From 6e46b6918b6460194c0cc2fd5ad7de6aea26771d Mon Sep 17 00:00:00 2001
From: Jojo Ortiz
Date: Wed, 22 Nov 2023 20:56:40 -0800
Subject: [PATCH 1/6] move dropdown to open up instead of down
---
pykoi/frontend/src/lib/Chatbots/Components/Dropdown.svelte | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pykoi/frontend/src/lib/Chatbots/Components/Dropdown.svelte b/pykoi/frontend/src/lib/Chatbots/Components/Dropdown.svelte
index 1855c12..a46b190 100644
--- a/pykoi/frontend/src/lib/Chatbots/Components/Dropdown.svelte
+++ b/pykoi/frontend/src/lib/Chatbots/Components/Dropdown.svelte
@@ -121,7 +121,7 @@
.dropdown-content {
position: absolute; /* has to be abs to prevent document overflow */
- top: 100%;
+ bottom: 100%;
left: 0;
width: 100%;
border: 1px #dadada solid;
From de2e0213ae0151109177dc2f518acd723f3e81f8 Mon Sep 17 00:00:00 2001
From: Jojo Ortiz
Date: Wed, 22 Nov 2023 21:46:25 -0800
Subject: [PATCH 2/6] default to select all documents onMount
---
pykoi/frontend/src/lib/Chatbots/RAGChatbot.svelte | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/pykoi/frontend/src/lib/Chatbots/RAGChatbot.svelte b/pykoi/frontend/src/lib/Chatbots/RAGChatbot.svelte
index 42c30ad..ed649bb 100644
--- a/pykoi/frontend/src/lib/Chatbots/RAGChatbot.svelte
+++ b/pykoi/frontend/src/lib/Chatbots/RAGChatbot.svelte
@@ -33,9 +33,15 @@
},
];
+ async function loadRetrievalFilesAndSelect() {
+ await loadRetrievalFiles();
+ $checkedDocs = new Set($uploadedFiles.map((doc) => doc.name));
+ checkedDocs.set(new Set($checkedDocs));
+ }
+
onMount(() => {
getDataFromDB();
- loadRetrievalFiles();
+ loadRetrievalFilesAndSelect();
});
async function loadRetrievalFiles() {
@@ -237,7 +243,7 @@
height: 100vh;
display: grid;
grid-template-columns: 100%;
- grid-template-rows: 65% 35%;
+ grid-template-rows: 80% 20%;
}
.message {
From bef07115badca8db8832e7055abcb37ad3561e75 Mon Sep 17 00:00:00 2001
From: Jojo Ortiz
Date: Wed, 22 Nov 2023 21:51:34 -0800
Subject: [PATCH 3/6] add default RETRIEVAL_MODEL for environment variable
retrieval
---
example/retrieval_qa/retrieval_qa_huggingface_demo.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/example/retrieval_qa/retrieval_qa_huggingface_demo.py b/example/retrieval_qa/retrieval_qa_huggingface_demo.py
index 90f0f44..24771f1 100644
--- a/example/retrieval_qa/retrieval_qa_huggingface_demo.py
+++ b/example/retrieval_qa/retrieval_qa_huggingface_demo.py
@@ -22,8 +22,7 @@
# "mistralai/Mistral-7B-v0.1"
# "databricks/dolly-v2-3b"
-RETRIEVAL_MODEL = os.getenv("RETRIEVAL_MODEL")
-
+RETRIEVAL_MODEL = os.getenv("RETRIEVAL_MODEL", default="mistralai/Mistral-7B-v0.1")
def main(**kwargs):
os.environ["DOC_PATH"] = os.path.join(os.getcwd(), "temp/docs")
From 2c5efcb9f43b03ca3451ca8425c2cdb1ae3c95d4 Mon Sep 17 00:00:00 2001
From: Jojo Ortiz
Date: Wed, 22 Nov 2023 21:52:20 -0800
Subject: [PATCH 4/6] add RAG_NUM_SOURCES environment variable for setting
MIN_DOCS
---
pykoi/retrieval/llm/huggingface.py | 6 +++++-
pykoi/retrieval/llm/openai.py | 8 ++++++--
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/pykoi/retrieval/llm/huggingface.py b/pykoi/retrieval/llm/huggingface.py
index 1051e4a..d4df1ae 100644
--- a/pykoi/retrieval/llm/huggingface.py
+++ b/pykoi/retrieval/llm/huggingface.py
@@ -7,9 +7,13 @@
from pykoi.retrieval.llm.abs_llm import AbsLlm
from pykoi.retrieval.vectordb.abs_vectordb import AbsVectorDb
+from dotenv import load_dotenv
-MIN_DOCS = 2
+# NOTE: Configure your MIN_DOCS as RAG_NUM_SOURCES in .env file.
+# Load environment variables from .env file
+load_dotenv()
+MIN_DOCS = int(os.getenv("RAG_NUM_SOURCES", default=2))
class HuggingFaceModel(AbsLlm):
"""
diff --git a/pykoi/retrieval/llm/openai.py b/pykoi/retrieval/llm/openai.py
index 90133b9..e0d9e7a 100644
--- a/pykoi/retrieval/llm/openai.py
+++ b/pykoi/retrieval/llm/openai.py
@@ -8,10 +8,14 @@
from pykoi.retrieval.llm.abs_llm import AbsLlm
from pykoi.retrieval.vectordb.abs_vectordb import AbsVectorDb
+from dotenv import load_dotenv
+# NOTE: Configure your MIN_DOCS as RAG_NUM_SOURCES in .env file.
+# Load environment variables from .env file
+load_dotenv()
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
-MIN_DOCS = 2
+MIN_DOCS = int(os.getenv("RAG_NUM_SOURCES", default=2))
class OpenAIModel(AbsLlm):
@@ -26,7 +30,7 @@ def __init__(self, vector_db: AbsVectorDb):
try:
self._llm = OpenAI(
model_name="gpt-4",
- temperature=0,
+ temperature=0,
max_tokens=500)
self._vector_db = vector_db.vector_db
From 5ec3bd8ca8944697e16af19f17843a85cd70c094 Mon Sep 17 00:00:00 2001
From: Jojo Ortiz
Date: Wed, 22 Nov 2023 21:53:25 -0800
Subject: [PATCH 5/6] add loading indicators for upload, index, load, and embed
---
pykoi/frontend/src/lib/RAG/RAG.svelte | 128 ++++++++++++++++++++++----
1 file changed, 109 insertions(+), 19 deletions(-)
diff --git a/pykoi/frontend/src/lib/RAG/RAG.svelte b/pykoi/frontend/src/lib/RAG/RAG.svelte
index 190d84c..8c9f9f7 100644
--- a/pykoi/frontend/src/lib/RAG/RAG.svelte
+++ b/pykoi/frontend/src/lib/RAG/RAG.svelte
@@ -4,12 +4,31 @@
import { onMount } from "svelte";
import { uploadedFiles, projections } from "../store.js";
import CloudArrowUp from "../../assets/CloudArrowUp.svelte";
+ import { slide } from "svelte/transition";
+
+ const UPLOAD_STATES = {
+ WAITING: "waiting",
+ IN_PROGRESS: "in-progress",
+ DONE: "done",
+ };
let selectedFiles = [];
- let indexed = false;
- let indexing = false;
+ let uploadState = UPLOAD_STATES.WAITING;
+ let indexState = UPLOAD_STATES.WAITING;
+ let loadState = UPLOAD_STATES.WAITING;
+ let embedState = UPLOAD_STATES.WAITING;
+
+ function resetStates() {
+ uploadState = UPLOAD_STATES.WAITING;
+ indexState = UPLOAD_STATES.WAITING;
+ loadState = UPLOAD_STATES.WAITING;
+ embedState = UPLOAD_STATES.WAITING;
+ }
+
async function handleFileChange(event) {
event.preventDefault();
+ resetStates();
+ uploadState = UPLOAD_STATES.IN_PROGRESS;
let selectedFiles = [];
if (event.dataTransfer) {
if (event.dataTransfer.items) {
@@ -39,12 +58,17 @@
method: "POST",
body: formData,
});
+ const data = await response.json();
+ console.log("Upload complete! Response:", data);
+ uploadState = UPLOAD_STATES.DONE;
indexFiles();
loadServerData();
getEmbeddings();
}
async function loadServerData() {
+ if (indexState === UPLOAD_STATES.IN_PROGRESS)
+ loadState = UPLOAD_STATES.IN_PROGRESS;
const response = await fetch("/retrieval/file/get");
const data = await response.json();
// Transform the received data
@@ -56,30 +80,31 @@
};
});
$uploadedFiles = [...filesData];
+ if (loadState === UPLOAD_STATES.IN_PROGRESS)
+ loadState = UPLOAD_STATES.DONE;
}
async function indexFiles() {
console.log("index!");
- indexing = true;
+ indexState = UPLOAD_STATES.IN_PROGRESS;
const response = await fetch("/retrieval/vector_db/index", {
method: "POST",
});
const data = await response.json();
- indexed = true;
- indexing = false;
+ indexState = UPLOAD_STATES.DONE;
}
async function getEmbeddings() {
+ embedState = UPLOAD_STATES.IN_PROGRESS;
console.log("getting embeddings...");
const response = await fetch("/retrieval/vector_db/get");
const embeddingData = await response.json();
console.log("embeddingData", embeddingData);
$projections = embeddingData;
+ embedState = UPLOAD_STATES.DONE;
}
function dragOverHandler(event) {
- console.log("File(s) in drop zone");
- // Prevent default behavior (Prevent file from being opened)
event.preventDefault();
}
@@ -87,15 +112,25 @@
loadServerData();
});
- let dotState = 0;
+ $: {
+ if (
+ indexState === UPLOAD_STATES.DONE &&
+ loadState === UPLOAD_STATES.DONE &&
+ embedState === UPLOAD_STATES.DONE
+ ) {
+ setTimeout(resetStates, 3000);
+ }
+ }
- // Set an interval to periodically change the number of dots
- setInterval(() => {
- dotState = (dotState + 1) % 4;
- }, 200);
+ // let dotState = 0;
- // Use a reactive statement to create the string with the correct number of dots
- $: dots = "Indexing" + ".".repeat(dotState);
+ // // Set an interval to periodically change the number of dots
+ // setInterval(() => {
+ // dotState = (dotState + 1) % 4;
+ // }, 200);
+
+ // // Use a reactive statement to create the string with the correct number of dots
+ // $: dots = ".".repeat(dotState);
@@ -117,11 +152,13 @@
Drag and drop files here
- {#if indexing && !indexed}
- {dots}
- {/if}
- {#if indexed}
- Data Successfully indexed!
+ {#if uploadState !== UPLOAD_STATES.WAITING}
+
+
Upload
+
Index
+
Load
+
Embed
+
{/if}
Currently pdf, txt, and md are supported.
@@ -194,8 +231,61 @@
gap: 10px;
width: 90%;
}
+ .upload-status {
+ display: flex;
+ gap: 3px;
+ justify-content: center;
+ align-items: center;
+ height: 100%;
+ border-radius: 500px;
+ padding: 0 10px;
+ }
+ @keyframes color {
+ 0% {
+ background-color: var(--yellow);
+ }
+ 50% {
+ background-color: var(--lightGrey);
+ }
+ 100% {
+ background-color: var(--yellow);
+ }
+ }
+
+ .loading {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ height: 100%;
+ padding: 0 10px;
+ border-radius: 2px;
+ }
+ .waiting {
+ background-color: var(--lightGrey);
+ color: var(--grey);
+ }
+ .in-progress {
+ background-color: var(--yellow);
+ animation-name: color;
+ animation-duration: 1s;
+ animation-iteration-count: infinite;
+ }
+
+ .done {
+ background-color: var(--green);
+ color: var(--lightGrey);
+ }
p {
margin: 0;
}
+ .load-left {
+ border-top-left-radius: 0.5em;
+ border-bottom-left-radius: 0.5em;
+ }
+
+ .load-right {
+ border-top-right-radius: 0.5em;
+ border-bottom-right-radius: 0.5em;
+ }
From 8bad17b2ea7e9d1599cb23dad0c4a36891fccb3b Mon Sep 17 00:00:00 2001
From: Jojo Ortiz
Date: Wed, 22 Nov 2023 23:13:58 -0800
Subject: [PATCH 6/6] Add processing files UI to RAG and remove log from
Dropdown
---
pykoi/frontend/dist/assets/index-33aea1b9.css | 1 +
pykoi/frontend/dist/assets/index-3b11fb1e.js | 65 -------------------
pykoi/frontend/dist/assets/index-8dfc5bce.js | 65 +++++++++++++++++++
pykoi/frontend/dist/assets/index-fc934c27.css | 1 -
pykoi/frontend/dist/index.html | 4 +-
.../lib/Chatbots/Components/Dropdown.svelte | 1 -
pykoi/frontend/src/lib/RAG/RAG.svelte | 60 ++++++++++++-----
7 files changed, 112 insertions(+), 85 deletions(-)
create mode 100644 pykoi/frontend/dist/assets/index-33aea1b9.css
delete mode 100644 pykoi/frontend/dist/assets/index-3b11fb1e.js
create mode 100644 pykoi/frontend/dist/assets/index-8dfc5bce.js
delete mode 100644 pykoi/frontend/dist/assets/index-fc934c27.css
diff --git a/pykoi/frontend/dist/assets/index-33aea1b9.css b/pykoi/frontend/dist/assets/index-33aea1b9.css
new file mode 100644
index 0000000..fe67954
--- /dev/null
+++ b/pykoi/frontend/dist/assets/index-33aea1b9.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}.answer.svelte-1cug6ja{display:inline-block;text-align:left;padding:10px;border:1px solid var(--black);width:100%}.small-button.svelte-1cug6ja{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-1cug6ja{display:flex;text-align:center;margin:auto;width:20%}.small-button.svelte-1cug6ja:hover{box-shadow:var(--shadow-md)}.thumbs-up.svelte-1cug6ja,.thumbs-up.svelte-1cug6ja:hover,.thumbs-up.svelte-1cug6ja::selection{background:var(--green)}.thumbs-down.svelte-1cug6ja,.thumbs-down.svelte-1cug6ja:hover,.thumbs-down.svelte-1cug6ja::selection{background:var(--red)}.vote-selected.svelte-1cug6ja{border:3px solid black;opacity:1}.vote-not-selected.svelte-1cug6ja{border:3px solid transparent;opacity:.65}.ranked-chat.svelte-yzyd3k.svelte-yzyd3k{height:100vh;display:grid;grid-template-columns:100%;grid-template-rows:80% 20%}.message.svelte-yzyd3k.svelte-yzyd3k{font-size:var(--smallText);padding-left:40px;padding-right:40px;margin:0 auto}.chat-input-holder.svelte-yzyd3k.svelte-yzyd3k{display:flex;flex-direction:column;align-items:center;padding:5px;width:100%;max-width:820px;margin:auto}.chat-input-textarea.svelte-yzyd3k.svelte-yzyd3k{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-yzyd3k.svelte-yzyd3k{display:flex;width:100%}.btnyousend.svelte-yzyd3k.svelte-yzyd3k{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-yzyd3k.svelte-yzyd3k{opacity:1}.green.svelte-yzyd3k.svelte-yzyd3k{border-bottom:2px solid var(--green)}.red.svelte-yzyd3k.svelte-yzyd3k{border-bottom:2px solid var(--red)}.instructions.svelte-yzyd3k.svelte-yzyd3k{text-align:center;padding:5%}.instructions.svelte-yzyd3k h5.svelte-yzyd3k{text-align:left}.instructions.svelte-yzyd3k p.svelte-yzyd3k{font-size:var(--smallText);text-align:left}.instructions.svelte-yzyd3k button.svelte-yzyd3k{font-size:var(--smallText)}.ranked-feedback-container.svelte-yzyd3k.svelte-yzyd3k{display:grid;grid-template-columns:20% 80%}.underline.svelte-yzyd3k.svelte-yzyd3k{border-bottom:var(--line)}.bold.svelte-yzyd3k.svelte-yzyd3k{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-yzyd3k.svelte-yzyd3k{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-yzyd3k.svelte-yzyd3k{flex:1;overflow-y:auto;padding:0 10px;box-sizing:border-box}.chat-message.svelte-yzyd3k.svelte-yzyd3k{background-color:var(--white);border-bottom:var(--line);box-sizing:border-box}.chat-message-center.svelte-yzyd3k.svelte-yzyd3k{display:flex;flex-direction:column;margin-left:auto;margin-right:auto;padding:12px;box-sizing:border-box}.message-content.svelte-yzyd3k.svelte-yzyd3k{display:flex;flex-direction:column;box-sizing:border-box}.message-content.svelte-yzyd3k .question.svelte-yzyd3k{text-align:left;border:1px solid var(--grey);padding:5px;background-color:var(--lightGrey)}.message-content.svelte-yzyd3k .answers.svelte-yzyd3k{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-1wrkg2k.svelte-1wrkg2k{position:relative;max-width:200px}.selectBox.svelte-1wrkg2k.svelte-1wrkg2k{position:relative}.selectBox.svelte-1wrkg2k select.svelte-1wrkg2k{width:100%;font-weight:700}.overSelect.svelte-1wrkg2k.svelte-1wrkg2k{position:absolute;left:0;right:0;top:0;bottom:0}.dropdown-content.svelte-1wrkg2k.svelte-1wrkg2k{position:absolute;bottom:100%;left:0;width:100%;border:1px #dadada solid;background-color:#fff;z-index:1;padding:.5em}.checkbox-container.svelte-1wrkg2k.svelte-1wrkg2k{display:flex;flex-direction:column;align-items:flex-start}.checkbox-container.svelte-1wrkg2k label.svelte-1wrkg2k{display:inline-block;padding-right:10px;white-space:nowrap}.checkbox-container.svelte-1wrkg2k input.svelte-1wrkg2k,.checkbox-container.svelte-1wrkg2k label span.svelte-1wrkg2k{cursor:pointer;vertical-align:middle}.select-button-container.svelte-1wrkg2k.svelte-1wrkg2k{width:100%;display:flex;justify-content:center;padding-top:1em}.select-button-container.svelte-1wrkg2k button.svelte-1wrkg2k{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)}.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}.drop-zone.svelte-qkz5xu{display:flex;flex-direction:column;align-items:center;justify-content:center;border:2px dashed var(--grey);background-color:var(--lightGrey);width:100%;color:#444;min-height:300px}.file-container.svelte-qkz5xu{display:grid;height:calc(100% - var(--headerHeight));align-items:center;justify-content:center}.upload-container.svelte-qkz5xu{margin:auto;max-width:100%;text-align:center}.charts-container.svelte-qkz5xu{height:calc(100vh - var(--headerHeight));display:grid;gap:2%;grid-template-columns:100%;grid-template-rows:50% 40%}.data-grid.svelte-qkz5xu{display:grid;grid-template-columns:45% 50%;gap:8px;margin:auto;max-width:1200px;padding-top:20px}.upload-box.svelte-qkz5xu{display:flex;gap:10px;flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%;margin:auto;padding:20px;border:1px solid #333;box-sizing:border-box;overflow:hidden}.upload-files-container.svelte-qkz5xu{display:flex;flex-direction:column;gap:10px;width:90%}.processing-container.svelte-qkz5xu{color:gray;display:flex;gap:4px;font-size:small}.processing-files.svelte-qkz5xu{margin:0;max-width:280px;max-height:2em;overflow-x:auto;overflow-y:hidden;white-space:nowrap;border:1px solid var(--grey);border-radius:.1em;padding:.1em .5em}.upload-status.svelte-qkz5xu{display:flex;gap:3px;justify-content:center;align-items:center;height:100%;border-radius:500px;padding:0 10px}@keyframes svelte-qkz5xu-color{0%{background-color:var(--yellow)}50%{background-color:var(--lightGrey)}to{background-color:var(--yellow)}}.loading.svelte-qkz5xu{display:flex;justify-content:center;align-items:center;height:100%;padding:0 10px;border-radius:2px}.waiting.svelte-qkz5xu{background-color:var(--lightGrey);color:var(--grey)}.in-progress.svelte-qkz5xu{background-color:var(--yellow);animation-name:svelte-qkz5xu-color;animation-duration:1s;animation-iteration-count:infinite}.done.svelte-qkz5xu{background-color:var(--green);color:var(--lightGrey)}.load-left.svelte-qkz5xu{border-top-left-radius:.5em;border-bottom-left-radius:.5em}.load-right.svelte-qkz5xu{border-top-right-radius:.5em;border-bottom-right-radius:.5em}p.svelte-qkz5xu{margin:0}.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-3b11fb1e.js b/pykoi/frontend/dist/assets/index-3b11fb1e.js
deleted file mode 100644
index 3e8e898..0000000
--- a/pykoi/frontend/dist/assets/index-3b11fb1e.js
+++ /dev/null
@@ -1,65 +0,0 @@
-(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 X(){}const Zs=e=>e;function Cn(e,t){for(const n in t)e[n]=t[n];return e}function ea(e){return e()}function Jl(){return Object.create(null)}function he(e){e.forEach(ea)}function Ve(e){return typeof e=="function"}function ue(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Nu(e){return Object.keys(e).length===0}function $l(e,...t){if(e==null)return X;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function Pu(e){let t;return $l(e,n=>t=n)(),t}function ae(e,t,n){e.$$.on_destroy.push($l(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?Cn(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(),Ro=na?e=>requestAnimationFrame(e):X;const Xt=new Set;function oa(e){Xt.forEach(t=>{t.c(e)||(Xt.delete(t),t.f())}),Xt.size!==0&&Ro(oa)}function ia(e){let t;return Xt.size===0&&Ro(oa),{promise:new Promise(n=>{Xt.add(t={c:e,f:n})}),abort(){Xt.delete(t)}}}let Al=!1;function Tu(){Al=!0}function Ou(){Al=!1}function zu(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:zu(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 ju(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 xu(e){return Array.from(e.childNodes)}function Uu(e){e.claim_info===void 0&&(e.claim_info={last_index:0,total_claimed:0})}function Wu(e,t,n,l,o=!1){Uu(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 Wu(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 J(e,t){t=""+t,e.data!==t&&(e.data=t)}function Qe(e,t){e.value=t??""}function ye(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;lonresize=function(){parent.postMessage(0,'*')}<\/script>",r=x(window,"message",s=>{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 Oe(e,t,n){e.classList[n?"add":"remove"](t)}function Qu(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 ol=new Map;let il=0;function Ku(e){let t=5381,n=e.length;for(;n--;)t=(t<<5)-t^e.charCodeAt(n);return t>>>0}function Ju(e,t){const n={stylesheet:Lu(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=`{
-`;for(let v=0;v<=1;v+=a){const w=t+(n-t)*r(v);f+=v*100+`%{${s(w,1-w)}}
-`}const c=f+`100% {${s(n,1-n)}}
-}`,d=`__svelte_${Ku(c)}_${u}`,g=ra(e),{stylesheet:p,rules:m}=ol.get(g)||Ju(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 Zu(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||ef())}function ef(){Ro(()=>{il||(ol.forEach(e=>{const{ownerNode:t}=e.stylesheet;t&&N(t)}),ol.clear())})}let Zt;function Ot(e){Zt=e}function tf(){if(!Zt)throw new Error("Function called outside component initialization");return Zt}function ct(e){tf().$$.on_mount.push(e)}function nf(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach(l=>l.call(this,t))}const xt=[],tt=[];let Yt=[];const Zl=[],lf=Promise.resolve();let eo=!1;function of(){eo||(eo=!0,lf.then(aa))}function Re(e){Yt.push(e)}function $n(e){Zl.push(e)}const El=new Set;let Ht=0;function aa(){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 an;function af(){return an||(an=Promise.resolve(),an.then(()=>{an=null})),an}function Fl(e,t,n){e.dispatchEvent(Qu(`${t?"intro":"outro"}${n}`))}const Qn=new Set;let ht;function _e(){ht={r:0,c:[],p:ht}}function ve(){ht.r||he(ht.c),ht=ht.p}function z(e,t){e&&e.i&&(Qn.delete(e),e.i(t))}function L(e,t,n,l){if(e&&e.o){if(Qn.has(e))return;Qn.add(e),ht.c.push(()=>{Qn.delete(e),l&&(n&&e.d(1),l())}),e.o(t)}else l&&l()}const uf={duration:0};function ot(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&&Zu(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=Zs,tick:w=X,css:y}=r||uf,C={start:la()+m,b:p};p||(C.group=ht,ht.r+=1),u||a?a=C:(y&&(c(),f=Ko(e,s,p,_,m,v,y)),p&&w(0,1),u=d(C,_),Re(()=>Fl(e,p,"start")),ia(M=>{if(a&&M>a.start&&(u=d(a,_),a=null,Fl(e,u.b,"start"),y&&(c(),f=Ko(e,s,u.b,u.duration,0,v,r.css))),u){if(M>=u.end)w(s=u.b,1-s),Fl(e,u.b,"end"),a||(u.b?c():--u.group.r||he(u.group.c)),u=null;else if(M>=u.start){const S=M-u.start;s=u.a+u.d*v(S/u.duration),w(s,1-s)}}return!!(u||a)}))}return{run(p){Ve(r)?af().then(()=>{r=r(o),g(p)}):g(p)},end(){c(),u=a=null}}}function en(e,t){e.d(1),t.delete(e.key)}function Mo(e,t){L(e,1,1,()=>{t.delete(e.key)})}function pt(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=[],w=new Map,y=new Map,C=[];for(m=p;m--;){const $=d(o,r,m),R=n($);let k=s.get(R);k?l&&C.push(()=>k.p($,t)):(k=f(R,$),k.c()),w.set(R,v[m]=k),R in _&&y.set(R,Math.abs(m-_[R]))}const M=new Set,S=new Set;function E($){z($,1),$.m(u,c),s.set($.key,$),c=$.first,p--}for(;g&&p;){const $=v[p-1],R=e[g-1],k=$.key,F=R.key;$===R?(c=$.first,g--,p--):w.has(F)?!s.has(k)||M.has(k)?E($):S.has(F)?g--:y.get(k)>y.get(F)?(S.add(k),E($)):(M.add(F),g--):(a(R,s),g--)}for(;g--;){const $=e[g];w.has($.key)||a($,s)}for(;p;)E(v[p-1]);return he(C),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 ff=/[&"]/g,cf=/[&<]/g;function df(e,t=!1){const n=String(e),l=t?ff:cf;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 hf(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 he(Dl),{html:s,css:{code:Array.from(r.css).map(u=>u.code).join(`
-`),map:null},head:r.title+r.head}},$$render:t}}function An(e,t,n){const l=e.$$.props[t];l!==void 0&&(e.$$.bound[l]=n,n(e.$$.ctx[l]))}function le(e){e&&e.c()}function gf(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||Re(()=>{const s=e.$$.on_mount.map(ea).filter(Ve);e.$$.on_destroy?e.$$.on_destroy.push(...s):he(s),e.$$.on_mount=[]}),r.forEach(Re)}function te(e,t){const n=e.$$;n.fragment!==null&&(sf(n.after_update),he(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function pf(e,t){e.$$.dirty[0]===-1&&(xt.push(e),of(),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&&pf(e,d)),g}):[],f.update(),c=!0,he(f.before_update),f.fragment=l?l(f.ctx):!1,t.target){if(t.hydrate){Tu();const d=xu(t.target);f.fragment&&f.fragment.l(d),d.forEach(N)}else f.fragment&&f.fragment.c();t.intro&&z(e.$$.fragment),ee(e,t.target,t.anchor,t.customElement),Ou(),aa()}Ot(a)}class fe{$destroy(){te(this,1),this.$destroy=X}$on(t,n){if(!Ve(n))return X;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&&!Nu(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Gt=[];function to(e,t){return{subscribe:Ie(e,t).subscribe}}function Ie(e,t=X){let n;const l=new Set;function o(u){if(ue(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 mf(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=X;const d=()=>{if(f)return;c();const p=t(l?a[0]:a,s);r?s(p):c=Ve(p)?p:X},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=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:g=Zs,interpolate:p=no}=Cn(Cn({},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=_(g(w/d))),!0)}),l.promise}return{set:r,update:(s,u)=>r(s(o,e),u),subscribe:n.subscribe}}const Ge=Ie([]),Il=Ie([]),un=Ie([]),Rn=Ie([]),at=Ie("all"),Zo=Ie({"n/a":1,up:1,down:1}),_f=["who","what","how","why","where","does","can","n/a"],lo=Fo(_f.map(e=>({question:e,count:0}))),It=Ie(new Set);var oo="http://www.w3.org/1999/xhtml";const ei={svg:"http://www.w3.org/2000/svg",xhtml:oo,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 vf(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===oo&&t.documentElement.namespaceURI===oo?t.createElement(e):t.createElementNS(n,e)}}function bf(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ha(e){var t=da(e);return(t.local?bf:vf)(t)}function wf(){}function ga(e){return e==null?wf:function(){return this.querySelector(e)}}function yf(e){typeof e!="function"&&(e=ga(e));for(var t=this._groups,n=t.length,l=new Array(n),o=0;o=C&&(C=y+1);!(S=v[C])&&++C=0;)(s=l[o])&&(r&&s.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(s,r),r=s);return this}function Wf(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 Yf(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Qf(){return Array.from(this)}function Kf(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?ac:typeof t=="function"?fc:uc)(e,t,n??"")):dc(this.node(),e)}function dc(e,t){return e.style.getPropertyValue(t)||va(e).getComputedStyle(e,null).getPropertyValue(t)}function hc(e){return function(){delete this[e]}}function gc(e,t){return function(){this[e]=t}}function pc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function mc(e,t){return arguments.length>1?this.each((t==null?hc:typeof t=="function"?pc:gc)(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 Bc(e){return function(){var t=this.__on;if(t){for(var n=0,l=-1,o=t.length,r;n({}),ti=e=>({});function Zc(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=P(),d&&d.c(),s=P(),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,_){O(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(){Ve(e[1])&&e[1].apply(this,arguments)}),x(n,"click",ju(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],_,Jc):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||(z(d,m),z(p,m),u=!0)},o(m){L(d,m),L(p,m),u=!1},d(m){m&&N(t),d&&d.d(m),p&&p.d(m),e[6](null),a=!1,he(f)}}}function ed(e,t,n){let{$$slots:l={},$$scope:o}=t,{showModal:r}=t,{dialog:s}=t,{handleClose:u}=t;function a(c){nf.call(this,e,c)}function f(c){tt[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 td extends fe{constructor(t){super(),ce(this,t,ed,Zc,ue,{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='Download ',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){O(c,t,d),b(t,n),b(n,l),b(n,o),b(n,r),Qe(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]&&Qe(r,c[2])},d(c){c&&N(t),a=!1,he(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){O(c,t,d),b(t,n),b(t,l),b(t,o),O(c,r,d),O(c,s,d),b(s,u),a||(f=x(u,"click",e[7]),a=!0)},p(c,d){d&4&&J(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){O(f,t,c),O(f,n,c),O(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:X,d(f){f&&N(t),f&&N(n),f&&N(l),u=!1,he(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(g,p){O(g,t,p),b(t,n),b(t,l),b(t,o),O(g,r,p),O(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&&J(l,g[2])},d(g){g&&N(t),g&&N(r),g&&N(s),c=!1,he(d)}}}function nd(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=ke()},m(f,c){r&&r.m(f,c),O(f,t,c),s&&s.m(f,c),O(f,n,c),u&&u.m(f,c),O(f,l,c),a&&a.m(f,c),O(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 ld(e){let t;return{c(){t=A("h4"),t.textContent="Download Data",h(t,"slot","header"),h(t,"class","svelte-sy2m0x")},m(n,l){O(n,t,l)},p:X,d(n){n&&N(t)}}}function od(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:[ld],default:[nd]},$$scope:{ctx:e}};return e[0]!==void 0&&(u.showModal=e[0]),e[1]!==void 0&&(u.dialog=e[1]),t=new td({props:u}),tt.push(()=>An(t,"showModal",r)),tt.push(()=>An(t,"dialog",s)),{c(){le(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||(z(t.$$.fragment,a),o=!0)},o(a){L(t.$$.fragment,a),o=!1},d(a){te(t,a)}}}function id(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 y=>{const C={file_name:y},S=await(await fetch(`/chat/${o}/save_to_csv`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)})).json();console.log("Download Complete: ",S),S.status==="200"?(console.log("success"),n(3,a=u.DOWNLOADED)):(console.log("failed"),n(3,a=u.FAILED_DOWNLOAD))},c=async y=>{y.preventDefault();const C=await fetch(`/file_exists/?file_name=${s}.csv`),{file_exists:M}=await C.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(y){l=y,n(0,l)}function w(y){r=y,n(1,r)}return e.$$set=y=>{"showModal"in y&&n(0,l=y.showModal),"table"in y&&n(8,o=y.table)},[l,r,s,a,u,f,c,d,o,g,p,m,_,v,w]}class Io extends fe{constructor(t){super(),ce(this,t,id,od,ue,{showModal:0,table:8})}}function ri(e){let t;return{c(){t=A("h5"),t.textContent="Response:",h(t,"class","bold")},m(n,l){O(n,t,l)},d(n){n&&N(t)}}}function si(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-1cug6ja"),Oe(n,"vote-selected",e[0].vote_status==="up"),Oe(n,"vote-not-selected",e[0].vote_status==="down"),h(o,"class","small-button thumbs-down svelte-1cug6ja"),Oe(o,"vote-selected",e[0].vote_status==="down"),Oe(o,"vote-not-selected",e[0].vote_status==="up"),h(t,"class","feedback-buttons svelte-1cug6ja")},m(u,a){O(u,t,a),b(t,n),b(t,l),b(t,o),r||(s=[x(n,"click",e[5]),x(o,"click",e[6])],r=!0)},p(u,a){a&1&&Oe(n,"vote-selected",u[0].vote_status==="up"),a&1&&Oe(n,"vote-not-selected",u[0].vote_status==="down"),a&1&&Oe(o,"vote-selected",u[0].vote_status==="down"),a&1&&Oe(o,"vote-not-selected",u[0].vote_status==="up")},d(u){u&&N(t),r=!1,he(s)}}}function rd(e){let t,n,l,o=e[0].answer+"",r,s,u=e[3]&&ri(),a=e[1]&&si(e);return{c(){t=A("div"),u&&u.c(),n=P(),l=A("p"),r=q(o),s=P(),a&&a.c(),h(t,"class","answer svelte-1cug6ja")},m(f,c){O(f,t,c),u&&u.m(t,null),b(t,n),b(t,l),b(l,r),b(t,s),a&&a.m(t,null)},p(f,[c]){f[3]?u||(u=ri(),u.c(),u.m(t,n)):u&&(u.d(1),u=null),c&1&&o!==(o=f[0].answer+"")&&J(r,o),f[1]?a?a.p(f,c):(a=si(f),a.c(),a.m(t,null)):a&&(a.d(1),a=null)},i:X,o:X,d(f){f&&N(t),u&&u.d(),a&&a.d()}}}function sd(e,t,n){let l;ae(e,Ge,g=>n(7,l=g));let{message:o={}}=t,{feedback:r=!1}=t,{index:s=0}=t,{title:u=!1}=t;async function a(g){const p=await fetch("/chat/rag_table/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)});if(p.ok)console.log("response",p),n(0,o.vote_status=g.vote_status,o);else{const m=await p.text();alert(m)}}function f(g,p,m){const _=l[m];_.vote=p;const v={id:m+1,vote_status:p};a(v)}console.log("Answer",o.vote_status);const c=g=>f(g,"up",s),d=g=>f(g,"down",s);return e.$$set=g=>{"message"in g&&n(0,o=g.message),"feedback"in g&&n(1,r=g.feedback),"index"in g&&n(2,s=g.index),"title"in g&&n(3,u=g.title)},[o,r,s,u,f,c,d]}class $a extends fe{constructor(t){super(),ce(this,t,sd,rd,ue,{message:0,feedback:1,index:2,title:3})}}function ai(e,t,n){const l=e.slice();return l[17]=t[n],l[19]=n,l}function ui(e,t){let n,l,o,r,s,u,a,f,c,d=t[17].question+"",g,p,m,_,v,w,y,C,M;return _=new $a({props:{feedback:t[0],message:t[17],index:t[19],title:!0}}),{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"),g=q(d),p=P(),m=A("div"),le(_.$$.fragment),v=P(),h(o,"class","avatar"),h(a,"class","bold svelte-yzyd3k"),h(u,"class","question svelte-yzyd3k"),h(m,"class","answers svelte-yzyd3k"),h(s,"class","message-content svelte-yzyd3k"),h(l,"class","chat-message-center svelte-yzyd3k"),h(n,"class","chat-message svelte-yzyd3k"),this.first=n},m(S,E){O(S,n,E),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),ee(_,m,null),b(n,v),y=!0,C||(M=Vt(w=ud.call(null,n,t[19]===t[5].length-1)),C=!0)},p(S,E){t=S,(!y||E&32)&&d!==(d=t[17].question+"")&&J(g,d);const $={};E&1&&($.feedback=t[0]),E&32&&($.message=t[17]),E&32&&($.index=t[19]),_.$set($),w&&Ve(w.update)&&E&32&&w.update.call(null,t[19]===t[5].length-1)},i(S){y||(z(_.$$.fragment,S),y=!0)},o(S){L(_.$$.fragment,S),y=!1},d(S){S&&N(n),te(_),C=!1,M()}}}function ad(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m,_=[],v=new Map,w,y,C,M,S,E,$=(e[3]?e[4]:"Send")+"",R,k,F,T,I,V,D;function G(W){e[10](W)}let U={table:"qa_table"};e[1]!==void 0&&(U.showModal=e[1]),t=new Io({props:U}),tt.push(()=>An(t,"showModal",G));let j=e[5];const K=W=>W[19];for(let W=0;W👍
- button. If the repsonse is not satisfactory, click on the
- 👎 button.`,f=P(),c=A("button"),c.textContent="Download Data",d=P(),g=A("div"),p=A("section"),m=A("div");for(let W=0;W<_.length;W+=1)_[W].c();w=P(),y=A("div"),C=A("form"),M=A("input"),S=P(),E=A("button"),R=q($),F=P(),T=A("p"),T.textContent="Note - may produce inaccurate information.",h(s,"class","underline bold svelte-yzyd3k"),h(a,"class","svelte-yzyd3k"),h(c,"class","svelte-yzyd3k"),h(r,"class","instructions svelte-yzyd3k"),h(m,"class","chat-log svelte-yzyd3k"),h(p,"class","chatbox svelte-yzyd3k"),h(M,"class","chat-input-textarea svelte-yzyd3k"),h(M,"placeholder","Type Question Here"),h(E,"class",k="btnyousend "+(e[2]===""?"":"active")+" svelte-yzyd3k"),h(E,"type","submit"),h(C,"class","chat-input-form svelte-yzyd3k"),h(T,"class","message svelte-yzyd3k"),h(y,"class","chat-input-holder svelte-yzyd3k"),h(g,"class","ranked-chat svelte-yzyd3k"),h(o,"class","ranked-feedback-container svelte-yzyd3k")},m(W,Y){ee(t,W,Y),O(W,l,Y),O(W,o,Y),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 Q=0;Q<_.length;Q+=1)_[Q]&&_[Q].m(m,null);b(g,w),b(g,y),b(y,C),b(C,M),Qe(M,e[2]),b(C,S),b(C,E),b(E,R),b(y,F),b(y,T),I=!0,V||(D=[x(c,"click",e[7]),x(M,"input",e[11]),x(C,"submit",e[6])],V=!0)},p(W,[Y]){const Q={};!n&&Y&2&&(n=!0,Q.showModal=W[1],$n(()=>n=!1)),t.$set(Q),Y&33&&(j=W[5],_e(),_=pt(_,Y,K,1,W,j,v,m,Mo,ui,null,ai),ve()),Y&4&&M.value!==W[2]&&Qe(M,W[2]),(!I||Y&24)&&$!==($=(W[3]?W[4]:"Send")+"")&&J(R,$),(!I||Y&4&&k!==(k="btnyousend "+(W[2]===""?"":"active")+" svelte-yzyd3k"))&&h(E,"class",k)},i(W){if(!I){z(t.$$.fragment,W);for(let Y=0;Y{e.scrollIntoView({behavior:"smooth"})},0)}function fd(e,t,n){let l,o;ae(e,Ge,w=>n(5,o=w));let r=!1,{feedback:s=!1}=t,{is_retrieval:u=!1}=t,a="",f="",c=!1;ct(()=>{d()});async function d(){const M=(await(await fetch("/chat/qa_table/retrieve")).json()).rows.map(S=>({id:S[0],question:S[1],answer:S[2],vote_status:S[3]}));De(Ge,o=[...M],o)}const g=async w=>{w.preventDefault(),a=f,n(2,f=""),n(3,c=!0);let y={id:o.length+1,question:a,answer:"Loading...",vote_status:"na"};De(Ge,o=[...o,y],o);const C=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(C.ok){const M=await C.json();console.log("response data",M),y.answer=M.answer,Ge.update(S=>(S[S.length-1]=y,S))}else{const M=await C.text();alert(M)}n(3,c=!1)};let p=0;setInterval(()=>{n(9,p=(p+1)%4)},200);function m(){n(1,r=!0)}[...Array(10).keys()].map(w=>String.fromCharCode(65+w));function _(w){r=w,n(1,r)}function v(){f=this.value,n(2,f)}return e.$$set=w=>{"feedback"in w&&n(0,s=w.feedback),"is_retrieval"in w&&n(8,u=w.is_retrieval)},e.$$.update=()=>{e.$$.dirty&512&&n(4,l=".".repeat(p).padEnd(3))},[s,r,f,c,l,o,g,m,u,p,_,v]}class No extends fe{constructor(t){super(),ce(this,t,fd,ad,ue,{feedback:0,is_retrieval:8})}}function fi(e,t,n){const l=e.slice();return l[14]=t[n],l[16]=n,l}function ci(e,t){let n,l,o,r,s,u,a,f,c,d=t[14].question+"",g,p,m,_,v,w,y,C=t[14].up_ranking_answer+"",M,S,E,$,R,k,F=t[14].low_ranking_answer+"",T,I,V,D,G;function U(...Y){return t[7](t[14],t[16],...Y)}function j(...Y){return t[8](t[14],t[16],...Y)}function K(...Y){return t[9](t[14],t[16],...Y)}function W(...Y){return t[10](t[14],t[16],...Y)}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"),g=q(d),p=P(),m=A("div"),_=A("div"),v=A("h5"),v.textContent="Response 1:",w=P(),y=A("p"),M=q(C),S=P(),E=A("div"),$=A("h5"),$.textContent="Response 2:",R=P(),k=A("p"),T=q(F),I=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($,"class","bold underline svelte-au920n"),h(E,"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(Y,Q){O(Y,n,Q),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(_,w),b(_,y),b(y,M),b(m,S),b(m,E),b(E,$),b(E,R),b(E,k),b(k,T),b(n,I),D||(G=[x(_,"click",U),x(_,"keydown",j),x(E,"click",K),x(E,"keydown",W),Vt(V=dd.call(null,n,t[16]===t[3].length-1))],D=!0)},p(Y,Q){t=Y,Q&8&&d!==(d=t[14].question+"")&&J(g,d),Q&8&&C!==(C=t[14].up_ranking_answer+"")&&J(M,C),Q&8&&F!==(F=t[14].low_ranking_answer+"")&&J(T,F),V&&Ve(V.update)&&Q&8&&V.update.call(null,t[16]===t[3].length-1)},d(Y){Y&&N(n),D=!1,he(G)}}}function cd(e){let t,n,l,o,r,s,u=[],a=new Map,f,c,d,g,p,m,_=(e[1]?e[2]:"Send")+"",v,w,y,C,M,S,E=e[3];const $=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.
- Download Data `,l=P(),o=A("div"),r=A("section"),s=A("div");for(let R=0;R{e.scrollIntoView({behavior:"smooth"})},0)}async function hd(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 gd(e,t,n){let l,o;ae(e,Il,v=>n(3,o=v));let r="",s="",u=!1;ct(()=>{});const a=async v=>{v.preventDefault(),r=s,n(0,s=""),n(1,u=!0);let w={question:r,up_ranking_answer:"Loading...",low_ranking_answer:"Loading..."};De(Il,o=[...o,w],o);const y=await fetch(`/chat/multi_responses/${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:r})});if(y.ok){const C=await y.json();w.up_ranking_answer=C.answer[0],w.low_ranking_answer=C.answer[1],Il.update(M=>(M[M.length-1]=w,M))}else{const C=await y.text();alert(C)}n(1,u=!1)};let f=0;setInterval(()=>{n(6,f=(f+1)%4)},200);function c(v,w,y,C){const M=o[y],S={1:"up_ranking_answer",2:"low_ranking_answer"},E={question:M.question,up_ranking_answer:M[S[C]],low_ranking_answer:M[S[C%2+1]]};hd(E),Mn(v.currentTarget.parentNode).selectAll("div").style("outline","2px solid var(--red)").style("border","1px solid var(--red)"),Mn(v.currentTarget).style("outline","2px solid var(--green)").style("border","1px solid var(--green)")}const d=(v,w,y)=>c(y,v,w,1),g=(v,w,y)=>c(y,v,w,1),p=(v,w,y)=>c(y,v,w,2),m=(v,w,y)=>c(y,v,w,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 pd extends fe{constructor(t){super(),ce(this,t,gd,cd,ue,{})}}function io(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 md(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 _d(e){const t=n=>{e&&!e.contains(n.target)&&!n.defaultPrevented&&e.dispatchEvent(new CustomEvent("click_outside",e))};return document.addEventListener("click",t,!0),{destroy(){document.removeEventListener("click",t,!0)}}}function di(e,t,n){const l=e.slice();return l[11]=t[n],l[13]=n,l}function vd(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 yd(e,t,n){let l;ae(e,It,m=>n(1,l=m));let{documents:o=[]}=t,r=!1,s;function u(m){m.preventDefault(),n(2,r=!r)}function a(m,_){_.target.checked?l.add(m):l.delete(m),It.set(new Set(l))}function f(m){m.preventDefault(),De(It,l=new Set(o.map(_=>_.name)),l),It.set(new Set(l))}function c(m){m.preventDefault(),De(It,l=new Set,l),It.set(new Set(l))}function d(m){m.preventDefault(),console.log("click outside"),n(2,r=!1)}const g=(m,_)=>a(m.name,_);function p(m){tt[m?"unshift":"push"](()=>{s=m,n(3,s)})}return e.$$set=m=>{"documents"in m&&n(0,o=m.documents)},e.$$.update=()=>{e.$$.dirty&2&&console.log(l)},[o,l,r,s,u,a,f,c,d,g,p]}let kd=class extends fe{constructor(t){super(),ce(this,t,yd,wd,ue,{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(w=>`${w[0].toUpperCase()}${w.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:w=>`overflow: hidden;opacity: ${Math.min(w*20,1)*s};${u}: ${w*a}px;padding-${f[0]}: ${w*d}px;padding-${f[1]}: ${w*g}px;margin-${f[0]}: ${w*p}px;margin-${f[1]}: ${w*m}px;border-${f[0]}-width: ${w*_}px;border-${f[1]}-width: ${w*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 Sd(e){let t;return{c(){t=A("p"),t.textContent="⌄",h(t,"class","svelte-1pk2e1k")},m(n,l){O(n,t,l)},d(n){n&&N(t)}}}function Cd(e){let t;return{c(){t=A("p"),t.textContent="⌃",h(t,"class","svelte-1pk2e1k")},m(n,l){O(n,t,l)},d(n){n&&N(t)}}}function pi(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){O(s,t,u),b(t,n),b(n,l),r=!0},p(s,u){(!r||u&2)&&J(l,s[1])},i(s){r||(Re(()=>{r&&(o||(o=ot(t,En,{},!0)),o.run(1))}),r=!0)},o(s){o||(o=ot(t,En,{},!1)),o.run(0),r=!1},d(s){s&&N(t),s&&o&&o.end()}}}function $d(e){let t,n,l,o=e[2]+1+"",r,s,u,a,f,c,d,g,p;function m(y,C){return y[3]?Cd:Sd}let _=m(e),v=_(e),w=e[3]&&pi(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(),w&&w.c(),h(l,"class","bold svelte-1pk2e1k"),h(n,"class","source_tab svelte-1pk2e1k"),h(t,"class","source svelte-1pk2e1k")},m(y,C){O(y,t,C),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),w&&w.m(t,null),d=!0,g||(p=x(n,"click",e[4]),g=!0)},p(y,[C]){(!d||C&4)&&o!==(o=y[2]+1+"")&&J(r,o),(!d||C&1)&&J(u,y[0]),_!==(_=m(y))&&(v.d(1),v=_(y),v&&(v.c(),v.m(n,null))),y[3]?w?(w.p(y,C),C&8&&z(w,1)):(w=pi(y),w.c(),z(w,1),w.m(t,null)):w&&(_e(),L(w,1,1,()=>{w=null}),ve())},i(y){d||(Re(()=>{d&&(f||(f=ot(n,En,{},!0)),f.run(1))}),z(w),d=!0)},o(y){f||(f=ot(n,En,{},!1)),f.run(0),L(w),d=!1},d(y){y&&N(t),v.d(),y&&f&&f.end(),w&&w.d(),g=!1,p()}}}function Ad(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 Rd extends fe{constructor(t){super(),ce(this,t,Ad,$d,ue,{source:0,source_content:1,i:2})}}function mi(e,t,n){const l=e.slice();return l[4]=t[n],l[6]=n,l}function _i(e){let t,n,l,o;const r=[Dd,Fd,Ed,Md],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=ke()},m(a,f){s[t].m(a,f),O(a,l,f),o=!0},p(a,f){let c=t;t=u(a),t===c?s[t].p(a,f):(_e(),L(s[c],1,1,()=>{s[c]=null}),ve(),n=s[t],n?n.p(a,f):(n=s[t]=r[t](a),n.c()),z(n,1),n.m(l.parentNode,l))},i(a){o||(z(n),o=!0)},o(a){L(n),o=!1},d(a){s[t].d(a),a&&N(l)}}}function Md(e){let t,n,l,o=e[0].length+"",r,s,u,a,f,c,d,g;function p(w,y){return w[2]?Nd:Id}let m=p(e),_=m(e),v=e[2]&&vi(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=ke(),h(n,"class","bold"),h(t,"class","sources-header svelte-1r759df")},m(w,y){O(w,t,y),b(t,n),b(n,l),b(n,r),b(n,s),b(t,u),_.m(t,null),O(w,a,y),v&&v.m(w,y),O(w,f,y),c=!0,d||(g=x(t,"click",e[3]),d=!0)},p(w,y){(!c||y&1)&&o!==(o=w[0].length+"")&&J(r,o),m!==(m=p(w))&&(_.d(1),_=m(w),_&&(_.c(),_.m(t,null))),w[2]?v?(v.p(w,y),y&4&&z(v,1)):(v=vi(w),v.c(),z(v,1),v.m(f.parentNode,f)):v&&(_e(),L(v,1,1,()=>{v=null}),ve())},i(w){c||(z(v),c=!0)},o(w){L(v),c=!1},d(w){w&&N(t),_.d(),w&&N(a),v&&v.d(w),w&&N(f),d=!1,g()}}}function Ed(e){let t;return{c(){t=A("h5"),t.textContent="⚠️ No sources loaded",h(t,"class","bold")},m(n,l){O(n,t,l)},p:X,i:X,o:X,d(n){n&&N(t)}}}function Fd(e){let t;return{c(){t=A("h5"),t.textContent="📖 Loading...",h(t,"class","bold")},m(n,l){O(n,t,l)},p:X,i:X,o:X,d(n){n&&N(t)}}}function Dd(e){let t;return{c(){t=A("h5"),t.textContent="⚠️ No Retrieval Sources selected or received",h(t,"class","bold")},m(n,l){O(n,t,l)},p:X,i:X,o:X,d(n){n&&N(t)}}}function Id(e){let t;return{c(){t=A("span"),t.textContent="⌄"},m(n,l){O(n,t,l)},d(n){n&&N(t)}}}function Nd(e){let t;return{c(){t=A("span"),t.textContent="⌃"},m(n,l){O(n,t,l)},d(n){n&&N(t)}}}function vi(e){let t,n,l=e[0],o=[];for(let s=0;sL(o[s],1,1,()=>{o[s]=null});return{c(){for(let s=0;s{l=null}),ve())},i(o){n||(z(l),n=!0)},o(o){L(l),n=!1},d(o){o&&N(t),l&&l.d()}}}function Td(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 Od extends fe{constructor(t){super(),ce(this,t,Td,Pd,ue,{sources:0,source_content:1})}}function wi(e,t,n){const l=e.slice();return l[4]=t[n],l}function yi(e,t,n){const l=e.slice();return l[4]=t[n],l}function ki(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){O(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+"")&&J(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 Si(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)}),ve()}s?(n=At(s,u()),le(n.$$.fragment),z(n.$$.fragment,1),ee(n,t,l)):n=null}else s&&n.$set(c)},i(a){o||(n&&z(n.$$.fragment,a),o=!0)},o(a){n&&L(n.$$.fragment,a),o=!1},d(a){a&&N(t),n&&te(n)}}}function Ci(e){let t,n,l=e[0]==e[4].value&&Si(e);return{c(){l&&l.c(),t=ke()},m(o,r){l&&l.m(o,r),O(o,t,r),n=!0},p(o,r){o[0]==o[4].value?l?(l.p(o,r),r&3&&z(l,1)):(l=Si(o),l.c(),z(l,1),l.m(t.parentNode,t)):l&&(_e(),L(l,1,1,()=>{l=null}),ve())},i(o){n||(z(l),n=!0)},o(o){L(l),n=!1},d(o){l&&l.d(o),o&&N(t)}}}function zd(e){let t,n,l,o,r=e[1],s=[];for(let c=0;cL(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 Ld extends fe{constructor(t){super(),ce(this,t,Vd,zd,ue,{items:1,activeTabValue:0,tabProps:2})}}function $i(e){let t;return{c(){t=q("Press ENTER to autofill with the RAG answer.")},m(n,l){O(n,t,l)},d(n){n&&N(t)}}}function qd(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m=e[0].edited_answer===sl&&$i();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){O(_,t,v),b(t,n),Qe(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&&Qe(n,_[0].edited_answer),_[0].edited_answer===sl?m||(m=$i(),m.c(),m.m(s,null)):m&&(m.d(1),m=null)},i:X,o:X,d(_){_&&N(t),e[6](null),m&&m.d(),g=!1,he(p)}}}const sl="";function Hd(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))};ct(function(){o.focus()});function f(){l.edited_answer=this.value,n(0,l)}function c(d){tt[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 Gd extends fe{constructor(t){super(),ce(this,t,Hd,qd,ue,{message:0})}}function Ai(e,t,n){const l=e.slice();return l[19]=t[n],l[21]=n,l}function Ri(e){let t,n,l,o,r,s,u,a;return{c(){t=A("div"),n=A("h5"),n.textContent="Vote Feedback Instructions",l=P(),o=A("p"),o.innerHTML=`Ask a question to receive an answer from the chatbot. If the response is
- satisfactory, click on the 👍
- button. If the response is not satisfactory, click on the
- 👎 button.`,r=P(),s=A("button"),s.textContent="Download Data",h(n,"class","underline bold svelte-uhmrzm"),h(o,"class","svelte-uhmrzm"),h(s,"class","svelte-uhmrzm"),h(t,"class","instructions svelte-uhmrzm")},m(f,c){O(f,t,c),b(t,n),b(t,l),b(t,o),b(t,r),b(t,s),u||(a=x(s,"click",e[10]),u=!0)},p:X,d(f){f&&N(t),u=!1,a()}}}function Mi(e,t){let n,l,o,r,s,u,a,f,c,d=t[19].question+"",g,p,m,_,v,w,y,C,M,S,E,$,R,k,F,T;return M=new Ld({props:{items:t[8],tabProps:{message:t[19],feedback:t[0],index:t[21]}}}),E=new Od({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"),g=q(d),p=P(),m=A("div"),_=A("p"),_.textContent="ℹ️ Retrieval Sources",w=P(),y=A("div"),C=A("div"),le(M.$$.fragment),S=P(),le(E.$$.fragment),$=P(),h(o,"class","avatar"),h(a,"class","bold"),h(_,"class","bold"),h(m,"class","rag-sources svelte-uhmrzm"),h(u,"class","question svelte-uhmrzm"),h(C,"class","answer svelte-uhmrzm"),h(y,"class","answers svelte-uhmrzm"),h(s,"class","message-content svelte-uhmrzm"),h(l,"class","chat-message-center svelte-uhmrzm"),h(n,"class","chat-message svelte-uhmrzm"),this.first=n},m(I,V){O(I,n,V),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,w),b(s,y),b(y,C),ee(M,C,null),b(s,S),ee(E,s,null),b(n,$),k=!0,F||(T=[Vt(v=Ra.call(null,_,Ei(t[19]))),Vt(R=Bd.call(null,n,t[21]===t[5].length-1))],F=!0)},p(I,V){t=I,(!k||V&32)&&d!==(d=t[19].question+"")&&J(g,d),v&&Ve(v.update)&&V&32&&v.update.call(null,Ei(t[19]));const D={};V&33&&(D.tabProps={message:t[19],feedback:t[0],index:t[21]}),M.$set(D);const G={};V&32&&(G.sources=t[19].source),V&32&&(G.source_content=t[19].source_content),E.$set(G),R&&Ve(R.update)&&V&32&&R.update.call(null,t[21]===t[5].length-1)},i(I){k||(z(M.$$.fragment,I),z(E.$$.fragment,I),k=!0)},o(I){L(M.$$.fragment,I),L(E.$$.fragment,I),k=!1},d(I){I&&N(n),te(M),te(E),F=!1,he(T)}}}function jd(e){let t,n,l,o,r,s,u,a,f=[],c=new Map,d,g,p,m,_,v,w,y,C,M=(e[2]?e[4]:"Send")+"",S,E,$,R,k,F,T;function I(j){e[13](j)}let V={table:"rag_table"};e[3]!==void 0&&(V.showModal=e[3]),t=new Io({props:V}),tt.push(()=>An(t,"showModal",I));let D=e[0]&&Ri(e),G=e[5];const U=j=>j[21];for(let j=0;jn=!1)),t.$set(W),j[0]?D?D.p(j,K):(D=Ri(j),D.c(),D.m(o,r)):D&&(D.d(1),D=null),K&289&&(G=j[5],_e(),f=pt(f,K,U,1,j,G,c,a,Mo,Mi,null,Ai),ve());const Y={};K&64&&(Y.documents=j[6]),m.$set(Y),K&2&&w.value!==j[1]&&Qe(w,j[1]),(!k||K&20)&&M!==(M=(j[2]?j[4]:"Send")+"")&&J(S,M),(!k||K&2&&E!==(E="btnyousend "+(j[1]===""?"":"active")+" svelte-uhmrzm"))&&h(C,"class",E),K&1&&ye(s,"grid-column",j[0]?"span 1":"span 2")},i(j){if(!k){z(t.$$.fragment,j);for(let K=0;K{e.scrollIntoView({behavior:"smooth"})},0)}function Ei(e){return e.rag_sources.length===0?"No Sources":e.rag_sources.join(", ")}function xd(e,t,n){let l,o,r,s;ae(e,Ge,E=>n(5,o=E)),ae(e,It,E=>n(16,r=E));let{feedback:u=!1}=t,{is_retrieval:a=!1}=t;const f=Ie([]);ae(e,f,E=>n(6,s=E));let c="",d="",g=!1,p=!1,m=[{label:"Answer",value:1,component:$a},{label:"Modified Answer",value:2,component:Gd}];ct(()=>{v(),_()});async function _(){const $=await(await fetch("/retrieval/file/get")).json();console.log("data",$.files);const k=$.files.map((F,T)=>({id:String(T),name:F.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(F=>({id:F[0],question:F[1],answer:F[2],edited_answer:F[3],vote_status:F[4],rag_sources:F[5],source:F[6],source_content:F[7]}));De(Ge,o=[...k],o)}const w=async E=>{E.preventDefault(),c=d,n(1,d=""),n(2,g=!0);const $=[...r];let R={id:o.length+1,question:c,answer:"Loading...",rag_sources:$,vote_status:"na",source:["Loading..."],source_content:["Loading..."]};De(Ge,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:$})}):await fetch(`/chat/${c}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:c})});if(k.ok){const F=await k.json();console.log("response data",F),R.answer=F.answer,R.source=F.source,R.source_content=F.source_content,Ge.update(T=>(T[T.length-1]=R,T))}else{const F=await k.text();alert(F)}n(2,g=!1)};let y=0;setInterval(()=>{n(12,y=(y+1)%4)},200);function C(){n(3,p=!0)}function M(E){p=E,n(3,p)}function S(){d=this.value,n(1,d)}return e.$$set=E=>{"feedback"in E&&n(0,u=E.feedback),"is_retrieval"in E&&n(11,a=E.is_retrieval)},e.$$.update=()=>{e.$$.dirty&4096&&n(4,l=".".repeat(y).padEnd(3))},[u,d,g,p,l,o,s,f,m,w,C,a,y,M,S]}class Ud extends fe{constructor(t){super(),ce(this,t,xd,jd,ue,{feedback:0,is_retrieval:11})}}function Fi(e){let t,n;return t=new No({props:{is_retrieval:e[1]}}),{c(){le(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||(z(t.$$.fragment,l),n=!0)},o(l){L(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function Di(e){let t,n;return t=new No({props:{feedback:!0,is_retrieval:e[1]}}),{c(){le(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||(z(t.$$.fragment,l),n=!0)},o(l){L(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function Ii(e){let t,n;return t=new Ud({props:{feedback:!1,is_retrieval:e[1]}}),{c(){le(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||(z(t.$$.fragment,l),n=!0)},o(l){L(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function Ni(e){let t,n,l,o;const r=[Xd,Wd],s=[];function u(a,f){return a[1]?0:1}return t=u(e),n=s[t]=r[t](e),{c(){n.c(),l=ke()},m(a,f){s[t].m(a,f),O(a,l,f),o=!0},p(a,f){let c=t;t=u(a),t===c?s[t].p(a,f):(_e(),L(s[c],1,1,()=>{s[c]=null}),ve(),n=s[t],n?n.p(a,f):(n=s[t]=r[t](a),n.c()),z(n,1),n.m(l.parentNode,l))},i(a){o||(z(n),o=!0)},o(a){L(n),o=!1},d(a){s[t].d(a),a&&N(l)}}}function Wd(e){let t,n;return t=new pd({}),{c(){le(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},p:X,i(l){n||(z(t.$$.fragment,l),n=!0)},o(l){L(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function Xd(e){let t,n;return t=new No({props:{feedback:!0,is_retrieval:e[1]}}),{c(){le(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||(z(t.$$.fragment,l),n=!0)},o(l){L(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function Yd(e){let t,n,l,o,r,s=!e[0]&&Fi(e),u=e[0]==="vote"&&Di(e),a=e[0]==="rag"&&Ii(e),f=e[0]==="rank"&&Ni(e);return{c(){s&&s.c(),t=P(),u&&u.c(),n=P(),a&&a.c(),l=P(),f&&f.c(),o=ke()},m(c,d){s&&s.m(c,d),O(c,t,d),u&&u.m(c,d),O(c,n,d),a&&a.m(c,d),O(c,l,d),f&&f.m(c,d),O(c,o,d),r=!0},p(c,[d]){c[0]?s&&(_e(),L(s,1,1,()=>{s=null}),ve()):s?(s.p(c,d),d&1&&z(s,1)):(s=Fi(c),s.c(),z(s,1),s.m(t.parentNode,t)),c[0]==="vote"?u?(u.p(c,d),d&1&&z(u,1)):(u=Di(c),u.c(),z(u,1),u.m(n.parentNode,n)):u&&(_e(),L(u,1,1,()=>{u=null}),ve()),c[0]==="rag"?a?(a.p(c,d),d&1&&z(a,1)):(a=Ii(c),a.c(),z(a,1),a.m(l.parentNode,l)):a&&(_e(),L(a,1,1,()=>{a=null}),ve()),c[0]==="rank"?f?(f.p(c,d),d&1&&z(f,1)):(f=Ni(c),f.c(),z(f,1),f.m(o.parentNode,o)):f&&(_e(),L(f,1,1,()=>{f=null}),ve())},i(c){r||(z(s),z(u),z(a),z(f),r=!0)},o(c){L(s),L(u),L(a),L(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 Qd(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 Kd extends fe{constructor(t){super(),ce(this,t,Qd,Yd,ue,{feedback:0,is_retrieval:1})}}function Pi(e,t,n){const l=e.slice();return l[2]=t[n],l}function Ti(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){O(r,t,s),b(t,l)},p(r,s){s&1&&n!==(n=r[2]+"")&&J(l,n),s&1&&o!==(o=r[2])&&(t.__value=o,t.value=t.__value)},d(r){r&&N(t)}}}function Jd(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 eh extends fe{constructor(t){super(),ce(this,t,Zd,Jd,ue,{data_endpoint:1})}}function Qt(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function th(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=Qt,n=(u,a)=>Qt(e(u),a),l=(u,a)=>e(u)-a):(t=e===Qt||e===th?e:nh,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 nh(){return 0}function lh(e){return e===null?NaN:+e}function*oh(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 ih=Ma(Qt),rh=ih.right;Ma(lh).center;const Ea=rh;function sh(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 ah(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 uh(e,t){const n=ah(e,t);return n&&Math.sqrt(n)}function vn(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 ph=Array.prototype,mh=ph.slice;function Pl(e){return()=>e}const _h=Math.sqrt(50),vh=Math.sqrt(10),bh=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>=_h?10:r>=vh?5:r>=bh?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 kh(e){return Math.max(1,Math.ceil(Math.log(sh(e))/Math.LN2)+1)}function Ia(){var e=hh,t=vn,n=kh;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(C>=g&&t===vn){const S=tn(d,g,M);isFinite(S)&&(S>0?g=(Math.floor(g/S)+1)*S:S<0&&(g=(Math.ceil(g*-S)+1)/-S))}else p.pop()}for(var m=p.length,_=0,v=m;p[_]<=d;)++_;for(;p[v-1]>g;)--v;(_||v0?p[r-1]:d,y.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 ro(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:gh(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));Na(e,t,p,m,o)}const r=e[t];let s=n,u=l;for(fn(e,n,t),o(e[l],r)>0&&fn(e,n,l);s0;)--u}o(e[n],r)===0?fn(e,n,u):(++u,fn(e,u,l)),u<=t&&(n=u+1),t<=u&&(l=u-1)}return e}function fn(e,t,n){const l=e[t];e[t]=e[n],e[n]=l}function Sh(e,t,n){if(e=Float64Array.from(oh(e,n)),!(!(l=e.length)||isNaN(t=+t))){if(t<=0||l<2)return ro(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=ro(e.subarray(r+1));return s+(u-s)*(o-r)}}function Ch(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 $h(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 nn(e){return e=ul(Math.abs(e)),e?e[1]:NaN}function Rh(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 Mh(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var Eh=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function fl(e){if(!(t=Eh.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 Fh(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 Dh(e,t){var n=ul(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")+ul(e,Math.max(0,t+r-1))[0]}function Vi(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 Li={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Ah,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:Dh,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function qi(e){return e}var Hi=Array.prototype.map,Gi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ih(e){var t=e.grouping===void 0||e.thousands===void 0?qi:Rh(Hi.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?qi:Mh(Hi.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,w=d.width,y=d.comma,C=d.precision,M=d.trim,S=d.type;S==="n"?(y=!0,S="g"):Li[S]||(C===void 0&&(C=12),M=!0,S="g"),(v||g==="0"&&p==="=")&&(v=!0,g="0",p="=");var E=_==="$"?n:_==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",$=_==="$"?l:/[%p]/.test(S)?s:"",R=Li[S],k=/[defgprs%]/.test(S);C=C===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function F(T){var I=E,V=$,D,G,U;if(S==="c")V=R(T)+V,T="";else{T=+T;var j=T<0||1/T<0;if(T=isNaN(T)?a:R(Math.abs(T),C),M&&(T=Fh(T)),j&&+T==0&&m!=="+"&&(j=!1),I=(j?m==="("?m:u:m==="-"||m==="("?"":m)+I,V=(S==="s"?Gi[8+Pa/3]:"")+V+(j&&m==="("?")":""),k){for(D=-1,G=T.length;++DU||U>57){V=(U===46?o+T.slice(D+1):T.slice(D))+V,T=T.slice(0,D);break}}}y&&!v&&(T=t(T,1/0));var K=I.length+T.length+V.length,W=K>1)+I+T+V+W.slice(K);break;default:T=W+I+T+V;break}return r(T)}return F.toString=function(){return d+""},F}function c(d,g){var p=f((d=fl(d),d.type="f",d)),m=Math.max(-8,Math.min(8,Math.floor(nn(g)/3)))*3,_=Math.pow(10,-m),v=Gi[8+m/3];return function(w){return p(_*w)+v}}return{format:f,formatPrefix:c}}var qn,vt,Ta;Nh({thousands:",",grouping:[3],currency:["$",""]});function Nh(e){return qn=Ih(e),vt=qn.format,Ta=qn.formatPrefix,qn}function Ph(e){return Math.max(0,-nn(Math.abs(e)))}function Th(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(nn(t)/3)))*3-nn(Math.abs(e)))}function Oh(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,nn(t)-nn(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 ji=Symbol("implicit");function Mt(){var e=new Oi,t=[],n=[],l=ji;function o(r){let s=e.get(r);if(s===void 0){if(l!==ji)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 Oi;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=Lh.exec(e))?new je(t[1],t[2],t[3],1):(t=qh.exec(e))?new je(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Hh.exec(e))?Hn(t[1],t[2],t[3],t[4]):(t=Gh.exec(e))?Hn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=jh.exec(e))?Ki(t[1],t[2]/100,t[3]/100,1):(t=Bh.exec(e))?Ki(t[1],t[2]/100,t[3]/100,t[4]):xi.hasOwnProperty(e)?Xi(xi[e]):e==="transparent"?new je(NaN,NaN,NaN,0):null}function Xi(e){return new je(e>>16&255,e>>8&255,e&255,1)}function Hn(e,t,n,l){return l<=0&&(e=t=n=NaN),new je(e,t,n,l)}function Wh(e){return e instanceof Pn||(e=In(e)),e?(e=e.rgb(),new je(e.r,e.g,e.b,e.opacity)):new je}function so(e,t,n,l){return arguments.length===1?Wh(e):new je(e,t,n,l??1)}function je(e,t,n,l){this.r=+e,this.g=+t,this.b=+n,this.opacity=+l}Oo(je,so,za(Pn,{brighter(e){return e=e==null?cl:Math.pow(cl,e),new je(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Fn:Math.pow(Fn,e),new je(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new je(zt(this.r),zt(this.g),zt(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:Yi,formatHex:Yi,formatHex8:Xh,formatRgb:Qi,toString:Qi}));function Yi(){return`#${Tt(this.r)}${Tt(this.g)}${Tt(this.b)}`}function Xh(){return`#${Tt(this.r)}${Tt(this.g)}${Tt(this.b)}${Tt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Qi(){const e=dl(this.opacity);return`${e===1?"rgb(":"rgba("}${zt(this.r)}, ${zt(this.g)}, ${zt(this.b)}${e===1?")":`, ${e})`}`}function dl(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 Tt(e){return e=zt(e),(e<16?"0":"")+e.toString(16)}function Ki(e,t,n,l){return l<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ze(e,t,n,l)}function Va(e){if(e instanceof Ze)return new Ze(e.h,e.s,e.l,e.opacity);if(e instanceof Pn||(e=In(e)),!e)return new Ze;if(e instanceof Ze)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 Ze(s,u,a,e.opacity)}function Yh(e,t,n,l){return arguments.length===1?Va(e):new Ze(e,t,n,l??1)}function Ze(e,t,n,l){this.h=+e,this.s=+t,this.l=+n,this.opacity=+l}Oo(Ze,Yh,za(Pn,{brighter(e){return e=e==null?cl:Math.pow(cl,e),new Ze(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Fn:Math.pow(Fn,e),new Ze(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 je(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 Ze(Ji(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("}${Ji(this.h)}, ${Gn(this.s)*100}%, ${Gn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ji(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 zo=e=>()=>e;function Qh(e,t){return function(n){return e+n*t}}function Kh(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 Jh(e){return(e=+e)==1?La:function(t,n){return n-t?Kh(t,n,e):zo(isNaN(t)?n:t)}}function La(e,t){var n=t-e;return n?Qh(e,n):zo(isNaN(e)?t:e)}const ao=function e(t){var n=Jh(t);function l(o,r){var s=n((o=so(o)).r,(r=so(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 Zh(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 fg(e,t,n){var l=e[0],o=e[1],r=t[0],s=t[1];return o2?cg:fg,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,ag),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=qa,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 gg(){return hg()(kt,kt)}function pg(e,t,n,l){var o=wh(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=Th(o,s))&&(l.precision=r),Ta(l,s)}case"":case"e":case"g":case"p":case"r":{l.precision==null&&!isNaN(r=Oh(o,Math.max(Math.abs(e),Math.abs(t))))&&(l.precision=r-(l.type==="e"));break}case"f":case"%":{l.precision==null&&!isNaN(r=Ph(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 pg(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=tn(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 Xe(){var e=gg();return e.copy=function(){return dg(e,Xe())},To.apply(e,arguments),Ha(e)}function mg(){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(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 _g(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Ga(){var e=Ha(mg()(kt));return e.copy=function(){return _g(e,Ga())},zh.apply(e,arguments)}function lt(e){return function(){return e}}const co=Math.PI,ho=2*co,Nt=1e-6,vg=ho-Nt;function ja(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return ja;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 p=l-s,m=o-u,_=a*a+f*f,v=p*p+m*m,w=Math.sqrt(_),y=Math.sqrt(g),C=r*Math.tan((co-Math.acos((_+g-v)/(2*w*y)))/2),M=C/y,S=C/w;Math.abs(M-1)>Nt&&this._append`L${t+M*c},${n+M*d}`,this._append`A${r},${r},0,0,${+(d*p>c*m)},${this._x1=t+S*a},${this._y1=n+S*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)>Nt||Math.abs(this._y1-c)>Nt)&&this._append`L${f},${c}`,l&&(g<0&&(g=g%ho+ho),g>vg?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>Nt&&this._append`A${l},${l},0,${+(g>=co)},${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 yg(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 wg(t)}function Ba(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 kg(e){return new xa(e)}function Sg(e){return e[0]}function Cg(e){return e[1]}function $g(e,t){var n=lt(!0),l=null,o=kg,r=null,s=yg(u);e=typeof e=="function"?e:e===void 0?Sg:lt(e),t=typeof t=="function"?t:t===void 0?Cg:lt(t);function u(a){var f,c=(a=Ba(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 Ag(e,t){return e[t]}function Rg(e){const t=[];return t.key=e,t}function Mg(){var e=lt([]),t=po,n=go,l=Ag;function o(r){var s=Array.from(e.apply(this,arguments),Rg),u,a=s.length,f=-1,c;for(const d of r)for(u=0,++f;uFeedback Distribution
",n=P(),l=A("div"),o=B("svg");for(let a=0;ae[19].call(l))},m(a,f){O(a,t,f),O(a,n,f),O(a,l,f),b(l,o);for(let c=0;cn(15,d=R)),ae(e,Zo,R=>n(4,g=R)),ae(e,Ge,R=>n(16,p=R));let m=300,_=300;const v={up:2,down:1,"n/a":0,all:"all"},w={top:10,bottom:10,left:25,right:5},y=Mt().range(["var(--yellow)","var(--red)","var(--green)"]),C=vt(".0%");function M(R,k){l===R?n(5,l="all"):n(5,l=R),De(at,d=l==="all"?"all":k,d)}const S=(R,k)=>M(R,k.key),E=(R,k)=>M(R,k.key);function $(){_=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=_-w.left-w.right),e.$$.dirty&1&&n(14,r=m-w.top-w.bottom),e.$$.dirty&65552&&p.forEach(R=>{De(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([w.top,r-w.bottom]).padding(0).domain(["a"])),e.$$.dirty&12&&n(7,a=Xe().rangeRound([w.left,o-w.right]).domain([0,s])),e.$$.dirty&8208&&n(6,c=f([g]))},n(13,f=Mg().keys(["n/a","down","up"]).order(po).offset(go)),[m,_,s,o,g,l,c,a,u,w,y,C,M,f,r,d,p,S,E,$]}class Ua extends fe{constructor(t){super(),ce(this,t,Fg,Eg,ue,{})}}function Dg(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=P(),s=A("div"),u=q("A: "),a=q(e[1]),f=P(),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){O(_,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&&J(o,_[0]),v&2&&J(a,_[1]),v&4&&g!==(g=_[3][_[2]]+"")&&J(p,g),v&4&&m!==(m="feedback "+_[2]+" svelte-szi0e")&&h(c,"class",m)},i:X,o:X,d(_){_&&N(t)}}}function Ig(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 Ng extends fe{constructor(t){super(),ce(this,t,Ig,Dg,ue,{question:0,answer:1,feedback:2})}}function or(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 ir(e){let t,n,l,o,r;return n=new Ng({props:{question:e[5],answer:e[6],feedback:e[7]}}),{c(){t=A("div"),le(n.$$.fragment),l=P()},m(s,u){O(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||(z(n.$$.fragment,s),s&&Re(()=>{r&&(o||(o=ot(t,e[1],{duration:300},!0)),o.run(1))}),r=!0)},o(s){L(n.$$.fragment,s),s&&(o||(o=ot(t,e[1],{duration:300},!1)),o.run(0)),r=!1},d(s){s&&N(t),te(n),s&&o&&o.end()}}}function Pg(e){let t,n,l=e[0],o=[];for(let s=0;sL(o[s],1,1,()=>{o[s]=null});return{c(){t=A("div");for(let s=0;sn(4,o=a)),ae(e,at,a=>n(2,r=a)),ae(e,Rn,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(lo,o=md(l),o)},[l,u,r,s]}class Wa extends fe{constructor(t){super(),ce(this,t,Tg,Pg,ue,{})}}function rr(e,t,n){const l=e.slice();return l[13]=t[n],l}function sr(e,t,n){const l=e.slice();return l[16]=t[n],l}function ar(e,t,n){const l=e.slice();return l[16]=t[n],l}function ur(e){let t,n,l,o,r=e[16]+"",s,u;return{c(){t=B("g"),n=B("line"),o=B("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){O(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]+"")&&J(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 fr(e){let t,n,l,o;return{c(){t=B("g"),n=B("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){O(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 cr(e){let t,n,l,o,r,s,u,a,f=Math.round(e[11](e[13].count))+"",c,d,g;return{c(){t=B("g"),n=B("rect"),a=B("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){O(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))+"")&&J(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&&N(t)}}}function Og(e){let t,n,l,o,r,s,u=e[8][e[7]]+"",a,f,c,d,g,p,m,_,v,w=e[4].map(dr),y=[];for(let $=0;$e[12].call(t))},m($,R){O($,t,R),b(t,n);for(let k=0;ke.question;function zg(e,t,n){let l,o,r,s,u,a;ae(e,lo,v=>n(4,u=v)),ae(e,at,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=Xe().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 Xa extends fe{constructor(t){super(),ce(this,t,zg,Og,ue,{})}}function hr(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 gr(e,t,n){const l=e.slice();return l[23]=t[n],l}function pr(e){let t,n,l,o,r=e[23]+"",s,u;return{c(){t=B("g"),n=B("line"),o=B("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){O(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]+"")&&J(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 mr(e){let t,n,l,o,r,s,u;return{c(){t=B("g"),n=B("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){O(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 Vg(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,w){O(v,t,w),b(t,n);for(let y=0;yn(5,d=C)),ae(e,Ge,C=>n(13,g=C));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 w=Array.from({length:_r},(C,M)=>M);function y(){_=this.offsetWidth,m=this.offsetHeight,n(1,_),n(0,m)}return e.$$.update=()=>{e.$$.dirty&8224&&n(12,l=d==="all"?g:g.filter(C=>C.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(w).value(C=>C.answer)(o)),e.$$.dirty&16&&n(7,a=Xe().domain([3,_r]).range([v.left,r-v.right])),e.$$.dirty&12&&n(6,f=Xe().domain([0,mt(u,C=>C.length)]).range([s-v.bottom,v.top])),e.$$.dirty&2048&&n(10,c=mt(o,C=>C.length)),e.$$.dirty&1056&&Xe().domain([0,c]).range(["white",p[d]]).interpolate(Tn)},[m,_,s,u,r,d,f,a,p,v,c,o,l,g,y]}class Ya extends fe{constructor(t){super(),ce(this,t,Lg,Vg,ue,{})}}function vr(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 br(e,t,n){const l=e.slice();return l[22]=t[n],l}function wr(e){let t,n,l,o,r=e[22]+"",s,u;return{c(){t=B("g"),n=B("line"),o=B("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){O(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]+"")&&J(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 yr(e){let t,n,l,o,r,s,u;return{c(){t=B("g"),n=B("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){O(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 qg(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,w){O(v,t,w),b(t,n);for(let y=0;yn(5,c=y)),ae(e,Ge,y=>n(12,d=y));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:kr},(y,C)=>C);Mt().range(["var(--yellow)","var(--red)","var(--green)"]);function w(){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(y=>y.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=p-_.top-_.bottom),e.$$.dirty&1024&&n(3,u=Ia().thresholds(v).value(y=>y.question)(o)),e.$$.dirty&16&&n(7,a=Xe().domain([3,kr]).range([_.left,r-_.right])),e.$$.dirty&12&&n(6,f=Xe().domain([0,mt(u,y=>y.length)]).range([s-_.bottom,_.top])),e.$$.dirty&1024&&mt(o,y=>y.length)},[p,m,s,u,r,c,f,a,g,_,o,l,d,w]}class Qa extends fe{constructor(t){super(),ce(this,t,Hg,qg,ue,{})}}function Gg(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m=Math.round(e[5](e[3]))+"",_,v,w,y,C,M,S,E;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"),g=B("svg"),p=B("text"),_=q(m),C=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"),ye(r,"background",e[6][e[0]]),h(r,"class","svelte-1pknxov"),e[0]===void 0&&Re(()=>e[9].call(r)),h(n,"class","svelte-1pknxov"),h(p,"dominant-baseline","middle"),h(p,"x",v=e[2]/2),h(p,"y",w=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"),Re(()=>e[10].call(d)),h(M,"class","small svelte-1pknxov"),h(t,"class","card-container svelte-1pknxov"),ye(t,"background",e[6][e[0]])},m($,R){O($,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,_),y=ft(d,e[10].bind(d)),b(t,C),b(t,M),S||(E=x(r,"change",e[9]),S=!0)},p($,[R]){R&1&&ye(r,"background",$[6][$[0]]),R&1&&ll(r,$[0]),R&8&&m!==(m=Math.round($[5]($[3]))+"")&&J(_,m),R&4&&v!==(v=$[2]/2)&&h(p,"x",v),R&2&&w!==(w=$[1]/2)&&h(p,"y",w),R&4&&h(g,"width",$[2]),R&2&&h(g,"height",$[1]),R&1&&ye(t,"background",$[6][$[0]])},i:X,o:X,d($){$&&N(t),y(),S=!1,E()}}}function jg(e,t){return t==="all"?e.length:e.filter(l=>l.vote_status===t).length}function Bg(e,t,n){let l,o,r,s;ae(e,at,m=>n(0,o=m)),ae(e,Ge,m=>n(8,r=m));let u,a,f=Fo(0);ae(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=sa(this),at.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&&console.log("fbc",l),e.$$.dirty&128&&f.set(l)},[o,u,a,s,f,c,d,l,r,g,p]}class Ka extends fe{constructor(t){super(),ce(this,t,Bg,Gg,ue,{})}}function xg(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m=e[5](e[3])+"",_,v,w,y,C,M,S,E;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"),g=B("svg"),p=B("text"),_=q(m),C=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"),ye(r,"background",e[6][e[0]]),h(r,"class","svelte-mchgj2"),e[0]===void 0&&Re(()=>e[9].call(r)),h(p,"dominant-baseline","middle"),h(p,"x",v=e[2]/2),h(p,"y",w=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"),Re(()=>e[10].call(d)),h(M,"class","small svelte-mchgj2"),h(t,"class","card-container svelte-mchgj2"),ye(t,"background",e[6][e[0]])},m($,R){O($,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,_),y=ft(d,e[10].bind(d)),b(t,C),b(t,M),S||(E=x(r,"change",e[9]),S=!0)},p($,[R]){R&1&&ye(r,"background",$[6][$[0]]),R&1&&ll(r,$[0]),R&8&&m!==(m=$[5]($[3])+"")&&J(_,m),R&4&&v!==(v=$[2]/2)&&h(p,"x",v),R&2&&w!==(w=$[1]/2)&&h(p,"y",w),R&4&&h(g,"width",$[2]),R&2&&h(g,"height",$[1]),R&1&&ye(t,"background",$[6][$[0]])},i:X,o:X,d($){$&&N(t),y(),S=!1,E()}}}function Ug(e,t){const n=e.length;return t==="all"?1:e.filter(o=>o.vote_status===t).length/n}function Wg(e,t,n){let l,o,r,s;ae(e,at,m=>n(0,o=m)),ae(e,Ge,m=>n(8,r=m));let u,a,f=Fo(0);ae(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=sa(this),at.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=Ug(r,o)),e.$$.dirty&128&&f.set(l)},[o,u,a,s,f,c,d,l,r,g,p]}class Ja extends fe{constructor(t){super(),ce(this,t,Wg,xg,ue,{})}}function Xg(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m,_,v,w,y,C,M,S,E,$,R,k,F,T;return r=new Ka({}),a=new Ja({}),d=new Ua({}),m=new Xa({props:{feedback:"Bad"}}),w=new Qa({}),M=new Ya({}),F=new Wa({}),{c(){t=A("div"),n=A("div"),l=A("div"),o=A("div"),le(r.$$.fragment),s=P(),u=A("div"),le(a.$$.fragment),f=P(),c=A("div"),le(d.$$.fragment),g=P(),p=A("div"),le(m.$$.fragment),_=P(),v=A("div"),le(w.$$.fragment),y=P(),C=A("div"),le(M.$$.fragment),S=P(),E=A("div"),$=A("div"),$.innerHTML=`
-
`,R=P(),k=A("div"),le(F.$$.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(C,"class","left-filter2"),h(n,"class","feedback-left svelte-14znspc"),h($,"class","right-chart svelte-14znspc"),h(k,"class","right-table svelte-14znspc"),h(E,"class","feedback-right svelte-14znspc"),h(t,"class","feedback-container svelte-14znspc")},m(I,V){O(I,t,V),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(w,v,null),b(n,y),b(n,C),ee(M,C,null),b(t,S),b(t,E),b(E,$),b(E,R),b(E,k),ee(F,k,null),T=!0},p:X,i(I){T||(z(r.$$.fragment,I),z(a.$$.fragment,I),z(d.$$.fragment,I),z(m.$$.fragment,I),z(w.$$.fragment,I),z(M.$$.fragment,I),z(F.$$.fragment,I),T=!0)},o(I){L(r.$$.fragment,I),L(a.$$.fragment,I),L(d.$$.fragment,I),L(m.$$.fragment,I),L(w.$$.fragment,I),L(M.$$.fragment,I),L(F.$$.fragment,I),T=!1},d(I){I&&N(t),te(r),te(a),te(d),te(m),te(w),te(M),te(F)}}}function Yg(e,t,n){let l;ae(e,Rn,r=>n(0,l=r)),ct(()=>{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(Rn,l=[...a],l)}return[]}class Za extends fe{constructor(t){super(),ce(this,t,Yg,Xg,ue,{})}}/**!
- * Sortable 1.15.0
- * @author RubaXa
- * @author owenm
- * @license MIT
- */function Sr(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 ut(e){for(var t=1;t=0)&&(n[o]=e[o]);return n}function Jg(e,t){if(e==null)return{};var n=Kg(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 Zg="1.15.0";function gt(e){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(e)}var bt=gt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),On=gt(/Edge/i),Cr=gt(/firefox/i),bn=gt(/safari/i)&&!gt(/chrome/i)&&!gt(/android/i),eu=gt(/iP(ad|od|hone)/i),tu=gt(/chrome/i)&>(/android/i),nu={capture:!1,passive:!1};function ge(e,t,n){e.addEventListener(t,n,!bt&&nu)}function de(e,t,n){e.removeEventListener(t,n,!bt&&nu)}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 ep(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function nt(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=ep(e))}return null}var $r=/\s+/g;function xe(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var l=(" "+e.className+" ").replace($r," ").replace(" "+t+" "," ");e.className=(l+(n?" "+t:"")).replace($r," ")}}function ne(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=ne(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===st())break;l=Ct(l,!1)}return!1}function ln(e,t,n,l){for(var o=0,r=0,s=e.children;r2&&arguments[2]!==void 0?arguments[2]:{},o=l.evt,r=Jg(l,ap);zn.pluginEvent.bind(Z)(t,n,ut({dragEl:H,parentEl:Ae,ghostEl:re,rootEl:be,nextEl:Pt,lastDownEl:Jn,cloneEl:we,cloneHidden:yt,dragStarted:hn,putSortable:Ne,activeSortable:Z.active,originalEvent:o,oldIndex:Wt,oldDraggableIndex:yn,newIndex:Ue,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){sp(ut({putSortable:Ne,cloneEl:we,targetEl:H,rootEl:be,oldIndex:Wt,oldDraggableIndex:yn,newIndex:Ue,newDraggableIndex:wt},e))}var H,Ae,re,be,Pt,Jn,we,yt,Wt,Ue,yn,wt,jn,Ne,Ut=!1,pl=!1,ml=[],Ft,Je,Ll,ql,Mr,Er,hn,Bt,kn,Sn=!1,Bn=!1,Zn,Pe,Hl=[],mo=!1,_l=[],Rl=typeof document<"u",xn=eu,Fr=On||bt?"cssFloat":"float",up=Rl&&!tu&&!eu&&"draggable"in document.createElement("div"),su=function(){if(Rl){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=ne(t),o=parseInt(l.width)-parseInt(l.paddingLeft)-parseInt(l.paddingRight)-parseInt(l.borderLeftWidth)-parseInt(l.borderRightWidth),r=ln(t,0,n),s=ln(t,1,n),u=r&&ne(r),a=s&&ne(s),f=u&&parseInt(u.marginLeft)+parseInt(u.marginRight)+Ee(r).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Ee(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[Fr]==="none"||s&&l[Fr]==="none"&&f+c>o)?"vertical":"horizontal"},fp=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},cp=function(t,n){var l;return ml.some(function(o){var r=o[We].options.emptyInsertThreshold;if(!(!r||Vo(o))){var s=Ee(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 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},fu=function(){!su&&re&&ne(re,"display","none")},cu=function(){!su&&re&&ne(re,"display","")};Rl&&!tu&&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=cp(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[We]._onDragOver(l)}}},dp=function(t){H&&H.parentNode[We]._isOutsideThisEl(t.target)};function Z(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[We]=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:Z.supportPointer!==!1&&"PointerEvent"in window&&!bn,emptyInsertThreshold:5};zn.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:up,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?ge(e,"pointerdown",this._onTapStart):(ge(e,"mousedown",this._onTapStart),ge(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(ge(e,"dragover",this),ge(e,"dragenter",this)),ml.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),_t(this,op())}Z.prototype={constructor:Z,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(Bt=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(wp(l),!H&&!(/mousedown|pointerdown/.test(s)&&t.button!==0||o.disabled)&&!f.isContentEditable&&!(!this.nativeDraggable&&bn&&a&&a.tagName.toUpperCase()==="SELECT")&&(a=nt(a,o.draggable,l,!1),!(a&&a.animated)&&Jn!==a)){if(Wt=Ye(a),yn=Ye(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}),qe("filter",n,{evt:t}),r&&t.cancelable&&t.preventDefault();return}}else if(c&&(c=c.split(",").some(function(d){if(d=nt(f,d.trim(),l,!1),d)return Te({sortable:n,rootEl:d,name:"filter",targetEl:a,fromEl:l,toEl:l}),qe("filter",n,{evt:t}),!0}),c)){r&&t.cancelable&&t.preventDefault();return}o.handle&&!nt(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=Ee(l);if(be=r,H=l,Ae=H.parentNode,Pt=H.nextSibling,Jn=l,jn=s.group,Z.dragged=H,Ft={target:H,clientX:(n||t).clientX,clientY:(n||t).clientY},Mr=Ft.clientX-f.left,Er=Ft.clientY-f.top,this._lastX=(n||t).clientX,this._lastY=(n||t).clientY,H.style["will-change"]="all",a=function(){if(qe("delayEnded",o,{evt:t}),Z.eventCanceled){o._onDrop();return}o._disableDelayedDragEvents(),!Cr&&o.nativeDraggable&&(H.draggable=!0),o._triggerDragStart(t,n),Te({sortable:o,name:"choose",originalEvent:t}),xe(H,s.chosenClass,!0)},s.ignore.split(",").forEach(function(c){lu(H,c.trim(),Gl)}),ge(u,"dragover",Dt),ge(u,"mousemove",Dt),ge(u,"touchmove",Dt),ge(u,"mouseup",o._onDrop),ge(u,"touchend",o._onDrop),ge(u,"touchcancel",o._onDrop),Cr&&this.nativeDraggable&&(this.options.touchStartThreshold=4,H.draggable=!0),qe("delayStart",this,{evt:t}),s.delay&&(!s.delayOnTouchOnly||n)&&(!this.nativeDraggable||!(On||bt))){if(Z.eventCanceled){this._onDrop();return}ge(u,"mouseup",o._disableDelayedDrag),ge(u,"touchend",o._disableDelayedDrag),ge(u,"touchcancel",o._disableDelayedDrag),ge(u,"mousemove",o._delayedDragTouchMoveHandler),ge(u,"touchmove",o._delayedDragTouchMoveHandler),s.supportPointer&&ge(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;de(t,"mouseup",this._disableDelayedDrag),de(t,"touchend",this._disableDelayedDrag),de(t,"touchcancel",this._disableDelayedDrag),de(t,"mousemove",this._delayedDragTouchMoveHandler),de(t,"touchmove",this._delayedDragTouchMoveHandler),de(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,n){n=n||t.pointerType=="touch"&&t,!this.nativeDraggable||n?this.options.supportPointer?ge(document,"pointermove",this._onTouchMove):n?ge(document,"touchmove",this._onTouchMove):ge(document,"mousemove",this._onTouchMove):(ge(H,"dragend",this),ge(be,"dragstart",this._onDragStart));try{document.selection?el(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,n){if(Ut=!1,be&&H){qe("dragStarted",this,{evt:n}),this.nativeDraggable&&ge(document,"dragover",dp);var l=this.options;!t&&xe(H,l.dragClass,!1),xe(H,l.ghostClass,!0),Z.active=this,t&&this._appendGhost(),Te({sortable:this,name:"start",originalEvent:n})}else this._nulling()},_emulateDragOver:function(){if(Je){this._lastX=Je.clientX,this._lastY=Je.clientY,fu();for(var t=document.elementFromPoint(Je.clientX,Je.clientY),n=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Je.clientX,Je.clientY),t!==n);)n=t;if(H.parentNode[We]._isOutsideThisEl(t),n)do{if(n[We]){var l=void 0;if(l=n[We]._onDragOver({clientX:Je.clientX,clientY:Je.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&&Jt(re,!0),u=re&&s&&s.a,a=re&&s&&s.d,f=xn&&Pe&&Rr(Pe),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(!Z.active&&!Ut){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:be,originalEvent:t}),Te({sortable:this,name:"remove",toEl:Ae,originalEvent:t}),Te({rootEl:Ae,name:"sort",toEl:Ae,fromEl:be,originalEvent:t}),Te({sortable:this,name:"sort",toEl:Ae,originalEvent:t})),Ne&&Ne.save()):Ue!==Wt&&Ue>=0&&(Te({sortable:this,name:"update",toEl:Ae,originalEvent:t}),Te({sortable:this,name:"sort",toEl:Ae,originalEvent:t})),Z.active&&((Ue==null||Ue===-1)&&(Ue=Wt,wt=yn),Te({sortable:this,name:"end",toEl:Ae,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){qe("nulling",this),be=H=Ae=re=Pt=we=Jn=yt=Ft=Je=hn=Ue=wt=Wt=yn=Bt=kn=Ne=jn=Z.dragged=Z.ghost=Z.clone=Z.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),hp(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 _p(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-kn}else if(a>c+f*(1-o)/2&&ad-f*r/2)?a>c+f/2?1:-1:0}function vp(e){return Ye(H)R[28];for(let R=0;RAn(t,"showModal",j));let W=e[8];const Y=Q=>Q[25];for(let Q=0;Qn=!1)),t.$set(Fe),Se&3463&&(W=Q[8],C=pt(C,Se,Y,1,Q,W,M,y,en,zr,null,Ir)),Se&8&&R.value!==Q[3]&&Qe(R,Q[3]),(!D||Se&80)&&T!==(T=(Q[4]?Q[6]:"Send")+"")&&J(I,T),(!D||Se&8&&V!==(V="btnyousend "+(Q[3]===""?"":"active")+" svelte-1nj8mt0"))&&h(F,"class",V)},i(Q){D||(z(t.$$.fragment,Q),D=!0)},o(Q){L(t.$$.fragment,Q),D=!1},d(Q){te(t,Q),Q&&N(l),Q&&N(o);for(let Se=0;Se{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 Cp(e,t,n){let l,o,r;ae(e,un,k=>n(8,r=k));let{numModels:s=1}=t,{models:u=[0]}=t,a="",f="",c=!1,d=!1;ct(async()=>{if(await new Promise(k=>setTimeout(k,200)),_){const k=new Z(_,{animation:150,onUpdate(F){k.toArray()}});k.toArray()}g()});async function g(){const F=await(await fetch("/chat/comparator/db/retrieve")).json();console.log(F);const T=F.data;let I={},V=new Set;for(const D of T)V.add(D.model),I[D.qid]||(I[D.qid]={},I[D.qid].qid=D.qid,I[D.qid].question=D.question),I[D.qid][D.model]=D.answer,console.log(I);n(1,u=Array.from(V)),n(0,s=u.length),console.log(Object.values(I)),De(un,r=[...Object.values(I)],r)}const p=async k=>{k.preventDefault(),a=f,n(3,f=""),n(4,c=!0);let F={question:a};for(let I of u)F[I]="Loading...";De(un,r=[...r,F],r),console.log("compare chat log",un);const T=await fetch(`/chat/comparator/${a}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:a})});if(T.ok){const I=await T.json();n(1,u=Object.keys(I.answer)),n(0,s=u.length);for(let V of u)F[V]=I.answer[V];F.qid=I.qid,un.update(V=>(V[V.length-1]=F,V))}else{const I=await T.text();alert(I)}n(4,c=!1)};let m=0;setInterval(()=>{n(13,m=(m+1)%4)},200);let _,v;function w(k,F){const T=F,V=Mn(k.currentTarget.parentNode).selectAll("div.answer").nodes().map(j=>j.id);V.forEach((j,K)=>{Mn(`#${j}`).select(".answer-rank").property("value",K+1)});let D=[];for(let[j,K]of V.entries()){const W=parseInt(K.split("-")[1]),Y=u[W],Q={rank:j,model:Y};D.push(Q)}let G=r.filter(j=>j.qid===T),U=[];for(let j of D){const K={model:j.model,qid:parseInt(T),rank:parseInt(j.rank)+1,answer:G[0][j.model]};U.push(K)}Vr(U)}function y(k,F,T){const I=F,V=parseInt(k.target.value),D=u[T],G={qid:I,rank:parseInt(V),model:D};let U=[],K=r.filter(Y=>Y.qid===G.qid)[0][G.model];const W={model:G.model,qid:parseInt(G.qid),rank:parseInt(G.rank),answer:K};U.push(W),Vr(U)}function C(){n(5,d=!0)}function M(k){d=k,n(5,d)}const S=(k,F,T)=>y(T,k.qid,F),E=(k,F)=>w(F,k.qid);function $(k){tt[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 Z(_,{animation:150,dataIdAttr:"id",onUpdate(k){v.toArray()}})),v.toArray())},[s,u,_,f,c,d,o,l,r,p,w,y,C,m,v,M,S,E,$,R]}class $p extends fe{constructor(t){super(),ce(this,t,Cp,kp,ue,{numModels:0,models:1})}}const on=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 Lr(e,t,n){const l=e.slice();return l[20]=t[n],l}function qr(e,t,n){const l=e.slice();return l[20]=t[n],l[24]=n,l}function Hr(e,t,n){const l=e.slice();return l[25]=t[n],l}function Gr(e){let t,n,l,o,r=`Q.${e[25]}`,s,u;return{c(){t=B("g"),n=B("line"),o=B("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){O(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]}`)&&J(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 jr(e){let t=Number.isInteger(e[25]),n,l=t&&Gr(e);return{c(){l&&l.c(),n=ke()},m(o,r){l&&l.m(o,r),O(o,n,r)},p(o,r){r&256&&(t=Number.isInteger(o[25])),t?l?l.p(o,r):(l=Gr(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 g(){return t[16](t[24])}return{key:e,first:null,c(){n=B("path"),r=B("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){O(p,n,m),O(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&&N(n),p&&N(r),f=!1,he(c)}}}function xr(e,t){let n,l,o,r,s,u,a=t[20].rank+"",f,c,d,g;return{key:e,first:null,c(){n=B("g"),l=B("circle"),u=B("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){O(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+"")&&J(f,a),m&152&&c!==(c=`translate(${t[3](t[20].qid)}, ${t[4](t[20].rank)})`)&&h(n,"transform",c)},d(p){p&&N(n),d=!1,he(g)}}}function Ap(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m=[],_=new Map,v,w=[],y=new Map,C,M,S,E,$,R=e[8],k=[];for(let D=0;DD[24];for(let D=0;DD[20].model+D[20].qid;for(let D=0;De[19].call(t))},m(D,G){O(D,t,G),b(t,n),b(n,l);for(let U=0;U{e.style.opacity=1})}function Rp(e,t,n){let l,o,r,s,u,a,f,c,d,g,p;ae(e,on,$=>n(7,p=$));let m,_,v={top:35,bottom:15,left:10,right:0};function w($){document.querySelectorAll(".model-path, .model-path-outer, .model-circle").forEach(R=>{R.style.opacity=.12}),document.querySelectorAll(`.model-path[data-model="${l[$]}"], .model-circle[data-model="${l[$]}"]`).forEach(R=>{R.style.opacity=1})}const y=$=>w($),C=$=>w($),M=()=>w(i),S=()=>w(i);function E(){_=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($=>$.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(p.map($=>$.qid)).padding(.3).range([v.left,o-v.right])),e.$$.dirty&128&&n(14,u=p.map($=>$.rank).sort(($,R)=>$-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(p.map($=>$.model)).range(["#FF5470","#1B2D45","#00EBC7","#FDE24F","red"])),e.$$.dirty&24&&n(10,c=$g().x($=>s($.qid)).y($=>a($.rank))),e.$$.dirty&132&&n(9,d=l.map($=>p.filter(R=>R.model===$))),e.$$.dirty&8&&n(8,g=s.domain().length>10?s.domain().filter(($,R)=>R%2===0):s.domain())},[m,_,l,s,a,r,o,p,g,d,c,f,v,w,u,y,C,M,S,E]}class Mp extends fe{constructor(t){super(),ce(this,t,Rp,Ap,ue,{})}}function Ur(e,t,n){const l=e.slice();return l[13]=t[n],l[15]=n,l}function Wr(e,t,n){const l=e.slice();return l[16]=t[n],l}function Xr(e,t,n){const l=e.slice();return l[16]=t[n],l}function Yr(e){let t,n,l=e[16]+"",o,r;return{c(){t=B("g"),n=B("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){O(s,t,u),b(t,n),b(n,o)},p(s,u){u&4&&l!==(l=s[16]+"")&&J(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 Qr(e){let t,n,l=e[16]+"",o,r;return{c(){t=B("g"),n=B("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){O(s,t,u),b(t,n),b(n,o)},p(s,u){u&128&&l!==(l=s[16]+"")&&J(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 Kr(e){let t,n=e[16]%2==0&&Qr(e);return{c(){n&&n.c(),t=ke()},m(l,o){n&&n.m(l,o),O(l,t,o)},p(l,o){l[16]%2==0?n?n.p(l,o):(n=Qr(l),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},d(l){n&&n.d(l),l&&N(t)}}}function Jr(e){let t,n,l,o,r,s,u,a=e[13].avgRank.toFixed(2)+"",f,c,d;return{c(){t=B("rect"),u=B("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){O(g,t,p),O(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)+"")&&J(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&&N(t),g&&N(u)}}}function Ep(e){let t,n,l,o,r,s,u,a,f,c,d,g,p=e[2].map(Zr),m=[];for(let C=0;Ce[12].call(t))},m(C,M){O(C,t,M),b(t,n);for(let S=0;Se.model;function Fp(e,t,n){let l,o,r,s,u,a,f,c,d;ae(e,on,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,w)=>(v[w.model]?(v[w.model].sum+=w.rank,v[w.model].count++):v[w.model]={sum:w.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=Xe().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 Dp extends fe{constructor(t){super(),ce(this,t,Fp,Ep,ue,{})}}function es(e,t,n){const l=e.slice();return l[20]=t[n],l[22]=n,l}function ts(e,t,n){const l=e.slice();return l[23]=t[n],l[25]=n,l}function ns(e,t,n){const l=e.slice();return l[23]=t[n],l}function ls(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){O(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+"")&&J(l,n)},d(u){u&&N(t),o=!1,r()}}}function os(e,t){let n,l=(t[20][t[23].key].length>rs&&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"),ye(n,"background",t[23].key==="change"?t[7](t[20][t[23].key]):"none"),Oe(n,"active",t[4]===`${t[22]}-${t[25]}`),this.first=n},m(f,c){O(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>rs&&t[4]!==`${t[22]}-${t[25]}`?`${t[20][t[23].key].substring(0,40)}...`:t[20][t[23].key])+"")&&J(o,l),c&64&&r!==(r="cell-type-"+t[23].type+" svelte-owgjbp")&&h(n,"class",r),c&96&&ye(n,"background",t[23].key==="change"?t[7](t[20][t[23].key]):"none"),c&80&&Oe(n,"active",t[4]===`${t[22]}-${t[25]}`)},d(f){f&&N(n),s=!1,u()}}}function is(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 S=M.reduce(($,R)=>($[R.model]||($[R.model]=[]),$[R.model].push(R.rank),$),{});return Object.entries(S).map(([$,R])=>{let k=R.reduce((T,I)=>(T[I]=(T[I]||0)+1,T),{}),F=Object.entries(k).reduce((T,I)=>I[1]>T[1]?I:T)[0];return{model:$,overall_rank:Number(F),average_rank:a(Ch(R)),standard_deviation_rank:a(uh(R))}})}u={...{columns:{},style:"normal",paged:25},...u};const d=Xe().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 w=null;const y=M=>{g&&(_===M.key&&n(2,v=!v),n(1,_=M.key))},C=(M,S)=>{n(4,w=w===`${M}-${S}`?null:`${M}-${S}`)};return e.$$.update=()=>{if(e.$$.dirty&512,e.$$.dirty&512&&n(8,l=f(s)),e.$$.dirty&774){_&&n(8,l=l.slice().sort((S,E)=>{let $=S[_],R=E[_];if($==R)return JSON.stringify(S).localeCompare(JSON.stringify(E));let k=$>R?1:${const S=u.columns[M]||{};return{key:M,type:S.type||typeof l[0][M],options:S}}))},n(5,r=[]),[u,_,v,g,w,r,o,d,l,s,y,C]}let Tp=class extends fe{constructor(t){super(),ce(this,t,Pp,Ip,ue,{})}};function ss(e,t,n){const l=e.slice();return l[19]=t[n],l}function as(e,t,n){const l=e.slice();return l[22]=t[n],l}function us(e,t,n){const l=e.slice();return l[25]=t[n],l[27]=n,l}function fs(e){let t,n=e[25]+"",l,o,r,s=e[25]+"",u,a;return{c(){t=B("text"),l=q(n),r=B("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){O(f,t,c),b(t,l),O(f,r,c),b(r,u)},p(f,c){c&8&&n!==(n=f[25]+"")&&J(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]+"")&&J(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 cs(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=B("rect"),a=B("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,_){O(m,t,_),O(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]])+"")&&J(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&&N(t),m&&N(a)}}}function ds(e){let t,n=e[3],l=[];for(let o=0;oe[16].call(t))},m(g,p){O(g,t,p),b(t,n);for(let m=0;mn(15,p=S));const m=vt(".1f");function _(S){let E=S.reduce((k,F)=>(k[F.qid]||(k[F.qid]=[]),k[F.qid].push(F),k),{}),$=Array.from(new Set(S.map(k=>k.model))),R=$.reduce((k,F)=>(k[F]=$.reduce((T,I)=>(T[I]={sum:0,count:0},T),{}),k),{});for(let k in E){let F=E[k];for(let T of $)for(let I of $){let V=F.find(G=>G.model===T),D=F.find(G=>G.model===I);V&&D&&(R[T][I].sum+=D.rank-V.rank,R[T][I].count++)}}for(let k in R)for(let F in R[k])R[k][F].count>0?R[k][F]=R[k][F].sum/R[k][F].count:R[k][F]=0;return R}let v=500,w=500,y={top:50,bottom:0,left:65,right:25};function C(S,E){let $=l[S][E];return $===0?"white":$>=0?g(S):g(E)}function M(){w=this.offsetWidth,v=this.offsetHeight,n(1,w),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(S=>S.model)))),e.$$.dirty&2&&n(14,r=w-y.left-y.right),e.$$.dirty&1&&n(13,s=v-y.top-y.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(S=>Object.values(S))),e.$$.dirty&4096&&n(11,c=ro(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((S,E)=>(S[E]=Ga().domain([c,d]).interpolator(ao("white",g(E))),S),{})},[v,w,l,o,a,u,m,y,C,g,d,c,f,s,r,p,M]}class Vp extends fe{constructor(t){super(),ce(this,t,zp,Op,ue,{})}}function hs(e,t,n){const l=e.slice();return l[7]=t[n],l[9]=n,l}function Lp(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){O(n,t,l)},p:X,i:X,o:X,d(n){n&&N(t)}}}function qp(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m,_,v,w,y,C,M,S,E=e[1],$=[];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){O(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):(_e(),L(s[c],1,1,()=>{s[c]=null}),ve(),l=s[n],l?l.p(a,f):(l=s[n]=r[n](a),l.c()),z(l,1),l.m(t,null))},i(a){o||(z(l),o=!0)},o(a){L(l),o=!1},d(a){a&&N(t),s[n].d()}}}function ps(){document.querySelectorAll(".model-path, .model-path-outer, .model-circle").forEach(e=>{e.style.opacity=1})}function Gp(e,t,n){let l,o,r;ae(e,on,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)}));De(on,r=[...p],r)}ct(()=>{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 fe{constructor(t){super(),ce(this,t,Gp,Hp,ue,{})}}function Bp(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,g,p,m,_,v,w,y;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[w=v<<1|_]))return o[w]=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[w]=s:e._root=s,e;do o=o?o[w]=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((w=v<<1|_)===(y=(m>=g)<<1|p>=d));return o[y]=r,o[w]=s,e}function xp(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)=w)<<1|e>=v)&&(m=g[g.length-1],g[g.length-1]=g[g.length-1-_],g[g.length-1-_]=m)}else{var y=e-+this._x.call(null,p.data),C=t-+this._y.call(null,p.data),M=y*y+C*C;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,w=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[w]=n:this._root=n),this):(this._root=r,this)}function Kp(e){for(var t=0,n=e.length;tg.index){var T=p-R.x-R.vx,I=m-R.y-R.vy,V=T*T+I*I;Vp+F||Em+F||$f.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}})}nl.prototype=pu.prototype={constructor:nl,on:function(e,t){var n=this._,l=fm(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;--rn}function bs(){qt=(yl=Nn.now())+Ml,rn=mn=0;try{hm()}finally{rn=0,pm(),qt=0}}function gm(){var e=Nn.now(),t=e-yl;t>mu&&(Ml-=t,yl=e)}function pm(){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);_n=e,yo(l)}function yo(e){if(!rn){mn&&(mn=clearTimeout(mn));var t=e-qt;t>24?(e<1/0&&(mn=setTimeout(bs,e-Nn.now()-Ml)),cn&&(cn=clearInterval(cn))):(cn||(yl=Nn.now(),cn=setInterval(gm,mu)),rn=1,_u(bs))}}const mm=1664525,_m=1013904223,ws=4294967296;function vm(){let e=1;return()=>(e=(mm*e+_m)%ws)/ws}var bm=10,wm=Math.PI*(3-Math.sqrt(5));function ym(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=vm();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,w){var y=0,C=e.length,M,S,E,$,R;for(w==null?w=1/0:w*=w,y=0;y1?(f.on(_,v),t):f.on(_)}}}function km(e){var t=it(.1),n,l,o;typeof e!="function"&&(e=it(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(y,C){O(y,t,C),b(t,n),b(t,r),b(r,u),b(r,a),b(a,c),_=!0,v||(w=[x(t,"mouseover",e[6]),x(t,"mouseout",e[7]),x(t,"focus",e[6]),x(t,"blur",e[7])],v=!0)},p(y,C){(!_||C&12&&l!==(l=y[3](y[20].size)))&&h(n,"r",l),(!_||C&4)&&s!==(s=y[20].file+"")&&J(u,s),(!_||C&4)&&f!==(f=io(y[20].size)+"")&&J(c,f),(!_||C&20&&d!==(d=y[20].size>y[4]?1:0))&&h(r,"opacity",d),(!_||C&20&&p!==(p="file-circle-g "+(y[20].size>y[4]?"large":"")+" svelte-h2ab3o"))&&h(t,"class",p),(!_||C&4&&m!==(m=y[5](y[20].x,y[20].y)))&&h(t,"style",m)},i(y){_||(y&&Re(()=>{_&&(o||(o=ot(n,Ln,{duration:1e3},!0)),o.run(1))}),y&&Re(()=>{_&&(g||(g=ot(r,Ln,{duration:1e3},!0)),g.run(1))}),_=!0)},o(y){y&&(o||(o=ot(n,Ln,{duration:1e3},!1)),o.run(0)),y&&(g||(g=ot(r,Ln,{duration:1e3},!1)),g.run(0)),_=!1},d(y){y&&N(t),y&&o&&o.end(),y&&g&&g.end(),v=!1,he(w)}}}function Cm(e){let t,n,l,o,r=e[2],s=[];for(let a=0;aL(s[a],1,1,()=>{s[a]=null});return{c(){t=A("div"),n=B("svg");for(let a=0;ae[15].call(t))},m(a,f){O(a,t,f),b(t,n);for(let c=0;cn(14,c=S));let d=600,g=350,p=!0,m=!1;const _=(S,E)=>`transform: translate(${S}px, ${E}px)`,v=[-4,4],w=[-1,1];function y(){n(8,p=!0),n(9,m=!0);const S=Mn(this);Nl(".file-circle-g").select("text").style("opacity",0),S.raise(),S.select("circle").attr("fill","var(--red)"),S.select("text").style("opacity",1)}const C=()=>{const S=Nl(".file-circle-g");S.select("circle").attr("fill","var(--yellow)"),S.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(S=>({...S,x:d/2,y:g/2,tickCount:0}))),e.$$.dirty&16384&&console.log(c.map(S=>S.size).sort((S,E)=>S-E)),e.$$.dirty&1&&n(13,o=km().x(d/2)),e.$$.dirty&2&&n(12,r=Sm().y(g/2)),e.$$.dirty&16384&&n(3,a=Xe().domain(vn(c,S=>S.size)).range([12,60])),e.$$.dirty&8&&n(10,s=am().radius(S=>a(S.size)+1).iterations(3)),e.$$.dirty&16384&&n(4,u=Sh(c.map(S=>S.size).sort((S,E)=>S-E),.85)),e.$$.dirty&1&&Xe().domain(v).range([5,d]),e.$$.dirty&2&&Xe().domain(w).range([g,5]),e.$$.dirty&4&&n(11,f=ym().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(vn(c,S=>S.size)),l.forEach(S=>S.radius=a(S.size)),f.nodes(l),s.radius(S=>S.radius+.5)),e.$$.dirty&768&&p===!1&&(m||Nl(".large").select("text").style("opacity",1))},[d,g,l,a,u,_,y,C,p,m,s,f,r,o,c,M]}class Am extends fe{constructor(t){super(),ce(this,t,$m,Cm,ue,{})}}/**
- * table-core
- *
- * Copyright (c) TanStack
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE.md file in the root directory of this source tree.
- *
- * @license MIT
- */function $t(e,t){return typeof e=="function"?e(t):e}function Ke(e,t){return n=>{t.setState(l=>({...l,[e]:$t(n,l[e])}))}}function Sl(e){return e instanceof Function}function Rm(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function Mm(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{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 Cs(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 Fm={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 w=[..._].reverse()[0],y=v.column.depth===m.depth;let C,M=!1;if(y&&v.column.parent?C=v.column.parent:(C=v.column,M=!0),w&&(w==null?void 0:w.column)===C)w.subHeaders.push(v);else{const S=Cs(n,C,{id:[l,p,C.id,v==null?void 0:v.id].filter(Boolean).join("_"),isPlaceholder:M,placeholderId:M?`${_.filter(E=>E.column===C).length}`:void 0,depth:p,index:_.length});S.subHeaders.push(v),_.push(S)}m.headers.push(v),v.headerGroup=m}),a.push(m),p>0&&f(_,p-1)},c=t.map((g,p)=>Cs(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,w=[0];m.subHeaders&&m.subHeaders.length?(w=[],d(m.subHeaders).forEach(C=>{let{colSpan:M,rowSpan:S}=C;_+=M,w.push(S)})):_=1;const y=Math.min(...w);return v=v+y,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:[]}),Dm={getDefaultColumnDef:()=>Xn,getInitialState:e=>({columnSizing:{},columnSizingInfo:Ul(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",onColumnSizingChange:Ke("columnSizing",e),onColumnSizingInfoChange:Ke("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(w=>{var y,C;const M=v-((y=w==null?void 0:w.startOffset)!=null?y:0),S=Math.max(M/((C=w==null?void 0:w.startSize)!=null?C:0),-.999999);return w.columnSizingStart.forEach(E=>{let[$,R]=E;a[$]=Math.round(Math.max(R+R*S,0)*100)/100}),{...w,deltaOffset:M,deltaPercentage:S}}),(t.options.columnResizeMode==="onChange"||_==="end")&&t.setColumnSizing(w=>({...w,...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=Im()?{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 Im(){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 Nm={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Ke("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=>et(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=>et(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=>et(e);const Su=(e,t,n)=>{var l;return(l=e.getValue(t))==null?void 0:l.includes(n)};Su.autoRemove=e=>et(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=>et(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=>et(e)||!(e!=null&&e.length);const Au=(e,t,n)=>e.getValue(t)===n;Au.autoRemove=e=>et(e);const Ru=(e,t,n)=>e.getValue(t)==n;Ru.autoRemove=e=>et(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=>et(e)||et(e[0])&&et(e[1]);const dt={includesString:wu,includesStringSensitive:yu,equalsString:ku,arrIncludes:Su,arrIncludesAll:Cu,arrIncludesSome:$u,equals:Au,weakEquals:Ru,inNumberRange:Go};function et(e){return e==null||e===""}const Pm={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:Ke("columnFilters",e),onGlobalFilterChange:Ke("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"?dt.includesString:typeof l=="number"?dt.inNumberRange:typeof l=="boolean"||l!==null&&typeof l=="object"?dt.equals:Array.isArray(l)?dt.arrIncludes:dt.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:dt[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($s(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:()=>dt.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:dt[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($s(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 $s(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const Tm=(e,t,n)=>n.reduce((l,o)=>{const r=o.getValue(e);return l+(typeof r=="number"?r:0)},0),Om=(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},Vm=(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},qm=(e,t)=>{if(!t.length)return;const n=t.map(r=>r.getValue(e));if(!Rm(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},Hm=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),Gm=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,jm=(e,t)=>t.length,Xl={sum:Tm,min:Om,max:zm,extent:Vm,mean:Lm,median:qm,unique:Hm,uniqueCount:Gm,count:jm},Bm={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:Ke("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 xm(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 Um={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Ke("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 xm(r,n,l)},{key:!1})})},ko=0,So=10,Yl=()=>({pageIndex:ko,pageSize:So}),Wm={getInitialState:e=>({...e,pagination:{...Yl(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Ke("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?ko:(o=(r=e.initialState)==null||(s=r.pagination)==null?void 0:s.pageIndex)!=null?o:ko)},resetPageSize:l=>{var o,r,s;e.setPageSize(l?So:(o=(r=e.initialState)==null||(s=r.pagination)==null?void 0:s.pageSize)!=null?o:So)},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:[]}),Xm={getInitialState:e=>({columnPinning:Ql(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Ke("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}})})},Ym={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Ke("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=>{Co(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 Co(r,e.id,n,t),r})},getIsSelected:()=>{const{rowSelection:n}=t.getState();return jo(e,n)},getIsSomeSelected:()=>{const{rowSelection:n}=t.getState();return As(e,n)==="some"},getIsAllSubRowsSelected:()=>{const{rowSelection:n}=t.getState();return As(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)}}})},Co=(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=>Co(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=jo(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 jo(e,t){var n;return(n=t[e.id])!=null?n:!1}function As(e,t,n){if(e.subRows&&e.subRows.length){let l=!0,o=!1;return e.subRows.forEach(r=>{o&&!l||(jo(r,t)?o=!0:l=!1)}),l?"all":o?"some":!1}return!1}const $o=/([0-9]+)/gm,Qm=(e,t,n)=>Mu(Rt(e.getValue(n)).toLowerCase(),Rt(t.getValue(n)).toLowerCase()),Km=(e,t,n)=>Mu(Rt(e.getValue(n)),Rt(t.getValue(n))),Jm=(e,t,n)=>Bo(Rt(e.getValue(n)).toLowerCase(),Rt(t.getValue(n)).toLowerCase()),Zm=(e,t,n)=>Bo(Rt(e.getValue(n)),Rt(t.getValue(n))),e_=(e,t,n)=>{const l=e.getValue(n),o=t.getValue(n);return l>o?1:lBo(e.getValue(n),t.getValue(n));function Bo(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($o).filter(Boolean),l=t.split($o).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 dn={alphanumeric:Qm,alphanumericCaseSensitive:Km,text:Jm,textCaseSensitive:Zm,datetime:e_,basic:t_},n_={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Ke("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 dn.datetime;if(typeof r=="string"&&(l=!0,r.split($o).length>1))return dn.alphanumeric}return l?dn.text:dn.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:dn[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())})},l_={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Ke("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)}}}},Rs=[Fm,l_,Um,Xm,Pm,n_,Bm,Nm,Wm,Ym,Dm];function o_(e){var t;(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");let n={_features:Rs};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:Rs,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=Em(n,_,m,p),w=_;return v.columns=w.columns?d(w.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 i_(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:()=>Mm(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=>i_(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 Ms(){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?s_(e,t,n):a_(e,t,n)}function s_(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 Fs(){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 Ds(){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 u_(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 Is(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=u_({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}})}/**
- * svelte-table
- *
- * Copyright (c) TanStack
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE.md file in the root directory of this source tree.
- *
- * @license MIT
- */function f_(e){let t;return{c(){t=q(e[0])},l(n){t=Xu(n,e[0])},m(n,l){Gu(n,t,l)},p(n,[l]){l&1&&J(t,n[0])},i:X,o:X,d(n){n&&N(t)}}}function c_(e,t,n){let{content:l}=t;return e.$$set=o=>{"content"in o&&n(0,l=o.content)},[l]}class d_ extends fe{constructor(t){super(),ce(this,t,c_,f_,ue,{content:0})}}const h_=ca((e,t,n,l)=>`${df(t.content)}`);var g_=typeof document>"u"?h_:d_;function p_(e,t,n){let l,o;return l=new t({props:n,$$inline:!0}),{c(){le(l.$$.fragment)},l(r){gf(l.$$.fragment,r)},m(r,s){ee(l,r,s),o=!0},p:X,i(r){o||(z(l.$$.fragment,r),o=!0)},o(r){L(l.$$.fragment,r),o=!1},d(r){te(l,r)}}}function m_(e,t){return class extends fe{constructor(l){super(),ce(this,l,null,o=>p_(o,e,t),ue,{},void 0)}}}function __(e,t){return ca((l,o,r,s)=>`${hf(e,"TableComponent").$$render(l,t,{},{})}`)}const Ao=typeof window>"u"?__:m_;function v_(e){return typeof e=="object"&&typeof e.$$render=="function"&&typeof e.render=="function"}function b_(e){var t,n;let l="__SVELTE_HMR"in window;return e.prototype instanceof fe||l&&((t=e.name)==null?void 0:t.startsWith("Proxy<"))&&((n=e.name)==null?void 0:n.endsWith(">"))}function Ns(e){return typeof document>"u"?v_(e):b_(e)}function Ps(e){return Ao(g_,{content:e})}function Cl(e,t){if(!e)return null;if(Ns(e))return Ao(e,t);if(typeof e=="function"){const n=e(t);return n==null?null:Ns(n)?Ao(n,t):Ps(n)}return Ps(e)}function Ts(e){let t;"subscribe"in e?t=e:t=to(e);let n={state:{},onStateChange:()=>{},renderFallbackValue:null,...Pu(t)},l=o_(n),o=Ie(l.initialState),r=mf([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()}})}/**
- * match-sorter-utils
- *
- * Copyright (c) TanStack
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE.md file in the root directory of this source tree.
- *
- * @license MIT
- */const 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"},w_=Object.keys(Fu).join("|"),y_=new RegExp(w_,"g");function k_(e){return e.replace(y_,t=>Fu[t])}/**
- * @name match-sorter
- * @license MIT license.
- * @copyright (c) 2099 Kent C. Dodds
- * @author Kent C. Dodds (https://kentcdodds.com)
- */const He={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0};function S_(e,t,n){var l;if(n=n||{},n.threshold=(l=n.threshold)!=null?l:He.MATCHES,!n.accessors){const s=Os(e,t,n);return{rankedValue:e,rank:s,accessorIndex:-1,accessorThreshold:n.threshold,passed:s>=n.threshold}}const o=R_(e,n.accessors),r={rankedValue:e,rank:He.NO_MATCH,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let s=0;s=He.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 Os(e,t,n){return e=zs(e,n),t=zs(t,n),t.length>e.length?He.NO_MATCH:e===t?He.CASE_SENSITIVE_EQUAL:(e=e.toLowerCase(),t=t.toLowerCase(),e===t?He.EQUAL:e.startsWith(t)?He.STARTS_WITH:e.includes(` ${t}`)?He.WORD_STARTS_WITH:e.includes(t)?He.CONTAINS:t.length===1?He.NO_MATCH:C_(e).includes(t)?He.ACRONYM:$_(e,t))}function C_(e){let t="";return e.split(" ").forEach(l=>{l.split("-").forEach(r=>{t+=r.substr(0,1)})}),t}function $_(e,t){let n=0,l=0;function o(a,f,c){for(let d=c,g=f.length;d-1))return He.NO_MATCH}const u=l-s;return r(u)}function zs(e,t){let{keepDiacritics:n}=t;return e=`${e}`,n||(e=k_(e)),e}function A_(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 R_(e,t){const n=[];for(let l=0,o=t.length;l{te(m,1)}),ve()}c?(n=At(c,d()),le(n.$$.fragment),z(n.$$.fragment,1),ee(n,t,l)):n=null}},i(g){u||(n&&z(n.$$.fragment,g),u=!0)},o(g){n&&L(n.$$.fragment,g),u=!1},d(g){g&&N(t),n&&te(n),a=!1,f()}}}function js(e){let t,n,l=!e[26].isPlaceholder&&E_(e);return{c(){t=A("th"),l&&l.c(),h(t,"colspan",e[26].colSpan),h(t,"class","svelte-16fb3tv")},m(o,r){O(o,t,r),l&&l.m(t,null),n=!0},p(o,r){o[26].isPlaceholder||l.p(o,r)},i(o){n||(z(l),n=!0)},o(o){L(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;uL(r[u],1,1,()=>{r[u]=null});return{c(){t=A("tr");for(let u=0;u{te(f,1)}),ve()}r?(l=At(r,s()),le(l.$$.fragment),z(l.$$.fragment,1),ee(l,n,null)):l=null}},i(u){o||(l&&z(l.$$.fragment,u),o=!0)},o(u){l&&L(l.$$.fragment,u),o=!1},d(u){u&&N(n),l&&te(l)}}}function Us(e){let t,n=[],l=new Map,o,r,s=e[17].getVisibleCells();const u=a=>a[20].id;for(let a=0;a",K,W,Y,Q,Se,Fe=e[5],Ce=[];for(let ie=0;ieL(Ce[ie],1,1,()=>{Ce[ie]=null});let Et=e[1].getRowModel().rows,$e=[];for(let ie=0;ieL($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=$l(w,S=>n(1,o=S)),w);ae(e,kl,S=>n(8,l=S)),e.$$.on_destroy.push(()=>r());const u=(S,E,$,R)=>{if(console.log("yessir"),Array.isArray($))return $.length===0?!0:$.includes(S.getValue(E));typeof $=="number"&&($=String($));const k=S_(S.getValue(E),$);return R({itemRank:k}),k.passed},a=r_(),f=[a.accessor("file",{header:"File",cell:S=>S.getValue(),footer:S=>S.column.id}),a.accessor("size",{header:"Size",cell:S=>io(S.getValue()),footer:S=>S.column.id}),a.accessor("type",{header:"Type",cell:S=>S.getValue(),footer:S=>S.column.id})];let c="",d=Ie({data:l,columns:f,getCoreRowModel:Ms(),getSortedRowModel:Ds(),getFilteredRowModel:Es(),globalFilterFn:u,getFacetedRowModel:Fs(),getPaginationRowModel:Is(),state:{globalFilter:c,pagination:{pageSize:7,pageIndex:0}},enableGlobalFilter:!0});function g(S){n(6,c=S),d.update(E=>({...E,state:{...E.state,globalFilter:S}}))}function p(S){d.update(E=>{var $;return{...E,state:{...E.state,pagination:{...($=E.state)==null?void 0:$.pagination,pageIndex:S}}}})}let m;function _(S){clearTimeout(m),m=setTimeout(()=>{const E=S.target;g(E.value)},100)}function v(S){const E=S.target;p(parseInt(E.value)-1)}let w=Ts(d);s();let y=o.getHeaderGroups();const C=()=>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:Ms(),getSortedRowModel:Ds(),getFilteredRowModel:Es(),globalFilterFn:u,getFacetedRowModel:Fs(),getPaginationRowModel:Is(),state:{globalFilter:c,pagination:{pageSize:7,pageIndex:0}},enableGlobalFilter:!0}),s(n(0,w=Ts(Ie(d)))))},[w,o,p,_,v,y,c,d,l,C,M]}class N_ extends fe{constructor(t){super(),ce(this,t,I_,F_,ue,{})}}function P_(e){let t,n;return{c(){t=B("svg"),n=B("path"),h(n,"d","M248,128a87.34,87.34,0,0,1-17.6,52.81,8,8,0,1,1-12.8-9.62A71.34,71.34,0,0,0,232,128a72,72,0,0,0-144,0,8,8,0,0,1-16,0,88,88,0,0,1,3.29-23.88C74.2,104,73.1,104,72,104a48,48,0,0,0,0,96H96a8,8,0,0,1,0,16H72A64,64,0,1,1,81.29,88.68,88,88,0,0,1,248,128Zm-90.34-5.66a8,8,0,0,0-11.32,0l-32,32a8,8,0,0,0,11.32,11.32L144,147.31V208a8,8,0,0,0,16,0V147.31l18.34,18.35a8,8,0,0,0,11.32-11.32Z"),h(t,"xmlns","http://www.w3.org/2000/svg"),h(t,"width",e[1]),h(t,"height",e[0]),h(t,"fill","currentColor"),h(t,"viewBox","0 0 256 256")},m(l,o){O(l,t,o),b(t,n)},p(l,[o]){o&2&&h(t,"width",l[1]),o&1&&h(t,"height",l[0])},i:X,o:X,d(l){l&&N(t)}}}function T_(e,t,n){let{height:l=256,width:o=256}=t;return e.$$set=r=>{"height"in r&&n(0,l=r.height),"width"in r&&n(1,o=r.width)},[l,o]}class O_ extends fe{constructor(t){super(),ce(this,t,T_,P_,ue,{height:0,width:1})}}function Ws(e){let t,n;return{c(){t=A("p"),n=q(e[2]),h(t,"class","svelte-14n6h1p")},m(l,o){O(l,t,o),b(t,n)},p(l,o){o&4&&J(n,l[2])},d(l){l&&N(t)}}}function Xs(e){let t;return{c(){t=A("p"),t.textContent="Data Successfully indexed!",h(t,"class","svelte-14n6h1p")},m(n,l){O(n,t,l)},d(n){n&&N(t)}}}function z_(e){let t,n;return t=new N_({}),{c(){le(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},i(l){n||(z(t.$$.fragment,l),n=!0)},o(l){L(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function V_(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m,_,v,w,y,C,M,S,E,$,R,k,F;m=new O_({props:{height:32,width:32}});let T=e[1]&&!e[0]&&Ws(e),I=e[0]&&Xs();E=new Am({});let V=e[3]&&z_();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("p"),u.textContent="These are the files your model will use as context.",a=P(),f=A("div"),c=A("form"),d=A("input"),g=P(),p=A("div"),le(m.$$.fragment),_=q(`
- Drag and drop files here`),v=P(),T&&T.c(),w=P(),I&&I.c(),y=P(),C=A("p"),C.textContent="Currently pdf, txt, and md are supported.",M=P(),S=A("div"),le(E.$$.fragment),$=P(),V&&V.c(),h(u,"class","svelte-14n6h1p"),h(d,"type","file"),d.multiple=!0,h(p,"class","drop-zone svelte-14n6h1p"),h(f,"class","upload-files-container svelte-14n6h1p"),h(C,"class","svelte-14n6h1p"),h(o,"class","upload-box svelte-14n6h1p"),h(l,"class","upload-container svelte-14n6h1p"),h(n,"class","file-container svelte-14n6h1p"),h(S,"class","charts-container svelte-14n6h1p"),h(t,"class","data-grid svelte-14n6h1p")},m(D,G){O(D,t,G),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(c,d),b(f,g),b(f,p),ee(m,p,null),b(p,_),b(o,v),T&&T.m(o,null),b(o,w),I&&I.m(o,null),b(o,y),b(o,C),b(t,M),b(t,S),ee(E,S,null),b(S,$),V&&V.m(S,null),R=!0,k||(F=[x(d,"change",e[4]),x(p,"drop",e[4]),x(p,"dragover",L_)],k=!0)},p(D,[G]){D[1]&&!D[0]?T?T.p(D,G):(T=Ws(D),T.c(),T.m(o,w)):T&&(T.d(1),T=null),D[0]?I||(I=Xs(),I.c(),I.m(o,y)):I&&(I.d(1),I=null)},i(D){R||(z(m.$$.fragment,D),z(E.$$.fragment,D),z(V),R=!0)},o(D){L(m.$$.fragment,D),L(E.$$.fragment,D),L(V),R=!1},d(D){D&&N(t),te(m),T&&T.d(),I&&I.d(),te(E),V&&V.d(),k=!1,he(F)}}}function L_(e){console.log("File(s) in drop zone"),e.preventDefault()}function q_(e,t,n){let l,o,r;ae(e,ys,m=>n(6,o=m)),ae(e,kl,m=>n(7,r=m));let s=[],u=!1,a=!1;async function f(m){m.preventDefault();let _=[];m.dataTransfer?m.dataTransfer.items?[...m.dataTransfer.items].forEach((w,y)=>{if(w.kind==="file"){const C=w.getAsFile();_.push(C)}}):[...m.dataTransfer.files].forEach((w,y)=>{_.push(w)}):_=m.target.files;const v=new FormData;for(let w=0;w<_.length;w++)v.append("files",_[w]);await fetch("/retrieval/file/upload",{method:"POST",body:v}),d(),c(),g()}async function c(){const v=(await(await fetch("/retrieval/file/get")).json()).files.map(w=>({file:w.name,size:w.size,type:w.type}));De(kl,r=[...v],r)}async function d(){console.log("index!"),n(1,a=!0),await(await fetch("/retrieval/vector_db/index",{method:"POST"})).json(),n(0,u=!0),n(1,a=!1)}async function g(){console.log("getting embeddings...");const _=await(await fetch("/retrieval/vector_db/get")).json();console.log("embeddingData",_),De(ys,o=_,o)}ct(()=>{c()});let p=0;return setInterval(()=>{n(5,p=(p+1)%4)},200),e.$$.update=()=>{e.$$.dirty&32&&n(2,l="Indexing"+".".repeat(p))},[u,a,l,s,f,p]}class H_ extends fe{constructor(t){super(),ce(this,t,q_,V_,ue,{})}}function G_(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m,_,v,w,y,C,M,S,E,$,R,k,F,T;return r=new Ka({}),a=new Ja({}),d=new Ua({}),m=new Xa({props:{feedback:"Bad"}}),w=new Qa({}),M=new Ya({}),F=new Wa({}),{c(){t=A("div"),n=A("div"),l=A("div"),o=A("div"),le(r.$$.fragment),s=P(),u=A("div"),le(a.$$.fragment),f=P(),c=A("div"),le(d.$$.fragment),g=P(),p=A("div"),le(m.$$.fragment),_=P(),v=A("div"),le(w.$$.fragment),y=P(),C=A("div"),le(M.$$.fragment),S=P(),E=A("div"),$=A("div"),$.innerHTML=`
-
`,R=P(),k=A("div"),le(F.$$.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(C,"class","left-filter2"),h(n,"class","feedback-left svelte-14znspc"),h($,"class","right-chart svelte-14znspc"),h(k,"class","right-table svelte-14znspc"),h(E,"class","feedback-right svelte-14znspc"),h(t,"class","feedback-container svelte-14znspc")},m(I,V){O(I,t,V),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(w,v,null),b(n,y),b(n,C),ee(M,C,null),b(t,S),b(t,E),b(E,$),b(E,R),b(E,k),ee(F,k,null),T=!0},p:X,i(I){T||(z(r.$$.fragment,I),z(a.$$.fragment,I),z(d.$$.fragment,I),z(m.$$.fragment,I),z(w.$$.fragment,I),z(M.$$.fragment,I),z(F.$$.fragment,I),T=!0)},o(I){L(r.$$.fragment,I),L(a.$$.fragment,I),L(d.$$.fragment,I),L(m.$$.fragment,I),L(w.$$.fragment,I),L(M.$$.fragment,I),L(F.$$.fragment,I),T=!1},d(I){I&&N(t),te(r),te(a),te(d),te(m),te(w),te(M),te(F)}}}function j_(e,t,n){let l;ae(e,Rn,r=>n(0,l=r)),ct(()=>{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(Rn,l=[...a],l)}return[]}class B_ extends fe{constructor(t){super(),ce(this,t,j_,G_,ue,{})}}function x_(e){let t,n;return t=new Za({}),{c(){le(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},i(l){n||(z(t.$$.fragment,l),n=!0)},o(l){L(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function U_(e){let t,n;return t=new B_({}),{c(){le(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},i(l){n||(z(t.$$.fragment,l),n=!0)},o(l){L(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function W_(e){let t,n;return t=new Za({}),{c(){le(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},i(l){n||(z(t.$$.fragment,l),n=!0)},o(l){L(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function X_(e){let t,n,l,o;const r=[W_,U_,x_],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=ke()},m(a,f){s[t].m(a,f),O(a,l,f),o=!0},p(a,[f]){let c=t;t=u(a),t!==c&&(_e(),L(s[c],1,1,()=>{s[c]=null}),ve(),n=s[t],n||(n=s[t]=r[t](a),n.c()),z(n,1),n.m(l.parentNode,l))},i(a){o||(z(n),o=!0)},o(a){L(n),o=!1},d(a){s[t].d(a),a&&N(l)}}}function Y_(e,t,n){let{feedback:l}=t;return e.$$set=o=>{"feedback"in o&&n(0,l=o.feedback)},[l]}class Q_ extends fe{constructor(t){super(),ce(this,t,Y_,X_,ue,{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)}),ve()}r?(t=At(r,s()),le(t.$$.fragment),z(t.$$.fragment,1),ee(t,n.parentNode,n)):t=null}else r&&t.$set(f)},i(u){l||(t&&z(t.$$.fragment,u),l=!0)},o(u){t&&L(t.$$.fragment,u),l=!1},d(u){u&&N(n),t&&te(t,u)}}}function K_(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=ke()},m(s,u){o&&o.m(s,u),O(s,t,u),r&&r.m(s,u),O(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&&z(r,1)):(r=Js(s),r.c(),z(r,1),r.m(n.parentNode,n)):r&&(_e(),L(r,1,1,()=>{r=null}),ve())},i(s){l||(z(r),l=!0)},o(s){L(r),l=!1},d(s){o&&o.d(s),s&&N(t),r&&r.d(s),s&&N(n)}}}function J_(e,t,n){let l,o;const r=Ie([]);ae(e,r,c=>n(0,l=c));const s=Ie(null);ae(e,s,c=>n(1,o=c));const u={Chatbot:Kd,Dropdown:eh,Feedback:Q_,Compare:$p,CompareDashboard:jp,RetrievalQA:H_},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 Z_ extends fe{constructor(t){super(),ce(this,t,J_,K_,ue,{})}}new Z_({target:document.getElementById("app")});
diff --git a/pykoi/frontend/dist/assets/index-8dfc5bce.js b/pykoi/frontend/dist/assets/index-8dfc5bce.js
new file mode 100644
index 0000000..0523967
--- /dev/null
+++ b/pykoi/frontend/dist/assets/index-8dfc5bce.js
@@ -0,0 +1,65 @@
+(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 X(){}const Zs=e=>e;function An(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 he(e){e.forEach(ea)}function Ve(e){return typeof e=="function"}function ue(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Nu(e){return Object.keys(e).length===0}function Al(e,...t){if(e==null)return X;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function Pu(e){let t;return Al(e,n=>t=n)(),t}function ae(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?An(n.ctx.slice(),e[1](l(t))):n.ctx}function Xo(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(),Eo=na?e=>requestAnimationFrame(e):X;const Qt=new Set;function oa(e){Qt.forEach(t=>{t.c(e)||(Qt.delete(t),t.f())}),Qt.size!==0&&Eo(oa)}function ia(e){let t;return Qt.size===0&&Eo(oa),{promise:new Promise(n=>{Qt.add(t={c:e,f:n})}),abort(){Qt.delete(t)}}}let Rl=!1;function Ou(){Rl=!0}function Tu(){Rl=!1}function zu(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:zu(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 ju(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 xu(e){return Array.from(e.childNodes)}function Wu(e){e.claim_info===void 0&&(e.claim_info={last_index:0,total_claimed:0})}function Uu(e,t,n,l,o=!1){Wu(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 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},()=>L(t),!0)}function J(e,t){t=""+t,e.data!==t&&(e.data=t)}function Ke(e,t){e.value=t??""}function ye(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;lonresize=function(){parent.postMessage(0,'*')}<\/script>",r=B(window,"message",s=>{s.source===l.contentWindow&&t()})):(l.src="about:blank",l.onload=()=>{r=B(l.contentWindow,"resize",t),t()}),b(e,l),()=>{(o||r&&l.contentWindow)&&r(),P(l)}}function Te(e,t,n){e.classList[n?"add":"remove"](t)}function Qu(e,t,{bubbles:n=!1,cancelable:l=!1}={}){const o=document.createEvent("CustomEvent");return o.initCustomEvent(e,n,l,t),o}function Mt(e,t){return new e(t)}const il=new Map;let rl=0;function Ku(e){let t=5381,n=e.length;for(;n--;)t=(t<<5)-t^e.charCodeAt(n);return t>>>0}function Ju(e,t){const n={stylesheet:qu(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 w=t+(n-t)*r(v);f+=v*100+`%{${s(w,1-w)}}
+`}const c=f+`100% {${s(n,1-n)}}
+}`,d=`__svelte_${Ku(c)}_${u}`,g=ra(e),{stylesheet:p,rules:m}=il.get(g)||Ju(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`,rl+=1,d}function Zu(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(", "),rl-=o,rl||ef())}function ef(){Eo(()=>{rl||(il.forEach(e=>{const{ownerNode:t}=e.stylesheet;t&&P(t)}),il.clear())})}let tn;function Vt(e){tn=e}function tf(){if(!tn)throw new Error("Function called outside component initialization");return tn}function dt(e){tf().$$.on_mount.push(e)}function nf(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach(l=>l.call(this,t))}const Ut=[],nt=[];let Kt=[];const eo=[],lf=Promise.resolve();let to=!1;function of(){to||(to=!0,lf.then(aa))}function Se(e){Kt.push(e)}function Rn(e){eo.push(e)}const Fl=new Set;let jt=0;function aa(){if(jt!==0)return;const e=tn;do{try{for(;jte.indexOf(l)===-1?t.push(l):n.push(l)),n.forEach(l=>l()),Kt=t}let fn;function af(){return fn||(fn=Promise.resolve(),fn.then(()=>{fn=null})),fn}function Dl(e,t,n){e.dispatchEvent(Qu(`${t?"intro":"outro"}${n}`))}const Kn=new Set;let pt;function _e(){pt={r:0,c:[],p:pt}}function ve(){pt.r||he(pt.c),pt=pt.p}function z(e,t){e&&e.i&&(Kn.delete(e),e.i(t))}function q(e,t,n,l){if(e&&e.o){if(Kn.has(e))return;Kn.add(e),pt.c.push(()=>{Kn.delete(e),l&&(n&&e.d(1),l())}),e.o(t)}else l&&l()}const uf={duration:0};function Ge(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&&Zu(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=Zs,tick:w=X,css:y}=r||uf,C={start:la()+m,b:p};p||(C.group=pt,pt.r+=1),u||a?a=C:(y&&(c(),f=Ko(e,s,p,_,m,v,y)),p&&w(0,1),u=d(C,_),Se(()=>Dl(e,p,"start")),ia(E=>{if(a&&E>a.start&&(u=d(a,_),a=null,Dl(e,u.b,"start"),y&&(c(),f=Ko(e,s,u.b,u.duration,0,v,r.css))),u){if(E>=u.end)w(s=u.b,1-s),Dl(e,u.b,"end"),a||(u.b?c():--u.group.r||he(u.group.c)),u=null;else if(E>=u.start){const S=E-u.start;s=u.a+u.d*v(S/u.duration),w(s,1-s)}}return!!(u||a)}))}return{run(p){Ve(r)?af().then(()=>{r=r(o),g(p)}):g(p)},end(){c(),u=a=null}}}function nn(e,t){e.d(1),t.delete(e.key)}function Mo(e,t){q(e,1,1,()=>{t.delete(e.key)})}function vt(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=[],w=new Map,y=new Map,C=[];for(m=p;m--;){const $=d(o,r,m),R=n($);let k=s.get(R);k?l&&C.push(()=>k.p($,t)):(k=f(R,$),k.c()),w.set(R,v[m]=k),R in _&&y.set(R,Math.abs(m-_[R]))}const E=new Set,S=new Set;function F($){z($,1),$.m(u,c),s.set($.key,$),c=$.first,p--}for(;g&&p;){const $=v[p-1],R=e[g-1],k=$.key,M=R.key;$===R?(c=$.first,g--,p--):w.has(M)?!s.has(k)||E.has(k)?F($):S.has(M)?g--:y.get(k)>y.get(M)?(S.add(k),F($)):(E.add(M),g--):(a(R,s),g--)}for(;g--;){const $=e[g];w.has($.key)||a($,s)}for(;p;)F(v[p-1]);return he(C),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 ff=/[&"]/g,cf=/[&<]/g;function df(e,t=!1){const n=String(e),l=t?ff:cf;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 hf(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 ca(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 he(Il),{html:s,css:{code:Array.from(r.css).map(u=>u.code).join(`
+`),map:null},head:r.title+r.head}},$$render:t}}function En(e,t,n){const l=e.$$.props[t];l!==void 0&&(e.$$.bound[l]=n,n(e.$$.ctx[l]))}function le(e){e&&e.c()}function gf(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||Se(()=>{const s=e.$$.on_mount.map(ea).filter(Ve);e.$$.on_destroy?e.$$.on_destroy.push(...s):he(s),e.$$.on_mount=[]}),r.forEach(Se)}function te(e,t){const n=e.$$;n.fragment!==null&&(sf(n.after_update),he(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function pf(e,t){e.$$.dirty[0]===-1&&(Ut.push(e),of(),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&&pf(e,d)),g}):[],f.update(),c=!0,he(f.before_update),f.fragment=l?l(f.ctx):!1,t.target){if(t.hydrate){Ou();const d=xu(t.target);f.fragment&&f.fragment.l(d),d.forEach(P)}else f.fragment&&f.fragment.c();t.intro&&z(e.$$.fragment),ee(e,t.target,t.anchor,t.customElement),Tu(),aa()}Vt(a)}class fe{$destroy(){te(this,1),this.$destroy=X}$on(t,n){if(!Ve(n))return X;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&&!Nu(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=X){let n;const l=new Set;function o(u){if(ue(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 mf(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=X;const d=()=>{if(f)return;c();const p=t(l?a[0]:a,s);r?s(p):c=Ve(p)?p:X},g=o.map((p,m)=>Al(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)=>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 Do(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:g=Zs,interpolate:p=lo}=An(An({},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=_(g(w/d))),!0)}),l.promise}return{set:r,update:(s,u)=>r(s(o,e),u),subscribe:n.subscribe}}const je=Ie([]),Nl=Ie([]),cn=Ie([]),Mn=Ie([]),ut=Ie("all"),Zo=Ie({"n/a":1,up:1,down:1}),_f=["who","what","how","why","where","does","can","n/a"],oo=Do(_f.map(e=>({question:e,count:0}))),gt=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 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 vf(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 bf(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ha(e){var t=da(e);return(t.local?bf:vf)(t)}function wf(){}function ga(e){return e==null?wf:function(){return this.querySelector(e)}}function yf(e){typeof e!="function"&&(e=ga(e));for(var t=this._groups,n=t.length,l=new Array(n),o=0;o=C&&(C=y+1);!(S=v[C])&&++C=0;)(s=l[o])&&(r&&s.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(s,r),r=s);return this}function Uf(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 Yf(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Qf(){return Array.from(this)}function Kf(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?ac:typeof t=="function"?fc:uc)(e,t,n??"")):dc(this.node(),e)}function dc(e,t){return e.style.getPropertyValue(t)||va(e).getComputedStyle(e,null).getPropertyValue(t)}function hc(e){return function(){delete this[e]}}function gc(e,t){return function(){this[e]=t}}function pc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function mc(e,t){return arguments.length>1?this.each((t==null?hc:typeof t=="function"?pc:gc)(e,t)):this.node()[e]}function ba(e){return e.trim().split(/^|\s+/)}function Io(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=Io(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 Zc(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,_){O(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=[B(o,"click",function(){Ve(e[1])&&e[1].apply(this,arguments)}),B(n,"click",ju(e[5])),B(t,"close",function(){Ve(e[1])&&e[1].apply(this,arguments)}),B(t,"click",Bu(function(){Ve(e[1])&&e[1].apply(this,arguments)}))],a=!0)},p(m,[_]){e=m,d&&d.p&&(!u||_&8)&&Yo(d,c,e,e[3],u?Xo(c,e[3],_,Jc):Qo(e[3]),ti),p&&p.p&&(!u||_&8)&&Yo(p,g,e,e[3],u?Xo(g,e[3],_,null):Qo(e[3]),null)},i(m){u||(z(d,m),z(p,m),u=!0)},o(m){q(d,m),q(p,m),u=!1},d(m){m&&P(t),d&&d.d(m),p&&p.d(m),e[6](null),a=!1,he(f)}}}function ed(e,t,n){let{$$slots:l={},$$scope:o}=t,{showModal:r}=t,{dialog:s}=t,{handleClose:u}=t;function a(c){nf.call(this,e,c)}function f(c){nt[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 td extends fe{constructor(t){super(),ce(this,t,ed,Zc,ue,{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='Download ',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){O(c,t,d),b(t,n),b(n,l),b(n,o),b(n,r),Ke(r,e[2]),b(t,s),b(t,u),a||(f=[B(r,"input",e[9]),B(t,"submit",e[6])],a=!0)},p(c,d){d&4&&r.value!==c[2]&&Ke(r,c[2])},d(c){c&&P(t),a=!1,he(f)}}}function li(e){let t,n,l,o,r,s,u,a,f;return{c(){t=A("div"),n=L("✅ Data downloaded to /pykoi/"),l=L(e[2]),o=L(".csv"),r=N(),s=A("div"),u=A("button"),u.textContent="Close",h(s,"class","btn-container svelte-sy2m0x")},m(c,d){O(c,t,d),b(t,n),b(t,l),b(t,o),O(c,r,d),O(c,s,d),b(s,u),a||(f=B(u,"click",e[7]),a=!0)},p(c,d){d&4&&J(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){O(f,t,c),O(f,n,c),O(f,l,c),b(l,o),b(l,r),b(l,s),u||(a=[B(o,"click",e[10]),B(s,"click",e[7])],u=!0)},p:X,d(f){f&&P(t),f&&P(n),f&&P(l),u=!1,he(a)}}}function ii(e){let t,n,l,o,r,s,u,a,f,c,d;return{c(){t=A("div"),n=L("⚠️ "),l=L(e[2]),o=L(".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){O(g,t,p),b(t,n),b(t,l),b(t,o),O(g,r,p),O(g,s,p),b(s,u),b(s,a),b(s,f),c||(d=[B(u,"click",e[11]),B(f,"click",e[12])],c=!0)},p(g,p){p&4&&J(l,g[2])},d(g){g&&P(t),g&&P(r),g&&P(s),c=!1,he(d)}}}function nd(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=ke()},m(f,c){r&&r.m(f,c),O(f,t,c),s&&s.m(f,c),O(f,n,c),u&&u.m(f,c),O(f,l,c),a&&a.m(f,c),O(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 ld(e){let t;return{c(){t=A("h4"),t.textContent="Download Data",h(t,"slot","header"),h(t,"class","svelte-sy2m0x")},m(n,l){O(n,t,l)},p:X,d(n){n&&P(t)}}}function od(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:[ld],default:[nd]},$$scope:{ctx:e}};return e[0]!==void 0&&(u.showModal=e[0]),e[1]!==void 0&&(u.dialog=e[1]),t=new td({props:u}),nt.push(()=>En(t,"showModal",r)),nt.push(()=>En(t,"dialog",s)),{c(){le(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],Rn(()=>n=!1)),!l&&f&2&&(l=!0,c.dialog=a[1],Rn(()=>l=!1)),t.$set(c)},i(a){o||(z(t.$$.fragment,a),o=!0)},o(a){q(t.$$.fragment,a),o=!1},d(a){te(t,a)}}}function id(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 y=>{const C={file_name:y},S=await(await fetch(`/chat/${o}/save_to_csv`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)})).json();console.log("Download Complete: ",S),S.status==="200"?(console.log("success"),n(3,a=u.DOWNLOADED)):(console.log("failed"),n(3,a=u.FAILED_DOWNLOAD))},c=async y=>{y.preventDefault();const C=await fetch(`/file_exists/?file_name=${s}.csv`),{file_exists:E}=await C.json();E===!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(y){l=y,n(0,l)}function w(y){r=y,n(1,r)}return e.$$set=y=>{"showModal"in y&&n(0,l=y.showModal),"table"in y&&n(8,o=y.table)},[l,r,s,a,u,f,c,d,o,g,p,m,_,v,w]}class No extends fe{constructor(t){super(),ce(this,t,id,od,ue,{showModal:0,table:8})}}function ri(e){let t;return{c(){t=A("h5"),t.textContent="Response:",h(t,"class","bold")},m(n,l){O(n,t,l)},d(n){n&&P(t)}}}function si(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-1cug6ja"),Te(n,"vote-selected",e[0].vote_status==="up"),Te(n,"vote-not-selected",e[0].vote_status==="down"),h(o,"class","small-button thumbs-down svelte-1cug6ja"),Te(o,"vote-selected",e[0].vote_status==="down"),Te(o,"vote-not-selected",e[0].vote_status==="up"),h(t,"class","feedback-buttons svelte-1cug6ja")},m(u,a){O(u,t,a),b(t,n),b(t,l),b(t,o),r||(s=[B(n,"click",e[5]),B(o,"click",e[6])],r=!0)},p(u,a){a&1&&Te(n,"vote-selected",u[0].vote_status==="up"),a&1&&Te(n,"vote-not-selected",u[0].vote_status==="down"),a&1&&Te(o,"vote-selected",u[0].vote_status==="down"),a&1&&Te(o,"vote-not-selected",u[0].vote_status==="up")},d(u){u&&P(t),r=!1,he(s)}}}function rd(e){let t,n,l,o=e[0].answer+"",r,s,u=e[3]&&ri(),a=e[1]&&si(e);return{c(){t=A("div"),u&&u.c(),n=N(),l=A("p"),r=L(o),s=N(),a&&a.c(),h(t,"class","answer svelte-1cug6ja")},m(f,c){O(f,t,c),u&&u.m(t,null),b(t,n),b(t,l),b(l,r),b(t,s),a&&a.m(t,null)},p(f,[c]){f[3]?u||(u=ri(),u.c(),u.m(t,n)):u&&(u.d(1),u=null),c&1&&o!==(o=f[0].answer+"")&&J(r,o),f[1]?a?a.p(f,c):(a=si(f),a.c(),a.m(t,null)):a&&(a.d(1),a=null)},i:X,o:X,d(f){f&&P(t),u&&u.d(),a&&a.d()}}}function sd(e,t,n){let l;ae(e,je,g=>n(7,l=g));let{message:o={}}=t,{feedback:r=!1}=t,{index:s=0}=t,{title:u=!1}=t;async function a(g){const p=await fetch("/chat/rag_table/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)});if(p.ok)console.log("response",p),n(0,o.vote_status=g.vote_status,o);else{const m=await p.text();alert(m)}}function f(g,p,m){const _=l[m];_.vote=p;const v={id:m+1,vote_status:p};a(v)}console.log("Answer",o.vote_status);const c=g=>f(g,"up",s),d=g=>f(g,"down",s);return e.$$set=g=>{"message"in g&&n(0,o=g.message),"feedback"in g&&n(1,r=g.feedback),"index"in g&&n(2,s=g.index),"title"in g&&n(3,u=g.title)},[o,r,s,u,f,c,d]}class $a extends fe{constructor(t){super(),ce(this,t,sd,rd,ue,{message:0,feedback:1,index:2,title:3})}}function ai(e,t,n){const l=e.slice();return l[17]=t[n],l[19]=n,l}function ui(e,t){let n,l,o,r,s,u,a,f,c,d=t[17].question+"",g,p,m,_,v,w,y,C,E;return _=new $a({props:{feedback:t[0],message:t[17],index:t[19],title:!0}}),{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=L(d),p=N(),m=A("div"),le(_.$$.fragment),v=N(),h(o,"class","avatar"),h(a,"class","bold svelte-yzyd3k"),h(u,"class","question svelte-yzyd3k"),h(m,"class","answers svelte-yzyd3k"),h(s,"class","message-content svelte-yzyd3k"),h(l,"class","chat-message-center svelte-yzyd3k"),h(n,"class","chat-message svelte-yzyd3k"),this.first=n},m(S,F){O(S,n,F),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),ee(_,m,null),b(n,v),y=!0,C||(E=Lt(w=ud.call(null,n,t[19]===t[5].length-1)),C=!0)},p(S,F){t=S,(!y||F&32)&&d!==(d=t[17].question+"")&&J(g,d);const $={};F&1&&($.feedback=t[0]),F&32&&($.message=t[17]),F&32&&($.index=t[19]),_.$set($),w&&Ve(w.update)&&F&32&&w.update.call(null,t[19]===t[5].length-1)},i(S){y||(z(_.$$.fragment,S),y=!0)},o(S){q(_.$$.fragment,S),y=!1},d(S){S&&P(n),te(_),C=!1,E()}}}function ad(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m,_=[],v=new Map,w,y,C,E,S,F,$=(e[3]?e[4]:"Send")+"",R,k,M,I,D,V,T;function x(U){e[10](U)}let W={table:"qa_table"};e[1]!==void 0&&(W.showModal=e[1]),t=new No({props:W}),nt.push(()=>En(t,"showModal",x));let G=e[5];const K=U=>U[19];for(let U=0;U👍
+ 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 U=0;U<_.length;U+=1)_[U].c();w=N(),y=A("div"),C=A("form"),E=A("input"),S=N(),F=A("button"),R=L($),M=N(),I=A("p"),I.textContent="Note - may produce inaccurate information.",h(s,"class","underline bold svelte-yzyd3k"),h(a,"class","svelte-yzyd3k"),h(c,"class","svelte-yzyd3k"),h(r,"class","instructions svelte-yzyd3k"),h(m,"class","chat-log svelte-yzyd3k"),h(p,"class","chatbox svelte-yzyd3k"),h(E,"class","chat-input-textarea svelte-yzyd3k"),h(E,"placeholder","Type Question Here"),h(F,"class",k="btnyousend "+(e[2]===""?"":"active")+" svelte-yzyd3k"),h(F,"type","submit"),h(C,"class","chat-input-form svelte-yzyd3k"),h(I,"class","message svelte-yzyd3k"),h(y,"class","chat-input-holder svelte-yzyd3k"),h(g,"class","ranked-chat svelte-yzyd3k"),h(o,"class","ranked-feedback-container svelte-yzyd3k")},m(U,Y){ee(t,U,Y),O(U,l,Y),O(U,o,Y),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 Q=0;Q<_.length;Q+=1)_[Q]&&_[Q].m(m,null);b(g,w),b(g,y),b(y,C),b(C,E),Ke(E,e[2]),b(C,S),b(C,F),b(F,R),b(y,M),b(y,I),D=!0,V||(T=[B(c,"click",e[7]),B(E,"input",e[11]),B(C,"submit",e[6])],V=!0)},p(U,[Y]){const Q={};!n&&Y&2&&(n=!0,Q.showModal=U[1],Rn(()=>n=!1)),t.$set(Q),Y&33&&(G=U[5],_e(),_=vt(_,Y,K,1,U,G,v,m,Mo,ui,null,ai),ve()),Y&4&&E.value!==U[2]&&Ke(E,U[2]),(!D||Y&24)&&$!==($=(U[3]?U[4]:"Send")+"")&&J(R,$),(!D||Y&4&&k!==(k="btnyousend "+(U[2]===""?"":"active")+" svelte-yzyd3k"))&&h(F,"class",k)},i(U){if(!D){z(t.$$.fragment,U);for(let Y=0;Y{e.scrollIntoView({behavior:"smooth"})},0)}function fd(e,t,n){let l,o;ae(e,je,w=>n(5,o=w));let r=!1,{feedback:s=!1}=t,{is_retrieval:u=!1}=t,a="",f="",c=!1;dt(()=>{d()});async function d(){const E=(await(await fetch("/chat/qa_table/retrieve")).json()).rows.map(S=>({id:S[0],question:S[1],answer:S[2],vote_status:S[3]}));Fe(je,o=[...E],o)}const g=async w=>{w.preventDefault(),a=f,n(2,f=""),n(3,c=!0);let y={id:o.length+1,question:a,answer:"Loading...",vote_status:"na"};Fe(je,o=[...o,y],o);const C=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(C.ok){const E=await C.json();console.log("response data",E),y.answer=E.answer,je.update(S=>(S[S.length-1]=y,S))}else{const E=await C.text();alert(E)}n(3,c=!1)};let p=0;setInterval(()=>{n(9,p=(p+1)%4)},200);function m(){n(1,r=!0)}[...Array(10).keys()].map(w=>String.fromCharCode(65+w));function _(w){r=w,n(1,r)}function v(){f=this.value,n(2,f)}return e.$$set=w=>{"feedback"in w&&n(0,s=w.feedback),"is_retrieval"in w&&n(8,u=w.is_retrieval)},e.$$.update=()=>{e.$$.dirty&512&&n(4,l=".".repeat(p).padEnd(3))},[s,r,f,c,l,o,g,m,u,p,_,v]}class Po extends fe{constructor(t){super(),ce(this,t,fd,ad,ue,{feedback:0,is_retrieval:8})}}function fi(e,t,n){const l=e.slice();return l[14]=t[n],l[16]=n,l}function ci(e,t){let n,l,o,r,s,u,a,f,c,d=t[14].question+"",g,p,m,_,v,w,y,C=t[14].up_ranking_answer+"",E,S,F,$,R,k,M=t[14].low_ranking_answer+"",I,D,V,T,x;function W(...Y){return t[7](t[14],t[16],...Y)}function G(...Y){return t[8](t[14],t[16],...Y)}function K(...Y){return t[9](t[14],t[16],...Y)}function U(...Y){return t[10](t[14],t[16],...Y)}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=L(d),p=N(),m=A("div"),_=A("div"),v=A("h5"),v.textContent="Response 1:",w=N(),y=A("p"),E=L(C),S=N(),F=A("div"),$=A("h5"),$.textContent="Response 2:",R=N(),k=A("p"),I=L(M),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($,"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(Y,Q){O(Y,n,Q),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(_,w),b(_,y),b(y,E),b(m,S),b(m,F),b(F,$),b(F,R),b(F,k),b(k,I),b(n,D),T||(x=[B(_,"click",W),B(_,"keydown",G),B(F,"click",K),B(F,"keydown",U),Lt(V=dd.call(null,n,t[16]===t[3].length-1))],T=!0)},p(Y,Q){t=Y,Q&8&&d!==(d=t[14].question+"")&&J(g,d),Q&8&&C!==(C=t[14].up_ranking_answer+"")&&J(E,C),Q&8&&M!==(M=t[14].low_ranking_answer+"")&&J(I,M),V&&Ve(V.update)&&Q&8&&V.update.call(null,t[16]===t[3].length-1)},d(Y){Y&&P(n),T=!1,he(x)}}}function cd(e){let t,n,l,o,r,s,u=[],a=new Map,f,c,d,g,p,m,_=(e[1]?e[2]:"Send")+"",v,w,y,C,E,S,F=e[3];const $=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.
+ Download Data `,l=N(),o=A("div"),r=A("section"),s=A("div");for(let R=0;R{e.scrollIntoView({behavior:"smooth"})},0)}async function hd(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 gd(e,t,n){let l,o;ae(e,Nl,v=>n(3,o=v));let r="",s="",u=!1;dt(()=>{});const a=async v=>{v.preventDefault(),r=s,n(0,s=""),n(1,u=!0);let w={question:r,up_ranking_answer:"Loading...",low_ranking_answer:"Loading..."};Fe(Nl,o=[...o,w],o);const y=await fetch(`/chat/multi_responses/${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:r})});if(y.ok){const C=await y.json();w.up_ranking_answer=C.answer[0],w.low_ranking_answer=C.answer[1],Nl.update(E=>(E[E.length-1]=w,E))}else{const C=await y.text();alert(C)}n(1,u=!1)};let f=0;setInterval(()=>{n(6,f=(f+1)%4)},200);function c(v,w,y,C){const E=o[y],S={1:"up_ranking_answer",2:"low_ranking_answer"},F={question:E.question,up_ranking_answer:E[S[C]],low_ranking_answer:E[S[C%2+1]]};hd(F),Fn(v.currentTarget.parentNode).selectAll("div").style("outline","2px solid var(--red)").style("border","1px solid var(--red)"),Fn(v.currentTarget).style("outline","2px solid var(--green)").style("border","1px solid var(--green)")}const d=(v,w,y)=>c(y,v,w,1),g=(v,w,y)=>c(y,v,w,1),p=(v,w,y)=>c(y,v,w,2),m=(v,w,y)=>c(y,v,w,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 pd extends fe{constructor(t){super(),ce(this,t,gd,cd,ue,{})}}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 md(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 _d(e){const t=n=>{e&&!e.contains(n.target)&&!n.defaultPrevented&&e.dispatchEvent(new CustomEvent("click_outside",e))};return document.addEventListener("click",t,!0),{destroy(){document.removeEventListener("click",t,!0)}}}function di(e,t,n){const l=e.slice();return l[11]=t[n],l[13]=n,l}function vd(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 yd(e,t,n){let l;ae(e,gt,m=>n(1,l=m));let{documents:o=[]}=t,r=!1,s;function u(m){m.preventDefault(),n(2,r=!r)}function a(m,_){_.target.checked?l.add(m):l.delete(m),gt.set(new Set(l))}function f(m){m.preventDefault(),Fe(gt,l=new Set(o.map(_=>_.name)),l),gt.set(new Set(l))}function c(m){m.preventDefault(),Fe(gt,l=new Set,l),gt.set(new Set(l))}function d(m){m.preventDefault(),n(2,r=!1)}const g=(m,_)=>a(m.name,_);function p(m){nt[m?"unshift":"push"](()=>{s=m,n(3,s)})}return e.$$set=m=>{"documents"in m&&n(0,o=m.documents)},e.$$.update=()=>{e.$$.dirty&2&&console.log(l)},[o,l,r,s,u,a,f,c,d,g,p]}let kd=class extends fe{constructor(t){super(),ce(this,t,yd,wd,ue,{documents:0})}};function mt(e,{delay:t=0,duration:n=400,easing:l=Fo,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(w=>`${w[0].toUpperCase()}${w.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:w=>`overflow: hidden;opacity: ${Math.min(w*20,1)*s};${u}: ${w*a}px;padding-${f[0]}: ${w*d}px;padding-${f[1]}: ${w*g}px;margin-${f[0]}: ${w*p}px;margin-${f[1]}: ${w*m}px;border-${f[0]}-width: ${w*_}px;border-${f[1]}-width: ${w*v}px;`}}function Ln(e,{delay:t=0,duration:n=400,easing:l=Fo,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 Sd(e){let t;return{c(){t=A("p"),t.textContent="⌄",h(t,"class","svelte-1pk2e1k")},m(n,l){O(n,t,l)},d(n){n&&P(t)}}}function Cd(e){let t;return{c(){t=A("p"),t.textContent="⌃",h(t,"class","svelte-1pk2e1k")},m(n,l){O(n,t,l)},d(n){n&&P(t)}}}function pi(e){let t,n,l,o,r;return{c(){t=A("div"),n=A("p"),l=L(e[1]),h(n,"class","bold svelte-1pk2e1k"),h(t,"class","source_content svelte-1pk2e1k")},m(s,u){O(s,t,u),b(t,n),b(n,l),r=!0},p(s,u){(!r||u&2)&&J(l,s[1])},i(s){r||(Se(()=>{r&&(o||(o=Ge(t,mt,{},!0)),o.run(1))}),r=!0)},o(s){o||(o=Ge(t,mt,{},!1)),o.run(0),r=!1},d(s){s&&P(t),s&&o&&o.end()}}}function $d(e){let t,n,l,o=e[2]+1+"",r,s,u,a,f,c,d,g,p;function m(y,C){return y[3]?Cd:Sd}let _=m(e),v=_(e),w=e[3]&&pi(e);return{c(){t=A("div"),n=A("div"),l=A("p"),r=L(o),s=L(": "),u=L(e[0]),a=N(),v.c(),c=N(),w&&w.c(),h(l,"class","bold svelte-1pk2e1k"),h(n,"class","source_tab svelte-1pk2e1k"),h(t,"class","source svelte-1pk2e1k")},m(y,C){O(y,t,C),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),w&&w.m(t,null),d=!0,g||(p=B(n,"click",e[4]),g=!0)},p(y,[C]){(!d||C&4)&&o!==(o=y[2]+1+"")&&J(r,o),(!d||C&1)&&J(u,y[0]),_!==(_=m(y))&&(v.d(1),v=_(y),v&&(v.c(),v.m(n,null))),y[3]?w?(w.p(y,C),C&8&&z(w,1)):(w=pi(y),w.c(),z(w,1),w.m(t,null)):w&&(_e(),q(w,1,1,()=>{w=null}),ve())},i(y){d||(Se(()=>{d&&(f||(f=Ge(n,mt,{},!0)),f.run(1))}),z(w),d=!0)},o(y){f||(f=Ge(n,mt,{},!1)),f.run(0),q(w),d=!1},d(y){y&&P(t),v.d(),y&&f&&f.end(),w&&w.d(),g=!1,p()}}}function Ad(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 Rd extends fe{constructor(t){super(),ce(this,t,Ad,$d,ue,{source:0,source_content:1,i:2})}}function mi(e,t,n){const l=e.slice();return l[4]=t[n],l[6]=n,l}function _i(e){let t,n,l,o;const r=[Dd,Fd,Md,Ed],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=ke()},m(a,f){s[t].m(a,f),O(a,l,f),o=!0},p(a,f){let c=t;t=u(a),t===c?s[t].p(a,f):(_e(),q(s[c],1,1,()=>{s[c]=null}),ve(),n=s[t],n?n.p(a,f):(n=s[t]=r[t](a),n.c()),z(n,1),n.m(l.parentNode,l))},i(a){o||(z(n),o=!0)},o(a){q(n),o=!1},d(a){s[t].d(a),a&&P(l)}}}function Ed(e){let t,n,l,o=e[0].length+"",r,s,u,a,f,c,d,g;function p(w,y){return w[2]?Nd:Id}let m=p(e),_=m(e),v=e[2]&&vi(e);return{c(){t=A("div"),n=A("h5"),l=L("📖 Response Sources ("),r=L(o),s=L(")"),u=N(),_.c(),a=N(),v&&v.c(),f=ke(),h(n,"class","bold"),h(t,"class","sources-header svelte-1r759df")},m(w,y){O(w,t,y),b(t,n),b(n,l),b(n,r),b(n,s),b(t,u),_.m(t,null),O(w,a,y),v&&v.m(w,y),O(w,f,y),c=!0,d||(g=B(t,"click",e[3]),d=!0)},p(w,y){(!c||y&1)&&o!==(o=w[0].length+"")&&J(r,o),m!==(m=p(w))&&(_.d(1),_=m(w),_&&(_.c(),_.m(t,null))),w[2]?v?(v.p(w,y),y&4&&z(v,1)):(v=vi(w),v.c(),z(v,1),v.m(f.parentNode,f)):v&&(_e(),q(v,1,1,()=>{v=null}),ve())},i(w){c||(z(v),c=!0)},o(w){q(v),c=!1},d(w){w&&P(t),_.d(),w&&P(a),v&&v.d(w),w&&P(f),d=!1,g()}}}function Md(e){let t;return{c(){t=A("h5"),t.textContent="⚠️ No sources loaded",h(t,"class","bold")},m(n,l){O(n,t,l)},p:X,i:X,o:X,d(n){n&&P(t)}}}function Fd(e){let t;return{c(){t=A("h5"),t.textContent="📖 Loading...",h(t,"class","bold")},m(n,l){O(n,t,l)},p:X,i:X,o:X,d(n){n&&P(t)}}}function Dd(e){let t;return{c(){t=A("h5"),t.textContent="⚠️ No Retrieval Sources selected or received",h(t,"class","bold")},m(n,l){O(n,t,l)},p:X,i:X,o:X,d(n){n&&P(t)}}}function Id(e){let t;return{c(){t=A("span"),t.textContent="⌄"},m(n,l){O(n,t,l)},d(n){n&&P(t)}}}function Nd(e){let t;return{c(){t=A("span"),t.textContent="⌃"},m(n,l){O(n,t,l)},d(n){n&&P(t)}}}function vi(e){let t,n,l=e[0],o=[];for(let s=0;sq(o[s],1,1,()=>{o[s]=null});return{c(){for(let s=0;s{l=null}),ve())},i(o){n||(z(l),n=!0)},o(o){q(l),n=!1},d(o){o&&P(t),l&&l.d()}}}function Od(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 Td extends fe{constructor(t){super(),ce(this,t,Od,Pd,ue,{sources:0,source_content:1})}}function wi(e,t,n){const l=e.slice();return l[4]=t[n],l}function yi(e,t,n){const l=e.slice();return l[4]=t[n],l}function ki(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=L(o),s=N(),h(l,"class","bold"),h(n,"class","svelte-iwm583"),h(t,"class",u=lt(e[0]===e[4].value?"active":"")+" svelte-iwm583")},m(c,d){O(c,t,d),b(t,n),b(n,l),b(l,r),b(t,s),a||(f=B(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+"")&&J(r,o),d&3&&u!==(u=lt(e[0]===e[4].value?"active":"")+" svelte-iwm583")&&h(t,"class",u)},d(c){c&&P(t),a=!1,f()}}}function Si(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)}),ve()}s?(n=Mt(s,u()),le(n.$$.fragment),z(n.$$.fragment,1),ee(n,t,l)):n=null}else s&&n.$set(c)},i(a){o||(n&&z(n.$$.fragment,a),o=!0)},o(a){n&&q(n.$$.fragment,a),o=!1},d(a){a&&P(t),n&&te(n)}}}function Ci(e){let t,n,l=e[0]==e[4].value&&Si(e);return{c(){l&&l.c(),t=ke()},m(o,r){l&&l.m(o,r),O(o,t,r),n=!0},p(o,r){o[0]==o[4].value?l?(l.p(o,r),r&3&&z(l,1)):(l=Si(o),l.c(),z(l,1),l.m(t.parentNode,t)):l&&(_e(),q(l,1,1,()=>{l=null}),ve())},i(o){n||(z(l),n=!0)},o(o){q(l),n=!1},d(o){l&&l.d(o),o&&P(t)}}}function zd(e){let t,n,l,o,r=e[1],s=[];for(let c=0;cq(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 qd extends fe{constructor(t){super(),ce(this,t,Vd,zd,ue,{items:1,activeTabValue:0,tabProps:2})}}function $i(e){let t;return{c(){t=L("Press ENTER to autofill with the RAG answer.")},m(n,l){O(n,t,l)},d(n){n&&P(t)}}}function Ld(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m=e[0].edited_answer===al&&$i();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){O(_,t,v),b(t,n),Ke(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=[B(n,"input",e[5]),B(n,"keydown",e[4]),B(f,"click",e[2]),B(d,"click",e[3])],g=!0)},p(_,[v]){v&1&&l!==(l=_[0].answer)&&h(n,"placeholder",l),v&1&&Ke(n,_[0].edited_answer),_[0].edited_answer===al?m||(m=$i(),m.c(),m.m(s,null)):m&&(m.d(1),m=null)},i:X,o:X,d(_){_&&P(t),e[6](null),m&&m.d(),g=!1,he(p)}}}const al="";function Hd(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(al)},a=d=>{d.key=="Enter"&&l.edited_answer===al&&(d.preventDefault(),console.log("ENTER"),n(0,l.edited_answer=l.answer,l))};dt(function(){o.focus()});function f(){l.edited_answer=this.value,n(0,l)}function c(d){nt[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 Gd extends fe{constructor(t){super(),ce(this,t,Hd,Ld,ue,{message:0})}}function Ai(e,t,n){const l=e.slice();return l[20]=t[n],l[22]=n,l}function Ri(e){let t,n,l,o,r,s,u,a;return{c(){t=A("div"),n=A("h5"),n.textContent="Vote Feedback Instructions",l=N(),o=A("p"),o.innerHTML=`Ask a question to receive an answer from the chatbot. If the response is
+ satisfactory, click on the 👍
+ button. If the response is not satisfactory, click on the
+ 👎 button.`,r=N(),s=A("button"),s.textContent="Download Data",h(n,"class","underline bold svelte-vgv4ev"),h(o,"class","svelte-vgv4ev"),h(s,"class","svelte-vgv4ev"),h(t,"class","instructions svelte-vgv4ev")},m(f,c){O(f,t,c),b(t,n),b(t,l),b(t,o),b(t,r),b(t,s),u||(a=B(s,"click",e[10]),u=!0)},p:X,d(f){f&&P(t),u=!1,a()}}}function Ei(e,t){let n,l,o,r,s,u,a,f,c,d=t[20].question+"",g,p,m,_,v,w,y,C,E,S,F,$,R,k,M,I;return E=new qd({props:{items:t[8],tabProps:{message:t[20],feedback:t[0],index:t[22]}}}),F=new Td({props:{sources:t[20].source,source_content:t[20].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=L(d),p=N(),m=A("div"),_=A("p"),_.textContent="ℹ️ Retrieval Sources",w=N(),y=A("div"),C=A("div"),le(E.$$.fragment),S=N(),le(F.$$.fragment),$=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(C,"class","answer svelte-vgv4ev"),h(y,"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,V){O(D,n,V),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,w),b(s,y),b(y,C),ee(E,C,null),b(s,S),ee(F,s,null),b(n,$),k=!0,M||(I=[Lt(v=Ra.call(null,_,Mi(t[20]))),Lt(R=Bd.call(null,n,t[22]===t[5].length-1))],M=!0)},p(D,V){t=D,(!k||V&32)&&d!==(d=t[20].question+"")&&J(g,d),v&&Ve(v.update)&&V&32&&v.update.call(null,Mi(t[20]));const T={};V&33&&(T.tabProps={message:t[20],feedback:t[0],index:t[22]}),E.$set(T);const x={};V&32&&(x.sources=t[20].source),V&32&&(x.source_content=t[20].source_content),F.$set(x),R&&Ve(R.update)&&V&32&&R.update.call(null,t[22]===t[5].length-1)},i(D){k||(z(E.$$.fragment,D),z(F.$$.fragment,D),k=!0)},o(D){q(E.$$.fragment,D),q(F.$$.fragment,D),k=!1},d(D){D&&P(n),te(E),te(F),M=!1,he(I)}}}function jd(e){let t,n,l,o,r,s,u,a,f=[],c=new Map,d,g,p,m,_,v,w,y,C,E=(e[2]?e[4]:"Send")+"",S,F,$,R,k,M,I;function D(G){e[13](G)}let V={table:"rag_table"};e[3]!==void 0&&(V.showModal=e[3]),t=new No({props:V}),nt.push(()=>En(t,"showModal",D));let T=e[0]&&Ri(e),x=e[5];const W=G=>G[22];for(let G=0;Gn=!1)),t.$set(U),G[0]?T?T.p(G,K):(T=Ri(G),T.c(),T.m(o,r)):T&&(T.d(1),T=null),K&289&&(x=G[5],_e(),f=vt(f,K,W,1,G,x,c,a,Mo,Ei,null,Ai),ve());const Y={};K&64&&(Y.documents=G[6]),m.$set(Y),K&2&&w.value!==G[1]&&Ke(w,G[1]),(!k||K&20)&&E!==(E=(G[2]?G[4]:"Send")+"")&&J(S,E),(!k||K&2&&F!==(F="btnyousend "+(G[1]===""?"":"active")+" svelte-vgv4ev"))&&h(C,"class",F),K&1&&ye(s,"grid-column",G[0]?"span 1":"span 2")},i(G){if(!k){z(t.$$.fragment,G);for(let K=0;K{e.scrollIntoView({behavior:"smooth"})},0)}function Mi(e){return e.rag_sources.length===0?"No Sources":e.rag_sources.join(", ")}function xd(e,t,n){let l,o,r,s;ae(e,je,$=>n(5,o=$)),ae(e,gt,$=>n(16,r=$));let{feedback:u=!1}=t,{is_retrieval:a=!1}=t;const f=Ie([]);ae(e,f,$=>n(6,s=$));let c="",d="",g=!1,p=!1,m=[{label:"Answer",value:1,component:$a},{label:"Modified Answer",value:2,component:Gd}];async function _(){await v(),Fe(gt,r=new Set(s.map($=>$.name)),r),gt.set(new Set(r))}dt(()=>{w(),_()});async function v(){const R=await(await fetch("/retrieval/file/get")).json();console.log("data",R.files);const M=R.files.map((I,D)=>({id:String(D),name:I.name}));console.log("files",M),Fe(f,s=[...M],s)}async function w(){const k=(await(await fetch("/chat/rag_table/retrieve")).json()).rows;console.log("Got data from db",k);const M=k.map(I=>({id:I[0],question:I[1],answer:I[2],edited_answer:I[3],vote_status:I[4],rag_sources:I[5],source:I[6],source_content:I[7]}));Fe(je,o=[...M],o)}const y=async $=>{$.preventDefault(),c=d,n(1,d=""),n(2,g=!0);const R=[...r];let k={id:o.length+1,question:c,answer:"Loading...",rag_sources:R,vote_status:"na",source:["Loading..."],source_content:["Loading..."]};Fe(je,o=[...o,k],o);const M=a?await fetch("/retrieval/new_message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:c,file_names:R})}):await fetch(`/chat/${c}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:c})});if(M.ok){const I=await M.json();console.log("response data",I),k.answer=I.answer,k.source=I.source,k.source_content=I.source_content,je.update(D=>(D[D.length-1]=k,D))}else{const I=await M.text();alert(I)}n(2,g=!1)};let C=0;setInterval(()=>{n(12,C=(C+1)%4)},200);function E(){n(3,p=!0)}function S($){p=$,n(3,p)}function F(){d=this.value,n(1,d)}return e.$$set=$=>{"feedback"in $&&n(0,u=$.feedback),"is_retrieval"in $&&n(11,a=$.is_retrieval)},e.$$.update=()=>{e.$$.dirty&4096&&n(4,l=".".repeat(C).padEnd(3))},[u,d,g,p,l,o,s,f,m,y,E,a,C,S,F]}class Wd extends fe{constructor(t){super(),ce(this,t,xd,jd,ue,{feedback:0,is_retrieval:11})}}function Fi(e){let t,n;return t=new Po({props:{is_retrieval:e[1]}}),{c(){le(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||(z(t.$$.fragment,l),n=!0)},o(l){q(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function Di(e){let t,n;return t=new Po({props:{feedback:!0,is_retrieval:e[1]}}),{c(){le(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||(z(t.$$.fragment,l),n=!0)},o(l){q(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function Ii(e){let t,n;return t=new Wd({props:{feedback:!1,is_retrieval:e[1]}}),{c(){le(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||(z(t.$$.fragment,l),n=!0)},o(l){q(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function Ni(e){let t,n,l,o;const r=[Xd,Ud],s=[];function u(a,f){return a[1]?0:1}return t=u(e),n=s[t]=r[t](e),{c(){n.c(),l=ke()},m(a,f){s[t].m(a,f),O(a,l,f),o=!0},p(a,f){let c=t;t=u(a),t===c?s[t].p(a,f):(_e(),q(s[c],1,1,()=>{s[c]=null}),ve(),n=s[t],n?n.p(a,f):(n=s[t]=r[t](a),n.c()),z(n,1),n.m(l.parentNode,l))},i(a){o||(z(n),o=!0)},o(a){q(n),o=!1},d(a){s[t].d(a),a&&P(l)}}}function Ud(e){let t,n;return t=new pd({}),{c(){le(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},p:X,i(l){n||(z(t.$$.fragment,l),n=!0)},o(l){q(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function Xd(e){let t,n;return t=new Po({props:{feedback:!0,is_retrieval:e[1]}}),{c(){le(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||(z(t.$$.fragment,l),n=!0)},o(l){q(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function Yd(e){let t,n,l,o,r,s=!e[0]&&Fi(e),u=e[0]==="vote"&&Di(e),a=e[0]==="rag"&&Ii(e),f=e[0]==="rank"&&Ni(e);return{c(){s&&s.c(),t=N(),u&&u.c(),n=N(),a&&a.c(),l=N(),f&&f.c(),o=ke()},m(c,d){s&&s.m(c,d),O(c,t,d),u&&u.m(c,d),O(c,n,d),a&&a.m(c,d),O(c,l,d),f&&f.m(c,d),O(c,o,d),r=!0},p(c,[d]){c[0]?s&&(_e(),q(s,1,1,()=>{s=null}),ve()):s?(s.p(c,d),d&1&&z(s,1)):(s=Fi(c),s.c(),z(s,1),s.m(t.parentNode,t)),c[0]==="vote"?u?(u.p(c,d),d&1&&z(u,1)):(u=Di(c),u.c(),z(u,1),u.m(n.parentNode,n)):u&&(_e(),q(u,1,1,()=>{u=null}),ve()),c[0]==="rag"?a?(a.p(c,d),d&1&&z(a,1)):(a=Ii(c),a.c(),z(a,1),a.m(l.parentNode,l)):a&&(_e(),q(a,1,1,()=>{a=null}),ve()),c[0]==="rank"?f?(f.p(c,d),d&1&&z(f,1)):(f=Ni(c),f.c(),z(f,1),f.m(o.parentNode,o)):f&&(_e(),q(f,1,1,()=>{f=null}),ve())},i(c){r||(z(s),z(u),z(a),z(f),r=!0)},o(c){q(s),q(u),q(a),q(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 Qd(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 Kd extends fe{constructor(t){super(),ce(this,t,Qd,Yd,ue,{feedback:0,is_retrieval:1})}}function Pi(e,t,n){const l=e.slice();return l[2]=t[n],l}function Oi(e){let t,n=e[2]+"",l,o;return{c(){t=A("option"),l=L(n),t.__value=o=e[2],t.value=t.__value},m(r,s){O(r,t,s),b(t,l)},p(r,s){s&1&&n!==(n=r[2]+"")&&J(l,n),s&1&&o!==(o=r[2])&&(t.__value=o,t.value=t.__value)},d(r){r&&P(t)}}}function Jd(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 eh extends fe{constructor(t){super(),ce(this,t,Zd,Jd,ue,{data_endpoint:1})}}function Jt(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function th(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Ea(e){let t,n,l;e.length!==2?(t=Jt,n=(u,a)=>Jt(e(u),a),l=(u,a)=>e(u)-a):(t=e===Jt||e===th?e:nh,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 nh(){return 0}function lh(e){return e===null?NaN:+e}function*oh(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 ih=Ea(Jt),rh=ih.right;Ea(lh).center;const Ma=rh;function sh(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 ah(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 uh(e,t){const n=ah(e,t);return n&&Math.sqrt(n)}function wn(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 ph=Array.prototype,mh=ph.slice;function Ol(e){return()=>e}const _h=Math.sqrt(50),vh=Math.sqrt(10),bh=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>=_h?10:r>=vh?5:r>=bh?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 kh(e){return Math.max(1,Math.ceil(Math.log(sh(e))/Math.LN2)+1)}function Ia(){var e=hh,t=wn,n=kh;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(C>=g&&t===wn){const S=ln(d,g,E);isFinite(S)&&(S>0?g=(Math.floor(g/S)+1)*S:S<0&&(g=(Math.ceil(g*-S)+1)/-S))}else p.pop()}for(var m=p.length,_=0,v=m;p[_]<=d;)++_;for(;p[v-1]>g;)--v;(_||v0?p[r-1]:d,y.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:gh(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));Na(e,t,p,m,o)}const r=e[t];let s=n,u=l;for(dn(e,n,t),o(e[l],r)>0&&dn(e,n,l);s0;)--u}o(e[n],r)===0?dn(e,n,u):(++u,dn(e,u,l)),u<=t&&(n=u+1),t<=u&&(l=u-1)}return e}function dn(e,t,n){const l=e[t];e[t]=e[n],e[n]=l}function Sh(e,t,n){if(e=Float64Array.from(oh(e,n)),!(!(l=e.length)||isNaN(t=+t))){if(t<=0||l<2)return so(e);if(t>=1)return bt(e);var l,o=(l-1)*t,r=Math.floor(o),s=bt(Na(e,r).subarray(0,r+1)),u=so(e.subarray(r+1));return s+(u-s)*(o-r)}}function Ch(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 $h(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 on(e){return e=fl(Math.abs(e)),e?e[1]:NaN}function Rh(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 Mh=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function cl(e){if(!(t=Mh.exec(e)))throw new Error("invalid format: "+e);var t;return new Oo({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=Oo.prototype;function Oo(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+""}Oo.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 Fh(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 Dh(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 qi={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Ah,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:Dh,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Li(e){return e}var Hi=Array.prototype.map,Gi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ih(e){var t=e.grouping===void 0||e.thousands===void 0?Li:Rh(Hi.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(Hi.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 g=d.fill,p=d.align,m=d.sign,_=d.symbol,v=d.zero,w=d.width,y=d.comma,C=d.precision,E=d.trim,S=d.type;S==="n"?(y=!0,S="g"):qi[S]||(C===void 0&&(C=12),E=!0,S="g"),(v||g==="0"&&p==="=")&&(v=!0,g="0",p="=");var F=_==="$"?n:_==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",$=_==="$"?l:/[%p]/.test(S)?s:"",R=qi[S],k=/[defgprs%]/.test(S);C=C===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function M(I){var D=F,V=$,T,x,W;if(S==="c")V=R(I)+V,I="";else{I=+I;var G=I<0||1/I<0;if(I=isNaN(I)?a:R(Math.abs(I),C),E&&(I=Fh(I)),G&&+I==0&&m!=="+"&&(G=!1),D=(G?m==="("?m:u:m==="-"||m==="("?"":m)+D,V=(S==="s"?Gi[8+Pa/3]:"")+V+(G&&m==="("?")":""),k){for(T=-1,x=I.length;++TW||W>57){V=(W===46?o+I.slice(T+1):I.slice(T))+V,I=I.slice(0,T);break}}}y&&!v&&(I=t(I,1/0));var K=D.length+I.length+V.length,U=K>1)+D+I+V+U.slice(K);break;default:I=U+D+I+V;break}return r(I)}return M.toString=function(){return d+""},M}function c(d,g){var p=f((d=cl(d),d.type="f",d)),m=Math.max(-8,Math.min(8,Math.floor(on(g)/3)))*3,_=Math.pow(10,-m),v=Gi[8+m/3];return function(w){return p(_*w)+v}}return{format:f,formatPrefix:c}}var Hn,yt,Oa;Nh({thousands:",",grouping:[3],currency:["$",""]});function Nh(e){return Hn=Ih(e),yt=Hn.format,Oa=Hn.formatPrefix,Hn}function Ph(e){return Math.max(0,-on(Math.abs(e)))}function Oh(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(on(t)/3)))*3-on(Math.abs(e)))}function Th(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,on(t)-on(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 ji=Symbol("implicit");function Dt(){var e=new Ti,t=[],n=[],l=ji;function o(r){let s=e.get(r);if(s===void 0){if(l!==ji)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 Dt(t,n).unknown(l)},To.apply(o,arguments),o}function Ht(){var e=Dt().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?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 Be(t[1],t[2],t[3],1):(t=Lh.exec(e))?new Be(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Hh.exec(e))?Gn(t[1],t[2],t[3],t[4]):(t=Gh.exec(e))?Gn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=jh.exec(e))?Ki(t[1],t[2]/100,t[3]/100,1):(t=Bh.exec(e))?Ki(t[1],t[2]/100,t[3]/100,t[4]):xi.hasOwnProperty(e)?Xi(xi[e]):e==="transparent"?new Be(NaN,NaN,NaN,0):null}function Xi(e){return new Be(e>>16&255,e>>8&255,e&255,1)}function Gn(e,t,n,l){return l<=0&&(e=t=n=NaN),new Be(e,t,n,l)}function Uh(e){return e instanceof On||(e=Nn(e)),e?(e=e.rgb(),new Be(e.r,e.g,e.b,e.opacity)):new Be}function ao(e,t,n,l){return arguments.length===1?Uh(e):new Be(e,t,n,l??1)}function Be(e,t,n,l){this.r=+e,this.g=+t,this.b=+n,this.opacity=+l}zo(Be,ao,za(On,{brighter(e){return e=e==null?dl:Math.pow(dl,e),new Be(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Dn:Math.pow(Dn,e),new Be(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Be(qt(this.r),qt(this.g),qt(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:Yi,formatHex:Yi,formatHex8:Xh,formatRgb:Qi,toString:Qi}));function Yi(){return`#${zt(this.r)}${zt(this.g)}${zt(this.b)}`}function Xh(){return`#${zt(this.r)}${zt(this.g)}${zt(this.b)}${zt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Qi(){const e=hl(this.opacity);return`${e===1?"rgb(":"rgba("}${qt(this.r)}, ${qt(this.g)}, ${qt(this.b)}${e===1?")":`, ${e})`}`}function hl(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function qt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function zt(e){return e=qt(e),(e<16?"0":"")+e.toString(16)}function Ki(e,t,n,l){return l<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new et(e,t,n,l)}function Va(e){if(e instanceof et)return new et(e.h,e.s,e.l,e.opacity);if(e instanceof On||(e=Nn(e)),!e)return new et;if(e instanceof et)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 et(s,u,a,e.opacity)}function Yh(e,t,n,l){return arguments.length===1?Va(e):new et(e,t,n,l??1)}function et(e,t,n,l){this.h=+e,this.s=+t,this.l=+n,this.opacity=+l}zo(et,Yh,za(On,{brighter(e){return e=e==null?dl:Math.pow(dl,e),new et(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Dn:Math.pow(Dn,e),new et(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 Be(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 et(Ji(this.h),jn(this.s),jn(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("}${Ji(this.h)}, ${jn(this.s)*100}%, ${jn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ji(e){return e=(e||0)%360,e<0?e+360:e}function jn(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 Qh(e,t){return function(n){return e+n*t}}function Kh(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 Jh(e){return(e=+e)==1?qa:function(t,n){return n-t?Kh(t,n,e):Vo(isNaN(t)?n:t)}}function qa(e,t){var n=t-e;return n?Qh(e,n):Vo(isNaN(e)?t:e)}const uo=function e(t){var n=Jh(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=qa(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 Zh(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=zl.lastIndex;return nt&&(n=e,e=t,t=n),function(l){return Math.max(e,Math.min(t,l))}}function fg(e,t,n){var l=e[0],o=e[1],r=t[0],s=t[1];return o2?cg:fg,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),gl)))(g)))},d.domain=function(g){return arguments.length?(e=Array.from(g,ag),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=La,c()},d.clamp=function(g){return arguments.length?(s=g?!0:$t,c()):s!==$t},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 gg(){return hg()($t,$t)}function pg(e,t,n,l){var o=wh(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),Oa(l,s)}case"":case"e":case"g":case"p":case"r":{l.precision==null&&!isNaN(r=Th(o,Math.max(Math.abs(e),Math.abs(t))))&&(l.precision=r-(l.type==="e"));break}case"f":case"%":{l.precision==null&&!isNaN(r=Ph(o))&&(l.precision=r-(l.type==="%")*2);break}}return yt(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 pg(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=ln(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 Ye(){var e=gg();return e.copy=function(){return dg(e,Ye())},To.apply(e,arguments),Ha(e)}function mg(){var e=0,t=1,n,l,o,r,s=$t,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(Tn),f.rangeRound=c(La),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 _g(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Ga(){var e=Ha(mg()($t));return e.copy=function(){return _g(e,Ga())},zh.apply(e,arguments)}function it(e){return function(){return e}}const ho=Math.PI,go=2*ho,Ot=1e-6,vg=go-Ot;function ja(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return ja;const n=10**t;return function(l){this._+=l[0];for(let o=1,r=l.length;oOt)if(!(Math.abs(d*a-f*c)>Ot)||!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,w=Math.sqrt(_),y=Math.sqrt(g),C=r*Math.tan((ho-Math.acos((_+g-v)/(2*w*y)))/2),E=C/y,S=C/w;Math.abs(E-1)>Ot&&this._append`L${t+E*c},${n+E*d}`,this._append`A${r},${r},0,0,${+(d*p>c*m)},${this._x1=t+S*a},${this._y1=n+S*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)>Ot||Math.abs(this._y1-c)>Ot)&&this._append`L${f},${c}`,l&&(g<0&&(g=g%go+go),g>vg?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>Ot&&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 yg(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 wg(t)}function Ba(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 kg(e){return new xa(e)}function Sg(e){return e[0]}function Cg(e){return e[1]}function $g(e,t){var n=it(!0),l=null,o=kg,r=null,s=yg(u);e=typeof e=="function"?e:e===void 0?Sg:it(e),t=typeof t=="function"?t:t===void 0?Cg:it(t);function u(a){var f,c=(a=Ba(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 Ag(e,t){return e[t]}function Rg(e){const t=[];return t.key=e,t}function Eg(){var e=it([]),t=mo,n=po,l=Ag;function o(r){var s=Array.from(e.apply(this,arguments),Rg),u,a=s.length,f=-1,c;for(const d of r)for(u=0,++f;uFeedback Distribution",n=N(),l=A("div"),o=j("svg");for(let a=0;ae[19].call(l))},m(a,f){O(a,t,f),O(a,n,f),O(a,l,f),b(l,o);for(let c=0;cn(15,d=R)),ae(e,Zo,R=>n(4,g=R)),ae(e,je,R=>n(16,p=R));let m=300,_=300;const v={up:2,down:1,"n/a":0,all:"all"},w={top:10,bottom:10,left:25,right:5},y=Dt().range(["var(--yellow)","var(--red)","var(--green)"]),C=yt(".0%");function E(R,k){l===R?n(5,l="all"):n(5,l=R),Fe(ut,d=l==="all"?"all":k,d)}const S=(R,k)=>E(R,k.key),F=(R,k)=>E(R,k.key);function $(){_=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=_-w.left-w.right),e.$$.dirty&1&&n(14,r=m-w.top-w.bottom),e.$$.dirty&65552&&p.forEach(R=>{Fe(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=Ht().rangeRound([w.top,r-w.bottom]).padding(0).domain(["a"])),e.$$.dirty&12&&n(7,a=Ye().rangeRound([w.left,o-w.right]).domain([0,s])),e.$$.dirty&8208&&n(6,c=f([g]))},n(13,f=Eg().keys(["n/a","down","up"]).order(mo).offset(po)),[m,_,s,o,g,l,c,a,u,w,y,C,E,f,r,d,p,S,F,$]}class Wa extends fe{constructor(t){super(),ce(this,t,Fg,Mg,ue,{})}}function Dg(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=L("Q: "),o=L(e[0]),r=N(),s=A("div"),u=L("A: "),a=L(e[1]),f=N(),c=A("div"),d=L("Rating: "),p=L(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){O(_,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&&J(o,_[0]),v&2&&J(a,_[1]),v&4&&g!==(g=_[3][_[2]]+"")&&J(p,g),v&4&&m!==(m="feedback "+_[2]+" svelte-szi0e")&&h(c,"class",m)},i:X,o:X,d(_){_&&P(t)}}}function Ig(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 Ng extends fe{constructor(t){super(),ce(this,t,Ig,Dg,ue,{question:0,answer:1,feedback:2})}}function or(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 ir(e){let t,n,l,o,r;return n=new Ng({props:{question:e[5],answer:e[6],feedback:e[7]}}),{c(){t=A("div"),le(n.$$.fragment),l=N()},m(s,u){O(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||(z(n.$$.fragment,s),s&&Se(()=>{r&&(o||(o=Ge(t,e[1],{duration:300},!0)),o.run(1))}),r=!0)},o(s){q(n.$$.fragment,s),s&&(o||(o=Ge(t,e[1],{duration:300},!1)),o.run(0)),r=!1},d(s){s&&P(t),te(n),s&&o&&o.end()}}}function Pg(e){let t,n,l=e[0],o=[];for(let s=0;sq(o[s],1,1,()=>{o[s]=null});return{c(){t=A("div");for(let s=0;sn(4,o=a)),ae(e,ut,a=>n(2,r=a)),ae(e,Mn,a=>n(3,s=a));const u=(a,{delay:f=0,duration:c=1e3,easing:d=Fo})=>mt(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&&Fe(oo,o=md(l),o)},[l,u,r,s]}class Ua extends fe{constructor(t){super(),ce(this,t,Og,Pg,ue,{})}}function rr(e,t,n){const l=e.slice();return l[13]=t[n],l}function sr(e,t,n){const l=e.slice();return l[16]=t[n],l}function ar(e,t,n){const l=e.slice();return l[16]=t[n],l}function ur(e){let t,n,l,o,r=e[16]+"",s,u;return{c(){t=j("g"),n=j("line"),o=j("text"),s=L(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){O(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]+"")&&J(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 fr(e){let t,n,l,o;return{c(){t=j("g"),n=j("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){O(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 cr(e){let t,n,l,o,r,s,u,a,f=Math.round(e[11](e[13].count))+"",c,d,g;return{c(){t=j("g"),n=j("rect"),a=j("text"),c=L(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){O(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))+"")&&J(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 Tg(e){let t,n,l,o,r,s,u=e[8][e[7]]+"",a,f,c,d,g,p,m,_,v,w=e[4].map(dr),y=[];for(let $=0;$e[12].call(t))},m($,R){O($,t,R),b(t,n);for(let k=0;ke.question;function zg(e,t,n){let l,o,r,s,u,a;ae(e,oo,v=>n(4,u=v)),ae(e,ut,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=yt(".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=Ht().rangeRound([p.left,l-p.right]).padding(.05).domain(u.map(v=>v.question))),e.$$.dirty&20&&n(5,s=Ye().rangeRound([o-p.bottom,p.top]).domain([0,bt(u,v=>v.count)])),e.$$.dirty&16&&console.log(u)},[d,g,o,l,u,s,r,a,f,c,p,m,_]}class Xa extends fe{constructor(t){super(),ce(this,t,zg,Tg,ue,{})}}function hr(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 gr(e,t,n){const l=e.slice();return l[23]=t[n],l}function pr(e){let t,n,l,o,r=e[23]+"",s,u;return{c(){t=j("g"),n=j("line"),o=j("text"),s=L(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){O(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]+"")&&J(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 mr(e){let t,n,l,o,r,s,u;return{c(){t=j("g"),n=j("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){O(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 Vg(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,w){O(v,t,w),b(t,n);for(let y=0;yn(5,d=C)),ae(e,je,C=>n(13,g=C));const p={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"#bfbfbf"};let m=300,_=300,v={top:15,bottom:10,left:25,right:5};yt(".1f");let w=Array.from({length:_r},(C,E)=>E);function y(){_=this.offsetWidth,m=this.offsetHeight,n(1,_),n(0,m)}return e.$$.update=()=>{e.$$.dirty&8224&&n(12,l=d==="all"?g:g.filter(C=>C.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(w).value(C=>C.answer)(o)),e.$$.dirty&16&&n(7,a=Ye().domain([3,_r]).range([v.left,r-v.right])),e.$$.dirty&12&&n(6,f=Ye().domain([0,bt(u,C=>C.length)]).range([s-v.bottom,v.top])),e.$$.dirty&2048&&n(10,c=bt(o,C=>C.length)),e.$$.dirty&1056&&Ye().domain([0,c]).range(["white",p[d]]).interpolate(Tn)},[m,_,s,u,r,d,f,a,p,v,c,o,l,g,y]}class Ya extends fe{constructor(t){super(),ce(this,t,qg,Vg,ue,{})}}function vr(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 br(e,t,n){const l=e.slice();return l[22]=t[n],l}function wr(e){let t,n,l,o,r=e[22]+"",s,u;return{c(){t=j("g"),n=j("line"),o=j("text"),s=L(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){O(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]+"")&&J(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 yr(e){let t,n,l,o,r,s,u;return{c(){t=j("g"),n=j("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){O(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 Lg(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,w){O(v,t,w),b(t,n);for(let y=0;yn(5,c=y)),ae(e,je,y=>n(12,d=y));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:kr},(y,C)=>C);Dt().range(["var(--yellow)","var(--red)","var(--green)"]);function w(){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(y=>y.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=p-_.top-_.bottom),e.$$.dirty&1024&&n(3,u=Ia().thresholds(v).value(y=>y.question)(o)),e.$$.dirty&16&&n(7,a=Ye().domain([3,kr]).range([_.left,r-_.right])),e.$$.dirty&12&&n(6,f=Ye().domain([0,bt(u,y=>y.length)]).range([s-_.bottom,_.top])),e.$$.dirty&1024&&bt(o,y=>y.length)},[p,m,s,u,r,c,f,a,g,_,o,l,d,w]}class Qa extends fe{constructor(t){super(),ce(this,t,Hg,Lg,ue,{})}}function Gg(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m=Math.round(e[5](e[3]))+"",_,v,w,y,C,E,S,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=j("svg"),p=j("text"),_=L(m),C=N(),E=A("p"),E.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"),ye(r,"background",e[6][e[0]]),h(r,"class","svelte-1pknxov"),e[0]===void 0&&Se(()=>e[9].call(r)),h(n,"class","svelte-1pknxov"),h(p,"dominant-baseline","middle"),h(p,"x",v=e[2]/2),h(p,"y",w=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"),Se(()=>e[10].call(d)),h(E,"class","small svelte-1pknxov"),h(t,"class","card-container svelte-1pknxov"),ye(t,"background",e[6][e[0]])},m($,R){O($,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,g),b(g,p),b(p,_),y=ct(d,e[10].bind(d)),b(t,C),b(t,E),S||(F=B(r,"change",e[9]),S=!0)},p($,[R]){R&1&&ye(r,"background",$[6][$[0]]),R&1&&ol(r,$[0]),R&8&&m!==(m=Math.round($[5]($[3]))+"")&&J(_,m),R&4&&v!==(v=$[2]/2)&&h(p,"x",v),R&2&&w!==(w=$[1]/2)&&h(p,"y",w),R&4&&h(g,"width",$[2]),R&2&&h(g,"height",$[1]),R&1&&ye(t,"background",$[6][$[0]])},i:X,o:X,d($){$&&P(t),y(),S=!1,F()}}}function jg(e,t){return t==="all"?e.length:e.filter(l=>l.vote_status===t).length}function Bg(e,t,n){let l,o,r,s;ae(e,ut,m=>n(0,o=m)),ae(e,je,m=>n(8,r=m));let u,a,f=Do(0);ae(e,f,m=>n(3,s=m));const c=yt(".1f"),d={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"var(--white)"};function g(){o=sa(this),ut.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&&console.log("fbc",l),e.$$.dirty&128&&f.set(l)},[o,u,a,s,f,c,d,l,r,g,p]}class Ka extends fe{constructor(t){super(),ce(this,t,Bg,Gg,ue,{})}}function xg(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m=e[5](e[3])+"",_,v,w,y,C,E,S,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=j("svg"),p=j("text"),_=L(m),C=N(),E=A("p"),E.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"),ye(r,"background",e[6][e[0]]),h(r,"class","svelte-mchgj2"),e[0]===void 0&&Se(()=>e[9].call(r)),h(p,"dominant-baseline","middle"),h(p,"x",v=e[2]/2),h(p,"y",w=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"),Se(()=>e[10].call(d)),h(E,"class","small svelte-mchgj2"),h(t,"class","card-container svelte-mchgj2"),ye(t,"background",e[6][e[0]])},m($,R){O($,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,g),b(g,p),b(p,_),y=ct(d,e[10].bind(d)),b(t,C),b(t,E),S||(F=B(r,"change",e[9]),S=!0)},p($,[R]){R&1&&ye(r,"background",$[6][$[0]]),R&1&&ol(r,$[0]),R&8&&m!==(m=$[5]($[3])+"")&&J(_,m),R&4&&v!==(v=$[2]/2)&&h(p,"x",v),R&2&&w!==(w=$[1]/2)&&h(p,"y",w),R&4&&h(g,"width",$[2]),R&2&&h(g,"height",$[1]),R&1&&ye(t,"background",$[6][$[0]])},i:X,o:X,d($){$&&P(t),y(),S=!1,F()}}}function Wg(e,t){const n=e.length;return t==="all"?1:e.filter(o=>o.vote_status===t).length/n}function Ug(e,t,n){let l,o,r,s;ae(e,ut,m=>n(0,o=m)),ae(e,je,m=>n(8,r=m));let u,a,f=Do(0);ae(e,f,m=>n(3,s=m));const c=yt(".1%"),d={up:"#00ebc7",down:"#FF5470","n/a":"#fde24f",all:"var(--white)"};function g(){o=sa(this),ut.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=Wg(r,o)),e.$$.dirty&128&&f.set(l)},[o,u,a,s,f,c,d,l,r,g,p]}class Ja extends fe{constructor(t){super(),ce(this,t,Ug,xg,ue,{})}}function Xg(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m,_,v,w,y,C,E,S,F,$,R,k,M,I;return r=new Ka({}),a=new Ja({}),d=new Wa({}),m=new Xa({props:{feedback:"Bad"}}),w=new Qa({}),E=new Ya({}),M=new Ua({}),{c(){t=A("div"),n=A("div"),l=A("div"),o=A("div"),le(r.$$.fragment),s=N(),u=A("div"),le(a.$$.fragment),f=N(),c=A("div"),le(d.$$.fragment),g=N(),p=A("div"),le(m.$$.fragment),_=N(),v=A("div"),le(w.$$.fragment),y=N(),C=A("div"),le(E.$$.fragment),S=N(),F=A("div"),$=A("div"),$.innerHTML=`
+
`,R=N(),k=A("div"),le(M.$$.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(C,"class","left-filter2"),h(n,"class","feedback-left svelte-14znspc"),h($,"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,V){O(D,t,V),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(w,v,null),b(n,y),b(n,C),ee(E,C,null),b(t,S),b(t,F),b(F,$),b(F,R),b(F,k),ee(M,k,null),I=!0},p:X,i(D){I||(z(r.$$.fragment,D),z(a.$$.fragment,D),z(d.$$.fragment,D),z(m.$$.fragment,D),z(w.$$.fragment,D),z(E.$$.fragment,D),z(M.$$.fragment,D),I=!0)},o(D){q(r.$$.fragment,D),q(a.$$.fragment,D),q(d.$$.fragment,D),q(m.$$.fragment,D),q(w.$$.fragment,D),q(E.$$.fragment,D),q(M.$$.fragment,D),I=!1},d(D){D&&P(t),te(r),te(a),te(d),te(m),te(w),te(E),te(M)}}}function Yg(e,t,n){let l;ae(e,Mn,r=>n(0,l=r)),dt(()=>{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]}));Fe(Mn,l=[...a],l)}return[]}class Za extends fe{constructor(t){super(),ce(this,t,Yg,Xg,ue,{})}}/**!
+ * Sortable 1.15.0
+ * @author RubaXa
+ * @author owenm
+ * @license MIT
+ */function Sr(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 ft(e){for(var t=1;t=0)&&(n[o]=e[o]);return n}function Jg(e,t){if(e==null)return{};var n=Kg(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 Zg="1.15.0";function _t(e){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(e)}var kt=_t(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),zn=_t(/Edge/i),Cr=_t(/firefox/i),yn=_t(/safari/i)&&!_t(/chrome/i)&&!_t(/android/i),eu=_t(/iP(ad|od|hone)/i),tu=_t(/chrome/i)&&_t(/android/i),nu={capture:!1,passive:!1};function ge(e,t,n){e.addEventListener(t,n,!kt&&nu)}function de(e,t,n){e.removeEventListener(t,n,!kt&&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 ep(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function ot(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=ep(e))}return null}var $r=/\s+/g;function We(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var l=(" "+e.className+" ").replace($r," ").replace(" "+t+" "," ");e.className=(l+(n?" "+t:"")).replace($r," ")}}function ne(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 en(e,t){var n="";if(typeof e=="string")n=e;else do{var l=ne(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===at())break;l=Rt(l,!1)}return!1}function rn(e,t,n,l){for(var o=0,r=0,s=e.children;r2&&arguments[2]!==void 0?arguments[2]:{},o=l.evt,r=Jg(l,ap);Vn.pluginEvent.bind(Z)(t,n,ft({dragEl:H,parentEl:Re,ghostEl:re,rootEl:be,nextEl:Tt,lastDownEl:Zn,cloneEl:we,cloneHidden:Ct,dragStarted:pn,putSortable:Ne,activeSortable:Z.active,originalEvent:o,oldIndex:Yt,oldDraggableIndex:Sn,newIndex:Ue,newDraggableIndex:St,hideGhostForTarget:fu,unhideGhostForTarget:cu,cloneNowHidden:function(){Ct=!0},cloneNowShown:function(){Ct=!1},dispatchSortableEvent:function(u){Oe({sortable:n,name:u,originalEvent:o})}},r))};function Oe(e){sp(ft({putSortable:Ne,cloneEl:we,targetEl:H,rootEl:be,oldIndex:Yt,oldDraggableIndex:Sn,newIndex:Ue,newDraggableIndex:St},e))}var H,Re,re,be,Tt,Zn,we,Ct,Yt,Ue,Sn,St,Bn,Ne,Xt=!1,ml=!1,_l=[],Nt,Ze,Ll,Hl,Er,Mr,pn,Wt,Cn,$n=!1,xn=!1,el,Pe,Gl=[],_o=!1,vl=[],El=typeof document<"u",Wn=eu,Fr=zn||kt?"cssFloat":"float",up=El&&!tu&&!eu&&"draggable"in document.createElement("div"),su=function(){if(El){if(kt)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto",e.style.pointerEvents==="auto"}}(),au=function(t,n){var l=ne(t),o=parseInt(l.width)-parseInt(l.paddingLeft)-parseInt(l.paddingRight)-parseInt(l.borderLeftWidth)-parseInt(l.borderRightWidth),r=rn(t,0,n),s=rn(t,1,n),u=r&&ne(r),a=s&&ne(s),f=u&&parseInt(u.marginLeft)+parseInt(u.marginRight)+Me(r).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Me(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[Fr]==="none"||s&&l[Fr]==="none"&&f+c>o)?"vertical":"horizontal"},fp=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},cp=function(t,n){var l;return _l.some(function(o){var r=o[Xe].options.emptyInsertThreshold;if(!(!r||qo(o))){var s=Me(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 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||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&&ne(re,"display","none")},cu=function(){!su&&re&&ne(re,"display","")};El&&!tu&&document.addEventListener("click",function(e){if(ml)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),ml=!1,!1},!0);var Pt=function(t){if(H){t=t.touches?t.touches[0]:t;var n=cp(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[Xe]._onDragOver(l)}}},dp=function(t){H&&H.parentNode[Xe]._isOutsideThisEl(t.target)};function Z(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=wt({},t),e[Xe]=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:Z.supportPointer!==!1&&"PointerEvent"in window&&!yn,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:up,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?ge(e,"pointerdown",this._onTapStart):(ge(e,"mousedown",this._onTapStart),ge(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(ge(e,"dragover",this),ge(e,"dragenter",this)),_l.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),wt(this,op())}Z.prototype={constructor:Z,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(Wt=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(wp(l),!H&&!(/mousedown|pointerdown/.test(s)&&t.button!==0||o.disabled)&&!f.isContentEditable&&!(!this.nativeDraggable&&yn&&a&&a.tagName.toUpperCase()==="SELECT")&&(a=ot(a,o.draggable,l,!1),!(a&&a.animated)&&Zn!==a)){if(Yt=Qe(a),Sn=Qe(a,o.draggable),typeof c=="function"){if(c.call(this,t,a,this)){Oe({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=ot(f,d.trim(),l,!1),d)return Oe({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&&!ot(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=Me(l);if(be=r,H=l,Re=H.parentNode,Tt=H.nextSibling,Zn=l,Bn=s.group,Z.dragged=H,Nt={target:H,clientX:(n||t).clientX,clientY:(n||t).clientY},Er=Nt.clientX-f.left,Mr=Nt.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}),Z.eventCanceled){o._onDrop();return}o._disableDelayedDragEvents(),!Cr&&o.nativeDraggable&&(H.draggable=!0),o._triggerDragStart(t,n),Oe({sortable:o,name:"choose",originalEvent:t}),We(H,s.chosenClass,!0)},s.ignore.split(",").forEach(function(c){lu(H,c.trim(),jl)}),ge(u,"dragover",Pt),ge(u,"mousemove",Pt),ge(u,"touchmove",Pt),ge(u,"mouseup",o._onDrop),ge(u,"touchend",o._onDrop),ge(u,"touchcancel",o._onDrop),Cr&&this.nativeDraggable&&(this.options.touchStartThreshold=4,H.draggable=!0),Le("delayStart",this,{evt:t}),s.delay&&(!s.delayOnTouchOnly||n)&&(!this.nativeDraggable||!(zn||kt))){if(Z.eventCanceled){this._onDrop();return}ge(u,"mouseup",o._disableDelayedDrag),ge(u,"touchend",o._disableDelayedDrag),ge(u,"touchcancel",o._disableDelayedDrag),ge(u,"mousemove",o._delayedDragTouchMoveHandler),ge(u,"touchmove",o._delayedDragTouchMoveHandler),s.supportPointer&&ge(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&&jl(H),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;de(t,"mouseup",this._disableDelayedDrag),de(t,"touchend",this._disableDelayedDrag),de(t,"touchcancel",this._disableDelayedDrag),de(t,"mousemove",this._delayedDragTouchMoveHandler),de(t,"touchmove",this._delayedDragTouchMoveHandler),de(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,n){n=n||t.pointerType=="touch"&&t,!this.nativeDraggable||n?this.options.supportPointer?ge(document,"pointermove",this._onTouchMove):n?ge(document,"touchmove",this._onTouchMove):ge(document,"mousemove",this._onTouchMove):(ge(H,"dragend",this),ge(be,"dragstart",this._onDragStart));try{document.selection?tl(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,n){if(Xt=!1,be&&H){Le("dragStarted",this,{evt:n}),this.nativeDraggable&&ge(document,"dragover",dp);var l=this.options;!t&&We(H,l.dragClass,!1),We(H,l.ghostClass,!0),Z.active=this,t&&this._appendGhost(),Oe({sortable:this,name:"start",originalEvent:n})}else this._nulling()},_emulateDragOver:function(){if(Ze){this._lastX=Ze.clientX,this._lastY=Ze.clientY,fu();for(var t=document.elementFromPoint(Ze.clientX,Ze.clientY),n=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Ze.clientX,Ze.clientY),t!==n);)n=t;if(H.parentNode[Xe]._isOutsideThisEl(t),n)do{if(n[Xe]){var l=void 0;if(l=n[Xe]._onDragOver({clientX:Ze.clientX,clientY:Ze.clientY,target:t,rootEl:n}),l&&!this.options.dragoverBubble)break}t=n}while(n=n.parentNode);cu()}},_onTouchMove:function(t){if(Nt){var n=this.options,l=n.fallbackTolerance,o=n.fallbackOffset,r=t.touches?t.touches[0]:t,s=re&&en(re,!0),u=re&&s&&s.a,a=re&&s&&s.d,f=Wn&&Pe&&Rr(Pe),c=(r.clientX-Nt.clientX+o.x)/(u||1)+(f?f[0]-Gl[0]:0)/(u||1),d=(r.clientY-Nt.clientY+o.y)/(a||1)+(f?f[1]-Gl[1]:0)/(a||1);if(!Z.active&&!Xt){if(l&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))=0&&(Oe({rootEl:Re,name:"add",toEl:Re,fromEl:be,originalEvent:t}),Oe({sortable:this,name:"remove",toEl:Re,originalEvent:t}),Oe({rootEl:Re,name:"sort",toEl:Re,fromEl:be,originalEvent:t}),Oe({sortable:this,name:"sort",toEl:Re,originalEvent:t})),Ne&&Ne.save()):Ue!==Yt&&Ue>=0&&(Oe({sortable:this,name:"update",toEl:Re,originalEvent:t}),Oe({sortable:this,name:"sort",toEl:Re,originalEvent:t})),Z.active&&((Ue==null||Ue===-1)&&(Ue=Yt,St=Sn),Oe({sortable:this,name:"end",toEl:Re,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){Le("nulling",this),be=H=Re=re=Tt=we=Zn=Ct=Nt=Ze=pn=Ue=St=Yt=Sn=Wt=Cn=Ne=Bn=Z.dragged=Z.ghost=Z.clone=Z.active=null,vl.forEach(function(t){t.checked=!0}),vl.length=Ll=Hl=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":H&&(this._onDragOver(t),hp(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 _p(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&&elc+f*r/2:ad-el)return-Cn}else if(a>c+f*(1-o)/2&&ad-f*r/2)?a>c+f/2?1:-1:0}function vp(e){return Qe(H)R[28];for(let R=0;REn(t,"showModal",G));let U=e[8];const Y=Q=>Q[25];for(let Q=0;Qn=!1)),t.$set(De),Ce&3463&&(U=Q[8],C=vt(C,Ce,Y,1,Q,U,E,y,nn,zr,null,Ir)),Ce&8&&R.value!==Q[3]&&Ke(R,Q[3]),(!T||Ce&80)&&I!==(I=(Q[4]?Q[6]:"Send")+"")&&J(D,I),(!T||Ce&8&&V!==(V="btnyousend "+(Q[3]===""?"":"active")+" svelte-1nj8mt0"))&&h(M,"class",V)},i(Q){T||(z(t.$$.fragment,Q),T=!0)},o(Q){q(t.$$.fragment,Q),T=!1},d(Q){te(t,Q),Q&&P(l),Q&&P(o);for(let Ce=0;Ce{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 Cp(e,t,n){let l,o,r;ae(e,cn,k=>n(8,r=k));let{numModels:s=1}=t,{models:u=[0]}=t,a="",f="",c=!1,d=!1;dt(async()=>{if(await new Promise(k=>setTimeout(k,200)),_){const k=new Z(_,{animation:150,onUpdate(M){k.toArray()}});k.toArray()}g()});async function g(){const M=await(await fetch("/chat/comparator/db/retrieve")).json();console.log(M);const I=M.data;let D={},V=new Set;for(const T of I)V.add(T.model),D[T.qid]||(D[T.qid]={},D[T.qid].qid=T.qid,D[T.qid].question=T.question),D[T.qid][T.model]=T.answer,console.log(D);n(1,u=Array.from(V)),n(0,s=u.length),console.log(Object.values(D)),Fe(cn,r=[...Object.values(D)],r)}const p=async k=>{k.preventDefault(),a=f,n(3,f=""),n(4,c=!0);let M={question:a};for(let D of u)M[D]="Loading...";Fe(cn,r=[...r,M],r),console.log("compare chat log",cn);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 V of u)M[V]=D.answer[V];M.qid=D.qid,cn.update(V=>(V[V.length-1]=M,V))}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 w(k,M){const I=M,V=Fn(k.currentTarget.parentNode).selectAll("div.answer").nodes().map(G=>G.id);V.forEach((G,K)=>{Fn(`#${G}`).select(".answer-rank").property("value",K+1)});let T=[];for(let[G,K]of V.entries()){const U=parseInt(K.split("-")[1]),Y=u[U],Q={rank:G,model:Y};T.push(Q)}let x=r.filter(G=>G.qid===I),W=[];for(let G of T){const K={model:G.model,qid:parseInt(I),rank:parseInt(G.rank)+1,answer:x[0][G.model]};W.push(K)}Vr(W)}function y(k,M,I){const D=M,V=parseInt(k.target.value),T=u[I],x={qid:D,rank:parseInt(V),model:T};let W=[],K=r.filter(Y=>Y.qid===x.qid)[0][x.model];const U={model:x.model,qid:parseInt(x.qid),rank:parseInt(x.rank),answer:K};W.push(U),Vr(W)}function C(){n(5,d=!0)}function E(k){d=k,n(5,d)}const S=(k,M,I)=>y(I,k.qid,M),F=(k,M)=>w(M,k.qid);function $(k){nt[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 Z(_,{animation:150,dataIdAttr:"id",onUpdate(k){v.toArray()}})),v.toArray())},[s,u,_,f,c,d,o,l,r,p,w,y,C,m,v,E,S,F,$,R]}class $p extends fe{constructor(t){super(),ce(this,t,Cp,kp,ue,{numModels:0,models:1})}}const sn=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 qr(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 Hr(e,t,n){const l=e.slice();return l[25]=t[n],l}function Gr(e){let t,n,l,o,r=`Q.${e[25]}`,s,u;return{c(){t=j("g"),n=j("line"),o=j("text"),s=L(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){O(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]}`)&&J(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 jr(e){let t=Number.isInteger(e[25]),n,l=t&&Gr(e);return{c(){l&&l.c(),n=ke()},m(o,r){l&&l.m(o,r),O(o,n,r)},p(o,r){r&256&&(t=Number.isInteger(o[25])),t?l?l.p(o,r):(l=Gr(o),l.c(),l.m(n.parentNode,n)):l&&(l.d(1),l=null)},d(o){l&&l.d(o),o&&P(n)}}}function Br(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=j("path"),r=j("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){O(p,n,m),O(p,r,m),f||(c=[B(r,"mouseover",d),B(r,"focus",g),B(r,"mouseout",wl),B(r,"blur",wl)],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,he(c)}}}function xr(e,t){let n,l,o,r,s,u,a=t[20].rank+"",f,c,d,g;return{key:e,first:null,c(){n=j("g"),l=j("circle"),u=j("text"),f=L(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){O(p,n,m),b(n,l),b(n,u),b(u,f),d||(g=[B(l,"mouseover",t[17]),B(l,"focus",t[18]),B(l,"mouseout",wl),B(l,"blur",wl)],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+"")&&J(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,he(g)}}}function Ap(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m=[],_=new Map,v,w=[],y=new Map,C,E,S,F,$,R=e[8],k=[];for(let T=0;TT[24];for(let T=0;TT[20].model+T[20].qid;for(let T=0;Te[19].call(t))},m(T,x){O(T,t,x),b(t,n),b(n,l);for(let W=0;W{e.style.opacity=1})}function Rp(e,t,n){let l,o,r,s,u,a,f,c,d,g,p;ae(e,sn,$=>n(7,p=$));let m,_,v={top:35,bottom:15,left:10,right:0};function w($){document.querySelectorAll(".model-path, .model-path-outer, .model-circle").forEach(R=>{R.style.opacity=.12}),document.querySelectorAll(`.model-path[data-model="${l[$]}"], .model-circle[data-model="${l[$]}"]`).forEach(R=>{R.style.opacity=1})}const y=$=>w($),C=$=>w($),E=()=>w(i),S=()=>w(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($=>$.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(p.map($=>$.qid)).padding(.3).range([v.left,o-v.right])),e.$$.dirty&128&&n(14,u=p.map($=>$.rank).sort(($,R)=>$-R)),e.$$.dirty&16416&&n(4,a=Bi().domain(u).padding(1).range([v.top,r-v.bottom])),e.$$.dirty&128&&n(11,f=Dt().domain(p.map($=>$.model)).range(["#FF5470","#1B2D45","#00EBC7","#FDE24F","red"])),e.$$.dirty&24&&n(10,c=$g().x($=>s($.qid)).y($=>a($.rank))),e.$$.dirty&132&&n(9,d=l.map($=>p.filter(R=>R.model===$))),e.$$.dirty&8&&n(8,g=s.domain().length>10?s.domain().filter(($,R)=>R%2===0):s.domain())},[m,_,l,s,a,r,o,p,g,d,c,f,v,w,u,y,C,E,S,F]}class Ep extends fe{constructor(t){super(),ce(this,t,Rp,Ap,ue,{})}}function Wr(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 Xr(e,t,n){const l=e.slice();return l[16]=t[n],l}function Yr(e){let t,n,l=e[16]+"",o,r;return{c(){t=j("g"),n=j("text"),o=L(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){O(s,t,u),b(t,n),b(n,o)},p(s,u){u&4&&l!==(l=s[16]+"")&&J(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 Qr(e){let t,n,l=e[16]+"",o,r;return{c(){t=j("g"),n=j("text"),o=L(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){O(s,t,u),b(t,n),b(n,o)},p(s,u){u&128&&l!==(l=s[16]+"")&&J(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 Kr(e){let t,n=e[16]%2==0&&Qr(e);return{c(){n&&n.c(),t=ke()},m(l,o){n&&n.m(l,o),O(l,t,o)},p(l,o){l[16]%2==0?n?n.p(l,o):(n=Qr(l),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},d(l){n&&n.d(l),l&&P(t)}}}function Jr(e){let t,n,l,o,r,s,u,a=e[13].avgRank.toFixed(2)+"",f,c,d;return{c(){t=j("rect"),u=j("text"),f=L(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){O(g,t,p),O(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)+"")&&J(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 Mp(e){let t,n,l,o,r,s,u,a,f,c,d,g,p=e[2].map(Zr),m=[];for(let C=0;Ce[12].call(t))},m(C,E){O(C,t,E),b(t,n);for(let S=0;Se.model;function Fp(e,t,n){let l,o,r,s,u,a,f,c,d;ae(e,sn,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,w)=>(v[w.model]?(v[w.model].sum+=w.rank,v[w.model].count++):v[w.model]={sum:w.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=Ht().rangeRound([m.top,s-m.bottom]).padding(.05).domain(o.map(v=>v.model))),e.$$.dirty&12&&n(7,a=Ye().rangeRound([m.left,r-m.right]).domain([0,bt(o,v=>v.avgRank)])),e.$$.dirty&4&&n(6,f=Dt().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 Dp extends fe{constructor(t){super(),ce(this,t,Fp,Mp,ue,{})}}function es(e,t,n){const l=e.slice();return l[20]=t[n],l[22]=n,l}function ts(e,t,n){const l=e.slice();return l[23]=t[n],l[25]=n,l}function ns(e,t,n){const l=e.slice();return l[23]=t[n],l}function ls(e){let t,n=e[23].key+"",l,o,r;function s(){return e[10](e[23])}return{c(){t=A("th"),l=L(n),h(t,"class","svelte-owgjbp")},m(u,a){O(u,t,a),b(t,l),o||(r=B(t,"click",s),o=!0)},p(u,a){e=u,a&64&&n!==(n=e[23].key+"")&&J(l,n)},d(u){u&&P(t),o=!1,r()}}}function os(e,t){let n,l=(t[20][t[23].key].length>rs&&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=L(l),h(n,"class",r="cell-type-"+t[23].type+" svelte-owgjbp"),ye(n,"background",t[23].key==="change"?t[7](t[20][t[23].key]):"none"),Te(n,"active",t[4]===`${t[22]}-${t[25]}`),this.first=n},m(f,c){O(f,n,c),b(n,o),s||(u=B(n,"click",a),s=!0)},p(f,c){t=f,c&112&&l!==(l=(t[20][t[23].key].length>rs&&t[4]!==`${t[22]}-${t[25]}`?`${t[20][t[23].key].substring(0,40)}...`:t[20][t[23].key])+"")&&J(o,l),c&64&&r!==(r="cell-type-"+t[23].type+" svelte-owgjbp")&&h(n,"class",r),c&96&&ye(n,"background",t[23].key==="change"?t[7](t[20][t[23].key]):"none"),c&80&&Te(n,"active",t[4]===`${t[22]}-${t[25]}`)},d(f){f&&P(n),s=!1,u()}}}function is(e){let t,n=[],l=new Map,o,r=e[6];const s=u=>u[23].key;for(let u=0;un(9,s=E));let u={};const a=yt(".2f");function f(E){let S=E.reduce(($,R)=>($[R.model]||($[R.model]=[]),$[R.model].push(R.rank),$),{});return Object.entries(S).map(([$,R])=>{let k=R.reduce((I,D)=>(I[D]=(I[D]||0)+1,I),{}),M=Object.entries(k).reduce((I,D)=>D[1]>I[1]?D:I)[0];return{model:$,overall_rank:Number(M),average_rank:a(Ch(R)),standard_deviation_rank:a(uh(R))}})}u={...{columns:{},style:"normal",paged:25},...u};const d=Ye().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 w=null;const y=E=>{g&&(_===E.key&&n(2,v=!v),n(1,_=E.key))},C=(E,S)=>{n(4,w=w===`${E}-${S}`?null:`${E}-${S}`)};return e.$$.update=()=>{if(e.$$.dirty&512,e.$$.dirty&512&&n(8,l=f(s)),e.$$.dirty&774){_&&n(8,l=l.slice().sort((S,F)=>{let $=S[_],R=F[_];if($==R)return JSON.stringify(S).localeCompare(JSON.stringify(F));let k=$>R?1:${const S=u.columns[E]||{};return{key:E,type:S.type||typeof l[0][E],options:S}}))},n(5,r=[]),[u,_,v,g,w,r,o,d,l,s,y,C]}let Op=class extends fe{constructor(t){super(),ce(this,t,Pp,Ip,ue,{})}};function ss(e,t,n){const l=e.slice();return l[19]=t[n],l}function as(e,t,n){const l=e.slice();return l[22]=t[n],l}function us(e,t,n){const l=e.slice();return l[25]=t[n],l[27]=n,l}function fs(e){let t,n=e[25]+"",l,o,r,s=e[25]+"",u,a;return{c(){t=j("text"),l=L(n),r=j("text"),u=L(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){O(f,t,c),b(t,l),O(f,r,c),b(r,u)},p(f,c){c&8&&n!==(n=f[25]+"")&&J(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]+"")&&J(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 cs(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=j("rect"),a=j("text"),c=L(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,_){O(m,t,_),O(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]])+"")&&J(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 ds(e){let t,n=e[3],l=[];for(let o=0;oe[16].call(t))},m(g,p){O(g,t,p),b(t,n);for(let m=0;mn(15,p=S));const m=yt(".1f");function _(S){let F=S.reduce((k,M)=>(k[M.qid]||(k[M.qid]=[]),k[M.qid].push(M),k),{}),$=Array.from(new Set(S.map(k=>k.model))),R=$.reduce((k,M)=>(k[M]=$.reduce((I,D)=>(I[D]={sum:0,count:0},I),{}),k),{});for(let k in F){let M=F[k];for(let I of $)for(let D of $){let V=M.find(x=>x.model===I),T=M.find(x=>x.model===D);V&&T&&(R[I][D].sum+=T.rank-V.rank,R[I][D].count++)}}for(let k in R)for(let M in R[k])R[k][M].count>0?R[k][M]=R[k][M].sum/R[k][M].count:R[k][M]=0;return R}let v=500,w=500,y={top:50,bottom:0,left:65,right:25};function C(S,F){let $=l[S][F];return $===0?"white":$>=0?g(S):g(F)}function E(){w=this.offsetWidth,v=this.offsetHeight,n(1,w),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(S=>S.model)))),e.$$.dirty&2&&n(14,r=w-y.left-y.right),e.$$.dirty&1&&n(13,s=v-y.top-y.bottom),e.$$.dirty&16392&&n(5,u=Ht().range([0,r]).domain(o).padding(.05)),e.$$.dirty&8200&&n(4,a=Ht().range([0,s]).domain(o).padding(.05)),e.$$.dirty&4&&n(12,f=Object.values(l).flatMap(S=>Object.values(S))),e.$$.dirty&4096&&n(11,c=so(f)),e.$$.dirty&4096&&n(10,d=bt(f)),e.$$.dirty&8&&n(9,g=Dt().domain(o).range(["#FF5470","#1B2D45","#00EBC7","#FDE24F"])),e.$$.dirty&3592&&o.reduce((S,F)=>(S[F]=Ga().domain([c,d]).interpolator(uo("white",g(F))),S),{})},[v,w,l,o,a,u,m,y,C,g,d,c,f,s,r,p,E]}class Vp extends fe{constructor(t){super(),ce(this,t,zp,Tp,ue,{})}}function hs(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){O(n,t,l)},p:X,i:X,o:X,d(n){n&&P(t)}}}function Lp(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m,_,v,w,y,C,E,S,F=e[1],$=[];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){O(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):(_e(),q(s[c],1,1,()=>{s[c]=null}),ve(),l=s[n],l?l.p(a,f):(l=s[n]=r[n](a),l.c()),z(l,1),l.m(t,null))},i(a){o||(z(l),o=!0)},o(a){q(l),o=!1},d(a){a&&P(t),s[n].d()}}}function ps(){document.querySelectorAll(".model-path, .model-path-outer, .model-circle").forEach(e=>{e.style.opacity=1})}function Gp(e,t,n){let l,o,r;ae(e,sn,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)}));Fe(sn,r=[...p],r)}dt(()=>{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=Dt().domain(r.map(c=>c.model)).range(["#FF5470","#1B2D45","#00EBC7","#FDE24F","red"]))},[r,l,o,u,a,f]}class jp extends fe{constructor(t){super(),ce(this,t,Gp,Hp,ue,{})}}function Bp(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,g,p,m,_,v,w,y;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[w=v<<1|_]))return o[w]=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[w]=s:e._root=s,e;do o=o?o[w]=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((w=v<<1|_)===(y=(m>=g)<<1|p>=d));return o[y]=r,o[w]=s,e}function xp(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)=w)<<1|e>=v)&&(m=g[g.length-1],g[g.length-1]=g[g.length-1-_],g[g.length-1-_]=m)}else{var y=e-+this._x.call(null,p.data),C=t-+this._y.call(null,p.data),E=y*y+C*C;if(E=(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,w=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[w]=n:this._root=n),this):(this._root=r,this)}function Kp(e){for(var t=0,n=e.length;tg.index){var I=p-R.x-R.vx,D=m-R.y-R.vy,V=I*I+D*D;Vp+M||Fm+M||$f.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=fm(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;--an}function bs(){Gt=(kl=Pn.now())+Ml,an=vn=0;try{hm()}finally{an=0,pm(),Gt=0}}function gm(){var e=Pn.now(),t=e-kl;t>mu&&(Ml-=t,kl=e)}function pm(){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);bn=e,ko(l)}function ko(e){if(!an){vn&&(vn=clearTimeout(vn));var t=e-Gt;t>24?(e<1/0&&(vn=setTimeout(bs,e-Pn.now()-Ml)),hn&&(hn=clearInterval(hn))):(hn||(kl=Pn.now(),hn=setInterval(gm,mu)),an=1,_u(bs))}}const mm=1664525,_m=1013904223,ws=4294967296;function vm(){let e=1;return()=>(e=(mm*e+_m)%ws)/ws}var bm=10,wm=Math.PI*(3-Math.sqrt(5));function ym(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=vm();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,w){var y=0,C=e.length,E,S,F,$,R;for(w==null?w=1/0:w*=w,y=0;y1?(f.on(_,v),t):f.on(_)}}}function km(e){var t=rt(.1),n,l,o;typeof e!="function"&&(e=rt(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(y,C){O(y,t,C),b(t,n),b(t,r),b(r,u),b(r,a),b(a,c),_=!0,v||(w=[B(t,"mouseover",e[6]),B(t,"mouseout",e[7]),B(t,"focus",e[6]),B(t,"blur",e[7])],v=!0)},p(y,C){(!_||C&12&&l!==(l=y[3](y[20].size)))&&h(n,"r",l),(!_||C&4)&&s!==(s=y[20].file+"")&&J(u,s),(!_||C&4)&&f!==(f=ro(y[20].size)+"")&&J(c,f),(!_||C&20&&d!==(d=y[20].size>y[4]?1:0))&&h(r,"opacity",d),(!_||C&20&&p!==(p="file-circle-g "+(y[20].size>y[4]?"large":"")+" svelte-h2ab3o"))&&h(t,"class",p),(!_||C&4&&m!==(m=y[5](y[20].x,y[20].y)))&&h(t,"style",m)},i(y){_||(y&&Se(()=>{_&&(o||(o=Ge(n,Ln,{duration:1e3},!0)),o.run(1))}),y&&Se(()=>{_&&(g||(g=Ge(r,Ln,{duration:1e3},!0)),g.run(1))}),_=!0)},o(y){y&&(o||(o=Ge(n,Ln,{duration:1e3},!1)),o.run(0)),y&&(g||(g=Ge(r,Ln,{duration:1e3},!1)),g.run(0)),_=!1},d(y){y&&P(t),y&&o&&o.end(),y&&g&&g.end(),v=!1,he(w)}}}function Cm(e){let t,n,l,o,r=e[2],s=[];for(let a=0;aq(s[a],1,1,()=>{s[a]=null});return{c(){t=A("div"),n=j("svg");for(let a=0;ae[15].call(t))},m(a,f){O(a,t,f),b(t,n);for(let c=0;cn(14,c=S));let d=600,g=350,p=!0,m=!1;const _=(S,F)=>`transform: translate(${S}px, ${F}px)`,v=[-4,4],w=[-1,1];function y(){n(8,p=!0),n(9,m=!0);const S=Fn(this);Pl(".file-circle-g").select("text").style("opacity",0),S.raise(),S.select("circle").attr("fill","var(--red)"),S.select("text").style("opacity",1)}const C=()=>{const S=Pl(".file-circle-g");S.select("circle").attr("fill","var(--yellow)"),S.select("text").style("opacity",0),n(9,m=!1),setTimeout(()=>{n(8,p=!1)},1e3)};function E(){d=this.offsetWidth,g=this.offsetHeight,n(0,d),n(1,g)}return e.$$.update=()=>{e.$$.dirty&16387&&n(2,l=c.map(S=>({...S,x:d/2,y:g/2,tickCount:0}))),e.$$.dirty&16384&&console.log(c.map(S=>S.size).sort((S,F)=>S-F)),e.$$.dirty&1&&n(13,o=km().x(d/2)),e.$$.dirty&2&&n(12,r=Sm().y(g/2)),e.$$.dirty&16384&&n(3,a=Ye().domain(wn(c,S=>S.size)).range([12,60])),e.$$.dirty&8&&n(10,s=am().radius(S=>a(S.size)+1).iterations(3)),e.$$.dirty&16384&&n(4,u=Sh(c.map(S=>S.size).sort((S,F)=>S-F),.85)),e.$$.dirty&1&&Ye().domain(v).range([5,d]),e.$$.dirty&2&&Ye().domain(w).range([g,5]),e.$$.dirty&4&&n(11,f=ym().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(wn(c,S=>S.size)),l.forEach(S=>S.radius=a(S.size)),f.nodes(l),s.radius(S=>S.radius+.5)),e.$$.dirty&768&&p===!1&&(m||Pl(".large").select("text").style("opacity",1))},[d,g,l,a,u,_,y,C,p,m,s,f,r,o,c,E]}class Am extends fe{constructor(t){super(),ce(this,t,$m,Cm,ue,{})}}/**
+ * table-core
+ *
+ * Copyright (c) TanStack
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE.md file in the root directory of this source tree.
+ *
+ * @license MIT
+ */function Et(e,t){return typeof e=="function"?e(t):e}function Je(e,t){return n=>{t.setState(l=>({...l,[e]:Et(n,l[e])}))}}function Cl(e){return e instanceof Function}function Rm(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,g=(p,m)=>{for(p=String(p);p.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 Cs(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 Fm={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 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(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 w=[..._].reverse()[0],y=v.column.depth===m.depth;let C,E=!1;if(y&&v.column.parent?C=v.column.parent:(C=v.column,E=!0),w&&(w==null?void 0:w.column)===C)w.subHeaders.push(v);else{const S=Cs(n,C,{id:[l,p,C.id,v==null?void 0:v.id].filter(Boolean).join("_"),isPlaceholder:E,placeholderId:E?`${_.filter(F=>F.column===C).length}`:void 0,depth:p,index:_.length});S.subHeaders.push(v),_.push(S)}m.headers.push(v),v.headerGroup=m}),a.push(m),p>0&&f(_,p-1)},c=t.map((g,p)=>Cs(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,w=[0];m.subHeaders&&m.subHeaders.length?(w=[],d(m.subHeaders).forEach(C=>{let{colSpan:E,rowSpan:S}=C;_+=E,w.push(S)})):_=1;const y=Math.min(...w);return v=v+y,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},Ul=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Dm={getDefaultColumnDef:()=>Yn,getInitialState:e=>({columnSizing:{},columnSizingInfo:Ul(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",onColumnSizingChange:Je("columnSizing",e),onColumnSizingInfoChange:Je("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(w=>{var y,C;const E=v-((y=w==null?void 0:w.startOffset)!=null?y:0),S=Math.max(E/((C=w==null?void 0:w.startSize)!=null?C:0),-.999999);return w.columnSizingStart.forEach(F=>{let[$,R]=F;a[$]=Math.round(Math.max(R+R*S,0)*100)/100}),{...w,deltaOffset:E,deltaPercentage:S}}),(t.options.columnResizeMode==="onChange"||_==="end")&&t.setColumnSizing(w=>({...w,...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=Im()?{passive:!1}:!1;Xl(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 Qn=null;function Im(){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 Nm={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Je("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=>tt(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=>tt(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=>tt(e);const Su=(e,t,n)=>{var l;return(l=e.getValue(t))==null?void 0:l.includes(n)};Su.autoRemove=e=>tt(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=>tt(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=>tt(e)||!(e!=null&&e.length);const Au=(e,t,n)=>e.getValue(t)===n;Au.autoRemove=e=>tt(e);const Ru=(e,t,n)=>e.getValue(t)==n;Ru.autoRemove=e=>tt(e);const jo=(e,t,n)=>{let[l,o]=n;const r=e.getValue(t);return r>=l&&r<=o};jo.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]};jo.autoRemove=e=>tt(e)||tt(e[0])&&tt(e[1]);const ht={includesString:wu,includesStringSensitive:yu,equalsString:ku,arrIncludes:Su,arrIncludesAll:Cu,arrIncludesSome:$u,equals:Au,weakEquals:Ru,inNumberRange:jo};function tt(e){return e==null||e===""}const Pm={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:Je("columnFilters",e),onGlobalFilterChange:Je("globalFilter",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100,globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n,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"?ht.includesString:typeof l=="number"?ht.inNumberRange:typeof l=="boolean"||l!==null&&typeof l=="object"?ht.equals:Array.isArray(l)?ht.arrIncludes:ht.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:ht[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=Et(n,r?r.value:void 0);if($s(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:()=>ht.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:ht[l]},setColumnFilters:t=>{const n=e.getAllLeafColumns(),l=o=>{var r;return(r=Et(t,o))==null?void 0:r.filter(s=>{const u=n.find(a=>a.id===s.id);if(u){const a=u.getFilterFn();if($s(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 $s(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),Tm=(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},Vm=(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},Lm=(e,t)=>{if(!t.length)return;const n=t.map(r=>r.getValue(e));if(!Rm(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},Hm=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),Gm=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,jm=(e,t)=>t.length,Yl={sum:Om,min:Tm,max:zm,extent:Vm,mean:qm,median:Lm,unique:Hm,uniqueCount:Gm,count:jm},Bm={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Je("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>({toggleGrouping:()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(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 xm(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:Je("columnOrder",e)}),createTable:e=>({setColumnOrder:t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),resetColumnOrder:t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},_getOrderColumnsFn: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 xm(r,n,l)},{key:!1})})},So=0,Co=10,Ql=()=>({pageIndex:So,pageSize:Co}),Um={getInitialState:e=>({...e,pagination:{...Ql(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Je("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=>Et(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=Et(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,Et(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=Et(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:[]}),Xm={getInitialState:e=>({columnPinning:Kl(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Je("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}})})},Ym={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Je("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>({setRowSelection:t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),resetRowSelection:t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},toggleAllRowsSelected:t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const 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 As(e,n)==="some"},getIsAllSubRowsSelected:()=>{const{rowSelection:n}=t.getState();return As(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 As(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,Qm=(e,t,n)=>Eu(Ft(e.getValue(n)).toLowerCase(),Ft(t.getValue(n)).toLowerCase()),Km=(e,t,n)=>Eu(Ft(e.getValue(n)),Ft(t.getValue(n))),Jm=(e,t,n)=>xo(Ft(e.getValue(n)).toLowerCase(),Ft(t.getValue(n)).toLowerCase()),Zm=(e,t,n)=>xo(Ft(e.getValue(n)),Ft(t.getValue(n))),e_=(e,t,n)=>{const l=e.getValue(n),o=t.getValue(n);return l>o?1:lxo(e.getValue(n),t.getValue(n));function xo(e,t){return e===t?0:e>t?1:-1}function Ft(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Eu(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 gn={alphanumeric:Qm,alphanumericCaseSensitive:Km,text:Jm,textCaseSensitive:Zm,datetime:e_,basic:t_},n_={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Je("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>({getAutoSortingFn:()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let 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 gn.datetime;if(typeof r=="string"&&(l=!0,r.split(Ao).length>1))return gn.alphanumeric}return l?gn.text:gn.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:gn[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())})},l_={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Je("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)}}}},Rs=[Fm,l_,Wm,Xm,Pm,n_,Bm,Nm,Um,Ym,Dm];function o_(e){var t;(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");let n={_features:Rs};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:Rs,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=Et(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=Mm(n,_,m,p),w=_;return v.columns=w.columns?d(w.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 i_(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 Wo=(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=>i_(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 Es(){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 Mu(e,t,n){return n.options.filterFromLeafRows?s_(e,t,n):a_(e,t,n)}function s_(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 Fs(){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 Ds(){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 u_(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 Is(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=u_({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}})}/**
+ * svelte-table
+ *
+ * Copyright (c) TanStack
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE.md file in the root directory of this source tree.
+ *
+ * @license MIT
+ */function f_(e){let t;return{c(){t=L(e[0])},l(n){t=Xu(n,e[0])},m(n,l){Gu(n,t,l)},p(n,[l]){l&1&&J(t,n[0])},i:X,o:X,d(n){n&&P(t)}}}function c_(e,t,n){let{content:l}=t;return e.$$set=o=>{"content"in o&&n(0,l=o.content)},[l]}class d_ extends fe{constructor(t){super(),ce(this,t,c_,f_,ue,{content:0})}}const h_=ca((e,t,n,l)=>`${df(t.content)}`);var g_=typeof document>"u"?h_:d_;function p_(e,t,n){let l,o;return l=new t({props:n,$$inline:!0}),{c(){le(l.$$.fragment)},l(r){gf(l.$$.fragment,r)},m(r,s){ee(l,r,s),o=!0},p:X,i(r){o||(z(l.$$.fragment,r),o=!0)},o(r){q(l.$$.fragment,r),o=!1},d(r){te(l,r)}}}function m_(e,t){return class extends fe{constructor(l){super(),ce(this,l,null,o=>p_(o,e,t),ue,{},void 0)}}}function __(e,t){return ca((l,o,r,s)=>`${hf(e,"TableComponent").$$render(l,t,{},{})}`)}const Ro=typeof window>"u"?__:m_;function v_(e){return typeof e=="object"&&typeof e.$$render=="function"&&typeof e.render=="function"}function b_(e){var t,n;let l="__SVELTE_HMR"in window;return e.prototype instanceof fe||l&&((t=e.name)==null?void 0:t.startsWith("Proxy<"))&&((n=e.name)==null?void 0:n.endsWith(">"))}function Ns(e){return typeof document>"u"?v_(e):b_(e)}function Ps(e){return Ro(g_,{content:e})}function $l(e,t){if(!e)return null;if(Ns(e))return Ro(e,t);if(typeof e=="function"){const n=e(t);return n==null?null:Ns(n)?Ro(n,t):Ps(n)}return Ps(e)}function Os(e){let t;"subscribe"in e?t=e:t=no(e);let n={state:{},onStateChange:()=>{},renderFallbackValue:null,...Pu(t)},l=o_(n),o=Ie(l.initialState),r=mf([o,t],u=>u);return no(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()}})}/**
+ * match-sorter-utils
+ *
+ * Copyright (c) TanStack
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE.md file in the root directory of this source tree.
+ *
+ * @license MIT
+ */const 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"},w_=Object.keys(Fu).join("|"),y_=new RegExp(w_,"g");function k_(e){return e.replace(y_,t=>Fu[t])}/**
+ * @name match-sorter
+ * @license MIT license.
+ * @copyright (c) 2099 Kent C. Dodds
+ * @author Kent C. Dodds (https://kentcdodds.com)
+ */const He={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0};function S_(e,t,n){var l;if(n=n||{},n.threshold=(l=n.threshold)!=null?l:He.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=R_(e,n.accessors),r={rankedValue:e,rank:He.NO_MATCH,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let s=0;s=He.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=zs(e,n),t=zs(t,n),t.length>e.length?He.NO_MATCH:e===t?He.CASE_SENSITIVE_EQUAL:(e=e.toLowerCase(),t=t.toLowerCase(),e===t?He.EQUAL:e.startsWith(t)?He.STARTS_WITH:e.includes(` ${t}`)?He.WORD_STARTS_WITH:e.includes(t)?He.CONTAINS:t.length===1?He.NO_MATCH:C_(e).includes(t)?He.ACRONYM:$_(e,t))}function C_(e){let t="";return e.split(" ").forEach(l=>{l.split("-").forEach(r=>{t+=r.substr(0,1)})}),t}function $_(e,t){let n=0,l=0;function o(a,f,c){for(let d=c,g=f.length;d-1))return He.NO_MATCH}const u=l-s;return r(u)}function zs(e,t){let{keepDiacritics:n}=t;return e=`${e}`,n||(e=k_(e)),e}function A_(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 R_(e,t){const n=[];for(let l=0,o=t.length;l{te(m,1)}),ve()}c?(n=Mt(c,d()),le(n.$$.fragment),z(n.$$.fragment,1),ee(n,t,l)):n=null}},i(g){u||(n&&z(n.$$.fragment,g),u=!0)},o(g){n&&q(n.$$.fragment,g),u=!1},d(g){g&&P(t),n&&te(n),a=!1,f()}}}function js(e){let t,n,l=!e[26].isPlaceholder&&M_(e);return{c(){t=A("th"),l&&l.c(),h(t,"colspan",e[26].colSpan),h(t,"class","svelte-16fb3tv")},m(o,r){O(o,t,r),l&&l.m(t,null),n=!0},p(o,r){o[26].isPlaceholder||l.p(o,r)},i(o){n||(z(l),n=!0)},o(o){q(l),n=!1},d(o){o&&P(t),l&&l.d()}}}function Bs(e){let t,n,l,o=e[23].headers,r=[];for(let u=0;uq(r[u],1,1,()=>{r[u]=null});return{c(){t=A("tr");for(let u=0;u{te(f,1)}),ve()}r?(l=Mt(r,s()),le(l.$$.fragment),z(l.$$.fragment,1),ee(l,n,null)):l=null}},i(u){o||(l&&z(l.$$.fragment,u),o=!0)},o(u){l&&q(l.$$.fragment,u),o=!1},d(u){u&&P(n),l&&te(l)}}}function Ws(e){let t,n=[],l=new Map,o,r,s=e[17].getVisibleCells();const u=a=>a[20].id;for(let a=0;a",K,U,Y,Q,Ce,De=e[5],$e=[];for(let ie=0;ieq($e[ie],1,1,()=>{$e[ie]=null});let It=e[1].getRowModel().rows,Ae=[];for(let ie=0;ieq(Ae[ie],1,1,()=>{Ae[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<$e.length;ie+=1)$e[ie].c();u=N(),a=A("tbody");for(let ie=0;ie(r(),r=Al(w,S=>n(1,o=S)),w);ae(e,Sl,S=>n(8,l=S)),e.$$.on_destroy.push(()=>r());const u=(S,F,$,R)=>{if(console.log("yessir"),Array.isArray($))return $.length===0?!0:$.includes(S.getValue(F));typeof $=="number"&&($=String($));const k=S_(S.getValue(F),$);return R({itemRank:k}),k.passed},a=r_(),f=[a.accessor("file",{header:"File",cell:S=>S.getValue(),footer:S=>S.column.id}),a.accessor("size",{header:"Size",cell:S=>ro(S.getValue()),footer:S=>S.column.id}),a.accessor("type",{header:"Type",cell:S=>S.getValue(),footer:S=>S.column.id})];let c="",d=Ie({data:l,columns:f,getCoreRowModel:Es(),getSortedRowModel:Ds(),getFilteredRowModel:Ms(),globalFilterFn:u,getFacetedRowModel:Fs(),getPaginationRowModel:Is(),state:{globalFilter:c,pagination:{pageSize:7,pageIndex:0}},enableGlobalFilter:!0});function g(S){n(6,c=S),d.update(F=>({...F,state:{...F.state,globalFilter:S}}))}function p(S){d.update(F=>{var $;return{...F,state:{...F.state,pagination:{...($=F.state)==null?void 0:$.pagination,pageIndex:S}}}})}let m;function _(S){clearTimeout(m),m=setTimeout(()=>{const F=S.target;g(F.value)},100)}function v(S){const F=S.target;p(parseInt(F.value)-1)}let w=Os(d);s();let y=o.getHeaderGroups();const C=()=>p(o.getState().pagination.pageIndex-1),E=()=>p(o.getState().pagination.pageIndex+1);return e.$$.update=()=>{e.$$.dirty&448&&(n(7,d={data:l,columns:f,getCoreRowModel:Es(),getSortedRowModel:Ds(),getFilteredRowModel:Ms(),globalFilterFn:u,getFacetedRowModel:Fs(),getPaginationRowModel:Is(),state:{globalFilter:c,pagination:{pageSize:7,pageIndex:0}},enableGlobalFilter:!0}),s(n(0,w=Os(Ie(d)))))},[w,o,p,_,v,y,c,d,l,C,E]}class N_ extends fe{constructor(t){super(),ce(this,t,I_,F_,ue,{})}}function P_(e){let t,n;return{c(){t=j("svg"),n=j("path"),h(n,"d","M248,128a87.34,87.34,0,0,1-17.6,52.81,8,8,0,1,1-12.8-9.62A71.34,71.34,0,0,0,232,128a72,72,0,0,0-144,0,8,8,0,0,1-16,0,88,88,0,0,1,3.29-23.88C74.2,104,73.1,104,72,104a48,48,0,0,0,0,96H96a8,8,0,0,1,0,16H72A64,64,0,1,1,81.29,88.68,88,88,0,0,1,248,128Zm-90.34-5.66a8,8,0,0,0-11.32,0l-32,32a8,8,0,0,0,11.32,11.32L144,147.31V208a8,8,0,0,0,16,0V147.31l18.34,18.35a8,8,0,0,0,11.32-11.32Z"),h(t,"xmlns","http://www.w3.org/2000/svg"),h(t,"width",e[1]),h(t,"height",e[0]),h(t,"fill","currentColor"),h(t,"viewBox","0 0 256 256")},m(l,o){O(l,t,o),b(t,n)},p(l,[o]){o&2&&h(t,"width",l[1]),o&1&&h(t,"height",l[0])},i:X,o:X,d(l){l&&P(t)}}}function O_(e,t,n){let{height:l=256,width:o=256}=t;return e.$$set=r=>{"height"in r&&n(0,l=r.height),"width"in r&&n(1,o=r.width)},[l,o]}class T_ extends fe{constructor(t){super(),ce(this,t,O_,P_,ue,{height:0,width:1})}}function Us(e){let t,n,l,o=e[4].length>1?`s (${e[4].length})`:"",r,s,u,a,f,c,d,g,p,m,_,v,w,y,C,E,S,F,$,R,k,M,I;return{c(){t=A("div"),n=A("div"),l=L("File"),r=L(o),s=N(),u=A("div"),u.textContent=`${e[7]()}`,f=N(),c=A("div"),d=A("div"),g=L("Upload"),m=N(),_=A("div"),v=L("Index"),y=N(),C=A("div"),E=L("Load"),F=N(),$=A("div"),R=L("Embed"),h(u,"class","processing-files svelte-qkz5xu"),h(t,"class","processing-container svelte-qkz5xu"),h(d,"class",p=lt(`loading load-left ${e[0]}`)+" svelte-qkz5xu"),h(_,"class",w=lt(`loading ${e[1]}`)+" svelte-qkz5xu"),h(C,"class",S=lt(`loading ${e[2]}`)+" svelte-qkz5xu"),h($,"class",k=lt(`loading load-right ${e[3]}`)+" svelte-qkz5xu"),h(c,"class","upload-status svelte-qkz5xu")},m(D,V){O(D,t,V),b(t,n),b(n,l),b(n,r),b(t,s),b(t,u),O(D,f,V),O(D,c,V),b(c,d),b(d,g),b(c,m),b(c,_),b(_,v),b(c,y),b(c,C),b(C,E),b(c,F),b(c,$),b($,R),I=!0},p(D,V){(!I||V&16)&&o!==(o=D[4].length>1?`s (${D[4].length})`:"")&&J(r,o),(!I||V&1&&p!==(p=lt(`loading load-left ${D[0]}`)+" svelte-qkz5xu"))&&h(d,"class",p),(!I||V&2&&w!==(w=lt(`loading ${D[1]}`)+" svelte-qkz5xu"))&&h(_,"class",w),(!I||V&4&&S!==(S=lt(`loading ${D[2]}`)+" svelte-qkz5xu"))&&h(C,"class",S),(!I||V&8&&k!==(k=lt(`loading load-right ${D[3]}`)+" svelte-qkz5xu"))&&h($,"class",k)},i(D){I||(Se(()=>{I&&(a||(a=Ge(t,mt,{duration:250},!0)),a.run(1))}),Se(()=>{I&&(M||(M=Ge(c,mt,{duration:250},!0)),M.run(1))}),I=!0)},o(D){a||(a=Ge(t,mt,{duration:250},!1)),a.run(0),M||(M=Ge(c,mt,{duration:250},!1)),M.run(0),I=!1},d(D){D&&P(t),D&&a&&a.end(),D&&P(f),D&&P(c),D&&M&&M.end()}}}function Xs(e){let t,n;return t=new N_({}),{c(){le(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},i(l){n||(z(t.$$.fragment,l),n=!0)},o(l){q(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function z_(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m,_,v,w,y,C,E,S,F,$,R,k;m=new T_({props:{height:32,width:32}});let M=e[0]!==e[5].WAITING&&Us(e);S=new Am({});let I=e[4]&&Xs();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("p"),u.textContent="These are the files your model will use as context.",a=N(),f=A("div"),c=A("form"),d=A("input"),g=N(),p=A("div"),le(m.$$.fragment),_=L(`
+ Drag and drop files here`),v=N(),M&&M.c(),w=N(),y=A("p"),y.textContent="Currently pdf, txt, and md are supported.",C=N(),E=A("div"),le(S.$$.fragment),F=N(),I&&I.c(),h(u,"class","svelte-qkz5xu"),h(d,"type","file"),d.multiple=!0,h(p,"class","drop-zone svelte-qkz5xu"),h(f,"class","upload-files-container svelte-qkz5xu"),h(y,"class","svelte-qkz5xu"),h(o,"class","upload-box svelte-qkz5xu"),h(l,"class","upload-container svelte-qkz5xu"),h(n,"class","file-container svelte-qkz5xu"),h(E,"class","charts-container svelte-qkz5xu"),h(t,"class","data-grid svelte-qkz5xu")},m(D,V){O(D,t,V),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(c,d),b(f,g),b(f,p),ee(m,p,null),b(p,_),b(o,v),M&&M.m(o,null),b(o,w),b(o,y),b(t,C),b(t,E),ee(S,E,null),b(E,F),I&&I.m(E,null),$=!0,R||(k=[B(d,"change",e[6]),B(p,"drop",e[6]),B(p,"dragover",V_)],R=!0)},p(D,[V]){D[0]!==D[5].WAITING?M?(M.p(D,V),V&1&&z(M,1)):(M=Us(D),M.c(),z(M,1),M.m(o,w)):M&&(_e(),q(M,1,1,()=>{M=null}),ve()),D[4]?I?V&16&&z(I,1):(I=Xs(),I.c(),z(I,1),I.m(E,null)):I&&(_e(),q(I,1,1,()=>{I=null}),ve())},i(D){$||(z(m.$$.fragment,D),z(M),z(S.$$.fragment,D),z(I),$=!0)},o(D){q(m.$$.fragment,D),q(M),q(S.$$.fragment,D),q(I),$=!1},d(D){D&&P(t),te(m),M&&M.d(),te(S),I&&I.d(),R=!1,he(k)}}}function V_(e){e.preventDefault()}function q_(e,t,n){let l,o;ae(e,ys,w=>n(8,l=w)),ae(e,Sl,w=>n(9,o=w));const r={WAITING:"waiting",IN_PROGRESS:"in-progress",DONE:"done"};let s=[],u=r.WAITING,a=r.WAITING,f=r.WAITING,c=r.WAITING;function d(){n(0,u=r.WAITING),n(1,a=r.WAITING),n(2,f=r.WAITING),n(3,c=r.WAITING)}async function g(w){w.preventDefault(),d(),n(0,u=r.IN_PROGRESS),n(4,s=[]),w.dataTransfer?w.dataTransfer.items?[...w.dataTransfer.items].forEach((S,F)=>{if(S.kind==="file"){const $=S.getAsFile();s.push($)}}):[...w.dataTransfer.files].forEach((S,F)=>{s.push(S)}):n(4,s=w.target.files);const y=new FormData;for(let S=0;S({file:E.name,size:E.size,type:E.type}));Fe(Sl,o=[...C],o),f===r.IN_PROGRESS&&n(2,f=r.DONE)}async function m(){console.log("index!"),n(1,a=r.IN_PROGRESS),await(await fetch("/retrieval/vector_db/index",{method:"POST"})).json(),n(1,a=r.DONE)}async function _(){n(3,c=r.IN_PROGRESS),console.log("getting embeddings...");const y=await(await fetch("/retrieval/vector_db/get")).json();console.log("embeddingData",y),Fe(ys,l=y,l),n(3,c=r.DONE)}function v(){let w="";for(let y=0;y{p()}),e.$$.update=()=>{e.$$.dirty&15&&u===r.DONE&&a===r.DONE&&f===r.DONE&&c===r.DONE&&setTimeout(d,3e3)},[u,a,f,c,s,r,g,v]}class L_ extends fe{constructor(t){super(),ce(this,t,q_,z_,ue,{})}}function H_(e){let t,n,l,o,r,s,u,a,f,c,d,g,p,m,_,v,w,y,C,E,S,F,$,R,k,M,I;return r=new Ka({}),a=new Ja({}),d=new Wa({}),m=new Xa({props:{feedback:"Bad"}}),w=new Qa({}),E=new Ya({}),M=new Ua({}),{c(){t=A("div"),n=A("div"),l=A("div"),o=A("div"),le(r.$$.fragment),s=N(),u=A("div"),le(a.$$.fragment),f=N(),c=A("div"),le(d.$$.fragment),g=N(),p=A("div"),le(m.$$.fragment),_=N(),v=A("div"),le(w.$$.fragment),y=N(),C=A("div"),le(E.$$.fragment),S=N(),F=A("div"),$=A("div"),$.innerHTML=`
+
`,R=N(),k=A("div"),le(M.$$.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(C,"class","left-filter2"),h(n,"class","feedback-left svelte-14znspc"),h($,"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,V){O(D,t,V),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(w,v,null),b(n,y),b(n,C),ee(E,C,null),b(t,S),b(t,F),b(F,$),b(F,R),b(F,k),ee(M,k,null),I=!0},p:X,i(D){I||(z(r.$$.fragment,D),z(a.$$.fragment,D),z(d.$$.fragment,D),z(m.$$.fragment,D),z(w.$$.fragment,D),z(E.$$.fragment,D),z(M.$$.fragment,D),I=!0)},o(D){q(r.$$.fragment,D),q(a.$$.fragment,D),q(d.$$.fragment,D),q(m.$$.fragment,D),q(w.$$.fragment,D),q(E.$$.fragment,D),q(M.$$.fragment,D),I=!1},d(D){D&&P(t),te(r),te(a),te(d),te(m),te(w),te(E),te(M)}}}function G_(e,t,n){let l;ae(e,Mn,r=>n(0,l=r)),dt(()=>{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]}));Fe(Mn,l=[...a],l)}return[]}class j_ extends fe{constructor(t){super(),ce(this,t,G_,H_,ue,{})}}function B_(e){let t,n;return t=new Za({}),{c(){le(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},i(l){n||(z(t.$$.fragment,l),n=!0)},o(l){q(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function x_(e){let t,n;return t=new j_({}),{c(){le(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},i(l){n||(z(t.$$.fragment,l),n=!0)},o(l){q(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function W_(e){let t,n;return t=new Za({}),{c(){le(t.$$.fragment)},m(l,o){ee(t,l,o),n=!0},i(l){n||(z(t.$$.fragment,l),n=!0)},o(l){q(t.$$.fragment,l),n=!1},d(l){te(t,l)}}}function U_(e){let t,n,l,o;const r=[W_,x_,B_],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=ke()},m(a,f){s[t].m(a,f),O(a,l,f),o=!0},p(a,[f]){let c=t;t=u(a),t!==c&&(_e(),q(s[c],1,1,()=>{s[c]=null}),ve(),n=s[t],n||(n=s[t]=r[t](a),n.c()),z(n,1),n.m(l.parentNode,l))},i(a){o||(z(n),o=!0)},o(a){q(n),o=!1},d(a){s[t].d(a),a&&P(l)}}}function X_(e,t,n){let{feedback:l}=t;return e.$$set=o=>{"feedback"in o&&n(0,l=o.feedback)},[l]}class Y_ extends fe{constructor(t){super(),ce(this,t,X_,U_,ue,{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)}),ve()}r?(t=Mt(r,s()),le(t.$$.fragment),z(t.$$.fragment,1),ee(t,n.parentNode,n)):t=null}else r&&t.$set(f)},i(u){l||(t&&z(t.$$.fragment,u),l=!0)},o(u){t&&q(t.$$.fragment,u),l=!1},d(u){u&&P(n),t&&te(t,u)}}}function Q_(e){let t,n,l,o=e[0].length>1&&Qs(e),r=e[1]&&Js(e);return{c(){o&&o.c(),t=N(),r&&r.c(),n=ke()},m(s,u){o&&o.m(s,u),O(s,t,u),r&&r.m(s,u),O(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&&z(r,1)):(r=Js(s),r.c(),z(r,1),r.m(n.parentNode,n)):r&&(_e(),q(r,1,1,()=>{r=null}),ve())},i(s){l||(z(r),l=!0)},o(s){q(r),l=!1},d(s){o&&o.d(s),s&&P(t),r&&r.d(s),s&&P(n)}}}function K_(e,t,n){let l,o;const r=Ie([]);ae(e,r,c=>n(0,l=c));const s=Ie(null);ae(e,s,c=>n(1,o=c));const u={Chatbot:Kd,Dropdown:eh,Feedback:Y_,Compare:$p,CompareDashboard:jp,RetrievalQA:L_},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 J_ extends fe{constructor(t){super(),ce(this,t,K_,Q_,ue,{})}}new J_({target:document.getElementById("app")});
diff --git a/pykoi/frontend/dist/assets/index-fc934c27.css b/pykoi/frontend/dist/assets/index-fc934c27.css
deleted file mode 100644
index 9573cc7..0000000
--- a/pykoi/frontend/dist/assets/index-fc934c27.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}.answer.svelte-1cug6ja{display:inline-block;text-align:left;padding:10px;border:1px solid var(--black);width:100%}.small-button.svelte-1cug6ja{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-1cug6ja{display:flex;text-align:center;margin:auto;width:20%}.small-button.svelte-1cug6ja:hover{box-shadow:var(--shadow-md)}.thumbs-up.svelte-1cug6ja,.thumbs-up.svelte-1cug6ja:hover,.thumbs-up.svelte-1cug6ja::selection{background:var(--green)}.thumbs-down.svelte-1cug6ja,.thumbs-down.svelte-1cug6ja:hover,.thumbs-down.svelte-1cug6ja::selection{background:var(--red)}.vote-selected.svelte-1cug6ja{border:3px solid black;opacity:1}.vote-not-selected.svelte-1cug6ja{border:3px solid transparent;opacity:.65}.ranked-chat.svelte-yzyd3k.svelte-yzyd3k{height:100vh;display:grid;grid-template-columns:100%;grid-template-rows:80% 20%}.message.svelte-yzyd3k.svelte-yzyd3k{font-size:var(--smallText);padding-left:40px;padding-right:40px;margin:0 auto}.chat-input-holder.svelte-yzyd3k.svelte-yzyd3k{display:flex;flex-direction:column;align-items:center;padding:5px;width:100%;max-width:820px;margin:auto}.chat-input-textarea.svelte-yzyd3k.svelte-yzyd3k{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-yzyd3k.svelte-yzyd3k{display:flex;width:100%}.btnyousend.svelte-yzyd3k.svelte-yzyd3k{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-yzyd3k.svelte-yzyd3k{opacity:1}.green.svelte-yzyd3k.svelte-yzyd3k{border-bottom:2px solid var(--green)}.red.svelte-yzyd3k.svelte-yzyd3k{border-bottom:2px solid var(--red)}.instructions.svelte-yzyd3k.svelte-yzyd3k{text-align:center;padding:5%}.instructions.svelte-yzyd3k h5.svelte-yzyd3k{text-align:left}.instructions.svelte-yzyd3k p.svelte-yzyd3k{font-size:var(--smallText);text-align:left}.instructions.svelte-yzyd3k button.svelte-yzyd3k{font-size:var(--smallText)}.ranked-feedback-container.svelte-yzyd3k.svelte-yzyd3k{display:grid;grid-template-columns:20% 80%}.underline.svelte-yzyd3k.svelte-yzyd3k{border-bottom:var(--line)}.bold.svelte-yzyd3k.svelte-yzyd3k{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-yzyd3k.svelte-yzyd3k{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-yzyd3k.svelte-yzyd3k{flex:1;overflow-y:auto;padding:0 10px;box-sizing:border-box}.chat-message.svelte-yzyd3k.svelte-yzyd3k{background-color:var(--white);border-bottom:var(--line);box-sizing:border-box}.chat-message-center.svelte-yzyd3k.svelte-yzyd3k{display:flex;flex-direction:column;margin-left:auto;margin-right:auto;padding:12px;box-sizing:border-box}.message-content.svelte-yzyd3k.svelte-yzyd3k{display:flex;flex-direction:column;box-sizing:border-box}.message-content.svelte-yzyd3k .question.svelte-yzyd3k{text-align:left;border:1px solid var(--grey);padding:5px;background-color:var(--lightGrey)}.message-content.svelte-yzyd3k .answers.svelte-yzyd3k{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)}.chat-and-question.svelte-uhmrzm.svelte-uhmrzm{display:grid;grid-template-columns:20% 80%;width:100%}.ranked-chat.svelte-uhmrzm.svelte-uhmrzm{height:100vh;display:grid;grid-template-columns:100%;grid-template-rows:65% 35%}.message.svelte-uhmrzm.svelte-uhmrzm{font-size:var(--smallText);padding-left:40px;padding-right:40px;margin:0 auto}.chat-input-holder.svelte-uhmrzm.svelte-uhmrzm{display:flex;flex-direction:column;align-items:center;padding:5px;width:100%;max-width:820px;margin:auto}.chat-input-textarea.svelte-uhmrzm.svelte-uhmrzm{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-uhmrzm.svelte-uhmrzm{display:flex;width:100%}.btnyousend.svelte-uhmrzm.svelte-uhmrzm{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-uhmrzm.svelte-uhmrzm{opacity:1}.green.svelte-uhmrzm.svelte-uhmrzm{border-bottom:2px solid var(--green)}.red.svelte-uhmrzm.svelte-uhmrzm{border-bottom:2px solid var(--red)}.instructions.svelte-uhmrzm.svelte-uhmrzm{text-align:center;padding:5%}.instructions.svelte-uhmrzm h5.svelte-uhmrzm{text-align:left}.instructions.svelte-uhmrzm p.svelte-uhmrzm{font-size:var(--smallText);text-align:left}.instructions.svelte-uhmrzm button.svelte-uhmrzm{font-size:var(--smallText)}.ranked-feedback-container.svelte-uhmrzm.svelte-uhmrzm{display:grid;grid-template-columns:20% 80%}.underline.svelte-uhmrzm.svelte-uhmrzm{border-bottom:var(--line)}.bold{font-weight:700;font-size:var(--smallText);margin:0;padding:0}.chatbox.svelte-uhmrzm.svelte-uhmrzm{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-uhmrzm.svelte-uhmrzm{flex:1;overflow-y:auto;padding:0 10px;box-sizing:border-box}.chat-message.svelte-uhmrzm.svelte-uhmrzm{background-color:var(--white);border-bottom:var(--line);box-sizing:border-box}.chat-message-center.svelte-uhmrzm.svelte-uhmrzm{display:flex;flex-direction:column;margin-left:auto;margin-right:auto;padding:12px;box-sizing:border-box}.message-content.svelte-uhmrzm.svelte-uhmrzm{display:flex;flex-direction:column;box-sizing:border-box}.message-content.svelte-uhmrzm .question.svelte-uhmrzm{text-align:left;border:1px solid var(--grey);padding:5px;background-color:var(--lightGrey)}.message-content.svelte-uhmrzm .answer.svelte-uhmrzm{display:inline-block;text-align:left;padding:10px;border:1px solid var(--black)}.message-content.svelte-uhmrzm .answers.svelte-uhmrzm{display:grid;grid-template-columns:100%;gap:0%;width:100%;margin:auto}.rag-sources.svelte-uhmrzm.svelte-uhmrzm{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}.drop-zone.svelte-14n6h1p{display:flex;flex-direction:column;align-items:center;justify-content:center;border:2px dashed var(--grey);background-color:var(--lightGrey);width:100%;color:#444;min-height:300px}.file-container.svelte-14n6h1p{display:grid;height:calc(100% - var(--headerHeight));align-items:center;justify-content:center}.upload-container.svelte-14n6h1p{margin:auto;max-width:100%;text-align:center}.charts-container.svelte-14n6h1p{height:calc(100vh - var(--headerHeight));display:grid;gap:2%;grid-template-columns:100%;grid-template-rows:50% 40%}.data-grid.svelte-14n6h1p{display:grid;grid-template-columns:45% 50%;gap:8px;margin:auto;max-width:1200px;padding-top:20px}.upload-box.svelte-14n6h1p{display:flex;gap:10px;flex-direction:column;justify-content:center;align-items:center;height:100%;margin:auto;padding:20px;border:1px solid #333;box-sizing:border-box}.upload-files-container.svelte-14n6h1p{display:flex;flex-direction:column;gap:10px;width:90%}p.svelte-14n6h1p{margin:0}.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 dd73712..6a335ce 100644
--- a/pykoi/frontend/dist/index.html
+++ b/pykoi/frontend/dist/index.html
@@ -5,8 +5,8 @@
pykoi
-
-
+
+
diff --git a/pykoi/frontend/src/lib/Chatbots/Components/Dropdown.svelte b/pykoi/frontend/src/lib/Chatbots/Components/Dropdown.svelte
index a46b190..7ee6ded 100644
--- a/pykoi/frontend/src/lib/Chatbots/Components/Dropdown.svelte
+++ b/pykoi/frontend/src/lib/Chatbots/Components/Dropdown.svelte
@@ -47,7 +47,6 @@
function handleClickOutside(e) {
e.preventDefault();
- console.log('click outside');
expanded = false;
}
diff --git a/pykoi/frontend/src/lib/RAG/RAG.svelte b/pykoi/frontend/src/lib/RAG/RAG.svelte
index 8c9f9f7..5c71331 100644
--- a/pykoi/frontend/src/lib/RAG/RAG.svelte
+++ b/pykoi/frontend/src/lib/RAG/RAG.svelte
@@ -29,7 +29,7 @@
event.preventDefault();
resetStates();
uploadState = UPLOAD_STATES.IN_PROGRESS;
- let selectedFiles = [];
+ selectedFiles = [];
if (event.dataTransfer) {
if (event.dataTransfer.items) {
// Use DataTransferItemList interface to access the file(s)
@@ -67,8 +67,9 @@
}
async function loadServerData() {
- if (indexState === UPLOAD_STATES.IN_PROGRESS)
+ if (indexState === UPLOAD_STATES.IN_PROGRESS) {
loadState = UPLOAD_STATES.IN_PROGRESS;
+ }
const response = await fetch("/retrieval/file/get");
const data = await response.json();
// Transform the received data
@@ -80,8 +81,9 @@
};
});
$uploadedFiles = [...filesData];
- if (loadState === UPLOAD_STATES.IN_PROGRESS)
+ if (loadState === UPLOAD_STATES.IN_PROGRESS) {
loadState = UPLOAD_STATES.DONE;
+ }
}
async function indexFiles() {
@@ -108,12 +110,21 @@
event.preventDefault();
}
+ function getSelectedFileNames() {
+ let fileNameStr = "";
+ for (let i = 0; i < selectedFiles.length; i++) {
+ fileNameStr += selectedFiles[i].name + ", ";
+ }
+ return fileNameStr.slice(0, -2);
+ }
+
onMount(() => {
loadServerData();
});
$: {
if (
+ uploadState === UPLOAD_STATES.DONE &&
indexState === UPLOAD_STATES.DONE &&
loadState === UPLOAD_STATES.DONE &&
embedState === UPLOAD_STATES.DONE
@@ -121,16 +132,6 @@
setTimeout(resetStates, 3000);
}
}
-
- // let dotState = 0;
-
- // // Set an interval to periodically change the number of dots
- // setInterval(() => {
- // dotState = (dotState + 1) % 4;
- // }, 200);
-
- // // Use a reactive statement to create the string with the correct number of dots
- // $: dots = ".".repeat(dotState);
@@ -153,6 +154,12 @@
{#if uploadState !== UPLOAD_STATES.WAITING}
+
+
File{selectedFiles.length > 1 ? `s (${selectedFiles.length})` : ""}
+
+ {getSelectedFileNames()}
+
+
Upload
Index
@@ -219,11 +226,13 @@
flex-direction: column;
justify-content: center;
align-items: center;
+ width: 100%;
height: 100%;
margin: auto;
padding: 20px;
border: 1px solid #333;
box-sizing: border-box;
+ overflow: hidden;
}
.upload-files-container {
display: flex;
@@ -231,6 +240,25 @@
gap: 10px;
width: 90%;
}
+ .processing-container {
+ color: grey;
+ display: flex;
+ gap: 4px;
+ font-size: small;
+ }
+
+ .processing-files {
+ margin: 0;
+ max-width: 280px;
+ max-height: 2em;
+ overflow-x: auto;
+ overflow-y: hidden;
+ white-space: nowrap;
+ border: 1px solid var(--grey);
+ border-radius: 0.1em;
+ padding: 0.1em 0.5em;
+ }
+
.upload-status {
display: flex;
gap: 3px;
@@ -276,9 +304,6 @@
background-color: var(--green);
color: var(--lightGrey);
}
- p {
- margin: 0;
- }
.load-left {
border-top-left-radius: 0.5em;
border-bottom-left-radius: 0.5em;
@@ -288,4 +313,7 @@
border-top-right-radius: 0.5em;
border-bottom-right-radius: 0.5em;
}
+ p {
+ margin: 0;
+ }