@depict-ai/ui 0.0.83 → 1.0.2

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/dist/module.js CHANGED
@@ -1,9 +1,8 @@
1
- import {add_to_version_info as $g9l4l$add_to_version_info, fetch_recs as $g9l4l$fetch_recs, snakeCasifyObject as $g9l4l$snakeCasifyObject, GenericSliderArrowButton as $g9l4l$GenericSliderArrowButton, catchify as $g9l4l$catchify, instant_exec_on_suspect_history_change as $g9l4l$instant_exec_on_suspect_history_change, base_url as $g9l4l$base_url, get_depict_id as $g9l4l$get_depict_id, get_user_id as $g9l4l$get_user_id, get_session_id as $g9l4l$get_session_id, dlog as $g9l4l$dlog, make_url_with_query_params as $g9l4l$make_url_with_query_params, fetch_retry as $g9l4l$fetch_retry, add_version_query_params as $g9l4l$add_version_query_params, sort_obj as $g9l4l$sort_obj, Placeholder as $g9l4l$Placeholder, report as $g9l4l$report, javascript_media_query as $g9l4l$javascript_media_query, standard_price_format as $g9l4l$standard_price_format, make_random_classname as $g9l4l$make_random_classname, n_col_styling_with_dist as $g9l4l$n_col_styling_with_dist, observer as $g9l4l$observer, CrossIcon as $g9l4l$CrossIcon, useExpandingContainer as $g9l4l$useExpandingContainer, Amazing_Slider as $g9l4l$Amazing_Slider, slider_snap_css as $g9l4l$slider_snap_css, slider_fading_factory as $g9l4l$slider_fading_factory, MinusIcon as $g9l4l$MinusIcon, FilterIcon as $g9l4l$FilterIcon, SortIconAsc as $g9l4l$SortIconAsc, SortIconDesc as $g9l4l$SortIconDesc, PlusIcon as $g9l4l$PlusIcon, hsl_to_rgb as $g9l4l$hsl_to_rgb, relative_luminance_from_rgb as $g9l4l$relative_luminance_from_rgb, TickIcon as $g9l4l$TickIcon, ArrowUp as $g9l4l$ArrowUp, queueMacroTask as $g9l4l$queueMacroTask, dwarn as $g9l4l$dwarn, ContainedPlaceholderImage as $g9l4l$ContainedPlaceholderImage, BackIcon as $g9l4l$BackIcon, SearchIcon as $g9l4l$SearchIcon, Layout as $g9l4l$Layout, async_iterable_ipns as $g9l4l$async_iterable_ipns, make_asyncIterable_exiter as $g9l4l$make_asyncIterable_exiter, href_change_ipns as $g9l4l$href_change_ipns, ContainedImage as $g9l4l$ContainedImage, buildThresholdList as $g9l4l$buildThresholdList, deparallelize_no_drop as $g9l4l$deparallelize_no_drop, PreviousSearchIcon as $g9l4l$PreviousSearchIcon, insert_surfaces as $g9l4l$insert_surfaces} from "@depict-ai/utilishared";
1
+ import {add_to_version_info as $g9l4l$add_to_version_info, fetch_recs as $g9l4l$fetch_recs, snakeCasifyObject as $g9l4l$snakeCasifyObject, GenericSliderArrowButton as $g9l4l$GenericSliderArrowButton, catchify as $g9l4l$catchify, instant_exec_on_suspect_history_change as $g9l4l$instant_exec_on_suspect_history_change, base_url as $g9l4l$base_url, dlog as $g9l4l$dlog, get_depict_id as $g9l4l$get_depict_id, get_user_id as $g9l4l$get_user_id, get_session_id as $g9l4l$get_session_id, make_url_with_query_params as $g9l4l$make_url_with_query_params, fetch_retry as $g9l4l$fetch_retry, add_version_query_params as $g9l4l$add_version_query_params, sort_obj as $g9l4l$sort_obj, Placeholder as $g9l4l$Placeholder, report as $g9l4l$report, javascript_media_query as $g9l4l$javascript_media_query, standard_price_format as $g9l4l$standard_price_format, make_random_classname as $g9l4l$make_random_classname, n_col_styling_with_dist as $g9l4l$n_col_styling_with_dist, observer as $g9l4l$observer, CrossIcon as $g9l4l$CrossIcon, useExpandingContainer as $g9l4l$useExpandingContainer, Amazing_Slider as $g9l4l$Amazing_Slider, slider_snap_css as $g9l4l$slider_snap_css, slider_fading_factory as $g9l4l$slider_fading_factory, MinusIcon as $g9l4l$MinusIcon, FilterIcon as $g9l4l$FilterIcon, SortIconAsc as $g9l4l$SortIconAsc, SortIconDesc as $g9l4l$SortIconDesc, PlusIcon as $g9l4l$PlusIcon, hsl_to_rgb as $g9l4l$hsl_to_rgb, relative_luminance_from_rgb as $g9l4l$relative_luminance_from_rgb, TickIcon as $g9l4l$TickIcon, ArrowUp as $g9l4l$ArrowUp, base64_encode_unicode as $g9l4l$base64_encode_unicode, base64_decode_unicode as $g9l4l$base64_decode_unicode, queueMacroTask as $g9l4l$queueMacroTask, dwarn as $g9l4l$dwarn, ContainedPlaceholderImage as $g9l4l$ContainedPlaceholderImage, BackIcon as $g9l4l$BackIcon, SearchIcon as $g9l4l$SearchIcon, Layout as $g9l4l$Layout, async_iterable_ipns as $g9l4l$async_iterable_ipns, make_asyncIterable_exiter as $g9l4l$make_asyncIterable_exiter, href_change_ipns as $g9l4l$href_change_ipns, ContainedImage as $g9l4l$ContainedImage, buildThresholdList as $g9l4l$buildThresholdList, deparallelize_no_drop as $g9l4l$deparallelize_no_drop, PreviousSearchIcon as $g9l4l$PreviousSearchIcon, insert_surfaces as $g9l4l$insert_surfaces} from "@depict-ai/utilishared";
2
2
  import {template as $g9l4l$template, insert as $g9l4l$insert, effect as $g9l4l$effect, setAttribute as $g9l4l$setAttribute, createComponent as $g9l4l$createComponent, use as $g9l4l$use, memo as $g9l4l$memo, addEventListener as $g9l4l$addEventListener, delegateEvents as $g9l4l$delegateEvents, spread as $g9l4l$spread, classList as $g9l4l$classList, style as $g9l4l$style, Dynamic as $g9l4l$Dynamic, mergeProps as $g9l4l$mergeProps, className as $g9l4l$className} from "solid-js/web";
3
- import {createSignal as $g9l4l$createSignal, onCleanup as $g9l4l$onCleanup, createComputed as $g9l4l$createComputed, createRenderEffect as $g9l4l$createRenderEffect, createEffect as $g9l4l$createEffect, untrack as $g9l4l$untrack, batch as $g9l4l$batch, createResource as $g9l4l$createResource, createMemo as $g9l4l$createMemo, Show as $g9l4l$Show, createReaction as $g9l4l$createReaction, Suspense as $g9l4l$Suspense, on as $g9l4l$on, createRoot as $g9l4l$createRoot, ErrorBoundary as $g9l4l$ErrorBoundary, For as $g9l4l$For, getOwner as $g9l4l$getOwner, runWithOwner as $g9l4l$runWithOwner, Index as $g9l4l$Index} from "solid-js";
4
- import {compressToBase64 as $g9l4l$compressToBase64, decompressFromBase64 as $g9l4l$decompressFromBase64} from "lz-string";
3
+ import {createSignal as $g9l4l$createSignal, getOwner as $g9l4l$getOwner, createRoot as $g9l4l$createRoot, runWithOwner as $g9l4l$runWithOwner, onCleanup as $g9l4l$onCleanup, createComputed as $g9l4l$createComputed, createRenderEffect as $g9l4l$createRenderEffect, createEffect as $g9l4l$createEffect, untrack as $g9l4l$untrack, batch as $g9l4l$batch, createResource as $g9l4l$createResource, createMemo as $g9l4l$createMemo, Show as $g9l4l$Show, createReaction as $g9l4l$createReaction, Suspense as $g9l4l$Suspense, on as $g9l4l$on, ErrorBoundary as $g9l4l$ErrorBoundary, For as $g9l4l$For, Index as $g9l4l$Index} from "solid-js";
5
4
 
6
- /*! Depict.ai search and product listing SDK */ const $18bf1d29fb889cca$export$83d89fbfd8236492 = "0.0.83";
5
+ /*! Depict.ai search and product listing SDK */ const $18bf1d29fb889cca$export$83d89fbfd8236492 = "1.0.2";
7
6
 
8
7
 
9
8
 
@@ -82,15 +81,6 @@ function $3075a4497054bec6$export$9862539c89138352(get_default_values_, router_)
82
81
 
83
82
  const $3846bb34098c738f$var$v2_base_url = (0, $g9l4l$base_url) + "/v2/";
84
83
  const $3846bb34098c738f$var$search_base_url = $3846bb34098c738f$var$v2_base_url + "search/";
85
- const $3846bb34098c738f$var$add_ids_to_request = (input_req)=>{
86
- const request = {
87
- ...input_req
88
- };
89
- request.dsid ??= (0, $g9l4l$get_depict_id)();
90
- request.user_id ??= (0, $g9l4l$get_user_id)();
91
- request.session_id ??= (0, $g9l4l$get_session_id)();
92
- return request;
93
- };
94
84
  class $3846bb34098c738f$export$e015ed2f2950f2e3 {
95
85
  #supports_finalization_registry = typeof FinalizationRegistry === "function";
96
86
  #cache_objs = {};
@@ -105,12 +95,26 @@ class $3846bb34098c738f$export$e015ed2f2950f2e3 {
105
95
  })) : undefined
106
96
  };
107
97
  }
98
+ #add_ids_to_request = (input_req)=>{
99
+ const request = {
100
+ ...input_req
101
+ };
102
+ request.dsid ??= (0, $g9l4l$get_depict_id)();
103
+ // Todo: remove the default user and session IDs once we've confirmed backend can handle it and do whatever fallback is necessary.
104
+ request.user_id ??= this.#get_user_id?.() || (0, $g9l4l$get_user_id)();
105
+ request.session_id ??= this.#get_session_id?.() || (0, $g9l4l$get_session_id)();
106
+ return request;
107
+ };
108
108
  #get_metadata;
109
- constructor(get_metadata){
109
+ #get_user_id;
110
+ #get_session_id;
111
+ constructor({ get_metadata: get_metadata , get_user_id: get_user_id , get_session_id: get_session_id } = {}){
110
112
  this.#get_metadata = get_metadata;
113
+ this.#get_user_id = get_user_id;
114
+ this.#get_session_id = get_session_id;
111
115
  }
112
116
  async suggest(input_req) {
113
- const request = $3846bb34098c738f$var$add_ids_to_request(input_req);
117
+ const request = this.#add_ids_to_request(input_req);
114
118
  const url = (0, $g9l4l$make_url_with_query_params)($3846bb34098c738f$var$search_base_url + "suggestions", request);
115
119
  const results = await (0, $g9l4l$fetch_retry)((0, $g9l4l$add_version_query_params)(url));
116
120
  attempt_to_return_api_response: {
@@ -127,7 +131,7 @@ class $3846bb34098c738f$export$e015ed2f2950f2e3 {
127
131
  }
128
132
  async #cached_post_request(endpoint1, input_req, fallback_response) {
129
133
  const cache_obj = this.#get_cache_obj_for_endpoint(endpoint1);
130
- const with_ids = $3846bb34098c738f$var$add_ids_to_request(input_req);
134
+ const with_ids = this.#add_ids_to_request(input_req);
131
135
  const metaData = await this.#get_metadata?.();
132
136
  const request = metaData ? Object.assign(with_ids, {
133
137
  metadata: metaData
@@ -801,7 +805,8 @@ function $dc5df79ae78a9d00$export$f33414a4df0afd3f({ product_card_template_: pro
801
805
  if (!unwrapped_array?.length || !unwrapped_array.every((item)=>item)) // Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
802
806
  return;
803
807
  // placeholders have finished rendering, freeze the elements
804
- $dc5df79ae78a9d00$var$cached_placeholder_element = get_cloned_placeholders(unwrapped_array); // Clone initial return value so that who gave us the elements can't mutate them, which has caused issues before with react
808
+ // here we might receive the result of a promise that has already been received, tore down and put into cached_placeholder_element, so don't overwrite that more valid result if it's already set
809
+ $dc5df79ae78a9d00$var$cached_placeholder_element ||= get_cloned_placeholders(unwrapped_array); // Clone initial return value so that who gave us the elements can't mutate them, which has caused issues before with react
805
810
  $dc5df79ae78a9d00$var$rendering_cached_placeholder_element = undefined;
806
811
  dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
807
812
  return get_cloned_placeholders(); // clone, just in case. If we wouldn't, someone could modify the copy in the DOM, and it would affect the cached version
@@ -4393,7 +4398,7 @@ function $73294c7089bfc7c9$var$encode_filter_data(op, data) {
4393
4398
  return encoded_data;
4394
4399
  }
4395
4400
  // Fallback encoding
4396
- return (0, $g9l4l$compressToBase64)(JSON.stringify(data));
4401
+ return (0, $g9l4l$base64_encode_unicode)(JSON.stringify(data));
4397
4402
  }
4398
4403
  function $73294c7089bfc7c9$var$decode_filter_data(op, encoded_data) {
4399
4404
  if (encoded_data === "1") return "true";
@@ -4401,7 +4406,7 @@ function $73294c7089bfc7c9$var$decode_filter_data(op, encoded_data) {
4401
4406
  if (op === "inrange" && encoded_data.includes($73294c7089bfc7c9$var$range_delimiter)) return encoded_data.split($73294c7089bfc7c9$var$range_delimiter).map((x)=>parseFloat(x));
4402
4407
  if (encoded_data.includes($73294c7089bfc7c9$var$string_item_delimiter) || encoded_data.includes($73294c7089bfc7c9$var$array_item_delimiter)) return $73294c7089bfc7c9$var$decode_array(encoded_data);
4403
4408
  try {
4404
- return JSON.parse((0, $g9l4l$decompressFromBase64)(encoded_data));
4409
+ return JSON.parse((0, $g9l4l$base64_decode_unicode)(encoded_data));
4405
4410
  } catch (e) {
4406
4411
  (0, $g9l4l$dlog)("Failed to fallback parse filter data", op, encoded_data, e);
4407
4412
  }
@@ -4462,13 +4467,13 @@ function $73294c7089bfc7c9$export$af4a870a0ee262c4(search_params) {
4462
4467
  ];
4463
4468
  for (const key of keys)if (key.startsWith($73294c7089bfc7c9$var$filter_query_param_prefix) || key === $73294c7089bfc7c9$var$sorting_query_param) search_params.delete(key);
4464
4469
  }
4465
- const $73294c7089bfc7c9$export$e2cf3f19dd3f8aac = "went_sideways_clear_filters";
4470
+ const $73294c7089bfc7c9$export$cf5feb2102aec7f2 = "went_sideways_clear_filters";
4466
4471
  function $73294c7089bfc7c9$export$43cd1e747fecd42e(to_url, set_clearing_flag, from_search_params = new URLSearchParams(location.search)) {
4467
4472
  if (!to_url) return to_url;
4468
4473
  const was_url_object = to_url instanceof URL;
4469
4474
  const url_object = was_url_object ? to_url : new URL(to_url, location.origin);
4470
4475
  const { searchParams: searchParams } = url_object;
4471
- if (set_clearing_flag) searchParams.set($73294c7089bfc7c9$export$e2cf3f19dd3f8aac, "true");
4476
+ if (set_clearing_flag) searchParams.set($73294c7089bfc7c9$export$cf5feb2102aec7f2, "true");
4472
4477
  if (from_search_params.has($73294c7089bfc7c9$var$sorting_query_param)) searchParams.set($73294c7089bfc7c9$var$sorting_query_param, from_search_params.get($73294c7089bfc7c9$var$sorting_query_param));
4473
4478
  for (const key of from_search_params.keys())if (key.startsWith($73294c7089bfc7c9$var$filter_query_param_prefix)) searchParams.set(key, from_search_params.get(key));
4474
4479
  if (was_url_object) return url_object;
@@ -4642,6 +4647,7 @@ function $6af87e1502f04aa3$export$466cdc317043f6cb({ quicklinks_data_: quicklink
4642
4647
  const quicklinks_data = quicklinks_data_(); // this signal should have updated by now since this is a createEffect
4643
4648
  const current_id = current_query_id_();
4644
4649
  if (!new_data || !quicklinks_data || !current_id) return;
4650
+ const owner = (0, $g9l4l$getOwner)();
4645
4651
  queueMicrotask(()=>{
4646
4652
  // has to be in microtask so that elements have rendered and are scroll-to-able
4647
4653
  scrolling_logic_ran_for_query_id = true;
@@ -4654,17 +4660,17 @@ function $6af87e1502f04aa3$export$466cdc317043f6cb({ quicklinks_data_: quicklink
4654
4660
  } else if (!(intersecting_items_object[selected_index()]?.intersectionRatio >= 0.95)) {
4655
4661
  // negated larger than to handle left side of comparison being undefined
4656
4662
  let done_work = false;
4657
- (0, $g9l4l$createComputed)((0, $g9l4l$catchify)(()=>{
4658
- if (done_work || !Array.isArray(quicklinks_data_())) return;
4659
- const sel_index = selected_index();
4660
- const target_element = sel_index >= 0 ? sel_index : 0;
4661
- if (document.documentElement.contains(insert_here)) {
4662
- slider.scroll_to_abs(target_element, true); // if nothing selected and no selected scroll position, go to left
4663
- last_scroll_position = insert_here.scrollLeft; // update this because it might get removed from the DOM before intersection observers triggered (actually happened for me)
4664
- } else // can't scroll if not in the DOM, scroll when we're back instead
4665
- scroll_to_element_on_dom_insertion = target_element;
4666
- done_work = true;
4667
- }));
4663
+ (0, $g9l4l$runWithOwner)(owner, ()=>(0, $g9l4l$createComputed)((0, $g9l4l$catchify)(()=>{
4664
+ if (done_work || !Array.isArray(quicklinks_data_())) return;
4665
+ const sel_index = selected_index();
4666
+ const target_element = sel_index >= 0 ? sel_index : 0;
4667
+ if (document.documentElement.contains(insert_here)) {
4668
+ slider.scroll_to_abs(target_element, true); // if nothing selected and no selected scroll position, go to left
4669
+ last_scroll_position = insert_here.scrollLeft; // update this because it might get removed from the DOM before intersection observers triggered (actually happened for me)
4670
+ } else // can't scroll if not in the DOM, scroll when we're back instead
4671
+ scroll_to_element_on_dom_insertion = target_element;
4672
+ done_work = true;
4673
+ })));
4668
4674
  }
4669
4675
  });
4670
4676
  }, {
@@ -4851,8 +4857,7 @@ let $01115659405f3c64$export$44dad306455dddf;
4851
4857
 
4852
4858
 
4853
4859
 
4854
-
4855
- function $cb20e79516018342$export$3945d6db2dfd3d12({ crumb_data_: crumb_data_ , query_id_: query_id_ , i18n_: i18n_ , selected_filters_: selected_filters_ , local_filter_cache_: local_filter_cache_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , plp_results_: plp_results_ , router_: router_ }) {
4860
+ function $cb20e79516018342$export$3945d6db2dfd3d12({ crumb_data_: crumb_data_ , query_id_: query_id_ , i18n_: i18n_ , selected_filters_: selected_filters_ , local_filter_cache_: local_filter_cache_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , plp_results_: plp_results_ , sideways_filter_clearing_flag_: sideways_filter_clearing_flag_ }) {
4856
4861
  // If we just got opened in a new tab, clear filters instantly and remove the flag
4857
4862
  $cb20e79516018342$var$clear_if_opened_new_tab_with_sideways_url_params_flag({
4858
4863
  plp_results_: plp_results_,
@@ -4860,7 +4865,7 @@ function $cb20e79516018342$export$3945d6db2dfd3d12({ crumb_data_: crumb_data_ ,
4860
4865
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
4861
4866
  selected_filters_: selected_filters_,
4862
4867
  i18n_: i18n_,
4863
- router_: router_
4868
+ sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
4864
4869
  });
4865
4870
  // Code below is for when we're already open and the user navigates to a new category
4866
4871
  let previous_crumb_data = (0, $g9l4l$untrack)(crumb_data_);
@@ -4890,7 +4895,7 @@ function $cb20e79516018342$export$3945d6db2dfd3d12({ crumb_data_: crumb_data_ ,
4890
4895
  local_filter_cache_: local_filter_cache_
4891
4896
  });
4892
4897
  // Also ensure we don't have `sideways_url_params_flag` set anymore
4893
- $cb20e79516018342$var$delete_sideways_param_flag(router_);
4898
+ sideways_filter_clearing_flag_[1](false);
4894
4899
  }
4895
4900
  }
4896
4901
  query_id_when_we_got_previous_data = query_id_of_new_data;
@@ -4898,11 +4903,11 @@ function $cb20e79516018342$export$3945d6db2dfd3d12({ crumb_data_: crumb_data_ ,
4898
4903
  if (!allow_filter_clearing) allow_filter_clearing = true;
4899
4904
  })));
4900
4905
  }
4901
- function $cb20e79516018342$var$clear_if_opened_new_tab_with_sideways_url_params_flag({ plp_results_: plp_results_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , i18n_: i18n_ , selected_filters_: selected_filters_ , local_filter_cache_: local_filter_cache_ , router_: router_ }) {
4906
+ function $cb20e79516018342$var$clear_if_opened_new_tab_with_sideways_url_params_flag({ plp_results_: plp_results_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , i18n_: i18n_ , selected_filters_: selected_filters_ , local_filter_cache_: local_filter_cache_ , sideways_filter_clearing_flag_: [get_sideways_filter_clearing_flag_, set_sideways_filter_clearing_flag_] }) {
4902
4907
  const tracking_function_for_plp_results = (0, $g9l4l$createReaction)(()=>{
4903
4908
  // On first rendering of the CategoryPage (after we have results), check if we got to this URL by going sideways in QuickLinks and clear filters with toast if so
4904
- const had_flag = $cb20e79516018342$var$delete_sideways_param_flag(router_);
4905
- if (!had_flag) return;
4909
+ if (!(0, $g9l4l$untrack)(get_sideways_filter_clearing_flag_)) return;
4910
+ set_sideways_filter_clearing_flag_(false);
4906
4911
  (0, $g9l4l$dlog)("Flag to clear filters was set, clearing filters");
4907
4912
  (0, $g9l4l$queueMacroTask)(()=>{
4908
4913
  // Do it next task so that all the filters have time to populate
@@ -4918,22 +4923,10 @@ function $cb20e79516018342$var$clear_if_opened_new_tab_with_sideways_url_params_
4918
4923
  });
4919
4924
  tracking_function_for_plp_results(plp_results_);
4920
4925
  }
4921
- function $cb20e79516018342$var$delete_sideways_param_flag(router) {
4922
- const url_object = new URL(location.href);
4923
- const { searchParams: searchParams } = url_object;
4924
- if (searchParams.get((0, $73294c7089bfc7c9$export$e2cf3f19dd3f8aac)) !== "true") return false;
4925
- searchParams.delete((0, $73294c7089bfc7c9$export$e2cf3f19dd3f8aac));
4926
- router.navigate_.go_to_({
4927
- new_url_: url_object,
4928
- is_replace_: true,
4929
- force_spa_navigation_: true
4930
- });
4931
- return true;
4932
- }
4933
4926
 
4934
4927
 
4935
4928
  const $1ae892b13d7746ab$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="product-count"> </div>`, 2), $1ae892b13d7746ab$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div></div>`, 2), $1ae892b13d7746ab$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="filter-results-for-one-row"></div>`, 2), $1ae892b13d7746ab$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="depict plp category"><div class="listing-page"></div></div>`, 4);
4936
- function $1ae892b13d7746ab$export$f7d2f673fc2f091d({ depict_api_: depict_api_ , query_id_: query_id_ , current_sorting_: current_sorting_ , min_products_to_fetch_: min_products_to_fetch_ , category_filters_open_: category_filters_open_ , category_sorting_open_: category_sorting_open_ , expanded_filters_: expanded_filters_ , selected_filters_: selected_filters_ , get_quicklinks_accessor_: get_quicklinks_accessor_ , i18n_: incoming_i18n , get_breadcrumb_accessor_: get_breadcrumb_accessor_ , slider_arrow_button_: slider_arrow_button_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , local_filter_cache_: local_filter_cache_ , tenant_: tenant_ , market_: market_ , router_: router_ , show_quicklinks_: show_quicklinks_ , category_title_: category_title_ , show_breadcrumbs_: show_breadcrumbs_ , layout_options_: layout_options_ , scroll_restoration_data_: scroll_restoration_data_ , product_card_template_: product_card_template_ }) {
4929
+ function $1ae892b13d7746ab$export$f7d2f673fc2f091d({ depict_api_: depict_api_ , query_id_: query_id_ , current_sorting_: current_sorting_ , min_products_to_fetch_: min_products_to_fetch_ , category_filters_open_: category_filters_open_ , category_sorting_open_: category_sorting_open_ , expanded_filters_: expanded_filters_ , selected_filters_: selected_filters_ , get_quicklinks_accessor_: get_quicklinks_accessor_ , i18n_: incoming_i18n , get_breadcrumb_accessor_: get_breadcrumb_accessor_ , slider_arrow_button_: slider_arrow_button_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , local_filter_cache_: local_filter_cache_ , tenant_: tenant_ , market_: market_ , router_: router_ , show_quicklinks_: show_quicklinks_ , category_title_: category_title_ , show_breadcrumbs_: show_breadcrumbs_ , layout_options_: layout_options_ , scroll_restoration_data_: scroll_restoration_data_ , product_card_template_: product_card_template_ , sideways_filter_clearing_flag_: sideways_filter_clearing_flag_ }) {
4937
4930
  let results_for;
4938
4931
  let only_show_filters_opener_;
4939
4932
  let middle_elements_;
@@ -5109,7 +5102,7 @@ function $1ae892b13d7746ab$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
5109
5102
  local_filter_cache_: local_filter_cache_,
5110
5103
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
5111
5104
  plp_results_: plp_results_,
5112
- router_: router_
5105
+ sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
5113
5106
  });
5114
5107
  get_breadcrumb_accessor_?.(crumb_data_);
5115
5108
  get_quicklinks_accessor_?.(quicklinks_data_);
@@ -5301,7 +5294,9 @@ const $b4e6a093ae83373b$export$6daf8749b65a1b77 = (cols_at_size)=>{
5301
5294
  ];
5302
5295
  }
5303
5296
  // Sort widths in ascending order
5304
- const sorted_cols_at_size = cols_at_size.sort((a, b)=>{
5297
+ const sorted_cols_at_size = [
5298
+ ...cols_at_size
5299
+ ].sort((a, b)=>{
5305
5300
  const [_b, width_A] = a;
5306
5301
  const [_a, width_b] = b;
5307
5302
  if (width_A === undefined) return -1;
@@ -5359,14 +5354,18 @@ function $c7f938ac40924f3b$export$23fca46f3143581f(component, error_message) {
5359
5354
 
5360
5355
 
5361
5356
 
5362
- function $f01b3a0b9fbf6519$export$477caf01aecaeb2a({ search_query_url_param_name_: search_query_url_param_name_ , router_: router_ }) {
5357
+ function $f01b3a0b9fbf6519$export$477caf01aecaeb2a(options) {
5358
+ const router_ = options.router_;
5359
+ const search_query_url_param_name_ = "search_query_url_param_name_" in options ? options.search_query_url_param_name_ : undefined;
5363
5360
  const search_query_ = search_query_url_param_name_ ? (0, $g9l4l$createSignal)("") : undefined;
5364
5361
  const get_search_query_ = search_query_?.[0];
5365
5362
  const set_search_query = search_query_?.[1];
5366
5363
  const current_sorting_ = (0, $g9l4l$createSignal)();
5367
5364
  const selected_filters_ = (0, $g9l4l$createSignal)([]);
5365
+ const sideways_filter_clearing_flag_ = (0, $g9l4l$createSignal)(false);
5368
5366
  const [get_sorting_, set_sorting] = current_sorting_;
5369
5367
  const [get_selected_filters_, set_selected_filters] = selected_filters_;
5368
+ const [get_has_sideways_filter_clearing_flag_, set_has_sideways_filter_clearing_flag] = sideways_filter_clearing_flag_;
5370
5369
  const [get_current_href, set_current_href] = (0, $g9l4l$createSignal)(location.href);
5371
5370
  const history_change_handler = (0, $g9l4l$catchify)(()=>set_current_href(location.href));
5372
5371
  const owner = (0, $g9l4l$getOwner)() || (0, $g9l4l$createRoot)(()=>(0, $g9l4l$getOwner)());
@@ -5400,12 +5399,14 @@ function $f01b3a0b9fbf6519$export$477caf01aecaeb2a({ search_query_url_param_name
5400
5399
  const found_query = searchParams.get(search_query_url_param_name_);
5401
5400
  set_search_query(found_query || "");
5402
5401
  }
5402
+ if (searchParams.get((0, $73294c7089bfc7c9$export$cf5feb2102aec7f2)) === "true") set_has_sideways_filter_clearing_flag(true);
5403
5403
  if (!writer_started) {
5404
5404
  // The owner here is the createComputed which gets disposed the next time the computation runs - but we actually just want to delay the start of the href_writer until our signals contain the current value of the URL, therefore the runWithOwner
5405
5405
  (0, $g9l4l$runWithOwner)(owner, ()=>$f01b3a0b9fbf6519$var$start_href_writer({
5406
5406
  get_sorting_: get_sorting_,
5407
5407
  get_selected_filters_: get_selected_filters_,
5408
- router_: router_
5408
+ router_: router_,
5409
+ get_has_sideways_filter_clearing_flag_: get_has_sideways_filter_clearing_flag_
5409
5410
  }));
5410
5411
  writer_started = true;
5411
5412
  }
@@ -5417,22 +5418,26 @@ function $f01b3a0b9fbf6519$export$477caf01aecaeb2a({ search_query_url_param_name
5417
5418
  selected_filters_: selected_filters_,
5418
5419
  ...typeof search_query_url_param_name_ === "string" ? {
5419
5420
  search_query_accessor_: get_search_query_
5420
- } : {}
5421
+ } : {
5422
+ sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
5423
+ }
5421
5424
  };
5422
5425
  }
5423
5426
  /**
5424
5427
  * Writes the sorting and filters to the URL query parameters when they change.
5425
- */ function $f01b3a0b9fbf6519$var$start_href_writer({ get_sorting_: get_sorting_ , get_selected_filters_: get_selected_filters_ , router_: router_ }) {
5428
+ */ function $f01b3a0b9fbf6519$var$start_href_writer({ get_sorting_: get_sorting_ , get_selected_filters_: get_selected_filters_ , router_: router_ , get_has_sideways_filter_clearing_flag_: get_has_sideways_filter_clearing_flag_ }) {
5426
5429
  (0, $g9l4l$createEffect)((0, $g9l4l$on)([
5427
5430
  get_sorting_,
5428
- get_selected_filters_
5429
- ], ([sorting, filters])=>{
5431
+ get_selected_filters_,
5432
+ get_has_sideways_filter_clearing_flag_
5433
+ ], ([sorting, filters, has_sideways_filter_clearing_flag])=>{
5430
5434
  const current_href = location.href;
5431
5435
  const url_object = new URL(current_href);
5432
5436
  const { searchParams: searchParams } = url_object;
5433
5437
  (0, $73294c7089bfc7c9$export$af4a870a0ee262c4)(searchParams);
5434
5438
  (0, $73294c7089bfc7c9$export$62acb285a7579555)(sorting, searchParams);
5435
5439
  (0, $73294c7089bfc7c9$export$58aa3f171519b6d7)(filters, searchParams);
5440
+ if (!has_sideways_filter_clearing_flag) $f01b3a0b9fbf6519$var$delete_sideways_param_flag(searchParams);
5436
5441
  // We can't just check if the URL is equal since sometimes the order of the parameters in the URL changes (randomly?) so we need to compare them one by one
5437
5442
  const unmodified_search_params = [
5438
5443
  ...new URL(current_href).searchParams
@@ -5452,6 +5457,9 @@ function $f01b3a0b9fbf6519$export$477caf01aecaeb2a({ search_query_url_param_name
5452
5457
  defer: true
5453
5458
  }));
5454
5459
  }
5460
+ function $f01b3a0b9fbf6519$var$delete_sideways_param_flag(searchParams) {
5461
+ if (searchParams.get((0, $73294c7089bfc7c9$export$cf5feb2102aec7f2)) === "true") searchParams.delete((0, $73294c7089bfc7c9$export$cf5feb2102aec7f2));
5462
+ }
5455
5463
 
5456
5464
 
5457
5465
 
@@ -5585,38 +5593,42 @@ class $ec52ef1e6c117813$export$f34314aa9505732e {
5585
5593
  this.#router.on_navigation_ = new_function;
5586
5594
  }
5587
5595
  constructor({ api: api , on_navigation: on_navigation , ...props_on_class }){
5588
- if ($ec52ef1e6c117813$export$f34314aa9505732e.#has_been_constructed) throw new Error("You can only have one instance of DepictCategory due to state limitations");
5589
- $ec52ef1e6c117813$export$f34314aa9505732e.#has_been_constructed = true;
5590
- Object.assign(this, props_on_class); // set initial signal values
5591
- (0, $2864fd26f57ff474$export$5162a71f252e6122)();
5592
- if (on_navigation) this.#router.on_navigation_ = on_navigation;
5593
- const { selected_filters_: selected_filters_ , current_sorting_: current_sorting_ } = (0, $f01b3a0b9fbf6519$export$477caf01aecaeb2a)({
5594
- router_: this.#router
5595
- });
5596
- const [reset_history_state_, state_] = (0, $3075a4497054bec6$export$9862539c89138352)(()=>({
5597
- category_filters_open: false,
5598
- category_sorting_open: false,
5599
- category_expanded_filters: [],
5600
- // Please make sure that the signal created by below line always updates AFTER selected_filters_ updates on a "popstate" event. If the filter cache is popped before the selected filters are the code in create_modified_filters() is going to re-calculate search_local_filter_cache without knowing the real value of search_selected_filters, and we'll end up with too few filters in search_local_filter_cache in some cases
5601
- category_local_filter_cache: [],
5602
- category_expanded_hierarchical_filters: [],
5603
- category_scroll_restoration_data: []
5604
- }), this.#router);
5605
- const i18n_ = (0, $0466953901b38f18$export$f091cbac892643a4)(this.#locale_signal[0]);
5606
- $ec52ef1e6c117813$var$privately_shared_properties.set(this, {
5607
- state_: state_,
5608
- breadcrumb_signal_: (0, $g9l4l$createSignal)(),
5609
- quicklinks_signal_: (0, $g9l4l$createSignal)(),
5610
- i18n_: i18n_,
5611
- reset_history_state_: reset_history_state_,
5612
- depict_api_: api ?? new (0, $3846bb34098c738f$export$e015ed2f2950f2e3)(),
5613
- router_: this.#router,
5614
- selected_filters_: selected_filters_,
5615
- current_sorting_: current_sorting_,
5616
- slider_arrow_button_: (0, $g9l4l$GenericSliderArrowButton)({
5617
- height_: 12,
5618
- width_: 6.46
5619
- })
5596
+ const owner = (0, $g9l4l$getOwner)() || (0, $g9l4l$createRoot)(()=>(0, $g9l4l$getOwner)()); // we might have an owner, if so, pass it on. Otherwise, create one so solid doesn't print warnings to the console
5597
+ (0, $g9l4l$runWithOwner)(owner, ()=>{
5598
+ if ($ec52ef1e6c117813$export$f34314aa9505732e.#has_been_constructed) throw new Error("You can only have one instance of DepictCategory due to state limitations");
5599
+ $ec52ef1e6c117813$export$f34314aa9505732e.#has_been_constructed = true;
5600
+ Object.assign(this, props_on_class); // set initial signal values
5601
+ (0, $2864fd26f57ff474$export$5162a71f252e6122)();
5602
+ if (on_navigation) this.#router.on_navigation_ = on_navigation;
5603
+ const { selected_filters_: selected_filters_ , current_sorting_: current_sorting_ , sideways_filter_clearing_flag_: sideways_filter_clearing_flag_ } = (0, $f01b3a0b9fbf6519$export$477caf01aecaeb2a)({
5604
+ router_: this.#router
5605
+ });
5606
+ const [reset_history_state_, state_] = (0, $3075a4497054bec6$export$9862539c89138352)(()=>({
5607
+ category_filters_open: false,
5608
+ category_sorting_open: false,
5609
+ category_expanded_filters: [],
5610
+ // Please make sure that the signal created by below line always updates AFTER selected_filters_ updates on a "popstate" event. If the filter cache is popped before the selected filters are the code in create_modified_filters() is going to re-calculate search_local_filter_cache without knowing the real value of search_selected_filters, and we'll end up with too few filters in search_local_filter_cache in some cases
5611
+ category_local_filter_cache: [],
5612
+ category_expanded_hierarchical_filters: [],
5613
+ category_scroll_restoration_data: []
5614
+ }), this.#router);
5615
+ const i18n_ = (0, $0466953901b38f18$export$f091cbac892643a4)(this.#locale_signal[0]);
5616
+ $ec52ef1e6c117813$var$privately_shared_properties.set(this, {
5617
+ state_: state_,
5618
+ breadcrumb_signal_: (0, $g9l4l$createSignal)(),
5619
+ quicklinks_signal_: (0, $g9l4l$createSignal)(),
5620
+ i18n_: i18n_,
5621
+ reset_history_state_: reset_history_state_,
5622
+ depict_api_: api ?? new (0, $3846bb34098c738f$export$e015ed2f2950f2e3)(),
5623
+ router_: this.#router,
5624
+ selected_filters_: selected_filters_,
5625
+ current_sorting_: current_sorting_,
5626
+ sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
5627
+ slider_arrow_button_: (0, $g9l4l$GenericSliderArrowButton)({
5628
+ height_: 12,
5629
+ width_: 6.46
5630
+ })
5631
+ });
5620
5632
  });
5621
5633
  }
5622
5634
  }
@@ -5629,7 +5641,7 @@ function $ec52ef1e6c117813$export$e2bf8ce7779e827e({ depict_category: depict_cat
5629
5641
  grid_spacing: grid_spacing.horizontal
5630
5642
  };
5631
5643
  return (0, $c7f938ac40924f3b$export$23fca46f3143581f)(()=>{
5632
- const { state_: { category_local_filter_cache: local_filter_cache_ , category_filters_open: category_filters_open_ , category_sorting_open: category_sorting_open_ , category_expanded_filters: expanded_filters_ , category_expanded_hierarchical_filters: expanded_hierarchical_filters_ , category_scroll_restoration_data: scroll_restoration_data_ } , current_sorting_: current_sorting_ , selected_filters_: selected_filters_ , reset_history_state_: reset_history_state_ , depict_api_: depict_api_ , i18n_: i18n_ , router_: router_ , breadcrumb_signal_: breadcrumb_signal_ , quicklinks_signal_: quicklinks_signal_ , slider_arrow_button_: slider_arrow_button_ } = shared_properties;
5644
+ const { state_: { category_local_filter_cache: local_filter_cache_ , category_filters_open: category_filters_open_ , category_sorting_open: category_sorting_open_ , category_expanded_filters: expanded_filters_ , category_expanded_hierarchical_filters: expanded_hierarchical_filters_ , category_scroll_restoration_data: scroll_restoration_data_ } , current_sorting_: current_sorting_ , selected_filters_: selected_filters_ , reset_history_state_: reset_history_state_ , depict_api_: depict_api_ , i18n_: i18n_ , router_: router_ , breadcrumb_signal_: breadcrumb_signal_ , quicklinks_signal_: quicklinks_signal_ , slider_arrow_button_: slider_arrow_button_ , sideways_filter_clearing_flag_: sideways_filter_clearing_flag_ } = shared_properties;
5633
5645
  (0, $g9l4l$onCleanup)(reset_history_state_);
5634
5646
  return (0, $1ae892b13d7746ab$export$f7d2f673fc2f091d)({
5635
5647
  tenant_: ()=>depict_category.merchant,
@@ -5652,6 +5664,7 @@ function $ec52ef1e6c117813$export$e2bf8ce7779e827e({ depict_category: depict_cat
5652
5664
  expanded_filters_: expanded_filters_,
5653
5665
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
5654
5666
  selected_filters_: selected_filters_,
5667
+ sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
5655
5668
  scroll_restoration_data_: scroll_restoration_data_,
5656
5669
  layout_options_: {
5657
5670
  cols_at_size: (0, $b4e6a093ae83373b$export$6daf8749b65a1b77)(cols_at_size),
@@ -7860,159 +7873,161 @@ class $540e930c58500cbe$export$ac6237957a15b3f0 {
7860
7873
  #router = new (0, $cfa2761d36e5714c$export$7e1297a3a19f10d8)("hard_navigation");
7861
7874
  constructor({ search_query_url_param_name: search_query_url_param_name_ = "query" , url_transformer: url_transformer , on_navigation: on_navigation , enable_category_suggestions: enable_category_suggestions = true , disable_scrolling_during_modal: // Stuff needed for non-standard customer deployments that we shouldn't actually expose
7862
7875
  disable_scrolling_during_modal = true , api: api , bottom_distance_under_modal: bottom_distance_under_modal , render_instant_card: render_instant_card , ...props_on_class }){
7863
- if ($540e930c58500cbe$export$ac6237957a15b3f0.#has_been_constructed) throw new Error("You can only have one instance of DepictSearch");
7864
- Object.assign(this, props_on_class);
7865
- if (on_navigation) this.#router.on_navigation_ = on_navigation;
7866
- const { current_sorting_: current_sorting_ , selected_filters_: selected_filters_ , search_query_accessor_: raw_search_query_accessor } = (0, $f01b3a0b9fbf6519$export$477caf01aecaeb2a)({
7867
- search_query_url_param_name_: search_query_url_param_name_,
7868
- router_: this.#router
7869
- });
7870
- const [reset_history_state_, state_] = (0, $3075a4497054bec6$export$9862539c89138352)(()=>({
7871
- search_field_value: new URLSearchParams(location.search).get(search_query_url_param_name_) ?? "",
7872
- search_filters_open: false,
7873
- search_sorting_open: false,
7874
- search_expanded_filters: [],
7875
- // Please make sure that the signal created by below line always updates AFTER selected_filters_ updates on a "popstate" event. If the filter cache is popped before the selected filters are the code in create_modified_filters() is going to re-calculate search_local_filter_cache without knowing the real value of search_selected_filters, and we'll end up with too few filters in search_local_filter_cache in some cases
7876
- search_local_filter_cache: [],
7877
- search_expanded_hierarchical_filters: [],
7878
- search_showing_recommendation_rows: (0, $aee0c68312d971f4$export$1c8c715550dc689d),
7879
- search_scroll_restoration_data: []
7880
- }), this.#router);
7881
- const search_query_updating_blocked_ = (0, $g9l4l$createSignal)(false);
7882
- const [get_search_query_updating_blocked] = search_query_updating_blocked_;
7883
- const get_search_query_ = (0, $g9l4l$createMemo)((previous_value)=>{
7884
- if (get_search_query_updating_blocked()) return previous_value;
7885
- else return raw_search_query_accessor();
7886
- });
7887
- const depict_api_ = api ?? new (0, $3846bb34098c738f$export$e015ed2f2950f2e3)();
7888
- const previous_searches = (0, $4d62f5daa51642fe$export$84bba84a7b837187)(get_search_query_);
7889
- const [, set_search_showing_recommendation_rows] = state_.search_showing_recommendation_rows;
7890
- const after_submit_ = ()=>set_search_showing_recommendation_rows((0, $aee0c68312d971f4$export$1c8c715550dc689d)); // do this every time after we have submitted a new query - otherwise there might already be a saved number of rows in the state
7891
- const on_submit_with_unchanged_value_ = ()=>this.modal_open = false;
7892
- const [get_search_field_value_, set_search_field_value_] = state_.search_field_value;
7893
- const configured_submit_query_ = (new_query)=>(0, $7f6ddd9a7e868c4d$export$e16630ecb9644a1c)({
7894
- on_submit_with_unchanged_value_: on_submit_with_unchanged_value_,
7895
- set_search_field_value_: set_search_field_value_,
7896
- get_search_query_: get_search_query_,
7897
- search_param_name_: search_query_url_param_name_,
7898
- after_submit_: after_submit_,
7899
- get_new_query: ()=>new_query || (0, $g9l4l$untrack)(get_search_field_value_),
7900
- url_transformer_: url_transformer,
7876
+ const owner = (0, $g9l4l$getOwner)() || (0, $g9l4l$createRoot)(()=>(0, $g9l4l$getOwner)()); // we might have an owner, if so, pass it on. Otherwise, create one so solid doesn't print warnings to the console
7877
+ (0, $g9l4l$runWithOwner)(owner, ()=>{
7878
+ if ($540e930c58500cbe$export$ac6237957a15b3f0.#has_been_constructed) throw new Error("You can only have one instance of DepictSearch");
7879
+ Object.assign(this, props_on_class);
7880
+ if (on_navigation) this.#router.on_navigation_ = on_navigation;
7881
+ const { current_sorting_: current_sorting_ , selected_filters_: selected_filters_ , search_query_accessor_: raw_search_query_accessor } = (0, $f01b3a0b9fbf6519$export$477caf01aecaeb2a)({
7882
+ search_query_url_param_name_: search_query_url_param_name_,
7901
7883
  router_: this.#router
7902
7884
  });
7903
- const i18n_ = (0, $0466953901b38f18$export$f091cbac892643a4)(this.#locale_signal[0]);
7904
- const clear_filters_on_next_submit_ = (0, $a0d89ff25220eb8d$export$e026af0c7b64ea5f)({
7905
- selected_filters_: selected_filters_,
7906
- get_search_query_: get_search_query_,
7907
- current_sorting_: current_sorting_,
7908
- expanded_hierarchical_filters_: state_.search_expanded_hierarchical_filters,
7909
- i18n_: i18n_,
7910
- local_filter_cache_: state_.search_local_filter_cache
7911
- });
7912
- $540e930c58500cbe$var$privately_shared_properties.set(this, {
7913
- search_query_url_param_name_: search_query_url_param_name_,
7914
- reset_history_state_: reset_history_state_,
7915
- state_: state_,
7916
- router_: this.#router,
7917
- url_transformer_: url_transformer,
7918
- depict_api_: depict_api_,
7919
- enable_category_suggestions_: enable_category_suggestions,
7920
- clear_filters_on_next_submit_: clear_filters_on_next_submit_,
7921
- configured_submit_query_: configured_submit_query_,
7922
- get_search_query_: get_search_query_,
7923
- i18n_: i18n_,
7924
- search_query_updating_blocked_: search_query_updating_blocked_,
7925
- current_sorting_: current_sorting_,
7926
- selected_filters_: selected_filters_
7927
- });
7928
- (0, $2864fd26f57ff474$export$5162a71f252e6122)();
7929
- (0, $g9l4l$catchify)(async ()=>{
7930
- const owner = (0, $g9l4l$getOwner)() || (0, $g9l4l$createRoot)(()=>(0, $g9l4l$getOwner)()); // we might have an owner, if so, pass it on. Otherwise, create one so solid doesn't print warnings to the console
7931
- const { open_modal_: open_modal_ , close_modal_: close_modal_ } = await (0, $3786428a06ed81c4$export$79b1565500412d9b)((...args)=>{
7932
- (0, $g9l4l$onCleanup)(()=>this.modal_open = false);
7933
- return (0, $a9f6faeac82c322b$export$1c593cbd6f1e10bc)(...args);
7934
- }, {
7935
- search_field_value_: state_.search_field_value,
7885
+ const [reset_history_state_, state_] = (0, $3075a4497054bec6$export$9862539c89138352)(()=>({
7886
+ search_field_value: new URLSearchParams(location.search).get(search_query_url_param_name_) ?? "",
7887
+ search_filters_open: false,
7888
+ search_sorting_open: false,
7889
+ search_expanded_filters: [],
7890
+ // Please make sure that the signal created by below line always updates AFTER selected_filters_ updates on a "popstate" event. If the filter cache is popped before the selected filters are the code in create_modified_filters() is going to re-calculate search_local_filter_cache without knowing the real value of search_selected_filters, and we'll end up with too few filters in search_local_filter_cache in some cases
7891
+ search_local_filter_cache: [],
7892
+ search_expanded_hierarchical_filters: [],
7893
+ search_showing_recommendation_rows: (0, $aee0c68312d971f4$export$1c8c715550dc689d),
7894
+ search_scroll_restoration_data: []
7895
+ }), this.#router);
7896
+ const search_query_updating_blocked_ = (0, $g9l4l$createSignal)(false);
7897
+ const [get_search_query_updating_blocked] = search_query_updating_blocked_;
7898
+ const get_search_query_ = (0, $g9l4l$createMemo)((previous_value)=>{
7899
+ if (get_search_query_updating_blocked()) return previous_value;
7900
+ else return raw_search_query_accessor();
7901
+ });
7902
+ const depict_api_ = api ?? new (0, $3846bb34098c738f$export$e015ed2f2950f2e3)();
7903
+ const previous_searches = (0, $4d62f5daa51642fe$export$84bba84a7b837187)(get_search_query_);
7904
+ const [, set_search_showing_recommendation_rows] = state_.search_showing_recommendation_rows;
7905
+ const after_submit_ = ()=>set_search_showing_recommendation_rows((0, $aee0c68312d971f4$export$1c8c715550dc689d)); // do this every time after we have submitted a new query - otherwise there might already be a saved number of rows in the state
7906
+ const on_submit_with_unchanged_value_ = ()=>this.modal_open = false;
7907
+ const [get_search_field_value_, set_search_field_value_] = state_.search_field_value;
7908
+ const configured_submit_query_ = (new_query)=>(0, $7f6ddd9a7e868c4d$export$e16630ecb9644a1c)({
7909
+ on_submit_with_unchanged_value_: on_submit_with_unchanged_value_,
7910
+ set_search_field_value_: set_search_field_value_,
7911
+ get_search_query_: get_search_query_,
7912
+ search_param_name_: search_query_url_param_name_,
7913
+ after_submit_: after_submit_,
7914
+ get_new_query: ()=>new_query || (0, $g9l4l$untrack)(get_search_field_value_),
7915
+ url_transformer_: url_transformer,
7916
+ router_: this.#router
7917
+ });
7918
+ const i18n_ = (0, $0466953901b38f18$export$f091cbac892643a4)(this.#locale_signal[0]);
7919
+ const clear_filters_on_next_submit_ = (0, $a0d89ff25220eb8d$export$e026af0c7b64ea5f)({
7920
+ selected_filters_: selected_filters_,
7936
7921
  get_search_query_: get_search_query_,
7922
+ current_sorting_: current_sorting_,
7923
+ expanded_hierarchical_filters_: state_.search_expanded_hierarchical_filters,
7924
+ i18n_: i18n_,
7925
+ local_filter_cache_: state_.search_local_filter_cache
7926
+ });
7927
+ $540e930c58500cbe$var$privately_shared_properties.set(this, {
7937
7928
  search_query_url_param_name_: search_query_url_param_name_,
7938
- previous_searches_: previous_searches,
7939
- depict_api_: depict_api_,
7940
- tenant_: this.#merchant_signal[0],
7941
- clear_filters_: clear_filters_on_next_submit_,
7942
- market_: this.#market_signal[0],
7943
- submit_query_: configured_submit_query_,
7944
- url_transformer_: url_transformer,
7929
+ reset_history_state_: reset_history_state_,
7930
+ state_: state_,
7945
7931
  router_: this.#router,
7946
- instant_results_options_: {
7947
- min_products_to_fetch_: $540e930c58500cbe$var$min_products_to_fetch_,
7948
- render_instant_card_: render_instant_card,
7949
- render_instant_card_placeholder_: (0, $aaacfac0064e97d9$export$ee1733d9a8495996),
7950
- has_sort_or_filters_: (0, $g9l4l$createMemo)(()=>!!(Object.keys(selected_filters_[0]())?.length || current_sorting_[0]()))
7951
- },
7952
- i18n_: i18n_,
7932
+ url_transformer_: url_transformer,
7933
+ depict_api_: depict_api_,
7953
7934
  enable_category_suggestions_: enable_category_suggestions,
7954
- disable_scrolling_: disable_scrolling_during_modal,
7955
- bottom_distance_under_modal_: bottom_distance_under_modal
7935
+ clear_filters_on_next_submit_: clear_filters_on_next_submit_,
7936
+ configured_submit_query_: configured_submit_query_,
7937
+ get_search_query_: get_search_query_,
7938
+ i18n_: i18n_,
7939
+ search_query_updating_blocked_: search_query_updating_blocked_,
7940
+ current_sorting_: current_sorting_,
7941
+ selected_filters_: selected_filters_
7956
7942
  });
7957
- // This will add some default behaviour to open_modal_ if no style_props_ are supplied
7958
- // The default behaviour is to align the modal with the input field if possible
7959
- const modal_opening_effect = ()=>{
7960
- const open_signal_value = this.modal_open;
7961
- const signal_value_is_options = Array.isArray(open_signal_value);
7962
- // Close modal if signal is false
7963
- if (!open_signal_value) {
7964
- close_modal_();
7965
- return;
7966
- }
7967
- const { search_page_aligned_modal_body_style_signal_: search_page_aligned_modal_body_style_signal_ } = $540e930c58500cbe$var$privately_shared_properties.get(this);
7968
- if (signal_value_is_options && open_signal_value[0]?.style_props_) {
7969
- // They know what they're doing, just call the modal with the provided options
7970
- open_modal_(...open_signal_value);
7971
- return;
7972
- }
7973
- if (!open_signal_value[0]?.style_props_ && search_page_aligned_modal_body_style_signal_) {
7974
- // Open modal aligned with search page if no alignment specified and possible to align with search page
7975
- if (!signal_value_is_options) {
7943
+ (0, $2864fd26f57ff474$export$5162a71f252e6122)();
7944
+ (0, $g9l4l$catchify)(async ()=>{
7945
+ const { open_modal_: open_modal_ , close_modal_: close_modal_ } = await (0, $3786428a06ed81c4$export$79b1565500412d9b)((...args)=>{
7946
+ (0, $g9l4l$onCleanup)(()=>this.modal_open = false);
7947
+ return (0, $a9f6faeac82c322b$export$1c593cbd6f1e10bc)(...args);
7948
+ }, {
7949
+ search_field_value_: state_.search_field_value,
7950
+ get_search_query_: get_search_query_,
7951
+ search_query_url_param_name_: search_query_url_param_name_,
7952
+ previous_searches_: previous_searches,
7953
+ depict_api_: depict_api_,
7954
+ tenant_: this.#merchant_signal[0],
7955
+ clear_filters_: clear_filters_on_next_submit_,
7956
+ market_: this.#market_signal[0],
7957
+ submit_query_: configured_submit_query_,
7958
+ url_transformer_: url_transformer,
7959
+ router_: this.#router,
7960
+ instant_results_options_: {
7961
+ min_products_to_fetch_: $540e930c58500cbe$var$min_products_to_fetch_,
7962
+ render_instant_card_: render_instant_card,
7963
+ render_instant_card_placeholder_: (0, $aaacfac0064e97d9$export$ee1733d9a8495996),
7964
+ has_sort_or_filters_: (0, $g9l4l$createMemo)(()=>!!(Object.keys(selected_filters_[0]())?.length || current_sorting_[0]()))
7965
+ },
7966
+ i18n_: i18n_,
7967
+ enable_category_suggestions_: enable_category_suggestions,
7968
+ disable_scrolling_: disable_scrolling_during_modal,
7969
+ bottom_distance_under_modal_: bottom_distance_under_modal
7970
+ });
7971
+ // This will add some default behaviour to open_modal_ if no style_props_ are supplied
7972
+ // The default behaviour is to align the modal with the input field if possible
7973
+ const modal_opening_effect = ()=>{
7974
+ const open_signal_value = this.modal_open;
7975
+ const signal_value_is_options = Array.isArray(open_signal_value);
7976
+ // Close modal if signal is false
7977
+ if (!open_signal_value) {
7978
+ close_modal_();
7979
+ return;
7980
+ }
7981
+ const { search_page_aligned_modal_body_style_signal_: search_page_aligned_modal_body_style_signal_ } = $540e930c58500cbe$var$privately_shared_properties.get(this);
7982
+ if (signal_value_is_options && open_signal_value[0]?.style_props_) {
7983
+ // They know what they're doing, just call the modal with the provided options
7984
+ open_modal_(...open_signal_value);
7985
+ return;
7986
+ }
7987
+ if (!open_signal_value[0]?.style_props_ && search_page_aligned_modal_body_style_signal_) {
7988
+ // Open modal aligned with search page if no alignment specified and possible to align with search page
7989
+ if (!signal_value_is_options) {
7990
+ open_modal_({
7991
+ style_props_: search_page_aligned_modal_body_style_signal_
7992
+ });
7993
+ return;
7994
+ }
7995
+ const [options_arg, ...rest] = open_signal_value;
7976
7996
  open_modal_({
7997
+ ...options_arg,
7977
7998
  style_props_: search_page_aligned_modal_body_style_signal_
7978
- });
7999
+ }, ...rest);
8000
+ return;
8001
+ }
8002
+ // Open centered modal
8003
+ const supports_hover = (0, $fefe7683325039b3$export$d9f36cf74e24d595)("(hover: hover) and (pointer: fine)");
8004
+ const desktop_short = (0, $fefe7683325039b3$export$d9f36cf74e24d595)("(max-height: 790px)");
8005
+ const mobile_short = (0, $fefe7683325039b3$export$d9f36cf74e24d595)("(max-height: 1000px)");
8006
+ const transform_y = (0, $g9l4l$createMemo)(()=>supports_hover() ? !desktop_short() : !mobile_short());
8007
+ const style_props_ = (0, $g9l4l$createSignal)({
8008
+ position: "fixed",
8009
+ top: "50%"
8010
+ });
8011
+ (0, $g9l4l$createComputed)(()=>style_props_[1]((old_value)=>({
8012
+ ...old_value,
8013
+ transform: transform_y() ? "translateY(-50%)" : "unset"
8014
+ })));
8015
+ if (signal_value_is_options) {
8016
+ const [options_arg, ...rest] = open_signal_value;
8017
+ open_modal_({
8018
+ ...options_arg,
8019
+ style_props_: search_page_aligned_modal_body_style_signal_ || style_props_
8020
+ }, ...rest);
7979
8021
  return;
7980
8022
  }
7981
- const [options_arg, ...rest] = open_signal_value;
7982
- open_modal_({
7983
- ...options_arg,
7984
- style_props_: search_page_aligned_modal_body_style_signal_
7985
- }, ...rest);
7986
- return;
7987
- }
7988
- // Open centered modal
7989
- const supports_hover = (0, $fefe7683325039b3$export$d9f36cf74e24d595)("(hover: hover) and (pointer: fine)");
7990
- const desktop_short = (0, $fefe7683325039b3$export$d9f36cf74e24d595)("(max-height: 790px)");
7991
- const mobile_short = (0, $fefe7683325039b3$export$d9f36cf74e24d595)("(max-height: 1000px)");
7992
- const transform_y = (0, $g9l4l$createMemo)(()=>supports_hover() ? !desktop_short() : !mobile_short());
7993
- const style_props_ = (0, $g9l4l$createSignal)({
7994
- position: "fixed",
7995
- top: "50%"
7996
- });
7997
- (0, $g9l4l$createComputed)(()=>style_props_[1]((old_value)=>({
7998
- ...old_value,
7999
- transform: transform_y() ? "translateY(-50%)" : "unset"
8000
- })));
8001
- if (signal_value_is_options) {
8002
- const [options_arg, ...rest] = open_signal_value;
8003
8023
  open_modal_({
8004
- ...options_arg,
8005
- style_props_: search_page_aligned_modal_body_style_signal_ || style_props_
8006
- }, ...rest);
8007
- return;
8008
- }
8009
- open_modal_({
8010
- style_props_: style_props_
8011
- });
8012
- };
8013
- (0, $g9l4l$runWithOwner)(owner, ()=>(0, $g9l4l$createEffect)(modal_opening_effect));
8014
- })();
8015
- $540e930c58500cbe$export$ac6237957a15b3f0.#has_been_constructed = true;
8024
+ style_props_: style_props_
8025
+ });
8026
+ };
8027
+ (0, $g9l4l$runWithOwner)(owner, ()=>(0, $g9l4l$createEffect)(modal_opening_effect));
8028
+ })();
8029
+ $540e930c58500cbe$export$ac6237957a15b3f0.#has_been_constructed = true;
8030
+ });
8016
8031
  }
8017
8032
  get on_navigation() {
8018
8033
  // The only non-reactive public property on the class (I don't see it making sense to have it reactive)