@best-bundles/bundle-ui 0.0.2 → 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,23 +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 k, useRef as K, useEffect as Z, useCallback as oe, useMemo as y, createContext as Ie, useContext as we, forwardRef as Be, createElement as ye } from "react";
4
- const pe = {
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
- bundleSource: "_bundle_source"
7
+ bundleSource: "_bundle_source",
8
+ bundleTitle: "_bundle_title"
8
9
  };
9
- async function Se(o) {
10
- const c = new URL("/api/public/bundle-config", o.apiBaseUrl);
11
- c.searchParams.set("shop", o.shop);
12
- const m = await (await fetch(c, {
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, {
13
14
  method: "GET",
14
15
  signal: o.signal,
15
16
  headers: { "Content-Type": "application/json" }
16
17
  })).json().catch(() => null);
17
- return !m || typeof m != "object" ? { ok: !1, error: "Invalid response." } : m;
18
+ return !i || typeof i != "object" ? { ok: !1, error: "Invalid response." } : i;
18
19
  }
19
- const Ne = Ie(null);
20
- function ke() {
20
+ const Vt = Yt(null);
21
+ function Kt() {
21
22
  try {
22
23
  const o = globalThis.crypto;
23
24
  if (o != null && o.randomUUID) return o.randomUUID();
@@ -25,175 +26,517 @@ function ke() {
25
26
  }
26
27
  return `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
27
28
  }
28
- function ge(o) {
29
+ function Dt(o) {
29
30
  return Number.isFinite(o) ? Math.max(0, Math.floor(o)) : 0;
30
31
  }
31
- function Qt(o) {
32
+ function Cn(o) {
32
33
  const {
33
- apiBaseUrl: c,
34
- shop: f,
35
- cartAdapter: m,
36
- configHandle: T = "default",
37
- initialData: h,
38
- configFetcher: U,
39
- children: x
40
- } = o, [w, L] = k(!1), [M, G] = k(!h), [g, E] = k(!1), [J, ce] = k(null), [F, X] = k((h == null ? void 0 : h.currencyCode) ?? null), [_, Y] = k((h == null ? void 0 : h.config) ?? null), [ee, te] = k(
41
- (h == null ? void 0 : h.eligibleVariants) ?? []
42
- ), [se, me] = k(
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(
43
44
  () => ({ selections: {}, order: [] })
44
- ), he = K(null);
45
- Z(() => {
46
- var B;
47
- if (h) return;
48
- (B = he.current) == null || B.abort();
49
- const d = new AbortController();
50
- he.current = d;
51
- const C = U ?? Se;
52
- return G(!0), ce(null), C({ apiBaseUrl: c, shop: f, signal: d.signal }).then((l) => {
53
- if (!l.ok) {
54
- ce(l.error || "Failed to load bundle config."), Y(null), te([]), X(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);
55
56
  return;
56
57
  }
57
- X(l.currencyCode ?? null), Y(l.config), te(l.eligibleVariants ?? []);
58
- }).catch((l) => {
59
- const D = l instanceof Error ? l.message : "Failed to load bundle config.";
60
- ce(D), Y(null), te([]), X(null);
61
- }).finally(() => G(!1)), () => d.abort();
62
- }, [c, f, h, U]);
63
- const le = oe(() => L(!0), []), I = oe(() => L(!1), []), A = oe(() => L((d) => !d), []), be = oe((d, C) => {
64
- const B = ge(C);
65
- me((l) => {
66
- const D = l.selections[d] ?? 0, ne = B - D;
67
- let j;
68
- if (B <= 0) {
69
- const { [d]: re, ...z } = l.selections;
70
- j = z;
71
- } else D === B ? j = l.selections : j = { ...l.selections, [d]: B };
72
- let Q = l.order;
73
- if (ne > 0)
74
- Q = [...l.order, ...Array.from({ length: ne }, () => d)];
75
- else if (ne < 0) {
76
- let re = -ne;
77
- const z = [];
78
- for (let ae = l.order.length - 1; ae >= 0; ae--) {
79
- const ue = l.order[ae];
80
- if (ue === d && re > 0) {
81
- 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--;
82
83
  continue;
83
84
  }
84
- z.push(ue);
85
+ D.push(ot);
85
86
  }
86
- z.reverse(), Q = z;
87
+ D.reverse(), L = D;
87
88
  }
88
- return j === l.selections && Q === l.order ? l : { selections: j, order: Q };
89
+ return I === g.selections && L === g.order ? g : { selections: I, order: L };
89
90
  });
90
- }, []), $ = oe(() => me({ selections: {}, order: [] }), []), W = se.selections, v = se.order, P = y(() => Object.values(W).reduce((d, C) => d + (C || 0), 0), [W]), V = y(() => {
91
- const d = (_ == null ? void 0 : _.rules) ?? [], C = d.length ? Math.min(...d.map((B) => B.minBundleSize)) : 2;
92
- return Number.isFinite(C) && C > 0 ? C : 2;
93
- }, [_]), S = y(() => !(M || g || J || !(_ != null && _.isActive) || P < V), [P, _ == null ? void 0 : _.isActive, J, M, V, g]), fe = oe(async () => {
94
- var B;
95
- if (!S || !_) return;
96
- const d = ke(), C = Object.entries(W).map(([l, D]) => ({ merchandiseId: l, quantity: ge(D) })).filter((l) => l.quantity > 0).map((l) => ({
97
- merchandiseId: l.merchandiseId,
98
- quantity: l.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,
99
100
  attributes: [
100
- { key: pe.bundleId, value: d },
101
- { key: pe.bundleConfig, value: T },
102
- { key: pe.bundleSource, value: "bundle_builder" }
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 }] : []
103
105
  ]
104
106
  }));
105
107
  if (C.length) {
106
- E(!0);
108
+ $(!0);
107
109
  try {
108
- await m.linesAdd(C), $(), I(), (B = m.openCartUI) == null || B.call(m);
110
+ await i.linesAdd(C), Z(), X(), (g = i.openCartUI) == null || g.call(i);
109
111
  } finally {
110
- E(!1);
112
+ $(!1);
111
113
  }
112
114
  }
113
- }, [S, m, $, I, _, T, W]), ie = y(
115
+ }, [tt, i, Z, X, b, r, A]), yt = T(
114
116
  () => ({
115
- isOpen: w,
116
- open: le,
117
- close: I,
118
- toggle: A,
119
- loading: M,
120
- submitting: g,
121
- error: J,
122
- currencyCode: F,
123
- config: _,
124
- eligibleVariants: ee,
125
- selections: W,
126
- selectionOrder: v,
127
- setQuantity: be,
128
- clearSelections: $,
129
- bundleSize: P,
130
- minRequired: V,
131
- canSubmit: S,
132
- 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
133
135
  }),
134
136
  [
137
+ m,
138
+ pt,
139
+ X,
140
+ bt,
141
+ N,
135
142
  w,
136
- le,
137
- I,
143
+ j,
144
+ S,
145
+ b,
146
+ rt,
138
147
  A,
139
- M,
140
- g,
148
+ ct,
149
+ _t,
150
+ Z,
151
+ at,
141
152
  J,
142
- F,
143
- _,
144
- ee,
145
- W,
146
- v,
147
- be,
148
- $,
149
- P,
150
- V,
151
- S,
152
- fe
153
+ tt,
154
+ vt
153
155
  ]
154
156
  );
155
- return /* @__PURE__ */ r(Ne.Provider, { value: ie, children: x });
157
+ return /* @__PURE__ */ d(Vt.Provider, { value: yt, children: l });
156
158
  }
157
- function xe() {
158
- const o = we(Ne);
159
+ function Nt() {
160
+ const o = Gt(Vt);
159
161
  if (!o)
160
162
  throw new Error("useBundleBuilder must be used within <BundleProvider />");
161
163
  return o;
162
164
  }
163
- function Ht() {
164
- const { isOpen: o, open: c, close: f, toggle: m } = xe();
165
- return { isOpen: o, open: c, close: f, 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 };
166
168
  }
167
- const Fe = "_button_18rtl_1", Pe = {
168
- button: Fe
169
+ const Xt = "_button_18rtl_1", Zt = {
170
+ button: Xt
169
171
  };
170
- function Kt(o) {
171
- const { toggle: c } = xe();
172
- return /* @__PURE__ */ r(
172
+ function Tn(o) {
173
+ const { toggle: t } = Nt();
174
+ return /* @__PURE__ */ d(
173
175
  "button",
174
176
  {
175
177
  type: "button",
176
- onClick: c,
177
- className: [Pe.button, o.className].filter(Boolean).join(" "),
178
+ onClick: t,
179
+ className: [Zt.button, o.className].filter(Boolean).join(" "),
178
180
  children: o.children ?? "Build a bundle"
179
181
  }
180
182
  );
181
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 }));
182
525
  /**
183
526
  * @license lucide-react v0.515.0 - ISC
184
527
  *
185
528
  * This source code is licensed under the ISC license.
186
529
  * See the LICENSE file in the root directory of this source tree.
187
530
  */
188
- 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(
189
532
  /^([A-Z])|[\s-_]+(\w)/g,
190
- (c, f, m) => m ? m.toUpperCase() : f.toLowerCase()
191
- ), ve = (o) => {
192
- const c = Oe(o);
193
- return c.charAt(0).toUpperCase() + c.slice(1);
194
- }, Ce = (...o) => o.filter((c, f, m) => !!c && c.trim() !== "" && m.indexOf(c) === f).join(" ").trim(), Le = (o) => {
195
- for (const c in o)
196
- if (c.startsWith("aria-") || c === "role" || c === "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")
197
540
  return !0;
198
541
  };
199
542
  /**
@@ -202,7 +545,7 @@ const Re = (o) => o.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Oe = (
202
545
  * This source code is licensed under the ISC license.
203
546
  * See the LICENSE file in the root directory of this source tree.
204
547
  */
205
- var Me = {
548
+ var de = {
206
549
  xmlns: "http://www.w3.org/2000/svg",
207
550
  width: 24,
208
551
  height: 24,
@@ -219,32 +562,32 @@ var Me = {
219
562
  * This source code is licensed under the ISC license.
220
563
  * See the LICENSE file in the root directory of this source tree.
221
564
  */
222
- const qe = Be(
565
+ const fe = Et(
223
566
  ({
224
567
  color: o = "currentColor",
225
- size: c = 24,
226
- strokeWidth: f = 2,
227
- absoluteStrokeWidth: m,
228
- className: T = "",
229
- children: h,
230
- iconNode: U,
231
- ...x
232
- }, w) => 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(
233
576
  "svg",
234
577
  {
235
- ref: w,
236
- ...Me,
237
- width: c,
238
- height: c,
578
+ ref: m,
579
+ ...de,
580
+ width: t,
581
+ height: t,
239
582
  stroke: o,
240
- strokeWidth: m ? Number(f) * 24 / Number(c) : f,
241
- className: Ce("lucide", T),
242
- ...!h && !Le(x) && { "aria-hidden": "true" },
243
- ...x
583
+ strokeWidth: i ? Number(e) * 24 / Number(t) : e,
584
+ className: zt("lucide", r),
585
+ ...!n && !he(l) && { "aria-hidden": "true" },
586
+ ...l
244
587
  },
245
588
  [
246
- ...U.map(([L, M]) => ye(L, M)),
247
- ...Array.isArray(h) ? h : [h]
589
+ ...c.map(([k, N]) => Tt(k, N)),
590
+ ...Array.isArray(n) ? n : [n]
248
591
  ]
249
592
  )
250
593
  );
@@ -254,20 +597,20 @@ const qe = Be(
254
597
  * This source code is licensed under the ISC license.
255
598
  * See the LICENSE file in the root directory of this source tree.
256
599
  */
257
- const Ae = (o, c) => {
258
- const f = Be(
259
- ({ className: m, ...T }, h) => ye(qe, {
260
- ref: h,
261
- iconNode: c,
262
- className: Ce(
263
- `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))}`,
264
607
  `lucide-${o}`,
265
- m
608
+ i
266
609
  ),
267
- ...T
610
+ ...r
268
611
  })
269
612
  );
270
- return f.displayName = ve(o), f;
613
+ return e.displayName = Wt(o), e;
271
614
  };
272
615
  /**
273
616
  * @license lucide-react v0.515.0 - ISC
@@ -275,413 +618,466 @@ const Ae = (o, c) => {
275
618
  * This source code is licensed under the ISC license.
276
619
  * See the LICENSE file in the root directory of this source tree.
277
620
  */
278
- const $e = [
621
+ const pe = [
279
622
  ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
280
623
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
281
- ], 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", ct = "_variants_1ctfr_260", st = "_variantList_1ctfr_264", lt = "_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 = {
282
- backdrop: Ve,
283
- backdropOpen: De,
284
- backdropClosed: je,
285
- panel: ze,
286
- panelOpen: Ue,
287
- panelClosed: Ee,
288
- header: Qe,
289
- headerCenter: He,
290
- title: Ke,
291
- searchIconButton: Ze,
292
- headerTitleWrap: Ge,
293
- headerSearchWrap: Je,
294
- headerSearchOpen: Xe,
295
- searchBar: Ye,
296
- searchInput: et,
297
- searchClearButton: tt,
298
- closeButton: nt,
299
- body: rt,
300
- muted: at,
301
- error: ot,
302
- variants: ct,
303
- variantList: st,
304
- variantRow: lt,
305
- variantLeft: it,
306
- addToBundleButton: ut,
307
- variantThumb: dt,
308
- variantThumbImg: mt,
309
- variantThumbFallback: ht,
310
- variantInfo: bt,
311
- variantName: ft,
312
- variantMeta: _t,
313
- variantPriceRow: pt,
314
- variantCompareAt: yt,
315
- variantPrice: xt,
316
- qtyControls: gt,
317
- qtyButton: vt,
318
- qtyValue: Bt,
319
- footer: Nt,
320
- boxSummaryWindow: Ct,
321
- boxSummaryRow: Tt,
322
- boxSlot: It,
323
- boxItem: wt,
324
- boxItemClickable: St,
325
- boxThresholdLabel: kt,
326
- boxItemPlaceholder: Ft,
327
- boxItemFilled: Pt,
328
- boxItemThreshold: Rt,
329
- boxItemDiscountText: Ot,
330
- boxItemPlus: Lt,
331
- boxItemImage: Mt,
332
- boxItemFallback: qt,
333
- cta: At,
334
- ctaTotals: $t,
335
- ctaDiscountBadge: Wt,
336
- ctaTotalsWrap: Vt,
337
- ctaTotalsWrapVisible: Dt,
338
- ctaTotalsStrike: jt,
339
- 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
340
683
  };
341
- function Zt(o) {
342
- var ue;
684
+ function Nn(o) {
685
+ var qt;
343
686
  const {
344
- isOpen: c,
345
- close: f,
346
- loading: m,
347
- submitting: T,
348
- error: h,
349
- currencyCode: U,
350
- config: x,
351
- eligibleVariants: w,
352
- selections: L,
353
- selectionOrder: M,
354
- setQuantity: G,
355
- bundleSize: g,
356
- minRequired: E,
357
- canSubmit: J,
358
- submit: ce
359
- } = xe(), [F, X] = k(!1), [_, Y] = k(""), ee = K(null), te = (e) => {
360
- const t = (e ?? []).filter((a) => {
361
- var b, u;
362
- const i = (b = a == null ? void 0 : a.name) == null ? void 0 : b.trim(), s = (u = a == null ? void 0 : a.value) == null ? void 0 : u.trim();
363
- return !(!i || !s || 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");
364
707
  });
365
- return t.length ? t.map((a) => `${a.name}: ${a.value}`).join(" · ") : null;
366
- }, se = (e) => {
367
- var t;
368
- return ((t = e.product) == null ? void 0 : t.title) ?? e.displayName ?? e.title;
369
- }, me = (e) => {
370
- const t = se(e), a = te(e.selectedOptions);
371
- return [t, a].filter(Boolean).join(" — ");
372
- }, [he, le] = k(c), I = K(null), A = (e) => {
373
- const t = Number(e);
374
- if (!Number.isFinite(t)) return e;
375
- if (U)
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)
376
719
  try {
377
- return new Intl.NumberFormat(void 0, { style: "currency", currency: U }).format(t);
720
+ return new Intl.NumberFormat(void 0, { style: "currency", currency: c }).format(s);
378
721
  } catch {
379
722
  }
380
- return `$${t.toFixed(2)}`;
381
- }, be = ((ue = x == null ? void 0 : x.title) == null ? void 0 : ue.trim()) || "Build your bundle", $ = y(() => [...w].sort((e, t) => e.displayName.localeCompare(t.displayName)), [w]), W = y(() => {
382
- const e = _.trim().toLowerCase();
383
- if (!e) return $;
384
- const t = e.split(/\s+/).filter(Boolean), a = (i) => {
385
- var u;
386
- const s = [];
387
- s.push(i.displayName), (u = i.product) != null && u.title && s.push(i.product.title);
388
- for (const p of i.selectedOptions ?? [])
389
- s.push(p.name), s.push(p.value);
390
- const b = s.join(" ").toLowerCase();
391
- 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));
392
735
  };
393
- return $.filter(a);
394
- }, [_, $]), v = y(() => [...(x == null ? void 0 : x.rules) ?? []].sort((e, t) => e.minBundleSize - t.minBundleSize), [x == null ? void 0 : x.rules]), P = y(() => Math.max(0, E - g), [g, E]), V = y(() => {
395
- let e = null;
396
- for (const t of v)
397
- g >= t.minBundleSize && (e = t);
398
- return e;
399
- }, [g, v]), S = y(() => {
400
- if (!V) return null;
401
- const e = Number.parseFloat(V.discountPercent);
402
- return !Number.isFinite(e) || e <= 0 ? null : e;
403
- }, [V]), fe = y(() => {
404
- const e = v[0];
405
- if (!e) return null;
406
- const t = Number.parseFloat(e.discountPercent);
407
- return !Number.isFinite(t) || t <= 0 ? null : t;
408
- }, [v]), ie = S ?? fe, d = y(() => {
409
- const e = new Map(w.map((a) => [a.id, a]));
410
- let t = 0;
411
- for (const [a, i] of Object.entries(L)) {
412
- const s = i ?? 0;
413
- if (s <= 0) continue;
414
- const b = e.get(a), u = Number(b == null ? void 0 : b.price);
415
- Number.isFinite(u) && (t += u * s);
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);
416
759
  }
417
- return Math.round(t * 100) / 100;
418
- }, [w, L]), C = y(() => {
419
- if (!S) return d;
420
- const e = d * (1 - S / 100);
421
- return Math.round(e * 100) / 100;
422
- }, [S, d]), B = y(() => v.length ? Math.max(...v.map((e) => e.minBundleSize)) : 0, [v]), l = y(() => {
423
- const e = new Map(w.map((t) => [t.id, t]));
424
- return M.map((t) => e.get(t)).filter((t) => !!t);
425
- }, [w, M]), D = y(() => {
426
- var t;
427
- const e = /* @__PURE__ */ new Map();
428
- for (const a of v) {
429
- const i = Math.max(0, a.minBundleSize - 1);
430
- e.set(i, {
431
- discountPercent: a.discountPercent,
432
- minBundleSize: a.minBundleSize,
433
- 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}+`
434
777
  });
435
778
  }
436
- return e;
437
- }, [v]), ne = y(() => Math.max(B || E, l.length), [l.length, B, E]), j = K(null), Q = K(null), re = K(null), z = K(g), ae = (e) => {
438
- const t = Q.current;
439
- if (!t) return;
440
- const a = t.querySelector(`[data-variant-row="${e}"]`);
441
- if (!a) return;
442
- const i = t.getBoundingClientRect(), s = a.getBoundingClientRect(), b = 8;
443
- if (s.top >= i.top + b && s.bottom <= i.bottom - b) return;
444
- const p = Math.max(0, t.scrollHeight - t.clientHeight), R = s.top - i.top + s.height / 2, O = t.scrollTop + R - t.clientHeight / 2, q = Math.min(p, Math.max(0, O));
445
- t.scrollTo({ top: q, 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" });
446
789
  };
447
- return Z(() => {
448
- if (!c) return;
449
- const e = (t) => {
450
- t.key === "Escape" && f();
790
+ return z(() => {
791
+ if (!t) return;
792
+ const a = (s) => {
793
+ s.key === "Escape" && e();
451
794
  };
452
- return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
453
- }, [f, c]), Z(() => {
454
- if (I.current != null && (window.clearTimeout(I.current), I.current = null), c) {
455
- le(!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);
456
803
  return;
457
804
  }
458
- I.current = window.setTimeout(() => {
459
- le(!1), I.current = null;
805
+ x.current = window.setTimeout(() => {
806
+ y(!1), x.current = null;
460
807
  }, 220);
461
- }, [c]), Z(() => () => {
462
- I.current != null && window.clearTimeout(I.current);
463
- }, []), Z(() => {
464
- if (!c || !F) return;
465
- const e = requestAnimationFrame(() => {
466
- var t;
467
- return (t = ee.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();
468
817
  });
469
- return () => cancelAnimationFrame(e);
470
- }, [c, F]), Z(() => {
471
- const e = z.current;
472
- if (z.current = g, g <= e) return;
473
- const t = re.current;
474
- if (!t) return;
475
- const a = v.some((u) => u.minBundleSize === g), i = v.find((u) => u.minBundleSize > g), s = i && a ? i.minBundleSize - 1 : i ? null : g - 1;
476
- if (s == null || s < 0) return;
477
- const b = requestAnimationFrame(() => {
478
- const u = t.querySelector(`[data-box-slot="${s}"]`);
479
- if (!u) return;
480
- const p = t.getBoundingClientRect(), O = u.getBoundingClientRect().right - p.right;
481
- if (O <= 1) return;
482
- const q = Math.max(0, t.scrollWidth - t.clientWidth), H = Math.min(q, Math.max(0, t.scrollLeft + O));
483
- t.scrollTo({ left: H, 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" });
484
833
  });
485
- return () => cancelAnimationFrame(b);
486
- }, [g, v]), Z(() => {
487
- var e;
488
- c && ((e = j.current) == null || e.focus());
489
- }, [c]), 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(
490
854
  "div",
491
855
  {
492
856
  role: "dialog",
493
857
  "aria-modal": "true",
494
858
  "aria-label": "Bundle builder",
495
- className: [n.backdrop, c ? n.backdropOpen : n.backdropClosed, o.className].filter(Boolean).join(" "),
496
- onMouseDown: (e) => {
497
- e.target === e.currentTarget && f();
859
+ className: [u.backdrop, t ? u.backdropOpen : u.backdropClosed, o.className].filter(Boolean).join(" "),
860
+ onMouseDown: (a) => {
861
+ a.target === a.currentTarget && e();
498
862
  },
499
- children: /* @__PURE__ */ N("aside", { ref: j, className: [n.panel, c ? n.panelOpen : n.panelClosed].filter(Boolean).join(" "), tabIndex: -1, children: [
500
- /* @__PURE__ */ N("header", { className: [n.header, F ? n.headerSearchOpen : null].filter(Boolean).join(" "), children: [
501
- /* @__PURE__ */ r(
502
- "button",
503
- {
504
- type: "button",
505
- className: n.searchIconButton,
506
- "aria-label": F ? "Search (expanded)" : "Search",
507
- "aria-expanded": F,
508
- onClick: () => {
509
- X(!0);
510
- },
511
- children: /* @__PURE__ */ r(We, { size: 18, "aria-hidden": "true" })
512
- }
513
- ),
514
- /* @__PURE__ */ N("div", { className: n.headerCenter, children: [
515
- /* @__PURE__ */ r("div", { className: n.headerTitleWrap, "aria-hidden": F, children: /* @__PURE__ */ r("h2", { className: n.title, children: be }) }),
516
- /* @__PURE__ */ r("div", { className: n.headerSearchWrap, "aria-hidden": !F, children: /* @__PURE__ */ N("div", { className: n.searchBar, children: [
517
- /* @__PURE__ */ r(
518
- "input",
519
- {
520
- ref: ee,
521
- className: n.searchInput,
522
- type: "search",
523
- value: _,
524
- placeholder: "Search",
525
- onChange: (e) => Y(e.target.value),
526
- onBlur: () => {
527
- _.trim() === "" && X(!1);
528
- }
529
- }
530
- ),
531
- _.trim() ? /* @__PURE__ */ r(
532
- "button",
533
- {
534
- type: "button",
535
- className: n.searchClearButton,
536
- onMouseDown: (e) => {
537
- e.preventDefault();
538
- },
539
- onClick: () => {
540
- var e;
541
- Y(""), (e = ee.current) == null || e.focus();
542
- },
543
- "aria-label": "Clear search",
544
- children: "Clear"
545
- }
546
- ) : null
547
- ] }) })
548
- ] }),
549
- /* @__PURE__ */ r("button", { type: "button", onClick: f, disabled: T, className: n.closeButton, "aria-label": "Close", children: "×" })
550
- ] }),
551
- /* @__PURE__ */ N("div", { className: n.body, ref: Q, children: [
552
- m ? /* @__PURE__ */ r("p", { className: n.muted, children: "Loading…" }) : null,
553
- h ? /* @__PURE__ */ r("p", { className: n.error, children: h }) : null,
554
- !m && x && !x.isActive ? /* @__PURE__ */ r("p", { className: n.error, children: "Bundles are not active." }) : null,
555
- /* @__PURE__ */ r("div", { className: n.variants, children: /* @__PURE__ */ r("ul", { className: n.variantList, children: W.map((e) => {
556
- var O, q, H, de;
557
- const t = L[e.id] ?? 0, a = se(e), i = te(e.selectedOptions), s = me(e), b = ie, u = Number(e.price), p = b != null && Number.isFinite(b) && b > 0 && Number.isFinite(u), R = p ? Math.round(u * (1 - b / 100) * 100) / 100 : null;
558
- return /* @__PURE__ */ N("li", { className: n.variantRow, "data-variant-row": e.id, children: [
559
- /* @__PURE__ */ N("div", { className: n.variantLeft, children: [
560
- /* @__PURE__ */ r("div", { className: n.variantThumb, "aria-hidden": "true", children: (O = e.image) != null && O.url ? /* @__PURE__ */ r(
561
- "img",
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",
562
914
  {
563
- className: n.variantThumbImg,
564
- src: e.image.url,
565
- alt: e.image.altText ?? s,
566
- loading: "lazy"
567
- }
568
- ) : /* @__PURE__ */ r("div", { className: n.variantThumbFallback, children: ((de = (H = (q = e.product) == null ? void 0 : q.title) == null ? void 0 : H.slice(0, 1)) == null ? void 0 : de.toUpperCase()) ?? "•" }) }),
569
- /* @__PURE__ */ N("div", { className: n.variantInfo, children: [
570
- /* @__PURE__ */ r("div", { className: n.variantName, children: a }),
571
- i ? /* @__PURE__ */ r("div", { className: n.variantMeta, children: i }) : null,
572
- /* @__PURE__ */ N("div", { className: n.variantPriceRow, children: [
573
- p ? /* @__PURE__ */ r("span", { className: n.variantCompareAt, children: A(Number.isFinite(u) ? u.toFixed(2) : e.price) }) : null,
574
- /* @__PURE__ */ r("span", { className: n.variantPrice, children: A(
575
- R != null ? R.toFixed(2) : Number.isFinite(u) ? u.toFixed(2) : e.price
576
- ) })
577
- ] })
578
- ] })
579
- ] }),
580
- t <= 0 ? /* @__PURE__ */ r(
581
- "button",
582
- {
583
- type: "button",
584
- onClick: () => G(e.id, 1),
585
- disabled: T,
586
- className: n.addToBundleButton,
587
- "aria-label": `Add ${s} to bundle`,
588
- children: "Add"
589
- }
590
- ) : /* @__PURE__ */ N("div", { className: n.qtyControls, children: [
591
- /* @__PURE__ */ r(
592
- "button",
593
- {
594
- type: "button",
595
- onClick: () => G(e.id, t - 1),
596
- disabled: T || t <= 0,
597
- className: n.qtyButton,
598
- "aria-label": `Decrease ${s}`,
599
- 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
+ }
600
924
  }
601
925
  ),
602
- /* @__PURE__ */ r("span", { className: n.qtyValue, "aria-label": `Quantity ${t}`, children: t }),
603
- /* @__PURE__ */ r(
926
+ b.trim() ? /* @__PURE__ */ d(
604
927
  "button",
605
928
  {
606
929
  type: "button",
607
- onClick: () => G(e.id, t + 1),
608
- disabled: T,
609
- className: n.qtyButton,
610
- "aria-label": `Increase ${s}`,
611
- 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"
612
940
  }
613
- )
614
- ] })
615
- ] }, e.id);
616
- }) }) })
617
- ] }),
618
- /* @__PURE__ */ N("footer", { className: n.footer, children: [
619
- /* @__PURE__ */ r("div", { className: n.boxSummaryWindow, ref: re, children: /* @__PURE__ */ r("div", { className: n.boxSummaryRow, "aria-label": "Bundle box summary", children: Array.from({ length: ne }).map((e, t) => {
620
- var O, q, H, de;
621
- const a = l[t], i = D.get(t), s = !!a, b = !!i, u = b && !s, p = i ? `${i.discountPercent}% off` : null, R = s ? a.displayName : `Slot ${t + 1}`;
622
- return /* @__PURE__ */ N("div", { "data-box-slot": t, className: n.boxSlot, children: [
623
- /* @__PURE__ */ r(
624
- "div",
625
- {
626
- className: [
627
- n.boxItem,
628
- s ? n.boxItemFilled : n.boxItemPlaceholder,
629
- b ? n.boxItemThreshold : null,
630
- s ? n.boxItemClickable : null
631
- ].filter(Boolean).join(" "),
632
- role: s ? "button" : void 0,
633
- tabIndex: s ? 0 : void 0,
634
- onClick: s ? () => ae(a.id) : void 0,
635
- onKeyDown: s ? (_e) => {
636
- (_e.key === "Enter" || _e.key === " ") && (_e.preventDefault(), ae(a.id));
637
- } : void 0,
638
- "aria-label": u && p ? `${R}. Unlocks ${p}.` : R,
639
- title: u && p ? `${R} • Unlocks ${p}` : R,
640
- children: s ? (O = a.image) != null && O.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(
641
956
  "img",
642
957
  {
643
- className: n.boxItemImage,
958
+ className: u.variantThumbImg,
644
959
  src: a.image.url,
645
- alt: a.image.altText ?? a.displayName,
960
+ alt: a.image.altText ?? f,
646
961
  loading: "lazy"
647
962
  }
648
- ) : /* @__PURE__ */ r("div", { className: n.boxItemFallback, "aria-hidden": "true", children: ((de = (H = (q = a.product) == null ? void 0 : q.title) == null ? void 0 : H.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: "+" })
649
- }
650
- ),
651
- b ? /* @__PURE__ */ r("div", { className: n.boxThresholdLabel, children: i.label }) : null
652
- ] }, t);
653
- }) }) }),
654
- /* @__PURE__ */ r(
655
- "div",
656
- {
657
- className: [n.ctaTotalsWrap, P <= 0 ? n.ctaTotalsWrapVisible : null].filter(Boolean).join(" "),
658
- "aria-hidden": P > 0,
659
- children: /* @__PURE__ */ N("div", { className: n.ctaTotals, "aria-label": "Totals", children: [
660
- ie ? /* @__PURE__ */ N("span", { className: n.ctaDiscountBadge, children: [
661
- S ? "Unlocked " : "",
662
- ie,
663
- "% off"
664
- ] }) : /* @__PURE__ */ r("span", {}),
665
- /* @__PURE__ */ r("span", { children: S ? /* @__PURE__ */ N(Te, { children: [
666
- /* @__PURE__ */ r("span", { className: n.ctaTotalsStrike, children: A(d.toFixed(2)) }),
667
- " ",
668
- /* @__PURE__ */ r("span", { className: n.ctaTotalsPrice, children: A(C.toFixed(2)) })
669
- ] }) : /* @__PURE__ */ r("span", { className: n.ctaTotalsPrice, children: A(d.toFixed(2)) }) })
670
- ] })
671
- }
672
- ),
673
- /* @__PURE__ */ r("button", { type: "button", onClick: ce, disabled: !J, className: n.cta, children: T ? "Adding…" : P > 0 ? `Add ${P} more product${P === 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
+ ] })
674
1070
  ] })
675
- ] })
1071
+ ]
676
1072
  }
677
1073
  ) : null;
678
1074
  }
679
1075
  export {
680
- Zt as BundleBuilderDrawer,
681
- Kt as BundleButton,
682
- pe as BundleLineAttributeKeys,
683
- Qt as BundleProvider,
684
- xe as useBundleBuilder,
685
- 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
686
1082
  };
687
1083
  //# sourceMappingURL=index.js.map