diff --git a/README.md b/README.md index 291c1ff..a85bafd 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ 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. +[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. ## Features @@ -26,12 +26,12 @@ Do you want to store your chat history with LLMs from OpenAI, Amazon Bedrock(:wo ### Model comparison -Comparing models is a difficult task. `pykoi` makes it easy by allowing one to directly compare the performance of multiple models to each other, with just a few lines of code. If you have multiple language models that you’d like to compare to each other on a set of prompts or via an interactive session, you can use `pk.Compare`. Check out any of the demo below: +Comparing models is a difficult task. `pykoi` makes it easy by allowing one to directly compare the performance of multiple models to each other, with just a few lines of code. If you have multiple language models that you’d like to compare to each other on a set of prompts or via an interactive session, you can use `pk.Compare`. Check out any of the demo below: - If you're using a CPU instance, check out [demo_launch_app_cpu.ipynb](https://nbviewer.org/github/CambioML/pykoi/blob/main/example/chatbot/demo_model_comparator_openai.ipynb) - If you're using a GPU instance, check out [demo_launch_app_gpu.ipynb](https://nbviewer.org/github/CambioML/pykoi/blob/main/example/chatbot/demo_model_comparator_gpu_huggingface.ipynb) - Alternatively, read our [blog](https://www.cambioml.com/docs/model_comparison.html) for more information! - + ![Watch the video](example/image/pykoi_demo_model_comparison.gif) ### RLHF @@ -40,6 +40,19 @@ Reinforcement Learning with Human Feedback (RLHF) is a unique training paradigm `pykoi` allows you to easily fine-tune your model on the datasets you've collected via your `pykoi` chat or rank databases. Check our [blog](https://www.cambioml.com/docs/rlhf.html) for detailed instructions on how to use it. +### RAG +Implement a Retrieval-Augmented Generation (RAG) Chatbot quickly with `pykoi`. Upload your own documents to create context-aware responses on top of a pretrained LLM, such as from OpenAI or Huggingface. + +![Watch the video](example/image/pykoi_demo_rag_chatbot_upload.gif) + +Then chat with the RAG Chatbot, where you can select specific sources for the text generation, as well as see which sources the model used to generate the response. + +![Watch the video](example/image/pykoi_demo_rag_chatbot_chat.gif) + +Finally, you can save a modified response to help improve the model. This is a great way to collect data for RLHF. + +![Watch the video](example/image/pykoi_demo_rag_chatbot_modify.gif) + ## Installation 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). @@ -56,10 +69,10 @@ 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/locally/) ``` pip3 install "pykoi[rag]" -pip3 install torch +pip3 install torch ``` -### Option 2: RAG (GPU) +### 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. On your GPU instance terminal, create a conda environment using: @@ -74,7 +87,7 @@ 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) +### 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: @@ -89,7 +102,7 @@ pip3 install "pykoi[rlhf]" pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu121 # cu121 means cuda 12.1 ``` -Congrats you have finished the installation! +Congrats you have finished the installation! ## Dev Setup If you are interested to contribute to us, here are the preliminary development setup. @@ -104,15 +117,15 @@ pip3 install poetry 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) +- Option 1: RAG (CPU) ``` poetry install --no-root --extras rag ``` -- Option 2: RAG (GPU) +- Option 2: RAG (GPU) ``` poetry install --no-root --extras "rag huggingface" ``` -- Option 3: RLHF (GPU) +- Option 3: RLHF (GPU) ``` poetry install --no-root --extras rlhf ``` diff --git a/example/image/pykoi_demo_rag_chatbot_chat.gif b/example/image/pykoi_demo_rag_chatbot_chat.gif new file mode 100644 index 0000000..7ceca02 Binary files /dev/null and b/example/image/pykoi_demo_rag_chatbot_chat.gif differ diff --git a/example/image/pykoi_demo_rag_chatbot_modify.gif b/example/image/pykoi_demo_rag_chatbot_modify.gif new file mode 100644 index 0000000..374223b Binary files /dev/null and b/example/image/pykoi_demo_rag_chatbot_modify.gif differ diff --git a/example/image/pykoi_demo_rag_chatbot_upload.gif b/example/image/pykoi_demo_rag_chatbot_upload.gif new file mode 100644 index 0000000..f274087 Binary files /dev/null and b/example/image/pykoi_demo_rag_chatbot_upload.gif differ diff --git a/example/retrieval_qa/retrieval_qa_demo.py b/example/retrieval_qa/retrieval_qa_demo.py deleted file mode 100644 index 23d1c26..0000000 --- a/example/retrieval_qa/retrieval_qa_demo.py +++ /dev/null @@ -1,72 +0,0 @@ -"""Demo for the retrieval_qa application.""" - -import os -import argparse -from pykoi import Application -from pykoi.chat import QuestionAnswerDatabase -from pykoi.retrieval import RetrievalFactory -from pykoi.retrieval import VectorDbFactory -from pykoi.component import Chatbot, Dashboard, RetrievalQA - - -def main(**kargs): - # enter openai api key here - os.environ["OPENAI_API_KEY"] = "" - os.environ["DOC_PATH"] = os.path.join(os.getcwd(), "temp/docs") - os.environ["VECTORDB_PATH"] = os.path.join(os.getcwd(), "temp/vectordb") - MODEL_SOURCE = "openai" - - ##################################### - # Creating a retrieval QA component # - ##################################### - # vector database - vector_db = VectorDbFactory.create( - model_source=MODEL_SOURCE, vector_db_name=kargs.get("vectordb"), **kargs - ) - - # retrieval model with vector database - retrieval_model = RetrievalFactory.create( - model_source=MODEL_SOURCE, vector_db=vector_db - ) - - # 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()) - - ############################################################ - # Starting the application and retrieval qa as a component # - ############################################################ - # Create the application - app = Application(debug=False, share=False) - app.add_component(retriever) - app.add_component(chatbot) - app.add_component(dashboard) - app.run() - - -if __name__ == "__main__": - # Parse the command-line arguments - parser = argparse.ArgumentParser(description="Demo for the Retrieval QA.") - parser.add_argument( - "-vectordb", - type=str, - default="chroma", - help="Name of the vector database (default: 'chroma')", - ) - parser.add_argument( - "-host", - type=str, - default="localhost", - help="Host address if using Epsilla vector database", - ) - parser.add_argument( - "-port", - type=int, - default=8888, - help="Port number if using Epsilla vector database", - ) - args = parser.parse_args() - - # Call the main function with the vector_db_name argument - main(**vars(args)) diff --git a/example/retrieval_qa/retrieval_qa_huggingface_demo.py b/example/retrieval_qa/retrieval_qa_huggingface_demo.py index e42dcaf..9de0e8a 100644 --- a/example/retrieval_qa/retrieval_qa_huggingface_demo.py +++ b/example/retrieval_qa/retrieval_qa_huggingface_demo.py @@ -3,7 +3,7 @@ import os import argparse from pykoi import Application -from pykoi.chat import QuestionAnswerDatabase +from pykoi.chat import RAGDatabase from pykoi.retrieval import RetrievalFactory from pykoi.retrieval import VectorDbFactory from pykoi.component import Chatbot, Dashboard, RetrievalQA @@ -36,9 +36,9 @@ def main(**kwargs): ) # 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/example/flex/flex_demo.py b/example/retrieval_qa/retrieval_qa_openai_demo.py similarity index 98% rename from example/flex/flex_demo.py rename to example/retrieval_qa/retrieval_qa_openai_demo.py index 60bf66c..e02fcf7 100644 --- a/example/flex/flex_demo.py +++ b/example/retrieval_qa/retrieval_qa_openai_demo.py @@ -4,7 +4,6 @@ import argparse from dotenv import load_dotenv from pykoi import Application -from pykoi.chat import QuestionAnswerDatabase from pykoi.retrieval import RetrievalFactory from pykoi.retrieval import VectorDbFactory from pykoi.component import Chatbot, Dashboard, RetrievalQA diff --git a/pykoi/application.py b/pykoi/application.py index 05bedd8..238b0ac 100644 --- a/pykoi/application.py +++ b/pykoi/application.py @@ -644,13 +644,13 @@ 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} - ) - print("output", output, output["result"]) - if output["source_documents"] == []: + output = component["component"].retrieval_model.run_with_return_source_documents({"query": request_body.prompt}) + print('output', output, output["result"]) + if "source_documents" not in output: + print('no source documents', output) + source = ["N/A"] + source_content = ["N/A"] + elif output["source_documents"] == []: source = ["N/A"] source_content = ["N/A"] else: diff --git a/pykoi/frontend/dist/assets/index-10f2d9f3.css b/pykoi/frontend/dist/assets/index-10f2d9f3.css deleted file mode 100644 index 8a05e68..0000000 --- a/pykoi/frontend/dist/assets/index-10f2d9f3.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}dialog.svelte-g384pz.svelte-g384pz{max-width:32em;border-radius:1em;border:none;padding:0}dialog.svelte-g384pz.svelte-g384pz::backdrop{background:rgba(0,0,0,.3)}dialog.svelte-g384pz>div.svelte-g384pz{padding:1em}dialog[open].svelte-g384pz.svelte-g384pz{animation:svelte-g384pz-zoom .3s cubic-bezier(.34,1.56,.64,1)}@keyframes svelte-g384pz-zoom{0%{transform:scale(.95)}to{transform:scale(1)}}dialog[open].svelte-g384pz.svelte-g384pz::backdrop{animation:svelte-g384pz-fade .2s ease-out}@keyframes svelte-g384pz-fade{0%{opacity:0}to{opacity:1}}button.svelte-g384pz.svelte-g384pz{display:block}.close-button.svelte-g384pz.svelte-g384pz{display:block;height:30px;width:30px;border-radius:50%;border:1px solid var(--grey);padding:0}.close-button.svelte-g384pz.svelte-g384pz:hover{background-color:var(--lightGrey)}.btn-container.svelte-g384pz.svelte-g384pz{display:flex;justify-content:flex-end}.btn-container.svelte-sy2m0x.svelte-sy2m0x{display:flex;justify-content:center;padding-top:1em}div.inputs.svelte-sy2m0x.svelte-sy2m0x{display:grid;grid-template-columns:max-content max-content;grid-gap:5px}div.inputs.svelte-sy2m0x label.svelte-sy2m0x{text-align:right}h4.svelte-sy2m0x.svelte-sy2m0x{margin:20px 0}.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}.instructions.svelte-19cad35 button.svelte-19cad35{font-size:var(--smallText)}.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-vgv4ev.svelte-vgv4ev{display:grid;grid-template-columns:20% 80%;width:100%}.ranked-chat.svelte-vgv4ev.svelte-vgv4ev{height:100vh;display:grid;grid-template-columns:100%;grid-template-rows:80% 20%}.message.svelte-vgv4ev.svelte-vgv4ev{font-size:var(--smallText);padding-left:40px;padding-right:40px;margin:0 auto}.chat-input-holder.svelte-vgv4ev.svelte-vgv4ev{display:flex;flex-direction:column;align-items:center;padding:5px;width:100%;max-width:820px;margin:auto}.chat-input-textarea.svelte-vgv4ev.svelte-vgv4ev{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-vgv4ev.svelte-vgv4ev{display:flex;width:100%}.btnyousend.svelte-vgv4ev.svelte-vgv4ev{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-vgv4ev.svelte-vgv4ev{opacity:1}.green.svelte-vgv4ev.svelte-vgv4ev{border-bottom:2px solid var(--green)}.red.svelte-vgv4ev.svelte-vgv4ev{border-bottom:2px solid var(--red)}.instructions.svelte-vgv4ev.svelte-vgv4ev{text-align:center;padding:5%}.instructions.svelte-vgv4ev h5.svelte-vgv4ev{text-align:left}.instructions.svelte-vgv4ev p.svelte-vgv4ev{font-size:var(--smallText);text-align:left}.instructions.svelte-vgv4ev button.svelte-vgv4ev{font-size:var(--smallText)}.ranked-feedback-container.svelte-vgv4ev.svelte-vgv4ev{display:grid;grid-template-columns:20% 80%}.underline.svelte-vgv4ev.svelte-vgv4ev{border-bottom:var(--line)}.bold{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-vgv4ev.svelte-vgv4ev{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-vgv4ev.svelte-vgv4ev{flex:1;overflow-y:auto;padding:0 10px;box-sizing:border-box}.chat-message.svelte-vgv4ev.svelte-vgv4ev{background-color:var(--white);border-bottom:var(--line);box-sizing:border-box}.chat-message-center.svelte-vgv4ev.svelte-vgv4ev{display:flex;flex-direction:column;margin-left:auto;margin-right:auto;padding:12px;box-sizing:border-box}.message-content.svelte-vgv4ev.svelte-vgv4ev{display:flex;flex-direction:column;box-sizing:border-box}.message-content.svelte-vgv4ev .question.svelte-vgv4ev{text-align:left;border:1px solid var(--grey);padding:5px;background-color:var(--lightGrey)}.message-content.svelte-vgv4ev .answer.svelte-vgv4ev{display:inline-block;text-align:left;padding:10px;border:1px solid var(--black)}.message-content.svelte-vgv4ev .answers.svelte-vgv4ev{display:grid;grid-template-columns:100%;gap:0%;width:100%;margin:auto}.rag-sources.svelte-vgv4ev.svelte-vgv4ev{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-7imt18.svelte-7imt18{height:100vh;width:100%;display:flex;justify-content:center;align-items:center}button.svelte-7imt18.svelte-7imt18{margin:0}.chart-captions.svelte-7imt18.svelte-7imt18{margin:auto;width:100%;text-align:left;height:100%}.chart-captions.svelte-7imt18 h4.svelte-7imt18{padding:0;margin:0}.main-container.svelte-7imt18.svelte-7imt18{margin:auto}.eval-container.svelte-7imt18.svelte-7imt18{display:grid;height:100vh;grid-template-rows:100%;grid-template-columns:65% 35%;padding:1rem}.left-charts.svelte-7imt18.svelte-7imt18{display:grid;grid-template-columns:100%;grid-template-rows:15% 60% 25%}.eval-table.svelte-7imt18.svelte-7imt18{margin:auto;width:100%}.right-charts.svelte-7imt18.svelte-7imt18{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-fb0d7a3f.js b/pykoi/frontend/dist/assets/index-6fbf13ee.js similarity index 52% rename from pykoi/frontend/dist/assets/index-fb0d7a3f.js rename to pykoi/frontend/dist/assets/index-6fbf13ee.js index 086f063..6563f6e 100644 --- a/pykoi/frontend/dist/assets/index-fb0d7a3f.js +++ b/pykoi/frontend/dist/assets/index-6fbf13ee.js @@ -1,31 +1,31 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))l(o);new MutationObserver(o=>{for(const r of o)if(r.type==="childList")for(const s of r.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&l(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const r={};return o.integrity&&(r.integrity=o.integrity),o.referrerPolicy&&(r.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?r.credentials="include":o.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function l(o){if(o.ep)return;o.ep=!0;const r=n(o);fetch(o.href,r)}})();function U(){}const Js=e=>e;function Sn(e,t){for(const n in t)e[n]=t[n];return e}function Zs(e){return e()}function Jl(){return Object.create(null)}function be(e){e.forEach(Zs)}function Ge(e){return typeof e=="function"}function fe(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Fu(e){return Object.keys(e).length===0}function $l(e,...t){if(e==null)return U;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function Du(e){let t;return $l(e,n=>t=n)(),t}function ue(e,t,n){e.$$.on_destroy.push($l(t,n))}function Uo(e,t,n,l){if(e){const o=ea(e,t,n,l);return e[0](o)}}function ea(e,t,n,l){return e[1]&&l?Sn(n.ctx.slice(),e[1](l(t))):n.ctx}function Wo(e,t,n,l){if(e[2]&&l){const o=e[2](l(n));if(t.dirty===void 0)return o;if(typeof o=="object"){const r=[],s=Math.max(t.dirty.length,o.length);for(let u=0;u32){const t=[],n=e.ctx.length/32;for(let l=0;lwindow.performance.now():()=>Date.now(),Mo=ta?e=>requestAnimationFrame(e):U;const Xt=new Set;function la(e){Xt.forEach(t=>{t.c(e)||(Xt.delete(t),t.f())}),Xt.size!==0&&Mo(la)}function oa(e){let t;return Xt.size===0&&Mo(la),{promise:new Promise(n=>{Xt.add(t={c:e,f:n})}),abort(){Xt.delete(t)}}}let Rl=!1;function Iu(){Rl=!0}function Nu(){Rl=!1}function Pu(e,t,n,l){for(;e>1);n(o)<=l?e=o+1:t=o}return e}function Tu(e){if(e.hydrate_init)return;e.hydrate_init=!0;let t=e.childNodes;if(e.nodeName==="HEAD"){const a=[];for(let f=0;f0&&t[n[o]].claim_order<=f?o+1:Pu(1,o,g=>t[n[g]].claim_order,f))-1;l[a]=n[c]+1;const d=c+1;n[d]=a,o=Math.max(d,o)}const r=[],s=[];let u=t.length-1;for(let a=n[o]+1;a!=0;a=l[a-1]){for(r.push(t[a-1]);u>=a;u--)s.push(t[u]);u--}for(;u>=0;u--)s.push(t[u]);r.reverse(),s.sort((a,f)=>a.claim_order-f.claim_order);for(let a=0,f=0;a=r[f].claim_order;)f++;const c=fe.removeEventListener(t,n,l)}function qu(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function Hu(e){return function(t){t.target===this&&e.call(this,t)}}function h(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function Gu(e){return Array.from(e.childNodes)}function Bu(e){e.claim_info===void 0&&(e.claim_info={last_index:0,total_claimed:0})}function ju(e,t,n,l,o=!1){Bu(e);const r=(()=>{for(let s=e.claim_info.last_index;s=0;s--){const u=e[s];if(t(u)){const a=n(u);return a===void 0?e.splice(s,1):e[s]=a,o?a===void 0&&e.claim_info.last_index--:e.claim_info.last_index=s,u}}return l()})();return r.claim_order=e.claim_info.total_claimed,e.claim_info.total_claimed+=1,r}function xu(e,t){return ju(e,n=>n.nodeType===3,n=>{const l=""+t;if(n.data.startsWith(l)){if(n.data.length!==l.length)return n.splitText(l.length)}else n.data=l},()=>q(t),!0)}function K(e,t){t=""+t,e.data!==t&&(e.data=t)}function Ye(e,t){e.value=t??""}function Ae(e,t,n,l){n==null?e.style.removeProperty(t):e.style.setProperty(t,n,l?"important":"")}function ll(e,t,n){for(let l=0;l{s.source===l.contentWindow&&t()})):(l.src="about:blank",l.onload=()=>{r=x(l.contentWindow,"resize",t),t()}),b(e,l),()=>{(o||r&&l.contentWindow)&&r(),P(l)}}function Pt(e,t,n){e.classList[n?"add":"remove"](t)}function Wu(e,t,{bubbles:n=!1,cancelable:l=!1}={}){const o=document.createEvent("CustomEvent");return o.initCustomEvent(e,n,l,t),o}function Rt(e,t){return new e(t)}const ol=new Map;let il=0;function Xu(e){let t=5381,n=e.length;for(;n--;)t=(t<<5)-t^e.charCodeAt(n);return t>>>0}function Yu(e,t){const n={stylesheet:Ou(t),rules:{}};return ol.set(e,n),n}function Ko(e,t,n,l,o,r,s,u=0){const a=16.666/l;let f=`{ +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))l(o);new MutationObserver(o=>{for(const r of o)if(r.type==="childList")for(const s of r.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&l(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const r={};return o.integrity&&(r.integrity=o.integrity),o.referrerPolicy&&(r.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?r.credentials="include":o.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function l(o){if(o.ep)return;o.ep=!0;const r=n(o);fetch(o.href,r)}})();function U(){}const Zs=e=>e;function $n(e,t){for(const n in t)e[n]=t[n];return e}function ea(e){return e()}function Zl(){return Object.create(null)}function ve(e){e.forEach(ea)}function Ve(e){return typeof e=="function"}function fe(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Iu(e){return Object.keys(e).length===0}function Al(e,...t){if(e==null)return U;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function Nu(e){let t;return Al(e,n=>t=n)(),t}function ue(e,t,n){e.$$.on_destroy.push(Al(t,n))}function Uo(e,t,n,l){if(e){const o=ta(e,t,n,l);return e[0](o)}}function ta(e,t,n,l){return e[1]&&l?$n(n.ctx.slice(),e[1](l(t))):n.ctx}function Wo(e,t,n,l){if(e[2]&&l){const o=e[2](l(n));if(t.dirty===void 0)return o;if(typeof o=="object"){const r=[],s=Math.max(t.dirty.length,o.length);for(let u=0;u32){const t=[],n=e.ctx.length/32;for(let l=0;lwindow.performance.now():()=>Date.now(),Mo=na?e=>requestAnimationFrame(e):U;const Yt=new Set;function oa(e){Yt.forEach(t=>{t.c(e)||(Yt.delete(t),t.f())}),Yt.size!==0&&Mo(oa)}function ia(e){let t;return Yt.size===0&&Mo(oa),{promise:new Promise(n=>{Yt.add(t={c:e,f:n})}),abort(){Yt.delete(t)}}}let Rl=!1;function Pu(){Rl=!0}function Tu(){Rl=!1}function Ou(e,t,n,l){for(;e>1);n(o)<=l?e=o+1:t=o}return e}function Vu(e){if(e.hydrate_init)return;e.hydrate_init=!0;let t=e.childNodes;if(e.nodeName==="HEAD"){const a=[];for(let f=0;f0&&t[n[o]].claim_order<=f?o+1:Ou(1,o,p=>t[n[p]].claim_order,f))-1;l[a]=n[c]+1;const d=c+1;n[d]=a,o=Math.max(d,o)}const r=[],s=[];let u=t.length-1;for(let a=n[o]+1;a!=0;a=l[a-1]){for(r.push(t[a-1]);u>=a;u--)s.push(t[u]);u--}for(;u>=0;u--)s.push(t[u]);r.reverse(),s.sort((a,f)=>a.claim_order-f.claim_order);for(let a=0,f=0;a=r[f].claim_order;)f++;const c=fe.removeEventListener(t,n,l)}function Gu(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function Bu(e){return function(t){t.target===this&&e.call(this,t)}}function h(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function ju(e){return Array.from(e.childNodes)}function xu(e){e.claim_info===void 0&&(e.claim_info={last_index:0,total_claimed:0})}function Uu(e,t,n,l,o=!1){xu(e);const r=(()=>{for(let s=e.claim_info.last_index;s=0;s--){const u=e[s];if(t(u)){const a=n(u);return a===void 0?e.splice(s,1):e[s]=a,o?a===void 0&&e.claim_info.last_index--:e.claim_info.last_index=s,u}}return l()})();return r.claim_order=e.claim_info.total_claimed,e.claim_info.total_claimed+=1,r}function Wu(e,t){return Uu(e,n=>n.nodeType===3,n=>{const l=""+t;if(n.data.startsWith(l)){if(n.data.length!==l.length)return n.splitText(l.length)}else n.data=l},()=>q(t),!0)}function K(e,t){t=""+t,e.data!==t&&(e.data=t)}function Ye(e,t){e.value=t??""}function Re(e,t,n,l){n==null?e.style.removeProperty(t):e.style.setProperty(t,n,l?"important":"")}function ol(e,t,n){for(let l=0;l{s.source===l.contentWindow&&t()})):(l.src="about:blank",l.onload=()=>{r=x(l.contentWindow,"resize",t),t()}),b(e,l),()=>{(o||r&&l.contentWindow)&&r(),N(l)}}function Tt(e,t,n){e.classList[n?"add":"remove"](t)}function Yu(e,t,{bubbles:n=!1,cancelable:l=!1}={}){const o=document.createEvent("CustomEvent");return o.initCustomEvent(e,n,l,t),o}function At(e,t){return new e(t)}const il=new Map;let rl=0;function Qu(e){let t=5381,n=e.length;for(;n--;)t=(t<<5)-t^e.charCodeAt(n);return t>>>0}function Ku(e,t){const n={stylesheet:zu(t),rules:{}};return il.set(e,n),n}function Ko(e,t,n,l,o,r,s,u=0){const a=16.666/l;let f=`{ `;for(let v=0;v<=1;v+=a){const y=t+(n-t)*r(v);f+=v*100+`%{${s(y,1-y)}} `}const c=f+`100% {${s(n,1-n)}} -}`,d=`__svelte_${Xu(c)}_${u}`,g=ia(e),{stylesheet:p,rules:m}=ol.get(g)||Yu(g,e);m[d]||(m[d]=!0,p.insertRule(`@keyframes ${d} ${c}`,p.cssRules.length));const _=e.style.animation||"";return e.style.animation=`${_?`${_}, `:""}${d} ${l}ms linear ${o}ms 1 both`,il+=1,d}function Qu(e,t){const n=(e.style.animation||"").split(", "),l=n.filter(t?r=>r.indexOf(t)<0:r=>r.indexOf("__svelte")===-1),o=n.length-l.length;o&&(e.style.animation=l.join(", "),il-=o,il||Ku())}function Ku(){Mo(()=>{il||(ol.forEach(e=>{const{ownerNode:t}=e.stylesheet;t&&P(t)}),ol.clear())})}let Zt;function Ot(e){Zt=e}function Ju(){if(!Zt)throw new Error("Function called outside component initialization");return Zt}function ft(e){Ju().$$.on_mount.push(e)}function Zu(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach(l=>l.call(this,t))}const xt=[],et=[];let Yt=[];const Zl=[],ef=Promise.resolve();let eo=!1;function tf(){eo||(eo=!0,ef.then(sa))}function Me(e){Yt.push(e)}function $n(e){Zl.push(e)}const El=new Set;let Ht=0;function sa(){if(Ht!==0)return;const e=Zt;do{try{for(;Hte.indexOf(l)===-1?t.push(l):n.push(l)),n.forEach(l=>l()),Yt=t}let sn;function of(){return sn||(sn=Promise.resolve(),sn.then(()=>{sn=null})),sn}function Fl(e,t,n){e.dispatchEvent(Wu(`${t?"intro":"outro"}${n}`))}const Qn=new Set;let dt;function we(){dt={r:0,c:[],p:dt}}function ye(){dt.r||be(dt.c),dt=dt.p}function V(e,t){e&&e.i&&(Qn.delete(e),e.i(t))}function z(e,t,n,l){if(e&&e.o){if(Qn.has(e))return;Qn.add(e),dt.c.push(()=>{Qn.delete(e),l&&(n&&e.d(1),l())}),e.o(t)}else l&&l()}const rf={duration:0};function lt(e,t,n,l){const o={direction:"both"};let r=t(e,n,o),s=l?0:1,u=null,a=null,f=null;function c(){f&&Qu(e,f)}function d(p,m){const _=p.b-s;return m*=Math.abs(_),{a:s,b:p.b,d:_,duration:m,start:p.start,end:p.start+m,group:p.group}}function g(p){const{delay:m=0,duration:_=300,easing:v=Js,tick:y=U,css:w}=r||rf,S={start:na()+m,b:p};p||(S.group=dt,dt.r+=1),u||a?a=S:(w&&(c(),f=Ko(e,s,p,_,m,v,w)),p&&y(0,1),u=d(S,_),Me(()=>Fl(e,p,"start")),oa(M=>{if(a&&M>a.start&&(u=d(a,_),a=null,Fl(e,u.b,"start"),w&&(c(),f=Ko(e,s,u.b,u.duration,0,v,r.css))),u){if(M>=u.end)y(s=u.b,1-s),Fl(e,u.b,"end"),a||(u.b?c():--u.group.r||be(u.group.c)),u=null;else if(M>=u.start){const $=M-u.start;s=u.a+u.d*v($/u.duration),y(s,1-s)}}return!!(u||a)}))}return{run(p){Ge(r)?of().then(()=>{r=r(o),g(p)}):g(p)},end(){c(),u=a=null}}}function zt(e,t){e.d(1),t.delete(e.key)}function aa(e,t){z(e,1,1,()=>{t.delete(e.key)})}function gt(e,t,n,l,o,r,s,u,a,f,c,d){let g=e.length,p=r.length,m=g;const _={};for(;m--;)_[e[m].key]=m;const v=[],y=new Map,w=new Map,S=[];for(m=p;m--;){const C=d(o,r,m),R=n(C);let k=s.get(R);k?l&&S.push(()=>k.p(C,t)):(k=f(R,C),k.c()),y.set(R,v[m]=k),R in _&&w.set(R,Math.abs(m-_[R]))}const M=new Set,$=new Set;function F(C){V(C,1),C.m(u,c),s.set(C.key,C),c=C.first,p--}for(;g&&p;){const C=v[p-1],R=e[g-1],k=C.key,E=R.key;C===R?(c=C.first,g--,p--):y.has(E)?!s.has(k)||M.has(k)?F(C):$.has(E)?g--:w.get(k)>w.get(E)?($.add(k),F(C)):(M.add(E),g--):(a(R,s),g--)}for(;g--;){const C=e[g];y.has(C.key)||a(C,s)}for(;p;)F(v[p-1]);return be(S),v}function ua(e,t){const n={},l={},o={$$scope:1};let r=e.length;for(;r--;){const s=e[r],u=t[r];if(u){for(const a in s)a in u||(l[a]=1);for(const a in u)o[a]||(n[a]=u[a],o[a]=1);e[r]=u}else for(const a in s)o[a]=1}for(const s in l)s in n||(n[s]=void 0);return n}function fa(e){return typeof e=="object"&&e!==null?e:{}}const sf=/[&"]/g,af=/[&<]/g;function uf(e,t=!1){const n=String(e),l=t?sf:af;l.lastIndex=0;let o="",r=0;for(;l.test(n);){const s=l.lastIndex-1,u=n[s];o+=n.substring(r,s)+(u==="&"?"&":u==='"'?""":"<"),r=s+1}return o+n.substring(r)}function ff(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 Dl;function ca(e){function t(n,l,o,r,s){const u=Zt,a={on_destroy:Dl,context:new Map(s||(u?u.$$.context:[])),on_mount:[],before_update:[],after_update:[],callbacks:Jl()};Ot({$$:a});const f=e(n,l,o,r);return Ot(u),f}return{render:(n={},{$$slots:l={},context:o=new Map}={})=>{Dl=[];const r={title:"",head:"",css:new Set},s=t(r,n,{},l,o);return be(Dl),{html:s,css:{code:Array.from(r.css).map(u=>u.code).join(` -`),map:null},head:r.title+r.head}},$$render:t}}function Rn(e,t,n){const l=e.$$.props[t];l!==void 0&&(e.$$.bound[l]=n,n(e.$$.ctx[l]))}function ne(e){e&&e.c()}function cf(e,t){e&&e.l(t)}function ee(e,t,n,l){const{fragment:o,after_update:r}=e.$$;o&&o.m(t,n),l||Me(()=>{const s=e.$$.on_mount.map(Zs).filter(Ge);e.$$.on_destroy?e.$$.on_destroy.push(...s):be(s),e.$$.on_mount=[]}),r.forEach(Me)}function te(e,t){const n=e.$$;n.fragment!==null&&(lf(n.after_update),be(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function df(e,t){e.$$.dirty[0]===-1&&(xt.push(e),tf(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const m=p.length?p[0]:g;return f.ctx&&o(f.ctx[d],f.ctx[d]=m)&&(!f.skip_bound&&f.bound[d]&&f.bound[d](m),c&&df(e,d)),g}):[],f.update(),c=!0,be(f.before_update),f.fragment=l?l(f.ctx):!1,t.target){if(t.hydrate){Iu();const d=Gu(t.target);f.fragment&&f.fragment.l(d),d.forEach(P)}else f.fragment&&f.fragment.c();t.intro&&V(e.$$.fragment),ee(e,t.target,t.anchor,t.customElement),Nu(),sa()}Ot(a)}class ce{$destroy(){te(this,1),this.$destroy=U}$on(t,n){if(!Ge(n))return U;const l=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return l.push(n),()=>{const o=l.indexOf(n);o!==-1&&l.splice(o,1)}}$set(t){this.$$set&&!Fu(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Gt=[];function to(e,t){return{subscribe:De(e,t).subscribe}}function De(e,t=U){let n;const l=new Set;function o(u){if(fe(e,u)&&(e=u,n)){const a=!Gt.length;for(const f of l)f[1](),Gt.push(f,e);if(a){for(let f=0;f{l.delete(f),l.size===0&&n&&(n(),n=null)}}return{set:o,update:r,subscribe:s}}function hf(e,t,n){const l=!Array.isArray(e),o=l?[e]:e,r=t.length<2;return to(n,s=>{let u=!1;const a=[];let f=0,c=U;const d=()=>{if(f)return;c();const p=t(l?a[0]:a,s);r?s(p):c=Ge(p)?p:U},g=o.map((p,m)=>$l(p,_=>{a[m]=_,f&=~(1<{f|=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 l=t.map((o,r)=>no(e[r],o));return o=>l.map(r=>r(o))}if(n==="object"){if(!e||!t)throw new Error("Object cannot be null");if(Jo(e)&&Jo(t)){e=e.getTime(),t=t.getTime();const r=t-e;return s=>new Date(e+s*r)}const l=Object.keys(t),o={};return l.forEach(r=>{o[r]=no(e[r],t[r])}),r=>{const s={};return l.forEach(u=>{s[u]=o[u](r)}),s}}if(n==="number"){const l=t-e;return o=>e+o*l}throw new Error(`Cannot interpolate ${n} values`)}function Fo(e,t={}){const n=De(e);let l,o=e;function r(s,u){if(e==null)return n.set(e=s),Promise.resolve();o=s;let a=l,f=!1,{delay:c=0,duration:d=400,easing:g=Js,interpolate:p=no}=Sn(Sn({},t),u);if(d===0)return a&&(a.abort(),a=null),n.set(e=o),Promise.resolve();const m=na()+c;let _;return l=oa(v=>{if(vd?(n.set(e=s),!1):(n.set(e=_(g(y/d))),!0)}),l.promise}return{set:r,update:(s,u)=>r(s(o,e),u),subscribe:n.subscribe}}const qe=De([]),Il=De([]),an=De([]),An=De([]),st=De("all"),Zo=De({"n/a":1,up:1,down:1}),gf=["who","what","how","why","where","does","can","n/a"],lo=Fo(gf.map(e=>({question:e,count:0}))),oo=De(new Set);var io="http://www.w3.org/1999/xhtml";const ei={svg:"http://www.w3.org/2000/svg",xhtml:io,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function da(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ei.hasOwnProperty(t)?{space:ei[t],local:e}:e}function pf(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===io&&t.documentElement.namespaceURI===io?t.createElement(e):t.createElementNS(n,e)}}function mf(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ha(e){var t=da(e);return(t.local?mf:pf)(t)}function _f(){}function ga(e){return e==null?_f:function(){return this.querySelector(e)}}function vf(e){typeof e!="function"&&(e=ga(e));for(var t=this._groups,n=t.length,l=new Array(n),o=0;o=S&&(S=w+1);!($=v[S])&&++S=0;)(s=l[o])&&(r&&s.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(s,r),r=s);return this}function jf(e){e||(e=xf);function t(d,g){return d&&g?e(d.__data__,g.__data__):!d-!g}for(var n=this._groups,l=n.length,o=new Array(l),r=0;rt?1:e>=t?0:NaN}function Uf(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Wf(){return Array.from(this)}function Xf(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?ic:typeof t=="function"?sc:rc)(e,t,n??"")):uc(this.node(),e)}function uc(e,t){return e.style.getPropertyValue(t)||va(e).getComputedStyle(e,null).getPropertyValue(t)}function fc(e){return function(){delete this[e]}}function cc(e,t){return function(){this[e]=t}}function dc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function hc(e,t){return arguments.length>1?this.each((t==null?fc:typeof t=="function"?dc:cc)(e,t)):this.node()[e]}function ba(e){return e.trim().split(/^|\s+/)}function Do(e){return e.classList||new wa(e)}function wa(e){this._node=e,this._names=ba(e.getAttribute("class")||"")}wa.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 ya(e,t){for(var n=Do(e),l=-1,o=t.length;++l=0&&(n=t.slice(l+1),t=t.slice(0,l)),{type:t,name:n}})}function Hc(e){return function(){var t=this.__on;if(t){for(var n=0,l=-1,o=t.length,r;n({}),ti=e=>({});function Qc(e){let t,n,l,o,r,s,u,a,f;const c=e[4].header,d=Uo(c,e,e[3],ti),g=e[4].default,p=Uo(g,e,e[3],null);return{c(){t=A("dialog"),n=A("div"),l=A("div"),o=A("button"),o.textContent="X",r=N(),d&&d.c(),s=N(),p&&p.c(),h(o,"class","close-button svelte-g384pz"),h(l,"class","btn-container svelte-g384pz"),h(n,"class","svelte-g384pz"),h(t,"class","svelte-g384pz")},m(m,_){T(m,t,_),b(t,n),b(n,l),b(l,o),b(n,r),d&&d.m(n,null),b(n,s),p&&p.m(n,null),e[6](t),u=!0,a||(f=[x(o,"click",function(){Ge(e[1])&&e[1].apply(this,arguments)}),x(n,"click",qu(e[5])),x(t,"close",function(){Ge(e[1])&&e[1].apply(this,arguments)}),x(t,"click",Hu(function(){Ge(e[1])&&e[1].apply(this,arguments)}))],a=!0)},p(m,[_]){e=m,d&&d.p&&(!u||_&8)&&Xo(d,c,e,e[3],u?Wo(c,e[3],_,Yc):Yo(e[3]),ti),p&&p.p&&(!u||_&8)&&Xo(p,g,e,e[3],u?Wo(g,e[3],_,null):Yo(e[3]),null)},i(m){u||(V(d,m),V(p,m),u=!0)},o(m){z(d,m),z(p,m),u=!1},d(m){m&&P(t),d&&d.d(m),p&&p.d(m),e[6](null),a=!1,be(f)}}}function Kc(e,t,n){let{$$slots:l={},$$scope:o}=t,{showModal:r}=t,{dialog:s}=t,{handleClose:u}=t;function a(c){Zu.call(this,e,c)}function f(c){et[c?"unshift":"push"](()=>{s=c,n(0,s)})}return e.$$set=c=>{"showModal"in c&&n(2,r=c.showModal),"dialog"in c&&n(0,s=c.dialog),"handleClose"in c&&n(1,u=c.handleClose),"$$scope"in c&&n(3,o=c.$$scope)},e.$$.update=()=>{e.$$.dirty&5&&s&&r&&s.showModal()},[s,u,r,o,l,a,f]}class Jc extends ce{constructor(t){super(),de(this,t,Kc,Qc,fe,{showModal:2,dialog:0,handleClose:1})}}function ni(e){let t,n,l,o,r,s,u,a,f;return{c(){t=A("form"),n=A("div"),l=A("label"),l.textContent="Filename",o=N(),r=A("input"),s=N(),u=A("div"),u.innerHTML='',h(l,"for","file_name"),h(l,"class","svelte-sy2m0x"),h(r,"type","text"),h(r,"placeholder","Please enter filename"),h(r,"name","file_name"),r.required=!0,h(n,"class","inputs svelte-sy2m0x"),h(u,"class","btn-container svelte-sy2m0x")},m(c,d){T(c,t,d),b(t,n),b(n,l),b(n,o),b(n,r),Ye(r,e[2]),b(t,s),b(t,u),a||(f=[x(r,"input",e[9]),x(t,"submit",e[6])],a=!0)},p(c,d){d&4&&r.value!==c[2]&&Ye(r,c[2])},d(c){c&&P(t),a=!1,be(f)}}}function li(e){let t,n,l,o,r,s,u,a,f;return{c(){t=A("div"),n=q("✅ Data downloaded to /pykoi/"),l=q(e[2]),o=q(".csv"),r=N(),s=A("div"),u=A("button"),u.textContent="Close",h(s,"class","btn-container svelte-sy2m0x")},m(c,d){T(c,t,d),b(t,n),b(t,l),b(t,o),T(c,r,d),T(c,s,d),b(s,u),a||(f=x(u,"click",e[7]),a=!0)},p(c,d){d&4&&K(l,c[2])},d(c){c&&P(t),c&&P(r),c&&P(s),a=!1,f()}}}function oi(e){let t,n,l,o,r,s,u,a;return{c(){t=A("div"),t.textContent="⚠️ Download failed. Please try again.",n=N(),l=A("div"),o=A("button"),o.textContent="Retry",r=N(),s=A("button"),s.textContent="Close",h(l,"class","btn-container svelte-sy2m0x")},m(f,c){T(f,t,c),T(f,n,c),T(f,l,c),b(l,o),b(l,r),b(l,s),u||(a=[x(o,"click",e[10]),x(s,"click",e[7])],u=!0)},p:U,d(f){f&&P(t),f&&P(n),f&&P(l),u=!1,be(a)}}}function ii(e){let t,n,l,o,r,s,u,a,f,c,d;return{c(){t=A("div"),n=q("⚠️ "),l=q(e[2]),o=q(".csv already exists. Do you wish to overwrite it?"),r=N(),s=A("div"),u=A("button"),u.textContent="Back",a=N(),f=A("button"),f.textContent="Overwrite",h(s,"class","btn-container svelte-sy2m0x")},m(g,p){T(g,t,p),b(t,n),b(t,l),b(t,o),T(g,r,p),T(g,s,p),b(s,u),b(s,a),b(s,f),c||(d=[x(u,"click",e[11]),x(f,"click",e[12])],c=!0)},p(g,p){p&4&&K(l,g[2])},d(g){g&&P(t),g&&P(r),g&&P(s),c=!1,be(d)}}}function Zc(e){let t,n,l,o,r=e[3]===e[4].FILE_INPUT&&ni(e),s=e[3]===e[4].DOWNLOADED&&li(e),u=e[3]===e[4].FAILED_DOWNLOAD&&oi(e),a=e[3]===e[4].OVERWRITE&&ii(e);return{c(){r&&r.c(),t=N(),s&&s.c(),n=N(),u&&u.c(),l=N(),a&&a.c(),o=Se()},m(f,c){r&&r.m(f,c),T(f,t,c),s&&s.m(f,c),T(f,n,c),u&&u.m(f,c),T(f,l,c),a&&a.m(f,c),T(f,o,c)},p(f,c){f[3]===f[4].FILE_INPUT?r?r.p(f,c):(r=ni(f),r.c(),r.m(t.parentNode,t)):r&&(r.d(1),r=null),f[3]===f[4].DOWNLOADED?s?s.p(f,c):(s=li(f),s.c(),s.m(n.parentNode,n)):s&&(s.d(1),s=null),f[3]===f[4].FAILED_DOWNLOAD?u?u.p(f,c):(u=oi(f),u.c(),u.m(l.parentNode,l)):u&&(u.d(1),u=null),f[3]===f[4].OVERWRITE?a?a.p(f,c):(a=ii(f),a.c(),a.m(o.parentNode,o)):a&&(a.d(1),a=null)},d(f){r&&r.d(f),f&&P(t),s&&s.d(f),f&&P(n),u&&u.d(f),f&&P(l),a&&a.d(f),f&&P(o)}}}function ed(e){let t;return{c(){t=A("h4"),t.textContent="Download Data",h(t,"slot","header"),h(t,"class","svelte-sy2m0x")},m(n,l){T(n,t,l)},p:U,d(n){n&&P(t)}}}function td(e){let t,n,l,o;function r(a){e[13](a)}function s(a){e[14](a)}let u={handleClose:e[7],$$slots:{header:[ed],default:[Zc]},$$scope:{ctx:e}};return e[0]!==void 0&&(u.showModal=e[0]),e[1]!==void 0&&(u.dialog=e[1]),t=new Jc({props:u}),et.push(()=>Rn(t,"showModal",r)),et.push(()=>Rn(t,"dialog",s)),{c(){ne(t.$$.fragment)},m(a,f){ee(t,a,f),o=!0},p(a,[f]){const c={};f&32780&&(c.$$scope={dirty:f,ctx:a}),!n&&f&1&&(n=!0,c.showModal=a[0],$n(()=>n=!1)),!l&&f&2&&(l=!0,c.dialog=a[1],$n(()=>l=!1)),t.$set(c)},i(a){o||(V(t.$$.fragment,a),o=!0)},o(a){z(t.$$.fragment,a),o=!1},d(a){te(t,a)}}}function nd(e,t,n){let{showModal:l,table:o}=t,r,s="";const u={FILE_INPUT:0,DOWNLOADED:1,FAILED_DOWNLOAD:2,OVERWRITE:3};let a=u.FILE_INPUT;const f=async w=>{const S={file_name:w},$=await(await fetch(`/chat/${o}/save_to_csv`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(S)})).json();console.log("Download Complete: ",$),$.status==="200"?(console.log("success"),n(3,a=u.DOWNLOADED)):(console.log("failed"),n(3,a=u.FAILED_DOWNLOAD))},c=async w=>{w.preventDefault();const S=await fetch(`/file_exists/?file_name=${s}.csv`),{file_exists:M}=await S.json();M===!0?n(3,a=u.OVERWRITE):f(s)};function d(){n(0,l=!1),n(3,a=u.FILE_INPUT),r.close()}function g(){s=this.value,n(2,s)}const p=()=>n(3,a=u.FILE_INPUT),m=()=>n(3,a=u.FILE_INPUT),_=()=>f(s);function v(w){l=w,n(0,l)}function y(w){r=w,n(1,r)}return e.$$set=w=>{"showModal"in w&&n(0,l=w.showModal),"table"in w&&n(8,o=w.table)},[l,r,s,a,u,f,c,d,o,g,p,m,_,v,y]}class Io extends ce{constructor(t){super(),de(this,t,nd,td,fe,{showModal:0,table:8})}}function ri(e,t,n){const l=e.slice();return l[19]=t[n],l[21]=n,l}function si(e){let t,n,l,o,r,s;function u(...f){return e[12](e[21],...f)}function a(...f){return e[13](e[21],...f)}return{c(){t=A("div"),n=A("button"),n.textContent="👍",l=N(),o=A("button"),o.textContent="👎",h(n,"class","small-button thumbs-up svelte-19cad35"),h(o,"class","small-button thumbs-down svelte-19cad35"),h(t,"class","feedback-buttons svelte-19cad35")},m(f,c){T(f,t,c),b(t,n),b(t,l),b(t,o),r||(s=[x(n,"click",u),x(o,"click",a)],r=!0)},p(f,c){e=f},d(f){f&&P(t),r=!1,be(s)}}}function ai(e,t){let n,l,o,r,s,u,a,f,c,d=t[19].question+"",g,p,m,_,v,y,w,S=t[19].answer+"",M,$,F,C,R,k,E=t[0]&&si(t);return{key:e,first:null,c(){n=A("div"),l=A("div"),o=A("div"),r=N(),s=A("div"),u=A("div"),a=A("h5"),a.textContent="Question:",f=N(),c=A("p"),g=q(d),p=N(),m=A("div"),_=A("div"),v=A("h5"),v.textContent="Response:",y=N(),w=A("p"),M=q(S),$=N(),E&&E.c(),F=N(),h(o,"class","avatar"),h(a,"class","bold svelte-19cad35"),h(u,"class","question svelte-19cad35"),h(v,"class","bold svelte-19cad35"),h(_,"class","answer svelte-19cad35"),h(m,"class","answers svelte-19cad35"),h(s,"class","message-content svelte-19cad35"),h(l,"class","chat-message-center svelte-19cad35"),h(n,"class","chat-message svelte-19cad35"),this.first=n},m(I,D){T(I,n,D),b(n,l),b(l,o),b(l,r),b(l,s),b(s,u),b(u,a),b(u,f),b(u,c),b(c,g),b(s,p),b(s,m),b(m,_),b(_,v),b(_,y),b(_,w),b(w,M),b(_,$),E&&E.m(_,null),b(n,F),R||(k=Cn(C=od.call(null,n,t[21]===t[5].length-1)),R=!0)},p(I,D){t=I,D&32&&d!==(d=t[19].question+"")&&K(g,d),D&32&&S!==(S=t[19].answer+"")&&K(M,S),t[0]?E?E.p(t,D):(E=si(t),E.c(),E.m(_,null)):E&&(E.d(1),E=null),C&&Ge(C.update)&&D&32&&C.update.call(null,t[21]===t[5].length-1)},d(I){I&&P(n),E&&E.d(),R=!1,k()}}}function ld(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m,_=[],v=new Map,y,w,S,M,$,F,C=(e[3]?e[4]:"Send")+"",R,k,E,I,D,L,O;function B(W){e[11](W)}let j={table:"qa_table"};e[1]!==void 0&&(j.showModal=e[1]),t=new Io({props:j}),et.push(()=>Rn(t,"showModal",B));let ae=e[5];const pe=W=>W[21];for(let W=0;Wr.indexOf(t)<0:r=>r.indexOf("__svelte")===-1),o=n.length-l.length;o&&(e.style.animation=l.join(", "),rl-=o,rl||Zu())}function Zu(){Mo(()=>{rl||(il.forEach(e=>{const{ownerNode:t}=e.stylesheet;t&&N(t)}),il.clear())})}let tn;function Vt(e){tn=e}function ef(){if(!tn)throw new Error("Function called outside component initialization");return tn}function ft(e){ef().$$.on_mount.push(e)}function tf(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach(l=>l.call(this,t))}const Ut=[],et=[];let Qt=[];const eo=[],nf=Promise.resolve();let to=!1;function lf(){to||(to=!0,nf.then(aa))}function Me(e){Qt.push(e)}function An(e){eo.push(e)}const Fl=new Set;let Gt=0;function aa(){if(Gt!==0)return;const e=tn;do{try{for(;Gte.indexOf(l)===-1?t.push(l):n.push(l)),n.forEach(l=>l()),Qt=t}let un;function sf(){return un||(un=Promise.resolve(),un.then(()=>{un=null})),un}function Dl(e,t,n){e.dispatchEvent(Yu(`${t?"intro":"outro"}${n}`))}const Kn=new Set;let dt;function we(){dt={r:0,c:[],p:dt}}function ye(){dt.r||ve(dt.c),dt=dt.p}function V(e,t){e&&e.i&&(Kn.delete(e),e.i(t))}function z(e,t,n,l){if(e&&e.o){if(Kn.has(e))return;Kn.add(e),dt.c.push(()=>{Kn.delete(e),l&&(n&&e.d(1),l())}),e.o(t)}else l&&l()}const af={duration:0};function lt(e,t,n,l){const o={direction:"both"};let r=t(e,n,o),s=l?0:1,u=null,a=null,f=null;function c(){f&&Ju(e,f)}function d(g,m){const _=g.b-s;return m*=Math.abs(_),{a:s,b:g.b,d:_,duration:m,start:g.start,end:g.start+m,group:g.group}}function p(g){const{delay:m=0,duration:_=300,easing:v=Zs,tick:y=U,css:w}=r||af,S={start:la()+m,b:g};g||(S.group=dt,dt.r+=1),u||a?a=S:(w&&(c(),f=Ko(e,s,g,_,m,v,w)),g&&y(0,1),u=d(S,_),Me(()=>Dl(e,g,"start")),ia(M=>{if(a&&M>a.start&&(u=d(a,_),a=null,Dl(e,u.b,"start"),w&&(c(),f=Ko(e,s,u.b,u.duration,0,v,r.css))),u){if(M>=u.end)y(s=u.b,1-s),Dl(e,u.b,"end"),a||(u.b?c():--u.group.r||ve(u.group.c)),u=null;else if(M>=u.start){const $=M-u.start;s=u.a+u.d*v($/u.duration),y(s,1-s)}}return!!(u||a)}))}return{run(g){Ve(r)?sf().then(()=>{r=r(o),p(g)}):p(g)},end(){c(),u=a=null}}}function Lt(e,t){e.d(1),t.delete(e.key)}function ua(e,t){z(e,1,1,()=>{t.delete(e.key)})}function gt(e,t,n,l,o,r,s,u,a,f,c,d){let p=e.length,g=r.length,m=p;const _={};for(;m--;)_[e[m].key]=m;const v=[],y=new Map,w=new Map,S=[];for(m=g;m--;){const C=d(o,r,m),R=n(C);let k=s.get(R);k?l&&S.push(()=>k.p(C,t)):(k=f(R,C),k.c()),y.set(R,v[m]=k),R in _&&w.set(R,Math.abs(m-_[R]))}const M=new Set,$=new Set;function F(C){V(C,1),C.m(u,c),s.set(C.key,C),c=C.first,g--}for(;p&&g;){const C=v[g-1],R=e[p-1],k=C.key,E=R.key;C===R?(c=C.first,p--,g--):y.has(E)?!s.has(k)||M.has(k)?F(C):$.has(E)?p--:w.get(k)>w.get(E)?($.add(k),F(C)):(M.add(E),p--):(a(R,s),p--)}for(;p--;){const C=e[p];y.has(C.key)||a(C,s)}for(;g;)F(v[g-1]);return ve(S),v}function fa(e,t){const n={},l={},o={$$scope:1};let r=e.length;for(;r--;){const s=e[r],u=t[r];if(u){for(const a in s)a in u||(l[a]=1);for(const a in u)o[a]||(n[a]=u[a],o[a]=1);e[r]=u}else for(const a in s)o[a]=1}for(const s in l)s in n||(n[s]=void 0);return n}function ca(e){return typeof e=="object"&&e!==null?e:{}}const uf=/[&"]/g,ff=/[&<]/g;function cf(e,t=!1){const n=String(e),l=t?uf:ff;l.lastIndex=0;let o="",r=0;for(;l.test(n);){const s=l.lastIndex-1,u=n[s];o+=n.substring(r,s)+(u==="&"?"&":u==='"'?""":"<"),r=s+1}return o+n.substring(r)}function df(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 Il;function da(e){function t(n,l,o,r,s){const u=tn,a={on_destroy:Il,context:new Map(s||(u?u.$$.context:[])),on_mount:[],before_update:[],after_update:[],callbacks:Zl()};Vt({$$:a});const f=e(n,l,o,r);return Vt(u),f}return{render:(n={},{$$slots:l={},context:o=new Map}={})=>{Il=[];const r={title:"",head:"",css:new Set},s=t(r,n,{},l,o);return ve(Il),{html:s,css:{code:Array.from(r.css).map(u=>u.code).join(` +`),map:null},head:r.title+r.head}},$$render:t}}function Rn(e,t,n){const l=e.$$.props[t];l!==void 0&&(e.$$.bound[l]=n,n(e.$$.ctx[l]))}function ne(e){e&&e.c()}function hf(e,t){e&&e.l(t)}function ee(e,t,n,l){const{fragment:o,after_update:r}=e.$$;o&&o.m(t,n),l||Me(()=>{const s=e.$$.on_mount.map(ea).filter(Ve);e.$$.on_destroy?e.$$.on_destroy.push(...s):ve(s),e.$$.on_mount=[]}),r.forEach(Me)}function te(e,t){const n=e.$$;n.fragment!==null&&(rf(n.after_update),ve(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function gf(e,t){e.$$.dirty[0]===-1&&(Ut.push(e),lf(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const m=g.length?g[0]:p;return f.ctx&&o(f.ctx[d],f.ctx[d]=m)&&(!f.skip_bound&&f.bound[d]&&f.bound[d](m),c&&gf(e,d)),p}):[],f.update(),c=!0,ve(f.before_update),f.fragment=l?l(f.ctx):!1,t.target){if(t.hydrate){Pu();const d=ju(t.target);f.fragment&&f.fragment.l(d),d.forEach(N)}else f.fragment&&f.fragment.c();t.intro&&V(e.$$.fragment),ee(e,t.target,t.anchor,t.customElement),Tu(),aa()}Vt(a)}class ce{$destroy(){te(this,1),this.$destroy=U}$on(t,n){if(!Ve(n))return U;const l=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return l.push(n),()=>{const o=l.indexOf(n);o!==-1&&l.splice(o,1)}}$set(t){this.$$set&&!Iu(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Bt=[];function no(e,t){return{subscribe:Ie(e,t).subscribe}}function Ie(e,t=U){let n;const l=new Set;function o(u){if(fe(e,u)&&(e=u,n)){const a=!Bt.length;for(const f of l)f[1](),Bt.push(f,e);if(a){for(let f=0;f{l.delete(f),l.size===0&&n&&(n(),n=null)}}return{set:o,update:r,subscribe:s}}function pf(e,t,n){const l=!Array.isArray(e),o=l?[e]:e,r=t.length<2;return no(n,s=>{let u=!1;const a=[];let f=0,c=U;const d=()=>{if(f)return;c();const g=t(l?a[0]:a,s);r?s(g):c=Ve(g)?g:U},p=o.map((g,m)=>Al(g,_=>{a[m]=_,f&=~(1<{f|=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 l=t.map((o,r)=>lo(e[r],o));return o=>l.map(r=>r(o))}if(n==="object"){if(!e||!t)throw new Error("Object cannot be null");if(Jo(e)&&Jo(t)){e=e.getTime(),t=t.getTime();const r=t-e;return s=>new Date(e+s*r)}const l=Object.keys(t),o={};return l.forEach(r=>{o[r]=lo(e[r],t[r])}),r=>{const s={};return l.forEach(u=>{s[u]=o[u](r)}),s}}if(n==="number"){const l=t-e;return o=>e+o*l}throw new Error(`Cannot interpolate ${n} values`)}function Fo(e,t={}){const n=Ie(e);let l,o=e;function r(s,u){if(e==null)return n.set(e=s),Promise.resolve();o=s;let a=l,f=!1,{delay:c=0,duration:d=400,easing:p=Zs,interpolate:g=lo}=$n($n({},t),u);if(d===0)return a&&(a.abort(),a=null),n.set(e=o),Promise.resolve();const m=la()+c;let _;return l=ia(v=>{if(vd?(n.set(e=s),!1):(n.set(e=_(p(y/d))),!0)}),l.promise}return{set:r,update:(s,u)=>r(s(o,e),u),subscribe:n.subscribe}}const He=Ie([]),Nl=Ie([]),fn=Ie([]),Mn=Ie([]),st=Ie("all"),Zo=Ie({"n/a":1,up:1,down:1}),mf=["who","what","how","why","where","does","can","n/a"],oo=Fo(mf.map(e=>({question:e,count:0}))),It=Ie(new Set);var io="http://www.w3.org/1999/xhtml";const ei={svg:"http://www.w3.org/2000/svg",xhtml:io,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ha(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ei.hasOwnProperty(t)?{space:ei[t],local:e}:e}function _f(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===io&&t.documentElement.namespaceURI===io?t.createElement(e):t.createElementNS(n,e)}}function vf(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ga(e){var t=ha(e);return(t.local?vf:_f)(t)}function bf(){}function pa(e){return e==null?bf:function(){return this.querySelector(e)}}function wf(e){typeof e!="function"&&(e=pa(e));for(var t=this._groups,n=t.length,l=new Array(n),o=0;o=S&&(S=w+1);!($=v[S])&&++S=0;)(s=l[o])&&(r&&s.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(s,r),r=s);return this}function Uf(e){e||(e=Wf);function t(d,p){return d&&p?e(d.__data__,p.__data__):!d-!p}for(var n=this._groups,l=n.length,o=new Array(l),r=0;rt?1:e>=t?0:NaN}function Xf(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Yf(){return Array.from(this)}function Qf(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?sc:typeof t=="function"?uc:ac)(e,t,n??"")):cc(this.node(),e)}function cc(e,t){return e.style.getPropertyValue(t)||ba(e).getComputedStyle(e,null).getPropertyValue(t)}function dc(e){return function(){delete this[e]}}function hc(e,t){return function(){this[e]=t}}function gc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function pc(e,t){return arguments.length>1?this.each((t==null?dc:typeof t=="function"?gc:hc)(e,t)):this.node()[e]}function wa(e){return e.trim().split(/^|\s+/)}function Do(e){return e.classList||new ya(e)}function ya(e){this._node=e,this._names=wa(e.getAttribute("class")||"")}ya.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 ka(e,t){for(var n=Do(e),l=-1,o=t.length;++l=0&&(n=t.slice(l+1),t=t.slice(0,l)),{type:t,name:n}})}function Bc(e){return function(){var t=this.__on;if(t){for(var n=0,l=-1,o=t.length,r;n({}),ti=e=>({});function Jc(e){let t,n,l,o,r,s,u,a,f;const c=e[4].header,d=Uo(c,e,e[3],ti),p=e[4].default,g=Uo(p,e,e[3],null);return{c(){t=A("dialog"),n=A("div"),l=A("div"),o=A("button"),o.textContent="X",r=P(),d&&d.c(),s=P(),g&&g.c(),h(o,"class","close-button svelte-g384pz"),h(l,"class","btn-container svelte-g384pz"),h(n,"class","svelte-g384pz"),h(t,"class","svelte-g384pz")},m(m,_){T(m,t,_),b(t,n),b(n,l),b(l,o),b(n,r),d&&d.m(n,null),b(n,s),g&&g.m(n,null),e[6](t),u=!0,a||(f=[x(o,"click",function(){Ve(e[1])&&e[1].apply(this,arguments)}),x(n,"click",Gu(e[5])),x(t,"close",function(){Ve(e[1])&&e[1].apply(this,arguments)}),x(t,"click",Bu(function(){Ve(e[1])&&e[1].apply(this,arguments)}))],a=!0)},p(m,[_]){e=m,d&&d.p&&(!u||_&8)&&Xo(d,c,e,e[3],u?Wo(c,e[3],_,Kc):Yo(e[3]),ti),g&&g.p&&(!u||_&8)&&Xo(g,p,e,e[3],u?Wo(p,e[3],_,null):Yo(e[3]),null)},i(m){u||(V(d,m),V(g,m),u=!0)},o(m){z(d,m),z(g,m),u=!1},d(m){m&&N(t),d&&d.d(m),g&&g.d(m),e[6](null),a=!1,ve(f)}}}function Zc(e,t,n){let{$$slots:l={},$$scope:o}=t,{showModal:r}=t,{dialog:s}=t,{handleClose:u}=t;function a(c){tf.call(this,e,c)}function f(c){et[c?"unshift":"push"](()=>{s=c,n(0,s)})}return e.$$set=c=>{"showModal"in c&&n(2,r=c.showModal),"dialog"in c&&n(0,s=c.dialog),"handleClose"in c&&n(1,u=c.handleClose),"$$scope"in c&&n(3,o=c.$$scope)},e.$$.update=()=>{e.$$.dirty&5&&s&&r&&s.showModal()},[s,u,r,o,l,a,f]}class ed extends ce{constructor(t){super(),de(this,t,Zc,Jc,fe,{showModal:2,dialog:0,handleClose:1})}}function ni(e){let t,n,l,o,r,s,u,a,f;return{c(){t=A("form"),n=A("div"),l=A("label"),l.textContent="Filename",o=P(),r=A("input"),s=P(),u=A("div"),u.innerHTML='',h(l,"for","file_name"),h(l,"class","svelte-sy2m0x"),h(r,"type","text"),h(r,"placeholder","Please enter filename"),h(r,"name","file_name"),r.required=!0,h(n,"class","inputs svelte-sy2m0x"),h(u,"class","btn-container svelte-sy2m0x")},m(c,d){T(c,t,d),b(t,n),b(n,l),b(n,o),b(n,r),Ye(r,e[2]),b(t,s),b(t,u),a||(f=[x(r,"input",e[9]),x(t,"submit",e[6])],a=!0)},p(c,d){d&4&&r.value!==c[2]&&Ye(r,c[2])},d(c){c&&N(t),a=!1,ve(f)}}}function li(e){let t,n,l,o,r,s,u,a,f;return{c(){t=A("div"),n=q("✅ Data downloaded to /pykoi/"),l=q(e[2]),o=q(".csv"),r=P(),s=A("div"),u=A("button"),u.textContent="Close",h(s,"class","btn-container svelte-sy2m0x")},m(c,d){T(c,t,d),b(t,n),b(t,l),b(t,o),T(c,r,d),T(c,s,d),b(s,u),a||(f=x(u,"click",e[7]),a=!0)},p(c,d){d&4&&K(l,c[2])},d(c){c&&N(t),c&&N(r),c&&N(s),a=!1,f()}}}function oi(e){let t,n,l,o,r,s,u,a;return{c(){t=A("div"),t.textContent="⚠️ Download failed. Please try again.",n=P(),l=A("div"),o=A("button"),o.textContent="Retry",r=P(),s=A("button"),s.textContent="Close",h(l,"class","btn-container svelte-sy2m0x")},m(f,c){T(f,t,c),T(f,n,c),T(f,l,c),b(l,o),b(l,r),b(l,s),u||(a=[x(o,"click",e[10]),x(s,"click",e[7])],u=!0)},p:U,d(f){f&&N(t),f&&N(n),f&&N(l),u=!1,ve(a)}}}function ii(e){let t,n,l,o,r,s,u,a,f,c,d;return{c(){t=A("div"),n=q("⚠️ "),l=q(e[2]),o=q(".csv already exists. Do you wish to overwrite it?"),r=P(),s=A("div"),u=A("button"),u.textContent="Back",a=P(),f=A("button"),f.textContent="Overwrite",h(s,"class","btn-container svelte-sy2m0x")},m(p,g){T(p,t,g),b(t,n),b(t,l),b(t,o),T(p,r,g),T(p,s,g),b(s,u),b(s,a),b(s,f),c||(d=[x(u,"click",e[11]),x(f,"click",e[12])],c=!0)},p(p,g){g&4&&K(l,p[2])},d(p){p&&N(t),p&&N(r),p&&N(s),c=!1,ve(d)}}}function td(e){let t,n,l,o,r=e[3]===e[4].FILE_INPUT&&ni(e),s=e[3]===e[4].DOWNLOADED&&li(e),u=e[3]===e[4].FAILED_DOWNLOAD&&oi(e),a=e[3]===e[4].OVERWRITE&&ii(e);return{c(){r&&r.c(),t=P(),s&&s.c(),n=P(),u&&u.c(),l=P(),a&&a.c(),o=Se()},m(f,c){r&&r.m(f,c),T(f,t,c),s&&s.m(f,c),T(f,n,c),u&&u.m(f,c),T(f,l,c),a&&a.m(f,c),T(f,o,c)},p(f,c){f[3]===f[4].FILE_INPUT?r?r.p(f,c):(r=ni(f),r.c(),r.m(t.parentNode,t)):r&&(r.d(1),r=null),f[3]===f[4].DOWNLOADED?s?s.p(f,c):(s=li(f),s.c(),s.m(n.parentNode,n)):s&&(s.d(1),s=null),f[3]===f[4].FAILED_DOWNLOAD?u?u.p(f,c):(u=oi(f),u.c(),u.m(l.parentNode,l)):u&&(u.d(1),u=null),f[3]===f[4].OVERWRITE?a?a.p(f,c):(a=ii(f),a.c(),a.m(o.parentNode,o)):a&&(a.d(1),a=null)},d(f){r&&r.d(f),f&&N(t),s&&s.d(f),f&&N(n),u&&u.d(f),f&&N(l),a&&a.d(f),f&&N(o)}}}function nd(e){let t;return{c(){t=A("h4"),t.textContent="Download Data",h(t,"slot","header"),h(t,"class","svelte-sy2m0x")},m(n,l){T(n,t,l)},p:U,d(n){n&&N(t)}}}function ld(e){let t,n,l,o;function r(a){e[13](a)}function s(a){e[14](a)}let u={handleClose:e[7],$$slots:{header:[nd],default:[td]},$$scope:{ctx:e}};return e[0]!==void 0&&(u.showModal=e[0]),e[1]!==void 0&&(u.dialog=e[1]),t=new ed({props:u}),et.push(()=>Rn(t,"showModal",r)),et.push(()=>Rn(t,"dialog",s)),{c(){ne(t.$$.fragment)},m(a,f){ee(t,a,f),o=!0},p(a,[f]){const c={};f&32780&&(c.$$scope={dirty:f,ctx:a}),!n&&f&1&&(n=!0,c.showModal=a[0],An(()=>n=!1)),!l&&f&2&&(l=!0,c.dialog=a[1],An(()=>l=!1)),t.$set(c)},i(a){o||(V(t.$$.fragment,a),o=!0)},o(a){z(t.$$.fragment,a),o=!1},d(a){te(t,a)}}}function od(e,t,n){let{showModal:l,table:o}=t,r,s="";const u={FILE_INPUT:0,DOWNLOADED:1,FAILED_DOWNLOAD:2,OVERWRITE:3};let a=u.FILE_INPUT;const f=async w=>{const S={file_name:w},$=await(await fetch(`/chat/${o}/save_to_csv`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(S)})).json();console.log("Download Complete: ",$),$.status==="200"?(console.log("success"),n(3,a=u.DOWNLOADED)):(console.log("failed"),n(3,a=u.FAILED_DOWNLOAD))},c=async w=>{w.preventDefault();const S=await fetch(`/file_exists/?file_name=${s}.csv`),{file_exists:M}=await S.json();M===!0?n(3,a=u.OVERWRITE):f(s)};function d(){n(0,l=!1),n(3,a=u.FILE_INPUT),r.close()}function p(){s=this.value,n(2,s)}const g=()=>n(3,a=u.FILE_INPUT),m=()=>n(3,a=u.FILE_INPUT),_=()=>f(s);function v(w){l=w,n(0,l)}function y(w){r=w,n(1,r)}return e.$$set=w=>{"showModal"in w&&n(0,l=w.showModal),"table"in w&&n(8,o=w.table)},[l,r,s,a,u,f,c,d,o,p,g,m,_,v,y]}class Io extends ce{constructor(t){super(),de(this,t,od,ld,fe,{showModal:0,table:8})}}function ri(e,t,n){const l=e.slice();return l[19]=t[n],l[21]=n,l}function si(e){let t,n,l,o,r,s;function u(...f){return e[12](e[21],...f)}function a(...f){return e[13](e[21],...f)}return{c(){t=A("div"),n=A("button"),n.textContent="👍",l=P(),o=A("button"),o.textContent="👎",h(n,"class","small-button thumbs-up svelte-19cad35"),h(o,"class","small-button thumbs-down svelte-19cad35"),h(t,"class","feedback-buttons svelte-19cad35")},m(f,c){T(f,t,c),b(t,n),b(t,l),b(t,o),r||(s=[x(n,"click",u),x(o,"click",a)],r=!0)},p(f,c){e=f},d(f){f&&N(t),r=!1,ve(s)}}}function ai(e,t){let n,l,o,r,s,u,a,f,c,d=t[19].question+"",p,g,m,_,v,y,w,S=t[19].answer+"",M,$,F,C,R,k,E=t[0]&&si(t);return{key:e,first:null,c(){n=A("div"),l=A("div"),o=A("div"),r=P(),s=A("div"),u=A("div"),a=A("h5"),a.textContent="Question:",f=P(),c=A("p"),p=q(d),g=P(),m=A("div"),_=A("div"),v=A("h5"),v.textContent="Response:",y=P(),w=A("p"),M=q(S),$=P(),E&&E.c(),F=P(),h(o,"class","avatar"),h(a,"class","bold svelte-19cad35"),h(u,"class","question svelte-19cad35"),h(v,"class","bold svelte-19cad35"),h(_,"class","answer svelte-19cad35"),h(m,"class","answers svelte-19cad35"),h(s,"class","message-content svelte-19cad35"),h(l,"class","chat-message-center svelte-19cad35"),h(n,"class","chat-message svelte-19cad35"),this.first=n},m(I,D){T(I,n,D),b(n,l),b(l,o),b(l,r),b(l,s),b(s,u),b(u,a),b(u,f),b(u,c),b(c,p),b(s,g),b(s,m),b(m,_),b(_,v),b(_,y),b(_,w),b(w,M),b(_,$),E&&E.m(_,null),b(n,F),R||(k=en(C=rd.call(null,n,t[21]===t[5].length-1)),R=!0)},p(I,D){t=I,D&32&&d!==(d=t[19].question+"")&&K(p,d),D&32&&S!==(S=t[19].answer+"")&&K(M,S),t[0]?E?E.p(t,D):(E=si(t),E.c(),E.m(_,null)):E&&(E.d(1),E=null),C&&Ve(C.update)&&D&32&&C.update.call(null,t[21]===t[5].length-1)},d(I){I&&N(n),E&&E.d(),R=!1,k()}}}function id(e){let t,n,l,o,r,s,u,a,f,c,d,p,g,m,_=[],v=new Map,y,w,S,M,$,F,C=(e[3]?e[4]:"Send")+"",R,k,E,I,D,L,O;function B(W){e[11](W)}let j={table:"qa_table"};e[1]!==void 0&&(j.showModal=e[1]),t=new Io({props:j}),et.push(()=>Rn(t,"showModal",B));let ae=e[5];const pe=W=>W[21];for(let W=0;W👍 button. If the repsonse is not satisfactory, click on the - 👎 button.`,f=N(),c=A("button"),c.textContent="Download Data",d=N(),g=A("div"),p=A("section"),m=A("div");for(let W=0;W<_.length;W+=1)_[W].c();y=N(),w=A("div"),S=A("form"),M=A("input"),$=N(),F=A("button"),R=q(C),E=N(),I=A("p"),I.textContent="Note - may produce inaccurate information.",h(s,"class","underline bold svelte-19cad35"),h(a,"class","svelte-19cad35"),h(c,"class","svelte-19cad35"),h(r,"class","instructions svelte-19cad35"),h(m,"class","chat-log svelte-19cad35"),h(p,"class","chatbox svelte-19cad35"),h(M,"class","chat-input-textarea svelte-19cad35"),h(M,"placeholder","Type Question Here"),h(F,"class",k="btnyousend "+(e[2]===""?"":"active")+" svelte-19cad35"),h(F,"type","submit"),h(S,"class","chat-input-form svelte-19cad35"),h(I,"class","message svelte-19cad35"),h(w,"class","chat-input-holder svelte-19cad35"),h(g,"class","ranked-chat svelte-19cad35"),h(o,"class","ranked-feedback-container svelte-19cad35")},m(W,Q){ee(t,W,Q),T(W,l,Q),T(W,o,Q),b(o,r),b(r,s),b(r,u),b(r,a),b(r,f),b(r,c),b(o,d),b(o,g),b(g,p),b(p,m);for(let X=0;X<_.length;X+=1)_[X]&&_[X].m(m,null);b(g,y),b(g,w),b(w,S),b(S,M),Ye(M,e[2]),b(S,$),b(S,F),b(F,R),b(w,E),b(w,I),D=!0,L||(O=[x(c,"click",e[8]),x(M,"input",e[14]),x(S,"submit",e[6])],L=!0)},p(W,[Q]){const X={};!n&&Q&2&&(n=!0,X.showModal=W[1],$n(()=>n=!1)),t.$set(X),Q&161&&(ae=W[5],_=gt(_,Q,pe,1,W,ae,v,m,zt,ai,null,ri)),Q&4&&M.value!==W[2]&&Ye(M,W[2]),(!D||Q&24)&&C!==(C=(W[3]?W[4]:"Send")+"")&&K(R,C),(!D||Q&4&&k!==(k="btnyousend "+(W[2]===""?"":"active")+" svelte-19cad35"))&&h(F,"class",k)},i(W){D||(V(t.$$.fragment,W),D=!0)},o(W){z(t.$$.fragment,W),D=!1},d(W){te(t,W),W&&P(l),W&&P(o);for(let Q=0;Q<_.length;Q+=1)_[Q].d();L=!1,be(O)}}}function od(e){setTimeout(()=>{e.scrollIntoView({behavior:"smooth"})},0)}async function id(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 rd(e,t,n){let l,o;ue(e,qe,M=>n(5,o=M));let r=!1,{feedback:s=!1}=t,{is_retrieval:u=!1}=t,a="",f="",c=!1;ft(()=>{d()});async function d(){const C=(await(await fetch("/chat/qa_table/retrieve")).json()).rows.map(R=>({id:R[0],question:R[1],answer:R[2],vote_status:R[3]}));Pe(qe,o=[...C],o)}const g=async M=>{M.preventDefault(),a=f,n(2,f=""),n(3,c=!0);let $={id:o.length+1,question:a,answer:"Loading...",vote_status:"na"};Pe(qe,o=[...o,$],o);const F=u?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(F.ok){const C=await F.json();console.log("response data",C),$.answer=C.answer,qe.update(R=>(R[R.length-1]=$,R))}else{const C=await F.text();alert(C)}n(3,c=!1)};let p=0;setInterval(()=>{n(10,p=(p+1)%4)},200);function m(M,$,F){const C=o[F];C.vote=$;const R={id:F+1,vote_status:$};id(R),pt(M.currentTarget.parentNode).selectAll("button").style("border","3px solid transparent").style("opacity",.65),pt(M.currentTarget).style("border","3px solid var(--black)").style("opacity",1)}function _(){n(1,r=!0)}[...Array(10).keys()].map(M=>String.fromCharCode(65+M));function v(M){r=M,n(1,r)}const y=(M,$)=>m($,"up",M),w=(M,$)=>m($,"down",M);function S(){f=this.value,n(2,f)}return e.$$set=M=>{"feedback"in M&&n(0,s=M.feedback),"is_retrieval"in M&&n(9,u=M.is_retrieval)},e.$$.update=()=>{e.$$.dirty&1024&&n(4,l=".".repeat(p).padEnd(3))},[s,r,f,c,l,o,g,m,_,u,p,v,y,w,S]}class No extends ce{constructor(t){super(),de(this,t,rd,ld,fe,{feedback:0,is_retrieval:9})}}function ui(e,t,n){const l=e.slice();return l[14]=t[n],l[16]=n,l}function fi(e,t){let n,l,o,r,s,u,a,f,c,d=t[14].question+"",g,p,m,_,v,y,w,S=t[14].up_ranking_answer+"",M,$,F,C,R,k,E=t[14].low_ranking_answer+"",I,D,L,O,B;function j(...Q){return t[7](t[14],t[16],...Q)}function ae(...Q){return t[8](t[14],t[16],...Q)}function pe(...Q){return t[9](t[14],t[16],...Q)}function W(...Q){return t[10](t[14],t[16],...Q)}return{key:e,first:null,c(){n=A("div"),l=A("div"),o=A("div"),r=N(),s=A("div"),u=A("div"),a=A("h5"),a.textContent="Question:",f=N(),c=A("p"),g=q(d),p=N(),m=A("div"),_=A("div"),v=A("h5"),v.textContent="Response 1:",y=N(),w=A("p"),M=q(S),$=N(),F=A("div"),C=A("h5"),C.textContent="Response 2:",R=N(),k=A("p"),I=q(E),D=N(),h(o,"class","avatar"),h(a,"class","bold svelte-au920n"),h(u,"class","question svelte-au920n"),h(v,"class","bold underline svelte-au920n"),h(_,"class","answer svelte-au920n"),h(C,"class","bold underline svelte-au920n"),h(F,"class","answer svelte-au920n"),h(m,"class","answers svelte-au920n"),h(s,"class","message-content svelte-au920n"),h(l,"class","chat-message-center svelte-au920n"),h(n,"class","chat-message svelte-au920n"),this.first=n},m(Q,X){T(Q,n,X),b(n,l),b(l,o),b(l,r),b(l,s),b(s,u),b(u,a),b(u,f),b(u,c),b(c,g),b(s,p),b(s,m),b(m,_),b(_,v),b(_,y),b(_,w),b(w,M),b(m,$),b(m,F),b(F,C),b(F,R),b(F,k),b(k,I),b(n,D),O||(B=[x(_,"click",j),x(_,"keydown",ae),x(F,"click",pe),x(F,"keydown",W),Cn(L=ad.call(null,n,t[16]===t[3].length-1))],O=!0)},p(Q,X){t=Q,X&8&&d!==(d=t[14].question+"")&&K(g,d),X&8&&S!==(S=t[14].up_ranking_answer+"")&&K(M,S),X&8&&E!==(E=t[14].low_ranking_answer+"")&&K(I,E),L&&Ge(L.update)&&X&8&&L.update.call(null,t[16]===t[3].length-1)},d(Q){Q&&P(n),O=!1,be(B)}}}function sd(e){let t,n,l,o,r,s,u=[],a=new Map,f,c,d,g,p,m,_=(e[1]?e[2]:"Send")+"",v,y,w,S,M,$,F=e[3];const C=R=>R[16];for(let R=0;RRanked Feedback Instructions + 👎 button.`,f=P(),c=A("button"),c.textContent="Download Data",d=P(),p=A("div"),g=A("section"),m=A("div");for(let W=0;W<_.length;W+=1)_[W].c();y=P(),w=A("div"),S=A("form"),M=A("input"),$=P(),F=A("button"),R=q(C),E=P(),I=A("p"),I.textContent="Note - may produce inaccurate information.",h(s,"class","underline bold svelte-19cad35"),h(a,"class","svelte-19cad35"),h(c,"class","svelte-19cad35"),h(r,"class","instructions svelte-19cad35"),h(m,"class","chat-log svelte-19cad35"),h(g,"class","chatbox svelte-19cad35"),h(M,"class","chat-input-textarea svelte-19cad35"),h(M,"placeholder","Type Question Here"),h(F,"class",k="btnyousend "+(e[2]===""?"":"active")+" svelte-19cad35"),h(F,"type","submit"),h(S,"class","chat-input-form svelte-19cad35"),h(I,"class","message svelte-19cad35"),h(w,"class","chat-input-holder svelte-19cad35"),h(p,"class","ranked-chat svelte-19cad35"),h(o,"class","ranked-feedback-container svelte-19cad35")},m(W,Q){ee(t,W,Q),T(W,l,Q),T(W,o,Q),b(o,r),b(r,s),b(r,u),b(r,a),b(r,f),b(r,c),b(o,d),b(o,p),b(p,g),b(g,m);for(let X=0;X<_.length;X+=1)_[X]&&_[X].m(m,null);b(p,y),b(p,w),b(w,S),b(S,M),Ye(M,e[2]),b(S,$),b(S,F),b(F,R),b(w,E),b(w,I),D=!0,L||(O=[x(c,"click",e[8]),x(M,"input",e[14]),x(S,"submit",e[6])],L=!0)},p(W,[Q]){const X={};!n&&Q&2&&(n=!0,X.showModal=W[1],An(()=>n=!1)),t.$set(X),Q&161&&(ae=W[5],_=gt(_,Q,pe,1,W,ae,v,m,Lt,ai,null,ri)),Q&4&&M.value!==W[2]&&Ye(M,W[2]),(!D||Q&24)&&C!==(C=(W[3]?W[4]:"Send")+"")&&K(R,C),(!D||Q&4&&k!==(k="btnyousend "+(W[2]===""?"":"active")+" svelte-19cad35"))&&h(F,"class",k)},i(W){D||(V(t.$$.fragment,W),D=!0)},o(W){z(t.$$.fragment,W),D=!1},d(W){te(t,W),W&&N(l),W&&N(o);for(let Q=0;Q<_.length;Q+=1)_[Q].d();L=!1,ve(O)}}}function rd(e){setTimeout(()=>{e.scrollIntoView({behavior:"smooth"})},0)}async function sd(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 ad(e,t,n){let l,o;ue(e,He,M=>n(5,o=M));let r=!1,{feedback:s=!1}=t,{is_retrieval:u=!1}=t,a="",f="",c=!1;ft(()=>{d()});async function d(){const C=(await(await fetch("/chat/qa_table/retrieve")).json()).rows.map(R=>({id:R[0],question:R[1],answer:R[2],vote_status:R[3]}));De(He,o=[...C],o)}const p=async M=>{M.preventDefault(),a=f,n(2,f=""),n(3,c=!0);let $={id:o.length+1,question:a,answer:"Loading...",vote_status:"na"};De(He,o=[...o,$],o);const F=u?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(F.ok){const C=await F.json();console.log("response data",C),$.answer=C.answer,He.update(R=>(R[R.length-1]=$,R))}else{const C=await F.text();alert(C)}n(3,c=!1)};let g=0;setInterval(()=>{n(10,g=(g+1)%4)},200);function m(M,$,F){const C=o[F];C.vote=$;const R={id:F+1,vote_status:$};sd(R),pt(M.currentTarget.parentNode).selectAll("button").style("border","3px solid transparent").style("opacity",.65),pt(M.currentTarget).style("border","3px solid var(--black)").style("opacity",1)}function _(){n(1,r=!0)}[...Array(10).keys()].map(M=>String.fromCharCode(65+M));function v(M){r=M,n(1,r)}const y=(M,$)=>m($,"up",M),w=(M,$)=>m($,"down",M);function S(){f=this.value,n(2,f)}return e.$$set=M=>{"feedback"in M&&n(0,s=M.feedback),"is_retrieval"in M&&n(9,u=M.is_retrieval)},e.$$.update=()=>{e.$$.dirty&1024&&n(4,l=".".repeat(g).padEnd(3))},[s,r,f,c,l,o,p,m,_,u,g,v,y,w,S]}class No extends ce{constructor(t){super(),de(this,t,ad,id,fe,{feedback:0,is_retrieval:9})}}function ui(e,t,n){const l=e.slice();return l[14]=t[n],l[16]=n,l}function fi(e,t){let n,l,o,r,s,u,a,f,c,d=t[14].question+"",p,g,m,_,v,y,w,S=t[14].up_ranking_answer+"",M,$,F,C,R,k,E=t[14].low_ranking_answer+"",I,D,L,O,B;function j(...Q){return t[7](t[14],t[16],...Q)}function ae(...Q){return t[8](t[14],t[16],...Q)}function pe(...Q){return t[9](t[14],t[16],...Q)}function W(...Q){return t[10](t[14],t[16],...Q)}return{key:e,first:null,c(){n=A("div"),l=A("div"),o=A("div"),r=P(),s=A("div"),u=A("div"),a=A("h5"),a.textContent="Question:",f=P(),c=A("p"),p=q(d),g=P(),m=A("div"),_=A("div"),v=A("h5"),v.textContent="Response 1:",y=P(),w=A("p"),M=q(S),$=P(),F=A("div"),C=A("h5"),C.textContent="Response 2:",R=P(),k=A("p"),I=q(E),D=P(),h(o,"class","avatar"),h(a,"class","bold svelte-au920n"),h(u,"class","question svelte-au920n"),h(v,"class","bold underline svelte-au920n"),h(_,"class","answer svelte-au920n"),h(C,"class","bold underline svelte-au920n"),h(F,"class","answer svelte-au920n"),h(m,"class","answers svelte-au920n"),h(s,"class","message-content svelte-au920n"),h(l,"class","chat-message-center svelte-au920n"),h(n,"class","chat-message svelte-au920n"),this.first=n},m(Q,X){T(Q,n,X),b(n,l),b(l,o),b(l,r),b(l,s),b(s,u),b(u,a),b(u,f),b(u,c),b(c,p),b(s,g),b(s,m),b(m,_),b(_,v),b(_,y),b(_,w),b(w,M),b(m,$),b(m,F),b(F,C),b(F,R),b(F,k),b(k,I),b(n,D),O||(B=[x(_,"click",j),x(_,"keydown",ae),x(F,"click",pe),x(F,"keydown",W),en(L=fd.call(null,n,t[16]===t[3].length-1))],O=!0)},p(Q,X){t=Q,X&8&&d!==(d=t[14].question+"")&&K(p,d),X&8&&S!==(S=t[14].up_ranking_answer+"")&&K(M,S),X&8&&E!==(E=t[14].low_ranking_answer+"")&&K(I,E),L&&Ve(L.update)&&X&8&&L.update.call(null,t[16]===t[3].length-1)},d(Q){Q&&N(n),O=!1,ve(B)}}}function ud(e){let t,n,l,o,r,s,u=[],a=new Map,f,c,d,p,g,m,_=(e[1]?e[2]:"Send")+"",v,y,w,S,M,$,F=e[3];const C=R=>R[16];for(let R=0;RRanked 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.

- `,l=N(),o=A("div"),r=A("section"),s=A("div");for(let R=0;R{e.scrollIntoView({behavior:"smooth"})},0)}async function ud(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 fd(e,t,n){let l,o;ue(e,Il,v=>n(3,o=v));let r="",s="",u=!1;ft(()=>{});const a=async v=>{v.preventDefault(),r=s,n(0,s=""),n(1,u=!0);let y={question:r,up_ranking_answer:"Loading...",low_ranking_answer:"Loading..."};Pe(Il,o=[...o,y],o);const w=await fetch(`/chat/multi_responses/${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:r})});if(w.ok){const S=await w.json();y.up_ranking_answer=S.answer[0],y.low_ranking_answer=S.answer[1],Il.update(M=>(M[M.length-1]=y,M))}else{const S=await w.text();alert(S)}n(1,u=!1)};let f=0;setInterval(()=>{n(6,f=(f+1)%4)},200);function c(v,y,w,S){const M=o[w],$={1:"up_ranking_answer",2:"low_ranking_answer"},F={question:M.question,up_ranking_answer:M[$[S]],low_ranking_answer:M[$[S%2+1]]};ud(F),pt(v.currentTarget.parentNode).selectAll("div").style("outline","2px solid var(--red)").style("border","1px solid var(--red)"),pt(v.currentTarget).style("outline","2px solid var(--green)").style("border","1px solid var(--green)")}const d=(v,y,w)=>c(w,v,y,1),g=(v,y,w)=>c(w,v,y,1),p=(v,y,w)=>c(w,v,y,2),m=(v,y,w)=>c(w,v,y,2);function _(){s=this.value,n(0,s)}return e.$$.update=()=>{e.$$.dirty&64&&n(2,l=".".repeat(f).padEnd(3))},[s,u,l,o,a,c,f,d,g,p,m,_]}class cd extends ce{constructor(t){super(),de(this,t,fd,sd,fe,{})}}function ci(e,t,n){const l=e.slice();return l[8]=t[n],l[10]=n,l}function di(e){let t,n,l,o,r=e[8].name+"",s,u,a,f,c;function d(...g){return e[6](e[8],...g)}return{c(){t=A("label"),n=A("input"),s=q(r),u=N(),h(n,"type","checkbox"),h(n,"id",l=e[8].id),n.checked=o=e[1].has(e[8].name),h(t,"for",a=e[8].id)},m(g,p){T(g,t,p),b(t,n),b(t,s),b(t,u),f||(c=x(n,"change",d),f=!0)},p(g,p){e=g,p&1&&l!==(l=e[8].id)&&h(n,"id",l),p&3&&o!==(o=e[1].has(e[8].name))&&(n.checked=o),p&1&&r!==(r=e[8].name+"")&&K(s,r),p&1&&a!==(a=e[8].id)&&h(t,"for",a)},d(g){g&&P(t),f=!1,c()}}}function dd(e){let t,n,l,o,r,s,u,a,f,c,d,g=e[0],p=[];for(let m=0;mn(1,l=d));let{documents:o=[]}=t,r=!1,s;function u(){n(2,r=!r)}function a(d,g){g.target.checked?l.add(d):l.delete(d),oo.set(new Set(l))}const f=(d,g)=>a(d.name,g);function c(d){et[d?"unshift":"push"](()=>{s=d,n(3,s)})}return e.$$set=d=>{"documents"in d&&n(0,o=d.documents)},e.$$.update=()=>{e.$$.dirty&2&&console.log(l)},[o,l,r,s,u,a,f,c]}let gd=class extends ce{constructor(t){super(),de(this,t,hd,dd,fe,{documents:0})}};function ro(e,t=2){if(e===0)return"0 Bytes";const n=1024,l=t<0?0:t,o=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],r=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/Math.pow(n,r)).toFixed(l))+" "+o[r]}function pd(e){let t={who:0,what:0,how:0,why:0,where:0,does:0,can:0,"n/a":0};for(let l=0;l({question:l,count:t[l]}))}function $a(e){return e.map(t=>{const n=t.question.split(" ").length,l=t.answer.split(" ").length;return{index:t.index,question:+n,answer:+l,vote:t.vote}})}function md(e,t){e.classList.add("tooltip"),e.setAttribute("tabindex",0);function n(){const o=document.createElement("span");o.textContent=t,o.setAttribute("id","tooltip"),e.appendChild(o),e.addEventListener("mouseleave",l),e.addEventListener("blur",l),e.removeEventListener("mouseenter",n),e.removeEventListener("focus",n)}function l(){e.removeChild(e.querySelector("#tooltip")),e.removeEventListener("mouseleave",l),e.removeEventListener("blur",l),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 Mn(e,{delay:t=0,duration:n=400,easing:l=Eo,axis:o="y"}={}){const r=getComputedStyle(e),s=+r.opacity,u=o==="y"?"height":"width",a=parseFloat(r[u]),f=o==="y"?["top","bottom"]:["left","right"],c=f.map(y=>`${y[0].toUpperCase()}${y.slice(1)}`),d=parseFloat(r[`padding${c[0]}`]),g=parseFloat(r[`padding${c[1]}`]),p=parseFloat(r[`margin${c[0]}`]),m=parseFloat(r[`margin${c[1]}`]),_=parseFloat(r[`border${c[0]}Width`]),v=parseFloat(r[`border${c[1]}Width`]);return{delay:t,duration:n,easing:l,css:y=>`overflow: hidden;opacity: ${Math.min(y*20,1)*s};${u}: ${y*a}px;padding-${f[0]}: ${y*d}px;padding-${f[1]}: ${y*g}px;margin-${f[0]}: ${y*p}px;margin-${f[1]}: ${y*m}px;border-${f[0]}-width: ${y*_}px;border-${f[1]}-width: ${y*v}px;`}}function Ln(e,{delay:t=0,duration:n=400,easing:l=Eo,start:o=0,opacity:r=0}={}){const s=getComputedStyle(e),u=+s.opacity,a=s.transform==="none"?"":s.transform,f=1-o,c=u*(1-r);return{delay:t,duration:n,easing:l,css:(d,g)=>` - transform: ${a} scale(${1-f*g}); - opacity: ${u-c*g} - `}}function _d(e){let t;return{c(){t=A("p"),t.textContent="⌄",h(t,"class","svelte-1pk2e1k")},m(n,l){T(n,t,l)},d(n){n&&P(t)}}}function vd(e){let t;return{c(){t=A("p"),t.textContent="⌃",h(t,"class","svelte-1pk2e1k")},m(n,l){T(n,t,l)},d(n){n&&P(t)}}}function hi(e){let t,n,l,o,r;return{c(){t=A("div"),n=A("p"),l=q(e[1]),h(n,"class","bold svelte-1pk2e1k"),h(t,"class","source_content svelte-1pk2e1k")},m(s,u){T(s,t,u),b(t,n),b(n,l),r=!0},p(s,u){(!r||u&2)&&K(l,s[1])},i(s){r||(Me(()=>{r&&(o||(o=lt(t,Mn,{},!0)),o.run(1))}),r=!0)},o(s){o||(o=lt(t,Mn,{},!1)),o.run(0),r=!1},d(s){s&&P(t),s&&o&&o.end()}}}function bd(e){let t,n,l,o=e[2]+1+"",r,s,u,a,f,c,d,g,p;function m(w,S){return w[3]?vd:_d}let _=m(e),v=_(e),y=e[3]&&hi(e);return{c(){t=A("div"),n=A("div"),l=A("p"),r=q(o),s=q(": "),u=q(e[0]),a=N(),v.c(),c=N(),y&&y.c(),h(l,"class","bold svelte-1pk2e1k"),h(n,"class","source_tab svelte-1pk2e1k"),h(t,"class","source svelte-1pk2e1k")},m(w,S){T(w,t,S),b(t,n),b(n,l),b(l,r),b(l,s),b(l,u),b(n,a),v.m(n,null),b(t,c),y&&y.m(t,null),d=!0,g||(p=x(n,"click",e[4]),g=!0)},p(w,[S]){(!d||S&4)&&o!==(o=w[2]+1+"")&&K(r,o),(!d||S&1)&&K(u,w[0]),_!==(_=m(w))&&(v.d(1),v=_(w),v&&(v.c(),v.m(n,null))),w[3]?y?(y.p(w,S),S&8&&V(y,1)):(y=hi(w),y.c(),V(y,1),y.m(t,null)):y&&(we(),z(y,1,1,()=>{y=null}),ye())},i(w){d||(Me(()=>{d&&(f||(f=lt(n,Mn,{},!0)),f.run(1))}),V(y),d=!0)},o(w){f||(f=lt(n,Mn,{},!1)),f.run(0),z(y),d=!1},d(w){w&&P(t),v.d(),w&&f&&f.end(),y&&y.d(),g=!1,p()}}}function wd(e,t,n){let{source:l=""}=t,{source_content:o=""}=t,{i:r=0}=t,s=r===0;const u=()=>n(3,s=!s);return e.$$set=a=>{"source"in a&&n(0,l=a.source),"source_content"in a&&n(1,o=a.source_content),"i"in a&&n(2,r=a.i)},[l,o,r,s,u]}class yd extends ce{constructor(t){super(),de(this,t,wd,bd,fe,{source:0,source_content:1,i:2})}}function gi(e,t,n){const l=e.slice();return l[4]=t[n],l[6]=n,l}function pi(e){let t,n,l,o;const r=[$d,Cd,Sd,kd],s=[];function u(a,f){return a[0][0]==="N/A"?0:a[0][0]==="Loading..."?1:a[0][0]==="Not loaded"?2:3}return t=u(e),n=s[t]=r[t](e),{c(){n.c(),l=Se()},m(a,f){s[t].m(a,f),T(a,l,f),o=!0},p(a,f){let c=t;t=u(a),t===c?s[t].p(a,f):(we(),z(s[c],1,1,()=>{s[c]=null}),ye(),n=s[t],n?n.p(a,f):(n=s[t]=r[t](a),n.c()),V(n,1),n.m(l.parentNode,l))},i(a){o||(V(n),o=!0)},o(a){z(n),o=!1},d(a){s[t].d(a),a&&P(l)}}}function kd(e){let t,n,l,o=e[0].length+"",r,s,u,a,f,c,d,g;function p(y,w){return y[2]?Ad:Rd}let m=p(e),_=m(e),v=e[2]&&mi(e);return{c(){t=A("div"),n=A("h5"),l=q("📖 Response Sources ("),r=q(o),s=q(")"),u=N(),_.c(),a=N(),v&&v.c(),f=Se(),h(n,"class","bold"),h(t,"class","sources-header svelte-1r759df")},m(y,w){T(y,t,w),b(t,n),b(n,l),b(n,r),b(n,s),b(t,u),_.m(t,null),T(y,a,w),v&&v.m(y,w),T(y,f,w),c=!0,d||(g=x(t,"click",e[3]),d=!0)},p(y,w){(!c||w&1)&&o!==(o=y[0].length+"")&&K(r,o),m!==(m=p(y))&&(_.d(1),_=m(y),_&&(_.c(),_.m(t,null))),y[2]?v?(v.p(y,w),w&4&&V(v,1)):(v=mi(y),v.c(),V(v,1),v.m(f.parentNode,f)):v&&(we(),z(v,1,1,()=>{v=null}),ye())},i(y){c||(V(v),c=!0)},o(y){z(v),c=!1},d(y){y&&P(t),_.d(),y&&P(a),v&&v.d(y),y&&P(f),d=!1,g()}}}function Sd(e){let t;return{c(){t=A("h5"),t.textContent="⚠️ No sources loaded",h(t,"class","bold")},m(n,l){T(n,t,l)},p:U,i:U,o:U,d(n){n&&P(t)}}}function Cd(e){let t;return{c(){t=A("h5"),t.textContent="📖 Loading...",h(t,"class","bold")},m(n,l){T(n,t,l)},p:U,i:U,o:U,d(n){n&&P(t)}}}function $d(e){let t;return{c(){t=A("h5"),t.textContent="⚠️ No Retrieval Sources selected",h(t,"class","bold")},m(n,l){T(n,t,l)},p:U,i:U,o:U,d(n){n&&P(t)}}}function Rd(e){let t;return{c(){t=A("span"),t.textContent="⌄"},m(n,l){T(n,t,l)},d(n){n&&P(t)}}}function Ad(e){let t;return{c(){t=A("span"),t.textContent="⌃"},m(n,l){T(n,t,l)},d(n){n&&P(t)}}}function mi(e){let t,n,l=e[0],o=[];for(let s=0;sz(o[s],1,1,()=>{o[s]=null});return{c(){for(let s=0;s{l=null}),ye())},i(o){n||(V(l),n=!0)},o(o){z(l),n=!1},d(o){o&&P(t),l&&l.d()}}}function Ed(e,t,n){let{sources:l=[]}=t,{source_content:o=[]}=t,r=!1;const s=()=>n(2,r=!r);return e.$$set=u=>{"sources"in u&&n(0,l=u.sources),"source_content"in u&&n(1,o=u.source_content)},[l,o,r,s]}class Fd extends ce{constructor(t){super(),de(this,t,Ed,Md,fe,{sources:0,source_content:1})}}function vi(e,t,n){const l=e.slice();return l[4]=t[n],l}function bi(e,t,n){const l=e.slice();return l[4]=t[n],l}function wi(e){let t,n,l,o=e[4].label+"",r,s,u,a,f;return{c(){t=A("li"),n=A("span"),l=A("h5"),r=q(o),s=N(),h(l,"class","bold"),h(n,"class","svelte-iwm583"),h(t,"class",u=Qo(e[0]===e[4].value?"active":"")+" svelte-iwm583")},m(c,d){T(c,t,d),b(t,n),b(n,l),b(l,r),b(t,s),a||(f=x(n,"click",function(){Ge(e[3](e[4].value))&&e[3](e[4].value).apply(this,arguments)}),a=!0)},p(c,d){e=c,d&2&&o!==(o=e[4].label+"")&&K(r,o),d&3&&u!==(u=Qo(e[0]===e[4].value?"active":"")+" svelte-iwm583")&&h(t,"class",u)},d(c){c&&P(t),a=!1,f()}}}function yi(e){let t,n,l,o;const r=[e[2]];var s=e[4].component;function u(a){let f={};for(let c=0;c{te(d,1)}),ye()}s?(n=Rt(s,u()),ne(n.$$.fragment),V(n.$$.fragment,1),ee(n,t,l)):n=null}else s&&n.$set(c)},i(a){o||(n&&V(n.$$.fragment,a),o=!0)},o(a){n&&z(n.$$.fragment,a),o=!1},d(a){a&&P(t),n&&te(n)}}}function ki(e){let t,n,l=e[0]==e[4].value&&yi(e);return{c(){l&&l.c(),t=Se()},m(o,r){l&&l.m(o,r),T(o,t,r),n=!0},p(o,r){o[0]==o[4].value?l?(l.p(o,r),r&3&&V(l,1)):(l=yi(o),l.c(),V(l,1),l.m(t.parentNode,t)):l&&(we(),z(l,1,1,()=>{l=null}),ye())},i(o){n||(V(l),n=!0)},o(o){z(l),n=!1},d(o){l&&l.d(o),o&&P(t)}}}function Dd(e){let t,n,l,o,r=e[1],s=[];for(let c=0;cz(a[c],1,1,()=>{a[c]=null});return{c(){t=A("ul");for(let c=0;c()=>n(0,o=u);return e.$$set=u=>{"items"in u&&n(1,l=u.items),"activeTabValue"in u&&n(0,o=u.activeTabValue),"tabProps"in u&&n(2,r=u.tabProps)},[o,l,r,s]}class Nd extends ce{constructor(t){super(),de(this,t,Id,Dd,fe,{items:1,activeTabValue:0,tabProps:2})}}function Si(e){let t;return{c(){t=q("Press ENTER to autofill with the RAG answer.")},m(n,l){T(n,t,l)},d(n){n&&P(t)}}}function Pd(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m=e[0].edited_answer===sl&&Si();return{c(){t=A("form"),n=A("textarea"),o=N(),r=A("div"),s=A("div"),m&&m.c(),u=N(),a=A("div"),f=A("button"),f.textContent="Update",c=N(),d=A("button"),d.textContent="Reset",h(n,"placeholder",l=e[0].answer),h(s,"class","note svelte-i9wciy"),h(r,"class","button-container svelte-i9wciy")},m(_,v){T(_,t,v),b(t,n),Ye(n,e[0].edited_answer),e[6](n),b(t,o),b(t,r),b(r,s),m&&m.m(s,null),b(r,u),b(r,a),b(a,f),b(a,c),b(a,d),g||(p=[x(n,"input",e[5]),x(n,"keydown",e[4]),x(f,"click",e[2]),x(d,"click",e[3])],g=!0)},p(_,[v]){v&1&&l!==(l=_[0].answer)&&h(n,"placeholder",l),v&1&&Ye(n,_[0].edited_answer),_[0].edited_answer===sl?m||(m=Si(),m.c(),m.m(s,null)):m&&(m.d(1),m=null)},i:U,o:U,d(_){_&&P(t),e[6](null),m&&m.d(),g=!1,be(p)}}}const sl="";function Td(e,t,n){let{message:l={}}=t,o;const r=async d=>{const g={id:l.id,new_answer:d},p=await fetch("/chat/rag_table/update_answer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)});if(p.ok)console.log("Answer updated successfully",p),n(0,l.edited_answer=d,l);else{const m=await p.text();alert(m)}},s=d=>{d.preventDefault(),r(l.edited_answer)},u=d=>{d.preventDefault(),r(sl)},a=d=>{d.key=="Enter"&&l.edited_answer===sl&&(d.preventDefault(),console.log("ENTER"),n(0,l.edited_answer=l.answer,l))};ft(function(){o.focus()});function f(){l.edited_answer=this.value,n(0,l)}function c(d){et[d?"unshift":"push"](()=>{o=d,n(1,o)})}return e.$$set=d=>{"message"in d&&n(0,l=d.message)},[l,o,s,u,a,f,c]}class Od extends ce{constructor(t){super(),de(this,t,Td,Pd,fe,{message:0})}}function Ci(e){let t,n,l,o,r,s;return{c(){t=A("div"),n=A("button"),n.textContent="👍",l=N(),o=A("button"),o.textContent="👎",h(n,"class","small-button thumbs-up svelte-1u8cd0w"),h(o,"class","small-button thumbs-down svelte-1u8cd0w"),h(t,"class","feedback-buttons svelte-1u8cd0w")},m(u,a){T(u,t,a),b(t,n),b(t,l),b(t,o),r||(s=[x(n,"click",e[4]),x(o,"click",e[5])],r=!0)},p:U,d(u){u&&P(t),r=!1,be(s)}}}function Vd(e){let t,n=e[0].answer+"",l,o,r,s=e[1]&&Ci(e);return{c(){t=A("div"),l=q(n),o=N(),s&&s.c(),r=Se()},m(u,a){T(u,t,a),b(t,l),T(u,o,a),s&&s.m(u,a),T(u,r,a)},p(u,[a]){a&1&&n!==(n=u[0].answer+"")&&K(l,n),u[1]?s?s.p(u,a):(s=Ci(u),s.c(),s.m(r.parentNode,r)):s&&(s.d(1),s=null)},i:U,o:U,d(u){u&&P(t),u&&P(o),s&&s.d(u),u&&P(r)}}}async function zd(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 Ld(e,t,n){let l;ue(e,qe,c=>n(6,l=c));let{message:o={}}=t,{feedback:r=!1}=t,{index:s=0}=t;function u(c,d,g){const p=l[g];p.vote=d;const m={id:g+1,vote_status:d};zd(m),pt(c.currentTarget.parentNode).selectAll("button").style("border","3px solid transparent").style("opacity",.65),pt(c.currentTarget).style("border","3px solid var(--black)").style("opacity",1)}const a=c=>u(c,"up",s),f=c=>u(c,"down",s);return e.$$set=c=>{"message"in c&&n(0,o=c.message),"feedback"in c&&n(1,r=c.feedback),"index"in c&&n(2,s=c.index)},[o,r,s,u,a,f]}class qd extends ce{constructor(t){super(),de(this,t,Ld,Vd,fe,{message:0,feedback:1,index:2})}}function $i(e,t,n){const l=e.slice();return l[19]=t[n],l[21]=n,l}function Ri(e,t){let n,l,o,r,s,u,a,f,c,d=t[19].question+"",g,p,m,_,v,y,w,S,M,$,F,C,R,k,E,I;return M=new Nd({props:{items:t[8],tabProps:{message:t[19],feedback:t[0],index:t[21]}}}),F=new Fd({props:{sources:t[19].source,source_content:t[19].source_content}}),{key:e,first:null,c(){n=A("div"),l=A("div"),o=A("div"),r=N(),s=A("div"),u=A("div"),a=A("h5"),a.textContent="Question:",f=N(),c=A("p"),g=q(d),p=N(),m=A("div"),_=A("p"),_.textContent="ℹ️ Retrieval Sources",y=N(),w=A("div"),S=A("div"),ne(M.$$.fragment),$=N(),ne(F.$$.fragment),C=N(),h(o,"class","avatar"),h(a,"class","bold"),h(_,"class","bold"),h(m,"class","rag-sources svelte-vgv4ev"),h(u,"class","question svelte-vgv4ev"),h(S,"class","answer svelte-vgv4ev"),h(w,"class","answers svelte-vgv4ev"),h(s,"class","message-content svelte-vgv4ev"),h(l,"class","chat-message-center svelte-vgv4ev"),h(n,"class","chat-message svelte-vgv4ev"),this.first=n},m(D,L){T(D,n,L),b(n,l),b(l,o),b(l,r),b(l,s),b(s,u),b(u,a),b(u,f),b(u,c),b(c,g),b(u,p),b(u,m),b(m,_),b(s,y),b(s,w),b(w,S),ee(M,S,null),b(s,$),ee(F,s,null),b(n,C),k=!0,E||(I=[Cn(v=md.call(null,_,Ai(t[19]))),Cn(R=Gd.call(null,n,t[21]===t[5].length-1))],E=!0)},p(D,L){t=D,(!k||L&32)&&d!==(d=t[19].question+"")&&K(g,d),v&&Ge(v.update)&&L&32&&v.update.call(null,Ai(t[19]));const O={};L&33&&(O.tabProps={message:t[19],feedback:t[0],index:t[21]}),M.$set(O);const B={};L&32&&(B.sources=t[19].source),L&32&&(B.source_content=t[19].source_content),F.$set(B),R&&Ge(R.update)&&L&32&&R.update.call(null,t[21]===t[5].length-1)},i(D){k||(V(M.$$.fragment,D),V(F.$$.fragment,D),k=!0)},o(D){z(M.$$.fragment,D),z(F.$$.fragment,D),k=!1},d(D){D&&P(n),te(M),te(F),E=!1,be(I)}}}function Hd(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m,_=[],v=new Map,y,w,S,M,$,F,C,R,k,E=(e[2]?e[4]:"Send")+"",I,D,L,O,B,j,ae;function pe(Y){e[13](Y)}let W={table:"rag_table"};e[3]!==void 0&&(W.showModal=e[3]),t=new Io({props:W}),et.push(()=>Rn(t,"showModal",pe));let Q=e[5];const X=Y=>Y[21];for(let Y=0;YDownload Data`,l=P(),o=A("div"),r=A("section"),s=A("div");for(let R=0;R{e.scrollIntoView({behavior:"smooth"})},0)}async function cd(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 dd(e,t,n){let l,o;ue(e,Nl,v=>n(3,o=v));let r="",s="",u=!1;ft(()=>{});const a=async v=>{v.preventDefault(),r=s,n(0,s=""),n(1,u=!0);let y={question:r,up_ranking_answer:"Loading...",low_ranking_answer:"Loading..."};De(Nl,o=[...o,y],o);const w=await fetch(`/chat/multi_responses/${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:r})});if(w.ok){const S=await w.json();y.up_ranking_answer=S.answer[0],y.low_ranking_answer=S.answer[1],Nl.update(M=>(M[M.length-1]=y,M))}else{const S=await w.text();alert(S)}n(1,u=!1)};let f=0;setInterval(()=>{n(6,f=(f+1)%4)},200);function c(v,y,w,S){const M=o[w],$={1:"up_ranking_answer",2:"low_ranking_answer"},F={question:M.question,up_ranking_answer:M[$[S]],low_ranking_answer:M[$[S%2+1]]};cd(F),pt(v.currentTarget.parentNode).selectAll("div").style("outline","2px solid var(--red)").style("border","1px solid var(--red)"),pt(v.currentTarget).style("outline","2px solid var(--green)").style("border","1px solid var(--green)")}const d=(v,y,w)=>c(w,v,y,1),p=(v,y,w)=>c(w,v,y,1),g=(v,y,w)=>c(w,v,y,2),m=(v,y,w)=>c(w,v,y,2);function _(){s=this.value,n(0,s)}return e.$$.update=()=>{e.$$.dirty&64&&n(2,l=".".repeat(f).padEnd(3))},[s,u,l,o,a,c,f,d,p,g,m,_]}class hd extends ce{constructor(t){super(),de(this,t,dd,ud,fe,{})}}function ro(e,t=2){if(e===0)return"0 Bytes";const n=1024,l=t<0?0:t,o=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],r=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/Math.pow(n,r)).toFixed(l))+" "+o[r]}function gd(e){let t={who:0,what:0,how:0,why:0,where:0,does:0,can:0,"n/a":0};for(let l=0;l({question:l,count:t[l]}))}function Aa(e){return e.map(t=>{const n=t.question.split(" ").length,l=t.answer.split(" ").length;return{index:t.index,question:+n,answer:+l,vote:t.vote}})}function Ra(e,t){e.classList.add("tooltip"),e.setAttribute("tabindex",0);function n(){const o=document.createElement("span");o.textContent=t,o.setAttribute("id","tooltip"),e.appendChild(o),e.addEventListener("mouseleave",l),e.addEventListener("blur",l),e.removeEventListener("mouseenter",n),e.removeEventListener("focus",n)}function l(){e.removeChild(e.querySelector("#tooltip")),e.removeEventListener("mouseleave",l),e.removeEventListener("blur",l),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 ci(e,t,n){const l=e.slice();return l[10]=t[n],l[12]=n,l}function pd(e){let t,n,l,o,r,s,u,a,f=e[0],c=[];for(let d=0;d16?e.slice(0,n)+"..."+e.slice(-n):e}function vd(e,t,n){let l;ue(e,It,g=>n(1,l=g));let{documents:o=[]}=t,r=!1,s;function u(g){g.preventDefault(),n(2,r=!r)}function a(g,m){m.target.checked?l.add(g):l.delete(g),It.set(new Set(l))}function f(g){g.preventDefault(),De(It,l=new Set(o.map(m=>m.name)),l),It.set(new Set(l))}function c(g){g.preventDefault(),De(It,l=new Set,l),It.set(new Set(l))}const d=(g,m)=>a(g.name,m);function p(g){et[g?"unshift":"push"](()=>{s=g,n(3,s)})}return e.$$set=g=>{"documents"in g&&n(0,o=g.documents)},e.$$.update=()=>{e.$$.dirty&2&&console.log(l)},[o,l,r,s,u,a,f,c,d,p]}let bd=class extends ce{constructor(t){super(),de(this,t,vd,_d,fe,{documents:0})}};function En(e,{delay:t=0,duration:n=400,easing:l=Eo,axis:o="y"}={}){const r=getComputedStyle(e),s=+r.opacity,u=o==="y"?"height":"width",a=parseFloat(r[u]),f=o==="y"?["top","bottom"]:["left","right"],c=f.map(y=>`${y[0].toUpperCase()}${y.slice(1)}`),d=parseFloat(r[`padding${c[0]}`]),p=parseFloat(r[`padding${c[1]}`]),g=parseFloat(r[`margin${c[0]}`]),m=parseFloat(r[`margin${c[1]}`]),_=parseFloat(r[`border${c[0]}Width`]),v=parseFloat(r[`border${c[1]}Width`]);return{delay:t,duration:n,easing:l,css:y=>`overflow: hidden;opacity: ${Math.min(y*20,1)*s};${u}: ${y*a}px;padding-${f[0]}: ${y*d}px;padding-${f[1]}: ${y*p}px;margin-${f[0]}: ${y*g}px;margin-${f[1]}: ${y*m}px;border-${f[0]}-width: ${y*_}px;border-${f[1]}-width: ${y*v}px;`}}function qn(e,{delay:t=0,duration:n=400,easing:l=Eo,start:o=0,opacity:r=0}={}){const s=getComputedStyle(e),u=+s.opacity,a=s.transform==="none"?"":s.transform,f=1-o,c=u*(1-r);return{delay:t,duration:n,easing:l,css:(d,p)=>` + transform: ${a} scale(${1-f*p}); + opacity: ${u-c*p} + `}}function wd(e){let t;return{c(){t=A("p"),t.textContent="⌄",h(t,"class","svelte-1pk2e1k")},m(n,l){T(n,t,l)},d(n){n&&N(t)}}}function yd(e){let t;return{c(){t=A("p"),t.textContent="⌃",h(t,"class","svelte-1pk2e1k")},m(n,l){T(n,t,l)},d(n){n&&N(t)}}}function gi(e){let t,n,l,o,r;return{c(){t=A("div"),n=A("p"),l=q(e[1]),h(n,"class","bold svelte-1pk2e1k"),h(t,"class","source_content svelte-1pk2e1k")},m(s,u){T(s,t,u),b(t,n),b(n,l),r=!0},p(s,u){(!r||u&2)&&K(l,s[1])},i(s){r||(Me(()=>{r&&(o||(o=lt(t,En,{},!0)),o.run(1))}),r=!0)},o(s){o||(o=lt(t,En,{},!1)),o.run(0),r=!1},d(s){s&&N(t),s&&o&&o.end()}}}function kd(e){let t,n,l,o=e[2]+1+"",r,s,u,a,f,c,d,p,g;function m(w,S){return w[3]?yd:wd}let _=m(e),v=_(e),y=e[3]&&gi(e);return{c(){t=A("div"),n=A("div"),l=A("p"),r=q(o),s=q(": "),u=q(e[0]),a=P(),v.c(),c=P(),y&&y.c(),h(l,"class","bold svelte-1pk2e1k"),h(n,"class","source_tab svelte-1pk2e1k"),h(t,"class","source svelte-1pk2e1k")},m(w,S){T(w,t,S),b(t,n),b(n,l),b(l,r),b(l,s),b(l,u),b(n,a),v.m(n,null),b(t,c),y&&y.m(t,null),d=!0,p||(g=x(n,"click",e[4]),p=!0)},p(w,[S]){(!d||S&4)&&o!==(o=w[2]+1+"")&&K(r,o),(!d||S&1)&&K(u,w[0]),_!==(_=m(w))&&(v.d(1),v=_(w),v&&(v.c(),v.m(n,null))),w[3]?y?(y.p(w,S),S&8&&V(y,1)):(y=gi(w),y.c(),V(y,1),y.m(t,null)):y&&(we(),z(y,1,1,()=>{y=null}),ye())},i(w){d||(Me(()=>{d&&(f||(f=lt(n,En,{},!0)),f.run(1))}),V(y),d=!0)},o(w){f||(f=lt(n,En,{},!1)),f.run(0),z(y),d=!1},d(w){w&&N(t),v.d(),w&&f&&f.end(),y&&y.d(),p=!1,g()}}}function Sd(e,t,n){let{source:l=""}=t,{source_content:o=""}=t,{i:r=0}=t,s=r===0;const u=()=>n(3,s=!s);return e.$$set=a=>{"source"in a&&n(0,l=a.source),"source_content"in a&&n(1,o=a.source_content),"i"in a&&n(2,r=a.i)},[l,o,r,s,u]}class Cd extends ce{constructor(t){super(),de(this,t,Sd,kd,fe,{source:0,source_content:1,i:2})}}function pi(e,t,n){const l=e.slice();return l[4]=t[n],l[6]=n,l}function mi(e){let t,n,l,o;const r=[Md,Rd,Ad,$d],s=[];function u(a,f){return a[0][0]==="N/A"?0:a[0][0]==="Loading..."?1:a[0][0]==="Not loaded"?2:3}return t=u(e),n=s[t]=r[t](e),{c(){n.c(),l=Se()},m(a,f){s[t].m(a,f),T(a,l,f),o=!0},p(a,f){let c=t;t=u(a),t===c?s[t].p(a,f):(we(),z(s[c],1,1,()=>{s[c]=null}),ye(),n=s[t],n?n.p(a,f):(n=s[t]=r[t](a),n.c()),V(n,1),n.m(l.parentNode,l))},i(a){o||(V(n),o=!0)},o(a){z(n),o=!1},d(a){s[t].d(a),a&&N(l)}}}function $d(e){let t,n,l,o=e[0].length+"",r,s,u,a,f,c,d,p;function g(y,w){return y[2]?Fd:Ed}let m=g(e),_=m(e),v=e[2]&&_i(e);return{c(){t=A("div"),n=A("h5"),l=q("📖 Response Sources ("),r=q(o),s=q(")"),u=P(),_.c(),a=P(),v&&v.c(),f=Se(),h(n,"class","bold"),h(t,"class","sources-header svelte-1r759df")},m(y,w){T(y,t,w),b(t,n),b(n,l),b(n,r),b(n,s),b(t,u),_.m(t,null),T(y,a,w),v&&v.m(y,w),T(y,f,w),c=!0,d||(p=x(t,"click",e[3]),d=!0)},p(y,w){(!c||w&1)&&o!==(o=y[0].length+"")&&K(r,o),m!==(m=g(y))&&(_.d(1),_=m(y),_&&(_.c(),_.m(t,null))),y[2]?v?(v.p(y,w),w&4&&V(v,1)):(v=_i(y),v.c(),V(v,1),v.m(f.parentNode,f)):v&&(we(),z(v,1,1,()=>{v=null}),ye())},i(y){c||(V(v),c=!0)},o(y){z(v),c=!1},d(y){y&&N(t),_.d(),y&&N(a),v&&v.d(y),y&&N(f),d=!1,p()}}}function Ad(e){let t;return{c(){t=A("h5"),t.textContent="⚠️ No sources loaded",h(t,"class","bold")},m(n,l){T(n,t,l)},p:U,i:U,o:U,d(n){n&&N(t)}}}function Rd(e){let t;return{c(){t=A("h5"),t.textContent="📖 Loading...",h(t,"class","bold")},m(n,l){T(n,t,l)},p:U,i:U,o:U,d(n){n&&N(t)}}}function Md(e){let t;return{c(){t=A("h5"),t.textContent="⚠️ No Retrieval Sources selected or received",h(t,"class","bold")},m(n,l){T(n,t,l)},p:U,i:U,o:U,d(n){n&&N(t)}}}function Ed(e){let t;return{c(){t=A("span"),t.textContent="⌄"},m(n,l){T(n,t,l)},d(n){n&&N(t)}}}function Fd(e){let t;return{c(){t=A("span"),t.textContent="⌃"},m(n,l){T(n,t,l)},d(n){n&&N(t)}}}function _i(e){let t,n,l=e[0],o=[];for(let s=0;sz(o[s],1,1,()=>{o[s]=null});return{c(){for(let s=0;s{l=null}),ye())},i(o){n||(V(l),n=!0)},o(o){z(l),n=!1},d(o){o&&N(t),l&&l.d()}}}function Id(e,t,n){let{sources:l=[]}=t,{source_content:o=[]}=t,r=!1;const s=()=>n(2,r=!r);return e.$$set=u=>{"sources"in u&&n(0,l=u.sources),"source_content"in u&&n(1,o=u.source_content)},[l,o,r,s]}class Nd extends ce{constructor(t){super(),de(this,t,Id,Dd,fe,{sources:0,source_content:1})}}function bi(e,t,n){const l=e.slice();return l[4]=t[n],l}function wi(e,t,n){const l=e.slice();return l[4]=t[n],l}function yi(e){let t,n,l,o=e[4].label+"",r,s,u,a,f;return{c(){t=A("li"),n=A("span"),l=A("h5"),r=q(o),s=P(),h(l,"class","bold"),h(n,"class","svelte-iwm583"),h(t,"class",u=Qo(e[0]===e[4].value?"active":"")+" svelte-iwm583")},m(c,d){T(c,t,d),b(t,n),b(n,l),b(l,r),b(t,s),a||(f=x(n,"click",function(){Ve(e[3](e[4].value))&&e[3](e[4].value).apply(this,arguments)}),a=!0)},p(c,d){e=c,d&2&&o!==(o=e[4].label+"")&&K(r,o),d&3&&u!==(u=Qo(e[0]===e[4].value?"active":"")+" svelte-iwm583")&&h(t,"class",u)},d(c){c&&N(t),a=!1,f()}}}function ki(e){let t,n,l,o;const r=[e[2]];var s=e[4].component;function u(a){let f={};for(let c=0;c{te(d,1)}),ye()}s?(n=At(s,u()),ne(n.$$.fragment),V(n.$$.fragment,1),ee(n,t,l)):n=null}else s&&n.$set(c)},i(a){o||(n&&V(n.$$.fragment,a),o=!0)},o(a){n&&z(n.$$.fragment,a),o=!1},d(a){a&&N(t),n&&te(n)}}}function Si(e){let t,n,l=e[0]==e[4].value&&ki(e);return{c(){l&&l.c(),t=Se()},m(o,r){l&&l.m(o,r),T(o,t,r),n=!0},p(o,r){o[0]==o[4].value?l?(l.p(o,r),r&3&&V(l,1)):(l=ki(o),l.c(),V(l,1),l.m(t.parentNode,t)):l&&(we(),z(l,1,1,()=>{l=null}),ye())},i(o){n||(V(l),n=!0)},o(o){z(l),n=!1},d(o){l&&l.d(o),o&&N(t)}}}function Pd(e){let t,n,l,o,r=e[1],s=[];for(let c=0;cz(a[c],1,1,()=>{a[c]=null});return{c(){t=A("ul");for(let c=0;c()=>n(0,o=u);return e.$$set=u=>{"items"in u&&n(1,l=u.items),"activeTabValue"in u&&n(0,o=u.activeTabValue),"tabProps"in u&&n(2,r=u.tabProps)},[o,l,r,s]}class Od extends ce{constructor(t){super(),de(this,t,Td,Pd,fe,{items:1,activeTabValue:0,tabProps:2})}}function Ci(e){let t;return{c(){t=q("Press ENTER to autofill with the RAG answer.")},m(n,l){T(n,t,l)},d(n){n&&N(t)}}}function Vd(e){let t,n,l,o,r,s,u,a,f,c,d,p,g,m=e[0].edited_answer===al&&Ci();return{c(){t=A("form"),n=A("textarea"),o=P(),r=A("div"),s=A("div"),m&&m.c(),u=P(),a=A("div"),f=A("button"),f.textContent="Update",c=P(),d=A("button"),d.textContent="Reset",h(n,"placeholder",l=e[0].answer),h(s,"class","note svelte-i9wciy"),h(r,"class","button-container svelte-i9wciy")},m(_,v){T(_,t,v),b(t,n),Ye(n,e[0].edited_answer),e[6](n),b(t,o),b(t,r),b(r,s),m&&m.m(s,null),b(r,u),b(r,a),b(a,f),b(a,c),b(a,d),p||(g=[x(n,"input",e[5]),x(n,"keydown",e[4]),x(f,"click",e[2]),x(d,"click",e[3])],p=!0)},p(_,[v]){v&1&&l!==(l=_[0].answer)&&h(n,"placeholder",l),v&1&&Ye(n,_[0].edited_answer),_[0].edited_answer===al?m||(m=Ci(),m.c(),m.m(s,null)):m&&(m.d(1),m=null)},i:U,o:U,d(_){_&&N(t),e[6](null),m&&m.d(),p=!1,ve(g)}}}const al="";function zd(e,t,n){let{message:l={}}=t,o;const r=async d=>{const p={id:l.id,new_answer:d},g=await fetch("/chat/rag_table/update_answer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(g.ok)console.log("Answer updated successfully",g),n(0,l.edited_answer=d,l);else{const m=await g.text();alert(m)}},s=d=>{d.preventDefault(),r(l.edited_answer)},u=d=>{d.preventDefault(),r(al)},a=d=>{d.key=="Enter"&&l.edited_answer===al&&(d.preventDefault(),console.log("ENTER"),n(0,l.edited_answer=l.answer,l))};ft(function(){o.focus()});function f(){l.edited_answer=this.value,n(0,l)}function c(d){et[d?"unshift":"push"](()=>{o=d,n(1,o)})}return e.$$set=d=>{"message"in d&&n(0,l=d.message)},[l,o,s,u,a,f,c]}class Ld extends ce{constructor(t){super(),de(this,t,zd,Vd,fe,{message:0})}}function $i(e){let t,n,l,o,r,s;return{c(){t=A("div"),n=A("button"),n.textContent="👍",l=P(),o=A("button"),o.textContent="👎",h(n,"class","small-button thumbs-up svelte-1u8cd0w"),h(o,"class","small-button thumbs-down svelte-1u8cd0w"),h(t,"class","feedback-buttons svelte-1u8cd0w")},m(u,a){T(u,t,a),b(t,n),b(t,l),b(t,o),r||(s=[x(n,"click",e[4]),x(o,"click",e[5])],r=!0)},p:U,d(u){u&&N(t),r=!1,ve(s)}}}function qd(e){let t,n=e[0].answer+"",l,o,r,s=e[1]&&$i(e);return{c(){t=A("div"),l=q(n),o=P(),s&&s.c(),r=Se()},m(u,a){T(u,t,a),b(t,l),T(u,o,a),s&&s.m(u,a),T(u,r,a)},p(u,[a]){a&1&&n!==(n=u[0].answer+"")&&K(l,n),u[1]?s?s.p(u,a):(s=$i(u),s.c(),s.m(r.parentNode,r)):s&&(s.d(1),s=null)},i:U,o:U,d(u){u&&N(t),u&&N(o),s&&s.d(u),u&&N(r)}}}async function Hd(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 Gd(e,t,n){let l;ue(e,He,c=>n(6,l=c));let{message:o={}}=t,{feedback:r=!1}=t,{index:s=0}=t;function u(c,d,p){const g=l[p];g.vote=d;const m={id:p+1,vote_status:d};Hd(m),pt(c.currentTarget.parentNode).selectAll("button").style("border","3px solid transparent").style("opacity",.65),pt(c.currentTarget).style("border","3px solid var(--black)").style("opacity",1)}const a=c=>u(c,"up",s),f=c=>u(c,"down",s);return e.$$set=c=>{"message"in c&&n(0,o=c.message),"feedback"in c&&n(1,r=c.feedback),"index"in c&&n(2,s=c.index)},[o,r,s,u,a,f]}class Bd extends ce{constructor(t){super(),de(this,t,Gd,qd,fe,{message:0,feedback:1,index:2})}}function Ai(e,t,n){const l=e.slice();return l[19]=t[n],l[21]=n,l}function Ri(e,t){let n,l,o,r,s,u,a,f,c,d=t[19].question+"",p,g,m,_,v,y,w,S,M,$,F,C,R,k,E,I;return M=new Od({props:{items:t[8],tabProps:{message:t[19],feedback:t[0],index:t[21]}}}),F=new Nd({props:{sources:t[19].source,source_content:t[19].source_content}}),{key:e,first:null,c(){n=A("div"),l=A("div"),o=A("div"),r=P(),s=A("div"),u=A("div"),a=A("h5"),a.textContent="Question:",f=P(),c=A("p"),p=q(d),g=P(),m=A("div"),_=A("p"),_.textContent="ℹ️ Retrieval Sources",y=P(),w=A("div"),S=A("div"),ne(M.$$.fragment),$=P(),ne(F.$$.fragment),C=P(),h(o,"class","avatar"),h(a,"class","bold"),h(_,"class","bold"),h(m,"class","rag-sources svelte-vgv4ev"),h(u,"class","question svelte-vgv4ev"),h(S,"class","answer svelte-vgv4ev"),h(w,"class","answers svelte-vgv4ev"),h(s,"class","message-content svelte-vgv4ev"),h(l,"class","chat-message-center svelte-vgv4ev"),h(n,"class","chat-message svelte-vgv4ev"),this.first=n},m(D,L){T(D,n,L),b(n,l),b(l,o),b(l,r),b(l,s),b(s,u),b(u,a),b(u,f),b(u,c),b(c,p),b(u,g),b(u,m),b(m,_),b(s,y),b(s,w),b(w,S),ee(M,S,null),b(s,$),ee(F,s,null),b(n,C),k=!0,E||(I=[en(v=Ra.call(null,_,Mi(t[19]))),en(R=xd.call(null,n,t[21]===t[5].length-1))],E=!0)},p(D,L){t=D,(!k||L&32)&&d!==(d=t[19].question+"")&&K(p,d),v&&Ve(v.update)&&L&32&&v.update.call(null,Mi(t[19]));const O={};L&33&&(O.tabProps={message:t[19],feedback:t[0],index:t[21]}),M.$set(O);const B={};L&32&&(B.sources=t[19].source),L&32&&(B.source_content=t[19].source_content),F.$set(B),R&&Ve(R.update)&&L&32&&R.update.call(null,t[21]===t[5].length-1)},i(D){k||(V(M.$$.fragment,D),V(F.$$.fragment,D),k=!0)},o(D){z(M.$$.fragment,D),z(F.$$.fragment,D),k=!1},d(D){D&&N(n),te(M),te(F),E=!1,ve(I)}}}function jd(e){let t,n,l,o,r,s,u,a,f,c,d,p,g,m,_=[],v=new Map,y,w,S,M,$,F,C,R,k,E=(e[2]?e[4]:"Send")+"",I,D,L,O,B,j,ae;function pe(Y){e[13](Y)}let W={table:"rag_table"};e[3]!==void 0&&(W.showModal=e[3]),t=new Io({props:W}),et.push(()=>Rn(t,"showModal",pe));let Q=e[5];const X=Y=>Y[21];for(let Y=0;Y👍 button. If the response is not satisfactory, click on the - 👎 button.`,f=N(),c=A("button"),c.textContent="Download Data",d=N(),g=A("div"),p=A("section"),m=A("div");for(let Y=0;Y<_.length;Y+=1)_[Y].c();y=N(),w=A("div"),S=A("div"),ne(M.$$.fragment),$=N(),F=A("form"),C=A("input"),R=N(),k=A("button"),I=q(E),L=N(),O=A("p"),O.textContent="Note - may produce inaccurate information.",h(s,"class","underline bold svelte-vgv4ev"),h(a,"class","svelte-vgv4ev"),h(c,"class","svelte-vgv4ev"),h(r,"class","instructions svelte-vgv4ev"),h(m,"class","chat-log svelte-vgv4ev"),h(p,"class","chatbox svelte-vgv4ev"),h(C,"class","chat-input-textarea svelte-vgv4ev"),h(C,"placeholder","Type Question Here"),h(k,"class",D="btnyousend "+(e[1]===""?"":"active")+" svelte-vgv4ev"),h(k,"type","submit"),h(F,"class","chat-input-form svelte-vgv4ev"),h(S,"class","chat-and-question svelte-vgv4ev"),h(O,"class","message svelte-vgv4ev"),h(w,"class","chat-input-holder svelte-vgv4ev"),h(g,"class","ranked-chat svelte-vgv4ev"),h(o,"class","ranked-feedback-container svelte-vgv4ev")},m(Y,le){ee(t,Y,le),T(Y,l,le),T(Y,o,le),b(o,r),b(r,s),b(r,u),b(r,a),b(r,f),b(r,c),b(o,d),b(o,g),b(g,p),b(p,m);for(let he=0;he<_.length;he+=1)_[he]&&_[he].m(m,null);b(g,y),b(g,w),b(w,S),ee(M,S,null),b(S,$),b(S,F),b(F,C),Ye(C,e[1]),b(F,R),b(F,k),b(k,I),b(w,L),b(w,O),B=!0,j||(ae=[x(c,"click",e[10]),x(C,"input",e[14]),x(F,"submit",e[9])],j=!0)},p(Y,[le]){const he={};!n&&le&8&&(n=!0,he.showModal=Y[3],$n(()=>n=!1)),t.$set(he),le&289&&(Q=Y[5],we(),_=gt(_,le,X,1,Y,Q,v,m,aa,Ri,null,$i),ye());const Vn={};le&64&&(Vn.documents=Y[6]),M.$set(Vn),le&2&&C.value!==Y[1]&&Ye(C,Y[1]),(!B||le&20)&&E!==(E=(Y[2]?Y[4]:"Send")+"")&&K(I,E),(!B||le&2&&D!==(D="btnyousend "+(Y[1]===""?"":"active")+" svelte-vgv4ev"))&&h(k,"class",D)},i(Y){if(!B){V(t.$$.fragment,Y);for(let le=0;le{e.scrollIntoView({behavior:"smooth"})},0)}function Ai(e){return e.rag_sources.length===0?"No Sources":e.rag_sources.join(", ")}function Bd(e,t,n){let l,o,r,s;ue(e,qe,F=>n(5,o=F)),ue(e,oo,F=>n(16,r=F));let{feedback:u=!1}=t,{is_retrieval:a=!1}=t;const f=De([]);ue(e,f,F=>n(6,s=F));let c="",d="",g=!1,p=!1,m=[{label:"Answer",value:1,component:qd},{label:"Modified Answer",value:2,component:Od}];ft(()=>{v(),_()});async function _(){const C=await(await fetch("/retrieval/file/get")).json();console.log("data",C.files);const k=C.files.map((E,I)=>({id:String(I),name:E.name}));console.log("files",k),Pe(f,s=[...k],s)}async function v(){const R=(await(await fetch("/chat/rag_table/retrieve")).json()).rows;console.log("Got data from db",R);const k=R.map(E=>({id:E[0],question:E[1],answer:E[2],edited_answer:E[3],vote_status:E[4],rag_sources:E[5],source:E[6],source_content:E[7]}));Pe(qe,o=[...k],o)}const y=async F=>{F.preventDefault(),c=d,n(1,d=""),n(2,g=!0);const C=[...r];let R={id:o.length+1,question:c,answer:"Loading...",rag_sources:C,vote_status:"na",source:["Loading..."],source_content:["Loading..."]};Pe(qe,o=[...o,R],o);const k=a?await fetch("/retrieval/new_message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:c,file_names:C})}):await fetch(`/chat/${c}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:c})});if(k.ok){const E=await k.json();console.log("response data",E),R.answer=E.answer,R.source=E.source,R.source_content=E.source_content,qe.update(I=>(I[I.length-1]=R,I))}else{const E=await k.text();alert(E)}n(2,g=!1)};let w=0;setInterval(()=>{n(12,w=(w+1)%4)},200);function S(){n(3,p=!0)}function M(F){p=F,n(3,p)}function $(){d=this.value,n(1,d)}return e.$$set=F=>{"feedback"in F&&n(0,u=F.feedback),"is_retrieval"in F&&n(11,a=F.is_retrieval)},e.$$.update=()=>{e.$$.dirty&4096&&n(4,l=".".repeat(w).padEnd(3))},[u,d,g,p,l,o,s,f,m,y,S,a,w,M,$]}class jd extends ce{constructor(t){super(),de(this,t,Bd,Hd,fe,{feedback:0,is_retrieval:11})}}function Mi(e){let t,n;return t=new No({props:{is_retrieval:e[1]}}),{c(){ne(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},p(l,o){const r={};o&2&&(r.is_retrieval=l[1]),t.$set(r)},i(l){n||(V(t.$$.fragment,l),n=!0)},o(l){z(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function Ei(e){let t,n;return t=new No({props:{feedback:!0,is_retrieval:e[1]}}),{c(){ne(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},p(l,o){const r={};o&2&&(r.is_retrieval=l[1]),t.$set(r)},i(l){n||(V(t.$$.fragment,l),n=!0)},o(l){z(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function Fi(e){let t,n;return t=new jd({props:{feedback:!0,is_retrieval:e[1]}}),{c(){ne(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},p(l,o){const r={};o&2&&(r.is_retrieval=l[1]),t.$set(r)},i(l){n||(V(t.$$.fragment,l),n=!0)},o(l){z(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function Di(e){let t,n,l,o;const r=[Ud,xd],s=[];function u(a,f){return a[1]?0:1}return t=u(e),n=s[t]=r[t](e),{c(){n.c(),l=Se()},m(a,f){s[t].m(a,f),T(a,l,f),o=!0},p(a,f){let c=t;t=u(a),t===c?s[t].p(a,f):(we(),z(s[c],1,1,()=>{s[c]=null}),ye(),n=s[t],n?n.p(a,f):(n=s[t]=r[t](a),n.c()),V(n,1),n.m(l.parentNode,l))},i(a){o||(V(n),o=!0)},o(a){z(n),o=!1},d(a){s[t].d(a),a&&P(l)}}}function xd(e){let t,n;return t=new cd({}),{c(){ne(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},p:U,i(l){n||(V(t.$$.fragment,l),n=!0)},o(l){z(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function Ud(e){let t,n;return t=new No({props:{feedback:!0,is_retrieval:e[1]}}),{c(){ne(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},p(l,o){const r={};o&2&&(r.is_retrieval=l[1]),t.$set(r)},i(l){n||(V(t.$$.fragment,l),n=!0)},o(l){z(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function Wd(e){let t,n,l,o,r,s=!e[0]&&Mi(e),u=e[0]==="vote"&&Ei(e),a=e[0]==="rag"&&Fi(e),f=e[0]==="rank"&&Di(e);return{c(){s&&s.c(),t=N(),u&&u.c(),n=N(),a&&a.c(),l=N(),f&&f.c(),o=Se()},m(c,d){s&&s.m(c,d),T(c,t,d),u&&u.m(c,d),T(c,n,d),a&&a.m(c,d),T(c,l,d),f&&f.m(c,d),T(c,o,d),r=!0},p(c,[d]){c[0]?s&&(we(),z(s,1,1,()=>{s=null}),ye()):s?(s.p(c,d),d&1&&V(s,1)):(s=Mi(c),s.c(),V(s,1),s.m(t.parentNode,t)),c[0]==="vote"?u?(u.p(c,d),d&1&&V(u,1)):(u=Ei(c),u.c(),V(u,1),u.m(n.parentNode,n)):u&&(we(),z(u,1,1,()=>{u=null}),ye()),c[0]==="rag"?a?(a.p(c,d),d&1&&V(a,1)):(a=Fi(c),a.c(),V(a,1),a.m(l.parentNode,l)):a&&(we(),z(a,1,1,()=>{a=null}),ye()),c[0]==="rank"?f?(f.p(c,d),d&1&&V(f,1)):(f=Di(c),f.c(),V(f,1),f.m(o.parentNode,o)):f&&(we(),z(f,1,1,()=>{f=null}),ye())},i(c){r||(V(s),V(u),V(a),V(f),r=!0)},o(c){z(s),z(u),z(a),z(f),r=!1},d(c){s&&s.d(c),c&&P(t),u&&u.d(c),c&&P(n),a&&a.d(c),c&&P(l),f&&f.d(c),c&&P(o)}}}function Xd(e,t,n){let{feedback:l}=t,{is_retrieval:o}=t;return e.$$set=r=>{"feedback"in r&&n(0,l=r.feedback),"is_retrieval"in r&&n(1,o=r.is_retrieval)},[l,o]}class Yd extends ce{constructor(t){super(),de(this,t,Xd,Wd,fe,{feedback:0,is_retrieval:1})}}function Ii(e,t,n){const l=e.slice();return l[2]=t[n],l}function Ni(e){let t,n=e[2]+"",l,o;return{c(){t=A("option"),l=q(n),t.__value=o=e[2],t.value=t.__value},m(r,s){T(r,t,s),b(t,l)},p(r,s){s&1&&n!==(n=r[2]+"")&&K(l,n),s&1&&o!==(o=r[2])&&(t.__value=o,t.value=t.__value)},d(r){r&&P(t)}}}function Qd(e){let t,n=e[0],l=[];for(let o=0;o{const r=await fetch(`/data/${l}`);n(0,o=await r.json())}),e.$$set=r=>{"data_endpoint"in r&&n(1,l=r.data_endpoint)},[o,l]}class Jd extends ce{constructor(t){super(),de(this,t,Kd,Qd,fe,{data_endpoint:1})}}function Qt(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function Zd(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Ra(e){let t,n,l;e.length!==2?(t=Qt,n=(u,a)=>Qt(e(u),a),l=(u,a)=>e(u)-a):(t=e===Qt||e===Zd?e:eh,n=e,l=e);function o(u,a,f=0,c=u.length){if(f>>1;n(u[d],a)<0?f=d+1:c=d}while(f>>1;n(u[d],a)<=0?f=d+1:c=d}while(ff&&l(u[d-1],a)>-l(u[d],a)?d-1:d}return{left:o,center:s,right:r}}function eh(){return 0}function th(e){return e===null?NaN:+e}function*nh(e,t){if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&(yield n);else{let n=-1;for(let l of e)(l=t(l,++n,e))!=null&&(l=+l)>=l&&(yield l)}}const lh=Ra(Qt),oh=lh.right;Ra(th).center;const Aa=oh;function ih(e,t){let n=0;if(t===void 0)for(let l of e)l!=null&&(l=+l)>=l&&++n;else{let l=-1;for(let o of e)(o=t(o,++l,e))!=null&&(o=+o)>=o&&++n}return n}function rh(e,t){let n=0,l,o=0,r=0;if(t===void 0)for(let s of e)s!=null&&(s=+s)>=s&&(l=s-o,o+=l/++n,r+=l*(s-o));else{let s=-1;for(let u of e)(u=t(u,++s,e))!=null&&(u=+u)>=u&&(l=u-o,o+=l/++n,r+=l*(u-o))}if(n>1)return r/(n-1)}function sh(e,t){const n=rh(e,t);return n&&Math.sqrt(n)}function _n(e,t){let n,l;if(t===void 0)for(const o of e)o!=null&&(n===void 0?o>=o&&(n=l=o):(n>o&&(n=o),l=r&&(n=l=r):(n>r&&(n=r),l{const l=e(t,n);return l||l===0?l:(e(n,n)===0)-(e(t,t)===0)}}function Ma(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}var hh=Array.prototype,gh=hh.slice;function Pl(e){return()=>e}const ph=Math.sqrt(50),mh=Math.sqrt(10),_h=Math.sqrt(2);function al(e,t,n){const l=(t-e)/Math.max(0,n),o=Math.floor(Math.log10(l)),r=l/Math.pow(10,o),s=r>=ph?10:r>=mh?5:r>=_h?2:1;let u,a,f;return o<0?(f=Math.pow(10,-o)/s,u=Math.round(e*f),a=Math.round(t*f),u/ft&&--a,f=-f):(f=Math.pow(10,o)*s,u=Math.round(e/f),a=Math.round(t/f),u*ft&&--a),a0))return[];if(e===t)return[e];const l=t=o))return[];const u=r-o+1,a=new Array(u);if(l)if(s<0)for(let f=0;f0?(e=Math.floor(e/o)*o,t=Math.ceil(t/o)*o):o<0&&(e=Math.ceil(e*o)/o,t=Math.floor(t*o)/o),l=o}}function wh(e){return Math.max(1,Math.ceil(Math.log(ih(e))/Math.LN2)+1)}function Fa(){var e=ch,t=_n,n=wh;function l(o){Array.isArray(o)||(o=Array.from(o));var r,s=o.length,u,a,f=new Array(s);for(r=0;r=g)if(S>=g&&t===_n){const $=en(d,g,M);isFinite($)&&($>0?g=(Math.floor(g/$)+1)*$:$<0&&(g=(Math.ceil(g*-$)+1)/-$))}else p.pop()}for(var m=p.length,_=0,v=m;p[_]<=d;)++_;for(;p[v-1]>g;)--v;(_||v0?p[r-1]:d,w.x1=r0)for(r=0;r=l)&&(n=l);else{let l=-1;for(let o of e)(o=t(o,++l,e))!=null&&(n=o)&&(n=o)}return n}function so(e,t){let n;if(t===void 0)for(const l of e)l!=null&&(n>l||n===void 0&&l>=l)&&(n=l);else{let l=-1;for(let o of e)(o=t(o,++l,e))!=null&&(n>o||n===void 0&&o>=o)&&(n=o)}return n}function Da(e,t,n=0,l=1/0,o){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),l=Math.floor(Math.min(e.length-1,l)),!(n<=t&&t<=l))return e;for(o=o===void 0?Ma:dh(o);l>n;){if(l-n>600){const a=l-n+1,f=t-n+1,c=Math.log(a),d=.5*Math.exp(2*c/3),g=.5*Math.sqrt(c*d*(a-d)/a)*(f-a/2<0?-1:1),p=Math.max(n,Math.floor(t-f*d/a+g)),m=Math.min(l,Math.floor(t+(a-f)*d/a+g));Da(e,t,p,m,o)}const r=e[t];let s=n,u=l;for(un(e,n,t),o(e[l],r)>0&&un(e,n,l);s0;)--u}o(e[n],r)===0?un(e,n,u):(++u,un(e,u,l)),u<=t&&(n=u+1),t<=u&&(l=u-1)}return e}function un(e,t,n){const l=e[t];e[t]=e[n],e[n]=l}function yh(e,t,n){if(e=Float64Array.from(nh(e,n)),!(!(l=e.length)||isNaN(t=+t))){if(t<=0||l<2)return so(e);if(t>=1)return mt(e);var l,o=(l-1)*t,r=Math.floor(o),s=mt(Da(e,r).subarray(0,r+1)),u=so(e.subarray(r+1));return s+(u-s)*(o-r)}}function kh(e,t){let n=0,l=0;if(t===void 0)for(let o of e)o!=null&&(o=+o)>=o&&(++n,l+=o);else{let o=-1;for(let r of e)(r=t(r,++o,e))!=null&&(r=+r)>=r&&(++n,l+=r)}if(n)return l/n}function Sh(e,t,n){e=+e,t=+t,n=(o=arguments.length)<2?(t=e,e=0,1):o<3?1:+n;for(var l=-1,o=Math.max(0,Math.ceil((t-e)/n))|0,r=new Array(o);++l=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function ul(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,l=e.slice(0,n);return[l.length>1?l[0]+l.slice(2):l,+e.slice(n+1)]}function tn(e){return e=ul(Math.abs(e)),e?e[1]:NaN}function $h(e,t){return function(n,l){for(var o=n.length,r=[],s=0,u=e[0],a=0;o>0&&u>0&&(a+u+1>l&&(u=Math.max(1,l-a)),r.push(n.substring(o-=u,o+u)),!((a+=u+1)>l));)u=e[s=(s+1)%e.length];return r.reverse().join(t)}}function Rh(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var Ah=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function fl(e){if(!(t=Ah.exec(e)))throw new Error("invalid format: "+e);var t;return new Po({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]})}fl.prototype=Po.prototype;function Po(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+""}Po.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 Mh(e){e:for(var t=e.length,n=1,l=-1,o;n0&&(l=0);break}return l>0?e.slice(0,l)+e.slice(o+1):e}var Ia;function Eh(e,t){var n=ul(e,t);if(!n)return e+"";var l=n[0],o=n[1],r=o-(Ia=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,s=l.length;return r===s?l:r>s?l+new Array(r-s+1).join("0"):r>0?l.slice(0,r)+"."+l.slice(r):"0."+new Array(1-r).join("0")+ul(e,Math.max(0,t+r-1))[0]}function Oi(e,t){var n=ul(e,t);if(!n)return e+"";var l=n[0],o=n[1];return o<0?"0."+new Array(-o).join("0")+l:l.length>o+1?l.slice(0,o+1)+"."+l.slice(o+1):l+new Array(o-l.length+2).join("0")}const Vi={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Ch,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)=>Oi(e*100,t),r:Oi,s:Eh,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function zi(e){return e}var Li=Array.prototype.map,qi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Fh(e){var t=e.grouping===void 0||e.thousands===void 0?zi:$h(Li.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",l=e.currency===void 0?"":e.currency[1]+"",o=e.decimal===void 0?".":e.decimal+"",r=e.numerals===void 0?zi:Rh(Li.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",u=e.minus===void 0?"−":e.minus+"",a=e.nan===void 0?"NaN":e.nan+"";function f(d){d=fl(d);var g=d.fill,p=d.align,m=d.sign,_=d.symbol,v=d.zero,y=d.width,w=d.comma,S=d.precision,M=d.trim,$=d.type;$==="n"?(w=!0,$="g"):Vi[$]||(S===void 0&&(S=12),M=!0,$="g"),(v||g==="0"&&p==="=")&&(v=!0,g="0",p="=");var F=_==="$"?n:_==="#"&&/[boxX]/.test($)?"0"+$.toLowerCase():"",C=_==="$"?l:/[%p]/.test($)?s:"",R=Vi[$],k=/[defgprs%]/.test($);S=S===void 0?6:/[gprs]/.test($)?Math.max(1,Math.min(21,S)):Math.max(0,Math.min(20,S));function E(I){var D=F,L=C,O,B,j;if($==="c")L=R(I)+L,I="";else{I=+I;var ae=I<0||1/I<0;if(I=isNaN(I)?a:R(Math.abs(I),S),M&&(I=Mh(I)),ae&&+I==0&&m!=="+"&&(ae=!1),D=(ae?m==="("?m:u:m==="-"||m==="("?"":m)+D,L=($==="s"?qi[8+Ia/3]:"")+L+(ae&&m==="("?")":""),k){for(O=-1,B=I.length;++Oj||j>57){L=(j===46?o+I.slice(O+1):I.slice(O))+L,I=I.slice(0,O);break}}}w&&!v&&(I=t(I,1/0));var pe=D.length+I.length+L.length,W=pe>1)+D+I+L+W.slice(pe);break;default:I=W+D+I+L;break}return r(I)}return E.toString=function(){return d+""},E}function c(d,g){var p=f((d=fl(d),d.type="f",d)),m=Math.max(-8,Math.min(8,Math.floor(tn(g)/3)))*3,_=Math.pow(10,-m),v=qi[8+m/3];return function(y){return p(_*y)+v}}return{format:f,formatPrefix:c}}var qn,vt,Na;Dh({thousands:",",grouping:[3],currency:["$",""]});function Dh(e){return qn=Fh(e),vt=qn.format,Na=qn.formatPrefix,qn}function Ih(e){return Math.max(0,-tn(Math.abs(e)))}function Nh(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(tn(t)/3)))*3-tn(Math.abs(e)))}function Ph(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,tn(t)-tn(e))+1}function To(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Th(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const Hi=Symbol("implicit");function Mt(){var e=new Pi,t=[],n=[],l=Hi;function o(r){let s=e.get(r);if(s===void 0){if(l!==Hi)return l;e.set(r,s=t.push(r)-1)}return n[s%n.length]}return o.domain=function(r){if(!arguments.length)return t.slice();t=[],e=new Pi;for(const s of r)e.has(s)||e.set(s,t.push(s)-1);return o},o.range=function(r){return arguments.length?(n=Array.from(r),o):n.slice()},o.unknown=function(r){return arguments.length?(l=r,o):l},o.copy=function(){return Mt(t,n).unknown(l)},To.apply(o,arguments),o}function Lt(){var e=Mt().unknown(void 0),t=e.domain,n=e.range,l=0,o=1,r,s,u=!1,a=0,f=0,c=.5;delete e.unknown;function d(){var g=t().length,p=o>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Hn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Hn(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=Vh.exec(e))?new He(t[1],t[2],t[3],1):(t=zh.exec(e))?new He(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Lh.exec(e))?Hn(t[1],t[2],t[3],t[4]):(t=qh.exec(e))?Hn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Hh.exec(e))?Yi(t[1],t[2]/100,t[3]/100,1):(t=Gh.exec(e))?Yi(t[1],t[2]/100,t[3]/100,t[4]):Bi.hasOwnProperty(e)?Ui(Bi[e]):e==="transparent"?new He(NaN,NaN,NaN,0):null}function Ui(e){return new He(e>>16&255,e>>8&255,e&255,1)}function Hn(e,t,n,l){return l<=0&&(e=t=n=NaN),new He(e,t,n,l)}function xh(e){return e instanceof Nn||(e=Dn(e)),e?(e=e.rgb(),new He(e.r,e.g,e.b,e.opacity)):new He}function ao(e,t,n,l){return arguments.length===1?xh(e):new He(e,t,n,l??1)}function He(e,t,n,l){this.r=+e,this.g=+t,this.b=+n,this.opacity=+l}Oo(He,ao,Ta(Nn,{brighter(e){return e=e==null?cl:Math.pow(cl,e),new He(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?En:Math.pow(En,e),new He(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new He(Vt(this.r),Vt(this.g),Vt(this.b),dl(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:Wi,formatHex:Wi,formatHex8:Uh,formatRgb:Xi,toString:Xi}));function Wi(){return`#${Tt(this.r)}${Tt(this.g)}${Tt(this.b)}`}function Uh(){return`#${Tt(this.r)}${Tt(this.g)}${Tt(this.b)}${Tt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Xi(){const e=dl(this.opacity);return`${e===1?"rgb(":"rgba("}${Vt(this.r)}, ${Vt(this.g)}, ${Vt(this.b)}${e===1?")":`, ${e})`}`}function dl(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Vt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Tt(e){return e=Vt(e),(e<16?"0":"")+e.toString(16)}function Yi(e,t,n,l){return l<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Je(e,t,n,l)}function Oa(e){if(e instanceof Je)return new Je(e.h,e.s,e.l,e.opacity);if(e instanceof Nn||(e=Dn(e)),!e)return new Je;if(e instanceof Je)return e;e=e.rgb();var t=e.r/255,n=e.g/255,l=e.b/255,o=Math.min(t,n,l),r=Math.max(t,n,l),s=NaN,u=r-o,a=(r+o)/2;return u?(t===r?s=(n-l)/u+(n0&&a<1?0:s,new Je(s,u,a,e.opacity)}function Wh(e,t,n,l){return arguments.length===1?Oa(e):new Je(e,t,n,l??1)}function Je(e,t,n,l){this.h=+e,this.s=+t,this.l=+n,this.opacity=+l}Oo(Je,Wh,Ta(Nn,{brighter(e){return e=e==null?cl:Math.pow(cl,e),new Je(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?En:Math.pow(En,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,l=n+(n<.5?n:1-n)*t,o=2*n-l;return new He(Tl(e>=240?e-240:e+120,o,l),Tl(e,o,l),Tl(e<120?e+240:e-120,o,l),this.opacity)},clamp(){return new Je(Qi(this.h),Gn(this.s),Gn(this.l),dl(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=dl(this.opacity);return`${e===1?"hsl(":"hsla("}${Qi(this.h)}, ${Gn(this.s)*100}%, ${Gn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Qi(e){return e=(e||0)%360,e<0?e+360:e}function Gn(e){return Math.max(0,Math.min(1,e||0))}function Tl(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 Vo=e=>()=>e;function Xh(e,t){return function(n){return e+n*t}}function Yh(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(l){return Math.pow(e+l*t,n)}}function Qh(e){return(e=+e)==1?Va:function(t,n){return n-t?Yh(t,n,e):Vo(isNaN(t)?n:t)}}function Va(e,t){var n=t-e;return n?Xh(e,n):Vo(isNaN(e)?t:e)}const uo=function e(t){var n=Qh(t);function l(o,r){var s=n((o=ao(o)).r,(r=ao(r)).r),u=n(o.g,r.g),a=n(o.b,r.b),f=Va(o.opacity,r.opacity);return function(c){return o.r=s(c),o.g=u(c),o.b=a(c),o.opacity=f(c),o+""}}return l.gamma=e,l}(1);function Kh(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,l=t.slice(),o;return function(r){for(o=0;on&&(r=t.slice(n,r),u[s]?u[s]+=r:u[++s]=r),(l=l[0])===(o=o[0])?u[s]?u[s]+=o:u[++s]=o:(u[++s]=null,a.push({i:s,x:hl(l,o)})),n=Ol.lastIndex;return nt&&(n=e,e=t,t=n),function(l){return Math.max(e,Math.min(t,l))}}function ag(e,t,n){var l=e[0],o=e[1],r=t[0],s=t[1];return o2?ug:ag,a=f=null,d}function d(g){return g==null||isNaN(g=+g)?r:(a||(a=u(e.map(l),t,n)))(l(s(g)))}return d.invert=function(g){return s(o((f||(f=u(t,e.map(l),hl)))(g)))},d.domain=function(g){return arguments.length?(e=Array.from(g,rg),c()):e.slice()},d.range=function(g){return arguments.length?(t=Array.from(g),c()):t.slice()},d.rangeRound=function(g){return t=Array.from(g),n=za,c()},d.clamp=function(g){return arguments.length?(s=g?!0:kt,c()):s!==kt},d.interpolate=function(g){return arguments.length?(n=g,c()):n},d.unknown=function(g){return arguments.length?(r=g,d):r},function(g,p){return l=g,o=p,c()}}function dg(){return cg()(kt,kt)}function hg(e,t,n,l){var o=vh(e,t,n),r;switch(l=fl(l??",f"),l.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return l.precision==null&&!isNaN(r=Nh(o,s))&&(l.precision=r),Na(l,s)}case"":case"e":case"g":case"p":case"r":{l.precision==null&&!isNaN(r=Ph(o,Math.max(Math.abs(e),Math.abs(t))))&&(l.precision=r-(l.type==="e"));break}case"f":case"%":{l.precision==null&&!isNaN(r=Ih(o))&&(l.precision=r-(l.type==="%")*2);break}}return vt(l)}function La(e){var t=e.domain;return e.ticks=function(n){var l=t();return Ea(l[0],l[l.length-1],n??10)},e.tickFormat=function(n,l){var o=t();return hg(o[0],o[o.length-1],n??10,l)},e.nice=function(n){n==null&&(n=10);var l=t(),o=0,r=l.length-1,s=l[o],u=l[r],a,f,c=10;for(u0;){if(f=en(s,u,n),f===a)return l[o]=s,l[r]=u,t(l);if(f>0)s=Math.floor(s/f)*f,u=Math.ceil(u/f)*f;else if(f<0)s=Math.ceil(s*f)/f,u=Math.floor(u*f)/f;else break;a=f}return e},e}function We(){var e=dg();return e.copy=function(){return fg(e,We())},To.apply(e,arguments),La(e)}function gg(){var e=0,t=1,n,l,o,r,s=kt,u=!1,a;function f(d){return d==null||isNaN(d=+d)?a:s(o===0?.5:(d=(r(d)-n)*o,u?Math.max(0,Math.min(1,d)):d))}f.domain=function(d){return arguments.length?([e,t]=d,n=r(e=+e),l=r(t=+t),o=n===l?0:1/(l-n),f):[e,t]},f.clamp=function(d){return arguments.length?(u=!!d,f):u},f.interpolator=function(d){return arguments.length?(s=d,f):s};function c(d){return function(g){var p,m;return arguments.length?([p,m]=g,s=d(p,m),f):[s(0),s(1)]}}return f.range=c(Pn),f.rangeRound=c(za),f.unknown=function(d){return arguments.length?(a=d,f):a},function(d){return r=d,n=d(e),l=d(t),o=n===l?0:1/(l-n),f}}function pg(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function qa(){var e=La(gg()(kt));return e.copy=function(){return pg(e,qa())},Th.apply(e,arguments)}function nt(e){return function(){return e}}const ho=Math.PI,go=2*ho,It=1e-6,mg=go-It;function Ha(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Ha;const n=10**t;return function(l){this._+=l[0];for(let o=1,r=l.length;oIt)if(!(Math.abs(d*a-f*c)>It)||!r)this._append`L${this._x1=t},${this._y1=n}`;else{let p=l-s,m=o-u,_=a*a+f*f,v=p*p+m*m,y=Math.sqrt(_),w=Math.sqrt(g),S=r*Math.tan((ho-Math.acos((_+g-v)/(2*y*w)))/2),M=S/w,$=S/y;Math.abs(M-1)>It&&this._append`L${t+M*c},${n+M*d}`,this._append`A${r},${r},0,0,${+(d*p>c*m)},${this._x1=t+$*a},${this._y1=n+$*f}`}}arc(t,n,l,o,r,s){if(t=+t,n=+n,l=+l,s=!!s,l<0)throw new Error(`negative radius: ${l}`);let u=l*Math.cos(o),a=l*Math.sin(o),f=t+u,c=n+a,d=1^s,g=s?o-r:r-o;this._x1===null?this._append`M${f},${c}`:(Math.abs(this._x1-f)>It||Math.abs(this._y1-c)>It)&&this._append`L${f},${c}`,l&&(g<0&&(g=g%go+go),g>mg?this._append`A${l},${l},0,1,${d},${t-u},${n-a}A${l},${l},0,1,${d},${this._x1=f},${this._y1=c}`:g>It&&this._append`A${l},${l},0,${+(g>=ho)},${d},${this._x1=t+l*Math.cos(r)},${this._y1=n+l*Math.sin(r)}`)}rect(t,n,l,o){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${l=+l}v${+o}h${-l}Z`}toString(){return this._}}function bg(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const l=Math.floor(n);if(!(l>=0))throw new RangeError(`invalid digits: ${n}`);t=l}return e},()=>new vg(t)}function Ga(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ba(e){this._context=e}Ba.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function wg(e){return new Ba(e)}function yg(e){return e[0]}function kg(e){return e[1]}function Sg(e,t){var n=nt(!0),l=null,o=wg,r=null,s=bg(u);e=typeof e=="function"?e:e===void 0?yg:nt(e),t=typeof t=="function"?t:t===void 0?kg:nt(t);function u(a){var f,c=(a=Ga(a)).length,d,g=!1,p;for(l==null&&(r=o(p=s())),f=0;f<=c;++f)!(f1)for(var n=1,l,o,r=e[t[0]],s,u=r.length;n=0;)n[t]=t;return n}function Cg(e,t){return e[t]}function $g(e){const t=[];return t.key=e,t}function Rg(){var e=nt([]),t=mo,n=po,l=Cg;function o(r){var s=Array.from(e.apply(this,arguments),$g),u,a=s.length,f=-1,c;for(const d of r)for(u=0,++f;uFeedback Distribution

",n=N(),l=A("div"),o=G("svg");for(let a=0;ae[19].call(l))},m(a,f){T(a,t,f),T(a,n,f),T(a,l,f),b(l,o);for(let c=0;cn(15,d=R)),ue(e,Zo,R=>n(4,g=R)),ue(e,qe,R=>n(16,p=R));let m=300,_=300;const v={up:2,down:1,"n/a":0,all:"all"},y={top:10,bottom:10,left:25,right:5},w=Mt().range(["var(--yellow)","var(--red)","var(--green)"]),S=vt(".0%");function M(R,k){l===R?n(5,l="all"):n(5,l=R),Pe(st,d=l==="all"?"all":k,d)}const $=(R,k)=>M(R,k.key),F=(R,k)=>M(R,k.key);function C(){_=this.offsetWidth,m=this.offsetHeight,n(1,_),n(0,m)}return e.$$.update=()=>{e.$$.dirty&32768&&n(5,l=v[d]),e.$$.dirty&2&&n(3,o=_-y.left-y.right),e.$$.dirty&1&&n(14,r=m-y.top-y.bottom),e.$$.dirty&65552&&p.forEach(R=>{Pe(Zo,g[R.vote_status]++,g)}),e.$$.dirty&16&&n(2,s=g.up+g.down+g["n/a"]),e.$$.dirty&16384&&n(8,u=Lt().rangeRound([y.top,r-y.bottom]).padding(0).domain(["a"])),e.$$.dirty&12&&n(7,a=We().rangeRound([y.left,o-y.right]).domain([0,s])),e.$$.dirty&8208&&n(6,c=f([g]))},n(13,f=Rg().keys(["n/a","down","up"]).order(mo).offset(po)),[m,_,s,o,g,l,c,a,u,y,w,S,M,f,r,d,p,$,F,C]}class ja extends ce{constructor(t){super(),de(this,t,Mg,Ag,fe,{})}}function Eg(e){let t,n,l,o,r,s,u,a,f,c,d,g=e[3][e[2]]+"",p,m;return{c(){t=A("div"),n=A("div"),l=q("Q: "),o=q(e[0]),r=N(),s=A("div"),u=q("A: "),a=q(e[1]),f=N(),c=A("div"),d=q("Rating: "),p=q(g),h(n,"class","question svelte-szi0e"),h(s,"class","answer svelte-szi0e"),h(c,"class",m="feedback "+e[2]+" svelte-szi0e"),h(t,"class","qa-card svelte-szi0e")},m(_,v){T(_,t,v),b(t,n),b(n,l),b(n,o),b(t,r),b(t,s),b(s,u),b(s,a),b(t,f),b(t,c),b(c,d),b(c,p)},p(_,[v]){v&1&&K(o,_[0]),v&2&&K(a,_[1]),v&4&&g!==(g=_[3][_[2]]+"")&&K(p,g),v&4&&m!==(m="feedback "+_[2]+" svelte-szi0e")&&h(c,"class",m)},i:U,o:U,d(_){_&&P(t)}}}function Fg(e,t,n){let{question:l="What is gradient descent?"}=t,{answer:o="Gradient descent is an algorithm used to minimize a loss function by taking small steps in the direction of steepest descent."}=t,{feedback:r="Good: 👍"}=t;const s={up:"Good 👍",down:"Bad 👎","n/a":"No Rating",all:"All"};return e.$$set=u=>{"question"in u&&n(0,l=u.question),"answer"in u&&n(1,o=u.answer),"feedback"in u&&n(2,r=u.feedback)},[l,o,r,s]}class Dg extends ce{constructor(t){super(),de(this,t,Fg,Eg,fe,{question:0,answer:1,feedback:2})}}function nr(e,t,n){const l=e.slice();return l[5]=t[n].question,l[6]=t[n].answer,l[7]=t[n].vote_status,l}function lr(e){let t,n,l,o,r;return n=new Dg({props:{question:e[5],answer:e[6],feedback:e[7]}}),{c(){t=A("div"),ne(n.$$.fragment),l=N()},m(s,u){T(s,t,u),ee(n,t,null),b(t,l),r=!0},p(s,u){const a={};u&1&&(a.question=s[5]),u&1&&(a.answer=s[6]),u&1&&(a.feedback=s[7]),n.$set(a)},i(s){r||(V(n.$$.fragment,s),s&&Me(()=>{r&&(o||(o=lt(t,e[1],{duration:300},!0)),o.run(1))}),r=!0)},o(s){z(n.$$.fragment,s),s&&(o||(o=lt(t,e[1],{duration:300},!1)),o.run(0)),r=!1},d(s){s&&P(t),te(n),s&&o&&o.end()}}}function Ig(e){let t,n,l=e[0],o=[];for(let s=0;sz(o[s],1,1,()=>{o[s]=null});return{c(){t=A("div");for(let s=0;sn(4,o=a)),ue(e,st,a=>n(2,r=a)),ue(e,An,a=>n(3,s=a));const u=(a,{delay:f=0,duration:c=1e3,easing:d=Eo})=>Mn(a,{delay:f,duration:c,easing:d});return e.$$.update=()=>{e.$$.dirty&12&&n(0,l=r==="all"?s:s.filter(a=>a.vote_status===r)),e.$$.dirty&1&&Pe(lo,o=pd(l),o)},[l,u,r,s]}class xa extends ce{constructor(t){super(),de(this,t,Ng,Ig,fe,{})}}function or(e,t,n){const l=e.slice();return l[13]=t[n],l}function ir(e,t,n){const l=e.slice();return l[16]=t[n],l}function rr(e,t,n){const l=e.slice();return l[16]=t[n],l}function sr(e){let t,n,l,o,r=e[16]+"",s,u;return{c(){t=G("g"),n=G("line"),o=G("text"),s=q(r),h(n,"class","axis-tick svelte-1oikip4"),h(n,"x1","0"),h(n,"x2","0"),h(n,"y1",0),h(n,"y2",l=-e[2]+e[10].bottom+e[10].top),h(n,"stroke","var(--squidink)"),h(n,"stroke-dasharray","4"),h(o,"class","axis-text svelte-1oikip4"),h(o,"y","15"),h(o,"text-anchor","middle"),h(t,"transform",u=`translate(${e[6](e[16])+e[6].bandwidth()/2} ${e[2]-e[10].bottom})`)},m(a,f){T(a,t,f),b(t,n),b(t,o),b(o,s)},p(a,f){f&4&&l!==(l=-a[2]+a[10].bottom+a[10].top)&&h(n,"y2",l),f&16&&r!==(r=a[16]+"")&&K(s,r),f&84&&u!==(u=`translate(${a[6](a[16])+a[6].bandwidth()/2} ${a[2]-a[10].bottom})`)&&h(t,"transform",u)},d(a){a&&P(t)}}}function ar(e){let t,n,l,o;return{c(){t=G("g"),n=G("line"),h(n,"class","axis-tick svelte-1oikip4"),h(n,"x1",0),h(n,"x2",l=e[3]-e[10].right-e[10].left),h(n,"y1","0"),h(n,"y2","0"),h(n,"stroke","black"),h(t,"transform",o=`translate(${e[10].left} ${e[5](e[16])+0})`)},m(r,s){T(r,t,s),b(t,n)},p(r,s){s&8&&l!==(l=r[3]-r[10].right-r[10].left)&&h(n,"x2",l),s&32&&o!==(o=`translate(${r[10].left} ${r[5](r[16])+0})`)&&h(t,"transform",o)},d(r){r&&P(t)}}}function ur(e){let t,n,l,o,r,s,u,a,f=Math.round(e[11](e[13].count))+"",c,d,g;return{c(){t=G("g"),n=G("rect"),a=G("text"),c=q(f),h(n,"x",l=e[6](e[13].question)),h(n,"y",o=e[5](e[13].count)),h(n,"height",r=e[2]-e[5](e[13].count)-e[10].bottom),h(n,"fill",s=e[9][e[7]]),h(n,"fill-opacity","0.95"),h(n,"width",u=e[6].bandwidth()),h(n,"class","svelte-1oikip4"),h(a,"class","axis-text svelte-1oikip4"),h(a,"x",d=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(p,m){T(p,t,m),b(t,n),b(t,a),b(a,c)},p(p,m){m&80&&l!==(l=p[6](p[13].question))&&h(n,"x",l),m&48&&o!==(o=p[5](p[13].count))&&h(n,"y",o),m&52&&r!==(r=p[2]-p[5](p[13].count)-p[10].bottom)&&h(n,"height",r),m&128&&s!==(s=p[9][p[7]])&&h(n,"fill",s),m&64&&u!==(u=p[6].bandwidth())&&h(n,"width",u),m&16&&f!==(f=Math.round(p[11](p[13].count))+"")&&K(c,f),m&80&&d!==(d=p[6](p[13].question)+p[6].bandwidth()/2)&&h(a,"x",d),m&48&&g!==(g=p[5](p[13].count)-5)&&h(a,"y",g)},d(p){p&&P(t)}}}function Pg(e){let t,n,l,o,r,s,u=e[8][e[7]]+"",a,f,c,d,g,p,m,_,v,y=e[4].map(fr),w=[];for(let C=0;Ce[12].call(t))},m(C,R){T(C,t,R),b(t,n);for(let k=0;ke.question;function Tg(e,t,n){let l,o,r,s,u,a;ue(e,lo,v=>n(4,u=v)),ue(e,st,v=>n(7,a=v));const f={up:"Good 👍",down:"Bad 👎","n/a":"No Rating",all:"All"},c={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"#bfbfbf"};let d=300,g=300,p={top:35,bottom:10,left:25,right:5};const m=vt(".1f");function _(){g=this.offsetWidth,d=this.offsetHeight,n(1,g),n(0,d)}return e.$$.update=()=>{e.$$.dirty&2&&n(3,l=g-p.left-p.right),e.$$.dirty&1&&n(2,o=d-p.top-p.bottom),e.$$.dirty&24&&n(6,r=Lt().rangeRound([p.left,l-p.right]).padding(.05).domain(u.map(v=>v.question))),e.$$.dirty&20&&n(5,s=We().rangeRound([o-p.bottom,p.top]).domain([0,mt(u,v=>v.count)])),e.$$.dirty&16&&console.log(u)},[d,g,o,l,u,s,r,a,f,c,p,m,_]}class Ua extends ce{constructor(t){super(),de(this,t,Tg,Pg,fe,{})}}function cr(e,t,n){const l=e.slice();l[19]=t[n];const o=l[7](l[19].x1)-l[7](l[19].x0);return l[20]=o,l}function dr(e,t,n){const l=e.slice();return l[23]=t[n],l}function hr(e){let t,n,l,o,r=e[23]+"",s,u;return{c(){t=G("g"),n=G("line"),o=G("text"),s=q(r),h(n,"class","axis-tick svelte-kz2qh6"),h(n,"x1","0"),h(n,"x2","0"),h(n,"y1",0),h(n,"y2",l=-e[2]+e[9].bottom+e[9].top),h(n,"stroke","var(--squidink)"),h(n,"stroke-dasharray","4"),h(o,"class","axis-text svelte-kz2qh6"),h(o,"y","15"),h(o,"text-anchor","middle"),h(t,"transform",u=`translate(${e[7](e[23])+(e[7](1)-e[7](0))/2} ${e[2]-e[9].bottom})`),h(t,"class","svelte-kz2qh6")},m(a,f){T(a,t,f),b(t,n),b(t,o),b(o,s)},p(a,f){f&4&&l!==(l=-a[2]+a[9].bottom+a[9].top)&&h(n,"y2",l),f&128&&r!==(r=a[23]+"")&&K(s,r),f&132&&u!==(u=`translate(${a[7](a[23])+(a[7](1)-a[7](0))/2} ${a[2]-a[9].bottom})`)&&h(t,"transform",u)},d(a){a&&P(t)}}}function gr(e){let t,n,l,o,r,s,u;return{c(){t=G("g"),n=G("rect"),h(n,"x",l=e[7](e[19].x0)+1),h(n,"width",o=e[20]),h(n,"y",r=e[6](e[19].length)),h(n,"height",s=e[6](0)-e[6](e[19].length)),h(n,"fill",u=e[8][e[5]]),h(n,"class","svelte-kz2qh6"),h(t,"class","histogram-bin svelte-kz2qh6")},m(a,f){T(a,t,f),b(t,n)},p(a,f){f&136&&l!==(l=a[7](a[19].x0)+1)&&h(n,"x",l),f&136&&o!==(o=a[20])&&h(n,"width",o),f&72&&r!==(r=a[6](a[19].length))&&h(n,"y",r),f&72&&s!==(s=a[6](0)-a[6](a[19].length))&&h(n,"height",s),f&32&&u!==(u=a[8][a[5]])&&h(n,"fill",u)},d(a){a&&P(t)}}}function Og(e){let t,n,l,o,r,s,u,a,f,c,d,g=e[7].ticks(),p=[];for(let v=0;ve[14].call(t))},m(v,y){T(v,t,y),b(t,n);for(let w=0;wn(5,d=S)),ue(e,qe,S=>n(13,g=S));const p={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"#bfbfbf"};let m=300,_=300,v={top:15,bottom:10,left:25,right:5};vt(".1f");let y=Array.from({length:pr},(S,M)=>M);function w(){_=this.offsetWidth,m=this.offsetHeight,n(1,_),n(0,m)}return e.$$.update=()=>{e.$$.dirty&8224&&n(12,l=d==="all"?g:g.filter(S=>S.vote_status===d)),e.$$.dirty&4096&&n(11,o=$a(l)),e.$$.dirty&2&&n(4,r=_-v.left-v.right),e.$$.dirty&1&&n(2,s=m-v.top-v.bottom),e.$$.dirty&2048&&n(3,u=Fa().thresholds(y).value(S=>S.answer)(o)),e.$$.dirty&16&&n(7,a=We().domain([3,pr]).range([v.left,r-v.right])),e.$$.dirty&12&&n(6,f=We().domain([0,mt(u,S=>S.length)]).range([s-v.bottom,v.top])),e.$$.dirty&2048&&n(10,c=mt(o,S=>S.length)),e.$$.dirty&1056&&We().domain([0,c]).range(["white",p[d]]).interpolate(Pn)},[m,_,s,u,r,d,f,a,p,v,c,o,l,g,w]}class Wa extends ce{constructor(t){super(),de(this,t,Vg,Og,fe,{})}}function mr(e,t,n){const l=e.slice();l[18]=t[n];const o=l[7](l[18].x1)-l[7](l[18].x0);return l[19]=o,l}function _r(e,t,n){const l=e.slice();return l[22]=t[n],l}function vr(e){let t,n,l,o,r=e[22]+"",s,u;return{c(){t=G("g"),n=G("line"),o=G("text"),s=q(r),h(n,"class","axis-tick svelte-kz2qh6"),h(n,"x1","0"),h(n,"x2","0"),h(n,"y1",0),h(n,"y2",l=-e[2]+e[9].bottom+e[9].top),h(n,"stroke","var(--squidink)"),h(n,"stroke-dasharray","4"),h(o,"class","axis-text svelte-kz2qh6"),h(o,"y","15"),h(o,"text-anchor","middle"),h(t,"transform",u=`translate(${e[7](e[22])+(e[7](1)-e[7](0))/2} ${e[2]-e[9].bottom})`),h(t,"class","svelte-kz2qh6")},m(a,f){T(a,t,f),b(t,n),b(t,o),b(o,s)},p(a,f){f&4&&l!==(l=-a[2]+a[9].bottom+a[9].top)&&h(n,"y2",l),f&128&&r!==(r=a[22]+"")&&K(s,r),f&132&&u!==(u=`translate(${a[7](a[22])+(a[7](1)-a[7](0))/2} ${a[2]-a[9].bottom})`)&&h(t,"transform",u)},d(a){a&&P(t)}}}function br(e){let t,n,l,o,r,s,u;return{c(){t=G("g"),n=G("rect"),h(n,"x",l=e[7](e[18].x0)+1),h(n,"width",o=e[19]),h(n,"y",r=e[6](e[18].length)),h(n,"height",s=e[6](0)-e[6](e[18].length)),h(n,"fill",u=e[8][e[5]]),h(n,"class","svelte-kz2qh6"),h(t,"class","histogram-bin svelte-kz2qh6")},m(a,f){T(a,t,f),b(t,n)},p(a,f){f&136&&l!==(l=a[7](a[18].x0)+1)&&h(n,"x",l),f&136&&o!==(o=a[19])&&h(n,"width",o),f&72&&r!==(r=a[6](a[18].length))&&h(n,"y",r),f&72&&s!==(s=a[6](0)-a[6](a[18].length))&&h(n,"height",s),f&32&&u!==(u=a[8][a[5]])&&h(n,"fill",u)},d(a){a&&P(t)}}}function zg(e){let t,n,l,o,r,s,u,a,f,c,d,g=e[7].ticks(),p=[];for(let v=0;ve[13].call(t))},m(v,y){T(v,t,y),b(t,n);for(let w=0;wn(5,c=w)),ue(e,qe,w=>n(12,d=w));const g={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"#bfbfbf"};let p=300,m=300,_={top:15,bottom:10,left:25,right:5},v=Array.from({length:wr},(w,S)=>S);Mt().range(["var(--yellow)","var(--red)","var(--green)"]);function y(){m=this.offsetWidth,p=this.offsetHeight,n(1,m),n(0,p)}return e.$$.update=()=>{e.$$.dirty&4128&&n(11,l=c==="all"?d:d.filter(w=>w.vote_status===c)),e.$$.dirty&2048&&n(10,o=$a(l)),e.$$.dirty&2&&n(4,r=m-_.left-_.right),e.$$.dirty&1&&n(2,s=p-_.top-_.bottom),e.$$.dirty&1024&&n(3,u=Fa().thresholds(v).value(w=>w.question)(o)),e.$$.dirty&16&&n(7,a=We().domain([3,wr]).range([_.left,r-_.right])),e.$$.dirty&12&&n(6,f=We().domain([0,mt(u,w=>w.length)]).range([s-_.bottom,_.top])),e.$$.dirty&1024&&mt(o,w=>w.length)},[p,m,s,u,r,c,f,a,g,_,o,l,d,y]}class Xa extends ce{constructor(t){super(),de(this,t,Lg,zg,fe,{})}}function qg(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m=Math.round(e[5](e[3]))+"",_,v,y,w,S,M,$,F;return{c(){t=A("div"),n=A("div"),l=A("p"),l.textContent="Questions",o=N(),r=A("select"),s=A("option"),s.textContent="All",u=A("option"),u.textContent="Good",a=A("option"),a.textContent="Bad",f=A("option"),f.textContent="N/A",c=N(),d=A("div"),g=G("svg"),p=G("text"),_=q(m),S=N(),M=A("p"),M.textContent="number of responses",h(l,"class","card-text svelte-1pknxov"),s.__value="all",s.value=s.__value,h(s,"class","svelte-1pknxov"),u.__value="up",u.value=u.__value,h(u,"class","svelte-1pknxov"),a.__value="down",a.value=a.__value,h(a,"class","svelte-1pknxov"),f.__value="n/a",f.value=f.__value,h(f,"class","svelte-1pknxov"),h(r,"id","feedback-dropdown"),h(r,"name","feedback-dropdown"),Ae(r,"background",e[6][e[0]]),h(r,"class","svelte-1pknxov"),e[0]===void 0&&Me(()=>e[9].call(r)),h(n,"class","svelte-1pknxov"),h(p,"dominant-baseline","middle"),h(p,"x",v=e[2]/2),h(p,"y",y=e[1]/2),h(p,"text-anchor","middle"),h(p,"class","svelte-1pknxov"),h(g,"width",e[2]),h(g,"height",e[1]),h(g,"class","svelte-1pknxov"),h(d,"class","svelte-1pknxov"),Me(()=>e[10].call(d)),h(M,"class","small svelte-1pknxov"),h(t,"class","card-container svelte-1pknxov"),Ae(t,"background",e[6][e[0]])},m(C,R){T(C,t,R),b(t,n),b(n,l),b(n,o),b(n,r),b(r,s),b(r,u),b(r,a),b(r,f),ll(r,e[0],!0),b(t,c),b(t,d),b(d,g),b(g,p),b(p,_),w=ut(d,e[10].bind(d)),b(t,S),b(t,M),$||(F=x(r,"change",e[9]),$=!0)},p(C,[R]){R&1&&Ae(r,"background",C[6][C[0]]),R&1&&ll(r,C[0]),R&8&&m!==(m=Math.round(C[5](C[3]))+"")&&K(_,m),R&4&&v!==(v=C[2]/2)&&h(p,"x",v),R&2&&y!==(y=C[1]/2)&&h(p,"y",y),R&4&&h(g,"width",C[2]),R&2&&h(g,"height",C[1]),R&1&&Ae(t,"background",C[6][C[0]])},i:U,o:U,d(C){C&&P(t),w(),$=!1,F()}}}function Hg(e,t){return t==="all"?e.length:e.filter(l=>l.vote_status===t).length}function Gg(e,t,n){let l,o,r,s;ue(e,st,m=>n(0,o=m)),ue(e,qe,m=>n(8,r=m));let u,a,f=Fo(0);ue(e,f,m=>n(3,s=m));const c=vt(".1f"),d={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"var(--white)"};function g(){o=ra(this),st.set(o)}function p(){a=this.clientWidth,u=this.clientHeight,n(2,a),n(1,u)}return e.$$.update=()=>{e.$$.dirty&257&&n(7,l=Hg(r,o)),e.$$.dirty&128&&console.log("fbc",l),e.$$.dirty&128&&f.set(l)},[o,u,a,s,f,c,d,l,r,g,p]}class Ya extends ce{constructor(t){super(),de(this,t,Gg,qg,fe,{})}}function Bg(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m=e[5](e[3])+"",_,v,y,w,S,M,$,F;return{c(){t=A("div"),n=A("div"),l=A("p"),l.textContent="Questions",o=N(),r=A("select"),s=A("option"),s.textContent="All",u=A("option"),u.textContent="Good",a=A("option"),a.textContent="Bad",f=A("option"),f.textContent="N/A",c=N(),d=A("div"),g=G("svg"),p=G("text"),_=q(m),S=N(),M=A("p"),M.textContent="percentage of responses",h(l,"class","card-text svelte-mchgj2"),s.__value="all",s.value=s.__value,u.__value="up",u.value=u.__value,a.__value="down",a.value=a.__value,f.__value="n/a",f.value=f.__value,h(r,"id","feedback-dropdown"),h(r,"name","feedback-dropdown"),Ae(r,"background",e[6][e[0]]),h(r,"class","svelte-mchgj2"),e[0]===void 0&&Me(()=>e[9].call(r)),h(p,"dominant-baseline","middle"),h(p,"x",v=e[2]/2),h(p,"y",y=e[1]/2),h(p,"text-anchor","middle"),h(p,"class","svelte-mchgj2"),h(g,"width",e[2]),h(g,"height",e[1]),h(g,"class","svelte-mchgj2"),Me(()=>e[10].call(d)),h(M,"class","small svelte-mchgj2"),h(t,"class","card-container svelte-mchgj2"),Ae(t,"background",e[6][e[0]])},m(C,R){T(C,t,R),b(t,n),b(n,l),b(n,o),b(n,r),b(r,s),b(r,u),b(r,a),b(r,f),ll(r,e[0],!0),b(t,c),b(t,d),b(d,g),b(g,p),b(p,_),w=ut(d,e[10].bind(d)),b(t,S),b(t,M),$||(F=x(r,"change",e[9]),$=!0)},p(C,[R]){R&1&&Ae(r,"background",C[6][C[0]]),R&1&&ll(r,C[0]),R&8&&m!==(m=C[5](C[3])+"")&&K(_,m),R&4&&v!==(v=C[2]/2)&&h(p,"x",v),R&2&&y!==(y=C[1]/2)&&h(p,"y",y),R&4&&h(g,"width",C[2]),R&2&&h(g,"height",C[1]),R&1&&Ae(t,"background",C[6][C[0]])},i:U,o:U,d(C){C&&P(t),w(),$=!1,F()}}}function jg(e,t){const n=e.length;return t==="all"?1:e.filter(o=>o.vote_status===t).length/n}function xg(e,t,n){let l,o,r,s;ue(e,st,m=>n(0,o=m)),ue(e,qe,m=>n(8,r=m));let u,a,f=Fo(0);ue(e,f,m=>n(3,s=m));const c=vt(".1%"),d={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"var(--white)"};function g(){o=ra(this),st.set(o)}function p(){a=this.clientWidth,u=this.clientHeight,n(2,a),n(1,u)}return e.$$.update=()=>{e.$$.dirty&257&&n(7,l=jg(r,o)),e.$$.dirty&128&&f.set(l)},[o,u,a,s,f,c,d,l,r,g,p]}class Qa extends ce{constructor(t){super(),de(this,t,xg,Bg,fe,{})}}function Ug(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m,_,v,y,w,S,M,$,F,C,R,k,E,I;return r=new Ya({}),a=new Qa({}),d=new ja({}),m=new Ua({props:{feedback:"Bad"}}),y=new Xa({}),M=new Wa({}),E=new xa({}),{c(){t=A("div"),n=A("div"),l=A("div"),o=A("div"),ne(r.$$.fragment),s=N(),u=A("div"),ne(a.$$.fragment),f=N(),c=A("div"),ne(d.$$.fragment),g=N(),p=A("div"),ne(m.$$.fragment),_=N(),v=A("div"),ne(y.$$.fragment),w=N(),S=A("div"),ne(M.$$.fragment),$=N(),F=A("div"),C=A("div"),C.innerHTML=`
-
`,R=N(),k=A("div"),ne(E.$$.fragment),h(o,"class","card-1 svelte-14znspc"),h(u,"class","card-2"),h(l,"class","left-text svelte-14znspc"),h(c,"class","left-confidence svelte-14znspc"),h(p,"class","left-question svelte-14znspc"),h(v,"class","left-filter svelte-14znspc"),h(S,"class","left-filter2"),h(n,"class","feedback-left svelte-14znspc"),h(C,"class","right-chart svelte-14znspc"),h(k,"class","right-table svelte-14znspc"),h(F,"class","feedback-right svelte-14znspc"),h(t,"class","feedback-container svelte-14znspc")},m(D,L){T(D,t,L),b(t,n),b(n,l),b(l,o),ee(r,o,null),b(l,s),b(l,u),ee(a,u,null),b(n,f),b(n,c),ee(d,c,null),b(n,g),b(n,p),ee(m,p,null),b(n,_),b(n,v),ee(y,v,null),b(n,w),b(n,S),ee(M,S,null),b(t,$),b(t,F),b(F,C),b(F,R),b(F,k),ee(E,k,null),I=!0},p:U,i(D){I||(V(r.$$.fragment,D),V(a.$$.fragment,D),V(d.$$.fragment,D),V(m.$$.fragment,D),V(y.$$.fragment,D),V(M.$$.fragment,D),V(E.$$.fragment,D),I=!0)},o(D){z(r.$$.fragment,D),z(a.$$.fragment,D),z(d.$$.fragment,D),z(m.$$.fragment,D),z(y.$$.fragment,D),z(M.$$.fragment,D),z(E.$$.fragment,D),I=!1},d(D){D&&P(t),te(r),te(a),te(d),te(m),te(y),te(M),te(E)}}}function Wg(e,t,n){let l;ue(e,An,r=>n(0,l=r)),ft(()=>{o()});async function o(){const a=(await(await fetch("/chat/qa_table/retrieve")).json()).rows.map(f=>({id:f[0],question:f[1],answer:f[2],vote_status:f[3]}));Pe(An,l=[...a],l)}return[]}class Ka extends ce{constructor(t){super(),de(this,t,Wg,Ug,fe,{})}}/**! + 👎 button.`,f=P(),c=A("button"),c.textContent="Download Data",d=P(),p=A("div"),g=A("section"),m=A("div");for(let Y=0;Y<_.length;Y+=1)_[Y].c();y=P(),w=A("div"),S=A("div"),ne(M.$$.fragment),$=P(),F=A("form"),C=A("input"),R=P(),k=A("button"),I=q(E),L=P(),O=A("p"),O.textContent="Note - may produce inaccurate information.",h(s,"class","underline bold svelte-vgv4ev"),h(a,"class","svelte-vgv4ev"),h(c,"class","svelte-vgv4ev"),h(r,"class","instructions svelte-vgv4ev"),h(m,"class","chat-log svelte-vgv4ev"),h(g,"class","chatbox svelte-vgv4ev"),h(C,"class","chat-input-textarea svelte-vgv4ev"),h(C,"placeholder","Type Question Here"),h(k,"class",D="btnyousend "+(e[1]===""?"":"active")+" svelte-vgv4ev"),h(k,"type","submit"),h(F,"class","chat-input-form svelte-vgv4ev"),h(S,"class","chat-and-question svelte-vgv4ev"),h(O,"class","message svelte-vgv4ev"),h(w,"class","chat-input-holder svelte-vgv4ev"),h(p,"class","ranked-chat svelte-vgv4ev"),h(o,"class","ranked-feedback-container svelte-vgv4ev")},m(Y,le){ee(t,Y,le),T(Y,l,le),T(Y,o,le),b(o,r),b(r,s),b(r,u),b(r,a),b(r,f),b(r,c),b(o,d),b(o,p),b(p,g),b(g,m);for(let he=0;he<_.length;he+=1)_[he]&&_[he].m(m,null);b(p,y),b(p,w),b(w,S),ee(M,S,null),b(S,$),b(S,F),b(F,C),Ye(C,e[1]),b(F,R),b(F,k),b(k,I),b(w,L),b(w,O),B=!0,j||(ae=[x(c,"click",e[10]),x(C,"input",e[14]),x(F,"submit",e[9])],j=!0)},p(Y,[le]){const he={};!n&&le&8&&(n=!0,he.showModal=Y[3],An(()=>n=!1)),t.$set(he),le&289&&(Q=Y[5],we(),_=gt(_,le,X,1,Y,Q,v,m,ua,Ri,null,Ai),ye());const zn={};le&64&&(zn.documents=Y[6]),M.$set(zn),le&2&&C.value!==Y[1]&&Ye(C,Y[1]),(!B||le&20)&&E!==(E=(Y[2]?Y[4]:"Send")+"")&&K(I,E),(!B||le&2&&D!==(D="btnyousend "+(Y[1]===""?"":"active")+" svelte-vgv4ev"))&&h(k,"class",D)},i(Y){if(!B){V(t.$$.fragment,Y);for(let le=0;le{e.scrollIntoView({behavior:"smooth"})},0)}function Mi(e){return e.rag_sources.length===0?"No Sources":e.rag_sources.join(", ")}function Ud(e,t,n){let l,o,r,s;ue(e,He,F=>n(5,o=F)),ue(e,It,F=>n(16,r=F));let{feedback:u=!1}=t,{is_retrieval:a=!1}=t;const f=Ie([]);ue(e,f,F=>n(6,s=F));let c="",d="",p=!1,g=!1,m=[{label:"Answer",value:1,component:Bd},{label:"Modified Answer",value:2,component:Ld}];ft(()=>{v(),_()});async function _(){const C=await(await fetch("/retrieval/file/get")).json();console.log("data",C.files);const k=C.files.map((E,I)=>({id:String(I),name:E.name}));console.log("files",k),De(f,s=[...k],s)}async function v(){const R=(await(await fetch("/chat/rag_table/retrieve")).json()).rows;console.log("Got data from db",R);const k=R.map(E=>({id:E[0],question:E[1],answer:E[2],edited_answer:E[3],vote_status:E[4],rag_sources:E[5],source:E[6],source_content:E[7]}));De(He,o=[...k],o)}const y=async F=>{F.preventDefault(),c=d,n(1,d=""),n(2,p=!0);const C=[...r];let R={id:o.length+1,question:c,answer:"Loading...",rag_sources:C,vote_status:"na",source:["Loading..."],source_content:["Loading..."]};De(He,o=[...o,R],o);const k=a?await fetch("/retrieval/new_message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:c,file_names:C})}):await fetch(`/chat/${c}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:c})});if(k.ok){const E=await k.json();console.log("response data",E),R.answer=E.answer,R.source=E.source,R.source_content=E.source_content,He.update(I=>(I[I.length-1]=R,I))}else{const E=await k.text();alert(E)}n(2,p=!1)};let w=0;setInterval(()=>{n(12,w=(w+1)%4)},200);function S(){n(3,g=!0)}function M(F){g=F,n(3,g)}function $(){d=this.value,n(1,d)}return e.$$set=F=>{"feedback"in F&&n(0,u=F.feedback),"is_retrieval"in F&&n(11,a=F.is_retrieval)},e.$$.update=()=>{e.$$.dirty&4096&&n(4,l=".".repeat(w).padEnd(3))},[u,d,p,g,l,o,s,f,m,y,S,a,w,M,$]}class Wd extends ce{constructor(t){super(),de(this,t,Ud,jd,fe,{feedback:0,is_retrieval:11})}}function Ei(e){let t,n;return t=new No({props:{is_retrieval:e[1]}}),{c(){ne(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},p(l,o){const r={};o&2&&(r.is_retrieval=l[1]),t.$set(r)},i(l){n||(V(t.$$.fragment,l),n=!0)},o(l){z(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function Fi(e){let t,n;return t=new No({props:{feedback:!0,is_retrieval:e[1]}}),{c(){ne(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},p(l,o){const r={};o&2&&(r.is_retrieval=l[1]),t.$set(r)},i(l){n||(V(t.$$.fragment,l),n=!0)},o(l){z(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function Di(e){let t,n;return t=new Wd({props:{feedback:!0,is_retrieval:e[1]}}),{c(){ne(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},p(l,o){const r={};o&2&&(r.is_retrieval=l[1]),t.$set(r)},i(l){n||(V(t.$$.fragment,l),n=!0)},o(l){z(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function Ii(e){let t,n,l,o;const r=[Yd,Xd],s=[];function u(a,f){return a[1]?0:1}return t=u(e),n=s[t]=r[t](e),{c(){n.c(),l=Se()},m(a,f){s[t].m(a,f),T(a,l,f),o=!0},p(a,f){let c=t;t=u(a),t===c?s[t].p(a,f):(we(),z(s[c],1,1,()=>{s[c]=null}),ye(),n=s[t],n?n.p(a,f):(n=s[t]=r[t](a),n.c()),V(n,1),n.m(l.parentNode,l))},i(a){o||(V(n),o=!0)},o(a){z(n),o=!1},d(a){s[t].d(a),a&&N(l)}}}function Xd(e){let t,n;return t=new hd({}),{c(){ne(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},p:U,i(l){n||(V(t.$$.fragment,l),n=!0)},o(l){z(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function Yd(e){let t,n;return t=new No({props:{feedback:!0,is_retrieval:e[1]}}),{c(){ne(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},p(l,o){const r={};o&2&&(r.is_retrieval=l[1]),t.$set(r)},i(l){n||(V(t.$$.fragment,l),n=!0)},o(l){z(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function Qd(e){let t,n,l,o,r,s=!e[0]&&Ei(e),u=e[0]==="vote"&&Fi(e),a=e[0]==="rag"&&Di(e),f=e[0]==="rank"&&Ii(e);return{c(){s&&s.c(),t=P(),u&&u.c(),n=P(),a&&a.c(),l=P(),f&&f.c(),o=Se()},m(c,d){s&&s.m(c,d),T(c,t,d),u&&u.m(c,d),T(c,n,d),a&&a.m(c,d),T(c,l,d),f&&f.m(c,d),T(c,o,d),r=!0},p(c,[d]){c[0]?s&&(we(),z(s,1,1,()=>{s=null}),ye()):s?(s.p(c,d),d&1&&V(s,1)):(s=Ei(c),s.c(),V(s,1),s.m(t.parentNode,t)),c[0]==="vote"?u?(u.p(c,d),d&1&&V(u,1)):(u=Fi(c),u.c(),V(u,1),u.m(n.parentNode,n)):u&&(we(),z(u,1,1,()=>{u=null}),ye()),c[0]==="rag"?a?(a.p(c,d),d&1&&V(a,1)):(a=Di(c),a.c(),V(a,1),a.m(l.parentNode,l)):a&&(we(),z(a,1,1,()=>{a=null}),ye()),c[0]==="rank"?f?(f.p(c,d),d&1&&V(f,1)):(f=Ii(c),f.c(),V(f,1),f.m(o.parentNode,o)):f&&(we(),z(f,1,1,()=>{f=null}),ye())},i(c){r||(V(s),V(u),V(a),V(f),r=!0)},o(c){z(s),z(u),z(a),z(f),r=!1},d(c){s&&s.d(c),c&&N(t),u&&u.d(c),c&&N(n),a&&a.d(c),c&&N(l),f&&f.d(c),c&&N(o)}}}function Kd(e,t,n){let{feedback:l}=t,{is_retrieval:o}=t;return e.$$set=r=>{"feedback"in r&&n(0,l=r.feedback),"is_retrieval"in r&&n(1,o=r.is_retrieval)},[l,o]}class Jd extends ce{constructor(t){super(),de(this,t,Kd,Qd,fe,{feedback:0,is_retrieval:1})}}function Ni(e,t,n){const l=e.slice();return l[2]=t[n],l}function Pi(e){let t,n=e[2]+"",l,o;return{c(){t=A("option"),l=q(n),t.__value=o=e[2],t.value=t.__value},m(r,s){T(r,t,s),b(t,l)},p(r,s){s&1&&n!==(n=r[2]+"")&&K(l,n),s&1&&o!==(o=r[2])&&(t.__value=o,t.value=t.__value)},d(r){r&&N(t)}}}function Zd(e){let t,n=e[0],l=[];for(let o=0;o{const r=await fetch(`/data/${l}`);n(0,o=await r.json())}),e.$$set=r=>{"data_endpoint"in r&&n(1,l=r.data_endpoint)},[o,l]}class th extends ce{constructor(t){super(),de(this,t,eh,Zd,fe,{data_endpoint:1})}}function Kt(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function nh(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Ma(e){let t,n,l;e.length!==2?(t=Kt,n=(u,a)=>Kt(e(u),a),l=(u,a)=>e(u)-a):(t=e===Kt||e===nh?e:lh,n=e,l=e);function o(u,a,f=0,c=u.length){if(f>>1;n(u[d],a)<0?f=d+1:c=d}while(f>>1;n(u[d],a)<=0?f=d+1:c=d}while(ff&&l(u[d-1],a)>-l(u[d],a)?d-1:d}return{left:o,center:s,right:r}}function lh(){return 0}function oh(e){return e===null?NaN:+e}function*ih(e,t){if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&(yield n);else{let n=-1;for(let l of e)(l=t(l,++n,e))!=null&&(l=+l)>=l&&(yield l)}}const rh=Ma(Kt),sh=rh.right;Ma(oh).center;const Ea=sh;function ah(e,t){let n=0;if(t===void 0)for(let l of e)l!=null&&(l=+l)>=l&&++n;else{let l=-1;for(let o of e)(o=t(o,++l,e))!=null&&(o=+o)>=o&&++n}return n}function uh(e,t){let n=0,l,o=0,r=0;if(t===void 0)for(let s of e)s!=null&&(s=+s)>=s&&(l=s-o,o+=l/++n,r+=l*(s-o));else{let s=-1;for(let u of e)(u=t(u,++s,e))!=null&&(u=+u)>=u&&(l=u-o,o+=l/++n,r+=l*(u-o))}if(n>1)return r/(n-1)}function fh(e,t){const n=uh(e,t);return n&&Math.sqrt(n)}function bn(e,t){let n,l;if(t===void 0)for(const o of e)o!=null&&(n===void 0?o>=o&&(n=l=o):(n>o&&(n=o),l=r&&(n=l=r):(n>r&&(n=r),l{const l=e(t,n);return l||l===0?l:(e(n,n)===0)-(e(t,t)===0)}}function Fa(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}var mh=Array.prototype,_h=mh.slice;function Tl(e){return()=>e}const vh=Math.sqrt(50),bh=Math.sqrt(10),wh=Math.sqrt(2);function ul(e,t,n){const l=(t-e)/Math.max(0,n),o=Math.floor(Math.log10(l)),r=l/Math.pow(10,o),s=r>=vh?10:r>=bh?5:r>=wh?2:1;let u,a,f;return o<0?(f=Math.pow(10,-o)/s,u=Math.round(e*f),a=Math.round(t*f),u/ft&&--a,f=-f):(f=Math.pow(10,o)*s,u=Math.round(e/f),a=Math.round(t/f),u*ft&&--a),a0))return[];if(e===t)return[e];const l=t=o))return[];const u=r-o+1,a=new Array(u);if(l)if(s<0)for(let f=0;f0?(e=Math.floor(e/o)*o,t=Math.ceil(t/o)*o):o<0&&(e=Math.ceil(e*o)/o,t=Math.floor(t*o)/o),l=o}}function Sh(e){return Math.max(1,Math.ceil(Math.log(ah(e))/Math.LN2)+1)}function Ia(){var e=gh,t=bn,n=Sh;function l(o){Array.isArray(o)||(o=Array.from(o));var r,s=o.length,u,a,f=new Array(s);for(r=0;r=p)if(S>=p&&t===bn){const $=nn(d,p,M);isFinite($)&&($>0?p=(Math.floor(p/$)+1)*$:$<0&&(p=(Math.ceil(p*-$)+1)/-$))}else g.pop()}for(var m=g.length,_=0,v=m;g[_]<=d;)++_;for(;g[v-1]>p;)--v;(_||v0?g[r-1]:d,w.x1=r0)for(r=0;r=l)&&(n=l);else{let l=-1;for(let o of e)(o=t(o,++l,e))!=null&&(n=o)&&(n=o)}return n}function so(e,t){let n;if(t===void 0)for(const l of e)l!=null&&(n>l||n===void 0&&l>=l)&&(n=l);else{let l=-1;for(let o of e)(o=t(o,++l,e))!=null&&(n>o||n===void 0&&o>=o)&&(n=o)}return n}function Na(e,t,n=0,l=1/0,o){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),l=Math.floor(Math.min(e.length-1,l)),!(n<=t&&t<=l))return e;for(o=o===void 0?Fa:ph(o);l>n;){if(l-n>600){const a=l-n+1,f=t-n+1,c=Math.log(a),d=.5*Math.exp(2*c/3),p=.5*Math.sqrt(c*d*(a-d)/a)*(f-a/2<0?-1:1),g=Math.max(n,Math.floor(t-f*d/a+p)),m=Math.min(l,Math.floor(t+(a-f)*d/a+p));Na(e,t,g,m,o)}const r=e[t];let s=n,u=l;for(cn(e,n,t),o(e[l],r)>0&&cn(e,n,l);s0;)--u}o(e[n],r)===0?cn(e,n,u):(++u,cn(e,u,l)),u<=t&&(n=u+1),t<=u&&(l=u-1)}return e}function cn(e,t,n){const l=e[t];e[t]=e[n],e[n]=l}function Ch(e,t,n){if(e=Float64Array.from(ih(e,n)),!(!(l=e.length)||isNaN(t=+t))){if(t<=0||l<2)return so(e);if(t>=1)return mt(e);var l,o=(l-1)*t,r=Math.floor(o),s=mt(Na(e,r).subarray(0,r+1)),u=so(e.subarray(r+1));return s+(u-s)*(o-r)}}function $h(e,t){let n=0,l=0;if(t===void 0)for(let o of e)o!=null&&(o=+o)>=o&&(++n,l+=o);else{let o=-1;for(let r of e)(r=t(r,++o,e))!=null&&(r=+r)>=r&&(++n,l+=r)}if(n)return l/n}function Ah(e,t,n){e=+e,t=+t,n=(o=arguments.length)<2?(t=e,e=0,1):o<3?1:+n;for(var l=-1,o=Math.max(0,Math.ceil((t-e)/n))|0,r=new Array(o);++l=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function fl(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,l=e.slice(0,n);return[l.length>1?l[0]+l.slice(2):l,+e.slice(n+1)]}function ln(e){return e=fl(Math.abs(e)),e?e[1]:NaN}function Mh(e,t){return function(n,l){for(var o=n.length,r=[],s=0,u=e[0],a=0;o>0&&u>0&&(a+u+1>l&&(u=Math.max(1,l-a)),r.push(n.substring(o-=u,o+u)),!((a+=u+1)>l));)u=e[s=(s+1)%e.length];return r.reverse().join(t)}}function Eh(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var Fh=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function cl(e){if(!(t=Fh.exec(e)))throw new Error("invalid format: "+e);var t;return new Po({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]})}cl.prototype=Po.prototype;function Po(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+""}Po.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 Dh(e){e:for(var t=e.length,n=1,l=-1,o;n0&&(l=0);break}return l>0?e.slice(0,l)+e.slice(o+1):e}var Pa;function Ih(e,t){var n=fl(e,t);if(!n)return e+"";var l=n[0],o=n[1],r=o-(Pa=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,s=l.length;return r===s?l:r>s?l+new Array(r-s+1).join("0"):r>0?l.slice(0,r)+"."+l.slice(r):"0."+new Array(1-r).join("0")+fl(e,Math.max(0,t+r-1))[0]}function Vi(e,t){var n=fl(e,t);if(!n)return e+"";var l=n[0],o=n[1];return o<0?"0."+new Array(-o).join("0")+l:l.length>o+1?l.slice(0,o+1)+"."+l.slice(o+1):l+new Array(o-l.length+2).join("0")}const zi={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Rh,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)=>Vi(e*100,t),r:Vi,s:Ih,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Li(e){return e}var qi=Array.prototype.map,Hi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Nh(e){var t=e.grouping===void 0||e.thousands===void 0?Li:Mh(qi.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",l=e.currency===void 0?"":e.currency[1]+"",o=e.decimal===void 0?".":e.decimal+"",r=e.numerals===void 0?Li:Eh(qi.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",u=e.minus===void 0?"−":e.minus+"",a=e.nan===void 0?"NaN":e.nan+"";function f(d){d=cl(d);var p=d.fill,g=d.align,m=d.sign,_=d.symbol,v=d.zero,y=d.width,w=d.comma,S=d.precision,M=d.trim,$=d.type;$==="n"?(w=!0,$="g"):zi[$]||(S===void 0&&(S=12),M=!0,$="g"),(v||p==="0"&&g==="=")&&(v=!0,p="0",g="=");var F=_==="$"?n:_==="#"&&/[boxX]/.test($)?"0"+$.toLowerCase():"",C=_==="$"?l:/[%p]/.test($)?s:"",R=zi[$],k=/[defgprs%]/.test($);S=S===void 0?6:/[gprs]/.test($)?Math.max(1,Math.min(21,S)):Math.max(0,Math.min(20,S));function E(I){var D=F,L=C,O,B,j;if($==="c")L=R(I)+L,I="";else{I=+I;var ae=I<0||1/I<0;if(I=isNaN(I)?a:R(Math.abs(I),S),M&&(I=Dh(I)),ae&&+I==0&&m!=="+"&&(ae=!1),D=(ae?m==="("?m:u:m==="-"||m==="("?"":m)+D,L=($==="s"?Hi[8+Pa/3]:"")+L+(ae&&m==="("?")":""),k){for(O=-1,B=I.length;++Oj||j>57){L=(j===46?o+I.slice(O+1):I.slice(O))+L,I=I.slice(0,O);break}}}w&&!v&&(I=t(I,1/0));var pe=D.length+I.length+L.length,W=pe>1)+D+I+L+W.slice(pe);break;default:I=W+D+I+L;break}return r(I)}return E.toString=function(){return d+""},E}function c(d,p){var g=f((d=cl(d),d.type="f",d)),m=Math.max(-8,Math.min(8,Math.floor(ln(p)/3)))*3,_=Math.pow(10,-m),v=Hi[8+m/3];return function(y){return g(_*y)+v}}return{format:f,formatPrefix:c}}var Hn,vt,Ta;Ph({thousands:",",grouping:[3],currency:["$",""]});function Ph(e){return Hn=Nh(e),vt=Hn.format,Ta=Hn.formatPrefix,Hn}function Th(e){return Math.max(0,-ln(Math.abs(e)))}function Oh(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ln(t)/3)))*3-ln(Math.abs(e)))}function Vh(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,ln(t)-ln(e))+1}function To(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function zh(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const Gi=Symbol("implicit");function Mt(){var e=new Ti,t=[],n=[],l=Gi;function o(r){let s=e.get(r);if(s===void 0){if(l!==Gi)return l;e.set(r,s=t.push(r)-1)}return n[s%n.length]}return o.domain=function(r){if(!arguments.length)return t.slice();t=[],e=new Ti;for(const s of r)e.has(s)||e.set(s,t.push(s)-1);return o},o.range=function(r){return arguments.length?(n=Array.from(r),o):n.slice()},o.unknown=function(r){return arguments.length?(l=r,o):l},o.copy=function(){return Mt(t,n).unknown(l)},To.apply(o,arguments),o}function qt(){var e=Mt().unknown(void 0),t=e.domain,n=e.range,l=0,o=1,r,s,u=!1,a=0,f=0,c=.5;delete e.unknown;function d(){var p=t().length,g=o>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Gn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Gn(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=qh.exec(e))?new Ge(t[1],t[2],t[3],1):(t=Hh.exec(e))?new Ge(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Gh.exec(e))?Gn(t[1],t[2],t[3],t[4]):(t=Bh.exec(e))?Gn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=jh.exec(e))?Qi(t[1],t[2]/100,t[3]/100,1):(t=xh.exec(e))?Qi(t[1],t[2]/100,t[3]/100,t[4]):ji.hasOwnProperty(e)?Wi(ji[e]):e==="transparent"?new Ge(NaN,NaN,NaN,0):null}function Wi(e){return new Ge(e>>16&255,e>>8&255,e&255,1)}function Gn(e,t,n,l){return l<=0&&(e=t=n=NaN),new Ge(e,t,n,l)}function Xh(e){return e instanceof Pn||(e=In(e)),e?(e=e.rgb(),new Ge(e.r,e.g,e.b,e.opacity)):new Ge}function ao(e,t,n,l){return arguments.length===1?Xh(e):new Ge(e,t,n,l??1)}function Ge(e,t,n,l){this.r=+e,this.g=+t,this.b=+n,this.opacity=+l}Oo(Ge,ao,Va(Pn,{brighter(e){return e=e==null?dl:Math.pow(dl,e),new Ge(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Fn:Math.pow(Fn,e),new Ge(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ge(zt(this.r),zt(this.g),zt(this.b),hl(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:Xi,formatHex:Xi,formatHex8:Yh,formatRgb:Yi,toString:Yi}));function Xi(){return`#${Ot(this.r)}${Ot(this.g)}${Ot(this.b)}`}function Yh(){return`#${Ot(this.r)}${Ot(this.g)}${Ot(this.b)}${Ot((isNaN(this.opacity)?1:this.opacity)*255)}`}function Yi(){const e=hl(this.opacity);return`${e===1?"rgb(":"rgba("}${zt(this.r)}, ${zt(this.g)}, ${zt(this.b)}${e===1?")":`, ${e})`}`}function hl(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function zt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ot(e){return e=zt(e),(e<16?"0":"")+e.toString(16)}function Qi(e,t,n,l){return l<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Je(e,t,n,l)}function za(e){if(e instanceof Je)return new Je(e.h,e.s,e.l,e.opacity);if(e instanceof Pn||(e=In(e)),!e)return new Je;if(e instanceof Je)return e;e=e.rgb();var t=e.r/255,n=e.g/255,l=e.b/255,o=Math.min(t,n,l),r=Math.max(t,n,l),s=NaN,u=r-o,a=(r+o)/2;return u?(t===r?s=(n-l)/u+(n0&&a<1?0:s,new Je(s,u,a,e.opacity)}function Qh(e,t,n,l){return arguments.length===1?za(e):new Je(e,t,n,l??1)}function Je(e,t,n,l){this.h=+e,this.s=+t,this.l=+n,this.opacity=+l}Oo(Je,Qh,Va(Pn,{brighter(e){return e=e==null?dl:Math.pow(dl,e),new Je(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Fn:Math.pow(Fn,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,l=n+(n<.5?n:1-n)*t,o=2*n-l;return new Ge(Ol(e>=240?e-240:e+120,o,l),Ol(e,o,l),Ol(e<120?e+240:e-120,o,l),this.opacity)},clamp(){return new Je(Ki(this.h),Bn(this.s),Bn(this.l),hl(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=hl(this.opacity);return`${e===1?"hsl(":"hsla("}${Ki(this.h)}, ${Bn(this.s)*100}%, ${Bn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ki(e){return e=(e||0)%360,e<0?e+360:e}function Bn(e){return Math.max(0,Math.min(1,e||0))}function Ol(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 Vo=e=>()=>e;function Kh(e,t){return function(n){return e+n*t}}function Jh(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(l){return Math.pow(e+l*t,n)}}function Zh(e){return(e=+e)==1?La:function(t,n){return n-t?Jh(t,n,e):Vo(isNaN(t)?n:t)}}function La(e,t){var n=t-e;return n?Kh(e,n):Vo(isNaN(e)?t:e)}const uo=function e(t){var n=Zh(t);function l(o,r){var s=n((o=ao(o)).r,(r=ao(r)).r),u=n(o.g,r.g),a=n(o.b,r.b),f=La(o.opacity,r.opacity);return function(c){return o.r=s(c),o.g=u(c),o.b=a(c),o.opacity=f(c),o+""}}return l.gamma=e,l}(1);function eg(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,l=t.slice(),o;return function(r){for(o=0;on&&(r=t.slice(n,r),u[s]?u[s]+=r:u[++s]=r),(l=l[0])===(o=o[0])?u[s]?u[s]+=o:u[++s]=o:(u[++s]=null,a.push({i:s,x:gl(l,o)})),n=Vl.lastIndex;return nt&&(n=e,e=t,t=n),function(l){return Math.max(e,Math.min(t,l))}}function cg(e,t,n){var l=e[0],o=e[1],r=t[0],s=t[1];return o2?dg:cg,a=f=null,d}function d(p){return p==null||isNaN(p=+p)?r:(a||(a=u(e.map(l),t,n)))(l(s(p)))}return d.invert=function(p){return s(o((f||(f=u(t,e.map(l),gl)))(p)))},d.domain=function(p){return arguments.length?(e=Array.from(p,ug),c()):e.slice()},d.range=function(p){return arguments.length?(t=Array.from(p),c()):t.slice()},d.rangeRound=function(p){return t=Array.from(p),n=qa,c()},d.clamp=function(p){return arguments.length?(s=p?!0:kt,c()):s!==kt},d.interpolate=function(p){return arguments.length?(n=p,c()):n},d.unknown=function(p){return arguments.length?(r=p,d):r},function(p,g){return l=p,o=g,c()}}function pg(){return gg()(kt,kt)}function mg(e,t,n,l){var o=yh(e,t,n),r;switch(l=cl(l??",f"),l.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return l.precision==null&&!isNaN(r=Oh(o,s))&&(l.precision=r),Ta(l,s)}case"":case"e":case"g":case"p":case"r":{l.precision==null&&!isNaN(r=Vh(o,Math.max(Math.abs(e),Math.abs(t))))&&(l.precision=r-(l.type==="e"));break}case"f":case"%":{l.precision==null&&!isNaN(r=Th(o))&&(l.precision=r-(l.type==="%")*2);break}}return vt(l)}function Ha(e){var t=e.domain;return e.ticks=function(n){var l=t();return Da(l[0],l[l.length-1],n??10)},e.tickFormat=function(n,l){var o=t();return mg(o[0],o[o.length-1],n??10,l)},e.nice=function(n){n==null&&(n=10);var l=t(),o=0,r=l.length-1,s=l[o],u=l[r],a,f,c=10;for(u0;){if(f=nn(s,u,n),f===a)return l[o]=s,l[r]=u,t(l);if(f>0)s=Math.floor(s/f)*f,u=Math.ceil(u/f)*f;else if(f<0)s=Math.ceil(s*f)/f,u=Math.floor(u*f)/f;else break;a=f}return e},e}function We(){var e=pg();return e.copy=function(){return hg(e,We())},To.apply(e,arguments),Ha(e)}function _g(){var e=0,t=1,n,l,o,r,s=kt,u=!1,a;function f(d){return d==null||isNaN(d=+d)?a:s(o===0?.5:(d=(r(d)-n)*o,u?Math.max(0,Math.min(1,d)):d))}f.domain=function(d){return arguments.length?([e,t]=d,n=r(e=+e),l=r(t=+t),o=n===l?0:1/(l-n),f):[e,t]},f.clamp=function(d){return arguments.length?(u=!!d,f):u},f.interpolator=function(d){return arguments.length?(s=d,f):s};function c(d){return function(p){var g,m;return arguments.length?([g,m]=p,s=d(g,m),f):[s(0),s(1)]}}return f.range=c(Tn),f.rangeRound=c(qa),f.unknown=function(d){return arguments.length?(a=d,f):a},function(d){return r=d,n=d(e),l=d(t),o=n===l?0:1/(l-n),f}}function vg(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Ga(){var e=Ha(_g()(kt));return e.copy=function(){return vg(e,Ga())},zh.apply(e,arguments)}function nt(e){return function(){return e}}const ho=Math.PI,go=2*ho,Nt=1e-6,bg=go-Nt;function Ba(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Ba;const n=10**t;return function(l){this._+=l[0];for(let o=1,r=l.length;oNt)if(!(Math.abs(d*a-f*c)>Nt)||!r)this._append`L${this._x1=t},${this._y1=n}`;else{let g=l-s,m=o-u,_=a*a+f*f,v=g*g+m*m,y=Math.sqrt(_),w=Math.sqrt(p),S=r*Math.tan((ho-Math.acos((_+p-v)/(2*y*w)))/2),M=S/w,$=S/y;Math.abs(M-1)>Nt&&this._append`L${t+M*c},${n+M*d}`,this._append`A${r},${r},0,0,${+(d*g>c*m)},${this._x1=t+$*a},${this._y1=n+$*f}`}}arc(t,n,l,o,r,s){if(t=+t,n=+n,l=+l,s=!!s,l<0)throw new Error(`negative radius: ${l}`);let u=l*Math.cos(o),a=l*Math.sin(o),f=t+u,c=n+a,d=1^s,p=s?o-r:r-o;this._x1===null?this._append`M${f},${c}`:(Math.abs(this._x1-f)>Nt||Math.abs(this._y1-c)>Nt)&&this._append`L${f},${c}`,l&&(p<0&&(p=p%go+go),p>bg?this._append`A${l},${l},0,1,${d},${t-u},${n-a}A${l},${l},0,1,${d},${this._x1=f},${this._y1=c}`:p>Nt&&this._append`A${l},${l},0,${+(p>=ho)},${d},${this._x1=t+l*Math.cos(r)},${this._y1=n+l*Math.sin(r)}`)}rect(t,n,l,o){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${l=+l}v${+o}h${-l}Z`}toString(){return this._}}function kg(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const l=Math.floor(n);if(!(l>=0))throw new RangeError(`invalid digits: ${n}`);t=l}return e},()=>new yg(t)}function ja(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function xa(e){this._context=e}xa.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Sg(e){return new xa(e)}function Cg(e){return e[0]}function $g(e){return e[1]}function Ag(e,t){var n=nt(!0),l=null,o=Sg,r=null,s=kg(u);e=typeof e=="function"?e:e===void 0?Cg:nt(e),t=typeof t=="function"?t:t===void 0?$g:nt(t);function u(a){var f,c=(a=ja(a)).length,d,p=!1,g;for(l==null&&(r=o(g=s())),f=0;f<=c;++f)!(f1)for(var n=1,l,o,r=e[t[0]],s,u=r.length;n=0;)n[t]=t;return n}function Rg(e,t){return e[t]}function Mg(e){const t=[];return t.key=e,t}function Eg(){var e=nt([]),t=mo,n=po,l=Rg;function o(r){var s=Array.from(e.apply(this,arguments),Mg),u,a=s.length,f=-1,c;for(const d of r)for(u=0,++f;uFeedback Distribution

",n=P(),l=A("div"),o=G("svg");for(let a=0;ae[19].call(l))},m(a,f){T(a,t,f),T(a,n,f),T(a,l,f),b(l,o);for(let c=0;cn(15,d=R)),ue(e,Zo,R=>n(4,p=R)),ue(e,He,R=>n(16,g=R));let m=300,_=300;const v={up:2,down:1,"n/a":0,all:"all"},y={top:10,bottom:10,left:25,right:5},w=Mt().range(["var(--yellow)","var(--red)","var(--green)"]),S=vt(".0%");function M(R,k){l===R?n(5,l="all"):n(5,l=R),De(st,d=l==="all"?"all":k,d)}const $=(R,k)=>M(R,k.key),F=(R,k)=>M(R,k.key);function C(){_=this.offsetWidth,m=this.offsetHeight,n(1,_),n(0,m)}return e.$$.update=()=>{e.$$.dirty&32768&&n(5,l=v[d]),e.$$.dirty&2&&n(3,o=_-y.left-y.right),e.$$.dirty&1&&n(14,r=m-y.top-y.bottom),e.$$.dirty&65552&&g.forEach(R=>{De(Zo,p[R.vote_status]++,p)}),e.$$.dirty&16&&n(2,s=p.up+p.down+p["n/a"]),e.$$.dirty&16384&&n(8,u=qt().rangeRound([y.top,r-y.bottom]).padding(0).domain(["a"])),e.$$.dirty&12&&n(7,a=We().rangeRound([y.left,o-y.right]).domain([0,s])),e.$$.dirty&8208&&n(6,c=f([p]))},n(13,f=Eg().keys(["n/a","down","up"]).order(mo).offset(po)),[m,_,s,o,p,l,c,a,u,y,w,S,M,f,r,d,g,$,F,C]}class Ua extends ce{constructor(t){super(),de(this,t,Dg,Fg,fe,{})}}function Ig(e){let t,n,l,o,r,s,u,a,f,c,d,p=e[3][e[2]]+"",g,m;return{c(){t=A("div"),n=A("div"),l=q("Q: "),o=q(e[0]),r=P(),s=A("div"),u=q("A: "),a=q(e[1]),f=P(),c=A("div"),d=q("Rating: "),g=q(p),h(n,"class","question svelte-szi0e"),h(s,"class","answer svelte-szi0e"),h(c,"class",m="feedback "+e[2]+" svelte-szi0e"),h(t,"class","qa-card svelte-szi0e")},m(_,v){T(_,t,v),b(t,n),b(n,l),b(n,o),b(t,r),b(t,s),b(s,u),b(s,a),b(t,f),b(t,c),b(c,d),b(c,g)},p(_,[v]){v&1&&K(o,_[0]),v&2&&K(a,_[1]),v&4&&p!==(p=_[3][_[2]]+"")&&K(g,p),v&4&&m!==(m="feedback "+_[2]+" svelte-szi0e")&&h(c,"class",m)},i:U,o:U,d(_){_&&N(t)}}}function Ng(e,t,n){let{question:l="What is gradient descent?"}=t,{answer:o="Gradient descent is an algorithm used to minimize a loss function by taking small steps in the direction of steepest descent."}=t,{feedback:r="Good: 👍"}=t;const s={up:"Good 👍",down:"Bad 👎","n/a":"No Rating",all:"All"};return e.$$set=u=>{"question"in u&&n(0,l=u.question),"answer"in u&&n(1,o=u.answer),"feedback"in u&&n(2,r=u.feedback)},[l,o,r,s]}class Pg extends ce{constructor(t){super(),de(this,t,Ng,Ig,fe,{question:0,answer:1,feedback:2})}}function lr(e,t,n){const l=e.slice();return l[5]=t[n].question,l[6]=t[n].answer,l[7]=t[n].vote_status,l}function or(e){let t,n,l,o,r;return n=new Pg({props:{question:e[5],answer:e[6],feedback:e[7]}}),{c(){t=A("div"),ne(n.$$.fragment),l=P()},m(s,u){T(s,t,u),ee(n,t,null),b(t,l),r=!0},p(s,u){const a={};u&1&&(a.question=s[5]),u&1&&(a.answer=s[6]),u&1&&(a.feedback=s[7]),n.$set(a)},i(s){r||(V(n.$$.fragment,s),s&&Me(()=>{r&&(o||(o=lt(t,e[1],{duration:300},!0)),o.run(1))}),r=!0)},o(s){z(n.$$.fragment,s),s&&(o||(o=lt(t,e[1],{duration:300},!1)),o.run(0)),r=!1},d(s){s&&N(t),te(n),s&&o&&o.end()}}}function Tg(e){let t,n,l=e[0],o=[];for(let s=0;sz(o[s],1,1,()=>{o[s]=null});return{c(){t=A("div");for(let s=0;sn(4,o=a)),ue(e,st,a=>n(2,r=a)),ue(e,Mn,a=>n(3,s=a));const u=(a,{delay:f=0,duration:c=1e3,easing:d=Eo})=>En(a,{delay:f,duration:c,easing:d});return e.$$.update=()=>{e.$$.dirty&12&&n(0,l=r==="all"?s:s.filter(a=>a.vote_status===r)),e.$$.dirty&1&&De(oo,o=gd(l),o)},[l,u,r,s]}class Wa extends ce{constructor(t){super(),de(this,t,Og,Tg,fe,{})}}function ir(e,t,n){const l=e.slice();return l[13]=t[n],l}function rr(e,t,n){const l=e.slice();return l[16]=t[n],l}function sr(e,t,n){const l=e.slice();return l[16]=t[n],l}function ar(e){let t,n,l,o,r=e[16]+"",s,u;return{c(){t=G("g"),n=G("line"),o=G("text"),s=q(r),h(n,"class","axis-tick svelte-1oikip4"),h(n,"x1","0"),h(n,"x2","0"),h(n,"y1",0),h(n,"y2",l=-e[2]+e[10].bottom+e[10].top),h(n,"stroke","var(--squidink)"),h(n,"stroke-dasharray","4"),h(o,"class","axis-text svelte-1oikip4"),h(o,"y","15"),h(o,"text-anchor","middle"),h(t,"transform",u=`translate(${e[6](e[16])+e[6].bandwidth()/2} ${e[2]-e[10].bottom})`)},m(a,f){T(a,t,f),b(t,n),b(t,o),b(o,s)},p(a,f){f&4&&l!==(l=-a[2]+a[10].bottom+a[10].top)&&h(n,"y2",l),f&16&&r!==(r=a[16]+"")&&K(s,r),f&84&&u!==(u=`translate(${a[6](a[16])+a[6].bandwidth()/2} ${a[2]-a[10].bottom})`)&&h(t,"transform",u)},d(a){a&&N(t)}}}function ur(e){let t,n,l,o;return{c(){t=G("g"),n=G("line"),h(n,"class","axis-tick svelte-1oikip4"),h(n,"x1",0),h(n,"x2",l=e[3]-e[10].right-e[10].left),h(n,"y1","0"),h(n,"y2","0"),h(n,"stroke","black"),h(t,"transform",o=`translate(${e[10].left} ${e[5](e[16])+0})`)},m(r,s){T(r,t,s),b(t,n)},p(r,s){s&8&&l!==(l=r[3]-r[10].right-r[10].left)&&h(n,"x2",l),s&32&&o!==(o=`translate(${r[10].left} ${r[5](r[16])+0})`)&&h(t,"transform",o)},d(r){r&&N(t)}}}function fr(e){let t,n,l,o,r,s,u,a,f=Math.round(e[11](e[13].count))+"",c,d,p;return{c(){t=G("g"),n=G("rect"),a=G("text"),c=q(f),h(n,"x",l=e[6](e[13].question)),h(n,"y",o=e[5](e[13].count)),h(n,"height",r=e[2]-e[5](e[13].count)-e[10].bottom),h(n,"fill",s=e[9][e[7]]),h(n,"fill-opacity","0.95"),h(n,"width",u=e[6].bandwidth()),h(n,"class","svelte-1oikip4"),h(a,"class","axis-text svelte-1oikip4"),h(a,"x",d=e[6](e[13].question)+e[6].bandwidth()/2),h(a,"y",p=e[5](e[13].count)-5),h(a,"text-anchor","middle"),h(t,"class","series")},m(g,m){T(g,t,m),b(t,n),b(t,a),b(a,c)},p(g,m){m&80&&l!==(l=g[6](g[13].question))&&h(n,"x",l),m&48&&o!==(o=g[5](g[13].count))&&h(n,"y",o),m&52&&r!==(r=g[2]-g[5](g[13].count)-g[10].bottom)&&h(n,"height",r),m&128&&s!==(s=g[9][g[7]])&&h(n,"fill",s),m&64&&u!==(u=g[6].bandwidth())&&h(n,"width",u),m&16&&f!==(f=Math.round(g[11](g[13].count))+"")&&K(c,f),m&80&&d!==(d=g[6](g[13].question)+g[6].bandwidth()/2)&&h(a,"x",d),m&48&&p!==(p=g[5](g[13].count)-5)&&h(a,"y",p)},d(g){g&&N(t)}}}function Vg(e){let t,n,l,o,r,s,u=e[8][e[7]]+"",a,f,c,d,p,g,m,_,v,y=e[4].map(cr),w=[];for(let C=0;Ce[12].call(t))},m(C,R){T(C,t,R),b(t,n);for(let k=0;ke.question;function zg(e,t,n){let l,o,r,s,u,a;ue(e,oo,v=>n(4,u=v)),ue(e,st,v=>n(7,a=v));const f={up:"Good 👍",down:"Bad 👎","n/a":"No Rating",all:"All"},c={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"#bfbfbf"};let d=300,p=300,g={top:35,bottom:10,left:25,right:5};const m=vt(".1f");function _(){p=this.offsetWidth,d=this.offsetHeight,n(1,p),n(0,d)}return e.$$.update=()=>{e.$$.dirty&2&&n(3,l=p-g.left-g.right),e.$$.dirty&1&&n(2,o=d-g.top-g.bottom),e.$$.dirty&24&&n(6,r=qt().rangeRound([g.left,l-g.right]).padding(.05).domain(u.map(v=>v.question))),e.$$.dirty&20&&n(5,s=We().rangeRound([o-g.bottom,g.top]).domain([0,mt(u,v=>v.count)])),e.$$.dirty&16&&console.log(u)},[d,p,o,l,u,s,r,a,f,c,g,m,_]}class Xa extends ce{constructor(t){super(),de(this,t,zg,Vg,fe,{})}}function dr(e,t,n){const l=e.slice();l[19]=t[n];const o=l[7](l[19].x1)-l[7](l[19].x0);return l[20]=o,l}function hr(e,t,n){const l=e.slice();return l[23]=t[n],l}function gr(e){let t,n,l,o,r=e[23]+"",s,u;return{c(){t=G("g"),n=G("line"),o=G("text"),s=q(r),h(n,"class","axis-tick svelte-kz2qh6"),h(n,"x1","0"),h(n,"x2","0"),h(n,"y1",0),h(n,"y2",l=-e[2]+e[9].bottom+e[9].top),h(n,"stroke","var(--squidink)"),h(n,"stroke-dasharray","4"),h(o,"class","axis-text svelte-kz2qh6"),h(o,"y","15"),h(o,"text-anchor","middle"),h(t,"transform",u=`translate(${e[7](e[23])+(e[7](1)-e[7](0))/2} ${e[2]-e[9].bottom})`),h(t,"class","svelte-kz2qh6")},m(a,f){T(a,t,f),b(t,n),b(t,o),b(o,s)},p(a,f){f&4&&l!==(l=-a[2]+a[9].bottom+a[9].top)&&h(n,"y2",l),f&128&&r!==(r=a[23]+"")&&K(s,r),f&132&&u!==(u=`translate(${a[7](a[23])+(a[7](1)-a[7](0))/2} ${a[2]-a[9].bottom})`)&&h(t,"transform",u)},d(a){a&&N(t)}}}function pr(e){let t,n,l,o,r,s,u;return{c(){t=G("g"),n=G("rect"),h(n,"x",l=e[7](e[19].x0)+1),h(n,"width",o=e[20]),h(n,"y",r=e[6](e[19].length)),h(n,"height",s=e[6](0)-e[6](e[19].length)),h(n,"fill",u=e[8][e[5]]),h(n,"class","svelte-kz2qh6"),h(t,"class","histogram-bin svelte-kz2qh6")},m(a,f){T(a,t,f),b(t,n)},p(a,f){f&136&&l!==(l=a[7](a[19].x0)+1)&&h(n,"x",l),f&136&&o!==(o=a[20])&&h(n,"width",o),f&72&&r!==(r=a[6](a[19].length))&&h(n,"y",r),f&72&&s!==(s=a[6](0)-a[6](a[19].length))&&h(n,"height",s),f&32&&u!==(u=a[8][a[5]])&&h(n,"fill",u)},d(a){a&&N(t)}}}function Lg(e){let t,n,l,o,r,s,u,a,f,c,d,p=e[7].ticks(),g=[];for(let v=0;ve[14].call(t))},m(v,y){T(v,t,y),b(t,n);for(let w=0;wn(5,d=S)),ue(e,He,S=>n(13,p=S));const g={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"#bfbfbf"};let m=300,_=300,v={top:15,bottom:10,left:25,right:5};vt(".1f");let y=Array.from({length:mr},(S,M)=>M);function w(){_=this.offsetWidth,m=this.offsetHeight,n(1,_),n(0,m)}return e.$$.update=()=>{e.$$.dirty&8224&&n(12,l=d==="all"?p:p.filter(S=>S.vote_status===d)),e.$$.dirty&4096&&n(11,o=Aa(l)),e.$$.dirty&2&&n(4,r=_-v.left-v.right),e.$$.dirty&1&&n(2,s=m-v.top-v.bottom),e.$$.dirty&2048&&n(3,u=Ia().thresholds(y).value(S=>S.answer)(o)),e.$$.dirty&16&&n(7,a=We().domain([3,mr]).range([v.left,r-v.right])),e.$$.dirty&12&&n(6,f=We().domain([0,mt(u,S=>S.length)]).range([s-v.bottom,v.top])),e.$$.dirty&2048&&n(10,c=mt(o,S=>S.length)),e.$$.dirty&1056&&We().domain([0,c]).range(["white",g[d]]).interpolate(Tn)},[m,_,s,u,r,d,f,a,g,v,c,o,l,p,w]}class Ya extends ce{constructor(t){super(),de(this,t,qg,Lg,fe,{})}}function _r(e,t,n){const l=e.slice();l[18]=t[n];const o=l[7](l[18].x1)-l[7](l[18].x0);return l[19]=o,l}function vr(e,t,n){const l=e.slice();return l[22]=t[n],l}function br(e){let t,n,l,o,r=e[22]+"",s,u;return{c(){t=G("g"),n=G("line"),o=G("text"),s=q(r),h(n,"class","axis-tick svelte-kz2qh6"),h(n,"x1","0"),h(n,"x2","0"),h(n,"y1",0),h(n,"y2",l=-e[2]+e[9].bottom+e[9].top),h(n,"stroke","var(--squidink)"),h(n,"stroke-dasharray","4"),h(o,"class","axis-text svelte-kz2qh6"),h(o,"y","15"),h(o,"text-anchor","middle"),h(t,"transform",u=`translate(${e[7](e[22])+(e[7](1)-e[7](0))/2} ${e[2]-e[9].bottom})`),h(t,"class","svelte-kz2qh6")},m(a,f){T(a,t,f),b(t,n),b(t,o),b(o,s)},p(a,f){f&4&&l!==(l=-a[2]+a[9].bottom+a[9].top)&&h(n,"y2",l),f&128&&r!==(r=a[22]+"")&&K(s,r),f&132&&u!==(u=`translate(${a[7](a[22])+(a[7](1)-a[7](0))/2} ${a[2]-a[9].bottom})`)&&h(t,"transform",u)},d(a){a&&N(t)}}}function wr(e){let t,n,l,o,r,s,u;return{c(){t=G("g"),n=G("rect"),h(n,"x",l=e[7](e[18].x0)+1),h(n,"width",o=e[19]),h(n,"y",r=e[6](e[18].length)),h(n,"height",s=e[6](0)-e[6](e[18].length)),h(n,"fill",u=e[8][e[5]]),h(n,"class","svelte-kz2qh6"),h(t,"class","histogram-bin svelte-kz2qh6")},m(a,f){T(a,t,f),b(t,n)},p(a,f){f&136&&l!==(l=a[7](a[18].x0)+1)&&h(n,"x",l),f&136&&o!==(o=a[19])&&h(n,"width",o),f&72&&r!==(r=a[6](a[18].length))&&h(n,"y",r),f&72&&s!==(s=a[6](0)-a[6](a[18].length))&&h(n,"height",s),f&32&&u!==(u=a[8][a[5]])&&h(n,"fill",u)},d(a){a&&N(t)}}}function Hg(e){let t,n,l,o,r,s,u,a,f,c,d,p=e[7].ticks(),g=[];for(let v=0;ve[13].call(t))},m(v,y){T(v,t,y),b(t,n);for(let w=0;wn(5,c=w)),ue(e,He,w=>n(12,d=w));const p={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"#bfbfbf"};let g=300,m=300,_={top:15,bottom:10,left:25,right:5},v=Array.from({length:yr},(w,S)=>S);Mt().range(["var(--yellow)","var(--red)","var(--green)"]);function y(){m=this.offsetWidth,g=this.offsetHeight,n(1,m),n(0,g)}return e.$$.update=()=>{e.$$.dirty&4128&&n(11,l=c==="all"?d:d.filter(w=>w.vote_status===c)),e.$$.dirty&2048&&n(10,o=Aa(l)),e.$$.dirty&2&&n(4,r=m-_.left-_.right),e.$$.dirty&1&&n(2,s=g-_.top-_.bottom),e.$$.dirty&1024&&n(3,u=Ia().thresholds(v).value(w=>w.question)(o)),e.$$.dirty&16&&n(7,a=We().domain([3,yr]).range([_.left,r-_.right])),e.$$.dirty&12&&n(6,f=We().domain([0,mt(u,w=>w.length)]).range([s-_.bottom,_.top])),e.$$.dirty&1024&&mt(o,w=>w.length)},[g,m,s,u,r,c,f,a,p,_,o,l,d,y]}class Qa extends ce{constructor(t){super(),de(this,t,Gg,Hg,fe,{})}}function Bg(e){let t,n,l,o,r,s,u,a,f,c,d,p,g,m=Math.round(e[5](e[3]))+"",_,v,y,w,S,M,$,F;return{c(){t=A("div"),n=A("div"),l=A("p"),l.textContent="Questions",o=P(),r=A("select"),s=A("option"),s.textContent="All",u=A("option"),u.textContent="Good",a=A("option"),a.textContent="Bad",f=A("option"),f.textContent="N/A",c=P(),d=A("div"),p=G("svg"),g=G("text"),_=q(m),S=P(),M=A("p"),M.textContent="number of responses",h(l,"class","card-text svelte-1pknxov"),s.__value="all",s.value=s.__value,h(s,"class","svelte-1pknxov"),u.__value="up",u.value=u.__value,h(u,"class","svelte-1pknxov"),a.__value="down",a.value=a.__value,h(a,"class","svelte-1pknxov"),f.__value="n/a",f.value=f.__value,h(f,"class","svelte-1pknxov"),h(r,"id","feedback-dropdown"),h(r,"name","feedback-dropdown"),Re(r,"background",e[6][e[0]]),h(r,"class","svelte-1pknxov"),e[0]===void 0&&Me(()=>e[9].call(r)),h(n,"class","svelte-1pknxov"),h(g,"dominant-baseline","middle"),h(g,"x",v=e[2]/2),h(g,"y",y=e[1]/2),h(g,"text-anchor","middle"),h(g,"class","svelte-1pknxov"),h(p,"width",e[2]),h(p,"height",e[1]),h(p,"class","svelte-1pknxov"),h(d,"class","svelte-1pknxov"),Me(()=>e[10].call(d)),h(M,"class","small svelte-1pknxov"),h(t,"class","card-container svelte-1pknxov"),Re(t,"background",e[6][e[0]])},m(C,R){T(C,t,R),b(t,n),b(n,l),b(n,o),b(n,r),b(r,s),b(r,u),b(r,a),b(r,f),ol(r,e[0],!0),b(t,c),b(t,d),b(d,p),b(p,g),b(g,_),w=ut(d,e[10].bind(d)),b(t,S),b(t,M),$||(F=x(r,"change",e[9]),$=!0)},p(C,[R]){R&1&&Re(r,"background",C[6][C[0]]),R&1&&ol(r,C[0]),R&8&&m!==(m=Math.round(C[5](C[3]))+"")&&K(_,m),R&4&&v!==(v=C[2]/2)&&h(g,"x",v),R&2&&y!==(y=C[1]/2)&&h(g,"y",y),R&4&&h(p,"width",C[2]),R&2&&h(p,"height",C[1]),R&1&&Re(t,"background",C[6][C[0]])},i:U,o:U,d(C){C&&N(t),w(),$=!1,F()}}}function jg(e,t){return t==="all"?e.length:e.filter(l=>l.vote_status===t).length}function xg(e,t,n){let l,o,r,s;ue(e,st,m=>n(0,o=m)),ue(e,He,m=>n(8,r=m));let u,a,f=Fo(0);ue(e,f,m=>n(3,s=m));const c=vt(".1f"),d={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"var(--white)"};function p(){o=sa(this),st.set(o)}function g(){a=this.clientWidth,u=this.clientHeight,n(2,a),n(1,u)}return e.$$.update=()=>{e.$$.dirty&257&&n(7,l=jg(r,o)),e.$$.dirty&128&&console.log("fbc",l),e.$$.dirty&128&&f.set(l)},[o,u,a,s,f,c,d,l,r,p,g]}class Ka extends ce{constructor(t){super(),de(this,t,xg,Bg,fe,{})}}function Ug(e){let t,n,l,o,r,s,u,a,f,c,d,p,g,m=e[5](e[3])+"",_,v,y,w,S,M,$,F;return{c(){t=A("div"),n=A("div"),l=A("p"),l.textContent="Questions",o=P(),r=A("select"),s=A("option"),s.textContent="All",u=A("option"),u.textContent="Good",a=A("option"),a.textContent="Bad",f=A("option"),f.textContent="N/A",c=P(),d=A("div"),p=G("svg"),g=G("text"),_=q(m),S=P(),M=A("p"),M.textContent="percentage of responses",h(l,"class","card-text svelte-mchgj2"),s.__value="all",s.value=s.__value,u.__value="up",u.value=u.__value,a.__value="down",a.value=a.__value,f.__value="n/a",f.value=f.__value,h(r,"id","feedback-dropdown"),h(r,"name","feedback-dropdown"),Re(r,"background",e[6][e[0]]),h(r,"class","svelte-mchgj2"),e[0]===void 0&&Me(()=>e[9].call(r)),h(g,"dominant-baseline","middle"),h(g,"x",v=e[2]/2),h(g,"y",y=e[1]/2),h(g,"text-anchor","middle"),h(g,"class","svelte-mchgj2"),h(p,"width",e[2]),h(p,"height",e[1]),h(p,"class","svelte-mchgj2"),Me(()=>e[10].call(d)),h(M,"class","small svelte-mchgj2"),h(t,"class","card-container svelte-mchgj2"),Re(t,"background",e[6][e[0]])},m(C,R){T(C,t,R),b(t,n),b(n,l),b(n,o),b(n,r),b(r,s),b(r,u),b(r,a),b(r,f),ol(r,e[0],!0),b(t,c),b(t,d),b(d,p),b(p,g),b(g,_),w=ut(d,e[10].bind(d)),b(t,S),b(t,M),$||(F=x(r,"change",e[9]),$=!0)},p(C,[R]){R&1&&Re(r,"background",C[6][C[0]]),R&1&&ol(r,C[0]),R&8&&m!==(m=C[5](C[3])+"")&&K(_,m),R&4&&v!==(v=C[2]/2)&&h(g,"x",v),R&2&&y!==(y=C[1]/2)&&h(g,"y",y),R&4&&h(p,"width",C[2]),R&2&&h(p,"height",C[1]),R&1&&Re(t,"background",C[6][C[0]])},i:U,o:U,d(C){C&&N(t),w(),$=!1,F()}}}function Wg(e,t){const n=e.length;return t==="all"?1:e.filter(o=>o.vote_status===t).length/n}function Xg(e,t,n){let l,o,r,s;ue(e,st,m=>n(0,o=m)),ue(e,He,m=>n(8,r=m));let u,a,f=Fo(0);ue(e,f,m=>n(3,s=m));const c=vt(".1%"),d={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"var(--white)"};function p(){o=sa(this),st.set(o)}function g(){a=this.clientWidth,u=this.clientHeight,n(2,a),n(1,u)}return e.$$.update=()=>{e.$$.dirty&257&&n(7,l=Wg(r,o)),e.$$.dirty&128&&f.set(l)},[o,u,a,s,f,c,d,l,r,p,g]}class Ja extends ce{constructor(t){super(),de(this,t,Xg,Ug,fe,{})}}function Yg(e){let t,n,l,o,r,s,u,a,f,c,d,p,g,m,_,v,y,w,S,M,$,F,C,R,k,E,I;return r=new Ka({}),a=new Ja({}),d=new Ua({}),m=new Xa({props:{feedback:"Bad"}}),y=new Qa({}),M=new Ya({}),E=new Wa({}),{c(){t=A("div"),n=A("div"),l=A("div"),o=A("div"),ne(r.$$.fragment),s=P(),u=A("div"),ne(a.$$.fragment),f=P(),c=A("div"),ne(d.$$.fragment),p=P(),g=A("div"),ne(m.$$.fragment),_=P(),v=A("div"),ne(y.$$.fragment),w=P(),S=A("div"),ne(M.$$.fragment),$=P(),F=A("div"),C=A("div"),C.innerHTML=`
+
`,R=P(),k=A("div"),ne(E.$$.fragment),h(o,"class","card-1 svelte-14znspc"),h(u,"class","card-2"),h(l,"class","left-text svelte-14znspc"),h(c,"class","left-confidence svelte-14znspc"),h(g,"class","left-question svelte-14znspc"),h(v,"class","left-filter svelte-14znspc"),h(S,"class","left-filter2"),h(n,"class","feedback-left svelte-14znspc"),h(C,"class","right-chart svelte-14znspc"),h(k,"class","right-table svelte-14znspc"),h(F,"class","feedback-right svelte-14znspc"),h(t,"class","feedback-container svelte-14znspc")},m(D,L){T(D,t,L),b(t,n),b(n,l),b(l,o),ee(r,o,null),b(l,s),b(l,u),ee(a,u,null),b(n,f),b(n,c),ee(d,c,null),b(n,p),b(n,g),ee(m,g,null),b(n,_),b(n,v),ee(y,v,null),b(n,w),b(n,S),ee(M,S,null),b(t,$),b(t,F),b(F,C),b(F,R),b(F,k),ee(E,k,null),I=!0},p:U,i(D){I||(V(r.$$.fragment,D),V(a.$$.fragment,D),V(d.$$.fragment,D),V(m.$$.fragment,D),V(y.$$.fragment,D),V(M.$$.fragment,D),V(E.$$.fragment,D),I=!0)},o(D){z(r.$$.fragment,D),z(a.$$.fragment,D),z(d.$$.fragment,D),z(m.$$.fragment,D),z(y.$$.fragment,D),z(M.$$.fragment,D),z(E.$$.fragment,D),I=!1},d(D){D&&N(t),te(r),te(a),te(d),te(m),te(y),te(M),te(E)}}}function Qg(e,t,n){let l;ue(e,Mn,r=>n(0,l=r)),ft(()=>{o()});async function o(){const a=(await(await fetch("/chat/qa_table/retrieve")).json()).rows.map(f=>({id:f[0],question:f[1],answer:f[2],vote_status:f[3]}));De(Mn,l=[...a],l)}return[]}class Za extends ce{constructor(t){super(),de(this,t,Qg,Yg,fe,{})}}/**! * Sortable 1.15.0 * @author RubaXa * @author owenm * @license MIT - */function yr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,l)}return n}function at(e){for(var t=1;t=0)&&(n[o]=e[o]);return n}function Qg(e,t){if(e==null)return{};var n=Yg(e,t),l,o;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0)&&Object.prototype.propertyIsEnumerable.call(e,l)&&(n[l]=e[l])}return n}var Kg="1.15.0";function ht(e){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(e)}var bt=ht(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Tn=ht(/Edge/i),kr=ht(/firefox/i),vn=ht(/safari/i)&&!ht(/chrome/i)&&!ht(/android/i),Ja=ht(/iP(ad|od|hone)/i),Za=ht(/chrome/i)&&ht(/android/i),eu={capture:!1,passive:!1};function me(e,t,n){e.addEventListener(t,n,!bt&&eu)}function ge(e,t,n){e.removeEventListener(t,n,!bt&&eu)}function gl(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 Jg(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function tt(e,t,n,l){if(e){n=n||document;do{if(t!=null&&(t[0]===">"?e.parentNode===n&&gl(e,t):gl(e,t))||l&&e===n)return e;if(e===n)break}while(e=Jg(e))}return null}var Sr=/\s+/g;function je(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var l=(" "+e.className+" ").replace(Sr," ").replace(" "+t+" "," ");e.className=(l+(n?" "+t:"")).replace(Sr," ")}}function Z(e,t,n){var l=e&&e.style;if(l){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 l)&&t.indexOf("webkit")===-1&&(t="-webkit-"+t),l[t]=n+(typeof n=="string"?"":"px")}}function Jt(e,t){var n="";if(typeof e=="string")n=e;else do{var l=Z(e,"transform");l&&l!=="none"&&(n=l+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function tu(e,t,n){if(e){var l=e.getElementsByTagName(t),o=0,r=l.length;if(n)for(;o=r:s=o<=r,!s)return l;if(l===rt())break;l=Ct(l,!1)}return!1}function nn(e,t,n,l){for(var o=0,r=0,s=e.children;r2&&arguments[2]!==void 0?arguments[2]:{},o=l.evt,r=Qg(l,rp);On.pluginEvent.bind(J)(t,n,at({dragEl:H,parentEl:Re,ghostEl:re,rootEl:ke,nextEl:Nt,lastDownEl:Jn,cloneEl:Ce,cloneHidden:yt,dragStarted:dn,putSortable:Ie,activeSortable:J.active,originalEvent:o,oldIndex:Wt,oldDraggableIndex:wn,newIndex:xe,newDraggableIndex:wt,hideGhostForTarget:au,unhideGhostForTarget:uu,cloneNowHidden:function(){yt=!0},cloneNowShown:function(){yt=!1},dispatchSortableEvent:function(u){Te({sortable:n,name:u,originalEvent:o})}},r))};function Te(e){ip(at({putSortable:Ie,cloneEl:Ce,targetEl:H,rootEl:ke,oldIndex:Wt,oldDraggableIndex:wn,newIndex:xe,newDraggableIndex:wt},e))}var H,Re,re,ke,Nt,Jn,Ce,yt,Wt,xe,wn,wt,Bn,Ie,Ut=!1,pl=!1,ml=[],Ft,Ke,Ll,ql,Rr,Ar,dn,jt,yn,kn=!1,jn=!1,Zn,Ne,Hl=[],_o=!1,_l=[],Al=typeof document<"u",xn=Ja,Mr=Tn||bt?"cssFloat":"float",sp=Al&&!Za&&!Ja&&"draggable"in document.createElement("div"),iu=function(){if(Al){if(bt)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto",e.style.pointerEvents==="auto"}}(),ru=function(t,n){var l=Z(t),o=parseInt(l.width)-parseInt(l.paddingLeft)-parseInt(l.paddingRight)-parseInt(l.borderLeftWidth)-parseInt(l.borderRightWidth),r=nn(t,0,n),s=nn(t,1,n),u=r&&Z(r),a=s&&Z(s),f=u&&parseInt(u.marginLeft)+parseInt(u.marginRight)+Fe(r).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Fe(s).width;if(l.display==="flex")return l.flexDirection==="column"||l.flexDirection==="column-reverse"?"vertical":"horizontal";if(l.display==="grid")return l.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(r&&u.float&&u.float!=="none"){var d=u.float==="left"?"left":"right";return s&&(a.clear==="both"||a.clear===d)?"vertical":"horizontal"}return r&&(u.display==="block"||u.display==="flex"||u.display==="table"||u.display==="grid"||f>=o&&l[Mr]==="none"||s&&l[Mr]==="none"&&f+c>o)?"vertical":"horizontal"},ap=function(t,n,l){var o=l?t.left:t.top,r=l?t.right:t.bottom,s=l?t.width:t.height,u=l?n.left:n.top,a=l?n.right:n.bottom,f=l?n.width:n.height;return o===u||r===a||o+s/2===u+f/2},up=function(t,n){var l;return ml.some(function(o){var r=o[Ue].options.emptyInsertThreshold;if(!(!r||zo(o))){var s=Fe(o),u=t>=s.left-r&&t<=s.right+r,a=n>=s.top-r&&n<=s.bottom+r;if(u&&a)return l=o}}),l},su=function(t){function n(r,s){return function(u,a,f,c){var d=u.options.group.name&&a.options.group.name&&u.options.group.name===a.options.group.name;if(r==null&&(s||d))return!0;if(r==null||r===!1)return!1;if(s&&r==="clone")return r;if(typeof r=="function")return n(r(u,a,f,c),s)(u,a,f,c);var g=(s?u:a).options.group.name;return r===!0||typeof r=="string"&&r===g||r.join&&r.indexOf(g)>-1}}var l={},o=t.group;(!o||Kn(o)!="object")&&(o={name:o}),l.name=o.name,l.checkPull=n(o.pull,!0),l.checkPut=n(o.put),l.revertClone=o.revertClone,t.group=l},au=function(){!iu&&re&&Z(re,"display","none")},uu=function(){!iu&&re&&Z(re,"display","")};Al&&!Za&&document.addEventListener("click",function(e){if(pl)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),pl=!1,!1},!0);var Dt=function(t){if(H){t=t.touches?t.touches[0]:t;var n=up(t.clientX,t.clientY);if(n){var l={};for(var o in t)t.hasOwnProperty(o)&&(l[o]=t[o]);l.target=l.rootEl=n,l.preventDefault=void 0,l.stopPropagation=void 0,n[Ue]._onDragOver(l)}}},fp=function(t){H&&H.parentNode[Ue]._isOutsideThisEl(t.target)};function J(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=_t({},t),e[Ue]=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 ru(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(s,u){s.setData("Text",u.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:J.supportPointer!==!1&&"PointerEvent"in window&&!vn,emptyInsertThreshold:5};On.initializePlugins(this,e,n);for(var l in n)!(l in t)&&(t[l]=n[l]);su(t);for(var o in this)o.charAt(0)==="_"&&typeof this[o]=="function"&&(this[o]=this[o].bind(this));this.nativeDraggable=t.forceFallback?!1:sp,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?me(e,"pointerdown",this._onTapStart):(me(e,"mousedown",this._onTapStart),me(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(me(e,"dragover",this),me(e,"dragenter",this)),ml.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),_t(this,np())}J.prototype={constructor:J,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(jt=null)},_getDirection:function(t,n){return typeof this.options.direction=="function"?this.options.direction.call(this,t,n,H):this.options.direction},_onTapStart:function(t){if(t.cancelable){var n=this,l=this.el,o=this.options,r=o.preventOnFilter,s=t.type,u=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,a=(u||t).target,f=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||a,c=o.filter;if(vp(l),!H&&!(/mousedown|pointerdown/.test(s)&&t.button!==0||o.disabled)&&!f.isContentEditable&&!(!this.nativeDraggable&&vn&&a&&a.tagName.toUpperCase()==="SELECT")&&(a=tt(a,o.draggable,l,!1),!(a&&a.animated)&&Jn!==a)){if(Wt=Xe(a),wn=Xe(a,o.draggable),typeof c=="function"){if(c.call(this,t,a,this)){Te({sortable:n,rootEl:f,name:"filter",targetEl:a,toEl:l,fromEl:l}),ze("filter",n,{evt:t}),r&&t.cancelable&&t.preventDefault();return}}else if(c&&(c=c.split(",").some(function(d){if(d=tt(f,d.trim(),l,!1),d)return Te({sortable:n,rootEl:d,name:"filter",targetEl:a,fromEl:l,toEl:l}),ze("filter",n,{evt:t}),!0}),c)){r&&t.cancelable&&t.preventDefault();return}o.handle&&!tt(f,o.handle,l,!1)||this._prepareDragStart(t,u,a)}}},_prepareDragStart:function(t,n,l){var o=this,r=o.el,s=o.options,u=r.ownerDocument,a;if(l&&!H&&l.parentNode===r){var f=Fe(l);if(ke=r,H=l,Re=H.parentNode,Nt=H.nextSibling,Jn=l,Bn=s.group,J.dragged=H,Ft={target:H,clientX:(n||t).clientX,clientY:(n||t).clientY},Rr=Ft.clientX-f.left,Ar=Ft.clientY-f.top,this._lastX=(n||t).clientX,this._lastY=(n||t).clientY,H.style["will-change"]="all",a=function(){if(ze("delayEnded",o,{evt:t}),J.eventCanceled){o._onDrop();return}o._disableDelayedDragEvents(),!kr&&o.nativeDraggable&&(H.draggable=!0),o._triggerDragStart(t,n),Te({sortable:o,name:"choose",originalEvent:t}),je(H,s.chosenClass,!0)},s.ignore.split(",").forEach(function(c){tu(H,c.trim(),Gl)}),me(u,"dragover",Dt),me(u,"mousemove",Dt),me(u,"touchmove",Dt),me(u,"mouseup",o._onDrop),me(u,"touchend",o._onDrop),me(u,"touchcancel",o._onDrop),kr&&this.nativeDraggable&&(this.options.touchStartThreshold=4,H.draggable=!0),ze("delayStart",this,{evt:t}),s.delay&&(!s.delayOnTouchOnly||n)&&(!this.nativeDraggable||!(Tn||bt))){if(J.eventCanceled){this._onDrop();return}me(u,"mouseup",o._disableDelayedDrag),me(u,"touchend",o._disableDelayedDrag),me(u,"touchcancel",o._disableDelayedDrag),me(u,"mousemove",o._delayedDragTouchMoveHandler),me(u,"touchmove",o._delayedDragTouchMoveHandler),s.supportPointer&&me(u,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(a,s.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(){H&&Gl(H),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;ge(t,"mouseup",this._disableDelayedDrag),ge(t,"touchend",this._disableDelayedDrag),ge(t,"touchcancel",this._disableDelayedDrag),ge(t,"mousemove",this._delayedDragTouchMoveHandler),ge(t,"touchmove",this._delayedDragTouchMoveHandler),ge(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,n){n=n||t.pointerType=="touch"&&t,!this.nativeDraggable||n?this.options.supportPointer?me(document,"pointermove",this._onTouchMove):n?me(document,"touchmove",this._onTouchMove):me(document,"mousemove",this._onTouchMove):(me(H,"dragend",this),me(ke,"dragstart",this._onDragStart));try{document.selection?el(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,n){if(Ut=!1,ke&&H){ze("dragStarted",this,{evt:n}),this.nativeDraggable&&me(document,"dragover",fp);var l=this.options;!t&&je(H,l.dragClass,!1),je(H,l.ghostClass,!0),J.active=this,t&&this._appendGhost(),Te({sortable:this,name:"start",originalEvent:n})}else this._nulling()},_emulateDragOver:function(){if(Ke){this._lastX=Ke.clientX,this._lastY=Ke.clientY,au();for(var t=document.elementFromPoint(Ke.clientX,Ke.clientY),n=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Ke.clientX,Ke.clientY),t!==n);)n=t;if(H.parentNode[Ue]._isOutsideThisEl(t),n)do{if(n[Ue]){var l=void 0;if(l=n[Ue]._onDragOver({clientX:Ke.clientX,clientY:Ke.clientY,target:t,rootEl:n}),l&&!this.options.dragoverBubble)break}t=n}while(n=n.parentNode);uu()}},_onTouchMove:function(t){if(Ft){var n=this.options,l=n.fallbackTolerance,o=n.fallbackOffset,r=t.touches?t.touches[0]:t,s=re&&Jt(re,!0),u=re&&s&&s.a,a=re&&s&&s.d,f=xn&&Ne&&$r(Ne),c=(r.clientX-Ft.clientX+o.x)/(u||1)+(f?f[0]-Hl[0]:0)/(u||1),d=(r.clientY-Ft.clientY+o.y)/(a||1)+(f?f[1]-Hl[1]:0)/(a||1);if(!J.active&&!Ut){if(l&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))=0&&(Te({rootEl:Re,name:"add",toEl:Re,fromEl:ke,originalEvent:t}),Te({sortable:this,name:"remove",toEl:Re,originalEvent:t}),Te({rootEl:Re,name:"sort",toEl:Re,fromEl:ke,originalEvent:t}),Te({sortable:this,name:"sort",toEl:Re,originalEvent:t})),Ie&&Ie.save()):xe!==Wt&&xe>=0&&(Te({sortable:this,name:"update",toEl:Re,originalEvent:t}),Te({sortable:this,name:"sort",toEl:Re,originalEvent:t})),J.active&&((xe==null||xe===-1)&&(xe=Wt,wt=wn),Te({sortable:this,name:"end",toEl:Re,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){ze("nulling",this),ke=H=Re=re=Nt=Ce=Jn=yt=Ft=Ke=dn=xe=wt=Wt=wn=jt=yn=Ie=Bn=J.dragged=J.ghost=J.clone=J.active=null,_l.forEach(function(t){t.checked=!0}),_l.length=Ll=ql=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":H&&(this._onDragOver(t),cp(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],n,l=this.el.children,o=0,r=l.length,s=this.options;ol.right+o||e.clientX<=l.right&&e.clientY>l.bottom&&e.clientX>=l.left:e.clientX>l.right&&e.clientY>l.top||e.clientX<=l.right&&e.clientY>l.bottom+o}function pp(e,t,n,l,o,r,s,u){var a=l?e.clientY:e.clientX,f=l?n.height:n.width,c=l?n.top:n.left,d=l?n.bottom:n.right,g=!1;if(!s){if(u&&Znc+f*r/2:ad-Zn)return-yn}else if(a>c+f*(1-o)/2&&ad-f*r/2)?a>c+f/2?1:-1:0}function mp(e){return Xe(H)R[28];for(let R=0;RRn(t,"showModal",ae));let W=e[8];const Q=X=>X[25];for(let X=0;X=0)&&(n[o]=e[o]);return n}function Zg(e,t){if(e==null)return{};var n=Jg(e,t),l,o;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0)&&Object.prototype.propertyIsEnumerable.call(e,l)&&(n[l]=e[l])}return n}var ep="1.15.0";function ht(e){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(e)}var bt=ht(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),On=ht(/Edge/i),Sr=ht(/firefox/i),wn=ht(/safari/i)&&!ht(/chrome/i)&&!ht(/android/i),eu=ht(/iP(ad|od|hone)/i),tu=ht(/chrome/i)&&ht(/android/i),nu={capture:!1,passive:!1};function me(e,t,n){e.addEventListener(t,n,!bt&&nu)}function ge(e,t,n){e.removeEventListener(t,n,!bt&&nu)}function pl(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 tp(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function tt(e,t,n,l){if(e){n=n||document;do{if(t!=null&&(t[0]===">"?e.parentNode===n&&pl(e,t):pl(e,t))||l&&e===n)return e;if(e===n)break}while(e=tp(e))}return null}var Cr=/\s+/g;function je(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var l=(" "+e.className+" ").replace(Cr," ").replace(" "+t+" "," ");e.className=(l+(n?" "+t:"")).replace(Cr," ")}}function Z(e,t,n){var l=e&&e.style;if(l){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 l)&&t.indexOf("webkit")===-1&&(t="-webkit-"+t),l[t]=n+(typeof n=="string"?"":"px")}}function Zt(e,t){var n="";if(typeof e=="string")n=e;else do{var l=Z(e,"transform");l&&l!=="none"&&(n=l+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function lu(e,t,n){if(e){var l=e.getElementsByTagName(t),o=0,r=l.length;if(n)for(;o=r:s=o<=r,!s)return l;if(l===rt())break;l=Ct(l,!1)}return!1}function on(e,t,n,l){for(var o=0,r=0,s=e.children;r2&&arguments[2]!==void 0?arguments[2]:{},o=l.evt,r=Zg(l,up);Vn.pluginEvent.bind(J)(t,n,at({dragEl:H,parentEl:Ae,ghostEl:re,rootEl:ke,nextEl:Pt,lastDownEl:Zn,cloneEl:Ce,cloneHidden:yt,dragStarted:gn,putSortable:Ne,activeSortable:J.active,originalEvent:o,oldIndex:Xt,oldDraggableIndex:kn,newIndex:xe,newDraggableIndex:wt,hideGhostForTarget:fu,unhideGhostForTarget:cu,cloneNowHidden:function(){yt=!0},cloneNowShown:function(){yt=!1},dispatchSortableEvent:function(u){Te({sortable:n,name:u,originalEvent:o})}},r))};function Te(e){ap(at({putSortable:Ne,cloneEl:Ce,targetEl:H,rootEl:ke,oldIndex:Xt,oldDraggableIndex:kn,newIndex:xe,newDraggableIndex:wt},e))}var H,Ae,re,ke,Pt,Zn,Ce,yt,Xt,xe,kn,wt,jn,Ne,Wt=!1,ml=!1,_l=[],Ft,Ke,ql,Hl,Rr,Mr,gn,xt,Sn,Cn=!1,xn=!1,el,Pe,Gl=[],_o=!1,vl=[],Ml=typeof document<"u",Un=eu,Er=On||bt?"cssFloat":"float",fp=Ml&&!tu&&!eu&&"draggable"in document.createElement("div"),su=function(){if(Ml){if(bt)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto",e.style.pointerEvents==="auto"}}(),au=function(t,n){var l=Z(t),o=parseInt(l.width)-parseInt(l.paddingLeft)-parseInt(l.paddingRight)-parseInt(l.borderLeftWidth)-parseInt(l.borderRightWidth),r=on(t,0,n),s=on(t,1,n),u=r&&Z(r),a=s&&Z(s),f=u&&parseInt(u.marginLeft)+parseInt(u.marginRight)+Fe(r).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Fe(s).width;if(l.display==="flex")return l.flexDirection==="column"||l.flexDirection==="column-reverse"?"vertical":"horizontal";if(l.display==="grid")return l.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(r&&u.float&&u.float!=="none"){var d=u.float==="left"?"left":"right";return s&&(a.clear==="both"||a.clear===d)?"vertical":"horizontal"}return r&&(u.display==="block"||u.display==="flex"||u.display==="table"||u.display==="grid"||f>=o&&l[Er]==="none"||s&&l[Er]==="none"&&f+c>o)?"vertical":"horizontal"},cp=function(t,n,l){var o=l?t.left:t.top,r=l?t.right:t.bottom,s=l?t.width:t.height,u=l?n.left:n.top,a=l?n.right:n.bottom,f=l?n.width:n.height;return o===u||r===a||o+s/2===u+f/2},dp=function(t,n){var l;return _l.some(function(o){var r=o[Ue].options.emptyInsertThreshold;if(!(!r||zo(o))){var s=Fe(o),u=t>=s.left-r&&t<=s.right+r,a=n>=s.top-r&&n<=s.bottom+r;if(u&&a)return l=o}}),l},uu=function(t){function n(r,s){return function(u,a,f,c){var d=u.options.group.name&&a.options.group.name&&u.options.group.name===a.options.group.name;if(r==null&&(s||d))return!0;if(r==null||r===!1)return!1;if(s&&r==="clone")return r;if(typeof r=="function")return n(r(u,a,f,c),s)(u,a,f,c);var p=(s?u:a).options.group.name;return r===!0||typeof r=="string"&&r===p||r.join&&r.indexOf(p)>-1}}var l={},o=t.group;(!o||Jn(o)!="object")&&(o={name:o}),l.name=o.name,l.checkPull=n(o.pull,!0),l.checkPut=n(o.put),l.revertClone=o.revertClone,t.group=l},fu=function(){!su&&re&&Z(re,"display","none")},cu=function(){!su&&re&&Z(re,"display","")};Ml&&!tu&&document.addEventListener("click",function(e){if(ml)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),ml=!1,!1},!0);var Dt=function(t){if(H){t=t.touches?t.touches[0]:t;var n=dp(t.clientX,t.clientY);if(n){var l={};for(var o in t)t.hasOwnProperty(o)&&(l[o]=t[o]);l.target=l.rootEl=n,l.preventDefault=void 0,l.stopPropagation=void 0,n[Ue]._onDragOver(l)}}},hp=function(t){H&&H.parentNode[Ue]._isOutsideThisEl(t.target)};function J(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=_t({},t),e[Ue]=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 au(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(s,u){s.setData("Text",u.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:J.supportPointer!==!1&&"PointerEvent"in window&&!wn,emptyInsertThreshold:5};Vn.initializePlugins(this,e,n);for(var l in n)!(l in t)&&(t[l]=n[l]);uu(t);for(var o in this)o.charAt(0)==="_"&&typeof this[o]=="function"&&(this[o]=this[o].bind(this));this.nativeDraggable=t.forceFallback?!1:fp,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?me(e,"pointerdown",this._onTapStart):(me(e,"mousedown",this._onTapStart),me(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(me(e,"dragover",this),me(e,"dragenter",this)),_l.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),_t(this,ip())}J.prototype={constructor:J,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(xt=null)},_getDirection:function(t,n){return typeof this.options.direction=="function"?this.options.direction.call(this,t,n,H):this.options.direction},_onTapStart:function(t){if(t.cancelable){var n=this,l=this.el,o=this.options,r=o.preventOnFilter,s=t.type,u=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,a=(u||t).target,f=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||a,c=o.filter;if(yp(l),!H&&!(/mousedown|pointerdown/.test(s)&&t.button!==0||o.disabled)&&!f.isContentEditable&&!(!this.nativeDraggable&&wn&&a&&a.tagName.toUpperCase()==="SELECT")&&(a=tt(a,o.draggable,l,!1),!(a&&a.animated)&&Zn!==a)){if(Xt=Xe(a),kn=Xe(a,o.draggable),typeof c=="function"){if(c.call(this,t,a,this)){Te({sortable:n,rootEl:f,name:"filter",targetEl:a,toEl:l,fromEl:l}),Le("filter",n,{evt:t}),r&&t.cancelable&&t.preventDefault();return}}else if(c&&(c=c.split(",").some(function(d){if(d=tt(f,d.trim(),l,!1),d)return Te({sortable:n,rootEl:d,name:"filter",targetEl:a,fromEl:l,toEl:l}),Le("filter",n,{evt:t}),!0}),c)){r&&t.cancelable&&t.preventDefault();return}o.handle&&!tt(f,o.handle,l,!1)||this._prepareDragStart(t,u,a)}}},_prepareDragStart:function(t,n,l){var o=this,r=o.el,s=o.options,u=r.ownerDocument,a;if(l&&!H&&l.parentNode===r){var f=Fe(l);if(ke=r,H=l,Ae=H.parentNode,Pt=H.nextSibling,Zn=l,jn=s.group,J.dragged=H,Ft={target:H,clientX:(n||t).clientX,clientY:(n||t).clientY},Rr=Ft.clientX-f.left,Mr=Ft.clientY-f.top,this._lastX=(n||t).clientX,this._lastY=(n||t).clientY,H.style["will-change"]="all",a=function(){if(Le("delayEnded",o,{evt:t}),J.eventCanceled){o._onDrop();return}o._disableDelayedDragEvents(),!Sr&&o.nativeDraggable&&(H.draggable=!0),o._triggerDragStart(t,n),Te({sortable:o,name:"choose",originalEvent:t}),je(H,s.chosenClass,!0)},s.ignore.split(",").forEach(function(c){lu(H,c.trim(),Bl)}),me(u,"dragover",Dt),me(u,"mousemove",Dt),me(u,"touchmove",Dt),me(u,"mouseup",o._onDrop),me(u,"touchend",o._onDrop),me(u,"touchcancel",o._onDrop),Sr&&this.nativeDraggable&&(this.options.touchStartThreshold=4,H.draggable=!0),Le("delayStart",this,{evt:t}),s.delay&&(!s.delayOnTouchOnly||n)&&(!this.nativeDraggable||!(On||bt))){if(J.eventCanceled){this._onDrop();return}me(u,"mouseup",o._disableDelayedDrag),me(u,"touchend",o._disableDelayedDrag),me(u,"touchcancel",o._disableDelayedDrag),me(u,"mousemove",o._delayedDragTouchMoveHandler),me(u,"touchmove",o._delayedDragTouchMoveHandler),s.supportPointer&&me(u,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(a,s.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(){H&&Bl(H),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;ge(t,"mouseup",this._disableDelayedDrag),ge(t,"touchend",this._disableDelayedDrag),ge(t,"touchcancel",this._disableDelayedDrag),ge(t,"mousemove",this._delayedDragTouchMoveHandler),ge(t,"touchmove",this._delayedDragTouchMoveHandler),ge(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,n){n=n||t.pointerType=="touch"&&t,!this.nativeDraggable||n?this.options.supportPointer?me(document,"pointermove",this._onTouchMove):n?me(document,"touchmove",this._onTouchMove):me(document,"mousemove",this._onTouchMove):(me(H,"dragend",this),me(ke,"dragstart",this._onDragStart));try{document.selection?tl(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,n){if(Wt=!1,ke&&H){Le("dragStarted",this,{evt:n}),this.nativeDraggable&&me(document,"dragover",hp);var l=this.options;!t&&je(H,l.dragClass,!1),je(H,l.ghostClass,!0),J.active=this,t&&this._appendGhost(),Te({sortable:this,name:"start",originalEvent:n})}else this._nulling()},_emulateDragOver:function(){if(Ke){this._lastX=Ke.clientX,this._lastY=Ke.clientY,fu();for(var t=document.elementFromPoint(Ke.clientX,Ke.clientY),n=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Ke.clientX,Ke.clientY),t!==n);)n=t;if(H.parentNode[Ue]._isOutsideThisEl(t),n)do{if(n[Ue]){var l=void 0;if(l=n[Ue]._onDragOver({clientX:Ke.clientX,clientY:Ke.clientY,target:t,rootEl:n}),l&&!this.options.dragoverBubble)break}t=n}while(n=n.parentNode);cu()}},_onTouchMove:function(t){if(Ft){var n=this.options,l=n.fallbackTolerance,o=n.fallbackOffset,r=t.touches?t.touches[0]:t,s=re&&Zt(re,!0),u=re&&s&&s.a,a=re&&s&&s.d,f=Un&&Pe&&Ar(Pe),c=(r.clientX-Ft.clientX+o.x)/(u||1)+(f?f[0]-Gl[0]:0)/(u||1),d=(r.clientY-Ft.clientY+o.y)/(a||1)+(f?f[1]-Gl[1]:0)/(a||1);if(!J.active&&!Wt){if(l&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))=0&&(Te({rootEl:Ae,name:"add",toEl:Ae,fromEl:ke,originalEvent:t}),Te({sortable:this,name:"remove",toEl:Ae,originalEvent:t}),Te({rootEl:Ae,name:"sort",toEl:Ae,fromEl:ke,originalEvent:t}),Te({sortable:this,name:"sort",toEl:Ae,originalEvent:t})),Ne&&Ne.save()):xe!==Xt&&xe>=0&&(Te({sortable:this,name:"update",toEl:Ae,originalEvent:t}),Te({sortable:this,name:"sort",toEl:Ae,originalEvent:t})),J.active&&((xe==null||xe===-1)&&(xe=Xt,wt=kn),Te({sortable:this,name:"end",toEl:Ae,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){Le("nulling",this),ke=H=Ae=re=Pt=Ce=Zn=yt=Ft=Ke=gn=xe=wt=Xt=kn=xt=Sn=Ne=jn=J.dragged=J.ghost=J.clone=J.active=null,vl.forEach(function(t){t.checked=!0}),vl.length=ql=Hl=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":H&&(this._onDragOver(t),gp(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],n,l=this.el.children,o=0,r=l.length,s=this.options;ol.right+o||e.clientX<=l.right&&e.clientY>l.bottom&&e.clientX>=l.left:e.clientX>l.right&&e.clientY>l.top||e.clientX<=l.right&&e.clientY>l.bottom+o}function vp(e,t,n,l,o,r,s,u){var a=l?e.clientY:e.clientX,f=l?n.height:n.width,c=l?n.top:n.left,d=l?n.bottom:n.right,p=!1;if(!s){if(u&&elc+f*r/2:ad-el)return-Sn}else if(a>c+f*(1-o)/2&&ad-f*r/2)?a>c+f/2?1:-1:0}function bp(e){return Xe(H)R[28];for(let R=0;RRn(t,"showModal",ae));let W=e[8];const Q=X=>X[25];for(let X=0;Xn=!1)),t.$set(le),Y&3463&&(W=X[8],S=gt(S,Y,Q,1,X,W,M,w,zt,Tr,null,Fr)),Y&8&&R.value!==X[3]&&Ye(R,X[3]),(!O||Y&80)&&I!==(I=(X[4]?X[6]:"Send")+"")&&K(D,I),(!O||Y&8&&L!==(L="btnyousend "+(X[3]===""?"":"active")+" svelte-1nj8mt0"))&&h(E,"class",L)},i(X){O||(V(t.$$.fragment,X),O=!0)},o(X){z(t.$$.fragment,X),O=!1},d(X){te(t,X),X&&P(l),X&&P(o);for(let Y=0;Y{e.scrollIntoView({behavior:"smooth"})},0)}async function Or(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 l=await n.text();alert(l)}}function kp(e,t,n){let l,o,r;ue(e,an,k=>n(8,r=k));let{numModels:s=1}=t,{models:u=[0]}=t,a="",f="",c=!1,d=!1;ft(async()=>{if(await new Promise(k=>setTimeout(k,200)),_){const k=new J(_,{animation:150,onUpdate(E){k.toArray()}});k.toArray()}g()});async function g(){const E=await(await fetch("/chat/comparator/db/retrieve")).json();console.log(E);const I=E.data;let D={},L=new Set;for(const O of I)L.add(O.model),D[O.qid]||(D[O.qid]={},D[O.qid].qid=O.qid,D[O.qid].question=O.question),D[O.qid][O.model]=O.answer,console.log(D);n(1,u=Array.from(L)),n(0,s=u.length),console.log(Object.values(D)),Pe(an,r=[...Object.values(D)],r)}const p=async k=>{k.preventDefault(),a=f,n(3,f=""),n(4,c=!0);let E={question:a};for(let D of u)E[D]="Loading...";Pe(an,r=[...r,E],r),console.log("compare chat log",an);const I=await fetch(`/chat/comparator/${a}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:a})});if(I.ok){const D=await I.json();n(1,u=Object.keys(D.answer)),n(0,s=u.length);for(let L of u)E[L]=D.answer[L];E.qid=D.qid,an.update(L=>(L[L.length-1]=E,L))}else{const D=await I.text();alert(D)}n(4,c=!1)};let m=0;setInterval(()=>{n(13,m=(m+1)%4)},200);let _,v;function y(k,E){const I=E,L=pt(k.currentTarget.parentNode).selectAll("div.answer").nodes().map(ae=>ae.id);L.forEach((ae,pe)=>{pt(`#${ae}`).select(".answer-rank").property("value",pe+1)});let O=[];for(let[ae,pe]of L.entries()){const W=parseInt(pe.split("-")[1]),Q=u[W],X={rank:ae,model:Q};O.push(X)}let B=r.filter(ae=>ae.qid===I),j=[];for(let ae of O){const pe={model:ae.model,qid:parseInt(I),rank:parseInt(ae.rank)+1,answer:B[0][ae.model]};j.push(pe)}Or(j)}function w(k,E,I){const D=E,L=parseInt(k.target.value),O=u[I],B={qid:D,rank:parseInt(L),model:O};let j=[],pe=r.filter(Q=>Q.qid===B.qid)[0][B.model];const W={model:B.model,qid:parseInt(B.qid),rank:parseInt(B.rank),answer:pe};j.push(W),Or(j)}function S(){n(5,d=!0)}function M(k){d=k,n(5,d)}const $=(k,E,I)=>w(I,k.qid,E),F=(k,E)=>y(E,k.qid);function C(k){et[k?"unshift":"push"](()=>{_=k,n(2,_)})}function R(){f=this.value,n(3,f)}return e.$$set=k=>{"numModels"in k&&n(0,s=k.numModels),"models"in k&&n(1,u=k.models)},e.$$.update=()=>{e.$$.dirty&1&&n(7,l="1fr ".repeat(s).trim()),e.$$.dirty&8192&&n(6,o=".".repeat(m).padEnd(3)),e.$$.dirty&16388&&_&&(n(14,v=new J(_,{animation:150,dataIdAttr:"id",onUpdate(k){v.toArray()}})),v.toArray())},[s,u,_,f,c,d,o,l,r,p,y,w,S,m,v,M,$,F,C,R]}class Sp extends ce{constructor(t){super(),de(this,t,kp,wp,fe,{numModels:0,models:1})}}const ln=De([{model:"llama",qid:1,rank:1,answer:"Llama's first unique answer."},{model:"gpt3.5",qid:1,rank:2,answer:"GPT-3.5's first unique answer."},{model:"gpt4",qid:1,rank:3,answer:"GPT-4's first unique answer."},{model:"claude",qid:1,rank:4,answer:"Claude's first unique answer."},{model:"llama",qid:2,rank:4,answer:"Llama's second unique answer."},{model:"gpt3.5",qid:2,rank:2,answer:"GPT-3.5's second unique answer."},{model:"gpt4",qid:2,rank:4,answer:"GPT-4's second unique answer."},{model:"claude",qid:2,rank:3,answer:"'s second unique answer."}]);function Vr(e,t,n){const l=e.slice();return l[20]=t[n],l}function zr(e,t,n){const l=e.slice();return l[20]=t[n],l[24]=n,l}function Lr(e,t,n){const l=e.slice();return l[25]=t[n],l}function qr(e){let t,n,l,o,r=`Q.${e[25]}`,s,u;return{c(){t=G("g"),n=G("line"),o=G("text"),s=q(r),h(n,"class","axis-tick svelte-1nna9rx"),h(n,"x1","0"),h(n,"x2","0"),h(n,"y1",0),h(n,"y2",l=-e[5]+e[12].bottom+e[12].top),h(n,"stroke","black"),h(n,"stroke-dasharray","4"),h(o,"class","axis-text svelte-1nna9rx"),h(o,"y","15"),h(o,"text-anchor","middle"),h(t,"transform",u=`translate(${e[3](e[25])+0} ${e[5]-e[12].bottom})`),h(t,"class","svelte-1nna9rx")},m(a,f){T(a,t,f),b(t,n),b(t,o),b(o,s)},p(a,f){f&32&&l!==(l=-a[5]+a[12].bottom+a[12].top)&&h(n,"y2",l),f&256&&r!==(r=`Q.${a[25]}`)&&K(s,r),f&296&&u!==(u=`translate(${a[3](a[25])+0} ${a[5]-a[12].bottom})`)&&h(t,"transform",u)},d(a){a&&P(t)}}}function Hr(e){let t=Number.isInteger(e[25]),n,l=t&&qr(e);return{c(){l&&l.c(),n=Se()},m(o,r){l&&l.m(o,r),T(o,n,r)},p(o,r){r&256&&(t=Number.isInteger(o[25])),t?l?l.p(o,r):(l=qr(o),l.c(),l.m(n.parentNode,n)):l&&(l.d(1),l=null)},d(o){l&&l.d(o),o&&P(n)}}}function Gr(e,t){let n,l,o,r,s,u,a,f,c;function d(){return t[15](t[24])}function g(){return t[16](t[24])}return{key:e,first:null,c(){n=G("path"),r=G("path"),h(n,"class","model-path-outer svelte-1nna9rx"),h(n,"d",l=t[10](t[20])),h(n,"stroke","white"),h(n,"data-model",o=t[2][t[24]]),h(r,"class","model-path svelte-1nna9rx"),h(r,"d",s=t[10](t[20])),h(r,"role","img"),h(r,"stroke",u=t[11](t[2][t[24]])),h(r,"data-model",a=t[2][t[24]]),this.first=n},m(p,m){T(p,n,m),T(p,r,m),f||(c=[x(r,"mouseover",d),x(r,"focus",g),x(r,"mouseout",bl),x(r,"blur",bl)],f=!0)},p(p,m){t=p,m&1536&&l!==(l=t[10](t[20]))&&h(n,"d",l),m&516&&o!==(o=t[2][t[24]])&&h(n,"data-model",o),m&1536&&s!==(s=t[10](t[20]))&&h(r,"d",s),m&2564&&u!==(u=t[11](t[2][t[24]]))&&h(r,"stroke",u),m&516&&a!==(a=t[2][t[24]])&&h(r,"data-model",a)},d(p){p&&P(n),p&&P(r),f=!1,be(c)}}}function Br(e,t){let n,l,o,r,s,u,a=t[20].rank+"",f,c,d,g;return{key:e,first:null,c(){n=G("g"),l=G("circle"),u=G("text"),f=q(a),h(l,"r",o=t[20].answer.length/2*0+12),h(l,"fill",r=t[11](t[20].model)),h(l,"stroke","white"),h(l,"class","model-circle svelte-1nna9rx"),h(l,"role","img"),h(l,"data-model",s=t[20].model),h(u,"class","bump-text svelte-1nna9rx"),h(u,"text-anchor","middle"),h(u,"alignment-baseline","middle"),h(u,"color","white"),h(u,"fill","white"),h(n,"transform",c=`translate(${t[3](t[20].qid)}, ${t[4](t[20].rank)})`),h(n,"class","svelte-1nna9rx"),this.first=n},m(p,m){T(p,n,m),b(n,l),b(n,u),b(u,f),d||(g=[x(l,"mouseover",t[17]),x(l,"focus",t[18]),x(l,"mouseout",bl),x(l,"blur",bl)],d=!0)},p(p,m){t=p,m&128&&o!==(o=t[20].answer.length/2*0+12)&&h(l,"r",o),m&2176&&r!==(r=t[11](t[20].model))&&h(l,"fill",r),m&128&&s!==(s=t[20].model)&&h(l,"data-model",s),m&128&&a!==(a=t[20].rank+"")&&K(f,a),m&152&&c!==(c=`translate(${t[3](t[20].qid)}, ${t[4](t[20].rank)})`)&&h(n,"transform",c)},d(p){p&&P(n),d=!1,be(g)}}}function Cp(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m=[],_=new Map,v,y=[],w=new Map,S,M,$,F,C,R=e[8],k=[];for(let O=0;OO[24];for(let O=0;OO[20].model+O[20].qid;for(let O=0;Oe[19].call(t))},m(O,B){T(O,t,B),b(t,n),b(n,l);for(let j=0;j{e.style.opacity=1})}function $p(e,t,n){let l,o,r,s,u,a,f,c,d,g,p;ue(e,ln,C=>n(7,p=C));let m,_,v={top:35,bottom:15,left:10,right:0};function y(C){document.querySelectorAll(".model-path, .model-path-outer, .model-circle").forEach(R=>{R.style.opacity=.12}),document.querySelectorAll(`.model-path[data-model="${l[C]}"], .model-circle[data-model="${l[C]}"]`).forEach(R=>{R.style.opacity=1})}const w=C=>y(C),S=C=>y(C),M=()=>y(i),$=()=>y(i);function F(){_=this.offsetWidth,m=this.offsetHeight,n(1,_),n(0,m)}return e.$$.update=()=>{e.$$.dirty&128&&n(2,l=Array.from(new Set(p.map(C=>C.model)))),e.$$.dirty&2&&n(6,o=_-v.left-v.right),e.$$.dirty&1&&n(5,r=m-v.top-v.bottom),e.$$.dirty&192&&n(3,s=Gi().domain(p.map(C=>C.qid)).padding(.3).range([v.left,o-v.right])),e.$$.dirty&128&&n(14,u=p.map(C=>C.rank).sort((C,R)=>C-R)),e.$$.dirty&16416&&n(4,a=Gi().domain(u).padding(1).range([v.top,r-v.bottom])),e.$$.dirty&128&&n(11,f=Mt().domain(p.map(C=>C.model)).range(["#FF5470","#1B2D45","#00EBC7","#FDE24F","red"])),e.$$.dirty&24&&n(10,c=Sg().x(C=>s(C.qid)).y(C=>a(C.rank))),e.$$.dirty&132&&n(9,d=l.map(C=>p.filter(R=>R.model===C))),e.$$.dirty&8&&n(8,g=s.domain().length>10?s.domain().filter((C,R)=>R%2===0):s.domain())},[m,_,l,s,a,r,o,p,g,d,c,f,v,y,u,w,S,M,$,F]}class Rp extends ce{constructor(t){super(),de(this,t,$p,Cp,fe,{})}}function jr(e,t,n){const l=e.slice();return l[13]=t[n],l[15]=n,l}function xr(e,t,n){const l=e.slice();return l[16]=t[n],l}function Ur(e,t,n){const l=e.slice();return l[16]=t[n],l}function Wr(e){let t,n,l=e[16]+"",o,r;return{c(){t=G("g"),n=G("text"),o=q(l),h(n,"class","axis-text svelte-1y9gffu"),h(n,"x","-5"),h(n,"y","0"),h(n,"text-anchor","end"),h(t,"transform",r=`translate(${e[9].left} ${e[8](e[16])+e[8].bandwidth()/2})`)},m(s,u){T(s,t,u),b(t,n),b(n,o)},p(s,u){u&4&&l!==(l=s[16]+"")&&K(o,l),u&260&&r!==(r=`translate(${s[9].left} ${s[8](s[16])+s[8].bandwidth()/2})`)&&h(t,"transform",r)},d(s){s&&P(t)}}}function Xr(e){let t,n,l=e[16]+"",o,r;return{c(){t=G("g"),n=G("text"),o=q(l),h(n,"class","axis-text svelte-1y9gffu"),h(n,"y","15"),h(n,"text-anchor","middle"),h(t,"transform",r=`translate(${e[7](e[16])}, ${e[4]-e[9].bottom})`)},m(s,u){T(s,t,u),b(t,n),b(n,o)},p(s,u){u&128&&l!==(l=s[16]+"")&&K(o,l),u&144&&r!==(r=`translate(${s[7](s[16])}, ${s[4]-s[9].bottom})`)&&h(t,"transform",r)},d(s){s&&P(t)}}}function Yr(e){let t,n=e[16]%2==0&&Xr(e);return{c(){n&&n.c(),t=Se()},m(l,o){n&&n.m(l,o),T(l,t,o)},p(l,o){l[16]%2==0?n?n.p(l,o):(n=Xr(l),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},d(l){n&&n.d(l),l&&P(t)}}}function Qr(e){let t,n,l,o,r,s,u,a=e[13].avgRank.toFixed(2)+"",f,c,d;return{c(){t=G("rect"),u=G("text"),f=q(a),h(t,"y",n=e[8](e[13].model)),h(t,"x",e[9].left),h(t,"width",l=e[7](e[13].avgRank)-e[9].left),h(t,"height",o=e[8].bandwidth()),h(t,"fill",r=e[6](e[13].model)),h(t,"class","model-path"),h(t,"data-model",s=e[5][e[15]]),h(u,"class","label-text svelte-1y9gffu"),h(u,"y",c=e[8](e[13].model)+e[8].bandwidth()/2),h(u,"x",d=e[7](e[13].avgRank)+5),h(u,"text-anchor","start"),h(u,"dominant-baseline","middle")},m(g,p){T(g,t,p),T(g,u,p),b(u,f)},p(g,p){p&260&&n!==(n=g[8](g[13].model))&&h(t,"y",n),p&132&&l!==(l=g[7](g[13].avgRank)-g[9].left)&&h(t,"width",l),p&256&&o!==(o=g[8].bandwidth())&&h(t,"height",o),p&68&&r!==(r=g[6](g[13].model))&&h(t,"fill",r),p&32&&s!==(s=g[5][g[15]])&&h(t,"data-model",s),p&4&&a!==(a=g[13].avgRank.toFixed(2)+"")&&K(f,a),p&260&&c!==(c=g[8](g[13].model)+g[8].bandwidth()/2)&&h(u,"y",c),p&132&&d!==(d=g[7](g[13].avgRank)+5)&&h(u,"x",d)},d(g){g&&P(t),g&&P(u)}}}function Ap(e){let t,n,l,o,r,s,u,a,f,c,d,g,p=e[2].map(Kr),m=[];for(let S=0;Se[12].call(t))},m(S,M){T(S,t,M),b(t,n);for(let $=0;$e.model;function Mp(e,t,n){let l,o,r,s,u,a,f,c,d;ue(e,ln,v=>n(11,d=v));let g=300,p=500,m={top:50,bottom:0,left:100,right:0};function _(){p=this.offsetWidth,g=this.offsetHeight,n(1,p),n(0,g)}return e.$$.update=()=>{e.$$.dirty&2048&&n(10,l=d.reduce((v,y)=>(v[y.model]?(v[y.model].sum+=y.rank,v[y.model].count++):v[y.model]={sum:y.rank,count:1},v),{})),e.$$.dirty&1024&&n(2,o=Object.keys(l).map(v=>({model:v,avgRank:l[v].sum/l[v].count}))),e.$$.dirty&2&&n(3,r=p-m.left-m.right),e.$$.dirty&1&&n(4,s=g-m.top-m.bottom),e.$$.dirty&20&&n(8,u=Lt().rangeRound([m.top,s-m.bottom]).padding(.05).domain(o.map(v=>v.model))),e.$$.dirty&12&&n(7,a=We().rangeRound([m.left,r-m.right]).domain([0,mt(o,v=>v.avgRank)])),e.$$.dirty&4&&n(6,f=Mt().domain(o.map(v=>v.model)).range(["#FF5470","#1B2D45","#00EBC7","#FDE24F"])),e.$$.dirty&2048&&n(5,c=Array.from(new Set(d.map(v=>v.model))))},[g,p,o,r,s,c,f,a,u,m,l,d,_]}class Ep extends ce{constructor(t){super(),de(this,t,Mp,Ap,fe,{})}}function Jr(e,t,n){const l=e.slice();return l[20]=t[n],l[22]=n,l}function Zr(e,t,n){const l=e.slice();return l[23]=t[n],l[25]=n,l}function es(e,t,n){const l=e.slice();return l[23]=t[n],l}function ts(e){let t,n=e[23].key+"",l,o,r;function s(){return e[10](e[23])}return{c(){t=A("th"),l=q(n),h(t,"class","svelte-owgjbp")},m(u,a){T(u,t,a),b(t,l),o||(r=x(t,"click",s),o=!0)},p(u,a){e=u,a&64&&n!==(n=e[23].key+"")&&K(l,n)},d(u){u&&P(t),o=!1,r()}}}function ns(e,t){let n,l=(t[20][t[23].key].length>os&&t[4]!==`${t[22]}-${t[25]}`?`${t[20][t[23].key].substring(0,40)}...`:t[20][t[23].key])+"",o,r,s,u;function a(){return t[11](t[22],t[25])}return{key:e,first:null,c(){n=A("td"),o=q(l),h(n,"class",r="cell-type-"+t[23].type+" svelte-owgjbp"),Ae(n,"background",t[23].key==="change"?t[7](t[20][t[23].key]):"none"),Pt(n,"active",t[4]===`${t[22]}-${t[25]}`),this.first=n},m(f,c){T(f,n,c),b(n,o),s||(u=x(n,"click",a),s=!0)},p(f,c){t=f,c&112&&l!==(l=(t[20][t[23].key].length>os&&t[4]!==`${t[22]}-${t[25]}`?`${t[20][t[23].key].substring(0,40)}...`:t[20][t[23].key])+"")&&K(o,l),c&64&&r!==(r="cell-type-"+t[23].type+" svelte-owgjbp")&&h(n,"class",r),c&96&&Ae(n,"background",t[23].key==="change"?t[7](t[20][t[23].key]):"none"),c&80&&Pt(n,"active",t[4]===`${t[22]}-${t[25]}`)},d(f){f&&P(n),s=!1,u()}}}function ls(e){let t,n=[],l=new Map,o,r=e[6];const s=u=>u[23].key;for(let u=0;un(9,s=M));let u={};const a=vt(".2f");function f(M){let $=M.reduce((C,R)=>(C[R.model]||(C[R.model]=[]),C[R.model].push(R.rank),C),{});return Object.entries($).map(([C,R])=>{let k=R.reduce((I,D)=>(I[D]=(I[D]||0)+1,I),{}),E=Object.entries(k).reduce((I,D)=>D[1]>I[1]?D:I)[0];return{model:C,overall_rank:Number(E),average_rank:a(kh(R)),standard_deviation_rank:a(sh(R))}})}u={...{columns:{},style:"normal",paged:25},...u};const d=We().domain([-1,0,1]).range(["#FF5470","#f8f8f8","#00ebc7"]);let{sortable:g,index:p,paged:m}=u,_,v=!0;if(g&&p)throw new Error("A table can either be ranked or sortable, but not both");p=1,g=1;let y=null;const w=M=>{g&&(_===M.key&&n(2,v=!v),n(1,_=M.key))},S=(M,$)=>{n(4,y=y===`${M}-${$}`?null:`${M}-${$}`)};return e.$$.update=()=>{if(e.$$.dirty&512,e.$$.dirty&512&&n(8,l=f(s)),e.$$.dirty&774){_&&n(8,l=l.slice().sort(($,F)=>{let C=$[_],R=F[_];if(C==R)return JSON.stringify($).localeCompare(JSON.stringify(F));let k=C>R?1:C{const $=u.columns[M]||{};return{key:M,type:$.type||typeof l[0][M],options:$}}))},n(5,r=[]),[u,_,v,g,y,r,o,d,l,s,w,S]}let Np=class extends ce{constructor(t){super(),de(this,t,Ip,Fp,fe,{})}};function is(e,t,n){const l=e.slice();return l[19]=t[n],l}function rs(e,t,n){const l=e.slice();return l[22]=t[n],l}function ss(e,t,n){const l=e.slice();return l[25]=t[n],l[27]=n,l}function as(e){let t,n=e[25]+"",l,o,r,s=e[25]+"",u,a;return{c(){t=G("text"),l=q(n),r=G("text"),u=q(s),h(t,"class","axis-text svelte-t6wv8i"),h(t,"x",o=e[7].left+e[5](e[25])+e[5].bandwidth()/2),h(t,"y",e[7].top-10),h(t,"text-anchor","middle"),h(r,"class","axis-text svelte-t6wv8i"),h(r,"x",e[7].left-10),h(r,"y",a=e[7].top+e[4](e[25])+e[4].bandwidth()/2),h(r,"text-anchor","end"),h(r,"dominant-baseline","middle")},m(f,c){T(f,t,c),b(t,l),T(f,r,c),b(r,u)},p(f,c){c&8&&n!==(n=f[25]+"")&&K(l,n),c&40&&o!==(o=f[7].left+f[5](f[25])+f[5].bandwidth()/2)&&h(t,"x",o),c&8&&s!==(s=f[25]+"")&&K(u,s),c&24&&a!==(a=f[7].top+f[4](f[25])+f[4].bandwidth()/2)&&h(r,"y",a)},d(f){f&&P(t),f&&P(r)}}}function us(e){let t,n,l,o,r,s,u,a,f=e[6](e[2][e[19]][e[22]])+"",c,d,g,p;return{c(){t=G("rect"),a=G("text"),c=q(f),h(t,"x",n=e[7].left+e[5](e[22])),h(t,"y",l=e[7].top+e[4](e[19])),h(t,"width",o=e[5].bandwidth()),h(t,"height",r=e[4].bandwidth()),h(t,"fill",s=e[8](e[19],e[22])),h(t,"rx","4"),h(t,"ry","4"),h(t,"class","model-path"),h(t,"data-model",u=e[19]),h(a,"x",d=e[7].left+e[5](e[22])+e[5].bandwidth()/2),h(a,"y",g=e[7].top+e[4](e[19])+e[4].bandwidth()/2),h(a,"text-anchor","middle"),h(a,"dominant-baseline","middle"),h(a,"class","model-path"),h(a,"data-model",p=e[19])},m(m,_){T(m,t,_),T(m,a,_),b(a,c)},p(m,_){_&40&&n!==(n=m[7].left+m[5](m[22]))&&h(t,"x",n),_&24&&l!==(l=m[7].top+m[4](m[19]))&&h(t,"y",l),_&32&&o!==(o=m[5].bandwidth())&&h(t,"width",o),_&16&&r!==(r=m[4].bandwidth())&&h(t,"height",r),_&8&&s!==(s=m[8](m[19],m[22]))&&h(t,"fill",s),_&8&&u!==(u=m[19])&&h(t,"data-model",u),_&12&&f!==(f=m[6](m[2][m[19]][m[22]])+"")&&K(c,f),_&40&&d!==(d=m[7].left+m[5](m[22])+m[5].bandwidth()/2)&&h(a,"x",d),_&24&&g!==(g=m[7].top+m[4](m[19])+m[4].bandwidth()/2)&&h(a,"y",g),_&8&&p!==(p=m[19])&&h(a,"data-model",p)},d(m){m&&P(t),m&&P(a)}}}function fs(e){let t,n=e[3],l=[];for(let o=0;oe[16].call(t))},m(g,p){T(g,t,p),b(t,n);for(let m=0;mn(15,p=$));const m=vt(".1f");function _($){let F=$.reduce((k,E)=>(k[E.qid]||(k[E.qid]=[]),k[E.qid].push(E),k),{}),C=Array.from(new Set($.map(k=>k.model))),R=C.reduce((k,E)=>(k[E]=C.reduce((I,D)=>(I[D]={sum:0,count:0},I),{}),k),{});for(let k in F){let E=F[k];for(let I of C)for(let D of C){let L=E.find(B=>B.model===I),O=E.find(B=>B.model===D);L&&O&&(R[I][D].sum+=O.rank-L.rank,R[I][D].count++)}}for(let k in R)for(let E in R[k])R[k][E].count>0?R[k][E]=R[k][E].sum/R[k][E].count:R[k][E]=0;return R}let v=500,y=500,w={top:50,bottom:0,left:65,right:25};function S($,F){let C=l[$][F];return C===0?"white":C>=0?g($):g(F)}function M(){y=this.offsetWidth,v=this.offsetHeight,n(1,y),n(0,v)}return e.$$.update=()=>{e.$$.dirty&32768&&n(2,l=_(p)),e.$$.dirty&32768&&n(3,o=Array.from(new Set(p.map($=>$.model)))),e.$$.dirty&2&&n(14,r=y-w.left-w.right),e.$$.dirty&1&&n(13,s=v-w.top-w.bottom),e.$$.dirty&16392&&n(5,u=Lt().range([0,r]).domain(o).padding(.05)),e.$$.dirty&8200&&n(4,a=Lt().range([0,s]).domain(o).padding(.05)),e.$$.dirty&4&&n(12,f=Object.values(l).flatMap($=>Object.values($))),e.$$.dirty&4096&&n(11,c=so(f)),e.$$.dirty&4096&&n(10,d=mt(f)),e.$$.dirty&8&&n(9,g=Mt().domain(o).range(["#FF5470","#1B2D45","#00EBC7","#FDE24F"])),e.$$.dirty&3592&&o.reduce(($,F)=>($[F]=qa().domain([c,d]).interpolator(uo("white",g(F))),$),{})},[v,y,l,o,a,u,m,w,S,g,d,c,f,s,r,p,M]}class Op extends ce{constructor(t){super(),de(this,t,Tp,Pp,fe,{})}}function cs(e,t,n){const l=e.slice();return l[7]=t[n],l[9]=n,l}function Vp(e){let t;return{c(){t=A("div"),t.innerHTML="
To view the comparison dashboard, you must first rank some comparisons!
",h(t,"class","holder svelte-7imt18")},m(n,l){T(n,t,l)},p:U,i:U,o:U,d(n){n&&P(t)}}}function zp(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m,_,v,y,w,S,M,$,F=e[1],C=[];for(let R=0;R0?0:1}return n=u(e),l=s[n]=r[n](e),{c(){t=A("div"),l.c(),h(t,"class","main-container svelte-7imt18")},m(a,f){T(a,t,f),s[n].m(t,null),o=!0},p(a,[f]){let c=n;n=u(a),n===c?s[n].p(a,f):(we(),z(s[c],1,1,()=>{s[c]=null}),ye(),l=s[n],l?l.p(a,f):(l=s[n]=r[n](a),l.c()),V(l,1),l.m(t,null))},i(a){o||(V(l),o=!0)},o(a){z(l),o=!1},d(a){a&&P(t),s[n].d()}}}function hs(){document.querySelectorAll(".model-path, .model-path-outer, .model-circle").forEach(e=>{e.style.opacity=1})}function qp(e,t,n){let l,o,r;ue(e,ln,c=>n(0,r=c));async function s(){const d=await(await fetch("/chat/comparator/db/retrieve")).json();console.log("uploooo",d);const p=d.data.map(m=>({model:m.model,answer:m.answer,qid:parseInt(m.qid),rank:parseInt(m.rank)}));Pe(ln,r=[...p],r)}ft(()=>{s()});function u(c){document.querySelectorAll(".model-path, .model-path-outer, .model-circle").forEach(d=>{d.style.opacity=.12}),document.querySelectorAll(`.model-path[data-model="${l[c]}"], .model-circle[data-model="${l[c]}"]`).forEach(d=>{d.style.opacity=1})}const a=c=>u(c),f=c=>u(c);return e.$$.update=()=>{e.$$.dirty&1&&n(1,l=Array.from(new Set(r.map(c=>c.model)))),e.$$.dirty&1&&n(2,o=Mt().domain(r.map(c=>c.model)).range(["#FF5470","#1B2D45","#00EBC7","#FDE24F","red"]))},[r,l,o,u,a,f]}class Hp extends ce{constructor(t){super(),de(this,t,qp,Lp,fe,{})}}function Gp(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return cu(this.cover(t,n),t,n,e)}function cu(e,t,n,l){if(isNaN(t)||isNaN(n))return e;var o,r=e._root,s={data:l},u=e._x0,a=e._y0,f=e._x1,c=e._y1,d,g,p,m,_,v,y,w;if(!r)return e._root=s,e;for(;r.length;)if((_=t>=(d=(u+f)/2))?u=d:f=d,(v=n>=(g=(a+c)/2))?a=g:c=g,o=r,!(r=r[y=v<<1|_]))return o[y]=s,e;if(p=+e._x.call(null,r.data),m=+e._y.call(null,r.data),t===p&&n===m)return s.next=r,o?o[y]=s:e._root=s,e;do o=o?o[y]=new Array(4):e._root=new Array(4),(_=t>=(d=(u+f)/2))?u=d:f=d,(v=n>=(g=(a+c)/2))?a=g:c=g;while((y=v<<1|_)===(w=(m>=g)<<1|p>=d));return o[w]=r,o[y]=s,e}function Bp(e){var t,n,l=e.length,o,r,s=new Array(l),u=new Array(l),a=1/0,f=1/0,c=-1/0,d=-1/0;for(n=0;nc&&(c=o),rd&&(d=r));if(a>c||f>d)return this;for(this.cover(a,f).cover(c,d),n=0;ne||e>=o||l>t||t>=r;)switch(f=(tc||(u=m.y0)>d||(a=m.x1)=y)<<1|e>=v)&&(m=g[g.length-1],g[g.length-1]=g[g.length-1-_],g[g.length-1-_]=m)}else{var w=e-+this._x.call(null,p.data),S=t-+this._y.call(null,p.data),M=w*w+S*S;if(M=(g=(s+a)/2))?s=g:a=g,(_=d>=(p=(u+f)/2))?u=p:f=p,t=n,!(n=n[v=_<<1|m]))return this;if(!n.length)break;(t[v+1&3]||t[v+2&3]||t[v+3&3])&&(l=t,y=v)}for(;n.data!==e;)if(o=n,!(n=n.next))return this;return(r=n.next)&&delete n.next,o?(r?o.next=r:delete o.next,this):t?(r?t[v]=r:delete t[v],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(l?l[y]=n:this._root=n),this):(this._root=r,this)}function Yp(e){for(var t=0,n=e.length;tg.index){var I=p-R.x-R.vx,D=m-R.y-R.vy,L=I*I+D*D;Lp+E||Fm+E||Cf.r&&(f.r=f[c].r)}function a(){if(t){var f,c=t.length,d;for(n=new Array(c),f=0;f{}};function hu(){for(var e=0,t=arguments.length,n={},l;e=0&&(l=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:l}})}nl.prototype=hu.prototype={constructor:nl,on:function(e,t){var n=this._,l=am(e+"",n),o,r=-1,s=l.length;if(arguments.length<2){for(;++r0)for(var n=new Array(o),l=0,o,r;l=0&&e._call.call(void 0,t),e=e._next;--on}function _s(){qt=(yl=In.now())+Ml,on=pn=0;try{cm()}finally{on=0,hm(),qt=0}}function dm(){var e=In.now(),t=e-yl;t>gu&&(Ml-=t,yl=e)}function hm(){for(var e,t=wl,n,l=1/0;t;)t._call?(l>t._time&&(l=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:wl=n);mn=e,ko(l)}function ko(e){if(!on){pn&&(pn=clearTimeout(pn));var t=e-qt;t>24?(e<1/0&&(pn=setTimeout(_s,e-In.now()-Ml)),fn&&(fn=clearInterval(fn))):(fn||(yl=In.now(),fn=setInterval(dm,gu)),on=1,pu(_s))}}const gm=1664525,pm=1013904223,vs=4294967296;function mm(){let e=1;return()=>(e=(gm*e+pm)%vs)/vs}var _m=10,vm=Math.PI*(3-Math.sqrt(5));function bm(e){var t,n=1,l=.001,o=1-Math.pow(l,1/300),r=0,s=.6,u=new Map,a=_u(d),f=hu("tick","end"),c=mm();e==null&&(e=[]);function d(){g(),f.call("tick",t),n1?(v==null?u.delete(_):u.set(_,m(v)),t):u.get(_)},find:function(_,v,y){var w=0,S=e.length,M,$,F,C,R;for(y==null?y=1/0:y*=y,w=0;w1?(f.on(_,v),t):f.on(_)}}}function wm(e){var t=ot(.1),n,l,o;typeof e!="function"&&(e=ot(e==null?0:+e));function r(u){for(var a=0,f=n.length,c;ae[4]?1:0),h(t,"class",p="file-circle-g "+(e[20].size>e[4]?"large":"")+" svelte-h2ab3o"),h(t,"style",m=e[5](e[20].x,e[20].y)),h(t,"role","img")},m(w,S){T(w,t,S),b(t,n),b(t,r),b(r,u),b(r,a),b(a,c),_=!0,v||(y=[x(t,"mouseover",e[6]),x(t,"mouseout",e[7]),x(t,"focus",e[6]),x(t,"blur",e[7])],v=!0)},p(w,S){(!_||S&12&&l!==(l=w[3](w[20].size)))&&h(n,"r",l),(!_||S&4)&&s!==(s=w[20].file+"")&&K(u,s),(!_||S&4)&&f!==(f=ro(w[20].size)+"")&&K(c,f),(!_||S&20&&d!==(d=w[20].size>w[4]?1:0))&&h(r,"opacity",d),(!_||S&20&&p!==(p="file-circle-g "+(w[20].size>w[4]?"large":"")+" svelte-h2ab3o"))&&h(t,"class",p),(!_||S&4&&m!==(m=w[5](w[20].x,w[20].y)))&&h(t,"style",m)},i(w){_||(w&&Me(()=>{_&&(o||(o=lt(n,Ln,{duration:1e3},!0)),o.run(1))}),w&&Me(()=>{_&&(g||(g=lt(r,Ln,{duration:1e3},!0)),g.run(1))}),_=!0)},o(w){w&&(o||(o=lt(n,Ln,{duration:1e3},!1)),o.run(0)),w&&(g||(g=lt(r,Ln,{duration:1e3},!1)),g.run(0)),_=!1},d(w){w&&P(t),w&&o&&o.end(),w&&g&&g.end(),v=!1,be(y)}}}function km(e){let t,n,l,o,r=e[2],s=[];for(let a=0;az(s[a],1,1,()=>{s[a]=null});return{c(){t=A("div"),n=G("svg");for(let a=0;ae[15].call(t))},m(a,f){T(a,t,f),b(t,n);for(let c=0;cn(14,c=$));let d=600,g=350,p=!0,m=!1;const _=($,F)=>`transform: translate(${$}px, ${F}px)`,v=[-4,4],y=[-1,1];function w(){n(8,p=!0),n(9,m=!0);const $=pt(this);Nl(".file-circle-g").select("text").style("opacity",0),$.raise(),$.select("circle").attr("fill","var(--red)"),$.select("text").style("opacity",1)}const S=()=>{const $=Nl(".file-circle-g");$.select("circle").attr("fill","var(--yellow)"),$.select("text").style("opacity",0),n(9,m=!1),setTimeout(()=>{n(8,p=!1)},1e3)};function M(){d=this.offsetWidth,g=this.offsetHeight,n(0,d),n(1,g)}return e.$$.update=()=>{e.$$.dirty&16387&&n(2,l=c.map($=>({...$,x:d/2,y:g/2,tickCount:0}))),e.$$.dirty&16384&&console.log(c.map($=>$.size).sort(($,F)=>$-F)),e.$$.dirty&1&&n(13,o=wm().x(d/2)),e.$$.dirty&2&&n(12,r=ym().y(g/2)),e.$$.dirty&16384&&n(3,a=We().domain(_n(c,$=>$.size)).range([12,60])),e.$$.dirty&8&&n(10,s=rm().radius($=>a($.size)+1).iterations(3)),e.$$.dirty&16384&&n(4,u=yh(c.map($=>$.size).sort(($,F)=>$-F),.85)),e.$$.dirty&1&&We().domain(v).range([5,d]),e.$$.dirty&2&&We().domain(y).range([g,5]),e.$$.dirty&4&&n(11,f=bm().nodes(l).on("tick",()=>{n(2,l=[...l])})),e.$$.dirty&15360&&(f.force("x",o),f.force("y",r),f.force("collide",s),f.alpha(.02),f.restart()),e.$$.dirty&19468&&(a.domain(_n(c,$=>$.size)),l.forEach($=>$.radius=a($.size)),f.nodes(l),s.radius($=>$.radius+.5)),e.$$.dirty&768&&p===!1&&(m||Nl(".large").select("text").style("opacity",1))},[d,g,l,a,u,_,w,S,p,m,s,f,r,o,c,M]}class Cm extends ce{constructor(t){super(),de(this,t,Sm,km,fe,{})}}/** + rank for each via the corresponding dropdown.`,d=P(),p=A("br"),g=P(),m=A("button"),m.textContent="Download Data",_=P(),v=A("div"),y=A("section"),w=A("div");for(let X=0;Xn=!1)),t.$set(le),Y&3463&&(W=X[8],S=gt(S,Y,Q,1,X,W,M,w,Lt,Or,null,Dr)),Y&8&&R.value!==X[3]&&Ye(R,X[3]),(!O||Y&80)&&I!==(I=(X[4]?X[6]:"Send")+"")&&K(D,I),(!O||Y&8&&L!==(L="btnyousend "+(X[3]===""?"":"active")+" svelte-1nj8mt0"))&&h(E,"class",L)},i(X){O||(V(t.$$.fragment,X),O=!0)},o(X){z(t.$$.fragment,X),O=!1},d(X){te(t,X),X&&N(l),X&&N(o);for(let Y=0;Y{e.scrollIntoView({behavior:"smooth"})},0)}async function Vr(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 l=await n.text();alert(l)}}function $p(e,t,n){let l,o,r;ue(e,fn,k=>n(8,r=k));let{numModels:s=1}=t,{models:u=[0]}=t,a="",f="",c=!1,d=!1;ft(async()=>{if(await new Promise(k=>setTimeout(k,200)),_){const k=new J(_,{animation:150,onUpdate(E){k.toArray()}});k.toArray()}p()});async function p(){const E=await(await fetch("/chat/comparator/db/retrieve")).json();console.log(E);const I=E.data;let D={},L=new Set;for(const O of I)L.add(O.model),D[O.qid]||(D[O.qid]={},D[O.qid].qid=O.qid,D[O.qid].question=O.question),D[O.qid][O.model]=O.answer,console.log(D);n(1,u=Array.from(L)),n(0,s=u.length),console.log(Object.values(D)),De(fn,r=[...Object.values(D)],r)}const g=async k=>{k.preventDefault(),a=f,n(3,f=""),n(4,c=!0);let E={question:a};for(let D of u)E[D]="Loading...";De(fn,r=[...r,E],r),console.log("compare chat log",fn);const I=await fetch(`/chat/comparator/${a}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:a})});if(I.ok){const D=await I.json();n(1,u=Object.keys(D.answer)),n(0,s=u.length);for(let L of u)E[L]=D.answer[L];E.qid=D.qid,fn.update(L=>(L[L.length-1]=E,L))}else{const D=await I.text();alert(D)}n(4,c=!1)};let m=0;setInterval(()=>{n(13,m=(m+1)%4)},200);let _,v;function y(k,E){const I=E,L=pt(k.currentTarget.parentNode).selectAll("div.answer").nodes().map(ae=>ae.id);L.forEach((ae,pe)=>{pt(`#${ae}`).select(".answer-rank").property("value",pe+1)});let O=[];for(let[ae,pe]of L.entries()){const W=parseInt(pe.split("-")[1]),Q=u[W],X={rank:ae,model:Q};O.push(X)}let B=r.filter(ae=>ae.qid===I),j=[];for(let ae of O){const pe={model:ae.model,qid:parseInt(I),rank:parseInt(ae.rank)+1,answer:B[0][ae.model]};j.push(pe)}Vr(j)}function w(k,E,I){const D=E,L=parseInt(k.target.value),O=u[I],B={qid:D,rank:parseInt(L),model:O};let j=[],pe=r.filter(Q=>Q.qid===B.qid)[0][B.model];const W={model:B.model,qid:parseInt(B.qid),rank:parseInt(B.rank),answer:pe};j.push(W),Vr(j)}function S(){n(5,d=!0)}function M(k){d=k,n(5,d)}const $=(k,E,I)=>w(I,k.qid,E),F=(k,E)=>y(E,k.qid);function C(k){et[k?"unshift":"push"](()=>{_=k,n(2,_)})}function R(){f=this.value,n(3,f)}return e.$$set=k=>{"numModels"in k&&n(0,s=k.numModels),"models"in k&&n(1,u=k.models)},e.$$.update=()=>{e.$$.dirty&1&&n(7,l="1fr ".repeat(s).trim()),e.$$.dirty&8192&&n(6,o=".".repeat(m).padEnd(3)),e.$$.dirty&16388&&_&&(n(14,v=new J(_,{animation:150,dataIdAttr:"id",onUpdate(k){v.toArray()}})),v.toArray())},[s,u,_,f,c,d,o,l,r,g,y,w,S,m,v,M,$,F,C,R]}class Ap extends ce{constructor(t){super(),de(this,t,$p,Sp,fe,{numModels:0,models:1})}}const rn=Ie([{model:"llama",qid:1,rank:1,answer:"Llama's first unique answer."},{model:"gpt3.5",qid:1,rank:2,answer:"GPT-3.5's first unique answer."},{model:"gpt4",qid:1,rank:3,answer:"GPT-4's first unique answer."},{model:"claude",qid:1,rank:4,answer:"Claude's first unique answer."},{model:"llama",qid:2,rank:4,answer:"Llama's second unique answer."},{model:"gpt3.5",qid:2,rank:2,answer:"GPT-3.5's second unique answer."},{model:"gpt4",qid:2,rank:4,answer:"GPT-4's second unique answer."},{model:"claude",qid:2,rank:3,answer:"'s second unique answer."}]);function zr(e,t,n){const l=e.slice();return l[20]=t[n],l}function Lr(e,t,n){const l=e.slice();return l[20]=t[n],l[24]=n,l}function qr(e,t,n){const l=e.slice();return l[25]=t[n],l}function Hr(e){let t,n,l,o,r=`Q.${e[25]}`,s,u;return{c(){t=G("g"),n=G("line"),o=G("text"),s=q(r),h(n,"class","axis-tick svelte-1nna9rx"),h(n,"x1","0"),h(n,"x2","0"),h(n,"y1",0),h(n,"y2",l=-e[5]+e[12].bottom+e[12].top),h(n,"stroke","black"),h(n,"stroke-dasharray","4"),h(o,"class","axis-text svelte-1nna9rx"),h(o,"y","15"),h(o,"text-anchor","middle"),h(t,"transform",u=`translate(${e[3](e[25])+0} ${e[5]-e[12].bottom})`),h(t,"class","svelte-1nna9rx")},m(a,f){T(a,t,f),b(t,n),b(t,o),b(o,s)},p(a,f){f&32&&l!==(l=-a[5]+a[12].bottom+a[12].top)&&h(n,"y2",l),f&256&&r!==(r=`Q.${a[25]}`)&&K(s,r),f&296&&u!==(u=`translate(${a[3](a[25])+0} ${a[5]-a[12].bottom})`)&&h(t,"transform",u)},d(a){a&&N(t)}}}function Gr(e){let t=Number.isInteger(e[25]),n,l=t&&Hr(e);return{c(){l&&l.c(),n=Se()},m(o,r){l&&l.m(o,r),T(o,n,r)},p(o,r){r&256&&(t=Number.isInteger(o[25])),t?l?l.p(o,r):(l=Hr(o),l.c(),l.m(n.parentNode,n)):l&&(l.d(1),l=null)},d(o){l&&l.d(o),o&&N(n)}}}function Br(e,t){let n,l,o,r,s,u,a,f,c;function d(){return t[15](t[24])}function p(){return t[16](t[24])}return{key:e,first:null,c(){n=G("path"),r=G("path"),h(n,"class","model-path-outer svelte-1nna9rx"),h(n,"d",l=t[10](t[20])),h(n,"stroke","white"),h(n,"data-model",o=t[2][t[24]]),h(r,"class","model-path svelte-1nna9rx"),h(r,"d",s=t[10](t[20])),h(r,"role","img"),h(r,"stroke",u=t[11](t[2][t[24]])),h(r,"data-model",a=t[2][t[24]]),this.first=n},m(g,m){T(g,n,m),T(g,r,m),f||(c=[x(r,"mouseover",d),x(r,"focus",p),x(r,"mouseout",wl),x(r,"blur",wl)],f=!0)},p(g,m){t=g,m&1536&&l!==(l=t[10](t[20]))&&h(n,"d",l),m&516&&o!==(o=t[2][t[24]])&&h(n,"data-model",o),m&1536&&s!==(s=t[10](t[20]))&&h(r,"d",s),m&2564&&u!==(u=t[11](t[2][t[24]]))&&h(r,"stroke",u),m&516&&a!==(a=t[2][t[24]])&&h(r,"data-model",a)},d(g){g&&N(n),g&&N(r),f=!1,ve(c)}}}function jr(e,t){let n,l,o,r,s,u,a=t[20].rank+"",f,c,d,p;return{key:e,first:null,c(){n=G("g"),l=G("circle"),u=G("text"),f=q(a),h(l,"r",o=t[20].answer.length/2*0+12),h(l,"fill",r=t[11](t[20].model)),h(l,"stroke","white"),h(l,"class","model-circle svelte-1nna9rx"),h(l,"role","img"),h(l,"data-model",s=t[20].model),h(u,"class","bump-text svelte-1nna9rx"),h(u,"text-anchor","middle"),h(u,"alignment-baseline","middle"),h(u,"color","white"),h(u,"fill","white"),h(n,"transform",c=`translate(${t[3](t[20].qid)}, ${t[4](t[20].rank)})`),h(n,"class","svelte-1nna9rx"),this.first=n},m(g,m){T(g,n,m),b(n,l),b(n,u),b(u,f),d||(p=[x(l,"mouseover",t[17]),x(l,"focus",t[18]),x(l,"mouseout",wl),x(l,"blur",wl)],d=!0)},p(g,m){t=g,m&128&&o!==(o=t[20].answer.length/2*0+12)&&h(l,"r",o),m&2176&&r!==(r=t[11](t[20].model))&&h(l,"fill",r),m&128&&s!==(s=t[20].model)&&h(l,"data-model",s),m&128&&a!==(a=t[20].rank+"")&&K(f,a),m&152&&c!==(c=`translate(${t[3](t[20].qid)}, ${t[4](t[20].rank)})`)&&h(n,"transform",c)},d(g){g&&N(n),d=!1,ve(p)}}}function Rp(e){let t,n,l,o,r,s,u,a,f,c,d,p,g,m=[],_=new Map,v,y=[],w=new Map,S,M,$,F,C,R=e[8],k=[];for(let O=0;OO[24];for(let O=0;OO[20].model+O[20].qid;for(let O=0;Oe[19].call(t))},m(O,B){T(O,t,B),b(t,n),b(n,l);for(let j=0;j{e.style.opacity=1})}function Mp(e,t,n){let l,o,r,s,u,a,f,c,d,p,g;ue(e,rn,C=>n(7,g=C));let m,_,v={top:35,bottom:15,left:10,right:0};function y(C){document.querySelectorAll(".model-path, .model-path-outer, .model-circle").forEach(R=>{R.style.opacity=.12}),document.querySelectorAll(`.model-path[data-model="${l[C]}"], .model-circle[data-model="${l[C]}"]`).forEach(R=>{R.style.opacity=1})}const w=C=>y(C),S=C=>y(C),M=()=>y(i),$=()=>y(i);function F(){_=this.offsetWidth,m=this.offsetHeight,n(1,_),n(0,m)}return e.$$.update=()=>{e.$$.dirty&128&&n(2,l=Array.from(new Set(g.map(C=>C.model)))),e.$$.dirty&2&&n(6,o=_-v.left-v.right),e.$$.dirty&1&&n(5,r=m-v.top-v.bottom),e.$$.dirty&192&&n(3,s=Bi().domain(g.map(C=>C.qid)).padding(.3).range([v.left,o-v.right])),e.$$.dirty&128&&n(14,u=g.map(C=>C.rank).sort((C,R)=>C-R)),e.$$.dirty&16416&&n(4,a=Bi().domain(u).padding(1).range([v.top,r-v.bottom])),e.$$.dirty&128&&n(11,f=Mt().domain(g.map(C=>C.model)).range(["#FF5470","#1B2D45","#00EBC7","#FDE24F","red"])),e.$$.dirty&24&&n(10,c=Ag().x(C=>s(C.qid)).y(C=>a(C.rank))),e.$$.dirty&132&&n(9,d=l.map(C=>g.filter(R=>R.model===C))),e.$$.dirty&8&&n(8,p=s.domain().length>10?s.domain().filter((C,R)=>R%2===0):s.domain())},[m,_,l,s,a,r,o,g,p,d,c,f,v,y,u,w,S,M,$,F]}class Ep extends ce{constructor(t){super(),de(this,t,Mp,Rp,fe,{})}}function xr(e,t,n){const l=e.slice();return l[13]=t[n],l[15]=n,l}function Ur(e,t,n){const l=e.slice();return l[16]=t[n],l}function Wr(e,t,n){const l=e.slice();return l[16]=t[n],l}function Xr(e){let t,n,l=e[16]+"",o,r;return{c(){t=G("g"),n=G("text"),o=q(l),h(n,"class","axis-text svelte-1y9gffu"),h(n,"x","-5"),h(n,"y","0"),h(n,"text-anchor","end"),h(t,"transform",r=`translate(${e[9].left} ${e[8](e[16])+e[8].bandwidth()/2})`)},m(s,u){T(s,t,u),b(t,n),b(n,o)},p(s,u){u&4&&l!==(l=s[16]+"")&&K(o,l),u&260&&r!==(r=`translate(${s[9].left} ${s[8](s[16])+s[8].bandwidth()/2})`)&&h(t,"transform",r)},d(s){s&&N(t)}}}function Yr(e){let t,n,l=e[16]+"",o,r;return{c(){t=G("g"),n=G("text"),o=q(l),h(n,"class","axis-text svelte-1y9gffu"),h(n,"y","15"),h(n,"text-anchor","middle"),h(t,"transform",r=`translate(${e[7](e[16])}, ${e[4]-e[9].bottom})`)},m(s,u){T(s,t,u),b(t,n),b(n,o)},p(s,u){u&128&&l!==(l=s[16]+"")&&K(o,l),u&144&&r!==(r=`translate(${s[7](s[16])}, ${s[4]-s[9].bottom})`)&&h(t,"transform",r)},d(s){s&&N(t)}}}function Qr(e){let t,n=e[16]%2==0&&Yr(e);return{c(){n&&n.c(),t=Se()},m(l,o){n&&n.m(l,o),T(l,t,o)},p(l,o){l[16]%2==0?n?n.p(l,o):(n=Yr(l),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},d(l){n&&n.d(l),l&&N(t)}}}function Kr(e){let t,n,l,o,r,s,u,a=e[13].avgRank.toFixed(2)+"",f,c,d;return{c(){t=G("rect"),u=G("text"),f=q(a),h(t,"y",n=e[8](e[13].model)),h(t,"x",e[9].left),h(t,"width",l=e[7](e[13].avgRank)-e[9].left),h(t,"height",o=e[8].bandwidth()),h(t,"fill",r=e[6](e[13].model)),h(t,"class","model-path"),h(t,"data-model",s=e[5][e[15]]),h(u,"class","label-text svelte-1y9gffu"),h(u,"y",c=e[8](e[13].model)+e[8].bandwidth()/2),h(u,"x",d=e[7](e[13].avgRank)+5),h(u,"text-anchor","start"),h(u,"dominant-baseline","middle")},m(p,g){T(p,t,g),T(p,u,g),b(u,f)},p(p,g){g&260&&n!==(n=p[8](p[13].model))&&h(t,"y",n),g&132&&l!==(l=p[7](p[13].avgRank)-p[9].left)&&h(t,"width",l),g&256&&o!==(o=p[8].bandwidth())&&h(t,"height",o),g&68&&r!==(r=p[6](p[13].model))&&h(t,"fill",r),g&32&&s!==(s=p[5][p[15]])&&h(t,"data-model",s),g&4&&a!==(a=p[13].avgRank.toFixed(2)+"")&&K(f,a),g&260&&c!==(c=p[8](p[13].model)+p[8].bandwidth()/2)&&h(u,"y",c),g&132&&d!==(d=p[7](p[13].avgRank)+5)&&h(u,"x",d)},d(p){p&&N(t),p&&N(u)}}}function Fp(e){let t,n,l,o,r,s,u,a,f,c,d,p,g=e[2].map(Jr),m=[];for(let S=0;Se[12].call(t))},m(S,M){T(S,t,M),b(t,n);for(let $=0;$e.model;function Dp(e,t,n){let l,o,r,s,u,a,f,c,d;ue(e,rn,v=>n(11,d=v));let p=300,g=500,m={top:50,bottom:0,left:100,right:0};function _(){g=this.offsetWidth,p=this.offsetHeight,n(1,g),n(0,p)}return e.$$.update=()=>{e.$$.dirty&2048&&n(10,l=d.reduce((v,y)=>(v[y.model]?(v[y.model].sum+=y.rank,v[y.model].count++):v[y.model]={sum:y.rank,count:1},v),{})),e.$$.dirty&1024&&n(2,o=Object.keys(l).map(v=>({model:v,avgRank:l[v].sum/l[v].count}))),e.$$.dirty&2&&n(3,r=g-m.left-m.right),e.$$.dirty&1&&n(4,s=p-m.top-m.bottom),e.$$.dirty&20&&n(8,u=qt().rangeRound([m.top,s-m.bottom]).padding(.05).domain(o.map(v=>v.model))),e.$$.dirty&12&&n(7,a=We().rangeRound([m.left,r-m.right]).domain([0,mt(o,v=>v.avgRank)])),e.$$.dirty&4&&n(6,f=Mt().domain(o.map(v=>v.model)).range(["#FF5470","#1B2D45","#00EBC7","#FDE24F"])),e.$$.dirty&2048&&n(5,c=Array.from(new Set(d.map(v=>v.model))))},[p,g,o,r,s,c,f,a,u,m,l,d,_]}class Ip extends ce{constructor(t){super(),de(this,t,Dp,Fp,fe,{})}}function Zr(e,t,n){const l=e.slice();return l[20]=t[n],l[22]=n,l}function es(e,t,n){const l=e.slice();return l[23]=t[n],l[25]=n,l}function ts(e,t,n){const l=e.slice();return l[23]=t[n],l}function ns(e){let t,n=e[23].key+"",l,o,r;function s(){return e[10](e[23])}return{c(){t=A("th"),l=q(n),h(t,"class","svelte-owgjbp")},m(u,a){T(u,t,a),b(t,l),o||(r=x(t,"click",s),o=!0)},p(u,a){e=u,a&64&&n!==(n=e[23].key+"")&&K(l,n)},d(u){u&&N(t),o=!1,r()}}}function ls(e,t){let n,l=(t[20][t[23].key].length>is&&t[4]!==`${t[22]}-${t[25]}`?`${t[20][t[23].key].substring(0,40)}...`:t[20][t[23].key])+"",o,r,s,u;function a(){return t[11](t[22],t[25])}return{key:e,first:null,c(){n=A("td"),o=q(l),h(n,"class",r="cell-type-"+t[23].type+" svelte-owgjbp"),Re(n,"background",t[23].key==="change"?t[7](t[20][t[23].key]):"none"),Tt(n,"active",t[4]===`${t[22]}-${t[25]}`),this.first=n},m(f,c){T(f,n,c),b(n,o),s||(u=x(n,"click",a),s=!0)},p(f,c){t=f,c&112&&l!==(l=(t[20][t[23].key].length>is&&t[4]!==`${t[22]}-${t[25]}`?`${t[20][t[23].key].substring(0,40)}...`:t[20][t[23].key])+"")&&K(o,l),c&64&&r!==(r="cell-type-"+t[23].type+" svelte-owgjbp")&&h(n,"class",r),c&96&&Re(n,"background",t[23].key==="change"?t[7](t[20][t[23].key]):"none"),c&80&&Tt(n,"active",t[4]===`${t[22]}-${t[25]}`)},d(f){f&&N(n),s=!1,u()}}}function os(e){let t,n=[],l=new Map,o,r=e[6];const s=u=>u[23].key;for(let u=0;un(9,s=M));let u={};const a=vt(".2f");function f(M){let $=M.reduce((C,R)=>(C[R.model]||(C[R.model]=[]),C[R.model].push(R.rank),C),{});return Object.entries($).map(([C,R])=>{let k=R.reduce((I,D)=>(I[D]=(I[D]||0)+1,I),{}),E=Object.entries(k).reduce((I,D)=>D[1]>I[1]?D:I)[0];return{model:C,overall_rank:Number(E),average_rank:a($h(R)),standard_deviation_rank:a(fh(R))}})}u={...{columns:{},style:"normal",paged:25},...u};const d=We().domain([-1,0,1]).range(["#FF5470","#f8f8f8","#00ebc7"]);let{sortable:p,index:g,paged:m}=u,_,v=!0;if(p&&g)throw new Error("A table can either be ranked or sortable, but not both");g=1,p=1;let y=null;const w=M=>{p&&(_===M.key&&n(2,v=!v),n(1,_=M.key))},S=(M,$)=>{n(4,y=y===`${M}-${$}`?null:`${M}-${$}`)};return e.$$.update=()=>{if(e.$$.dirty&512,e.$$.dirty&512&&n(8,l=f(s)),e.$$.dirty&774){_&&n(8,l=l.slice().sort(($,F)=>{let C=$[_],R=F[_];if(C==R)return JSON.stringify($).localeCompare(JSON.stringify(F));let k=C>R?1:C{const $=u.columns[M]||{};return{key:M,type:$.type||typeof l[0][M],options:$}}))},n(5,r=[]),[u,_,v,p,y,r,o,d,l,s,w,S]}let Op=class extends ce{constructor(t){super(),de(this,t,Tp,Np,fe,{})}};function rs(e,t,n){const l=e.slice();return l[19]=t[n],l}function ss(e,t,n){const l=e.slice();return l[22]=t[n],l}function as(e,t,n){const l=e.slice();return l[25]=t[n],l[27]=n,l}function us(e){let t,n=e[25]+"",l,o,r,s=e[25]+"",u,a;return{c(){t=G("text"),l=q(n),r=G("text"),u=q(s),h(t,"class","axis-text svelte-t6wv8i"),h(t,"x",o=e[7].left+e[5](e[25])+e[5].bandwidth()/2),h(t,"y",e[7].top-10),h(t,"text-anchor","middle"),h(r,"class","axis-text svelte-t6wv8i"),h(r,"x",e[7].left-10),h(r,"y",a=e[7].top+e[4](e[25])+e[4].bandwidth()/2),h(r,"text-anchor","end"),h(r,"dominant-baseline","middle")},m(f,c){T(f,t,c),b(t,l),T(f,r,c),b(r,u)},p(f,c){c&8&&n!==(n=f[25]+"")&&K(l,n),c&40&&o!==(o=f[7].left+f[5](f[25])+f[5].bandwidth()/2)&&h(t,"x",o),c&8&&s!==(s=f[25]+"")&&K(u,s),c&24&&a!==(a=f[7].top+f[4](f[25])+f[4].bandwidth()/2)&&h(r,"y",a)},d(f){f&&N(t),f&&N(r)}}}function fs(e){let t,n,l,o,r,s,u,a,f=e[6](e[2][e[19]][e[22]])+"",c,d,p,g;return{c(){t=G("rect"),a=G("text"),c=q(f),h(t,"x",n=e[7].left+e[5](e[22])),h(t,"y",l=e[7].top+e[4](e[19])),h(t,"width",o=e[5].bandwidth()),h(t,"height",r=e[4].bandwidth()),h(t,"fill",s=e[8](e[19],e[22])),h(t,"rx","4"),h(t,"ry","4"),h(t,"class","model-path"),h(t,"data-model",u=e[19]),h(a,"x",d=e[7].left+e[5](e[22])+e[5].bandwidth()/2),h(a,"y",p=e[7].top+e[4](e[19])+e[4].bandwidth()/2),h(a,"text-anchor","middle"),h(a,"dominant-baseline","middle"),h(a,"class","model-path"),h(a,"data-model",g=e[19])},m(m,_){T(m,t,_),T(m,a,_),b(a,c)},p(m,_){_&40&&n!==(n=m[7].left+m[5](m[22]))&&h(t,"x",n),_&24&&l!==(l=m[7].top+m[4](m[19]))&&h(t,"y",l),_&32&&o!==(o=m[5].bandwidth())&&h(t,"width",o),_&16&&r!==(r=m[4].bandwidth())&&h(t,"height",r),_&8&&s!==(s=m[8](m[19],m[22]))&&h(t,"fill",s),_&8&&u!==(u=m[19])&&h(t,"data-model",u),_&12&&f!==(f=m[6](m[2][m[19]][m[22]])+"")&&K(c,f),_&40&&d!==(d=m[7].left+m[5](m[22])+m[5].bandwidth()/2)&&h(a,"x",d),_&24&&p!==(p=m[7].top+m[4](m[19])+m[4].bandwidth()/2)&&h(a,"y",p),_&8&&g!==(g=m[19])&&h(a,"data-model",g)},d(m){m&&N(t),m&&N(a)}}}function cs(e){let t,n=e[3],l=[];for(let o=0;oe[16].call(t))},m(p,g){T(p,t,g),b(t,n);for(let m=0;mn(15,g=$));const m=vt(".1f");function _($){let F=$.reduce((k,E)=>(k[E.qid]||(k[E.qid]=[]),k[E.qid].push(E),k),{}),C=Array.from(new Set($.map(k=>k.model))),R=C.reduce((k,E)=>(k[E]=C.reduce((I,D)=>(I[D]={sum:0,count:0},I),{}),k),{});for(let k in F){let E=F[k];for(let I of C)for(let D of C){let L=E.find(B=>B.model===I),O=E.find(B=>B.model===D);L&&O&&(R[I][D].sum+=O.rank-L.rank,R[I][D].count++)}}for(let k in R)for(let E in R[k])R[k][E].count>0?R[k][E]=R[k][E].sum/R[k][E].count:R[k][E]=0;return R}let v=500,y=500,w={top:50,bottom:0,left:65,right:25};function S($,F){let C=l[$][F];return C===0?"white":C>=0?p($):p(F)}function M(){y=this.offsetWidth,v=this.offsetHeight,n(1,y),n(0,v)}return e.$$.update=()=>{e.$$.dirty&32768&&n(2,l=_(g)),e.$$.dirty&32768&&n(3,o=Array.from(new Set(g.map($=>$.model)))),e.$$.dirty&2&&n(14,r=y-w.left-w.right),e.$$.dirty&1&&n(13,s=v-w.top-w.bottom),e.$$.dirty&16392&&n(5,u=qt().range([0,r]).domain(o).padding(.05)),e.$$.dirty&8200&&n(4,a=qt().range([0,s]).domain(o).padding(.05)),e.$$.dirty&4&&n(12,f=Object.values(l).flatMap($=>Object.values($))),e.$$.dirty&4096&&n(11,c=so(f)),e.$$.dirty&4096&&n(10,d=mt(f)),e.$$.dirty&8&&n(9,p=Mt().domain(o).range(["#FF5470","#1B2D45","#00EBC7","#FDE24F"])),e.$$.dirty&3592&&o.reduce(($,F)=>($[F]=Ga().domain([c,d]).interpolator(uo("white",p(F))),$),{})},[v,y,l,o,a,u,m,w,S,p,d,c,f,s,r,g,M]}class Lp extends ce{constructor(t){super(),de(this,t,zp,Vp,fe,{})}}function ds(e,t,n){const l=e.slice();return l[7]=t[n],l[9]=n,l}function qp(e){let t;return{c(){t=A("div"),t.innerHTML="
To view the comparison dashboard, you must first rank some comparisons!
",h(t,"class","holder svelte-7imt18")},m(n,l){T(n,t,l)},p:U,i:U,o:U,d(n){n&&N(t)}}}function Hp(e){let t,n,l,o,r,s,u,a,f,c,d,p,g,m,_,v,y,w,S,M,$,F=e[1],C=[];for(let R=0;R0?0:1}return n=u(e),l=s[n]=r[n](e),{c(){t=A("div"),l.c(),h(t,"class","main-container svelte-7imt18")},m(a,f){T(a,t,f),s[n].m(t,null),o=!0},p(a,[f]){let c=n;n=u(a),n===c?s[n].p(a,f):(we(),z(s[c],1,1,()=>{s[c]=null}),ye(),l=s[n],l?l.p(a,f):(l=s[n]=r[n](a),l.c()),V(l,1),l.m(t,null))},i(a){o||(V(l),o=!0)},o(a){z(l),o=!1},d(a){a&&N(t),s[n].d()}}}function gs(){document.querySelectorAll(".model-path, .model-path-outer, .model-circle").forEach(e=>{e.style.opacity=1})}function Bp(e,t,n){let l,o,r;ue(e,rn,c=>n(0,r=c));async function s(){const d=await(await fetch("/chat/comparator/db/retrieve")).json();console.log("uploooo",d);const g=d.data.map(m=>({model:m.model,answer:m.answer,qid:parseInt(m.qid),rank:parseInt(m.rank)}));De(rn,r=[...g],r)}ft(()=>{s()});function u(c){document.querySelectorAll(".model-path, .model-path-outer, .model-circle").forEach(d=>{d.style.opacity=.12}),document.querySelectorAll(`.model-path[data-model="${l[c]}"], .model-circle[data-model="${l[c]}"]`).forEach(d=>{d.style.opacity=1})}const a=c=>u(c),f=c=>u(c);return e.$$.update=()=>{e.$$.dirty&1&&n(1,l=Array.from(new Set(r.map(c=>c.model)))),e.$$.dirty&1&&n(2,o=Mt().domain(r.map(c=>c.model)).range(["#FF5470","#1B2D45","#00EBC7","#FDE24F","red"]))},[r,l,o,u,a,f]}class jp extends ce{constructor(t){super(),de(this,t,Bp,Gp,fe,{})}}function xp(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return hu(this.cover(t,n),t,n,e)}function hu(e,t,n,l){if(isNaN(t)||isNaN(n))return e;var o,r=e._root,s={data:l},u=e._x0,a=e._y0,f=e._x1,c=e._y1,d,p,g,m,_,v,y,w;if(!r)return e._root=s,e;for(;r.length;)if((_=t>=(d=(u+f)/2))?u=d:f=d,(v=n>=(p=(a+c)/2))?a=p:c=p,o=r,!(r=r[y=v<<1|_]))return o[y]=s,e;if(g=+e._x.call(null,r.data),m=+e._y.call(null,r.data),t===g&&n===m)return s.next=r,o?o[y]=s:e._root=s,e;do o=o?o[y]=new Array(4):e._root=new Array(4),(_=t>=(d=(u+f)/2))?u=d:f=d,(v=n>=(p=(a+c)/2))?a=p:c=p;while((y=v<<1|_)===(w=(m>=p)<<1|g>=d));return o[w]=r,o[y]=s,e}function Up(e){var t,n,l=e.length,o,r,s=new Array(l),u=new Array(l),a=1/0,f=1/0,c=-1/0,d=-1/0;for(n=0;nc&&(c=o),rd&&(d=r));if(a>c||f>d)return this;for(this.cover(a,f).cover(c,d),n=0;ne||e>=o||l>t||t>=r;)switch(f=(tc||(u=m.y0)>d||(a=m.x1)=y)<<1|e>=v)&&(m=p[p.length-1],p[p.length-1]=p[p.length-1-_],p[p.length-1-_]=m)}else{var w=e-+this._x.call(null,g.data),S=t-+this._y.call(null,g.data),M=w*w+S*S;if(M=(p=(s+a)/2))?s=p:a=p,(_=d>=(g=(u+f)/2))?u=g:f=g,t=n,!(n=n[v=_<<1|m]))return this;if(!n.length)break;(t[v+1&3]||t[v+2&3]||t[v+3&3])&&(l=t,y=v)}for(;n.data!==e;)if(o=n,!(n=n.next))return this;return(r=n.next)&&delete n.next,o?(r?o.next=r:delete o.next,this):t?(r?t[v]=r:delete t[v],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(l?l[y]=n:this._root=n),this):(this._root=r,this)}function Jp(e){for(var t=0,n=e.length;tp.index){var I=g-R.x-R.vx,D=m-R.y-R.vy,L=I*I+D*D;Lg+E||Fm+E||Cf.r&&(f.r=f[c].r)}function a(){if(t){var f,c=t.length,d;for(n=new Array(c),f=0;f{}};function pu(){for(var e=0,t=arguments.length,n={},l;e=0&&(l=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:l}})}ll.prototype=pu.prototype={constructor:ll,on:function(e,t){var n=this._,l=cm(e+"",n),o,r=-1,s=l.length;if(arguments.length<2){for(;++r0)for(var n=new Array(o),l=0,o,r;l=0&&e._call.call(void 0,t),e=e._next;--sn}function vs(){Ht=(kl=Nn.now())+El,sn=_n=0;try{gm()}finally{sn=0,mm(),Ht=0}}function pm(){var e=Nn.now(),t=e-kl;t>mu&&(El-=t,kl=e)}function mm(){for(var e,t=yl,n,l=1/0;t;)t._call?(l>t._time&&(l=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:yl=n);vn=e,ko(l)}function ko(e){if(!sn){_n&&(_n=clearTimeout(_n));var t=e-Ht;t>24?(e<1/0&&(_n=setTimeout(vs,e-Nn.now()-El)),dn&&(dn=clearInterval(dn))):(dn||(kl=Nn.now(),dn=setInterval(pm,mu)),sn=1,_u(vs))}}const _m=1664525,vm=1013904223,bs=4294967296;function bm(){let e=1;return()=>(e=(_m*e+vm)%bs)/bs}var wm=10,ym=Math.PI*(3-Math.sqrt(5));function km(e){var t,n=1,l=.001,o=1-Math.pow(l,1/300),r=0,s=.6,u=new Map,a=bu(d),f=pu("tick","end"),c=bm();e==null&&(e=[]);function d(){p(),f.call("tick",t),n1?(v==null?u.delete(_):u.set(_,m(v)),t):u.get(_)},find:function(_,v,y){var w=0,S=e.length,M,$,F,C,R;for(y==null?y=1/0:y*=y,w=0;w1?(f.on(_,v),t):f.on(_)}}}function Sm(e){var t=ot(.1),n,l,o;typeof e!="function"&&(e=ot(e==null?0:+e));function r(u){for(var a=0,f=n.length,c;ae[4]?1:0),h(t,"class",g="file-circle-g "+(e[20].size>e[4]?"large":"")+" svelte-h2ab3o"),h(t,"style",m=e[5](e[20].x,e[20].y)),h(t,"role","img")},m(w,S){T(w,t,S),b(t,n),b(t,r),b(r,u),b(r,a),b(a,c),_=!0,v||(y=[x(t,"mouseover",e[6]),x(t,"mouseout",e[7]),x(t,"focus",e[6]),x(t,"blur",e[7])],v=!0)},p(w,S){(!_||S&12&&l!==(l=w[3](w[20].size)))&&h(n,"r",l),(!_||S&4)&&s!==(s=w[20].file+"")&&K(u,s),(!_||S&4)&&f!==(f=ro(w[20].size)+"")&&K(c,f),(!_||S&20&&d!==(d=w[20].size>w[4]?1:0))&&h(r,"opacity",d),(!_||S&20&&g!==(g="file-circle-g "+(w[20].size>w[4]?"large":"")+" svelte-h2ab3o"))&&h(t,"class",g),(!_||S&4&&m!==(m=w[5](w[20].x,w[20].y)))&&h(t,"style",m)},i(w){_||(w&&Me(()=>{_&&(o||(o=lt(n,qn,{duration:1e3},!0)),o.run(1))}),w&&Me(()=>{_&&(p||(p=lt(r,qn,{duration:1e3},!0)),p.run(1))}),_=!0)},o(w){w&&(o||(o=lt(n,qn,{duration:1e3},!1)),o.run(0)),w&&(p||(p=lt(r,qn,{duration:1e3},!1)),p.run(0)),_=!1},d(w){w&&N(t),w&&o&&o.end(),w&&p&&p.end(),v=!1,ve(y)}}}function $m(e){let t,n,l,o,r=e[2],s=[];for(let a=0;az(s[a],1,1,()=>{s[a]=null});return{c(){t=A("div"),n=G("svg");for(let a=0;ae[15].call(t))},m(a,f){T(a,t,f),b(t,n);for(let c=0;cn(14,c=$));let d=600,p=350,g=!0,m=!1;const _=($,F)=>`transform: translate(${$}px, ${F}px)`,v=[-4,4],y=[-1,1];function w(){n(8,g=!0),n(9,m=!0);const $=pt(this);Pl(".file-circle-g").select("text").style("opacity",0),$.raise(),$.select("circle").attr("fill","var(--red)"),$.select("text").style("opacity",1)}const S=()=>{const $=Pl(".file-circle-g");$.select("circle").attr("fill","var(--yellow)"),$.select("text").style("opacity",0),n(9,m=!1),setTimeout(()=>{n(8,g=!1)},1e3)};function M(){d=this.offsetWidth,p=this.offsetHeight,n(0,d),n(1,p)}return e.$$.update=()=>{e.$$.dirty&16387&&n(2,l=c.map($=>({...$,x:d/2,y:p/2,tickCount:0}))),e.$$.dirty&16384&&console.log(c.map($=>$.size).sort(($,F)=>$-F)),e.$$.dirty&1&&n(13,o=Sm().x(d/2)),e.$$.dirty&2&&n(12,r=Cm().y(p/2)),e.$$.dirty&16384&&n(3,a=We().domain(bn(c,$=>$.size)).range([12,60])),e.$$.dirty&8&&n(10,s=um().radius($=>a($.size)+1).iterations(3)),e.$$.dirty&16384&&n(4,u=Ch(c.map($=>$.size).sort(($,F)=>$-F),.85)),e.$$.dirty&1&&We().domain(v).range([5,d]),e.$$.dirty&2&&We().domain(y).range([p,5]),e.$$.dirty&4&&n(11,f=km().nodes(l).on("tick",()=>{n(2,l=[...l])})),e.$$.dirty&15360&&(f.force("x",o),f.force("y",r),f.force("collide",s),f.alpha(.02),f.restart()),e.$$.dirty&19468&&(a.domain(bn(c,$=>$.size)),l.forEach($=>$.radius=a($.size)),f.nodes(l),s.radius($=>$.radius+.5)),e.$$.dirty&768&&g===!1&&(m||Pl(".large").select("text").style("opacity",1))},[d,p,l,a,u,_,w,S,g,m,s,f,r,o,c,M]}class Rm extends ce{constructor(t){super(),de(this,t,Am,$m,fe,{})}}/** * table-core * * Copyright (c) TanStack @@ -34,10 +34,10 @@ * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function $t(e,t){return typeof e=="function"?e(t):e}function Qe(e,t){return n=>{t.setState(l=>({...l,[e]:$t(n,l[e])}))}}function Sl(e){return e instanceof Function}function $m(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function Rm(e,t){const n=[],l=o=>{o.forEach(r=>{n.push(r);const s=t(r);s!=null&&s.length&&l(s)})};return l(e),n}function oe(e,t,n){let l=[],o;return()=>{let r;n.key&&n.debug&&(r=Date.now());const s=e();if(!(s.length!==l.length||s.some((f,c)=>l[c]!==f)))return o;l=s;let a;if(n.key&&n.debug&&(a=Date.now()),o=t(...s),n==null||n.onChange==null||n.onChange(o),n.key&&n.debug&&n!=null&&n.debug()){const f=Math.round((Date.now()-r)*100)/100,c=Math.round((Date.now()-a)*100)/100,d=c/16,g=(p,m)=>{for(p=String(p);p.length{t.setState(l=>({...l,[e]:$t(n,l[e])}))}}function Cl(e){return e instanceof Function}function Mm(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function Em(e,t){const n=[],l=o=>{o.forEach(r=>{n.push(r);const s=t(r);s!=null&&s.length&&l(s)})};return l(e),n}function oe(e,t,n){let l=[],o;return()=>{let r;n.key&&n.debug&&(r=Date.now());const s=e();if(!(s.length!==l.length||s.some((f,c)=>l[c]!==f)))return o;l=s;let a;if(n.key&&n.debug&&(a=Date.now()),o=t(...s),n==null||n.onChange==null||n.onChange(o),n.key&&n.debug&&n!=null&&n.debug()){const f=Math.round((Date.now()-r)*100)/100,c=Math.round((Date.now()-a)*100)/100,d=c/16,p=(g,m)=>{for(g=String(g);g.length{let p=g;for(const _ of a.split(".")){var m;p=(m=p)==null?void 0:m[_]}return p}:c=g=>g[u.accessorKey]),!f)throw new Error;let d={id:`${String(f)}`,accessorFn:c,parent:l,depth:n,columnDef:u,columns:[],getFlatColumns:oe(()=>[!0],()=>{var g;return[d,...(g=d.columns)==null?void 0:g.flatMap(p=>p.getFlatColumns())]},{key:"column.getFlatColumns",debug:()=>{var g;return(g=e.options.debugAll)!=null?g:e.options.debugColumns}}),getLeafColumns:oe(()=>[e._getOrderColumnsFn()],g=>{var p;if((p=d.columns)!=null&&p.length){let m=d.columns.flatMap(_=>_.getLeafColumns());return g(m)}return[d]},{key:"column.getLeafColumns",debug:()=>{var g;return(g=e.options.debugAll)!=null?g:e.options.debugColumns}})};return d=e._features.reduce((g,p)=>Object.assign(g,p.createColumn==null?void 0:p.createColumn(d,e)),d),d}function ks(e,t,n){var l;let r={id:(l=n.id)!=null?l: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 s=[],u=a=>{a.subHeaders&&a.subHeaders.length&&a.subHeaders.map(u),s.push(a)};return u(r),s},getContext:()=>({table:e,header:r,column:t})};return e._features.forEach(s=>{Object.assign(r,s.createHeader==null?void 0:s.createHeader(r,e))}),r}const Mm={createTable:e=>({getHeaderGroups:oe(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,l,o)=>{var r,s;const u=(r=l==null?void 0:l.map(d=>n.find(g=>g.id===d)).filter(Boolean))!=null?r:[],a=(s=o==null?void 0:o.map(d=>n.find(g=>g.id===d)).filter(Boolean))!=null?s:[],f=n.filter(d=>!(l!=null&&l.includes(d.id))&&!(o!=null&&o.includes(d.id)));return Wn(t,[...u,...f,...a],e)},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getCenterHeaderGroups:oe(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,l,o)=>(n=n.filter(r=>!(l!=null&&l.includes(r.id))&&!(o!=null&&o.includes(r.id))),Wn(t,n,e,"center")),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeftHeaderGroups:oe(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,l)=>{var o;const r=(o=l==null?void 0:l.map(s=>n.find(u=>u.id===s)).filter(Boolean))!=null?o:[];return Wn(t,r,e,"left")},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getRightHeaderGroups:oe(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,l)=>{var o;const r=(o=l==null?void 0:l.map(s=>n.find(u=>u.id===s)).filter(Boolean))!=null?o:[];return Wn(t,r,e,"right")},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getFooterGroups:oe(()=>[e.getHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeftFooterGroups:oe(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getCenterFooterGroups:oe(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getRightFooterGroups:oe(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getFlatHeaders:oe(()=>[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:oe(()=>[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:oe(()=>[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:oe(()=>[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:oe(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var l;return!((l=n.subHeaders)!=null&&l.length)}),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeftLeafHeaders:oe(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var l;return!((l=n.subHeaders)!=null&&l.length)}),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getRightLeafHeaders:oe(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var l;return!((l=n.subHeaders)!=null&&l.length)}),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeafHeaders:oe(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,l)=>{var o,r,s,u,a,f;return[...(o=(r=t[0])==null?void 0:r.headers)!=null?o:[],...(s=(u=n[0])==null?void 0:u.headers)!=null?s:[],...(a=(f=l[0])==null?void 0:f.headers)!=null?a:[]].map(c=>c.getLeafHeaders()).flat()},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}})})};function Wn(e,t,n,l){var o,r;let s=0;const u=function(g,p){p===void 0&&(p=1),s=Math.max(s,p),g.filter(m=>m.getIsVisible()).forEach(m=>{var _;(_=m.columns)!=null&&_.length&&u(m.columns,p+1)},0)};u(e);let a=[];const f=(g,p)=>{const m={depth:p,id:[l,`${p}`].filter(Boolean).join("_"),headers:[]},_=[];g.forEach(v=>{const y=[..._].reverse()[0],w=v.column.depth===m.depth;let S,M=!1;if(w&&v.column.parent?S=v.column.parent:(S=v.column,M=!0),y&&(y==null?void 0:y.column)===S)y.subHeaders.push(v);else{const $=ks(n,S,{id:[l,p,S.id,v==null?void 0:v.id].filter(Boolean).join("_"),isPlaceholder:M,placeholderId:M?`${_.filter(F=>F.column===S).length}`:void 0,depth:p,index:_.length});$.subHeaders.push(v),_.push($)}m.headers.push(v),v.headerGroup=m}),a.push(m),p>0&&f(_,p-1)},c=t.map((g,p)=>ks(n,g,{depth:s,index:p}));f(c,s-1),a.reverse();const d=g=>g.filter(m=>m.column.getIsVisible()).map(m=>{let _=0,v=0,y=[0];m.subHeaders&&m.subHeaders.length?(y=[],d(m.subHeaders).forEach(S=>{let{colSpan:M,rowSpan:$}=S;_+=M,y.push($)})):_=1;const w=Math.min(...y);return v=v+w,m.colSpan=_,m.rowSpan=v,{colSpan:_,rowSpan:v}});return d((o=(r=a[0])==null?void 0:r.headers)!=null?o:[]),a}const Xn={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Ul=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Em={getDefaultColumnDef:()=>Xn,getInitialState:e=>({columnSizing:{},columnSizingInfo:Ul(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",onColumnSizingChange:Qe("columnSizing",e),onColumnSizingInfoChange:Qe("columnSizingInfo",e)}),createColumn:(e,t)=>({getSize:()=>{var n,l,o;const r=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:Xn.minSize,(l=r??e.columnDef.size)!=null?l:Xn.size),(o=e.columnDef.maxSize)!=null?o:Xn.maxSize)},getStart:n=>{const l=n?n==="left"?t.getLeftVisibleLeafColumns():t.getRightVisibleLeafColumns():t.getVisibleLeafColumns(),o=l.findIndex(r=>r.id===e.id);if(o>0){const r=l[o-1];return r.getStart(n)+r.getSize()}return 0},resetSize:()=>{t.setColumnSizing(n=>{let{[e.id]:l,...o}=n;return o})},getCanResize:()=>{var n,l;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((l=t.options.enableColumnResizing)!=null?l:!0)},getIsResizing:()=>t.getState().columnSizingInfo.isResizingColumn===e.id}),createHeader:(e,t)=>({getSize:()=>{let n=0;const l=o=>{if(o.subHeaders.length)o.subHeaders.forEach(l);else{var r;n+=(r=o.column.getSize())!=null?r:0}};return l(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),l=n==null?void 0:n.getCanResize();return o=>{if(!n||!l||(o.persist==null||o.persist(),Wl(o)&&o.touches&&o.touches.length>1))return;const r=e.getSize(),s=e?e.getLeafHeaders().map(_=>[_.column.id,_.column.getSize()]):[[n.id,n.getSize()]],u=Wl(o)?Math.round(o.touches[0].clientX):o.clientX,a={},f=(_,v)=>{typeof v=="number"&&(t.setColumnSizingInfo(y=>{var w,S;const M=v-((w=y==null?void 0:y.startOffset)!=null?w:0),$=Math.max(M/((S=y==null?void 0:y.startSize)!=null?S:0),-.999999);return y.columnSizingStart.forEach(F=>{let[C,R]=F;a[C]=Math.round(Math.max(R+R*$,0)*100)/100}),{...y,deltaOffset:M,deltaPercentage:$}}),(t.options.columnResizeMode==="onChange"||_==="end")&&t.setColumnSizing(y=>({...y,...a})))},c=_=>f("move",_),d=_=>{f("end",_),t.setColumnSizingInfo(v=>({...v,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},g={moveHandler:_=>c(_.clientX),upHandler:_=>{document.removeEventListener("mousemove",g.moveHandler),document.removeEventListener("mouseup",g.upHandler),d(_.clientX)}},p={moveHandler:_=>(_.cancelable&&(_.preventDefault(),_.stopPropagation()),c(_.touches[0].clientX),!1),upHandler:_=>{var v;document.removeEventListener("touchmove",p.moveHandler),document.removeEventListener("touchend",p.upHandler),_.cancelable&&(_.preventDefault(),_.stopPropagation()),d((v=_.touches[0])==null?void 0:v.clientX)}},m=Fm()?{passive:!1}:!1;Wl(o)?(document.addEventListener("touchmove",p.moveHandler,m),document.addEventListener("touchend",p.upHandler,m)):(document.addEventListener("mousemove",g.moveHandler,m),document.addEventListener("mouseup",g.upHandler,m)),t.setColumnSizingInfo(_=>({..._,startOffset:u,startSize:r,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,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?Ul():(n=e.initialState.columnSizingInfo)!=null?n:Ul())},getTotalSize:()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((l,o)=>l+o.getSize(),0))!=null?t:0},getLeftTotalSize:()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((l,o)=>l+o.getSize(),0))!=null?t:0},getCenterTotalSize:()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((l,o)=>l+o.getSize(),0))!=null?t:0},getRightTotalSize:()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((l,o)=>l+o.getSize(),0))!=null?t:0}})};let Yn=null;function Fm(){if(typeof Yn=="boolean")return Yn;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 Yn=e,Yn}function Wl(e){return e.type==="touchstart"}const Dm={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Qe("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;return{_autoResetExpanded:()=>{var l,o;if(!t){e._queue(()=>{t=!0});return}if((l=(o=e.options.autoResetAll)!=null?o:e.options.autoResetExpanded)!=null?l:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},setExpanded:l=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(l),toggleAllRowsExpanded:l=>{l??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},resetExpanded:l=>{var o,r;e.setExpanded(l?{}:(o=(r=e.initialState)==null?void 0:r.expanded)!=null?o:{})},getCanSomeRowsExpand:()=>e.getPrePaginationRowModel().flatRows.some(l=>l.getCanExpand()),getToggleAllRowsExpandedHandler:()=>l=>{l.persist==null||l.persist(),e.toggleAllRowsExpanded()},getIsSomeRowsExpanded:()=>{const l=e.getState().expanded;return l===!0||Object.values(l).some(Boolean)},getIsAllRowsExpanded:()=>{const l=e.getState().expanded;return typeof l=="boolean"?l===!0:!(!Object.keys(l).length||e.getRowModel().flatRows.some(o=>!o.getIsExpanded()))},getExpandedDepth:()=>{let l=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(r=>{const s=r.split(".");l=Math.max(l,s.length)}),l},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(l=>{var o;const r=l===!0?!0:!!(l!=null&&l[e.id]);let s={};if(l===!0?Object.keys(t.getRowModel().rowsById).forEach(u=>{s[u]=!0}):s=l,n=(o=n)!=null?o:!r,!r&&n)return{...s,[e.id]:!0};if(r&&!n){const{[e.id]:u,...a}=s;return a}return l})},getIsExpanded:()=>{var n;const l=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:l===!0||l!=null&&l[e.id])},getCanExpand:()=>{var n,l,o;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((l=t.options.enableExpanding)!=null?l:!0)&&!!((o=e.subRows)!=null&&o.length)},getToggleExpandedHandler:()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}})},vu=(e,t,n)=>{var l,o,r;const s=n.toLowerCase();return!!(!((l=e.getValue(t))==null||(o=l.toString())==null||(r=o.toLowerCase())==null)&&r.includes(s))};vu.autoRemove=e=>Ze(e);const bu=(e,t,n)=>{var l,o;return!!(!((l=e.getValue(t))==null||(o=l.toString())==null)&&o.includes(n))};bu.autoRemove=e=>Ze(e);const wu=(e,t,n)=>{var l,o;return((l=e.getValue(t))==null||(o=l.toString())==null?void 0:o.toLowerCase())===(n==null?void 0:n.toLowerCase())};wu.autoRemove=e=>Ze(e);const yu=(e,t,n)=>{var l;return(l=e.getValue(t))==null?void 0:l.includes(n)};yu.autoRemove=e=>Ze(e)||!(e!=null&&e.length);const ku=(e,t,n)=>!n.some(l=>{var o;return!((o=e.getValue(t))!=null&&o.includes(l))});ku.autoRemove=e=>Ze(e)||!(e!=null&&e.length);const Su=(e,t,n)=>n.some(l=>{var o;return(o=e.getValue(t))==null?void 0:o.includes(l)});Su.autoRemove=e=>Ze(e)||!(e!=null&&e.length);const Cu=(e,t,n)=>e.getValue(t)===n;Cu.autoRemove=e=>Ze(e);const $u=(e,t,n)=>e.getValue(t)==n;$u.autoRemove=e=>Ze(e);const Go=(e,t,n)=>{let[l,o]=n;const r=e.getValue(t);return r>=l&&r<=o};Go.resolveFilterValue=e=>{let[t,n]=e,l=typeof t!="number"?parseFloat(t):t,o=typeof n!="number"?parseFloat(n):n,r=t===null||Number.isNaN(l)?-1/0:l,s=n===null||Number.isNaN(o)?1/0:o;if(r>s){const u=r;r=s,s=u}return[r,s]};Go.autoRemove=e=>Ze(e)||Ze(e[0])&&Ze(e[1]);const ct={includesString:vu,includesStringSensitive:bu,equalsString:wu,arrIncludes:yu,arrIncludesAll:ku,arrIncludesSome:Su,equals:Cu,weakEquals:$u,inNumberRange:Go};function Ze(e){return e==null||e===""}const Im={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:Qe("columnFilters",e),onGlobalFilterChange:Qe("globalFilter",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100,globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n,l;const o=(n=e.getCoreRowModel().flatRows[0])==null||(l=n._getAllCellsByColumnId()[t.id])==null?void 0:l.getValue();return typeof o=="string"||typeof o=="number"}}),createColumn:(e,t)=>({getAutoFilterFn:()=>{const n=t.getCoreRowModel().flatRows[0],l=n==null?void 0:n.getValue(e.id);return typeof l=="string"?ct.includesString:typeof l=="number"?ct.inNumberRange:typeof l=="boolean"||l!==null&&typeof l=="object"?ct.equals:Array.isArray(l)?ct.arrIncludes:ct.weakEquals},getFilterFn:()=>{var n,l;return Sl(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(l=t.options.filterFns)==null?void 0:l[e.columnDef.filterFn])!=null?n:ct[e.columnDef.filterFn]},getCanFilter:()=>{var n,l,o;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((l=t.options.enableColumnFilters)!=null?l:!0)&&((o=t.options.enableFilters)!=null?o:!0)&&!!e.accessorFn},getCanGlobalFilter:()=>{var n,l,o,r;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((l=t.options.enableGlobalFilter)!=null?l:!0)&&((o=t.options.enableFilters)!=null?o:!0)&&((r=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?r:!0)&&!!e.accessorFn},getIsFiltered:()=>e.getFilterIndex()>-1,getFilterValue:()=>{var n,l;return(n=t.getState().columnFilters)==null||(l=n.find(o=>o.id===e.id))==null?void 0:l.value},getFilterIndex:()=>{var n,l;return(n=(l=t.getState().columnFilters)==null?void 0:l.findIndex(o=>o.id===e.id))!=null?n:-1},setFilterValue:n=>{t.setColumnFilters(l=>{const o=e.getFilterFn(),r=l==null?void 0:l.find(c=>c.id===e.id),s=$t(n,r?r.value:void 0);if(Ss(o,s,e)){var u;return(u=l==null?void 0:l.filter(c=>c.id!==e.id))!=null?u:[]}const a={id:e.id,value:s};if(r){var f;return(f=l==null?void 0:l.map(c=>c.id===e.id?a:c))!=null?f:[]}return l!=null&&l.length?[...l,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:()=>ct.includesString,getGlobalFilterFn:()=>{var t,n;const{globalFilterFn:l}=e.options;return Sl(l)?l:l==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[l])!=null?t:ct[l]},setColumnFilters:t=>{const n=e.getAllLeafColumns(),l=o=>{var r;return(r=$t(t,o))==null?void 0:r.filter(s=>{const u=n.find(a=>a.id===s.id);if(u){const a=u.getFilterFn();if(Ss(a,s.value,u))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(l)},setGlobalFilter:t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},resetGlobalFilter:t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)},resetColumnFilters:t=>{var n,l;e.setColumnFilters(t?[]:(n=(l=e.initialState)==null?void 0:l.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 Ss(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const Nm=(e,t,n)=>n.reduce((l,o)=>{const r=o.getValue(e);return l+(typeof r=="number"?r:0)},0),Pm=(e,t,n)=>{let l;return n.forEach(o=>{const r=o.getValue(e);r!=null&&(l>r||l===void 0&&r>=r)&&(l=r)}),l},Tm=(e,t,n)=>{let l;return n.forEach(o=>{const r=o.getValue(e);r!=null&&(l=r)&&(l=r)}),l},Om=(e,t,n)=>{let l,o;return n.forEach(r=>{const s=r.getValue(e);s!=null&&(l===void 0?s>=s&&(l=o=s):(l>s&&(l=s),o{let n=0,l=0;if(t.forEach(o=>{let r=o.getValue(e);r!=null&&(r=+r)>=r&&(++n,l+=r)}),n)return l/n},zm=(e,t)=>{if(!t.length)return;const n=t.map(r=>r.getValue(e));if(!$m(n))return;if(n.length===1)return n[0];const l=Math.floor(n.length/2),o=n.sort((r,s)=>r-s);return n.length%2!==0?o[l]:(o[l-1]+o[l])/2},Lm=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),qm=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,Hm=(e,t)=>t.length,Xl={sum:Nm,min:Pm,max:Tm,extent:Om,mean:Vm,median:zm,unique:Lm,uniqueCount:qm,count:Hm},Gm={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:Qe("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>({toggleGrouping:()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(l=>l!==e.id):[...n??[],e.id])},getCanGroup:()=>{var n,l,o,r;return(n=(l=(o=(r=e.columnDef.enableGrouping)!=null?r:!0)!=null?o:t.options.enableGrouping)!=null?l:!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],l=n==null?void 0:n.getValue(e.id);if(typeof l=="number")return Xl.sum;if(Object.prototype.toString.call(l)==="[object Date]")return Xl.extent},getAggregationFn:()=>{var n,l;if(!e)throw new Error;return Sl(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(l=t.options.aggregationFns)==null?void 0:l[e.columnDef.aggregationFn])!=null?n:Xl[e.columnDef.aggregationFn]}}),createTable:e=>({setGrouping:t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),resetGrouping:t=>{var n,l;e.setGrouping(t?[]:(n=(l=e.initialState)==null?void 0:l.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 l=t.getColumn(n);return l!=null&&l.columnDef.getGroupingValue?(e._groupingValuesCache[n]=l.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},_groupingValuesCache:{}}),createCell:(e,t,n,l)=>({getIsGrouped:()=>t.getIsGrouped()&&t.id===n.groupingColumnId,getIsPlaceholder:()=>!e.getIsGrouped()&&t.getIsGrouped(),getIsAggregated:()=>{var o;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((o=n.subRows)!=null&&o.length)}})};function Bm(e,t,n){if(!(t!=null&&t.length)||!n)return e;const l=e.filter(r=>!t.includes(r.id));return n==="remove"?l:[...t.map(r=>e.find(s=>s.id===r)).filter(Boolean),...l]}const jm={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Qe("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:oe(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,l)=>o=>{let r=[];if(!(t!=null&&t.length))r=o;else{const s=[...t],u=[...o];for(;u.length&&s.length;){const a=s.shift(),f=u.findIndex(c=>c.id===a);f>-1&&r.push(u.splice(f,1)[0])}r=[...r,...u]}return Bm(r,n,l)},{key:!1})})},So=0,Co=10,Yl=()=>({pageIndex:So,pageSize:Co}),xm={getInitialState:e=>({...e,pagination:{...Yl(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Qe("pagination",e)}),createTable:e=>{let t=!1,n=!1;return{_autoResetPageIndex:()=>{var l,o;if(!t){e._queue(()=>{t=!0});return}if((l=(o=e.options.autoResetAll)!=null?o:e.options.autoResetPageIndex)!=null?l:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},setPagination:l=>{const o=r=>$t(l,r);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(o)},resetPagination:l=>{var o;e.setPagination(l?Yl():(o=e.initialState.pagination)!=null?o:Yl())},setPageIndex:l=>{e.setPagination(o=>{let r=$t(l,o.pageIndex);const s=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return r=Math.max(0,Math.min(r,s)),{...o,pageIndex:r}})},resetPageIndex:l=>{var o,r,s;e.setPageIndex(l?So:(o=(r=e.initialState)==null||(s=r.pagination)==null?void 0:s.pageIndex)!=null?o:So)},resetPageSize:l=>{var o,r,s;e.setPageSize(l?Co:(o=(r=e.initialState)==null||(s=r.pagination)==null?void 0:s.pageSize)!=null?o:Co)},setPageSize:l=>{e.setPagination(o=>{const r=Math.max(1,$t(l,o.pageSize)),s=o.pageSize*o.pageIndex,u=Math.floor(s/r);return{...o,pageIndex:u,pageSize:r}})},setPageCount:l=>e.setPagination(o=>{var r;let s=$t(l,(r=e.options.pageCount)!=null?r:-1);return typeof s=="number"&&(s=Math.max(-1,s)),{...o,pageCount:s}}),getPageOptions:oe(()=>[e.getPageCount()],l=>{let o=[];return l&&l>0&&(o=[...new Array(l)].fill(null).map((r,s)=>s)),o},{key:!1,debug:()=>{var l;return(l=e.options.debugAll)!=null?l:e.options.debugTable}}),getCanPreviousPage:()=>e.getState().pagination.pageIndex>0,getCanNextPage:()=>{const{pageIndex:l}=e.getState().pagination,o=e.getPageCount();return o===-1?!0:o===0?!1:le.setPageIndex(l=>l-1),nextPage:()=>e.setPageIndex(l=>l+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 l;return(l=e.options.pageCount)!=null?l:Math.ceil(e.getPrePaginationRowModel().rows.length/e.getState().pagination.pageSize)}}}},Ql=()=>({left:[],right:[]}),Um={getInitialState:e=>({columnPinning:Ql(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Qe("columnPinning",e)}),createColumn:(e,t)=>({pin:n=>{const l=e.getLeafColumns().map(o=>o.id).filter(Boolean);t.setColumnPinning(o=>{var r,s;if(n==="right"){var u,a;return{left:((u=o==null?void 0:o.left)!=null?u:[]).filter(d=>!(l!=null&&l.includes(d))),right:[...((a=o==null?void 0:o.right)!=null?a:[]).filter(d=>!(l!=null&&l.includes(d))),...l]}}if(n==="left"){var f,c;return{left:[...((f=o==null?void 0:o.left)!=null?f:[]).filter(d=>!(l!=null&&l.includes(d))),...l],right:((c=o==null?void 0:o.right)!=null?c:[]).filter(d=>!(l!=null&&l.includes(d)))}}return{left:((r=o==null?void 0:o.left)!=null?r:[]).filter(d=>!(l!=null&&l.includes(d))),right:((s=o==null?void 0:o.right)!=null?s:[]).filter(d=>!(l!=null&&l.includes(d)))}})},getCanPin:()=>e.getLeafColumns().some(l=>{var o,r;return((o=l.columnDef.enablePinning)!=null?o:!0)&&((r=t.options.enablePinning)!=null?r:!0)}),getIsPinned:()=>{const n=e.getLeafColumns().map(u=>u.id),{left:l,right:o}=t.getState().columnPinning,r=n.some(u=>l==null?void 0:l.includes(u)),s=n.some(u=>o==null?void 0:o.includes(u));return r?"left":s?"right":!1},getPinnedIndex:()=>{var n,l,o;const r=e.getIsPinned();return r?(n=(l=t.getState().columnPinning)==null||(o=l[r])==null?void 0:o.indexOf(e.id))!=null?n:-1:0}}),createRow:(e,t)=>({getCenterVisibleCells:oe(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,l,o)=>{const r=[...l??[],...o??[]];return n.filter(s=>!r.includes(s.column.id))},{key:"row.getCenterVisibleCells",debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}}),getLeftVisibleCells:oe(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,,],(n,l)=>(l??[]).map(r=>n.find(s=>s.column.id===r)).filter(Boolean).map(r=>({...r,position:"left"})),{key:"row.getLeftVisibleCells",debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}}),getRightVisibleCells:oe(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,l)=>(l??[]).map(r=>n.find(s=>s.column.id===r)).filter(Boolean).map(r=>({...r,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,l;return e.setColumnPinning(t?Ql():(n=(l=e.initialState)==null?void 0:l.columnPinning)!=null?n:Ql())},getIsSomeColumnsPinned:t=>{var n;const l=e.getState().columnPinning;if(!t){var o,r;return!!((o=l.left)!=null&&o.length||(r=l.right)!=null&&r.length)}return!!((n=l[t])!=null&&n.length)},getLeftLeafColumns:oe(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(l=>t.find(o=>o.id===l)).filter(Boolean),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugColumns}}),getRightLeafColumns:oe(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(l=>t.find(o=>o.id===l)).filter(Boolean),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugColumns}}),getCenterLeafColumns:oe(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,l)=>{const o=[...n??[],...l??[]];return t.filter(r=>!o.includes(r.id))},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugColumns}})})},Wm={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Qe("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 l={...n},o=e.getPreGroupedRowModel().flatRows;return t?o.forEach(r=>{r.getCanSelect()&&(l[r.id]=!0)}):o.forEach(r=>{delete l[r.id]}),l})},toggleAllPageRowsSelected:t=>e.setRowSelection(n=>{const l=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),o={...n};return e.getRowModel().rows.forEach(r=>{$o(o,r.id,l,e)}),o}),getPreSelectedRowModel:()=>e.getCoreRowModel(),getSelectedRowModel:oe(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?Kl(e,n):{rows:[],flatRows:[],rowsById:{}},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable}}),getFilteredSelectedRowModel:oe(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?Kl(e,n):{rows:[],flatRows:[],rowsById:{}},{key:"getFilteredSelectedRowModel",debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable}}),getGroupedSelectedRowModel:oe(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?Kl(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 l=!!(t.length&&Object.keys(n).length);return l&&t.some(o=>o.getCanSelect()&&!n[o.id])&&(l=!1),l},getIsAllPageRowsSelected:()=>{const t=e.getPaginationRowModel().flatRows.filter(o=>o.getCanSelect()),{rowSelection:n}=e.getState();let l=!!t.length;return l&&t.some(o=>!n[o.id])&&(l=!1),l},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 l=e.getIsSelected();t.setRowSelection(o=>{if(n=typeof n<"u"?n:!l,l===n)return o;const r={...o};return $o(r,e.id,n,t),r})},getIsSelected:()=>{const{rowSelection:n}=t.getState();return Bo(e,n)},getIsSomeSelected:()=>{const{rowSelection:n}=t.getState();return Cs(e,n)==="some"},getIsAllSubRowsSelected:()=>{const{rowSelection:n}=t.getState();return Cs(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 l=>{var o;n&&e.toggleSelected((o=l.target)==null?void 0:o.checked)}}})},$o=(e,t,n,l)=>{var o;const r=l.getRow(t);n?(r.getCanMultiSelect()||Object.keys(e).forEach(s=>delete e[s]),r.getCanSelect()&&(e[t]=!0)):delete e[t],(o=r.subRows)!=null&&o.length&&r.getCanSelectSubRows()&&r.subRows.forEach(s=>$o(e,s.id,n,l))};function Kl(e,t){const n=e.getState().rowSelection,l=[],o={},r=function(s,u){return s.map(a=>{var f;const c=Bo(a,n);if(c&&(l.push(a),o[a.id]=a),(f=a.subRows)!=null&&f.length&&(a={...a,subRows:r(a.subRows)}),c)return a}).filter(Boolean)};return{rows:r(t.rows),flatRows:l,rowsById:o}}function Bo(e,t){var n;return(n=t[e.id])!=null?n:!1}function Cs(e,t,n){if(e.subRows&&e.subRows.length){let l=!0,o=!1;return e.subRows.forEach(r=>{o&&!l||(Bo(r,t)?o=!0:l=!1)}),l?"all":o?"some":!1}return!1}const Ro=/([0-9]+)/gm,Xm=(e,t,n)=>Ru(At(e.getValue(n)).toLowerCase(),At(t.getValue(n)).toLowerCase()),Ym=(e,t,n)=>Ru(At(e.getValue(n)),At(t.getValue(n))),Qm=(e,t,n)=>jo(At(e.getValue(n)).toLowerCase(),At(t.getValue(n)).toLowerCase()),Km=(e,t,n)=>jo(At(e.getValue(n)),At(t.getValue(n))),Jm=(e,t,n)=>{const l=e.getValue(n),o=t.getValue(n);return l>o?1:ljo(e.getValue(n),t.getValue(n));function jo(e,t){return e===t?0:e>t?1:-1}function At(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Ru(e,t){const n=e.split(Ro).filter(Boolean),l=t.split(Ro).filter(Boolean);for(;n.length&&l.length;){const o=n.shift(),r=l.shift(),s=parseInt(o,10),u=parseInt(r,10),a=[s,u].sort();if(isNaN(a[0])){if(o>r)return 1;if(r>o)return-1;continue}if(isNaN(a[1]))return isNaN(s)?-1:1;if(s>u)return 1;if(u>s)return-1}return n.length-l.length}const cn={alphanumeric:Xm,alphanumericCaseSensitive:Ym,text:Qm,textCaseSensitive:Km,datetime:Jm,basic:Zm},e_={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Qe("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>({getAutoSortingFn:()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let l=!1;for(const o of n){const r=o==null?void 0:o.getValue(e.id);if(Object.prototype.toString.call(r)==="[object Date]")return cn.datetime;if(typeof r=="string"&&(l=!0,r.split(Ro).length>1))return cn.alphanumeric}return l?cn.text:cn.basic},getAutoSortDir:()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(e.id))=="string"?"asc":"desc"},getSortingFn:()=>{var n,l;if(!e)throw new Error;return Sl(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(l=t.options.sortingFns)==null?void 0:l[e.columnDef.sortingFn])!=null?n:cn[e.columnDef.sortingFn]},toggleSorting:(n,l)=>{const o=e.getNextSortingOrder(),r=typeof n<"u"&&n!==null;t.setSorting(s=>{const u=s==null?void 0:s.find(p=>p.id===e.id),a=s==null?void 0:s.findIndex(p=>p.id===e.id);let f=[],c,d=r?n:o==="desc";if(s!=null&&s.length&&e.getCanMultiSort()&&l?u?c="toggle":c="add":s!=null&&s.length&&a!==s.length-1?c="replace":u?c="toggle":c="replace",c==="toggle"&&(r||o||(c="remove")),c==="add"){var g;f=[...s,{id:e.id,desc:d}],f.splice(0,f.length-((g=t.options.maxMultiSortColCount)!=null?g:Number.MAX_SAFE_INTEGER))}else c==="toggle"?f=s.map(p=>p.id===e.id?{...p,desc:d}:p):c==="remove"?f=s.filter(p=>p.id!==e.id):f=[{id:e.id,desc:d}];return f})},getFirstSortDir:()=>{var n,l;return((n=(l=e.columnDef.sortDescFirst)!=null?l:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},getNextSortingOrder:n=>{var l,o;const r=e.getFirstSortDir(),s=e.getIsSorted();return s?s!==r&&((l=t.options.enableSortingRemoval)==null||l)&&(!(n&&(o=t.options.enableMultiRemove)!=null)||o)?!1:s==="desc"?"asc":"desc":r},getCanSort:()=>{var n,l;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((l=t.options.enableSorting)!=null?l:!0)&&!!e.accessorFn},getCanMultiSort:()=>{var n,l;return(n=(l=e.columnDef.enableMultiSort)!=null?l:t.options.enableMultiSort)!=null?n:!!e.accessorFn},getIsSorted:()=>{var n;const l=(n=t.getState().sorting)==null?void 0:n.find(o=>o.id===e.id);return l?l.desc?"desc":"asc":!1},getSortIndex:()=>{var n,l;return(n=(l=t.getState().sorting)==null?void 0:l.findIndex(o=>o.id===e.id))!=null?n:-1},clearSorting:()=>{t.setSorting(n=>n!=null&&n.length?n.filter(l=>l.id!==e.id):[])},getToggleSortingHandler:()=>{const n=e.getCanSort();return l=>{n&&(l.persist==null||l.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(l):!1))}}}),createTable:e=>({setSorting:t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),resetSorting:t=>{var n,l;e.setSorting(t?[]:(n=(l=e.initialState)==null?void 0:l.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())})},t_={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Qe("columnVisibility",e)}),createColumn:(e,t)=>({toggleVisibility:n=>{e.getCanHide()&&t.setColumnVisibility(l=>({...l,[e.id]:n??!e.getIsVisible()}))},getIsVisible:()=>{var n,l;return(n=(l=t.getState().columnVisibility)==null?void 0:l[e.id])!=null?n:!0},getCanHide:()=>{var n,l;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((l=t.options.enableHiding)!=null?l:!0)},getToggleVisibilityHandler:()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}}),createRow:(e,t)=>({_getAllVisibleCells:oe(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(l=>l.column.getIsVisible()),{key:"row._getAllVisibleCells",debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}}),getVisibleCells:oe(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,l,o)=>[...n,...l,...o],{key:!1,debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}})}),createTable:e=>{const t=(n,l)=>oe(()=>[l(),l().filter(o=>o.getIsVisible()).map(o=>o.id).join("_")],o=>o.filter(r=>r.getIsVisible==null?void 0:r.getIsVisible()),{key:n,debug:()=>{var o;return(o=e.options.debugAll)!=null?o: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 l;e.setColumnVisibility(n?{}:(l=e.initialState.columnVisibility)!=null?l:{})},toggleAllColumnsVisible:n=>{var l;n=(l=n)!=null?l:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((o,r)=>({...o,[r.id]:n||!(r.getCanHide!=null&&r.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 l;e.toggleAllColumnsVisible((l=n.target)==null?void 0:l.checked)}}}},$s=[Mm,t_,jm,Um,Im,e_,Gm,Dm,xm,Wm,Em];function n_(e){var t;(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");let n={_features:$s};const l=n._features.reduce((c,d)=>Object.assign(c,d.getDefaultOptions==null?void 0:d.getDefaultOptions(n)),{}),o=c=>n.options.mergeOptions?n.options.mergeOptions(l,c):{...l,...c};let s={...{},...(t=e.initialState)!=null?t:{}};n._features.forEach(c=>{var d;s=(d=c.getInitialState==null?void 0:c.getInitialState(s))!=null?d:s});const u=[];let a=!1;const f={_features:$s,options:{...l,...e},initialState:s,_queue:c=>{u.push(c),a||(a=!0,Promise.resolve().then(()=>{for(;u.length;)u.shift()();a=!1}).catch(d=>setTimeout(()=>{throw d})))},reset:()=>{n.setState(n.initialState)},setOptions:c=>{const d=$t(c,n.options);n.options=o(d)},getState:()=>n.options.state,setState:c=>{n.options.onStateChange==null||n.options.onStateChange(c)},_getRowId:(c,d,g)=>{var p;return(p=n.options.getRowId==null?void 0:n.options.getRowId(c,d,g))!=null?p:`${g?[g.id,d].join("."):d}`},getCoreRowModel:()=>(n._getCoreRowModel||(n._getCoreRowModel=n.options.getCoreRowModel(n)),n._getCoreRowModel()),getRowModel:()=>n.getPaginationRowModel(),getRow:c=>{const d=n.getRowModel().rowsById[c];if(!d)throw new Error;return d},_getDefaultColumnDef:oe(()=>[n.options.defaultColumn],c=>{var d;return c=(d=c)!=null?d:{},{header:g=>{const p=g.header.column.columnDef;return p.accessorKey?p.accessorKey:p.accessorFn?p.id:null},cell:g=>{var p,m;return(p=(m=g.renderValue())==null||m.toString==null?void 0:m.toString())!=null?p:null},...n._features.reduce((g,p)=>Object.assign(g,p.getDefaultColumnDef==null?void 0:p.getDefaultColumnDef()),{}),...c}},{debug:()=>{var c;return(c=n.options.debugAll)!=null?c:n.options.debugColumns},key:!1}),_getColumnDefs:()=>n.options.columns,getAllColumns:oe(()=>[n._getColumnDefs()],c=>{const d=function(g,p,m){return m===void 0&&(m=0),g.map(_=>{const v=Am(n,_,m,p),y=_;return v.columns=y.columns?d(y.columns,v,m+1):[],v})};return d(c)},{key:!1,debug:()=>{var c;return(c=n.options.debugAll)!=null?c:n.options.debugColumns}}),getAllFlatColumns:oe(()=>[n.getAllColumns()],c=>c.flatMap(d=>d.getFlatColumns()),{key:!1,debug:()=>{var c;return(c=n.options.debugAll)!=null?c:n.options.debugColumns}}),_getAllFlatColumnsById:oe(()=>[n.getAllFlatColumns()],c=>c.reduce((d,g)=>(d[g.id]=g,d),{}),{key:!1,debug:()=>{var c;return(c=n.options.debugAll)!=null?c:n.options.debugColumns}}),getAllLeafColumns:oe(()=>[n.getAllColumns(),n._getOrderColumnsFn()],(c,d)=>{let g=c.flatMap(p=>p.getLeafColumns());return d(g)},{key:!1,debug:()=>{var c;return(c=n.options.debugAll)!=null?c:n.options.debugColumns}}),getColumn:c=>n._getAllFlatColumnsById()[c]};return Object.assign(n,f),n._features.forEach(c=>Object.assign(n,c.createTable==null?void 0:c.createTable(n))),n}function l_(e,t,n,l){const o=()=>{var s;return(s=r.getValue())!=null?s:e.options.renderFallbackValue},r={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(l),renderValue:o,getContext:oe(()=>[e,n,t,r],(s,u,a,f)=>({table:s,column:u,row:a,cell:f,getValue:f.getValue,renderValue:f.renderValue}),{key:!1,debug:()=>e.options.debugAll})};return e._features.forEach(s=>{Object.assign(r,s.createCell==null?void 0:s.createCell(r,n,t,e))},{}),r}const xo=(e,t,n,l,o,r,s)=>{let u={id:t,index:l,original:n,depth:o,parentId:s,_valuesCache:{},_uniqueValuesCache:{},getValue:a=>{if(u._valuesCache.hasOwnProperty(a))return u._valuesCache[a];const f=e.getColumn(a);if(f!=null&&f.accessorFn)return u._valuesCache[a]=f.accessorFn(u.original,l),u._valuesCache[a]},getUniqueValues:a=>{if(u._uniqueValuesCache.hasOwnProperty(a))return u._uniqueValuesCache[a];const f=e.getColumn(a);if(f!=null&&f.accessorFn)return f.columnDef.getUniqueValues?(u._uniqueValuesCache[a]=f.columnDef.getUniqueValues(u.original,l),u._uniqueValuesCache[a]):(u._uniqueValuesCache[a]=[u.getValue(a)],u._uniqueValuesCache[a])},renderValue:a=>{var f;return(f=u.getValue(a))!=null?f:e.options.renderFallbackValue},subRows:r??[],getLeafRows:()=>Rm(u.subRows,a=>a.subRows),getParentRow:()=>u.parentId?e.getRow(u.parentId):void 0,getParentRows:()=>{let a=[],f=u;for(;;){const c=f.getParentRow();if(!c)break;a.push(c),f=c}return a.reverse()},getAllCells:oe(()=>[e.getAllLeafColumns()],a=>a.map(f=>l_(e,u,f,f.id)),{key:!1,debug:()=>{var a;return(a=e.options.debugAll)!=null?a:e.options.debugRows}}),_getAllCellsByColumnId:oe(()=>[u.getAllCells()],a=>a.reduce((f,c)=>(f[c.column.id]=c,f),{}),{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 Rs(){return e=>oe(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},l=function(o,r,s){r===void 0&&(r=0);const u=[];for(let f=0;f{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function Au(e,t,n){return n.options.filterFromLeafRows?i_(e,t,n):r_(e,t,n)}function i_(e,t,n){var l;const o=[],r={},s=(l=n.options.maxLeafRowFilterDepth)!=null?l:100,u=function(a,f){f===void 0&&(f=0);const c=[];for(let g=0;goe(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,l)=>{if(!t.rows.length||!(n!=null&&n.length)&&!l){for(let g=0;g{var p;const m=e.getColumn(g.id);if(!m)return;const _=m.getFilterFn();_&&o.push({id:g.id,filterFn:_,resolvedValue:(p=_.resolveFilterValue==null?void 0:_.resolveFilterValue(g.value))!=null?p:g.value})});const s=n.map(g=>g.id),u=e.getGlobalFilterFn(),a=e.getAllLeafColumns().filter(g=>g.getCanGlobalFilter());l&&u&&a.length&&(s.push("__global__"),a.forEach(g=>{var p;r.push({id:g.id,filterFn:u,resolvedValue:(p=u.resolveFilterValue==null?void 0:u.resolveFilterValue(l))!=null?p:l})}));let f,c;for(let g=0;g{p.columnFiltersMeta[_]=v})}if(r.length){for(let m=0;m{p.columnFiltersMeta[_]=v})){p.columnFilters.__global__=!0;break}}p.columnFilters.__global__!==!0&&(p.columnFilters.__global__=!1)}}const d=g=>{for(let p=0;p{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function Ms(){return(e,t)=>oe(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()],(n,l,o)=>{if(!n.rows.length||!(l!=null&&l.length)&&!o)return n;const r=[...l.map(u=>u.id).filter(u=>u!==t),o?"__global__":void 0].filter(Boolean),s=u=>{for(let a=0;a{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable},onChange:()=>{}})}function Es(){return e=>oe(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const l=e.getState().sorting,o=[],r=l.filter(a=>{var f;return(f=e.getColumn(a.id))==null?void 0:f.getCanSort()}),s={};r.forEach(a=>{const f=e.getColumn(a.id);f&&(s[a.id]={sortUndefined:f.columnDef.sortUndefined,invertSorting:f.columnDef.invertSorting,sortingFn:f.getSortingFn()})});const u=a=>{const f=[...a];return f.sort((c,d)=>{for(let p=0;p{var d;o.push(c),(d=c.subRows)!=null&&d.length&&(c.subRows=u(c.subRows))}),f};return{rows:u(n.rows),flatRows:o,rowsById:n.rowsById}},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function s_(e){const t=[],n=l=>{var o;t.push(l),(o=l.subRows)!=null&&o.length&&l.getIsExpanded()&&l.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function Fs(e){return t=>oe(()=>[t.getState().pagination,t.getPrePaginationRowModel(),t.options.paginateExpandedRows?void 0:t.getState().expanded],(n,l)=>{if(!l.rows.length)return l;const{pageSize:o,pageIndex:r}=n;let{rows:s,flatRows:u,rowsById:a}=l;const f=o*r,c=f+o;s=s.slice(f,c);let d;t.options.paginateExpandedRows?d={rows:s,flatRows:u,rowsById:a}:d=s_({rows:s,flatRows:u,rowsById:a}),d.flatRows=[];const g=p=>{d.flatRows.push(p),p.subRows.length&&p.subRows.forEach(g)};return d.rows.forEach(g),d},{key:!1,debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugTable}})}/** + color: hsl(${Math.max(0,Math.min(120-120*d,120))}deg 100% 31%);`,n==null?void 0:n.key)}return o}}function Fm(e,t,n,l){var o,r;const u={...e._getDefaultColumnDef(),...t},a=u.accessorKey;let f=(o=(r=u.id)!=null?r:a?a.replace(".","_"):void 0)!=null?o:typeof u.header=="string"?u.header:void 0,c;if(u.accessorFn?c=u.accessorFn:a&&(a.includes(".")?c=p=>{let g=p;for(const _ of a.split(".")){var m;g=(m=g)==null?void 0:m[_]}return g}:c=p=>p[u.accessorKey]),!f)throw new Error;let d={id:`${String(f)}`,accessorFn:c,parent:l,depth:n,columnDef:u,columns:[],getFlatColumns:oe(()=>[!0],()=>{var p;return[d,...(p=d.columns)==null?void 0:p.flatMap(g=>g.getFlatColumns())]},{key:"column.getFlatColumns",debug:()=>{var p;return(p=e.options.debugAll)!=null?p:e.options.debugColumns}}),getLeafColumns:oe(()=>[e._getOrderColumnsFn()],p=>{var g;if((g=d.columns)!=null&&g.length){let m=d.columns.flatMap(_=>_.getLeafColumns());return p(m)}return[d]},{key:"column.getLeafColumns",debug:()=>{var p;return(p=e.options.debugAll)!=null?p:e.options.debugColumns}})};return d=e._features.reduce((p,g)=>Object.assign(p,g.createColumn==null?void 0:g.createColumn(d,e)),d),d}function Ss(e,t,n){var l;let r={id:(l=n.id)!=null?l: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 s=[],u=a=>{a.subHeaders&&a.subHeaders.length&&a.subHeaders.map(u),s.push(a)};return u(r),s},getContext:()=>({table:e,header:r,column:t})};return e._features.forEach(s=>{Object.assign(r,s.createHeader==null?void 0:s.createHeader(r,e))}),r}const Dm={createTable:e=>({getHeaderGroups:oe(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,l,o)=>{var r,s;const u=(r=l==null?void 0:l.map(d=>n.find(p=>p.id===d)).filter(Boolean))!=null?r:[],a=(s=o==null?void 0:o.map(d=>n.find(p=>p.id===d)).filter(Boolean))!=null?s:[],f=n.filter(d=>!(l!=null&&l.includes(d.id))&&!(o!=null&&o.includes(d.id)));return Xn(t,[...u,...f,...a],e)},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getCenterHeaderGroups:oe(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,l,o)=>(n=n.filter(r=>!(l!=null&&l.includes(r.id))&&!(o!=null&&o.includes(r.id))),Xn(t,n,e,"center")),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeftHeaderGroups:oe(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,l)=>{var o;const r=(o=l==null?void 0:l.map(s=>n.find(u=>u.id===s)).filter(Boolean))!=null?o:[];return Xn(t,r,e,"left")},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getRightHeaderGroups:oe(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,l)=>{var o;const r=(o=l==null?void 0:l.map(s=>n.find(u=>u.id===s)).filter(Boolean))!=null?o:[];return Xn(t,r,e,"right")},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getFooterGroups:oe(()=>[e.getHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeftFooterGroups:oe(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getCenterFooterGroups:oe(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getRightFooterGroups:oe(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getFlatHeaders:oe(()=>[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:oe(()=>[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:oe(()=>[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:oe(()=>[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:oe(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var l;return!((l=n.subHeaders)!=null&&l.length)}),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeftLeafHeaders:oe(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var l;return!((l=n.subHeaders)!=null&&l.length)}),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getRightLeafHeaders:oe(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var l;return!((l=n.subHeaders)!=null&&l.length)}),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugHeaders}}),getLeafHeaders:oe(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,l)=>{var o,r,s,u,a,f;return[...(o=(r=t[0])==null?void 0:r.headers)!=null?o:[],...(s=(u=n[0])==null?void 0:u.headers)!=null?s:[],...(a=(f=l[0])==null?void 0:f.headers)!=null?a:[]].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,l){var o,r;let s=0;const u=function(p,g){g===void 0&&(g=1),s=Math.max(s,g),p.filter(m=>m.getIsVisible()).forEach(m=>{var _;(_=m.columns)!=null&&_.length&&u(m.columns,g+1)},0)};u(e);let a=[];const f=(p,g)=>{const m={depth:g,id:[l,`${g}`].filter(Boolean).join("_"),headers:[]},_=[];p.forEach(v=>{const y=[..._].reverse()[0],w=v.column.depth===m.depth;let S,M=!1;if(w&&v.column.parent?S=v.column.parent:(S=v.column,M=!0),y&&(y==null?void 0:y.column)===S)y.subHeaders.push(v);else{const $=Ss(n,S,{id:[l,g,S.id,v==null?void 0:v.id].filter(Boolean).join("_"),isPlaceholder:M,placeholderId:M?`${_.filter(F=>F.column===S).length}`:void 0,depth:g,index:_.length});$.subHeaders.push(v),_.push($)}m.headers.push(v),v.headerGroup=m}),a.push(m),g>0&&f(_,g-1)},c=t.map((p,g)=>Ss(n,p,{depth:s,index:g}));f(c,s-1),a.reverse();const d=p=>p.filter(m=>m.column.getIsVisible()).map(m=>{let _=0,v=0,y=[0];m.subHeaders&&m.subHeaders.length?(y=[],d(m.subHeaders).forEach(S=>{let{colSpan:M,rowSpan:$}=S;_+=M,y.push($)})):_=1;const w=Math.min(...y);return v=v+w,m.colSpan=_,m.rowSpan=v,{colSpan:_,rowSpan:v}});return d((o=(r=a[0])==null?void 0:r.headers)!=null?o:[]),a}const Yn={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Wl=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Im={getDefaultColumnDef:()=>Yn,getInitialState:e=>({columnSizing:{},columnSizingInfo:Wl(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",onColumnSizingChange:Qe("columnSizing",e),onColumnSizingInfoChange:Qe("columnSizingInfo",e)}),createColumn:(e,t)=>({getSize:()=>{var n,l,o;const r=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:Yn.minSize,(l=r??e.columnDef.size)!=null?l:Yn.size),(o=e.columnDef.maxSize)!=null?o:Yn.maxSize)},getStart:n=>{const l=n?n==="left"?t.getLeftVisibleLeafColumns():t.getRightVisibleLeafColumns():t.getVisibleLeafColumns(),o=l.findIndex(r=>r.id===e.id);if(o>0){const r=l[o-1];return r.getStart(n)+r.getSize()}return 0},resetSize:()=>{t.setColumnSizing(n=>{let{[e.id]:l,...o}=n;return o})},getCanResize:()=>{var n,l;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((l=t.options.enableColumnResizing)!=null?l:!0)},getIsResizing:()=>t.getState().columnSizingInfo.isResizingColumn===e.id}),createHeader:(e,t)=>({getSize:()=>{let n=0;const l=o=>{if(o.subHeaders.length)o.subHeaders.forEach(l);else{var r;n+=(r=o.column.getSize())!=null?r:0}};return l(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),l=n==null?void 0:n.getCanResize();return o=>{if(!n||!l||(o.persist==null||o.persist(),Xl(o)&&o.touches&&o.touches.length>1))return;const r=e.getSize(),s=e?e.getLeafHeaders().map(_=>[_.column.id,_.column.getSize()]):[[n.id,n.getSize()]],u=Xl(o)?Math.round(o.touches[0].clientX):o.clientX,a={},f=(_,v)=>{typeof v=="number"&&(t.setColumnSizingInfo(y=>{var w,S;const M=v-((w=y==null?void 0:y.startOffset)!=null?w:0),$=Math.max(M/((S=y==null?void 0:y.startSize)!=null?S:0),-.999999);return y.columnSizingStart.forEach(F=>{let[C,R]=F;a[C]=Math.round(Math.max(R+R*$,0)*100)/100}),{...y,deltaOffset:M,deltaPercentage:$}}),(t.options.columnResizeMode==="onChange"||_==="end")&&t.setColumnSizing(y=>({...y,...a})))},c=_=>f("move",_),d=_=>{f("end",_),t.setColumnSizingInfo(v=>({...v,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},p={moveHandler:_=>c(_.clientX),upHandler:_=>{document.removeEventListener("mousemove",p.moveHandler),document.removeEventListener("mouseup",p.upHandler),d(_.clientX)}},g={moveHandler:_=>(_.cancelable&&(_.preventDefault(),_.stopPropagation()),c(_.touches[0].clientX),!1),upHandler:_=>{var v;document.removeEventListener("touchmove",g.moveHandler),document.removeEventListener("touchend",g.upHandler),_.cancelable&&(_.preventDefault(),_.stopPropagation()),d((v=_.touches[0])==null?void 0:v.clientX)}},m=Nm()?{passive:!1}:!1;Xl(o)?(document.addEventListener("touchmove",g.moveHandler,m),document.addEventListener("touchend",g.upHandler,m)):(document.addEventListener("mousemove",p.moveHandler,m),document.addEventListener("mouseup",p.upHandler,m)),t.setColumnSizingInfo(_=>({..._,startOffset:u,startSize:r,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,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?Wl():(n=e.initialState.columnSizingInfo)!=null?n:Wl())},getTotalSize:()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((l,o)=>l+o.getSize(),0))!=null?t:0},getLeftTotalSize:()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((l,o)=>l+o.getSize(),0))!=null?t:0},getCenterTotalSize:()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((l,o)=>l+o.getSize(),0))!=null?t:0},getRightTotalSize:()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((l,o)=>l+o.getSize(),0))!=null?t:0}})};let Qn=null;function Nm(){if(typeof Qn=="boolean")return Qn;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 Qn=e,Qn}function Xl(e){return e.type==="touchstart"}const Pm={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Qe("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;return{_autoResetExpanded:()=>{var l,o;if(!t){e._queue(()=>{t=!0});return}if((l=(o=e.options.autoResetAll)!=null?o:e.options.autoResetExpanded)!=null?l:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},setExpanded:l=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(l),toggleAllRowsExpanded:l=>{l??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},resetExpanded:l=>{var o,r;e.setExpanded(l?{}:(o=(r=e.initialState)==null?void 0:r.expanded)!=null?o:{})},getCanSomeRowsExpand:()=>e.getPrePaginationRowModel().flatRows.some(l=>l.getCanExpand()),getToggleAllRowsExpandedHandler:()=>l=>{l.persist==null||l.persist(),e.toggleAllRowsExpanded()},getIsSomeRowsExpanded:()=>{const l=e.getState().expanded;return l===!0||Object.values(l).some(Boolean)},getIsAllRowsExpanded:()=>{const l=e.getState().expanded;return typeof l=="boolean"?l===!0:!(!Object.keys(l).length||e.getRowModel().flatRows.some(o=>!o.getIsExpanded()))},getExpandedDepth:()=>{let l=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(r=>{const s=r.split(".");l=Math.max(l,s.length)}),l},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(l=>{var o;const r=l===!0?!0:!!(l!=null&&l[e.id]);let s={};if(l===!0?Object.keys(t.getRowModel().rowsById).forEach(u=>{s[u]=!0}):s=l,n=(o=n)!=null?o:!r,!r&&n)return{...s,[e.id]:!0};if(r&&!n){const{[e.id]:u,...a}=s;return a}return l})},getIsExpanded:()=>{var n;const l=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:l===!0||l!=null&&l[e.id])},getCanExpand:()=>{var n,l,o;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((l=t.options.enableExpanding)!=null?l:!0)&&!!((o=e.subRows)!=null&&o.length)},getToggleExpandedHandler:()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}})},wu=(e,t,n)=>{var l,o,r;const s=n.toLowerCase();return!!(!((l=e.getValue(t))==null||(o=l.toString())==null||(r=o.toLowerCase())==null)&&r.includes(s))};wu.autoRemove=e=>Ze(e);const yu=(e,t,n)=>{var l,o;return!!(!((l=e.getValue(t))==null||(o=l.toString())==null)&&o.includes(n))};yu.autoRemove=e=>Ze(e);const ku=(e,t,n)=>{var l,o;return((l=e.getValue(t))==null||(o=l.toString())==null?void 0:o.toLowerCase())===(n==null?void 0:n.toLowerCase())};ku.autoRemove=e=>Ze(e);const Su=(e,t,n)=>{var l;return(l=e.getValue(t))==null?void 0:l.includes(n)};Su.autoRemove=e=>Ze(e)||!(e!=null&&e.length);const Cu=(e,t,n)=>!n.some(l=>{var o;return!((o=e.getValue(t))!=null&&o.includes(l))});Cu.autoRemove=e=>Ze(e)||!(e!=null&&e.length);const $u=(e,t,n)=>n.some(l=>{var o;return(o=e.getValue(t))==null?void 0:o.includes(l)});$u.autoRemove=e=>Ze(e)||!(e!=null&&e.length);const Au=(e,t,n)=>e.getValue(t)===n;Au.autoRemove=e=>Ze(e);const Ru=(e,t,n)=>e.getValue(t)==n;Ru.autoRemove=e=>Ze(e);const Go=(e,t,n)=>{let[l,o]=n;const r=e.getValue(t);return r>=l&&r<=o};Go.resolveFilterValue=e=>{let[t,n]=e,l=typeof t!="number"?parseFloat(t):t,o=typeof n!="number"?parseFloat(n):n,r=t===null||Number.isNaN(l)?-1/0:l,s=n===null||Number.isNaN(o)?1/0:o;if(r>s){const u=r;r=s,s=u}return[r,s]};Go.autoRemove=e=>Ze(e)||Ze(e[0])&&Ze(e[1]);const ct={includesString:wu,includesStringSensitive:yu,equalsString:ku,arrIncludes:Su,arrIncludesAll:Cu,arrIncludesSome:$u,equals:Au,weakEquals:Ru,inNumberRange:Go};function Ze(e){return e==null||e===""}const Tm={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:Qe("columnFilters",e),onGlobalFilterChange:Qe("globalFilter",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100,globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n,l;const o=(n=e.getCoreRowModel().flatRows[0])==null||(l=n._getAllCellsByColumnId()[t.id])==null?void 0:l.getValue();return typeof o=="string"||typeof o=="number"}}),createColumn:(e,t)=>({getAutoFilterFn:()=>{const n=t.getCoreRowModel().flatRows[0],l=n==null?void 0:n.getValue(e.id);return typeof l=="string"?ct.includesString:typeof l=="number"?ct.inNumberRange:typeof l=="boolean"||l!==null&&typeof l=="object"?ct.equals:Array.isArray(l)?ct.arrIncludes:ct.weakEquals},getFilterFn:()=>{var n,l;return Cl(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(l=t.options.filterFns)==null?void 0:l[e.columnDef.filterFn])!=null?n:ct[e.columnDef.filterFn]},getCanFilter:()=>{var n,l,o;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((l=t.options.enableColumnFilters)!=null?l:!0)&&((o=t.options.enableFilters)!=null?o:!0)&&!!e.accessorFn},getCanGlobalFilter:()=>{var n,l,o,r;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((l=t.options.enableGlobalFilter)!=null?l:!0)&&((o=t.options.enableFilters)!=null?o:!0)&&((r=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?r:!0)&&!!e.accessorFn},getIsFiltered:()=>e.getFilterIndex()>-1,getFilterValue:()=>{var n,l;return(n=t.getState().columnFilters)==null||(l=n.find(o=>o.id===e.id))==null?void 0:l.value},getFilterIndex:()=>{var n,l;return(n=(l=t.getState().columnFilters)==null?void 0:l.findIndex(o=>o.id===e.id))!=null?n:-1},setFilterValue:n=>{t.setColumnFilters(l=>{const o=e.getFilterFn(),r=l==null?void 0:l.find(c=>c.id===e.id),s=$t(n,r?r.value:void 0);if(Cs(o,s,e)){var u;return(u=l==null?void 0:l.filter(c=>c.id!==e.id))!=null?u:[]}const a={id:e.id,value:s};if(r){var f;return(f=l==null?void 0:l.map(c=>c.id===e.id?a:c))!=null?f:[]}return l!=null&&l.length?[...l,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:()=>ct.includesString,getGlobalFilterFn:()=>{var t,n;const{globalFilterFn:l}=e.options;return Cl(l)?l:l==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[l])!=null?t:ct[l]},setColumnFilters:t=>{const n=e.getAllLeafColumns(),l=o=>{var r;return(r=$t(t,o))==null?void 0:r.filter(s=>{const u=n.find(a=>a.id===s.id);if(u){const a=u.getFilterFn();if(Cs(a,s.value,u))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(l)},setGlobalFilter:t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},resetGlobalFilter:t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)},resetColumnFilters:t=>{var n,l;e.setColumnFilters(t?[]:(n=(l=e.initialState)==null?void 0:l.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 Cs(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const Om=(e,t,n)=>n.reduce((l,o)=>{const r=o.getValue(e);return l+(typeof r=="number"?r:0)},0),Vm=(e,t,n)=>{let l;return n.forEach(o=>{const r=o.getValue(e);r!=null&&(l>r||l===void 0&&r>=r)&&(l=r)}),l},zm=(e,t,n)=>{let l;return n.forEach(o=>{const r=o.getValue(e);r!=null&&(l=r)&&(l=r)}),l},Lm=(e,t,n)=>{let l,o;return n.forEach(r=>{const s=r.getValue(e);s!=null&&(l===void 0?s>=s&&(l=o=s):(l>s&&(l=s),o{let n=0,l=0;if(t.forEach(o=>{let r=o.getValue(e);r!=null&&(r=+r)>=r&&(++n,l+=r)}),n)return l/n},Hm=(e,t)=>{if(!t.length)return;const n=t.map(r=>r.getValue(e));if(!Mm(n))return;if(n.length===1)return n[0];const l=Math.floor(n.length/2),o=n.sort((r,s)=>r-s);return n.length%2!==0?o[l]:(o[l-1]+o[l])/2},Gm=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),Bm=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,jm=(e,t)=>t.length,Yl={sum:Om,min:Vm,max:zm,extent:Lm,mean:qm,median:Hm,unique:Gm,uniqueCount:Bm,count:jm},xm={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:Qe("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>({toggleGrouping:()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(l=>l!==e.id):[...n??[],e.id])},getCanGroup:()=>{var n,l,o,r;return(n=(l=(o=(r=e.columnDef.enableGrouping)!=null?r:!0)!=null?o:t.options.enableGrouping)!=null?l:!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],l=n==null?void 0:n.getValue(e.id);if(typeof l=="number")return Yl.sum;if(Object.prototype.toString.call(l)==="[object Date]")return Yl.extent},getAggregationFn:()=>{var n,l;if(!e)throw new Error;return Cl(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(l=t.options.aggregationFns)==null?void 0:l[e.columnDef.aggregationFn])!=null?n:Yl[e.columnDef.aggregationFn]}}),createTable:e=>({setGrouping:t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),resetGrouping:t=>{var n,l;e.setGrouping(t?[]:(n=(l=e.initialState)==null?void 0:l.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 l=t.getColumn(n);return l!=null&&l.columnDef.getGroupingValue?(e._groupingValuesCache[n]=l.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},_groupingValuesCache:{}}),createCell:(e,t,n,l)=>({getIsGrouped:()=>t.getIsGrouped()&&t.id===n.groupingColumnId,getIsPlaceholder:()=>!e.getIsGrouped()&&t.getIsGrouped(),getIsAggregated:()=>{var o;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((o=n.subRows)!=null&&o.length)}})};function Um(e,t,n){if(!(t!=null&&t.length)||!n)return e;const l=e.filter(r=>!t.includes(r.id));return n==="remove"?l:[...t.map(r=>e.find(s=>s.id===r)).filter(Boolean),...l]}const Wm={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Qe("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:oe(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,l)=>o=>{let r=[];if(!(t!=null&&t.length))r=o;else{const s=[...t],u=[...o];for(;u.length&&s.length;){const a=s.shift(),f=u.findIndex(c=>c.id===a);f>-1&&r.push(u.splice(f,1)[0])}r=[...r,...u]}return Um(r,n,l)},{key:!1})})},So=0,Co=10,Ql=()=>({pageIndex:So,pageSize:Co}),Xm={getInitialState:e=>({...e,pagination:{...Ql(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Qe("pagination",e)}),createTable:e=>{let t=!1,n=!1;return{_autoResetPageIndex:()=>{var l,o;if(!t){e._queue(()=>{t=!0});return}if((l=(o=e.options.autoResetAll)!=null?o:e.options.autoResetPageIndex)!=null?l:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},setPagination:l=>{const o=r=>$t(l,r);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(o)},resetPagination:l=>{var o;e.setPagination(l?Ql():(o=e.initialState.pagination)!=null?o:Ql())},setPageIndex:l=>{e.setPagination(o=>{let r=$t(l,o.pageIndex);const s=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return r=Math.max(0,Math.min(r,s)),{...o,pageIndex:r}})},resetPageIndex:l=>{var o,r,s;e.setPageIndex(l?So:(o=(r=e.initialState)==null||(s=r.pagination)==null?void 0:s.pageIndex)!=null?o:So)},resetPageSize:l=>{var o,r,s;e.setPageSize(l?Co:(o=(r=e.initialState)==null||(s=r.pagination)==null?void 0:s.pageSize)!=null?o:Co)},setPageSize:l=>{e.setPagination(o=>{const r=Math.max(1,$t(l,o.pageSize)),s=o.pageSize*o.pageIndex,u=Math.floor(s/r);return{...o,pageIndex:u,pageSize:r}})},setPageCount:l=>e.setPagination(o=>{var r;let s=$t(l,(r=e.options.pageCount)!=null?r:-1);return typeof s=="number"&&(s=Math.max(-1,s)),{...o,pageCount:s}}),getPageOptions:oe(()=>[e.getPageCount()],l=>{let o=[];return l&&l>0&&(o=[...new Array(l)].fill(null).map((r,s)=>s)),o},{key:!1,debug:()=>{var l;return(l=e.options.debugAll)!=null?l:e.options.debugTable}}),getCanPreviousPage:()=>e.getState().pagination.pageIndex>0,getCanNextPage:()=>{const{pageIndex:l}=e.getState().pagination,o=e.getPageCount();return o===-1?!0:o===0?!1:le.setPageIndex(l=>l-1),nextPage:()=>e.setPageIndex(l=>l+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 l;return(l=e.options.pageCount)!=null?l:Math.ceil(e.getPrePaginationRowModel().rows.length/e.getState().pagination.pageSize)}}}},Kl=()=>({left:[],right:[]}),Ym={getInitialState:e=>({columnPinning:Kl(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Qe("columnPinning",e)}),createColumn:(e,t)=>({pin:n=>{const l=e.getLeafColumns().map(o=>o.id).filter(Boolean);t.setColumnPinning(o=>{var r,s;if(n==="right"){var u,a;return{left:((u=o==null?void 0:o.left)!=null?u:[]).filter(d=>!(l!=null&&l.includes(d))),right:[...((a=o==null?void 0:o.right)!=null?a:[]).filter(d=>!(l!=null&&l.includes(d))),...l]}}if(n==="left"){var f,c;return{left:[...((f=o==null?void 0:o.left)!=null?f:[]).filter(d=>!(l!=null&&l.includes(d))),...l],right:((c=o==null?void 0:o.right)!=null?c:[]).filter(d=>!(l!=null&&l.includes(d)))}}return{left:((r=o==null?void 0:o.left)!=null?r:[]).filter(d=>!(l!=null&&l.includes(d))),right:((s=o==null?void 0:o.right)!=null?s:[]).filter(d=>!(l!=null&&l.includes(d)))}})},getCanPin:()=>e.getLeafColumns().some(l=>{var o,r;return((o=l.columnDef.enablePinning)!=null?o:!0)&&((r=t.options.enablePinning)!=null?r:!0)}),getIsPinned:()=>{const n=e.getLeafColumns().map(u=>u.id),{left:l,right:o}=t.getState().columnPinning,r=n.some(u=>l==null?void 0:l.includes(u)),s=n.some(u=>o==null?void 0:o.includes(u));return r?"left":s?"right":!1},getPinnedIndex:()=>{var n,l,o;const r=e.getIsPinned();return r?(n=(l=t.getState().columnPinning)==null||(o=l[r])==null?void 0:o.indexOf(e.id))!=null?n:-1:0}}),createRow:(e,t)=>({getCenterVisibleCells:oe(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,l,o)=>{const r=[...l??[],...o??[]];return n.filter(s=>!r.includes(s.column.id))},{key:"row.getCenterVisibleCells",debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}}),getLeftVisibleCells:oe(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,,],(n,l)=>(l??[]).map(r=>n.find(s=>s.column.id===r)).filter(Boolean).map(r=>({...r,position:"left"})),{key:"row.getLeftVisibleCells",debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}}),getRightVisibleCells:oe(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,l)=>(l??[]).map(r=>n.find(s=>s.column.id===r)).filter(Boolean).map(r=>({...r,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,l;return e.setColumnPinning(t?Kl():(n=(l=e.initialState)==null?void 0:l.columnPinning)!=null?n:Kl())},getIsSomeColumnsPinned:t=>{var n;const l=e.getState().columnPinning;if(!t){var o,r;return!!((o=l.left)!=null&&o.length||(r=l.right)!=null&&r.length)}return!!((n=l[t])!=null&&n.length)},getLeftLeafColumns:oe(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(l=>t.find(o=>o.id===l)).filter(Boolean),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugColumns}}),getRightLeafColumns:oe(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(l=>t.find(o=>o.id===l)).filter(Boolean),{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugColumns}}),getCenterLeafColumns:oe(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,l)=>{const o=[...n??[],...l??[]];return t.filter(r=>!o.includes(r.id))},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugColumns}})})},Qm={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Qe("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 l={...n},o=e.getPreGroupedRowModel().flatRows;return t?o.forEach(r=>{r.getCanSelect()&&(l[r.id]=!0)}):o.forEach(r=>{delete l[r.id]}),l})},toggleAllPageRowsSelected:t=>e.setRowSelection(n=>{const l=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),o={...n};return e.getRowModel().rows.forEach(r=>{$o(o,r.id,l,e)}),o}),getPreSelectedRowModel:()=>e.getCoreRowModel(),getSelectedRowModel:oe(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?Jl(e,n):{rows:[],flatRows:[],rowsById:{}},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable}}),getFilteredSelectedRowModel:oe(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?Jl(e,n):{rows:[],flatRows:[],rowsById:{}},{key:"getFilteredSelectedRowModel",debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable}}),getGroupedSelectedRowModel:oe(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?Jl(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 l=!!(t.length&&Object.keys(n).length);return l&&t.some(o=>o.getCanSelect()&&!n[o.id])&&(l=!1),l},getIsAllPageRowsSelected:()=>{const t=e.getPaginationRowModel().flatRows.filter(o=>o.getCanSelect()),{rowSelection:n}=e.getState();let l=!!t.length;return l&&t.some(o=>!n[o.id])&&(l=!1),l},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 l=e.getIsSelected();t.setRowSelection(o=>{if(n=typeof n<"u"?n:!l,l===n)return o;const r={...o};return $o(r,e.id,n,t),r})},getIsSelected:()=>{const{rowSelection:n}=t.getState();return Bo(e,n)},getIsSomeSelected:()=>{const{rowSelection:n}=t.getState();return $s(e,n)==="some"},getIsAllSubRowsSelected:()=>{const{rowSelection:n}=t.getState();return $s(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 l=>{var o;n&&e.toggleSelected((o=l.target)==null?void 0:o.checked)}}})},$o=(e,t,n,l)=>{var o;const r=l.getRow(t);n?(r.getCanMultiSelect()||Object.keys(e).forEach(s=>delete e[s]),r.getCanSelect()&&(e[t]=!0)):delete e[t],(o=r.subRows)!=null&&o.length&&r.getCanSelectSubRows()&&r.subRows.forEach(s=>$o(e,s.id,n,l))};function Jl(e,t){const n=e.getState().rowSelection,l=[],o={},r=function(s,u){return s.map(a=>{var f;const c=Bo(a,n);if(c&&(l.push(a),o[a.id]=a),(f=a.subRows)!=null&&f.length&&(a={...a,subRows:r(a.subRows)}),c)return a}).filter(Boolean)};return{rows:r(t.rows),flatRows:l,rowsById:o}}function Bo(e,t){var n;return(n=t[e.id])!=null?n:!1}function $s(e,t,n){if(e.subRows&&e.subRows.length){let l=!0,o=!1;return e.subRows.forEach(r=>{o&&!l||(Bo(r,t)?o=!0:l=!1)}),l?"all":o?"some":!1}return!1}const Ao=/([0-9]+)/gm,Km=(e,t,n)=>Mu(Rt(e.getValue(n)).toLowerCase(),Rt(t.getValue(n)).toLowerCase()),Jm=(e,t,n)=>Mu(Rt(e.getValue(n)),Rt(t.getValue(n))),Zm=(e,t,n)=>jo(Rt(e.getValue(n)).toLowerCase(),Rt(t.getValue(n)).toLowerCase()),e_=(e,t,n)=>jo(Rt(e.getValue(n)),Rt(t.getValue(n))),t_=(e,t,n)=>{const l=e.getValue(n),o=t.getValue(n);return l>o?1:ljo(e.getValue(n),t.getValue(n));function jo(e,t){return e===t?0:e>t?1:-1}function Rt(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Mu(e,t){const n=e.split(Ao).filter(Boolean),l=t.split(Ao).filter(Boolean);for(;n.length&&l.length;){const o=n.shift(),r=l.shift(),s=parseInt(o,10),u=parseInt(r,10),a=[s,u].sort();if(isNaN(a[0])){if(o>r)return 1;if(r>o)return-1;continue}if(isNaN(a[1]))return isNaN(s)?-1:1;if(s>u)return 1;if(u>s)return-1}return n.length-l.length}const hn={alphanumeric:Km,alphanumericCaseSensitive:Jm,text:Zm,textCaseSensitive:e_,datetime:t_,basic:n_},l_={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Qe("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>({getAutoSortingFn:()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let l=!1;for(const o of n){const r=o==null?void 0:o.getValue(e.id);if(Object.prototype.toString.call(r)==="[object Date]")return hn.datetime;if(typeof r=="string"&&(l=!0,r.split(Ao).length>1))return hn.alphanumeric}return l?hn.text:hn.basic},getAutoSortDir:()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(e.id))=="string"?"asc":"desc"},getSortingFn:()=>{var n,l;if(!e)throw new Error;return Cl(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(l=t.options.sortingFns)==null?void 0:l[e.columnDef.sortingFn])!=null?n:hn[e.columnDef.sortingFn]},toggleSorting:(n,l)=>{const o=e.getNextSortingOrder(),r=typeof n<"u"&&n!==null;t.setSorting(s=>{const u=s==null?void 0:s.find(g=>g.id===e.id),a=s==null?void 0:s.findIndex(g=>g.id===e.id);let f=[],c,d=r?n:o==="desc";if(s!=null&&s.length&&e.getCanMultiSort()&&l?u?c="toggle":c="add":s!=null&&s.length&&a!==s.length-1?c="replace":u?c="toggle":c="replace",c==="toggle"&&(r||o||(c="remove")),c==="add"){var p;f=[...s,{id:e.id,desc:d}],f.splice(0,f.length-((p=t.options.maxMultiSortColCount)!=null?p:Number.MAX_SAFE_INTEGER))}else c==="toggle"?f=s.map(g=>g.id===e.id?{...g,desc:d}:g):c==="remove"?f=s.filter(g=>g.id!==e.id):f=[{id:e.id,desc:d}];return f})},getFirstSortDir:()=>{var n,l;return((n=(l=e.columnDef.sortDescFirst)!=null?l:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},getNextSortingOrder:n=>{var l,o;const r=e.getFirstSortDir(),s=e.getIsSorted();return s?s!==r&&((l=t.options.enableSortingRemoval)==null||l)&&(!(n&&(o=t.options.enableMultiRemove)!=null)||o)?!1:s==="desc"?"asc":"desc":r},getCanSort:()=>{var n,l;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((l=t.options.enableSorting)!=null?l:!0)&&!!e.accessorFn},getCanMultiSort:()=>{var n,l;return(n=(l=e.columnDef.enableMultiSort)!=null?l:t.options.enableMultiSort)!=null?n:!!e.accessorFn},getIsSorted:()=>{var n;const l=(n=t.getState().sorting)==null?void 0:n.find(o=>o.id===e.id);return l?l.desc?"desc":"asc":!1},getSortIndex:()=>{var n,l;return(n=(l=t.getState().sorting)==null?void 0:l.findIndex(o=>o.id===e.id))!=null?n:-1},clearSorting:()=>{t.setSorting(n=>n!=null&&n.length?n.filter(l=>l.id!==e.id):[])},getToggleSortingHandler:()=>{const n=e.getCanSort();return l=>{n&&(l.persist==null||l.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(l):!1))}}}),createTable:e=>({setSorting:t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),resetSorting:t=>{var n,l;e.setSorting(t?[]:(n=(l=e.initialState)==null?void 0:l.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())})},o_={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Qe("columnVisibility",e)}),createColumn:(e,t)=>({toggleVisibility:n=>{e.getCanHide()&&t.setColumnVisibility(l=>({...l,[e.id]:n??!e.getIsVisible()}))},getIsVisible:()=>{var n,l;return(n=(l=t.getState().columnVisibility)==null?void 0:l[e.id])!=null?n:!0},getCanHide:()=>{var n,l;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((l=t.options.enableHiding)!=null?l:!0)},getToggleVisibilityHandler:()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}}),createRow:(e,t)=>({_getAllVisibleCells:oe(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(l=>l.column.getIsVisible()),{key:"row._getAllVisibleCells",debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}}),getVisibleCells:oe(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,l,o)=>[...n,...l,...o],{key:!1,debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugRows}})}),createTable:e=>{const t=(n,l)=>oe(()=>[l(),l().filter(o=>o.getIsVisible()).map(o=>o.id).join("_")],o=>o.filter(r=>r.getIsVisible==null?void 0:r.getIsVisible()),{key:n,debug:()=>{var o;return(o=e.options.debugAll)!=null?o: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 l;e.setColumnVisibility(n?{}:(l=e.initialState.columnVisibility)!=null?l:{})},toggleAllColumnsVisible:n=>{var l;n=(l=n)!=null?l:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((o,r)=>({...o,[r.id]:n||!(r.getCanHide!=null&&r.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 l;e.toggleAllColumnsVisible((l=n.target)==null?void 0:l.checked)}}}},As=[Dm,o_,Wm,Ym,Tm,l_,xm,Pm,Xm,Qm,Im];function i_(e){var t;(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");let n={_features:As};const l=n._features.reduce((c,d)=>Object.assign(c,d.getDefaultOptions==null?void 0:d.getDefaultOptions(n)),{}),o=c=>n.options.mergeOptions?n.options.mergeOptions(l,c):{...l,...c};let s={...{},...(t=e.initialState)!=null?t:{}};n._features.forEach(c=>{var d;s=(d=c.getInitialState==null?void 0:c.getInitialState(s))!=null?d:s});const u=[];let a=!1;const f={_features:As,options:{...l,...e},initialState:s,_queue:c=>{u.push(c),a||(a=!0,Promise.resolve().then(()=>{for(;u.length;)u.shift()();a=!1}).catch(d=>setTimeout(()=>{throw d})))},reset:()=>{n.setState(n.initialState)},setOptions:c=>{const d=$t(c,n.options);n.options=o(d)},getState:()=>n.options.state,setState:c=>{n.options.onStateChange==null||n.options.onStateChange(c)},_getRowId:(c,d,p)=>{var g;return(g=n.options.getRowId==null?void 0:n.options.getRowId(c,d,p))!=null?g:`${p?[p.id,d].join("."):d}`},getCoreRowModel:()=>(n._getCoreRowModel||(n._getCoreRowModel=n.options.getCoreRowModel(n)),n._getCoreRowModel()),getRowModel:()=>n.getPaginationRowModel(),getRow:c=>{const d=n.getRowModel().rowsById[c];if(!d)throw new Error;return d},_getDefaultColumnDef:oe(()=>[n.options.defaultColumn],c=>{var d;return c=(d=c)!=null?d:{},{header:p=>{const g=p.header.column.columnDef;return g.accessorKey?g.accessorKey:g.accessorFn?g.id:null},cell:p=>{var g,m;return(g=(m=p.renderValue())==null||m.toString==null?void 0:m.toString())!=null?g:null},...n._features.reduce((p,g)=>Object.assign(p,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:oe(()=>[n._getColumnDefs()],c=>{const d=function(p,g,m){return m===void 0&&(m=0),p.map(_=>{const v=Fm(n,_,m,g),y=_;return v.columns=y.columns?d(y.columns,v,m+1):[],v})};return d(c)},{key:!1,debug:()=>{var c;return(c=n.options.debugAll)!=null?c:n.options.debugColumns}}),getAllFlatColumns:oe(()=>[n.getAllColumns()],c=>c.flatMap(d=>d.getFlatColumns()),{key:!1,debug:()=>{var c;return(c=n.options.debugAll)!=null?c:n.options.debugColumns}}),_getAllFlatColumnsById:oe(()=>[n.getAllFlatColumns()],c=>c.reduce((d,p)=>(d[p.id]=p,d),{}),{key:!1,debug:()=>{var c;return(c=n.options.debugAll)!=null?c:n.options.debugColumns}}),getAllLeafColumns:oe(()=>[n.getAllColumns(),n._getOrderColumnsFn()],(c,d)=>{let p=c.flatMap(g=>g.getLeafColumns());return d(p)},{key:!1,debug:()=>{var c;return(c=n.options.debugAll)!=null?c:n.options.debugColumns}}),getColumn:c=>n._getAllFlatColumnsById()[c]};return Object.assign(n,f),n._features.forEach(c=>Object.assign(n,c.createTable==null?void 0:c.createTable(n))),n}function r_(e,t,n,l){const o=()=>{var s;return(s=r.getValue())!=null?s:e.options.renderFallbackValue},r={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(l),renderValue:o,getContext:oe(()=>[e,n,t,r],(s,u,a,f)=>({table:s,column:u,row:a,cell:f,getValue:f.getValue,renderValue:f.renderValue}),{key:!1,debug:()=>e.options.debugAll})};return e._features.forEach(s=>{Object.assign(r,s.createCell==null?void 0:s.createCell(r,n,t,e))},{}),r}const xo=(e,t,n,l,o,r,s)=>{let u={id:t,index:l,original:n,depth:o,parentId:s,_valuesCache:{},_uniqueValuesCache:{},getValue:a=>{if(u._valuesCache.hasOwnProperty(a))return u._valuesCache[a];const f=e.getColumn(a);if(f!=null&&f.accessorFn)return u._valuesCache[a]=f.accessorFn(u.original,l),u._valuesCache[a]},getUniqueValues:a=>{if(u._uniqueValuesCache.hasOwnProperty(a))return u._uniqueValuesCache[a];const f=e.getColumn(a);if(f!=null&&f.accessorFn)return f.columnDef.getUniqueValues?(u._uniqueValuesCache[a]=f.columnDef.getUniqueValues(u.original,l),u._uniqueValuesCache[a]):(u._uniqueValuesCache[a]=[u.getValue(a)],u._uniqueValuesCache[a])},renderValue:a=>{var f;return(f=u.getValue(a))!=null?f:e.options.renderFallbackValue},subRows:r??[],getLeafRows:()=>Em(u.subRows,a=>a.subRows),getParentRow:()=>u.parentId?e.getRow(u.parentId):void 0,getParentRows:()=>{let a=[],f=u;for(;;){const c=f.getParentRow();if(!c)break;a.push(c),f=c}return a.reverse()},getAllCells:oe(()=>[e.getAllLeafColumns()],a=>a.map(f=>r_(e,u,f,f.id)),{key:!1,debug:()=>{var a;return(a=e.options.debugAll)!=null?a:e.options.debugRows}}),_getAllCellsByColumnId:oe(()=>[u.getAllCells()],a=>a.reduce((f,c)=>(f[c.column.id]=c,f),{}),{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 Rs(){return e=>oe(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},l=function(o,r,s){r===void 0&&(r=0);const u=[];for(let f=0;f{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function Eu(e,t,n){return n.options.filterFromLeafRows?a_(e,t,n):u_(e,t,n)}function a_(e,t,n){var l;const o=[],r={},s=(l=n.options.maxLeafRowFilterDepth)!=null?l:100,u=function(a,f){f===void 0&&(f=0);const c=[];for(let p=0;poe(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,l)=>{if(!t.rows.length||!(n!=null&&n.length)&&!l){for(let p=0;p{var g;const m=e.getColumn(p.id);if(!m)return;const _=m.getFilterFn();_&&o.push({id:p.id,filterFn:_,resolvedValue:(g=_.resolveFilterValue==null?void 0:_.resolveFilterValue(p.value))!=null?g:p.value})});const s=n.map(p=>p.id),u=e.getGlobalFilterFn(),a=e.getAllLeafColumns().filter(p=>p.getCanGlobalFilter());l&&u&&a.length&&(s.push("__global__"),a.forEach(p=>{var g;r.push({id:p.id,filterFn:u,resolvedValue:(g=u.resolveFilterValue==null?void 0:u.resolveFilterValue(l))!=null?g:l})}));let f,c;for(let p=0;p{g.columnFiltersMeta[_]=v})}if(r.length){for(let m=0;m{g.columnFiltersMeta[_]=v})){g.columnFilters.__global__=!0;break}}g.columnFilters.__global__!==!0&&(g.columnFilters.__global__=!1)}}const d=p=>{for(let g=0;g{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function Es(){return(e,t)=>oe(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()],(n,l,o)=>{if(!n.rows.length||!(l!=null&&l.length)&&!o)return n;const r=[...l.map(u=>u.id).filter(u=>u!==t),o?"__global__":void 0].filter(Boolean),s=u=>{for(let a=0;a{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable},onChange:()=>{}})}function Fs(){return e=>oe(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const l=e.getState().sorting,o=[],r=l.filter(a=>{var f;return(f=e.getColumn(a.id))==null?void 0:f.getCanSort()}),s={};r.forEach(a=>{const f=e.getColumn(a.id);f&&(s[a.id]={sortUndefined:f.columnDef.sortUndefined,invertSorting:f.columnDef.invertSorting,sortingFn:f.getSortingFn()})});const u=a=>{const f=[...a];return f.sort((c,d)=>{for(let g=0;g{var d;o.push(c),(d=c.subRows)!=null&&d.length&&(c.subRows=u(c.subRows))}),f};return{rows:u(n.rows),flatRows:o,rowsById:n.rowsById}},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function f_(e){const t=[],n=l=>{var o;t.push(l),(o=l.subRows)!=null&&o.length&&l.getIsExpanded()&&l.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function Ds(e){return t=>oe(()=>[t.getState().pagination,t.getPrePaginationRowModel(),t.options.paginateExpandedRows?void 0:t.getState().expanded],(n,l)=>{if(!l.rows.length)return l;const{pageSize:o,pageIndex:r}=n;let{rows:s,flatRows:u,rowsById:a}=l;const f=o*r,c=f+o;s=s.slice(f,c);let d;t.options.paginateExpandedRows?d={rows:s,flatRows:u,rowsById:a}:d=f_({rows:s,flatRows:u,rowsById:a}),d.flatRows=[];const p=g=>{d.flatRows.push(g),g.subRows.length&&g.subRows.forEach(p)};return d.rows.forEach(p),d},{key:!1,debug:()=>{var n;return(n=t.options.debugAll)!=null?n:t.options.debugTable}})}/** * svelte-table * * Copyright (c) TanStack @@ -46,7 +46,7 @@ * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function a_(e){let t;return{c(){t=q(e[0])},l(n){t=xu(n,e[0])},m(n,l){Lu(n,t,l)},p(n,[l]){l&1&&K(t,n[0])},i:U,o:U,d(n){n&&P(t)}}}function u_(e,t,n){let{content:l}=t;return e.$$set=o=>{"content"in o&&n(0,l=o.content)},[l]}class f_ extends ce{constructor(t){super(),de(this,t,u_,a_,fe,{content:0})}}const c_=ca((e,t,n,l)=>`${uf(t.content)}`);var d_=typeof document>"u"?c_:f_;function h_(e,t,n){let l,o;return l=new t({props:n,$$inline:!0}),{c(){ne(l.$$.fragment)},l(r){cf(l.$$.fragment,r)},m(r,s){ee(l,r,s),o=!0},p:U,i(r){o||(V(l.$$.fragment,r),o=!0)},o(r){z(l.$$.fragment,r),o=!1},d(r){te(l,r)}}}function g_(e,t){return class extends ce{constructor(l){super(),de(this,l,null,o=>h_(o,e,t),fe,{},void 0)}}}function p_(e,t){return ca((l,o,r,s)=>`${ff(e,"TableComponent").$$render(l,t,{},{})}`)}const Ao=typeof window>"u"?p_:g_;function m_(e){return typeof e=="object"&&typeof e.$$render=="function"&&typeof e.render=="function"}function __(e){var t,n;let l="__SVELTE_HMR"in window;return e.prototype instanceof ce||l&&((t=e.name)==null?void 0:t.startsWith("Proxy<"))&&((n=e.name)==null?void 0:n.endsWith(">"))}function Ds(e){return typeof document>"u"?m_(e):__(e)}function Is(e){return Ao(d_,{content:e})}function Cl(e,t){if(!e)return null;if(Ds(e))return Ao(e,t);if(typeof e=="function"){const n=e(t);return n==null?null:Ds(n)?Ao(n,t):Is(n)}return Is(e)}function Ns(e){let t;"subscribe"in e?t=e:t=to(e);let n={state:{},onStateChange:()=>{},renderFallbackValue:null,...Du(t)},l=n_(n),o=De(l.initialState),r=hf([o,t],u=>u);return to(l,function(a){const f=r.subscribe(c=>{let[d,g]=c;l.setOptions(p=>({...p,...g,state:{...d,...g.state},onStateChange:m=>{m instanceof Function?o.update(m):o.set(m),n.onStateChange==null||n.onStateChange(m)}})),a(l)});return function(){f()}})}/** + */function c_(e){let t;return{c(){t=q(e[0])},l(n){t=Wu(n,e[0])},m(n,l){Hu(n,t,l)},p(n,[l]){l&1&&K(t,n[0])},i:U,o:U,d(n){n&&N(t)}}}function d_(e,t,n){let{content:l}=t;return e.$$set=o=>{"content"in o&&n(0,l=o.content)},[l]}class h_ extends ce{constructor(t){super(),de(this,t,d_,c_,fe,{content:0})}}const g_=da((e,t,n,l)=>`${cf(t.content)}`);var p_=typeof document>"u"?g_:h_;function m_(e,t,n){let l,o;return l=new t({props:n,$$inline:!0}),{c(){ne(l.$$.fragment)},l(r){hf(l.$$.fragment,r)},m(r,s){ee(l,r,s),o=!0},p:U,i(r){o||(V(l.$$.fragment,r),o=!0)},o(r){z(l.$$.fragment,r),o=!1},d(r){te(l,r)}}}function __(e,t){return class extends ce{constructor(l){super(),de(this,l,null,o=>m_(o,e,t),fe,{},void 0)}}}function v_(e,t){return da((l,o,r,s)=>`${df(e,"TableComponent").$$render(l,t,{},{})}`)}const Ro=typeof window>"u"?v_:__;function b_(e){return typeof e=="object"&&typeof e.$$render=="function"&&typeof e.render=="function"}function w_(e){var t,n;let l="__SVELTE_HMR"in window;return e.prototype instanceof ce||l&&((t=e.name)==null?void 0:t.startsWith("Proxy<"))&&((n=e.name)==null?void 0:n.endsWith(">"))}function Is(e){return typeof document>"u"?b_(e):w_(e)}function Ns(e){return Ro(p_,{content:e})}function $l(e,t){if(!e)return null;if(Is(e))return Ro(e,t);if(typeof e=="function"){const n=e(t);return n==null?null:Is(n)?Ro(n,t):Ns(n)}return Ns(e)}function Ps(e){let t;"subscribe"in e?t=e:t=no(e);let n={state:{},onStateChange:()=>{},renderFallbackValue:null,...Nu(t)},l=i_(n),o=Ie(l.initialState),r=pf([o,t],u=>u);return no(l,function(a){const f=r.subscribe(c=>{let[d,p]=c;l.setOptions(g=>({...g,...p,state:{...d,...p.state},onStateChange:m=>{m instanceof Function?o.update(m):o.set(m),n.onStateChange==null||n.onStateChange(m)}})),a(l)});return function(){f()}})}/** * match-sorter-utils * * Copyright (c) TanStack @@ -55,10 +55,10 @@ * LICENSE.md file in the root directory of this source tree. * * @license MIT - */const Mu={À:"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:"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"},v_=Object.keys(Mu).join("|"),b_=new RegExp(v_,"g");function w_(e){return e.replace(b_,t=>Mu[t])}/** + */const Fu={À:"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:"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"},y_=Object.keys(Fu).join("|"),k_=new RegExp(y_,"g");function S_(e){return e.replace(k_,t=>Fu[t])}/** * @name match-sorter * @license MIT license. * @copyright (c) 2099 Kent C. Dodds * @author Kent C. Dodds (https://kentcdodds.com) - */const Le={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0};function y_(e,t,n){var l;if(n=n||{},n.threshold=(l=n.threshold)!=null?l:Le.MATCHES,!n.accessors){const s=Ps(e,t,n);return{rankedValue:e,rank:s,accessorIndex:-1,accessorThreshold:n.threshold,passed:s>=n.threshold}}const o=$_(e,n.accessors),r={rankedValue:e,rank:Le.NO_MATCH,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let s=0;s=Le.MATCHES?a=f:a>c&&(a=c),a=Math.min(a,c),a>=d&&a>r.rank&&(r.rank=a,r.passed=!0,r.accessorIndex=s,r.accessorThreshold=d,r.rankedValue=u.itemValue)}return r}function Ps(e,t,n){return e=Ts(e,n),t=Ts(t,n),t.length>e.length?Le.NO_MATCH:e===t?Le.CASE_SENSITIVE_EQUAL:(e=e.toLowerCase(),t=t.toLowerCase(),e===t?Le.EQUAL:e.startsWith(t)?Le.STARTS_WITH:e.includes(` ${t}`)?Le.WORD_STARTS_WITH:e.includes(t)?Le.CONTAINS:t.length===1?Le.NO_MATCH:k_(e).includes(t)?Le.ACRONYM:S_(e,t))}function k_(e){let t="";return e.split(" ").forEach(l=>{l.split("-").forEach(r=>{t+=r.substr(0,1)})}),t}function S_(e,t){let n=0,l=0;function o(a,f,c){for(let d=c,g=f.length;d-1))return Le.NO_MATCH}const u=l-s;return r(u)}function Ts(e,t){let{keepDiacritics:n}=t;return e=`${e}`,n||(e=w_(e)),e}function C_(e,t){let n=t;typeof t=="object"&&(n=t.accessor);const l=n(e);return l==null?[]:Array.isArray(l)?l:[String(l)]}function $_(e,t){const n=[];for(let l=0,o=t.length;l{te(m,1)}),ye()}c?(n=Rt(c,d()),ne(n.$$.fragment),V(n.$$.fragment,1),ee(n,t,l)):n=null}},i(g){u||(n&&V(n.$$.fragment,g),u=!0)},o(g){n&&z(n.$$.fragment,g),u=!1},d(g){g&&P(t),n&&te(n),a=!1,f()}}}function Hs(e){let t,n,l=!e[26].isPlaceholder&&A_(e);return{c(){t=A("th"),l&&l.c(),h(t,"colspan",e[26].colSpan),h(t,"class","svelte-16fb3tv")},m(o,r){T(o,t,r),l&&l.m(t,null),n=!0},p(o,r){o[26].isPlaceholder||l.p(o,r)},i(o){n||(V(l),n=!0)},o(o){z(l),n=!1},d(o){o&&P(t),l&&l.d()}}}function Gs(e){let t,n,l,o=e[23].headers,r=[];for(let u=0;uz(r[u],1,1,()=>{r[u]=null});return{c(){t=A("tr");for(let u=0;u{te(f,1)}),ye()}r?(l=Rt(r,s()),ne(l.$$.fragment),V(l.$$.fragment,1),ee(l,n,null)):l=null}},i(u){o||(l&&V(l.$$.fragment,u),o=!0)},o(u){l&&z(l.$$.fragment,u),o=!1},d(u){u&&P(n),l&&te(l)}}}function js(e){let t,n=[],l=new Map,o,r,s=e[17].getVisibleCells();const u=a=>a[20].id;for(let a=0;a",pe,W,Q,X,Y,le=e[5],he=[];for(let ie=0;iez(he[ie],1,1,()=>{he[ie]=null});let Et=e[1].getRowModel().rows,$e=[];for(let ie=0;iez($e[ie],1,1,()=>{$e[ie]=null});return{c(){t=A("div"),n=A("input"),l=N(),o=A("div"),r=A("table"),s=A("thead");for(let ie=0;ie(r(),r=$l(y,$=>n(1,o=$)),y);ue(e,kl,$=>n(8,l=$)),e.$$.on_destroy.push(()=>r());const u=($,F,C,R)=>{if(console.log("yessir"),Array.isArray(C))return C.length===0?!0:C.includes($.getValue(F));typeof C=="number"&&(C=String(C));const k=y_($.getValue(F),C);return R({itemRank:k}),k.passed},a=o_(),f=[a.accessor("file",{header:"File",cell:$=>$.getValue(),footer:$=>$.column.id}),a.accessor("size",{header:"Size",cell:$=>ro($.getValue()),footer:$=>$.column.id}),a.accessor("type",{header:"Type",cell:$=>$.getValue(),footer:$=>$.column.id})];let c="",d=De({data:l,columns:f,getCoreRowModel:Rs(),getSortedRowModel:Es(),getFilteredRowModel:As(),globalFilterFn:u,getFacetedRowModel:Ms(),getPaginationRowModel:Fs(),state:{globalFilter:c,pagination:{pageSize:7,pageIndex:0}},enableGlobalFilter:!0});function g($){n(6,c=$),d.update(F=>({...F,state:{...F.state,globalFilter:$}}))}function p($){d.update(F=>{var C;return{...F,state:{...F.state,pagination:{...(C=F.state)==null?void 0:C.pagination,pageIndex:$}}}})}let m;function _($){clearTimeout(m),m=setTimeout(()=>{const F=$.target;g(F.value)},100)}function v($){const F=$.target;p(parseInt(F.value)-1)}let y=Ns(d);s();let w=o.getHeaderGroups();const S=()=>p(o.getState().pagination.pageIndex-1),M=()=>p(o.getState().pagination.pageIndex+1);return e.$$.update=()=>{e.$$.dirty&448&&(n(7,d={data:l,columns:f,getCoreRowModel:Rs(),getSortedRowModel:Es(),getFilteredRowModel:As(),globalFilterFn:u,getFacetedRowModel:Ms(),getPaginationRowModel:Fs(),state:{globalFilter:c,pagination:{pageSize:7,pageIndex:0}},enableGlobalFilter:!0}),s(n(0,y=Ns(De(d)))))},[y,o,p,_,v,w,c,d,l,S,M]}class D_ extends ce{constructor(t){super(),de(this,t,F_,M_,fe,{})}}function xs(e){let t,n;return{c(){t=A("p"),n=q(e[3])},m(l,o){T(l,t,o),b(t,n)},p(l,o){o&8&&K(n,l[3])},d(l){l&&P(t)}}}function Us(e){let t;return{c(){t=A("p"),t.textContent="Data Successfully indexed!"},m(n,l){T(n,t,l)},d(n){n&&P(t)}}}function Ws(e){let t,n;return t=new D_({}),{c(){ne(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},i(l){n||(V(t.$$.fragment,l),n=!0)},o(l){z(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function I_(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m,_,v,y,w,S,M,$,F,C,R=e[2]&&!e[1]&&xs(e),k=e[1]&&Us();S=new Cm({});let E=e[0]&&Ws();return{c(){t=A("div"),n=A("div"),l=A("div"),o=A("div"),r=A("h4"),r.textContent="Upload Data",s=N(),u=A("br"),a=N(),f=A("form"),c=A("input"),d=N(),R&&R.c(),g=N(),k&&k.c(),p=N(),m=A("p"),m.textContent="These are the files your model will use as context.",_=N(),v=A("p"),v.innerHTML="Currently pdf, txt, and md are supported.",y=N(),w=A("div"),ne(S.$$.fragment),M=N(),E&&E.c(),h(c,"type","file"),c.multiple=!0,h(o,"class","upload-box svelte-1lu6hos"),h(l,"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,D){T(I,t,D),b(t,n),b(n,l),b(l,o),b(o,r),b(o,s),b(o,u),b(o,a),b(o,f),b(f,c),b(o,d),R&&R.m(o,null),b(o,g),k&&k.m(o,null),b(o,p),b(o,m),b(o,_),b(o,v),b(t,y),b(t,w),ee(S,w,null),b(w,M),E&&E.m(w,null),$=!0,F||(C=x(c,"change",e[4]),F=!0)},p(I,[D]){I[2]&&!I[1]?R?R.p(I,D):(R=xs(I),R.c(),R.m(o,g)):R&&(R.d(1),R=null),I[1]?k||(k=Us(),k.c(),k.m(o,p)):k&&(k.d(1),k=null),I[0]?E?D&1&&V(E,1):(E=Ws(),E.c(),V(E,1),E.m(w,null)):E&&(we(),z(E,1,1,()=>{E=null}),ye())},i(I){$||(V(S.$$.fragment,I),V(E),$=!0)},o(I){z(S.$$.fragment,I),z(E),$=!1},d(I){I&&P(t),R&&R.d(),k&&k.d(),te(S),E&&E.d(),F=!1,C()}}}function N_(e,t,n){let l,o,r;ue(e,bs,m=>n(6,o=m)),ue(e,kl,m=>n(7,r=m));let s=[],u=!1,a=!1;async function f(m){n(0,s=m.target.files);const _=new FormData;for(let v=0;v({file:y.name,size:y.size,type:y.type}));Pe(kl,r=[...v],r)}async function d(){console.log("index!"),n(2,a=!0),await(await fetch("/retrieval/vector_db/index",{method:"POST"})).json(),n(1,u=!0),n(2,a=!1)}async function g(){console.log("getting embeddings...");const _=await(await fetch("/retrieval/vector_db/get")).json();console.log("embeddingData",_),Pe(bs,o=_,o)}ft(()=>{c()});let p=0;return setInterval(()=>{n(5,p=(p+1)%4)},200),e.$$.update=()=>{e.$$.dirty&32&&n(3,l="Indexing"+".".repeat(p))},[s,u,a,l,f,p]}class P_ extends ce{constructor(t){super(),de(this,t,N_,I_,fe,{})}}function T_(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m,_,v,y,w,S,M,$,F,C,R,k,E,I;return r=new Ya({}),a=new Qa({}),d=new ja({}),m=new Ua({props:{feedback:"Bad"}}),y=new Xa({}),M=new Wa({}),E=new xa({}),{c(){t=A("div"),n=A("div"),l=A("div"),o=A("div"),ne(r.$$.fragment),s=N(),u=A("div"),ne(a.$$.fragment),f=N(),c=A("div"),ne(d.$$.fragment),g=N(),p=A("div"),ne(m.$$.fragment),_=N(),v=A("div"),ne(y.$$.fragment),w=N(),S=A("div"),ne(M.$$.fragment),$=N(),F=A("div"),C=A("div"),C.innerHTML=`
-
`,R=N(),k=A("div"),ne(E.$$.fragment),h(o,"class","card-1 svelte-14znspc"),h(u,"class","card-2"),h(l,"class","left-text svelte-14znspc"),h(c,"class","left-confidence svelte-14znspc"),h(p,"class","left-question svelte-14znspc"),h(v,"class","left-filter svelte-14znspc"),h(S,"class","left-filter2"),h(n,"class","feedback-left svelte-14znspc"),h(C,"class","right-chart svelte-14znspc"),h(k,"class","right-table svelte-14znspc"),h(F,"class","feedback-right svelte-14znspc"),h(t,"class","feedback-container svelte-14znspc")},m(D,L){T(D,t,L),b(t,n),b(n,l),b(l,o),ee(r,o,null),b(l,s),b(l,u),ee(a,u,null),b(n,f),b(n,c),ee(d,c,null),b(n,g),b(n,p),ee(m,p,null),b(n,_),b(n,v),ee(y,v,null),b(n,w),b(n,S),ee(M,S,null),b(t,$),b(t,F),b(F,C),b(F,R),b(F,k),ee(E,k,null),I=!0},p:U,i(D){I||(V(r.$$.fragment,D),V(a.$$.fragment,D),V(d.$$.fragment,D),V(m.$$.fragment,D),V(y.$$.fragment,D),V(M.$$.fragment,D),V(E.$$.fragment,D),I=!0)},o(D){z(r.$$.fragment,D),z(a.$$.fragment,D),z(d.$$.fragment,D),z(m.$$.fragment,D),z(y.$$.fragment,D),z(M.$$.fragment,D),z(E.$$.fragment,D),I=!1},d(D){D&&P(t),te(r),te(a),te(d),te(m),te(y),te(M),te(E)}}}function O_(e,t,n){let l;ue(e,An,r=>n(0,l=r)),ft(()=>{console.log("FEEDBACK on mount"),o()});async function o(){const a=(await(await fetch("/chat/rag_table/retrieve")).json()).rows.map(f=>({id:f[0],question:f[1],answer:f[2],vote_status:f[4]}));Pe(An,l=[...a],l)}return[]}class V_ extends ce{constructor(t){super(),de(this,t,O_,T_,fe,{})}}function z_(e){let t,n;return t=new Ka({}),{c(){ne(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},i(l){n||(V(t.$$.fragment,l),n=!0)},o(l){z(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function L_(e){let t,n;return t=new V_({}),{c(){ne(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},i(l){n||(V(t.$$.fragment,l),n=!0)},o(l){z(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function q_(e){let t,n;return t=new Ka({}),{c(){ne(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},i(l){n||(V(t.$$.fragment,l),n=!0)},o(l){z(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function H_(e){let t,n,l,o;const r=[q_,L_,z_],s=[];function u(a,f){return a[0]==="vote"?0:a[0]==="rag"?1:2}return t=u(e),n=s[t]=r[t](e),{c(){n.c(),l=Se()},m(a,f){s[t].m(a,f),T(a,l,f),o=!0},p(a,[f]){let c=t;t=u(a),t!==c&&(we(),z(s[c],1,1,()=>{s[c]=null}),ye(),n=s[t],n||(n=s[t]=r[t](a),n.c()),V(n,1),n.m(l.parentNode,l))},i(a){o||(V(n),o=!0)},o(a){z(n),o=!1},d(a){s[t].d(a),a&&P(l)}}}function G_(e,t,n){let{feedback:l}=t;return e.$$set=o=>{"feedback"in o&&n(0,l=o.feedback)},[l]}class B_ extends ce{constructor(t){super(),de(this,t,G_,H_,fe,{feedback:0})}}function Xs(e,t,n){const l=e.slice();return l[7]=t[n],l}function Ys(e){let t,n=e[0],l=[];for(let o=0;o{te(c,1)}),ye()}r?(t=Rt(r,s()),ne(t.$$.fragment),V(t.$$.fragment,1),ee(t,n.parentNode,n)):t=null}else r&&t.$set(f)},i(u){l||(t&&V(t.$$.fragment,u),l=!0)},o(u){t&&z(t.$$.fragment,u),l=!1},d(u){u&&P(n),t&&te(t,u)}}}function j_(e){let t,n,l,o=e[0].length>1&&Ys(e),r=e[1]&&Ks(e);return{c(){o&&o.c(),t=N(),r&&r.c(),n=Se()},m(s,u){o&&o.m(s,u),T(s,t,u),r&&r.m(s,u),T(s,n,u),l=!0},p(s,[u]){s[0].length>1?o?o.p(s,u):(o=Ys(s),o.c(),o.m(t.parentNode,t)):o&&(o.d(1),o=null),s[1]?r?(r.p(s,u),u&2&&V(r,1)):(r=Ks(s),r.c(),V(r,1),r.m(n.parentNode,n)):r&&(we(),z(r,1,1,()=>{r=null}),ye())},i(s){l||(V(r),l=!0)},o(s){z(r),l=!1},d(s){o&&o.d(s),s&&P(t),r&&r.d(s),s&&P(n)}}}function x_(e,t,n){let l,o;const r=De([]);ue(e,r,c=>n(0,l=c));const s=De(null);ue(e,s,c=>n(1,o=c));const u={Chatbot:Yd,Dropdown:Jd,Feedback:B_,Compare:Sp,CompareDashboard:Hp,RetrievalQA:P_},a=c=>{s.set(c)};return fetch("/components").then(c=>{if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return c.json()}).then(c=>{r.set(c),s.set(c[0])}).catch(c=>{console.log("Fetch request failed",c)}),[l,o,r,s,u,a,c=>a(c)]}class U_ extends ce{constructor(t){super(),de(this,t,x_,j_,fe,{})}}new U_({target:document.getElementById("app")}); + */const qe={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0};function C_(e,t,n){var l;if(n=n||{},n.threshold=(l=n.threshold)!=null?l:qe.MATCHES,!n.accessors){const s=Ts(e,t,n);return{rankedValue:e,rank:s,accessorIndex:-1,accessorThreshold:n.threshold,passed:s>=n.threshold}}const o=M_(e,n.accessors),r={rankedValue:e,rank:qe.NO_MATCH,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let s=0;s=qe.MATCHES?a=f:a>c&&(a=c),a=Math.min(a,c),a>=d&&a>r.rank&&(r.rank=a,r.passed=!0,r.accessorIndex=s,r.accessorThreshold=d,r.rankedValue=u.itemValue)}return r}function Ts(e,t,n){return e=Os(e,n),t=Os(t,n),t.length>e.length?qe.NO_MATCH:e===t?qe.CASE_SENSITIVE_EQUAL:(e=e.toLowerCase(),t=t.toLowerCase(),e===t?qe.EQUAL:e.startsWith(t)?qe.STARTS_WITH:e.includes(` ${t}`)?qe.WORD_STARTS_WITH:e.includes(t)?qe.CONTAINS:t.length===1?qe.NO_MATCH:$_(e).includes(t)?qe.ACRONYM:A_(e,t))}function $_(e){let t="";return e.split(" ").forEach(l=>{l.split("-").forEach(r=>{t+=r.substr(0,1)})}),t}function A_(e,t){let n=0,l=0;function o(a,f,c){for(let d=c,p=f.length;d-1))return qe.NO_MATCH}const u=l-s;return r(u)}function Os(e,t){let{keepDiacritics:n}=t;return e=`${e}`,n||(e=S_(e)),e}function R_(e,t){let n=t;typeof t=="object"&&(n=t.accessor);const l=n(e);return l==null?[]:Array.isArray(l)?l:[String(l)]}function M_(e,t){const n=[];for(let l=0,o=t.length;l{te(m,1)}),ye()}c?(n=At(c,d()),ne(n.$$.fragment),V(n.$$.fragment,1),ee(n,t,l)):n=null}},i(p){u||(n&&V(n.$$.fragment,p),u=!0)},o(p){n&&z(n.$$.fragment,p),u=!1},d(p){p&&N(t),n&&te(n),a=!1,f()}}}function Gs(e){let t,n,l=!e[26].isPlaceholder&&F_(e);return{c(){t=A("th"),l&&l.c(),h(t,"colspan",e[26].colSpan),h(t,"class","svelte-16fb3tv")},m(o,r){T(o,t,r),l&&l.m(t,null),n=!0},p(o,r){o[26].isPlaceholder||l.p(o,r)},i(o){n||(V(l),n=!0)},o(o){z(l),n=!1},d(o){o&&N(t),l&&l.d()}}}function Bs(e){let t,n,l,o=e[23].headers,r=[];for(let u=0;uz(r[u],1,1,()=>{r[u]=null});return{c(){t=A("tr");for(let u=0;u{te(f,1)}),ye()}r?(l=At(r,s()),ne(l.$$.fragment),V(l.$$.fragment,1),ee(l,n,null)):l=null}},i(u){o||(l&&V(l.$$.fragment,u),o=!0)},o(u){l&&z(l.$$.fragment,u),o=!1},d(u){u&&N(n),l&&te(l)}}}function xs(e){let t,n=[],l=new Map,o,r,s=e[17].getVisibleCells();const u=a=>a[20].id;for(let a=0;a",pe,W,Q,X,Y,le=e[5],he=[];for(let ie=0;iez(he[ie],1,1,()=>{he[ie]=null});let Et=e[1].getRowModel().rows,$e=[];for(let ie=0;iez($e[ie],1,1,()=>{$e[ie]=null});return{c(){t=A("div"),n=A("input"),l=P(),o=A("div"),r=A("table"),s=A("thead");for(let ie=0;ie(r(),r=Al(y,$=>n(1,o=$)),y);ue(e,Sl,$=>n(8,l=$)),e.$$.on_destroy.push(()=>r());const u=($,F,C,R)=>{if(console.log("yessir"),Array.isArray(C))return C.length===0?!0:C.includes($.getValue(F));typeof C=="number"&&(C=String(C));const k=C_($.getValue(F),C);return R({itemRank:k}),k.passed},a=s_(),f=[a.accessor("file",{header:"File",cell:$=>$.getValue(),footer:$=>$.column.id}),a.accessor("size",{header:"Size",cell:$=>ro($.getValue()),footer:$=>$.column.id}),a.accessor("type",{header:"Type",cell:$=>$.getValue(),footer:$=>$.column.id})];let c="",d=Ie({data:l,columns:f,getCoreRowModel:Rs(),getSortedRowModel:Fs(),getFilteredRowModel:Ms(),globalFilterFn:u,getFacetedRowModel:Es(),getPaginationRowModel:Ds(),state:{globalFilter:c,pagination:{pageSize:7,pageIndex:0}},enableGlobalFilter:!0});function p($){n(6,c=$),d.update(F=>({...F,state:{...F.state,globalFilter:$}}))}function g($){d.update(F=>{var C;return{...F,state:{...F.state,pagination:{...(C=F.state)==null?void 0:C.pagination,pageIndex:$}}}})}let m;function _($){clearTimeout(m),m=setTimeout(()=>{const F=$.target;p(F.value)},100)}function v($){const F=$.target;g(parseInt(F.value)-1)}let y=Ps(d);s();let w=o.getHeaderGroups();const S=()=>g(o.getState().pagination.pageIndex-1),M=()=>g(o.getState().pagination.pageIndex+1);return e.$$.update=()=>{e.$$.dirty&448&&(n(7,d={data:l,columns:f,getCoreRowModel:Rs(),getSortedRowModel:Fs(),getFilteredRowModel:Ms(),globalFilterFn:u,getFacetedRowModel:Es(),getPaginationRowModel:Ds(),state:{globalFilter:c,pagination:{pageSize:7,pageIndex:0}},enableGlobalFilter:!0}),s(n(0,y=Ps(Ie(d)))))},[y,o,g,_,v,w,c,d,l,S,M]}class P_ extends ce{constructor(t){super(),de(this,t,N_,D_,fe,{})}}function Us(e){let t,n;return{c(){t=A("p"),n=q(e[3])},m(l,o){T(l,t,o),b(t,n)},p(l,o){o&8&&K(n,l[3])},d(l){l&&N(t)}}}function Ws(e){let t;return{c(){t=A("p"),t.textContent="Data Successfully indexed!"},m(n,l){T(n,t,l)},d(n){n&&N(t)}}}function Xs(e){let t,n;return t=new P_({}),{c(){ne(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},i(l){n||(V(t.$$.fragment,l),n=!0)},o(l){z(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function T_(e){let t,n,l,o,r,s,u,a,f,c,d,p,g,m,_,v,y,w,S,M,$,F,C,R=e[2]&&!e[1]&&Us(e),k=e[1]&&Ws();S=new Rm({});let E=e[0]&&Xs();return{c(){t=A("div"),n=A("div"),l=A("div"),o=A("div"),r=A("h4"),r.textContent="Upload Data",s=P(),u=A("br"),a=P(),f=A("form"),c=A("input"),d=P(),R&&R.c(),p=P(),k&&k.c(),g=P(),m=A("p"),m.textContent="These are the files your model will use as context.",_=P(),v=A("p"),v.innerHTML="Currently pdf, txt, and md are supported.",y=P(),w=A("div"),ne(S.$$.fragment),M=P(),E&&E.c(),h(c,"type","file"),c.multiple=!0,h(o,"class","upload-box svelte-1lu6hos"),h(l,"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,D){T(I,t,D),b(t,n),b(n,l),b(l,o),b(o,r),b(o,s),b(o,u),b(o,a),b(o,f),b(f,c),b(o,d),R&&R.m(o,null),b(o,p),k&&k.m(o,null),b(o,g),b(o,m),b(o,_),b(o,v),b(t,y),b(t,w),ee(S,w,null),b(w,M),E&&E.m(w,null),$=!0,F||(C=x(c,"change",e[4]),F=!0)},p(I,[D]){I[2]&&!I[1]?R?R.p(I,D):(R=Us(I),R.c(),R.m(o,p)):R&&(R.d(1),R=null),I[1]?k||(k=Ws(),k.c(),k.m(o,g)):k&&(k.d(1),k=null),I[0]?E?D&1&&V(E,1):(E=Xs(),E.c(),V(E,1),E.m(w,null)):E&&(we(),z(E,1,1,()=>{E=null}),ye())},i(I){$||(V(S.$$.fragment,I),V(E),$=!0)},o(I){z(S.$$.fragment,I),z(E),$=!1},d(I){I&&N(t),R&&R.d(),k&&k.d(),te(S),E&&E.d(),F=!1,C()}}}function O_(e,t,n){let l,o,r;ue(e,ws,m=>n(6,o=m)),ue(e,Sl,m=>n(7,r=m));let s=[],u=!1,a=!1;async function f(m){n(0,s=m.target.files);const _=new FormData;for(let v=0;v({file:y.name,size:y.size,type:y.type}));De(Sl,r=[...v],r)}async function d(){console.log("index!"),n(2,a=!0),await(await fetch("/retrieval/vector_db/index",{method:"POST"})).json(),n(1,u=!0),n(2,a=!1)}async function p(){console.log("getting embeddings...");const _=await(await fetch("/retrieval/vector_db/get")).json();console.log("embeddingData",_),De(ws,o=_,o)}ft(()=>{c()});let g=0;return setInterval(()=>{n(5,g=(g+1)%4)},200),e.$$.update=()=>{e.$$.dirty&32&&n(3,l="Indexing"+".".repeat(g))},[s,u,a,l,f,g]}class V_ extends ce{constructor(t){super(),de(this,t,O_,T_,fe,{})}}function z_(e){let t,n,l,o,r,s,u,a,f,c,d,p,g,m,_,v,y,w,S,M,$,F,C,R,k,E,I;return r=new Ka({}),a=new Ja({}),d=new Ua({}),m=new Xa({props:{feedback:"Bad"}}),y=new Qa({}),M=new Ya({}),E=new Wa({}),{c(){t=A("div"),n=A("div"),l=A("div"),o=A("div"),ne(r.$$.fragment),s=P(),u=A("div"),ne(a.$$.fragment),f=P(),c=A("div"),ne(d.$$.fragment),p=P(),g=A("div"),ne(m.$$.fragment),_=P(),v=A("div"),ne(y.$$.fragment),w=P(),S=A("div"),ne(M.$$.fragment),$=P(),F=A("div"),C=A("div"),C.innerHTML=`
+
`,R=P(),k=A("div"),ne(E.$$.fragment),h(o,"class","card-1 svelte-14znspc"),h(u,"class","card-2"),h(l,"class","left-text svelte-14znspc"),h(c,"class","left-confidence svelte-14znspc"),h(g,"class","left-question svelte-14znspc"),h(v,"class","left-filter svelte-14znspc"),h(S,"class","left-filter2"),h(n,"class","feedback-left svelte-14znspc"),h(C,"class","right-chart svelte-14znspc"),h(k,"class","right-table svelte-14znspc"),h(F,"class","feedback-right svelte-14znspc"),h(t,"class","feedback-container svelte-14znspc")},m(D,L){T(D,t,L),b(t,n),b(n,l),b(l,o),ee(r,o,null),b(l,s),b(l,u),ee(a,u,null),b(n,f),b(n,c),ee(d,c,null),b(n,p),b(n,g),ee(m,g,null),b(n,_),b(n,v),ee(y,v,null),b(n,w),b(n,S),ee(M,S,null),b(t,$),b(t,F),b(F,C),b(F,R),b(F,k),ee(E,k,null),I=!0},p:U,i(D){I||(V(r.$$.fragment,D),V(a.$$.fragment,D),V(d.$$.fragment,D),V(m.$$.fragment,D),V(y.$$.fragment,D),V(M.$$.fragment,D),V(E.$$.fragment,D),I=!0)},o(D){z(r.$$.fragment,D),z(a.$$.fragment,D),z(d.$$.fragment,D),z(m.$$.fragment,D),z(y.$$.fragment,D),z(M.$$.fragment,D),z(E.$$.fragment,D),I=!1},d(D){D&&N(t),te(r),te(a),te(d),te(m),te(y),te(M),te(E)}}}function L_(e,t,n){let l;ue(e,Mn,r=>n(0,l=r)),ft(()=>{console.log("FEEDBACK on mount"),o()});async function o(){const a=(await(await fetch("/chat/rag_table/retrieve")).json()).rows.map(f=>({id:f[0],question:f[1],answer:f[2],vote_status:f[4]}));De(Mn,l=[...a],l)}return[]}class q_ extends ce{constructor(t){super(),de(this,t,L_,z_,fe,{})}}function H_(e){let t,n;return t=new Za({}),{c(){ne(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},i(l){n||(V(t.$$.fragment,l),n=!0)},o(l){z(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function G_(e){let t,n;return t=new q_({}),{c(){ne(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},i(l){n||(V(t.$$.fragment,l),n=!0)},o(l){z(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function B_(e){let t,n;return t=new Za({}),{c(){ne(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},i(l){n||(V(t.$$.fragment,l),n=!0)},o(l){z(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function j_(e){let t,n,l,o;const r=[B_,G_,H_],s=[];function u(a,f){return a[0]==="vote"?0:a[0]==="rag"?1:2}return t=u(e),n=s[t]=r[t](e),{c(){n.c(),l=Se()},m(a,f){s[t].m(a,f),T(a,l,f),o=!0},p(a,[f]){let c=t;t=u(a),t!==c&&(we(),z(s[c],1,1,()=>{s[c]=null}),ye(),n=s[t],n||(n=s[t]=r[t](a),n.c()),V(n,1),n.m(l.parentNode,l))},i(a){o||(V(n),o=!0)},o(a){z(n),o=!1},d(a){s[t].d(a),a&&N(l)}}}function x_(e,t,n){let{feedback:l}=t;return e.$$set=o=>{"feedback"in o&&n(0,l=o.feedback)},[l]}class U_ extends ce{constructor(t){super(),de(this,t,x_,j_,fe,{feedback:0})}}function Ys(e,t,n){const l=e.slice();return l[7]=t[n],l}function Qs(e){let t,n=e[0],l=[];for(let o=0;o{te(c,1)}),ye()}r?(t=At(r,s()),ne(t.$$.fragment),V(t.$$.fragment,1),ee(t,n.parentNode,n)):t=null}else r&&t.$set(f)},i(u){l||(t&&V(t.$$.fragment,u),l=!0)},o(u){t&&z(t.$$.fragment,u),l=!1},d(u){u&&N(n),t&&te(t,u)}}}function W_(e){let t,n,l,o=e[0].length>1&&Qs(e),r=e[1]&&Js(e);return{c(){o&&o.c(),t=P(),r&&r.c(),n=Se()},m(s,u){o&&o.m(s,u),T(s,t,u),r&&r.m(s,u),T(s,n,u),l=!0},p(s,[u]){s[0].length>1?o?o.p(s,u):(o=Qs(s),o.c(),o.m(t.parentNode,t)):o&&(o.d(1),o=null),s[1]?r?(r.p(s,u),u&2&&V(r,1)):(r=Js(s),r.c(),V(r,1),r.m(n.parentNode,n)):r&&(we(),z(r,1,1,()=>{r=null}),ye())},i(s){l||(V(r),l=!0)},o(s){z(r),l=!1},d(s){o&&o.d(s),s&&N(t),r&&r.d(s),s&&N(n)}}}function X_(e,t,n){let l,o;const r=Ie([]);ue(e,r,c=>n(0,l=c));const s=Ie(null);ue(e,s,c=>n(1,o=c));const u={Chatbot:Jd,Dropdown:th,Feedback:U_,Compare:Ap,CompareDashboard:jp,RetrievalQA:V_},a=c=>{s.set(c)};return fetch("/components").then(c=>{if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return c.json()}).then(c=>{r.set(c),s.set(c[0])}).catch(c=>{console.log("Fetch request failed",c)}),[l,o,r,s,u,a,c=>a(c)]}class Y_ extends ce{constructor(t){super(),de(this,t,X_,W_,fe,{})}}new Y_({target:document.getElementById("app")}); diff --git a/pykoi/frontend/dist/assets/index-857a4a8b.css b/pykoi/frontend/dist/assets/index-857a4a8b.css new file mode 100644 index 0000000..32009ad --- /dev/null +++ b/pykoi/frontend/dist/assets/index-857a4a8b.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}dialog.svelte-g384pz.svelte-g384pz{max-width:32em;border-radius:1em;border:none;padding:0}dialog.svelte-g384pz.svelte-g384pz::backdrop{background:rgba(0,0,0,.3)}dialog.svelte-g384pz>div.svelte-g384pz{padding:1em}dialog[open].svelte-g384pz.svelte-g384pz{animation:svelte-g384pz-zoom .3s cubic-bezier(.34,1.56,.64,1)}@keyframes svelte-g384pz-zoom{0%{transform:scale(.95)}to{transform:scale(1)}}dialog[open].svelte-g384pz.svelte-g384pz::backdrop{animation:svelte-g384pz-fade .2s ease-out}@keyframes svelte-g384pz-fade{0%{opacity:0}to{opacity:1}}button.svelte-g384pz.svelte-g384pz{display:block}.close-button.svelte-g384pz.svelte-g384pz{display:block;height:30px;width:30px;border-radius:50%;border:1px solid var(--grey);padding:0}.close-button.svelte-g384pz.svelte-g384pz:hover{background-color:var(--lightGrey)}.btn-container.svelte-g384pz.svelte-g384pz{display:flex;justify-content:flex-end}.btn-container.svelte-sy2m0x.svelte-sy2m0x{display:flex;justify-content:center;padding-top:1em}div.inputs.svelte-sy2m0x.svelte-sy2m0x{display:grid;grid-template-columns:max-content max-content;grid-gap:5px}div.inputs.svelte-sy2m0x label.svelte-sy2m0x{text-align:right}h4.svelte-sy2m0x.svelte-sy2m0x{margin:20px 0}.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}.instructions.svelte-19cad35 button.svelte-19cad35{font-size:var(--smallText)}.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-1betmla.svelte-1betmla{position:relative;max-width:200px}.selectBox.svelte-1betmla.svelte-1betmla{position:relative}.selectBox.svelte-1betmla select.svelte-1betmla{width:100%;font-weight:700}.overSelect.svelte-1betmla.svelte-1betmla{position:absolute;left:0;right:0;top:0;bottom:0}.dropdown-content.svelte-1betmla.svelte-1betmla{position:absolute;top:100%;left:0;width:100%;border:1px #dadada solid;background-color:#fff;z-index:1;padding:.5em}.checkbox-container.svelte-1betmla.svelte-1betmla{display:flex;flex-direction:column;align-items:flex-start}.checkbox-container.svelte-1betmla label.svelte-1betmla{display:inline-block;padding-right:10px;white-space:nowrap}.checkbox-container.svelte-1betmla input.svelte-1betmla,.checkbox-container.svelte-1betmla label span.svelte-1betmla{cursor:pointer;vertical-align:middle}.select-button-container.svelte-1betmla.svelte-1betmla{width:100%;display:flex;justify-content:center;padding-top:1em}.select-button-container.svelte-1betmla button.svelte-1betmla{color:var(--darkGrey);font-size:small;margin:0 2px;padding:1em}.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-vgv4ev.svelte-vgv4ev{display:grid;grid-template-columns:20% 80%;width:100%}.ranked-chat.svelte-vgv4ev.svelte-vgv4ev{height:100vh;display:grid;grid-template-columns:100%;grid-template-rows:80% 20%}.message.svelte-vgv4ev.svelte-vgv4ev{font-size:var(--smallText);padding-left:40px;padding-right:40px;margin:0 auto}.chat-input-holder.svelte-vgv4ev.svelte-vgv4ev{display:flex;flex-direction:column;align-items:center;padding:5px;width:100%;max-width:820px;margin:auto}.chat-input-textarea.svelte-vgv4ev.svelte-vgv4ev{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-vgv4ev.svelte-vgv4ev{display:flex;width:100%}.btnyousend.svelte-vgv4ev.svelte-vgv4ev{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-vgv4ev.svelte-vgv4ev{opacity:1}.green.svelte-vgv4ev.svelte-vgv4ev{border-bottom:2px solid var(--green)}.red.svelte-vgv4ev.svelte-vgv4ev{border-bottom:2px solid var(--red)}.instructions.svelte-vgv4ev.svelte-vgv4ev{text-align:center;padding:5%}.instructions.svelte-vgv4ev h5.svelte-vgv4ev{text-align:left}.instructions.svelte-vgv4ev p.svelte-vgv4ev{font-size:var(--smallText);text-align:left}.instructions.svelte-vgv4ev button.svelte-vgv4ev{font-size:var(--smallText)}.ranked-feedback-container.svelte-vgv4ev.svelte-vgv4ev{display:grid;grid-template-columns:20% 80%}.underline.svelte-vgv4ev.svelte-vgv4ev{border-bottom:var(--line)}.bold{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-vgv4ev.svelte-vgv4ev{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-vgv4ev.svelte-vgv4ev{flex:1;overflow-y:auto;padding:0 10px;box-sizing:border-box}.chat-message.svelte-vgv4ev.svelte-vgv4ev{background-color:var(--white);border-bottom:var(--line);box-sizing:border-box}.chat-message-center.svelte-vgv4ev.svelte-vgv4ev{display:flex;flex-direction:column;margin-left:auto;margin-right:auto;padding:12px;box-sizing:border-box}.message-content.svelte-vgv4ev.svelte-vgv4ev{display:flex;flex-direction:column;box-sizing:border-box}.message-content.svelte-vgv4ev .question.svelte-vgv4ev{text-align:left;border:1px solid var(--grey);padding:5px;background-color:var(--lightGrey)}.message-content.svelte-vgv4ev .answer.svelte-vgv4ev{display:inline-block;text-align:left;padding:10px;border:1px solid var(--black)}.message-content.svelte-vgv4ev .answers.svelte-vgv4ev{display:grid;grid-template-columns:100%;gap:0%;width:100%;margin:auto}.rag-sources.svelte-vgv4ev.svelte-vgv4ev{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-7imt18.svelte-7imt18{height:100vh;width:100%;display:flex;justify-content:center;align-items:center}button.svelte-7imt18.svelte-7imt18{margin:0}.chart-captions.svelte-7imt18.svelte-7imt18{margin:auto;width:100%;text-align:left;height:100%}.chart-captions.svelte-7imt18 h4.svelte-7imt18{padding:0;margin:0}.main-container.svelte-7imt18.svelte-7imt18{margin:auto}.eval-container.svelte-7imt18.svelte-7imt18{display:grid;height:100vh;grid-template-rows:100%;grid-template-columns:65% 35%;padding:1rem}.left-charts.svelte-7imt18.svelte-7imt18{display:grid;grid-template-columns:100%;grid-template-rows:15% 60% 25%}.eval-table.svelte-7imt18.svelte-7imt18{margin:auto;width:100%}.right-charts.svelte-7imt18.svelte-7imt18{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/index.html b/pykoi/frontend/dist/index.html index ee742e2..bf2e096 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/lib/Chatbots/Components/Dropdown.svelte b/pykoi/frontend/src/lib/Chatbots/Components/Dropdown.svelte index f435a81..a9dee91 100644 --- a/pykoi/frontend/src/lib/Chatbots/Components/Dropdown.svelte +++ b/pykoi/frontend/src/lib/Chatbots/Components/Dropdown.svelte @@ -1,15 +1,16 @@ @@ -39,17 +61,30 @@ class="dropdown-content" style="display: {expanded ? 'block' : 'none'};" > - {#each documents as doc, index} - - {/each} + {#if documents.length === 0} +
+ No documents found. Please upload via the RetrievalQA component. +
+ {:else} +
+ + +
+
+ {#each documents as doc, index} + + {/each} +
+ {/if} @@ -85,5 +120,38 @@ border: 1px #dadada solid; background-color: white; z-index: 1; + padding: 0.5em; + } + .checkbox-container { + display: flex; + flex-direction: column; + align-items: flex-start; + } + + .checkbox-container label { + display: inline-block; + padding-right: 10px; + white-space: nowrap; + } + .checkbox-container input { + cursor: pointer; + vertical-align: middle; + } + .checkbox-container label span { + cursor: pointer; + vertical-align: middle; + } + + .select-button-container { + width: 100%; + display: flex; + justify-content: center; + padding-top: 1em; + } + .select-button-container button { + color: var(--darkGrey); + font-size: small; + margin: 0 2px; + padding: 1em; } diff --git a/pykoi/frontend/src/lib/Chatbots/Components/SourceContainer.svelte b/pykoi/frontend/src/lib/Chatbots/Components/SourceContainer.svelte index 900288f..4cfd325 100644 --- a/pykoi/frontend/src/lib/Chatbots/Components/SourceContainer.svelte +++ b/pykoi/frontend/src/lib/Chatbots/Components/SourceContainer.svelte @@ -8,7 +8,7 @@
{#if sources !== undefined} {#if sources[0] === "N/A"} -
⚠️ No Retrieval Sources selected
+
⚠️ No Retrieval Sources selected or received
{:else if sources[0] === "Loading..."}
📖 Loading...
{:else if sources[0] === "Not loaded"} diff --git a/pykoi/retrieval/llm/huggingface.py b/pykoi/retrieval/llm/huggingface.py index fe59b46..ea164d2 100644 --- a/pykoi/retrieval/llm/huggingface.py +++ b/pykoi/retrieval/llm/huggingface.py @@ -13,15 +13,15 @@ class HuggingFaceModel(AbsLlm): """ - A class representing a language model that uses OpenAI's GPT-3 to generate text. + A class representing a language model that uses Huggingface's model to generate text. """ def __init__(self, vector_db: AbsVectorDb, **kwargs): """ - Initializes the OpenAIModel class. + Initializes the HuggingFaceModel class. """ try: - llm = HuggingFacePipeline.from_model_id( + self._llm = HuggingFacePipeline.from_model_id( model_id=kwargs.get("model_name"), task="text-generation", device=torch.cuda.device_count() - 1, @@ -30,19 +30,47 @@ def __init__(self, vector_db: AbsVectorDb, **kwargs): "temperature": 0, "max_length": kwargs.get("max_length", 500), "trust_remote_code": kwargs.get("trust_remote_code", True), - # "load_in_8bit": True, }, ) - vector_db = vector_db.vector_db + self._vector_db = vector_db.vector_db - retrieve_qa = RetrievalQA.from_chain_type( - llm=llm, + self._retrieve_qa = RetrievalQA.from_chain_type( + llm=self._llm, chain_type="stuff", - retriever=vector_db.as_retriever(search_kwargs={"k": MIN_DOCS}), + retriever=self._vector_db.as_retriever(search_kwargs={"k": MIN_DOCS, "filter": {}}), verbose=True, + return_source_documents=True, ) - print("HuggingFaceModel initialized successfully") - super().__init__(retrieve_qa) + print("HuggingFaceModel initialized successfully!") + super().__init__(self._retrieve_qa) except Exception as ex: print("Inference initialization failed: {}".format(ex)) + + def re_init(self, file_names: list[str]): + """ + Re-initializes the HuggingFaceModel class. + """ + try: + if file_names == []: + metadata_filename_filter = {"file_name": ""} + elif len(file_names) == 1: + metadata_filename_filter = {"file_name": file_names[0]} + else: + metadata_filename_filter = { + "$or": [{"file_name": name} for name in file_names] + } + + self._retrieve_qa = RetrievalQA.from_chain_type( + llm=self._llm, + chain_type="stuff", + retriever=self._vector_db.as_retriever(search_kwargs={"k": MIN_DOCS, "filter": metadata_filename_filter}), + verbose=True, + return_source_documents=True, + ) + + print("Re-initialized HuggingFaceModel successfully with filter: ", metadata_filename_filter) + + super().__init__(self._retrieve_qa) + except Exception as ex: + print("Inference re-init failed: {}".format(ex)) diff --git a/pyproject.toml b/pyproject.toml index 4ea2f0a..f473e1d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,16 +48,17 @@ huggingface = [ "einops", "accelerate", "bitsandbytes", - "sentence-transformers" + "sentence-transformers", + "xformers" ] rag = [ - "langchain", - "scikit-learn", - "chromadb", - "pyepsilla", - "pdfminer-six", - "docx2txt", - "python-multipart", + "langchain", + "scikit-learn", + "chromadb", + "pyepsilla", + "pdfminer-six", + "docx2txt", + "python-multipart", "tiktoken" ] rlhf = [ diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/chat/__init__.py b/tests/chat/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/chat/db/__init__.py b/tests/chat/db/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/chat/db/test_qa_database.py b/tests/chat/db/test_qa_database.py deleted file mode 100644 index d40368b..0000000 --- a/tests/chat/db/test_qa_database.py +++ /dev/null @@ -1,129 +0,0 @@ -"""Test the QuestionAnswerDatabase class""" -import datetime -import os -import sqlite3 -import unittest - -from pykoi.chat.db.qa_database import QuestionAnswerDatabase - -# Define a temporary database file for testing -TEST_DB_FILE = "test_qd.db" - - -class TestQuestionAnswerDatabase(unittest.TestCase): - """ - Test the QuestionAnswerDatabase class. - """ - - def setUp(self): - # Create a temporary database for testing - self.qadb = QuestionAnswerDatabase(db_file=TEST_DB_FILE, debug=False) - - def tearDown(self): - # Remove the temporary database and close connections after each test - self.qadb.close_connection() - os.remove(TEST_DB_FILE) - - def test_create_table(self): - """ - Test whether the table is created correctly. - """ - # Test whether the table is created correctly - conn = sqlite3.connect(TEST_DB_FILE) - cursor = conn.cursor() - - cursor.execute( - "SELECT name FROM sqlite_master WHERE type='table' AND name='question_answer'" - ) - table_exists = cursor.fetchone() - - self.assertTrue(table_exists) - - # Clean up - cursor.close() - conn.close() - - def test_insert_and_retrieve_question_answer(self): - """ - Test inserting and retrieving a question-answer pair - """ - question = "What is the meaning of life?" - answer = "42" - - # Insert data and get the ID - qa_id = self.qadb.insert_question_answer(question, answer) - - # Retrieve the data - rows = self.qadb.retrieve_all_question_answers() - - # Check if the data was inserted correctly - self.assertEqual(len(rows), 1) - self.assertEqual(rows[0][0], qa_id) - self.assertEqual(rows[0][1], question) - self.assertEqual(rows[0][2], answer) - self.assertEqual(rows[0][3], "n/a") # Default vote status - - def test_update_vote_status(self): - """ - Test updating the vote status of a question-answer pair. - """ - question = "What is the meaning of life?" - answer = "42" - - # Insert data and get the ID - qa_id = self.qadb.insert_question_answer(question, answer) - - # Update the vote status - new_vote_status = "up" - self.qadb.update_vote_status(qa_id, new_vote_status) - - # Retrieve the data - rows = self.qadb.retrieve_all_question_answers() - - # Check if the vote status was updated correctly - self.assertEqual(len(rows), 1) - self.assertEqual(rows[0][0], qa_id) - self.assertEqual(rows[0][3], new_vote_status) - - def test_save_to_csv(self): - """ - Test saving data to a CSV file - """ - question1 = "What is the meaning of life?" - answer1 = "42" - question2 = "What is the best programming language?" - answer2 = "Python" - - # Insert data - timestamp = datetime.datetime.now() - self.qadb.insert_question_answer(question1, answer1) - self.qadb.insert_question_answer(question2, answer2) - - # Save to CSV - self.qadb.save_to_csv("test_csv_file.csv") - - # Check if the CSV file was created and contains the correct data - self.assertTrue(os.path.exists("test_csv_file.csv")) - - with open("test_csv_file.csv", "r") as file: - lines = file.readlines() - - # Verify the CSV file content - timestamp_trim = 10 # Trim 10 characters from the timestamp - self.assertEqual(len(lines), 3) # Header + 2 rows - self.assertEqual(lines[0].strip(), "ID,Question,Answer,Vote Status,Timestamp") - self.assertEqual( - lines[1].strip()[:-timestamp_trim], - f"1,{question1},{answer1},n/a,{timestamp}"[:-timestamp_trim], - ) # Default vote status - self.assertEqual( - lines[2].strip()[:-timestamp_trim], - f"2,{question2},{answer2},n/a,{timestamp}"[:-timestamp_trim], - ) # Default vote status - - # Clean up - os.remove("test_csv_file.csv") - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/chat/db/test_ranking_database.py b/tests/chat/db/test_ranking_database.py deleted file mode 100644 index f813e6f..0000000 --- a/tests/chat/db/test_ranking_database.py +++ /dev/null @@ -1,116 +0,0 @@ -""" -Test the RankingDatabase class -""" -import os -import sqlite3 -import unittest - -from pykoi.chat.db.ranking_database import RankingDatabase - -# Define a temporary database file for testing -TEST_DB_FILE = "test_ranking.db" - - -class TestRankingDatabase(unittest.TestCase): - """ - Test the RankingDatabase class - """ - - def setUp(self): - # Create a temporary database for testing - self.ranking_db = RankingDatabase(db_file=TEST_DB_FILE, debug=False) - - def tearDown(self): - # Remove the temporary database and close connections after each test - self.ranking_db.close_connection() - os.remove(TEST_DB_FILE) - - def test_create_table(self): - """ - Test whether the table is created correctly. - """ - conn = sqlite3.connect(TEST_DB_FILE) - cursor = conn.cursor() - - cursor.execute( - "SELECT name FROM sqlite_master WHERE type='table' AND name='ranking'" - ) - table_exists = cursor.fetchone() - - self.assertTrue(table_exists) - - # Clean up - cursor.close() - conn.close() - - def test_insert_and_retrieve_ranking(self): - """ - Test inserting and retrieving a ranking entry - """ - question = "Which fruit is your favorite?" - up_ranking_answer = "Apple" - low_ranking_answer = "Banana" - - # Insert data and get the ID - ranking_id = self.ranking_db.insert_ranking( - question, up_ranking_answer, low_ranking_answer - ) - - # Retrieve the data - rows = self.ranking_db.retrieve_all_question_answers() - - # Check if the data was inserted correctly - self.assertEqual(len(rows), 1) - self.assertEqual(rows[0][0], ranking_id) - self.assertEqual(rows[0][1], question) - self.assertEqual(rows[0][2], up_ranking_answer) - self.assertEqual(rows[0][3], low_ranking_answer) - - def test_save_to_csv(self): - """ - Test saving data to a CSV file - """ - question1 = "Which fruit is your favorite?" - up_ranking_answer1 = "Apple" - low_ranking_answer1 = "Banana" - question2 = "Which country would you like to visit?" - up_ranking_answer2 = "Japan" - low_ranking_answer2 = "Italy" - - # Insert data - self.ranking_db.insert_ranking( - question1, up_ranking_answer1, low_ranking_answer1 - ) - self.ranking_db.insert_ranking( - question2, up_ranking_answer2, low_ranking_answer2 - ) - - # Save to CSV - self.ranking_db.save_to_csv("test_csv_file.csv") - - # Check if the CSV file was created and contains the correct data - self.assertTrue(os.path.exists("test_csv_file.csv")) - - with open("test_csv_file.csv", "r") as file: - lines = file.readlines() - - # Verify the CSV file content - self.assertEqual(len(lines), 3) # Header + 2 rows - self.assertEqual( - lines[0].strip(), "ID,Question,Up Ranking Answer,Low Ranking Answer" - ) - self.assertEqual( - lines[1].strip(), - f"1,{question1},{up_ranking_answer1},{low_ranking_answer1}", - ) - self.assertEqual( - lines[2].strip(), - f"2,{question2},{up_ranking_answer2},{low_ranking_answer2}", - ) - - # Clean up - os.remove("test_csv_file.csv") - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/chat/llm/__init__.py b/tests/chat/llm/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/chat/llm/test_abs_llm.py b/tests/chat/llm/test_abs_llm.py deleted file mode 100644 index 3a8ce02..0000000 --- a/tests/chat/llm/test_abs_llm.py +++ /dev/null @@ -1,40 +0,0 @@ -""" -Test the AbsLlm class. -""" -import unittest - -from pykoi.chat.llm.abs_llm import AbsLlm - - -class DummyLlm(AbsLlm): - """ - Dummy class for testing the abstract base class AbsLlm. - """ - - def predict(self, message: str): - return f"Q: {message}, A: N/A." - - -class TestAbsLlm(unittest.TestCase): - """ - Test the AbsLlm class. - """ - - def test_predict_abstract_method(self): - """ - Test whether the abstract method `predict` raises NotImplementedError - """ - - test_message = "test" - llm = DummyLlm() - self.assertEqual(llm.predict(test_message), f"Q: {test_message}, A: N/A.") - - def test_docstring(self): - """ - Test whether the class has a docstring - """ - self.assertIsNotNone(AbsLlm.__doc__) - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/chat/llm/test_constants.py b/tests/chat/llm/test_constants.py deleted file mode 100644 index 2e3e71f..0000000 --- a/tests/chat/llm/test_constants.py +++ /dev/null @@ -1,30 +0,0 @@ -""" -Test the constants of the LLM module. -""" -import unittest - -from pykoi.chat.llm.constants import ModelSource - - -class TestLlmName(unittest.TestCase): - """ - Test the ModelSource enum. - """ - - def test_enum_values(self): - """ - Test whether the enum values are defined correctly - """ - self.assertEqual(ModelSource.OPENAI.value, "openai") - self.assertEqual(ModelSource.HUGGINGFACE.value, "huggingface") - - def test_enum_attributes(self): - """ - Test whether the enum attributes are defined correctly - """ - self.assertEqual(ModelSource.OPENAI.name, "OPENAI") - self.assertEqual(ModelSource.HUGGINGFACE.name, "HUGGINGFACE") - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/chat/llm/test_huggingface.py b/tests/chat/llm/test_huggingface.py deleted file mode 100644 index 77e2d74..0000000 --- a/tests/chat/llm/test_huggingface.py +++ /dev/null @@ -1,40 +0,0 @@ -import unittest -from unittest.mock import patch, Mock -from transformers import AutoModelForCausalLM, AutoTokenizer - -from pykoi.chat.llm.abs_llm import AbsLlm -from pykoi.chat.llm.huggingface import HuggingfaceModel - - -class TestHuggingfaceModel(unittest.TestCase): - @patch.object(AutoModelForCausalLM, "from_pretrained") - @patch.object(AutoTokenizer, "from_pretrained") - def setUp(self, mock_model, mock_tokenizer): - self.model_name = "gpt2" - self.mock_model = mock_model - self.mock_tokenizer = mock_tokenizer - - # Mocking the pretrained model and tokenizer - self.mock_model.return_value = Mock() - self.mock_tokenizer.return_value = Mock() - - self.huggingface_model = HuggingfaceModel( - pretrained_model_name_or_path=self.model_name - ) - - def test_name(self): - expected_name = f"{HuggingfaceModel.model_source}_{self.model_name}_100" - self.assertEqual(self.huggingface_model.name, expected_name) - - @patch.object(HuggingfaceModel, "predict") - def test_predict(self, mock_predict): - mock_predict.return_value = ["Hello, how can I assist you today?"] - message = "Hello, chatbot!" - num_of_response = 1 - response = self.huggingface_model.predict(message, num_of_response) - mock_predict.assert_called_once_with(message, num_of_response) - self.assertEqual(response, ["Hello, how can I assist you today?"]) - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/chat/llm/test_openai.py b/tests/chat/llm/test_openai.py deleted file mode 100644 index 5cf01d8..0000000 --- a/tests/chat/llm/test_openai.py +++ /dev/null @@ -1,54 +0,0 @@ -""" -Test the OpenAIModel class -""" -import unittest -from unittest.mock import MagicMock, patch - -from pykoi.chat.llm.openai import OpenAIModel - - -class TestOpenAIModel(unittest.TestCase): - """ - Test the OpenAIModel class - """ - - def test_predict(self): - """ - Test the predict method of the OpenAIModel class - """ - # Test predicting the next word based on a given message - message = "What is the meaning of life?" - predicted_word = "42" - - # Mock the OpenAI.Completion.create behavior - mock_response = MagicMock() - mock_response.choices = [MagicMock()] - mock_response.choices[0].text = f"Answer: {predicted_word}" - openai_completion_create_mock = MagicMock(return_value=mock_response) - - # Patch the OpenAI.Completion.create method to use the mocked version - with patch( - "pykoi.chat.llm.openai.openai.Completion.create", openai_completion_create_mock - ): - openai_model = OpenAIModel( - api_key="fake_api_key", - engine="davinci", - max_tokens=100, - temperature=0.5, - ) - result = openai_model.predict(message, 1) - - # Check if the OpenAI.Completion.create method was called with the correct arguments - openai_completion_create_mock.assert_called_once_with( - engine="davinci", - prompt=f"Question: {message}\nAnswer:", - max_tokens=100, - n=1, - stop="\n", - temperature=0.5, - ) - self.assertEqual(result[0], f"Answer: {predicted_word}") - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/component/__init__.py b/tests/component/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/component/test_base.py b/tests/component/test_base.py deleted file mode 100644 index 84df2f9..0000000 --- a/tests/component/test_base.py +++ /dev/null @@ -1,77 +0,0 @@ -"""Tests for the base module.""" -import unittest - -from pykoi.component.base import Component, DataSource - - -class TestDataSource(unittest.TestCase): - """ - Unit test class for the DataSource class. - - This class tests the initialization of the DataSource class by creating a DataSource instance - with a specific id and a fetch function. It then asserts that the id and the data fetched by - the fetch function are as expected. - - Attributes: - fetch_func (function): A function that returns the data to be fetched. - ds (DataSource): An instance of the DataSource class. - - Methods: - test_init: Tests the initialization of the DataSource class. - """ - - def test_init(self): - """ - Tests the initialization of the DataSource class. - - This method creates a DataSource instance with a specific id and a fetch function. - It then asserts that the id and the data fetched by the fetch function are as expected. - """ - - def fetch_func(): - return "data" - - data_source = DataSource("test_id", fetch_func) - - self.assertEqual(data_source.id, "test_id") - self.assertEqual(data_source.fetch_func(), "data") - - -class TestComponent(unittest.TestCase): - """ - Unit test class for the Component class. - - This class tests the initialization of the Component class by creating a Component instance - with a specific fetch function, a svelte component, and properties. It then asserts that the id, - the data fetched by the fetch function, the svelte component, and the properties are as expected. - - Attributes: - fetch_func (function): A function that returns the data to be fetched. - comp (Component): An instance of the Component class. - - Methods: - test_init: Tests the initialization of the Component class. - """ - - def test_init(self): - """ - Tests the initialization of the Component class. - - This method creates a Component instance with a specific fetch function, a svelte component, - and properties. It then asserts that the id, the data fetched by the fetch function, the svelte - component, and the properties are as expected. - """ - - def fetch_func(): - return "data" - - comp = Component(fetch_func, "TestComponent", prop1="value1", prop2="value2") - - self.assertIsNotNone(comp.id) - self.assertEqual(comp.data_source.fetch_func(), "data") - self.assertEqual(comp.svelte_component, "TestComponent") - self.assertEqual(comp.props, {"prop1": "value1", "prop2": "value2"}) - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_application.py b/tests/test_application.py deleted file mode 100644 index 4f5f3b9..0000000 --- a/tests/test_application.py +++ /dev/null @@ -1,36 +0,0 @@ -""" -Test the Application class. -""" - -import os -import unittest -from unittest.mock import MagicMock, patch - -from pykoi.application import Application - - -class TestApplication(unittest.TestCase): - """ - Unit test class for the Application class. - """ - - def setUp(self): - self.app = Application(share=False, debug=False) - - def test_add_component(self): - """ - Tests adding a component to the application. - """ - component = MagicMock() - component.data_source = MagicMock() - component.id = "test_component" - - self.app.add_component(component) - - # Check if the component and its data source are added to the application - self.assertIn("test_component", self.app.data_sources) - self.assertIn(component, [c["component"] for c in self.app.components]) - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_state.py b/tests/test_state.py deleted file mode 100644 index 3854817..0000000 --- a/tests/test_state.py +++ /dev/null @@ -1,86 +0,0 @@ -""" -Tests for the State class. -""" -import unittest - -from pykoi.state import State, Store - - -class TestState(unittest.TestCase): - """ - Unit test class for the State class. - """ - - def test_get_attribute(self): - """ - Tests getting an attribute from the state. - """ - state = State() - state.state = {"test_attr": 42} - - self.assertEqual(state.test_attr, 42) - - def test_get_non_existing_attribute(self): - """ - Tests getting a non-existing attribute from the state. - """ - state = State() - - with self.assertRaises(AttributeError): - attr = state.non_existing_attr - - def test_set_attribute(self): - """ - Tests setting an attribute in the state. - """ - state = State() - state.test_attr = 42 - - self.assertEqual(state.state["test_attr"], 42) - - def test_call_method(self): - """ - Tests calling a method from the state. - """ - state = State() - state.state = {"test_method": lambda x: x * 2} - - result = state.test_method(3) - self.assertEqual(result, 6) - - -class TestStore(unittest.TestCase): - """ - Unit test class for the Store class. - """ - - def test_increment(self): - """ - Tests incrementing the count. - """ - store = Store() - store.increment() - - self.assertEqual(store.count, 5) - - def test_decrement(self): - """ - Tests decrementing the count. - """ - store = Store() - store.decrement() - - self.assertEqual(store.count, 3) - - def test_hello(self): - """ - Tests the hello method. - """ - store = Store() - hello_msg = store.hello() - - self.assertEqual(hello_msg, "hello jared") - - -if __name__ == "__main__": - unittest.main()