yt-uikit 0.9.6 → 0.9.8

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/esm/index.js CHANGED
@@ -2923,7 +2923,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
2923
2923
  text-align: center;
2924
2924
  display: flex;
2925
2925
  flex-shrink: 0;
2926
- `,zc=({tiers:t,isMobile:n=!1,selectedProductsByTier:o,selectedProducts:r,themeColor:i,showProductDetailsInTracker:a,handleRemoveItemProductTier:l,cornerRadius:c,currencySymbol:s})=>e.createElement(e.Fragment,null,t.map((i,d)=>{const p=i.minimumQuantity-(o[d]?.length??0),u=r?.filter(e=>e.tierIndex===d);return Math.min(o[d]?.length/i.minimumQuantity*100,100),e.createElement("div",{className:"yt-byob-tracker-product-list-tier-wrapper",style:{display:"flex",width:"100%"}},e.createElement("div",{className:"yt-byob-tracker-product-list-tier-items"},e.createElement("div",{className:"yt-byob-tracker-product-list-items",style:{display:"flex",gap:"5px"}},u?.map?.(t=>{const r=t.product.variants?.edges?.find(e=>e.node.id===t.variantId),p=o[d]?.filter(e=>e===r?.node.id).length||0;return a?e.createElement($c,{className:"yt-byob-tracker-detailed-product-item",key:t.variantId},e.createElement(dc,{className:"yt-byob-tracker-detailed-image",style:{backgroundImage:`url(${r?.node.image?.url&&r?.node.image?.url?.length>0?r?.node.image.url:t.product.featuredMedia?.preview?.image?.url})`}},t?.isFree&&e.createElement("div",{style:{position:"absolute",bottom:4,left:"30%",background:"linear-gradient(135deg, #ff0080, #ff4d4d)",color:"white",fontWeight:900,fontSize:"8px",padding:"4px 6px",borderRadius:"40px",letterSpacing:"1.5px",textTransform:"uppercase",boxShadow:"0 6px 20px rgba(255, 0, 128, 0.7)",zIndex:20,border:"1px solid white",animation:"popup 0.6s ease-out"}},"FREE",e.createElement("style",null,"\n @keyframes popup {\n 0% { transform: scale(0) rotate(-30deg); opacity: 0; }\n 70% { transform: scale(1.3); }\n 100% { transform: scale(1); }\n }\n ")),t?.quantity>1&&e.createElement(lc,{className:"yt-byob-tracker-quantity-badge",borderRadius:c},t.quantity,"x")),e.createElement(uc,{className:"yt-byob-tracker-info-block"},e.createElement(mc,{className:"yt-byob-tracker-product-title"},t.product.title),e.createElement(gc,{className:"yt-byob-tracker-product-price"},s,Pp(r?.node?.price)),e.createElement(cc,{className:"yt-byob-tracker-remove-detailed-btn",onClick:()=>l(t.variantId,d),style:{...1===i.minimumQuantity&&1===i.products.length&&1===o[d]?.length?{display:"none"}:{}}},e.createElement(lt,null),e.createElement("span",null,"Remove")))):e.createElement("div",{className:"yt-byob-tracker-product-item",key:t.variantId},e.createElement(Sc,{className:"yt-byob-tracker-product-list-item",isMobile:n,borderRadius:c,imageUrl:r?.node.image?.url&&r?.node.image?.url?.length>0?r?.node.image.url:t.product.featuredMedia?.preview?.image?.url,style:{borderRadius:c||"12px"}},t?.isFree&&e.createElement("div",{style:{position:"absolute",top:4,left:4,background:"linear-gradient(135deg, #ff0080, #ff4d4d)",color:"white",fontWeight:900,fontSize:"8px",padding:"4px 6px",borderRadius:"8px",letterSpacing:"1.5px",textTransform:"uppercase",boxShadow:"0 6px 20px rgba(255, 0, 128, 0.7)",zIndex:20,border:"1px solid white",animation:"popup 0.6s ease-out"}},e.createElement(it,null),e.createElement("style",null,"\n @keyframes popup {\n 0% { transform: scale(0) rotate(-30deg); opacity: 0; }\n 70% { transform: scale(1.3); }\n 100% { transform: scale(1); }\n }\n ")),p>1&&e.createElement(lc,{className:"yt-byob-tracker-quantity-badge",borderRadius:c},p,"x"),e.createElement(cc,{className:"yt-byob-tracker-remove-btn",onClick:()=>l(t.variantId,d),style:{...1===i.minimumQuantity&&1===i.products.length&&1===o[d]?.length?{display:"none"}:{}}},e.createElement(J,{fontSize:"12px"}))))}),p>=1&&[...Array(p)].map((t,o)=>e.createElement(fc,{className:"yt-byob-tracker-placeholder-box",isMobile:n,borderRadius:c,key:o},e.createElement(Pe,{size:40,color:"#A0A0A0"}))))),d<t.length-1&&e.createElement(Bc,{className:"yt-byob-tracker-plus-icon-container"},e.createElement(Pe,{size:"16px",style:{backgroundColor:"#f2f2f2"}})))})),Nc=({builderTiers:o,handleAddToCart:r,minimumQuantity:i,selectedProducts:a,showProductDetailsInTracker:l,loading:c,handleRemoveItem:s,percentageOff:d,selectedItemsQuantity:p,bundleSubtotal:u,amountOff:m,styles:g,dealAmount:x,isMobile:f=!1,themeColor:y,cornerRadiusType:b,primaryTextColorCta:h,handleRemoveItemProductTier:v,selectedProductsByTier:w,storeCurrencyCode:C,isUploading:E,showNextStep:k})=>{const[T,S]=t(!1),[$,B]=t(0),[z,N]=t([]),[I,F]=t(0),[D,P]=t(0),[A,_]=t(!1),[R,O]=t(null),L=u?.price||0,M=o?.type,j=e=>{if(e<0||!z[e])return L;const t=z[e].discountValue??0;return d?L*(1-t/100):x?t:m?L-t:L};n(()=>{if(o&&"none"!==o.type)if("productTier"===M&&o.productTier){const e=o.productTier||[];N(e);let t=0;o.productTier.map(e=>{t+=e.minimumQuantity}),P(t-p)}else if(z.length)I>0&&p<z[I-1]?.minimumQuantity?(F(I-1),O(I-1)):p<z[I]?.minimumQuantity&&O(I-1),B(j(I));else{const e=o.offerTier||[];N(e),F(0),P(e[0]?.minimumQuantity-p||i-p)}else N([]),P(i-p),F(0)},[o,i,p]),n(()=>{z.length&&"productTier"!=M?(()=>{if(!z?.length)return;let e=-1,t=null,n=0;if("offerTier"===M)for(let o=0;o<z.length&&(n+=z[o].minimumQuantity,p>=n);o++)t=o,e=o+1<z.length?o+1:o;if(F(e),O(t),null!==t){let e=z.slice(0,t+1).reduce((e,t)=>e+t.minimumQuantity,0);_(e===p),S(!0),B(j(t))}else _(!1),S(!1),B(L);const o=e>=0&&e<z.length?z.slice(0,e+1).reduce((e,t)=>e+t.minimumQuantity,0)-p:z[0].minimumQuantity-p;P(o)})():p===i?(S(!0),B(d?L*(1-d/100):x||(m?L-m:L)),_(!0)):(_(!1),S(!1))},[p,z]);const V=T?Math.max(u?.compareAtPrice,u?.price):u?.compareAtPrice>u?.price?u?.compareAtPrice:null,W=T?$.toFixed(2):u?.price?.toFixed(2),H=V&&W?(V-Number(W)).toFixed(2):0,q=o&&"none"!==M&&o.offerTier?"offerTier"===M?Math.min(p/(p+D)*100,100):void 0:p/i*100;n(()=>{if(T&&g.byob.enableConfetti){console.log("remainingItems",D);const e=document.getElementById("checkoutButton");if(!e)return;const t=e.getBoundingClientRect(),n=(t.left+t.width/2)/window.innerWidth,o=(t.top+t.height/2)/window.innerHeight;Ce({particleCount:100,spread:70,origin:{x:n,y:o},zIndex:9999})}},[T,g]),I>=0&&I<z.length&&z[I].tier;const Q=e.useMemo(()=>null!==R&&z[R+1]?z[R+1]?.customText||"":o?.offerTier?.[0]?.customText||"",[R,z,o]),U="number"==typeof R?z[R]?.customText:void 0,Y="string"==typeof U&&""!==U.trim();return e.createElement(Kl,{className:"yt-byob-tracker-container bundle-builder-tracker-container "+(f?"yt-byob-tracker-mobile":"yt-byob-tracker-desktop"),isMobile:f,style:{justifyContent:g.byob.selectedProductsVisibility&&!f?"space-between":"center"}},"offerTier"==M&&null!==R&&R>=0&&e.createElement(Jl,{className:"yt-byob-tracker-offer-tier-tag"},Y?e.createElement(e.Fragment,null,U," unlocked"):e.createElement(e.Fragment,null,e.createElement(e.Fragment,null,"Buy"," ",z.slice(0,R+1).reduce((e,t)=>e+t.minimumQuantity,0)," ","at",m||x?e.createElement(e.Fragment,null," ",Ap(g.general.currencySymbol,C)):""," ",Pp(z[R]?.discountValue),d?e.createElement(e.Fragment,null,"% "):Pp(x)?e.createElement(e.Fragment,null):"",d||m?e.createElement(e.Fragment,null," Off"):""),e.createElement("span",{style:{fontStyle:"italic"}}," applied"))),f&&D>=1&&!A&&"offerTier"!==M?e.createElement(ec,{className:"yt-byob-tracker-mobile-remaining",style:{margin:"0"}},0===z.length?e.createElement(e.Fragment,null,"Select ",D," more item(s)"," ",0!==x||0!==d?"to get the bundle at":"",0!==x&&e.createElement(e.Fragment,null,` ${Ap(g.general.currencySymbol,C)}${x}`),0!==d&&e.createElement(e.Fragment,null," ",` ${d}% Off`)):e.createElement(e.Fragment,null," Select ",D," more item(s)")):e.createElement(e.Fragment,null),"productTier"!==M&&e.createElement(tc,{className:"yt-byob-tracker-tier-progress-container"},e.createElement(nc,{className:"yt-byob-tracker-tier-progress-text"},"offerTier"==M&&z.length>0&&D>0&&e.createElement(e.Fragment,null,Q?e.createElement("div",{className:"yt-byob-tracker-add-more-text",style:{padding:"4px",fontWeight:"600",...window.innerWidth<=768&&{fontSize:"12px"},color:"#121212"}},"Add ",D," more to unlock ",Q):e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-tracker-add-more-text",style:{padding:"4px",fontWeight:"600",...window.innerWidth<=768&&{fontSize:"12px"},color:"#121212"}},"Add ",D," More Item(s)",e.createElement("span",{style:{fontWeight:"500"}}," to "),"Buy ",p+D," at"," ",m||x?e.createElement(e.Fragment,null,Ap(g.general.currencySymbol,C)):""," ",Pp(z[I>=0?I:0]?.discountValue),d?e.createElement(e.Fragment,null,"% "):Pp(x)?e.createElement(e.Fragment,null):"",d||m?e.createElement(e.Fragment,null," Off"):"")))),e.createElement(oc,{className:"yt-byob-tracker-progress-bar-bg"},e.createElement(rc,{className:"yt-byob-tracker-progress-bar-fill bundle-builder-tracker-progress",progressPercentage:q??0,primaryColor:y??g?.general.primaryColor}," "))),g.byob.selectedProductsVisibility&&e.createElement(ic,{className:"yt-byob-tracker-product-list-wrapper hide-tracker-scrollbar "+(f?"yt-byob-tracker-mobile-product-list":"yt-byob-tracker-desktop-product-list"),tierType:M??"",isMobile:f},"productTier"===M?e.createElement(zc,{tiers:z,isMobile:f,selectedProductsByTier:w??{},selectedProducts:a,themeColor:g.general.primaryColor,showProductDetailsInTracker:l,handleRemoveItemProductTier:v,cornerRadius:g.byob.borderRadius,currencySymbol:Ap(g.general.currencySymbol,C)}):e.createElement(e.Fragment,null,a?.map?.(t=>{const n=t.product.variants?.edges?.find(e=>e.node.id===t.variantId);return l?e.createElement(sc,{className:"yt-byob-tracker-detailed-item-container",borderRadius:g.byob.borderRadius,key:t.variantId},e.createElement(dc,{className:"yt-byob-tracker-detailed-image",style:{backgroundImage:`url(${n?.node.image?.url&&n?.node.image?.url?.length>0?n?.node.image.url:t.product.featuredMedia?.preview?.image?.url})`}},t?.quantity>1&&e.createElement(pc,{className:"yt-byob-tracker-badge"},t.quantity,"x")),e.createElement(uc,{className:"yt-byob-tracker-info-block"},e.createElement(mc,{className:"yt-byob-tracker-product-title"},t.product.title),e.createElement(gc,{className:"yt-byob-tracker-product-price"},g.general.currencySymbol,n?.node?.price),e.createElement(xc,{className:"yt-byob-tracker-remove-link",onClick:()=>s(t.variantId)},e.createElement(lt,null),e.createElement("span",null,"Remove")))):e.createElement("div",{className:"yt-byob-tracker-product-item",key:t.variantId},e.createElement(Tc,{className:"yt-byob-tracker-item bundle-builder-tracker-item",isMobile:f,borderRadius:g.byob.borderRadius,imageUrl:n?.node.image?.url&&n?.node.image?.url?.length>0?n?.node.image.url:t.product.featuredMedia?.preview?.image?.url},t?.quantity>1&&e.createElement(lc,{className:"yt-byob-tracker-quantity-badge",borderRadius:g.byob.borderRadius},t.quantity,"x"),e.createElement(cc,{className:"yt-byob-tracker-remove-btn",onClick:()=>s(t.variantId)},e.createElement(J,{fontSize:"12px"}))))}),D>=1&&[...Array(D)].map((t,n)=>e.createElement(fc,{className:"yt-byob-tracker-placeholder-box",isMobile:f,borderRadius:g.byob.borderRadius,key:n},e.createElement(Pe,{size:40,color:"#A0A0A0"}))))),(!f||A)&&e.createElement(ac,{className:"yt-byob-tracker-summary-container bundle-summary "+(f?"yt-byob-tracker-mobile-summary":"yt-byob-tracker-desktop-summary"),isMobile:f},Number(W)>0&&e.createElement(yc,{className:"yt-byob-tracker-summary-info summary-info"},e.createElement("div",{className:"yt-byob-tracker-summary-info-content",style:{display:"flex",...window.innerWidth<=600&&{flexDirection:"column"},gap:"5px",justifyContent:"center"}},f?e.createElement("div",{className:"yt-byob-tracker-mobile-subtotal-row",style:{display:"flex",flexDirection:"row",gap:"6px",alignItems:"center"}},e.createElement(bc,{className:"yt-byob-tracker-subtotal-label"},"Subtotal"),Number(H)>0&&e.createElement(hc,{className:"yt-byob-tracker-save-label",style:{}},"Save:"," ",Ap(g.general.currencySymbol,C),Pp(H))):e.createElement(e.Fragment,null,e.createElement(bc,{className:"yt-byob-tracker-subtotal-label"},"Subtotal"),Number(H)>0&&!f&&e.createElement(hc,{className:"yt-byob-tracker-save-label"},"Save:"," ",Ap(g.general.currencySymbol,C),Pp(H)))),e.createElement(vc,{className:"yt-byob-tracker-subtotal-row"},e.createElement(wc,{className:"yt-byob-tracker-final-price"},Ap(g.general.currencySymbol,C),Number(W)>=0?Pp(Number(W).toFixed(2)):0),V&&g.byob.compareAtPriceVisibility&&Number(V)>Number(W)&&e.createElement(Cc,{className:"yt-byob-tracker-line-through-price"},Ap(g.general.currencySymbol,C),Pp(Number(V).toFixed(2))))),e.createElement(Ec,{className:"yt-byob-tracker-checkout-button yt-tracking-bar-checkout-button",canCheckout:A,progressPercentage:q??0,ctaColors:{ctaBackgroundColor:g.general.ctaBackgroundColor,ctaBorderColor:g.general.ctaBorderColor,ctaHoverBackgroundColor:g.general.ctaHoverBackgroundColor,ctaHoverTextColor:g.general.ctaHoverTextColor},borderRadius:g.general.ctaBorderRadius,disabled:!A&&D>=1||E,onClick:e=>{c||console.log("saving"),r(e.target??e.currentTarget)},id:"checkoutButton"},c?e.createElement(ue,{color:"black",loading:c,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):D>=1&&!A?e.createElement("div",{className:"yt-byob-tracker-add-more-btn-text yt-tracking-bar-checkout-button-items-text",style:{color:g.general.primaryColor}},"Add ",D," More Item(s)"):e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center"}},e.createElement(kc,{className:"yt-byob-tracker-checkout-text yt-tracking-bar-checkout-button-text",ctaTextColor:g.general.ctaTextColor,ctaHoverTextColor:h??g.general.ctaHoverTextColor},k?"Next Step":g.byob.checkoutCTAText??"Checkout"),!k&&g?.general?.showPaymentIcons&&e.createElement("div",{style:{display:"flex",alignItems:"center",marginLeft:"10px"}},e.createElement("img",{src:"https://r2.yourtoken.io/checkout-button-payment-provider-icons.png",alt:"Payment methods",style:{height:"22px",width:"auto"}}),e.createElement("svg",{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",className:"yt-cart-summary-checkout-next-icon",fontSize:"24px",height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg"},e.createElement("polyline",{fill:"none",strokeWidth:"2",points:"9 6 15 12 9 18"})))))))},Ic={8087437412:{position:"fixed",bottom:"10px",zIndex:100,width:"95%",left:"50%",transform:"translateX(-50%)",mobile:{bottom:"50px"}},66134737152:{position:"fixed",zIndex:20,width:"90%",left:"50%",transform:"translateX(-50%)",bottom:"10px"},83438567714:{zIndex:100,position:"fixed",width:"95%",left:"50%",transform:"translateX(-50%)",bottom:"10px"},72726479068:{position:"fixed",zIndex:20,width:"90%",left:"50%",transform:"translateX(-50%)",bottom:"10px",mobile:{bottom:"70px"}},64800161992:{zIndex:20,mobile:{bottom:"50px"},position:"sticky",bottom:"10px"},53933408435:{zIndex:5,mobile:{bottom:"60px"},position:"sticky",bottom:"10px"},68377018594:{zIndex:5,bottom:"10px",position:"fixed",left:"50%",transform:"translateX(-50%)",mobile:{bottom:"70px"}},84569063743:{zIndex:999,bottom:"0px",width:"100%",position:"fixed",right:"0px",left:"0px"},62022680789:{bottom:"65px",zIndex:999,width:"100%",position:"fixed",right:"0px",left:"0px"},63102222549:{position:"sticky",bottom:"100px",zIndex:999,mobile:{bottom:"60px"}},26666008755:{bottom:"10px",zIndex:999,position:"fixed",left:"50%",transform:"translateX(-50%)"},67641475285:{bottom:"10px",zIndex:999,position:"fixed",left:"50%",transform:"translateX(-50%)"},61613179125:{position:"fixed",left:"50%",transform:"translateX(-50%)"},80866345280:{bottom:"10px",mobile:{bottom:"70px"}}},Fc={position:"sticky",bottom:"10px",zIndex:999,width:"96%"},Dc=o=>{const[r,i]=t(!1);n(()=>{const e=()=>{i(window.innerWidth<=768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const a="undefined"!=typeof window?(window?.ytapp||window?.ytBundleApp)?.storeId:void 0,l=((e,t=!1)=>{const n=e&&Ic[e]?Ic[e]:{},o={...Fc,...n};return t&&n.mobile?{...o,...n.mobile}:o})(String(a),r);o.renderingOnPage||(l.position="static",l.zIndex=0);const c={display:"flex",backgroundColor:"white",borderRadius:"4px",paddingBottom:"5px",justifyContent:"center",margin:"0 auto",transition:"box-shadow 0.3s ease, transform 0.3s ease",border:"1px solid #CBCBCB",boxShadow:"\n 0px 3px 6px 0px #00000040, \n 0px 11px 11px 0px #00000036, \n 0px 24px 14px 0px #00000021, \n 0px 43px 17px 0px #0000000A, \n 0px 68px 19px 0px #00000000\n ",...l};return e.createElement("div",{className:"yt-byob-tracker-bar yt-bundle-builder-tracker-bar "+(r?"yt-byob-tracker-mobile-bar":"yt-byob-tracker-desktop-bar"),style:{...c,width:r?"100%":l.width,...!o.styles.byob.selectedProductsVisibility&&{width:r?"96%":"fit-content",paddingInline:"10px"},...r&&{display:"flex",flexDirection:"row",paadingTop:"0px"}},onMouseEnter:e=>{e.currentTarget.style.boxShadow="\n 0px 8px 16px 0px #00000040, \n 0px 24px 24px 0px #00000036, \n 0px 50px 30px 0px #00000021, \n 0px 90px 36px 0px #0000000A, \n 0px 140px 40px 0px #00000000\n ",e.currentTarget.style.transform="translateX(-50%)"===l.transform?"translate(-50%, -3px)":"translateY(-3px)"},onMouseLeave:e=>{e.currentTarget.style.boxShadow="\n 0px 5px 12px 0px #00000040, \n 0px 22px 22px 0px #00000036, \n 0px 49px 29px 0px #00000021, \n 0px 87px 35px 0px #0000000A, \n 0px 136px 38px 0px #00000000\n ",e.currentTarget.style.transform=l.transform||"translateY(0)"}},e.createElement(Nc,{...o,isMobile:r}))},Pc=re(void 0),Ac=c.div`
2926
+ `,zc=({tiers:t,isMobile:n=!1,selectedProductsByTier:o,selectedProducts:r,themeColor:i,showProductDetailsInTracker:a,handleRemoveItemProductTier:l,cornerRadius:c,currencySymbol:s})=>e.createElement(e.Fragment,null,t.map((i,d)=>{const p=i.minimumQuantity-(o[d]?.length??0),u=r?.filter(e=>e.tierIndex===d);return Math.min(o[d]?.length/i.minimumQuantity*100,100),e.createElement("div",{className:"yt-byob-tracker-product-list-tier-wrapper",style:{display:"flex",width:"100%"}},e.createElement("div",{className:"yt-byob-tracker-product-list-tier-items"},e.createElement("div",{className:"yt-byob-tracker-product-list-items",style:{display:"flex",gap:"5px"}},u?.map?.(t=>{const r=t.product.variants?.edges?.find(e=>e.node.id===t.variantId),p=o[d]?.filter(e=>e===r?.node.id).length||0;return a?e.createElement($c,{className:"yt-byob-tracker-detailed-product-item",key:t.variantId},e.createElement(dc,{className:"yt-byob-tracker-detailed-image",style:{backgroundImage:`url(${r?.node.image?.url&&r?.node.image?.url?.length>0?r?.node.image.url:t.product.featuredMedia?.preview?.image?.url})`}},t?.isFree&&e.createElement("div",{style:{position:"absolute",bottom:4,left:"30%",background:"linear-gradient(135deg, #ff0080, #ff4d4d)",color:"white",fontWeight:900,fontSize:"8px",padding:"4px 6px",borderRadius:"40px",letterSpacing:"1.5px",textTransform:"uppercase",boxShadow:"0 6px 20px rgba(255, 0, 128, 0.7)",zIndex:20,border:"1px solid white",animation:"popup 0.6s ease-out"}},"FREE",e.createElement("style",null,"\n @keyframes popup {\n 0% { transform: scale(0) rotate(-30deg); opacity: 0; }\n 70% { transform: scale(1.3); }\n 100% { transform: scale(1); }\n }\n ")),t?.quantity>1&&e.createElement(lc,{className:"yt-byob-tracker-quantity-badge",borderRadius:c},t.quantity,"x")),e.createElement(uc,{className:"yt-byob-tracker-info-block"},e.createElement(mc,{className:"yt-byob-tracker-product-title"},t.product.title),e.createElement(gc,{className:"yt-byob-tracker-product-price"},s,Pp(r?.node?.price)),e.createElement(cc,{className:"yt-byob-tracker-remove-detailed-btn",onClick:()=>l(t.variantId,d),style:{...1===i.minimumQuantity&&1===i.products.length&&1===o[d]?.length?{display:"none"}:{}}},e.createElement(lt,null),e.createElement("span",null,"Remove")))):e.createElement("div",{className:"yt-byob-tracker-product-item",key:t.variantId},e.createElement(Sc,{className:"yt-byob-tracker-product-list-item",isMobile:n,borderRadius:c,imageUrl:r?.node.image?.url&&r?.node.image?.url?.length>0?r?.node.image.url:t.product.featuredMedia?.preview?.image?.url,style:{borderRadius:c||"12px"}},t?.isFree&&e.createElement("div",{style:{position:"absolute",top:4,left:4,background:"linear-gradient(135deg, #ff0080, #ff4d4d)",color:"white",fontWeight:900,fontSize:"8px",padding:"4px 6px",borderRadius:"8px",letterSpacing:"1.5px",textTransform:"uppercase",boxShadow:"0 6px 20px rgba(255, 0, 128, 0.7)",zIndex:20,border:"1px solid white",animation:"popup 0.6s ease-out"}},e.createElement(it,null),e.createElement("style",null,"\n @keyframes popup {\n 0% { transform: scale(0) rotate(-30deg); opacity: 0; }\n 70% { transform: scale(1.3); }\n 100% { transform: scale(1); }\n }\n ")),p>1&&e.createElement(lc,{className:"yt-byob-tracker-quantity-badge",borderRadius:c},p,"x"),e.createElement(cc,{className:"yt-byob-tracker-remove-btn",onClick:()=>l(t.variantId,d),style:{...1===i.minimumQuantity&&1===i.products.length&&1===o[d]?.length?{display:"none"}:{}}},e.createElement(J,{fontSize:"12px"}))))}),p>=1&&[...Array(p)].map((t,o)=>e.createElement(fc,{className:"yt-byob-tracker-placeholder-box",isMobile:n,borderRadius:c,key:o},e.createElement(Pe,{size:40,color:"#A0A0A0"}))))),d<t.length-1&&e.createElement(Bc,{className:"yt-byob-tracker-plus-icon-container"},e.createElement(Pe,{size:"16px",style:{backgroundColor:"#f2f2f2"}})))})),Nc=({builderTiers:o,handleAddToCart:r,minimumQuantity:i,selectedProducts:a,showProductDetailsInTracker:l,loading:c,handleRemoveItem:s,percentageOff:d,selectedItemsQuantity:p,bundleSubtotal:u,amountOff:m,styles:g,dealAmount:x,isMobile:f=!1,themeColor:y,cornerRadiusType:b,primaryTextColorCta:h,handleRemoveItemProductTier:v,selectedProductsByTier:w,storeCurrencyCode:C,isUploading:E,showNextStep:k})=>{const[T,S]=t(!1),[$,B]=t(0),[z,N]=t([]),[I,F]=t(0),[D,P]=t(0),[A,_]=t(!1),[R,O]=t(null),L=u?.price||0,M=o?.type,j=e=>{if(e<0||!z[e])return L;const t=z[e].discountValue??0;return d?L*(1-t/100):x?t:m?L-t:L};n(()=>{if(o&&"none"!==o.type)if("productTier"===M&&o.productTier){const e=o.productTier||[];N(e);let t=0;o.productTier.map(e=>{t+=e.minimumQuantity}),P(t-p)}else if(z.length)I>0&&p<z[I-1]?.minimumQuantity?(F(I-1),O(I-1)):p<z[I]?.minimumQuantity&&O(I-1),B(j(I));else{const e=o.offerTier||[];N(e),F(0),P(e[0]?.minimumQuantity-p||i-p)}else N([]),P(i-p),F(0)},[o,i,p]),n(()=>{z.length&&"productTier"!=M?(()=>{if(!z?.length)return;let e=-1,t=null,n=0;if("offerTier"===M)for(let o=0;o<z.length&&(n+=z[o].minimumQuantity,p>=n);o++)t=o,e=o+1<z.length?o+1:o;if(F(e),O(t),null!==t){let e=z.slice(0,t+1).reduce((e,t)=>e+t.minimumQuantity,0);_(e===p),S(!0),B(j(t))}else _(!1),S(!1),B(L);const o=e>=0&&e<z.length?z.slice(0,e+1).reduce((e,t)=>e+t.minimumQuantity,0)-p:z[0].minimumQuantity-p;P(o)})():p===i?(S(!0),B(d?L*(1-d/100):x||(m?L-m:L)),_(!0)):(_(!1),S(!1))},[p,z]);const V=T?Math.max(u?.compareAtPrice,u?.price):u?.compareAtPrice>u?.price?u?.compareAtPrice:null,W=T?$.toFixed(2):u?.price?.toFixed(2),H=V&&W?(V-Number(W)).toFixed(2):0,q=o&&"none"!==M&&o.offerTier?"offerTier"===M?Math.min(p/(p+D)*100,100):void 0:p/i*100;n(()=>{if(T&&g.byob.enableConfetti){console.log("remainingItems",D);const e=document.getElementById("checkoutButton");if(!e)return;const t=e.getBoundingClientRect(),n=(t.left+t.width/2)/window.innerWidth,o=(t.top+t.height/2)/window.innerHeight;Ce({particleCount:100,spread:70,origin:{x:n,y:o},zIndex:9999})}},[T,g]),I>=0&&I<z.length&&z[I].tier;const Q=e.useMemo(()=>null!==R&&z[R+1]?z[R+1]?.customText||"":o?.offerTier?.[0]?.customText||"",[R,z,o]),U="number"==typeof R?z[R]?.customText:void 0,Y="string"==typeof U&&""!==U.trim();return e.createElement(Kl,{className:"yt-byob-tracker-container bundle-builder-tracker-container "+(f?"yt-byob-tracker-mobile":"yt-byob-tracker-desktop"),isMobile:f,style:{justifyContent:g.byob.selectedProductsVisibility&&!f?"space-between":"center"}},"offerTier"==M&&null!==R&&R>=0&&e.createElement(Jl,{className:"yt-byob-tracker-offer-tier-tag"},Y?e.createElement(e.Fragment,null,U," unlocked"):e.createElement(e.Fragment,null,e.createElement(e.Fragment,null,"Buy"," ",z.slice(0,R+1).reduce((e,t)=>e+t.minimumQuantity,0)," ","at",m||x?e.createElement(e.Fragment,null," ",Ap(g.general.currencySymbol,C)):""," ",Pp(z[R]?.discountValue),d?e.createElement(e.Fragment,null,"% "):Pp(x)?e.createElement(e.Fragment,null):"",d||m?e.createElement(e.Fragment,null," Off"):""),e.createElement("span",{style:{fontStyle:"italic"}}," applied"))),f&&D>=1&&!A&&"offerTier"!==M?e.createElement(ec,{className:"yt-byob-tracker-mobile-remaining",style:{margin:"0"}},0===z.length?e.createElement(e.Fragment,null,"Select ",D," more item(s)"," ",0!==x||0!==d?"to get the bundle at":"",0!==x&&e.createElement(e.Fragment,null,` ${Ap(g.general.currencySymbol,C)}${x}`),d&&0!==d&&e.createElement(e.Fragment,null," ",` ${d}% Off`)):e.createElement(e.Fragment,null," Select ",D," more item(s)")):e.createElement(e.Fragment,null),"productTier"!==M&&e.createElement(tc,{className:"yt-byob-tracker-tier-progress-container"},e.createElement(nc,{className:"yt-byob-tracker-tier-progress-text"},"offerTier"==M&&z.length>0&&D>0&&e.createElement(e.Fragment,null,Q?e.createElement("div",{className:"yt-byob-tracker-add-more-text",style:{padding:"4px",fontWeight:"600",...window.innerWidth<=768&&{fontSize:"12px"},color:"#121212"}},"Add ",D," more to unlock ",Q):e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-tracker-add-more-text",style:{padding:"4px",fontWeight:"600",...window.innerWidth<=768&&{fontSize:"12px"},color:"#121212"}},"Add ",D," More Item(s)",e.createElement("span",{style:{fontWeight:"500"}}," to "),"Buy ",p+D," at"," ",m||x?e.createElement(e.Fragment,null,Ap(g.general.currencySymbol,C)):""," ",Pp(z[I>=0?I:0]?.discountValue),d?e.createElement(e.Fragment,null,"% "):Pp(x)?e.createElement(e.Fragment,null):"",d||m?e.createElement(e.Fragment,null," Off"):"")))),e.createElement(oc,{className:"yt-byob-tracker-progress-bar-bg"},e.createElement(rc,{className:"yt-byob-tracker-progress-bar-fill bundle-builder-tracker-progress",progressPercentage:q??0,primaryColor:y??g?.general.primaryColor}," "))),g.byob.selectedProductsVisibility&&e.createElement(ic,{className:"yt-byob-tracker-product-list-wrapper hide-tracker-scrollbar "+(f?"yt-byob-tracker-mobile-product-list":"yt-byob-tracker-desktop-product-list"),tierType:M??"",isMobile:f},"productTier"===M?e.createElement(zc,{tiers:z,isMobile:f,selectedProductsByTier:w??{},selectedProducts:a,themeColor:g.general.primaryColor,showProductDetailsInTracker:l,handleRemoveItemProductTier:v,cornerRadius:g.byob.borderRadius,currencySymbol:Ap(g.general.currencySymbol,C)}):e.createElement(e.Fragment,null,a?.map?.(t=>{const n=t.product.variants?.edges?.find(e=>e.node.id===t.variantId);return l?e.createElement(sc,{className:"yt-byob-tracker-detailed-item-container",borderRadius:g.byob.borderRadius,key:t.variantId},e.createElement(dc,{className:"yt-byob-tracker-detailed-image",style:{backgroundImage:`url(${n?.node.image?.url&&n?.node.image?.url?.length>0?n?.node.image.url:t.product.featuredMedia?.preview?.image?.url})`}},t?.quantity>1&&e.createElement(pc,{className:"yt-byob-tracker-badge"},t.quantity,"x")),e.createElement(uc,{className:"yt-byob-tracker-info-block"},e.createElement(mc,{className:"yt-byob-tracker-product-title"},t.product.title),e.createElement(gc,{className:"yt-byob-tracker-product-price"},g.general.currencySymbol,n?.node?.price),e.createElement(xc,{className:"yt-byob-tracker-remove-link",onClick:()=>s(t.variantId)},e.createElement(lt,null),e.createElement("span",null,"Remove")))):e.createElement("div",{className:"yt-byob-tracker-product-item",key:t.variantId},e.createElement(Tc,{className:"yt-byob-tracker-item bundle-builder-tracker-item",isMobile:f,borderRadius:g.byob.borderRadius,imageUrl:n?.node.image?.url&&n?.node.image?.url?.length>0?n?.node.image.url:t.product.featuredMedia?.preview?.image?.url},t?.quantity>1&&e.createElement(lc,{className:"yt-byob-tracker-quantity-badge",borderRadius:g.byob.borderRadius},t.quantity,"x"),e.createElement(cc,{className:"yt-byob-tracker-remove-btn",onClick:()=>s(t.variantId)},e.createElement(J,{fontSize:"12px"}))))}),D>=1&&[...Array(D)].map((t,n)=>e.createElement(fc,{className:"yt-byob-tracker-placeholder-box",isMobile:f,borderRadius:g.byob.borderRadius,key:n},e.createElement(Pe,{size:40,color:"#A0A0A0"}))))),(!f||A)&&e.createElement(ac,{className:"yt-byob-tracker-summary-container bundle-summary "+(f?"yt-byob-tracker-mobile-summary":"yt-byob-tracker-desktop-summary"),isMobile:f},Number(W)>0&&e.createElement(yc,{className:"yt-byob-tracker-summary-info summary-info"},e.createElement("div",{className:"yt-byob-tracker-summary-info-content",style:{display:"flex",...window.innerWidth<=600&&{flexDirection:"column"},gap:"5px",justifyContent:"center"}},f?e.createElement("div",{className:"yt-byob-tracker-mobile-subtotal-row",style:{display:"flex",flexDirection:"row",gap:"6px",alignItems:"center"}},e.createElement(bc,{className:"yt-byob-tracker-subtotal-label"},"Subtotal"),Number(H)>0&&e.createElement(hc,{className:"yt-byob-tracker-save-label",style:{}},"Save:"," ",Ap(g.general.currencySymbol,C),Pp(H))):e.createElement(e.Fragment,null,e.createElement(bc,{className:"yt-byob-tracker-subtotal-label"},"Subtotal"),Number(H)>0&&!f&&e.createElement(hc,{className:"yt-byob-tracker-save-label"},"Save:"," ",Ap(g.general.currencySymbol,C),Pp(H)))),e.createElement(vc,{className:"yt-byob-tracker-subtotal-row"},e.createElement(wc,{className:"yt-byob-tracker-final-price"},Ap(g.general.currencySymbol,C),Number(W)>=0?Pp(Number(W).toFixed(2)):0),V&&g.byob.compareAtPriceVisibility&&Number(V)>Number(W)&&e.createElement(Cc,{className:"yt-byob-tracker-line-through-price"},Ap(g.general.currencySymbol,C),Pp(Number(V).toFixed(2))))),e.createElement(Ec,{className:"yt-byob-tracker-checkout-button yt-tracking-bar-checkout-button",canCheckout:A,progressPercentage:q??0,ctaColors:{ctaBackgroundColor:g.general.ctaBackgroundColor,ctaBorderColor:g.general.ctaBorderColor,ctaHoverBackgroundColor:g.general.ctaHoverBackgroundColor,ctaHoverTextColor:g.general.ctaHoverTextColor},borderRadius:g.general.ctaBorderRadius,disabled:!A&&D>=1||E,onClick:e=>{c||console.log("saving"),r(e.target??e.currentTarget)},id:"checkoutButton"},c?e.createElement(ue,{color:"black",loading:c,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):D>=1&&!A?e.createElement("div",{className:"yt-byob-tracker-add-more-btn-text yt-tracking-bar-checkout-button-items-text",style:{color:g.general.primaryColor}},"Add ",D," More Item(s)"):e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center"}},e.createElement(kc,{className:"yt-byob-tracker-checkout-text yt-tracking-bar-checkout-button-text",ctaTextColor:g.general.ctaTextColor,ctaHoverTextColor:h??g.general.ctaHoverTextColor},k?"Next Step":g.byob.checkoutCTAText??"Checkout"),!k&&g?.general?.showPaymentIcons&&e.createElement("div",{style:{display:"flex",alignItems:"center",marginLeft:"10px"}},e.createElement("img",{src:"https://r2.yourtoken.io/checkout-button-payment-provider-icons.png",alt:"Payment methods",style:{height:"22px",width:"auto"}}),e.createElement("svg",{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",className:"yt-cart-summary-checkout-next-icon",fontSize:"24px",height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg"},e.createElement("polyline",{fill:"none",strokeWidth:"2",points:"9 6 15 12 9 18"})))))))},Ic={8087437412:{position:"fixed",bottom:"10px",zIndex:100,width:"95%",left:"50%",transform:"translateX(-50%)",mobile:{bottom:"50px"}},66134737152:{position:"fixed",zIndex:20,width:"90%",left:"50%",transform:"translateX(-50%)",bottom:"10px"},83438567714:{zIndex:100,position:"fixed",width:"95%",left:"50%",transform:"translateX(-50%)",bottom:"10px"},72726479068:{position:"fixed",zIndex:20,width:"90%",left:"50%",transform:"translateX(-50%)",bottom:"10px",mobile:{bottom:"70px"}},64800161992:{zIndex:20,mobile:{bottom:"50px"},position:"sticky",bottom:"10px"},53933408435:{zIndex:5,mobile:{bottom:"60px"},position:"sticky",bottom:"10px"},68377018594:{zIndex:5,bottom:"10px",position:"fixed",left:"50%",transform:"translateX(-50%)",mobile:{bottom:"70px"}},84569063743:{zIndex:999,bottom:"0px",width:"100%",position:"fixed",right:"0px",left:"0px"},62022680789:{bottom:"65px",zIndex:999,width:"100%",position:"fixed",right:"0px",left:"0px"},63102222549:{position:"sticky",bottom:"100px",zIndex:999,mobile:{bottom:"60px"}},26666008755:{bottom:"10px",zIndex:999,position:"fixed",left:"50%",transform:"translateX(-50%)"},67641475285:{bottom:"10px",zIndex:999,position:"fixed",left:"50%",transform:"translateX(-50%)"},61613179125:{position:"fixed",left:"50%",transform:"translateX(-50%)"},80866345280:{bottom:"10px",mobile:{bottom:"70px"}}},Fc={position:"sticky",bottom:"10px",zIndex:999,width:"96%"},Dc=o=>{const[r,i]=t(!1);n(()=>{const e=()=>{i(window.innerWidth<=768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const a="undefined"!=typeof window?(window?.ytapp||window?.ytBundleApp)?.storeId:void 0,l=((e,t=!1)=>{const n=e&&Ic[e]?Ic[e]:{},o={...Fc,...n};return t&&n.mobile?{...o,...n.mobile}:o})(String(a),r);o.renderingOnPage||(l.position="static",l.zIndex=0);const c={display:"flex",backgroundColor:"white",borderRadius:"4px",paddingBottom:"5px",justifyContent:"center",margin:"0 auto",transition:"box-shadow 0.3s ease, transform 0.3s ease",border:"1px solid #CBCBCB",boxShadow:"\n 0px 3px 6px 0px #00000040, \n 0px 11px 11px 0px #00000036, \n 0px 24px 14px 0px #00000021, \n 0px 43px 17px 0px #0000000A, \n 0px 68px 19px 0px #00000000\n ",...l};return e.createElement("div",{className:"yt-byob-tracker-bar yt-bundle-builder-tracker-bar "+(r?"yt-byob-tracker-mobile-bar":"yt-byob-tracker-desktop-bar"),style:{...c,width:r?"100%":l.width,...!o.styles.byob.selectedProductsVisibility&&{width:r?"96%":"fit-content",paddingInline:"10px"},...r&&{display:"flex",flexDirection:"row",paadingTop:"0px"}},onMouseEnter:e=>{e.currentTarget.style.boxShadow="\n 0px 8px 16px 0px #00000040, \n 0px 24px 24px 0px #00000036, \n 0px 50px 30px 0px #00000021, \n 0px 90px 36px 0px #0000000A, \n 0px 140px 40px 0px #00000000\n ",e.currentTarget.style.transform="translateX(-50%)"===l.transform?"translate(-50%, -3px)":"translateY(-3px)"},onMouseLeave:e=>{e.currentTarget.style.boxShadow="\n 0px 5px 12px 0px #00000040, \n 0px 22px 22px 0px #00000036, \n 0px 49px 29px 0px #00000021, \n 0px 87px 35px 0px #0000000A, \n 0px 136px 38px 0px #00000000\n ",e.currentTarget.style.transform=l.transform||"translateY(0)"}},e.createElement(Nc,{...o,isMobile:r}))},Pc=re(void 0),Ac=c.div`
2927
2927
  position: absolute;
2928
2928
  top: 0px;
2929
2929
  right: 0px;
@@ -3487,7 +3487,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
3487
3487
  scrollbar-width: none;
3488
3488
 
3489
3489
  -ms-overflow-style: none;
3490
- `,As=(e,t)=>{if(!t)return{};for(const n of t)if(n.productId==e)return n;return{}};function _s({bundle:a,addToCartFunction:l,currentProductId:c,dispatchAnalyticsEvent:s}){const d=o(()=>{if(c){const e="gid://shopify/Product/"+c,t=a.products?.some(t=>t.productId===e);return t?e:a.products?.[0]?.productId}return a.products?.[0]?.productId},[c,a.products]),p=o(()=>As(d,a.products),[d,a.products]),u=r(null),m=r(null);r({}),document.querySelector("#ProductSelect-product-template"),document.querySelector('form[action="/cart/add"]');const[g,x]=t(0),[f,y]=t(""),b=a.customizations??{},h=!1===b?.general?.showDecimalsInBundlePricing,v=o(()=>p?.productDetails?.tracksInventory??!0,[p?.productDetails?.tracksInventory]),w=i(e=>{if(!v)return 1/0;if(!e)return 0;if(!e.inventoryItem?.tracked)return 1/0;let t=e.inventoryQuantity??0;return t>0?t:"continue"===e.inventoryPolicy?.toLowerCase()?1/0:0},[v]),C=(o(()=>p?.productDetails?.variants?.edges?.reduce((e,{node:t})=>w(t)>0?e+1:e,0),[p,w]),o(()=>As(d,a.products)?.id,[d,a.products]));o(()=>C?As(d,a.products):void 0,[d,a.products,C]),o(()=>a.products?.some(e=>e.productDetails?.options?.some(e=>e.values.length>1))||!1,[a.products]),b.volumeBundle;const E=o(()=>a?.volumeTiers||[],[a?.volumeTiers]),k=E.findIndex(e=>e.isDefault),[T,S]=t(-1!==k?E[k].tier:E?.[0]?.tier||1),[$,B]=t(p?.productDetails?.variants?.edges?.find(e=>w(e?.node)>0)?.node?.id||p?.productDetails?.variants?.edges?.[0]?.node?.id||""),[z,N]=t({}),[I,F]=t(E.reduce((e,t,n)=>(e[t.tier-1]=Array.from({length:t.minimumQuantity},()=>p?.productDetails?.options?.map(e=>e.values[0])||[]),e),{})||{}),[D,P]=t(!1),[A,_]=t(!1),[R,O]=t(window.innerWidth<550),[L,M]=t(null),[j,V]=t(null);r([]);const W=r([]),H=r(T);n(()=>{if(s?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:a._id,bundleType:"volume-bundle"}}),"officialhouseofzelena.myshopify.com"===window?.Shopify?.shop||"791204-63.myshopify.com"===window?.Shopify?.shop){const e=document.querySelector('form[action="/cart/add"]');if(!e)return;const t=e.querySelectorAll('[type="submit"]');t&&t.forEach(e=>{e.setAttribute("style","display: none;")})}const e=()=>{O(window.innerWidth<550)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{const e=e=>{L&&W.current[L.index]&&W.current[L.index][L.optionIndex]&&!W.current[L.index][L.optionIndex]?.contains(e.target)&&M(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[L]),i(e=>{const t=E.find(t=>t.tier===e);if(!t)return null;const n=t.minimumQuantity,o=p?.productDetails?.variants?.edges||[];for(const e of o){const t=e.node;if(w(t)>=n){const e=t.title.split(" / ");return Array(n).fill(e)}}const r=[],i={},a=[...o].sort((e,t)=>{const n=w(e.node),o=w(t.node);return n===1/0&&o===1/0?0:n===1/0?-1:o===1/0?1:o-n});for(let e=0;e<n&&r.length<n;e++){let e=!1;for(const t of a){const n=t.node,o=i[n.id]||0;if(w(n)>o&&n.availableForSale){const t=n.title.split(" / ");r.push(t),i[n.id]=o+1,e=!0;break}}if(!e)return null}return r.length===n?r:null},[p,E,w]);const q=i(e=>{const t=E.find(t=>t.tier===e);if(!t)return!1;const n=t.minimumQuantity,o=p?.productDetails?.variants?.edges||[];let r=0;for(const e of o){const t=w(e.node);if(t===1/0){r=1/0;break}r+=t}return r>=n},[E,p,w]);n(()=>{const e={},t=p?.productDetails?.variants?.edges?.find(e=>w(e?.node)>0)?.node?.id||p?.productDetails?.variants?.edges?.[0]?.node?.id||"";t&&E.forEach(n=>{e[n.tier]={};for(let o=0;o<n.minimumQuantity;o++)e[n.tier][o]=t}),N(e)},[p?.id,E?.map(e=>`${e.tier}-${e.minimumQuantity}`).join("|"),w]);const Q=(e,t)=>e?.productDetails?.variants?.edges?.find(e=>e.node.id===t)?.node,U=i((e,t,n,o,r)=>{const i=E.find(t=>t.tier===e);if(!i)return!1;const a=i.minimumQuantity,l=[...n];l[o]=r;const c=l.join(" / "),s=p?.productDetails?.variants?.edges?.find(e=>e.node.title===c)?.node;if(!s||0===w(s))return!1;const d={},u=z[e]||{};for(let e=0;e<a;e++){let n;if(e===t)n=s.id;else{const t=u[e]||$,o=Q(p,t);if(!o)return!1;n=o.id}d[n]=(d[n]||0)+1}for(const[e,t]of Object.entries(d)){const n=Q(p,e),o=w(n);if(o!==1/0&&t>o)return!1}return!0},[E,p,I,I,z,$,w]),Y=i(e=>{const t=E.find(t=>t.tier===e);if(!t)return!1;const n=t.minimumQuantity,o=e-1,r={};for(let e=0;e<n;e++){const t=(I[o]?.[e]||p.productDetails.options.map(e=>e.values[0])).join(" / "),n=p?.productDetails?.variants?.edges?.find(e=>e.node.title===t);if(!n)return!1;const i=n.node.id;r[i]=(r[i]||0)+1}for(const[e,t]of Object.entries(r)){const n=Q(p,e),o=w(n);if(o!==1/0&&t>o)return!1}return!0},[E,p,I,w]);n(()=>{x(e=>e+1)},[z]);const G=(e,t,n)=>{N(o=>({...o,[e]:{...o[e]||{},[t]:n}}))},X=i(()=>p?.productDetails?.variants?.edges?.find(e=>w(e.node)>0)?.node||p?.productDetails?.variants?.edges?.[0]?.node,[p,w]),Z=i(()=>new URLSearchParams(window.location.search).get("variant")||"",[]);n(()=>{H.current=T},[T]),n(()=>{j?(V(null),K()):K()},[T]),n(()=>{if(a){const e=X();if(e)y(e.id),B(e.id);else{const e=p?.productDetails?.variants?.edges?.[0]?.node?.id||"";y(e),B(e)}}},[a,p,X]);const K=()=>{const e=Z();if(e){const t=p?.productDetails?.variants?.edges?.find(t=>String(t.node.id)==="gid://shopify/ProductVariant/"+String(e));let n=t?.node;if(n)B(String(n.id)),x(e=>e+1);else{const e=X();e&&(B(String(e.id)),n=e),x(e=>e+1)}if(n){0===w(n)?(V(null),setTimeout(()=>{V({tier:H.current,index:0,optionIndex:0,value:n.title})},0)):j&&V(null)}}};n(()=>{K();const e=new Event("urlChange");let t=!0;const n=window.history.pushState,o=window.history.replaceState;return window.history.pushState=function(){t&&(n.apply(this,arguments),window.dispatchEvent(e))},window.history.replaceState=function(){t&&(o.apply(this,arguments),window.dispatchEvent(e))},window.addEventListener("urlChange",K),()=>{t=!1,window.removeEventListener("urlChange",K),window.history.pushState=n,window.history.replaceState=o}},[Z,p?.id,X,w]);const J=e=>{const t=E.find(t=>t.tier===e);if(!t)return{original:0,discounted:0,discountedFromPrice:0,discountedFromCompare:0,diffAmountFromPrice:0,diffAmountFromCompare:0,diffPercentFromPrice:0,diffPercentFromCompare:0,discountValue:0};let n=0,o=0,r=0;const i=z[e]||{};for(let e=0;e<t.minimumQuantity;e++){const t=i[e]||$,a=Q(p,t);if(!a)continue;const l=Number.parseFloat(a.price);n+=a.compareAtPrice?Number.parseFloat(a.compareAtPrice):l,o+=l,r+=l}if("percentOff"===a?.discountType){r*=1-t.discountValue/100}else"amountOff"===a?.discountType&&(r-=t.discountValue);const l=Math.max(0,r),c=b?.volumeBundle?.discountBadgeDisplay,s=b?.volumeBundle?.discountBadgeVisibility;let d=n;"Disabled"===s?d=l:"discount-on-price"===c&&(d=o);const u=o-l,m=d-l,g=o>0?u/o*100:0,x=d>0?m/d*100:0;return{original:d,discounted:l,discountedFromPrice:l,discountedFromCompare:l,diffAmountFromPrice:u,diffAmountFromCompare:m,diffPercentFromPrice:Math.round(g),diffPercentFromCompare:Math.round(x),discountValue:t.discountValue}},ee=(e,t,n,o)=>{let r=Q(e,t);if(o){const i=z[o]?.[n||0]||t;r=Q(e,i)}return r?.image?.url?r.image.url:e.productDetails?.media?.edges[0]?.node?.preview?.image?.url||""},te=async e=>{if(Y(T))try{P(!0);const t=E.find(e=>e.tier===T);if(!t)return;const n={},o=z[t.tier]||{};for(let e=0;e<t.minimumQuantity;e++){const t=o[e]||$;n[t]?n[t].quantity+=1:n[t]={quantity:1}}s?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:a._id,bundleType:"volume-bundle",selectedProducts:p?[{id:p?.productId,title:p?.productDetails?.title}]:[],selectedVariants:Object.values(o)}});const r=J(t.tier),i=Array.from({length:t.minimumQuantity},(e,t)=>o[t]||$);l&&await l(r.original,i,void 0,void 0,e)}catch(e){console.error("VolumeBundle handleAddToCart error:",e)}finally{P(!1)}else console.error("Selected tier is out of stock")};function ne(e){if(e.startsWith("gid://")){const t=e.split("/");return t[t.length-1]}return e}n(()=>{const e=()=>{if(b.volumeBundle?.addtoCartMethod&&"shopify_atc_button"!==b.volumeBundle?.addtoCartMethod)return;const e=document.querySelector('form[action="/cart/add"]');if(!e)return;const t=e.querySelector(".sr-headless-checkout");t&&t?.setAttribute("style","display: none;");const n=document.querySelector("#Quantity-product-template")||document.querySelector('input[name="quantity"]')||document.querySelector('input[type="number"][min="1"]');let o=1;n&&n.value&&(o=parseInt(n.value,10)||1);const r=E.find(e=>e.tier===T);if(!r)return;e.querySelectorAll('.bundle-input-field, [name^="properties["], [name="id"], [name="quantity"], .t4s-quantity-wrapper').forEach(e=>e.remove());const i=r.minimumQuantity;let a={};const l=Math.max(i,o);if(o>i){const e=f||$;if(!e)return;a[e]=l}else{const e=z[r.tier]||{};for(let t=0;t<i;t++){let n=e[t];n||(n=$),n&&(a[n]=(a[n]||0)+1)}}const c=J(r.tier),s=Object.fromEntries(Object.entries(a).map(([e,t])=>[ne(e),Math.round(t)])),d=(t,n,o="bundle-input-field")=>{const r=document.createElement("input");r.type="hidden",r.name=t,r.value=n,r.className=o,e.appendChild(r)};if(o>i){const e=f||$;e&&d("id",ne(e))}d("properties[_bundle_price]",String(c.original)),d("properties[_bundle_tier]",String(r.tier)),d("properties[_bundle_items]",JSON.stringify(s));let p=0;Object.entries(s).forEach(([e,t])=>{t>0&&(d(`items[${p}][id]`,e),d(`items[${p}][quantity]`,String(t)),p++)}),requestAnimationFrame(()=>{const t=e.querySelector('[type="submit"]'),n=e.querySelector(".noti-btn-main-wrap"),r=(e,t,n)=>{if(!e)return;e.disabled=t,e.classList.toggle("disabled",t);const o=e.querySelector("[data-add-to-cart-text]")||e.querySelector("span");o&&(o.textContent=n)};o<=i&&(j?(r(t,!0,"Sold out"),t&&t.classList.add("btn--sold-out","hidden"),n&&(n.style.display="block",n.classList.remove("hidden"),n.classList.add("block"))):(r(t,!1,"Add to cart"),t&&t.classList.remove("btn--sold-out","hidden"),n&&(n.style.display="none",n.classList.add("hidden"))))})};e();const t=document.querySelector("#Quantity-product-template")||document.querySelector('input[name="quantity"]')||document.querySelector('input[type="number"][min="1"]');if(t){const n=()=>{requestAnimationFrame(()=>{e()})};return t.addEventListener("input",n),t.addEventListener("change",n),()=>{t.removeEventListener("input",n),t.removeEventListener("change",n)}}return()=>{}},[T,JSON.stringify(z),$,b.volumeBundle?.cardStyle,c,f,j]);const oe=o(()=>E.find(e=>e.tier===T),[E,T]),re=o(()=>oe?J(oe.tier):null,[oe,z,$]),ie=o(()=>{if(!oe||!re)return;const e=z[oe.tier]||{},t={};for(let n=0;n<oe.minimumQuantity;n++){const o=e[n]||$;t[o]=(t[o]||0)+1}return t},[oe?.minimumQuantity,$,z,re]),ae=o(()=>Object.entries(ie??{}).map(([e,t])=>({variantId:e,quantity:t})),[ie]);if(n(()=>{if(!oe||!re)return;const e={tier:T,items:oe.minimumQuantity,discountedPrice:re.discounted,originalPrice:re.original,variants:ae,productId:p?.id??null,tierMeta:{title:oe.title,subtitle:oe.subtitle,badgeTitle:oe.badgeTitle},productData:p,tierData:oe},t=m.current;return t&&JSON.stringify(t)===JSON.stringify(e)?void 0:(u.current&&clearTimeout(u.current),u.current=window.setTimeout(()=>{m.current=e;const t=new CustomEvent("ytBundleTierChange",{detail:e});window.dispatchEvent(t),l&&(window.ytVolumeBundle={bundle:a,addToCart:l,currentTier:oe,selectedVariants:ae},window.dispatchEvent(new CustomEvent("yt-volume-bundle-updated",{detail:{...e,addToCart:l}})))},50),()=>{u.current&&clearTimeout(u.current)})},[T,oe?.tier,oe?.minimumQuantity,re?.discounted,re?.original,p?.id,JSON.stringify(ae),l,a]),n(()=>()=>{window.ytVolumeBundle=void 0,window.dispatchEvent(new CustomEvent("yt-volume-bundle-updated",{detail:void 0}))},[]),n(()=>{if(!$||!p)return;const e=Q(p,$);if(!e)return;const t=e.title.split(" / "),n={},o={};E.forEach(e=>{const r=e.tier-1,i={};for(let t=0;t<e.minimumQuantity;t++)i[t]=$;n[e.tier]=i,o[r]=Array(e.minimumQuantity).fill(t)}),N(e=>({...e,...n})),F(e=>({...e,...o}))},[$,p?.id,E.length]),!l)return e.createElement(e.Fragment,null);const le=b.volumeBundle?.cardStyle,ce=b.general?.primaryColor,se=b.general?.secondaryColor,de=b.general.primaryContrastColor,pe=b.general.secondaryContrastColor,me="high"===a.cornerRadiusType?"20px":"medium"===a.cornerRadiusType?"6px":"0px",ge="bundles"==a.appName?a.pageHeader?.title:a?.title,xe="bundles"==a.appName?a.pageHeader?.description:a?.subtitle;return n(()=>{const e=Y(T);e?V(null):e||V({tier:T,index:0,optionIndex:0,value:""})},[T,ae,Y]),e.createElement(as,{verticalMargin:b.volumeBundle?.verticalMargin,$backgroundColor:b.volumeBundle?.sectionBackgroundColor,className:"yt-bundle-container"},e.createElement(ls,{className:"yt-bundle-header"},ge&&ge.trim().length>0&&e.createElement(cs,{fontSize:b.volumeBundle?.titleFontSize,$backgroundColor:b.volumeBundle?.titleBackgroundColor,textColor:b.volumeBundle?.titleTextColor,className:"yt-bundle-header-title"},ge),e.createElement(ss,{className:"yt-bundle-header-subtitle",fontSize:b.volumeBundle?.subtitleFontSize},xe)),"vertical"===le?e.createElement("div",{style:{display:"grid",gridTemplateColumns:R||4===E.length?"repeat(2, 1fr)":E.length>4?"repeat(3, 1fr)":`repeat(${E.length}, 1fr)`,justifyItems:"center",gap:R?"10px":"16px",paddingTop:"10px"},className:"yt-bundle-vertical-container"},E.map(t=>{const n=J(t.tier),o=n.original-n.discounted,r=T===t.tier,i=!q(t.tier);return e.createElement(e.Fragment,{key:t.tier},e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"8px",borderRadius:me||"24px",...r?{border:`2px solid ${ce}`}:{border:`1px solid ${se}`},boxShadow:`6px 6px 0px -1px ${r?ce:se}20`,...t.badgeTitle&&{position:"relative"},zIndex:5,backgroundColor:i?"#f5f5f5":"white",cursor:i?"not-allowed":"pointer",position:"relative",height:"100%",maxHeight:"350px",width:"100%",opacity:i?.6:1},className:"yt-volume-vertical-tier-item "+(r?"yt-volume-vertical-tier-item-active":""),"data-tier":t.tier,"data-discount-value":n.discountValue,"data-discount-type":a?.discountType,"data-minimum-quantity":t.minimumQuantity,"data-original-price":n.original.toFixed(h?0:2),"data-discounted-price":n.discounted.toFixed(h?0:2),onClick:()=>!i&&S(t.tier)},t.badgeTitle&&e.createElement("div",{style:{position:"absolute",top:"-15px",zIndex:-1,left:"0",right:"0",width:"80%",textAlign:"center",margin:"0 auto",fontSize:"10px",clipPath:"polygon(2% 0%, 98% 0%, 100% 100%, 0% 100%)",backgroundColor:r?ce:se,color:r?de:pe,padding:"2px 0",borderRadius:"12px 12px 0px 0px",lineHeight:"normal"},className:r?"yt-volume-vertical-tier-badge-active":"yt-volume-vertical-tier-badge","data-tier":t.tier,"data-badge-title":t.badgeTitle},t.badgeTitle),e.createElement("div",{style:{position:"relative",width:"100%",display:"flex",justifyContent:"center",height:"fit-content"},className:"yt-volume-vertical-tier-save-badge-container"},"Enabled"===b.volumeBundle?.discountBadgeVisibility&&R&&(()=>{if(!((n?.diffAmountFromPrice>0||n?.diffAmountFromCompare>0)&&(n?.diffPercentFromPrice>0||n?.diffPercentFromCompare>0)))return null;const o=Ap(b.general.currencySymbol,a.storeCurrencyCode);let i="";if(b?.volumeBundle?.discountBadgeDisplay&&b?.volumeBundle?.discountDisplayType){const{discountBadgeDisplay:e,discountDisplayType:t}=b.volumeBundle;"discount-on-compare"===e&&(i="percentage"===t?n.diffPercentFromCompare>0?`${Math.round(n.diffPercentFromCompare)}% Off`:"":n.diffAmountFromCompare>0?`Save ${o}${Pp(n.diffAmountFromCompare)}`:""),"discount-on-price"===e&&(i="percentage"===t?n.diffPercentFromPrice>0?`${Math.round(n.diffPercentFromPrice)}% Off`:"":n.diffAmountFromPrice>0?`Save ${o}${Pp(n.diffAmountFromPrice)}`:"")}else n?.discountValue>0&&(i="percentOff"===a?.discountType?`${n.discountValue}% Off`:`Save ${o}${Pp(n.discountValue)}`);return i?e.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"5px",top:"8px"}},e.createElement(gs,{primaryBackgroundColorCta:r?ce:se,isSelected:r,style:{height:"fit-content",fontSize:"10px",lineHeight:"normal",color:r?de:pe},className:"yt-volume-vertical-tier-save-badge","data-tier":t.tier,"data-discount-value":n.discountValue,"data-discount-type":a?.discountType},i)):null})(),t.imageUrl&&e.createElement("img",{src:_p(t.imageUrl),style:{objectFit:"cover",aspectRatio:"1/1",width:"100%",maxHeight:"160px",maxWidth:"160px",height:"fit-content",borderTopLeftRadius:me||"24px",borderTopRightRadius:me||"24px"},className:"yt-volume-vertical-tier-badge"})),e.createElement("div",{style:{padding:"8px",paddingTop:"0"}},e.createElement(xs,{style:{display:"flex",width:"100%",gap:"4px"},className:"yt-volume-vertical-details-container"},e.createElement("div",{style:{display:"flex",alignItems:"center",position:"relative",width:"100%"},className:"yt-volume-vertical-details-title-container"},e.createElement(fs,{style:{fontSize:R?"12px":"14px",lineHeight:"normal"},className:"yt-volume-vertical-details-title"},t.title?t.title:e.createElement(e.Fragment,null,"Buy ",t.minimumQuantity,", Get"," ",t.discountValue,"% Off")),"Enabled"===b.volumeBundle?.discountBadgeVisibility&&!R&&(()=>{if(!((n?.diffAmountFromPrice>0||n?.diffAmountFromCompare>0)&&(n?.diffPercentFromPrice>0||n?.diffPercentFromCompare>0)))return null;const o=Ap(b.general.currencySymbol,a.storeCurrencyCode);let i="";if(b?.volumeBundle?.discountBadgeDisplay&&b?.volumeBundle?.discountDisplayType){const{discountBadgeDisplay:e,discountDisplayType:t}=b.volumeBundle;"discount-on-compare"===e&&(i="percentage"===t?n.diffPercentFromCompare>0?`${Math.round(n.diffPercentFromCompare)}% Off`:"":n.diffAmountFromCompare>0?`Save ${o}${Pp(n.diffAmountFromCompare)}`:""),"discount-on-price"===e&&(i="percentage"===t?n.diffPercentFromPrice>0?`${Math.round(n.diffPercentFromPrice)}% Off`:"":n.diffAmountFromPrice>0?`Save ${o}${Pp(n.diffAmountFromPrice)}`:"")}else n?.discountValue>0&&(i="percentOff"===a?.discountType?`${n.discountValue}% Off`:`Save ${o}${Pp(n.discountValue)}`);return i?e.createElement(gs,{primaryBackgroundColorCta:r?ce:se,isSelected:r,style:{height:"fit-content",fontSize:"10px",lineHeight:"normal",color:r?de:pe},className:"yt-volume-vertical-tier-save-badge","data-tier":t.tier,"data-discount-value":n.discountValue,"data-discount-type":a?.discountType},i):null})(),r&&t.imageUrl&&e.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"0px"},className:"yt-volume-vertical-tier-selected-check"},e.createElement("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",borderRadius:"50%",backgroundColor:ce,color:de,padding:"2px"}},e.createElement(Me,{style:{paddingBottom:"1px"},size:20,fontWeight:20})))),e.createElement(ys,{style:{lineHeight:"normal",fontSize:R?"10px":"14px",color:"#666"},className:"yt-volume-vertical-details-subtitle"},t.subtitle?t.subtitle:e.createElement(e.Fragment,null))),q(t.tier)?e.createElement(bs,{style:{textAlign:"left",marginTop:"4px",display:"flex",flexDirection:"row",flexWrap:"wrap",alignItems:"center"},className:"yt-volume-vertical-details-price","data-tier":t.tier,"data-original-price":n.original.toFixed(h?0:2),"data-discounted-price":n.discounted.toFixed(h?0:2),"data-savings":o.toFixed(h?0:2)},(()=>{const r=b?.volumeBundle?.tierPriceType||"tier-price";if("none"===r)return;let i="",l="";if("unit-price"===r){const e=n.discounted/t.minimumQuantity;i=(n.original/t.minimumQuantity).toFixed(h?0:2),l=e.toFixed(h?0:2)}else"tier-price"===r&&(i=n.original.toFixed(h?0:2),l=n.discounted.toFixed(h?0:2));return e.createElement(e.Fragment,null,e.createElement(hs,{style:{marginLeft:"0",lineHeight:"normal",marginRight:"8px"},className:"yt-volume-vertical-details-price-discount"},Ap(b.general.currencySymbol,a.storeCurrencyCode),Pp(l),"unit-price"===r?"/unit":""),o>0&&e.createElement(vs,{style:{lineHeight:"normal"},className:"yt-volume-vertical-details-price-original"},Ap(b.general.currencySymbol,a.storeCurrencyCode),Pp(i),"unit-price"===r?"/unit":""))})()):e.createElement("div",{style:{textAlign:"center",color:"#999",fontSize:"14px",fontWeight:"500",padding:"4px 0",lineHeight:"normal"}},"Out of Stock")),r&&!t.imageUrl&&e.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"10px",bottom:"10px"},className:"yt-volume-vertical-tier-selected-check"},e.createElement("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",borderRadius:"50%",backgroundColor:ce,color:de,padding:"2px"}},e.createElement(Me,{style:{paddingBottom:"1px"},size:20,fontWeight:20})))))})):e.createElement(e.Fragment,null,E.map(t=>{const n=J(t.tier),o=n.original-n.discounted,r=!q(t.tier);return e.createElement(e.Fragment,{key:t.tier},t.badgeTitle&&e.createElement(ds,{primaryTextColorCta:de,primaryBackgroundColorCta:ce,style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-badge","data-tier":t.tier,"data-badge-title":t.badgeTitle},t.badgeTitle),e.createElement(ps,{cornerRadiusType:a?.cornerRadiusType??"",key:t.tier,primaryBackgroundColorCta:ce??"",isSelected:T===t.tier,onClick:()=>S(t.tier),style:{borderRadius:me,cursor:"pointer",backgroundColor:r?"#f5f5f5":"white",opacity:r?.6:1},className:"yt-volume-horizontal-tier-container "+(T===t.tier?"yt-volume-horizontal-tier-container-active":""),"data-tier":t.tier,"data-discount-value":n.discountValue,"data-discount-type":a?.discountType,"data-minimum-quantity":t.minimumQuantity,"data-original-price":n.original.toFixed(h?0:2),"data-discounted-price":n.discounted.toFixed(h?0:2)},e.createElement(us,{cornerRadiusType:a?.cornerRadiusType??"",style:{borderRadius:me,borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"},className:"yt-volume-horizontal-tier-header"},e.createElement(ms,{className:"yt-volume-horizontal-tier-info"},e.createElement(Ts,{"data-active":T===t.tier,accentColor:ce,className:"yt-volume-horizontal-tier-radio-wrapper"},e.createElement(Ss,{name:"tier",checked:T===t.tier,onChange:()=>!r&&S(t.tier),disabled:r,className:"yt-volume-horizontal-tier-radio-hidden"}),e.createElement($s,{accentColor:ce,className:"yt-volume-horizontal-tier-radio-custom"})),e.createElement(xs,{className:"yt-volume-horizontal-tier-details"},e.createElement("div",{style:{display:"flex"},className:"yt-volume-horizontal-tier-title-container"},e.createElement(fs,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-title"},t.title?t.title:e.createElement(e.Fragment,null,"Buy ",t.minimumQuantity,", Get"," ",t.discountValue,"% Off")),"Enabled"===b.volumeBundle?.discountBadgeVisibility&&(()=>{if(!((n?.diffAmountFromPrice>0||n?.diffAmountFromCompare>0)&&(n?.diffPercentFromPrice>0||n?.diffPercentFromCompare>0)))return null;const o=Ap(b.general.currencySymbol,a.storeCurrencyCode);let r="";if(b?.volumeBundle?.discountBadgeDisplay&&b?.volumeBundle?.discountDisplayType){const{discountBadgeDisplay:e,discountDisplayType:t}=b.volumeBundle;"discount-on-compare"===e&&(r="percentage"===t?n.diffPercentFromCompare>0?`${Math.round(n.diffPercentFromCompare)}% Off`:"":n.diffAmountFromCompare>0?`Save ${o}${Pp(n.diffAmountFromCompare)}`:""),"discount-on-price"===e&&(r="percentage"===t?n.diffPercentFromPrice>0?`${Math.round(n.diffPercentFromPrice)}% Off`:"":n.diffAmountFromPrice>0?`Save ${o}${Pp(n.diffAmountFromPrice)}`:"")}else n?.discountValue>0&&(r="percentOff"===a?.discountType?`${n.discountValue}% Off`:`Save ${o}${Pp(n.discountValue)}`);return r?e.createElement(gs,{primaryBackgroundColorCta:ce,isSelected:T===t.tier,style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-save-badge","data-tier":t.tier,"data-discount-value":n.discountValue,"data-discount-type":a?.discountType},r):null})()),e.createElement(ys,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-subtitle"},t.subtitle?t.subtitle:e.createElement(e.Fragment,null)))),q(t.tier)?e.createElement(bs,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-price","data-tier":t.tier,"data-original-price":n.original.toFixed(h?0:2),"data-discounted-price":n.discounted.toFixed(h?0:2),"data-savings":o.toFixed(0)},(()=>{const r=b?.volumeBundle?.tierPriceType||"tier-price";if("none"===r)return;let i="",l="";if("unit-price"===r){const e=n.discounted/t.minimumQuantity;i=(n.original/t.minimumQuantity).toFixed(h?0:2),l=e.toFixed(h?0:2)}else"tier-price"===r&&(i=n.original.toFixed(h?0:2),l=n.discounted.toFixed(h?0:2));return e.createElement(e.Fragment,null,o>0?e.createElement(vs,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-original-price"},Ap(b.general.currencySymbol,a.storeCurrencyCode),Pp(i),"unit-price"===r?"/unit":""):"",e.createElement(hs,{className:"yt-volume-horizontal-tier-discounted-price"},Ap(b.general.currencySymbol,a.storeCurrencyCode),Pp(l),"unit-price"===r?"/unit":""))})()):e.createElement("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",lineHeight:"normal"}},e.createElement("span",{style:{color:"#999",fontSize:"14px",fontWeight:"500"}},"Out of Stock"))),T===t.tier&&e.createElement(ws,{className:"yt-volume-horizontal-tier-product-grid",style:{padding:p.productDetails.variants.edges.length>1||1===p.productDetails.variants.edges.length&&"Default Title"!==p.productDetails.variants.edges[0].node.title?"10px 15px":"0",gap:p.productDetails.variants.edges.length>1||1===p.productDetails.variants.edges.length&&"Default Title"!==p.productDetails.variants.edges[0].node.title?"10px":"0"}},Array.from({length:t.minimumQuantity}).map((n,o)=>{const i=t.tier-1,l=(I[i]||[])[o]||p.productDetails.options?.map(e=>e.values[0])||[],c=p?.productDetails?.options.some(e=>e.values.length>1)||1===p?.productDetails?.variants?.edges?.length&&"Default Title"!==p?.productDetails?.variants?.edges[0]?.node?.title;return e.createElement("div",{key:o,style:{display:"flex",gap:"10px",alignItems:"center",position:"relative"},className:"yt-volume-horizontal-tier-product-item"},c&&e.createElement(Bs,{src:_p(ee(p,$,o,t.tier)),alt:p?.productDetails?.title||"Product",style:{height:"64px",width:"auto"},className:"yt-volume-horizontal-tier-product-image"}),("auto"===b?.volumeBundle?.variantSelectorType||"dropdown"===b?.volumeBundle?.variantSelectorType)&&e.createElement("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap"}},p?.productDetails?.options?.map((n,c)=>{const s=n.values.filter(e=>p.productDetails.variants.edges.some(t=>t.node.title.split(" / ")[c]===e));if(0===s.length||1===s.length&&"Default Title"===s[0])return null;const d=L?.tier===t.tier&&L?.index===o&&L?.optionIndex===c,u=a?.variantOptions?.options?.find(e=>e.name===n.name);let m="";return"color"===u?.type&&(m=u?.values?.find(e=>e.name===l[c])?.value||""),e.createElement(Fs,{key:c,ref:e=>{W.current[o]||(W.current[o]=[]),W.current[o][c]=e},style:{zIndex:d?1e3:"auto",display:"flex",flexDirection:"column",gap:"4px"},isActive:d},b?.volumeBundle?.showVariantOptionsLabel&&n?.name&&e.createElement("p",{style:{lineHeight:"normal",fontSize:"14px",margin:0}},n?.name),e.createElement(Ds,{onClick:e=>{e.stopPropagation(),M(d?null:{tier:t.tier,index:o,optionIndex:c})},isActive:d,disabled:r},"color"===u?.type&&m&&e.createElement("div",{className:"yt-fixedBundle-product-card_color-swatch",style:{display:"inline-block",width:20,height:20,borderRadius:"50%",backgroundColor:m||"transparent",border:"1px solid #ddd"}}),l[c],e.createElement(ze,{style:{display:"block"}})),d&&e.createElement(Ps,{style:{zIndex:1001}},s.map((n,a)=>{const s=[...l];s[c]=n;const d=!U(t.tier,o,l,c,n)||r;p.productDetails.variants.edges.find(({node:e})=>e.title===s.join(" / "));const m=e=>{if(e.preventDefault(),e.stopPropagation(),F(e=>{const t={...e},n=[...t[i]||[]];return n[o]=s,t[i]=n,t}),d){V({tier:T,index:o,optionIndex:c,value:n}),M(null);const e=s.join(" / "),r=p.productDetails.variants.edges.find(t=>t.node.title===e)?.node.id||$;return void G(t.tier,o,r)}const r=s.join(" / "),a=p.productDetails.variants.edges.find(e=>e.node.title===r)?.node.id||$;G(t.tier,o,a),M(null)},g=u?.values.find(e=>e.name===n);return"image"===u?.type&&g?.value?e.createElement(zs,{key:n,onClick:m,style:{cursor:"pointer"}},e.createElement(Ns,{src:g.value,alt:n}),n):"color"===u?.type&&g?.value?e.createElement(zs,{key:n,onClick:m,style:{cursor:"pointer"}},e.createElement(Is,{style:{backgroundColor:g.value}}),n):e.createElement(zs,{key:n,onClick:m,style:{cursor:"pointer"}},n)})))})),"swatches"===b?.volumeBundle?.variantSelectorType&&e.createElement(Cs,{style:{display:"flex",flexDirection:"column",gap:"5px"},className:"yt-volume-horizontal-tier-variant-selector"},p?.productDetails?.options.map((n,c)=>{const s=n.values.filter(e=>p.productDetails.variants.edges.some(t=>t.node.title.split(" / ")[c]===e));if(0===s.length||1===s.length&&"Default Title"===s[0])return null;const d=a.variantOptions?.options?.find(e=>e.name===n.name)||null;return e.createElement("div",{key:n.name,style:{width:"100%",display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"},className:"yt-volume-horizontal-tier-variant-option"},b?.volumeBundle?.showVariantOptionsLabel&&n?.name&&e.createElement("p",{style:{lineHeight:"normal",fontSize:"14px",margin:0}},n?.name),e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"},className:"yt-volume-horizontal-tier-variant-values"},s.map(n=>{const a=l[c]===n,s=!U(t.tier,o,l,c,n)||r,u=d?.values.find(e=>e.name===n),m=e=>{if(e.preventDefault(),e.stopPropagation(),s)return;const r=[...l];r[c]=n,F(e=>{const t={...e},n=[...t[i]||[]];return n[o]=r,t[i]=n,t});const a=r.join(" / "),d=p.productDetails.variants.edges.find(e=>e.node.title===a)?.node.id||$;G(t.tier,o,d)},g={opacity:s?.5:1,cursor:s?"not-allowed":"pointer"};return"color"===d?.type&&u?.value?e.createElement("button",{key:n,onClick:m,style:{...g,borderRadius:"50%",padding:"1px",backgroundColor:"white",border:a?`1px solid ${b.general?.ctaBackgroundColor||"#121212"}`:"1px solid transparent",lineHeight:"normal"},className:"yt-volume-horizontal-tier-variant-color-button",disabled:s},e.createElement("div",{style:{width:a?"24px":"20px",height:a?"24px":"20px",borderRadius:"50%",backgroundColor:u.value,lineHeight:"normal",boxShadow:"rgba(9, 30, 66, 0.25) 0px 4px 8px -2px, rgba(9, 30, 66, 0.08) 0px 0px 0px 2px"}},e.createElement("span",null))):"image"===d?.type&&u?.value?e.createElement("button",{key:n,onClick:m,style:{...g,border:a?`1px solid ${b.general?.ctaBackgroundColor||"#121212"}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:a?"#F7F7F7":"transparent",padding:"0px",width:a?"20px":"18px",height:a?"20px":"18px",overflow:"hidden"},className:"yt-volume-horizontal-tier-variant-image-button",disabled:s},e.createElement("img",{src:u.value,alt:n,style:{width:a?"26px":"24px",height:a?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}})):e.createElement(Es,{key:n,isSelected:a,onClick:m,style:{...g,padding:"4px 8px",border:a?`1px solid ${b.general?.ctaBackgroundColor||"#121212"}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:a?"#F7F7F7":"transparent",color:"#707070",cursor:"pointer",fontSize:"12px",fontWeight:"600",lineHeight:"normal"},className:"yt-volume-horizontal-tier-variant-button-default",disabled:s},n)})))})))})),j&&j.tier===t.tier&&e.createElement("div",{style:{color:ce,textAlign:"center",fontSize:"14px",fontStyle:"normal",fontWeight:"500",lineHeight:"110%",background:`${ce}1A`,padding:"12px",borderBottomLeftRadius:me,borderBottomRightRadius:me}},"There aren’t enough items in our stock for select option, please select smaller bundle.")))})),a?.showCta&&"shopify_atc_button"!==b.volumeBundle?.addtoCartMethod&&e.createElement("div",{style:{position:"relative"}},e.createElement(ks,{bgColor:Y(T)?b.general?.ctaBackgroundColor:"#ccc",textColor:Y(T)?b.general?.ctaTextColor:"#666",border:`1px solid ${Y(T)?b.general?.ctaBorderColor||"#121212":"#999"}`,shadow:b.general.ctaShadowType,padding:b.general?.ctaPadding,width:b.general?.ctaWidth,hoverProperties:{customizeHoverState:!!Y(T)&&b.general?.customizeHoverState,backgroundColor:b.general?.ctaHoverBackgroundColor,textColor:b.general?.ctaHoverTextColor},onClick:async()=>{a.personalizedForm?_(!0):await te()},borderRadius:b.general.ctaBorderRadius??"",disabled:D||!Y(T),className:"yt-volume-add-to-cart-button"},Y(T)?e.createElement(e.Fragment,null,D?e.createElement(ue,{color:"white",loading:D,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):e.createElement("div",{style:{display:"flex",flexDirection:"row",gap:"8px",justifyContent:"center",alignItems:"center"}},e.createElement("span",null,b.volumeBundle?.ctaTitle??"Add Bundle to Cart")," ","•",e.createElement("div",{className:"yt-volume-add-to-cart-button-info"},(()=>{const t=J(T);return e.createElement(e.Fragment,null,Ap(b.general.currencySymbol,a.storeCurrencyCode),Pp(t.discounted.toFixed(h?0:2))," ",t?.original!==t.discounted&&t?.original>t.discounted&&e.createElement("span",{style:{lineHeight:"normal",textDecoration:"line-through",fontWeight:"550"}},Ap(b.general.currencySymbol,a.storeCurrencyCode),Pp(t?.original.toFixed(h?0:2))," "))})()))):e.createElement(e.Fragment,null,"Out of Stock"))),a.personalizedForm&&e.createElement(os,{isOpen:A,onClose:()=>_(!1),formConfig:a.personalizedForm,onCheckout:async e=>{await te(e),_(!1)},cta:{backgroundColor:b.general?.ctaBackgroundColor||"#121212",textColor:b.general?.ctaTextColor||"#FFFFFF"},isMobile:R}))}const Rs=c.div`
3490
+ `,As=(e,t)=>{if(!t)return{};for(const n of t)if(n.productId==e)return n;return{}};function _s({bundle:a,addToCartFunction:l,currentProductId:c,dispatchAnalyticsEvent:s}){const d=o(()=>{if(c){const e="gid://shopify/Product/"+c,t=a.products?.some(t=>t.productId===e);return t?e:a.products?.[0]?.productId}return a.products?.[0]?.productId},[c,a.products]),p=o(()=>As(d,a.products),[d,a.products]),u=r(null),m=r(null);r({}),document.querySelector("#ProductSelect-product-template"),document.querySelector('form[action="/cart/add"]');const[g,x]=t(0),[f,y]=t(""),b=a.customizations??{},h=!1===b?.general?.showDecimalsInBundlePricing,v=o(()=>p?.productDetails?.tracksInventory??!0,[p?.productDetails?.tracksInventory]),w=i(e=>{if(!v)return 1/0;if(!e)return 0;if(!e.inventoryItem?.tracked)return 1/0;let t=e.inventoryQuantity??0;return t>0?t:"continue"===e.inventoryPolicy?.toLowerCase()?1/0:0},[v]),C=(o(()=>p?.productDetails?.variants?.edges?.reduce((e,{node:t})=>w(t)>0?e+1:e,0),[p,w]),o(()=>As(d,a.products)?.id,[d,a.products]));o(()=>C?As(d,a.products):void 0,[d,a.products,C]),o(()=>a.products?.some(e=>e.productDetails?.options?.some(e=>e.values.length>1))||!1,[a.products]),b.volumeBundle;const E=o(()=>a?.volumeTiers||[],[a?.volumeTiers]),k=E.findIndex(e=>e.isDefault),[T,S]=t(-1!==k?E[k].tier:E?.[0]?.tier||1),[$,B]=t(p?.productDetails?.variants?.edges?.find(e=>w(e?.node)>0)?.node?.id||p?.productDetails?.variants?.edges?.[0]?.node?.id||""),[z,N]=t({}),[I,F]=t(E.reduce((e,t,n)=>(e[t.tier-1]=Array.from({length:t.minimumQuantity},()=>p?.productDetails?.options?.map(e=>e.values[0])||[]),e),{})||{}),[D,P]=t(!1),[A,_]=t(!1),[R,O]=t(window.innerWidth<550),[L,M]=t(null),[j,V]=t(null);r([]);const W=r([]),H=r(T);n(()=>{if(s?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:a._id,bundleType:"volume-bundle"}}),"officialhouseofzelena.myshopify.com"===window?.Shopify?.shop||"791204-63.myshopify.com"===window?.Shopify?.shop){const e=document.querySelector('form[action="/cart/add"]');if(!e)return;const t=e.querySelectorAll('[type="submit"]');t&&t.forEach(e=>{e.setAttribute("style","display: none;")})}const e=()=>{O(window.innerWidth<550)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{const e=e=>{L&&W.current[L.index]&&W.current[L.index][L.optionIndex]&&!W.current[L.index][L.optionIndex]?.contains(e.target)&&M(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[L]),i(e=>{const t=E.find(t=>t.tier===e);if(!t)return null;const n=t.minimumQuantity,o=p?.productDetails?.variants?.edges||[];for(const e of o){const t=e.node;if(w(t)>=n){const e=t.title.split(" / ");return Array(n).fill(e)}}const r=[],i={},a=[...o].sort((e,t)=>{const n=w(e.node),o=w(t.node);return n===1/0&&o===1/0?0:n===1/0?-1:o===1/0?1:o-n});for(let e=0;e<n&&r.length<n;e++){let e=!1;for(const t of a){const n=t.node,o=i[n.id]||0;if(w(n)>o&&n.availableForSale){const t=n.title.split(" / ");r.push(t),i[n.id]=o+1,e=!0;break}}if(!e)return null}return r.length===n?r:null},[p,E,w]);const q=i(e=>{const t=E.find(t=>t.tier===e);if(!t)return!1;const n=t.minimumQuantity,o=p?.productDetails?.variants?.edges||[];let r=0;for(const e of o){const t=w(e.node);if(t===1/0){r=1/0;break}r+=t}return r>=n},[E,p,w]);n(()=>{const e={},t=p?.productDetails?.variants?.edges?.find(e=>w(e?.node)>0)?.node?.id||p?.productDetails?.variants?.edges?.[0]?.node?.id||"";t&&E.forEach(n=>{e[n.tier]={};for(let o=0;o<n.minimumQuantity;o++)e[n.tier][o]=t}),N(e)},[p?.id,E?.map(e=>`${e.tier}-${e.minimumQuantity}`).join("|"),w]);const Q=(e,t)=>e?.productDetails?.variants?.edges?.find(e=>e.node.id===t)?.node,U=i((e,t,n,o,r)=>{const i=E.find(t=>t.tier===e);if(!i)return!1;const a=i.minimumQuantity,l=[...n];l[o]=r;const c=l.join(" / "),s=p?.productDetails?.variants?.edges?.find(e=>e.node.title===c)?.node;if(!s||0===w(s))return!1;const d={},u=z[e]||{};for(let e=0;e<a;e++){let n;if(e===t)n=s.id;else{const t=u[e]||$,o=Q(p,t);if(!o)return!1;n=o.id}d[n]=(d[n]||0)+1}for(const[e,t]of Object.entries(d)){const n=Q(p,e),o=w(n);if(o!==1/0&&t>o)return!1}return!0},[E,p,I,I,z,$,w]),Y=i(e=>{const t=E.find(t=>t.tier===e);if(!t)return!1;const n=t.minimumQuantity,o=e-1,r={};for(let e=0;e<n;e++){const t=(I[o]?.[e]||p.productDetails.options.map(e=>e.values[0])).join(" / "),n=p?.productDetails?.variants?.edges?.find(e=>e.node.title===t);if(!n)return!1;const i=n.node.id;r[i]=(r[i]||0)+1}for(const[e,t]of Object.entries(r)){const n=Q(p,e),o=w(n);if(o!==1/0&&t>o)return!1}return!0},[E,p,I,w]);n(()=>{x(e=>e+1)},[z]);const G=(e,t,n)=>{N(o=>({...o,[e]:{...o[e]||{},[t]:n}}))},X=i(()=>p?.productDetails?.variants?.edges?.find(e=>w(e.node)>0)?.node||p?.productDetails?.variants?.edges?.[0]?.node,[p,w]),Z=i(()=>new URLSearchParams(window.location.search).get("variant")||"",[]);n(()=>{H.current=T},[T]),n(()=>{j?(V(null),K()):K()},[T]),n(()=>{if(a){const e=X();if(e)y(e.id),B(e.id);else{const e=p?.productDetails?.variants?.edges?.[0]?.node?.id||"";y(e),B(e)}}},[a,p,X]);const K=()=>{const e=Z();if(e){const t=p?.productDetails?.variants?.edges?.find(t=>String(t.node.id)==="gid://shopify/ProductVariant/"+String(e));let n=t?.node;if(n)B(String(n.id)),x(e=>e+1);else{const e=X();e&&(B(String(e.id)),n=e),x(e=>e+1)}if(n){0===w(n)?(V(null),setTimeout(()=>{V({tier:H.current,index:0,optionIndex:0,value:n.title})},0)):j&&V(null)}}};n(()=>{K();const e=new Event("urlChange");let t=!0;const n=window.history.pushState,o=window.history.replaceState;return window.history.pushState=function(){t&&(n.apply(this,arguments),window.dispatchEvent(e))},window.history.replaceState=function(){t&&(o.apply(this,arguments),window.dispatchEvent(e))},window.addEventListener("urlChange",K),()=>{t=!1,window.removeEventListener("urlChange",K),window.history.pushState=n,window.history.replaceState=o}},[Z,p?.id,X,w]);const J=e=>{const t=E.find(t=>t.tier===e);if(!t)return{original:0,discounted:0,discountedFromPrice:0,discountedFromCompare:0,diffAmountFromPrice:0,diffAmountFromCompare:0,diffPercentFromPrice:0,diffPercentFromCompare:0,discountValue:0};let n=0,o=0,r=0;const i=z[e]||{};for(let e=0;e<t.minimumQuantity;e++){const t=i[e]||$,a=Q(p,t);if(!a)continue;const l=Number.parseFloat(a.price);n+=a.compareAtPrice?Number.parseFloat(a.compareAtPrice):l,o+=l,r+=l}if("percentOff"===a?.discountType){r*=1-(t.discountValue??0)/100}else"amountOff"===a?.discountType&&(r-=t.discountValue??0);const l=Math.max(0,r),c=b?.volumeBundle?.discountBadgeDisplay,s=b?.volumeBundle?.discountBadgeVisibility;let d=n;"Disabled"===s?d=l:"discount-on-price"===c&&(d=o);const u=o-l,m=d-l,g=o>0?u/o*100:0,x=d>0?m/d*100:0;return{original:d,discounted:l,discountedFromPrice:l,discountedFromCompare:l,diffAmountFromPrice:u,diffAmountFromCompare:m,diffPercentFromPrice:Math.round(g),diffPercentFromCompare:Math.round(x),discountValue:t.discountValue??0}},ee=(e,t,n,o)=>{let r=Q(e,t);if(o){const i=z[o]?.[n||0]||t;r=Q(e,i)}return r?.image?.url?r.image.url:e.productDetails?.media?.edges[0]?.node?.preview?.image?.url||""},te=async e=>{if(Y(T))try{P(!0);const t=E.find(e=>e.tier===T);if(!t)return;const n={},o=z[t.tier]||{};for(let e=0;e<t.minimumQuantity;e++){const t=o[e]||$;n[t]?n[t].quantity+=1:n[t]={quantity:1}}s?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:a._id,bundleType:"volume-bundle",selectedProducts:p?[{id:p?.productId,title:p?.productDetails?.title}]:[],selectedVariants:Object.values(o)}});const r=J(t.tier),i=Array.from({length:t.minimumQuantity},(e,t)=>o[t]||$);l&&await l(r.original,i,void 0,void 0,e)}catch(e){console.error("VolumeBundle handleAddToCart error:",e)}finally{P(!1)}else console.error("Selected tier is out of stock")};function ne(e){if(e.startsWith("gid://")){const t=e.split("/");return t[t.length-1]}return e}n(()=>{const e=()=>{if(b.volumeBundle?.addtoCartMethod&&"shopify_atc_button"!==b.volumeBundle?.addtoCartMethod)return;const e=document.querySelector('form[action="/cart/add"]');if(!e)return;const t=e.querySelector(".sr-headless-checkout");t&&t?.setAttribute("style","display: none;");const n=document.querySelector("#Quantity-product-template")||document.querySelector('input[name="quantity"]')||document.querySelector('input[type="number"][min="1"]');let o=1;n&&n.value&&(o=parseInt(n.value,10)||1);const r=E.find(e=>e.tier===T);if(!r)return;e.querySelectorAll('.bundle-input-field, [name^="properties["], [name="id"], [name="quantity"], .t4s-quantity-wrapper').forEach(e=>e.remove());const i=r.minimumQuantity;let a={};const l=Math.max(i,o);if(o>i){const e=f||$;if(!e)return;a[e]=l}else{const e=z[r.tier]||{};for(let t=0;t<i;t++){let n=e[t];n||(n=$),n&&(a[n]=(a[n]||0)+1)}}const c=J(r.tier),s=Object.fromEntries(Object.entries(a).map(([e,t])=>[ne(e),Math.round(t)])),d=(t,n,o="bundle-input-field")=>{const r=document.createElement("input");r.type="hidden",r.name=t,r.value=n,r.className=o,e.appendChild(r)};if(o>i){const e=f||$;e&&d("id",ne(e))}d("properties[_bundle_price]",String(c.original)),d("properties[_bundle_tier]",String(r.tier)),d("properties[_bundle_items]",JSON.stringify(s));let p=0;Object.entries(s).forEach(([e,t])=>{t>0&&(d(`items[${p}][id]`,e),d(`items[${p}][quantity]`,String(t)),p++)}),requestAnimationFrame(()=>{const t=e.querySelector('[type="submit"]'),n=e.querySelector(".noti-btn-main-wrap"),r=(e,t,n)=>{if(!e)return;e.disabled=t,e.classList.toggle("disabled",t);const o=e.querySelector("[data-add-to-cart-text]")||e.querySelector("span");o&&(o.textContent=n)};o<=i&&(j?(r(t,!0,"Sold out"),t&&t.classList.add("btn--sold-out","hidden"),n&&(n.style.display="block",n.classList.remove("hidden"),n.classList.add("block"))):(r(t,!1,"Add to cart"),t&&t.classList.remove("btn--sold-out","hidden"),n&&(n.style.display="none",n.classList.add("hidden"))))})};e();const t=document.querySelector("#Quantity-product-template")||document.querySelector('input[name="quantity"]')||document.querySelector('input[type="number"][min="1"]');if(t){const n=()=>{requestAnimationFrame(()=>{e()})};return t.addEventListener("input",n),t.addEventListener("change",n),()=>{t.removeEventListener("input",n),t.removeEventListener("change",n)}}return()=>{}},[T,JSON.stringify(z),$,b.volumeBundle?.cardStyle,c,f,j]);const oe=o(()=>E.find(e=>e.tier===T),[E,T]),re=o(()=>oe?J(oe.tier):null,[oe,z,$]),ie=o(()=>{if(!oe||!re)return;const e=z[oe.tier]||{},t={};for(let n=0;n<oe.minimumQuantity;n++){const o=e[n]||$;t[o]=(t[o]||0)+1}return t},[oe?.minimumQuantity,$,z,re]),ae=o(()=>Object.entries(ie??{}).map(([e,t])=>({variantId:e,quantity:t})),[ie]);if(n(()=>{if(!oe||!re)return;const e={tier:T,items:oe.minimumQuantity,discountedPrice:re.discounted,originalPrice:re.original,variants:ae,productId:p?.id??null,tierMeta:{title:oe.title,subtitle:oe.subtitle,badgeTitle:oe.badgeTitle},productData:p,tierData:oe},t=m.current;return t&&JSON.stringify(t)===JSON.stringify(e)?void 0:(u.current&&clearTimeout(u.current),u.current=window.setTimeout(()=>{m.current=e;const t=new CustomEvent("ytBundleTierChange",{detail:e});window.dispatchEvent(t),l&&(window.ytVolumeBundle={bundle:a,addToCart:l,currentTier:oe,selectedVariants:ae},window.dispatchEvent(new CustomEvent("yt-volume-bundle-updated",{detail:{...e,addToCart:l}})))},50),()=>{u.current&&clearTimeout(u.current)})},[T,oe?.tier,oe?.minimumQuantity,re?.discounted,re?.original,p?.id,JSON.stringify(ae),l,a]),n(()=>()=>{window.ytVolumeBundle=void 0,window.dispatchEvent(new CustomEvent("yt-volume-bundle-updated",{detail:void 0}))},[]),n(()=>{if(!$||!p)return;const e=Q(p,$);if(!e)return;const t=e.title.split(" / "),n={},o={};E.forEach(e=>{const r=e.tier-1,i={};for(let t=0;t<e.minimumQuantity;t++)i[t]=$;n[e.tier]=i,o[r]=Array(e.minimumQuantity).fill(t)}),N(e=>({...e,...n})),F(e=>({...e,...o}))},[$,p?.id,E.length]),!l)return e.createElement(e.Fragment,null);const le=b.volumeBundle?.cardStyle,ce=b.general?.primaryColor,se=b.general?.secondaryColor,de=b.general.primaryContrastColor,pe=b.general.secondaryContrastColor,me="high"===a.cornerRadiusType?"20px":"medium"===a.cornerRadiusType?"6px":"0px",ge="bundles"==a.appName?a.pageHeader?.title:a?.title,xe="bundles"==a.appName?a.pageHeader?.description:a?.subtitle;return n(()=>{const e=Y(T);e?V(null):e||V({tier:T,index:0,optionIndex:0,value:""})},[T,ae,Y]),e.createElement(as,{verticalMargin:b.volumeBundle?.verticalMargin,$backgroundColor:b.volumeBundle?.sectionBackgroundColor,className:"yt-bundle-container"},e.createElement(ls,{className:"yt-bundle-header"},ge&&ge.trim().length>0&&e.createElement(cs,{fontSize:b.volumeBundle?.titleFontSize,$backgroundColor:b.volumeBundle?.titleBackgroundColor,textColor:b.volumeBundle?.titleTextColor,className:"yt-bundle-header-title"},ge),e.createElement(ss,{className:"yt-bundle-header-subtitle",fontSize:b.volumeBundle?.subtitleFontSize},xe)),"vertical"===le?e.createElement("div",{style:{display:"grid",gridTemplateColumns:R||4===E.length?"repeat(2, 1fr)":E.length>4?"repeat(3, 1fr)":`repeat(${E.length}, 1fr)`,justifyItems:"center",gap:R?"10px":"16px",paddingTop:"10px"},className:"yt-bundle-vertical-container"},E.map(t=>{const n=J(t.tier),o=n.original-n.discounted,r=T===t.tier,i=!q(t.tier);return e.createElement(e.Fragment,{key:t.tier},e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"8px",borderRadius:me||"24px",...r?{border:`2px solid ${ce}`}:{border:`1px solid ${se}`},boxShadow:`6px 6px 0px -1px ${r?ce:se}20`,...t.badgeTitle&&{position:"relative"},zIndex:5,backgroundColor:i?"#f5f5f5":"white",cursor:i?"not-allowed":"pointer",position:"relative",height:"100%",maxHeight:"350px",width:"100%",opacity:i?.6:1},className:"yt-volume-vertical-tier-item "+(r?"yt-volume-vertical-tier-item-active":""),"data-tier":t.tier,"data-discount-value":n.discountValue,"data-discount-type":a?.discountType,"data-minimum-quantity":t.minimumQuantity,"data-original-price":n.original.toFixed(h?0:2),"data-discounted-price":n.discounted.toFixed(h?0:2),onClick:()=>!i&&S(t.tier)},t.badgeTitle&&e.createElement("div",{style:{position:"absolute",top:"-15px",zIndex:-1,left:"0",right:"0",width:"80%",textAlign:"center",margin:"0 auto",fontSize:"10px",clipPath:"polygon(2% 0%, 98% 0%, 100% 100%, 0% 100%)",backgroundColor:r?ce:se,color:r?de:pe,padding:"2px 0",borderRadius:"12px 12px 0px 0px",lineHeight:"normal"},className:r?"yt-volume-vertical-tier-badge-active":"yt-volume-vertical-tier-badge","data-tier":t.tier,"data-badge-title":t.badgeTitle},t.badgeTitle),e.createElement("div",{style:{position:"relative",width:"100%",display:"flex",justifyContent:"center",height:"fit-content"},className:"yt-volume-vertical-tier-save-badge-container"},"Enabled"===b.volumeBundle?.discountBadgeVisibility&&R&&(()=>{if(!((n?.diffAmountFromPrice>0||n?.diffAmountFromCompare>0)&&(n?.diffPercentFromPrice>0||n?.diffPercentFromCompare>0)))return null;const o=Ap(b.general.currencySymbol,a.storeCurrencyCode);let i="";if(b?.volumeBundle?.discountBadgeDisplay&&b?.volumeBundle?.discountDisplayType){const{discountBadgeDisplay:e,discountDisplayType:t}=b.volumeBundle;"discount-on-compare"===e&&(i="percentage"===t?n.diffPercentFromCompare>0?`${Math.round(n.diffPercentFromCompare)}% Off`:"":n.diffAmountFromCompare>0?`Save ${o}${Pp(n.diffAmountFromCompare)}`:""),"discount-on-price"===e&&(i="percentage"===t?n.diffPercentFromPrice>0?`${Math.round(n.diffPercentFromPrice)}% Off`:"":n.diffAmountFromPrice>0?`Save ${o}${Pp(n.diffAmountFromPrice)}`:"")}else n?.discountValue>0&&(i="percentOff"===a?.discountType?`${n.discountValue}% Off`:`Save ${o}${Pp(n.discountValue)}`);return i?e.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"5px",top:"8px"}},e.createElement(gs,{primaryBackgroundColorCta:r?ce:se,isSelected:r,style:{height:"fit-content",fontSize:"10px",lineHeight:"normal",color:r?de:pe},className:"yt-volume-vertical-tier-save-badge","data-tier":t.tier,"data-discount-value":n.discountValue,"data-discount-type":a?.discountType},i)):null})(),t.imageUrl&&e.createElement("img",{src:_p(t.imageUrl),style:{objectFit:"cover",aspectRatio:"1/1",width:"100%",maxHeight:"160px",maxWidth:"160px",height:"fit-content",borderTopLeftRadius:me||"24px",borderTopRightRadius:me||"24px"},className:"yt-volume-vertical-tier-badge"})),e.createElement("div",{style:{padding:"8px",paddingTop:"0"}},e.createElement(xs,{style:{display:"flex",width:"100%",gap:"4px"},className:"yt-volume-vertical-details-container"},e.createElement("div",{style:{display:"flex",alignItems:"center",position:"relative",width:"100%"},className:"yt-volume-vertical-details-title-container"},e.createElement(fs,{style:{fontSize:R?"12px":"14px",lineHeight:"normal"},className:"yt-volume-vertical-details-title"},t.title?t.title:e.createElement(e.Fragment,null,"Buy ",t.minimumQuantity,", Get"," ",t.discountValue,"% Off")),"Enabled"===b.volumeBundle?.discountBadgeVisibility&&!R&&(()=>{if(!((n?.diffAmountFromPrice>0||n?.diffAmountFromCompare>0)&&(n?.diffPercentFromPrice>0||n?.diffPercentFromCompare>0)))return null;const o=Ap(b.general.currencySymbol,a.storeCurrencyCode);let i="";if(b?.volumeBundle?.discountBadgeDisplay&&b?.volumeBundle?.discountDisplayType){const{discountBadgeDisplay:e,discountDisplayType:t}=b.volumeBundle;"discount-on-compare"===e&&(i="percentage"===t?n.diffPercentFromCompare>0?`${Math.round(n.diffPercentFromCompare)}% Off`:"":n.diffAmountFromCompare>0?`Save ${o}${Pp(n.diffAmountFromCompare)}`:""),"discount-on-price"===e&&(i="percentage"===t?n.diffPercentFromPrice>0?`${Math.round(n.diffPercentFromPrice)}% Off`:"":n.diffAmountFromPrice>0?`Save ${o}${Pp(n.diffAmountFromPrice)}`:"")}else n?.discountValue>0&&(i="percentOff"===a?.discountType?`${n.discountValue}% Off`:`Save ${o}${Pp(n.discountValue)}`);return i?e.createElement(gs,{primaryBackgroundColorCta:r?ce:se,isSelected:r,style:{height:"fit-content",fontSize:"10px",lineHeight:"normal",color:r?de:pe},className:"yt-volume-vertical-tier-save-badge","data-tier":t.tier,"data-discount-value":n.discountValue,"data-discount-type":a?.discountType},i):null})(),r&&t.imageUrl&&e.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"0px"},className:"yt-volume-vertical-tier-selected-check"},e.createElement("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",borderRadius:"50%",backgroundColor:ce,color:de,padding:"2px"}},e.createElement(Me,{style:{paddingBottom:"1px"},size:20,fontWeight:20})))),e.createElement(ys,{style:{lineHeight:"normal",fontSize:R?"10px":"14px",color:"#666"},className:"yt-volume-vertical-details-subtitle"},t.subtitle?t.subtitle:e.createElement(e.Fragment,null))),q(t.tier)?e.createElement(bs,{style:{textAlign:"left",marginTop:"4px",display:"flex",flexDirection:"row",flexWrap:"wrap",alignItems:"center"},className:"yt-volume-vertical-details-price","data-tier":t.tier,"data-original-price":n.original.toFixed(h?0:2),"data-discounted-price":n.discounted.toFixed(h?0:2),"data-savings":o.toFixed(h?0:2)},(()=>{const r=b?.volumeBundle?.tierPriceType||"tier-price";if("none"===r)return;let i="",l="";if("unit-price"===r){const e=n.discounted/t.minimumQuantity;i=(n.original/t.minimumQuantity).toFixed(h?0:2),l=e.toFixed(h?0:2)}else"tier-price"===r&&(i=n.original.toFixed(h?0:2),l=n.discounted.toFixed(h?0:2));return e.createElement(e.Fragment,null,e.createElement(hs,{style:{marginLeft:"0",lineHeight:"normal",marginRight:"8px"},className:"yt-volume-vertical-details-price-discount"},Ap(b.general.currencySymbol,a.storeCurrencyCode),Pp(l),"unit-price"===r?"/unit":""),o>0&&e.createElement(vs,{style:{lineHeight:"normal"},className:"yt-volume-vertical-details-price-original"},Ap(b.general.currencySymbol,a.storeCurrencyCode),Pp(i),"unit-price"===r?"/unit":""))})()):e.createElement("div",{style:{textAlign:"center",color:"#999",fontSize:"14px",fontWeight:"500",padding:"4px 0",lineHeight:"normal"}},"Out of Stock")),r&&!t.imageUrl&&e.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"10px",bottom:"10px"},className:"yt-volume-vertical-tier-selected-check"},e.createElement("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",borderRadius:"50%",backgroundColor:ce,color:de,padding:"2px"}},e.createElement(Me,{style:{paddingBottom:"1px"},size:20,fontWeight:20})))))})):e.createElement(e.Fragment,null,E.map(t=>{const n=J(t.tier),o=n.original-n.discounted,r=!q(t.tier);return e.createElement(e.Fragment,{key:t.tier},t.badgeTitle&&e.createElement(ds,{primaryTextColorCta:de,primaryBackgroundColorCta:ce,style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-badge","data-tier":t.tier,"data-badge-title":t.badgeTitle},t.badgeTitle),e.createElement(ps,{cornerRadiusType:a?.cornerRadiusType??"",key:t.tier,primaryBackgroundColorCta:ce??"",isSelected:T===t.tier,onClick:()=>S(t.tier),style:{borderRadius:me,cursor:"pointer",backgroundColor:r?"#f5f5f5":"white",opacity:r?.6:1},className:"yt-volume-horizontal-tier-container "+(T===t.tier?"yt-volume-horizontal-tier-container-active":""),"data-tier":t.tier,"data-discount-value":n.discountValue,"data-discount-type":a?.discountType,"data-minimum-quantity":t.minimumQuantity,"data-original-price":n.original.toFixed(h?0:2),"data-discounted-price":n.discounted.toFixed(h?0:2)},e.createElement(us,{cornerRadiusType:a?.cornerRadiusType??"",style:{borderRadius:me,borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"},className:"yt-volume-horizontal-tier-header"},e.createElement(ms,{className:"yt-volume-horizontal-tier-info"},e.createElement(Ts,{"data-active":T===t.tier,accentColor:ce,className:"yt-volume-horizontal-tier-radio-wrapper"},e.createElement(Ss,{name:"tier",checked:T===t.tier,onChange:()=>!r&&S(t.tier),disabled:r,className:"yt-volume-horizontal-tier-radio-hidden"}),e.createElement($s,{accentColor:ce,className:"yt-volume-horizontal-tier-radio-custom"})),e.createElement(xs,{className:"yt-volume-horizontal-tier-details"},e.createElement("div",{style:{display:"flex"},className:"yt-volume-horizontal-tier-title-container"},e.createElement(fs,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-title"},t.title?t.title:e.createElement(e.Fragment,null,"Buy ",t.minimumQuantity,", Get"," ",t.discountValue,"% Off")),"Enabled"===b.volumeBundle?.discountBadgeVisibility&&(()=>{if(!((n?.diffAmountFromPrice>0||n?.diffAmountFromCompare>0)&&(n?.diffPercentFromPrice>0||n?.diffPercentFromCompare>0)))return null;const o=Ap(b.general.currencySymbol,a.storeCurrencyCode);let r="";if(b?.volumeBundle?.discountBadgeDisplay&&b?.volumeBundle?.discountDisplayType){const{discountBadgeDisplay:e,discountDisplayType:t}=b.volumeBundle;"discount-on-compare"===e&&(r="percentage"===t?n.diffPercentFromCompare>0?`${Math.round(n.diffPercentFromCompare)}% Off`:"":n.diffAmountFromCompare>0?`Save ${o}${Pp(n.diffAmountFromCompare)}`:""),"discount-on-price"===e&&(r="percentage"===t?n.diffPercentFromPrice>0?`${Math.round(n.diffPercentFromPrice)}% Off`:"":n.diffAmountFromPrice>0?`Save ${o}${Pp(n.diffAmountFromPrice)}`:"")}else n?.discountValue>0&&(r="percentOff"===a?.discountType?`${n.discountValue}% Off`:`Save ${o}${Pp(n.discountValue)}`);return r?e.createElement(gs,{primaryBackgroundColorCta:ce,isSelected:T===t.tier,style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-save-badge","data-tier":t.tier,"data-discount-value":n.discountValue,"data-discount-type":a?.discountType},r):null})()),e.createElement(ys,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-subtitle"},t.subtitle?t.subtitle:e.createElement(e.Fragment,null)))),q(t.tier)?e.createElement(bs,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-price","data-tier":t.tier,"data-original-price":n.original.toFixed(h?0:2),"data-discounted-price":n.discounted.toFixed(h?0:2),"data-savings":o.toFixed(0)},(()=>{const r=b?.volumeBundle?.tierPriceType||"tier-price";if("none"===r)return;let i="",l="";if("unit-price"===r){const e=n.discounted/t.minimumQuantity;i=(n.original/t.minimumQuantity).toFixed(h?0:2),l=e.toFixed(h?0:2)}else"tier-price"===r&&(i=n.original.toFixed(h?0:2),l=n.discounted.toFixed(h?0:2));return e.createElement(e.Fragment,null,o>0?e.createElement(vs,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-original-price"},Ap(b.general.currencySymbol,a.storeCurrencyCode),Pp(i),"unit-price"===r?"/unit":""):"",e.createElement(hs,{className:"yt-volume-horizontal-tier-discounted-price"},Ap(b.general.currencySymbol,a.storeCurrencyCode),Pp(l),"unit-price"===r?"/unit":""))})()):e.createElement("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",lineHeight:"normal"}},e.createElement("span",{style:{color:"#999",fontSize:"14px",fontWeight:"500"}},"Out of Stock"))),T===t.tier&&e.createElement(ws,{className:"yt-volume-horizontal-tier-product-grid",style:{padding:p.productDetails.variants.edges.length>1||1===p.productDetails.variants.edges.length&&"Default Title"!==p.productDetails.variants.edges[0].node.title?"10px 15px":"0",gap:p.productDetails.variants.edges.length>1||1===p.productDetails.variants.edges.length&&"Default Title"!==p.productDetails.variants.edges[0].node.title?"10px":"0"}},Array.from({length:t.minimumQuantity}).map((n,o)=>{const i=t.tier-1,l=(I[i]||[])[o]||p.productDetails.options?.map(e=>e.values[0])||[],c=p?.productDetails?.options.some(e=>e.values.length>1)||1===p?.productDetails?.variants?.edges?.length&&"Default Title"!==p?.productDetails?.variants?.edges[0]?.node?.title;return e.createElement("div",{key:o,style:{display:"flex",gap:"10px",alignItems:"center",position:"relative"},className:"yt-volume-horizontal-tier-product-item"},c&&e.createElement(Bs,{src:_p(ee(p,$,o,t.tier)),alt:p?.productDetails?.title||"Product",style:{height:"64px",width:"auto"},className:"yt-volume-horizontal-tier-product-image"}),("auto"===b?.volumeBundle?.variantSelectorType||"dropdown"===b?.volumeBundle?.variantSelectorType)&&e.createElement("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap"}},p?.productDetails?.options?.map((n,c)=>{const s=n.values.filter(e=>p.productDetails.variants.edges.some(t=>t.node.title.split(" / ")[c]===e));if(0===s.length||1===s.length&&"Default Title"===s[0])return null;const d=L?.tier===t.tier&&L?.index===o&&L?.optionIndex===c,u=a?.variantOptions?.options?.find(e=>e.name===n.name);let m="";return"color"===u?.type&&(m=u?.values?.find(e=>e.name===l[c])?.value||""),e.createElement(Fs,{key:c,ref:e=>{W.current[o]||(W.current[o]=[]),W.current[o][c]=e},style:{zIndex:d?1e3:"auto",display:"flex",flexDirection:"column",gap:"4px"},isActive:d},b?.volumeBundle?.showVariantOptionsLabel&&n?.name&&e.createElement("p",{style:{lineHeight:"normal",fontSize:"14px",margin:0}},n?.name),e.createElement(Ds,{onClick:e=>{e.stopPropagation(),M(d?null:{tier:t.tier,index:o,optionIndex:c})},isActive:d,disabled:r},"color"===u?.type&&m&&e.createElement("div",{className:"yt-fixedBundle-product-card_color-swatch",style:{display:"inline-block",width:20,height:20,borderRadius:"50%",backgroundColor:m||"transparent",border:"1px solid #ddd"}}),l[c],e.createElement(ze,{style:{display:"block"}})),d&&e.createElement(Ps,{style:{zIndex:1001}},s.map((n,a)=>{const s=[...l];s[c]=n;const d=!U(t.tier,o,l,c,n)||r;p.productDetails.variants.edges.find(({node:e})=>e.title===s.join(" / "));const m=e=>{if(e.preventDefault(),e.stopPropagation(),F(e=>{const t={...e},n=[...t[i]||[]];return n[o]=s,t[i]=n,t}),d){V({tier:T,index:o,optionIndex:c,value:n}),M(null);const e=s.join(" / "),r=p.productDetails.variants.edges.find(t=>t.node.title===e)?.node.id||$;return void G(t.tier,o,r)}const r=s.join(" / "),a=p.productDetails.variants.edges.find(e=>e.node.title===r)?.node.id||$;G(t.tier,o,a),M(null)},g=u?.values.find(e=>e.name===n);return"image"===u?.type&&g?.value?e.createElement(zs,{key:n,onClick:m,style:{cursor:"pointer"}},e.createElement(Ns,{src:g.value,alt:n}),n):"color"===u?.type&&g?.value?e.createElement(zs,{key:n,onClick:m,style:{cursor:"pointer"}},e.createElement(Is,{style:{backgroundColor:g.value}}),n):e.createElement(zs,{key:n,onClick:m,style:{cursor:"pointer"}},n)})))})),"swatches"===b?.volumeBundle?.variantSelectorType&&e.createElement(Cs,{style:{display:"flex",flexDirection:"column",gap:"5px"},className:"yt-volume-horizontal-tier-variant-selector"},p?.productDetails?.options.map((n,c)=>{const s=n.values.filter(e=>p.productDetails.variants.edges.some(t=>t.node.title.split(" / ")[c]===e));if(0===s.length||1===s.length&&"Default Title"===s[0])return null;const d=a.variantOptions?.options?.find(e=>e.name===n.name)||null;return e.createElement("div",{key:n.name,style:{width:"100%",display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"},className:"yt-volume-horizontal-tier-variant-option"},b?.volumeBundle?.showVariantOptionsLabel&&n?.name&&e.createElement("p",{style:{lineHeight:"normal",fontSize:"14px",margin:0}},n?.name),e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"},className:"yt-volume-horizontal-tier-variant-values"},s.map(n=>{const a=l[c]===n,s=!U(t.tier,o,l,c,n)||r,u=d?.values.find(e=>e.name===n),m=e=>{if(e.preventDefault(),e.stopPropagation(),s)return;const r=[...l];r[c]=n,F(e=>{const t={...e},n=[...t[i]||[]];return n[o]=r,t[i]=n,t});const a=r.join(" / "),d=p.productDetails.variants.edges.find(e=>e.node.title===a)?.node.id||$;G(t.tier,o,d)},g={opacity:s?.5:1,cursor:s?"not-allowed":"pointer"};return"color"===d?.type&&u?.value?e.createElement("button",{key:n,onClick:m,style:{...g,borderRadius:"50%",padding:"1px",backgroundColor:"white",border:a?`1px solid ${b.general?.ctaBackgroundColor||"#121212"}`:"1px solid transparent",lineHeight:"normal"},className:"yt-volume-horizontal-tier-variant-color-button",disabled:s},e.createElement("div",{style:{width:a?"24px":"20px",height:a?"24px":"20px",borderRadius:"50%",backgroundColor:u.value,lineHeight:"normal",boxShadow:"rgba(9, 30, 66, 0.25) 0px 4px 8px -2px, rgba(9, 30, 66, 0.08) 0px 0px 0px 2px"}},e.createElement("span",null))):"image"===d?.type&&u?.value?e.createElement("button",{key:n,onClick:m,style:{...g,border:a?`1px solid ${b.general?.ctaBackgroundColor||"#121212"}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:a?"#F7F7F7":"transparent",padding:"0px",width:a?"20px":"18px",height:a?"20px":"18px",overflow:"hidden"},className:"yt-volume-horizontal-tier-variant-image-button",disabled:s},e.createElement("img",{src:u.value,alt:n,style:{width:a?"26px":"24px",height:a?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}})):e.createElement(Es,{key:n,isSelected:a,onClick:m,style:{...g,padding:"4px 8px",border:a?`1px solid ${b.general?.ctaBackgroundColor||"#121212"}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:a?"#F7F7F7":"transparent",color:"#707070",cursor:"pointer",fontSize:"12px",fontWeight:"600",lineHeight:"normal"},className:"yt-volume-horizontal-tier-variant-button-default",disabled:s},n)})))})))})),j&&j.tier===t.tier&&e.createElement("div",{style:{color:ce,textAlign:"center",fontSize:"14px",fontStyle:"normal",fontWeight:"500",lineHeight:"110%",background:`${ce}1A`,padding:"12px",borderBottomLeftRadius:me,borderBottomRightRadius:me}},"There aren’t enough items in our stock for select option, please select smaller bundle.")))})),a?.showCta&&"shopify_atc_button"!==b.volumeBundle?.addtoCartMethod&&e.createElement("div",{style:{position:"relative"}},e.createElement(ks,{bgColor:Y(T)?b.general?.ctaBackgroundColor:"#ccc",textColor:Y(T)?b.general?.ctaTextColor:"#666",border:`1px solid ${Y(T)?b.general?.ctaBorderColor||"#121212":"#999"}`,shadow:b.general.ctaShadowType,padding:b.general?.ctaPadding,width:b.general?.ctaWidth,hoverProperties:{customizeHoverState:!!Y(T)&&b.general?.customizeHoverState,backgroundColor:b.general?.ctaHoverBackgroundColor,textColor:b.general?.ctaHoverTextColor},onClick:async()=>{a.personalizedForm?_(!0):await te()},borderRadius:b.general.ctaBorderRadius??"",disabled:D||!Y(T),className:"yt-volume-add-to-cart-button"},Y(T)?e.createElement(e.Fragment,null,D?e.createElement(ue,{color:"white",loading:D,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):e.createElement("div",{style:{display:"flex",flexDirection:"row",gap:"8px",justifyContent:"center",alignItems:"center"}},e.createElement("span",null,b.volumeBundle?.ctaTitle??"Add Bundle to Cart")," ","•",e.createElement("div",{className:"yt-volume-add-to-cart-button-info"},(()=>{const t=J(T);return e.createElement(e.Fragment,null,Ap(b.general.currencySymbol,a.storeCurrencyCode),Pp(t.discounted.toFixed(h?0:2))," ",t?.original!==t.discounted&&t?.original>t.discounted&&e.createElement("span",{style:{lineHeight:"normal",textDecoration:"line-through",fontWeight:"550"}},Ap(b.general.currencySymbol,a.storeCurrencyCode),Pp(t?.original.toFixed(h?0:2))," "))})()))):e.createElement(e.Fragment,null,"Out of Stock"))),a.personalizedForm&&e.createElement(os,{isOpen:A,onClose:()=>_(!1),formConfig:a.personalizedForm,onCheckout:async e=>{await te(e),_(!1)},cta:{backgroundColor:b.general?.ctaBackgroundColor||"#121212",textColor:b.general?.ctaTextColor||"#FFFFFF"},isMobile:R}))}const Rs=c.div`
3491
3491
  container-type: inline-size;
3492
3492
  border-radius: ${e=>e.borderRadius?e.borderRadius:"8px"};
3493
3493
  max-width: 800px;
@@ -4665,7 +4665,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
4665
4665
  }
4666
4666
  `,vp=c.span`
4667
4667
  font-size: 12px;
4668
- `,wp=({productsWithIndices:r,isOpen:i,onClose:a,cta:l,variantOptions:c,onVariantChange:s,handleAddToCart:d,primaryProductId:p,variantId:u})=>{const m=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e?.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),[g,x]=t({}),[f,y]=t({});n(()=>{const e={},t={};r?.forEach(({product:n,index:o})=>{let r,i=[];if(n.productId===p&&u){const e=n?.productDetails?.variants?.edges.find(e=>e?.node?.id?.includes(u))?.node;e&&m(n.productDetails,e.id)>0&&(i=e.title.split(" / "),r=e)}if(!i.length){const e=n.productDetails.variants.edges.find(e=>m(n.productDetails,e?.node?.id)>0)?.node||n?.productDetails?.variants?.edges?.[0]?.node;e?(i=e.title.split(" / "),r=e):i=n?.productDetails?.options?.map(e=>e.values[0]??"")}e[o]=i,r&&(t[o]={node:r},s(o,r.id))}),x(e),y(t)},[r,p,u,s,m]),n(()=>{if(!p||!u)return;const e=r?.find(({product:e})=>e?.productId===p);if(!e)return;const{product:t,index:n}=e,o=t?.productDetails?.variants?.edges?.find(e=>e.node.id.includes(u))?.node;if(o&&m(t.productDetails,o.id)>0){const e=o.title.split(" / ");x(t=>({...t,[n]:e})),y(e=>({...e,[n]:{node:o}})),s(n,o.id)}},[u,p,r,s,m]);const b=(e,t,n,o)=>{const r=[...g[e]||[]];r[t]=n;const i=r.join(" / "),a=o.productDetails.variants.edges.find(e=>e.node.title===i)?.node;return!!a&&m(o.productDetails,a.id)>0},h=(e,t,n)=>{const{product:o}=r?.find(t=>t.index===e)||{product:{productDetails:{variants:{edges:[]}}}};if(!o?.productDetails)return;if(!b(e,n,t,o))return;const i={...g};i[e][n]=t,x(i);const a=o?.productDetails?.variants?.edges?.find(t=>t.node.title===i[e].join(" / "))?.node;a&&(s(e,a.id),y(t=>({...t,[e]:{node:a}})))};if(!i)return null;const v=e.createElement(ap,{className:"yt-fixedBundle-variant-modal_overlay",onClick:a},e.createElement(lp,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},e.createElement(cp,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:l.backgroundColor,color:l.textColor}},"Select Options"),r?.map(({product:t,index:n},o)=>e.createElement(e.Fragment,null,e.createElement(dp,{className:"yt-fixedBundle-variant-modal_product-block"},e.createElement(pp,{className:"yt-fixedBundle-variant-modal_thumbnail",src:f[n]?.node?.image?.url||t.productDetails.featuredMedia?.preview?.image?.url,alt:t.productDetails.title}),e.createElement(up,{className:"yt-fixedBundle-variant-modal_product-info"},e.createElement(mp,{className:"yt-fixedBundle-variant-modal_product-name"},t.productDetails.title,t?.productDetails?.variants?.edges?.filter(e=>"Default Title"!==e.node.title)?.length>0&&e.createElement(xp,{className:"yt-fixedBundle-variant-modal_selected-value"},g[n]?.join(" / "))),t.productDetails.options.map((o,r)=>{const i=c&&c?.options?.find(e=>e.name===o.name),a=o.values.filter(e=>t.productDetails.variants.edges.some(t=>t.node.title.split(" / ")[r]===e));return 0===a.length||1===a.length&&"Default Title"===a[0]?e.createElement(e.Fragment,null):i&&"color"===i?.type?e.createElement(fp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(vp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),a.map((o,a)=>{const l=!b(n,r,o,t);return e.createElement(e.Fragment,null,i.values.find(e=>e.name===o)?.value?e.createElement(yp,{className:"yt-fixedBundle-variant-modal_color-swatch",key:a,color:i.values.find(e=>e.name===o)?.value||o,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},e.createElement("span",null)):e.createElement(bp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},o))})):i&&"image"===i?.type?e.createElement(fp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(vp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),a.map((o,a)=>{const l=!b(n,r,o,t);return e.createElement(e.Fragment,null,i?.values.find(e=>e.name===o)?.value?e.createElement(hp,{className:"yt-fixedBundle-variant-modal_image-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)},src:i.values.find(e=>e.name===o)?.value},e.createElement("span",null)):e.createElement(bp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},o))})):e.createElement(fp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(vp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),a.map((o,i)=>{const a=!b(n,r,o,t);return e.createElement(bp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:i,selected:g[n]?.[r]==o,disabled:a,onClick:()=>{h(n,o,r)}},o)}))}))),o<r.length-1&&e.createElement(gp,{className:"yt-fixedBundle-variant-modal_divider"}))),e.createElement(sp,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:l.backgroundColor,color:l.textColor},onClick:d},"Add bundle to cart")));return P.createPortal(v,document.body)},Cp=({options:o,selectedValue:i,onChange:a,type:l="text"})=>{const[c,s]=t(!1),d=r(null);n(()=>{const e=e=>{d.current&&!d.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const p=t=>"color"===l?e.createElement(tp,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:t.value},e.createElement("span",null)):"image"===l?e.createElement(np,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:t.value||"/placeholder.svg",alt:t.name},e.createElement("span",null)):null;return e.createElement(Yd,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:d},e.createElement(Gd,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>s(!c)},e.createElement(Xd,{className:"yt-fixedBundle-variant-dropdown-horizontal_content"},i&&("color"===l||"image"===l)&&p(i),e.createElement("span",{className:"yt-fixedBundle-variant-dropdown-horizontal_selected-text"},i&&i.name)),e.createElement(Zd,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:c})),c&&e.createElement(Kd,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},o?.map(t=>e.createElement(Jd,{className:"yt-fixedBundle-variant-selector_dropdown-item "+(i?.name===t.name?"yt-fixedBundle-variant-selector_dropdown-item--selected":""),key:t.name,$isSelected:i?.name===t.name,onClick:()=>{t.disabled||(a(t),s(!1))},style:{opacity:t.disabled?.5:1,cursor:t.disabled?"not-allowed":"pointer"}},("color"===l||"image"===l)&&p(t),e.createElement(ep,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},t.name)))))},Ep=({product:o,variantOptions:r,selectedVariants:i,onVariantChange:a,variantId:l,primaryProductId:c,variantType:s="dropdown"})=>{const[d,p]=t(i||[]);n(()=>{i&&i.length>0&&p(i)},[i]),n(()=>{if(l&&o.variants.edges.some(e=>e.node.id.includes(l))){const e=o.variants.edges.find(e=>e.node.id.includes(l))?.node;if(e){const t=e.title.split(" / ");p(t)}}},[l,o]);const u=e=>{if(!r?.options)return"text";const t=r.options.find(t=>t.name===e);return t?.type||"text"},m=(e,t)=>{const n=d[t];if(!n)return null;return g(e,t).find(e=>e.name===n)||null},g=(e,t)=>{const n=r?.options?.find(t=>t.name===e.name);return e.values.filter(e=>o.variants.edges.some(n=>n.node.title.split(" / ")[t]===e)).map(e=>{const r=n?.values?.find(t=>t.name===e),i=!((e,t,n)=>{const o=[...d||[]];o[e]=t;const r=o.join(" / "),i=n.variants.edges.find(e=>e.node.title===r)?.node;return!!i&&((e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e?.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLocaleLowerCase()?1/0:0:1/0:0})(n,i.id)>0})(t,e,o);return{name:e,value:r?.value||e,disabled:i}})};return e.createElement(op,{className:"yt-fixedBundle-variant-selector-horizontal_container"},o.options.map((t,n)=>{const r=g(t,n);return 0===r.length||1===r.length&&"Default Title"===r[0].name?null:e.createElement(rp,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:t.name,$isFirst:0===n},e.createElement(Cp,{options:r,selectedValue:m(t,n),onChange:e=>{((e,t)=>{const n=[...d];n[e]=t.name,p(n);const r=o.variants.edges.find(t=>t.node.title===(o.options?.length>0?n.join(" / "):n[e]))?.node.id;a(r||"")})(n,e)},type:u(t.name)}))}))},kp=({product:r,selectedVariantId:a,isChecked:l,canCustomize:c,styles:s,onVariantChange:d,onCheckChange:p,isMobile:u,isHorizontal:m,index:g,variantOptions:x,productsLength:f,handleOpenModal:y,storeCurrencyCode:b,primaryProductId:h,variantId:v,checkedProducts:w,bundleDiscountValue:C,bundleDiscountType:E,bundleProductsCount:k,totalSelectedOriginal:T})=>{const S=o(()=>e=>{const t=r?.variants?.edges?.find(t=>t.node.id===e),n=t?.node;return n?r?.tracksInventory&&n.inventoryItem?.tracked?n.inventoryQuantity>0?n.inventoryQuantity:n.inventoryQuantity<=0&&"continue"===n.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[r]),[$,B]=t(r?.variants?.edges.find(e=>S(e?.node?.id)>0)?.node||r?.variants?.edges?.[0]?.node),z=o(()=>$?.title?.split(" / ")||[],[$]),N=r?.id===h;n(()=>{if(r.id===h){const e=r?.variants?.edges?.find(e=>e?.node?.id?.includes(a))?.node;e&&S(e.id)>0&&(B(e),d(e.id))}else{const e=r?.variants?.edges?.find(e=>e?.node?.id===a)?.node||r?.variants?.edges?.find(e=>S(e?.node?.id)>0)?.node||r?.variants?.edges?.[0]?.node;B(e)}},[r,h,a,v,d,S]);const I=i(e=>{const t=r?.variants?.edges?.find(t=>t.node.id===e)?.node;t&&d(e)},[r,d]),F=s?.fixedBundle?.discountBadgeDisplay,D=parseFloat($?.price??"0"),P=w?.size===k,A=((e,t,n,o,r,i)=>{if(0===o||!n)return e;if(o!==r)return e;switch(t){case"percentOff":case"percentageOff":case"percentage":case"Percentage":return e*(1-n/100);case"amountOff":case"amount":case"Amount Off":{if(i<=0)return e;const t=e/i*n;return Math.max(0,e-t)}case"fixedPrice":case"fixed":case"fixedPrice":return n*(e/i);default:return e}})(D,E,C??0,w?.size,k,T),_=P?A:parseFloat($?.price??"0"),R="discount-on-compare"===F?parseFloat($?.compareAtPrice||$?.price||"0"):parseFloat($?.price??"0"),O=!1!==s?.fixedBundle?.discountBadgeVisibility&&(R>_&&s?.fixedBundle?.compareAtPriceVisibility||"discount-on-compare"===F&&s?.fixedBundle?.compareAtPriceVisibility),L=_.toFixed(2),M="undefined"!=typeof window&&"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,j=$?.image?.url||r.featuredMedia?.preview?.image?.url;return e.createElement(e.Fragment,null,m?e.createElement("div",{className:""+(r.id===h?"yt-fixedBundle-product-card--horizontal-primary":"yt-fixedBundle-product-card--horizontal-associated"),style:{display:"flex",alignItems:"center",gap:"10px"}},c&&e.createElement("div",{className:"yt-fixedBundle-product-card_checkbox-wrapper--horizontal"},e.createElement("input",{type:"checkbox",style:{display:"none"},className:"yt-fixedBundle-product-card_checkbox-hidden",id:`checkbox-${r.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:N}),e.createElement("label",{className:"yt-fixed-bundle-checkbox-label yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${r.id}-${g}`,style:{width:"18px",height:"18px",border:"1.5px solid "+((s.fixedBundle?.borderColor??"#ccc")+"80"),borderRadius:s.fixedBundle?.borderRadius??"4px",backgroundColor:l?s.general?.ctaBackgroundColor??"#d3122a":"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.2s ease",color:"white"}},e.createElement(X,{style:{fontSize:"14px",visibility:l?"visible":"hidden"}}))),e.createElement(vd,{className:"yt-fixedBundle-product-card-horizontal_item",style:{borderRadius:s.fixedBundle?.borderRadius,border:`1px solid ${s.fixedBundle?.borderColor}80`,backgroundColor:s.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`8px 8px 8px -6px ${s.fixedBundle.borderColor}`,"no-spread":`4px 4px 0px -1px ${s.fixedBundle.borderColor}80`}[s.fixedBundle.shadowType]||"none"},canCustomize:c},"undefined"!=typeof window&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&e.createElement(wd,{className:"yt-fixedBundle-product-card-horizontal_image",src:_p(j),alt:r.title,style:{borderRadius:s.fixedBundle?.borderRadius,borderColor:s.fixedBundle?.borderColor,aspectRatio:s.general.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),e.createElement(Cd,{className:"yt-fixedBundle-product-card-horizontal_details"},e.createElement(Ed,{className:"yt-fixedBundle-product-card-horizontal_title"},r.title),s.fixedBundle.productsPriceVisibility&&e.createElement(kd,{className:"yt-fixedBundle-product-card-horizontal_price-section"},e.createElement(Td,{className:"yt-fixedBundle-product-card-horizontal_price--new"},Ap(s.general.currencySymbol,b)," ",Pp(L)),O&&R>_&&e.createElement(Sd,{className:"yt-fixedBundle-product-card-horizontal_price--old"},Ap(s.general.currencySymbol,b),Pp(R))),e.createElement(Ep,{product:r,variantOptions:x,selectedVariants:z,onVariantChange:I,variantId:v,primaryProductId:h})))):e.createElement(e.Fragment,null,e.createElement(Ad,{className:""+(r.id===h?"yt-fixedBundle-product-card--vertical-primary":"yt-fixedBundle-product-card--vertical-associated"),productsLength:f,style:{borderRadius:s.fixedBundle?.borderRadius,border:`1px solid ${s.fixedBundle?.borderColor}50`,backgroundColor:s.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`0 4px 10px -6px ${s.fixedBundle.borderColor}50`,"no-spread":`4px 4px 0px -1px ${s.fixedBundle.borderColor}50`}[s.fixedBundle.shadowType]||"none",...c&&{position:"relative"},...M&&{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",minWidth:"max-content",paddingLeft:"2px"}},borderRadius:s.fixedBundle?.borderRadius,borderColor:s.fixedBundle?.borderColor,backgroundColor:s.fixedBundle?.cardBackgroundColor},c&&e.createElement(ip,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:M},e.createElement("input",{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${r.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:N}),e.createElement("label",{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${r.id}-${g}`,style:{width:"18px",height:"18px",border:"1.5px solid "+((s.fixedBundle?.borderColor??"#ccc")+"80"),borderRadius:s.fixedBundle?.borderRadius??"4px",backgroundColor:l?s.general?.ctaBackgroundColor??"#d3122a":"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.2s ease",color:"white"}},e.createElement(X,{size:10,style:{fontSize:"14px",visibility:l?"visible":"hidden"}}))),"undefined"!=typeof window&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&e.createElement(_d,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:s.general.imageAspectRatio,height:"fit-content"}},e.createElement(Rd,{className:"yt-fixedBundle-product-card_image--vertical",src:_p(j),style:{aspectRatio:s.general.imageAspectRatio},alt:r.title}),r.variants.edges.length>1&&e.createElement(Od,{className:"yt-fixedBundle-product-card_badge-container"},e.createElement(Ld,{className:"yt-fixedBundle-product-card_circle-button"},e.createElement("span",null)),e.createElement(Md,{className:"yt-fixedBundle-product-card_circle-button-two"},e.createElement("span",null)),e.createElement(jd,{className:"yt-fixedBundle-product-card_count-badge"},r.variants.edges.length,"+"))),e.createElement(Vd,{className:"yt-fixedBundle-product-card-vertical_info"},e.createElement(Wd,{className:"yt-fixedBundle-product-card-vertical_title"},r.title),s.fixedBundle.productsPriceVisibility&&e.createElement(qd,{className:"yt-fixedBundle-product-card-vertical_price-line"},e.createElement(Hd,{className:"yt-fixedBundle-product-card-vertical_price--new"},Ap(s.general.currencySymbol,b),Pp(L)),s.fixedBundle.compareAtPriceVisibility&&O&&R>_&&e.createElement(Sd,{className:"yt-fixedBundle-product-card-vertical_price--old"},Ap(s.general.currencySymbol,b),Pp(R))))),(f<=3||!u)&&g<f-1&&e.createElement(Qd,{className:"yt-fixedBundle-plus-wrapper"}," ",e.createElement(Ud,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},Tp=({bundle:r,addToCartFunction:a,dispatchAnalyticsEvent:l})=>{const[c,s]=t(!1),[d,p]=t(window.innerWidth<786),[u,m]=t(null),[g,x]=t(!1),[f,y]=t(!1),b="undefined"!=typeof window?window.location.href:null,h=r?.products?.find(e=>e.productDetails?.handle===b?.split("/").pop()?.split("?")[0]),v=h?.productId,w=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e?.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),[C,E]=t(Object.fromEntries(r?.products?.map((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find(t=>w(e.productDetails,t?.node?.id)>0)?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id]))),k=r?.showIndividualProductSelector??!0,[T,S]=t(new Set(r.products.reduce((e,t,n)=>((t?.productId===v||k)&&e.push(n),e),[])));n(()=>{l?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:r._id,bundleType:"fixed-bundle"}});const e=()=>{const e=new URL(window.location.href).searchParams.get("variant");m(e)},t=e=>{const t=history[e];return function(...n){const o=t.apply(this,n);return window.dispatchEvent(new Event(e.toLowerCase())),o}};return history.pushState=t("pushState"),history.replaceState=t("replaceState"),window.addEventListener("pushstate",e),window.addEventListener("replacestate",e),e(),()=>{window.removeEventListener("pushstate",e),window.removeEventListener("replacestate",e)}},[]),n(()=>{u&&v&&E(e=>{const t={...e};return r?.products?.forEach((e,n)=>{e.productId===v&&(t[n.toString()]=u)}),t})},[u,v,r?.products]),n(()=>{const e=()=>{p(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const $=i((e,t)=>{E(n=>({...n,[e.toString()]:t}))},[]),B=(e,t)=>{r.products[t].productId!==v&&S(n=>{const o=new Set(n);return e?o.add(t):o.delete(t),o})},z=o(()=>(e,t)=>w(e.productDetails,t)>0,[w]),N=o(()=>r.products.some((e,t)=>T.has(t)&&e.productDetails.variants.edges.length>1),[r.products,T]),{originalPrice:I,dealPrice:F,offerValue:D}=o(()=>{const{price:e,compareAtPrice:t}=r.products.reduce((e,t,n)=>{if(!T.has(n))return e;const o=C[n.toString()];if(!o)return e;const r=t.productDetails.variants.edges?.find(e=>e.node.id===o)?.node;if(!r)return e;const i=parseFloat(r?.price??"0"),a=parseFloat(r?.compareAtPrice||i.toString());return e.price+=i,e.compareAtPrice+=a,e},{price:0,compareAtPrice:0}),n="discount-on-compare"===(r?.customizations?.fixedBundle?.discountBadgeDisplay||"discount-on-price")?t:e;let o=e;T.size===r.products.length&&(r?.percentageOff?o=e*(1-r.percentageOff/100):r?.dealAmount?o=r.dealAmount:r?.amountOff&&(o=e-r.amountOff));const i=n-o;return{originalPrice:n.toFixed(2),dealPrice:o.toFixed(2),offerValue:i.toFixed(2)}},[r.products,C,T,r.percentageOff,r.dealAmount,r.amountOff,r?.customizations?.fixedBundle?.discountBadgeDisplay]),P=o(()=>r.products.map((e,t)=>({product:e,index:t})).filter(({index:e})=>T.has(e)),[r.products,T]),A=P.every(({product:e,index:t})=>z(e,C[t.toString()])),_=o(()=>{let e=0;return r.products.forEach((t,n)=>{if(T.has(n)){const o=C[n.toString()],r=t.productDetails.variants.edges.find(e=>e.node.id===o)?.node;r&&(e+=parseFloat(r.price??"0"))}}),e},[r.products,T,C]),R=async e=>{s(!0),x(!1),l?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:r._id,bundleType:"fixed-bundle",selectedProducts:P?.map(e=>({id:e?.product?.productId,title:e?.product?.productDetails?.title}))}});try{const t=Object.entries(C).map(([e,t])=>{const n=parseInt(e);return isNaN(n)||!T.has(n)?null:t}).filter(Boolean);a&&await a(Number(I),t,void 0,void 0,e)}catch(e){console.error("Error adding to cart:",e)}s(!1)},O=async e=>{if(A){if(e&&(e.preventDefault(),e.stopPropagation()),r.personalizedForm)return x(!1),void y(!0);await R()}};if(!a)return e.createElement(e.Fragment,null);const L=r.customizations,M=L.fixedBundle?.cardLayoutStyle||"auto",j="horizontal"===M||"auto"===M&&d,V="bundles"==r.appName?r.pageHeader?.title:r?.title,W="bundles"==r.appName?r.pageHeader?.description:r?.subtitle;return e.createElement(fd,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:L.fixedBundle.sectionBackgroundColor,..."transparent"!==L.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},V&&e.createElement(yd,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:L.fixedBundle?.titleBackgroundColor||"none",color:L.fixedBundle?.titleTextColor||"black",textAlign:L.fixedBundle.infoAlignment??"center",fontSize:L.fixedBundle?.titleFontSize,..."transparent"!==L.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===L.fixedBundle.infoAlignment&&"transparent"!==L.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===L.fixedBundle.infoAlignment&&"transparent"!==L.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===L.fixedBundle.infoAlignment&&"transparent"===L.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},V),W&&e.createElement(bd,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:L.fixedBundle?.subtitleFontSize,textAlign:L.fixedBundle.infoAlignment??"center",..."left"===L.fixedBundle.infoAlignment&&"transparent"!==L.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===L.fixedBundle.infoAlignment&&"transparent"!==L.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===L.fixedBundle.infoAlignment&&"transparent"===L.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},W),j?e.createElement(hd,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},r?.products?.map((t,n)=>e.createElement(e.Fragment,{key:`${t.productId}-${n}`},e.createElement(kp,{isChecked:T.has(n),product:t.productDetails,selectedVariantId:C[n.toString()]||"",canCustomize:r?.canCustomizeFixedBundle||!1,styles:L,onVariantChange:e=>$(n,e),onCheckChange:e=>{B(e,n)},isMobile:d,index:n,isHorizontal:j,variantOptions:r.variantOptions,productsLength:r.products.length,storeCurrencyCode:r.storeCurrencyCode,primaryProductId:v,variantId:u||void 0,bundleDiscountType:r.discountType??"none",checkedProducts:T,bundleProductsCount:r.products.length,bundleDiscountValue:r.percentageOff||r.amountOff||r.dealAmount,totalSelectedOriginal:_})))):e.createElement(Dd,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},e.createElement(Pd,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===L.fixedBundle.infoAlignment?"flex-start":"right"===L.fixedBundle.infoAlignment?"flex-end":"center"}},r?.products?.map((t,n)=>e.createElement(kp,{key:`${t.productId}-${n}`,isChecked:T.has(n),product:t.productDetails,selectedVariantId:C[n.toString()]||"",canCustomize:r?.canCustomizeFixedBundle||!1,styles:L,onVariantChange:e=>{$(n,e)},onCheckChange:e=>B(e,n),isMobile:d,index:n,isHorizontal:j,productsLength:r.products.length,storeCurrencyCode:r.storeCurrencyCode,primaryProductId:v,variantId:u||void 0,bundleDiscountType:r.discountType??"none",checkedProducts:T,bundleProductsCount:r.products.length,bundleDiscountValue:r.percentageOff||r.amountOff||r.dealAmount,totalSelectedOriginal:_})),N&&e.createElement(wp,{productsWithIndices:P,isOpen:g,onClose:()=>x(!1),variantOptions:r.variantOptions,cta:{textColor:L.general.ctaTextColor,backgroundColor:L.general.ctaBackgroundColor},onVariantChange:$,handleAddToCart:O,primaryProductId:v,variantId:u||void 0}))),e.createElement($d,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===L.fixedBundle.infoAlignment?"flex-start":"right"===L.fixedBundle.infoAlignment?"flex-end":"center"}},Number(I)>0&&Number(D)>0&&L.fixedBundle.compareAtPriceVisibility&&e.createElement(Bd,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",e.createElement(Nd,{className:"yt-fixedBundle-summary_price"},Ap(L.general.currencySymbol,r?.storeCurrencyCode),Pp(I))),0!==T.size&&e.createElement(zd,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",e.createElement(Nd,{className:"yt-fixedBundle-summary_price"},Ap(L.general.currencySymbol,r?.storeCurrencyCode),Pp(F))," ",Number(D)>0&&e.createElement(Id,{className:"yt-fixedBundle-summary_save-tag"},"Save:"," ",Ap(L.general.currencySymbol,r?.storeCurrencyCode),Pp(D)))),e.createElement(Fd,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),j||!N?O(e):x(!0)},disabled:T.size<1||c||!A,style:{backgroundColor:L.general?.ctaBackgroundColor||"#121212",color:L.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${L.general?.ctaBackgroundColor||"#121212"}`,boxShadow:L.general.ctaShadowType,paddingTop:L.general?.ctaPadding,paddingBottom:L.general?.ctaPadding,borderRadius:L.general.ctaBorderRadius,width:L.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{L.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=L.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=L.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{L.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=L.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=L.general?.ctaTextColor||"#FFFFFF")}},c?e.createElement(ue,{color:"white",loading:c,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):A?e.createElement(e.Fragment,null,L.fixedBundle?.ctaTitle??"Add Bundle to cart"):e.createElement(e.Fragment,null,"Out of Stock")),r?.personalizedForm&&e.createElement(os,{isOpen:f,onClose:()=>y(!1),formConfig:r.personalizedForm,onCheckout:async e=>{await R(e),y(!1)},cta:{backgroundColor:L.general?.ctaBackgroundColor||"#121212",textColor:L.general?.ctaTextColor||"#FFFFFF"},isMobile:d}))},Sp=({product:o,tierIdx:r,isOpen:i,onClose:a,onAddToBundle:l,canAdd:c,isSelected:s,customizations:d,isMobile:p,splitVariants:u=!1})=>{const[m,g]=t(0),[x,f]=t(o.variants[0]?.id.toString()||""),[y,b]=t(!0),h=o.variants.find(e=>e.id.toString()===x)||o.variants[0],v=o.images.filter(Boolean),w=()=>{v.length<=1||(g(e=>0===e?v.length-1:e-1),b(!0))},C=()=>{v.length<=1||(g(e=>e===v.length-1?0:e+1),b(!0))};if(n(()=>(i&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=""}),[i]),n(()=>{if(h&&h?.featured_image?.src){const e=document.querySelector(".yt-collection-bundle-modal-image"),t=_p(h?.featured_image?.src);e?.setAttribute("src",t)}},[h]),!i)return null;const E=v.length>1,k=e.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:a},e.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",borderRadius:d?.borderRadius||"12px",maxWidth:1e3,width:"100%",height:"72dvh",margin:"auto",display:"flex",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:a,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"}},e.createElement(G,{size:22})),e.createElement("div",{className:"yt-collection-bundle-modal-image-container",style:{flex:1,position:"relative",margin:"20px 0 20px 20px",borderRadius:d?.borderRadius||"12px",background:"#f5f5f5"}},v.length>0&&e.createElement(e.Fragment,null,y&&e.createElement("style",null,"\n @keyframes shimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n }\n "),y&&e.createElement("div",{style:{position:"absolute",inset:0,background:"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s infinite",borderRadius:d?.borderRadius||"12px"}}),e.createElement("img",{className:"yt-collection-bundle-modal-image",src:_p(v[m]||o.images[0]),alt:o.title,onLoad:()=>b(!1),style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:d?.borderRadius||"12px",opacity:y?0:1,transition:"opacity 0.3s"}}),E&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:w,disabled:0===m,style:{position:"absolute",left:16,top:"50%",transform:"translateY(-50%)",background:0===m?"rgba(0,0,0,0.2)":"rgba(0,0,0,0.4)",border:"none",borderRadius:"50%",width:44,height:44,display:"flex",alignItems:"center",justifyContent:"center",cursor:0===m?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:0===m?.5:1}},e.createElement(Z,{size:24})),e.createElement("button",{onClick:C,disabled:m===v.length-1,style:{position:"absolute",right:16,top:"50%",transform:"translateY(-50%)",background:m===v.length-1?"rgba(0,0,0,0.2)":"rgba(0,0,0,0.4)",border:"none",borderRadius:"50%",width:44,height:44,display:"flex",alignItems:"center",justifyContent:"center",cursor:m===v.length-1?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:m===v.length-1?.5:1}},e.createElement(L,{size:24}))))),e.createElement("div",{className:"yt-collection-bundle-modal-content",style:{flex:1,padding:"30px",overflowY:"auto",display:"flex",flexDirection:"column",scrollbarWidth:"none"}},e.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"6px 0",fontSize:24,fontWeight:600,lineHeight:"normal"}},u&&h?.name||o.title),!u&&o.variants.length>1&&e.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative"}},e.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee",lineHeight:"normal"}},o?.options?.join(" & "),":"," ",e.createElement("strong",null,h.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:x,onChange:e=>{f(e.target.value),b(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer",lineHeight:"normal"}},o.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0",lineHeight:"normal"}},"₹",(h.price/100).toLocaleString(),h.compare_at_price&&h.compare_at_price>h.price?e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999",lineHeight:"normal"}},"₹",(h.compare_at_price/100).toLocaleString()):null),e.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"white"}},e.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!c?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>l(o,r),disabled:!c||!h.available,style:{width:"100%",padding:"12px",fontSize:17,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:h.available?s||!c?"#28a745":d?.atcBg||"#007bff":"rgb(204, 204, 204)",color:d?.atcText||"#fff",cursor:c&&h.available?"pointer":"not-allowed",textAlign:"center",lineHeight:"normal"}},s?"Added to Box":h.available?"Add to Box":"Out of Stock")),o.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:o.description},style:{lineHeight:"normal",color:"#444",marginTop:"10px"}})))),T=e.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:a},e.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",width:"100%",height:"100dvh",display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:a,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement(G,{size:22})),e.createElement("div",{className:"yt-collection-bundle-modal-scroll-container",style:{flex:1,overflowY:"auto",paddingBottom:100}},v.length>0&&e.createElement("div",{className:"yt-collection-bundle-modal-image-wrapper",style:{position:"relative",background:"#f5f5f5"}},y&&e.createElement("div",{style:{position:"absolute",inset:0,background:"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s infinite"}}),e.createElement("img",{className:"yt-collection-bundle-modal-image",src:v[m]||o.images[0],alt:o.title,onLoad:()=>b(!1),style:{width:"100%",minWidth:"100%",display:"block",maxHeight:"50vh",minHeight:"50vh",objectFit:"cover",objectPosition:"center",opacity:y?0:1,transition:"opacity 0.3s"}}),E&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:w,disabled:0===m,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",background:0===m?"rgba(0,0,0,0.3)":"rgba(0,0,0,0.5)",border:"none",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",zIndex:5,opacity:0===m?.5:1,cursor:0===m?"not-allowed":"pointer"}},e.createElement(Z,{size:20})),e.createElement("button",{onClick:C,disabled:m===v.length-1,style:{position:"absolute",right:12,top:"50%",transform:"translateY(-50%)",background:m===v.length-1?"rgba(0,0,0,0.3)":"rgba(0,0,0,0.5)",border:"none",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",zIndex:5,opacity:m===v.length-1?.5:1,cursor:m===v.length-1?"not-allowed":"pointer"}},e.createElement(L,{size:20})))),e.createElement("div",{className:"yt-collection-bundle-modal-content",style:{padding:"20px"}},e.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"0 0 12px",fontSize:22,fontWeight:600}},o.title),!u&&o.variants.length>1&&e.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative",marginBottom:20}},e.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee"}},o?.options?.join(" & "),":"," ",e.createElement("strong",null,h.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:x,onChange:e=>{f(e.target.value),b(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}},o.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0"}},"₹",(h.price/100).toLocaleString(),h.compare_at_price?h.compare_at_price>h.price&&e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999"}},"₹",(h.compare_at_price/100).toLocaleString()):null),o.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:o.description},style:{lineHeight:1.7,color:"#444"}}))),e.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"#fff",padding:"8px 10px",borderTop:"1px solid #eee",boxShadow:"0 -4px 10px rgba(0,0,0,0.05)"}},e.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!c?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>l(o,r),disabled:!c||!h.available,style:{width:"100%",padding:"10px",fontSize:14,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:!s&&c&&h.available?d?.atcBg||"#007bff":"#28a745",color:d?.atcText||"#fff",cursor:c&&h.available?"pointer":"not-allowed"}},s?"Added to Box":h.available?"Add to Box":"Out of Stock"))));return P.createPortal(p?T:k,document.body)},$p=({styles:t,isMobile:n,categories:o,activeCategory:r,onCategoryChange:i})=>{const a=e=>{i(e)},l=(e,t)=>{const n=e.replace("#","");return`rgba(${parseInt(n.substring(0,2),16)||0}, ${parseInt(n.substring(2,4),16)||0}, ${parseInt(n.substring(4,6),16)||0}, ${t})`};return"tabs"===t?.categoryFilterOnPage?e.createElement("div",{className:"yt-collection-bundle-category-filter-wrapper",style:{overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",width:"100%"}},e.createElement("div",{className:"yt-collection-bundle-category-tabs-container",style:{display:"flex",gap:"0px",minWidth:"max-content",paddingBottom:"1px",flexWrap:"nowrap",justifyContent:"center",borderBottom:"1px solid #e0e0e0",width:"auto",height:n?"28px":"45px"}},["All",...o].map(o=>{const i=r===o,c=t.btnPrimaryBg||"#111";return e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-collection-bundle-category-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:i?"600":"400",color:i?c:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:i?l(c,.07):"transparent",borderBottom:i?`2px solid ${c}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:e=>{i||(e.currentTarget.style.color=c)},onMouseLeave:e=>{i||(e.currentTarget.style.color="#666")}},e.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},o.charAt(0).toUpperCase()+o.slice(1)),e.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},o.charAt(0).toUpperCase()+o.slice(1)))}))):e.createElement("div",{className:"yt-collection-bundle-category-filter-wrapper",style:{overflowX:n?"auto":"visible",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",paddingBottom:"5px"}},e.createElement("div",{className:"yt-collection-bundle-category-buttons-container",style:{display:"flex",gap:"8px",minWidth:"max-content",flexWrap:"nowrap",justifyContent:"center",paddingRight:n?"10px":"0px"}},["All",...o].map(o=>{const i=t.btnPrimaryBg||"#111",l=t.borderRadius||"8px";return e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-collection-bundle-category-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${r===o?i:"#e0e0e0"}`,borderRadius:l,backgroundColor:r===o?i:"white",color:r===o?"white":"#333",cursor:"pointer"}},o.charAt(0).toUpperCase()+o.slice(1))})))},Bp=e=>{if(e.metafields&&e.metafields.yourtoken_bundles_app&&e.metafields.yourtoken_bundles_app.categories){const t=e.metafields.yourtoken_bundles_app.categories;if(Array.isArray(t))return t;if("string"==typeof t)try{const e=JSON.parse(t);if(Array.isArray(e))return e}catch(e){console.error("Failed to parse categories:",e)}}return[]},zp=({config:o,bundleAddToCartLoading:a,addCustomBundleToCart:l})=>{const[c,s]=t(1),[d,p]=t("All"),[u,m]=t([]),[g,x]=t(null),[f,y]=t({}),[b,h]=t(!1),[v,w]=t(window.innerWidth<640),[C,E]=t({}),k=r(null),T=r(new Map),[S,$]=t(160),B=v?8:20,{customizations:z}=o,N=o.config.builderTiers.collectionTier.sort((e,t)=>e.tier-t.tier),I=!!o.config.form,F=N.length+(I?1:0),D=z.hideSelectedProducts,P=z.allowMultipleQty,A=z.hideOutOfStockProducts,_=o.config.splitVariants??!1,R=r(new Set),O=i((e,t=d)=>{const n=N[e-1]?.products||[],o="All"===t?n:n.filter(e=>Bp(e).includes(t));return A?o.filter(e=>e.available):o},[N,d,A]),L=i(e=>{const t=O(e).length;E(n=>{const o=n[e]||0,r=Math.min(o+8,t);return r<=o?n:{...n,[e]:r}})},[8,O]);n(()=>(k.current=new IntersectionObserver(e=>{for(const t of e)if(t.isIntersecting){const e=parseInt(t.target.getAttribute("data-sentinel-step")||"0");e>0&&e===c&&L(e)}},{root:null,threshold:0,rootMargin:"100px 0px"}),()=>{k.current?.disconnect()}),[L,c]),n(()=>{p("All")},[c]),n(()=>{if(I&&c===F)return;const e=c-1;if(!N[e])return;if(R.current.has(e))return;const t=O(c);if(console.log("filteredProducts",t),1!==t.length)return;const n=t[0],o=n.variants.filter(e=>e.available);if(1!==o.length)return;const r=o[0],i=Q(e),a=Y[e];if(i!==1/0&&a>=i)return;if(!u.some(t=>t.productId===n.id.toString()&&t.variantId===r.id.toString()&&t.tierIndex===e)&&(R.current.add(e),m(t=>[...t,{productId:n.id.toString(),variantId:r.id.toString(),price:r.price,quantity:1,tierIndex:e}]),c<F)){const e=setTimeout(()=>{s(e=>e+1),window.scrollTo(0,0)},50);return()=>clearTimeout(e)}},[c]),n(()=>{if(I&&c===F)return;const e=c,t=O(e).length;E(n=>{const o=n[`${e}_category`]!==d;return 0===(n[e]||0)||o?{...n,[e]:Math.min(B,t),[`${e}_category`]:d}:n})},[c,B,d,O]),n(()=>{const e=document.querySelector(".box-loader-scene");e&&e.setAttribute("style","display: none;");const t=()=>w(window.innerWidth<640);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const M=i(e=>{$(e+10)},[]),j=u.reduce((e,t)=>e+t.quantity,0),V=u.reduce((e,t)=>e+t.price*t.quantity,0)/100,W=u.reduce((e,t)=>{const n=N.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId),o=n?.variants.find(e=>e.id.toString()===t.variantId);return e+(o?.compare_at_price??t.price)*t.quantity},0)/100,H=(e,t)=>{const n=e.variants.find(e=>e.id===parseInt(t));if(!n)return;const o=document.querySelector(`[data-product-id="${e.id}"]`);o&&(o.dataset.selectedVariant=t,o.dataset.currentPrice=n.price.toString())},q=(e,t)=>{const n=document.querySelector(`[data-product-id="${e.id}"]`);if(!n)return;const o=n.dataset.selectedVariant||e.variants[0].id.toString(),r=parseInt(n.dataset.currentPrice||e.variants[0].price.toString());m(n=>{const i=`${e.id}-${o}-${t}`,a=n.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===i);if(a)return n.filter(e=>e!==a);const l=Y[t],c=Q(t);return c!==1/0&&l>=c?n:[...n,{productId:e.id.toString(),variantId:o,price:r,quantity:1,tierIndex:t}]})},Q=e=>{const t=N[e];return t.maximumQuantity>0?t.maximumQuantity:1/0},U=(e,t)=>{const n=Q(t);if(n===1/0)return!0;const o=Y[t];return!!u.some(n=>n.productId===e.id.toString()&&n.tierIndex===t)||o<n},Y=N.map((e,t)=>u.filter(e=>e.tierIndex===t).reduce((e,t)=>e+t.quantity,0)),G=(e,t,n)=>{const o=Q(n);if(o===1/0)return!0;return Y[n]<o},X=I&&c===F,Z=(X?null:N[c-1])?Q(c-1):0,K=N.map((e,t)=>({tier:e,items:u.filter(e=>e.tierIndex===t).reduce((e,t)=>{const n=`${t.productId}-${t.variantId}`,o=e.find(e=>`${e.productId}-${e.variantId}`===n);return o?o.quantity+=t.quantity:e.push({...t,quantity:t.quantity}),e},[]),count:Y[t]}));return e.createElement("div",{className:"yt-collection-bundle-builder",style:{margin:"0 auto",maxWidth:"1600px"}},z.headerImage&&!z.headerImage.includes("Liquid error")&&e.createElement("img",{className:"yt-collection-bundle-header-img",src:z.headerImage,alt:"Collection Bundle header",style:{width:"100%"}}),z.showTierSteps&&e.createElement("div",{style:{paddingTop:z.headerImage&&!z.headerImage.includes("Liquid error")?"20px":"0"}},e.createElement(Np,{totalSteps:F,isFormStep:X,currentStep:c,getStepTitle:e=>I&&e===F?"Customize Gift Details":N[e-1]?.title||`Step ${e}`,isMobile:v,formTitle:o?.config?.form?.title,hasForm:I,onStepClick:e=>{if(e>1&&!u.length)return alert("Add at least one product first");s(e),window.scrollTo(0,0)}})),Array.from({length:F},(e,t)=>t+1).map(t=>{const n=I&&t===F,r=n?[]:(e=>N[e-1]?.products||[])(t);let i=[];if(!n&&z.enableProductCategories){const e=new Set;r.forEach(t=>Bp(t).forEach(t=>e.add(t))),i=Array.from(e).sort()}const a=n?[]:O(t),l=t-1,s=a.slice(0,C[t]||0);return e.createElement("div",{key:t,className:"yt-collection-bundle-step-content "+(c===t?"yt-collection-bundle-step-content-active":""),style:{display:c===t?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},n&&o.config.form?e.createElement(Xc,{form:o.config.form,formData:f,setFormData:y,barHeight:S,isUploading:b,setIsUploading:h}):e.createElement(e.Fragment,null,z.enableProductCategories&&i.length>0&&e.createElement($p,{styles:z,isMobile:v,categories:i,activeCategory:d,onCategoryChange:p}),e.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:v?"grid":"flex",gridTemplateColumns:v?"repeat(2,1fr)":"",flexWrap:v?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:`${S}px`}},_?s.flatMap(t=>t.variants.filter(e=>!A||e.available).map(n=>e.createElement(Ip,{key:`${t.id}-${n.id}`,product:{...t,variants:[n]},tierIdx:l,customizations:z,isMobile:v,hoveredCard:g,setHoveredCard:x,selectedProducts:u,handleAddToBundle:q,canAddProduct:U,allowMultipleQty:P,handleVariantChange:H,canIncrement:G,setSelectedProducts:m,splitVariants:!0}))):s.map(t=>e.createElement(Ip,{key:t.id,product:t,tierIdx:l,customizations:z,isMobile:v,hoveredCard:g,setHoveredCard:x,selectedProducts:u,handleAddToBundle:q,canAddProduct:U,allowMultipleQty:P,handleVariantChange:H,canIncrement:G,setSelectedProducts:m,splitVariants:!1})),c===t&&(C[t]||0)<a.length&&e.createElement("div",{ref:e=>{const n=T.current.get(t);n&&k.current?.unobserve(n),e?(T.current.set(t,e),k.current?.observe(e)):T.current.delete(t)},"data-sentinel-step":t.toString(),style:{height:"20px",width:"100%",display:"block"}}))))}),e.createElement(Fp,{config:o,selectedProducts:u,selectedByTier:K,totalItems:j,totalPrice:V,totalCompareAtPrice:W,currentStep:c,totalSteps:F,currentTierMax:Z,tierSelectedCounts:Y,isMobile:v,bundleAddToCartLoading:a,isUploading:b,hoveredCard:g,setHoveredCard:x,hideSelectedProducts:D,getProductStep:e=>{for(let t=0;t<N.length;t++)if(N[t].products.some(t=>t.id.toString()===e))return t+1;return I?F:N.length},setCurrentStep:s,handleRemoveItem:(e,t,n)=>{m(o=>o.filter(o=>!(o.productId===e&&o.variantId===t&&o.tierIndex===n)))},handleCheckout:async()=>{if(c!==F||!u.length)return;const e={};I&&Object.entries(f).forEach(([t,n])=>{const o=t.split("|").pop()?.replace(/^f_\d+$/,"")||t;"string"==typeof n&&n.trim()?e[o]=n:n&&"object"==typeof n&&"url"in n&&(e[o]=n.url)});const t=u.map(t=>({variantId:t.variantId,quantity:t.quantity,properties:e}));l(t)},hasForm:I,onHeightChange:M}))},Np=({totalSteps:t,isFormStep:o,currentStep:r,getStepTitle:i,isMobile:a,formTitle:l,hasForm:c,onStepClick:s})=>{const d=e.useRef(null);return n(()=>{if(!a||!d.current)return;const e=d.current.querySelector(".yt-collection-bundle-step-item-active");e&&e.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})},[r,a]),e.createElement("div",{className:"yt-collection-bundle-steps-nav-container",style:{display:"flex",justifyContent:"center",flexDirection:"column",gap:a?"0":"1rem",overflowX:"auto",scrollbarWidth:"none",borderBottom:"1px solid #878787",marginInline:a?"0":"2%",paddingBottom:"1rem",textAlign:"center"}},e.createElement("div",{ref:d,className:"yt-collection-bundle-steps-nav",style:{display:"flex",justifyContent:a?"flex-start":"center",gap:a?"1rem":"2rem",minWidth:a?100*t+"px":"auto",paddingInline:a?"calc(50% - 60px)":"0",scrollPaddingInline:a?"calc(50% - 60px)":"0",scrollBehavior:"smooth",overflowX:"auto",scrollbarWidth:"none"}},Array.from({length:t},(e,t)=>t+1).map(n=>e.createElement("div",{key:n,className:"yt-collection-bundle-step-item "+(r===n?"yt-collection-bundle-step-item-active":""),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.5rem",minWidth:a?"100px":"120px",flexShrink:0,cursor:"pointer",opacity:r===n?1:.5,transition:"opacity 0.2s"},onClick:()=>s(n)},e.createElement("div",{className:"yt-collection-bundle-step-icon "+(r===n?"yt-collection-bundle-step-icon-active":""),style:{width:"40px",height:"40px",background:r===n?"#000":"#fff",border:"2px solid #ccc",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center"}},c&&n===t?e.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},e.createElement("path",{d:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.67C10.96 2.54 10.05 2 9 2c-1.66 0-3 1.34-3 3 0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1h-2c-.55 0-1-.45-1-1s.45-1 1-1h2zm-6 0c.55 0 1 .45 1 1s-.45 1-1 1H7c-.55 0-1-.45-1-1s.45-1 1-1h2zM20 19H4V8h16v11z"})):e.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},e.createElement("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}))),e.createElement("div",{className:"yt-collection-bundle-step-label",style:{fontSize:"14px",textAlign:"center",color:"#333",fontWeight:"600",lineHeight:"normal"}},i(n))))),l&&c&&o&&e.createElement("p",{className:"yt-collection-bundle-steps-nav-description",style:{fontSize:a?"14px":"16px",marginBottom:a?"0":"14px",fontWeight:"400",color:"#000",lineHeight:"normal"}},l))},Ip=({product:n,tierIdx:o,customizations:r,isMobile:i,hoveredCard:a,setHoveredCard:l,selectedProducts:c,handleAddToBundle:s,canAddProduct:d,allowMultipleQty:p,handleVariantChange:u,canIncrement:m,setSelectedProducts:g,splitVariants:x=!1})=>{const[f,y]=t(!1),b=x?null:document.querySelector(`[data-product-id="${n.id}"]`),h=x?n.variants[0].id.toString():b?.dataset.selectedVariant??n.variants[0].id.toString(),v=n.variants.find(e=>e.id.toString()===h)||n.variants[0],w=x?`${n.id}-${v.id}`:n.id,C=c.some(e=>e.productId===n.id.toString()&&e.variantId===h&&e.tierIndex===o),E=a===w,k=c.filter(e=>e.productId===n.id.toString()&&e.variantId===v.id.toString()&&e.tierIndex===o).reduce((e,t)=>e+t.quantity,0);return e.createElement(e.Fragment,null,e.createElement("div",{key:w,className:"yt-collection-bundle-product-item","data-product-id":n.id,"data-selected-variant":v.id,"data-current-price":v.price,style:{display:"flex",flexDirection:"column",border:r?.productCardBorder||"1px solid #ddd",background:r?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:i?0:"250px",maxWidth:i?"none":"250px",borderRadius:r?.borderRadius||"8px",boxShadow:"spread"===r?.productCardShadow?"8px 8px 8px -6px #0000004D":"no-spread"===r?.productCardShadow?"6px 6px 0px -1px #00000033":"none",width:i?"100%":""}},e.createElement("div",{className:"yt-collection-bundle-product-image",style:{position:"relative",width:"100%",aspectRatio:r?.productImageRatio||"1/1",overflow:"hidden",cursor:"pointer",background:"#f9f9f9"},onClick:()=>y(!0),onMouseEnter:()=>l(w),onMouseLeave:()=>l(null)},e.createElement("img",{src:_p(n.images[0]||"https://cdn.shopify.com/s/files/1/0750/9937/3789/files/placeholder-thumbnail.png?width=250px"),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:E?0:1,transform:E?"scale(1.05)":"scale(1)"},alt:n.title}),e.createElement("img",{src:_p(n.images[1]||n.images[0]),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:E?1:0,transform:"scale(1.05)"},alt:n.title}),!x&&n.variants.length>1&&e.createElement("select",{className:"yt-collection-bundle-variant-selector",style:{position:"absolute",bottom:"10px",left:"10px",right:"10px",background:"rgba(255,255,255,0.9)",border:"none",borderRadius:"4px",padding:"8px",fontSize:"12px",fontWeight:"600",zIndex:2,lineHeight:"normal"},onChange:e=>u(n,e.target.value),defaultValue:v.id,onClick:e=>{e.stopPropagation()}},n.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-product-info",style:{padding:"12px",flexGrow:1,display:"flex",flexDirection:"column"}},r.productCardCategoryVisibility&&Bp(n).length>0&&e.createElement("div",{className:"yt-collection-bundle-product-categories-wrapper",style:{paddingBottom:"8px"}},e.createElement("div",{className:"yt-collection-bundle-product-categories",style:{display:"flex",flexWrap:"wrap",gap:"4px"}},Bp(n).slice(0,2).map((t,n)=>e.createElement("span",{className:"yt-collection-bundle-category-tag",key:n,style:{fontSize:i?"10px":"12px",color:"#666",fontWeight:"500"}},t.charAt(0).toUpperCase()+t.slice(1))),Bp(n).length>2&&e.createElement("span",{className:"yt-collection-bundle-more-categories",style:{fontSize:"10px",padding:"2px 6px",backgroundColor:"rgba(0, 0, 0, 0.05)",borderRadius:"8px",color:"#666",fontWeight:"500"}},"+",Bp(n).length-2," more"))),e.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:i?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:"normal",color:"#333",flexGrow:x?0:1}},n.title),x&&"Default Title"!==v.title&&e.createElement("p",{className:"yt-collection-bundle-variant-label",style:{fontSize:i?"10px":"12px",color:"#666",margin:"0 0 4px",lineHeight:"normal",flexGrow:1}},v.title),e.createElement("div",{className:"yt-collection-bundle-product-prices",style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"nowrap",whiteSpace:"nowrap",overflow:"hidden",lineHeight:"normal"}},e.createElement("span",{className:"yt-collection-bundle-product-price",style:{fontSize:i?"14px":"16px",fontWeight:"bold",color:"#000",flexShrink:0,lineHeight:"normal"}},"₹",(v.price/100).toLocaleString()),v.compare_at_price&&0!==v.compare_at_price&&v.compare_at_price>v.price?e.createElement("span",{className:"yt-collection-bundle-product-compare",style:{fontSize:"14px",textDecoration:"line-through",color:"#999",flexShrink:0,lineHeight:"normal"}},"₹",(v.compare_at_price/100).toLocaleString()):null)),p&&k>0?e.createElement("div",{className:"yt-collection-bundle-quantity-row",style:{display:"flex",alignItems:"center",flexWrap:"nowrap",background:"#cccccc"}},e.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-minus",style:{width:"40%",height:v.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:i?"6px":"12px",fontSize:i?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{g(e=>{const t=`${n.id}-${v.id}-${o}`,r=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return r&&r.quantity>1?e.map(e=>e===r?{...e,quantity:e.quantity-1}:e):r?e.filter(e=>e!==r):e})}},"-"),e.createElement("span",{className:"yt-collection-bundle-qty-display",style:{minWidth:"24px",textAlign:"center",fontWeight:600,width:"100%",lineHeight:"normal"}},k),e.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-plus",style:{width:"40%",height:v.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:i?"6px":"12px",fontSize:i?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{v.available&&m(n,v.id.toString(),o)&&g(e=>{const t=`${n.id}-${v.id}-${o}`,r=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return r?e.map(e=>e===r?{...e,quantity:e.quantity+1}:e):[...e,{productId:n.id.toString(),variantId:v.id.toString(),price:v.price,quantity:1,tierIndex:o}]})},disabled:!v.available||!m(n,v.id.toString(),o)},"+")):e.createElement("button",{className:"yt-collection-bundle-add-btn "+(C?"yt-collection-bundle-add-btn-added":""),style:{background:C?"#28a745":d(n,o)&&v.available?r?.atcBg||"#007bff":"#ccc",color:r?.atcText||"#fff",border:"none",padding:i?"6px":"12px",fontSize:i?"12px":"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",opacity:v.available?1:.6,lineHeight:"normal",textAlign:"center"},onClick:()=>{if(x)v.available&&d(n,o)&&g(e=>{const t=`${n.id}-${v.id}-${o}`,r=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return r?e.filter(e=>e!==r):[...e,{productId:n.id.toString(),variantId:v.id.toString(),price:v.price,quantity:1,tierIndex:o}]});else{if(!v.available||!d(n,o))return;s(n,o)}},disabled:!v.available||!d(n,o)},C?"Added":v.available?"ADD TO BOX":"Out of Stock")),f&&e.createElement(Sp,{product:n,tierIdx:o,isOpen:f,onClose:()=>y(!1),onAddToBundle:(e,t)=>{s(e,t),y(!1)},canAdd:d(n,o),isSelected:C,customizations:r,isMobile:i,splitVariants:x}))},Fp=o=>{const{config:i,selectedProducts:a,selectedByTier:l,totalItems:c,totalPrice:s,totalCompareAtPrice:d,currentStep:p,totalSteps:u,currentTierMax:m,tierSelectedCounts:g,isMobile:x,bundleAddToCartLoading:f,isUploading:y,hoveredCard:b,setHoveredCard:h,getProductStep:v,setCurrentStep:w,handleRemoveItem:C,handleCheckout:E,hasForm:k,onHeightChange:T}=o,{customizations:S}=i,[$,B]=t(!1),z=r(null),N=r(null),{totalOriginal:I,hasSavings:F,formattedSavings:D,totalAfterDiscount:P}=(e=>{let t=0,n=0;e.forEach(({items:e,tier:o})=>{const r=o?.discountData;let i=0;e.forEach(e=>{const t=(e.price||0)/100,n=e.quantity||1;i+=t*n}),t+=i;let a=i;if("mov_percentage"===r?.type&&r.tiers?.length){const e=[...r.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity).filter(e=>i>=e.minimumQuantity);if(e.length>0){const t=e.reduce((e,t)=>t.discountValue>e.discountValue?t:e).discountValue/100;a=i*(1-t)}}n+=a});const o=Math.round(t-n),r=o>0;return{savings:o,totalOriginal:t,totalAfterDiscount:n,hasSavings:r,formattedSavings:r?`₹${o.toLocaleString()}`:"",calculatedDiscountedTotal:Math.round(n)}})(l),A=l.filter(({count:e})=>e>0).map(({tier:e,items:t})=>{const n=t.reduce((e,t)=>{if(!t)return e;return e+(t.price||0)*(t.quantity||1)},0)/100;return((e,t,n)=>{const o=e.discountData;if(!o||!o.tiers?.length)return null;const r=[...o.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity),i=[];if("mov_percentage"===o.type){if("number"!=typeof n)return null;const e=r.filter(e=>n>=e.minimumQuantity).pop();e&&i.push(`${e.discountValue}% OFF`);const t=r.find(e=>n<e.minimumQuantity);if(t){const e=t.minimumQuantity-n;i.push(`Add ₹${e} more to get ${t.discountValue}% OFF`)}return i.length?i.join(" + "):null}const a=r.filter(e=>t>=e.minimumQuantity);if(a.length>0){const e=a.reduce((e,t)=>e.minimumQuantity>t.minimumQuantity?e:t);let t=null;switch(o.type){case"percentage_discount_coupon":t=`${e.discountValue}% OFF`;break;case"amount_discount_coupon":t=`₹${e.discountValue} OFF`;break;case"fixed_price_collection":t=`Fixed ₹${e.discountValue}`;break;case"dummy_coupon":t="Discount Applied"}t&&i.push(t)}const l=r.find(e=>t<e.minimumQuantity);if(l){const e=l.minimumQuantity-t;let n=null;switch(o.type){case"percentage_discount_coupon":n=`${l.discountValue}% OFF`;break;case"amount_discount_coupon":n=`₹${l.discountValue} OFF`;break;case"fixed_price_collection":n=`Fixed ₹${l.discountValue}`;break;case"dummy_coupon":n="Discount"}n&&i.push(`Add ${e} more item${1!==e?"s":""} to get ${n}`)}return i.length?i.join(" + "):null})(e,t.length,n)}).filter(Boolean);return n(()=>{const e=m!==1/0&&g[p-1]===m-2&&m>1;let t=null;return e?(B(!0),t=setTimeout(()=>{B(!1)},3e3)):B(!1),()=>{t&&clearTimeout(t)}},[m,g,p]),n(()=>{if(z.current&&T){const e=z.current.offsetHeight;T(e)}},[x,T,a]),n(()=>{const e=Math.max(...l.map(({tier:e,items:t})=>{if("mov_percentage"!==e?.discountData?.type)return 0;const n=t.reduce((e,t)=>e+(t.price||0)*(t.quantity||1),0)/100,o=(e?.discountData?.tiers||[]).filter(e=>n>=e.minimumQuantity).sort((e,t)=>t.discountValue-e.discountValue)[0];return o?.discountValue??0}));if(e<(N.current??0)&&(N.current=e),e>(N.current??0)){N.current=e;const t=document.querySelector(".yt-collection-bundle-next-btn");if(!t)return;const n=t.getBoundingClientRect(),o=(n.left+n.width/2)/window.innerWidth,r=(n.top+n.height/2)/window.innerHeight;Ce({particleCount:100,spread:70,origin:{x:o,y:r},zIndex:9999})}},[l]),e.createElement("div",{ref:z,className:"yt-collection-bundle-bar",style:{background:S?.bundleBg||"#fff",color:S?.bundleText||"#333",border:S?.bundleBorder||"1px solid #878787",display:"flex",flexDirection:"column",position:"fixed",bottom:"10px",left:"50%",transform:"translateX(-50%)",width:"compact"==S.stickyBarWidth?"600px":"90%",maxWidth:"95%",zIndex:899,boxShadow:"0 -2px 10px rgba(0,0,0,0.1)",transition:"bottom 0.3s ease",borderRadius:S?.borderRadius||"8px",overflow:"hidden"}},A.length>0&&e.createElement("div",{style:{padding:"4px 8px",background:"#dbdbdbc5",color:"#6c757d",textAlign:"center",fontSize:"12px",fontWeight:500}},A.join(" + ")),e.createElement("div",{className:"yt-collection-bundle-bar-header",style:{position:"relative",textAlign:"center"}},$&&e.createElement(e.Fragment,null,e.createElement("style",null,"\n @keyframes fadeIn {\n from { opacity: 0; transform: translateX(-50%) translateY(10px); }\n to { opacity: 1; transform: translateX(-50%) translateY(0); }\n }\n "),e.createElement("div",{className:"yt-collection-bundle-ctx",style:{position:"absolute",top:"-40px",left:"50%",transform:"translateX(-50%)",background:S?.atcBg||"#007bff",color:S?.atcText||"#fff",padding:"4px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"14px",whiteSpace:"nowrap",zIndex:10,boxShadow:"0 4px 12px rgba(0,0,0,0.2)",animation:"fadeIn 0.3s ease-out",minWidth:"300px",textAlign:"center",border:"1px solid rgba(0,0,0,0.1)",lineHeight:"normal"}},"Add up to"," ",e.createElement("span",{style:{fontWeight:600}},m," item",m>1?"s":"")))),a.length>0&&e.createElement("div",{className:"yt-collection-bundle-bar-top",style:{display:"flex",alignItems:"center",padding:"8px 8px 0",position:"relative",borderRadius:S?.borderRadius||"8px"}},e.createElement("div",{className:"yt-collection-bundle-images",style:{display:"flex",flex:1,gap:"5px",justifyContent:"center",alignItems:"center",overflowX:"auto",padding:"4px 0",scrollbarWidth:"none"}},l.filter(({count:e})=>e>0).map(({items:t},n,o)=>e.createElement(e.Fragment,{key:n},e.createElement("div",{className:"yt-collection-bundle-tier-images",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",minWidth:"fit-content"}},e.createElement("div",{style:{display:"flex",gap:"4px"}},t.map((t,o)=>{const r=i.config.builderTiers.collectionTier.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId);if(!r)return null;const a=v(t.productId),l=p===a;return e.createElement("div",{key:o,className:"yt-collection-bundle-img-wrapper",style:{position:"relative",flexShrink:0,height:"65px"}},e.createElement("div",{style:{position:"relative",width:"67px",height:"67px",borderRadius:`calc(${S?.borderRadius||"8px"} / 2)`,overflow:"hidden",cursor:l?"default":"pointer",transition:"transform 0.2s ease"},onMouseEnter:e=>!l&&(e.currentTarget.style.transform="scale(1.08)"),onMouseLeave:e=>e.currentTarget.style.transform="scale(1)",onClick:()=>!l&&w(a)},e.createElement("img",{src:_p(r.images[0]),style:{width:"65px",height:"65px",objectFit:"cover",borderRadius:`calc(${S?.borderRadius||"8px"} / 2)`,transition:"opacity 0.2s",pointerEvents:"none",border:"1px solid #ddd"},alt:"Selected"}),t.quantity>1&&e.createElement("div",{className:"yt-collection-bundle-qty-badge",style:{position:"absolute",bottom:"4px",right:"4px",background:"rgba(0,0,0,0.7)",color:"#fff",borderRadius:"10px",padding:"2px 6px",fontSize:"10px",fontWeight:600,lineHeight:"normal"}},"x",t.quantity),e.createElement("button",{className:"yt-collection-bundle-remove-btn",style:{position:"absolute",top:"4px",right:"4px",width:"20px",height:"20px",background:"rgba(220,53,69,0.95)",color:"white",border:"none",borderRadius:"50%",fontSize:"12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.3)",textAlign:"center",lineHeight:"normal"},onClick:e=>{e.stopPropagation(),C(t.productId,t.variantId,n)}},"×")))}))),n<o.length-1&&o[n+1].count>0&&e.createElement("div",{style:{color:"#666",paddingInline:"6px",lineHeight:"normal"}},e.createElement(U,null)))))),x?e.createElement("div",{className:"yt-collection-bundle-mobile-bar-content",style:{display:"flex",flexDirection:c>0&&(k||i?.config?.builderTiers?.collectionTier?.length>1)?"column":"row",margin:"4px",gap:c>0?"10px":"0",background:"#dbdbdb",borderRadius:S?.borderRadius||"8px",overflow:"hidden"}},e.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:a.length>0?"space-between":"center",alignItems:"center",borderRadius:S?.borderRadius||"8px"}},e.createElement(e.Fragment,null,0===c&&e.createElement("div",{style:{fontSize:"14px",color:"#6c757d",lineHeight:"normal",...0===c&&{padding:"8px 0 12px 0",background:"#dbdbdb",color:"#6c757d",width:"100%",borderRadius:S?.borderRadius||"8px"}}},"Add Items to Checkout"),c>0&&e.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"6px",width:"100%",justifyContent:"center",flexWrap:"wrap"}},e.createElement("div",{style:{fontSize:"14px",color:"#000",fontWeight:600}},"₹",(P??s).toLocaleString()),F?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",I.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",D)):e.createElement(e.Fragment,null,d>s&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",d.toLocaleString())),e.createElement("span",{style:{fontSize:"12px",color:"#000",fontWeight:500}},"(",c," items)")))),e.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"4px"}},(i?.config?.builderTiers?.collectionTier?.length>1||k)&&c>0&&e.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:1===p?"not-allowed":"pointer",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",textAlign:"center",lineHeight:"normal"},onClick:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>h(-1),onMouseLeave:()=>h(null),disabled:1===p},"Back"),c>0&&e.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===c||y?"yt-collection-bundle-next-btn-disabled":""),style:{background:S?.btnPrimaryBg||"#28a745",color:S?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",opacity:p===u&&0===c||y?.6:1,textAlign:"center",lineHeight:"normal"},onClick:p===u?E:()=>w(p+1),disabled:p===u&&0===c||f||y},f?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(Yc,null)):p===u?"Checkout":"Next"))):e.createElement("div",{className:"yt-collection-bundle-bar-bottom",style:{display:"flex",alignItems:"center",padding:"0px",background:"#dbdbdb",margin:"8px",borderRadius:S?.borderRadius||"8px",overflow:"hidden",scrollbarWidth:"none"}},(i?.config?.builderTiers?.collectionTier?.length>1||k)&&c>0&&e.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:1===p?"not-allowed":"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",...-1===b&&{filter:"brightness(60%)"},textAlign:"center",lineHeight:"normal"},onClick:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>h(-1),onMouseLeave:()=>h(null),disabled:1===p},"Back"),e.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:a.length>0?"space-between":"center",paddingInline:"6px",alignItems:"center",...0===c&&{padding:"12px 24px"}}},0===c&&e.createElement("div",{style:{fontSize:"16px",color:"#6c757d",lineHeight:"normal"}},"Add Items to Checkout"),c>0&&e.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",justifyContent:"center"}},e.createElement("div",{style:{fontSize:"16px",color:"#000",fontWeight:600}},"₹",(P??s).toLocaleString()),F?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",I.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",D)):e.createElement(e.Fragment,null,d>s&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",d.toLocaleString())),e.createElement("span",{style:{fontSize:"16px",color:"#000",fontWeight:500}},"(",c," items)"))),c>0&&e.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===c||y?"yt-collection-bundle-next-btn-disabled":""),style:{background:S?.btnPrimaryBg||"#28a745",color:S?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",opacity:p===u&&0===c||y?.6:1,...-2===b&&{filter:"brightness(90%)"},textAlign:"center",lineHeight:"normal"},onClick:p===u?E:()=>w(p+1),disabled:p===u&&0===c||f||y,onMouseEnter:()=>h(-2),onMouseLeave:()=>h(null)},f?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(Yc,null)):p===u?"Checkout":"Next")))},Dp=window?.Shopify?.currency||{rate:1,active:"INR"},Pp=e=>{if(!e)return;const t=navigator.language||"en-US",n=Number((Number(e)*Dp.rate).toFixed(2));return new Intl.NumberFormat(t).format(n)},Ap=(e,t)=>t==Dp.active?e:se(Dp.active)||Dp.active,_p=(e,t)=>{if(!e||!e.includes("cdn.shopify")&&!e.includes("/cdn/shop/files/"))return e;try{const n=new URL(e),o=n.searchParams;return o.has("format")||o.set("format","webp"),o.has("quality")||o.set("quality",t?.toString()||"70"),o.has("width")||o.set("width","600"),n.toString()}catch{const n=e.includes("?")?"&":"?";return e+n+`format=webp&quality=70&width=${t?.toString()||"600"}`}},Rp=(e,t,n,o,r,i,a)=>{const l=o.findIndex(t=>t.variantId===e&&(void 0===a||t.tierIndex===a));r(0===n?e=>e.filter((e,t)=>t!==l):-1===l?o=>[...o,{product:t,variantId:e,quantity:n,isFree:i,tierIndex:a}]:e=>e.map((e,t)=>t===l?{...e,quantity:e.quantity+n,isFree:i,tierIndex:a}:e))},Op=({bundle:t,currentProductId:n,addToCartFunction:o,addCustomBundleToCart:r,selectedItems:i,setSelectedItems:a,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:s,renderingOnPage:d,bundleSubtotal:p,dispatchAnalyticsEvent:u,fetchStoreDetails:m,productsPagination:g})=>"fixed"!==t.type&&t.type&&0!==t?.type?.length?"builder"===t.type?e.createElement(ns,{bundleAddToCartLoading:l,bundle:t,selectedItems:i,setSelectedItems:a,handleAddToCart:r,handleRemoveItem:c,renderingOnPage:d,selectedItemsQuantity:s??0,bundleSubtotal:p??{price:0,compareAtPrice:0},dispatchAnalyticsEvent:u,fetchStoreDetails:m,productsPagination:g}):"combo"===t.type?e.createElement(is,{bundle:t,addToCartFunction:o,dispatchAnalyticsEvent:u}):"mixAndMatch"===t.type?e.createElement(xd,{bundle:t,addToCartFunction:o,dispatchAnalyticsEvent:u}):"collection"===t.type?e.createElement(zp,{config:t,addCustomBundleToCart:r,bundleAddToCartLoading:l}):e.createElement(_s,{bundle:t,currentProductId:n,addToCartFunction:o,dispatchAnalyticsEvent:u}):e.createElement(Tp,{addToCartFunction:o,bundle:t,dispatchAnalyticsEvent:u}),Lp=c.div`
4668
+ `,wp=({productsWithIndices:r,isOpen:i,onClose:a,cta:l,variantOptions:c,onVariantChange:s,handleAddToCart:d,primaryProductId:p,variantId:u})=>{const m=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e?.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),[g,x]=t({}),[f,y]=t({});n(()=>{const e={},t={};r?.forEach(({product:n,index:o})=>{let r,i=[];if(n.productId===p&&u){const e=n?.productDetails?.variants?.edges.find(e=>e?.node?.id?.includes(u))?.node;e&&m(n.productDetails,e.id)>0&&(i=e.title.split(" / "),r=e)}if(!i.length){const e=n.productDetails.variants.edges.find(e=>m(n.productDetails,e?.node?.id)>0)?.node||n?.productDetails?.variants?.edges?.[0]?.node;e?(i=e.title.split(" / "),r=e):i=n?.productDetails?.options?.map(e=>e.values[0]??"")}e[o]=i,r&&(t[o]={node:r},s(o,r.id))}),x(e),y(t)},[r,p,u,s,m]),n(()=>{if(!p||!u)return;const e=r?.find(({product:e})=>e?.productId===p);if(!e)return;const{product:t,index:n}=e,o=t?.productDetails?.variants?.edges?.find(e=>e.node.id.includes(u))?.node;if(o&&m(t.productDetails,o.id)>0){const e=o.title.split(" / ");x(t=>({...t,[n]:e})),y(e=>({...e,[n]:{node:o}})),s(n,o.id)}},[u,p,r,s,m]);const b=(e,t,n,o)=>{const r=[...g[e]||[]];r[t]=n;const i=r.join(" / "),a=o.productDetails.variants.edges.find(e=>e.node.title===i)?.node;return!!a&&m(o.productDetails,a.id)>0},h=(e,t,n)=>{const{product:o}=r?.find(t=>t.index===e)||{product:{productDetails:{variants:{edges:[]}}}};if(!o?.productDetails)return;if(!b(e,n,t,o))return;const i={...g};i[e][n]=t,x(i);const a=o?.productDetails?.variants?.edges?.find(t=>t.node.title===i[e].join(" / "))?.node;a&&(s(e,a.id),y(t=>({...t,[e]:{node:a}})))};if(!i)return null;const v=e.createElement(ap,{className:"yt-fixedBundle-variant-modal_overlay",onClick:a},e.createElement(lp,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},e.createElement(cp,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:l.backgroundColor,color:l.textColor}},"Select Options"),r?.map(({product:t,index:n},o)=>e.createElement(e.Fragment,null,e.createElement(dp,{className:"yt-fixedBundle-variant-modal_product-block"},e.createElement(pp,{className:"yt-fixedBundle-variant-modal_thumbnail",src:f[n]?.node?.image?.url||t.productDetails.featuredMedia?.preview?.image?.url,alt:t.productDetails.title}),e.createElement(up,{className:"yt-fixedBundle-variant-modal_product-info"},e.createElement(mp,{className:"yt-fixedBundle-variant-modal_product-name"},t.productDetails.title,t?.productDetails?.variants?.edges?.filter(e=>"Default Title"!==e.node.title)?.length>0&&e.createElement(xp,{className:"yt-fixedBundle-variant-modal_selected-value"},g[n]?.join(" / "))),t.productDetails.options.map((o,r)=>{const i=c&&c?.options?.find(e=>e.name===o.name),a=o.values.filter(e=>t.productDetails.variants.edges.some(t=>t.node.title.split(" / ")[r]===e));return 0===a.length||1===a.length&&"Default Title"===a[0]?e.createElement(e.Fragment,null):i&&"color"===i?.type?e.createElement(fp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(vp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),a.map((o,a)=>{const l=!b(n,r,o,t);return e.createElement(e.Fragment,null,i.values.find(e=>e.name===o)?.value?e.createElement(yp,{className:"yt-fixedBundle-variant-modal_color-swatch",key:a,color:i.values.find(e=>e.name===o)?.value||o,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},e.createElement("span",null)):e.createElement(bp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},o))})):i&&"image"===i?.type?e.createElement(fp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(vp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),a.map((o,a)=>{const l=!b(n,r,o,t);return e.createElement(e.Fragment,null,i?.values.find(e=>e.name===o)?.value?e.createElement(hp,{className:"yt-fixedBundle-variant-modal_image-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)},src:i.values.find(e=>e.name===o)?.value},e.createElement("span",null)):e.createElement(bp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},o))})):e.createElement(fp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(vp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),a.map((o,i)=>{const a=!b(n,r,o,t);return e.createElement(bp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:i,selected:g[n]?.[r]==o,disabled:a,onClick:()=>{h(n,o,r)}},o)}))}))),o<r.length-1&&e.createElement(gp,{className:"yt-fixedBundle-variant-modal_divider"}))),e.createElement(sp,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:l.backgroundColor,color:l.textColor},onClick:d},"Add bundle to cart")));return P.createPortal(v,document.body)},Cp=({options:o,selectedValue:i,onChange:a,type:l="text"})=>{const[c,s]=t(!1),d=r(null);n(()=>{const e=e=>{d.current&&!d.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const p=t=>"color"===l?e.createElement(tp,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:t.value},e.createElement("span",null)):"image"===l?e.createElement(np,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:t.value||"/placeholder.svg",alt:t.name},e.createElement("span",null)):null;return e.createElement(Yd,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:d},e.createElement(Gd,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>s(!c)},e.createElement(Xd,{className:"yt-fixedBundle-variant-dropdown-horizontal_content"},i&&("color"===l||"image"===l)&&p(i),e.createElement("span",{className:"yt-fixedBundle-variant-dropdown-horizontal_selected-text"},i&&i.name)),e.createElement(Zd,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:c})),c&&e.createElement(Kd,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},o?.map(t=>e.createElement(Jd,{className:"yt-fixedBundle-variant-selector_dropdown-item "+(i?.name===t.name?"yt-fixedBundle-variant-selector_dropdown-item--selected":""),key:t.name,$isSelected:i?.name===t.name,onClick:()=>{t.disabled||(a(t),s(!1))},style:{opacity:t.disabled?.5:1,cursor:t.disabled?"not-allowed":"pointer"}},("color"===l||"image"===l)&&p(t),e.createElement(ep,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},t.name)))))},Ep=({product:o,variantOptions:r,selectedVariants:i,onVariantChange:a,variantId:l,primaryProductId:c,variantType:s="dropdown"})=>{const[d,p]=t(i||[]);n(()=>{i&&i.length>0&&p(i)},[i]),n(()=>{if(l&&o.variants.edges.some(e=>e.node.id.includes(l))){const e=o.variants.edges.find(e=>e.node.id.includes(l))?.node;if(e){const t=e.title.split(" / ");p(t)}}},[l,o]);const u=e=>{if(!r?.options)return"text";const t=r.options.find(t=>t.name===e);return t?.type||"text"},m=(e,t)=>{const n=d[t];if(!n)return null;return g(e,t).find(e=>e.name===n)||null},g=(e,t)=>{const n=r?.options?.find(t=>t.name===e.name);return e.values.filter(e=>o.variants.edges.some(n=>n.node.title.split(" / ")[t]===e)).map(e=>{const r=n?.values?.find(t=>t.name===e),i=!((e,t,n)=>{const o=[...d||[]];o[e]=t;const r=o.join(" / "),i=n.variants.edges.find(e=>e.node.title===r)?.node;return!!i&&((e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e?.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLocaleLowerCase()?1/0:0:1/0:0})(n,i.id)>0})(t,e,o);return{name:e,value:r?.value||e,disabled:i}})};return e.createElement(op,{className:"yt-fixedBundle-variant-selector-horizontal_container"},o.options.map((t,n)=>{const r=g(t,n);return 0===r.length||1===r.length&&"Default Title"===r[0].name?null:e.createElement(rp,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:t.name,$isFirst:0===n},e.createElement(Cp,{options:r,selectedValue:m(t,n),onChange:e=>{((e,t)=>{const n=[...d];n[e]=t.name,p(n);const r=o.variants.edges.find(t=>t.node.title===(o.options?.length>0?n.join(" / "):n[e]))?.node.id;a(r||"")})(n,e)},type:u(t.name)}))}))},kp=({product:r,selectedVariantId:a,isChecked:l,canCustomize:c,styles:s,onVariantChange:d,onCheckChange:p,isMobile:u,isHorizontal:m,index:g,variantOptions:x,productsLength:f,handleOpenModal:y,storeCurrencyCode:b,primaryProductId:h,variantId:v,checkedProducts:w,bundleDiscountValue:C,bundleDiscountType:E,bundleProductsCount:k,totalSelectedOriginal:T})=>{const S=o(()=>e=>{const t=r?.variants?.edges?.find(t=>t.node.id===e),n=t?.node;return n?r?.tracksInventory&&n.inventoryItem?.tracked?n.inventoryQuantity>0?n.inventoryQuantity:n.inventoryQuantity<=0&&"continue"===n.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[r]),[$,B]=t(r?.variants?.edges.find(e=>S(e?.node?.id)>0)?.node||r?.variants?.edges?.[0]?.node),z=o(()=>$?.title?.split(" / ")||[],[$]),N=r?.id===h;n(()=>{if(r.id===h){const e=r?.variants?.edges?.find(e=>e?.node?.id?.includes(a))?.node;e&&S(e.id)>0&&(B(e),d(e.id))}else{const e=r?.variants?.edges?.find(e=>e?.node?.id===a)?.node||r?.variants?.edges?.find(e=>S(e?.node?.id)>0)?.node||r?.variants?.edges?.[0]?.node;B(e)}},[r,h,a,v,d,S]);const I=i(e=>{const t=r?.variants?.edges?.find(t=>t.node.id===e)?.node;t&&d(e)},[r,d]),F=s?.fixedBundle?.discountBadgeDisplay,D=parseFloat($?.price??"0"),P=w?.size===k,A=((e,t,n,o,r,i)=>{if(0===o||!n)return e;if(o!==r)return e;switch(t){case"percentOff":case"percentageOff":case"percentage":case"Percentage":return e*(1-n/100);case"amountOff":case"amount":case"Amount Off":{if(i<=0)return e;const t=e/i*n;return Math.max(0,e-t)}case"fixedPrice":case"fixed":case"fixedPrice":return n*(e/i);default:return e}})(D,E,C??0,w?.size,k,T),_=P?A:parseFloat($?.price??"0"),R="discount-on-compare"===F?parseFloat($?.compareAtPrice||$?.price||"0"):parseFloat($?.price??"0"),O=!1!==s?.fixedBundle?.discountBadgeVisibility&&(R>_&&s?.fixedBundle?.compareAtPriceVisibility||"discount-on-compare"===F&&s?.fixedBundle?.compareAtPriceVisibility),L=_.toFixed(2),M="undefined"!=typeof window&&"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,j=$?.image?.url||r.featuredMedia?.preview?.image?.url;return e.createElement(e.Fragment,null,m?e.createElement("div",{className:""+(r.id===h?"yt-fixedBundle-product-card--horizontal-primary":"yt-fixedBundle-product-card--horizontal-associated"),style:{display:"flex",alignItems:"center",gap:"10px"}},c&&e.createElement("div",{className:"yt-fixedBundle-product-card_checkbox-wrapper--horizontal"},e.createElement("input",{type:"checkbox",style:{display:"none"},className:"yt-fixedBundle-product-card_checkbox-hidden",id:`checkbox-${r.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:N}),e.createElement("label",{className:"yt-fixed-bundle-checkbox-label yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${r.id}-${g}`,style:{width:"18px",height:"18px",border:"1.5px solid "+((s.fixedBundle?.borderColor??"#ccc")+"80"),borderRadius:s.fixedBundle?.borderRadius??"4px",backgroundColor:l?s.general?.ctaBackgroundColor??"#d3122a":"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.2s ease",color:"white"}},e.createElement(X,{style:{fontSize:"14px",visibility:l?"visible":"hidden"}}))),e.createElement(vd,{className:"yt-fixedBundle-product-card-horizontal_item",style:{borderRadius:s.fixedBundle?.borderRadius,border:`1px solid ${s.fixedBundle?.borderColor}80`,backgroundColor:s.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`8px 8px 8px -6px ${s.fixedBundle.borderColor}`,"no-spread":`4px 4px 0px -1px ${s.fixedBundle.borderColor}80`}[s.fixedBundle.shadowType]||"none"},canCustomize:c},"undefined"!=typeof window&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&e.createElement(wd,{className:"yt-fixedBundle-product-card-horizontal_image",src:_p(j),alt:r.title,style:{borderRadius:s.fixedBundle?.borderRadius,borderColor:s.fixedBundle?.borderColor,aspectRatio:s.general.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),e.createElement(Cd,{className:"yt-fixedBundle-product-card-horizontal_details"},e.createElement(Ed,{className:"yt-fixedBundle-product-card-horizontal_title"},r.title),s.fixedBundle.productsPriceVisibility&&e.createElement(kd,{className:"yt-fixedBundle-product-card-horizontal_price-section"},e.createElement(Td,{className:"yt-fixedBundle-product-card-horizontal_price--new"},Ap(s.general.currencySymbol,b)," ",Pp(L)),O&&R>_&&e.createElement(Sd,{className:"yt-fixedBundle-product-card-horizontal_price--old"},Ap(s.general.currencySymbol,b),Pp(R))),e.createElement(Ep,{product:r,variantOptions:x,selectedVariants:z,onVariantChange:I,variantId:v,primaryProductId:h})))):e.createElement(e.Fragment,null,e.createElement(Ad,{className:""+(r.id===h?"yt-fixedBundle-product-card--vertical-primary":"yt-fixedBundle-product-card--vertical-associated"),productsLength:f,style:{borderRadius:s.fixedBundle?.borderRadius,border:`1px solid ${s.fixedBundle?.borderColor}50`,backgroundColor:s.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`0 4px 10px -6px ${s.fixedBundle.borderColor}50`,"no-spread":`4px 4px 0px -1px ${s.fixedBundle.borderColor}50`}[s.fixedBundle.shadowType]||"none",...c&&{position:"relative"},...M&&{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",minWidth:"max-content",paddingLeft:"2px"}},borderRadius:s.fixedBundle?.borderRadius,borderColor:s.fixedBundle?.borderColor,backgroundColor:s.fixedBundle?.cardBackgroundColor},c&&e.createElement(ip,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:M},e.createElement("input",{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${r.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:N}),e.createElement("label",{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${r.id}-${g}`,style:{width:"18px",height:"18px",border:"1.5px solid "+((s.fixedBundle?.borderColor??"#ccc")+"80"),borderRadius:s.fixedBundle?.borderRadius??"4px",backgroundColor:l?s.general?.ctaBackgroundColor??"#d3122a":"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.2s ease",color:"white"}},e.createElement(X,{size:10,style:{fontSize:"14px",visibility:l?"visible":"hidden"}}))),"undefined"!=typeof window&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&e.createElement(_d,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:s.general.imageAspectRatio,height:"fit-content"}},e.createElement(Rd,{className:"yt-fixedBundle-product-card_image--vertical",src:_p(j),style:{aspectRatio:s.general.imageAspectRatio},alt:r.title}),r.variants.edges.length>1&&e.createElement(Od,{className:"yt-fixedBundle-product-card_badge-container"},e.createElement(Ld,{className:"yt-fixedBundle-product-card_circle-button"},e.createElement("span",null)),e.createElement(Md,{className:"yt-fixedBundle-product-card_circle-button-two"},e.createElement("span",null)),e.createElement(jd,{className:"yt-fixedBundle-product-card_count-badge"},r.variants.edges.length,"+"))),e.createElement(Vd,{className:"yt-fixedBundle-product-card-vertical_info"},e.createElement(Wd,{className:"yt-fixedBundle-product-card-vertical_title"},r.title),s.fixedBundle.productsPriceVisibility&&e.createElement(qd,{className:"yt-fixedBundle-product-card-vertical_price-line"},e.createElement(Hd,{className:"yt-fixedBundle-product-card-vertical_price--new"},Ap(s.general.currencySymbol,b),Pp(L)),s.fixedBundle.compareAtPriceVisibility&&O&&R>_&&e.createElement(Sd,{className:"yt-fixedBundle-product-card-vertical_price--old"},Ap(s.general.currencySymbol,b),Pp(R))))),(f<=3||!u)&&g<f-1&&e.createElement(Qd,{className:"yt-fixedBundle-plus-wrapper"}," ",e.createElement(Ud,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},Tp=({bundle:r,addToCartFunction:a,dispatchAnalyticsEvent:l})=>{const[c,s]=t(!1),[d,p]=t(window.innerWidth<786),[u,m]=t(null),[g,x]=t(!1),[f,y]=t(!1),b="undefined"!=typeof window?window.location.href:null,h=r?.products?.find(e=>e.productDetails?.handle===b?.split("/").pop()?.split("?")[0]),v=h?.productId,w=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e?.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),[C,E]=t(Object.fromEntries(r?.products?.map((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find(t=>w(e.productDetails,t?.node?.id)>0)?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id]))),k="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"beautywiseshop.myshopify.com"===window.ytBundleApp?.storeDomain||"swashaa.myshopify.com"===window.ytBundleApp?.storeDomain),T=r?.showIndividualProductSelector??!0,[S,$]=t(new Set(r.products.reduce((e,t,n)=>(k&&t?.productId!==v&&!T||e.push(n),e),[])));n(()=>{l?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:r._id,bundleType:"fixed-bundle"}});const e=()=>{const e=new URL(window.location.href).searchParams.get("variant");m(e)},t=e=>{const t=history[e];return function(...n){const o=t.apply(this,n);return window.dispatchEvent(new Event(e.toLowerCase())),o}};return history.pushState=t("pushState"),history.replaceState=t("replaceState"),window.addEventListener("pushstate",e),window.addEventListener("replacestate",e),e(),()=>{window.removeEventListener("pushstate",e),window.removeEventListener("replacestate",e)}},[]),n(()=>{u&&v&&E(e=>{const t={...e};return r?.products?.forEach((e,n)=>{e.productId===v&&(t[n.toString()]=u)}),t})},[u,v,r?.products]),n(()=>{const e=()=>{p(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const B=i((e,t)=>{E(n=>({...n,[e.toString()]:t}))},[]),z=(e,t)=>{const n=r.products[t].productId;k&&n===v||$(n=>{const o=new Set(n);return e?o.add(t):o.delete(t),o})},N=o(()=>(e,t)=>w(e.productDetails,t)>0,[w]),I=o(()=>r.products.some((e,t)=>S.has(t)&&e.productDetails.variants.edges.length>1),[r.products,S]),{originalPrice:F,dealPrice:D,offerValue:P}=o(()=>{const{price:e,compareAtPrice:t}=r.products.reduce((e,t,n)=>{if(!S.has(n))return e;const o=C[n.toString()];if(!o)return e;const r=t.productDetails.variants.edges?.find(e=>e.node.id===o)?.node;if(!r)return e;const i=parseFloat(r?.price??"0"),a=parseFloat(r?.compareAtPrice||i.toString());return e.price+=i,e.compareAtPrice+=a,e},{price:0,compareAtPrice:0}),n="discount-on-compare"===(r?.customizations?.fixedBundle?.discountBadgeDisplay||"discount-on-price")?t:e;let o=e;S.size===r.products.length&&(r?.percentageOff?o=e*(1-r.percentageOff/100):r?.dealAmount?o=r.dealAmount:r?.amountOff&&(o=e-r.amountOff));const i=n-o;return{originalPrice:n.toFixed(2),dealPrice:o.toFixed(2),offerValue:i.toFixed(2)}},[r.products,C,S,r.percentageOff,r.dealAmount,r.amountOff,r?.customizations?.fixedBundle?.discountBadgeDisplay]),A=o(()=>r.products.map((e,t)=>({product:e,index:t})).filter(({index:e})=>S.has(e)),[r.products,S]),_=A.every(({product:e,index:t})=>N(e,C[t.toString()])),R=o(()=>{let e=0;return r.products.forEach((t,n)=>{if(S.has(n)){const o=C[n.toString()],r=t.productDetails.variants.edges.find(e=>e.node.id===o)?.node;r&&(e+=parseFloat(r.price??"0"))}}),e},[r.products,S,C]),O=async e=>{s(!0),x(!1),l?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:r._id,bundleType:"fixed-bundle",selectedProducts:A?.map(e=>({id:e?.product?.productId,title:e?.product?.productDetails?.title}))}});try{const t=Object.entries(C).map(([e,t])=>{const n=parseInt(e);return isNaN(n)||!S.has(n)?null:t}).filter(Boolean);a&&await a(Number(F),t,void 0,void 0,e)}catch(e){console.error("Error adding to cart:",e)}s(!1)},L=async e=>{if(_){if(e&&(e.preventDefault(),e.stopPropagation()),r.personalizedForm)return x(!1),void y(!0);await O()}};if(!a)return e.createElement(e.Fragment,null);const M=r.customizations,j=M.fixedBundle?.cardLayoutStyle||"auto",V="horizontal"===j||"auto"===j&&d,W="bundles"==r.appName?r.pageHeader?.title:r?.title,H="bundles"==r.appName?r.pageHeader?.description:r?.subtitle;return e.createElement(fd,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:M.fixedBundle.sectionBackgroundColor,..."transparent"!==M.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},W&&e.createElement(yd,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:M.fixedBundle?.titleBackgroundColor||"none",color:M.fixedBundle?.titleTextColor||"black",textAlign:M.fixedBundle.infoAlignment??"center",fontSize:M.fixedBundle?.titleFontSize,..."transparent"!==M.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===M.fixedBundle.infoAlignment&&"transparent"!==M.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===M.fixedBundle.infoAlignment&&"transparent"!==M.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===M.fixedBundle.infoAlignment&&"transparent"===M.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},W),H&&e.createElement(bd,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:M.fixedBundle?.subtitleFontSize,textAlign:M.fixedBundle.infoAlignment??"center",..."left"===M.fixedBundle.infoAlignment&&"transparent"!==M.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===M.fixedBundle.infoAlignment&&"transparent"!==M.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===M.fixedBundle.infoAlignment&&"transparent"===M.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},H),V?e.createElement(hd,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},r?.products?.map((t,n)=>e.createElement(e.Fragment,{key:`${t.productId}-${n}`},e.createElement(kp,{isChecked:S.has(n),product:t.productDetails,selectedVariantId:C[n.toString()]||"",canCustomize:r?.canCustomizeFixedBundle||!1,styles:M,onVariantChange:e=>B(n,e),onCheckChange:e=>{z(e,n)},isMobile:d,index:n,isHorizontal:V,variantOptions:r.variantOptions,productsLength:r.products.length,storeCurrencyCode:r.storeCurrencyCode,primaryProductId:v,variantId:u||void 0,bundleDiscountType:r.discountType??"none",checkedProducts:S,bundleProductsCount:r.products.length,bundleDiscountValue:r.percentageOff||r.amountOff||r.dealAmount,totalSelectedOriginal:R})))):e.createElement(Dd,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},e.createElement(Pd,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===M.fixedBundle.infoAlignment?"flex-start":"right"===M.fixedBundle.infoAlignment?"flex-end":"center"}},r?.products?.map((t,n)=>e.createElement(kp,{key:`${t.productId}-${n}`,isChecked:S.has(n),product:t.productDetails,selectedVariantId:C[n.toString()]||"",canCustomize:r?.canCustomizeFixedBundle||!1,styles:M,onVariantChange:e=>{B(n,e)},onCheckChange:e=>z(e,n),isMobile:d,index:n,isHorizontal:V,productsLength:r.products.length,storeCurrencyCode:r.storeCurrencyCode,primaryProductId:v,variantId:u||void 0,bundleDiscountType:r.discountType??"none",checkedProducts:S,bundleProductsCount:r.products.length,bundleDiscountValue:r.percentageOff||r.amountOff||r.dealAmount,totalSelectedOriginal:R})),I&&e.createElement(wp,{productsWithIndices:A,isOpen:g,onClose:()=>x(!1),variantOptions:r.variantOptions,cta:{textColor:M.general.ctaTextColor,backgroundColor:M.general.ctaBackgroundColor},onVariantChange:B,handleAddToCart:L,primaryProductId:v,variantId:u||void 0}))),e.createElement($d,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===M.fixedBundle.infoAlignment?"flex-start":"right"===M.fixedBundle.infoAlignment?"flex-end":"center"}},Number(F)>0&&Number(P)>0&&M.fixedBundle.compareAtPriceVisibility&&e.createElement(Bd,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",e.createElement(Nd,{className:"yt-fixedBundle-summary_price"},Ap(M.general.currencySymbol,r?.storeCurrencyCode),Pp(F))),0!==S.size&&e.createElement(zd,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",e.createElement(Nd,{className:"yt-fixedBundle-summary_price"},Ap(M.general.currencySymbol,r?.storeCurrencyCode),Pp(D))," ",Number(P)>0&&e.createElement(Id,{className:"yt-fixedBundle-summary_save-tag"},"Save:"," ",Ap(M.general.currencySymbol,r?.storeCurrencyCode),Pp(P)))),e.createElement(Fd,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),V||!I?L(e):x(!0)},disabled:S.size<1||c||!_,style:{backgroundColor:M.general?.ctaBackgroundColor||"#121212",color:M.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${M.general?.ctaBackgroundColor||"#121212"}`,boxShadow:M.general.ctaShadowType,paddingTop:M.general?.ctaPadding,paddingBottom:M.general?.ctaPadding,borderRadius:M.general.ctaBorderRadius,width:M.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{M.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=M.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=M.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{M.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=M.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=M.general?.ctaTextColor||"#FFFFFF")}},c?e.createElement(ue,{color:"white",loading:c,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):_?e.createElement(e.Fragment,null,M.fixedBundle?.ctaTitle??"Add Bundle to cart"):e.createElement(e.Fragment,null,"Out of Stock")),r?.personalizedForm&&e.createElement(os,{isOpen:f,onClose:()=>y(!1),formConfig:r.personalizedForm,onCheckout:async e=>{await O(e),y(!1)},cta:{backgroundColor:M.general?.ctaBackgroundColor||"#121212",textColor:M.general?.ctaTextColor||"#FFFFFF"},isMobile:d}))},Sp=({product:o,tierIdx:r,isOpen:i,onClose:a,onAddToBundle:l,canAdd:c,isSelected:s,customizations:d,isMobile:p,splitVariants:u=!1})=>{const[m,g]=t(0),[x,f]=t(o.variants[0]?.id.toString()||""),[y,b]=t(!0),h=o.variants.find(e=>e.id.toString()===x)||o.variants[0],v=o.images.filter(Boolean),w=()=>{v.length<=1||(g(e=>0===e?v.length-1:e-1),b(!0))},C=()=>{v.length<=1||(g(e=>e===v.length-1?0:e+1),b(!0))};if(n(()=>(i&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=""}),[i]),n(()=>{if(h&&h?.featured_image?.src){const e=document.querySelector(".yt-collection-bundle-modal-image"),t=_p(h?.featured_image?.src);e?.setAttribute("src",t)}},[h]),!i)return null;const E=v.length>1,k=e.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:a},e.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",borderRadius:d?.borderRadius||"12px",maxWidth:1e3,width:"100%",height:"72dvh",margin:"auto",display:"flex",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:a,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"}},e.createElement(G,{size:22})),e.createElement("div",{className:"yt-collection-bundle-modal-image-container",style:{flex:1,position:"relative",margin:"20px 0 20px 20px",borderRadius:d?.borderRadius||"12px",background:"#f5f5f5"}},v.length>0&&e.createElement(e.Fragment,null,y&&e.createElement("style",null,"\n @keyframes shimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n }\n "),y&&e.createElement("div",{style:{position:"absolute",inset:0,background:"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s infinite",borderRadius:d?.borderRadius||"12px"}}),e.createElement("img",{className:"yt-collection-bundle-modal-image",src:_p(v[m]||o.images[0]),alt:o.title,onLoad:()=>b(!1),style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:d?.borderRadius||"12px",opacity:y?0:1,transition:"opacity 0.3s"}}),E&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:w,disabled:0===m,style:{position:"absolute",left:16,top:"50%",transform:"translateY(-50%)",background:0===m?"rgba(0,0,0,0.2)":"rgba(0,0,0,0.4)",border:"none",borderRadius:"50%",width:44,height:44,display:"flex",alignItems:"center",justifyContent:"center",cursor:0===m?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:0===m?.5:1}},e.createElement(Z,{size:24})),e.createElement("button",{onClick:C,disabled:m===v.length-1,style:{position:"absolute",right:16,top:"50%",transform:"translateY(-50%)",background:m===v.length-1?"rgba(0,0,0,0.2)":"rgba(0,0,0,0.4)",border:"none",borderRadius:"50%",width:44,height:44,display:"flex",alignItems:"center",justifyContent:"center",cursor:m===v.length-1?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:m===v.length-1?.5:1}},e.createElement(L,{size:24}))))),e.createElement("div",{className:"yt-collection-bundle-modal-content",style:{flex:1,padding:"30px",overflowY:"auto",display:"flex",flexDirection:"column",scrollbarWidth:"none"}},e.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"6px 0",fontSize:24,fontWeight:600,lineHeight:"normal"}},u&&h?.name||o.title),!u&&o.variants.length>1&&e.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative"}},e.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee",lineHeight:"normal"}},o?.options?.join(" & "),":"," ",e.createElement("strong",null,h.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:x,onChange:e=>{f(e.target.value),b(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer",lineHeight:"normal"}},o.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0",lineHeight:"normal"}},"₹",(h.price/100).toLocaleString(),h.compare_at_price&&h.compare_at_price>h.price?e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999",lineHeight:"normal"}},"₹",(h.compare_at_price/100).toLocaleString()):null),e.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"white"}},e.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!c?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>l(o,r),disabled:!c||!h.available,style:{width:"100%",padding:"12px",fontSize:17,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:h.available?s||!c?"#28a745":d?.atcBg||"#007bff":"rgb(204, 204, 204)",color:d?.atcText||"#fff",cursor:c&&h.available?"pointer":"not-allowed",textAlign:"center",lineHeight:"normal"}},s?"Added to Box":h.available?"Add to Box":"Out of Stock")),o.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:o.description},style:{lineHeight:"normal",color:"#444",marginTop:"10px"}})))),T=e.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:a},e.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",width:"100%",height:"100dvh",display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:a,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement(G,{size:22})),e.createElement("div",{className:"yt-collection-bundle-modal-scroll-container",style:{flex:1,overflowY:"auto",paddingBottom:100}},v.length>0&&e.createElement("div",{className:"yt-collection-bundle-modal-image-wrapper",style:{position:"relative",background:"#f5f5f5"}},y&&e.createElement("div",{style:{position:"absolute",inset:0,background:"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s infinite"}}),e.createElement("img",{className:"yt-collection-bundle-modal-image",src:v[m]||o.images[0],alt:o.title,onLoad:()=>b(!1),style:{width:"100%",minWidth:"100%",display:"block",maxHeight:"50vh",minHeight:"50vh",objectFit:"cover",objectPosition:"center",opacity:y?0:1,transition:"opacity 0.3s"}}),E&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:w,disabled:0===m,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",background:0===m?"rgba(0,0,0,0.3)":"rgba(0,0,0,0.5)",border:"none",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",zIndex:5,opacity:0===m?.5:1,cursor:0===m?"not-allowed":"pointer"}},e.createElement(Z,{size:20})),e.createElement("button",{onClick:C,disabled:m===v.length-1,style:{position:"absolute",right:12,top:"50%",transform:"translateY(-50%)",background:m===v.length-1?"rgba(0,0,0,0.3)":"rgba(0,0,0,0.5)",border:"none",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",zIndex:5,opacity:m===v.length-1?.5:1,cursor:m===v.length-1?"not-allowed":"pointer"}},e.createElement(L,{size:20})))),e.createElement("div",{className:"yt-collection-bundle-modal-content",style:{padding:"20px"}},e.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"0 0 12px",fontSize:22,fontWeight:600}},o.title),!u&&o.variants.length>1&&e.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative",marginBottom:20}},e.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee"}},o?.options?.join(" & "),":"," ",e.createElement("strong",null,h.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:x,onChange:e=>{f(e.target.value),b(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}},o.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0"}},"₹",(h.price/100).toLocaleString(),h.compare_at_price?h.compare_at_price>h.price&&e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999"}},"₹",(h.compare_at_price/100).toLocaleString()):null),o.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:o.description},style:{lineHeight:1.7,color:"#444"}}))),e.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"#fff",padding:"8px 10px",borderTop:"1px solid #eee",boxShadow:"0 -4px 10px rgba(0,0,0,0.05)"}},e.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!c?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>l(o,r),disabled:!c||!h.available,style:{width:"100%",padding:"10px",fontSize:14,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:!s&&c&&h.available?d?.atcBg||"#007bff":"#28a745",color:d?.atcText||"#fff",cursor:c&&h.available?"pointer":"not-allowed"}},s?"Added to Box":h.available?"Add to Box":"Out of Stock"))));return P.createPortal(p?T:k,document.body)},$p=({styles:t,isMobile:n,categories:o,activeCategory:r,onCategoryChange:i})=>{const a=e=>{i(e)},l=(e,t)=>{const n=e.replace("#","");return`rgba(${parseInt(n.substring(0,2),16)||0}, ${parseInt(n.substring(2,4),16)||0}, ${parseInt(n.substring(4,6),16)||0}, ${t})`};return"tabs"===t?.categoryFilterOnPage?e.createElement("div",{className:"yt-collection-bundle-category-filter-wrapper",style:{overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",width:"100%"}},e.createElement("div",{className:"yt-collection-bundle-category-tabs-container",style:{display:"flex",gap:"0px",minWidth:"max-content",paddingBottom:"1px",flexWrap:"nowrap",justifyContent:"center",borderBottom:"1px solid #e0e0e0",width:"auto",height:n?"28px":"45px"}},["All",...o].map(o=>{const i=r===o,c=t.btnPrimaryBg||"#111";return e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-collection-bundle-category-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:i?"600":"400",color:i?c:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:i?l(c,.07):"transparent",borderBottom:i?`2px solid ${c}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:e=>{i||(e.currentTarget.style.color=c)},onMouseLeave:e=>{i||(e.currentTarget.style.color="#666")}},e.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},o.charAt(0).toUpperCase()+o.slice(1)),e.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},o.charAt(0).toUpperCase()+o.slice(1)))}))):e.createElement("div",{className:"yt-collection-bundle-category-filter-wrapper",style:{overflowX:n?"auto":"visible",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",paddingBottom:"5px"}},e.createElement("div",{className:"yt-collection-bundle-category-buttons-container",style:{display:"flex",gap:"8px",minWidth:"max-content",flexWrap:"nowrap",justifyContent:"center",paddingRight:n?"10px":"0px"}},["All",...o].map(o=>{const i=t.btnPrimaryBg||"#111",l=t.borderRadius||"8px";return e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-collection-bundle-category-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${r===o?i:"#e0e0e0"}`,borderRadius:l,backgroundColor:r===o?i:"white",color:r===o?"white":"#333",cursor:"pointer"}},o.charAt(0).toUpperCase()+o.slice(1))})))},Bp=e=>{if(e.metafields&&e.metafields.yourtoken_bundles_app&&e.metafields.yourtoken_bundles_app.categories){const t=e.metafields.yourtoken_bundles_app.categories;if(Array.isArray(t))return t;if("string"==typeof t)try{const e=JSON.parse(t);if(Array.isArray(e))return e}catch(e){console.error("Failed to parse categories:",e)}}return[]},zp=({config:o,bundleAddToCartLoading:a,addCustomBundleToCart:l})=>{const[c,s]=t(1),[d,p]=t("All"),[u,m]=t([]),[g,x]=t(null),[f,y]=t({}),[b,h]=t(!1),[v,w]=t(window.innerWidth<640),[C,E]=t({}),k=r(null),T=r(new Map),[S,$]=t(160),B=v?8:20,{customizations:z}=o,N=o.config.builderTiers.collectionTier.sort((e,t)=>e.tier-t.tier),I=!!o.config.form,F=N.length+(I?1:0),D=z.hideSelectedProducts,P=z.allowMultipleQty,A=z.hideOutOfStockProducts,_=o.config.splitVariants??!1,R=r(new Set),O=i((e,t=d)=>{const n=N[e-1]?.products||[],o="All"===t?n:n.filter(e=>Bp(e).includes(t));return A?o.filter(e=>e.available):o},[N,d,A]),L=i(e=>{const t=O(e).length;E(n=>{const o=n[e]||0,r=Math.min(o+8,t);return r<=o?n:{...n,[e]:r}})},[8,O]);n(()=>(k.current=new IntersectionObserver(e=>{for(const t of e)if(t.isIntersecting){const e=parseInt(t.target.getAttribute("data-sentinel-step")||"0");e>0&&e===c&&L(e)}},{root:null,threshold:0,rootMargin:"100px 0px"}),()=>{k.current?.disconnect()}),[L,c]),n(()=>{p("All")},[c]),n(()=>{if(I&&c===F)return;const e=c-1;if(!N[e])return;if(R.current.has(e))return;const t=O(c);if(console.log("filteredProducts",t),1!==t.length)return;const n=t[0],o=n.variants.filter(e=>e.available);if(1!==o.length)return;const r=o[0],i=Q(e),a=Y[e];if(i!==1/0&&a>=i)return;if(!u.some(t=>t.productId===n.id.toString()&&t.variantId===r.id.toString()&&t.tierIndex===e)&&(R.current.add(e),m(t=>[...t,{productId:n.id.toString(),variantId:r.id.toString(),price:r.price,quantity:1,tierIndex:e}]),c<F)){const e=setTimeout(()=>{s(e=>e+1),window.scrollTo(0,0)},50);return()=>clearTimeout(e)}},[c]),n(()=>{if(I&&c===F)return;const e=c,t=O(e).length;E(n=>{const o=n[`${e}_category`]!==d;return 0===(n[e]||0)||o?{...n,[e]:Math.min(B,t),[`${e}_category`]:d}:n})},[c,B,d,O]),n(()=>{const e=document.querySelector(".box-loader-scene");e&&e.setAttribute("style","display: none;");const t=()=>w(window.innerWidth<640);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const M=i(e=>{$(e+10)},[]),j=u.reduce((e,t)=>e+t.quantity,0),V=u.reduce((e,t)=>e+t.price*t.quantity,0)/100,W=u.reduce((e,t)=>{const n=N.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId),o=n?.variants.find(e=>e.id.toString()===t.variantId);return e+(o?.compare_at_price??t.price)*t.quantity},0)/100,H=(e,t)=>{const n=e.variants.find(e=>e.id===parseInt(t));if(!n)return;const o=document.querySelector(`[data-product-id="${e.id}"]`);o&&(o.dataset.selectedVariant=t,o.dataset.currentPrice=n.price.toString())},q=(e,t)=>{const n=document.querySelector(`[data-product-id="${e.id}"]`);if(!n)return;const o=n.dataset.selectedVariant||e.variants[0].id.toString(),r=parseInt(n.dataset.currentPrice||e.variants[0].price.toString());m(n=>{const i=`${e.id}-${o}-${t}`,a=n.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===i);if(a)return n.filter(e=>e!==a);const l=Y[t],c=Q(t);return c!==1/0&&l>=c?n:[...n,{productId:e.id.toString(),variantId:o,price:r,quantity:1,tierIndex:t}]})},Q=e=>{const t=N[e];return t.maximumQuantity>0?t.maximumQuantity:1/0},U=(e,t)=>{const n=Q(t);if(n===1/0)return!0;const o=Y[t];return!!u.some(n=>n.productId===e.id.toString()&&n.tierIndex===t)||o<n},Y=N.map((e,t)=>u.filter(e=>e.tierIndex===t).reduce((e,t)=>e+t.quantity,0)),G=(e,t,n)=>{const o=Q(n);if(o===1/0)return!0;return Y[n]<o},X=I&&c===F,Z=(X?null:N[c-1])?Q(c-1):0,K=N.map((e,t)=>({tier:e,items:u.filter(e=>e.tierIndex===t).reduce((e,t)=>{const n=`${t.productId}-${t.variantId}`,o=e.find(e=>`${e.productId}-${e.variantId}`===n);return o?o.quantity+=t.quantity:e.push({...t,quantity:t.quantity}),e},[]),count:Y[t]}));return e.createElement("div",{className:"yt-collection-bundle-builder",style:{margin:"0 auto",maxWidth:"1600px"}},z.headerImage&&!z.headerImage.includes("Liquid error")&&e.createElement("img",{className:"yt-collection-bundle-header-img",src:z.headerImage,alt:"Collection Bundle header",style:{width:"100%"}}),z.showTierSteps&&e.createElement("div",{style:{paddingTop:z.headerImage&&!z.headerImage.includes("Liquid error")?"20px":"0"}},e.createElement(Np,{totalSteps:F,isFormStep:X,currentStep:c,getStepTitle:e=>I&&e===F?"Customize Gift Details":N[e-1]?.title||`Step ${e}`,isMobile:v,formTitle:o?.config?.form?.title,hasForm:I,onStepClick:e=>{if(e>1&&!u.length)return alert("Add at least one product first");s(e),window.scrollTo(0,0)}})),Array.from({length:F},(e,t)=>t+1).map(t=>{const n=I&&t===F,r=n?[]:(e=>N[e-1]?.products||[])(t);let i=[];if(!n&&z.enableProductCategories){const e=new Set;r.forEach(t=>Bp(t).forEach(t=>e.add(t))),i=Array.from(e).sort()}const a=n?[]:O(t),l=t-1,s=a.slice(0,C[t]||0);return e.createElement("div",{key:t,className:"yt-collection-bundle-step-content "+(c===t?"yt-collection-bundle-step-content-active":""),style:{display:c===t?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},n&&o.config.form?e.createElement(Xc,{form:o.config.form,formData:f,setFormData:y,barHeight:S,isUploading:b,setIsUploading:h}):e.createElement(e.Fragment,null,z.enableProductCategories&&i.length>0&&e.createElement($p,{styles:z,isMobile:v,categories:i,activeCategory:d,onCategoryChange:p}),e.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:v?"grid":"flex",gridTemplateColumns:v?"repeat(2,1fr)":"",flexWrap:v?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:`${S}px`}},_?s.flatMap(t=>t.variants.filter(e=>!A||e.available).map(n=>e.createElement(Ip,{key:`${t.id}-${n.id}`,product:{...t,variants:[n]},tierIdx:l,customizations:z,isMobile:v,hoveredCard:g,setHoveredCard:x,selectedProducts:u,handleAddToBundle:q,canAddProduct:U,allowMultipleQty:P,handleVariantChange:H,canIncrement:G,setSelectedProducts:m,splitVariants:!0}))):s.map(t=>e.createElement(Ip,{key:t.id,product:t,tierIdx:l,customizations:z,isMobile:v,hoveredCard:g,setHoveredCard:x,selectedProducts:u,handleAddToBundle:q,canAddProduct:U,allowMultipleQty:P,handleVariantChange:H,canIncrement:G,setSelectedProducts:m,splitVariants:!1})),c===t&&(C[t]||0)<a.length&&e.createElement("div",{ref:e=>{const n=T.current.get(t);n&&k.current?.unobserve(n),e?(T.current.set(t,e),k.current?.observe(e)):T.current.delete(t)},"data-sentinel-step":t.toString(),style:{height:"20px",width:"100%",display:"block"}}))))}),e.createElement(Fp,{config:o,selectedProducts:u,selectedByTier:K,totalItems:j,totalPrice:V,totalCompareAtPrice:W,currentStep:c,totalSteps:F,currentTierMax:Z,tierSelectedCounts:Y,isMobile:v,bundleAddToCartLoading:a,isUploading:b,hoveredCard:g,setHoveredCard:x,hideSelectedProducts:D,getProductStep:e=>{for(let t=0;t<N.length;t++)if(N[t].products.some(t=>t.id.toString()===e))return t+1;return I?F:N.length},setCurrentStep:s,handleRemoveItem:(e,t,n)=>{m(o=>o.filter(o=>!(o.productId===e&&o.variantId===t&&o.tierIndex===n)))},handleCheckout:async()=>{if(c!==F||!u.length)return;const e={};I&&Object.entries(f).forEach(([t,n])=>{const o=t.split("|").pop()?.replace(/^f_\d+$/,"")||t;"string"==typeof n&&n.trim()?e[o]=n:n&&"object"==typeof n&&"url"in n&&(e[o]=n.url)});const t=u.map(t=>({variantId:t.variantId,quantity:t.quantity,properties:e}));l(t)},hasForm:I,onHeightChange:M}))},Np=({totalSteps:t,isFormStep:o,currentStep:r,getStepTitle:i,isMobile:a,formTitle:l,hasForm:c,onStepClick:s})=>{const d=e.useRef(null);return n(()=>{if(!a||!d.current)return;const e=d.current.querySelector(".yt-collection-bundle-step-item-active");e&&e.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})},[r,a]),e.createElement("div",{className:"yt-collection-bundle-steps-nav-container",style:{display:"flex",justifyContent:"center",flexDirection:"column",gap:a?"0":"1rem",overflowX:"auto",scrollbarWidth:"none",borderBottom:"1px solid #878787",marginInline:a?"0":"2%",paddingBottom:"1rem",textAlign:"center"}},e.createElement("div",{ref:d,className:"yt-collection-bundle-steps-nav",style:{display:"flex",justifyContent:a?"flex-start":"center",gap:a?"1rem":"2rem",minWidth:a?100*t+"px":"auto",paddingInline:a?"calc(50% - 60px)":"0",scrollPaddingInline:a?"calc(50% - 60px)":"0",scrollBehavior:"smooth",overflowX:"auto",scrollbarWidth:"none"}},Array.from({length:t},(e,t)=>t+1).map(n=>e.createElement("div",{key:n,className:"yt-collection-bundle-step-item "+(r===n?"yt-collection-bundle-step-item-active":""),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.5rem",minWidth:a?"100px":"120px",flexShrink:0,cursor:"pointer",opacity:r===n?1:.5,transition:"opacity 0.2s"},onClick:()=>s(n)},e.createElement("div",{className:"yt-collection-bundle-step-icon "+(r===n?"yt-collection-bundle-step-icon-active":""),style:{width:"40px",height:"40px",background:r===n?"#000":"#fff",border:"2px solid #ccc",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center"}},c&&n===t?e.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},e.createElement("path",{d:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.67C10.96 2.54 10.05 2 9 2c-1.66 0-3 1.34-3 3 0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1h-2c-.55 0-1-.45-1-1s.45-1 1-1h2zm-6 0c.55 0 1 .45 1 1s-.45 1-1 1H7c-.55 0-1-.45-1-1s.45-1 1-1h2zM20 19H4V8h16v11z"})):e.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},e.createElement("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}))),e.createElement("div",{className:"yt-collection-bundle-step-label",style:{fontSize:"14px",textAlign:"center",color:"#333",fontWeight:"600",lineHeight:"normal"}},i(n))))),l&&c&&o&&e.createElement("p",{className:"yt-collection-bundle-steps-nav-description",style:{fontSize:a?"14px":"16px",marginBottom:a?"0":"14px",fontWeight:"400",color:"#000",lineHeight:"normal"}},l))},Ip=({product:n,tierIdx:o,customizations:r,isMobile:i,hoveredCard:a,setHoveredCard:l,selectedProducts:c,handleAddToBundle:s,canAddProduct:d,allowMultipleQty:p,handleVariantChange:u,canIncrement:m,setSelectedProducts:g,splitVariants:x=!1})=>{const[f,y]=t(!1),b=x?null:document.querySelector(`[data-product-id="${n.id}"]`),h=x?n.variants[0].id.toString():b?.dataset.selectedVariant??n.variants[0].id.toString(),v=n.variants.find(e=>e.id.toString()===h)||n.variants[0],w=x?`${n.id}-${v.id}`:n.id,C=c.some(e=>e.productId===n.id.toString()&&e.variantId===h&&e.tierIndex===o),E=a===w,k=c.filter(e=>e.productId===n.id.toString()&&e.variantId===v.id.toString()&&e.tierIndex===o).reduce((e,t)=>e+t.quantity,0);return e.createElement(e.Fragment,null,e.createElement("div",{key:w,className:"yt-collection-bundle-product-item","data-product-id":n.id,"data-selected-variant":v.id,"data-current-price":v.price,style:{display:"flex",flexDirection:"column",border:r?.productCardBorder||"1px solid #ddd",background:r?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:i?0:"250px",maxWidth:i?"none":"250px",borderRadius:r?.borderRadius||"8px",boxShadow:"spread"===r?.productCardShadow?"8px 8px 8px -6px #0000004D":"no-spread"===r?.productCardShadow?"6px 6px 0px -1px #00000033":"none",width:i?"100%":""}},e.createElement("div",{className:"yt-collection-bundle-product-image",style:{position:"relative",width:"100%",aspectRatio:r?.productImageRatio||"1/1",overflow:"hidden",cursor:"pointer",background:"#f9f9f9"},onClick:()=>y(!0),onMouseEnter:()=>l(w),onMouseLeave:()=>l(null)},e.createElement("img",{src:_p(n.images[0]||"https://cdn.shopify.com/s/files/1/0750/9937/3789/files/placeholder-thumbnail.png?width=250px"),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:E?0:1,transform:E?"scale(1.05)":"scale(1)"},alt:n.title}),e.createElement("img",{src:_p(n.images[1]||n.images[0]),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:E?1:0,transform:"scale(1.05)"},alt:n.title}),!x&&n.variants.length>1&&e.createElement("select",{className:"yt-collection-bundle-variant-selector",style:{position:"absolute",bottom:"10px",left:"10px",right:"10px",background:"rgba(255,255,255,0.9)",border:"none",borderRadius:"4px",padding:"8px",fontSize:"12px",fontWeight:"600",zIndex:2,lineHeight:"normal"},onChange:e=>u(n,e.target.value),defaultValue:v.id,onClick:e=>{e.stopPropagation()}},n.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-product-info",style:{padding:"12px",flexGrow:1,display:"flex",flexDirection:"column"}},r.productCardCategoryVisibility&&Bp(n).length>0&&e.createElement("div",{className:"yt-collection-bundle-product-categories-wrapper",style:{paddingBottom:"8px"}},e.createElement("div",{className:"yt-collection-bundle-product-categories",style:{display:"flex",flexWrap:"wrap",gap:"4px"}},Bp(n).slice(0,2).map((t,n)=>e.createElement("span",{className:"yt-collection-bundle-category-tag",key:n,style:{fontSize:i?"10px":"12px",color:"#666",fontWeight:"500"}},t.charAt(0).toUpperCase()+t.slice(1))),Bp(n).length>2&&e.createElement("span",{className:"yt-collection-bundle-more-categories",style:{fontSize:"10px",padding:"2px 6px",backgroundColor:"rgba(0, 0, 0, 0.05)",borderRadius:"8px",color:"#666",fontWeight:"500"}},"+",Bp(n).length-2," more"))),e.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:i?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:"normal",color:"#333",flexGrow:x?0:1}},n.title),x&&"Default Title"!==v.title&&e.createElement("p",{className:"yt-collection-bundle-variant-label",style:{fontSize:i?"10px":"12px",color:"#666",margin:"0 0 4px",lineHeight:"normal",flexGrow:1}},v.title),e.createElement("div",{className:"yt-collection-bundle-product-prices",style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"nowrap",whiteSpace:"nowrap",overflow:"hidden",lineHeight:"normal"}},e.createElement("span",{className:"yt-collection-bundle-product-price",style:{fontSize:i?"14px":"16px",fontWeight:"bold",color:"#000",flexShrink:0,lineHeight:"normal"}},"₹",(v.price/100).toLocaleString()),v.compare_at_price&&0!==v.compare_at_price&&v.compare_at_price>v.price?e.createElement("span",{className:"yt-collection-bundle-product-compare",style:{fontSize:"14px",textDecoration:"line-through",color:"#999",flexShrink:0,lineHeight:"normal"}},"₹",(v.compare_at_price/100).toLocaleString()):null)),p&&k>0?e.createElement("div",{className:"yt-collection-bundle-quantity-row",style:{display:"flex",alignItems:"center",flexWrap:"nowrap",background:"#cccccc"}},e.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-minus",style:{width:"40%",height:v.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:i?"6px":"12px",fontSize:i?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{g(e=>{const t=`${n.id}-${v.id}-${o}`,r=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return r&&r.quantity>1?e.map(e=>e===r?{...e,quantity:e.quantity-1}:e):r?e.filter(e=>e!==r):e})}},"-"),e.createElement("span",{className:"yt-collection-bundle-qty-display",style:{minWidth:"24px",textAlign:"center",fontWeight:600,width:"100%",lineHeight:"normal"}},k),e.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-plus",style:{width:"40%",height:v.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:i?"6px":"12px",fontSize:i?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{v.available&&m(n,v.id.toString(),o)&&g(e=>{const t=`${n.id}-${v.id}-${o}`,r=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return r?e.map(e=>e===r?{...e,quantity:e.quantity+1}:e):[...e,{productId:n.id.toString(),variantId:v.id.toString(),price:v.price,quantity:1,tierIndex:o}]})},disabled:!v.available||!m(n,v.id.toString(),o)},"+")):e.createElement("button",{className:"yt-collection-bundle-add-btn "+(C?"yt-collection-bundle-add-btn-added":""),style:{background:C?"#28a745":d(n,o)&&v.available?r?.atcBg||"#007bff":"#ccc",color:r?.atcText||"#fff",border:"none",padding:i?"6px":"12px",fontSize:i?"12px":"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",opacity:v.available?1:.6,lineHeight:"normal",textAlign:"center"},onClick:()=>{if(x)v.available&&d(n,o)&&g(e=>{const t=`${n.id}-${v.id}-${o}`,r=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return r?e.filter(e=>e!==r):[...e,{productId:n.id.toString(),variantId:v.id.toString(),price:v.price,quantity:1,tierIndex:o}]});else{if(!v.available||!d(n,o))return;s(n,o)}},disabled:!v.available||!d(n,o)},C?"Added":v.available?"ADD TO BOX":"Out of Stock")),f&&e.createElement(Sp,{product:n,tierIdx:o,isOpen:f,onClose:()=>y(!1),onAddToBundle:(e,t)=>{s(e,t),y(!1)},canAdd:d(n,o),isSelected:C,customizations:r,isMobile:i,splitVariants:x}))},Fp=o=>{const{config:i,selectedProducts:a,selectedByTier:l,totalItems:c,totalPrice:s,totalCompareAtPrice:d,currentStep:p,totalSteps:u,currentTierMax:m,tierSelectedCounts:g,isMobile:x,bundleAddToCartLoading:f,isUploading:y,hoveredCard:b,setHoveredCard:h,getProductStep:v,setCurrentStep:w,handleRemoveItem:C,handleCheckout:E,hasForm:k,onHeightChange:T}=o,{customizations:S}=i,[$,B]=t(!1),z=r(null),N=r(null),{totalOriginal:I,hasSavings:F,formattedSavings:D,totalAfterDiscount:P}=(e=>{let t=0,n=0;e.forEach(({items:e,tier:o})=>{const r=o?.discountData;let i=0;e.forEach(e=>{const t=(e.price||0)/100,n=e.quantity||1;i+=t*n}),t+=i;let a=i;if("mov_percentage"===r?.type&&r.tiers?.length){const e=[...r.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity).filter(e=>i>=e.minimumQuantity);if(e.length>0){const t=e.reduce((e,t)=>t.discountValue>e.discountValue?t:e).discountValue/100;a=i*(1-t)}}n+=a});const o=Math.round(t-n),r=o>0;return{savings:o,totalOriginal:t,totalAfterDiscount:n,hasSavings:r,formattedSavings:r?`₹${o.toLocaleString()}`:"",calculatedDiscountedTotal:Math.round(n)}})(l),A=l.filter(({count:e})=>e>0).map(({tier:e,items:t})=>{const n=t.reduce((e,t)=>{if(!t)return e;return e+(t.price||0)*(t.quantity||1)},0)/100;return((e,t,n)=>{const o=e.discountData;if(!o||!o.tiers?.length)return null;const r=[...o.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity),i=[];if("mov_percentage"===o.type){if("number"!=typeof n)return null;const e=r.filter(e=>n>=e.minimumQuantity).pop();e&&i.push(`${e.discountValue}% OFF`);const t=r.find(e=>n<e.minimumQuantity);if(t){const e=t.minimumQuantity-n;i.push(`Add ₹${e} more to get ${t.discountValue}% OFF`)}return i.length?i.join(" + "):null}const a=r.filter(e=>t>=e.minimumQuantity);if(a.length>0){const e=a.reduce((e,t)=>e.minimumQuantity>t.minimumQuantity?e:t);let t=null;switch(o.type){case"percentage_discount_coupon":t=`${e.discountValue}% OFF`;break;case"amount_discount_coupon":t=`₹${e.discountValue} OFF`;break;case"fixed_price_collection":t=`Fixed ₹${e.discountValue}`;break;case"dummy_coupon":t="Discount Applied"}t&&i.push(t)}const l=r.find(e=>t<e.minimumQuantity);if(l){const e=l.minimumQuantity-t;let n=null;switch(o.type){case"percentage_discount_coupon":n=`${l.discountValue}% OFF`;break;case"amount_discount_coupon":n=`₹${l.discountValue} OFF`;break;case"fixed_price_collection":n=`Fixed ₹${l.discountValue}`;break;case"dummy_coupon":n="Discount"}n&&i.push(`Add ${e} more item${1!==e?"s":""} to get ${n}`)}return i.length?i.join(" + "):null})(e,t.length,n)}).filter(Boolean);return n(()=>{const e=m!==1/0&&g[p-1]===m-2&&m>1;let t=null;return e?(B(!0),t=setTimeout(()=>{B(!1)},3e3)):B(!1),()=>{t&&clearTimeout(t)}},[m,g,p]),n(()=>{if(z.current&&T){const e=z.current.offsetHeight;T(e)}},[x,T,a]),n(()=>{const e=Math.max(...l.map(({tier:e,items:t})=>{if("mov_percentage"!==e?.discountData?.type)return 0;const n=t.reduce((e,t)=>e+(t.price||0)*(t.quantity||1),0)/100,o=(e?.discountData?.tiers||[]).filter(e=>n>=e.minimumQuantity).sort((e,t)=>t.discountValue-e.discountValue)[0];return o?.discountValue??0}));if(e<(N.current??0)&&(N.current=e),e>(N.current??0)){N.current=e;const t=document.querySelector(".yt-collection-bundle-next-btn");if(!t)return;const n=t.getBoundingClientRect(),o=(n.left+n.width/2)/window.innerWidth,r=(n.top+n.height/2)/window.innerHeight;Ce({particleCount:100,spread:70,origin:{x:o,y:r},zIndex:9999})}},[l]),e.createElement("div",{ref:z,className:"yt-collection-bundle-bar",style:{background:S?.bundleBg||"#fff",color:S?.bundleText||"#333",border:S?.bundleBorder||"1px solid #878787",display:"flex",flexDirection:"column",position:"fixed",bottom:"10px",left:"50%",transform:"translateX(-50%)",width:"compact"==S.stickyBarWidth?"600px":"90%",maxWidth:"95%",zIndex:899,boxShadow:"0 -2px 10px rgba(0,0,0,0.1)",transition:"bottom 0.3s ease",borderRadius:S?.borderRadius||"8px",overflow:"hidden"}},A.length>0&&e.createElement("div",{style:{padding:"4px 8px",background:"#dbdbdbc5",color:"#6c757d",textAlign:"center",fontSize:"12px",fontWeight:500}},A.join(" + ")),e.createElement("div",{className:"yt-collection-bundle-bar-header",style:{position:"relative",textAlign:"center"}},$&&e.createElement(e.Fragment,null,e.createElement("style",null,"\n @keyframes fadeIn {\n from { opacity: 0; transform: translateX(-50%) translateY(10px); }\n to { opacity: 1; transform: translateX(-50%) translateY(0); }\n }\n "),e.createElement("div",{className:"yt-collection-bundle-ctx",style:{position:"absolute",top:"-40px",left:"50%",transform:"translateX(-50%)",background:S?.atcBg||"#007bff",color:S?.atcText||"#fff",padding:"4px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"14px",whiteSpace:"nowrap",zIndex:10,boxShadow:"0 4px 12px rgba(0,0,0,0.2)",animation:"fadeIn 0.3s ease-out",minWidth:"300px",textAlign:"center",border:"1px solid rgba(0,0,0,0.1)",lineHeight:"normal"}},"Add up to"," ",e.createElement("span",{style:{fontWeight:600}},m," item",m>1?"s":"")))),a.length>0&&e.createElement("div",{className:"yt-collection-bundle-bar-top",style:{display:"flex",alignItems:"center",padding:"8px 8px 0",position:"relative",borderRadius:S?.borderRadius||"8px"}},e.createElement("div",{className:"yt-collection-bundle-images",style:{display:"flex",flex:1,gap:"5px",justifyContent:"center",alignItems:"center",overflowX:"auto",padding:"4px 0",scrollbarWidth:"none"}},l.filter(({count:e})=>e>0).map(({items:t},n,o)=>e.createElement(e.Fragment,{key:n},e.createElement("div",{className:"yt-collection-bundle-tier-images",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",minWidth:"fit-content"}},e.createElement("div",{style:{display:"flex",gap:"4px"}},t.map((t,o)=>{const r=i.config.builderTiers.collectionTier.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId);if(!r)return null;const a=v(t.productId),l=p===a;return e.createElement("div",{key:o,className:"yt-collection-bundle-img-wrapper",style:{position:"relative",flexShrink:0,height:"65px"}},e.createElement("div",{style:{position:"relative",width:"67px",height:"67px",borderRadius:`calc(${S?.borderRadius||"8px"} / 2)`,overflow:"hidden",cursor:l?"default":"pointer",transition:"transform 0.2s ease"},onMouseEnter:e=>!l&&(e.currentTarget.style.transform="scale(1.08)"),onMouseLeave:e=>e.currentTarget.style.transform="scale(1)",onClick:()=>!l&&w(a)},e.createElement("img",{src:_p(r.images[0]),style:{width:"65px",height:"65px",objectFit:"cover",borderRadius:`calc(${S?.borderRadius||"8px"} / 2)`,transition:"opacity 0.2s",pointerEvents:"none",border:"1px solid #ddd"},alt:"Selected"}),t.quantity>1&&e.createElement("div",{className:"yt-collection-bundle-qty-badge",style:{position:"absolute",bottom:"4px",right:"4px",background:"rgba(0,0,0,0.7)",color:"#fff",borderRadius:"10px",padding:"2px 6px",fontSize:"10px",fontWeight:600,lineHeight:"normal"}},"x",t.quantity),e.createElement("button",{className:"yt-collection-bundle-remove-btn",style:{position:"absolute",top:"4px",right:"4px",width:"20px",height:"20px",background:"rgba(220,53,69,0.95)",color:"white",border:"none",borderRadius:"50%",fontSize:"12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.3)",textAlign:"center",lineHeight:"normal"},onClick:e=>{e.stopPropagation(),C(t.productId,t.variantId,n)}},"×")))}))),n<o.length-1&&o[n+1].count>0&&e.createElement("div",{style:{color:"#666",paddingInline:"6px",lineHeight:"normal"}},e.createElement(U,null)))))),x?e.createElement("div",{className:"yt-collection-bundle-mobile-bar-content",style:{display:"flex",flexDirection:c>0&&(k||i?.config?.builderTiers?.collectionTier?.length>1)?"column":"row",margin:"4px",gap:c>0?"10px":"0",background:"#dbdbdb",borderRadius:S?.borderRadius||"8px",overflow:"hidden"}},e.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:a.length>0?"space-between":"center",alignItems:"center",borderRadius:S?.borderRadius||"8px"}},e.createElement(e.Fragment,null,0===c&&e.createElement("div",{style:{fontSize:"14px",color:"#6c757d",lineHeight:"normal",...0===c&&{padding:"8px 0 12px 0",background:"#dbdbdb",color:"#6c757d",width:"100%",borderRadius:S?.borderRadius||"8px"}}},"Add Items to Checkout"),c>0&&e.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"6px",width:"100%",justifyContent:"center",flexWrap:"wrap"}},e.createElement("div",{style:{fontSize:"14px",color:"#000",fontWeight:600}},"₹",(P??s).toLocaleString()),F?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",I.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",D)):e.createElement(e.Fragment,null,d>s&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",d.toLocaleString())),e.createElement("span",{style:{fontSize:"12px",color:"#000",fontWeight:500}},"(",c," items)")))),e.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"4px"}},(i?.config?.builderTiers?.collectionTier?.length>1||k)&&c>0&&e.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:1===p?"not-allowed":"pointer",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",textAlign:"center",lineHeight:"normal"},onClick:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>h(-1),onMouseLeave:()=>h(null),disabled:1===p},"Back"),c>0&&e.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===c||y?"yt-collection-bundle-next-btn-disabled":""),style:{background:S?.btnPrimaryBg||"#28a745",color:S?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",opacity:p===u&&0===c||y?.6:1,textAlign:"center",lineHeight:"normal"},onClick:p===u?E:()=>w(p+1),disabled:p===u&&0===c||f||y},f?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(Yc,null)):p===u?"Checkout":"Next"))):e.createElement("div",{className:"yt-collection-bundle-bar-bottom",style:{display:"flex",alignItems:"center",padding:"0px",background:"#dbdbdb",margin:"8px",borderRadius:S?.borderRadius||"8px",overflow:"hidden",scrollbarWidth:"none"}},(i?.config?.builderTiers?.collectionTier?.length>1||k)&&c>0&&e.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:1===p?"not-allowed":"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",...-1===b&&{filter:"brightness(60%)"},textAlign:"center",lineHeight:"normal"},onClick:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>h(-1),onMouseLeave:()=>h(null),disabled:1===p},"Back"),e.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:a.length>0?"space-between":"center",paddingInline:"6px",alignItems:"center",...0===c&&{padding:"12px 24px"}}},0===c&&e.createElement("div",{style:{fontSize:"16px",color:"#6c757d",lineHeight:"normal"}},"Add Items to Checkout"),c>0&&e.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",justifyContent:"center"}},e.createElement("div",{style:{fontSize:"16px",color:"#000",fontWeight:600}},"₹",(P??s).toLocaleString()),F?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",I.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",D)):e.createElement(e.Fragment,null,d>s&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",d.toLocaleString())),e.createElement("span",{style:{fontSize:"16px",color:"#000",fontWeight:500}},"(",c," items)"))),c>0&&e.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===c||y?"yt-collection-bundle-next-btn-disabled":""),style:{background:S?.btnPrimaryBg||"#28a745",color:S?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",opacity:p===u&&0===c||y?.6:1,...-2===b&&{filter:"brightness(90%)"},textAlign:"center",lineHeight:"normal"},onClick:p===u?E:()=>w(p+1),disabled:p===u&&0===c||f||y,onMouseEnter:()=>h(-2),onMouseLeave:()=>h(null)},f?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(Yc,null)):p===u?"Checkout":"Next")))},Dp=window?.Shopify?.currency||{rate:1,active:"INR"},Pp=e=>{if(!e)return;const t=navigator.language||"en-US",n=Number((Number(e)*Dp.rate).toFixed(2));return new Intl.NumberFormat(t).format(n)},Ap=(e,t)=>t==Dp.active?e:se(Dp.active)||Dp.active,_p=(e,t)=>{if(!e||!e.includes("cdn.shopify")&&!e.includes("/cdn/shop/files/"))return e;try{const n=new URL(e),o=n.searchParams;return o.has("format")||o.set("format","webp"),o.has("quality")||o.set("quality",t?.toString()||"70"),o.has("width")||o.set("width","600"),n.toString()}catch{const n=e.includes("?")?"&":"?";return e+n+`format=webp&quality=70&width=${t?.toString()||"600"}`}},Rp=(e,t,n,o,r,i,a)=>{const l=o.findIndex(t=>t.variantId===e&&(void 0===a||t.tierIndex===a));r(0===n?e=>e.filter((e,t)=>t!==l):-1===l?o=>[...o,{product:t,variantId:e,quantity:n,isFree:i,tierIndex:a}]:e=>e.map((e,t)=>t===l?{...e,quantity:e.quantity+n,isFree:i,tierIndex:a}:e))},Op=({bundle:t,currentProductId:n,addToCartFunction:o,addCustomBundleToCart:r,selectedItems:i,setSelectedItems:a,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:s,renderingOnPage:d,bundleSubtotal:p,dispatchAnalyticsEvent:u,fetchStoreDetails:m,productsPagination:g})=>"fixed"!==t.type&&t.type&&0!==t?.type?.length?"builder"===t.type?e.createElement(ns,{bundleAddToCartLoading:l,bundle:t,selectedItems:i,setSelectedItems:a,handleAddToCart:r,handleRemoveItem:c,renderingOnPage:d,selectedItemsQuantity:s??0,bundleSubtotal:p??{price:0,compareAtPrice:0},dispatchAnalyticsEvent:u,fetchStoreDetails:m,productsPagination:g}):"combo"===t.type?e.createElement(is,{bundle:t,addToCartFunction:o,dispatchAnalyticsEvent:u}):"mixAndMatch"===t.type?e.createElement(xd,{bundle:t,addToCartFunction:o,dispatchAnalyticsEvent:u}):"collection"===t.type?e.createElement(zp,{config:t,addCustomBundleToCart:r,bundleAddToCartLoading:l}):e.createElement(_s,{bundle:t,currentProductId:n,addToCartFunction:o,dispatchAnalyticsEvent:u}):e.createElement(Tp,{addToCartFunction:o,bundle:t,dispatchAnalyticsEvent:u}),Lp=c.div`
4669
4669
  position: relative;
4670
4670
  `,Mp=c.button`
4671
4671
  border: 1px solid #ccc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yt-uikit",
3
- "version": "0.9.6",
3
+ "version": "0.9.8",
4
4
  "description": "YourToken UI Kit",
5
5
  "scripts": {
6
6
  "rollup": "rm -rf dist && tsc && rollup -c",