yt-uikit 0.8.75 → 0.8.76
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
|
@@ -3145,7 +3145,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
|
|
|
3145
3145
|
font-size: 1em;
|
|
3146
3146
|
justify-content: center;
|
|
3147
3147
|
align-items: center;
|
|
3148
|
-
`;const Bc=({options:t,selectedValue:n,onChange:o,type:r="text",isOptionAvailable:i,isMobile:a})=>e.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"}},t?.map(t=>{const a=!i||i(t.name);return e.createElement("div",{key:t.name,onClick:()=>{a&&o(t)},style:{cursor:a?"pointer":"not-allowed"}},((t,n)=>{const o=!i||i(t.name),a={cursor:o?"pointer":"not-allowed",border:n?"2px solid #333":"1px solid #d1d5db",transition:"all 0.2s ease",opacity:o?1:.5};if("color"===r)return t.value&&(()=>{if(!t.value.trim())return!1;if(t.value===t.name||t.value.length<3)return!1;try{const e=document.createElement("div");return e.style.color=t.value,""!==e.style.color}catch{return!1}})()?e.createElement("div",{style:{...a,width:24,height:24,borderRadius:"50%",backgroundColor:t.value,display:"block"}}):e.createElement("div",{style:{...a,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"}},t.name);return"image"===r?e.createElement("img",{src:gn(t.value,48,85,"webp")||"/placeholder.svg",alt:t.name,style:{...a,width:24,height:24,borderRadius:"50%",objectFit:"cover"}}):e.createElement("div",{style:{...a,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"}},t.name)})(t,n?.name===t.name))})),Ic=({product:r,isOpen:i,onClose:a,variantOptions:l,cta:c,onConfirm:d})=>{const s=o(()=>e=>e?r?.tracksInventory&&e?.inventoryItem?.tracked?e.inventoryQuantity>0?e?.inventoryQuantity:e.inventoryQuantity<=0&&"continue"===e.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0,[r?.tracksInventory]),p=o(()=>{const e=r.variants.edges.find(e=>{const t=e.node;return s(t)>0})?.node;return e?.title&&"Default Title"!==e.title?e.title.split(" / "):r.options?.map(e=>e.values[0])||[]},[r,s]),[u,m]=t(p),[g,x]=t(window.innerWidth<1024);n(()=>{const e=()=>x(window.innerWidth<1024);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),n(()=>{const e=e=>{"Escape"===e.key&&a()};return i&&document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[i,a]);const f=r.variants.edges.find(e=>e.node.title===(r.options?.length>0?u.join(" / "):u[0]))?.node,y=f?.image?.url||r.featuredMedia?.preview?.image?.url,b=gn(y,150,85,"webp"),h=e=>{if(!l?.options)return"text";const t=l.options.find(t=>t.name===e);return t?.type||"text"},v=e=>{if(!l?.options)return e.values.map(e=>({name:e,value:e}));const t=l.options.find(t=>t.name===e.name);return e.values.map(e=>{const n=t?.values?.find(t=>t.name===e);return{name:e,value:n?.value||e}})},w=(e,t)=>{const n=u[t];if(!n)return null;return v(e).find(e=>e.name===n)||null};if(!i)return null;const C=e.createElement("div",{onClick:a,style:{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100vw",height:"100vh",background:"rgba(0, 0, 0, 0.4)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center"},role:"dialog","aria-modal":"true","aria-labelledby":"yt-variant-options-modal-title"},e.createElement("div",{onClick:e=>e.stopPropagation(),style:{background:"white",borderRadius:16,width:"fit-content",minWidth:350,maxWidth:450,maxHeight:"90vh",overflowY:"auto",position:"relative",zIndex:999,...window.innerWidth<=600&&{width:"90vw",maxWidth:"90vw",minWidth:"90vw"}}},e.createElement("div",{id:"yt-variant-options-modal-title",style:{width:"100%",padding:"16px 0",fontWeight:600,fontSize:14,textTransform:"uppercase",backgroundColor:"rgba(217, 217, 217)",color:"black",textAlign:"center",borderTopLeftRadius:16,borderTopRightRadius:16}},"Select Options"),e.createElement("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"16px 20px",borderBottom:"1px solid #f0f0f0"}},e.createElement("img",{src:b,alt:r.title,style:{width:60,height:60,borderRadius:8,objectFit:"cover",flexShrink:0,transition:"opacity 0.3s ease"}}),e.createElement("div",{style:{display:"flex",flexDirection:"column",flex:1,gap:4}},e.createElement("div",{style:{fontSize:14,fontWeight:600,color:"#333"}},r.title))),e.createElement("div",{style:{padding:"20px"}},r.options.map((t,n)=>e.createElement("div",{key:t.name,style:{display:"flex",flexDirection:"column",gap:8,marginBottom:t?.values?.length>1?16:0}},t?.values?.length>1&&e.createElement(e.Fragment,null,e.createElement("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8}},e.createElement("span",{style:{fontSize:14,fontWeight:500,color:"#333"}},"Select ",t.name),e.createElement("span",{style:{fontSize:12,fontWeight:500,color:"#666",backgroundColor:"#f5f5f5",padding:"4px 12px",borderRadius:16,textTransform:"capitalize"}},w(t,n)?.name||t.values[0])),e.createElement(Bc,{options:v(t),selectedValue:w(t,n),onChange:e=>{((e,t)=>{const n=[...u];n[e]=t.name,m(n)})(n,e)},type:h(t.name),isOptionAvailable:e=>((e,t)=>{const n=[...u];n[e]=t;const o=r.options?.length>0?n.join(" / "):n[0],i=r.variants.edges.find(e=>e.node.title===o)?.node;return!!i&&s(i)>0})(n,e),isMobile:g}))))),e.createElement("button",{onClick:()=>{const e=r.variants.edges.find(e=>e.node.title===(r.options?.length>0?u.join(" / "):u[0]))?.node,t=!!e&&s(e)>0;if(e?.id&&t)d(e.id),a();else{console.warn("yt::variant options modal - selected variant not available or out of stock:",u);const e=r.variants.edges.find(e=>s(e.node)>0)?.node.id;e&&(d(e),a())}},style:{width:"100%",fontSize:14,fontWeight:600,textTransform:"uppercase",backgroundColor:c.backgroundColor,color:c.textColor,textAlign:"center",padding:"16px 0",border:"none",cursor:"pointer",borderBottomLeftRadius:16,borderBottomRightRadius:16},onMouseEnter:e=>{e.currentTarget.style.opacity="0.9"},onMouseLeave:e=>{e.currentTarget.style.opacity="1"}},"Add to Bundle")));return D.createPortal(C,document.body)},zc=l((r,a)=>{const[l,c]=ie(Ec),d=o(()=>e=>{const t=r?.customVariantsQuantity?.find(t=>t.variantId===e?.id)?.quantity;return void 0!==t?t:r?.bundleProductsCustomQuantity?r?.bundleProductsCustomQuantity:e?l?.tracksInventory&&e.inventoryItem?.tracked?e.inventoryQuantity>0?e.inventoryQuantity:e.inventoryQuantity<=0&&"continue"===e.inventoryPolicy?.toLocaleLowerCase()?1/0:0:1/0:0},[l?.tracksInventory,r?.customVariantsQuantity,r?.bundleProductsCustomQuantity]),s=l?.variants.edges?.filter(e=>d(e.node)>0)||[],[p,u]=t(s?.[0]?.node),[m,g]=t(0),[x,f]=t("undefined"!=typeof window&&window.innerWidth<=600),[y,b]=t(1),[h,v]=t("idle"),[w,C]=t(null),[E,k]=t(null),T=o(()=>{const e=l?.variants.edges.find(e=>{const t=e.node;return d(t)>0})?.node;return e?.title&&"Default Title"!==e.title?e.title.split(" / "):l?.options?.map(e=>e.values[0])||[]},[l,d]),[S,$]=t(T);n(()=>{if(l){const e=l.variants.edges?.filter(e=>d(e.node)>0),t=l?.selectedVariant??e[0]?.node;u(t),t?.title&&"Default Title"!==t.title&&$(t.title.split(" / "))}},[l,d]),n(()=>{const e=r.selectedProducts.find(e=>e.variantId===p?.id);b(e?e.quantity:0)},[y,r.selectedProducts,p]),n(()=>{if(l&&p?.image?.url&&Array.isArray(N)){const e=N.findIndex(e=>e?.url===p?.image?.url);-1!==e&&e!==m&&g(e)}},[p]);if(n(()=>{const e=()=>f(window.innerWidth<=600);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),!l)return null;const{title:B,descriptionHtml:I,media:z,variants:F}=l,N=z.edges.map(e=>e?.node.preview.image??e?.node.image).filter(e=>e?.url?.length>0),P=i(e=>{const t=e.target.value,n=s?.find(e=>e.node.id===t)?.node;n&&d(n)>0&&(u(n),n.title&&"Default Title"!==n.title&&$(n.title.split(" / ")))},[s,d]),A=i(e=>{if(!r.bundleVariantOptions?.options)return"text";const t=r.bundleVariantOptions?.options.find(t=>t.name===e);return t?.type||"text"},[r.bundleVariantOptions]),_=i(e=>{if(!r?.bundleVariantOptions?.options)return e.values.map(e=>({name:e,value:e}));const t=r?.bundleVariantOptions?.options.find(t=>t.name===e.name);return e.values.map(e=>{const n=t?.values?.find(t=>t.name===e);return{name:e,value:n?.value||e}})},[r.bundleVariantOptions]),R=i((e,t)=>{const n=[...S];n[e]=t.name,$(n);const o=l?.options?.length>0?n.join(" / "):n[0],r=l?.variants.edges.find(e=>e.node.title===o)?.node;r&&d(r)>0&&u(r)},[S,l,d]),O=i((e,t)=>{const n=S[t];if(!n)return null;return _(e).find(e=>e.name===n)||null},[S,_]),L=i((e,t)=>{const n=[...S];n[e]=t;const o=l?.options?.length>0?n.join(" / "):n[0],r=l?.variants.edges.find(e=>e.node.title===o)?.node;return!!r&&d(r)>0},[S,l,d]);n(()=>{if(l){window.history.pushState({modalOpen:!0},"",window.location.href);const e=e=>{c(void 0),e.preventDefault()};return window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e),window.history.state?.modalOpen&&window.history.back()}}},[l,c]);const M=e=>{C(e.targetTouches[0].clientX),k(null)},j=e=>{k(e.targetTouches[0].clientX)},V=()=>{if(null!==w&&null!==E&&N.length>1){const e=w-E,t=50;e>t?g(e=>e<N.length-1?e+1:0):e<-t&&g(e=>e>0?e-1:N.length-1)}C(null),k(null)},W=r.selectedProducts.filter(e=>e.variantId===p?.id).reduce((e,t)=>e+t.quantity,0),H=r.customVariantsQuantity?.find(e=>e.variantId===p?.id)?.quantity??r.bundleProductsCustomQuantity??1/0,q=H!==1/0&&W>=H,Q=r.hideAddToBundle||!p||d(p)<=0||q||"idle"!==h||r?.disableQuantitySelector&&1===y,U=({className:t})=>{const n=l?.rating?.averageRating??r?.rating?.averageRating??0,o=l?.rating?.ratingCount??r?.rating?.ratingCount??0;return n<=0?null:e.createElement(e.Fragment,null,"ratingOnly"===r.reviewRatingType&&e.createElement("div",{className:t,style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(Se,{color:"gold",size:14}),e.createElement("span",{style:{marginLeft:6}},n," rating")),"ratingAndReviewCount"===r.reviewRatingType&&e.createElement("div",{className:t,style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(Se,{color:"gold",size:14}),n,e.createElement(he,{size:14,style:{color:"dodgerblue",marginLeft:"4px"}}),"(",o," reviews)"))},Y=({isMobile:t})=>e.createElement(e.Fragment,null,e.createElement("div",{className:t?"yt-byob-modal-mobile-image-swipe":"yt-byob-modal-desktop-image-swipe",style:t?{position:"relative"}:{},onTouchStart:M,onTouchMove:j,onTouchEnd:V},e.createElement(ut,{small:Bp(N[m]?.url),medium:Bp(N[m]?.url),large:Bp(N[m]?.url),hideDownload:!0,className:t?"yt-byob-modal-mobile-main-image main-image":"yt-byob-modal-desktop-main-image main-image",imageBackgroundColor:"#000"}),t&&e.createElement("div",{className:"yt-byob-modal-mobile-image-indicators",style:{position:"absolute",bottom:"20px",width:"100%",display:"flex",justifyContent:"center",alignItems:"center"}},N.length>1&&N.map((t,n)=>e.createElement("span",{key:n,className:"yt-byob-modal-mobile-indicator "+(m===n?"active":""),style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:m===n?"#FFFFFF":"#EBEBEB",margin:"0 3px",cursor:"pointer",backdropFilter:"blur(10px)"}})))),e.createElement("div",{className:t?"yt-byob-modal-mobile-image-gallery image-gallery":"yt-byob-modal-desktop-image-gallery image-gallery",style:{display:"flex",flexDirection:"row",overflow:"auto",gap:t?"5px":"10px",scrollbarWidth:"none",...t&&{overflowX:"auto",padding:"5px 20px"}}},N.length>1&&N.filter(e=>e?.url.length>0).map((n,o)=>e.createElement("img",{key:o,className:`${t?"yt-byob-modal-mobile-gallery-thumb":"yt-byob-modal-desktop-gallery-thumb"} ${m===o?"active":""}`,src:Bp(n?.url),alt:n.altText||`${B} - Image ${o+1}`,onClick:()=>g(o),style:{width:t?"60px":"73px",height:t?"60px":"73px",cursor:"pointer",borderRadius:"7px",border:"1px solid lightgray",...m===o&&{border:`2px solid ${r.themeColor||"#111"}`},objectFit:"cover"},loading:"lazy"})))),X=({className:t})=>l?.variants?.edges?.length<=1?null:e.createElement("div",{className:t},e.createElement("div",{className:`${t}-label`,style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid #e0e0e0",paddingBottom:"5px",fontSize:"16px",color:"#999",position:"relative",marginBottom:"10px"}},e.createElement("span",{style:{flexShrink:0}},l.options[0].name," :"," ",e.createElement("strong",{style:{color:"#000",paddingLeft:"5px"}},p?.title)),e.createElement("select",{className:`${t}-select`,value:p?.id||"",onChange:P,style:{appearance:"none",border:"none",background:"transparent",fontWeight:"bold",color:"#000",cursor:"pointer",paddingRight:"20px",position:"absolute",right:0,top:0,bottom:0,width:"100%",opacity:0,zIndex:2}},l?.variants?.edges?.map(({node:t})=>e.createElement("option",{key:t.id,value:t.id,disabled:0===d(t)},t.title))),e.createElement("span",{className:`${t}-chevron`,style:{position:"absolute",right:5,pointerEvents:"none",fontSize:"12px",color:"#000"}},e.createElement(Ge,null)))),Z=({isMobile:t})=>e.createElement(e.Fragment,null,l.options.map((n,o)=>e.createElement("div",{key:n.name,style:{display:"flex",flexDirection:"column",gap:8,marginBottom:n?.values?.length>1?16:0}},n?.values?.length>1&&e.createElement(e.Fragment,null,e.createElement("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8}},e.createElement("span",{style:{fontSize:14,fontWeight:500,color:"#333"}},"Select ",n.name),e.createElement("span",{style:{fontSize:12,fontWeight:500,color:"#666",backgroundColor:"#f5f5f5",padding:"4px 12px",borderRadius:16,textTransform:"capitalize"}},S[o]||n.values[0])),e.createElement(Bc,{options:_(n),selectedValue:O(n,o),onChange:e=>{R(o,e)},type:A(n.name),isOptionAvailable:e=>L(o,e),isMobile:t}))))),K=({isMobile:t})=>e.createElement("div",{className:t?"yt-byob-modal-mobile-price":"yt-byob-modal-desktop-price",style:{width:"fit-content",minWidth:"fit-content",paddingRight:"10px",display:"flex",flexDirection:"row",alignItems:t?"center":"baseline",gap:"6px"}},r?.isFreebieTier&&!r.showFreebieTierProductPrices?e.createElement(e.Fragment,null,e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"20px",textDecoration:"line-through",color:"#888",marginRight:"6px"}},$p(r.styles.general.currencySymbol,r.styles.general.currencySymbol),Sp(p?.price)),e.createElement("span",{className:"yt-byob-current-price",style:{color:r.styles.general.primaryColor||"#d32f2f",fontWeight:"bold",fontSize:"20px"}},"FREE")):e.createElement(e.Fragment,null,p?.compareAtPrice&&parseFloat(p.compareAtPrice)>parseFloat(p?.price)&&e.createElement("div",{className:t?"yt-byob-modal-mobile-compare-price":"yt-byob-modal-desktop-compare-price",style:{textDecoration:"line-through",opacity:"0.5",lineHeight:"normal"}},$p(r.styles.general.currencySymbol,r.styles.general.currencySymbol),Sp(p?.compareAtPrice)),e.createElement("div",{className:t?"yt-byob-modal-mobile-current-price":"yt-byob-modal-desktop-current-price"},e.createElement("span",{style:{fontSize:"20px",fontWeight:"600",color:"#000",textAlign:"center",lineHeight:"normal"}},$p(r.styles.general.currencySymbol,r.styles.general.currencySymbol),Sp(p?.price))))),J=({isMobile:t})=>e.createElement("div",{className:t?"yt-byob-modal-mobile-atc-wrapper":"yt-byob-modal-desktop-atc-wrapper yt-product-modal-atc-wrapper",style:{width:t?"100%":"80%"}},e.createElement("button",{className:t?"yt-byob-modal-mobile-atc-button":"yt-byob-modal-desktop-atc-button yt-product-modal-atc-button",style:{textTransform:"uppercase",fontWeight:"800",width:"100%",border:"none",backgroundColor:r.themeColor||"#111",borderRadius:r.cornerRadius,color:r.primaryTextColorCta||"#fff",minHeight:"40px",padding:"0px 15px",position:"relative",overflow:"hidden",opacity:Q?.5:1,cursor:Q?"not-allowed":"pointer"},onClick:e=>{e.stopPropagation(),e.preventDefault(),p?.id&&l&&(v("check"),r.handleAddToBundle(p?.id,l,1),setTimeout(()=>{v("idle"),c(void 0)},500))},disabled:Q},r.styles.byob.addToBundleCTAText??"Add to bundle")),ee=e.createElement(Tc,{className:"yt-byob-modal-desktop-overlay"},e.createElement(Sc,{$isSmallScreen:x,ref:a},e.createElement($c,{ref:a,className:"yt-byob-modal-desktop-container yt-variant-selection-modal"},e.createElement("div",{className:"yt-byob-modal-desktop yt-variant-selection-modal "+(x?"small-screen":"large-screen")},e.createElement(kc,{className:"yt-byob-modal-desktop-close",onClick:()=>{c(void 0)},style:{backgroundColor:"white"}},e.createElement(G,{size:"25"})),e.createElement("div",{className:"yt-byob-modal-desktop-image-section image-section"},e.createElement(Y,null)),e.createElement("div",{className:"yt-byob-modal-desktop-details-section details-section",style:{marginLeft:"20px",minHeight:"100%",maxHeight:"70vh",scrollbarWidth:"none",overflowY:"auto",display:"flex",flexDirection:"column"}},e.createElement("h2",{className:"yt-byob-modal-desktop-title"},"variant-display-name"===r?.styles?.byob?.productVariantTitleType?l?.selectedVariant?.displayName:"variant-title"===r?.styles?.byob?.productVariantTitleType?l?.selectedVariant?.title:l?.title),e.createElement(U,{className:"yt-byob-modal-desktop-rating"}),e.createElement("div",{className:"yt-byob-modal-desktop-variant-price-wrapper",style:{display:"flex",flexDirection:"column",gap:"2px",marginTop:"20px"}},"dropdown"===r?.styles?.byob.variantSelectorType&&e.createElement(X,{className:"yt-byob-modal-desktop-variant-selector"}),"customOptions"===r?.styles?.byob.variantSelectorType&&e.createElement(Z,null),e.createElement("div",{className:"yt-byob-modal-desktop-price-atc-wrapper",style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"}},e.createElement(K,{isMobile:!1}),e.createElement(J,{isMobile:!1}))),e.createElement("div",{className:"yt-byob-modal-desktop-divider",style:{height:"10px",minHeight:"10px",border:"none",backgroundColor:"#D9D9D96B",margin:"20px 0 10px 0",display:"block !important"}},e.createElement("span",null)),e.createElement("span",{className:"yt-byob-modal-desktop-description yt-description-content",style:{scrollBehavior:"smooth"},dangerouslySetInnerHTML:{__html:I}})))))),te=e.createElement(Tc,{className:"yt-byob-modal-mobile-overlay"},e.createElement(Sc,{className:"yt-byob-modal-mobile-content",style:{padding:"0px",position:"relative"},$isSmallScreen:x,ref:a},e.createElement($c,{ref:a,className:"yt-byob-modal-mobile-container yt-variant-selection-modal"},e.createElement("button",{className:"yt-byob-modal-mobile-close-btn",style:{position:"fixed",top:"20px",right:"20px",zIndex:9999999999,backgroundColor:"#FFFFFF",padding:"4px",borderRadius:"50%",border:"1px solid lightgray",display:"flex",justifyContent:"center",alignItems:"center"},onClick:()=>{c(void 0)}},e.createElement(Ye,{className:"yt-byob-modal-mobile-close-icon",style:{height:"22px",width:"22px",padding:"4px",color:"black"},onMouseEnter:e=>e.currentTarget.style.color="black"})),e.createElement("div",{className:"yt-byob-modal-mobile yt-variant-selection-modal small-screen",style:{padding:"0px"}},e.createElement("div",{className:"yt-byob-modal-mobile-image-section image-section"},e.createElement(Y,{isMobile:!0})),e.createElement("div",{className:"yt-byob-modal-mobile-details-section details-section",style:{padding:"0 30px",margin:"15px 0",paddingBottom:"120px"}},e.createElement("h2",{className:"yt-byob-modal-mobile-title",style:{margin:"0px"}},"variant-display-name"===r?.styles?.byob?.productVariantTitleType?l?.selectedVariant?.displayName:"variant-title"===r?.styles?.byob?.productVariantTitleType?l?.selectedVariant?.title:l?.title),e.createElement(U,{className:"yt-byob-modal-mobile-rating"}),e.createElement("div",{className:"yt-byob-modal-mobile-divider",style:{opacity:"0.2",border:"none",height:"2px",backgroundColor:"#000000",margin:"10px 0px",display:"block !important"}},e.createElement("span",null)),e.createElement("div",{className:"yt-byob-modal-mobile-description yt-description-content",style:{scrollbarWidth:"none",scrollBehavior:"smooth",margin:"0px"},dangerouslySetInnerHTML:{__html:I}})))),e.createElement("div",{className:"yt-byob-modal-mobile-bottom-bar",style:{position:"fixed",bottom:"0px",left:"0px",right:"0px",padding:"12px 15px",borderTop:"1px solid lightgray",boxShadow:"0px -4px 5px rgba(0, 0, 0, 0.1)",backgroundColor:"#fff",display:"flex",flexDirection:"column",gap:"2px",zIndex:9999999999}},"dropdown"===r?.styles?.byob.variantSelectorType&&e.createElement(X,{className:"yt-byob-modal-desktop-variant-selector"}),"customOptions"===r?.styles?.byob.variantSelectorType&&e.createElement(Z,{isMobile:!0}),e.createElement("div",{className:"yt-byob-modal-mobile-price-atc-wrapper",style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"}},e.createElement(K,{isMobile:!0}),e.createElement(J,{isMobile:!0})))));return D.createPortal(x?te:ee,document.body)}),Fc=({coverImageUrl:t,mobileCoverImageUrl:n,alt:o="Background",styles:r})=>{const i=[{imageWidth:21,descriptor:36},{imageWidth:48,descriptor:80},{imageWidth:99,descriptor:165},{imageWidth:216,descriptor:360},{imageWidth:225,descriptor:375},{imageWidth:319,descriptor:533},{imageWidth:330,descriptor:550},{imageWidth:432,descriptor:720},{imageWidth:564,descriptor:940},{imageWidth:639,descriptor:1066},{imageWidth:648,descriptor:1080},{imageWidth:900,descriptor:1500},{imageWidth:1068,descriptor:1780},{imageWidth:1296,descriptor:2160}],a=(e,t)=>{if(e&&e.includes("cdn.shopify"))try{const n=new URL(e),o=n.searchParams;return o.has("format")||o.set("format","webp"),o.has("quality")||o.set("quality","80"),o.set("width",t.toString()),n.toString()}catch{const n=e.includes("?")?"&":"?";return`${e}${n}format=webp&quality=80&width=${t}`}},l=e=>e?i.map(({imageWidth:t,descriptor:n})=>{const o=a(e,t);return o?`${o} ${n}w`:""}).filter(Boolean).join(", "):"";if(!t&&!n)return null;const c=t||n||"",d=a(c,800)||c,s=[];if(n&&n!==t){const t=l(n);t&&s.push(e.createElement("source",{key:"mobile",media:"(max-width: 768px)",srcSet:t}))}if(t){const n=l(t);n&&(s.length>0?s.push(e.createElement("source",{key:"desktop",media:"(min-width: 769px)",srcSet:n})):s.push(e.createElement("source",{key:"desktop",srcSet:n})))}else if(n){const t=l(n);t&&s.push(e.createElement("source",{key:"mobile",srcSet:t}))}return e.createElement("div",{style:{width:"100%",display:"block"}},e.createElement("picture",{style:{display:"block",width:"100%"}},s,e.createElement("img",{src:d,alt:o,style:{width:"100%",height:"auto",display:"block",...r},loading:"eager",fetchPriority:"high",sizes:"100vw"})))},Nc=({title:t,isOpen:n,onToggle:o,children:r})=>e.createElement("div",{className:"yt-byob-filter-section",style:{borderBottom:"1px solid #eee",paddingBottom:n?"20px":"12px",marginBottom:"12px"}},e.createElement("div",{className:"yt-byob-filter-section-header",onClick:o,style:{display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",padding:"8px 0"}},e.createElement("span",{className:"yt-byob-filter-section-title",style:{fontSize:"16px",fontWeight:500,color:"#111"}},t),n?e.createElement(_e,{className:"yt-byob-icon-minus",size:20}):e.createElement(Ne,{className:"yt-byob-icon-plus",size:20})),n&&e.createElement("div",{className:"yt-byob-filter-section-body",style:{marginTop:"16px"}},r)),Pc=({availableFilters:n,appliedFilters:o,toggleFilter:r,clearAllFilters:i,applyPriceFilter:a,priceMin:l,setPriceMin:c,priceMax:d,setPriceMax:s,maxPossiblePrice:p,styles:u,availableProductCount:m,products:g,unavailableProductCount:x,storeCurrencyCode:f,showActions:y=!0,openSections:b,toggleSection:h})=>{const[v,w]=t(null),C=$p(u?.general?.currencySymbol,f)??"₹";return e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-filters-content-wrapper",style:{overflowY:"auto",scrollbarWidth:"none",padding:"20px",flex:1,minHeight:0,overscrollBehavior:"contain"}},n.map(t=>e.createElement(Nc,{key:t.id,title:t.label,isOpen:!!b[t.id],onToggle:()=>h(t.id)},"LIST"===t.type&&e.createElement("div",{className:"yt-byob-filter-list",style:{display:"flex",flexDirection:"column",gap:"14px"}},t.values.map(n=>{const i=o[t.id]?.includes(n.id)||!1,a="filter.v.availability.1"===n.id?m??g.length:"filter.v.availability.0"===n.id?x??0:n.count;return e.createElement("label",{key:n.id,className:"yt-byob-filter-item-label",style:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer"}},e.createElement("div",{className:"yt-byob-filter-item-left",style:{display:"flex",alignItems:"center",gap:"10px"}},e.createElement("input",{className:"yt-byob-filter-checkbox",type:"checkbox",checked:i,onChange:()=>r(t.id,n.id),style:{width:"18px",height:"18px",accentColor:u?.general?.primaryColor||"#333",cursor:"pointer"}}),e.createElement("span",{className:"yt-byob-filter-item-text",style:{fontSize:"15px",color:"#333"}},n.label)),e.createElement("span",{className:"yt-byob-filter-item-count",style:{fontSize:"12px",background:"#f3f4f6",padding:"2px 8px",borderRadius:"4px",color:"#666",minWidth:"24px",textAlign:"center"}},a))})),"PRICE_RANGE"===t.type&&e.createElement("div",{className:"yt-byob-price-filter",style:{padding:"0 4px"}},e.createElement("div",{className:"yt-byob-price-range-display",style:{fontSize:"15px",color:"#333",marginBottom:"24px",fontWeight:500}},C,l.toLocaleString()," – ",C,d.toLocaleString(),d>=p?"+":""),e.createElement("div",{className:"yt-byob-price-slider-container",style:{position:"relative",width:"100%",height:"4px",background:"#e5e7eb",borderRadius:"4px",marginBottom:"10px"}},e.createElement("div",{className:"yt-byob-price-slider-track",style:{position:"absolute",height:"100%",background:"#333",borderRadius:"4px",left:l/p*100+"%",right:100-d/p*100+"%"}}),e.createElement("input",{type:"range",min:0,max:p,value:l,onMouseDown:()=>w("min"),onTouchStart:()=>w("min"),onChange:e=>{const t=Math.min(Number(e.target.value),d-10);c(t)},style:{position:"absolute",width:"100%",height:"0px",top:"50%",transform:"translateY(-50%)",background:"none",pointerEvents:"none",appearance:"none",WebkitAppearance:"none",zIndex:"min"===v?11:5,margin:0},className:"yt-byob-dual-range-input-min"}),e.createElement("input",{type:"range",min:0,max:p,value:d,onMouseDown:()=>w("max"),onTouchStart:()=>w("max"),onChange:e=>{const t=Math.max(Number(e.target.value),l+10);s(t)},style:{position:"absolute",width:"100%",height:"0px",top:"50%",transform:"translateY(-50%)",background:"none",pointerEvents:"none",appearance:"none",WebkitAppearance:"none",zIndex:"max"===v?11:4,margin:0},className:"yt-byob-dual-range-input-max"})),e.createElement("style",null,"\n .yt-byob-dual-range-input-min::-webkit-slider-thumb,\n .yt-byob-dual-range-input-max::-webkit-slider-thumb {\n pointer-events: auto;\n appearance: none;\n width: 22px;\n height: 22px;\n border-radius: 50%;\n background: #444;\n border: 3px solid white;\n cursor: pointer;\n box-shadow: 0 2px 5px rgba(0,0,0,0.2);\n position: relative;\n z-index: 20;\n }\n .yt-byob-dual-range-input-min::-moz-range-thumb,\n .yt-byob-dual-range-input-max::-moz-range-thumb {\n pointer-events: auto;\n width: 22px;\n height: 22px;\n border-radius: 50%;\n background: #444;\n border: 3px solid white;\n cursor: pointer;\n box-shadow: 0 2px 5px rgba(0,0,0,0.2);\n position: relative;\n z-index: 20;\n }\n "))))),y&&e.createElement("div",{className:"yt-byob-filter-actions",style:{display:"flex",gap:"12px",borderTop:"1px solid #eee",padding:"16px 0px",position:"sticky",bottom:"2px",paddingInline:"10px"}},e.createElement("button",{className:"yt-byob-filter-clear-button",onClick:i,style:{flex:1,padding:"8px",background:"#f3f4f6",border:"none",borderRadius:u?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px",color:"#333",fontFamily:"inherit"}},"Clear All"),e.createElement("button",{className:"yt-byob-filter-apply-button",onClick:a,style:{flex:1,padding:"8px",background:u?.general?.primaryColor||"#333",color:"white",border:"none",borderRadius:u?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px",fontFamily:"inherit"}},"Apply")))},Dc=t=>{const{showFiltersDrawer:n,handleClose:o,isAnimating:r,isMobile:i}=t;return n?A(e.createElement("div",{className:"yt-byob-filter-drawer-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:1e3,display:"flex",justifyContent:"flex-end",opacity:r?1:0,transition:"opacity 300ms ease-in-out"},onClick:o},e.createElement("div",{className:"yt-byob-filter-drawer-content",style:{width:i?"85%":"380px",height:"100%",background:"white",boxShadow:"-4px 0 12px rgba(0,0,0,0.15)",transform:r?"translateX(0)":"translateX(100%)",transition:"transform 300ms ease-in-out",display:"flex",flexDirection:"column",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement(Pc,{...t,applyPriceFilter:()=>{t.applyPriceFilter(),o()},openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})}))),document.body):null},Ac=t=>{const{showFiltersDrawer:n}=t;return n&&0!==t?.availableFilters?.length?e.createElement("div",{className:"yt-byob-filters-sidebar",style:{width:"280px",minWidth:"280px",padding:"0",height:"auto",maxHeight:"calc(100vh - 40px)",position:"sticky",top:"20px",display:"flex",flexDirection:"column",borderRight:"1px solid #eee",marginRight:"20px"}},e.createElement(Pc,{...t,showActions:!0,openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})})):null},_c=({enableSortAndFilter:o,isMobile:r,setSearchTerm:i,searchTerm:a,styles:l,setSortBy:c,appliedFilters:d,setAppliedFilters:s,availableFilters:p=[],products:u,availableProductCount:m,unavailableProductCount:g,maxPossiblePrice:x,storeCurrencyCode:f,sharedFiltersState:b,openSections:h,toggleSection:v,sortBy:w})=>{const[C,E]=t(!1),[k,T]=t(a),{showFilters:S,setShowFilters:$,priceMax:B,setPriceMax:I,priceMin:z,setPriceMin:F}=b,[N,P]=t(!1),D=l?.byob?.productFiltersDisplay||"drawer",A=!r&&"sidebar"===D,_="none"===D;n(()=>{d["filter.v.price"]||(I(x),F(0))},[x,d]);n(()=>{const e=setTimeout(()=>{i(k)},300);return()=>clearTimeout(e)},[k,i]),n(()=>(S&&!A?(document.body.style.overflow="hidden",P(!0)):(document.body.style.overflow="",P(!1)),()=>{document.body.style.overflow=""}),[S,A]);const R=Object.entries(d).reduce((e,[t,n])=>"filter.v.price"===t?z>0||B<x?e+1:e:e+(n?n.length:0),0);return e.createElement("div",{className:"yt-byob-sort-filter-container",style:{display:"flex",flexDirection:r?"column":"row",justifyContent:"space-between",alignItems:r?"flex-end":"center",marginBottom:"20px",width:"100%",gap:r?"10px":"0"}},e.createElement("div",{className:"yt-byob-search-filter-controls",style:{display:"flex",flexDirection:o?"row-reverse":"row",justifyContent:"space-between",alignItems:C?void 0:"center",gap:"12px",width:"100%"}},o&&e.createElement("div",{className:"yt-byob-search-wrapper",style:{position:"relative",display:"flex",alignItems:"center",width:r?C?"100%":"auto":"400px",transition:"width 0.3s ease-in-out"}},r&&!C?e.createElement(Pe,{className:"yt-byob-search-icon-trigger",fontSize:"20px",color:"#555",style:{cursor:"pointer"},onClick:()=>E(!0)}):e.createElement(e.Fragment,null,e.createElement("input",{className:"yt-byob-search-input",style:{width:"100%",padding:r?"10px 12px":"10px 14px",fontSize:"14px",outline:"none",color:"#333",border:"1px solid #c7c7c7",borderRadius:l?.byob.borderRadius,boxShadow:l?.byob.borderColor?"0 2px 4px rgba(0,0,0,0.1)":"none"},placeholder:"Search by Product Name",value:k,onChange:e=>T(e.target.value)}),!C&&e.createElement(Pe,{className:"yt-byob-search-icon",fontSize:"18px",style:{position:"absolute",right:"12px",color:"#aaa",pointerEvents:"none"}})),r&&C&&e.createElement("span",{className:"yt-byob-search-close",style:{position:"absolute",right:"12px",color:"#aaa",fontSize:"16px",cursor:"pointer"},onClick:()=>E(!1)},"X")),e.createElement("div",{className:"yt-byob-actions-wrapper",style:{display:"flex",flexDirection:"row",gap:"10px"}},p?.length>0&&e.createElement("button",{className:"yt-byob-filter-toggle-button",onClick:()=>$(!S),style:{display:_?"none":"flex",alignItems:"center",gap:r?"0px":"6px",background:S&&A?"#f3f4f6":"white",cursor:"pointer",fontSize:"14px",color:"#333",whiteSpace:"nowrap",border:"1px solid #d1d5db",padding:"8px 12px",borderRadius:l?.byob.borderRadius,boxShadow:"0 2px 4px rgba(0,0,0,0.1)"}},e.createElement(De,{className:"yt-byob-filter-toggle-icon",size:18}),!r&&"Filters",R>0&&e.createElement("span",{className:"yt-byob-active-filter-badge",style:{background:l?.general?.primaryColor||"#ef4444",color:"white",borderRadius:"999px",padding:"2px 8px",fontSize:"12px",lineHeight:1}},R)),o&&e.createElement("div",{className:"yt-byob-sort-wrapper",style:{display:"flex",alignItems:"center",border:"1px solid #d1d5db",padding:"8px 12px",borderRadius:l?.byob.borderRadius,boxShadow:"0 2px 4px rgba(0,0,0,0.1)",position:"relative"}},!r&&e.createElement("span",{className:"yt-byob-sort-label",style:{fontSize:"14px",color:"#555",marginRight:"6px"}},"Sort:"),r&&e.createElement(Ae,{className:"yt-byob-sort-icon",size:18,style:{color:"#555"}}),e.createElement("select",{className:"yt-byob-sort-select",style:{border:"none",background:"transparent",fontSize:"14px",color:"#333",cursor:"pointer",outline:"none",appearance:"none",WebkitAppearance:"none",paddingRight:"20px"},value:w,onChange:e=>c(e.target.value)},e.createElement("option",{className:"yt-byob-sort-option",value:""},"Featured"),e.createElement("option",{className:"yt-byob-sort-option",value:"price-low-to-high"},"Price: Low to High"),e.createElement("option",{className:"yt-byob-sort-option",value:"price-high-to-low"},"Price: High to Low"),e.createElement("option",{className:"yt-byob-sort-option",value:"title-asc"},"Alphabetical: A-Z"),e.createElement("option",{className:"yt-byob-sort-option",value:"title-desc"},"Alphabetical: Z-A")),e.createElement(y,{className:"yt-byob-sort-chevron",size:14,style:{position:"absolute",right:"10px",pointerEvents:"none",color:"#555"}})))),!A&&!_&&e.createElement(Dc,{showFiltersDrawer:S,handleClose:()=>{A?$(!1):(document.body.style.overflow="",P(!1),setTimeout(()=>{$(!1)},300))},isAnimating:N,isMobile:r,availableFilters:p,appliedFilters:d,toggleFilter:(e,t)=>{s(n=>{const o=n[e]||[],r=o.includes(t)?o.filter(e=>e!==t):[...o,t],i={...n,[e]:r.length?r:void 0};return Object.fromEntries(Object.entries(i).filter(([,e])=>void 0!==e))})},clearAllFilters:()=>{I(x),F(0),s({})},applyPriceFilter:()=>{s(e=>{const t={...e};return t["filter.v.price"]=[`min:${z}-max:${B}`],t})},priceMin:z,setPriceMin:F,priceMax:B,setPriceMax:I,maxPossiblePrice:x,styles:l,availableProductCount:m,products:u,unavailableProductCount:g,storeCurrencyCode:f,openSections:h,toggleSection:v}))};function Rc({quantity:t,setQuantity:n,remainingQuantity:o,handleAddToBundle:r,variantId:i,product:a,handleRemoveItem:l,hideAddToBundle:c,selectedVariantInventoryQty:d}){const s={display:"flex",alignItems:"center",justifyContent:"center",width:"33%",cursor:"pointer",backgroundColor:"#f2f2f2",userSelect:"none",border:"none",padding:"8px",margin:"0",fontSize:"20px",color:"#333",textDecoration:"none",boxShadow:"none",outline:"none",borderRadius:"0",boxSizing:"border-box"},p=t<d;return e.createElement(zl,{className:"yt-byob-quantity-selector-container"},e.createElement("button",{className:"yt-byob-quantity-minus-button",onClick:e=>{e.stopPropagation();const o=Math.max(0,t-1);n(o),l&&i&&l(i,1)},style:s},"-"),e.createElement(Fl,{className:"yt-byob-quantity-display"},t," added"),e.createElement("button",{className:"yt-byob-quantity-plus-button",onClick:e=>{e.stopPropagation();const l=Math.min(o,t+1,d);n(l),r&&i&&a&&r(i,a,1)},disabled:!p||c,style:{...s,cursor:!p||c?"not-allowed":"pointer",opacity:!p||c?.6:1}},"+"))}const Oc=({product:r,styles:i,selectedVariant:a})=>{const[l,c]=t(!1),d=o(()=>Bp(a?.image?.url||r?.featuredMedia?.preview?.image?.url||r?.media?.edges?.[0]?.node?.image?.url)||"",[a?.image?.url,r?.featuredMedia?.preview?.image?.url,r?.media?.edges]),s=o(()=>r?.media?.edges?.map(e=>Bp(e?.node?.preview?.image?.url??e?.node?.image?.url)).filter(Boolean)??[],[r?.media?.edges]),p=o(()=>s?.[1]??d??"",[s,d]);n(()=>{if(d){(new Image).src=d}},[d]);const u=o(()=>d||s?.[0],[d,s]);return e.createElement("div",{className:"yt-byob-image-hover-container",style:{position:"relative",width:"100%",overflow:"hidden",aspectRatio:i.general.imageAspectRatio||"1/1"},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1)},e.createElement("div",{className:"yt-byob-image-inner-container",style:{width:"100%",height:"100%",position:"relative"}},e.createElement("img",{className:"yt-byob-image-main",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",objectPosition:"top",opacity:l&&u!==p?0:1,transition:s?.length>0?"opacity 300ms ease, transform 300ms ease":"",transform:l?"scale(1.1)":"scale(1)"},src:u,alt:r.title}),u!==p&&e.createElement("img",{className:"yt-byob-image-hover",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",opacity:l?1:0,transition:"opacity 400ms ease, transform 400ms ease",transform:l?"scale(1.1)":"scale(1)",position:"absolute",top:0,left:0,objectPosition:"top"},src:p,alt:r.title})))},Lc=({product:o,bundle:r,handleAddToBundle:a,hideAddToBundle:l,remainingQuantity:c,themeColor:d,handleRemoveItem:s,transitionActive:p,idx:u,selecteditems:m,customVariantsQuantity:g,currentProductTier:x,showFreebieTierProductPrices:f,tierIndex:b})=>{const h=le(Ec),v=r.customizations,w=v?.byob?.variantSelectorType,[C,E]=t(!1),k=v.general?.variantTitleSuffix?o?.variants?.edges:(e=>{if(!e||e.length<2)return e;const t=e.map(e=>e.node.title).map(e=>e.split(" "));let n=[...t[0]];for(let e=1;e<t.length;e++){const o=t[e];let r=0;for(;r<n.length&&r<o.length&&n[n.length-1-r]===o[o.length-1-r];)r++;n=n.slice(n.length-r)}return n.length<1?e:e.map(e=>{const t=e.node.title.split(" "),o=t.slice(0,t.length-n.length).join(" ");return{...e,node:{...e.node,title:o,commonSuffix:n.join(" ")}}})})(o?.variants?.edges);if(!k||!k.length)return e.createElement(e.Fragment,null);const T=i(e=>{const t=g?.find(t=>t.variantId===e)?.quantity;if(void 0!==t)return t;if(r?.customProductsQuantity)return r?.customProductsQuantity;const n=k?.find(t=>t.node.id===e),i=n?.node;return i?o.tracksInventory&&i.inventoryItem?.tracked?i.inventoryQuantity>0?i.inventoryQuantity:i.inventoryQuantity<=0&&"continue"===i.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[k,g,o.tracksInventory]),S=k?.find(e=>T(e.node.id)>0)?.node?.id;if(!S&&!v.general.showOutOfStockProducts)return e.createElement(e.Fragment,null);const[$,B]=t(k?.find(e=>T(e.node.id)>0)?.node?.id||k[0]?.node?.id),[I,z]=t(0),[F,N]=t(window.innerWidth<450),[P,D]=t("normal"),A=k?.find(e=>e?.node?.id===$)?.node,_=T($||"");n(()=>{const e=m.find(e=>e.variantId===$&&(void 0===b||e.tierIndex===b));z(e?e.quantity:0)},[m,$,b]),n(()=>{const e=()=>{N(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{CSS.supports("font-weight","500")?D("500"):CSS.supports("font-weight","400")?D("400"):CSS.supports("font-weight","600")&&D("600")},[]),n(()=>{document.documentElement.style.setProperty("--yt-bundle-font-weight",P)},[P]),n(()=>{if($&&!k?.some(e=>e.node.id===$)){const e=k.find(e=>T(e.node.id)>0)?.node.id||k[0]?.node?.id;e&&B(e)}},[$,k,T]);const R=o.variants&&o.variants.edges?.length>1&&"customOptions"!==w,O="undefined"!=typeof window?(window?.ytapp||window?.ytBundleApp)?.storeId:void 0,L="53933408435"===O,M="75851235630"===O,j=(e=>{if(e.metafield&&"yourtoken_bundles_app"===e.metafield.namespace&&"categories"===e.metafield.key){if(e.metafield.jsonValue&&Array.isArray(e.metafield.jsonValue))return e.metafield.jsonValue;if(e.metafield.value)try{const t=JSON.parse(e.metafield.value);if(Array.isArray(t))return t}catch(e){console.error("Failed to parse categories:",e)}}return[]})(o),V=j.length>0;return e.createElement(e.Fragment,null,e.createElement(Dl,{borderRadius:v?.byob.borderRadius,borderColor:v?.byob.borderColor,shadowType:v?.byob.shadowType,backgroundColor:v?.byob.cardBackgroundColor,className:"yt-byob-product-container bundle-builder-product-container "+(p?"yt-product-card-transition-active":u%2==0?"yt-product-card-transition":"yt-product-card-transition-up"),onClick:()=>{if(_<=0)return;const e={...o,variants:{...o.variants,edges:k},selectedVariant:A};h(e)},onMouseEnter:e=>{e.currentTarget.style.transform="scale(1.01)"},onMouseLeave:e=>{e.currentTarget.style.transform="scale(1)"},style:{WebkitTapHighlightColor:"transparent",textAlign:v?.byob?.productCardDetailsAlignment||"left"}},e.createElement(Al,{className:"yt-byob-image-wrapper"},e.createElement(Oc,{product:o,styles:v,selectedVariant:A}),r?.productCardBadgeText&&e.createElement("div",{className:"yt-byob-product-badge",style:{position:"absolute",top:"0px",left:"0px",backgroundColor:v?.general.primaryColor||"#111",color:v?.general.primaryContrastColor||"#fff",zIndex:1,margin:"0px",whiteSpace:"pre",padding:"4px 8px",fontSize:"12px",borderTopLeftRadius:v.byob.borderRadius}},r.productCardBadgeText),R&&e.createElement("div",{className:"yt-byob-variant-selector-wrapper",style:{position:"relative",width:"100%"}},e.createElement(_l,{className:"yt-byob-variant-selector",isCoralHaze:L,onClick:e=>{e.preventDefault(),e.stopPropagation()},value:$||"",onChange:e=>{e.stopPropagation(),e.preventDefault(),B(e.target.value)}},k?.map(t=>{const n=window.innerWidth<=320?10:window.innerWidth<=420?15:22,o=t.node.title.length>n?t.node.title.substring(0,n)+"...":t.node.title;return e.createElement("option",{key:t.node.id,value:t.node.id},o)})),e.createElement("div",{className:"yt-byob-variant-chevron",style:{position:"absolute",right:"16px",bottom:"10px",pointerEvents:"none"}},e.createElement(y,null)))),e.createElement("div",{className:"yt-byob-product-content"},"enabled"===r?.customizations?.byob?.productCardCategoryVisibility&&V&&e.createElement("div",{className:"yt-byob-product-categories-wrapper",style:{padding:"2px 4px"}},e.createElement("div",{className:"yt-byob-product-categories",style:{display:"flex",flexWrap:"wrap",gap:"4px"}},j.slice(0,2).map((t,n)=>e.createElement("span",{className:"yt-byob-category-tag",key:n,style:{fontSize:F?"8px":"12px",color:"#666",fontWeight:"500"}},t.charAt(0).toUpperCase()+t.slice(1))),j.length>2&&e.createElement("span",{className:"yt-byob-more-categories",style:{fontSize:"10px",padding:"2px 6px",backgroundColor:"rgba(0, 0, 0, 0.05)",borderRadius:"8px",color:"#666",fontWeight:"500"}},"+",j.length-2," more"))),e.createElement(Rl,{isMobile:F,showBorder:r?.showBorder??!0,style:{...!v?.byob.productsPriceVisibility&&{padding:"8px"},...v?.byob.productTitleFontSize&&{fontSize:v?.byob.productTitleFontSize||"18px"}},className:"yt-byob-product-title-wrapper"},e.createElement("div",{style:{display:"-webkit-box",WebkitLineClamp:v?.byob?.productTitleWrapLines||2,WebkitBoxOrient:"vertical",overflow:"hidden",lineHeight:"normal"},className:"yt-byob-product-title"},M?String(A?.displayName).replace("- Default Title",""):o.title,A?.commonSuffix?" -"+A?.commonSuffix:""))),"Default Title"!==A?.title&&v?.byob?.showVariantTitleInCard&&e.createElement("p",{style:{padding:r?.showBorder??1?"0px 10px":"0 4px",fontSize:"12px",margin:"0",fontWeight:"600",color:"#888",lineHeight:"normal"},className:"yt-byob-product-variant-title"},A?.title),"ratingOnly"===r?.reviewRatingType&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(Se,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6}},o?.rating?.averageRating," rating")),"ratingAndReviewCount"===r?.reviewRatingType&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(Se,{color:"gold",size:14})," ",o?.rating?.averageRating,e.createElement(he,{className:"yt-byob-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",o?.rating?.ratingCount," reviews)"),v?.byob.productsPriceVisibility&&e.createElement("div",{className:"yt-byob-product-price yt-bundle-builder-product-price",style:{marginBottom:"5px",padding:r?.showBorder?"0px 10px":"0 4px"}},x?.isFreebieTier&&!f?e.createElement(e.Fragment,null,e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"14px",textDecoration:"line-through",color:"#888",marginRight:"6px"}},$p(v.general.currencySymbol,r?.storeCurrencyCode)??"Rs.",Sp(A?.price)),e.createElement("span",{className:"yt-byob-current-price",style:{color:v.general.primaryColor||"#d32f2f",fontWeight:"bold"}},"FREE")):parseFloat(A?.price??"0")>0?e.createElement("span",{className:"yt-byob-current-price"},$p(v.general.currencySymbol,r?.storeCurrencyCode)??"Rs.",Sp(A?.price)):e.createElement("span",{className:"yt-byob-free-price"},"Free"),(!x?.isFreebieTier||f)&&A?.compareAtPrice&&v?.byob.compareAtPriceVisibility&&parseFloat(A.compareAtPrice)>parseFloat(A?.price)&&e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"14px"}},$p(v.general.currencySymbol,r?.storeCurrencyCode)??"Rs.",Sp(A.compareAtPrice))),(_>0||_===1/0)&&e.createElement(Ol,{borderRadius:v?.byob.borderRadius,className:"yt-byob-add-to-bundle-wrapper yt-product-atc-wrapper"},(0===I||void 0===I)&&e.createElement(Nl,{style:{...!l&&{backgroundColor:v?.general.primaryColor||"#111",color:v?.general.primaryContrastColor||"#fff"}},disabled:l,onClick:e=>{e.stopPropagation(),e.preventDefault(),z(1),(()=>{if(!$)return;"customOptions"===w&&k.length>1?E(!0):a($,o,1)})()},className:"yt-byob-add-to-bundle-button yt-product-atc-button"},v?.byob.addToBundleCTAText),!r?.disableQuantitySelector&&I>0&&$&&e.createElement(Pl,{className:"yt-byob-quantity-selector-container visible",style:{overflow:"hidden"}},e.createElement(Rc,{remainingQuantity:c,setQuantity:z,quantity:I,handleAddToBundle:a,variantId:$,product:o,handleRemoveItem:s,hideAddToBundle:l,selectedVariantInventoryQty:_})),r?.disableQuantitySelector&&I>0&&$&&e.createElement(Nl,{style:{backgroundColor:"#747474",color:v?.general.primaryContrastColor||"#fff",display:"flex",justifyContent:"space-between",overflow:"hidden",height:"40px"},className:"yt-byob-added-button yt-product-atc-single-qty-selector"},e.createElement(Ll,{className:"yt-byob-added-text yt-product-atc-single-qty-selector-added"},"ADDED"),e.createElement(Ml,{className:"yt-byob-single-qty-remove yt-product-atc-single-qty-selector-remove",onClick:e=>{e.stopPropagation();const t=Math.max(0,I-1);z(t),s&&$&&s($,b)}},e.createElement(Re,{style:{color:"#fff",fontSize:"20px"}})))),_<=0&&_!==1/0&&e.createElement(Nl,{style:{backgroundColor:v.general.disabledButtonColor,color:"#fff",cursor:"not-allowed",transition:"transform 0.2s ease-in-out"},className:"yt-product-atc-disabled"},v?.general.outOfStockLabel||"Out of Stock")),"customOptions"===w&&C&&k.length>1&&e.createElement(Ic,{product:o,isOpen:C,onClose:()=>E(!1),variantOptions:r.variantOptions,cta:{textColor:v.general.ctaTextColor,backgroundColor:v.general.primaryColor},onConfirm:e=>{B(e),a(e,o,1)}}))},Mc=({currentStep:t,setCurrentProductTier:n,totalSteps:o,tiers:r,isMobile:i,selectedProductsByTier:a,primaryColor:l="#000",primaryTextColorCta:c="#fff",tierNavigation:d})=>e.createElement("div",{className:"yt-byob-stepper-container",style:{textAlign:"center",fontSize:"20px"}},e.createElement("div",{className:"yt-byob-stepper-steps",style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"center"}},Array.from({length:o}).map((c,s)=>{const p=s+1,u=r[s].minimumQuantity-(a[s]?.length??0)===0,m=s===t;return l="black"===l?"#000000":l,e.createElement(e.Fragment,{key:p},e.createElement("div",{className:"yt-byob-stepper-step-wrapper",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:"pointer",gap:i?"4px":"8px"},onClick:()=>!1===d?()=>{}:n(p-1)},e.createElement("div",{className:"yt-byob-stepper-step-number",style:{fontSize:"14px"}},"Step ",p),e.createElement("div",{className:"yt-byob-stepper-step-bar",style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"center",cursor:"pointer"}},e.createElement("div",{className:"yt-byob-stepper-step-left-bar",style:{height:"3px",width:i?"30px":"50px",backgroundColor:u?l:m?"#666666":"#CBD5E0",display:"block",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px"}}),e.createElement("div",{className:"yt-byob-stepper-step-circle",style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:u?`${l}50`:"white",border:`2px solid ${u?l:m?"#666666":"#CBD5E0"}`,display:"flex",alignItems:"center",justifyContent:"center"}}),e.createElement("div",{className:"yt-byob-stepper-step-right-bar",style:{height:"3px",width:i?"30px":"50px",backgroundColor:u?l:m?"#666666":"#CBD5E0",display:"block",marginRight:s<o?i?"4px":"6px":"",borderTopRightRadius:"5px",borderBottomRightRadius:"5px"}}))))})),e.createElement("div",{className:"yt-byob-stepper-title",style:{margin:i?"16px 0px":"15px 0px",fontSize:i?"16px":"18px",padding:"4px",background:"rgba(0, 0, 0, 0.03)",borderBottom:"1px solid rgba(130, 130, 130, 0.28)"}},r[t]?.title)),jc=({styles:t,isMobile:n,categories:o,activeCategory:r,onCategoryChange:i})=>{const a=e=>{i(e)},l=(e,t)=>{const n=e.replace("#","");return`rgba(${parseInt(n.substring(0,2),16)}, ${parseInt(n.substring(2,4),16)}, ${parseInt(n.substring(4,6),16)}, ${t})`};return"tabs"===t?.byob?.categoryFilterOnPage?e.createElement("div",{className:"yt-byob-category-filter-wrapper",style:{overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",width:"100%"}},e.createElement("div",{className:"yt-byob-category-tabs-container",style:{display:"flex",gap:"0px",minWidth:"max-content",paddingBottom:"1px",flexWrap:"nowrap",justifyContent:"center",borderBottom:"1px solid #e0e0e0",width:"auto",height:n?"28px":"45px"}},["All",...o].map(o=>{const i=r===o;return e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-byob-category-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:i?"600":"400",color:i?t.general.primaryColor:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:i?l(t.general.primaryColor,.07):"transparent",borderBottom:i?`2px solid ${t?.general.primaryColor}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:e=>{i||(e.currentTarget.style.color=t?.general.primaryColor)},onMouseLeave:e=>{i||(e.currentTarget.style.color="#666")}},e.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},o.charAt(0).toUpperCase()+o.slice(1)),e.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},o.charAt(0).toUpperCase()+o.slice(1)))}))):e.createElement("div",{className:"yt-byob-category-filter-wrapper",style:{overflowX:n?"auto":"visible",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",paddingBottom:"5px"}},e.createElement("div",{className:"yt-byob-category-buttons-container",style:{display:"flex",gap:"8px",minWidth:"max-content",flexWrap:"nowrap",justifyContent:"center",paddingRight:n?"10px":"0px"}},["All",...o].map(o=>e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-byob-category-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${r===o?t?.general.primaryColor:"#e0e0e0"}`,borderRadius:t?.general.ctaBorderRadius,backgroundColor:r===o?t?.general.primaryColor:"white",color:r===o?"white":"#333",cursor:"pointer",transition:"all 0.3s ease",outline:"none",whiteSpace:"nowrap",minWidth:"fit-content",flexShrink:0},onMouseEnter:e=>{r!==o&&(e.currentTarget.style.borderColor=t?.general.primaryColor,e.currentTarget.style.color=t?.general.primaryColor)},onMouseLeave:e=>{r!==o&&(e.currentTarget.style.borderColor="#e0e0e0",e.currentTarget.style.color="#333")}},o.charAt(0).toUpperCase()+o.slice(1)))))},Vc=(e,t)=>{const n=[],o=e=>!t||0===t.length||t.includes(e);let r=0,i=0;e.forEach(e=>{const t=e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id)),n=t?.some(e=>e.node.availableForSale);n?r++:i++}),o("Availability")&&n.push({id:"filter.v.availability",label:"Availability",type:"LIST",values:[{id:"filter.v.availability.1",label:"In stock",count:r,input:'{"available":true}'},{id:"filter.v.availability.0",label:"Out of stock",count:i,input:'{"available":false}'}]});let a=0;e.forEach(e=>{const t=e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id));t?.forEach(e=>{const t=parseFloat(e.node.price);t>a&&(a=t)})}),o("Price")&&n.push({id:"filter.v.price",label:"Price",type:"PRICE_RANGE",values:[{id:"filter.v.price",label:"Price",count:e.length,input:JSON.stringify({price:{min:0,max:a}})}]});const l={};e.forEach(e=>{const t=e.productDetails.productType;t&&(l[t]=(l[t]||0)+1)}),Object.keys(l).length>0&&o("Product Type")&&n.push({id:"filter.p.product_type",label:"Product Type",type:"LIST",values:Object.entries(l).map(([e,t])=>({id:`filter.p.product_type.${e}`,label:e,count:t,input:JSON.stringify({productType:e})}))});const c={};e.forEach(e=>{const t=e.productDetails.vendor;t&&(c[t]=(c[t]||0)+1)}),Object.keys(c).length>0&&o("Vendor")&&n.push({id:"filter.p.vendor",label:"Vendor",type:"LIST",values:Object.entries(c).map(([e,t])=>({id:`filter.p.vendor.${e}`,label:e,count:t,input:JSON.stringify({vendor:e})}))});const d={};e.forEach(e=>{e.productDetails.tags?.forEach(e=>{e&&(d[e]=(d[e]||0)+1)})}),Object.keys(d).length>0&&o("Tags")&&n.push({id:"filter.p.tag",label:"Tag",type:"LIST",values:Object.entries(d).map(([e,t])=>({id:`filter.p.tag.${e}`,label:e,count:t,input:JSON.stringify({tag:e})}))});const s={};return e.forEach(e=>{(e.productDetails.options||[]).forEach((t,n)=>{if("Title"===t.name)return;s[t.name]||(s[t.name]={});const o=e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id))||[];t.values?.forEach(e=>{void 0===s[t.name][e]&&(s[t.name][e]=0);o.some(t=>(t.node.title.split(" / ")[n]||t.node.title).toLowerCase()===e.toLowerCase())&&s[t.name][e]++})})}),o("Variant Options")&&Object.entries(s).forEach(([e,t])=>{const o=Object.entries(t).filter(([e,t])=>t>0).map(([t,n])=>({id:`${e.toLowerCase()}.${t}`,label:t,count:n,input:JSON.stringify({variantOption:{name:e,value:t}})}));o.length>0&&n.push({id:`filter.v.option.${e.toLowerCase()}`,label:e,type:"LIST",values:o})}),n},Wc=({bundle:a,selectedItems:l,setSelectedItems:c,handleAddToCart:d,bundleAddToCartLoading:s,renderingOnPage:p,selectedItemsQuantity:u,handleRemoveItem:m,bundleSubtotal:g,dispatchAnalyticsEvent:x,fetchStoreDetails:f})=>{const[y,b]=t(void 0),[h,v]=t(window.innerWidth<450),[w,C]=t(0),[E,k]=t({}),T=a.builderTiers?.type,S=a.customizations,$=a.builderTiers?.productTier??[],B=a.builderTiers?.offerTier??[],[I,z]=t([]),[F,N]=t(!1),[P,D]=t("All"),[A,_]=t(0),R=r(null),[O,L]=t({}),[M,j]=t([]),[V,W]=t(!1),[H,q]=t(0),[Q,U]=t(0),[Y,G]=t({}),X=e=>{G(t=>{const n=!1!==t[e];return{...t,[e]:!n}})};n(()=>{M.length>0&&G(e=>{const t={...e};return M.forEach(e=>{void 0===t[e.id]&&(t[e.id]=!1)}),t})},[M]);const Z=a.customStoreDetails?.fixedInventoryDetails;n(()=>{const e=new Set;let t=!1;a?.products?.forEach(n=>{const o=n.productDetails;if(o.metafield&&"yourtoken_bundles_app"===o.metafield.namespace&&"categories"===o.metafield.key){let n=[];if(o.metafield.jsonValue&&Array.isArray(o.metafield.jsonValue))n=o.metafield.jsonValue;else if(o.metafield.value)try{const e=JSON.parse(o.metafield.value);Array.isArray(e)&&(n=e)}catch(e){console.error("Failed to parse categories:",e)}n.length>0&&(t=!0,n.forEach(t=>e.add(t)))}}),z(Array.from(e)),N(t);S?.byob?.productFiltersDisplay&&"none"!==S?.byob?.productFiltersDisplay&&(async()=>{const e=S?.byob?.filtersProvider??"products-data",t=S?.byob?.selectedFilterOptions;if("search-and-discovery-app-sync"===e)try{const e=await(f?.());e?.productFilters&&j(e.productFilters??[])}catch(e){j(Vc(a.products,t))}else j(Vc(a.products,t))})()},[a.products,S?.byob,f]),n(()=>{L({})},[w,P]);const K=((e,t)=>"All"===t?e:e.filter(e=>{const n=e.productDetails;if(n.metafield&&"yourtoken_bundles_app"===n.metafield.namespace&&"categories"===n.metafield.key){let e=[];if(n.metafield.jsonValue&&Array.isArray(n.metafield.jsonValue))e=n.metafield.jsonValue;else if(n.metafield.value)try{const t=JSON.parse(n.metafield.value);Array.isArray(t)&&(e=t)}catch(e){console.error("Failed to parse categories:",e)}return e.includes(t)}return!1}))(a.products.filter(e=>"active"===e.productDetails.status?.toLowerCase()||"unlisted"===e.productDetails.status?.toLowerCase()||void 0===e.productDetails.status||""===e.productDetails.status),P),J="productTier"===T?$.reduce((e,t)=>e+t.minimumQuantity,0):"offerTier"===T?B.reduce((e,t)=>e+t.minimumQuantity,0):a.minimumQuantity,ee=i((e,t)=>{const n=Z?.find(e=>e.variantId===t)?.quantity;if(void 0!==n)return n;const o=(e.variants?.edges||[]).find(e=>e.node.id===t),r=o?.node;return r?e.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[Z]),[te,ne]=t(3e3);n(()=>{let e=0;a.products.forEach(t=>{const n=Number(t.productDetails.variants?.edges?.[0]?.node?.price||0);n>e&&(e=n)}),ne(100*Math.ceil(e/100)||5e3)},[a.products]);const[oe,re]=t(""),[ae,le]=t(""),ce=((e,t)=>e.filter(e=>e?.productDetails?.title?.toLowerCase().includes(t?.toLowerCase())))(K,oe),de=((e,t)=>[...e].sort((e,n)=>{const o=e?.productDetails?.title?.toLowerCase(),r=n?.productDetails?.title?.toLowerCase(),i=parseFloat(e?.productDetails?.variants?.edges?.[0]?.node?.price||"0"),a=parseFloat(n?.productDetails?.variants?.edges?.[0]?.node?.price||"0");switch(t){case"title-asc":return o.localeCompare(r);case"title-desc":return r.localeCompare(o);case"price-low-to-high":return i-a;case"price-high-to-low":return a-i;default:return 0}}))(ce,ae),se=de.filter(e=>((e,t,n,o)=>{if(0===Object.keys(t).length)return!0;for(const[r,i]of Object.entries(t)){if(0===i.length)continue;const a=n.find(e=>e.id===r);if(!a)continue;let l=!1;if("filter.v.price"===r){const n=t[r][0];if(!n)continue;const[o,i]=n.split("-"),a=parseFloat(o.replace("min:",""))||0,c="max:∞"===i?1/0:parseFloat(i.replace("max:",""))||1/0;(e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id))||[]).some(e=>{const t=Number(e.node.price||0);return t>=a&&t<=c})&&(l=!0)}else for(const t of i){const n=a.values.find(e=>e.id===t);if(n)try{const t=JSON.parse(n.input);if(void 0!==t.available){const n=e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id))||[];if(!0===t.available){if(n.some(t=>o(e.productDetails,t.node.id)>0)){l=!0;break}}else if(!1===t.available&&n.every(t=>0===o(e.productDetails,t.node.id))){l=!0;break}}else if(t.productType){if(e.productDetails.productType===t.productType){l=!0;break}}else if(t.vendor){if(e.productDetails.vendor===t.vendor){l=!0;break}}else if(t.tag){if(e.productDetails.tags?.includes(t.tag)){l=!0;break}}else if(t.variantOption){const{name:n,value:o}=t.variantOption,r=e.productDetails.options?.findIndex(e=>e.name===n);if(void 0!==r&&-1!==r){if((e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id))||[]).some(e=>{const t=(e.node.title||"").split(" / ")[r]||e.node.title;return t?.toLowerCase()===o.toLowerCase()})){l=!0;break}}}}catch(e){console.warn("Bad filter input",n.input)}}if(!l)return!1}return!0})(e,O,M,ee)),pe=((e,t,n,o,r)=>(e[r]?.products.filter(e=>t.some(t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0]))&&t?.productDetails.title.toLowerCase().includes(n?.toLowerCase())))||[]).sort((e,n)=>{let r=t.find(t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0]))),i=t.find(e=>e.productId===n.productId&&(n.variantIds.length<1||e.variantIds.includes(n.variantIds[0])));if(!r||!i)return 0;const a=r.productDetails?.title?.toLowerCase(),l=i.productDetails?.title?.toLowerCase(),c=parseFloat(r?.productDetails?.variants?.edges?.[0]?.node?.price||"0"),d=parseFloat(i?.productDetails?.variants?.edges?.[0]?.node?.price||"0");switch(o){case"title-asc":return a.localeCompare(l);case"title-desc":return l.localeCompare(a);case"price-low-to-high":return c-d;case"price-high-to-low":return d-c;default:return 0}}))($,se,oe,ae,w),[ue,me]=ie(Ec),[ge,xe]=t(!1),fe="productTier"===T?pe:se,ye=fe.slice(0,20*(A+1));n(()=>{x?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:a?._id,bundleType:"byob-page-bundle",byobBundleType:a.builderTiers?.type??"builder"}}),setTimeout(()=>{xe(!0)},100)},[]);const be=r(null);n(()=>{const e=()=>{v(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{if(a.coverImageUrl){const e=new Image;e.src=Bp(a.coverImageUrl)??"",e.onload=()=>{b(e.width/e.height)}}},[a.coverImageUrl]),n(()=>{xe(!1),setTimeout(()=>xe(!0),100)},[w]);const he=(e,t)=>{if("productTier"===T){let n={...E},o=!1;if(n[t]){const r=n[t].indexOf(e);-1!==r&&(n[t]=[...n[t]],n[t].splice(r,1),o=!0)}if(!o)for(let t=$.length;t>=0;t--){const o=n[t].indexOf(e);if(-1!==o){n[t]=[...n[t]],n[t].splice(o,1);break}}k(n);const r=$.findIndex((e,t)=>n[t]?.length<e.minimumQuantity);-1!==r&&C(r)}m(e,t)},ve=()=>{const e=document.querySelector(".products-display");e&&e.scrollIntoView({behavior:"smooth"})};n(()=>{if("productTier"===T){const e=Object.fromEntries($.map(e=>[e.tier,[]]));k(e)}},[a]),n(()=>{if("productTier"!==T||!$[w])return;if(J===u)return;const e=$.findIndex((e,t)=>{const n=E[t]||[];return t>=w&&n.length<e.minimumQuantity});if(-1!==e&&e!==w){C(e);$[w].products.length>1&&ve()}},[E,$,T]),n(()=>{re("")},[w]),n(()=>{function e(e){if(!be.current||!e.target)return;!be.current.contains(e.target)&&me(void 0)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const we=(e,t,n)=>{var o;"productTier"===T&&(o=e,k(e=>{const t={...e},n=$.findIndex((e,n)=>{const o=t[n]||[];return n>=w&&o.length<e.minimumQuantity});return-1!==n&&C(n),t[n]||(t[n]=[]),t[n].push(o),t}));const r=!0===$[w]?.isFreebieTier;x?.({eventNameCustom:"byob_add_to_bundle",eventTypeCustom:"clicks",data:{bundleId:a._id,bundleType:"byob-page-bundle",byobBundleType:a.builderTiers?.type??"builder",addedProduct:{id:t?.id,title:t?.title}}}),Ip(e,t,n,l,c,r,w)},Ce=(()=>{if(!a?.builderTiers)return a.minimumQuantity;const{type:e,offerTier:t,productTier:n}=a.builderTiers,o="offerTier"===e?t:"productTier"===e?n:null;if(!o)return a.minimumQuantity;let r=0;return o.map(e=>{r+=e.minimumQuantity}),r})(),Ee=h&&a.mobileCoverImageUrl?Bp(a.mobileCoverImageUrl):Bp(a.coverImageUrl??"")||null,ke=i(e=>{const t=S?.general?.showOutOfStockProducts;if(t)return!0;const n=e.productDetails,o=n?.variants?.edges||[];if(Z){if(o.some(e=>Z.some(t=>t.variantId===e.node.id&&t.quantity>0)))return!0}return o.some(e=>ee(n,e.node.id)>0)},[S?.general?.showOutOfStockProducts,Z,ee]);n(()=>{if("productTier"!==T)return;const e=$[w];if(!e)return;if(1!==e.minimumQuantity)return;if(1!==e.products.length)return;const t=e.products[0],n=a.products.find(e=>e.productId===t.productId)?.productDetails;if(!n)return;if(n.variants?.edges?.length>1)return;const o=n.variants?.edges?.find(e=>ee(n,e.node.id)>0)?.node;if(!o)return;const r=o.id,i=E[w]?.includes(r);if(!i&&(we(r,n,1),w<$.length-1)){C(w+1);const e=$?.[w];e?.products?.length>1&&ve()}},[T,$,w,a.products,E,ee,we]);const Te=o(()=>K.filter(e=>{const t=e.productDetails;return(t.variants?.edges||[]).some(e=>ee(t,e.node.id)>0)}).length,[K,ee]),Se=o(()=>K.length-Te,[K,Te]),$e="bundles"==a.appName?a.pageHeader?.title:a?.title,Be="bundles"==a.appName?a.pageHeader?.description:a?.subtitle;n(()=>{_(0)},[oe,ae,P,w,O]);const Ie=i(()=>{ye.length<fe.length&&_(e=>e+1)},[ye.length,fe.length]);n(()=>{const e=new IntersectionObserver(([e])=>{e.isIntersecting&&Ie()},{threshold:.1});return R.current&&e.observe(R.current),()=>{R.current&&e.unobserve(R.current)}},[Ie]);const ze=()=>{x?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:a._id,bundleType:"byob-page-bundle",byobBundleType:a.builderTiers?.type??"builder",selectedProducts:l.map(e=>({id:e?.product?.id,title:e?.product?.title,quantity:e?.quantity}))}})};return e.createElement(e.Fragment,null,e.createElement("div",{style:{display:"flex",flexDirection:"column",width:"100%",alignItems:"center",justifyContent:"center",rowGap:"15px",padding:"20px 0px",marginBottom:"20px",backgroundColor:S.byob.sectionBackgroundColor,..."transparent"!==S.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},Ee?e.createElement("div",{style:{position:"relative",width:"100%",display:"flex",justifyContent:"center",alignItems:"center",textAlign:"center",overflow:"hidden",...a?.coverImageVerticalMargin&&{marginBottom:a?.coverImageVerticalMargin,marginTop:a?.coverImageVerticalMargin}}},Ee&&e.createElement(Fc,{coverImageUrl:Ee,alt:"Background",styles:{width:"100%",height:"auto",display:"block"}}),e.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",width:"90%",maxWidth:"1000px",textShadow:"2px 2px 8px rgba(0, 0, 0, 0.4)"}},e.createElement("span",{style:{lineHeight:"normal",fontSize:S?.byob?.titleFontSize??"3rem",fontWeight:"700",color:S?.byob?.titleTextColor??"#000",marginBottom:"15px",backgroundColor:S?.byob?.titleBackgroundColor??"transparent",width:"100%",textAlign:"center"},className:"bundle-builder-title"},$e),e.createElement("span",{style:{lineHeight:"normal",fontSize:S?.byob?.subtitleFontSize??"1.5rem",color:S?.byob?.titleTextColor??"#000"},className:"bundle-builder-subtitle"},Be))):($e||Be)&&e.createElement("div",{style:{zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",width:"90%",maxWidth:"1000px"}},$e&&e.createElement("span",{style:{lineHeight:"normal",fontSize:S?.byob?.titleFontSize??"3rem",fontWeight:"700",color:S?.byob?.titleTextColor??"#000",marginBottom:"15px",textAlign:"center",width:"100%",backgroundColor:S?.byob?.titleBackgroundColor??"transparent"}},$e),Be&&e.createElement("span",{style:{lineHeight:"normal",fontSize:S?.byob?.subtitleFontSize??"1.5rem",color:S?.byob?.titleTextColor??"#000"}},Be)),e.createElement("div",{style:{fontSize:"20px",width:"100%"},className:"products-display"},"productTier"===T&&$.length>0&&S?.byob.productTiersVisibility&&e.createElement(e.Fragment,null,e.createElement("div",null,e.createElement(Mc,{currentStep:w,totalSteps:$.length,tiers:$,isMobile:h,primaryColor:S?.general?.primaryColor,primaryTextColorCta:S?.general?.primaryContrastColor,setCurrentProductTier:C,selectedProductsByTier:E,tierNavigation:S.byob.tierNavigation})))),e.createElement("div",{style:{display:"flex",flexDirection:"row",width:h?"100%":"90%",marginInline:"auto"}},"sidebar"===S?.byob?.productFiltersDisplay&&!h&&e.createElement(Ac,{showFiltersDrawer:V,handleClose:()=>W(!1),isAnimating:!1,isMobile:!1,availableFilters:M,appliedFilters:O,toggleFilter:(e,t)=>{L(n=>{const o=n[e]||[],r=o.includes(t)?o.filter(e=>e!==t):[...o,t],i={...n,[e]:r.length?r:void 0};return Object.fromEntries(Object.entries(i).filter(([,e])=>void 0!==e))})},clearAllFilters:()=>{L({}),U(0),q(te)},applyPriceFilter:()=>{L(e=>{const t={...e};return t["filter.v.price"]=[`min:${Q}-max:${H}`],t})},priceMin:Q,setPriceMin:U,priceMax:H,setPriceMax:q,maxPossiblePrice:te,styles:S,products:a.products,unavailableProductCount:Se,storeCurrencyCode:a?.storeCurrencyCode,openSections:Y,toggleSection:X}),e.createElement("div",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0}},e.createElement("div",{style:{width:"100%",marginBottom:"20px",display:"flex",flexDirection:"column",gap:"20px"}},e.createElement(_c,{enableSortAndFilter:a?.enableSortAndFilter??!1,isMobile:h,searchTerm:oe,setSearchTerm:re,setSortBy:le,styles:S,appliedFilters:O,setAppliedFilters:L,availableFilters:M,products:a.products,availableProductCount:Te,unavailableProductCount:Se,maxPossiblePrice:te,storeCurrencyCode:a?.storeCurrencyCode,sharedFiltersState:{showFilters:V,setShowFilters:W,priceMax:H,setPriceMax:q,priceMin:Q,setPriceMin:U},openSections:Y,toggleSection:X}),a?.customizations?.byob?.enableProductCategories&&F&&e.createElement("div",null,e.createElement(jc,{styles:S,isMobile:h,categories:I,activeCategory:P,onCategoryChange:e=>{D(e)}}))),e.createElement("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"12px",justifyContent:V&&"sidebar"===S?.byob?.productFiltersDisplay?"flex-start":"center",width:"100%",height:"fit-content",paddingBottom:p?"100px":"20px"},className:"products-display"},0===fe?.length?e.createElement("p",{style:{fontSize:"20px",color:"#333",textAlign:"center",width:"100%"}},"No products found"):"productTier"===T&&$.length>0?ye.filter(e=>ke(se.find(t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0]))))).map((t,n)=>{const o=($[w]?.minimumQuantity??0)>(E[w]?.length??0),r=se.find(e=>e.productId===t.productId&&(t.variantIds.length<1||e.variantIds.includes(t.variantIds[0])));return r?e.createElement(Lc,{bundle:a,idx:n,key:t?.variantIds?.[0]??t.productId,product:r?.productDetails,handleAddToBundle:we,hideAddToBundle:!o,remainingQuantity:Ce-u,themeColor:a?.dealTextColor,handleRemoveItem:e=>he(e,w),selecteditems:l,transitionActive:ge,customVariantsQuantity:Z,currentProductTier:$[w],showFreebieTierProductPrices:a?.customStoreDetails?.showFreebieTierProductPrices,tierIndex:w}):null}):ye.filter(ke).map((t,n)=>e.createElement(Lc,{bundle:a,idx:n,key:t.productId,product:t?.productDetails,handleAddToBundle:we,hideAddToBundle:u>=Ce,remainingQuantity:Ce-u,themeColor:a?.dealTextColor,handleRemoveItem:m,selecteditems:l,transitionActive:ge,customVariantsQuantity:Z,tierIndex:w})),ye.length<fe.length&&e.createElement("div",{ref:R,style:{height:"1px",width:"100%",display:"block"}})),!p&&e.createElement(Cc,{builderTiers:a?.builderTiers,handleAddToCart:async e=>{await d(e),ze()},minimumQuantity:J,selectedProducts:l,showProductDetailsInTracker:a.showProductDetailsInTracker,handleRemoveItem:m,handleRemoveItemProductTier:he,selectedItemsQuantity:u,percentageOff:a.percentageOff,loading:s,bundleSubtotal:g,amountOff:a.amountOff,styles:a.customizations,dealAmount:a.dealAmount,themeColor:a?.dealTextColor??"#333",primaryTextColorCta:a?.primaryTextColorCta??"#fff",cornerRadiusType:a?.cornerRadiusType??"",selectedProductsByTier:E,renderingOnPage:p}),p&&e.createElement("div",{style:{width:"100%",marginTop:"20px",position:"sticky",bottom:"10px",zIndex:999}},e.createElement(Cc,{handleAddToCart:async e=>{await d(e),ze()},minimumQuantity:J,builderTiers:a?.builderTiers,selectedProducts:l,showProductDetailsInTracker:a.showProductDetailsInTracker,loading:s,handleRemoveItem:m,handleRemoveItemProductTier:he,percentageOff:a.percentageOff,selectedItemsQuantity:u??0,bundleSubtotal:g??{price:0,compareAtPrice:0},amountOff:a.amountOff,styles:a.customizations,dealAmount:a.dealAmount,themeColor:S?.general.primaryColor||"#000",primaryTextColorCta:S.general.primaryContrastColor??"#fff",cornerRadiusType:a?.cornerRadiusType??"",selectedProductsByTier:E,renderingOnPage:p})))),ue&&void 0!==u&&(()=>{let t=u<a.minimumQuantity;return"productTier"==T?t=($[w]?.minimumQuantity??0)>(E[w]?.length??0):"offerTier"==T&&(t=u<B.reduce((e,t)=>e+t.minimumQuantity,0)),e.createElement(zc,{handleAddToBundle:we,ref:be,remainingQuantity:a.minimumQuantity-u,hideAddToBundle:!t,disableQuantitySelector:a?.disableQuantitySelector??!1,selectedProducts:l,selectedProductsByTier:E,themeColor:S?.general.primaryColor||"#000",primaryTextColorCta:a?.customizations?.general.primaryContrastColor??"#fff",primaryBackgroundColorCta:S?.general.primaryColor||"#000",cornerRadius:a?.customizations.byob.borderRadius,styles:a.customizations,reviewRatingType:a?.reviewRatingType??"none",customVariantsQuantity:Z,bundleProductsCustomQuantity:a?.customProductsQuantity,isFreebieTier:$?.[w]?.isFreebieTier,showFreebieTierProductPrices:a?.customStoreDetails?.showFreebieTierProductPrices,bundleVariantOptions:a?.variantOptions})})()))},Hc=({product:t,selectedVariantId:n,onVariantChange:r,styles:i,originalPrice:a,dealPrice:l,totalPriceSum:c,isVertical:d=!1,variantOptions:s,storeCurrencyCode:p})=>{const u=o(()=>e=>{const n=t?.productDetails?.variants?.edges?.find(t=>t.node.id===e),o=n?.node;return o?t.productDetails.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLocaleLowerCase()?1/0:0:1/0:0},[t.productDetails]),m=t?.productDetails?.variants?.edges?.find(e=>e?.node?.id===n)?.node;u(n);const g=o(()=>{if(m?.title&&t.productDetails.options){const e=m.title.split(" / ");if(e.length===t.productDetails.options.length)return e}return t.productDetails.options?.map(e=>e.values[0])||[]},[m,t.productDetails.options]),x=e=>{r(e)};return d?e.createElement("div",{className:"yt-comboBundle-product-card-vertical",style:{display:"flex",flexDirection:"column",alignItems:"center",lineHeight:"normal",width:"165px",backgroundColor:"#F6F6F6",borderRadius:"20px",border:"1px solid #B3B3B3",boxShadow:"4px 4px 0px -1px #00000033",overflow:"hidden"}},e.createElement("div",{className:"yt-comboBundle-product-card-image-container-vertical",style:{position:"relative",width:"100%"}},i.comboBundle.subProductsImageVisibility&&e.createElement(e.Fragment,null,e.createElement("img",{className:"yt-comboBundle-product-image-vertical",src:Bp(m?.image?.url||t?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg"),alt:t?.productDetails?.featuredMedia?.alt,width:165,height:165,style:{objectFit:"cover",borderRadius:"20px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",height:"100%",aspectRatio:i.general?.imageAspectRatio||"1/1"}}),e.createElement("div",{className:"yt-comboBundle-product-variant-selector-container-vertical",style:{marginTop:"8px",position:"absolute",bottom:"10px",left:"5px",right:"5px"}},t?.productDetails?.variants?.edges?.filter(e=>"Default Title"!==e.node.title)?.length>0&&e.createElement(e.Fragment,null,e.createElement("select",{className:"yt-comboBundle-product-variant-select-vertical",value:n,onChange:e=>x(e.target.value),style:{padding:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",width:"100%",appearance:"none",marginRight:"30px",fontSize:"12px",fontWeight:600}},t?.productDetails?.variants?.edges.map(t=>{const n=u(t?.node?.id);return e.createElement("option",{key:t?.node?.id,value:t?.node?.id,disabled:0===n,className:"yt-comboBundle-product-variant-option"},t?.node?.title)})),e.createElement("div",{className:"yt-comboBundle-product-variant-select-icon-vertical",style:{position:"absolute",right:"1px",top:"2px",bottom:"0px",pointerEvents:"none",backgroundColor:"#F3F3F3",width:"15%",height:"calc(100% - 4px)",display:"flex",justifyContent:"center",alignItems:"center"}},e.createElement(y,null)))))),(i.comboBundle.subProductsProductTitleVisibility||i.comboBundle.subProductsProductPriceVisibility)&&e.createElement("div",{className:"yt-comboBundle-product-info-container-vertical",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"40px",width:"100%",paddingBlock:"5px"}},i.comboBundle.subProductsProductTitleVisibility&&e.createElement("span",{className:"yt-comboBundle-product-title-vertical",style:{fontSize:"12px",color:"#333",fontWeight:"600",lineHeight:"normal",textAlign:"center",width:"fit-content"}},t?.productDetails?.title),i.comboBundle.subProductsProductPriceVisibility&&e.createElement("div",{className:"yt-comboBundle-product-price-container-vertical",style:{display:"flex",alignItems:"center",gap:"8px",lineHeight:"normal",fontSize:"14px"}},e.createElement("span",{className:"yt-comboBundle-product-deal-price-vertical",style:{lineHeight:"normal"}},$p(i.general.currencySymbol,p),Sp((Number(m?.price||0)/Number(c)*Number(l)).toFixed(2))),m?.compareAtPrice&&Number(m.compareAtPrice)>Number(m.price)&&e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},$p(i.general.currencySymbol,p),m.compareAtPrice?Sp(m.compareAtPrice):Sp(m.price))))):e.createElement("div",{className:"yt-comboBundle-product-card-horizontal",style:{display:"flex",alignItems:"center",gap:"16px",padding:"4px",lineHeight:"normal",borderRadius:"8px",transition:"background-color 0.3s",width:"100%",border:"1px solid transparent",..."right"===i.comboBundle.infoAlignment&&{flexDirection:"row-reverse"},..."center"===i.comboBundle.infoAlignment&&{justifyContent:"center"}},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#fafafa",e.currentTarget.style.border="1px solid #DFDFDF"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent",e.currentTarget.style.border="1px solid transparent"}},i.comboBundle.subProductsImageVisibility&&e.createElement("div",{className:"yt-comboBundle-product-image-wrapper-horizontal"},e.createElement("img",{className:"yt-comboBundle-product-image-horizontal",src:Bp(m?.image?.url||t?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg"),alt:t?.productDetails?.featuredMedia?.alt,height:80,style:{objectFit:"cover",borderRadius:"10px",border:"1px solid #DEDEDE",aspectRatio:"1/1",width:"90px",height:"90px"}})),e.createElement("div",{className:"yt-comboBundle-product-info-horizontal",style:{display:"flex",flexDirection:"column",alignItems:"left"===i.comboBundle?.infoAlignment?"flex-start":"right"===i.comboBundle?.infoAlignment?"flex-end":"center"===i.comboBundle?.infoAlignment?"flex-start":void 0}},i.comboBundle.subProductsProductTitleVisibility&&e.createElement("span",{className:"yt-comboBundle-product-title-horizontal",style:{fontSize:"14px",fontWeight:"600",lineHeight:"normal",display:"flex",alignItems:"center",gap:"8px"}},e.createElement("span",{className:"yt-comboBundle-product-title-text"}," ",t?.productDetails?.title," "),"dropdown"!==i.comboBundle.comboVariantTypeSelector&&t.productDetails.variants.edges.filter(e=>"Default Title"!==e.node.title).length>0&&s&&g&&e.createElement("span",{className:"yt-comboBundle-product-variant-tag-horizontal",style:{fontSize:"10px",color:"#666",backgroundColor:"#F4F4F4",padding:"2px 8px",borderRadius:"10px",border:"1px solid #ddd"}},g.length>1?g.join(" / "):g)),i.comboBundle.subProductsProductPriceVisibility&&e.createElement("div",{className:"yt-comboBundle-product-price-wrapper-horizontal",style:{display:"flex",gap:"8px",marginTop:"5px",alignItems:"baseline"}},e.createElement("span",{className:"yt-comboBundle-product-deal-price-horizontal",style:{lineHeight:"normal"}},$p(i.general.currencySymbol,p),Sp((Number(m?.price||0)/Number(c)*Number(l)).toFixed(2))),m?.compareAtPrice&&Number(m.compareAtPrice)>Number(m.price)&&e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},$p(i.general.currencySymbol,p),Sp(m?.compareAtPrice?m?.compareAtPrice:m?.price))),t.productDetails.variants.edges.length>1&&("dropdown"===i.comboBundle.comboVariantTypeSelector?e.createElement("div",{className:"yt-comboBundle-product-variant-dropdown-horizontal",style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},e.createElement("select",{className:"yt-comboBundle-product-variant-select-horizontal",value:n,onChange:e=>x(e.target.value),style:{padding:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",fontSize:"12px",fontWeight:600,borderRadius:"4px"}},t.productDetails.variants.edges.map(t=>{const n=u(t?.node?.id);return e.createElement("option",{key:t?.node?.id,value:t?.node?.id,disabled:0===n,className:"yt-comboBundle-product-variant-option"},t?.node?.title)})),e.createElement("div",{className:"yt-comboBundle-product-variant-select-icon-horizontal",style:{position:"absolute",right:"1px",top:"2px",bottom:"0px",pointerEvents:"none",backgroundColor:"#F3F3F3",width:"15%",height:"calc(100% - 4px)",display:"flex",justifyContent:"center",alignItems:"center"}},e.createElement(y,null))):t.productDetails.options.length>0?e.createElement(e.Fragment,null,t.productDetails.options.map((n,o)=>e.createElement("div",{key:n.name,className:"yt-comboBundle-product-option-group-horizontal",style:{...n?.values?.length>1&&{marginTop:"10px"},display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"}},t.productDetails.options.length>1&&n?.values?.length>1&&e.createElement("label",{className:"yt-comboBundle-product-option-label",style:{fontSize:"12px",fontWeight:"500",color:"#333"}},n.name,":"),n?.values?.length>1&&e.createElement("div",{className:"yt-comboBundle-product-option-values-horizontal",style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"}},n.values.map(r=>{const a=[...g];a[o]=r;const l=t.productDetails.options.length>0?a.join(" / "):a[o],c=t.productDetails.variants.edges.find(e=>e.node.title===l)?.node,d=0===(c?u(c.id):0),p=g[o]===r,m=s&&s?.options?.find(e=>e.name===n.name);return m&&"color"===m?.type?e.createElement("button",{key:r,className:`yt-comboBundle-product-option-button-color ${p?"yt-comboBundle-product-option-button-selected":""} ${d?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!d&&c&&x(c.id)},disabled:d,style:{borderRadius:"50%",padding:"1px",backgroundColor:"white",border:p&&!d?`1px solid ${i.general?.ctaBackgroundColor}`:"1px solid transparent",opacity:d?.5:1,cursor:d?"not-allowed":"pointer"}},m?.values.find(e=>e.name===r)?.value?e.createElement("div",{className:"yt-comboBundle-product-option-color-swatch",style:{width:p&&!d?"26px":"24px",height:p&&!d?"26px":"24px",borderRadius:"50%",backgroundColor:m?.values.find(e=>e.name===r)?.value}},e.createElement("span",null)):e.createElement("span",{key:r,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:p&&!d?`1px solid ${i.general?.ctaBackgroundColor}`:d?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:p&&!d?"#F7F7F7":"transparent",color:d?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},r)):m&&"image"===m?.type?e.createElement("button",{key:r,className:`yt-comboBundle-product-option-button-image ${p?"yt-comboBundle-product-option-button-selected":""} ${d?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!d&&c&&x(c.id)},disabled:d,style:{border:p&&!d?`1px solid ${i.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:p&&!d?"#F7F7F7":"transparent",cursor:d?"not-allowed":"pointer",padding:"0px",width:p&&!d?"26px":"24px",height:p&&!d?"26px":"24px",overflow:"hidden",opacity:d?.5:1}},m?.values.find(e=>e.name===r)?.value?e.createElement("img",{className:"yt-comboBundle-product-option-image",src:Bp(m?.values.find(e=>e.name===r)?.value||"/placeholder.svg"),alt:r,style:{width:p&&!d?"26px":"24px",height:p&&!d?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}}):e.createElement("span",{key:r,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:p&&!d?`1px solid ${i.general?.ctaBackgroundColor}`:d?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:p&&!d?"#F7F7F7":"transparent",color:d?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},r)):e.createElement("button",{key:r,className:`yt-comboBundle-product-option-button-text ${p?"yt-comboBundle-product-option-button-selected":""} ${d?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!d&&c&&x(c.id)},disabled:d,style:{padding:"4px 8px",border:p&&!d?`1px solid ${i.general?.ctaBackgroundColor}`:d?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:p&&!d?"#F7F7F7":"transparent",color:d?"#ccc":"#707070",cursor:d?"not-allowed":"pointer",fontSize:"10px",fontWeight:"600",opacity:d?.5:1}},r)}))))):e.createElement(e.Fragment,null,t?.productDetails?.variants?.edges?.length>1&&e.createElement("div",{className:"yt-comboBundle-product-variant-buttons-horizontal",style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},t?.productDetails?.variants?.edges.map(t=>{const o=0===u(t?.node?.id);return e.createElement("button",{key:t?.node?.id,className:`yt-comboBundle-product-variant-button ${n===t?.node?.id?"yt-comboBundle-product-variant-button-selected":""} ${o?"yt-comboBundle-product-variant-button-disabled":""}`,onClick:()=>x(t?.node?.id),disabled:o,style:{padding:"4px 8px",border:n===t?.node?.id?`1px solid ${i.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:n===t?.node?.id?"#F7F7F7":"transparent",color:o?"#ccc":"#707070",cursor:o?"not-allowed":"pointer",fontSize:"12px",fontWeight:"500",opacity:o?.5:1}},t?.node?.title)}))))))},qc=({bundle:r,addToCartFunction:i,dispatchAnalyticsEvent:a})=>{const[l,c]=t(!1),[d,s]=t(window.innerWidth<786),p=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),[u,m]=t(()=>{const e={};return r.products.forEach((t,n)=>{const o=t.productDetails?.variants?.edges?.find(e=>p(t.productDetails,e?.node?.id)>0)?.node;e[n]=o?o.id:t?.productDetails?.variants?.edges[0]?.node?.id}),e});n(()=>(i&&(window.ytComboBundle={bundle:r,addToCart:i,selectedVariants:u},window.dispatchEvent(new CustomEvent("yt-combo-bundle-updated",{detail:window.ytComboBundle}))),()=>{window.ytComboBundle=void 0,window.dispatchEvent(new CustomEvent("yt-combo-bundle-updated",{detail:void 0}))}),[r,i,u]);const g=r.products?.every((e,t)=>{const n=u[t];return p(e.productDetails,n)>0}),x=(e,t)=>{m(n=>({...n,[e]:t}))},{originalPrice:f,dealPrice:y,offerValue:b,totalPriceSum:h}=o(()=>{const{price:e,compareAtPrice:t}=Object.entries(u).reduce((e,[t,n])=>{const o=r.products[parseInt(t)],i=o.productDetails.variants.edges?.find(e=>e.node.id===n)?.node,a=parseFloat(i?.price??"0"),l=parseFloat(i?.compareAtPrice||a.toString());return e.price+=a,e.compareAtPrice+=l,e},{price:0,compareAtPrice:0}),n=Math.max(e,t);let o=Math.min(e,t);r?.percentageOff?o=e*(1-r.percentageOff/100):r?.dealAmount?o=r.dealAmount:r?.amountOff&&(o=e-r.amountOff);const i=t-o;return{originalPrice:n.toFixed(2),dealPrice:o.toFixed(2),offerValue:i.toFixed(2),totalPriceSum:e.toFixed(2)}},[u,r.products,r.percentageOff,r.dealAmount,r.amountOff]);n(()=>{a?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:r._id,bundleType:"combo-bundle"}});const e=()=>{s(window.innerWidth<786)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const v=r.customizations,w=v.comboBundle?.comboCardStyle||"auto",C="vertical"===w||"auto"===w&&!d,E=v.comboBundle?.embedContentVisibility,k="bundles"==r.appName?r.pageHeader?.title:r?.title,T="bundles"==r.appName?r.pageHeader?.description:r?.subtitle;return e.createElement("div",{className:`yt-comboBundle-bundle-container ${"left"===v.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-left":"right"===v.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-right":"center"===v.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-center":void 0}`,style:{lineHeight:"normal",maxWidth:"800px",marginBlock:v.comboBundle?.verticalMargin||"0px",display:"flex",flexDirection:"column",alignItems:"left"===v.comboBundle?.infoAlignment?"flex-start":"right"===v.comboBundle?.infoAlignment?"flex-end":"center"===v.comboBundle?.infoAlignment?"center":void 0,textAlign:v.comboBundle?.infoAlignment??"left",fontFamily:"system-ui, -apple-system, sans-serif"}},E&&v.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Title")&&e.createElement("div",{className:"yt-comboBundle-bundle-title-container",style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"10px"}},e.createElement("h2",{className:"yt-comboBundle-bundle-title",style:{fontSize:v.comboBundle?.productTitleFontSize||"28px",color:v.comboBundle?.titleTextColor||"#000",fontWeight:"bold",lineHeight:"1.6",margin:0}},k)),E&&v?.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Price")&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-comboBundle-bundle-price-container",style:{display:"flex",alignItems:"center",gap:"8px",color:v.comboBundle?.titleTextColor||"#000",fontSize:(parseInt(v.comboBundle?.productTitleFontSize?.replace("px",""))||28)-4+"px"}},e.createElement("div",{className:"yt-comboBundle-bundle-price-details",style:{display:"flex",alignItems:"center",gap:"5px",flexWrap:"wrap"}},e.createElement("span",{className:"yt-comboBundle-bundle-deal-price-text",style:{fontWeight:"bold",lineHeight:"1",minWidth:"fit-content"}},$p(v.general.currencySymbol,r.storeCurrencyCode),Sp(y)),!isNaN(Number(f))&&!isNaN(Number(y))&&Number(f)>Number(y)&&e.createElement("div",{className:"yt-comboBundle-bundle-original-price-text",style:{color:v.comboBundle?.titleTextColor||"#666",textDecoration:"line-through",verticalAlign:"middle",display:"inline-block",minWidth:"fit-content"}},$p(v.general.currencySymbol,r.storeCurrencyCode),Sp(f)),Number(b)>0&&e.createElement("span",{className:"yt-comboBundle-bundle-offer-badge",style:{backgroundColor:"#D3122A",color:"white",padding:"4px 8px",fontSize:"14px",borderRadius:"20px",fontWeight:"500",lineHeight:"1",minWidth:"fit-content"}},r?.percentageOff?`${r?.percentageOff}% Off`:r?.amountOff?`${$p(v.general.currencySymbol,r.storeCurrencyCode)}${Sp(r?.amountOff)} Off`:`Save ${$p(v.general.currencySymbol,r.storeCurrencyCode)}${Sp(b)}`))),e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",margin:"15px 0px"},className:"yt-comboBundle-checkoutSpecific-container"},e.createElement("div",{style:{display:"flex",width:"12px",height:"12px",justifyContent:"center",alignItems:"center",alignContent:"center",borderRadius:"50%",backgroundColor:v.general?.ctaBackgroundColor||"#1e1e1e",flexShrink:0},className:"yt-comboBundle-checkoutSpecific-dot"},e.createElement("span",null)),e.createElement("p",{style:{fontSize:v.comboBundle.productDescriptionFontSize||"16px",color:v.comboBundle?.descriptionTextColor||"#000",alignItems:"center",margin:0,lineHeight:"1.2"},className:"yt-comboBundle-checkoutSpecific-text"},"Tax included. ",e.createElement("u",null,"Shipping")," calculated at checkout."))),v.comboBundle.subProductsSectionVisibility&&e.createElement(e.Fragment,null,C?e.createElement("div",{className:"yt-comboBundle-products-grid-vertical "+(d?"yt-comboBundle-products-grid-mobile":""),style:{display:"flex",flexDirection:"row",gap:"20px",marginTop:"10px",flexWrap:"wrap"}},r.products.map((t,n)=>{const o=t?.productDetails?.variants?.edges?.find(e=>e?.node?.id===u[n])?.node;return o?e.createElement(Hc,{key:`combo-product-${n}-${t.productId}`,product:t,styles:v,originalPrice:f,dealPrice:y,totalPriceSum:h,selectedVariantId:u[n],onVariantChange:e=>x(n,e),isVertical:C,variantOptions:r.variantOptions,storeCurrencyCode:r.storeCurrencyCode}):null})):e.createElement("div",{className:"yt-comboBundle-products-list-horizontal "+(d?"yt-comboBundle-products-list-mobile":""),style:{display:"flex",flexDirection:"column",gap:"10px",width:"100%"}},v.comboBundle.subProductsSectionVisibility&&r.products.map((t,n)=>e.createElement(Hc,{key:`combo-product-horizontal-${n}-${t.productId}`,product:t,styles:v,originalPrice:f,dealPrice:y,totalPriceSum:h,selectedVariantId:u[n],onVariantChange:e=>x(n,e),variantOptions:r.variantOptions})))),e.createElement("div",{className:"yt-comboBundle-bundle-cta-section",style:{borderTop:"1px solid #eee",display:"flex",flexDirection:"column",rowGap:"5px",marginTop:"20px",width:"100%"}},e.createElement("button",{className:`yt-comboBundle-bundle-cta-button ${g?"":"yt-comboBundle-bundle-cta-button-disabled"} ${d?"yt-comboBundle-bundle-cta-button-mobile":""}`,style:{backgroundColor:g?v.general?.ctaBackgroundColor||"#121212":v.general.disabledButtonColor,color:v.general?.ctaTextColor||"#FFFFFF",fontSize:"16px",borderRadius:v.general.ctaBorderRadius??"20px",fontWeight:"bold",cursor:g?"pointer":"not-allowed",border:`1px solid ${g?v.general?.ctaBackgroundColor||"#121212":v.general.disabledButtonColor}`,boxShadow:v.general.ctaShadowType,padding:v.general?.ctaPadding,width:v.general?.ctaWidth,margin:"0"},disabled:!g,onMouseOver:e=>{v.general.customizeHoverState&&g&&(e.currentTarget.style.backgroundColor=v.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=v.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{v.general.customizeHoverState&&g&&(e.currentTarget.style.backgroundColor=v.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=v.general?.ctaTextColor||"#FFFFFF")},onClick:async()=>{const e=Object.entries(u).map(([e])=>({id:r.products[parseInt(e)].productId,title:r.products[parseInt(e)]?.productDetails?.title}));a?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:r._id,bundleType:"combo-bundle",selectedProducts:e}});try{if(c(!0),!i)return console.error("[ComboBundle.tsx] No addToCartFunction available"),void c(!1);const e=Object.entries(u).map(([e,t])=>{const n=r.products[parseInt(e)],o=n.productDetails.variants.edges.find(e=>e.node.id===t)?.node;return o?{variantId:t,price:Number(o.price)}:null}).filter(e=>null!==e),t=Object.values(u);await i(Number(f),t,Number(y),e)}catch(e){console.error("[ComboBundle.tsx] Error adding to cart:",e)}c(!1)}},l?e.createElement(rt,{color:"white",loading:l,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):e.createElement(e.Fragment,null,g?v.comboBundle?.ctaTitle??"Add Bundle to cart":v.general.outOfStockLabel||"Out of Stock"," "))),E&&v.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Description")&&e.createElement("div",{className:"yt-comboBundle-bundle-description-section",style:{margin:"20px 0px"}},e.createElement("h4",{className:"yt-comboBundle-bundle-description-header",style:{fontSize:"16px",color:v.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",margin:0,padding:"8px",backgroundColor:v.general.primaryColor+"20"}},"Description"),e.createElement("div",{className:"yt-comboBundle-bundle-description-content",style:{fontSize:v.comboBundle.productDescriptionFontSize||"16px",color:v.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",padding:"8px",backgroundColor:v.general.primaryColor+"08"}},e.createElement("p",null,T))))},Qc=c.div`
|
|
3148
|
+
`;const Bc=({options:t,selectedValue:n,onChange:o,type:r="text",isOptionAvailable:i,isMobile:a})=>e.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"}},t?.map(t=>{const a=!i||i(t.name);return e.createElement("div",{key:t.name,onClick:()=>{a&&o(t)},style:{cursor:a?"pointer":"not-allowed"}},((t,n)=>{const o=!i||i(t.name),a={cursor:o?"pointer":"not-allowed",border:n?"2px solid #333":"1px solid #d1d5db",transition:"all 0.2s ease",opacity:o?1:.5};if("color"===r)return t.value&&(()=>{if(!t.value.trim())return!1;if(t.value===t.name||t.value.length<3)return!1;try{const e=document.createElement("div");return e.style.color=t.value,""!==e.style.color}catch{return!1}})()?e.createElement("div",{style:{...a,width:24,height:24,borderRadius:"50%",backgroundColor:t.value,display:"block"}}):e.createElement("div",{style:{...a,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"}},t.name);return"image"===r?e.createElement("img",{src:gn(t.value,48,85,"webp")||"/placeholder.svg",alt:t.name,style:{...a,width:24,height:24,borderRadius:"50%",objectFit:"cover"}}):e.createElement("div",{style:{...a,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"}},t.name)})(t,n?.name===t.name))})),Ic=({product:r,isOpen:i,onClose:a,variantOptions:l,cta:c,onConfirm:d})=>{const s=o(()=>e=>e?r?.tracksInventory&&e?.inventoryItem?.tracked?e.inventoryQuantity>0?e?.inventoryQuantity:e.inventoryQuantity<=0&&"continue"===e.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0,[r?.tracksInventory]),p=o(()=>{const e=r.variants.edges.find(e=>{const t=e.node;return s(t)>0})?.node;return e?.title&&"Default Title"!==e.title?e.title.split(" / "):r.options?.map(e=>e.values[0])||[]},[r,s]),[u,m]=t(p),[g,x]=t(window.innerWidth<1024);n(()=>{const e=()=>x(window.innerWidth<1024);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),n(()=>{const e=e=>{"Escape"===e.key&&a()};return i&&document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[i,a]);const f=r.variants.edges.find(e=>e.node.title===(r.options?.length>0?u.join(" / "):u[0]))?.node,y=f?.image?.url||r.featuredMedia?.preview?.image?.url,b=gn(y,150,85,"webp"),h=e=>{if(!l?.options)return"text";const t=l.options.find(t=>t.name===e);return t?.type||"text"},v=e=>{if(!l?.options)return e.values.map(e=>({name:e,value:e}));const t=l.options.find(t=>t.name===e.name);return e.values.map(e=>{const n=t?.values?.find(t=>t.name===e);return{name:e,value:n?.value||e}})},w=(e,t)=>{const n=u[t];if(!n)return null;return v(e).find(e=>e.name===n)||null};if(!i)return null;const C=e.createElement("div",{onClick:a,style:{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100vw",height:"100vh",background:"rgba(0, 0, 0, 0.4)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center"},role:"dialog","aria-modal":"true","aria-labelledby":"yt-variant-options-modal-title"},e.createElement("div",{onClick:e=>e.stopPropagation(),style:{background:"white",borderRadius:16,width:"fit-content",minWidth:350,maxWidth:450,maxHeight:"90vh",overflowY:"auto",position:"relative",zIndex:999,...window.innerWidth<=600&&{width:"90vw",maxWidth:"90vw",minWidth:"90vw"}}},e.createElement("div",{id:"yt-variant-options-modal-title",style:{width:"100%",padding:"16px 0",fontWeight:600,fontSize:14,textTransform:"uppercase",backgroundColor:"rgba(217, 217, 217)",color:"black",textAlign:"center",borderTopLeftRadius:16,borderTopRightRadius:16}},"Select Options"),e.createElement("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"16px 20px",borderBottom:"1px solid #f0f0f0"}},e.createElement("img",{src:b,alt:r.title,style:{width:60,height:60,borderRadius:8,objectFit:"cover",flexShrink:0,transition:"opacity 0.3s ease"}}),e.createElement("div",{style:{display:"flex",flexDirection:"column",flex:1,gap:4}},e.createElement("div",{style:{fontSize:14,fontWeight:600,color:"#333"}},r.title))),e.createElement("div",{style:{padding:"20px"}},r.options.map((t,n)=>e.createElement("div",{key:t.name,style:{display:"flex",flexDirection:"column",gap:8,marginBottom:t?.values?.length>1?16:0}},t?.values?.length>1&&e.createElement(e.Fragment,null,e.createElement("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8}},e.createElement("span",{style:{fontSize:14,fontWeight:500,color:"#333"}},"Select ",t.name),e.createElement("span",{style:{fontSize:12,fontWeight:500,color:"#666",backgroundColor:"#f5f5f5",padding:"4px 12px",borderRadius:16,textTransform:"capitalize"}},w(t,n)?.name||t.values[0])),e.createElement(Bc,{options:v(t),selectedValue:w(t,n),onChange:e=>{((e,t)=>{const n=[...u];n[e]=t.name,m(n)})(n,e)},type:h(t.name),isOptionAvailable:e=>((e,t)=>{const n=[...u];n[e]=t;const o=r.options?.length>0?n.join(" / "):n[0],i=r.variants.edges.find(e=>e.node.title===o)?.node;return!!i&&s(i)>0})(n,e),isMobile:g}))))),e.createElement("button",{onClick:()=>{const e=r.variants.edges.find(e=>e.node.title===(r.options?.length>0?u.join(" / "):u[0]))?.node,t=!!e&&s(e)>0;if(e?.id&&t)d(e.id),a();else{console.warn("yt::variant options modal - selected variant not available or out of stock:",u);const e=r.variants.edges.find(e=>s(e.node)>0)?.node.id;e&&(d(e),a())}},style:{width:"100%",fontSize:14,fontWeight:600,textTransform:"uppercase",backgroundColor:c.backgroundColor,color:c.textColor,textAlign:"center",padding:"16px 0",border:"none",cursor:"pointer",borderBottomLeftRadius:16,borderBottomRightRadius:16},onMouseEnter:e=>{e.currentTarget.style.opacity="0.9"},onMouseLeave:e=>{e.currentTarget.style.opacity="1"}},"Add to Bundle")));return D.createPortal(C,document.body)},zc=l((a,l)=>{const[c,d]=ie(Ec),s=o(()=>e=>{const t=a?.customVariantsQuantity?.find(t=>t.variantId===e?.id)?.quantity;return void 0!==t?t:a?.bundleProductsCustomQuantity?a?.bundleProductsCustomQuantity:e?c?.tracksInventory&&e.inventoryItem?.tracked?e.inventoryQuantity>0?e.inventoryQuantity:e.inventoryQuantity<=0&&"continue"===e.inventoryPolicy?.toLocaleLowerCase()?1/0:0:1/0:0},[c?.tracksInventory,a?.customVariantsQuantity,a?.bundleProductsCustomQuantity]),p=c?.variants.edges?.filter(e=>s(e.node)>0)||[],[u,m]=t(p?.[0]?.node),[g,x]=t(0),[f,y]=t("undefined"!=typeof window&&window.innerWidth<=600),[b,h]=t(1),[v,w]=t("idle"),C=r(null),E=r(null),k=r(!1),[T,S]=t(0),$=o(()=>{const e=c?.variants.edges.find(e=>{const t=e.node;return s(t)>0})?.node;return e?.title&&"Default Title"!==e.title?e.title.split(" / "):c?.options?.map(e=>e.values[0])||[]},[c,s]),[B,I]=t($);n(()=>{if(c){const e=c.variants.edges?.filter(e=>s(e.node)>0),t=c?.selectedVariant??e[0]?.node;m(t),t?.title&&"Default Title"!==t.title&&I(t.title.split(" / "))}},[c,s]),n(()=>{const e=a.selectedProducts.find(e=>e.variantId===u?.id);h(e?e.quantity:0)},[b,a.selectedProducts,u]),n(()=>{if(E.current&&-1!==g&&k.current){const e=E.current.children;e[g]&&e[g].scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"}),k.current=!1}},[g]);if(n(()=>{const e=()=>y(window.innerWidth<=600);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),!c)return null;const{title:z,descriptionHtml:F,media:N,variants:P}=c,A=N.edges.map(e=>e?.node.preview.image??e?.node.image).filter(e=>e?.url?.length>0),_=i(e=>{const t=e.target.value,n=p?.find(e=>e.node.id===t)?.node;n&&s(n)>0&&(k.current=!0,m(n),n.title&&"Default Title"!==n.title&&I(n.title.split(" / ")))},[p,s]),R=i(e=>{if(!a.bundleVariantOptions?.options)return"text";const t=a.bundleVariantOptions?.options.find(t=>t.name===e);return t?.type||"text"},[a.bundleVariantOptions]),O=i(e=>{if(!a?.bundleVariantOptions?.options)return e.values.map(e=>({name:e,value:e}));const t=a?.bundleVariantOptions?.options.find(t=>t.name===e.name);return e.values.map(e=>{const n=t?.values?.find(t=>t.name===e);return{name:e,value:n?.value||e}})},[a.bundleVariantOptions]),L=i((e,t)=>{const n=[...B];n[e]=t.name,I(n);const o=c?.options?.length>0?n.join(" / "):n[0],r=c?.variants.edges.find(e=>e.node.title===o)?.node;r&&s(r)>0&&(k.current=!0,m(r))},[B,c,s]),M=i((e,t)=>{const n=B[t];if(!n)return null;return O(e).find(e=>e.name===n)||null},[B,O]),j=i((e,t)=>{const n=[...B];n[e]=t;const o=c?.options?.length>0?n.join(" / "):n[0],r=c?.variants.edges.find(e=>e.node.title===o)?.node;return!!r&&s(r)>0},[B,c,s]);n(()=>{if(c&&u?.image?.url&&Array.isArray(A)){const e=A.findIndex(e=>e?.url===u?.image?.url);-1!==e&&e!==g&&x(e)}},[u,g,A]),n(()=>{if(c){document.body.style.overflow="hidden",window.history.pushState({modalOpen:!0},"",window.location.href);const e=e=>{d(void 0),e.preventDefault()};return window.addEventListener("popstate",e),()=>{document.body.style.overflow="unset",window.removeEventListener("popstate",e),window.history.state?.modalOpen&&window.history.back()}}},[c,d]),n(()=>{if(f&&c&&C.current){const e=()=>{C.current&&S(C.current.offsetHeight)};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}},[f,c]);const V=a.selectedProducts.filter(e=>e.variantId===u?.id).reduce((e,t)=>e+t.quantity,0),W=a.customVariantsQuantity?.find(e=>e.variantId===u?.id)?.quantity??a.bundleProductsCustomQuantity??1/0,H=W!==1/0&&V>=W,q=a.hideAddToBundle||!u||s(u)<=0||H||"idle"!==v||a?.disableQuantitySelector&&1===b,Q=({className:t})=>{const n=c?.rating?.averageRating??a?.rating?.averageRating??0,o=c?.rating?.ratingCount??a?.rating?.ratingCount??0;return n<=0?null:e.createElement(e.Fragment,null,"ratingOnly"===a.reviewRatingType&&e.createElement("div",{className:t,style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(Se,{color:"gold",size:14}),e.createElement("span",{style:{marginLeft:6}},n," rating")),"ratingAndReviewCount"===a.reviewRatingType&&e.createElement("div",{className:t,style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(Se,{color:"gold",size:14}),n,e.createElement(he,{size:14,style:{color:"dodgerblue",marginLeft:"4px"}}),"(",o," reviews)"))},U=({isMobile:t})=>e.createElement(e.Fragment,null,e.createElement("div",{style:{position:t?"relative":void 0}},t?e.createElement("div",{ref:E,style:{display:"flex",flexDirection:"row",overflowX:"auto",WebkitOverflowScrolling:"touch",scrollSnapType:"x mandatory",scrollbarWidth:"none",msOverflowStyle:"none"}},A.length>1&&A.map((t,n)=>e.createElement("div",{key:n,style:{width:"100%",flex:"0 0 auto",scrollSnapAlign:"center",objectFit:"contain",maxHeight:"50vh",zIndex:999}},e.createElement(ut,{small:Bp(t?.url),medium:Bp(t?.url),large:Bp(t?.url),alt:t.altText||`${z} - Image ${n+1}`,hideDownload:!0,imageBackgroundColor:"#000",className:"yt-byob-modal-desktop-main-image"})))):e.createElement(e.Fragment,null,e.createElement(ut,{small:Bp(A[g]?.url),medium:Bp(A[g]?.url),large:Bp(A[g]?.url),hideDownload:!0,imageBackgroundColor:"#000",className:"yt-byob-modal-desktop-main-image main-image"}),e.createElement("div",{style:{display:"flex",flexDirection:"row",overflowX:"auto",gap:t?"8px":"12px",padding:"12px 0",WebkitOverflowScrolling:"touch",scrollSnapType:"x mandatory",scrollbarWidth:"none",msOverflowStyle:"none"}},A.length>1&&A.filter(e=>e?.url?.length>0).map((n,o)=>e.createElement("img",{key:o,src:Bp(n?.url),alt:n.altText||`${z} - Image ${o+1}`,onClick:()=>x(o),style:{width:t?"60px":"73px",height:t?"60px":"73px",flex:"0 0 auto",scrollSnapAlign:"center",borderRadius:"7px",border:g===o?`2px solid ${a.themeColor||"#111"}`:"1px solid lightgray",objectFit:"cover",cursor:"pointer"},loading:"lazy"})))))),Y=({className:t})=>c?.variants?.edges?.length<=1?null:e.createElement("div",{className:t},e.createElement("div",{className:`${t}-label`,style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid #e0e0e0",paddingBottom:"5px",fontSize:"16px",color:"#999",position:"relative",marginBottom:"10px"}},e.createElement("span",{style:{flexShrink:0}},c.options[0].name," :"," ",e.createElement("strong",{style:{color:"#000",paddingLeft:"5px"}},u?.title)),e.createElement("select",{className:`${t}-select`,value:u?.id||"",onChange:_,style:{appearance:"none",border:"none",background:"transparent",fontWeight:"bold",color:"#000",cursor:"pointer",paddingRight:"20px",position:"absolute",right:0,top:0,bottom:0,width:"100%",opacity:0,zIndex:2}},c?.variants?.edges?.map(({node:t})=>e.createElement("option",{key:t.id,value:t.id,disabled:0===s(t)},t.title))),e.createElement("span",{className:`${t}-chevron`,style:{position:"absolute",right:5,pointerEvents:"none",fontSize:"12px",color:"#000"}},e.createElement(Ge,null)))),X=({isMobile:t})=>e.createElement(e.Fragment,null,c.options.map((n,o)=>e.createElement("div",{key:n.name,style:{display:"flex",flexDirection:"column",gap:8,marginBottom:n?.values?.length>1?16:0}},n?.values?.length>1&&e.createElement(e.Fragment,null,e.createElement("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8}},e.createElement("span",{style:{fontSize:14,fontWeight:500,color:"#333"}},"Select ",n.name),e.createElement("span",{style:{fontSize:12,fontWeight:500,color:"#666",backgroundColor:"#f5f5f5",padding:"4px 12px",borderRadius:16,textTransform:"capitalize"}},B[o]||n.values[0])),e.createElement(Bc,{options:O(n),selectedValue:M(n,o),onChange:e=>{L(o,e)},type:R(n.name),isOptionAvailable:e=>j(o,e),isMobile:t}))))),Z=({isMobile:t})=>e.createElement("div",{className:t?"yt-byob-modal-mobile-price":"yt-byob-modal-desktop-price",style:{width:"fit-content",minWidth:"fit-content",paddingRight:"10px",display:"flex",flexDirection:"row",alignItems:t?"center":"baseline",gap:"6px"}},a?.isFreebieTier&&!a.showFreebieTierProductPrices?e.createElement(e.Fragment,null,e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"20px",textDecoration:"line-through",color:"#888",marginRight:"6px"}},$p(a.styles.general.currencySymbol,a.styles.general.currencySymbol),Sp(u?.price)),e.createElement("span",{className:"yt-byob-current-price",style:{color:a.styles.general.primaryColor||"#d32f2f",fontWeight:"bold",fontSize:"20px"}},"FREE")):e.createElement(e.Fragment,null,u?.compareAtPrice&&parseFloat(u.compareAtPrice)>parseFloat(u?.price)&&e.createElement("div",{className:t?"yt-byob-modal-mobile-compare-price":"yt-byob-modal-desktop-compare-price",style:{textDecoration:"line-through",opacity:"0.5",lineHeight:"normal"}},$p(a.styles.general.currencySymbol,a.styles.general.currencySymbol),Sp(u?.compareAtPrice)),e.createElement("div",{className:t?"yt-byob-modal-mobile-current-price":"yt-byob-modal-desktop-current-price"},e.createElement("span",{style:{fontSize:"20px",fontWeight:"600",color:"#000",textAlign:"center",lineHeight:"normal"}},$p(a.styles.general.currencySymbol,a.styles.general.currencySymbol),Sp(u?.price))))),K=({isMobile:t})=>e.createElement("div",{className:t?"yt-byob-modal-mobile-atc-wrapper":"yt-byob-modal-desktop-atc-wrapper yt-product-modal-atc-wrapper",style:{width:t?"100%":"80%"}},e.createElement("button",{className:t?"yt-byob-modal-mobile-atc-button":"yt-byob-modal-desktop-atc-button yt-product-modal-atc-button",style:{textTransform:"uppercase",fontWeight:"800",width:"100%",border:"none",backgroundColor:a.themeColor||"#111",borderRadius:a.cornerRadius,color:a.primaryTextColorCta||"#fff",minHeight:"40px",padding:"0px 15px",position:"relative",overflow:"hidden",opacity:q?.5:1,cursor:q?"not-allowed":"pointer"},onClick:e=>{e.stopPropagation(),e.preventDefault(),u?.id&&c&&(w("check"),a.handleAddToBundle(u?.id,c,1),setTimeout(()=>{w("idle"),d(void 0)},500))},disabled:q},a.styles.byob.addToBundleCTAText??"Add to bundle")),J=e.createElement(Tc,{className:"yt-byob-modal-desktop-overlay"},e.createElement(Sc,{$isSmallScreen:f,ref:l},e.createElement($c,{ref:l,className:"yt-byob-modal-desktop-container yt-variant-selection-modal"},e.createElement("div",{className:"yt-byob-modal-desktop yt-variant-selection-modal "+(f?"small-screen":"large-screen")},e.createElement(kc,{className:"yt-byob-modal-desktop-close",onClick:()=>{d(void 0)},style:{backgroundColor:"white"}},e.createElement(G,{size:"25"})),e.createElement("div",{className:"yt-byob-modal-desktop-image-section image-section"},e.createElement(U,null)),e.createElement("div",{className:"yt-byob-modal-desktop-details-section details-section",style:{marginLeft:"20px",minHeight:"100%",maxHeight:"70vh",scrollbarWidth:"none",overflowY:"auto",display:"flex",flexDirection:"column"}},e.createElement("h2",{className:"yt-byob-modal-desktop-title"},"variant-display-name"===a?.styles?.byob?.productVariantTitleType?c?.selectedVariant?.displayName:"variant-title"===a?.styles?.byob?.productVariantTitleType?c?.selectedVariant?.title:c?.title),e.createElement(Q,{className:"yt-byob-modal-desktop-rating"}),e.createElement("div",{className:"yt-byob-modal-desktop-variant-price-wrapper",style:{display:"flex",flexDirection:"column",gap:"2px",marginTop:"20px"}},"dropdown"===a?.styles?.byob.variantSelectorType&&e.createElement(Y,{className:"yt-byob-modal-desktop-variant-selector"}),"customOptions"===a?.styles?.byob.variantSelectorType&&e.createElement(X,null),e.createElement("div",{className:"yt-byob-modal-desktop-price-atc-wrapper",style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"}},e.createElement(Z,{isMobile:!1}),e.createElement(K,{isMobile:!1}))),e.createElement("div",{className:"yt-byob-modal-desktop-divider",style:{height:"10px",minHeight:"10px",border:"none",backgroundColor:"#D9D9D96B",margin:"20px 0 10px 0",display:"block !important"}},e.createElement("span",null)),e.createElement("span",{className:"yt-byob-modal-desktop-description yt-description-content",style:{scrollBehavior:"smooth"},dangerouslySetInnerHTML:{__html:F}})))))),ee=e.createElement(Tc,{className:"yt-byob-modal-mobile-overlay"},e.createElement(Sc,{className:"yt-byob-modal-mobile-content",style:{padding:"0px",position:"relative"},$isSmallScreen:f,ref:l},e.createElement($c,{ref:l,className:"yt-byob-modal-mobile-container yt-variant-selection-modal"},e.createElement("button",{className:"yt-byob-modal-mobile-close-btn",style:{position:"fixed",top:"20px",right:"20px",zIndex:9999999999,backgroundColor:"#FFFFFF",padding:"4px",borderRadius:"50%",border:"1px solid lightgray",display:"flex",justifyContent:"center",alignItems:"center"},onClick:()=>{d(void 0)}},e.createElement(Ye,{className:"yt-byob-modal-mobile-close-icon",style:{height:"22px",width:"22px",padding:"4px",color:"black"},onMouseEnter:e=>e.currentTarget.style.color="black"})),e.createElement("div",{className:"yt-byob-modal-mobile yt-variant-selection-modal small-screen",style:{padding:"0px"}},e.createElement("div",{className:"yt-byob-modal-mobile-image-section image-section"},e.createElement(U,{isMobile:!0})),e.createElement("div",{className:"yt-byob-modal-mobile-details-section details-section",style:{padding:"0 30px",margin:"15px 0",paddingBottom:T?`${T+20}px`:"120px"}},e.createElement("h2",{className:"yt-byob-modal-mobile-title",style:{margin:"0px"}},"variant-display-name"===a?.styles?.byob?.productVariantTitleType?c?.selectedVariant?.displayName:"variant-title"===a?.styles?.byob?.productVariantTitleType?c?.selectedVariant?.title:c?.title),e.createElement("div",{style:{paddingBlockStart:"10px"}},e.createElement(Q,{className:"yt-byob-modal-mobile-rating"})),e.createElement("div",{className:"yt-byob-modal-mobile-divider",style:{opacity:"0.2",border:"none",height:"2px",backgroundColor:"#000000",margin:"10px 0px",display:"block !important"}},e.createElement("span",null)),e.createElement("div",{className:"yt-byob-modal-mobile-description yt-description-content",style:{scrollbarWidth:"none",scrollBehavior:"smooth",margin:"0px"},dangerouslySetInnerHTML:{__html:F}})))),e.createElement("div",{className:"yt-byob-modal-mobile-bottom-bar",ref:C,style:{position:"fixed",bottom:"0px",left:"0px",right:"0px",padding:"12px 15px",borderTop:"1px solid lightgray",boxShadow:"0px -4px 5px rgba(0, 0, 0, 0.1)",backgroundColor:"#fff",display:"flex",flexDirection:"column",gap:"2px",zIndex:9999999999}},"customOptions"===a?.styles?.byob.variantSelectorType?e.createElement(X,{isMobile:!0}):e.createElement(Y,{className:"yt-byob-modal-desktop-variant-selector"}),e.createElement("div",{className:"yt-byob-modal-mobile-price-atc-wrapper",style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"}},e.createElement(Z,{isMobile:!0}),e.createElement(K,{isMobile:!0})))));return D.createPortal(f?ee:J,document.body)}),Fc=({coverImageUrl:t,mobileCoverImageUrl:n,alt:o="Background",styles:r})=>{const i=[{imageWidth:21,descriptor:36},{imageWidth:48,descriptor:80},{imageWidth:99,descriptor:165},{imageWidth:216,descriptor:360},{imageWidth:225,descriptor:375},{imageWidth:319,descriptor:533},{imageWidth:330,descriptor:550},{imageWidth:432,descriptor:720},{imageWidth:564,descriptor:940},{imageWidth:639,descriptor:1066},{imageWidth:648,descriptor:1080},{imageWidth:900,descriptor:1500},{imageWidth:1068,descriptor:1780},{imageWidth:1296,descriptor:2160}],a=(e,t)=>{if(e&&e.includes("cdn.shopify"))try{const n=new URL(e),o=n.searchParams;return o.has("format")||o.set("format","webp"),o.has("quality")||o.set("quality","80"),o.set("width",t.toString()),n.toString()}catch{const n=e.includes("?")?"&":"?";return`${e}${n}format=webp&quality=80&width=${t}`}},l=e=>e?i.map(({imageWidth:t,descriptor:n})=>{const o=a(e,t);return o?`${o} ${n}w`:""}).filter(Boolean).join(", "):"";if(!t&&!n)return null;const c=t||n||"",d=a(c,800)||c,s=[];if(n&&n!==t){const t=l(n);t&&s.push(e.createElement("source",{key:"mobile",media:"(max-width: 768px)",srcSet:t}))}if(t){const n=l(t);n&&(s.length>0?s.push(e.createElement("source",{key:"desktop",media:"(min-width: 769px)",srcSet:n})):s.push(e.createElement("source",{key:"desktop",srcSet:n})))}else if(n){const t=l(n);t&&s.push(e.createElement("source",{key:"mobile",srcSet:t}))}return e.createElement("div",{style:{width:"100%",display:"block"}},e.createElement("picture",{style:{display:"block",width:"100%"}},s,e.createElement("img",{src:d,alt:o,style:{width:"100%",height:"auto",display:"block",...r},loading:"eager",fetchPriority:"high",sizes:"100vw"})))},Nc=({title:t,isOpen:n,onToggle:o,children:r})=>e.createElement("div",{className:"yt-byob-filter-section",style:{borderBottom:"1px solid #eee",paddingBottom:n?"20px":"12px",marginBottom:"12px"}},e.createElement("div",{className:"yt-byob-filter-section-header",onClick:o,style:{display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",padding:"8px 0"}},e.createElement("span",{className:"yt-byob-filter-section-title",style:{fontSize:"16px",fontWeight:500,color:"#111"}},t),n?e.createElement(_e,{className:"yt-byob-icon-minus",size:20}):e.createElement(Ne,{className:"yt-byob-icon-plus",size:20})),n&&e.createElement("div",{className:"yt-byob-filter-section-body",style:{marginTop:"16px"}},r)),Pc=({availableFilters:n,appliedFilters:o,toggleFilter:r,clearAllFilters:i,applyPriceFilter:a,priceMin:l,setPriceMin:c,priceMax:d,setPriceMax:s,maxPossiblePrice:p,styles:u,availableProductCount:m,products:g,unavailableProductCount:x,storeCurrencyCode:f,showActions:y=!0,openSections:b,toggleSection:h})=>{const[v,w]=t(null),C=$p(u?.general?.currencySymbol,f)??"₹";return e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-filters-content-wrapper",style:{overflowY:"auto",scrollbarWidth:"none",padding:"20px",flex:1,minHeight:0,overscrollBehavior:"contain"}},n.map(t=>e.createElement(Nc,{key:t.id,title:t.label,isOpen:!!b[t.id],onToggle:()=>h(t.id)},"LIST"===t.type&&e.createElement("div",{className:"yt-byob-filter-list",style:{display:"flex",flexDirection:"column",gap:"14px"}},t.values.map(n=>{const i=o[t.id]?.includes(n.id)||!1,a="filter.v.availability.1"===n.id?m??g.length:"filter.v.availability.0"===n.id?x??0:n.count;return e.createElement("label",{key:n.id,className:"yt-byob-filter-item-label",style:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer"}},e.createElement("div",{className:"yt-byob-filter-item-left",style:{display:"flex",alignItems:"center",gap:"10px"}},e.createElement("input",{className:"yt-byob-filter-checkbox",type:"checkbox",checked:i,onChange:()=>r(t.id,n.id),style:{width:"18px",height:"18px",accentColor:u?.general?.primaryColor||"#333",cursor:"pointer"}}),e.createElement("span",{className:"yt-byob-filter-item-text",style:{fontSize:"15px",color:"#333"}},n.label)),e.createElement("span",{className:"yt-byob-filter-item-count",style:{fontSize:"12px",background:"#f3f4f6",padding:"2px 8px",borderRadius:"4px",color:"#666",minWidth:"24px",textAlign:"center"}},a))})),"PRICE_RANGE"===t.type&&e.createElement("div",{className:"yt-byob-price-filter",style:{padding:"0 4px"}},e.createElement("div",{className:"yt-byob-price-range-display",style:{fontSize:"15px",color:"#333",marginBottom:"24px",fontWeight:500}},C,l.toLocaleString()," – ",C,d.toLocaleString(),d>=p?"+":""),e.createElement("div",{className:"yt-byob-price-slider-container",style:{position:"relative",width:"100%",height:"4px",background:"#e5e7eb",borderRadius:"4px",marginBottom:"10px"}},e.createElement("div",{className:"yt-byob-price-slider-track",style:{position:"absolute",height:"100%",background:"#333",borderRadius:"4px",left:l/p*100+"%",right:100-d/p*100+"%"}}),e.createElement("input",{type:"range",min:0,max:p,value:l,onMouseDown:()=>w("min"),onTouchStart:()=>w("min"),onChange:e=>{const t=Math.min(Number(e.target.value),d-10);c(t)},style:{position:"absolute",width:"100%",height:"0px",top:"50%",transform:"translateY(-50%)",background:"none",pointerEvents:"none",appearance:"none",WebkitAppearance:"none",zIndex:"min"===v?11:5,margin:0},className:"yt-byob-dual-range-input-min"}),e.createElement("input",{type:"range",min:0,max:p,value:d,onMouseDown:()=>w("max"),onTouchStart:()=>w("max"),onChange:e=>{const t=Math.max(Number(e.target.value),l+10);s(t)},style:{position:"absolute",width:"100%",height:"0px",top:"50%",transform:"translateY(-50%)",background:"none",pointerEvents:"none",appearance:"none",WebkitAppearance:"none",zIndex:"max"===v?11:4,margin:0},className:"yt-byob-dual-range-input-max"})),e.createElement("style",null,"\n .yt-byob-dual-range-input-min::-webkit-slider-thumb,\n .yt-byob-dual-range-input-max::-webkit-slider-thumb {\n pointer-events: auto;\n appearance: none;\n width: 22px;\n height: 22px;\n border-radius: 50%;\n background: #444;\n border: 3px solid white;\n cursor: pointer;\n box-shadow: 0 2px 5px rgba(0,0,0,0.2);\n position: relative;\n z-index: 20;\n }\n .yt-byob-dual-range-input-min::-moz-range-thumb,\n .yt-byob-dual-range-input-max::-moz-range-thumb {\n pointer-events: auto;\n width: 22px;\n height: 22px;\n border-radius: 50%;\n background: #444;\n border: 3px solid white;\n cursor: pointer;\n box-shadow: 0 2px 5px rgba(0,0,0,0.2);\n position: relative;\n z-index: 20;\n }\n "))))),y&&e.createElement("div",{className:"yt-byob-filter-actions",style:{display:"flex",gap:"12px",borderTop:"1px solid #eee",padding:"16px 0px",position:"sticky",bottom:"2px",paddingInline:"10px"}},e.createElement("button",{className:"yt-byob-filter-clear-button",onClick:i,style:{flex:1,padding:"8px",background:"#f3f4f6",border:"none",borderRadius:u?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px",color:"#333",fontFamily:"inherit"}},"Clear All"),e.createElement("button",{className:"yt-byob-filter-apply-button",onClick:a,style:{flex:1,padding:"8px",background:u?.general?.primaryColor||"#333",color:"white",border:"none",borderRadius:u?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px",fontFamily:"inherit"}},"Apply")))},Dc=t=>{const{showFiltersDrawer:n,handleClose:o,isAnimating:r,isMobile:i}=t;return n?A(e.createElement("div",{className:"yt-byob-filter-drawer-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:1e3,display:"flex",justifyContent:"flex-end",opacity:r?1:0,transition:"opacity 300ms ease-in-out"},onClick:o},e.createElement("div",{className:"yt-byob-filter-drawer-content",style:{width:i?"85%":"380px",height:"100%",background:"white",boxShadow:"-4px 0 12px rgba(0,0,0,0.15)",transform:r?"translateX(0)":"translateX(100%)",transition:"transform 300ms ease-in-out",display:"flex",flexDirection:"column",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement(Pc,{...t,applyPriceFilter:()=>{t.applyPriceFilter(),o()},openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})}))),document.body):null},Ac=t=>{const{showFiltersDrawer:n}=t;return n&&0!==t?.availableFilters?.length?e.createElement("div",{className:"yt-byob-filters-sidebar",style:{width:"280px",minWidth:"280px",padding:"0",height:"auto",maxHeight:"calc(100vh - 40px)",position:"sticky",top:"20px",display:"flex",flexDirection:"column",borderRight:"1px solid #eee",marginRight:"20px"}},e.createElement(Pc,{...t,showActions:!0,openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})})):null},_c=({enableSortAndFilter:o,isMobile:r,setSearchTerm:i,searchTerm:a,styles:l,setSortBy:c,appliedFilters:d,setAppliedFilters:s,availableFilters:p=[],products:u,availableProductCount:m,unavailableProductCount:g,maxPossiblePrice:x,storeCurrencyCode:f,sharedFiltersState:b,openSections:h,toggleSection:v,sortBy:w})=>{const[C,E]=t(!1),[k,T]=t(a),{showFilters:S,setShowFilters:$,priceMax:B,setPriceMax:I,priceMin:z,setPriceMin:F}=b,[N,P]=t(!1),D=l?.byob?.productFiltersDisplay||"drawer",A=!r&&"sidebar"===D,_="none"===D;n(()=>{d["filter.v.price"]||(I(x),F(0))},[x,d]);n(()=>{const e=setTimeout(()=>{i(k)},300);return()=>clearTimeout(e)},[k,i]),n(()=>(S&&!A?(document.body.style.overflow="hidden",P(!0)):(document.body.style.overflow="",P(!1)),()=>{document.body.style.overflow=""}),[S,A]);const R=Object.entries(d).reduce((e,[t,n])=>"filter.v.price"===t?z>0||B<x?e+1:e:e+(n?n.length:0),0);return e.createElement("div",{className:"yt-byob-sort-filter-container",style:{display:"flex",flexDirection:r?"column":"row",justifyContent:"space-between",alignItems:r?"flex-end":"center",marginBottom:"20px",width:"100%",gap:r?"10px":"0"}},e.createElement("div",{className:"yt-byob-search-filter-controls",style:{display:"flex",flexDirection:o?"row-reverse":"row",justifyContent:"space-between",alignItems:C?void 0:"center",gap:"12px",width:"100%"}},o&&e.createElement("div",{className:"yt-byob-search-wrapper",style:{position:"relative",display:"flex",alignItems:"center",width:r?C?"100%":"auto":"400px",transition:"width 0.3s ease-in-out"}},r&&!C?e.createElement(Pe,{className:"yt-byob-search-icon-trigger",fontSize:"20px",color:"#555",style:{cursor:"pointer"},onClick:()=>E(!0)}):e.createElement(e.Fragment,null,e.createElement("input",{className:"yt-byob-search-input",style:{width:"100%",padding:r?"10px 12px":"10px 14px",fontSize:"14px",outline:"none",color:"#333",border:"1px solid #c7c7c7",borderRadius:l?.byob.borderRadius,boxShadow:l?.byob.borderColor?"0 2px 4px rgba(0,0,0,0.1)":"none"},placeholder:"Search by Product Name",value:k,onChange:e=>T(e.target.value)}),!C&&e.createElement(Pe,{className:"yt-byob-search-icon",fontSize:"18px",style:{position:"absolute",right:"12px",color:"#aaa",pointerEvents:"none"}})),r&&C&&e.createElement("span",{className:"yt-byob-search-close",style:{position:"absolute",right:"12px",color:"#aaa",fontSize:"16px",cursor:"pointer"},onClick:()=>E(!1)},"X")),e.createElement("div",{className:"yt-byob-actions-wrapper",style:{display:"flex",flexDirection:"row",gap:"10px"}},p?.length>0&&e.createElement("button",{className:"yt-byob-filter-toggle-button",onClick:()=>$(!S),style:{display:_?"none":"flex",alignItems:"center",gap:r?"0px":"6px",background:S&&A?"#f3f4f6":"white",cursor:"pointer",fontSize:"14px",color:"#333",whiteSpace:"nowrap",border:"1px solid #d1d5db",padding:"8px 12px",borderRadius:l?.byob.borderRadius,boxShadow:"0 2px 4px rgba(0,0,0,0.1)"}},e.createElement(De,{className:"yt-byob-filter-toggle-icon",size:18}),!r&&"Filters",R>0&&e.createElement("span",{className:"yt-byob-active-filter-badge",style:{background:l?.general?.primaryColor||"#ef4444",color:"white",borderRadius:"999px",padding:"2px 8px",fontSize:"12px",lineHeight:1}},R)),o&&e.createElement("div",{className:"yt-byob-sort-wrapper",style:{display:"flex",alignItems:"center",border:"1px solid #d1d5db",padding:"8px 12px",borderRadius:l?.byob.borderRadius,boxShadow:"0 2px 4px rgba(0,0,0,0.1)",position:"relative"}},!r&&e.createElement("span",{className:"yt-byob-sort-label",style:{fontSize:"14px",color:"#555",marginRight:"6px"}},"Sort:"),r&&e.createElement(Ae,{className:"yt-byob-sort-icon",size:18,style:{color:"#555"}}),e.createElement("select",{className:"yt-byob-sort-select",style:{border:"none",background:"transparent",fontSize:"14px",color:"#333",cursor:"pointer",outline:"none",appearance:"none",WebkitAppearance:"none",paddingRight:"20px"},value:w,onChange:e=>c(e.target.value)},e.createElement("option",{className:"yt-byob-sort-option",value:""},"Featured"),e.createElement("option",{className:"yt-byob-sort-option",value:"price-low-to-high"},"Price: Low to High"),e.createElement("option",{className:"yt-byob-sort-option",value:"price-high-to-low"},"Price: High to Low"),e.createElement("option",{className:"yt-byob-sort-option",value:"title-asc"},"Alphabetical: A-Z"),e.createElement("option",{className:"yt-byob-sort-option",value:"title-desc"},"Alphabetical: Z-A")),e.createElement(y,{className:"yt-byob-sort-chevron",size:14,style:{position:"absolute",right:"10px",pointerEvents:"none",color:"#555"}})))),!A&&!_&&e.createElement(Dc,{showFiltersDrawer:S,handleClose:()=>{A?$(!1):(document.body.style.overflow="",P(!1),setTimeout(()=>{$(!1)},300))},isAnimating:N,isMobile:r,availableFilters:p,appliedFilters:d,toggleFilter:(e,t)=>{s(n=>{const o=n[e]||[],r=o.includes(t)?o.filter(e=>e!==t):[...o,t],i={...n,[e]:r.length?r:void 0};return Object.fromEntries(Object.entries(i).filter(([,e])=>void 0!==e))})},clearAllFilters:()=>{I(x),F(0),s({})},applyPriceFilter:()=>{s(e=>{const t={...e};return t["filter.v.price"]=[`min:${z}-max:${B}`],t})},priceMin:z,setPriceMin:F,priceMax:B,setPriceMax:I,maxPossiblePrice:x,styles:l,availableProductCount:m,products:u,unavailableProductCount:g,storeCurrencyCode:f,openSections:h,toggleSection:v}))};function Rc({quantity:t,setQuantity:n,remainingQuantity:o,handleAddToBundle:r,variantId:i,product:a,handleRemoveItem:l,hideAddToBundle:c,selectedVariantInventoryQty:d}){const s={display:"flex",alignItems:"center",justifyContent:"center",width:"33%",cursor:"pointer",backgroundColor:"#f2f2f2",userSelect:"none",border:"none",padding:"8px",margin:"0",fontSize:"20px",color:"#333",textDecoration:"none",boxShadow:"none",outline:"none",borderRadius:"0",boxSizing:"border-box"},p=t<d;return e.createElement(zl,{className:"yt-byob-quantity-selector-container"},e.createElement("button",{className:"yt-byob-quantity-minus-button",onClick:e=>{e.stopPropagation();const o=Math.max(0,t-1);n(o),l&&i&&l(i,1)},style:s},"-"),e.createElement(Fl,{className:"yt-byob-quantity-display"},t," added"),e.createElement("button",{className:"yt-byob-quantity-plus-button",onClick:e=>{e.stopPropagation();const l=Math.min(o,t+1,d);n(l),r&&i&&a&&r(i,a,1)},disabled:!p||c,style:{...s,cursor:!p||c?"not-allowed":"pointer",opacity:!p||c?.6:1}},"+"))}const Oc=({product:r,styles:i,selectedVariant:a})=>{const[l,c]=t(!1),d=o(()=>Bp(a?.image?.url||r?.featuredMedia?.preview?.image?.url||r?.media?.edges?.[0]?.node?.image?.url)||"",[a?.image?.url,r?.featuredMedia?.preview?.image?.url,r?.media?.edges]),s=o(()=>r?.media?.edges?.map(e=>Bp(e?.node?.preview?.image?.url??e?.node?.image?.url)).filter(Boolean)??[],[r?.media?.edges]),p=o(()=>s?.[1]??d??"",[s,d]);n(()=>{if(d){(new Image).src=d}},[d]);const u=o(()=>d||s?.[0],[d,s]);return e.createElement("div",{className:"yt-byob-image-hover-container",style:{position:"relative",width:"100%",overflow:"hidden",aspectRatio:i.general.imageAspectRatio||"1/1"},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1)},e.createElement("div",{className:"yt-byob-image-inner-container",style:{width:"100%",height:"100%",position:"relative"}},e.createElement("img",{className:"yt-byob-image-main",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",objectPosition:"top",opacity:l&&u!==p?0:1,transition:s?.length>0?"opacity 300ms ease, transform 300ms ease":"",transform:l?"scale(1.1)":"scale(1)"},src:u,alt:r.title}),u!==p&&e.createElement("img",{className:"yt-byob-image-hover",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",opacity:l?1:0,transition:"opacity 400ms ease, transform 400ms ease",transform:l?"scale(1.1)":"scale(1)",position:"absolute",top:0,left:0,objectPosition:"top"},src:p,alt:r.title})))},Lc=({product:o,bundle:r,handleAddToBundle:a,hideAddToBundle:l,remainingQuantity:c,themeColor:d,handleRemoveItem:s,transitionActive:p,idx:u,selecteditems:m,customVariantsQuantity:g,currentProductTier:x,showFreebieTierProductPrices:f,tierIndex:b})=>{const h=le(Ec),v=r.customizations,w=v?.byob?.variantSelectorType,[C,E]=t(!1),k=v.general?.variantTitleSuffix?o?.variants?.edges:(e=>{if(!e||e.length<2)return e;const t=e.map(e=>e.node.title).map(e=>e.split(" "));let n=[...t[0]];for(let e=1;e<t.length;e++){const o=t[e];let r=0;for(;r<n.length&&r<o.length&&n[n.length-1-r]===o[o.length-1-r];)r++;n=n.slice(n.length-r)}return n.length<1?e:e.map(e=>{const t=e.node.title.split(" "),o=t.slice(0,t.length-n.length).join(" ");return{...e,node:{...e.node,title:o,commonSuffix:n.join(" ")}}})})(o?.variants?.edges);if(!k||!k.length)return e.createElement(e.Fragment,null);const T=i(e=>{const t=g?.find(t=>t.variantId===e)?.quantity;if(void 0!==t)return t;if(r?.customProductsQuantity)return r?.customProductsQuantity;const n=k?.find(t=>t.node.id===e),i=n?.node;return i?o.tracksInventory&&i.inventoryItem?.tracked?i.inventoryQuantity>0?i.inventoryQuantity:i.inventoryQuantity<=0&&"continue"===i.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[k,g,o.tracksInventory]),S=k?.find(e=>T(e.node.id)>0)?.node?.id;if(!S&&!v.general.showOutOfStockProducts)return e.createElement(e.Fragment,null);const[$,B]=t(k?.find(e=>T(e.node.id)>0)?.node?.id||k[0]?.node?.id),[I,z]=t(0),[F,N]=t(window.innerWidth<450),[P,D]=t("normal"),A=k?.find(e=>e?.node?.id===$)?.node,_=T($||"");n(()=>{const e=m.find(e=>e.variantId===$&&(void 0===b||e.tierIndex===b));z(e?e.quantity:0)},[m,$,b]),n(()=>{const e=()=>{N(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{CSS.supports("font-weight","500")?D("500"):CSS.supports("font-weight","400")?D("400"):CSS.supports("font-weight","600")&&D("600")},[]),n(()=>{document.documentElement.style.setProperty("--yt-bundle-font-weight",P)},[P]),n(()=>{if($&&!k?.some(e=>e.node.id===$)){const e=k.find(e=>T(e.node.id)>0)?.node.id||k[0]?.node?.id;e&&B(e)}},[$,k,T]);const R=o.variants&&o.variants.edges?.length>1&&"customOptions"!==w,O="undefined"!=typeof window?(window?.ytapp||window?.ytBundleApp)?.storeId:void 0,L="53933408435"===O,M="75851235630"===O,j=(e=>{if(e.metafield&&"yourtoken_bundles_app"===e.metafield.namespace&&"categories"===e.metafield.key){if(e.metafield.jsonValue&&Array.isArray(e.metafield.jsonValue))return e.metafield.jsonValue;if(e.metafield.value)try{const t=JSON.parse(e.metafield.value);if(Array.isArray(t))return t}catch(e){console.error("Failed to parse categories:",e)}}return[]})(o),V=j.length>0;return e.createElement(e.Fragment,null,e.createElement(Dl,{borderRadius:v?.byob.borderRadius,borderColor:v?.byob.borderColor,shadowType:v?.byob.shadowType,backgroundColor:v?.byob.cardBackgroundColor,className:"yt-byob-product-container bundle-builder-product-container "+(p?"yt-product-card-transition-active":u%2==0?"yt-product-card-transition":"yt-product-card-transition-up"),onClick:()=>{if(_<=0)return;const e={...o,variants:{...o.variants,edges:k},selectedVariant:A};h(e)},onMouseEnter:e=>{e.currentTarget.style.transform="scale(1.01)"},onMouseLeave:e=>{e.currentTarget.style.transform="scale(1)"},style:{WebkitTapHighlightColor:"transparent",textAlign:v?.byob?.productCardDetailsAlignment||"left"}},e.createElement(Al,{className:"yt-byob-image-wrapper"},e.createElement(Oc,{product:o,styles:v,selectedVariant:A}),r?.productCardBadgeText&&e.createElement("div",{className:"yt-byob-product-badge",style:{position:"absolute",top:"0px",left:"0px",backgroundColor:v?.general.primaryColor||"#111",color:v?.general.primaryContrastColor||"#fff",zIndex:1,margin:"0px",whiteSpace:"pre",padding:"4px 8px",fontSize:"12px",borderTopLeftRadius:v.byob.borderRadius}},r.productCardBadgeText),R&&e.createElement("div",{className:"yt-byob-variant-selector-wrapper",style:{position:"relative",width:"100%"}},e.createElement(_l,{className:"yt-byob-variant-selector",isCoralHaze:L,onClick:e=>{e.preventDefault(),e.stopPropagation()},value:$||"",onChange:e=>{e.stopPropagation(),e.preventDefault(),B(e.target.value)}},k?.map(t=>{const n=window.innerWidth<=320?10:window.innerWidth<=420?15:22,o=t.node.title.length>n?t.node.title.substring(0,n)+"...":t.node.title;return e.createElement("option",{key:t.node.id,value:t.node.id},o)})),e.createElement("div",{className:"yt-byob-variant-chevron",style:{position:"absolute",right:"16px",bottom:"10px",pointerEvents:"none"}},e.createElement(y,null)))),e.createElement("div",{className:"yt-byob-product-content"},"enabled"===r?.customizations?.byob?.productCardCategoryVisibility&&V&&e.createElement("div",{className:"yt-byob-product-categories-wrapper",style:{padding:"2px 4px"}},e.createElement("div",{className:"yt-byob-product-categories",style:{display:"flex",flexWrap:"wrap",gap:"4px"}},j.slice(0,2).map((t,n)=>e.createElement("span",{className:"yt-byob-category-tag",key:n,style:{fontSize:F?"8px":"12px",color:"#666",fontWeight:"500"}},t.charAt(0).toUpperCase()+t.slice(1))),j.length>2&&e.createElement("span",{className:"yt-byob-more-categories",style:{fontSize:"10px",padding:"2px 6px",backgroundColor:"rgba(0, 0, 0, 0.05)",borderRadius:"8px",color:"#666",fontWeight:"500"}},"+",j.length-2," more"))),e.createElement(Rl,{isMobile:F,showBorder:r?.showBorder??!0,style:{...!v?.byob.productsPriceVisibility&&{padding:"8px"},...v?.byob.productTitleFontSize&&{fontSize:v?.byob.productTitleFontSize||"18px"}},className:"yt-byob-product-title-wrapper"},e.createElement("div",{style:{display:"-webkit-box",WebkitLineClamp:v?.byob?.productTitleWrapLines||2,WebkitBoxOrient:"vertical",overflow:"hidden",lineHeight:"normal"},className:"yt-byob-product-title"},M?String(A?.displayName).replace("- Default Title",""):o.title,A?.commonSuffix?" -"+A?.commonSuffix:""))),"Default Title"!==A?.title&&v?.byob?.showVariantTitleInCard&&e.createElement("p",{style:{padding:r?.showBorder??1?"0px 10px":"0 4px",fontSize:"12px",margin:"0",fontWeight:"600",color:"#888",lineHeight:"normal"},className:"yt-byob-product-variant-title"},A?.title),"ratingOnly"===r?.reviewRatingType&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(Se,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6}},o?.rating?.averageRating," rating")),"ratingAndReviewCount"===r?.reviewRatingType&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(Se,{color:"gold",size:14})," ",o?.rating?.averageRating,e.createElement(he,{className:"yt-byob-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",o?.rating?.ratingCount," reviews)"),v?.byob.productsPriceVisibility&&e.createElement("div",{className:"yt-byob-product-price yt-bundle-builder-product-price",style:{marginBottom:"5px",padding:r?.showBorder?"0px 10px":"0 4px"}},x?.isFreebieTier&&!f?e.createElement(e.Fragment,null,e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"14px",textDecoration:"line-through",color:"#888",marginRight:"6px"}},$p(v.general.currencySymbol,r?.storeCurrencyCode)??"Rs.",Sp(A?.price)),e.createElement("span",{className:"yt-byob-current-price",style:{color:v.general.primaryColor||"#d32f2f",fontWeight:"bold"}},"FREE")):parseFloat(A?.price??"0")>0?e.createElement("span",{className:"yt-byob-current-price"},$p(v.general.currencySymbol,r?.storeCurrencyCode)??"Rs.",Sp(A?.price)):e.createElement("span",{className:"yt-byob-free-price"},"Free"),(!x?.isFreebieTier||f)&&A?.compareAtPrice&&v?.byob.compareAtPriceVisibility&&parseFloat(A.compareAtPrice)>parseFloat(A?.price)&&e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"14px"}},$p(v.general.currencySymbol,r?.storeCurrencyCode)??"Rs.",Sp(A.compareAtPrice))),(_>0||_===1/0)&&e.createElement(Ol,{borderRadius:v?.byob.borderRadius,className:"yt-byob-add-to-bundle-wrapper yt-product-atc-wrapper"},(0===I||void 0===I)&&e.createElement(Nl,{style:{...!l&&{backgroundColor:v?.general.primaryColor||"#111",color:v?.general.primaryContrastColor||"#fff"}},disabled:l,onClick:e=>{e.stopPropagation(),e.preventDefault(),z(1),(()=>{if(!$)return;"customOptions"===w&&k.length>1?E(!0):a($,o,1)})()},className:"yt-byob-add-to-bundle-button yt-product-atc-button"},v?.byob.addToBundleCTAText),!r?.disableQuantitySelector&&I>0&&$&&e.createElement(Pl,{className:"yt-byob-quantity-selector-container visible",style:{overflow:"hidden"}},e.createElement(Rc,{remainingQuantity:c,setQuantity:z,quantity:I,handleAddToBundle:a,variantId:$,product:o,handleRemoveItem:s,hideAddToBundle:l,selectedVariantInventoryQty:_})),r?.disableQuantitySelector&&I>0&&$&&e.createElement(Nl,{style:{backgroundColor:"#747474",color:v?.general.primaryContrastColor||"#fff",display:"flex",justifyContent:"space-between",overflow:"hidden",height:"40px"},className:"yt-byob-added-button yt-product-atc-single-qty-selector"},e.createElement(Ll,{className:"yt-byob-added-text yt-product-atc-single-qty-selector-added"},"ADDED"),e.createElement(Ml,{className:"yt-byob-single-qty-remove yt-product-atc-single-qty-selector-remove",onClick:e=>{e.stopPropagation();const t=Math.max(0,I-1);z(t),s&&$&&s($,b)}},e.createElement(Re,{style:{color:"#fff",fontSize:"20px"}})))),_<=0&&_!==1/0&&e.createElement(Nl,{style:{backgroundColor:v.general.disabledButtonColor,color:"#fff",cursor:"not-allowed",transition:"transform 0.2s ease-in-out"},className:"yt-product-atc-disabled"},v?.general.outOfStockLabel||"Out of Stock")),"customOptions"===w&&C&&k.length>1&&e.createElement(Ic,{product:o,isOpen:C,onClose:()=>E(!1),variantOptions:r.variantOptions,cta:{textColor:v.general.ctaTextColor,backgroundColor:v.general.primaryColor},onConfirm:e=>{B(e),a(e,o,1)}}))},Mc=({currentStep:t,setCurrentProductTier:n,totalSteps:o,tiers:r,isMobile:i,selectedProductsByTier:a,primaryColor:l="#000",primaryTextColorCta:c="#fff",tierNavigation:d})=>e.createElement("div",{className:"yt-byob-stepper-container",style:{textAlign:"center",fontSize:"20px"}},e.createElement("div",{className:"yt-byob-stepper-steps",style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"center"}},Array.from({length:o}).map((c,s)=>{const p=s+1,u=r[s].minimumQuantity-(a[s]?.length??0)===0,m=s===t;return l="black"===l?"#000000":l,e.createElement(e.Fragment,{key:p},e.createElement("div",{className:"yt-byob-stepper-step-wrapper",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:"pointer",gap:i?"4px":"8px"},onClick:()=>!1===d?()=>{}:n(p-1)},e.createElement("div",{className:"yt-byob-stepper-step-number",style:{fontSize:"14px"}},"Step ",p),e.createElement("div",{className:"yt-byob-stepper-step-bar",style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"center",cursor:"pointer"}},e.createElement("div",{className:"yt-byob-stepper-step-left-bar",style:{height:"3px",width:i?"30px":"50px",backgroundColor:u?l:m?"#666666":"#CBD5E0",display:"block",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px"}}),e.createElement("div",{className:"yt-byob-stepper-step-circle",style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:u?`${l}50`:"white",border:`2px solid ${u?l:m?"#666666":"#CBD5E0"}`,display:"flex",alignItems:"center",justifyContent:"center"}}),e.createElement("div",{className:"yt-byob-stepper-step-right-bar",style:{height:"3px",width:i?"30px":"50px",backgroundColor:u?l:m?"#666666":"#CBD5E0",display:"block",marginRight:s<o?i?"4px":"6px":"",borderTopRightRadius:"5px",borderBottomRightRadius:"5px"}}))))})),e.createElement("div",{className:"yt-byob-stepper-title",style:{margin:i?"16px 0px":"15px 0px",fontSize:i?"16px":"18px",padding:"4px",background:"rgba(0, 0, 0, 0.03)",borderBottom:"1px solid rgba(130, 130, 130, 0.28)"}},r[t]?.title)),jc=({styles:t,isMobile:n,categories:o,activeCategory:r,onCategoryChange:i})=>{const a=e=>{i(e)},l=(e,t)=>{const n=e.replace("#","");return`rgba(${parseInt(n.substring(0,2),16)}, ${parseInt(n.substring(2,4),16)}, ${parseInt(n.substring(4,6),16)}, ${t})`};return"tabs"===t?.byob?.categoryFilterOnPage?e.createElement("div",{className:"yt-byob-category-filter-wrapper",style:{overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",width:"100%"}},e.createElement("div",{className:"yt-byob-category-tabs-container",style:{display:"flex",gap:"0px",minWidth:"max-content",paddingBottom:"1px",flexWrap:"nowrap",justifyContent:"center",borderBottom:"1px solid #e0e0e0",width:"auto",height:n?"28px":"45px"}},["All",...o].map(o=>{const i=r===o;return e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-byob-category-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:i?"600":"400",color:i?t.general.primaryColor:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:i?l(t.general.primaryColor,.07):"transparent",borderBottom:i?`2px solid ${t?.general.primaryColor}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:e=>{i||(e.currentTarget.style.color=t?.general.primaryColor)},onMouseLeave:e=>{i||(e.currentTarget.style.color="#666")}},e.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},o.charAt(0).toUpperCase()+o.slice(1)),e.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},o.charAt(0).toUpperCase()+o.slice(1)))}))):e.createElement("div",{className:"yt-byob-category-filter-wrapper",style:{overflowX:n?"auto":"visible",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",paddingBottom:"5px"}},e.createElement("div",{className:"yt-byob-category-buttons-container",style:{display:"flex",gap:"8px",minWidth:"max-content",flexWrap:"nowrap",justifyContent:"center",paddingRight:n?"10px":"0px"}},["All",...o].map(o=>e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-byob-category-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${r===o?t?.general.primaryColor:"#e0e0e0"}`,borderRadius:t?.general.ctaBorderRadius,backgroundColor:r===o?t?.general.primaryColor:"white",color:r===o?"white":"#333",cursor:"pointer",transition:"all 0.3s ease",outline:"none",whiteSpace:"nowrap",minWidth:"fit-content",flexShrink:0},onMouseEnter:e=>{r!==o&&(e.currentTarget.style.borderColor=t?.general.primaryColor,e.currentTarget.style.color=t?.general.primaryColor)},onMouseLeave:e=>{r!==o&&(e.currentTarget.style.borderColor="#e0e0e0",e.currentTarget.style.color="#333")}},o.charAt(0).toUpperCase()+o.slice(1)))))},Vc=(e,t)=>{const n=[],o=e=>!t||0===t.length||t.includes(e);let r=0,i=0;e.forEach(e=>{const t=e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id)),n=t?.some(e=>e.node.availableForSale);n?r++:i++}),o("Availability")&&n.push({id:"filter.v.availability",label:"Availability",type:"LIST",values:[{id:"filter.v.availability.1",label:"In stock",count:r,input:'{"available":true}'},{id:"filter.v.availability.0",label:"Out of stock",count:i,input:'{"available":false}'}]});let a=0;e.forEach(e=>{const t=e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id));t?.forEach(e=>{const t=parseFloat(e.node.price);t>a&&(a=t)})}),o("Price")&&n.push({id:"filter.v.price",label:"Price",type:"PRICE_RANGE",values:[{id:"filter.v.price",label:"Price",count:e.length,input:JSON.stringify({price:{min:0,max:a}})}]});const l={};e.forEach(e=>{const t=e.productDetails.productType;t&&(l[t]=(l[t]||0)+1)}),Object.keys(l).length>0&&o("Product Type")&&n.push({id:"filter.p.product_type",label:"Product Type",type:"LIST",values:Object.entries(l).map(([e,t])=>({id:`filter.p.product_type.${e}`,label:e,count:t,input:JSON.stringify({productType:e})}))});const c={};e.forEach(e=>{const t=e.productDetails.vendor;t&&(c[t]=(c[t]||0)+1)}),Object.keys(c).length>0&&o("Vendor")&&n.push({id:"filter.p.vendor",label:"Vendor",type:"LIST",values:Object.entries(c).map(([e,t])=>({id:`filter.p.vendor.${e}`,label:e,count:t,input:JSON.stringify({vendor:e})}))});const d={};e.forEach(e=>{e.productDetails.tags?.forEach(e=>{e&&(d[e]=(d[e]||0)+1)})}),Object.keys(d).length>0&&o("Tags")&&n.push({id:"filter.p.tag",label:"Tag",type:"LIST",values:Object.entries(d).map(([e,t])=>({id:`filter.p.tag.${e}`,label:e,count:t,input:JSON.stringify({tag:e})}))});const s={};return e.forEach(e=>{(e.productDetails.options||[]).forEach((t,n)=>{if("Title"===t.name)return;s[t.name]||(s[t.name]={});const o=e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id))||[];t.values?.forEach(e=>{void 0===s[t.name][e]&&(s[t.name][e]=0);o.some(t=>(t.node.title.split(" / ")[n]||t.node.title).toLowerCase()===e.toLowerCase())&&s[t.name][e]++})})}),o("Variant Options")&&Object.entries(s).forEach(([e,t])=>{const o=Object.entries(t).filter(([e,t])=>t>0).map(([t,n])=>({id:`${e.toLowerCase()}.${t}`,label:t,count:n,input:JSON.stringify({variantOption:{name:e,value:t}})}));o.length>0&&n.push({id:`filter.v.option.${e.toLowerCase()}`,label:e,type:"LIST",values:o})}),n},Wc=({bundle:a,selectedItems:l,setSelectedItems:c,handleAddToCart:d,bundleAddToCartLoading:s,renderingOnPage:p,selectedItemsQuantity:u,handleRemoveItem:m,bundleSubtotal:g,dispatchAnalyticsEvent:x,fetchStoreDetails:f})=>{const[y,b]=t(void 0),[h,v]=t(window.innerWidth<450),[w,C]=t(0),[E,k]=t({}),T=a.builderTiers?.type,S=a.customizations,$=a.builderTiers?.productTier??[],B=a.builderTiers?.offerTier??[],[I,z]=t([]),[F,N]=t(!1),[P,D]=t("All"),[A,_]=t(0),R=r(null),[O,L]=t({}),[M,j]=t([]),[V,W]=t(!1),[H,q]=t(0),[Q,U]=t(0),[Y,G]=t({}),X=e=>{G(t=>{const n=!1!==t[e];return{...t,[e]:!n}})};n(()=>{M.length>0&&G(e=>{const t={...e};return M.forEach(e=>{void 0===t[e.id]&&(t[e.id]=!1)}),t})},[M]);const Z=a.customStoreDetails?.fixedInventoryDetails;n(()=>{const e=new Set;let t=!1;a?.products?.forEach(n=>{const o=n.productDetails;if(o.metafield&&"yourtoken_bundles_app"===o.metafield.namespace&&"categories"===o.metafield.key){let n=[];if(o.metafield.jsonValue&&Array.isArray(o.metafield.jsonValue))n=o.metafield.jsonValue;else if(o.metafield.value)try{const e=JSON.parse(o.metafield.value);Array.isArray(e)&&(n=e)}catch(e){console.error("Failed to parse categories:",e)}n.length>0&&(t=!0,n.forEach(t=>e.add(t)))}}),z(Array.from(e)),N(t);S?.byob?.productFiltersDisplay&&"none"!==S?.byob?.productFiltersDisplay&&(async()=>{const e=S?.byob?.filtersProvider??"products-data",t=S?.byob?.selectedFilterOptions;if("search-and-discovery-app-sync"===e)try{const e=await(f?.());e?.productFilters&&j(e.productFilters??[])}catch(e){j(Vc(a.products,t))}else j(Vc(a.products,t))})()},[a.products,S?.byob,f]),n(()=>{L({})},[w,P]);const K=((e,t)=>"All"===t?e:e.filter(e=>{const n=e.productDetails;if(n.metafield&&"yourtoken_bundles_app"===n.metafield.namespace&&"categories"===n.metafield.key){let e=[];if(n.metafield.jsonValue&&Array.isArray(n.metafield.jsonValue))e=n.metafield.jsonValue;else if(n.metafield.value)try{const t=JSON.parse(n.metafield.value);Array.isArray(t)&&(e=t)}catch(e){console.error("Failed to parse categories:",e)}return e.includes(t)}return!1}))(a.products.filter(e=>"active"===e.productDetails.status?.toLowerCase()||"unlisted"===e.productDetails.status?.toLowerCase()||void 0===e.productDetails.status||""===e.productDetails.status),P),J="productTier"===T?$.reduce((e,t)=>e+t.minimumQuantity,0):"offerTier"===T?B.reduce((e,t)=>e+t.minimumQuantity,0):a.minimumQuantity,ee=i((e,t)=>{const n=Z?.find(e=>e.variantId===t)?.quantity;if(void 0!==n)return n;const o=(e.variants?.edges||[]).find(e=>e.node.id===t),r=o?.node;return r?e.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[Z]),[te,ne]=t(3e3);n(()=>{let e=0;a.products.forEach(t=>{const n=Number(t.productDetails.variants?.edges?.[0]?.node?.price||0);n>e&&(e=n)}),ne(100*Math.ceil(e/100)||5e3)},[a.products]);const[oe,re]=t(""),[ae,le]=t(""),ce=((e,t)=>e.filter(e=>e?.productDetails?.title?.toLowerCase().includes(t?.toLowerCase())))(K,oe),de=((e,t)=>[...e].sort((e,n)=>{const o=e?.productDetails?.title?.toLowerCase(),r=n?.productDetails?.title?.toLowerCase(),i=parseFloat(e?.productDetails?.variants?.edges?.[0]?.node?.price||"0"),a=parseFloat(n?.productDetails?.variants?.edges?.[0]?.node?.price||"0");switch(t){case"title-asc":return o.localeCompare(r);case"title-desc":return r.localeCompare(o);case"price-low-to-high":return i-a;case"price-high-to-low":return a-i;default:return 0}}))(ce,ae),se=de.filter(e=>((e,t,n,o)=>{if(0===Object.keys(t).length)return!0;for(const[r,i]of Object.entries(t)){if(0===i.length)continue;const a=n.find(e=>e.id===r);if(!a)continue;let l=!1;if("filter.v.price"===r){const n=t[r][0];if(!n)continue;const[o,i]=n.split("-"),a=parseFloat(o.replace("min:",""))||0,c="max:∞"===i?1/0:parseFloat(i.replace("max:",""))||1/0;(e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id))||[]).some(e=>{const t=Number(e.node.price||0);return t>=a&&t<=c})&&(l=!0)}else for(const t of i){const n=a.values.find(e=>e.id===t);if(n)try{const t=JSON.parse(n.input);if(void 0!==t.available){const n=e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id))||[];if(!0===t.available){if(n.some(t=>o(e.productDetails,t.node.id)>0)){l=!0;break}}else if(!1===t.available&&n.every(t=>0===o(e.productDetails,t.node.id))){l=!0;break}}else if(t.productType){if(e.productDetails.productType===t.productType){l=!0;break}}else if(t.vendor){if(e.productDetails.vendor===t.vendor){l=!0;break}}else if(t.tag){if(e.productDetails.tags?.includes(t.tag)){l=!0;break}}else if(t.variantOption){const{name:n,value:o}=t.variantOption,r=e.productDetails.options?.findIndex(e=>e.name===n);if(void 0!==r&&-1!==r){if((e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id))||[]).some(e=>{const t=(e.node.title||"").split(" / ")[r]||e.node.title;return t?.toLowerCase()===o.toLowerCase()})){l=!0;break}}}}catch(e){console.warn("Bad filter input",n.input)}}if(!l)return!1}return!0})(e,O,M,ee)),pe=((e,t,n,o,r)=>(e[r]?.products.filter(e=>t.some(t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0]))&&t?.productDetails.title.toLowerCase().includes(n?.toLowerCase())))||[]).sort((e,n)=>{let r=t.find(t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0]))),i=t.find(e=>e.productId===n.productId&&(n.variantIds.length<1||e.variantIds.includes(n.variantIds[0])));if(!r||!i)return 0;const a=r.productDetails?.title?.toLowerCase(),l=i.productDetails?.title?.toLowerCase(),c=parseFloat(r?.productDetails?.variants?.edges?.[0]?.node?.price||"0"),d=parseFloat(i?.productDetails?.variants?.edges?.[0]?.node?.price||"0");switch(o){case"title-asc":return a.localeCompare(l);case"title-desc":return l.localeCompare(a);case"price-low-to-high":return c-d;case"price-high-to-low":return d-c;default:return 0}}))($,se,oe,ae,w),[ue,me]=ie(Ec),[ge,xe]=t(!1),fe="productTier"===T?pe:se,ye=fe.slice(0,20*(A+1));n(()=>{x?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:a?._id,bundleType:"byob-page-bundle",byobBundleType:a.builderTiers?.type??"builder"}}),setTimeout(()=>{xe(!0)},100)},[]);const be=r(null);n(()=>{const e=()=>{v(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{if(a.coverImageUrl){const e=new Image;e.src=Bp(a.coverImageUrl)??"",e.onload=()=>{b(e.width/e.height)}}},[a.coverImageUrl]),n(()=>{xe(!1),setTimeout(()=>xe(!0),100)},[w]);const he=(e,t)=>{if("productTier"===T){let n={...E},o=!1;if(n[t]){const r=n[t].indexOf(e);-1!==r&&(n[t]=[...n[t]],n[t].splice(r,1),o=!0)}if(!o)for(let t=$.length;t>=0;t--){const o=n[t].indexOf(e);if(-1!==o){n[t]=[...n[t]],n[t].splice(o,1);break}}k(n);const r=$.findIndex((e,t)=>n[t]?.length<e.minimumQuantity);-1!==r&&C(r)}m(e,t)},ve=()=>{const e=document.querySelector(".products-display");e&&e.scrollIntoView({behavior:"smooth"})};n(()=>{if("productTier"===T){const e=Object.fromEntries($.map(e=>[e.tier,[]]));k(e)}},[a]),n(()=>{if("productTier"!==T||!$[w])return;if(J===u)return;const e=$.findIndex((e,t)=>{const n=E[t]||[];return t>=w&&n.length<e.minimumQuantity});if(-1!==e&&e!==w){C(e);$[w].products.length>1&&ve()}},[E,$,T]),n(()=>{re("")},[w]),n(()=>{function e(e){if(!be.current||!e.target)return;!be.current.contains(e.target)&&me(void 0)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const we=(e,t,n)=>{var o;"productTier"===T&&(o=e,k(e=>{const t={...e},n=$.findIndex((e,n)=>{const o=t[n]||[];return n>=w&&o.length<e.minimumQuantity});return-1!==n&&C(n),t[n]||(t[n]=[]),t[n].push(o),t}));const r=!0===$[w]?.isFreebieTier;x?.({eventNameCustom:"byob_add_to_bundle",eventTypeCustom:"clicks",data:{bundleId:a._id,bundleType:"byob-page-bundle",byobBundleType:a.builderTiers?.type??"builder",addedProduct:{id:t?.id,title:t?.title}}}),Ip(e,t,n,l,c,r,w)},Ce=(()=>{if(!a?.builderTiers)return a.minimumQuantity;const{type:e,offerTier:t,productTier:n}=a.builderTiers,o="offerTier"===e?t:"productTier"===e?n:null;if(!o)return a.minimumQuantity;let r=0;return o.map(e=>{r+=e.minimumQuantity}),r})(),Ee=h&&a.mobileCoverImageUrl?Bp(a.mobileCoverImageUrl):Bp(a.coverImageUrl??"")||null,ke=i(e=>{const t=S?.general?.showOutOfStockProducts;if(t)return!0;const n=e.productDetails,o=n?.variants?.edges||[];if(Z){if(o.some(e=>Z.some(t=>t.variantId===e.node.id&&t.quantity>0)))return!0}return o.some(e=>ee(n,e.node.id)>0)},[S?.general?.showOutOfStockProducts,Z,ee]);n(()=>{if("productTier"!==T)return;const e=$[w];if(!e)return;if(1!==e.minimumQuantity)return;if(1!==e.products.length)return;const t=e.products[0],n=a.products.find(e=>e.productId===t.productId)?.productDetails;if(!n)return;if(n.variants?.edges?.length>1)return;const o=n.variants?.edges?.find(e=>ee(n,e.node.id)>0)?.node;if(!o)return;const r=o.id,i=E[w]?.includes(r);if(!i&&(we(r,n,1),w<$.length-1)){C(w+1);const e=$?.[w];e?.products?.length>1&&ve()}},[T,$,w,a.products,E,ee,we]);const Te=o(()=>K.filter(e=>{const t=e.productDetails;return(t.variants?.edges||[]).some(e=>ee(t,e.node.id)>0)}).length,[K,ee]),Se=o(()=>K.length-Te,[K,Te]),$e="bundles"==a.appName?a.pageHeader?.title:a?.title,Be="bundles"==a.appName?a.pageHeader?.description:a?.subtitle;n(()=>{_(0)},[oe,ae,P,w,O]);const Ie=i(()=>{ye.length<fe.length&&_(e=>e+1)},[ye.length,fe.length]);n(()=>{const e=new IntersectionObserver(([e])=>{e.isIntersecting&&Ie()},{threshold:.1});return R.current&&e.observe(R.current),()=>{R.current&&e.unobserve(R.current)}},[Ie]);const ze=()=>{x?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:a._id,bundleType:"byob-page-bundle",byobBundleType:a.builderTiers?.type??"builder",selectedProducts:l.map(e=>({id:e?.product?.id,title:e?.product?.title,quantity:e?.quantity}))}})};return e.createElement(e.Fragment,null,e.createElement("div",{style:{display:"flex",flexDirection:"column",width:"100%",alignItems:"center",justifyContent:"center",rowGap:"15px",padding:"20px 0px",marginBottom:"20px",backgroundColor:S.byob.sectionBackgroundColor,..."transparent"!==S.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},Ee?e.createElement("div",{style:{position:"relative",width:"100%",display:"flex",justifyContent:"center",alignItems:"center",textAlign:"center",overflow:"hidden",...a?.coverImageVerticalMargin&&{marginBottom:a?.coverImageVerticalMargin,marginTop:a?.coverImageVerticalMargin}}},Ee&&e.createElement(Fc,{coverImageUrl:Ee,alt:"Background",styles:{width:"100%",height:"auto",display:"block"}}),e.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",width:"90%",maxWidth:"1000px",textShadow:"2px 2px 8px rgba(0, 0, 0, 0.4)"}},e.createElement("span",{style:{lineHeight:"normal",fontSize:S?.byob?.titleFontSize??"3rem",fontWeight:"700",color:S?.byob?.titleTextColor??"#000",marginBottom:"15px",backgroundColor:S?.byob?.titleBackgroundColor??"transparent",width:"100%",textAlign:"center"},className:"bundle-builder-title"},$e),e.createElement("span",{style:{lineHeight:"normal",fontSize:S?.byob?.subtitleFontSize??"1.5rem",color:S?.byob?.titleTextColor??"#000"},className:"bundle-builder-subtitle"},Be))):($e||Be)&&e.createElement("div",{style:{zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",width:"90%",maxWidth:"1000px"}},$e&&e.createElement("span",{style:{lineHeight:"normal",fontSize:S?.byob?.titleFontSize??"3rem",fontWeight:"700",color:S?.byob?.titleTextColor??"#000",marginBottom:"15px",textAlign:"center",width:"100%",backgroundColor:S?.byob?.titleBackgroundColor??"transparent"}},$e),Be&&e.createElement("span",{style:{lineHeight:"normal",fontSize:S?.byob?.subtitleFontSize??"1.5rem",color:S?.byob?.titleTextColor??"#000"}},Be)),e.createElement("div",{style:{fontSize:"20px",width:"100%"},className:"products-display"},"productTier"===T&&$.length>0&&S?.byob.productTiersVisibility&&e.createElement(e.Fragment,null,e.createElement("div",null,e.createElement(Mc,{currentStep:w,totalSteps:$.length,tiers:$,isMobile:h,primaryColor:S?.general?.primaryColor,primaryTextColorCta:S?.general?.primaryContrastColor,setCurrentProductTier:C,selectedProductsByTier:E,tierNavigation:S.byob.tierNavigation})))),e.createElement("div",{style:{display:"flex",flexDirection:"row",width:h?"100%":"90%",marginInline:"auto"}},"sidebar"===S?.byob?.productFiltersDisplay&&!h&&e.createElement(Ac,{showFiltersDrawer:V,handleClose:()=>W(!1),isAnimating:!1,isMobile:!1,availableFilters:M,appliedFilters:O,toggleFilter:(e,t)=>{L(n=>{const o=n[e]||[],r=o.includes(t)?o.filter(e=>e!==t):[...o,t],i={...n,[e]:r.length?r:void 0};return Object.fromEntries(Object.entries(i).filter(([,e])=>void 0!==e))})},clearAllFilters:()=>{L({}),U(0),q(te)},applyPriceFilter:()=>{L(e=>{const t={...e};return t["filter.v.price"]=[`min:${Q}-max:${H}`],t})},priceMin:Q,setPriceMin:U,priceMax:H,setPriceMax:q,maxPossiblePrice:te,styles:S,products:a.products,unavailableProductCount:Se,storeCurrencyCode:a?.storeCurrencyCode,openSections:Y,toggleSection:X}),e.createElement("div",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0}},e.createElement("div",{style:{width:"100%",marginBottom:"20px",display:"flex",flexDirection:"column",gap:"20px"}},e.createElement(_c,{enableSortAndFilter:a?.enableSortAndFilter??!1,isMobile:h,searchTerm:oe,setSearchTerm:re,setSortBy:le,styles:S,appliedFilters:O,setAppliedFilters:L,availableFilters:M,products:a.products,availableProductCount:Te,unavailableProductCount:Se,maxPossiblePrice:te,storeCurrencyCode:a?.storeCurrencyCode,sharedFiltersState:{showFilters:V,setShowFilters:W,priceMax:H,setPriceMax:q,priceMin:Q,setPriceMin:U},openSections:Y,toggleSection:X}),a?.customizations?.byob?.enableProductCategories&&F&&e.createElement("div",null,e.createElement(jc,{styles:S,isMobile:h,categories:I,activeCategory:P,onCategoryChange:e=>{D(e)}}))),e.createElement("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"12px",justifyContent:V&&"sidebar"===S?.byob?.productFiltersDisplay?"flex-start":"center",width:"100%",height:"fit-content",paddingBottom:p?"100px":"20px"},className:"products-display"},0===fe?.length?e.createElement("p",{style:{fontSize:"20px",color:"#333",textAlign:"center",width:"100%"}},"No products found"):"productTier"===T&&$.length>0?ye.filter(e=>ke(se.find(t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0]))))).map((t,n)=>{const o=($[w]?.minimumQuantity??0)>(E[w]?.length??0),r=se.find(e=>e.productId===t.productId&&(t.variantIds.length<1||e.variantIds.includes(t.variantIds[0])));return r?e.createElement(Lc,{bundle:a,idx:n,key:t?.variantIds?.[0]??t.productId,product:r?.productDetails,handleAddToBundle:we,hideAddToBundle:!o,remainingQuantity:Ce-u,themeColor:a?.dealTextColor,handleRemoveItem:e=>he(e,w),selecteditems:l,transitionActive:ge,customVariantsQuantity:Z,currentProductTier:$[w],showFreebieTierProductPrices:a?.customStoreDetails?.showFreebieTierProductPrices,tierIndex:w}):null}):ye.filter(ke).map((t,n)=>e.createElement(Lc,{bundle:a,idx:n,key:t.productId,product:t?.productDetails,handleAddToBundle:we,hideAddToBundle:u>=Ce,remainingQuantity:Ce-u,themeColor:a?.dealTextColor,handleRemoveItem:m,selecteditems:l,transitionActive:ge,customVariantsQuantity:Z,tierIndex:w})),ye.length<fe.length&&e.createElement("div",{ref:R,style:{height:"1px",width:"100%",display:"block"}})),!p&&e.createElement(Cc,{builderTiers:a?.builderTiers,handleAddToCart:async e=>{await d(e),ze()},minimumQuantity:J,selectedProducts:l,showProductDetailsInTracker:a.showProductDetailsInTracker,handleRemoveItem:m,handleRemoveItemProductTier:he,selectedItemsQuantity:u,percentageOff:a.percentageOff,loading:s,bundleSubtotal:g,amountOff:a.amountOff,styles:a.customizations,dealAmount:a.dealAmount,themeColor:a?.dealTextColor??"#333",primaryTextColorCta:a?.primaryTextColorCta??"#fff",cornerRadiusType:a?.cornerRadiusType??"",selectedProductsByTier:E,renderingOnPage:p}),p&&e.createElement("div",{style:{width:"100%",marginTop:"20px",position:"sticky",bottom:"10px",zIndex:999}},e.createElement(Cc,{handleAddToCart:async e=>{await d(e),ze()},minimumQuantity:J,builderTiers:a?.builderTiers,selectedProducts:l,showProductDetailsInTracker:a.showProductDetailsInTracker,loading:s,handleRemoveItem:m,handleRemoveItemProductTier:he,percentageOff:a.percentageOff,selectedItemsQuantity:u??0,bundleSubtotal:g??{price:0,compareAtPrice:0},amountOff:a.amountOff,styles:a.customizations,dealAmount:a.dealAmount,themeColor:S?.general.primaryColor||"#000",primaryTextColorCta:S.general.primaryContrastColor??"#fff",cornerRadiusType:a?.cornerRadiusType??"",selectedProductsByTier:E,renderingOnPage:p})))),ue&&void 0!==u&&(()=>{let t=u<a.minimumQuantity;return"productTier"==T?t=($[w]?.minimumQuantity??0)>(E[w]?.length??0):"offerTier"==T&&(t=u<B.reduce((e,t)=>e+t.minimumQuantity,0)),e.createElement(zc,{handleAddToBundle:we,ref:be,remainingQuantity:a.minimumQuantity-u,hideAddToBundle:!t,disableQuantitySelector:a?.disableQuantitySelector??!1,selectedProducts:l,selectedProductsByTier:E,themeColor:S?.general.primaryColor||"#000",primaryTextColorCta:a?.customizations?.general.primaryContrastColor??"#fff",primaryBackgroundColorCta:S?.general.primaryColor||"#000",cornerRadius:a?.customizations.byob.borderRadius,styles:a.customizations,reviewRatingType:a?.reviewRatingType??"none",customVariantsQuantity:Z,bundleProductsCustomQuantity:a?.customProductsQuantity,isFreebieTier:$?.[w]?.isFreebieTier,showFreebieTierProductPrices:a?.customStoreDetails?.showFreebieTierProductPrices,bundleVariantOptions:a?.variantOptions})})()))},Hc=({product:t,selectedVariantId:n,onVariantChange:r,styles:i,originalPrice:a,dealPrice:l,totalPriceSum:c,isVertical:d=!1,variantOptions:s,storeCurrencyCode:p})=>{const u=o(()=>e=>{const n=t?.productDetails?.variants?.edges?.find(t=>t.node.id===e),o=n?.node;return o?t.productDetails.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLocaleLowerCase()?1/0:0:1/0:0},[t.productDetails]),m=t?.productDetails?.variants?.edges?.find(e=>e?.node?.id===n)?.node;u(n);const g=o(()=>{if(m?.title&&t.productDetails.options){const e=m.title.split(" / ");if(e.length===t.productDetails.options.length)return e}return t.productDetails.options?.map(e=>e.values[0])||[]},[m,t.productDetails.options]),x=e=>{r(e)};return d?e.createElement("div",{className:"yt-comboBundle-product-card-vertical",style:{display:"flex",flexDirection:"column",alignItems:"center",lineHeight:"normal",width:"165px",backgroundColor:"#F6F6F6",borderRadius:"20px",border:"1px solid #B3B3B3",boxShadow:"4px 4px 0px -1px #00000033",overflow:"hidden"}},e.createElement("div",{className:"yt-comboBundle-product-card-image-container-vertical",style:{position:"relative",width:"100%"}},i.comboBundle.subProductsImageVisibility&&e.createElement(e.Fragment,null,e.createElement("img",{className:"yt-comboBundle-product-image-vertical",src:Bp(m?.image?.url||t?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg"),alt:t?.productDetails?.featuredMedia?.alt,width:165,height:165,style:{objectFit:"cover",borderRadius:"20px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",height:"100%",aspectRatio:i.general?.imageAspectRatio||"1/1"}}),e.createElement("div",{className:"yt-comboBundle-product-variant-selector-container-vertical",style:{marginTop:"8px",position:"absolute",bottom:"10px",left:"5px",right:"5px"}},t?.productDetails?.variants?.edges?.filter(e=>"Default Title"!==e.node.title)?.length>0&&e.createElement(e.Fragment,null,e.createElement("select",{className:"yt-comboBundle-product-variant-select-vertical",value:n,onChange:e=>x(e.target.value),style:{padding:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",width:"100%",appearance:"none",marginRight:"30px",fontSize:"12px",fontWeight:600}},t?.productDetails?.variants?.edges.map(t=>{const n=u(t?.node?.id);return e.createElement("option",{key:t?.node?.id,value:t?.node?.id,disabled:0===n,className:"yt-comboBundle-product-variant-option"},t?.node?.title)})),e.createElement("div",{className:"yt-comboBundle-product-variant-select-icon-vertical",style:{position:"absolute",right:"1px",top:"2px",bottom:"0px",pointerEvents:"none",backgroundColor:"#F3F3F3",width:"15%",height:"calc(100% - 4px)",display:"flex",justifyContent:"center",alignItems:"center"}},e.createElement(y,null)))))),(i.comboBundle.subProductsProductTitleVisibility||i.comboBundle.subProductsProductPriceVisibility)&&e.createElement("div",{className:"yt-comboBundle-product-info-container-vertical",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"40px",width:"100%",paddingBlock:"5px"}},i.comboBundle.subProductsProductTitleVisibility&&e.createElement("span",{className:"yt-comboBundle-product-title-vertical",style:{fontSize:"12px",color:"#333",fontWeight:"600",lineHeight:"normal",textAlign:"center",width:"fit-content"}},t?.productDetails?.title),i.comboBundle.subProductsProductPriceVisibility&&e.createElement("div",{className:"yt-comboBundle-product-price-container-vertical",style:{display:"flex",alignItems:"center",gap:"8px",lineHeight:"normal",fontSize:"14px"}},e.createElement("span",{className:"yt-comboBundle-product-deal-price-vertical",style:{lineHeight:"normal"}},$p(i.general.currencySymbol,p),Sp((Number(m?.price||0)/Number(c)*Number(l)).toFixed(2))),m?.compareAtPrice&&Number(m.compareAtPrice)>Number(m.price)&&e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},$p(i.general.currencySymbol,p),m.compareAtPrice?Sp(m.compareAtPrice):Sp(m.price))))):e.createElement("div",{className:"yt-comboBundle-product-card-horizontal",style:{display:"flex",alignItems:"center",gap:"16px",padding:"4px",lineHeight:"normal",borderRadius:"8px",transition:"background-color 0.3s",width:"100%",border:"1px solid transparent",..."right"===i.comboBundle.infoAlignment&&{flexDirection:"row-reverse"},..."center"===i.comboBundle.infoAlignment&&{justifyContent:"center"}},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#fafafa",e.currentTarget.style.border="1px solid #DFDFDF"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent",e.currentTarget.style.border="1px solid transparent"}},i.comboBundle.subProductsImageVisibility&&e.createElement("div",{className:"yt-comboBundle-product-image-wrapper-horizontal"},e.createElement("img",{className:"yt-comboBundle-product-image-horizontal",src:Bp(m?.image?.url||t?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg"),alt:t?.productDetails?.featuredMedia?.alt,height:80,style:{objectFit:"cover",borderRadius:"10px",border:"1px solid #DEDEDE",aspectRatio:"1/1",width:"90px",height:"90px"}})),e.createElement("div",{className:"yt-comboBundle-product-info-horizontal",style:{display:"flex",flexDirection:"column",alignItems:"left"===i.comboBundle?.infoAlignment?"flex-start":"right"===i.comboBundle?.infoAlignment?"flex-end":"center"===i.comboBundle?.infoAlignment?"flex-start":void 0}},i.comboBundle.subProductsProductTitleVisibility&&e.createElement("span",{className:"yt-comboBundle-product-title-horizontal",style:{fontSize:"14px",fontWeight:"600",lineHeight:"normal",display:"flex",alignItems:"center",gap:"8px"}},e.createElement("span",{className:"yt-comboBundle-product-title-text"}," ",t?.productDetails?.title," "),"dropdown"!==i.comboBundle.comboVariantTypeSelector&&t.productDetails.variants.edges.filter(e=>"Default Title"!==e.node.title).length>0&&s&&g&&e.createElement("span",{className:"yt-comboBundle-product-variant-tag-horizontal",style:{fontSize:"10px",color:"#666",backgroundColor:"#F4F4F4",padding:"2px 8px",borderRadius:"10px",border:"1px solid #ddd"}},g.length>1?g.join(" / "):g)),i.comboBundle.subProductsProductPriceVisibility&&e.createElement("div",{className:"yt-comboBundle-product-price-wrapper-horizontal",style:{display:"flex",gap:"8px",marginTop:"5px",alignItems:"baseline"}},e.createElement("span",{className:"yt-comboBundle-product-deal-price-horizontal",style:{lineHeight:"normal"}},$p(i.general.currencySymbol,p),Sp((Number(m?.price||0)/Number(c)*Number(l)).toFixed(2))),m?.compareAtPrice&&Number(m.compareAtPrice)>Number(m.price)&&e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},$p(i.general.currencySymbol,p),Sp(m?.compareAtPrice?m?.compareAtPrice:m?.price))),t.productDetails.variants.edges.length>1&&("dropdown"===i.comboBundle.comboVariantTypeSelector?e.createElement("div",{className:"yt-comboBundle-product-variant-dropdown-horizontal",style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},e.createElement("select",{className:"yt-comboBundle-product-variant-select-horizontal",value:n,onChange:e=>x(e.target.value),style:{padding:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",fontSize:"12px",fontWeight:600,borderRadius:"4px"}},t.productDetails.variants.edges.map(t=>{const n=u(t?.node?.id);return e.createElement("option",{key:t?.node?.id,value:t?.node?.id,disabled:0===n,className:"yt-comboBundle-product-variant-option"},t?.node?.title)})),e.createElement("div",{className:"yt-comboBundle-product-variant-select-icon-horizontal",style:{position:"absolute",right:"1px",top:"2px",bottom:"0px",pointerEvents:"none",backgroundColor:"#F3F3F3",width:"15%",height:"calc(100% - 4px)",display:"flex",justifyContent:"center",alignItems:"center"}},e.createElement(y,null))):t.productDetails.options.length>0?e.createElement(e.Fragment,null,t.productDetails.options.map((n,o)=>e.createElement("div",{key:n.name,className:"yt-comboBundle-product-option-group-horizontal",style:{...n?.values?.length>1&&{marginTop:"10px"},display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"}},t.productDetails.options.length>1&&n?.values?.length>1&&e.createElement("label",{className:"yt-comboBundle-product-option-label",style:{fontSize:"12px",fontWeight:"500",color:"#333"}},n.name,":"),n?.values?.length>1&&e.createElement("div",{className:"yt-comboBundle-product-option-values-horizontal",style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"}},n.values.map(r=>{const a=[...g];a[o]=r;const l=t.productDetails.options.length>0?a.join(" / "):a[o],c=t.productDetails.variants.edges.find(e=>e.node.title===l)?.node,d=0===(c?u(c.id):0),p=g[o]===r,m=s&&s?.options?.find(e=>e.name===n.name);return m&&"color"===m?.type?e.createElement("button",{key:r,className:`yt-comboBundle-product-option-button-color ${p?"yt-comboBundle-product-option-button-selected":""} ${d?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!d&&c&&x(c.id)},disabled:d,style:{borderRadius:"50%",padding:"1px",backgroundColor:"white",border:p&&!d?`1px solid ${i.general?.ctaBackgroundColor}`:"1px solid transparent",opacity:d?.5:1,cursor:d?"not-allowed":"pointer"}},m?.values.find(e=>e.name===r)?.value?e.createElement("div",{className:"yt-comboBundle-product-option-color-swatch",style:{width:p&&!d?"26px":"24px",height:p&&!d?"26px":"24px",borderRadius:"50%",backgroundColor:m?.values.find(e=>e.name===r)?.value}},e.createElement("span",null)):e.createElement("span",{key:r,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:p&&!d?`1px solid ${i.general?.ctaBackgroundColor}`:d?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:p&&!d?"#F7F7F7":"transparent",color:d?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},r)):m&&"image"===m?.type?e.createElement("button",{key:r,className:`yt-comboBundle-product-option-button-image ${p?"yt-comboBundle-product-option-button-selected":""} ${d?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!d&&c&&x(c.id)},disabled:d,style:{border:p&&!d?`1px solid ${i.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:p&&!d?"#F7F7F7":"transparent",cursor:d?"not-allowed":"pointer",padding:"0px",width:p&&!d?"26px":"24px",height:p&&!d?"26px":"24px",overflow:"hidden",opacity:d?.5:1}},m?.values.find(e=>e.name===r)?.value?e.createElement("img",{className:"yt-comboBundle-product-option-image",src:Bp(m?.values.find(e=>e.name===r)?.value||"/placeholder.svg"),alt:r,style:{width:p&&!d?"26px":"24px",height:p&&!d?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}}):e.createElement("span",{key:r,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:p&&!d?`1px solid ${i.general?.ctaBackgroundColor}`:d?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:p&&!d?"#F7F7F7":"transparent",color:d?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},r)):e.createElement("button",{key:r,className:`yt-comboBundle-product-option-button-text ${p?"yt-comboBundle-product-option-button-selected":""} ${d?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!d&&c&&x(c.id)},disabled:d,style:{padding:"4px 8px",border:p&&!d?`1px solid ${i.general?.ctaBackgroundColor}`:d?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:p&&!d?"#F7F7F7":"transparent",color:d?"#ccc":"#707070",cursor:d?"not-allowed":"pointer",fontSize:"10px",fontWeight:"600",opacity:d?.5:1}},r)}))))):e.createElement(e.Fragment,null,t?.productDetails?.variants?.edges?.length>1&&e.createElement("div",{className:"yt-comboBundle-product-variant-buttons-horizontal",style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},t?.productDetails?.variants?.edges.map(t=>{const o=0===u(t?.node?.id);return e.createElement("button",{key:t?.node?.id,className:`yt-comboBundle-product-variant-button ${n===t?.node?.id?"yt-comboBundle-product-variant-button-selected":""} ${o?"yt-comboBundle-product-variant-button-disabled":""}`,onClick:()=>x(t?.node?.id),disabled:o,style:{padding:"4px 8px",border:n===t?.node?.id?`1px solid ${i.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:n===t?.node?.id?"#F7F7F7":"transparent",color:o?"#ccc":"#707070",cursor:o?"not-allowed":"pointer",fontSize:"12px",fontWeight:"500",opacity:o?.5:1}},t?.node?.title)}))))))},qc=({bundle:r,addToCartFunction:i,dispatchAnalyticsEvent:a})=>{const[l,c]=t(!1),[d,s]=t(window.innerWidth<786),p=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),[u,m]=t(()=>{const e={};return r.products.forEach((t,n)=>{const o=t.productDetails?.variants?.edges?.find(e=>p(t.productDetails,e?.node?.id)>0)?.node;e[n]=o?o.id:t?.productDetails?.variants?.edges[0]?.node?.id}),e});n(()=>(i&&(window.ytComboBundle={bundle:r,addToCart:i,selectedVariants:u},window.dispatchEvent(new CustomEvent("yt-combo-bundle-updated",{detail:window.ytComboBundle}))),()=>{window.ytComboBundle=void 0,window.dispatchEvent(new CustomEvent("yt-combo-bundle-updated",{detail:void 0}))}),[r,i,u]);const g=r.products?.every((e,t)=>{const n=u[t];return p(e.productDetails,n)>0}),x=(e,t)=>{m(n=>({...n,[e]:t}))},{originalPrice:f,dealPrice:y,offerValue:b,totalPriceSum:h}=o(()=>{const{price:e,compareAtPrice:t}=Object.entries(u).reduce((e,[t,n])=>{const o=r.products[parseInt(t)],i=o.productDetails.variants.edges?.find(e=>e.node.id===n)?.node,a=parseFloat(i?.price??"0"),l=parseFloat(i?.compareAtPrice||a.toString());return e.price+=a,e.compareAtPrice+=l,e},{price:0,compareAtPrice:0}),n=Math.max(e,t);let o=Math.min(e,t);r?.percentageOff?o=e*(1-r.percentageOff/100):r?.dealAmount?o=r.dealAmount:r?.amountOff&&(o=e-r.amountOff);const i=t-o;return{originalPrice:n.toFixed(2),dealPrice:o.toFixed(2),offerValue:i.toFixed(2),totalPriceSum:e.toFixed(2)}},[u,r.products,r.percentageOff,r.dealAmount,r.amountOff]);n(()=>{a?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:r._id,bundleType:"combo-bundle"}});const e=()=>{s(window.innerWidth<786)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const v=r.customizations,w=v.comboBundle?.comboCardStyle||"auto",C="vertical"===w||"auto"===w&&!d,E=v.comboBundle?.embedContentVisibility,k="bundles"==r.appName?r.pageHeader?.title:r?.title,T="bundles"==r.appName?r.pageHeader?.description:r?.subtitle;return e.createElement("div",{className:`yt-comboBundle-bundle-container ${"left"===v.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-left":"right"===v.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-right":"center"===v.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-center":void 0}`,style:{lineHeight:"normal",maxWidth:"800px",marginBlock:v.comboBundle?.verticalMargin||"0px",display:"flex",flexDirection:"column",alignItems:"left"===v.comboBundle?.infoAlignment?"flex-start":"right"===v.comboBundle?.infoAlignment?"flex-end":"center"===v.comboBundle?.infoAlignment?"center":void 0,textAlign:v.comboBundle?.infoAlignment??"left",fontFamily:"system-ui, -apple-system, sans-serif"}},E&&v.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Title")&&e.createElement("div",{className:"yt-comboBundle-bundle-title-container",style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"10px"}},e.createElement("h2",{className:"yt-comboBundle-bundle-title",style:{fontSize:v.comboBundle?.productTitleFontSize||"28px",color:v.comboBundle?.titleTextColor||"#000",fontWeight:"bold",lineHeight:"1.6",margin:0}},k)),E&&v?.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Price")&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-comboBundle-bundle-price-container",style:{display:"flex",alignItems:"center",gap:"8px",color:v.comboBundle?.titleTextColor||"#000",fontSize:(parseInt(v.comboBundle?.productTitleFontSize?.replace("px",""))||28)-4+"px"}},e.createElement("div",{className:"yt-comboBundle-bundle-price-details",style:{display:"flex",alignItems:"center",gap:"5px",flexWrap:"wrap"}},e.createElement("span",{className:"yt-comboBundle-bundle-deal-price-text",style:{fontWeight:"bold",lineHeight:"1",minWidth:"fit-content"}},$p(v.general.currencySymbol,r.storeCurrencyCode),Sp(y)),!isNaN(Number(f))&&!isNaN(Number(y))&&Number(f)>Number(y)&&e.createElement("div",{className:"yt-comboBundle-bundle-original-price-text",style:{color:v.comboBundle?.titleTextColor||"#666",textDecoration:"line-through",verticalAlign:"middle",display:"inline-block",minWidth:"fit-content"}},$p(v.general.currencySymbol,r.storeCurrencyCode),Sp(f)),Number(b)>0&&e.createElement("span",{className:"yt-comboBundle-bundle-offer-badge",style:{backgroundColor:"#D3122A",color:"white",padding:"4px 8px",fontSize:"14px",borderRadius:"20px",fontWeight:"500",lineHeight:"1",minWidth:"fit-content"}},r?.percentageOff?`${r?.percentageOff}% Off`:r?.amountOff?`${$p(v.general.currencySymbol,r.storeCurrencyCode)}${Sp(r?.amountOff)} Off`:`Save ${$p(v.general.currencySymbol,r.storeCurrencyCode)}${Sp(b)}`))),e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",margin:"15px 0px"},className:"yt-comboBundle-checkoutSpecific-container"},e.createElement("div",{style:{display:"flex",width:"12px",height:"12px",justifyContent:"center",alignItems:"center",alignContent:"center",borderRadius:"50%",backgroundColor:v.general?.ctaBackgroundColor||"#1e1e1e",flexShrink:0},className:"yt-comboBundle-checkoutSpecific-dot"},e.createElement("span",null)),e.createElement("p",{style:{fontSize:v.comboBundle.productDescriptionFontSize||"16px",color:v.comboBundle?.descriptionTextColor||"#000",alignItems:"center",margin:0,lineHeight:"1.2"},className:"yt-comboBundle-checkoutSpecific-text"},"Tax included. ",e.createElement("u",null,"Shipping")," calculated at checkout."))),v.comboBundle.subProductsSectionVisibility&&e.createElement(e.Fragment,null,C?e.createElement("div",{className:"yt-comboBundle-products-grid-vertical "+(d?"yt-comboBundle-products-grid-mobile":""),style:{display:"flex",flexDirection:"row",gap:"20px",marginTop:"10px",flexWrap:"wrap"}},r.products.map((t,n)=>{const o=t?.productDetails?.variants?.edges?.find(e=>e?.node?.id===u[n])?.node;return o?e.createElement(Hc,{key:`combo-product-${n}-${t.productId}`,product:t,styles:v,originalPrice:f,dealPrice:y,totalPriceSum:h,selectedVariantId:u[n],onVariantChange:e=>x(n,e),isVertical:C,variantOptions:r.variantOptions,storeCurrencyCode:r.storeCurrencyCode}):null})):e.createElement("div",{className:"yt-comboBundle-products-list-horizontal "+(d?"yt-comboBundle-products-list-mobile":""),style:{display:"flex",flexDirection:"column",gap:"10px",width:"100%"}},v.comboBundle.subProductsSectionVisibility&&r.products.map((t,n)=>e.createElement(Hc,{key:`combo-product-horizontal-${n}-${t.productId}`,product:t,styles:v,originalPrice:f,dealPrice:y,totalPriceSum:h,selectedVariantId:u[n],onVariantChange:e=>x(n,e),variantOptions:r.variantOptions})))),e.createElement("div",{className:"yt-comboBundle-bundle-cta-section",style:{borderTop:"1px solid #eee",display:"flex",flexDirection:"column",rowGap:"5px",marginTop:"20px",width:"100%"}},e.createElement("button",{className:`yt-comboBundle-bundle-cta-button ${g?"":"yt-comboBundle-bundle-cta-button-disabled"} ${d?"yt-comboBundle-bundle-cta-button-mobile":""}`,style:{backgroundColor:g?v.general?.ctaBackgroundColor||"#121212":v.general.disabledButtonColor,color:v.general?.ctaTextColor||"#FFFFFF",fontSize:"16px",borderRadius:v.general.ctaBorderRadius??"20px",fontWeight:"bold",cursor:g?"pointer":"not-allowed",border:`1px solid ${g?v.general?.ctaBackgroundColor||"#121212":v.general.disabledButtonColor}`,boxShadow:v.general.ctaShadowType,padding:v.general?.ctaPadding,width:v.general?.ctaWidth,margin:"0"},disabled:!g,onMouseOver:e=>{v.general.customizeHoverState&&g&&(e.currentTarget.style.backgroundColor=v.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=v.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{v.general.customizeHoverState&&g&&(e.currentTarget.style.backgroundColor=v.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=v.general?.ctaTextColor||"#FFFFFF")},onClick:async()=>{const e=Object.entries(u).map(([e])=>({id:r.products[parseInt(e)].productId,title:r.products[parseInt(e)]?.productDetails?.title}));a?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:r._id,bundleType:"combo-bundle",selectedProducts:e}});try{if(c(!0),!i)return console.error("[ComboBundle.tsx] No addToCartFunction available"),void c(!1);const e=Object.entries(u).map(([e,t])=>{const n=r.products[parseInt(e)],o=n.productDetails.variants.edges.find(e=>e.node.id===t)?.node;return o?{variantId:t,price:Number(o.price)}:null}).filter(e=>null!==e),t=Object.values(u);await i(Number(f),t,Number(y),e)}catch(e){console.error("[ComboBundle.tsx] Error adding to cart:",e)}c(!1)}},l?e.createElement(rt,{color:"white",loading:l,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):e.createElement(e.Fragment,null,g?v.comboBundle?.ctaTitle??"Add Bundle to cart":v.general.outOfStockLabel||"Out of Stock"," "))),E&&v.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Description")&&e.createElement("div",{className:"yt-comboBundle-bundle-description-section",style:{margin:"20px 0px"}},e.createElement("h4",{className:"yt-comboBundle-bundle-description-header",style:{fontSize:"16px",color:v.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",margin:0,padding:"8px",backgroundColor:v.general.primaryColor+"20"}},"Description"),e.createElement("div",{className:"yt-comboBundle-bundle-description-content",style:{fontSize:v.comboBundle.productDescriptionFontSize||"16px",color:v.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",padding:"8px",backgroundColor:v.general.primaryColor+"08"}},e.createElement("p",null,T))))},Qc=c.div`
|
|
3149
3149
|
max-width: 800px;
|
|
3150
3150
|
container-type: inline-size;
|
|
3151
3151
|
margin-top: ${e=>e.verticalMargin||"0px"};
|
|
@@ -3451,6 +3451,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
|
|
|
3451
3451
|
min-width: fit-content;
|
|
3452
3452
|
width: fit-content;
|
|
3453
3453
|
z-index: ${e=>e.isActive?"9999":"auto"};
|
|
3454
|
+
border: 1px solid #e0e0e0;
|
|
3454
3455
|
outline: none;
|
|
3455
3456
|
`,hd=c.button`
|
|
3456
3457
|
width: 100%;
|
|
@@ -3463,11 +3464,11 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
|
|
|
3463
3464
|
cursor: pointer;
|
|
3464
3465
|
font-size: 14px;
|
|
3465
3466
|
color: #333;
|
|
3467
|
+
border: 1px solid transparent;
|
|
3466
3468
|
outline: none;
|
|
3467
3469
|
&:hover {
|
|
3468
3470
|
background-color: #eaeaea;
|
|
3469
3471
|
}
|
|
3470
|
-
border: 1px solid #e0e0e0;
|
|
3471
3472
|
`,vd=c.ul`
|
|
3472
3473
|
position: absolute;
|
|
3473
3474
|
top: 100%;
|
|
@@ -3490,7 +3491,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
|
|
|
3490
3491
|
scrollbar-width: none;
|
|
3491
3492
|
|
|
3492
3493
|
-ms-overflow-style: none;
|
|
3493
|
-
`,wd=(e,t)=>{if(!t)return{};for(const n of t)if(n.productId==e)return n;return{}};function Cd({bundle:a,addToCartFunction:l,currentProductId:c,dispatchAnalyticsEvent:d}){const s=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(()=>wd(s,a.products),[s,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(()=>wd(s,a.products)?.id,[s,a.products]));o(()=>C?wd(s,a.products):void 0,[s,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||""),[I,z]=t({}),[F,N]=t(E.reduce((e,t,n)=>(e[t.tier-1]=Array.from({length:t.minimumQuantity},()=>p?.productDetails?.options?.map(e=>e.values[0])||[]),e),{})||{}),[P,D]=t(!1),[A,_]=t(window.innerWidth<550),[R,O]=t(null),[L,M]=t(null);r([]);const j=r([]),V=r(T);n(()=>{if(d?.({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=()=>{_(window.innerWidth<550)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{const e=e=>{R&&j.current[R.index]&&j.current[R.index][R.optionIndex]&&!j.current[R.index][R.optionIndex]?.contains(e.target)&&O(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[R]),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 W=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}),z(e)},[p?.id,E?.map(e=>`${e.tier}-${e.minimumQuantity}`).join("|"),w]);const H=(e,t)=>e?.productDetails?.variants?.edges?.find(e=>e.node.id===t)?.node,q=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(" / "),d=p?.productDetails?.variants?.edges?.find(e=>e.node.title===c)?.node;if(!d||0===w(d))return!1;const s={},u=I[e]||{};for(let e=0;e<a;e++){let n;if(e===t)n=d.id;else{const t=u[e]||$,o=H(p,t);if(!o)return!1;n=o.id}s[n]=(s[n]||0)+1}for(const[e,t]of Object.entries(s)){const n=H(p,e),o=w(n);if(o!==1/0&&t>o)return!1}return!0},[E,p,F,F,I,$,w]),Q=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=(F[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=H(p,e),o=w(n);if(o!==1/0&&t>o)return!1}return!0},[E,p,F,w]);n(()=>{x(e=>e+1)},[I]);const U=(e,t,n)=>{z(o=>({...o,[e]:{...o[e]||{},[t]:n}}))},Y=i(()=>p?.productDetails?.variants?.edges?.find(e=>w(e.node)>0)?.node||p?.productDetails?.variants?.edges?.[0]?.node,[p,w]),G=i(()=>new URLSearchParams(window.location.search).get("variant")||"",[]);n(()=>{V.current=T},[T]),n(()=>{L?(M(null),X()):X()},[T]),n(()=>{if(a){const e=Y();if(e)y(e.id),B(e.id);else{const e=p?.productDetails?.variants?.edges?.[0]?.node?.id||"";y(e),B(e)}}},[a,p,Y]);const X=()=>{const e=G();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=Y();e&&(B(String(e.id)),n=e),x(e=>e+1)}if(n){0===w(n)?(M(null),setTimeout(()=>{M({tier:V.current,index:0,optionIndex:0,value:n.title})},0)):L&&M(null)}}};n(()=>{X();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",X),()=>{t=!1,window.removeEventListener("urlChange",X),window.history.pushState=n,window.history.replaceState=o}},[G,p?.id,Y,w]);const Z=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=I[e]||{};for(let e=0;e<t.minimumQuantity;e++){const t=i[e]||$,a=H(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=o-l,d=n-l,s=o>0?c/o*100:0,u=n>0?d/n*100:0;return{original:n,discounted:l,discountedFromPrice:l,discountedFromCompare:l,diffAmountFromPrice:c,diffAmountFromCompare:d,diffPercentFromPrice:Math.round(s),diffPercentFromCompare:Math.round(u),discountValue:t.discountValue}},K=(e,t,n,o)=>{let r=H(e,t);if(o){const i=I[o]?.[n||0]||t;r=H(e,i)}return r?.image?.url?r.image.url:e.productDetails?.media?.edges[0]?.node?.preview?.image?.url||""};function J(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=I[r.tier]||{};for(let t=0;t<i;t++){let n=e[t];n||(n=$),n&&(a[n]=(a[n]||0)+1)}}const c=Z(r.tier),d=Object.fromEntries(Object.entries(a).map(([e,t])=>[J(e),Math.round(t)])),s=(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&&s("id",J(e))}s("properties[_bundle_price]",String(c.original)),s("properties[_bundle_tier]",String(r.tier)),s("properties[_bundle_items]",JSON.stringify(d));let p=0;Object.entries(d).forEach(([e,t])=>{t>0&&(s(`items[${p}][id]`,e),s(`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&&(L?(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(I),$,b.volumeBundle?.cardStyle,c,f,L]);const ee=o(()=>E.find(e=>e.tier===T),[E,T]),te=o(()=>ee?Z(ee.tier):null,[ee,I,$]),ne=o(()=>{if(!ee||!te)return;const e=I[ee.tier]||{},t={};for(let n=0;n<ee.minimumQuantity;n++){const o=e[n]||$;t[o]=(t[o]||0)+1}return t},[ee?.minimumQuantity,$,I,te]),oe=o(()=>Object.entries(ne??{}).map(([e,t])=>({variantId:e,quantity:t})),[ne]);if(n(()=>{if(!ee||!te)return;const e={tier:T,items:ee.minimumQuantity,discountedPrice:te.discounted,originalPrice:te.original,variants:oe,productId:p?.id??null,tierMeta:{title:ee.title,subtitle:ee.subtitle,badgeTitle:ee.badgeTitle},productData:p,tierData:ee},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:ee,selectedVariants:oe},window.dispatchEvent(new CustomEvent("yt-volume-bundle-updated",{detail:{...e,addToCart:l}})))},50),()=>{u.current&&clearTimeout(u.current)})},[T,ee?.tier,ee?.minimumQuantity,te?.discounted,te?.original,p?.id,JSON.stringify(oe),l,a]),n(()=>()=>{window.ytVolumeBundle=void 0,window.dispatchEvent(new CustomEvent("yt-volume-bundle-updated",{detail:void 0}))},[]),n(()=>{if(!$||!p)return;const e=H(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)}),z(e=>({...e,...n})),N(e=>({...e,...o}))},[$,p?.id,E.length]),!l)return e.createElement(e.Fragment,null);const re=b.volumeBundle?.cardStyle,ie=b.general?.primaryColor,ae=b.general?.secondaryColor,le=b.general.primaryContrastColor,ce=b.general.secondaryContrastColor,de="high"===a.cornerRadiusType?"20px":"medium"===a.cornerRadiusType?"6px":"0px",se="bundles"==a.appName?a.pageHeader?.title:a?.title,pe="bundles"==a.appName?a.pageHeader?.description:a?.subtitle;return n(()=>{const e=Q(T);e?M(null):e||M({tier:T,index:0,optionIndex:0,value:""})},[T,oe,Q]),e.createElement(Qc,{verticalMargin:b.volumeBundle?.verticalMargin,$backgroundColor:b.volumeBundle?.sectionBackgroundColor,className:"yt-bundle-container"},e.createElement(Uc,{className:"yt-bundle-header"},se&&se.trim().length>0&&e.createElement(Yc,{fontSize:b.volumeBundle?.titleFontSize,$backgroundColor:b.volumeBundle?.titleBackgroundColor,textColor:b.volumeBundle?.titleTextColor,className:"yt-bundle-header-title"},se),e.createElement(Gc,{className:"yt-bundle-header-subtitle",fontSize:b.volumeBundle?.subtitleFontSize},pe)),"vertical"===re?e.createElement("div",{style:{display:"grid",gridTemplateColumns:A||4===E.length?"repeat(2, 1fr)":E.length>4?"repeat(3, 1fr)":`repeat(${E.length}, 1fr)`,justifyItems:"center",gap:A?"10px":"16px",paddingTop:"10px"},className:"yt-bundle-vertical-container"},E.map(t=>{const n=Z(t.tier),o=n.original-n.discounted,r=T===t.tier,i=!W(t.tier);return e.createElement(e.Fragment,{key:t.tier},e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"8px",borderRadius:de||"24px",...r?{border:`2px solid ${ie}`}:{border:`1px solid ${ae}`},boxShadow:`6px 6px 0px -1px ${r?ie:ae}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?ie:ae,color:r?le:ce,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&&A&&(()=>{if(!((n?.diffAmountFromPrice>0||n?.diffAmountFromCompare>0)&&(n?.diffPercentFromPrice>0||n?.diffPercentFromCompare>0)))return null;const o=$p(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}${Sp(n.diffAmountFromCompare)}`:""),"discount-on-price"===e&&(i="percentage"===t?n.diffPercentFromPrice>0?`${Math.round(n.diffPercentFromPrice)}% Off`:"":n.diffAmountFromPrice>0?`Save ${o}${Sp(n.diffAmountFromPrice)}`:"")}else n?.discountValue>0&&(i="percentOff"===a?.discountType?`${n.discountValue}% Off`:`Save ${o}${Sp(n.discountValue)}`);return i?e.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"5px",top:"8px"}},e.createElement(ed,{primaryBackgroundColorCta:r?ie:ae,isSelected:r,style:{height:"fit-content",fontSize:"10px",lineHeight:"normal",color:r?le:ce},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:Bp(t.imageUrl),style:{objectFit:"cover",aspectRatio:"1/1",width:"100%",maxHeight:"160px",maxWidth:"160px",height:"fit-content",borderTopLeftRadius:de||"24px",borderTopRightRadius:de||"24px"},className:"yt-volume-vertical-tier-badge"})),e.createElement("div",{style:{padding:"8px",paddingTop:"0"}},e.createElement(td,{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(nd,{style:{fontSize:A?"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&&!A&&(()=>{if(!((n?.diffAmountFromPrice>0||n?.diffAmountFromCompare>0)&&(n?.diffPercentFromPrice>0||n?.diffPercentFromCompare>0)))return null;const o=$p(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}${Sp(n.diffAmountFromCompare)}`:""),"discount-on-price"===e&&(i="percentage"===t?n.diffPercentFromPrice>0?`${Math.round(n.diffPercentFromPrice)}% Off`:"":n.diffAmountFromPrice>0?`Save ${o}${Sp(n.diffAmountFromPrice)}`:"")}else n?.discountValue>0&&(i="percentOff"===a?.discountType?`${n.discountValue}% Off`:`Save ${o}${Sp(n.discountValue)}`);return i?e.createElement(ed,{primaryBackgroundColorCta:r?ie:ae,isSelected:r,style:{height:"fit-content",fontSize:"10px",lineHeight:"normal",color:r?le:ce},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:ie,color:le,padding:"2px"}},e.createElement(Oe,{style:{paddingBottom:"1px"},size:20,fontWeight:20})))),e.createElement(od,{style:{lineHeight:"normal",fontSize:A?"10px":"14px",color:"#666"},className:"yt-volume-vertical-details-subtitle"},t.subtitle?t.subtitle:e.createElement(e.Fragment,null))),W(t.tier)?e.createElement(rd,{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(id,{style:{marginLeft:"0",lineHeight:"normal",marginRight:"8px"},className:"yt-volume-vertical-details-price-discount"},$p(b.general.currencySymbol,a.storeCurrencyCode),Sp(l),"unit-price"===r?"/unit":""),o>0&&e.createElement(ad,{style:{lineHeight:"normal"},className:"yt-volume-vertical-details-price-original"},$p(b.general.currencySymbol,a.storeCurrencyCode),Sp(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:ie,color:le,padding:"2px"}},e.createElement(Oe,{style:{paddingBottom:"1px"},size:20,fontWeight:20})))))})):e.createElement(e.Fragment,null,E.map(t=>{const n=Z(t.tier),o=n.original-n.discounted,r=!W(t.tier);return e.createElement(e.Fragment,{key:t.tier},t.badgeTitle&&e.createElement(Xc,{primaryTextColorCta:le,primaryBackgroundColorCta:ie,style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-badge","data-tier":t.tier,"data-badge-title":t.badgeTitle},t.badgeTitle),e.createElement(Zc,{cornerRadiusType:a?.cornerRadiusType??"",key:t.tier,primaryBackgroundColorCta:ie??"",isSelected:T===t.tier,onClick:()=>S(t.tier),style:{borderRadius:de,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(Kc,{cornerRadiusType:a?.cornerRadiusType??"",style:{borderRadius:de,borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"},className:"yt-volume-horizontal-tier-header"},e.createElement(Jc,{className:"yt-volume-horizontal-tier-info"},e.createElement(pd,{"data-active":T===t.tier,accentColor:ie,className:"yt-volume-horizontal-tier-radio-wrapper"},e.createElement(ud,{name:"tier",checked:T===t.tier,onChange:()=>!r&&S(t.tier),disabled:r,className:"yt-volume-horizontal-tier-radio-hidden"}),e.createElement(md,{accentColor:ie,className:"yt-volume-horizontal-tier-radio-custom"})),e.createElement(td,{className:"yt-volume-horizontal-tier-details"},e.createElement("div",{style:{display:"flex"},className:"yt-volume-horizontal-tier-title-container"},e.createElement(nd,{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=$p(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}${Sp(n.diffAmountFromCompare)}`:""),"discount-on-price"===e&&(r="percentage"===t?n.diffPercentFromPrice>0?`${Math.round(n.diffPercentFromPrice)}% Off`:"":n.diffAmountFromPrice>0?`Save ${o}${Sp(n.diffAmountFromPrice)}`:"")}else n?.discountValue>0&&(r="percentOff"===a?.discountType?`${n.discountValue}% Off`:`Save ${o}${Sp(n.discountValue)}`);return r?e.createElement(ed,{primaryBackgroundColorCta:ie,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(od,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-subtitle"},t.subtitle?t.subtitle:e.createElement(e.Fragment,null)))),W(t.tier)?e.createElement(rd,{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(ad,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-original-price"},$p(b.general.currencySymbol,a.storeCurrencyCode),Sp(i),"unit-price"===r?"/unit":""):"",e.createElement(id,{className:"yt-volume-horizontal-tier-discounted-price"},$p(b.general.currencySymbol,a.storeCurrencyCode),Sp(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(ld,{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=(F[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(gd,{src:Bp(K(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 d=n.values.filter(e=>p.productDetails.variants.edges.some(t=>t.node.title.split(" / ")[c]===e));if(0===d.length||1===d.length&&"Default Title"===d[0])return null;const s=R?.tier===t.tier&&R?.index===o&&R?.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(bd,{key:c,ref:e=>{j.current[o]||(j.current[o]=[]),j.current[o][c]=e},style:{zIndex:s?1e3:"auto",display:"flex",flexDirection:"column",gap:"4px"},isActive:s},b?.volumeBundle?.showVariantOptionsLabel&&n?.name&&e.createElement("p",{style:{lineHeight:"normal",fontSize:"14px",margin:0}},n?.name),e.createElement(hd,{onClick:e=>{e.stopPropagation(),O(s?null:{tier:t.tier,index:o,optionIndex:c})},isActive:s,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($e,{style:{display:"block"}})),s&&e.createElement(vd,{style:{zIndex:1001}},d.map((n,a)=>{const d=[...l];d[c]=n;const s=!q(t.tier,o,l,c,n)||r;p.productDetails.variants.edges.find(({node:e})=>e.title===d.join(" / "));const m=e=>{if(e.preventDefault(),e.stopPropagation(),N(e=>{const t={...e},n=[...t[i]||[]];return n[o]=d,t[i]=n,t}),s){M({tier:T,index:o,optionIndex:c,value:n}),O(null);const e=d.join(" / "),r=p.productDetails.variants.edges.find(t=>t.node.title===e)?.node.id||$;return void U(t.tier,o,r)}const r=d.join(" / "),a=p.productDetails.variants.edges.find(e=>e.node.title===r)?.node.id||$;U(t.tier,o,a),O(null)},g=u?.values.find(e=>e.name===n);return"image"===u?.type&&g?.value?e.createElement(xd,{key:n,onClick:m,style:{cursor:"pointer"}},e.createElement(fd,{src:g.value,alt:n}),n):"color"===u?.type&&g?.value?e.createElement(xd,{key:n,onClick:m,style:{cursor:"pointer"}},e.createElement(yd,{style:{backgroundColor:g.value}}),n):e.createElement(xd,{key:n,onClick:m,style:{cursor:"pointer"}},n)})))})),"swatches"===b?.volumeBundle?.variantSelectorType&&e.createElement(cd,{style:{display:"flex",flexDirection:"column",gap:"5px"},className:"yt-volume-horizontal-tier-variant-selector"},p?.productDetails?.options.map((n,c)=>{const d=n.values.filter(e=>p.productDetails.variants.edges.some(t=>t.node.title.split(" / ")[c]===e));if(0===d.length||1===d.length&&"Default Title"===d[0])return null;const s=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"},d.map(n=>{const a=l[c]===n,d=!q(t.tier,o,l,c,n)||r,u=s?.values.find(e=>e.name===n),m=e=>{if(e.preventDefault(),e.stopPropagation(),d)return;const r=[...l];r[c]=n,N(e=>{const t={...e},n=[...t[i]||[]];return n[o]=r,t[i]=n,t});const a=r.join(" / "),s=p.productDetails.variants.edges.find(e=>e.node.title===a)?.node.id||$;U(t.tier,o,s)},g={opacity:d?.5:1,cursor:d?"not-allowed":"pointer"};return"color"===s?.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:d},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"===s?.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:d},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(dd,{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:d},n)})))})))})),L&&L.tier===t.tier&&e.createElement("div",{style:{color:ie,textAlign:"center",fontSize:"14px",fontStyle:"normal",fontWeight:"500",lineHeight:"110%",background:`${ie}1A`,padding:"12px",borderBottomLeftRadius:de,borderBottomRightRadius:de}},"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(sd,{bgColor:Q(T)?b.general?.ctaBackgroundColor:"#ccc",textColor:Q(T)?b.general?.ctaTextColor:"#666",border:`1px solid ${Q(T)?b.general?.ctaBorderColor||"#121212":"#999"}`,shadow:b.general.ctaShadowType,padding:b.general?.ctaPadding,width:b.general?.ctaWidth,hoverProperties:{customizeHoverState:!!Q(T)&&b.general?.customizeHoverState,backgroundColor:b.general?.ctaHoverBackgroundColor,textColor:b.general?.ctaHoverTextColor},onClick:async()=>{if(Q(T))try{D(!0);const e=E.find(e=>e.tier===T);if(!e)return;const t={},n=I[e.tier]||{};for(let o=0;o<e.minimumQuantity;o++){const e=n[o]||$;t[e]?t[e].quantity+=1:t[e]={quantity:1}}d?.({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(n)}});const o=Z(e.tier),r=Array.from({length:e.minimumQuantity},(e,t)=>n[t]||$);l&&await l(o.original,r)}catch(e){console.error("VolumeBundle handleAddToCart error:",e)}finally{D(!1)}else console.error("Selected tier is out of stock")},borderRadius:b.general.ctaBorderRadius??"",disabled:P||!Q(T),className:"yt-volume-add-to-cart-button"},Q(T)?e.createElement(e.Fragment,null,P?e.createElement(rt,{color:"white",loading:P,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=Z(T);return e.createElement(e.Fragment,null,$p(b.general.currencySymbol,a.storeCurrencyCode),Sp(t.discounted.toFixed(h?0:2))," ",t?.original!==t.discounted&&e.createElement("span",{style:{lineHeight:"normal",textDecoration:"line-through",fontWeight:"550"}},$p(b.general.currencySymbol,a.storeCurrencyCode),Sp(t?.original.toFixed(h?0:2))," "))})()))):e.createElement(e.Fragment,null,"Out of Stock"))))}const Ed=c.div`
|
|
3494
|
+
`,wd=(e,t)=>{if(!t)return{};for(const n of t)if(n.productId==e)return n;return{}};function Cd({bundle:a,addToCartFunction:l,currentProductId:c,dispatchAnalyticsEvent:d}){const s=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(()=>wd(s,a.products),[s,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(()=>wd(s,a.products)?.id,[s,a.products]));o(()=>C?wd(s,a.products):void 0,[s,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||""),[I,z]=t({}),[F,N]=t(E.reduce((e,t,n)=>(e[t.tier-1]=Array.from({length:t.minimumQuantity},()=>p?.productDetails?.options?.map(e=>e.values[0])||[]),e),{})||{}),[P,D]=t(!1),[A,_]=t(window.innerWidth<550),[R,O]=t(null),[L,M]=t(null);r([]);const j=r([]),V=r(T);n(()=>{if(d?.({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=()=>{_(window.innerWidth<550)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{const e=e=>{R&&j.current[R.index]&&j.current[R.index][R.optionIndex]&&!j.current[R.index][R.optionIndex]?.contains(e.target)&&O(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[R]),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 W=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}),z(e)},[p?.id,E?.map(e=>`${e.tier}-${e.minimumQuantity}`).join("|"),w]);const H=(e,t)=>e?.productDetails?.variants?.edges?.find(e=>e.node.id===t)?.node,q=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(" / "),d=p?.productDetails?.variants?.edges?.find(e=>e.node.title===c)?.node;if(!d||0===w(d))return!1;const s={},u=I[e]||{};for(let e=0;e<a;e++){let n;if(e===t)n=d.id;else{const t=u[e]||$,o=H(p,t);if(!o)return!1;n=o.id}s[n]=(s[n]||0)+1}for(const[e,t]of Object.entries(s)){const n=H(p,e),o=w(n);if(o!==1/0&&t>o)return!1}return!0},[E,p,F,F,I,$,w]),Q=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=(F[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=H(p,e),o=w(n);if(o!==1/0&&t>o)return!1}return!0},[E,p,F,w]);n(()=>{x(e=>e+1)},[I]);const U=(e,t,n)=>{z(o=>({...o,[e]:{...o[e]||{},[t]:n}}))},Y=i(()=>p?.productDetails?.variants?.edges?.find(e=>w(e.node)>0)?.node||p?.productDetails?.variants?.edges?.[0]?.node,[p,w]),G=i(()=>new URLSearchParams(window.location.search).get("variant")||"",[]);n(()=>{V.current=T},[T]),n(()=>{L?(M(null),X()):X()},[T]),n(()=>{if(a){const e=Y();if(e)y(e.id),B(e.id);else{const e=p?.productDetails?.variants?.edges?.[0]?.node?.id||"";y(e),B(e)}}},[a,p,Y]);const X=()=>{const e=G();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=Y();e&&(B(String(e.id)),n=e),x(e=>e+1)}if(n){0===w(n)?(M(null),setTimeout(()=>{M({tier:V.current,index:0,optionIndex:0,value:n.title})},0)):L&&M(null)}}};n(()=>{X();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",X),()=>{t=!1,window.removeEventListener("urlChange",X),window.history.pushState=n,window.history.replaceState=o}},[G,p?.id,Y,w]);const Z=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=I[e]||{};for(let e=0;e<t.minimumQuantity;e++){const t=i[e]||$,a=H(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=o-l,d=n-l,s=o>0?c/o*100:0,u=n>0?d/n*100:0;return{original:n,discounted:l,discountedFromPrice:l,discountedFromCompare:l,diffAmountFromPrice:c,diffAmountFromCompare:d,diffPercentFromPrice:Math.round(s),diffPercentFromCompare:Math.round(u),discountValue:t.discountValue}},K=(e,t,n,o)=>{let r=H(e,t);if(o){const i=I[o]?.[n||0]||t;r=H(e,i)}return r?.image?.url?r.image.url:e.productDetails?.media?.edges[0]?.node?.preview?.image?.url||""};function J(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=I[r.tier]||{};for(let t=0;t<i;t++){let n=e[t];n||(n=$),n&&(a[n]=(a[n]||0)+1)}}const c=Z(r.tier),d=Object.fromEntries(Object.entries(a).map(([e,t])=>[J(e),Math.round(t)])),s=(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&&s("id",J(e))}s("properties[_bundle_price]",String(c.original)),s("properties[_bundle_tier]",String(r.tier)),s("properties[_bundle_items]",JSON.stringify(d));let p=0;Object.entries(d).forEach(([e,t])=>{t>0&&(s(`items[${p}][id]`,e),s(`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&&(L?(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(I),$,b.volumeBundle?.cardStyle,c,f,L]);const ee=o(()=>E.find(e=>e.tier===T),[E,T]),te=o(()=>ee?Z(ee.tier):null,[ee,I,$]),ne=o(()=>{if(!ee||!te)return;const e=I[ee.tier]||{},t={};for(let n=0;n<ee.minimumQuantity;n++){const o=e[n]||$;t[o]=(t[o]||0)+1}return t},[ee?.minimumQuantity,$,I,te]),oe=o(()=>Object.entries(ne??{}).map(([e,t])=>({variantId:e,quantity:t})),[ne]);if(n(()=>{if(!ee||!te)return;const e={tier:T,items:ee.minimumQuantity,discountedPrice:te.discounted,originalPrice:te.original,variants:oe,productId:p?.id??null,tierMeta:{title:ee.title,subtitle:ee.subtitle,badgeTitle:ee.badgeTitle},productData:p,tierData:ee},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:ee,selectedVariants:oe},window.dispatchEvent(new CustomEvent("yt-volume-bundle-updated",{detail:{...e,addToCart:l}})))},50),()=>{u.current&&clearTimeout(u.current)})},[T,ee?.tier,ee?.minimumQuantity,te?.discounted,te?.original,p?.id,JSON.stringify(oe),l,a]),n(()=>()=>{window.ytVolumeBundle=void 0,window.dispatchEvent(new CustomEvent("yt-volume-bundle-updated",{detail:void 0}))},[]),n(()=>{if(!$||!p)return;const e=H(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)}),z(e=>({...e,...n})),N(e=>({...e,...o}))},[$,p?.id,E.length]),!l)return e.createElement(e.Fragment,null);const re=b.volumeBundle?.cardStyle,ie=b.general?.primaryColor,ae=b.general?.secondaryColor,le=b.general.primaryContrastColor,ce=b.general.secondaryContrastColor,de="high"===a.cornerRadiusType?"20px":"medium"===a.cornerRadiusType?"6px":"0px",se="bundles"==a.appName?a.pageHeader?.title:a?.title,pe="bundles"==a.appName?a.pageHeader?.description:a?.subtitle;return n(()=>{const e=Q(T);e?M(null):e||M({tier:T,index:0,optionIndex:0,value:""})},[T,oe,Q]),e.createElement(Qc,{verticalMargin:b.volumeBundle?.verticalMargin,$backgroundColor:b.volumeBundle?.sectionBackgroundColor,className:"yt-bundle-container"},e.createElement(Uc,{className:"yt-bundle-header"},se&&se.trim().length>0&&e.createElement(Yc,{fontSize:b.volumeBundle?.titleFontSize,$backgroundColor:b.volumeBundle?.titleBackgroundColor,textColor:b.volumeBundle?.titleTextColor,className:"yt-bundle-header-title"},se),e.createElement(Gc,{className:"yt-bundle-header-subtitle",fontSize:b.volumeBundle?.subtitleFontSize},pe)),"vertical"===re?e.createElement("div",{style:{display:"grid",gridTemplateColumns:A||4===E.length?"repeat(2, 1fr)":E.length>4?"repeat(3, 1fr)":`repeat(${E.length}, 1fr)`,justifyItems:"center",gap:A?"10px":"16px",paddingTop:"10px"},className:"yt-bundle-vertical-container"},E.map(t=>{const n=Z(t.tier),o=n.original-n.discounted,r=T===t.tier,i=!W(t.tier);return e.createElement(e.Fragment,{key:t.tier},e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"8px",borderRadius:de||"24px",...r?{border:`2px solid ${ie}`}:{border:`1px solid ${ae}`},boxShadow:`6px 6px 0px -1px ${r?ie:ae}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?ie:ae,color:r?le:ce,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&&A&&(()=>{if(!((n?.diffAmountFromPrice>0||n?.diffAmountFromCompare>0)&&(n?.diffPercentFromPrice>0||n?.diffPercentFromCompare>0)))return null;const o=$p(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}${Sp(n.diffAmountFromCompare)}`:""),"discount-on-price"===e&&(i="percentage"===t?n.diffPercentFromPrice>0?`${Math.round(n.diffPercentFromPrice)}% Off`:"":n.diffAmountFromPrice>0?`Save ${o}${Sp(n.diffAmountFromPrice)}`:"")}else n?.discountValue>0&&(i="percentOff"===a?.discountType?`${n.discountValue}% Off`:`Save ${o}${Sp(n.discountValue)}`);return i?e.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"5px",top:"8px"}},e.createElement(ed,{primaryBackgroundColorCta:r?ie:ae,isSelected:r,style:{height:"fit-content",fontSize:"10px",lineHeight:"normal",color:r?le:ce},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:Bp(t.imageUrl),style:{objectFit:"cover",aspectRatio:"1/1",width:"100%",maxHeight:"160px",maxWidth:"160px",height:"fit-content",borderTopLeftRadius:de||"24px",borderTopRightRadius:de||"24px"},className:"yt-volume-vertical-tier-badge"})),e.createElement("div",{style:{padding:"8px",paddingTop:"0"}},e.createElement(td,{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(nd,{style:{fontSize:A?"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&&!A&&(()=>{if(!((n?.diffAmountFromPrice>0||n?.diffAmountFromCompare>0)&&(n?.diffPercentFromPrice>0||n?.diffPercentFromCompare>0)))return null;const o=$p(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}${Sp(n.diffAmountFromCompare)}`:""),"discount-on-price"===e&&(i="percentage"===t?n.diffPercentFromPrice>0?`${Math.round(n.diffPercentFromPrice)}% Off`:"":n.diffAmountFromPrice>0?`Save ${o}${Sp(n.diffAmountFromPrice)}`:"")}else n?.discountValue>0&&(i="percentOff"===a?.discountType?`${n.discountValue}% Off`:`Save ${o}${Sp(n.discountValue)}`);return i?e.createElement(ed,{primaryBackgroundColorCta:r?ie:ae,isSelected:r,style:{height:"fit-content",fontSize:"10px",lineHeight:"normal",color:r?le:ce},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:ie,color:le,padding:"2px"}},e.createElement(Oe,{style:{paddingBottom:"1px"},size:20,fontWeight:20})))),e.createElement(od,{style:{lineHeight:"normal",fontSize:A?"10px":"14px",color:"#666"},className:"yt-volume-vertical-details-subtitle"},t.subtitle?t.subtitle:e.createElement(e.Fragment,null))),W(t.tier)?e.createElement(rd,{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(id,{style:{marginLeft:"0",lineHeight:"normal",marginRight:"8px"},className:"yt-volume-vertical-details-price-discount"},$p(b.general.currencySymbol,a.storeCurrencyCode),Sp(l),"unit-price"===r?"/unit":""),o>0&&e.createElement(ad,{style:{lineHeight:"normal"},className:"yt-volume-vertical-details-price-original"},$p(b.general.currencySymbol,a.storeCurrencyCode),Sp(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:ie,color:le,padding:"2px"}},e.createElement(Oe,{style:{paddingBottom:"1px"},size:20,fontWeight:20})))))})):e.createElement(e.Fragment,null,E.map(t=>{const n=Z(t.tier),o=n.original-n.discounted,r=!W(t.tier);return e.createElement(e.Fragment,{key:t.tier},t.badgeTitle&&e.createElement(Xc,{primaryTextColorCta:le,primaryBackgroundColorCta:ie,style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-badge","data-tier":t.tier,"data-badge-title":t.badgeTitle},t.badgeTitle),e.createElement(Zc,{cornerRadiusType:a?.cornerRadiusType??"",key:t.tier,primaryBackgroundColorCta:ie??"",isSelected:T===t.tier,onClick:()=>S(t.tier),style:{borderRadius:de,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(Kc,{cornerRadiusType:a?.cornerRadiusType??"",style:{borderRadius:de,borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"},className:"yt-volume-horizontal-tier-header"},e.createElement(Jc,{className:"yt-volume-horizontal-tier-info"},e.createElement(pd,{"data-active":T===t.tier,accentColor:ie,className:"yt-volume-horizontal-tier-radio-wrapper"},e.createElement(ud,{name:"tier",checked:T===t.tier,onChange:()=>!r&&S(t.tier),disabled:r,className:"yt-volume-horizontal-tier-radio-hidden"}),e.createElement(md,{accentColor:ie,className:"yt-volume-horizontal-tier-radio-custom"})),e.createElement(td,{className:"yt-volume-horizontal-tier-details"},e.createElement("div",{style:{display:"flex"},className:"yt-volume-horizontal-tier-title-container"},e.createElement(nd,{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=$p(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}${Sp(n.diffAmountFromCompare)}`:""),"discount-on-price"===e&&(r="percentage"===t?n.diffPercentFromPrice>0?`${Math.round(n.diffPercentFromPrice)}% Off`:"":n.diffAmountFromPrice>0?`Save ${o}${Sp(n.diffAmountFromPrice)}`:"")}else n?.discountValue>0&&(r="percentOff"===a?.discountType?`${n.discountValue}% Off`:`Save ${o}${Sp(n.discountValue)}`);return r?e.createElement(ed,{primaryBackgroundColorCta:ie,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(od,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-subtitle"},t.subtitle?t.subtitle:e.createElement(e.Fragment,null)))),W(t.tier)?e.createElement(rd,{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(ad,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-original-price"},$p(b.general.currencySymbol,a.storeCurrencyCode),Sp(i),"unit-price"===r?"/unit":""):"",e.createElement(id,{className:"yt-volume-horizontal-tier-discounted-price"},$p(b.general.currencySymbol,a.storeCurrencyCode),Sp(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(ld,{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=(F[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(gd,{src:Bp(K(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:"8px",flexWrap:"wrap"}},p?.productDetails?.options?.map((n,c)=>{const d=n.values.filter(e=>p.productDetails.variants.edges.some(t=>t.node.title.split(" / ")[c]===e));if(0===d.length||1===d.length&&"Default Title"===d[0])return null;const s=R?.tier===t.tier&&R?.index===o&&R?.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(bd,{key:c,ref:e=>{j.current[o]||(j.current[o]=[]),j.current[o][c]=e},style:{zIndex:s?1e3:"auto",display:"flex"},isActive:s},e.createElement(hd,{onClick:e=>{e.stopPropagation(),O(s?null:{tier:t.tier,index:o,optionIndex:c})},isActive:s,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($e,{style:{display:"block"}})),s&&e.createElement(vd,{style:{zIndex:1001}},d.map((n,a)=>{const d=[...l];d[c]=n;const s=!q(t.tier,o,l,c,n)||r;p.productDetails.variants.edges.find(({node:e})=>e.title===d.join(" / "));const m=e=>{if(e.preventDefault(),e.stopPropagation(),N(e=>{const t={...e},n=[...t[i]||[]];return n[o]=d,t[i]=n,t}),s){M({tier:T,index:o,optionIndex:c,value:n}),O(null);const e=d.join(" / "),r=p.productDetails.variants.edges.find(t=>t.node.title===e)?.node.id||$;return void U(t.tier,o,r)}const r=d.join(" / "),a=p.productDetails.variants.edges.find(e=>e.node.title===r)?.node.id||$;U(t.tier,o,a),O(null)},g=u?.values.find(e=>e.name===n);return"image"===u?.type&&g?.value?e.createElement(xd,{key:n,onClick:m,style:{cursor:"pointer"}},e.createElement(fd,{src:g.value,alt:n}),n):"color"===u?.type&&g?.value?e.createElement(xd,{key:n,onClick:m,style:{cursor:"pointer"}},e.createElement(yd,{style:{backgroundColor:g.value}}),n):e.createElement(xd,{key:n,onClick:m,style:{cursor:"pointer"}},n)})))})),"swatches"===b?.volumeBundle?.variantSelectorType&&e.createElement(cd,{style:{display:"flex",flexDirection:"column",gap:"5px"},className:"yt-volume-horizontal-tier-variant-selector"},p?.productDetails?.options.map((n,c)=>{const d=n.values.filter(e=>p.productDetails.variants.edges.some(t=>t.node.title.split(" / ")[c]===e));if(0===d.length||1===d.length&&"Default Title"===d[0])return null;const s=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"},e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"},className:"yt-volume-horizontal-tier-variant-values"},d.map(n=>{const a=l[c]===n,d=!q(t.tier,o,l,c,n)||r,u=s?.values.find(e=>e.name===n),m=e=>{if(e.preventDefault(),e.stopPropagation(),d)return;const r=[...l];r[c]=n,N(e=>{const t={...e},n=[...t[i]||[]];return n[o]=r,t[i]=n,t});const a=r.join(" / "),s=p.productDetails.variants.edges.find(e=>e.node.title===a)?.node.id||$;U(t.tier,o,s)},g={opacity:d?.5:1,cursor:d?"not-allowed":"pointer"};return"color"===s?.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:d},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"===s?.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:d},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(dd,{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:d},n)})))})))})),L&&L.tier===t.tier&&e.createElement("div",{style:{color:ie,textAlign:"center",fontSize:"14px",fontStyle:"normal",fontWeight:"500",lineHeight:"110%",background:`${ie}1A`,padding:"12px",borderBottomLeftRadius:de,borderBottomRightRadius:de}},"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(sd,{bgColor:Q(T)?b.general?.ctaBackgroundColor:"#ccc",textColor:Q(T)?b.general?.ctaTextColor:"#666",border:`1px solid ${Q(T)?b.general?.ctaBorderColor||"#121212":"#999"}`,shadow:b.general.ctaShadowType,padding:b.general?.ctaPadding,width:b.general?.ctaWidth,hoverProperties:{customizeHoverState:!!Q(T)&&b.general?.customizeHoverState,backgroundColor:b.general?.ctaHoverBackgroundColor,textColor:b.general?.ctaHoverTextColor},onClick:async()=>{if(Q(T))try{D(!0);const e=E.find(e=>e.tier===T);if(!e)return;const t={},n=I[e.tier]||{};for(let o=0;o<e.minimumQuantity;o++){const e=n[o]||$;t[e]?t[e].quantity+=1:t[e]={quantity:1}}d?.({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(n)}});const o=Z(e.tier),r=Array.from({length:e.minimumQuantity},(e,t)=>n[t]||$);l&&await l(o.original,r)}catch(e){console.error("VolumeBundle handleAddToCart error:",e)}finally{D(!1)}else console.error("Selected tier is out of stock")},borderRadius:b.general.ctaBorderRadius??"",disabled:P||!Q(T),className:"yt-volume-add-to-cart-button"},Q(T)?e.createElement(e.Fragment,null,P?e.createElement(rt,{color:"white",loading:P,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=Z(T);return e.createElement(e.Fragment,null,$p(b.general.currencySymbol,a.storeCurrencyCode),Sp(t.discounted.toFixed(h?0:2))," ",t?.original!==t.discounted&&e.createElement("span",{style:{lineHeight:"normal",textDecoration:"line-through",fontWeight:"550"}},$p(b.general.currencySymbol,a.storeCurrencyCode),Sp(t?.original.toFixed(h?0:2))," "))})()))):e.createElement(e.Fragment,null,"Out of Stock"))))}const Ed=c.div`
|
|
3494
3495
|
container-type: inline-size;
|
|
3495
3496
|
border-radius: ${e=>e.borderRadius?e.borderRadius:"8px"};
|
|
3496
3497
|
max-width: 800px;
|