@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/ES10/index.js CHANGED
@@ -1,6 +1,7 @@
1
- import { add_to_version_info as $8tj43$add_to_version_info, catchify as $8tj43$catchify, is_safari as $8tj43$is_safari, report as $8tj43$report, observer as $8tj43$observer, useExpandingContainer as $8tj43$useExpandingContainer, standard_price_format as $8tj43$standard_price_format, Amazing_Slider as $8tj43$Amazing_Slider, slider_snap_css as $8tj43$slider_snap_css, slider_fading_factory as $8tj43$slider_fading_factory, make_random_classname as $8tj43$make_random_classname, dlog as $8tj43$dlog, hex_to_rgb as $8tj43$hex_to_rgb, relative_luminance_from_rgb as $8tj43$relative_luminance_from_rgb, javascript_media_query as $8tj43$javascript_media_query, n_col_styling_with_dist as $8tj43$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $8tj43$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $8tj43$layout_get_total_rec_amount_for_row, layout_media_query_header as $8tj43$layout_media_query_header, fetch_recs as $8tj43$fetch_recs, snakeCasifyObject as $8tj43$snakeCasifyObject, instant_exec_on_suspect_history_change as $8tj43$instant_exec_on_suspect_history_change, base_url as $8tj43$base_url, get_depict_id as $8tj43$get_depict_id, get_user_id as $8tj43$get_user_id, get_session_id as $8tj43$get_session_id, make_url_with_query_params as $8tj43$make_url_with_query_params, fetch_retry as $8tj43$fetch_retry, add_version_query_params as $8tj43$add_version_query_params, dwarn as $8tj43$dwarn, sort_obj as $8tj43$sort_obj, edit_current_page_meta_tags as $8tj43$edit_current_page_meta_tags, use_href_accessor as $8tj43$use_href_accessor, base64_encode_unicode as $8tj43$base64_encode_unicode, base64_decode_unicode as $8tj43$base64_decode_unicode, queueMacroTask as $8tj43$queueMacroTask, is_debug as $8tj43$is_debug, make_asyncIterable_exiter as $8tj43$make_asyncIterable_exiter, href_change_ipns as $8tj43$href_change_ipns, ContainedImage as $8tj43$ContainedImage, buildThresholdList as $8tj43$buildThresholdList, deparallelize_no_drop as $8tj43$deparallelize_no_drop, insert_surfaces as $8tj43$insert_surfaces } from "@depict-ai/utilishared/ES10";
2
- import { template as $8tj43$template, getNextElement as $8tj43$getNextElement, spread as $8tj43$spread, mergeProps as $8tj43$mergeProps, runHydrationEvents as $8tj43$runHydrationEvents, effect as $8tj43$effect, style as $8tj43$style, insert as $8tj43$insert, classList as $8tj43$classList, createComponent as $8tj43$createComponent, getNextMarker as $8tj43$getNextMarker, addEventListener as $8tj43$addEventListener, memo as $8tj43$memo, delegateEvents as $8tj43$delegateEvents, setAttribute as $8tj43$setAttribute, Dynamic as $8tj43$Dynamic, use as $8tj43$use, className as $8tj43$className, isServer as $8tj43$isServer } from "solid-js/web";
3
- import { createSignal as $8tj43$createSignal, onCleanup as $8tj43$onCleanup, ErrorBoundary as $8tj43$ErrorBoundary, createMemo as $8tj43$createMemo, untrack as $8tj43$untrack, createEffect as $8tj43$createEffect, getOwner as $8tj43$getOwner, Show as $8tj43$Show, runWithOwner as $8tj43$runWithOwner, Index as $8tj43$Index, createRoot as $8tj43$createRoot, on as $8tj43$on, For as $8tj43$For, createRenderEffect as $8tj43$createRenderEffect, createComputed as $8tj43$createComputed, batch as $8tj43$batch, createResource as $8tj43$createResource, createReaction as $8tj43$createReaction, Suspense as $8tj43$Suspense } from "solid-js";
1
+ import { add_to_version_info as $8tj43$add_to_version_info, make_random_classname as $8tj43$make_random_classname, n_col_styling_with_dist as $8tj43$n_col_styling_with_dist, catchify as $8tj43$catchify, layout_get_visible_recs_without_partial_rows as $8tj43$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $8tj43$layout_get_total_rec_amount_for_row, layout_media_query_header as $8tj43$layout_media_query_header, report as $8tj43$report, Amazing_Slider as $8tj43$Amazing_Slider, slider_snap_css as $8tj43$slider_snap_css, slider_fading_factory as $8tj43$slider_fading_factory, is_safari as $8tj43$is_safari, observer as $8tj43$observer, useExpandingContainer as $8tj43$useExpandingContainer, standard_price_format as $8tj43$standard_price_format, dlog as $8tj43$dlog, hex_to_rgb as $8tj43$hex_to_rgb, relative_luminance_from_rgb as $8tj43$relative_luminance_from_rgb, javascript_media_query as $8tj43$javascript_media_query, fetch_recs as $8tj43$fetch_recs, snakeCasifyObject as $8tj43$snakeCasifyObject, instant_exec_on_suspect_history_change as $8tj43$instant_exec_on_suspect_history_change, base_url as $8tj43$base_url, get_depict_id as $8tj43$get_depict_id, get_user_id as $8tj43$get_user_id, get_session_id as $8tj43$get_session_id, make_url_with_query_params as $8tj43$make_url_with_query_params, fetch_retry as $8tj43$fetch_retry, add_version_query_params as $8tj43$add_version_query_params, dwarn as $8tj43$dwarn, sort_obj as $8tj43$sort_obj, edit_current_page_meta_tags as $8tj43$edit_current_page_meta_tags, use_href_accessor as $8tj43$use_href_accessor, base64_encode_unicode as $8tj43$base64_encode_unicode, base64_decode_unicode as $8tj43$base64_decode_unicode, queueMacroTask as $8tj43$queueMacroTask, is_debug as $8tj43$is_debug, make_asyncIterable_exiter as $8tj43$make_asyncIterable_exiter, href_change_ipns as $8tj43$href_change_ipns, ContainedImage as $8tj43$ContainedImage, buildThresholdList as $8tj43$buildThresholdList, deparallelize_no_drop as $8tj43$deparallelize_no_drop, insert_surfaces as $8tj43$insert_surfaces } from "@depict-ai/utilishared/ES10";
2
+ import { template as $8tj43$template, getNextElement as $8tj43$getNextElement, insert as $8tj43$insert, createComponent as $8tj43$createComponent, mergeProps as $8tj43$mergeProps, isServer as $8tj43$isServer, spread as $8tj43$spread, runHydrationEvents as $8tj43$runHydrationEvents, addEventListener as $8tj43$addEventListener, className as $8tj43$className, memo as $8tj43$memo, delegateEvents as $8tj43$delegateEvents, effect as $8tj43$effect, classList as $8tj43$classList, setAttribute as $8tj43$setAttribute, getNextMarker as $8tj43$getNextMarker, style as $8tj43$style, Dynamic as $8tj43$Dynamic, use as $8tj43$use } from "solid-js/web";
3
+ import { createMemo as $8tj43$createMemo, createResource as $8tj43$createResource, Suspense as $8tj43$Suspense, Show as $8tj43$Show, createSignal as $8tj43$createSignal, createRenderEffect as $8tj43$createRenderEffect, createRoot as $8tj43$createRoot, onCleanup as $8tj43$onCleanup, For as $8tj43$For, getOwner as $8tj43$getOwner, runWithOwner as $8tj43$runWithOwner, createEffect as $8tj43$createEffect, untrack as $8tj43$untrack, createComputed as $8tj43$createComputed, ErrorBoundary as $8tj43$ErrorBoundary, Index as $8tj43$Index, on as $8tj43$on, batch as $8tj43$batch, createReaction as $8tj43$createReaction } from "solid-js";
4
+ import { slider_fractional_factory as $8tj43$slider_fractional_factory } from "@depict-ai/utilishared/latest/ES10";
4
5
  import $8tj43$babelruntimehelpersclassPrivateFieldSet from "@babel/runtime/helpers/classPrivateFieldSet";
5
6
  import $8tj43$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpers/classPrivateFieldGet";
6
7
  import $8tj43$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/defineProperty";
@@ -8,7 +9,685 @@ import $8tj43$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/def
8
9
  /*! Depict.ai search and product listing SDK */
9
10
  import { register_es_version } from "../multi_import_deduplicator.mjs";
10
11
  register_es_version("ui", "ES10");
11
- const $8db9a15135765c11$export$83d89fbfd8236492 = "1.4.22";
12
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "1.4.24";
13
+ const $a9c7ba6087881ac2$var$transform_elements = sorted_cols_at_size => {
14
+ const cols_at_size = [];
15
+ for (let i = 0; i < sorted_cols_at_size.length; i++) {
16
+ var _sorted_cols_at_size;
17
+ const [nb_cols, width] = sorted_cols_at_size[i];
18
+ const next_width = (_sorted_cols_at_size = sorted_cols_at_size[i + 1]) === null || _sorted_cols_at_size === void 0 ? void 0 : _sorted_cols_at_size[1];
19
+ const max_width = i === 0 ? "" : "".concat(width, "px");
20
+ const min_width = next_width !== undefined ? "".concat(next_width + 1, "px") : "";
21
+ const col_at_size = [nb_cols, min_width, max_width];
22
+ cols_at_size.push(col_at_size);
23
+ }
24
+ return cols_at_size;
25
+ };
26
+ const $a9c7ba6087881ac2$export$6daf8749b65a1b77 = cols_at_size => {
27
+ // Check that every element is an array
28
+ const are_arrays = cols_at_size.every(element => Array.isArray(element));
29
+ if (!are_arrays) throw new Error("Every element in cols_at_size must be an array");
30
+ // Check width duplicates
31
+ const widths = cols_at_size.map(_ref => {
32
+ let [_, width] = _ref;
33
+ return width;
34
+ });
35
+ const widths_set = new Set(widths);
36
+ if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
37
+ if (cols_at_size.length === 1) {
38
+ const [nb_cols, width] = cols_at_size[0];
39
+ const max_width = width !== undefined ? "".concat(width, "px") : "";
40
+ return [[nb_cols, "", max_width]];
41
+ }
42
+ // Sort widths in ascending order
43
+ const sorted_cols_at_size = [...cols_at_size].sort((a, b) => {
44
+ const [_b, width_A] = a;
45
+ const [_a, width_b] = b;
46
+ if (width_A === undefined) return -1;
47
+ if (width_b === undefined) return 1;
48
+ return width_b - width_A;
49
+ });
50
+ return $a9c7ba6087881ac2$var$transform_elements(sorted_cols_at_size);
51
+ };
52
+
53
+ /**
54
+ * 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
55
+ */
56
+ function $3f7203368ad0d3ca$export$ff7109b9b2b206ba(sdk_cols_at_size) {
57
+ let min_width_for_more_than_one_column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
58
+ if (!sdk_cols_at_size.length) return sdk_cols_at_size;
59
+ const sorted_sizes = sdk_cols_at_size.map(_ref => {
60
+ let [cols, max_width] = _ref;
61
+ return [cols, max_width !== null && max_width !== void 0 ? max_width : Infinity];
62
+ }).sort((_ref2, _ref3) => {
63
+ let [, a] = _ref2;
64
+ let [, b] = _ref3;
65
+ return a - b;
66
+ });
67
+ const [[, smallest_max_width]] = sorted_sizes;
68
+ if (smallest_max_width > min_width_for_more_than_one_column)
69
+ // If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
70
+ return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
71
+ const to_delete = [];
72
+ for (let i = 0; i < sorted_sizes.length; i++) {
73
+ const [, max_width] = sorted_sizes[i];
74
+ if (max_width > min_width_for_more_than_one_column) continue;
75
+ to_delete.push(i);
76
+ }
77
+ while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
78
+ sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
79
+ return sorted_sizes.map(_ref4 => {
80
+ let [cols, max_width] = _ref4;
81
+ return max_width == Infinity ? [cols] : [cols, max_width];
82
+ });
83
+ }
84
+ function $ca55612a53dbbdd2$export$a2cc176055f8f08() {
85
+ 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.";
86
+ return (0, $8tj43$isServer) ? "<!-- ".concat(text, " -->") : document.createComment(text);
87
+ }
88
+ function $cb64b315b25cfc59$export$2f0cbfbb4354bb52(elements) {
89
+ // FYI this probably doesn't work on hugely deep nestings or large amount of elements
90
+ return $8tj43$createMemo(() => $cb64b315b25cfc59$var$unwrapping_helper(elements));
91
+ }
92
+ function $cb64b315b25cfc59$var$unwrapping_helper(elements) {
93
+ const result = [];
94
+ if (Array.isArray(elements)) for (let i = 0; i < elements.length; i++) {
95
+ const element = elements[i];
96
+ result.push(...$cb64b315b25cfc59$var$unwrapping_helper(element));
97
+ } else if (typeof elements == "function") result.push(...$cb64b315b25cfc59$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
98
+ return result;
99
+ }
100
+ let $bdd80c7862246dc2$var$cached_placeholder_element;
101
+ let $bdd80c7862246dc2$var$rendering_cached_placeholder_element;
102
+ function $bdd80c7862246dc2$export$f33414a4df0afd3f(_ref) {
103
+ let {
104
+ product_card_template_: product_card_template_,
105
+ num_placeholders_: num_placeholders_
106
+ } = _ref;
107
+ const [get_elements, set_elements] = $8tj43$createSignal([]);
108
+ let existing_num = 0;
109
+ if (0, $8tj43$isServer)
110
+ // want to render simple placeholders on server, effects don't run there
111
+ return $8tj43$createMemo(() => Array.from({
112
+ length: num_placeholders_()
113
+ }).map(() => {
114
+ const template_result = product_card_template_(null, undefined);
115
+ // @ts-ignore
116
+ if (typeof (template_result === null || template_result === void 0 ? void 0 : template_result.then) !== "function") return template_result;
117
+ }));
118
+ $8tj43$createRenderEffect(() => {
119
+ const to_add = num_placeholders_() - existing_num;
120
+ if (to_add <= 0) return;
121
+ // 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.
122
+ // 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.
123
+ // 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.
124
+ set_elements(prev => [...prev, ...Array.from({
125
+ length: to_add
126
+ }).map(() => $bdd80c7862246dc2$var$Placeholder({
127
+ product_card_template_: product_card_template_
128
+ }))]);
129
+ existing_num += to_add;
130
+ });
131
+ return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
132
+ }
133
+ /**
134
+ * Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
135
+ */
136
+ function $bdd80c7862246dc2$var$Placeholder(_ref2) {
137
+ let {
138
+ product_card_template_: product_card_template_
139
+ } = _ref2;
140
+ const get_cloned_placeholders = function () {
141
+ let element_to_clone = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : $bdd80c7862246dc2$var$cached_placeholder_element;
142
+ return Array.isArray(element_to_clone) ? element_to_clone.map(el => el instanceof Node ? el.cloneNode(true) : el) : element_to_clone;
143
+ };
144
+ if ($bdd80c7862246dc2$var$cached_placeholder_element) return get_cloned_placeholders();
145
+ let dispose_original_copy;
146
+ const get_unwrapped_element = $8tj43$createRoot(dispose => {
147
+ dispose_original_copy = dispose;
148
+ // if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
149
+ const [resource] = $8tj43$createResource(() => {
150
+ if ($bdd80c7862246dc2$var$rendering_cached_placeholder_element) return $bdd80c7862246dc2$var$rendering_cached_placeholder_element;
151
+ const return_value = product_card_template_(null, undefined);
152
+ if (typeof return_value === "object" && typeof (return_value === null || return_value === void 0 ? void 0 : return_value.then) === "function")
153
+ // Is Promise or promise-like object
154
+ $bdd80c7862246dc2$var$rendering_cached_placeholder_element = return_value;
155
+ return return_value;
156
+ });
157
+ return $8tj43$createMemo(() => {
158
+ if (resource.loading) return () => [];
159
+ return $cb64b315b25cfc59$export$2f0cbfbb4354bb52(resource);
160
+ });
161
+ });
162
+ $8tj43$onCleanup(() => {
163
+ if ($bdd80c7862246dc2$var$rendering_cached_placeholder_element) {
164
+ var _rendering_cached_pla;
165
+ // 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
166
+ const unset_current_rendering = () => {
167
+ dispose_original_copy();
168
+ $bdd80c7862246dc2$var$rendering_cached_placeholder_element = undefined;
169
+ };
170
+ (_rendering_cached_pla = $bdd80c7862246dc2$var$rendering_cached_placeholder_element) === null || _rendering_cached_pla === void 0 || _rendering_cached_pla.then(unset_current_rendering, unset_current_rendering);
171
+ } else
172
+ // Otherwise, just make sure we've disposed our root
173
+ dispose_original_copy();
174
+ });
175
+ return $8tj43$createMemo(() => {
176
+ const unwrapped_array = get_unwrapped_element()();
177
+ if (!(unwrapped_array !== null && unwrapped_array !== void 0 && unwrapped_array.length) || !unwrapped_array.every(item => item))
178
+ // Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
179
+ return;
180
+ // placeholders have finished rendering, freeze the elements
181
+ // 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
182
+ $bdd80c7862246dc2$var$cached_placeholder_element || ($bdd80c7862246dc2$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
183
+ $bdd80c7862246dc2$var$rendering_cached_placeholder_element = undefined;
184
+ dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
185
+ 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
186
+ });
187
+ }
188
+
189
+ /**
190
+ * Gets product_id (the thing we key the rendering on) from a display
191
+ */
192
+ function $6a4c7ed6d005505c$export$548d053aba053d79(display) {
193
+ if ("variant_index" in display) {
194
+ const actual_display = display.variant_displays[display.variant_index];
195
+ return actual_display.product_id;
196
+ }
197
+ return display.product_id;
198
+ }
199
+ function $2d7bad8684bc7f44$export$7f8bd308237ab5a5(get_displays_) {
200
+ const displays_by_key_ = $8tj43$createMemo(() => {
201
+ const displays = get_displays_();
202
+ // We key by product_id because that's what can be used to uniquely identify products
203
+ // This way <For> can optimize the rendering
204
+ const map = new Map();
205
+ for (let i = 0; i < displays.length; i++) {
206
+ const display = displays[i];
207
+ const product_id = $6a4c7ed6d005505c$export$548d053aba053d79(display);
208
+ map.set(product_id, display);
209
+ }
210
+ return map;
211
+ });
212
+ return displays_by_key_;
213
+ }
214
+ function $2d7bad8684bc7f44$export$43f0fb951fcb0c54(_ref) {
215
+ let {
216
+ displays_by_key_: displays_by_key_,
217
+ merchant_: merchant_,
218
+ market_: market_,
219
+ product_card_template_: product_card_template_,
220
+ do_per_elements_: do_per_elements_
221
+ } = _ref;
222
+ return $8tj43$createComponent((0, $8tj43$For), {
223
+ get each() {
224
+ return [...displays_by_key_().keys()];
225
+ },
226
+ children: (product_id, index) => {
227
+ const owner = $8tj43$getOwner();
228
+ const display_accessor = $8tj43$createMemo(() => displays_by_key_().get(product_id));
229
+ const [product_card_resource] = $8tj43$createResource(display_accessor,
230
+ // re-render when the reference to the display object changes
231
+ // this should only be the case when the merchant or market changes and the new request has completed
232
+ display => {
233
+ // get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
234
+ return product_card_template_(display, {
235
+ set_on_index_change: fn => $8tj43$runWithOwner(owner, () => $8tj43$createEffect(() => fn(index()))),
236
+ merchant: $8tj43$untrack(merchant_),
237
+ // 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
238
+ market: $8tj43$untrack(market_) // recommendation_grid can provide a sneaky undefined here just FYI
239
+ });
240
+ });
241
+
242
+ const node_accessor = $cb64b315b25cfc59$export$2f0cbfbb4354bb52(product_card_resource);
243
+ $8tj43$createEffect(() => {
244
+ const product_card_nodes = node_accessor();
245
+ const display = display_accessor();
246
+ const elements = [];
247
+ for (let i = 0; i < product_card_nodes.length; i++) {
248
+ const element = product_card_nodes[i];
249
+ if (!(element instanceof Element)) continue;
250
+ elements.push(element);
251
+ // Add tracking ids
252
+ if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
253
+ const {
254
+ dataset: dataset
255
+ } = element;
256
+ const {
257
+ search_result_id: search_result_id,
258
+ product_listing_result_id: product_listing_result_id,
259
+ recommendation_id: recommendation_id
260
+ } = display;
261
+ 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;
262
+ }
263
+ do_per_elements_ === null || do_per_elements_ === void 0 || do_per_elements_(elements, index);
264
+ });
265
+ return product_card_resource; // https://github.com/solidjs/solid/releases/tag/v1.7.0
266
+ }
267
+ });
268
+ }
269
+
270
+ // Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
271
+ class $f3b7124b76123e44$export$e1d52e4f0c7557a1 extends Error {}
272
+ class $f3b7124b76123e44$export$aa14a9f43128f61f extends $f3b7124b76123e44$export$e1d52e4f0c7557a1 {
273
+ constructor(templateError) {
274
+ super("Uncaught error in product card template", {
275
+ cause: templateError
276
+ });
277
+ }
278
+ }
279
+ const $74777e8fe65b3dcb$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div></div>`, 2);
280
+ function $74777e8fe65b3dcb$export$b69d0d92862de18b(props) {
281
+ return $8tj43$ErrorBoundary({
282
+ fallback(err, retry) {
283
+ var _props$on_error_;
284
+ const {
285
+ message_: message_,
286
+ severity_: severity_
287
+ } = props;
288
+ let message = message_;
289
+ if (err instanceof (0, $f3b7124b76123e44$export$aa14a9f43128f61f)) {
290
+ console.error(err.cause);
291
+ message = "".concat(message, ": ").concat(err.message);
292
+ } else $8tj43$report([err, message_], severity_);
293
+ (_props$on_error_ = props.on_error_) === null || _props$on_error_ === void 0 || _props$on_error_.call(props, retry);
294
+ return (() => {
295
+ const _el$ = $8tj43$getNextElement($74777e8fe65b3dcb$var$_tmpl$);
296
+ $8tj43$insert(_el$, message);
297
+ $8tj43$effect(_$p => {
298
+ var _props$class_list_;
299
+ return $8tj43$classList(_el$, Object.fromEntries(((_props$class_list_ = props.class_list_) === null || _props$class_list_ === void 0 ? void 0 : _props$class_list_.map(c => [c, true])) || []), _$p);
300
+ });
301
+ return _el$;
302
+ })();
303
+ },
304
+ get children() {
305
+ return props.children;
306
+ }
307
+ });
308
+ }
309
+ const $63f1f8dbcd07d3b0$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div></div>`, 2),
310
+ $63f1f8dbcd07d3b0$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<style type="text/css"></style>`, 2);
311
+ function $63f1f8dbcd07d3b0$export$d21e32dfedac04be(props) {
312
+ const container_element_ = (() => {
313
+ const _el$ = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$);
314
+ $8tj43$spread(_el$, $8tj43$mergeProps(() => props.element_attributes), false, true);
315
+ $8tj43$insert(_el$, () => props.children);
316
+ $8tj43$runHydrationEvents();
317
+ return _el$;
318
+ })(); // Don't want this in the error boundary below, it should only be for the actual layouting
319
+ return $8tj43$createComponent((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
320
+ get message_() {
321
+ return "Failed calculating " + props.layout + " layout";
322
+ },
323
+ severity_: "error",
324
+ get children() {
325
+ return $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, container_element_);
326
+ }
327
+ });
328
+ }
329
+ function $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, container_element) {
330
+ let insert_after_container = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
331
+ // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
332
+ const show_all_rows = $8tj43$createMemo(() => props.rows === "all");
333
+ const rows_or_empty_object = $8tj43$createMemo(() => show_all_rows() ? {} : props.rows);
334
+ const view_more_button_elements = $cb64b315b25cfc59$export$2f0cbfbb4354bb52($8tj43$createMemo(() => rows_or_empty_object().button));
335
+ const view_less_button_elements = $cb64b315b25cfc59$export$2f0cbfbb4354bb52($8tj43$createMemo(() => rows_or_empty_object().view_less_button));
336
+ const have_a_view_more_button = $8tj43$createMemo(() => {
337
+ const button = view_more_button_elements();
338
+ return !(!button || Array.isArray(button) && !button.length);
339
+ });
340
+ const have_a_view_less_button = $8tj43$createMemo(() => {
341
+ const button = view_less_button_elements();
342
+ return !(!button || Array.isArray(button) && !button.length);
343
+ });
344
+ const [get_styling, set_styling] = $8tj43$createSignal();
345
+ const container_class = $8tj43$make_random_classname();
346
+ const selector_beginning = ".depict .".concat(container_class, ">"); // class so ppl can have id if needed
347
+ const [get_children_count, set_children_count] = $8tj43$createSignal(0);
348
+ const update_children_count = () => set_children_count(container_element.children.length);
349
+ const col_styling = $8tj43$createMemo(() => $8tj43$n_col_styling_with_dist(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
350
+ const default_currently_visible_signal = $8tj43$createSignal($8tj43$untrack(() => {
351
+ var _rows_or_empty_object;
352
+ return (_rows_or_empty_object = rows_or_empty_object().start_rows) !== null && _rows_or_empty_object !== void 0 ? _rows_or_empty_object : 1;
353
+ })); // 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
354
+ const rows_visible_signal = $8tj43$createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
355
+ const get_rows_visible = $8tj43$createMemo(() => rows_visible_signal()[0]());
356
+ const set_rows_visible = $8tj43$createMemo(() => rows_visible_signal()[1]);
357
+ const view_more_button_class = $8tj43$make_random_classname();
358
+ const view_less_button_class = $8tj43$make_random_classname();
359
+ const style_element = (() => {
360
+ const _el$2 = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$2);
361
+ $8tj43$insert(_el$2, get_styling);
362
+ return _el$2;
363
+ })();
364
+ const view_more_button_container = $8tj43$createMemo(() => have_a_view_more_button() && (() => {
365
+ const _el$3 = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$);
366
+ $8tj43$addEventListener(_el$3, "click", $8tj43$catchify(() => set_rows_visible()(prev => {
367
+ var _rows_or_empty_object2;
368
+ return prev + ((_rows_or_empty_object2 = rows_or_empty_object().rows_per_click) !== null && _rows_or_empty_object2 !== void 0 ? _rows_or_empty_object2 : 1);
369
+ })), true);
370
+ $8tj43$className(_el$3, "load-more-container ".concat(view_more_button_class));
371
+ $8tj43$insert(_el$3, () => rows_or_empty_object().button);
372
+ $8tj43$runHydrationEvents();
373
+ return _el$3;
374
+ })());
375
+ // 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
376
+ const view_less_button_container = $8tj43$createMemo(() => have_a_view_less_button() && (() => {
377
+ const _el$4 = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$);
378
+ $8tj43$addEventListener(_el$4, "click", $8tj43$catchify(() => set_rows_visible()(() => {
379
+ var _rows_or_empty_object3;
380
+ return (_rows_or_empty_object3 = rows_or_empty_object().start_rows) !== null && _rows_or_empty_object3 !== void 0 ? _rows_or_empty_object3 : 1;
381
+ })), true);
382
+ $8tj43$className(_el$4, "load-less-container ".concat(view_less_button_class));
383
+ $8tj43$insert(_el$4, () => rows_or_empty_object().view_less_button);
384
+ $8tj43$runHydrationEvents();
385
+ return _el$4;
386
+ })());
387
+ container_element.classList.add(container_class);
388
+ $8tj43$createComputed(() => {
389
+ // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
390
+ const rows_visible = get_rows_visible();
391
+ const max_rows = rows_or_empty_object().max_rows;
392
+ if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
393
+ });
394
+ $8tj43$createRenderEffect(() => {
395
+ // Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
396
+ if (show_all_rows()) {
397
+ // no view more functionality requested
398
+ set_styling(() => col_styling);
399
+ return;
400
+ }
401
+ update_children_count();
402
+ const mutation_observer = new MutationObserver($8tj43$catchify(update_children_count));
403
+ mutation_observer.observe(container_element, {
404
+ childList: true
405
+ });
406
+ $8tj43$onCleanup(() => mutation_observer.disconnect());
407
+ set_styling(
408
+ // this is needed because solid will think that the memo-accessor is a setter function otherwise
409
+ () => $8tj43$createMemo(() => {
410
+ const {
411
+ rows_per_click: rows_per_click,
412
+ max_rows = -1,
413
+ start_rows: start_rows
414
+ } = rows_or_empty_object();
415
+ const rows_visible = get_rows_visible();
416
+ const children_count = get_children_count();
417
+ return col_styling() + props.cols_at_size.map(options => {
418
+ const [recs_per_row, min, max] = options;
419
+ let should_hide_view_more_button;
420
+ let visible_recs;
421
+ if (props.disable_partial_rows) {
422
+ visible_recs = $8tj43$layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
423
+ const visible_recs_next_show_more = $8tj43$layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
424
+ // Should this really be zero when we default rows_per_click to 1?
425
+ children_count, options);
426
+ should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
427
+ } else {
428
+ visible_recs = $8tj43$layout_get_total_rec_amount_for_row(rows_visible, options);
429
+ should_hide_view_more_button = visible_recs >= children_count;
430
+ }
431
+ const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
432
+ // 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
433
+ 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;
434
+ return "".concat($8tj43$layout_media_query_header(min, max), "{").concat(selector_beginning, ":nth-child(n+").concat(visible_recs + 1, "){display:none}").concat(props.layout == "slider" ? "".concat(selector_beginning, ":nth-child(n+").concat(visible_recs, "){margin-right:0}") : "").concat(should_hide_button_final ? ".depict .".concat(view_more_button_class, "{display:none!important}") : "").concat(should_hide_view_less_button ? ".depict .".concat(view_less_button_class, "{display:none!important}") : "", "}");
435
+ }).join("");
436
+ }));
437
+ });
438
+ if (insert_after_container) container_element.after(style_element);
439
+ return [container_element, $8tj43$memo(view_more_button_container), $8tj43$memo(view_less_button_container), style_element];
440
+ }
441
+ $8tj43$delegateEvents(["click"]);
442
+ const $ca6ab5f08bd28bca$var$_tmpl$ = /*#__PURE__*/$8tj43$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);
443
+ function $ca6ab5f08bd28bca$export$8be2714ec7f169ee() {
444
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
445
+ return (() => {
446
+ const _el$ = $8tj43$getNextElement($ca6ab5f08bd28bca$var$_tmpl$);
447
+ $8tj43$effect(_p$ => {
448
+ var _props$width_, _props$height_;
449
+ const _v$ = (_props$width_ = props.width_) !== null && _props$width_ !== void 0 ? _props$width_ : 14,
450
+ _v$2 = (_props$height_ = props.height_) !== null && _props$height_ !== void 0 ? _props$height_ : 26;
451
+ _v$ !== _p$._v$ && $8tj43$setAttribute(_el$, "width", _p$._v$ = _v$);
452
+ _v$2 !== _p$._v$2 && $8tj43$setAttribute(_el$, "height", _p$._v$2 = _v$2);
453
+ return _p$;
454
+ }, {
455
+ _v$: undefined,
456
+ _v$2: undefined
457
+ });
458
+ return _el$;
459
+ })();
460
+ }
461
+ const $002f09d00aac50b2$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div></div>`, 2);
462
+ function $002f09d00aac50b2$export$6649caad96ef8870(_ref) {
463
+ let {
464
+ children: children,
465
+ slider_ref_: slider_ref_,
466
+ faded_opacity_ = 0.7,
467
+ mutation_plugins_ = [],
468
+ disable_fading_: disable_fading_
469
+ } = _ref;
470
+ const slider = new (0, $8tj43$Amazing_Slider)({
471
+ button_contents: {
472
+ left: [(() => {
473
+ const _el$ = $8tj43$getNextElement($002f09d00aac50b2$var$_tmpl$);
474
+ $8tj43$insert(_el$, $8tj43$createComponent((0, $ca6ab5f08bd28bca$export$8be2714ec7f169ee), {}));
475
+ return _el$;
476
+ })()],
477
+ right: [(() => {
478
+ const _el$2 = $8tj43$getNextElement($002f09d00aac50b2$var$_tmpl$);
479
+ $8tj43$insert(_el$2, $8tj43$createComponent((0, $ca6ab5f08bd28bca$export$8be2714ec7f169ee), {}));
480
+ return _el$2;
481
+ })()]
482
+ },
483
+ constructor_plugins: [$8tj43$slider_snap_css().constructor_plugin],
484
+ mutation_plugins: [...(disable_fading_ ? [] : [$8tj43$slider_fading_factory({
485
+ threshold_: 0.96,
486
+ faded_opacity_: faded_opacity_
487
+ }).mutation_plugin_]), ...mutation_plugins_]
488
+ });
489
+ $8tj43$insert(slider.insert_here, children);
490
+ $8tj43$onCleanup(() => slider.observer.disconnect());
491
+ slider_ref_ === null || slider_ref_ === void 0 || slider_ref_(slider);
492
+ return slider.container;
493
+ }
494
+ function $39ddb986053fb759$export$d41d19e89346fa2(_ref) {
495
+ let {
496
+ recommendations_resource_: recommendations_resource_,
497
+ product_card_template_: product_card_template_,
498
+ layout_options_: layout_options_,
499
+ merchant_: merchant_,
500
+ market_: market_
501
+ } = _ref;
502
+ const is_showing_something = $8tj43$createMemo(() => {
503
+ var _recommendations_reso;
504
+ return recommendations_resource_.loading || ((_recommendations_reso = recommendations_resource_()) === null || _recommendations_reso === void 0 ? void 0 : _recommendations_reso.length);
505
+ });
506
+ const num_placeholders_ = () => 20;
507
+ const slider = $8tj43$createComponent((0, $002f09d00aac50b2$export$6649caad96ef8870), {
508
+ disable_fading_: true,
509
+ slider_ref_: slider => {
510
+ const {
511
+ insert_here: insert_here
512
+ } = slider;
513
+ const Layout = props => $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, insert_here, true);
514
+ // Do like this, so we don't have to call mergeProps ourselves
515
+ $8tj43$createComponent(Layout, $8tj43$mergeProps({
516
+ rows: "all",
517
+ layout: "slider"
518
+ }, layout_options_));
519
+ $8tj43$slider_fractional_factory(0, 0.75).constructor_plugin.call(slider, {}); // enable fractional scrolling
520
+ insert_here.before($ca55612a53dbbdd2$export$a2cc176055f8f08());
521
+ },
522
+ get children() {
523
+ return $8tj43$createComponent((0, $8tj43$Suspense), {
524
+ get fallback() {
525
+ return $bdd80c7862246dc2$export$f33414a4df0afd3f({
526
+ num_placeholders_: num_placeholders_,
527
+ product_card_template_: product_card_template_
528
+ });
529
+ },
530
+ get children() {
531
+ return (() => {
532
+ // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
533
+ const displays_by_key_ = $2d7bad8684bc7f44$export$7f8bd308237ab5a5($8tj43$createMemo(() => recommendations_resource_() || []));
534
+ return $2d7bad8684bc7f44$export$43f0fb951fcb0c54({
535
+ displays_by_key_: displays_by_key_,
536
+ merchant_: merchant_,
537
+ market_: market_,
538
+ product_card_template_: product_card_template_
539
+ });
540
+ })();
541
+ }
542
+ });
543
+ }
544
+ });
545
+ return $8tj43$createComponent((0, $8tj43$Show), {
546
+ get when() {
547
+ return is_showing_something();
548
+ },
549
+ children: slider
550
+ });
551
+ }
552
+ const $d5d7e58c5c9d8db0$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class="depict recommendations"></div>`, 2);
553
+ function $d5d7e58c5c9d8db0$export$9574e176201e5e8d(props) {
554
+ const grid_spacing_override = $8tj43$createMemo(() => {
555
+ const {
556
+ grid_spacing: grid_spacing
557
+ } = props; // can be reactive
558
+ return typeof grid_spacing === "string" ? {
559
+ grid_spacing: grid_spacing
560
+ } : {
561
+ override_vertical_spacing: grid_spacing.vertical,
562
+ grid_spacing: grid_spacing.horizontal
563
+ };
564
+ });
565
+ const [recommendations_resource_] = $8tj43$createResource(() => props.recommendations, recs => recs);
566
+ return (() => {
567
+ const _el$ = $8tj43$getNextElement($d5d7e58c5c9d8db0$var$_tmpl$);
568
+ $8tj43$insert(_el$, () => $39ddb986053fb759$export$d41d19e89346fa2({
569
+ product_card_template_: function () {
570
+ return props.product_card_template(...arguments);
571
+ },
572
+ recommendations_resource_: recommendations_resource_,
573
+ market_: () => props.market,
574
+ merchant_: () => props.merchant,
575
+ layout_options_: $8tj43$createMemo(() => ({
576
+ cols_at_size: $a9c7ba6087881ac2$export$6daf8749b65a1b77($3f7203368ad0d3ca$export$ff7109b9b2b206ba(props.cols_at_size)),
577
+ ...grid_spacing_override()
578
+ }))
579
+ }));
580
+ return _el$;
581
+ })();
582
+ }
583
+ const $e3efeb558d952696$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class="recommendation-grid"><!#><!/><!#><!/></div>`, 6);
584
+ function $e3efeb558d952696$export$7da560f849543dff(_ref) {
585
+ let {
586
+ recommendations_resource_: recommendations_resource_,
587
+ product_card_template_: product_card_template_,
588
+ layout_options_: layout_options_,
589
+ merchant_: merchant_,
590
+ market_: market_,
591
+ rows_object_: rows_object_
592
+ } = _ref;
593
+ const is_showing_something = $8tj43$createMemo(() => {
594
+ var _recommendations_reso;
595
+ return recommendations_resource_.loading || ((_recommendations_reso = recommendations_resource_()) === null || _recommendations_reso === void 0 ? void 0 : _recommendations_reso.length);
596
+ });
597
+ const num_placeholders_ = () => 20;
598
+ return $8tj43$createComponent((0, $8tj43$Show), {
599
+ get when() {
600
+ return is_showing_something();
601
+ },
602
+ get children() {
603
+ const _el$ = $8tj43$getNextElement($e3efeb558d952696$var$_tmpl$),
604
+ _el$2 = _el$.firstChild,
605
+ [_el$3, _co$] = $8tj43$getNextMarker(_el$2.nextSibling),
606
+ _el$4 = _el$3.nextSibling,
607
+ [_el$5, _co$2] = $8tj43$getNextMarker(_el$4.nextSibling);
608
+ $8tj43$insert(_el$, (0, $ca55612a53dbbdd2$export$a2cc176055f8f08), _el$3, _co$);
609
+ $8tj43$insert(_el$, $8tj43$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), $8tj43$mergeProps({
610
+ get rows() {
611
+ return rows_object_();
612
+ },
613
+ layout: "grid",
614
+ element_attributes: {
615
+ class: "cards"
616
+ }
617
+ }, layout_options_, {
618
+ get children() {
619
+ return $8tj43$createComponent((0, $8tj43$Suspense), {
620
+ get fallback() {
621
+ return $bdd80c7862246dc2$export$f33414a4df0afd3f({
622
+ num_placeholders_: num_placeholders_,
623
+ product_card_template_: product_card_template_
624
+ });
625
+ },
626
+ get children() {
627
+ return (() => {
628
+ // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
629
+ const displays_by_key_ = $2d7bad8684bc7f44$export$7f8bd308237ab5a5($8tj43$createMemo(() => recommendations_resource_() || []));
630
+ return $2d7bad8684bc7f44$export$43f0fb951fcb0c54({
631
+ displays_by_key_: displays_by_key_,
632
+ merchant_: merchant_,
633
+ market_: market_,
634
+ product_card_template_: product_card_template_
635
+ });
636
+ })();
637
+ }
638
+ });
639
+ }
640
+ })), _el$5, _co$2);
641
+ return _el$;
642
+ }
643
+ });
644
+ }
645
+ const $b432b11321ad4c97$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<button class="show-more major" type="button"></button>`, 2),
646
+ $b432b11321ad4c97$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<div class="depict plp recommendations"></div>`, 2);
647
+ function $b432b11321ad4c97$export$9756467d34d91cdb(props) {
648
+ const rows_object_ = $8tj43$createMemo(() => {
649
+ const view_more_button = props.view_more_button;
650
+ if (!view_more_button) return "all";
651
+ return {
652
+ start_rows: view_more_button.start_rows,
653
+ rows_per_click: view_more_button.rows_per_click,
654
+ button: (() => {
655
+ const _el$ = $8tj43$getNextElement($b432b11321ad4c97$var$_tmpl$);
656
+ $8tj43$insert(_el$, () => view_more_button.text);
657
+ return _el$;
658
+ })()
659
+ };
660
+ });
661
+ const grid_spacing_override = $8tj43$createMemo(() => {
662
+ const {
663
+ grid_spacing: grid_spacing
664
+ } = props; // can be reactive
665
+ return typeof grid_spacing === "string" ? {
666
+ grid_spacing: grid_spacing
667
+ } : {
668
+ override_vertical_spacing: grid_spacing.vertical,
669
+ grid_spacing: grid_spacing.horizontal
670
+ };
671
+ });
672
+ const [recommendations_resource_] = $8tj43$createResource(() => props.recommendations, recs => recs);
673
+ return (() => {
674
+ const _el$2 = $8tj43$getNextElement($b432b11321ad4c97$var$_tmpl$2);
675
+ $8tj43$insert(_el$2, () => $e3efeb558d952696$export$7da560f849543dff({
676
+ rows_object_: rows_object_,
677
+ product_card_template_: function () {
678
+ return props.product_card_template(...arguments);
679
+ },
680
+ recommendations_resource_: recommendations_resource_,
681
+ market_: () => props.market,
682
+ merchant_: () => props.merchant,
683
+ layout_options_: $8tj43$createMemo(() => ({
684
+ cols_at_size: $a9c7ba6087881ac2$export$6daf8749b65a1b77($3f7203368ad0d3ca$export$ff7109b9b2b206ba(props.cols_at_size)),
685
+ ...grid_spacing_override()
686
+ }))
687
+ }));
688
+ return _el$2;
689
+ })();
690
+ }
12
691
  const $56047603f9d212b6$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<img>`, 1);
13
692
  function $56047603f9d212b6$export$e6fffe67d4cdd848(whatToWatch) {
14
693
  const [size, setSize] = $8tj43$createSignal(0);
@@ -65,46 +744,6 @@ function $801e8845d3fa3653$export$94026ee33dbabc26(props) {
65
744
  return _el$;
66
745
  })();
67
746
  }
68
-
69
- // Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
70
- class $f3b7124b76123e44$export$e1d52e4f0c7557a1 extends Error {}
71
- class $f3b7124b76123e44$export$aa14a9f43128f61f extends $f3b7124b76123e44$export$e1d52e4f0c7557a1 {
72
- constructor(templateError) {
73
- super("Uncaught error in product card template", {
74
- cause: templateError
75
- });
76
- }
77
- }
78
- const $74777e8fe65b3dcb$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div></div>`, 2);
79
- function $74777e8fe65b3dcb$export$b69d0d92862de18b(props) {
80
- return $8tj43$ErrorBoundary({
81
- fallback(err, retry) {
82
- var _props$on_error_;
83
- const {
84
- message_: message_,
85
- severity_: severity_
86
- } = props;
87
- let message = message_;
88
- if (err instanceof (0, $f3b7124b76123e44$export$aa14a9f43128f61f)) {
89
- console.error(err.cause);
90
- message = "".concat(message, ": ").concat(err.message);
91
- } else $8tj43$report([err, message_], severity_);
92
- (_props$on_error_ = props.on_error_) === null || _props$on_error_ === void 0 || _props$on_error_.call(props, retry);
93
- return (() => {
94
- const _el$ = $8tj43$getNextElement($74777e8fe65b3dcb$var$_tmpl$);
95
- $8tj43$insert(_el$, message);
96
- $8tj43$effect(_$p => {
97
- var _props$class_list_;
98
- return $8tj43$classList(_el$, Object.fromEntries(((_props$class_list_ = props.class_list_) === null || _props$class_list_ === void 0 ? void 0 : _props$class_list_.map(c => [c, true])) || []), _$p);
99
- });
100
- return _el$;
101
- })();
102
- },
103
- get children() {
104
- return props.children;
105
- }
106
- });
107
- }
108
747
  function $8e8b179489080711$export$5bad61ecde080b1f() {
109
748
  const {
110
749
  collapse: collapse,
@@ -224,57 +863,6 @@ function $60ec7a29849d81db$export$a71e92cfbb498adc(props) {
224
863
  return $8tj43$standard_price_format(props.price_, price_formatting.places_after_comma_, price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
225
864
  });
226
865
  }
227
- const $ca6ab5f08bd28bca$var$_tmpl$ = /*#__PURE__*/$8tj43$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);
228
- function $ca6ab5f08bd28bca$export$8be2714ec7f169ee() {
229
- let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
230
- return (() => {
231
- const _el$ = $8tj43$getNextElement($ca6ab5f08bd28bca$var$_tmpl$);
232
- $8tj43$effect(_p$ => {
233
- var _props$width_, _props$height_;
234
- const _v$ = (_props$width_ = props.width_) !== null && _props$width_ !== void 0 ? _props$width_ : 14,
235
- _v$2 = (_props$height_ = props.height_) !== null && _props$height_ !== void 0 ? _props$height_ : 26;
236
- _v$ !== _p$._v$ && $8tj43$setAttribute(_el$, "width", _p$._v$ = _v$);
237
- _v$2 !== _p$._v$2 && $8tj43$setAttribute(_el$, "height", _p$._v$2 = _v$2);
238
- return _p$;
239
- }, {
240
- _v$: undefined,
241
- _v$2: undefined
242
- });
243
- return _el$;
244
- })();
245
- }
246
- const $002f09d00aac50b2$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div></div>`, 2);
247
- function $002f09d00aac50b2$export$6649caad96ef8870(_ref) {
248
- let {
249
- children: children,
250
- slider_ref_: slider_ref_,
251
- faded_opacity_ = 0.7,
252
- mutation_plugins_ = []
253
- } = _ref;
254
- const slider = new (0, $8tj43$Amazing_Slider)({
255
- button_contents: {
256
- left: [(() => {
257
- const _el$ = $8tj43$getNextElement($002f09d00aac50b2$var$_tmpl$);
258
- $8tj43$insert(_el$, $8tj43$createComponent((0, $ca6ab5f08bd28bca$export$8be2714ec7f169ee), {}));
259
- return _el$;
260
- })()],
261
- right: [(() => {
262
- const _el$2 = $8tj43$getNextElement($002f09d00aac50b2$var$_tmpl$);
263
- $8tj43$insert(_el$2, $8tj43$createComponent((0, $ca6ab5f08bd28bca$export$8be2714ec7f169ee), {}));
264
- return _el$2;
265
- })()]
266
- },
267
- constructor_plugins: [$8tj43$slider_snap_css().constructor_plugin],
268
- mutation_plugins: [$8tj43$slider_fading_factory({
269
- threshold_: 0.96,
270
- faded_opacity_: faded_opacity_
271
- }).mutation_plugin_, ...mutation_plugins_]
272
- });
273
- $8tj43$insert(slider.insert_here, children);
274
- $8tj43$onCleanup(() => slider.observer.disconnect());
275
- slider_ref_ === null || slider_ref_ === void 0 || slider_ref_(slider);
276
- return slider.container;
277
- }
278
866
  const $a61a2051e15c8d7a$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div></div>`, 2);
279
867
  const $a61a2051e15c8d7a$var$closing_functions = /*@__PURE__*/new Set();
280
868
  const $a61a2051e15c8d7a$export$22970a0140fc759c = /*@__PURE__*/$8tj43$createSignal(false);
@@ -2815,161 +3403,19 @@ function $44aa24b1bb793549$var$modify_only_local_filter(local_filter_object, sel
2815
3403
  for (let i = 0; i < values.length; i++) {
2816
3404
  const value = values[i];
2817
3405
  if (!jsond_set_values.includes(JSON.stringify(value)))
2818
- // We want to remove the entry with this value from the filter object because it's not selected
2819
- indexes_to_remove.add(i);
2820
- }
2821
- new_meta.values = values.filter((_, index) => !indexes_to_remove.has(index));
2822
- if (new_meta.names) new_meta.names = new_meta.names.filter((_, index) => !indexes_to_remove.has(index));
2823
- if (new_meta.counts)
2824
- // remove counts that are too much, they're all zero anyway if they exist
2825
- new_meta.counts.length -= indexes_to_remove.size;
2826
- }
2827
- }
2828
- }
2829
- return modified_filter_object;
2830
- }
2831
- function $cb64b315b25cfc59$export$2f0cbfbb4354bb52(elements) {
2832
- // FYI this probably doesn't work on hugely deep nestings or large amount of elements
2833
- return $8tj43$createMemo(() => $cb64b315b25cfc59$var$unwrapping_helper(elements));
2834
- }
2835
- function $cb64b315b25cfc59$var$unwrapping_helper(elements) {
2836
- const result = [];
2837
- if (Array.isArray(elements)) for (let i = 0; i < elements.length; i++) {
2838
- const element = elements[i];
2839
- result.push(...$cb64b315b25cfc59$var$unwrapping_helper(element));
2840
- } else if (typeof elements == "function") result.push(...$cb64b315b25cfc59$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
2841
- return result;
2842
- }
2843
- const $63f1f8dbcd07d3b0$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div></div>`, 2),
2844
- $63f1f8dbcd07d3b0$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<style type="text/css"></style>`, 2);
2845
- function $63f1f8dbcd07d3b0$export$d21e32dfedac04be(props) {
2846
- const container_element_ = (() => {
2847
- const _el$ = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$);
2848
- $8tj43$spread(_el$, $8tj43$mergeProps(() => props.element_attributes), false, true);
2849
- $8tj43$insert(_el$, () => props.children);
2850
- $8tj43$runHydrationEvents();
2851
- return _el$;
2852
- })(); // Don't want this in the error boundary below, it should only be for the actual layouting
2853
- return $8tj43$createComponent((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
2854
- get message_() {
2855
- return "Failed calculating " + props.layout + " layout";
2856
- },
2857
- severity_: "error",
2858
- get children() {
2859
- return $63f1f8dbcd07d3b0$var$ActualSolidLayout(props, container_element_);
2860
- }
2861
- });
2862
- }
2863
- function $63f1f8dbcd07d3b0$var$ActualSolidLayout(props, container_element) {
2864
- // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
2865
- const show_all_rows = $8tj43$createMemo(() => props.rows === "all");
2866
- const rows_or_empty_object = $8tj43$createMemo(() => show_all_rows() ? {} : props.rows);
2867
- const view_more_button_elements = $cb64b315b25cfc59$export$2f0cbfbb4354bb52($8tj43$createMemo(() => rows_or_empty_object().button));
2868
- const view_less_button_elements = $cb64b315b25cfc59$export$2f0cbfbb4354bb52($8tj43$createMemo(() => rows_or_empty_object().view_less_button));
2869
- const have_a_view_more_button = $8tj43$createMemo(() => {
2870
- const button = view_more_button_elements();
2871
- return !(!button || Array.isArray(button) && !button.length);
2872
- });
2873
- const have_a_view_less_button = $8tj43$createMemo(() => {
2874
- const button = view_less_button_elements();
2875
- return !(!button || Array.isArray(button) && !button.length);
2876
- });
2877
- const [get_styling, set_styling] = $8tj43$createSignal();
2878
- const container_class = $8tj43$make_random_classname();
2879
- const selector_beginning = ".depict .".concat(container_class, ">"); // class so ppl can have id if needed
2880
- const [get_children_count, set_children_count] = $8tj43$createSignal(0);
2881
- const update_children_count = () => set_children_count(container_element.children.length);
2882
- const col_styling = $8tj43$createMemo(() => $8tj43$n_col_styling_with_dist(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
2883
- const default_currently_visible_signal = $8tj43$createSignal($8tj43$untrack(() => {
2884
- var _rows_or_empty_object;
2885
- return (_rows_or_empty_object = rows_or_empty_object().start_rows) !== null && _rows_or_empty_object !== void 0 ? _rows_or_empty_object : 1;
2886
- })); // 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
2887
- const rows_visible_signal = $8tj43$createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
2888
- const get_rows_visible = $8tj43$createMemo(() => rows_visible_signal()[0]());
2889
- const set_rows_visible = $8tj43$createMemo(() => rows_visible_signal()[1]);
2890
- const view_more_button_class = $8tj43$make_random_classname();
2891
- const view_less_button_class = $8tj43$make_random_classname();
2892
- const view_more_button_container = $8tj43$createMemo(() => have_a_view_more_button() && (() => {
2893
- const _el$2 = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$);
2894
- $8tj43$addEventListener(_el$2, "click", $8tj43$catchify(() => set_rows_visible()(prev => {
2895
- var _rows_or_empty_object2;
2896
- return prev + ((_rows_or_empty_object2 = rows_or_empty_object().rows_per_click) !== null && _rows_or_empty_object2 !== void 0 ? _rows_or_empty_object2 : 1);
2897
- })), true);
2898
- $8tj43$className(_el$2, "load-more-container ".concat(view_more_button_class));
2899
- $8tj43$insert(_el$2, () => rows_or_empty_object().button);
2900
- $8tj43$runHydrationEvents();
2901
- return _el$2;
2902
- })());
2903
- // 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
2904
- const view_less_button_container = $8tj43$createMemo(() => have_a_view_less_button() && (() => {
2905
- const _el$3 = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$);
2906
- $8tj43$addEventListener(_el$3, "click", $8tj43$catchify(() => set_rows_visible()(() => {
2907
- var _rows_or_empty_object3;
2908
- return (_rows_or_empty_object3 = rows_or_empty_object().start_rows) !== null && _rows_or_empty_object3 !== void 0 ? _rows_or_empty_object3 : 1;
2909
- })), true);
2910
- $8tj43$className(_el$3, "load-less-container ".concat(view_less_button_class));
2911
- $8tj43$insert(_el$3, () => rows_or_empty_object().view_less_button);
2912
- $8tj43$runHydrationEvents();
2913
- return _el$3;
2914
- })());
2915
- container_element.classList.add(container_class);
2916
- $8tj43$createComputed(() => {
2917
- // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
2918
- const rows_visible = get_rows_visible();
2919
- const max_rows = rows_or_empty_object().max_rows;
2920
- if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
2921
- });
2922
- $8tj43$createRenderEffect(() => {
2923
- // Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
2924
- if (show_all_rows()) {
2925
- // no view more functionality requested
2926
- set_styling(() => col_styling);
2927
- return;
2928
- }
2929
- update_children_count();
2930
- const mutation_observer = new MutationObserver($8tj43$catchify(update_children_count));
2931
- mutation_observer.observe(container_element, {
2932
- childList: true
2933
- });
2934
- $8tj43$onCleanup(() => mutation_observer.disconnect());
2935
- set_styling(
2936
- // this is needed because solid will think that the memo-accessor is a setter function otherwise
2937
- () => $8tj43$createMemo(() => {
2938
- const {
2939
- rows_per_click: rows_per_click,
2940
- max_rows = -1,
2941
- start_rows: start_rows
2942
- } = rows_or_empty_object();
2943
- const rows_visible = get_rows_visible();
2944
- const children_count = get_children_count();
2945
- return col_styling() + props.cols_at_size.map(options => {
2946
- const [recs_per_row, min, max] = options;
2947
- let should_hide_view_more_button;
2948
- let visible_recs;
2949
- if (props.disable_partial_rows) {
2950
- visible_recs = $8tj43$layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
2951
- const visible_recs_next_show_more = $8tj43$layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
2952
- // Should this really be zero when we default rows_per_click to 1?
2953
- children_count, options);
2954
- should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
2955
- } else {
2956
- visible_recs = $8tj43$layout_get_total_rec_amount_for_row(rows_visible, options);
2957
- should_hide_view_more_button = visible_recs >= children_count;
2958
- }
2959
- const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
2960
- // 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
2961
- 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;
2962
- return "".concat($8tj43$layout_media_query_header(min, max), "{").concat(selector_beginning, ":nth-child(n+").concat(visible_recs + 1, "){display:none}").concat(props.layout == "slider" ? "".concat(selector_beginning, ":nth-child(n+").concat(visible_recs, "){margin-right:0}") : "").concat(should_hide_button_final ? ".depict .".concat(view_more_button_class, "{display:none!important}") : "").concat(should_hide_view_less_button ? ".depict .".concat(view_less_button_class, "{display:none!important}") : "", "}");
2963
- }).join("");
2964
- }));
2965
- });
2966
- return [container_element, $8tj43$memo(view_more_button_container), $8tj43$memo(view_less_button_container), (() => {
2967
- const _el$4 = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$2);
2968
- $8tj43$insert(_el$4, get_styling);
2969
- return _el$4;
2970
- })()];
3406
+ // We want to remove the entry with this value from the filter object because it's not selected
3407
+ indexes_to_remove.add(i);
3408
+ }
3409
+ new_meta.values = values.filter((_, index) => !indexes_to_remove.has(index));
3410
+ if (new_meta.names) new_meta.names = new_meta.names.filter((_, index) => !indexes_to_remove.has(index));
3411
+ if (new_meta.counts)
3412
+ // remove counts that are too much, they're all zero anyway if they exist
3413
+ new_meta.counts.length -= indexes_to_remove.size;
3414
+ }
3415
+ }
3416
+ }
3417
+ return modified_filter_object;
2971
3418
  }
2972
- $8tj43$delegateEvents(["click"]);
2973
3419
  async function $d5f1e6a0f9117286$export$79b1565500412d9b(search_modal, modal_fn_opts) {
2974
3420
  const body = await (0, $8tj43$observer).wait_for_element("body");
2975
3421
  let dispose_and_remove;
@@ -3745,98 +4191,6 @@ function $94af29837186eb21$export$ef6006467f04ee41(_ref) {
3745
4191
  })()];
3746
4192
  }
3747
4193
  $8tj43$delegateEvents(["click"]);
3748
- function $ca55612a53dbbdd2$export$a2cc176055f8f08() {
3749
- 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.";
3750
- return (0, $8tj43$isServer) ? "<!-- ".concat(text, " -->") : document.createComment(text);
3751
- }
3752
- let $bdd80c7862246dc2$var$cached_placeholder_element;
3753
- let $bdd80c7862246dc2$var$rendering_cached_placeholder_element;
3754
- function $bdd80c7862246dc2$export$f33414a4df0afd3f(_ref) {
3755
- let {
3756
- product_card_template_: product_card_template_,
3757
- num_placeholders_: num_placeholders_
3758
- } = _ref;
3759
- const [get_elements, set_elements] = $8tj43$createSignal([]);
3760
- let existing_num = 0;
3761
- if (0, $8tj43$isServer)
3762
- // want to render simple placeholders on server, effects don't run there
3763
- return $8tj43$createMemo(() => Array.from({
3764
- length: num_placeholders_()
3765
- }).map(() => {
3766
- const template_result = product_card_template_(null, undefined);
3767
- // @ts-ignore
3768
- if (typeof (template_result === null || template_result === void 0 ? void 0 : template_result.then) !== "function") return template_result;
3769
- }));
3770
- $8tj43$createRenderEffect(() => {
3771
- const to_add = num_placeholders_() - existing_num;
3772
- if (to_add <= 0) return;
3773
- // 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.
3774
- // 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.
3775
- // 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.
3776
- set_elements(prev => [...prev, ...Array.from({
3777
- length: to_add
3778
- }).map(() => $bdd80c7862246dc2$var$Placeholder({
3779
- product_card_template_: product_card_template_
3780
- }))]);
3781
- existing_num += to_add;
3782
- });
3783
- return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
3784
- }
3785
- /**
3786
- * Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
3787
- */
3788
- function $bdd80c7862246dc2$var$Placeholder(_ref2) {
3789
- let {
3790
- product_card_template_: product_card_template_
3791
- } = _ref2;
3792
- const get_cloned_placeholders = function () {
3793
- let element_to_clone = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : $bdd80c7862246dc2$var$cached_placeholder_element;
3794
- return Array.isArray(element_to_clone) ? element_to_clone.map(el => el instanceof Node ? el.cloneNode(true) : el) : element_to_clone;
3795
- };
3796
- if ($bdd80c7862246dc2$var$cached_placeholder_element) return get_cloned_placeholders();
3797
- let dispose_original_copy;
3798
- const get_unwrapped_element = $8tj43$createRoot(dispose => {
3799
- dispose_original_copy = dispose;
3800
- // if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
3801
- const [resource] = $8tj43$createResource(() => {
3802
- if ($bdd80c7862246dc2$var$rendering_cached_placeholder_element) return $bdd80c7862246dc2$var$rendering_cached_placeholder_element;
3803
- const return_value = product_card_template_(null, undefined);
3804
- if (typeof return_value === "object" && typeof (return_value === null || return_value === void 0 ? void 0 : return_value.then) === "function")
3805
- // Is Promise or promise-like object
3806
- $bdd80c7862246dc2$var$rendering_cached_placeholder_element = return_value;
3807
- return return_value;
3808
- });
3809
- return $8tj43$createMemo(() => {
3810
- if (resource.loading) return () => [];
3811
- return $cb64b315b25cfc59$export$2f0cbfbb4354bb52(resource);
3812
- });
3813
- });
3814
- $8tj43$onCleanup(() => {
3815
- if ($bdd80c7862246dc2$var$rendering_cached_placeholder_element) {
3816
- var _rendering_cached_pla;
3817
- // 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
3818
- const unset_current_rendering = () => {
3819
- dispose_original_copy();
3820
- $bdd80c7862246dc2$var$rendering_cached_placeholder_element = undefined;
3821
- };
3822
- (_rendering_cached_pla = $bdd80c7862246dc2$var$rendering_cached_placeholder_element) === null || _rendering_cached_pla === void 0 || _rendering_cached_pla.then(unset_current_rendering, unset_current_rendering);
3823
- } else
3824
- // Otherwise, just make sure we've disposed our root
3825
- dispose_original_copy();
3826
- });
3827
- return $8tj43$createMemo(() => {
3828
- const unwrapped_array = get_unwrapped_element()();
3829
- if (!(unwrapped_array !== null && unwrapped_array !== void 0 && unwrapped_array.length) || !unwrapped_array.every(item => item))
3830
- // Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
3831
- return;
3832
- // placeholders have finished rendering, freeze the elements
3833
- // 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
3834
- $bdd80c7862246dc2$var$cached_placeholder_element || ($bdd80c7862246dc2$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
3835
- $bdd80c7862246dc2$var$rendering_cached_placeholder_element = undefined;
3836
- dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
3837
- 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
3838
- });
3839
- }
3840
4194
 
3841
4195
  /*
3842
4196
  * 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.
@@ -3945,87 +4299,6 @@ function $e6dd9dfff4603d8c$export$63dd0350f8559dda(_ref) {
3945
4299
  equals: false
3946
4300
  });
3947
4301
  }
3948
-
3949
- /**
3950
- * Gets product_id (the thing we key the rendering on) from a display
3951
- */
3952
- function $6a4c7ed6d005505c$export$548d053aba053d79(display) {
3953
- if ("variant_index" in display) {
3954
- const actual_display = display.variant_displays[display.variant_index];
3955
- return actual_display.product_id;
3956
- }
3957
- return display.product_id;
3958
- }
3959
- function $2d7bad8684bc7f44$export$7f8bd308237ab5a5(get_displays_) {
3960
- const displays_by_key_ = $8tj43$createMemo(() => {
3961
- const displays = get_displays_();
3962
- // We key by product_id because that's what can be used to uniquely identify products
3963
- // This way <For> can optimize the rendering
3964
- const map = new Map();
3965
- for (let i = 0; i < displays.length; i++) {
3966
- const display = displays[i];
3967
- const product_id = $6a4c7ed6d005505c$export$548d053aba053d79(display);
3968
- map.set(product_id, display);
3969
- }
3970
- return map;
3971
- });
3972
- return displays_by_key_;
3973
- }
3974
- function $2d7bad8684bc7f44$export$43f0fb951fcb0c54(_ref) {
3975
- let {
3976
- displays_by_key_: displays_by_key_,
3977
- merchant_: merchant_,
3978
- market_: market_,
3979
- product_card_template_: product_card_template_,
3980
- do_per_elements_: do_per_elements_
3981
- } = _ref;
3982
- return $8tj43$createComponent((0, $8tj43$For), {
3983
- get each() {
3984
- return [...displays_by_key_().keys()];
3985
- },
3986
- children: (product_id, index) => {
3987
- const owner = $8tj43$getOwner();
3988
- const display_accessor = $8tj43$createMemo(() => displays_by_key_().get(product_id));
3989
- const [product_card_resource] = $8tj43$createResource(display_accessor,
3990
- // re-render when the reference to the display object changes
3991
- // this should only be the case when the merchant or market changes and the new request has completed
3992
- display => {
3993
- // get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
3994
- return product_card_template_(display, {
3995
- set_on_index_change: fn => $8tj43$runWithOwner(owner, () => $8tj43$createEffect(() => fn(index()))),
3996
- merchant: $8tj43$untrack(merchant_),
3997
- // 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
3998
- market: $8tj43$untrack(market_)
3999
- });
4000
- });
4001
- const node_accessor = $cb64b315b25cfc59$export$2f0cbfbb4354bb52(product_card_resource);
4002
- $8tj43$createEffect(() => {
4003
- const product_card_nodes = node_accessor();
4004
- const display = display_accessor();
4005
- const elements = [];
4006
- for (let i = 0; i < product_card_nodes.length; i++) {
4007
- const element = product_card_nodes[i];
4008
- if (!(element instanceof Element)) continue;
4009
- elements.push(element);
4010
- // Add tracking ids
4011
- if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
4012
- const {
4013
- dataset: dataset
4014
- } = element;
4015
- const {
4016
- search_result_id: search_result_id,
4017
- product_listing_result_id: product_listing_result_id,
4018
- recommendation_id: recommendation_id
4019
- } = display;
4020
- 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;
4021
- }
4022
- do_per_elements_ === null || do_per_elements_ === void 0 || do_per_elements_(elements, index);
4023
- });
4024
- return product_card_resource; // https://github.com/solidjs/solid/releases/tag/v1.7.0
4025
- }
4026
- });
4027
- }
4028
-
4029
4302
  function $45a8953d760b5e58$export$a1fd619a4743ca08(_ref) {
4030
4303
  let {
4031
4304
  plp_results_: plp_results_,
@@ -6469,45 +6742,6 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
6469
6742
  return _el$13;
6470
6743
  })()];
6471
6744
  }
6472
- const $a9c7ba6087881ac2$var$transform_elements = sorted_cols_at_size => {
6473
- const cols_at_size = [];
6474
- for (let i = 0; i < sorted_cols_at_size.length; i++) {
6475
- var _sorted_cols_at_size;
6476
- const [nb_cols, width] = sorted_cols_at_size[i];
6477
- const next_width = (_sorted_cols_at_size = sorted_cols_at_size[i + 1]) === null || _sorted_cols_at_size === void 0 ? void 0 : _sorted_cols_at_size[1];
6478
- const max_width = i === 0 ? "" : "".concat(width, "px");
6479
- const min_width = next_width !== undefined ? "".concat(next_width + 1, "px") : "";
6480
- const col_at_size = [nb_cols, min_width, max_width];
6481
- cols_at_size.push(col_at_size);
6482
- }
6483
- return cols_at_size;
6484
- };
6485
- const $a9c7ba6087881ac2$export$6daf8749b65a1b77 = cols_at_size => {
6486
- // Check that every element is an array
6487
- const are_arrays = cols_at_size.every(element => Array.isArray(element));
6488
- if (!are_arrays) throw new Error("Every element in cols_at_size must be an array");
6489
- // Check width duplicates
6490
- const widths = cols_at_size.map(_ref => {
6491
- let [_, width] = _ref;
6492
- return width;
6493
- });
6494
- const widths_set = new Set(widths);
6495
- if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
6496
- if (cols_at_size.length === 1) {
6497
- const [nb_cols, width] = cols_at_size[0];
6498
- const max_width = width !== undefined ? "".concat(width, "px") : "";
6499
- return [[nb_cols, "", max_width]];
6500
- }
6501
- // Sort widths in ascending order
6502
- const sorted_cols_at_size = [...cols_at_size].sort((a, b) => {
6503
- const [_b, width_A] = a;
6504
- const [_a, width_b] = b;
6505
- if (width_A === undefined) return -1;
6506
- if (width_b === undefined) return 1;
6507
- return width_b - width_A;
6508
- });
6509
- return $a9c7ba6087881ac2$var$transform_elements(sorted_cols_at_size);
6510
- };
6511
6745
  function $83e8cf2c0b87a58a$export$23fca46f3143581f(component, error_message) {
6512
6746
  const component_in_error_boundary = do_with_elements => {
6513
6747
  const error_boundary_wrapped = $74777e8fe65b3dcb$export$b69d0d92862de18b({
@@ -7028,7 +7262,7 @@ class $f5f54892fd0c7d9f$export$f34314aa9505732e {
7028
7262
  */
7029
7263
  var $f5f54892fd0c7d9f$var$_keys_constructed_with = {
7030
7264
  writable: true,
7031
- value: new Set()
7265
+ value: /*@__PURE__*/new Set()
7032
7266
  };
7033
7267
  function $f5f54892fd0c7d9f$export$e2bf8ce7779e827e(props) {
7034
7268
  const {
@@ -10321,38 +10555,6 @@ function $37e8c97bb6876197$export$828dcdd425fd3231(aligner) {
10321
10555
  cleanup: cleanup
10322
10556
  };
10323
10557
  }
10324
-
10325
- /**
10326
- * 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
10327
- */
10328
- function $3f7203368ad0d3ca$export$ff7109b9b2b206ba(sdk_cols_at_size) {
10329
- let min_width_for_more_than_one_column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
10330
- if (!sdk_cols_at_size.length) return sdk_cols_at_size;
10331
- const sorted_sizes = sdk_cols_at_size.map(_ref => {
10332
- let [cols, max_width] = _ref;
10333
- return [cols, max_width !== null && max_width !== void 0 ? max_width : Infinity];
10334
- }).sort((_ref2, _ref3) => {
10335
- let [, a] = _ref2;
10336
- let [, b] = _ref3;
10337
- return a - b;
10338
- });
10339
- const [[, smallest_max_width]] = sorted_sizes;
10340
- if (smallest_max_width > min_width_for_more_than_one_column)
10341
- // If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
10342
- return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
10343
- const to_delete = [];
10344
- for (let i = 0; i < sorted_sizes.length; i++) {
10345
- const [, max_width] = sorted_sizes[i];
10346
- if (max_width > min_width_for_more_than_one_column) continue;
10347
- to_delete.push(i);
10348
- }
10349
- while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
10350
- sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
10351
- return sorted_sizes.map(_ref4 => {
10352
- let [cols, max_width] = _ref4;
10353
- return max_width == Infinity ? [cols] : [cols, max_width];
10354
- });
10355
- }
10356
10558
  const $eb064bc3350276c1$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class="depict plp search"></div>`, 2);
10357
10559
  function $eb064bc3350276c1$var$_classPrivateFieldInitSpec(obj, privateMap, value) {
10358
10560
  $eb064bc3350276c1$var$_checkPrivateRedeclaration(obj, privateMap);
@@ -10678,7 +10880,7 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
10678
10880
  }
10679
10881
  var $eb064bc3350276c1$var$_keys_constructed_with = {
10680
10882
  writable: true,
10681
- value: new Set()
10883
+ value: /*@__PURE__*/new Set()
10682
10884
  };
10683
10885
  function $eb064bc3350276c1$var$get_shared_properties(depict_search) {
10684
10886
  const shared_properties = $eb064bc3350276c1$var$privately_shared_properties.get(depict_search);
@@ -11051,7 +11253,7 @@ class $f9fd3017c20b774a$export$3ccaa27d81dd8556 extends EventTarget {
11051
11253
  });
11052
11254
  $f9fd3017c20b774a$var$_classPrivateFieldInitSpec(this, $f9fd3017c20b774a$var$_unload, {
11053
11255
  writable: true,
11054
- value: $8tj43$catchify(() => {
11256
+ value: /*@__PURE__*/$8tj43$catchify(() => {
11055
11257
  var _classPrivateFieldGet3;
11056
11258
  if (!$8tj43$babelruntimehelpersclassPrivateFieldGet(this, $f9fd3017c20b774a$var$_is_open)) return;
11057
11259
  (_classPrivateFieldGet3 = $8tj43$babelruntimehelpersclassPrivateFieldGet(this, $f9fd3017c20b774a$var$_disconnect_observer)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.call(this);
@@ -11065,7 +11267,7 @@ class $f9fd3017c20b774a$export$3ccaa27d81dd8556 extends EventTarget {
11065
11267
  });
11066
11268
  $f9fd3017c20b774a$var$_classPrivateFieldInitSpec(this, $f9fd3017c20b774a$var$_load, {
11067
11269
  writable: true,
11068
- value: $8tj43$catchify(async els => {
11270
+ value: /*@__PURE__*/$8tj43$catchify(async els => {
11069
11271
  $8tj43$babelruntimehelpersclassPrivateFieldSet(this, $f9fd3017c20b774a$var$_is_open, true);
11070
11272
  // So that #load doesn't get called again
11071
11273
  let set_should_stay_inserted;
@@ -11193,7 +11395,7 @@ var $f9fd3017c20b774a$var$_reverting_permitted = {
11193
11395
  };
11194
11396
  var $f9fd3017c20b774a$var$_visited_urls = {
11195
11397
  writable: true,
11196
- value: (() => {
11398
+ value: /*@__PURE__*/(() => {
11197
11399
  // 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).
11198
11400
  $8tj43$catchify(async () => {
11199
11401
  // Static initialization blocks aren't supported in MobileSafari yet, otherwise this would be one.
@@ -11215,4 +11417,4 @@ const $d399250dfa491636$export$c3834fa86c616831 = [[4], [3, 1024], [2, 901]];
11215
11417
  const $d399250dfa491636$export$864d304a0bc46829 = "2%";
11216
11418
  const $d399250dfa491636$export$7bf543b9d9be2c22 = (0, $fa332ea03168857c$export$b91cec6bdc6b32a1);
11217
11419
  $8tj43$add_to_version_info("ui", (0, $8db9a15135765c11$export$83d89fbfd8236492));
11218
- export { $56047603f9d212b6$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $56047603f9d212b6$export$e6fffe67d4cdd848 as makeSizeAccessor, $801e8845d3fa3653$export$94026ee33dbabc26 as ImageContainer, $74777e8fe65b3dcb$export$b69d0d92862de18b as SentryErrorBoundary, $ad371564683947ab$export$6c6d7a51fa9aa15d as ExpandingDetails, $e18ab2868df26f40$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $4711a82d08d2021b$export$fecbb157621501bd as SelectedFilters, $f6b0500577e1b210$export$3f1a388cc0d8fed7 as FilterBody, $44aa24b1bb793549$export$b288c38ae3fddb56 as create_modified_filters, $63f1f8dbcd07d3b0$export$d21e32dfedac04be as SolidLayout, $d5f1e6a0f9117286$export$79b1565500412d9b as general_modal_abstraction, $9783d437ad61594c$export$3b621d86b1566b2 as CrossIcon, $ca6ab5f08bd28bca$export$8be2714ec7f169ee as GenericSliderArrowButton, $5c5732ef44f05b26$export$58e808b1db15d3bc as fetchDepictRecommendations, $f5f54892fd0c7d9f$export$de035477d6fef996 as QuickLinks, $f5f54892fd0c7d9f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $fa332ea03168857c$export$b91cec6bdc6b32a1 as CategoryTitle, $702d7656a373973e$export$824dde41348efed1 as embedded_num_products, $96fd967c5b358ead$export$643598a327b5833e as get_categories, $f5f54892fd0c7d9f$export$f34314aa9505732e as DepictCategory, $f5f54892fd0c7d9f$export$e2bf8ce7779e827e as CategoryPage, $eb064bc3350276c1$export$ac6237957a15b3f0 as DepictSearch, $eb064bc3350276c1$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $eb064bc3350276c1$export$f2dc7e4e4aa11abb as SearchPage, $eb064bc3350276c1$export$316f6f283ae64765 as SearchField, $f3b7124b76123e44$export$aa14a9f43128f61f as ProductCardError, $169c13c0531d91d2$export$d86a33413558014e as open_modal_with_alignment, $5eaa00b951637e96$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $1308a7816c3d4f2d$export$b3ad617e9036868 as align_field, $a9c7ba6087881ac2$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $cc64aabf2c7a1f1a$export$1233ca167bf71f9a as styles_to_valid_css_string, $e56d241d0f33d459$export$fe334901e8bebd57 as disable_scrolling, $573c007c697a1831$export$d0596b5cae35ad4 as open_search_with_shift_slash, $284849364a6ef73a$export$e015ed2f2950f2e3 as DepictAPI, $00a5b94f0c11efbb$export$d9f36cf74e24d595 as media_query_to_accessor, $e60a76195ac6d408$export$689e204eadb33baf as setup_fast_leave, $a61a2051e15c8d7a$export$5196e4c01fa56fcb as show_toast, $60ec7a29849d81db$export$a71e92cfbb498adc as SolidFormatPrice, $37e8c97bb6876197$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $bc2337c9a05ecd18$export$acb3eaade4b23afd as BasePlaceholder, $ceafb6fb91c6f394$export$89c6019e4baa40b1 as TextPlaceholder, $3ab4aa97880fb88d$export$3f37af283f8fb843 as ImagePlaceholder, $f9fd3017c20b774a$export$3ccaa27d81dd8556 as PageReplacer, $d399250dfa491636$export$864d304a0bc46829 as defaultGridSpacing, $d399250dfa491636$export$c3834fa86c616831 as defaultColsAtSize, $d399250dfa491636$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $8db9a15135765c11$export$83d89fbfd8236492 as version };
11420
+ export { $d5d7e58c5c9d8db0$export$9574e176201e5e8d as RecommendationSlider, $b432b11321ad4c97$export$9756467d34d91cdb as RecommendationGrid, $56047603f9d212b6$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $56047603f9d212b6$export$e6fffe67d4cdd848 as makeSizeAccessor, $801e8845d3fa3653$export$94026ee33dbabc26 as ImageContainer, $74777e8fe65b3dcb$export$b69d0d92862de18b as SentryErrorBoundary, $ad371564683947ab$export$6c6d7a51fa9aa15d as ExpandingDetails, $e18ab2868df26f40$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $4711a82d08d2021b$export$fecbb157621501bd as SelectedFilters, $f6b0500577e1b210$export$3f1a388cc0d8fed7 as FilterBody, $44aa24b1bb793549$export$b288c38ae3fddb56 as create_modified_filters, $63f1f8dbcd07d3b0$export$d21e32dfedac04be as SolidLayout, $d5f1e6a0f9117286$export$79b1565500412d9b as general_modal_abstraction, $9783d437ad61594c$export$3b621d86b1566b2 as CrossIcon, $ca6ab5f08bd28bca$export$8be2714ec7f169ee as GenericSliderArrowButton, $5c5732ef44f05b26$export$58e808b1db15d3bc as fetchDepictRecommendations, $f5f54892fd0c7d9f$export$de035477d6fef996 as QuickLinks, $f5f54892fd0c7d9f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $fa332ea03168857c$export$b91cec6bdc6b32a1 as CategoryTitle, $702d7656a373973e$export$824dde41348efed1 as embedded_num_products, $96fd967c5b358ead$export$643598a327b5833e as get_categories, $f5f54892fd0c7d9f$export$f34314aa9505732e as DepictCategory, $f5f54892fd0c7d9f$export$e2bf8ce7779e827e as CategoryPage, $eb064bc3350276c1$export$ac6237957a15b3f0 as DepictSearch, $eb064bc3350276c1$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $eb064bc3350276c1$export$f2dc7e4e4aa11abb as SearchPage, $eb064bc3350276c1$export$316f6f283ae64765 as SearchField, $f3b7124b76123e44$export$aa14a9f43128f61f as ProductCardError, $169c13c0531d91d2$export$d86a33413558014e as open_modal_with_alignment, $5eaa00b951637e96$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $1308a7816c3d4f2d$export$b3ad617e9036868 as align_field, $a9c7ba6087881ac2$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $cc64aabf2c7a1f1a$export$1233ca167bf71f9a as styles_to_valid_css_string, $e56d241d0f33d459$export$fe334901e8bebd57 as disable_scrolling, $573c007c697a1831$export$d0596b5cae35ad4 as open_search_with_shift_slash, $284849364a6ef73a$export$e015ed2f2950f2e3 as DepictAPI, $00a5b94f0c11efbb$export$d9f36cf74e24d595 as media_query_to_accessor, $e60a76195ac6d408$export$689e204eadb33baf as setup_fast_leave, $a61a2051e15c8d7a$export$5196e4c01fa56fcb as show_toast, $60ec7a29849d81db$export$a71e92cfbb498adc as SolidFormatPrice, $37e8c97bb6876197$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $bc2337c9a05ecd18$export$acb3eaade4b23afd as BasePlaceholder, $ceafb6fb91c6f394$export$89c6019e4baa40b1 as TextPlaceholder, $3ab4aa97880fb88d$export$3f37af283f8fb843 as ImagePlaceholder, $f9fd3017c20b774a$export$3ccaa27d81dd8556 as PageReplacer, $d399250dfa491636$export$864d304a0bc46829 as defaultGridSpacing, $d399250dfa491636$export$c3834fa86c616831 as defaultColsAtSize, $d399250dfa491636$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $8db9a15135765c11$export$83d89fbfd8236492 as version };