@best-bundles/bundle-ui 0.0.20 → 0.0.21

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