@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/latest/index.cjs CHANGED
@@ -10,6 +10,8 @@ function $parcel$export(e, n, v, s) {
10
10
  configurable: true
11
11
  });
12
12
  }
13
+ $parcel$export(module.exports, "RecommendationSlider", () => $72f96c4782db0b1b$export$9574e176201e5e8d);
14
+ $parcel$export(module.exports, "RecommendationGrid", () => $1f8dbf7e28b3eff2$export$9756467d34d91cdb);
13
15
  $parcel$export(module.exports, "ShopifyResponsiveImg", () => $19950faaac026e09$export$6e5611bc7e57e477);
14
16
  $parcel$export(module.exports, "makeSizeAccessor", () => $19950faaac026e09$export$e6fffe67d4cdd848);
15
17
  $parcel$export(module.exports, "ImageContainer", () => $93304d59a9747aa6$export$94026ee33dbabc26);
@@ -58,7 +60,628 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
58
60
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
59
61
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
60
62
  /*! Depict.ai search and product listing SDK */
61
- const $b757f75811f3261f$export$83d89fbfd8236492 = "1.4.22";
63
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "1.4.23";
64
+ const $4e04be41243c3d80$var$transform_elements = sorted_cols_at_size => {
65
+ const cols_at_size = [];
66
+ for (let i = 0; i < sorted_cols_at_size.length; i++) {
67
+ const [nb_cols, width] = sorted_cols_at_size[i];
68
+ const next_width = sorted_cols_at_size[i + 1]?.[1];
69
+ const max_width = i === 0 ? "" : `${width}px`;
70
+ const min_width = next_width !== undefined ? `${next_width + 1}px` : "";
71
+ const col_at_size = [nb_cols, min_width, max_width];
72
+ cols_at_size.push(col_at_size);
73
+ }
74
+ return cols_at_size;
75
+ };
76
+ const $4e04be41243c3d80$export$6daf8749b65a1b77 = cols_at_size => {
77
+ // Check that every element is an array
78
+ const are_arrays = cols_at_size.every(element => Array.isArray(element));
79
+ if (!are_arrays) throw new Error("Every element in cols_at_size must be an array");
80
+ // Check width duplicates
81
+ const widths = cols_at_size.map(([_, width]) => width);
82
+ const widths_set = new Set(widths);
83
+ if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
84
+ if (cols_at_size.length === 1) {
85
+ const [nb_cols, width] = cols_at_size[0];
86
+ const max_width = width !== undefined ? `${width}px` : "";
87
+ return [[nb_cols, "", max_width]];
88
+ }
89
+ // Sort widths in ascending order
90
+ const sorted_cols_at_size = [...cols_at_size].sort((a, b) => {
91
+ const [_b, width_A] = a;
92
+ const [_a, width_b] = b;
93
+ if (width_A === undefined) return -1;
94
+ if (width_b === undefined) return 1;
95
+ return width_b - width_A;
96
+ });
97
+ return $4e04be41243c3d80$var$transform_elements(sorted_cols_at_size);
98
+ };
99
+
100
+ /**
101
+ * 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
102
+ */
103
+ function $ab7c6c7911bae2f5$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_for_more_than_one_column = 500) {
104
+ if (!sdk_cols_at_size.length) return sdk_cols_at_size;
105
+ const sorted_sizes = sdk_cols_at_size.map(([cols, max_width]) => [cols, max_width ?? Infinity]).sort(([, a], [, b]) => a - b);
106
+ const [[, smallest_max_width]] = sorted_sizes;
107
+ if (smallest_max_width > min_width_for_more_than_one_column)
108
+ // If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
109
+ return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
110
+ const to_delete = [];
111
+ for (let i = 0; i < sorted_sizes.length; i++) {
112
+ const [, max_width] = sorted_sizes[i];
113
+ if (max_width > min_width_for_more_than_one_column) continue;
114
+ to_delete.push(i);
115
+ }
116
+ while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
117
+ sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
118
+ return sorted_sizes.map(([cols, max_width]) => max_width == Infinity ? [cols] : [cols, max_width]);
119
+ }
120
+ function $fc23d7668ae0011d$export$a2cc176055f8f08() {
121
+ 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.";
122
+ return (0, $gVhhF$solidjsweb.isServer) ? `<!-- ${text} -->` : document.createComment(text);
123
+ }
124
+ function $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(elements) {
125
+ // FYI this probably doesn't work on hugely deep nestings or large amount of elements
126
+ return $gVhhF$solidjs.createMemo(() => $5f7d55c710fd1bc2$var$unwrapping_helper(elements));
127
+ }
128
+ function $5f7d55c710fd1bc2$var$unwrapping_helper(elements) {
129
+ const result = [];
130
+ if (Array.isArray(elements)) for (let i = 0; i < elements.length; i++) {
131
+ const element = elements[i];
132
+ result.push(...$5f7d55c710fd1bc2$var$unwrapping_helper(element));
133
+ } else if (typeof elements == "function") result.push(...$5f7d55c710fd1bc2$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
134
+ return result;
135
+ }
136
+ let $0caf87eaa19079da$var$cached_placeholder_element;
137
+ let $0caf87eaa19079da$var$rendering_cached_placeholder_element;
138
+ function $0caf87eaa19079da$export$f33414a4df0afd3f({
139
+ product_card_template_: product_card_template_,
140
+ num_placeholders_: num_placeholders_
141
+ }) {
142
+ const [get_elements, set_elements] = $gVhhF$solidjs.createSignal([]);
143
+ let existing_num = 0;
144
+ if (0, $gVhhF$solidjsweb.isServer)
145
+ // want to render simple placeholders on server, effects don't run there
146
+ return $gVhhF$solidjs.createMemo(() => Array.from({
147
+ length: num_placeholders_()
148
+ }).map(() => {
149
+ const template_result = product_card_template_(null, undefined);
150
+ // @ts-ignore
151
+ if (typeof template_result?.then !== "function") return template_result;
152
+ }));
153
+ $gVhhF$solidjs.createRenderEffect(() => {
154
+ const to_add = num_placeholders_() - existing_num;
155
+ if (to_add <= 0) return;
156
+ // 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.
157
+ // 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.
158
+ // 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.
159
+ set_elements(prev => [...prev, ...Array.from({
160
+ length: to_add
161
+ }).map(() => $0caf87eaa19079da$var$Placeholder({
162
+ product_card_template_: product_card_template_
163
+ }))]);
164
+ existing_num += to_add;
165
+ });
166
+ return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
167
+ }
168
+ /**
169
+ * Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
170
+ */
171
+ function $0caf87eaa19079da$var$Placeholder({
172
+ product_card_template_: product_card_template_
173
+ }) {
174
+ const get_cloned_placeholders = (element_to_clone = $0caf87eaa19079da$var$cached_placeholder_element) => Array.isArray(element_to_clone) ? element_to_clone.map(el => el instanceof Node ? el.cloneNode(true) : el) : element_to_clone;
175
+ if ($0caf87eaa19079da$var$cached_placeholder_element) return get_cloned_placeholders();
176
+ let dispose_original_copy;
177
+ const get_unwrapped_element = $gVhhF$solidjs.createRoot(dispose => {
178
+ dispose_original_copy = dispose;
179
+ // if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
180
+ const [resource] = $gVhhF$solidjs.createResource(() => {
181
+ if ($0caf87eaa19079da$var$rendering_cached_placeholder_element) return $0caf87eaa19079da$var$rendering_cached_placeholder_element;
182
+ const return_value = product_card_template_(null, undefined);
183
+ if (typeof return_value === "object" && typeof return_value?.then === "function")
184
+ // Is Promise or promise-like object
185
+ $0caf87eaa19079da$var$rendering_cached_placeholder_element = return_value;
186
+ return return_value;
187
+ });
188
+ return $gVhhF$solidjs.createMemo(() => {
189
+ if (resource.loading) return () => [];
190
+ return $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(resource);
191
+ });
192
+ });
193
+ $gVhhF$solidjs.onCleanup(() => {
194
+ if ($0caf87eaa19079da$var$rendering_cached_placeholder_element) {
195
+ // 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
196
+ const unset_current_rendering = () => {
197
+ dispose_original_copy();
198
+ $0caf87eaa19079da$var$rendering_cached_placeholder_element = undefined;
199
+ };
200
+ $0caf87eaa19079da$var$rendering_cached_placeholder_element?.then(unset_current_rendering, unset_current_rendering);
201
+ } else
202
+ // Otherwise, just make sure we've disposed our root
203
+ dispose_original_copy();
204
+ });
205
+ return $gVhhF$solidjs.createMemo(() => {
206
+ const unwrapped_array = get_unwrapped_element()();
207
+ if (!unwrapped_array?.length || !unwrapped_array.every(item => item))
208
+ // Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
209
+ return;
210
+ // placeholders have finished rendering, freeze the elements
211
+ // 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
212
+ $0caf87eaa19079da$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
213
+ $0caf87eaa19079da$var$rendering_cached_placeholder_element = undefined;
214
+ dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
215
+ 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
216
+ });
217
+ }
218
+
219
+ /**
220
+ * Gets product_id (the thing we key the rendering on) from a display
221
+ */
222
+ function $a5871dacf261adf8$export$548d053aba053d79(display) {
223
+ if ("variant_index" in display) {
224
+ const actual_display = display.variant_displays[display.variant_index];
225
+ return actual_display.product_id;
226
+ }
227
+ return display.product_id;
228
+ }
229
+ function $a73063cc642f3e5f$export$7f8bd308237ab5a5(get_displays_) {
230
+ const displays_by_key_ = $gVhhF$solidjs.createMemo(() => {
231
+ const displays = get_displays_();
232
+ // We key by product_id because that's what can be used to uniquely identify products
233
+ // This way <For> can optimize the rendering
234
+ const map = new Map();
235
+ for (let i = 0; i < displays.length; i++) {
236
+ const display = displays[i];
237
+ const product_id = $a5871dacf261adf8$export$548d053aba053d79(display);
238
+ map.set(product_id, display);
239
+ }
240
+ return map;
241
+ });
242
+ return displays_by_key_;
243
+ }
244
+ function $a73063cc642f3e5f$export$43f0fb951fcb0c54({
245
+ displays_by_key_: displays_by_key_,
246
+ merchant_: merchant_,
247
+ market_: market_,
248
+ product_card_template_: product_card_template_,
249
+ do_per_elements_: do_per_elements_
250
+ }) {
251
+ return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.For), {
252
+ get each() {
253
+ return [...displays_by_key_().keys()];
254
+ },
255
+ children: (product_id, index) => {
256
+ const owner = $gVhhF$solidjs.getOwner();
257
+ const display_accessor = $gVhhF$solidjs.createMemo(() => displays_by_key_().get(product_id));
258
+ const [product_card_resource] = $gVhhF$solidjs.createResource(display_accessor,
259
+ // re-render when the reference to the display object changes
260
+ // this should only be the case when the merchant or market changes and the new request has completed
261
+ display => {
262
+ // get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
263
+ return product_card_template_(display, {
264
+ set_on_index_change: fn => $gVhhF$solidjs.runWithOwner(owner, () => $gVhhF$solidjs.createEffect(() => fn(index()))),
265
+ merchant: $gVhhF$solidjs.untrack(merchant_),
266
+ // 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
267
+ market: $gVhhF$solidjs.untrack(market_) // recommendation_grid can provide a sneaky undefined here just FYI
268
+ });
269
+ });
270
+
271
+ const node_accessor = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(product_card_resource);
272
+ $gVhhF$solidjs.createEffect(() => {
273
+ const product_card_nodes = node_accessor();
274
+ const display = display_accessor();
275
+ const elements = [];
276
+ for (let i = 0; i < product_card_nodes.length; i++) {
277
+ const element = product_card_nodes[i];
278
+ if (!(element instanceof Element)) continue;
279
+ elements.push(element);
280
+ // Add tracking ids
281
+ if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
282
+ const {
283
+ dataset: dataset
284
+ } = element;
285
+ const {
286
+ search_result_id: search_result_id,
287
+ product_listing_result_id: product_listing_result_id,
288
+ recommendation_id: recommendation_id
289
+ } = display;
290
+ 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;
291
+ }
292
+ do_per_elements_?.(elements, index);
293
+ });
294
+ return product_card_resource; // https://github.com/solidjs/solid/releases/tag/v1.7.0
295
+ }
296
+ });
297
+ }
298
+
299
+ // Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
300
+ class $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 extends Error {}
301
+ class $7dd1edb2ee2b43ad$export$aa14a9f43128f61f extends $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 {
302
+ constructor(templateError) {
303
+ super("Uncaught error in product card template", {
304
+ cause: templateError
305
+ });
306
+ }
307
+ }
308
+ const $edafe91daf3091d7$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div></div>`, 2);
309
+ function $edafe91daf3091d7$export$b69d0d92862de18b(props) {
310
+ return $gVhhF$solidjs.ErrorBoundary({
311
+ fallback(err, retry) {
312
+ const {
313
+ message_: message_,
314
+ severity_: severity_
315
+ } = props;
316
+ let message = message_;
317
+ if (err instanceof (0, $7dd1edb2ee2b43ad$export$aa14a9f43128f61f)) {
318
+ console.error(err.cause);
319
+ message = `${message}: ${err.message}`;
320
+ } else $gVhhF$depictaiutilishared.report([err, message_], severity_);
321
+ props.on_error_?.(retry);
322
+ return (() => {
323
+ const _el$ = $gVhhF$solidjsweb.getNextElement($edafe91daf3091d7$var$_tmpl$);
324
+ $gVhhF$solidjsweb.insert(_el$, message);
325
+ $gVhhF$solidjsweb.effect(_$p => $gVhhF$solidjsweb.classList(_el$, Object.fromEntries(props.class_list_?.map(c => [c, true]) || []), _$p));
326
+ return _el$;
327
+ })();
328
+ },
329
+ get children() {
330
+ return props.children;
331
+ }
332
+ });
333
+ }
334
+ const $f48d0fbb00835aaa$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div></div>`, 2),
335
+ $f48d0fbb00835aaa$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<style type="text/css"></style>`, 2);
336
+ function $f48d0fbb00835aaa$export$d21e32dfedac04be(props) {
337
+ const container_element_ = (() => {
338
+ const _el$ = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$);
339
+ $gVhhF$solidjsweb.spread(_el$, $gVhhF$solidjsweb.mergeProps(() => props.element_attributes), false, true);
340
+ $gVhhF$solidjsweb.insert(_el$, () => props.children);
341
+ $gVhhF$solidjsweb.runHydrationEvents();
342
+ return _el$;
343
+ })(); // Don't want this in the error boundary below, it should only be for the actual layouting
344
+ return $gVhhF$solidjsweb.createComponent((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
345
+ get message_() {
346
+ return "Failed calculating " + props.layout + " layout";
347
+ },
348
+ severity_: "error",
349
+ get children() {
350
+ return $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, container_element_);
351
+ }
352
+ });
353
+ }
354
+ function $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, container_element, insert_after_container = false) {
355
+ // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
356
+ const show_all_rows = $gVhhF$solidjs.createMemo(() => props.rows === "all");
357
+ const rows_or_empty_object = $gVhhF$solidjs.createMemo(() => show_all_rows() ? {} : props.rows);
358
+ const view_more_button_elements = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52($gVhhF$solidjs.createMemo(() => rows_or_empty_object().button));
359
+ const view_less_button_elements = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52($gVhhF$solidjs.createMemo(() => rows_or_empty_object().view_less_button));
360
+ const have_a_view_more_button = $gVhhF$solidjs.createMemo(() => {
361
+ const button = view_more_button_elements();
362
+ return !(!button || Array.isArray(button) && !button.length);
363
+ });
364
+ const have_a_view_less_button = $gVhhF$solidjs.createMemo(() => {
365
+ const button = view_less_button_elements();
366
+ return !(!button || Array.isArray(button) && !button.length);
367
+ });
368
+ const [get_styling, set_styling] = $gVhhF$solidjs.createSignal();
369
+ const container_class = $gVhhF$depictaiutilishared.make_random_classname();
370
+ const selector_beginning = `.depict .${container_class}>`; // class so ppl can have id if needed
371
+ const [get_children_count, set_children_count] = $gVhhF$solidjs.createSignal(0);
372
+ const update_children_count = () => set_children_count(container_element.children.length);
373
+ const col_styling = $gVhhF$solidjs.createMemo(() => $gVhhF$depictaiutilishared.n_col_styling_with_dist(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
374
+ const default_currently_visible_signal = $gVhhF$solidjs.createSignal($gVhhF$solidjs.untrack(() => rows_or_empty_object().start_rows ?? 1)); // Keep this signal here, so it doesn't change when rows_or_empty_object and I think it's to be expected that the "internal default signal" stays the same
375
+ const rows_visible_signal = $gVhhF$solidjs.createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
376
+ const get_rows_visible = $gVhhF$solidjs.createMemo(() => rows_visible_signal()[0]());
377
+ const set_rows_visible = $gVhhF$solidjs.createMemo(() => rows_visible_signal()[1]);
378
+ const view_more_button_class = $gVhhF$depictaiutilishared.make_random_classname();
379
+ const view_less_button_class = $gVhhF$depictaiutilishared.make_random_classname();
380
+ const style_element = (() => {
381
+ const _el$2 = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$2);
382
+ $gVhhF$solidjsweb.insert(_el$2, get_styling);
383
+ return _el$2;
384
+ })();
385
+ const view_more_button_container = $gVhhF$solidjs.createMemo(() => have_a_view_more_button() && (() => {
386
+ const _el$3 = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$);
387
+ $gVhhF$solidjsweb.addEventListener(_el$3, "click", $gVhhF$depictaiutilishared.catchify(() => set_rows_visible()(prev => prev + (rows_or_empty_object().rows_per_click ?? 1))), true);
388
+ $gVhhF$solidjsweb.className(_el$3, `load-more-container ${view_more_button_class}`);
389
+ $gVhhF$solidjsweb.insert(_el$3, () => rows_or_empty_object().button);
390
+ $gVhhF$solidjsweb.runHydrationEvents();
391
+ return _el$3;
392
+ })());
393
+ // 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
394
+ const view_less_button_container = $gVhhF$solidjs.createMemo(() => have_a_view_less_button() && (() => {
395
+ const _el$4 = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$);
396
+ $gVhhF$solidjsweb.addEventListener(_el$4, "click", $gVhhF$depictaiutilishared.catchify(() => set_rows_visible()(() => rows_or_empty_object().start_rows ?? 1)), true);
397
+ $gVhhF$solidjsweb.className(_el$4, `load-less-container ${view_less_button_class}`);
398
+ $gVhhF$solidjsweb.insert(_el$4, () => rows_or_empty_object().view_less_button);
399
+ $gVhhF$solidjsweb.runHydrationEvents();
400
+ return _el$4;
401
+ })());
402
+ container_element.classList.add(container_class);
403
+ $gVhhF$solidjs.createComputed(() => {
404
+ // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
405
+ const rows_visible = get_rows_visible();
406
+ const max_rows = rows_or_empty_object().max_rows;
407
+ if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
408
+ });
409
+ $gVhhF$solidjs.createRenderEffect(() => {
410
+ // Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
411
+ if (show_all_rows()) {
412
+ // no view more functionality requested
413
+ set_styling(() => col_styling);
414
+ return;
415
+ }
416
+ update_children_count();
417
+ const mutation_observer = new MutationObserver($gVhhF$depictaiutilishared.catchify(update_children_count));
418
+ mutation_observer.observe(container_element, {
419
+ childList: true
420
+ });
421
+ $gVhhF$solidjs.onCleanup(() => mutation_observer.disconnect());
422
+ set_styling(
423
+ // this is needed because solid will think that the memo-accessor is a setter function otherwise
424
+ () => $gVhhF$solidjs.createMemo(() => {
425
+ const {
426
+ rows_per_click: rows_per_click,
427
+ max_rows = -1,
428
+ start_rows: start_rows
429
+ } = rows_or_empty_object();
430
+ const rows_visible = get_rows_visible();
431
+ const children_count = get_children_count();
432
+ return col_styling() + props.cols_at_size.map(options => {
433
+ const [recs_per_row, min, max] = options;
434
+ let should_hide_view_more_button;
435
+ let visible_recs;
436
+ if (props.disable_partial_rows) {
437
+ visible_recs = $gVhhF$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
438
+ const visible_recs_next_show_more = $gVhhF$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
439
+ // Should this really be zero when we default rows_per_click to 1?
440
+ children_count, options);
441
+ should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
442
+ } else {
443
+ visible_recs = $gVhhF$depictaiutilishared.layout_get_total_rec_amount_for_row(rows_visible, options);
444
+ should_hide_view_more_button = visible_recs >= children_count;
445
+ }
446
+ const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
447
+ // 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
448
+ 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;
449
+ return `${$gVhhF$depictaiutilishared.layout_media_query_header(min, max)}{${selector_beginning}:nth-child(n+${visible_recs + 1}){display:none}${props.layout == "slider" ? `${selector_beginning}:nth-child(n+${visible_recs}){margin-right:0}` : ""}${should_hide_button_final ? `.depict .${view_more_button_class}{display:none!important}` : ``}${should_hide_view_less_button ? `.depict .${view_less_button_class}{display:none!important}` : ``}}`;
450
+ }).join("");
451
+ }));
452
+ });
453
+ if (insert_after_container) container_element.after(style_element);
454
+ return [container_element, $gVhhF$solidjsweb.memo(view_more_button_container), $gVhhF$solidjsweb.memo(view_less_button_container), style_element];
455
+ }
456
+ $gVhhF$solidjsweb.delegateEvents(["click"]);
457
+ const $0f313083912e447a$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.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);
458
+ function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
459
+ return (() => {
460
+ const _el$ = $gVhhF$solidjsweb.getNextElement($0f313083912e447a$var$_tmpl$);
461
+ $gVhhF$solidjsweb.effect(_p$ => {
462
+ const _v$ = props.width_ ?? 14,
463
+ _v$2 = props.height_ ?? 26;
464
+ _v$ !== _p$._v$ && $gVhhF$solidjsweb.setAttribute(_el$, "width", _p$._v$ = _v$);
465
+ _v$2 !== _p$._v$2 && $gVhhF$solidjsweb.setAttribute(_el$, "height", _p$._v$2 = _v$2);
466
+ return _p$;
467
+ }, {
468
+ _v$: undefined,
469
+ _v$2: undefined
470
+ });
471
+ return _el$;
472
+ })();
473
+ }
474
+ const $a0e53f99354809d9$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div></div>`, 2);
475
+ function $a0e53f99354809d9$export$6649caad96ef8870({
476
+ children: children,
477
+ slider_ref_: slider_ref_,
478
+ faded_opacity_ = 0.7,
479
+ mutation_plugins_ = []
480
+ }) {
481
+ const slider = new (0, $gVhhF$depictaiutilishared.Amazing_Slider)({
482
+ button_contents: {
483
+ left: [(() => {
484
+ const _el$ = $gVhhF$solidjsweb.getNextElement($a0e53f99354809d9$var$_tmpl$);
485
+ $gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $0f313083912e447a$export$8be2714ec7f169ee), {}));
486
+ return _el$;
487
+ })()],
488
+ right: [(() => {
489
+ const _el$2 = $gVhhF$solidjsweb.getNextElement($a0e53f99354809d9$var$_tmpl$);
490
+ $gVhhF$solidjsweb.insert(_el$2, $gVhhF$solidjsweb.createComponent((0, $0f313083912e447a$export$8be2714ec7f169ee), {}));
491
+ return _el$2;
492
+ })()]
493
+ },
494
+ constructor_plugins: [$gVhhF$depictaiutilishared.slider_snap_css().constructor_plugin],
495
+ mutation_plugins: [$gVhhF$depictaiutilishared.slider_fading_factory({
496
+ threshold_: 0.96,
497
+ faded_opacity_: faded_opacity_
498
+ }).mutation_plugin_, ...mutation_plugins_]
499
+ });
500
+ $gVhhF$solidjsweb.insert(slider.insert_here, children);
501
+ $gVhhF$solidjs.onCleanup(() => slider.observer.disconnect());
502
+ slider_ref_?.(slider);
503
+ return slider.container;
504
+ }
505
+ function $363ce4d1d71041aa$export$d41d19e89346fa2({
506
+ recommendations_resource_: recommendations_resource_,
507
+ product_card_template_: product_card_template_,
508
+ layout_options_: layout_options_,
509
+ merchant_: merchant_,
510
+ market_: market_
511
+ }) {
512
+ const is_showing_something = $gVhhF$solidjs.createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
513
+ const num_placeholders_ = () => 20;
514
+ const slider = $gVhhF$solidjsweb.createComponent((0, $a0e53f99354809d9$export$6649caad96ef8870), {
515
+ slider_ref_: slider => {
516
+ const Layout = props => $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, slider.insert_here, true);
517
+ // Do like this, so we don't have to call mergeProps ourselves
518
+ $gVhhF$solidjsweb.createComponent(Layout, $gVhhF$solidjsweb.mergeProps({
519
+ rows: "all",
520
+ layout: "slider"
521
+ }, layout_options_));
522
+ slider.insert_here.before($fc23d7668ae0011d$export$a2cc176055f8f08());
523
+ },
524
+ get children() {
525
+ return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Suspense), {
526
+ get fallback() {
527
+ return $0caf87eaa19079da$export$f33414a4df0afd3f({
528
+ num_placeholders_: num_placeholders_,
529
+ product_card_template_: product_card_template_
530
+ });
531
+ },
532
+ get children() {
533
+ return (() => {
534
+ // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
535
+ const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($gVhhF$solidjs.createMemo(() => recommendations_resource_() || []));
536
+ return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
537
+ displays_by_key_: displays_by_key_,
538
+ merchant_: merchant_,
539
+ market_: market_,
540
+ product_card_template_: product_card_template_
541
+ });
542
+ })();
543
+ }
544
+ });
545
+ }
546
+ });
547
+ return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
548
+ get when() {
549
+ return is_showing_something();
550
+ },
551
+ children: slider
552
+ });
553
+ }
554
+ const $72f96c4782db0b1b$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="depict plp"></div>`, 2);
555
+ function $72f96c4782db0b1b$export$9574e176201e5e8d(props) {
556
+ const grid_spacing_override = $gVhhF$solidjs.createMemo(() => {
557
+ const {
558
+ grid_spacing: grid_spacing
559
+ } = props; // can be reactive
560
+ return typeof grid_spacing === "string" ? {
561
+ grid_spacing: grid_spacing
562
+ } : {
563
+ override_vertical_spacing: grid_spacing.vertical,
564
+ grid_spacing: grid_spacing.horizontal
565
+ };
566
+ });
567
+ const [recommendations_resource_] = $gVhhF$solidjs.createResource(() => props.recommendations, recs => recs);
568
+ return (() => {
569
+ const _el$ = $gVhhF$solidjsweb.getNextElement($72f96c4782db0b1b$var$_tmpl$);
570
+ $gVhhF$solidjsweb.insert(_el$, () => $363ce4d1d71041aa$export$d41d19e89346fa2({
571
+ product_card_template_: (...args) => props.product_card_template(...args),
572
+ recommendations_resource_: recommendations_resource_,
573
+ market_: () => props.market,
574
+ merchant_: () => props.merchant,
575
+ layout_options_: $gVhhF$solidjs.createMemo(() => ({
576
+ cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77($ab7c6c7911bae2f5$export$ff7109b9b2b206ba(props.cols_at_size)),
577
+ ...grid_spacing_override()
578
+ }))
579
+ }));
580
+ return _el$;
581
+ })();
582
+ }
583
+ const $b8e79813f4f7ebe4$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="recommendation-grid"><!#><!/><!#><!/></div>`, 6);
584
+ function $b8e79813f4f7ebe4$export$7da560f849543dff({
585
+ recommendations_resource_: recommendations_resource_,
586
+ product_card_template_: product_card_template_,
587
+ layout_options_: layout_options_,
588
+ merchant_: merchant_,
589
+ market_: market_,
590
+ rows_object_: rows_object_
591
+ }) {
592
+ const is_showing_something = $gVhhF$solidjs.createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
593
+ const num_placeholders_ = () => 20;
594
+ return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
595
+ get when() {
596
+ return is_showing_something();
597
+ },
598
+ get children() {
599
+ const _el$ = $gVhhF$solidjsweb.getNextElement($b8e79813f4f7ebe4$var$_tmpl$),
600
+ _el$2 = _el$.firstChild,
601
+ [_el$3, _co$] = $gVhhF$solidjsweb.getNextMarker(_el$2.nextSibling),
602
+ _el$4 = _el$3.nextSibling,
603
+ [_el$5, _co$2] = $gVhhF$solidjsweb.getNextMarker(_el$4.nextSibling);
604
+ $gVhhF$solidjsweb.insert(_el$, (0, $fc23d7668ae0011d$export$a2cc176055f8f08), _el$3, _co$);
605
+ $gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), $gVhhF$solidjsweb.mergeProps({
606
+ get rows() {
607
+ return rows_object_();
608
+ },
609
+ layout: "grid",
610
+ element_attributes: {
611
+ class: "cards"
612
+ }
613
+ }, layout_options_, {
614
+ get children() {
615
+ return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Suspense), {
616
+ get fallback() {
617
+ return $0caf87eaa19079da$export$f33414a4df0afd3f({
618
+ num_placeholders_: num_placeholders_,
619
+ product_card_template_: product_card_template_
620
+ });
621
+ },
622
+ get children() {
623
+ return (() => {
624
+ // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
625
+ const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($gVhhF$solidjs.createMemo(() => recommendations_resource_() || []));
626
+ return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
627
+ displays_by_key_: displays_by_key_,
628
+ merchant_: merchant_,
629
+ market_: market_,
630
+ product_card_template_: product_card_template_
631
+ });
632
+ })();
633
+ }
634
+ });
635
+ }
636
+ })), _el$5, _co$2);
637
+ return _el$;
638
+ }
639
+ });
640
+ }
641
+ const $1f8dbf7e28b3eff2$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button class="show-more major" type="button"></button>`, 2),
642
+ $1f8dbf7e28b3eff2$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="depict plp"></div>`, 2);
643
+ function $1f8dbf7e28b3eff2$export$9756467d34d91cdb(props) {
644
+ const rows_object_ = $gVhhF$solidjs.createMemo(() => {
645
+ const view_more_button = props.view_more_button;
646
+ if (!view_more_button) return "all";
647
+ return {
648
+ start_rows: view_more_button.start_rows,
649
+ rows_per_click: view_more_button.rows_per_click,
650
+ button: (() => {
651
+ const _el$ = $gVhhF$solidjsweb.getNextElement($1f8dbf7e28b3eff2$var$_tmpl$);
652
+ $gVhhF$solidjsweb.insert(_el$, () => view_more_button.text);
653
+ return _el$;
654
+ })()
655
+ };
656
+ });
657
+ const grid_spacing_override = $gVhhF$solidjs.createMemo(() => {
658
+ const {
659
+ grid_spacing: grid_spacing
660
+ } = props; // can be reactive
661
+ return typeof grid_spacing === "string" ? {
662
+ grid_spacing: grid_spacing
663
+ } : {
664
+ override_vertical_spacing: grid_spacing.vertical,
665
+ grid_spacing: grid_spacing.horizontal
666
+ };
667
+ });
668
+ const [recommendations_resource_] = $gVhhF$solidjs.createResource(() => props.recommendations, recs => recs);
669
+ return (() => {
670
+ const _el$2 = $gVhhF$solidjsweb.getNextElement($1f8dbf7e28b3eff2$var$_tmpl$2);
671
+ $gVhhF$solidjsweb.insert(_el$2, () => $b8e79813f4f7ebe4$export$7da560f849543dff({
672
+ rows_object_: rows_object_,
673
+ product_card_template_: (...args) => props.product_card_template(...args),
674
+ recommendations_resource_: recommendations_resource_,
675
+ market_: () => props.market,
676
+ merchant_: () => props.merchant,
677
+ layout_options_: $gVhhF$solidjs.createMemo(() => ({
678
+ cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77($ab7c6c7911bae2f5$export$ff7109b9b2b206ba(props.cols_at_size)),
679
+ ...grid_spacing_override()
680
+ }))
681
+ }));
682
+ return _el$2;
683
+ })();
684
+ }
62
685
  const $19950faaac026e09$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<img>`, 1);
63
686
  function $19950faaac026e09$export$e6fffe67d4cdd848(whatToWatch) {
64
687
  const [size, setSize] = $gVhhF$solidjs.createSignal(0);
@@ -114,42 +737,6 @@ function $93304d59a9747aa6$export$94026ee33dbabc26(props) {
114
737
  return _el$;
115
738
  })();
116
739
  }
117
-
118
- // Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
119
- class $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 extends Error {}
120
- class $7dd1edb2ee2b43ad$export$aa14a9f43128f61f extends $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 {
121
- constructor(templateError) {
122
- super("Uncaught error in product card template", {
123
- cause: templateError
124
- });
125
- }
126
- }
127
- const $edafe91daf3091d7$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div></div>`, 2);
128
- function $edafe91daf3091d7$export$b69d0d92862de18b(props) {
129
- return $gVhhF$solidjs.ErrorBoundary({
130
- fallback(err, retry) {
131
- const {
132
- message_: message_,
133
- severity_: severity_
134
- } = props;
135
- let message = message_;
136
- if (err instanceof (0, $7dd1edb2ee2b43ad$export$aa14a9f43128f61f)) {
137
- console.error(err.cause);
138
- message = `${message}: ${err.message}`;
139
- } else $gVhhF$depictaiutilishared.report([err, message_], severity_);
140
- props.on_error_?.(retry);
141
- return (() => {
142
- const _el$ = $gVhhF$solidjsweb.getNextElement($edafe91daf3091d7$var$_tmpl$);
143
- $gVhhF$solidjsweb.insert(_el$, message);
144
- $gVhhF$solidjsweb.effect(_$p => $gVhhF$solidjsweb.classList(_el$, Object.fromEntries(props.class_list_?.map(c => [c, true]) || []), _$p));
145
- return _el$;
146
- })();
147
- },
148
- get children() {
149
- return props.children;
150
- }
151
- });
152
- }
153
740
  function $4b455f60dadde8b8$export$5bad61ecde080b1f(...params) {
154
741
  const {
155
742
  collapse: collapse,
@@ -268,54 +855,6 @@ function $d659702496cb72ea$export$a71e92cfbb498adc(props) {
268
855
  return $gVhhF$depictaiutilishared.standard_price_format(props.price_, price_formatting.places_after_comma_, price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
269
856
  });
270
857
  }
271
- const $0f313083912e447a$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.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);
272
- function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
273
- return (() => {
274
- const _el$ = $gVhhF$solidjsweb.getNextElement($0f313083912e447a$var$_tmpl$);
275
- $gVhhF$solidjsweb.effect(_p$ => {
276
- const _v$ = props.width_ ?? 14,
277
- _v$2 = props.height_ ?? 26;
278
- _v$ !== _p$._v$ && $gVhhF$solidjsweb.setAttribute(_el$, "width", _p$._v$ = _v$);
279
- _v$2 !== _p$._v$2 && $gVhhF$solidjsweb.setAttribute(_el$, "height", _p$._v$2 = _v$2);
280
- return _p$;
281
- }, {
282
- _v$: undefined,
283
- _v$2: undefined
284
- });
285
- return _el$;
286
- })();
287
- }
288
- const $a0e53f99354809d9$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div></div>`, 2);
289
- function $a0e53f99354809d9$export$6649caad96ef8870({
290
- children: children,
291
- slider_ref_: slider_ref_,
292
- faded_opacity_ = 0.7,
293
- mutation_plugins_ = []
294
- }) {
295
- const slider = new (0, $gVhhF$depictaiutilishared.Amazing_Slider)({
296
- button_contents: {
297
- left: [(() => {
298
- const _el$ = $gVhhF$solidjsweb.getNextElement($a0e53f99354809d9$var$_tmpl$);
299
- $gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $0f313083912e447a$export$8be2714ec7f169ee), {}));
300
- return _el$;
301
- })()],
302
- right: [(() => {
303
- const _el$2 = $gVhhF$solidjsweb.getNextElement($a0e53f99354809d9$var$_tmpl$);
304
- $gVhhF$solidjsweb.insert(_el$2, $gVhhF$solidjsweb.createComponent((0, $0f313083912e447a$export$8be2714ec7f169ee), {}));
305
- return _el$2;
306
- })()]
307
- },
308
- constructor_plugins: [$gVhhF$depictaiutilishared.slider_snap_css().constructor_plugin],
309
- mutation_plugins: [$gVhhF$depictaiutilishared.slider_fading_factory({
310
- threshold_: 0.96,
311
- faded_opacity_: faded_opacity_
312
- }).mutation_plugin_, ...mutation_plugins_]
313
- });
314
- $gVhhF$solidjsweb.insert(slider.insert_here, children);
315
- $gVhhF$solidjs.onCleanup(() => slider.observer.disconnect());
316
- slider_ref_?.(slider);
317
- return slider.container;
318
- }
319
858
  const $ee498ec5e7dc2bba$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div></div>`, 2);
320
859
  const $ee498ec5e7dc2bba$var$closing_functions = /*@__PURE__*/new Set();
321
860
  const $ee498ec5e7dc2bba$export$22970a0140fc759c = /*@__PURE__*/$gVhhF$solidjs.createSignal(false);
@@ -2660,166 +3199,33 @@ function $70482f04605572e2$var$modify_only_local_filter(local_filter_object, sel
2660
3199
  ...old_meta
2661
3200
  };
2662
3201
  modified_filter_object.meta = new_meta;
2663
- // set counts to 0
2664
- if ("counts" in new_meta) {
2665
- const counts = new_meta.counts;
2666
- if (counts) new_meta.counts = counts.map(() => 0);
2667
- }
2668
- if (Array.isArray(selected_filter_data) && "values" in new_meta) {
2669
- // we have an array of values and want to strip the ones from the available ones that aren't selected
2670
- const values = new_meta.values;
2671
- if (Array.isArray(values)) {
2672
- const jsond_set_values = selected_filter_data.map(data => JSON.stringify(data));
2673
- const indexes_to_remove = new Set();
2674
- for (let i = 0; i < values.length; i++) {
2675
- const value = values[i];
2676
- if (!jsond_set_values.includes(JSON.stringify(value)))
2677
- // We want to remove the entry with this value from the filter object because it's not selected
2678
- indexes_to_remove.add(i);
2679
- }
2680
- new_meta.values = values.filter((_, index) => !indexes_to_remove.has(index));
2681
- if (new_meta.names) new_meta.names = new_meta.names.filter((_, index) => !indexes_to_remove.has(index));
2682
- if (new_meta.counts)
2683
- // remove counts that are too much, they're all zero anyway if they exist
2684
- new_meta.counts.length -= indexes_to_remove.size;
2685
- }
2686
- }
2687
- }
2688
- return modified_filter_object;
2689
- }
2690
- function $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(elements) {
2691
- // FYI this probably doesn't work on hugely deep nestings or large amount of elements
2692
- return $gVhhF$solidjs.createMemo(() => $5f7d55c710fd1bc2$var$unwrapping_helper(elements));
2693
- }
2694
- function $5f7d55c710fd1bc2$var$unwrapping_helper(elements) {
2695
- const result = [];
2696
- if (Array.isArray(elements)) for (let i = 0; i < elements.length; i++) {
2697
- const element = elements[i];
2698
- result.push(...$5f7d55c710fd1bc2$var$unwrapping_helper(element));
2699
- } else if (typeof elements == "function") result.push(...$5f7d55c710fd1bc2$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
2700
- return result;
2701
- }
2702
- const $f48d0fbb00835aaa$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div></div>`, 2),
2703
- $f48d0fbb00835aaa$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<style type="text/css"></style>`, 2);
2704
- function $f48d0fbb00835aaa$export$d21e32dfedac04be(props) {
2705
- const container_element_ = (() => {
2706
- const _el$ = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$);
2707
- $gVhhF$solidjsweb.spread(_el$, $gVhhF$solidjsweb.mergeProps(() => props.element_attributes), false, true);
2708
- $gVhhF$solidjsweb.insert(_el$, () => props.children);
2709
- $gVhhF$solidjsweb.runHydrationEvents();
2710
- return _el$;
2711
- })(); // Don't want this in the error boundary below, it should only be for the actual layouting
2712
- return $gVhhF$solidjsweb.createComponent((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
2713
- get message_() {
2714
- return "Failed calculating " + props.layout + " layout";
2715
- },
2716
- severity_: "error",
2717
- get children() {
2718
- return $f48d0fbb00835aaa$var$ActualSolidLayout(props, container_element_);
2719
- }
2720
- });
2721
- }
2722
- function $f48d0fbb00835aaa$var$ActualSolidLayout(props, container_element) {
2723
- // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
2724
- const show_all_rows = $gVhhF$solidjs.createMemo(() => props.rows === "all");
2725
- const rows_or_empty_object = $gVhhF$solidjs.createMemo(() => show_all_rows() ? {} : props.rows);
2726
- const view_more_button_elements = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52($gVhhF$solidjs.createMemo(() => rows_or_empty_object().button));
2727
- const view_less_button_elements = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52($gVhhF$solidjs.createMemo(() => rows_or_empty_object().view_less_button));
2728
- const have_a_view_more_button = $gVhhF$solidjs.createMemo(() => {
2729
- const button = view_more_button_elements();
2730
- return !(!button || Array.isArray(button) && !button.length);
2731
- });
2732
- const have_a_view_less_button = $gVhhF$solidjs.createMemo(() => {
2733
- const button = view_less_button_elements();
2734
- return !(!button || Array.isArray(button) && !button.length);
2735
- });
2736
- const [get_styling, set_styling] = $gVhhF$solidjs.createSignal();
2737
- const container_class = $gVhhF$depictaiutilishared.make_random_classname();
2738
- const selector_beginning = `.depict .${container_class}>`; // class so ppl can have id if needed
2739
- const [get_children_count, set_children_count] = $gVhhF$solidjs.createSignal(0);
2740
- const update_children_count = () => set_children_count(container_element.children.length);
2741
- const col_styling = $gVhhF$solidjs.createMemo(() => $gVhhF$depictaiutilishared.n_col_styling_with_dist(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
2742
- const default_currently_visible_signal = $gVhhF$solidjs.createSignal($gVhhF$solidjs.untrack(() => rows_or_empty_object().start_rows ?? 1)); // Keep this signal here, so it doesn't change when rows_or_empty_object and I think it's to be expected that the "internal default signal" stays the same
2743
- const rows_visible_signal = $gVhhF$solidjs.createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
2744
- const get_rows_visible = $gVhhF$solidjs.createMemo(() => rows_visible_signal()[0]());
2745
- const set_rows_visible = $gVhhF$solidjs.createMemo(() => rows_visible_signal()[1]);
2746
- const view_more_button_class = $gVhhF$depictaiutilishared.make_random_classname();
2747
- const view_less_button_class = $gVhhF$depictaiutilishared.make_random_classname();
2748
- const view_more_button_container = $gVhhF$solidjs.createMemo(() => have_a_view_more_button() && (() => {
2749
- const _el$2 = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$);
2750
- $gVhhF$solidjsweb.addEventListener(_el$2, "click", $gVhhF$depictaiutilishared.catchify(() => set_rows_visible()(prev => prev + (rows_or_empty_object().rows_per_click ?? 1))), true);
2751
- $gVhhF$solidjsweb.className(_el$2, `load-more-container ${view_more_button_class}`);
2752
- $gVhhF$solidjsweb.insert(_el$2, () => rows_or_empty_object().button);
2753
- $gVhhF$solidjsweb.runHydrationEvents();
2754
- return _el$2;
2755
- })());
2756
- // 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
2757
- const view_less_button_container = $gVhhF$solidjs.createMemo(() => have_a_view_less_button() && (() => {
2758
- const _el$3 = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$);
2759
- $gVhhF$solidjsweb.addEventListener(_el$3, "click", $gVhhF$depictaiutilishared.catchify(() => set_rows_visible()(() => rows_or_empty_object().start_rows ?? 1)), true);
2760
- $gVhhF$solidjsweb.className(_el$3, `load-less-container ${view_less_button_class}`);
2761
- $gVhhF$solidjsweb.insert(_el$3, () => rows_or_empty_object().view_less_button);
2762
- $gVhhF$solidjsweb.runHydrationEvents();
2763
- return _el$3;
2764
- })());
2765
- container_element.classList.add(container_class);
2766
- $gVhhF$solidjs.createComputed(() => {
2767
- // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
2768
- const rows_visible = get_rows_visible();
2769
- const max_rows = rows_or_empty_object().max_rows;
2770
- if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
2771
- });
2772
- $gVhhF$solidjs.createRenderEffect(() => {
2773
- // Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
2774
- if (show_all_rows()) {
2775
- // no view more functionality requested
2776
- set_styling(() => col_styling);
2777
- return;
2778
- }
2779
- update_children_count();
2780
- const mutation_observer = new MutationObserver($gVhhF$depictaiutilishared.catchify(update_children_count));
2781
- mutation_observer.observe(container_element, {
2782
- childList: true
2783
- });
2784
- $gVhhF$solidjs.onCleanup(() => mutation_observer.disconnect());
2785
- set_styling(
2786
- // this is needed because solid will think that the memo-accessor is a setter function otherwise
2787
- () => $gVhhF$solidjs.createMemo(() => {
2788
- const {
2789
- rows_per_click: rows_per_click,
2790
- max_rows = -1,
2791
- start_rows: start_rows
2792
- } = rows_or_empty_object();
2793
- const rows_visible = get_rows_visible();
2794
- const children_count = get_children_count();
2795
- return col_styling() + props.cols_at_size.map(options => {
2796
- const [recs_per_row, min, max] = options;
2797
- let should_hide_view_more_button;
2798
- let visible_recs;
2799
- if (props.disable_partial_rows) {
2800
- visible_recs = $gVhhF$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
2801
- const visible_recs_next_show_more = $gVhhF$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
2802
- // Should this really be zero when we default rows_per_click to 1?
2803
- children_count, options);
2804
- should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
2805
- } else {
2806
- visible_recs = $gVhhF$depictaiutilishared.layout_get_total_rec_amount_for_row(rows_visible, options);
2807
- should_hide_view_more_button = visible_recs >= children_count;
3202
+ // set counts to 0
3203
+ if ("counts" in new_meta) {
3204
+ const counts = new_meta.counts;
3205
+ if (counts) new_meta.counts = counts.map(() => 0);
3206
+ }
3207
+ if (Array.isArray(selected_filter_data) && "values" in new_meta) {
3208
+ // we have an array of values and want to strip the ones from the available ones that aren't selected
3209
+ const values = new_meta.values;
3210
+ if (Array.isArray(values)) {
3211
+ const jsond_set_values = selected_filter_data.map(data => JSON.stringify(data));
3212
+ const indexes_to_remove = new Set();
3213
+ for (let i = 0; i < values.length; i++) {
3214
+ const value = values[i];
3215
+ if (!jsond_set_values.includes(JSON.stringify(value)))
3216
+ // We want to remove the entry with this value from the filter object because it's not selected
3217
+ indexes_to_remove.add(i);
2808
3218
  }
2809
- const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
2810
- // 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
2811
- 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;
2812
- return `${$gVhhF$depictaiutilishared.layout_media_query_header(min, max)}{${selector_beginning}:nth-child(n+${visible_recs + 1}){display:none}${props.layout == "slider" ? `${selector_beginning}:nth-child(n+${visible_recs}){margin-right:0}` : ""}${should_hide_button_final ? `.depict .${view_more_button_class}{display:none!important}` : ``}${should_hide_view_less_button ? `.depict .${view_less_button_class}{display:none!important}` : ``}}`;
2813
- }).join("");
2814
- }));
2815
- });
2816
- return [container_element, $gVhhF$solidjsweb.memo(view_more_button_container), $gVhhF$solidjsweb.memo(view_less_button_container), (() => {
2817
- const _el$4 = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$2);
2818
- $gVhhF$solidjsweb.insert(_el$4, get_styling);
2819
- return _el$4;
2820
- })()];
3219
+ new_meta.values = values.filter((_, index) => !indexes_to_remove.has(index));
3220
+ if (new_meta.names) new_meta.names = new_meta.names.filter((_, index) => !indexes_to_remove.has(index));
3221
+ if (new_meta.counts)
3222
+ // remove counts that are too much, they're all zero anyway if they exist
3223
+ new_meta.counts.length -= indexes_to_remove.size;
3224
+ }
3225
+ }
3226
+ }
3227
+ return modified_filter_object;
2821
3228
  }
2822
- $gVhhF$solidjsweb.delegateEvents(["click"]);
2823
3229
  async function $9abb0a35d4b60ed3$export$79b1565500412d9b(search_modal, modal_fn_opts) {
2824
3230
  const body = await (0, $gVhhF$depictaiutilishared.observer).wait_for_element("body");
2825
3231
  let dispose_and_remove;
@@ -3515,92 +3921,6 @@ function $0d0b172488865048$export$ef6006467f04ee41({
3515
3921
  })()];
3516
3922
  }
3517
3923
  $gVhhF$solidjsweb.delegateEvents(["click"]);
3518
- function $fc23d7668ae0011d$export$a2cc176055f8f08() {
3519
- 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.";
3520
- return (0, $gVhhF$solidjsweb.isServer) ? `<!-- ${text} -->` : document.createComment(text);
3521
- }
3522
- let $0caf87eaa19079da$var$cached_placeholder_element;
3523
- let $0caf87eaa19079da$var$rendering_cached_placeholder_element;
3524
- function $0caf87eaa19079da$export$f33414a4df0afd3f({
3525
- product_card_template_: product_card_template_,
3526
- num_placeholders_: num_placeholders_
3527
- }) {
3528
- const [get_elements, set_elements] = $gVhhF$solidjs.createSignal([]);
3529
- let existing_num = 0;
3530
- if (0, $gVhhF$solidjsweb.isServer)
3531
- // want to render simple placeholders on server, effects don't run there
3532
- return $gVhhF$solidjs.createMemo(() => Array.from({
3533
- length: num_placeholders_()
3534
- }).map(() => {
3535
- const template_result = product_card_template_(null, undefined);
3536
- // @ts-ignore
3537
- if (typeof template_result?.then !== "function") return template_result;
3538
- }));
3539
- $gVhhF$solidjs.createRenderEffect(() => {
3540
- const to_add = num_placeholders_() - existing_num;
3541
- if (to_add <= 0) return;
3542
- // 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.
3543
- // 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.
3544
- // 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.
3545
- set_elements(prev => [...prev, ...Array.from({
3546
- length: to_add
3547
- }).map(() => $0caf87eaa19079da$var$Placeholder({
3548
- product_card_template_: product_card_template_
3549
- }))]);
3550
- existing_num += to_add;
3551
- });
3552
- return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
3553
- }
3554
- /**
3555
- * Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
3556
- */
3557
- function $0caf87eaa19079da$var$Placeholder({
3558
- product_card_template_: product_card_template_
3559
- }) {
3560
- const get_cloned_placeholders = (element_to_clone = $0caf87eaa19079da$var$cached_placeholder_element) => Array.isArray(element_to_clone) ? element_to_clone.map(el => el instanceof Node ? el.cloneNode(true) : el) : element_to_clone;
3561
- if ($0caf87eaa19079da$var$cached_placeholder_element) return get_cloned_placeholders();
3562
- let dispose_original_copy;
3563
- const get_unwrapped_element = $gVhhF$solidjs.createRoot(dispose => {
3564
- dispose_original_copy = dispose;
3565
- // if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
3566
- const [resource] = $gVhhF$solidjs.createResource(() => {
3567
- if ($0caf87eaa19079da$var$rendering_cached_placeholder_element) return $0caf87eaa19079da$var$rendering_cached_placeholder_element;
3568
- const return_value = product_card_template_(null, undefined);
3569
- if (typeof return_value === "object" && typeof return_value?.then === "function")
3570
- // Is Promise or promise-like object
3571
- $0caf87eaa19079da$var$rendering_cached_placeholder_element = return_value;
3572
- return return_value;
3573
- });
3574
- return $gVhhF$solidjs.createMemo(() => {
3575
- if (resource.loading) return () => [];
3576
- return $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(resource);
3577
- });
3578
- });
3579
- $gVhhF$solidjs.onCleanup(() => {
3580
- if ($0caf87eaa19079da$var$rendering_cached_placeholder_element) {
3581
- // 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
3582
- const unset_current_rendering = () => {
3583
- dispose_original_copy();
3584
- $0caf87eaa19079da$var$rendering_cached_placeholder_element = undefined;
3585
- };
3586
- $0caf87eaa19079da$var$rendering_cached_placeholder_element?.then(unset_current_rendering, unset_current_rendering);
3587
- } else
3588
- // Otherwise, just make sure we've disposed our root
3589
- dispose_original_copy();
3590
- });
3591
- return $gVhhF$solidjs.createMemo(() => {
3592
- const unwrapped_array = get_unwrapped_element()();
3593
- if (!unwrapped_array?.length || !unwrapped_array.every(item => item))
3594
- // Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
3595
- return;
3596
- // placeholders have finished rendering, freeze the elements
3597
- // 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
3598
- $0caf87eaa19079da$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
3599
- $0caf87eaa19079da$var$rendering_cached_placeholder_element = undefined;
3600
- dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
3601
- 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
3602
- });
3603
- }
3604
3924
 
3605
3925
  /*
3606
3926
  * 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.
@@ -3706,86 +4026,6 @@ function $4117463e2939f5f4$export$63dd0350f8559dda({
3706
4026
  equals: false
3707
4027
  });
3708
4028
  }
3709
-
3710
- /**
3711
- * Gets product_id (the thing we key the rendering on) from a display
3712
- */
3713
- function $a5871dacf261adf8$export$548d053aba053d79(display) {
3714
- if ("variant_index" in display) {
3715
- const actual_display = display.variant_displays[display.variant_index];
3716
- return actual_display.product_id;
3717
- }
3718
- return display.product_id;
3719
- }
3720
- function $a73063cc642f3e5f$export$7f8bd308237ab5a5(get_displays_) {
3721
- const displays_by_key_ = $gVhhF$solidjs.createMemo(() => {
3722
- const displays = get_displays_();
3723
- // We key by product_id because that's what can be used to uniquely identify products
3724
- // This way <For> can optimize the rendering
3725
- const map = new Map();
3726
- for (let i = 0; i < displays.length; i++) {
3727
- const display = displays[i];
3728
- const product_id = $a5871dacf261adf8$export$548d053aba053d79(display);
3729
- map.set(product_id, display);
3730
- }
3731
- return map;
3732
- });
3733
- return displays_by_key_;
3734
- }
3735
- function $a73063cc642f3e5f$export$43f0fb951fcb0c54({
3736
- displays_by_key_: displays_by_key_,
3737
- merchant_: merchant_,
3738
- market_: market_,
3739
- product_card_template_: product_card_template_,
3740
- do_per_elements_: do_per_elements_
3741
- }) {
3742
- return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.For), {
3743
- get each() {
3744
- return [...displays_by_key_().keys()];
3745
- },
3746
- children: (product_id, index) => {
3747
- const owner = $gVhhF$solidjs.getOwner();
3748
- const display_accessor = $gVhhF$solidjs.createMemo(() => displays_by_key_().get(product_id));
3749
- const [product_card_resource] = $gVhhF$solidjs.createResource(display_accessor,
3750
- // re-render when the reference to the display object changes
3751
- // this should only be the case when the merchant or market changes and the new request has completed
3752
- display => {
3753
- // get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
3754
- return product_card_template_(display, {
3755
- set_on_index_change: fn => $gVhhF$solidjs.runWithOwner(owner, () => $gVhhF$solidjs.createEffect(() => fn(index()))),
3756
- merchant: $gVhhF$solidjs.untrack(merchant_),
3757
- // 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
3758
- market: $gVhhF$solidjs.untrack(market_)
3759
- });
3760
- });
3761
- const node_accessor = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(product_card_resource);
3762
- $gVhhF$solidjs.createEffect(() => {
3763
- const product_card_nodes = node_accessor();
3764
- const display = display_accessor();
3765
- const elements = [];
3766
- for (let i = 0; i < product_card_nodes.length; i++) {
3767
- const element = product_card_nodes[i];
3768
- if (!(element instanceof Element)) continue;
3769
- elements.push(element);
3770
- // Add tracking ids
3771
- if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
3772
- const {
3773
- dataset: dataset
3774
- } = element;
3775
- const {
3776
- search_result_id: search_result_id,
3777
- product_listing_result_id: product_listing_result_id,
3778
- recommendation_id: recommendation_id
3779
- } = display;
3780
- 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;
3781
- }
3782
- do_per_elements_?.(elements, index);
3783
- });
3784
- return product_card_resource; // https://github.com/solidjs/solid/releases/tag/v1.7.0
3785
- }
3786
- });
3787
- }
3788
-
3789
4029
  function $ac167f6af6a48fc3$export$a1fd619a4743ca08({
3790
4030
  plp_results_: plp_results_,
3791
4031
  product_card_template_: product_card_template_,
@@ -6071,41 +6311,6 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
6071
6311
  return _el$13;
6072
6312
  })()];
6073
6313
  }
6074
- const $4e04be41243c3d80$var$transform_elements = sorted_cols_at_size => {
6075
- const cols_at_size = [];
6076
- for (let i = 0; i < sorted_cols_at_size.length; i++) {
6077
- const [nb_cols, width] = sorted_cols_at_size[i];
6078
- const next_width = sorted_cols_at_size[i + 1]?.[1];
6079
- const max_width = i === 0 ? "" : `${width}px`;
6080
- const min_width = next_width !== undefined ? `${next_width + 1}px` : "";
6081
- const col_at_size = [nb_cols, min_width, max_width];
6082
- cols_at_size.push(col_at_size);
6083
- }
6084
- return cols_at_size;
6085
- };
6086
- const $4e04be41243c3d80$export$6daf8749b65a1b77 = cols_at_size => {
6087
- // Check that every element is an array
6088
- const are_arrays = cols_at_size.every(element => Array.isArray(element));
6089
- if (!are_arrays) throw new Error("Every element in cols_at_size must be an array");
6090
- // Check width duplicates
6091
- const widths = cols_at_size.map(([_, width]) => width);
6092
- const widths_set = new Set(widths);
6093
- if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
6094
- if (cols_at_size.length === 1) {
6095
- const [nb_cols, width] = cols_at_size[0];
6096
- const max_width = width !== undefined ? `${width}px` : "";
6097
- return [[nb_cols, "", max_width]];
6098
- }
6099
- // Sort widths in ascending order
6100
- const sorted_cols_at_size = [...cols_at_size].sort((a, b) => {
6101
- const [_b, width_A] = a;
6102
- const [_a, width_b] = b;
6103
- if (width_A === undefined) return -1;
6104
- if (width_b === undefined) return 1;
6105
- return width_b - width_A;
6106
- });
6107
- return $4e04be41243c3d80$var$transform_elements(sorted_cols_at_size);
6108
- };
6109
6314
  function $95837413165cc2df$export$23fca46f3143581f(component, error_message) {
6110
6315
  const component_in_error_boundary = do_with_elements => {
6111
6316
  const error_boundary_wrapped = $edafe91daf3091d7$export$b69d0d92862de18b({
@@ -6409,7 +6614,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
6409
6614
  #meta_title_suffix_ = $gVhhF$solidjs.createSignal();
6410
6615
  #disable_override_query_id = $gVhhF$solidjs.createSignal();
6411
6616
  #listing_type_signal = $gVhhF$solidjs.createSignal();
6412
- static #keys_constructed_with = new Set();
6617
+ static #keys_constructed_with = /*@__PURE__*/new Set();
6413
6618
  get localization() {
6414
6619
  // allow reactive access
6415
6620
  return this.#locale_signal[0]();
@@ -9655,27 +9860,6 @@ function $d8e94ea381ab57fa$export$828dcdd425fd3231(aligner) {
9655
9860
  cleanup: cleanup
9656
9861
  };
9657
9862
  }
9658
-
9659
- /**
9660
- * 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
9661
- */
9662
- function $ab7c6c7911bae2f5$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_for_more_than_one_column = 500) {
9663
- if (!sdk_cols_at_size.length) return sdk_cols_at_size;
9664
- const sorted_sizes = sdk_cols_at_size.map(([cols, max_width]) => [cols, max_width ?? Infinity]).sort(([, a], [, b]) => a - b);
9665
- const [[, smallest_max_width]] = sorted_sizes;
9666
- if (smallest_max_width > min_width_for_more_than_one_column)
9667
- // If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
9668
- return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
9669
- const to_delete = [];
9670
- for (let i = 0; i < sorted_sizes.length; i++) {
9671
- const [, max_width] = sorted_sizes[i];
9672
- if (max_width > min_width_for_more_than_one_column) continue;
9673
- to_delete.push(i);
9674
- }
9675
- while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
9676
- sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
9677
- return sorted_sizes.map(([cols, max_width]) => max_width == Infinity ? [cols] : [cols, max_width]);
9678
- }
9679
9863
  const $2c61e4cd8229c49a$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="depict plp search"></div>`, 2);
9680
9864
  // We just pass page_url_creator to DepictAPI when we instantiate it, so don't allow it to be specified if api is already specified
9681
9865
  /**
@@ -9694,7 +9878,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
9694
9878
  #market_signal = $gVhhF$solidjs.createSignal();
9695
9879
  #modal_open_signal = $gVhhF$solidjs.createSignal(false);
9696
9880
  #content_search_signal = $gVhhF$solidjs.createSignal();
9697
- static #keys_constructed_with = new Set();
9881
+ static #keys_constructed_with = /*@__PURE__*/new Set();
9698
9882
  #router = new (0, $e96dd13889871fc0$export$7e1297a3a19f10d8)("hard_navigation");
9699
9883
  constructor({
9700
9884
  unique_instance_key_for_state = "",
@@ -10212,7 +10396,7 @@ class $0a6acf31d1eae57c$export$3ccaa27d81dd8556 extends EventTarget {
10212
10396
  #revert_fns = [];
10213
10397
  #is_open = false;
10214
10398
  static #reverting_permitted = true;
10215
- static #visited_urls = (() => {
10399
+ static #visited_urls = /*@__PURE__*/(() => {
10216
10400
  // 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).
10217
10401
  $gVhhF$depictaiutilishared.catchify(async () => {
10218
10402
  // Static initialization blocks aren't supported in MobileSafari yet, otherwise this would be one.
@@ -10253,14 +10437,14 @@ class $0a6acf31d1eae57c$export$3ccaa27d81dd8556 extends EventTarget {
10253
10437
  return $gVhhF$depictaiutilishared.catchify(this.render_, "rendering failed")() || [];
10254
10438
  });
10255
10439
  }
10256
- #unload = $gVhhF$depictaiutilishared.catchify(() => {
10440
+ #unload = /*@__PURE__*/$gVhhF$depictaiutilishared.catchify(() => {
10257
10441
  if (!this.#is_open) return;
10258
10442
  this.#disconnect_observer?.();
10259
10443
  if ($0a6acf31d1eae57c$export$3ccaa27d81dd8556.#reverting_permitted) while (this.#revert_fns.length) this.#revert_fns.pop()?.();
10260
10444
  this.#is_open = false;
10261
10445
  this.dispatchEvent(new CustomEvent("close"));
10262
10446
  }, "failed to close page");
10263
- #load = $gVhhF$depictaiutilishared.catchify(async els => {
10447
+ #load = /*@__PURE__*/$gVhhF$depictaiutilishared.catchify(async els => {
10264
10448
  this.#is_open = true;
10265
10449
  // So that #load doesn't get called again
10266
10450
  let set_should_stay_inserted;