@lime-bundles/widget 2.2.1 → 2.4.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.
@@ -1,4 +1,4 @@
1
- "use strict";var LimeBundles=(()=>{var Y=Object.defineProperty;var $e=Object.getOwnPropertyDescriptor;var We=Object.getOwnPropertyNames;var qe=Object.prototype.hasOwnProperty;var Ne=(e,t)=>{for(var n in t)Y(e,n,{get:t[n],enumerable:!0})},ze=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of We(t))!qe.call(e,r)&&r!==n&&Y(e,r,{get:()=>t[r],enumerable:!(i=$e(t,r))||i.enumerable});return e};var je=e=>ze(Y({},"__esModule",{value:!0}),e);var jt={};Ne(jt,{LimeBundleElement:()=>j});var ie=class extends Error{constructor(e){super(e.map(t=>t.message).join("; ")),this.errors=e,this.name="StorefrontApiError"}},Ge="2025-10";function K(e){let t=e.apiVersion??Ge,n=`https://${e.shopDomain}/api/${t}/graphql.json`;return{async query(i,r,a){let o={"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":e.accessToken};e.buyerIp&&(o["Shopify-Storefront-Buyer-IP"]=e.buyerIp);let d=await fetch(n,{method:"POST",headers:o,body:JSON.stringify({query:i,variables:r}),signal:a?.signal});if(!d.ok)throw new ie([{message:`Storefront API error: ${d.status} ${d.statusText}`}]);let l=await d.json();if(l.errors?.length)throw new ie(l.errors);return l.data}}}var ce=`#graphql
1
+ "use strict";var LimeBundles=(()=>{var Z=Object.defineProperty;var Ke=Object.getOwnPropertyDescriptor;var Ye=Object.getOwnPropertyNames;var Xe=Object.prototype.hasOwnProperty;var Je=(e,t)=>{for(var r in t)Z(e,r,{get:t[r],enumerable:!0})},Ze=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ye(t))!Xe.call(e,i)&&i!==r&&Z(e,i,{get:()=>t[i],enumerable:!(n=Ke(t,i))||n.enumerable});return e};var et=e=>Ze(Z({},"__esModule",{value:!0}),e);var ir={};Je(ir,{LimeBundleElement:()=>K});var ce=class extends Error{constructor(e){super(e.map(t=>t.message).join("; ")),this.errors=e,this.name="StorefrontApiError"}},tt="2025-10";function ee(e){let t=e.apiVersion??tt,r=`https://${e.shopDomain}/api/${t}/graphql.json`;return{async query(n,i,a){let o={"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":e.accessToken};e.buyerIp&&(o["Shopify-Storefront-Buyer-IP"]=e.buyerIp);let l=await fetch(r,{method:"POST",headers:o,body:JSON.stringify({query:n,variables:i}),signal:a?.signal});if(!l.ok)throw new ce([{message:`Storefront API error: ${l.status} ${l.statusText}`}]);let d=await l.json();if(d.errors?.length)throw new ce(d.errors);return d.data}}}var fe=`#graphql
2
2
  query BundleMetaobject($id: ID!) {
3
3
  metaobject(id: $id) {
4
4
  id
@@ -23,6 +23,8 @@
23
23
  availableForSale
24
24
  price { amount currencyCode }
25
25
  compareAtPrice { amount currencyCode }
26
+ unitPrice { amount currencyCode }
27
+ unitPriceMeasurement { referenceValue referenceUnit }
26
28
  selectedOptions { name value }
27
29
  }
28
30
  }
@@ -46,6 +48,8 @@
46
48
  availableForSale
47
49
  price { amount currencyCode }
48
50
  compareAtPrice { amount currencyCode }
51
+ unitPrice { amount currencyCode }
52
+ unitPriceMeasurement { referenceValue referenceUnit }
49
53
  selectedOptions { name value }
50
54
  }
51
55
  }
@@ -71,6 +75,8 @@
71
75
  availableForSale
72
76
  price { amount currencyCode }
73
77
  compareAtPrice { amount currencyCode }
78
+ unitPrice { amount currencyCode }
79
+ unitPriceMeasurement { referenceValue referenceUnit }
74
80
  selectedOptions { name value }
75
81
  }
76
82
  }
@@ -82,7 +88,7 @@
82
88
  }
83
89
  }
84
90
  }
85
- `,ue=`#graphql
91
+ `,ve=`#graphql
86
92
  query ShopCustomCss {
87
93
  shop {
88
94
  metafield(namespace: "$app", key: "custom_css") {
@@ -90,7 +96,7 @@
90
96
  }
91
97
  }
92
98
  }
93
- `,pe=`#graphql
99
+ `,xe=`#graphql
94
100
  query BundlesForProduct($handle: String!) {
95
101
  product(handle: $handle) {
96
102
  id
@@ -122,6 +128,8 @@
122
128
  availableForSale
123
129
  price { amount currencyCode }
124
130
  compareAtPrice { amount currencyCode }
131
+ unitPrice { amount currencyCode }
132
+ unitPriceMeasurement { referenceValue referenceUnit }
125
133
  selectedOptions { name value }
126
134
  }
127
135
  }
@@ -145,6 +153,8 @@
145
153
  availableForSale
146
154
  price { amount currencyCode }
147
155
  compareAtPrice { amount currencyCode }
156
+ unitPrice { amount currencyCode }
157
+ unitPriceMeasurement { referenceValue referenceUnit }
148
158
  selectedOptions { name value }
149
159
  }
150
160
  }
@@ -170,6 +180,8 @@
170
180
  availableForSale
171
181
  price { amount currencyCode }
172
182
  compareAtPrice { amount currencyCode }
183
+ unitPrice { amount currencyCode }
184
+ unitPriceMeasurement { referenceValue referenceUnit }
173
185
  selectedOptions { name value }
174
186
  }
175
187
  }
@@ -185,42 +197,42 @@
185
197
  }
186
198
  }
187
199
  }
188
- `,be=`#graphql
200
+ `,Ce=`#graphql
189
201
  mutation CartCreate($input: CartInput!) {
190
202
  cartCreate(input: $input) {
191
203
  cart { id checkoutUrl }
192
204
  userErrors { field message }
193
205
  }
194
206
  }
195
- `,he=`#graphql
207
+ `,ye=`#graphql
196
208
  mutation CartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) {
197
209
  cartLinesAdd(cartId: $cartId, lines: $lines) {
198
210
  cart { id checkoutUrl }
199
211
  userErrors { field message }
200
212
  }
201
213
  }
202
- `,U=class extends Error{constructor(e,t){super(e),this.reason=t,this.name="BundleParseError"}},D={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,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,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 Qe(e){if(!e||typeof e!="object")return D;let t=e;return{...D,...t,defaultTier:Ye(t.defaultTier),header:{...D.header,...t.header??{}},layout:{...D.layout,...t.layout??{}},productList:{...D.productList,...t.productList??{}},pricing:{...D.pricing,...t.pricing??{}},cta:{...D.cta,...t.cta??{}},savingsBar:{...D.savingsBar,...t.savingsBar??{}},countdown:{...D.countdown,...t.countdown??{}},popularBadge:{...D.popularBadge,...t.popularBadge??{}}}}function Ye(e){return e==="first"||e==="best_value"||typeof e=="number"&&Number.isInteger(e)&&e>=0?e:D.defaultTier}function Ke(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,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,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 Xe={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"},Je=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 me(e,t){let n=Ke(t);for(let[i,r]of Object.entries(Xe)){let a=n[i];if(a==null)continue;let o=Je.has(i)?`${a}px`:String(a);e.style.setProperty(r,o)}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"),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})`)}var Ze=new Set(["fixed","mix_match","volume"]),et=new Set(["active"]);function X(e,t){try{return tt(e,t)}catch(n){if(n instanceof U)return null;throw n}}function tt(e,t){let n=new Map(t.map(v=>[v.key,v])),i=n.get("title")?.value??"Bundle",r=n.get("bundle_type")?.value,a=n.get("status")?.value;if(!r||!Ze.has(r))throw new U(`Invalid or missing bundle_type: ${r??"null"}`,"invalid_type");let o=r;if(!a||!et.has(a))throw new U(`Bundle is not active: status=${a??"null"}`,"inactive");let d=a,l=n.get("starts_at")?.value??null,u=n.get("ends_at")?.value??null,c=new Date;if(l){let v=new Date(l);if(Number.isNaN(v.getTime()))throw new U(`Invalid starts_at: ${l}`,"invalid_type");if(v>c)throw new U(`Bundle not yet started: starts_at=${l}`,"not_started")}if(u){let v=new Date(u);if(Number.isNaN(v.getTime()))throw new U(`Invalid ends_at: ${u}`,"invalid_type");if(v<c)throw new U(`Bundle has expired: ends_at=${u}`,"expired")}let p=rt(n),f=nt(n),h=it(n),m={id:e,title:i,description:n.get("description")?.value||null,status:d,products:p,discountConfig:f,widgetConfig:h,startsAt:l,endsAt:u,discountLabel:n.get("discount_label")?.value??null,selectedVariantIds:ot(n),productQuantities:oe(n,"product_quantities"),variantQuantities:oe(n,"variant_quantities"),abTestId:n.get("ab_test_id")?.value??null,abVariantB:at(n)};switch(o){case"fixed":return{...m,bundleType:"fixed"};case"volume":return{...m,bundleType:"volume",volumeTiers:lt(n)};case"mix_match":return{...m,bundleType:"mix_match",minQuantity:ae(n,"min_quantity",{min:1}),maxQuantity:ae(n,"max_quantity",{min:1})}}}function rt(e){let t=[],n=e.get("products");if(n?.reference&&"variants"in n.reference&&t.push(n.reference),n?.references?.nodes)for(let r of n.references.nodes)"variants"in r?t.push(r):"products"in r&&r.products?.nodes&&t.push(...r.products.nodes);let i=e.get("collection");if(i?.references?.nodes)for(let r of i.references.nodes)"products"in r&&r.products?.nodes&&t.push(...r.products.nodes);return t}function nt(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 it(e){return Qe(z(e,"widget_config"))}function ot(e){let t=z(e,"selected_variant_ids");if(!Array.isArray(t))return null;let n=[];for(let i of t)Array.isArray(i)?n.push(i.filter(r=>typeof r=="string")):n.push([]);return n}function oe(e,t){let n=z(e,t);if(!n||typeof n!="object"||Array.isArray(n))return{};let i={};for(let[r,a]of Object.entries(n)){let o=typeof a=="number"?a:Number(a);Number.isFinite(o)&&o>=0&&o<=99&&(i[r]=Math.floor(o))}return i}function at(e){if(!e.get("ab_test_id")?.value)return null;let n={},i=e.get("ab_title")?.value;i&&(n.title=i);let r=e.get("ab_description")?.value;r&&(n.description=r);let a=e.get("ab_discount_type")?.value,o=e.get("ab_discount_value")?.value;if(a&&(a==="percentage"||a==="fixed_amount")&&o){let l=parseFloat(o);Number.isFinite(l)&&(n.discountConfig={discountType:a,discountValue:l,allowStacking:e.get("allow_stacking")?.value==="true"})}let d=z(e,"ab_volume_tiers");return Array.isArray(d)&&(n.volumeTiers=d.filter(l=>typeof l=="object"&&l!==null).map(ge)),Object.keys(n).length===0?null:n}function lt(e){let t=z(e,"volume_tiers");return Array.isArray(t)?t.filter(n=>typeof n=="object"&&n!==null).map(ge):[]}function ge(e){let t=Number(e.minQuantity??0),n={minQuantity:Number.isFinite(t)&&t>=0?t:0};return typeof e.percentage=="number"&&Number.isFinite(e.percentage)&&(n.percentage=e.percentage),typeof e.amount=="number"&&Number.isFinite(e.amount)&&(n.amount=e.amount),n}function z(e,t){let n=e.get(t)?.value;if(!n)return null;try{return JSON.parse(n)}catch{return null}}function ae(e,t,n={}){let i=e.get(t)?.value;if(!i)return null;let r=parseInt(i,10);return isNaN(r)||n.min!==void 0&&r<n.min?null:r}function J(e,t,n){let i=e.variantQuantities[n];return i!==void 0?i:e.productQuantities[t]??1}function fe(e){let t=e.abVariantB;if(!t)return e;let n=t.title??e.title,i=t.description!==void 0?t.description:e.description,r=t.discountConfig??e.discountConfig;switch(e.bundleType){case"volume":return{...e,title:n,description:i,discountConfig:r,volumeTiers:t.volumeTiers??e.volumeTiers};case"mix_match":return{...e,title:n,description:i,discountConfig:r};case"fixed":return{...e,title:n,description:i,discountConfig:r}}}async function ve(e,t){await ye(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 xe(e,t){await ye(e,{shopDomain:e.shopDomain,eventType:"bundle_add_to_cart",...t,occurredAt:new Date().toISOString()})}function Ce(e,t){if(typeof IntersectionObserver>"u")return t(),()=>{};let n=new IntersectionObserver(i=>{for(let r of i)r.isIntersecting&&(t(),n.unobserve(r.target))},{threshold:.5});return n.observe(e),()=>n.disconnect()}async function ye(e,t){let n=`${e.appUrl}/api/analytics`,i=JSON.stringify(t);try{(await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:i})).ok||(await new Promise(a=>setTimeout(a,2e3)),await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:i}))}catch{try{typeof navigator<"u"&&navigator.sendBeacon&&navigator.sendBeacon(n,i)}catch{}}}var dt=!1;function st(){if(dt)return!0;if(typeof window>"u")return!1;let e=window.Shopify;try{return e?.customerPrivacy?.analyticsProcessingAllowed?.()===!0}catch{return!1}}var le="lb_session",ct=720*60*60,ut=720*60*60;function we(e){return`__Host-_lb_ab_${e}`}async function _e(e,t,n,i){if(typeof document>"u")return null;let r=pt(i);if(r&&r.testId===n)return{variant:r.variant,testId:n,persisted:!0};if(!st())return{variant:"A",testId:n,persisted:!1};let a=ht(),o=mt(a,n);bt(i,n,o);try{fetch(`${e}/api/ab-assign`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({shopDomain:t,testId:n,sessionId:a,variant:o})}).catch(()=>{})}catch{}return{variant:o,testId:n,persisted:!0}}function pt(e){if(typeof document>"u")return null;let n=`${we(e)}=`,r=document.cookie.split(";").map(l=>l.trim()).find(l=>l.startsWith(n));if(!r)return null;let a=r.substring(n.length),[o,d]=a.split("|");return o!=="A"&&o!=="B"||!d?null:{testId:d,variant:o}}function bt(e,t,n){if(typeof document>"u")return;let i=we(e),r=`${n}|${t}|${Date.now()}`;document.cookie=`${i}=${r}; Path=/; Max-Age=${ut}; SameSite=Lax; Secure`}function ht(){if(typeof document>"u")return de();let t=document.cookie.split(";").map(i=>i.trim()).find(i=>i.startsWith(`${le}=`))?.split("=")[1];if(t)return t;let n=de();return document.cookie=`${le}=${n}; path=/; max-age=${ct}; SameSite=Lax; Secure`,n}function de(){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 mt(e,t){let n=e+":"+t,i=2166136261;for(let r=0;r<n.length;r++)i^=n.charCodeAt(r),i=Math.imul(i,16777619);return(i>>>0)%2===0?"A":"B"}var se=1e4,gt=[[/@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"]],ft=/^(https:|\/[^/]|\.\/|\.\.\/|#)/;function Z(e){if(e.length>se)return{ok:!1,error:`CSS exceeds ${se.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,(r,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[r,a]of gt)if(r.test(t))return{ok:!1,error:`CSS contains blocked pattern: ${a}`};let n=/url\s*\(\s*([\s\S]*?)\s*\)/gi,i;for(;(i=n.exec(t))!==null;){let r=i[1].trim();if((r.startsWith("'")||r.startsWith('"'))&&(r=r.slice(1)),(r.endsWith("'")||r.endsWith('"'))&&(r=r.slice(0,-1)),r=r.trim(),r&&!ft.test(r))return{ok:!1,error:"CSS url() values must use https:// or relative paths"}}return{ok:!0,css:t}}var vt="lb-custom-css-";function Be(e,t){if(typeof document>"u"||!t)return!1;let n=Z(t);if(!n.ok||!n.css.trim())return!1;let i=vt+xt(e),r=document.getElementById(i);return r||(r=document.createElement("style"),r.id=i,r.setAttribute("data-lime-bundles","custom-css"),document.head.appendChild(r)),r.textContent!==n.css&&(r.textContent=n.css),!0}function xt(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16)}function P(e){if(e==null)return 0;let t=typeof e=="string"?parseFloat(e):e;return Number.isFinite(t)?Math.round(t*100):0}function _(e,t){try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t}).format(e/100)}catch{return`${t} ${(e/100).toFixed(2)}`}}function ke(e,t){return Math.max(0,e-Math.floor(e*t/100))}function ee(e,t=e.productQuantities,n=e.widgetConfig.pricing.showSaveBadge){let{discountType:i,discountValue:r}=e.discountConfig,a=[],o=0,d=0;for(let p of e.products){let f=p.variants.nodes.find(C=>C.availableForSale)??p.variants.nodes[0];if(!f)continue;let h=P(f.price.amount),m=t[p.id]??1,v=h*m,T=f.compareAtPrice?P(f.compareAtPrice.amount):null;if(a.push({unitCents:h,qty:m,lineCents:v,compareCents:T}),o+=v,i==="percentage"){let C=ke(h,r);d+=C*m}else d+=v}i==="fixed_amount"&&(d=Math.max(0,o-Math.round(r*100)));let l=Math.max(0,o-d),u=e.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",c="";return n&&l>0&&(i==="percentage"&&r>0?c=`-${Math.round(r)}%`:i==="fixed_amount"&&r>0&&(c=`-${_(Math.round(r*100),u)}`)),{rows:a,totalCents:o,saleCents:d,savingsCents:l,headerBadge:c,currency:u}}function Q(e,t){if(t.discountType==="percentage"){let n=Math.floor(e*t.discountValue/100);return Math.max(0,e-n)}return Math.max(0,e-Math.round(t.discountValue*100))}var L=152;function O(e,t={}){if(!e)return"";try{let n=new URL(e);return t.width!==void 0&&n.searchParams.set("width",String(t.width)),t.height!==void 0&&n.searchParams.set("height",String(t.height)),t.crop&&n.searchParams.set("crop",t.crop),n.toString()}catch{return e}}function Se(e){if(!Number.isFinite(e)||e<=0)return"";let t=Math.floor(e/1e3),n=Math.floor(t/86400),i=Math.floor(t%86400/3600),r=Math.floor(t%3600/60),a=t%60,o=d=>String(d).padStart(2,"0");return n>0?`${n}d ${o(i)}h ${o(r)}m ${o(a)}s`:`${o(i)}h ${o(r)}m ${o(a)}s`}function H(e){let t=Ct(e);if(t===null||t<=Date.now())return null;let n=t,i=document.createElement("div");i.className="lb-bundle-countdown",i.setAttribute("data-countdown","");let r=document.createElement("div");r.className="lb-bundle-countdown__label";let a=document.createElement("span");a.textContent="Ends in",r.appendChild(a),i.appendChild(r);let o=document.createElement("span");o.className="lb-bundle-countdown__timer",o.setAttribute("data-countdown-timer",""),i.appendChild(o);let d=null;function l(){let c=n-Date.now();if(c<=0){i.style.display="none",u();return}o.textContent=Se(c)}function u(){d!==null&&(clearInterval(d),d=null)}return l(),d=setInterval(l,1e3),{el:i,stop:u}}function Ct(e){let t=Date.parse(e);return Number.isFinite(t)?t:null}function $(e){let t=document.createElement("button");t.type="button",t.className="lb-bundle-cta",t.setAttribute("data-add-bundle","");let n=document.createElement("span");n.className="lb-cta-label",n.setAttribute("data-cta-label",""),n.textContent=e,t.appendChild(n);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 te(e,t){let n=e.querySelector("[data-cta-label]");n&&(n.textContent=t)}function s(e,t,n={}){let i=document.createElement(e);t&&(i.className=t);for(let[r,a]of Object.entries(n))i.setAttribute(r,a);return i}var yt=`
214
+ `,W=class extends Error{constructor(e,t){super(e),this.reason=t,this.name="BundleParseError"}},F={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 rt(e){if(!e||typeof e!="object")return F;let t=e;return{...F,...t,defaultTier:it(t.defaultTier),header:{...F.header,...t.header??{}},layout:{...F.layout,...t.layout??{}},productList:{...F.productList,...t.productList??{}},pricing:{...F.pricing,...t.pricing??{}},cta:{...F.cta,...t.cta??{}},savingsBar:{...F.savingsBar,...t.savingsBar??{}},countdown:{...F.countdown,...t.countdown??{}},popularBadge:{...F.popularBadge,...t.popularBadge??{}}}}function it(e){return e==="first"||e==="best_value"||typeof e=="number"&&Number.isInteger(e)&&e>=0?e:F.defaultTier}function nt(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 ot={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"},at=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 we(e,t){let r=nt(t);for(let[a,o]of Object.entries(ot)){let l=r[a];if(l==null)continue;let d=at.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"),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 n=ue(t.productList.thumbnailRatio);e.style.setProperty("--lb-thumbnail-aspect-ratio",n.aspectRatio),e.style.setProperty("--lb-thumbnail-img-fit",n.imgFit),e.style.setProperty("--lb-thumbnail-img-height",n.imgHeight);let i=ue(t.pickerThumbnailRatio);e.style.setProperty("--lb-picker-thumbnail-aspect-ratio",i.aspectRatio),e.style.setProperty("--lb-picker-thumbnail-img-fit",i.imgFit),e.style.setProperty("--lb-picker-thumbnail-img-height",i.imgHeight)}function ue(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 lt=new Set(["fixed","mix_match","volume"]),dt=new Set(["active"]);function te(e,t){try{return st(e,t)}catch(r){if(r instanceof W)return null;throw r}}function st(e,t){let r=new Map(t.map(v=>[v.key,v])),n=r.get("title")?.value??"Bundle",i=r.get("bundle_type")?.value,a=r.get("status")?.value;if(!i||!lt.has(i))throw new W(`Invalid or missing bundle_type: ${i??"null"}`,"invalid_type");let o=i;if(!a||!dt.has(a))throw new W(`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,c=new Date;if(d){let v=new Date(d);if(Number.isNaN(v.getTime()))throw new W(`Invalid starts_at: ${d}`,"invalid_type");if(v>c)throw new W(`Bundle not yet started: starts_at=${d}`,"not_started")}if(u){let v=new Date(u);if(Number.isNaN(v.getTime()))throw new W(`Invalid ends_at: ${u}`,"invalid_type");if(v<c)throw new W(`Bundle has expired: ends_at=${u}`,"expired")}let p=ct(r),g=ut(r),w=pt(r),b={id:e,title:n,description:r.get("description")?.value||null,status:l,products:p,discountConfig:g,widgetConfig:w,startsAt:d,endsAt:u,discountLabel:r.get("discount_label")?.value??null,selectedVariantIds:bt(r),productQuantities:pe(r,"product_quantities"),variantQuantities:pe(r,"variant_quantities"),abTestId:r.get("ab_test_id")?.value??null,abVariantB:ht(r)};switch(o){case"fixed":return{...b,bundleType:"fixed"};case"volume":return{...b,bundleType:"volume",volumeTiers:mt(r)};case"mix_match":return{...b,bundleType:"mix_match",minQuantity:be(r,"min_quantity",{min:1}),maxQuantity:be(r,"max_quantity",{min:1})}}}function ct(e){let t=[],r=e.get("products");if(r?.reference&&"variants"in r.reference&&t.push(r.reference),r?.references?.nodes)for(let i of r.references.nodes)"variants"in i?t.push(i):"products"in i&&i.products?.nodes&&t.push(...i.products.nodes);let n=e.get("collection");if(n?.references?.nodes)for(let i of n.references.nodes)"products"in i&&i.products?.nodes&&t.push(...i.products.nodes);return t}function ut(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 pt(e){return rt(Q(e,"widget_config"))}function bt(e){let t=Q(e,"selected_variant_ids");if(!Array.isArray(t))return null;let r=[];for(let n of t)Array.isArray(n)?r.push(n.filter(i=>typeof i=="string")):r.push([]);return r}function pe(e,t){let r=Q(e,t);if(!r||typeof r!="object"||Array.isArray(r))return{};let n={};for(let[i,a]of Object.entries(r)){let o=typeof a=="number"?a:Number(a);Number.isFinite(o)&&o>=0&&o<=99&&(n[i]=Math.floor(o))}return n}function ht(e){if(!e.get("ab_test_id")?.value)return null;let r={},n=e.get("ab_title")?.value;n&&(r.title=n);let i=e.get("ab_description")?.value;i&&(r.description=i);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=Q(e,"ab_volume_tiers");return Array.isArray(l)&&(r.volumeTiers=l.filter(d=>typeof d=="object"&&d!==null).map(_e)),Object.keys(r).length===0?null:r}function mt(e){let t=Q(e,"volume_tiers");return Array.isArray(t)?t.filter(r=>typeof r=="object"&&r!==null).map(_e):[]}function _e(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 Q(e,t){let r=e.get(t)?.value;if(!r)return null;try{return JSON.parse(r)}catch{return null}}function be(e,t,r={}){let n=e.get(t)?.value;if(!n)return null;let i=parseInt(n,10);return isNaN(i)||r.min!==void 0&&i<r.min?null:i}function re(e,t,r){let n=e.variantQuantities[r];return n!==void 0?n:e.productQuantities[t]??1}function Be(e){let t=e.abVariantB;if(!t)return e;let r=t.title??e.title,n=t.description!==void 0?t.description:e.description,i=t.discountConfig??e.discountConfig;switch(e.bundleType){case"volume":return{...e,title:r,description:n,discountConfig:i,volumeTiers:t.volumeTiers??e.volumeTiers};case"mix_match":return{...e,title:r,description:n,discountConfig:i};case"fixed":return{...e,title:r,description:n,discountConfig:i}}}async function ke(e,t){await Ae(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 Se(e,t){await Ae(e,{shopDomain:e.shopDomain,eventType:"bundle_add_to_cart",...t,occurredAt:new Date().toISOString()})}function Te(e,t){if(typeof IntersectionObserver>"u")return t(),()=>{};let r=new IntersectionObserver(n=>{for(let i of n)i.isIntersecting&&(t(),r.unobserve(i.target))},{threshold:.5});return r.observe(e),()=>r.disconnect()}async function Ae(e,t){let r=`${e.appUrl}/api/analytics`,n=JSON.stringify(t);try{(await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:n})).ok||(await new Promise(a=>setTimeout(a,2e3)),await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:n}))}catch{try{typeof navigator<"u"&&navigator.sendBeacon&&navigator.sendBeacon(r,n)}catch{}}}var gt=!1;function ft(){if(gt)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",vt=720*60*60,xt=720*60*60;function Ee(e){return`__Host-_lb_ab_${e}`}async function Pe(e,t,r,n){if(typeof document>"u")return null;let i=Ct(n);if(i&&i.testId===r)return{variant:i.variant,testId:r,persisted:!0};if(!ft())return{variant:"A",testId:r,persisted:!1};let a=wt(),o=_t(a,r);yt(n,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 Ct(e){if(typeof document>"u")return null;let r=`${Ee(e)}=`,i=document.cookie.split(";").map(d=>d.trim()).find(d=>d.startsWith(r));if(!i)return null;let a=i.substring(r.length),[o,l]=a.split("|");return o!=="A"&&o!=="B"||!l?null:{testId:l,variant:o}}function yt(e,t,r){if(typeof document>"u")return;let n=Ee(e),i=`${r}|${t}|${Date.now()}`;document.cookie=`${n}=${i}; Path=/; Max-Age=${xt}; SameSite=Lax; Secure`}function wt(){if(typeof document>"u")return me();let t=document.cookie.split(";").map(n=>n.trim()).find(n=>n.startsWith(`${he}=`))?.split("=")[1];if(t)return t;let r=me();return document.cookie=`${he}=${r}; path=/; max-age=${vt}; SameSite=Lax; Secure`,r}function me(){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 _t(e,t){let r=e+":"+t,n=2166136261;for(let i=0;i<r.length;i++)n^=r.charCodeAt(i),n=Math.imul(n,16777619);return(n>>>0)%2===0?"A":"B"}var ge=1e4,Bt=[[/@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"]],kt=/^(https:|\/[^/]|\.\/|\.\.\/|#)/;function ie(e){if(e.length>ge)return{ok:!1,error:`CSS exceeds ${ge.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,(i,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[i,a]of Bt)if(i.test(t))return{ok:!1,error:`CSS contains blocked pattern: ${a}`};let r=/url\s*\(\s*([\s\S]*?)\s*\)/gi,n;for(;(n=r.exec(t))!==null;){let i=n[1].trim();if((i.startsWith("'")||i.startsWith('"'))&&(i=i.slice(1)),(i.endsWith("'")||i.endsWith('"'))&&(i=i.slice(0,-1)),i=i.trim(),i&&!kt.test(i))return{ok:!1,error:"CSS url() values must use https:// or relative paths"}}return{ok:!0,css:t}}var St="lb-custom-css-";function Le(e,t){if(typeof document>"u"||!t)return!1;let r=ie(t);if(!r.ok||!r.css.trim())return!1;let n=St+Tt(e),i=document.getElementById(n);return i||(i=document.createElement("style"),i.id=n,i.setAttribute("data-lime-bundles","custom-css"),document.head.appendChild(i)),i.textContent!==r.css&&(i.textContent=r.css),!0}function Tt(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 At(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 Et={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 U(e,t,r){if(!e||!t||t.referenceUnit==="UNKNOWN")return null;let n=parseFloat(e.amount);if(!Number.isFinite(n))return null;let i=Et[t.referenceUnit]??"";if(!i)return null;let a=e.currencyCode||r||"USD",o=At(n,a),l=t.referenceValue,d=l===1?i:`${l}${i}`;return`${o}/${d}`}function P(e){if(e==null)return 0;let t=typeof e=="string"?parseFloat(e):e;return Number.isFinite(t)?Math.round(t*100):0}function k(e,t){try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t}).format(e/100)}catch{return`${t} ${(e/100).toFixed(2)}`}}function Me(e,t){return Math.max(0,e-Math.floor(e*t/100))}function ne(e,t=e.productQuantities,r=e.widgetConfig.pricing.showSaveBadge){let{discountType:n,discountValue:i}=e.discountConfig,a=[],o=0,l=0;for(let p of e.products){let g=p.variants.nodes.find(x=>x.availableForSale)??p.variants.nodes[0];if(!g)continue;let w=P(g.price.amount),b=t[p.id]??1,v=w*b,B=g.compareAtPrice?P(g.compareAtPrice.amount):null;if(a.push({unitCents:w,qty:b,lineCents:v,compareCents:B}),o+=v,n==="percentage"){let x=Me(w,i);l+=x*b}else l+=v}n==="fixed_amount"&&(l=Math.max(0,o-Math.round(i*100)));let d=Math.max(0,o-l),u=e.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",c="";return r&&d>0&&(n==="percentage"&&i>0?c=`-${Math.round(i)}%`:n==="fixed_amount"&&i>0&&(c=`-${k(Math.round(i*100),u)}`)),{rows:a,totalCents:o,saleCents:l,savingsCents:d,headerBadge:c,currency:u}}function Y(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 L=152;function N(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 Re(e){if(!Number.isFinite(e)||e<=0)return"";let t=Math.floor(e/1e3),r=Math.floor(t/86400),n=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),a=t%60,o=l=>String(l).padStart(2,"0");return r>0?`${r}d ${o(n)}h ${o(i)}m ${o(a)}s`:`${o(n)}h ${o(i)}m ${o(a)}s`}function z(e){let t=Pt(e);if(t===null||t<=Date.now())return null;let r=t,n=document.createElement("div");n.className="lb-bundle-countdown",n.setAttribute("data-countdown","");let i=document.createElement("div");i.className="lb-bundle-countdown__label";let a=document.createElement("span");a.textContent="Ends in",i.appendChild(a),n.appendChild(i);let o=document.createElement("span");o.className="lb-bundle-countdown__timer",o.setAttribute("data-countdown-timer",""),n.appendChild(o);let l=null;function d(){let c=r-Date.now();if(c<=0){n.style.display="none",u();return}o.textContent=Re(c)}function u(){l!==null&&(clearInterval(l),l=null)}return d(),l=setInterval(d,1e3),{el:n,stop:u}}function Pt(e){let t=Date.parse(e);return Number.isFinite(t)?t:null}function j(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 n=document.createElement("span");return n.className="lb-cta-spinner",n.setAttribute("data-cta-spinner",""),n.setAttribute("aria-hidden","true"),n.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(n),t}function oe(e,t){let r=e.querySelector("[data-cta-label]");r&&(r.textContent=t)}function s(e,t,r={}){let n=document.createElement(e);t&&(n.className=t);for(let[i,a]of Object.entries(r))n.setAttribute(i,a);return n}var Lt=`
203
215
  <svg class="lb-bundle-placeholder-icon" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
204
216
  <rect x="4" y="4" width="20" height="20" rx="3"></rect>
205
217
  <line x1="4" y1="20" x2="24" y2="20"></line>
206
218
  <circle cx="10" cy="12" r="2"></circle>
207
- </svg>`;function Te(e,t,n,i){let r=t.widgetConfig,a=(C,k)=>J(t,C,k),o=[],d=0;if(t.products.forEach((C,k)=>{let A=wt(t,C,k);A.qty!==0&&(A.isOos&&(d++,r.outOfStockBehavior==="hide")||o.push(A))}),o.length===0)return;let l=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)}),c=_t(t,l);if(u.appendChild(c.el),r.countdown.showCountdown&&t.endsAt){let C=H(t.endsAt);C&&(u.appendChild(C.el),i?.(C.stop))}let p=s("div","lb-fixed__products"),f=[];o.forEach(C=>{let k=kt(C,l,a,()=>{T()});f.push(k),p.appendChild(k.el)}),u.appendChild(p),u.appendChild(s("div","lb-bundle-divider"));let h=St(t);u.appendChild(h.el);let m=r.savingsBar.visible?Tt():null;m&&u.appendChild(m.el);let v=At(t,d,()=>{let C=o.filter(k=>k.selected).map(k=>({merchandiseId:k.selected.id,quantity:k.qty,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}));C.length!==0&&n(C)});u.appendChild(v),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),T();function T(){let C=o.reduce((b,B)=>{if(!B.selected)return b;let y=P(B.selected.price.amount);return b+y*B.qty},0),k=Et(C,t.discountConfig,o),A=Math.max(0,C-k);h.update({totalCents:C,saleCents:k,savingsCents:A,currency:l}),m&&m.update({savingsCents:A,currency:l}),c.refresh(Bt(t,C,k,l))}}function wt(e,t,n){let i=e.selectedVariantIds?.[n]??null,r=t.variants.nodes.filter(u=>u.availableForSale),a=i&&i.length>0?r.filter(u=>i.includes(u.id)):r,o=a.length===0,d=a[0]??null,l=d?J(e,t.id,d.id):1;return{product:t,eligibleVariants:a,selected:d,qty:l,isOos:o}}function _t(e,t){let n=e.widgetConfig,i=s("div","lb-bundle-header"),r=s("div","lb-bundle-header__content"),a=s("h3","lb-bundle-title");if(a.textContent=e.title,r.appendChild(a),e.description){let l=s("p","lb-bundle-subtitle");l.textContent=e.description,r.appendChild(l)}i.appendChild(r);let o=s("span","lb-bundle-header__badge",{"data-header-badge":""});i.appendChild(o);let d=ee(e,e.productQuantities,n.pricing.showSaveBadge);return d.headerBadge?o.textContent=d.headerBadge:o.style.display="none",{el:i,refresh(l){if(!n.pricing.showSaveBadge){o.style.display="none";return}l?(o.textContent=l,o.style.display=""):o.style.display="none"}}}function Bt(e,t,n,i){if(!e.widgetConfig.pricing.showSaveBadge)return"";let r=t-n;if(r<=0)return"";let a=e.discountConfig;return a.discountType==="percentage"&&a.discountValue>0?`-${Math.round(a.discountValue)}%`:a.discountType==="fixed_amount"&&a.discountValue>0?`-${_(Math.round(a.discountValue*100),i)}`:`-${_(r,i)}`}function kt(e,t,n,i){let r=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"}:{}}),a=s("div","lb-bundle-thumbnail",{"data-thumbnail":""});if(e.product.featuredImage){let u=document.createElement("img");u.src=O(e.product.featuredImage.url,{width:L,height:L,crop:"center"}),u.alt=e.product.featuredImage.altText??e.product.title,u.width=L,u.height=L,u.loading="lazy",a.appendChild(u)}else a.insertAdjacentHTML("beforeend",yt);let o=null;e.isOos||(o=s("span","lb-bundle-qty-badge",{"data-qty-badge":""}),o.textContent=String(e.qty),a.appendChild(o)),r.appendChild(a);let d=s("div","lb-bundle-product-info"),l=document.createElement("a");if(l.className="lb-bundle-product-name",l.href=`/products/${e.product.handle}`,l.textContent=e.product.title,d.appendChild(l),e.isOos){let u=s("span","lb-bundle-oos-label");u.textContent="Out of stock",d.appendChild(u)}else if(e.selected){let u=s("span","lb-bundle-product-prices"),c=s("span","lb-bundle-product-compare-price",{"data-product-compare-price":""}),p=s("span","lb-bundle-product-price",{"data-product-price":""});u.appendChild(c),u.appendChild(p),d.appendChild(u);let f=h=>{let m=P(h.price.amount);if(p.textContent=_(m,t),h.compareAtPrice){let v=P(h.compareAtPrice.amount);v>m?(c.textContent=_(v,t),c.removeAttribute("hidden")):c.setAttribute("hidden","")}else c.setAttribute("hidden","")};if(f(e.selected),e.eligibleVariants.length>1){let h=document.createElement("select");h.className="lb-bundle-variant-select",h.setAttribute("data-variant-select",""),h.setAttribute("aria-label",`Select variant for ${e.product.title}`),e.eligibleVariants.forEach(m=>{let v=document.createElement("option");v.value=m.id,v.textContent=m.title,m.id===e.selected?.id&&(v.selected=!0),h.appendChild(v)}),h.addEventListener("change",()=>{let m=e.eligibleVariants.find(v=>v.id===h.value);m&&(e.selected=m,e.qty=n(e.product.id,m.id),o&&(o.textContent=String(e.qty)),f(m),i())}),d.appendChild(h)}else if(e.eligibleVariants.length===1&&e.product.variants.nodes.length>1){let h=s("span","lb-bundle-variant-badge");h.textContent=e.eligibleVariants[0].title,d.appendChild(h)}}return r.appendChild(d),{el:r,state:e}}function St(e){let t=s("div","lb-bundle-pricing"),n=s("span","lb-bundle-pricing__label");n.textContent="Bundle price",t.appendChild(n);let i=s("span","lb-bundle-pricing__prices"),r=s("span","lb-bundle-compare-price",{"data-compare-price":""});r.style.display="none",i.appendChild(r);let a=s("span","lb-bundle-sale-price",{"data-sale-price":""});return i.appendChild(a),t.appendChild(i),{el:t,update({totalCents:o,saleCents:d,savingsCents:l,currency:u}){a.textContent=_(d,u),e.widgetConfig.pricing.showCompareAtPrice&&l>0?(r.textContent=_(o,u),r.style.display=""):r.style.display="none"}}}function Tt(){let e=s("div","lb-bundle-savings-bar",{"data-savings-bar":""}),t=document.createElement("span");t.textContent="You save",e.appendChild(t);let n=s("span","",{"data-savings-amount":""});return e.appendChild(n),{el:e,update({savingsCents:i,currency:r}){if(i<=0){e.style.display="none";return}e.style.display="",n.textContent=_(i,r)}}}function At(e,t,n){let i=t>0?`${t} item${t===1?"":"s"} out of stock`:e.widgetConfig.cta.ctaText||"Add to cart",r=$(i);return t>0?r.disabled=!0:r.addEventListener("click",()=>{r.disabled||n()}),r}function Et(e,t,n){if(t.discountType==="percentage"){let i=0;for(let r of n){if(!r.selected)continue;let a=P(r.selected.price.amount),o=Math.floor(a*t.discountValue/100),d=Math.max(0,a-o);i+=d*r.qty}return i}return Math.max(0,e-Math.round(t.discountValue*100))}var Ee=`
219
+ </svg>`;function Ie(e,t,r,n){let i=t.widgetConfig,a=(x,T)=>re(t,x,T),o=[],l=0;if(t.products.forEach((x,T)=>{let E=Mt(t,x,T);E.qty!==0&&(E.isOos&&(l++,i.outOfStockBehavior==="hide")||o.push(E))}),o.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)}),c=Rt(t,d);if(u.appendChild(c.el),i.countdown.showCountdown&&t.endsAt){let x=z(t.endsAt);x&&(u.appendChild(x.el),n?.(x.stop))}let p=s("div","lb-fixed__products"),g=[];o.forEach(x=>{let T=Ft(x,d,a,()=>{B()});g.push(T),p.appendChild(T.el)}),u.appendChild(p),u.appendChild(s("div","lb-bundle-divider"));let w=Vt(t);u.appendChild(w.el);let b=i.savingsBar.visible?Dt():null;b&&u.appendChild(b.el);let v=Ut(t,l,()=>{let x=o.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}]}));x.length!==0&&r(x)});u.appendChild(v),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),B();function B(){let x=o.reduce((h,S)=>{if(!S.selected)return h;let C=P(S.selected.price.amount);return h+C*S.qty},0),T=Ot(x,t.discountConfig,o),E=Math.max(0,x-T);w.update({totalCents:x,saleCents:T,savingsCents:E,currency:d}),b&&b.update({savingsCents:E,currency:d}),c.refresh(It(t,x,T,d))}}function Mt(e,t,r){let n=e.selectedVariantIds?.[r]??null,i=t.variants.nodes.filter(u=>u.availableForSale),a=n&&n.length>0?i.filter(u=>n.includes(u.id)):i,o=a.length===0,l=a[0]??null,d=l?re(e,t.id,l.id):1;return{product:t,eligibleVariants:a,selected:l,qty:d,isOos:o}}function Rt(e,t){let r=e.widgetConfig,n=s("div","lb-bundle-header"),i=s("div","lb-bundle-header__content"),a=s("h3","lb-bundle-title");if(a.textContent=e.title,i.appendChild(a),e.description){let d=s("p","lb-bundle-subtitle");d.textContent=e.description,i.appendChild(d)}n.appendChild(i);let o=s("span","lb-bundle-header__badge",{"data-header-badge":""});n.appendChild(o);let l=ne(e,e.productQuantities,r.pricing.showSaveBadge);return l.headerBadge?o.textContent=l.headerBadge:o.style.display="none",{el:n,refresh(d){if(!r.pricing.showSaveBadge){o.style.display="none";return}d?(o.textContent=d,o.style.display=""):o.style.display="none"}}}function It(e,t,r,n){if(!e.widgetConfig.pricing.showSaveBadge)return"";let i=t-r;if(i<=0)return"";let a=e.discountConfig;return a.discountType==="percentage"&&a.discountValue>0?`-${Math.round(a.discountValue)}%`:a.discountType==="fixed_amount"&&a.discountValue>0?`-${k(Math.round(a.discountValue*100),n)}`:`-${k(i,n)}`}function Ft(e,t,r,n){let i=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"}:{}}),a=s("div","lb-bundle-thumbnail",{"data-thumbnail":""});if(e.product.featuredImage){let u=document.createElement("img");u.src=N(e.product.featuredImage.url,{width:L,height:L,crop:"center"}),u.alt=e.product.featuredImage.altText??e.product.title,u.width=L,u.height=L,u.loading="lazy",a.appendChild(u)}else a.insertAdjacentHTML("beforeend",Lt);let o=null;e.isOos||(o=s("span","lb-bundle-qty-badge",{"data-qty-badge":""}),o.textContent=String(e.qty),a.appendChild(o)),i.appendChild(a);let l=s("div","lb-bundle-product-info"),d=document.createElement("a");if(d.className="lb-bundle-product-name",d.href=`/products/${e.product.handle}`,d.textContent=e.product.title,l.appendChild(d),e.isOos){let u=s("span","lb-bundle-oos-label");u.textContent="Out of stock",l.appendChild(u)}else if(e.selected){let u=s("span","lb-bundle-product-prices"),c=s("span","lb-bundle-product-compare-price",{"data-product-compare-price":""}),p=s("span","lb-bundle-product-price",{"data-product-price":""});u.appendChild(c),u.appendChild(p),l.appendChild(u);let g=s("span","lb-bundle-product-unit-price",{"data-product-unit-price":""});g.setAttribute("hidden",""),l.appendChild(g);let w=b=>{let v=P(b.price.amount);if(p.textContent=k(v,t),b.compareAtPrice){let x=P(b.compareAtPrice.amount);x>v?(c.textContent=k(x,t),c.removeAttribute("hidden")):c.setAttribute("hidden","")}else c.setAttribute("hidden","");let B=U(b.unitPrice,b.unitPriceMeasurement,t);B?(g.textContent=B,g.removeAttribute("hidden")):g.setAttribute("hidden","")};if(w(e.selected),e.eligibleVariants.length>1){let b=document.createElement("select");b.className="lb-bundle-variant-select",b.setAttribute("data-variant-select",""),b.name=`lb-variant-${e.product.id.replace(/^.*\//,"")}`,b.setAttribute("aria-label",`Select variant for ${e.product.title}`),e.eligibleVariants.forEach(v=>{let B=document.createElement("option");B.value=v.id,B.textContent=v.title,v.id===e.selected?.id&&(B.selected=!0),b.appendChild(B)}),b.addEventListener("change",()=>{let v=e.eligibleVariants.find(B=>B.id===b.value);v&&(e.selected=v,e.qty=r(e.product.id,v.id),o&&(o.textContent=String(e.qty)),w(v),n())}),l.appendChild(b)}else 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,l.appendChild(b)}}return i.appendChild(l),{el:i,state:e}}function Vt(e){let t=s("div","lb-bundle-pricing"),r=s("span","lb-bundle-pricing__label");r.textContent="Bundle price",t.appendChild(r);let n=s("span","lb-bundle-pricing__prices"),i=s("span","lb-bundle-compare-price",{"data-compare-price":""});i.style.display="none",n.appendChild(i);let a=s("span","lb-bundle-sale-price",{"data-sale-price":""});return n.appendChild(a),t.appendChild(n),{el:t,update({totalCents:o,saleCents:l,savingsCents:d,currency:u}){a.textContent=k(l,u),e.widgetConfig.pricing.showCompareAtPrice&&d>0?(i.textContent=k(o,u),i.style.display=""):i.style.display="none"}}}function Dt(){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:n,currency:i}){if(n<=0){e.style.display="none";return}e.style.display="",r.textContent=k(n,i)}}}function Ut(e,t,r){let n=t>0?`${t} item${t===1?"":"s"} out of stock`:e.widgetConfig.cta.ctaText||"Add to cart",i=j(n);return t>0?i.disabled=!0:i.addEventListener("click",()=>{i.disabled||r()}),i}function Ot(e,t,r){if(t.discountType==="percentage"){let n=0;for(let i of r){if(!i.selected)continue;let a=P(i.selected.price.amount),o=Math.floor(a*t.discountValue/100),l=Math.max(0,a-o);n+=l*i.qty}return n}return Math.max(0,e-Math.round(t.discountValue*100))}var Ve=`
208
220
  <svg class="lb-bundle-placeholder-icon" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
209
221
  <rect x="4" y="4" width="20" height="20" rx="3"></rect>
210
222
  <line x1="4" y1="20" x2="24" y2="20"></line>
211
223
  <circle cx="10" cy="12" r="2"></circle>
212
- </svg>`,Pe=`
224
+ </svg>`,Ht=`
213
225
  <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
214
226
  <line x1="9" y1="3" x2="9" y2="15" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
215
227
  <line x1="3" y1="9" x2="15" y2="9" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
216
- </svg>`,re=`
228
+ </svg>`,De=`
217
229
  <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
218
230
  <line x1="5" y1="5" x2="15" y2="15" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
219
231
  <line x1="15" y1="5" x2="5" y2="15" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
220
- </svg>`,Pt=`
232
+ </svg>`,$t=`
221
233
  <svg width="16" height="16" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
222
234
  <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"/>
223
- </svg>`;function Le(e,t,n,i){let r=t.widgetConfig,a=t.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",o=t.minQuantity??1,d=t.maxQuantity??o,l=Ut(t,r.outOfStockBehavior);if(l.filter(x=>!x.isOos).length<o)return;let c=[],p=s("div","lb-mix-match",{"data-required-quantity":String(o),"data-max-quantity":String(d)}),f=Lt(t);if(p.appendChild(f),r.countdown.showCountdown&&t.endsAt){let x=H(t.endsAt);x&&(p.appendChild(x.el),i?.(x.stop))}let h=Mt(o);p.appendChild(h.el);let m=s("div","lb-mix-match__slots",{"data-selection-slots":""});p.appendChild(m),p.appendChild(s("div","lb-bundle-divider"));let v=Ft(r.pricing.showCompareAtPrice);p.appendChild(v.el);let T=r.savingsBar.visible?Dt():null;T&&p.appendChild(T.el);let C=s("div","lb-mix-match__price-placeholder",{"data-price-placeholder":""}),k=s("span","lb-mix-match__price-placeholder-text");k.textContent=`Select ${o} items to see price`,C.appendChild(k),p.appendChild(C);let A=Vt(t,l,a,{showSearch:r.showSearch,onAdd:(x,w)=>S(x,w),onRemove:(x,w)=>M(x,w),countFor:(x,w)=>c.filter(F=>F.productId===x&&F.variantId===w).length,isOverMax:()=>c.length>=d});p.appendChild(A.el);let b=$(`Select ${o} items to unlock`);b.disabled=!0,b.addEventListener("click",()=>{if(b.disabled)return;let x=c.map(w=>({merchandiseId:w.variantId,quantity:1,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}));n(x)}),p.appendChild(b),p.appendChild(s("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),p.appendChild(s("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(p);let B=l.find(x=>!x.isOos),y=B?.firstAvailableVariant??B?.variants[0];B&&y&&c.push({productId:B.product.id,productTitle:B.product.title,variantId:y.id,variantTitle:y.title,imageUrl:B.product.featuredImage?.url??null,priceCents:P(y.price.amount),compareCents:y.compareAtPrice?P(y.compareAtPrice.amount):null}),g();function S(x,w){c.length>=d||(c.push({productId:x.id,productTitle:x.title,variantId:w.id,variantTitle:w.title,imageUrl:x.featuredImage?.url??null,priceCents:P(w.price.amount),compareCents:w.compareAtPrice?P(w.compareAtPrice.amount):null}),g())}function M(x,w){let F=c.findIndex(q=>q.productId===x&&q.variantId===w);F!==-1&&(c.splice(F,1),g())}function W(x){x<0||x>=c.length||(c.splice(x,1),g())}function g(){R(),h.update(c.length),v.update(c,t,a),T&&T.update(c,t,a),C.style.display=c.length===0?"":"none",A.refreshCounts(),I()}function R(){m.innerHTML="";let x=Math.max(o,c.length);for(let w=0;w<x;w++){let F=c[w];F?m.appendChild(It(F,w,a,()=>W(w))):m.appendChild(Rt(w,()=>A.open()))}}function I(){let x=c.length;x<o?(b.disabled=!0,te(b,`Select ${o-x} more to unlock`)):(b.disabled=!1,te(b,r.cta.ctaText||"Add to cart"))}}function Lt(e){let t=e.widgetConfig,n=s("div","lb-bundle-header"),i=s("div","lb-bundle-header__content"),r=s("h3","lb-bundle-title");if(r.textContent=e.title,i.appendChild(r),n.appendChild(i),t.pricing.showSaveBadge){let{discountType:a,discountValue:o}=e.discountConfig,d=null;if(a==="percentage"&&o>0?d=`-${Math.round(o)}%`:a==="fixed_amount"&&o>0&&(d=`-${_(Math.round(o*100),e.products[0]?.priceRange.minVariantPrice.currencyCode??"USD")}`),d){let l=s("span","lb-bundle-header__badge");l.textContent=d,n.appendChild(l)}}return n}function Mt(e){let t=s("div","lb-mix-match__progress"),n=s("div","lb-mix-match__progress-labels"),i=s("span","lb-mix-match__progress-count",{"data-progress-count":""});i.textContent=`0 of ${e} selected`,n.appendChild(i);let r=s("span","lb-mix-match__progress-remaining",{"data-progress-remaining":""});r.textContent=`${e} more to go`,n.appendChild(r),t.appendChild(n);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 d(l){let u=Math.min(100,l/e*100);i.textContent=`${l} of ${e} selected`,l>=e?r.textContent="Complete":r.textContent=`${e-l} more to go`,o.style.width=`${u}%`,a.setAttribute("aria-valuenow",String(Math.min(l,e)))}return{el:t,update:d}}function Rt(e,t){let n=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=Pe,n.appendChild(i);let r=s("span","lb-mix-match__empty-text");return r.textContent="Choose an item",n.appendChild(r),n.addEventListener("click",t),n.addEventListener("keydown",a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),t())}),n}function It(e,t,n,i){let r=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 p=document.createElement("img");p.src=O(e.imageUrl,{width:L,height:L,crop:"center"}),p.alt=e.productTitle,p.width=L,p.height=L,p.loading="lazy",a.appendChild(p)}else a.insertAdjacentHTML("beforeend",Ee);r.appendChild(a);let o=s("div","lb-mix-match__filled-info"),d=s("span","lb-mix-match__filled-title");if(d.textContent=e.productTitle,o.appendChild(d),e.variantTitle&&e.variantTitle!=="Default Title"){let p=s("span","lb-mix-match__filled-variant");p.textContent=e.variantTitle,o.appendChild(p)}let l=s("span","lb-mix-match__filled-price");if(e.compareCents&&e.compareCents>e.priceCents){let p=s("span","lb-mix-match__filled-compare");p.textContent=_(e.compareCents,n),l.appendChild(p)}let u=document.createElement("span");u.textContent=_(e.priceCents,n),l.appendChild(u),o.appendChild(l),r.appendChild(o);let c=document.createElement("button");return c.type="button",c.className="lb-mix-match__slot-remove",c.setAttribute("aria-label",`Remove ${e.productTitle}`),c.innerHTML=re,c.addEventListener("click",p=>{p.stopPropagation(),i()}),r.appendChild(c),r}function Ft(e){let t=s("div","lb-bundle-pricing",{"data-pricing-section":""});t.style.display="none";let n=s("span","lb-bundle-pricing__label");n.textContent="Bundle price",t.appendChild(n);let i=s("span","lb-bundle-pricing__prices"),r=s("span","lb-bundle-compare-price",{"data-compare-price":""});e&&i.appendChild(r);let a=s("span","lb-bundle-sale-price",{"data-sale-price":""});i.appendChild(a),t.appendChild(i);function o(d,l,u){if(d.length===0){t.style.display="none";return}t.style.display="";let c=d.reduce((f,h)=>f+h.priceCents,0),p=Q(c,l.discountConfig);e&&c>p?(r.textContent=_(c,u),r.style.display=""):r.style.display="none",a.textContent=_(p,u)}return{el:t,update:o}}function Dt(){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 n=s("span","",{"data-savings-amount":""});e.appendChild(n);function i(r,a,o){if(r.length===0){e.style.display="none";return}let d=r.reduce((c,p)=>c+p.priceCents,0),l=Q(d,a.discountConfig),u=Math.max(0,d-l);if(u<=0){e.style.display="none";return}e.style.display="",n.textContent=_(u,o)}return{el:e,update:i}}function Vt(e,t,n,i){let r=s("div","lb-mix-match__modal-overlay",{"data-modal-overlay":"","data-bundle-gid":e.id});r.style.display="none";let a=s("div","lb-mix-match__modal",{role:"dialog","aria-modal":"true","aria-labelledby":`lb-modal-title-${Ae(e.id)}`,tabindex:"-1"}),o=s("div","lb-mix-match__modal-header"),d=s("h4","lb-mix-match__modal-title",{id:`lb-modal-title-${Ae(e.id)}`});d.textContent="Pick an item",o.appendChild(d);let l=document.createElement("button");l.type="button",l.className="lb-mix-match__modal-close",l.setAttribute("data-modal-close",""),l.setAttribute("aria-label","Close"),l.innerHTML=re,l.addEventListener("click",S),o.appendChild(l),a.appendChild(o);let u=null,c=null;if(i.showSearch){let g=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",()=>k()),g.appendChild(u),c=document.createElement("button"),c.type="button",c.className="lb-mix-match__modal-search-clear",c.setAttribute("data-modal-search-clear",""),c.setAttribute("aria-label","Clear search"),c.style.display="none",c.innerHTML=Pt,c.addEventListener("click",()=>{u&&(u.value="",k(),u.focus())}),g.appendChild(c),a.appendChild(g)}let p=s("div","lb-mix-match__modal-list",{"data-modal-list":""});a.appendChild(p);let f=s("div","lb-mix-match__modal-empty",{"data-modal-empty":""});f.style.display="none";let h=document.createElement("p");h.textContent="No products match your search.",f.appendChild(h),a.appendChild(f);let m=s("span","lb-visually-hidden",{"data-modal-live":"","aria-live":"polite"});a.appendChild(m),r.appendChild(a);let v=!1,T=[];function C(){v||(v=!0,p.innerHTML="",t.forEach(g=>{let R=g.firstAvailableVariant??g.variants[0];if(!R)return;let I=s("div",g.isOos?"lb-mix-match__modal-product lb-mix-match__modal-product--sold-out":"lb-mix-match__modal-product",{"data-product-id":g.product.id.replace(/^.*\//,"")}),x=s("div","lb-mix-match__modal-product-thumb");if(g.product.featuredImage){let E=document.createElement("img");E.src=O(g.product.featuredImage.url,{width:L,height:L,crop:"center"}),E.alt=g.product.featuredImage.altText??g.product.title,E.width=L,E.height=L,E.loading="lazy",x.appendChild(E)}else x.insertAdjacentHTML("beforeend",Ee);I.appendChild(x);let w=s("div","lb-mix-match__modal-product-info"),F=s("span","lb-mix-match__modal-product-title");F.textContent=g.product.title,w.appendChild(F);let q=s("span","lb-mix-match__modal-product-price");if(q.textContent=_(P(R.price.amount),n),w.appendChild(q),g.isOos){let E=s("span","lb-mix-match__modal-sold-out-label");E.textContent="Sold out",w.appendChild(E)}if(I.appendChild(w),g.isOos)T.push({el:I,product:g.product,variant:R,updateCount:()=>{}});else{let E=document.createElement("button");E.type="button",E.className="lb-mix-match__modal-add",E.setAttribute("aria-label",`Add ${g.product.title}`),E.innerHTML=Pe;let N=s("span","lb-bundle-qty-badge");N.style.display="none",E.appendChild(N),E.addEventListener("click",()=>{i.isOverMax()||i.onAdd(g.product,R)}),I.appendChild(E);let V=document.createElement("button");V.type="button",V.className="lb-mix-match__slot-remove",V.setAttribute("aria-label",`Remove one ${g.product.title}`),V.style.display="none",V.innerHTML=re,V.addEventListener("click",G=>{G.stopPropagation(),i.onRemove(g.product.id,R.id)}),I.appendChild(V),T.push({el:I,product:g.product,variant:R,updateCount:()=>{let G=i.countFor(g.product.id,R.id);G>0?(N.textContent=String(G),N.style.display="",V.style.display=""):(N.style.display="none",V.style.display="none")}})}p.appendChild(I)}),W())}function k(){if(!u)return;let g=u.value.trim().toLowerCase();c&&(c.style.display=g?"":"none");let R=0;T.forEach(I=>{let x=!g||I.product.title.toLowerCase().includes(g);I.el.style.display=x?"":"none",x&&R++}),f.style.display=R===0&&g?"":"none"}let A=null;function b(g){if(g.key==="Escape"){g.preventDefault(),S();return}g.key==="Tab"&&Ot(g,a)}let B=!1;function y(){B||i.isOverMax()||(B=!0,C(),A=r.getRootNode().activeElement,r.style.display="",r.classList.add("lb-mix-match__modal-overlay--open"),a.focus(),document.addEventListener("keydown",b),r.addEventListener("click",M))}function S(){B&&(B=!1,r.classList.remove("lb-mix-match__modal-overlay--open"),r.style.display="none",document.removeEventListener("keydown",b),r.removeEventListener("click",M),A instanceof HTMLElement&&A.focus())}function M(g){g.target===r&&S()}function W(){T.forEach(g=>g.updateCount())}return{el:r,open:y,close:S,refreshCounts:W}}function Ut(e,t){let n=[],i=new Set;for(let r of e.products){if(i.has(r.id))continue;i.add(r.id);let a=r.variants.nodes.filter(d=>d.availableForSale),o=a.length===0;o&&t==="hide"||n.push({product:r,variants:r.variants.nodes,firstAvailableVariant:a[0]??null,isOos:o})}return n}function Ot(e,t){let n=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(n.length===0)return;let i=n[0],r=n[n.length-1],a=t.getRootNode().activeElement;e.shiftKey&&a===i?(e.preventDefault(),r.focus()):!e.shiftKey&&a===r&&(e.preventDefault(),i.focus())}function Ae(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function Fe(e,t,n,i){let r=t.widgetConfig,o=t.products[0]?.variants.nodes.find(b=>b.availableForSale);if(!o&&r.outOfStockBehavior==="hide")return;let d=o?P(o.price.amount):0,l=o?.price.currencyCode??"USD",u=t.discountConfig.discountType,c=t.volumeTiers.map((b,B)=>{let y;if(u==="fixed_amount"){let S=Math.round((b.amount??0)*100);y=Math.max(0,d-S)}else{let S=b.percentage??0,M=Math.floor(d*S/100);y=Math.max(0,d-M)}return{tier:b,index:B,qty:b.minQuantity,pricePerUnitCents:y,basePricePerUnitCents:d}}),p=qt(c),f=r.defaultTier==="best_value"?p:0;typeof r.defaultTier=="number"&&(f=Ie(r.defaultTier,0,c.length-1));let h=r.popularBadge.tierIndex!==void 0?Ie(r.popularBadge.tierIndex,0,c.length-1):p,m=s("div","lb-volume");if(m.appendChild(Ht(t,c,f,l,u)),r.countdown.showCountdown&&t.endsAt){let b=H(t.endsAt);b&&(m.appendChild(b.el),i?.(b.stop))}let v=s("div","lb-volume__tiers",{role:"radiogroup","aria-label":"Quantity tiers","data-tier-group":""});c.forEach(b=>{let B=$t(b,b.index===f,l,r.popularBadge.visible&&b.index===h?r.popularBadge.text:null,r.pricing.showComparePrice,r.pricing.showPerUnitPrice);B.addEventListener("click",()=>A(b.index)),B.addEventListener("keydown",y=>{if(y.key==="Enter"||y.key===" "){y.preventDefault(),A(b.index);return}if(y.key==="ArrowDown"||y.key==="ArrowRight"||y.key==="ArrowUp"||y.key==="ArrowLeft"){y.preventDefault();let S=y.key==="ArrowDown"||y.key==="ArrowRight"?1:-1,M=(b.index+S+c.length)%c.length;A(M),v.children[M]?.focus()}}),v.appendChild(B)}),m.appendChild(v),m.appendChild(s("div","lb-bundle-divider"));let T=Me(c,f,l,r.pricing.showItemCount,r.pricing.showCompareAtPrice);m.appendChild(T);let C=r.savingsBar.visible?Re(c,f,l):null;C&&m.appendChild(C);let k=Wt(t,()=>{if(!o)return;let b=c[f];b&&n([{merchandiseId:o.id,quantity:b.qty,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}])});m.appendChild(k),m.appendChild(s("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),m.appendChild(s("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(m);function A(b){if(b===f||b<0||b>=c.length)return;f=b,Array.from(v.children).forEach((S,M)=>{S.setAttribute("aria-checked",String(M===b)),S.tabIndex=M===b?0:-1});let B=Me(c,b,l,r.pricing.showItemCount,r.pricing.showCompareAtPrice);if(T.replaceWith(B),T=B,C){let S=Re(c,b,l);C.replaceWith(S),C=S}let y=m.querySelector("[data-header-badge]");if(y){let S=De(c[b],l,u);S?(y.textContent=S,y.style.display=""):y.style.display="none"}}}function Ht(e,t,n,i,r){let a=e.widgetConfig,o=s("div","lb-bundle-header"),d=s("div","lb-bundle-header__content"),l=s("h3","lb-bundle-title");if(l.textContent=e.title,d.appendChild(l),o.appendChild(d),a.pricing.showSaveBadge){let u=De(t[n],i,r);if(u){let c=s("span","lb-bundle-header__badge",{"data-header-badge":""});c.textContent=u,o.appendChild(c)}}return o}function $t(e,t,n,i,r,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)}),d=s("span","lb-volume__radio");d.appendChild(s("span","lb-volume__radio-dot")),o.appendChild(d);let l=s("span","lb-volume__tier-grid"),u=s("span","lb-volume__tier-label");u.textContent=`Buy ${e.qty}`,l.appendChild(u);let c=s("span","lb-volume__tier-price");if(r&&e.pricePerUnitCents<e.basePricePerUnitCents){let f=s("span","lb-volume__tier-compare");f.textContent=_(e.basePricePerUnitCents,n),c.appendChild(f)}if(a){let f=document.createElement("span");f.setAttribute("data-tier-price-each",""),f.textContent=_(e.pricePerUnitCents,n),c.appendChild(f);let h=s("span","lb-volume__tier-unit");h.textContent=" each",c.appendChild(h)}l.appendChild(c),o.appendChild(l);let p=s("span","lb-volume__tier-badge");return i?p.textContent=i:p.style.display="none",o.appendChild(p),o}function Me(e,t,n,i,r){let a=e[t],o=a?a.pricePerUnitCents*a.qty:0,d=a?a.basePricePerUnitCents*a.qty:0,l=Math.max(0,d-o),u=s("div","lb-bundle-pricing"),c=s("span","lb-bundle-pricing__label",{"data-total-label":""});if(c.textContent="Total",i&&a){let h=document.createElement("span");h.setAttribute("data-item-count",""),h.textContent=` (${a.qty} item${a.qty===1?"":"s"})`,c.appendChild(h)}u.appendChild(c);let p=s("span","lb-bundle-pricing__prices");if(r&&l>0){let h=s("span","lb-bundle-compare-price",{"data-compare-price":""});h.textContent=_(d,n),p.appendChild(h)}let f=s("span","lb-bundle-sale-price",{"data-total-price":""});return f.textContent=_(o,n),p.appendChild(f),u.appendChild(p),u}function Re(e,t,n){let i=e[t],r=i?i.pricePerUnitCents*i.qty:0,a=i?i.basePricePerUnitCents*i.qty:0,o=Math.max(0,a-r),d=s("div","lb-bundle-savings-bar",{"data-savings-bar":""});o<=0&&(d.style.display="none");let l=document.createElement("span");l.textContent="You save",d.appendChild(l);let u=s("span","",{"data-savings-amount":""});return u.textContent=_(o,n),d.appendChild(u),d}function Wt(e,t){let i=e.products[0]?.variants.nodes.some(o=>o.availableForSale),r=i?e.widgetConfig.cta.ctaText||"Add to cart":"Sold out",a=$(r);return i||(a.disabled=!0),a.addEventListener("click",()=>{a.disabled||t()}),a}function De(e,t,n){if(!e)return null;let{tier:i}=e;if(n==="fixed_amount"){let r=i.amount??0;return r>0?`-${_(Math.round(r*100),t)}`:null}if(n==="percentage"){let r=i.percentage??0;return r>0?`-${Math.round(r)}%`:null}return null}function qt(e){let t=0,n=0;return e.forEach((i,r)=>{let a=i.basePricePerUnitCents-i.pricePerUnitCents;a>t&&(t=a,n=r)}),n}function Ie(e,t,n){return Math.max(t,Math.min(n,e))}var ne=`/* Lime Bundles \u2014 shared base styles for all bundle widget types */
235
+ </svg>`;function Ue(e,t,r,n){let i=t.widgetConfig,a=t.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",o=t.minQuantity??1,l=t.maxQuantity??o,d=Kt(t,i.outOfStockBehavior);if(d.filter(m=>!m.isOos).length<o)return;let c=[],p=s("div","lb-mix-match",{"data-required-quantity":String(o),"data-max-quantity":String(l)}),g=qt(t);if(p.appendChild(g),i.countdown.showCountdown&&t.endsAt){let m=z(t.endsAt);m&&(p.appendChild(m.el),n?.(m.stop))}let w=Wt(o);p.appendChild(w.el);let b=s("div","lb-mix-match__slots",{"data-selection-slots":""});p.appendChild(b),p.appendChild(s("div","lb-bundle-divider"));let v=jt(i.pricing.showCompareAtPrice);p.appendChild(v.el);let B=i.savingsBar.visible?Gt():null;B&&p.appendChild(B.el);let x=s("div","lb-mix-match__price-placeholder",{"data-price-placeholder":""}),T=s("span","lb-mix-match__price-placeholder-text");T.textContent=`Select ${o} items to see price`,x.appendChild(T),p.appendChild(x);let E=Qt(t,d,a,{showSearch:i.showSearch,onAdd:(m,_)=>A(m,_),onRemove:(m,_)=>R(m,_),countFor:(m,_)=>c.filter(M=>M.productId===m&&M.variantId===_).length,isOverMax:()=>c.length>=l});p.appendChild(E.el);let h=j(`Select ${o} items to unlock`);h.disabled=!0,h.addEventListener("click",()=>{if(h.disabled)return;let m=c.map(_=>({merchandiseId:_.variantId,quantity:1,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}));r(m)}),p.appendChild(h),p.appendChild(s("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),p.appendChild(s("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(p);let S=d.find(m=>!m.isOos),C=S?.firstAvailableVariant??S?.variants[0];S&&C&&c.push({productId:S.product.id,productTitle:S.product.title,variantId:C.id,variantTitle:C.title,imageUrl:S.product.featuredImage?.url??null,priceCents:P(C.price.amount),compareCents:C.compareAtPrice?P(C.compareAtPrice.amount):null,unitPriceLabel:U(C.unitPrice,C.unitPriceMeasurement,a)}),f();function A(m,_){c.length>=l||(c.push({productId:m.id,productTitle:m.title,variantId:_.id,variantTitle:_.title,imageUrl:m.featuredImage?.url??null,priceCents:P(_.price.amount),compareCents:_.compareAtPrice?P(_.compareAtPrice.amount):null,unitPriceLabel:U(_.unitPrice,_.unitPriceMeasurement,a)}),f())}function R(m,_){let M=c.findIndex(D=>D.productId===m&&D.variantId===_);M!==-1&&(c.splice(M,1),f())}function G(m){m<0||m>=c.length||(c.splice(m,1),f())}function f(){V(),w.update(c.length),v.update(c,t,a),B&&B.update(c,t,a),x.style.display=c.length===0?"":"none",E.refreshCounts(),I()}function V(){b.innerHTML="";let m=Math.max(o,c.length);for(let _=0;_<m;_++){let M=c[_];M?b.appendChild(zt(M,_,a,()=>G(_))):b.appendChild(Nt(_,()=>E.open()))}}function I(){let m=c.length;m<o?(h.disabled=!0,oe(h,`Select ${o-m} more to unlock`)):(h.disabled=!1,oe(h,i.cta.ctaText||"Add to cart"))}}function qt(e){let t=e.widgetConfig,r=s("div","lb-bundle-header"),n=s("div","lb-bundle-header__content"),i=s("h3","lb-bundle-title");if(i.textContent=e.title,n.appendChild(i),r.appendChild(n),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=`-${k(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 Wt(e){let t=s("div","lb-mix-match__progress"),r=s("div","lb-mix-match__progress-labels"),n=s("span","lb-mix-match__progress-count",{"data-progress-count":""});n.textContent=`0 of ${e} selected`,r.appendChild(n);let i=s("span","lb-mix-match__progress-remaining",{"data-progress-remaining":""});i.textContent=`${e} more to go`,r.appendChild(i),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 u=Math.min(100,d/e*100);n.textContent=`${d} of ${e} selected`,d>=e?i.textContent="Complete":i.textContent=`${e-d} more to go`,o.style.width=`${u}%`,a.setAttribute("aria-valuenow",String(Math.min(d,e)))}return{el:t,update:l}}function Nt(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"}),n=s("div","lb-mix-match__empty-thumb");n.innerHTML=Ht,r.appendChild(n);let i=s("span","lb-mix-match__empty-text");return i.textContent="Choose an item",r.appendChild(i),r.addEventListener("click",t),r.addEventListener("keydown",a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),t())}),r}function zt(e,t,r,n){let i=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 p=document.createElement("img");p.src=N(e.imageUrl,{width:L,height:L,crop:"center"}),p.alt=e.productTitle,p.width=L,p.height=L,p.loading="lazy",a.appendChild(p)}else a.insertAdjacentHTML("beforeend",Ve);i.appendChild(a);let o=s("div","lb-mix-match__filled-info"),l=s("span","lb-mix-match__filled-title");if(l.textContent=e.productTitle,o.appendChild(l),e.variantTitle&&e.variantTitle!=="Default Title"){let p=s("span","lb-mix-match__filled-variant");p.textContent=e.variantTitle,o.appendChild(p)}let d=s("span","lb-mix-match__filled-price");if(e.compareCents&&e.compareCents>e.priceCents){let p=s("span","lb-mix-match__filled-compare");p.textContent=k(e.compareCents,r),d.appendChild(p)}let u=document.createElement("span");if(u.textContent=k(e.priceCents,r),d.appendChild(u),o.appendChild(d),e.unitPriceLabel){let p=s("span","lb-bundle-product-unit-price");p.textContent=e.unitPriceLabel,o.appendChild(p)}i.appendChild(o);let c=document.createElement("button");return c.type="button",c.className="lb-mix-match__slot-remove",c.setAttribute("aria-label",`Remove ${e.productTitle}`),c.innerHTML=De,c.addEventListener("click",p=>{p.stopPropagation(),n()}),i.appendChild(c),i}function jt(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 n=s("span","lb-bundle-pricing__prices"),i=s("span","lb-bundle-compare-price",{"data-compare-price":""});e&&n.appendChild(i);let a=s("span","lb-bundle-sale-price",{"data-sale-price":""});n.appendChild(a),t.appendChild(n);function o(l,d,u){if(l.length===0){t.style.display="none";return}t.style.display="";let c=l.reduce((g,w)=>g+w.priceCents,0),p=Y(c,d.discountConfig);e&&c>p?(i.textContent=k(c,u),i.style.display=""):i.style.display="none",a.textContent=k(p,u)}return{el:t,update:o}}function Gt(){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 n(i,a,o){if(i.length===0){e.style.display="none";return}let l=i.reduce((c,p)=>c+p.priceCents,0),d=Y(l,a.discountConfig),u=Math.max(0,l-d);if(u<=0){e.style.display="none";return}e.style.display="",r.textContent=k(u,o)}return{el:e,update:n}}function Qt(e,t,r,n){let i=s("div","lb-mix-match__modal-overlay",{"data-modal-overlay":"","data-bundle-gid":e.id});i.style.display="none";let a=s("div","lb-mix-match__modal",{role:"dialog","aria-modal":"true","aria-labelledby":`lb-modal-title-${Fe(e.id)}`,tabindex:"-1"}),o=s("div","lb-mix-match__modal-header"),l=s("h4","lb-mix-match__modal-title",{id:`lb-modal-title-${Fe(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=De,d.addEventListener("click",A),o.appendChild(d),a.appendChild(o);let u=null,c=null;if(n.showSearch){let f=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()),f.appendChild(u),c=document.createElement("button"),c.type="button",c.className="lb-mix-match__modal-search-clear",c.setAttribute("data-modal-search-clear",""),c.setAttribute("aria-label","Clear search"),c.style.display="none",c.innerHTML=$t,c.addEventListener("click",()=>{u&&(u.value="",T(),u.focus())}),f.appendChild(c),a.appendChild(f)}let p=s("div","lb-mix-match__modal-list",{"data-modal-list":""});a.appendChild(p);let g=s("div","lb-mix-match__modal-empty",{"data-modal-empty":""});g.style.display="none";let w=document.createElement("p");w.textContent="No products match your search.",g.appendChild(w),a.appendChild(g);let b=s("span","lb-visually-hidden",{"data-modal-live":"","aria-live":"polite"});a.appendChild(b),i.appendChild(a);let v=!1,B=[];function x(){v||(v=!0,p.innerHTML="",t.forEach(f=>{let V=f.variants.filter(y=>y.availableForSale),I=V[0]??f.firstAvailableVariant??f.variants[0];if(!I)return;let m=I,_=s("div",f.isOos?"lb-mix-match__modal-product lb-mix-match__modal-product--sold-out":"lb-mix-match__modal-product",{"data-product-id":f.product.id.replace(/^.*\//,"")}),M=s("div","lb-mix-match__modal-product-thumb");if(f.product.featuredImage){let y=document.createElement("img");y.src=N(f.product.featuredImage.url,{width:L,height:L,crop:"center"}),y.alt=f.product.featuredImage.altText??f.product.title,y.width=L,y.height=L,y.loading="lazy",M.appendChild(y)}else M.insertAdjacentHTML("beforeend",Ve);let D=s("span","lb-bundle-qty-badge");D.style.display="none",M.appendChild(D),_.appendChild(M);let O=s("div","lb-mix-match__modal-product-info"),le=s("p","lb-mix-match__modal-product-title");le.textContent=f.product.title,O.appendChild(le);let X=s("p","lb-mix-match__modal-product-price");X.textContent=k(P(m.price.amount),r),O.appendChild(X);let H=s("p","lb-mix-match__modal-product-unit-price lb-bundle-product-unit-price"),de=U(m.unitPrice,m.unitPriceMeasurement,r);de?H.textContent=de:H.hidden=!0,O.appendChild(H);let J={el:_,product:f.product,variant:I,updateCount:()=>{}};if(V.length>1){let y=document.createElement("select");y.className="lb-mix-match__variant-select",y.setAttribute("data-variant-select",""),y.name=`lb-variant-${f.product.id.replace(/^.*\//,"")}`,y.setAttribute("aria-label",`Select variant for ${f.product.title}`),V.forEach($=>{let q=document.createElement("option");q.value=$.id,q.textContent=$.title,$.id===I.id&&(q.selected=!0),y.appendChild(q)}),y.addEventListener("change",()=>{let $=V.find(Qe=>Qe.id===y.value);if(!$)return;m=$,J.variant=$,X.textContent=k(P(m.price.amount),r);let q=U(m.unitPrice,m.unitPriceMeasurement,r);q?(H.textContent=q,H.hidden=!1):(H.textContent="",H.hidden=!0),se()}),O.appendChild(y)}else if(V.length===1&&I.title!=="Default Title"){let y=s("span","lb-mix-match__filled-variant");y.textContent=I.title,O.appendChild(y)}if(f.isOos){let y=s("span","lb-mix-match__modal-sold-out-label");y.textContent="Sold out",O.appendChild(y)}_.appendChild(O);let se=()=>{let y=n.countFor(f.product.id,m.id);y>0?(D.textContent=String(y),D.style.display=""):D.style.display="none"};if(!f.isOos){let y=document.createElement("button");y.type="button",y.className="lb-mix-match__modal-add",y.textContent="Add",y.addEventListener("click",()=>{n.isOverMax()||n.onAdd(f.product,m)}),_.appendChild(y)}J.updateCount=f.isOos?()=>{}:se,B.push(J),p.appendChild(_)}),G())}function T(){if(!u)return;let f=u.value.trim().toLowerCase();c&&(c.style.display=f?"":"none");let V=0;B.forEach(I=>{let m=!f||I.product.title.toLowerCase().includes(f);I.el.style.display=m?"":"none",m&&V++}),g.style.display=V===0&&f?"":"none"}let E=null;function h(f){if(f.key==="Escape"){f.preventDefault(),A();return}f.key==="Tab"&&Yt(f,a)}let S=!1;function C(){S||n.isOverMax()||(S=!0,x(),E=i.getRootNode().activeElement,i.style.display="",i.classList.add("lb-mix-match__modal-overlay--open"),a.focus(),document.addEventListener("keydown",h),i.addEventListener("click",R))}function A(){S&&(S=!1,i.classList.remove("lb-mix-match__modal-overlay--open"),i.style.display="none",document.removeEventListener("keydown",h),i.removeEventListener("click",R),E instanceof HTMLElement&&E.focus())}function R(f){f.target===i&&A()}function G(){B.forEach(f=>f.updateCount())}return{el:i,open:C,close:A,refreshCounts:G}}function Kt(e,t){let r=[],n=new Set;for(let i of e.products){if(n.has(i.id))continue;n.add(i.id);let a=i.variants.nodes.filter(l=>l.availableForSale),o=a.length===0;o&&t==="hide"||r.push({product:i,variants:i.variants.nodes,firstAvailableVariant:a[0]??null,isOos:o})}return r}function Yt(e,t){let r=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(r.length===0)return;let n=r[0],i=r[r.length-1],a=t.getRootNode().activeElement;e.shiftKey&&a===n?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),n.focus())}function Fe(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function qe(e,t,r,n){let i=t.widgetConfig,o=t.products[0]?.variants.nodes.find(h=>h.availableForSale);if(!o&&i.outOfStockBehavior==="hide")return;let l=o?P(o.price.amount):0,d=o?.price.currencyCode??"USD",u=t.discountConfig.discountType,c=t.volumeTiers.map((h,S)=>{let C;if(u==="fixed_amount"){let A=Math.round((h.amount??0)*100);C=Math.max(0,l-A)}else{let A=h.percentage??0,R=Math.floor(l*A/100);C=Math.max(0,l-R)}return{tier:h,index:S,qty:h.minQuantity,pricePerUnitCents:C,basePricePerUnitCents:l}}),p=er(c),g=i.defaultTier==="best_value"?p:0;typeof i.defaultTier=="number"&&(g=$e(i.defaultTier,0,c.length-1));let w=i.popularBadge.tierIndex!==void 0?$e(i.popularBadge.tierIndex,0,c.length-1):p,b=s("div","lb-volume");if(b.appendChild(Xt(t,c,g,d,u)),i.countdown.showCountdown&&t.endsAt){let h=z(t.endsAt);h&&(b.appendChild(h.el),n?.(h.stop))}let v=s("div","lb-volume__tiers",{role:"radiogroup","aria-label":"Quantity tiers","data-tier-group":""});c.forEach(h=>{let S=Jt(h,h.index===g,d,i.popularBadge.visible&&h.index===w?i.popularBadge.text:null,i.pricing.showComparePrice,i.pricing.showPerUnitPrice);S.addEventListener("click",()=>E(h.index)),S.addEventListener("keydown",C=>{if(C.key==="Enter"||C.key===" "){C.preventDefault(),E(h.index);return}if(C.key==="ArrowDown"||C.key==="ArrowRight"||C.key==="ArrowUp"||C.key==="ArrowLeft"){C.preventDefault();let A=C.key==="ArrowDown"||C.key==="ArrowRight"?1:-1,R=(h.index+A+c.length)%c.length;E(R),v.children[R]?.focus()}}),v.appendChild(S)}),b.appendChild(v),b.appendChild(s("div","lb-bundle-divider"));let B=Oe(c,g,d,i.pricing.showItemCount,i.pricing.showCompareAtPrice);b.appendChild(B);let x=i.savingsBar.visible?He(c,g,d):null;x&&b.appendChild(x);let T=Zt(t,()=>{if(!o)return;let h=c[g];h&&r([{merchandiseId:o.id,quantity:h.qty,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}])});b.appendChild(T),b.appendChild(s("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),b.appendChild(s("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(b);function E(h){if(h===g||h<0||h>=c.length)return;g=h,Array.from(v.children).forEach((A,R)=>{A.setAttribute("aria-checked",String(R===h)),A.tabIndex=R===h?0:-1});let S=Oe(c,h,d,i.pricing.showItemCount,i.pricing.showCompareAtPrice);if(B.replaceWith(S),B=S,x){let A=He(c,h,d);x.replaceWith(A),x=A}let C=b.querySelector("[data-header-badge]");if(C){let A=We(c[h],d,u);A?(C.textContent=A,C.style.display=""):C.style.display="none"}}}function Xt(e,t,r,n,i){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 u=We(t[r],n,i);if(u){let c=s("span","lb-bundle-header__badge",{"data-header-badge":""});c.textContent=u,o.appendChild(c)}}return o}function Jt(e,t,r,n,i,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"),u=s("span","lb-volume__tier-label");u.textContent=`Buy ${e.qty}`,d.appendChild(u);let c=s("span","lb-volume__tier-price");if(i&&e.pricePerUnitCents<e.basePricePerUnitCents){let g=s("span","lb-volume__tier-compare");g.textContent=k(e.basePricePerUnitCents,r),c.appendChild(g)}if(a){let g=document.createElement("span");g.setAttribute("data-tier-price-each",""),g.textContent=k(e.pricePerUnitCents,r),c.appendChild(g);let w=s("span","lb-volume__tier-unit");w.textContent=" each",c.appendChild(w)}d.appendChild(c),o.appendChild(d);let p=s("span","lb-volume__tier-badge");return n?p.textContent=n:p.style.display="none",o.appendChild(p),o}function Oe(e,t,r,n,i){let a=e[t],o=a?a.pricePerUnitCents*a.qty:0,l=a?a.basePricePerUnitCents*a.qty:0,d=Math.max(0,l-o),u=s("div","lb-bundle-pricing"),c=s("span","lb-bundle-pricing__label",{"data-total-label":""});if(c.textContent="Total",n&&a){let w=document.createElement("span");w.setAttribute("data-item-count",""),w.textContent=` (${a.qty} item${a.qty===1?"":"s"})`,c.appendChild(w)}u.appendChild(c);let p=s("span","lb-bundle-pricing__prices");if(i&&d>0){let w=s("span","lb-bundle-compare-price",{"data-compare-price":""});w.textContent=k(l,r),p.appendChild(w)}let g=s("span","lb-bundle-sale-price",{"data-total-price":""});return g.textContent=k(o,r),p.appendChild(g),u.appendChild(p),u}function He(e,t,r){let n=e[t],i=n?n.pricePerUnitCents*n.qty:0,a=n?n.basePricePerUnitCents*n.qty:0,o=Math.max(0,a-i),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 u=s("span","",{"data-savings-amount":""});return u.textContent=k(o,r),l.appendChild(u),l}function Zt(e,t){let n=e.products[0]?.variants.nodes.some(o=>o.availableForSale),i=n?e.widgetConfig.cta.ctaText||"Add to cart":"Sold out",a=j(i);return n||(a.disabled=!0),a.addEventListener("click",()=>{a.disabled||t()}),a}function We(e,t,r){if(!e)return null;let{tier:n}=e;if(r==="fixed_amount"){let i=n.amount??0;return i>0?`-${k(Math.round(i*100),t)}`:null}if(r==="percentage"){let i=n.percentage??0;return i>0?`-${Math.round(i)}%`:null}return null}function er(e){let t=0,r=0;return e.forEach((n,i)=>{let a=n.basePricePerUnitCents-n.pricePerUnitCents;a>t&&(t=a,r=i)}),r}function $e(e,t,r){return Math.max(t,Math.min(r,e))}var ae=`/* Lime Bundles \u2014 shared base styles for all bundle widget types */
224
236
 
225
237
  .lb-bundle-widget.lb-bundle-widget,
226
238
  .lb-bundle-widget.lb-bundle-widget * {
@@ -229,7 +241,6 @@
229
241
 
230
242
  .lb-bundle-widget {
231
243
  /* Internal CSS-only vars (not merchant-configurable). */
232
- --lb-text-muted: #666666;
233
244
  --lb-thumbnail-bg: #F0F0F0;
234
245
  --lb-widget-pad: 20px;
235
246
  --lb-progress-color: var(--lb-primary-color);
@@ -252,7 +263,7 @@
252
263
  margin: 0 calc(-1 * var(--lb-widget-pad)) 20px;
253
264
  padding: 12px 20px;
254
265
  background: var(--lb-countdown-bg);
255
- border-top: 1px solid rgba(0, 0, 0, 0.06);
266
+ border-top: 1px solid color-mix(in srgb, var(--lb-text) 6%, transparent);
256
267
  display: flex;
257
268
  align-items: center;
258
269
  justify-content: space-between;
@@ -348,7 +359,7 @@
348
359
  font-size: 16px;
349
360
  font-weight: 400;
350
361
  line-height: 20px;
351
- color: var(--lb-text-muted);
362
+ color: color-mix(in srgb, var(--lb-text) 60%, transparent);
352
363
  margin: 4px 0 0;
353
364
  }
354
365
 
@@ -391,15 +402,18 @@
391
402
  /* Product rows */
392
403
  .lb-bundle-product-row {
393
404
  display: flex;
394
- gap: 12px;
405
+ gap: 20px;
395
406
  padding: 12px 0;
396
407
  }
397
408
 
398
409
  .lb-bundle-thumbnail {
399
410
  position: relative;
400
411
  width: 48px;
401
- height: 48px;
402
412
  min-width: 48px;
413
+ /* Aspect-ratio comes from the merchant \`thumbnailRatio\` enum via Liquid;
414
+ "original" sets it to \`auto\` so the box sizes to the image's intrinsic
415
+ ratio. Default keeps the historical 1:1 behaviour. */
416
+ aspect-ratio: var(--lb-thumbnail-aspect-ratio, 1 / 1);
403
417
  background: var(--lb-thumbnail-bg);
404
418
  border-radius: 8px;
405
419
  overflow: hidden;
@@ -410,14 +424,16 @@
410
424
 
411
425
  .lb-bundle-thumbnail img {
412
426
  width: 100%;
413
- height: 100%;
414
- object-fit: cover;
427
+ /* Height + fit come from the same merchant enum; "original" sets them to
428
+ \`auto\` / \`contain\` so the image renders uncropped at intrinsic ratio. */
429
+ height: var(--lb-thumbnail-img-height, 100%);
430
+ object-fit: var(--lb-thumbnail-img-fit, cover);
415
431
  }
416
432
 
417
433
  .lb-bundle-thumbnail svg {
418
434
  width: 28px;
419
435
  height: 28px;
420
- color: #BBBBBB;
436
+ color: color-mix(in srgb, var(--lb-text) 35%, transparent);
421
437
  }
422
438
 
423
439
  .lb-bundle-product-info {
@@ -442,7 +458,7 @@
442
458
  .lb-bundle-product-price {
443
459
  /* --lb-product-price-display fallback is the "on" branch; Liquid sets 'none' when merchant disables. */
444
460
  display: var(--lb-product-price-display, block);
445
- font-size: 12px;
461
+ font-size: 14px;
446
462
  font-weight: 400;
447
463
  line-height: 20px;
448
464
  color: var(--lb-text);
@@ -459,7 +475,7 @@
459
475
  .lb-bundle-product-compare-price {
460
476
  /* --lb-product-compare-display fallback is the "on" branch; Liquid sets 'none' when merchant disables. */
461
477
  display: var(--lb-product-compare-display, inline);
462
- font-size: 12px;
478
+ font-size: 14px;
463
479
  font-weight: 400;
464
480
  line-height: 20px;
465
481
  color: color-mix(in srgb, var(--lb-text) 60%, transparent);
@@ -472,6 +488,22 @@
472
488
  display: none;
473
489
  }
474
490
 
491
+ /* Unit price (e.g. "$0.50/100ml") \u2014 only rendered when the merchant has
492
+ configured unit pricing on the variant in the Shopify admin. No merchant
493
+ toggle: present in admin \u2192 shown; absent \u2192 hidden. Styled as muted
494
+ secondary text beneath the price row so it doesn't compete visually. */
495
+ .lb-bundle-product-unit-price {
496
+ display: block;
497
+ font-size: 12px;
498
+ line-height: 16px;
499
+ color: color-mix(in srgb, var(--lb-text) 60%, transparent);
500
+ margin-top: 2px;
501
+ }
502
+
503
+ .lb-bundle-product-unit-price[hidden] {
504
+ display: none;
505
+ }
506
+
475
507
  .lb-bundle-variant-badge {
476
508
  display: inline-block;
477
509
  border: var(--lb-variant-border-width) solid var(--lb-variant-border-color);
@@ -479,14 +511,14 @@
479
511
  padding: 8px 12px;
480
512
  font-size: 12px;
481
513
  line-height: 16px;
482
- color: var(--lb-text-muted);
514
+ color: color-mix(in srgb, var(--lb-text) 60%, transparent);
483
515
  margin-top: 8px;
484
516
  }
485
517
 
486
518
  .lb-bundle-quantity {
487
519
  font-size: 12px;
488
520
  line-height: 16px;
489
- color: var(--lb-text-muted);
521
+ color: color-mix(in srgb, var(--lb-text) 60%, transparent);
490
522
  margin-left: 8px;
491
523
  white-space: nowrap;
492
524
  }
@@ -541,7 +573,7 @@
541
573
  font-size: 16px;
542
574
  font-weight: 600;
543
575
  line-height: 20px;
544
- padding: 12px 16px;
576
+ padding: 8px 12px;
545
577
  border-radius: var(--lb-savings-bar-radius);
546
578
  margin-bottom: 12px;
547
579
  }
@@ -585,7 +617,7 @@
585
617
  grid-template-rows: 1fr;
586
618
  grid-template-columns: 1fr;
587
619
  width: 100%;
588
- padding: 16px;
620
+ padding: 12px 16px;
589
621
  border: var(--lb-cta-border-width) solid var(--lb-cta-border-color);
590
622
  border-radius: var(--lb-cta-radius);
591
623
  font-size: 16px;
@@ -686,7 +718,7 @@
686
718
  .lb-bundle-placeholder-icon {
687
719
  width: 28px;
688
720
  height: 28px;
689
- stroke: #BBBBBB;
721
+ stroke: color-mix(in srgb, var(--lb-text) 35%, transparent);
690
722
  stroke-width: 1.5;
691
723
  fill: none;
692
724
  }
@@ -708,7 +740,7 @@
708
740
  .lb-ab-pending {
709
741
  visibility: hidden;
710
742
  }
711
- `,Ve=`/* Lime Bundles \u2014 Fixed bundle styles */
743
+ `,Ne=`/* Lime Bundles \u2014 Fixed bundle styles */
712
744
 
713
745
  .lb-fixed__products {
714
746
  display: flex;
@@ -719,14 +751,14 @@
719
751
 
720
752
  /* Fixed bundles: product rows */
721
753
  .lb-fixed .lb-bundle-product-row {
722
- gap: 16px;
754
+ gap: 20px;
723
755
  align-items: center;
724
756
  }
725
757
 
726
- /* Fixed bundles: larger thumbnails */
758
+ /* Fixed bundles: larger thumbnails. Height comes from --lb-thumbnail-aspect-ratio
759
+ (set on .lb-bundle-widget via Liquid / applyWidgetConfigVars). */
727
760
  .lb-fixed .lb-bundle-thumbnail {
728
761
  width: 60px;
729
- height: 60px;
730
762
  min-width: 60px;
731
763
  border-radius: var(--lb-image-border-radius);
732
764
  border: var(--lb-image-border-width) solid var(--lb-image-border-color);
@@ -765,7 +797,7 @@
765
797
  outline: 2px solid var(--lb-primary-color);
766
798
  outline-offset: 2px;
767
799
  }
768
- `,Ue=`/* Lime Bundles \u2014 Mix & Match styles */
800
+ `,ze=`/* Lime Bundles \u2014 Mix & Match styles */
769
801
 
770
802
  /* === Progress Bar === */
771
803
  .lb-mix-match__progress {
@@ -826,7 +858,10 @@
826
858
  width: 60px;
827
859
  height: 60px;
828
860
  min-width: 60px;
829
- border: var(--lb-image-border-width) dashed color-mix(in srgb, var(--lb-text) 20%, transparent);
861
+ /* 2px border is intentionally independent of --lb-image-border-width \u2014
862
+ empty slots always need a visible dashed outline as an affordance,
863
+ regardless of how the merchant has styled populated thumbnails. */
864
+ border: 2px dashed color-mix(in srgb, var(--lb-text) 35%, transparent);
830
865
  border-radius: var(--lb-image-border-radius);
831
866
  box-sizing: border-box;
832
867
  display: flex;
@@ -846,9 +881,10 @@
846
881
  cursor: default;
847
882
  }
848
883
 
884
+ /* Mix-match thumbnails. Height comes from --lb-thumbnail-aspect-ratio
885
+ (set on .lb-bundle-widget via Liquid / applyWidgetConfigVars). */
849
886
  .lb-mix-match .lb-bundle-thumbnail {
850
887
  width: 60px;
851
- height: 60px;
852
888
  min-width: 60px;
853
889
  border-radius: var(--lb-image-border-radius);
854
890
  border: var(--lb-image-border-width) solid var(--lb-image-border-color);
@@ -1083,7 +1119,7 @@
1083
1119
  .lb-mix-match__modal-product {
1084
1120
  display: flex;
1085
1121
  align-items: center;
1086
- gap: 12px;
1122
+ gap: 20px;
1087
1123
  padding: 12px 0;
1088
1124
  border-bottom: 1px solid color-mix(in srgb, var(--lb-picker-text) 7%, transparent);
1089
1125
  }
@@ -1095,13 +1131,16 @@
1095
1131
  .lb-mix-match__modal-product-thumb {
1096
1132
  position: relative;
1097
1133
  width: 48px;
1098
- height: 48px;
1099
1134
  min-width: 48px;
1135
+ /* Modal picker thumbs follow the merchant's pickerThumbnailRatio \u2014
1136
+ independent from the main widget's thumbnailRatio so a merchant can
1137
+ e.g. show tall picker thumbs with square main thumbs. */
1138
+ aspect-ratio: var(--lb-picker-thumbnail-aspect-ratio, 1 / 1);
1100
1139
  border-radius: var(--lb-picker-product-radius);
1101
1140
  border: var(--lb-picker-product-border-width) solid var(--lb-picker-product-border-color);
1102
1141
  box-sizing: border-box;
1103
1142
  overflow: visible;
1104
- background: #F0F0F0;
1143
+ background: var(--lb-thumbnail-bg);
1105
1144
  }
1106
1145
 
1107
1146
  /* Qty badge inside the picker modal inherits picker-product border (width + color) plus
@@ -1117,8 +1156,10 @@
1117
1156
 
1118
1157
  .lb-mix-match__modal-product-thumb img {
1119
1158
  width: 100%;
1120
- height: 100%;
1121
- object-fit: cover;
1159
+ /* Height + fit come from pickerThumbnailRatio \u2014 "original" sets both
1160
+ to auto/contain so the image renders uncropped at intrinsic ratio. */
1161
+ height: var(--lb-picker-thumbnail-img-height, 100%);
1162
+ object-fit: var(--lb-picker-thumbnail-img-fit, cover);
1122
1163
  border-radius: max(0px, calc(var(--lb-picker-product-radius) - var(--lb-picker-product-border-width)));
1123
1164
  }
1124
1165
 
@@ -1142,6 +1183,17 @@
1142
1183
  margin: 4px 0 0;
1143
1184
  }
1144
1185
 
1186
+ .lb-mix-match__modal-product-unit-price {
1187
+ font-size: 11px;
1188
+ line-height: 16px;
1189
+ color: color-mix(in srgb, var(--lb-text) 60%, transparent);
1190
+ margin: 2px 0 0;
1191
+ }
1192
+
1193
+ .lb-mix-match__modal-product-unit-price[hidden] {
1194
+ display: none;
1195
+ }
1196
+
1145
1197
  .lb-mix-match__variant-select {
1146
1198
  font-size: 12px;
1147
1199
  margin: 4px 0 0;
@@ -1251,7 +1303,7 @@
1251
1303
  transition: none;
1252
1304
  }
1253
1305
  }
1254
- `,Oe=`/* Lime Bundles \u2014 Volume / Quantity Breaks styles */
1306
+ `,je=`/* Lime Bundles \u2014 Volume / Quantity Breaks styles */
1255
1307
 
1256
1308
  .lb-volume__tiers {
1257
1309
  display: flex;
@@ -1341,7 +1393,7 @@
1341
1393
 
1342
1394
  .lb-volume__tier-price {
1343
1395
  grid-column: 1 / -1;
1344
- font-size: 12px;
1396
+ font-size: 14px;
1345
1397
  font-weight: 500;
1346
1398
  color: var(--lb-text);
1347
1399
  }
@@ -1353,7 +1405,7 @@
1353
1405
 
1354
1406
  /* Compare-at (strikethrough) price */
1355
1407
  .lb-volume__tier-compare {
1356
- font-size: 12px;
1408
+ font-size: 14px;
1357
1409
  line-height: 16px;
1358
1410
  color: color-mix(in srgb, var(--lb-text) 60%, transparent);
1359
1411
  text-decoration: line-through;
@@ -1361,7 +1413,7 @@
1361
1413
  }
1362
1414
 
1363
1415
 
1364
- `,He=`/* Lime Bundles \u2014 web-component loading skeleton (not mirrored to theme assets) */
1416
+ `,Ge=`/* Lime Bundles \u2014 web-component loading skeleton (not mirrored to theme assets) */
1365
1417
 
1366
1418
  .lb-bundle-widget--loading {
1367
1419
  display: block;
@@ -1457,10 +1509,10 @@
1457
1509
  animation: none;
1458
1510
  }
1459
1511
  }
1460
- `;var Nt=e=>`lb_cart_id:${e}`;function zt(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 j=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,n,i){n===i||!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 n=K({shopDomain:this.shopDomain,accessToken:this.storefrontToken});try{let i,r=!1;if(this.bundleGid)r=!0,i=this.fetchSingleBundle(n,t.signal);else{let d=zt(this.productHandleAttr);if(!d){this.teardownImpressions(),this.renderError("No bundle-gid or product-handle provided, and the current URL doesn't match /products/<handle>.");return}i=this.fetchProductBundles(n,t.signal,d)}let a=n.query(ue,void 0,{signal:t.signal}).catch(()=>null);if(await i,t.signal.aborted)return;if(r&&this.bundles.length===0){this.teardownImpressions(),this.renderError("Bundle not found");return}let o=await a;if(o?.shop?.metafield?.value){Be(this.shopDomain,o.shop.metafield.value);let d=Z(o.shop.metafield.value);d.ok&&(this.shopCustomCss=d.css)}await this.applyABVariants(),this.renderBundles()}catch(i){if(t.signal.aborted)return;this.bundles=[],this.teardownImpressions(),this.renderError(i instanceof Error?i.message:"Failed to load bundle")}}async applyABVariants(){if(!this.appUrl||this.bundles.length===0)return;let t=await Promise.all(this.bundles.map(async n=>{if(!n.abTestId||!n.abVariantB)return n;try{if((await _e(this.appUrl,this.shopDomain,n.abTestId,n.id))?.variant==="B")return fe(n)}catch(i){console.warn(`[lime-bundle] A/B assignment failed for bundle ${n.id}; falling back to Variant A.`,i)}return n}));this.bundles=t}async fetchSingleBundle(t,n){let i=await t.query(ce,{id:this.bundleGid},{signal:n});if(!i.metaobject){this.bundles=[];return}let r=X(i.metaobject.id,i.metaobject.fields);this.bundles=r?[r]:[]}async fetchProductBundles(t,n,i){let r=await t.query(pe,{handle:i},{signal:n});if(!r.product){this.bundles=[];return}let a=r.product.metafield?.references?.nodes??[],o=[];for(let d of a){let l=X(d.id,d.fields);l&&o.push(l)}this.bundles=o}handleAddToCart=async(t,n)=>{let i=new CustomEvent("lime-bundle:add-to-cart",{detail:{lines:n},bubbles:!0,composed:!0,cancelable:!0}),r=this.dispatchEvent(i);this.reportAddToCartEvent(t,n),r&&await this.defaultAddToCart(n)};async defaultAddToCart(t){if(typeof window>"u")return;let n=K({shopDomain:this.shopDomain,accessToken:this.storefrontToken}),i=window.localStorage,r=Nt(this.shopDomain),a=i?.getItem(r)??null;try{let o=null;if(a){let l=(await n.query(he,{cartId:a,lines:t})).cartLinesAdd;l?.userErrors?.length?i?.removeItem(r):l?.cart&&(o=l.cart.checkoutUrl)}if(!o){let l=(await n.query(be,{input:{lines:t}})).cartCreate;l?.cart&&(i?.setItem(r,l.cart.id),o=l.cart.checkoutUrl)}o?window.location.assign(o):this.dispatchEvent(new CustomEvent("lime-bundle:error",{detail:{message:"Cart creation failed",code:"CART_ERROR"},bubbles:!0,composed:!0}))}catch(o){this.dispatchEvent(new CustomEvent("lime-bundle:error",{detail:{message:o instanceof Error?o.message:"Cart mutation failed",code:"CART_ERROR"},bubbles:!0,composed:!0}))}}reportAddToCartEvent(t,n){if(!this.analyticsEnabled||!this.appUrl)return;let i=n.reduce((a,o)=>a+o.quantity,0),r=n.reduce((a,o)=>{let l=t.products.find(c=>c.variants.nodes.some(p=>p.id===o.merchandiseId))?.variants.nodes.find(c=>c.id===o.merchandiseId),u=l?parseFloat(l.price.amount):0;return a+u*o.quantity},0);xe({shopDomain:this.shopDomain,appUrl:this.appUrl},{bundleGid:t.id,bundleType:t.bundleType,productId:t.products[0]?.id??"",quantity:i,totalPrice:Math.round(r*100)/100})}renderBundles(){this.teardownImpressions(),this.teardownRenderers(),this.shadow.innerHTML="";let t=document.createElement("style");if(t.textContent=[ne,Ve,Ue,Oe].join(`
1461
- `),this.shadow.appendChild(t),this.shopCustomCss){let i=document.createElement("style");i.setAttribute("data-lime-bundles","shop-custom-css"),i.textContent=this.shopCustomCss,this.shadow.appendChild(i)}for(let i of this.bundles){let r=document.createElement("div");r.className="lb-bundle-widget",r.setAttribute("role","region"),r.setAttribute("aria-label",i.title),r.setAttribute("data-bundle-type",i.bundleType),r.setAttribute("data-bundle-gid",i.id),me(r,i.widgetConfig);let a=d=>this.handleAddToCart(i,d),o=d=>this.renderCleanups.push(d);switch(i.bundleType){case"fixed":Te(r,i,a,o);break;case"mix_match":Le(r,i,a,o);break;case"volume":Fe(r,i,a,o);break}this.shadow.appendChild(r),this.setupImpressionFor(i,r)}let n=this.bundles[0];this.dispatchEvent(new CustomEvent("lime-bundle:loaded",{detail:{bundleCount:this.bundles.length,bundleTypes:this.bundles.map(i=>i.bundleType),bundleType:n?.bundleType,title:n?.title},bubbles:!0,composed:!0}))}setupImpressionFor(t,n){if(!this.analyticsEnabled||!this.appUrl)return;let i=Ce(n,()=>{ve({shopDomain:this.shopDomain,appUrl:this.appUrl},{bundleGid:t.id,bundleType:t.bundleType})});this.impressionCleanups.push(i)}renderLoading(){this.shadow.innerHTML=`
1462
- <style>${ne}</style>
1463
- <style>${He}</style>
1512
+ `;var tr=e=>`lb_cart_id:${e}`;function rr(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 K=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,n){r===n||!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=ee({shopDomain:this.shopDomain,accessToken:this.storefrontToken});try{let n,i=!1;if(this.bundleGid)i=!0,n=this.fetchSingleBundle(r,t.signal);else{let l=rr(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}n=this.fetchProductBundles(r,t.signal,l)}let a=r.query(ve,void 0,{signal:t.signal}).catch(()=>null);if(await n,t.signal.aborted)return;if(i&&this.bundles.length===0){this.teardownImpressions(),this.renderError("Bundle not found");return}let o=await a;if(o?.shop?.metafield?.value){Le(this.shopDomain,o.shop.metafield.value);let l=ie(o.shop.metafield.value);l.ok&&(this.shopCustomCss=l.css)}await this.applyABVariants(),this.renderBundles()}catch(n){if(t.signal.aborted)return;this.bundles=[],this.teardownImpressions(),this.renderError(n instanceof Error?n.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 Pe(this.appUrl,this.shopDomain,r.abTestId,r.id))?.variant==="B")return Be(r)}catch(n){console.warn(`[lime-bundle] A/B assignment failed for bundle ${r.id}; falling back to Variant A.`,n)}return r}));this.bundles=t}async fetchSingleBundle(t,r){let n=await t.query(fe,{id:this.bundleGid},{signal:r});if(!n.metaobject){this.bundles=[];return}let i=te(n.metaobject.id,n.metaobject.fields);this.bundles=i?[i]:[]}async fetchProductBundles(t,r,n){let i=await t.query(xe,{handle:n},{signal:r});if(!i.product){this.bundles=[];return}let a=i.product.metafield?.references?.nodes??[],o=[];for(let l of a){let d=te(l.id,l.fields);d&&o.push(d)}this.bundles=o}handleAddToCart=async(t,r)=>{let n=new CustomEvent("lime-bundle:add-to-cart",{detail:{lines:r},bubbles:!0,composed:!0,cancelable:!0}),i=this.dispatchEvent(n);this.reportAddToCartEvent(t,r),i&&await this.defaultAddToCart(r)};async defaultAddToCart(t){if(typeof window>"u")return;let r=ee({shopDomain:this.shopDomain,accessToken:this.storefrontToken}),n=window.localStorage,i=tr(this.shopDomain),a=n?.getItem(i)??null;try{let o=null;if(a){let d=(await r.query(ye,{cartId:a,lines:t})).cartLinesAdd;d?.userErrors?.length?n?.removeItem(i):d?.cart&&(o=d.cart.checkoutUrl)}if(!o){let d=(await r.query(Ce,{input:{lines:t}})).cartCreate;d?.cart&&(n?.setItem(i,d.cart.id),o=d.cart.checkoutUrl)}o?window.location.assign(o):this.dispatchEvent(new CustomEvent("lime-bundle:error",{detail:{message:"Cart creation failed",code:"CART_ERROR"},bubbles:!0,composed:!0}))}catch(o){this.dispatchEvent(new CustomEvent("lime-bundle:error",{detail:{message:o instanceof Error?o.message:"Cart mutation failed",code:"CART_ERROR"},bubbles:!0,composed:!0}))}}reportAddToCartEvent(t,r){if(!this.analyticsEnabled||!this.appUrl)return;let n=r.reduce((a,o)=>a+o.quantity,0),i=r.reduce((a,o)=>{let d=t.products.find(c=>c.variants.nodes.some(p=>p.id===o.merchandiseId))?.variants.nodes.find(c=>c.id===o.merchandiseId),u=d?parseFloat(d.price.amount):0;return a+u*o.quantity},0);Se({shopDomain:this.shopDomain,appUrl:this.appUrl},{bundleGid:t.id,bundleType:t.bundleType,productId:t.products[0]?.id??"",quantity:n,totalPrice:Math.round(i*100)/100})}renderBundles(){this.teardownImpressions(),this.teardownRenderers(),this.shadow.innerHTML="";let t=document.createElement("style");if(t.textContent=[ae,Ne,ze,je].join(`
1513
+ `),this.shadow.appendChild(t),this.shopCustomCss){let n=document.createElement("style");n.setAttribute("data-lime-bundles","shop-custom-css"),n.textContent=this.shopCustomCss,this.shadow.appendChild(n)}for(let n of this.bundles){let i=document.createElement("div");i.className="lb-bundle-widget",i.setAttribute("role","region"),i.setAttribute("aria-label",n.title),i.setAttribute("data-bundle-type",n.bundleType),i.setAttribute("data-bundle-gid",n.id),we(i,n.widgetConfig);let a=l=>this.handleAddToCart(n,l),o=l=>this.renderCleanups.push(l);switch(n.bundleType){case"fixed":Ie(i,n,a,o);break;case"mix_match":Ue(i,n,a,o);break;case"volume":qe(i,n,a,o);break}this.shadow.appendChild(i),this.setupImpressionFor(n,i)}let r=this.bundles[0];this.dispatchEvent(new CustomEvent("lime-bundle:loaded",{detail:{bundleCount:this.bundles.length,bundleTypes:this.bundles.map(n=>n.bundleType),bundleType:r?.bundleType,title:r?.title},bubbles:!0,composed:!0}))}setupImpressionFor(t,r){if(!this.analyticsEnabled||!this.appUrl)return;let n=Te(r,()=>{ke({shopDomain:this.shopDomain,appUrl:this.appUrl},{bundleGid:t.id,bundleType:t.bundleType})});this.impressionCleanups.push(n)}renderLoading(){this.shadow.innerHTML=`
1514
+ <style>${ae}</style>
1515
+ <style>${Ge}</style>
1464
1516
  <div class="lb-bundle-widget lb-bundle-widget--loading" aria-busy="true" aria-label="Loading bundle">
1465
1517
  <div class="lb-skeleton lb-skeleton--title"></div>
1466
1518
  <div class="lb-skeleton--products">
@@ -1494,5 +1546,5 @@
1494
1546
  <div class="lb-skeleton lb-skeleton--cta"></div>
1495
1547
  </div>
1496
1548
  </div>
1497
- `}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",j);return je(jt);})();
1549
+ `}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",K);return et(ir);})();
1498
1550
  //# sourceMappingURL=lime-bundle.global.js.map