@depict-ai/ui 1.4.22 → 1.4.24

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/latest/index.js CHANGED
@@ -1,11 +1,639 @@
1
- import { add_to_version_info as $9HbP8$add_to_version_info, catchify as $9HbP8$catchify, is_safari as $9HbP8$is_safari, report as $9HbP8$report, observer as $9HbP8$observer, useExpandingContainer as $9HbP8$useExpandingContainer, standard_price_format as $9HbP8$standard_price_format, Amazing_Slider as $9HbP8$Amazing_Slider, slider_snap_css as $9HbP8$slider_snap_css, slider_fading_factory as $9HbP8$slider_fading_factory, make_random_classname as $9HbP8$make_random_classname, dlog as $9HbP8$dlog, hex_to_rgb as $9HbP8$hex_to_rgb, relative_luminance_from_rgb as $9HbP8$relative_luminance_from_rgb, javascript_media_query as $9HbP8$javascript_media_query, n_col_styling_with_dist as $9HbP8$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $9HbP8$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $9HbP8$layout_get_total_rec_amount_for_row, layout_media_query_header as $9HbP8$layout_media_query_header, fetch_recs as $9HbP8$fetch_recs, snakeCasifyObject as $9HbP8$snakeCasifyObject, instant_exec_on_suspect_history_change as $9HbP8$instant_exec_on_suspect_history_change, base_url as $9HbP8$base_url, get_depict_id as $9HbP8$get_depict_id, get_user_id as $9HbP8$get_user_id, get_session_id as $9HbP8$get_session_id, sort_obj as $9HbP8$sort_obj, fetch_retry as $9HbP8$fetch_retry, add_version_query_params as $9HbP8$add_version_query_params, dwarn as $9HbP8$dwarn, make_url_with_query_params as $9HbP8$make_url_with_query_params, edit_current_page_meta_tags as $9HbP8$edit_current_page_meta_tags, use_href_accessor as $9HbP8$use_href_accessor, base64_encode_unicode as $9HbP8$base64_encode_unicode, base64_decode_unicode as $9HbP8$base64_decode_unicode, queueMacroTask as $9HbP8$queueMacroTask, is_debug as $9HbP8$is_debug, make_asyncIterable_exiter as $9HbP8$make_asyncIterable_exiter, href_change_ipns as $9HbP8$href_change_ipns, ContainedImage as $9HbP8$ContainedImage, buildThresholdList as $9HbP8$buildThresholdList, deparallelize_no_drop as $9HbP8$deparallelize_no_drop, insert_surfaces as $9HbP8$insert_surfaces } from "@depict-ai/utilishared/latest";
2
- import { template as $9HbP8$template, getNextElement as $9HbP8$getNextElement, spread as $9HbP8$spread, mergeProps as $9HbP8$mergeProps, runHydrationEvents as $9HbP8$runHydrationEvents, effect as $9HbP8$effect, style as $9HbP8$style, insert as $9HbP8$insert, classList as $9HbP8$classList, createComponent as $9HbP8$createComponent, getNextMarker as $9HbP8$getNextMarker, addEventListener as $9HbP8$addEventListener, memo as $9HbP8$memo, delegateEvents as $9HbP8$delegateEvents, setAttribute as $9HbP8$setAttribute, Dynamic as $9HbP8$Dynamic, use as $9HbP8$use, className as $9HbP8$className, isServer as $9HbP8$isServer } from "solid-js/web";
3
- import { createSignal as $9HbP8$createSignal, onCleanup as $9HbP8$onCleanup, ErrorBoundary as $9HbP8$ErrorBoundary, createMemo as $9HbP8$createMemo, untrack as $9HbP8$untrack, createEffect as $9HbP8$createEffect, getOwner as $9HbP8$getOwner, Show as $9HbP8$Show, runWithOwner as $9HbP8$runWithOwner, Index as $9HbP8$Index, createRoot as $9HbP8$createRoot, on as $9HbP8$on, For as $9HbP8$For, createRenderEffect as $9HbP8$createRenderEffect, createComputed as $9HbP8$createComputed, batch as $9HbP8$batch, createResource as $9HbP8$createResource, createReaction as $9HbP8$createReaction, Suspense as $9HbP8$Suspense } from "solid-js";
1
+ import { add_to_version_info as $9HbP8$add_to_version_info, make_random_classname as $9HbP8$make_random_classname, n_col_styling_with_dist as $9HbP8$n_col_styling_with_dist, catchify as $9HbP8$catchify, layout_get_visible_recs_without_partial_rows as $9HbP8$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $9HbP8$layout_get_total_rec_amount_for_row, layout_media_query_header as $9HbP8$layout_media_query_header, report as $9HbP8$report, Amazing_Slider as $9HbP8$Amazing_Slider, slider_snap_css as $9HbP8$slider_snap_css, slider_fading_factory as $9HbP8$slider_fading_factory, is_safari as $9HbP8$is_safari, observer as $9HbP8$observer, useExpandingContainer as $9HbP8$useExpandingContainer, standard_price_format as $9HbP8$standard_price_format, dlog as $9HbP8$dlog, hex_to_rgb as $9HbP8$hex_to_rgb, relative_luminance_from_rgb as $9HbP8$relative_luminance_from_rgb, javascript_media_query as $9HbP8$javascript_media_query, fetch_recs as $9HbP8$fetch_recs, snakeCasifyObject as $9HbP8$snakeCasifyObject, instant_exec_on_suspect_history_change as $9HbP8$instant_exec_on_suspect_history_change, base_url as $9HbP8$base_url, get_depict_id as $9HbP8$get_depict_id, get_user_id as $9HbP8$get_user_id, get_session_id as $9HbP8$get_session_id, sort_obj as $9HbP8$sort_obj, fetch_retry as $9HbP8$fetch_retry, add_version_query_params as $9HbP8$add_version_query_params, dwarn as $9HbP8$dwarn, make_url_with_query_params as $9HbP8$make_url_with_query_params, edit_current_page_meta_tags as $9HbP8$edit_current_page_meta_tags, use_href_accessor as $9HbP8$use_href_accessor, base64_encode_unicode as $9HbP8$base64_encode_unicode, base64_decode_unicode as $9HbP8$base64_decode_unicode, queueMacroTask as $9HbP8$queueMacroTask, is_debug as $9HbP8$is_debug, make_asyncIterable_exiter as $9HbP8$make_asyncIterable_exiter, href_change_ipns as $9HbP8$href_change_ipns, ContainedImage as $9HbP8$ContainedImage, buildThresholdList as $9HbP8$buildThresholdList, deparallelize_no_drop as $9HbP8$deparallelize_no_drop, insert_surfaces as $9HbP8$insert_surfaces } from "@depict-ai/utilishared/latest";
2
+ import { template as $9HbP8$template, getNextElement as $9HbP8$getNextElement, insert as $9HbP8$insert, createComponent as $9HbP8$createComponent, mergeProps as $9HbP8$mergeProps, isServer as $9HbP8$isServer, spread as $9HbP8$spread, runHydrationEvents as $9HbP8$runHydrationEvents, addEventListener as $9HbP8$addEventListener, className as $9HbP8$className, memo as $9HbP8$memo, delegateEvents as $9HbP8$delegateEvents, effect as $9HbP8$effect, classList as $9HbP8$classList, setAttribute as $9HbP8$setAttribute, getNextMarker as $9HbP8$getNextMarker, style as $9HbP8$style, Dynamic as $9HbP8$Dynamic, use as $9HbP8$use } from "solid-js/web";
3
+ import { createMemo as $9HbP8$createMemo, createResource as $9HbP8$createResource, Suspense as $9HbP8$Suspense, Show as $9HbP8$Show, createSignal as $9HbP8$createSignal, createRenderEffect as $9HbP8$createRenderEffect, createRoot as $9HbP8$createRoot, onCleanup as $9HbP8$onCleanup, For as $9HbP8$For, getOwner as $9HbP8$getOwner, runWithOwner as $9HbP8$runWithOwner, createEffect as $9HbP8$createEffect, untrack as $9HbP8$untrack, createComputed as $9HbP8$createComputed, ErrorBoundary as $9HbP8$ErrorBoundary, Index as $9HbP8$Index, on as $9HbP8$on, batch as $9HbP8$batch, createReaction as $9HbP8$createReaction } from "solid-js";
4
+ import { slider_fractional_factory as $9HbP8$slider_fractional_factory } from "@depict-ai/utilishared/latest/latest";
4
5
 
5
6
  /*! Depict.ai search and product listing SDK */
6
7
  import { register_es_version } from "../multi_import_deduplicator.mjs";
7
8
  register_es_version("ui", "latest");
8
- const $ec291e0010116877$export$83d89fbfd8236492 = "1.4.22";
9
+ const $ec291e0010116877$export$83d89fbfd8236492 = "1.4.24";
10
+ const $b5cccc8ee7d24677$var$transform_elements = sorted_cols_at_size => {
11
+ const cols_at_size = [];
12
+ for (let i = 0; i < sorted_cols_at_size.length; i++) {
13
+ const [nb_cols, width] = sorted_cols_at_size[i];
14
+ const next_width = sorted_cols_at_size[i + 1]?.[1];
15
+ const max_width = i === 0 ? "" : `${width}px`;
16
+ const min_width = next_width !== undefined ? `${next_width + 1}px` : "";
17
+ const col_at_size = [nb_cols, min_width, max_width];
18
+ cols_at_size.push(col_at_size);
19
+ }
20
+ return cols_at_size;
21
+ };
22
+ const $b5cccc8ee7d24677$export$6daf8749b65a1b77 = cols_at_size => {
23
+ // Check that every element is an array
24
+ const are_arrays = cols_at_size.every(element => Array.isArray(element));
25
+ if (!are_arrays) throw new Error("Every element in cols_at_size must be an array");
26
+ // Check width duplicates
27
+ const widths = cols_at_size.map(([_, width]) => width);
28
+ const widths_set = new Set(widths);
29
+ if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
30
+ if (cols_at_size.length === 1) {
31
+ const [nb_cols, width] = cols_at_size[0];
32
+ const max_width = width !== undefined ? `${width}px` : "";
33
+ return [[nb_cols, "", max_width]];
34
+ }
35
+ // Sort widths in ascending order
36
+ const sorted_cols_at_size = [...cols_at_size].sort((a, b) => {
37
+ const [_b, width_A] = a;
38
+ const [_a, width_b] = b;
39
+ if (width_A === undefined) return -1;
40
+ if (width_b === undefined) return 1;
41
+ return width_b - width_A;
42
+ });
43
+ return $b5cccc8ee7d24677$var$transform_elements(sorted_cols_at_size);
44
+ };
45
+
46
+ /**
47
+ * Content results ContentCard look stupid on mobile if there are two columns of them, so we limit the number of columns to 1 if the screen is too small
48
+ */
49
+ function $1848f7cca286fbab$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_for_more_than_one_column = 500) {
50
+ if (!sdk_cols_at_size.length) return sdk_cols_at_size;
51
+ const sorted_sizes = sdk_cols_at_size.map(([cols, max_width]) => [cols, max_width ?? Infinity]).sort(([, a], [, b]) => a - b);
52
+ const [[, smallest_max_width]] = sorted_sizes;
53
+ if (smallest_max_width > min_width_for_more_than_one_column)
54
+ // If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
55
+ return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
56
+ const to_delete = [];
57
+ for (let i = 0; i < sorted_sizes.length; i++) {
58
+ const [, max_width] = sorted_sizes[i];
59
+ if (max_width > min_width_for_more_than_one_column) continue;
60
+ to_delete.push(i);
61
+ }
62
+ while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
63
+ sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
64
+ return sorted_sizes.map(([cols, max_width]) => max_width == Infinity ? [cols] : [cols, max_width]);
65
+ }
66
+ function $a458486f22b22f63$export$a2cc176055f8f08() {
67
+ const text = "Please try setting `colsAtSize` on the `SearchPage`/`CategoryPage` components to change the grid before setting it with CSS. If you do with CSS, set `ColsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
68
+ return (0, $9HbP8$isServer) ? `<!-- ${text} -->` : document.createComment(text);
69
+ }
70
+ function $a52235d12ccf9c88$export$2f0cbfbb4354bb52(elements) {
71
+ // FYI this probably doesn't work on hugely deep nestings or large amount of elements
72
+ return $9HbP8$createMemo(() => $a52235d12ccf9c88$var$unwrapping_helper(elements));
73
+ }
74
+ function $a52235d12ccf9c88$var$unwrapping_helper(elements) {
75
+ const result = [];
76
+ if (Array.isArray(elements)) for (let i = 0; i < elements.length; i++) {
77
+ const element = elements[i];
78
+ result.push(...$a52235d12ccf9c88$var$unwrapping_helper(element));
79
+ } else if (typeof elements == "function") result.push(...$a52235d12ccf9c88$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
80
+ return result;
81
+ }
82
+ let $6e41f1fde994db72$var$cached_placeholder_element;
83
+ let $6e41f1fde994db72$var$rendering_cached_placeholder_element;
84
+ function $6e41f1fde994db72$export$f33414a4df0afd3f({
85
+ product_card_template_: product_card_template_,
86
+ num_placeholders_: num_placeholders_
87
+ }) {
88
+ const [get_elements, set_elements] = $9HbP8$createSignal([]);
89
+ let existing_num = 0;
90
+ if (0, $9HbP8$isServer)
91
+ // want to render simple placeholders on server, effects don't run there
92
+ return $9HbP8$createMemo(() => Array.from({
93
+ length: num_placeholders_()
94
+ }).map(() => {
95
+ const template_result = product_card_template_(null, undefined);
96
+ // @ts-ignore
97
+ if (typeof template_result?.then !== "function") return template_result;
98
+ }));
99
+ $9HbP8$createRenderEffect(() => {
100
+ const to_add = num_placeholders_() - existing_num;
101
+ if (to_add <= 0) return;
102
+ // Below comment is from when we used recommendation renderer and manual DOM manipulation for this, but I'm still scared to remove placeholders and mess up scroll restoration, so I'm keeping the way it worked. Otherwise, <Index> could be used which would be far more elegant.
103
+ // We don't need to remove placeholders, only need to add. The reason for that is that chrome restores the scroll position once all tasks queued as reaction of the "popstate" events have been completed in the task queue. That means that we need to get the placeholders in fast, or we might lose scroll position if the previous site was shorter.
104
+ // The query id and the amount might update in separate tasks because one comes from href_change_ipns and the other one from another "popstate" listener. Therefore, we need to be able to dynamically add more placeholders. I'm not entirely sure about this anymore though, since we have the scroll position on a per-id basis it might work anyway but THIS WORKS, and I've been working on this bug for 3 hours so let's just keep it this way.
105
+ set_elements(prev => [...prev, ...Array.from({
106
+ length: to_add
107
+ }).map(() => $6e41f1fde994db72$var$Placeholder({
108
+ product_card_template_: product_card_template_
109
+ }))]);
110
+ existing_num += to_add;
111
+ });
112
+ return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
113
+ }
114
+ /**
115
+ * Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
116
+ */
117
+ function $6e41f1fde994db72$var$Placeholder({
118
+ product_card_template_: product_card_template_
119
+ }) {
120
+ const get_cloned_placeholders = (element_to_clone = $6e41f1fde994db72$var$cached_placeholder_element) => Array.isArray(element_to_clone) ? element_to_clone.map(el => el instanceof Node ? el.cloneNode(true) : el) : element_to_clone;
121
+ if ($6e41f1fde994db72$var$cached_placeholder_element) return get_cloned_placeholders();
122
+ let dispose_original_copy;
123
+ const get_unwrapped_element = $9HbP8$createRoot(dispose => {
124
+ dispose_original_copy = dispose;
125
+ // if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
126
+ const [resource] = $9HbP8$createResource(() => {
127
+ if ($6e41f1fde994db72$var$rendering_cached_placeholder_element) return $6e41f1fde994db72$var$rendering_cached_placeholder_element;
128
+ const return_value = product_card_template_(null, undefined);
129
+ if (typeof return_value === "object" && typeof return_value?.then === "function")
130
+ // Is Promise or promise-like object
131
+ $6e41f1fde994db72$var$rendering_cached_placeholder_element = return_value;
132
+ return return_value;
133
+ });
134
+ return $9HbP8$createMemo(() => {
135
+ if (resource.loading) return () => [];
136
+ return $a52235d12ccf9c88$export$2f0cbfbb4354bb52(resource);
137
+ });
138
+ });
139
+ $9HbP8$onCleanup(() => {
140
+ if ($6e41f1fde994db72$var$rendering_cached_placeholder_element) {
141
+ // If we're still rendering in our separate root, let the rendering finish or other <Placeholder> components waiting for it might get an incomplete result
142
+ const unset_current_rendering = () => {
143
+ dispose_original_copy();
144
+ $6e41f1fde994db72$var$rendering_cached_placeholder_element = undefined;
145
+ };
146
+ $6e41f1fde994db72$var$rendering_cached_placeholder_element?.then(unset_current_rendering, unset_current_rendering);
147
+ } else
148
+ // Otherwise, just make sure we've disposed our root
149
+ dispose_original_copy();
150
+ });
151
+ return $9HbP8$createMemo(() => {
152
+ const unwrapped_array = get_unwrapped_element()();
153
+ if (!unwrapped_array?.length || !unwrapped_array.every(item => item))
154
+ // Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
155
+ return;
156
+ // placeholders have finished rendering, freeze the elements
157
+ // 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
158
+ $6e41f1fde994db72$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
159
+ $6e41f1fde994db72$var$rendering_cached_placeholder_element = undefined;
160
+ dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
161
+ 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
162
+ });
163
+ }
164
+
165
+ /**
166
+ * Gets product_id (the thing we key the rendering on) from a display
167
+ */
168
+ function $16351e4c87b90b3d$export$548d053aba053d79(display) {
169
+ if ("variant_index" in display) {
170
+ const actual_display = display.variant_displays[display.variant_index];
171
+ return actual_display.product_id;
172
+ }
173
+ return display.product_id;
174
+ }
175
+ function $29ec7cddbe1d3484$export$7f8bd308237ab5a5(get_displays_) {
176
+ const displays_by_key_ = $9HbP8$createMemo(() => {
177
+ const displays = get_displays_();
178
+ // We key by product_id because that's what can be used to uniquely identify products
179
+ // This way <For> can optimize the rendering
180
+ const map = new Map();
181
+ for (let i = 0; i < displays.length; i++) {
182
+ const display = displays[i];
183
+ const product_id = $16351e4c87b90b3d$export$548d053aba053d79(display);
184
+ map.set(product_id, display);
185
+ }
186
+ return map;
187
+ });
188
+ return displays_by_key_;
189
+ }
190
+ function $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
191
+ displays_by_key_: displays_by_key_,
192
+ merchant_: merchant_,
193
+ market_: market_,
194
+ product_card_template_: product_card_template_,
195
+ do_per_elements_: do_per_elements_
196
+ }) {
197
+ return $9HbP8$createComponent((0, $9HbP8$For), {
198
+ get each() {
199
+ return [...displays_by_key_().keys()];
200
+ },
201
+ children: (product_id, index) => {
202
+ const owner = $9HbP8$getOwner();
203
+ const display_accessor = $9HbP8$createMemo(() => displays_by_key_().get(product_id));
204
+ const [product_card_resource] = $9HbP8$createResource(display_accessor,
205
+ // re-render when the reference to the display object changes
206
+ // this should only be the case when the merchant or market changes and the new request has completed
207
+ display => {
208
+ // get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
209
+ return product_card_template_(display, {
210
+ set_on_index_change: fn => $9HbP8$runWithOwner(owner, () => $9HbP8$createEffect(() => fn(index()))),
211
+ merchant: $9HbP8$untrack(merchant_),
212
+ // this means that the merchant and market provided to the template is wrong while we do another fetch, but I don't see how anyone would need to know the correct market there
213
+ market: $9HbP8$untrack(market_) // recommendation_grid can provide a sneaky undefined here just FYI
214
+ });
215
+ });
216
+
217
+ const node_accessor = $a52235d12ccf9c88$export$2f0cbfbb4354bb52(product_card_resource);
218
+ $9HbP8$createEffect(() => {
219
+ const product_card_nodes = node_accessor();
220
+ const display = display_accessor();
221
+ const elements = [];
222
+ for (let i = 0; i < product_card_nodes.length; i++) {
223
+ const element = product_card_nodes[i];
224
+ if (!(element instanceof Element)) continue;
225
+ elements.push(element);
226
+ // Add tracking ids
227
+ if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
228
+ const {
229
+ dataset: dataset
230
+ } = element;
231
+ const {
232
+ search_result_id: search_result_id,
233
+ product_listing_result_id: product_listing_result_id,
234
+ recommendation_id: recommendation_id
235
+ } = display;
236
+ if (search_result_id) dataset.searchResultId = search_result_id;else if (product_listing_result_id) dataset.productListingResultId = product_listing_result_id;else if (recommendation_id) dataset.recommendationId = recommendation_id;
237
+ }
238
+ do_per_elements_?.(elements, index);
239
+ });
240
+ return product_card_resource; // https://github.com/solidjs/solid/releases/tag/v1.7.0
241
+ }
242
+ });
243
+ }
244
+
245
+ // Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
246
+ class $4fd48cb976bf1789$export$e1d52e4f0c7557a1 extends Error {}
247
+ class $4fd48cb976bf1789$export$aa14a9f43128f61f extends $4fd48cb976bf1789$export$e1d52e4f0c7557a1 {
248
+ constructor(templateError) {
249
+ super("Uncaught error in product card template", {
250
+ cause: templateError
251
+ });
252
+ }
253
+ }
254
+ const $b7436a6d1fd64e3b$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div></div>`, 2);
255
+ function $b7436a6d1fd64e3b$export$b69d0d92862de18b(props) {
256
+ return $9HbP8$ErrorBoundary({
257
+ fallback(err, retry) {
258
+ const {
259
+ message_: message_,
260
+ severity_: severity_
261
+ } = props;
262
+ let message = message_;
263
+ if (err instanceof (0, $4fd48cb976bf1789$export$aa14a9f43128f61f)) {
264
+ console.error(err.cause);
265
+ message = `${message}: ${err.message}`;
266
+ } else $9HbP8$report([err, message_], severity_);
267
+ props.on_error_?.(retry);
268
+ return (() => {
269
+ const _el$ = $9HbP8$getNextElement($b7436a6d1fd64e3b$var$_tmpl$);
270
+ $9HbP8$insert(_el$, message);
271
+ $9HbP8$effect(_$p => $9HbP8$classList(_el$, Object.fromEntries(props.class_list_?.map(c => [c, true]) || []), _$p));
272
+ return _el$;
273
+ })();
274
+ },
275
+ get children() {
276
+ return props.children;
277
+ }
278
+ });
279
+ }
280
+ const $c8d5ff4524619fcd$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div></div>`, 2),
281
+ $c8d5ff4524619fcd$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<style type="text/css"></style>`, 2);
282
+ function $c8d5ff4524619fcd$export$d21e32dfedac04be(props) {
283
+ const container_element_ = (() => {
284
+ const _el$ = $9HbP8$getNextElement($c8d5ff4524619fcd$var$_tmpl$);
285
+ $9HbP8$spread(_el$, $9HbP8$mergeProps(() => props.element_attributes), false, true);
286
+ $9HbP8$insert(_el$, () => props.children);
287
+ $9HbP8$runHydrationEvents();
288
+ return _el$;
289
+ })(); // Don't want this in the error boundary below, it should only be for the actual layouting
290
+ return $9HbP8$createComponent((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
291
+ get message_() {
292
+ return "Failed calculating " + props.layout + " layout";
293
+ },
294
+ severity_: "error",
295
+ get children() {
296
+ return $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, container_element_);
297
+ }
298
+ });
299
+ }
300
+ function $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, container_element, insert_after_container = false) {
301
+ // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
302
+ const show_all_rows = $9HbP8$createMemo(() => props.rows === "all");
303
+ const rows_or_empty_object = $9HbP8$createMemo(() => show_all_rows() ? {} : props.rows);
304
+ const view_more_button_elements = $a52235d12ccf9c88$export$2f0cbfbb4354bb52($9HbP8$createMemo(() => rows_or_empty_object().button));
305
+ const view_less_button_elements = $a52235d12ccf9c88$export$2f0cbfbb4354bb52($9HbP8$createMemo(() => rows_or_empty_object().view_less_button));
306
+ const have_a_view_more_button = $9HbP8$createMemo(() => {
307
+ const button = view_more_button_elements();
308
+ return !(!button || Array.isArray(button) && !button.length);
309
+ });
310
+ const have_a_view_less_button = $9HbP8$createMemo(() => {
311
+ const button = view_less_button_elements();
312
+ return !(!button || Array.isArray(button) && !button.length);
313
+ });
314
+ const [get_styling, set_styling] = $9HbP8$createSignal();
315
+ const container_class = $9HbP8$make_random_classname();
316
+ const selector_beginning = `.depict .${container_class}>`; // class so ppl can have id if needed
317
+ const [get_children_count, set_children_count] = $9HbP8$createSignal(0);
318
+ const update_children_count = () => set_children_count(container_element.children.length);
319
+ const col_styling = $9HbP8$createMemo(() => $9HbP8$n_col_styling_with_dist(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
320
+ const default_currently_visible_signal = $9HbP8$createSignal($9HbP8$untrack(() => rows_or_empty_object().start_rows ?? 1)); // Keep this signal here, so it doesn't change when rows_or_empty_object and I think it's to be expected that the "internal default signal" stays the same
321
+ const rows_visible_signal = $9HbP8$createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
322
+ const get_rows_visible = $9HbP8$createMemo(() => rows_visible_signal()[0]());
323
+ const set_rows_visible = $9HbP8$createMemo(() => rows_visible_signal()[1]);
324
+ const view_more_button_class = $9HbP8$make_random_classname();
325
+ const view_less_button_class = $9HbP8$make_random_classname();
326
+ const style_element = (() => {
327
+ const _el$2 = $9HbP8$getNextElement($c8d5ff4524619fcd$var$_tmpl$2);
328
+ $9HbP8$insert(_el$2, get_styling);
329
+ return _el$2;
330
+ })();
331
+ const view_more_button_container = $9HbP8$createMemo(() => have_a_view_more_button() && (() => {
332
+ const _el$3 = $9HbP8$getNextElement($c8d5ff4524619fcd$var$_tmpl$);
333
+ $9HbP8$addEventListener(_el$3, "click", $9HbP8$catchify(() => set_rows_visible()(prev => prev + (rows_or_empty_object().rows_per_click ?? 1))), true);
334
+ $9HbP8$className(_el$3, `load-more-container ${view_more_button_class}`);
335
+ $9HbP8$insert(_el$3, () => rows_or_empty_object().button);
336
+ $9HbP8$runHydrationEvents();
337
+ return _el$3;
338
+ })());
339
+ // We need to have duplicate buttons because which ones is shown depends on the number of rows visible and therefore on the viewport size and therefore on the css media queries
340
+ const view_less_button_container = $9HbP8$createMemo(() => have_a_view_less_button() && (() => {
341
+ const _el$4 = $9HbP8$getNextElement($c8d5ff4524619fcd$var$_tmpl$);
342
+ $9HbP8$addEventListener(_el$4, "click", $9HbP8$catchify(() => set_rows_visible()(() => rows_or_empty_object().start_rows ?? 1)), true);
343
+ $9HbP8$className(_el$4, `load-less-container ${view_less_button_class}`);
344
+ $9HbP8$insert(_el$4, () => rows_or_empty_object().view_less_button);
345
+ $9HbP8$runHydrationEvents();
346
+ return _el$4;
347
+ })());
348
+ container_element.classList.add(container_class);
349
+ $9HbP8$createComputed(() => {
350
+ // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
351
+ const rows_visible = get_rows_visible();
352
+ const max_rows = rows_or_empty_object().max_rows;
353
+ if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
354
+ });
355
+ $9HbP8$createRenderEffect(() => {
356
+ // Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
357
+ if (show_all_rows()) {
358
+ // no view more functionality requested
359
+ set_styling(() => col_styling);
360
+ return;
361
+ }
362
+ update_children_count();
363
+ const mutation_observer = new MutationObserver($9HbP8$catchify(update_children_count));
364
+ mutation_observer.observe(container_element, {
365
+ childList: true
366
+ });
367
+ $9HbP8$onCleanup(() => mutation_observer.disconnect());
368
+ set_styling(
369
+ // this is needed because solid will think that the memo-accessor is a setter function otherwise
370
+ () => $9HbP8$createMemo(() => {
371
+ const {
372
+ rows_per_click: rows_per_click,
373
+ max_rows = -1,
374
+ start_rows: start_rows
375
+ } = rows_or_empty_object();
376
+ const rows_visible = get_rows_visible();
377
+ const children_count = get_children_count();
378
+ return col_styling() + props.cols_at_size.map(options => {
379
+ const [recs_per_row, min, max] = options;
380
+ let should_hide_view_more_button;
381
+ let visible_recs;
382
+ if (props.disable_partial_rows) {
383
+ visible_recs = $9HbP8$layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
384
+ const visible_recs_next_show_more = $9HbP8$layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
385
+ // Should this really be zero when we default rows_per_click to 1?
386
+ children_count, options);
387
+ should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
388
+ } else {
389
+ visible_recs = $9HbP8$layout_get_total_rec_amount_for_row(rows_visible, options);
390
+ should_hide_view_more_button = visible_recs >= children_count;
391
+ }
392
+ const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
393
+ // I don't really understand the logic for when the view more button gets hidden so IDK if below is correct, but it works how it should for now
394
+ const should_hide_view_less_button = !should_hide_view_more_button || start_rows == undefined || rows_visible <= start_rows || children_count <= recs_per_row * start_rows;
395
+ return `${$9HbP8$layout_media_query_header(min, max)}{${selector_beginning}:nth-child(n+${visible_recs + 1}){display:none}${props.layout == "slider" ? `${selector_beginning}:nth-child(n+${visible_recs}){margin-right:0}` : ""}${should_hide_button_final ? `.depict .${view_more_button_class}{display:none!important}` : ``}${should_hide_view_less_button ? `.depict .${view_less_button_class}{display:none!important}` : ``}}`;
396
+ }).join("");
397
+ }));
398
+ });
399
+ if (insert_after_container) container_element.after(style_element);
400
+ return [container_element, $9HbP8$memo(view_more_button_container), $9HbP8$memo(view_less_button_container), style_element];
401
+ }
402
+ $9HbP8$delegateEvents(["click"]);
403
+ const $fbbadcb080ad1d4a$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0" fill="#0f0f0f"></path></svg>`, 4);
404
+ function $fbbadcb080ad1d4a$export$8be2714ec7f169ee(props = {}) {
405
+ return (() => {
406
+ const _el$ = $9HbP8$getNextElement($fbbadcb080ad1d4a$var$_tmpl$);
407
+ $9HbP8$effect(_p$ => {
408
+ const _v$ = props.width_ ?? 14,
409
+ _v$2 = props.height_ ?? 26;
410
+ _v$ !== _p$._v$ && $9HbP8$setAttribute(_el$, "width", _p$._v$ = _v$);
411
+ _v$2 !== _p$._v$2 && $9HbP8$setAttribute(_el$, "height", _p$._v$2 = _v$2);
412
+ return _p$;
413
+ }, {
414
+ _v$: undefined,
415
+ _v$2: undefined
416
+ });
417
+ return _el$;
418
+ })();
419
+ }
420
+ const $f32e14878e75af51$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div></div>`, 2);
421
+ function $f32e14878e75af51$export$6649caad96ef8870({
422
+ children: children,
423
+ slider_ref_: slider_ref_,
424
+ faded_opacity_ = 0.7,
425
+ mutation_plugins_ = [],
426
+ disable_fading_: disable_fading_
427
+ }) {
428
+ const slider = new (0, $9HbP8$Amazing_Slider)({
429
+ button_contents: {
430
+ left: [(() => {
431
+ const _el$ = $9HbP8$getNextElement($f32e14878e75af51$var$_tmpl$);
432
+ $9HbP8$insert(_el$, $9HbP8$createComponent((0, $fbbadcb080ad1d4a$export$8be2714ec7f169ee), {}));
433
+ return _el$;
434
+ })()],
435
+ right: [(() => {
436
+ const _el$2 = $9HbP8$getNextElement($f32e14878e75af51$var$_tmpl$);
437
+ $9HbP8$insert(_el$2, $9HbP8$createComponent((0, $fbbadcb080ad1d4a$export$8be2714ec7f169ee), {}));
438
+ return _el$2;
439
+ })()]
440
+ },
441
+ constructor_plugins: [$9HbP8$slider_snap_css().constructor_plugin],
442
+ mutation_plugins: [...(disable_fading_ ? [] : [$9HbP8$slider_fading_factory({
443
+ threshold_: 0.96,
444
+ faded_opacity_: faded_opacity_
445
+ }).mutation_plugin_]), ...mutation_plugins_]
446
+ });
447
+ $9HbP8$insert(slider.insert_here, children);
448
+ $9HbP8$onCleanup(() => slider.observer.disconnect());
449
+ slider_ref_?.(slider);
450
+ return slider.container;
451
+ }
452
+ function $c4492d24952ed731$export$d41d19e89346fa2({
453
+ recommendations_resource_: recommendations_resource_,
454
+ product_card_template_: product_card_template_,
455
+ layout_options_: layout_options_,
456
+ merchant_: merchant_,
457
+ market_: market_
458
+ }) {
459
+ const is_showing_something = $9HbP8$createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
460
+ const num_placeholders_ = () => 20;
461
+ const slider = $9HbP8$createComponent((0, $f32e14878e75af51$export$6649caad96ef8870), {
462
+ disable_fading_: true,
463
+ slider_ref_: slider => {
464
+ const {
465
+ insert_here: insert_here
466
+ } = slider;
467
+ const Layout = props => $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, insert_here, true);
468
+ // Do like this, so we don't have to call mergeProps ourselves
469
+ $9HbP8$createComponent(Layout, $9HbP8$mergeProps({
470
+ rows: "all",
471
+ layout: "slider"
472
+ }, layout_options_));
473
+ $9HbP8$slider_fractional_factory(0, 0.75).constructor_plugin.call(slider, {}); // enable fractional scrolling
474
+ insert_here.before($a458486f22b22f63$export$a2cc176055f8f08());
475
+ },
476
+ get children() {
477
+ return $9HbP8$createComponent((0, $9HbP8$Suspense), {
478
+ get fallback() {
479
+ return $6e41f1fde994db72$export$f33414a4df0afd3f({
480
+ num_placeholders_: num_placeholders_,
481
+ product_card_template_: product_card_template_
482
+ });
483
+ },
484
+ get children() {
485
+ return (() => {
486
+ // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
487
+ const displays_by_key_ = $29ec7cddbe1d3484$export$7f8bd308237ab5a5($9HbP8$createMemo(() => recommendations_resource_() || []));
488
+ return $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
489
+ displays_by_key_: displays_by_key_,
490
+ merchant_: merchant_,
491
+ market_: market_,
492
+ product_card_template_: product_card_template_
493
+ });
494
+ })();
495
+ }
496
+ });
497
+ }
498
+ });
499
+ return $9HbP8$createComponent((0, $9HbP8$Show), {
500
+ get when() {
501
+ return is_showing_something();
502
+ },
503
+ children: slider
504
+ });
505
+ }
506
+ const $ee116da074deb002$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class="depict recommendations"></div>`, 2);
507
+ function $ee116da074deb002$export$9574e176201e5e8d(props) {
508
+ const grid_spacing_override = $9HbP8$createMemo(() => {
509
+ const {
510
+ grid_spacing: grid_spacing
511
+ } = props; // can be reactive
512
+ return typeof grid_spacing === "string" ? {
513
+ grid_spacing: grid_spacing
514
+ } : {
515
+ override_vertical_spacing: grid_spacing.vertical,
516
+ grid_spacing: grid_spacing.horizontal
517
+ };
518
+ });
519
+ const [recommendations_resource_] = $9HbP8$createResource(() => props.recommendations, recs => recs);
520
+ return (() => {
521
+ const _el$ = $9HbP8$getNextElement($ee116da074deb002$var$_tmpl$);
522
+ $9HbP8$insert(_el$, () => $c4492d24952ed731$export$d41d19e89346fa2({
523
+ product_card_template_: (...args) => props.product_card_template(...args),
524
+ recommendations_resource_: recommendations_resource_,
525
+ market_: () => props.market,
526
+ merchant_: () => props.merchant,
527
+ layout_options_: $9HbP8$createMemo(() => ({
528
+ cols_at_size: $b5cccc8ee7d24677$export$6daf8749b65a1b77($1848f7cca286fbab$export$ff7109b9b2b206ba(props.cols_at_size)),
529
+ ...grid_spacing_override()
530
+ }))
531
+ }));
532
+ return _el$;
533
+ })();
534
+ }
535
+ const $3da8afe3ed57cf34$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class="recommendation-grid"><!#><!/><!#><!/></div>`, 6);
536
+ function $3da8afe3ed57cf34$export$7da560f849543dff({
537
+ recommendations_resource_: recommendations_resource_,
538
+ product_card_template_: product_card_template_,
539
+ layout_options_: layout_options_,
540
+ merchant_: merchant_,
541
+ market_: market_,
542
+ rows_object_: rows_object_
543
+ }) {
544
+ const is_showing_something = $9HbP8$createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
545
+ const num_placeholders_ = () => 20;
546
+ return $9HbP8$createComponent((0, $9HbP8$Show), {
547
+ get when() {
548
+ return is_showing_something();
549
+ },
550
+ get children() {
551
+ const _el$ = $9HbP8$getNextElement($3da8afe3ed57cf34$var$_tmpl$),
552
+ _el$2 = _el$.firstChild,
553
+ [_el$3, _co$] = $9HbP8$getNextMarker(_el$2.nextSibling),
554
+ _el$4 = _el$3.nextSibling,
555
+ [_el$5, _co$2] = $9HbP8$getNextMarker(_el$4.nextSibling);
556
+ $9HbP8$insert(_el$, (0, $a458486f22b22f63$export$a2cc176055f8f08), _el$3, _co$);
557
+ $9HbP8$insert(_el$, $9HbP8$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), $9HbP8$mergeProps({
558
+ get rows() {
559
+ return rows_object_();
560
+ },
561
+ layout: "grid",
562
+ element_attributes: {
563
+ class: "cards"
564
+ }
565
+ }, layout_options_, {
566
+ get children() {
567
+ return $9HbP8$createComponent((0, $9HbP8$Suspense), {
568
+ get fallback() {
569
+ return $6e41f1fde994db72$export$f33414a4df0afd3f({
570
+ num_placeholders_: num_placeholders_,
571
+ product_card_template_: product_card_template_
572
+ });
573
+ },
574
+ get children() {
575
+ return (() => {
576
+ // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
577
+ const displays_by_key_ = $29ec7cddbe1d3484$export$7f8bd308237ab5a5($9HbP8$createMemo(() => recommendations_resource_() || []));
578
+ return $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
579
+ displays_by_key_: displays_by_key_,
580
+ merchant_: merchant_,
581
+ market_: market_,
582
+ product_card_template_: product_card_template_
583
+ });
584
+ })();
585
+ }
586
+ });
587
+ }
588
+ })), _el$5, _co$2);
589
+ return _el$;
590
+ }
591
+ });
592
+ }
593
+ const $9ea5383493360761$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<button class="show-more major" type="button"></button>`, 2),
594
+ $9ea5383493360761$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<div class="depict plp recommendations"></div>`, 2);
595
+ function $9ea5383493360761$export$9756467d34d91cdb(props) {
596
+ const rows_object_ = $9HbP8$createMemo(() => {
597
+ const view_more_button = props.view_more_button;
598
+ if (!view_more_button) return "all";
599
+ return {
600
+ start_rows: view_more_button.start_rows,
601
+ rows_per_click: view_more_button.rows_per_click,
602
+ button: (() => {
603
+ const _el$ = $9HbP8$getNextElement($9ea5383493360761$var$_tmpl$);
604
+ $9HbP8$insert(_el$, () => view_more_button.text);
605
+ return _el$;
606
+ })()
607
+ };
608
+ });
609
+ const grid_spacing_override = $9HbP8$createMemo(() => {
610
+ const {
611
+ grid_spacing: grid_spacing
612
+ } = props; // can be reactive
613
+ return typeof grid_spacing === "string" ? {
614
+ grid_spacing: grid_spacing
615
+ } : {
616
+ override_vertical_spacing: grid_spacing.vertical,
617
+ grid_spacing: grid_spacing.horizontal
618
+ };
619
+ });
620
+ const [recommendations_resource_] = $9HbP8$createResource(() => props.recommendations, recs => recs);
621
+ return (() => {
622
+ const _el$2 = $9HbP8$getNextElement($9ea5383493360761$var$_tmpl$2);
623
+ $9HbP8$insert(_el$2, () => $3da8afe3ed57cf34$export$7da560f849543dff({
624
+ rows_object_: rows_object_,
625
+ product_card_template_: (...args) => props.product_card_template(...args),
626
+ recommendations_resource_: recommendations_resource_,
627
+ market_: () => props.market,
628
+ merchant_: () => props.merchant,
629
+ layout_options_: $9HbP8$createMemo(() => ({
630
+ cols_at_size: $b5cccc8ee7d24677$export$6daf8749b65a1b77($1848f7cca286fbab$export$ff7109b9b2b206ba(props.cols_at_size)),
631
+ ...grid_spacing_override()
632
+ }))
633
+ }));
634
+ return _el$2;
635
+ })();
636
+ }
9
637
  const $e8ffe11ed01df0fe$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<img>`, 1);
10
638
  function $e8ffe11ed01df0fe$export$e6fffe67d4cdd848(whatToWatch) {
11
639
  const [size, setSize] = $9HbP8$createSignal(0);
@@ -61,42 +689,6 @@ function $f18d425032111270$export$94026ee33dbabc26(props) {
61
689
  return _el$;
62
690
  })();
63
691
  }
64
-
65
- // Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
66
- class $4fd48cb976bf1789$export$e1d52e4f0c7557a1 extends Error {}
67
- class $4fd48cb976bf1789$export$aa14a9f43128f61f extends $4fd48cb976bf1789$export$e1d52e4f0c7557a1 {
68
- constructor(templateError) {
69
- super("Uncaught error in product card template", {
70
- cause: templateError
71
- });
72
- }
73
- }
74
- const $b7436a6d1fd64e3b$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div></div>`, 2);
75
- function $b7436a6d1fd64e3b$export$b69d0d92862de18b(props) {
76
- return $9HbP8$ErrorBoundary({
77
- fallback(err, retry) {
78
- const {
79
- message_: message_,
80
- severity_: severity_
81
- } = props;
82
- let message = message_;
83
- if (err instanceof (0, $4fd48cb976bf1789$export$aa14a9f43128f61f)) {
84
- console.error(err.cause);
85
- message = `${message}: ${err.message}`;
86
- } else $9HbP8$report([err, message_], severity_);
87
- props.on_error_?.(retry);
88
- return (() => {
89
- const _el$ = $9HbP8$getNextElement($b7436a6d1fd64e3b$var$_tmpl$);
90
- $9HbP8$insert(_el$, message);
91
- $9HbP8$effect(_$p => $9HbP8$classList(_el$, Object.fromEntries(props.class_list_?.map(c => [c, true]) || []), _$p));
92
- return _el$;
93
- })();
94
- },
95
- get children() {
96
- return props.children;
97
- }
98
- });
99
- }
100
692
  function $24e27fab9c821b86$export$5bad61ecde080b1f(...params) {
101
693
  const {
102
694
  collapse: collapse,
@@ -215,54 +807,6 @@ function $8c0f86cb3e266eeb$export$a71e92cfbb498adc(props) {
215
807
  return $9HbP8$standard_price_format(props.price_, price_formatting.places_after_comma_, price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
216
808
  });
217
809
  }
218
- const $fbbadcb080ad1d4a$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0" fill="#0f0f0f"></path></svg>`, 4);
219
- function $fbbadcb080ad1d4a$export$8be2714ec7f169ee(props = {}) {
220
- return (() => {
221
- const _el$ = $9HbP8$getNextElement($fbbadcb080ad1d4a$var$_tmpl$);
222
- $9HbP8$effect(_p$ => {
223
- const _v$ = props.width_ ?? 14,
224
- _v$2 = props.height_ ?? 26;
225
- _v$ !== _p$._v$ && $9HbP8$setAttribute(_el$, "width", _p$._v$ = _v$);
226
- _v$2 !== _p$._v$2 && $9HbP8$setAttribute(_el$, "height", _p$._v$2 = _v$2);
227
- return _p$;
228
- }, {
229
- _v$: undefined,
230
- _v$2: undefined
231
- });
232
- return _el$;
233
- })();
234
- }
235
- const $f32e14878e75af51$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div></div>`, 2);
236
- function $f32e14878e75af51$export$6649caad96ef8870({
237
- children: children,
238
- slider_ref_: slider_ref_,
239
- faded_opacity_ = 0.7,
240
- mutation_plugins_ = []
241
- }) {
242
- const slider = new (0, $9HbP8$Amazing_Slider)({
243
- button_contents: {
244
- left: [(() => {
245
- const _el$ = $9HbP8$getNextElement($f32e14878e75af51$var$_tmpl$);
246
- $9HbP8$insert(_el$, $9HbP8$createComponent((0, $fbbadcb080ad1d4a$export$8be2714ec7f169ee), {}));
247
- return _el$;
248
- })()],
249
- right: [(() => {
250
- const _el$2 = $9HbP8$getNextElement($f32e14878e75af51$var$_tmpl$);
251
- $9HbP8$insert(_el$2, $9HbP8$createComponent((0, $fbbadcb080ad1d4a$export$8be2714ec7f169ee), {}));
252
- return _el$2;
253
- })()]
254
- },
255
- constructor_plugins: [$9HbP8$slider_snap_css().constructor_plugin],
256
- mutation_plugins: [$9HbP8$slider_fading_factory({
257
- threshold_: 0.96,
258
- faded_opacity_: faded_opacity_
259
- }).mutation_plugin_, ...mutation_plugins_]
260
- });
261
- $9HbP8$insert(slider.insert_here, children);
262
- $9HbP8$onCleanup(() => slider.observer.disconnect());
263
- slider_ref_?.(slider);
264
- return slider.container;
265
- }
266
810
  const $bf52d9f9eebd1938$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div></div>`, 2);
267
811
  const $bf52d9f9eebd1938$var$closing_functions = /*@__PURE__*/new Set();
268
812
  const $bf52d9f9eebd1938$export$22970a0140fc759c = /*@__PURE__*/$9HbP8$createSignal(false);
@@ -2607,166 +3151,33 @@ function $5efb5894079b220e$var$modify_only_local_filter(local_filter_object, sel
2607
3151
  ...old_meta
2608
3152
  };
2609
3153
  modified_filter_object.meta = new_meta;
2610
- // set counts to 0
2611
- if ("counts" in new_meta) {
2612
- const counts = new_meta.counts;
2613
- if (counts) new_meta.counts = counts.map(() => 0);
2614
- }
2615
- if (Array.isArray(selected_filter_data) && "values" in new_meta) {
2616
- // we have an array of values and want to strip the ones from the available ones that aren't selected
2617
- const values = new_meta.values;
2618
- if (Array.isArray(values)) {
2619
- const jsond_set_values = selected_filter_data.map(data => JSON.stringify(data));
2620
- const indexes_to_remove = new Set();
2621
- for (let i = 0; i < values.length; i++) {
2622
- const value = values[i];
2623
- if (!jsond_set_values.includes(JSON.stringify(value)))
2624
- // We want to remove the entry with this value from the filter object because it's not selected
2625
- indexes_to_remove.add(i);
2626
- }
2627
- new_meta.values = values.filter((_, index) => !indexes_to_remove.has(index));
2628
- if (new_meta.names) new_meta.names = new_meta.names.filter((_, index) => !indexes_to_remove.has(index));
2629
- if (new_meta.counts)
2630
- // remove counts that are too much, they're all zero anyway if they exist
2631
- new_meta.counts.length -= indexes_to_remove.size;
2632
- }
2633
- }
2634
- }
2635
- return modified_filter_object;
2636
- }
2637
- function $a52235d12ccf9c88$export$2f0cbfbb4354bb52(elements) {
2638
- // FYI this probably doesn't work on hugely deep nestings or large amount of elements
2639
- return $9HbP8$createMemo(() => $a52235d12ccf9c88$var$unwrapping_helper(elements));
2640
- }
2641
- function $a52235d12ccf9c88$var$unwrapping_helper(elements) {
2642
- const result = [];
2643
- if (Array.isArray(elements)) for (let i = 0; i < elements.length; i++) {
2644
- const element = elements[i];
2645
- result.push(...$a52235d12ccf9c88$var$unwrapping_helper(element));
2646
- } else if (typeof elements == "function") result.push(...$a52235d12ccf9c88$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
2647
- return result;
2648
- }
2649
- const $c8d5ff4524619fcd$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div></div>`, 2),
2650
- $c8d5ff4524619fcd$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<style type="text/css"></style>`, 2);
2651
- function $c8d5ff4524619fcd$export$d21e32dfedac04be(props) {
2652
- const container_element_ = (() => {
2653
- const _el$ = $9HbP8$getNextElement($c8d5ff4524619fcd$var$_tmpl$);
2654
- $9HbP8$spread(_el$, $9HbP8$mergeProps(() => props.element_attributes), false, true);
2655
- $9HbP8$insert(_el$, () => props.children);
2656
- $9HbP8$runHydrationEvents();
2657
- return _el$;
2658
- })(); // Don't want this in the error boundary below, it should only be for the actual layouting
2659
- return $9HbP8$createComponent((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
2660
- get message_() {
2661
- return "Failed calculating " + props.layout + " layout";
2662
- },
2663
- severity_: "error",
2664
- get children() {
2665
- return $c8d5ff4524619fcd$var$ActualSolidLayout(props, container_element_);
2666
- }
2667
- });
2668
- }
2669
- function $c8d5ff4524619fcd$var$ActualSolidLayout(props, container_element) {
2670
- // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
2671
- const show_all_rows = $9HbP8$createMemo(() => props.rows === "all");
2672
- const rows_or_empty_object = $9HbP8$createMemo(() => show_all_rows() ? {} : props.rows);
2673
- const view_more_button_elements = $a52235d12ccf9c88$export$2f0cbfbb4354bb52($9HbP8$createMemo(() => rows_or_empty_object().button));
2674
- const view_less_button_elements = $a52235d12ccf9c88$export$2f0cbfbb4354bb52($9HbP8$createMemo(() => rows_or_empty_object().view_less_button));
2675
- const have_a_view_more_button = $9HbP8$createMemo(() => {
2676
- const button = view_more_button_elements();
2677
- return !(!button || Array.isArray(button) && !button.length);
2678
- });
2679
- const have_a_view_less_button = $9HbP8$createMemo(() => {
2680
- const button = view_less_button_elements();
2681
- return !(!button || Array.isArray(button) && !button.length);
2682
- });
2683
- const [get_styling, set_styling] = $9HbP8$createSignal();
2684
- const container_class = $9HbP8$make_random_classname();
2685
- const selector_beginning = `.depict .${container_class}>`; // class so ppl can have id if needed
2686
- const [get_children_count, set_children_count] = $9HbP8$createSignal(0);
2687
- const update_children_count = () => set_children_count(container_element.children.length);
2688
- const col_styling = $9HbP8$createMemo(() => $9HbP8$n_col_styling_with_dist(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
2689
- const default_currently_visible_signal = $9HbP8$createSignal($9HbP8$untrack(() => rows_or_empty_object().start_rows ?? 1)); // Keep this signal here, so it doesn't change when rows_or_empty_object and I think it's to be expected that the "internal default signal" stays the same
2690
- const rows_visible_signal = $9HbP8$createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
2691
- const get_rows_visible = $9HbP8$createMemo(() => rows_visible_signal()[0]());
2692
- const set_rows_visible = $9HbP8$createMemo(() => rows_visible_signal()[1]);
2693
- const view_more_button_class = $9HbP8$make_random_classname();
2694
- const view_less_button_class = $9HbP8$make_random_classname();
2695
- const view_more_button_container = $9HbP8$createMemo(() => have_a_view_more_button() && (() => {
2696
- const _el$2 = $9HbP8$getNextElement($c8d5ff4524619fcd$var$_tmpl$);
2697
- $9HbP8$addEventListener(_el$2, "click", $9HbP8$catchify(() => set_rows_visible()(prev => prev + (rows_or_empty_object().rows_per_click ?? 1))), true);
2698
- $9HbP8$className(_el$2, `load-more-container ${view_more_button_class}`);
2699
- $9HbP8$insert(_el$2, () => rows_or_empty_object().button);
2700
- $9HbP8$runHydrationEvents();
2701
- return _el$2;
2702
- })());
2703
- // We need to have duplicate buttons because which ones is shown depends on the number of rows visible and therefore on the viewport size and therefore on the css media queries
2704
- const view_less_button_container = $9HbP8$createMemo(() => have_a_view_less_button() && (() => {
2705
- const _el$3 = $9HbP8$getNextElement($c8d5ff4524619fcd$var$_tmpl$);
2706
- $9HbP8$addEventListener(_el$3, "click", $9HbP8$catchify(() => set_rows_visible()(() => rows_or_empty_object().start_rows ?? 1)), true);
2707
- $9HbP8$className(_el$3, `load-less-container ${view_less_button_class}`);
2708
- $9HbP8$insert(_el$3, () => rows_or_empty_object().view_less_button);
2709
- $9HbP8$runHydrationEvents();
2710
- return _el$3;
2711
- })());
2712
- container_element.classList.add(container_class);
2713
- $9HbP8$createComputed(() => {
2714
- // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
2715
- const rows_visible = get_rows_visible();
2716
- const max_rows = rows_or_empty_object().max_rows;
2717
- if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
2718
- });
2719
- $9HbP8$createRenderEffect(() => {
2720
- // Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
2721
- if (show_all_rows()) {
2722
- // no view more functionality requested
2723
- set_styling(() => col_styling);
2724
- return;
2725
- }
2726
- update_children_count();
2727
- const mutation_observer = new MutationObserver($9HbP8$catchify(update_children_count));
2728
- mutation_observer.observe(container_element, {
2729
- childList: true
2730
- });
2731
- $9HbP8$onCleanup(() => mutation_observer.disconnect());
2732
- set_styling(
2733
- // this is needed because solid will think that the memo-accessor is a setter function otherwise
2734
- () => $9HbP8$createMemo(() => {
2735
- const {
2736
- rows_per_click: rows_per_click,
2737
- max_rows = -1,
2738
- start_rows: start_rows
2739
- } = rows_or_empty_object();
2740
- const rows_visible = get_rows_visible();
2741
- const children_count = get_children_count();
2742
- return col_styling() + props.cols_at_size.map(options => {
2743
- const [recs_per_row, min, max] = options;
2744
- let should_hide_view_more_button;
2745
- let visible_recs;
2746
- if (props.disable_partial_rows) {
2747
- visible_recs = $9HbP8$layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
2748
- const visible_recs_next_show_more = $9HbP8$layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
2749
- // Should this really be zero when we default rows_per_click to 1?
2750
- children_count, options);
2751
- should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
2752
- } else {
2753
- visible_recs = $9HbP8$layout_get_total_rec_amount_for_row(rows_visible, options);
2754
- should_hide_view_more_button = visible_recs >= children_count;
3154
+ // set counts to 0
3155
+ if ("counts" in new_meta) {
3156
+ const counts = new_meta.counts;
3157
+ if (counts) new_meta.counts = counts.map(() => 0);
3158
+ }
3159
+ if (Array.isArray(selected_filter_data) && "values" in new_meta) {
3160
+ // we have an array of values and want to strip the ones from the available ones that aren't selected
3161
+ const values = new_meta.values;
3162
+ if (Array.isArray(values)) {
3163
+ const jsond_set_values = selected_filter_data.map(data => JSON.stringify(data));
3164
+ const indexes_to_remove = new Set();
3165
+ for (let i = 0; i < values.length; i++) {
3166
+ const value = values[i];
3167
+ if (!jsond_set_values.includes(JSON.stringify(value)))
3168
+ // We want to remove the entry with this value from the filter object because it's not selected
3169
+ indexes_to_remove.add(i);
2755
3170
  }
2756
- const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
2757
- // I don't really understand the logic for when the view more button gets hidden so IDK if below is correct, but it works how it should for now
2758
- const should_hide_view_less_button = !should_hide_view_more_button || start_rows == undefined || rows_visible <= start_rows || children_count <= recs_per_row * start_rows;
2759
- return `${$9HbP8$layout_media_query_header(min, max)}{${selector_beginning}:nth-child(n+${visible_recs + 1}){display:none}${props.layout == "slider" ? `${selector_beginning}:nth-child(n+${visible_recs}){margin-right:0}` : ""}${should_hide_button_final ? `.depict .${view_more_button_class}{display:none!important}` : ``}${should_hide_view_less_button ? `.depict .${view_less_button_class}{display:none!important}` : ``}}`;
2760
- }).join("");
2761
- }));
2762
- });
2763
- return [container_element, $9HbP8$memo(view_more_button_container), $9HbP8$memo(view_less_button_container), (() => {
2764
- const _el$4 = $9HbP8$getNextElement($c8d5ff4524619fcd$var$_tmpl$2);
2765
- $9HbP8$insert(_el$4, get_styling);
2766
- return _el$4;
2767
- })()];
3171
+ new_meta.values = values.filter((_, index) => !indexes_to_remove.has(index));
3172
+ if (new_meta.names) new_meta.names = new_meta.names.filter((_, index) => !indexes_to_remove.has(index));
3173
+ if (new_meta.counts)
3174
+ // remove counts that are too much, they're all zero anyway if they exist
3175
+ new_meta.counts.length -= indexes_to_remove.size;
3176
+ }
3177
+ }
3178
+ }
3179
+ return modified_filter_object;
2768
3180
  }
2769
- $9HbP8$delegateEvents(["click"]);
2770
3181
  async function $194bd6b8e4c59830$export$79b1565500412d9b(search_modal, modal_fn_opts) {
2771
3182
  const body = await (0, $9HbP8$observer).wait_for_element("body");
2772
3183
  let dispose_and_remove;
@@ -3462,92 +3873,6 @@ function $598245ecfe38f34b$export$ef6006467f04ee41({
3462
3873
  })()];
3463
3874
  }
3464
3875
  $9HbP8$delegateEvents(["click"]);
3465
- function $a458486f22b22f63$export$a2cc176055f8f08() {
3466
- const text = "Please try setting `colsAtSize` on the `SearchPage`/`CategoryPage` components to change the grid before setting it with CSS. If you do with CSS, set `ColsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
3467
- return (0, $9HbP8$isServer) ? `<!-- ${text} -->` : document.createComment(text);
3468
- }
3469
- let $6e41f1fde994db72$var$cached_placeholder_element;
3470
- let $6e41f1fde994db72$var$rendering_cached_placeholder_element;
3471
- function $6e41f1fde994db72$export$f33414a4df0afd3f({
3472
- product_card_template_: product_card_template_,
3473
- num_placeholders_: num_placeholders_
3474
- }) {
3475
- const [get_elements, set_elements] = $9HbP8$createSignal([]);
3476
- let existing_num = 0;
3477
- if (0, $9HbP8$isServer)
3478
- // want to render simple placeholders on server, effects don't run there
3479
- return $9HbP8$createMemo(() => Array.from({
3480
- length: num_placeholders_()
3481
- }).map(() => {
3482
- const template_result = product_card_template_(null, undefined);
3483
- // @ts-ignore
3484
- if (typeof template_result?.then !== "function") return template_result;
3485
- }));
3486
- $9HbP8$createRenderEffect(() => {
3487
- const to_add = num_placeholders_() - existing_num;
3488
- if (to_add <= 0) return;
3489
- // Below comment is from when we used recommendation renderer and manual DOM manipulation for this, but I'm still scared to remove placeholders and mess up scroll restoration, so I'm keeping the way it worked. Otherwise, <Index> could be used which would be far more elegant.
3490
- // We don't need to remove placeholders, only need to add. The reason for that is that chrome restores the scroll position once all tasks queued as reaction of the "popstate" events have been completed in the task queue. That means that we need to get the placeholders in fast, or we might lose scroll position if the previous site was shorter.
3491
- // The query id and the amount might update in separate tasks because one comes from href_change_ipns and the other one from another "popstate" listener. Therefore, we need to be able to dynamically add more placeholders. I'm not entirely sure about this anymore though, since we have the scroll position on a per-id basis it might work anyway but THIS WORKS, and I've been working on this bug for 3 hours so let's just keep it this way.
3492
- set_elements(prev => [...prev, ...Array.from({
3493
- length: to_add
3494
- }).map(() => $6e41f1fde994db72$var$Placeholder({
3495
- product_card_template_: product_card_template_
3496
- }))]);
3497
- existing_num += to_add;
3498
- });
3499
- return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
3500
- }
3501
- /**
3502
- * Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
3503
- */
3504
- function $6e41f1fde994db72$var$Placeholder({
3505
- product_card_template_: product_card_template_
3506
- }) {
3507
- const get_cloned_placeholders = (element_to_clone = $6e41f1fde994db72$var$cached_placeholder_element) => Array.isArray(element_to_clone) ? element_to_clone.map(el => el instanceof Node ? el.cloneNode(true) : el) : element_to_clone;
3508
- if ($6e41f1fde994db72$var$cached_placeholder_element) return get_cloned_placeholders();
3509
- let dispose_original_copy;
3510
- const get_unwrapped_element = $9HbP8$createRoot(dispose => {
3511
- dispose_original_copy = dispose;
3512
- // if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
3513
- const [resource] = $9HbP8$createResource(() => {
3514
- if ($6e41f1fde994db72$var$rendering_cached_placeholder_element) return $6e41f1fde994db72$var$rendering_cached_placeholder_element;
3515
- const return_value = product_card_template_(null, undefined);
3516
- if (typeof return_value === "object" && typeof return_value?.then === "function")
3517
- // Is Promise or promise-like object
3518
- $6e41f1fde994db72$var$rendering_cached_placeholder_element = return_value;
3519
- return return_value;
3520
- });
3521
- return $9HbP8$createMemo(() => {
3522
- if (resource.loading) return () => [];
3523
- return $a52235d12ccf9c88$export$2f0cbfbb4354bb52(resource);
3524
- });
3525
- });
3526
- $9HbP8$onCleanup(() => {
3527
- if ($6e41f1fde994db72$var$rendering_cached_placeholder_element) {
3528
- // If we're still rendering in our separate root, let the rendering finish or other <Placeholder> components waiting for it might get an incomplete result
3529
- const unset_current_rendering = () => {
3530
- dispose_original_copy();
3531
- $6e41f1fde994db72$var$rendering_cached_placeholder_element = undefined;
3532
- };
3533
- $6e41f1fde994db72$var$rendering_cached_placeholder_element?.then(unset_current_rendering, unset_current_rendering);
3534
- } else
3535
- // Otherwise, just make sure we've disposed our root
3536
- dispose_original_copy();
3537
- });
3538
- return $9HbP8$createMemo(() => {
3539
- const unwrapped_array = get_unwrapped_element()();
3540
- if (!unwrapped_array?.length || !unwrapped_array.every(item => item))
3541
- // Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
3542
- return;
3543
- // placeholders have finished rendering, freeze the elements
3544
- // 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
3545
- $6e41f1fde994db72$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
3546
- $6e41f1fde994db72$var$rendering_cached_placeholder_element = undefined;
3547
- dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
3548
- 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
3549
- });
3550
- }
3551
3876
 
3552
3877
  /*
3553
3878
  * Usually product templates are somewhat height-elastic depending on the content, i.e. if the title is longer we might up to two extra rows for this. That means that the placeholders almost never will reflect the size of the actual content when we do scroll restoration. This magic number specifies how many extra placeholders we should render everytime to compensate for this, since if the placeholders are in total shorter than the old scroll location the scroll restoration won't work.
@@ -3653,86 +3978,6 @@ function $0e0b96a8dc1ad492$export$63dd0350f8559dda({
3653
3978
  equals: false
3654
3979
  });
3655
3980
  }
3656
-
3657
- /**
3658
- * Gets product_id (the thing we key the rendering on) from a display
3659
- */
3660
- function $16351e4c87b90b3d$export$548d053aba053d79(display) {
3661
- if ("variant_index" in display) {
3662
- const actual_display = display.variant_displays[display.variant_index];
3663
- return actual_display.product_id;
3664
- }
3665
- return display.product_id;
3666
- }
3667
- function $29ec7cddbe1d3484$export$7f8bd308237ab5a5(get_displays_) {
3668
- const displays_by_key_ = $9HbP8$createMemo(() => {
3669
- const displays = get_displays_();
3670
- // We key by product_id because that's what can be used to uniquely identify products
3671
- // This way <For> can optimize the rendering
3672
- const map = new Map();
3673
- for (let i = 0; i < displays.length; i++) {
3674
- const display = displays[i];
3675
- const product_id = $16351e4c87b90b3d$export$548d053aba053d79(display);
3676
- map.set(product_id, display);
3677
- }
3678
- return map;
3679
- });
3680
- return displays_by_key_;
3681
- }
3682
- function $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
3683
- displays_by_key_: displays_by_key_,
3684
- merchant_: merchant_,
3685
- market_: market_,
3686
- product_card_template_: product_card_template_,
3687
- do_per_elements_: do_per_elements_
3688
- }) {
3689
- return $9HbP8$createComponent((0, $9HbP8$For), {
3690
- get each() {
3691
- return [...displays_by_key_().keys()];
3692
- },
3693
- children: (product_id, index) => {
3694
- const owner = $9HbP8$getOwner();
3695
- const display_accessor = $9HbP8$createMemo(() => displays_by_key_().get(product_id));
3696
- const [product_card_resource] = $9HbP8$createResource(display_accessor,
3697
- // re-render when the reference to the display object changes
3698
- // this should only be the case when the merchant or market changes and the new request has completed
3699
- display => {
3700
- // get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
3701
- return product_card_template_(display, {
3702
- set_on_index_change: fn => $9HbP8$runWithOwner(owner, () => $9HbP8$createEffect(() => fn(index()))),
3703
- merchant: $9HbP8$untrack(merchant_),
3704
- // this means that the merchant and market provided to the template is wrong while we do another fetch, but I don't see how anyone would need to know the correct market there
3705
- market: $9HbP8$untrack(market_)
3706
- });
3707
- });
3708
- const node_accessor = $a52235d12ccf9c88$export$2f0cbfbb4354bb52(product_card_resource);
3709
- $9HbP8$createEffect(() => {
3710
- const product_card_nodes = node_accessor();
3711
- const display = display_accessor();
3712
- const elements = [];
3713
- for (let i = 0; i < product_card_nodes.length; i++) {
3714
- const element = product_card_nodes[i];
3715
- if (!(element instanceof Element)) continue;
3716
- elements.push(element);
3717
- // Add tracking ids
3718
- if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
3719
- const {
3720
- dataset: dataset
3721
- } = element;
3722
- const {
3723
- search_result_id: search_result_id,
3724
- product_listing_result_id: product_listing_result_id,
3725
- recommendation_id: recommendation_id
3726
- } = display;
3727
- if (search_result_id) dataset.searchResultId = search_result_id;else if (product_listing_result_id) dataset.productListingResultId = product_listing_result_id;else if (recommendation_id) dataset.recommendationId = recommendation_id;
3728
- }
3729
- do_per_elements_?.(elements, index);
3730
- });
3731
- return product_card_resource; // https://github.com/solidjs/solid/releases/tag/v1.7.0
3732
- }
3733
- });
3734
- }
3735
-
3736
3981
  function $0449e7d49398c077$export$a1fd619a4743ca08({
3737
3982
  plp_results_: plp_results_,
3738
3983
  product_card_template_: product_card_template_,
@@ -6018,41 +6263,6 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
6018
6263
  return _el$13;
6019
6264
  })()];
6020
6265
  }
6021
- const $b5cccc8ee7d24677$var$transform_elements = sorted_cols_at_size => {
6022
- const cols_at_size = [];
6023
- for (let i = 0; i < sorted_cols_at_size.length; i++) {
6024
- const [nb_cols, width] = sorted_cols_at_size[i];
6025
- const next_width = sorted_cols_at_size[i + 1]?.[1];
6026
- const max_width = i === 0 ? "" : `${width}px`;
6027
- const min_width = next_width !== undefined ? `${next_width + 1}px` : "";
6028
- const col_at_size = [nb_cols, min_width, max_width];
6029
- cols_at_size.push(col_at_size);
6030
- }
6031
- return cols_at_size;
6032
- };
6033
- const $b5cccc8ee7d24677$export$6daf8749b65a1b77 = cols_at_size => {
6034
- // Check that every element is an array
6035
- const are_arrays = cols_at_size.every(element => Array.isArray(element));
6036
- if (!are_arrays) throw new Error("Every element in cols_at_size must be an array");
6037
- // Check width duplicates
6038
- const widths = cols_at_size.map(([_, width]) => width);
6039
- const widths_set = new Set(widths);
6040
- if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
6041
- if (cols_at_size.length === 1) {
6042
- const [nb_cols, width] = cols_at_size[0];
6043
- const max_width = width !== undefined ? `${width}px` : "";
6044
- return [[nb_cols, "", max_width]];
6045
- }
6046
- // Sort widths in ascending order
6047
- const sorted_cols_at_size = [...cols_at_size].sort((a, b) => {
6048
- const [_b, width_A] = a;
6049
- const [_a, width_b] = b;
6050
- if (width_A === undefined) return -1;
6051
- if (width_b === undefined) return 1;
6052
- return width_b - width_A;
6053
- });
6054
- return $b5cccc8ee7d24677$var$transform_elements(sorted_cols_at_size);
6055
- };
6056
6266
  function $16b52438165aafe2$export$23fca46f3143581f(component, error_message) {
6057
6267
  const component_in_error_boundary = do_with_elements => {
6058
6268
  const error_boundary_wrapped = $b7436a6d1fd64e3b$export$b69d0d92862de18b({
@@ -6356,7 +6566,7 @@ class $961b5c64bef4662f$export$f34314aa9505732e {
6356
6566
  #meta_title_suffix_ = $9HbP8$createSignal();
6357
6567
  #disable_override_query_id = $9HbP8$createSignal();
6358
6568
  #listing_type_signal = $9HbP8$createSignal();
6359
- static #keys_constructed_with = new Set();
6569
+ static #keys_constructed_with = /*@__PURE__*/new Set();
6360
6570
  get localization() {
6361
6571
  // allow reactive access
6362
6572
  return this.#locale_signal[0]();
@@ -9602,27 +9812,6 @@ function $4ca91518c9a35379$export$828dcdd425fd3231(aligner) {
9602
9812
  cleanup: cleanup
9603
9813
  };
9604
9814
  }
9605
-
9606
- /**
9607
- * Content results ContentCard look stupid on mobile if there are two columns of them, so we limit the number of columns to 1 if the screen is too small
9608
- */
9609
- function $1848f7cca286fbab$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_for_more_than_one_column = 500) {
9610
- if (!sdk_cols_at_size.length) return sdk_cols_at_size;
9611
- const sorted_sizes = sdk_cols_at_size.map(([cols, max_width]) => [cols, max_width ?? Infinity]).sort(([, a], [, b]) => a - b);
9612
- const [[, smallest_max_width]] = sorted_sizes;
9613
- if (smallest_max_width > min_width_for_more_than_one_column)
9614
- // If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
9615
- return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
9616
- const to_delete = [];
9617
- for (let i = 0; i < sorted_sizes.length; i++) {
9618
- const [, max_width] = sorted_sizes[i];
9619
- if (max_width > min_width_for_more_than_one_column) continue;
9620
- to_delete.push(i);
9621
- }
9622
- while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
9623
- sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
9624
- return sorted_sizes.map(([cols, max_width]) => max_width == Infinity ? [cols] : [cols, max_width]);
9625
- }
9626
9815
  const $806c97b931758897$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class="depict plp search"></div>`, 2);
9627
9816
  // We just pass page_url_creator to DepictAPI when we instantiate it, so don't allow it to be specified if api is already specified
9628
9817
  /**
@@ -9641,7 +9830,7 @@ class $806c97b931758897$export$ac6237957a15b3f0 {
9641
9830
  #market_signal = $9HbP8$createSignal();
9642
9831
  #modal_open_signal = $9HbP8$createSignal(false);
9643
9832
  #content_search_signal = $9HbP8$createSignal();
9644
- static #keys_constructed_with = new Set();
9833
+ static #keys_constructed_with = /*@__PURE__*/new Set();
9645
9834
  #router = new (0, $4fd2ba03703a7d92$export$7e1297a3a19f10d8)("hard_navigation");
9646
9835
  constructor({
9647
9836
  unique_instance_key_for_state = "",
@@ -10159,7 +10348,7 @@ class $753e9b2889a47c89$export$3ccaa27d81dd8556 extends EventTarget {
10159
10348
  #revert_fns = [];
10160
10349
  #is_open = false;
10161
10350
  static #reverting_permitted = true;
10162
- static #visited_urls = (() => {
10351
+ static #visited_urls = /*@__PURE__*/(() => {
10163
10352
  // Keep track of all URLs that have been visited since the document that was initially loaded (loaded means the process where the browser creates a new `document` and `window` object).
10164
10353
  $9HbP8$catchify(async () => {
10165
10354
  // Static initialization blocks aren't supported in MobileSafari yet, otherwise this would be one.
@@ -10200,14 +10389,14 @@ class $753e9b2889a47c89$export$3ccaa27d81dd8556 extends EventTarget {
10200
10389
  return $9HbP8$catchify(this.render_, "rendering failed")() || [];
10201
10390
  });
10202
10391
  }
10203
- #unload = $9HbP8$catchify(() => {
10392
+ #unload = /*@__PURE__*/$9HbP8$catchify(() => {
10204
10393
  if (!this.#is_open) return;
10205
10394
  this.#disconnect_observer?.();
10206
10395
  if ($753e9b2889a47c89$export$3ccaa27d81dd8556.#reverting_permitted) while (this.#revert_fns.length) this.#revert_fns.pop()?.();
10207
10396
  this.#is_open = false;
10208
10397
  this.dispatchEvent(new CustomEvent("close"));
10209
10398
  }, "failed to close page");
10210
- #load = $9HbP8$catchify(async els => {
10399
+ #load = /*@__PURE__*/$9HbP8$catchify(async els => {
10211
10400
  this.#is_open = true;
10212
10401
  // So that #load doesn't get called again
10213
10402
  let set_should_stay_inserted;
@@ -10322,4 +10511,4 @@ const $4690a06c8489dcd0$export$c3834fa86c616831 = [[4], [3, 1024], [2, 901]];
10322
10511
  const $4690a06c8489dcd0$export$864d304a0bc46829 = "2%";
10323
10512
  const $4690a06c8489dcd0$export$7bf543b9d9be2c22 = (0, $e4615ecd1849548f$export$b91cec6bdc6b32a1);
10324
10513
  $9HbP8$add_to_version_info("ui", (0, $ec291e0010116877$export$83d89fbfd8236492));
10325
- export { $e8ffe11ed01df0fe$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $e8ffe11ed01df0fe$export$e6fffe67d4cdd848 as makeSizeAccessor, $f18d425032111270$export$94026ee33dbabc26 as ImageContainer, $b7436a6d1fd64e3b$export$b69d0d92862de18b as SentryErrorBoundary, $6bb0a0c563dff4bb$export$6c6d7a51fa9aa15d as ExpandingDetails, $c16e74cfe125bb05$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $1adfe60f3a14a1d7$export$fecbb157621501bd as SelectedFilters, $fab07f52c9861732$export$3f1a388cc0d8fed7 as FilterBody, $5efb5894079b220e$export$b288c38ae3fddb56 as create_modified_filters, $c8d5ff4524619fcd$export$d21e32dfedac04be as SolidLayout, $194bd6b8e4c59830$export$79b1565500412d9b as general_modal_abstraction, $19976a74d273070d$export$3b621d86b1566b2 as CrossIcon, $fbbadcb080ad1d4a$export$8be2714ec7f169ee as GenericSliderArrowButton, $c58717f39bf51647$export$58e808b1db15d3bc as fetchDepictRecommendations, $961b5c64bef4662f$export$de035477d6fef996 as QuickLinks, $961b5c64bef4662f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $e4615ecd1849548f$export$b91cec6bdc6b32a1 as CategoryTitle, $a6e23a834336fc19$export$824dde41348efed1 as embedded_num_products, $c9312089e8983364$export$643598a327b5833e as get_categories, $961b5c64bef4662f$export$f34314aa9505732e as DepictCategory, $961b5c64bef4662f$export$e2bf8ce7779e827e as CategoryPage, $806c97b931758897$export$ac6237957a15b3f0 as DepictSearch, $806c97b931758897$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $806c97b931758897$export$f2dc7e4e4aa11abb as SearchPage, $806c97b931758897$export$316f6f283ae64765 as SearchField, $4fd48cb976bf1789$export$aa14a9f43128f61f as ProductCardError, $6891c018a834cfdd$export$d86a33413558014e as open_modal_with_alignment, $bb15dfb548a7666e$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $b6d5529b253681aa$export$b3ad617e9036868 as align_field, $b5cccc8ee7d24677$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $926b1b5ba2239356$export$1233ca167bf71f9a as styles_to_valid_css_string, $aea1edf92433e81e$export$fe334901e8bebd57 as disable_scrolling, $6e8944558258054f$export$d0596b5cae35ad4 as open_search_with_shift_slash, $7fa23e2a0079eca4$export$e015ed2f2950f2e3 as DepictAPI, $dc9262ef6f786812$export$d9f36cf74e24d595 as media_query_to_accessor, $6936724b9e0b98d5$export$689e204eadb33baf as setup_fast_leave, $bf52d9f9eebd1938$export$5196e4c01fa56fcb as show_toast, $8c0f86cb3e266eeb$export$a71e92cfbb498adc as SolidFormatPrice, $4ca91518c9a35379$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $d20eff0aadc28983$export$acb3eaade4b23afd as BasePlaceholder, $d134eae24341b4a1$export$89c6019e4baa40b1 as TextPlaceholder, $7f60f09116a3fe61$export$3f37af283f8fb843 as ImagePlaceholder, $753e9b2889a47c89$export$3ccaa27d81dd8556 as PageReplacer, $4690a06c8489dcd0$export$864d304a0bc46829 as defaultGridSpacing, $4690a06c8489dcd0$export$c3834fa86c616831 as defaultColsAtSize, $4690a06c8489dcd0$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $ec291e0010116877$export$83d89fbfd8236492 as version };
10514
+ export { $ee116da074deb002$export$9574e176201e5e8d as RecommendationSlider, $9ea5383493360761$export$9756467d34d91cdb as RecommendationGrid, $e8ffe11ed01df0fe$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $e8ffe11ed01df0fe$export$e6fffe67d4cdd848 as makeSizeAccessor, $f18d425032111270$export$94026ee33dbabc26 as ImageContainer, $b7436a6d1fd64e3b$export$b69d0d92862de18b as SentryErrorBoundary, $6bb0a0c563dff4bb$export$6c6d7a51fa9aa15d as ExpandingDetails, $c16e74cfe125bb05$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $1adfe60f3a14a1d7$export$fecbb157621501bd as SelectedFilters, $fab07f52c9861732$export$3f1a388cc0d8fed7 as FilterBody, $5efb5894079b220e$export$b288c38ae3fddb56 as create_modified_filters, $c8d5ff4524619fcd$export$d21e32dfedac04be as SolidLayout, $194bd6b8e4c59830$export$79b1565500412d9b as general_modal_abstraction, $19976a74d273070d$export$3b621d86b1566b2 as CrossIcon, $fbbadcb080ad1d4a$export$8be2714ec7f169ee as GenericSliderArrowButton, $c58717f39bf51647$export$58e808b1db15d3bc as fetchDepictRecommendations, $961b5c64bef4662f$export$de035477d6fef996 as QuickLinks, $961b5c64bef4662f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $e4615ecd1849548f$export$b91cec6bdc6b32a1 as CategoryTitle, $a6e23a834336fc19$export$824dde41348efed1 as embedded_num_products, $c9312089e8983364$export$643598a327b5833e as get_categories, $961b5c64bef4662f$export$f34314aa9505732e as DepictCategory, $961b5c64bef4662f$export$e2bf8ce7779e827e as CategoryPage, $806c97b931758897$export$ac6237957a15b3f0 as DepictSearch, $806c97b931758897$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $806c97b931758897$export$f2dc7e4e4aa11abb as SearchPage, $806c97b931758897$export$316f6f283ae64765 as SearchField, $4fd48cb976bf1789$export$aa14a9f43128f61f as ProductCardError, $6891c018a834cfdd$export$d86a33413558014e as open_modal_with_alignment, $bb15dfb548a7666e$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $b6d5529b253681aa$export$b3ad617e9036868 as align_field, $b5cccc8ee7d24677$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $926b1b5ba2239356$export$1233ca167bf71f9a as styles_to_valid_css_string, $aea1edf92433e81e$export$fe334901e8bebd57 as disable_scrolling, $6e8944558258054f$export$d0596b5cae35ad4 as open_search_with_shift_slash, $7fa23e2a0079eca4$export$e015ed2f2950f2e3 as DepictAPI, $dc9262ef6f786812$export$d9f36cf74e24d595 as media_query_to_accessor, $6936724b9e0b98d5$export$689e204eadb33baf as setup_fast_leave, $bf52d9f9eebd1938$export$5196e4c01fa56fcb as show_toast, $8c0f86cb3e266eeb$export$a71e92cfbb498adc as SolidFormatPrice, $4ca91518c9a35379$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $d20eff0aadc28983$export$acb3eaade4b23afd as BasePlaceholder, $d134eae24341b4a1$export$89c6019e4baa40b1 as TextPlaceholder, $7f60f09116a3fe61$export$3f37af283f8fb843 as ImagePlaceholder, $753e9b2889a47c89$export$3ccaa27d81dd8556 as PageReplacer, $4690a06c8489dcd0$export$864d304a0bc46829 as defaultGridSpacing, $4690a06c8489dcd0$export$c3834fa86c616831 as defaultColsAtSize, $4690a06c8489dcd0$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $ec291e0010116877$export$83d89fbfd8236492 as version };