@depict-ai/ui 1.4.22 → 1.4.23

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,6 @@
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
4
  import $8tj43$babelruntimehelpersclassPrivateFieldSet from "@babel/runtime/helpers/classPrivateFieldSet";
5
5
  import $8tj43$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpers/classPrivateFieldGet";
6
6
  import $8tj43$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/defineProperty";
@@ -8,7 +8,679 @@ import $8tj43$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/def
8
8
  /*! Depict.ai search and product listing SDK */
9
9
  import { register_es_version } from "../multi_import_deduplicator.mjs";
10
10
  register_es_version("ui", "ES10");
11
- const $8db9a15135765c11$export$83d89fbfd8236492 = "1.4.22";
11
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "1.4.23";
12
+ const $a9c7ba6087881ac2$var$transform_elements = sorted_cols_at_size => {
13
+ const cols_at_size = [];
14
+ for (let i = 0; i < sorted_cols_at_size.length; i++) {
15
+ var _sorted_cols_at_size;
16
+ const [nb_cols, width] = sorted_cols_at_size[i];
17
+ 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];
18
+ const max_width = i === 0 ? "" : "".concat(width, "px");
19
+ const min_width = next_width !== undefined ? "".concat(next_width + 1, "px") : "";
20
+ const col_at_size = [nb_cols, min_width, max_width];
21
+ cols_at_size.push(col_at_size);
22
+ }
23
+ return cols_at_size;
24
+ };
25
+ const $a9c7ba6087881ac2$export$6daf8749b65a1b77 = cols_at_size => {
26
+ // Check that every element is an array
27
+ const are_arrays = cols_at_size.every(element => Array.isArray(element));
28
+ if (!are_arrays) throw new Error("Every element in cols_at_size must be an array");
29
+ // Check width duplicates
30
+ const widths = cols_at_size.map(_ref => {
31
+ let [_, width] = _ref;
32
+ return width;
33
+ });
34
+ const widths_set = new Set(widths);
35
+ if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
36
+ if (cols_at_size.length === 1) {
37
+ const [nb_cols, width] = cols_at_size[0];
38
+ const max_width = width !== undefined ? "".concat(width, "px") : "";
39
+ return [[nb_cols, "", max_width]];
40
+ }
41
+ // Sort widths in ascending order
42
+ const sorted_cols_at_size = [...cols_at_size].sort((a, b) => {
43
+ const [_b, width_A] = a;
44
+ const [_a, width_b] = b;
45
+ if (width_A === undefined) return -1;
46
+ if (width_b === undefined) return 1;
47
+ return width_b - width_A;
48
+ });
49
+ return $a9c7ba6087881ac2$var$transform_elements(sorted_cols_at_size);
50
+ };
51
+
52
+ /**
53
+ * 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
54
+ */
55
+ function $3f7203368ad0d3ca$export$ff7109b9b2b206ba(sdk_cols_at_size) {
56
+ let min_width_for_more_than_one_column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
57
+ if (!sdk_cols_at_size.length) return sdk_cols_at_size;
58
+ const sorted_sizes = sdk_cols_at_size.map(_ref => {
59
+ let [cols, max_width] = _ref;
60
+ return [cols, max_width !== null && max_width !== void 0 ? max_width : Infinity];
61
+ }).sort((_ref2, _ref3) => {
62
+ let [, a] = _ref2;
63
+ let [, b] = _ref3;
64
+ return a - b;
65
+ });
66
+ const [[, smallest_max_width]] = sorted_sizes;
67
+ if (smallest_max_width > min_width_for_more_than_one_column)
68
+ // If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
69
+ return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
70
+ const to_delete = [];
71
+ for (let i = 0; i < sorted_sizes.length; i++) {
72
+ const [, max_width] = sorted_sizes[i];
73
+ if (max_width > min_width_for_more_than_one_column) continue;
74
+ to_delete.push(i);
75
+ }
76
+ while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
77
+ sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
78
+ return sorted_sizes.map(_ref4 => {
79
+ let [cols, max_width] = _ref4;
80
+ return max_width == Infinity ? [cols] : [cols, max_width];
81
+ });
82
+ }
83
+ function $ca55612a53dbbdd2$export$a2cc176055f8f08() {
84
+ 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.";
85
+ return (0, $8tj43$isServer) ? "<!-- ".concat(text, " -->") : document.createComment(text);
86
+ }
87
+ function $cb64b315b25cfc59$export$2f0cbfbb4354bb52(elements) {
88
+ // FYI this probably doesn't work on hugely deep nestings or large amount of elements
89
+ return $8tj43$createMemo(() => $cb64b315b25cfc59$var$unwrapping_helper(elements));
90
+ }
91
+ function $cb64b315b25cfc59$var$unwrapping_helper(elements) {
92
+ const result = [];
93
+ if (Array.isArray(elements)) for (let i = 0; i < elements.length; i++) {
94
+ const element = elements[i];
95
+ result.push(...$cb64b315b25cfc59$var$unwrapping_helper(element));
96
+ } else if (typeof elements == "function") result.push(...$cb64b315b25cfc59$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
97
+ return result;
98
+ }
99
+ let $bdd80c7862246dc2$var$cached_placeholder_element;
100
+ let $bdd80c7862246dc2$var$rendering_cached_placeholder_element;
101
+ function $bdd80c7862246dc2$export$f33414a4df0afd3f(_ref) {
102
+ let {
103
+ product_card_template_: product_card_template_,
104
+ num_placeholders_: num_placeholders_
105
+ } = _ref;
106
+ const [get_elements, set_elements] = $8tj43$createSignal([]);
107
+ let existing_num = 0;
108
+ if (0, $8tj43$isServer)
109
+ // want to render simple placeholders on server, effects don't run there
110
+ return $8tj43$createMemo(() => Array.from({
111
+ length: num_placeholders_()
112
+ }).map(() => {
113
+ const template_result = product_card_template_(null, undefined);
114
+ // @ts-ignore
115
+ if (typeof (template_result === null || template_result === void 0 ? void 0 : template_result.then) !== "function") return template_result;
116
+ }));
117
+ $8tj43$createRenderEffect(() => {
118
+ const to_add = num_placeholders_() - existing_num;
119
+ if (to_add <= 0) return;
120
+ // 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.
121
+ // 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.
122
+ // 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.
123
+ set_elements(prev => [...prev, ...Array.from({
124
+ length: to_add
125
+ }).map(() => $bdd80c7862246dc2$var$Placeholder({
126
+ product_card_template_: product_card_template_
127
+ }))]);
128
+ existing_num += to_add;
129
+ });
130
+ return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
131
+ }
132
+ /**
133
+ * Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
134
+ */
135
+ function $bdd80c7862246dc2$var$Placeholder(_ref2) {
136
+ let {
137
+ product_card_template_: product_card_template_
138
+ } = _ref2;
139
+ const get_cloned_placeholders = function () {
140
+ let element_to_clone = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : $bdd80c7862246dc2$var$cached_placeholder_element;
141
+ return Array.isArray(element_to_clone) ? element_to_clone.map(el => el instanceof Node ? el.cloneNode(true) : el) : element_to_clone;
142
+ };
143
+ if ($bdd80c7862246dc2$var$cached_placeholder_element) return get_cloned_placeholders();
144
+ let dispose_original_copy;
145
+ const get_unwrapped_element = $8tj43$createRoot(dispose => {
146
+ dispose_original_copy = dispose;
147
+ // if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
148
+ const [resource] = $8tj43$createResource(() => {
149
+ if ($bdd80c7862246dc2$var$rendering_cached_placeholder_element) return $bdd80c7862246dc2$var$rendering_cached_placeholder_element;
150
+ const return_value = product_card_template_(null, undefined);
151
+ if (typeof return_value === "object" && typeof (return_value === null || return_value === void 0 ? void 0 : return_value.then) === "function")
152
+ // Is Promise or promise-like object
153
+ $bdd80c7862246dc2$var$rendering_cached_placeholder_element = return_value;
154
+ return return_value;
155
+ });
156
+ return $8tj43$createMemo(() => {
157
+ if (resource.loading) return () => [];
158
+ return $cb64b315b25cfc59$export$2f0cbfbb4354bb52(resource);
159
+ });
160
+ });
161
+ $8tj43$onCleanup(() => {
162
+ if ($bdd80c7862246dc2$var$rendering_cached_placeholder_element) {
163
+ var _rendering_cached_pla;
164
+ // 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
165
+ const unset_current_rendering = () => {
166
+ dispose_original_copy();
167
+ $bdd80c7862246dc2$var$rendering_cached_placeholder_element = undefined;
168
+ };
169
+ (_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);
170
+ } else
171
+ // Otherwise, just make sure we've disposed our root
172
+ dispose_original_copy();
173
+ });
174
+ return $8tj43$createMemo(() => {
175
+ const unwrapped_array = get_unwrapped_element()();
176
+ if (!(unwrapped_array !== null && unwrapped_array !== void 0 && unwrapped_array.length) || !unwrapped_array.every(item => item))
177
+ // Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
178
+ return;
179
+ // placeholders have finished rendering, freeze the elements
180
+ // 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
181
+ $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
182
+ $bdd80c7862246dc2$var$rendering_cached_placeholder_element = undefined;
183
+ dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
184
+ 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
185
+ });
186
+ }
187
+
188
+ /**
189
+ * Gets product_id (the thing we key the rendering on) from a display
190
+ */
191
+ function $6a4c7ed6d005505c$export$548d053aba053d79(display) {
192
+ if ("variant_index" in display) {
193
+ const actual_display = display.variant_displays[display.variant_index];
194
+ return actual_display.product_id;
195
+ }
196
+ return display.product_id;
197
+ }
198
+ function $2d7bad8684bc7f44$export$7f8bd308237ab5a5(get_displays_) {
199
+ const displays_by_key_ = $8tj43$createMemo(() => {
200
+ const displays = get_displays_();
201
+ // We key by product_id because that's what can be used to uniquely identify products
202
+ // This way <For> can optimize the rendering
203
+ const map = new Map();
204
+ for (let i = 0; i < displays.length; i++) {
205
+ const display = displays[i];
206
+ const product_id = $6a4c7ed6d005505c$export$548d053aba053d79(display);
207
+ map.set(product_id, display);
208
+ }
209
+ return map;
210
+ });
211
+ return displays_by_key_;
212
+ }
213
+ function $2d7bad8684bc7f44$export$43f0fb951fcb0c54(_ref) {
214
+ let {
215
+ displays_by_key_: displays_by_key_,
216
+ merchant_: merchant_,
217
+ market_: market_,
218
+ product_card_template_: product_card_template_,
219
+ do_per_elements_: do_per_elements_
220
+ } = _ref;
221
+ return $8tj43$createComponent((0, $8tj43$For), {
222
+ get each() {
223
+ return [...displays_by_key_().keys()];
224
+ },
225
+ children: (product_id, index) => {
226
+ const owner = $8tj43$getOwner();
227
+ const display_accessor = $8tj43$createMemo(() => displays_by_key_().get(product_id));
228
+ const [product_card_resource] = $8tj43$createResource(display_accessor,
229
+ // re-render when the reference to the display object changes
230
+ // this should only be the case when the merchant or market changes and the new request has completed
231
+ display => {
232
+ // get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
233
+ return product_card_template_(display, {
234
+ set_on_index_change: fn => $8tj43$runWithOwner(owner, () => $8tj43$createEffect(() => fn(index()))),
235
+ merchant: $8tj43$untrack(merchant_),
236
+ // 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
237
+ market: $8tj43$untrack(market_) // recommendation_grid can provide a sneaky undefined here just FYI
238
+ });
239
+ });
240
+
241
+ const node_accessor = $cb64b315b25cfc59$export$2f0cbfbb4354bb52(product_card_resource);
242
+ $8tj43$createEffect(() => {
243
+ const product_card_nodes = node_accessor();
244
+ const display = display_accessor();
245
+ const elements = [];
246
+ for (let i = 0; i < product_card_nodes.length; i++) {
247
+ const element = product_card_nodes[i];
248
+ if (!(element instanceof Element)) continue;
249
+ elements.push(element);
250
+ // Add tracking ids
251
+ if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
252
+ const {
253
+ dataset: dataset
254
+ } = element;
255
+ const {
256
+ search_result_id: search_result_id,
257
+ product_listing_result_id: product_listing_result_id,
258
+ recommendation_id: recommendation_id
259
+ } = display;
260
+ 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;
261
+ }
262
+ do_per_elements_ === null || do_per_elements_ === void 0 || do_per_elements_(elements, index);
263
+ });
264
+ return product_card_resource; // https://github.com/solidjs/solid/releases/tag/v1.7.0
265
+ }
266
+ });
267
+ }
268
+
269
+ // Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
270
+ class $f3b7124b76123e44$export$e1d52e4f0c7557a1 extends Error {}
271
+ class $f3b7124b76123e44$export$aa14a9f43128f61f extends $f3b7124b76123e44$export$e1d52e4f0c7557a1 {
272
+ constructor(templateError) {
273
+ super("Uncaught error in product card template", {
274
+ cause: templateError
275
+ });
276
+ }
277
+ }
278
+ const $74777e8fe65b3dcb$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div></div>`, 2);
279
+ function $74777e8fe65b3dcb$export$b69d0d92862de18b(props) {
280
+ return $8tj43$ErrorBoundary({
281
+ fallback(err, retry) {
282
+ var _props$on_error_;
283
+ const {
284
+ message_: message_,
285
+ severity_: severity_
286
+ } = props;
287
+ let message = message_;
288
+ if (err instanceof (0, $f3b7124b76123e44$export$aa14a9f43128f61f)) {
289
+ console.error(err.cause);
290
+ message = "".concat(message, ": ").concat(err.message);
291
+ } else $8tj43$report([err, message_], severity_);
292
+ (_props$on_error_ = props.on_error_) === null || _props$on_error_ === void 0 || _props$on_error_.call(props, retry);
293
+ return (() => {
294
+ const _el$ = $8tj43$getNextElement($74777e8fe65b3dcb$var$_tmpl$);
295
+ $8tj43$insert(_el$, message);
296
+ $8tj43$effect(_$p => {
297
+ var _props$class_list_;
298
+ 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);
299
+ });
300
+ return _el$;
301
+ })();
302
+ },
303
+ get children() {
304
+ return props.children;
305
+ }
306
+ });
307
+ }
308
+ const $63f1f8dbcd07d3b0$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div></div>`, 2),
309
+ $63f1f8dbcd07d3b0$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<style type="text/css"></style>`, 2);
310
+ function $63f1f8dbcd07d3b0$export$d21e32dfedac04be(props) {
311
+ const container_element_ = (() => {
312
+ const _el$ = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$);
313
+ $8tj43$spread(_el$, $8tj43$mergeProps(() => props.element_attributes), false, true);
314
+ $8tj43$insert(_el$, () => props.children);
315
+ $8tj43$runHydrationEvents();
316
+ return _el$;
317
+ })(); // Don't want this in the error boundary below, it should only be for the actual layouting
318
+ return $8tj43$createComponent((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
319
+ get message_() {
320
+ return "Failed calculating " + props.layout + " layout";
321
+ },
322
+ severity_: "error",
323
+ get children() {
324
+ return $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, container_element_);
325
+ }
326
+ });
327
+ }
328
+ function $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, container_element) {
329
+ let insert_after_container = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
330
+ // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
331
+ const show_all_rows = $8tj43$createMemo(() => props.rows === "all");
332
+ const rows_or_empty_object = $8tj43$createMemo(() => show_all_rows() ? {} : props.rows);
333
+ const view_more_button_elements = $cb64b315b25cfc59$export$2f0cbfbb4354bb52($8tj43$createMemo(() => rows_or_empty_object().button));
334
+ const view_less_button_elements = $cb64b315b25cfc59$export$2f0cbfbb4354bb52($8tj43$createMemo(() => rows_or_empty_object().view_less_button));
335
+ const have_a_view_more_button = $8tj43$createMemo(() => {
336
+ const button = view_more_button_elements();
337
+ return !(!button || Array.isArray(button) && !button.length);
338
+ });
339
+ const have_a_view_less_button = $8tj43$createMemo(() => {
340
+ const button = view_less_button_elements();
341
+ return !(!button || Array.isArray(button) && !button.length);
342
+ });
343
+ const [get_styling, set_styling] = $8tj43$createSignal();
344
+ const container_class = $8tj43$make_random_classname();
345
+ const selector_beginning = ".depict .".concat(container_class, ">"); // class so ppl can have id if needed
346
+ const [get_children_count, set_children_count] = $8tj43$createSignal(0);
347
+ const update_children_count = () => set_children_count(container_element.children.length);
348
+ 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));
349
+ const default_currently_visible_signal = $8tj43$createSignal($8tj43$untrack(() => {
350
+ var _rows_or_empty_object;
351
+ return (_rows_or_empty_object = rows_or_empty_object().start_rows) !== null && _rows_or_empty_object !== void 0 ? _rows_or_empty_object : 1;
352
+ })); // 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
353
+ const rows_visible_signal = $8tj43$createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
354
+ const get_rows_visible = $8tj43$createMemo(() => rows_visible_signal()[0]());
355
+ const set_rows_visible = $8tj43$createMemo(() => rows_visible_signal()[1]);
356
+ const view_more_button_class = $8tj43$make_random_classname();
357
+ const view_less_button_class = $8tj43$make_random_classname();
358
+ const style_element = (() => {
359
+ const _el$2 = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$2);
360
+ $8tj43$insert(_el$2, get_styling);
361
+ return _el$2;
362
+ })();
363
+ const view_more_button_container = $8tj43$createMemo(() => have_a_view_more_button() && (() => {
364
+ const _el$3 = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$);
365
+ $8tj43$addEventListener(_el$3, "click", $8tj43$catchify(() => set_rows_visible()(prev => {
366
+ var _rows_or_empty_object2;
367
+ 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);
368
+ })), true);
369
+ $8tj43$className(_el$3, "load-more-container ".concat(view_more_button_class));
370
+ $8tj43$insert(_el$3, () => rows_or_empty_object().button);
371
+ $8tj43$runHydrationEvents();
372
+ return _el$3;
373
+ })());
374
+ // 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
375
+ const view_less_button_container = $8tj43$createMemo(() => have_a_view_less_button() && (() => {
376
+ const _el$4 = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$);
377
+ $8tj43$addEventListener(_el$4, "click", $8tj43$catchify(() => set_rows_visible()(() => {
378
+ var _rows_or_empty_object3;
379
+ return (_rows_or_empty_object3 = rows_or_empty_object().start_rows) !== null && _rows_or_empty_object3 !== void 0 ? _rows_or_empty_object3 : 1;
380
+ })), true);
381
+ $8tj43$className(_el$4, "load-less-container ".concat(view_less_button_class));
382
+ $8tj43$insert(_el$4, () => rows_or_empty_object().view_less_button);
383
+ $8tj43$runHydrationEvents();
384
+ return _el$4;
385
+ })());
386
+ container_element.classList.add(container_class);
387
+ $8tj43$createComputed(() => {
388
+ // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
389
+ const rows_visible = get_rows_visible();
390
+ const max_rows = rows_or_empty_object().max_rows;
391
+ if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
392
+ });
393
+ $8tj43$createRenderEffect(() => {
394
+ // Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
395
+ if (show_all_rows()) {
396
+ // no view more functionality requested
397
+ set_styling(() => col_styling);
398
+ return;
399
+ }
400
+ update_children_count();
401
+ const mutation_observer = new MutationObserver($8tj43$catchify(update_children_count));
402
+ mutation_observer.observe(container_element, {
403
+ childList: true
404
+ });
405
+ $8tj43$onCleanup(() => mutation_observer.disconnect());
406
+ set_styling(
407
+ // this is needed because solid will think that the memo-accessor is a setter function otherwise
408
+ () => $8tj43$createMemo(() => {
409
+ const {
410
+ rows_per_click: rows_per_click,
411
+ max_rows = -1,
412
+ start_rows: start_rows
413
+ } = rows_or_empty_object();
414
+ const rows_visible = get_rows_visible();
415
+ const children_count = get_children_count();
416
+ return col_styling() + props.cols_at_size.map(options => {
417
+ const [recs_per_row, min, max] = options;
418
+ let should_hide_view_more_button;
419
+ let visible_recs;
420
+ if (props.disable_partial_rows) {
421
+ visible_recs = $8tj43$layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
422
+ const visible_recs_next_show_more = $8tj43$layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
423
+ // Should this really be zero when we default rows_per_click to 1?
424
+ children_count, options);
425
+ should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
426
+ } else {
427
+ visible_recs = $8tj43$layout_get_total_rec_amount_for_row(rows_visible, options);
428
+ should_hide_view_more_button = visible_recs >= children_count;
429
+ }
430
+ const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
431
+ // 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
432
+ 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;
433
+ 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}") : "", "}");
434
+ }).join("");
435
+ }));
436
+ });
437
+ if (insert_after_container) container_element.after(style_element);
438
+ return [container_element, $8tj43$memo(view_more_button_container), $8tj43$memo(view_less_button_container), style_element];
439
+ }
440
+ $8tj43$delegateEvents(["click"]);
441
+ 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);
442
+ function $ca6ab5f08bd28bca$export$8be2714ec7f169ee() {
443
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
444
+ return (() => {
445
+ const _el$ = $8tj43$getNextElement($ca6ab5f08bd28bca$var$_tmpl$);
446
+ $8tj43$effect(_p$ => {
447
+ var _props$width_, _props$height_;
448
+ const _v$ = (_props$width_ = props.width_) !== null && _props$width_ !== void 0 ? _props$width_ : 14,
449
+ _v$2 = (_props$height_ = props.height_) !== null && _props$height_ !== void 0 ? _props$height_ : 26;
450
+ _v$ !== _p$._v$ && $8tj43$setAttribute(_el$, "width", _p$._v$ = _v$);
451
+ _v$2 !== _p$._v$2 && $8tj43$setAttribute(_el$, "height", _p$._v$2 = _v$2);
452
+ return _p$;
453
+ }, {
454
+ _v$: undefined,
455
+ _v$2: undefined
456
+ });
457
+ return _el$;
458
+ })();
459
+ }
460
+ const $002f09d00aac50b2$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div></div>`, 2);
461
+ function $002f09d00aac50b2$export$6649caad96ef8870(_ref) {
462
+ let {
463
+ children: children,
464
+ slider_ref_: slider_ref_,
465
+ faded_opacity_ = 0.7,
466
+ mutation_plugins_ = []
467
+ } = _ref;
468
+ const slider = new (0, $8tj43$Amazing_Slider)({
469
+ button_contents: {
470
+ left: [(() => {
471
+ const _el$ = $8tj43$getNextElement($002f09d00aac50b2$var$_tmpl$);
472
+ $8tj43$insert(_el$, $8tj43$createComponent((0, $ca6ab5f08bd28bca$export$8be2714ec7f169ee), {}));
473
+ return _el$;
474
+ })()],
475
+ right: [(() => {
476
+ const _el$2 = $8tj43$getNextElement($002f09d00aac50b2$var$_tmpl$);
477
+ $8tj43$insert(_el$2, $8tj43$createComponent((0, $ca6ab5f08bd28bca$export$8be2714ec7f169ee), {}));
478
+ return _el$2;
479
+ })()]
480
+ },
481
+ constructor_plugins: [$8tj43$slider_snap_css().constructor_plugin],
482
+ mutation_plugins: [$8tj43$slider_fading_factory({
483
+ threshold_: 0.96,
484
+ faded_opacity_: faded_opacity_
485
+ }).mutation_plugin_, ...mutation_plugins_]
486
+ });
487
+ $8tj43$insert(slider.insert_here, children);
488
+ $8tj43$onCleanup(() => slider.observer.disconnect());
489
+ slider_ref_ === null || slider_ref_ === void 0 || slider_ref_(slider);
490
+ return slider.container;
491
+ }
492
+ function $39ddb986053fb759$export$d41d19e89346fa2(_ref) {
493
+ let {
494
+ recommendations_resource_: recommendations_resource_,
495
+ product_card_template_: product_card_template_,
496
+ layout_options_: layout_options_,
497
+ merchant_: merchant_,
498
+ market_: market_
499
+ } = _ref;
500
+ const is_showing_something = $8tj43$createMemo(() => {
501
+ var _recommendations_reso;
502
+ return recommendations_resource_.loading || ((_recommendations_reso = recommendations_resource_()) === null || _recommendations_reso === void 0 ? void 0 : _recommendations_reso.length);
503
+ });
504
+ const num_placeholders_ = () => 20;
505
+ const slider = $8tj43$createComponent((0, $002f09d00aac50b2$export$6649caad96ef8870), {
506
+ slider_ref_: slider => {
507
+ const Layout = props => $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, slider.insert_here, true);
508
+ // Do like this, so we don't have to call mergeProps ourselves
509
+ $8tj43$createComponent(Layout, $8tj43$mergeProps({
510
+ rows: "all",
511
+ layout: "slider"
512
+ }, layout_options_));
513
+ slider.insert_here.before($ca55612a53dbbdd2$export$a2cc176055f8f08());
514
+ },
515
+ get children() {
516
+ return $8tj43$createComponent((0, $8tj43$Suspense), {
517
+ get fallback() {
518
+ return $bdd80c7862246dc2$export$f33414a4df0afd3f({
519
+ num_placeholders_: num_placeholders_,
520
+ product_card_template_: product_card_template_
521
+ });
522
+ },
523
+ get children() {
524
+ return (() => {
525
+ // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
526
+ const displays_by_key_ = $2d7bad8684bc7f44$export$7f8bd308237ab5a5($8tj43$createMemo(() => recommendations_resource_() || []));
527
+ return $2d7bad8684bc7f44$export$43f0fb951fcb0c54({
528
+ displays_by_key_: displays_by_key_,
529
+ merchant_: merchant_,
530
+ market_: market_,
531
+ product_card_template_: product_card_template_
532
+ });
533
+ })();
534
+ }
535
+ });
536
+ }
537
+ });
538
+ return $8tj43$createComponent((0, $8tj43$Show), {
539
+ get when() {
540
+ return is_showing_something();
541
+ },
542
+ children: slider
543
+ });
544
+ }
545
+ const $d5d7e58c5c9d8db0$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class="depict plp"></div>`, 2);
546
+ function $d5d7e58c5c9d8db0$export$9574e176201e5e8d(props) {
547
+ const grid_spacing_override = $8tj43$createMemo(() => {
548
+ const {
549
+ grid_spacing: grid_spacing
550
+ } = props; // can be reactive
551
+ return typeof grid_spacing === "string" ? {
552
+ grid_spacing: grid_spacing
553
+ } : {
554
+ override_vertical_spacing: grid_spacing.vertical,
555
+ grid_spacing: grid_spacing.horizontal
556
+ };
557
+ });
558
+ const [recommendations_resource_] = $8tj43$createResource(() => props.recommendations, recs => recs);
559
+ return (() => {
560
+ const _el$ = $8tj43$getNextElement($d5d7e58c5c9d8db0$var$_tmpl$);
561
+ $8tj43$insert(_el$, () => $39ddb986053fb759$export$d41d19e89346fa2({
562
+ product_card_template_: function () {
563
+ return props.product_card_template(...arguments);
564
+ },
565
+ recommendations_resource_: recommendations_resource_,
566
+ market_: () => props.market,
567
+ merchant_: () => props.merchant,
568
+ layout_options_: $8tj43$createMemo(() => ({
569
+ cols_at_size: $a9c7ba6087881ac2$export$6daf8749b65a1b77($3f7203368ad0d3ca$export$ff7109b9b2b206ba(props.cols_at_size)),
570
+ ...grid_spacing_override()
571
+ }))
572
+ }));
573
+ return _el$;
574
+ })();
575
+ }
576
+ const $e3efeb558d952696$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class="recommendation-grid"><!#><!/><!#><!/></div>`, 6);
577
+ function $e3efeb558d952696$export$7da560f849543dff(_ref) {
578
+ let {
579
+ recommendations_resource_: recommendations_resource_,
580
+ product_card_template_: product_card_template_,
581
+ layout_options_: layout_options_,
582
+ merchant_: merchant_,
583
+ market_: market_,
584
+ rows_object_: rows_object_
585
+ } = _ref;
586
+ const is_showing_something = $8tj43$createMemo(() => {
587
+ var _recommendations_reso;
588
+ return recommendations_resource_.loading || ((_recommendations_reso = recommendations_resource_()) === null || _recommendations_reso === void 0 ? void 0 : _recommendations_reso.length);
589
+ });
590
+ const num_placeholders_ = () => 20;
591
+ return $8tj43$createComponent((0, $8tj43$Show), {
592
+ get when() {
593
+ return is_showing_something();
594
+ },
595
+ get children() {
596
+ const _el$ = $8tj43$getNextElement($e3efeb558d952696$var$_tmpl$),
597
+ _el$2 = _el$.firstChild,
598
+ [_el$3, _co$] = $8tj43$getNextMarker(_el$2.nextSibling),
599
+ _el$4 = _el$3.nextSibling,
600
+ [_el$5, _co$2] = $8tj43$getNextMarker(_el$4.nextSibling);
601
+ $8tj43$insert(_el$, (0, $ca55612a53dbbdd2$export$a2cc176055f8f08), _el$3, _co$);
602
+ $8tj43$insert(_el$, $8tj43$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), $8tj43$mergeProps({
603
+ get rows() {
604
+ return rows_object_();
605
+ },
606
+ layout: "grid",
607
+ element_attributes: {
608
+ class: "cards"
609
+ }
610
+ }, layout_options_, {
611
+ get children() {
612
+ return $8tj43$createComponent((0, $8tj43$Suspense), {
613
+ get fallback() {
614
+ return $bdd80c7862246dc2$export$f33414a4df0afd3f({
615
+ num_placeholders_: num_placeholders_,
616
+ product_card_template_: product_card_template_
617
+ });
618
+ },
619
+ get children() {
620
+ return (() => {
621
+ // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
622
+ const displays_by_key_ = $2d7bad8684bc7f44$export$7f8bd308237ab5a5($8tj43$createMemo(() => recommendations_resource_() || []));
623
+ return $2d7bad8684bc7f44$export$43f0fb951fcb0c54({
624
+ displays_by_key_: displays_by_key_,
625
+ merchant_: merchant_,
626
+ market_: market_,
627
+ product_card_template_: product_card_template_
628
+ });
629
+ })();
630
+ }
631
+ });
632
+ }
633
+ })), _el$5, _co$2);
634
+ return _el$;
635
+ }
636
+ });
637
+ }
638
+ const $b432b11321ad4c97$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<button class="show-more major" type="button"></button>`, 2),
639
+ $b432b11321ad4c97$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<div class="depict plp"></div>`, 2);
640
+ function $b432b11321ad4c97$export$9756467d34d91cdb(props) {
641
+ const rows_object_ = $8tj43$createMemo(() => {
642
+ const view_more_button = props.view_more_button;
643
+ if (!view_more_button) return "all";
644
+ return {
645
+ start_rows: view_more_button.start_rows,
646
+ rows_per_click: view_more_button.rows_per_click,
647
+ button: (() => {
648
+ const _el$ = $8tj43$getNextElement($b432b11321ad4c97$var$_tmpl$);
649
+ $8tj43$insert(_el$, () => view_more_button.text);
650
+ return _el$;
651
+ })()
652
+ };
653
+ });
654
+ const grid_spacing_override = $8tj43$createMemo(() => {
655
+ const {
656
+ grid_spacing: grid_spacing
657
+ } = props; // can be reactive
658
+ return typeof grid_spacing === "string" ? {
659
+ grid_spacing: grid_spacing
660
+ } : {
661
+ override_vertical_spacing: grid_spacing.vertical,
662
+ grid_spacing: grid_spacing.horizontal
663
+ };
664
+ });
665
+ const [recommendations_resource_] = $8tj43$createResource(() => props.recommendations, recs => recs);
666
+ return (() => {
667
+ const _el$2 = $8tj43$getNextElement($b432b11321ad4c97$var$_tmpl$2);
668
+ $8tj43$insert(_el$2, () => $e3efeb558d952696$export$7da560f849543dff({
669
+ rows_object_: rows_object_,
670
+ product_card_template_: function () {
671
+ return props.product_card_template(...arguments);
672
+ },
673
+ recommendations_resource_: recommendations_resource_,
674
+ market_: () => props.market,
675
+ merchant_: () => props.merchant,
676
+ layout_options_: $8tj43$createMemo(() => ({
677
+ cols_at_size: $a9c7ba6087881ac2$export$6daf8749b65a1b77($3f7203368ad0d3ca$export$ff7109b9b2b206ba(props.cols_at_size)),
678
+ ...grid_spacing_override()
679
+ }))
680
+ }));
681
+ return _el$2;
682
+ })();
683
+ }
12
684
  const $56047603f9d212b6$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<img>`, 1);
13
685
  function $56047603f9d212b6$export$e6fffe67d4cdd848(whatToWatch) {
14
686
  const [size, setSize] = $8tj43$createSignal(0);
@@ -65,46 +737,6 @@ function $801e8845d3fa3653$export$94026ee33dbabc26(props) {
65
737
  return _el$;
66
738
  })();
67
739
  }
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
740
  function $8e8b179489080711$export$5bad61ecde080b1f() {
109
741
  const {
110
742
  collapse: collapse,
@@ -224,57 +856,6 @@ function $60ec7a29849d81db$export$a71e92cfbb498adc(props) {
224
856
  return $8tj43$standard_price_format(props.price_, price_formatting.places_after_comma_, price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
225
857
  });
226
858
  }
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
859
  const $a61a2051e15c8d7a$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div></div>`, 2);
279
860
  const $a61a2051e15c8d7a$var$closing_functions = /*@__PURE__*/new Set();
280
861
  const $a61a2051e15c8d7a$export$22970a0140fc759c = /*@__PURE__*/$8tj43$createSignal(false);
@@ -2815,161 +3396,19 @@ function $44aa24b1bb793549$var$modify_only_local_filter(local_filter_object, sel
2815
3396
  for (let i = 0; i < values.length; i++) {
2816
3397
  const value = values[i];
2817
3398
  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
- })()];
3399
+ // We want to remove the entry with this value from the filter object because it's not selected
3400
+ indexes_to_remove.add(i);
3401
+ }
3402
+ new_meta.values = values.filter((_, index) => !indexes_to_remove.has(index));
3403
+ if (new_meta.names) new_meta.names = new_meta.names.filter((_, index) => !indexes_to_remove.has(index));
3404
+ if (new_meta.counts)
3405
+ // remove counts that are too much, they're all zero anyway if they exist
3406
+ new_meta.counts.length -= indexes_to_remove.size;
3407
+ }
3408
+ }
3409
+ }
3410
+ return modified_filter_object;
2971
3411
  }
2972
- $8tj43$delegateEvents(["click"]);
2973
3412
  async function $d5f1e6a0f9117286$export$79b1565500412d9b(search_modal, modal_fn_opts) {
2974
3413
  const body = await (0, $8tj43$observer).wait_for_element("body");
2975
3414
  let dispose_and_remove;
@@ -3745,98 +4184,6 @@ function $94af29837186eb21$export$ef6006467f04ee41(_ref) {
3745
4184
  })()];
3746
4185
  }
3747
4186
  $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
4187
 
3841
4188
  /*
3842
4189
  * 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 +4292,6 @@ function $e6dd9dfff4603d8c$export$63dd0350f8559dda(_ref) {
3945
4292
  equals: false
3946
4293
  });
3947
4294
  }
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
4295
  function $45a8953d760b5e58$export$a1fd619a4743ca08(_ref) {
4030
4296
  let {
4031
4297
  plp_results_: plp_results_,
@@ -6469,45 +6735,6 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
6469
6735
  return _el$13;
6470
6736
  })()];
6471
6737
  }
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
6738
  function $83e8cf2c0b87a58a$export$23fca46f3143581f(component, error_message) {
6512
6739
  const component_in_error_boundary = do_with_elements => {
6513
6740
  const error_boundary_wrapped = $74777e8fe65b3dcb$export$b69d0d92862de18b({
@@ -7028,7 +7255,7 @@ class $f5f54892fd0c7d9f$export$f34314aa9505732e {
7028
7255
  */
7029
7256
  var $f5f54892fd0c7d9f$var$_keys_constructed_with = {
7030
7257
  writable: true,
7031
- value: new Set()
7258
+ value: /*@__PURE__*/new Set()
7032
7259
  };
7033
7260
  function $f5f54892fd0c7d9f$export$e2bf8ce7779e827e(props) {
7034
7261
  const {
@@ -10321,38 +10548,6 @@ function $37e8c97bb6876197$export$828dcdd425fd3231(aligner) {
10321
10548
  cleanup: cleanup
10322
10549
  };
10323
10550
  }
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
10551
  const $eb064bc3350276c1$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class="depict plp search"></div>`, 2);
10357
10552
  function $eb064bc3350276c1$var$_classPrivateFieldInitSpec(obj, privateMap, value) {
10358
10553
  $eb064bc3350276c1$var$_checkPrivateRedeclaration(obj, privateMap);
@@ -10678,7 +10873,7 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
10678
10873
  }
10679
10874
  var $eb064bc3350276c1$var$_keys_constructed_with = {
10680
10875
  writable: true,
10681
- value: new Set()
10876
+ value: /*@__PURE__*/new Set()
10682
10877
  };
10683
10878
  function $eb064bc3350276c1$var$get_shared_properties(depict_search) {
10684
10879
  const shared_properties = $eb064bc3350276c1$var$privately_shared_properties.get(depict_search);
@@ -11051,7 +11246,7 @@ class $f9fd3017c20b774a$export$3ccaa27d81dd8556 extends EventTarget {
11051
11246
  });
11052
11247
  $f9fd3017c20b774a$var$_classPrivateFieldInitSpec(this, $f9fd3017c20b774a$var$_unload, {
11053
11248
  writable: true,
11054
- value: $8tj43$catchify(() => {
11249
+ value: /*@__PURE__*/$8tj43$catchify(() => {
11055
11250
  var _classPrivateFieldGet3;
11056
11251
  if (!$8tj43$babelruntimehelpersclassPrivateFieldGet(this, $f9fd3017c20b774a$var$_is_open)) return;
11057
11252
  (_classPrivateFieldGet3 = $8tj43$babelruntimehelpersclassPrivateFieldGet(this, $f9fd3017c20b774a$var$_disconnect_observer)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.call(this);
@@ -11065,7 +11260,7 @@ class $f9fd3017c20b774a$export$3ccaa27d81dd8556 extends EventTarget {
11065
11260
  });
11066
11261
  $f9fd3017c20b774a$var$_classPrivateFieldInitSpec(this, $f9fd3017c20b774a$var$_load, {
11067
11262
  writable: true,
11068
- value: $8tj43$catchify(async els => {
11263
+ value: /*@__PURE__*/$8tj43$catchify(async els => {
11069
11264
  $8tj43$babelruntimehelpersclassPrivateFieldSet(this, $f9fd3017c20b774a$var$_is_open, true);
11070
11265
  // So that #load doesn't get called again
11071
11266
  let set_should_stay_inserted;
@@ -11193,7 +11388,7 @@ var $f9fd3017c20b774a$var$_reverting_permitted = {
11193
11388
  };
11194
11389
  var $f9fd3017c20b774a$var$_visited_urls = {
11195
11390
  writable: true,
11196
- value: (() => {
11391
+ value: /*@__PURE__*/(() => {
11197
11392
  // 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
11393
  $8tj43$catchify(async () => {
11199
11394
  // Static initialization blocks aren't supported in MobileSafari yet, otherwise this would be one.
@@ -11215,4 +11410,4 @@ const $d399250dfa491636$export$c3834fa86c616831 = [[4], [3, 1024], [2, 901]];
11215
11410
  const $d399250dfa491636$export$864d304a0bc46829 = "2%";
11216
11411
  const $d399250dfa491636$export$7bf543b9d9be2c22 = (0, $fa332ea03168857c$export$b91cec6bdc6b32a1);
11217
11412
  $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 };
11413
+ 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 };