@lime-bundles/widget 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +160 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +145 -37
- package/dist/index.js.map +1 -1
- package/dist/lime-bundle.global.js +82 -40
- package/dist/lime-bundle.global.js.map +1 -1
- package/docs/css-variables.md +11 -0
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var LimeBundles=(()=>{var
|
|
1
|
+
"use strict";var LimeBundles=(()=>{var Be=Object.defineProperty;var Vt=Object.getOwnPropertyDescriptor;var Ot=Object.getOwnPropertyNames;var Ht=Object.prototype.hasOwnProperty;var Ut=(e,t)=>{for(var r in t)Be(e,r,{get:t[r],enumerable:!0})},Nt=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ot(t))!Ht.call(e,n)&&n!==r&&Be(e,n,{get:()=>t[n],enumerable:!(o=Vt(t,n))||o.enumerable});return e};var qt=e=>Nt(Be({},"__esModule",{value:!0}),e);var yn={};Ut(yn,{LimeBundleElement:()=>ce,trackInputMode:()=>ye});var $t=Object.defineProperty,Ye=(e,t)=>{for(var r in t)$t(e,r,{get:t[r],enumerable:!0})},He=class extends Error{constructor(e){super(e.map(t=>t.message).join("; ")),this.errors=e,this.name="StorefrontApiError"}},Wt="2025-10";function Ae(e){let t=e.apiVersion??Wt,r=`https://${e.shopDomain}/api/${t}/graphql.json`;return{async query(o,n,a){let i={"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":e.accessToken};e.buyerIp&&(i["Shopify-Storefront-Buyer-IP"]=e.buyerIp);let l=await fetch(r,{method:"POST",headers:i,body:JSON.stringify({query:o,variables:n}),signal:a?.signal});if(!l.ok)throw new He([{message:`Storefront API error: ${l.status} ${l.statusText}`}]);let d=await l.json();if(d.errors?.length)throw new He(d.errors);return d.data}}}var Qe=`#graphql
|
|
2
2
|
query BundleMetaobject($id: ID!) {
|
|
3
3
|
metaobject(id: $id) {
|
|
4
4
|
id
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
id
|
|
22
22
|
title
|
|
23
23
|
availableForSale
|
|
24
|
+
currentlyNotInStock
|
|
25
|
+
quantityAvailable
|
|
24
26
|
price { amount currencyCode }
|
|
25
27
|
compareAtPrice { amount currencyCode }
|
|
26
28
|
unitPrice { amount currencyCode }
|
|
@@ -47,6 +49,8 @@
|
|
|
47
49
|
id
|
|
48
50
|
title
|
|
49
51
|
availableForSale
|
|
52
|
+
currentlyNotInStock
|
|
53
|
+
quantityAvailable
|
|
50
54
|
price { amount currencyCode }
|
|
51
55
|
compareAtPrice { amount currencyCode }
|
|
52
56
|
unitPrice { amount currencyCode }
|
|
@@ -75,6 +79,8 @@
|
|
|
75
79
|
id
|
|
76
80
|
title
|
|
77
81
|
availableForSale
|
|
82
|
+
currentlyNotInStock
|
|
83
|
+
quantityAvailable
|
|
78
84
|
price { amount currencyCode }
|
|
79
85
|
compareAtPrice { amount currencyCode }
|
|
80
86
|
unitPrice { amount currencyCode }
|
|
@@ -91,7 +97,7 @@
|
|
|
91
97
|
}
|
|
92
98
|
}
|
|
93
99
|
}
|
|
94
|
-
`,
|
|
100
|
+
`,Xe=`#graphql
|
|
95
101
|
query ShopCustomCss {
|
|
96
102
|
shop {
|
|
97
103
|
metafield(namespace: "$app", key: "custom_css") {
|
|
@@ -99,7 +105,7 @@
|
|
|
99
105
|
}
|
|
100
106
|
}
|
|
101
107
|
}
|
|
102
|
-
`,
|
|
108
|
+
`,Je=`#graphql
|
|
103
109
|
query BundlesForProduct($handle: String!) {
|
|
104
110
|
product(handle: $handle) {
|
|
105
111
|
id
|
|
@@ -129,6 +135,8 @@
|
|
|
129
135
|
id
|
|
130
136
|
title
|
|
131
137
|
availableForSale
|
|
138
|
+
currentlyNotInStock
|
|
139
|
+
quantityAvailable
|
|
132
140
|
price { amount currencyCode }
|
|
133
141
|
compareAtPrice { amount currencyCode }
|
|
134
142
|
unitPrice { amount currencyCode }
|
|
@@ -155,6 +163,8 @@
|
|
|
155
163
|
id
|
|
156
164
|
title
|
|
157
165
|
availableForSale
|
|
166
|
+
currentlyNotInStock
|
|
167
|
+
quantityAvailable
|
|
158
168
|
price { amount currencyCode }
|
|
159
169
|
compareAtPrice { amount currencyCode }
|
|
160
170
|
unitPrice { amount currencyCode }
|
|
@@ -183,6 +193,8 @@
|
|
|
183
193
|
id
|
|
184
194
|
title
|
|
185
195
|
availableForSale
|
|
196
|
+
currentlyNotInStock
|
|
197
|
+
quantityAvailable
|
|
186
198
|
price { amount currencyCode }
|
|
187
199
|
compareAtPrice { amount currencyCode }
|
|
188
200
|
unitPrice { amount currencyCode }
|
|
@@ -203,42 +215,42 @@
|
|
|
203
215
|
}
|
|
204
216
|
}
|
|
205
217
|
}
|
|
206
|
-
`,
|
|
218
|
+
`,Ze=`#graphql
|
|
207
219
|
mutation CartCreate($input: CartInput!) {
|
|
208
220
|
cartCreate(input: $input) {
|
|
209
221
|
cart { id checkoutUrl }
|
|
210
222
|
userErrors { field message }
|
|
211
223
|
}
|
|
212
224
|
}
|
|
213
|
-
`,
|
|
225
|
+
`,et=`#graphql
|
|
214
226
|
mutation CartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) {
|
|
215
227
|
cartLinesAdd(cartId: $cartId, lines: $lines) {
|
|
216
228
|
cart { id checkoutUrl }
|
|
217
229
|
userErrors { field message }
|
|
218
230
|
}
|
|
219
231
|
}
|
|
220
|
-
`,te=class extends Error{constructor(e,t){super(e),this.reason=t,this.name="BundleParseError"}},Y={header:{textColor:"#FFFFFF",headerStyle:"gradient",gradientStart:"#C62828",gradientEnd:"#AD1457",saveBadgeBgColor:"#FFFFFF",saveBadgeTextColor:"#AD1457",saveBadgeBorderColor:"#FFFFFF",saveBadgeBorderWidth:0,saveBadgeBorderRadius:8,countdownBgColor:"#FFF0F3",countdownTextColor:"#C62828"},layout:{backgroundColor:"#FFFFFF",borderColor:"#E5E5E5",borderWidth:1,borderRadius:12},productList:{textColor:"#1A1A1A",imageBorderWidth:0,imageBorderColor:"#E5E5E5",imageBorderRadius:8,thumbnailRatio:"square",variantBorderWidth:1,variantBorderColor:"#E5E5E5",variantBorderRadius:8,showPrice:!0,showCompareAtPrice:!0,showCountBubble:!0,countBubbleBgColor:"#1A1A1A",countBubbleTextColor:"#FFFFFF"},pricing:{showSaveBadge:!0,showComparePrice:!0,showPerUnitPrice:!0,showItemCount:!0,showCompareAtPrice:!0},cta:{ctaText:"Add to cart",primaryColor:"#1A1A1A",buttonTextColor:"#FFFFFF",borderWidth:0,borderColor:"#1A1A1A",borderRadius:12},savingsBar:{visible:!0,bgColor:"#EDFBF1",textColor:"#2DB554",borderWidth:0,borderColor:"#2DB554",borderRadius:8},countdown:{showCountdown:!0},popularBadge:{visible:!0,text:"Most Popular",bgColor:"#1A1A1A",textColor:"#FFFFFF",borderWidth:0,borderColor:"#1A1A1A",borderRadius:12},outOfStockBehavior:"show_greyed_out",showSearch:!0,pickerBgColor:"#FFFFFF",pickerTextColor:"#1A1A1A",pickerBorderWidth:0,pickerBorderColor:"#E5E5E5",pickerBorderRadius:16,pickerSearchBorderWidth:1,pickerSearchBorderColor:"#E5E5E5",pickerSearchBorderRadius:8,pickerProductBorderWidth:0,pickerProductBorderColor:"#E5E5E5",pickerProductBorderRadius:8,pickerThumbnailRatio:"square",pickerShowCountBubble:!0,pickerCountBubbleBgColor:"#1A1A1A",pickerCountBubbleTextColor:"#FFFFFF",pickerAddBgColor:"#1A1A1A",pickerAddLabelColor:"#FFFFFF",pickerAddBorderWidth:0,pickerAddBorderColor:"#1A1A1A",pickerAddBorderRadius:8,pickerVariantBorderWidth:1,pickerVariantBorderColor:"#1A1A1A",pickerVariantBorderRadius:8,tierBorderColor:"#E5E5E5",tierBorderWidth:1,tierBorderRadius:12,tierSelectedBorderColor:"#1A1A1A",tierSelectedBorderWidth:2,defaultTier:"first"};function Nt(e){if(!e||typeof e!="object")return Y;let t=e;return{...Y,...t,defaultTier:qt(t.defaultTier),header:{...Y.header,...t.header??{}},layout:{...Y.layout,...t.layout??{}},productList:{...Y.productList,...t.productList??{}},pricing:{...Y.pricing,...t.pricing??{}},cta:{...Y.cta,...t.cta??{}},savingsBar:{...Y.savingsBar,...t.savingsBar??{}},countdown:{...Y.countdown,...t.countdown??{}},popularBadge:{...Y.popularBadge,...t.popularBadge??{}}}}function qt(e){return e==="first"||e==="best_value"||typeof e=="number"&&Number.isInteger(e)&&e>=0?e:Y.defaultTier}function $t(e){return{primaryColor:e.cta.primaryColor,backgroundColor:e.layout.backgroundColor,textColor:e.productList.textColor,borderColor:e.layout.borderColor,borderWidth:e.layout.borderWidth,buttonTextColor:e.cta.buttonTextColor,ctaBorderWidth:e.cta.borderWidth,ctaBorderColor:e.cta.borderColor,ctaBorderRadius:e.cta.borderRadius,savingsBarBgColor:e.savingsBar.bgColor,savingsBarTextColor:e.savingsBar.textColor,savingsBarBorderWidth:e.savingsBar.borderWidth,savingsBarBorderColor:e.savingsBar.borderColor,savingsBarBorderRadius:e.savingsBar.borderRadius,borderRadius:e.layout.borderRadius,headerTextColor:e.header.textColor,saveBadgeBgColor:e.header.saveBadgeBgColor,saveBadgeTextColor:e.header.saveBadgeTextColor,saveBadgeBorderColor:e.header.saveBadgeBorderColor,saveBadgeBorderWidth:e.header.saveBadgeBorderWidth,saveBadgeBorderRadius:e.header.saveBadgeBorderRadius,countdownBgColor:e.header.countdownBgColor,countdownTextColor:e.header.countdownTextColor,headerStyle:e.header.headerStyle,headerGradientStart:e.header.gradientStart,headerGradientEnd:e.header.gradientEnd,showSaveBadge:e.pricing.showSaveBadge,imageBorderWidth:e.productList.imageBorderWidth,imageBorderColor:e.productList.imageBorderColor,imageBorderRadius:e.productList.imageBorderRadius,thumbnailRatio:e.productList.thumbnailRatio,variantBorderWidth:e.productList.variantBorderWidth,variantBorderColor:e.productList.variantBorderColor,variantBorderRadius:e.productList.variantBorderRadius,countBubbleBgColor:e.productList.countBubbleBgColor,countBubbleTextColor:e.productList.countBubbleTextColor,showProductPrice:e.productList.showPrice,showProductCompareAtPrice:e.productList.showCompareAtPrice,showCountBubble:e.productList.showCountBubble,showCountdown:e.countdown.showCountdown,ctaText:e.cta.ctaText,outOfStockBehavior:e.outOfStockBehavior,showComparePrice:e.pricing.showComparePrice,showPerUnitPrice:e.pricing.showPerUnitPrice,showItemCount:e.pricing.showItemCount,showCompareAtPrice:e.pricing.showCompareAtPrice,showMostPopular:e.popularBadge.visible,popularBadgeText:e.popularBadge.text,popularBadgeBgColor:e.popularBadge.bgColor,popularBadgeTextColor:e.popularBadge.textColor,popularBadgeBorderWidth:e.popularBadge.borderWidth,popularBadgeBorderColor:e.popularBadge.borderColor,popularBadgeBorderRadius:e.popularBadge.borderRadius,showSearch:e.showSearch,pickerBgColor:e.pickerBgColor,pickerTextColor:e.pickerTextColor,pickerBorderWidth:e.pickerBorderWidth,pickerBorderColor:e.pickerBorderColor,pickerBorderRadius:e.pickerBorderRadius,pickerSearchBorderWidth:e.pickerSearchBorderWidth,pickerSearchBorderColor:e.pickerSearchBorderColor,pickerSearchBorderRadius:e.pickerSearchBorderRadius,pickerProductBorderWidth:e.pickerProductBorderWidth,pickerProductBorderColor:e.pickerProductBorderColor,pickerProductBorderRadius:e.pickerProductBorderRadius,pickerThumbnailRatio:e.pickerThumbnailRatio,pickerShowCountBubble:e.pickerShowCountBubble,pickerCountBubbleBgColor:e.pickerCountBubbleBgColor,pickerCountBubbleTextColor:e.pickerCountBubbleTextColor,pickerAddBgColor:e.pickerAddBgColor,pickerAddLabelColor:e.pickerAddLabelColor,pickerAddBorderWidth:e.pickerAddBorderWidth,pickerAddBorderColor:e.pickerAddBorderColor,pickerAddBorderRadius:e.pickerAddBorderRadius,pickerVariantBorderWidth:e.pickerVariantBorderWidth,pickerVariantBorderColor:e.pickerVariantBorderColor,pickerVariantBorderRadius:e.pickerVariantBorderRadius,tierBorderColor:e.tierBorderColor,tierBorderWidth:e.tierBorderWidth,tierBorderRadius:e.tierBorderRadius,tierSelectedBorderColor:e.tierSelectedBorderColor,tierSelectedBorderWidth:e.tierSelectedBorderWidth,defaultTier:e.defaultTier,...e.popularBadge.tierIndex!==void 0&&{mostPopularTierIndex:e.popularBadge.tierIndex}}}var Wt={primaryColor:"--lb-primary-color",backgroundColor:"--lb-bg",textColor:"--lb-text",imageBorderWidth:"--lb-image-border-width",imageBorderColor:"--lb-image-border-color",imageBorderRadius:"--lb-image-border-radius",variantBorderWidth:"--lb-variant-border-width",variantBorderColor:"--lb-variant-border-color",variantBorderRadius:"--lb-variant-radius",countBubbleBgColor:"--lb-qty-badge-bg",countBubbleTextColor:"--lb-qty-badge-color",borderColor:"--lb-border",borderWidth:"--lb-border-width",buttonTextColor:"--lb-btn-text",borderRadius:"--lb-radius",headerTextColor:"--lb-header-text",saveBadgeBgColor:"--lb-save-badge-bg",saveBadgeTextColor:"--lb-save-badge-text",saveBadgeBorderColor:"--lb-save-badge-border-color",saveBadgeBorderWidth:"--lb-save-badge-border-width",saveBadgeBorderRadius:"--lb-save-badge-radius",countdownBgColor:"--lb-countdown-bg",countdownTextColor:"--lb-countdown-text",ctaBorderWidth:"--lb-cta-border-width",ctaBorderColor:"--lb-cta-border-color",ctaBorderRadius:"--lb-cta-radius",savingsBarBgColor:"--lb-savings-bar-bg",savingsBarTextColor:"--lb-savings-bar-text",savingsBarBorderWidth:"--lb-savings-bar-border-width",savingsBarBorderColor:"--lb-savings-bar-border-color",savingsBarBorderRadius:"--lb-savings-bar-radius",tierBorderColor:"--lb-tier-border-color",tierBorderWidth:"--lb-tier-border-width",tierBorderRadius:"--lb-tier-radius",tierSelectedBorderColor:"--lb-tier-selected-border-color",tierSelectedBorderWidth:"--lb-tier-selected-border-width",popularBadgeBgColor:"--lb-popular-badge-bg",popularBadgeTextColor:"--lb-popular-badge-text",popularBadgeBorderWidth:"--lb-popular-badge-border-width",popularBadgeBorderColor:"--lb-popular-badge-border-color",popularBadgeBorderRadius:"--lb-popular-badge-radius",headerGradientStart:"--lb-header-start",headerGradientEnd:"--lb-header-end",pickerBgColor:"--lb-picker-bg",pickerTextColor:"--lb-picker-text",pickerBorderWidth:"--lb-picker-border-width",pickerBorderColor:"--lb-picker-border-color",pickerBorderRadius:"--lb-picker-radius",pickerSearchBorderWidth:"--lb-picker-search-border-width",pickerSearchBorderColor:"--lb-picker-search-border-color",pickerSearchBorderRadius:"--lb-picker-search-radius",pickerProductBorderWidth:"--lb-picker-product-border-width",pickerProductBorderColor:"--lb-picker-product-border-color",pickerProductBorderRadius:"--lb-picker-product-radius",pickerCountBubbleBgColor:"--lb-picker-qty-badge-bg",pickerCountBubbleTextColor:"--lb-picker-qty-badge-color",pickerAddBgColor:"--lb-picker-add-bg",pickerAddLabelColor:"--lb-picker-add-label",pickerAddBorderWidth:"--lb-picker-add-border-width",pickerAddBorderColor:"--lb-picker-add-border-color",pickerAddBorderRadius:"--lb-picker-add-radius",pickerVariantBorderWidth:"--lb-picker-variant-border-width",pickerVariantBorderColor:"--lb-picker-variant-border-color",pickerVariantBorderRadius:"--lb-picker-variant-radius"},zt=new Set(["borderRadius","borderWidth","saveBadgeBorderWidth","saveBadgeBorderRadius","tierBorderWidth","tierBorderRadius","tierSelectedBorderWidth","savingsBarBorderWidth","savingsBarBorderRadius","ctaBorderWidth","ctaBorderRadius","popularBadgeBorderWidth","popularBadgeBorderRadius","imageBorderWidth","imageBorderRadius","variantBorderWidth","variantBorderRadius","pickerBorderWidth","pickerBorderRadius","pickerSearchBorderWidth","pickerSearchBorderRadius","pickerProductBorderWidth","pickerProductBorderRadius","pickerAddBorderWidth","pickerAddBorderRadius","pickerVariantBorderWidth","pickerVariantBorderRadius"]);function Qe(e,t){let r=$t(t);for(let[a,o]of Object.entries(Wt)){let l=r[a];if(l==null)continue;let d=zt.has(a)?`${l}px`:String(l);e.style.setProperty(o,d)}e.style.setProperty("--lb-product-price-display",t.productList.showPrice?"block":"none"),e.style.setProperty("--lb-product-compare-display",t.productList.showCompareAtPrice?"inline":"none"),e.style.setProperty("--lb-qty-badge-display",t.productList.showCountBubble?"flex":"none"),e.style.setProperty("--lb-picker-qty-badge-display",t.pickerShowCountBubble?"flex":"none"),e.style.setProperty("--lb-variant-chevron",De(t.productList.variantBorderColor)),e.style.setProperty("--lb-picker-variant-chevron",De(t.pickerVariantBorderColor)),t.header.headerStyle==="solid"?e.style.setProperty("--lb-header-bg",t.header.gradientStart):e.style.setProperty("--lb-header-bg",`linear-gradient(135deg, ${t.header.gradientStart}, ${t.header.gradientEnd})`);let i=Fe(t.productList.thumbnailRatio);e.style.setProperty("--lb-thumbnail-aspect-ratio",i.aspectRatio),e.style.setProperty("--lb-thumbnail-img-fit",i.imgFit),e.style.setProperty("--lb-thumbnail-img-height",i.imgHeight);let n=Fe(t.pickerThumbnailRatio);e.style.setProperty("--lb-picker-thumbnail-aspect-ratio",n.aspectRatio),e.style.setProperty("--lb-picker-thumbnail-img-fit",n.imgFit),e.style.setProperty("--lb-picker-thumbnail-img-height",n.imgHeight)}function De(e){return`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='${e.replace(/#/g,"%23")}' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")`}function Fe(e){switch(e){case"tall":return{aspectRatio:"3 / 4",imgFit:"cover",imgHeight:"100%"};case"wide":return{aspectRatio:"4 / 3",imgFit:"cover",imgHeight:"100%"};case"original":return{aspectRatio:"auto",imgFit:"contain",imgHeight:"auto"};default:return{aspectRatio:"1 / 1",imgFit:"cover",imgHeight:"100%"}}}var jt=new Set(["fixed","mix_match","volume"]),Kt=new Set(["active"]);function Be(e,t){try{return Gt(e,t)}catch(r){if(r instanceof te)return null;throw r}}function Gt(e,t){let r=new Map(t.map(E=>[E.key,E])),i=r.get("title")?.value??"Bundle",n=r.get("bundle_type")?.value,a=r.get("status")?.value;if(!n||!jt.has(n))throw new te(`Invalid or missing bundle_type: ${n??"null"}`,"invalid_type");let o=n;if(!a||!Kt.has(a))throw new te(`Bundle is not active: status=${a??"null"}`,"inactive");let l=a,d=r.get("starts_at")?.value??null,p=r.get("ends_at")?.value??null,u=new Date;if(d){let E=new Date(d);if(Number.isNaN(E.getTime()))throw new te(`Invalid starts_at: ${d}`,"invalid_type");if(E>u)throw new te(`Bundle not yet started: starts_at=${d}`,"not_started")}if(p){let E=new Date(p);if(Number.isNaN(E.getTime()))throw new te(`Invalid ends_at: ${p}`,"invalid_type");if(E<u)throw new te(`Bundle has expired: ends_at=${p}`,"expired")}let c=Yt(r),x=Qt(r),v=Xt(r),h={id:e,title:i,description:r.get("description")?.value||null,status:l,products:c,discountConfig:x,widgetConfig:v,startsAt:d,endsAt:p,discountLabel:r.get("discount_label")?.value??null,selectedVariantIds:Jt(r),productQuantities:Ve(r,"product_quantities"),variantQuantities:Ve(r,"variant_quantities"),abTestId:r.get("ab_test_id")?.value??null,abVariantB:Zt(r)};switch(o){case"fixed":return{...h,bundleType:"fixed"};case"volume":return{...h,bundleType:"volume",volumeTiers:er(r)};case"mix_match":return{...h,bundleType:"mix_match",minQuantity:Oe(r,"min_quantity",{min:1}),maxQuantity:Oe(r,"max_quantity",{min:1})}}}function Yt(e){let t=[],r=e.get("products");if(r?.reference&&"variants"in r.reference&&t.push(r.reference),r?.references?.nodes)for(let n of r.references.nodes)"variants"in n?t.push(n):"products"in n&&n.products?.nodes&&t.push(...n.products.nodes);let i=e.get("collection");if(i?.references?.nodes)for(let n of i.references.nodes)"products"in n&&n.products?.nodes&&t.push(...n.products.nodes);return t}function Qt(e){return{discountType:e.get("discount_type")?.value??"percentage",discountValue:parseFloat(e.get("discount_value")?.value??"0"),allowStacking:e.get("allow_stacking")?.value==="true"}}function Xt(e){return Nt(ae(e,"widget_config"))}function Jt(e){let t=ae(e,"selected_variant_ids");if(!Array.isArray(t))return null;let r=[];for(let i of t)Array.isArray(i)?r.push(i.filter(n=>typeof n=="string")):r.push([]);return r}function Ve(e,t){let r=ae(e,t);if(!r||typeof r!="object"||Array.isArray(r))return{};let i={};for(let[n,a]of Object.entries(r)){let o=typeof a=="number"?a:Number(a);Number.isFinite(o)&&o>=0&&o<=99&&(i[n]=Math.floor(o))}return i}function Zt(e){if(!e.get("ab_test_id")?.value)return null;let r={},i=e.get("ab_title")?.value;i&&(r.title=i);let n=e.get("ab_description")?.value;n&&(r.description=n);let a=e.get("ab_discount_type")?.value,o=e.get("ab_discount_value")?.value;if(a&&(a==="percentage"||a==="fixed_amount")&&o){let d=parseFloat(o);Number.isFinite(d)&&(r.discountConfig={discountType:a,discountValue:d,allowStacking:e.get("allow_stacking")?.value==="true"})}let l=ae(e,"ab_volume_tiers");return Array.isArray(l)&&(r.volumeTiers=l.filter(d=>typeof d=="object"&&d!==null).map(Xe)),Object.keys(r).length===0?null:r}function er(e){let t=ae(e,"volume_tiers");return Array.isArray(t)?t.filter(r=>typeof r=="object"&&r!==null).map(Xe):[]}function Xe(e){let t=Number(e.minQuantity??0),r={minQuantity:Number.isFinite(t)&&t>=0?t:0};return typeof e.percentage=="number"&&Number.isFinite(e.percentage)&&(r.percentage=e.percentage),typeof e.amount=="number"&&Number.isFinite(e.amount)&&(r.amount=e.amount),r}function ae(e,t){let r=e.get(t)?.value;if(!r)return null;try{return JSON.parse(r)}catch{return null}}function Oe(e,t,r={}){let i=e.get(t)?.value;if(!i)return null;let n=parseInt(i,10);return isNaN(n)||r.min!==void 0&&n<r.min?null:n}function X(e,t,r){let i=e.variantQuantities[r];return i!==void 0?i:e.productQuantities[t]??1}function Je(e){let t=e.abVariantB;if(!t)return e;let r=t.title??e.title,i=t.description!==void 0?t.description:e.description,n=t.discountConfig??e.discountConfig;switch(e.bundleType){case"volume":return{...e,title:r,description:i,discountConfig:n,volumeTiers:t.volumeTiers??e.volumeTiers};case"mix_match":return{...e,title:r,description:i,discountConfig:n};case"fixed":return{...e,title:r,description:i,discountConfig:n}}}async function Ze(e,t){await rt(e,{shopDomain:e.shopDomain,eventType:"bundle_impression",bundleGid:t.bundleGid,bundleType:t.bundleType,productId:t.productId,abTestId:t.abTestId,abVariant:t.abVariant,occurredAt:new Date().toISOString()})}async function et(e,t){await rt(e,{shopDomain:e.shopDomain,eventType:"bundle_add_to_cart",...t,occurredAt:new Date().toISOString()})}function tt(e,t){if(typeof IntersectionObserver>"u")return t(),()=>{};let r=new IntersectionObserver(i=>{for(let n of i)n.isIntersecting&&(t(),r.unobserve(n.target))},{threshold:.5});return r.observe(e),()=>r.disconnect()}async function rt(e,t){let r=`${e.appUrl}/api/analytics`,i=JSON.stringify(t);try{(await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:i})).ok||(await new Promise(a=>setTimeout(a,2e3)),await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:i}))}catch{try{typeof navigator<"u"&&navigator.sendBeacon&&navigator.sendBeacon(r,i)}catch{}}}var tr=!1;function rr(){if(tr)return!0;if(typeof window>"u")return!1;let e=window.Shopify;try{return e?.customerPrivacy?.analyticsProcessingAllowed?.()===!0}catch{return!1}}var He="lb_session",nr=720*60*60,ir=720*60*60;function nt(e){return`__Host-_lb_ab_${e}`}async function it(e,t,r,i){if(typeof document>"u")return null;let n=or(i);if(n&&n.testId===r)return{variant:n.variant,testId:r,persisted:!0};if(!rr())return{variant:"A",testId:r,persisted:!1};let a=lr(),o=dr(a,r);ar(i,r,o);try{fetch(`${e}/api/ab-assign`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({shopDomain:t,testId:r,sessionId:a,variant:o})}).catch(()=>{})}catch{}return{variant:o,testId:r,persisted:!0}}function or(e){if(typeof document>"u")return null;let r=`${nt(e)}=`,n=document.cookie.split(";").map(d=>d.trim()).find(d=>d.startsWith(r));if(!n)return null;let a=n.substring(r.length),[o,l]=a.split("|");return o!=="A"&&o!=="B"||!l?null:{testId:l,variant:o}}function ar(e,t,r){if(typeof document>"u")return;let i=nt(e),n=`${r}|${t}|${Date.now()}`;document.cookie=`${i}=${n}; Path=/; Max-Age=${ir}; SameSite=Lax; Secure`}function lr(){if(typeof document>"u")return Ue();let t=document.cookie.split(";").map(i=>i.trim()).find(i=>i.startsWith(`${He}=`))?.split("=")[1];if(t)return t;let r=Ue();return document.cookie=`${He}=${r}; path=/; max-age=${nr}; SameSite=Lax; Secure`,r}function Ue(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function dr(e,t){let r=e+":"+t,i=2166136261;for(let n=0;n<r.length;n++)i^=r.charCodeAt(n),i=Math.imul(i,16777619);return(i>>>0)%2===0?"A":"B"}var Ne=1e4,sr=[[/@import/i,"@import rules"],[/@charset/i,"@charset declarations"],[/expression\s*\(/i,"CSS expressions"],[/-moz-binding/i,"-moz-binding"],[/-webkit-binding/i,"-webkit-binding"],[/behavior\s*:/i,"behavior property"]],cr=/^(https:|\/[^/]|\.\/|\.\.\/|#)/;function Se(e){if(e.length>Ne)return{ok:!1,error:`CSS exceeds ${Ne.toLocaleString("en-US")} character limit`};let t=e.replace(/\/\*[\s\S]*?\*\//g,"");try{t=t.replace(/\\([0-9a-fA-F]{1,6})[ \t\n\f]?/g,(n,a)=>{let o=parseInt(a,16);return o<0||o>1114111?"\uFFFD":String.fromCodePoint(o)}),t=t.replace(/\\\r?\n/g,""),t=t.replace(/\\([^\n\r\f0-9a-fA-F])/g,"$1")}catch{return{ok:!1,error:"CSS contains invalid unicode escape sequences"}}t=t.replace(/</g,"").replace(/>/g,"");for(let[n,a]of sr)if(n.test(t))return{ok:!1,error:`CSS contains blocked pattern: ${a}`};let r=/url\s*\(\s*([\s\S]*?)\s*\)/gi,i;for(;(i=r.exec(t))!==null;){let n=i[1].trim();if((n.startsWith("'")||n.startsWith('"'))&&(n=n.slice(1)),(n.endsWith("'")||n.endsWith('"'))&&(n=n.slice(0,-1)),n=n.trim(),n&&!cr.test(n))return{ok:!1,error:"CSS url() values must use https:// or relative paths"}}return{ok:!0,css:t}}var ur="lb-custom-css-";function ot(e,t){if(typeof document>"u"||!t)return!1;let r=Se(t);if(!r.ok||!r.css.trim())return!1;let i=ur+pr(e),n=document.getElementById(i);return n||(n=document.createElement("style"),n.id=i,n.setAttribute("data-lime-bundles","custom-css"),document.head.appendChild(n)),n.textContent!==r.css&&(n.textContent=r.css),!0}function pr(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return(t>>>0).toString(16)}function br(e,t){let r=typeof e=="string"?parseFloat(e):e;try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t}).format(r)}catch{return`${t} ${r.toFixed(2)}`}}var hr={CL:"cl",CM:"cm",FLOZ:"fl oz",FT:"ft",FT2:"ft\xB2",G:"g",GAL:"gal",IN:"in",ITEM:"each",KG:"kg",L:"l",LB:"lb",M:"m",M2:"m\xB2",M3:"m\xB3",MG:"mg",ML:"ml",MM:"mm",OZ:"oz",PT:"pt",QT:"qt",UNKNOWN:"",YD:"yd"};function Z(e,t,r){if(!e||!t||t.referenceUnit==="UNKNOWN")return null;let i=parseFloat(e.amount);if(!Number.isFinite(i))return null;let n=hr[t.referenceUnit]??"";if(!n)return null;let a=e.currencyCode||r||"USD",o=br(i,a),l=t.referenceValue,d=l===1?n:`${l}${n}`;return`${o}/${d}`}function q(e){if(e==null)return 0;let t=typeof e=="string"?parseFloat(e):e;return Number.isFinite(t)?Math.round(t*100):0}function R(e,t){try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t}).format(e/100)}catch{return`${t} ${(e/100).toFixed(2)}`}}function at(e,t){return Math.max(0,e-Math.floor(e*t/100))}function Ee(e,t=e.productQuantities,r=e.widgetConfig.pricing.showSaveBadge){let{discountType:i,discountValue:n}=e.discountConfig,a=[],o=0,l=0;for(let c of e.products){let x=c.variants.nodes.find(y=>y.availableForSale)??c.variants.nodes[0];if(!x)continue;let v=q(x.price.amount),h=t[c.id]??1,E=v*h,B=x.compareAtPrice?q(x.compareAtPrice.amount):null;if(a.push({unitCents:v,qty:h,lineCents:E,compareCents:B}),o+=E,i==="percentage"){let y=at(v,n);l+=y*h}else l+=E}i==="fixed_amount"&&(l=Math.max(0,o-Math.round(n*100)));let d=Math.max(0,o-l),p=e.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",u="";return r&&d>0&&(i==="percentage"&&n>0?u=`-${Math.round(n)}%`:i==="fixed_amount"&&n>0&&(u=`-${R(Math.round(n*100),p)}`)),{rows:a,totalCents:o,saleCents:l,savingsCents:d,headerBadge:u,currency:p}}function ce(e,t){if(t.discountType==="percentage"){let r=Math.floor(e*t.discountValue/100);return Math.max(0,e-r)}return Math.max(0,e-Math.round(t.discountValue*100))}var V=152;function ee(e,t={}){if(!e)return"";try{let r=new URL(e);return t.width!==void 0&&r.searchParams.set("width",String(t.width)),t.height!==void 0&&r.searchParams.set("height",String(t.height)),t.crop&&r.searchParams.set("crop",t.crop),r.toString()}catch{return e}}function lt(e){if(!Number.isFinite(e)||e<=0)return"";let t=Math.floor(e/1e3),r=Math.floor(t/86400),i=Math.floor(t%86400/3600),n=Math.floor(t%3600/60),a=t%60,o=l=>String(l).padStart(2,"0");return r>0?`${r}d ${o(i)}h ${o(n)}m ${o(a)}s`:`${o(i)}h ${o(n)}m ${o(a)}s`}var Te={};We(Te,{computePosition:()=>gr,emptyTypeAheadState:()=>yr,handleKey:()=>xr,pushTypeAheadChar:()=>Cr});var mr=4;function gr({trigger:e,viewportHeight:t,desiredHeight:r,margin:i=mr}){let n=Math.max(0,t-e.bottom-i),a=Math.max(0,e.top-i),o=r<=n?"down":a>n?"up":"down",d=Math.min(r,o==="down"?n:a),p=o==="down"?e.bottom+i:e.top-i-d;return{placement:o,maxHeight:d,offsetTop:p,offsetLeft:e.left,width:e.width}}var Ce={type:"passthrough",preventDefault:!1};function _e(e){for(let t=0;t<e.length;t++)if(!e[t].disabled)return t;return-1}function qe(e){for(let t=e.length-1;t>=0;t--)if(!e[t].disabled)return t;return-1}function fr(e,t){if(e.length===0)return-1;for(let r=1;r<=e.length;r++){let i=(t+r)%e.length;if(!e[i].disabled)return i}return t}function vr(e,t){if(e.length===0)return-1;for(let r=1;r<=e.length;r++){let i=(t-r+e.length)%e.length;if(!e[i].disabled)return i}return t}function $e(e){return e.length===1&&e!==" "&&/\S/.test(e)}function xr(e,t){if(e.ctrlKey||e.metaKey||e.altKey)return Ce;let{key:r}=e,{isOpen:i,activeIndex:n,selectedIndex:a,options:o}=t;if(!i)switch(r){case"Enter":case" ":case"ArrowDown":return{type:"open",activeIndex:a>=0&&!o[a]?.disabled?a:_e(o),preventDefault:!0};case"ArrowUp":return{type:"open",activeIndex:a>=0&&!o[a]?.disabled?a:qe(o),preventDefault:!0};default:return $e(r)?{type:"open",activeIndex:a>=0&&!o[a]?.disabled?a:_e(o),preventDefault:!0}:Ce}switch(r){case"ArrowDown":return{type:"move-active",activeIndex:fr(o,n),preventDefault:!0};case"ArrowUp":return{type:"move-active",activeIndex:vr(o,n),preventDefault:!0};case"Home":return{type:"move-active",activeIndex:_e(o),preventDefault:!0};case"End":return{type:"move-active",activeIndex:qe(o),preventDefault:!0};case"Enter":case" ":return n>=0&&!o[n]?.disabled?{type:"commit",index:n,preventDefault:!0}:{type:"passthrough",preventDefault:!0};case"Escape":return{type:"close",commit:!1,restoreFocus:!0,preventDefault:!0};case"Tab":return{type:"close",commit:!1,restoreFocus:!1,preventDefault:!1};default:return $e(r)?{type:"type-ahead",char:r,preventDefault:!1}:Ce}}var wr=500;function yr(){return{buffer:"",lastTime:0}}function Cr(e,t,r,i,n=wr){if(t.length!==1)return{newState:e,matchedIndex:null};let o=(r-e.lastTime>n?"":e.buffer)+t.toLowerCase(),l={buffer:o,lastTime:r};for(let d=0;d<i.length;d++){let p=i[d];if(!p.disabled&&p.label.toLowerCase().startsWith(o))return{newState:l,matchedIndex:d}}return{newState:l,matchedIndex:null}}var _r={};We(_r,{findVariantByOptions:()=>kr,isOptionValueAvailable:()=>Br,toPickerVariant:()=>Sr});function kr(e,t){if(e.length===0)return null;for(let r of e){if(r.optionValues.length!==t.length)continue;let i=!0;for(let n=0;n<r.optionValues.length;n++)if(r.optionValues[n]!==t[n]){i=!1;break}if(i)return r}return null}function Br(e,t,r,i){for(let n of e){if(!n.available||n.optionValues[t]!==r)continue;let a=!0;for(let o=0;o<n.optionValues.length;o++)if(o!==t&&n.optionValues[o]!==i[o]){a=!1;break}if(a)return!0}return!1}function Sr(e){return{id:e.id,optionValues:e.selectedOptions.map(t=>t.value),available:e.availableForSale}}var{computePosition:Er,emptyTypeAheadState:Tr,handleKey:Ar,pushTypeAheadChar:Pr}=Te,Lr=32,Mr=8,Ir=8,K=[];function pe(e){let t=e.composedPath();for(let r=K.length-1;r>=0;r--){let i=K[r];!t.includes(i.shell)&&!t.includes(i.listbox)&&i.close()}}function dt(){for(let e=K.length-1;e>=0;e--)K[e].close()}var be=!1;function Rr(){be||(document.addEventListener("pointerdown",pe,!0),window.addEventListener("scroll",pe,!0),window.addEventListener("resize",dt),be=!0)}function Dr(){!be||K.length>0||(document.removeEventListener("pointerdown",pe,!0),window.removeEventListener("scroll",pe,!0),window.removeEventListener("resize",dt),be=!1)}function ue(e){let t=[];for(let r=0;r<e.options.length;r++){let i=e.options[r];t.push({disabled:i.disabled,label:i.textContent||i.value})}return t}function Fr(e){for(let t=0;t<e.length;t++)if(!e[t].disabled)return t;return-1}var Vr=["lb-bundle-variant-select","lb-mix-match__variant-select"],Or=Vr.map(e=>`select.${e}:not(.lb-dropdown-state)`).join(", ");function Hr(e){let t=e;if(e.classList.contains("lb-dropdown-state"))return t.__lbDropdownInstance??null;let r=e.ownerDocument,i=e.getRootNode(),n=e.getAttribute("aria-label")??"",a=`lb-dd-${Math.random().toString(36).slice(2,9)}`;e.classList.add("lb-dropdown-state"),e.setAttribute("aria-hidden","true"),e.setAttribute("tabindex","-1");let o=r.createElement("div");o.className="lb-dropdown",o.setAttribute("data-lb-dropdown","");let l=r.createElement("button");l.type="button",l.className="lb-dropdown-trigger",l.setAttribute("role","combobox"),l.setAttribute("aria-haspopup","listbox"),l.setAttribute("aria-expanded","false");let d=`${a}-listbox`;l.setAttribute("aria-controls",d),n&&l.setAttribute("aria-label",n);let p=r.createElement("span");p.className="lb-dropdown-trigger-value";let u=r.createElement("span");u.className="lb-dropdown-chevron",u.setAttribute("aria-hidden","true"),l.appendChild(p),l.appendChild(u);let c=r.createElement("ul");c.id=d,c.className="lb-dropdown-listbox",c.setAttribute("role","listbox"),n&&c.setAttribute("aria-label",n),c.hidden=!0,o.appendChild(l),e.parentNode?.insertBefore(o,e.nextSibling);let x=e.closest("[data-modal-overlay]");x?(x.appendChild(c),c.setAttribute("data-lb-dropdown-portal","")):o.appendChild(c);let v=!1,h=-1,E=Tr(),B=[],y;function S(){let g=ue(e),w=e.selectedIndex;for(p.textContent=w>=0&&g[w]?g[w].label:"";c.firstChild;)c.removeChild(c.firstChild);B=[];for(let _=0;_<g.length;_++){let D=r.createElement("li");D.id=`${a}-opt-${_}`,D.className="lb-dropdown-option",D.setAttribute("role","option"),D.setAttribute("aria-selected",_===w?"true":"false"),g[_].disabled&&D.setAttribute("aria-disabled","true"),D.setAttribute("data-value",e.options[_].value),D.setAttribute("data-index",String(_)),D.textContent=g[_].label,c.appendChild(D),B.push(D)}}function A(g){if(h>=0&&B[h]&&B[h].classList.remove("is-active"),h=g,g>=0&&B[g]){let w=B[g];w.classList.add("is-active"),l.setAttribute("aria-activedescendant",w.id);let _=w.offsetTop,D=_+w.offsetHeight,re=c.scrollTop,J=re+c.clientHeight;_<re?c.scrollTop=_:D>J&&(c.scrollTop=D-c.clientHeight)}else l.setAttribute("aria-activedescendant","")}function f(){let g=l.getBoundingClientRect();if(g.width===0)return!1;let _=Math.min(B.length||1,Ir)*Lr+Mr,D=Er({trigger:{top:g.top,bottom:g.bottom,left:g.left,width:g.width},viewportHeight:window.innerHeight,desiredHeight:_});return c.setAttribute("data-placement",D.placement),c.style.maxHeight=`${D.maxHeight}px`,c.hasAttribute("data-lb-dropdown-portal")&&(c.style.top=`${D.offsetTop}px`,c.style.left=`${D.offsetLeft}px`,c.style.width=`${D.width}px`),!0}function P(){if(v)return;for(let _=K.length-1;_>=0;_--)K[_]!==y&&K[_].close();v=!0,c.hidden=!1,l.setAttribute("aria-expanded","true"),f()||requestAnimationFrame(()=>f());let g=ue(e),w=e.selectedIndex;w>=0&&g[w]&&!g[w].disabled?A(w):A(Fr(g)),K.push(y),K.length===1&&Rr()}function C(g){if(!v)return;v=!1,c.hidden=!0,l.setAttribute("aria-expanded","false"),l.setAttribute("aria-activedescendant",""),h>=0&&B[h]&&B[h].classList.remove("is-active"),h=-1;let w=K.indexOf(y);w>=0&&K.splice(w,1),K.length===0&&Dr(),g&&l.focus()}function M(g){let w=e.options[g];if(!(!w||w.disabled)){if(e.value!==w.value){e.value=w.value;let _=new Event("change",{bubbles:!0});e.dispatchEvent(_)}S(),C(!0)}}function U(g){switch(g.type){case"open":P(),g.activeIndex>=0&&A(g.activeIndex);return;case"close":C(g.restoreFocus);return;case"move-active":A(g.activeIndex);return;case"commit":M(g.index);return;case"type-ahead":{let w=ue(e),_=Pr(E,g.char,Date.now(),w);E=_.newState,_.matchedIndex!==null&&(v||P(),A(_.matchedIndex));return}case"passthrough":return;default:{let w=g}}}function I(g){let w=ue(e),_=Ar({key:g.key,ctrlKey:g.ctrlKey,metaKey:g.metaKey,altKey:g.altKey,shiftKey:g.shiftKey},{isOpen:v,activeIndex:h,selectedIndex:e.selectedIndex,options:w});_.preventDefault&&g.preventDefault(),U(_)}function b(g){g.preventDefault(),v?C(!1):P()}function T(g){let w=g.target;for(;w&&w!==c;){if(w.classList?.contains("lb-dropdown-option")){let _=parseInt(w.getAttribute("data-index")??"",10);if(!Number.isNaN(_)){M(_);return}}w=w.parentElement}}function L(g){let w=g.target;for(;w&&w!==c;){if(w.classList?.contains("lb-dropdown-option")){if(w.getAttribute("aria-disabled")==="true")return;let _=parseInt(w.getAttribute("data-index")??"",10);!Number.isNaN(_)&&_!==h&&A(_);return}w=w.parentElement}}function m(){setTimeout(()=>{if(!v)return;let g=i.activeElement??r.activeElement;o.contains(g)||C(!1)},0)}function k(){S()}let $=new MutationObserver(()=>{S()});$.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["disabled","value","selected"]});let z=g=>g.preventDefault();l.addEventListener("click",b),l.addEventListener("keydown",I),o.addEventListener("focusout",m),c.addEventListener("mousedown",z),c.addEventListener("click",T),c.addEventListener("mousemove",L),e.addEventListener("change",k);function Q(){v&&C(!1),$.disconnect(),l.removeEventListener("click",b),l.removeEventListener("keydown",I),o.removeEventListener("focusout",m),c.removeEventListener("mousedown",z),c.removeEventListener("click",T),c.removeEventListener("mousemove",L),e.removeEventListener("change",k),o.parentNode&&o.parentNode.removeChild(o),c.parentNode&&c.parentNode.removeChild(c),e.classList.remove("lb-dropdown-state"),e.removeAttribute("aria-hidden"),e.removeAttribute("tabindex"),delete t.__lbDropdownInstance}return y={shell:o,listbox:c,select:e,close:()=>C(!1),destroy:Q},t.__lbDropdownInstance=y,S(),y}function he(e){let t=e.querySelectorAll(Or),r=[];return t.forEach(i=>{let n=Hr(i);n&&r.push(n)}),r}function me(e){e.querySelectorAll("select.lb-dropdown-state").forEach(r=>{let i=r.__lbDropdownInstance;i&&i.destroy()})}function ie(e){let t=Ur(e);if(t===null||t<=Date.now())return null;let r=t,i=document.createElement("div");i.className="lb-bundle-countdown",i.setAttribute("data-countdown","");let n=document.createElement("div");n.className="lb-bundle-countdown__label";let a=document.createElement("span");a.textContent="Ends in",n.appendChild(a),i.appendChild(n);let o=document.createElement("span");o.className="lb-bundle-countdown__timer",o.setAttribute("data-countdown-timer",""),i.appendChild(o);let l=null;function d(){let u=r-Date.now();if(u<=0){i.style.display="none",p();return}o.textContent=lt(u)}function p(){l!==null&&(clearInterval(l),l=null)}return d(),l=setInterval(d,1e3),{el:i,stop:p}}function Ur(e){let t=Date.parse(e);return Number.isFinite(t)?t:null}function oe(e){let t=document.createElement("button");t.type="button",t.className="lb-bundle-cta",t.setAttribute("data-add-bundle","");let r=document.createElement("span");r.className="lb-cta-label",r.setAttribute("data-cta-label",""),r.textContent=e,t.appendChild(r);let i=document.createElement("span");return i.className="lb-cta-spinner",i.setAttribute("data-cta-spinner",""),i.setAttribute("aria-hidden","true"),i.innerHTML='<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><path d="M12 2a10 10 0 0 1 10 10" /></svg>',t.appendChild(i),t}function Ae(e,t){let r=e.querySelector("[data-cta-label]");r&&(r.textContent=t)}function s(e,t,r={}){let i=document.createElement(e);t&&(i.className=t);for(let[n,a]of Object.entries(r))i.setAttribute(n,a);return i}var Nr=`
|
|
232
|
+
`,re=class extends Error{constructor(e,t){super(e),this.reason=t,this.name="BundleParseError"}},X={header:{textColor:"#FFFFFF",headerStyle:"gradient",gradientStart:"#C62828",gradientEnd:"#AD1457",saveBadgeBgColor:"#FFFFFF",saveBadgeTextColor:"#AD1457",saveBadgeBorderColor:"#FFFFFF",saveBadgeBorderWidth:0,saveBadgeBorderRadius:8,countdownBgColor:"#FFF0F3",countdownTextColor:"#C62828"},layout:{backgroundColor:"#FFFFFF",borderColor:"#E5E5E5",borderWidth:1,borderRadius:12},productList:{textColor:"#1A1A1A",imageBorderWidth:0,imageBorderColor:"#E5E5E5",imageBorderRadius:8,thumbnailRatio:"square",variantBorderWidth:1,variantBorderColor:"#E5E5E5",variantBorderRadius:8,showPrice:!0,showCompareAtPrice:!0,showCountBubble:!0,countBubbleBgColor:"#1A1A1A",countBubbleTextColor:"#FFFFFF"},pricing:{showSaveBadge:!0,showComparePrice:!0,showPerUnitPrice:!0,showItemCount:!0,showCompareAtPrice:!0},cta:{ctaText:"Add to cart",primaryColor:"#1A1A1A",buttonTextColor:"#FFFFFF",borderWidth:0,borderColor:"#1A1A1A",borderRadius:12},savingsBar:{visible:!0,bgColor:"#EDFBF1",textColor:"#2DB554",borderWidth:0,borderColor:"#2DB554",borderRadius:8},countdown:{showCountdown:!0},popularBadge:{visible:!0,text:"Most Popular",bgColor:"#1A1A1A",textColor:"#FFFFFF",borderWidth:0,borderColor:"#1A1A1A",borderRadius:12},outOfStockBehavior:"show_greyed_out",showLowStockBadge:!0,lowStockThreshold:10,lowStockBgColor:"#FEF3C7",lowStockTextColor:"#92400E",showSearch:!0,pickerBgColor:"#FFFFFF",pickerTextColor:"#1A1A1A",pickerBorderWidth:0,pickerBorderColor:"#E5E5E5",pickerBorderRadius:16,pickerSearchBorderWidth:1,pickerSearchBorderColor:"#E5E5E5",pickerSearchBorderRadius:8,pickerProductBorderWidth:0,pickerProductBorderColor:"#E5E5E5",pickerProductBorderRadius:8,pickerThumbnailRatio:"square",pickerShowCountBubble:!0,pickerCountBubbleBgColor:"#1A1A1A",pickerCountBubbleTextColor:"#FFFFFF",pickerAddBgColor:"#1A1A1A",pickerAddLabelColor:"#FFFFFF",pickerAddBorderWidth:0,pickerAddBorderColor:"#1A1A1A",pickerAddBorderRadius:8,pickerVariantBorderWidth:1,pickerVariantBorderColor:"#1A1A1A",pickerVariantBorderRadius:8,tierBorderColor:"#E5E5E5",tierBorderWidth:1,tierBorderRadius:12,tierSelectedBorderColor:"#1A1A1A",tierSelectedBorderWidth:2,defaultTier:"first"};function zt(e){if(!e||typeof e!="object")return X;let t=e;return{...X,...t,defaultTier:jt(t.defaultTier),header:{...X.header,...t.header??{}},layout:{...X.layout,...t.layout??{}},productList:{...X.productList,...t.productList??{}},pricing:{...X.pricing,...t.pricing??{}},cta:{...X.cta,...t.cta??{}},savingsBar:{...X.savingsBar,...t.savingsBar??{}},countdown:{...X.countdown,...t.countdown??{}},popularBadge:{...X.popularBadge,...t.popularBadge??{}}}}function jt(e){return e==="first"||e==="best_value"||typeof e=="number"&&Number.isInteger(e)&&e>=0?e:X.defaultTier}function Kt(e){return{primaryColor:e.cta.primaryColor,backgroundColor:e.layout.backgroundColor,textColor:e.productList.textColor,borderColor:e.layout.borderColor,borderWidth:e.layout.borderWidth,buttonTextColor:e.cta.buttonTextColor,ctaBorderWidth:e.cta.borderWidth,ctaBorderColor:e.cta.borderColor,ctaBorderRadius:e.cta.borderRadius,savingsBarBgColor:e.savingsBar.bgColor,savingsBarTextColor:e.savingsBar.textColor,savingsBarBorderWidth:e.savingsBar.borderWidth,savingsBarBorderColor:e.savingsBar.borderColor,savingsBarBorderRadius:e.savingsBar.borderRadius,borderRadius:e.layout.borderRadius,headerTextColor:e.header.textColor,saveBadgeBgColor:e.header.saveBadgeBgColor,saveBadgeTextColor:e.header.saveBadgeTextColor,saveBadgeBorderColor:e.header.saveBadgeBorderColor,saveBadgeBorderWidth:e.header.saveBadgeBorderWidth,saveBadgeBorderRadius:e.header.saveBadgeBorderRadius,countdownBgColor:e.header.countdownBgColor,countdownTextColor:e.header.countdownTextColor,headerStyle:e.header.headerStyle,headerGradientStart:e.header.gradientStart,headerGradientEnd:e.header.gradientEnd,showSaveBadge:e.pricing.showSaveBadge,imageBorderWidth:e.productList.imageBorderWidth,imageBorderColor:e.productList.imageBorderColor,imageBorderRadius:e.productList.imageBorderRadius,thumbnailRatio:e.productList.thumbnailRatio,variantBorderWidth:e.productList.variantBorderWidth,variantBorderColor:e.productList.variantBorderColor,variantBorderRadius:e.productList.variantBorderRadius,countBubbleBgColor:e.productList.countBubbleBgColor,countBubbleTextColor:e.productList.countBubbleTextColor,showProductPrice:e.productList.showPrice,showProductCompareAtPrice:e.productList.showCompareAtPrice,showCountBubble:e.productList.showCountBubble,showCountdown:e.countdown.showCountdown,ctaText:e.cta.ctaText,outOfStockBehavior:e.outOfStockBehavior,showLowStockBadge:e.showLowStockBadge,lowStockThreshold:e.lowStockThreshold,lowStockBgColor:e.lowStockBgColor,lowStockTextColor:e.lowStockTextColor,showComparePrice:e.pricing.showComparePrice,showPerUnitPrice:e.pricing.showPerUnitPrice,showItemCount:e.pricing.showItemCount,showCompareAtPrice:e.pricing.showCompareAtPrice,showMostPopular:e.popularBadge.visible,popularBadgeText:e.popularBadge.text,popularBadgeBgColor:e.popularBadge.bgColor,popularBadgeTextColor:e.popularBadge.textColor,popularBadgeBorderWidth:e.popularBadge.borderWidth,popularBadgeBorderColor:e.popularBadge.borderColor,popularBadgeBorderRadius:e.popularBadge.borderRadius,showSearch:e.showSearch,pickerBgColor:e.pickerBgColor,pickerTextColor:e.pickerTextColor,pickerBorderWidth:e.pickerBorderWidth,pickerBorderColor:e.pickerBorderColor,pickerBorderRadius:e.pickerBorderRadius,pickerSearchBorderWidth:e.pickerSearchBorderWidth,pickerSearchBorderColor:e.pickerSearchBorderColor,pickerSearchBorderRadius:e.pickerSearchBorderRadius,pickerProductBorderWidth:e.pickerProductBorderWidth,pickerProductBorderColor:e.pickerProductBorderColor,pickerProductBorderRadius:e.pickerProductBorderRadius,pickerThumbnailRatio:e.pickerThumbnailRatio,pickerShowCountBubble:e.pickerShowCountBubble,pickerCountBubbleBgColor:e.pickerCountBubbleBgColor,pickerCountBubbleTextColor:e.pickerCountBubbleTextColor,pickerAddBgColor:e.pickerAddBgColor,pickerAddLabelColor:e.pickerAddLabelColor,pickerAddBorderWidth:e.pickerAddBorderWidth,pickerAddBorderColor:e.pickerAddBorderColor,pickerAddBorderRadius:e.pickerAddBorderRadius,pickerVariantBorderWidth:e.pickerVariantBorderWidth,pickerVariantBorderColor:e.pickerVariantBorderColor,pickerVariantBorderRadius:e.pickerVariantBorderRadius,tierBorderColor:e.tierBorderColor,tierBorderWidth:e.tierBorderWidth,tierBorderRadius:e.tierBorderRadius,tierSelectedBorderColor:e.tierSelectedBorderColor,tierSelectedBorderWidth:e.tierSelectedBorderWidth,defaultTier:e.defaultTier,...e.popularBadge.tierIndex!==void 0&&{mostPopularTierIndex:e.popularBadge.tierIndex}}}var Gt={primaryColor:"--lb-primary-color",backgroundColor:"--lb-bg",textColor:"--lb-text",imageBorderWidth:"--lb-image-border-width",imageBorderColor:"--lb-image-border-color",imageBorderRadius:"--lb-image-border-radius",variantBorderWidth:"--lb-variant-border-width",variantBorderColor:"--lb-variant-border-color",variantBorderRadius:"--lb-variant-radius",countBubbleBgColor:"--lb-qty-badge-bg",countBubbleTextColor:"--lb-qty-badge-color",borderColor:"--lb-border",borderWidth:"--lb-border-width",buttonTextColor:"--lb-btn-text",borderRadius:"--lb-radius",headerTextColor:"--lb-header-text",saveBadgeBgColor:"--lb-save-badge-bg",saveBadgeTextColor:"--lb-save-badge-text",saveBadgeBorderColor:"--lb-save-badge-border-color",saveBadgeBorderWidth:"--lb-save-badge-border-width",saveBadgeBorderRadius:"--lb-save-badge-radius",countdownBgColor:"--lb-countdown-bg",countdownTextColor:"--lb-countdown-text",ctaBorderWidth:"--lb-cta-border-width",ctaBorderColor:"--lb-cta-border-color",ctaBorderRadius:"--lb-cta-radius",savingsBarBgColor:"--lb-savings-bar-bg",savingsBarTextColor:"--lb-savings-bar-text",savingsBarBorderWidth:"--lb-savings-bar-border-width",savingsBarBorderColor:"--lb-savings-bar-border-color",savingsBarBorderRadius:"--lb-savings-bar-radius",tierBorderColor:"--lb-tier-border-color",tierBorderWidth:"--lb-tier-border-width",tierBorderRadius:"--lb-tier-radius",tierSelectedBorderColor:"--lb-tier-selected-border-color",tierSelectedBorderWidth:"--lb-tier-selected-border-width",popularBadgeBgColor:"--lb-popular-badge-bg",popularBadgeTextColor:"--lb-popular-badge-text",popularBadgeBorderWidth:"--lb-popular-badge-border-width",popularBadgeBorderColor:"--lb-popular-badge-border-color",popularBadgeBorderRadius:"--lb-popular-badge-radius",headerGradientStart:"--lb-header-start",headerGradientEnd:"--lb-header-end",pickerBgColor:"--lb-picker-bg",pickerTextColor:"--lb-picker-text",pickerBorderWidth:"--lb-picker-border-width",pickerBorderColor:"--lb-picker-border-color",pickerBorderRadius:"--lb-picker-radius",pickerSearchBorderWidth:"--lb-picker-search-border-width",pickerSearchBorderColor:"--lb-picker-search-border-color",pickerSearchBorderRadius:"--lb-picker-search-radius",pickerProductBorderWidth:"--lb-picker-product-border-width",pickerProductBorderColor:"--lb-picker-product-border-color",pickerProductBorderRadius:"--lb-picker-product-radius",pickerCountBubbleBgColor:"--lb-picker-qty-badge-bg",pickerCountBubbleTextColor:"--lb-picker-qty-badge-color",pickerAddBgColor:"--lb-picker-add-bg",pickerAddLabelColor:"--lb-picker-add-label",pickerAddBorderWidth:"--lb-picker-add-border-width",pickerAddBorderColor:"--lb-picker-add-border-color",pickerAddBorderRadius:"--lb-picker-add-radius",pickerVariantBorderWidth:"--lb-picker-variant-border-width",pickerVariantBorderColor:"--lb-picker-variant-border-color",pickerVariantBorderRadius:"--lb-picker-variant-radius"},Yt=new Set(["borderRadius","borderWidth","saveBadgeBorderWidth","saveBadgeBorderRadius","tierBorderWidth","tierBorderRadius","tierSelectedBorderWidth","savingsBarBorderWidth","savingsBarBorderRadius","ctaBorderWidth","ctaBorderRadius","popularBadgeBorderWidth","popularBadgeBorderRadius","imageBorderWidth","imageBorderRadius","variantBorderWidth","variantBorderRadius","pickerBorderWidth","pickerBorderRadius","pickerSearchBorderWidth","pickerSearchBorderRadius","pickerProductBorderWidth","pickerProductBorderRadius","pickerAddBorderWidth","pickerAddBorderRadius","pickerVariantBorderWidth","pickerVariantBorderRadius"]);function tt(e,t){let r=Kt(t);for(let[a,i]of Object.entries(Gt)){let l=r[a];if(l==null)continue;let d=Yt.has(a)?`${l}px`:String(l);e.style.setProperty(i,d)}e.style.setProperty("--lb-product-price-display",t.productList.showPrice?"block":"none"),e.style.setProperty("--lb-product-compare-display",t.productList.showCompareAtPrice?"inline":"none"),e.style.setProperty("--lb-qty-badge-display",t.productList.showCountBubble?"flex":"none"),e.style.setProperty("--lb-picker-qty-badge-display",t.pickerShowCountBubble?"flex":"none"),e.style.setProperty("--lb-variant-chevron",Ue(t.productList.variantBorderColor)),e.style.setProperty("--lb-picker-variant-chevron",Ue(t.pickerVariantBorderColor)),t.header.headerStyle==="solid"?e.style.setProperty("--lb-header-bg",t.header.gradientStart):e.style.setProperty("--lb-header-bg",`linear-gradient(135deg, ${t.header.gradientStart}, ${t.header.gradientEnd})`);let o=Ne(t.productList.thumbnailRatio);e.style.setProperty("--lb-thumbnail-aspect-ratio",o.aspectRatio),e.style.setProperty("--lb-thumbnail-img-fit",o.imgFit),e.style.setProperty("--lb-thumbnail-img-height",o.imgHeight);let n=Ne(t.pickerThumbnailRatio);e.style.setProperty("--lb-picker-thumbnail-aspect-ratio",n.aspectRatio),e.style.setProperty("--lb-picker-thumbnail-img-fit",n.imgFit),e.style.setProperty("--lb-picker-thumbnail-img-height",n.imgHeight)}function Ue(e){return`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='${e.replace(/#/g,"%23")}' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")`}function Ne(e){switch(e){case"tall":return{aspectRatio:"3 / 4",imgFit:"cover",imgHeight:"100%"};case"wide":return{aspectRatio:"4 / 3",imgFit:"cover",imgHeight:"100%"};case"original":return{aspectRatio:"auto",imgFit:"contain",imgHeight:"auto"};default:return{aspectRatio:"1 / 1",imgFit:"cover",imgHeight:"100%"}}}var Qt=new Set(["fixed","mix_match","volume"]),Xt=new Set(["active"]);function Ee(e,t){try{return Jt(e,t)}catch(r){if(r instanceof re)return null;throw r}}function Jt(e,t){let r=new Map(t.map(k=>[k.key,k])),o=r.get("title")?.value??"Bundle",n=r.get("bundle_type")?.value,a=r.get("status")?.value;if(!n||!Qt.has(n))throw new re(`Invalid or missing bundle_type: ${n??"null"}`,"invalid_type");let i=n;if(!a||!Xt.has(a))throw new re(`Bundle is not active: status=${a??"null"}`,"inactive");let l=a,d=r.get("starts_at")?.value??null,u=r.get("ends_at")?.value??null,p=new Date;if(d){let k=new Date(d);if(Number.isNaN(k.getTime()))throw new re(`Invalid starts_at: ${d}`,"invalid_type");if(k>p)throw new re(`Bundle not yet started: starts_at=${d}`,"not_started")}if(u){let k=new Date(u);if(Number.isNaN(k.getTime()))throw new re(`Invalid ends_at: ${u}`,"invalid_type");if(k<p)throw new re(`Bundle has expired: ends_at=${u}`,"expired")}let c=Zt(r),_=er(r),g=tr(r),f={id:e,title:o,description:r.get("description")?.value||null,status:l,products:c,discountConfig:_,widgetConfig:g,startsAt:d,endsAt:u,discountLabel:r.get("discount_label")?.value??null,selectedVariantIds:rr(r),productQuantities:qe(r,"product_quantities"),variantQuantities:qe(r,"variant_quantities"),abTestId:r.get("ab_test_id")?.value??null,abVariantB:nr(r)};switch(i){case"fixed":return{...f,bundleType:"fixed"};case"volume":return{...f,bundleType:"volume",volumeTiers:or(r)};case"mix_match":return{...f,bundleType:"mix_match",minQuantity:$e(r,"min_quantity",{min:1}),maxQuantity:$e(r,"max_quantity",{min:1})}}}function Zt(e){let t=[],r=e.get("products");if(r?.reference&&"variants"in r.reference&&t.push(r.reference),r?.references?.nodes)for(let n of r.references.nodes)"variants"in n?t.push(n):"products"in n&&n.products?.nodes&&t.push(...n.products.nodes);let o=e.get("collection");if(o?.references?.nodes)for(let n of o.references.nodes)"products"in n&&n.products?.nodes&&t.push(...n.products.nodes);return t}function er(e){return{discountType:e.get("discount_type")?.value??"percentage",discountValue:parseFloat(e.get("discount_value")?.value??"0"),allowStacking:e.get("allow_stacking")?.value==="true"}}function tr(e){return zt(se(e,"widget_config"))}function rr(e){let t=se(e,"selected_variant_ids");if(!Array.isArray(t))return null;let r=[];for(let o of t)Array.isArray(o)?r.push(o.filter(n=>typeof n=="string")):r.push([]);return r}function qe(e,t){let r=se(e,t);if(!r||typeof r!="object"||Array.isArray(r))return{};let o={};for(let[n,a]of Object.entries(r)){let i=typeof a=="number"?a:Number(a);Number.isFinite(i)&&i>=0&&i<=99&&(o[n]=Math.floor(i))}return o}function nr(e){if(!e.get("ab_test_id")?.value)return null;let r={},o=e.get("ab_title")?.value;o&&(r.title=o);let n=e.get("ab_description")?.value;n&&(r.description=n);let a=e.get("ab_discount_type")?.value,i=e.get("ab_discount_value")?.value;if(a&&(a==="percentage"||a==="fixed_amount")&&i){let d=parseFloat(i);Number.isFinite(d)&&(r.discountConfig={discountType:a,discountValue:d,allowStacking:e.get("allow_stacking")?.value==="true"})}let l=se(e,"ab_volume_tiers");return Array.isArray(l)&&(r.volumeTiers=l.filter(d=>typeof d=="object"&&d!==null).map(rt)),Object.keys(r).length===0?null:r}function or(e){let t=se(e,"volume_tiers");return Array.isArray(t)?t.filter(r=>typeof r=="object"&&r!==null).map(rt):[]}function rt(e){let t=Number(e.minQuantity??0),r={minQuantity:Number.isFinite(t)&&t>=0?t:0};return typeof e.percentage=="number"&&Number.isFinite(e.percentage)&&(r.percentage=e.percentage),typeof e.amount=="number"&&Number.isFinite(e.amount)&&(r.amount=e.amount),r}function se(e,t){let r=e.get(t)?.value;if(!r)return null;try{return JSON.parse(r)}catch{return null}}function $e(e,t,r={}){let o=e.get(t)?.value;if(!o)return null;let n=parseInt(o,10);return isNaN(n)||r.min!==void 0&&n<r.min?null:n}function z(e,t,r){let o=e.variantQuantities[r];return o!==void 0?o:e.productQuantities[t]??1}function nt(e){let t=e.abVariantB;if(!t)return e;let r=t.title??e.title,o=t.description!==void 0?t.description:e.description,n=t.discountConfig??e.discountConfig;switch(e.bundleType){case"volume":return{...e,title:r,description:o,discountConfig:n,volumeTiers:t.volumeTiers??e.volumeTiers};case"mix_match":return{...e,title:r,description:o,discountConfig:n};case"fixed":return{...e,title:r,description:o,discountConfig:n}}}async function ot(e,t){await lt(e,{shopDomain:e.shopDomain,eventType:"bundle_impression",bundleGid:t.bundleGid,bundleType:t.bundleType,productId:t.productId,abTestId:t.abTestId,abVariant:t.abVariant,occurredAt:new Date().toISOString()})}async function it(e,t){await lt(e,{shopDomain:e.shopDomain,eventType:"bundle_add_to_cart",...t,occurredAt:new Date().toISOString()})}function at(e,t){if(typeof IntersectionObserver>"u")return t(),()=>{};let r=new IntersectionObserver(o=>{for(let n of o)n.isIntersecting&&(t(),r.unobserve(n.target))},{threshold:.5});return r.observe(e),()=>r.disconnect()}async function lt(e,t){let r=`${e.appUrl}/api/analytics`,o=JSON.stringify(t);try{(await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:o})).ok||(await new Promise(a=>setTimeout(a,2e3)),await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:o}))}catch{try{typeof navigator<"u"&&navigator.sendBeacon&&navigator.sendBeacon(r,o)}catch{}}}var ir=!1;function ar(){if(ir)return!0;if(typeof window>"u")return!1;let e=window.Shopify;try{return e?.customerPrivacy?.analyticsProcessingAllowed?.()===!0}catch{return!1}}var We="lb_session",lr=720*60*60,dr=720*60*60;function dt(e){return`__Host-_lb_ab_${e}`}async function st(e,t,r,o){if(typeof document>"u")return null;let n=sr(o);if(n&&n.testId===r)return{variant:n.variant,testId:r,persisted:!0};if(!ar())return{variant:"A",testId:r,persisted:!1};let a=ur(),i=pr(a,r);cr(o,r,i);try{fetch(`${e}/api/ab-assign`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({shopDomain:t,testId:r,sessionId:a,variant:i})}).catch(()=>{})}catch{}return{variant:i,testId:r,persisted:!0}}function sr(e){if(typeof document>"u")return null;let r=`${dt(e)}=`,n=document.cookie.split(";").map(d=>d.trim()).find(d=>d.startsWith(r));if(!n)return null;let a=n.substring(r.length),[i,l]=a.split("|");return i!=="A"&&i!=="B"||!l?null:{testId:l,variant:i}}function cr(e,t,r){if(typeof document>"u")return;let o=dt(e),n=`${r}|${t}|${Date.now()}`;document.cookie=`${o}=${n}; Path=/; Max-Age=${dr}; SameSite=Lax; Secure`}function ur(){if(typeof document>"u")return ze();let t=document.cookie.split(";").map(o=>o.trim()).find(o=>o.startsWith(`${We}=`))?.split("=")[1];if(t)return t;let r=ze();return document.cookie=`${We}=${r}; path=/; max-age=${lr}; SameSite=Lax; Secure`,r}function ze(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function pr(e,t){let r=e+":"+t,o=2166136261;for(let n=0;n<r.length;n++)o^=r.charCodeAt(n),o=Math.imul(o,16777619);return(o>>>0)%2===0?"A":"B"}var je=1e4,br=[[/@import/i,"@import rules"],[/@charset/i,"@charset declarations"],[/expression\s*\(/i,"CSS expressions"],[/-moz-binding/i,"-moz-binding"],[/-webkit-binding/i,"-webkit-binding"],[/behavior\s*:/i,"behavior property"]],hr=/^(https:|\/[^/]|\.\/|\.\.\/|#)/;function Pe(e){if(e.length>je)return{ok:!1,error:`CSS exceeds ${je.toLocaleString("en-US")} character limit`};let t=e.replace(/\/\*[\s\S]*?\*\//g,"");try{t=t.replace(/\\([0-9a-fA-F]{1,6})[ \t\n\f]?/g,(n,a)=>{let i=parseInt(a,16);return i<0||i>1114111?"\uFFFD":String.fromCodePoint(i)}),t=t.replace(/\\\r?\n/g,""),t=t.replace(/\\([^\n\r\f0-9a-fA-F])/g,"$1")}catch{return{ok:!1,error:"CSS contains invalid unicode escape sequences"}}t=t.replace(/</g,"").replace(/>/g,"");for(let[n,a]of br)if(n.test(t))return{ok:!1,error:`CSS contains blocked pattern: ${a}`};let r=/url\s*\(\s*([\s\S]*?)\s*\)/gi,o;for(;(o=r.exec(t))!==null;){let n=o[1].trim();if((n.startsWith("'")||n.startsWith('"'))&&(n=n.slice(1)),(n.endsWith("'")||n.endsWith('"'))&&(n=n.slice(0,-1)),n=n.trim(),n&&!hr.test(n))return{ok:!1,error:"CSS url() values must use https:// or relative paths"}}return{ok:!0,css:t}}var mr="lb-custom-css-";function ct(e,t){if(typeof document>"u"||!t)return!1;let r=Pe(t);if(!r.ok||!r.css.trim())return!1;let o=mr+gr(e),n=document.getElementById(o);return n||(n=document.createElement("style"),n.id=o,n.setAttribute("data-lime-bundles","custom-css"),document.head.appendChild(n)),n.textContent!==r.css&&(n.textContent=r.css),!0}function gr(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return(t>>>0).toString(16)}function fr(e,t){let r=typeof e=="string"?parseFloat(e):e;try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t}).format(r)}catch{return`${t} ${r.toFixed(2)}`}}var vr={CL:"cl",CM:"cm",FLOZ:"fl oz",FT:"ft",FT2:"ft\xB2",G:"g",GAL:"gal",IN:"in",ITEM:"each",KG:"kg",L:"l",LB:"lb",M:"m",M2:"m\xB2",M3:"m\xB3",MG:"mg",ML:"ml",MM:"mm",OZ:"oz",PT:"pt",QT:"qt",UNKNOWN:"",YD:"yd"};function ee(e,t,r){if(!e||!t||t.referenceUnit==="UNKNOWN")return null;let o=parseFloat(e.amount);if(!Number.isFinite(o))return null;let n=vr[t.referenceUnit]??"";if(!n)return null;let a=e.currencyCode||r||"USD",i=fr(o,a),l=t.referenceValue,d=l===1?n:`${l}${n}`;return`${i}/${d}`}function W(e){if(e==null)return 0;let t=typeof e=="string"?parseFloat(e):e;return Number.isFinite(t)?Math.round(t*100):0}function R(e,t){try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t}).format(e/100)}catch{return`${t} ${(e/100).toFixed(2)}`}}function ut(e,t){return Math.max(0,e-Math.floor(e*t/100))}function Le(e,t=e.productQuantities,r=e.widgetConfig.pricing.showSaveBadge){let{discountType:o,discountValue:n}=e.discountConfig,a=[],i=0,l=0;for(let c of e.products){let _=c.variants.nodes.find(C=>C.availableForSale)??c.variants.nodes[0];if(!_)continue;let g=W(_.price.amount),f=t[c.id]??1,k=g*f,A=_.compareAtPrice?W(_.compareAtPrice.amount):null;if(a.push({unitCents:g,qty:f,lineCents:k,compareCents:A}),i+=k,o==="percentage"){let C=ut(g,n);l+=C*f}else l+=k}o==="fixed_amount"&&(l=Math.max(0,i-Math.round(n*100)));let d=Math.max(0,i-l),u=e.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",p="";return r&&d>0&&(o==="percentage"&&n>0?p=`-${Math.round(n)}%`:o==="fixed_amount"&&n>0&&(p=`-${R(Math.round(n*100),u)}`)),{rows:a,totalCents:i,saleCents:l,savingsCents:d,headerBadge:p,currency:u}}function be(e,t){if(t.discountType==="percentage"){let r=Math.floor(e*t.discountValue/100);return Math.max(0,e-r)}return Math.max(0,e-Math.round(t.discountValue*100))}var U=152;function te(e,t={}){if(!e)return"";try{let r=new URL(e);return t.width!==void 0&&r.searchParams.set("width",String(t.width)),t.height!==void 0&&r.searchParams.set("height",String(t.height)),t.crop&&r.searchParams.set("crop",t.crop),r.toString()}catch{return e}}function pt(e){if(!Number.isFinite(e)||e<=0)return"";let t=Math.floor(e/1e3),r=Math.floor(t/86400),o=Math.floor(t%86400/3600),n=Math.floor(t%3600/60),a=t%60,i=l=>String(l).padStart(2,"0");return r>0?`${r}d ${i(o)}h ${i(n)}m ${i(a)}s`:`${i(o)}h ${i(n)}m ${i(a)}s`}var Ie={};Ye(Ie,{computePosition:()=>wr,emptyTypeAheadState:()=>Br,handleKey:()=>kr,pushTypeAheadChar:()=>Sr});var xr=4;function wr({trigger:e,viewportHeight:t,desiredHeight:r,margin:o=xr}){let n=Math.max(0,t-e.bottom-o),a=Math.max(0,e.top-o),i=r<=n?"down":a>n?"up":"down",d=Math.min(r,i==="down"?n:a),u=i==="down"?e.bottom+o:e.top-o-d;return{placement:i,maxHeight:d,offsetTop:u,offsetLeft:e.left,width:e.width}}var Se={type:"passthrough",preventDefault:!1};function Te(e){for(let t=0;t<e.length;t++)if(!e[t].disabled)return t;return-1}function Ke(e){for(let t=e.length-1;t>=0;t--)if(!e[t].disabled)return t;return-1}function yr(e,t){if(e.length===0)return-1;for(let r=1;r<=e.length;r++){let o=(t+r)%e.length;if(!e[o].disabled)return o}return t}function Cr(e,t){if(e.length===0)return-1;for(let r=1;r<=e.length;r++){let o=(t-r+e.length)%e.length;if(!e[o].disabled)return o}return t}function Ge(e){return e.length===1&&e!==" "&&/\S/.test(e)}function kr(e,t){if(e.ctrlKey||e.metaKey||e.altKey)return Se;let{key:r}=e,{isOpen:o,activeIndex:n,selectedIndex:a,options:i}=t;if(!o)switch(r){case"Enter":case" ":case"ArrowDown":return{type:"open",activeIndex:a>=0&&!i[a]?.disabled?a:Te(i),preventDefault:!0};case"ArrowUp":return{type:"open",activeIndex:a>=0&&!i[a]?.disabled?a:Ke(i),preventDefault:!0};default:return Ge(r)?{type:"open",activeIndex:a>=0&&!i[a]?.disabled?a:Te(i),preventDefault:!0}:Se}switch(r){case"ArrowDown":return{type:"move-active",activeIndex:yr(i,n),preventDefault:!0};case"ArrowUp":return{type:"move-active",activeIndex:Cr(i,n),preventDefault:!0};case"Home":return{type:"move-active",activeIndex:Te(i),preventDefault:!0};case"End":return{type:"move-active",activeIndex:Ke(i),preventDefault:!0};case"Enter":case" ":return n>=0&&!i[n]?.disabled?{type:"commit",index:n,preventDefault:!0}:{type:"passthrough",preventDefault:!0};case"Escape":return{type:"close",commit:!1,restoreFocus:!0,preventDefault:!0};case"Tab":return{type:"close",commit:!1,restoreFocus:!1,preventDefault:!1};default:return Ge(r)?{type:"type-ahead",char:r,preventDefault:!1}:Se}}var _r=500;function Br(){return{buffer:"",lastTime:0}}function Sr(e,t,r,o,n=_r){if(t.length!==1)return{newState:e,matchedIndex:null};let i=(r-e.lastTime>n?"":e.buffer)+t.toLowerCase(),l={buffer:i,lastTime:r};for(let d=0;d<o.length;d++){let u=o[d];if(!u.disabled&&u.label.toLowerCase().startsWith(i))return{newState:l,matchedIndex:d}}return{newState:l,matchedIndex:null}}var Tr={};Ye(Tr,{findVariantByOptions:()=>Ar,isOptionValueAvailable:()=>Er,toPickerVariant:()=>Pr});function Ar(e,t){if(e.length===0)return null;for(let r of e){if(r.optionValues.length!==t.length)continue;let o=!0;for(let n=0;n<r.optionValues.length;n++)if(r.optionValues[n]!==t[n]){o=!1;break}if(o)return r}return null}function Er(e,t,r,o){for(let n of e){if(!n.available||n.optionValues[t]!==r)continue;let a=!0;for(let i=0;i<n.optionValues.length;i++)if(i!==t&&n.optionValues[i]!==o[i]){a=!1;break}if(a)return!0}return!1}function Pr(e){return{id:e.id,optionValues:e.selectedOptions.map(t=>t.value),available:e.availableForSale}}function J(e,t){return e.availableForSale?e.currentlyNotInStock||e.quantityAvailable==null?!0:e.quantityAvailable>=t:!1}function ie(e,t,r,o){return!o||e.quantityAvailable==null||e.quantityAvailable<t?!1:e.quantityAvailable<=r}var{computePosition:Lr,emptyTypeAheadState:Ir,handleKey:Mr,pushTypeAheadChar:Rr}=Ie,Dr=32,Fr=8,Vr=8,G=[];function me(e){let t=e.composedPath();for(let r=G.length-1;r>=0;r--){let o=G[r];!t.includes(o.shell)&&!t.includes(o.listbox)&&o.close()}}function bt(){for(let e=G.length-1;e>=0;e--)G[e].close()}var ge=!1;function Or(){ge||(document.addEventListener("pointerdown",me,!0),window.addEventListener("scroll",me,!0),window.addEventListener("resize",bt),ge=!0)}function Hr(){!ge||G.length>0||(document.removeEventListener("pointerdown",me,!0),window.removeEventListener("scroll",me,!0),window.removeEventListener("resize",bt),ge=!1)}function he(e){let t=[];for(let r=0;r<e.options.length;r++){let o=e.options[r];t.push({disabled:o.disabled,label:o.textContent||o.value})}return t}function Ur(e){for(let t=0;t<e.length;t++)if(!e[t].disabled)return t;return-1}var Nr=["lb-bundle-variant-select","lb-mix-match__variant-select"],qr=Nr.map(e=>`select.${e}:not(.lb-dropdown-state)`).join(", ");function $r(e){let t=e;if(e.classList.contains("lb-dropdown-state"))return t.__lbDropdownInstance??null;let r=e.ownerDocument,o=e.getRootNode(),n=e.getAttribute("aria-label")??"",a=`lb-dd-${Math.random().toString(36).slice(2,9)}`;e.classList.add("lb-dropdown-state"),e.setAttribute("aria-hidden","true"),e.setAttribute("tabindex","-1");let i=r.createElement("div");i.className="lb-dropdown",i.setAttribute("data-lb-dropdown","");let l=r.createElement("button");l.type="button",l.className="lb-dropdown-trigger",l.setAttribute("role","combobox"),l.setAttribute("aria-haspopup","listbox"),l.setAttribute("aria-expanded","false");let d=`${a}-listbox`;l.setAttribute("aria-controls",d),n&&l.setAttribute("aria-label",n);let u=r.createElement("span");u.className="lb-dropdown-trigger-value";let p=r.createElement("span");p.className="lb-dropdown-chevron",p.setAttribute("aria-hidden","true"),l.appendChild(u),l.appendChild(p);let c=r.createElement("ul");c.id=d,c.className="lb-dropdown-listbox",c.setAttribute("role","listbox"),n&&c.setAttribute("aria-label",n),c.hidden=!0,i.appendChild(l),e.parentNode?.insertBefore(i,e.nextSibling);let _=e.closest("[data-modal-overlay]");_?(_.appendChild(c),c.setAttribute("data-lb-dropdown-portal","")):i.appendChild(c);let g=!1,f=-1,k=Ir(),A=[],C;function T(){let h=he(e),x=e.selectedIndex;for(u.textContent=x>=0&&h[x]?h[x].label:"";c.firstChild;)c.removeChild(c.firstChild);A=[];for(let y=0;y<h.length;y++){let F=r.createElement("li");F.id=`${a}-opt-${y}`,F.className="lb-dropdown-option",F.setAttribute("role","option"),F.setAttribute("aria-selected",y===x?"true":"false"),h[y].disabled&&F.setAttribute("aria-disabled","true"),F.setAttribute("data-value",e.options[y].value),F.setAttribute("data-index",String(y)),F.textContent=h[y].label,c.appendChild(F),A.push(F)}}function B(h){if(f>=0&&A[f]&&A[f].classList.remove("is-active"),f=h,h>=0&&A[h]){let x=A[h];x.classList.add("is-active"),l.setAttribute("aria-activedescendant",x.id);let y=x.offsetTop,F=y+x.offsetHeight,ne=c.scrollTop,Z=ne+c.clientHeight;y<ne?c.scrollTop=y:F>Z&&(c.scrollTop=F-c.clientHeight)}else l.setAttribute("aria-activedescendant","")}function I(){let h=l.getBoundingClientRect();if(h.width===0)return!1;let y=Math.min(A.length||1,Vr)*Dr+Fr,F=Lr({trigger:{top:h.top,bottom:h.bottom,left:h.left,width:h.width},viewportHeight:window.innerHeight,desiredHeight:y});return c.setAttribute("data-placement",F.placement),c.style.maxHeight=`${F.maxHeight}px`,c.hasAttribute("data-lb-dropdown-portal")&&(c.style.top=`${F.offsetTop}px`,c.style.left=`${F.offsetLeft}px`,c.style.width=`${F.width}px`),!0}function m(){if(g)return;for(let y=G.length-1;y>=0;y--)G[y]!==C&&G[y].close();g=!0,c.hidden=!1,l.setAttribute("aria-expanded","true"),I()||requestAnimationFrame(()=>I());let h=he(e),x=e.selectedIndex;x>=0&&h[x]&&!h[x].disabled?B(x):B(Ur(h)),G.push(C),G.length===1&&Or()}function S(h){if(!g)return;g=!1,c.hidden=!0,l.setAttribute("aria-expanded","false"),l.setAttribute("aria-activedescendant",""),f>=0&&A[f]&&A[f].classList.remove("is-active"),f=-1;let x=G.indexOf(C);x>=0&&G.splice(x,1),G.length===0&&Hr(),h&&l.focus()}function E(h){let x=e.options[h];if(!(!x||x.disabled)){if(e.value!==x.value){e.value=x.value;let y=new Event("change",{bubbles:!0});e.dispatchEvent(y)}T(),S(!0)}}function M(h){switch(h.type){case"open":m(),h.activeIndex>=0&&B(h.activeIndex);return;case"close":S(h.restoreFocus);return;case"move-active":B(h.activeIndex);return;case"commit":E(h.index);return;case"type-ahead":{let x=he(e),y=Rr(k,h.char,Date.now(),x);k=y.newState,y.matchedIndex!==null&&(g||m(),B(y.matchedIndex));return}case"passthrough":return;default:{let x=h}}}function V(h){let x=he(e),y=Mr({key:h.key,ctrlKey:h.ctrlKey,metaKey:h.metaKey,altKey:h.altKey,shiftKey:h.shiftKey},{isOpen:g,activeIndex:f,selectedIndex:e.selectedIndex,options:x});y.preventDefault&&h.preventDefault(),M(y)}function v(h){h.preventDefault(),g?S(!1):m()}function $(h){let x=h.target;for(;x&&x!==c;){if(x.classList?.contains("lb-dropdown-option")){let y=parseInt(x.getAttribute("data-index")??"",10);if(!Number.isNaN(y)){E(y);return}}x=x.parentElement}}function P(h){let x=h.target;for(;x&&x!==c;){if(x.classList?.contains("lb-dropdown-option")){if(x.getAttribute("aria-disabled")==="true")return;let y=parseInt(x.getAttribute("data-index")??"",10);!Number.isNaN(y)&&y!==f&&B(y);return}x=x.parentElement}}function b(){setTimeout(()=>{if(!g)return;let h=o.activeElement??r.activeElement;i.contains(h)||S(!1)},0)}function w(){T()}let L=new MutationObserver(()=>{T()});L.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["disabled","value","selected"]});let N=h=>h.preventDefault();l.addEventListener("click",v),l.addEventListener("keydown",V),i.addEventListener("focusout",b),c.addEventListener("mousedown",N),c.addEventListener("click",$),c.addEventListener("mousemove",P),e.addEventListener("change",w);function Y(){g&&S(!1),L.disconnect(),l.removeEventListener("click",v),l.removeEventListener("keydown",V),i.removeEventListener("focusout",b),c.removeEventListener("mousedown",N),c.removeEventListener("click",$),c.removeEventListener("mousemove",P),e.removeEventListener("change",w),i.parentNode&&i.parentNode.removeChild(i),c.parentNode&&c.parentNode.removeChild(c),e.classList.remove("lb-dropdown-state"),e.removeAttribute("aria-hidden"),e.removeAttribute("tabindex"),delete t.__lbDropdownInstance}return C={shell:i,listbox:c,select:e,close:()=>S(!1),destroy:Y},t.__lbDropdownInstance=C,T(),C}function fe(e){let t=e.querySelectorAll(qr),r=[];return t.forEach(o=>{let n=$r(o);n&&r.push(n)}),r}function ve(e){e.querySelectorAll("select.lb-dropdown-state").forEach(r=>{let o=r.__lbDropdownInstance;o&&o.destroy()})}function ae(e){let t=Wr(e);if(t===null||t<=Date.now())return null;let r=t,o=document.createElement("div");o.className="lb-bundle-countdown",o.setAttribute("data-countdown","");let n=document.createElement("div");n.className="lb-bundle-countdown__label";let a=document.createElement("span");a.textContent="Ends in",n.appendChild(a),o.appendChild(n);let i=document.createElement("span");i.className="lb-bundle-countdown__timer",i.setAttribute("data-countdown-timer",""),o.appendChild(i);let l=null;function d(){let p=r-Date.now();if(p<=0){o.style.display="none",u();return}i.textContent=pt(p)}function u(){l!==null&&(clearInterval(l),l=null)}return d(),l=setInterval(d,1e3),{el:o,stop:u}}function Wr(e){let t=Date.parse(e);return Number.isFinite(t)?t:null}function le(e){let t=document.createElement("button");t.type="button",t.className="lb-bundle-cta",t.setAttribute("data-add-bundle","");let r=document.createElement("span");r.className="lb-cta-label",r.setAttribute("data-cta-label",""),r.textContent=e,t.appendChild(r);let o=document.createElement("span");return o.className="lb-cta-spinner",o.setAttribute("data-cta-spinner",""),o.setAttribute("aria-hidden","true"),o.innerHTML='<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><path d="M12 2a10 10 0 0 1 10 10" /></svg>',t.appendChild(o),t}function Me(e,t){let r=e.querySelector("[data-cta-label]");r&&(r.textContent=t)}function s(e,t,r={}){let o=document.createElement(e);t&&(o.className=t);for(let[n,a]of Object.entries(r))o.setAttribute(n,a);return o}var zr=`
|
|
221
233
|
<svg class="lb-bundle-placeholder-icon" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
|
|
222
234
|
<rect x="4" y="4" width="20" height="20" rx="3"></rect>
|
|
223
235
|
<line x1="4" y1="20" x2="24" y2="20"></line>
|
|
224
236
|
<circle cx="10" cy="12" r="2"></circle>
|
|
225
|
-
</svg>`;function
|
|
237
|
+
</svg>`;function ht(e,t,r,o){let n=t.widgetConfig,a=(C,T)=>z(t,C,T),i=[],l=0;if(t.products.forEach((C,T)=>{let B=jr(t,C,T);B.qty!==0&&(B.isOos&&(l++,n.outOfStockBehavior==="hide")||i.push(B))}),i.length===0)return;let d=t.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",u=s("div","lb-fixed",{"data-discount-type":t.discountConfig.discountType,"data-discount-value":String(t.discountConfig.discountValue)}),p=Kr(t,d);if(u.appendChild(p.el),n.countdown.showCountdown&&t.endsAt){let C=ae(t.endsAt);C&&(u.appendChild(C.el),o?.(C.stop))}let c=s("div","lb-fixed__products"),_=[];i.forEach(C=>{let T=Yr(C,d,a,{enabled:n.showLowStockBadge,threshold:n.lowStockThreshold},()=>{A()});_.push(T),c.appendChild(T.el)}),u.appendChild(c),u.appendChild(s("div","lb-bundle-divider"));let g=Qr(t);u.appendChild(g.el);let f=n.savingsBar.visible?Xr():null;f&&u.appendChild(f.el);let k=Jr(t,l,()=>{let C=i.filter(T=>T.selected).map(T=>({merchandiseId:T.selected.id,quantity:T.qty,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}));C.length!==0&&r(C)});u.appendChild(k),u.appendChild(s("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),u.appendChild(s("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(u),fe(u),o?.(()=>ve(u)),A();function A(){let C=i.reduce((I,m)=>{if(!m.selected)return I;let S=W(m.selected.price.amount);return I+S*m.qty},0),T=Zr(C,t.discountConfig,i),B=Math.max(0,C-T);g.update({totalCents:C,saleCents:T,savingsCents:B,currency:d}),f&&f.update({savingsCents:B,currency:d}),p.refresh(Gr(t,C,T,d))}}function jr(e,t,r){let o=e.selectedVariantIds?.[r]??null,n=o&&o.length>0?t.variants.nodes.filter(p=>o.includes(p.id)):t.variants.nodes,a=n.find(p=>J(p,z(e,t.id,p.id)))??null,i=n,l=!a,d=a??n[0]??null,u=d?z(e,t.id,d.id):1;return{product:t,eligibleVariants:i,selected:d,qty:u,isOos:l}}function Kr(e,t){let r=e.widgetConfig,o=s("div","lb-bundle-header"),n=s("div","lb-bundle-header__content"),a=s("h3","lb-bundle-title");if(a.textContent=e.title,n.appendChild(a),e.description){let d=s("p","lb-bundle-subtitle");d.textContent=e.description,n.appendChild(d)}o.appendChild(n);let i=s("span","lb-bundle-header__badge",{"data-header-badge":""});o.appendChild(i);let l=Le(e,e.productQuantities,r.pricing.showSaveBadge);return l.headerBadge?i.textContent=l.headerBadge:i.style.display="none",{el:o,refresh(d){if(!r.pricing.showSaveBadge){i.style.display="none";return}d?(i.textContent=d,i.style.display=""):i.style.display="none"}}}function Gr(e,t,r,o){if(!e.widgetConfig.pricing.showSaveBadge)return"";let n=t-r;if(n<=0)return"";let a=e.discountConfig;return a.discountType==="percentage"&&a.discountValue>0?`-${Math.round(a.discountValue)}%`:a.discountType==="fixed_amount"&&a.discountValue>0?`-${R(Math.round(a.discountValue*100),o)}`:`-${R(n,o)}`}function Yr(e,t,r,o,n){let a=s("div",e.isOos?"lb-bundle-product-row lb-bundle-product-row--oos":"lb-bundle-product-row",{"data-product-id":e.product.id.replace(/^.*\//,""),...e.isOos?{"aria-disabled":"true"}:{}}),i=s("div","lb-bundle-thumbnail",{"data-thumbnail":""}),l=e.selected?.image??e.product.featuredImage??null,d=null;l?(d=document.createElement("img"),d.src=te(l.url,{width:U,height:U,crop:"center"}),d.alt=l.altText??e.product.title,d.width=U,d.height=U,d.loading="lazy",i.appendChild(d)):i.insertAdjacentHTML("beforeend",zr);let u=null;e.isOos||(u=s("span","lb-bundle-qty-badge",{"data-qty-badge":""}),u.textContent=String(e.qty),i.appendChild(u)),a.appendChild(i);let p=s("div","lb-bundle-product-info"),c=document.createElement("a");if(c.className="lb-bundle-product-name",c.href=`/products/${e.product.handle}`,c.textContent=e.product.title,p.appendChild(c),e.isOos){let _=s("span","lb-bundle-oos-label");_.textContent="Out of stock",p.appendChild(_)}else if(e.selected){if(e.eligibleVariants.length===1&&e.product.variants.nodes.length>1){let B=s("span","lb-bundle-variant-badge");B.textContent=e.eligibleVariants[0].title,p.appendChild(B)}let g=s("span","lb-bundle-product-prices"),f=s("span","lb-bundle-product-compare-price",{"data-product-compare-price":""}),k=s("span","lb-bundle-product-price",{"data-product-price":""});g.appendChild(f),g.appendChild(k),p.appendChild(g);let A=s("span","lb-bundle-product-unit-price",{"data-product-unit-price":""});A.setAttribute("hidden",""),p.appendChild(A);let C=s("span","lb-bundle-low-stock-badge",{"data-low-stock-badge":""});C.setAttribute("hidden",""),p.appendChild(C);let T=B=>{let I=W(B.price.amount);if(k.textContent=R(I,t),B.compareAtPrice){let M=W(B.compareAtPrice.amount);M>I?(f.textContent=R(M,t),f.removeAttribute("hidden")):f.setAttribute("hidden","")}else f.setAttribute("hidden","");let m=ee(B.unitPrice,B.unitPriceMeasurement,t);m?(A.textContent=m,A.removeAttribute("hidden")):A.setAttribute("hidden","");let S=B.image??e.product.featuredImage;d&&S&&(d.src=te(S.url,{width:U,height:U,crop:"center"}),d.alt=S.altText??e.product.title);let E=r(e.product.id,B.id);ie(B,E,o.threshold,o.enabled)?(C.textContent=`Only ${B.quantityAvailable} left`,C.removeAttribute("hidden")):C.setAttribute("hidden","")};if(T(e.selected),e.eligibleVariants.length>1){let B=e.eligibleVariants[0].selectedOptions.map(P=>P.name),I=e.product.id.replace(/^.*\//,""),m=[],S=P=>e.eligibleVariants.find(b=>b.selectedOptions.every((w,L)=>w.value===P[L])&&b.selectedOptions.length===P.length)??null,E=P=>{P.selectedOptions.forEach((b,w)=>{let L=m[w];L&&L.value!==b.value&&(L.value=b.value)})},M=(P,b,w)=>e.eligibleVariants.some(L=>!J(L,r(e.product.id,L.id))||L.selectedOptions[P]?.value!==b?!1:L.selectedOptions.every((N,Y)=>Y===P||N.value===w[Y])),V=P=>{m.forEach((b,w)=>{Array.from(b.options).forEach(L=>{L.disabled=!M(w,L.value,P)})})},v=()=>{let P=m.map(w=>w.value),b=S(P);if(!b){e.selected&&(E(e.selected),V(e.selected.selectedOptions.map(w=>w.value)));return}e.selected=b,e.qty=r(e.product.id,b.id),u&&(u.textContent=String(e.qty)),T(b),V(b.selectedOptions.map(w=>w.value)),n()},$=s("div","lb-bundle-variant-option-groups");B.forEach((P,b)=>{let w=s("div","lb-bundle-variant-option-group"),L=s("span","lb-bundle-variant-option-label");L.textContent=P,w.appendChild(L);let N=document.createElement("select");N.className="lb-bundle-variant-select",N.setAttribute("data-variant-option",""),N.setAttribute("data-option-position",String(b+1)),N.name=`lb-variant-${I}-${b+1}`,N.setAttribute("aria-label",P);let Y=new Set;e.eligibleVariants.forEach(h=>{let x=h.selectedOptions[b]?.value;if(!x||Y.has(x))return;Y.add(x);let y=document.createElement("option");y.value=x,y.textContent=x,e.selected?.selectedOptions[b]?.value===x&&(y.selected=!0),N.appendChild(y)}),N.addEventListener("change",v),m.push(N),w.appendChild(N),$.appendChild(w)}),p.appendChild($),e.selected&&V(e.selected.selectedOptions.map(P=>P.value))}}return a.appendChild(p),{el:a,state:e}}function Qr(e){let t=s("div","lb-bundle-pricing"),r=s("span","lb-bundle-pricing__label");r.textContent="Bundle price",t.appendChild(r);let o=s("span","lb-bundle-pricing__prices"),n=s("span","lb-bundle-compare-price",{"data-compare-price":""});n.style.display="none",o.appendChild(n);let a=s("span","lb-bundle-sale-price",{"data-sale-price":""});return o.appendChild(a),t.appendChild(o),{el:t,update({totalCents:i,saleCents:l,savingsCents:d,currency:u}){a.textContent=R(l,u),e.widgetConfig.pricing.showCompareAtPrice&&d>0?(n.textContent=R(i,u),n.style.display=""):n.style.display="none"}}}function Xr(){let e=s("div","lb-bundle-savings-bar",{"data-savings-bar":""}),t=document.createElement("span");t.textContent="You save",e.appendChild(t);let r=s("span","",{"data-savings-amount":""});return e.appendChild(r),{el:e,update({savingsCents:o,currency:n}){if(o<=0){e.style.display="none";return}e.style.display="",r.textContent=R(o,n)}}}function Jr(e,t,r){let o=t>0?`${t} item${t===1?"":"s"} out of stock`:e.widgetConfig.cta.ctaText||"Add to cart",n=le(o);return t>0?n.disabled=!0:n.addEventListener("click",()=>{n.disabled||r()}),n}function Zr(e,t,r){if(t.discountType==="percentage"){let o=0;for(let n of r){if(!n.selected)continue;let a=W(n.selected.price.amount),i=Math.floor(a*t.discountValue/100),l=Math.max(0,a-i);o+=l*n.qty}return o}return Math.max(0,e-Math.round(t.discountValue*100))}var gt=`
|
|
226
238
|
<svg class="lb-bundle-placeholder-icon" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
|
|
227
239
|
<rect x="4" y="4" width="20" height="20" rx="3"></rect>
|
|
228
240
|
<line x1="4" y1="20" x2="24" y2="20"></line>
|
|
229
241
|
<circle cx="10" cy="12" r="2"></circle>
|
|
230
|
-
</svg>`,
|
|
242
|
+
</svg>`,en=`
|
|
231
243
|
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
232
244
|
<line x1="9" y1="3" x2="9" y2="15" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
233
245
|
<line x1="3" y1="9" x2="15" y2="9" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
234
|
-
</svg>`,
|
|
246
|
+
</svg>`,ft=`
|
|
235
247
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
236
248
|
<line x1="5" y1="5" x2="15" y2="15" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
237
249
|
<line x1="15" y1="5" x2="5" y2="15" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
238
|
-
</svg>`,
|
|
250
|
+
</svg>`,tn=`
|
|
239
251
|
<svg width="16" height="16" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
240
252
|
<path d="M14.348 5.652a.5.5 0 0 0-.707 0L10 9.293 6.36 5.652a.5.5 0 1 0-.708.707L9.293 10l-3.641 3.641a.5.5 0 0 0 .708.707L10 10.707l3.641 3.641a.5.5 0 0 0 .707-.707L10.707 10l3.641-3.641a.5.5 0 0 0 0-.707z"/>
|
|
241
|
-
</svg>`;function bt(e,t,r,i){let n=t.widgetConfig,a=t.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",o=t.minQuantity??1,l=t.maxQuantity??o,d=an(t,n.outOfStockBehavior);if(d.filter(m=>!m.isOos).length<o)return;let u=[],c=s("div","lb-mix-match",{"data-required-quantity":String(o),"data-max-quantity":String(l)}),x=Jr(t);if(c.appendChild(x),n.countdown.showCountdown&&t.endsAt){let m=ie(t.endsAt);m&&(c.appendChild(m.el),i?.(m.stop))}let v=Zr(o);c.appendChild(v.el);let h=s("div","lb-mix-match__slots",{"data-selection-slots":""});c.appendChild(h),c.appendChild(s("div","lb-bundle-divider"));let E=rn(n.pricing.showCompareAtPrice);c.appendChild(E.el);let B=n.savingsBar.visible?nn():null;B&&c.appendChild(B.el);let y=s("div","lb-mix-match__price-placeholder",{"data-price-placeholder":""}),S=s("span","lb-mix-match__price-placeholder-text");S.textContent=`Select ${o} items to see price`,y.appendChild(S),c.appendChild(y);let A=on(t,d,a,{showSearch:n.showSearch,onAdd:(m,k)=>M(m,k),onRemove:(m,k)=>U(m,k),isOverMax:()=>u.length>=l});c.appendChild(A.el);let f=oe(`Select ${o} items to unlock`);f.disabled=!0,f.addEventListener("click",()=>{if(f.disabled)return;let m=u.map(k=>({merchandiseId:k.variantId,quantity:k.quantity,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}));r(m)}),c.appendChild(f),c.appendChild(s("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),c.appendChild(s("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(c),i?.(()=>me(c));let P=d.find(m=>!m.isOos),C=P?.firstAvailableVariant??P?.variants[0];P&&C&&u.push({productId:P.product.id,productTitle:P.product.title,variantId:C.id,variantTitle:C.title,imageUrl:C.image?.url??P.product.featuredImage?.url??null,priceCents:q(C.price.amount),compareCents:C.compareAtPrice?q(C.compareAtPrice.amount):null,unitPriceLabel:Z(C.unitPrice,C.unitPriceMeasurement,a),quantity:X(t,P.product.id,C.id)}),b();function M(m,k){u.length>=l||(u.push({productId:m.id,productTitle:m.title,variantId:k.id,variantTitle:k.title,imageUrl:k.image?.url??m.featuredImage?.url??null,priceCents:q(k.price.amount),compareCents:k.compareAtPrice?q(k.compareAtPrice.amount):null,unitPriceLabel:Z(k.unitPrice,k.unitPriceMeasurement,a),quantity:X(t,m.id,k.id)}),b())}function U(m,k){let $=u.findIndex(z=>z.productId===m&&z.variantId===k);$!==-1&&(u.splice($,1),b())}function I(m){m<0||m>=u.length||(u.splice(m,1),b())}function b(){T(),v.update(u.length),E.update(u,t,a),B&&B.update(u,t,a),y.style.display=u.length===0?"":"none",A.refreshCounts(),L()}function T(){h.innerHTML="";let m=Math.max(o,u.length);for(let k=0;k<m;k++){let $=u[k];$?h.appendChild(tn($,k,a,()=>I(k))):h.appendChild(en(k,()=>A.open()))}}function L(){let m=u.length;m<o?(f.disabled=!0,Ae(f,`Select ${o-m} more to unlock`)):(f.disabled=!1,Ae(f,n.cta.ctaText||"Add to cart"))}}function Jr(e){let t=e.widgetConfig,r=s("div","lb-bundle-header"),i=s("div","lb-bundle-header__content"),n=s("h3","lb-bundle-title");if(n.textContent=e.title,i.appendChild(n),r.appendChild(i),t.pricing.showSaveBadge){let{discountType:a,discountValue:o}=e.discountConfig,l=null;if(a==="percentage"&&o>0?l=`-${Math.round(o)}%`:a==="fixed_amount"&&o>0&&(l=`-${R(Math.round(o*100),e.products[0]?.priceRange.minVariantPrice.currencyCode??"USD")}`),l){let d=s("span","lb-bundle-header__badge");d.textContent=l,r.appendChild(d)}}return r}function Zr(e){let t=s("div","lb-mix-match__progress"),r=s("div","lb-mix-match__progress-labels"),i=s("span","lb-mix-match__progress-count",{"data-progress-count":""});i.textContent=`0 of ${e} selected`,r.appendChild(i);let n=s("span","lb-mix-match__progress-remaining",{"data-progress-remaining":""});n.textContent=`${e} more to go`,r.appendChild(n),t.appendChild(r);let a=s("div","lb-mix-match__progress-track",{role:"progressbar","aria-valuenow":"0","aria-valuemin":"0","aria-valuemax":String(e)}),o=s("div","lb-mix-match__progress-fill",{"data-progress-fill":""});o.style.width="0%",a.appendChild(o),t.appendChild(a);function l(d){let p=Math.min(100,d/e*100);i.textContent=`${d} of ${e} selected`,d>=e?n.textContent="Complete":n.textContent=`${e-d} more to go`,o.style.width=`${p}%`,a.setAttribute("aria-valuenow",String(Math.min(d,e)))}return{el:t,update:l}}function en(e,t){let r=s("div","lb-bundle-product-row lb-mix-match__slot lb-mix-match__slot--empty",{"data-slot":String(e+1),tabindex:"0",role:"button","aria-label":"Add a product to the bundle"}),i=s("div","lb-mix-match__empty-thumb");i.innerHTML=Qr,r.appendChild(i);let n=s("span","lb-mix-match__empty-text");return n.textContent="Choose an item",r.appendChild(n),r.addEventListener("click",t),r.addEventListener("keydown",a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),t())}),r}function tn(e,t,r,i){let n=s("div","lb-bundle-product-row lb-mix-match__slot lb-mix-match__slot--filled",{"data-slot":String(t+1)}),a=s("div","lb-bundle-thumbnail",{"data-thumbnail":""});if(e.imageUrl){let h=document.createElement("img");h.src=ee(e.imageUrl,{width:V,height:V,crop:"center"}),h.alt=e.productTitle,h.width=V,h.height=V,h.loading="lazy",a.appendChild(h)}else a.insertAdjacentHTML("beforeend",ut);let o=s("span","lb-bundle-qty-badge");o.textContent=String(e.quantity),a.appendChild(o),n.appendChild(a);let l=s("div","lb-mix-match__filled-info"),d=s("span","lb-mix-match__filled-title");if(d.textContent=e.productTitle,l.appendChild(d),e.variantTitle&&e.variantTitle!=="Default Title"){let h=s("span","lb-mix-match__filled-variant");h.textContent=e.variantTitle,l.appendChild(h)}let p=e.priceCents*e.quantity,u=e.compareCents!==null?e.compareCents*e.quantity:null,c=s("span","lb-mix-match__filled-price");if(u!==null&&u>p){let h=s("span","lb-mix-match__filled-compare");h.textContent=R(u,r),c.appendChild(h)}let x=document.createElement("span");if(x.textContent=R(p,r),c.appendChild(x),l.appendChild(c),e.unitPriceLabel){let h=s("span","lb-bundle-product-unit-price");h.textContent=e.unitPriceLabel,l.appendChild(h)}n.appendChild(l);let v=document.createElement("button");return v.type="button",v.className="lb-mix-match__slot-remove",v.setAttribute("aria-label",`Remove ${e.productTitle}`),v.innerHTML=pt,v.addEventListener("click",h=>{h.stopPropagation(),i()}),n.appendChild(v),n}function rn(e){let t=s("div","lb-bundle-pricing",{"data-pricing-section":""});t.style.display="none";let r=s("span","lb-bundle-pricing__label");r.textContent="Bundle price",t.appendChild(r);let i=s("span","lb-bundle-pricing__prices"),n=s("span","lb-bundle-compare-price",{"data-compare-price":""});e&&i.appendChild(n);let a=s("span","lb-bundle-sale-price",{"data-sale-price":""});i.appendChild(a),t.appendChild(i);function o(l,d,p){if(l.length===0){t.style.display="none";return}t.style.display="";let u=l.reduce((x,v)=>x+v.priceCents*v.quantity,0),c=ce(u,d.discountConfig);e&&u>c?(n.textContent=R(u,p),n.style.display=""):n.style.display="none",a.textContent=R(c,p)}return{el:t,update:o}}function nn(){let e=s("div","lb-bundle-savings-bar",{"data-savings-bar":""});e.style.display="none";let t=document.createElement("span");t.textContent="You save",e.appendChild(t);let r=s("span","",{"data-savings-amount":""});e.appendChild(r);function i(n,a,o){if(n.length===0){e.style.display="none";return}let l=n.reduce((u,c)=>u+c.priceCents*c.quantity,0),d=ce(l,a.discountConfig),p=Math.max(0,l-d);if(p<=0){e.style.display="none";return}e.style.display="",r.textContent=R(p,o)}return{el:e,update:i}}function on(e,t,r,i){let n=s("div","lb-mix-match__modal-overlay",{"data-modal-overlay":"","data-bundle-gid":e.id});n.style.display="none";let a=s("div","lb-mix-match__modal",{role:"dialog","aria-modal":"true","aria-labelledby":`lb-modal-title-${ct(e.id)}`,tabindex:"-1"}),o=s("div","lb-mix-match__modal-header"),l=s("h4","lb-mix-match__modal-title",{id:`lb-modal-title-${ct(e.id)}`});l.textContent="Pick an item",o.appendChild(l);let d=document.createElement("button");d.type="button",d.className="lb-mix-match__modal-close",d.setAttribute("data-modal-close",""),d.setAttribute("aria-label","Close"),d.innerHTML=pt,d.addEventListener("click",M),o.appendChild(d),a.appendChild(o);let p=null,u=null;if(i.showSearch){let b=s("div","lb-mix-match__modal-search");p=document.createElement("input"),p.type="text",p.className="lb-mix-match__modal-search-input",p.setAttribute("data-modal-search",""),p.setAttribute("role","searchbox"),p.setAttribute("aria-label","Search products"),p.setAttribute("placeholder","Search products"),p.autocomplete="off",p.addEventListener("input",()=>S()),b.appendChild(p),u=document.createElement("button"),u.type="button",u.className="lb-mix-match__modal-search-clear",u.setAttribute("data-modal-search-clear",""),u.setAttribute("aria-label","Clear search"),u.style.display="none",u.innerHTML=Xr,u.addEventListener("click",()=>{p&&(p.value="",S(),p.focus())}),b.appendChild(u),a.appendChild(b)}let c=s("div","lb-mix-match__modal-list",{"data-modal-list":""});a.appendChild(c);let x=s("div","lb-mix-match__modal-empty",{"data-modal-empty":""});x.style.display="none";let v=document.createElement("p");v.textContent="No products match your search.",x.appendChild(v),a.appendChild(x);let h=s("span","lb-visually-hidden",{"data-modal-live":"","aria-live":"polite"});a.appendChild(h),n.appendChild(a);let E=!1,B=[];function y(){E||(E=!0,c.innerHTML="",t.forEach(b=>{let T=b.variants,L=b.variants.find(N=>N.availableForSale)??b.firstAvailableVariant??b.variants[0];if(!L)return;let m=L,k=s("div",b.isOos?"lb-mix-match__modal-product lb-mix-match__modal-product--sold-out":"lb-mix-match__modal-product",{"data-product-id":b.product.id.replace(/^.*\//,"")}),$=s("div","lb-mix-match__modal-product-thumb"),Q=(b.variants.find(N=>N.availableForSale)??b.variants[0]??null)?.image??b.product.featuredImage??null,g=null;Q?(g=document.createElement("img"),g.src=ee(Q.url,{width:V,height:V,crop:"center"}),g.alt=Q.altText??b.product.title,g.width=V,g.height=V,g.loading="lazy",$.appendChild(g)):$.insertAdjacentHTML("beforeend",ut);let w=s("span","lb-bundle-qty-badge");w.textContent=String(X(e,b.product.id,m.id)),$.appendChild(w),k.appendChild($);let _=s("div","lb-mix-match__modal-product-info"),D=s("p","lb-mix-match__modal-product-title");D.textContent=b.product.title,_.appendChild(D);let re=s("p","lb-mix-match__modal-product-price");re.textContent=R(q(m.price.amount)*X(e,b.product.id,m.id),r),_.appendChild(re);let J=s("p","lb-mix-match__modal-product-unit-price lb-bundle-product-unit-price"),Le=Z(m.unitPrice,m.unitPriceMeasurement,r);Le?J.textContent=Le:J.hidden=!0,_.appendChild(J);let xe={el:k,product:b.product,variant:L,updateCount:()=>{}};if(T.length>1){let N=T[0].selectedOptions.map(O=>O.name),Et=b.product.id.replace(/^.*\//,""),de=[],Tt=O=>T.find(F=>F.selectedOptions.length===O.length&&F.selectedOptions.every((j,H)=>j.value===O[H]))??null,At=O=>{O.selectedOptions.forEach((F,j)=>{let H=de[j];H&&H.value!==F.value&&(H.value=F.value)})},Pt=(O,F,j)=>T.some(H=>!H.availableForSale||H.selectedOptions[O]?.value!==F?!1:H.selectedOptions.every((W,G)=>G===O||W.value===j[G])),we=O=>{de.forEach((F,j)=>{Array.from(F.options).forEach(H=>{H.disabled=!Pt(j,H.value,O)})})},Lt=()=>{let O=de.map(G=>G.value),F=Tt(O);if(!F){At(m),we(m.selectedOptions.map(G=>G.value));return}m=F,xe.variant=F;let j=X(e,b.product.id,m.id);re.textContent=R(q(m.price.amount)*j,r);let H=Z(m.unitPrice,m.unitPriceMeasurement,r);H?(J.textContent=H,J.hidden=!1):(J.textContent="",J.hidden=!0);let W=m.image??b.product.featuredImage;g&&W&&(g.src=ee(W.url,{width:V,height:V,crop:"center"}),g.alt=W.altText??b.product.title),we(F.selectedOptions.map(G=>G.value)),Me()},Ie=s("div","lb-bundle-variant-option-groups");N.forEach((O,F)=>{let j=s("div","lb-bundle-variant-option-group"),H=s("span","lb-bundle-variant-option-label");H.textContent=O,j.appendChild(H);let W=document.createElement("select");W.className="lb-mix-match__variant-select",W.setAttribute("data-variant-option",""),W.setAttribute("data-option-position",String(F+1)),W.name=`lb-variant-${Et}-${F+1}`,W.setAttribute("aria-label",O);let G=new Set;T.forEach(Mt=>{let ne=Mt.selectedOptions[F]?.value;if(!ne||G.has(ne))return;G.add(ne);let se=document.createElement("option");se.value=ne,se.textContent=ne,L.selectedOptions[F]?.value===ne&&(se.selected=!0),W.appendChild(se)}),W.addEventListener("change",Lt),de.push(W),j.appendChild(W),Ie.appendChild(j)}),_.appendChild(Ie),we(L.selectedOptions.map(O=>O.value))}else if(T.length===1&&L.title!=="Default Title"){let N=s("span","lb-mix-match__filled-variant");N.textContent=L.title,_.appendChild(N)}if(b.isOos){let N=s("span","lb-mix-match__modal-sold-out-label");N.textContent="Sold out",_.appendChild(N)}k.appendChild(_);let Me=()=>{w.textContent=String(X(e,b.product.id,m.id))};if(!b.isOos){let N=document.createElement("button");N.type="button",N.className="lb-mix-match__modal-add",N.textContent="Add",N.addEventListener("click",()=>{i.isOverMax()||(i.onAdd(b.product,m),M())}),k.appendChild(N)}xe.updateCount=b.isOos?()=>{}:Me,B.push(xe),c.appendChild(k)}),he(c),I())}function S(){if(!p)return;let b=p.value.trim().toLowerCase();u&&(u.style.display=b?"":"none");let T=0;B.forEach(L=>{let m=!b||L.product.title.toLowerCase().includes(b);L.el.style.display=m?"":"none",m&&T++}),x.style.display=T===0&&b?"":"none"}let A=null;function f(b){if(b.key==="Escape"){b.preventDefault(),M();return}b.key==="Tab"&&ln(b,a)}let P=!1;function C(){P||i.isOverMax()||(P=!0,y(),A=n.getRootNode().activeElement,n.style.display="",n.classList.add("lb-mix-match__modal-overlay--open"),a.focus(),document.addEventListener("keydown",f),n.addEventListener("click",U))}function M(){P&&(P=!1,n.classList.remove("lb-mix-match__modal-overlay--open"),n.style.display="none",document.removeEventListener("keydown",f),n.removeEventListener("click",U),A instanceof HTMLElement&&A.focus())}function U(b){b.target===n&&M()}function I(){B.forEach(b=>b.updateCount())}return{el:n,open:C,close:M,refreshCounts:I}}function an(e,t){let r=[],i=new Set;for(let n of e.products){if(i.has(n.id))continue;i.add(n.id);let a=n.variants.nodes.filter(l=>l.availableForSale),o=a.length===0;o&&t==="hide"||r.push({product:n,variants:n.variants.nodes,firstAvailableVariant:a[0]??null,isOos:o})}return r}function ln(e,t){let r=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(r.length===0)return;let i=r[0],n=r[r.length-1],a=t.getRootNode().activeElement;e.shiftKey&&a===i?(e.preventDefault(),n.focus()):!e.shiftKey&&a===n&&(e.preventDefault(),i.focus())}function ct(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function ft(e,t,r,i){let n=t.widgetConfig,o=t.products[0]?.variants.nodes.find(f=>f.availableForSale);if(!o&&n.outOfStockBehavior==="hide")return;let l=o?q(o.price.amount):0,d=o?.price.currencyCode??"USD",p=t.discountConfig.discountType,u=t.volumeTiers.map((f,P)=>{let C;if(p==="fixed_amount"){let M=Math.round((f.amount??0)*100);C=Math.max(0,l-M)}else{let M=f.percentage??0,U=Math.floor(l*M/100);C=Math.max(0,l-U)}return{tier:f,index:P,qty:f.minQuantity,pricePerUnitCents:C,basePricePerUnitCents:l}}),c=un(u),x=n.defaultTier==="best_value"?c:0;typeof n.defaultTier=="number"&&(x=gt(n.defaultTier,0,u.length-1));let v=n.popularBadge.tierIndex!==void 0?gt(n.popularBadge.tierIndex,0,u.length-1):c,h=s("div","lb-volume");if(h.appendChild(dn(t,u,x,d,p)),n.countdown.showCountdown&&t.endsAt){let f=ie(t.endsAt);f&&(h.appendChild(f.el),i?.(f.stop))}let E=s("div","lb-volume__tiers",{role:"radiogroup","aria-label":"Quantity tiers","data-tier-group":""});u.forEach(f=>{let P=sn(f,f.index===x,d,n.popularBadge.visible&&f.index===v?n.popularBadge.text:null,n.pricing.showComparePrice,n.pricing.showPerUnitPrice);P.addEventListener("click",()=>A(f.index)),P.addEventListener("keydown",C=>{if(C.key==="Enter"||C.key===" "){C.preventDefault(),A(f.index);return}if(C.key==="ArrowDown"||C.key==="ArrowRight"||C.key==="ArrowUp"||C.key==="ArrowLeft"){C.preventDefault();let M=C.key==="ArrowDown"||C.key==="ArrowRight"?1:-1,U=(f.index+M+u.length)%u.length;A(U),E.children[U]?.focus()}}),E.appendChild(P)}),h.appendChild(E),h.appendChild(s("div","lb-bundle-divider"));let B=ht(u,x,d,n.pricing.showItemCount,n.pricing.showCompareAtPrice);h.appendChild(B);let y=n.savingsBar.visible?mt(u,x,d):null;y&&h.appendChild(y);let S=cn(t,()=>{if(!o)return;let f=u[x];f&&r([{merchandiseId:o.id,quantity:f.qty,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}])});h.appendChild(S),h.appendChild(s("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),h.appendChild(s("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(h);function A(f){if(f===x||f<0||f>=u.length)return;x=f,Array.from(E.children).forEach((M,U)=>{M.setAttribute("aria-checked",String(U===f)),M.tabIndex=U===f?0:-1});let P=ht(u,f,d,n.pricing.showItemCount,n.pricing.showCompareAtPrice);if(B.replaceWith(P),B=P,y){let M=mt(u,f,d);y.replaceWith(M),y=M}let C=h.querySelector("[data-header-badge]");if(C){let M=vt(u[f],d,p);M?(C.textContent=M,C.style.display=""):C.style.display="none"}}}function dn(e,t,r,i,n){let a=e.widgetConfig,o=s("div","lb-bundle-header"),l=s("div","lb-bundle-header__content"),d=s("h3","lb-bundle-title");if(d.textContent=e.title,l.appendChild(d),o.appendChild(l),a.pricing.showSaveBadge){let p=vt(t[r],i,n);if(p){let u=s("span","lb-bundle-header__badge",{"data-header-badge":""});u.textContent=p,o.appendChild(u)}}return o}function sn(e,t,r,i,n,a){let o=s("div","lb-volume__tier",{role:"radio","aria-checked":String(t),tabindex:t?"0":"-1","data-tier-index":String(e.index),"data-tier-qty":String(e.qty)}),l=s("span","lb-volume__radio");l.appendChild(s("span","lb-volume__radio-dot")),o.appendChild(l);let d=s("span","lb-volume__tier-grid"),p=s("span","lb-volume__tier-label");p.textContent=`Buy ${e.qty}`,d.appendChild(p);let u=s("span","lb-volume__tier-price");if(n&&e.pricePerUnitCents<e.basePricePerUnitCents){let x=s("span","lb-volume__tier-compare");x.textContent=R(e.basePricePerUnitCents,r),u.appendChild(x)}if(a){let x=document.createElement("span");x.setAttribute("data-tier-price-each",""),x.textContent=R(e.pricePerUnitCents,r),u.appendChild(x);let v=s("span","lb-volume__tier-unit");v.textContent=" each",u.appendChild(v)}d.appendChild(u),o.appendChild(d);let c=s("span","lb-volume__tier-badge");return i?c.textContent=i:c.style.display="none",o.appendChild(c),o}function ht(e,t,r,i,n){let a=e[t],o=a?a.pricePerUnitCents*a.qty:0,l=a?a.basePricePerUnitCents*a.qty:0,d=Math.max(0,l-o),p=s("div","lb-bundle-pricing"),u=s("span","lb-bundle-pricing__label",{"data-total-label":""});if(u.textContent="Total",i&&a){let v=document.createElement("span");v.setAttribute("data-item-count",""),v.textContent=` (${a.qty} item${a.qty===1?"":"s"})`,u.appendChild(v)}p.appendChild(u);let c=s("span","lb-bundle-pricing__prices");if(n&&d>0){let v=s("span","lb-bundle-compare-price",{"data-compare-price":""});v.textContent=R(l,r),c.appendChild(v)}let x=s("span","lb-bundle-sale-price",{"data-total-price":""});return x.textContent=R(o,r),c.appendChild(x),p.appendChild(c),p}function mt(e,t,r){let i=e[t],n=i?i.pricePerUnitCents*i.qty:0,a=i?i.basePricePerUnitCents*i.qty:0,o=Math.max(0,a-n),l=s("div","lb-bundle-savings-bar",{"data-savings-bar":""});o<=0&&(l.style.display="none");let d=document.createElement("span");d.textContent="You save",l.appendChild(d);let p=s("span","",{"data-savings-amount":""});return p.textContent=R(o,r),l.appendChild(p),l}function cn(e,t){let i=e.products[0]?.variants.nodes.some(o=>o.availableForSale),n=i?e.widgetConfig.cta.ctaText||"Add to cart":"Sold out",a=oe(n);return i||(a.disabled=!0),a.addEventListener("click",()=>{a.disabled||t()}),a}function vt(e,t,r){if(!e)return null;let{tier:i}=e;if(r==="fixed_amount"){let n=i.amount??0;return n>0?`-${R(Math.round(n*100),t)}`:null}if(r==="percentage"){let n=i.percentage??0;return n>0?`-${Math.round(n)}%`:null}return null}function un(e){let t=0,r=0;return e.forEach((i,n)=>{let a=i.basePricePerUnitCents-i.pricePerUnitCents;a>t&&(t=a,r=n)}),r}function gt(e,t,r){return Math.max(t,Math.min(r,e))}var pn=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown","Enter"," ","Escape"]),ge=new Set,fe=!1;function xt(e){let t=e==="using-mouse"?"using-keyboard":"using-mouse";for(let r of ge)r.classList.add(e),r.classList.remove(t)}function wt(e){pn.has(e.key)&&xt("using-keyboard")}function yt(){xt("using-mouse")}function bn(){fe||(fe=!0,document.addEventListener("keydown",wt,!0),document.addEventListener("pointerdown",yt,!0))}function hn(){fe&&(fe=!1,document.removeEventListener("keydown",wt,!0),document.removeEventListener("pointerdown",yt,!0))}function ve(e){return e.classList.add("using-mouse"),e.classList.remove("using-keyboard"),ge.add(e),bn(),()=>{ge.delete(e),e.classList.remove("using-mouse"),e.classList.remove("using-keyboard"),ge.size===0&&hn()}}var Pe=`/* Lime Bundles \u2014 shared base styles for all bundle widget types */
|
|
253
|
+
</svg>`;function vt(e,t,r,o){let n=t.widgetConfig,a=t.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",i=t.minQuantity??1,l=t.maxQuantity??i,d=cn(t,n.outOfStockBehavior);if(d.filter(b=>!b.isOos).length<i)return;let p=[],c=s("div","lb-mix-match",{"data-required-quantity":String(i),"data-max-quantity":String(l)}),_=rn(t);if(c.appendChild(_),n.countdown.showCountdown&&t.endsAt){let b=ae(t.endsAt);b&&(c.appendChild(b.el),o?.(b.stop))}let g=nn(i);c.appendChild(g.el);let f=s("div","lb-mix-match__slots",{"data-selection-slots":""});c.appendChild(f),c.appendChild(s("div","lb-bundle-divider"));let k=ln(n.pricing.showCompareAtPrice);c.appendChild(k.el);let A=n.savingsBar.visible?dn():null;A&&c.appendChild(A.el);let C=s("div","lb-mix-match__price-placeholder",{"data-price-placeholder":""}),T=s("span","lb-mix-match__price-placeholder-text");T.textContent=`Select ${i} items to see price`,C.appendChild(T),c.appendChild(C);let B=sn(t,d,a,{showSearch:n.showSearch,onAdd:(b,w)=>E(b,w),onRemove:(b,w)=>M(b,w),isOverMax:()=>p.length>=l});c.appendChild(B.el);let I=le(`Select ${i} items to unlock`);I.disabled=!0,I.addEventListener("click",()=>{if(I.disabled)return;let b=p.map(w=>({merchandiseId:w.variantId,quantity:w.quantity,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}));r(b)}),c.appendChild(I),c.appendChild(s("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),c.appendChild(s("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(c),o?.(()=>ve(c));let m=d.find(b=>!b.isOos),S=m?.firstAvailableVariant??m?.variants[0];m&&S&&p.push({productId:m.product.id,productTitle:m.product.title,variantId:S.id,variantTitle:S.title,imageUrl:S.image?.url??m.product.featuredImage?.url??null,priceCents:W(S.price.amount),compareCents:S.compareAtPrice?W(S.compareAtPrice.amount):null,unitPriceLabel:ee(S.unitPrice,S.unitPriceMeasurement,a),quantity:z(t,m.product.id,S.id)}),v();function E(b,w){p.length>=l||(p.push({productId:b.id,productTitle:b.title,variantId:w.id,variantTitle:w.title,imageUrl:w.image?.url??b.featuredImage?.url??null,priceCents:W(w.price.amount),compareCents:w.compareAtPrice?W(w.compareAtPrice.amount):null,unitPriceLabel:ee(w.unitPrice,w.unitPriceMeasurement,a),quantity:z(t,b.id,w.id)}),v())}function M(b,w){let L=p.findIndex(N=>N.productId===b&&N.variantId===w);L!==-1&&(p.splice(L,1),v())}function V(b){b<0||b>=p.length||(p.splice(b,1),v())}function v(){$(),g.update(p.length),k.update(p,t,a),A&&A.update(p,t,a),C.style.display=p.length===0?"":"none",B.refreshCounts(),P()}function $(){f.innerHTML="";let b=Math.max(i,p.length);for(let w=0;w<b;w++){let L=p[w];L?f.appendChild(an(L,w,a,()=>V(w))):f.appendChild(on(w,()=>B.open()))}}function P(){let b=p.length;b<i?(I.disabled=!0,Me(I,`Select ${i-b} more to unlock`)):(I.disabled=!1,Me(I,n.cta.ctaText||"Add to cart"))}}function rn(e){let t=e.widgetConfig,r=s("div","lb-bundle-header"),o=s("div","lb-bundle-header__content"),n=s("h3","lb-bundle-title");if(n.textContent=e.title,o.appendChild(n),r.appendChild(o),t.pricing.showSaveBadge){let{discountType:a,discountValue:i}=e.discountConfig,l=null;if(a==="percentage"&&i>0?l=`-${Math.round(i)}%`:a==="fixed_amount"&&i>0&&(l=`-${R(Math.round(i*100),e.products[0]?.priceRange.minVariantPrice.currencyCode??"USD")}`),l){let d=s("span","lb-bundle-header__badge");d.textContent=l,r.appendChild(d)}}return r}function nn(e){let t=s("div","lb-mix-match__progress"),r=s("div","lb-mix-match__progress-labels"),o=s("span","lb-mix-match__progress-count",{"data-progress-count":""});o.textContent=`0 of ${e} selected`,r.appendChild(o);let n=s("span","lb-mix-match__progress-remaining",{"data-progress-remaining":""});n.textContent=`${e} more to go`,r.appendChild(n),t.appendChild(r);let a=s("div","lb-mix-match__progress-track",{role:"progressbar","aria-valuenow":"0","aria-valuemin":"0","aria-valuemax":String(e)}),i=s("div","lb-mix-match__progress-fill",{"data-progress-fill":""});i.style.width="0%",a.appendChild(i),t.appendChild(a);function l(d){let u=Math.min(100,d/e*100);o.textContent=`${d} of ${e} selected`,d>=e?n.textContent="Complete":n.textContent=`${e-d} more to go`,i.style.width=`${u}%`,a.setAttribute("aria-valuenow",String(Math.min(d,e)))}return{el:t,update:l}}function on(e,t){let r=s("div","lb-bundle-product-row lb-mix-match__slot lb-mix-match__slot--empty",{"data-slot":String(e+1),tabindex:"0",role:"button","aria-label":"Add a product to the bundle"}),o=s("div","lb-mix-match__empty-thumb");o.innerHTML=en,r.appendChild(o);let n=s("span","lb-mix-match__empty-text");return n.textContent="Choose an item",r.appendChild(n),r.addEventListener("click",t),r.addEventListener("keydown",a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),t())}),r}function an(e,t,r,o){let n=s("div","lb-bundle-product-row lb-mix-match__slot lb-mix-match__slot--filled",{"data-slot":String(t+1)}),a=s("div","lb-bundle-thumbnail",{"data-thumbnail":""});if(e.imageUrl){let f=document.createElement("img");f.src=te(e.imageUrl,{width:U,height:U,crop:"center"}),f.alt=e.productTitle,f.width=U,f.height=U,f.loading="lazy",a.appendChild(f)}else a.insertAdjacentHTML("beforeend",gt);let i=s("span","lb-bundle-qty-badge");i.textContent=String(e.quantity),a.appendChild(i),n.appendChild(a);let l=s("div","lb-mix-match__filled-info"),d=s("span","lb-mix-match__filled-title");if(d.textContent=e.productTitle,l.appendChild(d),e.variantTitle&&e.variantTitle!=="Default Title"){let f=s("span","lb-mix-match__filled-variant");f.textContent=e.variantTitle,l.appendChild(f)}let u=e.priceCents*e.quantity,p=e.compareCents!==null?e.compareCents*e.quantity:null,c=s("span","lb-mix-match__filled-price");if(p!==null&&p>u){let f=s("span","lb-mix-match__filled-compare");f.textContent=R(p,r),c.appendChild(f)}let _=document.createElement("span");if(_.textContent=R(u,r),c.appendChild(_),l.appendChild(c),e.unitPriceLabel){let f=s("span","lb-bundle-product-unit-price");f.textContent=e.unitPriceLabel,l.appendChild(f)}n.appendChild(l);let g=document.createElement("button");return g.type="button",g.className="lb-mix-match__slot-remove",g.setAttribute("aria-label",`Remove ${e.productTitle}`),g.innerHTML=ft,g.addEventListener("click",f=>{f.stopPropagation(),o()}),n.appendChild(g),n}function ln(e){let t=s("div","lb-bundle-pricing",{"data-pricing-section":""});t.style.display="none";let r=s("span","lb-bundle-pricing__label");r.textContent="Bundle price",t.appendChild(r);let o=s("span","lb-bundle-pricing__prices"),n=s("span","lb-bundle-compare-price",{"data-compare-price":""});e&&o.appendChild(n);let a=s("span","lb-bundle-sale-price",{"data-sale-price":""});o.appendChild(a),t.appendChild(o);function i(l,d,u){if(l.length===0){t.style.display="none";return}t.style.display="";let p=l.reduce((_,g)=>_+g.priceCents*g.quantity,0),c=be(p,d.discountConfig);e&&p>c?(n.textContent=R(p,u),n.style.display=""):n.style.display="none",a.textContent=R(c,u)}return{el:t,update:i}}function dn(){let e=s("div","lb-bundle-savings-bar",{"data-savings-bar":""});e.style.display="none";let t=document.createElement("span");t.textContent="You save",e.appendChild(t);let r=s("span","",{"data-savings-amount":""});e.appendChild(r);function o(n,a,i){if(n.length===0){e.style.display="none";return}let l=n.reduce((p,c)=>p+c.priceCents*c.quantity,0),d=be(l,a.discountConfig),u=Math.max(0,l-d);if(u<=0){e.style.display="none";return}e.style.display="",r.textContent=R(u,i)}return{el:e,update:o}}function sn(e,t,r,o){let n=s("div","lb-mix-match__modal-overlay",{"data-modal-overlay":"","data-bundle-gid":e.id});n.style.display="none";let a=s("div","lb-mix-match__modal",{role:"dialog","aria-modal":"true","aria-labelledby":`lb-modal-title-${mt(e.id)}`,tabindex:"-1"}),i=s("div","lb-mix-match__modal-header"),l=s("h4","lb-mix-match__modal-title",{id:`lb-modal-title-${mt(e.id)}`});l.textContent="Pick an item",i.appendChild(l);let d=document.createElement("button");d.type="button",d.className="lb-mix-match__modal-close",d.setAttribute("data-modal-close",""),d.setAttribute("aria-label","Close"),d.innerHTML=ft,d.addEventListener("click",E),i.appendChild(d),a.appendChild(i);let u=null,p=null;if(o.showSearch){let v=s("div","lb-mix-match__modal-search");u=document.createElement("input"),u.type="text",u.className="lb-mix-match__modal-search-input",u.setAttribute("data-modal-search",""),u.setAttribute("role","searchbox"),u.setAttribute("aria-label","Search products"),u.setAttribute("placeholder","Search products"),u.autocomplete="off",u.addEventListener("input",()=>T()),v.appendChild(u),p=document.createElement("button"),p.type="button",p.className="lb-mix-match__modal-search-clear",p.setAttribute("data-modal-search-clear",""),p.setAttribute("aria-label","Clear search"),p.style.display="none",p.innerHTML=tn,p.addEventListener("click",()=>{u&&(u.value="",T(),u.focus())}),v.appendChild(p),a.appendChild(v)}let c=s("div","lb-mix-match__modal-list",{"data-modal-list":""});a.appendChild(c);let _=s("div","lb-mix-match__modal-empty",{"data-modal-empty":""});_.style.display="none";let g=document.createElement("p");g.textContent="No products match your search.",_.appendChild(g),a.appendChild(_);let f=s("span","lb-visually-hidden",{"data-modal-live":"","aria-live":"polite"});a.appendChild(f),n.appendChild(a);let k=!1,A=[];function C(){k||(k=!0,c.innerHTML="",t.forEach(v=>{let $=v.variants,P=v.variants.find(D=>J(D,z(e,v.product.id,D.id)))??v.firstAvailableVariant??v.variants[0];if(!P)return;let b=P,w=s("div",v.isOos?"lb-mix-match__modal-product lb-mix-match__modal-product--sold-out":"lb-mix-match__modal-product",{"data-product-id":v.product.id.replace(/^.*\//,"")}),L=s("div","lb-mix-match__modal-product-thumb"),Y=(v.variants.find(D=>J(D,z(e,v.product.id,D.id)))??v.variants[0]??null)?.image??v.product.featuredImage??null,h=null;Y?(h=document.createElement("img"),h.src=te(Y.url,{width:U,height:U,crop:"center"}),h.alt=Y.altText??v.product.title,h.width=U,h.height=U,h.loading="lazy",L.appendChild(h)):L.insertAdjacentHTML("beforeend",gt);let x=s("span","lb-bundle-qty-badge");x.textContent=String(z(e,v.product.id,b.id)),L.appendChild(x),w.appendChild(L);let y=s("div","lb-mix-match__modal-product-info"),F=s("p","lb-mix-match__modal-product-title");F.textContent=v.product.title,y.appendChild(F);let ne=s("p","lb-mix-match__modal-product-price");ne.textContent=R(W(b.price.amount)*z(e,v.product.id,b.id),r),y.appendChild(ne);let Z=s("p","lb-mix-match__modal-product-unit-price lb-bundle-product-unit-price"),De=ee(b.unitPrice,b.unitPriceMeasurement,r);De?Z.textContent=De:Z.hidden=!0,y.appendChild(Z);let de=s("span","lb-bundle-low-stock-badge",{"data-low-stock-badge":""});de.hidden=!0,y.appendChild(de);let Fe=D=>{let ke=z(e,v.product.id,D.id);ie(D,ke,e.widgetConfig.lowStockThreshold,e.widgetConfig.showLowStockBadge)?(de.textContent=`Only ${D.quantityAvailable} left`,de.hidden=!1):de.hidden=!0};Fe(b);let Ce={el:w,product:v.product,variant:P,updateCount:()=>{}};if($.length>1){let D=$[0].selectedOptions.map(q=>q.name),ke=v.product.id.replace(/^.*\//,""),ue=[],It=q=>$.find(O=>O.selectedOptions.length===q.length&&O.selectedOptions.every((K,H)=>K.value===q[H]))??null,Mt=q=>{q.selectedOptions.forEach((O,K)=>{let H=ue[K];H&&H.value!==O.value&&(H.value=O.value)})},Rt=(q,O,K)=>$.some(H=>!J(H,z(e,v.product.id,H.id))||H.selectedOptions[q]?.value!==O?!1:H.selectedOptions.every((j,Q)=>Q===q||j.value===K[Q])),_e=q=>{ue.forEach((O,K)=>{Array.from(O.options).forEach(H=>{H.disabled=!Rt(K,H.value,q)})})},Dt=()=>{let q=ue.map(Q=>Q.value),O=It(q);if(!O){Mt(b),_e(b.selectedOptions.map(Q=>Q.value));return}b=O,Ce.variant=O;let K=z(e,v.product.id,b.id);ne.textContent=R(W(b.price.amount)*K,r);let H=ee(b.unitPrice,b.unitPriceMeasurement,r);H?(Z.textContent=H,Z.hidden=!1):(Z.textContent="",Z.hidden=!0);let j=b.image??v.product.featuredImage;h&&j&&(h.src=te(j.url,{width:U,height:U,crop:"center"}),h.alt=j.altText??v.product.title),_e(O.selectedOptions.map(Q=>Q.value)),Fe(b),Ve()},Oe=s("div","lb-bundle-variant-option-groups");D.forEach((q,O)=>{let K=s("div","lb-bundle-variant-option-group"),H=s("span","lb-bundle-variant-option-label");H.textContent=q,K.appendChild(H);let j=document.createElement("select");j.className="lb-mix-match__variant-select",j.setAttribute("data-variant-option",""),j.setAttribute("data-option-position",String(O+1)),j.name=`lb-variant-${ke}-${O+1}`,j.setAttribute("aria-label",q);let Q=new Set;$.forEach(Ft=>{let oe=Ft.selectedOptions[O]?.value;if(!oe||Q.has(oe))return;Q.add(oe);let pe=document.createElement("option");pe.value=oe,pe.textContent=oe,P.selectedOptions[O]?.value===oe&&(pe.selected=!0),j.appendChild(pe)}),j.addEventListener("change",Dt),ue.push(j),K.appendChild(j),Oe.appendChild(K)}),y.appendChild(Oe),_e(P.selectedOptions.map(q=>q.value))}else if($.length===1&&P.title!=="Default Title"){let D=s("span","lb-mix-match__filled-variant");D.textContent=P.title,y.appendChild(D)}if(v.isOos){let D=s("span","lb-mix-match__modal-sold-out-label");D.textContent="Sold out",y.appendChild(D)}w.appendChild(y);let Ve=()=>{x.textContent=String(z(e,v.product.id,b.id))};if(!v.isOos){let D=document.createElement("button");D.type="button",D.className="lb-mix-match__modal-add",D.textContent="Add",D.addEventListener("click",()=>{o.isOverMax()||(o.onAdd(v.product,b),E())}),w.appendChild(D)}Ce.updateCount=v.isOos?()=>{}:Ve,A.push(Ce),c.appendChild(w)}),fe(c),V())}function T(){if(!u)return;let v=u.value.trim().toLowerCase();p&&(p.style.display=v?"":"none");let $=0;A.forEach(P=>{let b=!v||P.product.title.toLowerCase().includes(v);P.el.style.display=b?"":"none",b&&$++}),_.style.display=$===0&&v?"":"none"}let B=null;function I(v){if(v.key==="Escape"){v.preventDefault(),E();return}v.key==="Tab"&&un(v,a)}let m=!1;function S(){m||o.isOverMax()||(m=!0,C(),B=n.getRootNode().activeElement,n.style.display="",n.classList.add("lb-mix-match__modal-overlay--open"),a.focus(),document.addEventListener("keydown",I),n.addEventListener("click",M))}function E(){m&&(m=!1,n.classList.remove("lb-mix-match__modal-overlay--open"),n.style.display="none",document.removeEventListener("keydown",I),n.removeEventListener("click",M),B instanceof HTMLElement&&B.focus())}function M(v){v.target===n&&E()}function V(){A.forEach(v=>v.updateCount())}return{el:n,open:S,close:E,refreshCounts:V}}function cn(e,t){let r=[],o=new Set;for(let n of e.products){if(o.has(n.id))continue;o.add(n.id);let a=n.variants.nodes.filter(l=>J(l,z(e,n.id,l.id))),i=a.length===0;i&&t==="hide"||r.push({product:n,variants:n.variants.nodes,firstAvailableVariant:a[0]??null,isOos:i})}return r}function un(e,t){let r=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(r.length===0)return;let o=r[0],n=r[r.length-1],a=t.getRootNode().activeElement;e.shiftKey&&a===o?(e.preventDefault(),n.focus()):!e.shiftKey&&a===n&&(e.preventDefault(),o.focus())}function mt(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function Ct(e,t,r,o){let n=t.widgetConfig,a=t.products[0],i=t.volumeTiers[0]?.minQuantity??1,l=a?.variants.nodes.find(m=>J(m,i));if(!l&&n.outOfStockBehavior==="hide")return;let d=l?W(l.price.amount):0,u=l?.price.currencyCode??"USD",p=t.discountConfig.discountType,c=t.volumeTiers.map((m,S)=>{let E;if(p==="fixed_amount"){let M=Math.round((m.amount??0)*100);E=Math.max(0,d-M)}else{let M=m.percentage??0,V=Math.floor(d*M/100);E=Math.max(0,d-V)}return{tier:m,index:S,qty:m.minQuantity,pricePerUnitCents:E,basePricePerUnitCents:d}}),_=mn(c),g=n.defaultTier==="best_value"?_:0;typeof n.defaultTier=="number"&&(g=yt(n.defaultTier,0,c.length-1));let f=n.popularBadge.tierIndex!==void 0?yt(n.popularBadge.tierIndex,0,c.length-1):_,k=s("div","lb-volume");if(k.appendChild(pn(t,c,g,u,p)),n.countdown.showCountdown&&t.endsAt){let m=ae(t.endsAt);m&&(k.appendChild(m.el),o?.(m.stop))}let A=s("div","lb-volume__tiers",{role:"radiogroup","aria-label":"Quantity tiers","data-tier-group":""});c.forEach(m=>{let S=bn(m,m.index===g,u,n.popularBadge.visible&&m.index===f?n.popularBadge.text:null,n.pricing.showComparePrice,n.pricing.showPerUnitPrice);S.addEventListener("click",()=>I(m.index)),S.addEventListener("keydown",E=>{if(E.key==="Enter"||E.key===" "){E.preventDefault(),I(m.index);return}if(E.key==="ArrowDown"||E.key==="ArrowRight"||E.key==="ArrowUp"||E.key==="ArrowLeft"){E.preventDefault();let M=E.key==="ArrowDown"||E.key==="ArrowRight"?1:-1,V=(m.index+M+c.length)%c.length;I(V),A.children[V]?.focus()}}),A.appendChild(S)}),k.appendChild(A),k.appendChild(s("div","lb-bundle-divider"));let C=xt(c,g,u,n.pricing.showItemCount,n.pricing.showCompareAtPrice);k.appendChild(C);let T=n.savingsBar.visible?wt(c,g,u):null;T&&k.appendChild(T);let B=hn(t,()=>{if(!l)return;let m=c[g];m&&r([{merchandiseId:l.id,quantity:m.qty,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}])});if(l&&ie(l,i,n.lowStockThreshold,n.showLowStockBadge)){let m=s("span","lb-bundle-low-stock-badge",{"data-low-stock-badge":""});m.textContent=`Only ${l.quantityAvailable} left`,k.appendChild(m)}k.appendChild(B),k.appendChild(s("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),k.appendChild(s("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(k);function I(m){if(m===g||m<0||m>=c.length)return;g=m,Array.from(A.children).forEach((M,V)=>{M.setAttribute("aria-checked",String(V===m)),M.tabIndex=V===m?0:-1});let S=xt(c,m,u,n.pricing.showItemCount,n.pricing.showCompareAtPrice);if(C.replaceWith(S),C=S,T){let M=wt(c,m,u);T.replaceWith(M),T=M}let E=k.querySelector("[data-header-badge]");if(E){let M=kt(c[m],u,p);M?(E.textContent=M,E.style.display=""):E.style.display="none"}}}function pn(e,t,r,o,n){let a=e.widgetConfig,i=s("div","lb-bundle-header"),l=s("div","lb-bundle-header__content"),d=s("h3","lb-bundle-title");if(d.textContent=e.title,l.appendChild(d),i.appendChild(l),a.pricing.showSaveBadge){let u=kt(t[r],o,n);if(u){let p=s("span","lb-bundle-header__badge",{"data-header-badge":""});p.textContent=u,i.appendChild(p)}}return i}function bn(e,t,r,o,n,a){let i=s("div","lb-volume__tier",{role:"radio","aria-checked":String(t),tabindex:t?"0":"-1","data-tier-index":String(e.index),"data-tier-qty":String(e.qty)}),l=s("span","lb-volume__radio");l.appendChild(s("span","lb-volume__radio-dot")),i.appendChild(l);let d=s("span","lb-volume__tier-grid"),u=s("span","lb-volume__tier-label");u.textContent=`Buy ${e.qty}`,d.appendChild(u);let p=s("span","lb-volume__tier-price");if(n&&e.pricePerUnitCents<e.basePricePerUnitCents){let _=s("span","lb-volume__tier-compare");_.textContent=R(e.basePricePerUnitCents,r),p.appendChild(_)}if(a){let _=document.createElement("span");_.setAttribute("data-tier-price-each",""),_.textContent=R(e.pricePerUnitCents,r),p.appendChild(_);let g=s("span","lb-volume__tier-unit");g.textContent=" each",p.appendChild(g)}d.appendChild(p),i.appendChild(d);let c=s("span","lb-volume__tier-badge");return o?c.textContent=o:c.style.display="none",i.appendChild(c),i}function xt(e,t,r,o,n){let a=e[t],i=a?a.pricePerUnitCents*a.qty:0,l=a?a.basePricePerUnitCents*a.qty:0,d=Math.max(0,l-i),u=s("div","lb-bundle-pricing"),p=s("span","lb-bundle-pricing__label",{"data-total-label":""});if(p.textContent="Total",o&&a){let g=document.createElement("span");g.setAttribute("data-item-count",""),g.textContent=` (${a.qty} item${a.qty===1?"":"s"})`,p.appendChild(g)}u.appendChild(p);let c=s("span","lb-bundle-pricing__prices");if(n&&d>0){let g=s("span","lb-bundle-compare-price",{"data-compare-price":""});g.textContent=R(l,r),c.appendChild(g)}let _=s("span","lb-bundle-sale-price",{"data-total-price":""});return _.textContent=R(i,r),c.appendChild(_),u.appendChild(c),u}function wt(e,t,r){let o=e[t],n=o?o.pricePerUnitCents*o.qty:0,a=o?o.basePricePerUnitCents*o.qty:0,i=Math.max(0,a-n),l=s("div","lb-bundle-savings-bar",{"data-savings-bar":""});i<=0&&(l.style.display="none");let d=document.createElement("span");d.textContent="You save",l.appendChild(d);let u=s("span","",{"data-savings-amount":""});return u.textContent=R(i,r),l.appendChild(u),l}function hn(e,t){let r=e.products[0],o=e.volumeTiers[0]?.minQuantity??1,n=r?.variants.nodes.some(l=>J(l,o)),a=n?e.widgetConfig.cta.ctaText||"Add to cart":"Sold out",i=le(a);return n||(i.disabled=!0),i.addEventListener("click",()=>{i.disabled||t()}),i}function kt(e,t,r){if(!e)return null;let{tier:o}=e;if(r==="fixed_amount"){let n=o.amount??0;return n>0?`-${R(Math.round(n*100),t)}`:null}if(r==="percentage"){let n=o.percentage??0;return n>0?`-${Math.round(n)}%`:null}return null}function mn(e){let t=0,r=0;return e.forEach((o,n)=>{let a=o.basePricePerUnitCents-o.pricePerUnitCents;a>t&&(t=a,r=n)}),r}function yt(e,t,r){return Math.max(t,Math.min(r,e))}var gn=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown","Enter"," ","Escape"]),xe=new Set,we=!1;function _t(e){let t=e==="using-mouse"?"using-keyboard":"using-mouse";for(let r of xe)r.classList.add(e),r.classList.remove(t)}function Bt(e){gn.has(e.key)&&_t("using-keyboard")}function St(){_t("using-mouse")}function fn(){we||(we=!0,document.addEventListener("keydown",Bt,!0),document.addEventListener("pointerdown",St,!0))}function vn(){we&&(we=!1,document.removeEventListener("keydown",Bt,!0),document.removeEventListener("pointerdown",St,!0))}function ye(e){return e.classList.add("using-mouse"),e.classList.remove("using-keyboard"),xe.add(e),fn(),()=>{xe.delete(e),e.classList.remove("using-mouse"),e.classList.remove("using-keyboard"),xe.size===0&&vn()}}var Re=`/* Lime Bundles \u2014 shared base styles for all bundle widget types */
|
|
242
254
|
|
|
243
255
|
.lb-bundle-widget.lb-bundle-widget,
|
|
244
256
|
.lb-bundle-widget.lb-bundle-widget * {
|
|
@@ -515,15 +527,19 @@
|
|
|
515
527
|
display: none;
|
|
516
528
|
}
|
|
517
529
|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
530
|
+
/* Read-only variant text shown below the product title when only one
|
|
531
|
+
variant is in scope (single-variant product, or merchant pinned a
|
|
532
|
+
single variant). Same visual treatment as the mix-match filled
|
|
533
|
+
slot's variant text \u2014 see .lb-mix-match__filled-variant in
|
|
534
|
+
bundle-mix-match.css. Both share this rule via the comma selector
|
|
535
|
+
so the storefront UX stays consistent across bundle types. */
|
|
536
|
+
.lb-bundle-variant-badge,
|
|
537
|
+
.lb-mix-match__slot--filled .lb-mix-match__filled-variant {
|
|
538
|
+
display: block;
|
|
523
539
|
font-size: 12px;
|
|
524
|
-
line-height:
|
|
540
|
+
line-height: 20px;
|
|
541
|
+
margin-top: 2px;
|
|
525
542
|
color: color-mix(in srgb, var(--lb-text) 60%, transparent);
|
|
526
|
-
margin-top: 8px;
|
|
527
543
|
}
|
|
528
544
|
|
|
529
545
|
/* Per-option variant pickers. Each option's label + select sit inside a
|
|
@@ -567,10 +583,10 @@
|
|
|
567
583
|
click-to-focus doesn't leave a keyboard-style ring. The modal overlay
|
|
568
584
|
gets its own selector because the Liquid path reparents it to body,
|
|
569
585
|
outside the widget root. */
|
|
570
|
-
.using-mouse .lb-bundle-widget :focus,
|
|
571
|
-
.using-mouse .lb-bundle-widget :focus-visible,
|
|
572
|
-
.using-mouse .lb-mix-match__modal-overlay :focus,
|
|
573
|
-
.using-mouse .lb-mix-match__modal-overlay :focus-visible {
|
|
586
|
+
.using-mouse .lb-bundle-widget :focus:not([aria-checked="true"]),
|
|
587
|
+
.using-mouse .lb-bundle-widget :focus-visible:not([aria-checked="true"]),
|
|
588
|
+
.using-mouse .lb-mix-match__modal-overlay :focus:not([aria-checked="true"]),
|
|
589
|
+
.using-mouse .lb-mix-match__modal-overlay :focus-visible:not([aria-checked="true"]) {
|
|
574
590
|
outline: none;
|
|
575
591
|
outline-offset: 0;
|
|
576
592
|
box-shadow: none;
|
|
@@ -797,11 +813,29 @@
|
|
|
797
813
|
margin-left: auto;
|
|
798
814
|
}
|
|
799
815
|
|
|
816
|
+
/* "Only X left" low-stock badge \u2014 appears alongside product/variant
|
|
817
|
+
info when ProductVariant.quantityAvailable falls at or below
|
|
818
|
+
wc.lowStockThreshold. Hidden when quantityAvailable is unknown
|
|
819
|
+
(Storefront token without read_product_inventory). */
|
|
820
|
+
.lb-bundle-low-stock-badge {
|
|
821
|
+
display: inline-flex;
|
|
822
|
+
align-items: center;
|
|
823
|
+
gap: 4px;
|
|
824
|
+
padding: 2px 8px;
|
|
825
|
+
font-size: 11px;
|
|
826
|
+
font-weight: 600;
|
|
827
|
+
line-height: 1.4;
|
|
828
|
+
color: var(--lb-low-stock-text);
|
|
829
|
+
background-color: var(--lb-low-stock-bg);
|
|
830
|
+
border-radius: 4px;
|
|
831
|
+
white-space: nowrap;
|
|
832
|
+
}
|
|
833
|
+
|
|
800
834
|
/* A/B test: hide save badge until JS swaps the label (prevents flash of default) */
|
|
801
835
|
.lb-ab-pending {
|
|
802
836
|
visibility: hidden;
|
|
803
837
|
}
|
|
804
|
-
`,
|
|
838
|
+
`,Tt=`/* Lime Bundles \u2014 Fixed bundle styles */
|
|
805
839
|
|
|
806
840
|
.lb-fixed__products {
|
|
807
841
|
display: flex;
|
|
@@ -876,7 +910,7 @@
|
|
|
876
910
|
outline: 2px solid var(--lb-primary-color);
|
|
877
911
|
outline-offset: 2px;
|
|
878
912
|
}
|
|
879
|
-
`,
|
|
913
|
+
`,At=`/* Lime Bundles \u2014 Mix & Match styles */
|
|
880
914
|
|
|
881
915
|
/* === Slot list ============================================================
|
|
882
916
|
Caps the height of the slot stack so long bundles don't push the CTA off
|
|
@@ -1018,12 +1052,9 @@
|
|
|
1018
1052
|
text-decoration: underline;
|
|
1019
1053
|
}
|
|
1020
1054
|
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
margin-top: 2px;
|
|
1025
|
-
color: color-mix(in srgb, var(--lb-text) 60%, transparent);
|
|
1026
|
-
}
|
|
1055
|
+
/* .lb-mix-match__filled-variant \u2014 styled jointly with
|
|
1056
|
+
.lb-bundle-variant-badge above to keep the variant text consistent
|
|
1057
|
+
across mix-match and fixed bundle widgets. */
|
|
1027
1058
|
|
|
1028
1059
|
.lb-mix-match__filled-price {
|
|
1029
1060
|
/* --lb-product-price-display fallback is the "on" branch; Liquid sets 'none' when merchant disables. */
|
|
@@ -1409,7 +1440,7 @@
|
|
|
1409
1440
|
transition: none;
|
|
1410
1441
|
}
|
|
1411
1442
|
}
|
|
1412
|
-
`,
|
|
1443
|
+
`,Et=`/* Lime Bundles \u2014 Volume / Quantity Breaks styles */
|
|
1413
1444
|
|
|
1414
1445
|
.lb-volume__tiers {
|
|
1415
1446
|
display: flex;
|
|
@@ -1446,10 +1477,21 @@
|
|
|
1446
1477
|
}
|
|
1447
1478
|
|
|
1448
1479
|
.lb-volume__tier:hover {
|
|
1449
|
-
border-color:
|
|
1480
|
+
border-color: var(--lb-tier-selected-border-color);
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
/* Suppress the UA default focus outline so a freshly-clicked selected
|
|
1484
|
+
tier doesn't briefly show the 1px focus ring on top of (or in place of)
|
|
1485
|
+
the custom selected-state outline below. Keyboard focus is still
|
|
1486
|
+
indicated by the :focus-visible rule. */
|
|
1487
|
+
.lb-volume__tier:focus {
|
|
1488
|
+
outline: none;
|
|
1450
1489
|
}
|
|
1451
1490
|
|
|
1452
|
-
|
|
1491
|
+
/* Keyboard focus indicator \u2014 explicitly excludes the selected tier so
|
|
1492
|
+
the selected-state outline rule below has full ownership of the
|
|
1493
|
+
outline property when both states apply at once. */
|
|
1494
|
+
.lb-volume__tier:focus-visible:not([aria-checked="true"]) {
|
|
1453
1495
|
outline: 2px solid var(--lb-primary-color);
|
|
1454
1496
|
outline-offset: 2px;
|
|
1455
1497
|
}
|
|
@@ -1535,7 +1577,7 @@
|
|
|
1535
1577
|
}
|
|
1536
1578
|
|
|
1537
1579
|
|
|
1538
|
-
`,
|
|
1580
|
+
`,Pt=`/**
|
|
1539
1581
|
* Lime Bundles \u2014 Custom variant-picker dropdown styling.
|
|
1540
1582
|
*
|
|
1541
1583
|
* Reuses existing CSS variables: no new merchant-configurable surface.
|
|
@@ -1787,7 +1829,7 @@
|
|
|
1787
1829
|
[data-modal-overlay] > .lb-dropdown-listbox::-webkit-scrollbar-thumb {
|
|
1788
1830
|
background: color-mix(in srgb, var(--lb-picker-text) 15%, transparent);
|
|
1789
1831
|
}
|
|
1790
|
-
`,
|
|
1832
|
+
`,Lt=`/* Lime Bundles \u2014 web-component loading skeleton (not mirrored to theme assets) */
|
|
1791
1833
|
|
|
1792
1834
|
.lb-bundle-widget--loading {
|
|
1793
1835
|
display: block;
|
|
@@ -1883,10 +1925,10 @@
|
|
|
1883
1925
|
animation: none;
|
|
1884
1926
|
}
|
|
1885
1927
|
}
|
|
1886
|
-
`;var
|
|
1887
|
-
`),this.shadow.appendChild(t),this.shopCustomCss){let
|
|
1888
|
-
<style>${
|
|
1889
|
-
<style>${
|
|
1928
|
+
`;var xn=e=>`lb_cart_id:${e}`;function wn(e){if(e)return e.trim()||null;if(typeof document<"u"){let t=document.querySelector('meta[name="shopify:product-handle"]');if(t?.content)return t.content.trim()||null}if(typeof window<"u"){let t=window.location.pathname.match(/\/products\/([^/?#]+)/);if(t?.[1])return decodeURIComponent(t[1])}return null}var ce=class extends HTMLElement{static observedAttributes=["shop-domain","storefront-token","bundle-gid","product-handle","app-url","analytics","locale"];shadow;bundles=[];abortController=null;impressionCleanups=[];renderCleanups=[];shopCustomCss=null;constructor(){super(),this.shadow=this.attachShadow({mode:"open"})}connectedCallback(){this.fetchBundle()}disconnectedCallback(){this.abortController?.abort(),this.teardownImpressions(),this.teardownRenderers()}teardownImpressions(){for(let t of this.impressionCleanups)t();this.impressionCleanups=[]}teardownRenderers(){for(let t of this.renderCleanups)t();this.renderCleanups=[]}attributeChangedCallback(t,r,o){r===o||!this.isConnected||(t==="bundle-gid"||t==="product-handle"||t==="shop-domain"||t==="storefront-token")&&this.shopDomain&&this.storefrontToken&&this.fetchBundle()}get shopDomain(){return this.getAttribute("shop-domain")??""}get storefrontToken(){return this.getAttribute("storefront-token")??""}get bundleGid(){return this.getAttribute("bundle-gid")??""}get productHandleAttr(){return this.getAttribute("product-handle")??""}get appUrl(){return this.getAttribute("app-url")??""}get analyticsEnabled(){return this.getAttribute("analytics")!=="false"}async fetchBundle(){if(!this.shopDomain||!this.storefrontToken){this.renderError("Missing required attributes: shop-domain, storefront-token");return}this.abortController?.abort();let t=new AbortController;this.abortController=t,this.renderLoading();let r=Ae({shopDomain:this.shopDomain,accessToken:this.storefrontToken});try{let o,n=!1;if(this.bundleGid)n=!0,o=this.fetchSingleBundle(r,t.signal);else{let l=wn(this.productHandleAttr);if(!l){this.teardownImpressions(),this.renderError("No bundle-gid or product-handle provided, and the current URL doesn't match /products/<handle>.");return}o=this.fetchProductBundles(r,t.signal,l)}let a=r.query(Xe,void 0,{signal:t.signal}).catch(()=>null);if(await o,t.signal.aborted)return;if(n&&this.bundles.length===0){this.teardownImpressions(),this.renderError("Bundle not found");return}let i=await a;if(i?.shop?.metafield?.value){ct(this.shopDomain,i.shop.metafield.value);let l=Pe(i.shop.metafield.value);l.ok&&(this.shopCustomCss=l.css)}await this.applyABVariants(),this.renderBundles()}catch(o){if(t.signal.aborted)return;this.bundles=[],this.teardownImpressions(),this.renderError(o instanceof Error?o.message:"Failed to load bundle")}}async applyABVariants(){if(!this.appUrl||this.bundles.length===0)return;let t=await Promise.all(this.bundles.map(async r=>{if(!r.abTestId||!r.abVariantB)return r;try{if((await st(this.appUrl,this.shopDomain,r.abTestId,r.id))?.variant==="B")return nt(r)}catch(o){console.warn(`[lime-bundle] A/B assignment failed for bundle ${r.id}; falling back to Variant A.`,o)}return r}));this.bundles=t}async fetchSingleBundle(t,r){let o=await t.query(Qe,{id:this.bundleGid},{signal:r});if(!o.metaobject){this.bundles=[];return}let n=Ee(o.metaobject.id,o.metaobject.fields);this.bundles=n?[n]:[]}async fetchProductBundles(t,r,o){let n=await t.query(Je,{handle:o},{signal:r});if(!n.product){this.bundles=[];return}let a=n.product.metafield?.references?.nodes??[],i=[];for(let l of a){let d=Ee(l.id,l.fields);d&&i.push(d)}this.bundles=i}handleAddToCart=async(t,r)=>{let o=new CustomEvent("lime-bundle:add-to-cart",{detail:{lines:r},bubbles:!0,composed:!0,cancelable:!0}),n=this.dispatchEvent(o);this.reportAddToCartEvent(t,r),n&&await this.defaultAddToCart(r)};async defaultAddToCart(t){if(typeof window>"u")return;let r=Ae({shopDomain:this.shopDomain,accessToken:this.storefrontToken}),o=window.localStorage,n=xn(this.shopDomain),a=o?.getItem(n)??null;try{let i=null;if(a){let d=(await r.query(et,{cartId:a,lines:t})).cartLinesAdd;d?.userErrors?.length?o?.removeItem(n):d?.cart&&(i=d.cart.checkoutUrl)}if(!i){let d=(await r.query(Ze,{input:{lines:t}})).cartCreate;d?.cart&&(o?.setItem(n,d.cart.id),i=d.cart.checkoutUrl)}i?window.location.assign(i):this.dispatchEvent(new CustomEvent("lime-bundle:error",{detail:{message:"Cart creation failed",code:"CART_ERROR"},bubbles:!0,composed:!0}))}catch(i){this.dispatchEvent(new CustomEvent("lime-bundle:error",{detail:{message:i instanceof Error?i.message:"Cart mutation failed",code:"CART_ERROR"},bubbles:!0,composed:!0}))}}reportAddToCartEvent(t,r){if(!this.analyticsEnabled||!this.appUrl)return;let o=r.reduce((a,i)=>a+i.quantity,0),n=r.reduce((a,i)=>{let d=t.products.find(p=>p.variants.nodes.some(c=>c.id===i.merchandiseId))?.variants.nodes.find(p=>p.id===i.merchandiseId),u=d?parseFloat(d.price.amount):0;return a+u*i.quantity},0);it({shopDomain:this.shopDomain,appUrl:this.appUrl},{bundleGid:t.id,bundleType:t.bundleType,productId:t.products[0]?.id??"",quantity:o,totalPrice:Math.round(n*100)/100})}renderBundles(){this.teardownImpressions(),this.teardownRenderers(),this.shadow.innerHTML="";let t=document.createElement("style");if(t.textContent=[Re,Tt,At,Et,Pt].join(`
|
|
1929
|
+
`),this.shadow.appendChild(t),this.shopCustomCss){let o=document.createElement("style");o.setAttribute("data-lime-bundles","shop-custom-css"),o.textContent=this.shopCustomCss,this.shadow.appendChild(o)}for(let o of this.bundles){let n=document.createElement("div");n.className="lb-bundle-widget",n.setAttribute("role","region"),n.setAttribute("aria-label",o.title),n.setAttribute("data-bundle-type",o.bundleType),n.setAttribute("data-bundle-gid",o.id),tt(n,o.widgetConfig),this.renderCleanups.push(ye(n));let a=l=>this.handleAddToCart(o,l),i=l=>this.renderCleanups.push(l);switch(o.bundleType){case"fixed":ht(n,o,a,i);break;case"mix_match":vt(n,o,a,i);break;case"volume":Ct(n,o,a,i);break}this.shadow.appendChild(n),this.setupImpressionFor(o,n)}let r=this.bundles[0];this.dispatchEvent(new CustomEvent("lime-bundle:loaded",{detail:{bundleCount:this.bundles.length,bundleTypes:this.bundles.map(o=>o.bundleType),bundleType:r?.bundleType,title:r?.title},bubbles:!0,composed:!0}))}setupImpressionFor(t,r){if(!this.analyticsEnabled||!this.appUrl)return;let o=at(r,()=>{ot({shopDomain:this.shopDomain,appUrl:this.appUrl},{bundleGid:t.id,bundleType:t.bundleType})});this.impressionCleanups.push(o)}renderLoading(){this.shadow.innerHTML=`
|
|
1930
|
+
<style>${Re}</style>
|
|
1931
|
+
<style>${Lt}</style>
|
|
1890
1932
|
<div class="lb-bundle-widget lb-bundle-widget--loading" aria-busy="true" aria-label="Loading bundle">
|
|
1891
1933
|
<div class="lb-skeleton lb-skeleton--title"></div>
|
|
1892
1934
|
<div class="lb-skeleton--products">
|
|
@@ -1920,5 +1962,5 @@
|
|
|
1920
1962
|
<div class="lb-skeleton lb-skeleton--cta"></div>
|
|
1921
1963
|
</div>
|
|
1922
1964
|
</div>
|
|
1923
|
-
`}renderError(t){this.shadow.innerHTML="",this.dispatchEvent(new CustomEvent("lime-bundle:error",{detail:{message:t,code:"LOAD_ERROR"},bubbles:!0,composed:!0}))}};typeof customElements<"u"&&!customElements.get("lime-bundle")&&customElements.define("lime-bundle",
|
|
1965
|
+
`}renderError(t){this.shadow.innerHTML="",this.dispatchEvent(new CustomEvent("lime-bundle:error",{detail:{message:t,code:"LOAD_ERROR"},bubbles:!0,composed:!0}))}};typeof customElements<"u"&&!customElements.get("lime-bundle")&&customElements.define("lime-bundle",ce);return qt(yn);})();
|
|
1924
1966
|
//# sourceMappingURL=lime-bundle.global.js.map
|