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