@depict-ai/ui 4.7.29 → 4.7.31

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.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  var $52FdA$depictaiutilishared = require("@depict-ai/utilishared/ES10");
2
- var $52FdA$depictaiutilisharedlatest = require("@depict-ai/utilishared/ES10");
3
- var $52FdA$solidjs = require("solid-js");
4
2
  var $52FdA$solidjsweb = require("solid-js/web");
3
+ var $52FdA$solidjs = require("solid-js");
4
+ var $52FdA$solidjsstore = require("solid-js/store");
5
+ var $52FdA$depictaiutilisharedlatest = require("@depict-ai/utilishared/ES10");
5
6
  var $52FdA$babelruntimehelpersdefineProperty = require("@babel/runtime/helpers/defineProperty");
6
7
  var $52FdA$babelruntimehelpersclassPrivateFieldSet = require("@babel/runtime/helpers/classPrivateFieldSet");
7
8
  var $52FdA$babelruntimehelpersclassPrivateFieldGet = require("@babel/runtime/helpers/classPrivateFieldGet");
8
- var $52FdA$solidjsstore = require("solid-js/store");
9
9
  require("../multi_import_deduplicator.cjs").register_es_version("ui", "ES10");
10
10
  function $parcel$export(e, n, v, s) {
11
11
  Object.defineProperty(e, n, {
@@ -18,6 +18,7 @@ function $parcel$export(e, n, v, s) {
18
18
  function $parcel$interopDefault(a) {
19
19
  return a && a.__esModule ? a.default : a;
20
20
  }
21
+ $parcel$export(module.exports, "remap_blocks_to_index", () => $f8f375d6245ffff2$export$92aa5d691d588f3f);
21
22
  $parcel$export(module.exports, "useMobileHover", () => $0deb6ff75e3d67c6$export$d4d96868197be50e);
22
23
  $parcel$export(module.exports, "useVisibilityState", () => $e7a7d2fe8a8217d8$export$54299a3c81f5425);
23
24
  $parcel$export(module.exports, "useSlidableInformation", () => $ad8ec7729fffeb9c$export$eaa625fb39439e37);
@@ -110,7 +111,437 @@ $parcel$export(module.exports, "BreadCrumbs", () => $335c02c1241a9ca8$export$5b7
110
111
  $parcel$export(module.exports, "QuickLinks", () => $335c02c1241a9ca8$export$de035477d6fef996);
111
112
  $parcel$export(module.exports, "CategoryPage", () => $c10e33c4681f8c9b$export$e2bf8ce7779e827e);
112
113
  /*! Depict.ai search and product listing SDK */
113
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.7.29";
114
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.7.31";
115
+ function $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query) {
116
+ const signal = $52FdA$solidjs.createSignal(false);
117
+ $52FdA$solidjs.onCleanup($52FdA$depictaiutilishared.javascript_media_query(media_query, _ref => {
118
+ let {
119
+ matches: matches
120
+ } = _ref;
121
+ return signal[1](matches);
122
+ }).remove);
123
+ return signal[0];
124
+ }
125
+ function $478e5a09664da64c$export$a79e666719b3647c(cols_at_size_) {
126
+ const size_active = $52FdA$solidjs.createMemo(() => cols_at_size_().map(_ref => {
127
+ let [n_cols, min_width, max_width] = _ref;
128
+ const media_query = $52FdA$depictaiutilishared.layout_media_query_header(min_width, max_width).replaceAll("@media", "");
129
+ const matches = $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query);
130
+ return [matches, n_cols];
131
+ }));
132
+ const n_cols_currently_showing = $52FdA$solidjs.createMemo(() => {
133
+ try {
134
+ const [, n_cols_currently_showing] = size_active().find(_ref2 => {
135
+ let [media_query] = _ref2;
136
+ return media_query();
137
+ });
138
+ return n_cols_currently_showing;
139
+ } catch (e) {
140
+ $52FdA$depictaiutilishared.dwarn("No active size found in columnsAtSize - can't render content blocks or looks");
141
+ return null;
142
+ }
143
+ });
144
+ return n_cols_currently_showing;
145
+ }
146
+
147
+ // Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
148
+ class $95e4006e1dcb5b72$export$e1d52e4f0c7557a1 extends Error {}
149
+ class $95e4006e1dcb5b72$export$aa14a9f43128f61f extends $95e4006e1dcb5b72$export$e1d52e4f0c7557a1 {
150
+ constructor(templateError) {
151
+ super("Uncaught error in product card template", {
152
+ cause: templateError
153
+ });
154
+ }
155
+ }
156
+ var $1b3cf201cdd38687$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div><!$><!/><!$><!/>`);
157
+ const $1b3cf201cdd38687$var$ExtraInfoContext = /*@__PURE__*/$52FdA$solidjs.createContext();
158
+ function $1b3cf201cdd38687$export$240ecf5363d76c0f(props) {
159
+ return $52FdA$solidjsweb.createComponent($1b3cf201cdd38687$var$ExtraInfoContext.Provider, {
160
+ get value() {
161
+ return props.getContext_;
162
+ },
163
+ get children() {
164
+ return props.children;
165
+ }
166
+ });
167
+ }
168
+ function $1b3cf201cdd38687$export$b69d0d92862de18b(props) {
169
+ const getContextFunction = $52FdA$solidjs.useContext($1b3cf201cdd38687$var$ExtraInfoContext);
170
+ return $52FdA$solidjs.ErrorBoundary({
171
+ fallback(err, retry) {
172
+ const {
173
+ message_: message_,
174
+ severity_: severity_
175
+ } = props;
176
+ let message = message_;
177
+ if (err instanceof (0, $95e4006e1dcb5b72$export$aa14a9f43128f61f)) {
178
+ console.error(err.cause);
179
+ message = "".concat(message, ": ").concat(err.message);
180
+ } else $52FdA$depictaiutilishared.report([err, message_], severity_, getContextFunction === null || getContextFunction === void 0 ? void 0 : getContextFunction());
181
+ return (() => {
182
+ var _el$ = $52FdA$solidjsweb.getNextElement($1b3cf201cdd38687$var$_tmpl$),
183
+ _el$2 = _el$.firstChild,
184
+ [_el$3, _co$] = $52FdA$solidjsweb.getNextMarker(_el$2.nextSibling),
185
+ _el$4 = _el$3.nextSibling,
186
+ [_el$5, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$4.nextSibling);
187
+ $52FdA$solidjsweb.insert(_el$, message, _el$3, _co$);
188
+ $52FdA$solidjsweb.insert(_el$, () => {
189
+ var _props$on_error_;
190
+ return (_props$on_error_ = props.on_error_) === null || _props$on_error_ === void 0 ? void 0 : _props$on_error_.call(props, retry);
191
+ }, _el$5, _co$2);
192
+ $52FdA$solidjsweb.effect(_$p => {
193
+ var _props$class_list_;
194
+ return $52FdA$solidjsweb.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);
195
+ });
196
+ return _el$;
197
+ })();
198
+ },
199
+ get children() {
200
+ return props.children;
201
+ }
202
+ });
203
+ }
204
+ var $830518481649feb1$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div>`),
205
+ $830518481649feb1$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<style type=text/css>`);
206
+ const $830518481649feb1$export$c500183c31c2b22e = "--spans-columns";
207
+ function $830518481649feb1$export$ab6b147eec64fea5(props) {
208
+ const container_class = "x" + $52FdA$solidjs.createUniqueId();
209
+ const container_element_ = (() => {
210
+ var _el$ = $52FdA$solidjsweb.getNextElement($830518481649feb1$var$_tmpl$);
211
+ $52FdA$solidjsweb.spread(_el$, $52FdA$solidjsweb.mergeProps(() => props.element_attributes, {
212
+ "classList": {
213
+ [container_class]: true
214
+ }
215
+ }), false, true);
216
+ $52FdA$solidjsweb.insert(_el$, () => props.children);
217
+ $52FdA$solidjsweb.runHydrationEvents();
218
+ return _el$;
219
+ })(); // Don't want this in the error boundary below, it should only be for the actual layouting
220
+ return $52FdA$solidjsweb.createComponent((0, $1b3cf201cdd38687$export$b69d0d92862de18b), {
221
+ message_: "Failed calculating css grid layout",
222
+ severity_: "error",
223
+ get children() {
224
+ return $830518481649feb1$export$e2f22da34aaf310a(props, container_element_, false, container_class);
225
+ }
226
+ });
227
+ }
228
+ function $830518481649feb1$export$e2f22da34aaf310a(props, container_element) {
229
+ let insert_after_container = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
230
+ let container_class = arguments.length > 3 ? arguments[3] : undefined;
231
+ if (!container_class) {
232
+ // only try to add if it wasn't provided, so that we have a code path without classList when doing SSR
233
+ container_class = $52FdA$depictaiutilishared.make_random_classname();
234
+ container_element.classList.add(container_class);
235
+ }
236
+ const container_selector = ".depict .".concat(container_class); // class so ppl can have id if needed
237
+ const col_styling = $52FdA$solidjs.createMemo(() => $830518481649feb1$var$generate_media_queried_declarations({
238
+ container_selector_: container_selector,
239
+ default_grid_spacing_text: props.grid_spacing,
240
+ cols_at_size_: props.cols_at_size,
241
+ override_vertical_spacing_: props.override_vertical_spacing,
242
+ top_row_shortened_by_: props.top_row_shortened_by_()
243
+ }));
244
+ const base_styling = $52FdA$solidjs.createMemo(() => {
245
+ return "".concat(container_selector, "{display:grid;}");
246
+ });
247
+ const get_styling = $52FdA$solidjs.createMemo(() => base_styling() + col_styling());
248
+ const style_element = (() => {
249
+ var _el$2 = $52FdA$solidjsweb.getNextElement($830518481649feb1$var$_tmpl$2);
250
+ $52FdA$solidjsweb.insert(_el$2, get_styling);
251
+ return _el$2;
252
+ })(); // need to create this after set_styling has been called or else there will be no styling in the SSR'd output
253
+ if (insert_after_container) container_element.after(style_element);
254
+ return [container_element, style_element];
255
+ }
256
+ function $830518481649feb1$var$generate_media_queried_declarations(_ref) {
257
+ let {
258
+ container_selector_: container_selector_,
259
+ default_grid_spacing_text: default_grid_spacing_text,
260
+ cols_at_size_: cols_at_size_,
261
+ override_vertical_spacing_: override_vertical_spacing_,
262
+ top_row_shortened_by_: top_row_shortened_by_
263
+ } = _ref;
264
+ return cols_at_size_.map(options => {
265
+ const [n_cols, min, max, grid_spacing_for_size] = options;
266
+ const main_spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
267
+ // See comment in else block below
268
+ const can_use_gap = override_vertical_spacing_ ? $830518481649feb1$var$can_use_gap_for_unit(override_vertical_spacing_) : $830518481649feb1$var$can_use_gap_for_unit(main_spacing_to_use);
269
+ let spacing_styling;
270
+ let additional_styling = ""; // outside the media query
271
+ if (can_use_gap) spacing_styling = "gap:".concat(main_spacing_to_use, ";").concat(override_vertical_spacing_ ? "row-gap:".concat(override_vertical_spacing_, ";") : "");else {
272
+ // When using percent units, which our default styling does (because convenient) and our interface relies on (hard to specify different gaps for different screen sizes)
273
+ // row gaps in grids are relative to the whole height of the grid, maybe see also https://stackoverflow.com/a/53563865. The issue with that is that as we load more products, the gap grows. Also, it breaks existing integrations.
274
+ // Logical thought: use margins for the vertical spacing. But margins in grids are apparently relative to the size of the individual items in grids.
275
+ // Given that, and that content blocks can be of different width, we have to do some complicated calculations to convert the provided gap, which is in gap of the total container width, to a margin of the individual items.
276
+ const vertical_spacing_to_use = override_vertical_spacing_ !== null && override_vertical_spacing_ !== void 0 ? override_vertical_spacing_ : main_spacing_to_use;
277
+ const width_multiplier = "var(".concat($830518481649feb1$export$c500183c31c2b22e, ", 1)"); // How many cards wide the current item is (needed because content blocks)
278
+ const one_item_width_exclusing_gaps = "calc(calc(100 / ".concat(n_cols, ") - calc(calc(").concat(n_cols * 2 - 2, " * calc(").concat($830518481649feb1$var$strip_percent_unit(vertical_spacing_to_use), " / 2)) / ").concat(n_cols, "))"); // Width of one item in percent of the whole
279
+ // Equation from layout.tsx, also used in CheckboxGrid. Needs half spacing for some reason
280
+ const this_item_width_meat = "calc(".concat(one_item_width_exclusing_gaps, " * ").concat(width_multiplier, ")"); // Width of just the card
281
+ const this_item_width_gaps = "calc(calc(".concat(width_multiplier, " - 1) * ").concat($830518481649feb1$var$strip_percent_unit(vertical_spacing_to_use), ")"); // Width of the gaps
282
+ const this_item_width = "calc(".concat(this_item_width_meat, " + ").concat(this_item_width_gaps, ")"); // Width of this item including gaps
283
+ // this_item_width needs to be unitless, and since plain css can't do calc(40% / 5%) which would become unitless we need to strip all units in the calculations before
284
+ const convert_top_spacing_to_item_width_percentage = spacing => "calc(calc(100 / ".concat(this_item_width, ") * ").concat(spacing, ")"); // Now finally we can convert the desired spacing to a percentage of this individual item's width (including gaps that would be there but aren't because content blocks span them)
285
+ spacing_styling = "column-gap:".concat(main_spacing_to_use, ";"); // Still use gaps in the horizontal direction because that works flawlessly
286
+ // Re-use old layout code to get the correct :nth-child declarations for the top margins
287
+ additional_styling = $52FdA$depictaiutilishared.n_col_styling_with_dist(container_selector_ + ">", convert_top_spacing_to_item_width_percentage(default_grid_spacing_text), [[n_cols, min, max, grid_spacing_for_size ? convert_top_spacing_to_item_width_percentage(grid_spacing_for_size) : null]], "grid", override_vertical_spacing_ ? convert_top_spacing_to_item_width_percentage(override_vertical_spacing_) : override_vertical_spacing_, top_row_shortened_by_);
288
+ }
289
+ const media_query_body = "".concat(container_selector_, "{").concat(spacing_styling, "grid-template-columns:repeat(").concat(n_cols, ",minmax(0,1fr));}");
290
+ return "".concat($52FdA$depictaiutilishared.layout_media_query_header(min, max), "{").concat(media_query_body, "}").concat(additional_styling);
291
+ }).join("");
292
+ }
293
+ function $830518481649feb1$var$can_use_gap_for_unit(spacing) {
294
+ const trimmed_spacing = spacing.trim();
295
+ return !trimmed_spacing.includes("%");
296
+ }
297
+ function $830518481649feb1$var$strip_percent_unit(css_value) {
298
+ return css_value.replaceAll("%", "");
299
+ }
300
+ var $e3d733f899558f40$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<span>`);
301
+ function $e3d733f899558f40$export$acb3eaade4b23afd(props) {
302
+ // Work around https://github.com/solidjs/solid/issues/1980
303
+ return (() => {
304
+ var _el$ = $52FdA$solidjsweb.getNextElement($e3d733f899558f40$var$_tmpl$);
305
+ $52FdA$solidjsweb.effect(_p$ => {
306
+ var _v$ = "".concat(props.class || "", " depict-placeholder"),
307
+ _v$2 = props.style;
308
+ _v$ !== _p$.e && $52FdA$solidjsweb.className(_el$, _p$.e = _v$);
309
+ _p$.t = $52FdA$solidjsweb.style(_el$, _v$2, _p$.t);
310
+ return _p$;
311
+ }, {
312
+ e: undefined,
313
+ t: undefined
314
+ });
315
+ return _el$;
316
+ })();
317
+ }
318
+ function $b8a8d61b3ec5f5ac$export$3f37af283f8fb843(props) {
319
+ const style = $52FdA$solidjs.createMemo(() => {
320
+ const {
321
+ style: style,
322
+ height: height,
323
+ width: width,
324
+ aspectRatio: aspectRatio
325
+ } = props;
326
+ const is_image = aspectRatio != undefined;
327
+ const size_data = is_image ? {
328
+ width: "100%",
329
+ "padding-bottom": "calc(calc(1 / ".concat(aspectRatio, ") * 100%)")
330
+ } : {
331
+ width: width,
332
+ height: height
333
+ };
334
+ return {
335
+ display: "block",
336
+ ...(style || {}),
337
+ ...size_data
338
+ };
339
+ });
340
+ return $52FdA$solidjsweb.createComponent((0, $e3d733f899558f40$export$acb3eaade4b23afd), {
341
+ get style() {
342
+ return style();
343
+ },
344
+ get ["class"]() {
345
+ return props.class;
346
+ }
347
+ });
348
+ }
349
+ var $f8f375d6245ffff2$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=content-block-wrapper>`);
350
+ function $f8f375d6245ffff2$export$791ef57e62e21c3f(_ref) {
351
+ let {
352
+ content_blocks_: incoming_content_blocks,
353
+ cols_at_size_: cols_at_size_,
354
+ set_top_row_shortened_by_: set_top_row_shortened_by_
355
+ } = _ref;
356
+ // these are by row
357
+ const [content_blocks, set_content_blocks] = $52FdA$solidjsstore.createStore([]);
358
+ const n_cols_currently_showing_ = $478e5a09664da64c$export$a79e666719b3647c(cols_at_size_);
359
+ $52FdA$solidjs.createEffect(() => {
360
+ const incoming_value = incoming_content_blocks();
361
+ if (!incoming_value) {
362
+ set_content_blocks([]);
363
+ return;
364
+ }
365
+ set_content_blocks($52FdA$solidjsstore.reconcile(incoming_value, {
366
+ key: "content"
367
+ })); // key: Make moving blocks faster, see https://github.com/solidjs/solid/issues/1925#issuecomment-1769671596
368
+ });
369
+
370
+ const get_wrapped_blocks_ = $f8f375d6245ffff2$var$wrap_blocks_in_div(content_blocks, n_cols_currently_showing_);
371
+ $52FdA$solidjs.createComputed(() => {
372
+ // Update our styling if a content block forces some items that should be in the top row into a lower one, so we can generate margin-top declarations for them
373
+ const top_row_block = get_wrapped_blocks_()[0];
374
+ const blocks_in_top_row_taken = top_row_block === null || top_row_block === void 0 ? void 0 : top_row_block.span_columns;
375
+ if (blocks_in_top_row_taken == undefined) {
376
+ // Fall back to zero if no content block in top row, since then no blocks in top row are taken
377
+ set_top_row_shortened_by_(0);
378
+ return;
379
+ }
380
+ set_top_row_shortened_by_(blocks_in_top_row_taken - 1); // minus one because the content block wrapper also is an element
381
+ });
382
+
383
+ return $52FdA$solidjs.createMemo(() => $f8f375d6245ffff2$export$92aa5d691d588f3f({
384
+ wrapped_blocks_: get_wrapped_blocks_(),
385
+ n_cols_currently_showing_: n_cols_currently_showing_()
386
+ }).content_blocks_by_index_);
387
+ }
388
+ function $f8f375d6245ffff2$export$92aa5d691d588f3f(_ref2) {
389
+ let {
390
+ wrapped_blocks_: wrapped_blocks_,
391
+ n_cols_currently_showing_: n_cols_currently_showing_
392
+ } = _ref2;
393
+ // This computation should be quite cheap since it just moves around things into an array
394
+ const content_blocks_by_index_ = [];
395
+ const constructed_block_arrays = new WeakSet();
396
+ // Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
397
+ const displaced_products_ = []; // undefined = is product, true = is content block if number instead of tuple number indicates content blocks in that row. Index in first array is row, index in second array is column
398
+ if (!n_cols_currently_showing_)
399
+ // Nope out of here if we don't know how many columns are showing
400
+ return {
401
+ content_blocks_by_index_: content_blocks_by_index_
402
+ };
403
+ for (let i = 0; i < wrapped_blocks_.length; i++) {
404
+ // i = row to show at
405
+ const block = wrapped_blocks_[i];
406
+ if (!block) continue; // Array can have holes/not defined places
407
+ const index_of_first_item_in_row = i * n_cols_currently_showing_;
408
+ const index_of_last_item_in_row = index_of_first_item_in_row + n_cols_currently_showing_;
409
+ const {
410
+ span_rows: span_rows,
411
+ position: position,
412
+ span_columns: span_columns
413
+ } = block; // span columns is already capped in the block wrapping step (wrap_blocks_in_div)
414
+ let target_index;
415
+ if (position === "left") target_index = index_of_first_item_in_row;else if (position === "right") target_index = index_of_last_item_in_row - span_columns;else if (position === "center") target_index = index_of_first_item_in_row + Math.floor((n_cols_currently_showing_ - span_columns) / 2);else throw new Error("Invalid position for content block - must be left, right or center: " + JSON.stringify(position));
416
+ // Calculate displacement of us by content blocks above us
417
+ let displacement_by_added_blocks = 0;
418
+ for (let j = 0; j < i; j++) {
419
+ const row = displaced_products_[j];
420
+ if (row === undefined) continue; // there were no blocks in this row
421
+ let displaced_items_in_row;
422
+ if (typeof row === "number") displaced_items_in_row = row;else {
423
+ displaced_items_in_row = row.filter(item => item).length;
424
+ displaced_products_[j] = displaced_items_in_row;
425
+ }
426
+ displacement_by_added_blocks += displaced_items_in_row;
427
+ }
428
+ const index_of_us_in_row = target_index - index_of_first_item_in_row;
429
+ for (let j = 0; j < index_of_us_in_row; j++) {
430
+ var _displaced_products_$;
431
+ if ((_displaced_products_$ = displaced_products_[i]) !== null && _displaced_products_$ !== void 0 && _displaced_products_$[j])
432
+ // Add blocks in our *current* row to the displacement, but only the ones to our left
433
+ displacement_by_added_blocks++;
434
+ }
435
+ // Add block to output array at the correct index
436
+ const final_target_index = target_index - displacement_by_added_blocks;
437
+ const existing_block = content_blocks_by_index_[final_target_index];
438
+ const block_content = block.content;
439
+ // If two blocks want to exist at the same location (can happen, for example if one block wants to be at the end of a row and the other one at the start of the next row) add an array with both
440
+ if (existing_block) {
441
+ if (constructed_block_arrays.has(existing_block))
442
+ // Only push to arrays we have created to not create funky bugs when there's an array in JSX.Element
443
+ existing_block.push(block_content);else {
444
+ const array = [existing_block, block_content];
445
+ constructed_block_arrays.add(array);
446
+ content_blocks_by_index_[final_target_index] = array;
447
+ }
448
+ } else content_blocks_by_index_[final_target_index] = block_content;
449
+ // Update displacement
450
+ for (let j = 0; j < span_rows; j++) {
451
+ var _ref3;
452
+ const row = displaced_products_[_ref3 = i + j] || (displaced_products_[_ref3] = []);
453
+ for (let k = index_of_us_in_row; k < index_of_us_in_row + span_columns; k++) row[k] = true;
454
+ }
455
+ }
456
+ return {
457
+ content_blocks_by_index_: content_blocks_by_index_,
458
+ displaced_products_: displaced_products_
459
+ };
460
+ }
461
+ /**
462
+ * Takes a store that contains an array from where index is number of row and value is the result of executing the content block rendering function.
463
+ * Then renders the content and wraps it into a div with the correct styling.
464
+ * Also caps span_columns to max available columns
465
+ */
466
+ function $f8f375d6245ffff2$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
467
+ const get_wrapped_blocks = $52FdA$solidjs.mapArray(() => rendered_content_blocks, block => {
468
+ if (!block) return;
469
+ const final_span_columns = $52FdA$solidjs.createMemo(() => {
470
+ var _max_span_columns;
471
+ return Math.min(block.span_columns, (_max_span_columns = max_span_columns()) !== null && _max_span_columns !== void 0 ? _max_span_columns : Infinity);
472
+ });
473
+ // If the item spans an entire row, limit the height to 1 row since there's no concept of "rows" if there are no products beside the block
474
+ const final_span_rows = $52FdA$solidjs.createMemo(() => final_span_columns() === max_span_columns() ? 1 : block.span_rows);
475
+ const [rendering_delayed, set_rendering_delayed_] = $52FdA$solidjs.createSignal(true);
476
+ const content = $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
477
+ get when() {
478
+ return !rendering_delayed();
479
+ },
480
+ get children() {
481
+ var _el$ = $52FdA$solidjsweb.getNextElement($f8f375d6245ffff2$var$_tmpl$);
482
+ $52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent($f8f375d6245ffff2$var$RenderContent, {
483
+ get content() {
484
+ return block.content;
485
+ }
486
+ }));
487
+ $52FdA$solidjsweb.effect(_p$ => {
488
+ var _v$ = {
489
+ [(0, $830518481649feb1$export$c500183c31c2b22e)]: final_span_columns()
490
+ },
491
+ _v$2 = "span ".concat(final_span_columns()),
492
+ _v$3 = "span ".concat(final_span_rows());
493
+ _p$.e = $52FdA$solidjsweb.style(_el$, _v$, _p$.e);
494
+ _v$2 !== _p$.t && ((_p$.t = _v$2) != null ? _el$.style.setProperty("grid-column", _v$2) : _el$.style.removeProperty("grid-column"));
495
+ _v$3 !== _p$.a && ((_p$.a = _v$3) != null ? _el$.style.setProperty("grid-row", _v$3) : _el$.style.removeProperty("grid-row"));
496
+ return _p$;
497
+ }, {
498
+ e: undefined,
499
+ t: undefined,
500
+ a: undefined
501
+ });
502
+ return _el$;
503
+ }
504
+ });
505
+ return $52FdA$solidjs.mergeProps(block, {
506
+ // Create content divs for the blocks with as much fine-grained diffing as possible?
507
+ content: () => {
508
+ // Sneaky on-demand rendering, so we don't render more blocks than we can show: we have the rendered value here and don't return a function that renders because if our block would be moved around we'd be guaranteed to re-render
509
+ // However, no need to count products to know if we should render: the <For> loops in Placeholders and render_displays will only call this function if there's actually a product here that wants to display this block
510
+ set_rendering_delayed_(false);
511
+ return content;
512
+ },
513
+ get span_columns() {
514
+ // Cap max width of block to the number of columns available, for everyone downstream
515
+ return final_span_columns();
516
+ },
517
+ get span_rows() {
518
+ return final_span_rows();
519
+ }
520
+ });
521
+ });
522
+ return get_wrapped_blocks;
523
+ }
524
+ /**
525
+ * Basically adds support for async content block functions and shows a rudimentary placeholder if rendering is delayed. Required due to react having a rendering delay.
526
+ */
527
+ function $f8f375d6245ffff2$var$RenderContent(props) {
528
+ const [resource] = $52FdA$solidjs.createResource(() => props.content,
529
+ // Could be reactive
530
+ fn => fn());
531
+ $52FdA$solidjs.createEffect(() => {
532
+ if (resource.error) console.error("Error in content block rendering", resource.error);
533
+ });
534
+ // The suspense is for when there's an async content block (which we have to support due to react having a rendering delay) so that we can show some height while it's loading (should kinda never be visible)
535
+ return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Suspense), {
536
+ get fallback() {
537
+ return $52FdA$solidjsweb.createComponent((0, $b8a8d61b3ec5f5ac$export$3f37af283f8fb843), {
538
+ width: "100%",
539
+ height: "max(100%, 400px)"
540
+ });
541
+ },
542
+ children: resource
543
+ });
544
+ }
114
545
  let $0deb6ff75e3d67c6$var$elementsHoveredSignal;
115
546
  let $0deb6ff75e3d67c6$var$consumersSignal;
116
547
  function $0deb6ff75e3d67c6$export$d4d96868197be50e() {
@@ -745,108 +1176,51 @@ function $e3915574cfd3466c$var$Placeholder(_ref2) {
745
1176
  return Array.isArray(element_to_clone) ? element_to_clone.map(el => el instanceof Node ? el.cloneNode(true) : el) : element_to_clone;
746
1177
  };
747
1178
  if ($e3915574cfd3466c$var$cachedPlaceholderElements[placeholderCacheKey_]) return get_cloned_placeholders();
748
- let dispose_original_copy;
749
- const get_unwrapped_element = $52FdA$solidjs.createRoot(dispose => {
750
- dispose_original_copy = dispose;
751
- // if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
752
- const [resource] = $52FdA$solidjs.createResource(() => {
753
- const rendering_cached_placeholder_element = $e3915574cfd3466c$var$renderingCachedPlaceholderElement[placeholderCacheKey_];
754
- if (rendering_cached_placeholder_element) return rendering_cached_placeholder_element;
755
- const return_value = product_card_template_(null, undefined);
756
- if (typeof return_value === "object" && typeof (return_value === null || return_value === void 0 ? void 0 : return_value.then) === "function")
757
- // Is Promise or promise-like object
758
- $e3915574cfd3466c$var$renderingCachedPlaceholderElement[placeholderCacheKey_] = return_value;
759
- return return_value;
760
- });
761
- return $52FdA$solidjs.createMemo(() => {
762
- if (resource.loading) return () => [];
763
- return $e82d0d417fa613e8$export$2f0cbfbb4354bb52(resource);
764
- });
765
- });
766
- $52FdA$solidjs.onCleanup(() => {
767
- const rendering = $e3915574cfd3466c$var$renderingCachedPlaceholderElement[placeholderCacheKey_];
768
- if (rendering) {
769
- // 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
770
- const unset_current_rendering = () => {
771
- dispose_original_copy();
772
- $e3915574cfd3466c$var$renderingCachedPlaceholderElement[placeholderCacheKey_] = undefined;
773
- };
774
- rendering === null || rendering === void 0 || rendering.then(unset_current_rendering, unset_current_rendering);
775
- } else
776
- // Otherwise, just make sure we've disposed our root
777
- dispose_original_copy();
778
- });
779
- return $52FdA$solidjs.createMemo(() => {
780
- const unwrapped_array = get_unwrapped_element()();
781
- if (!(unwrapped_array !== null && unwrapped_array !== void 0 && unwrapped_array.length) || !unwrapped_array.every(item => item))
782
- // Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
783
- return;
784
- // placeholders have finished rendering, freeze the elements
785
- // 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
786
- $e3915574cfd3466c$var$cachedPlaceholderElements[placeholderCacheKey_] || ($e3915574cfd3466c$var$cachedPlaceholderElements[placeholderCacheKey_] = 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
787
- $e3915574cfd3466c$var$renderingCachedPlaceholderElement[placeholderCacheKey_] = undefined;
788
- dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
789
- 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
790
- });
791
- }
792
-
793
- // Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
794
- class $95e4006e1dcb5b72$export$e1d52e4f0c7557a1 extends Error {}
795
- class $95e4006e1dcb5b72$export$aa14a9f43128f61f extends $95e4006e1dcb5b72$export$e1d52e4f0c7557a1 {
796
- constructor(templateError) {
797
- super("Uncaught error in product card template", {
798
- cause: templateError
799
- });
800
- }
801
- }
802
- var $1b3cf201cdd38687$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div><!$><!/><!$><!/>`);
803
- const $1b3cf201cdd38687$var$ExtraInfoContext = /*@__PURE__*/$52FdA$solidjs.createContext();
804
- function $1b3cf201cdd38687$export$240ecf5363d76c0f(props) {
805
- return $52FdA$solidjsweb.createComponent($1b3cf201cdd38687$var$ExtraInfoContext.Provider, {
806
- get value() {
807
- return props.getContext_;
808
- },
809
- get children() {
810
- return props.children;
811
- }
812
- });
813
- }
814
- function $1b3cf201cdd38687$export$b69d0d92862de18b(props) {
815
- const getContextFunction = $52FdA$solidjs.useContext($1b3cf201cdd38687$var$ExtraInfoContext);
816
- return $52FdA$solidjs.ErrorBoundary({
817
- fallback(err, retry) {
818
- const {
819
- message_: message_,
820
- severity_: severity_
821
- } = props;
822
- let message = message_;
823
- if (err instanceof (0, $95e4006e1dcb5b72$export$aa14a9f43128f61f)) {
824
- console.error(err.cause);
825
- message = "".concat(message, ": ").concat(err.message);
826
- } else $52FdA$depictaiutilishared.report([err, message_], severity_, getContextFunction === null || getContextFunction === void 0 ? void 0 : getContextFunction());
827
- return (() => {
828
- var _el$ = $52FdA$solidjsweb.getNextElement($1b3cf201cdd38687$var$_tmpl$),
829
- _el$2 = _el$.firstChild,
830
- [_el$3, _co$] = $52FdA$solidjsweb.getNextMarker(_el$2.nextSibling),
831
- _el$4 = _el$3.nextSibling,
832
- [_el$5, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$4.nextSibling);
833
- $52FdA$solidjsweb.insert(_el$, message, _el$3, _co$);
834
- $52FdA$solidjsweb.insert(_el$, () => {
835
- var _props$on_error_;
836
- return (_props$on_error_ = props.on_error_) === null || _props$on_error_ === void 0 ? void 0 : _props$on_error_.call(props, retry);
837
- }, _el$5, _co$2);
838
- $52FdA$solidjsweb.effect(_$p => {
839
- var _props$class_list_;
840
- return $52FdA$solidjsweb.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);
841
- });
842
- return _el$;
843
- })();
844
- },
845
- get children() {
846
- return props.children;
847
- }
1179
+ let dispose_original_copy;
1180
+ const get_unwrapped_element = $52FdA$solidjs.createRoot(dispose => {
1181
+ dispose_original_copy = dispose;
1182
+ // if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
1183
+ const [resource] = $52FdA$solidjs.createResource(() => {
1184
+ const rendering_cached_placeholder_element = $e3915574cfd3466c$var$renderingCachedPlaceholderElement[placeholderCacheKey_];
1185
+ if (rendering_cached_placeholder_element) return rendering_cached_placeholder_element;
1186
+ const return_value = product_card_template_(null, undefined);
1187
+ if (typeof return_value === "object" && typeof (return_value === null || return_value === void 0 ? void 0 : return_value.then) === "function")
1188
+ // Is Promise or promise-like object
1189
+ $e3915574cfd3466c$var$renderingCachedPlaceholderElement[placeholderCacheKey_] = return_value;
1190
+ return return_value;
1191
+ });
1192
+ return $52FdA$solidjs.createMemo(() => {
1193
+ if (resource.loading) return () => [];
1194
+ return $e82d0d417fa613e8$export$2f0cbfbb4354bb52(resource);
1195
+ });
1196
+ });
1197
+ $52FdA$solidjs.onCleanup(() => {
1198
+ const rendering = $e3915574cfd3466c$var$renderingCachedPlaceholderElement[placeholderCacheKey_];
1199
+ if (rendering) {
1200
+ // 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
1201
+ const unset_current_rendering = () => {
1202
+ dispose_original_copy();
1203
+ $e3915574cfd3466c$var$renderingCachedPlaceholderElement[placeholderCacheKey_] = undefined;
1204
+ };
1205
+ rendering === null || rendering === void 0 || rendering.then(unset_current_rendering, unset_current_rendering);
1206
+ } else
1207
+ // Otherwise, just make sure we've disposed our root
1208
+ dispose_original_copy();
1209
+ });
1210
+ return $52FdA$solidjs.createMemo(() => {
1211
+ const unwrapped_array = get_unwrapped_element()();
1212
+ if (!(unwrapped_array !== null && unwrapped_array !== void 0 && unwrapped_array.length) || !unwrapped_array.every(item => item))
1213
+ // Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
1214
+ return;
1215
+ // placeholders have finished rendering, freeze the elements
1216
+ // 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
1217
+ $e3915574cfd3466c$var$cachedPlaceholderElements[placeholderCacheKey_] || ($e3915574cfd3466c$var$cachedPlaceholderElements[placeholderCacheKey_] = 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
1218
+ $e3915574cfd3466c$var$renderingCachedPlaceholderElement[placeholderCacheKey_] = undefined;
1219
+ dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
1220
+ 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
848
1221
  });
849
1222
  }
1223
+
850
1224
  var $6c2c739b113a8ddf$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div>`),
851
1225
  $6c2c739b113a8ddf$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<style type=text/css>`);
852
1226
  function $6c2c739b113a8ddf$export$d21e32dfedac04be(props) {
@@ -1122,65 +1496,6 @@ function $d067f3a30f047b41$export$e68cff63f76bd15b(props) {
1122
1496
  function $d067f3a30f047b41$export$8d0c4fdbb05a2f2e() {
1123
1497
  return $52FdA$solidjs.useContext($d067f3a30f047b41$var$ListingContext);
1124
1498
  }
1125
- var $e3d733f899558f40$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<span>`);
1126
- function $e3d733f899558f40$export$acb3eaade4b23afd(props) {
1127
- // Work around https://github.com/solidjs/solid/issues/1980
1128
- return (() => {
1129
- var _el$ = $52FdA$solidjsweb.getNextElement($e3d733f899558f40$var$_tmpl$);
1130
- $52FdA$solidjsweb.effect(_p$ => {
1131
- var _v$ = "".concat(props.class || "", " depict-placeholder"),
1132
- _v$2 = props.style;
1133
- _v$ !== _p$.e && $52FdA$solidjsweb.className(_el$, _p$.e = _v$);
1134
- _p$.t = $52FdA$solidjsweb.style(_el$, _v$2, _p$.t);
1135
- return _p$;
1136
- }, {
1137
- e: undefined,
1138
- t: undefined
1139
- });
1140
- return _el$;
1141
- })();
1142
- }
1143
- function $b8a8d61b3ec5f5ac$export$3f37af283f8fb843(props) {
1144
- const style = $52FdA$solidjs.createMemo(() => {
1145
- const {
1146
- style: style,
1147
- height: height,
1148
- width: width,
1149
- aspectRatio: aspectRatio
1150
- } = props;
1151
- const is_image = aspectRatio != undefined;
1152
- const size_data = is_image ? {
1153
- width: "100%",
1154
- "padding-bottom": "calc(calc(1 / ".concat(aspectRatio, ") * 100%)")
1155
- } : {
1156
- width: width,
1157
- height: height
1158
- };
1159
- return {
1160
- display: "block",
1161
- ...(style || {}),
1162
- ...size_data
1163
- };
1164
- });
1165
- return $52FdA$solidjsweb.createComponent((0, $e3d733f899558f40$export$acb3eaade4b23afd), {
1166
- get style() {
1167
- return style();
1168
- },
1169
- get ["class"]() {
1170
- return props.class;
1171
- }
1172
- });
1173
- }
1174
- function $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query) {
1175
- const signal = $52FdA$solidjs.createSignal(false);
1176
- $52FdA$solidjs.onCleanup($52FdA$depictaiutilishared.javascript_media_query(media_query, _ref => {
1177
- let {
1178
- matches: matches
1179
- } = _ref;
1180
- return signal[1](matches);
1181
- }).remove);
1182
- return signal[0];
1183
- }
1184
1499
  function $a7f7d416e6f61504$export$89c6019e4baa40b1(props) {
1185
1500
  const style = $52FdA$solidjs.createMemo(() => {
1186
1501
  const {
@@ -2048,7 +2363,7 @@ function $ae325261371de459$export$44809a8a3e867e30(_ref) {
2048
2363
  [_el$3, _co$] = $52FdA$solidjsweb.getNextMarker(_el$2.nextSibling),
2049
2364
  _el$4 = _el$3.nextSibling,
2050
2365
  [_el$5, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$4.nextSibling);
2051
- $52FdA$solidjsweb.addEventListener(_el$, "click", $52FdA$depictaiutilishared.catchify(() => setUserWantsExpanded(prev => display_() ? !prev : false)), true);
2366
+ $52FdA$solidjsweb.addEventListener(_el$, "click", $52FdA$depictaiutilishared.catchify(() => display_() && setUserWantsExpanded(prev => !prev)), true);
2052
2367
  $52FdA$solidjsweb.use(el => {
2053
2368
  container = el;
2054
2369
  const ro = new ResizeObserver($52FdA$depictaiutilishared.catchify(records => {
@@ -10335,7 +10650,8 @@ class $e270e9f953fcbc58$export$e015ed2f2950f2e3 {
10335
10650
  breadcrumbs: [],
10336
10651
  quick_links: [],
10337
10652
  image_urls: [],
10338
- failed: true
10653
+ failed: true,
10654
+ content_blocks: []
10339
10655
  }),
10340
10656
  method_: "GET"
10341
10657
  });
@@ -11637,162 +11953,66 @@ function $45c16e404a883f74$export$63dd0350f8559dda(_ref) {
11637
11953
  }
11638
11954
  if (isNaN(last)) return 0;
11639
11955
  if (Math.abs(last) === Infinity)
11640
- // No product card in view and not after last card, assume first card
11641
- return 0;
11642
- return last / displays_by_key_().size * 100;
11643
- }, undefined, {
11644
- equals: false
11645
- });
11646
- }
11647
- function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
11648
- let {
11649
- plp_results_: plp_results_,
11650
- product_card_template_: product_card_template_,
11651
- first_result_in_viewport_: [, setFirstResultInViewport],
11652
- last_result_in_viewport_: [lastResultInViewport, setLastResultsInViewport],
11653
- all_products_loaded_: all_products_loaded_,
11654
- min_products_to_fetch_: min_products_to_fetch_,
11655
- query_base_: query_base_,
11656
- depict_api_: depict_api_,
11657
- is_loading_: is_loading_,
11658
- content_blocks_: content_blocks_
11659
- } = _ref;
11660
- // Although typing doesn't reflect it, plp_results is guaranteed to contain an array of at least one display at this point
11661
- const [get_extra_displays, set_extra_displays_] = $52FdA$solidjs.createSignal([], {
11662
- equals: false
11663
- });
11664
- const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($52FdA$solidjs.createMemo(() => {
11665
- var _plp_results_;
11666
- return [...(((_plp_results_ = plp_results_()) === null || _plp_results_ === void 0 ? void 0 : _plp_results_.displays) || []), ...get_extra_displays()];
11667
- }));
11668
- const {
11669
- indexToTargetMap_: indexToTargetMap_,
11670
- renderedDisplays_: renderedDisplays_,
11671
- currentlyIntersecting: currentlyIntersecting
11672
- } = $a52942afacbced93$export$4a14175d33d81a96({
11673
- displays_by_key_: displays_by_key_,
11674
- product_card_template_: product_card_template_,
11675
- content_blocks_: content_blocks_,
11676
- alwaysObserveCards_: true
11677
- });
11678
- const percentage_in_view_ = $45c16e404a883f74$export$63dd0350f8559dda({
11679
- get_last_result_in_viewport_: lastResultInViewport,
11680
- displays_by_key_: displays_by_key_,
11681
- index_to_target_map_: indexToTargetMap_,
11682
- is_loading_: is_loading_,
11683
- get_extra_displays: get_extra_displays
11684
- });
11685
- $19438fea513c9d01$export$5e4aed86c12acdd9({
11686
- percentage_in_view_: percentage_in_view_,
11687
- set_extra_displays_: set_extra_displays_,
11688
- all_products_loaded_: all_products_loaded_,
11689
- plp_results_: plp_results_,
11690
- min_products_to_fetch_: min_products_to_fetch_,
11691
- query_base_: query_base_,
11692
- depict_api_: depict_api_
11693
- });
11694
- $52FdA$solidjs.createEffect(() => {
11695
- const intersecting = currentlyIntersecting();
11696
- setFirstResultInViewport(Math.min(...intersecting) + 1); // +1 because we want to start counting at 1
11697
- setLastResultsInViewport(Math.max(...intersecting) + 1);
11698
- });
11699
- return renderedDisplays_;
11700
- }
11701
- var $830518481649feb1$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div>`),
11702
- $830518481649feb1$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<style type=text/css>`);
11703
- const $830518481649feb1$export$c500183c31c2b22e = "--spans-columns";
11704
- function $830518481649feb1$export$ab6b147eec64fea5(props) {
11705
- const container_class = "x" + $52FdA$solidjs.createUniqueId();
11706
- const container_element_ = (() => {
11707
- var _el$ = $52FdA$solidjsweb.getNextElement($830518481649feb1$var$_tmpl$);
11708
- $52FdA$solidjsweb.spread(_el$, $52FdA$solidjsweb.mergeProps(() => props.element_attributes, {
11709
- "classList": {
11710
- [container_class]: true
11711
- }
11712
- }), false, true);
11713
- $52FdA$solidjsweb.insert(_el$, () => props.children);
11714
- $52FdA$solidjsweb.runHydrationEvents();
11715
- return _el$;
11716
- })(); // Don't want this in the error boundary below, it should only be for the actual layouting
11717
- return $52FdA$solidjsweb.createComponent((0, $1b3cf201cdd38687$export$b69d0d92862de18b), {
11718
- message_: "Failed calculating css grid layout",
11719
- severity_: "error",
11720
- get children() {
11721
- return $830518481649feb1$export$e2f22da34aaf310a(props, container_element_, false, container_class);
11722
- }
11723
- });
11724
- }
11725
- function $830518481649feb1$export$e2f22da34aaf310a(props, container_element) {
11726
- let insert_after_container = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
11727
- let container_class = arguments.length > 3 ? arguments[3] : undefined;
11728
- if (!container_class) {
11729
- // only try to add if it wasn't provided, so that we have a code path without classList when doing SSR
11730
- container_class = $52FdA$depictaiutilishared.make_random_classname();
11731
- container_element.classList.add(container_class);
11732
- }
11733
- const container_selector = ".depict .".concat(container_class); // class so ppl can have id if needed
11734
- const col_styling = $52FdA$solidjs.createMemo(() => $830518481649feb1$var$generate_media_queried_declarations({
11735
- container_selector_: container_selector,
11736
- default_grid_spacing_text: props.grid_spacing,
11737
- cols_at_size_: props.cols_at_size,
11738
- override_vertical_spacing_: props.override_vertical_spacing,
11739
- top_row_shortened_by_: props.top_row_shortened_by_()
11740
- }));
11741
- const base_styling = $52FdA$solidjs.createMemo(() => {
11742
- return "".concat(container_selector, "{display:grid;}");
11743
- });
11744
- const get_styling = $52FdA$solidjs.createMemo(() => base_styling() + col_styling());
11745
- const style_element = (() => {
11746
- var _el$2 = $52FdA$solidjsweb.getNextElement($830518481649feb1$var$_tmpl$2);
11747
- $52FdA$solidjsweb.insert(_el$2, get_styling);
11748
- return _el$2;
11749
- })(); // need to create this after set_styling has been called or else there will be no styling in the SSR'd output
11750
- if (insert_after_container) container_element.after(style_element);
11751
- return [container_element, style_element];
11752
- }
11753
- function $830518481649feb1$var$generate_media_queried_declarations(_ref) {
11754
- let {
11755
- container_selector_: container_selector_,
11756
- default_grid_spacing_text: default_grid_spacing_text,
11757
- cols_at_size_: cols_at_size_,
11758
- override_vertical_spacing_: override_vertical_spacing_,
11759
- top_row_shortened_by_: top_row_shortened_by_
11760
- } = _ref;
11761
- return cols_at_size_.map(options => {
11762
- const [n_cols, min, max, grid_spacing_for_size] = options;
11763
- const main_spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
11764
- // See comment in else block below
11765
- const can_use_gap = override_vertical_spacing_ ? $830518481649feb1$var$can_use_gap_for_unit(override_vertical_spacing_) : $830518481649feb1$var$can_use_gap_for_unit(main_spacing_to_use);
11766
- let spacing_styling;
11767
- let additional_styling = ""; // outside the media query
11768
- if (can_use_gap) spacing_styling = "gap:".concat(main_spacing_to_use, ";").concat(override_vertical_spacing_ ? "row-gap:".concat(override_vertical_spacing_, ";") : "");else {
11769
- // When using percent units, which our default styling does (because convenient) and our interface relies on (hard to specify different gaps for different screen sizes)
11770
- // row gaps in grids are relative to the whole height of the grid, maybe see also https://stackoverflow.com/a/53563865. The issue with that is that as we load more products, the gap grows. Also, it breaks existing integrations.
11771
- // Logical thought: use margins for the vertical spacing. But margins in grids are apparently relative to the size of the individual items in grids.
11772
- // Given that, and that content blocks can be of different width, we have to do some complicated calculations to convert the provided gap, which is in gap of the total container width, to a margin of the individual items.
11773
- const vertical_spacing_to_use = override_vertical_spacing_ !== null && override_vertical_spacing_ !== void 0 ? override_vertical_spacing_ : main_spacing_to_use;
11774
- const width_multiplier = "var(".concat($830518481649feb1$export$c500183c31c2b22e, ", 1)"); // How many cards wide the current item is (needed because content blocks)
11775
- const one_item_width_exclusing_gaps = "calc(calc(100 / ".concat(n_cols, ") - calc(calc(").concat(n_cols * 2 - 2, " * calc(").concat($830518481649feb1$var$strip_percent_unit(vertical_spacing_to_use), " / 2)) / ").concat(n_cols, "))"); // Width of one item in percent of the whole
11776
- // Equation from layout.tsx, also used in CheckboxGrid. Needs half spacing for some reason
11777
- const this_item_width_meat = "calc(".concat(one_item_width_exclusing_gaps, " * ").concat(width_multiplier, ")"); // Width of just the card
11778
- const this_item_width_gaps = "calc(calc(".concat(width_multiplier, " - 1) * ").concat($830518481649feb1$var$strip_percent_unit(vertical_spacing_to_use), ")"); // Width of the gaps
11779
- const this_item_width = "calc(".concat(this_item_width_meat, " + ").concat(this_item_width_gaps, ")"); // Width of this item including gaps
11780
- // this_item_width needs to be unitless, and since plain css can't do calc(40% / 5%) which would become unitless we need to strip all units in the calculations before
11781
- const convert_top_spacing_to_item_width_percentage = spacing => "calc(calc(100 / ".concat(this_item_width, ") * ").concat(spacing, ")"); // Now finally we can convert the desired spacing to a percentage of this individual item's width (including gaps that would be there but aren't because content blocks span them)
11782
- spacing_styling = "column-gap:".concat(main_spacing_to_use, ";"); // Still use gaps in the horizontal direction because that works flawlessly
11783
- // Re-use old layout code to get the correct :nth-child declarations for the top margins
11784
- additional_styling = $52FdA$depictaiutilishared.n_col_styling_with_dist(container_selector_ + ">", convert_top_spacing_to_item_width_percentage(default_grid_spacing_text), [[n_cols, min, max, grid_spacing_for_size ? convert_top_spacing_to_item_width_percentage(grid_spacing_for_size) : null]], "grid", override_vertical_spacing_ ? convert_top_spacing_to_item_width_percentage(override_vertical_spacing_) : override_vertical_spacing_, top_row_shortened_by_);
11785
- }
11786
- const media_query_body = "".concat(container_selector_, "{").concat(spacing_styling, "grid-template-columns:repeat(").concat(n_cols, ",minmax(0,1fr));}");
11787
- return "".concat($52FdA$depictaiutilishared.layout_media_query_header(min, max), "{").concat(media_query_body, "}").concat(additional_styling);
11788
- }).join("");
11789
- }
11790
- function $830518481649feb1$var$can_use_gap_for_unit(spacing) {
11791
- const trimmed_spacing = spacing.trim();
11792
- return !trimmed_spacing.includes("%");
11956
+ // No product card in view and not after last card, assume first card
11957
+ return 0;
11958
+ return last / displays_by_key_().size * 100;
11959
+ }, undefined, {
11960
+ equals: false
11961
+ });
11793
11962
  }
11794
- function $830518481649feb1$var$strip_percent_unit(css_value) {
11795
- return css_value.replaceAll("%", "");
11963
+ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
11964
+ let {
11965
+ plp_results_: plp_results_,
11966
+ product_card_template_: product_card_template_,
11967
+ first_result_in_viewport_: [, setFirstResultInViewport],
11968
+ last_result_in_viewport_: [lastResultInViewport, setLastResultsInViewport],
11969
+ all_products_loaded_: all_products_loaded_,
11970
+ min_products_to_fetch_: min_products_to_fetch_,
11971
+ query_base_: query_base_,
11972
+ depict_api_: depict_api_,
11973
+ is_loading_: is_loading_,
11974
+ content_blocks_: content_blocks_
11975
+ } = _ref;
11976
+ // Although typing doesn't reflect it, plp_results is guaranteed to contain an array of at least one display at this point
11977
+ const [get_extra_displays, set_extra_displays_] = $52FdA$solidjs.createSignal([], {
11978
+ equals: false
11979
+ });
11980
+ const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($52FdA$solidjs.createMemo(() => {
11981
+ var _plp_results_;
11982
+ return [...(((_plp_results_ = plp_results_()) === null || _plp_results_ === void 0 ? void 0 : _plp_results_.displays) || []), ...get_extra_displays()];
11983
+ }));
11984
+ const {
11985
+ indexToTargetMap_: indexToTargetMap_,
11986
+ renderedDisplays_: renderedDisplays_,
11987
+ currentlyIntersecting: currentlyIntersecting
11988
+ } = $a52942afacbced93$export$4a14175d33d81a96({
11989
+ displays_by_key_: displays_by_key_,
11990
+ product_card_template_: product_card_template_,
11991
+ content_blocks_: content_blocks_,
11992
+ alwaysObserveCards_: true
11993
+ });
11994
+ const percentage_in_view_ = $45c16e404a883f74$export$63dd0350f8559dda({
11995
+ get_last_result_in_viewport_: lastResultInViewport,
11996
+ displays_by_key_: displays_by_key_,
11997
+ index_to_target_map_: indexToTargetMap_,
11998
+ is_loading_: is_loading_,
11999
+ get_extra_displays: get_extra_displays
12000
+ });
12001
+ $19438fea513c9d01$export$5e4aed86c12acdd9({
12002
+ percentage_in_view_: percentage_in_view_,
12003
+ set_extra_displays_: set_extra_displays_,
12004
+ all_products_loaded_: all_products_loaded_,
12005
+ plp_results_: plp_results_,
12006
+ min_products_to_fetch_: min_products_to_fetch_,
12007
+ query_base_: query_base_,
12008
+ depict_api_: depict_api_
12009
+ });
12010
+ $52FdA$solidjs.createEffect(() => {
12011
+ const intersecting = currentlyIntersecting();
12012
+ setFirstResultInViewport(Math.min(...intersecting) + 1); // +1 because we want to start counting at 1
12013
+ setLastResultsInViewport(Math.max(...intersecting) + 1);
12014
+ });
12015
+ return renderedDisplays_;
11796
12016
  }
11797
12017
  function $c749e60bca5000cb$export$cb5808ba002cdeed(_ref) {
11798
12018
  let {
@@ -11820,226 +12040,6 @@ function $c749e60bca5000cb$export$cb5808ba002cdeed(_ref) {
11820
12040
  }) : when_filters_closed_cols;
11821
12041
  });
11822
12042
  }
11823
- function $478e5a09664da64c$export$a79e666719b3647c(cols_at_size_) {
11824
- const size_active = $52FdA$solidjs.createMemo(() => cols_at_size_().map(_ref => {
11825
- let [n_cols, min_width, max_width] = _ref;
11826
- const media_query = $52FdA$depictaiutilishared.layout_media_query_header(min_width, max_width).replaceAll("@media", "");
11827
- const matches = $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query);
11828
- return [matches, n_cols];
11829
- }));
11830
- const n_cols_currently_showing = $52FdA$solidjs.createMemo(() => {
11831
- try {
11832
- const [, n_cols_currently_showing] = size_active().find(_ref2 => {
11833
- let [media_query] = _ref2;
11834
- return media_query();
11835
- });
11836
- return n_cols_currently_showing;
11837
- } catch (e) {
11838
- $52FdA$depictaiutilishared.dwarn("No active size found in columnsAtSize - can't render content blocks or looks");
11839
- return null;
11840
- }
11841
- });
11842
- return n_cols_currently_showing;
11843
- }
11844
- var $f8f375d6245ffff2$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=content-block-wrapper>`);
11845
- function $f8f375d6245ffff2$export$791ef57e62e21c3f(_ref) {
11846
- let {
11847
- content_blocks_: incoming_content_blocks,
11848
- cols_at_size_: cols_at_size_,
11849
- set_top_row_shortened_by_: set_top_row_shortened_by_
11850
- } = _ref;
11851
- // these are by row
11852
- const [content_blocks, set_content_blocks] = $52FdA$solidjsstore.createStore([]);
11853
- const n_cols_currently_showing_ = $478e5a09664da64c$export$a79e666719b3647c(cols_at_size_);
11854
- $52FdA$solidjs.createEffect(() => {
11855
- const incoming_value = incoming_content_blocks();
11856
- if (!incoming_value) {
11857
- set_content_blocks([]);
11858
- return;
11859
- }
11860
- set_content_blocks($52FdA$solidjsstore.reconcile(incoming_value, {
11861
- key: "content"
11862
- })); // key: Make moving blocks faster, see https://github.com/solidjs/solid/issues/1925#issuecomment-1769671596
11863
- });
11864
-
11865
- const get_wrapped_blocks_ = $f8f375d6245ffff2$var$wrap_blocks_in_div(content_blocks, n_cols_currently_showing_);
11866
- $52FdA$solidjs.createComputed(() => {
11867
- // Update our styling if a content block forces some items that should be in the top row into a lower one, so we can generate margin-top declarations for them
11868
- const top_row_block = get_wrapped_blocks_()[0];
11869
- const blocks_in_top_row_taken = top_row_block === null || top_row_block === void 0 ? void 0 : top_row_block.span_columns;
11870
- if (blocks_in_top_row_taken == undefined) {
11871
- // Fall back to zero if no content block in top row, since then no blocks in top row are taken
11872
- set_top_row_shortened_by_(0);
11873
- return;
11874
- }
11875
- set_top_row_shortened_by_(blocks_in_top_row_taken - 1); // minus one because the content block wrapper also is an element
11876
- });
11877
-
11878
- return $f8f375d6245ffff2$var$remap_blocks_to_index({
11879
- get_wrapped_blocks_: get_wrapped_blocks_,
11880
- n_cols_currently_showing_: n_cols_currently_showing_
11881
- });
11882
- }
11883
- /**
11884
- * Calculate where to put each of the finished wrapped content blocks. Also limit blocks' max width.
11885
- * @returns an array where index is index of the blocks in the "displays array" and value is the content block (elements) to show at that index
11886
- */
11887
- function $f8f375d6245ffff2$var$remap_blocks_to_index(_ref2) {
11888
- let {
11889
- get_wrapped_blocks_: get_wrapped_blocks_,
11890
- n_cols_currently_showing_: n_cols_currently_showing_
11891
- } = _ref2;
11892
- return $52FdA$solidjs.createMemo(() => {
11893
- // This computation should be quite cheap since it just moves around things into an array
11894
- const content_blocks_by_index = [];
11895
- const constructed_block_arrays = new WeakSet();
11896
- const wrapped_blocks = get_wrapped_blocks_();
11897
- const cols_showing = n_cols_currently_showing_();
11898
- // Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
11899
- const displaced_products = []; // undefined = is product, true = is content block if number instead of tuple number indicates content blocks in that row. Index in first array is row, index in second array is column
11900
- if (!cols_showing)
11901
- // Nope out of here if we don't know how many columns are showing
11902
- return content_blocks_by_index;
11903
- for (let i = 0; i < wrapped_blocks.length; i++) {
11904
- // i = row to show at
11905
- const block = wrapped_blocks[i];
11906
- if (!block) continue; // Array can have holes/not defined places
11907
- const index_of_first_item_in_row = i * cols_showing;
11908
- const index_of_last_item_in_row = index_of_first_item_in_row + cols_showing;
11909
- const {
11910
- span_rows: span_rows,
11911
- position: position,
11912
- span_columns: span_columns
11913
- } = block; // span columns is already capped in the block wrapping step (wrap_blocks_in_div)
11914
- let target_index;
11915
- if (position === "left") target_index = index_of_first_item_in_row;else if (position === "right") target_index = index_of_last_item_in_row - span_columns;else if (position === "center") target_index = index_of_first_item_in_row + Math.floor((cols_showing - span_columns) / 2);else throw new Error("Invalid position for content block - must be left, right or center: " + JSON.stringify(position));
11916
- // Calculate displacement of us by content blocks above us
11917
- let displacement_by_added_blocks = 0;
11918
- for (let j = 0; j < i; j++) {
11919
- const row = displaced_products[j];
11920
- if (row === undefined) continue; // there were no blocks in this row
11921
- let displaced_items_in_row;
11922
- if (typeof row === "number") displaced_items_in_row = row;else {
11923
- displaced_items_in_row = row.filter(item => item).length;
11924
- displaced_products[j] = displaced_items_in_row;
11925
- }
11926
- displacement_by_added_blocks += displaced_items_in_row;
11927
- }
11928
- const index_of_us_in_row = target_index - index_of_first_item_in_row;
11929
- for (let j = 0; j < index_of_us_in_row; j++) {
11930
- var _displaced_products$i;
11931
- if ((_displaced_products$i = displaced_products[i]) !== null && _displaced_products$i !== void 0 && _displaced_products$i[j])
11932
- // Add blocks in our *current* row to the displacement, but only the ones to our left
11933
- displacement_by_added_blocks++;
11934
- }
11935
- // Add block to output array at the correct index
11936
- const final_target_index = target_index - displacement_by_added_blocks;
11937
- const existing_block = content_blocks_by_index[final_target_index];
11938
- const block_content = block.content;
11939
- // If two blocks want to exist at the same location (can happen, for example if one block wants to be at the end of a row and the other one at the start of the next row) add an array with both
11940
- if (existing_block) {
11941
- if (constructed_block_arrays.has(existing_block))
11942
- // Only push to arrays we have created to not create funky bugs when there's an array in JSX.Element
11943
- existing_block.push(block_content);else {
11944
- const array = [existing_block, block_content];
11945
- constructed_block_arrays.add(array);
11946
- content_blocks_by_index[final_target_index] = array;
11947
- }
11948
- } else content_blocks_by_index[final_target_index] = block_content;
11949
- // Update displacement
11950
- for (let j = 0; j < span_rows; j++) {
11951
- var _ref3;
11952
- const row = displaced_products[_ref3 = i + j] || (displaced_products[_ref3] = []);
11953
- for (let k = index_of_us_in_row; k < index_of_us_in_row + span_columns; k++) row[k] = true;
11954
- }
11955
- }
11956
- return content_blocks_by_index;
11957
- });
11958
- }
11959
- /**
11960
- * Takes a store that contains an array from where index is number of row and value is the result of executing the content block rendering function.
11961
- * Then renders the content and wraps it into a div with the correct styling.
11962
- * Also caps span_columns to max available columns
11963
- */
11964
- function $f8f375d6245ffff2$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
11965
- const get_wrapped_blocks = $52FdA$solidjs.mapArray(() => rendered_content_blocks, block => {
11966
- if (!block) return;
11967
- const final_span_columns = $52FdA$solidjs.createMemo(() => {
11968
- var _max_span_columns;
11969
- return Math.min(block.span_columns, (_max_span_columns = max_span_columns()) !== null && _max_span_columns !== void 0 ? _max_span_columns : Infinity);
11970
- });
11971
- // If the item spans an entire row, limit the height to 1 row since there's no concept of "rows" if there are no products beside the block
11972
- const final_span_rows = $52FdA$solidjs.createMemo(() => final_span_columns() === max_span_columns() ? 1 : block.span_rows);
11973
- const [rendering_delayed, set_rendering_delayed_] = $52FdA$solidjs.createSignal(true);
11974
- const content = $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
11975
- get when() {
11976
- return !rendering_delayed();
11977
- },
11978
- get children() {
11979
- var _el$ = $52FdA$solidjsweb.getNextElement($f8f375d6245ffff2$var$_tmpl$);
11980
- $52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent($f8f375d6245ffff2$var$RenderContent, {
11981
- get content() {
11982
- return block.content;
11983
- }
11984
- }));
11985
- $52FdA$solidjsweb.effect(_p$ => {
11986
- var _v$ = {
11987
- [(0, $830518481649feb1$export$c500183c31c2b22e)]: final_span_columns()
11988
- },
11989
- _v$2 = "span ".concat(final_span_columns()),
11990
- _v$3 = "span ".concat(final_span_rows());
11991
- _p$.e = $52FdA$solidjsweb.style(_el$, _v$, _p$.e);
11992
- _v$2 !== _p$.t && ((_p$.t = _v$2) != null ? _el$.style.setProperty("grid-column", _v$2) : _el$.style.removeProperty("grid-column"));
11993
- _v$3 !== _p$.a && ((_p$.a = _v$3) != null ? _el$.style.setProperty("grid-row", _v$3) : _el$.style.removeProperty("grid-row"));
11994
- return _p$;
11995
- }, {
11996
- e: undefined,
11997
- t: undefined,
11998
- a: undefined
11999
- });
12000
- return _el$;
12001
- }
12002
- });
12003
- return $52FdA$solidjs.mergeProps(block, {
12004
- // Create content divs for the blocks with as much fine-grained diffing as possible?
12005
- content: () => {
12006
- // Sneaky on-demand rendering, so we don't render more blocks than we can show: we have the rendered value here and don't return a function that renders because if our block would be moved around we'd be guaranteed to re-render
12007
- // However, no need to count products to know if we should render: the <For> loops in Placeholders and render_displays will only call this function if there's actually a product here that wants to display this block
12008
- set_rendering_delayed_(false);
12009
- return content;
12010
- },
12011
- get span_columns() {
12012
- // Cap max width of block to the number of columns available, for everyone downstream
12013
- return final_span_columns();
12014
- },
12015
- get span_rows() {
12016
- return final_span_rows();
12017
- }
12018
- });
12019
- });
12020
- return get_wrapped_blocks;
12021
- }
12022
- /**
12023
- * Basically adds support for async content block functions and shows a rudimentary placeholder if rendering is delayed. Required due to react having a rendering delay.
12024
- */
12025
- function $f8f375d6245ffff2$var$RenderContent(props) {
12026
- const [resource] = $52FdA$solidjs.createResource(() => props.content,
12027
- // Could be reactive
12028
- fn => fn());
12029
- $52FdA$solidjs.createEffect(() => {
12030
- if (resource.error) console.error("Error in content block rendering", resource.error);
12031
- });
12032
- // The suspense is for when there's an async content block (which we have to support due to react having a rendering delay) so that we can show some height while it's loading (should kinda never be visible)
12033
- return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Suspense), {
12034
- get fallback() {
12035
- return $52FdA$solidjsweb.createComponent((0, $b8a8d61b3ec5f5ac$export$3f37af283f8fb843), {
12036
- width: "100%",
12037
- height: "max(100%, 400px)"
12038
- });
12039
- },
12040
- children: resource
12041
- });
12042
- }
12043
12043
  var $484eec37514a982e$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=PLP-results><!$><!/><!$><!/>`);
12044
12044
  function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
12045
12045
  let {
@@ -15925,6 +15925,71 @@ function $c3a7faae6f2b93c9$export$7af06a63c5a976c9(el, listing_id, i18n_) {
15925
15925
  $52FdA$solidjs.onCleanup(disconnect);
15926
15926
  }
15927
15927
  $52FdA$solidjsweb.delegateEvents(["click"]);
15928
+ var $c19709057a32b2e7$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<a><img>`),
15929
+ $c19709057a32b2e7$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<a><video loop>`);
15930
+ function $c19709057a32b2e7$export$780a853d15174484(_ref) {
15931
+ let {
15932
+ contentBlock: contentBlock,
15933
+ router_: router_
15934
+ } = _ref;
15935
+ if (contentBlock.content.type === "image") return () => (() => {
15936
+ var _el$ = $52FdA$solidjsweb.getNextElement($c19709057a32b2e7$var$_tmpl$),
15937
+ _el$2 = _el$.firstChild;
15938
+ $52FdA$solidjsweb.addEventListener(_el$, "click", $52FdA$depictaiutilisharedlatest.catchify(ev => router_.navigate_.go_to_({
15939
+ new_url_: contentBlock.content.link,
15940
+ is_replace_: false,
15941
+ event_: ev
15942
+ })), true);
15943
+ _el$2.style.setProperty("width", "100%");
15944
+ _el$2.style.setProperty("height", "100%");
15945
+ _el$2.style.setProperty("object-fit", "cover");
15946
+ _el$2.style.setProperty("position", "absolute");
15947
+ _el$2.style.setProperty("inset", "0");
15948
+ $52FdA$solidjsweb.effect(_p$ => {
15949
+ var _v$ = contentBlock.content.link,
15950
+ _v$2 = contentBlock.content.url;
15951
+ _v$ !== _p$.e && $52FdA$solidjsweb.setAttribute(_el$, "href", _p$.e = _v$);
15952
+ _v$2 !== _p$.t && $52FdA$solidjsweb.setAttribute(_el$2, "src", _p$.t = _v$2);
15953
+ return _p$;
15954
+ }, {
15955
+ e: undefined,
15956
+ t: undefined
15957
+ });
15958
+ $52FdA$solidjsweb.runHydrationEvents();
15959
+ return _el$;
15960
+ })();
15961
+ if (contentBlock.content.type === "video") return () => (() => {
15962
+ var _el$3 = $52FdA$solidjsweb.getNextElement($c19709057a32b2e7$var$_tmpl$2),
15963
+ _el$4 = _el$3.firstChild;
15964
+ $52FdA$solidjsweb.addEventListener(_el$3, "click", $52FdA$depictaiutilisharedlatest.catchify(ev => router_.navigate_.go_to_({
15965
+ new_url_: contentBlock.content.link,
15966
+ is_replace_: false,
15967
+ event_: ev
15968
+ })), true);
15969
+ $52FdA$solidjsweb.setProperty(_el$4, "controls", false);
15970
+ $52FdA$solidjsweb.setProperty(_el$4, "muted", true);
15971
+ $52FdA$solidjsweb.setProperty(_el$4, "autoplay", true);
15972
+ $52FdA$solidjsweb.setProperty(_el$4, "playsinline", true);
15973
+ _el$4.style.setProperty("width", "100%");
15974
+ _el$4.style.setProperty("height", "100%");
15975
+ _el$4.style.setProperty("object-fit", "cover");
15976
+ _el$4.style.setProperty("position", "absolute");
15977
+ _el$4.style.setProperty("inset", "0");
15978
+ $52FdA$solidjsweb.effect(_p$ => {
15979
+ var _v$3 = contentBlock.content.link,
15980
+ _v$4 = contentBlock.content.url;
15981
+ _v$3 !== _p$.e && $52FdA$solidjsweb.setAttribute(_el$3, "href", _p$.e = _v$3);
15982
+ _v$4 !== _p$.t && $52FdA$solidjsweb.setAttribute(_el$4, "src", _p$.t = _v$4);
15983
+ return _p$;
15984
+ }, {
15985
+ e: undefined,
15986
+ t: undefined
15987
+ });
15988
+ $52FdA$solidjsweb.runHydrationEvents();
15989
+ return _el$3;
15990
+ })();
15991
+ }
15992
+ $52FdA$solidjsweb.delegateEvents(["click"]);
15928
15993
  var $ede6c70ecdca46fe$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=product-count><!$><!/> <!$><!/>`),
15929
15994
  $ede6c70ecdca46fe$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div>`),
15930
15995
  $ede6c70ecdca46fe$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=filter-results-for-one-row><!$><!/><!$><!/>`),
@@ -16021,6 +16086,24 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
16021
16086
  }));
16022
16087
  // Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
16023
16088
  const [plp_meta] = $52FdA$solidjs.createResource(meta_query_base, $52FdA$depictaiutilisharedlatest.catchify(query => depict_api_.get_listing(query)));
16089
+ const contentBlocksByRow = $52FdA$solidjs.createMemo(() => {
16090
+ var _plp_meta, _plp_meta$content_blo;
16091
+ if (content_blocks_by_row_()) return content_blocks_by_row_();
16092
+ const content = [];
16093
+ (_plp_meta = plp_meta()) === null || _plp_meta === void 0 || (_plp_meta$content_blo = _plp_meta.content_blocks) === null || _plp_meta$content_blo === void 0 || _plp_meta$content_blo.forEach(row => {
16094
+ const contentBlock = {
16095
+ span_columns: row.span_columns,
16096
+ span_rows: row.span_rows,
16097
+ position: row.position,
16098
+ content: $c19709057a32b2e7$export$780a853d15174484({
16099
+ contentBlock: row,
16100
+ router_: router_
16101
+ })
16102
+ };
16103
+ content[row.row] = contentBlock;
16104
+ });
16105
+ return content;
16106
+ });
16024
16107
  const available_sortings_ = $52FdA$solidjs.createMemo(() => {
16025
16108
  var _plp_products_, _plp_products_$sorts;
16026
16109
  return (_plp_products_ = plp_products_()) === null || _plp_products_ === void 0 ? void 0 : (_plp_products_$sorts = _plp_products_.sorts) === null || _plp_products_$sorts === void 0 ? void 0 : _plp_products_$sorts.map(sort => {
@@ -16036,13 +16119,13 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
16036
16119
  return (_plp_products_2 = plp_products_()) === null || _plp_products_2 === void 0 ? void 0 : _plp_products_2.filters;
16037
16120
  });
16038
16121
  const title = $52FdA$solidjs.createMemo(() => {
16039
- var _plp_meta;
16040
- return (_plp_meta = plp_meta()) === null || _plp_meta === void 0 ? void 0 : _plp_meta.title;
16122
+ var _plp_meta2;
16123
+ return (_plp_meta2 = plp_meta()) === null || _plp_meta2 === void 0 ? void 0 : _plp_meta2.title;
16041
16124
  });
16042
16125
  const crumb_data_ = $ede6c70ecdca46fe$var$add_us_to_crumbs(plp_meta);
16043
16126
  const quicklinks_data_ = $52FdA$solidjs.createMemo(() => {
16044
- var _plp_meta2;
16045
- return (_plp_meta2 = plp_meta()) === null || _plp_meta2 === void 0 ? void 0 : _plp_meta2.quick_links;
16127
+ var _plp_meta3;
16128
+ return (_plp_meta3 = plp_meta()) === null || _plp_meta3 === void 0 ? void 0 : _plp_meta3.quick_links;
16046
16129
  });
16047
16130
  const [sort_or_filter_open_, set_sort_or_filter_open_] = $52FdA$solidjs.createSignal(false);
16048
16131
  const [desktop_filter_elements_, set_desktop_filter_elements] = $52FdA$solidjs.createSignal();
@@ -16309,7 +16392,7 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
16309
16392
  product_card_template_: product_card_template_,
16310
16393
  sort_or_filter_open_: sort_or_filter_open_,
16311
16394
  desktop_filter_elements_: desktop_filter_elements_,
16312
- content_blocks_by_row_: content_blocks_by_row_,
16395
+ content_blocks_by_row_: contentBlocksByRow,
16313
16396
  ConfiguredScrollStatus_: ConfiguredScrollStatus_,
16314
16397
  id_currently_querying_for_: id_to_query_for_,
16315
16398
  no_results_options_: {
@@ -16354,8 +16437,8 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
16354
16437
  function $ede6c70ecdca46fe$var$add_us_to_crumbs(plp_meta) {
16355
16438
  const href_accessor = $52FdA$depictaiutilisharedlatest.use_href_accessor();
16356
16439
  return $52FdA$solidjs.createMemo(() => {
16357
- var _plp_meta3;
16358
- const api_value = (_plp_meta3 = plp_meta()) === null || _plp_meta3 === void 0 ? void 0 : _plp_meta3.breadcrumbs;
16440
+ var _plp_meta4;
16441
+ const api_value = (_plp_meta4 = plp_meta()) === null || _plp_meta4 === void 0 ? void 0 : _plp_meta4.breadcrumbs;
16359
16442
  if (!api_value) return api_value;
16360
16443
  return [...api_value, $52FdA$solidjs.mergeProps(plp_meta(), {
16361
16444
  get page_url() {