@best-bundles/bundle-ui 0.0.19 → 0.0.20

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,69 +1,69 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.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_vl21a_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}._celebrationOverlay_vl21a_14{position:absolute;top:0;right:0;bottom:0;left:0;display:grid;place-items:center;pointer-events:none;z-index:50}._celebrationChip_vl21a_23{font-family:var(--bb-font-family-body, "Cabin", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif);letter-spacing:.03em;font-size:18px;line-height:1;padding:12px 16px;border-radius:999px;color:#0b1b44;background:linear-gradient(180deg,#fff,#bae6fd);border:2px solid rgba(37,99,235,.28);box-shadow:0 18px 55px #0006,0 10px 28px #2563eb33,inset 0 1px #ffffffbf;transform-origin:50% 60%;will-change:transform,opacity,filter;animation:_bbCelebrationPop_vl21a_1 2.8s cubic-bezier(.16,1,.3,1) forwards;filter:saturate(1.05)}@keyframes _bbCelebrationPop_vl21a_1{0%{opacity:0;transform:translateY(10px) scale(.6);filter:blur(1px) saturate(1.1)}12%{opacity:1;transform:translateY(0) scale(1.12);filter:blur(0px) saturate(1.1)}22%{opacity:1;transform:translateY(0) scale(1)}80%{opacity:1;transform:translateY(0) scale(1)}to{opacity:0;transform:translateY(-10px) scale(.98)}}._backdropOpen_vl21a_74{opacity:1}._backdropClosed_vl21a_78{opacity:0}._panel_vl21a_82{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_vl21a_102{animation:_bbSlideInFromRight_vl21a_1 var(--bb-drawer-transition-duration, .22s) ease forwards}._panelClosed_vl21a_106{animation:_bbSlideOutToRight_vl21a_1 var(--bb-drawer-transition-duration, .22s) ease forwards}@keyframes _bbSlideInFromRight_vl21a_1{0%{transform:translate(110%)}to{transform:translate(0)}}@keyframes _bbSlideOutToRight_vl21a_1{0%{transform:translate(0)}to{transform:translate(110%)}}@media(prefers-reduced-motion:reduce){._backdrop_vl21a_1{transition:none}._celebrationChip_vl21a_23,._panelOpen_vl21a_102,._panelClosed_vl21a_106{animation:none}}._header_vl21a_145{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_vl21a_154{position:relative;min-width:0;display:flex;justify-content:center;align-items:center}._title_vl21a_162{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_vl21a_171{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_vl21a_171:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._searchIconButton_vl21a_171:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._headerTitleWrap_vl21a_193{transition:opacity .18s ease,transform .22s ease}._headerSearchWrap_vl21a_197{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_vl21a_209 ._headerTitleWrap_vl21a_193{opacity:0;transform:translateY(2px);pointer-events:none}._headerSearchOpen_vl21a_209 ._headerSearchWrap_vl21a_197{opacity:1;transform:translateY(0);pointer-events:auto}._searchBar_vl21a_221{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_vl21a_233{width:100%;border:none;outline:none;background:transparent;font:inherit;font-size:14px;min-width:0;height:100%;line-height:36px;padding:0}._searchInput_vl21a_233::-webkit-search-cancel-button,._searchInput_vl21a_233::-webkit-search-decoration,._searchInput_vl21a_233::-webkit-search-results-button,._searchInput_vl21a_233::-webkit-search-results-decoration{-webkit-appearance:none;-moz-appearance:none;appearance:none}._searchClearButton_vl21a_254{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_vl21a_254:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._searchClearButton_vl21a_254:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._closeButton_vl21a_276{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_vl21a_276:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._closeButton_vl21a_276:disabled{opacity:.6;cursor:not-allowed}._closeButton_vl21a_276:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}@media(prefers-reduced-motion:reduce){._headerTitleWrap_vl21a_193,._headerSearchWrap_vl21a_197{transition:none}}._body_vl21a_309{padding:var(--bb-body-padding, 8px 16px);overflow:auto}._muted_vl21a_314{color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65));margin:0 0 12px}._error_vl21a_319{color:var(--bb-error-color, #b91c1c);margin:0 0 12px}._variants_vl21a_324{margin-top:4px}._variantList_vl21a_328{list-style:none;padding:0;margin:0;display:grid;gap:10px}._variantRow_vl21a_336{display:grid;grid-template-columns:1fr auto;gap:0px;align-items:stretch;padding:5px}._variantLeft_vl21a_344{min-width:0;display:flex;gap:12px;align-items:center}._addToBundleButton_vl21a_351{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_vl21a_351:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._addToBundleButton_vl21a_351:disabled{opacity:.6;cursor:not-allowed}._addToBundleButton_vl21a_351:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._variantThumb_vl21a_379{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_vl21a_389{width:100%;height:100%;object-fit:cover;display:block}._variantThumbFallback_vl21a_396{width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-weight:800;color:var(--bb-text-color, #111827)}._variantInfo_vl21a_406{min-width:0}._variantName_vl21a_410{font-size:14px;font-weight:600;margin-bottom:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._variantMeta_vl21a_419{font-size:12px;color:var(--bb-muted-color, rgba(17, 24, 39, .6));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._variantPriceRow_vl21a_427{display:flex;align-items:baseline;gap:8px;margin-top:4px}._variantCompareAt_vl21a_434{font-size:12px;color:var(--bb-muted-color, rgba(17, 24, 39, .6));text-decoration:line-through}._variantPrice_vl21a_427{font-size:13px;font-weight:800}._qtyControls_vl21a_445{display:inline-flex;align-items:center;gap:6px}._qtyButton_vl21a_451{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_vl21a_451:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._qtyButton_vl21a_451:disabled{opacity:.6;cursor:not-allowed}._qtyButton_vl21a_451:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._qtyValue_vl21a_476{min-width:18px;text-align:center;font-variant-numeric:tabular-nums;font-weight:700}._footer_vl21a_483{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}._poweredBy_vl21a_490{font-size:10px;color:var(rgba(17, 24, 39, .6));text-align:center;margin-top:10px}._poweredBy_vl21a_490 a{color:inherit;text-decoration:none}._boxSummaryWindow_vl21a_502{margin-bottom:6px;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;padding-bottom:6px;scrollbar-width:none;-ms-overflow-style:none}._boxSummaryWindow_vl21a_502::-webkit-scrollbar{display:none}._boxSummaryRow_vl21a_519{--bb-box-gap: 10px;display:flex;align-items:flex-start;gap:var(--bb-box-gap);width:100%}._boxSlot_vl21a_527{flex:0 0 calc((100% - (4 * var(--bb-box-gap))) / 5);display:flex;flex-direction:column;align-items:stretch;gap:6px}._boxItem_vl21a_535{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_vl21a_547{cursor:pointer}._boxItemClickable_vl21a_547:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._boxThresholdLabel_vl21a_556{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_vl21a_567{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_vl21a_573{border:1px solid var(--bb-border-color, rgba(17, 24, 39, .08));background:var(--bb-surface-bg, #ffffff);overflow:hidden}._boxItemThreshold_vl21a_579{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_vl21a_587{font-size:12px;font-weight:800;text-align:center;line-height:1.1;padding:6px}._boxItemPlus_vl21a_595{font-size:22px;font-weight:700;opacity:.5;line-height:1}._boxItemImage_vl21a_602{width:100%;height:100%;object-fit:cover;display:block}._boxItemFallback_vl21a_609{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}._ctaButtonGroup_vl21a_620{display:flex;gap:8px;width:100%;transition:gap .3s cubic-bezier(.4,0,.2,1)}._ctaButtonGroupAnimating_vl21a_627{gap:0}._cta_vl21a_620{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}._ctaSecondary_vl21a_643{width:100%;border:2px solid var(--bb-cta-bg, #2563eb);background:transparent;color:var(--bb-cta-bg, #2563eb);font:inherit;font-weight:700;padding:10px 14px;border-radius:12px;cursor:pointer}._ctaDualLeft_vl21a_655{width:100%;border:2px solid var(--bb-cta-bg, #2563eb);background:transparent;color:var(--bb-cta-bg, #2563eb);font:inherit;font-weight:700;padding:10px 14px;border-radius:12px;cursor:pointer;transition:border-radius .3s cubic-bezier(.4,0,.2,1),background .3s cubic-bezier(.4,0,.2,1),color .3s cubic-bezier(.4,0,.2,1),border-right-width .3s cubic-bezier(.4,0,.2,1),opacity .3s cubic-bezier(.4,0,.2,1)}._ctaDualLeftAnimating_vl21a_673{border-top-right-radius:0;border-bottom-right-radius:0;border-right-width:0;background:var(--bb-cta-bg, #2563eb);opacity:.6;color:var(--bb-cta-text, #ffffff)}._ctaDualLeftAnimating_vl21a_673>span{opacity:0}._ctaDualRight_vl21a_686{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;transition:border-radius .3s cubic-bezier(.4,0,.2,1),border-left-width .3s cubic-bezier(.4,0,.2,1),opacity .3s cubic-bezier(.4,0,.2,1)}._ctaDualRightAnimating_vl21a_702{border-top-left-radius:0;border-bottom-left-radius:0;border-left-width:0;opacity:.6}._ctaDualRightAnimating_vl21a_702>span{opacity:0}._ctaTotals_vl21a_713{display:flex;justify-content:space-between;align-items:baseline;gap:10px;font-variant-numeric:tabular-nums}._ctaDiscountBadge_vl21a_721{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_vl21a_735{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_vl21a_748{max-height:40px;opacity:1;transform:translateY(0);margin-bottom:8px}._ctaTotalsStrike_vl21a_755{opacity:.85;text-decoration:line-through;font-weight:700;color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65))}._ctaTotalsPrice_vl21a_762{font-weight:900;color:var(--bb-text-color, #111827)}@media(prefers-reduced-motion:reduce){._ctaTotalsWrap_vl21a_735{transition:none}}._cta_vl21a_620:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._cta_vl21a_620:disabled{opacity:.6;cursor:not-allowed}._cta_vl21a_620:focus-visible{outline:2px solid var(--bb-cta-focus-ring, var(--bb-text-color, #111827));outline-offset:2px}._ctaSecondary_vl21a_643:hover{background:var(--bb-cta-bg, #2563eb);color:var(--bb-cta-text, #ffffff)}._ctaSecondary_vl21a_643:disabled{opacity:.6;cursor:not-allowed}._ctaSecondary_vl21a_643:focus-visible{outline:2px solid var(--bb-cta-focus-ring, var(--bb-text-color, #111827));outline-offset:2px}._ctaDualLeft_vl21a_655:hover{background:var(--bb-cta-bg, #2563eb);color:var(--bb-cta-text, #ffffff)}._ctaDualLeft_vl21a_655:disabled{opacity:.6;cursor:not-allowed}._ctaDualLeft_vl21a_655:focus-visible{outline:2px solid var(--bb-cta-focus-ring, var(--bb-text-color, #111827));outline-offset:2px}._ctaDualRight_vl21a_686:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._ctaDualRight_vl21a_686:disabled{opacity:.6;cursor:not-allowed}._ctaDualRight_vl21a_686:focus-visible{outline:2px solid var(--bb-cta-focus-ring, var(--bb-text-color, #111827));outline-offset:2px}._helperText_vl21a_831{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_vl21a_1{padding:0;justify-content:stretch}._panel_vl21a_82{width:100%;height:100%;border-radius:0}}')),document.head.appendChild(a)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
- import { jsx as h, jsxs as k, Fragment as fe } from "react/jsx-runtime";
3
- import Ft, { useState as O, useRef as U, useEffect as z, useCallback as dt, useMemo as M, createContext as me, useContext as pe, forwardRef as se, createElement as Vt } from "react";
4
- const kt = {
2
+ import { jsx as h, jsxs as O, Fragment as mt } from "react/jsx-runtime";
3
+ import qe, { useState as P, useRef as L, useEffect as $, useCallback as ue, useMemo as T, createContext as pt, useContext as vt, forwardRef as lt, createElement as Ge } from "react";
4
+ const Fe = {
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 be(i) {
11
- const t = new URL("/api/public/bundle-config", i.apiBaseUrl);
12
- t.searchParams.set("shop", i.shop);
13
- const a = await (await fetch(t, {
10
+ async function bt(i) {
11
+ const e = new URL("/api/public/bundle-config", i.apiBaseUrl);
12
+ e.searchParams.set("shop", i.shop);
13
+ const r = await (await fetch(e, {
14
14
  method: "GET",
15
15
  signal: i.signal,
16
16
  headers: { "Content-Type": "application/json" }
17
17
  })).json().catch(() => null);
18
- return !a || typeof a != "object" ? { ok: !1, error: "Invalid response." } : a;
18
+ return !r || typeof r != "object" ? { ok: !1, error: "Invalid response." } : r;
19
19
  }
20
- const ne = "bb_anonymous_user_id";
21
- function At() {
20
+ const at = "bb_anonymous_user_id";
21
+ function Ae() {
22
22
  if (typeof window > "u" || typeof localStorage > "u")
23
23
  return `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
24
24
  try {
25
- const i = localStorage.getItem(ne);
25
+ const i = localStorage.getItem(at);
26
26
  if (i && typeof i == "string" && i.length > 0)
27
27
  return i;
28
- let t;
28
+ let e;
29
29
  try {
30
- const e = globalThis.crypto;
31
- if (e != null && e.randomUUID)
32
- t = e.randomUUID();
30
+ const t = globalThis.crypto;
31
+ if (t != null && t.randomUUID)
32
+ e = t.randomUUID();
33
33
  else
34
34
  throw new Error("crypto.randomUUID not available");
35
35
  } catch {
36
- t = `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
36
+ e = `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
37
37
  }
38
- return localStorage.setItem(ne, t), t;
38
+ return localStorage.setItem(at, e), e;
39
39
  } catch {
40
40
  return `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
41
41
  }
42
42
  }
43
- async function Rt(i, t, e) {
43
+ async function Re(i, e, t) {
44
44
  if (!(typeof window > "u"))
45
45
  try {
46
- const a = new URL(i, window.location.origin);
47
- a.searchParams.set("shop", t);
48
- const r = await fetch(a, {
46
+ const r = new URL(i, window.location.origin);
47
+ r.searchParams.set("shop", e);
48
+ const a = await fetch(r, {
49
49
  method: "POST",
50
50
  headers: {
51
51
  "Content-Type": "application/json"
52
52
  },
53
- body: JSON.stringify(e),
53
+ body: JSON.stringify(t),
54
54
  // Don't wait for response - fire and forget
55
55
  keepalive: !0
56
56
  });
57
- r.ok || console.warn(
58
- `[Bundle Analytics] Event tracking failed with status ${r.status}:`,
59
- await r.text().catch(() => "Unable to read response")
57
+ a.ok || console.warn(
58
+ `[Bundle Analytics] Event tracking failed with status ${a.status}:`,
59
+ await a.text().catch(() => "Unable to read response")
60
60
  );
61
- } catch (a) {
62
- console.warn("[Bundle Analytics] Failed to track event:", a);
61
+ } catch (r) {
62
+ console.warn("[Bundle Analytics] Failed to track event:", r);
63
63
  }
64
64
  }
65
- const ce = me(null);
66
- function ve() {
65
+ const ut = pt(null);
66
+ function yt() {
67
67
  try {
68
68
  const i = globalThis.crypto;
69
69
  if (i != null && i.randomUUID) return i.randomUUID();
@@ -71,49 +71,49 @@ function ve() {
71
71
  }
72
72
  return `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
73
73
  }
74
- function re(i) {
74
+ function it(i) {
75
75
  return Number.isFinite(i) ? Math.max(0, Math.floor(i)) : 0;
76
76
  }
77
77
  function rr(i) {
78
78
  const {
79
- apiBaseUrl: t,
80
- shop: e,
81
- cartAdapter: a,
82
- configHandle: r = "default",
79
+ apiBaseUrl: e,
80
+ shop: t,
81
+ cartAdapter: r,
82
+ configHandle: a = "default",
83
83
  initialData: n,
84
84
  configFetcher: l,
85
85
  analyticsEndpoint: c,
86
86
  children: m
87
- } = i, w = c ?? `${t}/api/public/bundle-analytics`, [A, R] = O(!1), [x, J] = O(!n), [E, H] = O(!1), [L, P] = O(null), [F, V] = O((n == null ? void 0 : n.currencyCode) ?? null), [g, ft] = O((n == null ? void 0 : n.config) ?? null), [st, wt] = O(
87
+ } = i, w = c ?? `${e}/api/public/bundle-analytics`, [k, F] = P(!1), [x, X] = P(!n), [V, Z] = P(!1), [z, M] = P(null), [A, W] = P((n == null ? void 0 : n.currencyCode) ?? null), [g, he] = P((n == null ? void 0 : n.config) ?? null), [se, _e] = P(
88
88
  (n == null ? void 0 : n.eligibleVariants) ?? []
89
- ), [mt, St] = O(
89
+ ), [fe, Ne] = P(
90
90
  () => ({ selections: {}, order: [] })
91
- ), Nt = U(null);
92
- z(() => {
91
+ ), Te = L(null);
92
+ $(() => {
93
93
  var D;
94
94
  if (n) return;
95
- (D = Nt.current) == null || D.abort();
95
+ (D = Te.current) == null || D.abort();
96
96
  const f = new AbortController();
97
- Nt.current = f;
98
- const C = l ?? be;
99
- return J(!0), P(null), C({ apiBaseUrl: t, shop: e, signal: f.signal }).then((y) => {
97
+ Te.current = f;
98
+ const C = l ?? bt;
99
+ return X(!0), M(null), C({ apiBaseUrl: e, shop: t, signal: f.signal }).then((y) => {
100
100
  if (!y.ok) {
101
- P(y.error || "Failed to load bundle config."), ft(null), wt([]), V(null);
101
+ M(y.error || "Failed to load bundle config."), he(null), _e([]), W(null);
102
102
  return;
103
103
  }
104
- V(y.currencyCode ?? null), ft(y.config), wt(y.eligibleVariants ?? []);
104
+ W(y.currencyCode ?? null), he(y.config), _e(y.eligibleVariants ?? []);
105
105
  }).catch((y) => {
106
- const rt = y instanceof Error ? y.message : "Failed to load bundle config.";
107
- P(rt), ft(null), wt([]), V(null);
108
- }).finally(() => J(!1)), () => f.abort();
109
- }, [t, e, n, l]);
110
- const Tt = dt(() => {
111
- if (R(!0), w)
106
+ const ne = y instanceof Error ? y.message : "Failed to load bundle config.";
107
+ M(ne), he(null), _e([]), W(null);
108
+ }).finally(() => X(!1)), () => f.abort();
109
+ }, [e, t, n, l]);
110
+ const Me = ue(() => {
111
+ if (F(!0), w)
112
112
  try {
113
- const f = At();
114
- Rt(w, e, {
113
+ const f = Ae();
114
+ Re(w, t, {
115
115
  eventType: "DRAWER_OPENED",
116
- shop: e,
116
+ shop: t,
117
117
  anonymousUserId: f,
118
118
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
119
119
  }).catch((C) => {
@@ -122,14 +122,14 @@ function rr(i) {
122
122
  } catch (f) {
123
123
  console.warn("[Bundle Analytics] Error in open() callback:", f);
124
124
  }
125
- }, [w, e]), pt = dt(() => R(!1), []), Mt = dt(() => {
126
- R((f) => {
125
+ }, [w, t]), me = ue(() => F(!1), []), Pe = ue(() => {
126
+ F((f) => {
127
127
  if (!f && w)
128
128
  try {
129
- const C = At();
130
- Rt(w, e, {
129
+ const C = Ae();
130
+ Re(w, t, {
131
131
  eventType: "DRAWER_OPENED",
132
- shop: e,
132
+ shop: t,
133
133
  anonymousUserId: C,
134
134
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
135
135
  }).catch((D) => {
@@ -140,385 +140,390 @@ function rr(i) {
140
140
  }
141
141
  return !f;
142
142
  });
143
- }, [w, e]), Pt = M(() => {
143
+ }, [w, t]), Oe = T(() => {
144
144
  const f = Number((g == null ? void 0 : g.maxBundleSize) ?? NaN), C = Number.isFinite(f) ? Math.floor(f) : 100;
145
145
  return Math.max(2, Math.min(100, C));
146
- }, [g == null ? void 0 : g.maxBundleSize]), bt = M(() => new Set(st.map((f) => f.id)), [st]), tt = dt((f, C) => {
147
- if (!bt.has(f))
146
+ }, [g == null ? void 0 : g.maxBundleSize]), pe = T(() => new Set(se.map((f) => f.id)), [se]), J = ue((f, C) => {
147
+ if (!pe.has(f))
148
148
  return;
149
- const D = re(C);
150
- St((y) => {
151
- const rt = y.selections[f] ?? 0, q = D - rt, G = Object.values(y.selections).reduce(($, Y) => $ + (Y || 0), 0), B = q > 0 ? Math.min(q, Math.max(0, Pt - G)) : q, at = rt + B;
149
+ const D = it(C);
150
+ Ne((y) => {
151
+ const ne = y.selections[f] ?? 0, q = D - ne, G = Object.values(y.selections).reduce((E, Y) => E + (Y || 0), 0), B = q > 0 ? Math.min(q, Math.max(0, Oe - G)) : q, re = ne + B;
152
152
  let Q;
153
- if (at <= 0) {
154
- const { [f]: $, ...Y } = y.selections;
153
+ if (re <= 0) {
154
+ const { [f]: E, ...Y } = y.selections;
155
155
  Q = Y;
156
- } else rt === at ? Q = y.selections : Q = { ...y.selections, [f]: at };
157
- let it = y.order;
156
+ } else ne === re ? Q = y.selections : Q = { ...y.selections, [f]: re };
157
+ let ae = y.order;
158
158
  if (B > 0)
159
- it = [...y.order, ...Array.from({ length: B }, () => f)];
159
+ ae = [...y.order, ...Array.from({ length: B }, () => f)];
160
160
  else if (B < 0) {
161
- let $ = -B;
161
+ let E = -B;
162
162
  const Y = [];
163
- for (let T = y.order.length - 1; T >= 0; T--) {
164
- const S = y.order[T];
165
- if (S === f && $ > 0) {
166
- $--;
163
+ for (let N = y.order.length - 1; N >= 0; N--) {
164
+ const R = y.order[N];
165
+ if (R === f && E > 0) {
166
+ E--;
167
167
  continue;
168
168
  }
169
- Y.push(S);
169
+ Y.push(R);
170
170
  }
171
- Y.reverse(), it = Y;
171
+ Y.reverse(), ae = Y;
172
172
  }
173
- if (Q === y.selections && it === y.order) return y;
173
+ if (Q === y.selections && ae === y.order) return y;
174
174
  if (w)
175
175
  try {
176
- const $ = At();
177
- Rt(w, e, {
176
+ const E = Ae();
177
+ Re(w, t, {
178
178
  eventType: "VARIANT_SELECTION_CHANGED",
179
- shop: e,
180
- anonymousUserId: $,
179
+ shop: t,
180
+ anonymousUserId: E,
181
181
  before: { ...y.selections },
182
182
  after: { ...Q },
183
183
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
184
184
  });
185
185
  } catch {
186
186
  }
187
- return { selections: Q, order: it };
187
+ return { selections: Q, order: ae };
188
188
  });
189
- }, [Pt, bt, w, e]), vt = dt(() => St({ selections: {}, order: [] }), []), X = mt.selections, xt = mt.order, ct = M(() => Object.values(X).reduce((f, C) => f + (C || 0), 0), [X]), et = M(() => {
189
+ }, [Oe, pe, w, t]), ve = ue(() => Ne({ selections: {}, order: [] }), []), K = fe.selections, Ie = fe.order, ce = T(() => Object.values(K).reduce((f, C) => f + (C || 0), 0), [K]), ee = T(() => {
190
190
  const f = (g == null ? void 0 : g.rules) ?? [], C = f.length ? Math.min(...f.map((D) => D.minBundleSize)) : 2;
191
191
  return Number.isFinite(C) && C > 0 ? C : 2;
192
- }, [g]), gt = M(() => !(x || E || L || !(g != null && g.isActive) || ct < et), [ct, g == null ? void 0 : g.isActive, L, x, et, E]), lt = dt(async (f) => {
193
- var S;
194
- if (!gt || !g) return;
195
- const C = ve(), D = (g.title ?? "").trim().slice(0, 255), y = Object.entries(X).map(([v, K]) => ({ merchandiseId: v, quantity: re(K) })).filter((v) => v.quantity > 0).filter((v) => bt.has(v.merchandiseId)).map((v) => ({
196
- merchandiseId: v.merchandiseId,
197
- quantity: v.quantity,
192
+ }, [g]), we = T(() => !(x || V || z || !(g != null && g.isActive) || ce < ee), [ce, g == null ? void 0 : g.isActive, z, x, ee, V]), le = ue(async (f) => {
193
+ var R, ge;
194
+ if (!we || !g) return;
195
+ const C = yt(), D = (g.title ?? "").trim().slice(0, 255), y = Object.entries(K).map(([b, be]) => ({ merchandiseId: b, quantity: it(be) })).filter((b) => b.quantity > 0).filter((b) => pe.has(b.merchandiseId)).map((b) => ({
196
+ merchandiseId: b.merchandiseId,
197
+ quantity: b.quantity,
198
198
  attributes: [
199
- { key: kt.bundleId, value: C },
200
- { key: kt.bundleConfig, value: r },
201
- { key: kt.bundleSource, value: "bundle_builder" },
202
- ...D ? [{ key: kt.bundleTitle, value: D }] : []
199
+ { key: Fe.bundleId, value: C },
200
+ { key: Fe.bundleConfig, value: a },
201
+ { key: Fe.bundleSource, value: "bundle_builder" },
202
+ ...D ? [{ key: Fe.bundleTitle, value: D }] : []
203
203
  ]
204
204
  }));
205
205
  if (!y.length) return;
206
- const rt = new Map(st.map((v) => [v.id, v]));
206
+ const ne = new Map(se.map((b) => [b.id, b]));
207
207
  let q = 0;
208
- for (const [v, K] of Object.entries(X)) {
209
- const Ot = K ?? 0;
210
- if (Ot <= 0) continue;
211
- const _t = rt.get(v), ut = Number(_t == null ? void 0 : _t.price);
212
- Number.isFinite(ut) && (q += ut * Ot);
208
+ for (const [b, be] of Object.entries(K)) {
209
+ const xe = be ?? 0;
210
+ if (xe <= 0) continue;
211
+ const ie = ne.get(b), ke = Number(ie == null ? void 0 : ie.price);
212
+ Number.isFinite(ke) && (q += ke * xe);
213
213
  }
214
214
  q = Math.round(q * 100) / 100;
215
- const G = [...g.rules ?? []].sort((v, K) => v.minBundleSize - K.minBundleSize);
215
+ const G = [...g.rules ?? []].sort((b, be) => b.minBundleSize - be.minBundleSize);
216
216
  let B = null;
217
- for (const v of G)
218
- ct >= v.minBundleSize && (B = v);
219
- const at = B ? (() => {
220
- const v = Number.parseFloat(B.discountPercent);
221
- return Number.isFinite(v) && v > 0 ? v : null;
222
- })() : null, Q = at ? Math.round(q * (1 - at / 100) * 100) / 100 : q, it = q - Q, $ = y.map((v) => v.merchandiseId), Y = (B == null ? void 0 : B.handle) ?? "", T = ((S = B == null ? void 0 : B.label) == null ? void 0 : S.trim()) || "";
223
- H(!0);
217
+ for (const b of G)
218
+ ce >= b.minBundleSize && (B = b);
219
+ const re = B ? (() => {
220
+ const b = Number.parseFloat(B.discountPercent);
221
+ return Number.isFinite(b) && b > 0 ? b : null;
222
+ })() : null, Q = re ? Math.round(q * (1 - re / 100) * 100) / 100 : q, ae = q - Q, E = y.map((b) => b.merchandiseId), Y = (B == null ? void 0 : B.handle) ?? "", N = ((R = B == null ? void 0 : B.label) == null ? void 0 : R.trim()) || "";
223
+ Z(!0);
224
224
  try {
225
- if (await a.linesAdd(y), w)
225
+ if (f != null && f.checkout ? await r.linesAddForCheckout(y) : await r.linesAdd(y), w)
226
226
  try {
227
- const v = At();
228
- Rt(w, e, {
227
+ const b = Ae();
228
+ Re(w, t, {
229
229
  eventType: "BUNDLE_ADDED_TO_BASKET",
230
- shop: e,
231
- anonymousUserId: v,
230
+ shop: t,
231
+ anonymousUserId: b,
232
232
  bundleId: C,
233
- productVariantIds: $,
233
+ productVariantIds: E,
234
234
  grossPrice: q,
235
235
  discountedPrice: Q,
236
- currency: F ?? void 0,
236
+ currency: A ?? void 0,
237
237
  discountThresholdIdentifier: Y,
238
- discountLabel: T,
239
- discountPercentage: at,
240
- discountedAmount: it,
238
+ discountLabel: N,
239
+ discountPercentage: re,
240
+ discountedAmount: ae,
241
241
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
242
242
  });
243
243
  } catch {
244
244
  }
245
- vt(), pt(), f == null || f();
245
+ ve(), me(), (ge = f == null ? void 0 : f.onComplete) == null || ge.call(f);
246
246
  } finally {
247
- H(!1);
247
+ Z(!1);
248
248
  }
249
249
  }, [
250
- gt,
251
- a,
252
- vt,
253
- pt,
254
- g,
250
+ we,
255
251
  r,
256
- F,
257
- X,
258
- bt,
259
- st,
260
- ct,
252
+ ve,
253
+ me,
254
+ g,
255
+ a,
256
+ A,
257
+ K,
258
+ pe,
259
+ se,
260
+ ce,
261
261
  w,
262
- e
263
- ]), It = dt(async () => {
264
- await lt(
265
- () => {
266
- var f;
267
- (f = a.openCartUI) == null || f.call(a);
262
+ t
263
+ ]), Ce = ue(async () => {
264
+ await le(
265
+ {
266
+ onComplete: () => {
267
+ var f;
268
+ (f = r.openCartUI) == null || f.call(r);
269
+ }
268
270
  }
269
271
  );
270
- }, [lt, a]), nt = dt(async () => {
271
- await lt(
272
- () => {
273
- var f;
274
- (f = a.navigateToCheckout) == null || f.call(a);
272
+ }, [le, r]), te = ue(async () => {
273
+ await le(
274
+ {
275
+ checkout: !0,
276
+ onComplete: () => {
277
+ var f;
278
+ (f = r.navigateToCheckout) == null || f.call(r);
279
+ }
275
280
  }
276
281
  );
277
- }, [lt, a]), Dt = M(
282
+ }, [le, r]), Ee = T(
278
283
  () => ({
279
- isOpen: A,
280
- open: Tt,
281
- close: pt,
282
- toggle: Mt,
284
+ isOpen: k,
285
+ open: Me,
286
+ close: me,
287
+ toggle: Pe,
283
288
  loading: x,
284
- submitting: E,
285
- error: L,
286
- currencyCode: F,
289
+ submitting: V,
290
+ error: z,
291
+ currencyCode: A,
287
292
  config: g,
288
- eligibleVariants: st,
289
- selections: X,
290
- selectionOrder: xt,
291
- setQuantity: tt,
292
- clearSelections: vt,
293
- bundleSize: ct,
294
- minRequired: et,
295
- canSubmit: gt,
296
- submit: It,
297
- submitAndCheckout: nt
293
+ eligibleVariants: se,
294
+ selections: K,
295
+ selectionOrder: Ie,
296
+ setQuantity: J,
297
+ clearSelections: ve,
298
+ bundleSize: ce,
299
+ minRequired: ee,
300
+ canSubmit: we,
301
+ submit: Ce,
302
+ submitAndCheckout: te
298
303
  }),
299
304
  [
300
- A,
301
- Tt,
302
- pt,
303
- Mt,
305
+ k,
306
+ Me,
307
+ me,
308
+ Pe,
304
309
  x,
305
- E,
306
- L,
307
- F,
310
+ V,
311
+ z,
312
+ A,
308
313
  g,
309
- st,
310
- X,
311
- xt,
312
- tt,
313
- vt,
314
- ct,
315
- et,
316
- gt,
317
- It,
318
- nt
314
+ se,
315
+ K,
316
+ Ie,
317
+ J,
318
+ ve,
319
+ ce,
320
+ ee,
321
+ we,
322
+ Ce,
323
+ te
319
324
  ]
320
325
  );
321
- return /* @__PURE__ */ h(ce.Provider, { value: Dt, children: m });
326
+ return /* @__PURE__ */ h(ut.Provider, { value: Ee, children: m });
322
327
  }
323
- function jt() {
324
- const i = pe(ce);
328
+ function Qe() {
329
+ const i = vt(ut);
325
330
  if (!i)
326
331
  throw new Error("useBundleBuilder must be used within <BundleProvider />");
327
332
  return i;
328
333
  }
329
334
  function ar() {
330
- const { isOpen: i, open: t, close: e, toggle: a } = jt();
331
- return { isOpen: i, open: t, close: e, toggle: a };
335
+ const { isOpen: i, open: e, close: t, toggle: r } = Qe();
336
+ return { isOpen: i, open: e, close: t, toggle: r };
332
337
  }
333
- const _e = "_button_18rtl_1", ye = {
334
- button: _e
338
+ const _t = "_button_18rtl_1", wt = {
339
+ button: _t
335
340
  };
336
341
  function ir(i) {
337
- const { toggle: t } = jt();
342
+ const { toggle: e } = Qe();
338
343
  return /* @__PURE__ */ h(
339
344
  "button",
340
345
  {
341
346
  type: "button",
342
- onClick: t,
343
- className: [ye.button, i.className].filter(Boolean).join(" "),
347
+ onClick: e,
348
+ className: [wt.button, i.className].filter(Boolean).join(" "),
344
349
  children: i.children ?? "Build a bundle"
345
350
  }
346
351
  );
347
352
  }
348
- var Ut, ae;
349
- function we() {
350
- if (ae) return Ut;
351
- ae = 1;
353
+ var We, ot;
354
+ function gt() {
355
+ if (ot) return We;
356
+ ot = 1;
352
357
  var i = {
353
- linear: function(t, e, a, r) {
354
- var n = a - e;
355
- return n * t / r + e;
358
+ linear: function(e, t, r, a) {
359
+ var n = r - t;
360
+ return n * e / a + t;
356
361
  },
357
- easeInQuad: function(t, e, a, r) {
358
- var n = a - e;
359
- return n * (t /= r) * t + e;
362
+ easeInQuad: function(e, t, r, a) {
363
+ var n = r - t;
364
+ return n * (e /= a) * e + t;
360
365
  },
361
- easeOutQuad: function(t, e, a, r) {
362
- var n = a - e;
363
- return -n * (t /= r) * (t - 2) + e;
366
+ easeOutQuad: function(e, t, r, a) {
367
+ var n = r - t;
368
+ return -n * (e /= a) * (e - 2) + t;
364
369
  },
365
- easeInOutQuad: function(t, e, a, r) {
366
- var n = a - e;
367
- return (t /= r / 2) < 1 ? n / 2 * t * t + e : -n / 2 * (--t * (t - 2) - 1) + e;
370
+ easeInOutQuad: function(e, t, r, a) {
371
+ var n = r - t;
372
+ return (e /= a / 2) < 1 ? n / 2 * e * e + t : -n / 2 * (--e * (e - 2) - 1) + t;
368
373
  },
369
- easeInCubic: function(t, e, a, r) {
370
- var n = a - e;
371
- return n * (t /= r) * t * t + e;
374
+ easeInCubic: function(e, t, r, a) {
375
+ var n = r - t;
376
+ return n * (e /= a) * e * e + t;
372
377
  },
373
- easeOutCubic: function(t, e, a, r) {
374
- var n = a - e;
375
- return n * ((t = t / r - 1) * t * t + 1) + e;
378
+ easeOutCubic: function(e, t, r, a) {
379
+ var n = r - t;
380
+ return n * ((e = e / a - 1) * e * e + 1) + t;
376
381
  },
377
- easeInOutCubic: function(t, e, a, r) {
378
- var n = a - e;
379
- return (t /= r / 2) < 1 ? n / 2 * t * t * t + e : n / 2 * ((t -= 2) * t * t + 2) + e;
382
+ easeInOutCubic: function(e, t, r, a) {
383
+ var n = r - t;
384
+ return (e /= a / 2) < 1 ? n / 2 * e * e * e + t : n / 2 * ((e -= 2) * e * e + 2) + t;
380
385
  },
381
- easeInQuart: function(t, e, a, r) {
382
- var n = a - e;
383
- return n * (t /= r) * t * t * t + e;
386
+ easeInQuart: function(e, t, r, a) {
387
+ var n = r - t;
388
+ return n * (e /= a) * e * e * e + t;
384
389
  },
385
- easeOutQuart: function(t, e, a, r) {
386
- var n = a - e;
387
- return -n * ((t = t / r - 1) * t * t * t - 1) + e;
390
+ easeOutQuart: function(e, t, r, a) {
391
+ var n = r - t;
392
+ return -n * ((e = e / a - 1) * e * e * e - 1) + t;
388
393
  },
389
- easeInOutQuart: function(t, e, a, r) {
390
- var n = a - e;
391
- return (t /= r / 2) < 1 ? n / 2 * t * t * t * t + e : -n / 2 * ((t -= 2) * t * t * t - 2) + e;
394
+ easeInOutQuart: function(e, t, r, a) {
395
+ var n = r - t;
396
+ return (e /= a / 2) < 1 ? n / 2 * e * e * e * e + t : -n / 2 * ((e -= 2) * e * e * e - 2) + t;
392
397
  },
393
- easeInQuint: function(t, e, a, r) {
394
- var n = a - e;
395
- return n * (t /= r) * t * t * t * t + e;
398
+ easeInQuint: function(e, t, r, a) {
399
+ var n = r - t;
400
+ return n * (e /= a) * e * e * e * e + t;
396
401
  },
397
- easeOutQuint: function(t, e, a, r) {
398
- var n = a - e;
399
- return n * ((t = t / r - 1) * t * t * t * t + 1) + e;
402
+ easeOutQuint: function(e, t, r, a) {
403
+ var n = r - t;
404
+ return n * ((e = e / a - 1) * e * e * e * e + 1) + t;
400
405
  },
401
- easeInOutQuint: function(t, e, a, r) {
402
- var n = a - e;
403
- return (t /= r / 2) < 1 ? n / 2 * t * t * t * t * t + e : n / 2 * ((t -= 2) * t * t * t * t + 2) + e;
406
+ easeInOutQuint: function(e, t, r, a) {
407
+ var n = r - t;
408
+ return (e /= a / 2) < 1 ? n / 2 * e * e * e * e * e + t : n / 2 * ((e -= 2) * e * e * e * e + 2) + t;
404
409
  },
405
- easeInSine: function(t, e, a, r) {
406
- var n = a - e;
407
- return -n * Math.cos(t / r * (Math.PI / 2)) + n + e;
410
+ easeInSine: function(e, t, r, a) {
411
+ var n = r - t;
412
+ return -n * Math.cos(e / a * (Math.PI / 2)) + n + t;
408
413
  },
409
- easeOutSine: function(t, e, a, r) {
410
- var n = a - e;
411
- return n * Math.sin(t / r * (Math.PI / 2)) + e;
414
+ easeOutSine: function(e, t, r, a) {
415
+ var n = r - t;
416
+ return n * Math.sin(e / a * (Math.PI / 2)) + t;
412
417
  },
413
- easeInOutSine: function(t, e, a, r) {
414
- var n = a - e;
415
- return -n / 2 * (Math.cos(Math.PI * t / r) - 1) + e;
418
+ easeInOutSine: function(e, t, r, a) {
419
+ var n = r - t;
420
+ return -n / 2 * (Math.cos(Math.PI * e / a) - 1) + t;
416
421
  },
417
- easeInExpo: function(t, e, a, r) {
418
- var n = a - e;
419
- return t == 0 ? e : n * Math.pow(2, 10 * (t / r - 1)) + e;
422
+ easeInExpo: function(e, t, r, a) {
423
+ var n = r - t;
424
+ return e == 0 ? t : n * Math.pow(2, 10 * (e / a - 1)) + t;
420
425
  },
421
- easeOutExpo: function(t, e, a, r) {
422
- var n = a - e;
423
- return t == r ? e + n : n * (-Math.pow(2, -10 * t / r) + 1) + e;
426
+ easeOutExpo: function(e, t, r, a) {
427
+ var n = r - t;
428
+ return e == a ? t + n : n * (-Math.pow(2, -10 * e / a) + 1) + t;
424
429
  },
425
- easeInOutExpo: function(t, e, a, r) {
426
- var n = a - e;
427
- 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;
430
+ easeInOutExpo: function(e, t, r, a) {
431
+ var n = r - t;
432
+ return e === 0 ? t : e === a ? t + n : (e /= a / 2) < 1 ? n / 2 * Math.pow(2, 10 * (e - 1)) + t : n / 2 * (-Math.pow(2, -10 * --e) + 2) + t;
428
433
  },
429
- easeInCirc: function(t, e, a, r) {
430
- var n = a - e;
431
- return -n * (Math.sqrt(1 - (t /= r) * t) - 1) + e;
434
+ easeInCirc: function(e, t, r, a) {
435
+ var n = r - t;
436
+ return -n * (Math.sqrt(1 - (e /= a) * e) - 1) + t;
432
437
  },
433
- easeOutCirc: function(t, e, a, r) {
434
- var n = a - e;
435
- return n * Math.sqrt(1 - (t = t / r - 1) * t) + e;
438
+ easeOutCirc: function(e, t, r, a) {
439
+ var n = r - t;
440
+ return n * Math.sqrt(1 - (e = e / a - 1) * e) + t;
436
441
  },
437
- easeInOutCirc: function(t, e, a, r) {
438
- var n = a - e;
439
- return (t /= r / 2) < 1 ? -n / 2 * (Math.sqrt(1 - t * t) - 1) + e : n / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + e;
442
+ easeInOutCirc: function(e, t, r, a) {
443
+ var n = r - t;
444
+ return (e /= a / 2) < 1 ? -n / 2 * (Math.sqrt(1 - e * e) - 1) + t : n / 2 * (Math.sqrt(1 - (e -= 2) * e) + 1) + t;
440
445
  },
441
- easeInElastic: function(t, e, a, r) {
442
- var n = a - e, l, c, m;
443
- return m = 1.70158, c = 0, l = n, t === 0 ? e : (t /= r) === 1 ? e + n : (c || (c = r * 0.3), l < Math.abs(n) ? (l = n, m = c / 4) : m = c / (2 * Math.PI) * Math.asin(n / l), -(l * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * r - m) * (2 * Math.PI) / c)) + e);
446
+ easeInElastic: function(e, t, r, a) {
447
+ var n = r - t, l, c, m;
448
+ return m = 1.70158, c = 0, l = n, e === 0 ? t : (e /= a) === 1 ? t + n : (c || (c = a * 0.3), l < Math.abs(n) ? (l = n, m = c / 4) : m = c / (2 * Math.PI) * Math.asin(n / l), -(l * Math.pow(2, 10 * (e -= 1)) * Math.sin((e * a - m) * (2 * Math.PI) / c)) + t);
444
449
  },
445
- easeOutElastic: function(t, e, a, r) {
446
- var n = a - e, l, c, m;
447
- return m = 1.70158, c = 0, l = n, t === 0 ? e : (t /= r) === 1 ? e + n : (c || (c = r * 0.3), l < Math.abs(n) ? (l = n, m = c / 4) : m = c / (2 * Math.PI) * Math.asin(n / l), l * Math.pow(2, -10 * t) * Math.sin((t * r - m) * (2 * Math.PI) / c) + n + e);
450
+ easeOutElastic: function(e, t, r, a) {
451
+ var n = r - t, l, c, m;
452
+ return m = 1.70158, c = 0, l = n, e === 0 ? t : (e /= a) === 1 ? t + n : (c || (c = a * 0.3), l < Math.abs(n) ? (l = n, m = c / 4) : m = c / (2 * Math.PI) * Math.asin(n / l), l * Math.pow(2, -10 * e) * Math.sin((e * a - m) * (2 * Math.PI) / c) + n + t);
448
453
  },
449
- easeInOutElastic: function(t, e, a, r) {
450
- var n = a - e, l, c, m;
451
- return m = 1.70158, c = 0, l = n, t === 0 ? e : (t /= r / 2) === 2 ? e + n : (c || (c = r * (0.3 * 1.5)), l < Math.abs(n) ? (l = n, m = c / 4) : m = c / (2 * Math.PI) * Math.asin(n / l), t < 1 ? -0.5 * (l * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * r - m) * (2 * Math.PI) / c)) + e : l * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * r - m) * (2 * Math.PI) / c) * 0.5 + n + e);
454
+ easeInOutElastic: function(e, t, r, a) {
455
+ var n = r - t, l, c, m;
456
+ return m = 1.70158, c = 0, l = n, e === 0 ? t : (e /= a / 2) === 2 ? t + n : (c || (c = a * (0.3 * 1.5)), l < Math.abs(n) ? (l = n, m = c / 4) : m = c / (2 * Math.PI) * Math.asin(n / l), e < 1 ? -0.5 * (l * Math.pow(2, 10 * (e -= 1)) * Math.sin((e * a - m) * (2 * Math.PI) / c)) + t : l * Math.pow(2, -10 * (e -= 1)) * Math.sin((e * a - m) * (2 * Math.PI) / c) * 0.5 + n + t);
452
457
  },
453
- easeInBack: function(t, e, a, r, n) {
454
- var l = a - e;
455
- return n === void 0 && (n = 1.70158), l * (t /= r) * t * ((n + 1) * t - n) + e;
458
+ easeInBack: function(e, t, r, a, n) {
459
+ var l = r - t;
460
+ return n === void 0 && (n = 1.70158), l * (e /= a) * e * ((n + 1) * e - n) + t;
456
461
  },
457
- easeOutBack: function(t, e, a, r, n) {
458
- var l = a - e;
459
- return n === void 0 && (n = 1.70158), l * ((t = t / r - 1) * t * ((n + 1) * t + n) + 1) + e;
462
+ easeOutBack: function(e, t, r, a, n) {
463
+ var l = r - t;
464
+ return n === void 0 && (n = 1.70158), l * ((e = e / a - 1) * e * ((n + 1) * e + n) + 1) + t;
460
465
  },
461
- easeInOutBack: function(t, e, a, r, n) {
462
- var l = a - e;
463
- return n === void 0 && (n = 1.70158), (t /= r / 2) < 1 ? l / 2 * (t * t * (((n *= 1.525) + 1) * t - n)) + e : l / 2 * ((t -= 2) * t * (((n *= 1.525) + 1) * t + n) + 2) + e;
466
+ easeInOutBack: function(e, t, r, a, n) {
467
+ var l = r - t;
468
+ return n === void 0 && (n = 1.70158), (e /= a / 2) < 1 ? l / 2 * (e * e * (((n *= 1.525) + 1) * e - n)) + t : l / 2 * ((e -= 2) * e * (((n *= 1.525) + 1) * e + n) + 2) + t;
464
469
  },
465
- easeInBounce: function(t, e, a, r) {
466
- var n = a - e, l;
467
- return l = i.easeOutBounce(r - t, 0, n, r), n - l + e;
470
+ easeInBounce: function(e, t, r, a) {
471
+ var n = r - t, l;
472
+ return l = i.easeOutBounce(a - e, 0, n, a), n - l + t;
468
473
  },
469
- easeOutBounce: function(t, e, a, r) {
470
- var n = a - e;
471
- 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;
474
+ easeOutBounce: function(e, t, r, a) {
475
+ var n = r - t;
476
+ return (e /= a) < 1 / 2.75 ? n * (7.5625 * e * e) + t : e < 2 / 2.75 ? n * (7.5625 * (e -= 1.5 / 2.75) * e + 0.75) + t : e < 2.5 / 2.75 ? n * (7.5625 * (e -= 2.25 / 2.75) * e + 0.9375) + t : n * (7.5625 * (e -= 2.625 / 2.75) * e + 0.984375) + t;
472
477
  },
473
- easeInOutBounce: function(t, e, a, r) {
474
- var n = a - e, l;
475
- return t < r / 2 ? (l = i.easeInBounce(t * 2, 0, n, r), l * 0.5 + e) : (l = i.easeOutBounce(t * 2 - r, 0, n, r), l * 0.5 + n * 0.5 + e);
478
+ easeInOutBounce: function(e, t, r, a) {
479
+ var n = r - t, l;
480
+ return e < a / 2 ? (l = i.easeInBounce(e * 2, 0, n, a), l * 0.5 + t) : (l = i.easeOutBounce(e * 2 - a, 0, n, a), l * 0.5 + n * 0.5 + t);
476
481
  }
477
482
  };
478
- return Ut = i, Ut;
483
+ return We = i, We;
479
484
  }
480
- var ge = we();
481
- function xe(i) {
485
+ var xt = gt();
486
+ function It(i) {
482
487
  return i * Math.PI / 180;
483
488
  }
484
- function W(i, t) {
485
- return i + Math.random() * (t - i);
489
+ function U(i, e) {
490
+ return i + Math.random() * (e - i);
486
491
  }
487
- function Ie(i, t) {
488
- return Math.floor(i + Math.random() * (t - i + 1));
492
+ function Ct(i, e) {
493
+ return Math.floor(i + Math.random() * (e - i + 1));
489
494
  }
490
- var Bt;
495
+ var Se;
491
496
  (function(i) {
492
497
  i[i.Circle = 0] = "Circle", i[i.Square = 1] = "Square", i[i.Strip = 2] = "Strip";
493
- })(Bt || (Bt = {}));
494
- var ht;
498
+ })(Se || (Se = {}));
499
+ var de;
495
500
  (function(i) {
496
501
  i[i.Positive = 1] = "Positive", i[i.Negative = -1] = "Negative";
497
- })(ht || (ht = {}));
498
- const Ce = 1e3 / 60;
499
- class Be {
500
- constructor(t, e, a, r) {
501
- this.getOptions = e;
502
+ })(de || (de = {}));
503
+ const Bt = 1e3 / 60;
504
+ class St {
505
+ constructor(e, t, r, a) {
506
+ this.getOptions = t;
502
507
  const { colors: n, initialVelocityX: l, initialVelocityY: c } = this.getOptions();
503
- this.context = t, this.x = a, this.y = r, this.w = W(5, 20), this.h = W(5, 20), this.radius = W(5, 10), this.vx = typeof l == "number" ? W(-l, l) : W(l.min, l.max), this.vy = typeof c == "number" ? W(-c, 0) : W(c.min, c.max), this.shape = Ie(0, 2), this.angle = xe(W(0, 360)), this.angularSpin = W(-0.2, 0.2), this.color = n[Math.floor(Math.random() * n.length)], this.rotateY = W(0, 1), this.rotationDirection = W(0, 1) ? ht.Positive : ht.Negative;
508
+ this.context = e, this.x = r, this.y = a, this.w = U(5, 20), this.h = U(5, 20), this.radius = U(5, 10), this.vx = typeof l == "number" ? U(-l, l) : U(l.min, l.max), this.vy = typeof c == "number" ? U(-c, 0) : U(c.min, c.max), this.shape = Ct(0, 2), this.angle = It(U(0, 360)), this.angularSpin = U(-0.2, 0.2), this.color = n[Math.floor(Math.random() * n.length)], this.rotateY = U(0, 1), this.rotationDirection = U(0, 1) ? de.Positive : de.Negative;
504
509
  }
505
- update(t) {
506
- const { gravity: e, wind: a, friction: r, opacity: n, drawShape: l } = this.getOptions(), c = t / Ce;
507
- this.x += this.vx * c, this.y += this.vy * c, this.vy += e * c, this.vx += a * c, this.vx *= r ** c, this.vy *= r ** c, this.rotateY >= 1 && this.rotationDirection === ht.Positive ? this.rotationDirection = ht.Negative : this.rotateY <= -1 && this.rotationDirection === ht.Negative && (this.rotationDirection = ht.Positive);
510
+ update(e) {
511
+ const { gravity: t, wind: r, friction: a, opacity: n, drawShape: l } = this.getOptions(), c = e / Bt;
512
+ this.x += this.vx * c, this.y += this.vy * c, this.vy += t * c, this.vx += r * c, this.vx *= a ** c, this.vy *= a ** c, this.rotateY >= 1 && this.rotationDirection === de.Positive ? this.rotationDirection = de.Negative : this.rotateY <= -1 && this.rotationDirection === de.Negative && (this.rotationDirection = de.Positive);
508
513
  const m = 0.1 * this.rotationDirection * c;
509
514
  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, l && typeof l == "function")
510
515
  l.call(this, this.context);
511
516
  else
512
517
  switch (this.shape) {
513
- case Bt.Circle: {
518
+ case Se.Circle: {
514
519
  this.context.beginPath(), this.context.arc(0, 0, this.radius, 0, 2 * Math.PI), this.context.fill();
515
520
  break;
516
521
  }
517
- case Bt.Square: {
522
+ case Se.Square: {
518
523
  this.context.fillRect(-this.w / 2, -this.h / 2, this.w, this.h);
519
524
  break;
520
525
  }
521
- case Bt.Strip: {
526
+ case Se.Strip: {
522
527
  this.context.fillRect(-this.w / 6, -this.h / 2, this.w / 3, this.h);
523
528
  break;
524
529
  }
@@ -526,39 +531,39 @@ class Be {
526
531
  this.context.closePath(), this.context.restore();
527
532
  }
528
533
  }
529
- class Se {
530
- constructor(t, e) {
531
- 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) => {
532
- this.particles.splice(r, 1);
534
+ class Nt {
535
+ constructor(e, t) {
536
+ 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 = (a) => {
537
+ this.particles.splice(a, 1);
533
538
  }, this.getParticle = () => {
534
- const r = W(this.x, this.w + this.x), n = W(this.y, this.h + this.y);
535
- return new Be(this.context, this.getOptions, r, n);
536
- }, this.animate = (r) => {
537
- const { canvas: n, context: l, particlesGenerated: c, lastNumberOfPieces: m } = this, { run: w, recycle: A, numberOfPieces: R, debug: x, tweenFunction: J, tweenDuration: E } = this.getOptions();
539
+ const a = U(this.x, this.w + this.x), n = U(this.y, this.h + this.y);
540
+ return new St(this.context, this.getOptions, a, n);
541
+ }, this.animate = (a) => {
542
+ const { canvas: n, context: l, particlesGenerated: c, lastNumberOfPieces: m } = this, { run: w, recycle: k, numberOfPieces: F, debug: x, tweenFunction: X, tweenDuration: V } = this.getOptions();
538
543
  if (!w)
539
544
  return !1;
540
- const H = this.particles.length, L = A ? H : c;
541
- if (L < R) {
542
- m !== R && (this.tweenProgress = 0, this.tweenFrom = L, this.lastNumberOfPieces = R), this.tweenProgress = Math.min(E, Math.max(0, this.tweenProgress + r));
543
- const P = J(this.tweenProgress, this.tweenFrom, R, E), F = Math.round(P - L);
544
- for (let V = 0; V < F; V++)
545
+ const Z = this.particles.length, z = k ? Z : c;
546
+ if (z < F) {
547
+ m !== F && (this.tweenProgress = 0, this.tweenFrom = z, this.lastNumberOfPieces = F), this.tweenProgress = Math.min(V, Math.max(0, this.tweenProgress + a));
548
+ const M = X(this.tweenProgress, this.tweenFrom, F, V), A = Math.round(M - z);
549
+ for (let W = 0; W < A; W++)
545
550
  this.particles.push(this.getParticle());
546
- this.particlesGenerated += F;
551
+ this.particlesGenerated += A;
547
552
  }
548
- x && (l.font = "12px sans-serif", l.fillStyle = "#333", l.textAlign = "right", l.fillText(`Particles: ${H}`, n.width - 10, n.height - 20));
549
- for (let P = this.particles.length - 1; P >= 0; P--) {
550
- const F = this.particles[P];
551
- F.update(r), (F.y > n.height || F.y < -100 || F.x > n.width + 100 || F.x < -100) && (A && L <= R ? this.particles[P] = this.getParticle() : this.removeParticleAt(P));
553
+ x && (l.font = "12px sans-serif", l.fillStyle = "#333", l.textAlign = "right", l.fillText(`Particles: ${Z}`, n.width - 10, n.height - 20));
554
+ for (let M = this.particles.length - 1; M >= 0; M--) {
555
+ const A = this.particles[M];
556
+ A.update(a), (A.y > n.height || A.y < -100 || A.x > n.width + 100 || A.x < -100) && (k && z <= F ? this.particles[M] = this.getParticle() : this.removeParticleAt(M));
552
557
  }
553
- return H > 0 || L < R;
554
- }, this.canvas = t;
555
- const a = this.canvas.getContext("2d");
556
- if (!a)
558
+ return Z > 0 || z < F;
559
+ }, this.canvas = e;
560
+ const r = this.canvas.getContext("2d");
561
+ if (!r)
557
562
  throw new Error("Could not get canvas context");
558
- this.context = a, this.getOptions = e;
563
+ this.context = r, this.getOptions = t;
559
564
  }
560
565
  }
561
- const Gt = {
566
+ const Ye = {
562
567
  width: typeof window < "u" ? window.innerWidth : 300,
563
568
  height: typeof window < "u" ? window.innerHeight : 200,
564
569
  numberOfPieces: 200,
@@ -588,14 +593,14 @@ const Gt = {
588
593
  ],
589
594
  opacity: 1,
590
595
  debug: !1,
591
- tweenFunction: ge.easeInOutQuad,
596
+ tweenFunction: xt.easeInOutQuad,
592
597
  tweenDuration: 5e3,
593
598
  recycle: !0,
594
599
  run: !0
595
600
  };
596
- class Ne {
597
- constructor(t, e) {
598
- this.lastFrameTime = 0, this.setOptionsWithDefaults = (r) => {
601
+ class Tt {
602
+ constructor(e, t) {
603
+ this.lastFrameTime = 0, this.setOptionsWithDefaults = (a) => {
599
604
  const n = {
600
605
  confettiSource: {
601
606
  x: 0,
@@ -606,55 +611,55 @@ class Ne {
606
611
  };
607
612
  this._options = {
608
613
  ...n,
609
- ...Gt,
610
- ...r
611
- }, Object.assign(this, r.confettiSource);
612
- }, this.update = (r = 0) => {
613
- const { options: { run: n, onConfettiComplete: l, frameRate: c }, canvas: m, context: w } = this, A = Math.min(r - this.lastFrameTime, 50);
614
- if (c && A < 1e3 / c) {
614
+ ...Ye,
615
+ ...a
616
+ }, Object.assign(this, a.confettiSource);
617
+ }, this.update = (a = 0) => {
618
+ const { options: { run: n, onConfettiComplete: l, frameRate: c }, canvas: m, context: w } = this, k = Math.min(a - this.lastFrameTime, 50);
619
+ if (c && k < 1e3 / c) {
615
620
  this.rafId = requestAnimationFrame(this.update);
616
621
  return;
617
622
  }
618
- this.lastFrameTime = r - (c ? A % c : 0), n && (w.fillStyle = "white", w.clearRect(0, 0, m.width, m.height)), this.generator.animate(A) ? this.rafId = requestAnimationFrame(this.update) : (l && typeof l == "function" && this.generator.particlesGenerated > 0 && l.call(this, this), this._options.run = !1);
623
+ this.lastFrameTime = a - (c ? k % c : 0), n && (w.fillStyle = "white", w.clearRect(0, 0, m.width, m.height)), this.generator.animate(k) ? this.rafId = requestAnimationFrame(this.update) : (l && typeof l == "function" && this.generator.particlesGenerated > 0 && l.call(this, this), this._options.run = !1);
619
624
  }, this.reset = () => {
620
625
  this.generator && this.generator.particlesGenerated > 0 && (this.generator.particlesGenerated = 0, this.generator.particles = [], this.generator.lastNumberOfPieces = 0);
621
626
  }, this.stop = () => {
622
627
  this.options = { run: !1 }, this.rafId && (cancelAnimationFrame(this.rafId), this.rafId = void 0);
623
- }, this.canvas = t;
624
- const a = this.canvas.getContext("2d");
625
- if (!a)
628
+ }, this.canvas = e;
629
+ const r = this.canvas.getContext("2d");
630
+ if (!r)
626
631
  throw new Error("Could not get canvas context");
627
- this.context = a, this.generator = new Se(this.canvas, () => this.options), this.options = e, this.update();
632
+ this.context = r, this.generator = new Nt(this.canvas, () => this.options), this.options = t, this.update();
628
633
  }
629
634
  get options() {
630
635
  return this._options;
631
636
  }
632
- set options(t) {
633
- var r, n;
634
- const e = (r = this._options) == null ? void 0 : r.run, a = (n = this._options) == null ? void 0 : n.recycle;
635
- this.setOptionsWithDefaults(t), this.generator && (Object.assign(this.generator, this.options.confettiSource), typeof t.recycle == "boolean" && t.recycle && a === !1 && (this.generator.lastNumberOfPieces = this.generator.particles.length)), typeof t.run == "boolean" && t.run && e === !1 && this.update();
637
+ set options(e) {
638
+ var a, n;
639
+ const t = (a = this._options) == null ? void 0 : a.run, r = (n = this._options) == null ? void 0 : n.recycle;
640
+ this.setOptionsWithDefaults(e), this.generator && (Object.assign(this.generator, this.options.confettiSource), typeof e.recycle == "boolean" && e.recycle && r === !1 && (this.generator.lastNumberOfPieces = this.generator.particles.length)), typeof e.run == "boolean" && e.run && t === !1 && this.update();
636
641
  }
637
642
  }
638
- const Te = Ft.createRef();
639
- class Qt extends Ft.Component {
640
- constructor(t) {
641
- super(t), this.canvas = Ft.createRef(), this.canvas = t.canvasRef || Te;
643
+ const Mt = qe.createRef();
644
+ class Ke extends qe.Component {
645
+ constructor(e) {
646
+ super(e), this.canvas = qe.createRef(), this.canvas = e.canvasRef || Mt;
642
647
  }
643
648
  componentDidMount() {
644
649
  if (this.canvas.current) {
645
- const t = zt(this.props)[0];
646
- this.confetti = new Ne(this.canvas.current, t);
650
+ const e = je(this.props)[0];
651
+ this.confetti = new Tt(this.canvas.current, e);
647
652
  }
648
653
  }
649
654
  componentDidUpdate() {
650
- const t = zt(this.props)[0];
651
- this.confetti && (this.confetti.options = t);
655
+ const e = je(this.props)[0];
656
+ this.confetti && (this.confetti.options = e);
652
657
  }
653
658
  componentWillUnmount() {
654
659
  this.confetti && this.confetti.stop(), this.confetti = void 0;
655
660
  }
656
661
  render() {
657
- const [t, e] = zt(this.props), a = {
662
+ const [e, t] = je(this.props), r = {
658
663
  zIndex: 2,
659
664
  position: "absolute",
660
665
  pointerEvents: "none",
@@ -662,18 +667,18 @@ class Qt extends Ft.Component {
662
667
  left: 0,
663
668
  bottom: 0,
664
669
  right: 0,
665
- ...e.style
670
+ ...t.style
666
671
  };
667
- return h("canvas", { width: t.width, height: t.height, ref: this.canvas, ...e, style: a });
672
+ return h("canvas", { width: e.width, height: e.height, ref: this.canvas, ...t, style: r });
668
673
  }
669
674
  }
670
- Qt.defaultProps = {
671
- ...Gt
675
+ Ke.defaultProps = {
676
+ ...Ye
672
677
  };
673
- Qt.displayName = "ReactConfetti";
674
- function zt(i) {
675
- const t = {}, e = {}, a = {}, r = [
676
- ...Object.keys(Gt),
678
+ Ke.displayName = "ReactConfetti";
679
+ function je(i) {
680
+ const e = {}, t = {}, r = {}, a = [
681
+ ...Object.keys(Ye),
677
682
  "confettiSource",
678
683
  "drawShape",
679
684
  "onConfettiComplete",
@@ -681,26 +686,26 @@ function zt(i) {
681
686
  ], n = ["canvasRef"];
682
687
  for (const l in i) {
683
688
  const c = i[l];
684
- r.includes(l) ? t[l] = c : n.includes(l) ? n[l] = c : a[l] = c;
689
+ a.includes(l) ? e[l] = c : n.includes(l) ? n[l] = c : r[l] = c;
685
690
  }
686
- return [t, a, e];
691
+ return [e, r, t];
687
692
  }
688
- const Me = Ft.forwardRef((i, t) => h(Qt, { canvasRef: t, ...i }));
693
+ const Pt = qe.forwardRef((i, e) => h(Ke, { canvasRef: e, ...i }));
689
694
  /**
690
695
  * @license lucide-react v0.515.0 - ISC
691
696
  *
692
697
  * This source code is licensed under the ISC license.
693
698
  * See the LICENSE file in the root directory of this source tree.
694
699
  */
695
- const Pe = (i) => i.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Oe = (i) => i.replace(
700
+ const Ot = (i) => i.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), kt = (i) => i.replace(
696
701
  /^([A-Z])|[\s-_]+(\w)/g,
697
- (t, e, a) => a ? a.toUpperCase() : e.toLowerCase()
698
- ), ie = (i) => {
699
- const t = Oe(i);
700
- return t.charAt(0).toUpperCase() + t.slice(1);
701
- }, le = (...i) => i.filter((t, e, a) => !!t && t.trim() !== "" && a.indexOf(t) === e).join(" ").trim(), ke = (i) => {
702
- for (const t in i)
703
- if (t.startsWith("aria-") || t === "role" || t === "title")
702
+ (e, t, r) => r ? r.toUpperCase() : t.toLowerCase()
703
+ ), st = (i) => {
704
+ const e = kt(i);
705
+ return e.charAt(0).toUpperCase() + e.slice(1);
706
+ }, dt = (...i) => i.filter((e, t, r) => !!e && e.trim() !== "" && r.indexOf(e) === t).join(" ").trim(), Ft = (i) => {
707
+ for (const e in i)
708
+ if (e.startsWith("aria-") || e === "role" || e === "title")
704
709
  return !0;
705
710
  };
706
711
  /**
@@ -709,7 +714,7 @@ const Pe = (i) => i.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Oe = (
709
714
  * This source code is licensed under the ISC license.
710
715
  * See the LICENSE file in the root directory of this source tree.
711
716
  */
712
- var Ae = {
717
+ var At = {
713
718
  xmlns: "http://www.w3.org/2000/svg",
714
719
  width: 24,
715
720
  height: 24,
@@ -726,31 +731,31 @@ var Ae = {
726
731
  * This source code is licensed under the ISC license.
727
732
  * See the LICENSE file in the root directory of this source tree.
728
733
  */
729
- const Re = se(
734
+ const Rt = lt(
730
735
  ({
731
736
  color: i = "currentColor",
732
- size: t = 24,
733
- strokeWidth: e = 2,
734
- absoluteStrokeWidth: a,
735
- className: r = "",
737
+ size: e = 24,
738
+ strokeWidth: t = 2,
739
+ absoluteStrokeWidth: r,
740
+ className: a = "",
736
741
  children: n,
737
742
  iconNode: l,
738
743
  ...c
739
- }, m) => Vt(
744
+ }, m) => Ge(
740
745
  "svg",
741
746
  {
742
747
  ref: m,
743
- ...Ae,
744
- width: t,
745
- height: t,
748
+ ...At,
749
+ width: e,
750
+ height: e,
746
751
  stroke: i,
747
- strokeWidth: a ? Number(e) * 24 / Number(t) : e,
748
- className: le("lucide", r),
749
- ...!n && !ke(c) && { "aria-hidden": "true" },
752
+ strokeWidth: r ? Number(t) * 24 / Number(e) : t,
753
+ className: dt("lucide", a),
754
+ ...!n && !Ft(c) && { "aria-hidden": "true" },
750
755
  ...c
751
756
  },
752
757
  [
753
- ...l.map(([w, A]) => Vt(w, A)),
758
+ ...l.map(([w, k]) => Ge(w, k)),
754
759
  ...Array.isArray(n) ? n : [n]
755
760
  ]
756
761
  )
@@ -761,20 +766,20 @@ const Re = se(
761
766
  * This source code is licensed under the ISC license.
762
767
  * See the LICENSE file in the root directory of this source tree.
763
768
  */
764
- const Fe = (i, t) => {
765
- const e = se(
766
- ({ className: a, ...r }, n) => Vt(Re, {
769
+ const Dt = (i, e) => {
770
+ const t = lt(
771
+ ({ className: r, ...a }, n) => Ge(Rt, {
767
772
  ref: n,
768
- iconNode: t,
769
- className: le(
770
- `lucide-${Pe(ie(i))}`,
773
+ iconNode: e,
774
+ className: dt(
775
+ `lucide-${Ot(st(i))}`,
771
776
  `lucide-${i}`,
772
- a
777
+ r
773
778
  ),
774
- ...r
779
+ ...a
775
780
  })
776
781
  );
777
- return e.displayName = ie(i), e;
782
+ return t.displayName = st(i), t;
778
783
  };
779
784
  /**
780
785
  * @license lucide-react v0.515.0 - ISC
@@ -782,105 +787,105 @@ const Fe = (i, t) => {
782
787
  * This source code is licensed under the ISC license.
783
788
  * See the LICENSE file in the root directory of this source tree.
784
789
  */
785
- const De = [
790
+ const qt = [
786
791
  ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
787
792
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
788
- ], qe = Fe("search", De), Ee = "_backdrop_vl21a_1", Le = "_celebrationOverlay_vl21a_14", $e = "_celebrationChip_vl21a_23", Ue = "_backdropOpen_vl21a_74", ze = "_backdropClosed_vl21a_78", We = "_panel_vl21a_82", Ve = "_panelOpen_vl21a_102", je = "_panelClosed_vl21a_106", Ge = "_header_vl21a_145", Qe = "_headerCenter_vl21a_154", Ye = "_title_vl21a_162", Ke = "_searchIconButton_vl21a_171", He = "_headerTitleWrap_vl21a_193", Xe = "_headerSearchWrap_vl21a_197", Ze = "_headerSearchOpen_vl21a_209", Je = "_searchBar_vl21a_221", tn = "_searchInput_vl21a_233", en = "_searchClearButton_vl21a_254", nn = "_closeButton_vl21a_276", rn = "_body_vl21a_309", an = "_muted_vl21a_314", on = "_error_vl21a_319", sn = "_variants_vl21a_324", cn = "_variantList_vl21a_328", ln = "_variantRow_vl21a_336", un = "_variantLeft_vl21a_344", dn = "_addToBundleButton_vl21a_351", hn = "_variantThumb_vl21a_379", fn = "_variantThumbImg_vl21a_389", mn = "_variantThumbFallback_vl21a_396", pn = "_variantInfo_vl21a_406", bn = "_variantName_vl21a_410", vn = "_variantMeta_vl21a_419", _n = "_variantPriceRow_vl21a_427", yn = "_variantCompareAt_vl21a_434", wn = "_variantPrice_vl21a_427", gn = "_qtyControls_vl21a_445", xn = "_qtyButton_vl21a_451", In = "_qtyValue_vl21a_476", Cn = "_footer_vl21a_483", Bn = "_poweredBy_vl21a_490", Sn = "_boxSummaryWindow_vl21a_502", Nn = "_boxSummaryRow_vl21a_519", Tn = "_boxSlot_vl21a_527", Mn = "_boxItem_vl21a_535", Pn = "_boxItemClickable_vl21a_547", On = "_boxThresholdLabel_vl21a_556", kn = "_boxItemPlaceholder_vl21a_567", An = "_boxItemFilled_vl21a_573", Rn = "_boxItemThreshold_vl21a_579", Fn = "_boxItemDiscountText_vl21a_587", Dn = "_boxItemPlus_vl21a_595", qn = "_boxItemImage_vl21a_602", En = "_boxItemFallback_vl21a_609", Ln = "_ctaButtonGroup_vl21a_620", $n = "_ctaButtonGroupAnimating_vl21a_627", Un = "_cta_vl21a_620", zn = "_ctaDualLeft_vl21a_655", Wn = "_ctaDualLeftAnimating_vl21a_673", Vn = "_ctaDualRight_vl21a_686", jn = "_ctaDualRightAnimating_vl21a_702", Gn = "_ctaTotals_vl21a_713", Qn = "_ctaDiscountBadge_vl21a_721", Yn = "_ctaTotalsWrap_vl21a_735", Kn = "_ctaTotalsWrapVisible_vl21a_748", Hn = "_ctaTotalsStrike_vl21a_755", Xn = "_ctaTotalsPrice_vl21a_762", u = {
789
- backdrop: Ee,
790
- celebrationOverlay: Le,
791
- celebrationChip: $e,
792
- backdropOpen: Ue,
793
- backdropClosed: ze,
794
- panel: We,
795
- panelOpen: Ve,
796
- panelClosed: je,
797
- header: Ge,
798
- headerCenter: Qe,
799
- title: Ye,
800
- searchIconButton: Ke,
801
- headerTitleWrap: He,
802
- headerSearchWrap: Xe,
803
- headerSearchOpen: Ze,
804
- searchBar: Je,
793
+ ], Et = Dt("search", qt), Lt = "_backdrop_vl21a_1", $t = "_celebrationOverlay_vl21a_14", Ut = "_celebrationChip_vl21a_23", zt = "_backdropOpen_vl21a_74", Wt = "_backdropClosed_vl21a_78", jt = "_panel_vl21a_82", Vt = "_panelOpen_vl21a_102", Gt = "_panelClosed_vl21a_106", Qt = "_header_vl21a_145", Yt = "_headerCenter_vl21a_154", Kt = "_title_vl21a_162", Ht = "_searchIconButton_vl21a_171", Xt = "_headerTitleWrap_vl21a_193", Zt = "_headerSearchWrap_vl21a_197", Jt = "_headerSearchOpen_vl21a_209", en = "_searchBar_vl21a_221", tn = "_searchInput_vl21a_233", nn = "_searchClearButton_vl21a_254", rn = "_closeButton_vl21a_276", an = "_body_vl21a_309", on = "_muted_vl21a_314", sn = "_error_vl21a_319", cn = "_variants_vl21a_324", ln = "_variantList_vl21a_328", un = "_variantRow_vl21a_336", dn = "_variantLeft_vl21a_344", hn = "_addToBundleButton_vl21a_351", fn = "_variantThumb_vl21a_379", mn = "_variantThumbImg_vl21a_389", pn = "_variantThumbFallback_vl21a_396", vn = "_variantInfo_vl21a_406", bn = "_variantName_vl21a_410", yn = "_variantMeta_vl21a_419", _n = "_variantPriceRow_vl21a_427", wn = "_variantCompareAt_vl21a_434", gn = "_variantPrice_vl21a_427", xn = "_qtyControls_vl21a_445", In = "_qtyButton_vl21a_451", Cn = "_qtyValue_vl21a_476", Bn = "_footer_vl21a_483", Sn = "_poweredBy_vl21a_490", Nn = "_boxSummaryWindow_vl21a_502", Tn = "_boxSummaryRow_vl21a_519", Mn = "_boxSlot_vl21a_527", Pn = "_boxItem_vl21a_535", On = "_boxItemClickable_vl21a_547", kn = "_boxThresholdLabel_vl21a_556", Fn = "_boxItemPlaceholder_vl21a_567", An = "_boxItemFilled_vl21a_573", Rn = "_boxItemThreshold_vl21a_579", Dn = "_boxItemDiscountText_vl21a_587", qn = "_boxItemPlus_vl21a_595", En = "_boxItemImage_vl21a_602", Ln = "_boxItemFallback_vl21a_609", $n = "_ctaButtonGroup_vl21a_620", Un = "_ctaButtonGroupAnimating_vl21a_627", zn = "_cta_vl21a_620", Wn = "_ctaDualLeft_vl21a_655", jn = "_ctaDualLeftAnimating_vl21a_673", Vn = "_ctaDualRight_vl21a_686", Gn = "_ctaDualRightAnimating_vl21a_702", Qn = "_ctaTotals_vl21a_713", Yn = "_ctaDiscountBadge_vl21a_721", Kn = "_ctaTotalsWrap_vl21a_735", Hn = "_ctaTotalsWrapVisible_vl21a_748", Xn = "_ctaTotalsStrike_vl21a_755", Zn = "_ctaTotalsPrice_vl21a_762", u = {
794
+ backdrop: Lt,
795
+ celebrationOverlay: $t,
796
+ celebrationChip: Ut,
797
+ backdropOpen: zt,
798
+ backdropClosed: Wt,
799
+ panel: jt,
800
+ panelOpen: Vt,
801
+ panelClosed: Gt,
802
+ header: Qt,
803
+ headerCenter: Yt,
804
+ title: Kt,
805
+ searchIconButton: Ht,
806
+ headerTitleWrap: Xt,
807
+ headerSearchWrap: Zt,
808
+ headerSearchOpen: Jt,
809
+ searchBar: en,
805
810
  searchInput: tn,
806
- searchClearButton: en,
807
- closeButton: nn,
808
- body: rn,
809
- muted: an,
810
- error: on,
811
- variants: sn,
812
- variantList: cn,
813
- variantRow: ln,
814
- variantLeft: un,
815
- addToBundleButton: dn,
816
- variantThumb: hn,
817
- variantThumbImg: fn,
818
- variantThumbFallback: mn,
819
- variantInfo: pn,
811
+ searchClearButton: nn,
812
+ closeButton: rn,
813
+ body: an,
814
+ muted: on,
815
+ error: sn,
816
+ variants: cn,
817
+ variantList: ln,
818
+ variantRow: un,
819
+ variantLeft: dn,
820
+ addToBundleButton: hn,
821
+ variantThumb: fn,
822
+ variantThumbImg: mn,
823
+ variantThumbFallback: pn,
824
+ variantInfo: vn,
820
825
  variantName: bn,
821
- variantMeta: vn,
826
+ variantMeta: yn,
822
827
  variantPriceRow: _n,
823
- variantCompareAt: yn,
824
- variantPrice: wn,
825
- qtyControls: gn,
826
- qtyButton: xn,
827
- qtyValue: In,
828
- footer: Cn,
829
- poweredBy: Bn,
830
- boxSummaryWindow: Sn,
831
- boxSummaryRow: Nn,
832
- boxSlot: Tn,
833
- boxItem: Mn,
834
- boxItemClickable: Pn,
835
- boxThresholdLabel: On,
836
- boxItemPlaceholder: kn,
828
+ variantCompareAt: wn,
829
+ variantPrice: gn,
830
+ qtyControls: xn,
831
+ qtyButton: In,
832
+ qtyValue: Cn,
833
+ footer: Bn,
834
+ poweredBy: Sn,
835
+ boxSummaryWindow: Nn,
836
+ boxSummaryRow: Tn,
837
+ boxSlot: Mn,
838
+ boxItem: Pn,
839
+ boxItemClickable: On,
840
+ boxThresholdLabel: kn,
841
+ boxItemPlaceholder: Fn,
837
842
  boxItemFilled: An,
838
843
  boxItemThreshold: Rn,
839
- boxItemDiscountText: Fn,
840
- boxItemPlus: Dn,
841
- boxItemImage: qn,
842
- boxItemFallback: En,
843
- ctaButtonGroup: Ln,
844
- ctaButtonGroupAnimating: $n,
845
- cta: Un,
846
- ctaDualLeft: zn,
847
- ctaDualLeftAnimating: Wn,
844
+ boxItemDiscountText: Dn,
845
+ boxItemPlus: qn,
846
+ boxItemImage: En,
847
+ boxItemFallback: Ln,
848
+ ctaButtonGroup: $n,
849
+ ctaButtonGroupAnimating: Un,
850
+ cta: zn,
851
+ ctaDualLeft: Wn,
852
+ ctaDualLeftAnimating: jn,
848
853
  ctaDualRight: Vn,
849
- ctaDualRightAnimating: jn,
850
- ctaTotals: Gn,
851
- ctaDiscountBadge: Qn,
852
- ctaTotalsWrap: Yn,
853
- ctaTotalsWrapVisible: Kn,
854
- ctaTotalsStrike: Hn,
855
- ctaTotalsPrice: Xn
854
+ ctaDualRightAnimating: Gn,
855
+ ctaTotals: Qn,
856
+ ctaDiscountBadge: Yn,
857
+ ctaTotalsWrap: Kn,
858
+ ctaTotalsWrapVisible: Hn,
859
+ ctaTotalsStrike: Xn,
860
+ ctaTotalsPrice: Zn
856
861
  };
857
862
  function or(i) {
858
- var ee;
863
+ var rt;
859
864
  const {
860
- isOpen: t,
861
- close: e,
862
- loading: a,
863
- submitting: r,
865
+ isOpen: e,
866
+ close: t,
867
+ loading: r,
868
+ submitting: a,
864
869
  error: n,
865
870
  currencyCode: l,
866
871
  config: c,
867
872
  eligibleVariants: m,
868
873
  selections: w,
869
- selectionOrder: A,
870
- setQuantity: R,
874
+ selectionOrder: k,
875
+ setQuantity: F,
871
876
  bundleSize: x,
872
- minRequired: J,
873
- canSubmit: E,
874
- submit: H,
875
- submitAndCheckout: L
876
- } = jt(), [P, F] = O(!1), [V, g] = O(""), ft = U(null), st = U(null), wt = U(null), [mt, St] = O(() => typeof window > "u" ? { width: 0, height: 0 } : { width: window.innerWidth, height: window.innerHeight }), [Nt, Tt] = O(0), [pt, Mt] = O(null), [Pt, bt] = O(!1), tt = U(null), vt = U(x), X = 7e3, [xt, ct] = O(0), [et, gt] = O(null), [lt, It] = O(!1), nt = U(null), Dt = 2800, f = (o) => {
877
+ minRequired: X,
878
+ canSubmit: V,
879
+ submit: Z,
880
+ submitAndCheckout: z
881
+ } = Qe(), [M, A] = P(!1), [W, g] = P(""), he = L(null), se = L(null), _e = L(null), [fe, Ne] = P(() => typeof window > "u" ? { width: 0, height: 0 } : { width: window.innerWidth, height: window.innerHeight }), [Te, Me] = P(0), [me, Pe] = P(null), [Oe, pe] = P(!1), J = L(null), ve = L(x), K = 7e3, [Ie, ce] = P(0), [ee, we] = P(null), [le, Ce] = P(!1), te = L(null), Ee = 2800, f = (o) => {
877
882
  const s = Number.parseFloat(o);
878
883
  return Number.isFinite(s) ? String(Math.round(s)) : o;
879
884
  }, C = (o) => {
880
885
  const s = (o ?? []).filter((d) => {
881
886
  var I, _;
882
- const b = (I = d == null ? void 0 : d.name) == null ? void 0 : I.trim(), p = (_ = d == null ? void 0 : d.value) == null ? void 0 : _.trim();
883
- return !(!b || !p || b.toLowerCase() === "title");
887
+ const v = (I = d == null ? void 0 : d.name) == null ? void 0 : I.trim(), p = (_ = d == null ? void 0 : d.value) == null ? void 0 : _.trim();
888
+ return !(!v || !p || v.toLowerCase() === "title");
884
889
  });
885
890
  return s.length ? s.map((d) => `${d.name}: ${d.value}`).join(" · ") : null;
886
891
  }, D = (o) => {
@@ -889,7 +894,7 @@ function or(i) {
889
894
  }, y = (o) => {
890
895
  const s = D(o), d = C(o.selectedOptions);
891
896
  return [s, d].filter(Boolean).join(" — ");
892
- }, [rt, q] = O(t), G = U(null), B = (o) => {
897
+ }, [ne, q] = P(e), G = L(null), B = (o) => {
893
898
  const s = Number(o);
894
899
  if (!Number.isFinite(s)) return o;
895
900
  if (l)
@@ -898,173 +903,173 @@ function or(i) {
898
903
  } catch {
899
904
  }
900
905
  return `$${s.toFixed(2)}`;
901
- }, at = ((ee = c == null ? void 0 : c.title) == null ? void 0 : ee.trim()) || "Build your bundle", Q = M(() => {
906
+ }, re = ((rt = c == null ? void 0 : c.title) == null ? void 0 : rt.trim()) || "Build your bundle", Q = T(() => {
902
907
  const o = Number((c == null ? void 0 : c.maxBundleSize) ?? NaN), s = Number.isFinite(o) ? Math.floor(o) : 100;
903
908
  return Math.max(2, Math.min(100, s));
904
- }, [c == null ? void 0 : c.maxBundleSize]), it = x >= Q, $ = M(() => [...m].sort((o, s) => o.displayName.localeCompare(s.displayName)), [m]), Y = M(() => {
905
- const o = V.trim().toLowerCase();
906
- if (!o) return $;
907
- const s = o.split(/\s+/).filter(Boolean), d = (b) => {
909
+ }, [c == null ? void 0 : c.maxBundleSize]), ae = x >= Q, E = T(() => [...m].sort((o, s) => o.displayName.localeCompare(s.displayName)), [m]), Y = T(() => {
910
+ const o = W.trim().toLowerCase();
911
+ if (!o) return E;
912
+ const s = o.split(/\s+/).filter(Boolean), d = (v) => {
908
913
  var _;
909
914
  const p = [];
910
- p.push(b.displayName), (_ = b.product) != null && _.title && p.push(b.product.title);
911
- for (const N of b.selectedOptions ?? [])
912
- p.push(N.name), p.push(N.value);
915
+ p.push(v.displayName), (_ = v.product) != null && _.title && p.push(v.product.title);
916
+ for (const S of v.selectedOptions ?? [])
917
+ p.push(S.name), p.push(S.value);
913
918
  const I = p.join(" ").toLowerCase();
914
- return s.every((N) => I.includes(N));
919
+ return s.every((S) => I.includes(S));
915
920
  };
916
- return $.filter(d);
917
- }, [V, $]), T = M(() => [...(c == null ? void 0 : c.rules) ?? []].sort((o, s) => o.minBundleSize - s.minBundleSize), [c == null ? void 0 : c.rules]), S = M(() => Math.max(0, J - x), [x, J]), v = M(() => {
921
+ return E.filter(d);
922
+ }, [W, E]), N = T(() => [...(c == null ? void 0 : c.rules) ?? []].sort((o, s) => o.minBundleSize - s.minBundleSize), [c == null ? void 0 : c.rules]), R = T(() => Math.max(0, X - x), [x, X]), ge = T(() => {
918
923
  let o = null;
919
- for (const s of T)
924
+ for (const s of N)
920
925
  x >= s.minBundleSize && (o = s);
921
926
  return o;
922
- }, [x, T]), K = M(() => {
923
- if (!v) return null;
924
- const o = Number.parseFloat(v.discountPercent);
927
+ }, [x, N]), b = T(() => {
928
+ if (!ge) return null;
929
+ const o = Number.parseFloat(ge.discountPercent);
925
930
  return !Number.isFinite(o) || o <= 0 ? null : o;
926
- }, [v]), Ot = M(() => {
927
- const o = T[0];
931
+ }, [ge]), be = T(() => {
932
+ const o = N[0];
928
933
  if (!o) return null;
929
934
  const s = Number.parseFloat(o.discountPercent);
930
935
  return !Number.isFinite(s) || s <= 0 ? null : s;
931
- }, [T]), _t = K ?? Ot, ut = M(() => {
936
+ }, [N]), xe = b ?? be, ie = T(() => {
932
937
  const o = new Map(m.map((d) => [d.id, d]));
933
938
  let s = 0;
934
- for (const [d, b] of Object.entries(w)) {
935
- const p = b ?? 0;
939
+ for (const [d, v] of Object.entries(w)) {
940
+ const p = v ?? 0;
936
941
  if (p <= 0) continue;
937
942
  const I = o.get(d), _ = Number(I == null ? void 0 : I.price);
938
943
  Number.isFinite(_) && (s += _ * p);
939
944
  }
940
945
  return Math.round(s * 100) / 100;
941
- }, [m, w]), ue = M(() => {
942
- if (!K) return ut;
943
- const o = ut * (1 - K / 100);
946
+ }, [m, w]), ke = T(() => {
947
+ if (!b) return ie;
948
+ const o = ie * (1 - b / 100);
944
949
  return Math.round(o * 100) / 100;
945
- }, [K, ut]), Yt = M(() => T.length ? Math.max(...T.map((o) => o.minBundleSize)) : 0, [T]), qt = M(() => {
950
+ }, [b, ie]), He = T(() => N.length ? Math.max(...N.map((o) => o.minBundleSize)) : 0, [N]), Le = T(() => {
946
951
  const o = new Map(m.map((s) => [s.id, s]));
947
- return A.map((s) => o.get(s)).filter((s) => !!s);
948
- }, [m, A]), de = M(() => {
952
+ return k.map((s) => o.get(s)).filter((s) => !!s);
953
+ }, [m, k]), ht = T(() => {
949
954
  var s;
950
955
  const o = /* @__PURE__ */ new Map();
951
- for (const d of T) {
952
- const b = Math.max(0, d.minBundleSize - 1);
953
- o.set(b, {
956
+ for (const d of N) {
957
+ const v = Math.max(0, d.minBundleSize - 1);
958
+ o.set(v, {
954
959
  discountPercent: d.discountPercent,
955
960
  minBundleSize: d.minBundleSize,
956
961
  label: ((s = d.label) == null ? void 0 : s.trim()) || `Buy ${d.minBundleSize}+`
957
962
  });
958
963
  }
959
964
  return o;
960
- }, [T]), he = M(() => Math.max(Yt || J, qt.length), [qt.length, Yt, J]), [Et, Kt] = O(!0), Ht = U(S);
961
- z(() => {
962
- if (((c == null ? void 0 : c.ctaButtonMode) || "add_to_cart") === "add_to_cart_checkout") {
963
- const s = Ht.current > 0;
964
- Kt(!(s && S === 0));
965
+ }, [N]), ft = T(() => Math.max(He || X, Le.length), [Le.length, He, X]), [$e, Xe] = P(!0), Ze = L(R);
966
+ $(() => {
967
+ {
968
+ const o = Ze.current > 0;
969
+ Xe(!(o && R === 0));
965
970
  }
966
- Ht.current = S;
967
- }, [S, c == null ? void 0 : c.ctaButtonMode]);
968
- const Lt = U(null), Xt = U(null), Zt = U(null), Jt = U(x), te = (o) => {
969
- const s = Xt.current;
971
+ Ze.current = R;
972
+ }, [R, c == null ? void 0 : c.ctaButtonMode]);
973
+ const Ue = L(null), Je = L(null), et = L(null), tt = L(x), nt = (o) => {
974
+ const s = Je.current;
970
975
  if (!s) return;
971
976
  const d = s.querySelector(`[data-variant-row="${o}"]`);
972
977
  if (!d) return;
973
- const b = s.getBoundingClientRect(), p = d.getBoundingClientRect(), I = 8;
974
- if (p.top >= b.top + I && p.bottom <= b.bottom - I) return;
975
- const N = Math.max(0, s.scrollHeight - s.clientHeight), j = p.top - b.top + p.height / 2, Z = s.scrollTop + j - s.clientHeight / 2, ot = Math.min(N, Math.max(0, Z));
976
- s.scrollTo({ top: ot, behavior: "smooth" });
978
+ const v = s.getBoundingClientRect(), p = d.getBoundingClientRect(), I = 8;
979
+ if (p.top >= v.top + I && p.bottom <= v.bottom - I) return;
980
+ const S = Math.max(0, s.scrollHeight - s.clientHeight), j = p.top - v.top + p.height / 2, H = s.scrollTop + j - s.clientHeight / 2, oe = Math.min(S, Math.max(0, H));
981
+ s.scrollTo({ top: oe, behavior: "smooth" });
977
982
  };
978
- return z(() => {
979
- if (!t) return;
983
+ return $(() => {
984
+ if (!e) return;
980
985
  const o = (s) => {
981
- s.key === "Escape" && e();
986
+ s.key === "Escape" && t();
982
987
  };
983
988
  return window.addEventListener("keydown", o), () => window.removeEventListener("keydown", o);
984
- }, [e, t]), z(() => {
989
+ }, [t, e]), $(() => {
985
990
  if (typeof window > "u") return;
986
- const o = () => St({ width: window.innerWidth, height: window.innerHeight });
991
+ const o = () => Ne({ width: window.innerWidth, height: window.innerHeight });
987
992
  return o(), window.addEventListener("resize", o), () => window.removeEventListener("resize", o);
988
- }, []), z(() => {
989
- if (G.current != null && (window.clearTimeout(G.current), G.current = null), t) {
993
+ }, []), $(() => {
994
+ if (G.current != null && (window.clearTimeout(G.current), G.current = null), e) {
990
995
  q(!0);
991
996
  return;
992
997
  }
993
998
  G.current = window.setTimeout(() => {
994
999
  q(!1), G.current = null;
995
1000
  }, 220);
996
- }, [t]), z(() => () => {
1001
+ }, [e]), $(() => () => {
997
1002
  G.current != null && window.clearTimeout(G.current);
998
- }, []), z(() => () => {
999
- tt.current != null && window.clearTimeout(tt.current);
1000
- }, []), z(() => () => {
1001
- nt.current != null && window.clearTimeout(nt.current);
1002
- }, []), z(() => {
1003
- if (!t || !P) return;
1003
+ }, []), $(() => () => {
1004
+ J.current != null && window.clearTimeout(J.current);
1005
+ }, []), $(() => () => {
1006
+ te.current != null && window.clearTimeout(te.current);
1007
+ }, []), $(() => {
1008
+ if (!e || !M) return;
1004
1009
  const o = requestAnimationFrame(() => {
1005
1010
  var s;
1006
- return (s = ft.current) == null ? void 0 : s.focus();
1011
+ return (s = he.current) == null ? void 0 : s.focus();
1007
1012
  });
1008
1013
  return () => cancelAnimationFrame(o);
1009
- }, [t, P]), z(() => {
1010
- const o = Jt.current;
1011
- if (Jt.current = x, x <= o) return;
1012
- const s = Zt.current;
1014
+ }, [e, M]), $(() => {
1015
+ const o = tt.current;
1016
+ if (tt.current = x, x <= o) return;
1017
+ const s = et.current;
1013
1018
  if (!s) return;
1014
- const d = T.some((_) => _.minBundleSize === x), b = T.find((_) => _.minBundleSize > x), p = b && d ? b.minBundleSize - 1 : b ? null : x - 1;
1019
+ const d = N.some((_) => _.minBundleSize === x), v = N.find((_) => _.minBundleSize > x), p = v && d ? v.minBundleSize - 1 : v ? null : x - 1;
1015
1020
  if (p == null || p < 0) return;
1016
1021
  const I = requestAnimationFrame(() => {
1017
1022
  const _ = s.querySelector(`[data-box-slot="${p}"]`);
1018
1023
  if (!_) return;
1019
- const N = s.getBoundingClientRect(), Z = _.getBoundingClientRect().right - N.right;
1020
- if (Z <= 1) return;
1021
- const ot = Math.max(0, s.scrollWidth - s.clientWidth), yt = Math.min(ot, Math.max(0, s.scrollLeft + Z));
1022
- s.scrollTo({ left: yt, behavior: "smooth" });
1024
+ const S = s.getBoundingClientRect(), H = _.getBoundingClientRect().right - S.right;
1025
+ if (H <= 1) return;
1026
+ const oe = Math.max(0, s.scrollWidth - s.clientWidth), ye = Math.min(oe, Math.max(0, s.scrollLeft + H));
1027
+ s.scrollTo({ left: ye, behavior: "smooth" });
1023
1028
  });
1024
1029
  return () => cancelAnimationFrame(I);
1025
- }, [x, T]), z(() => {
1026
- if (!t) return;
1027
- const o = vt.current;
1028
- if (vt.current = x, x <= o) return;
1029
- const s = T.find((d) => d.minBundleSize === x);
1030
- s && (gt(`You received a ${f(s.discountPercent)}% discount!`), ct((d) => d + 1), It(!0), nt.current != null && window.clearTimeout(nt.current), nt.current = window.setTimeout(() => {
1031
- It(!1), nt.current = null;
1032
- }, Dt));
1033
- }, [x, t, T]), z(() => {
1034
- if (!t || !lt || !et) return;
1030
+ }, [x, N]), $(() => {
1031
+ if (!e) return;
1032
+ const o = ve.current;
1033
+ if (ve.current = x, x <= o) return;
1034
+ const s = N.find((d) => d.minBundleSize === x);
1035
+ s && (we(`You received a ${f(s.discountPercent)}% discount!`), ce((d) => d + 1), Ce(!0), te.current != null && window.clearTimeout(te.current), te.current = window.setTimeout(() => {
1036
+ Ce(!1), te.current = null;
1037
+ }, Ee));
1038
+ }, [x, e, N]), $(() => {
1039
+ if (!e || !le || !ee) return;
1035
1040
  const o = requestAnimationFrame(() => {
1036
- var N;
1037
- const s = wt.current, d = s == null ? void 0 : s.getBoundingClientRect(), b = (N = Lt.current) == null ? void 0 : N.getBoundingClientRect(), p = d ? d.left + d.width / 2 : b ? b.left + b.width / 2 : window.innerWidth / 2, I = d ? d.top + d.height / 2 : b ? b.top + b.height / 2 : window.innerHeight / 2, _ = {
1041
+ var S;
1042
+ const s = _e.current, d = s == null ? void 0 : s.getBoundingClientRect(), v = (S = Ue.current) == null ? void 0 : S.getBoundingClientRect(), p = d ? d.left + d.width / 2 : v ? v.left + v.width / 2 : window.innerWidth / 2, I = d ? d.top + d.height / 2 : v ? v.top + v.height / 2 : window.innerHeight / 2, _ = {
1038
1043
  x: p - 2,
1039
1044
  y: I - 2,
1040
1045
  w: 4,
1041
1046
  h: 4
1042
1047
  };
1043
- Mt(_), Tt((j) => j + 1), bt(!0), tt.current != null && window.clearTimeout(tt.current), tt.current = window.setTimeout(() => {
1044
- bt(!1), tt.current = null;
1045
- }, X);
1048
+ Pe(_), Me((j) => j + 1), pe(!0), J.current != null && window.clearTimeout(J.current), J.current = window.setTimeout(() => {
1049
+ pe(!1), J.current = null;
1050
+ }, K);
1046
1051
  });
1047
1052
  return () => cancelAnimationFrame(o);
1048
- }, [xt, et, X, lt, t]), z(() => {
1053
+ }, [Ie, ee, K, le, e]), $(() => {
1049
1054
  var o;
1050
- t && ((o = Lt.current) == null || o.focus());
1051
- }, [t]), rt ? /* @__PURE__ */ k(
1055
+ e && ((o = Ue.current) == null || o.focus());
1056
+ }, [e]), ne ? /* @__PURE__ */ O(
1052
1057
  "div",
1053
1058
  {
1054
1059
  role: "dialog",
1055
1060
  "aria-modal": "true",
1056
1061
  "aria-label": "Bundle builder",
1057
- className: [u.backdrop, t ? u.backdropOpen : u.backdropClosed, i.className].filter(Boolean).join(" "),
1062
+ className: [u.backdrop, e ? u.backdropOpen : u.backdropClosed, i.className].filter(Boolean).join(" "),
1058
1063
  onMouseDown: (o) => {
1059
- o.target === o.currentTarget && e();
1064
+ o.target === o.currentTarget && t();
1060
1065
  },
1061
1066
  children: [
1062
- Pt && pt && mt.width > 0 && mt.height > 0 ? /* @__PURE__ */ h(
1063
- Me,
1067
+ Oe && me && fe.width > 0 && fe.height > 0 ? /* @__PURE__ */ h(
1068
+ Pt,
1064
1069
  {
1065
- width: mt.width,
1066
- height: mt.height,
1067
- confettiSource: pt,
1070
+ width: fe.width,
1071
+ height: fe.height,
1072
+ confettiSource: me,
1068
1073
  colors: [
1069
1074
  "#2563eb",
1070
1075
  // blue-600
@@ -1087,42 +1092,42 @@ function or(i) {
1087
1092
  initialVelocityX: { min: -6, max: 6 },
1088
1093
  style: { position: "fixed", inset: 0, pointerEvents: "none", zIndex: 2147483646 }
1089
1094
  },
1090
- Nt
1095
+ Te
1091
1096
  ) : null,
1092
- /* @__PURE__ */ k("aside", { ref: Lt, className: [u.panel, t ? u.panelOpen : u.panelClosed].filter(Boolean).join(" "), tabIndex: -1, children: [
1093
- lt && et ? /* @__PURE__ */ h("div", { className: u.celebrationOverlay, "aria-hidden": "true", children: /* @__PURE__ */ h("div", { ref: wt, className: u.celebrationChip, children: et }, xt) }) : null,
1094
- /* @__PURE__ */ k("header", { className: [u.header, P ? u.headerSearchOpen : null].filter(Boolean).join(" "), children: [
1097
+ /* @__PURE__ */ O("aside", { ref: Ue, className: [u.panel, e ? u.panelOpen : u.panelClosed].filter(Boolean).join(" "), tabIndex: -1, children: [
1098
+ le && ee ? /* @__PURE__ */ h("div", { className: u.celebrationOverlay, "aria-hidden": "true", children: /* @__PURE__ */ h("div", { ref: _e, className: u.celebrationChip, children: ee }, Ie) }) : null,
1099
+ /* @__PURE__ */ O("header", { className: [u.header, M ? u.headerSearchOpen : null].filter(Boolean).join(" "), children: [
1095
1100
  /* @__PURE__ */ h(
1096
1101
  "button",
1097
1102
  {
1098
1103
  type: "button",
1099
1104
  className: u.searchIconButton,
1100
- "aria-label": P ? "Search (expanded)" : "Search",
1101
- "aria-expanded": P,
1105
+ "aria-label": M ? "Search (expanded)" : "Search",
1106
+ "aria-expanded": M,
1102
1107
  onClick: () => {
1103
- F(!0);
1108
+ A(!0);
1104
1109
  },
1105
- children: /* @__PURE__ */ h(qe, { size: 18, "aria-hidden": "true" })
1110
+ children: /* @__PURE__ */ h(Et, { size: 18, "aria-hidden": "true" })
1106
1111
  }
1107
1112
  ),
1108
- /* @__PURE__ */ k("div", { className: u.headerCenter, children: [
1109
- /* @__PURE__ */ h("div", { className: u.headerTitleWrap, "aria-hidden": P, children: /* @__PURE__ */ h("h2", { className: u.title, children: at }) }),
1110
- /* @__PURE__ */ h("div", { className: u.headerSearchWrap, "aria-hidden": !P, children: /* @__PURE__ */ k("div", { className: u.searchBar, children: [
1113
+ /* @__PURE__ */ O("div", { className: u.headerCenter, children: [
1114
+ /* @__PURE__ */ h("div", { className: u.headerTitleWrap, "aria-hidden": M, children: /* @__PURE__ */ h("h2", { className: u.title, children: re }) }),
1115
+ /* @__PURE__ */ h("div", { className: u.headerSearchWrap, "aria-hidden": !M, children: /* @__PURE__ */ O("div", { className: u.searchBar, children: [
1111
1116
  /* @__PURE__ */ h(
1112
1117
  "input",
1113
1118
  {
1114
- ref: ft,
1119
+ ref: he,
1115
1120
  className: u.searchInput,
1116
1121
  type: "search",
1117
- value: V,
1122
+ value: W,
1118
1123
  placeholder: "Search",
1119
1124
  onChange: (o) => g(o.target.value),
1120
1125
  onBlur: () => {
1121
- V.trim() === "" && F(!1);
1126
+ W.trim() === "" && A(!1);
1122
1127
  }
1123
1128
  }
1124
1129
  ),
1125
- V.trim() ? /* @__PURE__ */ h(
1130
+ W.trim() ? /* @__PURE__ */ h(
1126
1131
  "button",
1127
1132
  {
1128
1133
  type: "button",
@@ -1132,7 +1137,7 @@ function or(i) {
1132
1137
  },
1133
1138
  onClick: () => {
1134
1139
  var o;
1135
- g(""), (o = ft.current) == null || o.focus();
1140
+ g(""), (o = he.current) == null || o.focus();
1136
1141
  },
1137
1142
  "aria-label": "Clear search",
1138
1143
  children: "Clear"
@@ -1140,18 +1145,18 @@ function or(i) {
1140
1145
  ) : null
1141
1146
  ] }) })
1142
1147
  ] }),
1143
- /* @__PURE__ */ h("button", { type: "button", onClick: e, disabled: r, className: u.closeButton, "aria-label": "Close", children: "×" })
1148
+ /* @__PURE__ */ h("button", { type: "button", onClick: t, disabled: a, className: u.closeButton, "aria-label": "Close", children: "×" })
1144
1149
  ] }),
1145
- /* @__PURE__ */ k("div", { className: u.body, ref: Xt, children: [
1146
- a ? /* @__PURE__ */ h("p", { className: u.muted, children: "Loading…" }) : null,
1150
+ /* @__PURE__ */ O("div", { className: u.body, ref: Je, children: [
1151
+ r ? /* @__PURE__ */ h("p", { className: u.muted, children: "Loading…" }) : null,
1147
1152
  n ? /* @__PURE__ */ h("p", { className: u.error, children: n }) : null,
1148
- !a && c && !c.isActive ? /* @__PURE__ */ h("p", { className: u.error, children: "Bundles are not active." }) : null,
1153
+ !r && c && !c.isActive ? /* @__PURE__ */ h("p", { className: u.error, children: "Bundles are not active." }) : null,
1149
1154
  /* @__PURE__ */ h("div", { className: u.variants, children: /* @__PURE__ */ h("ul", { className: u.variantList, children: Y.map((o) => {
1150
- var Z, ot, yt, Ct;
1151
- const s = w[o.id] ?? 0, d = D(o), b = C(o.selectedOptions), p = y(o), I = _t, _ = Number(o.price), N = I != null && Number.isFinite(I) && I > 0 && Number.isFinite(_), j = N ? Math.round(_ * (1 - I / 100) * 100) / 100 : null;
1152
- return /* @__PURE__ */ k("li", { className: u.variantRow, "data-variant-row": o.id, children: [
1153
- /* @__PURE__ */ k("div", { className: u.variantLeft, children: [
1154
- /* @__PURE__ */ h("div", { className: u.variantThumb, "aria-hidden": "true", children: (Z = o.image) != null && Z.url ? /* @__PURE__ */ h(
1155
+ var H, oe, ye, Be;
1156
+ const s = w[o.id] ?? 0, d = D(o), v = C(o.selectedOptions), p = y(o), I = xe, _ = Number(o.price), S = I != null && Number.isFinite(I) && I > 0 && Number.isFinite(_), j = S ? Math.round(_ * (1 - I / 100) * 100) / 100 : null;
1157
+ return /* @__PURE__ */ O("li", { className: u.variantRow, "data-variant-row": o.id, children: [
1158
+ /* @__PURE__ */ O("div", { className: u.variantLeft, children: [
1159
+ /* @__PURE__ */ h("div", { className: u.variantThumb, "aria-hidden": "true", children: (H = o.image) != null && H.url ? /* @__PURE__ */ h(
1155
1160
  "img",
1156
1161
  {
1157
1162
  className: u.variantThumbImg,
@@ -1159,12 +1164,12 @@ function or(i) {
1159
1164
  alt: o.image.altText ?? p,
1160
1165
  loading: "lazy"
1161
1166
  }
1162
- ) : /* @__PURE__ */ h("div", { className: u.variantThumbFallback, children: ((Ct = (yt = (ot = o.product) == null ? void 0 : ot.title) == null ? void 0 : yt.slice(0, 1)) == null ? void 0 : Ct.toUpperCase()) ?? "•" }) }),
1163
- /* @__PURE__ */ k("div", { className: u.variantInfo, children: [
1167
+ ) : /* @__PURE__ */ h("div", { className: u.variantThumbFallback, children: ((Be = (ye = (oe = o.product) == null ? void 0 : oe.title) == null ? void 0 : ye.slice(0, 1)) == null ? void 0 : Be.toUpperCase()) ?? "•" }) }),
1168
+ /* @__PURE__ */ O("div", { className: u.variantInfo, children: [
1164
1169
  /* @__PURE__ */ h("div", { className: u.variantName, children: d }),
1165
- b ? /* @__PURE__ */ h("div", { className: u.variantMeta, children: b }) : null,
1166
- /* @__PURE__ */ k("div", { className: u.variantPriceRow, children: [
1167
- N ? /* @__PURE__ */ h("span", { className: u.variantCompareAt, children: B(Number.isFinite(_) ? _.toFixed(2) : o.price) }) : null,
1170
+ v ? /* @__PURE__ */ h("div", { className: u.variantMeta, children: v }) : null,
1171
+ /* @__PURE__ */ O("div", { className: u.variantPriceRow, children: [
1172
+ S ? /* @__PURE__ */ h("span", { className: u.variantCompareAt, children: B(Number.isFinite(_) ? _.toFixed(2) : o.price) }) : null,
1168
1173
  /* @__PURE__ */ h("span", { className: u.variantPrice, children: B(
1169
1174
  j != null ? j.toFixed(2) : Number.isFinite(_) ? _.toFixed(2) : o.price
1170
1175
  ) })
@@ -1175,19 +1180,19 @@ function or(i) {
1175
1180
  "button",
1176
1181
  {
1177
1182
  type: "button",
1178
- onClick: () => R(o.id, 1),
1179
- disabled: r || it,
1183
+ onClick: () => F(o.id, 1),
1184
+ disabled: a || ae,
1180
1185
  className: u.addToBundleButton,
1181
1186
  "aria-label": `Add ${p} to bundle`,
1182
1187
  children: "Add"
1183
1188
  }
1184
- ) : /* @__PURE__ */ k("div", { className: u.qtyControls, children: [
1189
+ ) : /* @__PURE__ */ O("div", { className: u.qtyControls, children: [
1185
1190
  /* @__PURE__ */ h(
1186
1191
  "button",
1187
1192
  {
1188
1193
  type: "button",
1189
- onClick: () => R(o.id, s - 1),
1190
- disabled: r || s <= 0,
1194
+ onClick: () => F(o.id, s - 1),
1195
+ disabled: a || s <= 0,
1191
1196
  className: u.qtyButton,
1192
1197
  "aria-label": `Decrease ${p}`,
1193
1198
  children: "−"
@@ -1198,8 +1203,8 @@ function or(i) {
1198
1203
  "button",
1199
1204
  {
1200
1205
  type: "button",
1201
- onClick: () => R(o.id, s + 1),
1202
- disabled: r || it,
1206
+ onClick: () => F(o.id, s + 1),
1207
+ disabled: a || ae,
1203
1208
  className: u.qtyButton,
1204
1209
  "aria-label": `Increase ${p}`,
1205
1210
  children: "+"
@@ -1209,11 +1214,11 @@ function or(i) {
1209
1214
  ] }, o.id);
1210
1215
  }) }) })
1211
1216
  ] }),
1212
- /* @__PURE__ */ k("footer", { className: u.footer, ref: st, children: [
1213
- /* @__PURE__ */ h("div", { className: u.boxSummaryWindow, ref: Zt, children: /* @__PURE__ */ h("div", { className: u.boxSummaryRow, "aria-label": "Bundle box summary", children: Array.from({ length: he }).map((o, s) => {
1214
- var Z, ot, yt, Ct;
1215
- const d = qt[s], b = de.get(s), p = !!d, I = !!b, _ = I && !p, N = b ? `${b.discountPercent}% off` : null, j = p ? d.displayName : `Slot ${s + 1}`;
1216
- return /* @__PURE__ */ k("div", { "data-box-slot": s, className: u.boxSlot, children: [
1217
+ /* @__PURE__ */ O("footer", { className: u.footer, ref: se, children: [
1218
+ /* @__PURE__ */ h("div", { className: u.boxSummaryWindow, ref: et, children: /* @__PURE__ */ h("div", { className: u.boxSummaryRow, "aria-label": "Bundle box summary", children: Array.from({ length: ft }).map((o, s) => {
1219
+ var H, oe, ye, Be;
1220
+ const d = Le[s], v = ht.get(s), p = !!d, I = !!v, _ = I && !p, S = v ? `${v.discountPercent}% off` : null, j = p ? d.displayName : `Slot ${s + 1}`;
1221
+ return /* @__PURE__ */ O("div", { "data-box-slot": s, className: u.boxSlot, children: [
1217
1222
  /* @__PURE__ */ h(
1218
1223
  "div",
1219
1224
  {
@@ -1225,13 +1230,13 @@ function or(i) {
1225
1230
  ].filter(Boolean).join(" "),
1226
1231
  role: p ? "button" : void 0,
1227
1232
  tabIndex: p ? 0 : void 0,
1228
- onClick: p ? () => te(d.id) : void 0,
1229
- onKeyDown: p ? ($t) => {
1230
- ($t.key === "Enter" || $t.key === " ") && ($t.preventDefault(), te(d.id));
1233
+ onClick: p ? () => nt(d.id) : void 0,
1234
+ onKeyDown: p ? (ze) => {
1235
+ (ze.key === "Enter" || ze.key === " ") && (ze.preventDefault(), nt(d.id));
1231
1236
  } : void 0,
1232
- "aria-label": _ && N ? `${j}. Unlocks ${N}.` : j,
1233
- title: _ && N ? `${j} • Unlocks ${N}` : j,
1234
- children: p ? (Z = d.image) != null && Z.url ? /* @__PURE__ */ h(
1237
+ "aria-label": _ && S ? `${j}. Unlocks ${S}.` : j,
1238
+ title: _ && S ? `${j} • Unlocks ${S}` : j,
1239
+ children: p ? (H = d.image) != null && H.url ? /* @__PURE__ */ h(
1235
1240
  "img",
1236
1241
  {
1237
1242
  className: u.boxItemImage,
@@ -1239,56 +1244,53 @@ function or(i) {
1239
1244
  alt: d.image.altText ?? d.displayName,
1240
1245
  loading: "lazy"
1241
1246
  }
1242
- ) : /* @__PURE__ */ h("div", { className: u.boxItemFallback, "aria-hidden": "true", children: ((Ct = (yt = (ot = d.product) == null ? void 0 : ot.title) == null ? void 0 : yt.slice(0, 1)) == null ? void 0 : Ct.toUpperCase()) ?? "•" }) : _ && N ? /* @__PURE__ */ h("div", { className: u.boxItemDiscountText, children: N }) : /* @__PURE__ */ h("div", { className: u.boxItemPlus, "aria-hidden": "true", children: "+" })
1247
+ ) : /* @__PURE__ */ h("div", { className: u.boxItemFallback, "aria-hidden": "true", children: ((Be = (ye = (oe = d.product) == null ? void 0 : oe.title) == null ? void 0 : ye.slice(0, 1)) == null ? void 0 : Be.toUpperCase()) ?? "•" }) : _ && S ? /* @__PURE__ */ h("div", { className: u.boxItemDiscountText, children: S }) : /* @__PURE__ */ h("div", { className: u.boxItemPlus, "aria-hidden": "true", children: "+" })
1243
1248
  }
1244
1249
  ),
1245
- I ? /* @__PURE__ */ h("div", { className: u.boxThresholdLabel, children: b.label }) : null
1250
+ I ? /* @__PURE__ */ h("div", { className: u.boxThresholdLabel, children: v.label }) : null
1246
1251
  ] }, s);
1247
1252
  }) }) }),
1248
1253
  /* @__PURE__ */ h(
1249
1254
  "div",
1250
1255
  {
1251
- className: [u.ctaTotalsWrap, S <= 0 ? u.ctaTotalsWrapVisible : null].filter(Boolean).join(" "),
1252
- "aria-hidden": S > 0,
1253
- children: /* @__PURE__ */ k("div", { className: u.ctaTotals, "aria-label": "Totals", children: [
1254
- _t ? /* @__PURE__ */ k("span", { className: u.ctaDiscountBadge, children: [
1255
- _t,
1256
+ className: [u.ctaTotalsWrap, R <= 0 ? u.ctaTotalsWrapVisible : null].filter(Boolean).join(" "),
1257
+ "aria-hidden": R > 0,
1258
+ children: /* @__PURE__ */ O("div", { className: u.ctaTotals, "aria-label": "Totals", children: [
1259
+ xe ? /* @__PURE__ */ O("span", { className: u.ctaDiscountBadge, children: [
1260
+ xe,
1256
1261
  "% Discount"
1257
1262
  ] }) : /* @__PURE__ */ h("span", {}),
1258
- /* @__PURE__ */ h("span", { children: K ? /* @__PURE__ */ k(fe, { children: [
1259
- /* @__PURE__ */ h("span", { className: u.ctaTotalsStrike, children: B(ut.toFixed(2)) }),
1263
+ /* @__PURE__ */ h("span", { children: b ? /* @__PURE__ */ O(mt, { children: [
1264
+ /* @__PURE__ */ h("span", { className: u.ctaTotalsStrike, children: B(ie.toFixed(2)) }),
1260
1265
  " ",
1261
- /* @__PURE__ */ h("span", { className: u.ctaTotalsPrice, children: B(ue.toFixed(2)) })
1262
- ] }) : /* @__PURE__ */ h("span", { className: u.ctaTotalsPrice, children: B(ut.toFixed(2)) }) })
1266
+ /* @__PURE__ */ h("span", { className: u.ctaTotalsPrice, children: B(ke.toFixed(2)) })
1267
+ ] }) : /* @__PURE__ */ h("span", { className: u.ctaTotalsPrice, children: B(ie.toFixed(2)) }) })
1263
1268
  ] })
1264
1269
  }
1265
1270
  ),
1266
- (() => {
1267
- const o = (c == null ? void 0 : c.ctaButtonMode) || "add_to_cart";
1268
- return o === "add_to_cart_checkout" ? S > 0 ? /* @__PURE__ */ h("button", { type: "button", onClick: H, disabled: !E, className: u.cta, children: r ? "Adding…" : `Add ${S} more product${S === 1 ? "" : "s"}` }) : /* @__PURE__ */ k("div", { className: `${u.ctaButtonGroup} ${Et ? u.ctaButtonGroupAnimating : ""}`, children: [
1269
- /* @__PURE__ */ h(
1270
- "button",
1271
- {
1272
- type: "button",
1273
- onClick: H,
1274
- disabled: !E,
1275
- className: `${u.ctaDualLeft} ${Et ? u.ctaDualLeftAnimating : ""}`,
1276
- children: /* @__PURE__ */ h("span", { children: r ? "Adding…" : "Add to Basket" })
1277
- }
1278
- ),
1279
- /* @__PURE__ */ h(
1280
- "button",
1281
- {
1282
- type: "button",
1283
- onClick: L,
1284
- disabled: !E,
1285
- className: `${u.ctaDualRight} ${Et ? u.ctaDualRightAnimating : ""}`,
1286
- children: /* @__PURE__ */ h("span", { children: r ? "Processing…" : "Checkout" })
1287
- }
1288
- )
1289
- ] }) : o === "checkout" ? /* @__PURE__ */ h("button", { type: "button", onClick: L, disabled: !E, className: u.cta, children: r ? "Processing…" : S > 0 ? `Add ${S} more product${S === 1 ? "" : "s"}` : "Checkout" }) : /* @__PURE__ */ h("button", { type: "button", onClick: H, disabled: !E, className: u.cta, children: r ? "Adding…" : S > 0 ? `Add ${S} more product${S === 1 ? "" : "s"}` : "Add to Basket" });
1290
- })(),
1291
- /* @__PURE__ */ k("div", { className: u.poweredBy, children: [
1271
+ R > 0 ? /* @__PURE__ */ h("button", { type: "button", onClick: Z, disabled: !V, className: u.cta, children: a ? "Adding…" : `Add ${R} more product${R === 1 ? "" : "s"}` }) : /* @__PURE__ */ O("div", { className: `${u.ctaButtonGroup} ${$e ? u.ctaButtonGroupAnimating : ""}`, children: [
1272
+ /* @__PURE__ */ h(
1273
+ "button",
1274
+ {
1275
+ type: "button",
1276
+ onClick: Z,
1277
+ disabled: !V,
1278
+ className: `${u.ctaDualLeft} ${$e ? u.ctaDualLeftAnimating : ""}`,
1279
+ children: /* @__PURE__ */ h("span", { children: a ? "Adding…" : "Add to Basket" })
1280
+ }
1281
+ ),
1282
+ /* @__PURE__ */ h(
1283
+ "button",
1284
+ {
1285
+ type: "button",
1286
+ onClick: z,
1287
+ disabled: !V,
1288
+ className: `${u.ctaDualRight} ${$e ? u.ctaDualRightAnimating : ""}`,
1289
+ children: /* @__PURE__ */ h("span", { children: a ? "Processing…" : "Checkout" })
1290
+ }
1291
+ )
1292
+ ] }),
1293
+ /* @__PURE__ */ O("div", { className: u.poweredBy, children: [
1292
1294
  "powered by ",
1293
1295
  /* @__PURE__ */ h("a", { href: "https://apps.shopify.com/best-bundles", target: "_blank", rel: "noopener noreferrer", children: " BestBundles" })
1294
1296
  ] })
@@ -1298,30 +1300,30 @@ function or(i) {
1298
1300
  }
1299
1301
  ) : null;
1300
1302
  }
1301
- function oe(i) {
1303
+ function Ve(i) {
1302
1304
  if (i != null && i.length)
1303
- return i.reduce((t, e) => (e != null && e.key && (t[e.key] = e.value ?? ""), t), {});
1305
+ return i.reduce((e, t) => (t != null && t.key && (e[t.key] = t.value ?? ""), e), {});
1304
1306
  }
1305
- function Zn(i) {
1306
- const t = /\/(\d+)$/.exec(i);
1307
- return t ? t[1] : i;
1307
+ function ct(i) {
1308
+ const e = /\/(\d+)$/.exec(i);
1309
+ return e ? e[1] : i;
1308
1310
  }
1309
1311
  function Jn() {
1310
1312
  var i;
1311
1313
  return ((i = window == null ? void 0 : window.routes) == null ? void 0 : i.cart_url) || "/cart";
1312
1314
  }
1313
- async function tr() {
1315
+ async function er() {
1314
1316
  try {
1315
- const i = Jn(), t = encodeURIComponent("cart-drawer,cart-icon-bubble,cart-live-region-text"), e = await fetch(`${i}?sections=${t}`, { method: "GET" });
1316
- if (!e.ok) return;
1317
- const a = await e.json().catch(() => null);
1318
- if (!a) return;
1319
- const r = ["cart-drawer", "cart-icon-bubble", "cart-live-region-text"];
1320
- for (const c of r) {
1321
- const m = a[c];
1317
+ const i = Jn(), e = encodeURIComponent("cart-drawer,cart-icon-bubble,cart-live-region-text"), t = await fetch(`${i}?sections=${e}`, { method: "GET" });
1318
+ if (!t.ok) return;
1319
+ const r = await t.json().catch(() => null);
1320
+ if (!r) return;
1321
+ const a = ["cart-drawer", "cart-icon-bubble", "cart-live-region-text"];
1322
+ for (const c of a) {
1323
+ const m = r[c];
1322
1324
  if (!m) continue;
1323
- const w = new DOMParser().parseFromString(m, "text/html"), A = w.getElementById(c) || w.querySelector(c), R = document.getElementById(c) || document.querySelector(c);
1324
- R && A && R.replaceWith(A);
1325
+ const w = new DOMParser().parseFromString(m, "text/html"), k = w.getElementById(c) || w.querySelector(c), F = document.getElementById(c) || document.querySelector(c);
1326
+ F && k && F.replaceWith(k);
1325
1327
  }
1326
1328
  const n = document.querySelector("cart-drawer");
1327
1329
  if (n && typeof n.open == "function") {
@@ -1334,46 +1336,54 @@ async function tr() {
1334
1336
  } catch {
1335
1337
  }
1336
1338
  }
1337
- async function Wt(i, t) {
1338
- const e = await fetch(i, {
1339
+ async function De(i, e) {
1340
+ const t = await fetch(i, {
1339
1341
  method: "POST",
1340
1342
  headers: {
1341
1343
  Accept: "application/json",
1342
1344
  "Content-Type": "application/json"
1343
1345
  },
1344
- body: JSON.stringify(t)
1346
+ body: JSON.stringify(e)
1345
1347
  });
1346
- if (!e.ok) {
1347
- const a = await e.text().catch(() => "");
1348
- throw new Error(a || `Cart request failed: ${e.status}`);
1348
+ if (!t.ok) {
1349
+ const r = await t.text().catch(() => "");
1350
+ throw new Error(r || `Cart request failed: ${t.status}`);
1349
1351
  }
1350
- return e.json().catch(() => null);
1352
+ return t.json().catch(() => null);
1351
1353
  }
1352
1354
  function sr() {
1353
1355
  return {
1354
1356
  async linesAdd(i) {
1355
- const t = i.map((e) => ({
1356
- id: Zn(e.merchandiseId),
1357
- quantity: e.quantity,
1358
- properties: oe(e.attributes)
1357
+ const e = i.map((t) => ({
1358
+ id: ct(t.merchandiseId),
1359
+ quantity: t.quantity,
1360
+ properties: Ve(t.attributes)
1361
+ }));
1362
+ await De("/cart/add.js", { items: e });
1363
+ },
1364
+ async linesAddForCheckout(i) {
1365
+ const e = i.map((t) => ({
1366
+ id: ct(t.merchandiseId),
1367
+ quantity: t.quantity,
1368
+ properties: Ve(t.attributes)
1359
1369
  }));
1360
- await Wt("/cart/add.js", { items: t });
1370
+ await De("/cart/add.js", { items: e });
1361
1371
  },
1362
1372
  async linesUpdate(i) {
1363
- for (const t of i)
1364
- await Wt("/cart/change.js", {
1365
- id: t.id,
1366
- quantity: t.quantity,
1367
- properties: oe(t.attributes)
1373
+ for (const e of i)
1374
+ await De("/cart/change.js", {
1375
+ id: e.id,
1376
+ quantity: e.quantity,
1377
+ properties: Ve(e.attributes)
1368
1378
  });
1369
1379
  },
1370
1380
  async linesRemove(i) {
1371
- for (const t of i)
1372
- await Wt("/cart/change.js", { id: t, quantity: 0 });
1381
+ for (const e of i)
1382
+ await De("/cart/change.js", { id: e, quantity: 0 });
1373
1383
  },
1374
1384
  openCartUI() {
1375
1385
  window.setTimeout(() => {
1376
- tr();
1386
+ er();
1377
1387
  }, 0);
1378
1388
  },
1379
1389
  navigateToCheckout() {
@@ -1384,10 +1394,10 @@ function sr() {
1384
1394
  export {
1385
1395
  or as BundleBuilderDrawer,
1386
1396
  ir as BundleButton,
1387
- kt as BundleLineAttributeKeys,
1397
+ Fe as BundleLineAttributeKeys,
1388
1398
  rr as BundleProvider,
1389
1399
  sr as createLiquidCartAdapter,
1390
- jt as useBundleBuilder,
1400
+ Qe as useBundleBuilder,
1391
1401
  ar as useBundleBuilderDrawer
1392
1402
  };
1393
1403
  //# sourceMappingURL=index.js.map