@getlupa/client 1.15.7 → 1.15.9

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.
@@ -7289,7 +7289,7 @@ var __async = (__this, __arguments, generator) => {
7289
7289
  details: "/{id}"
7290
7290
  },
7291
7291
  elements: [],
7292
- breadcrumbs: [{ label: "Main Page", link: "/" }, { label: "Search: {1}" }]
7292
+ breadcrumbs: []
7293
7293
  };
7294
7294
  const useScreenStore = defineStore("screen", () => {
7295
7295
  const measuredScreenWidth = ref(1e3);
@@ -8128,12 +8128,15 @@ var __async = (__this, __arguments, generator) => {
8128
8128
  value
8129
8129
  };
8130
8130
  };
8131
- const toggleTermFilter = (appendParams, facetAction, getQueryParamName, currentFilters) => {
8131
+ const toggleTermFilter = (appendParams, facetAction, getQueryParamName, currentFilters, paramsToRemove = []) => {
8132
8132
  const currentFilter = currentFilters == null ? void 0 : currentFilters[facetAction.key];
8133
8133
  const newParams = toggleTermParam(currentFilter, facetAction.value);
8134
8134
  appendParams({
8135
8135
  params: [getFacetParam(facetAction.key, newParams)],
8136
- paramsToRemove: [getQueryParamName ? getQueryParamName(QUERY_PARAMS$1.PAGE) : QUERY_PARAMS$1.PAGE]
8136
+ paramsToRemove: [
8137
+ ...paramsToRemove,
8138
+ ...[getQueryParamName ? getQueryParamName(QUERY_PARAMS$1.PAGE) : QUERY_PARAMS$1.PAGE]
8139
+ ]
8137
8140
  });
8138
8141
  };
8139
8142
  const replaceHierarchyParam = (params = [], param = "") => {
@@ -8819,7 +8822,7 @@ var __async = (__this, __arguments, generator) => {
8819
8822
  __name: "SearchBoxMoreResults",
8820
8823
  props: {
8821
8824
  labels: {},
8822
- showTotalCount: { type: Boolean }
8825
+ options: {}
8823
8826
  },
8824
8827
  emits: ["go-to-results"],
8825
8828
  setup(__props, { emit: emit2 }) {
@@ -8827,23 +8830,28 @@ var __async = (__this, __arguments, generator) => {
8827
8830
  const searchBoxStore = useSearchBoxStore();
8828
8831
  const { docResults, options } = storeToRefs(searchBoxStore);
8829
8832
  const totalCount = computed(() => {
8830
- var _a, _b, _c;
8831
- if (!props.showTotalCount) {
8833
+ var _a, _b, _c, _d;
8834
+ if (!((_a = props.options) == null ? void 0 : _a.showTotalCount)) {
8832
8835
  return "";
8833
8836
  }
8834
- const queryKey = (_b = (_a = options.value) == null ? void 0 : _a.panels.find((x2) => x2.type === "document")) == null ? void 0 : _b.queryKey;
8835
- const total = queryKey ? (_c = docResults.value[queryKey]) == null ? void 0 : _c.total : "";
8837
+ const queryKey = (_c = (_b = options.value) == null ? void 0 : _b.panels.find((x2) => x2.type === "document")) == null ? void 0 : _c.queryKey;
8838
+ const total = queryKey ? (_d = docResults.value[queryKey]) == null ? void 0 : _d.total : "";
8836
8839
  return total ? `(${total})` : "";
8837
8840
  });
8841
+ const showMoreResultsButton = computed(() => {
8842
+ var _a;
8843
+ return (_a = props.options.showMoreResultsButton) != null ? _a : true;
8844
+ });
8838
8845
  const handleClick = () => {
8839
8846
  emit2("go-to-results");
8840
8847
  };
8841
8848
  return (_ctx, _cache) => {
8842
- return openBlock(), createElementBlock("a", {
8849
+ return showMoreResultsButton.value ? (openBlock(), createElementBlock("a", {
8850
+ key: 0,
8843
8851
  class: "lupa-more-results",
8844
8852
  "data-cy": "lupa-more-results",
8845
8853
  onClick: handleClick
8846
- }, toDisplayString(_ctx.labels.moreResults) + " " + toDisplayString(totalCount.value), 1);
8854
+ }, toDisplayString(_ctx.labels.moreResults) + " " + toDisplayString(totalCount.value), 1)) : createCommentVNode("", true);
8847
8855
  };
8848
8856
  }
8849
8857
  });
@@ -20049,7 +20057,6 @@ and ensure you are accounting for this risk.
20049
20057
  return resultCountFromRelatedPanel < 1;
20050
20058
  };
20051
20059
  return (_ctx, _cache) => {
20052
- var _a;
20053
20060
  return openBlock(), createElementBlock("div", {
20054
20061
  ref_key: "panelContainer",
20055
20062
  ref: panelContainer
@@ -20066,7 +20073,7 @@ and ensure you are accounting for this risk.
20066
20073
  "data-cy": "lupa-main-panel"
20067
20074
  }, [
20068
20075
  (openBlock(true), createElementBlock(Fragment, null, renderList(displayPanels.value, (panel, index) => {
20069
- var _a2, _b, _c, _d;
20076
+ var _a, _b, _c, _d;
20070
20077
  return openBlock(), createElementBlock("div", {
20071
20078
  key: index,
20072
20079
  class: normalizeClass([
@@ -20076,7 +20083,7 @@ and ensure you are accounting for this risk.
20076
20083
  style: normalizeStyle(panel.gridArea ? { gridArea: `${panel.gridArea}${index}` } : {}),
20077
20084
  "data-cy": "lupa-panel-" + panel.type + "-index"
20078
20085
  }, [
20079
- ((_a2 = panel.labels) == null ? void 0 : _a2.topResultsTitle) && showTopResultsPanelTitle(panel.queryKey) ? (openBlock(), createElementBlock("div", _hoisted_3$y, toDisplayString((_b = panel.labels) == null ? void 0 : _b.topResultsTitle), 1)) : createCommentVNode("", true),
20086
+ ((_a = panel.labels) == null ? void 0 : _a.topResultsTitle) && showTopResultsPanelTitle(panel.queryKey) ? (openBlock(), createElementBlock("div", _hoisted_3$y, toDisplayString((_b = panel.labels) == null ? void 0 : _b.topResultsTitle), 1)) : createCommentVNode("", true),
20080
20087
  ((_c = panel.labels) == null ? void 0 : _c.title) && showPanelTitle(panel) ? (openBlock(), createElementBlock("div", _hoisted_4$p, toDisplayString((_d = panel.labels) == null ? void 0 : _d.title), 1)) : createCommentVNode("", true),
20081
20088
  panel.queryKey && canShowPanel(panel) ? (openBlock(), createBlock(resolveDynamicComponent(getComponent(panel.type)), {
20082
20089
  key: 2,
@@ -20109,9 +20116,9 @@ and ensure you are accounting for this risk.
20109
20116
  unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (openBlock(), createBlock(_sfc_main$1s, {
20110
20117
  key: 2,
20111
20118
  labels: labels.value,
20112
- showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
20119
+ options: _ctx.options,
20113
20120
  onGoToResults: _cache[4] || (_cache[4] = ($event) => _ctx.$emit("go-to-results"))
20114
- }, null, 8, ["labels", "showTotalCount"])) : createCommentVNode("", true)
20121
+ }, null, 8, ["labels", "options"])) : createCommentVNode("", true)
20115
20122
  ])) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_5$g, [
20116
20123
  createVNode(_sfc_main$1q, {
20117
20124
  options: _ctx.options.history,
@@ -20190,7 +20197,8 @@ and ensure you are accounting for this risk.
20190
20197
  "showTotalCount",
20191
20198
  "hideMoreResultsButtonOnNoResults",
20192
20199
  "showNoResultsPanel",
20193
- "expandOnSinglePanel"
20200
+ "expandOnSinglePanel",
20201
+ "showMoreResultsButton"
20194
20202
  ])
20195
20203
  );
20196
20204
  const searchTriggers = computed(() => {
@@ -20663,11 +20671,15 @@ and ensure you are accounting for this risk.
20663
20671
  var _a, _b;
20664
20672
  return (_b = (_a = props.options.labels) == null ? void 0 : _a.searchResultsCount) != null ? _b : "";
20665
20673
  });
20674
+ const searchResultsTitleTemplate = computed(() => {
20675
+ var _a, _b, _c, _d, _e;
20676
+ return ((_c = (_b = (_a = props.options) == null ? void 0 : _a.labels) == null ? void 0 : _b.searchResults) == null ? void 0 : _c.includes("{")) ? addParamsToLabel((_e = (_d = props.options) == null ? void 0 : _d.labels) == null ? void 0 : _e.searchResults, queryText.value) : ``;
20677
+ });
20666
20678
  return (_ctx, _cache) => {
20667
20679
  return openBlock(), createElementBlock("div", null, [
20668
20680
  showSearchTitle.value ? (openBlock(), createElementBlock("h1", _hoisted_1$S, [
20669
- createTextVNode(toDisplayString(_ctx.options.labels.searchResults), 1),
20670
- queryText.value ? (openBlock(), createElementBlock("span", _hoisted_2$F, "'" + toDisplayString(queryText.value) + "'", 1)) : createCommentVNode("", true),
20681
+ createTextVNode(toDisplayString(searchResultsTitleTemplate.value || _ctx.options.labels.searchResults), 1),
20682
+ queryText.value && !searchResultsTitleTemplate.value ? (openBlock(), createElementBlock("span", _hoisted_2$F, "'" + toDisplayString(queryText.value) + "'", 1)) : createCommentVNode("", true),
20671
20683
  showProductCount.value ? (openBlock(), createElementBlock("span", _hoisted_3$w, [
20672
20684
  createTextVNode("(" + toDisplayString(searchResultsCountLabel.value), 1),
20673
20685
  createBaseVNode("span", _hoisted_4$n, toDisplayString(unref(totalItems)), 1),
@@ -24675,26 +24687,104 @@ and ensure you are accounting for this risk.
24675
24687
  RelatedQuerySourceType2["FACETS"] = "facets";
24676
24688
  return RelatedQuerySourceType2;
24677
24689
  })(RelatedQuerySourceType || {});
24678
- const extractFacetsRelatedSource = (source, searchResults2) => {
24690
+ const combineIdenticalValues = (results) => {
24691
+ const result2 = [];
24692
+ const keys = /* @__PURE__ */ new Set();
24693
+ for (const item of results) {
24694
+ const trimmedValue = item.value.trim().toLowerCase();
24695
+ if (!keys.has(trimmedValue)) {
24696
+ keys.add(trimmedValue);
24697
+ result2.push({ key: item.key, value: item.value.trim() });
24698
+ }
24699
+ }
24700
+ return result2;
24701
+ };
24702
+ const processFacetsRelatedSourceSuggestionQuery = (searchText, querySource, options, activeFilters) => __async2(void 0, null, function* () {
24703
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
24704
+ if ((_a = Object.keys(activeFilters != null ? activeFilters : {})) == null ? void 0 : _a.length) {
24705
+ return [];
24706
+ }
24707
+ const lupaQuery = {
24708
+ searchText,
24709
+ limit: 1,
24710
+ trackTerm: false
24711
+ };
24712
+ try {
24713
+ const result2 = yield LupaSearchSdk.suggestions(querySource.queryKey, lupaQuery, options);
24714
+ if (!result2.success || ((_c = (_b = result2.items) == null ? void 0 : _b[0].suggestion) == null ? void 0 : _c.toLocaleLowerCase()) !== (searchText == null ? void 0 : searchText.toLocaleLowerCase())) {
24715
+ return [];
24716
+ }
24717
+ return (_i = (_h = (_f = (_e = (_d = result2.items) == null ? void 0 : _d[0].facets) == null ? void 0 : _e[querySource.facetKey]) == null ? void 0 : _f.map((item) => ({
24718
+ key: querySource.facetKey,
24719
+ value: item.title
24720
+ }))) == null ? void 0 : _h.slice(0, (_g = querySource.maxCount) != null ? _g : 5)) != null ? _i : [];
24721
+ } catch (error) {
24722
+ return [];
24723
+ }
24724
+ });
24725
+ const processFacetsRelatedSourceDocumentQuery = (searchText, querySource, options, activeFilters) => __async2(void 0, null, function* () {
24726
+ const lupaQuery = {
24727
+ searchText,
24728
+ limit: 1,
24729
+ filters: activeFilters,
24730
+ trackTerm: false
24731
+ };
24732
+ try {
24733
+ const result2 = yield LupaSearchSdk.query(querySource.queryKey, lupaQuery, options);
24734
+ if (!result2.success) {
24735
+ return [];
24736
+ }
24737
+ return extractFacetsRelatedSourceFromOriginalQuery(
24738
+ {
24739
+ type: RelatedQuerySourceType.FACETS,
24740
+ key: querySource.facetKey,
24741
+ count: querySource.maxCount
24742
+ },
24743
+ result2
24744
+ );
24745
+ } catch (error) {
24746
+ return [];
24747
+ }
24748
+ });
24749
+ const processFacetsRelatedSourceQuery = (searchText, query, options, activeFilters) => __async2(void 0, null, function* () {
24750
+ switch (query.type) {
24751
+ case "document":
24752
+ return processFacetsRelatedSourceDocumentQuery(searchText, query, options, activeFilters);
24753
+ case "suggestion":
24754
+ return processFacetsRelatedSourceSuggestionQuery(searchText, query, options, activeFilters);
24755
+ }
24756
+ });
24757
+ const extractFacetsRelatedSource = (source, searchResults2, options, activeFilters) => __async2(void 0, null, function* () {
24758
+ var _a, _b;
24759
+ if (!((_a = source.queries) == null ? void 0 : _a.length)) {
24760
+ return extractFacetsRelatedSourceFromOriginalQuery(source, searchResults2);
24761
+ }
24762
+ const promises = source.queries.map(
24763
+ (query) => processFacetsRelatedSourceQuery(searchResults2.searchText, query, options, activeFilters)
24764
+ );
24765
+ const result2 = (yield Promise.all(promises)).flat();
24766
+ return (_b = combineIdenticalValues(result2)) == null ? void 0 : _b.slice(0, source.count);
24767
+ });
24768
+ const extractFacetsRelatedSourceFromOriginalQuery = (source, searchResults2) => __async2(void 0, null, function* () {
24679
24769
  var _a, _b, _c, _d, _e;
24680
24770
  const facet = (_a = searchResults2.facets) == null ? void 0 : _a.find((facet2) => facet2.key === source.key);
24681
24771
  if (!facet) {
24682
24772
  return [];
24683
24773
  }
24684
24774
  if (facet.type === "terms") {
24685
- return (_c = (_b = facet.items) == null ? void 0 : _b.slice(0, source.count)) == null ? void 0 : _c.map((item) => item.title);
24775
+ return (_c = (_b = facet.items) == null ? void 0 : _b.slice(0, source.count)) == null ? void 0 : _c.map((item) => ({ key: source.key, value: item.title }));
24686
24776
  }
24687
24777
  if (facet.type === "hierarchy") {
24688
- return (_e = (_d = facet.items) == null ? void 0 : _d.slice(0, source.count)) == null ? void 0 : _e.map((item) => item.title);
24778
+ return (_e = (_d = facet.items) == null ? void 0 : _d.slice(0, source.count)) == null ? void 0 : _e.map((item) => ({ key: source.key, value: item.title }));
24689
24779
  }
24690
24780
  return [];
24691
- };
24692
- const extractRelatedSource = (source, searchResults2) => {
24781
+ });
24782
+ const extractRelatedSource = (source, searchResults2, options, activeFilters) => __async2(void 0, null, function* () {
24693
24783
  switch (source.type) {
24694
24784
  case RelatedQuerySourceType.FACETS:
24695
- return extractFacetsRelatedSource(source, searchResults2);
24785
+ return extractFacetsRelatedSource(source, searchResults2, options, activeFilters);
24696
24786
  }
24697
- };
24787
+ });
24698
24788
  const _hoisted_1$h = { class: "lupa-related-query-item" };
24699
24789
  const _hoisted_2$e = { class: "lupa-related-query-image" };
24700
24790
  const _hoisted_3$a = { class: "lupa-related-query-label" };
@@ -24707,12 +24797,16 @@ and ensure you are accounting for this risk.
24707
24797
  __name: "RelatedQueryPanel",
24708
24798
  props: {
24709
24799
  query: {},
24710
- options: {}
24800
+ sourceKey: {},
24801
+ options: {},
24802
+ existingItemsFromOtherQueries: {}
24711
24803
  },
24712
- setup(__props) {
24804
+ emits: ["loaded"],
24805
+ setup(__props, { emit: emit2 }) {
24713
24806
  const props = __props;
24714
24807
  const loading = ref(false);
24715
24808
  const relatedQueryResult = ref(null);
24809
+ const itemToDisplay = ref(null);
24716
24810
  const optionsStore = useOptionsStore();
24717
24811
  const searchResultStore = useSearchResultStore();
24718
24812
  const { searchResultOptions } = storeToRefs(optionsStore);
@@ -24733,10 +24827,6 @@ and ensure you are accounting for this risk.
24733
24827
  var _a, _b;
24734
24828
  return ((_b = (_a = relatedQueryResult.value) == null ? void 0 : _a.items) == null ? void 0 : _b.length) > 0;
24735
24829
  });
24736
- const firstResultItem = computed(() => {
24737
- var _a, _b;
24738
- return (_b = (_a = relatedQueryResult.value) == null ? void 0 : _a.items) == null ? void 0 : _b[0];
24739
- });
24740
24830
  const totalItemCount = computed(() => {
24741
24831
  var _a, _b;
24742
24832
  return (_b = (_a = relatedQueryResult.value) == null ? void 0 : _a.total) != null ? _b : 0;
@@ -24746,19 +24836,19 @@ and ensure you are accounting for this risk.
24746
24836
  return ((_a = props.options.source) == null ? void 0 : _a.mode) === "filter" ? (_b = searchResult.value) == null ? void 0 : _b.searchText : (_c = props.query) == null ? void 0 : _c.toLowerCase();
24747
24837
  });
24748
24838
  const relatedQueryFilters = computed(() => {
24749
- var _a, _b, _c;
24839
+ var _a;
24750
24840
  return ((_a = props.options.source) == null ? void 0 : _a.mode) === "filter" ? {
24751
- [(_c = (_b = props.options) == null ? void 0 : _b.source) == null ? void 0 : _c.key]: [props.query]
24841
+ [props.sourceKey]: [props.query]
24752
24842
  } : {};
24753
24843
  });
24754
24844
  const searchForRelatedQuery = () => __async2(this, null, function* () {
24755
- var _a, _b, _c;
24845
+ var _a, _b, _c, _d, _e, _f, _g, _h;
24756
24846
  if (!props.query) {
24757
24847
  return;
24758
24848
  }
24759
24849
  const lupaQuery = {
24760
24850
  searchText: searchText.value,
24761
- limit: 1,
24851
+ limit: 3,
24762
24852
  filters: relatedQueryFilters.value,
24763
24853
  trackTerm: false
24764
24854
  };
@@ -24772,8 +24862,13 @@ and ensure you are accounting for this risk.
24772
24862
  if (result2.success) {
24773
24863
  relatedQueryResult.value = result2;
24774
24864
  }
24865
+ const firstItem = (_c = (_b = relatedQueryResult.value) == null ? void 0 : _b.items) == null ? void 0 : _c[0];
24866
+ itemToDisplay.value = (_f = (_e = (_d = relatedQueryResult == null ? void 0 : relatedQueryResult.value) == null ? void 0 : _d.items) == null ? void 0 : _e.find(
24867
+ (i) => !props.existingItemsFromOtherQueries[`${i.id}`]
24868
+ )) != null ? _f : firstItem;
24869
+ emit2("loaded", itemToDisplay.value);
24775
24870
  } catch (error) {
24776
- (_c = (_b = searchResultOptions.value) == null ? void 0 : _b.options) == null ? void 0 : _c.onError(error);
24871
+ (_h = (_g = searchResultOptions.value) == null ? void 0 : _g.options) == null ? void 0 : _h.onError(error);
24777
24872
  } finally {
24778
24873
  loading.value = false;
24779
24874
  }
@@ -24791,11 +24886,11 @@ and ensure you are accounting for this risk.
24791
24886
  var _a;
24792
24887
  return openBlock(), createElementBlock("div", _hoisted_1$h, [
24793
24888
  createBaseVNode("div", _hoisted_2$e, [
24794
- firstResultItem.value && image.value ? (openBlock(), createBlock(_sfc_main$1l, {
24889
+ itemToDisplay.value && image.value ? (openBlock(), createBlock(_sfc_main$1l, {
24795
24890
  key: 0,
24796
24891
  "wrapper-class": "lupa-related-query-image-wrapper",
24797
24892
  "image-class": "lupa-related-query-image",
24798
- item: firstResultItem.value,
24893
+ item: itemToDisplay.value,
24799
24894
  options: image.value
24800
24895
  }, null, 8, ["item", "options"])) : createCommentVNode("", true)
24801
24896
  ]),
@@ -24827,47 +24922,63 @@ and ensure you are accounting for this risk.
24827
24922
  const paramsStore = useParamsStore();
24828
24923
  const optionsStore = useOptionsStore();
24829
24924
  const { searchResult } = storeToRefs(searchResultStore);
24925
+ const { searchResultOptions } = storeToRefs(optionsStore);
24926
+ const relatedQueries = ref([]);
24927
+ const allDisplayItems = ref({});
24928
+ const querySourceResultMap = ref({});
24830
24929
  const currentSearchText = computed(() => {
24831
24930
  var _a, _b;
24832
24931
  return (_b = (_a = searchResult.value) == null ? void 0 : _a.searchText) != null ? _b : "";
24833
24932
  });
24834
- const relatedQueries = computed(() => {
24835
- if (!props.options || !searchResult.value) {
24836
- return [];
24933
+ const currentFilters = computed(() => paramsStore.filters);
24934
+ const querySources = computed(() => {
24935
+ var _a, _b, _c, _d;
24936
+ return (_d = (_c = (_b = (_a = props.options) == null ? void 0 : _a.source) == null ? void 0 : _b.queries) == null ? void 0 : _c.map((q) => q.facetKey)) != null ? _d : [];
24937
+ });
24938
+ const currentFiltersWithoutQuerySources = computed(() => {
24939
+ const filters = {};
24940
+ if (currentFilters.value) {
24941
+ for (const key in currentFilters.value) {
24942
+ if (!querySources.value.includes(key)) {
24943
+ filters[key] = currentFilters.value[key];
24944
+ }
24945
+ }
24837
24946
  }
24838
- const queries = extractRelatedSource(props.options.source, searchResult.value);
24839
- return queries;
24947
+ return filters;
24840
24948
  });
24949
+ watch(searchResult, () => __async2(this, null, function* () {
24950
+ allDisplayItems.value = {};
24951
+ querySourceResultMap.value = {};
24952
+ if (!props.options || !searchResult.value) {
24953
+ relatedQueries.value = [];
24954
+ }
24955
+ const queries = yield extractRelatedSource(
24956
+ props.options.source,
24957
+ searchResult.value,
24958
+ searchResultOptions.value.options,
24959
+ currentFiltersWithoutQuerySources.value
24960
+ );
24961
+ relatedQueries.value = queries;
24962
+ }));
24841
24963
  const hasEnoughRelatedQueries = computed(() => {
24842
24964
  return relatedQueries.value.length > 1;
24843
24965
  });
24844
- const goToResults = ({ searchText }) => {
24845
- paramsStore.goToResults({ searchText });
24846
- };
24847
24966
  const handleRelatedQueryClick = (query) => {
24848
24967
  var _a;
24849
24968
  if (((_a = props.options.source) == null ? void 0 : _a.mode) === "filter") {
24850
24969
  handleFilter(query);
24851
24970
  } else {
24852
- goToResults({ searchText: query });
24971
+ paramsStore.goToResults({ searchText: query.value });
24853
24972
  }
24854
24973
  };
24855
24974
  const handleFilter = (query) => {
24856
- var _a, _b;
24857
- const facet = (_b = (_a = searchResult.value) == null ? void 0 : _a.facets) == null ? void 0 : _b.find(
24858
- (facet2) => {
24859
- var _a2, _b2;
24860
- return facet2.key === ((_b2 = (_a2 = props.options) == null ? void 0 : _a2.source) == null ? void 0 : _b2.key);
24861
- }
24862
- );
24863
- if (!facet || facet.type !== "terms") {
24864
- return [];
24865
- }
24975
+ var _a;
24866
24976
  toggleTermFilter(
24867
24977
  paramsStore.appendParams,
24868
- { type: "terms", key: facet.key, value: query },
24978
+ { type: "terms", key: query.key, value: query.value },
24869
24979
  optionsStore.getQueryParamName,
24870
- {}
24980
+ {},
24981
+ (_a = querySources.value) == null ? void 0 : _a.map((q) => `f.${q}`)
24871
24982
  );
24872
24983
  };
24873
24984
  const getSelectedFilterClass = (query) => {
@@ -24875,9 +24986,13 @@ and ensure you are accounting for this risk.
24875
24986
  if (((_a = props.options.source) == null ? void 0 : _a.mode) !== "filter") {
24876
24987
  return "";
24877
24988
  }
24878
- return Array.isArray((_c = (_b = searchResult.value) == null ? void 0 : _b.filters) == null ? void 0 : _c[props.options.source.key]) && ((_f = (_e = (_d = searchResult.value) == null ? void 0 : _d.filters) == null ? void 0 : _e[props.options.source.key]) == null ? void 0 : _f.includes(
24879
- query
24880
- )) ? "lupa-selected-related-query-filter" : "";
24989
+ return Array.isArray((_c = (_b = searchResult.value) == null ? void 0 : _b.filters) == null ? void 0 : _c[query.key]) && ((_f = (_e = (_d = searchResult.value) == null ? void 0 : _d.filters) == null ? void 0 : _e[query.key]) == null ? void 0 : _f.includes(query.value)) ? "lupa-selected-related-query-filter" : "";
24990
+ };
24991
+ const processLoadedItem = (query, item) => {
24992
+ if (item) {
24993
+ allDisplayItems.value[`${item.id}`] = item;
24994
+ }
24995
+ querySourceResultMap.value[query.value] = Boolean(item);
24881
24996
  };
24882
24997
  return (_ctx, _cache) => {
24883
24998
  var _a, _b, _c, _d;
@@ -24885,19 +25000,24 @@ and ensure you are accounting for this risk.
24885
25000
  ((_b = (_a = _ctx.options) == null ? void 0 : _a.labels) == null ? void 0 : _b.title) ? (openBlock(), createElementBlock("h3", _hoisted_2$d, toDisplayString((_d = (_c = _ctx.options) == null ? void 0 : _c.labels) == null ? void 0 : _d.title), 1)) : createCommentVNode("", true),
24886
25001
  createBaseVNode("ul", null, [
24887
25002
  (openBlock(true), createElementBlock(Fragment, null, renderList(relatedQueries.value, (query) => {
24888
- return openBlock(), createElementBlock("li", {
24889
- key: query + currentSearchText.value,
25003
+ return withDirectives((openBlock(), createElementBlock("li", {
25004
+ key: query.value + query.key + currentSearchText.value,
24890
25005
  class: normalizeClass(getSelectedFilterClass(query))
24891
25006
  }, [
24892
25007
  createBaseVNode("a", {
24893
25008
  onClick: ($event) => handleRelatedQueryClick(query)
24894
25009
  }, [
24895
25010
  createVNode(_sfc_main$j, {
25011
+ "source-key": query.key,
24896
25012
  options: _ctx.options,
24897
- query
24898
- }, null, 8, ["options", "query"])
25013
+ query: query.value,
25014
+ "existing-items-from-other-queries": allDisplayItems.value,
25015
+ onLoaded: (item) => processLoadedItem(query, item)
25016
+ }, null, 8, ["source-key", "options", "query", "existing-items-from-other-queries", "onLoaded"])
24899
25017
  ], 8, _hoisted_3$9)
24900
- ], 2);
25018
+ ], 2)), [
25019
+ [vShow, querySourceResultMap.value[query.value] !== false]
25020
+ ]);
24901
25021
  }), 128))
24902
25022
  ])
24903
25023
  ])) : createCommentVNode("", true);