@depict-ai/ui 2.1.11 → 2.1.13

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.
package/ES10/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { add_to_version_info as $8tj43$add_to_version_info, base64_encode_unicode as $8tj43$base64_encode_unicode, base64_decode_unicode as $8tj43$base64_decode_unicode, dlog as $8tj43$dlog, queueMacroTask as $8tj43$queueMacroTask, catchify as $8tj43$catchify, is_safari as $8tj43$is_safari, observer as $8tj43$observer, dwarn as $8tj43$dwarn, Amazing_Slider as $8tj43$Amazing_Slider, slider_snap_css as $8tj43$slider_snap_css, slider_fading_factory as $8tj43$slider_fading_factory, slider_fractional_factory as $8tj43$slider_fractional_factory, camelCasifyObject as $8tj43$camelCasifyObject, make_random_classname as $8tj43$make_random_classname, n_col_styling_with_dist as $8tj43$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $8tj43$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $8tj43$layout_get_total_rec_amount_for_row, layout_media_query_header as $8tj43$layout_media_query_header, report as $8tj43$report, useExpandingContainer as $8tj43$useExpandingContainer, standard_price_format as $8tj43$standard_price_format, hex_to_rgb as $8tj43$hex_to_rgb, relative_luminance_from_rgb as $8tj43$relative_luminance_from_rgb, fetch_recs as $8tj43$fetch_recs, snakeCasifyObject as $8tj43$snakeCasifyObject, instant_exec_on_suspect_history_change as $8tj43$instant_exec_on_suspect_history_change, base_url as $8tj43$base_url, get_depict_id as $8tj43$get_depict_id, get_user_id as $8tj43$get_user_id, get_session_id as $8tj43$get_session_id, make_url_with_query_params as $8tj43$make_url_with_query_params, fetch_retry as $8tj43$fetch_retry, add_version_query_params as $8tj43$add_version_query_params, sort_obj as $8tj43$sort_obj, edit_current_page_meta_tags as $8tj43$edit_current_page_meta_tags, javascript_media_query as $8tj43$javascript_media_query, use_href_accessor as $8tj43$use_href_accessor, is_debug as $8tj43$is_debug, make_asyncIterable_exiter as $8tj43$make_asyncIterable_exiter, href_change_ipns as $8tj43$href_change_ipns, ContainedImage as $8tj43$ContainedImage, buildThresholdList as $8tj43$buildThresholdList, deparallelize_no_drop as $8tj43$deparallelize_no_drop, ListenableSet as $8tj43$ListenableSet, insert_surfaces as $8tj43$insert_surfaces } from "@depict-ai/utilishared/ES10";
2
- import { createComponent as $8tj43$createComponent, insert as $8tj43$insert, template as $8tj43$template, getNextElement as $8tj43$getNextElement, effect as $8tj43$effect, style as $8tj43$style, spread as $8tj43$spread, setAttribute as $8tj43$setAttribute, mergeProps as $8tj43$mergeProps1, isServer as $8tj43$isServer, runHydrationEvents as $8tj43$runHydrationEvents, addEventListener as $8tj43$addEventListener, className as $8tj43$className, memo as $8tj43$memo, delegateEvents as $8tj43$delegateEvents, classList as $8tj43$classList, getNextMarker as $8tj43$getNextMarker, Dynamic as $8tj43$Dynamic, use as $8tj43$use, setProperty as $8tj43$setProperty } from "solid-js/web";
2
+ import { createComponent as $8tj43$createComponent, insert as $8tj43$insert, template as $8tj43$template, getNextElement as $8tj43$getNextElement, effect as $8tj43$effect, style as $8tj43$style, spread as $8tj43$spread, setAttribute as $8tj43$setAttribute, mergeProps as $8tj43$mergeProps1, isServer as $8tj43$isServer, runHydrationEvents as $8tj43$runHydrationEvents, addEventListener as $8tj43$addEventListener, className as $8tj43$className, memo as $8tj43$memo, delegateEvents as $8tj43$delegateEvents, getNextMarker as $8tj43$getNextMarker, classList as $8tj43$classList, use as $8tj43$use, Dynamic as $8tj43$Dynamic, setProperty as $8tj43$setProperty } from "solid-js/web";
3
3
  import { createSignal as $8tj43$createSignal, getOwner as $8tj43$getOwner, createEffect as $8tj43$createEffect, runWithOwner as $8tj43$runWithOwner, onCleanup as $8tj43$onCleanup, createMemo as $8tj43$createMemo, createContext as $8tj43$createContext, useContext as $8tj43$useContext, mergeProps as $8tj43$mergeProps, Show as $8tj43$Show, createResource as $8tj43$createResource, Suspense as $8tj43$Suspense, untrack as $8tj43$untrack, createRenderEffect as $8tj43$createRenderEffect, Index as $8tj43$Index, createRoot as $8tj43$createRoot, For as $8tj43$For, createUniqueId as $8tj43$createUniqueId, createComputed as $8tj43$createComputed, ErrorBoundary as $8tj43$ErrorBoundary, on as $8tj43$on, batch as $8tj43$batch, createReaction as $8tj43$createReaction, mapArray as $8tj43$mapArray } from "solid-js";
4
4
  import $8tj43$babelruntimehelpersclassPrivateFieldSet from "@babel/runtime/helpers/classPrivateFieldSet";
5
5
  import $8tj43$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpers/classPrivateFieldGet";
@@ -9,7 +9,7 @@ import { createStore as $8tj43$createStore, reconcile as $8tj43$reconcile } from
9
9
  /*! Depict.ai search and product listing SDK */
10
10
  import { register_es_version } from "../multi_import_deduplicator.mjs";
11
11
  register_es_version("ui", "ES10");
12
- const $8db9a15135765c11$export$83d89fbfd8236492 = "2.1.11";
12
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "2.1.13";
13
13
  const $2855bffe06ef7a03$var$fallback_operator = "in";
14
14
  const $2855bffe06ef7a03$var$fallback_token = "";
15
15
  const $2855bffe06ef7a03$var$legacy_filter_prefix = "filter_";
@@ -464,13 +464,13 @@ function $002f09d00aac50b2$export$6649caad96ef8870(_ref) {
464
464
 
465
465
  /** @jsxImportSource solid-js */
466
466
 
467
- function $0dc044cffe1e825b$export$9f191182275e9ef(what_to_watch) {
468
- const [size, setSize] = $8tj43$createSignal();
467
+ function $fc830a7ee59416ef$export$ebdc3711f7e02ccd(what_to_watch) {
468
+ const [width, setWidth] = $8tj43$createSignal();
469
469
  const resizeObserver = new ResizeObserver($8tj43$catchify(records => {
470
470
  for (let j = 0; j < records.length; j++) {
471
471
  var _records$j$borderBoxS, _records$j$borderBoxS2, _records$j$borderBoxS3;
472
472
  const width = (_records$j$borderBoxS = (_records$j$borderBoxS2 = records[j].borderBoxSize) === null || _records$j$borderBoxS2 === void 0 ? void 0 : (_records$j$borderBoxS3 = _records$j$borderBoxS2[0]) === null || _records$j$borderBoxS3 === void 0 ? void 0 : _records$j$borderBoxS3.inlineSize) !== null && _records$j$borderBoxS !== void 0 ? _records$j$borderBoxS : what_to_watch.getBoundingClientRect().width;
473
- setSize(width);
473
+ setWidth(width);
474
474
  }
475
475
  }));
476
476
  // If we start observing elements before they're in the DOM Chrome (Version 117.0.5938.92 (Official Build) (arm64)) sometimes gives us a resize event with a width of 0 and then doesn't dispatch one with the actual width once it's in the DOM. So we wait until the element is in the DOM before we start observing it.
@@ -479,13 +479,19 @@ function $0dc044cffe1e825b$export$9f191182275e9ef(what_to_watch) {
479
479
  let {
480
480
  element: element
481
481
  } = _ref;
482
- return requestAnimationFrame($8tj43$catchify(() => resizeObserver.observe(element)));
482
+ return requestAnimationFrame($8tj43$catchify(() => {
483
+ const current_size = what_to_watch.getBoundingClientRect().width;
484
+ if (current_size)
485
+ // If element has size, set signal to that. ResizeObserver only triggers when the content is visible in some cases, but it might already have a size. This reduces size filter expanding animation jank in chrome.
486
+ setWidth(current_size);
487
+ resizeObserver.observe(element);
488
+ }));
483
489
  });
484
490
  $8tj43$onCleanup(() => {
485
491
  resizeObserver.disconnect();
486
492
  disconnect();
487
493
  });
488
- return size;
494
+ return width;
489
495
  }
490
496
  const $a9c7ba6087881ac2$var$transform_elements = sorted_cols_at_size => {
491
497
  const cols_at_size = [];
@@ -786,11 +792,10 @@ class $f3b7124b76123e44$export$aa14a9f43128f61f extends $f3b7124b76123e44$export
786
792
  });
787
793
  }
788
794
  }
789
- const $74777e8fe65b3dcb$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div>`);
795
+ const $74777e8fe65b3dcb$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div><!$><!/><!$><!/>`);
790
796
  function $74777e8fe65b3dcb$export$b69d0d92862de18b(props) {
791
797
  return $8tj43$ErrorBoundary({
792
798
  fallback(err, retry) {
793
- var _props$on_error_;
794
799
  const {
795
800
  message_: message_,
796
801
  severity_: severity_
@@ -800,10 +805,17 @@ function $74777e8fe65b3dcb$export$b69d0d92862de18b(props) {
800
805
  console.error(err.cause);
801
806
  message = "".concat(message, ": ").concat(err.message);
802
807
  } else $8tj43$report([err, message_], severity_);
803
- (_props$on_error_ = props.on_error_) === null || _props$on_error_ === void 0 || _props$on_error_.call(props, retry);
804
808
  return (() => {
805
- const _el$ = $8tj43$getNextElement($74777e8fe65b3dcb$var$_tmpl$);
806
- $8tj43$insert(_el$, message);
809
+ const _el$ = $8tj43$getNextElement($74777e8fe65b3dcb$var$_tmpl$),
810
+ _el$2 = _el$.firstChild,
811
+ [_el$3, _co$] = $8tj43$getNextMarker(_el$2.nextSibling),
812
+ _el$4 = _el$3.nextSibling,
813
+ [_el$5, _co$2] = $8tj43$getNextMarker(_el$4.nextSibling);
814
+ $8tj43$insert(_el$, message, _el$3, _co$);
815
+ $8tj43$insert(_el$, () => {
816
+ var _props$on_error_;
817
+ return (_props$on_error_ = props.on_error_) === null || _props$on_error_ === void 0 ? void 0 : _props$on_error_.call(props, retry);
818
+ }, _el$5, _co$2);
807
819
  $8tj43$effect(_$p => {
808
820
  var _props$class_list_;
809
821
  return $8tj43$classList(_el$, Object.fromEntries(((_props$class_list_ = props.class_list_) === null || _props$class_list_ === void 0 ? void 0 : _props$class_list_.map(c => [c, true])) || []), _$p);
@@ -1517,17 +1529,12 @@ function $b4465d8d605f61e9$export$8895d39404bd2bb1(props) {
1517
1529
  if (delay_toast_) return show_configured_toast;else show_configured_toast();
1518
1530
  }
1519
1531
  $8tj43$delegateEvents(["click"]);
1520
- const $9783d437ad61594c$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<svg><path d="M11.669 10.531l9.156-9.156a.78.78 0 0 0 .237-.569c0-.221-.079-.412-.237-.569A.8.8 0 0 0 20.24 0a.77.77 0 0 0-.569.237l-9.14 9.14-9.14-9.14A.79.79 0 0 0 .807 0a.77.77 0 0 0-.569.237A.78.78 0 0 0 0 .807a.77.77 0 0 0 .237.569l9.156 9.156-9.156 9.14c-.159.157-.237.349-.237.569s.079.412.237.569c.085.085.174.148.268.19a1.095 1.095 0 0 0 .316.048.894.894 0 0 0 .285-.048.84.84 0 0 0 .285-.19l9.139-9.14 9.14 9.14a.894.894 0 0 0 .268.19 1.049 1.049 0 0 0 .301.048.941.941 0 0 0 .301-.048.84.84 0 0 0 .285-.19.78.78 0 0 0 .237-.569c0-.221-.079-.412-.237-.569z">`);
1532
+ const $9783d437ad61594c$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<svg xmlns=http://www.w3.org/2000/svg width=21.064 height=21.047 viewBox="0 0 21.064 21.064"><path d="M11.669 10.531l9.156-9.156a.78.78 0 0 0 .237-.569c0-.221-.079-.412-.237-.569A.8.8 0 0 0 20.24 0a.77.77 0 0 0-.569.237l-9.14 9.14-9.14-9.14A.79.79 0 0 0 .807 0a.77.77 0 0 0-.569.237A.78.78 0 0 0 0 .807a.77.77 0 0 0 .237.569l9.156 9.156-9.156 9.14c-.159.157-.237.349-.237.569s.079.412.237.569c.085.085.174.148.268.19a1.095 1.095 0 0 0 .316.048.894.894 0 0 0 .285-.048.84.84 0 0 0 .285-.19l9.139-9.14 9.14 9.14a.894.894 0 0 0 .268.19 1.049 1.049 0 0 0 .301.048.941.941 0 0 0 .301-.048.84.84 0 0 0 .285-.19.78.78 0 0 0 .237-.569c0-.221-.079-.412-.237-.569z">`);
1521
1533
  function $9783d437ad61594c$export$3b621d86b1566b2() {
1522
1534
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1523
1535
  return (() => {
1524
1536
  const _el$ = $8tj43$getNextElement($9783d437ad61594c$var$_tmpl$);
1525
- $8tj43$spread(_el$, $8tj43$mergeProps1(props, {
1526
- "xmlns": "http://www.w3.org/2000/svg",
1527
- "width": "21.064",
1528
- "height": "21.047",
1529
- "viewBox": "0 0 21.064 21.064"
1530
- }), true, true);
1537
+ $8tj43$spread(_el$, props, true, true);
1531
1538
  $8tj43$runHydrationEvents();
1532
1539
  return _el$;
1533
1540
  })();
@@ -1855,7 +1862,7 @@ $8tj43$delegateEvents(["click"]);
1855
1862
  const $19e828709c7723a0$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<span class=count>`),
1856
1863
  $19e828709c7723a0$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<label class=input-row><div class=left><input type=checkbox><span class=custom-indicator></span><span class="text line-clamp"></span></div><!$><!/>`);
1857
1864
  const $19e828709c7723a0$export$48513f6b9f8ce62d = props => {
1858
- // It seems like there's no diffing without memos here (since we often just have computations in the getters above that update to the same result often because their dependencies change with unrelated changes often), so put memos here to avoid unneeded DOM changes
1865
+ /* don't destructure props, it could have reactive getters */ // It seems like there's no diffing without memos here (since we often just have computations in the getters above that update to the same result often because their dependencies change with unrelated changes often), so put memos here to avoid unneeded DOM changes
1859
1866
  const count = $8tj43$createMemo(() => props.count_);
1860
1867
  const label = $8tj43$createMemo(() => props.label_);
1861
1868
  const checked = $8tj43$createMemo(() => props.checked_);
@@ -1953,6 +1960,79 @@ function $3e850b2f2cca761f$export$ca21a16d65b3dd8(_ref) {
1953
1960
  })();
1954
1961
  }
1955
1962
  $8tj43$delegateEvents(["click"]);
1963
+ const $02b6641aa50ce528$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<span class=highlighted-part>`),
1964
+ $02b6641aa50ce528$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<span>`);
1965
+ function $02b6641aa50ce528$export$ba17c5b7e6dda39f(_ref) {
1966
+ let {
1967
+ whole_text_to_display_: whole_text_to_display_memo,
1968
+ searching_for_value_: searching_for_value_memo,
1969
+ class_: class_
1970
+ } = _ref;
1971
+ const [get_has_highlighted, set_has_highlighted] = $8tj43$createSignal(false);
1972
+ const text_itself = $8tj43$createMemo(() => $8tj43$batch(() => {
1973
+ set_has_highlighted(false);
1974
+ const searching_for_value = searching_for_value_memo();
1975
+ const whole_text_to_display_ = whole_text_to_display_memo();
1976
+ let for_black = "";
1977
+ let pushed_grey = false;
1978
+ const search_q = searching_for_value;
1979
+ if (!search_q) return whole_text_to_display_;
1980
+ const output = [];
1981
+ const searching_for = search_q.toLowerCase();
1982
+ const push_black = () => {
1983
+ if (for_black) {
1984
+ set_has_highlighted(true);
1985
+ output.push((() => {
1986
+ const _el$ = $8tj43$getNextElement($02b6641aa50ce528$var$_tmpl$);
1987
+ $8tj43$insert(_el$, for_black);
1988
+ return _el$;
1989
+ })()); // "black"
1990
+ for_black = "";
1991
+ }
1992
+ };
1993
+ for (let i = 0; i < whole_text_to_display_.length;) {
1994
+ let is_whole_word = true;
1995
+ let searching_for_but_with_texts_casing = "";
1996
+ const i_at_start = i;
1997
+ for (let j = 0; j < searching_for.length; i++, j++) {
1998
+ const letter_in_suggestion = whole_text_to_display_[i];
1999
+ if ((letter_in_suggestion === null || letter_in_suggestion === void 0 ? void 0 : letter_in_suggestion.toLowerCase()) !== searching_for[j]) {
2000
+ is_whole_word = false;
2001
+ i = i_at_start;
2002
+ break;
2003
+ }
2004
+ searching_for_but_with_texts_casing += letter_in_suggestion;
2005
+ }
2006
+ if (is_whole_word) {
2007
+ push_black();
2008
+ output.push(searching_for_but_with_texts_casing);
2009
+ pushed_grey = true;
2010
+ } else for_black += whole_text_to_display_[i++];
2011
+ }
2012
+ push_black();
2013
+ if (!pushed_grey) {
2014
+ set_has_highlighted(false);
2015
+ return whole_text_to_display_;
2016
+ }
2017
+ return output;
2018
+ }));
2019
+ return (() => {
2020
+ const _el$2 = $8tj43$getNextElement($02b6641aa50ce528$var$_tmpl$2);
2021
+ $8tj43$className(_el$2, class_);
2022
+ $8tj43$insert(_el$2, text_itself);
2023
+ $8tj43$effect(_p$ => {
2024
+ const _v$ = !!get_has_highlighted(),
2025
+ _v$2 = whole_text_to_display_memo() /* for when line-clamped, users can see full text on hover */;
2026
+ _v$ !== _p$._v$ && _el$2.classList.toggle("has-match", _p$._v$ = _v$);
2027
+ _v$2 !== _p$._v$2 && $8tj43$setAttribute(_el$2, "title", _p$._v$2 = _v$2);
2028
+ return _p$;
2029
+ }, {
2030
+ _v$: undefined,
2031
+ _v$2: undefined
2032
+ });
2033
+ return _el$2;
2034
+ })();
2035
+ }
1956
2036
  const $133484ef10e4e954$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<form class=checkboxes><!$><!/><!$><!/>`);
1957
2037
  const $133484ef10e4e954$var$max_visible_without_collapsing = 15;
1958
2038
  const $133484ef10e4e954$var$show_non_collapsible_when_collapsed = 4;
@@ -1961,7 +2041,8 @@ function $133484ef10e4e954$export$dd948f91abc3a1c4(_ref) {
1961
2041
  filter_: filter_,
1962
2042
  selected_filters_: [get_selected_filters, set_selected_filters],
1963
2043
  i18n_: i18n_,
1964
- view_more_button_below_group_: [, set_view_more_button_below_group_]
2044
+ view_more_button_below_group_: [, set_view_more_button_below_group_],
2045
+ filter_query_: filter_query_
1965
2046
  } = _ref;
1966
2047
  const existing_filter = $8tj43$createMemo(() => {
1967
2048
  const {
@@ -1996,12 +2077,18 @@ function $133484ef10e4e954$export$dd948f91abc3a1c4(_ref) {
1996
2077
  const value = $af5d8e0b7d97a7f6$export$325f75597868c4f0(checkbox().value_);
1997
2078
  return !!(data !== null && data !== void 0 && data.some(item => $af5d8e0b7d97a7f6$export$325f75597868c4f0(item) === value));
1998
2079
  });
2080
+ const value = $8tj43$createMemo(() => checkbox().value_);
1999
2081
  return $8tj43$createComponent((0, $19e828709c7723a0$export$48513f6b9f8ce62d), {
2000
2082
  get value_() {
2001
- return checkbox().value_;
2083
+ return value();
2002
2084
  },
2003
2085
  get label_() {
2004
- return checkbox().name_;
2086
+ return $8tj43$createComponent((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
2087
+ get whole_text_to_display_() {
2088
+ return $8tj43$createMemo(() => checkbox().name_ || value());
2089
+ },
2090
+ searching_for_value_: () => filter_query_ === null || filter_query_ === void 0 ? void 0 : filter_query_()
2091
+ });
2005
2092
  },
2006
2093
  get count_() {
2007
2094
  return checkbox().count_;
@@ -2100,7 +2187,8 @@ const $b54fc842e721c9eb$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<form class=r
2100
2187
  function $b54fc842e721c9eb$export$430444115f70a734(_ref) {
2101
2188
  let {
2102
2189
  selected_filters_: selected_filters_,
2103
- filter_: filter_
2190
+ filter_: filter_,
2191
+ filter_query_: filter_query_
2104
2192
  } = _ref;
2105
2193
  const radio_name = $8tj43$make_random_classname();
2106
2194
  const existing_filter = $8tj43$createMemo(() => {
@@ -2128,6 +2216,13 @@ function $b54fc842e721c9eb$export$430444115f70a734(_ref) {
2128
2216
  var _counts;
2129
2217
  return (_counts = filter_().meta.counts) === null || _counts === void 0 ? void 0 : _counts[index];
2130
2218
  });
2219
+ const label = $8tj43$createMemo(() => {
2220
+ var _filter_$meta, _filter_$meta$names;
2221
+ const name = (_filter_$meta = filter_().meta) === null || _filter_$meta === void 0 ? void 0 : (_filter_$meta$names = _filter_$meta.names) === null || _filter_$meta$names === void 0 ? void 0 : _filter_$meta$names[index];
2222
+ if (name) return name;
2223
+ const v = value();
2224
+ return Array.isArray(v) ? v.join(" - ") : v + "";
2225
+ });
2131
2226
  return (() => {
2132
2227
  const _el$2 = $8tj43$getNextElement($b54fc842e721c9eb$var$_tmpl$3),
2133
2228
  _el$3 = _el$2.firstChild,
@@ -2152,12 +2247,9 @@ function $b54fc842e721c9eb$export$430444115f70a734(_ref) {
2152
2247
  }));
2153
2248
  $8tj43$setAttribute(_el$4, "id", random_selector);
2154
2249
  $8tj43$setAttribute(_el$4, "name", radio_name);
2155
- $8tj43$insert(_el$3, $8tj43$createMemo(() => {
2156
- var _filter_$meta, _filter_$meta$names;
2157
- const name = (_filter_$meta = filter_().meta) === null || _filter_$meta === void 0 ? void 0 : (_filter_$meta$names = _filter_$meta.names) === null || _filter_$meta$names === void 0 ? void 0 : _filter_$meta$names[index];
2158
- if (name) return name;
2159
- const v = value();
2160
- return Array.isArray(v) ? v.join(" - ") : v;
2250
+ $8tj43$insert(_el$3, $8tj43$createComponent((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
2251
+ whole_text_to_display_: label,
2252
+ searching_for_value_: () => filter_query_ === null || filter_query_ === void 0 ? void 0 : filter_query_()
2161
2253
  }), _el$7, _co$);
2162
2254
  $8tj43$insert(_el$2, $8tj43$createComponent((0, $8tj43$Show), {
2163
2255
  get when() {
@@ -2191,7 +2283,8 @@ function $1e7465a8ffa97f6c$export$e0d834a0ad870cda(_ref) {
2191
2283
  let {
2192
2284
  filter_: filter_,
2193
2285
  selected_filters_: selected_filters_,
2194
- i18n_: i18n_
2286
+ i18n_: i18n_,
2287
+ filter_query_: filter_query_
2195
2288
  } = _ref;
2196
2289
  // If you ever attempt to implement that one can drag one range "knob" over the other like on prisjakt, see https://gitlab.com/depict-ai/depict.ai/-/merge_requests/8458/diffs?commit_id=c52dbdd15ca073489bee138b15d27bb6bf2992df
2197
2290
  // The issue with it is that one wants to discard the changes to the lower value as soon as the lower value has become the upper value when dragging the initially lower knob over the initially upper knob
@@ -2584,135 +2677,417 @@ function $457279ff15864cb9$export$e5c2828934226505(_ref) {
2584
2677
  });
2585
2678
  return outer_div;
2586
2679
  }
2587
- const $0ae614c5c7babb43$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<form class="checkboxes hierarchical"><!$><!/><!$><!/>`),
2588
- $0ae614c5c7babb43$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<div class=checkbox-details><!$><!/><!$><!/>`),
2589
- $0ae614c5c7babb43$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<details>`),
2590
- $0ae614c5c7babb43$var$_tmpl$4 = /*#__PURE__*/$8tj43$template(`<summary class=category-parent><div class=summary><span class=count></span><!$><!/>`);
2591
- const $0ae614c5c7babb43$var$max_visible_without_collapsing = 15;
2592
- const $0ae614c5c7babb43$var$show_non_collapsible_when_collapsed = 4;
2593
- function $0ae614c5c7babb43$export$a32086fa6616eafd(_ref) {
2680
+ const $f3a159279dc1a8fb$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<span class=highlighted-part>`);
2681
+ const $f3a159279dc1a8fb$var$dont_cut_in_between_less_than_characters = 30;
2682
+ function $f3a159279dc1a8fb$export$e1a98a189fd2c0e7(_ref) {
2594
2683
  let {
2595
- filter_: filter_,
2596
- selected_filters_: selected_filters_,
2597
- i18n_: i18n_,
2598
- view_more_button_below_group_: view_more_button_below_group_,
2599
- expanded_hierarchical_filters_: expanded_hierarchical_filters_
2684
+ content_result_: content_result_,
2685
+ key_: key_,
2686
+ cut_when_possible_: cut_when_possible_
2600
2687
  } = _ref;
2601
- let form;
2602
- const existing_filter = $8tj43$createMemo(() => {
2603
- const {
2604
- field: field,
2605
- op: op
2606
- } = filter_();
2607
- return selected_filters_[0]().find(_ref2 => {
2608
- let {
2609
- field: checking_field,
2610
- op: checking_op
2611
- } = _ref2;
2612
- return checking_field === field && checking_op === op;
2613
- });
2614
- });
2615
- const show_extras = $8tj43$createSignal(false);
2616
- const trigger_sync_ = $0ae614c5c7babb43$var$batching_filter_state_syncer({
2617
- filter_: filter_,
2618
- existing_filter_: existing_filter,
2619
- selected_filters_: selected_filters_,
2620
- get category_structure_() {
2621
- return structured_categories();
2622
- }
2623
- });
2624
- const structured_categories = $8tj43$createMemo(() => {
2625
- const execute_when_structure_finished = [];
2626
- const {
2627
- values: values,
2628
- names: names,
2629
- counts: counts
2630
- } = filter_().meta;
2631
- const data_structure = {};
2632
- for (let i = 0; i < values.length; i++) {
2633
- const value = values[i];
2634
- let pointer = data_structure;
2635
- let parent_ = {};
2636
- let created_an_object = false;
2637
- for (let j = 0; j < value.length; j++) {
2638
- var _pointer;
2639
- const this_categories_name = value[j];
2640
- const obj = (_pointer = pointer)[this_categories_name] || (_pointer[this_categories_name] = (() => {
2641
- const value_as_string = value.map(v => typeof v === "number" ? v + "" : v); // don't think backend will ever send numbers but technically it's allowed;
2642
- const created_obj = {
2643
- name_: names[i],
2644
- count_: counts === null || counts === void 0 ? void 0 : counts[i],
2645
- parent_: parent_,
2646
- is_expanded_: $0ae614c5c7babb43$var$make_expanded_signal({
2647
- expanded_hierarchical_filters_: expanded_hierarchical_filters_,
2648
- filter_value_: value_as_string
2649
- }),
2650
- value_: value_as_string,
2651
- children_: {}
2652
- };
2653
- const {
2654
- signal_: signal_,
2655
- on_structure_complete_: on_structure_complete_
2656
- } = $0ae614c5c7babb43$var$create_updating_signal({
2657
- self_: created_obj,
2658
- existing_filter_: $8tj43$untrack(existing_filter),
2659
- trigger_sync_: trigger_sync_
2660
- });
2661
- execute_when_structure_finished.push(on_structure_complete_);
2662
- created_obj.is_checked_ = signal_;
2663
- parent_ = created_obj;
2664
- created_an_object = true;
2665
- return created_obj;
2666
- })());
2667
- pointer = obj.children_;
2668
- parent_ = obj;
2669
- }
2670
- if (!created_an_object && "value_" in parent_) {
2671
- // if an object was created for our "depth" in the hierarchy but not for our specific entry this means that the entry array was unsorted and looked something like
2672
- // [
2673
- // ["Öl", "IPA"],
2674
- // ["Öl", "Pale Ale"],
2675
- // ["Öl", "Ale"],
2676
- // ["Öl", "Mörk Lager"],
2677
- // ["Öl", "Suröl"],
2678
- // ["Öl", "Veteöl"],
2679
- // ["Öl", "Stout och Porter"],
2680
- // ["Öl"], // <- We are here, our `hierarchical_data_structure[string]`-object was created when we iterated over ["Öl", "IPA"]
2681
- // ["Öl", "Ljus Lager"],
2682
- // ];
2683
- // In this case we want to just correct the name and value of the already created object, which will be in parent_
2684
- parent_.value_ = value.map(v => v + "");
2685
- parent_.name_ = names[i];
2686
- parent_.count_ = counts[i];
2687
- parent_.is_expanded_ = $0ae614c5c7babb43$var$make_expanded_signal({
2688
- expanded_hierarchical_filters_: expanded_hierarchical_filters_,
2689
- filter_value_: parent_.value_
2690
- });
2691
- }
2692
- }
2693
- while (execute_when_structure_finished.length) execute_when_structure_finished.pop()();
2694
- $0ae614c5c7babb43$var$expand_until_choice(data_structure);
2695
- $8tj43$dlog("CheckboxHierarchicalFilter: Recomputed structured_categories", data_structure);
2696
- return data_structure;
2688
+ const matched_tokens = $8tj43$createMemo(() => {
2689
+ var _content_result_$high, _content_result_$high2;
2690
+ return (_content_result_$high = content_result_().highlights) === null || _content_result_$high === void 0 ? void 0 : (_content_result_$high2 = _content_result_$high.find(highlight => highlight.field == key_)) === null || _content_result_$high2 === void 0 ? void 0 : _content_result_$high2.matched_tokens;
2697
2691
  });
2698
- const some_top_level_are_hidden = $8tj43$createMemo(() => Object.keys(structured_categories()).length > $0ae614c5c7babb43$var$max_visible_without_collapsing);
2699
- const {
2700
- expand: expand,
2701
- collapse: collapse,
2702
- ExpandingContainer: ExpandingContainer
2703
- } = $8e8b179489080711$export$5bad61ecde080b1f({
2704
- duration: 200
2692
+ const full_value = $8tj43$createMemo(() => {
2693
+ var _content_result_$key_;
2694
+ return (_content_result_$key_ = content_result_()[key_]) === null || _content_result_$key_ === void 0 ? void 0 : _content_result_$key_.replaceAll("\n", " ");
2705
2695
  });
2706
- const expanding_container_els = $8tj43$createComponent(ExpandingContainer, {
2696
+ return $8tj43$createComponent((0, $8tj43$Show), {
2697
+ get when() {
2698
+ var _matched_tokens;
2699
+ return (_matched_tokens = matched_tokens()) === null || _matched_tokens === void 0 ? void 0 : _matched_tokens.length;
2700
+ },
2701
+ get fallback() {
2702
+ return full_value();
2703
+ },
2707
2704
  get children() {
2708
- return $8tj43$createComponent((0, $8tj43$Show), {
2709
- get when() {
2710
- return some_top_level_are_hidden();
2711
- },
2712
- get children() {
2713
- return $0ae614c5c7babb43$var$render_stuff($8tj43$createMemo(() => Object.fromEntries(Object.entries(structured_categories()).slice($0ae614c5c7babb43$var$show_non_collapsible_when_collapsed))), existing_filter, i18n_);
2714
- }
2715
- });
2705
+ return (() => {
2706
+ const segmented_cut_text = $8tj43$createMemo(() => {
2707
+ const segmented_text = $f3a159279dc1a8fb$export$1b00d74faf266c56(full_value(), matched_tokens());
2708
+ if (cut_when_possible_) $f3a159279dc1a8fb$var$cut_text(segmented_text);
2709
+ return segmented_text;
2710
+ });
2711
+ return $8tj43$createComponent((0, $8tj43$Index), {
2712
+ get each() {
2713
+ return segmented_cut_text();
2714
+ },
2715
+ children: item => {
2716
+ return $8tj43$createComponent((0, $8tj43$Show), {
2717
+ get when() {
2718
+ return item().highlighted_;
2719
+ },
2720
+ get fallback() {
2721
+ return item().text_;
2722
+ },
2723
+ get children() {
2724
+ const _el$ = $8tj43$getNextElement($f3a159279dc1a8fb$var$_tmpl$);
2725
+ $8tj43$insert(_el$, () => item().text_);
2726
+ return _el$;
2727
+ }
2728
+ });
2729
+ }
2730
+ });
2731
+ })();
2732
+ }
2733
+ });
2734
+ }
2735
+ function $f3a159279dc1a8fb$var$cut_text(segmented_text) {
2736
+ // cut away chunks of text that are not highlighted to give a google-like overview of the content
2737
+ const highlighted_segments = segmented_text === null || segmented_text === void 0 ? void 0 : segmented_text.filter(segment => segment.highlighted_);
2738
+ if (!segmented_text || !(highlighted_segments !== null && highlighted_segments !== void 0 && highlighted_segments.length)) return;
2739
+ // We have one or more highlighted segments
2740
+ if (highlighted_segments.length === 1) {
2741
+ // cut away from the left until the start of the highlighted sentence if just one sentence is highlighted
2742
+ $f3a159279dc1a8fb$var$cut_start(segmented_text.indexOf(highlighted_segments[0]), segmented_text);
2743
+ return;
2744
+ }
2745
+ // We have two or more highlighted segments, take the two biggest chunks and show them + a bit text around
2746
+ const sorted_highlighted_segments = [...highlighted_segments].sort((a, b) => b.text_.trim().length - a.text_.trim().length // trim to avoid unfair comparisons due to whitespace
2747
+ );
2748
+
2749
+ const [longest_segment, next_longest_segment] = sorted_highlighted_segments;
2750
+ // We need to cut before the first segment - possibly through other segments - and maybe between segments
2751
+ let [index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
2752
+ $f3a159279dc1a8fb$var$cut_start(index_of_first_segment, segmented_text);
2753
+ // update indexes since we might have removed segments
2754
+ [index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
2755
+ let number_of_characters_between_segments = 0;
2756
+ for (let i = index_of_first_segment + 1; i < index_of_second_segment; i++) {
2757
+ const segment = segmented_text[i];
2758
+ number_of_characters_between_segments += segment.text_.length;
2759
+ }
2760
+ if (number_of_characters_between_segments < $f3a159279dc1a8fb$var$dont_cut_in_between_less_than_characters)
2761
+ // don't cut if there are less than 30 characters between the two segments
2762
+ return;
2763
+ // We have more than 50 characters between the two segments, cut between them
2764
+ const [split_start_segment, split_start_character] = $f3a159279dc1a8fb$var$find_split_point(index_of_first_segment, index_of_second_segment, segmented_text);
2765
+ const [split_end_segment, split_end_character] = $f3a159279dc1a8fb$var$find_split_point(index_of_second_segment, index_of_first_segment, segmented_text);
2766
+ if (split_start_segment === undefined || split_end_segment === undefined ||
2767
+ // identical split point, or split end before split start, can't do anything
2768
+ split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
2769
+ const dots_segment = {
2770
+ text_: " … ",
2771
+ highlighted_: false
2772
+ };
2773
+ const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
2774
+ if (i < split_start_segment || i > split_end_segment) return segment;
2775
+ const text = segment.text_;
2776
+ if (i == split_end_segment && i == split_start_segment) return [{
2777
+ ...segment,
2778
+ text_: text.slice(0, split_start_character).trimEnd()
2779
+ }, dots_segment, {
2780
+ ...segment,
2781
+ text_: text.slice(split_end_character + 1, text.length).trimStart()
2782
+ }];else if (i == split_start_segment) {
2783
+ segment.text_ = text.slice(0, split_start_character).trimEnd(); // this would be split_start_character + 1, but we want to remove the last "dot" because . ... looks weird
2784
+ return segment;
2785
+ } else if (i == split_end_segment) return [dots_segment, {
2786
+ ...segment,
2787
+ text_: text.slice(split_end_character + 1, text.length).trimStart()
2788
+ }];
2789
+ return []; // remove all segments inbetween
2790
+ });
2791
+
2792
+ segmented_text.splice(0, segmented_text.length, ...split_and_dotted_values); // Sorry…
2793
+ $f3a159279dc1a8fb$var$heal_holes(segmented_text);
2794
+ }
2795
+ function $f3a159279dc1a8fb$var$heal_holes(segmented_text) {
2796
+ // try to heal "holes" created in the segments so there are only alternating segments
2797
+ const segments_to_delete = new Set();
2798
+ for (let i = 0; i < segmented_text.length; i++) {
2799
+ var _previous_segment, _previous_segment2;
2800
+ const segment = segmented_text[i];
2801
+ let previous_segment;
2802
+ for (let j = i - 1; j >= 0; j--) {
2803
+ previous_segment = segmented_text[j];
2804
+ // Don't write to a segment that's marked for deletion or the contents we write to it will be deleted
2805
+ if (!segments_to_delete.has(previous_segment)) break;
2806
+ }
2807
+ if ((_previous_segment = previous_segment) !== null && _previous_segment !== void 0 && _previous_segment.highlighted_ && segment.highlighted_ || ((_previous_segment2 = previous_segment) === null || _previous_segment2 === void 0 ? void 0 : _previous_segment2.highlighted_) === false && segment.highlighted_ === false) {
2808
+ previous_segment.text_ += segment.text_; // IDK if this ever happens
2809
+ segments_to_delete.add(segment);
2810
+ }
2811
+ }
2812
+ for (const segment of segments_to_delete) {
2813
+ const index = segmented_text.indexOf(segment);
2814
+ segmented_text.splice(index, 1);
2815
+ }
2816
+ }
2817
+ function $f3a159279dc1a8fb$var$find_split_point(index_of_start_segment, index_of_end_segment, segmented_text) {
2818
+ let be_very_aggressive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
2819
+ const should_loop_backwards = index_of_start_segment > index_of_end_segment;
2820
+ const step = should_loop_backwards ? -1 : 1;
2821
+ const desperate_split_attempts = [":", ";", ","];
2822
+ while (desperate_split_attempts.length) {
2823
+ const split_point_between_words = [];
2824
+ // for the middle also try to split with a few more characters if the default ones don't work over a full run
2825
+ const desperate_split_attempt = desperate_split_attempts.pop();
2826
+ let is_first_character = true;
2827
+ for (let i = index_of_start_segment + step; should_loop_backwards ? i > index_of_end_segment : i < index_of_end_segment; i += step) {
2828
+ const segment = segmented_text[i];
2829
+ const text = segment.text_;
2830
+ for (let j = should_loop_backwards ? text.length - 1 : 0; should_loop_backwards ? j >= 0 : j < text.length; j += step) {
2831
+ const character = text[j];
2832
+ if (character == "." || character == "?" || character == "!" || character == desperate_split_attempt) return [i, j]; // segment index, character index
2833
+ if (is_first_character) is_first_character = false;else if (be_very_aggressive && character == " ") {
2834
+ split_point_between_words.push([i, j]);
2835
+ if (split_point_between_words.length > 3)
2836
+ // We can't find a split point, so we'll just split between words
2837
+ // This is because for UI reasons we only want to show 2 lines of text, so we need to be very aggressive with getting the second match soon
2838
+ return split_point_between_words[1];
2839
+ }
2840
+ }
2841
+ }
2842
+ }
2843
+ return [];
2844
+ }
2845
+ function $f3a159279dc1a8fb$var$cut_start(cut_left_of_index, segmented_text) {
2846
+ // Cut the start of the text to bring the first matching token
2847
+ let is_first_character = false;
2848
+ let words_encountered = 0;
2849
+ outmost_loop: for (let i = cut_left_of_index - 1; i >= 0; i--) {
2850
+ const segment = segmented_text[i];
2851
+ // We assume that two adjacent highlighted segments don't exist and have been merged if they were to have existed
2852
+ const text = segment.text_;
2853
+ for (let j = text.length - 1; j >= 0; j--) {
2854
+ const character = text[j];
2855
+ const is_space = character == " ";
2856
+ if (!is_first_character && is_space) words_encountered++;
2857
+ if (character == "." || character == "?" || character == "!" || character == "," || words_encountered > 8 && is_space) {
2858
+ // We have to be really aggressive at the start of sentences so stuff can be seen on mobile, hence comma
2859
+ segment.text_ = text.slice(j + 1).trimStart();
2860
+ segmented_text.splice(0, i);
2861
+ if (character === "," || is_space)
2862
+ // if we cut at a comma or psace, we add a … at the beginning
2863
+ segmented_text.unshift({
2864
+ text_: "… ",
2865
+ highlighted_: false
2866
+ });
2867
+ break outmost_loop;
2868
+ }
2869
+ if (is_first_character) is_first_character = false;
2870
+ }
2871
+ }
2872
+ $f3a159279dc1a8fb$var$heal_holes(segmented_text); // if we added a ... there could now be a sequence that's not alternating true/false
2873
+ }
2874
+
2875
+ function $f3a159279dc1a8fb$export$1b00d74faf266c56(text, matched_strings) {
2876
+ let loose = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
2877
+ const output = [];
2878
+ if (!text) return; // shouldn't happen but whatever
2879
+ for (let i = 0; i < text.length; i++) {
2880
+ const found_strings = [];
2881
+ if (!i || text[i - 1] == " " || loose)
2882
+ // only match at the start of a word or string, it looks weird if i.e. "we" is highlighted in "activewear
2883
+ for (let j = 0; j < matched_strings.length; j++) {
2884
+ const matched_string = matched_strings[j];
2885
+ const part_in_text = text.slice(i, i + matched_string.length);
2886
+ if (matched_string.length < 2 && !loose) continue; // don't match on single characters, i.e. "I", it looks weird
2887
+ if (part_in_text.toLowerCase() === matched_string.toLowerCase()) found_strings.push(part_in_text); // use the casing from the text, not from typesense, can look weird otherwise
2888
+ }
2889
+
2890
+ const last_index_in_output = output.length - 1;
2891
+ if (!found_strings.length) {
2892
+ var _output$last_index_in;
2893
+ const character = text[i];
2894
+ if (((_output$last_index_in = output[last_index_in_output]) === null || _output$last_index_in === void 0 ? void 0 : _output$last_index_in.highlighted_) === false || output.length && /\s/.test(character))
2895
+ // always push whitespace characters to the last segment, this is because typesense doesn't see them as part of the matched tokens but we want to be able to detect "phat" matched segments
2896
+ output[last_index_in_output].text_ += character;else output.push({
2897
+ highlighted_: false,
2898
+ text_: character
2899
+ });
2900
+ } else {
2901
+ var _output$last_index_in2;
2902
+ const longest_found_string = found_strings.reduce((a, b) => a.length > b.length ? a : b);
2903
+ if ((_output$last_index_in2 = output[last_index_in_output]) !== null && _output$last_index_in2 !== void 0 && _output$last_index_in2.highlighted_) output[last_index_in_output].text_ += longest_found_string;else output.push({
2904
+ highlighted_: true,
2905
+ text_: longest_found_string
2906
+ });
2907
+ i += longest_found_string.length - 1;
2908
+ }
2909
+ }
2910
+ return output;
2911
+ }
2912
+ const $b0e2100b511ec9a4$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<span>`),
2913
+ $b0e2100b511ec9a4$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<span class=highlighted-part>`);
2914
+ function $b0e2100b511ec9a4$export$8e79c28529dbfa90(props) {
2915
+ const segmented_text = $8tj43$createMemo(() => {
2916
+ const {
2917
+ to_highlight_: to_highlight_,
2918
+ text_: text_
2919
+ } = props;
2920
+ return $f3a159279dc1a8fb$export$1b00d74faf266c56(text_, to_highlight_ ? [to_highlight_] : [], true);
2921
+ });
2922
+ const has_highlights = $8tj43$createMemo(() => segmented_text().some(segment => segment.highlighted_));
2923
+ return (() => {
2924
+ const _el$ = $8tj43$getNextElement($b0e2100b511ec9a4$var$_tmpl$);
2925
+ $8tj43$insert(_el$, $8tj43$createComponent((0, $8tj43$Index), {
2926
+ get each() {
2927
+ return segmented_text();
2928
+ },
2929
+ children: item => {
2930
+ return $8tj43$createComponent((0, $8tj43$Show), {
2931
+ get when() {
2932
+ return item().highlighted_;
2933
+ },
2934
+ get fallback() {
2935
+ return item().text_;
2936
+ },
2937
+ get children() {
2938
+ const _el$2 = $8tj43$getNextElement($b0e2100b511ec9a4$var$_tmpl$2);
2939
+ $8tj43$insert(_el$2, () => item().text_);
2940
+ return _el$2;
2941
+ }
2942
+ });
2943
+ }
2944
+ }));
2945
+ $8tj43$effect(_p$ => {
2946
+ const _v$ = props.text_,
2947
+ _v$2 = !!has_highlights();
2948
+ _v$ !== _p$._v$ && $8tj43$setAttribute(_el$, "title", _p$._v$ = _v$);
2949
+ _v$2 !== _p$._v$2 && _el$.classList.toggle("has-match", _p$._v$2 = _v$2);
2950
+ return _p$;
2951
+ }, {
2952
+ _v$: undefined,
2953
+ _v$2: undefined
2954
+ });
2955
+ return _el$;
2956
+ })();
2957
+ }
2958
+ const $0ae614c5c7babb43$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<form class="checkboxes hierarchical"><!$><!/><!$><!/>`),
2959
+ $0ae614c5c7babb43$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<div class=checkbox-details><!$><!/><!$><!/>`),
2960
+ $0ae614c5c7babb43$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<details>`),
2961
+ $0ae614c5c7babb43$var$_tmpl$4 = /*#__PURE__*/$8tj43$template(`<summary class=category-parent><div class=summary><span class=count></span><!$><!/>`);
2962
+ const $0ae614c5c7babb43$var$max_visible_without_collapsing = 15;
2963
+ const $0ae614c5c7babb43$var$show_non_collapsible_when_collapsed = 4;
2964
+ function $0ae614c5c7babb43$export$a32086fa6616eafd(_ref) {
2965
+ let {
2966
+ filter_: filter_,
2967
+ selected_filters_: selected_filters_,
2968
+ i18n_: i18n_,
2969
+ view_more_button_below_group_: view_more_button_below_group_,
2970
+ expanded_hierarchical_filters_: expanded_hierarchical_filters_,
2971
+ filter_query_: filter_query_
2972
+ } = _ref;
2973
+ let form;
2974
+ const existing_filter = $8tj43$createMemo(() => {
2975
+ const {
2976
+ field: field,
2977
+ op: op
2978
+ } = filter_();
2979
+ return selected_filters_[0]().find(_ref2 => {
2980
+ let {
2981
+ field: checking_field,
2982
+ op: checking_op
2983
+ } = _ref2;
2984
+ return checking_field === field && checking_op === op;
2985
+ });
2986
+ });
2987
+ const show_extras = $8tj43$createSignal(false);
2988
+ const is_being_searched_ = $8tj43$createMemo(() => !!(filter_query_ !== null && filter_query_ !== void 0 && filter_query_())); // If the user is searching in the filter
2989
+ const trigger_sync_ = $0ae614c5c7babb43$var$batching_filter_state_syncer({
2990
+ filter_: filter_,
2991
+ existing_filter_: existing_filter,
2992
+ selected_filters_: selected_filters_,
2993
+ get category_structure_() {
2994
+ return structured_categories();
2995
+ }
2996
+ });
2997
+ const structured_categories = $8tj43$createMemo(() => {
2998
+ const execute_when_structure_finished = [];
2999
+ const {
3000
+ values: values,
3001
+ names: names,
3002
+ counts: counts
3003
+ } = filter_().meta;
3004
+ const data_structure = {};
3005
+ for (let i = 0; i < values.length; i++) {
3006
+ const value = values[i];
3007
+ let pointer = data_structure;
3008
+ let parent_ = {};
3009
+ let created_an_object = false;
3010
+ for (let j = 0; j < value.length; j++) {
3011
+ var _pointer;
3012
+ const this_categories_name = value[j];
3013
+ const obj = (_pointer = pointer)[this_categories_name] || (_pointer[this_categories_name] = (() => {
3014
+ const value_as_string = value.map(v => typeof v === "number" ? v + "" : v); // don't think backend will ever send numbers but technically it's allowed;
3015
+ const created_obj = {
3016
+ name_: names[i],
3017
+ count_: counts === null || counts === void 0 ? void 0 : counts[i],
3018
+ parent_: parent_,
3019
+ is_expanded_: $0ae614c5c7babb43$var$make_expanded_signal({
3020
+ expanded_hierarchical_filters_: expanded_hierarchical_filters_,
3021
+ filter_value_: value_as_string,
3022
+ is_being_searched_: is_being_searched_
3023
+ }),
3024
+ value_: value_as_string,
3025
+ children_: {}
3026
+ };
3027
+ const {
3028
+ signal_: signal_,
3029
+ on_structure_complete_: on_structure_complete_
3030
+ } = $0ae614c5c7babb43$var$create_updating_signal({
3031
+ self_: created_obj,
3032
+ existing_filter_: $8tj43$untrack(existing_filter),
3033
+ trigger_sync_: trigger_sync_
3034
+ });
3035
+ execute_when_structure_finished.push(on_structure_complete_);
3036
+ created_obj.is_checked_ = signal_;
3037
+ parent_ = created_obj;
3038
+ created_an_object = true;
3039
+ return created_obj;
3040
+ })());
3041
+ pointer = obj.children_;
3042
+ parent_ = obj;
3043
+ }
3044
+ if (!created_an_object && "value_" in parent_) {
3045
+ // if an object was created for our "depth" in the hierarchy but not for our specific entry this means that the entry array was unsorted and looked something like
3046
+ // [
3047
+ // ["Öl", "IPA"],
3048
+ // ["Öl", "Pale Ale"],
3049
+ // ["Öl", "Ale"],
3050
+ // ["Öl", "Mörk Lager"],
3051
+ // ["Öl", "Suröl"],
3052
+ // ["Öl", "Veteöl"],
3053
+ // ["Öl", "Stout och Porter"],
3054
+ // ["Öl"], // <- We are here, our `hierarchical_data_structure[string]`-object was created when we iterated over ["Öl", "IPA"]
3055
+ // ["Öl", "Ljus Lager"],
3056
+ // ];
3057
+ // In this case we want to just correct the name and value of the already created object, which will be in parent_
3058
+ parent_.value_ = value.map(v => v + "");
3059
+ parent_.name_ = names[i];
3060
+ parent_.count_ = counts[i];
3061
+ parent_.is_expanded_ = $0ae614c5c7babb43$var$make_expanded_signal({
3062
+ expanded_hierarchical_filters_: expanded_hierarchical_filters_,
3063
+ filter_value_: parent_.value_,
3064
+ is_being_searched_: is_being_searched_
3065
+ });
3066
+ }
3067
+ }
3068
+ while (execute_when_structure_finished.length) execute_when_structure_finished.pop()();
3069
+ $0ae614c5c7babb43$var$expand_until_choice(data_structure);
3070
+ $8tj43$dlog("CheckboxHierarchicalFilter: Recomputed structured_categories", data_structure);
3071
+ return data_structure;
3072
+ });
3073
+ const some_top_level_are_hidden = $8tj43$createMemo(() => Object.keys(structured_categories()).length > $0ae614c5c7babb43$var$max_visible_without_collapsing);
3074
+ const {
3075
+ expand: expand,
3076
+ collapse: collapse,
3077
+ ExpandingContainer: ExpandingContainer
3078
+ } = $8e8b179489080711$export$5bad61ecde080b1f({
3079
+ duration: 200
3080
+ });
3081
+ const expanding_container_els = $8tj43$createComponent(ExpandingContainer, {
3082
+ get children() {
3083
+ return $8tj43$createComponent((0, $8tj43$Show), {
3084
+ get when() {
3085
+ return some_top_level_are_hidden();
3086
+ },
3087
+ get children() {
3088
+ return $0ae614c5c7babb43$var$render_stuff($8tj43$createMemo(() => Object.fromEntries(Object.entries(structured_categories()).slice($0ae614c5c7babb43$var$show_non_collapsible_when_collapsed))), existing_filter, i18n_, filter_query_);
3089
+ }
3090
+ });
2716
3091
  }
2717
3092
  });
2718
3093
  $8tj43$createRenderEffect(() => {
@@ -2736,13 +3111,13 @@ function $0ae614c5c7babb43$export$a32086fa6616eafd(_ref) {
2736
3111
  [_el$5, _co$2] = $8tj43$getNextMarker(_el$4.nextSibling);
2737
3112
  const _ref$ = form;
2738
3113
  typeof _ref$ === "function" ? $8tj43$use(_ref$, _el$) : form = _el$;
2739
- $8tj43$insert(_el$, () => $0ae614c5c7babb43$var$render_stuff($8tj43$createMemo(() => some_top_level_are_hidden() ? Object.fromEntries(Object.entries(structured_categories()).slice(0, $0ae614c5c7babb43$var$show_non_collapsible_when_collapsed)) : structured_categories()), existing_filter, i18n_), _el$3, _co$);
3114
+ $8tj43$insert(_el$, () => $0ae614c5c7babb43$var$render_stuff($8tj43$createMemo(() => some_top_level_are_hidden() ? Object.fromEntries(Object.entries(structured_categories()).slice(0, $0ae614c5c7babb43$var$show_non_collapsible_when_collapsed)) : structured_categories()), existing_filter, i18n_, filter_query_), _el$3, _co$);
2740
3115
  $8tj43$insert(_el$, expanding_container_els, _el$5, _co$2);
2741
3116
  $8tj43$effect(() => _el$.classList.toggle("any-expandable", !!Object.values(structured_categories()).some(category => Object.keys(category.children_).length)));
2742
3117
  return _el$;
2743
3118
  })();
2744
3119
  }
2745
- function $0ae614c5c7babb43$var$render_stuff(data, existing_filter, i18n_) {
3120
+ function $0ae614c5c7babb43$var$render_stuff(data, existing_filter, i18n_, filter_query_) {
2746
3121
  const keys = $8tj43$createMemo(() => Object.keys(data()));
2747
3122
  return $8tj43$createComponent((0, $8tj43$For), {
2748
3123
  get each() {
@@ -2760,6 +3135,14 @@ function $0ae614c5c7babb43$var$render_stuff(data, existing_filter, i18n_) {
2760
3135
  var _value;
2761
3136
  return !!Object.keys(((_value = value()) === null || _value === void 0 ? void 0 : _value.children_) || {}).length;
2762
3137
  });
3138
+ const value_as_string = $8tj43$createMemo(() => {
3139
+ var _value2;
3140
+ return JSON.stringify((_value2 = value()) === null || _value2 === void 0 ? void 0 : _value2.value_);
3141
+ });
3142
+ const label_text = $8tj43$createMemo(() => {
3143
+ var _value3;
3144
+ return ((_value3 = value()) === null || _value3 === void 0 ? void 0 : _value3.name_) || value_as_string();
3145
+ });
2763
3146
  return (() => {
2764
3147
  const _el$6 = $8tj43$getNextElement($0ae614c5c7babb43$var$_tmpl$2),
2765
3148
  _el$7 = _el$6.firstChild,
@@ -2768,12 +3151,17 @@ function $0ae614c5c7babb43$var$render_stuff(data, existing_filter, i18n_) {
2768
3151
  [_el$10, _co$4] = $8tj43$getNextMarker(_el$9.nextSibling);
2769
3152
  $8tj43$insert(_el$6, $8tj43$createComponent((0, $19e828709c7723a0$export$48513f6b9f8ce62d), {
2770
3153
  get value_() {
2771
- var _value2;
2772
- return JSON.stringify((_value2 = value()) === null || _value2 === void 0 ? void 0 : _value2.value_);
3154
+ return value_as_string();
2773
3155
  },
2774
3156
  get label_() {
2775
- var _value3;
2776
- return (_value3 = value()) === null || _value3 === void 0 ? void 0 : _value3.name_;
3157
+ return $8tj43$createComponent((0, $b0e2100b511ec9a4$export$8e79c28529dbfa90), {
3158
+ get text_() {
3159
+ return label_text();
3160
+ },
3161
+ get to_highlight_() {
3162
+ return filter_query_ === null || filter_query_ === void 0 ? void 0 : filter_query_();
3163
+ }
3164
+ });
2777
3165
  },
2778
3166
  get count_() {
2779
3167
  var _value4;
@@ -2873,7 +3261,7 @@ function $0ae614c5c7babb43$var$render_stuff(data, existing_filter, i18n_) {
2873
3261
  return $0ae614c5c7babb43$var$render_stuff($8tj43$createMemo(() => {
2874
3262
  var _value13;
2875
3263
  return ((_value13 = value()) === null || _value13 === void 0 ? void 0 : _value13.children_) || {};
2876
- }), existing_filter, i18n_);
3264
+ }), existing_filter, i18n_, filter_query_);
2877
3265
  }
2878
3266
  });
2879
3267
  })();
@@ -2991,7 +3379,8 @@ function $0ae614c5c7babb43$var$make_expanded_signal(_ref5) {
2991
3379
  var _untrack$untrack;
2992
3380
  let {
2993
3381
  expanded_hierarchical_filters_: [read_expanded_hierarchical_filters, write_expanded_hierarchical_filters],
2994
- filter_value_: filter_value_
3382
+ filter_value_: filter_value_,
3383
+ is_being_searched_: is_being_searched_
2995
3384
  } = _ref5;
2996
3385
  const index_in_expanded_filters = $8tj43$createMemo(() => read_expanded_hierarchical_filters().findIndex(_ref6 => {
2997
3386
  let {
@@ -3034,9 +3423,11 @@ function $0ae614c5c7babb43$var$make_expanded_signal(_ref5) {
3034
3423
  defer: true
3035
3424
  }));
3036
3425
  return {
3037
- ui_should_show_expanded_: $8tj43$createMemo(() => {
3426
+ ui_should_show_expanded_: $8tj43$createMemo(
3427
+ // When user is searching through filters, expand everything they haven't collapsed, so they can see the results
3428
+ () => {
3038
3429
  var _user_choice_signal$;
3039
- return (_user_choice_signal$ = user_choice_signal[0]()) !== null && _user_choice_signal$ !== void 0 ? _user_choice_signal$ : get_low_precedence_expanded();
3430
+ return (_user_choice_signal$ = user_choice_signal[0]()) !== null && _user_choice_signal$ !== void 0 ? _user_choice_signal$ : is_being_searched_() || get_low_precedence_expanded();
3040
3431
  }),
3041
3432
  set_low_precedence_expanded_: set_low_precedence_expanded,
3042
3433
  set_user_expanded_: set_user_choice_expanded
@@ -3067,7 +3458,9 @@ const $830ea8efda59884e$var$max_columns = 3;
3067
3458
  const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
3068
3459
  let {
3069
3460
  filter_: filter_,
3070
- selected_filters_: [get_selected_filters, set_selected_filters]
3461
+ selected_filters_: [get_selected_filters, set_selected_filters],
3462
+ filter_query_: filter_query_,
3463
+ details_element_width_: details_element_width_
3071
3464
  } = _ref;
3072
3465
  const existing_filter = $8tj43$createMemo(() => {
3073
3466
  const {
@@ -3101,7 +3494,7 @@ const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
3101
3494
  const container_width_accessor = $8tj43$createMemo(() => {
3102
3495
  const element = container();
3103
3496
  if (!element) return;
3104
- return $0dc044cffe1e825b$export$9f191182275e9ef(element);
3497
+ return $fc830a7ee59416ef$export$ebdc3711f7e02ccd(element);
3105
3498
  });
3106
3499
  const [shadow_children, set_shadow_children] = $8tj43$createSignal(new Set(), {
3107
3500
  equals: false
@@ -3113,11 +3506,11 @@ const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
3113
3506
  })(); // for getting the smallest possible sizes of all the items
3114
3507
  $8tj43$createEffect(() => {
3115
3508
  var _container_width_acce;
3116
- const container_width = (_container_width_acce = container_width_accessor()) === null || _container_width_acce === void 0 ? void 0 : _container_width_acce();
3117
- if (container_width == undefined) return;
3509
+ const container_width = ((_container_width_acce = container_width_accessor()) === null || _container_width_acce === void 0 ? void 0 : _container_width_acce()) || details_element_width_();
3510
+ if (container_width === undefined) return; // On firefox, unexpanded <details> elements' contents dont't have a width, fall back to the width of the details element itself to not have janky expanding animations due to wrong number of columns at point of expanding
3118
3511
  $830ea8efda59884e$var$adjust_sizes(container_width, sizes_set(), set_cols_at_size);
3119
3512
  });
3120
- return [shadow_grid, $8tj43$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), {
3513
+ return [$8tj43$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), {
3121
3514
  get cols_at_size() {
3122
3515
  return cols_at_size();
3123
3516
  },
@@ -3140,66 +3533,72 @@ const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
3140
3533
  const current_value = $af5d8e0b7d97a7f6$export$325f75597868c4f0(value().value_);
3141
3534
  return !!(data !== null && data !== void 0 && data.some(item => $af5d8e0b7d97a7f6$export$325f75597868c4f0(item) === current_value));
3142
3535
  });
3143
- const MakeButton = attributes => (() => {
3144
- const _el$2 = $8tj43$getNextElement($830ea8efda59884e$var$_tmpl$3),
3145
- _el$5 = _el$2.firstChild,
3146
- [_el$6, _co$] = $8tj43$getNextMarker(_el$5.nextSibling),
3147
- _el$7 = _el$6.nextSibling,
3148
- [_el$8, _co$2] = $8tj43$getNextMarker(_el$7.nextSibling);
3149
- $8tj43$spread(_el$2, $8tj43$mergeProps1(attributes, {
3150
- get disabled() {
3151
- return $8tj43$memo(() => value().count_ === 0)() && !is_selected();
3152
- },
3153
- get classList() {
3154
- return {
3155
- minor: !is_selected(),
3156
- major: is_selected(),
3157
- "major-minor-transition": true
3158
- };
3159
- },
3160
- get onClick() {
3161
- return $8tj43$catchify(() => {
3162
- const set_filter = existing_filter();
3163
- const {
3164
- field: field,
3165
- op: op
3166
- } = filter_();
3167
- const base_object = set_filter ? set_filter : {
3168
- op: op,
3169
- field: field
3170
- };
3171
- const old_data = base_object.data;
3172
- const new_data = [...(Array.isArray(old_data) ? [...old_data] : old_data ? [old_data] : [])];
3173
- const new_filter_object = {
3174
- ...base_object,
3175
- data: new_data
3536
+ const MakeButton = attributes => {
3537
+ const label = $8tj43$createMemo(() => value().name_ || value().value_ + "");
3538
+ return (() => {
3539
+ const _el$2 = $8tj43$getNextElement($830ea8efda59884e$var$_tmpl$3),
3540
+ _el$5 = _el$2.firstChild,
3541
+ [_el$6, _co$] = $8tj43$getNextMarker(_el$5.nextSibling),
3542
+ _el$7 = _el$6.nextSibling,
3543
+ [_el$8, _co$2] = $8tj43$getNextMarker(_el$7.nextSibling);
3544
+ $8tj43$spread(_el$2, $8tj43$mergeProps1(attributes, {
3545
+ get disabled() {
3546
+ return $8tj43$memo(() => value().count_ === 0)() && !is_selected();
3547
+ },
3548
+ get classList() {
3549
+ return {
3550
+ minor: !is_selected(),
3551
+ major: is_selected(),
3552
+ "major-minor-transition": true
3176
3553
  };
3177
- if (!is_selected()) new_filter_object.data.push(value().value_);else {
3178
- const current_value_lower = $af5d8e0b7d97a7f6$export$325f75597868c4f0(value().value_);
3179
- new_filter_object.data = new_filter_object.data.filter(v => $af5d8e0b7d97a7f6$export$325f75597868c4f0(v) !== current_value_lower);
3180
- }
3181
- const selected_filters = [...get_selected_filters().filter(f => f !== set_filter), ...(new_filter_object.data.length ? [new_filter_object] : [])];
3182
- set_selected_filters(selected_filters);
3183
- });
3184
- }
3185
- }), false, true);
3186
- $8tj43$insert(_el$2, () => value().value_, _el$6, _co$);
3187
- $8tj43$insert(_el$2, $8tj43$createComponent((0, $8tj43$Show), {
3188
- get when() {
3189
- return value().count_ != undefined;
3190
- },
3191
- get children() {
3192
- const _el$3 = $8tj43$getNextElement($830ea8efda59884e$var$_tmpl$2),
3193
- _el$4 = _el$3.firstChild;
3194
- $8tj43$insert(_el$4, () => value().count_);
3195
- return _el$3;
3196
- }
3197
- }), _el$8, _co$2);
3198
- $8tj43$runHydrationEvents();
3199
- return _el$2;
3200
- })();
3554
+ },
3555
+ get onClick() {
3556
+ return $8tj43$catchify(() => {
3557
+ const set_filter = existing_filter();
3558
+ const {
3559
+ field: field,
3560
+ op: op
3561
+ } = filter_();
3562
+ const base_object = set_filter ? set_filter : {
3563
+ op: op,
3564
+ field: field
3565
+ };
3566
+ const old_data = base_object.data;
3567
+ const new_data = [...(Array.isArray(old_data) ? [...old_data] : old_data ? [old_data] : [])];
3568
+ const new_filter_object = {
3569
+ ...base_object,
3570
+ data: new_data
3571
+ };
3572
+ if (!is_selected()) new_filter_object.data.push(value().value_);else {
3573
+ const current_value_lower = $af5d8e0b7d97a7f6$export$325f75597868c4f0(value().value_);
3574
+ new_filter_object.data = new_filter_object.data.filter(v => $af5d8e0b7d97a7f6$export$325f75597868c4f0(v) !== current_value_lower);
3575
+ }
3576
+ const selected_filters = [...get_selected_filters().filter(f => f !== set_filter), ...(new_filter_object.data.length ? [new_filter_object] : [])];
3577
+ set_selected_filters(selected_filters);
3578
+ });
3579
+ }
3580
+ }), false, true);
3581
+ $8tj43$insert(_el$2, $8tj43$createComponent((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
3582
+ whole_text_to_display_: label,
3583
+ searching_for_value_: () => filter_query_ === null || filter_query_ === void 0 ? void 0 : filter_query_()
3584
+ }), _el$6, _co$);
3585
+ $8tj43$insert(_el$2, $8tj43$createComponent((0, $8tj43$Show), {
3586
+ get when() {
3587
+ return value().count_ != undefined;
3588
+ },
3589
+ get children() {
3590
+ const _el$3 = $8tj43$getNextElement($830ea8efda59884e$var$_tmpl$2),
3591
+ _el$4 = _el$3.firstChild;
3592
+ $8tj43$insert(_el$4, () => value().count_);
3593
+ return _el$3;
3594
+ }
3595
+ }), _el$8, _co$2);
3596
+ $8tj43$runHydrationEvents();
3597
+ return _el$2;
3598
+ })();
3599
+ };
3201
3600
  const invisible_size_button = $8tj43$createComponent(MakeButton, {});
3202
- const smallest_possible_size = $0dc044cffe1e825b$export$9f191182275e9ef(invisible_size_button); // create ResizeObserver for the invisible size button where the div hugs its content
3601
+ const smallest_possible_size = $fc830a7ee59416ef$export$ebdc3711f7e02ccd(invisible_size_button); // create ResizeObserver for the invisible size button where the div hugs its content
3203
3602
  const sizes_value = $8tj43$untrack(sizes_set);
3204
3603
  const shadow_children_value = $8tj43$untrack(shadow_children);
3205
3604
  sizes_value.add(smallest_possible_size);
@@ -3219,7 +3618,7 @@ const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
3219
3618
  }
3220
3619
  });
3221
3620
  }
3222
- })];
3621
+ }), shadow_grid];
3223
3622
  };
3224
3623
  /**
3225
3624
  * Calculate and apply cols_at_size overrides to fit as many items as possible in a row, evenly spaced
@@ -3287,7 +3686,8 @@ function $2cb856c297c53e6c$export$82ed4b28ecb67608(_ref) {
3287
3686
  filter_: filter_,
3288
3687
  selected_filters_: [get_selected_filters, set_selected_filters],
3289
3688
  i18n_: i18n_,
3290
- view_more_button_below_group_: [_get_view_more_button_below_group_, set_view_more_button_below_group_]
3689
+ view_more_button_below_group_: [_get_view_more_button_below_group_, set_view_more_button_below_group_],
3690
+ filter_query_: filter_query_
3291
3691
  } = _ref;
3292
3692
  // same as in CheckboxFilter, maybe we should make this DRY at some point
3293
3693
  const existing_filter = $8tj43$createMemo(() => {
@@ -3332,12 +3732,17 @@ function $2cb856c297c53e6c$export$82ed4b28ecb67608(_ref) {
3332
3732
  const value = $af5d8e0b7d97a7f6$export$325f75597868c4f0(checkbox().value_);
3333
3733
  return !!(data !== null && data !== void 0 && data.some(item => $af5d8e0b7d97a7f6$export$325f75597868c4f0(item) === value));
3334
3734
  });
3735
+ const value = $8tj43$createMemo(() => checkbox().value_);
3736
+ const label_text = $8tj43$createMemo(() => checkbox().name_ || value() + "");
3335
3737
  const input_row = $8tj43$createComponent((0, $19e828709c7723a0$export$48513f6b9f8ce62d), {
3336
3738
  get value_() {
3337
- return checkbox().value_;
3739
+ return value();
3338
3740
  },
3339
3741
  get label_() {
3340
- return checkbox().name_;
3742
+ return $8tj43$createComponent((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
3743
+ whole_text_to_display_: label_text,
3744
+ searching_for_value_: () => filter_query_ === null || filter_query_ === void 0 ? void 0 : filter_query_()
3745
+ });
3341
3746
  },
3342
3747
  get count_() {
3343
3748
  return checkbox().count_;
@@ -3653,10 +4058,174 @@ function $ceafb6fb91c6f394$export$89c6019e4baa40b1(props) {
3653
4058
  }
3654
4059
  });
3655
4060
  }
4061
+ const $ef0f18a578b32578$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<svg xmlns=http://www.w3.org/2000/svg width=20 height=22 viewBox="0 0 20 22"><path d="M19.811 20.174l-6.234-6.809a7.96 7.96 0 0 0 .923-1.179c.274-.424.502-.865.687-1.323a8.04 8.04 0 0 0 .42-1.436 7.88 7.88 0 0 0 .144-1.507c0-.526-.051-1.042-.154-1.548-.096-.506-.243-.995-.441-1.466s-.441-.919-.728-1.343a8.28 8.28 0 0 0-.984-1.21 7.86 7.86 0 0 0-1.2-.984A7.56 7.56 0 0 0 10.89.651C10.418.453 9.929.302 9.423.2S8.401.046 7.875.046 6.833.097 6.327.2 5.332.453 4.86.651a7.56 7.56 0 0 0-1.354.718c-.431.287-.831.615-1.2.984a8.28 8.28 0 0 0-.984 1.21 7.73 7.73 0 0 0-.728 1.343c-.198.472-.349.96-.451 1.466A8.31 8.31 0 0 0 0 7.921a8.31 8.31 0 0 0 .144 1.548c.103.506.253.995.451 1.466a8.08 8.08 0 0 0 .728 1.354 7.86 7.86 0 0 0 .984 1.2 7.54 7.54 0 0 0 1.2.995c.431.287.882.53 1.354.728.472.191.96.338 1.466.441a8.31 8.31 0 0 0 1.548.144c.451 0 .896-.038 1.333-.113a7.83 7.83 0 0 0 1.282-.328 7.55 7.55 0 0 0 1.2-.533 8.08 8.08 0 0 0 1.107-.749l6.245 6.809a.45.45 0 0 0 .174.123.55.55 0 0 0 .205.041.61.61 0 0 0 .195-.031c.061-.021.116-.055.164-.102.109-.096.164-.219.164-.369.007-.144-.038-.267-.133-.369zM1.046 7.921c0-.937.178-1.818.533-2.646.362-.834.851-1.559 1.466-2.174.622-.615 1.347-1.101 2.174-1.456.827-.362 1.712-.543 2.656-.543s1.829.181 2.656.543c.827.355 1.548.841 2.164 1.456.622.615 1.111 1.34 1.466 2.174a6.52 6.52 0 0 1 .543 2.646c0 .943-.181 1.829-.543 2.656a6.89 6.89 0 0 1-1.466 2.174c-.615.615-1.336 1.104-2.164 1.466-.827.356-1.712.533-2.656.533s-1.829-.178-2.656-.533c-.827-.362-1.552-.851-2.174-1.466-.615-.622-1.104-1.347-1.466-2.174-.355-.827-.533-1.712-.533-2.656z">`);
4062
+ function $ef0f18a578b32578$export$82eafebb825fc23f() {
4063
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4064
+ return (() => {
4065
+ const _el$ = $8tj43$getNextElement($ef0f18a578b32578$var$_tmpl$);
4066
+ $8tj43$spread(_el$, props, true, true);
4067
+ $8tj43$runHydrationEvents();
4068
+ return _el$;
4069
+ })();
4070
+ }
4071
+ const $e354b2f9ce33cb75$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class=search-in-filters><input type=text class=query><!$><!/><button class=clear>`);
4072
+ const $e354b2f9ce33cb75$var$min_items_to_enable_filter_searching = 10; // For checkbox hierarchical we 2x this
4073
+ function $e354b2f9ce33cb75$export$4b2c5292ffe0c5dd(filter_array_, section, i18n_) {
4074
+ const [filter_query_, set_filter_query_] = $8tj43$createSignal();
4075
+ // Check if we have enough items to enable searching
4076
+ const enable_searchability = $8tj43$createMemo(() => {
4077
+ let count = 0;
4078
+ for (const filter of filter_array_()) {
4079
+ var _filter$meta;
4080
+ const type = (_filter$meta = filter.meta) === null || _filter$meta === void 0 ? void 0 : _filter$meta.type;
4081
+ if (type === "range") continue;
4082
+ const length = filter.meta.values.length;
4083
+ count += type === "checkbox-color" ? length / 2 : type === "checkbox-grid" ? length / 3 : length; // For checkbox-color we have two columns, checkbox-grid three, so we can show search later
4084
+ }
4085
+
4086
+ return count >= $e354b2f9ce33cb75$var$min_items_to_enable_filter_searching;
4087
+ });
4088
+ const SearchThisFilterGroup_ = () => {
4089
+ return $8tj43$createComponent((0, $8tj43$Show), {
4090
+ get when() {
4091
+ return enable_searchability();
4092
+ },
4093
+ get children() {
4094
+ const _el$ = $8tj43$getNextElement($e354b2f9ce33cb75$var$_tmpl$),
4095
+ _el$2 = _el$.firstChild,
4096
+ _el$4 = _el$2.nextSibling,
4097
+ [_el$5, _co$] = $8tj43$getNextMarker(_el$4.nextSibling),
4098
+ _el$3 = _el$5.nextSibling;
4099
+ _el$2.$$input = ev => set_filter_query_(ev.currentTarget.value);
4100
+ $8tj43$insert(_el$, $8tj43$createComponent((0, $ef0f18a578b32578$export$82eafebb825fc23f), {
4101
+ width: "16",
4102
+ height: "17.6",
4103
+ "class": "search-icon"
4104
+ }), _el$5, _co$);
4105
+ _el$3.$$click = () => set_filter_query_();
4106
+ $8tj43$insert(_el$3, $8tj43$createComponent((0, $9783d437ad61594c$export$3b621d86b1566b2), {
4107
+ width: "12",
4108
+ height: "12"
4109
+ }));
4110
+ $8tj43$effect(_p$ => {
4111
+ const _v$ = i18n_.search_a_filter_()(section),
4112
+ _v$2 = filter_query_() ? "" : "none";
4113
+ _v$ !== _p$._v$ && $8tj43$setAttribute(_el$2, "placeholder", _p$._v$ = _v$);
4114
+ _v$2 !== _p$._v$2 && ((_p$._v$2 = _v$2) != null ? _el$3.style.setProperty("display", _v$2) : _el$3.style.removeProperty("display"));
4115
+ return _p$;
4116
+ }, {
4117
+ _v$: undefined,
4118
+ _v$2: undefined
4119
+ });
4120
+ $8tj43$effect(() => $8tj43$setProperty(_el$2, "value", filter_query_() || ""));
4121
+ $8tj43$runHydrationEvents();
4122
+ return _el$;
4123
+ }
4124
+ });
4125
+ };
4126
+ const searched_filter_array_ = $8tj43$createMemo(() => {
4127
+ const query = filter_query_();
4128
+ if (!enable_searchability() || !query) return filter_array_();
4129
+ const lowercase_query = query.toLowerCase();
4130
+ const check_string_match = to_check => {
4131
+ to_check = to_check.toLowerCase();
4132
+ return to_check.includes(lowercase_query) || lowercase_query.includes(to_check);
4133
+ };
4134
+ return filter_array_().map(filter => {
4135
+ var _filter$meta2, _meta$names;
4136
+ const type = (_filter$meta2 = filter.meta) === null || _filter$meta2 === void 0 ? void 0 : _filter$meta2.type;
4137
+ if (type === "range") return filter; // can't search in range filters and for checkbox-hierarchical we do the searching in the filter component since we have access to a hierarchical structure there
4138
+ const meta = filter.meta;
4139
+ const {
4140
+ values: values,
4141
+ names: names,
4142
+ counts: counts
4143
+ } = meta;
4144
+ if (!Array.isArray(values)) return filter; // Might have to adjust this in the future, but I think these super simple filters won't need search
4145
+ const is_hierarchical_checkbox = type === "checkbox-hierarchical";
4146
+ // Which index of counts, values and names should be kept
4147
+ const filtered_indexes = values.map((item, index) => {
4148
+ const item_from_names = names === null || names === void 0 ? void 0 : names[index];
4149
+ if (item_from_names && !is_hierarchical_checkbox)
4150
+ // We should use names if they exist, but sometimes backend doesn't provide any at all, and sometimes they are undefined, presumably from create_modified_filters
4151
+ item = item_from_names;
4152
+ if (typeof item === "number") return true;
4153
+ if (is_hierarchical_checkbox && names)
4154
+ // Special case for hierarchical checkboxes where we need to check if any of the names in the path match the query
4155
+ item = item.map((_, index) => names[$e354b2f9ce33cb75$var$find_str_arr_in_str_arr_arr("findIndex", values, item.slice(0, index + 1))]);
4156
+ if (Array.isArray(item)) return item.some(item => check_string_match(item + "")); // If any of the items in the array match, keep it
4157
+ return check_string_match(item);
4158
+ });
4159
+ const new_values = values.filter((_, i) => filtered_indexes[i]);
4160
+ if (!new_values.length) return false; // false = please delete this filter, see below
4161
+ const new_filter_object = {
4162
+ ...filter,
4163
+ meta: {
4164
+ ...meta,
4165
+ counts: counts === null || counts === void 0 ? void 0 : counts.filter((_, i) => filtered_indexes[i]),
4166
+ ...(names ? {
4167
+ names: (_meta$names = meta.names) === null || _meta$names === void 0 ? void 0 : _meta$names.filter((_, i) => filtered_indexes[i])
4168
+ } : {}),
4169
+ values: new_values
4170
+ }
4171
+ };
4172
+ if (is_hierarchical_checkbox) {
4173
+ // For hierarchical checkbox we need to fill the holes created by filtering, for example if there is
4174
+ // ["Clothes"]
4175
+ // ["Clothes", "Blazers"]
4176
+ // And the user searched for "blazers" we need to add back ["Clothes"] so CheckboxHierarchicalFilter doesn't get confused
4177
+ // I explored doing the filtering there instead, but it's very hard to do it early enough before the expansion/collapsedness is calculated and check-logic is set up in relation to other items
4178
+ // So we do it here instead
4179
+ const new_meta = new_filter_object.meta;
4180
+ const new_values = new_meta.values;
4181
+ for (const value of new_values) {
4182
+ if (!Array.isArray(value)) continue; // Shouldn't happen
4183
+ if (value.length < 2) continue; // No parent
4184
+ const parent = value.slice(0, -1);
4185
+ // Check if parent exists
4186
+ if ($e354b2f9ce33cb75$var$find_str_arr_in_str_arr_arr("some", new_values, parent)) continue; // Parent exists
4187
+ // Otherwise, put it back
4188
+ const index_to_restore = $e354b2f9ce33cb75$var$find_str_arr_in_str_arr_arr("findIndex", values, parent);
4189
+ if (index_to_restore < 0) {
4190
+ $8tj43$dwarn("Can't restore", parent, "to", new_values);
4191
+ continue;
4192
+ }
4193
+ const current_index_of_us = new_values.findIndex(item => item === value);
4194
+ new_values.splice(current_index_of_us, 0, values[index_to_restore]);
4195
+ const count_to_restore = counts === null || counts === void 0 ? void 0 : counts[index_to_restore];
4196
+ if (count_to_restore) {
4197
+ var _new_meta$counts;
4198
+ (_new_meta$counts = new_meta.counts) === null || _new_meta$counts === void 0 || _new_meta$counts.splice(current_index_of_us, 0, count_to_restore);
4199
+ }
4200
+ const name_to_restore = names === null || names === void 0 ? void 0 : names[index_to_restore];
4201
+ if (name_to_restore) {
4202
+ var _new_meta$names;
4203
+ (_new_meta$names = new_meta.names) === null || _new_meta$names === void 0 || _new_meta$names.splice(current_index_of_us, 0, name_to_restore);
4204
+ }
4205
+ }
4206
+ }
4207
+ return new_filter_object;
4208
+ }).filter(filter => filter); // Delete filters that don't have a value anymore
4209
+ });
4210
+
4211
+ return {
4212
+ SearchThisFilterGroup_: SearchThisFilterGroup_,
4213
+ searched_filter_array_: searched_filter_array_,
4214
+ filter_query_: filter_query_
4215
+ };
4216
+ }
4217
+ /**
4218
+ * Finds/whatevers what's effectively one hierarchical filter item in an array of hierarchical filter items
4219
+ * Functions similar to this happen loads in create_modified_filters, but they have additional checks so not touching them RN
4220
+ */
4221
+ function $e354b2f9ce33cb75$var$find_str_arr_in_str_arr_arr(operation, haystack, needle) {
4222
+ return haystack[operation](value => value.length === needle.length && value.every((item, index) => item === needle[index]));
4223
+ }
4224
+ $8tj43$delegateEvents(["input", "click"]);
3656
4225
  const $f6b0500577e1b210$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class=filter-collapsible>`),
3657
4226
  $f6b0500577e1b210$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<button class=clear-group><!$><!/><span>`),
3658
4227
  $f6b0500577e1b210$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<div class=view-more-clear><!$><!/><!$><!/>`),
3659
- $f6b0500577e1b210$var$_tmpl$4 = /*#__PURE__*/$8tj43$template(`<div class=filter-collapsible-body><div class=filter-part></div><!$><!/>`),
4228
+ $f6b0500577e1b210$var$_tmpl$4 = /*#__PURE__*/$8tj43$template(`<div class=filter-collapsible-body><div class=filter-part><!$><!/><!$><!/></div><!$><!/>`),
3660
4229
  $f6b0500577e1b210$var$_tmpl$5 = /*#__PURE__*/$8tj43$template(`<details class=filter-collapsible>`),
3661
4230
  $f6b0500577e1b210$var$_tmpl$6 = /*#__PURE__*/$8tj43$template(`<summary class=filter-group-summary><div class=summary><span></span><div class=selected-w-sign><!$><!/><!$><!/>`),
3662
4231
  $f6b0500577e1b210$var$_tmpl$7 = /*#__PURE__*/$8tj43$template(`<div class=ungrouped>`),
@@ -3717,6 +4286,11 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
3717
4286
  const filter_array_ = $8tj43$createMemo(() => {
3718
4287
  return Object.values(togglable_filters_grouped_by_collapsible())[get_section_index()];
3719
4288
  });
4289
+ const {
4290
+ SearchThisFilterGroup_: SearchThisFilterGroup_,
4291
+ searched_filter_array_: searched_filter_array_,
4292
+ filter_query_: filter_query_
4293
+ } = $e354b2f9ce33cb75$export$4b2c5292ffe0c5dd(filter_array_, section_, props.i18n_);
3720
4294
  const is_open = $f1e63746f76ce012$export$ab34afce88557c0e({
3721
4295
  get expanded_filters_() {
3722
4296
  return props.expanded_filters_;
@@ -3732,27 +4306,33 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
3732
4306
  return selected_filter;
3733
4307
  })));
3734
4308
  const a_filter_is_selected = $8tj43$createMemo(() => selected_filters_in_group().size);
4309
+ const [get_details_width, set_get_details_width] = $8tj43$createSignal();
4310
+ const details_element_width_ = $8tj43$createMemo(() => {
4311
+ var _get_details_width;
4312
+ return get_details_width === null || get_details_width === void 0 ? void 0 : (_get_details_width = get_details_width()) === null || _get_details_width === void 0 ? void 0 : _get_details_width();
4313
+ });
3735
4314
  return $8tj43$createComponent((0, $ad371564683947ab$export$6c6d7a51fa9aa15d), {
3736
4315
  is_open_: is_open,
3737
4316
  get details_() {
3738
4317
  return (() => {
3739
- const _el$15 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$5);
3740
- $8tj43$setAttribute(_el$15, "data-group-title", section_);
3741
- return _el$15;
4318
+ const _el$19 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$5);
4319
+ $8tj43$use(element => set_get_details_width(() => $fc830a7ee59416ef$export$ebdc3711f7e02ccd(element)), _el$19);
4320
+ $8tj43$setAttribute(_el$19, "data-group-title", section_);
4321
+ return _el$19;
3742
4322
  })();
3743
4323
  },
3744
4324
  get summary_() {
3745
4325
  return (() => {
3746
- const _el$16 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$6),
3747
- _el$17 = _el$16.firstChild,
3748
- _el$18 = _el$17.firstChild,
3749
- _el$19 = _el$18.nextSibling,
3750
- _el$20 = _el$19.firstChild,
3751
- [_el$21, _co$5] = $8tj43$getNextMarker(_el$20.nextSibling),
3752
- _el$22 = _el$21.nextSibling,
3753
- [_el$23, _co$6] = $8tj43$getNextMarker(_el$22.nextSibling);
3754
- $8tj43$insert(_el$18, section_);
3755
- $8tj43$insert(_el$19, $8tj43$createComponent((0, $8tj43$Show), {
4326
+ const _el$20 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$6),
4327
+ _el$21 = _el$20.firstChild,
4328
+ _el$22 = _el$21.firstChild,
4329
+ _el$23 = _el$22.nextSibling,
4330
+ _el$24 = _el$23.firstChild,
4331
+ [_el$25, _co$7] = $8tj43$getNextMarker(_el$24.nextSibling),
4332
+ _el$26 = _el$25.nextSibling,
4333
+ [_el$27, _co$8] = $8tj43$getNextMarker(_el$26.nextSibling);
4334
+ $8tj43$insert(_el$22, section_);
4335
+ $8tj43$insert(_el$23, $8tj43$createComponent((0, $8tj43$Show), {
3756
4336
  get when() {
3757
4337
  return a_filter_is_selected();
3758
4338
  },
@@ -3764,26 +4344,31 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
3764
4344
  }
3765
4345
  });
3766
4346
  }
3767
- }), _el$21, _co$5);
3768
- $8tj43$insert(_el$19, $8tj43$createComponent((0, $457279ff15864cb9$export$e5c2828934226505), {
4347
+ }), _el$25, _co$7);
4348
+ $8tj43$insert(_el$23, $8tj43$createComponent((0, $457279ff15864cb9$export$e5c2828934226505), {
3769
4349
  get expanded_() {
3770
4350
  return is_open[0];
3771
4351
  },
3772
4352
  get i18n_() {
3773
4353
  return props.i18n_;
3774
4354
  }
3775
- }), _el$23, _co$6);
3776
- return _el$16;
4355
+ }), _el$27, _co$8);
4356
+ return _el$20;
3777
4357
  })();
3778
4358
  },
3779
4359
  get children() {
3780
4360
  const _el$2 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$4),
3781
4361
  _el$3 = _el$2.firstChild,
3782
- _el$13 = _el$3.nextSibling,
3783
- [_el$14, _co$4] = $8tj43$getNextMarker(_el$13.nextSibling);
4362
+ _el$4 = _el$3.firstChild,
4363
+ [_el$5, _co$] = $8tj43$getNextMarker(_el$4.nextSibling),
4364
+ _el$6 = _el$5.nextSibling,
4365
+ [_el$7, _co$2] = $8tj43$getNextMarker(_el$6.nextSibling),
4366
+ _el$17 = _el$3.nextSibling,
4367
+ [_el$18, _co$6] = $8tj43$getNextMarker(_el$17.nextSibling);
4368
+ $8tj43$insert(_el$3, $8tj43$createComponent(SearchThisFilterGroup_, {}), _el$5, _co$);
3784
4369
  $8tj43$insert(_el$3, $8tj43$createComponent((0, $8tj43$Index), {
3785
4370
  get each() {
3786
- return filter_array_();
4371
+ return searched_filter_array_();
3787
4372
  },
3788
4373
  children: filter => $8tj43$createComponent((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
3789
4374
  severity_: "error",
@@ -3806,11 +4391,13 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
3806
4391
  get i18n_() {
3807
4392
  return props.i18n_;
3808
4393
  },
3809
- view_more_button_below_group_: view_more_button_below_group
4394
+ view_more_button_below_group_: view_more_button_below_group,
4395
+ filter_query_: filter_query_,
4396
+ details_element_width_: details_element_width_
3810
4397
  });
3811
4398
  }
3812
4399
  })
3813
- }));
4400
+ }), _el$7, _co$2);
3814
4401
  $8tj43$insert(_el$2, $8tj43$createComponent((0, $8tj43$Show), {
3815
4402
  get when() {
3816
4403
  return $8tj43$createMemo(() => {
@@ -3819,22 +4406,22 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
3819
4406
  })();
3820
4407
  },
3821
4408
  get children() {
3822
- const _el$4 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$3),
3823
- _el$9 = _el$4.firstChild,
3824
- [_el$10, _co$2] = $8tj43$getNextMarker(_el$9.nextSibling),
3825
- _el$11 = _el$10.nextSibling,
3826
- [_el$12, _co$3] = $8tj43$getNextMarker(_el$11.nextSibling);
3827
- $8tj43$insert(_el$4, () => view_more_button_below_group[0](), _el$10, _co$2);
3828
- $8tj43$insert(_el$4, $8tj43$createComponent((0, $8tj43$Show), {
4409
+ const _el$8 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$3),
4410
+ _el$13 = _el$8.firstChild,
4411
+ [_el$14, _co$4] = $8tj43$getNextMarker(_el$13.nextSibling),
4412
+ _el$15 = _el$14.nextSibling,
4413
+ [_el$16, _co$5] = $8tj43$getNextMarker(_el$15.nextSibling);
4414
+ $8tj43$insert(_el$8, () => view_more_button_below_group[0](), _el$14, _co$4);
4415
+ $8tj43$insert(_el$8, $8tj43$createComponent((0, $8tj43$Show), {
3829
4416
  get when() {
3830
4417
  return a_filter_is_selected();
3831
4418
  },
3832
4419
  get children() {
3833
- const _el$5 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$2),
3834
- _el$7 = _el$5.firstChild,
3835
- [_el$8, _co$] = $8tj43$getNextMarker(_el$7.nextSibling),
3836
- _el$6 = _el$8.nextSibling;
3837
- $8tj43$addEventListener(_el$5, "click", $8tj43$catchify(() => {
4420
+ const _el$9 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$2),
4421
+ _el$11 = _el$9.firstChild,
4422
+ [_el$12, _co$3] = $8tj43$getNextMarker(_el$11.nextSibling),
4423
+ _el$10 = _el$12.nextSibling;
4424
+ $8tj43$addEventListener(_el$9, "click", $8tj43$catchify(() => {
3838
4425
  const new_filter_obj = [...props.selected_filters_[0]()];
3839
4426
  for (const filter of filter_array_()) {
3840
4427
  const index = new_filter_obj.findIndex(_ref2 => {
@@ -3848,15 +4435,15 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
3848
4435
  }
3849
4436
  props.selected_filters_[1](new_filter_obj);
3850
4437
  }), true);
3851
- $8tj43$insert(_el$5, $8tj43$createComponent((0, $9783d437ad61594c$export$3b621d86b1566b2), {}), _el$8, _co$);
3852
- $8tj43$insert(_el$6, () => props.i18n_.clear_individual_filter_());
4438
+ $8tj43$insert(_el$9, $8tj43$createComponent((0, $9783d437ad61594c$export$3b621d86b1566b2), {}), _el$12, _co$3);
4439
+ $8tj43$insert(_el$10, () => props.i18n_.clear_individual_filter_());
3853
4440
  $8tj43$runHydrationEvents();
3854
- return _el$5;
4441
+ return _el$9;
3855
4442
  }
3856
- }), _el$12, _co$3);
3857
- return _el$4;
4443
+ }), _el$16, _co$5);
4444
+ return _el$8;
3858
4445
  }
3859
- }), _el$14, _co$4);
4446
+ }), _el$18, _co$6);
3860
4447
  return _el$2;
3861
4448
  }
3862
4449
  });
@@ -3870,8 +4457,8 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
3870
4457
  return (_untogglable_filters = untogglable_filters()) === null || _untogglable_filters === void 0 ? void 0 : _untogglable_filters.length;
3871
4458
  },
3872
4459
  get children() {
3873
- const _el$24 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$7);
3874
- $8tj43$insert(_el$24, $8tj43$createComponent((0, $8tj43$Index), {
4460
+ const _el$28 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$7);
4461
+ $8tj43$insert(_el$28, $8tj43$createComponent((0, $8tj43$Index), {
3875
4462
  get each() {
3876
4463
  return untogglable_filters();
3877
4464
  },
@@ -3897,7 +4484,7 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
3897
4484
  }), $8tj43$memo(get_view_more_button_below_group)];
3898
4485
  }
3899
4486
  }));
3900
- return _el$24;
4487
+ return _el$28;
3901
4488
  }
3902
4489
  }), $8tj43$createComponent((0, $8tj43$Show), {
3903
4490
  get when() {
@@ -3905,8 +4492,8 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
3905
4492
  return $8tj43$memo(() => !!!props.are_in_modal_ /* modal has its own clear button */)() && ((_props$selected_filte = props.selected_filters_[0]()) === null || _props$selected_filte === void 0 ? void 0 : _props$selected_filte.length);
3906
4493
  },
3907
4494
  get children() {
3908
- const _el$25 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$8);
3909
- $8tj43$addEventListener(_el$25, "click", $8tj43$catchify(() => $b4465d8d605f61e9$export$8895d39404bd2bb1({
4495
+ const _el$29 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$8);
4496
+ $8tj43$addEventListener(_el$29, "click", $8tj43$catchify(() => $b4465d8d605f61e9$export$8895d39404bd2bb1({
3910
4497
  user_triggered_: true,
3911
4498
  selected_filters_: props.selected_filters_,
3912
4499
  i18n_: props.i18n_,
@@ -3914,9 +4501,9 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
3914
4501
  expanded_hierarchical_filters_: props.expanded_hierarchical_filters_,
3915
4502
  local_filter_cache_: props.local_filter_cache_
3916
4503
  })), true);
3917
- $8tj43$insert(_el$25, () => props.i18n_.clear_all_filters_from_big_button_());
4504
+ $8tj43$insert(_el$29, () => props.i18n_.clear_all_filters_from_big_button_());
3918
4505
  $8tj43$runHydrationEvents();
3919
- return _el$25;
4506
+ return _el$29;
3920
4507
  }
3921
4508
  })];
3922
4509
  }
@@ -8551,20 +9138,6 @@ const $ecc323d9c29305ee$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<svg xmlns=ht
8551
9138
  function $ecc323d9c29305ee$export$1c641004b5485fed() {
8552
9139
  return $8tj43$getNextElement($ecc323d9c29305ee$var$_tmpl$);
8553
9140
  }
8554
- const $ef0f18a578b32578$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<svg><path d="M19.811 20.174l-6.234-6.809a7.96 7.96 0 0 0 .923-1.179c.274-.424.502-.865.687-1.323a8.04 8.04 0 0 0 .42-1.436 7.88 7.88 0 0 0 .144-1.507c0-.526-.051-1.042-.154-1.548-.096-.506-.243-.995-.441-1.466s-.441-.919-.728-1.343a8.28 8.28 0 0 0-.984-1.21 7.86 7.86 0 0 0-1.2-.984A7.56 7.56 0 0 0 10.89.651C10.418.453 9.929.302 9.423.2S8.401.046 7.875.046 6.833.097 6.327.2 5.332.453 4.86.651a7.56 7.56 0 0 0-1.354.718c-.431.287-.831.615-1.2.984a8.28 8.28 0 0 0-.984 1.21 7.73 7.73 0 0 0-.728 1.343c-.198.472-.349.96-.451 1.466A8.31 8.31 0 0 0 0 7.921a8.31 8.31 0 0 0 .144 1.548c.103.506.253.995.451 1.466a8.08 8.08 0 0 0 .728 1.354 7.86 7.86 0 0 0 .984 1.2 7.54 7.54 0 0 0 1.2.995c.431.287.882.53 1.354.728.472.191.96.338 1.466.441a8.31 8.31 0 0 0 1.548.144c.451 0 .896-.038 1.333-.113a7.83 7.83 0 0 0 1.282-.328 7.55 7.55 0 0 0 1.2-.533 8.08 8.08 0 0 0 1.107-.749l6.245 6.809a.45.45 0 0 0 .174.123.55.55 0 0 0 .205.041.61.61 0 0 0 .195-.031c.061-.021.116-.055.164-.102.109-.096.164-.219.164-.369.007-.144-.038-.267-.133-.369zM1.046 7.921c0-.937.178-1.818.533-2.646.362-.834.851-1.559 1.466-2.174.622-.615 1.347-1.101 2.174-1.456.827-.362 1.712-.543 2.656-.543s1.829.181 2.656.543c.827.355 1.548.841 2.164 1.456.622.615 1.111 1.34 1.466 2.174a6.52 6.52 0 0 1 .543 2.646c0 .943-.181 1.829-.543 2.656a6.89 6.89 0 0 1-1.466 2.174c-.615.615-1.336 1.104-2.164 1.466-.827.356-1.712.533-2.656.533s-1.829-.178-2.656-.533c-.827-.362-1.552-.851-2.174-1.466-.615-.622-1.104-1.347-1.466-2.174-.355-.827-.533-1.712-.533-2.656z">`);
8555
- function $ef0f18a578b32578$export$82eafebb825fc23f() {
8556
- let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8557
- return (() => {
8558
- const _el$ = $8tj43$getNextElement($ef0f18a578b32578$var$_tmpl$);
8559
- $8tj43$spread(_el$, $8tj43$mergeProps1(props, {
8560
- "xmlns": "http://www.w3.org/2000/svg",
8561
- "width": "20",
8562
- "height": "22"
8563
- }), true, true);
8564
- $8tj43$runHydrationEvents();
8565
- return _el$;
8566
- })();
8567
- }
8568
9141
  const $584c06c09cf4609d$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<button class=back type=button>`),
8569
9142
  $584c06c09cf4609d$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<div class=search-field><!$><!/><div class=field><input class=query tabindex=0><button type=button class=clear></button></div><button class="submit major"type=button>`);
8570
9143
  function $584c06c09cf4609d$export$b94867ecbd698f21(_ref) {
@@ -9338,91 +9911,18 @@ function $494c9ad553139dbc$export$a146ac6fa8346a25(_ref) {
9338
9911
  _v$4 !== _p$._v$4 && $8tj43$setAttribute(_el$9, "title", _p$._v$4 = _v$4);
9339
9912
  return _p$;
9340
9913
  }, {
9341
- _v$: undefined,
9342
- _v$2: undefined,
9343
- _v$3: undefined,
9344
- _v$4: undefined
9345
- });
9346
- return _el$4;
9347
- })();
9348
- }
9349
- }));
9350
- return _el$;
9351
- }
9352
- });
9353
- }
9354
- const $02b6641aa50ce528$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<span class=highlighted-part>`),
9355
- $02b6641aa50ce528$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<span>`);
9356
- function $02b6641aa50ce528$export$ba17c5b7e6dda39f(_ref) {
9357
- let {
9358
- whole_text_to_display_: whole_text_to_display_memo,
9359
- searching_for_value_: searching_for_value_memo,
9360
- class_: class_
9361
- } = _ref;
9362
- const [get_has_highlighted, set_has_highlighted] = $8tj43$createSignal(false);
9363
- const text_itself = $8tj43$createMemo(() => $8tj43$batch(() => {
9364
- set_has_highlighted(false);
9365
- const searching_for_value = searching_for_value_memo();
9366
- const whole_text_to_display_ = whole_text_to_display_memo();
9367
- let for_black = "";
9368
- let pushed_grey = false;
9369
- const search_q = searching_for_value;
9370
- if (!search_q) return whole_text_to_display_;
9371
- const output = [];
9372
- const searching_for = search_q.toLowerCase();
9373
- const push_black = () => {
9374
- if (for_black) {
9375
- set_has_highlighted(true);
9376
- output.push((() => {
9377
- const _el$ = $8tj43$getNextElement($02b6641aa50ce528$var$_tmpl$);
9378
- $8tj43$insert(_el$, for_black);
9379
- return _el$;
9380
- })()); // "black"
9381
- for_black = "";
9382
- }
9383
- };
9384
- for (let i = 0; i < whole_text_to_display_.length;) {
9385
- let is_whole_word = true;
9386
- let searching_for_but_with_texts_casing = "";
9387
- const i_at_start = i;
9388
- for (let j = 0; j < searching_for.length; i++, j++) {
9389
- const letter_in_suggestion = whole_text_to_display_[i];
9390
- if ((letter_in_suggestion === null || letter_in_suggestion === void 0 ? void 0 : letter_in_suggestion.toLowerCase()) !== searching_for[j]) {
9391
- is_whole_word = false;
9392
- i = i_at_start;
9393
- break;
9394
- }
9395
- searching_for_but_with_texts_casing += letter_in_suggestion;
9396
- }
9397
- if (is_whole_word) {
9398
- push_black();
9399
- output.push(searching_for_but_with_texts_casing);
9400
- pushed_grey = true;
9401
- } else for_black += whole_text_to_display_[i++];
9402
- }
9403
- push_black();
9404
- if (!pushed_grey) {
9405
- set_has_highlighted(false);
9406
- return whole_text_to_display_;
9914
+ _v$: undefined,
9915
+ _v$2: undefined,
9916
+ _v$3: undefined,
9917
+ _v$4: undefined
9918
+ });
9919
+ return _el$4;
9920
+ })();
9921
+ }
9922
+ }));
9923
+ return _el$;
9407
9924
  }
9408
- return output;
9409
- }));
9410
- return (() => {
9411
- const _el$2 = $8tj43$getNextElement($02b6641aa50ce528$var$_tmpl$2);
9412
- $8tj43$className(_el$2, class_);
9413
- $8tj43$insert(_el$2, text_itself);
9414
- $8tj43$effect(_p$ => {
9415
- const _v$ = !!get_has_highlighted(),
9416
- _v$2 = whole_text_to_display_memo() /* for when line-clamped, users can see full text on hover */;
9417
- _v$ !== _p$._v$ && _el$2.classList.toggle("has-history-match", _p$._v$ = _v$);
9418
- _v$2 !== _p$._v$2 && $8tj43$setAttribute(_el$2, "title", _p$._v$2 = _v$2);
9419
- return _p$;
9420
- }, {
9421
- _v$: undefined,
9422
- _v$2: undefined
9423
- });
9424
- return _el$2;
9425
- })();
9925
+ });
9426
9926
  }
9427
9927
  const $3c5e15c6ee4227a9$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 256 256"><path d="M56 26.455a13.71 13.71 0 0 0-9.578 3.967A13.71 13.71 0 0 0 42.455 40v176a13.71 13.71 0 0 0 3.967 9.578A13.71 13.71 0 0 0 56 229.545h144A13.71 13.71 0 0 0 213.545 216V88a2.456 2.456 0 0 1 0-.002c.001-1.452-.597-2.895-1.623-3.922l-55.998-55.998a5.61 5.61 0 0 0-3.922-1.623 2.456 2.456 0 0 1-.002 0zm0 11.09h88A2.456 2.456 0 0 1 146.455 40v48c0 2.903 2.642 5.545 5.545 5.545h48A2.456 2.456 0 0 1 202.455 96v120a2.456 2.456 0 0 1-2.455 2.455H56A2.456 2.456 0 0 1 53.545 216V40A2.456 2.456 0 0 1 56 37.545zm103.061 11.498a2.456 2.456 0 0 1 2.676.531l28.689 28.689a2.456 2.456 0 0 1-1.736 4.191H160A2.456 2.456 0 0 1 157.545 80V51.311a2.456 2.456 0 0 1 1.516-2.268zM96 130.455c-2.903 0-5.545 2.642-5.545 5.545s2.642 5.545 5.545 5.545h64c2.903 0 5.545-2.642 5.545-5.545s-2.642-5.545-5.545-5.545zm0 32c-2.903 0-5.545 2.642-5.545 5.545s2.642 5.545 5.545 5.545h64c2.903 0 5.545-2.642 5.545-5.545s-2.642-5.545-5.545-5.545z">`);
9428
9928
  function $3c5e15c6ee4227a9$export$605674723bcc715c() {
@@ -9466,8 +9966,8 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
9466
9966
  } = _ref2;
9467
9967
  return type === (0, $7cd4d275a9f8d600$export$3cf9497e790da491) && !filtered_previous_searches_().includes(title);
9468
9968
  } // don't show the ones we already show from the history
9469
- ));
9470
-
9969
+ ) // + limit to three query suggestions, API sends more sometimes
9970
+ .slice(0, 3));
9471
9971
  const not_queries_memo = $8tj43$createMemo(() => {
9472
9972
  // For the section that shows categories and content results
9473
9973
  // We want to limit to 3 items, and we want to show the categories first
@@ -10494,238 +10994,6 @@ function $8e8ce3f7a5eb11a6$export$41b4894022a3580f() {
10494
10994
  })));
10495
10995
  return style_props_;
10496
10996
  }
10497
- const $f3a159279dc1a8fb$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<span class=highlighted-part>`);
10498
- const $f3a159279dc1a8fb$var$dont_cut_in_between_less_than_characters = 30;
10499
- function $f3a159279dc1a8fb$export$e1a98a189fd2c0e7(_ref) {
10500
- let {
10501
- content_result_: content_result_,
10502
- key_: key_,
10503
- cut_when_possible_: cut_when_possible_
10504
- } = _ref;
10505
- const matched_tokens = $8tj43$createMemo(() => {
10506
- var _content_result_$high, _content_result_$high2;
10507
- return (_content_result_$high = content_result_().highlights) === null || _content_result_$high === void 0 ? void 0 : (_content_result_$high2 = _content_result_$high.find(highlight => highlight.field == key_)) === null || _content_result_$high2 === void 0 ? void 0 : _content_result_$high2.matched_tokens;
10508
- });
10509
- const full_value = $8tj43$createMemo(() => {
10510
- var _content_result_$key_;
10511
- return (_content_result_$key_ = content_result_()[key_]) === null || _content_result_$key_ === void 0 ? void 0 : _content_result_$key_.replaceAll("\n", " ");
10512
- });
10513
- return $8tj43$createComponent((0, $8tj43$Show), {
10514
- get when() {
10515
- var _matched_tokens;
10516
- return (_matched_tokens = matched_tokens()) === null || _matched_tokens === void 0 ? void 0 : _matched_tokens.length;
10517
- },
10518
- get fallback() {
10519
- return full_value();
10520
- },
10521
- get children() {
10522
- return (() => {
10523
- const segmented_cut_text = $8tj43$createMemo(() => {
10524
- const segmented_text = $f3a159279dc1a8fb$var$segment_text(full_value(), matched_tokens());
10525
- if (cut_when_possible_) $f3a159279dc1a8fb$var$cut_text(segmented_text);
10526
- return segmented_text;
10527
- });
10528
- return $8tj43$createComponent((0, $8tj43$Index), {
10529
- get each() {
10530
- return segmented_cut_text();
10531
- },
10532
- children: item => {
10533
- return $8tj43$createComponent((0, $8tj43$Show), {
10534
- get when() {
10535
- return item().highlighted_;
10536
- },
10537
- get fallback() {
10538
- return item().text_;
10539
- },
10540
- get children() {
10541
- const _el$ = $8tj43$getNextElement($f3a159279dc1a8fb$var$_tmpl$);
10542
- $8tj43$insert(_el$, () => item().text_);
10543
- return _el$;
10544
- }
10545
- });
10546
- }
10547
- });
10548
- })();
10549
- }
10550
- });
10551
- }
10552
- function $f3a159279dc1a8fb$var$cut_text(segmented_text) {
10553
- // cut away chunks of text that are not highlighted to give a google-like overview of the content
10554
- const highlighted_segments = segmented_text === null || segmented_text === void 0 ? void 0 : segmented_text.filter(segment => segment.highlighted_);
10555
- if (!segmented_text || !(highlighted_segments !== null && highlighted_segments !== void 0 && highlighted_segments.length)) return;
10556
- // We have one or more highlighted segments
10557
- if (highlighted_segments.length === 1) {
10558
- // cut away from the left until the start of the highlighted sentence if just one sentence is highlighted
10559
- $f3a159279dc1a8fb$var$cut_start(segmented_text.indexOf(highlighted_segments[0]), segmented_text);
10560
- return;
10561
- }
10562
- // We have two or more highlighted segments, take the two biggest chunks and show them + a bit text around
10563
- const sorted_highlighted_segments = [...highlighted_segments].sort((a, b) => b.text_.trim().length - a.text_.trim().length // trim to avoid unfair comparisons due to whitespace
10564
- );
10565
-
10566
- const [longest_segment, next_longest_segment] = sorted_highlighted_segments;
10567
- // We need to cut before the first segment - possibly through other segments - and maybe between segments
10568
- let [index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
10569
- $f3a159279dc1a8fb$var$cut_start(index_of_first_segment, segmented_text);
10570
- // update indexes since we might have removed segments
10571
- [index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
10572
- let number_of_characters_between_segments = 0;
10573
- for (let i = index_of_first_segment + 1; i < index_of_second_segment; i++) {
10574
- const segment = segmented_text[i];
10575
- number_of_characters_between_segments += segment.text_.length;
10576
- }
10577
- if (number_of_characters_between_segments < $f3a159279dc1a8fb$var$dont_cut_in_between_less_than_characters)
10578
- // don't cut if there are less than 30 characters between the two segments
10579
- return;
10580
- // We have more than 50 characters between the two segments, cut between them
10581
- const [split_start_segment, split_start_character] = $f3a159279dc1a8fb$var$find_split_point(index_of_first_segment, index_of_second_segment, segmented_text);
10582
- const [split_end_segment, split_end_character] = $f3a159279dc1a8fb$var$find_split_point(index_of_second_segment, index_of_first_segment, segmented_text);
10583
- if (split_start_segment === undefined || split_end_segment === undefined ||
10584
- // identical split point, or split end before split start, can't do anything
10585
- split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
10586
- const dots_segment = {
10587
- text_: " … ",
10588
- highlighted_: false
10589
- };
10590
- const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
10591
- if (i < split_start_segment || i > split_end_segment) return segment;
10592
- const text = segment.text_;
10593
- if (i == split_end_segment && i == split_start_segment) return [{
10594
- ...segment,
10595
- text_: text.slice(0, split_start_character).trimEnd()
10596
- }, dots_segment, {
10597
- ...segment,
10598
- text_: text.slice(split_end_character + 1, text.length).trimStart()
10599
- }];else if (i == split_start_segment) {
10600
- segment.text_ = text.slice(0, split_start_character).trimEnd(); // this would be split_start_character + 1, but we want to remove the last "dot" because . ... looks weird
10601
- return segment;
10602
- } else if (i == split_end_segment) return [dots_segment, {
10603
- ...segment,
10604
- text_: text.slice(split_end_character + 1, text.length).trimStart()
10605
- }];
10606
- return []; // remove all segments inbetween
10607
- });
10608
-
10609
- segmented_text.splice(0, segmented_text.length, ...split_and_dotted_values); // Sorry…
10610
- $f3a159279dc1a8fb$var$heal_holes(segmented_text);
10611
- }
10612
- function $f3a159279dc1a8fb$var$heal_holes(segmented_text) {
10613
- // try to heal "holes" created in the segments so there are only alternating segments
10614
- const segments_to_delete = new Set();
10615
- for (let i = 0; i < segmented_text.length; i++) {
10616
- var _previous_segment, _previous_segment2;
10617
- const segment = segmented_text[i];
10618
- let previous_segment;
10619
- for (let j = i - 1; j >= 0; j--) {
10620
- previous_segment = segmented_text[j];
10621
- // Don't write to a segment that's marked for deletion or the contents we write to it will be deleted
10622
- if (!segments_to_delete.has(previous_segment)) break;
10623
- }
10624
- if ((_previous_segment = previous_segment) !== null && _previous_segment !== void 0 && _previous_segment.highlighted_ && segment.highlighted_ || ((_previous_segment2 = previous_segment) === null || _previous_segment2 === void 0 ? void 0 : _previous_segment2.highlighted_) === false && segment.highlighted_ === false) {
10625
- previous_segment.text_ += segment.text_; // IDK if this ever happens
10626
- segments_to_delete.add(segment);
10627
- }
10628
- }
10629
- for (const segment of segments_to_delete) {
10630
- const index = segmented_text.indexOf(segment);
10631
- segmented_text.splice(index, 1);
10632
- }
10633
- }
10634
- function $f3a159279dc1a8fb$var$find_split_point(index_of_start_segment, index_of_end_segment, segmented_text) {
10635
- let be_very_aggressive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
10636
- const should_loop_backwards = index_of_start_segment > index_of_end_segment;
10637
- const step = should_loop_backwards ? -1 : 1;
10638
- const desperate_split_attempts = [":", ";", ","];
10639
- while (desperate_split_attempts.length) {
10640
- const split_point_between_words = [];
10641
- // for the middle also try to split with a few more characters if the default ones don't work over a full run
10642
- const desperate_split_attempt = desperate_split_attempts.pop();
10643
- let is_first_character = true;
10644
- for (let i = index_of_start_segment + step; should_loop_backwards ? i > index_of_end_segment : i < index_of_end_segment; i += step) {
10645
- const segment = segmented_text[i];
10646
- const text = segment.text_;
10647
- for (let j = should_loop_backwards ? text.length - 1 : 0; should_loop_backwards ? j >= 0 : j < text.length; j += step) {
10648
- const character = text[j];
10649
- if (character == "." || character == "?" || character == "!" || character == desperate_split_attempt) return [i, j]; // segment index, character index
10650
- if (is_first_character) is_first_character = false;else if (be_very_aggressive && character == " ") {
10651
- split_point_between_words.push([i, j]);
10652
- if (split_point_between_words.length > 3)
10653
- // We can't find a split point, so we'll just split between words
10654
- // This is because for UI reasons we only want to show 2 lines of text, so we need to be very aggressive with getting the second match soon
10655
- return split_point_between_words[1];
10656
- }
10657
- }
10658
- }
10659
- }
10660
- return [];
10661
- }
10662
- function $f3a159279dc1a8fb$var$cut_start(cut_left_of_index, segmented_text) {
10663
- // Cut the start of the text to bring the first matching token
10664
- let is_first_character = false;
10665
- let words_encountered = 0;
10666
- outmost_loop: for (let i = cut_left_of_index - 1; i >= 0; i--) {
10667
- const segment = segmented_text[i];
10668
- // We assume that two adjacent highlighted segments don't exist and have been merged if they were to have existed
10669
- const text = segment.text_;
10670
- for (let j = text.length - 1; j >= 0; j--) {
10671
- const character = text[j];
10672
- const is_space = character == " ";
10673
- if (!is_first_character && is_space) words_encountered++;
10674
- if (character == "." || character == "?" || character == "!" || character == "," || words_encountered > 8 && is_space) {
10675
- // We have to be really aggressive at the start of sentences so stuff can be seen on mobile, hence comma
10676
- segment.text_ = text.slice(j + 1).trimStart();
10677
- segmented_text.splice(0, i);
10678
- if (character === "," || is_space)
10679
- // if we cut at a comma or psace, we add a … at the beginning
10680
- segmented_text.unshift({
10681
- text_: "… ",
10682
- highlighted_: false
10683
- });
10684
- break outmost_loop;
10685
- }
10686
- if (is_first_character) is_first_character = false;
10687
- }
10688
- }
10689
- $f3a159279dc1a8fb$var$heal_holes(segmented_text); // if we added a ... there could now be a sequence that's not alternating true/false
10690
- }
10691
-
10692
- function $f3a159279dc1a8fb$var$segment_text(text, matched_strings) {
10693
- // segment text where the matched strings are highlighted sections
10694
- const output = [];
10695
- if (!text) return; // shouldn't happen but whatever
10696
- for (let i = 0; i < text.length; i++) {
10697
- const found_strings = [];
10698
- if (!i || text[i - 1] == " ")
10699
- // only match at the start of a word or string, it looks weird if i.e. "we" is highlighted in "activewear
10700
- for (let j = 0; j < matched_strings.length; j++) {
10701
- const matched_string = matched_strings[j];
10702
- const part_in_text = text.slice(i, i + matched_string.length);
10703
- if (matched_string.length < 2) continue; // don't match on single characters, i.e. "I", it looks weird
10704
- if (part_in_text.toLowerCase() === matched_string.toLowerCase()) found_strings.push(part_in_text); // use the casing from the text, not from typesense, can look weird otherwise
10705
- }
10706
-
10707
- const last_index_in_output = output.length - 1;
10708
- if (!found_strings.length) {
10709
- var _output$last_index_in;
10710
- const character = text[i];
10711
- if (((_output$last_index_in = output[last_index_in_output]) === null || _output$last_index_in === void 0 ? void 0 : _output$last_index_in.highlighted_) === false || output.length && /\s/.test(character))
10712
- // always push whitespace characters to the last segment, this is because typesense doesn't see them as part of the matched tokens but we want to be able to detect "phat" matched segments
10713
- output[last_index_in_output].text_ += character;else output.push({
10714
- highlighted_: false,
10715
- text_: character
10716
- });
10717
- } else {
10718
- var _output$last_index_in2;
10719
- const longest_found_string = found_strings.reduce((a, b) => a.length > b.length ? a : b);
10720
- if ((_output$last_index_in2 = output[last_index_in_output]) !== null && _output$last_index_in2 !== void 0 && _output$last_index_in2.highlighted_) output[last_index_in_output].text_ += longest_found_string;else output.push({
10721
- highlighted_: true,
10722
- text_: longest_found_string
10723
- });
10724
- i += longest_found_string.length - 1;
10725
- }
10726
- }
10727
- return output;
10728
- }
10729
10997
  const $22470de5f42cc35d$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<a>`),
10730
10998
  $22470de5f42cc35d$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<div>`),
10731
10999
  $22470de5f42cc35d$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<div class="description line-clamp">`),
@@ -12343,4 +12611,4 @@ const $d399250dfa491636$export$c3834fa86c616831 = [[4], [3, 1024], [2, 901]];
12343
12611
  const $d399250dfa491636$export$864d304a0bc46829 = "2%";
12344
12612
  const $d399250dfa491636$export$7bf543b9d9be2c22 = (0, $fa332ea03168857c$export$b91cec6bdc6b32a1);
12345
12613
  $8tj43$add_to_version_info("ui", (0, $8db9a15135765c11$export$83d89fbfd8236492));
12346
- export { $2855bffe06ef7a03$export$916e6850778505f6 as strip_encoded_filter_and_sort, $2855bffe06ef7a03$export$58aa3f171519b6d7 as encode_filters, $2855bffe06ef7a03$export$f934fa24c3a86811 as decode_filters, $4df489344a0f97c7$export$d7b7ab832c20e2f4 as shopifyContainedImageContextSymbol, $5441862cd2f5e111$export$e68cff63f76bd15b as ListingProvider, $5441862cd2f5e111$export$8d0c4fdbb05a2f2e as useListing, $4df489344a0f97c7$export$e4b984597b71e989 as ShopifyContainedImage, $002f09d00aac50b2$export$6649caad96ef8870 as SlidableItems, $0dc044cffe1e825b$export$9f191182275e9ef as make_accurate_size_accessor, $d5d7e58c5c9d8db0$export$9574e176201e5e8d as RecommendationSlider, $b432b11321ad4c97$export$9756467d34d91cdb as RecommendationGrid, $56047603f9d212b6$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $56047603f9d212b6$export$e6fffe67d4cdd848 as makeSizeAccessor, $801e8845d3fa3653$export$94026ee33dbabc26 as ImageContainer, $74777e8fe65b3dcb$export$b69d0d92862de18b as SentryErrorBoundary, $ad371564683947ab$export$6c6d7a51fa9aa15d as ExpandingDetails, $e18ab2868df26f40$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $4711a82d08d2021b$export$fecbb157621501bd as SelectedFilters, $f6b0500577e1b210$export$3f1a388cc0d8fed7 as FilterBody, $44aa24b1bb793549$export$b288c38ae3fddb56 as create_modified_filters, $63f1f8dbcd07d3b0$export$d21e32dfedac04be as SolidLayout, $d5f1e6a0f9117286$export$79b1565500412d9b as general_modal_abstraction, $9783d437ad61594c$export$3b621d86b1566b2 as CrossIcon, $ca6ab5f08bd28bca$export$8be2714ec7f169ee as GenericSliderArrowButton, $5c5732ef44f05b26$export$58e808b1db15d3bc as fetchDepictRecommendations, $f5f54892fd0c7d9f$export$de035477d6fef996 as QuickLinks, $f5f54892fd0c7d9f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $fa332ea03168857c$export$b91cec6bdc6b32a1 as CategoryTitle, $702d7656a373973e$export$824dde41348efed1 as embedded_num_products, $96fd967c5b358ead$export$643598a327b5833e as get_categories, $f5f54892fd0c7d9f$export$f34314aa9505732e as DepictCategory, $f5f54892fd0c7d9f$export$e2bf8ce7779e827e as CategoryPage, $eb064bc3350276c1$export$ac6237957a15b3f0 as DepictSearch, $eb064bc3350276c1$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $eb064bc3350276c1$export$f2dc7e4e4aa11abb as SearchPage, $eb064bc3350276c1$export$316f6f283ae64765 as SearchField, $f3b7124b76123e44$export$aa14a9f43128f61f as ProductCardError, $169c13c0531d91d2$export$d86a33413558014e as open_modal_with_alignment, $5eaa00b951637e96$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $1308a7816c3d4f2d$export$b3ad617e9036868 as align_field, $a9c7ba6087881ac2$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $cc64aabf2c7a1f1a$export$1233ca167bf71f9a as styles_to_valid_css_string, $e56d241d0f33d459$export$fe334901e8bebd57 as disable_scrolling, $573c007c697a1831$export$d0596b5cae35ad4 as open_search_with_shift_slash, $284849364a6ef73a$export$e015ed2f2950f2e3 as DepictAPI, $00a5b94f0c11efbb$export$d9f36cf74e24d595 as media_query_to_accessor, $e60a76195ac6d408$export$689e204eadb33baf as setup_fast_leave, $a61a2051e15c8d7a$export$5196e4c01fa56fcb as show_toast, $60ec7a29849d81db$export$a71e92cfbb498adc as SolidFormatPrice, $37e8c97bb6876197$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $bc2337c9a05ecd18$export$acb3eaade4b23afd as BasePlaceholder, $ceafb6fb91c6f394$export$89c6019e4baa40b1 as TextPlaceholder, $3ab4aa97880fb88d$export$3f37af283f8fb843 as ImagePlaceholder, $f9fd3017c20b774a$export$3ccaa27d81dd8556 as PageReplacer, $d399250dfa491636$export$864d304a0bc46829 as defaultGridSpacing, $d399250dfa491636$export$c3834fa86c616831 as defaultColsAtSize, $d399250dfa491636$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $8db9a15135765c11$export$83d89fbfd8236492 as version };
12614
+ export { $2855bffe06ef7a03$export$916e6850778505f6 as strip_encoded_filter_and_sort, $2855bffe06ef7a03$export$58aa3f171519b6d7 as encode_filters, $2855bffe06ef7a03$export$f934fa24c3a86811 as decode_filters, $4df489344a0f97c7$export$d7b7ab832c20e2f4 as shopifyContainedImageContextSymbol, $5441862cd2f5e111$export$e68cff63f76bd15b as ListingProvider, $5441862cd2f5e111$export$8d0c4fdbb05a2f2e as useListing, $4df489344a0f97c7$export$e4b984597b71e989 as ShopifyContainedImage, $002f09d00aac50b2$export$6649caad96ef8870 as SlidableItems, $fc830a7ee59416ef$export$ebdc3711f7e02ccd as make_accurate_width_accessor, $d5d7e58c5c9d8db0$export$9574e176201e5e8d as RecommendationSlider, $b432b11321ad4c97$export$9756467d34d91cdb as RecommendationGrid, $56047603f9d212b6$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $56047603f9d212b6$export$e6fffe67d4cdd848 as makeSizeAccessor, $801e8845d3fa3653$export$94026ee33dbabc26 as ImageContainer, $74777e8fe65b3dcb$export$b69d0d92862de18b as SentryErrorBoundary, $ad371564683947ab$export$6c6d7a51fa9aa15d as ExpandingDetails, $e18ab2868df26f40$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $4711a82d08d2021b$export$fecbb157621501bd as SelectedFilters, $f6b0500577e1b210$export$3f1a388cc0d8fed7 as FilterBody, $44aa24b1bb793549$export$b288c38ae3fddb56 as create_modified_filters, $63f1f8dbcd07d3b0$export$d21e32dfedac04be as SolidLayout, $d5f1e6a0f9117286$export$79b1565500412d9b as general_modal_abstraction, $9783d437ad61594c$export$3b621d86b1566b2 as CrossIcon, $ca6ab5f08bd28bca$export$8be2714ec7f169ee as GenericSliderArrowButton, $5c5732ef44f05b26$export$58e808b1db15d3bc as fetchDepictRecommendations, $f5f54892fd0c7d9f$export$de035477d6fef996 as QuickLinks, $f5f54892fd0c7d9f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $fa332ea03168857c$export$b91cec6bdc6b32a1 as CategoryTitle, $702d7656a373973e$export$824dde41348efed1 as embedded_num_products, $96fd967c5b358ead$export$643598a327b5833e as get_categories, $f5f54892fd0c7d9f$export$f34314aa9505732e as DepictCategory, $f5f54892fd0c7d9f$export$e2bf8ce7779e827e as CategoryPage, $eb064bc3350276c1$export$ac6237957a15b3f0 as DepictSearch, $eb064bc3350276c1$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $eb064bc3350276c1$export$f2dc7e4e4aa11abb as SearchPage, $eb064bc3350276c1$export$316f6f283ae64765 as SearchField, $f3b7124b76123e44$export$aa14a9f43128f61f as ProductCardError, $169c13c0531d91d2$export$d86a33413558014e as open_modal_with_alignment, $5eaa00b951637e96$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $1308a7816c3d4f2d$export$b3ad617e9036868 as align_field, $a9c7ba6087881ac2$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $cc64aabf2c7a1f1a$export$1233ca167bf71f9a as styles_to_valid_css_string, $e56d241d0f33d459$export$fe334901e8bebd57 as disable_scrolling, $573c007c697a1831$export$d0596b5cae35ad4 as open_search_with_shift_slash, $284849364a6ef73a$export$e015ed2f2950f2e3 as DepictAPI, $00a5b94f0c11efbb$export$d9f36cf74e24d595 as media_query_to_accessor, $e60a76195ac6d408$export$689e204eadb33baf as setup_fast_leave, $a61a2051e15c8d7a$export$5196e4c01fa56fcb as show_toast, $60ec7a29849d81db$export$a71e92cfbb498adc as SolidFormatPrice, $37e8c97bb6876197$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $bc2337c9a05ecd18$export$acb3eaade4b23afd as BasePlaceholder, $ceafb6fb91c6f394$export$89c6019e4baa40b1 as TextPlaceholder, $3ab4aa97880fb88d$export$3f37af283f8fb843 as ImagePlaceholder, $f9fd3017c20b774a$export$3ccaa27d81dd8556 as PageReplacer, $d399250dfa491636$export$864d304a0bc46829 as defaultGridSpacing, $d399250dfa491636$export$c3834fa86c616831 as defaultColsAtSize, $d399250dfa491636$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $8db9a15135765c11$export$83d89fbfd8236492 as version };