yt-uikit 0.9.6 → 0.9.7

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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yt-uikit",
3
- "version": "0.9.6",
3
+ "version": "0.9.7",
4
4
  "description": "YourToken UI Kit",
5
5
  "scripts": {
6
6
  "rollup": "rm -rf dist && tsc && rollup -c",