@depict-ai/portal-components 2.7.5 → 2.7.7

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/dist/main.js CHANGED
@@ -1,9 +1,9 @@
1
1
  var $7jsgb$depictaiutilisharedlatest = require("@depict-ai/utilishared/latest");
2
- var $7jsgb$solidjs = require("solid-js");
3
- var $7jsgb$depictaiuilatest = require("@depict-ai/ui/latest");
4
2
  var $7jsgb$solidjsweb = require("solid-js/web");
5
3
  var $7jsgb$react = require("react");
6
4
  var $7jsgb$solidjsstore = require("solid-js/store");
5
+ var $7jsgb$depictaiuilatest = require("@depict-ai/ui/latest");
6
+ var $7jsgb$solidjs = require("solid-js");
7
7
  var $7jsgb$reactdom = require("react-dom");
8
8
 
9
9
 
@@ -11,14 +11,14 @@ function $parcel$export(e, n, v, s) {
11
11
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
12
12
  }
13
13
 
14
+ $parcel$export(module.exports, "ReactDefaultProductCard", () => $70cc6bd7e3f1dd4b$export$d1a48be4967fe67c);
14
15
  $parcel$export(module.exports, "ReactSelectedFilters", () => $19e9e02e1e300b6d$export$aea1707d7b01c3a2);
15
16
  $parcel$export(module.exports, "ReactFilterBody", () => $240090d16a629bfe$export$d929db7fb6179159);
16
17
  $parcel$export(module.exports, "ExpandingSection", () => $2214dc111b9e2866$export$4ea53cd12ff17334);
17
18
  $parcel$export(module.exports, "ReactLookCard", () => $35bab9ff48bfe404$export$48787da2a5568bc);
18
19
  $parcel$export(module.exports, "version", () => $0a017be3a74fcc94$export$83d89fbfd8236492);
19
20
  /*! Depict.ai portal components */ // This is where the actual source of your React stuff should live
20
- const $0a017be3a74fcc94$export$83d89fbfd8236492 = "2.7.5";
21
-
21
+ const $0a017be3a74fcc94$export$83d89fbfd8236492 = "2.7.7";
22
22
 
23
23
 
24
24
 
@@ -46,6 +46,977 @@ function $d38f1fd3cc4cd6b2$export$f6e64e17bd69eeef({ solid_component: solid_comp
46
46
 
47
47
 
48
48
 
49
+
50
+
51
+
52
+ var $3375ddd88f77967d$var$_tmpl$ = /*#__PURE__*/ (0, $7jsgb$solidjsweb.template)(`<a>`), $3375ddd88f77967d$var$_tmpl$2 = /*#__PURE__*/ (0, $7jsgb$solidjsweb.template)(`<div class="d-title line-clamp">`), $3375ddd88f77967d$var$_tmpl$3 = /*#__PURE__*/ (0, $7jsgb$solidjsweb.template)(`<div class=d-product-card>`), $3375ddd88f77967d$var$_tmpl$4 = /*#__PURE__*/ (0, $7jsgb$solidjsweb.template)(`<svg xmlns=http://www.w3.org/2000/svg width=12 height=12 class=more><path d="M10.8 6c0 .153-.061.299-.169.407s-.255.169-.407.169H6.576v3.648c0 .153-.061.299-.169.407S6.153 10.8 6 10.8s-.299-.061-.407-.169-.169-.255-.169-.407V6.576H1.776c-.153 0-.299-.061-.407-.169S1.2 6.153 1.2 6s.061-.299.169-.407.255-.169.407-.169h3.648V1.776c0-.153.061-.299.169-.407S5.847 1.2 6 1.2s.299.061.407.169.169.255.169.407v3.648h3.648c.153 0 .299.061.407.169s.169.255.169.407z">`), $3375ddd88f77967d$var$_tmpl$5 = /*#__PURE__*/ (0, $7jsgb$solidjsweb.template)(`<div class=d-swatches>`), $3375ddd88f77967d$var$_tmpl$6 = /*#__PURE__*/ (0, $7jsgb$solidjsweb.template)(`<a class=d-swatch>`), $3375ddd88f77967d$var$_tmpl$7 = /*#__PURE__*/ (0, $7jsgb$solidjsweb.template)(`<span class=more>+ <!> more`), $3375ddd88f77967d$var$_tmpl$8 = /*#__PURE__*/ (0, $7jsgb$solidjsweb.template)(`<div class=sizes>`), $3375ddd88f77967d$var$_tmpl$9 = /*#__PURE__*/ (0, $7jsgb$solidjsweb.template)(`<span>`), $3375ddd88f77967d$var$_tmpl$10 = /*#__PURE__*/ (0, $7jsgb$solidjsweb.template)(`<s>`), $3375ddd88f77967d$var$_tmpl$11 = /*#__PURE__*/ (0, $7jsgb$solidjsweb.template)(`<div>`), $3375ddd88f77967d$var$_tmpl$12 = /*#__PURE__*/ (0, $7jsgb$solidjsweb.template)(`<div class="media-item video">`), $3375ddd88f77967d$var$_tmpl$13 = /*#__PURE__*/ (0, $7jsgb$solidjsweb.template)(`<div class="media-item image">`), $3375ddd88f77967d$var$_tmpl$14 = /*#__PURE__*/ (0, $7jsgb$solidjsweb.template)(`<source type=application/x-mpegURL>`), $3375ddd88f77967d$var$_tmpl$15 = /*#__PURE__*/ (0, $7jsgb$solidjsweb.template)(`<video class=s-responsive-image crossorigin=anonymous>`), $3375ddd88f77967d$var$_tmpl$16 = /*#__PURE__*/ (0, $7jsgb$solidjsweb.template)(`<source>`), $3375ddd88f77967d$var$_tmpl$17 = /*#__PURE__*/ (0, $7jsgb$solidjsweb.template)(`<span class=price>`), $3375ddd88f77967d$var$_tmpl$18 = /*#__PURE__*/ (0, $7jsgb$solidjsweb.template)(`<span class=original-price>`);
53
+ // You can import from the solid-js library here and leverage its reactivity to create an interactive UI.
54
+ // Also, Depict packages can be imported (you must import /latest from those).
55
+ const $3375ddd88f77967d$var$sizeOrder = [
56
+ "XXS",
57
+ "XS",
58
+ "XS/S",
59
+ "S",
60
+ "S/M",
61
+ "M",
62
+ "M/L",
63
+ "L",
64
+ "L/XL",
65
+ "XL",
66
+ "XL/XXL",
67
+ "XXL",
68
+ "One Size",
69
+ "Onesize"
70
+ ];
71
+ const $3375ddd88f77967d$var$ContainsColorSwatchesContext = /*@__PURE__*/ (0, $7jsgb$solidjs.createContext)();
72
+ let $3375ddd88f77967d$var$colorCanvasContext;
73
+ function $3375ddd88f77967d$export$f11681c54c860912(display, info, configuredOptions_ = ()=>({
74
+ image_radius: "md",
75
+ alignment: "left",
76
+ sizes: true,
77
+ smart_labels: {
78
+ font_size_rem: 0.5,
79
+ enabled: true,
80
+ bold: false,
81
+ italic: false,
82
+ color: "red",
83
+ bg_color: "yellow"
84
+ },
85
+ title: {
86
+ font_size_rem: 1.6,
87
+ enabled: true,
88
+ bold: false,
89
+ italic: false,
90
+ color: "black"
91
+ },
92
+ price: {
93
+ font_size_rem: 1.5,
94
+ enabled: true,
95
+ bold: false,
96
+ italic: false,
97
+ color: "black"
98
+ },
99
+ original_price: {
100
+ font_size_rem: 0.9,
101
+ enabled: true,
102
+ bold: false,
103
+ italic: false,
104
+ color: "black"
105
+ },
106
+ use_hover_image: true,
107
+ image_carousel: true,
108
+ color_options: true,
109
+ image_aspect_ratio: 1
110
+ })) {
111
+ const variantDisplays = (0, $7jsgb$solidjs.createMemo)(()=>display()?.variant_displays);
112
+ const defaultVariantIndex = (0, $7jsgb$solidjs.createMemo)(()=>display()?.variant_index);
113
+ const [showVariantIndex, setShowVariantIndex] = (0, $7jsgb$solidjs.createSignal)((0, $7jsgb$solidjs.untrack)(defaultVariantIndex));
114
+ const [cardIsHovered, setCardIsHovered] = (0, $7jsgb$solidjs.createSignal)(false);
115
+ const variantToShow = (0, $7jsgb$solidjs.createMemo)(()=>variantDisplays()?.[showVariantIndex()]);
116
+ const noHoverSupport_ = (0, $7jsgb$depictaiuilatest.media_query_to_accessor)("(hover: none)");
117
+ const [salePrice] = (0, $7jsgb$solidjs.createResource)(variantToShow, (v)=>v?.sale_price);
118
+ const [originalPrice] = (0, $7jsgb$solidjs.createResource)(variantToShow, (v)=>v?.original_price);
119
+ const onSale = (0, $7jsgb$solidjs.createMemo)(()=>(0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Suspense), {
120
+ get children () {
121
+ return originalPrice() !== salePrice();
122
+ }
123
+ }));
124
+ const aspectRatio_ = (0, $7jsgb$solidjs.createMemo)(()=>configuredOptions_().image_aspect_ratio);
125
+ const sizesInStock_ = (0, $7jsgb$solidjs.createMemo)(()=>new Map(variantDisplays()?.map((d)=>[
126
+ d.size_name,
127
+ d.in_stock
128
+ ]).filter(([name])=>name)));
129
+ const titleOptions = (0, $7jsgb$solidjs.createMemo)(()=>configuredOptions_().title);
130
+ const colorMap = (0, $7jsgb$solidjs.createMemo)(()=>new Map(variantDisplays()?.map((variant, index)=>[
131
+ variant.color_name,
132
+ {
133
+ hexColor_: variant.color_name,
134
+ pageUrl_: variant.page_url,
135
+ variantIndex_: index
136
+ }
137
+ ]).filter(([colorName])=>colorName) // in case color_name is null
138
+ ));
139
+ const swatchContainerHeight = (0, $7jsgb$solidjs.createMemo)(()=>{
140
+ // To avoid the product cards switching around as one hovers and price switches to the swatches, we have to make the swatches container have the same height as the price one
141
+ let considerSize = [];
142
+ const { original_price: original_price, price: price } = configuredOptions_();
143
+ const isOnSale = onSale?.()?.(); // Hack for getting if we're on sale without triggering <Suspense> above us
144
+ if (price.enabled) considerSize.push(price.font_size_rem);
145
+ if (original_price.enabled && isOnSale) considerSize.push(original_price.font_size_rem);
146
+ if (!considerSize.length) return;
147
+ return Math.max(...considerSize);
148
+ });
149
+ const LinkWrapped = (props)=>(()=>{
150
+ var _el$ = $3375ddd88f77967d$var$_tmpl$();
151
+ (0, $7jsgb$solidjsweb.addEventListener)(_el$, "click", (0, $7jsgb$depictaiutilisharedlatest.catchify)((e)=>{
152
+ const { target: target } = e;
153
+ const navbuttonSelector = ".d-navbutton";
154
+ if (target.matches(navbuttonSelector) || target.closest(navbuttonSelector)) // Don't navigate if optional slider button that can be shown using css was clicked
155
+ e.preventDefault();
156
+ }), true);
157
+ (0, $7jsgb$solidjsweb.use)((el)=>props?.ref?.(el), _el$);
158
+ (0, $7jsgb$solidjsweb.insert)(_el$, ()=>props.children);
159
+ (0, $7jsgb$solidjsweb.effect)((_p$)=>{
160
+ var _v$ = props.class, _v$2 = variantToShow()?.page_url || "#";
161
+ _v$ !== _p$.e && (0, $7jsgb$solidjsweb.className)(_el$, _p$.e = _v$);
162
+ _v$2 !== _p$.t && (0, $7jsgb$solidjsweb.setAttribute)(_el$, "href", _p$.t = _v$2);
163
+ return _p$;
164
+ }, {
165
+ e: undefined,
166
+ t: undefined
167
+ });
168
+ return _el$;
169
+ })();
170
+ const Title = (props)=>(()=>{
171
+ var _el$2 = $3375ddd88f77967d$var$_tmpl$2();
172
+ (0, $7jsgb$solidjsweb.use)((el)=>{
173
+ props.ref_?.(el);
174
+ $3375ddd88f77967d$var$setStyleForTextOptions(el, titleOptions);
175
+ }, _el$2);
176
+ (0, $7jsgb$solidjsweb.insert)(_el$2, ()=>variantToShow()?.title ?? [
177
+ (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$depictaiuilatest.TextPlaceholder), {
178
+ height: "1em",
179
+ width: "20ch"
180
+ }),
181
+ (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$depictaiuilatest.TextPlaceholder), {
182
+ height: "1em",
183
+ width: "20ch"
184
+ })
185
+ ]);
186
+ (0, $7jsgb$solidjsweb.effect)(()=>(0, $7jsgb$solidjsweb.setAttribute)(_el$2, "title", variantToShow()?.title));
187
+ return _el$2;
188
+ })();
189
+ const mainStyle = ()=>{
190
+ const { alignment: alignment } = configuredOptions_();
191
+ const flexAlignment = alignment === "center" ? alignment : "flex-" + alignment;
192
+ return {
193
+ "--flex-alignment": flexAlignment,
194
+ "--alignment": alignment
195
+ };
196
+ };
197
+ (0, $7jsgb$solidjs.createEffect)(()=>(0, $7jsgb$depictaiutilisharedlatest.dlog)("Got passed options", JSON.parse(JSON.stringify(configuredOptions_()))));
198
+ (0, $7jsgb$solidjs.createEffect)(()=>(0, $7jsgb$depictaiutilisharedlatest.dlog)("Got passed display", JSON.parse(JSON.stringify(display()))));
199
+ (0, $7jsgb$solidjs.createEffect)(()=>noHoverSupport_() && setCardIsHovered(false));
200
+ return (0, $7jsgb$solidjsweb.createComponent)($3375ddd88f77967d$var$ContainsColorSwatchesProvider, {
201
+ get children () {
202
+ var _el$3 = $3375ddd88f77967d$var$_tmpl$3();
203
+ (0, $7jsgb$solidjsweb.addEventListener)(_el$3, "mouseleave", (0, $7jsgb$depictaiutilisharedlatest.catchify)(()=>!noHoverSupport_() && setCardIsHovered(false)));
204
+ (0, $7jsgb$solidjsweb.addEventListener)(_el$3, "mouseenter", (0, $7jsgb$depictaiutilisharedlatest.catchify)(()=>!noHoverSupport_() && setCardIsHovered(true)));
205
+ (0, $7jsgb$solidjsweb.insert)(_el$3, (0, $7jsgb$solidjsweb.createComponent)(LinkWrapped, {
206
+ "class": "upper",
207
+ get children () {
208
+ return (0, $7jsgb$solidjsweb.createComponent)($3375ddd88f77967d$var$ImagesAndVideos, {
209
+ image_urls_: ()=>variantToShow()?.image_urls,
210
+ video_: ()=>variantToShow()?.videos?.[0],
211
+ configuredOptions_: configuredOptions_,
212
+ cardIsHovered_: ()=>showVariantIndex() === display()?.variant_index && cardIsHovered(),
213
+ aspectRatio_: aspectRatio_
214
+ });
215
+ }
216
+ }), null);
217
+ (0, $7jsgb$solidjsweb.insert)(_el$3, (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
218
+ get when () {
219
+ return titleOptions().enabled || configuredOptions_().price.enabled || configuredOptions_().sizes || configuredOptions_().color_options;
220
+ },
221
+ get children () {
222
+ return (()=>{
223
+ // We want the whole product card to be a link, except for the color swatches
224
+ const [containsColorSwatches] = $3375ddd88f77967d$var$useContainsColorSwatches();
225
+ const LinkWrappedIfHaveSwatches = (props)=>{
226
+ const resolved = (0, $7jsgb$solidjs.children)(()=>props.children);
227
+ return (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
228
+ get when () {
229
+ return containsColorSwatches();
230
+ },
231
+ get fallback () {
232
+ return resolved();
233
+ },
234
+ get children () {
235
+ return (0, $7jsgb$solidjsweb.createComponent)(LinkWrapped, {
236
+ get children () {
237
+ return resolved();
238
+ }
239
+ });
240
+ }
241
+ });
242
+ };
243
+ return (0, $7jsgb$solidjsweb.createComponent)($3375ddd88f77967d$var$InComponentOrDiv, {
244
+ get component_ () {
245
+ return !containsColorSwatches() && LinkWrapped;
246
+ },
247
+ class_: "text-container",
248
+ get children () {
249
+ return [
250
+ (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
251
+ get when () {
252
+ return titleOptions().enabled;
253
+ },
254
+ get fallback () {
255
+ return (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
256
+ get when () {
257
+ return configuredOptions_().sizes;
258
+ },
259
+ get children () {
260
+ return (0, $7jsgb$solidjsweb.createComponent)(LinkWrappedIfHaveSwatches, {
261
+ get children () {
262
+ return (0, $7jsgb$solidjsweb.createComponent)($3375ddd88f77967d$var$Sizes, {
263
+ sizesInStock_: sizesInStock_,
264
+ fontSizeRem_: ()=>titleOptions().font_size_rem
265
+ });
266
+ }
267
+ });
268
+ }
269
+ });
270
+ },
271
+ get children () {
272
+ return (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
273
+ get when () {
274
+ return (0, $7jsgb$solidjsweb.memo)(()=>!!configuredOptions_().sizes)() && sizesInStock_().size > 1;
275
+ },
276
+ get fallback () {
277
+ return (0, $7jsgb$solidjsweb.createComponent)(LinkWrappedIfHaveSwatches, {
278
+ get children () {
279
+ return (0, $7jsgb$solidjsweb.createComponent)(Title, {});
280
+ }
281
+ });
282
+ },
283
+ get children () {
284
+ return (0, $7jsgb$solidjsweb.createComponent)($3375ddd88f77967d$var$AnimatedRowSwitch, {
285
+ DefaultComponent_: Title,
286
+ HoveredComponent_: ({ ref_: ref_ })=>(0, $7jsgb$solidjsweb.createComponent)($3375ddd88f77967d$var$Sizes, {
287
+ sizesInStock_: sizesInStock_,
288
+ fontSizeRem_: ()=>titleOptions().font_size_rem,
289
+ ref_: ref_
290
+ }),
291
+ cardIsHovered_: cardIsHovered,
292
+ containerComponent_: ()=>containsColorSwatches() && LinkWrapped
293
+ });
294
+ }
295
+ });
296
+ }
297
+ }),
298
+ (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
299
+ get when () {
300
+ return configuredOptions_().price.enabled;
301
+ },
302
+ get fallback () {
303
+ return (0, $7jsgb$solidjsweb.memo)(()=>!!configuredOptions_().color_options)() && (0, $7jsgb$solidjsweb.createComponent)($3375ddd88f77967d$var$ColorSwatches, {
304
+ colorMap_: colorMap,
305
+ showVariantIndex_: showVariantIndex,
306
+ setShowVariantIndex_: setShowVariantIndex,
307
+ colorsAtIndex_: ()=>variantDisplays()?.map((variant)=>variant.color_name),
308
+ wantedContainerHeightRem_: swatchContainerHeight,
309
+ defaultVariantIndex_: defaultVariantIndex
310
+ });
311
+ },
312
+ get children () {
313
+ return (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
314
+ get when () {
315
+ return (0, $7jsgb$solidjsweb.memo)(()=>!!configuredOptions_().color_options)() && colorMap().size > 1;
316
+ },
317
+ get fallback () {
318
+ return (0, $7jsgb$solidjsweb.createComponent)($3375ddd88f77967d$var$Prices, {
319
+ variantToShow_: variantToShow,
320
+ get formatPrice_ () {
321
+ return info?.formatPrice;
322
+ },
323
+ configuredOptions_: configuredOptions_,
324
+ salePrice_: salePrice,
325
+ originalPrice_: originalPrice,
326
+ wrapperComponent_: ()=>containsColorSwatches() && LinkWrapped
327
+ });
328
+ },
329
+ get children () {
330
+ return (0, $7jsgb$solidjsweb.createComponent)($3375ddd88f77967d$var$AnimatedRowSwitch, {
331
+ containerComponent_: ()=>!containsColorSwatches() && LinkWrapped,
332
+ DefaultComponent_: ({ ref_: ref_ })=>(0, $7jsgb$solidjsweb.createComponent)($3375ddd88f77967d$var$Prices, {
333
+ variantToShow_: variantToShow,
334
+ get formatPrice_ () {
335
+ return info?.formatPrice;
336
+ },
337
+ salePrice_: salePrice,
338
+ originalPrice_: originalPrice,
339
+ configuredOptions_: configuredOptions_,
340
+ wrapperComponent_: ()=>containsColorSwatches() && LinkWrapped,
341
+ ref_: ref_
342
+ }),
343
+ HoveredComponent_: ({ ref_: ref_ })=>(0, $7jsgb$solidjsweb.createComponent)($3375ddd88f77967d$var$ColorSwatches, {
344
+ colorMap_: colorMap,
345
+ showVariantIndex_: showVariantIndex,
346
+ setShowVariantIndex_: setShowVariantIndex,
347
+ colorsAtIndex_: ()=>variantDisplays()?.map((variant)=>variant.color_name),
348
+ ref_: ref_,
349
+ wantedContainerHeightRem_: swatchContainerHeight,
350
+ defaultVariantIndex_: defaultVariantIndex
351
+ }),
352
+ cardIsHovered_: cardIsHovered
353
+ });
354
+ }
355
+ });
356
+ }
357
+ })
358
+ ];
359
+ }
360
+ });
361
+ })();
362
+ }
363
+ }), null);
364
+ (0, $7jsgb$solidjsweb.effect)((_$p)=>(0, $7jsgb$solidjsweb.style)(_el$3, mainStyle(), _$p));
365
+ return _el$3;
366
+ }
367
+ });
368
+ }
369
+ /**
370
+ * Transitions between DefaultComponent_ and HoveredComponent_ when cardIsHovered_ changes in both height and opacity.
371
+ */ function $3375ddd88f77967d$var$AnimatedRowSwitch({ DefaultComponent_: DefaultComponent_, HoveredComponent_: HoveredComponent_, cardIsHovered_: cardIsHovered_, containerComponent_: containerComponent_ }) {
372
+ let defaultElement;
373
+ let hoveredElement;
374
+ let containerElement;
375
+ let defaultElementAnimation;
376
+ let hoveredElementAnimation;
377
+ let containerAnimation;
378
+ const fadeInKeyframes = [
379
+ {
380
+ opacity: 0,
381
+ pointerEvents: "none",
382
+ cursor: "default"
383
+ },
384
+ {
385
+ opacity: 1,
386
+ pointerEvents: "auto",
387
+ cursor: "unset"
388
+ }
389
+ ];
390
+ const fadeOutKeyframes = [
391
+ ...fadeInKeyframes
392
+ ].reverse();
393
+ (0, $7jsgb$solidjs.createEffect)((firstRun)=>{
394
+ const isHovered = cardIsHovered_();
395
+ if (!hoveredElement || !defaultElement) return; // Got no sizes probably, can't switch to anything
396
+ const hoveredStyle = hoveredElement.style;
397
+ const defaultStyle = defaultElement.style;
398
+ const containerStyle = containerElement.style;
399
+ const duration = 200;
400
+ const easing = "ease-in-out";
401
+ hoveredStyle.position = "absolute";
402
+ if (firstRun) {
403
+ Object.assign(hoveredStyle, fadeInKeyframes[0]);
404
+ return;
405
+ }
406
+ defaultStyle.position = "absolute";
407
+ // These animations we can let live forever, since opacity always goes between 0 and 1
408
+ hoveredElementAnimation ||= hoveredElement.animate(fadeInKeyframes, {
409
+ duration: duration,
410
+ fill: "both",
411
+ easing: easing
412
+ });
413
+ defaultElementAnimation ||= defaultElement.animate(fadeOutKeyframes, {
414
+ duration: duration,
415
+ fill: "both",
416
+ easing: easing
417
+ });
418
+ if (!containerAnimation) {
419
+ const containerKeyframes = [
420
+ {
421
+ height: defaultElement.getBoundingClientRect().height + "px"
422
+ },
423
+ {
424
+ height: hoveredElement.getBoundingClientRect().height + "px"
425
+ }
426
+ ];
427
+ containerAnimation = containerElement.animate(containerKeyframes, {
428
+ duration: duration,
429
+ easing: easing
430
+ });
431
+ containerAnimation.finished.then(()=>{
432
+ containerAnimation?.cancel();
433
+ containerAnimation = undefined;
434
+ // Animation can survive direction change so need to get current hovered state when it finishes
435
+ const hoveredNow = (0, $7jsgb$solidjs.untrack)(cardIsHovered_);
436
+ containerStyle.height = "";
437
+ if (hoveredNow) hoveredStyle.position = "";
438
+ else defaultStyle.position = "";
439
+ });
440
+ if (!isHovered) // When starting the animation in reverse we need to set the current time to the end of the animation
441
+ containerAnimation.currentTime = containerAnimation.effect.getComputedTiming().endTime;
442
+ // Remove this animation once it has finished and re-create it later since the size of the elements containing texts might change, i.e. when the window is resized of zoom level adjusted
443
+ }
444
+ const animationDirection = isHovered ? 1 : -1;
445
+ defaultElementAnimation.updatePlaybackRate(animationDirection);
446
+ defaultElementAnimation.play();
447
+ hoveredElementAnimation.updatePlaybackRate(animationDirection);
448
+ hoveredElementAnimation.play();
449
+ containerAnimation.updatePlaybackRate(animationDirection);
450
+ }, true);
451
+ return (0, $7jsgb$solidjsweb.createComponent)($3375ddd88f77967d$var$InComponentOrDiv, {
452
+ get component_ () {
453
+ return containerComponent_();
454
+ },
455
+ class_: "animated-row-switch",
456
+ ref_: (el)=>containerElement = el,
457
+ get children () {
458
+ return [
459
+ (0, $7jsgb$solidjsweb.createComponent)(DefaultComponent_, {
460
+ ref_: (el)=>defaultElement = el
461
+ }),
462
+ (0, $7jsgb$solidjsweb.createComponent)(HoveredComponent_, {
463
+ ref_: (el)=>hoveredElement = el
464
+ })
465
+ ];
466
+ }
467
+ });
468
+ }
469
+ function $3375ddd88f77967d$var$ColorSwatches({ colorMap_: colorMap_, setShowVariantIndex_: setShowVariantIndex_, showVariantIndex_: showVariantIndex_, colorsAtIndex_: colorsAtIndex_, wantedContainerHeightRem_: wantedContainerHeightRem_, defaultVariantIndex_: defaultVariantIndex_, ref_: ref_ }) {
470
+ let unHoverDebouncedTimeout;
471
+ const entriesToShow = ()=>[
472
+ ...colorMap_().entries()
473
+ ].slice(0, 12);
474
+ const [, setContainsColorSwatches] = $3375ddd88f77967d$var$useContainsColorSwatches();
475
+ return (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
476
+ get when () {
477
+ return entriesToShow().length > 1;
478
+ },
479
+ get children () {
480
+ return (()=>{
481
+ setContainsColorSwatches(true);
482
+ (0, $7jsgb$solidjs.onCleanup)(()=>setContainsColorSwatches(false));
483
+ return (()=>{
484
+ var _el$4 = $3375ddd88f77967d$var$_tmpl$5();
485
+ (0, $7jsgb$solidjsweb.use)((el)=>{
486
+ ref_?.(el);
487
+ // Do like this so we don't override other styles set by AnimateRowSwitch
488
+ (0, $7jsgb$solidjs.createEffect)(()=>$3375ddd88f77967d$var$setPropertyIfExists(el.style, "--swatch-container-height", wantedContainerHeightRem_() && wantedContainerHeightRem_() + "rem"));
489
+ }, _el$4);
490
+ (0, $7jsgb$solidjsweb.insert)(_el$4, (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.For), {
491
+ get each () {
492
+ return entriesToShow();
493
+ },
494
+ children: ([colorName, { pageUrl_: pageUrl_, hexColor_: hexColor_, variantIndex_: variantIndex_ }])=>{
495
+ const thisColorIsDefaultColor = (0, $7jsgb$solidjs.createMemo)(()=>colorsAtIndex_()?.[defaultVariantIndex_()] === colorName);
496
+ // Since we don't have actual colors right now and rely on color names working as css colors
497
+ // We need a default fallback for it being usable
498
+ const [invalidColor, setInvalidColor] = (0, $7jsgb$solidjs.createSignal)(false);
499
+ return (()=>{
500
+ var _el$6 = $3375ddd88f77967d$var$_tmpl$6();
501
+ (0, $7jsgb$solidjsweb.use)((element)=>requestAnimationFrame(// After one frame we're usually in the DOM, if we're not boxShadow is ""
502
+ // If it's none, the color was invalid - so just show this swatch as a white swatch which is the prettiest
503
+ (0, $7jsgb$depictaiutilisharedlatest.catchify)(()=>getComputedStyle(element).boxShadow === "none" && setInvalidColor(true))), _el$6);
504
+ (0, $7jsgb$solidjsweb.addEventListener)(_el$6, "pointerleave", (0, $7jsgb$depictaiutilisharedlatest.catchify)((e)=>{
505
+ clearTimeout(unHoverDebouncedTimeout);
506
+ unHoverDebouncedTimeout = setTimeout((0, $7jsgb$depictaiutilisharedlatest.catchify)(()=>setShowVariantIndex_(defaultVariantIndex_())), 500);
507
+ }));
508
+ (0, $7jsgb$solidjsweb.addEventListener)(_el$6, "pointerenter", (0, $7jsgb$depictaiutilisharedlatest.catchify)((e)=>{
509
+ clearTimeout(unHoverDebouncedTimeout);
510
+ setShowVariantIndex_(thisColorIsDefaultColor() ? defaultVariantIndex_() : variantIndex_);
511
+ }));
512
+ (0, $7jsgb$solidjsweb.setAttribute)(_el$6, "href", pageUrl_);
513
+ (0, $7jsgb$solidjsweb.setAttribute)(_el$6, "title", colorName);
514
+ (0, $7jsgb$solidjsweb.effect)((_p$)=>{
515
+ var _v$3 = `--background:${invalidColor() ? "white" : hexColor_}`, _v$4 = !!(colorsAtIndex_()?.[showVariantIndex_()] === colorName), _v$5 = !!thisColorIsDefaultColor(), _v$6 = !!($3375ddd88f77967d$var$isLightColor(hexColor_) || invalidColor());
516
+ _p$.e = (0, $7jsgb$solidjsweb.style)(_el$6, _v$3, _p$.e);
517
+ _v$4 !== _p$.t && _el$6.classList.toggle("selected", _p$.t = _v$4);
518
+ _v$5 !== _p$.a && _el$6.classList.toggle("first", _p$.a = _v$5);
519
+ _v$6 !== _p$.o && _el$6.classList.toggle("light-colored", _p$.o = _v$6);
520
+ return _p$;
521
+ }, {
522
+ e: undefined,
523
+ t: undefined,
524
+ a: undefined,
525
+ o: undefined
526
+ });
527
+ return _el$6;
528
+ })();
529
+ }
530
+ }), null);
531
+ (0, $7jsgb$solidjsweb.insert)(_el$4, (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
532
+ get when () {
533
+ return entriesToShow().length !== colorMap_().size;
534
+ },
535
+ get children () {
536
+ return $3375ddd88f77967d$var$_tmpl$4();
537
+ }
538
+ }), null);
539
+ return _el$4;
540
+ })();
541
+ })();
542
+ }
543
+ });
544
+ }
545
+ function $3375ddd88f77967d$var$Sizes({ sizesInStock_: sizesInStock_, ref_: ref_, fontSizeRem_: fontSizeRem_ }) {
546
+ const keys = ()=>[
547
+ ...sizesInStock_().keys()
548
+ ];
549
+ const keysToShow = ()=>keys().slice(0, 7);
550
+ const hidden = ()=>keys().length - keysToShow().length;
551
+ return (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
552
+ get when () {
553
+ return keysToShow().length > 1;
554
+ },
555
+ get children () {
556
+ var _el$7 = $3375ddd88f77967d$var$_tmpl$8();
557
+ (0, $7jsgb$solidjsweb.use)((el)=>{
558
+ ref_?.(el);
559
+ // Do like this so we don't override other styles set by AnimateRowSwitch
560
+ (0, $7jsgb$solidjs.createEffect)(()=>el.style.setProperty("--font-size-rem", fontSizeRem_() + "rem"));
561
+ }, _el$7);
562
+ (0, $7jsgb$solidjsweb.insert)(_el$7, (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.For), {
563
+ get each () {
564
+ return $3375ddd88f77967d$var$sortSizes(keysToShow());
565
+ },
566
+ children: (size)=>(0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
567
+ get when () {
568
+ return sizesInStock_().get(size);
569
+ },
570
+ get fallback () {
571
+ return (()=>{
572
+ var _el$13 = $3375ddd88f77967d$var$_tmpl$10();
573
+ (0, $7jsgb$solidjsweb.insert)(_el$13, size);
574
+ return _el$13;
575
+ })();
576
+ },
577
+ get children () {
578
+ var _el$12 = $3375ddd88f77967d$var$_tmpl$9();
579
+ (0, $7jsgb$solidjsweb.insert)(_el$12, size);
580
+ return _el$12;
581
+ }
582
+ })
583
+ }), null);
584
+ (0, $7jsgb$solidjsweb.insert)(_el$7, (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
585
+ get when () {
586
+ return hidden() > 0;
587
+ },
588
+ get children () {
589
+ var _el$8 = $3375ddd88f77967d$var$_tmpl$7(), _el$9 = _el$8.firstChild, _el$11 = _el$9.nextSibling, _el$10 = _el$11.nextSibling;
590
+ (0, $7jsgb$solidjsweb.insert)(_el$8, hidden, _el$11);
591
+ return _el$8;
592
+ }
593
+ }), null);
594
+ return _el$7;
595
+ }
596
+ });
597
+ }
598
+ function $3375ddd88f77967d$var$setPropertyIfExists(style, property, value) {
599
+ if (value) style.setProperty(property, value);
600
+ else style.removeProperty(property);
601
+ }
602
+ function $3375ddd88f77967d$var$setStyleForTextOptions({ style: style }, options) {
603
+ // Doing this instead of just using style={} because AnimatedRowSwitch needs to be able to set inline styling without it being overridden
604
+ (0, $7jsgb$solidjs.createEffect)(()=>$3375ddd88f77967d$var$setPropertyIfExists(style, "--font-size-rem", options().font_size_rem + "rem"));
605
+ (0, $7jsgb$solidjs.createEffect)(()=>$3375ddd88f77967d$var$setPropertyIfExists(style, "--font-weight", options().bold && "bold"));
606
+ (0, $7jsgb$solidjs.createEffect)(()=>$3375ddd88f77967d$var$setPropertyIfExists(style, "--font-style", options().italic && "italic"));
607
+ (0, $7jsgb$solidjs.createEffect)(()=>$3375ddd88f77967d$var$setPropertyIfExists(style, "--color", options().color));
608
+ (0, $7jsgb$solidjs.createEffect)(()=>$3375ddd88f77967d$var$setPropertyIfExists(style, "--background", options().bg_color));
609
+ }
610
+ function $3375ddd88f77967d$var$ImagesAndVideos({ image_urls_: image_urls_, video_: video_, configuredOptions_: configuredOptions_, cardIsHovered_: cardIsHovered_, aspectRatio_: aspectRatio_ }) {
611
+ const isAlreadyInSlider = !!(0, $7jsgb$depictaiuilatest.useSlidableInformation)();
612
+ const containerClasses = ()=>[
613
+ "image-video",
614
+ "border-radius-" + configuredOptions_().image_radius
615
+ ];
616
+ // Don't make cards swipable inside of sliders (PLP slider or recs slider)
617
+ const slidable = (0, $7jsgb$solidjs.createMemo)(()=>!isAlreadyInSlider && configuredOptions_().image_carousel);
618
+ const hoverImageDisabled = (0, $7jsgb$solidjs.createMemo)(()=>!configuredOptions_().use_hover_image);
619
+ const video_urls = ()=>video_()?.video_urls;
620
+ const Container = (props)=>{
621
+ const resolved = (0, $7jsgb$solidjs.children)(()=>props.children);
622
+ return (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
623
+ get when () {
624
+ return slidable();
625
+ },
626
+ get fallback () {
627
+ return (()=>{
628
+ var _el$14 = $3375ddd88f77967d$var$_tmpl$11();
629
+ (0, $7jsgb$solidjsweb.insert)(_el$14, resolved);
630
+ (0, $7jsgb$solidjsweb.effect)(()=>(0, $7jsgb$solidjsweb.className)(_el$14, containerClasses().join(" ")));
631
+ return _el$14;
632
+ })();
633
+ },
634
+ get children () {
635
+ return (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$depictaiuilatest.SlidableItems), {
636
+ arrow_height_: 25,
637
+ arrow_width_: 12.5,
638
+ disable_fading_: true,
639
+ slider_ref_: (slider)=>{
640
+ const { container: container, insert_here: insert_here } = slider;
641
+ slider.stepstoslide = 1; // In case anyone enables the hidden buttons using css
642
+ (0, $7jsgb$solidjs.createRenderEffect)((previous)=>(0, $7jsgb$solidjsweb.classList)(container, {
643
+ products: true,
644
+ ...Object.fromEntries(containerClasses().map((cls)=>[
645
+ cls,
646
+ true
647
+ ]))
648
+ }, previous));
649
+ // Scroll to beginning when changing what variant we're showing
650
+ (0, $7jsgb$solidjs.createEffect)((0, $7jsgb$solidjs.on)(image_urls_, ()=>insert_here.scrollTo({
651
+ left: 0,
652
+ behavior: "auto"
653
+ }), {
654
+ defer: true
655
+ }));
656
+ },
657
+ get children () {
658
+ return resolved();
659
+ }
660
+ });
661
+ }
662
+ });
663
+ };
664
+ return (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
665
+ get when () {
666
+ return image_urls_();
667
+ },
668
+ get fallback () {
669
+ return (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$depictaiuilatest.ImagePlaceholder), {
670
+ get aspectRatio () {
671
+ return aspectRatio_();
672
+ }
673
+ });
674
+ },
675
+ get children () {
676
+ return (0, $7jsgb$solidjsweb.createComponent)(Container, {
677
+ get children () {
678
+ return [
679
+ (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
680
+ get when () {
681
+ return video_urls()?.length;
682
+ },
683
+ get children () {
684
+ var _el$15 = $3375ddd88f77967d$var$_tmpl$12();
685
+ (0, $7jsgb$solidjsweb.insert)(_el$15, (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$depictaiuilatest.ImageContainer), {
686
+ get aspectRatio () {
687
+ return aspectRatio_();
688
+ },
689
+ get children () {
690
+ return (0, $7jsgb$solidjsweb.createComponent)($3375ddd88f77967d$var$Video, {
691
+ get video_sources_ () {
692
+ return video_urls();
693
+ },
694
+ get poster_ () {
695
+ return video_()?.preview_image_url || image_urls_()?.[0];
696
+ }
697
+ });
698
+ }
699
+ }));
700
+ return _el$15;
701
+ }
702
+ }),
703
+ (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
704
+ get when () {
705
+ return !video_urls()?.length || slidable();
706
+ },
707
+ get children () {
708
+ return (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.For), {
709
+ get each () {
710
+ return (0, $7jsgb$solidjsweb.memo)(()=>!!slidable())() ? image_urls_() : image_urls_()?.slice(0, 1);
711
+ },
712
+ children: (image_url, index)=>(0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
713
+ get when () {
714
+ return hoverImageDisabled() || index() !== 1;
715
+ },
716
+ get children () {
717
+ var _el$16 = $3375ddd88f77967d$var$_tmpl$13();
718
+ (0, $7jsgb$solidjsweb.insert)(_el$16, (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$depictaiuilatest.ShopifyContainedImage), {
719
+ src: image_url,
720
+ get aspectRatio () {
721
+ return aspectRatio_();
722
+ },
723
+ imgProps: {
724
+ alt: "Product image"
725
+ }
726
+ }), null);
727
+ (0, $7jsgb$solidjsweb.insert)(_el$16, (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
728
+ get when () {
729
+ return (0, $7jsgb$solidjsweb.memo)(()=>!!(!index() && image_urls_()?.[1]))() && !hoverImageDisabled();
730
+ },
731
+ get children () {
732
+ return (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$depictaiuilatest.ShopifyContainedImage), {
733
+ get src () {
734
+ return image_urls_()[1];
735
+ },
736
+ get aspectRatio () {
737
+ return aspectRatio_();
738
+ },
739
+ imgProps: {
740
+ alt: "Product image"
741
+ },
742
+ get ["class"] () {
743
+ return `hover${cardIsHovered_() ? " visible" : ""}`;
744
+ }
745
+ });
746
+ }
747
+ }), null);
748
+ return _el$16;
749
+ }
750
+ })
751
+ });
752
+ }
753
+ })
754
+ ];
755
+ }
756
+ });
757
+ }
758
+ });
759
+ }
760
+ function $3375ddd88f77967d$var$Video(props) {
761
+ // Making some assumptions for shopify here rn, change those if wanting to support other browsers too
762
+ const tabIsVisible = (0, $7jsgb$depictaiuilatest.useVisibilityState)();
763
+ const hlsSource = (0, $7jsgb$solidjs.createMemo)(()=>props.video_sources_.find((src)=>src.endsWith(".m3u8"))); // Prefer HLS when given by backend and browser supported
764
+ // This is because HLS automatically lets the browser choose both a fitting resolution and quality, depending on video dimensions and network conditions
765
+ const nonHLSSources = (0, $7jsgb$solidjs.createMemo)(()=>{
766
+ const sources = props.video_sources_?.filter((src)=>!src.endsWith(".m3u8"));
767
+ try {
768
+ $3375ddd88f77967d$var$sortVideoUrlsByQuality(sources);
769
+ } catch (e) {
770
+ (0, $7jsgb$depictaiutilisharedlatest.dlog)("Sorting by quality failed", e);
771
+ }
772
+ return sources;
773
+ });
774
+ const productCardIndexAccessor = (0, $7jsgb$depictaiuilatest.useProductCardIndex)();
775
+ const isVisible = (0, $7jsgb$depictaiuilatest.useProductCardIsVisible)();
776
+ const slidableInformation = (0, $7jsgb$depictaiuilatest.useSlidableInformation)();
777
+ const hiddenInImageCarousel = (0, $7jsgb$solidjs.createMemo)(()=>{
778
+ // Pause video when swiping to the next image
779
+ slidableInformation?.intersectionEntries_(); // Re-check when intersecting entries change
780
+ const intersectingsObject = slidableInformation?.slider_.intersecting_items_object;
781
+ // If intersection observers haven't started yet or we aren't in a slider, we count as visible for faster playback
782
+ if (!intersectingsObject || !Object.keys(intersectingsObject).length) return false;
783
+ // Video is always the first card in the slider
784
+ const ratio = intersectingsObject?.[0]?.intersectionRatio;
785
+ return !ratio;
786
+ });
787
+ return (()=>{
788
+ var _el$17 = $3375ddd88f77967d$var$_tmpl$15();
789
+ (0, $7jsgb$solidjsweb.use)((element)=>{
790
+ element.disablePictureInPicture = true;
791
+ (0, $7jsgb$solidjs.createEffect)(()=>{
792
+ if (isVisible() && tabIsVisible() && !hiddenInImageCarousel()) element.play().catch((e)=>(0, $7jsgb$depictaiutilisharedlatest.dwarn)("Error playing video", e));
793
+ else element.pause();
794
+ });
795
+ }, _el$17);
796
+ _el$17.controls = false;
797
+ _el$17.playsInline = true;
798
+ _el$17.loop = true;
799
+ _el$17.muted = true;
800
+ (0, $7jsgb$solidjsweb.spread)(_el$17, (0, $7jsgb$solidjsweb.mergeProps)({
801
+ get poster () {
802
+ return props.poster_;
803
+ }
804
+ }, ()=>productCardIndexAccessor?.() < 8 && {
805
+ preload: "auto"
806
+ }), false, true);
807
+ (0, $7jsgb$solidjsweb.insert)(_el$17, (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
808
+ get when () {
809
+ return hlsSource();
810
+ },
811
+ get children () {
812
+ var _el$18 = $3375ddd88f77967d$var$_tmpl$14();
813
+ (0, $7jsgb$solidjsweb.effect)(()=>(0, $7jsgb$solidjsweb.setAttribute)(_el$18, "src", hlsSource()));
814
+ return _el$18;
815
+ }
816
+ }), null);
817
+ (0, $7jsgb$solidjsweb.insert)(_el$17, (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.For), {
818
+ get each () {
819
+ return nonHLSSources();
820
+ },
821
+ children: (source)=>(()=>{
822
+ var _el$19 = $3375ddd88f77967d$var$_tmpl$16();
823
+ (0, $7jsgb$solidjsweb.setAttribute)(_el$19, "src", source);
824
+ return _el$19;
825
+ })()
826
+ }), null);
827
+ return _el$17;
828
+ })();
829
+ }
830
+ // ChatGPT written
831
+ function $3375ddd88f77967d$var$sortVideoUrlsByQuality(urls) {
832
+ // Function to extract resolution from a URL, assuming format consistency
833
+ function getResolution(url) {
834
+ const match = url.match(/(\d+)p/);
835
+ return match ? parseInt(match[1], 10) : 0;
836
+ }
837
+ // Sort the URLs based on the resolution extracted
838
+ return urls.sort((a, b)=>{
839
+ const resolutionA = getResolution(a);
840
+ const resolutionB = getResolution(b);
841
+ // For descending order, compare B to A
842
+ return resolutionB - resolutionA;
843
+ });
844
+ }
845
+ function $3375ddd88f77967d$var$Prices({ formatPrice_: formatPrice_, configuredOptions_: configuredOptions_, salePrice_: salePrice_, originalPrice_: originalPrice_, ref_: ref_, variantToShow_: variantToShow_, wrapperComponent_: wrapperComponent_ }) {
846
+ // Depict is fetching the prices from Shopify's storefront API on the frontend. This is because getting all prices in all currencies from Shopify be too computationally intensive (~1 million prices for some customers that can change at any time depending on exchange rate).
847
+ // This is why the prices are wrapped in a Promise (we want to render product cards without having to wait for the price request).
848
+ const priceOptions = ()=>configuredOptions_().price;
849
+ const originalPriceOptions = ()=>configuredOptions_().original_price;
850
+ return (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
851
+ get when () {
852
+ return priceOptions().enabled;
853
+ },
854
+ get children () {
855
+ return (0, $7jsgb$solidjsweb.createComponent)($3375ddd88f77967d$var$InComponentOrDiv, {
856
+ get component_ () {
857
+ return wrapperComponent_();
858
+ },
859
+ class_: "price-container",
860
+ ref_: ref_,
861
+ get children () {
862
+ return [
863
+ (()=>{
864
+ var _el$20 = $3375ddd88f77967d$var$_tmpl$17();
865
+ (0, $7jsgb$solidjsweb.use)((el)=>$3375ddd88f77967d$var$setStyleForTextOptions(el, priceOptions), _el$20);
866
+ (0, $7jsgb$solidjsweb.insert)(_el$20, (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
867
+ get when () {
868
+ return variantToShow_();
869
+ },
870
+ get fallback () {
871
+ return (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$depictaiuilatest.TextPlaceholder), {
872
+ height: "1em",
873
+ width: "5ch"
874
+ });
875
+ },
876
+ get children () {
877
+ return (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Suspense), {
878
+ get fallback () {
879
+ return (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$depictaiuilatest.TextPlaceholder), {
880
+ height: "1em",
881
+ width: "5ch"
882
+ });
883
+ },
884
+ get children () {
885
+ return formatPrice_?.(salePrice_());
886
+ }
887
+ });
888
+ }
889
+ }));
890
+ return _el$20;
891
+ })(),
892
+ (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Suspense), {
893
+ get children () {
894
+ return (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
895
+ get when () {
896
+ return (0, $7jsgb$solidjsweb.memo)(()=>originalPrice_() !== salePrice_())() && originalPriceOptions().enabled;
897
+ },
898
+ get children () {
899
+ return [
900
+ " ",
901
+ (()=>{
902
+ var _el$21 = $3375ddd88f77967d$var$_tmpl$18();
903
+ (0, $7jsgb$solidjsweb.use)((el)=>$3375ddd88f77967d$var$setStyleForTextOptions(el, originalPriceOptions), _el$21);
904
+ (0, $7jsgb$solidjsweb.insert)(_el$21, ()=>formatPrice_?.(originalPrice_()));
905
+ return _el$21;
906
+ })()
907
+ ];
908
+ }
909
+ });
910
+ }
911
+ })
912
+ ];
913
+ }
914
+ });
915
+ }
916
+ });
917
+ }
918
+ function $3375ddd88f77967d$var$isLightColor(anyCssColor) {
919
+ // Source: https://stackoverflow.com/a/47355187
920
+ $3375ddd88f77967d$var$colorCanvasContext ||= document.createElement("canvas").getContext("2d");
921
+ $3375ddd88f77967d$var$colorCanvasContext.fillStyle = anyCssColor;
922
+ const asHex = $3375ddd88f77967d$var$colorCanvasContext.fillStyle;
923
+ // Source: https://stackoverflow.com/a/12043228
924
+ const stripped = asHex.substring(1); // strip #
925
+ const rgb = parseInt(stripped, 16); // convert rrggbb to decimal
926
+ const r = rgb >> 16 & 0xff; // extract red
927
+ const g = rgb >> 8 & 0xff; // extract green
928
+ const b = rgb >> 0 & 0xff; // extract blue
929
+ const luma = 0.2126 * r + 0.7152 * g + 0.0722 * b; // per ITU-R BT.709, apparently between 0 and 255
930
+ return luma > 200;
931
+ }
932
+ // Mostly written by chatGPT
933
+ function $3375ddd88f77967d$var$sortSizes(sizesToSort) {
934
+ const sizeEntries = sizesToSort.map((size)=>{
935
+ const numericMatch = size.match(/^(\d+)(?:\/\d+)?$/);
936
+ if (numericMatch) // It's a numeric size or a range like "44/46", we sort by the first number.
937
+ return {
938
+ size: size,
939
+ numericValue: parseInt(numericMatch[1], 10)
940
+ };
941
+ return {
942
+ size: size
943
+ };
944
+ });
945
+ sizeEntries.sort((a, b)=>{
946
+ const indexA = $3375ddd88f77967d$var$sizeOrder.indexOf(a.size);
947
+ const indexB = $3375ddd88f77967d$var$sizeOrder.indexOf(b.size);
948
+ // Both sizes are in the predefined list
949
+ if (indexA !== -1 && indexB !== -1) return indexA - indexB;
950
+ // Handle numeric and mixed sorting
951
+ if (a.numericValue != null && b.numericValue != null) return a.numericValue - b.numericValue;
952
+ if (a.numericValue != null && indexB === -1) return -1; // numeric values come before unknown text
953
+ if (b.numericValue != null && indexA === -1) return 1; // numeric values come before unknown text
954
+ // Fallback if both are unrecognized, sort alphabetically
955
+ return a.size.localeCompare(b.size);
956
+ });
957
+ return sizeEntries.map((entry)=>entry.size);
958
+ }
959
+ function $3375ddd88f77967d$var$ContainsColorSwatchesProvider(props) {
960
+ const containsSignal = (0, $7jsgb$solidjs.createSignal)(false);
961
+ return (0, $7jsgb$solidjsweb.createComponent)($3375ddd88f77967d$var$ContainsColorSwatchesContext.Provider, {
962
+ value: containsSignal,
963
+ get children () {
964
+ return props.children;
965
+ }
966
+ });
967
+ }
968
+ function $3375ddd88f77967d$var$useContainsColorSwatches() {
969
+ return (0, $7jsgb$solidjs.useContext)($3375ddd88f77967d$var$ContainsColorSwatchesContext);
970
+ }
971
+ // Work around https://github.com/solidjs/solid/issues/2136 and random shit I thought was an issue before I found https://github.com/solidjs/solid/issues/2137
972
+ function $3375ddd88f77967d$var$InComponentOrDiv(props) {
973
+ const resolved = (0, $7jsgb$solidjs.children)(()=>props.children);
974
+ return (0, $7jsgb$solidjs.createMemo)(()=>{
975
+ const Component = props.component_;
976
+ if (Component) // Written like this because the JSX transform mutates our props object: https://github.com/ryansolid/dom-expressions/pull/316#issuecomment-2066925544
977
+ return (0, $7jsgb$solidjsweb.createComponent)(Component, {
978
+ get class () {
979
+ return props.class_;
980
+ },
981
+ get ref () {
982
+ return props.ref_;
983
+ },
984
+ children: resolved
985
+ });
986
+ return (()=>{
987
+ var _el$22 = $3375ddd88f77967d$var$_tmpl$11();
988
+ (0, $7jsgb$solidjsweb.use)((el)=>props?.ref_?.(el), _el$22);
989
+ (0, $7jsgb$solidjsweb.insert)(_el$22, resolved);
990
+ (0, $7jsgb$solidjsweb.effect)(()=>(0, $7jsgb$solidjsweb.className)(_el$22, props.class_));
991
+ return _el$22;
992
+ })();
993
+ });
994
+ }
995
+ (0, $7jsgb$solidjsweb.delegateEvents)([
996
+ "click"
997
+ ]);
998
+
999
+
1000
+
1001
+ function $70cc6bd7e3f1dd4b$export$d1a48be4967fe67c(react_props) {
1002
+ return (0, $d38f1fd3cc4cd6b2$export$f6e64e17bd69eeef)({
1003
+ solid_component: (props_store)=>{
1004
+ return (0, $3375ddd88f77967d$export$f11681c54c860912)(()=>props_store.display, {
1005
+ set_on_index_change: ()=>{},
1006
+ depictCardsDataset: {},
1007
+ formatPrice: (price)=>price && (0, $7jsgb$depictaiutilisharedlatest.standard_price_format)(price)
1008
+ }, ()=>props_store.options);
1009
+ },
1010
+ // Work around in case https://github.com/solidjs/solid/issues/2139 potentially arises
1011
+ props: structuredClone(react_props),
1012
+ className: "depict"
1013
+ });
1014
+ }
1015
+
1016
+
1017
+
1018
+
1019
+
49
1020
  function $a1efb49ef2dfa3c2$export$32717ad33b14d079(get_value, get_set_function) {
50
1021
  const return_value = [
51
1022
  get_value,