@genspectrum/dashboard-components 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/custom-elements.json +228 -0
  2. package/dist/dashboard-components.js +778 -244
  3. package/dist/dashboard-components.js.map +1 -1
  4. package/dist/genspectrum-components.d.ts +119 -9
  5. package/dist/style.css +7 -4
  6. package/package.json +3 -1
  7. package/src/constants.ts +1 -1
  8. package/src/lapisApi/lapisTypes.ts +1 -0
  9. package/src/operator/FillMissingOperator.spec.ts +3 -1
  10. package/src/operator/FillMissingOperator.ts +4 -2
  11. package/src/preact/mutationComparison/queryMutationData.ts +12 -4
  12. package/src/preact/mutationsOverTime/__mockData__/aggregated_date.json +642 -0
  13. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_01.json +1747 -0
  14. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_02.json +1774 -0
  15. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_03.json +1819 -0
  16. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_04.json +1864 -0
  17. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_05.json +1927 -0
  18. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_06.json +1864 -0
  19. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_07.json +9 -0
  20. package/src/preact/mutationsOverTime/getFilteredMutationsOverTime.spec.ts +86 -0
  21. package/src/preact/mutationsOverTime/getFilteredMutationsOverTimeData.ts +62 -0
  22. package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +92 -0
  23. package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +206 -0
  24. package/src/preact/mutationsOverTime/mutations-over-time.tsx +170 -0
  25. package/src/preact/numberSequencesOverTime/getNumberOfSequencesOverTimeTableData.ts +1 -1
  26. package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +1 -0
  27. package/src/preact/shared/table/formatProportion.ts +2 -2
  28. package/src/query/queryAggregatedDataOverTime.ts +8 -33
  29. package/src/query/queryMutationsOverTime.spec.ts +352 -0
  30. package/src/query/queryMutationsOverTime.ts +164 -0
  31. package/src/query/queryNumberOfSequencesOverTime.ts +0 -1
  32. package/src/query/queryRelativeGrowthAdvantage.ts +3 -3
  33. package/src/utils/Map2d.ts +75 -0
  34. package/src/utils/map2d.spec.ts +94 -0
  35. package/src/utils/mutations.ts +5 -1
  36. package/src/utils/temporal.ts +64 -5
  37. package/src/web-components/input/index.ts +1 -0
  38. package/src/web-components/visualization/gs-mutations-over-time.stories.ts +225 -0
  39. package/src/web-components/visualization/gs-mutations-over-time.tsx +107 -0
  40. package/src/web-components/visualization/index.ts +1 -0
@@ -9,6 +9,7 @@ import { VennDiagramController, ArcSlice, extractSets } from "chartjs-chart-venn
9
9
  import { autoUpdate, computePosition, offset, shift, flip, size } from "@floating-ui/dom";
10
10
  import { ReactiveElement } from "@lit/reactive-element";
11
11
  import { BarWithErrorBarsController, BarWithErrorBar } from "chartjs-chart-error-bars";
12
+ import hash from "object-hash";
12
13
  import flatpickr from "flatpickr";
13
14
  /**
14
15
  * @license
@@ -490,14 +491,14 @@ const substitutionsOrDeletionsEndpoint = (lapisUrl, sequenceType) => {
490
491
  return sequenceType === "amino acid" ? `${lapisUrl}/sample/aminoAcidMutations` : `${lapisUrl}/sample/nucleotideMutations`;
491
492
  };
492
493
  const referenceGenomeEndpoint = (lapisUrl) => `${lapisUrl}/sample/referenceGenome`;
493
- var __defProp$b = Object.defineProperty;
494
- var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
495
- var __decorateClass$b = (decorators, target, key, kind) => {
496
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
494
+ var __defProp$d = Object.defineProperty;
495
+ var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
496
+ var __decorateClass$d = (decorators, target, key, kind) => {
497
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
497
498
  for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
498
499
  if (decorator = decorators[i2])
499
500
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
500
- if (kind && result) __defProp$b(target, key, result);
501
+ if (kind && result) __defProp$d(target, key, result);
501
502
  return result;
502
503
  };
503
504
  let App = class extends LitElement {
@@ -528,14 +529,14 @@ let App = class extends LitElement {
528
529
  return this;
529
530
  }
530
531
  };
531
- __decorateClass$b([
532
+ __decorateClass$d([
532
533
  provide({ context: lapisContext }),
533
534
  n2()
534
535
  ], App.prototype, "lapis", 2);
535
- __decorateClass$b([
536
+ __decorateClass$d([
536
537
  provide({ context: referenceGenomeContext })
537
538
  ], App.prototype, "referenceGenome", 2);
538
- App = __decorateClass$b([
539
+ App = __decorateClass$d([
539
540
  t$2("gs-app")
540
541
  ], App);
541
542
  var f$1 = 0;
@@ -558,7 +559,7 @@ function h(n3) {
558
559
  }
559
560
  function p(n3, u2, i2) {
560
561
  var o2 = d(t++, 2);
561
- if (o2.t = n3, !o2.__c && (o2.__ = [i2 ? i2(u2) : D$1(void 0, u2), function(n4) {
562
+ if (o2.t = n3, !o2.__c && (o2.__ = [D$1(void 0, u2), function(n4) {
562
563
  var t2 = o2.__N ? o2.__N[0] : o2.__[0], r2 = o2.t(t2, n4);
563
564
  t2 !== r2 && (o2.__N = [r2, o2.__[1]], o2.__c.setState({}));
564
565
  }], o2.__c = r, !r.u)) {
@@ -773,6 +774,7 @@ class Substitution {
773
774
  this.valueAtReference = valueAtReference;
774
775
  this.substitutionValue = substitutionValue;
775
776
  this.position = position;
777
+ this.type = "substitution";
776
778
  const segmentString = this.segment ? `${this.segment}:` : "";
777
779
  const valueAtReferenceString = this.valueAtReference ? `${this.valueAtReference}` : "";
778
780
  const substitutionValueString = this.substitutionValue ? `${this.substitutionValue}` : "";
@@ -806,6 +808,7 @@ class Deletion {
806
808
  this.segment = segment;
807
809
  this.valueAtReference = valueAtReference;
808
810
  this.position = position;
811
+ this.type = "deletion";
809
812
  const segmentString = this.segment ? `${this.segment}:` : "";
810
813
  const valueAtReferenceString = this.valueAtReference ? `${this.valueAtReference}` : "";
811
814
  this.code = `${segmentString}${valueAtReferenceString}${this.position}-`;
@@ -833,6 +836,7 @@ class Insertion {
833
836
  this.segment = segment;
834
837
  this.position = position;
835
838
  this.insertedSymbols = insertedSymbols;
839
+ this.type = "insertion";
836
840
  this.code = `ins_${this.segment ? `${this.segment}:` : ""}${this.position}:${this.insertedSymbols}`;
837
841
  }
838
842
  equals(other) {
@@ -918,8 +922,8 @@ const compareSubstitutionValues = (a2, b3) => {
918
922
  }
919
923
  return a2.localeCompare(b3);
920
924
  };
921
- const formatProportion = (proportion) => {
922
- return `${(proportion * 100).toFixed(2)}%`;
925
+ const formatProportion = (proportion, digits = 2) => {
926
+ return `${(proportion * 100).toFixed(digits)}%`;
923
927
  };
924
928
  const MutationComparisonTable = ({
925
929
  data,
@@ -1133,6 +1137,12 @@ async function queryMutationData(lapisFilters, sequenceType, lapis) {
1133
1137
  return { mutationData };
1134
1138
  }
1135
1139
  function filterMutationData(data, displayedSegments, displayedMutationTypes) {
1140
+ return data.map((mutationEntry) => ({
1141
+ displayName: mutationEntry.displayName,
1142
+ data: filterBySegmentAndMutationType(mutationEntry.data, displayedSegments, displayedMutationTypes)
1143
+ }));
1144
+ }
1145
+ function filterBySegmentAndMutationType(data, displayedSegments, displayedMutationTypes) {
1136
1146
  const byDisplayedSegments = (mutationEntry) => {
1137
1147
  if (mutationEntry.mutation.segment === void 0) {
1138
1148
  return true;
@@ -1146,10 +1156,7 @@ function filterMutationData(data, displayedSegments, displayedMutationTypes) {
1146
1156
  (displayedMutationType) => displayedMutationType.checked && displayedMutationType.type === mutationEntry.type
1147
1157
  );
1148
1158
  };
1149
- return data.map((mutationEntry) => ({
1150
- displayName: mutationEntry.displayName,
1151
- data: mutationEntry.data.filter(byDisplayedSegments).filter(byDisplayedMutationTypes)
1152
- }));
1159
+ return data.filter(byDisplayedSegments).filter(byDisplayedMutationTypes);
1153
1160
  }
1154
1161
  const LapisUrlContext = createContext$1("");
1155
1162
  function useFloatingUi(referenceRef, floatingRef, middleware, placement) {
@@ -1750,7 +1757,7 @@ const MutationComparisonTabs = ({
1750
1757
  {
1751
1758
  tabs,
1752
1759
  toolbar: /* @__PURE__ */ u$1(
1753
- Toolbar$4,
1760
+ Toolbar$5,
1754
1761
  {
1755
1762
  displayedSegments,
1756
1763
  setDisplayedSegments,
@@ -1764,7 +1771,7 @@ const MutationComparisonTabs = ({
1764
1771
  }
1765
1772
  );
1766
1773
  };
1767
- const Toolbar$4 = ({
1774
+ const Toolbar$5 = ({
1768
1775
  displayedSegments,
1769
1776
  setDisplayedSegments,
1770
1777
  displayedMutationTypes,
@@ -1804,7 +1811,7 @@ const Toolbar$4 = ({
1804
1811
  const gridJsStyle = '.gridjs-head button, .gridjs-footer button {\n cursor: pointer;\n background-color: transparent;\n background-image: none;\n padding: 0;\n margin: 0;\n border: none;\n outline: none;\n}\n\n.gridjs-temp {\n position: relative;\n}\n\n.gridjs-head {\n width: 100%;\n margin-bottom: 5px;\n padding: 5px 1px;\n}\n.gridjs-head::after {\n content: "";\n display: block;\n clear: both;\n}\n.gridjs-head:empty {\n padding: 0;\n border: none;\n}\n\n.gridjs-container {\n overflow: hidden;\n display: inline-block;\n padding: 2px;\n color: #000;\n position: relative;\n z-index: 0;\n}\n\n.gridjs-footer {\n display: block;\n position: relative;\n width: 100%;\n z-index: 5;\n padding: 12px 24px;\n border-top: 1px solid #e5e7eb;\n background-color: #fff;\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.26);\n border-radius: 0 0 8px 8px;\n border-bottom-width: 1px;\n border-color: #e5e7eb;\n}\n.gridjs-footer:empty {\n padding: 0;\n border: none;\n}\n\ninput.gridjs-input {\n outline: none;\n background-color: #fff;\n border: 1px solid #d2d6dc;\n border-radius: 5px;\n padding: 10px 13px;\n font-size: 14px;\n line-height: 1.45;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\ninput.gridjs-input:focus {\n box-shadow: 0 0 0 3px rgba(149, 189, 243, 0.5);\n border-color: #9bc2f7;\n}\n\n.gridjs-pagination {\n color: #3d4044;\n}\n.gridjs-pagination::after {\n content: "";\n display: block;\n clear: both;\n}\n.gridjs-pagination .gridjs-summary {\n float: left;\n margin-top: 5px;\n}\n.gridjs-pagination .gridjs-pages {\n float: right;\n}\n.gridjs-pagination .gridjs-pages button {\n padding: 5px 14px;\n border: 1px solid #d2d6dc;\n background-color: #fff;\n border-right: none;\n outline: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n.gridjs-pagination .gridjs-pages button:focus {\n box-shadow: 0 0 0 2px rgba(149, 189, 243, 0.5);\n position: relative;\n margin-right: -1px;\n border-right: 1px solid #d2d6dc;\n}\n.gridjs-pagination .gridjs-pages button:hover {\n background-color: #f7f7f7;\n color: rgb(60, 66, 87);\n outline: none;\n}\n.gridjs-pagination .gridjs-pages button:disabled,\n.gridjs-pagination .gridjs-pages button[disabled],\n.gridjs-pagination .gridjs-pages button:hover:disabled {\n cursor: default;\n background-color: #fff;\n color: #6b7280;\n}\n.gridjs-pagination .gridjs-pages button.gridjs-spread {\n cursor: default;\n box-shadow: none;\n background-color: #fff;\n}\n.gridjs-pagination .gridjs-pages button.gridjs-currentPage {\n background-color: #f7f7f7;\n font-weight: bold;\n}\n.gridjs-pagination .gridjs-pages button:last-child {\n border-bottom-right-radius: 6px;\n border-top-right-radius: 6px;\n border-right: 1px solid #d2d6dc;\n}\n.gridjs-pagination .gridjs-pages button:first-child {\n border-bottom-left-radius: 6px;\n border-top-left-radius: 6px;\n}\n.gridjs-pagination .gridjs-pages button:last-child:focus {\n margin-right: 0;\n}\n\nbutton.gridjs-sort {\n float: right;\n height: 24px;\n width: 13px;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position-x: center;\n cursor: pointer;\n padding: 0;\n margin: 0;\n border: none;\n outline: none;\n background-size: contain;\n}\nbutton.gridjs-sort-neutral {\n opacity: 0.3;\n background-image: url("data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJDYXBhXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHdpZHRoPSI0MDEuOTk4cHgiIGhlaWdodD0iNDAxLjk5OHB4IiB2aWV3Qm94PSIwIDAgNDAxLjk5OCA0MDEuOTk4IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0MDEuOTk4IDQwMS45OTg7IgoJIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8Zz4KCTxnPgoJCTxwYXRoIGQ9Ik03My4wOTIsMTY0LjQ1MmgyNTUuODEzYzQuOTQ5LDAsOS4yMzMtMS44MDcsMTIuODQ4LTUuNDI0YzMuNjEzLTMuNjE2LDUuNDI3LTcuODk4LDUuNDI3LTEyLjg0NwoJCQljMC00Ljk0OS0xLjgxMy05LjIyOS01LjQyNy0xMi44NUwyMTMuODQ2LDUuNDI0QzIxMC4yMzIsMS44MTIsMjA1Ljk1MSwwLDIwMC45OTksMHMtOS4yMzMsMS44MTItMTIuODUsNS40MjRMNjAuMjQyLDEzMy4zMzEKCQkJYy0zLjYxNywzLjYxNy01LjQyNCw3LjkwMS01LjQyNCwxMi44NWMwLDQuOTQ4LDEuODA3LDkuMjMxLDUuNDI0LDEyLjg0N0M2My44NjMsMTYyLjY0NSw2OC4xNDQsMTY0LjQ1Miw3My4wOTIsMTY0LjQ1MnoiLz4KCQk8cGF0aCBkPSJNMzI4LjkwNSwyMzcuNTQ5SDczLjA5MmMtNC45NTIsMC05LjIzMywxLjgwOC0xMi44NSw1LjQyMWMtMy42MTcsMy42MTctNS40MjQsNy44OTgtNS40MjQsMTIuODQ3CgkJCWMwLDQuOTQ5LDEuODA3LDkuMjMzLDUuNDI0LDEyLjg0OEwxODguMTQ5LDM5Ni41N2MzLjYyMSwzLjYxNyw3LjkwMiw1LjQyOCwxMi44NSw1LjQyOHM5LjIzMy0xLjgxMSwxMi44NDctNS40MjhsMTI3LjkwNy0xMjcuOTA2CgkJCWMzLjYxMy0zLjYxNCw1LjQyNy03Ljg5OCw1LjQyNy0xMi44NDhjMC00Ljk0OC0xLjgxMy05LjIyOS01LjQyNy0xMi44NDdDMzM4LjEzOSwyMzkuMzUzLDMzMy44NTQsMjM3LjU0OSwzMjguOTA1LDIzNy41NDl6Ii8+Cgk8L2c+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPC9zdmc+");\n background-position-y: center;\n}\nbutton.gridjs-sort-asc {\n background-image: url("data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJDYXBhXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHdpZHRoPSIyOTIuMzYycHgiIGhlaWdodD0iMjkyLjM2MXB4IiB2aWV3Qm94PSIwIDAgMjkyLjM2MiAyOTIuMzYxIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAyOTIuMzYyIDI5Mi4zNjE7IgoJIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8Zz4KCTxwYXRoIGQ9Ik0yODYuOTM1LDE5Ny4yODdMMTU5LjAyOCw2OS4zODFjLTMuNjEzLTMuNjE3LTcuODk1LTUuNDI0LTEyLjg0Ny01LjQyNHMtOS4yMzMsMS44MDctMTIuODUsNS40MjRMNS40MjQsMTk3LjI4NwoJCUMxLjgwNywyMDAuOTA0LDAsMjA1LjE4NiwwLDIxMC4xMzRzMS44MDcsOS4yMzMsNS40MjQsMTIuODQ3YzMuNjIxLDMuNjE3LDcuOTAyLDUuNDI1LDEyLjg1LDUuNDI1aDI1NS44MTMKCQljNC45NDksMCw5LjIzMy0xLjgwOCwxMi44NDgtNS40MjVjMy42MTMtMy42MTMsNS40MjctNy44OTgsNS40MjctMTIuODQ3UzI5MC41NDgsMjAwLjkwNCwyODYuOTM1LDE5Ny4yODd6Ii8+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPC9zdmc+");\n background-position-y: 35%;\n background-size: 10px;\n}\nbutton.gridjs-sort-desc {\n background-image: url("data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJDYXBhXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHdpZHRoPSIyOTIuMzYycHgiIGhlaWdodD0iMjkyLjM2MnB4IiB2aWV3Qm94PSIwIDAgMjkyLjM2MiAyOTIuMzYyIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAyOTIuMzYyIDI5Mi4zNjI7IgoJIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8Zz4KCTxwYXRoIGQ9Ik0yODYuOTM1LDY5LjM3N2MtMy42MTQtMy42MTctNy44OTgtNS40MjQtMTIuODQ4LTUuNDI0SDE4LjI3NGMtNC45NTIsMC05LjIzMywxLjgwNy0xMi44NSw1LjQyNAoJCUMxLjgwNyw3Mi45OTgsMCw3Ny4yNzksMCw4Mi4yMjhjMCw0Ljk0OCwxLjgwNyw5LjIyOSw1LjQyNCwxMi44NDdsMTI3LjkwNywxMjcuOTA3YzMuNjIxLDMuNjE3LDcuOTAyLDUuNDI4LDEyLjg1LDUuNDI4CgkJczkuMjMzLTEuODExLDEyLjg0Ny01LjQyOEwyODYuOTM1LDk1LjA3NGMzLjYxMy0zLjYxNyw1LjQyNy03Ljg5OCw1LjQyNy0xMi44NDdDMjkyLjM2Miw3Ny4yNzksMjkwLjU0OCw3Mi45OTgsMjg2LjkzNSw2OS4zNzd6Ii8+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPC9zdmc+");\n background-position-y: 65%;\n background-size: 10px;\n}\nbutton.gridjs-sort:focus {\n outline: none;\n}\n\ntable.gridjs-table {\n width: 100%;\n max-width: 100%;\n border-collapse: collapse;\n text-align: left;\n display: table;\n margin: 0;\n padding: 0;\n overflow: auto;\n table-layout: fixed;\n}\n\n.gridjs-tbody {\n background-color: #fff;\n}\n\ntd.gridjs-td {\n border: 1px solid #e5e7eb;\n padding: 12px 24px;\n background-color: #fff;\n box-sizing: content-box;\n}\ntd.gridjs-td:first-child {\n border-left: none;\n}\ntd.gridjs-td:last-child {\n border-right: none;\n}\ntd.gridjs-message {\n text-align: center;\n}\n\nth.gridjs-th {\n position: relative;\n color: #6b7280;\n background-color: #f9fafb;\n border: 1px solid #e5e7eb;\n border-top: none;\n padding: 14px 24px;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n box-sizing: border-box;\n white-space: nowrap;\n outline: none;\n vertical-align: middle;\n}\nth.gridjs-th .gridjs-th-content {\n text-overflow: ellipsis;\n overflow: hidden;\n width: 100%;\n float: left;\n}\nth.gridjs-th-sort {\n cursor: pointer;\n}\nth.gridjs-th-sort .gridjs-th-content {\n width: calc(100% - 15px);\n}\nth.gridjs-th-sort:hover {\n background-color: #e5e7eb;\n}\nth.gridjs-th-sort:focus {\n background-color: #e5e7eb;\n}\nth.gridjs-th-fixed {\n position: sticky;\n box-shadow: 0 1px 0 0 #e5e7eb;\n}\n@supports (-moz-appearance: none) {\n th.gridjs-th-fixed {\n box-shadow: 0 0 0 1px #e5e7eb;\n }\n}\nth.gridjs-th:first-child {\n border-left: none;\n}\nth.gridjs-th:last-child {\n border-right: none;\n}\n\n.gridjs-tr {\n border: none;\n}\n.gridjs-tr-selected td {\n background-color: #ebf5ff;\n}\n.gridjs-tr:last-child td {\n border-bottom: 0;\n}\n\n.gridjs *,\n.gridjs :after,\n.gridjs :before {\n box-sizing: border-box;\n}\n\n.gridjs-wrapper {\n position: relative;\n z-index: 1;\n overflow: auto;\n width: 100%;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.26);\n border-radius: 8px 8px 0 0;\n display: block;\n border-top-width: 1px;\n border-color: #e5e7eb;\n}\n.gridjs-wrapper:nth-last-of-type(2) {\n border-radius: 8px;\n border-bottom-width: 1px;\n}\n\n.gridjs-search {\n float: left;\n}\n.gridjs-search-input {\n width: 250px;\n}\n\n.gridjs-loading-bar {\n z-index: 10;\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n background-color: #fff;\n opacity: 0.5;\n}\n.gridjs-loading-bar::after {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n transform: translateX(-100%);\n background-image: linear-gradient(90deg, rgba(204, 204, 204, 0) 0, rgba(204, 204, 204, 0.2) 20%, rgba(204, 204, 204, 0.5) 60%, rgba(204, 204, 204, 0));\n animation: shimmer 2s infinite;\n content: "";\n}\n@keyframes shimmer {\n 100% {\n transform: translateX(100%);\n }\n}\n\n.gridjs-td .gridjs-checkbox {\n display: block;\n margin: auto;\n cursor: pointer;\n}\n\n.gridjs-resizable {\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n width: 5px;\n}\n.gridjs-resizable:hover {\n cursor: ew-resize;\n background-color: #9bc2f7;\n}\n/*# sourceMappingURL=mermaid.css?inline.map */';
1805
1812
  const minMaxPercentSliderCss = 'input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n pointer-events: all;\n width: 24px;\n height: 24px;\n background-color: #fff;\n border-radius: 50%;\n box-shadow: 0 0 0 1px #C6C6C6;\n cursor: pointer;\n}\n\ninput[type=range]::-moz-range-thumb {\n -webkit-appearance: none;\n pointer-events: all;\n width: 24px;\n height: 24px;\n background-color: #fff;\n border-radius: 50%;\n box-shadow: 0 0 0 1px #C6C6C6;\n cursor: pointer;\n}\n\ninput[type=range]::-webkit-slider-thumb:hover {\n background: #f7f7f7;\n}\n\ninput[type=range]::-webkit-slider-thumb:active {\n box-shadow: inset 0 0 3px #387bbe, 0 0 9px #387bbe;\n -webkit-box-shadow: inset 0 0 3px #387bbe, 0 0 9px #387bbe;\n}\n\ninput[type="range"] {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n height: 2px;\n width: 100%;\n position: absolute;\n background-color: #C6C6C6;\n pointer-events: none;\n}';
1806
1813
  const tailwindStyle = `/*
1807
- ! tailwindcss v3.4.4 | MIT License | https://tailwindcss.com
1814
+ ! tailwindcss v3.4.6 | MIT License | https://tailwindcss.com
1808
1815
  *//*
1809
1816
  1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
1810
1817
  2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
@@ -4253,9 +4260,6 @@ input.tab:checked + .tab-content,
4253
4260
  .mb-2 {
4254
4261
  margin-bottom: 0.5rem;
4255
4262
  }
4256
- .ml-2 {
4257
- margin-left: 0.5rem;
4258
- }
4259
4263
  .ml-2\\.5 {
4260
4264
  margin-left: 0.625rem;
4261
4265
  }
@@ -4460,6 +4464,9 @@ input.tab:checked + .tab-content,
4460
4464
  padding-top: 1rem;
4461
4465
  padding-bottom: 1rem;
4462
4466
  }
4467
+ .text-center {
4468
+ text-align: center;
4469
+ }
4463
4470
  .text-justify {
4464
4471
  text-align: justify;
4465
4472
  }
@@ -4551,6 +4558,9 @@ input.tab:checked + .tab-content,
4551
4558
  --tw-bg-opacity: 1;
4552
4559
  background-color: rgb(243 244 246 / var(--tw-bg-opacity));
4553
4560
  }
4561
+ .hover\\:font-bold:hover {
4562
+ font-weight: 700;
4563
+ }
4554
4564
  .hover\\:text-blue-700:hover {
4555
4565
  --tw-text-opacity: 1;
4556
4566
  color: rgb(29 78 216 / var(--tw-text-opacity));
@@ -4576,14 +4586,13 @@ input.tab:checked + .tab-content,
4576
4586
  --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);
4577
4587
  box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
4578
4588
  }`;
4579
- var __defProp$a = Object.defineProperty;
4580
- var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
4581
- var __decorateClass$a = (decorators, target, key, kind) => {
4582
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
4589
+ var __defProp$c = Object.defineProperty;
4590
+ var __decorateClass$c = (decorators, target, key, kind) => {
4591
+ var result = void 0;
4583
4592
  for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
4584
4593
  if (decorator = decorators[i2])
4585
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
4586
- if (kind && result) __defProp$a(target, key, result);
4594
+ result = decorator(target, key, result) || result;
4595
+ if (result) __defProp$c(target, key, result);
4587
4596
  return result;
4588
4597
  };
4589
4598
  const tailwindElementCss = unsafeCSS(tailwindStyle);
@@ -4605,25 +4614,25 @@ const _PreactLitAdapter = class _PreactLitAdapter extends ReactiveElement {
4605
4614
  };
4606
4615
  _PreactLitAdapter.styles = [tailwindElementCss, minMaxPercentSliderElementCss];
4607
4616
  let PreactLitAdapter = _PreactLitAdapter;
4608
- __decorateClass$a([
4617
+ __decorateClass$c([
4609
4618
  consume({ context: lapisContext })
4610
- ], PreactLitAdapter.prototype, "lapis", 2);
4611
- __decorateClass$a([
4619
+ ], PreactLitAdapter.prototype, "lapis");
4620
+ __decorateClass$c([
4612
4621
  consume({ context: referenceGenomeContext, subscribe: true })
4613
- ], PreactLitAdapter.prototype, "referenceGenome", 2);
4622
+ ], PreactLitAdapter.prototype, "referenceGenome");
4614
4623
  const gridJsElementCss = unsafeCSS(gridJsStyle);
4615
4624
  const _PreactLitAdapterWithGridJsStyles = class _PreactLitAdapterWithGridJsStyles extends PreactLitAdapter {
4616
4625
  };
4617
4626
  _PreactLitAdapterWithGridJsStyles.styles = [...PreactLitAdapter.styles, gridJsElementCss];
4618
4627
  let PreactLitAdapterWithGridJsStyles = _PreactLitAdapterWithGridJsStyles;
4619
- var __defProp$9 = Object.defineProperty;
4620
- var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
4621
- var __decorateClass$9 = (decorators, target, key, kind) => {
4622
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
4628
+ var __defProp$b = Object.defineProperty;
4629
+ var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
4630
+ var __decorateClass$b = (decorators, target, key, kind) => {
4631
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
4623
4632
  for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
4624
4633
  if (decorator = decorators[i2])
4625
4634
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
4626
- if (kind && result) __defProp$9(target, key, result);
4635
+ if (kind && result) __defProp$b(target, key, result);
4627
4636
  return result;
4628
4637
  };
4629
4638
  let MutationComparisonComponent = class extends PreactLitAdapterWithGridJsStyles {
@@ -4650,25 +4659,25 @@ let MutationComparisonComponent = class extends PreactLitAdapterWithGridJsStyles
4650
4659
  );
4651
4660
  }
4652
4661
  };
4653
- __decorateClass$9([
4662
+ __decorateClass$b([
4654
4663
  n2({ type: Array })
4655
4664
  ], MutationComparisonComponent.prototype, "lapisFilters", 2);
4656
- __decorateClass$9([
4665
+ __decorateClass$b([
4657
4666
  n2({ type: String })
4658
4667
  ], MutationComparisonComponent.prototype, "sequenceType", 2);
4659
- __decorateClass$9([
4668
+ __decorateClass$b([
4660
4669
  n2({ type: Array })
4661
4670
  ], MutationComparisonComponent.prototype, "views", 2);
4662
- __decorateClass$9([
4671
+ __decorateClass$b([
4663
4672
  n2({ type: String })
4664
4673
  ], MutationComparisonComponent.prototype, "width", 2);
4665
- __decorateClass$9([
4674
+ __decorateClass$b([
4666
4675
  n2({ type: String })
4667
4676
  ], MutationComparisonComponent.prototype, "height", 2);
4668
- __decorateClass$9([
4677
+ __decorateClass$b([
4669
4678
  n2({ type: Object })
4670
4679
  ], MutationComparisonComponent.prototype, "pageSize", 2);
4671
- MutationComparisonComponent = __decorateClass$9([
4680
+ MutationComparisonComponent = __decorateClass$b([
4672
4681
  t$2("gs-mutation-comparison")
4673
4682
  ], MutationComparisonComponent);
4674
4683
  function getInsertionsTableData(data) {
@@ -5003,7 +5012,7 @@ const MutationsTabs = ({ mutationsData, sequenceType, views, pageSize }) => {
5003
5012
  };
5004
5013
  const tabs = views.map((view) => getTab(view));
5005
5014
  const toolbar = (activeTab) => /* @__PURE__ */ u$1(
5006
- Toolbar$3,
5015
+ Toolbar$4,
5007
5016
  {
5008
5017
  activeTab,
5009
5018
  displayedSegments,
@@ -5017,7 +5026,7 @@ const MutationsTabs = ({ mutationsData, sequenceType, views, pageSize }) => {
5017
5026
  );
5018
5027
  return /* @__PURE__ */ u$1(Tabs, { tabs, toolbar });
5019
5028
  };
5020
- const Toolbar$3 = ({
5029
+ const Toolbar$4 = ({
5021
5030
  activeTab,
5022
5031
  displayedSegments,
5023
5032
  setDisplayedSegments,
@@ -5070,14 +5079,14 @@ const Toolbar$3 = ({
5070
5079
  /* @__PURE__ */ u$1(Info, { height: "100px", children: "Info for mutations" })
5071
5080
  ] });
5072
5081
  };
5073
- var __defProp$8 = Object.defineProperty;
5074
- var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
5075
- var __decorateClass$8 = (decorators, target, key, kind) => {
5076
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
5082
+ var __defProp$a = Object.defineProperty;
5083
+ var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
5084
+ var __decorateClass$a = (decorators, target, key, kind) => {
5085
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
5077
5086
  for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
5078
5087
  if (decorator = decorators[i2])
5079
5088
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
5080
- if (kind && result) __defProp$8(target, key, result);
5089
+ if (kind && result) __defProp$a(target, key, result);
5081
5090
  return result;
5082
5091
  };
5083
5092
  let MutationsComponent = class extends PreactLitAdapterWithGridJsStyles {
@@ -5104,25 +5113,25 @@ let MutationsComponent = class extends PreactLitAdapterWithGridJsStyles {
5104
5113
  );
5105
5114
  }
5106
5115
  };
5107
- __decorateClass$8([
5116
+ __decorateClass$a([
5108
5117
  n2({ type: Object })
5109
5118
  ], MutationsComponent.prototype, "lapisFilter", 2);
5110
- __decorateClass$8([
5119
+ __decorateClass$a([
5111
5120
  n2({ type: String })
5112
5121
  ], MutationsComponent.prototype, "sequenceType", 2);
5113
- __decorateClass$8([
5122
+ __decorateClass$a([
5114
5123
  n2({ type: Array })
5115
5124
  ], MutationsComponent.prototype, "views", 2);
5116
- __decorateClass$8([
5125
+ __decorateClass$a([
5117
5126
  n2({ type: String })
5118
5127
  ], MutationsComponent.prototype, "width", 2);
5119
- __decorateClass$8([
5128
+ __decorateClass$a([
5120
5129
  n2({ type: String })
5121
5130
  ], MutationsComponent.prototype, "height", 2);
5122
- __decorateClass$8([
5131
+ __decorateClass$a([
5123
5132
  n2({ type: Object })
5124
5133
  ], MutationsComponent.prototype, "pageSize", 2);
5125
- MutationsComponent = __decorateClass$8([
5134
+ MutationsComponent = __decorateClass$a([
5126
5135
  t$2("gs-mutations")
5127
5136
  ], MutationsComponent);
5128
5137
  function getPrevalenceOverTimeTableData(data, granularity) {
@@ -5929,6 +5938,12 @@ class YearMonthDay {
5929
5938
  toString() {
5930
5939
  return this.text;
5931
5940
  }
5941
+ get firstDay() {
5942
+ return this;
5943
+ }
5944
+ get lastDay() {
5945
+ return this;
5946
+ }
5932
5947
  get year() {
5933
5948
  return this.cache.getYear(`${this.yearNumber}`);
5934
5949
  }
@@ -5967,6 +5982,10 @@ class YearWeek {
5967
5982
  const firstDay = dayjs().year(this.isoYearNumber).month(1).date(4).isoWeek(this.isoWeekNumber).startOf("isoWeek");
5968
5983
  return this.cache.getYearMonthDay(firstDay.format("YYYY-MM-DD"));
5969
5984
  }
5985
+ get lastDay() {
5986
+ const lastDay = dayjs().year(this.isoYearNumber).month(12).date(31).isoWeek(this.isoWeekNumber).endOf("isoWeek");
5987
+ return this.cache.getYearMonthDay(lastDay.format("YYYY-MM-DD"));
5988
+ }
5970
5989
  get year() {
5971
5990
  return this.cache.getYear(`${this.isoYearNumber}`);
5972
5991
  }
@@ -5998,6 +6017,11 @@ class YearMonth {
5998
6017
  get firstDay() {
5999
6018
  return this.cache.getYearMonthDay(dayjs(`${this.yearNumber}-${this.monthNumber}-01`).format("YYYY-MM-DD"));
6000
6019
  }
6020
+ get lastDay() {
6021
+ return this.cache.getYearMonthDay(
6022
+ dayjs(`${this.yearNumber}-${this.monthNumber}-01`).endOf("month").format("YYYY-MM-DD")
6023
+ );
6024
+ }
6001
6025
  get year() {
6002
6026
  return this.cache.getYear(`${this.yearNumber}`);
6003
6027
  }
@@ -6028,9 +6052,15 @@ class Year {
6028
6052
  get firstMonth() {
6029
6053
  return this.cache.getYearMonth(`${this.year}-01`);
6030
6054
  }
6055
+ get lastMonth() {
6056
+ return this.cache.getYearMonth(`${this.year}-12`);
6057
+ }
6031
6058
  get firstDay() {
6032
6059
  return this.firstMonth.firstDay;
6033
6060
  }
6061
+ get lastDay() {
6062
+ return this.lastMonth.lastDay;
6063
+ }
6034
6064
  addYears(years) {
6035
6065
  const date = this.firstDay.dayjs.add(years, "year");
6036
6066
  const s2 = date.format("YYYY");
@@ -6140,9 +6170,9 @@ function getMinMaxTemporal(values) {
6140
6170
  }
6141
6171
  }
6142
6172
  if (min === null || max === null) {
6143
- return null;
6173
+ return { min: null, max: null };
6144
6174
  }
6145
- return [min, max];
6175
+ return { min, max };
6146
6176
  }
6147
6177
  function addUnit(temporal, amount) {
6148
6178
  if (temporal instanceof YearMonthDay) {
@@ -6159,6 +6189,29 @@ function addUnit(temporal, amount) {
6159
6189
  }
6160
6190
  throw new Error(`Invalid argument: ${temporal}`);
6161
6191
  }
6192
+ function parseDateStringToTemporal(date, granularity) {
6193
+ const cache = TemporalCache.getInstance();
6194
+ const day = cache.getYearMonthDay(date);
6195
+ switch (granularity) {
6196
+ case "day":
6197
+ return day;
6198
+ case "week":
6199
+ return day.week;
6200
+ case "month":
6201
+ return day.month;
6202
+ case "year":
6203
+ return day.year;
6204
+ }
6205
+ }
6206
+ function dateRangeCompare(a2, b3) {
6207
+ if (a2.dateRange === null) {
6208
+ return 1;
6209
+ }
6210
+ if (b3.dateRange === null) {
6211
+ return -1;
6212
+ }
6213
+ return compareTemporal(a2.dateRange, b3.dateRange);
6214
+ }
6162
6215
  function getMinMaxNumber(values) {
6163
6216
  let min = null;
6164
6217
  let max = null;
@@ -6450,7 +6503,7 @@ class FillMissingOperator {
6450
6503
  if (minMax === null) {
6451
6504
  return childEvaluated;
6452
6505
  }
6453
- const [min, max] = minMax;
6506
+ const { min, max } = minMax;
6454
6507
  const requiredKeys = this.getAllRequiredKeysFn(min, max);
6455
6508
  const content = childEvaluated.content;
6456
6509
  for (const key of requiredKeys) {
@@ -6557,39 +6610,12 @@ function queryAggregatedDataOverTime(filter, granularity, smoothingWindow, lapis
6557
6610
  const sortData = new SortOperator(fillData, dateRangeCompare);
6558
6611
  return smoothingWindow >= 1 ? new SlidingOperator(sortData, smoothingWindow, averageSmoothing) : sortData;
6559
6612
  }
6560
- function mapDateToGranularityRange(d2, granularity) {
6561
- let dateRange = null;
6562
- if (d2.date !== null) {
6563
- const date = TemporalCache.getInstance().getYearMonthDay(d2.date);
6564
- switch (granularity) {
6565
- case "day":
6566
- dateRange = date;
6567
- break;
6568
- case "week":
6569
- dateRange = date.week;
6570
- break;
6571
- case "month":
6572
- dateRange = date.month;
6573
- break;
6574
- case "year":
6575
- dateRange = date.year;
6576
- break;
6577
- }
6578
- }
6613
+ function mapDateToGranularityRange(data, granularity) {
6579
6614
  return {
6580
- dateRange,
6581
- count: d2.count
6615
+ dateRange: data.date === null ? null : parseDateStringToTemporal(data.date, granularity),
6616
+ count: data.count
6582
6617
  };
6583
6618
  }
6584
- function dateRangeCompare(a2, b3) {
6585
- if (a2.dateRange === null) {
6586
- return 1;
6587
- }
6588
- if (b3.dateRange === null) {
6589
- return -1;
6590
- }
6591
- return compareTemporal(a2.dateRange, b3.dateRange);
6592
- }
6593
6619
  function averageSmoothing(slidingWindow) {
6594
6620
  const average = slidingWindow.reduce((acc, curr) => acc + curr.count, 0) / slidingWindow.length;
6595
6621
  const centerIndex = Math.floor(slidingWindow.length / 2);
@@ -6826,7 +6852,7 @@ const PrevalenceOverTimeTabs = ({
6826
6852
  };
6827
6853
  const tabs = views.map((view) => getTab(view));
6828
6854
  const toolbar = (activeTab) => /* @__PURE__ */ u$1(
6829
- Toolbar$2,
6855
+ Toolbar$3,
6830
6856
  {
6831
6857
  activeTab,
6832
6858
  yAxisScaleType,
@@ -6840,7 +6866,7 @@ const PrevalenceOverTimeTabs = ({
6840
6866
  );
6841
6867
  return /* @__PURE__ */ u$1(Tabs, { tabs, toolbar });
6842
6868
  };
6843
- const Toolbar$2 = ({
6869
+ const Toolbar$3 = ({
6844
6870
  activeTab,
6845
6871
  yAxisScaleType,
6846
6872
  setYAxisScaleType,
@@ -6878,14 +6904,14 @@ const PrevalenceOverTimeInfo = () => {
6878
6904
  ] });
6879
6905
  };
6880
6906
  const maxInData = (data) => Math.max(...data.flatMap((variant) => variant.content.map((dataPoint) => dataPoint.prevalence)));
6881
- var __defProp$7 = Object.defineProperty;
6882
- var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
6883
- var __decorateClass$7 = (decorators, target, key, kind) => {
6884
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
6907
+ var __defProp$9 = Object.defineProperty;
6908
+ var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
6909
+ var __decorateClass$9 = (decorators, target, key, kind) => {
6910
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
6885
6911
  for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
6886
6912
  if (decorator = decorators[i2])
6887
6913
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6888
- if (kind && result) __defProp$7(target, key, result);
6914
+ if (kind && result) __defProp$9(target, key, result);
6889
6915
  return result;
6890
6916
  };
6891
6917
  let PrevalenceOverTimeComponent = class extends PreactLitAdapterWithGridJsStyles {
@@ -6926,43 +6952,43 @@ let PrevalenceOverTimeComponent = class extends PreactLitAdapterWithGridJsStyles
6926
6952
  );
6927
6953
  }
6928
6954
  };
6929
- __decorateClass$7([
6955
+ __decorateClass$9([
6930
6956
  n2({ type: Object })
6931
6957
  ], PrevalenceOverTimeComponent.prototype, "numeratorFilter", 2);
6932
- __decorateClass$7([
6958
+ __decorateClass$9([
6933
6959
  n2({ type: Object })
6934
6960
  ], PrevalenceOverTimeComponent.prototype, "denominatorFilter", 2);
6935
- __decorateClass$7([
6961
+ __decorateClass$9([
6936
6962
  n2({ type: String })
6937
6963
  ], PrevalenceOverTimeComponent.prototype, "granularity", 2);
6938
- __decorateClass$7([
6964
+ __decorateClass$9([
6939
6965
  n2({ type: Number })
6940
6966
  ], PrevalenceOverTimeComponent.prototype, "smoothingWindow", 2);
6941
- __decorateClass$7([
6967
+ __decorateClass$9([
6942
6968
  n2({ type: Array })
6943
6969
  ], PrevalenceOverTimeComponent.prototype, "views", 2);
6944
- __decorateClass$7([
6970
+ __decorateClass$9([
6945
6971
  n2({ type: Array })
6946
6972
  ], PrevalenceOverTimeComponent.prototype, "confidenceIntervalMethods", 2);
6947
- __decorateClass$7([
6973
+ __decorateClass$9([
6948
6974
  n2({ type: String })
6949
6975
  ], PrevalenceOverTimeComponent.prototype, "width", 2);
6950
- __decorateClass$7([
6976
+ __decorateClass$9([
6951
6977
  n2({ type: String })
6952
6978
  ], PrevalenceOverTimeComponent.prototype, "height", 2);
6953
- __decorateClass$7([
6979
+ __decorateClass$9([
6954
6980
  n2({ type: String })
6955
6981
  ], PrevalenceOverTimeComponent.prototype, "lapisDateField", 2);
6956
- __decorateClass$7([
6982
+ __decorateClass$9([
6957
6983
  n2({ type: Object })
6958
6984
  ], PrevalenceOverTimeComponent.prototype, "pageSize", 2);
6959
- __decorateClass$7([
6985
+ __decorateClass$9([
6960
6986
  n2({ type: String })
6961
6987
  ], PrevalenceOverTimeComponent.prototype, "yAxisMaxLinear", 2);
6962
- __decorateClass$7([
6988
+ __decorateClass$9([
6963
6989
  n2({ type: String })
6964
6990
  ], PrevalenceOverTimeComponent.prototype, "yAxisMaxLogarithmic", 2);
6965
- PrevalenceOverTimeComponent = __decorateClass$7([
6991
+ PrevalenceOverTimeComponent = __decorateClass$9([
6966
6992
  t$2("gs-prevalence-over-time")
6967
6993
  ], PrevalenceOverTimeComponent);
6968
6994
  Chart.register(...registerables, LogitScale);
@@ -7105,11 +7131,10 @@ async function queryRelativeGrowthAdvantage(numerator, denominator, generationTi
7105
7131
  mapNumerator.evaluate(lapis, signal),
7106
7132
  mapDenominator.evaluate(lapis, signal)
7107
7133
  ]);
7108
- const minMaxDate = getMinMaxTemporal(denominatorData.content.map((d2) => d2.date));
7109
- if (!minMaxDate) {
7134
+ const { min: minDate, max: maxDate } = getMinMaxTemporal(denominatorData.content.map((d2) => d2.date));
7135
+ if (!minDate && !maxDate) {
7110
7136
  return null;
7111
7137
  }
7112
- const [minDate, maxDate] = minMaxDate;
7113
7138
  const numeratorCounts = /* @__PURE__ */ new Map();
7114
7139
  numeratorData.content.forEach((d2) => {
7115
7140
  if (d2.date) {
@@ -7287,14 +7312,14 @@ const RelativeGrowthAdvantageInfo = ({ generationTime }) => {
7287
7312
  ] })
7288
7313
  ] });
7289
7314
  };
7290
- var __defProp$6 = Object.defineProperty;
7291
- var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
7292
- var __decorateClass$6 = (decorators, target, key, kind) => {
7293
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
7315
+ var __defProp$8 = Object.defineProperty;
7316
+ var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
7317
+ var __decorateClass$8 = (decorators, target, key, kind) => {
7318
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
7294
7319
  for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
7295
7320
  if (decorator = decorators[i2])
7296
7321
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7297
- if (kind && result) __defProp$6(target, key, result);
7322
+ if (kind && result) __defProp$8(target, key, result);
7298
7323
  return result;
7299
7324
  };
7300
7325
  let RelativeGrowthAdvantageComponent = class extends PreactLitAdapter {
@@ -7329,34 +7354,34 @@ let RelativeGrowthAdvantageComponent = class extends PreactLitAdapter {
7329
7354
  );
7330
7355
  }
7331
7356
  };
7332
- __decorateClass$6([
7357
+ __decorateClass$8([
7333
7358
  n2({ type: Object })
7334
7359
  ], RelativeGrowthAdvantageComponent.prototype, "numeratorFilter", 2);
7335
- __decorateClass$6([
7360
+ __decorateClass$8([
7336
7361
  n2({ type: Object })
7337
7362
  ], RelativeGrowthAdvantageComponent.prototype, "denominatorFilter", 2);
7338
- __decorateClass$6([
7363
+ __decorateClass$8([
7339
7364
  n2({ type: Number })
7340
7365
  ], RelativeGrowthAdvantageComponent.prototype, "generationTime", 2);
7341
- __decorateClass$6([
7366
+ __decorateClass$8([
7342
7367
  n2({ type: Array })
7343
7368
  ], RelativeGrowthAdvantageComponent.prototype, "views", 2);
7344
- __decorateClass$6([
7369
+ __decorateClass$8([
7345
7370
  n2({ type: String })
7346
7371
  ], RelativeGrowthAdvantageComponent.prototype, "width", 2);
7347
- __decorateClass$6([
7372
+ __decorateClass$8([
7348
7373
  n2({ type: String })
7349
7374
  ], RelativeGrowthAdvantageComponent.prototype, "height", 2);
7350
- __decorateClass$6([
7375
+ __decorateClass$8([
7351
7376
  n2({ type: String })
7352
7377
  ], RelativeGrowthAdvantageComponent.prototype, "lapisDateField", 2);
7353
- __decorateClass$6([
7378
+ __decorateClass$8([
7354
7379
  n2({ type: String })
7355
7380
  ], RelativeGrowthAdvantageComponent.prototype, "yAxisMaxLinear", 2);
7356
- __decorateClass$6([
7381
+ __decorateClass$8([
7357
7382
  n2({ type: String })
7358
7383
  ], RelativeGrowthAdvantageComponent.prototype, "yAxisMaxLogarithmic", 2);
7359
- RelativeGrowthAdvantageComponent = __decorateClass$6([
7384
+ RelativeGrowthAdvantageComponent = __decorateClass$8([
7360
7385
  t$2("gs-relative-growth-advantage")
7361
7386
  ], RelativeGrowthAdvantageComponent);
7362
7387
  const compareAscending = (a2, b3) => {
@@ -7445,22 +7470,22 @@ const AggregatedDataTabs = ({ data, views, fields, pageSize }) => {
7445
7470
  }
7446
7471
  };
7447
7472
  const tabs = views.map((view) => getTab(view));
7448
- return /* @__PURE__ */ u$1(Tabs, { tabs, toolbar: /* @__PURE__ */ u$1(Toolbar$1, { data }) });
7473
+ return /* @__PURE__ */ u$1(Tabs, { tabs, toolbar: /* @__PURE__ */ u$1(Toolbar$2, { data }) });
7449
7474
  };
7450
- const Toolbar$1 = ({ data }) => {
7475
+ const Toolbar$2 = ({ data }) => {
7451
7476
  return /* @__PURE__ */ u$1("div", { class: "flex flex-row", children: [
7452
7477
  /* @__PURE__ */ u$1(CsvDownloadButton, { className: "mx-1 btn btn-xs", getData: () => data, filename: "aggregate.csv" }),
7453
7478
  /* @__PURE__ */ u$1(Info, { height: "100px", children: "Info for aggregate" })
7454
7479
  ] });
7455
7480
  };
7456
- var __defProp$5 = Object.defineProperty;
7457
- var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
7458
- var __decorateClass$5 = (decorators, target, key, kind) => {
7459
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
7481
+ var __defProp$7 = Object.defineProperty;
7482
+ var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
7483
+ var __decorateClass$7 = (decorators, target, key, kind) => {
7484
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
7460
7485
  for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
7461
7486
  if (decorator = decorators[i2])
7462
7487
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7463
- if (kind && result) __defProp$5(target, key, result);
7488
+ if (kind && result) __defProp$7(target, key, result);
7464
7489
  return result;
7465
7490
  };
7466
7491
  let AggregateComponent = class extends PreactLitAdapterWithGridJsStyles {
@@ -7491,31 +7516,31 @@ let AggregateComponent = class extends PreactLitAdapterWithGridJsStyles {
7491
7516
  );
7492
7517
  }
7493
7518
  };
7494
- __decorateClass$5([
7519
+ __decorateClass$7([
7495
7520
  n2({ type: Array })
7496
7521
  ], AggregateComponent.prototype, "fields", 2);
7497
- __decorateClass$5([
7522
+ __decorateClass$7([
7498
7523
  n2({ type: Array })
7499
7524
  ], AggregateComponent.prototype, "views", 2);
7500
- __decorateClass$5([
7525
+ __decorateClass$7([
7501
7526
  n2({ type: Object })
7502
7527
  ], AggregateComponent.prototype, "filter", 2);
7503
- __decorateClass$5([
7528
+ __decorateClass$7([
7504
7529
  n2({ type: String })
7505
7530
  ], AggregateComponent.prototype, "width", 2);
7506
- __decorateClass$5([
7531
+ __decorateClass$7([
7507
7532
  n2({ type: String })
7508
7533
  ], AggregateComponent.prototype, "height", 2);
7509
- __decorateClass$5([
7534
+ __decorateClass$7([
7510
7535
  n2({ type: String })
7511
7536
  ], AggregateComponent.prototype, "initialSortField", 2);
7512
- __decorateClass$5([
7537
+ __decorateClass$7([
7513
7538
  n2({ type: String })
7514
7539
  ], AggregateComponent.prototype, "initialSortDirection", 2);
7515
- __decorateClass$5([
7540
+ __decorateClass$7([
7516
7541
  n2({ type: Object })
7517
7542
  ], AggregateComponent.prototype, "pageSize", 2);
7518
- AggregateComponent = __decorateClass$5([
7543
+ AggregateComponent = __decorateClass$7([
7519
7544
  t$2("gs-aggregate")
7520
7545
  ], AggregateComponent);
7521
7546
  const getNumberOfSequencesOverTimeTableData = (data, dateRangeKey) => {
@@ -7531,7 +7556,7 @@ const getNumberOfSequencesOverTimeTableData = (data, dateRangeKey) => {
7531
7556
  if (minMax === null) {
7532
7557
  return [];
7533
7558
  }
7534
- const allDateRanges = generateAllInRange(...minMax);
7559
+ const allDateRanges = generateAllInRange(minMax.min, minMax.max);
7535
7560
  if (allDateRangesThatOccurInData.has(null)) {
7536
7561
  allDateRanges.unshift(null);
7537
7562
  }
@@ -7729,7 +7754,7 @@ const NumberSequencesOverTimeTabs = ({ views, data, granularity, pageSize }) =>
7729
7754
  {
7730
7755
  tabs: views.map((view) => getTab(view)),
7731
7756
  toolbar: (activeTab) => /* @__PURE__ */ u$1(
7732
- Toolbar,
7757
+ Toolbar$1,
7733
7758
  {
7734
7759
  activeTab,
7735
7760
  data,
@@ -7741,7 +7766,7 @@ const NumberSequencesOverTimeTabs = ({ views, data, granularity, pageSize }) =>
7741
7766
  }
7742
7767
  );
7743
7768
  };
7744
- const Toolbar = ({ activeTab, data, granularity, yAxisScaleType, setYAxisScaleType }) => {
7769
+ const Toolbar$1 = ({ activeTab, data, granularity, yAxisScaleType, setYAxisScaleType }) => {
7745
7770
  return /* @__PURE__ */ u$1(Fragment, { children: [
7746
7771
  activeTab !== "Table" && /* @__PURE__ */ u$1(
7747
7772
  ScalingSelector,
@@ -7766,14 +7791,14 @@ const NumberSequencesOverTimeInfo = () => /* @__PURE__ */ u$1(Info, { height: "1
7766
7791
  /* @__PURE__ */ u$1(InfoHeadline1, { children: "Number of sequences over time" }),
7767
7792
  /* @__PURE__ */ u$1(InfoParagraph, { children: /* @__PURE__ */ u$1("a", { href: "https://github.com/GenSpectrum/dashboard-components/issues/315", children: "TODO" }) })
7768
7793
  ] });
7769
- var __defProp$4 = Object.defineProperty;
7770
- var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
7771
- var __decorateClass$4 = (decorators, target, key, kind) => {
7772
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
7794
+ var __defProp$6 = Object.defineProperty;
7795
+ var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
7796
+ var __decorateClass$6 = (decorators, target, key, kind) => {
7797
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
7773
7798
  for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
7774
7799
  if (decorator = decorators[i2])
7775
7800
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7776
- if (kind && result) __defProp$4(target, key, result);
7801
+ if (kind && result) __defProp$6(target, key, result);
7777
7802
  return result;
7778
7803
  };
7779
7804
  let NumberSequencesOverTimeComponent = class extends PreactLitAdapterWithGridJsStyles {
@@ -7804,57 +7829,455 @@ let NumberSequencesOverTimeComponent = class extends PreactLitAdapterWithGridJsS
7804
7829
  );
7805
7830
  }
7806
7831
  };
7807
- __decorateClass$4([
7832
+ __decorateClass$6([
7808
7833
  n2({ type: Object })
7809
7834
  ], NumberSequencesOverTimeComponent.prototype, "lapisFilter", 2);
7810
- __decorateClass$4([
7835
+ __decorateClass$6([
7811
7836
  n2({ type: String })
7812
7837
  ], NumberSequencesOverTimeComponent.prototype, "lapisDateField", 2);
7813
- __decorateClass$4([
7838
+ __decorateClass$6([
7814
7839
  n2({ type: Array })
7815
7840
  ], NumberSequencesOverTimeComponent.prototype, "views", 2);
7816
- __decorateClass$4([
7841
+ __decorateClass$6([
7817
7842
  n2({ type: String })
7818
7843
  ], NumberSequencesOverTimeComponent.prototype, "width", 2);
7819
- __decorateClass$4([
7844
+ __decorateClass$6([
7820
7845
  n2({ type: String })
7821
7846
  ], NumberSequencesOverTimeComponent.prototype, "height", 2);
7822
- __decorateClass$4([
7847
+ __decorateClass$6([
7823
7848
  n2({ type: String })
7824
7849
  ], NumberSequencesOverTimeComponent.prototype, "granularity", 2);
7825
- __decorateClass$4([
7850
+ __decorateClass$6([
7826
7851
  n2({ type: Number })
7827
7852
  ], NumberSequencesOverTimeComponent.prototype, "smoothingWindow", 2);
7828
- __decorateClass$4([
7853
+ __decorateClass$6([
7829
7854
  n2({ type: Object })
7830
7855
  ], NumberSequencesOverTimeComponent.prototype, "pageSize", 2);
7831
- NumberSequencesOverTimeComponent = __decorateClass$4([
7856
+ NumberSequencesOverTimeComponent = __decorateClass$6([
7832
7857
  t$2("gs-number-sequences-over-time")
7833
7858
  ], NumberSequencesOverTimeComponent);
7834
- const PRESET_VALUE_CUSTOM = "custom";
7835
- const PRESET_VALUE_ALL_TIMES = "allTimes";
7836
- const PRESET_VALUE_LAST_2_WEEKS = "last2Weeks";
7837
- const PRESET_VALUE_LAST_MONTH = "lastMonth";
7838
- const PRESET_VALUE_LAST_2_MONTHS = "last2Months";
7839
- const PRESET_VALUE_LAST_3_MONTHS = "last3Months";
7840
- const PRESET_VALUE_LAST_6_MONTHS = "last6Months";
7841
- const presets = {
7842
- [PRESET_VALUE_CUSTOM]: { label: "Custom" },
7843
- [PRESET_VALUE_ALL_TIMES]: { label: "All times" },
7844
- [PRESET_VALUE_LAST_2_WEEKS]: { label: "Last 2 weeks" },
7845
- [PRESET_VALUE_LAST_MONTH]: { label: "Last month" },
7846
- [PRESET_VALUE_LAST_2_MONTHS]: { label: "Last 2 months" },
7847
- [PRESET_VALUE_LAST_3_MONTHS]: { label: "Last 3 months" },
7848
- [PRESET_VALUE_LAST_6_MONTHS]: { label: "Last 6 months" }
7849
- };
7850
- const getSelectableOptions = (customSelectOptions) => {
7851
- const presetOptions = Object.entries(presets).map(([key, value]) => {
7852
- return { label: value.label, value: key };
7853
- });
7854
- const customOptions = customSelectOptions.map((customSelectOption) => {
7855
- return { label: customSelectOption.label, value: customSelectOption.label };
7859
+ function getFilteredMutationOverTimeData(data, displayedSegments, displayedMutationTypes, proportionInterval) {
7860
+ const filteredData = data.copy();
7861
+ filterDisplayedSegments(displayedSegments, filteredData);
7862
+ filterMutationTypes(displayedMutationTypes, filteredData);
7863
+ filterProportion(filteredData, proportionInterval);
7864
+ return filteredData;
7865
+ }
7866
+ function filterDisplayedSegments(displayedSegments, data) {
7867
+ displayedSegments.forEach((segment) => {
7868
+ if (!segment.checked) {
7869
+ data.getFirstAxisKeys().forEach((mutation) => {
7870
+ if (mutation.segment === segment.segment) {
7871
+ data.deleteRow(mutation);
7872
+ }
7873
+ });
7874
+ }
7856
7875
  });
7857
- return [...presetOptions, ...customOptions];
7876
+ }
7877
+ function filterMutationTypes(displayedMutationTypes, data) {
7878
+ displayedMutationTypes.forEach((mutationType) => {
7879
+ if (!mutationType.checked) {
7880
+ data.getFirstAxisKeys().forEach((mutation) => {
7881
+ if (mutationType.type === mutation.type) {
7882
+ data.deleteRow(mutation);
7883
+ }
7884
+ });
7885
+ }
7886
+ });
7887
+ }
7888
+ function filterProportion(data, proportionInterval) {
7889
+ data.getFirstAxisKeys().forEach((mutation) => {
7890
+ const row = data.getRow(mutation, 0);
7891
+ if (!row.some((value) => value >= proportionInterval.min && value <= proportionInterval.max)) {
7892
+ data.deleteRow(mutation);
7893
+ }
7894
+ });
7895
+ }
7896
+ const MutationsOverTimeGrid = ({ data }) => {
7897
+ const mutations = data.getFirstAxisKeys();
7898
+ const dates = data.getSecondAxisKeys().sort((a2, b3) => compareTemporal(a2, b3));
7899
+ return /* @__PURE__ */ u$1(
7900
+ "div",
7901
+ {
7902
+ style: {
7903
+ display: "grid",
7904
+ gridTemplateRows: `repeat(${mutations.length}, 24px)`,
7905
+ gridTemplateColumns: `8rem repeat(${dates.length}, minmax(1.5rem, 1fr))`
7906
+ },
7907
+ children: mutations.map((mutation, i2) => {
7908
+ return /* @__PURE__ */ u$1(Fragment, { children: [
7909
+ /* @__PURE__ */ u$1(
7910
+ "div",
7911
+ {
7912
+ style: { gridRowStart: i2 + 1, gridColumnStart: 1 },
7913
+ children: /* @__PURE__ */ u$1(MutationCell, { mutation })
7914
+ },
7915
+ `mutation-${mutation.toString()}`
7916
+ ),
7917
+ dates.map((date, j2) => {
7918
+ const value = data.get(mutation, date) ?? 0;
7919
+ return /* @__PURE__ */ u$1(
7920
+ "div",
7921
+ {
7922
+ style: { gridRowStart: i2 + 1, gridColumnStart: j2 + 2 },
7923
+ children: /* @__PURE__ */ u$1(ProportionCell, { value, date, mutation })
7924
+ },
7925
+ `${mutation.toString()}-${date.toString()}`
7926
+ );
7927
+ })
7928
+ ] }, `fragment-${mutation.toString()}`);
7929
+ })
7930
+ }
7931
+ );
7932
+ };
7933
+ const ProportionCell = ({ value }) => {
7934
+ return /* @__PURE__ */ u$1(Fragment, { children: /* @__PURE__ */ u$1("div", { className: "py-1", children: /* @__PURE__ */ u$1(
7935
+ "div",
7936
+ {
7937
+ style: { backgroundColor: backgroundColor(value), color: textColor(value) },
7938
+ className: "text-center hover:font-bold text-xs",
7939
+ children: formatProportion(value, 0)
7940
+ }
7941
+ ) }) });
7942
+ };
7943
+ const backgroundColor = (proportion) => {
7944
+ const minAlpha = 0;
7945
+ const maxAlpha = 1;
7946
+ const alpha = minAlpha + (maxAlpha - minAlpha) * proportion;
7947
+ return singleGraphColorRGBByName("indigo", alpha);
7948
+ };
7949
+ const textColor = (proportion) => {
7950
+ return proportion > 0.5 ? "white" : "black";
7951
+ };
7952
+ const MutationCell = ({ mutation }) => {
7953
+ return /* @__PURE__ */ u$1("div", { className: "text-center", children: mutation.toString() });
7954
+ };
7955
+ class Map2d {
7956
+ constructor(serializeFirstAxis = (key) => typeof key === "string" ? key : hash(key), serializeSecondAxis = (key) => typeof key === "string" ? key : hash(key)) {
7957
+ this.serializeFirstAxis = serializeFirstAxis;
7958
+ this.serializeSecondAxis = serializeSecondAxis;
7959
+ this.data = /* @__PURE__ */ new Map();
7960
+ this.keysFirstAxis = /* @__PURE__ */ new Map();
7961
+ this.keysSecondAxis = /* @__PURE__ */ new Map();
7962
+ }
7963
+ get(keyFirstAxis, keySecondAxis) {
7964
+ var _a;
7965
+ const serializedKeyFirstAxis = this.serializeFirstAxis(keyFirstAxis);
7966
+ const serializedKeySecondAxis = this.serializeSecondAxis(keySecondAxis);
7967
+ return (_a = this.data.get(serializedKeyFirstAxis)) == null ? void 0 : _a.get(serializedKeySecondAxis);
7968
+ }
7969
+ getRow(key, fillEmptyWith) {
7970
+ const serializedKeyFirstAxis = this.serializeFirstAxis(key);
7971
+ const row = this.data.get(serializedKeyFirstAxis);
7972
+ if (row === void 0) {
7973
+ return [];
7974
+ }
7975
+ return Array.from(this.keysSecondAxis.keys()).map((key2) => row.get(key2) ?? fillEmptyWith);
7976
+ }
7977
+ set(keyFirstAxis, keySecondAxis, value) {
7978
+ const serializedKeyFirstAxis = this.serializeFirstAxis(keyFirstAxis);
7979
+ const serializedKeySecondAxis = this.serializeSecondAxis(keySecondAxis);
7980
+ if (!this.data.has(serializedKeyFirstAxis)) {
7981
+ this.data.set(serializedKeyFirstAxis, /* @__PURE__ */ new Map());
7982
+ }
7983
+ this.data.get(serializedKeyFirstAxis).set(serializedKeySecondAxis, value);
7984
+ this.keysFirstAxis.set(serializedKeyFirstAxis, keyFirstAxis);
7985
+ this.keysSecondAxis.set(serializedKeySecondAxis, keySecondAxis);
7986
+ }
7987
+ deleteRow(key) {
7988
+ const serializedKeyFirstAxis = this.serializeFirstAxis(key);
7989
+ this.data.delete(serializedKeyFirstAxis);
7990
+ this.keysFirstAxis.delete(serializedKeyFirstAxis);
7991
+ }
7992
+ getFirstAxisKeys() {
7993
+ return Array.from(this.keysFirstAxis.values());
7994
+ }
7995
+ getSecondAxisKeys() {
7996
+ return Array.from(this.keysSecondAxis.values());
7997
+ }
7998
+ getAsArray(fillEmptyWith) {
7999
+ return this.getFirstAxisKeys().map((firstAxisKey) => {
8000
+ return this.getSecondAxisKeys().map((secondAxisKey) => {
8001
+ return this.get(firstAxisKey, secondAxisKey) ?? fillEmptyWith;
8002
+ });
8003
+ });
8004
+ }
8005
+ copy() {
8006
+ const copy = new Map2d(this.serializeFirstAxis, this.serializeSecondAxis);
8007
+ this.data.forEach((value, key) => {
8008
+ const keyFirstAxis = this.keysFirstAxis.get(key);
8009
+ value.forEach((value2, key2) => {
8010
+ const keySecondAxis = this.keysSecondAxis.get(key2);
8011
+ copy.set(keyFirstAxis, keySecondAxis, value2);
8012
+ });
8013
+ });
8014
+ return copy;
8015
+ }
8016
+ }
8017
+ async function queryMutationsOverTimeData(lapisFilter, sequenceType, lapis, lapisDateField, granularity, signal) {
8018
+ const allDates = await getDatesInDataset(lapisFilter, lapis, granularity, lapisDateField, signal);
8019
+ const subQueries = allDates.map(async (date) => {
8020
+ const dateFrom = date.firstDay.toString();
8021
+ const dateTo = date.lastDay.toString();
8022
+ const filter = {
8023
+ ...lapisFilter,
8024
+ [`${lapisDateField}From`]: dateFrom,
8025
+ [`${lapisDateField}To`]: dateTo
8026
+ };
8027
+ const data2 = await fetchAndPrepareSubstitutionsOrDeletions(filter, sequenceType).evaluate(lapis, signal);
8028
+ return {
8029
+ date,
8030
+ mutations: data2.content
8031
+ };
8032
+ });
8033
+ const data = await Promise.all(subQueries);
8034
+ return groupByMutation(data);
8035
+ }
8036
+ async function getDatesInDataset(lapisFilter, lapis, granularity, lapisDateField, signal) {
8037
+ const { content: availableDates } = await queryAvailableDates(
8038
+ lapisFilter,
8039
+ lapis,
8040
+ granularity,
8041
+ lapisDateField,
8042
+ signal
8043
+ );
8044
+ const { dateFrom, dateTo } = getDateRangeFromFilter(lapisFilter, lapisDateField, granularity);
8045
+ const { min, max } = getMinMaxTemporal(availableDates);
8046
+ return generateAllInRange(dateFrom ?? min, dateTo ?? max);
8047
+ }
8048
+ function getDateRangeFromFilter(lapisFilter, lapisDateField, granularity) {
8049
+ const valueFromFilter = lapisFilter[lapisDateField];
8050
+ if (valueFromFilter) {
8051
+ return {
8052
+ dateFrom: parseDateStringToTemporal(valueFromFilter, granularity),
8053
+ dateTo: parseDateStringToTemporal(valueFromFilter, granularity)
8054
+ };
8055
+ }
8056
+ const minFromFilter = lapisFilter[`${lapisDateField}From`];
8057
+ const maxFromFilter = lapisFilter[`${lapisDateField}To`];
8058
+ return {
8059
+ dateFrom: minFromFilter ? parseDateStringToTemporal(minFromFilter, granularity) : null,
8060
+ dateTo: maxFromFilter ? parseDateStringToTemporal(maxFromFilter, granularity) : null
8061
+ };
8062
+ }
8063
+ function queryAvailableDates(lapisFilter, lapis, granularity, lapisDateField, signal) {
8064
+ return fetchAndPrepareDates(lapisFilter, granularity, lapisDateField).evaluate(lapis, signal);
8065
+ }
8066
+ function fetchAndPrepareDates(filter, granularity, lapisDateField) {
8067
+ const fetchData = new FetchAggregatedOperator(filter, [lapisDateField]);
8068
+ const dataWithFixedDateKey = new RenameFieldOperator(fetchData, lapisDateField, "date");
8069
+ const mapData = new MapOperator(dataWithFixedDateKey, (data) => mapDateToGranularityRange(data, granularity));
8070
+ const groupByData = new GroupByAndSumOperator(mapData, "dateRange", "count");
8071
+ const sortData = new SortOperator(groupByData, dateRangeCompare);
8072
+ return new MapOperator(sortData, (data) => data.dateRange);
8073
+ }
8074
+ function fetchAndPrepareSubstitutionsOrDeletions(filter, sequenceType) {
8075
+ return new FetchSubstitutionsOrDeletionsOperator(filter, sequenceType, 1e-3);
8076
+ }
8077
+ function groupByMutation(data) {
8078
+ const dataArray = new Map2d(
8079
+ (mutation) => mutation.code,
8080
+ (date) => date.toString()
8081
+ );
8082
+ data.forEach((mutationData) => {
8083
+ mutationData.mutations.forEach((mutationEntry) => {
8084
+ dataArray.set(mutationEntry.mutation, mutationData.date, mutationEntry.proportion);
8085
+ });
8086
+ });
8087
+ addZeroValuesForDatesWithNoMutationData(dataArray, data);
8088
+ return dataArray;
8089
+ }
8090
+ function addZeroValuesForDatesWithNoMutationData(dataArray, data) {
8091
+ if (dataArray.getFirstAxisKeys().length !== 0) {
8092
+ const someMutation = dataArray.getFirstAxisKeys()[0];
8093
+ data.forEach((mutationData) => {
8094
+ if (mutationData.mutations.length === 0) {
8095
+ dataArray.set(someMutation, mutationData.date, 0);
8096
+ }
8097
+ });
8098
+ }
8099
+ }
8100
+ const MutationsOverTime = ({ width, height, ...innerProps }) => {
8101
+ const size2 = { height, width };
8102
+ return /* @__PURE__ */ u$1(ErrorBoundary, { size: size2, children: /* @__PURE__ */ u$1(ResizeContainer, { size: size2, children: /* @__PURE__ */ u$1(MutationsOverTimeInner, { ...innerProps }) }) });
8103
+ };
8104
+ const MutationsOverTimeInner = ({
8105
+ lapisFilter,
8106
+ sequenceType,
8107
+ views,
8108
+ granularity,
8109
+ lapisDateField
8110
+ }) => {
8111
+ const lapis = x(LapisUrlContext);
8112
+ const { data, error, isLoading } = useQuery(async () => {
8113
+ return queryMutationsOverTimeData(lapisFilter, sequenceType, lapis, lapisDateField, granularity);
8114
+ }, [lapisFilter, sequenceType, lapis, granularity, lapisDateField]);
8115
+ if (isLoading) {
8116
+ return /* @__PURE__ */ u$1(LoadingDisplay, {});
8117
+ }
8118
+ if (error !== null) {
8119
+ return /* @__PURE__ */ u$1(ErrorDisplay, { error });
8120
+ }
8121
+ if (data === null) {
8122
+ return /* @__PURE__ */ u$1(NoDataDisplay, {});
8123
+ }
8124
+ return /* @__PURE__ */ u$1(MutationsOverTimeTabs, { mutationOverTimeData: data, sequenceType, views });
8125
+ };
8126
+ const MutationsOverTimeTabs = ({
8127
+ mutationOverTimeData,
8128
+ sequenceType,
8129
+ views
8130
+ }) => {
8131
+ const [proportionInterval, setProportionInterval] = h({ min: 0.05, max: 0.9 });
8132
+ const [displayedSegments, setDisplayedSegments] = useDisplayedSegments(sequenceType);
8133
+ const [displayedMutationTypes, setDisplayedMutationTypes] = h([
8134
+ { label: "Substitutions", checked: true, type: "substitution" },
8135
+ { label: "Deletions", checked: true, type: "deletion" }
8136
+ ]);
8137
+ const filteredData = T(
8138
+ () => getFilteredMutationOverTimeData(
8139
+ mutationOverTimeData,
8140
+ displayedSegments,
8141
+ displayedMutationTypes,
8142
+ proportionInterval
8143
+ ),
8144
+ [mutationOverTimeData, displayedSegments, displayedMutationTypes, proportionInterval]
8145
+ );
8146
+ const getTab = (view) => {
8147
+ switch (view) {
8148
+ case "grid":
8149
+ return {
8150
+ title: "Grid",
8151
+ content: /* @__PURE__ */ u$1(MutationsOverTimeGrid, { data: filteredData })
8152
+ };
8153
+ }
8154
+ };
8155
+ const tabs = views.map((view) => getTab(view));
8156
+ const toolbar = () => /* @__PURE__ */ u$1(
8157
+ Toolbar,
8158
+ {
8159
+ displayedSegments,
8160
+ setDisplayedSegments,
8161
+ displayedMutationTypes,
8162
+ setDisplayedMutationTypes,
8163
+ proportionInterval,
8164
+ setProportionInterval
8165
+ }
8166
+ );
8167
+ return /* @__PURE__ */ u$1(Tabs, { tabs, toolbar });
8168
+ };
8169
+ const Toolbar = ({
8170
+ displayedSegments,
8171
+ setDisplayedSegments,
8172
+ displayedMutationTypes,
8173
+ setDisplayedMutationTypes,
8174
+ proportionInterval,
8175
+ setProportionInterval
8176
+ }) => {
8177
+ return /* @__PURE__ */ u$1(Fragment, { children: [
8178
+ /* @__PURE__ */ u$1(SegmentSelector, { displayedSegments, setDisplayedSegments }),
8179
+ /* @__PURE__ */ u$1(
8180
+ MutationTypeSelector,
8181
+ {
8182
+ setDisplayedMutationTypes,
8183
+ displayedMutationTypes
8184
+ }
8185
+ ),
8186
+ /* @__PURE__ */ u$1(Fragment, { children: /* @__PURE__ */ u$1(
8187
+ ProportionSelectorDropdown,
8188
+ {
8189
+ proportionInterval,
8190
+ setMinProportion: (min) => setProportionInterval((prev) => ({ ...prev, min })),
8191
+ setMaxProportion: (max) => setProportionInterval((prev) => ({ ...prev, max }))
8192
+ }
8193
+ ) }),
8194
+ /* @__PURE__ */ u$1(Info, { height: "100px", children: "Info for mutations over time" })
8195
+ ] });
8196
+ };
8197
+ var __defProp$5 = Object.defineProperty;
8198
+ var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
8199
+ var __decorateClass$5 = (decorators, target, key, kind) => {
8200
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
8201
+ for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
8202
+ if (decorator = decorators[i2])
8203
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8204
+ if (kind && result) __defProp$5(target, key, result);
8205
+ return result;
8206
+ };
8207
+ let MutationsOverTimeComponent = class extends PreactLitAdapterWithGridJsStyles {
8208
+ constructor() {
8209
+ super(...arguments);
8210
+ this.lapisFilter = {};
8211
+ this.sequenceType = "nucleotide";
8212
+ this.views = ["grid"];
8213
+ this.width = "100%";
8214
+ this.height = "700px";
8215
+ this.granularity = "week";
8216
+ this.lapisDateField = "date";
8217
+ }
8218
+ render() {
8219
+ return /* @__PURE__ */ u$1(
8220
+ MutationsOverTime,
8221
+ {
8222
+ lapisFilter: this.lapisFilter,
8223
+ sequenceType: this.sequenceType,
8224
+ views: this.views,
8225
+ width: this.width,
8226
+ height: this.height,
8227
+ granularity: this.granularity,
8228
+ lapisDateField: this.lapisDateField
8229
+ }
8230
+ );
8231
+ }
8232
+ };
8233
+ __decorateClass$5([
8234
+ n2({ type: Object })
8235
+ ], MutationsOverTimeComponent.prototype, "lapisFilter", 2);
8236
+ __decorateClass$5([
8237
+ n2({ type: String })
8238
+ ], MutationsOverTimeComponent.prototype, "sequenceType", 2);
8239
+ __decorateClass$5([
8240
+ n2({ type: Array })
8241
+ ], MutationsOverTimeComponent.prototype, "views", 2);
8242
+ __decorateClass$5([
8243
+ n2({ type: String })
8244
+ ], MutationsOverTimeComponent.prototype, "width", 2);
8245
+ __decorateClass$5([
8246
+ n2({ type: String })
8247
+ ], MutationsOverTimeComponent.prototype, "height", 2);
8248
+ __decorateClass$5([
8249
+ n2({ type: String })
8250
+ ], MutationsOverTimeComponent.prototype, "granularity", 2);
8251
+ __decorateClass$5([
8252
+ n2({ type: String })
8253
+ ], MutationsOverTimeComponent.prototype, "lapisDateField", 2);
8254
+ MutationsOverTimeComponent = __decorateClass$5([
8255
+ t$2("gs-mutations-over-time")
8256
+ ], MutationsOverTimeComponent);
8257
+ const PRESET_VALUE_CUSTOM = "custom";
8258
+ const PRESET_VALUE_ALL_TIMES = "allTimes";
8259
+ const PRESET_VALUE_LAST_2_WEEKS = "last2Weeks";
8260
+ const PRESET_VALUE_LAST_MONTH = "lastMonth";
8261
+ const PRESET_VALUE_LAST_2_MONTHS = "last2Months";
8262
+ const PRESET_VALUE_LAST_3_MONTHS = "last3Months";
8263
+ const PRESET_VALUE_LAST_6_MONTHS = "last6Months";
8264
+ const presets = {
8265
+ [PRESET_VALUE_CUSTOM]: { label: "Custom" },
8266
+ [PRESET_VALUE_ALL_TIMES]: { label: "All times" },
8267
+ [PRESET_VALUE_LAST_2_WEEKS]: { label: "Last 2 weeks" },
8268
+ [PRESET_VALUE_LAST_MONTH]: { label: "Last month" },
8269
+ [PRESET_VALUE_LAST_2_MONTHS]: { label: "Last 2 months" },
8270
+ [PRESET_VALUE_LAST_3_MONTHS]: { label: "Last 3 months" },
8271
+ [PRESET_VALUE_LAST_6_MONTHS]: { label: "Last 6 months" }
8272
+ };
8273
+ const getSelectableOptions = (customSelectOptions) => {
8274
+ const presetOptions = Object.entries(presets).map(([key, value]) => {
8275
+ return { label: value.label, value: key };
8276
+ });
8277
+ const customOptions = customSelectOptions.map((customSelectOption) => {
8278
+ return { label: customSelectOption.label, value: customSelectOption.label };
8279
+ });
8280
+ return [...presetOptions, ...customOptions];
7858
8281
  };
7859
8282
  const getDatesForSelectorValue = (selectorValue, customSelectOptions, earliestDate) => {
7860
8283
  const today = /* @__PURE__ */ new Date();
@@ -8091,14 +8514,14 @@ const DateRangeSelectorInner = ({
8091
8514
  ] })
8092
8515
  ] });
8093
8516
  };
8094
- var __defProp$3 = Object.defineProperty;
8095
- var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
8096
- var __decorateClass$3 = (decorators, target, key, kind) => {
8097
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
8517
+ var __defProp$4 = Object.defineProperty;
8518
+ var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
8519
+ var __decorateClass$4 = (decorators, target, key, kind) => {
8520
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
8098
8521
  for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
8099
8522
  if (decorator = decorators[i2])
8100
8523
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8101
- if (kind && result) __defProp$3(target, key, result);
8524
+ if (kind && result) __defProp$4(target, key, result);
8102
8525
  return result;
8103
8526
  };
8104
8527
  let DateRangeSelectorComponent = class extends PreactLitAdapter {
@@ -8127,28 +8550,28 @@ let DateRangeSelectorComponent = class extends PreactLitAdapter {
8127
8550
  );
8128
8551
  }
8129
8552
  };
8130
- __decorateClass$3([
8553
+ __decorateClass$4([
8131
8554
  n2({ type: Array })
8132
8555
  ], DateRangeSelectorComponent.prototype, "customSelectOptions", 2);
8133
- __decorateClass$3([
8556
+ __decorateClass$4([
8134
8557
  n2({ type: String })
8135
8558
  ], DateRangeSelectorComponent.prototype, "earliestDate", 2);
8136
- __decorateClass$3([
8559
+ __decorateClass$4([
8137
8560
  n2()
8138
8561
  ], DateRangeSelectorComponent.prototype, "initialValue", 2);
8139
- __decorateClass$3([
8562
+ __decorateClass$4([
8140
8563
  n2()
8141
8564
  ], DateRangeSelectorComponent.prototype, "initialDateFrom", 2);
8142
- __decorateClass$3([
8565
+ __decorateClass$4([
8143
8566
  n2()
8144
8567
  ], DateRangeSelectorComponent.prototype, "initialDateTo", 2);
8145
- __decorateClass$3([
8568
+ __decorateClass$4([
8146
8569
  n2({ type: String })
8147
8570
  ], DateRangeSelectorComponent.prototype, "width", 2);
8148
- __decorateClass$3([
8571
+ __decorateClass$4([
8149
8572
  n2({ type: String })
8150
8573
  ], DateRangeSelectorComponent.prototype, "dateColumn", 2);
8151
- DateRangeSelectorComponent = __decorateClass$3([
8574
+ DateRangeSelectorComponent = __decorateClass$4([
8152
8575
  t$2("gs-date-range-selector")
8153
8576
  ], DateRangeSelectorComponent);
8154
8577
  async function fetchAutocompletionList(fields, lapis, signal) {
@@ -8264,14 +8687,14 @@ const hasMatchingEntry = (data, eventDetail) => {
8264
8687
  const matchingEntries = Object.entries(eventDetail).filter(([, value]) => value !== void 0).reduce((filteredData, [key, value]) => filteredData.filter((it) => it[key] === value), data);
8265
8688
  return matchingEntries.length > 0;
8266
8689
  };
8267
- var __defProp$2 = Object.defineProperty;
8268
- var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
8269
- var __decorateClass$2 = (decorators, target, key, kind) => {
8270
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
8690
+ var __defProp$3 = Object.defineProperty;
8691
+ var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
8692
+ var __decorateClass$3 = (decorators, target, key, kind) => {
8693
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
8271
8694
  for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
8272
8695
  if (decorator = decorators[i2])
8273
8696
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8274
- if (kind && result) __defProp$2(target, key, result);
8697
+ if (kind && result) __defProp$3(target, key, result);
8275
8698
  return result;
8276
8699
  };
8277
8700
  let LocationFilterComponent = class extends PreactLitAdapter {
@@ -8294,19 +8717,19 @@ let LocationFilterComponent = class extends PreactLitAdapter {
8294
8717
  );
8295
8718
  }
8296
8719
  };
8297
- __decorateClass$2([
8720
+ __decorateClass$3([
8298
8721
  n2()
8299
8722
  ], LocationFilterComponent.prototype, "initialValue", 2);
8300
- __decorateClass$2([
8723
+ __decorateClass$3([
8301
8724
  n2({ type: Array })
8302
8725
  ], LocationFilterComponent.prototype, "fields", 2);
8303
- __decorateClass$2([
8726
+ __decorateClass$3([
8304
8727
  n2({ type: String })
8305
8728
  ], LocationFilterComponent.prototype, "width", 2);
8306
- __decorateClass$2([
8729
+ __decorateClass$3([
8307
8730
  n2()
8308
8731
  ], LocationFilterComponent.prototype, "placeholderText", 2);
8309
- LocationFilterComponent = __decorateClass$2([
8732
+ LocationFilterComponent = __decorateClass$3([
8310
8733
  t$2("gs-location-filter")
8311
8734
  ], LocationFilterComponent);
8312
8735
  async function fetchAutocompleteList(lapis, field, signal) {
@@ -8366,14 +8789,14 @@ const TextInputInner = ({ lapisField, placeholderText, initialValue }) => {
8366
8789
  /* @__PURE__ */ u$1("datalist", { id: lapisField, children: data.map((item) => /* @__PURE__ */ u$1("option", { value: item }, item)) })
8367
8790
  ] });
8368
8791
  };
8369
- var __defProp$1 = Object.defineProperty;
8370
- var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
8371
- var __decorateClass$1 = (decorators, target, key, kind) => {
8372
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
8792
+ var __defProp$2 = Object.defineProperty;
8793
+ var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
8794
+ var __decorateClass$2 = (decorators, target, key, kind) => {
8795
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
8373
8796
  for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
8374
8797
  if (decorator = decorators[i2])
8375
8798
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8376
- if (kind && result) __defProp$1(target, key, result);
8799
+ if (kind && result) __defProp$2(target, key, result);
8377
8800
  return result;
8378
8801
  };
8379
8802
  let TextInputComponent = class extends PreactLitAdapter {
@@ -8396,19 +8819,19 @@ let TextInputComponent = class extends PreactLitAdapter {
8396
8819
  );
8397
8820
  }
8398
8821
  };
8399
- __decorateClass$1([
8822
+ __decorateClass$2([
8400
8823
  n2()
8401
8824
  ], TextInputComponent.prototype, "initialValue", 2);
8402
- __decorateClass$1([
8825
+ __decorateClass$2([
8403
8826
  n2()
8404
8827
  ], TextInputComponent.prototype, "lapisField", 2);
8405
- __decorateClass$1([
8828
+ __decorateClass$2([
8406
8829
  n2()
8407
8830
  ], TextInputComponent.prototype, "placeholderText", 2);
8408
- __decorateClass$1([
8831
+ __decorateClass$2([
8409
8832
  n2({ type: String })
8410
8833
  ], TextInputComponent.prototype, "width", 2);
8411
- TextInputComponent = __decorateClass$1([
8834
+ TextInputComponent = __decorateClass$2([
8412
8835
  t$2("gs-text-input")
8413
8836
  ], TextInputComponent);
8414
8837
  const ReferenceGenomesAwaiter = ({ children }) => {
@@ -8867,68 +9290,68 @@ const SelectedMutationDisplay = ({ selectedFilters, setSelectedFilters, fireChan
8867
9290
  ] });
8868
9291
  };
8869
9292
  const SelectedAminoAcidInsertion = ({ insertion, onDelete }) => {
8870
- const backgroundColor = singleGraphColorRGBByName("teal", 0.3);
8871
- const textColor = singleGraphColorRGBByName("teal", 1);
9293
+ const backgroundColor2 = singleGraphColorRGBByName("teal", 0.3);
9294
+ const textColor2 = singleGraphColorRGBByName("teal", 1);
8872
9295
  return /* @__PURE__ */ u$1(
8873
9296
  SelectedFilter,
8874
9297
  {
8875
9298
  mutation: insertion,
8876
9299
  onDelete,
8877
- backgroundColor,
8878
- textColor
9300
+ backgroundColor: backgroundColor2,
9301
+ textColor: textColor2
8879
9302
  }
8880
9303
  );
8881
9304
  };
8882
9305
  const SelectedAminoAcidMutation = ({ mutation, onDelete }) => {
8883
- const backgroundColor = singleGraphColorRGBByName("rose", 0.3);
8884
- const textColor = singleGraphColorRGBByName("rose", 1);
9306
+ const backgroundColor2 = singleGraphColorRGBByName("rose", 0.3);
9307
+ const textColor2 = singleGraphColorRGBByName("rose", 1);
8885
9308
  return /* @__PURE__ */ u$1(
8886
9309
  SelectedFilter,
8887
9310
  {
8888
9311
  mutation,
8889
9312
  onDelete,
8890
- backgroundColor,
8891
- textColor
9313
+ backgroundColor: backgroundColor2,
9314
+ textColor: textColor2
8892
9315
  }
8893
9316
  );
8894
9317
  };
8895
9318
  const SelectedNucleotideMutation = ({ mutation, onDelete }) => {
8896
- const backgroundColor = singleGraphColorRGBByName("indigo", 0.3);
8897
- const textColor = singleGraphColorRGBByName("indigo", 1);
9319
+ const backgroundColor2 = singleGraphColorRGBByName("indigo", 0.3);
9320
+ const textColor2 = singleGraphColorRGBByName("indigo", 1);
8898
9321
  return /* @__PURE__ */ u$1(
8899
9322
  SelectedFilter,
8900
9323
  {
8901
9324
  mutation,
8902
9325
  onDelete,
8903
- backgroundColor,
8904
- textColor
9326
+ backgroundColor: backgroundColor2,
9327
+ textColor: textColor2
8905
9328
  }
8906
9329
  );
8907
9330
  };
8908
9331
  const SelectedNucleotideInsertion = ({ insertion, onDelete }) => {
8909
- const backgroundColor = singleGraphColorRGBByName("green", 0.3);
8910
- const textColor = singleGraphColorRGBByName("green", 1);
9332
+ const backgroundColor2 = singleGraphColorRGBByName("green", 0.3);
9333
+ const textColor2 = singleGraphColorRGBByName("green", 1);
8911
9334
  return /* @__PURE__ */ u$1(
8912
9335
  SelectedFilter,
8913
9336
  {
8914
9337
  mutation: insertion,
8915
9338
  onDelete,
8916
- backgroundColor,
8917
- textColor
9339
+ backgroundColor: backgroundColor2,
9340
+ textColor: textColor2
8918
9341
  }
8919
9342
  );
8920
9343
  };
8921
9344
  const SelectedFilter = ({
8922
9345
  mutation,
8923
9346
  onDelete,
8924
- backgroundColor,
8925
- textColor
9347
+ backgroundColor: backgroundColor2,
9348
+ textColor: textColor2
8926
9349
  }) => {
8927
9350
  return /* @__PURE__ */ u$1(
8928
9351
  "span",
8929
9352
  {
8930
9353
  class: "inline-block mx-1 px-2 py-1 font-medium text-xs rounded-full",
8931
- style: { backgroundColor, color: textColor },
9354
+ style: { backgroundColor: backgroundColor2, color: textColor2 },
8932
9355
  children: [
8933
9356
  mutation.toString(),
8934
9357
  /* @__PURE__ */ u$1("button", { type: "button", onClick: () => onDelete(mutation), children: /* @__PURE__ */ u$1(DeleteIcon, {}) })
@@ -8944,14 +9367,14 @@ function mapToMutationFilterStrings(selectedFilters) {
8944
9367
  nucleotideInsertions: selectedFilters.nucleotideInsertions.map((insertion) => insertion.toString())
8945
9368
  };
8946
9369
  }
8947
- var __defProp = Object.defineProperty;
8948
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8949
- var __decorateClass = (decorators, target, key, kind) => {
8950
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
9370
+ var __defProp$1 = Object.defineProperty;
9371
+ var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
9372
+ var __decorateClass$1 = (decorators, target, key, kind) => {
9373
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
8951
9374
  for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
8952
9375
  if (decorator = decorators[i2])
8953
9376
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8954
- if (kind && result) __defProp(target, key, result);
9377
+ if (kind && result) __defProp$1(target, key, result);
8955
9378
  return result;
8956
9379
  };
8957
9380
  let MutationFilterComponent = class extends PreactLitAdapter {
@@ -8964,23 +9387,134 @@ let MutationFilterComponent = class extends PreactLitAdapter {
8964
9387
  return /* @__PURE__ */ u$1(ReferenceGenomesAwaiter, { children: /* @__PURE__ */ u$1(MutationFilter, { initialValue: this.initialValue, width: this.width }) });
8965
9388
  }
8966
9389
  };
8967
- __decorateClass([
9390
+ __decorateClass$1([
8968
9391
  n2({ type: Object })
8969
9392
  ], MutationFilterComponent.prototype, "initialValue", 2);
8970
- __decorateClass([
9393
+ __decorateClass$1([
8971
9394
  n2({ type: String })
8972
9395
  ], MutationFilterComponent.prototype, "width", 2);
8973
- MutationFilterComponent = __decorateClass([
9396
+ MutationFilterComponent = __decorateClass$1([
8974
9397
  t$2("gs-mutation-filter")
8975
9398
  ], MutationFilterComponent);
9399
+ async function fetchLineageAutocompleteList(lapis, field, signal) {
9400
+ const fetchAggregatedOperator = new FetchAggregatedOperator({}, [field]);
9401
+ const data = (await fetchAggregatedOperator.evaluate(lapis, signal)).content;
9402
+ return data.flatMap((item) => [item[field], `${item[field]}*`]).sort();
9403
+ }
9404
+ const LineageFilter = ({ width, ...innerProps }) => {
9405
+ const size2 = { width, height: "3rem" };
9406
+ return /* @__PURE__ */ u$1(ErrorBoundary, { size: size2, children: /* @__PURE__ */ u$1(ResizeContainer, { size: size2, children: /* @__PURE__ */ u$1(LineageFilterInner, { ...innerProps }) }) });
9407
+ };
9408
+ const LineageFilterInner = ({
9409
+ lapisField,
9410
+ placeholderText,
9411
+ initialValue
9412
+ }) => {
9413
+ const lapis = x(LapisUrlContext);
9414
+ const inputRef = A(null);
9415
+ const { data, error, isLoading } = useQuery(
9416
+ () => fetchLineageAutocompleteList(lapis, lapisField),
9417
+ [lapisField, lapis]
9418
+ );
9419
+ if (isLoading) {
9420
+ return /* @__PURE__ */ u$1(LoadingDisplay, {});
9421
+ }
9422
+ if (error !== null) {
9423
+ return /* @__PURE__ */ u$1(ErrorDisplay, { error });
9424
+ }
9425
+ if (data === null) {
9426
+ return /* @__PURE__ */ u$1(NoDataDisplay, {});
9427
+ }
9428
+ const onInput = () => {
9429
+ var _a, _b, _c;
9430
+ const value = ((_a = inputRef.current) == null ? void 0 : _a.value) === "" ? void 0 : (_b = inputRef.current) == null ? void 0 : _b.value;
9431
+ if (isValidValue(value)) {
9432
+ (_c = inputRef.current) == null ? void 0 : _c.dispatchEvent(
9433
+ new CustomEvent("gs-lineage-filter-changed", {
9434
+ detail: { [lapisField]: value },
9435
+ bubbles: true,
9436
+ composed: true
9437
+ })
9438
+ );
9439
+ }
9440
+ };
9441
+ const isValidValue = (value) => {
9442
+ if (value === void 0) {
9443
+ return true;
9444
+ }
9445
+ return data.includes(value);
9446
+ };
9447
+ return /* @__PURE__ */ u$1(Fragment, { children: [
9448
+ /* @__PURE__ */ u$1(
9449
+ "input",
9450
+ {
9451
+ type: "text",
9452
+ class: "input input-bordered w-full",
9453
+ placeholder: placeholderText !== void 0 ? placeholderText : lapisField,
9454
+ onInput,
9455
+ ref: inputRef,
9456
+ list: lapisField,
9457
+ value: initialValue
9458
+ }
9459
+ ),
9460
+ /* @__PURE__ */ u$1("datalist", { id: lapisField, children: data.map((item) => /* @__PURE__ */ u$1("option", { value: item }, item)) })
9461
+ ] });
9462
+ };
9463
+ var __defProp = Object.defineProperty;
9464
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9465
+ var __decorateClass = (decorators, target, key, kind) => {
9466
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
9467
+ for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
9468
+ if (decorator = decorators[i2])
9469
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9470
+ if (kind && result) __defProp(target, key, result);
9471
+ return result;
9472
+ };
9473
+ let LineageFilterComponent = class extends PreactLitAdapter {
9474
+ constructor() {
9475
+ super(...arguments);
9476
+ this.initialValue = "";
9477
+ this.lapisField = "";
9478
+ this.placeholderText = "";
9479
+ this.width = "100%";
9480
+ }
9481
+ render() {
9482
+ return /* @__PURE__ */ u$1(
9483
+ LineageFilter,
9484
+ {
9485
+ lapisField: this.lapisField,
9486
+ placeholderText: this.placeholderText,
9487
+ initialValue: this.initialValue,
9488
+ width: this.width
9489
+ }
9490
+ );
9491
+ }
9492
+ };
9493
+ __decorateClass([
9494
+ n2()
9495
+ ], LineageFilterComponent.prototype, "initialValue", 2);
9496
+ __decorateClass([
9497
+ n2()
9498
+ ], LineageFilterComponent.prototype, "lapisField", 2);
9499
+ __decorateClass([
9500
+ n2()
9501
+ ], LineageFilterComponent.prototype, "placeholderText", 2);
9502
+ __decorateClass([
9503
+ n2({ type: String })
9504
+ ], LineageFilterComponent.prototype, "width", 2);
9505
+ LineageFilterComponent = __decorateClass([
9506
+ t$2("gs-lineage-filter")
9507
+ ], LineageFilterComponent);
8976
9508
  export {
8977
9509
  AggregateComponent,
8978
9510
  App,
8979
9511
  DateRangeSelectorComponent,
9512
+ LineageFilterComponent,
8980
9513
  LocationFilterComponent,
8981
9514
  MutationComparisonComponent,
8982
9515
  MutationFilterComponent,
8983
9516
  MutationsComponent,
9517
+ MutationsOverTimeComponent,
8984
9518
  NumberSequencesOverTimeComponent,
8985
9519
  PrevalenceOverTimeComponent,
8986
9520
  RelativeGrowthAdvantageComponent,