@depict-ai/ui 2.1.12 → 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.cjs +870 -608
- package/ES10/index.d.ts +3 -2
- package/ES10/index.js +871 -609
- package/latest/index.cjs +842 -596
- package/latest/index.d.ts +3 -2
- package/latest/index.js +843 -597
- package/locales/ES10/index.cjs +25 -12
- package/locales/ES10/index.d.ts +1 -0
- package/locales/ES10/index.js +25 -12
- package/locales/latest/index.cjs +25 -12
- package/locales/latest/index.d.ts +1 -0
- package/locales/latest/index.js +25 -12
- package/locales/require.js +1152 -0
- package/package.json +2 -2
- package/server/ES10/index.cjs +746 -518
- package/server/ES10/index.d.ts +3 -2
- package/server/ES10/index.js +747 -519
- package/server/latest/index.cjs +732 -520
- package/server/latest/index.d.ts +3 -2
- package/server/latest/index.js +733 -521
package/server/latest/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { add_to_version_info as $i7OB2$add_to_version_info, base64_encode_unicode as $i7OB2$base64_encode_unicode, base64_decode_unicode as $i7OB2$base64_decode_unicode, dlog as $i7OB2$dlog, queueMacroTask as $i7OB2$queueMacroTask, catchify as $i7OB2$catchify, is_safari as $i7OB2$is_safari, observer as $i7OB2$observer, dwarn as $i7OB2$dwarn, Amazing_Slider as $i7OB2$Amazing_Slider, slider_snap_css as $i7OB2$slider_snap_css, slider_fading_factory as $i7OB2$slider_fading_factory, slider_fractional_factory as $i7OB2$slider_fractional_factory, camelCasifyObject as $i7OB2$camelCasifyObject, make_random_classname as $i7OB2$make_random_classname, n_col_styling_with_dist as $i7OB2$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $i7OB2$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $i7OB2$layout_get_total_rec_amount_for_row, layout_media_query_header as $i7OB2$layout_media_query_header, report as $i7OB2$report, useExpandingContainer as $i7OB2$useExpandingContainer, standard_price_format as $i7OB2$standard_price_format, hex_to_rgb as $i7OB2$hex_to_rgb, relative_luminance_from_rgb as $i7OB2$relative_luminance_from_rgb, fetch_recs as $i7OB2$fetch_recs, snakeCasifyObject as $i7OB2$snakeCasifyObject, instant_exec_on_suspect_history_change as $i7OB2$instant_exec_on_suspect_history_change, base_url as $i7OB2$base_url, get_depict_id as $i7OB2$get_depict_id, get_user_id as $i7OB2$get_user_id, get_session_id as $i7OB2$get_session_id, sort_obj as $i7OB2$sort_obj, fetch_retry as $i7OB2$fetch_retry, add_version_query_params as $i7OB2$add_version_query_params, make_url_with_query_params as $i7OB2$make_url_with_query_params, edit_current_page_meta_tags as $i7OB2$edit_current_page_meta_tags, javascript_media_query as $i7OB2$javascript_media_query, use_href_accessor as $i7OB2$use_href_accessor, make_asyncIterable_exiter as $i7OB2$make_asyncIterable_exiter, href_change_ipns as $i7OB2$href_change_ipns, ContainedImage as $i7OB2$ContainedImage, deparallelize_no_drop as $i7OB2$deparallelize_no_drop, ListenableSet as $i7OB2$ListenableSet, insert_surfaces as $i7OB2$insert_surfaces } from "@depict-ai/utilishared/latest";
|
|
2
2
|
import { createComponent as $i7OB2$createComponent, insert as $i7OB2$insert, ssr as $i7OB2$ssr, ssrHydrationKey as $i7OB2$ssrHydrationKey, ssrStyle as $i7OB2$ssrStyle, spread as $i7OB2$spread, escape as $i7OB2$escape, ssrAttribute as $i7OB2$ssrAttribute, mergeProps as $i7OB2$mergeProps1, isServer as $i7OB2$isServer, ssrElement as $i7OB2$ssrElement, ssrClassList as $i7OB2$ssrClassList, Dynamic as $i7OB2$Dynamic } from "solid-js/web";
|
|
3
|
-
import { createSignal as $i7OB2$createSignal, getOwner as $i7OB2$getOwner, createEffect as $i7OB2$createEffect, runWithOwner as $i7OB2$runWithOwner, onCleanup as $i7OB2$onCleanup, createMemo as $i7OB2$createMemo, createContext as $i7OB2$createContext, useContext as $i7OB2$useContext, mergeProps as $i7OB2$mergeProps, Show as $i7OB2$Show, createResource as $i7OB2$createResource, Suspense as $i7OB2$Suspense, untrack as $i7OB2$untrack, createRenderEffect as $i7OB2$createRenderEffect, Index as $i7OB2$Index, createRoot as $i7OB2$createRoot, For as $i7OB2$For, createUniqueId as $i7OB2$createUniqueId, createComputed as $i7OB2$createComputed, ErrorBoundary as $i7OB2$ErrorBoundary,
|
|
3
|
+
import { createSignal as $i7OB2$createSignal, getOwner as $i7OB2$getOwner, createEffect as $i7OB2$createEffect, runWithOwner as $i7OB2$runWithOwner, onCleanup as $i7OB2$onCleanup, createMemo as $i7OB2$createMemo, createContext as $i7OB2$createContext, useContext as $i7OB2$useContext, mergeProps as $i7OB2$mergeProps, Show as $i7OB2$Show, createResource as $i7OB2$createResource, Suspense as $i7OB2$Suspense, untrack as $i7OB2$untrack, createRenderEffect as $i7OB2$createRenderEffect, Index as $i7OB2$Index, createRoot as $i7OB2$createRoot, For as $i7OB2$For, createUniqueId as $i7OB2$createUniqueId, createComputed as $i7OB2$createComputed, ErrorBoundary as $i7OB2$ErrorBoundary, batch as $i7OB2$batch, on as $i7OB2$on, createReaction as $i7OB2$createReaction, mapArray as $i7OB2$mapArray } from "solid-js";
|
|
4
4
|
import { createStore as $i7OB2$createStore, reconcile as $i7OB2$reconcile } from "solid-js/store";
|
|
5
5
|
|
|
6
6
|
/*! Depict.ai search and product listing SDK */
|
|
7
7
|
import { register_es_version } from "../../multi_import_deduplicator.mjs";
|
|
8
8
|
register_es_version("ui", "latest");
|
|
9
|
-
const $ec291e0010116877$export$83d89fbfd8236492 = "2.1.
|
|
9
|
+
const $ec291e0010116877$export$83d89fbfd8236492 = "2.1.13";
|
|
10
10
|
const $4147651646da990a$var$fallback_operator = "in";
|
|
11
11
|
const $4147651646da990a$var$fallback_token = "";
|
|
12
12
|
const $4147651646da990a$var$legacy_filter_prefix = "filter_";
|
|
@@ -422,24 +422,30 @@ function $f32e14878e75af51$export$6649caad96ef8870({
|
|
|
422
422
|
|
|
423
423
|
/** @jsxImportSource solid-js */
|
|
424
424
|
|
|
425
|
-
function $
|
|
426
|
-
const [
|
|
425
|
+
function $2449872a62a75a20$export$ebdc3711f7e02ccd(what_to_watch) {
|
|
426
|
+
const [width, setWidth] = $i7OB2$createSignal();
|
|
427
427
|
const resizeObserver = new ResizeObserver($i7OB2$catchify(records => {
|
|
428
428
|
for (let j = 0; j < records.length; j++) {
|
|
429
429
|
const width = records[j].borderBoxSize?.[0]?.inlineSize ?? what_to_watch.getBoundingClientRect().width;
|
|
430
|
-
|
|
430
|
+
setWidth(width);
|
|
431
431
|
}
|
|
432
432
|
}));
|
|
433
433
|
// 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.
|
|
434
434
|
// It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
|
|
435
435
|
const disconnect = (0, $i7OB2$observer).onexists(what_to_watch, ({
|
|
436
436
|
element: element
|
|
437
|
-
}) => requestAnimationFrame($i7OB2$catchify(() =>
|
|
437
|
+
}) => requestAnimationFrame($i7OB2$catchify(() => {
|
|
438
|
+
const current_size = what_to_watch.getBoundingClientRect().width;
|
|
439
|
+
if (current_size)
|
|
440
|
+
// 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.
|
|
441
|
+
setWidth(current_size);
|
|
442
|
+
resizeObserver.observe(element);
|
|
443
|
+
})));
|
|
438
444
|
$i7OB2$onCleanup(() => {
|
|
439
445
|
resizeObserver.disconnect();
|
|
440
446
|
disconnect();
|
|
441
447
|
});
|
|
442
|
-
return
|
|
448
|
+
return width;
|
|
443
449
|
}
|
|
444
450
|
const $b5cccc8ee7d24677$var$transform_elements = sorted_cols_at_size => {
|
|
445
451
|
const cols_at_size = [];
|
|
@@ -1196,12 +1202,12 @@ function $8c0f86cb3e266eeb$export$a71e92cfbb498adc(props) {
|
|
|
1196
1202
|
}
|
|
1197
1203
|
const $19976a74d273070d$var$_tmpl$ = '<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"></path>';
|
|
1198
1204
|
function $19976a74d273070d$export$3b621d86b1566b2(props = {}) {
|
|
1199
|
-
return $i7OB2$ssrElement("svg", $i7OB2$mergeProps1(
|
|
1205
|
+
return $i7OB2$ssrElement("svg", $i7OB2$mergeProps1({
|
|
1200
1206
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1201
1207
|
width: "21.064",
|
|
1202
1208
|
height: "21.047",
|
|
1203
1209
|
viewBox: "0 0 21.064 21.064"
|
|
1204
|
-
}), () => $i7OB2$ssr($19976a74d273070d$var$_tmpl$), true);
|
|
1210
|
+
}, props), () => $i7OB2$ssr($19976a74d273070d$var$_tmpl$), true);
|
|
1205
1211
|
}
|
|
1206
1212
|
|
|
1207
1213
|
/**
|
|
@@ -1415,7 +1421,7 @@ function $1adfe60f3a14a1d7$export$fecbb157621501bd({
|
|
|
1415
1421
|
const $49b79728e7d9e2a1$var$_tmpl$ = ["<span", ' class="count">', "</span>"],
|
|
1416
1422
|
$49b79728e7d9e2a1$var$_tmpl$2 = ["<label", ' class="', '"', '><div class="left"><input type="checkbox"', "", "", '><span class="custom-indicator"></span><span class="text line-clamp">', "</span></div><!--$-->", "<!--/--></label>"];
|
|
1417
1423
|
const $49b79728e7d9e2a1$export$48513f6b9f8ce62d = props => {
|
|
1418
|
-
// 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
|
|
1424
|
+
/* 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
|
|
1419
1425
|
const count = $i7OB2$createMemo(() => props.count_);
|
|
1420
1426
|
const label = $i7OB2$createMemo(() => props.label_);
|
|
1421
1427
|
const checked = $i7OB2$createMemo(() => props.checked_);
|
|
@@ -1447,6 +1453,59 @@ function $67b173f9db427028$export$ca21a16d65b3dd8({
|
|
|
1447
1453
|
}) {
|
|
1448
1454
|
return $i7OB2$ssr($67b173f9db427028$var$_tmpl$, $i7OB2$ssrHydrationKey(), `expand-filter ${get_show_extras() ? "expanded" : ""}`, $i7OB2$escape($i7OB2$createComponent((0, $f8a56ba74eedd0c6$export$f21ab0717a89c77f), {})), get_show_extras() ? $i7OB2$escape(i18n_.view_less_()) : $i7OB2$escape(i18n_.view_more_()));
|
|
1449
1455
|
}
|
|
1456
|
+
const $f3213c0640246d58$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"],
|
|
1457
|
+
$f3213c0640246d58$var$_tmpl$2 = ["<span", ' class="', '"', ">", "</span>"];
|
|
1458
|
+
function $f3213c0640246d58$export$ba17c5b7e6dda39f({
|
|
1459
|
+
whole_text_to_display_: whole_text_to_display_memo,
|
|
1460
|
+
searching_for_value_: searching_for_value_memo,
|
|
1461
|
+
class_: class_
|
|
1462
|
+
}) {
|
|
1463
|
+
const [get_has_highlighted, set_has_highlighted] = $i7OB2$createSignal(false);
|
|
1464
|
+
const text_itself = $i7OB2$createMemo(() => $i7OB2$batch(() => {
|
|
1465
|
+
set_has_highlighted(false);
|
|
1466
|
+
const searching_for_value = searching_for_value_memo();
|
|
1467
|
+
const whole_text_to_display_ = whole_text_to_display_memo();
|
|
1468
|
+
let for_black = "";
|
|
1469
|
+
let pushed_grey = false;
|
|
1470
|
+
const search_q = searching_for_value;
|
|
1471
|
+
if (!search_q) return whole_text_to_display_;
|
|
1472
|
+
const output = [];
|
|
1473
|
+
const searching_for = search_q.toLowerCase();
|
|
1474
|
+
const push_black = () => {
|
|
1475
|
+
if (for_black) {
|
|
1476
|
+
set_has_highlighted(true);
|
|
1477
|
+
output.push($i7OB2$ssr($f3213c0640246d58$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape(for_black))); // "black"
|
|
1478
|
+
for_black = "";
|
|
1479
|
+
}
|
|
1480
|
+
};
|
|
1481
|
+
for (let i = 0; i < whole_text_to_display_.length;) {
|
|
1482
|
+
let is_whole_word = true;
|
|
1483
|
+
let searching_for_but_with_texts_casing = "";
|
|
1484
|
+
const i_at_start = i;
|
|
1485
|
+
for (let j = 0; j < searching_for.length; i++, j++) {
|
|
1486
|
+
const letter_in_suggestion = whole_text_to_display_[i];
|
|
1487
|
+
if (letter_in_suggestion?.toLowerCase() !== searching_for[j]) {
|
|
1488
|
+
is_whole_word = false;
|
|
1489
|
+
i = i_at_start;
|
|
1490
|
+
break;
|
|
1491
|
+
}
|
|
1492
|
+
searching_for_but_with_texts_casing += letter_in_suggestion;
|
|
1493
|
+
}
|
|
1494
|
+
if (is_whole_word) {
|
|
1495
|
+
push_black();
|
|
1496
|
+
output.push(searching_for_but_with_texts_casing);
|
|
1497
|
+
pushed_grey = true;
|
|
1498
|
+
} else for_black += whole_text_to_display_[i++];
|
|
1499
|
+
}
|
|
1500
|
+
push_black();
|
|
1501
|
+
if (!pushed_grey) {
|
|
1502
|
+
set_has_highlighted(false);
|
|
1503
|
+
return whole_text_to_display_;
|
|
1504
|
+
}
|
|
1505
|
+
return output;
|
|
1506
|
+
}));
|
|
1507
|
+
return $i7OB2$ssr($f3213c0640246d58$var$_tmpl$2, $i7OB2$ssrHydrationKey(), `${$i7OB2$escape(class_, true) || ""} ${get_has_highlighted() ? "has-match" : ""}`, $i7OB2$ssrAttribute("title", $i7OB2$escape(whole_text_to_display_memo(), true), false), $i7OB2$escape(text_itself()));
|
|
1508
|
+
}
|
|
1450
1509
|
const $a4601e6bea3ed1e6$var$_tmpl$ = ["<form", ' class="checkboxes"><!--$-->', "<!--/--><!--$-->", "<!--/--></form>"];
|
|
1451
1510
|
const $a4601e6bea3ed1e6$var$max_visible_without_collapsing = 15;
|
|
1452
1511
|
const $a4601e6bea3ed1e6$var$show_non_collapsible_when_collapsed = 4;
|
|
@@ -1454,7 +1513,8 @@ function $a4601e6bea3ed1e6$export$dd948f91abc3a1c4({
|
|
|
1454
1513
|
filter_: filter_,
|
|
1455
1514
|
selected_filters_: [get_selected_filters, set_selected_filters],
|
|
1456
1515
|
i18n_: i18n_,
|
|
1457
|
-
view_more_button_below_group_: [, set_view_more_button_below_group_]
|
|
1516
|
+
view_more_button_below_group_: [, set_view_more_button_below_group_],
|
|
1517
|
+
filter_query_: filter_query_
|
|
1458
1518
|
}) {
|
|
1459
1519
|
const existing_filter = $i7OB2$createMemo(() => {
|
|
1460
1520
|
const {
|
|
@@ -1482,12 +1542,18 @@ function $a4601e6bea3ed1e6$export$dd948f91abc3a1c4({
|
|
|
1482
1542
|
const value = $91aa8ee9f431800d$export$325f75597868c4f0(checkbox().value_);
|
|
1483
1543
|
return !!data?.some(item => $91aa8ee9f431800d$export$325f75597868c4f0(item) === value);
|
|
1484
1544
|
});
|
|
1545
|
+
const value = $i7OB2$createMemo(() => checkbox().value_);
|
|
1485
1546
|
return $i7OB2$createComponent((0, $49b79728e7d9e2a1$export$48513f6b9f8ce62d), {
|
|
1486
1547
|
get value_() {
|
|
1487
|
-
return
|
|
1548
|
+
return value();
|
|
1488
1549
|
},
|
|
1489
1550
|
get label_() {
|
|
1490
|
-
return
|
|
1551
|
+
return $i7OB2$createComponent((0, $f3213c0640246d58$export$ba17c5b7e6dda39f), {
|
|
1552
|
+
get whole_text_to_display_() {
|
|
1553
|
+
return $i7OB2$createMemo(() => checkbox().name_ || value());
|
|
1554
|
+
},
|
|
1555
|
+
searching_for_value_: () => filter_query_?.()
|
|
1556
|
+
});
|
|
1491
1557
|
},
|
|
1492
1558
|
get count_() {
|
|
1493
1559
|
return checkbox().count_;
|
|
@@ -1549,7 +1615,8 @@ const $eb8d9bf3b5700c26$var$_tmpl$ = ["<form", ' class="radios">', "</form>"],
|
|
|
1549
1615
|
$eb8d9bf3b5700c26$var$_tmpl$3 = ["<label", ' class="', '"', '><div class="left"><input type="radio"', "", '><span class="custom-indicator"></span><!--$-->', "<!--/--></div><!--$-->", "<!--/--></label>"];
|
|
1550
1616
|
function $eb8d9bf3b5700c26$export$430444115f70a734({
|
|
1551
1617
|
selected_filters_: selected_filters_,
|
|
1552
|
-
filter_: filter_
|
|
1618
|
+
filter_: filter_,
|
|
1619
|
+
filter_query_: filter_query_
|
|
1553
1620
|
}) {
|
|
1554
1621
|
const radio_name = $i7OB2$make_random_classname();
|
|
1555
1622
|
const existing_filter = $i7OB2$createMemo(() => {
|
|
@@ -1569,17 +1636,21 @@ function $eb8d9bf3b5700c26$export$430444115f70a734({
|
|
|
1569
1636
|
children: (value, index) => {
|
|
1570
1637
|
const random_selector = $i7OB2$make_random_classname();
|
|
1571
1638
|
const count = $i7OB2$createMemo(() => filter_().meta.counts?.[index]);
|
|
1639
|
+
const label = $i7OB2$createMemo(() => {
|
|
1640
|
+
const name = filter_().meta?.names?.[index];
|
|
1641
|
+
if (name) return name;
|
|
1642
|
+
const v = value();
|
|
1643
|
+
return Array.isArray(v) ? v.join(" - ") : v + "";
|
|
1644
|
+
});
|
|
1572
1645
|
return $i7OB2$ssr($eb8d9bf3b5700c26$var$_tmpl$3, $i7OB2$ssrHydrationKey(), `input-row ${count() === 0 ? "count-0" : ""}`, $i7OB2$ssrAttribute("for", $i7OB2$escape(random_selector, true), false), $i7OB2$ssrAttribute("id", $i7OB2$escape(random_selector, true), false) + $i7OB2$ssrAttribute("name", $i7OB2$escape(radio_name, true), false), $i7OB2$ssrAttribute("checked", $i7OB2$createMemo(() => {
|
|
1573
1646
|
const v = value();
|
|
1574
1647
|
const data = existing_filter()?.data;
|
|
1575
1648
|
if ($91aa8ee9f431800d$export$325f75597868c4f0(data) === $91aa8ee9f431800d$export$325f75597868c4f0(v)) return true;
|
|
1576
1649
|
return Array.isArray(data) && data.every((item, index) => item === v[index]);
|
|
1577
|
-
})(), true), $i7OB2$escape($i7OB2$
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
return Array.isArray(v) ? v.join(" - ") : v;
|
|
1582
|
-
})()), $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Show), {
|
|
1650
|
+
})(), true), $i7OB2$escape($i7OB2$createComponent((0, $f3213c0640246d58$export$ba17c5b7e6dda39f), {
|
|
1651
|
+
whole_text_to_display_: label,
|
|
1652
|
+
searching_for_value_: () => filter_query_?.()
|
|
1653
|
+
})), $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Show), {
|
|
1583
1654
|
get when() {
|
|
1584
1655
|
return count() != undefined;
|
|
1585
1656
|
},
|
|
@@ -1596,7 +1667,8 @@ const $a6b08770e164eced$var$_tmpl$ = ["<div", ' class="', '"><div class="input-g
|
|
|
1596
1667
|
function $a6b08770e164eced$export$e0d834a0ad870cda({
|
|
1597
1668
|
filter_: filter_,
|
|
1598
1669
|
selected_filters_: selected_filters_,
|
|
1599
|
-
i18n_: i18n_
|
|
1670
|
+
i18n_: i18n_,
|
|
1671
|
+
filter_query_: filter_query_
|
|
1600
1672
|
}) {
|
|
1601
1673
|
// 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
|
|
1602
1674
|
// 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
|
|
@@ -1815,168 +1887,428 @@ function $0b6bc2f8309efa8a$export$e5c2828934226505({
|
|
|
1815
1887
|
});
|
|
1816
1888
|
return outer_div;
|
|
1817
1889
|
}
|
|
1818
|
-
const $
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
function $1c8cac76cb67e9af$export$a32086fa6616eafd({
|
|
1825
|
-
filter_: filter_,
|
|
1826
|
-
selected_filters_: selected_filters_,
|
|
1827
|
-
i18n_: i18n_,
|
|
1828
|
-
view_more_button_below_group_: view_more_button_below_group_,
|
|
1829
|
-
expanded_hierarchical_filters_: expanded_hierarchical_filters_
|
|
1890
|
+
const $522a690e0e2bd46d$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"];
|
|
1891
|
+
const $522a690e0e2bd46d$var$dont_cut_in_between_less_than_characters = 30;
|
|
1892
|
+
function $522a690e0e2bd46d$export$e1a98a189fd2c0e7({
|
|
1893
|
+
content_result_: content_result_,
|
|
1894
|
+
key_: key_,
|
|
1895
|
+
cut_when_possible_: cut_when_possible_
|
|
1830
1896
|
}) {
|
|
1831
|
-
|
|
1832
|
-
const
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
}
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
}) => checking_field === field && checking_op === op);
|
|
1841
|
-
});
|
|
1842
|
-
const show_extras = $i7OB2$createSignal(false);
|
|
1843
|
-
const trigger_sync_ = $1c8cac76cb67e9af$var$batching_filter_state_syncer({
|
|
1844
|
-
filter_: filter_,
|
|
1845
|
-
existing_filter_: existing_filter,
|
|
1846
|
-
selected_filters_: selected_filters_,
|
|
1847
|
-
get category_structure_() {
|
|
1848
|
-
return structured_categories();
|
|
1849
|
-
}
|
|
1850
|
-
});
|
|
1851
|
-
const structured_categories = $i7OB2$createMemo(() => {
|
|
1852
|
-
const execute_when_structure_finished = [];
|
|
1853
|
-
const {
|
|
1854
|
-
values: values,
|
|
1855
|
-
names: names,
|
|
1856
|
-
counts: counts
|
|
1857
|
-
} = filter_().meta;
|
|
1858
|
-
const data_structure = {};
|
|
1859
|
-
for (let i = 0; i < values.length; i++) {
|
|
1860
|
-
const value = values[i];
|
|
1861
|
-
let pointer = data_structure;
|
|
1862
|
-
let parent_ = {};
|
|
1863
|
-
let created_an_object = false;
|
|
1864
|
-
for (let j = 0; j < value.length; j++) {
|
|
1865
|
-
const this_categories_name = value[j];
|
|
1866
|
-
const obj = pointer[this_categories_name] ||= (() => {
|
|
1867
|
-
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;
|
|
1868
|
-
const created_obj = {
|
|
1869
|
-
name_: names[i],
|
|
1870
|
-
count_: counts?.[i],
|
|
1871
|
-
parent_: parent_,
|
|
1872
|
-
is_expanded_: $1c8cac76cb67e9af$var$make_expanded_signal({
|
|
1873
|
-
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
1874
|
-
filter_value_: value_as_string
|
|
1875
|
-
}),
|
|
1876
|
-
value_: value_as_string,
|
|
1877
|
-
children_: {}
|
|
1878
|
-
};
|
|
1879
|
-
const {
|
|
1880
|
-
signal_: signal_,
|
|
1881
|
-
on_structure_complete_: on_structure_complete_
|
|
1882
|
-
} = $1c8cac76cb67e9af$var$create_updating_signal({
|
|
1883
|
-
self_: created_obj,
|
|
1884
|
-
existing_filter_: $i7OB2$untrack(existing_filter),
|
|
1885
|
-
trigger_sync_: trigger_sync_
|
|
1886
|
-
});
|
|
1887
|
-
execute_when_structure_finished.push(on_structure_complete_);
|
|
1888
|
-
created_obj.is_checked_ = signal_;
|
|
1889
|
-
parent_ = created_obj;
|
|
1890
|
-
created_an_object = true;
|
|
1891
|
-
return created_obj;
|
|
1892
|
-
})();
|
|
1893
|
-
pointer = obj.children_;
|
|
1894
|
-
parent_ = obj;
|
|
1895
|
-
}
|
|
1896
|
-
if (!created_an_object && "value_" in parent_) {
|
|
1897
|
-
// 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
|
|
1898
|
-
// [
|
|
1899
|
-
// ["Öl", "IPA"],
|
|
1900
|
-
// ["Öl", "Pale Ale"],
|
|
1901
|
-
// ["Öl", "Ale"],
|
|
1902
|
-
// ["Öl", "Mörk Lager"],
|
|
1903
|
-
// ["Öl", "Suröl"],
|
|
1904
|
-
// ["Öl", "Veteöl"],
|
|
1905
|
-
// ["Öl", "Stout och Porter"],
|
|
1906
|
-
// ["Öl"], // <- We are here, our `hierarchical_data_structure[string]`-object was created when we iterated over ["Öl", "IPA"]
|
|
1907
|
-
// ["Öl", "Ljus Lager"],
|
|
1908
|
-
// ];
|
|
1909
|
-
// In this case we want to just correct the name and value of the already created object, which will be in parent_
|
|
1910
|
-
parent_.value_ = value.map(v => v + "");
|
|
1911
|
-
parent_.name_ = names[i];
|
|
1912
|
-
parent_.count_ = counts[i];
|
|
1913
|
-
parent_.is_expanded_ = $1c8cac76cb67e9af$var$make_expanded_signal({
|
|
1914
|
-
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
1915
|
-
filter_value_: parent_.value_
|
|
1916
|
-
});
|
|
1917
|
-
}
|
|
1918
|
-
}
|
|
1919
|
-
while (execute_when_structure_finished.length) execute_when_structure_finished.pop()();
|
|
1920
|
-
$1c8cac76cb67e9af$var$expand_until_choice(data_structure);
|
|
1921
|
-
$i7OB2$dlog("CheckboxHierarchicalFilter: Recomputed structured_categories", data_structure);
|
|
1922
|
-
return data_structure;
|
|
1923
|
-
});
|
|
1924
|
-
const some_top_level_are_hidden = $i7OB2$createMemo(() => Object.keys(structured_categories()).length > $1c8cac76cb67e9af$var$max_visible_without_collapsing);
|
|
1925
|
-
const {
|
|
1926
|
-
expand: expand,
|
|
1927
|
-
collapse: collapse,
|
|
1928
|
-
ExpandingContainer: ExpandingContainer
|
|
1929
|
-
} = $24e27fab9c821b86$export$5bad61ecde080b1f({
|
|
1930
|
-
duration: 200
|
|
1931
|
-
});
|
|
1932
|
-
const expanding_container_els = $i7OB2$createComponent(ExpandingContainer, {
|
|
1897
|
+
const matched_tokens = $i7OB2$createMemo(() => content_result_().highlights?.find(highlight => highlight.field == key_)?.matched_tokens);
|
|
1898
|
+
const full_value = $i7OB2$createMemo(() => content_result_()[key_]?.replaceAll("\n", " "));
|
|
1899
|
+
return $i7OB2$createComponent((0, $i7OB2$Show), {
|
|
1900
|
+
get when() {
|
|
1901
|
+
return matched_tokens()?.length;
|
|
1902
|
+
},
|
|
1903
|
+
get fallback() {
|
|
1904
|
+
return full_value();
|
|
1905
|
+
},
|
|
1933
1906
|
get children() {
|
|
1934
|
-
return
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1907
|
+
return (() => {
|
|
1908
|
+
const segmented_cut_text = $i7OB2$createMemo(() => {
|
|
1909
|
+
const segmented_text = $522a690e0e2bd46d$export$1b00d74faf266c56(full_value(), matched_tokens());
|
|
1910
|
+
if (cut_when_possible_) $522a690e0e2bd46d$var$cut_text(segmented_text);
|
|
1911
|
+
return segmented_text;
|
|
1912
|
+
});
|
|
1913
|
+
return $i7OB2$createComponent((0, $i7OB2$Index), {
|
|
1914
|
+
get each() {
|
|
1915
|
+
return segmented_cut_text();
|
|
1916
|
+
},
|
|
1917
|
+
children: item => {
|
|
1918
|
+
return $i7OB2$createComponent((0, $i7OB2$Show), {
|
|
1919
|
+
get when() {
|
|
1920
|
+
return item().highlighted_;
|
|
1921
|
+
},
|
|
1922
|
+
get fallback() {
|
|
1923
|
+
return item().text_;
|
|
1924
|
+
},
|
|
1925
|
+
get children() {
|
|
1926
|
+
return $i7OB2$ssr($522a690e0e2bd46d$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape(item().text_));
|
|
1927
|
+
}
|
|
1928
|
+
});
|
|
1929
|
+
}
|
|
1930
|
+
});
|
|
1931
|
+
})();
|
|
1942
1932
|
}
|
|
1943
1933
|
});
|
|
1944
|
-
$i7OB2$createRenderEffect(() => {
|
|
1945
|
-
view_more_button_below_group_[1](some_top_level_are_hidden() ? $i7OB2$createComponent((0, $67b173f9db427028$export$ca21a16d65b3dd8), {
|
|
1946
|
-
show_extras_: show_extras,
|
|
1947
|
-
i18n_: i18n_
|
|
1948
|
-
}) : []);
|
|
1949
|
-
});
|
|
1950
|
-
$i7OB2$createEffect($i7OB2$catchify(async () => {
|
|
1951
|
-
if (!some_top_level_are_hidden()) {
|
|
1952
|
-
await collapse();
|
|
1953
|
-
return;
|
|
1954
|
-
}
|
|
1955
|
-
if (show_extras[0]()) await expand();else await collapse();
|
|
1956
|
-
}));
|
|
1957
|
-
return $i7OB2$ssr($1c8cac76cb67e9af$var$_tmpl$, $i7OB2$ssrHydrationKey(), `checkboxes hierarchical ${Object.values(structured_categories()).some(category => Object.keys(category.children_).length) ? "any-expandable" : ""}`, $i7OB2$escape($1c8cac76cb67e9af$var$render_stuff($i7OB2$createMemo(() => some_top_level_are_hidden() ? Object.fromEntries(Object.entries(structured_categories()).slice(0, $1c8cac76cb67e9af$var$show_non_collapsible_when_collapsed)) : structured_categories()), existing_filter, i18n_)), $i7OB2$escape(expanding_container_els));
|
|
1958
1934
|
}
|
|
1959
|
-
function $
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1935
|
+
function $522a690e0e2bd46d$var$cut_text(segmented_text) {
|
|
1936
|
+
// cut away chunks of text that are not highlighted to give a google-like overview of the content
|
|
1937
|
+
const highlighted_segments = segmented_text?.filter(segment => segment.highlighted_);
|
|
1938
|
+
if (!segmented_text || !highlighted_segments?.length) return;
|
|
1939
|
+
// We have one or more highlighted segments
|
|
1940
|
+
if (highlighted_segments.length === 1) {
|
|
1941
|
+
// cut away from the left until the start of the highlighted sentence if just one sentence is highlighted
|
|
1942
|
+
$522a690e0e2bd46d$var$cut_start(segmented_text.indexOf(highlighted_segments[0]), segmented_text);
|
|
1943
|
+
return;
|
|
1944
|
+
}
|
|
1945
|
+
// We have two or more highlighted segments, take the two biggest chunks and show them + a bit text around
|
|
1946
|
+
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
|
|
1947
|
+
);
|
|
1948
|
+
|
|
1949
|
+
const [longest_segment, next_longest_segment] = sorted_highlighted_segments;
|
|
1950
|
+
// We need to cut before the first segment - possibly through other segments - and maybe between segments
|
|
1951
|
+
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);
|
|
1952
|
+
$522a690e0e2bd46d$var$cut_start(index_of_first_segment, segmented_text);
|
|
1953
|
+
// update indexes since we might have removed segments
|
|
1954
|
+
[index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
|
|
1955
|
+
let number_of_characters_between_segments = 0;
|
|
1956
|
+
for (let i = index_of_first_segment + 1; i < index_of_second_segment; i++) {
|
|
1957
|
+
const segment = segmented_text[i];
|
|
1958
|
+
number_of_characters_between_segments += segment.text_.length;
|
|
1959
|
+
}
|
|
1960
|
+
if (number_of_characters_between_segments < $522a690e0e2bd46d$var$dont_cut_in_between_less_than_characters)
|
|
1961
|
+
// don't cut if there are less than 30 characters between the two segments
|
|
1962
|
+
return;
|
|
1963
|
+
// We have more than 50 characters between the two segments, cut between them
|
|
1964
|
+
const [split_start_segment, split_start_character] = $522a690e0e2bd46d$var$find_split_point(index_of_first_segment, index_of_second_segment, segmented_text);
|
|
1965
|
+
const [split_end_segment, split_end_character] = $522a690e0e2bd46d$var$find_split_point(index_of_second_segment, index_of_first_segment, segmented_text);
|
|
1966
|
+
if (split_start_segment === undefined || split_end_segment === undefined ||
|
|
1967
|
+
// identical split point, or split end before split start, can't do anything
|
|
1968
|
+
split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
|
|
1969
|
+
const dots_segment = {
|
|
1970
|
+
text_: " … ",
|
|
1971
|
+
highlighted_: false
|
|
1972
|
+
};
|
|
1973
|
+
const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
|
|
1974
|
+
if (i < split_start_segment || i > split_end_segment) return segment;
|
|
1975
|
+
const text = segment.text_;
|
|
1976
|
+
if (i == split_end_segment && i == split_start_segment) return [{
|
|
1977
|
+
...segment,
|
|
1978
|
+
text_: text.slice(0, split_start_character).trimEnd()
|
|
1979
|
+
}, dots_segment, {
|
|
1980
|
+
...segment,
|
|
1981
|
+
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
1982
|
+
}];else if (i == split_start_segment) {
|
|
1983
|
+
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
|
|
1984
|
+
return segment;
|
|
1985
|
+
} else if (i == split_end_segment) return [dots_segment, {
|
|
1986
|
+
...segment,
|
|
1987
|
+
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
1988
|
+
}];
|
|
1989
|
+
return []; // remove all segments inbetween
|
|
1990
|
+
});
|
|
1991
|
+
|
|
1992
|
+
segmented_text.splice(0, segmented_text.length, ...split_and_dotted_values); // Sorry…
|
|
1993
|
+
$522a690e0e2bd46d$var$heal_holes(segmented_text);
|
|
1994
|
+
}
|
|
1995
|
+
function $522a690e0e2bd46d$var$heal_holes(segmented_text) {
|
|
1996
|
+
// try to heal "holes" created in the segments so there are only alternating segments
|
|
1997
|
+
const segments_to_delete = new Set();
|
|
1998
|
+
for (let i = 0; i < segmented_text.length; i++) {
|
|
1999
|
+
const segment = segmented_text[i];
|
|
2000
|
+
let previous_segment;
|
|
2001
|
+
for (let j = i - 1; j >= 0; j--) {
|
|
2002
|
+
previous_segment = segmented_text[j];
|
|
2003
|
+
// Don't write to a segment that's marked for deletion or the contents we write to it will be deleted
|
|
2004
|
+
if (!segments_to_delete.has(previous_segment)) break;
|
|
2005
|
+
}
|
|
2006
|
+
if (previous_segment?.highlighted_ && segment.highlighted_ || previous_segment?.highlighted_ === false && segment.highlighted_ === false) {
|
|
2007
|
+
previous_segment.text_ += segment.text_; // IDK if this ever happens
|
|
2008
|
+
segments_to_delete.add(segment);
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
for (const segment of segments_to_delete) {
|
|
2012
|
+
const index = segmented_text.indexOf(segment);
|
|
2013
|
+
segmented_text.splice(index, 1);
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
function $522a690e0e2bd46d$var$find_split_point(index_of_start_segment, index_of_end_segment, segmented_text, be_very_aggressive = true) {
|
|
2017
|
+
const should_loop_backwards = index_of_start_segment > index_of_end_segment;
|
|
2018
|
+
const step = should_loop_backwards ? -1 : 1;
|
|
2019
|
+
const desperate_split_attempts = [":", ";", ","];
|
|
2020
|
+
while (desperate_split_attempts.length) {
|
|
2021
|
+
const split_point_between_words = [];
|
|
2022
|
+
// for the middle also try to split with a few more characters if the default ones don't work over a full run
|
|
2023
|
+
const desperate_split_attempt = desperate_split_attempts.pop();
|
|
2024
|
+
let is_first_character = true;
|
|
2025
|
+
for (let i = index_of_start_segment + step; should_loop_backwards ? i > index_of_end_segment : i < index_of_end_segment; i += step) {
|
|
2026
|
+
const segment = segmented_text[i];
|
|
2027
|
+
const text = segment.text_;
|
|
2028
|
+
for (let j = should_loop_backwards ? text.length - 1 : 0; should_loop_backwards ? j >= 0 : j < text.length; j += step) {
|
|
2029
|
+
const character = text[j];
|
|
2030
|
+
if (character == "." || character == "?" || character == "!" || character == desperate_split_attempt) return [i, j]; // segment index, character index
|
|
2031
|
+
if (is_first_character) is_first_character = false;else if (be_very_aggressive && character == " ") {
|
|
2032
|
+
split_point_between_words.push([i, j]);
|
|
2033
|
+
if (split_point_between_words.length > 3)
|
|
2034
|
+
// We can't find a split point, so we'll just split between words
|
|
2035
|
+
// 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
|
|
2036
|
+
return split_point_between_words[1];
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
return [];
|
|
2042
|
+
}
|
|
2043
|
+
function $522a690e0e2bd46d$var$cut_start(cut_left_of_index, segmented_text) {
|
|
2044
|
+
// Cut the start of the text to bring the first matching token
|
|
2045
|
+
let is_first_character = false;
|
|
2046
|
+
let words_encountered = 0;
|
|
2047
|
+
outmost_loop: for (let i = cut_left_of_index - 1; i >= 0; i--) {
|
|
2048
|
+
const segment = segmented_text[i];
|
|
2049
|
+
// We assume that two adjacent highlighted segments don't exist and have been merged if they were to have existed
|
|
2050
|
+
const text = segment.text_;
|
|
2051
|
+
for (let j = text.length - 1; j >= 0; j--) {
|
|
2052
|
+
const character = text[j];
|
|
2053
|
+
const is_space = character == " ";
|
|
2054
|
+
if (!is_first_character && is_space) words_encountered++;
|
|
2055
|
+
if (character == "." || character == "?" || character == "!" || character == "," || words_encountered > 8 && is_space) {
|
|
2056
|
+
// We have to be really aggressive at the start of sentences so stuff can be seen on mobile, hence comma
|
|
2057
|
+
segment.text_ = text.slice(j + 1).trimStart();
|
|
2058
|
+
segmented_text.splice(0, i);
|
|
2059
|
+
if (character === "," || is_space)
|
|
2060
|
+
// if we cut at a comma or psace, we add a … at the beginning
|
|
2061
|
+
segmented_text.unshift({
|
|
2062
|
+
text_: "… ",
|
|
2063
|
+
highlighted_: false
|
|
2064
|
+
});
|
|
2065
|
+
break outmost_loop;
|
|
2066
|
+
}
|
|
2067
|
+
if (is_first_character) is_first_character = false;
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
$522a690e0e2bd46d$var$heal_holes(segmented_text); // if we added a ... there could now be a sequence that's not alternating true/false
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
function $522a690e0e2bd46d$export$1b00d74faf266c56(text, matched_strings, loose = false) {
|
|
2074
|
+
const output = [];
|
|
2075
|
+
if (!text) return; // shouldn't happen but whatever
|
|
2076
|
+
for (let i = 0; i < text.length; i++) {
|
|
2077
|
+
const found_strings = [];
|
|
2078
|
+
if (!i || text[i - 1] == " " || loose)
|
|
2079
|
+
// only match at the start of a word or string, it looks weird if i.e. "we" is highlighted in "activewear
|
|
2080
|
+
for (let j = 0; j < matched_strings.length; j++) {
|
|
2081
|
+
const matched_string = matched_strings[j];
|
|
2082
|
+
const part_in_text = text.slice(i, i + matched_string.length);
|
|
2083
|
+
if (matched_string.length < 2 && !loose) continue; // don't match on single characters, i.e. "I", it looks weird
|
|
2084
|
+
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
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
const last_index_in_output = output.length - 1;
|
|
2088
|
+
if (!found_strings.length) {
|
|
2089
|
+
const character = text[i];
|
|
2090
|
+
if (output[last_index_in_output]?.highlighted_ === false || output.length && /\s/.test(character))
|
|
2091
|
+
// 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
|
|
2092
|
+
output[last_index_in_output].text_ += character;else output.push({
|
|
2093
|
+
highlighted_: false,
|
|
2094
|
+
text_: character
|
|
2095
|
+
});
|
|
2096
|
+
} else {
|
|
2097
|
+
const longest_found_string = found_strings.reduce((a, b) => a.length > b.length ? a : b);
|
|
2098
|
+
if (output[last_index_in_output]?.highlighted_) output[last_index_in_output].text_ += longest_found_string;else output.push({
|
|
2099
|
+
highlighted_: true,
|
|
2100
|
+
text_: longest_found_string
|
|
2101
|
+
});
|
|
2102
|
+
i += longest_found_string.length - 1;
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
return output;
|
|
2106
|
+
}
|
|
2107
|
+
const $3ec2b9489931358d$var$_tmpl$ = ["<span", ' class="', '">', "</span>"],
|
|
2108
|
+
$3ec2b9489931358d$var$_tmpl$2 = ["<span", ' class="highlighted-part">', "</span>"];
|
|
2109
|
+
function $3ec2b9489931358d$export$8e79c28529dbfa90(props) {
|
|
2110
|
+
const segmented_text = $i7OB2$createMemo(() => {
|
|
2111
|
+
const {
|
|
2112
|
+
to_highlight_: to_highlight_,
|
|
2113
|
+
text_: text_
|
|
2114
|
+
} = props;
|
|
2115
|
+
return $522a690e0e2bd46d$export$1b00d74faf266c56(text_, to_highlight_ ? [to_highlight_] : [], true);
|
|
2116
|
+
});
|
|
2117
|
+
const has_highlights = $i7OB2$createMemo(() => segmented_text().some(segment => segment.highlighted_));
|
|
2118
|
+
return $i7OB2$ssr($3ec2b9489931358d$var$_tmpl$, $i7OB2$ssrHydrationKey() + $i7OB2$ssrAttribute("title", $i7OB2$escape(props.text_, true), false), has_highlights() ? "has-match" : "", $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Index), {
|
|
2119
|
+
get each() {
|
|
2120
|
+
return segmented_text();
|
|
2121
|
+
},
|
|
2122
|
+
children: item => {
|
|
2123
|
+
return $i7OB2$createComponent((0, $i7OB2$Show), {
|
|
2124
|
+
get when() {
|
|
2125
|
+
return item().highlighted_;
|
|
2126
|
+
},
|
|
2127
|
+
get fallback() {
|
|
2128
|
+
return item().text_;
|
|
2129
|
+
},
|
|
2130
|
+
get children() {
|
|
2131
|
+
return $i7OB2$ssr($3ec2b9489931358d$var$_tmpl$2, $i7OB2$ssrHydrationKey(), $i7OB2$escape(item().text_));
|
|
2132
|
+
}
|
|
2133
|
+
});
|
|
2134
|
+
}
|
|
2135
|
+
})));
|
|
2136
|
+
}
|
|
2137
|
+
const $1c8cac76cb67e9af$var$_tmpl$ = ["<form", ' class="', '"><!--$-->', "<!--/--><!--$-->", "<!--/--></form>"],
|
|
2138
|
+
$1c8cac76cb67e9af$var$_tmpl$2 = ["<div", ' class="', '"><!--$-->', "<!--/--><!--$-->", "<!--/--></div>"],
|
|
2139
|
+
$1c8cac76cb67e9af$var$_tmpl$3 = ["<details", "></details>"],
|
|
2140
|
+
$1c8cac76cb67e9af$var$_tmpl$4 = ["<summary", ' class="category-parent"><div class="summary"><span class="', '">', "</span><!--$-->", "<!--/--></div></summary>"];
|
|
2141
|
+
const $1c8cac76cb67e9af$var$max_visible_without_collapsing = 15;
|
|
2142
|
+
const $1c8cac76cb67e9af$var$show_non_collapsible_when_collapsed = 4;
|
|
2143
|
+
function $1c8cac76cb67e9af$export$a32086fa6616eafd({
|
|
2144
|
+
filter_: filter_,
|
|
2145
|
+
selected_filters_: selected_filters_,
|
|
2146
|
+
i18n_: i18n_,
|
|
2147
|
+
view_more_button_below_group_: view_more_button_below_group_,
|
|
2148
|
+
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
2149
|
+
filter_query_: filter_query_
|
|
2150
|
+
}) {
|
|
2151
|
+
let form;
|
|
2152
|
+
const existing_filter = $i7OB2$createMemo(() => {
|
|
2153
|
+
const {
|
|
2154
|
+
field: field,
|
|
2155
|
+
op: op
|
|
2156
|
+
} = filter_();
|
|
2157
|
+
return selected_filters_[0]().find(({
|
|
2158
|
+
field: checking_field,
|
|
2159
|
+
op: checking_op
|
|
2160
|
+
}) => checking_field === field && checking_op === op);
|
|
2161
|
+
});
|
|
2162
|
+
const show_extras = $i7OB2$createSignal(false);
|
|
2163
|
+
const is_being_searched_ = $i7OB2$createMemo(() => !!filter_query_?.()); // If the user is searching in the filter
|
|
2164
|
+
const trigger_sync_ = $1c8cac76cb67e9af$var$batching_filter_state_syncer({
|
|
2165
|
+
filter_: filter_,
|
|
2166
|
+
existing_filter_: existing_filter,
|
|
2167
|
+
selected_filters_: selected_filters_,
|
|
2168
|
+
get category_structure_() {
|
|
2169
|
+
return structured_categories();
|
|
2170
|
+
}
|
|
2171
|
+
});
|
|
2172
|
+
const structured_categories = $i7OB2$createMemo(() => {
|
|
2173
|
+
const execute_when_structure_finished = [];
|
|
2174
|
+
const {
|
|
2175
|
+
values: values,
|
|
2176
|
+
names: names,
|
|
2177
|
+
counts: counts
|
|
2178
|
+
} = filter_().meta;
|
|
2179
|
+
const data_structure = {};
|
|
2180
|
+
for (let i = 0; i < values.length; i++) {
|
|
2181
|
+
const value = values[i];
|
|
2182
|
+
let pointer = data_structure;
|
|
2183
|
+
let parent_ = {};
|
|
2184
|
+
let created_an_object = false;
|
|
2185
|
+
for (let j = 0; j < value.length; j++) {
|
|
2186
|
+
const this_categories_name = value[j];
|
|
2187
|
+
const obj = pointer[this_categories_name] ||= (() => {
|
|
2188
|
+
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;
|
|
2189
|
+
const created_obj = {
|
|
2190
|
+
name_: names[i],
|
|
2191
|
+
count_: counts?.[i],
|
|
2192
|
+
parent_: parent_,
|
|
2193
|
+
is_expanded_: $1c8cac76cb67e9af$var$make_expanded_signal({
|
|
2194
|
+
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
2195
|
+
filter_value_: value_as_string,
|
|
2196
|
+
is_being_searched_: is_being_searched_
|
|
2197
|
+
}),
|
|
2198
|
+
value_: value_as_string,
|
|
2199
|
+
children_: {}
|
|
2200
|
+
};
|
|
2201
|
+
const {
|
|
2202
|
+
signal_: signal_,
|
|
2203
|
+
on_structure_complete_: on_structure_complete_
|
|
2204
|
+
} = $1c8cac76cb67e9af$var$create_updating_signal({
|
|
2205
|
+
self_: created_obj,
|
|
2206
|
+
existing_filter_: $i7OB2$untrack(existing_filter),
|
|
2207
|
+
trigger_sync_: trigger_sync_
|
|
2208
|
+
});
|
|
2209
|
+
execute_when_structure_finished.push(on_structure_complete_);
|
|
2210
|
+
created_obj.is_checked_ = signal_;
|
|
2211
|
+
parent_ = created_obj;
|
|
2212
|
+
created_an_object = true;
|
|
2213
|
+
return created_obj;
|
|
2214
|
+
})();
|
|
2215
|
+
pointer = obj.children_;
|
|
2216
|
+
parent_ = obj;
|
|
2217
|
+
}
|
|
2218
|
+
if (!created_an_object && "value_" in parent_) {
|
|
2219
|
+
// 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
|
|
2220
|
+
// [
|
|
2221
|
+
// ["Öl", "IPA"],
|
|
2222
|
+
// ["Öl", "Pale Ale"],
|
|
2223
|
+
// ["Öl", "Ale"],
|
|
2224
|
+
// ["Öl", "Mörk Lager"],
|
|
2225
|
+
// ["Öl", "Suröl"],
|
|
2226
|
+
// ["Öl", "Veteöl"],
|
|
2227
|
+
// ["Öl", "Stout och Porter"],
|
|
2228
|
+
// ["Öl"], // <- We are here, our `hierarchical_data_structure[string]`-object was created when we iterated over ["Öl", "IPA"]
|
|
2229
|
+
// ["Öl", "Ljus Lager"],
|
|
2230
|
+
// ];
|
|
2231
|
+
// In this case we want to just correct the name and value of the already created object, which will be in parent_
|
|
2232
|
+
parent_.value_ = value.map(v => v + "");
|
|
2233
|
+
parent_.name_ = names[i];
|
|
2234
|
+
parent_.count_ = counts[i];
|
|
2235
|
+
parent_.is_expanded_ = $1c8cac76cb67e9af$var$make_expanded_signal({
|
|
2236
|
+
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
2237
|
+
filter_value_: parent_.value_,
|
|
2238
|
+
is_being_searched_: is_being_searched_
|
|
2239
|
+
});
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
while (execute_when_structure_finished.length) execute_when_structure_finished.pop()();
|
|
2243
|
+
$1c8cac76cb67e9af$var$expand_until_choice(data_structure);
|
|
2244
|
+
$i7OB2$dlog("CheckboxHierarchicalFilter: Recomputed structured_categories", data_structure);
|
|
2245
|
+
return data_structure;
|
|
2246
|
+
});
|
|
2247
|
+
const some_top_level_are_hidden = $i7OB2$createMemo(() => Object.keys(structured_categories()).length > $1c8cac76cb67e9af$var$max_visible_without_collapsing);
|
|
2248
|
+
const {
|
|
2249
|
+
expand: expand,
|
|
2250
|
+
collapse: collapse,
|
|
2251
|
+
ExpandingContainer: ExpandingContainer
|
|
2252
|
+
} = $24e27fab9c821b86$export$5bad61ecde080b1f({
|
|
2253
|
+
duration: 200
|
|
2254
|
+
});
|
|
2255
|
+
const expanding_container_els = $i7OB2$createComponent(ExpandingContainer, {
|
|
2256
|
+
get children() {
|
|
2257
|
+
return $i7OB2$createComponent((0, $i7OB2$Show), {
|
|
2258
|
+
get when() {
|
|
2259
|
+
return some_top_level_are_hidden();
|
|
2260
|
+
},
|
|
2261
|
+
get children() {
|
|
2262
|
+
return $1c8cac76cb67e9af$var$render_stuff($i7OB2$createMemo(() => Object.fromEntries(Object.entries(structured_categories()).slice($1c8cac76cb67e9af$var$show_non_collapsible_when_collapsed))), existing_filter, i18n_, filter_query_);
|
|
2263
|
+
}
|
|
2264
|
+
});
|
|
2265
|
+
}
|
|
2266
|
+
});
|
|
2267
|
+
$i7OB2$createRenderEffect(() => {
|
|
2268
|
+
view_more_button_below_group_[1](some_top_level_are_hidden() ? $i7OB2$createComponent((0, $67b173f9db427028$export$ca21a16d65b3dd8), {
|
|
2269
|
+
show_extras_: show_extras,
|
|
2270
|
+
i18n_: i18n_
|
|
2271
|
+
}) : []);
|
|
2272
|
+
});
|
|
2273
|
+
$i7OB2$createEffect($i7OB2$catchify(async () => {
|
|
2274
|
+
if (!some_top_level_are_hidden()) {
|
|
2275
|
+
await collapse();
|
|
2276
|
+
return;
|
|
2277
|
+
}
|
|
2278
|
+
if (show_extras[0]()) await expand();else await collapse();
|
|
2279
|
+
}));
|
|
2280
|
+
return $i7OB2$ssr($1c8cac76cb67e9af$var$_tmpl$, $i7OB2$ssrHydrationKey(), `checkboxes hierarchical ${Object.values(structured_categories()).some(category => Object.keys(category.children_).length) ? "any-expandable" : ""}`, $i7OB2$escape($1c8cac76cb67e9af$var$render_stuff($i7OB2$createMemo(() => some_top_level_are_hidden() ? Object.fromEntries(Object.entries(structured_categories()).slice(0, $1c8cac76cb67e9af$var$show_non_collapsible_when_collapsed)) : structured_categories()), existing_filter, i18n_, filter_query_)), $i7OB2$escape(expanding_container_els));
|
|
2281
|
+
}
|
|
2282
|
+
function $1c8cac76cb67e9af$var$render_stuff(data, existing_filter, i18n_, filter_query_) {
|
|
2283
|
+
const keys = $i7OB2$createMemo(() => Object.keys(data()));
|
|
2284
|
+
return $i7OB2$createComponent((0, $i7OB2$For), {
|
|
2285
|
+
get each() {
|
|
2286
|
+
return keys();
|
|
2287
|
+
},
|
|
2288
|
+
children: key => $i7OB2$createComponent((0, $i7OB2$Show), {
|
|
2289
|
+
get when() {
|
|
2290
|
+
return $i7OB2$createMemo(() => !!data()[key])();
|
|
2291
|
+
},
|
|
2292
|
+
get children() {
|
|
2293
|
+
return (() => {
|
|
2294
|
+
// for some reason the for thing doesn't dispose of us if the key no longer exists?? so I'm doing it with show instead
|
|
2295
|
+
const value = $i7OB2$createMemo(() => data()[key]); // still sometimes get undefined here even though we have <Show>
|
|
2296
|
+
const has_expandable = $i7OB2$createMemo(() => !!Object.keys(value()?.children_ || {}).length);
|
|
2297
|
+
const value_as_string = $i7OB2$createMemo(() => JSON.stringify(value()?.value_));
|
|
2298
|
+
const label_text = $i7OB2$createMemo(() => value()?.name_ || value_as_string());
|
|
2299
|
+
return $i7OB2$ssr($1c8cac76cb67e9af$var$_tmpl$2, $i7OB2$ssrHydrationKey(), `checkbox-details ${has_expandable() ? "expandable" : ""}`, $i7OB2$escape($i7OB2$createComponent((0, $49b79728e7d9e2a1$export$48513f6b9f8ce62d), {
|
|
1975
2300
|
get value_() {
|
|
1976
|
-
return
|
|
2301
|
+
return value_as_string();
|
|
1977
2302
|
},
|
|
1978
2303
|
get label_() {
|
|
1979
|
-
return
|
|
2304
|
+
return $i7OB2$createComponent((0, $3ec2b9489931358d$export$8e79c28529dbfa90), {
|
|
2305
|
+
get text_() {
|
|
2306
|
+
return label_text();
|
|
2307
|
+
},
|
|
2308
|
+
get to_highlight_() {
|
|
2309
|
+
return filter_query_?.();
|
|
2310
|
+
}
|
|
2311
|
+
});
|
|
1980
2312
|
},
|
|
1981
2313
|
get count_() {
|
|
1982
2314
|
return has_expandable() ? undefined : value()?.count_;
|
|
@@ -2045,7 +2377,7 @@ function $1c8cac76cb67e9af$var$render_stuff(data, existing_filter, i18n_) {
|
|
|
2045
2377
|
return is_open();
|
|
2046
2378
|
},
|
|
2047
2379
|
get children() {
|
|
2048
|
-
return $1c8cac76cb67e9af$var$render_stuff($i7OB2$createMemo(() => value()?.children_ || {}), existing_filter, i18n_);
|
|
2380
|
+
return $1c8cac76cb67e9af$var$render_stuff($i7OB2$createMemo(() => value()?.children_ || {}), existing_filter, i18n_, filter_query_);
|
|
2049
2381
|
}
|
|
2050
2382
|
});
|
|
2051
2383
|
})();
|
|
@@ -2153,7 +2485,8 @@ function $1c8cac76cb67e9af$var$create_updating_signal({
|
|
|
2153
2485
|
}
|
|
2154
2486
|
function $1c8cac76cb67e9af$var$make_expanded_signal({
|
|
2155
2487
|
expanded_hierarchical_filters_: [read_expanded_hierarchical_filters, write_expanded_hierarchical_filters],
|
|
2156
|
-
filter_value_: filter_value_
|
|
2488
|
+
filter_value_: filter_value_,
|
|
2489
|
+
is_being_searched_: is_being_searched_
|
|
2157
2490
|
}) {
|
|
2158
2491
|
const index_in_expanded_filters = $i7OB2$createMemo(() => read_expanded_hierarchical_filters().findIndex(({
|
|
2159
2492
|
value_: value_
|
|
@@ -2192,7 +2525,9 @@ function $1c8cac76cb67e9af$var$make_expanded_signal({
|
|
|
2192
2525
|
defer: true
|
|
2193
2526
|
}));
|
|
2194
2527
|
return {
|
|
2195
|
-
ui_should_show_expanded_: $i7OB2$createMemo(
|
|
2528
|
+
ui_should_show_expanded_: $i7OB2$createMemo(
|
|
2529
|
+
// When user is searching through filters, expand everything they haven't collapsed, so they can see the results
|
|
2530
|
+
() => user_choice_signal[0]() ?? (is_being_searched_() || get_low_precedence_expanded())),
|
|
2196
2531
|
set_low_precedence_expanded_: set_low_precedence_expanded,
|
|
2197
2532
|
set_user_expanded_: set_user_choice_expanded
|
|
2198
2533
|
};
|
|
@@ -2220,7 +2555,9 @@ const $93716a9ad0dea854$var$gap_px = 5;
|
|
|
2220
2555
|
const $93716a9ad0dea854$var$max_columns = 3;
|
|
2221
2556
|
const $93716a9ad0dea854$export$414f6a19d38e655c = ({
|
|
2222
2557
|
filter_: filter_,
|
|
2223
|
-
selected_filters_: [get_selected_filters, set_selected_filters]
|
|
2558
|
+
selected_filters_: [get_selected_filters, set_selected_filters],
|
|
2559
|
+
filter_query_: filter_query_,
|
|
2560
|
+
details_element_width_: details_element_width_
|
|
2224
2561
|
}) => {
|
|
2225
2562
|
const existing_filter = $i7OB2$createMemo(() => {
|
|
2226
2563
|
const {
|
|
@@ -2248,18 +2585,18 @@ const $93716a9ad0dea854$export$414f6a19d38e655c = ({
|
|
|
2248
2585
|
const container_width_accessor = $i7OB2$createMemo(() => {
|
|
2249
2586
|
const element = container();
|
|
2250
2587
|
if (!element) return;
|
|
2251
|
-
return $
|
|
2588
|
+
return $2449872a62a75a20$export$ebdc3711f7e02ccd(element);
|
|
2252
2589
|
});
|
|
2253
2590
|
const [shadow_children, set_shadow_children] = $i7OB2$createSignal(new Set(), {
|
|
2254
2591
|
equals: false
|
|
2255
2592
|
});
|
|
2256
2593
|
const shadow_grid = $i7OB2$ssr($93716a9ad0dea854$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape([...shadow_children()])); // for getting the smallest possible sizes of all the items
|
|
2257
2594
|
$i7OB2$createEffect(() => {
|
|
2258
|
-
const container_width = container_width_accessor()?.();
|
|
2259
|
-
if (container_width
|
|
2595
|
+
const container_width = container_width_accessor()?.() || details_element_width_();
|
|
2596
|
+
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
|
|
2260
2597
|
$93716a9ad0dea854$var$adjust_sizes(container_width, sizes_set(), set_cols_at_size);
|
|
2261
2598
|
});
|
|
2262
|
-
return [
|
|
2599
|
+
return [$i7OB2$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), {
|
|
2263
2600
|
get cols_at_size() {
|
|
2264
2601
|
return cols_at_size();
|
|
2265
2602
|
},
|
|
@@ -2281,27 +2618,33 @@ const $93716a9ad0dea854$export$414f6a19d38e655c = ({
|
|
|
2281
2618
|
const current_value = $91aa8ee9f431800d$export$325f75597868c4f0(value().value_);
|
|
2282
2619
|
return !!data?.some(item => $91aa8ee9f431800d$export$325f75597868c4f0(item) === current_value);
|
|
2283
2620
|
});
|
|
2284
|
-
const MakeButton = attributes =>
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2621
|
+
const MakeButton = attributes => {
|
|
2622
|
+
const label = $i7OB2$createMemo(() => value().name_ || value().value_ + "");
|
|
2623
|
+
return $i7OB2$ssrElement("button", $i7OB2$mergeProps1(attributes, {
|
|
2624
|
+
get disabled() {
|
|
2625
|
+
return value().count_ === 0 && !is_selected();
|
|
2626
|
+
},
|
|
2627
|
+
get classList() {
|
|
2628
|
+
return {
|
|
2629
|
+
minor: !is_selected(),
|
|
2630
|
+
major: is_selected(),
|
|
2631
|
+
"major-minor-transition": true
|
|
2632
|
+
};
|
|
2633
|
+
}
|
|
2634
|
+
}), () => ["<!--$-->", $i7OB2$escape($i7OB2$createComponent((0, $f3213c0640246d58$export$ba17c5b7e6dda39f), {
|
|
2635
|
+
whole_text_to_display_: label,
|
|
2636
|
+
searching_for_value_: () => filter_query_?.()
|
|
2637
|
+
})), "<!--/-->", "<!--$-->", $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Show), {
|
|
2638
|
+
get when() {
|
|
2639
|
+
return value().count_ != undefined;
|
|
2640
|
+
},
|
|
2641
|
+
get children() {
|
|
2642
|
+
return $i7OB2$ssr($93716a9ad0dea854$var$_tmpl$2, $i7OB2$ssrHydrationKey(), $i7OB2$escape(value().count_));
|
|
2643
|
+
}
|
|
2644
|
+
})), "<!--/-->"], true);
|
|
2645
|
+
};
|
|
2303
2646
|
const invisible_size_button = $i7OB2$createComponent(MakeButton, {});
|
|
2304
|
-
const smallest_possible_size = $
|
|
2647
|
+
const smallest_possible_size = $2449872a62a75a20$export$ebdc3711f7e02ccd(invisible_size_button); // create ResizeObserver for the invisible size button where the div hugs its content
|
|
2305
2648
|
const sizes_value = $i7OB2$untrack(sizes_set);
|
|
2306
2649
|
const shadow_children_value = $i7OB2$untrack(shadow_children);
|
|
2307
2650
|
sizes_value.add(smallest_possible_size);
|
|
@@ -2321,7 +2664,7 @@ const $93716a9ad0dea854$export$414f6a19d38e655c = ({
|
|
|
2321
2664
|
}
|
|
2322
2665
|
});
|
|
2323
2666
|
}
|
|
2324
|
-
})];
|
|
2667
|
+
}), shadow_grid];
|
|
2325
2668
|
};
|
|
2326
2669
|
/**
|
|
2327
2670
|
* Calculate and apply cols_at_size overrides to fit as many items as possible in a row, evenly spaced
|
|
@@ -2387,7 +2730,8 @@ function $e731d52d97444b7c$export$82ed4b28ecb67608({
|
|
|
2387
2730
|
filter_: filter_,
|
|
2388
2731
|
selected_filters_: [get_selected_filters, set_selected_filters],
|
|
2389
2732
|
i18n_: i18n_,
|
|
2390
|
-
view_more_button_below_group_: [_get_view_more_button_below_group_, set_view_more_button_below_group_]
|
|
2733
|
+
view_more_button_below_group_: [_get_view_more_button_below_group_, set_view_more_button_below_group_],
|
|
2734
|
+
filter_query_: filter_query_
|
|
2391
2735
|
}) {
|
|
2392
2736
|
// same as in CheckboxFilter, maybe we should make this DRY at some point
|
|
2393
2737
|
const existing_filter = $i7OB2$createMemo(() => {
|
|
@@ -2421,12 +2765,17 @@ function $e731d52d97444b7c$export$82ed4b28ecb67608({
|
|
|
2421
2765
|
const value = $91aa8ee9f431800d$export$325f75597868c4f0(checkbox().value_);
|
|
2422
2766
|
return !!data?.some(item => $91aa8ee9f431800d$export$325f75597868c4f0(item) === value);
|
|
2423
2767
|
});
|
|
2768
|
+
const value = $i7OB2$createMemo(() => checkbox().value_);
|
|
2769
|
+
const label_text = $i7OB2$createMemo(() => checkbox().name_ || value() + "");
|
|
2424
2770
|
const input_row = $i7OB2$createComponent((0, $49b79728e7d9e2a1$export$48513f6b9f8ce62d), {
|
|
2425
2771
|
get value_() {
|
|
2426
|
-
return
|
|
2772
|
+
return value();
|
|
2427
2773
|
},
|
|
2428
2774
|
get label_() {
|
|
2429
|
-
return
|
|
2775
|
+
return $i7OB2$createComponent((0, $f3213c0640246d58$export$ba17c5b7e6dda39f), {
|
|
2776
|
+
whole_text_to_display_: label_text,
|
|
2777
|
+
searching_for_value_: () => filter_query_?.()
|
|
2778
|
+
});
|
|
2430
2779
|
},
|
|
2431
2780
|
get count_() {
|
|
2432
2781
|
return checkbox().count_;
|
|
@@ -2677,10 +3026,143 @@ function $d134eae24341b4a1$export$89c6019e4baa40b1(props) {
|
|
|
2677
3026
|
}
|
|
2678
3027
|
});
|
|
2679
3028
|
}
|
|
3029
|
+
const $16f0ed5ea30d8d9c$var$_tmpl$ = '<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"></path>';
|
|
3030
|
+
function $16f0ed5ea30d8d9c$export$82eafebb825fc23f(props = {}) {
|
|
3031
|
+
return $i7OB2$ssrElement("svg", $i7OB2$mergeProps1({
|
|
3032
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3033
|
+
width: "20",
|
|
3034
|
+
height: "22",
|
|
3035
|
+
viewBox: "0 0 20 22"
|
|
3036
|
+
}, props), () => $i7OB2$ssr($16f0ed5ea30d8d9c$var$_tmpl$), true);
|
|
3037
|
+
}
|
|
3038
|
+
const $e01b34f289b61435$var$_tmpl$ = ["<div", ' class="search-in-filters"><input type="text" class="query"', "><!--$-->", '<!--/--><button style="', '" class="clear">', "</button></div>"];
|
|
3039
|
+
const $e01b34f289b61435$var$min_items_to_enable_filter_searching = 10; // For checkbox hierarchical we 2x this
|
|
3040
|
+
function $e01b34f289b61435$export$4b2c5292ffe0c5dd(filter_array_, section, i18n_) {
|
|
3041
|
+
const [filter_query_, set_filter_query_] = $i7OB2$createSignal();
|
|
3042
|
+
// Check if we have enough items to enable searching
|
|
3043
|
+
const enable_searchability = $i7OB2$createMemo(() => {
|
|
3044
|
+
let count = 0;
|
|
3045
|
+
for (const filter of filter_array_()) {
|
|
3046
|
+
const type = filter.meta?.type;
|
|
3047
|
+
if (type === "range") continue;
|
|
3048
|
+
const length = filter.meta.values.length;
|
|
3049
|
+
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
|
|
3050
|
+
}
|
|
3051
|
+
|
|
3052
|
+
return count >= $e01b34f289b61435$var$min_items_to_enable_filter_searching;
|
|
3053
|
+
});
|
|
3054
|
+
const SearchThisFilterGroup_ = () => {
|
|
3055
|
+
return $i7OB2$createComponent((0, $i7OB2$Show), {
|
|
3056
|
+
get when() {
|
|
3057
|
+
return enable_searchability();
|
|
3058
|
+
},
|
|
3059
|
+
get children() {
|
|
3060
|
+
return $i7OB2$ssr($e01b34f289b61435$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$ssrAttribute("value", $i7OB2$escape(filter_query_(), true) || "", false) + $i7OB2$ssrAttribute("placeholder", $i7OB2$escape(i18n_.search_a_filter_()(section), true), false), $i7OB2$escape($i7OB2$createComponent((0, $16f0ed5ea30d8d9c$export$82eafebb825fc23f), {
|
|
3061
|
+
width: "16",
|
|
3062
|
+
height: "17.6",
|
|
3063
|
+
"class": "search-icon"
|
|
3064
|
+
})), "display:" + (filter_query_() ? "" : "none"), $i7OB2$escape($i7OB2$createComponent((0, $19976a74d273070d$export$3b621d86b1566b2), {
|
|
3065
|
+
width: "12",
|
|
3066
|
+
height: "12"
|
|
3067
|
+
})));
|
|
3068
|
+
}
|
|
3069
|
+
});
|
|
3070
|
+
};
|
|
3071
|
+
const searched_filter_array_ = $i7OB2$createMemo(() => {
|
|
3072
|
+
const query = filter_query_();
|
|
3073
|
+
if (!enable_searchability() || !query) return filter_array_();
|
|
3074
|
+
const lowercase_query = query.toLowerCase();
|
|
3075
|
+
const check_string_match = to_check => {
|
|
3076
|
+
to_check = to_check.toLowerCase();
|
|
3077
|
+
return to_check.includes(lowercase_query) || lowercase_query.includes(to_check);
|
|
3078
|
+
};
|
|
3079
|
+
return filter_array_().map(filter => {
|
|
3080
|
+
const type = filter.meta?.type;
|
|
3081
|
+
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
|
|
3082
|
+
const meta = filter.meta;
|
|
3083
|
+
const {
|
|
3084
|
+
values: values,
|
|
3085
|
+
names: names,
|
|
3086
|
+
counts: counts
|
|
3087
|
+
} = meta;
|
|
3088
|
+
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
|
|
3089
|
+
const is_hierarchical_checkbox = type === "checkbox-hierarchical";
|
|
3090
|
+
// Which index of counts, values and names should be kept
|
|
3091
|
+
const filtered_indexes = values.map((item, index) => {
|
|
3092
|
+
const item_from_names = names?.[index];
|
|
3093
|
+
if (item_from_names && !is_hierarchical_checkbox)
|
|
3094
|
+
// 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
|
|
3095
|
+
item = item_from_names;
|
|
3096
|
+
if (typeof item === "number") return true;
|
|
3097
|
+
if (is_hierarchical_checkbox && names)
|
|
3098
|
+
// Special case for hierarchical checkboxes where we need to check if any of the names in the path match the query
|
|
3099
|
+
item = item.map((_, index) => names[$e01b34f289b61435$var$find_str_arr_in_str_arr_arr("findIndex", values, item.slice(0, index + 1))]);
|
|
3100
|
+
if (Array.isArray(item)) return item.some(item => check_string_match(item + "")); // If any of the items in the array match, keep it
|
|
3101
|
+
return check_string_match(item);
|
|
3102
|
+
});
|
|
3103
|
+
const new_values = values.filter((_, i) => filtered_indexes[i]);
|
|
3104
|
+
if (!new_values.length) return false; // false = please delete this filter, see below
|
|
3105
|
+
const new_filter_object = {
|
|
3106
|
+
...filter,
|
|
3107
|
+
meta: {
|
|
3108
|
+
...meta,
|
|
3109
|
+
counts: counts?.filter((_, i) => filtered_indexes[i]),
|
|
3110
|
+
...(names ? {
|
|
3111
|
+
names: meta.names?.filter((_, i) => filtered_indexes[i])
|
|
3112
|
+
} : {}),
|
|
3113
|
+
values: new_values
|
|
3114
|
+
}
|
|
3115
|
+
};
|
|
3116
|
+
if (is_hierarchical_checkbox) {
|
|
3117
|
+
// For hierarchical checkbox we need to fill the holes created by filtering, for example if there is
|
|
3118
|
+
// ["Clothes"]
|
|
3119
|
+
// ["Clothes", "Blazers"]
|
|
3120
|
+
// And the user searched for "blazers" we need to add back ["Clothes"] so CheckboxHierarchicalFilter doesn't get confused
|
|
3121
|
+
// 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
|
|
3122
|
+
// So we do it here instead
|
|
3123
|
+
const new_meta = new_filter_object.meta;
|
|
3124
|
+
const new_values = new_meta.values;
|
|
3125
|
+
for (const value of new_values) {
|
|
3126
|
+
if (!Array.isArray(value)) continue; // Shouldn't happen
|
|
3127
|
+
if (value.length < 2) continue; // No parent
|
|
3128
|
+
const parent = value.slice(0, -1);
|
|
3129
|
+
// Check if parent exists
|
|
3130
|
+
if ($e01b34f289b61435$var$find_str_arr_in_str_arr_arr("some", new_values, parent)) continue; // Parent exists
|
|
3131
|
+
// Otherwise, put it back
|
|
3132
|
+
const index_to_restore = $e01b34f289b61435$var$find_str_arr_in_str_arr_arr("findIndex", values, parent);
|
|
3133
|
+
if (index_to_restore < 0) {
|
|
3134
|
+
$i7OB2$dwarn("Can't restore", parent, "to", new_values);
|
|
3135
|
+
continue;
|
|
3136
|
+
}
|
|
3137
|
+
const current_index_of_us = new_values.findIndex(item => item === value);
|
|
3138
|
+
new_values.splice(current_index_of_us, 0, values[index_to_restore]);
|
|
3139
|
+
const count_to_restore = counts?.[index_to_restore];
|
|
3140
|
+
if (count_to_restore) new_meta.counts?.splice(current_index_of_us, 0, count_to_restore);
|
|
3141
|
+
const name_to_restore = names?.[index_to_restore];
|
|
3142
|
+
if (name_to_restore) new_meta.names?.splice(current_index_of_us, 0, name_to_restore);
|
|
3143
|
+
}
|
|
3144
|
+
}
|
|
3145
|
+
return new_filter_object;
|
|
3146
|
+
}).filter(filter => filter); // Delete filters that don't have a value anymore
|
|
3147
|
+
});
|
|
3148
|
+
|
|
3149
|
+
return {
|
|
3150
|
+
SearchThisFilterGroup_: SearchThisFilterGroup_,
|
|
3151
|
+
searched_filter_array_: searched_filter_array_,
|
|
3152
|
+
filter_query_: filter_query_
|
|
3153
|
+
};
|
|
3154
|
+
}
|
|
3155
|
+
/**
|
|
3156
|
+
* Finds/whatevers what's effectively one hierarchical filter item in an array of hierarchical filter items
|
|
3157
|
+
* Functions similar to this happen loads in create_modified_filters, but they have additional checks so not touching them RN
|
|
3158
|
+
*/
|
|
3159
|
+
function $e01b34f289b61435$var$find_str_arr_in_str_arr_arr(operation, haystack, needle) {
|
|
3160
|
+
return haystack[operation](value => value.length === needle.length && value.every((item, index) => item === needle[index]));
|
|
3161
|
+
}
|
|
2680
3162
|
const $fab07f52c9861732$var$_tmpl$ = ["<div", ' class="filter-collapsible">', "</div>"],
|
|
2681
3163
|
$fab07f52c9861732$var$_tmpl$2 = ["<button", ' class="clear-group"><!--$-->', "<!--/--><span>", "</span></button>"],
|
|
2682
3164
|
$fab07f52c9861732$var$_tmpl$3 = ["<div", ' class="view-more-clear"><!--$-->', "<!--/--><!--$-->", "<!--/--></div>"],
|
|
2683
|
-
$fab07f52c9861732$var$_tmpl$4 = ["<div", ' class="filter-collapsible-body"><div class="filter-part"
|
|
3165
|
+
$fab07f52c9861732$var$_tmpl$4 = ["<div", ' class="filter-collapsible-body"><div class="filter-part"><!--$-->', "<!--/--><!--$-->", "<!--/--></div><!--$-->", "<!--/--></div>"],
|
|
2684
3166
|
$fab07f52c9861732$var$_tmpl$5 = ["<details", ' class="filter-collapsible"', "></details>"],
|
|
2685
3167
|
$fab07f52c9861732$var$_tmpl$6 = ["<summary", ' class="filter-group-summary"><div class="summary"><span>', '</span><div class="selected-w-sign"><!--$-->', "<!--/--><!--$-->", "<!--/--></div></div></summary>"],
|
|
2686
3168
|
$fab07f52c9861732$var$_tmpl$7 = ["<div", ' class="ungrouped">', "</div>"],
|
|
@@ -2731,6 +3213,11 @@ function $fab07f52c9861732$var$ActualFilterBody(props) {
|
|
|
2731
3213
|
const filter_array_ = $i7OB2$createMemo(() => {
|
|
2732
3214
|
return Object.values(togglable_filters_grouped_by_collapsible())[get_section_index()];
|
|
2733
3215
|
});
|
|
3216
|
+
const {
|
|
3217
|
+
SearchThisFilterGroup_: SearchThisFilterGroup_,
|
|
3218
|
+
searched_filter_array_: searched_filter_array_,
|
|
3219
|
+
filter_query_: filter_query_
|
|
3220
|
+
} = $e01b34f289b61435$export$4b2c5292ffe0c5dd(filter_array_, section_, props.i18n_);
|
|
2734
3221
|
const is_open = $84d6cd10bb7b1589$export$ab34afce88557c0e({
|
|
2735
3222
|
get expanded_filters_() {
|
|
2736
3223
|
return props.expanded_filters_;
|
|
@@ -2743,6 +3230,8 @@ function $fab07f52c9861732$var$ActualFilterBody(props) {
|
|
|
2743
3230
|
// this is absolutely not accurate which is why we have the .filter below, it's just the easiest way to get the typing of the map correct
|
|
2744
3231
|
filter_from_api]).filter(([selected_filter]) => selected_filter)));
|
|
2745
3232
|
const a_filter_is_selected = $i7OB2$createMemo(() => selected_filters_in_group().size);
|
|
3233
|
+
const [get_details_width, set_get_details_width] = $i7OB2$createSignal();
|
|
3234
|
+
const details_element_width_ = $i7OB2$createMemo(() => get_details_width?.()?.());
|
|
2746
3235
|
return $i7OB2$createComponent((0, $6bb0a0c563dff4bb$export$6c6d7a51fa9aa15d), {
|
|
2747
3236
|
is_open_: is_open,
|
|
2748
3237
|
get details_() {
|
|
@@ -2771,9 +3260,9 @@ function $fab07f52c9861732$var$ActualFilterBody(props) {
|
|
|
2771
3260
|
})));
|
|
2772
3261
|
},
|
|
2773
3262
|
get children() {
|
|
2774
|
-
return $i7OB2$ssr($fab07f52c9861732$var$_tmpl$4, $i7OB2$ssrHydrationKey(), $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Index), {
|
|
3263
|
+
return $i7OB2$ssr($fab07f52c9861732$var$_tmpl$4, $i7OB2$ssrHydrationKey(), $i7OB2$escape($i7OB2$createComponent(SearchThisFilterGroup_, {})), $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Index), {
|
|
2775
3264
|
get each() {
|
|
2776
|
-
return
|
|
3265
|
+
return searched_filter_array_();
|
|
2777
3266
|
},
|
|
2778
3267
|
children: filter => $i7OB2$createComponent((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
|
|
2779
3268
|
severity_: "error",
|
|
@@ -2795,7 +3284,9 @@ function $fab07f52c9861732$var$ActualFilterBody(props) {
|
|
|
2795
3284
|
get i18n_() {
|
|
2796
3285
|
return props.i18n_;
|
|
2797
3286
|
},
|
|
2798
|
-
view_more_button_below_group_: view_more_button_below_group
|
|
3287
|
+
view_more_button_below_group_: view_more_button_below_group,
|
|
3288
|
+
filter_query_: filter_query_,
|
|
3289
|
+
details_element_width_: details_element_width_
|
|
2799
3290
|
});
|
|
2800
3291
|
}
|
|
2801
3292
|
})
|
|
@@ -6568,14 +7059,6 @@ const $22e59517c2ec94d3$var$_tmpl$ = ["<svg", ' xmlns="http://www.w3.org/2000/sv
|
|
|
6568
7059
|
function $22e59517c2ec94d3$export$1c641004b5485fed() {
|
|
6569
7060
|
return $i7OB2$ssr($22e59517c2ec94d3$var$_tmpl$, $i7OB2$ssrHydrationKey());
|
|
6570
7061
|
}
|
|
6571
|
-
const $16f0ed5ea30d8d9c$var$_tmpl$ = '<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"></path>';
|
|
6572
|
-
function $16f0ed5ea30d8d9c$export$82eafebb825fc23f(props = {}) {
|
|
6573
|
-
return $i7OB2$ssrElement("svg", $i7OB2$mergeProps1(props, {
|
|
6574
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
6575
|
-
width: "20",
|
|
6576
|
-
height: "22"
|
|
6577
|
-
}), () => $i7OB2$ssr($16f0ed5ea30d8d9c$var$_tmpl$), true);
|
|
6578
|
-
}
|
|
6579
7062
|
const $5285d2814d0fac0c$var$_tmpl$ = ["<button", ' class="back" type="button"', ">", "</button>"],
|
|
6580
7063
|
$5285d2814d0fac0c$var$_tmpl$2 = ["<div", ' class="search-field"><!--$-->', '<!--/--><div class="field"><input class="', '" tabindex="0"', '><button type="button" class="clear"', ' style="', '">', '</button></div><button class="submit major" type="button"', ">", "</button></div>"];
|
|
6581
7064
|
function $5285d2814d0fac0c$export$b94867ecbd698f21({
|
|
@@ -7024,89 +7507,36 @@ function $7ad3a93cbe6fa208$export$a146ac6fa8346a25({
|
|
|
7024
7507
|
const has_entries = $i7OB2$createMemo(() => previous_searches_().length >= 1);
|
|
7025
7508
|
currently_showing_suggestions_[1](value => {
|
|
7026
7509
|
value[0] = $i7OB2$createMemo(() => previous_searches_().map(result => ({
|
|
7027
|
-
type: (0, $a0eb8b431ec1f87b$export$3cf9497e790da491),
|
|
7028
|
-
title: result,
|
|
7029
|
-
suggestions_result_id: "history"
|
|
7030
|
-
})));
|
|
7031
|
-
return value;
|
|
7032
|
-
});
|
|
7033
|
-
$i7OB2$onCleanup(() => currently_showing_suggestions_[1](value => {
|
|
7034
|
-
delete value[0];
|
|
7035
|
-
return value;
|
|
7036
|
-
}));
|
|
7037
|
-
return $i7OB2$createComponent((0, $i7OB2$Show), {
|
|
7038
|
-
get when() {
|
|
7039
|
-
return has_entries();
|
|
7040
|
-
},
|
|
7041
|
-
get children() {
|
|
7042
|
-
return $i7OB2$ssr($7ad3a93cbe6fa208$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape(text_()), $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Index), {
|
|
7043
|
-
get each() {
|
|
7044
|
-
return previous_searches_();
|
|
7045
|
-
},
|
|
7046
|
-
children: (item, index) => {
|
|
7047
|
-
const href = $a36cbc4f68bfd590$export$91c3b6774e8be0f5({
|
|
7048
|
-
param_: search_query_param_name_,
|
|
7049
|
-
value_: item,
|
|
7050
|
-
url_transformer_: url_transformer_
|
|
7051
|
-
});
|
|
7052
|
-
return $i7OB2$ssr($7ad3a93cbe6fa208$var$_tmpl$2, $i7OB2$ssrHydrationKey(), `${`item` || ""} ${$i7OB2$createMemo(() => read_selected_index_()?.[0] === 0 && read_selected_index_()?.[1] === index)() ? "selected" : ""}`, $i7OB2$ssrAttribute("href", $i7OB2$escape(href(), true), false), $i7OB2$escape($i7OB2$createComponent((0, $694b7f90501fea4c$export$5d2caaa6b530761c), {})), $i7OB2$ssrAttribute("title", $i7OB2$escape(item(), true), false), $i7OB2$escape(item()), $i7OB2$ssrAttribute("title", $i7OB2$escape(i18n_.previous_searches_delete_entry_from_history_(), true), false), $i7OB2$escape($i7OB2$createComponent((0, $19976a74d273070d$export$3b621d86b1566b2), {})));
|
|
7053
|
-
}
|
|
7054
|
-
})));
|
|
7055
|
-
}
|
|
7056
|
-
});
|
|
7057
|
-
}
|
|
7058
|
-
const $f3213c0640246d58$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"],
|
|
7059
|
-
$f3213c0640246d58$var$_tmpl$2 = ["<span", ' class="', '"', ">", "</span>"];
|
|
7060
|
-
function $f3213c0640246d58$export$ba17c5b7e6dda39f({
|
|
7061
|
-
whole_text_to_display_: whole_text_to_display_memo,
|
|
7062
|
-
searching_for_value_: searching_for_value_memo,
|
|
7063
|
-
class_: class_
|
|
7064
|
-
}) {
|
|
7065
|
-
const [get_has_highlighted, set_has_highlighted] = $i7OB2$createSignal(false);
|
|
7066
|
-
const text_itself = $i7OB2$createMemo(() => $i7OB2$batch(() => {
|
|
7067
|
-
set_has_highlighted(false);
|
|
7068
|
-
const searching_for_value = searching_for_value_memo();
|
|
7069
|
-
const whole_text_to_display_ = whole_text_to_display_memo();
|
|
7070
|
-
let for_black = "";
|
|
7071
|
-
let pushed_grey = false;
|
|
7072
|
-
const search_q = searching_for_value;
|
|
7073
|
-
if (!search_q) return whole_text_to_display_;
|
|
7074
|
-
const output = [];
|
|
7075
|
-
const searching_for = search_q.toLowerCase();
|
|
7076
|
-
const push_black = () => {
|
|
7077
|
-
if (for_black) {
|
|
7078
|
-
set_has_highlighted(true);
|
|
7079
|
-
output.push($i7OB2$ssr($f3213c0640246d58$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape(for_black))); // "black"
|
|
7080
|
-
for_black = "";
|
|
7081
|
-
}
|
|
7082
|
-
};
|
|
7083
|
-
for (let i = 0; i < whole_text_to_display_.length;) {
|
|
7084
|
-
let is_whole_word = true;
|
|
7085
|
-
let searching_for_but_with_texts_casing = "";
|
|
7086
|
-
const i_at_start = i;
|
|
7087
|
-
for (let j = 0; j < searching_for.length; i++, j++) {
|
|
7088
|
-
const letter_in_suggestion = whole_text_to_display_[i];
|
|
7089
|
-
if (letter_in_suggestion?.toLowerCase() !== searching_for[j]) {
|
|
7090
|
-
is_whole_word = false;
|
|
7091
|
-
i = i_at_start;
|
|
7092
|
-
break;
|
|
7510
|
+
type: (0, $a0eb8b431ec1f87b$export$3cf9497e790da491),
|
|
7511
|
+
title: result,
|
|
7512
|
+
suggestions_result_id: "history"
|
|
7513
|
+
})));
|
|
7514
|
+
return value;
|
|
7515
|
+
});
|
|
7516
|
+
$i7OB2$onCleanup(() => currently_showing_suggestions_[1](value => {
|
|
7517
|
+
delete value[0];
|
|
7518
|
+
return value;
|
|
7519
|
+
}));
|
|
7520
|
+
return $i7OB2$createComponent((0, $i7OB2$Show), {
|
|
7521
|
+
get when() {
|
|
7522
|
+
return has_entries();
|
|
7523
|
+
},
|
|
7524
|
+
get children() {
|
|
7525
|
+
return $i7OB2$ssr($7ad3a93cbe6fa208$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape(text_()), $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Index), {
|
|
7526
|
+
get each() {
|
|
7527
|
+
return previous_searches_();
|
|
7528
|
+
},
|
|
7529
|
+
children: (item, index) => {
|
|
7530
|
+
const href = $a36cbc4f68bfd590$export$91c3b6774e8be0f5({
|
|
7531
|
+
param_: search_query_param_name_,
|
|
7532
|
+
value_: item,
|
|
7533
|
+
url_transformer_: url_transformer_
|
|
7534
|
+
});
|
|
7535
|
+
return $i7OB2$ssr($7ad3a93cbe6fa208$var$_tmpl$2, $i7OB2$ssrHydrationKey(), `${`item` || ""} ${$i7OB2$createMemo(() => read_selected_index_()?.[0] === 0 && read_selected_index_()?.[1] === index)() ? "selected" : ""}`, $i7OB2$ssrAttribute("href", $i7OB2$escape(href(), true), false), $i7OB2$escape($i7OB2$createComponent((0, $694b7f90501fea4c$export$5d2caaa6b530761c), {})), $i7OB2$ssrAttribute("title", $i7OB2$escape(item(), true), false), $i7OB2$escape(item()), $i7OB2$ssrAttribute("title", $i7OB2$escape(i18n_.previous_searches_delete_entry_from_history_(), true), false), $i7OB2$escape($i7OB2$createComponent((0, $19976a74d273070d$export$3b621d86b1566b2), {})));
|
|
7093
7536
|
}
|
|
7094
|
-
|
|
7095
|
-
}
|
|
7096
|
-
if (is_whole_word) {
|
|
7097
|
-
push_black();
|
|
7098
|
-
output.push(searching_for_but_with_texts_casing);
|
|
7099
|
-
pushed_grey = true;
|
|
7100
|
-
} else for_black += whole_text_to_display_[i++];
|
|
7101
|
-
}
|
|
7102
|
-
push_black();
|
|
7103
|
-
if (!pushed_grey) {
|
|
7104
|
-
set_has_highlighted(false);
|
|
7105
|
-
return whole_text_to_display_;
|
|
7537
|
+
})));
|
|
7106
7538
|
}
|
|
7107
|
-
|
|
7108
|
-
}));
|
|
7109
|
-
return $i7OB2$ssr($f3213c0640246d58$var$_tmpl$2, $i7OB2$ssrHydrationKey(), `${$i7OB2$escape(class_, true) || ""} ${get_has_highlighted() ? "has-history-match" : ""}`, $i7OB2$ssrAttribute("title", $i7OB2$escape(whole_text_to_display_memo(), true), false), $i7OB2$escape(text_itself()));
|
|
7539
|
+
});
|
|
7110
7540
|
}
|
|
7111
7541
|
const $190927650b4840eb$var$_tmpl$ = '<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"></path>';
|
|
7112
7542
|
function $190927650b4840eb$export$605674723bcc715c(props = {}) {
|
|
@@ -7145,8 +7575,8 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
|
|
|
7145
7575
|
type: type,
|
|
7146
7576
|
title: title
|
|
7147
7577
|
}) => type === (0, $a0eb8b431ec1f87b$export$3cf9497e790da491) && !filtered_previous_searches_().includes(title) // don't show the ones we already show from the history
|
|
7148
|
-
)
|
|
7149
|
-
|
|
7578
|
+
) // + limit to three query suggestions, API sends more sometimes
|
|
7579
|
+
.slice(0, 3));
|
|
7150
7580
|
const not_queries_memo = $i7OB2$createMemo(() => {
|
|
7151
7581
|
// For the section that shows categories and content results
|
|
7152
7582
|
// We want to limit to 3 items, and we want to show the categories first
|
|
@@ -7941,224 +8371,6 @@ function $1801dbce7adb3f19$export$41b4894022a3580f({
|
|
|
7941
8371
|
})));
|
|
7942
8372
|
return style_props_;
|
|
7943
8373
|
}
|
|
7944
|
-
const $522a690e0e2bd46d$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"];
|
|
7945
|
-
const $522a690e0e2bd46d$var$dont_cut_in_between_less_than_characters = 30;
|
|
7946
|
-
function $522a690e0e2bd46d$export$e1a98a189fd2c0e7({
|
|
7947
|
-
content_result_: content_result_,
|
|
7948
|
-
key_: key_,
|
|
7949
|
-
cut_when_possible_: cut_when_possible_
|
|
7950
|
-
}) {
|
|
7951
|
-
const matched_tokens = $i7OB2$createMemo(() => content_result_().highlights?.find(highlight => highlight.field == key_)?.matched_tokens);
|
|
7952
|
-
const full_value = $i7OB2$createMemo(() => content_result_()[key_]?.replaceAll("\n", " "));
|
|
7953
|
-
return $i7OB2$createComponent((0, $i7OB2$Show), {
|
|
7954
|
-
get when() {
|
|
7955
|
-
return matched_tokens()?.length;
|
|
7956
|
-
},
|
|
7957
|
-
get fallback() {
|
|
7958
|
-
return full_value();
|
|
7959
|
-
},
|
|
7960
|
-
get children() {
|
|
7961
|
-
return (() => {
|
|
7962
|
-
const segmented_cut_text = $i7OB2$createMemo(() => {
|
|
7963
|
-
const segmented_text = $522a690e0e2bd46d$var$segment_text(full_value(), matched_tokens());
|
|
7964
|
-
if (cut_when_possible_) $522a690e0e2bd46d$var$cut_text(segmented_text);
|
|
7965
|
-
return segmented_text;
|
|
7966
|
-
});
|
|
7967
|
-
return $i7OB2$createComponent((0, $i7OB2$Index), {
|
|
7968
|
-
get each() {
|
|
7969
|
-
return segmented_cut_text();
|
|
7970
|
-
},
|
|
7971
|
-
children: item => {
|
|
7972
|
-
return $i7OB2$createComponent((0, $i7OB2$Show), {
|
|
7973
|
-
get when() {
|
|
7974
|
-
return item().highlighted_;
|
|
7975
|
-
},
|
|
7976
|
-
get fallback() {
|
|
7977
|
-
return item().text_;
|
|
7978
|
-
},
|
|
7979
|
-
get children() {
|
|
7980
|
-
return $i7OB2$ssr($522a690e0e2bd46d$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape(item().text_));
|
|
7981
|
-
}
|
|
7982
|
-
});
|
|
7983
|
-
}
|
|
7984
|
-
});
|
|
7985
|
-
})();
|
|
7986
|
-
}
|
|
7987
|
-
});
|
|
7988
|
-
}
|
|
7989
|
-
function $522a690e0e2bd46d$var$cut_text(segmented_text) {
|
|
7990
|
-
// cut away chunks of text that are not highlighted to give a google-like overview of the content
|
|
7991
|
-
const highlighted_segments = segmented_text?.filter(segment => segment.highlighted_);
|
|
7992
|
-
if (!segmented_text || !highlighted_segments?.length) return;
|
|
7993
|
-
// We have one or more highlighted segments
|
|
7994
|
-
if (highlighted_segments.length === 1) {
|
|
7995
|
-
// cut away from the left until the start of the highlighted sentence if just one sentence is highlighted
|
|
7996
|
-
$522a690e0e2bd46d$var$cut_start(segmented_text.indexOf(highlighted_segments[0]), segmented_text);
|
|
7997
|
-
return;
|
|
7998
|
-
}
|
|
7999
|
-
// We have two or more highlighted segments, take the two biggest chunks and show them + a bit text around
|
|
8000
|
-
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
|
|
8001
|
-
);
|
|
8002
|
-
|
|
8003
|
-
const [longest_segment, next_longest_segment] = sorted_highlighted_segments;
|
|
8004
|
-
// We need to cut before the first segment - possibly through other segments - and maybe between segments
|
|
8005
|
-
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);
|
|
8006
|
-
$522a690e0e2bd46d$var$cut_start(index_of_first_segment, segmented_text);
|
|
8007
|
-
// update indexes since we might have removed segments
|
|
8008
|
-
[index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
|
|
8009
|
-
let number_of_characters_between_segments = 0;
|
|
8010
|
-
for (let i = index_of_first_segment + 1; i < index_of_second_segment; i++) {
|
|
8011
|
-
const segment = segmented_text[i];
|
|
8012
|
-
number_of_characters_between_segments += segment.text_.length;
|
|
8013
|
-
}
|
|
8014
|
-
if (number_of_characters_between_segments < $522a690e0e2bd46d$var$dont_cut_in_between_less_than_characters)
|
|
8015
|
-
// don't cut if there are less than 30 characters between the two segments
|
|
8016
|
-
return;
|
|
8017
|
-
// We have more than 50 characters between the two segments, cut between them
|
|
8018
|
-
const [split_start_segment, split_start_character] = $522a690e0e2bd46d$var$find_split_point(index_of_first_segment, index_of_second_segment, segmented_text);
|
|
8019
|
-
const [split_end_segment, split_end_character] = $522a690e0e2bd46d$var$find_split_point(index_of_second_segment, index_of_first_segment, segmented_text);
|
|
8020
|
-
if (split_start_segment === undefined || split_end_segment === undefined ||
|
|
8021
|
-
// identical split point, or split end before split start, can't do anything
|
|
8022
|
-
split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
|
|
8023
|
-
const dots_segment = {
|
|
8024
|
-
text_: " … ",
|
|
8025
|
-
highlighted_: false
|
|
8026
|
-
};
|
|
8027
|
-
const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
|
|
8028
|
-
if (i < split_start_segment || i > split_end_segment) return segment;
|
|
8029
|
-
const text = segment.text_;
|
|
8030
|
-
if (i == split_end_segment && i == split_start_segment) return [{
|
|
8031
|
-
...segment,
|
|
8032
|
-
text_: text.slice(0, split_start_character).trimEnd()
|
|
8033
|
-
}, dots_segment, {
|
|
8034
|
-
...segment,
|
|
8035
|
-
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
8036
|
-
}];else if (i == split_start_segment) {
|
|
8037
|
-
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
|
|
8038
|
-
return segment;
|
|
8039
|
-
} else if (i == split_end_segment) return [dots_segment, {
|
|
8040
|
-
...segment,
|
|
8041
|
-
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
8042
|
-
}];
|
|
8043
|
-
return []; // remove all segments inbetween
|
|
8044
|
-
});
|
|
8045
|
-
|
|
8046
|
-
segmented_text.splice(0, segmented_text.length, ...split_and_dotted_values); // Sorry…
|
|
8047
|
-
$522a690e0e2bd46d$var$heal_holes(segmented_text);
|
|
8048
|
-
}
|
|
8049
|
-
function $522a690e0e2bd46d$var$heal_holes(segmented_text) {
|
|
8050
|
-
// try to heal "holes" created in the segments so there are only alternating segments
|
|
8051
|
-
const segments_to_delete = new Set();
|
|
8052
|
-
for (let i = 0; i < segmented_text.length; i++) {
|
|
8053
|
-
const segment = segmented_text[i];
|
|
8054
|
-
let previous_segment;
|
|
8055
|
-
for (let j = i - 1; j >= 0; j--) {
|
|
8056
|
-
previous_segment = segmented_text[j];
|
|
8057
|
-
// Don't write to a segment that's marked for deletion or the contents we write to it will be deleted
|
|
8058
|
-
if (!segments_to_delete.has(previous_segment)) break;
|
|
8059
|
-
}
|
|
8060
|
-
if (previous_segment?.highlighted_ && segment.highlighted_ || previous_segment?.highlighted_ === false && segment.highlighted_ === false) {
|
|
8061
|
-
previous_segment.text_ += segment.text_; // IDK if this ever happens
|
|
8062
|
-
segments_to_delete.add(segment);
|
|
8063
|
-
}
|
|
8064
|
-
}
|
|
8065
|
-
for (const segment of segments_to_delete) {
|
|
8066
|
-
const index = segmented_text.indexOf(segment);
|
|
8067
|
-
segmented_text.splice(index, 1);
|
|
8068
|
-
}
|
|
8069
|
-
}
|
|
8070
|
-
function $522a690e0e2bd46d$var$find_split_point(index_of_start_segment, index_of_end_segment, segmented_text, be_very_aggressive = true) {
|
|
8071
|
-
const should_loop_backwards = index_of_start_segment > index_of_end_segment;
|
|
8072
|
-
const step = should_loop_backwards ? -1 : 1;
|
|
8073
|
-
const desperate_split_attempts = [":", ";", ","];
|
|
8074
|
-
while (desperate_split_attempts.length) {
|
|
8075
|
-
const split_point_between_words = [];
|
|
8076
|
-
// for the middle also try to split with a few more characters if the default ones don't work over a full run
|
|
8077
|
-
const desperate_split_attempt = desperate_split_attempts.pop();
|
|
8078
|
-
let is_first_character = true;
|
|
8079
|
-
for (let i = index_of_start_segment + step; should_loop_backwards ? i > index_of_end_segment : i < index_of_end_segment; i += step) {
|
|
8080
|
-
const segment = segmented_text[i];
|
|
8081
|
-
const text = segment.text_;
|
|
8082
|
-
for (let j = should_loop_backwards ? text.length - 1 : 0; should_loop_backwards ? j >= 0 : j < text.length; j += step) {
|
|
8083
|
-
const character = text[j];
|
|
8084
|
-
if (character == "." || character == "?" || character == "!" || character == desperate_split_attempt) return [i, j]; // segment index, character index
|
|
8085
|
-
if (is_first_character) is_first_character = false;else if (be_very_aggressive && character == " ") {
|
|
8086
|
-
split_point_between_words.push([i, j]);
|
|
8087
|
-
if (split_point_between_words.length > 3)
|
|
8088
|
-
// We can't find a split point, so we'll just split between words
|
|
8089
|
-
// 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
|
|
8090
|
-
return split_point_between_words[1];
|
|
8091
|
-
}
|
|
8092
|
-
}
|
|
8093
|
-
}
|
|
8094
|
-
}
|
|
8095
|
-
return [];
|
|
8096
|
-
}
|
|
8097
|
-
function $522a690e0e2bd46d$var$cut_start(cut_left_of_index, segmented_text) {
|
|
8098
|
-
// Cut the start of the text to bring the first matching token
|
|
8099
|
-
let is_first_character = false;
|
|
8100
|
-
let words_encountered = 0;
|
|
8101
|
-
outmost_loop: for (let i = cut_left_of_index - 1; i >= 0; i--) {
|
|
8102
|
-
const segment = segmented_text[i];
|
|
8103
|
-
// We assume that two adjacent highlighted segments don't exist and have been merged if they were to have existed
|
|
8104
|
-
const text = segment.text_;
|
|
8105
|
-
for (let j = text.length - 1; j >= 0; j--) {
|
|
8106
|
-
const character = text[j];
|
|
8107
|
-
const is_space = character == " ";
|
|
8108
|
-
if (!is_first_character && is_space) words_encountered++;
|
|
8109
|
-
if (character == "." || character == "?" || character == "!" || character == "," || words_encountered > 8 && is_space) {
|
|
8110
|
-
// We have to be really aggressive at the start of sentences so stuff can be seen on mobile, hence comma
|
|
8111
|
-
segment.text_ = text.slice(j + 1).trimStart();
|
|
8112
|
-
segmented_text.splice(0, i);
|
|
8113
|
-
if (character === "," || is_space)
|
|
8114
|
-
// if we cut at a comma or psace, we add a … at the beginning
|
|
8115
|
-
segmented_text.unshift({
|
|
8116
|
-
text_: "… ",
|
|
8117
|
-
highlighted_: false
|
|
8118
|
-
});
|
|
8119
|
-
break outmost_loop;
|
|
8120
|
-
}
|
|
8121
|
-
if (is_first_character) is_first_character = false;
|
|
8122
|
-
}
|
|
8123
|
-
}
|
|
8124
|
-
$522a690e0e2bd46d$var$heal_holes(segmented_text); // if we added a ... there could now be a sequence that's not alternating true/false
|
|
8125
|
-
}
|
|
8126
|
-
|
|
8127
|
-
function $522a690e0e2bd46d$var$segment_text(text, matched_strings) {
|
|
8128
|
-
// segment text where the matched strings are highlighted sections
|
|
8129
|
-
const output = [];
|
|
8130
|
-
if (!text) return; // shouldn't happen but whatever
|
|
8131
|
-
for (let i = 0; i < text.length; i++) {
|
|
8132
|
-
const found_strings = [];
|
|
8133
|
-
if (!i || text[i - 1] == " ")
|
|
8134
|
-
// only match at the start of a word or string, it looks weird if i.e. "we" is highlighted in "activewear
|
|
8135
|
-
for (let j = 0; j < matched_strings.length; j++) {
|
|
8136
|
-
const matched_string = matched_strings[j];
|
|
8137
|
-
const part_in_text = text.slice(i, i + matched_string.length);
|
|
8138
|
-
if (matched_string.length < 2) continue; // don't match on single characters, i.e. "I", it looks weird
|
|
8139
|
-
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
|
|
8140
|
-
}
|
|
8141
|
-
|
|
8142
|
-
const last_index_in_output = output.length - 1;
|
|
8143
|
-
if (!found_strings.length) {
|
|
8144
|
-
const character = text[i];
|
|
8145
|
-
if (output[last_index_in_output]?.highlighted_ === false || output.length && /\s/.test(character))
|
|
8146
|
-
// 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
|
|
8147
|
-
output[last_index_in_output].text_ += character;else output.push({
|
|
8148
|
-
highlighted_: false,
|
|
8149
|
-
text_: character
|
|
8150
|
-
});
|
|
8151
|
-
} else {
|
|
8152
|
-
const longest_found_string = found_strings.reduce((a, b) => a.length > b.length ? a : b);
|
|
8153
|
-
if (output[last_index_in_output]?.highlighted_) output[last_index_in_output].text_ += longest_found_string;else output.push({
|
|
8154
|
-
highlighted_: true,
|
|
8155
|
-
text_: longest_found_string
|
|
8156
|
-
});
|
|
8157
|
-
i += longest_found_string.length - 1;
|
|
8158
|
-
}
|
|
8159
|
-
}
|
|
8160
|
-
return output;
|
|
8161
|
-
}
|
|
8162
8374
|
const $b2bf2cdcff8142d8$var$_tmpl$ = ["<div", ' class="description line-clamp">', "</div>"],
|
|
8163
8375
|
$b2bf2cdcff8142d8$var$_tmpl$2 = ["<div", ' class="content-card"><div class="image">', '</div><div class="info"><!--$-->', "<!--/--><!--$-->", "<!--/--></div></div>"];
|
|
8164
8376
|
function $b2bf2cdcff8142d8$export$f631859cab12b342({
|
|
@@ -9457,4 +9669,4 @@ const $4690a06c8489dcd0$export$c3834fa86c616831 = [[4], [3, 1024], [2, 901]];
|
|
|
9457
9669
|
const $4690a06c8489dcd0$export$864d304a0bc46829 = "2%";
|
|
9458
9670
|
const $4690a06c8489dcd0$export$7bf543b9d9be2c22 = (0, $e4615ecd1849548f$export$b91cec6bdc6b32a1);
|
|
9459
9671
|
$i7OB2$add_to_version_info("ui", (0, $ec291e0010116877$export$83d89fbfd8236492));
|
|
9460
|
-
export { $4147651646da990a$export$916e6850778505f6 as strip_encoded_filter_and_sort, $4147651646da990a$export$58aa3f171519b6d7 as encode_filters, $4147651646da990a$export$f934fa24c3a86811 as decode_filters, $660070e2a394b3c3$export$d7b7ab832c20e2f4 as shopifyContainedImageContextSymbol, $011607bdf658f807$export$e68cff63f76bd15b as ListingProvider, $011607bdf658f807$export$8d0c4fdbb05a2f2e as useListing, $660070e2a394b3c3$export$e4b984597b71e989 as ShopifyContainedImage, $f32e14878e75af51$export$6649caad96ef8870 as SlidableItems, $
|
|
9672
|
+
export { $4147651646da990a$export$916e6850778505f6 as strip_encoded_filter_and_sort, $4147651646da990a$export$58aa3f171519b6d7 as encode_filters, $4147651646da990a$export$f934fa24c3a86811 as decode_filters, $660070e2a394b3c3$export$d7b7ab832c20e2f4 as shopifyContainedImageContextSymbol, $011607bdf658f807$export$e68cff63f76bd15b as ListingProvider, $011607bdf658f807$export$8d0c4fdbb05a2f2e as useListing, $660070e2a394b3c3$export$e4b984597b71e989 as ShopifyContainedImage, $f32e14878e75af51$export$6649caad96ef8870 as SlidableItems, $2449872a62a75a20$export$ebdc3711f7e02ccd as make_accurate_width_accessor, $ee116da074deb002$export$9574e176201e5e8d as RecommendationSlider, $9ea5383493360761$export$9756467d34d91cdb as RecommendationGrid, $e8ffe11ed01df0fe$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $e8ffe11ed01df0fe$export$e6fffe67d4cdd848 as makeSizeAccessor, $f18d425032111270$export$94026ee33dbabc26 as ImageContainer, $b7436a6d1fd64e3b$export$b69d0d92862de18b as SentryErrorBoundary, $6bb0a0c563dff4bb$export$6c6d7a51fa9aa15d as ExpandingDetails, $c16e74cfe125bb05$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $1adfe60f3a14a1d7$export$fecbb157621501bd as SelectedFilters, $fab07f52c9861732$export$3f1a388cc0d8fed7 as FilterBody, $5efb5894079b220e$export$b288c38ae3fddb56 as create_modified_filters, $c8d5ff4524619fcd$export$d21e32dfedac04be as SolidLayout, $194bd6b8e4c59830$export$79b1565500412d9b as general_modal_abstraction, $19976a74d273070d$export$3b621d86b1566b2 as CrossIcon, $fbbadcb080ad1d4a$export$8be2714ec7f169ee as GenericSliderArrowButton, $c58717f39bf51647$export$58e808b1db15d3bc as fetchDepictRecommendations, $961b5c64bef4662f$export$de035477d6fef996 as QuickLinks, $961b5c64bef4662f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $e4615ecd1849548f$export$b91cec6bdc6b32a1 as CategoryTitle, $a6e23a834336fc19$export$824dde41348efed1 as embedded_num_products, $c9312089e8983364$export$643598a327b5833e as get_categories, $961b5c64bef4662f$export$f34314aa9505732e as DepictCategory, $961b5c64bef4662f$export$e2bf8ce7779e827e as CategoryPage, $806c97b931758897$export$ac6237957a15b3f0 as DepictSearch, $806c97b931758897$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $806c97b931758897$export$f2dc7e4e4aa11abb as SearchPage, $806c97b931758897$export$316f6f283ae64765 as SearchField, $4fd48cb976bf1789$export$aa14a9f43128f61f as ProductCardError, $6891c018a834cfdd$export$d86a33413558014e as open_modal_with_alignment, $bb15dfb548a7666e$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $b6d5529b253681aa$export$b3ad617e9036868 as align_field, $b5cccc8ee7d24677$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $926b1b5ba2239356$export$1233ca167bf71f9a as styles_to_valid_css_string, $aea1edf92433e81e$export$fe334901e8bebd57 as disable_scrolling, $6e8944558258054f$export$d0596b5cae35ad4 as open_search_with_shift_slash, $7fa23e2a0079eca4$export$e015ed2f2950f2e3 as DepictAPI, $dc9262ef6f786812$export$d9f36cf74e24d595 as media_query_to_accessor, $6936724b9e0b98d5$export$689e204eadb33baf as setup_fast_leave, $bf52d9f9eebd1938$export$5196e4c01fa56fcb as show_toast, $8c0f86cb3e266eeb$export$a71e92cfbb498adc as SolidFormatPrice, $4ca91518c9a35379$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $d20eff0aadc28983$export$acb3eaade4b23afd as BasePlaceholder, $d134eae24341b4a1$export$89c6019e4baa40b1 as TextPlaceholder, $7f60f09116a3fe61$export$3f37af283f8fb843 as ImagePlaceholder, $753e9b2889a47c89$export$3ccaa27d81dd8556 as PageReplacer, $4690a06c8489dcd0$export$864d304a0bc46829 as defaultGridSpacing, $4690a06c8489dcd0$export$c3834fa86c616831 as defaultColsAtSize, $4690a06c8489dcd0$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $ec291e0010116877$export$83d89fbfd8236492 as version };
|