@depict-ai/ui 0.0.4 → 0.0.5

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,5 +1,5 @@
1
1
  import {template as $kyEB6$template, insert as $kyEB6$insert, createComponent as $kyEB6$createComponent, spread as $kyEB6$spread, use as $kyEB6$use, setAttribute as $kyEB6$setAttribute, effect as $kyEB6$effect, addEventListener as $kyEB6$addEventListener, delegateEvents as $kyEB6$delegateEvents, memo as $kyEB6$memo, style as $kyEB6$style, mergeProps as $kyEB6$mergeProps, classList as $kyEB6$classList, className as $kyEB6$className} from "solid-js/web";
2
- import {Placeholder as $kyEB6$Placeholder, catchify as $kyEB6$catchify, get_depict_id as $kyEB6$get_depict_id, get_user_id as $kyEB6$get_user_id, get_session_id as $kyEB6$get_session_id, dlog as $kyEB6$dlog, make_url_with_query_params as $kyEB6$make_url_with_query_params, fetch_retry as $kyEB6$fetch_retry, sort_obj as $kyEB6$sort_obj, observer as $kyEB6$observer, report as $kyEB6$report, ContainedPlaceholderImage as $kyEB6$ContainedPlaceholderImage, javascript_media_query as $kyEB6$javascript_media_query, href_change_ipns as $kyEB6$href_change_ipns, standard_price_format as $kyEB6$standard_price_format, deparallelize as $kyEB6$deparallelize, make_asyncIterable_exiter as $kyEB6$make_asyncIterable_exiter, insert_surfaces as $kyEB6$insert_surfaces, Tenant as $kyEB6$Tenant, deparallelize_no_drop as $kyEB6$deparallelize_no_drop, default_rr as $kyEB6$default_rr, make_random_classname as $kyEB6$make_random_classname, n_col_styling_with_dist as $kyEB6$n_col_styling_with_dist, Lazyfier as $kyEB6$Lazyfier, Rec_Renderer as $kyEB6$Rec_Renderer, CrossIcon as $kyEB6$CrossIcon, useExpandingContainer as $kyEB6$useExpandingContainer, Amazing_Slider as $kyEB6$Amazing_Slider, slider_snap_css as $kyEB6$slider_snap_css, slider_fading_factory as $kyEB6$slider_fading_factory, MinusIcon as $kyEB6$MinusIcon, FilterIcon as $kyEB6$FilterIcon, SortIconAsc as $kyEB6$SortIconAsc, SortIconDesc as $kyEB6$SortIconDesc, PlusIcon as $kyEB6$PlusIcon, TickIcon as $kyEB6$TickIcon, ArrowUp as $kyEB6$ArrowUp, queueMacroTask as $kyEB6$queueMacroTask, BackIcon as $kyEB6$BackIcon, SearchIcon as $kyEB6$SearchIcon, depict_click as $kyEB6$depict_click, impression_track_element as $kyEB6$impression_track_element, add_new_tab_listener as $kyEB6$add_new_tab_listener, buildThresholdList as $kyEB6$buildThresholdList, PreviousSearchIcon as $kyEB6$PreviousSearchIcon, Layout as $kyEB6$Layout, make_placeholder_rr as $kyEB6$make_placeholder_rr, async_iterable_ipns as $kyEB6$async_iterable_ipns} from "@depict-ai/utilishared";
2
+ import {Placeholder as $kyEB6$Placeholder, catchify as $kyEB6$catchify, base_url as $kyEB6$base_url, get_depict_id as $kyEB6$get_depict_id, get_user_id as $kyEB6$get_user_id, get_session_id as $kyEB6$get_session_id, dlog as $kyEB6$dlog, make_url_with_query_params as $kyEB6$make_url_with_query_params, fetch_retry as $kyEB6$fetch_retry, sort_obj as $kyEB6$sort_obj, observer as $kyEB6$observer, report as $kyEB6$report, ContainedPlaceholderImage as $kyEB6$ContainedPlaceholderImage, javascript_media_query as $kyEB6$javascript_media_query, href_change_ipns as $kyEB6$href_change_ipns, standard_price_format as $kyEB6$standard_price_format, deparallelize as $kyEB6$deparallelize, make_asyncIterable_exiter as $kyEB6$make_asyncIterable_exiter, insert_surfaces as $kyEB6$insert_surfaces, Tenant as $kyEB6$Tenant, deparallelize_no_drop as $kyEB6$deparallelize_no_drop, default_rr as $kyEB6$default_rr, make_random_classname as $kyEB6$make_random_classname, n_col_styling_with_dist as $kyEB6$n_col_styling_with_dist, Lazyfier as $kyEB6$Lazyfier, queueMacroTask as $kyEB6$queueMacroTask, Rec_Renderer as $kyEB6$Rec_Renderer, CrossIcon as $kyEB6$CrossIcon, useExpandingContainer as $kyEB6$useExpandingContainer, Amazing_Slider as $kyEB6$Amazing_Slider, slider_snap_css as $kyEB6$slider_snap_css, slider_fading_factory as $kyEB6$slider_fading_factory, MinusIcon as $kyEB6$MinusIcon, FilterIcon as $kyEB6$FilterIcon, SortIconAsc as $kyEB6$SortIconAsc, SortIconDesc as $kyEB6$SortIconDesc, PlusIcon as $kyEB6$PlusIcon, TickIcon as $kyEB6$TickIcon, ArrowUp as $kyEB6$ArrowUp, normal_get_product_id as $kyEB6$normal_get_product_id, GenericSliderArrowButton as $kyEB6$GenericSliderArrowButton, BackIcon as $kyEB6$BackIcon, SearchIcon as $kyEB6$SearchIcon, depict_click as $kyEB6$depict_click, impression_track_element as $kyEB6$impression_track_element, add_new_tab_listener as $kyEB6$add_new_tab_listener, buildThresholdList as $kyEB6$buildThresholdList, PreviousSearchIcon as $kyEB6$PreviousSearchIcon, Layout as $kyEB6$Layout, make_placeholder_rr as $kyEB6$make_placeholder_rr, async_iterable_ipns as $kyEB6$async_iterable_ipns, ContainedImage as $kyEB6$ContainedImage} from "@depict-ai/utilishared";
3
3
  import {createSignal as $kyEB6$createSignal, untrack as $kyEB6$untrack, createMemo as $kyEB6$createMemo, onCleanup as $kyEB6$onCleanup, createEffect as $kyEB6$createEffect, createComputed as $kyEB6$createComputed, createRoot as $kyEB6$createRoot, createResource as $kyEB6$createResource, Show as $kyEB6$Show, createRenderEffect as $kyEB6$createRenderEffect, runWithOwner as $kyEB6$runWithOwner, getOwner as $kyEB6$getOwner, on as $kyEB6$on, Index as $kyEB6$Index, batch as $kyEB6$batch, For as $kyEB6$For, ErrorBoundary as $kyEB6$ErrorBoundary} from "solid-js";
4
4
 
5
5
 
@@ -116,7 +116,7 @@ const $a79d86d64fb64e8e$export$824dde41348efed1 = /*@__PURE__*/ (()=>{
116
116
 
117
117
 
118
118
 
119
- const $7fa23e2a0079eca4$var$v2_base_url = process.env.BASE_URL + "/v2/";
119
+ const $7fa23e2a0079eca4$var$v2_base_url = (0, $kyEB6$base_url) + "/v2/";
120
120
  const $7fa23e2a0079eca4$var$search_base_url = $7fa23e2a0079eca4$var$v2_base_url + "search/";
121
121
  const $7fa23e2a0079eca4$var$add_ids_to_request = (input_req)=>{
122
122
  const request = {
@@ -455,7 +455,7 @@ async function $5c5f95951393e5d1$var$fetch_and_store_categories(tenant, market,
455
455
  return new_categories;
456
456
  }
457
457
  async function $5c5f95951393e5d1$var$download_categories(tenant, market) {
458
- const fetched = await (0, $kyEB6$fetch_retry)(process.env.BASE_URL + "/v2/product-listing/queries", {
458
+ const fetched = await (0, $kyEB6$fetch_retry)((0, $kyEB6$base_url) + "/v2/product-listing/queries", {
459
459
  method: "POST",
460
460
  body: JSON.stringify({
461
461
  tenant: tenant,
@@ -2294,6 +2294,7 @@ let $2d25e42846eac370$var$cached_placeholder_element;
2294
2294
  function $2d25e42846eac370$export$3925f87b1545cfc6({ plp_results_: plp_results_ , depict_api_: depict_api_ , all_products_loaded_: all_products_loaded_ , min_products_to_fetch_: min_products_to_fetch_ , query_base_: query_base_ , first_result_in_viewport_: first_result_in_viewport_ , last_result_in_viewport_: last_result_in_viewport_ , scroll_restoration_data_: scroll_restoration_data_ , no_results_options_: no_results_options_ , desktop_filter_elements_: desktop_filter_elements_ , sort_or_filter_open_: sort_or_filter_open_ , rr_options_: rr_options_ , layout_options_: layout_options_ , tenant_object_: tenant_object_ , type_for_tracking_: type_for_tracking_ , id_currently_querying_for_: id_currently_querying_for_ }) {
2295
2295
  // The plp_results_ resource will be delayed because we're using createBatchedMemo to not make triplicate API requests, but we need to show the placeholders before already to match Chrome and Firefox's "content has to be there, ready for scroll restoration, before all popstate tasks have been completed"-requirement
2296
2296
  const is_loading = (0, $kyEB6$createMemo)(()=>plp_results_.loading || query_base_.loading);
2297
+ const cleanup_old_cards = [];
2297
2298
  const render_and_insert_results = (0, $kyEB6$deparallelize_no_drop)(async (insert_into, owner)=>{
2298
2299
  const fallback_to_no_results = ()=>(0, $kyEB6$runWithOwner)(owner, ()=>insert_into.replaceChildren(...(0, $598245ecfe38f34b$export$ef6006467f04ee41)(no_results_options_)));
2299
2300
  const observe_for_counting_ = (0, $kyEB6$runWithOwner)(owner, ()=>(0, $6656265e0c3cc617$export$daf1a0aef2143a61)({
@@ -2311,10 +2312,19 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({ plp_results_: plp_results_
2311
2312
  observe_for_counting_: observe_for_counting_,
2312
2313
  start_cursor_: current_cursor
2313
2314
  }) : (items)=>(observe_for_counting_(items), items);
2315
+ // create owner to run product cards with an Owner, so they know when they've gotten removed
2316
+ const [owner_for_cards, dispose_our_cards] = (0, $kyEB6$createRoot)((dispose)=>[
2317
+ (0, $kyEB6$getOwner)(),
2318
+ dispose
2319
+ ]);
2314
2320
  const rendering_result = await (0, $kyEB6$default_rr)(tenant_object_, {
2315
2321
  type: type_for_tracking_,
2316
2322
  recs: current_results.displays,
2317
2323
  ...rr_options_,
2324
+ ...typeof rr_options_.template === "function" ? {
2325
+ template: (...args)=>(0, $kyEB6$runWithOwner)(owner_for_cards, ()=>// give template the possibility to know when it gets removed from the DOM by using solid-js onCleanup
2326
+ rr_options_.template(...args))
2327
+ } : {},
2318
2328
  post_processors: [
2319
2329
  ...rr_options_.post_processors || [],
2320
2330
  load_more_post_processor
@@ -2331,6 +2341,9 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({ plp_results_: plp_results_
2331
2341
  return;
2332
2342
  }
2333
2343
  insert_into.replaceChildren(...elements);
2344
+ // Dispose the old cards just after the cards have been removed from the DOM
2345
+ cleanup_old_cards.forEach((cleanup_function)=>cleanup_function());
2346
+ cleanup_old_cards.push(dispose_our_cards); // push after calling, so that we don't instantly demolish ourselves lol
2334
2347
  should_stay_inserted?.then((should)=>{
2335
2348
  // If we shouldn't stay inserted for some reason, switch back to no results
2336
2349
  if (!should) fallback_to_no_results();
@@ -2344,6 +2357,7 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({ plp_results_: plp_results_
2344
2357
  const is_at_end = !plp_results_()?.cursor; // or failed, but we don't wanna / it's not easy to retry
2345
2358
  if (!is_loading() && is_at_end) all_products_loaded_[1](true);
2346
2359
  });
2360
+ (0, $kyEB6$onCleanup)(()=>cleanup_old_cards.forEach((fn)=>fn())); // if everything gets cleaned up without new cards replacing the old ones, clean up the last cards
2347
2361
  return (()=>{
2348
2362
  const _el$ = $2d25e42846eac370$var$_tmpl$.cloneNode(true);
2349
2363
  (0, $kyEB6$insert)(_el$, (0, $kyEB6$createComponent)((0, $kyEB6$Show), {
@@ -2454,6 +2468,15 @@ async function $2d25e42846eac370$var$insert_placeholders({ scroll_restoration_da
2454
2468
  type: "placeholder",
2455
2469
  pre_processors: [],
2456
2470
  post_processors: [],
2471
+ ...typeof rr_options_.template === "function" ? {
2472
+ template: (...args)=>(0, $kyEB6$createRoot)(async (dispose)=>{
2473
+ try {
2474
+ return await rr_options_.template(...args);
2475
+ } finally{
2476
+ (0, $kyEB6$queueMacroTask)((0, $kyEB6$catchify)(dispose)); // we just want it cloned and dead
2477
+ }
2478
+ })
2479
+ } : {},
2457
2480
  recs: [
2458
2481
  {
2459
2482
  page_url: "javascript:void(0)"
@@ -2462,7 +2485,7 @@ async function $2d25e42846eac370$var$insert_placeholders({ scroll_restoration_da
2462
2485
  });
2463
2486
  const element = elements?.find((e)=>e instanceof HTMLElement || e instanceof SVGElement);
2464
2487
  if (!element) return [];
2465
- $2d25e42846eac370$var$cached_placeholder_element = element;
2488
+ $2d25e42846eac370$var$cached_placeholder_element = element.cloneNode(true); // don't save the actual element, clone it directly so that the who provided it can't modify it later (this has caused a bug before with react)
2466
2489
  }
2467
2490
  (0, $kyEB6$runWithOwner)(owner_, ()=>(0, $kyEB6$createRenderEffect)(()=>{
2468
2491
  const to_add = num_placeholders() - existing_num;
@@ -2635,6 +2658,7 @@ function $1adfe60f3a14a1d7$export$fecbb157621501bd({ number_of_rendered_selected
2635
2658
  const { collapse: collapse , expand: expand , ExpandingContainer: ExpandingContainer } = (0, $24e27fab9c821b86$export$5bad61ecde080b1f)({
2636
2659
  duration: 200
2637
2660
  });
2661
+ const owner = (0, $kyEB6$getOwner)();
2638
2662
  const outmost_element = (0, $kyEB6$createComponent)(ExpandingContainer, {
2639
2663
  get children () {
2640
2664
  return (0, $kyEB6$createComponent)((0, $kyEB6$Show), {
@@ -2651,14 +2675,15 @@ function $1adfe60f3a14a1d7$export$fecbb157621501bd({ number_of_rendered_selected
2651
2675
  return [
2652
2676
  (()=>{
2653
2677
  const _el$4 = $1adfe60f3a14a1d7$var$_tmpl$.cloneNode(true);
2654
- (0, $kyEB6$addEventListener)(_el$4, "click", (0, $kyEB6$catchify)(()=>(0, $e9342fb3ac73a54a$export$8895d39404bd2bb1)({
2655
- selected_filters_: selected_filters_,
2656
- i18n_: i18n_,
2657
- also_clear_sorting_: false,
2658
- user_triggered_: true,
2659
- expanded_hierarchical_filters_: expanded_hierarchical_filters_,
2660
- local_filter_cache_: local_filter_cache_
2661
- })), true);
2678
+ (0, $kyEB6$addEventListener)(_el$4, "click", (0, $kyEB6$catchify)(()=>// click event handlers don't have an owner, carry it over
2679
+ (0, $kyEB6$runWithOwner)(owner, ()=>(0, $e9342fb3ac73a54a$export$8895d39404bd2bb1)({
2680
+ selected_filters_: selected_filters_,
2681
+ i18n_: i18n_,
2682
+ also_clear_sorting_: false,
2683
+ user_triggered_: true,
2684
+ expanded_hierarchical_filters_: expanded_hierarchical_filters_,
2685
+ local_filter_cache_: local_filter_cache_
2686
+ }))), true);
2662
2687
  (0, $kyEB6$insert)(_el$4, ()=>i18n_.clear_all_from_filter_crumbs_());
2663
2688
  return _el$4;
2664
2689
  })(),
@@ -2932,8 +2957,10 @@ async function $194bd6b8e4c59830$export$79b1565500412d9b(search_modal, modal_fn_
2932
2957
  const close_modal_ = ()=>{
2933
2958
  if (dispose_and_remove) {
2934
2959
  // modal is open
2935
- dispose_and_remove();
2960
+ const dispose_fn = dispose_and_remove;
2961
+ // set dispose function to undefined in case that it triggers this dispose function itself. Not doing it leads to a bug like https://github.com/solidjs/solid/discussions/1194
2936
2962
  dispose_and_remove = undefined;
2963
+ dispose_fn();
2937
2964
  }
2938
2965
  };
2939
2966
  return {
@@ -6011,8 +6038,8 @@ function $90980bd87c9960f9$var$proxy_push_state(function_name, thing) {
6011
6038
  }
6012
6039
 
6013
6040
 
6014
- const $a0f0a70198583479$var$_tmpl$ = /*#__PURE__*/ (0, $kyEB6$template)(`<div class="depict plp category"></div>`, 2);
6015
- class $a0f0a70198583479$export$3a8840c5b2ecf003 {
6041
+ const $9653a36120f642b0$var$_tmpl$ = /*#__PURE__*/ (0, $kyEB6$template)(`<div class="depict plp category"></div>`, 2);
6042
+ class $9653a36120f642b0$export$3a8840c5b2ecf003 {
6016
6043
  #locale_signal = (0, $kyEB6$createSignal)();
6017
6044
  #tenant_signal = (0, $kyEB6$createSignal)();
6018
6045
  #market_signal = (0, $kyEB6$createSignal)();
@@ -6024,14 +6051,14 @@ class $a0f0a70198583479$export$3a8840c5b2ecf003 {
6024
6051
  #booted = false;
6025
6052
  static #has_been_constructed = false;
6026
6053
  constructor(opts){
6027
- if ($a0f0a70198583479$export$3a8840c5b2ecf003.#has_been_constructed) throw new Error("You can only have one instance of Category due to state limitations");
6028
- $a0f0a70198583479$export$3a8840c5b2ecf003.#has_been_constructed = true;
6054
+ if ($9653a36120f642b0$export$3a8840c5b2ecf003.#has_been_constructed) throw new Error("You can only have one instance of Category due to state limitations");
6055
+ $9653a36120f642b0$export$3a8840c5b2ecf003.#has_been_constructed = true;
6029
6056
  this.#constructor_options = opts;
6030
6057
  (0, $90980bd87c9960f9$export$5162a71f252e6122)();
6031
6058
  }
6032
6059
  get #external_area_div() {
6033
6060
  // creates a new node every time this is accessed, doing like this for DRY purposes
6034
- return $a0f0a70198583479$var$_tmpl$.cloneNode(true);
6061
+ return $9653a36120f642b0$var$_tmpl$.cloneNode(true);
6035
6062
  }
6036
6063
  get locale_() {
6037
6064
  // allow reactive access
@@ -6158,6 +6185,9 @@ class $a0f0a70198583479$export$3a8840c5b2ecf003 {
6158
6185
 
6159
6186
 
6160
6187
 
6188
+
6189
+
6190
+
6161
6191
  function $48d7e4a9707315b6$export$e026af0c7b64ea5f({ selected_filters_: selected_filters_ , search_query_: [get_search_query] , current_sorting_: current_sorting_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , i18n_: i18n_ , local_filter_cache_: local_filter_cache_ }) {
6162
6192
  const [get_selected_filters, set_selected_filters] = selected_filters_;
6163
6193
  const clear_filters_next_submit_ = (0, $kyEB6$createSignal)(false); // we store this here (and not in history.state) (maybe there's a better place) because it's a very temporary thing. I.e. as soon as anything breaks the "flow of intent" to make a new search we want this reset
@@ -6273,6 +6303,18 @@ function $13e008d5237dbbee$export$2542ffb77b620b02(params_to_default_value) {
6273
6303
 
6274
6304
 
6275
6305
 
6306
+
6307
+
6308
+
6309
+
6310
+
6311
+
6312
+
6313
+
6314
+
6315
+
6316
+
6317
+
6276
6318
 
6277
6319
 
6278
6320
 
@@ -6280,7 +6322,7 @@ function $13e008d5237dbbee$export$2542ffb77b620b02(params_to_default_value) {
6280
6322
 
6281
6323
 
6282
6324
  const $857105c41ea47bee$var$_tmpl$ = /*#__PURE__*/ (0, $kyEB6$template)(`<button class="back" type="button"></button>`, 2), $857105c41ea47bee$var$_tmpl$2 = /*#__PURE__*/ (0, $kyEB6$template)(`<div class="query_input"><div class="field"><input class="query" tabindex="0"><button type="button" class="clear"></button></div><button class="submit major" type="button"></button></div>`, 9);
6283
- function $857105c41ea47bee$export$ff21851bb5d30e15({ search_field_value_: search_field_value_ , input_field_ref_: input_field_ref_ , submit_query_: submit_query_ , override_on_enter_: override_on_enter_ , clear_filters_: clear_filters_ , disabled_: disabled_ = false , on_back_: on_back_ , i18n_: i18n_ }) {
6325
+ function $857105c41ea47bee$export$ff21851bb5d30e15({ search_field_value_: search_field_value_ , input_field_ref_: input_field_ref_ , field_element_ref_: field_element_ref_ , submit_query_: submit_query_ , override_on_enter_: override_on_enter_ , clear_filters_: clear_filters_ , disabled_: disabled_ = false , on_back_: on_back_ , i18n_: i18n_ }) {
6284
6326
  let input_field;
6285
6327
  (0, $kyEB6$createEffect)((0, $kyEB6$catchify)(async ()=>{
6286
6328
  if (disabled_) return;
@@ -6300,6 +6342,7 @@ function $857105c41ea47bee$export$ff21851bb5d30e15({ search_field_value_: search
6300
6342
  return _el$2;
6301
6343
  }
6302
6344
  }), _el$3);
6345
+ (0, $kyEB6$use)((el)=>field_element_ref_?.(el), _el$3);
6303
6346
  (0, $kyEB6$addEventListener)(_el$4, "select", (0, $kyEB6$catchify)((e)=>{
6304
6347
  if (!disabled_) // just in case. The field not actually being disabled when being disabled_ is so that you can focus it and open the modal. We don't want any of the other input-field-interaction features to work
6305
6348
  {
@@ -6376,19 +6419,6 @@ function $857105c41ea47bee$export$ff21851bb5d30e15({ search_field_value_: search
6376
6419
 
6377
6420
 
6378
6421
 
6379
-
6380
-
6381
-
6382
-
6383
-
6384
-
6385
-
6386
-
6387
-
6388
-
6389
-
6390
-
6391
-
6392
6422
 
6393
6423
  const $eea41f703612261b$var$_tmpl$ = /*#__PURE__*/ (0, $kyEB6$template)(`<div class="instant-results"></div>`, 2);
6394
6424
  function $eea41f703612261b$export$62f101a8aa597bf8({ depict_api_: depict_api_ , search_field_value_: [get_search_field_value] , tenant_: tenant_ , market_: market_ , render_instant_card_: render_instant_card_ , render_instant_card_placeholder_: render_instant_card_placeholder_ , min_products_to_fetch_: min_products_to_fetch_ , has_sort_or_filters_: has_sort_or_filters_ , set_num_results_accessor_: set_num_results_accessor_ , i18n_: i18n_ }) {
@@ -7445,6 +7475,7 @@ function $172e1b898d457050$export$7de92c4c2205ebf3({ depict_api_: depict_api_ ,
7445
7475
  })();
7446
7476
  const [get_showing_recommendation_rows] = showing_recommendation_rows_;
7447
7477
  const rows_object = view_more_button_ ? $172e1b898d457050$var$make_state_saved_rows(showing_recommendation_rows_, i18n_) : "all";
7478
+ const cleanup_old_cards = [];
7448
7479
  (0, $kyEB6$Layout)({
7449
7480
  container_element: cards,
7450
7481
  layout: "grid",
@@ -7482,13 +7513,22 @@ function $172e1b898d457050$export$7de92c4c2205ebf3({ depict_api_: depict_api_ ,
7482
7513
  }));
7483
7514
  const deparallelized_recs_fetcher = (0, $kyEB6$deparallelize_no_drop)((0, $kyEB6$catchify)(async (base_query)=>{
7484
7515
  const recs_promise = depict_api_.get_recommended(base_query).then((r)=>r.displays);
7516
+ // create owner to run product cards with an Owner, so they know when they've gotten removed
7517
+ const [owner_for_cards, dispose_our_cards] = (0, $kyEB6$createRoot)((dispose)=>[
7518
+ (0, $kyEB6$getOwner)(),
7519
+ dispose
7520
+ ]);
7485
7521
  const rendering_result = await (await (0, $kyEB6$make_placeholder_rr)({
7486
7522
  // render the max amount of elements that there could be, to make sure scroll restoration works (placeholders can't be shorter than actual content)
7487
7523
  num_items: (0, $7747fe1a8c5652e3$export$6c9030e511152266) + (0, $kyEB6$untrack)(get_showing_recommendation_rows) * Math.max(...layout_options_.cols_at_size.map(([per_column])=>per_column))
7488
7524
  }))(tenant_object_, {
7489
7525
  type: "search_recs",
7490
7526
  recs: recs_promise,
7491
- ...rr_options_
7527
+ ...rr_options_,
7528
+ ...typeof rr_options_.template === "function" ? {
7529
+ template: (...args)=>(0, $kyEB6$runWithOwner)(owner_for_cards, ()=>// give template the possibility to know when it gets removed from the DOM by using solid-js onCleanup
7530
+ rr_options_.template(...args))
7531
+ } : {}
7492
7532
  });
7493
7533
  const { elements: elements , should_stay_inserted: should_stay_inserted } = rendering_result;
7494
7534
  let dead = false;
@@ -7499,12 +7539,16 @@ function $172e1b898d457050$export$7de92c4c2205ebf3({ depict_api_: depict_api_ ,
7499
7539
  return;
7500
7540
  }
7501
7541
  cards.replaceChildren(...elements);
7542
+ // Dispose the old cards just after the cards have been removed from the DOM
7543
+ cleanup_old_cards.forEach((cleanup_function)=>cleanup_function());
7544
+ cleanup_old_cards.push(dispose_our_cards); // push after calling, so that we don't instantly demolish ourselves lol
7502
7545
  set_is_showing_something(true);
7503
7546
  should_stay_inserted?.then((should)=>{
7504
7547
  if (!should && !dead /* just in case */ ) set_is_showing_something(false);
7505
7548
  });
7506
7549
  }));
7507
7550
  (0, $kyEB6$createRenderEffect)(()=>deparallelized_recs_fetcher(search_query_base_()));
7551
+ (0, $kyEB6$onCleanup)(()=>cleanup_old_cards.forEach((fn)=>fn())); // if everything gets cleaned up without new cards replacing the old ones, clean up the last cards
7508
7552
  return (0, $kyEB6$createComponent)((0, $kyEB6$Show), {
7509
7553
  get when () {
7510
7554
  return is_showing_something();
@@ -7572,491 +7616,778 @@ function $f8c929beb82c512b$export$9dd50d35b9d94fdf({ search_query_: search_query
7572
7616
 
7573
7617
  const $7097477c78a89208$var$_tmpl$ = /*#__PURE__*/ (0, $kyEB6$template)(`<div class="filter-results-for-one-row"></div>`, 2), $7097477c78a89208$var$_tmpl$2 = /*#__PURE__*/ (0, $kyEB6$template)(`<div class="depict plp search"><div class="listing-page"></div></div>`, 4);
7574
7618
  function $7097477c78a89208$export$a54ec244c8863715(opts) {
7575
- const { depict_api_: depict_api_ , page_replacer_: page_replacer_ , search_field_value_: search_field_value_ , search_query_: search_query_ , open_modal_: open_modal_ , submit_query_: submit_query_ , current_sorting_: current_sorting_ , min_products_to_fetch_: min_products_to_fetch_ , search_filters_open_: search_filters_open_ , search_sorting_open_: search_sorting_open_ , expanded_filters_: expanded_filters_ , input_modal_open_: input_modal_open_ , selected_filters_: selected_filters_ , i18n_: i18n_ , slider_arrow_button_: slider_arrow_button_ , make_category_suggestion_card_: make_category_suggestion_card_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , clear_filters_on_next_submit_: clear_filters_on_next_submit_ , local_filter_cache_: local_filter_cache_ , include_input_field_: include_input_field_ , tenant_: tenant_ , market_: market_ , showing_recommendation_rows_: showing_recommendation_rows_ , rr_options_: rr_options_ , recommendations_rr_options_: recommendations_rr_options_ = rr_options_ , search_recs_view_more_: search_recs_view_more_ , get_product_id_: get_product_id_ , disable_search_recommendations_: disable_search_recommendations_ , layout_options_: layout_options_ , recommendations_layout_options_: recommendations_layout_options_ = layout_options_ , scroll_restoration_data_: scroll_restoration_data_ } = opts;
7576
- return (0, $kyEB6$createRoot)((dispose)=>{
7577
- return (0, $b7436a6d1fd64e3b$export$b69d0d92862de18b)({
7578
- severity_: "error",
7579
- message_: "Whole search failed",
7580
- get children () {
7581
- page_replacer_.addEventListener("close", dispose, {
7582
- once: true
7583
- });
7584
- const tenant_object_ = new (0, $kyEB6$Tenant)({
7585
- TENANT: (0, $kyEB6$untrack)(tenant_),
7586
- MARKET: (0, $kyEB6$untrack)(market_),
7587
- GA_ID: "",
7588
- get_product_id: get_product_id_
7589
- });
7590
- const [get_sorting] = current_sorting_;
7591
- const [get_search_query] = search_query_;
7592
- const all_products_loaded_ = (0, $kyEB6$createSignal)(false);
7593
- const [get_all_products_loaded, set_all_products_loaded] = all_products_loaded_;
7594
- const number_of_rendered_selected_filters_items_ = (0, $kyEB6$createSignal)(0);
7595
- const first_result_in_viewport_ = (0, $kyEB6$createSignal)();
7596
- const last_result_in_viewport_ = (0, $kyEB6$createSignal)();
7597
- const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = (0, $kyEB6$createSignal)(false);
7598
- const search_query_base_ = (0, $587cd61972788655$export$210f130a61ac1e8d)(()=>{
7599
- const sort_obj = get_sorting() && {
7600
- ...get_sorting()
7601
- };
7602
- delete sort_obj?.meta;
7603
- const f = selected_filters_[0]();
7604
- return {
7605
- tenant: tenant_(),
7606
- market: market_(),
7607
- query: get_search_query(),
7608
- ...f.length ? {
7609
- filters: f
7610
- } : {},
7611
- ...sort_obj ? {
7612
- sort: sort_obj
7613
- } : {}
7614
- };
7615
- });
7616
- const [search_results_] = (0, $kyEB6$createResource)(search_query_base_, (0, $kyEB6$catchify)(async (base_query)=>{
7617
- set_all_products_loaded(false);
7618
- // only first page of results
7619
- return await (0, $641bba2917fe862b$export$cc42dd29bf655ab6)({
7620
- id_: (0, $kyEB6$untrack)(get_search_query),
7619
+ const { depict_api_: depict_api_ , search_field_value_: search_field_value_ , search_query_: search_query_ , open_modal_: open_modal_ , submit_query_: submit_query_ , current_sorting_: current_sorting_ , min_products_to_fetch_: min_products_to_fetch_ , search_filters_open_: search_filters_open_ , search_sorting_open_: search_sorting_open_ , expanded_filters_: expanded_filters_ , input_modal_open_: input_modal_open_ , selected_filters_: selected_filters_ , i18n_: i18n_ , slider_arrow_button_: slider_arrow_button_ , make_category_suggestion_card_: make_category_suggestion_card_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , clear_filters_on_next_submit_: clear_filters_on_next_submit_ , local_filter_cache_: local_filter_cache_ , include_input_field_: include_input_field_ , tenant_: tenant_ , market_: market_ , showing_recommendation_rows_: showing_recommendation_rows_ , rr_options_: rr_options_ , recommendations_rr_options_: recommendations_rr_options_ = rr_options_ , search_recs_view_more_: search_recs_view_more_ , get_product_id_: get_product_id_ , disable_search_recommendations_: disable_search_recommendations_ , layout_options_: layout_options_ , recommendations_layout_options_: recommendations_layout_options_ = layout_options_ , scroll_restoration_data_: scroll_restoration_data_ } = opts;
7620
+ const tenant_object_ = new (0, $kyEB6$Tenant)({
7621
+ TENANT: (0, $kyEB6$untrack)(tenant_),
7622
+ MARKET: (0, $kyEB6$untrack)(market_),
7623
+ GA_ID: "",
7624
+ get_product_id: get_product_id_
7625
+ });
7626
+ const [get_sorting] = current_sorting_;
7627
+ const [get_search_query] = search_query_;
7628
+ const all_products_loaded_ = (0, $kyEB6$createSignal)(false);
7629
+ const [get_all_products_loaded, set_all_products_loaded] = all_products_loaded_;
7630
+ const number_of_rendered_selected_filters_items_ = (0, $kyEB6$createSignal)(0);
7631
+ const first_result_in_viewport_ = (0, $kyEB6$createSignal)();
7632
+ const last_result_in_viewport_ = (0, $kyEB6$createSignal)();
7633
+ const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = (0, $kyEB6$createSignal)(false);
7634
+ const search_query_base_ = (0, $587cd61972788655$export$210f130a61ac1e8d)(()=>{
7635
+ const sort_obj = get_sorting() && {
7636
+ ...get_sorting()
7637
+ };
7638
+ delete sort_obj?.meta;
7639
+ const f = selected_filters_[0]();
7640
+ return {
7641
+ tenant: tenant_(),
7642
+ market: market_(),
7643
+ query: get_search_query(),
7644
+ ...f.length ? {
7645
+ filters: f
7646
+ } : {},
7647
+ ...sort_obj ? {
7648
+ sort: sort_obj
7649
+ } : {}
7650
+ };
7651
+ });
7652
+ const [search_results_] = (0, $kyEB6$createResource)(search_query_base_, (0, $kyEB6$catchify)(async (base_query)=>{
7653
+ set_all_products_loaded(false);
7654
+ // only first page of results
7655
+ return await (0, $641bba2917fe862b$export$cc42dd29bf655ab6)({
7656
+ id_: (0, $kyEB6$untrack)(get_search_query),
7657
+ min_products_to_fetch_: min_products_to_fetch_,
7658
+ scroll_restoration_data_: scroll_restoration_data_,
7659
+ make_request_: (limit, cursor)=>depict_api_.query({
7660
+ ...base_query,
7661
+ limit: limit,
7662
+ ...cursor ? {
7663
+ cursor: cursor
7664
+ } : {}
7665
+ })
7666
+ });
7667
+ }));
7668
+ const [suggestions] = (0, $kyEB6$createResource)((0, $kyEB6$createMemo)(()=>({
7669
+ query: search_query_[0](),
7670
+ tenant: tenant_(),
7671
+ market: market_()
7672
+ })), (opts)=>depict_api_.suggest(opts));
7673
+ const available_sortings_ = (0, $kyEB6$createMemo)(()=>search_results_()?.sorts?.map((sort)=>({
7674
+ ...sort,
7675
+ order: sort.order ?? "desc"
7676
+ })));
7677
+ const available_filters_ = (0, $kyEB6$createMemo)(()=>search_results_()?.filters);
7678
+ const modal_body_style = (0, $kyEB6$createSignal)({});
7679
+ let input_field;
7680
+ if (include_input_field_) {
7681
+ const SafeQueryInput = (0, $kyEB6$catchify)((0, $857105c41ea47bee$export$ff21851bb5d30e15));
7682
+ input_field = (0, $kyEB6$createComponent)(SafeQueryInput, {
7683
+ i18n_: i18n_,
7684
+ disabled_: true,
7685
+ search_query_: search_query_,
7686
+ search_field_value_: search_field_value_,
7687
+ submit_query_: submit_query_,
7688
+ clear_filters_: clear_filters_on_next_submit_
7689
+ });
7690
+ if (input_field) {
7691
+ opts?.modal_body_style_ref_?.(modal_body_style);
7692
+ const align_position = (0, $kyEB6$catchify)((0, $b6d5529b253681aa$export$b3ad617e9036868))(modal_body_style, input_field, undefined, true);
7693
+ input_field.addEventListener("click", (0, $kyEB6$catchify)((e)=>{
7694
+ const target = e.target;
7695
+ const sel = ".submit";
7696
+ if (target?.matches?.(sel) || target?.closest?.(sel)) // the search button is just decor, don't do anything when clicked
7697
+ return;
7698
+ align_position?.();
7699
+ open_modal_({
7700
+ style_props_: modal_body_style
7701
+ }, ()=>include_input_field_?.on_close_?.());
7702
+ include_input_field_?.on_open_?.();
7703
+ }));
7704
+ }
7705
+ }
7706
+ const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $kyEB6$createSignal)(false);
7707
+ const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $kyEB6$createSignal)();
7708
+ const formatted_number_of_results_ = (0, $511cc0abd9a64ce8$export$92f2da32c6e7e7ee)({
7709
+ search_results_: search_results_,
7710
+ i18n_: i18n_
7711
+ });
7712
+ const [sort_and_filter_element_, set_sort_and_filter_element_] = (0, $kyEB6$createSignal)();
7713
+ const results_for = (0, $kyEB6$createComponent)((0, $f8c929beb82c512b$export$9dd50d35b9d94fdf), {
7714
+ search_query_: search_query_,
7715
+ i18n_: i18n_,
7716
+ formatted_number_of_results_: formatted_number_of_results_
7717
+ });
7718
+ const filters_opener = (0, $cdea4cf8c5c071ef$export$d7841e452f2e59a8)({
7719
+ set_sort_or_filter_open_: set_sort_or_filter_open_,
7720
+ set_extra_els_in_results_container_: set_desktop_filter_elements,
7721
+ i18n_: i18n_,
7722
+ search_sorting_open_: search_sorting_open_,
7723
+ available_filters_: available_filters_,
7724
+ available_sortings_: available_sortings_,
7725
+ search_filters_open_: search_filters_open_,
7726
+ set_sort_and_filter_element_: set_sort_and_filter_element_,
7727
+ current_sorting_: current_sorting_,
7728
+ input_modal_open_: input_modal_open_,
7729
+ expanded_filters_: expanded_filters_,
7730
+ selected_filters_: selected_filters_,
7731
+ formatted_number_of_results_: formatted_number_of_results_,
7732
+ local_filter_cache_: local_filter_cache_,
7733
+ expanded_hierarchical_filters_: expanded_hierarchical_filters_,
7734
+ number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_
7735
+ });
7736
+ const results_filters = (0, $kyEB6$createSignal)();
7737
+ (0, $kyEB6$onCleanup)((0, $kyEB6$javascript_media_query)("(max-width:600px)", async ({ matches: matches })=>{
7738
+ results_filters[1]();
7739
+ await new Promise((r)=>queueMicrotask(r));
7740
+ results_filters[1](matches ? [
7741
+ results_for,
7742
+ filters_opener
7743
+ ] : (()=>{
7744
+ const _el$ = $7097477c78a89208$var$_tmpl$.cloneNode(true);
7745
+ (0, $kyEB6$insert)(_el$, results_for, null);
7746
+ (0, $kyEB6$insert)(_el$, filters_opener, null);
7747
+ return _el$;
7748
+ })());
7749
+ }).remove);
7750
+ (0, $kyEB6$catchify)((0, $641bba2917fe862b$export$6e49da55e449af7c))({
7751
+ scroll_restoration_data_: scroll_restoration_data_,
7752
+ last_result_in_viewport_: last_result_in_viewport_,
7753
+ id_: get_search_query,
7754
+ can_write_scroll_restoration_: can_write_scroll_restoration_
7755
+ });
7756
+ (0, $kyEB6$createComputed)(()=>{
7757
+ if (search_results_.loading) set_can_write_scroll_restoration(false);
7758
+ else if (search_results_()) set_can_write_scroll_restoration(true);
7759
+ });
7760
+ (0, $fc5a12f3a857ca30$export$e702733a056c40d6)({
7761
+ selected_filters_: selected_filters_,
7762
+ available_filters_: available_filters_
7763
+ });
7764
+ // @ts-ignore
7765
+ if (process.env.GA !== "false") (0, $kyEB6$createEffect)(()=>{
7766
+ get_search_query();
7767
+ (0, $d78eea1e8707dc2d$export$c7e181728ad525f)(location);
7768
+ });
7769
+ (0, $kyEB6$createComputed)(()=>{
7770
+ tenant_object_.tenant = tenant_object_.TENANT = tenant_();
7771
+ tenant_object_.market = tenant_object_.MARKET = market_();
7772
+ });
7773
+ return [
7774
+ document.createComment("Depict.ai frontend integrated search page"),
7775
+ (()=>{
7776
+ const _el$2 = $7097477c78a89208$var$_tmpl$2.cloneNode(true), _el$3 = _el$2.firstChild;
7777
+ (0, $kyEB6$insert)(_el$3, input_field, null);
7778
+ (0, $kyEB6$insert)(_el$3, make_category_suggestion_card_ ? (0, $kyEB6$createComponent)((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
7779
+ severity_: "error",
7780
+ message_: "Category suggestions failed",
7781
+ get children () {
7782
+ return (0, $kyEB6$createComponent)((0, $793905995512612d$export$c05a196222ba1302), {
7783
+ selected_filters_: selected_filters_,
7784
+ suggestions_: suggestions,
7785
+ slider_arrow_button_: slider_arrow_button_,
7786
+ children: make_category_suggestion_card_
7787
+ });
7788
+ }
7789
+ }) : null, null);
7790
+ (0, $kyEB6$insert)(_el$3, ()=>results_filters[0](), null);
7791
+ (0, $kyEB6$insert)(_el$3, (0, $kyEB6$createComponent)((0, $kyEB6$Show), {
7792
+ get when () {
7793
+ return selected_filters_[0]()?.length;
7794
+ },
7795
+ keyed: false,
7796
+ get children () {
7797
+ return (0, $kyEB6$createComponent)((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
7798
+ message_: "Selected filters failed",
7799
+ severity_: "error",
7800
+ get children () {
7801
+ return (0, $1adfe60f3a14a1d7$export$fecbb157621501bd)({
7802
+ i18n_: i18n_,
7803
+ selected_filters_: selected_filters_,
7804
+ local_filter_cache_: local_filter_cache_,
7805
+ slider_arrow_button_: slider_arrow_button_,
7806
+ search_filters_open_: search_filters_open_,
7807
+ search_sorting_open_: search_sorting_open_,
7808
+ number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_,
7809
+ expanded_hierarchical_filters_: expanded_hierarchical_filters_
7810
+ });
7811
+ }
7812
+ });
7813
+ }
7814
+ }), null);
7815
+ (0, $kyEB6$insert)(_el$3, (0, $kyEB6$createComponent)((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
7816
+ severity_: "error",
7817
+ message_: "Search results failed",
7818
+ get children () {
7819
+ return (0, $2d25e42846eac370$export$3925f87b1545cfc6)({
7820
+ all_products_loaded_: all_products_loaded_,
7621
7821
  min_products_to_fetch_: min_products_to_fetch_,
7822
+ query_base_: search_query_base_,
7823
+ plp_results_: search_results_,
7824
+ depict_api_: depict_api_,
7825
+ first_result_in_viewport_: first_result_in_viewport_,
7826
+ last_result_in_viewport_: last_result_in_viewport_,
7622
7827
  scroll_restoration_data_: scroll_restoration_data_,
7623
- make_request_: (limit, cursor)=>depict_api_.query({
7624
- ...base_query,
7625
- limit: limit,
7626
- ...cursor ? {
7627
- cursor: cursor
7628
- } : {}
7629
- })
7828
+ desktop_filter_elements_: desktop_filter_elements_,
7829
+ rr_options_: rr_options_,
7830
+ layout_options_: layout_options_,
7831
+ sort_or_filter_open_: sort_or_filter_open_,
7832
+ tenant_object_: tenant_object_,
7833
+ type_for_tracking_: "search",
7834
+ id_currently_querying_for_: get_search_query,
7835
+ no_results_options_: {
7836
+ selected_filters_: selected_filters_,
7837
+ expanded_hierarchical_filters_: expanded_hierarchical_filters_,
7838
+ local_filter_cache_: local_filter_cache_,
7839
+ i18n_: i18n_
7840
+ }
7630
7841
  });
7631
- }));
7632
- const [suggestions] = (0, $kyEB6$createResource)((0, $kyEB6$createMemo)(()=>({
7633
- query: search_query_[0](),
7634
- tenant: tenant_(),
7635
- market: market_()
7636
- })), (opts)=>depict_api_.suggest(opts));
7637
- const available_sortings_ = (0, $kyEB6$createMemo)(()=>search_results_()?.sorts?.map((sort)=>({
7638
- ...sort,
7639
- order: sort.order ?? "desc"
7640
- })));
7641
- const available_filters_ = (0, $kyEB6$createMemo)(()=>search_results_()?.filters);
7642
- const modal_body_style = (0, $kyEB6$createSignal)({});
7643
- let input_field;
7644
- if (include_input_field_) {
7645
- const SafeQueryInput = (0, $kyEB6$catchify)((0, $857105c41ea47bee$export$ff21851bb5d30e15));
7646
- input_field = (0, $kyEB6$createComponent)(SafeQueryInput, {
7842
+ }
7843
+ }), null);
7844
+ (0, $kyEB6$insert)(_el$3, (0, $kyEB6$createComponent)((0, $kyEB6$Show), {
7845
+ get when () {
7846
+ return get_all_products_loaded() && !disable_search_recommendations_;
7847
+ },
7848
+ keyed: false,
7849
+ get children () {
7850
+ return (0, $kyEB6$createComponent)((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
7851
+ severity_: "error",
7852
+ message_: "Search recommendations failed",
7853
+ get children () {
7854
+ return (0, $kyEB6$createComponent)((0, $172e1b898d457050$export$7de92c4c2205ebf3), {
7855
+ depict_api_: depict_api_,
7856
+ i18n_: i18n_,
7857
+ search_query_base_: search_query_base_,
7858
+ layout_options_: recommendations_layout_options_,
7859
+ showing_recommendation_rows_: showing_recommendation_rows_,
7860
+ rr_options_: recommendations_rr_options_,
7861
+ view_more_button_: search_recs_view_more_,
7862
+ tenant_object_: tenant_object_
7863
+ });
7864
+ }
7865
+ });
7866
+ }
7867
+ }), null);
7868
+ (0, $kyEB6$insert)(_el$2, (0, $kyEB6$createComponent)((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
7869
+ message_: "Scroll status failed",
7870
+ severity_: "error",
7871
+ get children () {
7872
+ return (0, $6db49ca163afa2c3$export$83fd5de5504a7a67)({
7873
+ first_result_in_viewport_: first_result_in_viewport_,
7874
+ last_result_in_viewport_: last_result_in_viewport_,
7875
+ formatted_number_of_results_: formatted_number_of_results_,
7647
7876
  i18n_: i18n_,
7648
- disabled_: true,
7649
- search_query_: search_query_,
7650
- search_field_value_: search_field_value_,
7651
- submit_query_: submit_query_,
7652
- clear_filters_: clear_filters_on_next_submit_
7877
+ number_of_results_: (0, $kyEB6$createMemo)(()=>search_results_()?.n_hits)
7653
7878
  });
7654
- if (input_field) {
7655
- opts?.modal_body_style_ref_?.(modal_body_style);
7656
- const align_position = (0, $kyEB6$catchify)((0, $b6d5529b253681aa$export$b3ad617e9036868))(modal_body_style, input_field, undefined, true);
7657
- input_field.addEventListener("click", (0, $kyEB6$catchify)((e)=>{
7658
- const target = e.target;
7659
- const sel = ".submit";
7660
- if (target?.matches?.(sel) || target?.closest?.(sel)) // the search button is just decor, don't do anything when clicked
7661
- return;
7662
- align_position?.();
7663
- open_modal_({
7664
- style_props_: modal_body_style
7665
- }, ()=>include_input_field_?.on_close_?.());
7666
- include_input_field_?.on_open_?.();
7667
- }));
7668
- }
7669
7879
  }
7670
- const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $kyEB6$createSignal)(false);
7671
- const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $kyEB6$createSignal)();
7672
- const formatted_number_of_results_ = (0, $511cc0abd9a64ce8$export$92f2da32c6e7e7ee)({
7673
- search_results_: search_results_,
7674
- i18n_: i18n_
7675
- });
7676
- const [sort_and_filter_element_, set_sort_and_filter_element_] = (0, $kyEB6$createSignal)();
7677
- const results_for = (0, $kyEB6$createComponent)((0, $f8c929beb82c512b$export$9dd50d35b9d94fdf), {
7678
- search_query_: search_query_,
7679
- i18n_: i18n_,
7680
- formatted_number_of_results_: formatted_number_of_results_
7681
- });
7682
- const filters_opener = (0, $cdea4cf8c5c071ef$export$d7841e452f2e59a8)({
7683
- set_sort_or_filter_open_: set_sort_or_filter_open_,
7684
- set_extra_els_in_results_container_: set_desktop_filter_elements,
7685
- i18n_: i18n_,
7686
- search_sorting_open_: search_sorting_open_,
7687
- available_filters_: available_filters_,
7688
- available_sortings_: available_sortings_,
7689
- search_filters_open_: search_filters_open_,
7690
- set_sort_and_filter_element_: set_sort_and_filter_element_,
7691
- current_sorting_: current_sorting_,
7692
- input_modal_open_: input_modal_open_,
7693
- expanded_filters_: expanded_filters_,
7694
- selected_filters_: selected_filters_,
7695
- formatted_number_of_results_: formatted_number_of_results_,
7696
- local_filter_cache_: local_filter_cache_,
7697
- expanded_hierarchical_filters_: expanded_hierarchical_filters_,
7698
- number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_
7699
- });
7700
- const results_filters = (0, $kyEB6$createSignal)();
7701
- (0, $kyEB6$onCleanup)((0, $kyEB6$javascript_media_query)("(max-width:600px)", async ({ matches: matches })=>{
7702
- results_filters[1]();
7703
- await new Promise((r)=>queueMicrotask(r));
7704
- results_filters[1](matches ? [
7705
- results_for,
7706
- filters_opener
7707
- ] : (()=>{
7708
- const _el$ = $7097477c78a89208$var$_tmpl$.cloneNode(true);
7709
- (0, $kyEB6$insert)(_el$, results_for, null);
7710
- (0, $kyEB6$insert)(_el$, filters_opener, null);
7711
- return _el$;
7712
- })());
7713
- }).remove);
7714
- (0, $kyEB6$catchify)((0, $641bba2917fe862b$export$6e49da55e449af7c))({
7715
- scroll_restoration_data_: scroll_restoration_data_,
7716
- last_result_in_viewport_: last_result_in_viewport_,
7717
- id_: get_search_query,
7718
- can_write_scroll_restoration_: can_write_scroll_restoration_
7719
- });
7720
- (0, $kyEB6$createComputed)(()=>{
7721
- if (search_results_.loading) set_can_write_scroll_restoration(false);
7722
- else if (search_results_()) set_can_write_scroll_restoration(true);
7723
- });
7724
- (0, $fc5a12f3a857ca30$export$e702733a056c40d6)({
7725
- selected_filters_: selected_filters_,
7726
- available_filters_: available_filters_
7727
- });
7728
- // @ts-ignore
7729
- if (process.env.GA !== "false") (0, $kyEB6$createEffect)(()=>{
7730
- get_search_query();
7731
- (0, $d78eea1e8707dc2d$export$c7e181728ad525f)(location);
7732
- });
7733
- (0, $kyEB6$createComputed)(()=>{
7734
- tenant_object_.tenant = tenant_object_.TENANT = tenant_();
7735
- tenant_object_.market = tenant_object_.MARKET = market_();
7736
- });
7737
- return [
7738
- document.createComment("Depict.ai frontend integrated search page"),
7739
- (()=>{
7740
- const _el$2 = $7097477c78a89208$var$_tmpl$2.cloneNode(true), _el$3 = _el$2.firstChild;
7741
- (0, $kyEB6$insert)(_el$3, input_field, null);
7742
- (0, $kyEB6$insert)(_el$3, make_category_suggestion_card_ ? (0, $kyEB6$createComponent)((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
7743
- severity_: "error",
7744
- message_: "Category suggestions failed",
7745
- get children () {
7746
- return (0, $kyEB6$createComponent)((0, $793905995512612d$export$c05a196222ba1302), {
7747
- selected_filters_: selected_filters_,
7748
- suggestions_: suggestions,
7749
- slider_arrow_button_: slider_arrow_button_,
7750
- children: make_category_suggestion_card_
7751
- });
7752
- }
7753
- }) : null, null);
7754
- (0, $kyEB6$insert)(_el$3, ()=>results_filters[0](), null);
7755
- (0, $kyEB6$insert)(_el$3, (0, $kyEB6$createComponent)((0, $kyEB6$Show), {
7756
- get when () {
7757
- return selected_filters_[0]()?.length;
7758
- },
7759
- keyed: false,
7760
- get children () {
7761
- return (0, $kyEB6$createComponent)((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
7762
- message_: "Selected filters failed",
7763
- severity_: "error",
7764
- get children () {
7765
- return (0, $1adfe60f3a14a1d7$export$fecbb157621501bd)({
7766
- i18n_: i18n_,
7767
- selected_filters_: selected_filters_,
7768
- local_filter_cache_: local_filter_cache_,
7769
- slider_arrow_button_: slider_arrow_button_,
7770
- search_filters_open_: search_filters_open_,
7771
- search_sorting_open_: search_sorting_open_,
7772
- number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_,
7773
- expanded_hierarchical_filters_: expanded_hierarchical_filters_
7774
- });
7775
- }
7776
- });
7777
- }
7778
- }), null);
7779
- (0, $kyEB6$insert)(_el$3, (0, $kyEB6$createComponent)((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
7780
- severity_: "error",
7781
- message_: "Search results failed",
7782
- get children () {
7783
- return (0, $2d25e42846eac370$export$3925f87b1545cfc6)({
7784
- all_products_loaded_: all_products_loaded_,
7785
- min_products_to_fetch_: min_products_to_fetch_,
7786
- query_base_: search_query_base_,
7787
- plp_results_: search_results_,
7788
- depict_api_: depict_api_,
7789
- first_result_in_viewport_: first_result_in_viewport_,
7790
- last_result_in_viewport_: last_result_in_viewport_,
7791
- scroll_restoration_data_: scroll_restoration_data_,
7792
- desktop_filter_elements_: desktop_filter_elements_,
7793
- rr_options_: rr_options_,
7794
- layout_options_: layout_options_,
7795
- sort_or_filter_open_: sort_or_filter_open_,
7796
- tenant_object_: tenant_object_,
7797
- type_for_tracking_: "search",
7798
- id_currently_querying_for_: get_search_query,
7799
- no_results_options_: {
7800
- selected_filters_: selected_filters_,
7801
- expanded_hierarchical_filters_: expanded_hierarchical_filters_,
7802
- local_filter_cache_: local_filter_cache_,
7803
- i18n_: i18n_
7804
- }
7805
- });
7806
- }
7807
- }), null);
7808
- (0, $kyEB6$insert)(_el$3, (0, $kyEB6$createComponent)((0, $kyEB6$Show), {
7809
- get when () {
7810
- return get_all_products_loaded() && !disable_search_recommendations_;
7811
- },
7812
- keyed: false,
7813
- get children () {
7814
- return (0, $kyEB6$createComponent)((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
7815
- severity_: "error",
7816
- message_: "Search recommendations failed",
7817
- get children () {
7818
- return (0, $kyEB6$createComponent)((0, $172e1b898d457050$export$7de92c4c2205ebf3), {
7819
- depict_api_: depict_api_,
7820
- i18n_: i18n_,
7821
- search_query_base_: search_query_base_,
7822
- layout_options_: recommendations_layout_options_,
7823
- showing_recommendation_rows_: showing_recommendation_rows_,
7824
- rr_options_: recommendations_rr_options_,
7825
- view_more_button_: search_recs_view_more_,
7826
- tenant_object_: tenant_object_
7827
- });
7828
- }
7829
- });
7830
- }
7831
- }), null);
7832
- (0, $kyEB6$insert)(_el$2, (0, $kyEB6$createComponent)((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
7833
- message_: "Scroll status failed",
7834
- severity_: "error",
7835
- get children () {
7836
- return (0, $6db49ca163afa2c3$export$83fd5de5504a7a67)({
7837
- first_result_in_viewport_: first_result_in_viewport_,
7838
- last_result_in_viewport_: last_result_in_viewport_,
7839
- formatted_number_of_results_: formatted_number_of_results_,
7840
- i18n_: i18n_,
7841
- number_of_results_: (0, $kyEB6$createMemo)(()=>search_results_()?.n_hits)
7842
- });
7843
- }
7844
- }), null);
7845
- (0, $kyEB6$insert)(_el$2, (0, $kyEB6$createComponent)((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
7846
- message_: "Floating buttons failed",
7847
- severity_: "error",
7848
- get children () {
7849
- return (0, $0b0380f75d729d63$export$b23abd26de154ede)({
7850
- search_filters_open_: search_filters_open_,
7851
- search_sorting_open_: search_sorting_open_,
7852
- current_sorting_: current_sorting_,
7853
- sort_and_filter_element_: sort_and_filter_element_,
7854
- i18n_: i18n_
7855
- });
7856
- }
7857
- }), null);
7858
- return _el$2;
7859
- })()
7860
- ];
7880
+ }), null);
7881
+ (0, $kyEB6$insert)(_el$2, (0, $kyEB6$createComponent)((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
7882
+ message_: "Floating buttons failed",
7883
+ severity_: "error",
7884
+ get children () {
7885
+ return (0, $0b0380f75d729d63$export$b23abd26de154ede)({
7886
+ search_filters_open_: search_filters_open_,
7887
+ search_sorting_open_: search_sorting_open_,
7888
+ current_sorting_: current_sorting_,
7889
+ sort_and_filter_element_: sort_and_filter_element_,
7890
+ i18n_: i18n_
7891
+ });
7892
+ }
7893
+ }), null);
7894
+ return _el$2;
7895
+ })()
7896
+ ];
7897
+ }
7898
+
7899
+
7900
+
7901
+
7902
+
7903
+
7904
+
7905
+
7906
+
7907
+
7908
+
7909
+
7910
+
7911
+ const $ba4105f38be0a8e0$var$_tmpl$ = /*#__PURE__*/ (0, $kyEB6$template)(`<span class="orig price"></span>`, 2), $ba4105f38be0a8e0$var$_tmpl$2 = /*#__PURE__*/ (0, $kyEB6$template)(`<a class="instant-card"><div class="img_part"></div><div class="right_part"><div class="title_brand"><span class="brand"></span><span class="title"></span></div><div class="price_container"><span class="price"></span></div></div></a>`, 16);
7912
+ function $ba4105f38be0a8e0$export$3b5becc25bbaed73(display, _index, get_fake_rendering_options, i18n_) {
7913
+ const image_url = (0, $kyEB6$createMemo)(()=>display().image_url);
7914
+ const contained_image = (0, $kyEB6$createMemo)(()=>(0, $kyEB6$ContainedImage)({
7915
+ aspect_ratio: 1,
7916
+ alt: "",
7917
+ // @ts-ignore
7918
+ "data-src": image_url(),
7919
+ rendering_options: (0, $kyEB6$untrack)(()=>get_fake_rendering_options()),
7920
+ srcset_opts: {
7921
+ set_dataset: true
7922
+ },
7923
+ init_with_placeholder: true
7924
+ }));
7925
+ const is_sale = (0, $kyEB6$createMemo)(()=>display().sale_price !== display().original_price);
7926
+ return (()=>{
7927
+ const _el$ = $ba4105f38be0a8e0$var$_tmpl$2.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild, _el$5 = _el$4.firstChild, _el$6 = _el$5.nextSibling, _el$7 = _el$4.nextSibling, _el$9 = _el$7.firstChild;
7928
+ (0, $kyEB6$insert)(_el$2, contained_image);
7929
+ (0, $kyEB6$insert)(_el$5, ()=>display().brand);
7930
+ (0, $kyEB6$insert)(_el$6, ()=>display().title);
7931
+ (0, $kyEB6$insert)(_el$7, (0, $kyEB6$createComponent)((0, $kyEB6$Show), {
7932
+ get when () {
7933
+ return is_sale();
7934
+ },
7935
+ get children () {
7936
+ const _el$8 = $ba4105f38be0a8e0$var$_tmpl$.cloneNode(true);
7937
+ (0, $kyEB6$insert)(_el$8, ()=>i18n_.price_formatting_().pre_, null);
7938
+ (0, $kyEB6$insert)(_el$8, ()=>(0, $8c0f86cb3e266eeb$export$469c7af753d08925)({
7939
+ price_: (0, $kyEB6$createMemo)(()=>display().original_price),
7940
+ price_formatting_: i18n_.price_formatting_
7941
+ }), null);
7942
+ (0, $kyEB6$insert)(_el$8, ()=>i18n_.price_formatting_().post_, null);
7943
+ return _el$8;
7861
7944
  }
7862
- })();
7863
- });
7945
+ }), _el$9);
7946
+ (0, $kyEB6$insert)(_el$9, ()=>i18n_.price_formatting_().pre_, null);
7947
+ (0, $kyEB6$insert)(_el$9, ()=>(0, $8c0f86cb3e266eeb$export$469c7af753d08925)({
7948
+ price_: (0, $kyEB6$createMemo)(()=>display().sale_price),
7949
+ price_formatting_: i18n_.price_formatting_
7950
+ }), null);
7951
+ (0, $kyEB6$insert)(_el$9, ()=>i18n_.price_formatting_().post_, null);
7952
+ (0, $kyEB6$effect)(()=>(0, $kyEB6$setAttribute)(_el$, "href", display().page_url));
7953
+ return _el$;
7954
+ })();
7955
+ }
7956
+
7957
+
7958
+
7959
+
7960
+
7961
+
7962
+
7963
+
7964
+
7965
+
7966
+
7967
+
7968
+
7969
+ const $897bd4a76f611b38$var$_tmpl$ = /*#__PURE__*/ (0, $kyEB6$template)(`<span class="parent_title"></span>`, 2), $897bd4a76f611b38$var$_tmpl$2 = /*#__PURE__*/ (0, $kyEB6$template)(`<a class="category-suggestion"><span class="title"></span></a>`, 4);
7970
+ function $897bd4a76f611b38$export$d757d54550ebfb3d({ category_suggestion_: category_suggestion_ , on_navigation_: on_navigation_ }) {
7971
+ return (()=>{
7972
+ const _el$ = $897bd4a76f611b38$var$_tmpl$2.cloneNode(true), _el$2 = _el$.firstChild;
7973
+ (0, $kyEB6$addEventListener)(_el$, "click", (0, $kyEB6$catchify)((e)=>{
7974
+ if (e.button || e.metaKey || e.ctrlKey) // Not single page navigating because button is not 0 or ctrl/command click
7975
+ return;
7976
+ return on_navigation_?.(category_suggestion_().page_url);
7977
+ }), true);
7978
+ (0, $kyEB6$insert)(_el$2, ()=>category_suggestion_().title);
7979
+ (0, $kyEB6$insert)(_el$, (0, $kyEB6$createComponent)((0, $kyEB6$Show), {
7980
+ get when () {
7981
+ return typeof category_suggestion_().parent_title === "string";
7982
+ },
7983
+ get children () {
7984
+ const _el$3 = $897bd4a76f611b38$var$_tmpl$.cloneNode(true);
7985
+ (0, $kyEB6$insert)(_el$3, ()=>category_suggestion_().parent_title);
7986
+ return _el$3;
7987
+ }
7988
+ }), null);
7989
+ (0, $kyEB6$effect)(()=>(0, $kyEB6$setAttribute)(_el$, "href", category_suggestion_().page_url));
7990
+ return _el$;
7991
+ })();
7864
7992
  }
7993
+ (0, $kyEB6$delegateEvents)([
7994
+ "click"
7995
+ ]);
7996
+
7865
7997
 
7998
+ const $b5cccc8ee7d24677$var$transform_elements = (sorted_cols_at_size)=>{
7999
+ const cols_at_size = [];
8000
+ for(let i = 0; i < sorted_cols_at_size.length; i++){
8001
+ const [nb_cols, width] = sorted_cols_at_size[i];
8002
+ const next_width = sorted_cols_at_size[i + 1]?.[1];
8003
+ const max_width = i === 0 ? "" : `${width}px`;
8004
+ const min_width = next_width !== undefined ? `${next_width + 1}px` : "";
8005
+ const col_at_size = [
8006
+ nb_cols,
8007
+ min_width,
8008
+ max_width
8009
+ ];
8010
+ cols_at_size.push(col_at_size);
8011
+ }
8012
+ return cols_at_size;
8013
+ };
8014
+ const $b5cccc8ee7d24677$export$6daf8749b65a1b77 = (cols_at_size)=>{
8015
+ // Check width duplicates
8016
+ const widths = cols_at_size.map(([_, width])=>width);
8017
+ const widths_set = new Set(widths);
8018
+ if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
8019
+ if (cols_at_size.length === 1) {
8020
+ const [nb_cols, width] = cols_at_size[0];
8021
+ const max_width = width !== undefined ? `${width}px` : "";
8022
+ return [
8023
+ [
8024
+ nb_cols,
8025
+ "",
8026
+ max_width
8027
+ ]
8028
+ ];
8029
+ }
8030
+ // Sort widths in ascending order
8031
+ const sorted_cols_at_size = cols_at_size.sort((a, b)=>{
8032
+ const [_b, width_A] = a;
8033
+ const [_a, width_b] = b;
8034
+ if (width_A === undefined) return -1;
8035
+ if (width_b === undefined) return 1;
8036
+ return width_b - width_A;
8037
+ });
8038
+ return $b5cccc8ee7d24677$var$transform_elements(sorted_cols_at_size);
8039
+ };
7866
8040
 
7867
8041
 
7868
8042
 
7869
- class $08b0dc201128ebbe$export$4b85d3515bd863a5 {
8043
+
8044
+ const $59f48be661ca9195$var$_tmpl$ = /*#__PURE__*/ (0, $kyEB6$template)(`<div class="depict plp search"></div>`, 2);
8045
+ /**
8046
+ * Type for the private properties that are shared between the different exported search SDK wrapper functions. SDK users are not allowed to change/access these, they're an internal implementation detail.
8047
+ */ const $59f48be661ca9195$var$privately_shared_properties = new WeakMap();
8048
+ const $59f48be661ca9195$var$min_products_to_fetch_ = 20;
8049
+ const $59f48be661ca9195$export$bde3eb976dfded9 = (depict_search)=>$59f48be661ca9195$var$privately_shared_properties.get(depict_search)?.search_query_updating_blocked_;
8050
+ class $59f48be661ca9195$export$ac6237957a15b3f0 {
7870
8051
  #locale_signal = (0, $kyEB6$createSignal)();
7871
- #tenant_signal = (0, $kyEB6$createSignal)();
8052
+ #merchant_signal = (0, $kyEB6$createSignal)();
7872
8053
  #market_signal = (0, $kyEB6$createSignal)();
7873
8054
  #modal_open_signal = (0, $kyEB6$createSignal)(false);
7874
- #constructor_options;
7875
- #query_input_opts;
7876
- #booted = false;
7877
8055
  static #has_been_constructed = false;
7878
- constructor(opts){
7879
- if ($08b0dc201128ebbe$export$4b85d3515bd863a5.#has_been_constructed) throw new Error("You can only have one instance of Search due to state limitations");
7880
- $08b0dc201128ebbe$export$4b85d3515bd863a5.#has_been_constructed = true;
7881
- this.#constructor_options = opts;
8056
+ constructor({ search_query_url_param_name: search_query_url_param_name = "search_query" , url_transformer: url_transformer , on_navigation: on_navigation , enable_category_suggestions: enable_category_suggestions = true , ...props_on_class }){
8057
+ if ($59f48be661ca9195$export$ac6237957a15b3f0.#has_been_constructed) throw new Error("You can only have one instance of DepictSearch");
8058
+ Object.assign(this, props_on_class);
8059
+ const alternative_query_submitter_for_spas_ = on_navigation && ((search_param_name, new_search_query, url_transformer)=>{
8060
+ const target_url = new URL(location.href);
8061
+ url_transformer?.(target_url);
8062
+ target_url.searchParams.set(search_param_name, new_search_query);
8063
+ on_navigation(target_url.href);
8064
+ });
8065
+ const [reset_history_state_, state_] = (0, $a8fa7302d6f93c0b$export$9862539c89138352)(()=>({
8066
+ search_field_value: new URLSearchParams(location.search).get(search_query_url_param_name) ?? "",
8067
+ search_sorting: undefined,
8068
+ search_filters_open: false,
8069
+ search_sorting_open: false,
8070
+ search_expanded_filters: [],
8071
+ // WARNING, it is insanely important, when creating the signals like this using make_resettable_history_state, that the two lines below are in *precisely that order*. The reason for that is that make_resettable_history_state will write the values of the signals in the order that they are written here when a "popstate" event occurs. If the filter cache is popped before the selected filters are the code in create_modified_filters() in FilterBody.tsx 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
8072
+ search_selected_filters: [],
8073
+ search_local_filter_cache: [],
8074
+ search_expanded_hierarchical_filters: [],
8075
+ search_showing_recommendation_rows: (0, $172e1b898d457050$export$1c8c715550dc689d),
8076
+ search_scroll_restoration_data: []
8077
+ }));
8078
+ const search_query_updating_blocked_ = (0, $kyEB6$createSignal)(false);
8079
+ const { [search_query_url_param_name]: raw_search_query_signal } = (0, $13e008d5237dbbee$export$2542ffb77b620b02)({
8080
+ [search_query_url_param_name]: ""
8081
+ });
8082
+ const search_query_signal_ = (0, $kyEB6$createSignal)((0, $kyEB6$untrack)(raw_search_query_signal[0]));
8083
+ const depict_api_ = new (0, $7fa23e2a0079eca4$export$e015ed2f2950f2e3)();
8084
+ const previous_searches = (0, $21f51c14cb3f586f$export$84bba84a7b837187)(search_query_signal_);
8085
+ const [, set_search_showing_recommendation_rows] = state_.search_showing_recommendation_rows;
8086
+ const after_submit_ = ()=>set_search_showing_recommendation_rows((0, $172e1b898d457050$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
8087
+ const configured_submit_query_ = ()=>(0, $bfd908d13d90934c$export$e16630ecb9644a1c)({
8088
+ on_submit_with_unchanged_value_: ()=>this.modal_open = false,
8089
+ search_field_value_: state_.search_field_value,
8090
+ search_query_: search_query_signal_,
8091
+ search_param_name_: search_query_url_param_name,
8092
+ url_transformer_: url_transformer,
8093
+ on_submit_: alternative_query_submitter_for_spas_,
8094
+ after_submit_: after_submit_
8095
+ });
8096
+ const i18n_ = Object.fromEntries(Object.keys((0, $kyEB6$untrack)(()=>this.localization)).map((key)=>[
8097
+ key,
8098
+ (0, $kyEB6$createMemo)(()=>this.localization[key])
8099
+ ]));
8100
+ const clear_filters_on_next_submit_ = (0, $48d7e4a9707315b6$export$e026af0c7b64ea5f)({
8101
+ selected_filters_: state_.search_selected_filters,
8102
+ search_query_: search_query_signal_,
8103
+ current_sorting_: state_.search_sorting,
8104
+ expanded_hierarchical_filters_: state_.search_expanded_hierarchical_filters,
8105
+ i18n_: i18n_,
8106
+ local_filter_cache_: state_.search_local_filter_cache
8107
+ });
8108
+ (0, $kyEB6$createComputed)(()=>{
8109
+ const [get_search_query_updating_blocked] = search_query_updating_blocked_;
8110
+ const [get_raw_search_query_signal] = raw_search_query_signal;
8111
+ const [, set_search_query_signal] = search_query_signal_; // this signal won't get written from anywhere, see url_params_to_signals JSDoc
8112
+ if (!get_search_query_updating_blocked()) set_search_query_signal(get_raw_search_query_signal());
8113
+ });
8114
+ $59f48be661ca9195$var$privately_shared_properties.set(this, {
8115
+ search_query_url_param_name_: search_query_url_param_name,
8116
+ reset_history_state_: reset_history_state_,
8117
+ state_: state_,
8118
+ on_navigation_: on_navigation,
8119
+ url_transformer_: url_transformer,
8120
+ depict_api_: depict_api_,
8121
+ enable_category_suggestions_: enable_category_suggestions,
8122
+ clear_filters_on_next_submit_: clear_filters_on_next_submit_,
8123
+ configured_submit_query_: configured_submit_query_,
8124
+ search_query_signal_: search_query_signal_,
8125
+ i18n_: i18n_,
8126
+ search_query_updating_blocked_: search_query_updating_blocked_
8127
+ });
7882
8128
  (0, $90980bd87c9960f9$export$5162a71f252e6122)();
8129
+ (0, $kyEB6$catchify)(async ()=>{
8130
+ const { open_modal_: open_modal_ , close_modal_: close_modal_ } = await (0, $194bd6b8e4c59830$export$79b1565500412d9b)((...args)=>{
8131
+ (0, $kyEB6$onCleanup)(()=>this.modal_open = false);
8132
+ return (0, $fabfda1230351b1a$export$1c593cbd6f1e10bc)(...args);
8133
+ }, {
8134
+ after_submit_: after_submit_,
8135
+ search_field_value_: state_.search_field_value,
8136
+ search_query_: search_query_signal_,
8137
+ search_page_url_param_name_: search_query_url_param_name,
8138
+ previous_searches_: previous_searches,
8139
+ depict_api_: depict_api_,
8140
+ tenant_: this.#merchant_signal[0],
8141
+ clear_filters_: clear_filters_on_next_submit_,
8142
+ market_: this.#market_signal[0],
8143
+ submit_query_: configured_submit_query_,
8144
+ alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_,
8145
+ url_transformer_: url_transformer,
8146
+ instant_results_options_: {
8147
+ min_products_to_fetch_: $59f48be661ca9195$var$min_products_to_fetch_,
8148
+ render_instant_card_: (0, $ba4105f38be0a8e0$export$3b5becc25bbaed73),
8149
+ render_instant_card_placeholder_: (0, $bb15dfb548a7666e$export$ee1733d9a8495996),
8150
+ has_sort_or_filters_: (0, $kyEB6$createMemo)(()=>!!(Object.keys(state_.search_selected_filters[0]())?.length || state_.search_sorting[0]()))
8151
+ },
8152
+ i18n_: i18n_,
8153
+ enable_category_suggestions_: enable_category_suggestions
8154
+ });
8155
+ // This will add some default behaviour to open_modal_ if no style_props_ are supplied
8156
+ // The default behaviour is to align the modal with the input field if possible
8157
+ (0, $kyEB6$createComputed)(()=>{
8158
+ const open_signal_value = this.modal_open;
8159
+ const signal_value_is_options = Array.isArray(open_signal_value);
8160
+ // Close modal if signal is false
8161
+ if (!open_signal_value) {
8162
+ close_modal_();
8163
+ return;
8164
+ }
8165
+ const { search_page_aligned_modal_body_style_signal_: search_page_aligned_modal_body_style_signal_ } = $59f48be661ca9195$var$privately_shared_properties.get(this);
8166
+ if (signal_value_is_options && open_signal_value[0]?.style_props_) {
8167
+ // They know what they're doing, just call the modal with the provided options
8168
+ open_modal_(...open_signal_value);
8169
+ return;
8170
+ }
8171
+ if (!open_signal_value[0]?.style_props_ && search_page_aligned_modal_body_style_signal_) {
8172
+ // Open modal aligned with search page if no alignment specified and possible to align with search page
8173
+ // TODO: nice to have: align with most visible SearchField if possible since that's always more desirable than centering
8174
+ if (!signal_value_is_options) {
8175
+ open_modal_({
8176
+ style_props_: search_page_aligned_modal_body_style_signal_
8177
+ });
8178
+ return;
8179
+ }
8180
+ const [options_arg, ...rest] = open_signal_value;
8181
+ open_modal_({
8182
+ ...options_arg,
8183
+ style_props_: search_page_aligned_modal_body_style_signal_
8184
+ }, ...rest);
8185
+ return;
8186
+ }
8187
+ // Open centered modal
8188
+ const supports_hover = (0, $dc9262ef6f786812$export$d9f36cf74e24d595)("(hover: hover) and (pointer: fine)");
8189
+ const slim = (0, $dc9262ef6f786812$export$d9f36cf74e24d595)("(max-width: 600px)");
8190
+ const desktop_short = (0, $dc9262ef6f786812$export$d9f36cf74e24d595)("(max-height: 790px)");
8191
+ const mobile_short = (0, $dc9262ef6f786812$export$d9f36cf74e24d595)("(max-height: 1000px)");
8192
+ const transform_x = (0, $kyEB6$createSignal)(false);
8193
+ const transform_y = (0, $kyEB6$createSignal)(false);
8194
+ const style_props_ = (0, $kyEB6$createSignal)({
8195
+ position: "fixed",
8196
+ top: "50%",
8197
+ left: "50%"
8198
+ });
8199
+ (0, $kyEB6$createComputed)(()=>transform_y[1](supports_hover() ? !desktop_short() : !mobile_short()));
8200
+ (0, $kyEB6$createComputed)(()=>transform_x[1](transform_y[0]() || !slim()));
8201
+ (0, $kyEB6$createComputed)(()=>style_props_[1]((old_value)=>({
8202
+ ...old_value,
8203
+ transform: transform_x[0]() && transform_y[0]() ? "translate(-50%,-50%)" : transform_x[0]() ? "translateX(-50%)" : transform_y[0]() ? "translateY(-50%)" : "unset"
8204
+ })));
8205
+ if (signal_value_is_options) {
8206
+ const [options_arg1, ...rest1] = open_signal_value;
8207
+ open_modal_({
8208
+ ...options_arg1,
8209
+ style_props_: search_page_aligned_modal_body_style_signal_
8210
+ }, ...rest1);
8211
+ return;
8212
+ }
8213
+ open_modal_({
8214
+ style_props_: style_props_
8215
+ });
8216
+ });
8217
+ })();
8218
+ $59f48be661ca9195$export$ac6237957a15b3f0.#has_been_constructed = true;
7883
8219
  }
7884
- get locale_() {
8220
+ get localization() {
7885
8221
  // allow reactive access
7886
8222
  return this.#locale_signal[0]();
7887
8223
  }
7888
- set locale_(locale_obj) {
8224
+ set localization(locale_obj) {
7889
8225
  this.#locale_signal[1](locale_obj);
7890
8226
  }
7891
- get readonly_modal_open_() {
8227
+ get modal_open() {
7892
8228
  return this.#modal_open_signal[0]();
7893
8229
  }
7894
- get tenant_() {
7895
- return this.#tenant_signal[0]();
8230
+ set modal_open(new_state) {
8231
+ this.#modal_open_signal[1](new_state);
7896
8232
  }
7897
- set tenant_(tenant) {
7898
- this.#tenant_signal[1](tenant);
8233
+ get merchant() {
8234
+ return this.#merchant_signal[0]();
7899
8235
  }
7900
- get market_() {
8236
+ set merchant(tenant) {
8237
+ this.#merchant_signal[1](tenant);
8238
+ }
8239
+ get market() {
7901
8240
  return this.#market_signal[0]();
7902
8241
  }
7903
- set market_(market) {
8242
+ set market(market) {
7904
8243
  this.#market_signal[1](market);
7905
8244
  }
7906
- get boot_() {
7907
- return (0, $kyEB6$catchify)(async ()=>{
7908
- if (!this.locale_) throw new Error("Can't start before locale is defined");
7909
- if (this.#booted) throw new Error("Already booted");
7910
- const search_query_url_param_name = this.#constructor_options.search_page_.search_query_param_name_ ?? "search_query";
7911
- let open_modal_;
7912
- let close_modal_;
7913
- const [reset_history_state, { search_field_value: search_field_value , search_sorting: search_sorting , search_filters_open: search_filters_open , search_sorting_open: search_sorting_open , search_expanded_filters: search_expanded_filters , search_local_filter_cache: search_local_filter_cache , search_selected_filters: search_selected_filters , search_expanded_hierarchical_filters: search_expanded_hierarchical_filters , search_showing_recommendation_rows: search_showing_recommendation_rows , search_scroll_restoration_data: search_scroll_restoration_data }] = (0, $a8fa7302d6f93c0b$export$9862539c89138352)(()=>({
7914
- search_field_value: new URLSearchParams(location.search).get(search_query_url_param_name) ?? "",
7915
- search_sorting: undefined,
7916
- search_filters_open: false,
7917
- search_sorting_open: false,
7918
- search_expanded_filters: [],
7919
- // WARNING, it is insanely important, when creating the signals like this using make_resettable_history_state, that the two lines below are in *precisely that order*. The reason for that is that make_resettable_history_state will write the values of the signals in the order that they are written here when a "popstate" event occurs. If the filter cache is popped before the selected filters are the code in create_modified_filters() in FilterBody.tsx 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
7920
- search_selected_filters: [],
7921
- search_local_filter_cache: [],
7922
- search_expanded_hierarchical_filters: [],
7923
- search_showing_recommendation_rows: (0, $172e1b898d457050$export$1c8c715550dc689d),
7924
- search_scroll_restoration_data: []
7925
- }));
7926
- const { [search_query_url_param_name]: search_query_signal } = (0, $13e008d5237dbbee$export$2542ffb77b620b02)({
7927
- [search_query_url_param_name]: ""
7928
- });
7929
- const previous_searches = (0, $21f51c14cb3f586f$export$84bba84a7b837187)(search_query_signal);
7930
- const [, set_search_showing_recommendation_rows] = search_showing_recommendation_rows;
7931
- const after_submit_ = ()=>set_search_showing_recommendation_rows((0, $172e1b898d457050$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
7932
- const configured_submit_query = ()=>(0, $bfd908d13d90934c$export$e16630ecb9644a1c)({
7933
- on_submit_with_unchanged_value_: ()=>close_modal_?.(),
7934
- search_field_value_: search_field_value,
7935
- search_query_: search_query_signal,
7936
- search_param_name_: search_query_url_param_name,
7937
- url_transformer_: this.#constructor_options.url_transformer_,
7938
- on_submit_: this.#constructor_options.alternative_query_submitter_for_spas_,
7939
- after_submit_: after_submit_
8245
+ }
8246
+ function $59f48be661ca9195$var$get_shared_properties(depict_search) {
8247
+ const shared_properties = $59f48be661ca9195$var$privately_shared_properties.get(depict_search);
8248
+ if (!shared_properties) throw new Error("Can't connect to provided DepictSearch instance");
8249
+ return shared_properties;
8250
+ }
8251
+ function $59f48be661ca9195$export$f2dc7e4e4aa11abb({ depict_search: depict_search , include_input_field: include_input_field , grid_spacing: grid_spacing , cols_at_size: cols_at_size , product_card_template: product_card_template , get_product_id: get_product_id = (0, $kyEB6$normal_get_product_id) }) {
8252
+ const shared_properties = $59f48be661ca9195$var$get_shared_properties(depict_search);
8253
+ return $59f48be661ca9195$var$run_in_root_or_auto_cleanup(()=>{
8254
+ const { state_: state_ } = shared_properties;
8255
+ (0, $kyEB6$onCleanup)(shared_properties.reset_history_state_);
8256
+ return (0, $7097477c78a89208$export$a54ec244c8863715)({
8257
+ input_modal_open_: ()=>!!depict_search.modal_open,
8258
+ tenant_: ()=>depict_search.merchant,
8259
+ market_: ()=>depict_search.market,
8260
+ depict_api_: shared_properties.depict_api_,
8261
+ min_products_to_fetch_: $59f48be661ca9195$var$min_products_to_fetch_,
8262
+ local_filter_cache_: state_.search_local_filter_cache,
8263
+ search_field_value_: state_.search_field_value,
8264
+ search_query_: shared_properties.search_query_signal_,
8265
+ clear_filters_on_next_submit_: shared_properties.clear_filters_on_next_submit_,
8266
+ open_modal_: (...args)=>depict_search.modal_open = args,
8267
+ submit_query_: shared_properties.configured_submit_query_,
8268
+ i18n_: shared_properties.i18n_,
8269
+ modal_body_style_ref_: (style)=>{
8270
+ const shared_info_right_now = $59f48be661ca9195$var$privately_shared_properties.get(depict_search);
8271
+ if (!shared_info_right_now) return;
8272
+ $59f48be661ca9195$var$privately_shared_properties.set(depict_search, {
8273
+ ...shared_info_right_now,
8274
+ search_page_aligned_modal_body_style_signal_: style
7940
8275
  });
7941
- const i18n_ = Object.fromEntries(Object.keys((0, $kyEB6$untrack)(()=>this.locale_)).map((key)=>[
7942
- key,
7943
- (0, $kyEB6$createMemo)(()=>this.locale_[key])
7944
- ]));
7945
- const min_products_to_fetch_ = 20;
7946
- const [input_modal_open, set_input_model_open] = this.#modal_open_signal;
7947
- const clear_filters_on_next_submit_ = (0, $48d7e4a9707315b6$export$e026af0c7b64ea5f)({
7948
- selected_filters_: search_selected_filters,
7949
- search_query_: search_query_signal,
7950
- current_sorting_: search_sorting,
7951
- expanded_hierarchical_filters_: search_expanded_hierarchical_filters,
7952
- i18n_: i18n_,
7953
- local_filter_cache_: search_local_filter_cache
7954
- });
7955
- let modal_body_style;
7956
- const search_page_options = this.#constructor_options.search_page_;
7957
- const pr = new (0, $753e9b2889a47c89$export$3ccaa27d81dd8556)({
7958
- is_page_: search_page_options.is_search_page_,
7959
- title_: search_page_options.page_title_,
7960
- selector_: search_page_options.selector_for_page_to_replace_,
7961
- append_instead_of_replace_: search_page_options.append_instead_of_replace_,
7962
- render_: ()=>{
7963
- const rendered_page = (0, $7097477c78a89208$export$a54ec244c8863715)({
7964
- ...search_page_options,
7965
- input_modal_open_: input_modal_open,
7966
- tenant_: this.#tenant_signal[0],
7967
- market_: this.#market_signal[0],
7968
- depict_api_: this.#constructor_options.depict_api_,
7969
- page_replacer_: pr,
7970
- min_products_to_fetch_: min_products_to_fetch_,
7971
- local_filter_cache_: search_local_filter_cache,
7972
- search_field_value_: search_field_value,
7973
- search_query_: search_query_signal,
7974
- clear_filters_on_next_submit_: clear_filters_on_next_submit_,
7975
- open_modal_: (...args)=>open_modal_?.(...args),
7976
- submit_query_: configured_submit_query,
7977
- i18n_: i18n_,
7978
- modal_body_style_ref_: (style)=>modal_body_style = style,
7979
- current_sorting_: search_sorting,
7980
- search_filters_open_: search_filters_open,
7981
- search_sorting_open_: search_sorting_open,
7982
- expanded_filters_: search_expanded_filters,
7983
- make_category_suggestion_card_: this.#constructor_options.enable_category_suggestions_ ?? true ? search_page_options.make_category_suggestion_card_ : false,
7984
- expanded_hierarchical_filters_: search_expanded_hierarchical_filters,
7985
- selected_filters_: search_selected_filters,
7986
- showing_recommendation_rows_: search_showing_recommendation_rows,
7987
- scroll_restoration_data_: search_scroll_restoration_data
8276
+ (0, $kyEB6$onCleanup)(()=>{
8277
+ const shared_info_right_now = $59f48be661ca9195$var$privately_shared_properties.get(depict_search);
8278
+ if (!shared_info_right_now || shared_info_right_now.search_page_aligned_modal_body_style_signal_ !== style) return;
8279
+ $59f48be661ca9195$var$privately_shared_properties.set(depict_search, {
8280
+ ...shared_info_right_now,
8281
+ search_page_aligned_modal_body_style_signal_: undefined
7988
8282
  });
7989
- return search_page_options.wrap_search_page_?.(rendered_page) || rendered_page;
8283
+ });
8284
+ },
8285
+ current_sorting_: state_.search_sorting,
8286
+ search_filters_open_: state_.search_filters_open,
8287
+ search_sorting_open_: state_.search_sorting_open,
8288
+ expanded_filters_: state_.search_expanded_filters,
8289
+ make_category_suggestion_card_: shared_properties.enable_category_suggestions_ ? (category_suggestion_)=>{
8290
+ return (0, $897bd4a76f611b38$export$d757d54550ebfb3d)({
8291
+ category_suggestion_: category_suggestion_,
8292
+ on_navigation_: shared_properties.on_navigation_
8293
+ });
8294
+ } : false,
8295
+ expanded_hierarchical_filters_: state_.search_expanded_hierarchical_filters,
8296
+ selected_filters_: state_.search_selected_filters,
8297
+ showing_recommendation_rows_: state_.search_showing_recommendation_rows,
8298
+ scroll_restoration_data_: state_.search_scroll_restoration_data,
8299
+ include_input_field_: include_input_field,
8300
+ layout_options_: {
8301
+ cols_at_size: (0, $b5cccc8ee7d24677$export$6daf8749b65a1b77)(cols_at_size),
8302
+ ...typeof grid_spacing === "string" ? {
8303
+ grid_spacing: grid_spacing
8304
+ } : {
8305
+ override_vertical_spacing: grid_spacing.vertical,
8306
+ grid_spacing: grid_spacing.horizontal
7990
8307
  }
7991
- });
7992
- pr.addEventListener("close", (0, $kyEB6$catchify)(reset_history_state)); // when closing search page, reset everything
7993
- this.#constructor_options.page_replacer_ref_?.(pr);
7994
- const modal_options = this.#constructor_options.modal_options_;
7995
- ({ open_modal_: open_modal_ , close_modal_: close_modal_ } = await (0, $194bd6b8e4c59830$export$79b1565500412d9b)((...args)=>{
7996
- set_input_model_open(true);
7997
- (0, $kyEB6$onCleanup)(()=>set_input_model_open(false));
7998
- return (0, $fabfda1230351b1a$export$1c593cbd6f1e10bc)(...args);
7999
- }, {
8000
- after_submit_: after_submit_,
8001
- search_field_value_: search_field_value,
8002
- search_query_: search_query_signal,
8003
- search_page_url_param_name_: search_query_url_param_name,
8004
- previous_searches_: previous_searches,
8005
- depict_api_: this.#constructor_options.depict_api_,
8006
- tenant_: this.#tenant_signal[0],
8007
- clear_filters_: clear_filters_on_next_submit_,
8008
- market_: this.#market_signal[0],
8009
- submit_query_: configured_submit_query,
8010
- alternative_query_submitter_for_spas_: this.#constructor_options.alternative_query_submitter_for_spas_,
8011
- url_transformer_: this.#constructor_options.url_transformer_,
8012
- instant_results_options_: {
8013
- min_products_to_fetch_: min_products_to_fetch_,
8014
- render_instant_card_: modal_options.render_instant_card_,
8015
- render_instant_card_placeholder_: modal_options.render_instant_card_placeholder_,
8016
- has_sort_or_filters_: (0, $kyEB6$createMemo)(()=>!!(Object.keys(search_selected_filters[0]())?.length || search_sorting[0]()))
8017
- },
8018
- i18n_: i18n_,
8019
- disable_scrolling_: modal_options.disable_scrolling_,
8020
- enable_category_suggestions_: this.#constructor_options.enable_category_suggestions_,
8021
- bottom_distance_under_modal_: modal_options.bottom_distance_under_modal_
8022
- }));
8023
- this.#query_input_opts = {
8024
- search_query_: search_query_signal,
8025
- search_field_value_: search_field_value,
8026
- submit_query_: configured_submit_query,
8027
- clear_filters_: clear_filters_on_next_submit_,
8028
- i18n_: i18n_
8029
- };
8030
- this.#booted = true;
8031
- // This will add some default behaviour to open_modal_ if no style_props_ are supplied
8032
- // The default behaviour is to align the modal with the input field if possible
8033
- const wrapped_open_modal = (...args)=>{
8034
- if (!args[0].style_props_ && modal_body_style) return open_modal_({
8035
- ...args[0],
8036
- style_props_: modal_body_style
8037
- }, ...args.slice(1) // Not sure I can tell TypeScript that these are the rest of the arguments
8038
- );
8039
- else return open_modal_(...args);
8040
- };
8041
- return {
8042
- close_modal_: close_modal_,
8043
- open_modal_: wrapped_open_modal
8044
- };
8308
+ },
8309
+ slider_arrow_button_: (0, $kyEB6$GenericSliderArrowButton)({
8310
+ height_: 12,
8311
+ width_: 6.46
8312
+ }),
8313
+ rr_options_: {
8314
+ template: product_card_template
8315
+ },
8316
+ get_product_id_: get_product_id
8045
8317
  });
8046
- }
8047
- get get_query_input() {
8048
- return (opts = {})=>{
8049
- if (!this.#booted) throw new Error("Instance not booted");
8050
- return (0, $857105c41ea47bee$export$ff21851bb5d30e15)({
8051
- disabled_: true,
8052
- ...opts,
8053
- ...this.#query_input_opts
8054
- });
8055
- };
8056
- }
8318
+ }, "Entire SearchPage failed");
8319
+ }
8320
+ function $59f48be661ca9195$export$b94867ecbd698f21({ depict_search: depict_search , modal_dispose_handler: modal_dispose_handler }) {
8321
+ const shared_properties = $59f48be661ca9195$var$get_shared_properties(depict_search);
8322
+ return $59f48be661ca9195$var$run_in_root_or_auto_cleanup(()=>{
8323
+ const input = (0, $kyEB6$createComponent)((0, $857105c41ea47bee$export$ff21851bb5d30e15), {
8324
+ get search_query_ () {
8325
+ return shared_properties.search_query_signal_;
8326
+ },
8327
+ get search_field_value_ () {
8328
+ return shared_properties.state_.search_field_value;
8329
+ },
8330
+ get submit_query_ () {
8331
+ return shared_properties.configured_submit_query_;
8332
+ },
8333
+ get clear_filters_ () {
8334
+ return shared_properties.clear_filters_on_next_submit_;
8335
+ },
8336
+ get i18n_ () {
8337
+ return shared_properties.i18n_;
8338
+ },
8339
+ disabled_: true,
8340
+ field_element_ref_: (field)=>{
8341
+ const handler = (0, $kyEB6$catchify)(()=>{
8342
+ depict_search.modal_open = [
8343
+ {
8344
+ style_props_: style_props_
8345
+ },
8346
+ modal_dispose_handler
8347
+ ];
8348
+ });
8349
+ field.addEventListener("click", handler);
8350
+ (0, $kyEB6$onCleanup)(()=>field.removeEventListener("click", handler));
8351
+ }
8352
+ });
8353
+ const style_props_ = (0, $kyEB6$createSignal)({
8354
+ position: "fixed"
8355
+ });
8356
+ (0, $b6d5529b253681aa$export$b3ad617e9036868)(style_props_, input);
8357
+ return [
8358
+ (()=>{
8359
+ const _el$ = $59f48be661ca9195$var$_tmpl$.cloneNode(true);
8360
+ (0, $kyEB6$insert)(_el$, input);
8361
+ return _el$;
8362
+ })()
8363
+ ];
8364
+ }, "SearchField failed");
8365
+ }
8366
+ function $59f48be661ca9195$var$run_in_root_or_auto_cleanup(component, error_message) {
8367
+ const component_in_error_boundary = (do_with_elements)=>{
8368
+ return (0, $b7436a6d1fd64e3b$export$b69d0d92862de18b)({
8369
+ severity_: "error",
8370
+ message_: error_message,
8371
+ get children () {
8372
+ const elements = component();
8373
+ do_with_elements?.(elements);
8374
+ return elements;
8375
+ }
8376
+ })();
8377
+ };
8378
+ const owner = (0, $kyEB6$getOwner)();
8379
+ if (owner == null) return (0, $kyEB6$createRoot)((dispose)=>{
8380
+ // if we're not already run in a root, create a root and automatically dispose it when the first returned element is removed from the DOM
8381
+ return component_in_error_boundary((elements)=>{
8382
+ if (!elements?.length) return;
8383
+ (0, $kyEB6$observer).onremoved(elements[0], dispose);
8384
+ });
8385
+ });
8386
+ else // we're already in a root so cleanups are handled
8387
+ return component_in_error_boundary();
8057
8388
  }
8058
8389
 
8059
8390
 
8060
8391
 
8061
8392
 
8062
- export {$e4615ecd1849548f$export$b91cec6bdc6b32a1 as CategoryTitle, $a79d86d64fb64e8e$export$824dde41348efed1 as embedded_num_products, $7fa23e2a0079eca4$export$e015ed2f2950f2e3 as DepictAPI, $bf52d9f9eebd1938$export$5196e4c01fa56fcb as show_toast, $d1d4dbcadcf4cb02$export$26df08e242fe83a3 as push_state_with_query_param_value, $aea1edf92433e81e$export$fe334901e8bebd57 as disable_scrolling, $5c5f95951393e5d1$export$643598a327b5833e as get_categories, $bb15dfb548a7666e$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $dc9262ef6f786812$export$d9f36cf74e24d595 as media_query_to_accessor, $6e8944558258054f$export$d0596b5cae35ad4 as open_search_with_shift_slash, $b6d5529b253681aa$export$b3ad617e9036868 as align_field, $6936724b9e0b98d5$export$689e204eadb33baf as setup_fast_leave, $2e7dbdfa682bea45$export$93916862db74da11 as czech_category_translation, $2e7dbdfa682bea45$export$62ef558576ddaf3d as czech_search_translation, $88b98b9d8654446d$export$70578856b2420b5d as danish_search_translation, $88b98b9d8654446d$export$f816e22bdb8038e1 as danish_category_translation, $45ff89a5006dbeee$export$e6614b50d36f30aa as dutch_category_translation, $45ff89a5006dbeee$export$5d14584e27bf4bc5 as dutch_search_translation, $8e57f28e9b8ba103$export$434b5d2e9cbbcde1 as english_search_translation, $8e57f28e9b8ba103$export$61b15fe6451cdba0 as english_category_translation, $17bb4bc19a558158$export$bf7930000f7ad633 as finnish_category_translation, $17bb4bc19a558158$export$bb9c5e11b9203620 as finnish_search_translation, $8f244ab97fceb5b3$export$ef75fbff2e809c9 as french_category_translation, $8f244ab97fceb5b3$export$e608b2bb21ba1862 as french_search_translation, $52d8525a7f06f813$export$f1905e1353ecf78e as german_category_translation, $52d8525a7f06f813$export$b43a5e72c07b4d2a as german_search_translation, $af10c927f9d40ee9$export$3812cbf78064c3ab as italian_category_translation, $af10c927f9d40ee9$export$c05550c0848a3fe4 as italian_search_translation, $b6fc9ca373acfd8e$export$e3024c30c728ef08 as norwegian_category_translation, $b6fc9ca373acfd8e$export$dcb702a89633f297 as norwegian_search_translation, $02d28687f3e70797$export$ca594fc9015508ad as polish_category_translation, $02d28687f3e70797$export$b0eb0dd41442f532 as polish_search_translation, $f6f89421463e8473$export$b3b5aa2c4df8976f as portuguese_search_translation, $f6f89421463e8473$export$d8290cf1bac152ab as portuguese_category_translation, $eb8757bc61f65db5$export$40e5a8a77e52bc27 as spanish_category_translation, $eb8757bc61f65db5$export$49b8f20513f0ff25 as spanish_search_translation, $ee9ca02aebefa7e4$export$7ba4dc17618f444f as swedish_category_translation, $ee9ca02aebefa7e4$export$596caee559c76764 as swedish_search_translation, $8c0f86cb3e266eeb$export$469c7af753d08925 as solid_format_price, $753e9b2889a47c89$export$3ccaa27d81dd8556 as PageReplacer, $a0f0a70198583479$export$3a8840c5b2ecf003 as Category, $08b0dc201128ebbe$export$4b85d3515bd863a5 as Search};
8393
+ export {$e4615ecd1849548f$export$b91cec6bdc6b32a1 as CategoryTitle, $a79d86d64fb64e8e$export$824dde41348efed1 as embedded_num_products, $7fa23e2a0079eca4$export$e015ed2f2950f2e3 as DepictAPI, $bf52d9f9eebd1938$export$5196e4c01fa56fcb as show_toast, $d1d4dbcadcf4cb02$export$26df08e242fe83a3 as push_state_with_query_param_value, $aea1edf92433e81e$export$fe334901e8bebd57 as disable_scrolling, $5c5f95951393e5d1$export$643598a327b5833e as get_categories, $bb15dfb548a7666e$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $dc9262ef6f786812$export$d9f36cf74e24d595 as media_query_to_accessor, $6e8944558258054f$export$d0596b5cae35ad4 as open_search_with_shift_slash, $b6d5529b253681aa$export$b3ad617e9036868 as align_field, $6936724b9e0b98d5$export$689e204eadb33baf as setup_fast_leave, $2e7dbdfa682bea45$export$93916862db74da11 as czech_category_translation, $2e7dbdfa682bea45$export$62ef558576ddaf3d as czech_search_translation, $88b98b9d8654446d$export$70578856b2420b5d as danish_search_translation, $88b98b9d8654446d$export$f816e22bdb8038e1 as danish_category_translation, $45ff89a5006dbeee$export$e6614b50d36f30aa as dutch_category_translation, $45ff89a5006dbeee$export$5d14584e27bf4bc5 as dutch_search_translation, $8e57f28e9b8ba103$export$434b5d2e9cbbcde1 as english_search_translation, $8e57f28e9b8ba103$export$61b15fe6451cdba0 as english_category_translation, $17bb4bc19a558158$export$bf7930000f7ad633 as finnish_category_translation, $17bb4bc19a558158$export$bb9c5e11b9203620 as finnish_search_translation, $8f244ab97fceb5b3$export$ef75fbff2e809c9 as french_category_translation, $8f244ab97fceb5b3$export$e608b2bb21ba1862 as french_search_translation, $52d8525a7f06f813$export$f1905e1353ecf78e as german_category_translation, $52d8525a7f06f813$export$b43a5e72c07b4d2a as german_search_translation, $af10c927f9d40ee9$export$3812cbf78064c3ab as italian_category_translation, $af10c927f9d40ee9$export$c05550c0848a3fe4 as italian_search_translation, $b6fc9ca373acfd8e$export$e3024c30c728ef08 as norwegian_category_translation, $b6fc9ca373acfd8e$export$dcb702a89633f297 as norwegian_search_translation, $02d28687f3e70797$export$ca594fc9015508ad as polish_category_translation, $02d28687f3e70797$export$b0eb0dd41442f532 as polish_search_translation, $f6f89421463e8473$export$b3b5aa2c4df8976f as portuguese_search_translation, $f6f89421463e8473$export$d8290cf1bac152ab as portuguese_category_translation, $eb8757bc61f65db5$export$40e5a8a77e52bc27 as spanish_category_translation, $eb8757bc61f65db5$export$49b8f20513f0ff25 as spanish_search_translation, $ee9ca02aebefa7e4$export$7ba4dc17618f444f as swedish_category_translation, $ee9ca02aebefa7e4$export$596caee559c76764 as swedish_search_translation, $8c0f86cb3e266eeb$export$469c7af753d08925 as solid_format_price, $753e9b2889a47c89$export$3ccaa27d81dd8556 as PageReplacer, $9653a36120f642b0$export$3a8840c5b2ecf003 as Category, $59f48be661ca9195$export$ac6237957a15b3f0 as DepictSearch, $59f48be661ca9195$export$f2dc7e4e4aa11abb as SearchPage, $59f48be661ca9195$export$b94867ecbd698f21 as SearchField, $59f48be661ca9195$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal};