@lime-bundles/widget 2.4.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +326 -91
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +305 -71
- package/dist/index.js.map +1 -1
- package/dist/lime-bundle.global.js +82 -25
- package/dist/lime-bundle.global.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var LimeBundles=(()=>{var
|
|
1
|
+
"use strict";var LimeBundles=(()=>{var ue=Object.defineProperty;var gt=Object.getOwnPropertyDescriptor;var ft=Object.getOwnPropertyNames;var vt=Object.prototype.hasOwnProperty;var xt=(e,t)=>{for(var r in t)ue(e,r,{get:t[r],enumerable:!0})},Ct=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ft(t))!vt.call(e,n)&&n!==r&&ue(e,n,{get:()=>t[n],enumerable:!(i=gt(t,n))||i.enumerable});return e};var yt=e=>Ct(ue({},"__esModule",{value:!0}),e);var Tr={};xt(Tr,{LimeBundleElement:()=>te,trackInputMode:()=>le});var we=class extends Error{constructor(e){super(e.map(t=>t.message).join("; ")),this.errors=e,this.name="StorefrontApiError"}},wt="2025-10";function pe(e){let t=e.apiVersion??wt,r=`https://${e.shopDomain}/api/${t}/graphql.json`;return{async query(i,n,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:i,variables:n}),signal:a?.signal});if(!l.ok)throw new we([{message:`Storefront API error: ${l.status} ${l.statusText}`}]);let d=await l.json();if(d.errors?.length)throw new we(d.errors);return d.data}}}var Pe=`#graphql
|
|
2
2
|
query BundleMetaobject($id: ID!) {
|
|
3
3
|
metaobject(id: $id) {
|
|
4
4
|
id
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
`,
|
|
91
|
+
`,Le=`#graphql
|
|
92
92
|
query ShopCustomCss {
|
|
93
93
|
shop {
|
|
94
94
|
metafield(namespace: "$app", key: "custom_css") {
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
`,
|
|
99
|
+
`,Me=`#graphql
|
|
100
100
|
query BundlesForProduct($handle: String!) {
|
|
101
101
|
product(handle: $handle) {
|
|
102
102
|
id
|
|
@@ -197,42 +197,42 @@
|
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
-
`,
|
|
200
|
+
`,Re=`#graphql
|
|
201
201
|
mutation CartCreate($input: CartInput!) {
|
|
202
202
|
cartCreate(input: $input) {
|
|
203
203
|
cart { id checkoutUrl }
|
|
204
204
|
userErrors { field message }
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
`,
|
|
207
|
+
`,Ie=`#graphql
|
|
208
208
|
mutation CartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) {
|
|
209
209
|
cartLinesAdd(cartId: $cartId, lines: $lines) {
|
|
210
210
|
cart { id checkoutUrl }
|
|
211
211
|
userErrors { field message }
|
|
212
212
|
}
|
|
213
213
|
}
|
|
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=`
|
|
214
|
+
`,G=class extends Error{constructor(e,t){super(e),this.reason=t,this.name="BundleParseError"}},$={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 _t(e){if(!e||typeof e!="object")return $;let t=e;return{...$,...t,defaultTier:kt(t.defaultTier),header:{...$.header,...t.header??{}},layout:{...$.layout,...t.layout??{}},productList:{...$.productList,...t.productList??{}},pricing:{...$.pricing,...t.pricing??{}},cta:{...$.cta,...t.cta??{}},savingsBar:{...$.savingsBar,...t.savingsBar??{}},countdown:{...$.countdown,...t.countdown??{}},popularBadge:{...$.popularBadge,...t.popularBadge??{}}}}function kt(e){return e==="first"||e==="best_value"||typeof e=="number"&&Number.isInteger(e)&&e>=0?e:$.defaultTier}function Bt(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 St={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"},Tt=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 Fe(e,t){let r=Bt(t);for(let[a,o]of Object.entries(St)){let l=r[a];if(l==null)continue;let d=Tt.has(a)?`${l}px`:String(l);e.style.setProperty(o,d)}e.style.setProperty("--lb-product-price-display",t.productList.showPrice?"block":"none"),e.style.setProperty("--lb-product-compare-display",t.productList.showCompareAtPrice?"inline":"none"),e.style.setProperty("--lb-qty-badge-display",t.productList.showCountBubble?"flex":"none"),e.style.setProperty("--lb-picker-qty-badge-display",t.pickerShowCountBubble?"flex":"none"),e.style.setProperty("--lb-variant-chevron",_e(t.productList.variantBorderColor)),e.style.setProperty("--lb-picker-variant-chevron",_e(t.pickerVariantBorderColor)),t.header.headerStyle==="solid"?e.style.setProperty("--lb-header-bg",t.header.gradientStart):e.style.setProperty("--lb-header-bg",`linear-gradient(135deg, ${t.header.gradientStart}, ${t.header.gradientEnd})`);let i=ke(t.productList.thumbnailRatio);e.style.setProperty("--lb-thumbnail-aspect-ratio",i.aspectRatio),e.style.setProperty("--lb-thumbnail-img-fit",i.imgFit),e.style.setProperty("--lb-thumbnail-img-height",i.imgHeight);let n=ke(t.pickerThumbnailRatio);e.style.setProperty("--lb-picker-thumbnail-aspect-ratio",n.aspectRatio),e.style.setProperty("--lb-picker-thumbnail-img-fit",n.imgFit),e.style.setProperty("--lb-picker-thumbnail-img-height",n.imgHeight)}function _e(e){return`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='${e.replace(/#/g,"%23")}' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")`}function ke(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 Et=new Set(["fixed","mix_match","volume"]),At=new Set(["active"]);function be(e,t){try{return Pt(e,t)}catch(r){if(r instanceof G)return null;throw r}}function Pt(e,t){let r=new Map(t.map(_=>[_.key,_])),i=r.get("title")?.value??"Bundle",n=r.get("bundle_type")?.value,a=r.get("status")?.value;if(!n||!Et.has(n))throw new G(`Invalid or missing bundle_type: ${n??"null"}`,"invalid_type");let o=n;if(!a||!At.has(a))throw new G(`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 _=new Date(d);if(Number.isNaN(_.getTime()))throw new G(`Invalid starts_at: ${d}`,"invalid_type");if(_>c)throw new G(`Bundle not yet started: starts_at=${d}`,"not_started")}if(u){let _=new Date(u);if(Number.isNaN(_.getTime()))throw new G(`Invalid ends_at: ${u}`,"invalid_type");if(_<c)throw new G(`Bundle has expired: ends_at=${u}`,"expired")}let h=Lt(r),f=Mt(r),x=Rt(r),p={id:e,title:i,description:r.get("description")?.value||null,status:l,products:h,discountConfig:f,widgetConfig:x,startsAt:d,endsAt:u,discountLabel:r.get("discount_label")?.value??null,selectedVariantIds:It(r),productQuantities:Be(r,"product_quantities"),variantQuantities:Be(r,"variant_quantities"),abTestId:r.get("ab_test_id")?.value??null,abVariantB:Ft(r)};switch(o){case"fixed":return{...p,bundleType:"fixed"};case"volume":return{...p,bundleType:"volume",volumeTiers:Vt(r)};case"mix_match":return{...p,bundleType:"mix_match",minQuantity:Se(r,"min_quantity",{min:1}),maxQuantity:Se(r,"max_quantity",{min:1})}}}function Lt(e){let t=[],r=e.get("products");if(r?.reference&&"variants"in r.reference&&t.push(r.reference),r?.references?.nodes)for(let n of r.references.nodes)"variants"in n?t.push(n):"products"in n&&n.products?.nodes&&t.push(...n.products.nodes);let i=e.get("collection");if(i?.references?.nodes)for(let n of i.references.nodes)"products"in n&&n.products?.nodes&&t.push(...n.products.nodes);return t}function Mt(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 Rt(e){return _t(ee(e,"widget_config"))}function It(e){let t=ee(e,"selected_variant_ids");if(!Array.isArray(t))return null;let r=[];for(let i of t)Array.isArray(i)?r.push(i.filter(n=>typeof n=="string")):r.push([]);return r}function Be(e,t){let r=ee(e,t);if(!r||typeof r!="object"||Array.isArray(r))return{};let i={};for(let[n,a]of Object.entries(r)){let o=typeof a=="number"?a:Number(a);Number.isFinite(o)&&o>=0&&o<=99&&(i[n]=Math.floor(o))}return i}function Ft(e){if(!e.get("ab_test_id")?.value)return null;let r={},i=e.get("ab_title")?.value;i&&(r.title=i);let n=e.get("ab_description")?.value;n&&(r.description=n);let a=e.get("ab_discount_type")?.value,o=e.get("ab_discount_value")?.value;if(a&&(a==="percentage"||a==="fixed_amount")&&o){let d=parseFloat(o);Number.isFinite(d)&&(r.discountConfig={discountType:a,discountValue:d,allowStacking:e.get("allow_stacking")?.value==="true"})}let l=ee(e,"ab_volume_tiers");return Array.isArray(l)&&(r.volumeTiers=l.filter(d=>typeof d=="object"&&d!==null).map(Ve)),Object.keys(r).length===0?null:r}function Vt(e){let t=ee(e,"volume_tiers");return Array.isArray(t)?t.filter(r=>typeof r=="object"&&r!==null).map(Ve):[]}function Ve(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 ee(e,t){let r=e.get(t)?.value;if(!r)return null;try{return JSON.parse(r)}catch{return null}}function Se(e,t,r={}){let i=e.get(t)?.value;if(!i)return null;let n=parseInt(i,10);return isNaN(n)||r.min!==void 0&&n<r.min?null:n}function N(e,t,r){let i=e.variantQuantities[r];return i!==void 0?i:e.productQuantities[t]??1}function De(e){let t=e.abVariantB;if(!t)return e;let r=t.title??e.title,i=t.description!==void 0?t.description:e.description,n=t.discountConfig??e.discountConfig;switch(e.bundleType){case"volume":return{...e,title:r,description:i,discountConfig:n,volumeTiers:t.volumeTiers??e.volumeTiers};case"mix_match":return{...e,title:r,description:i,discountConfig:n};case"fixed":return{...e,title:r,description:i,discountConfig:n}}}async function Ue(e,t){await qe(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 Oe(e,t){await qe(e,{shopDomain:e.shopDomain,eventType:"bundle_add_to_cart",...t,occurredAt:new Date().toISOString()})}function He(e,t){if(typeof IntersectionObserver>"u")return t(),()=>{};let r=new IntersectionObserver(i=>{for(let n of i)n.isIntersecting&&(t(),r.unobserve(n.target))},{threshold:.5});return r.observe(e),()=>r.disconnect()}async function qe(e,t){let r=`${e.appUrl}/api/analytics`,i=JSON.stringify(t);try{(await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:i})).ok||(await new Promise(a=>setTimeout(a,2e3)),await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:i}))}catch{try{typeof navigator<"u"&&navigator.sendBeacon&&navigator.sendBeacon(r,i)}catch{}}}var Dt=!1;function Ut(){if(Dt)return!0;if(typeof window>"u")return!1;let e=window.Shopify;try{return e?.customerPrivacy?.analyticsProcessingAllowed?.()===!0}catch{return!1}}var Te="lb_session",Ot=720*60*60,Ht=720*60*60;function $e(e){return`__Host-_lb_ab_${e}`}async function Ne(e,t,r,i){if(typeof document>"u")return null;let n=qt(i);if(n&&n.testId===r)return{variant:n.variant,testId:r,persisted:!0};if(!Ut())return{variant:"A",testId:r,persisted:!1};let a=Nt(),o=Wt(a,r);$t(i,r,o);try{fetch(`${e}/api/ab-assign`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({shopDomain:t,testId:r,sessionId:a,variant:o})}).catch(()=>{})}catch{}return{variant:o,testId:r,persisted:!0}}function qt(e){if(typeof document>"u")return null;let r=`${$e(e)}=`,n=document.cookie.split(";").map(d=>d.trim()).find(d=>d.startsWith(r));if(!n)return null;let a=n.substring(r.length),[o,l]=a.split("|");return o!=="A"&&o!=="B"||!l?null:{testId:l,variant:o}}function $t(e,t,r){if(typeof document>"u")return;let i=$e(e),n=`${r}|${t}|${Date.now()}`;document.cookie=`${i}=${n}; Path=/; Max-Age=${Ht}; SameSite=Lax; Secure`}function Nt(){if(typeof document>"u")return Ee();let t=document.cookie.split(";").map(i=>i.trim()).find(i=>i.startsWith(`${Te}=`))?.split("=")[1];if(t)return t;let r=Ee();return document.cookie=`${Te}=${r}; path=/; max-age=${Ot}; SameSite=Lax; Secure`,r}function Ee(){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 Wt(e,t){let r=e+":"+t,i=2166136261;for(let n=0;n<r.length;n++)i^=r.charCodeAt(n),i=Math.imul(i,16777619);return(i>>>0)%2===0?"A":"B"}var Ae=1e4,zt=[[/@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"]],jt=/^(https:|\/[^/]|\.\/|\.\.\/|#)/;function he(e){if(e.length>Ae)return{ok:!1,error:`CSS exceeds ${Ae.toLocaleString("en-US")} character limit`};let t=e.replace(/\/\*[\s\S]*?\*\//g,"");try{t=t.replace(/\\([0-9a-fA-F]{1,6})[ \t\n\f]?/g,(n,a)=>{let o=parseInt(a,16);return o<0||o>1114111?"\uFFFD":String.fromCodePoint(o)}),t=t.replace(/\\\r?\n/g,""),t=t.replace(/\\([^\n\r\f0-9a-fA-F])/g,"$1")}catch{return{ok:!1,error:"CSS contains invalid unicode escape sequences"}}t=t.replace(/</g,"").replace(/>/g,"");for(let[n,a]of zt)if(n.test(t))return{ok:!1,error:`CSS contains blocked pattern: ${a}`};let r=/url\s*\(\s*([\s\S]*?)\s*\)/gi,i;for(;(i=r.exec(t))!==null;){let n=i[1].trim();if((n.startsWith("'")||n.startsWith('"'))&&(n=n.slice(1)),(n.endsWith("'")||n.endsWith('"'))&&(n=n.slice(0,-1)),n=n.trim(),n&&!jt.test(n))return{ok:!1,error:"CSS url() values must use https:// or relative paths"}}return{ok:!0,css:t}}var Gt="lb-custom-css-";function We(e,t){if(typeof document>"u"||!t)return!1;let r=he(t);if(!r.ok||!r.css.trim())return!1;let i=Gt+Kt(e),n=document.getElementById(i);return n||(n=document.createElement("style"),n.id=i,n.setAttribute("data-lime-bundles","custom-css"),document.head.appendChild(n)),n.textContent!==r.css&&(n.textContent=r.css),!0}function Kt(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 Qt(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 Yt={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 W(e,t,r){if(!e||!t||t.referenceUnit==="UNKNOWN")return null;let i=parseFloat(e.amount);if(!Number.isFinite(i))return null;let n=Yt[t.referenceUnit]??"";if(!n)return null;let a=e.currencyCode||r||"USD",o=Qt(i,a),l=t.referenceValue,d=l===1?n:`${l}${n}`;return`${o}/${d}`}function U(e){if(e==null)return 0;let t=typeof e=="string"?parseFloat(e):e;return Number.isFinite(t)?Math.round(t*100):0}function S(e,t){try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t}).format(e/100)}catch{return`${t} ${(e/100).toFixed(2)}`}}function ze(e,t){return Math.max(0,e-Math.floor(e*t/100))}function me(e,t=e.productQuantities,r=e.widgetConfig.pricing.showSaveBadge){let{discountType:i,discountValue:n}=e.discountConfig,a=[],o=0,l=0;for(let h of e.products){let f=h.variants.nodes.find(C=>C.availableForSale)??h.variants.nodes[0];if(!f)continue;let x=U(f.price.amount),p=t[h.id]??1,_=x*p,T=f.compareAtPrice?U(f.compareAtPrice.amount):null;if(a.push({unitCents:x,qty:p,lineCents:_,compareCents:T}),o+=_,i==="percentage"){let C=ze(x,n);l+=C*p}else l+=_}i==="fixed_amount"&&(l=Math.max(0,o-Math.round(n*100)));let d=Math.max(0,o-l),u=e.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",c="";return r&&d>0&&(i==="percentage"&&n>0?c=`-${Math.round(n)}%`:i==="fixed_amount"&&n>0&&(c=`-${S(Math.round(n*100),u)}`)),{rows:a,totalCents:o,saleCents:l,savingsCents:d,headerBadge:c,currency:u}}function ie(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 H=152;function Y(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 je(e){if(!Number.isFinite(e)||e<=0)return"";let t=Math.floor(e/1e3),r=Math.floor(t/86400),i=Math.floor(t%86400/3600),n=Math.floor(t%3600/60),a=t%60,o=l=>String(l).padStart(2,"0");return r>0?`${r}d ${o(i)}h ${o(n)}m ${o(a)}s`:`${o(i)}h ${o(n)}m ${o(a)}s`}function X(e){let t=Xt(e);if(t===null||t<=Date.now())return null;let r=t,i=document.createElement("div");i.className="lb-bundle-countdown",i.setAttribute("data-countdown","");let n=document.createElement("div");n.className="lb-bundle-countdown__label";let a=document.createElement("span");a.textContent="Ends in",n.appendChild(a),i.appendChild(n);let o=document.createElement("span");o.className="lb-bundle-countdown__timer",o.setAttribute("data-countdown-timer",""),i.appendChild(o);let l=null;function d(){let c=r-Date.now();if(c<=0){i.style.display="none",u();return}o.textContent=je(c)}function u(){l!==null&&(clearInterval(l),l=null)}return d(),l=setInterval(d,1e3),{el:i,stop:u}}function Xt(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 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 ge(e,t){let r=e.querySelector("[data-cta-label]");r&&(r.textContent=t)}function s(e,t,r={}){let i=document.createElement(e);t&&(i.className=t);for(let[n,a]of Object.entries(r))i.setAttribute(n,a);return i}var Jt=`
|
|
215
215
|
<svg class="lb-bundle-placeholder-icon" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
|
|
216
216
|
<rect x="4" y="4" width="20" height="20" rx="3"></rect>
|
|
217
217
|
<line x1="4" y1="20" x2="24" y2="20"></line>
|
|
218
218
|
<circle cx="10" cy="12" r="2"></circle>
|
|
219
|
-
</svg>`;function
|
|
219
|
+
</svg>`;function Ge(e,t,r,i){let n=t.widgetConfig,a=(C,E)=>N(t,C,E),o=[],l=0;if(t.products.forEach((C,E)=>{let M=Zt(t,C,E);M.qty!==0&&(M.isOos&&(l++,n.outOfStockBehavior==="hide")||o.push(M))}),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=er(t,d);if(u.appendChild(c.el),n.countdown.showCountdown&&t.endsAt){let C=X(t.endsAt);C&&(u.appendChild(C.el),i?.(C.stop))}let h=s("div","lb-fixed__products"),f=[];o.forEach(C=>{let E=rr(C,d,a,()=>{T()});f.push(E),h.appendChild(E.el)}),u.appendChild(h),u.appendChild(s("div","lb-bundle-divider"));let x=nr(t);u.appendChild(x.el);let p=n.savingsBar.visible?ir():null;p&&u.appendChild(p.el);let _=or(t,l,()=>{let C=o.filter(E=>E.selected).map(E=>({merchandiseId:E.selected.id,quantity:E.qty,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}));C.length!==0&&r(C)});u.appendChild(_),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((m,B)=>{if(!B.selected)return m;let w=U(B.selected.price.amount);return m+w*B.qty},0),E=ar(C,t.discountConfig,o),M=Math.max(0,C-E);x.update({totalCents:C,saleCents:E,savingsCents:M,currency:d}),p&&p.update({savingsCents:M,currency:d}),c.refresh(tr(t,C,E,d))}}function Zt(e,t,r){let i=e.selectedVariantIds?.[r]??null,n=i&&i.length>0?t.variants.nodes.filter(c=>i.includes(c.id)):t.variants.nodes,a=n.find(c=>c.availableForSale)??null,o=n,l=!a,d=a??n[0]??null,u=d?N(e,t.id,d.id):1;return{product:t,eligibleVariants:o,selected:d,qty:u,isOos:l}}function er(e,t){let r=e.widgetConfig,i=s("div","lb-bundle-header"),n=s("div","lb-bundle-header__content"),a=s("h3","lb-bundle-title");if(a.textContent=e.title,n.appendChild(a),e.description){let d=s("p","lb-bundle-subtitle");d.textContent=e.description,n.appendChild(d)}i.appendChild(n);let o=s("span","lb-bundle-header__badge",{"data-header-badge":""});i.appendChild(o);let l=me(e,e.productQuantities,r.pricing.showSaveBadge);return l.headerBadge?o.textContent=l.headerBadge:o.style.display="none",{el:i,refresh(d){if(!r.pricing.showSaveBadge){o.style.display="none";return}d?(o.textContent=d,o.style.display=""):o.style.display="none"}}}function tr(e,t,r,i){if(!e.widgetConfig.pricing.showSaveBadge)return"";let n=t-r;if(n<=0)return"";let a=e.discountConfig;return a.discountType==="percentage"&&a.discountValue>0?`-${Math.round(a.discountValue)}%`:a.discountType==="fixed_amount"&&a.discountValue>0?`-${S(Math.round(a.discountValue*100),i)}`:`-${S(n,i)}`}function rr(e,t,r,i){let n=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=Y(e.product.featuredImage.url,{width:H,height:H,crop:"center"}),u.alt=e.product.featuredImage.altText??e.product.title,u.width=H,u.height=H,u.loading="lazy",a.appendChild(u)}else a.insertAdjacentHTML("beforeend",Jt);let o=null;e.isOos||(o=s("span","lb-bundle-qty-badge",{"data-qty-badge":""}),o.textContent=String(e.qty),a.appendChild(o)),n.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":""}),h=s("span","lb-bundle-product-price",{"data-product-price":""});u.appendChild(c),u.appendChild(h),l.appendChild(u);let f=s("span","lb-bundle-product-unit-price",{"data-product-unit-price":""});f.setAttribute("hidden",""),l.appendChild(f);let x=p=>{let _=U(p.price.amount);if(h.textContent=S(_,t),p.compareAtPrice){let C=U(p.compareAtPrice.amount);C>_?(c.textContent=S(C,t),c.removeAttribute("hidden")):c.setAttribute("hidden","")}else c.setAttribute("hidden","");let T=W(p.unitPrice,p.unitPriceMeasurement,t);T?(f.textContent=T,f.removeAttribute("hidden")):f.setAttribute("hidden","")};if(x(e.selected),e.eligibleVariants.length>1){let p=e.eligibleVariants[0].selectedOptions.map(v=>v.name),_=e.product.id.replace(/^.*\//,""),T=[],C=v=>e.eligibleVariants.find(k=>k.selectedOptions.every((A,b)=>A.value===v[b])&&k.selectedOptions.length===v.length)??null,E=v=>{v.selectedOptions.forEach((k,A)=>{let b=T[A];b&&b.value!==k.value&&(b.value=k.value)})},M=(v,k,A)=>e.eligibleVariants.some(b=>!b.availableForSale||b.selectedOptions[v]?.value!==k?!1:b.selectedOptions.every((P,I)=>I===v||P.value===A[I])),m=v=>{T.forEach((k,A)=>{Array.from(k.options).forEach(b=>{b.disabled=!M(A,b.value,v)})})},B=()=>{let v=T.map(A=>A.value),k=C(v);if(!k){e.selected&&(E(e.selected),m(e.selected.selectedOptions.map(A=>A.value)));return}e.selected=k,e.qty=r(e.product.id,k.id),o&&(o.textContent=String(e.qty)),x(k),m(k.selectedOptions.map(A=>A.value)),i()},w=s("div","lb-bundle-variant-option-groups");p.forEach((v,k)=>{let A=s("div","lb-bundle-variant-option-group"),b=s("span","lb-bundle-variant-option-label");b.textContent=v,A.appendChild(b);let P=document.createElement("select");P.className="lb-bundle-variant-select",P.setAttribute("data-variant-option",""),P.setAttribute("data-option-position",String(k+1)),P.name=`lb-variant-${_}-${k+1}`,P.setAttribute("aria-label",v);let I=new Set;e.eligibleVariants.forEach(g=>{let y=g.selectedOptions[k]?.value;if(!y||I.has(y))return;I.add(y);let O=document.createElement("option");O.value=y,O.textContent=y,e.selected?.selectedOptions[k]?.value===y&&(O.selected=!0),P.appendChild(O)}),P.addEventListener("change",B),T.push(P),A.appendChild(P),w.appendChild(A)}),l.appendChild(w),e.selected&&m(e.selected.selectedOptions.map(v=>v.value))}else if(e.eligibleVariants.length===1&&e.product.variants.nodes.length>1){let p=s("span","lb-bundle-variant-badge");p.textContent=e.eligibleVariants[0].title,l.appendChild(p)}}return n.appendChild(l),{el:n,state:e}}function nr(e){let t=s("div","lb-bundle-pricing"),r=s("span","lb-bundle-pricing__label");r.textContent="Bundle price",t.appendChild(r);let i=s("span","lb-bundle-pricing__prices"),n=s("span","lb-bundle-compare-price",{"data-compare-price":""});n.style.display="none",i.appendChild(n);let a=s("span","lb-bundle-sale-price",{"data-sale-price":""});return i.appendChild(a),t.appendChild(i),{el:t,update({totalCents:o,saleCents:l,savingsCents:d,currency:u}){a.textContent=S(l,u),e.widgetConfig.pricing.showCompareAtPrice&&d>0?(n.textContent=S(o,u),n.style.display=""):n.style.display="none"}}}function ir(){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:i,currency:n}){if(i<=0){e.style.display="none";return}e.style.display="",r.textContent=S(i,n)}}}function or(e,t,r){let i=t>0?`${t} item${t===1?"":"s"} out of stock`:e.widgetConfig.cta.ctaText||"Add to cart",n=J(i);return t>0?n.disabled=!0:n.addEventListener("click",()=>{n.disabled||r()}),n}function ar(e,t,r){if(t.discountType==="percentage"){let i=0;for(let n of r){if(!n.selected)continue;let a=U(n.selected.price.amount),o=Math.floor(a*t.discountValue/100),l=Math.max(0,a-o);i+=l*n.qty}return i}return Math.max(0,e-Math.round(t.discountValue*100))}var Qe=`
|
|
220
220
|
<svg class="lb-bundle-placeholder-icon" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
|
|
221
221
|
<rect x="4" y="4" width="20" height="20" rx="3"></rect>
|
|
222
222
|
<line x1="4" y1="20" x2="24" y2="20"></line>
|
|
223
223
|
<circle cx="10" cy="12" r="2"></circle>
|
|
224
|
-
</svg>`,
|
|
224
|
+
</svg>`,lr=`
|
|
225
225
|
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
226
226
|
<line x1="9" y1="3" x2="9" y2="15" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
227
227
|
<line x1="3" y1="9" x2="15" y2="9" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
228
|
-
</svg>`,
|
|
228
|
+
</svg>`,Ye=`
|
|
229
229
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
230
230
|
<line x1="5" y1="5" x2="15" y2="15" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
231
231
|
<line x1="15" y1="5" x2="5" y2="15" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
232
|
-
</svg
|
|
232
|
+
</svg>`,dr=`
|
|
233
233
|
<svg width="16" height="16" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
234
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"/>
|
|
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 */
|
|
235
|
+
</svg>`;function Xe(e,t,r,i){let n=t.widgetConfig,a=t.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",o=t.minQuantity??1,l=t.maxQuantity??o,d=gr(t,n.outOfStockBehavior);if(d.filter(g=>!g.isOos).length<o)return;let c=[],h=s("div","lb-mix-match",{"data-required-quantity":String(o),"data-max-quantity":String(l)}),f=sr(t);if(h.appendChild(f),n.countdown.showCountdown&&t.endsAt){let g=X(t.endsAt);g&&(h.appendChild(g.el),i?.(g.stop))}let x=cr(o);h.appendChild(x.el);let p=s("div","lb-mix-match__slots",{"data-selection-slots":""});h.appendChild(p),h.appendChild(s("div","lb-bundle-divider"));let _=br(n.pricing.showCompareAtPrice);h.appendChild(_.el);let T=n.savingsBar.visible?hr():null;T&&h.appendChild(T.el);let C=s("div","lb-mix-match__price-placeholder",{"data-price-placeholder":""}),E=s("span","lb-mix-match__price-placeholder-text");E.textContent=`Select ${o} items to see price`,C.appendChild(E),h.appendChild(C);let M=mr(t,d,a,{showSearch:n.showSearch,onAdd:(g,y)=>v(g,y),onRemove:(g,y)=>k(g,y),isOverMax:()=>c.length>=l});h.appendChild(M.el);let m=J(`Select ${o} items to unlock`);m.disabled=!0,m.addEventListener("click",()=>{if(m.disabled)return;let g=c.map(y=>({merchandiseId:y.variantId,quantity:y.quantity,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}));r(g)}),h.appendChild(m),h.appendChild(s("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),h.appendChild(s("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(h);let B=d.find(g=>!g.isOos),w=B?.firstAvailableVariant??B?.variants[0];B&&w&&c.push({productId:B.product.id,productTitle:B.product.title,variantId:w.id,variantTitle:w.title,imageUrl:B.product.featuredImage?.url??null,priceCents:U(w.price.amount),compareCents:w.compareAtPrice?U(w.compareAtPrice.amount):null,unitPriceLabel:W(w.unitPrice,w.unitPriceMeasurement,a),quantity:N(t,B.product.id,w.id)}),b();function v(g,y){c.length>=l||(c.push({productId:g.id,productTitle:g.title,variantId:y.id,variantTitle:y.title,imageUrl:g.featuredImage?.url??null,priceCents:U(y.price.amount),compareCents:y.compareAtPrice?U(y.compareAtPrice.amount):null,unitPriceLabel:W(y.unitPrice,y.unitPriceMeasurement,a),quantity:N(t,g.id,y.id)}),b())}function k(g,y){let O=c.findIndex(K=>K.productId===g&&K.variantId===y);O!==-1&&(c.splice(O,1),b())}function A(g){g<0||g>=c.length||(c.splice(g,1),b())}function b(){P(),x.update(c.length),_.update(c,t,a),T&&T.update(c,t,a),C.style.display=c.length===0?"":"none",M.refreshCounts(),I()}function P(){p.innerHTML="";let g=Math.max(o,c.length);for(let y=0;y<g;y++){let O=c[y];O?p.appendChild(pr(O,y,a,()=>A(y))):p.appendChild(ur(y,()=>M.open()))}}function I(){let g=c.length;g<o?(m.disabled=!0,ge(m,`Select ${o-g} more to unlock`)):(m.disabled=!1,ge(m,n.cta.ctaText||"Add to cart"))}}function sr(e){let t=e.widgetConfig,r=s("div","lb-bundle-header"),i=s("div","lb-bundle-header__content"),n=s("h3","lb-bundle-title");if(n.textContent=e.title,i.appendChild(n),r.appendChild(i),t.pricing.showSaveBadge){let{discountType:a,discountValue:o}=e.discountConfig,l=null;if(a==="percentage"&&o>0?l=`-${Math.round(o)}%`:a==="fixed_amount"&&o>0&&(l=`-${S(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 cr(e){let t=s("div","lb-mix-match__progress"),r=s("div","lb-mix-match__progress-labels"),i=s("span","lb-mix-match__progress-count",{"data-progress-count":""});i.textContent=`0 of ${e} selected`,r.appendChild(i);let n=s("span","lb-mix-match__progress-remaining",{"data-progress-remaining":""});n.textContent=`${e} more to go`,r.appendChild(n),t.appendChild(r);let a=s("div","lb-mix-match__progress-track",{role:"progressbar","aria-valuenow":"0","aria-valuemin":"0","aria-valuemax":String(e)}),o=s("div","lb-mix-match__progress-fill",{"data-progress-fill":""});o.style.width="0%",a.appendChild(o),t.appendChild(a);function l(d){let u=Math.min(100,d/e*100);i.textContent=`${d} of ${e} selected`,d>=e?n.textContent="Complete":n.textContent=`${e-d} more to go`,o.style.width=`${u}%`,a.setAttribute("aria-valuenow",String(Math.min(d,e)))}return{el:t,update:l}}function ur(e,t){let r=s("div","lb-bundle-product-row lb-mix-match__slot lb-mix-match__slot--empty",{"data-slot":String(e+1),tabindex:"0",role:"button","aria-label":"Add a product to the bundle"}),i=s("div","lb-mix-match__empty-thumb");i.innerHTML=lr,r.appendChild(i);let n=s("span","lb-mix-match__empty-text");return n.textContent="Choose an item",r.appendChild(n),r.addEventListener("click",t),r.addEventListener("keydown",a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),t())}),r}function pr(e,t,r,i){let n=s("div","lb-bundle-product-row lb-mix-match__slot lb-mix-match__slot--filled",{"data-slot":String(t+1)}),a=s("div","lb-bundle-thumbnail",{"data-thumbnail":""});if(e.imageUrl){let p=document.createElement("img");p.src=Y(e.imageUrl,{width:H,height:H,crop:"center"}),p.alt=e.productTitle,p.width=H,p.height=H,p.loading="lazy",a.appendChild(p)}else a.insertAdjacentHTML("beforeend",Qe);let o=s("span","lb-bundle-qty-badge");o.textContent=String(e.quantity),a.appendChild(o),n.appendChild(a);let l=s("div","lb-mix-match__filled-info"),d=s("span","lb-mix-match__filled-title");if(d.textContent=e.productTitle,l.appendChild(d),e.variantTitle&&e.variantTitle!=="Default Title"){let p=s("span","lb-mix-match__filled-variant");p.textContent=e.variantTitle,l.appendChild(p)}let u=e.priceCents*e.quantity,c=e.compareCents!==null?e.compareCents*e.quantity:null,h=s("span","lb-mix-match__filled-price");if(c!==null&&c>u){let p=s("span","lb-mix-match__filled-compare");p.textContent=S(c,r),h.appendChild(p)}let f=document.createElement("span");if(f.textContent=S(u,r),h.appendChild(f),l.appendChild(h),e.unitPriceLabel){let p=s("span","lb-bundle-product-unit-price");p.textContent=e.unitPriceLabel,l.appendChild(p)}n.appendChild(l);let x=document.createElement("button");return x.type="button",x.className="lb-mix-match__slot-remove",x.setAttribute("aria-label",`Remove ${e.productTitle}`),x.innerHTML=Ye,x.addEventListener("click",p=>{p.stopPropagation(),i()}),n.appendChild(x),n}function br(e){let t=s("div","lb-bundle-pricing",{"data-pricing-section":""});t.style.display="none";let r=s("span","lb-bundle-pricing__label");r.textContent="Bundle price",t.appendChild(r);let i=s("span","lb-bundle-pricing__prices"),n=s("span","lb-bundle-compare-price",{"data-compare-price":""});e&&i.appendChild(n);let a=s("span","lb-bundle-sale-price",{"data-sale-price":""});i.appendChild(a),t.appendChild(i);function o(l,d,u){if(l.length===0){t.style.display="none";return}t.style.display="";let c=l.reduce((f,x)=>f+x.priceCents*x.quantity,0),h=ie(c,d.discountConfig);e&&c>h?(n.textContent=S(c,u),n.style.display=""):n.style.display="none",a.textContent=S(h,u)}return{el:t,update:o}}function hr(){let e=s("div","lb-bundle-savings-bar",{"data-savings-bar":""});e.style.display="none";let t=document.createElement("span");t.textContent="You save",e.appendChild(t);let r=s("span","",{"data-savings-amount":""});e.appendChild(r);function i(n,a,o){if(n.length===0){e.style.display="none";return}let l=n.reduce((c,h)=>c+h.priceCents*h.quantity,0),d=ie(l,a.discountConfig),u=Math.max(0,l-d);if(u<=0){e.style.display="none";return}e.style.display="",r.textContent=S(u,o)}return{el:e,update:i}}function mr(e,t,r,i){let n=s("div","lb-mix-match__modal-overlay",{"data-modal-overlay":"","data-bundle-gid":e.id});n.style.display="none";let a=s("div","lb-mix-match__modal",{role:"dialog","aria-modal":"true","aria-labelledby":`lb-modal-title-${Ke(e.id)}`,tabindex:"-1"}),o=s("div","lb-mix-match__modal-header"),l=s("h4","lb-mix-match__modal-title",{id:`lb-modal-title-${Ke(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=Ye,d.addEventListener("click",v),o.appendChild(d),a.appendChild(o);let u=null,c=null;if(i.showSearch){let b=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",()=>E()),b.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=dr,c.addEventListener("click",()=>{u&&(u.value="",E(),u.focus())}),b.appendChild(c),a.appendChild(b)}let h=s("div","lb-mix-match__modal-list",{"data-modal-list":""});a.appendChild(h);let f=s("div","lb-mix-match__modal-empty",{"data-modal-empty":""});f.style.display="none";let x=document.createElement("p");x.textContent="No products match your search.",f.appendChild(x),a.appendChild(f);let p=s("span","lb-visually-hidden",{"data-modal-live":"","aria-live":"polite"});a.appendChild(p),n.appendChild(a);let _=!1,T=[];function C(){_||(_=!0,h.innerHTML="",t.forEach(b=>{let P=b.variants,I=b.variants.find(L=>L.availableForSale)??b.firstAvailableVariant??b.variants[0];if(!I)return;let g=I,y=s("div",b.isOos?"lb-mix-match__modal-product lb-mix-match__modal-product--sold-out":"lb-mix-match__modal-product",{"data-product-id":b.product.id.replace(/^.*\//,"")}),O=s("div","lb-mix-match__modal-product-thumb");if(b.product.featuredImage){let L=document.createElement("img");L.src=Y(b.product.featuredImage.url,{width:H,height:H,crop:"center"}),L.alt=b.product.featuredImage.altText??b.product.title,L.width=H,L.height=H,L.loading="lazy",O.appendChild(L)}else O.insertAdjacentHTML("beforeend",Qe);let K=s("span","lb-bundle-qty-badge");K.textContent=String(N(e,b.product.id,g.id)),O.appendChild(K),y.appendChild(O);let z=s("div","lb-mix-match__modal-product-info"),ve=s("p","lb-mix-match__modal-product-title");ve.textContent=b.product.title,z.appendChild(ve);let de=s("p","lb-mix-match__modal-product-price");de.textContent=S(U(g.price.amount)*N(e,b.product.id,g.id),r),z.appendChild(de);let j=s("p","lb-mix-match__modal-product-unit-price lb-bundle-product-unit-price"),xe=W(g.unitPrice,g.unitPriceMeasurement,r);xe?j.textContent=xe:j.hidden=!0,z.appendChild(j);let se={el:y,product:b.product,variant:I,updateCount:()=>{}};if(P.length>1){let L=P[0].selectedOptions.map(F=>F.name),ct=b.product.id.replace(/^.*\//,""),re=[],ut=F=>P.find(R=>R.selectedOptions.length===F.length&&R.selectedOptions.every((q,V)=>q.value===F[V]))??null,pt=F=>{F.selectedOptions.forEach((R,q)=>{let V=re[q];V&&V.value!==R.value&&(V.value=R.value)})},bt=(F,R,q)=>P.some(V=>!V.availableForSale||V.selectedOptions[F]?.value!==R?!1:V.selectedOptions.every((D,Z)=>Z===F||D.value===q[Z])),ce=F=>{re.forEach((R,q)=>{Array.from(R.options).forEach(V=>{V.disabled=!bt(q,V.value,F)})})},ht=()=>{let F=re.map(D=>D.value),R=ut(F);if(!R){pt(g),ce(g.selectedOptions.map(D=>D.value));return}g=R,se.variant=R;let q=N(e,b.product.id,g.id);de.textContent=S(U(g.price.amount)*q,r);let V=W(g.unitPrice,g.unitPriceMeasurement,r);V?(j.textContent=V,j.hidden=!1):(j.textContent="",j.hidden=!0),ce(R.selectedOptions.map(D=>D.value)),Ce()},ye=s("div","lb-bundle-variant-option-groups");L.forEach((F,R)=>{let q=s("div","lb-bundle-variant-option-group"),V=s("span","lb-bundle-variant-option-label");V.textContent=F,q.appendChild(V);let D=document.createElement("select");D.className="lb-mix-match__variant-select",D.setAttribute("data-variant-option",""),D.setAttribute("data-option-position",String(R+1)),D.name=`lb-variant-${ct}-${R+1}`,D.setAttribute("aria-label",F);let Z=new Set;P.forEach(mt=>{let Q=mt.selectedOptions[R]?.value;if(!Q||Z.has(Q))return;Z.add(Q);let ne=document.createElement("option");ne.value=Q,ne.textContent=Q,I.selectedOptions[R]?.value===Q&&(ne.selected=!0),D.appendChild(ne)}),D.addEventListener("change",ht),re.push(D),q.appendChild(D),ye.appendChild(q)}),z.appendChild(ye),ce(I.selectedOptions.map(F=>F.value))}else if(P.length===1&&I.title!=="Default Title"){let L=s("span","lb-mix-match__filled-variant");L.textContent=I.title,z.appendChild(L)}if(b.isOos){let L=s("span","lb-mix-match__modal-sold-out-label");L.textContent="Sold out",z.appendChild(L)}y.appendChild(z);let Ce=()=>{K.textContent=String(N(e,b.product.id,g.id))};if(!b.isOos){let L=document.createElement("button");L.type="button",L.className="lb-mix-match__modal-add",L.textContent="Add",L.addEventListener("click",()=>{i.isOverMax()||(i.onAdd(b.product,g),v())}),y.appendChild(L)}se.updateCount=b.isOos?()=>{}:Ce,T.push(se),h.appendChild(y)}),A())}function E(){if(!u)return;let b=u.value.trim().toLowerCase();c&&(c.style.display=b?"":"none");let P=0;T.forEach(I=>{let g=!b||I.product.title.toLowerCase().includes(b);I.el.style.display=g?"":"none",g&&P++}),f.style.display=P===0&&b?"":"none"}let M=null;function m(b){if(b.key==="Escape"){b.preventDefault(),v();return}b.key==="Tab"&&fr(b,a)}let B=!1;function w(){B||i.isOverMax()||(B=!0,C(),M=n.getRootNode().activeElement,n.style.display="",n.classList.add("lb-mix-match__modal-overlay--open"),a.focus(),document.addEventListener("keydown",m),n.addEventListener("click",k))}function v(){B&&(B=!1,n.classList.remove("lb-mix-match__modal-overlay--open"),n.style.display="none",document.removeEventListener("keydown",m),n.removeEventListener("click",k),M instanceof HTMLElement&&M.focus())}function k(b){b.target===n&&v()}function A(){T.forEach(b=>b.updateCount())}return{el:n,open:w,close:v,refreshCounts:A}}function gr(e,t){let r=[],i=new Set;for(let n of e.products){if(i.has(n.id))continue;i.add(n.id);let a=n.variants.nodes.filter(l=>l.availableForSale),o=a.length===0;o&&t==="hide"||r.push({product:n,variants:n.variants.nodes,firstAvailableVariant:a[0]??null,isOos:o})}return r}function fr(e,t){let r=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(r.length===0)return;let i=r[0],n=r[r.length-1],a=t.getRootNode().activeElement;e.shiftKey&&a===i?(e.preventDefault(),n.focus()):!e.shiftKey&&a===n&&(e.preventDefault(),i.focus())}function Ke(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function tt(e,t,r,i){let n=t.widgetConfig,o=t.products[0]?.variants.nodes.find(m=>m.availableForSale);if(!o&&n.outOfStockBehavior==="hide")return;let l=o?U(o.price.amount):0,d=o?.price.currencyCode??"USD",u=t.discountConfig.discountType,c=t.volumeTiers.map((m,B)=>{let w;if(u==="fixed_amount"){let v=Math.round((m.amount??0)*100);w=Math.max(0,l-v)}else{let v=m.percentage??0,k=Math.floor(l*v/100);w=Math.max(0,l-k)}return{tier:m,index:B,qty:m.minQuantity,pricePerUnitCents:w,basePricePerUnitCents:l}}),h=yr(c),f=n.defaultTier==="best_value"?h:0;typeof n.defaultTier=="number"&&(f=et(n.defaultTier,0,c.length-1));let x=n.popularBadge.tierIndex!==void 0?et(n.popularBadge.tierIndex,0,c.length-1):h,p=s("div","lb-volume");if(p.appendChild(vr(t,c,f,d,u)),n.countdown.showCountdown&&t.endsAt){let m=X(t.endsAt);m&&(p.appendChild(m.el),i?.(m.stop))}let _=s("div","lb-volume__tiers",{role:"radiogroup","aria-label":"Quantity tiers","data-tier-group":""});c.forEach(m=>{let B=xr(m,m.index===f,d,n.popularBadge.visible&&m.index===x?n.popularBadge.text:null,n.pricing.showComparePrice,n.pricing.showPerUnitPrice);B.addEventListener("click",()=>M(m.index)),B.addEventListener("keydown",w=>{if(w.key==="Enter"||w.key===" "){w.preventDefault(),M(m.index);return}if(w.key==="ArrowDown"||w.key==="ArrowRight"||w.key==="ArrowUp"||w.key==="ArrowLeft"){w.preventDefault();let v=w.key==="ArrowDown"||w.key==="ArrowRight"?1:-1,k=(m.index+v+c.length)%c.length;M(k),_.children[k]?.focus()}}),_.appendChild(B)}),p.appendChild(_),p.appendChild(s("div","lb-bundle-divider"));let T=Je(c,f,d,n.pricing.showItemCount,n.pricing.showCompareAtPrice);p.appendChild(T);let C=n.savingsBar.visible?Ze(c,f,d):null;C&&p.appendChild(C);let E=Cr(t,()=>{if(!o)return;let m=c[f];m&&r([{merchandiseId:o.id,quantity:m.qty,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}])});p.appendChild(E),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);function M(m){if(m===f||m<0||m>=c.length)return;f=m,Array.from(_.children).forEach((v,k)=>{v.setAttribute("aria-checked",String(k===m)),v.tabIndex=k===m?0:-1});let B=Je(c,m,d,n.pricing.showItemCount,n.pricing.showCompareAtPrice);if(T.replaceWith(B),T=B,C){let v=Ze(c,m,d);C.replaceWith(v),C=v}let w=p.querySelector("[data-header-badge]");if(w){let v=rt(c[m],d,u);v?(w.textContent=v,w.style.display=""):w.style.display="none"}}}function vr(e,t,r,i,n){let a=e.widgetConfig,o=s("div","lb-bundle-header"),l=s("div","lb-bundle-header__content"),d=s("h3","lb-bundle-title");if(d.textContent=e.title,l.appendChild(d),o.appendChild(l),a.pricing.showSaveBadge){let u=rt(t[r],i,n);if(u){let c=s("span","lb-bundle-header__badge",{"data-header-badge":""});c.textContent=u,o.appendChild(c)}}return o}function xr(e,t,r,i,n,a){let o=s("div","lb-volume__tier",{role:"radio","aria-checked":String(t),tabindex:t?"0":"-1","data-tier-index":String(e.index),"data-tier-qty":String(e.qty)}),l=s("span","lb-volume__radio");l.appendChild(s("span","lb-volume__radio-dot")),o.appendChild(l);let d=s("span","lb-volume__tier-grid"),u=s("span","lb-volume__tier-label");u.textContent=`Buy ${e.qty}`,d.appendChild(u);let c=s("span","lb-volume__tier-price");if(n&&e.pricePerUnitCents<e.basePricePerUnitCents){let f=s("span","lb-volume__tier-compare");f.textContent=S(e.basePricePerUnitCents,r),c.appendChild(f)}if(a){let f=document.createElement("span");f.setAttribute("data-tier-price-each",""),f.textContent=S(e.pricePerUnitCents,r),c.appendChild(f);let x=s("span","lb-volume__tier-unit");x.textContent=" each",c.appendChild(x)}d.appendChild(c),o.appendChild(d);let h=s("span","lb-volume__tier-badge");return i?h.textContent=i:h.style.display="none",o.appendChild(h),o}function Je(e,t,r,i,n){let a=e[t],o=a?a.pricePerUnitCents*a.qty:0,l=a?a.basePricePerUnitCents*a.qty:0,d=Math.max(0,l-o),u=s("div","lb-bundle-pricing"),c=s("span","lb-bundle-pricing__label",{"data-total-label":""});if(c.textContent="Total",i&&a){let x=document.createElement("span");x.setAttribute("data-item-count",""),x.textContent=` (${a.qty} item${a.qty===1?"":"s"})`,c.appendChild(x)}u.appendChild(c);let h=s("span","lb-bundle-pricing__prices");if(n&&d>0){let x=s("span","lb-bundle-compare-price",{"data-compare-price":""});x.textContent=S(l,r),h.appendChild(x)}let f=s("span","lb-bundle-sale-price",{"data-total-price":""});return f.textContent=S(o,r),h.appendChild(f),u.appendChild(h),u}function Ze(e,t,r){let i=e[t],n=i?i.pricePerUnitCents*i.qty:0,a=i?i.basePricePerUnitCents*i.qty:0,o=Math.max(0,a-n),l=s("div","lb-bundle-savings-bar",{"data-savings-bar":""});o<=0&&(l.style.display="none");let d=document.createElement("span");d.textContent="You save",l.appendChild(d);let u=s("span","",{"data-savings-amount":""});return u.textContent=S(o,r),l.appendChild(u),l}function Cr(e,t){let i=e.products[0]?.variants.nodes.some(o=>o.availableForSale),n=i?e.widgetConfig.cta.ctaText||"Add to cart":"Sold out",a=J(n);return i||(a.disabled=!0),a.addEventListener("click",()=>{a.disabled||t()}),a}function rt(e,t,r){if(!e)return null;let{tier:i}=e;if(r==="fixed_amount"){let n=i.amount??0;return n>0?`-${S(Math.round(n*100),t)}`:null}if(r==="percentage"){let n=i.percentage??0;return n>0?`-${Math.round(n)}%`:null}return null}function yr(e){let t=0,r=0;return e.forEach((i,n)=>{let a=i.basePricePerUnitCents-i.pricePerUnitCents;a>t&&(t=a,r=n)}),r}function et(e,t,r){return Math.max(t,Math.min(r,e))}var wr=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown","Enter"," ","Escape"]),oe=new Set,ae=!1;function nt(e){let t=e==="using-mouse"?"using-keyboard":"using-mouse";for(let r of oe)r.classList.add(e),r.classList.remove(t)}function it(e){wr.has(e.key)&&nt("using-keyboard")}function ot(){nt("using-mouse")}function _r(){ae||(ae=!0,document.addEventListener("keydown",it,!0),document.addEventListener("pointerdown",ot,!0))}function kr(){ae&&(ae=!1,document.removeEventListener("keydown",it,!0),document.removeEventListener("pointerdown",ot,!0))}function le(e){return e.classList.add("using-mouse"),e.classList.remove("using-keyboard"),oe.add(e),_r(),()=>{oe.delete(e),e.classList.remove("using-mouse"),e.classList.remove("using-keyboard"),oe.size===0&&kr()}}var fe=`/* Lime Bundles \u2014 shared base styles for all bundle widget types */
|
|
236
236
|
|
|
237
237
|
.lb-bundle-widget.lb-bundle-widget,
|
|
238
238
|
.lb-bundle-widget.lb-bundle-widget * {
|
|
@@ -515,6 +515,56 @@
|
|
|
515
515
|
margin-top: 8px;
|
|
516
516
|
}
|
|
517
517
|
|
|
518
|
+
/* Per-option variant pickers. Each option's label + select sit inside a
|
|
519
|
+
.lb-bundle-variant-option-group (flex column, 2px gap between label and
|
|
520
|
+
select); the groups stack inside a .lb-bundle-variant-option-groups
|
|
521
|
+
parent (flex column, 12px gap between groups). The parent owns the top
|
|
522
|
+
offset from the preceding unit-price line, so individual labels and
|
|
523
|
+
selects don't carry their own vertical margins. */
|
|
524
|
+
.lb-bundle-variant-option-groups {
|
|
525
|
+
display: flex;
|
|
526
|
+
flex-direction: column;
|
|
527
|
+
gap: 12px;
|
|
528
|
+
margin-top: 8px;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.lb-bundle-variant-option-group {
|
|
532
|
+
display: flex;
|
|
533
|
+
flex-direction: column;
|
|
534
|
+
gap: 2px;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
.lb-bundle-variant-option-label {
|
|
538
|
+
display: block;
|
|
539
|
+
margin: 0;
|
|
540
|
+
font-size: 12px;
|
|
541
|
+
line-height: 16px;
|
|
542
|
+
font-weight: 600;
|
|
543
|
+
letter-spacing: 0.05em;
|
|
544
|
+
text-transform: uppercase;
|
|
545
|
+
color: color-mix(in srgb, var(--lb-text) 60%, transparent);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
.lb-mix-match__modal-product-info .lb-bundle-variant-option-groups {
|
|
549
|
+
margin-top: 4px;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/* Focus-ring suppression for mouse users. A small JS helper \u2014 see
|
|
553
|
+
packages/widget/src/utils/input-mode.ts and bundle-widget.js \u2014 toggles
|
|
554
|
+
.using-mouse / .using-keyboard on the widget root (or html in the Liquid
|
|
555
|
+
path) based on the customer's current input device. Default is mouse, so
|
|
556
|
+
click-to-focus doesn't leave a keyboard-style ring. The modal overlay
|
|
557
|
+
gets its own selector because the Liquid path reparents it to body,
|
|
558
|
+
outside the widget root. */
|
|
559
|
+
.using-mouse .lb-bundle-widget :focus,
|
|
560
|
+
.using-mouse .lb-bundle-widget :focus-visible,
|
|
561
|
+
.using-mouse .lb-mix-match__modal-overlay :focus,
|
|
562
|
+
.using-mouse .lb-mix-match__modal-overlay :focus-visible {
|
|
563
|
+
outline: none;
|
|
564
|
+
outline-offset: 0;
|
|
565
|
+
box-shadow: none;
|
|
566
|
+
}
|
|
567
|
+
|
|
518
568
|
.lb-bundle-quantity {
|
|
519
569
|
font-size: 12px;
|
|
520
570
|
line-height: 16px;
|
|
@@ -740,7 +790,7 @@
|
|
|
740
790
|
.lb-ab-pending {
|
|
741
791
|
visibility: hidden;
|
|
742
792
|
}
|
|
743
|
-
`,
|
|
793
|
+
`,at=`/* Lime Bundles \u2014 Fixed bundle styles */
|
|
744
794
|
|
|
745
795
|
.lb-fixed__products {
|
|
746
796
|
display: flex;
|
|
@@ -771,9 +821,10 @@
|
|
|
771
821
|
border: none;
|
|
772
822
|
}
|
|
773
823
|
|
|
774
|
-
/* Variant picker select \u2014 styled to match the variant badge aesthetic
|
|
824
|
+
/* Variant picker select \u2014 styled to match the variant badge aesthetic.
|
|
825
|
+
Sits inside .lb-bundle-variant-option-group so vertical spacing is owned
|
|
826
|
+
by the group/groups flex gap, not the select itself. */
|
|
775
827
|
.lb-bundle-variant-select {
|
|
776
|
-
margin-top: 8px;
|
|
777
828
|
display: inline-block;
|
|
778
829
|
border: var(--lb-variant-border-width) solid var(--lb-variant-border-color);
|
|
779
830
|
border-radius: var(--lb-variant-radius);
|
|
@@ -790,14 +841,15 @@
|
|
|
790
841
|
background-repeat: no-repeat;
|
|
791
842
|
background-position: right 8px center;
|
|
792
843
|
background-size: 12px;
|
|
793
|
-
|
|
844
|
+
width: 50%;
|
|
845
|
+
max-width: 50%;
|
|
794
846
|
}
|
|
795
847
|
|
|
796
848
|
.lb-bundle-variant-select:focus-visible {
|
|
797
849
|
outline: 2px solid var(--lb-primary-color);
|
|
798
850
|
outline-offset: 2px;
|
|
799
851
|
}
|
|
800
|
-
`,
|
|
852
|
+
`,lt=`/* Lime Bundles \u2014 Mix & Match styles */
|
|
801
853
|
|
|
802
854
|
/* === Progress Bar === */
|
|
803
855
|
.lb-mix-match__progress {
|
|
@@ -1196,7 +1248,6 @@
|
|
|
1196
1248
|
|
|
1197
1249
|
.lb-mix-match__variant-select {
|
|
1198
1250
|
font-size: 12px;
|
|
1199
|
-
margin: 4px 0 0;
|
|
1200
1251
|
padding: 4px 24px 4px 8px;
|
|
1201
1252
|
border: var(--lb-picker-variant-border-width) solid var(--lb-picker-variant-border-color);
|
|
1202
1253
|
border-radius: var(--lb-picker-variant-radius);
|
|
@@ -1209,7 +1260,8 @@
|
|
|
1209
1260
|
font-family: inherit;
|
|
1210
1261
|
min-height: 32px;
|
|
1211
1262
|
cursor: pointer;
|
|
1212
|
-
|
|
1263
|
+
width: 50%;
|
|
1264
|
+
max-width: 50%;
|
|
1213
1265
|
appearance: none;
|
|
1214
1266
|
-webkit-appearance: none;
|
|
1215
1267
|
}
|
|
@@ -1293,6 +1345,11 @@
|
|
|
1293
1345
|
.lb-mix-match__modal-overlay--open .lb-mix-match__modal {
|
|
1294
1346
|
transform: translateY(0);
|
|
1295
1347
|
}
|
|
1348
|
+
|
|
1349
|
+
.lb-mix-match__variant-select {
|
|
1350
|
+
width: 80%;
|
|
1351
|
+
max-width: 80%;
|
|
1352
|
+
}
|
|
1296
1353
|
}
|
|
1297
1354
|
|
|
1298
1355
|
/* === Reduced Motion === */
|
|
@@ -1303,7 +1360,7 @@
|
|
|
1303
1360
|
transition: none;
|
|
1304
1361
|
}
|
|
1305
1362
|
}
|
|
1306
|
-
`,
|
|
1363
|
+
`,dt=`/* Lime Bundles \u2014 Volume / Quantity Breaks styles */
|
|
1307
1364
|
|
|
1308
1365
|
.lb-volume__tiers {
|
|
1309
1366
|
display: flex;
|
|
@@ -1413,7 +1470,7 @@
|
|
|
1413
1470
|
}
|
|
1414
1471
|
|
|
1415
1472
|
|
|
1416
|
-
`,
|
|
1473
|
+
`,st=`/* Lime Bundles \u2014 web-component loading skeleton (not mirrored to theme assets) */
|
|
1417
1474
|
|
|
1418
1475
|
.lb-bundle-widget--loading {
|
|
1419
1476
|
display: block;
|
|
@@ -1509,10 +1566,10 @@
|
|
|
1509
1566
|
animation: none;
|
|
1510
1567
|
}
|
|
1511
1568
|
}
|
|
1512
|
-
`;var
|
|
1513
|
-
`),this.shadow.appendChild(t),this.shopCustomCss){let
|
|
1514
|
-
<style>${
|
|
1515
|
-
<style>${
|
|
1569
|
+
`;var Br=e=>`lb_cart_id:${e}`;function Sr(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 te=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,i){r===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 r=pe({shopDomain:this.shopDomain,accessToken:this.storefrontToken});try{let i,n=!1;if(this.bundleGid)n=!0,i=this.fetchSingleBundle(r,t.signal);else{let l=Sr(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}i=this.fetchProductBundles(r,t.signal,l)}let a=r.query(Le,void 0,{signal:t.signal}).catch(()=>null);if(await i,t.signal.aborted)return;if(n&&this.bundles.length===0){this.teardownImpressions(),this.renderError("Bundle not found");return}let o=await a;if(o?.shop?.metafield?.value){We(this.shopDomain,o.shop.metafield.value);let l=he(o.shop.metafield.value);l.ok&&(this.shopCustomCss=l.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 r=>{if(!r.abTestId||!r.abVariantB)return r;try{if((await Ne(this.appUrl,this.shopDomain,r.abTestId,r.id))?.variant==="B")return De(r)}catch(i){console.warn(`[lime-bundle] A/B assignment failed for bundle ${r.id}; falling back to Variant A.`,i)}return r}));this.bundles=t}async fetchSingleBundle(t,r){let i=await t.query(Pe,{id:this.bundleGid},{signal:r});if(!i.metaobject){this.bundles=[];return}let n=be(i.metaobject.id,i.metaobject.fields);this.bundles=n?[n]:[]}async fetchProductBundles(t,r,i){let n=await t.query(Me,{handle:i},{signal:r});if(!n.product){this.bundles=[];return}let a=n.product.metafield?.references?.nodes??[],o=[];for(let l of a){let d=be(l.id,l.fields);d&&o.push(d)}this.bundles=o}handleAddToCart=async(t,r)=>{let i=new CustomEvent("lime-bundle:add-to-cart",{detail:{lines:r},bubbles:!0,composed:!0,cancelable:!0}),n=this.dispatchEvent(i);this.reportAddToCartEvent(t,r),n&&await this.defaultAddToCart(r)};async defaultAddToCart(t){if(typeof window>"u")return;let r=pe({shopDomain:this.shopDomain,accessToken:this.storefrontToken}),i=window.localStorage,n=Br(this.shopDomain),a=i?.getItem(n)??null;try{let o=null;if(a){let d=(await r.query(Ie,{cartId:a,lines:t})).cartLinesAdd;d?.userErrors?.length?i?.removeItem(n):d?.cart&&(o=d.cart.checkoutUrl)}if(!o){let d=(await r.query(Re,{input:{lines:t}})).cartCreate;d?.cart&&(i?.setItem(n,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 i=r.reduce((a,o)=>a+o.quantity,0),n=r.reduce((a,o)=>{let d=t.products.find(c=>c.variants.nodes.some(h=>h.id===o.merchandiseId))?.variants.nodes.find(c=>c.id===o.merchandiseId),u=d?parseFloat(d.price.amount):0;return a+u*o.quantity},0);Oe({shopDomain:this.shopDomain,appUrl:this.appUrl},{bundleGid:t.id,bundleType:t.bundleType,productId:t.products[0]?.id??"",quantity:i,totalPrice:Math.round(n*100)/100})}renderBundles(){this.teardownImpressions(),this.teardownRenderers(),this.shadow.innerHTML="";let t=document.createElement("style");if(t.textContent=[fe,at,lt,dt].join(`
|
|
1570
|
+
`),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 n=document.createElement("div");n.className="lb-bundle-widget",n.setAttribute("role","region"),n.setAttribute("aria-label",i.title),n.setAttribute("data-bundle-type",i.bundleType),n.setAttribute("data-bundle-gid",i.id),Fe(n,i.widgetConfig),this.renderCleanups.push(le(n));let a=l=>this.handleAddToCart(i,l),o=l=>this.renderCleanups.push(l);switch(i.bundleType){case"fixed":Ge(n,i,a,o);break;case"mix_match":Xe(n,i,a,o);break;case"volume":tt(n,i,a,o);break}this.shadow.appendChild(n),this.setupImpressionFor(i,n)}let r=this.bundles[0];this.dispatchEvent(new CustomEvent("lime-bundle:loaded",{detail:{bundleCount:this.bundles.length,bundleTypes:this.bundles.map(i=>i.bundleType),bundleType:r?.bundleType,title:r?.title},bubbles:!0,composed:!0}))}setupImpressionFor(t,r){if(!this.analyticsEnabled||!this.appUrl)return;let i=He(r,()=>{Ue({shopDomain:this.shopDomain,appUrl:this.appUrl},{bundleGid:t.id,bundleType:t.bundleType})});this.impressionCleanups.push(i)}renderLoading(){this.shadow.innerHTML=`
|
|
1571
|
+
<style>${fe}</style>
|
|
1572
|
+
<style>${st}</style>
|
|
1516
1573
|
<div class="lb-bundle-widget lb-bundle-widget--loading" aria-busy="true" aria-label="Loading bundle">
|
|
1517
1574
|
<div class="lb-skeleton lb-skeleton--title"></div>
|
|
1518
1575
|
<div class="lb-skeleton--products">
|
|
@@ -1546,5 +1603,5 @@
|
|
|
1546
1603
|
<div class="lb-skeleton lb-skeleton--cta"></div>
|
|
1547
1604
|
</div>
|
|
1548
1605
|
</div>
|
|
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",
|
|
1606
|
+
`}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",te);return yt(Tr);})();
|
|
1550
1607
|
//# sourceMappingURL=lime-bundle.global.js.map
|