@best-bundles/bundle-ui 0.0.3 → 0.0.4

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/index.js CHANGED
@@ -1,24 +1,24 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode('._button_18rtl_1{display:inline-flex;align-items:center;justify-content:center;gap:8px;font-family:var(--bb-font-family, inherit);border:1px solid var(--bb-button-border, rgba(0, 0, 0, .12));background:var(--bb-button-bg, #111827);color:var(--bb-button-text, #ffffff);font:inherit;line-height:1;padding:10px 14px;border-radius:var(--bb-button-radius, 10px);cursor:pointer;transition:transform .12s ease,background .12s ease,border-color .12s ease,opacity .12s ease}._button_18rtl_1:hover{background:var(--bb-button-bg-hover, #0b1220)}._button_18rtl_1:active{transform:translateY(1px)}._button_18rtl_1:disabled{opacity:.6;cursor:not-allowed}._button_18rtl_1:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._backdrop_1ctfr_1{position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--bb-backdrop-z-index, 9999);display:flex;justify-content:flex-end;background:var(--bb-backdrop-bg, rgba(0, 0, 0, .5));-webkit-backdrop-filter:blur(var(--bb-backdrop-blur, 2px));backdrop-filter:blur(var(--bb-backdrop-blur, 2px));padding:var(--bb-backdrop-padding, 12px);opacity:0;transition:opacity var(--bb-drawer-transition-duration, .22s) ease}._backdropOpen_1ctfr_14{opacity:1}._backdropClosed_1ctfr_18{opacity:0}._panel_1ctfr_22{width:440px;max-width:100%;height:100%;background:var(--bb-surface-bg, #ffffff);color:var(--bb-text-color, #111827);font-family:var(--bb-font-family-body, "Cabin", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif);border-radius:var(--bb-panel-radius, 16px);box-shadow:0 20px 60px #00000059;display:grid;grid-template-rows:auto 1fr auto;overflow:hidden;outline:none;position:relative;top:unset;right:unset;bottom:unset;left:unset}._panelOpen_1ctfr_42{animation:_bbSlideInFromRight_1ctfr_1 var(--bb-drawer-transition-duration, .22s) ease forwards}._panelClosed_1ctfr_46{animation:_bbSlideOutToRight_1ctfr_1 var(--bb-drawer-transition-duration, .22s) ease forwards}@keyframes _bbSlideInFromRight_1ctfr_1{0%{transform:translate(110%)}to{transform:translate(0)}}@keyframes _bbSlideOutToRight_1ctfr_1{0%{transform:translate(0)}to{transform:translate(110%)}}@media(prefers-reduced-motion:reduce){._backdrop_1ctfr_1{transition:none}._panelOpen_1ctfr_42,._panelClosed_1ctfr_46{animation:none}}._header_1ctfr_81{display:grid;grid-template-columns:36px 1fr 36px;align-items:center;column-gap:12px;padding:var(--bb-header-padding, 16px 16px 12px 16px);border-bottom:1px solid var(--bb-border-color, rgba(17, 24, 39, .08))}._headerCenter_1ctfr_90{position:relative;min-width:0;display:flex;justify-content:center;align-items:center}._title_1ctfr_98{font-size:24px;margin:0;line-height:1.2;font-family:var(--bb-font-family-title, "Bebas Neue", "Cabin", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif);letter-spacing:.02em;color:var(--bb-title-color, var(--bb-text-color, #111827))}._searchIconButton_1ctfr_107{width:36px;height:36px;border-radius:10px;border:1px solid var(--bb-border-strong-color, rgba(17, 24, 39, .12));background:var(--bb-surface-bg, #ffffff);color:var(--bb-text-color, #111827);cursor:pointer;display:inline-flex;align-items:center;justify-content:center}._searchIconButton_1ctfr_107:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._searchIconButton_1ctfr_107:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._headerTitleWrap_1ctfr_129{transition:opacity .18s ease,transform .22s ease}._headerSearchWrap_1ctfr_133{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;justify-content:center;align-items:center;pointer-events:none;opacity:0;transform:translateY(-2px);transition:opacity .18s ease,transform .22s ease}._headerSearchOpen_1ctfr_145 ._headerTitleWrap_1ctfr_129{opacity:0;transform:translateY(2px);pointer-events:none}._headerSearchOpen_1ctfr_145 ._headerSearchWrap_1ctfr_133{opacity:1;transform:translateY(0);pointer-events:auto}._searchBar_1ctfr_157{width:min(320px,100%);height:36px;display:flex;align-items:center;gap:8px;background:var(--bb-surface-bg, #ffffff);border:1px solid var(--bb-border-strong-color, rgba(17, 24, 39, .12));border-radius:10px;padding:0 8px}._searchInput_1ctfr_169{width:100%;border:none;outline:none;background:transparent;font:inherit;font-size:14px;min-width:0;height:100%;line-height:36px;padding:0}._searchInput_1ctfr_169::-webkit-search-cancel-button,._searchInput_1ctfr_169::-webkit-search-decoration,._searchInput_1ctfr_169::-webkit-search-results-button,._searchInput_1ctfr_169::-webkit-search-results-decoration{-webkit-appearance:none;-moz-appearance:none;appearance:none}._searchClearButton_1ctfr_190{border:none;background:transparent;color:var(--bb-text-color, #111827);font:inherit;font-size:13px;font-weight:700;cursor:pointer;padding:6px;border-radius:10px;line-height:1}._searchClearButton_1ctfr_190:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._searchClearButton_1ctfr_190:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._closeButton_1ctfr_212{border:1px solid var(--bb-border-strong-color, rgba(17, 24, 39, .12));background:var(--bb-surface-bg, #ffffff);color:var(--bb-text-color, #111827);width:36px;height:36px;border-radius:10px;cursor:pointer;flex:0 0 auto}._closeButton_1ctfr_212:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._closeButton_1ctfr_212:disabled{opacity:.6;cursor:not-allowed}._closeButton_1ctfr_212:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}@media(prefers-reduced-motion:reduce){._headerTitleWrap_1ctfr_129,._headerSearchWrap_1ctfr_133{transition:none}}._body_1ctfr_245{padding:var(--bb-body-padding, 8px 16px);overflow:auto}._muted_1ctfr_250{color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65));margin:0 0 12px}._error_1ctfr_255{color:var(--bb-error-color, #b91c1c);margin:0 0 12px}._variants_1ctfr_260{margin-top:4px}._variantList_1ctfr_264{list-style:none;padding:0;margin:0;display:grid;gap:10px}._variantRow_1ctfr_272{display:grid;grid-template-columns:1fr auto;gap:0px;align-items:stretch;padding:5px}._variantLeft_1ctfr_280{min-width:0;display:flex;gap:12px;align-items:center}._addToBundleButton_1ctfr_287{height:100%;align-self:stretch;border-radius:12px;border:none;background:var(--bb-cta-bg, #91aae5);color:var(--bb-cta-text, #ffffff);font:inherit;font-weight:800;padding:0 16px;cursor:pointer;white-space:nowrap}._addToBundleButton_1ctfr_287:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._addToBundleButton_1ctfr_287:disabled{opacity:.6;cursor:not-allowed}._addToBundleButton_1ctfr_287:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._variantThumb_1ctfr_315{width:60px;height:60px;border-radius:12px;overflow:hidden;border:1px solid var(--bb-border-color, rgba(17, 24, 39, .08));background:var(--bb-surface-subtle-bg, rgba(17, 24, 39, .02));flex:0 0 auto}._variantThumbImg_1ctfr_325{width:100%;height:100%;object-fit:cover;display:block}._variantThumbFallback_1ctfr_332{width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-weight:800;color:var(--bb-text-color, #111827)}._variantInfo_1ctfr_342{min-width:0}._variantName_1ctfr_346{font-size:14px;font-weight:600;margin-bottom:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._variantMeta_1ctfr_355{font-size:12px;color:var(--bb-muted-color, rgba(17, 24, 39, .6));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._variantPriceRow_1ctfr_363{display:flex;align-items:baseline;gap:8px;margin-top:4px}._variantCompareAt_1ctfr_370{font-size:12px;color:var(--bb-muted-color, rgba(17, 24, 39, .6));text-decoration:line-through}._variantPrice_1ctfr_363{font-size:13px;font-weight:800}._qtyControls_1ctfr_381{display:inline-flex;align-items:center;gap:6px}._qtyButton_1ctfr_387{width:34px;height:34px;border-radius:10px;border:1px solid var(--bb-border-strong-color, rgba(17, 24, 39, .12));background:var(--bb-surface-bg, #ffffff);cursor:pointer;line-height:1;font-size:16px}._qtyButton_1ctfr_387:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._qtyButton_1ctfr_387:disabled{opacity:.6;cursor:not-allowed}._qtyButton_1ctfr_387:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._qtyValue_1ctfr_412{min-width:18px;text-align:center;font-variant-numeric:tabular-nums;font-weight:700}._footer_1ctfr_419{padding:var(--bb-footer-padding, 12px 16px 16px 16px);border-top:1px solid var(--bb-border-color, rgba(17, 24, 39, .08));background:var(--bb-surface-bg, #ffffff);position:relative}._boxSummaryWindow_1ctfr_426{margin-bottom:6px;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;padding-bottom:6px;scrollbar-width:none;-ms-overflow-style:none}._boxSummaryWindow_1ctfr_426::-webkit-scrollbar{display:none}._boxSummaryRow_1ctfr_443{--bb-box-gap: 10px;display:flex;align-items:flex-start;gap:var(--bb-box-gap);width:100%}._boxSlot_1ctfr_451{flex:0 0 calc((100% - (4 * var(--bb-box-gap))) / 5);display:flex;flex-direction:column;align-items:stretch;gap:6px}._boxItem_1ctfr_459{width:100%;aspect-ratio:1 / 1;border-radius:12px;position:relative;display:flex;align-items:center;justify-content:center;-webkit-user-select:none;user-select:none;box-sizing:border-box}._boxItemClickable_1ctfr_471{cursor:pointer}._boxItemClickable_1ctfr_471:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._boxThresholdLabel_1ctfr_480{font-size:11px;line-height:1.15;font-weight:700;color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65));text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}._boxItemPlaceholder_1ctfr_491{border:1px dashed var(--bb-border-strong-color, rgba(17, 24, 39, .18));background:var(--bb-surface-subtle-bg, rgba(17, 24, 39, .02));color:var(--bb-muted-color, rgba(17, 24, 39, .6))}._boxItemFilled_1ctfr_497{border:1px solid var(--bb-border-color, rgba(17, 24, 39, .08));background:var(--bb-surface-bg, #ffffff);overflow:hidden}._boxItemThreshold_1ctfr_503{border-style:solid;border-width:2px;border-color:var(--bb-tier-border, rgba(37, 99, 235, .55));background:linear-gradient(180deg,#2563eb1a,#2563eb08);color:var(--bb-tier-text, rgba(29, 78, 216, .95))}._boxItemDiscountText_1ctfr_511{font-size:12px;font-weight:800;text-align:center;line-height:1.1;padding:6px}._boxItemPlus_1ctfr_519{font-size:22px;font-weight:700;opacity:.5;line-height:1}._boxItemImage_1ctfr_526{width:100%;height:100%;object-fit:cover;display:block}._boxItemFallback_1ctfr_533{width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:var(--bb-surface-subtle-bg, rgba(17, 24, 39, .04));color:var(--bb-text-color, #111827);font-weight:800}._cta_1ctfr_544{width:100%;border:1px solid var(--bb-cta-border, rgba(0, 0, 0, .12));background:var(--bb-cta-bg, #2563eb);color:var(--bb-cta-text, #ffffff);font:inherit;font-weight:700;padding:12px 14px;border-radius:12px;cursor:pointer}._ctaTotals_1ctfr_556{display:flex;justify-content:space-between;align-items:baseline;gap:10px;font-variant-numeric:tabular-nums}._ctaDiscountBadge_1ctfr_564{display:inline-flex;align-items:center;gap:6px;padding:6px 10px;border-radius:999px;font-size:12px;font-weight:800;background:linear-gradient(180deg,#2563eb24,#2563eb0f);border:1px solid rgba(37,99,235,.3);color:#1d4ed8f2;white-space:nowrap}._ctaTotalsWrap_1ctfr_578{overflow:hidden;max-height:0;opacity:0;transform:translateY(4px);margin-bottom:0;transition:max-height .22s ease,opacity .16s ease,transform .22s ease,margin-bottom .22s ease}._ctaTotalsWrapVisible_1ctfr_591{max-height:40px;opacity:1;transform:translateY(0);margin-bottom:8px}._ctaTotalsStrike_1ctfr_598{opacity:.85;text-decoration:line-through;font-weight:700;color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65))}._ctaTotalsPrice_1ctfr_605{font-weight:900;color:var(--bb-text-color, #111827)}@media(prefers-reduced-motion:reduce){._ctaTotalsWrap_1ctfr_578{transition:none}}._cta_1ctfr_544:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._cta_1ctfr_544:disabled{opacity:.6;cursor:not-allowed}._cta_1ctfr_544:focus-visible{outline:2px solid var(--bb-cta-focus-ring, var(--bb-text-color, #111827));outline-offset:2px}._helperText_1ctfr_630{margin-top:8px;font-size:12px;color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65));text-align:center}@media(max-width:767px){._backdrop_1ctfr_1{padding:0;justify-content:stretch}._panel_1ctfr_22{width:100%;height:100%;border-radius:0}}')),document.head.appendChild(r)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
- import { jsx as r, jsxs as N, Fragment as Te } from "react/jsx-runtime";
3
- import { useState as F, useRef as Z, useEffect as G, useCallback as oe, useMemo as y, createContext as Ie, useContext as we, forwardRef as Be, createElement as ye } from "react";
4
- const _e = {
2
+ import { jsx as d, jsxs as P, Fragment as Qt } from "react/jsx-runtime";
3
+ import wt, { useState as O, useRef as V, useEffect as z, useCallback as st, useMemo as T, createContext as Yt, useContext as Gt, forwardRef as Et, createElement as Tt } from "react";
4
+ const gt = {
5
5
  bundleId: "_bundle_id",
6
6
  bundleConfig: "_bundle_config",
7
7
  bundleSource: "_bundle_source",
8
8
  bundleTitle: "_bundle_title"
9
9
  };
10
- async function Se(o) {
11
- const l = new URL("/api/public/bundle-config", o.apiBaseUrl);
12
- l.searchParams.set("shop", o.shop);
13
- const m = await (await fetch(l, {
10
+ async function Ht(o) {
11
+ const t = new URL("/api/public/bundle-config", o.apiBaseUrl);
12
+ t.searchParams.set("shop", o.shop);
13
+ const i = await (await fetch(t, {
14
14
  method: "GET",
15
15
  signal: o.signal,
16
16
  headers: { "Content-Type": "application/json" }
17
17
  })).json().catch(() => null);
18
- return !m || typeof m != "object" ? { ok: !1, error: "Invalid response." } : m;
18
+ return !i || typeof i != "object" ? { ok: !1, error: "Invalid response." } : i;
19
19
  }
20
- const Ne = Ie(null);
21
- function ke() {
20
+ const Vt = Yt(null);
21
+ function Kt() {
22
22
  try {
23
23
  const o = globalThis.crypto;
24
24
  if (o != null && o.randomUUID) return o.randomUUID();
@@ -26,176 +26,517 @@ function ke() {
26
26
  }
27
27
  return `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
28
28
  }
29
- function ge(o) {
29
+ function Dt(o) {
30
30
  return Number.isFinite(o) ? Math.max(0, Math.floor(o)) : 0;
31
31
  }
32
- function Qt(o) {
32
+ function Cn(o) {
33
33
  const {
34
- apiBaseUrl: l,
35
- shop: _,
36
- cartAdapter: m,
37
- configHandle: I = "default",
38
- initialData: h,
39
- configFetcher: E,
40
- children: x
41
- } = o, [S, M] = F(!1), [q, J] = F(!h), [g, Q] = F(!1), [X, le] = F(null), [P, Y] = F((h == null ? void 0 : h.currencyCode) ?? null), [f, ee] = F((h == null ? void 0 : h.config) ?? null), [te, ne] = F(
42
- (h == null ? void 0 : h.eligibleVariants) ?? []
43
- ), [ce, me] = F(
34
+ apiBaseUrl: t,
35
+ shop: e,
36
+ cartAdapter: i,
37
+ configHandle: r = "default",
38
+ initialData: n,
39
+ configFetcher: c,
40
+ children: l
41
+ } = o, [m, k] = O(!1), [N, R] = O(!n), [w, $] = O(!1), [j, U] = O(null), [S, F] = O((n == null ? void 0 : n.currencyCode) ?? null), [b, Q] = O((n == null ? void 0 : n.config) ?? null), [rt, it] = O(
42
+ (n == null ? void 0 : n.eligibleVariants) ?? []
43
+ ), [K, ft] = O(
44
44
  () => ({ selections: {}, order: [] })
45
- ), he = Z(null);
46
- G(() => {
47
- var B;
48
- if (h) return;
49
- (B = he.current) == null || B.abort();
50
- const d = new AbortController();
51
- he.current = d;
52
- const C = E ?? Se;
53
- return J(!0), le(null), C({ apiBaseUrl: l, shop: _, signal: d.signal }).then((s) => {
54
- if (!s.ok) {
55
- le(s.error || "Failed to load bundle config."), ee(null), ne([]), Y(null);
45
+ ), mt = V(null);
46
+ z(() => {
47
+ var C;
48
+ if (n) return;
49
+ (C = mt.current) == null || C.abort();
50
+ const y = new AbortController();
51
+ mt.current = y;
52
+ const x = c ?? Ht;
53
+ return R(!0), U(null), x({ apiBaseUrl: t, shop: e, signal: y.signal }).then((g) => {
54
+ if (!g.ok) {
55
+ U(g.error || "Failed to load bundle config."), Q(null), it([]), F(null);
56
56
  return;
57
57
  }
58
- Y(s.currencyCode ?? null), ee(s.config), ne(s.eligibleVariants ?? []);
59
- }).catch((s) => {
60
- const T = s instanceof Error ? s.message : "Failed to load bundle config.";
61
- le(T), ee(null), ne([]), Y(null);
62
- }).finally(() => J(!1)), () => d.abort();
63
- }, [l, _, h, E]);
64
- const se = oe(() => M(!0), []), w = oe(() => M(!1), []), $ = oe(() => M((d) => !d), []), be = oe((d, C) => {
65
- const B = ge(C);
66
- me((s) => {
67
- const T = s.selections[d] ?? 0, j = B - T;
68
- let z;
69
- if (B <= 0) {
70
- const { [d]: re, ...U } = s.selections;
71
- z = U;
72
- } else T === B ? z = s.selections : z = { ...s.selections, [d]: B };
73
- let H = s.order;
74
- if (j > 0)
75
- H = [...s.order, ...Array.from({ length: j }, () => d)];
76
- else if (j < 0) {
77
- let re = -j;
78
- const U = [];
79
- for (let ae = s.order.length - 1; ae >= 0; ae--) {
80
- const ue = s.order[ae];
81
- if (ue === d && re > 0) {
82
- re--;
58
+ F(g.currencyCode ?? null), Q(g.config), it(g.eligibleVariants ?? []);
59
+ }).catch((g) => {
60
+ const M = g instanceof Error ? g.message : "Failed to load bundle config.";
61
+ U(M), Q(null), it([]), F(null);
62
+ }).finally(() => R(!1)), () => y.abort();
63
+ }, [t, e, n, c]);
64
+ const pt = st(() => k(!0), []), X = st(() => k(!1), []), bt = st(() => k((y) => !y), []), _t = st((y, x) => {
65
+ const C = Dt(x);
66
+ ft((g) => {
67
+ const M = g.selections[y] ?? 0, G = C - M;
68
+ let I;
69
+ if (C <= 0) {
70
+ const { [y]: et, ...D } = g.selections;
71
+ I = D;
72
+ } else M === C ? I = g.selections : I = { ...g.selections, [y]: C };
73
+ let L = g.order;
74
+ if (G > 0)
75
+ L = [...g.order, ...Array.from({ length: G }, () => y)];
76
+ else if (G < 0) {
77
+ let et = -G;
78
+ const D = [];
79
+ for (let lt = g.order.length - 1; lt >= 0; lt--) {
80
+ const ot = g.order[lt];
81
+ if (ot === y && et > 0) {
82
+ et--;
83
83
  continue;
84
84
  }
85
- U.push(ue);
85
+ D.push(ot);
86
86
  }
87
- U.reverse(), H = U;
87
+ D.reverse(), L = D;
88
88
  }
89
- return z === s.selections && H === s.order ? s : { selections: z, order: H };
89
+ return I === g.selections && L === g.order ? g : { selections: I, order: L };
90
90
  });
91
- }, []), W = oe(() => me({ selections: {}, order: [] }), []), V = ce.selections, v = ce.order, R = y(() => Object.values(V).reduce((d, C) => d + (C || 0), 0), [V]), D = y(() => {
92
- const d = (f == null ? void 0 : f.rules) ?? [], C = d.length ? Math.min(...d.map((B) => B.minBundleSize)) : 2;
93
- return Number.isFinite(C) && C > 0 ? C : 2;
94
- }, [f]), k = y(() => !(q || g || X || !(f != null && f.isActive) || R < D), [R, f == null ? void 0 : f.isActive, X, q, D, g]), fe = oe(async () => {
95
- var s;
96
- if (!k || !f) return;
97
- const d = ke(), C = (f.title ?? "").trim().slice(0, 255), B = Object.entries(V).map(([T, j]) => ({ merchandiseId: T, quantity: ge(j) })).filter((T) => T.quantity > 0).map((T) => ({
98
- merchandiseId: T.merchandiseId,
99
- quantity: T.quantity,
91
+ }, []), Z = st(() => ft({ selections: {}, order: [] }), []), A = K.selections, ct = K.order, at = T(() => Object.values(A).reduce((y, x) => y + (x || 0), 0), [A]), J = T(() => {
92
+ const y = (b == null ? void 0 : b.rules) ?? [], x = y.length ? Math.min(...y.map((C) => C.minBundleSize)) : 2;
93
+ return Number.isFinite(x) && x > 0 ? x : 2;
94
+ }, [b]), tt = T(() => !(N || w || j || !(b != null && b.isActive) || at < J), [at, b == null ? void 0 : b.isActive, j, N, J, w]), vt = st(async () => {
95
+ var g;
96
+ if (!tt || !b) return;
97
+ const y = Kt(), x = (b.title ?? "").trim().slice(0, 255), C = Object.entries(A).map(([M, G]) => ({ merchandiseId: M, quantity: Dt(G) })).filter((M) => M.quantity > 0).map((M) => ({
98
+ merchandiseId: M.merchandiseId,
99
+ quantity: M.quantity,
100
100
  attributes: [
101
- { key: _e.bundleId, value: d },
102
- { key: _e.bundleConfig, value: I },
103
- { key: _e.bundleSource, value: "bundle_builder" },
104
- ...C ? [{ key: _e.bundleTitle, value: C }] : []
101
+ { key: gt.bundleId, value: y },
102
+ { key: gt.bundleConfig, value: r },
103
+ { key: gt.bundleSource, value: "bundle_builder" },
104
+ ...x ? [{ key: gt.bundleTitle, value: x }] : []
105
105
  ]
106
106
  }));
107
- if (B.length) {
108
- Q(!0);
107
+ if (C.length) {
108
+ $(!0);
109
109
  try {
110
- await m.linesAdd(B), W(), w(), (s = m.openCartUI) == null || s.call(m);
110
+ await i.linesAdd(C), Z(), X(), (g = i.openCartUI) == null || g.call(i);
111
111
  } finally {
112
- Q(!1);
112
+ $(!1);
113
113
  }
114
114
  }
115
- }, [k, m, W, w, f, I, V]), ie = y(
115
+ }, [tt, i, Z, X, b, r, A]), yt = T(
116
116
  () => ({
117
- isOpen: S,
118
- open: se,
119
- close: w,
120
- toggle: $,
121
- loading: q,
122
- submitting: g,
123
- error: X,
124
- currencyCode: P,
125
- config: f,
126
- eligibleVariants: te,
127
- selections: V,
128
- selectionOrder: v,
129
- setQuantity: be,
130
- clearSelections: W,
131
- bundleSize: R,
132
- minRequired: D,
133
- canSubmit: k,
134
- submit: fe
117
+ isOpen: m,
118
+ open: pt,
119
+ close: X,
120
+ toggle: bt,
121
+ loading: N,
122
+ submitting: w,
123
+ error: j,
124
+ currencyCode: S,
125
+ config: b,
126
+ eligibleVariants: rt,
127
+ selections: A,
128
+ selectionOrder: ct,
129
+ setQuantity: _t,
130
+ clearSelections: Z,
131
+ bundleSize: at,
132
+ minRequired: J,
133
+ canSubmit: tt,
134
+ submit: vt
135
135
  }),
136
136
  [
137
- S,
138
- se,
139
- w,
140
- $,
141
- q,
142
- g,
137
+ m,
138
+ pt,
143
139
  X,
144
- P,
145
- f,
146
- te,
147
- V,
148
- v,
149
- be,
150
- W,
151
- R,
152
- D,
153
- k,
154
- fe
140
+ bt,
141
+ N,
142
+ w,
143
+ j,
144
+ S,
145
+ b,
146
+ rt,
147
+ A,
148
+ ct,
149
+ _t,
150
+ Z,
151
+ at,
152
+ J,
153
+ tt,
154
+ vt
155
155
  ]
156
156
  );
157
- return /* @__PURE__ */ r(Ne.Provider, { value: ie, children: x });
157
+ return /* @__PURE__ */ d(Vt.Provider, { value: yt, children: l });
158
158
  }
159
- function xe() {
160
- const o = we(Ne);
159
+ function Nt() {
160
+ const o = Gt(Vt);
161
161
  if (!o)
162
162
  throw new Error("useBundleBuilder must be used within <BundleProvider />");
163
163
  return o;
164
164
  }
165
- function Ht() {
166
- const { isOpen: o, open: l, close: _, toggle: m } = xe();
167
- return { isOpen: o, open: l, close: _, toggle: m };
165
+ function Bn() {
166
+ const { isOpen: o, open: t, close: e, toggle: i } = Nt();
167
+ return { isOpen: o, open: t, close: e, toggle: i };
168
168
  }
169
- const Fe = "_button_18rtl_1", Pe = {
170
- button: Fe
169
+ const Xt = "_button_18rtl_1", Zt = {
170
+ button: Xt
171
171
  };
172
- function Kt(o) {
173
- const { toggle: l } = xe();
174
- return /* @__PURE__ */ r(
172
+ function Tn(o) {
173
+ const { toggle: t } = Nt();
174
+ return /* @__PURE__ */ d(
175
175
  "button",
176
176
  {
177
177
  type: "button",
178
- onClick: l,
179
- className: [Pe.button, o.className].filter(Boolean).join(" "),
178
+ onClick: t,
179
+ className: [Zt.button, o.className].filter(Boolean).join(" "),
180
180
  children: o.children ?? "Build a bundle"
181
181
  }
182
182
  );
183
183
  }
184
+ var Ct, Lt;
185
+ function Jt() {
186
+ if (Lt) return Ct;
187
+ Lt = 1;
188
+ var o = {
189
+ linear: function(t, e, i, r) {
190
+ var n = i - e;
191
+ return n * t / r + e;
192
+ },
193
+ easeInQuad: function(t, e, i, r) {
194
+ var n = i - e;
195
+ return n * (t /= r) * t + e;
196
+ },
197
+ easeOutQuad: function(t, e, i, r) {
198
+ var n = i - e;
199
+ return -n * (t /= r) * (t - 2) + e;
200
+ },
201
+ easeInOutQuad: function(t, e, i, r) {
202
+ var n = i - e;
203
+ return (t /= r / 2) < 1 ? n / 2 * t * t + e : -n / 2 * (--t * (t - 2) - 1) + e;
204
+ },
205
+ easeInCubic: function(t, e, i, r) {
206
+ var n = i - e;
207
+ return n * (t /= r) * t * t + e;
208
+ },
209
+ easeOutCubic: function(t, e, i, r) {
210
+ var n = i - e;
211
+ return n * ((t = t / r - 1) * t * t + 1) + e;
212
+ },
213
+ easeInOutCubic: function(t, e, i, r) {
214
+ var n = i - e;
215
+ return (t /= r / 2) < 1 ? n / 2 * t * t * t + e : n / 2 * ((t -= 2) * t * t + 2) + e;
216
+ },
217
+ easeInQuart: function(t, e, i, r) {
218
+ var n = i - e;
219
+ return n * (t /= r) * t * t * t + e;
220
+ },
221
+ easeOutQuart: function(t, e, i, r) {
222
+ var n = i - e;
223
+ return -n * ((t = t / r - 1) * t * t * t - 1) + e;
224
+ },
225
+ easeInOutQuart: function(t, e, i, r) {
226
+ var n = i - e;
227
+ return (t /= r / 2) < 1 ? n / 2 * t * t * t * t + e : -n / 2 * ((t -= 2) * t * t * t - 2) + e;
228
+ },
229
+ easeInQuint: function(t, e, i, r) {
230
+ var n = i - e;
231
+ return n * (t /= r) * t * t * t * t + e;
232
+ },
233
+ easeOutQuint: function(t, e, i, r) {
234
+ var n = i - e;
235
+ return n * ((t = t / r - 1) * t * t * t * t + 1) + e;
236
+ },
237
+ easeInOutQuint: function(t, e, i, r) {
238
+ var n = i - e;
239
+ return (t /= r / 2) < 1 ? n / 2 * t * t * t * t * t + e : n / 2 * ((t -= 2) * t * t * t * t + 2) + e;
240
+ },
241
+ easeInSine: function(t, e, i, r) {
242
+ var n = i - e;
243
+ return -n * Math.cos(t / r * (Math.PI / 2)) + n + e;
244
+ },
245
+ easeOutSine: function(t, e, i, r) {
246
+ var n = i - e;
247
+ return n * Math.sin(t / r * (Math.PI / 2)) + e;
248
+ },
249
+ easeInOutSine: function(t, e, i, r) {
250
+ var n = i - e;
251
+ return -n / 2 * (Math.cos(Math.PI * t / r) - 1) + e;
252
+ },
253
+ easeInExpo: function(t, e, i, r) {
254
+ var n = i - e;
255
+ return t == 0 ? e : n * Math.pow(2, 10 * (t / r - 1)) + e;
256
+ },
257
+ easeOutExpo: function(t, e, i, r) {
258
+ var n = i - e;
259
+ return t == r ? e + n : n * (-Math.pow(2, -10 * t / r) + 1) + e;
260
+ },
261
+ easeInOutExpo: function(t, e, i, r) {
262
+ var n = i - e;
263
+ return t === 0 ? e : t === r ? e + n : (t /= r / 2) < 1 ? n / 2 * Math.pow(2, 10 * (t - 1)) + e : n / 2 * (-Math.pow(2, -10 * --t) + 2) + e;
264
+ },
265
+ easeInCirc: function(t, e, i, r) {
266
+ var n = i - e;
267
+ return -n * (Math.sqrt(1 - (t /= r) * t) - 1) + e;
268
+ },
269
+ easeOutCirc: function(t, e, i, r) {
270
+ var n = i - e;
271
+ return n * Math.sqrt(1 - (t = t / r - 1) * t) + e;
272
+ },
273
+ easeInOutCirc: function(t, e, i, r) {
274
+ var n = i - e;
275
+ return (t /= r / 2) < 1 ? -n / 2 * (Math.sqrt(1 - t * t) - 1) + e : n / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + e;
276
+ },
277
+ easeInElastic: function(t, e, i, r) {
278
+ var n = i - e, c, l, m;
279
+ return m = 1.70158, l = 0, c = n, t === 0 ? e : (t /= r) === 1 ? e + n : (l || (l = r * 0.3), c < Math.abs(n) ? (c = n, m = l / 4) : m = l / (2 * Math.PI) * Math.asin(n / c), -(c * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * r - m) * (2 * Math.PI) / l)) + e);
280
+ },
281
+ easeOutElastic: function(t, e, i, r) {
282
+ var n = i - e, c, l, m;
283
+ return m = 1.70158, l = 0, c = n, t === 0 ? e : (t /= r) === 1 ? e + n : (l || (l = r * 0.3), c < Math.abs(n) ? (c = n, m = l / 4) : m = l / (2 * Math.PI) * Math.asin(n / c), c * Math.pow(2, -10 * t) * Math.sin((t * r - m) * (2 * Math.PI) / l) + n + e);
284
+ },
285
+ easeInOutElastic: function(t, e, i, r) {
286
+ var n = i - e, c, l, m;
287
+ return m = 1.70158, l = 0, c = n, t === 0 ? e : (t /= r / 2) === 2 ? e + n : (l || (l = r * (0.3 * 1.5)), c < Math.abs(n) ? (c = n, m = l / 4) : m = l / (2 * Math.PI) * Math.asin(n / c), t < 1 ? -0.5 * (c * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * r - m) * (2 * Math.PI) / l)) + e : c * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * r - m) * (2 * Math.PI) / l) * 0.5 + n + e);
288
+ },
289
+ easeInBack: function(t, e, i, r, n) {
290
+ var c = i - e;
291
+ return n === void 0 && (n = 1.70158), c * (t /= r) * t * ((n + 1) * t - n) + e;
292
+ },
293
+ easeOutBack: function(t, e, i, r, n) {
294
+ var c = i - e;
295
+ return n === void 0 && (n = 1.70158), c * ((t = t / r - 1) * t * ((n + 1) * t + n) + 1) + e;
296
+ },
297
+ easeInOutBack: function(t, e, i, r, n) {
298
+ var c = i - e;
299
+ return n === void 0 && (n = 1.70158), (t /= r / 2) < 1 ? c / 2 * (t * t * (((n *= 1.525) + 1) * t - n)) + e : c / 2 * ((t -= 2) * t * (((n *= 1.525) + 1) * t + n) + 2) + e;
300
+ },
301
+ easeInBounce: function(t, e, i, r) {
302
+ var n = i - e, c;
303
+ return c = o.easeOutBounce(r - t, 0, n, r), n - c + e;
304
+ },
305
+ easeOutBounce: function(t, e, i, r) {
306
+ var n = i - e;
307
+ return (t /= r) < 1 / 2.75 ? n * (7.5625 * t * t) + e : t < 2 / 2.75 ? n * (7.5625 * (t -= 1.5 / 2.75) * t + 0.75) + e : t < 2.5 / 2.75 ? n * (7.5625 * (t -= 2.25 / 2.75) * t + 0.9375) + e : n * (7.5625 * (t -= 2.625 / 2.75) * t + 0.984375) + e;
308
+ },
309
+ easeInOutBounce: function(t, e, i, r) {
310
+ var n = i - e, c;
311
+ return t < r / 2 ? (c = o.easeInBounce(t * 2, 0, n, r), c * 0.5 + e) : (c = o.easeOutBounce(t * 2 - r, 0, n, r), c * 0.5 + n * 0.5 + e);
312
+ }
313
+ };
314
+ return Ct = o, Ct;
315
+ }
316
+ var te = Jt();
317
+ function ee(o) {
318
+ return o * Math.PI / 180;
319
+ }
320
+ function q(o, t) {
321
+ return o + Math.random() * (t - o);
322
+ }
323
+ function ne(o, t) {
324
+ return Math.floor(o + Math.random() * (t - o + 1));
325
+ }
326
+ var dt;
327
+ (function(o) {
328
+ o[o.Circle = 0] = "Circle", o[o.Square = 1] = "Square", o[o.Strip = 2] = "Strip";
329
+ })(dt || (dt = {}));
330
+ var H;
331
+ (function(o) {
332
+ o[o.Positive = 1] = "Positive", o[o.Negative = -1] = "Negative";
333
+ })(H || (H = {}));
334
+ const re = 1e3 / 60;
335
+ class ie {
336
+ constructor(t, e, i, r) {
337
+ this.getOptions = e;
338
+ const { colors: n, initialVelocityX: c, initialVelocityY: l } = this.getOptions();
339
+ this.context = t, this.x = i, this.y = r, this.w = q(5, 20), this.h = q(5, 20), this.radius = q(5, 10), this.vx = typeof c == "number" ? q(-c, c) : q(c.min, c.max), this.vy = typeof l == "number" ? q(-l, 0) : q(l.min, l.max), this.shape = ne(0, 2), this.angle = ee(q(0, 360)), this.angularSpin = q(-0.2, 0.2), this.color = n[Math.floor(Math.random() * n.length)], this.rotateY = q(0, 1), this.rotationDirection = q(0, 1) ? H.Positive : H.Negative;
340
+ }
341
+ update(t) {
342
+ const { gravity: e, wind: i, friction: r, opacity: n, drawShape: c } = this.getOptions(), l = t / re;
343
+ this.x += this.vx * l, this.y += this.vy * l, this.vy += e * l, this.vx += i * l, this.vx *= r ** l, this.vy *= r ** l, this.rotateY >= 1 && this.rotationDirection === H.Positive ? this.rotationDirection = H.Negative : this.rotateY <= -1 && this.rotationDirection === H.Negative && (this.rotationDirection = H.Positive);
344
+ const m = 0.1 * this.rotationDirection * l;
345
+ if (this.rotateY += m, this.angle += this.angularSpin, this.context.save(), this.context.translate(this.x, this.y), this.context.rotate(this.angle), this.context.scale(1, this.rotateY), this.context.rotate(this.angle), this.context.beginPath(), this.context.fillStyle = this.color, this.context.strokeStyle = this.color, this.context.globalAlpha = n, this.context.lineCap = "round", this.context.lineWidth = 2, c && typeof c == "function")
346
+ c.call(this, this.context);
347
+ else
348
+ switch (this.shape) {
349
+ case dt.Circle: {
350
+ this.context.beginPath(), this.context.arc(0, 0, this.radius, 0, 2 * Math.PI), this.context.fill();
351
+ break;
352
+ }
353
+ case dt.Square: {
354
+ this.context.fillRect(-this.w / 2, -this.h / 2, this.w, this.h);
355
+ break;
356
+ }
357
+ case dt.Strip: {
358
+ this.context.fillRect(-this.w / 6, -this.h / 2, this.w / 3, this.h);
359
+ break;
360
+ }
361
+ }
362
+ this.context.closePath(), this.context.restore();
363
+ }
364
+ }
365
+ class ae {
366
+ constructor(t, e) {
367
+ this.x = 0, this.y = 0, this.w = 0, this.h = 0, this.lastNumberOfPieces = 0, this.tweenProgress = 0, this.tweenFrom = 0, this.particles = [], this.particlesGenerated = 0, this.removeParticleAt = (r) => {
368
+ this.particles.splice(r, 1);
369
+ }, this.getParticle = () => {
370
+ const r = q(this.x, this.w + this.x), n = q(this.y, this.h + this.y);
371
+ return new ie(this.context, this.getOptions, r, n);
372
+ }, this.animate = (r) => {
373
+ const { canvas: n, context: c, particlesGenerated: l, lastNumberOfPieces: m } = this, { run: k, recycle: N, numberOfPieces: R, debug: w, tweenFunction: $, tweenDuration: j } = this.getOptions();
374
+ if (!k)
375
+ return !1;
376
+ const U = this.particles.length, S = N ? U : l;
377
+ if (S < R) {
378
+ m !== R && (this.tweenProgress = 0, this.tweenFrom = S, this.lastNumberOfPieces = R), this.tweenProgress = Math.min(j, Math.max(0, this.tweenProgress + r));
379
+ const F = $(this.tweenProgress, this.tweenFrom, R, j), b = Math.round(F - S);
380
+ for (let Q = 0; Q < b; Q++)
381
+ this.particles.push(this.getParticle());
382
+ this.particlesGenerated += b;
383
+ }
384
+ w && (c.font = "12px sans-serif", c.fillStyle = "#333", c.textAlign = "right", c.fillText(`Particles: ${U}`, n.width - 10, n.height - 20));
385
+ for (let F = this.particles.length - 1; F >= 0; F--) {
386
+ const b = this.particles[F];
387
+ b.update(r), (b.y > n.height || b.y < -100 || b.x > n.width + 100 || b.x < -100) && (N && S <= R ? this.particles[F] = this.getParticle() : this.removeParticleAt(F));
388
+ }
389
+ return U > 0 || S < R;
390
+ }, this.canvas = t;
391
+ const i = this.canvas.getContext("2d");
392
+ if (!i)
393
+ throw new Error("Could not get canvas context");
394
+ this.context = i, this.getOptions = e;
395
+ }
396
+ }
397
+ const St = {
398
+ width: typeof window < "u" ? window.innerWidth : 300,
399
+ height: typeof window < "u" ? window.innerHeight : 200,
400
+ numberOfPieces: 200,
401
+ friction: 0.99,
402
+ wind: 0,
403
+ gravity: 0.1,
404
+ initialVelocityX: 4,
405
+ initialVelocityY: 10,
406
+ colors: [
407
+ "#f44336",
408
+ "#e91e63",
409
+ "#9c27b0",
410
+ "#673ab7",
411
+ "#3f51b5",
412
+ "#2196f3",
413
+ "#03a9f4",
414
+ "#00bcd4",
415
+ "#009688",
416
+ "#4CAF50",
417
+ "#8BC34A",
418
+ "#CDDC39",
419
+ "#FFEB3B",
420
+ "#FFC107",
421
+ "#FF9800",
422
+ "#FF5722",
423
+ "#795548"
424
+ ],
425
+ opacity: 1,
426
+ debug: !1,
427
+ tweenFunction: te.easeInOutQuad,
428
+ tweenDuration: 5e3,
429
+ recycle: !0,
430
+ run: !0
431
+ };
432
+ class oe {
433
+ constructor(t, e) {
434
+ this.lastFrameTime = 0, this.setOptionsWithDefaults = (r) => {
435
+ const n = {
436
+ confettiSource: {
437
+ x: 0,
438
+ y: 0,
439
+ w: this.canvas.width,
440
+ h: 0
441
+ }
442
+ };
443
+ this._options = {
444
+ ...n,
445
+ ...St,
446
+ ...r
447
+ }, Object.assign(this, r.confettiSource);
448
+ }, this.update = (r = 0) => {
449
+ const { options: { run: n, onConfettiComplete: c, frameRate: l }, canvas: m, context: k } = this, N = Math.min(r - this.lastFrameTime, 50);
450
+ if (l && N < 1e3 / l) {
451
+ this.rafId = requestAnimationFrame(this.update);
452
+ return;
453
+ }
454
+ this.lastFrameTime = r - (l ? N % l : 0), n && (k.fillStyle = "white", k.clearRect(0, 0, m.width, m.height)), this.generator.animate(N) ? this.rafId = requestAnimationFrame(this.update) : (c && typeof c == "function" && this.generator.particlesGenerated > 0 && c.call(this, this), this._options.run = !1);
455
+ }, this.reset = () => {
456
+ this.generator && this.generator.particlesGenerated > 0 && (this.generator.particlesGenerated = 0, this.generator.particles = [], this.generator.lastNumberOfPieces = 0);
457
+ }, this.stop = () => {
458
+ this.options = { run: !1 }, this.rafId && (cancelAnimationFrame(this.rafId), this.rafId = void 0);
459
+ }, this.canvas = t;
460
+ const i = this.canvas.getContext("2d");
461
+ if (!i)
462
+ throw new Error("Could not get canvas context");
463
+ this.context = i, this.generator = new ae(this.canvas, () => this.options), this.options = e, this.update();
464
+ }
465
+ get options() {
466
+ return this._options;
467
+ }
468
+ set options(t) {
469
+ var r, n;
470
+ const e = (r = this._options) == null ? void 0 : r.run, i = (n = this._options) == null ? void 0 : n.recycle;
471
+ this.setOptionsWithDefaults(t), this.generator && (Object.assign(this.generator, this.options.confettiSource), typeof t.recycle == "boolean" && t.recycle && i === !1 && (this.generator.lastNumberOfPieces = this.generator.particles.length)), typeof t.run == "boolean" && t.run && e === !1 && this.update();
472
+ }
473
+ }
474
+ const se = wt.createRef();
475
+ class Pt extends wt.Component {
476
+ constructor(t) {
477
+ super(t), this.canvas = wt.createRef(), this.canvas = t.canvasRef || se;
478
+ }
479
+ componentDidMount() {
480
+ if (this.canvas.current) {
481
+ const t = Bt(this.props)[0];
482
+ this.confetti = new oe(this.canvas.current, t);
483
+ }
484
+ }
485
+ componentDidUpdate() {
486
+ const t = Bt(this.props)[0];
487
+ this.confetti && (this.confetti.options = t);
488
+ }
489
+ componentWillUnmount() {
490
+ this.confetti && this.confetti.stop(), this.confetti = void 0;
491
+ }
492
+ render() {
493
+ const [t, e] = Bt(this.props), i = {
494
+ zIndex: 2,
495
+ position: "absolute",
496
+ pointerEvents: "none",
497
+ top: 0,
498
+ left: 0,
499
+ bottom: 0,
500
+ right: 0,
501
+ ...e.style
502
+ };
503
+ return d("canvas", { width: t.width, height: t.height, ref: this.canvas, ...e, style: i });
504
+ }
505
+ }
506
+ Pt.defaultProps = {
507
+ ...St
508
+ };
509
+ Pt.displayName = "ReactConfetti";
510
+ function Bt(o) {
511
+ const t = {}, e = {}, i = {}, r = [
512
+ ...Object.keys(St),
513
+ "confettiSource",
514
+ "drawShape",
515
+ "onConfettiComplete",
516
+ "frameRate"
517
+ ], n = ["canvasRef"];
518
+ for (const c in o) {
519
+ const l = o[c];
520
+ r.includes(c) ? t[c] = l : n.includes(c) ? n[c] = l : i[c] = l;
521
+ }
522
+ return [t, i, e];
523
+ }
524
+ const ce = wt.forwardRef((o, t) => d(Pt, { canvasRef: t, ...o }));
184
525
  /**
185
526
  * @license lucide-react v0.515.0 - ISC
186
527
  *
187
528
  * This source code is licensed under the ISC license.
188
529
  * See the LICENSE file in the root directory of this source tree.
189
530
  */
190
- const Re = (o) => o.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Oe = (o) => o.replace(
531
+ const le = (o) => o.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ue = (o) => o.replace(
191
532
  /^([A-Z])|[\s-_]+(\w)/g,
192
- (l, _, m) => m ? m.toUpperCase() : _.toLowerCase()
193
- ), ve = (o) => {
194
- const l = Oe(o);
195
- return l.charAt(0).toUpperCase() + l.slice(1);
196
- }, Ce = (...o) => o.filter((l, _, m) => !!l && l.trim() !== "" && m.indexOf(l) === _).join(" ").trim(), Le = (o) => {
197
- for (const l in o)
198
- if (l.startsWith("aria-") || l === "role" || l === "title")
533
+ (t, e, i) => i ? i.toUpperCase() : e.toLowerCase()
534
+ ), Wt = (o) => {
535
+ const t = ue(o);
536
+ return t.charAt(0).toUpperCase() + t.slice(1);
537
+ }, zt = (...o) => o.filter((t, e, i) => !!t && t.trim() !== "" && i.indexOf(t) === e).join(" ").trim(), he = (o) => {
538
+ for (const t in o)
539
+ if (t.startsWith("aria-") || t === "role" || t === "title")
199
540
  return !0;
200
541
  };
201
542
  /**
@@ -204,7 +545,7 @@ const Re = (o) => o.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Oe = (
204
545
  * This source code is licensed under the ISC license.
205
546
  * See the LICENSE file in the root directory of this source tree.
206
547
  */
207
- var Me = {
548
+ var de = {
208
549
  xmlns: "http://www.w3.org/2000/svg",
209
550
  width: 24,
210
551
  height: 24,
@@ -221,32 +562,32 @@ var Me = {
221
562
  * This source code is licensed under the ISC license.
222
563
  * See the LICENSE file in the root directory of this source tree.
223
564
  */
224
- const qe = Be(
565
+ const fe = Et(
225
566
  ({
226
567
  color: o = "currentColor",
227
- size: l = 24,
228
- strokeWidth: _ = 2,
229
- absoluteStrokeWidth: m,
230
- className: I = "",
231
- children: h,
232
- iconNode: E,
233
- ...x
234
- }, S) => ye(
568
+ size: t = 24,
569
+ strokeWidth: e = 2,
570
+ absoluteStrokeWidth: i,
571
+ className: r = "",
572
+ children: n,
573
+ iconNode: c,
574
+ ...l
575
+ }, m) => Tt(
235
576
  "svg",
236
577
  {
237
- ref: S,
238
- ...Me,
239
- width: l,
240
- height: l,
578
+ ref: m,
579
+ ...de,
580
+ width: t,
581
+ height: t,
241
582
  stroke: o,
242
- strokeWidth: m ? Number(_) * 24 / Number(l) : _,
243
- className: Ce("lucide", I),
244
- ...!h && !Le(x) && { "aria-hidden": "true" },
245
- ...x
583
+ strokeWidth: i ? Number(e) * 24 / Number(t) : e,
584
+ className: zt("lucide", r),
585
+ ...!n && !he(l) && { "aria-hidden": "true" },
586
+ ...l
246
587
  },
247
588
  [
248
- ...E.map(([M, q]) => ye(M, q)),
249
- ...Array.isArray(h) ? h : [h]
589
+ ...c.map(([k, N]) => Tt(k, N)),
590
+ ...Array.isArray(n) ? n : [n]
250
591
  ]
251
592
  )
252
593
  );
@@ -256,20 +597,20 @@ const qe = Be(
256
597
  * This source code is licensed under the ISC license.
257
598
  * See the LICENSE file in the root directory of this source tree.
258
599
  */
259
- const Ae = (o, l) => {
260
- const _ = Be(
261
- ({ className: m, ...I }, h) => ye(qe, {
262
- ref: h,
263
- iconNode: l,
264
- className: Ce(
265
- `lucide-${Re(ve(o))}`,
600
+ const me = (o, t) => {
601
+ const e = Et(
602
+ ({ className: i, ...r }, n) => Tt(fe, {
603
+ ref: n,
604
+ iconNode: t,
605
+ className: zt(
606
+ `lucide-${le(Wt(o))}`,
266
607
  `lucide-${o}`,
267
- m
608
+ i
268
609
  ),
269
- ...I
610
+ ...r
270
611
  })
271
612
  );
272
- return _.displayName = ve(o), _;
613
+ return e.displayName = Wt(o), e;
273
614
  };
274
615
  /**
275
616
  * @license lucide-react v0.515.0 - ISC
@@ -277,413 +618,466 @@ const Ae = (o, l) => {
277
618
  * This source code is licensed under the ISC license.
278
619
  * See the LICENSE file in the root directory of this source tree.
279
620
  */
280
- const $e = [
621
+ const pe = [
281
622
  ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
282
623
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
283
- ], We = Ae("search", $e), Ve = "_backdrop_1ctfr_1", De = "_backdropOpen_1ctfr_14", je = "_backdropClosed_1ctfr_18", ze = "_panel_1ctfr_22", Ue = "_panelOpen_1ctfr_42", Ee = "_panelClosed_1ctfr_46", Qe = "_header_1ctfr_81", He = "_headerCenter_1ctfr_90", Ke = "_title_1ctfr_98", Ze = "_searchIconButton_1ctfr_107", Ge = "_headerTitleWrap_1ctfr_129", Je = "_headerSearchWrap_1ctfr_133", Xe = "_headerSearchOpen_1ctfr_145", Ye = "_searchBar_1ctfr_157", et = "_searchInput_1ctfr_169", tt = "_searchClearButton_1ctfr_190", nt = "_closeButton_1ctfr_212", rt = "_body_1ctfr_245", at = "_muted_1ctfr_250", ot = "_error_1ctfr_255", lt = "_variants_1ctfr_260", ct = "_variantList_1ctfr_264", st = "_variantRow_1ctfr_272", it = "_variantLeft_1ctfr_280", ut = "_addToBundleButton_1ctfr_287", dt = "_variantThumb_1ctfr_315", mt = "_variantThumbImg_1ctfr_325", ht = "_variantThumbFallback_1ctfr_332", bt = "_variantInfo_1ctfr_342", ft = "_variantName_1ctfr_346", _t = "_variantMeta_1ctfr_355", pt = "_variantPriceRow_1ctfr_363", yt = "_variantCompareAt_1ctfr_370", xt = "_variantPrice_1ctfr_363", gt = "_qtyControls_1ctfr_381", vt = "_qtyButton_1ctfr_387", Bt = "_qtyValue_1ctfr_412", Nt = "_footer_1ctfr_419", Ct = "_boxSummaryWindow_1ctfr_426", Tt = "_boxSummaryRow_1ctfr_443", It = "_boxSlot_1ctfr_451", wt = "_boxItem_1ctfr_459", St = "_boxItemClickable_1ctfr_471", kt = "_boxThresholdLabel_1ctfr_480", Ft = "_boxItemPlaceholder_1ctfr_491", Pt = "_boxItemFilled_1ctfr_497", Rt = "_boxItemThreshold_1ctfr_503", Ot = "_boxItemDiscountText_1ctfr_511", Lt = "_boxItemPlus_1ctfr_519", Mt = "_boxItemImage_1ctfr_526", qt = "_boxItemFallback_1ctfr_533", At = "_cta_1ctfr_544", $t = "_ctaTotals_1ctfr_556", Wt = "_ctaDiscountBadge_1ctfr_564", Vt = "_ctaTotalsWrap_1ctfr_578", Dt = "_ctaTotalsWrapVisible_1ctfr_591", jt = "_ctaTotalsStrike_1ctfr_598", zt = "_ctaTotalsPrice_1ctfr_605", n = {
284
- backdrop: Ve,
285
- backdropOpen: De,
286
- backdropClosed: je,
287
- panel: ze,
288
- panelOpen: Ue,
289
- panelClosed: Ee,
290
- header: Qe,
291
- headerCenter: He,
292
- title: Ke,
293
- searchIconButton: Ze,
294
- headerTitleWrap: Ge,
295
- headerSearchWrap: Je,
296
- headerSearchOpen: Xe,
297
- searchBar: Ye,
298
- searchInput: et,
299
- searchClearButton: tt,
300
- closeButton: nt,
301
- body: rt,
302
- muted: at,
303
- error: ot,
304
- variants: lt,
305
- variantList: ct,
306
- variantRow: st,
307
- variantLeft: it,
308
- addToBundleButton: ut,
309
- variantThumb: dt,
310
- variantThumbImg: mt,
311
- variantThumbFallback: ht,
312
- variantInfo: bt,
313
- variantName: ft,
314
- variantMeta: _t,
315
- variantPriceRow: pt,
316
- variantCompareAt: yt,
317
- variantPrice: xt,
318
- qtyControls: gt,
319
- qtyButton: vt,
320
- qtyValue: Bt,
321
- footer: Nt,
322
- boxSummaryWindow: Ct,
323
- boxSummaryRow: Tt,
324
- boxSlot: It,
325
- boxItem: wt,
326
- boxItemClickable: St,
327
- boxThresholdLabel: kt,
328
- boxItemPlaceholder: Ft,
329
- boxItemFilled: Pt,
330
- boxItemThreshold: Rt,
331
- boxItemDiscountText: Ot,
332
- boxItemPlus: Lt,
333
- boxItemImage: Mt,
334
- boxItemFallback: qt,
335
- cta: At,
336
- ctaTotals: $t,
337
- ctaDiscountBadge: Wt,
338
- ctaTotalsWrap: Vt,
339
- ctaTotalsWrapVisible: Dt,
340
- ctaTotalsStrike: jt,
341
- ctaTotalsPrice: zt
624
+ ], be = me("search", pe), _e = "_backdrop_1ctfr_1", ve = "_backdropOpen_1ctfr_14", ge = "_backdropClosed_1ctfr_18", we = "_panel_1ctfr_22", ye = "_panelOpen_1ctfr_42", xe = "_panelClosed_1ctfr_46", Ie = "_header_1ctfr_81", Ce = "_headerCenter_1ctfr_90", Be = "_title_1ctfr_98", Te = "_searchIconButton_1ctfr_107", Ne = "_headerTitleWrap_1ctfr_129", Se = "_headerSearchWrap_1ctfr_133", Pe = "_headerSearchOpen_1ctfr_145", Me = "_searchBar_1ctfr_157", Oe = "_searchInput_1ctfr_169", ke = "_searchClearButton_1ctfr_190", Fe = "_closeButton_1ctfr_212", Re = "_body_1ctfr_245", Ae = "_muted_1ctfr_250", qe = "_error_1ctfr_255", De = "_variants_1ctfr_260", Le = "_variantList_1ctfr_264", We = "_variantRow_1ctfr_272", Ee = "_variantLeft_1ctfr_280", Ve = "_addToBundleButton_1ctfr_287", ze = "_variantThumb_1ctfr_315", $e = "_variantThumbImg_1ctfr_325", je = "_variantThumbFallback_1ctfr_332", Ue = "_variantInfo_1ctfr_342", Qe = "_variantName_1ctfr_346", Ye = "_variantMeta_1ctfr_355", Ge = "_variantPriceRow_1ctfr_363", He = "_variantCompareAt_1ctfr_370", Ke = "_variantPrice_1ctfr_363", Xe = "_qtyControls_1ctfr_381", Ze = "_qtyButton_1ctfr_387", Je = "_qtyValue_1ctfr_412", tn = "_footer_1ctfr_419", en = "_boxSummaryWindow_1ctfr_426", nn = "_boxSummaryRow_1ctfr_443", rn = "_boxSlot_1ctfr_451", an = "_boxItem_1ctfr_459", on = "_boxItemClickable_1ctfr_471", sn = "_boxThresholdLabel_1ctfr_480", cn = "_boxItemPlaceholder_1ctfr_491", ln = "_boxItemFilled_1ctfr_497", un = "_boxItemThreshold_1ctfr_503", hn = "_boxItemDiscountText_1ctfr_511", dn = "_boxItemPlus_1ctfr_519", fn = "_boxItemImage_1ctfr_526", mn = "_boxItemFallback_1ctfr_533", pn = "_cta_1ctfr_544", bn = "_ctaTotals_1ctfr_556", _n = "_ctaDiscountBadge_1ctfr_564", vn = "_ctaTotalsWrap_1ctfr_578", gn = "_ctaTotalsWrapVisible_1ctfr_591", wn = "_ctaTotalsStrike_1ctfr_598", yn = "_ctaTotalsPrice_1ctfr_605", u = {
625
+ backdrop: _e,
626
+ backdropOpen: ve,
627
+ backdropClosed: ge,
628
+ panel: we,
629
+ panelOpen: ye,
630
+ panelClosed: xe,
631
+ header: Ie,
632
+ headerCenter: Ce,
633
+ title: Be,
634
+ searchIconButton: Te,
635
+ headerTitleWrap: Ne,
636
+ headerSearchWrap: Se,
637
+ headerSearchOpen: Pe,
638
+ searchBar: Me,
639
+ searchInput: Oe,
640
+ searchClearButton: ke,
641
+ closeButton: Fe,
642
+ body: Re,
643
+ muted: Ae,
644
+ error: qe,
645
+ variants: De,
646
+ variantList: Le,
647
+ variantRow: We,
648
+ variantLeft: Ee,
649
+ addToBundleButton: Ve,
650
+ variantThumb: ze,
651
+ variantThumbImg: $e,
652
+ variantThumbFallback: je,
653
+ variantInfo: Ue,
654
+ variantName: Qe,
655
+ variantMeta: Ye,
656
+ variantPriceRow: Ge,
657
+ variantCompareAt: He,
658
+ variantPrice: Ke,
659
+ qtyControls: Xe,
660
+ qtyButton: Ze,
661
+ qtyValue: Je,
662
+ footer: tn,
663
+ boxSummaryWindow: en,
664
+ boxSummaryRow: nn,
665
+ boxSlot: rn,
666
+ boxItem: an,
667
+ boxItemClickable: on,
668
+ boxThresholdLabel: sn,
669
+ boxItemPlaceholder: cn,
670
+ boxItemFilled: ln,
671
+ boxItemThreshold: un,
672
+ boxItemDiscountText: hn,
673
+ boxItemPlus: dn,
674
+ boxItemImage: fn,
675
+ boxItemFallback: mn,
676
+ cta: pn,
677
+ ctaTotals: bn,
678
+ ctaDiscountBadge: _n,
679
+ ctaTotalsWrap: vn,
680
+ ctaTotalsWrapVisible: gn,
681
+ ctaTotalsStrike: wn,
682
+ ctaTotalsPrice: yn
342
683
  };
343
- function Zt(o) {
344
- var ue;
684
+ function Nn(o) {
685
+ var qt;
345
686
  const {
346
- isOpen: l,
347
- close: _,
348
- loading: m,
349
- submitting: I,
350
- error: h,
351
- currencyCode: E,
352
- config: x,
353
- eligibleVariants: S,
354
- selections: M,
355
- selectionOrder: q,
356
- setQuantity: J,
357
- bundleSize: g,
358
- minRequired: Q,
359
- canSubmit: X,
360
- submit: le
361
- } = xe(), [P, Y] = F(!1), [f, ee] = F(""), te = Z(null), ne = (e) => {
362
- const t = (e ?? []).filter((a) => {
363
- var b, u;
364
- const i = (b = a == null ? void 0 : a.name) == null ? void 0 : b.trim(), c = (u = a == null ? void 0 : a.value) == null ? void 0 : u.trim();
365
- return !(!i || !c || i.toLowerCase() === "title");
687
+ isOpen: t,
688
+ close: e,
689
+ loading: i,
690
+ submitting: r,
691
+ error: n,
692
+ currencyCode: c,
693
+ config: l,
694
+ eligibleVariants: m,
695
+ selections: k,
696
+ selectionOrder: N,
697
+ setQuantity: R,
698
+ bundleSize: w,
699
+ minRequired: $,
700
+ canSubmit: j,
701
+ submit: U
702
+ } = Nt(), [S, F] = O(!1), [b, Q] = O(""), rt = V(null), it = V(null), [K, ft] = O(() => typeof window > "u" ? { width: 0, height: 0 } : { width: window.innerWidth, height: window.innerHeight }), [mt, pt] = O(0), [X, bt] = O(null), [_t, Z] = O(!1), A = V(null), ct = V(w), at = 7e3, J = (a) => {
703
+ const s = (a ?? []).filter((h) => {
704
+ var v, _;
705
+ const p = (v = h == null ? void 0 : h.name) == null ? void 0 : v.trim(), f = (_ = h == null ? void 0 : h.value) == null ? void 0 : _.trim();
706
+ return !(!p || !f || p.toLowerCase() === "title");
366
707
  });
367
- return t.length ? t.map((a) => `${a.name}: ${a.value}`).join(" · ") : null;
368
- }, ce = (e) => {
369
- var t;
370
- return ((t = e.product) == null ? void 0 : t.title) ?? e.displayName ?? e.title;
371
- }, me = (e) => {
372
- const t = ce(e), a = ne(e.selectedOptions);
373
- return [t, a].filter(Boolean).join(" — ");
374
- }, [he, se] = F(l), w = Z(null), $ = (e) => {
375
- const t = Number(e);
376
- if (!Number.isFinite(t)) return e;
377
- if (E)
708
+ return s.length ? s.map((h) => `${h.name}: ${h.value}`).join(" · ") : null;
709
+ }, tt = (a) => {
710
+ var s;
711
+ return ((s = a.product) == null ? void 0 : s.title) ?? a.displayName ?? a.title;
712
+ }, vt = (a) => {
713
+ const s = tt(a), h = J(a.selectedOptions);
714
+ return [s, h].filter(Boolean).join(" — ");
715
+ }, [yt, y] = O(t), x = V(null), C = (a) => {
716
+ const s = Number(a);
717
+ if (!Number.isFinite(s)) return a;
718
+ if (c)
378
719
  try {
379
- return new Intl.NumberFormat(void 0, { style: "currency", currency: E }).format(t);
720
+ return new Intl.NumberFormat(void 0, { style: "currency", currency: c }).format(s);
380
721
  } catch {
381
722
  }
382
- return `$${t.toFixed(2)}`;
383
- }, be = ((ue = x == null ? void 0 : x.title) == null ? void 0 : ue.trim()) || "Build your bundle", W = y(() => [...S].sort((e, t) => e.displayName.localeCompare(t.displayName)), [S]), V = y(() => {
384
- const e = f.trim().toLowerCase();
385
- if (!e) return W;
386
- const t = e.split(/\s+/).filter(Boolean), a = (i) => {
387
- var u;
388
- const c = [];
389
- c.push(i.displayName), (u = i.product) != null && u.title && c.push(i.product.title);
390
- for (const p of i.selectedOptions ?? [])
391
- c.push(p.name), c.push(p.value);
392
- const b = c.join(" ").toLowerCase();
393
- return t.every((p) => b.includes(p));
723
+ return `$${s.toFixed(2)}`;
724
+ }, g = ((qt = l == null ? void 0 : l.title) == null ? void 0 : qt.trim()) || "Build your bundle", M = T(() => [...m].sort((a, s) => a.displayName.localeCompare(s.displayName)), [m]), G = T(() => {
725
+ const a = b.trim().toLowerCase();
726
+ if (!a) return M;
727
+ const s = a.split(/\s+/).filter(Boolean), h = (p) => {
728
+ var _;
729
+ const f = [];
730
+ f.push(p.displayName), (_ = p.product) != null && _.title && f.push(p.product.title);
731
+ for (const B of p.selectedOptions ?? [])
732
+ f.push(B.name), f.push(B.value);
733
+ const v = f.join(" ").toLowerCase();
734
+ return s.every((B) => v.includes(B));
394
735
  };
395
- return W.filter(a);
396
- }, [f, W]), v = y(() => [...(x == null ? void 0 : x.rules) ?? []].sort((e, t) => e.minBundleSize - t.minBundleSize), [x == null ? void 0 : x.rules]), R = y(() => Math.max(0, Q - g), [g, Q]), D = y(() => {
397
- let e = null;
398
- for (const t of v)
399
- g >= t.minBundleSize && (e = t);
400
- return e;
401
- }, [g, v]), k = y(() => {
402
- if (!D) return null;
403
- const e = Number.parseFloat(D.discountPercent);
404
- return !Number.isFinite(e) || e <= 0 ? null : e;
405
- }, [D]), fe = y(() => {
406
- const e = v[0];
407
- if (!e) return null;
408
- const t = Number.parseFloat(e.discountPercent);
409
- return !Number.isFinite(t) || t <= 0 ? null : t;
410
- }, [v]), ie = k ?? fe, d = y(() => {
411
- const e = new Map(S.map((a) => [a.id, a]));
412
- let t = 0;
413
- for (const [a, i] of Object.entries(M)) {
414
- const c = i ?? 0;
415
- if (c <= 0) continue;
416
- const b = e.get(a), u = Number(b == null ? void 0 : b.price);
417
- Number.isFinite(u) && (t += u * c);
736
+ return M.filter(h);
737
+ }, [b, M]), I = T(() => [...(l == null ? void 0 : l.rules) ?? []].sort((a, s) => a.minBundleSize - s.minBundleSize), [l == null ? void 0 : l.rules]), L = T(() => Math.max(0, $ - w), [w, $]), et = T(() => {
738
+ let a = null;
739
+ for (const s of I)
740
+ w >= s.minBundleSize && (a = s);
741
+ return a;
742
+ }, [w, I]), D = T(() => {
743
+ if (!et) return null;
744
+ const a = Number.parseFloat(et.discountPercent);
745
+ return !Number.isFinite(a) || a <= 0 ? null : a;
746
+ }, [et]), lt = T(() => {
747
+ const a = I[0];
748
+ if (!a) return null;
749
+ const s = Number.parseFloat(a.discountPercent);
750
+ return !Number.isFinite(s) || s <= 0 ? null : s;
751
+ }, [I]), ot = D ?? lt, ut = T(() => {
752
+ const a = new Map(m.map((h) => [h.id, h]));
753
+ let s = 0;
754
+ for (const [h, p] of Object.entries(k)) {
755
+ const f = p ?? 0;
756
+ if (f <= 0) continue;
757
+ const v = a.get(h), _ = Number(v == null ? void 0 : v.price);
758
+ Number.isFinite(_) && (s += _ * f);
418
759
  }
419
- return Math.round(t * 100) / 100;
420
- }, [S, M]), C = y(() => {
421
- if (!k) return d;
422
- const e = d * (1 - k / 100);
423
- return Math.round(e * 100) / 100;
424
- }, [k, d]), B = y(() => v.length ? Math.max(...v.map((e) => e.minBundleSize)) : 0, [v]), s = y(() => {
425
- const e = new Map(S.map((t) => [t.id, t]));
426
- return q.map((t) => e.get(t)).filter((t) => !!t);
427
- }, [S, q]), T = y(() => {
428
- var t;
429
- const e = /* @__PURE__ */ new Map();
430
- for (const a of v) {
431
- const i = Math.max(0, a.minBundleSize - 1);
432
- e.set(i, {
433
- discountPercent: a.discountPercent,
434
- minBundleSize: a.minBundleSize,
435
- label: ((t = a.label) == null ? void 0 : t.trim()) || `Buy ${a.minBundleSize}+`
760
+ return Math.round(s * 100) / 100;
761
+ }, [m, k]), $t = T(() => {
762
+ if (!D) return ut;
763
+ const a = ut * (1 - D / 100);
764
+ return Math.round(a * 100) / 100;
765
+ }, [D, ut]), Mt = T(() => I.length ? Math.max(...I.map((a) => a.minBundleSize)) : 0, [I]), xt = T(() => {
766
+ const a = new Map(m.map((s) => [s.id, s]));
767
+ return N.map((s) => a.get(s)).filter((s) => !!s);
768
+ }, [m, N]), jt = T(() => {
769
+ var s;
770
+ const a = /* @__PURE__ */ new Map();
771
+ for (const h of I) {
772
+ const p = Math.max(0, h.minBundleSize - 1);
773
+ a.set(p, {
774
+ discountPercent: h.discountPercent,
775
+ minBundleSize: h.minBundleSize,
776
+ label: ((s = h.label) == null ? void 0 : s.trim()) || `Buy ${h.minBundleSize}+`
436
777
  });
437
778
  }
438
- return e;
439
- }, [v]), j = y(() => Math.max(B || Q, s.length), [s.length, B, Q]), z = Z(null), H = Z(null), re = Z(null), U = Z(g), ae = (e) => {
440
- const t = H.current;
441
- if (!t) return;
442
- const a = t.querySelector(`[data-variant-row="${e}"]`);
443
- if (!a) return;
444
- const i = t.getBoundingClientRect(), c = a.getBoundingClientRect(), b = 8;
445
- if (c.top >= i.top + b && c.bottom <= i.bottom - b) return;
446
- const p = Math.max(0, t.scrollHeight - t.clientHeight), O = c.top - i.top + c.height / 2, L = t.scrollTop + O - t.clientHeight / 2, A = Math.min(p, Math.max(0, L));
447
- t.scrollTo({ top: A, behavior: "smooth" });
779
+ return a;
780
+ }, [I]), Ut = T(() => Math.max(Mt || $, xt.length), [xt.length, Mt, $]), Ot = V(null), kt = V(null), Ft = V(null), Rt = V(w), At = (a) => {
781
+ const s = kt.current;
782
+ if (!s) return;
783
+ const h = s.querySelector(`[data-variant-row="${a}"]`);
784
+ if (!h) return;
785
+ const p = s.getBoundingClientRect(), f = h.getBoundingClientRect(), v = 8;
786
+ if (f.top >= p.top + v && f.bottom <= p.bottom - v) return;
787
+ const B = Math.max(0, s.scrollHeight - s.clientHeight), W = f.top - p.top + f.height / 2, E = s.scrollTop + W - s.clientHeight / 2, Y = Math.min(B, Math.max(0, E));
788
+ s.scrollTo({ top: Y, behavior: "smooth" });
448
789
  };
449
- return G(() => {
450
- if (!l) return;
451
- const e = (t) => {
452
- t.key === "Escape" && _();
790
+ return z(() => {
791
+ if (!t) return;
792
+ const a = (s) => {
793
+ s.key === "Escape" && e();
453
794
  };
454
- return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
455
- }, [_, l]), G(() => {
456
- if (w.current != null && (window.clearTimeout(w.current), w.current = null), l) {
457
- se(!0);
795
+ return window.addEventListener("keydown", a), () => window.removeEventListener("keydown", a);
796
+ }, [e, t]), z(() => {
797
+ if (typeof window > "u") return;
798
+ const a = () => ft({ width: window.innerWidth, height: window.innerHeight });
799
+ return a(), window.addEventListener("resize", a), () => window.removeEventListener("resize", a);
800
+ }, []), z(() => {
801
+ if (x.current != null && (window.clearTimeout(x.current), x.current = null), t) {
802
+ y(!0);
458
803
  return;
459
804
  }
460
- w.current = window.setTimeout(() => {
461
- se(!1), w.current = null;
805
+ x.current = window.setTimeout(() => {
806
+ y(!1), x.current = null;
462
807
  }, 220);
463
- }, [l]), G(() => () => {
464
- w.current != null && window.clearTimeout(w.current);
465
- }, []), G(() => {
466
- if (!l || !P) return;
467
- const e = requestAnimationFrame(() => {
468
- var t;
469
- return (t = te.current) == null ? void 0 : t.focus();
808
+ }, [t]), z(() => () => {
809
+ x.current != null && window.clearTimeout(x.current);
810
+ }, []), z(() => () => {
811
+ A.current != null && window.clearTimeout(A.current);
812
+ }, []), z(() => {
813
+ if (!t || !S) return;
814
+ const a = requestAnimationFrame(() => {
815
+ var s;
816
+ return (s = rt.current) == null ? void 0 : s.focus();
470
817
  });
471
- return () => cancelAnimationFrame(e);
472
- }, [l, P]), G(() => {
473
- const e = U.current;
474
- if (U.current = g, g <= e) return;
475
- const t = re.current;
476
- if (!t) return;
477
- const a = v.some((u) => u.minBundleSize === g), i = v.find((u) => u.minBundleSize > g), c = i && a ? i.minBundleSize - 1 : i ? null : g - 1;
478
- if (c == null || c < 0) return;
479
- const b = requestAnimationFrame(() => {
480
- const u = t.querySelector(`[data-box-slot="${c}"]`);
481
- if (!u) return;
482
- const p = t.getBoundingClientRect(), L = u.getBoundingClientRect().right - p.right;
483
- if (L <= 1) return;
484
- const A = Math.max(0, t.scrollWidth - t.clientWidth), K = Math.min(A, Math.max(0, t.scrollLeft + L));
485
- t.scrollTo({ left: K, behavior: "smooth" });
818
+ return () => cancelAnimationFrame(a);
819
+ }, [t, S]), z(() => {
820
+ const a = Rt.current;
821
+ if (Rt.current = w, w <= a) return;
822
+ const s = Ft.current;
823
+ if (!s) return;
824
+ const h = I.some((_) => _.minBundleSize === w), p = I.find((_) => _.minBundleSize > w), f = p && h ? p.minBundleSize - 1 : p ? null : w - 1;
825
+ if (f == null || f < 0) return;
826
+ const v = requestAnimationFrame(() => {
827
+ const _ = s.querySelector(`[data-box-slot="${f}"]`);
828
+ if (!_) return;
829
+ const B = s.getBoundingClientRect(), E = _.getBoundingClientRect().right - B.right;
830
+ if (E <= 1) return;
831
+ const Y = Math.max(0, s.scrollWidth - s.clientWidth), nt = Math.min(Y, Math.max(0, s.scrollLeft + E));
832
+ s.scrollTo({ left: nt, behavior: "smooth" });
486
833
  });
487
- return () => cancelAnimationFrame(b);
488
- }, [g, v]), G(() => {
489
- var e;
490
- l && ((e = z.current) == null || e.focus());
491
- }, [l]), he ? /* @__PURE__ */ r(
834
+ return () => cancelAnimationFrame(v);
835
+ }, [w, I]), z(() => {
836
+ if (!t) return;
837
+ const a = ct.current;
838
+ if (ct.current = w, w <= a || !I.some((v) => v.minBundleSize === w)) return;
839
+ const h = it.current;
840
+ if (!h) return;
841
+ const p = h.getBoundingClientRect(), f = {
842
+ x: p.left + p.width / 2 - 2,
843
+ y: p.top + 4,
844
+ w: 4,
845
+ h: 4
846
+ };
847
+ bt(f), pt((v) => v + 1), Z(!0), A.current != null && window.clearTimeout(A.current), A.current = window.setTimeout(() => {
848
+ Z(!1), A.current = null;
849
+ }, at);
850
+ }, [w, t, I]), z(() => {
851
+ var a;
852
+ t && ((a = Ot.current) == null || a.focus());
853
+ }, [t]), yt ? /* @__PURE__ */ P(
492
854
  "div",
493
855
  {
494
856
  role: "dialog",
495
857
  "aria-modal": "true",
496
858
  "aria-label": "Bundle builder",
497
- className: [n.backdrop, l ? n.backdropOpen : n.backdropClosed, o.className].filter(Boolean).join(" "),
498
- onMouseDown: (e) => {
499
- e.target === e.currentTarget && _();
859
+ className: [u.backdrop, t ? u.backdropOpen : u.backdropClosed, o.className].filter(Boolean).join(" "),
860
+ onMouseDown: (a) => {
861
+ a.target === a.currentTarget && e();
500
862
  },
501
- children: /* @__PURE__ */ N("aside", { ref: z, className: [n.panel, l ? n.panelOpen : n.panelClosed].filter(Boolean).join(" "), tabIndex: -1, children: [
502
- /* @__PURE__ */ N("header", { className: [n.header, P ? n.headerSearchOpen : null].filter(Boolean).join(" "), children: [
503
- /* @__PURE__ */ r(
504
- "button",
505
- {
506
- type: "button",
507
- className: n.searchIconButton,
508
- "aria-label": P ? "Search (expanded)" : "Search",
509
- "aria-expanded": P,
510
- onClick: () => {
511
- Y(!0);
512
- },
513
- children: /* @__PURE__ */ r(We, { size: 18, "aria-hidden": "true" })
514
- }
515
- ),
516
- /* @__PURE__ */ N("div", { className: n.headerCenter, children: [
517
- /* @__PURE__ */ r("div", { className: n.headerTitleWrap, "aria-hidden": P, children: /* @__PURE__ */ r("h2", { className: n.title, children: be }) }),
518
- /* @__PURE__ */ r("div", { className: n.headerSearchWrap, "aria-hidden": !P, children: /* @__PURE__ */ N("div", { className: n.searchBar, children: [
519
- /* @__PURE__ */ r(
520
- "input",
521
- {
522
- ref: te,
523
- className: n.searchInput,
524
- type: "search",
525
- value: f,
526
- placeholder: "Search",
527
- onChange: (e) => ee(e.target.value),
528
- onBlur: () => {
529
- f.trim() === "" && Y(!1);
530
- }
531
- }
532
- ),
533
- f.trim() ? /* @__PURE__ */ r(
534
- "button",
535
- {
536
- type: "button",
537
- className: n.searchClearButton,
538
- onMouseDown: (e) => {
539
- e.preventDefault();
540
- },
541
- onClick: () => {
542
- var e;
543
- ee(""), (e = te.current) == null || e.focus();
544
- },
545
- "aria-label": "Clear search",
546
- children: "Clear"
547
- }
548
- ) : null
549
- ] }) })
550
- ] }),
551
- /* @__PURE__ */ r("button", { type: "button", onClick: _, disabled: I, className: n.closeButton, "aria-label": "Close", children: "×" })
552
- ] }),
553
- /* @__PURE__ */ N("div", { className: n.body, ref: H, children: [
554
- m ? /* @__PURE__ */ r("p", { className: n.muted, children: "Loading…" }) : null,
555
- h ? /* @__PURE__ */ r("p", { className: n.error, children: h }) : null,
556
- !m && x && !x.isActive ? /* @__PURE__ */ r("p", { className: n.error, children: "Bundles are not active." }) : null,
557
- /* @__PURE__ */ r("div", { className: n.variants, children: /* @__PURE__ */ r("ul", { className: n.variantList, children: V.map((e) => {
558
- var L, A, K, de;
559
- const t = M[e.id] ?? 0, a = ce(e), i = ne(e.selectedOptions), c = me(e), b = ie, u = Number(e.price), p = b != null && Number.isFinite(b) && b > 0 && Number.isFinite(u), O = p ? Math.round(u * (1 - b / 100) * 100) / 100 : null;
560
- return /* @__PURE__ */ N("li", { className: n.variantRow, "data-variant-row": e.id, children: [
561
- /* @__PURE__ */ N("div", { className: n.variantLeft, children: [
562
- /* @__PURE__ */ r("div", { className: n.variantThumb, "aria-hidden": "true", children: (L = e.image) != null && L.url ? /* @__PURE__ */ r(
563
- "img",
564
- {
565
- className: n.variantThumbImg,
566
- src: e.image.url,
567
- alt: e.image.altText ?? c,
568
- loading: "lazy"
569
- }
570
- ) : /* @__PURE__ */ r("div", { className: n.variantThumbFallback, children: ((de = (K = (A = e.product) == null ? void 0 : A.title) == null ? void 0 : K.slice(0, 1)) == null ? void 0 : de.toUpperCase()) ?? "•" }) }),
571
- /* @__PURE__ */ N("div", { className: n.variantInfo, children: [
572
- /* @__PURE__ */ r("div", { className: n.variantName, children: a }),
573
- i ? /* @__PURE__ */ r("div", { className: n.variantMeta, children: i }) : null,
574
- /* @__PURE__ */ N("div", { className: n.variantPriceRow, children: [
575
- p ? /* @__PURE__ */ r("span", { className: n.variantCompareAt, children: $(Number.isFinite(u) ? u.toFixed(2) : e.price) }) : null,
576
- /* @__PURE__ */ r("span", { className: n.variantPrice, children: $(
577
- O != null ? O.toFixed(2) : Number.isFinite(u) ? u.toFixed(2) : e.price
578
- ) })
579
- ] })
580
- ] })
581
- ] }),
582
- t <= 0 ? /* @__PURE__ */ r(
583
- "button",
584
- {
585
- type: "button",
586
- onClick: () => J(e.id, 1),
587
- disabled: I,
588
- className: n.addToBundleButton,
589
- "aria-label": `Add ${c} to bundle`,
590
- children: "Add"
591
- }
592
- ) : /* @__PURE__ */ N("div", { className: n.qtyControls, children: [
593
- /* @__PURE__ */ r(
594
- "button",
863
+ children: [
864
+ _t && X && K.width > 0 && K.height > 0 ? /* @__PURE__ */ d(
865
+ ce,
866
+ {
867
+ width: K.width,
868
+ height: K.height,
869
+ confettiSource: X,
870
+ colors: [
871
+ "#2563eb",
872
+ // blue-600
873
+ "#3b82f6",
874
+ // blue-500
875
+ "#60a5fa",
876
+ // blue-400
877
+ "#93c5fd",
878
+ // blue-300
879
+ "#bae6fd",
880
+ // blue-200
881
+ "#e0f2fe"
882
+ // blue-100
883
+ ],
884
+ recycle: !1,
885
+ numberOfPieces: 70,
886
+ tweenDuration: 100,
887
+ gravity: 0.45,
888
+ initialVelocityY: { min: -10, max: -30 },
889
+ initialVelocityX: { min: -6, max: 6 },
890
+ style: { position: "fixed", inset: 0, pointerEvents: "none", zIndex: 2147483647 }
891
+ },
892
+ mt
893
+ ) : null,
894
+ /* @__PURE__ */ P("aside", { ref: Ot, className: [u.panel, t ? u.panelOpen : u.panelClosed].filter(Boolean).join(" "), tabIndex: -1, children: [
895
+ /* @__PURE__ */ P("header", { className: [u.header, S ? u.headerSearchOpen : null].filter(Boolean).join(" "), children: [
896
+ /* @__PURE__ */ d(
897
+ "button",
898
+ {
899
+ type: "button",
900
+ className: u.searchIconButton,
901
+ "aria-label": S ? "Search (expanded)" : "Search",
902
+ "aria-expanded": S,
903
+ onClick: () => {
904
+ F(!0);
905
+ },
906
+ children: /* @__PURE__ */ d(be, { size: 18, "aria-hidden": "true" })
907
+ }
908
+ ),
909
+ /* @__PURE__ */ P("div", { className: u.headerCenter, children: [
910
+ /* @__PURE__ */ d("div", { className: u.headerTitleWrap, "aria-hidden": S, children: /* @__PURE__ */ d("h2", { className: u.title, children: g }) }),
911
+ /* @__PURE__ */ d("div", { className: u.headerSearchWrap, "aria-hidden": !S, children: /* @__PURE__ */ P("div", { className: u.searchBar, children: [
912
+ /* @__PURE__ */ d(
913
+ "input",
595
914
  {
596
- type: "button",
597
- onClick: () => J(e.id, t - 1),
598
- disabled: I || t <= 0,
599
- className: n.qtyButton,
600
- "aria-label": `Decrease ${c}`,
601
- children: "−"
915
+ ref: rt,
916
+ className: u.searchInput,
917
+ type: "search",
918
+ value: b,
919
+ placeholder: "Search",
920
+ onChange: (a) => Q(a.target.value),
921
+ onBlur: () => {
922
+ b.trim() === "" && F(!1);
923
+ }
602
924
  }
603
925
  ),
604
- /* @__PURE__ */ r("span", { className: n.qtyValue, "aria-label": `Quantity ${t}`, children: t }),
605
- /* @__PURE__ */ r(
926
+ b.trim() ? /* @__PURE__ */ d(
606
927
  "button",
607
928
  {
608
929
  type: "button",
609
- onClick: () => J(e.id, t + 1),
610
- disabled: I,
611
- className: n.qtyButton,
612
- "aria-label": `Increase ${c}`,
613
- children: "+"
930
+ className: u.searchClearButton,
931
+ onMouseDown: (a) => {
932
+ a.preventDefault();
933
+ },
934
+ onClick: () => {
935
+ var a;
936
+ Q(""), (a = rt.current) == null || a.focus();
937
+ },
938
+ "aria-label": "Clear search",
939
+ children: "Clear"
614
940
  }
615
- )
616
- ] })
617
- ] }, e.id);
618
- }) }) })
619
- ] }),
620
- /* @__PURE__ */ N("footer", { className: n.footer, children: [
621
- /* @__PURE__ */ r("div", { className: n.boxSummaryWindow, ref: re, children: /* @__PURE__ */ r("div", { className: n.boxSummaryRow, "aria-label": "Bundle box summary", children: Array.from({ length: j }).map((e, t) => {
622
- var L, A, K, de;
623
- const a = s[t], i = T.get(t), c = !!a, b = !!i, u = b && !c, p = i ? `${i.discountPercent}% off` : null, O = c ? a.displayName : `Slot ${t + 1}`;
624
- return /* @__PURE__ */ N("div", { "data-box-slot": t, className: n.boxSlot, children: [
625
- /* @__PURE__ */ r(
626
- "div",
627
- {
628
- className: [
629
- n.boxItem,
630
- c ? n.boxItemFilled : n.boxItemPlaceholder,
631
- b ? n.boxItemThreshold : null,
632
- c ? n.boxItemClickable : null
633
- ].filter(Boolean).join(" "),
634
- role: c ? "button" : void 0,
635
- tabIndex: c ? 0 : void 0,
636
- onClick: c ? () => ae(a.id) : void 0,
637
- onKeyDown: c ? (pe) => {
638
- (pe.key === "Enter" || pe.key === " ") && (pe.preventDefault(), ae(a.id));
639
- } : void 0,
640
- "aria-label": u && p ? `${O}. Unlocks ${p}.` : O,
641
- title: u && p ? `${O} • Unlocks ${p}` : O,
642
- children: c ? (L = a.image) != null && L.url ? /* @__PURE__ */ r(
941
+ ) : null
942
+ ] }) })
943
+ ] }),
944
+ /* @__PURE__ */ d("button", { type: "button", onClick: e, disabled: r, className: u.closeButton, "aria-label": "Close", children: "×" })
945
+ ] }),
946
+ /* @__PURE__ */ P("div", { className: u.body, ref: kt, children: [
947
+ i ? /* @__PURE__ */ d("p", { className: u.muted, children: "Loading…" }) : null,
948
+ n ? /* @__PURE__ */ d("p", { className: u.error, children: n }) : null,
949
+ !i && l && !l.isActive ? /* @__PURE__ */ d("p", { className: u.error, children: "Bundles are not active." }) : null,
950
+ /* @__PURE__ */ d("div", { className: u.variants, children: /* @__PURE__ */ d("ul", { className: u.variantList, children: G.map((a) => {
951
+ var E, Y, nt, ht;
952
+ const s = k[a.id] ?? 0, h = tt(a), p = J(a.selectedOptions), f = vt(a), v = ot, _ = Number(a.price), B = v != null && Number.isFinite(v) && v > 0 && Number.isFinite(_), W = B ? Math.round(_ * (1 - v / 100) * 100) / 100 : null;
953
+ return /* @__PURE__ */ P("li", { className: u.variantRow, "data-variant-row": a.id, children: [
954
+ /* @__PURE__ */ P("div", { className: u.variantLeft, children: [
955
+ /* @__PURE__ */ d("div", { className: u.variantThumb, "aria-hidden": "true", children: (E = a.image) != null && E.url ? /* @__PURE__ */ d(
643
956
  "img",
644
957
  {
645
- className: n.boxItemImage,
958
+ className: u.variantThumbImg,
646
959
  src: a.image.url,
647
- alt: a.image.altText ?? a.displayName,
960
+ alt: a.image.altText ?? f,
648
961
  loading: "lazy"
649
962
  }
650
- ) : /* @__PURE__ */ r("div", { className: n.boxItemFallback, "aria-hidden": "true", children: ((de = (K = (A = a.product) == null ? void 0 : A.title) == null ? void 0 : K.slice(0, 1)) == null ? void 0 : de.toUpperCase()) ?? "•" }) : u && p ? /* @__PURE__ */ r("div", { className: n.boxItemDiscountText, children: p }) : /* @__PURE__ */ r("div", { className: n.boxItemPlus, "aria-hidden": "true", children: "+" })
651
- }
652
- ),
653
- b ? /* @__PURE__ */ r("div", { className: n.boxThresholdLabel, children: i.label }) : null
654
- ] }, t);
655
- }) }) }),
656
- /* @__PURE__ */ r(
657
- "div",
658
- {
659
- className: [n.ctaTotalsWrap, R <= 0 ? n.ctaTotalsWrapVisible : null].filter(Boolean).join(" "),
660
- "aria-hidden": R > 0,
661
- children: /* @__PURE__ */ N("div", { className: n.ctaTotals, "aria-label": "Totals", children: [
662
- ie ? /* @__PURE__ */ N("span", { className: n.ctaDiscountBadge, children: [
663
- k ? "Unlocked " : "",
664
- ie,
665
- "% off"
666
- ] }) : /* @__PURE__ */ r("span", {}),
667
- /* @__PURE__ */ r("span", { children: k ? /* @__PURE__ */ N(Te, { children: [
668
- /* @__PURE__ */ r("span", { className: n.ctaTotalsStrike, children: $(d.toFixed(2)) }),
669
- " ",
670
- /* @__PURE__ */ r("span", { className: n.ctaTotalsPrice, children: $(C.toFixed(2)) })
671
- ] }) : /* @__PURE__ */ r("span", { className: n.ctaTotalsPrice, children: $(d.toFixed(2)) }) })
672
- ] })
673
- }
674
- ),
675
- /* @__PURE__ */ r("button", { type: "button", onClick: le, disabled: !X, className: n.cta, children: I ? "Adding…" : R > 0 ? `Add ${R} more product${R === 1 ? "" : "s"}` : "Add to Basket" })
963
+ ) : /* @__PURE__ */ d("div", { className: u.variantThumbFallback, children: ((ht = (nt = (Y = a.product) == null ? void 0 : Y.title) == null ? void 0 : nt.slice(0, 1)) == null ? void 0 : ht.toUpperCase()) ?? "•" }) }),
964
+ /* @__PURE__ */ P("div", { className: u.variantInfo, children: [
965
+ /* @__PURE__ */ d("div", { className: u.variantName, children: h }),
966
+ p ? /* @__PURE__ */ d("div", { className: u.variantMeta, children: p }) : null,
967
+ /* @__PURE__ */ P("div", { className: u.variantPriceRow, children: [
968
+ B ? /* @__PURE__ */ d("span", { className: u.variantCompareAt, children: C(Number.isFinite(_) ? _.toFixed(2) : a.price) }) : null,
969
+ /* @__PURE__ */ d("span", { className: u.variantPrice, children: C(
970
+ W != null ? W.toFixed(2) : Number.isFinite(_) ? _.toFixed(2) : a.price
971
+ ) })
972
+ ] })
973
+ ] })
974
+ ] }),
975
+ s <= 0 ? /* @__PURE__ */ d(
976
+ "button",
977
+ {
978
+ type: "button",
979
+ onClick: () => R(a.id, 1),
980
+ disabled: r,
981
+ className: u.addToBundleButton,
982
+ "aria-label": `Add ${f} to bundle`,
983
+ children: "Add"
984
+ }
985
+ ) : /* @__PURE__ */ P("div", { className: u.qtyControls, children: [
986
+ /* @__PURE__ */ d(
987
+ "button",
988
+ {
989
+ type: "button",
990
+ onClick: () => R(a.id, s - 1),
991
+ disabled: r || s <= 0,
992
+ className: u.qtyButton,
993
+ "aria-label": `Decrease ${f}`,
994
+ children: "−"
995
+ }
996
+ ),
997
+ /* @__PURE__ */ d("span", { className: u.qtyValue, "aria-label": `Quantity ${s}`, children: s }),
998
+ /* @__PURE__ */ d(
999
+ "button",
1000
+ {
1001
+ type: "button",
1002
+ onClick: () => R(a.id, s + 1),
1003
+ disabled: r,
1004
+ className: u.qtyButton,
1005
+ "aria-label": `Increase ${f}`,
1006
+ children: "+"
1007
+ }
1008
+ )
1009
+ ] })
1010
+ ] }, a.id);
1011
+ }) }) })
1012
+ ] }),
1013
+ /* @__PURE__ */ P("footer", { className: u.footer, ref: it, children: [
1014
+ /* @__PURE__ */ d("div", { className: u.boxSummaryWindow, ref: Ft, children: /* @__PURE__ */ d("div", { className: u.boxSummaryRow, "aria-label": "Bundle box summary", children: Array.from({ length: Ut }).map((a, s) => {
1015
+ var E, Y, nt, ht;
1016
+ const h = xt[s], p = jt.get(s), f = !!h, v = !!p, _ = v && !f, B = p ? `${p.discountPercent}% off` : null, W = f ? h.displayName : `Slot ${s + 1}`;
1017
+ return /* @__PURE__ */ P("div", { "data-box-slot": s, className: u.boxSlot, children: [
1018
+ /* @__PURE__ */ d(
1019
+ "div",
1020
+ {
1021
+ className: [
1022
+ u.boxItem,
1023
+ f ? u.boxItemFilled : u.boxItemPlaceholder,
1024
+ v ? u.boxItemThreshold : null,
1025
+ f ? u.boxItemClickable : null
1026
+ ].filter(Boolean).join(" "),
1027
+ role: f ? "button" : void 0,
1028
+ tabIndex: f ? 0 : void 0,
1029
+ onClick: f ? () => At(h.id) : void 0,
1030
+ onKeyDown: f ? (It) => {
1031
+ (It.key === "Enter" || It.key === " ") && (It.preventDefault(), At(h.id));
1032
+ } : void 0,
1033
+ "aria-label": _ && B ? `${W}. Unlocks ${B}.` : W,
1034
+ title: _ && B ? `${W} • Unlocks ${B}` : W,
1035
+ children: f ? (E = h.image) != null && E.url ? /* @__PURE__ */ d(
1036
+ "img",
1037
+ {
1038
+ className: u.boxItemImage,
1039
+ src: h.image.url,
1040
+ alt: h.image.altText ?? h.displayName,
1041
+ loading: "lazy"
1042
+ }
1043
+ ) : /* @__PURE__ */ d("div", { className: u.boxItemFallback, "aria-hidden": "true", children: ((ht = (nt = (Y = h.product) == null ? void 0 : Y.title) == null ? void 0 : nt.slice(0, 1)) == null ? void 0 : ht.toUpperCase()) ?? "•" }) : _ && B ? /* @__PURE__ */ d("div", { className: u.boxItemDiscountText, children: B }) : /* @__PURE__ */ d("div", { className: u.boxItemPlus, "aria-hidden": "true", children: "+" })
1044
+ }
1045
+ ),
1046
+ v ? /* @__PURE__ */ d("div", { className: u.boxThresholdLabel, children: p.label }) : null
1047
+ ] }, s);
1048
+ }) }) }),
1049
+ /* @__PURE__ */ d(
1050
+ "div",
1051
+ {
1052
+ className: [u.ctaTotalsWrap, L <= 0 ? u.ctaTotalsWrapVisible : null].filter(Boolean).join(" "),
1053
+ "aria-hidden": L > 0,
1054
+ children: /* @__PURE__ */ P("div", { className: u.ctaTotals, "aria-label": "Totals", children: [
1055
+ ot ? /* @__PURE__ */ P("span", { className: u.ctaDiscountBadge, children: [
1056
+ D ? "Unlocked " : "",
1057
+ ot,
1058
+ "% off"
1059
+ ] }) : /* @__PURE__ */ d("span", {}),
1060
+ /* @__PURE__ */ d("span", { children: D ? /* @__PURE__ */ P(Qt, { children: [
1061
+ /* @__PURE__ */ d("span", { className: u.ctaTotalsStrike, children: C(ut.toFixed(2)) }),
1062
+ " ",
1063
+ /* @__PURE__ */ d("span", { className: u.ctaTotalsPrice, children: C($t.toFixed(2)) })
1064
+ ] }) : /* @__PURE__ */ d("span", { className: u.ctaTotalsPrice, children: C(ut.toFixed(2)) }) })
1065
+ ] })
1066
+ }
1067
+ ),
1068
+ /* @__PURE__ */ d("button", { type: "button", onClick: U, disabled: !j, className: u.cta, children: r ? "Adding…" : L > 0 ? `Add ${L} more product${L === 1 ? "" : "s"}` : "Add to Basket" })
1069
+ ] })
676
1070
  ] })
677
- ] })
1071
+ ]
678
1072
  }
679
1073
  ) : null;
680
1074
  }
681
1075
  export {
682
- Zt as BundleBuilderDrawer,
683
- Kt as BundleButton,
684
- _e as BundleLineAttributeKeys,
685
- Qt as BundleProvider,
686
- xe as useBundleBuilder,
687
- Ht as useBundleBuilderDrawer
1076
+ Nn as BundleBuilderDrawer,
1077
+ Tn as BundleButton,
1078
+ gt as BundleLineAttributeKeys,
1079
+ Cn as BundleProvider,
1080
+ Nt as useBundleBuilder,
1081
+ Bn as useBundleBuilderDrawer
688
1082
  };
689
1083
  //# sourceMappingURL=index.js.map