yt-uikit 0.8.15-productTier-freebie-update.1 → 0.8.15-productTier-freebie-update.2
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/components/BundleBlock/BundleProductDetailsModal/BundleProductDetailsModal.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ type BundleProductDetailsModalProps = {
|
|
|
28
28
|
quantity: number;
|
|
29
29
|
variantId: string;
|
|
30
30
|
}[];
|
|
31
|
+
bundleProductsCustomQuantity?: number | null;
|
|
31
32
|
};
|
|
32
33
|
declare const BundleProductDetailsModal: React.ForwardRefExoticComponent<BundleProductDetailsModalProps & React.RefAttributes<HTMLDivElement>>;
|
|
33
34
|
export default BundleProductDetailsModal;
|
package/dist/esm/index.js
CHANGED
|
@@ -3538,7 +3538,7 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
|
|
|
3538
3538
|
font-size: 1em;
|
|
3539
3539
|
justify-content: center;
|
|
3540
3540
|
align-items: center;
|
|
3541
|
-
`;const af=n(((e,n)=>{const[r,o]=Jt(gm),a=i((()=>t=>{const n=e?.customVariantsQuantity?.find((e=>e.variantId===t?.id))?.quantity;return void 0!==n?n:t?r?.tracksInventory&&t.inventoryItem?.tracked?t.inventoryQuantity>0?t.inventoryQuantity:t.inventoryQuantity<=0&&"continue"===t.inventoryPolicy?1/0:0:1/0:0}),[r?.tracksInventory,e?.customVariantsQuantity]),s=r?.variants.edges?.filter((e=>a(e.node)>0))||[],[d,p]=c(s?.[0]?.node),[u,m]=c(0),[f,g]=c("undefined"!=typeof window&&window.innerWidth<=600),[h,x]=c(1),[y,b]=c("idle"),[w,C]=c(null),[k,E]=c(null);l((()=>{if(r){const e=r.variants.edges?.filter((e=>a(e.node)>0));p(r?.selectedVariant??e[0]?.node)}}),[r,a]),l((()=>{const t=e.selectedProducts.find((e=>e.variantId===d?.id));x(t?t.quantity:0)}),[h,e.selectedProducts,d]);const T=()=>{d?.id&&r&&(b("check"),e.handleAddToBundle(d?.id,r,1),setTimeout((()=>{b("idle"),o(void 0)}),500))};if(l((()=>{const e=()=>g(window.innerWidth<=600);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[]),!r)return null;const{title:S,descriptionHtml:$,media:B,variants:z}=r,I=B.edges.map((e=>e?.node.preview.image??e?.node.image)).filter((e=>e?.url?.length>0));l((()=>{if(r&&d?.image?.url&&Array.isArray(I)){const e=I.findIndex((e=>e?.url===d?.image?.url));-1!==e&&e!==u&&m(e)}}),[d]);const N=e=>{const t=e.target.value,n=s?.find((e=>e.node.id===t))?.node;n&&a(n)>0&&p(n)};l((()=>{if(r){window.history.pushState({modalOpen:!0},"",window.location.href);const e=e=>{o(void 0),e.preventDefault()};return window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e),window.history.state?.modalOpen&&window.history.back()}}}),[r,o]);const D=e=>{C(e.targetTouches[0].clientX),E(null)},_=e=>{E(e.targetTouches[0].clientX)},P=()=>{if(null!==w&&null!==k&&I.length>1){const e=w-k,t=50;e>t?m((e=>e<I.length-1?e+1:0)):e<-t&&m((e=>e>0?e-1:I.length-1))}C(null),E(null)},O=Object.values(e.selectedProductsByTier||{}).reduce(((e,t)=>e+(t?.filter((e=>e===d?.id)).length||0)),0),A=e.customVariantsQuantity?.find((e=>e.variantId===d?.id))?.quantity,F=void 0!==A&&O>=A,M=e.hideAddToBundle||a(d)<=0||e.disableQuantitySelector&&O>=1||F||"idle"!==y,R=t.createElement(nf,{className:"yt-byob-modal-desktop-overlay"},t.createElement(rf,{$isSmallScreen:f,ref:n},t.createElement(of,{ref:n,className:"yt-byob-modal-desktop-container yt-variant-selection-modal"},t.createElement("div",{className:"yt-byob-modal-desktop yt-variant-selection-modal "+(f?"small-screen":"large-screen")},t.createElement(tf,{className:"yt-byob-modal-desktop-close",onClick:()=>{o(void 0)},style:{backgroundColor:"white"}},t.createElement(ft,{size:"25"})),t.createElement("div",{className:"yt-byob-modal-desktop-image-section image-section"},t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-byob-modal-desktop-image-swipe",onTouchStart:D,onTouchMove:_,onTouchEnd:P},t.createElement(ef,{small:Jh(I[u]?.url),medium:Jh(I[u]?.url),large:Jh(I[u]?.url),hideDownload:!0,className:"yt-byob-modal-desktop-main-image main-image",imageBackgroundColor:"#000"})),t.createElement("div",{className:"yt-byob-modal-desktop-image-gallery image-gallery",style:{display:"flex",flexDirection:"row",overflow:"auto",gap:"10px",scrollbarWidth:"none"}},I.length>1&&I.filter((e=>e?.url.length>0)).map(((n,r)=>t.createElement("img",{key:r,className:"yt-byob-modal-desktop-gallery-thumb "+(u===r?"active":""),src:Jh(n?.url),alt:n.altText||`${S} - Image ${r+1}`,onClick:()=>m(r),style:{width:"73px",height:"73px",cursor:"pointer",borderRadius:"7px",border:"1px solid lightgray",...u===r&&{border:`2px solid ${e.themeColor||"#111"}`},objectFit:"cover"},loading:"lazy"})))))),t.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"}},t.createElement("h2",{className:"yt-byob-modal-desktop-title"},s.length>1?d?.displayName:r.title),"ratingOnly"===e.reviewRatingType&&(r?.rating?.averageRating??0)>0&&t.createElement("div",{className:"yt-byob-modal-desktop-rating",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Kr,{color:"gold",size:14})," ",t.createElement("span",{style:{marginLeft:6}},r?.rating?.averageRating,"rating")),"ratingAndReviewCount"===e.reviewRatingType&&(r?.rating?.averageRating??0)>0&&t.createElement("div",{className:"yt-byob-modal-desktop-rating-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Kr,{color:"gold",size:14})," ",r?.rating?.averageRating,t.createElement(tr,{size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",r?.rating?.ratingCount," reviews)"),t.createElement("div",{className:"yt-byob-modal-desktop-variant-price-wrapper",style:{display:"flex",flexDirection:"column",gap:"2px",marginTop:"20px"}},s.length>1&&t.createElement("div",{className:"yt-byob-modal-desktop-variant-selector"},t.createElement("div",{className:"yt-byob-modal-desktop-variant-label",style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid #e0e0e0",paddingBottom:"5px",fontSize:"16px",color:"#999",position:"relative",marginBottom:"10px"}},t.createElement("span",{style:{flexShrink:0}},r.options[0].name," :"," ",t.createElement("strong",{style:{color:"#000",paddingLeft:"5px"}},d?.title)),t.createElement("select",{className:"yt-byob-modal-desktop-variant-select",value:d?.id||"",onChange:N,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}},s.map((({node:e})=>t.createElement("option",{key:e.id,value:e.id,disabled:0===a(e)},e.title)))),t.createElement("span",{className:"yt-byob-modal-desktop-variant-chevron",style:{position:"absolute",right:5,pointerEvents:"none",fontSize:"12px",color:"#000"}},t.createElement(go,null)))),t.createElement("div",{className:"yt-byob-modal-desktop-price-atc-wrapper",style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"}},t.createElement("div",{className:"yt-byob-modal-desktop-price",style:{width:"fit-content",minWidth:"fit-content",paddingRight:"10px",display:"flex",flexDirection:"column"}},d?.compareAtPrice&&parseFloat(d.compareAtPrice)>parseFloat(d?.price)&&t.createElement("div",{className:"yt-byob-modal-desktop-compare-price",style:{textDecoration:"line-through",opacity:"0.5",lineHeight:"normal"}},Kh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),Xh(d?.compareAtPrice)),t.createElement("div",{className:"yt-byob-modal-desktop-current-price"},t.createElement("span",{style:{fontSize:"20px",fontWeight:"600",color:"#000",textAlign:"center",lineHeight:"normal"}},Kh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),Xh(d?.price)))),t.createElement("div",{className:"yt-byob-modal-desktop-atc-wrapper yt-product-modal-atc-wrapper",style:{width:"80%"}},t.createElement("button",{className:"yt-byob-modal-desktop-atc-button yt-product-modal-atc-button",style:{textTransform:"uppercase",fontWeight:"800",width:"100%",border:"none",backgroundColor:e.themeColor||"#111",borderRadius:e.cornerRadius,color:e.primaryTextColorCta||"#fff",minHeight:"40px",padding:"0px 15px",position:"relative",overflow:"hidden",opacity:M?.5:1,cursor:M?"not-allowed":"pointer"},onClick:e=>{e.stopPropagation(),e.preventDefault(),T()},disabled:M},e.styles.byob.addToBundleCTAText??"Add to bundle")))),t.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"}},t.createElement("span",null)),t.createElement("span",{className:"yt-byob-modal-desktop-description yt-description-content",style:{scrollBehavior:"smooth"},dangerouslySetInnerHTML:{__html:$}})))))),L=t.createElement(nf,{className:"yt-byob-modal-mobile-overlay"},t.createElement(rf,{className:"yt-byob-modal-mobile-content",style:{padding:"0px",position:"relative"},$isSmallScreen:f,ref:n},t.createElement(of,{ref:n,className:"yt-byob-modal-mobile-container yt-variant-selection-modal"},t.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:()=>{o(void 0)}},t.createElement(ho,{className:"yt-byob-modal-mobile-close-icon",style:{height:"22px",width:"22px",padding:"4px",color:"black"},onMouseEnter:e=>e.currentTarget.style.color="black"})),t.createElement("div",{className:"yt-byob-modal-mobile yt-variant-selection-modal small-screen",style:{padding:"0px"}},t.createElement("div",{className:"yt-byob-modal-mobile-image-section image-section"},t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-byob-modal-mobile-image-swipe",style:{position:"relative"},onTouchStart:D,onTouchMove:_,onTouchEnd:P},t.createElement(ef,{small:Jh(I[u]?.url),medium:Jh(I[u]?.url),large:Jh(I[u]?.url),hideDownload:!0,className:"yt-byob-modal-mobile-main-image main-image",imageBackgroundColor:"#000"}),t.createElement("div",{className:"yt-byob-modal-mobile-image-indicators",style:{position:"absolute",bottom:"20px",width:"100%",display:"flex",justifyContent:"center",alignItems:"center"}},I.length>1&&I.map(((e,n)=>t.createElement("span",{key:n,className:"yt-byob-modal-mobile-indicator "+(u===n?"active":""),style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:u===n?"#FFFFFF":"#EBEBEB",margin:"0 3px",cursor:"pointer",backdropFilter:"blur(10px)"}}))))),t.createElement("div",{className:"yt-byob-modal-mobile-image-gallery image-gallery",style:{display:"flex",flexDirection:"row",overflowX:"auto",padding:"5px 20px",gap:"5px",scrollbarWidth:"none"}},I.length>1&&I.map(((n,r)=>t.createElement("img",{key:r,className:"yt-byob-modal-mobile-gallery-thumb "+(u===r?"active":""),src:Jh(n?.url),alt:n.altText||`${S} - Image ${r+1}`,onClick:()=>m(r),style:{width:"60px",height:"60px",cursor:"pointer",borderRadius:"7px",border:"1px solid lightgray",...u===r&&{border:`2px solid ${e.themeColor||"#111"}`},objectFit:"cover"},loading:"lazy"})))))),t.createElement("div",{className:"yt-byob-modal-mobile-details-section details-section",style:{padding:"0 30px",margin:"15px 0",paddingBottom:"120px"}},t.createElement("h2",{className:"yt-byob-modal-mobile-title",style:{margin:"0px"}},s.length>1?d?.displayName:r.title),"ratingOnly"===e.reviewRatingType&&(e?.rating?.averageRating??0)>0&&t.createElement("div",{className:"yt-byob-modal-mobile-rating",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Kr,{color:"gold",size:14})," ",t.createElement("span",{style:{marginLeft:6}},e?.rating?.averageRating," rating")),"ratingAndReviewCount"===e.reviewRatingType&&(e?.rating?.averageRating??0)>0&&t.createElement("div",{className:"yt-byob-modal-mobile-rating-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Kr,{color:"gold",size:14})," ",e?.rating?.averageRating,t.createElement(tr,{className:"yt-byob-modal-mobile-verified-icon",style:{color:"dodgerblue",marginLeft:"4px"},size:14})," ","(",e?.rating?.ratingCount," reviews)"),t.createElement("div",{className:"yt-byob-modal-mobile-divider",style:{opacity:"0.2",border:"none",height:"2px",backgroundColor:"#000000",margin:"10px 0px",display:"block !important"}},t.createElement("span",null)),t.createElement("div",{className:"yt-byob-modal-mobile-description yt-description-content",style:{scrollbarWidth:"none",scrollBehavior:"smooth",margin:"0px"},dangerouslySetInnerHTML:{__html:$}})))),t.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}},s.length>1&&t.createElement("div",{className:"yt-byob-modal-mobile-variant-selector"},t.createElement("div",{className:"yt-byob-modal-mobile-variant-label",style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid #e0e0e0",paddingBottom:"5px",fontSize:"16px",color:"#999",position:"relative",margin:"10px 0"}},t.createElement("span",{style:{flexShrink:0}},r.options[0].name," :"," ",t.createElement("strong",{style:{color:"#000",paddingLeft:"5px"}},d?.title)),t.createElement("select",{className:"yt-byob-modal-mobile-variant-select",value:d?.id||"",onChange:N,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}},s.map((({node:e})=>t.createElement("option",{key:e.id,value:e.id,disabled:0===a(e)},e.title)))),t.createElement("span",{className:"yt-byob-modal-mobile-variant-chevron",style:{position:"absolute",right:5,pointerEvents:"none",fontSize:"12px",color:"#000"}},t.createElement(go,null)))),t.createElement("div",{className:"yt-byob-modal-mobile-price-atc-wrapper",style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"}},t.createElement("div",{className:"yt-byob-modal-mobile-price",style:{width:"fit-content",minWidth:"fit-content",display:"flex",flexDirection:"column",paddingRight:"10px"}},d?.compareAtPrice&&t.createElement("div",{className:"yt-byob-modal-mobile-compare-price",style:{textDecoration:"line-through",opacity:"0.5",lineHeight:"normal"}},Kh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),Xh(d?.compareAtPrice)),t.createElement("div",{className:"yt-byob-modal-mobile-current-price"},t.createElement("span",{style:{fontSize:"20px",fontWeight:"600",color:"#000",textAlign:"center",lineHeight:"normal"}},Kh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),Xh(d?.price)))),!e.hideAddToBundle&&a(d)>0&&(!e?.disableQuantitySelector||h<1)&&t.createElement("div",{className:"yt-byob-modal-mobile-atc-wrapper",style:{width:"100%"}},t.createElement("button",{className:"yt-byob-modal-mobile-atc-button",style:{textTransform:"uppercase",fontWeight:"800",width:"100%",cursor:"pointer",border:"none",backgroundColor:e.themeColor||"#111",borderRadius:e.cornerRadius,color:e.primaryTextColorCta||"#fff",minHeight:"40px",padding:"0px 15px",position:"relative",overflow:"hidden"},onClick:e=>{e.stopPropagation(),e.preventDefault(),T()},disabled:"idle"!==y},e.styles.byob.addToBundleCTAText||"Add to Bundle"))))));return v.createPortal(f?L:R,document.body)})),lf=({options:e,selectedValue:n,onChange:r,type:o="text",isOptionAvailable:a,isMobile:i})=>t.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"}},e?.map((e=>{const l=!a||a(e.name);return i&&!l?null:t.createElement("div",{key:e.name,onClick:()=>{l&&r(e)},style:{cursor:l?"pointer":"not-allowed"}},((e,n)=>{const r=!a||a(e.name),i={cursor:r?"pointer":"not-allowed",border:n?"2px solid #333":"1px solid #d1d5db",transition:"all 0.2s ease",opacity:r?1:.5};if("color"===o)return e.value&&(()=>{if(!e.value.trim())return!1;if(e.value===e.name||e.value.length<3)return!1;try{const t=document.createElement("div");return t.style.color=e.value,""!==t.style.color}catch{return!1}})()?t.createElement("div",{style:{...i,width:24,height:24,borderRadius:"50%",backgroundColor:e.value}}):t.createElement("div",{style:{...i,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"}},e.name);return"image"===o?t.createElement("img",{src:Nn(e.value,48,85,"webp")||"/placeholder.svg",alt:e.name,style:{...i,width:24,height:24,borderRadius:"50%",objectFit:"cover"}}):t.createElement("div",{style:{...i,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"}},e.name)})(e,n?.name===e.name))}))),cf=({product:e,isOpen:n,onClose:r,variantOptions:o,cta:a,onConfirm:s})=>{const d=i((()=>t=>t?e?.tracksInventory&&t?.inventoryItem?.tracked?t.inventoryQuantity>0?t?.inventoryQuantity:t.inventoryQuantity<=0&&"continue"===t.inventoryPolicy?1/0:0:1/0:0),[e?.tracksInventory]),p=i((()=>{const t=e.variants.edges.find((e=>{const t=e.node;return d(t)>0}))?.node;return t?.title&&"Default Title"!==t.title?t.title.split(" / "):e.options?.map((e=>e.values[0]))||[]}),[e,d]),[u,m]=c(p),[f,g]=c(window.innerWidth<1024);l((()=>{const e=()=>g(window.innerWidth<1024);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[]),l((()=>{const e=e=>{"Escape"===e.key&&r()};return n&&document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}),[n,r]);const h=e.variants.edges.find((t=>t.node.title===(e.options?.length>0?u.join(" / "):u[0])))?.node,x=h?.image?.url||e.featuredMedia?.preview?.image?.url,y=Nn(x,150,85,"webp"),b=e=>{if(!o?.options)return"text";const t=o.options.find((t=>t.name===e));return t?.type||"text"},w=e=>{if(!o?.options)return e.values.map((e=>({name:e,value:e})));const t=o.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}}))},C=(e,t)=>{const n=u[t];if(!n)return null;return w(e).find((e=>e.name===n))||null};if(!n)return null;const k=t.createElement("div",{onClick:r,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"},t.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"}}},t.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"),t.createElement("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"16px 20px",borderBottom:"1px solid #f0f0f0"}},t.createElement("img",{src:y,alt:e.title,style:{width:60,height:60,borderRadius:8,objectFit:"cover",flexShrink:0,transition:"opacity 0.3s ease"}}),t.createElement("div",{style:{display:"flex",flexDirection:"column",flex:1,gap:4}},t.createElement("div",{style:{fontSize:14,fontWeight:600,color:"#333"}},e.title))),t.createElement("div",{style:{padding:"20px"}},e.options.map(((n,r)=>t.createElement("div",{key:n.name,style:{display:"flex",flexDirection:"column",gap:8,marginBottom:n?.values?.length>1?16:0}},n?.values?.length>1&&t.createElement(t.Fragment,null,t.createElement("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8}},t.createElement("span",{style:{fontSize:14,fontWeight:500,color:"#333"}},"Select ",n.name),t.createElement("span",{style:{fontSize:12,fontWeight:500,color:"#666",backgroundColor:"#f5f5f5",padding:"4px 12px",borderRadius:16,textTransform:"capitalize"}},C(n,r)?.name||n.values[0])),t.createElement(lf,{options:w(n),selectedValue:C(n,r),onChange:e=>{((e,t)=>{const n=[...u];n[e]=t.name,m(n)})(r,e)},type:b(n.name),isOptionAvailable:t=>((t,n)=>{const r=[...u];r[t]=n;const o=e.options?.length>0?r.join(" / "):r[0],a=e.variants.edges.find((e=>e.node.title===o))?.node;return!!a&&d(a)>0})(r,t),isMobile:f})))))),t.createElement("button",{onClick:()=>{const t=e.variants.edges.find((t=>t.node.title===(e.options?.length>0?u.join(" / "):u[0])))?.node,n=!!t&&d(t)>0;if(t?.id&&n)s(t.id),r();else{console.warn("yt::variant options modal - selected variant not available or out of stock:",u);const t=e.variants.edges.find((e=>d(e.node)>0))?.node.id;t&&(s(t),r())}},style:{width:"100%",fontSize:14,fontWeight:600,textTransform:"uppercase",backgroundColor:a.backgroundColor,color:a.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 v.createPortal(k,document.body)},sf=({coverImageUrl:e,mobileCoverImageUrl:n,alt:r="Background",styles:o})=>{const a=[{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}],i=(e,t)=>{if(e&&e.includes("cdn.shopify"))try{const n=new URL(e),r=n.searchParams;return r.has("format")||r.set("format","webp"),r.has("quality")||r.set("quality","80"),r.set("width",t.toString()),n.toString()}catch{const n=e.includes("?")?"&":"?";return`${e}${n}format=webp&quality=80&width=${t}`}},l=e=>e?a.map((({imageWidth:t,descriptor:n})=>{const r=i(e,t);return r?`${r} ${n}w`:""})).filter(Boolean).join(", "):"";if(!e&&!n)return null;const c=e||n||"",s=i(c,800)||c,d=[];if(n&&n!==e){const e=l(n);e&&d.push(t.createElement("source",{key:"mobile",media:"(max-width: 768px)",srcSet:e}))}if(e){const n=l(e);n&&(d.length>0?d.push(t.createElement("source",{key:"desktop",media:"(min-width: 769px)",srcSet:n})):d.push(t.createElement("source",{key:"desktop",srcSet:n})))}else if(n){const e=l(n);e&&d.push(t.createElement("source",{key:"mobile",srcSet:e}))}return t.createElement("div",{style:{width:"100%",display:"block"}},t.createElement("picture",{style:{display:"block",width:"100%"}},d,t.createElement("img",{src:s,alt:r,style:{width:"100%",height:"auto",display:"block",...o},loading:"eager",fetchPriority:"high",sizes:"100vw"})))};function df({quantity:e,setQuantity:n,remainingQuantity:r,handleAddToBundle:o,variantId:a,product:i,handleRemoveItem:l,hideAddToBundle:c,selectedVariantInventoryQty:s}){const d={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=e<s;return t.createElement(Cu,{className:"yt-byob-quantity-selector-container"},t.createElement("button",{className:"yt-byob-quantity-minus-button",onClick:t=>{t.stopPropagation();const r=Math.max(0,e-1);n(r),l&&a&&l(a,1)},style:d},"-"),t.createElement(ku,{className:"yt-byob-quantity-display"},e," added"),t.createElement("button",{className:"yt-byob-quantity-plus-button",onClick:t=>{t.stopPropagation();const l=Math.min(r,e+1,s);n(l),o&&a&&i&&o(a,i,1)},disabled:!p||c,style:{...d,cursor:!p||c?"not-allowed":"pointer",opacity:!p||c?.6:1}},"+"))}const pf=({product:e,styles:n,selectedVariant:r})=>{const[o,a]=c(!1),s=i((()=>Jh(r?.image?.url||e?.featuredMedia?.preview?.image?.url||e?.media?.edges?.[0]?.node?.image?.url)||""),[r?.image?.url,e?.featuredMedia?.preview?.image?.url,e?.media?.edges]),d=i((()=>e?.media?.edges?.map((e=>Jh(e?.node?.preview?.image?.url??e?.node?.image?.url))).filter(Boolean)??[]),[e?.media?.edges]),p=i((()=>d?.[1]??s??""),[d,s]);l((()=>{if(s){(new Image).src=s}}),[s]);const u=i((()=>s||d?.[0]),[s,d]);return t.createElement("div",{className:"yt-byob-image-hover-container",style:{position:"relative",width:"100%",overflow:"hidden",aspectRatio:n.general.imageAspectRatio||"1/1"},onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1)},t.createElement("div",{className:"yt-byob-image-inner-container",style:{width:"100%",height:"100%",position:"relative"}},t.createElement("img",{className:"yt-byob-image-main",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",objectPosition:"top",opacity:o&&u!==p?0:1,transition:d?.length>0?"opacity 300ms ease, transform 300ms ease":"",transform:o?"scale(1.1)":"scale(1)"},src:u,alt:e.title}),u!==p&&t.createElement("img",{className:"yt-byob-image-hover",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",opacity:o?1:0,transition:"opacity 400ms ease, transform 400ms ease",transform:o?"scale(1.1)":"scale(1)",position:"absolute",top:0,left:0,objectPosition:"top"},src:p,alt:e.title})))},uf=({product:e,bundle:n,handleAddToBundle:r,hideAddToBundle:o,remainingQuantity:i,themeColor:s,handleRemoveItem:d,transitionActive:p,idx:u,selecteditems:m,customVariantsQuantity:f,currentProductTier:g,showFreebieTierProductPrices:h})=>{const x=Kt(gm),y=n.customizations,b=y?.byob?.variantSelectorType,[v,w]=c(!1),C=y.general?.variantTitleSuffix?e?.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 r=t[e];let o=0;for(;o<n.length&&o<r.length&&n[n.length-1-o]===r[r.length-1-o];)o++;n=n.slice(n.length-o)}return n.length<1?e:e.map((e=>{const t=e.node.title.split(" "),r=t.slice(0,t.length-n.length).join(" ");return{...e,node:{...e.node,title:r,commonSuffix:n.join(" ")}}}))})(e?.variants?.edges);if(!C||!C.length)return t.createElement(t.Fragment,null);const k=a((t=>{const n=f?.find((e=>e.variantId===t))?.quantity;if(void 0!==n)return n;const r=C?.find((e=>e.node.id===t)),o=r?.node;return o?e.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?1/0:0:1/0:0}),[C,f,e.tracksInventory]),E=C?.find((e=>k(e.node.id)>0))?.node?.id;if(!E&&!y.general.showOutOfStockProducts)return t.createElement(t.Fragment,null);const[T,S]=c(C?.find((e=>k(e.node.id)>0))?.node?.id||C[0]?.node?.id),[$,B]=c(0),[z,I]=c(window.innerWidth<450),[N,D]=c("normal"),_=C?.find((e=>e?.node?.id===T))?.node,P=k(T||"");l((()=>{const e=m.find((e=>e.variantId===T));B(e?e.quantity:0)}),[$,m,T]),l((()=>{const e=()=>{I(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),l((()=>{CSS.supports("font-weight","500")?D("500"):CSS.supports("font-weight","400")?D("400"):CSS.supports("font-weight","600")&&D("600")}),[]),l((()=>{document.documentElement.style.setProperty("--yt-bundle-font-weight",N)}),[N]),l((()=>{if(T&&!C?.some((e=>e.node.id===T))){const e=C.find((e=>k(e.node.id)>0))?.node.id||C[0]?.node?.id;e&&S(e)}}),[T,C,k]);const O=e.variants&&e.variants.edges?.length>1&&"customOptions"!==b,A="undefined"!=typeof window?(window?.ytapp||window?.ytBundleApp)?.storeId:void 0,F="53933408435"===A,M="75851235630"===A,L=(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[]})(e),j=L.length>0;return t.createElement(t.Fragment,null,t.createElement(Su,{borderRadius:y?.byob.borderRadius,borderColor:y?.byob.borderColor,shadowType:y?.byob.shadowType,backgroundColor:y?.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(P<=0)return;const t={...e,variants:{...e.variants,edges:C},selectedVariant:_};x(t)},onMouseEnter:e=>{e.currentTarget.style.transform="scale(1.01)"},onMouseLeave:e=>{e.currentTarget.style.transform="scale(1)"},style:{WebkitTapHighlightColor:"transparent"}},t.createElement($u,{className:"yt-byob-image-wrapper"},t.createElement(pf,{product:e,styles:y,selectedVariant:_}),n?.productCardBadgeText&&t.createElement("div",{className:"yt-byob-product-badge",style:{position:"absolute",top:"0px",left:"0px",backgroundColor:y?.general.primaryColor||"#111",color:y?.general.primaryContrastColor||"#fff",zIndex:1,margin:"0px",whiteSpace:"pre",padding:"4px 8px",fontSize:"12px",borderTopLeftRadius:y.byob.borderRadius}},n.productCardBadgeText),O&&t.createElement("div",{className:"yt-byob-variant-selector-wrapper",style:{position:"relative",width:"100%"}},t.createElement(Bu,{className:"yt-byob-variant-selector",isCoralHaze:F,onClick:e=>{e.preventDefault(),e.stopPropagation()},value:T||"",onChange:e=>{e.stopPropagation(),e.preventDefault(),S(e.target.value)}},C?.map((e=>{const n=window.innerWidth<=320?10:window.innerWidth<=420?15:22,r=e.node.title.length>n?e.node.title.substring(0,n)+"...":e.node.title;return t.createElement("option",{key:e.node.id,value:e.node.id},r)}))),t.createElement("div",{className:"yt-byob-variant-chevron",style:{position:"absolute",right:"16px",bottom:"10px",pointerEvents:"none"}},t.createElement(R,null)))),t.createElement("div",{className:"yt-byob-product-content"},"enabled"===n?.customizations?.byob?.productCardCategoryVisibility&&j&&t.createElement("div",{className:"yt-byob-product-categories-wrapper",style:{padding:"2px 4px"}},t.createElement("div",{className:"yt-byob-product-categories",style:{display:"flex",flexWrap:"wrap",gap:"4px"}},L.slice(0,2).map(((e,n)=>t.createElement("span",{className:"yt-byob-category-tag",key:n,style:{fontSize:z?"8px":"12px",color:"#666",fontWeight:"500"}},e.charAt(0).toUpperCase()+e.slice(1)))),L.length>2&&t.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"}},"+",L.length-2," more"))),t.createElement(zu,{isMobile:z,showBorder:n?.showBorder??!0,style:{...!y?.byob.productsPriceVisibility&&{padding:"8px"},...y?.byob.productTitleFontSize&&{fontSize:y?.byob.productTitleFontSize}},className:"yt-byob-product-title-wrapper"},t.createElement("div",{style:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",lineHeight:"normal"},className:"yt-byob-product-title"},M?String(_?.displayName).replace("- Default Title",""):e.title,_?.commonSuffix?" -"+_?.commonSuffix:""))),"ratingOnly"===n?.reviewRatingType&&(e?.rating?.averageRating??0)>0&&t.createElement("div",{className:"yt-byob-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Kr,{color:"gold",size:14})," ",t.createElement("span",{style:{marginLeft:6}},e?.rating?.averageRating," rating")),"ratingAndReviewCount"===n?.reviewRatingType&&(e?.rating?.averageRating??0)>0&&t.createElement("div",{className:"yt-byob-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Kr,{color:"gold",size:14})," ",e?.rating?.averageRating,t.createElement(tr,{className:"yt-byob-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",e?.rating?.ratingCount," reviews)"),y?.byob.productsPriceVisibility&&t.createElement("div",{className:"yt-byob-product-price yt-bundle-builder-product-price",style:{marginBottom:"5px",padding:n?.showBorder?"0px 10px":"0 4px"}},g?.isFreebieTier&&!h?t.createElement(t.Fragment,null,t.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"14px",textDecoration:"line-through",color:"#888",marginRight:"6px"}},Kh(y.general.currencySymbol,n?.storeCurrencyCode)??"Rs.",Xh(_?.price)),t.createElement("span",{className:"yt-byob-current-price",style:{color:y.general.primaryColor||"#d32f2f",fontWeight:"bold"}},"FREE")):parseFloat(_?.price??"0")>0?t.createElement("span",{className:"yt-byob-current-price"},Kh(y.general.currencySymbol,n?.storeCurrencyCode)??"Rs.",Xh(_?.price)):t.createElement("span",{className:"yt-byob-free-price"},"Free"),(!g?.isFreebieTier||h)&&_?.compareAtPrice&&y?.byob.compareAtPriceVisibility&&parseFloat(_.compareAtPrice)>parseFloat(_?.price)&&t.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"14px"}},Kh(y.general.currencySymbol,n?.storeCurrencyCode)??"Rs.",Xh(_.compareAtPrice))),(P>0||P===1/0)&&t.createElement(Iu,{borderRadius:y?.byob.borderRadius,className:"yt-byob-add-to-bundle-wrapper yt-product-atc-wrapper"},(0===$||void 0===$)&&t.createElement(Eu,{style:{...!o&&{backgroundColor:y?.general.primaryColor||"#111",color:y?.general.primaryContrastColor||"#fff"}},disabled:o,onClick:t=>{t.stopPropagation(),t.preventDefault(),B(1),(()=>{if(!T)return;"customOptions"===b&&C.length>1?w(!0):r(T,e,1)})()},className:"yt-byob-add-to-bundle-button yt-product-atc-button"},y?.byob.addToBundleCTAText),!n?.disableQuantitySelector&&$>0&&T&&t.createElement(Tu,{className:"yt-byob-quantity-selector-container visible",style:{overflow:"hidden"}},t.createElement(df,{remainingQuantity:i,setQuantity:B,quantity:$,handleAddToBundle:r,variantId:T,product:e,handleRemoveItem:d,hideAddToBundle:o,selectedVariantInventoryQty:P})),n?.disableQuantitySelector&&$>0&&T&&t.createElement(Eu,{style:{backgroundColor:"#747474",color:y?.general.primaryContrastColor||"#fff",display:"flex",justifyContent:"space-between",overflow:"hidden",height:"40px"},className:"yt-byob-added-button yt-product-atc-single-qty-selector"},t.createElement(Nu,{className:"yt-byob-added-text yt-product-atc-single-qty-selector-added"},"ADDED"),t.createElement(Du,{className:"yt-byob-single-qty-remove yt-product-atc-single-qty-selector-remove",onClick:e=>{e.stopPropagation();const t=Math.max(0,$-1);B(t),d&&T&&d(T,1)}},t.createElement(po,{style:{color:"#fff",fontSize:"20px"}})))),P<=0&&P!==1/0&&t.createElement(Eu,{style:{backgroundColor:y.general.disabledButtonColor,color:"#fff",cursor:"not-allowed",transition:"transform 0.2s ease-in-out"},className:"yt-product-atc-disabled"},y?.general.outOfStockLabel||"Out of Stock")),"customOptions"===b&&v&&C.length>1&&t.createElement(cf,{product:e,isOpen:v,onClose:()=>w(!1),variantOptions:n.variantOptions,cta:{textColor:y.general.ctaTextColor,backgroundColor:y.general.primaryColor},onConfirm:t=>{S(t),r(t,e,1)}}))},mf=({currentStep:e,setCurrentProductTier:n,totalSteps:r,tiers:o,isMobile:a,selectedProductsByTier:i,primaryColor:l="#000",primaryTextColorCta:c="#fff",tierNavigation:s})=>t.createElement("div",{className:"yt-byob-stepper-container",style:{textAlign:"center",fontSize:"20px"}},t.createElement("div",{className:"yt-byob-stepper-steps",style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"center"}},Array.from({length:r}).map(((c,d)=>{const p=d+1,u=o[d].minimumQuantity-(i[d]?.length??0)==0,m=d===e;return l="black"===l?"#000000":l,t.createElement(t.Fragment,{key:p},t.createElement("div",{className:"yt-byob-stepper-step-wrapper",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:"pointer",gap:a?"4px":"8px"},onClick:()=>!1===s?()=>{}:n(p-1)},t.createElement("div",{className:"yt-byob-stepper-step-number",style:{fontSize:"14px"}},"Step ",p),t.createElement("div",{className:"yt-byob-stepper-step-bar",style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"center",cursor:"pointer"}},t.createElement("div",{className:"yt-byob-stepper-step-left-bar",style:{height:"3px",width:a?"30px":"50px",backgroundColor:u?l:m?"#666666":"#CBD5E0",display:"block",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px"}}),t.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"}}),t.createElement("div",{className:"yt-byob-stepper-step-right-bar",style:{height:"3px",width:a?"30px":"50px",backgroundColor:u?l:m?"#666666":"#CBD5E0",display:"block",marginRight:d<r?a?"4px":"6px":"",borderTopRightRadius:"5px",borderBottomRightRadius:"5px"}}))))}))),t.createElement("div",{className:"yt-byob-stepper-title",style:{margin:a?"16px 0px":"15px 0px",fontSize:a?"16px":"18px",padding:"4px",background:"rgba(0, 0, 0, 0.03)",borderBottom:"1px solid rgba(130, 130, 130, 0.28)"}},o[e]?.title)),ff=({isMobile:e,setSearchTerm:n,searchTerm:r,styles:o,setSortBy:a})=>{const[i,s]=c(!1),[d,p]=c(r);return l((()=>{const e=setTimeout((()=>{n(d)}),300);return()=>clearTimeout(e)}),[d,n]),t.createElement("div",{className:"yt-byob-sort-filter-container",style:{display:"flex",flexDirection:e?"column":"row",justifyContent:"space-between",alignItems:e?"flex-end":"center",textAlign:"center",marginBottom:"20px",width:"97%",gap:e?"10px":"0"}},t.createElement("div",{className:"yt-byob-sort-filter-inner",style:{display:"flex",flexDirection:i&&e?"column":e?"row-reverse":"row",justifyContent:"space-between",alignItems:i?"":"center",gap:"12px",width:"100%"}},t.createElement("div",{className:"yt-byob-search-wrapper",style:{position:"relative",display:"flex",alignItems:"center",width:e?i?"100%":"auto":"400px",transition:"width 0.3s ease-in-out"}},e&&!i?t.createElement(so,{className:"yt-byob-search-icon",fontSize:"20px",color:"#555",style:{cursor:"pointer",lineHeight:"normal"},onClick:()=>s(!0)}):t.createElement(t.Fragment,null,t.createElement("input",{className:"yt-byob-search-input",style:{width:"100%",padding:e?"10px 12px":"10px 14px",fontSize:"14px",outline:"none",color:"#333",border:"1px solid #c7c7c7",borderRadius:o?.byob.borderRadius,boxShadow:o?.byob.borderColor?"0 2px 4px rgba(0, 0, 0, 0.1)":"none",textAlign:"start"},placeholder:"Search by Product Name",value:d,onChange:e=>p(e.target.value)}),!i&&t.createElement("span",{className:"yt-byob-search-icon-input",style:{position:"absolute",right:"12px",color:"#aaa",fontSize:"16px",display:"flex",alignItems:"center",justifyContent:"center",background:"white",paddingLeft:"5px"}},t.createElement(so,{fontSize:"18px",style:{lineHeight:"normal"}}))),e&&i&&t.createElement("span",{className:"yt-byob-search-close-icon",style:{position:"absolute",right:"12px",color:"#aaa",fontSize:"16px",cursor:"pointer"},onClick:()=>s(!1)},"✖")),t.createElement("div",{className:"yt-byob-filter-wrapper",style:{display:"flex",alignItems:"center",textAlign:"center",border:window.innerWidth>600?"1px solid #d1d5db":"",padding:"8px 12px",fontSize:"14px",cursor:"pointer",borderRadius:o?.byob.borderRadius,boxShadow:o?.byob.borderColor?window.innerWidth>600?"0 2px 4px rgba(0, 0, 0, 0.1)":" ":"none"}},t.createElement("span",{className:"yt-byob-filter-label",style:{fontSize:"14px",color:"#555",marginRight:"6px"}},"Sort:"),t.createElement("select",{className:"yt-byob-filter-select",style:{flex:1,border:"none",height:"auto",padding:"0px",marginBottom:"0px",background:"transparent",fontSize:"14px",color:"#333",fontWeight:"500",width:e?"120px":"",outline:"none",cursor:"pointer",textAlign:"start"},onChange:e=>a(e.target.value)},t.createElement("option",{value:"best-selling"},"Featured"),t.createElement("option",{value:"title-asc"},"Product Title (A-Z)"),t.createElement("option",{value:"title-desc"},"Product Title (Z-A)"),t.createElement("option",{value:"price-low-to-high"},"Price (Low to High)"),t.createElement("option",{value:"price-high-to-low"},"Price (High to Low)")))))},gf=({styles:e,isMobile:n,categories:r,activeCategory:o,onCategoryChange:a})=>{const i=e=>{a(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"===e?.byob?.categoryFilterOnPage?t.createElement("div",{className:"yt-byob-category-filter-wrapper",style:{overflowX:n?"auto":"visible",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",width:"100%"}},t.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",...r].map((r=>{const a=o===r;return t.createElement("button",{key:r,onClick:()=>i(r),className:"yt-byob-category-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:a?"600":"400",color:a?e.general.primaryColor:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:a?l(e.general.primaryColor,.07):"transparent",borderBottom:a?`2px solid ${e?.general.primaryColor}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:t=>{a||(t.currentTarget.style.color=e?.general.primaryColor)},onMouseLeave:e=>{a||(e.currentTarget.style.color="#666")}},t.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},r.charAt(0).toUpperCase()+r.slice(1)),t.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},r.charAt(0).toUpperCase()+r.slice(1)))})))):t.createElement("div",{className:"yt-byob-category-filter-wrapper",style:{overflowX:n?"auto":"visible",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",paddingBottom:"5px"}},t.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",...r].map((r=>t.createElement("button",{key:r,onClick:()=>i(r),className:"yt-byob-category-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${o===r?e?.general.primaryColor:"#e0e0e0"}`,borderRadius:e?.general.ctaBorderRadius,backgroundColor:o===r?e?.general.primaryColor:"white",color:o===r?"white":"#333",cursor:"pointer",transition:"all 0.3s ease",outline:"none",whiteSpace:"nowrap",minWidth:"fit-content",flexShrink:0},onMouseEnter:t=>{o!==r&&(t.currentTarget.style.borderColor=e?.general.primaryColor,t.currentTarget.style.color=e?.general.primaryColor)},onMouseLeave:e=>{o!==r&&(e.currentTarget.style.borderColor="#e0e0e0",e.currentTarget.style.color="#333")}},r.charAt(0).toUpperCase()+r.slice(1))))))},hf=({bundle:e,selectedItems:n,setSelectedItems:r,handleAddToCart:i,bundleAddToCartLoading:s,renderingOnPage:d,selectedItemsQuantity:p,handleRemoveItem:u,bundleSubtotal:m})=>{const[f,g]=c(void 0),[h,x]=c(window.innerWidth<450),[y,b]=c(0),[v,w]=c({}),C=e.builderTiers?.type,k=e.customizations,E=e.builderTiers?.productTier??[],T=e.builderTiers?.offerTier??[],[S,$]=c([]),[B,z]=c(!1),[I,N]=c("All"),[D,_]=c(0),P=o(null);l((()=>{const t=new Set;let n=!1;e?.products?.forEach((e=>{const r=e.productDetails;if(r.metafield&&"yourtoken_bundles_app"===r.metafield.namespace&&"categories"===r.metafield.key){let e=[];if(r.metafield.jsonValue&&Array.isArray(r.metafield.jsonValue))e=r.metafield.jsonValue;else if(r.metafield.value)try{const t=JSON.parse(r.metafield.value);Array.isArray(t)&&(e=t)}catch(e){console.error("Failed to parse categories:",e)}e.length>0&&(n=!0,e.forEach((e=>t.add(e))))}})),$(Array.from(t)),z(n)}),[e.products]);const O=((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})))(e.products.filter((e=>"active"===e.productDetails.status?.toLowerCase()||void 0===e.productDetails.status||""===e.productDetails.status)),I),A="productTier"===C?E.reduce(((e,t)=>e+t.minimumQuantity),0):"offerTier"===C?T.reduce(((e,t)=>e+t.minimumQuantity),0):e.minimumQuantity,[F,M]=c(""),[R,L]=c(""),j=((e,t)=>e.filter((e=>e?.productDetails?.title?.toLowerCase().includes(t?.toLowerCase()))))(O,F),V=((e,t)=>[...e].sort(((e,n)=>{const r=e?.productDetails?.title?.toLowerCase(),o=n?.productDetails?.title?.toLowerCase(),a=parseFloat(e?.productDetails?.variants?.edges?.[0]?.node?.price||"0"),i=parseFloat(n?.productDetails?.variants?.edges?.[0]?.node?.price||"0");switch(t){case"title-asc":return r.localeCompare(o);case"title-desc":return o.localeCompare(r);case"price-low-to-high":return a-i;case"price-high-to-low":return i-a;default:return 0}})))(j,R),W=((e,t,n,r,o)=>(e[o]?.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 o=t.find((t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0])))),a=t.find((e=>e.productId===n.productId&&(n.variantIds.length<1||e.variantIds.includes(n.variantIds[0]))));if(!o||!a)return 0;const i=o.productDetails?.title?.toLowerCase(),l=a.productDetails?.title?.toLowerCase(),c=parseFloat(o?.productDetails?.variants?.edges?.[0]?.node?.price||"0"),s=parseFloat(a?.productDetails?.variants?.edges?.[0]?.node?.price||"0");switch(r){case"title-asc":return i.localeCompare(l);case"title-desc":return l.localeCompare(i);case"price-low-to-high":return c-s;case"price-high-to-low":return s-c;default:return 0}})))(E,V,F,R,y),[H,q]=Jt(gm),[U,Q]=c(!1),G="productTier"===C?W:V,Y=G.slice(0,20*(D+1));l((()=>{setTimeout((()=>{Q(!0)}),100)}),[]);const Z=o(null);l((()=>{const e=()=>{x(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),l((()=>{if(e.coverImageUrl){const t=new Image;t.src=Jh(e.coverImageUrl)??"",t.onload=()=>{g(t.width/t.height)}}}),[e.coverImageUrl]),l((()=>{Q(!1),setTimeout((()=>Q(!0)),100)}),[y]);const X=(e,t)=>{if("productTier"===C){let n={...v},r=!1;if(n[t]){const o=n[t].indexOf(e);-1!==o&&(n[t]=[...n[t]],n[t].splice(o,1),r=!0)}if(!r)for(let t=E.length;t>=0;t--){const r=n[t].indexOf(e);if(-1!==r){n[t]=[...n[t]],n[t].splice(r,1);break}}w(n);const o=E.findIndex(((e,t)=>n[t]?.length<e.minimumQuantity));-1!==o&&b(o)}u(e)},K=()=>{const e=document.querySelector(".products-display");e&&e.scrollIntoView({behavior:"smooth"})};l((()=>{if("productTier"===C){const e=Object.fromEntries(E.map((e=>[e.tier,[]])));w(e)}}),[e]),l((()=>{if("productTier"!==C||!E[y])return;if(A===p)return;const e=E.findIndex(((e,t)=>{const n=v[t]||[];return t>=y&&n.length<e.minimumQuantity}));-1!==e&&e!==y&&(b(e),K())}),[v,E,C]),l((()=>{M("")}),[y]),l((()=>{function e(e){if(!Z.current||!e.target)return;!Z.current.contains(e.target)&&q(void 0)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[]);const J=(e,t,o)=>{var a;"productTier"===C&&(a=e,w((e=>{const t={...e},n=E.findIndex(((e,n)=>{const r=t[n]||[];return n>=y&&r.length<e.minimumQuantity}));return-1!==n&&b(n),t[n]||(t[n]=[]),t[n].push(a),t})));const i=!0===E[y]?.isFreebieTier;ex(e,t,o,n,r,i)},ee=(()=>{if(!e?.builderTiers)return e.minimumQuantity;const{type:t,offerTier:n,productTier:r}=e.builderTiers,o="offerTier"===t?n:"productTier"===t?r:null;if(!o)return e.minimumQuantity;let a=0;return o.map((e=>{a+=e.minimumQuantity})),a})(),te=h&&e.mobileCoverImageUrl?Jh(e.mobileCoverImageUrl):Jh(e.coverImageUrl??"")||null,ne=e.customStoreDetails?.fixedInventoryDetails,re=a(((e,t)=>{const n=ne?.find((e=>e.variantId===t))?.quantity;if(void 0!==n)return n;const r=(e.variants?.edges||[]).find((e=>e.node.id===t)),o=r?.node;return o?e.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?1/0:0:1/0:0}),[ne]),oe=a((e=>{const t=k?.general?.showOutOfStockProducts;if(t)return!0;const n=e.productDetails,r=n?.variants?.edges||[];if(ne){if(r.some((e=>ne.some((t=>t.variantId===e.node.id&&t.quantity>0)))))return!0}return r.some((e=>re(n,e.node.id)>0))}),[k?.general?.showOutOfStockProducts,ne,re]);l((()=>{if("productTier"!==C)return;const t=E[y];if(!t)return;if(1!==t.minimumQuantity)return;if(1!==t.products.length)return;const n=t.products[0],r=e.products.find((e=>e.productId===n.productId))?.productDetails;if(!r)return;if(r.variants?.edges?.length>1)return;const o=r.variants?.edges?.find((e=>re(r,e.node.id)>0))?.node;if(!o)return;const a=o.id,i=v[y]?.includes(a);i||(J(a,r,1),y<E.length-1&&(b(y+1),K()))}),[C,E,y,e.products,v,re,J]);const ae="bundles"==e.appName?e.pageHeader?.title:e?.title,ie="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;l((()=>{_(0)}),[F,R,I,y]);const le=a((()=>{Y.length<G.length&&_((e=>e+1))}),[Y.length,G.length]);return l((()=>{const e=new IntersectionObserver((([e])=>{e.isIntersecting&&le()}),{threshold:.1});return P.current&&e.observe(P.current),()=>{P.current&&e.unobserve(P.current)}}),[le]),t.createElement(t.Fragment,null,t.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",rowGap:"15px",padding:"20px 0px",marginBottom:"20px",backgroundColor:k.byob.sectionBackgroundColor,..."transparent"!==k.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},te?t.createElement("div",{style:{position:"relative",width:"100%",display:"flex",justifyContent:"center",alignItems:"center",textAlign:"center",overflow:"hidden",...e?.coverImageVerticalMargin&&{marginBottom:e?.coverImageVerticalMargin,marginTop:e?.coverImageVerticalMargin}}},te&&t.createElement(sf,{coverImageUrl:te,alt:"Background",styles:{width:"100%",height:"auto",display:"block"}}),t.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)"}},t.createElement("span",{style:{lineHeight:"normal",fontSize:k?.byob?.titleFontSize??"3rem",fontWeight:"700",color:k?.byob?.titleTextColor??"#000",marginBottom:"15px",backgroundColor:k?.byob?.titleBackgroundColor??"transparent",width:"100%",textAlign:"center"},className:"bundle-builder-title"},ae),t.createElement("span",{style:{lineHeight:"normal",fontSize:k?.byob?.subtitleFontSize??"1.5rem",color:k?.byob?.titleTextColor??"#000"},className:"bundle-builder-subtitle"},ie))):(ae||ie)&&t.createElement("div",{style:{zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",width:"90%",maxWidth:"1000px"}},ae&&t.createElement("span",{style:{lineHeight:"normal",fontSize:k?.byob?.titleFontSize??"3rem",fontWeight:"700",color:k?.byob?.titleTextColor??"#000",marginBottom:"15px",textAlign:"center",width:"100%",backgroundColor:k?.byob?.titleBackgroundColor??"transparent"}},ae),ie&&t.createElement("span",{style:{lineHeight:"normal",fontSize:k?.byob?.subtitleFontSize??"1.5rem",color:k?.byob?.titleTextColor??"#000"}},ie)),t.createElement("div",{style:{fontSize:"20px",width:"100%"},className:"products-display"},"productTier"===C&&E.length>0&&k?.byob.productTiersVisibility&&t.createElement(t.Fragment,null,t.createElement("div",null,t.createElement(mf,{currentStep:y,totalSteps:E.length,tiers:E,isMobile:h,primaryColor:k?.general?.primaryColor,primaryTextColorCta:k?.general?.primaryContrastColor,setCurrentProductTier:b,selectedProductsByTier:v,tierNavigation:k.byob.tierNavigation})))),t.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"20px"}},e?.enableSortAndFilter&&t.createElement(ff,{isMobile:h,searchTerm:F,setSearchTerm:M,setSortBy:L,styles:k}),e?.customizations?.byob?.enableProductCategories&&B&&t.createElement("div",null,t.createElement(gf,{styles:k,isMobile:h,categories:S,activeCategory:I,onCategoryChange:e=>{N(e)}}))),t.createElement("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"12px",justifyContent:"center",width:"100%"},className:"products-display"},0===G?.length?t.createElement("p",{style:{fontSize:"20px",color:"#333",textAlign:"center",width:"100%"}},"No products found"):"productTier"===C&&E.length>0?Y.filter((e=>oe(V.find((t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0]))))))).map(((r,o)=>{const a=(E[y]?.minimumQuantity??0)>(v[y]?.length??0),i=V.find((e=>e.productId===r.productId&&(r.variantIds.length<1||e.variantIds.includes(r.variantIds[0]))));return i?t.createElement(uf,{bundle:e,idx:o,key:r?.variantIds?.[0]??r.productId,product:i?.productDetails,handleAddToBundle:J,hideAddToBundle:!a,remainingQuantity:ee-p,themeColor:e?.dealTextColor,handleRemoveItem:e=>X(e,y),selecteditems:n,transitionActive:U,customVariantsQuantity:ne,currentProductTier:E[y],showFreebieTierProductPrices:e?.customStoreDetails?.showFreebieTierProductPrices}):null})):Y.filter(oe).map(((r,o)=>t.createElement(uf,{bundle:e,idx:o,key:r.productId,product:r?.productDetails,handleAddToBundle:J,hideAddToBundle:p>=ee,remainingQuantity:ee-p,themeColor:e?.dealTextColor,handleRemoveItem:u,selecteditems:n,transitionActive:U,customVariantsQuantity:ne}))),Y.length<G.length&&t.createElement("div",{ref:P,style:{height:"1px",width:"100%",display:"block"}})),!d&&t.createElement(fm,{builderTiers:e?.builderTiers,handleAddToCart:i,minimumQuantity:A,selectedProducts:n,showProductDetailsInTracker:e.showProductDetailsInTracker,handleRemoveItem:u,handleRemoveItemProductTier:X,selectedItemsQuantity:p,percentageOff:e.percentageOff,loading:s,bundleSubtotal:m,amountOff:e.amountOff,styles:e.customizations,dealAmount:e.dealAmount,themeColor:e?.dealTextColor??"#333",primaryTextColorCta:e?.primaryTextColorCta??"#fff",cornerRadiusType:e?.cornerRadiusType??"",selectedProductsByTier:v,renderingOnPage:d})),d&&t.createElement(fm,{handleAddToCart:i,minimumQuantity:A,builderTiers:e?.builderTiers,selectedProducts:n,showProductDetailsInTracker:e.showProductDetailsInTracker,loading:s,handleRemoveItem:u,handleRemoveItemProductTier:X,percentageOff:e.percentageOff,selectedItemsQuantity:p??0,bundleSubtotal:m??{price:0,compareAtPrice:0},amountOff:e.amountOff,styles:e.customizations,dealAmount:e.dealAmount,themeColor:k?.general.primaryColor||"#000",primaryTextColorCta:k.general.primaryContrastColor??"#fff",cornerRadiusType:e?.cornerRadiusType??"",selectedProductsByTier:v,renderingOnPage:d}),H&&void 0!==p&&(()=>{let r=p<e.minimumQuantity;return"productTier"==C?r=(E[y]?.minimumQuantity??0)>(v[y]?.length??0):"offerTier"==C&&(r=p<T.reduce(((e,t)=>e+t.minimumQuantity),0)),t.createElement(af,{handleAddToBundle:J,ref:Z,remainingQuantity:e.minimumQuantity-p,hideAddToBundle:!r,disableQuantitySelector:e?.disableQuantitySelector??!1,selectedProducts:n,selectedProductsByTier:v,themeColor:k?.general.primaryColor||"#000",primaryTextColorCta:e?.customizations?.general.primaryContrastColor??"#fff",primaryBackgroundColorCta:k?.general.primaryColor||"#000",cornerRadius:e?.customizations.byob.borderRadius,styles:e.customizations,reviewRatingType:e?.reviewRatingType??"none",customVariantsQuantity:ne})})())},xf=({product:e,selectedVariantId:n,onVariantChange:r,styles:o,originalPrice:a,dealPrice:l,isVertical:c=!1,variantOptions:s,storeCurrencyCode:d})=>{const p=i((()=>t=>{const n=e?.productDetails?.variants?.edges?.find((e=>e.node.id===t)),r=n?.node;return r?e.productDetails.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?1/0:0:1/0:0}),[e.productDetails]),u=e?.productDetails?.variants?.edges?.find((e=>e?.node?.id===n))?.node;p(n);const m=i((()=>{if(u?.title&&e.productDetails.options){const t=u.title.split(" / ");if(t.length===e.productDetails.options.length)return t}return e.productDetails.options?.map((e=>e.values[0]))||[]}),[u,e.productDetails.options]),f=e=>{r(e)};return c?t.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"}},t.createElement("div",{className:"yt-comboBundle-product-card-image-container-vertical",style:{position:"relative",width:"100%"}},o.comboBundle.subProductsImageVisibility&&t.createElement(t.Fragment,null,t.createElement("img",{className:"yt-comboBundle-product-image-vertical",src:Jh(u?.image?.url||e?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg"),alt:e?.productDetails?.featuredMedia?.alt,width:165,height:165,style:{objectFit:"cover",borderRadius:"20px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",height:"100%",aspectRatio:o.general?.imageAspectRatio||"1/1"}}),t.createElement("div",{className:"yt-comboBundle-product-variant-selector-container-vertical",style:{marginTop:"8px",position:"absolute",bottom:"10px",left:"5px",right:"5px"}},e?.productDetails?.variants?.edges?.length>1&&t.createElement(t.Fragment,null,t.createElement("select",{className:"yt-comboBundle-product-variant-select-vertical",value:n,onChange:e=>f(e.target.value),style:{padding:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",width:"100%",appearance:"none",marginRight:"30px",fontSize:"12px",fontWeight:600}},e?.productDetails?.variants?.edges.map((e=>{const n=p(e?.node?.id);return t.createElement("option",{key:e?.node?.id,value:e?.node?.id,disabled:0===n,className:"yt-comboBundle-product-variant-option"},e?.node?.title)}))),t.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"}},t.createElement(R,null)))))),(o.comboBundle.subProductsProductTitleVisibility||o.comboBundle.subProductsProductPriceVisibility)&&t.createElement("div",{className:"yt-comboBundle-product-info-container-vertical",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"40px",width:"100%",paddingBlock:"5px"}},o.comboBundle.subProductsProductTitleVisibility&&t.createElement("span",{className:"yt-comboBundle-product-title-vertical",style:{fontSize:"12px",color:"#333",fontWeight:"600",lineHeight:"normal",textAlign:"center",width:"fit-content"}},e?.productDetails?.title),o.comboBundle.subProductsProductPriceVisibility&&t.createElement("div",{className:"yt-comboBundle-product-price-container-vertical",style:{display:"flex",alignItems:"center",gap:"8px",lineHeight:"normal",fontSize:"14px"}},t.createElement("span",{className:"yt-comboBundle-product-deal-price-vertical",style:{lineHeight:"normal"}},Kh(o.general.currencySymbol,d),Xh((Number(u?.compareAtPrice?Number(u?.compareAtPrice):u?.price)/Number(a)*Number(l)).toFixed(2))),u?.compareAtPrice&&t.createElement("span",{className:"yt-comboBundle-product-original-price-vertical",style:{textDecoration:"line-through",color:"#999",lineHeight:"normal",fontSize:"12px"}},Kh(o.general.currencySymbol,d),Xh(u?.compareAtPrice?u?.compareAtPrice:u?.price))))):t.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"===o.comboBundle.infoAlignment&&{flexDirection:"row-reverse"},..."center"===o.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"}},o.comboBundle.subProductsImageVisibility&&t.createElement("div",{className:"yt-comboBundle-product-image-wrapper-horizontal"},t.createElement("img",{className:"yt-comboBundle-product-image-horizontal",src:Jh(u?.image?.url||e?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg"),alt:e?.productDetails?.featuredMedia?.alt,height:80,style:{objectFit:"cover",borderRadius:"10px",border:"1px solid #DEDEDE",aspectRatio:"1/1",width:"90px",height:"90px"}})),t.createElement("div",{className:"yt-comboBundle-product-info-horizontal",style:{display:"flex",flexDirection:"column",alignItems:"left"===o.comboBundle?.infoAlignment?"flex-start":"right"===o.comboBundle?.infoAlignment?"flex-end":"center"===o.comboBundle?.infoAlignment?"flex-start":void 0}},o.comboBundle.subProductsProductTitleVisibility&&t.createElement("span",{className:"yt-comboBundle-product-title-horizontal",style:{fontSize:"14px",fontWeight:"600",lineHeight:"normal",display:"flex",alignItems:"center",gap:"8px"}},t.createElement("span",{className:"yt-comboBundle-product-title-text"}," ",e?.productDetails?.title," "),"dropdown"!==o.comboBundle.comboVariantTypeSelector&&e.productDetails.variants.edges.length>1&&s&&m&&t.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"}},m.length>1?m.join(" / "):m)),o.comboBundle.subProductsProductPriceVisibility&&t.createElement("div",{className:"yt-comboBundle-product-price-wrapper-horizontal",style:{display:"flex",gap:"8px",marginTop:"5px",alignItems:"baseline"}},t.createElement("span",{className:"yt-comboBundle-product-deal-price-horizontal",style:{lineHeight:"normal"}},Kh(o.general.currencySymbol,d),Xh((Number(u?.compareAtPrice?Number(u?.compareAtPrice):u?.price)/Number(a)*Number(l)).toFixed(2))),u?.compareAtPrice&&t.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},Kh(o.general.currencySymbol,d),Xh(u?.compareAtPrice?u?.compareAtPrice:u?.price))),e.productDetails.variants.edges.length>1&&("dropdown"===o.comboBundle.comboVariantTypeSelector?t.createElement("div",{className:"yt-comboBundle-product-variant-dropdown-horizontal",style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},t.createElement("select",{className:"yt-comboBundle-product-variant-select-horizontal",value:n,onChange:e=>f(e.target.value),style:{padding:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",fontSize:"12px",fontWeight:600,borderRadius:"4px"}},e.productDetails.variants.edges.map((e=>{const n=p(e?.node?.id);return t.createElement("option",{key:e?.node?.id,value:e?.node?.id,disabled:0===n,className:"yt-comboBundle-product-variant-option"},e?.node?.title)}))),t.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"}},t.createElement(R,null))):e.productDetails.options.length>0?t.createElement(t.Fragment,null,e.productDetails.options.map(((n,r)=>t.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"}},e.productDetails.options.length>1&&n?.values?.length>1&&t.createElement("label",{className:"yt-comboBundle-product-option-label",style:{fontSize:"12px",fontWeight:"500",color:"#333"}},n.name,":"),n?.values?.length>1&&t.createElement("div",{className:"yt-comboBundle-product-option-values-horizontal",style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"}},n.values.map((a=>{const i=[...m];i[r]=a;const l=e.productDetails.options.length>0?i.join(" / "):i[r],c=e.productDetails.variants.edges.find((e=>e.node.title===l))?.node,d=0===(c?p(c.id):0),u=m[r]===a,g=s&&s?.options?.find((e=>e.name===n.name));return g&&"color"===g?.type?t.createElement("button",{key:a,className:`yt-comboBundle-product-option-button-color ${u?"yt-comboBundle-product-option-button-selected":""} ${d?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!d&&c&&f(c.id)},disabled:d,style:{borderRadius:"50%",padding:"1px",backgroundColor:"white",border:u&&!d?`1px solid ${o.general?.ctaBackgroundColor}`:"1px solid transparent",opacity:d?.5:1,cursor:d?"not-allowed":"pointer"}},g?.values.find((e=>e.name===a))?.value?t.createElement("div",{className:"yt-comboBundle-product-option-color-swatch",style:{width:u&&!d?"26px":"24px",height:u&&!d?"26px":"24px",borderRadius:"50%",backgroundColor:g?.values.find((e=>e.name===a))?.value}},t.createElement("span",null)):t.createElement("span",{key:a,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:u&&!d?`1px solid ${o.general?.ctaBackgroundColor}`:d?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!d?"#F7F7F7":"transparent",color:d?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},a)):g&&"image"===g?.type?t.createElement("button",{key:a,className:`yt-comboBundle-product-option-button-image ${u?"yt-comboBundle-product-option-button-selected":""} ${d?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!d&&c&&f(c.id)},disabled:d,style:{border:u&&!d?`1px solid ${o.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:u&&!d?"#F7F7F7":"transparent",cursor:d?"not-allowed":"pointer",padding:"0px",width:u&&!d?"26px":"24px",height:u&&!d?"26px":"24px",overflow:"hidden",opacity:d?.5:1}},g?.values.find((e=>e.name===a))?.value?t.createElement("img",{className:"yt-comboBundle-product-option-image",src:Jh(g?.values.find((e=>e.name===a))?.value||"/placeholder.svg"),alt:a,style:{width:u&&!d?"26px":"24px",height:u&&!d?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}}):t.createElement("span",{key:a,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:u&&!d?`1px solid ${o.general?.ctaBackgroundColor}`:d?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!d?"#F7F7F7":"transparent",color:d?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},a)):t.createElement("button",{key:a,className:`yt-comboBundle-product-option-button-text ${u?"yt-comboBundle-product-option-button-selected":""} ${d?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!d&&c&&f(c.id)},disabled:d,style:{padding:"4px 8px",border:u&&!d?`1px solid ${o.general?.ctaBackgroundColor}`:d?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!d?"#F7F7F7":"transparent",color:d?"#ccc":"#707070",cursor:d?"not-allowed":"pointer",fontSize:"10px",fontWeight:"600",opacity:d?.5:1}},a)}))))))):t.createElement(t.Fragment,null,e?.productDetails?.variants?.edges?.length>1&&t.createElement("div",{className:"yt-comboBundle-product-variant-buttons-horizontal",style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},e?.productDetails?.variants?.edges.map((e=>{const r=0===p(e?.node?.id);return t.createElement("button",{key:e?.node?.id,className:`yt-comboBundle-product-variant-button ${n===e?.node?.id?"yt-comboBundle-product-variant-button-selected":""} ${r?"yt-comboBundle-product-variant-button-disabled":""}`,onClick:()=>f(e?.node?.id),disabled:r,style:{padding:"4px 8px",border:n===e?.node?.id?`1px solid ${o.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:n===e?.node?.id?"#F7F7F7":"transparent",color:r?"#ccc":"#707070",cursor:r?"not-allowed":"pointer",fontSize:"12px",fontWeight:"500",opacity:r?.5:1}},e?.node?.title)})))))))},yf=({bundle:e,addToCartFunction:n})=>{const[r,o]=c(!1),[a,s]=c(window.innerWidth<786);l((()=>(n&&(window.ytComboBundle={bundle:e,addToCart:n},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}))})),[e,n]);const d=i((()=>(e,t)=>{const n=e?.variants?.edges?.find((e=>e.node.id===t)),r=n?.node;return r?e.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?1/0:0:1/0:0}),[]),[p,u]=c((()=>{const t={};return e.products.forEach(((e,n)=>{const r=e.productDetails?.variants?.edges?.find((t=>d(e.productDetails,t?.node?.id)>0))?.node;t[n]=r?r.id:e?.productDetails?.variants?.edges[0]?.node?.id})),t})),m=e.products?.every(((e,t)=>{const n=p[t];return d(e.productDetails,n)>0})),f=(e,t)=>{u((n=>({...n,[e]:t})))},{originalPrice:g,dealPrice:h,offerValue:x}=i((()=>{const{price:t,compareAtPrice:n}=Object.entries(p).reduce(((t,[n,r])=>{const o=e.products[parseInt(n)],a=o.productDetails.variants.edges?.find((e=>e.node.id===r))?.node,i=parseFloat(a?.price??"0"),l=parseFloat(a?.compareAtPrice||i.toString());return t.price+=i,t.compareAtPrice+=l,t}),{price:0,compareAtPrice:0}),r=Math.max(t,n);let o=Math.min(t,n);e?.percentageOff?o=t*(1-e.percentageOff/100):e?.dealAmount?o=e.dealAmount:e?.amountOff&&(o=t-e.amountOff);const a=n-o;return{originalPrice:r.toFixed(2),dealPrice:o.toFixed(2),offerValue:a.toFixed(2)}}),[p,e.products,e.percentageOff,e.dealAmount,e.amountOff]);l((()=>{const e=()=>{s(window.innerWidth<786)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const y=e.customizations,b=y.comboBundle?.comboCardStyle||"auto",v="vertical"===b||"auto"===b&&!a,w=y.comboBundle?.embedContentVisibility,C="bundles"==e.appName?e.pageHeader?.title:e?.title,k="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return t.createElement("div",{className:`yt-comboBundle-bundle-container ${"left"===y.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-left":"right"===y.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-right":"center"===y.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-center":void 0}`,style:{lineHeight:"normal",maxWidth:"800px",marginBlock:y.comboBundle?.verticalMargin||"0px",display:"flex",flexDirection:"column",alignItems:"left"===y.comboBundle?.infoAlignment?"flex-start":"right"===y.comboBundle?.infoAlignment?"flex-end":"center"===y.comboBundle?.infoAlignment?"center":void 0,textAlign:y.comboBundle?.infoAlignment??"left",fontFamily:"system-ui, -apple-system, sans-serif"}},w&&y.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Title")&&t.createElement("div",{className:"yt-comboBundle-bundle-title-container",style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"10px"}},t.createElement("h2",{className:"yt-comboBundle-bundle-title",style:{fontSize:y.comboBundle?.productTitleFontSize||"28px",color:y.comboBundle?.titleTextColor||"#000",fontWeight:"bold",lineHeight:"1.6",margin:0}},C)),w&&y?.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Price")&&t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-comboBundle-bundle-price-container",style:{display:"flex",alignItems:"center",gap:"8px",color:y.comboBundle?.titleTextColor||"#000",fontSize:(parseInt(y.comboBundle?.productTitleFontSize?.replace("px",""))||28)-4+"px"}},t.createElement("div",{className:"yt-comboBundle-bundle-price-details",style:{display:"flex",alignItems:"center",gap:"5px",flexWrap:"wrap"}},t.createElement("span",{className:"yt-comboBundle-bundle-deal-price-text",style:{fontWeight:"bold",lineHeight:"1",minWidth:"fit-content"}},Kh(y.general.currencySymbol,e.storeCurrencyCode),Xh(h)),t.createElement("div",{className:"yt-comboBundle-bundle-original-price-text",style:{color:y.comboBundle?.titleTextColor||"#666",textDecoration:"line-through",verticalAlign:"middle",display:"inline-block",minWidth:"fit-content"}},Kh(y.general.currencySymbol,e.storeCurrencyCode),Xh(g)),t.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"}},e?.percentageOff?`${e?.percentageOff}% Off`:e?.amountOff?`${Kh(y.general.currencySymbol,e.storeCurrencyCode)}${Xh(e?.amountOff)} Off`:`Save ${Kh(y.general.currencySymbol,e.storeCurrencyCode)}${Xh(x)}`))),t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",margin:"15px 0px"},className:"yt-comboBundle-checkoutSpecific-container"},t.createElement("div",{style:{display:"flex",width:"12px",height:"12px",justifyContent:"center",alignItems:"center",alignContent:"center",borderRadius:"50%",backgroundColor:y.general?.ctaBackgroundColor||"#1e1e1e",flexShrink:0},className:"yt-comboBundle-checkoutSpecific-dot"},t.createElement("span",null)),t.createElement("p",{style:{fontSize:y.comboBundle.productDescriptionFontSize||"16px",color:y.comboBundle?.descriptionTextColor||"#000",alignItems:"center",margin:0,lineHeight:"1.2"},className:"yt-comboBundle-checkoutSpecific-text"},"Tax included. ",t.createElement("u",null,"Shipping")," calculated at checkout."))),y.comboBundle.subProductsSectionVisibility&&t.createElement(t.Fragment,null,v?t.createElement("div",{className:"yt-comboBundle-products-grid-vertical "+(a?"yt-comboBundle-products-grid-mobile":""),style:{display:"flex",flexDirection:"row",gap:"20px",marginTop:"10px",flexWrap:"wrap"}},e.products.map(((n,r)=>{const o=n?.productDetails?.variants?.edges?.find((e=>e?.node?.id===p[r]))?.node;return o?t.createElement(xf,{key:`combo-product-${r}-${n.productId}`,product:n,styles:y,originalPrice:g,dealPrice:h,selectedVariantId:p[r],onVariantChange:e=>f(r,e),isVertical:v,variantOptions:e.variantOptions,storeCurrencyCode:e.storeCurrencyCode}):null}))):t.createElement("div",{className:"yt-comboBundle-products-list-horizontal "+(a?"yt-comboBundle-products-list-mobile":""),style:{display:"flex",flexDirection:"column",gap:"10px",width:"100%"}},y.comboBundle.subProductsSectionVisibility&&e.products.map(((n,r)=>t.createElement(xf,{key:`combo-product-horizontal-${r}-${n.productId}`,product:n,styles:y,originalPrice:g,dealPrice:h,selectedVariantId:p[r],onVariantChange:e=>f(r,e),variantOptions:e.variantOptions}))))),t.createElement("div",{className:"yt-comboBundle-bundle-cta-section",style:{borderTop:"1px solid #eee",display:"flex",flexDirection:"column",rowGap:"5px",marginTop:"20px",width:"100%"}},t.createElement("button",{className:`yt-comboBundle-bundle-cta-button ${m?"":"yt-comboBundle-bundle-cta-button-disabled"} ${a?"yt-comboBundle-bundle-cta-button-mobile":""}`,style:{backgroundColor:m?y.general?.ctaBackgroundColor||"#121212":y.general.disabledButtonColor,color:y.general?.ctaTextColor||"#FFFFFF",fontSize:"16px",borderRadius:y.general.ctaBorderRadius??"20px",fontWeight:"bold",cursor:m?"pointer":"not-allowed",border:`1px solid ${m?y.general?.ctaBackgroundColor||"#121212":y.general.disabledButtonColor}`,boxShadow:y.general.ctaShadowType,padding:y.general?.ctaPadding,width:y.general?.ctaWidth,margin:"0"},disabled:!m,onMouseOver:e=>{y.general.customizeHoverState&&m&&(e.currentTarget.style.backgroundColor=y.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=y.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{y.general.customizeHoverState&&m&&(e.currentTarget.style.backgroundColor=y.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=y.general?.ctaTextColor||"#FFFFFF")},onClick:async()=>{try{if(o(!0),!n)return console.error("[ComboBundle.tsx] No addToCartFunction available"),void o(!1);const t=Object.entries(p).map((([t,n])=>{const r=e.products[parseInt(t)],o=r.productDetails.variants.edges.find((e=>e.node.id===n))?.node;return o?{variantId:n,price:Number(o.price)}:null})).filter((e=>null!==e)),r=Object.values(p);await n(Number(g),r,Number(h),t)}catch(e){console.error("[ComboBundle.tsx] Error adding to cart:",e)}o(!1)}},r?t.createElement(na,{color:"white",loading:r,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):t.createElement(t.Fragment,null,m?y.comboBundle?.ctaTitle??"Add Bundle to cart":y.general.outOfStockLabel||"Out of Stock"," "))),w&&y.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Description")&&t.createElement("div",{className:"yt-comboBundle-bundle-description-section",style:{margin:"20px 0px"}},t.createElement("h4",{className:"yt-comboBundle-bundle-description-header",style:{fontSize:"16px",color:y.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",margin:0,padding:"8px",backgroundColor:y.general.primaryColor+"20"}},"Description"),t.createElement("div",{className:"yt-comboBundle-bundle-description-content",style:{fontSize:y.comboBundle.productDescriptionFontSize||"16px",color:y.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",padding:"8px",backgroundColor:y.general.primaryColor+"08"}},t.createElement("p",null,k))))},bf=x.div`
|
|
3541
|
+
`;const af=n(((e,n)=>{const[r,o]=Jt(gm),a=i((()=>t=>{const n=e?.customVariantsQuantity?.find((e=>e.variantId===t?.id))?.quantity;return void 0!==n?n:e?.bundleProductsCustomQuantity?e?.bundleProductsCustomQuantity:t?r?.tracksInventory&&t.inventoryItem?.tracked?t.inventoryQuantity>0?t.inventoryQuantity:t.inventoryQuantity<=0&&"continue"===t.inventoryPolicy?1/0:0:1/0:0}),[r?.tracksInventory,e?.customVariantsQuantity,e?.bundleProductsCustomQuantity]),s=r?.variants.edges?.filter((e=>a(e.node)>0))||[],[d,p]=c(s?.[0]?.node),[u,m]=c(0),[f,g]=c("undefined"!=typeof window&&window.innerWidth<=600),[h,x]=c(1),[y,b]=c("idle"),[w,C]=c(null),[k,E]=c(null);l((()=>{if(r){const e=r.variants.edges?.filter((e=>a(e.node)>0));p(r?.selectedVariant??e[0]?.node)}}),[r,a]),l((()=>{const t=e.selectedProducts.find((e=>e.variantId===d?.id));x(t?t.quantity:0)}),[h,e.selectedProducts,d]);const T=()=>{d?.id&&r&&(b("check"),e.handleAddToBundle(d?.id,r,1),setTimeout((()=>{b("idle"),o(void 0)}),500))};if(l((()=>{const e=()=>g(window.innerWidth<=600);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[]),!r)return null;const{title:S,descriptionHtml:$,media:B,variants:z}=r,I=B.edges.map((e=>e?.node.preview.image??e?.node.image)).filter((e=>e?.url?.length>0));l((()=>{if(r&&d?.image?.url&&Array.isArray(I)){const e=I.findIndex((e=>e?.url===d?.image?.url));-1!==e&&e!==u&&m(e)}}),[d]);const N=e=>{const t=e.target.value,n=s?.find((e=>e.node.id===t))?.node;n&&a(n)>0&&p(n)};l((()=>{if(r){window.history.pushState({modalOpen:!0},"",window.location.href);const e=e=>{o(void 0),e.preventDefault()};return window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e),window.history.state?.modalOpen&&window.history.back()}}}),[r,o]);const D=e=>{C(e.targetTouches[0].clientX),E(null)},_=e=>{E(e.targetTouches[0].clientX)},P=()=>{if(null!==w&&null!==k&&I.length>1){const e=w-k,t=50;e>t?m((e=>e<I.length-1?e+1:0)):e<-t&&m((e=>e>0?e-1:I.length-1))}C(null),E(null)},O=Object.values(e.selectedProductsByTier||{}).reduce(((e,t)=>e+(t?.filter((e=>e===d?.id)).length||0)),0),A=e.customVariantsQuantity?.find((e=>e.variantId===d?.id))?.quantity,F=void 0!==A&&O>=A,M=e.hideAddToBundle||a(d)<=0||e.disableQuantitySelector&&O>=1||F||"idle"!==y,R=t.createElement(nf,{className:"yt-byob-modal-desktop-overlay"},t.createElement(rf,{$isSmallScreen:f,ref:n},t.createElement(of,{ref:n,className:"yt-byob-modal-desktop-container yt-variant-selection-modal"},t.createElement("div",{className:"yt-byob-modal-desktop yt-variant-selection-modal "+(f?"small-screen":"large-screen")},t.createElement(tf,{className:"yt-byob-modal-desktop-close",onClick:()=>{o(void 0)},style:{backgroundColor:"white"}},t.createElement(ft,{size:"25"})),t.createElement("div",{className:"yt-byob-modal-desktop-image-section image-section"},t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-byob-modal-desktop-image-swipe",onTouchStart:D,onTouchMove:_,onTouchEnd:P},t.createElement(ef,{small:Jh(I[u]?.url),medium:Jh(I[u]?.url),large:Jh(I[u]?.url),hideDownload:!0,className:"yt-byob-modal-desktop-main-image main-image",imageBackgroundColor:"#000"})),t.createElement("div",{className:"yt-byob-modal-desktop-image-gallery image-gallery",style:{display:"flex",flexDirection:"row",overflow:"auto",gap:"10px",scrollbarWidth:"none"}},I.length>1&&I.filter((e=>e?.url.length>0)).map(((n,r)=>t.createElement("img",{key:r,className:"yt-byob-modal-desktop-gallery-thumb "+(u===r?"active":""),src:Jh(n?.url),alt:n.altText||`${S} - Image ${r+1}`,onClick:()=>m(r),style:{width:"73px",height:"73px",cursor:"pointer",borderRadius:"7px",border:"1px solid lightgray",...u===r&&{border:`2px solid ${e.themeColor||"#111"}`},objectFit:"cover"},loading:"lazy"})))))),t.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"}},t.createElement("h2",{className:"yt-byob-modal-desktop-title"},s.length>1?d?.displayName:r.title),"ratingOnly"===e.reviewRatingType&&(r?.rating?.averageRating??0)>0&&t.createElement("div",{className:"yt-byob-modal-desktop-rating",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Kr,{color:"gold",size:14})," ",t.createElement("span",{style:{marginLeft:6}},r?.rating?.averageRating,"rating")),"ratingAndReviewCount"===e.reviewRatingType&&(r?.rating?.averageRating??0)>0&&t.createElement("div",{className:"yt-byob-modal-desktop-rating-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Kr,{color:"gold",size:14})," ",r?.rating?.averageRating,t.createElement(tr,{size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",r?.rating?.ratingCount," reviews)"),t.createElement("div",{className:"yt-byob-modal-desktop-variant-price-wrapper",style:{display:"flex",flexDirection:"column",gap:"2px",marginTop:"20px"}},s.length>1&&t.createElement("div",{className:"yt-byob-modal-desktop-variant-selector"},t.createElement("div",{className:"yt-byob-modal-desktop-variant-label",style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid #e0e0e0",paddingBottom:"5px",fontSize:"16px",color:"#999",position:"relative",marginBottom:"10px"}},t.createElement("span",{style:{flexShrink:0}},r.options[0].name," :"," ",t.createElement("strong",{style:{color:"#000",paddingLeft:"5px"}},d?.title)),t.createElement("select",{className:"yt-byob-modal-desktop-variant-select",value:d?.id||"",onChange:N,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}},s.map((({node:e})=>t.createElement("option",{key:e.id,value:e.id,disabled:0===a(e)},e.title)))),t.createElement("span",{className:"yt-byob-modal-desktop-variant-chevron",style:{position:"absolute",right:5,pointerEvents:"none",fontSize:"12px",color:"#000"}},t.createElement(go,null)))),t.createElement("div",{className:"yt-byob-modal-desktop-price-atc-wrapper",style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"}},t.createElement("div",{className:"yt-byob-modal-desktop-price",style:{width:"fit-content",minWidth:"fit-content",paddingRight:"10px",display:"flex",flexDirection:"column"}},d?.compareAtPrice&&parseFloat(d.compareAtPrice)>parseFloat(d?.price)&&t.createElement("div",{className:"yt-byob-modal-desktop-compare-price",style:{textDecoration:"line-through",opacity:"0.5",lineHeight:"normal"}},Kh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),Xh(d?.compareAtPrice)),t.createElement("div",{className:"yt-byob-modal-desktop-current-price"},t.createElement("span",{style:{fontSize:"20px",fontWeight:"600",color:"#000",textAlign:"center",lineHeight:"normal"}},Kh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),Xh(d?.price)))),t.createElement("div",{className:"yt-byob-modal-desktop-atc-wrapper yt-product-modal-atc-wrapper",style:{width:"80%"}},t.createElement("button",{className:"yt-byob-modal-desktop-atc-button yt-product-modal-atc-button",style:{textTransform:"uppercase",fontWeight:"800",width:"100%",border:"none",backgroundColor:e.themeColor||"#111",borderRadius:e.cornerRadius,color:e.primaryTextColorCta||"#fff",minHeight:"40px",padding:"0px 15px",position:"relative",overflow:"hidden",opacity:M?.5:1,cursor:M?"not-allowed":"pointer"},onClick:e=>{e.stopPropagation(),e.preventDefault(),T()},disabled:M},e.styles.byob.addToBundleCTAText??"Add to bundle")))),t.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"}},t.createElement("span",null)),t.createElement("span",{className:"yt-byob-modal-desktop-description yt-description-content",style:{scrollBehavior:"smooth"},dangerouslySetInnerHTML:{__html:$}})))))),L=t.createElement(nf,{className:"yt-byob-modal-mobile-overlay"},t.createElement(rf,{className:"yt-byob-modal-mobile-content",style:{padding:"0px",position:"relative"},$isSmallScreen:f,ref:n},t.createElement(of,{ref:n,className:"yt-byob-modal-mobile-container yt-variant-selection-modal"},t.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:()=>{o(void 0)}},t.createElement(ho,{className:"yt-byob-modal-mobile-close-icon",style:{height:"22px",width:"22px",padding:"4px",color:"black"},onMouseEnter:e=>e.currentTarget.style.color="black"})),t.createElement("div",{className:"yt-byob-modal-mobile yt-variant-selection-modal small-screen",style:{padding:"0px"}},t.createElement("div",{className:"yt-byob-modal-mobile-image-section image-section"},t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-byob-modal-mobile-image-swipe",style:{position:"relative"},onTouchStart:D,onTouchMove:_,onTouchEnd:P},t.createElement(ef,{small:Jh(I[u]?.url),medium:Jh(I[u]?.url),large:Jh(I[u]?.url),hideDownload:!0,className:"yt-byob-modal-mobile-main-image main-image",imageBackgroundColor:"#000"}),t.createElement("div",{className:"yt-byob-modal-mobile-image-indicators",style:{position:"absolute",bottom:"20px",width:"100%",display:"flex",justifyContent:"center",alignItems:"center"}},I.length>1&&I.map(((e,n)=>t.createElement("span",{key:n,className:"yt-byob-modal-mobile-indicator "+(u===n?"active":""),style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:u===n?"#FFFFFF":"#EBEBEB",margin:"0 3px",cursor:"pointer",backdropFilter:"blur(10px)"}}))))),t.createElement("div",{className:"yt-byob-modal-mobile-image-gallery image-gallery",style:{display:"flex",flexDirection:"row",overflowX:"auto",padding:"5px 20px",gap:"5px",scrollbarWidth:"none"}},I.length>1&&I.map(((n,r)=>t.createElement("img",{key:r,className:"yt-byob-modal-mobile-gallery-thumb "+(u===r?"active":""),src:Jh(n?.url),alt:n.altText||`${S} - Image ${r+1}`,onClick:()=>m(r),style:{width:"60px",height:"60px",cursor:"pointer",borderRadius:"7px",border:"1px solid lightgray",...u===r&&{border:`2px solid ${e.themeColor||"#111"}`},objectFit:"cover"},loading:"lazy"})))))),t.createElement("div",{className:"yt-byob-modal-mobile-details-section details-section",style:{padding:"0 30px",margin:"15px 0",paddingBottom:"120px"}},t.createElement("h2",{className:"yt-byob-modal-mobile-title",style:{margin:"0px"}},s.length>1?d?.displayName:r.title),"ratingOnly"===e.reviewRatingType&&(e?.rating?.averageRating??0)>0&&t.createElement("div",{className:"yt-byob-modal-mobile-rating",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Kr,{color:"gold",size:14})," ",t.createElement("span",{style:{marginLeft:6}},e?.rating?.averageRating," rating")),"ratingAndReviewCount"===e.reviewRatingType&&(e?.rating?.averageRating??0)>0&&t.createElement("div",{className:"yt-byob-modal-mobile-rating-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Kr,{color:"gold",size:14})," ",e?.rating?.averageRating,t.createElement(tr,{className:"yt-byob-modal-mobile-verified-icon",style:{color:"dodgerblue",marginLeft:"4px"},size:14})," ","(",e?.rating?.ratingCount," reviews)"),t.createElement("div",{className:"yt-byob-modal-mobile-divider",style:{opacity:"0.2",border:"none",height:"2px",backgroundColor:"#000000",margin:"10px 0px",display:"block !important"}},t.createElement("span",null)),t.createElement("div",{className:"yt-byob-modal-mobile-description yt-description-content",style:{scrollbarWidth:"none",scrollBehavior:"smooth",margin:"0px"},dangerouslySetInnerHTML:{__html:$}})))),t.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}},s.length>1&&t.createElement("div",{className:"yt-byob-modal-mobile-variant-selector"},t.createElement("div",{className:"yt-byob-modal-mobile-variant-label",style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid #e0e0e0",paddingBottom:"5px",fontSize:"16px",color:"#999",position:"relative",margin:"10px 0"}},t.createElement("span",{style:{flexShrink:0}},r.options[0].name," :"," ",t.createElement("strong",{style:{color:"#000",paddingLeft:"5px"}},d?.title)),t.createElement("select",{className:"yt-byob-modal-mobile-variant-select",value:d?.id||"",onChange:N,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}},s.map((({node:e})=>t.createElement("option",{key:e.id,value:e.id,disabled:0===a(e)},e.title)))),t.createElement("span",{className:"yt-byob-modal-mobile-variant-chevron",style:{position:"absolute",right:5,pointerEvents:"none",fontSize:"12px",color:"#000"}},t.createElement(go,null)))),t.createElement("div",{className:"yt-byob-modal-mobile-price-atc-wrapper",style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"}},t.createElement("div",{className:"yt-byob-modal-mobile-price",style:{width:"fit-content",minWidth:"fit-content",display:"flex",flexDirection:"column",paddingRight:"10px"}},d?.compareAtPrice&&t.createElement("div",{className:"yt-byob-modal-mobile-compare-price",style:{textDecoration:"line-through",opacity:"0.5",lineHeight:"normal"}},Kh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),Xh(d?.compareAtPrice)),t.createElement("div",{className:"yt-byob-modal-mobile-current-price"},t.createElement("span",{style:{fontSize:"20px",fontWeight:"600",color:"#000",textAlign:"center",lineHeight:"normal"}},Kh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),Xh(d?.price)))),!e.hideAddToBundle&&a(d)>0&&(!e?.disableQuantitySelector||h<1)&&t.createElement("div",{className:"yt-byob-modal-mobile-atc-wrapper",style:{width:"100%"}},t.createElement("button",{className:"yt-byob-modal-mobile-atc-button",style:{textTransform:"uppercase",fontWeight:"800",width:"100%",cursor:"pointer",border:"none",backgroundColor:e.themeColor||"#111",borderRadius:e.cornerRadius,color:e.primaryTextColorCta||"#fff",minHeight:"40px",padding:"0px 15px",position:"relative",overflow:"hidden"},onClick:e=>{e.stopPropagation(),e.preventDefault(),T()},disabled:"idle"!==y},e.styles.byob.addToBundleCTAText||"Add to Bundle"))))));return v.createPortal(f?L:R,document.body)})),lf=({options:e,selectedValue:n,onChange:r,type:o="text",isOptionAvailable:a,isMobile:i})=>t.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"}},e?.map((e=>{const l=!a||a(e.name);return i&&!l?null:t.createElement("div",{key:e.name,onClick:()=>{l&&r(e)},style:{cursor:l?"pointer":"not-allowed"}},((e,n)=>{const r=!a||a(e.name),i={cursor:r?"pointer":"not-allowed",border:n?"2px solid #333":"1px solid #d1d5db",transition:"all 0.2s ease",opacity:r?1:.5};if("color"===o)return e.value&&(()=>{if(!e.value.trim())return!1;if(e.value===e.name||e.value.length<3)return!1;try{const t=document.createElement("div");return t.style.color=e.value,""!==t.style.color}catch{return!1}})()?t.createElement("div",{style:{...i,width:24,height:24,borderRadius:"50%",backgroundColor:e.value}}):t.createElement("div",{style:{...i,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"}},e.name);return"image"===o?t.createElement("img",{src:Nn(e.value,48,85,"webp")||"/placeholder.svg",alt:e.name,style:{...i,width:24,height:24,borderRadius:"50%",objectFit:"cover"}}):t.createElement("div",{style:{...i,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"}},e.name)})(e,n?.name===e.name))}))),cf=({product:e,isOpen:n,onClose:r,variantOptions:o,cta:a,onConfirm:s})=>{const d=i((()=>t=>t?e?.tracksInventory&&t?.inventoryItem?.tracked?t.inventoryQuantity>0?t?.inventoryQuantity:t.inventoryQuantity<=0&&"continue"===t.inventoryPolicy?1/0:0:1/0:0),[e?.tracksInventory]),p=i((()=>{const t=e.variants.edges.find((e=>{const t=e.node;return d(t)>0}))?.node;return t?.title&&"Default Title"!==t.title?t.title.split(" / "):e.options?.map((e=>e.values[0]))||[]}),[e,d]),[u,m]=c(p),[f,g]=c(window.innerWidth<1024);l((()=>{const e=()=>g(window.innerWidth<1024);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[]),l((()=>{const e=e=>{"Escape"===e.key&&r()};return n&&document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}),[n,r]);const h=e.variants.edges.find((t=>t.node.title===(e.options?.length>0?u.join(" / "):u[0])))?.node,x=h?.image?.url||e.featuredMedia?.preview?.image?.url,y=Nn(x,150,85,"webp"),b=e=>{if(!o?.options)return"text";const t=o.options.find((t=>t.name===e));return t?.type||"text"},w=e=>{if(!o?.options)return e.values.map((e=>({name:e,value:e})));const t=o.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}}))},C=(e,t)=>{const n=u[t];if(!n)return null;return w(e).find((e=>e.name===n))||null};if(!n)return null;const k=t.createElement("div",{onClick:r,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"},t.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"}}},t.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"),t.createElement("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"16px 20px",borderBottom:"1px solid #f0f0f0"}},t.createElement("img",{src:y,alt:e.title,style:{width:60,height:60,borderRadius:8,objectFit:"cover",flexShrink:0,transition:"opacity 0.3s ease"}}),t.createElement("div",{style:{display:"flex",flexDirection:"column",flex:1,gap:4}},t.createElement("div",{style:{fontSize:14,fontWeight:600,color:"#333"}},e.title))),t.createElement("div",{style:{padding:"20px"}},e.options.map(((n,r)=>t.createElement("div",{key:n.name,style:{display:"flex",flexDirection:"column",gap:8,marginBottom:n?.values?.length>1?16:0}},n?.values?.length>1&&t.createElement(t.Fragment,null,t.createElement("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8}},t.createElement("span",{style:{fontSize:14,fontWeight:500,color:"#333"}},"Select ",n.name),t.createElement("span",{style:{fontSize:12,fontWeight:500,color:"#666",backgroundColor:"#f5f5f5",padding:"4px 12px",borderRadius:16,textTransform:"capitalize"}},C(n,r)?.name||n.values[0])),t.createElement(lf,{options:w(n),selectedValue:C(n,r),onChange:e=>{((e,t)=>{const n=[...u];n[e]=t.name,m(n)})(r,e)},type:b(n.name),isOptionAvailable:t=>((t,n)=>{const r=[...u];r[t]=n;const o=e.options?.length>0?r.join(" / "):r[0],a=e.variants.edges.find((e=>e.node.title===o))?.node;return!!a&&d(a)>0})(r,t),isMobile:f})))))),t.createElement("button",{onClick:()=>{const t=e.variants.edges.find((t=>t.node.title===(e.options?.length>0?u.join(" / "):u[0])))?.node,n=!!t&&d(t)>0;if(t?.id&&n)s(t.id),r();else{console.warn("yt::variant options modal - selected variant not available or out of stock:",u);const t=e.variants.edges.find((e=>d(e.node)>0))?.node.id;t&&(s(t),r())}},style:{width:"100%",fontSize:14,fontWeight:600,textTransform:"uppercase",backgroundColor:a.backgroundColor,color:a.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 v.createPortal(k,document.body)},sf=({coverImageUrl:e,mobileCoverImageUrl:n,alt:r="Background",styles:o})=>{const a=[{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}],i=(e,t)=>{if(e&&e.includes("cdn.shopify"))try{const n=new URL(e),r=n.searchParams;return r.has("format")||r.set("format","webp"),r.has("quality")||r.set("quality","80"),r.set("width",t.toString()),n.toString()}catch{const n=e.includes("?")?"&":"?";return`${e}${n}format=webp&quality=80&width=${t}`}},l=e=>e?a.map((({imageWidth:t,descriptor:n})=>{const r=i(e,t);return r?`${r} ${n}w`:""})).filter(Boolean).join(", "):"";if(!e&&!n)return null;const c=e||n||"",s=i(c,800)||c,d=[];if(n&&n!==e){const e=l(n);e&&d.push(t.createElement("source",{key:"mobile",media:"(max-width: 768px)",srcSet:e}))}if(e){const n=l(e);n&&(d.length>0?d.push(t.createElement("source",{key:"desktop",media:"(min-width: 769px)",srcSet:n})):d.push(t.createElement("source",{key:"desktop",srcSet:n})))}else if(n){const e=l(n);e&&d.push(t.createElement("source",{key:"mobile",srcSet:e}))}return t.createElement("div",{style:{width:"100%",display:"block"}},t.createElement("picture",{style:{display:"block",width:"100%"}},d,t.createElement("img",{src:s,alt:r,style:{width:"100%",height:"auto",display:"block",...o},loading:"eager",fetchPriority:"high",sizes:"100vw"})))};function df({quantity:e,setQuantity:n,remainingQuantity:r,handleAddToBundle:o,variantId:a,product:i,handleRemoveItem:l,hideAddToBundle:c,selectedVariantInventoryQty:s}){const d={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=e<s;return t.createElement(Cu,{className:"yt-byob-quantity-selector-container"},t.createElement("button",{className:"yt-byob-quantity-minus-button",onClick:t=>{t.stopPropagation();const r=Math.max(0,e-1);n(r),l&&a&&l(a,1)},style:d},"-"),t.createElement(ku,{className:"yt-byob-quantity-display"},e," added"),t.createElement("button",{className:"yt-byob-quantity-plus-button",onClick:t=>{t.stopPropagation();const l=Math.min(r,e+1,s);n(l),o&&a&&i&&o(a,i,1)},disabled:!p||c,style:{...d,cursor:!p||c?"not-allowed":"pointer",opacity:!p||c?.6:1}},"+"))}const pf=({product:e,styles:n,selectedVariant:r})=>{const[o,a]=c(!1),s=i((()=>Jh(r?.image?.url||e?.featuredMedia?.preview?.image?.url||e?.media?.edges?.[0]?.node?.image?.url)||""),[r?.image?.url,e?.featuredMedia?.preview?.image?.url,e?.media?.edges]),d=i((()=>e?.media?.edges?.map((e=>Jh(e?.node?.preview?.image?.url??e?.node?.image?.url))).filter(Boolean)??[]),[e?.media?.edges]),p=i((()=>d?.[1]??s??""),[d,s]);l((()=>{if(s){(new Image).src=s}}),[s]);const u=i((()=>s||d?.[0]),[s,d]);return t.createElement("div",{className:"yt-byob-image-hover-container",style:{position:"relative",width:"100%",overflow:"hidden",aspectRatio:n.general.imageAspectRatio||"1/1"},onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1)},t.createElement("div",{className:"yt-byob-image-inner-container",style:{width:"100%",height:"100%",position:"relative"}},t.createElement("img",{className:"yt-byob-image-main",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",objectPosition:"top",opacity:o&&u!==p?0:1,transition:d?.length>0?"opacity 300ms ease, transform 300ms ease":"",transform:o?"scale(1.1)":"scale(1)"},src:u,alt:e.title}),u!==p&&t.createElement("img",{className:"yt-byob-image-hover",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",opacity:o?1:0,transition:"opacity 400ms ease, transform 400ms ease",transform:o?"scale(1.1)":"scale(1)",position:"absolute",top:0,left:0,objectPosition:"top"},src:p,alt:e.title})))},uf=({product:e,bundle:n,handleAddToBundle:r,hideAddToBundle:o,remainingQuantity:i,themeColor:s,handleRemoveItem:d,transitionActive:p,idx:u,selecteditems:m,customVariantsQuantity:f,currentProductTier:g,showFreebieTierProductPrices:h})=>{const x=Kt(gm),y=n.customizations,b=y?.byob?.variantSelectorType,[v,w]=c(!1),C=y.general?.variantTitleSuffix?e?.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 r=t[e];let o=0;for(;o<n.length&&o<r.length&&n[n.length-1-o]===r[r.length-1-o];)o++;n=n.slice(n.length-o)}return n.length<1?e:e.map((e=>{const t=e.node.title.split(" "),r=t.slice(0,t.length-n.length).join(" ");return{...e,node:{...e.node,title:r,commonSuffix:n.join(" ")}}}))})(e?.variants?.edges);if(!C||!C.length)return t.createElement(t.Fragment,null);const k=a((t=>{const r=f?.find((e=>e.variantId===t))?.quantity;if(void 0!==r)return r;if(n?.customProductsQuantity)return n?.customProductsQuantity;const o=C?.find((e=>e.node.id===t)),a=o?.node;return a?e.tracksInventory&&a.inventoryItem?.tracked?a.inventoryQuantity>0?a.inventoryQuantity:a.inventoryQuantity<=0&&"continue"===a.inventoryPolicy?1/0:0:1/0:0}),[C,f,e.tracksInventory]),E=C?.find((e=>k(e.node.id)>0))?.node?.id;if(!E&&!y.general.showOutOfStockProducts)return t.createElement(t.Fragment,null);const[T,S]=c(C?.find((e=>k(e.node.id)>0))?.node?.id||C[0]?.node?.id),[$,B]=c(0),[z,I]=c(window.innerWidth<450),[N,D]=c("normal"),_=C?.find((e=>e?.node?.id===T))?.node,P=k(T||"");l((()=>{const e=m.find((e=>e.variantId===T));B(e?e.quantity:0)}),[$,m,T]),l((()=>{const e=()=>{I(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),l((()=>{CSS.supports("font-weight","500")?D("500"):CSS.supports("font-weight","400")?D("400"):CSS.supports("font-weight","600")&&D("600")}),[]),l((()=>{document.documentElement.style.setProperty("--yt-bundle-font-weight",N)}),[N]),l((()=>{if(T&&!C?.some((e=>e.node.id===T))){const e=C.find((e=>k(e.node.id)>0))?.node.id||C[0]?.node?.id;e&&S(e)}}),[T,C,k]);const O=e.variants&&e.variants.edges?.length>1&&"customOptions"!==b,A="undefined"!=typeof window?(window?.ytapp||window?.ytBundleApp)?.storeId:void 0,F="53933408435"===A,M="75851235630"===A,L=(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[]})(e),j=L.length>0;return t.createElement(t.Fragment,null,t.createElement(Su,{borderRadius:y?.byob.borderRadius,borderColor:y?.byob.borderColor,shadowType:y?.byob.shadowType,backgroundColor:y?.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(P<=0)return;const t={...e,variants:{...e.variants,edges:C},selectedVariant:_};x(t)},onMouseEnter:e=>{e.currentTarget.style.transform="scale(1.01)"},onMouseLeave:e=>{e.currentTarget.style.transform="scale(1)"},style:{WebkitTapHighlightColor:"transparent"}},t.createElement($u,{className:"yt-byob-image-wrapper"},t.createElement(pf,{product:e,styles:y,selectedVariant:_}),n?.productCardBadgeText&&t.createElement("div",{className:"yt-byob-product-badge",style:{position:"absolute",top:"0px",left:"0px",backgroundColor:y?.general.primaryColor||"#111",color:y?.general.primaryContrastColor||"#fff",zIndex:1,margin:"0px",whiteSpace:"pre",padding:"4px 8px",fontSize:"12px",borderTopLeftRadius:y.byob.borderRadius}},n.productCardBadgeText),O&&t.createElement("div",{className:"yt-byob-variant-selector-wrapper",style:{position:"relative",width:"100%"}},t.createElement(Bu,{className:"yt-byob-variant-selector",isCoralHaze:F,onClick:e=>{e.preventDefault(),e.stopPropagation()},value:T||"",onChange:e=>{e.stopPropagation(),e.preventDefault(),S(e.target.value)}},C?.map((e=>{const n=window.innerWidth<=320?10:window.innerWidth<=420?15:22,r=e.node.title.length>n?e.node.title.substring(0,n)+"...":e.node.title;return t.createElement("option",{key:e.node.id,value:e.node.id},r)}))),t.createElement("div",{className:"yt-byob-variant-chevron",style:{position:"absolute",right:"16px",bottom:"10px",pointerEvents:"none"}},t.createElement(R,null)))),t.createElement("div",{className:"yt-byob-product-content"},"enabled"===n?.customizations?.byob?.productCardCategoryVisibility&&j&&t.createElement("div",{className:"yt-byob-product-categories-wrapper",style:{padding:"2px 4px"}},t.createElement("div",{className:"yt-byob-product-categories",style:{display:"flex",flexWrap:"wrap",gap:"4px"}},L.slice(0,2).map(((e,n)=>t.createElement("span",{className:"yt-byob-category-tag",key:n,style:{fontSize:z?"8px":"12px",color:"#666",fontWeight:"500"}},e.charAt(0).toUpperCase()+e.slice(1)))),L.length>2&&t.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"}},"+",L.length-2," more"))),t.createElement(zu,{isMobile:z,showBorder:n?.showBorder??!0,style:{...!y?.byob.productsPriceVisibility&&{padding:"8px"},...y?.byob.productTitleFontSize&&{fontSize:y?.byob.productTitleFontSize}},className:"yt-byob-product-title-wrapper"},t.createElement("div",{style:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",lineHeight:"normal"},className:"yt-byob-product-title"},M?String(_?.displayName).replace("- Default Title",""):e.title,_?.commonSuffix?" -"+_?.commonSuffix:""))),"ratingOnly"===n?.reviewRatingType&&(e?.rating?.averageRating??0)>0&&t.createElement("div",{className:"yt-byob-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Kr,{color:"gold",size:14})," ",t.createElement("span",{style:{marginLeft:6}},e?.rating?.averageRating," rating")),"ratingAndReviewCount"===n?.reviewRatingType&&(e?.rating?.averageRating??0)>0&&t.createElement("div",{className:"yt-byob-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Kr,{color:"gold",size:14})," ",e?.rating?.averageRating,t.createElement(tr,{className:"yt-byob-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",e?.rating?.ratingCount," reviews)"),y?.byob.productsPriceVisibility&&t.createElement("div",{className:"yt-byob-product-price yt-bundle-builder-product-price",style:{marginBottom:"5px",padding:n?.showBorder?"0px 10px":"0 4px"}},g?.isFreebieTier&&!h?t.createElement(t.Fragment,null,t.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"14px",textDecoration:"line-through",color:"#888",marginRight:"6px"}},Kh(y.general.currencySymbol,n?.storeCurrencyCode)??"Rs.",Xh(_?.price)),t.createElement("span",{className:"yt-byob-current-price",style:{color:y.general.primaryColor||"#d32f2f",fontWeight:"bold"}},"FREE")):parseFloat(_?.price??"0")>0?t.createElement("span",{className:"yt-byob-current-price"},Kh(y.general.currencySymbol,n?.storeCurrencyCode)??"Rs.",Xh(_?.price)):t.createElement("span",{className:"yt-byob-free-price"},"Free"),(!g?.isFreebieTier||h)&&_?.compareAtPrice&&y?.byob.compareAtPriceVisibility&&parseFloat(_.compareAtPrice)>parseFloat(_?.price)&&t.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"14px"}},Kh(y.general.currencySymbol,n?.storeCurrencyCode)??"Rs.",Xh(_.compareAtPrice))),(P>0||P===1/0)&&t.createElement(Iu,{borderRadius:y?.byob.borderRadius,className:"yt-byob-add-to-bundle-wrapper yt-product-atc-wrapper"},(0===$||void 0===$)&&t.createElement(Eu,{style:{...!o&&{backgroundColor:y?.general.primaryColor||"#111",color:y?.general.primaryContrastColor||"#fff"}},disabled:o,onClick:t=>{t.stopPropagation(),t.preventDefault(),B(1),(()=>{if(!T)return;"customOptions"===b&&C.length>1?w(!0):r(T,e,1)})()},className:"yt-byob-add-to-bundle-button yt-product-atc-button"},y?.byob.addToBundleCTAText),!n?.disableQuantitySelector&&$>0&&T&&t.createElement(Tu,{className:"yt-byob-quantity-selector-container visible",style:{overflow:"hidden"}},t.createElement(df,{remainingQuantity:i,setQuantity:B,quantity:$,handleAddToBundle:r,variantId:T,product:e,handleRemoveItem:d,hideAddToBundle:o,selectedVariantInventoryQty:P})),n?.disableQuantitySelector&&$>0&&T&&t.createElement(Eu,{style:{backgroundColor:"#747474",color:y?.general.primaryContrastColor||"#fff",display:"flex",justifyContent:"space-between",overflow:"hidden",height:"40px"},className:"yt-byob-added-button yt-product-atc-single-qty-selector"},t.createElement(Nu,{className:"yt-byob-added-text yt-product-atc-single-qty-selector-added"},"ADDED"),t.createElement(Du,{className:"yt-byob-single-qty-remove yt-product-atc-single-qty-selector-remove",onClick:e=>{e.stopPropagation();const t=Math.max(0,$-1);B(t),d&&T&&d(T,1)}},t.createElement(po,{style:{color:"#fff",fontSize:"20px"}})))),P<=0&&P!==1/0&&t.createElement(Eu,{style:{backgroundColor:y.general.disabledButtonColor,color:"#fff",cursor:"not-allowed",transition:"transform 0.2s ease-in-out"},className:"yt-product-atc-disabled"},y?.general.outOfStockLabel||"Out of Stock")),"customOptions"===b&&v&&C.length>1&&t.createElement(cf,{product:e,isOpen:v,onClose:()=>w(!1),variantOptions:n.variantOptions,cta:{textColor:y.general.ctaTextColor,backgroundColor:y.general.primaryColor},onConfirm:t=>{S(t),r(t,e,1)}}))},mf=({currentStep:e,setCurrentProductTier:n,totalSteps:r,tiers:o,isMobile:a,selectedProductsByTier:i,primaryColor:l="#000",primaryTextColorCta:c="#fff",tierNavigation:s})=>t.createElement("div",{className:"yt-byob-stepper-container",style:{textAlign:"center",fontSize:"20px"}},t.createElement("div",{className:"yt-byob-stepper-steps",style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"center"}},Array.from({length:r}).map(((c,d)=>{const p=d+1,u=o[d].minimumQuantity-(i[d]?.length??0)==0,m=d===e;return l="black"===l?"#000000":l,t.createElement(t.Fragment,{key:p},t.createElement("div",{className:"yt-byob-stepper-step-wrapper",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:"pointer",gap:a?"4px":"8px"},onClick:()=>!1===s?()=>{}:n(p-1)},t.createElement("div",{className:"yt-byob-stepper-step-number",style:{fontSize:"14px"}},"Step ",p),t.createElement("div",{className:"yt-byob-stepper-step-bar",style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"center",cursor:"pointer"}},t.createElement("div",{className:"yt-byob-stepper-step-left-bar",style:{height:"3px",width:a?"30px":"50px",backgroundColor:u?l:m?"#666666":"#CBD5E0",display:"block",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px"}}),t.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"}}),t.createElement("div",{className:"yt-byob-stepper-step-right-bar",style:{height:"3px",width:a?"30px":"50px",backgroundColor:u?l:m?"#666666":"#CBD5E0",display:"block",marginRight:d<r?a?"4px":"6px":"",borderTopRightRadius:"5px",borderBottomRightRadius:"5px"}}))))}))),t.createElement("div",{className:"yt-byob-stepper-title",style:{margin:a?"16px 0px":"15px 0px",fontSize:a?"16px":"18px",padding:"4px",background:"rgba(0, 0, 0, 0.03)",borderBottom:"1px solid rgba(130, 130, 130, 0.28)"}},o[e]?.title)),ff=({isMobile:e,setSearchTerm:n,searchTerm:r,styles:o,setSortBy:a})=>{const[i,s]=c(!1),[d,p]=c(r);return l((()=>{const e=setTimeout((()=>{n(d)}),300);return()=>clearTimeout(e)}),[d,n]),t.createElement("div",{className:"yt-byob-sort-filter-container",style:{display:"flex",flexDirection:e?"column":"row",justifyContent:"space-between",alignItems:e?"flex-end":"center",textAlign:"center",marginBottom:"20px",width:"97%",gap:e?"10px":"0"}},t.createElement("div",{className:"yt-byob-sort-filter-inner",style:{display:"flex",flexDirection:i&&e?"column":e?"row-reverse":"row",justifyContent:"space-between",alignItems:i?"":"center",gap:"12px",width:"100%"}},t.createElement("div",{className:"yt-byob-search-wrapper",style:{position:"relative",display:"flex",alignItems:"center",width:e?i?"100%":"auto":"400px",transition:"width 0.3s ease-in-out"}},e&&!i?t.createElement(so,{className:"yt-byob-search-icon",fontSize:"20px",color:"#555",style:{cursor:"pointer",lineHeight:"normal"},onClick:()=>s(!0)}):t.createElement(t.Fragment,null,t.createElement("input",{className:"yt-byob-search-input",style:{width:"100%",padding:e?"10px 12px":"10px 14px",fontSize:"14px",outline:"none",color:"#333",border:"1px solid #c7c7c7",borderRadius:o?.byob.borderRadius,boxShadow:o?.byob.borderColor?"0 2px 4px rgba(0, 0, 0, 0.1)":"none",textAlign:"start"},placeholder:"Search by Product Name",value:d,onChange:e=>p(e.target.value)}),!i&&t.createElement("span",{className:"yt-byob-search-icon-input",style:{position:"absolute",right:"12px",color:"#aaa",fontSize:"16px",display:"flex",alignItems:"center",justifyContent:"center",background:"white",paddingLeft:"5px"}},t.createElement(so,{fontSize:"18px",style:{lineHeight:"normal"}}))),e&&i&&t.createElement("span",{className:"yt-byob-search-close-icon",style:{position:"absolute",right:"12px",color:"#aaa",fontSize:"16px",cursor:"pointer"},onClick:()=>s(!1)},"✖")),t.createElement("div",{className:"yt-byob-filter-wrapper",style:{display:"flex",alignItems:"center",textAlign:"center",border:window.innerWidth>600?"1px solid #d1d5db":"",padding:"8px 12px",fontSize:"14px",cursor:"pointer",borderRadius:o?.byob.borderRadius,boxShadow:o?.byob.borderColor?window.innerWidth>600?"0 2px 4px rgba(0, 0, 0, 0.1)":" ":"none"}},t.createElement("span",{className:"yt-byob-filter-label",style:{fontSize:"14px",color:"#555",marginRight:"6px"}},"Sort:"),t.createElement("select",{className:"yt-byob-filter-select",style:{flex:1,border:"none",height:"auto",padding:"0px",marginBottom:"0px",background:"transparent",fontSize:"14px",color:"#333",fontWeight:"500",width:e?"120px":"",outline:"none",cursor:"pointer",textAlign:"start"},onChange:e=>a(e.target.value)},t.createElement("option",{value:"best-selling"},"Featured"),t.createElement("option",{value:"title-asc"},"Product Title (A-Z)"),t.createElement("option",{value:"title-desc"},"Product Title (Z-A)"),t.createElement("option",{value:"price-low-to-high"},"Price (Low to High)"),t.createElement("option",{value:"price-high-to-low"},"Price (High to Low)")))))},gf=({styles:e,isMobile:n,categories:r,activeCategory:o,onCategoryChange:a})=>{const i=e=>{a(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"===e?.byob?.categoryFilterOnPage?t.createElement("div",{className:"yt-byob-category-filter-wrapper",style:{overflowX:n?"auto":"visible",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",width:"100%"}},t.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",...r].map((r=>{const a=o===r;return t.createElement("button",{key:r,onClick:()=>i(r),className:"yt-byob-category-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:a?"600":"400",color:a?e.general.primaryColor:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:a?l(e.general.primaryColor,.07):"transparent",borderBottom:a?`2px solid ${e?.general.primaryColor}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:t=>{a||(t.currentTarget.style.color=e?.general.primaryColor)},onMouseLeave:e=>{a||(e.currentTarget.style.color="#666")}},t.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},r.charAt(0).toUpperCase()+r.slice(1)),t.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},r.charAt(0).toUpperCase()+r.slice(1)))})))):t.createElement("div",{className:"yt-byob-category-filter-wrapper",style:{overflowX:n?"auto":"visible",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",paddingBottom:"5px"}},t.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",...r].map((r=>t.createElement("button",{key:r,onClick:()=>i(r),className:"yt-byob-category-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${o===r?e?.general.primaryColor:"#e0e0e0"}`,borderRadius:e?.general.ctaBorderRadius,backgroundColor:o===r?e?.general.primaryColor:"white",color:o===r?"white":"#333",cursor:"pointer",transition:"all 0.3s ease",outline:"none",whiteSpace:"nowrap",minWidth:"fit-content",flexShrink:0},onMouseEnter:t=>{o!==r&&(t.currentTarget.style.borderColor=e?.general.primaryColor,t.currentTarget.style.color=e?.general.primaryColor)},onMouseLeave:e=>{o!==r&&(e.currentTarget.style.borderColor="#e0e0e0",e.currentTarget.style.color="#333")}},r.charAt(0).toUpperCase()+r.slice(1))))))},hf=({bundle:e,selectedItems:n,setSelectedItems:r,handleAddToCart:i,bundleAddToCartLoading:s,renderingOnPage:d,selectedItemsQuantity:p,handleRemoveItem:u,bundleSubtotal:m})=>{const[f,g]=c(void 0),[h,x]=c(window.innerWidth<450),[y,b]=c(0),[v,w]=c({}),C=e.builderTiers?.type,k=e.customizations,E=e.builderTiers?.productTier??[],T=e.builderTiers?.offerTier??[],[S,$]=c([]),[B,z]=c(!1),[I,N]=c("All"),[D,_]=c(0),P=o(null);l((()=>{const t=new Set;let n=!1;e?.products?.forEach((e=>{const r=e.productDetails;if(r.metafield&&"yourtoken_bundles_app"===r.metafield.namespace&&"categories"===r.metafield.key){let e=[];if(r.metafield.jsonValue&&Array.isArray(r.metafield.jsonValue))e=r.metafield.jsonValue;else if(r.metafield.value)try{const t=JSON.parse(r.metafield.value);Array.isArray(t)&&(e=t)}catch(e){console.error("Failed to parse categories:",e)}e.length>0&&(n=!0,e.forEach((e=>t.add(e))))}})),$(Array.from(t)),z(n)}),[e.products]);const O=((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})))(e.products.filter((e=>"active"===e.productDetails.status?.toLowerCase()||void 0===e.productDetails.status||""===e.productDetails.status)),I),A="productTier"===C?E.reduce(((e,t)=>e+t.minimumQuantity),0):"offerTier"===C?T.reduce(((e,t)=>e+t.minimumQuantity),0):e.minimumQuantity,[F,M]=c(""),[R,L]=c(""),j=((e,t)=>e.filter((e=>e?.productDetails?.title?.toLowerCase().includes(t?.toLowerCase()))))(O,F),V=((e,t)=>[...e].sort(((e,n)=>{const r=e?.productDetails?.title?.toLowerCase(),o=n?.productDetails?.title?.toLowerCase(),a=parseFloat(e?.productDetails?.variants?.edges?.[0]?.node?.price||"0"),i=parseFloat(n?.productDetails?.variants?.edges?.[0]?.node?.price||"0");switch(t){case"title-asc":return r.localeCompare(o);case"title-desc":return o.localeCompare(r);case"price-low-to-high":return a-i;case"price-high-to-low":return i-a;default:return 0}})))(j,R),W=((e,t,n,r,o)=>(e[o]?.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 o=t.find((t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0])))),a=t.find((e=>e.productId===n.productId&&(n.variantIds.length<1||e.variantIds.includes(n.variantIds[0]))));if(!o||!a)return 0;const i=o.productDetails?.title?.toLowerCase(),l=a.productDetails?.title?.toLowerCase(),c=parseFloat(o?.productDetails?.variants?.edges?.[0]?.node?.price||"0"),s=parseFloat(a?.productDetails?.variants?.edges?.[0]?.node?.price||"0");switch(r){case"title-asc":return i.localeCompare(l);case"title-desc":return l.localeCompare(i);case"price-low-to-high":return c-s;case"price-high-to-low":return s-c;default:return 0}})))(E,V,F,R,y),[H,q]=Jt(gm),[U,Q]=c(!1),G="productTier"===C?W:V,Y=G.slice(0,20*(D+1));l((()=>{setTimeout((()=>{Q(!0)}),100)}),[]);const Z=o(null);l((()=>{const e=()=>{x(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),l((()=>{if(e.coverImageUrl){const t=new Image;t.src=Jh(e.coverImageUrl)??"",t.onload=()=>{g(t.width/t.height)}}}),[e.coverImageUrl]),l((()=>{Q(!1),setTimeout((()=>Q(!0)),100)}),[y]);const X=(e,t)=>{if("productTier"===C){let n={...v},r=!1;if(n[t]){const o=n[t].indexOf(e);-1!==o&&(n[t]=[...n[t]],n[t].splice(o,1),r=!0)}if(!r)for(let t=E.length;t>=0;t--){const r=n[t].indexOf(e);if(-1!==r){n[t]=[...n[t]],n[t].splice(r,1);break}}w(n);const o=E.findIndex(((e,t)=>n[t]?.length<e.minimumQuantity));-1!==o&&b(o)}u(e)},K=()=>{const e=document.querySelector(".products-display");e&&e.scrollIntoView({behavior:"smooth"})};l((()=>{if("productTier"===C){const e=Object.fromEntries(E.map((e=>[e.tier,[]])));w(e)}}),[e]),l((()=>{if("productTier"!==C||!E[y])return;if(A===p)return;const e=E.findIndex(((e,t)=>{const n=v[t]||[];return t>=y&&n.length<e.minimumQuantity}));-1!==e&&e!==y&&(b(e),K())}),[v,E,C]),l((()=>{M("")}),[y]),l((()=>{function e(e){if(!Z.current||!e.target)return;!Z.current.contains(e.target)&&q(void 0)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[]);const J=(e,t,o)=>{var a;"productTier"===C&&(a=e,w((e=>{const t={...e},n=E.findIndex(((e,n)=>{const r=t[n]||[];return n>=y&&r.length<e.minimumQuantity}));return-1!==n&&b(n),t[n]||(t[n]=[]),t[n].push(a),t})));const i=!0===E[y]?.isFreebieTier;ex(e,t,o,n,r,i)},ee=(()=>{if(!e?.builderTiers)return e.minimumQuantity;const{type:t,offerTier:n,productTier:r}=e.builderTiers,o="offerTier"===t?n:"productTier"===t?r:null;if(!o)return e.minimumQuantity;let a=0;return o.map((e=>{a+=e.minimumQuantity})),a})(),te=h&&e.mobileCoverImageUrl?Jh(e.mobileCoverImageUrl):Jh(e.coverImageUrl??"")||null,ne=e.customStoreDetails?.fixedInventoryDetails,re=a(((e,t)=>{const n=ne?.find((e=>e.variantId===t))?.quantity;if(void 0!==n)return n;const r=(e.variants?.edges||[]).find((e=>e.node.id===t)),o=r?.node;return o?e.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?1/0:0:1/0:0}),[ne]),oe=a((e=>{const t=k?.general?.showOutOfStockProducts;if(t)return!0;const n=e.productDetails,r=n?.variants?.edges||[];if(ne){if(r.some((e=>ne.some((t=>t.variantId===e.node.id&&t.quantity>0)))))return!0}return r.some((e=>re(n,e.node.id)>0))}),[k?.general?.showOutOfStockProducts,ne,re]);l((()=>{if("productTier"!==C)return;const t=E[y];if(!t)return;if(1!==t.minimumQuantity)return;if(1!==t.products.length)return;const n=t.products[0],r=e.products.find((e=>e.productId===n.productId))?.productDetails;if(!r)return;if(r.variants?.edges?.length>1)return;const o=r.variants?.edges?.find((e=>re(r,e.node.id)>0))?.node;if(!o)return;const a=o.id,i=v[y]?.includes(a);i||(J(a,r,1),y<E.length-1&&(b(y+1),K()))}),[C,E,y,e.products,v,re,J]);const ae="bundles"==e.appName?e.pageHeader?.title:e?.title,ie="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;l((()=>{_(0)}),[F,R,I,y]);const le=a((()=>{Y.length<G.length&&_((e=>e+1))}),[Y.length,G.length]);return l((()=>{const e=new IntersectionObserver((([e])=>{e.isIntersecting&&le()}),{threshold:.1});return P.current&&e.observe(P.current),()=>{P.current&&e.unobserve(P.current)}}),[le]),t.createElement(t.Fragment,null,t.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",rowGap:"15px",padding:"20px 0px",marginBottom:"20px",backgroundColor:k.byob.sectionBackgroundColor,..."transparent"!==k.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},te?t.createElement("div",{style:{position:"relative",width:"100%",display:"flex",justifyContent:"center",alignItems:"center",textAlign:"center",overflow:"hidden",...e?.coverImageVerticalMargin&&{marginBottom:e?.coverImageVerticalMargin,marginTop:e?.coverImageVerticalMargin}}},te&&t.createElement(sf,{coverImageUrl:te,alt:"Background",styles:{width:"100%",height:"auto",display:"block"}}),t.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)"}},t.createElement("span",{style:{lineHeight:"normal",fontSize:k?.byob?.titleFontSize??"3rem",fontWeight:"700",color:k?.byob?.titleTextColor??"#000",marginBottom:"15px",backgroundColor:k?.byob?.titleBackgroundColor??"transparent",width:"100%",textAlign:"center"},className:"bundle-builder-title"},ae),t.createElement("span",{style:{lineHeight:"normal",fontSize:k?.byob?.subtitleFontSize??"1.5rem",color:k?.byob?.titleTextColor??"#000"},className:"bundle-builder-subtitle"},ie))):(ae||ie)&&t.createElement("div",{style:{zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",width:"90%",maxWidth:"1000px"}},ae&&t.createElement("span",{style:{lineHeight:"normal",fontSize:k?.byob?.titleFontSize??"3rem",fontWeight:"700",color:k?.byob?.titleTextColor??"#000",marginBottom:"15px",textAlign:"center",width:"100%",backgroundColor:k?.byob?.titleBackgroundColor??"transparent"}},ae),ie&&t.createElement("span",{style:{lineHeight:"normal",fontSize:k?.byob?.subtitleFontSize??"1.5rem",color:k?.byob?.titleTextColor??"#000"}},ie)),t.createElement("div",{style:{fontSize:"20px",width:"100%"},className:"products-display"},"productTier"===C&&E.length>0&&k?.byob.productTiersVisibility&&t.createElement(t.Fragment,null,t.createElement("div",null,t.createElement(mf,{currentStep:y,totalSteps:E.length,tiers:E,isMobile:h,primaryColor:k?.general?.primaryColor,primaryTextColorCta:k?.general?.primaryContrastColor,setCurrentProductTier:b,selectedProductsByTier:v,tierNavigation:k.byob.tierNavigation})))),t.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"20px"}},e?.enableSortAndFilter&&t.createElement(ff,{isMobile:h,searchTerm:F,setSearchTerm:M,setSortBy:L,styles:k}),e?.customizations?.byob?.enableProductCategories&&B&&t.createElement("div",null,t.createElement(gf,{styles:k,isMobile:h,categories:S,activeCategory:I,onCategoryChange:e=>{N(e)}}))),t.createElement("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"12px",justifyContent:"center",width:"100%"},className:"products-display"},0===G?.length?t.createElement("p",{style:{fontSize:"20px",color:"#333",textAlign:"center",width:"100%"}},"No products found"):"productTier"===C&&E.length>0?Y.filter((e=>oe(V.find((t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0]))))))).map(((r,o)=>{const a=(E[y]?.minimumQuantity??0)>(v[y]?.length??0),i=V.find((e=>e.productId===r.productId&&(r.variantIds.length<1||e.variantIds.includes(r.variantIds[0]))));return i?t.createElement(uf,{bundle:e,idx:o,key:r?.variantIds?.[0]??r.productId,product:i?.productDetails,handleAddToBundle:J,hideAddToBundle:!a,remainingQuantity:ee-p,themeColor:e?.dealTextColor,handleRemoveItem:e=>X(e,y),selecteditems:n,transitionActive:U,customVariantsQuantity:ne,currentProductTier:E[y],showFreebieTierProductPrices:e?.customStoreDetails?.showFreebieTierProductPrices}):null})):Y.filter(oe).map(((r,o)=>t.createElement(uf,{bundle:e,idx:o,key:r.productId,product:r?.productDetails,handleAddToBundle:J,hideAddToBundle:p>=ee,remainingQuantity:ee-p,themeColor:e?.dealTextColor,handleRemoveItem:u,selecteditems:n,transitionActive:U,customVariantsQuantity:ne}))),Y.length<G.length&&t.createElement("div",{ref:P,style:{height:"1px",width:"100%",display:"block"}})),!d&&t.createElement(fm,{builderTiers:e?.builderTiers,handleAddToCart:i,minimumQuantity:A,selectedProducts:n,showProductDetailsInTracker:e.showProductDetailsInTracker,handleRemoveItem:u,handleRemoveItemProductTier:X,selectedItemsQuantity:p,percentageOff:e.percentageOff,loading:s,bundleSubtotal:m,amountOff:e.amountOff,styles:e.customizations,dealAmount:e.dealAmount,themeColor:e?.dealTextColor??"#333",primaryTextColorCta:e?.primaryTextColorCta??"#fff",cornerRadiusType:e?.cornerRadiusType??"",selectedProductsByTier:v,renderingOnPage:d})),d&&t.createElement(fm,{handleAddToCart:i,minimumQuantity:A,builderTiers:e?.builderTiers,selectedProducts:n,showProductDetailsInTracker:e.showProductDetailsInTracker,loading:s,handleRemoveItem:u,handleRemoveItemProductTier:X,percentageOff:e.percentageOff,selectedItemsQuantity:p??0,bundleSubtotal:m??{price:0,compareAtPrice:0},amountOff:e.amountOff,styles:e.customizations,dealAmount:e.dealAmount,themeColor:k?.general.primaryColor||"#000",primaryTextColorCta:k.general.primaryContrastColor??"#fff",cornerRadiusType:e?.cornerRadiusType??"",selectedProductsByTier:v,renderingOnPage:d}),H&&void 0!==p&&(()=>{let r=p<e.minimumQuantity;return"productTier"==C?r=(E[y]?.minimumQuantity??0)>(v[y]?.length??0):"offerTier"==C&&(r=p<T.reduce(((e,t)=>e+t.minimumQuantity),0)),t.createElement(af,{handleAddToBundle:J,ref:Z,remainingQuantity:e.minimumQuantity-p,hideAddToBundle:!r,disableQuantitySelector:e?.disableQuantitySelector??!1,selectedProducts:n,selectedProductsByTier:v,themeColor:k?.general.primaryColor||"#000",primaryTextColorCta:e?.customizations?.general.primaryContrastColor??"#fff",primaryBackgroundColorCta:k?.general.primaryColor||"#000",cornerRadius:e?.customizations.byob.borderRadius,styles:e.customizations,reviewRatingType:e?.reviewRatingType??"none",customVariantsQuantity:ne,bundleProductsCustomQuantity:e?.customProductsQuantity})})())},xf=({product:e,selectedVariantId:n,onVariantChange:r,styles:o,originalPrice:a,dealPrice:l,isVertical:c=!1,variantOptions:s,storeCurrencyCode:d})=>{const p=i((()=>t=>{const n=e?.productDetails?.variants?.edges?.find((e=>e.node.id===t)),r=n?.node;return r?e.productDetails.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?1/0:0:1/0:0}),[e.productDetails]),u=e?.productDetails?.variants?.edges?.find((e=>e?.node?.id===n))?.node;p(n);const m=i((()=>{if(u?.title&&e.productDetails.options){const t=u.title.split(" / ");if(t.length===e.productDetails.options.length)return t}return e.productDetails.options?.map((e=>e.values[0]))||[]}),[u,e.productDetails.options]),f=e=>{r(e)};return c?t.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"}},t.createElement("div",{className:"yt-comboBundle-product-card-image-container-vertical",style:{position:"relative",width:"100%"}},o.comboBundle.subProductsImageVisibility&&t.createElement(t.Fragment,null,t.createElement("img",{className:"yt-comboBundle-product-image-vertical",src:Jh(u?.image?.url||e?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg"),alt:e?.productDetails?.featuredMedia?.alt,width:165,height:165,style:{objectFit:"cover",borderRadius:"20px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",height:"100%",aspectRatio:o.general?.imageAspectRatio||"1/1"}}),t.createElement("div",{className:"yt-comboBundle-product-variant-selector-container-vertical",style:{marginTop:"8px",position:"absolute",bottom:"10px",left:"5px",right:"5px"}},e?.productDetails?.variants?.edges?.length>1&&t.createElement(t.Fragment,null,t.createElement("select",{className:"yt-comboBundle-product-variant-select-vertical",value:n,onChange:e=>f(e.target.value),style:{padding:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",width:"100%",appearance:"none",marginRight:"30px",fontSize:"12px",fontWeight:600}},e?.productDetails?.variants?.edges.map((e=>{const n=p(e?.node?.id);return t.createElement("option",{key:e?.node?.id,value:e?.node?.id,disabled:0===n,className:"yt-comboBundle-product-variant-option"},e?.node?.title)}))),t.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"}},t.createElement(R,null)))))),(o.comboBundle.subProductsProductTitleVisibility||o.comboBundle.subProductsProductPriceVisibility)&&t.createElement("div",{className:"yt-comboBundle-product-info-container-vertical",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"40px",width:"100%",paddingBlock:"5px"}},o.comboBundle.subProductsProductTitleVisibility&&t.createElement("span",{className:"yt-comboBundle-product-title-vertical",style:{fontSize:"12px",color:"#333",fontWeight:"600",lineHeight:"normal",textAlign:"center",width:"fit-content"}},e?.productDetails?.title),o.comboBundle.subProductsProductPriceVisibility&&t.createElement("div",{className:"yt-comboBundle-product-price-container-vertical",style:{display:"flex",alignItems:"center",gap:"8px",lineHeight:"normal",fontSize:"14px"}},t.createElement("span",{className:"yt-comboBundle-product-deal-price-vertical",style:{lineHeight:"normal"}},Kh(o.general.currencySymbol,d),Xh((Number(u?.compareAtPrice?Number(u?.compareAtPrice):u?.price)/Number(a)*Number(l)).toFixed(2))),u?.compareAtPrice&&t.createElement("span",{className:"yt-comboBundle-product-original-price-vertical",style:{textDecoration:"line-through",color:"#999",lineHeight:"normal",fontSize:"12px"}},Kh(o.general.currencySymbol,d),Xh(u?.compareAtPrice?u?.compareAtPrice:u?.price))))):t.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"===o.comboBundle.infoAlignment&&{flexDirection:"row-reverse"},..."center"===o.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"}},o.comboBundle.subProductsImageVisibility&&t.createElement("div",{className:"yt-comboBundle-product-image-wrapper-horizontal"},t.createElement("img",{className:"yt-comboBundle-product-image-horizontal",src:Jh(u?.image?.url||e?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg"),alt:e?.productDetails?.featuredMedia?.alt,height:80,style:{objectFit:"cover",borderRadius:"10px",border:"1px solid #DEDEDE",aspectRatio:"1/1",width:"90px",height:"90px"}})),t.createElement("div",{className:"yt-comboBundle-product-info-horizontal",style:{display:"flex",flexDirection:"column",alignItems:"left"===o.comboBundle?.infoAlignment?"flex-start":"right"===o.comboBundle?.infoAlignment?"flex-end":"center"===o.comboBundle?.infoAlignment?"flex-start":void 0}},o.comboBundle.subProductsProductTitleVisibility&&t.createElement("span",{className:"yt-comboBundle-product-title-horizontal",style:{fontSize:"14px",fontWeight:"600",lineHeight:"normal",display:"flex",alignItems:"center",gap:"8px"}},t.createElement("span",{className:"yt-comboBundle-product-title-text"}," ",e?.productDetails?.title," "),"dropdown"!==o.comboBundle.comboVariantTypeSelector&&e.productDetails.variants.edges.length>1&&s&&m&&t.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"}},m.length>1?m.join(" / "):m)),o.comboBundle.subProductsProductPriceVisibility&&t.createElement("div",{className:"yt-comboBundle-product-price-wrapper-horizontal",style:{display:"flex",gap:"8px",marginTop:"5px",alignItems:"baseline"}},t.createElement("span",{className:"yt-comboBundle-product-deal-price-horizontal",style:{lineHeight:"normal"}},Kh(o.general.currencySymbol,d),Xh((Number(u?.compareAtPrice?Number(u?.compareAtPrice):u?.price)/Number(a)*Number(l)).toFixed(2))),u?.compareAtPrice&&t.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},Kh(o.general.currencySymbol,d),Xh(u?.compareAtPrice?u?.compareAtPrice:u?.price))),e.productDetails.variants.edges.length>1&&("dropdown"===o.comboBundle.comboVariantTypeSelector?t.createElement("div",{className:"yt-comboBundle-product-variant-dropdown-horizontal",style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},t.createElement("select",{className:"yt-comboBundle-product-variant-select-horizontal",value:n,onChange:e=>f(e.target.value),style:{padding:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",fontSize:"12px",fontWeight:600,borderRadius:"4px"}},e.productDetails.variants.edges.map((e=>{const n=p(e?.node?.id);return t.createElement("option",{key:e?.node?.id,value:e?.node?.id,disabled:0===n,className:"yt-comboBundle-product-variant-option"},e?.node?.title)}))),t.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"}},t.createElement(R,null))):e.productDetails.options.length>0?t.createElement(t.Fragment,null,e.productDetails.options.map(((n,r)=>t.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"}},e.productDetails.options.length>1&&n?.values?.length>1&&t.createElement("label",{className:"yt-comboBundle-product-option-label",style:{fontSize:"12px",fontWeight:"500",color:"#333"}},n.name,":"),n?.values?.length>1&&t.createElement("div",{className:"yt-comboBundle-product-option-values-horizontal",style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"}},n.values.map((a=>{const i=[...m];i[r]=a;const l=e.productDetails.options.length>0?i.join(" / "):i[r],c=e.productDetails.variants.edges.find((e=>e.node.title===l))?.node,d=0===(c?p(c.id):0),u=m[r]===a,g=s&&s?.options?.find((e=>e.name===n.name));return g&&"color"===g?.type?t.createElement("button",{key:a,className:`yt-comboBundle-product-option-button-color ${u?"yt-comboBundle-product-option-button-selected":""} ${d?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!d&&c&&f(c.id)},disabled:d,style:{borderRadius:"50%",padding:"1px",backgroundColor:"white",border:u&&!d?`1px solid ${o.general?.ctaBackgroundColor}`:"1px solid transparent",opacity:d?.5:1,cursor:d?"not-allowed":"pointer"}},g?.values.find((e=>e.name===a))?.value?t.createElement("div",{className:"yt-comboBundle-product-option-color-swatch",style:{width:u&&!d?"26px":"24px",height:u&&!d?"26px":"24px",borderRadius:"50%",backgroundColor:g?.values.find((e=>e.name===a))?.value}},t.createElement("span",null)):t.createElement("span",{key:a,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:u&&!d?`1px solid ${o.general?.ctaBackgroundColor}`:d?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!d?"#F7F7F7":"transparent",color:d?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},a)):g&&"image"===g?.type?t.createElement("button",{key:a,className:`yt-comboBundle-product-option-button-image ${u?"yt-comboBundle-product-option-button-selected":""} ${d?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!d&&c&&f(c.id)},disabled:d,style:{border:u&&!d?`1px solid ${o.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:u&&!d?"#F7F7F7":"transparent",cursor:d?"not-allowed":"pointer",padding:"0px",width:u&&!d?"26px":"24px",height:u&&!d?"26px":"24px",overflow:"hidden",opacity:d?.5:1}},g?.values.find((e=>e.name===a))?.value?t.createElement("img",{className:"yt-comboBundle-product-option-image",src:Jh(g?.values.find((e=>e.name===a))?.value||"/placeholder.svg"),alt:a,style:{width:u&&!d?"26px":"24px",height:u&&!d?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}}):t.createElement("span",{key:a,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:u&&!d?`1px solid ${o.general?.ctaBackgroundColor}`:d?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!d?"#F7F7F7":"transparent",color:d?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},a)):t.createElement("button",{key:a,className:`yt-comboBundle-product-option-button-text ${u?"yt-comboBundle-product-option-button-selected":""} ${d?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!d&&c&&f(c.id)},disabled:d,style:{padding:"4px 8px",border:u&&!d?`1px solid ${o.general?.ctaBackgroundColor}`:d?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!d?"#F7F7F7":"transparent",color:d?"#ccc":"#707070",cursor:d?"not-allowed":"pointer",fontSize:"10px",fontWeight:"600",opacity:d?.5:1}},a)}))))))):t.createElement(t.Fragment,null,e?.productDetails?.variants?.edges?.length>1&&t.createElement("div",{className:"yt-comboBundle-product-variant-buttons-horizontal",style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},e?.productDetails?.variants?.edges.map((e=>{const r=0===p(e?.node?.id);return t.createElement("button",{key:e?.node?.id,className:`yt-comboBundle-product-variant-button ${n===e?.node?.id?"yt-comboBundle-product-variant-button-selected":""} ${r?"yt-comboBundle-product-variant-button-disabled":""}`,onClick:()=>f(e?.node?.id),disabled:r,style:{padding:"4px 8px",border:n===e?.node?.id?`1px solid ${o.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:n===e?.node?.id?"#F7F7F7":"transparent",color:r?"#ccc":"#707070",cursor:r?"not-allowed":"pointer",fontSize:"12px",fontWeight:"500",opacity:r?.5:1}},e?.node?.title)})))))))},yf=({bundle:e,addToCartFunction:n})=>{const[r,o]=c(!1),[a,s]=c(window.innerWidth<786);l((()=>(n&&(window.ytComboBundle={bundle:e,addToCart:n},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}))})),[e,n]);const d=i((()=>(e,t)=>{const n=e?.variants?.edges?.find((e=>e.node.id===t)),r=n?.node;return r?e.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?1/0:0:1/0:0}),[]),[p,u]=c((()=>{const t={};return e.products.forEach(((e,n)=>{const r=e.productDetails?.variants?.edges?.find((t=>d(e.productDetails,t?.node?.id)>0))?.node;t[n]=r?r.id:e?.productDetails?.variants?.edges[0]?.node?.id})),t})),m=e.products?.every(((e,t)=>{const n=p[t];return d(e.productDetails,n)>0})),f=(e,t)=>{u((n=>({...n,[e]:t})))},{originalPrice:g,dealPrice:h,offerValue:x}=i((()=>{const{price:t,compareAtPrice:n}=Object.entries(p).reduce(((t,[n,r])=>{const o=e.products[parseInt(n)],a=o.productDetails.variants.edges?.find((e=>e.node.id===r))?.node,i=parseFloat(a?.price??"0"),l=parseFloat(a?.compareAtPrice||i.toString());return t.price+=i,t.compareAtPrice+=l,t}),{price:0,compareAtPrice:0}),r=Math.max(t,n);let o=Math.min(t,n);e?.percentageOff?o=t*(1-e.percentageOff/100):e?.dealAmount?o=e.dealAmount:e?.amountOff&&(o=t-e.amountOff);const a=n-o;return{originalPrice:r.toFixed(2),dealPrice:o.toFixed(2),offerValue:a.toFixed(2)}}),[p,e.products,e.percentageOff,e.dealAmount,e.amountOff]);l((()=>{const e=()=>{s(window.innerWidth<786)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const y=e.customizations,b=y.comboBundle?.comboCardStyle||"auto",v="vertical"===b||"auto"===b&&!a,w=y.comboBundle?.embedContentVisibility,C="bundles"==e.appName?e.pageHeader?.title:e?.title,k="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return t.createElement("div",{className:`yt-comboBundle-bundle-container ${"left"===y.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-left":"right"===y.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-right":"center"===y.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-center":void 0}`,style:{lineHeight:"normal",maxWidth:"800px",marginBlock:y.comboBundle?.verticalMargin||"0px",display:"flex",flexDirection:"column",alignItems:"left"===y.comboBundle?.infoAlignment?"flex-start":"right"===y.comboBundle?.infoAlignment?"flex-end":"center"===y.comboBundle?.infoAlignment?"center":void 0,textAlign:y.comboBundle?.infoAlignment??"left",fontFamily:"system-ui, -apple-system, sans-serif"}},w&&y.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Title")&&t.createElement("div",{className:"yt-comboBundle-bundle-title-container",style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"10px"}},t.createElement("h2",{className:"yt-comboBundle-bundle-title",style:{fontSize:y.comboBundle?.productTitleFontSize||"28px",color:y.comboBundle?.titleTextColor||"#000",fontWeight:"bold",lineHeight:"1.6",margin:0}},C)),w&&y?.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Price")&&t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-comboBundle-bundle-price-container",style:{display:"flex",alignItems:"center",gap:"8px",color:y.comboBundle?.titleTextColor||"#000",fontSize:(parseInt(y.comboBundle?.productTitleFontSize?.replace("px",""))||28)-4+"px"}},t.createElement("div",{className:"yt-comboBundle-bundle-price-details",style:{display:"flex",alignItems:"center",gap:"5px",flexWrap:"wrap"}},t.createElement("span",{className:"yt-comboBundle-bundle-deal-price-text",style:{fontWeight:"bold",lineHeight:"1",minWidth:"fit-content"}},Kh(y.general.currencySymbol,e.storeCurrencyCode),Xh(h)),t.createElement("div",{className:"yt-comboBundle-bundle-original-price-text",style:{color:y.comboBundle?.titleTextColor||"#666",textDecoration:"line-through",verticalAlign:"middle",display:"inline-block",minWidth:"fit-content"}},Kh(y.general.currencySymbol,e.storeCurrencyCode),Xh(g)),t.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"}},e?.percentageOff?`${e?.percentageOff}% Off`:e?.amountOff?`${Kh(y.general.currencySymbol,e.storeCurrencyCode)}${Xh(e?.amountOff)} Off`:`Save ${Kh(y.general.currencySymbol,e.storeCurrencyCode)}${Xh(x)}`))),t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",margin:"15px 0px"},className:"yt-comboBundle-checkoutSpecific-container"},t.createElement("div",{style:{display:"flex",width:"12px",height:"12px",justifyContent:"center",alignItems:"center",alignContent:"center",borderRadius:"50%",backgroundColor:y.general?.ctaBackgroundColor||"#1e1e1e",flexShrink:0},className:"yt-comboBundle-checkoutSpecific-dot"},t.createElement("span",null)),t.createElement("p",{style:{fontSize:y.comboBundle.productDescriptionFontSize||"16px",color:y.comboBundle?.descriptionTextColor||"#000",alignItems:"center",margin:0,lineHeight:"1.2"},className:"yt-comboBundle-checkoutSpecific-text"},"Tax included. ",t.createElement("u",null,"Shipping")," calculated at checkout."))),y.comboBundle.subProductsSectionVisibility&&t.createElement(t.Fragment,null,v?t.createElement("div",{className:"yt-comboBundle-products-grid-vertical "+(a?"yt-comboBundle-products-grid-mobile":""),style:{display:"flex",flexDirection:"row",gap:"20px",marginTop:"10px",flexWrap:"wrap"}},e.products.map(((n,r)=>{const o=n?.productDetails?.variants?.edges?.find((e=>e?.node?.id===p[r]))?.node;return o?t.createElement(xf,{key:`combo-product-${r}-${n.productId}`,product:n,styles:y,originalPrice:g,dealPrice:h,selectedVariantId:p[r],onVariantChange:e=>f(r,e),isVertical:v,variantOptions:e.variantOptions,storeCurrencyCode:e.storeCurrencyCode}):null}))):t.createElement("div",{className:"yt-comboBundle-products-list-horizontal "+(a?"yt-comboBundle-products-list-mobile":""),style:{display:"flex",flexDirection:"column",gap:"10px",width:"100%"}},y.comboBundle.subProductsSectionVisibility&&e.products.map(((n,r)=>t.createElement(xf,{key:`combo-product-horizontal-${r}-${n.productId}`,product:n,styles:y,originalPrice:g,dealPrice:h,selectedVariantId:p[r],onVariantChange:e=>f(r,e),variantOptions:e.variantOptions}))))),t.createElement("div",{className:"yt-comboBundle-bundle-cta-section",style:{borderTop:"1px solid #eee",display:"flex",flexDirection:"column",rowGap:"5px",marginTop:"20px",width:"100%"}},t.createElement("button",{className:`yt-comboBundle-bundle-cta-button ${m?"":"yt-comboBundle-bundle-cta-button-disabled"} ${a?"yt-comboBundle-bundle-cta-button-mobile":""}`,style:{backgroundColor:m?y.general?.ctaBackgroundColor||"#121212":y.general.disabledButtonColor,color:y.general?.ctaTextColor||"#FFFFFF",fontSize:"16px",borderRadius:y.general.ctaBorderRadius??"20px",fontWeight:"bold",cursor:m?"pointer":"not-allowed",border:`1px solid ${m?y.general?.ctaBackgroundColor||"#121212":y.general.disabledButtonColor}`,boxShadow:y.general.ctaShadowType,padding:y.general?.ctaPadding,width:y.general?.ctaWidth,margin:"0"},disabled:!m,onMouseOver:e=>{y.general.customizeHoverState&&m&&(e.currentTarget.style.backgroundColor=y.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=y.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{y.general.customizeHoverState&&m&&(e.currentTarget.style.backgroundColor=y.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=y.general?.ctaTextColor||"#FFFFFF")},onClick:async()=>{try{if(o(!0),!n)return console.error("[ComboBundle.tsx] No addToCartFunction available"),void o(!1);const t=Object.entries(p).map((([t,n])=>{const r=e.products[parseInt(t)],o=r.productDetails.variants.edges.find((e=>e.node.id===n))?.node;return o?{variantId:n,price:Number(o.price)}:null})).filter((e=>null!==e)),r=Object.values(p);await n(Number(g),r,Number(h),t)}catch(e){console.error("[ComboBundle.tsx] Error adding to cart:",e)}o(!1)}},r?t.createElement(na,{color:"white",loading:r,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):t.createElement(t.Fragment,null,m?y.comboBundle?.ctaTitle??"Add Bundle to cart":y.general.outOfStockLabel||"Out of Stock"," "))),w&&y.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Description")&&t.createElement("div",{className:"yt-comboBundle-bundle-description-section",style:{margin:"20px 0px"}},t.createElement("h4",{className:"yt-comboBundle-bundle-description-header",style:{fontSize:"16px",color:y.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",margin:0,padding:"8px",backgroundColor:y.general.primaryColor+"20"}},"Description"),t.createElement("div",{className:"yt-comboBundle-bundle-description-content",style:{fontSize:y.comboBundle.productDescriptionFontSize||"16px",color:y.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",padding:"8px",backgroundColor:y.general.primaryColor+"08"}},t.createElement("p",null,k))))},bf=x.div`
|
|
3542
3542
|
max-width: 800px;
|
|
3543
3543
|
container-type: inline-size;
|
|
3544
3544
|
margin-top: ${e=>e.verticalMargin||"0px"};
|
|
@@ -28,6 +28,7 @@ type BundleProductDetailsModalProps = {
|
|
|
28
28
|
quantity: number;
|
|
29
29
|
variantId: string;
|
|
30
30
|
}[];
|
|
31
|
+
bundleProductsCustomQuantity?: number | null;
|
|
31
32
|
};
|
|
32
33
|
declare const BundleProductDetailsModal: React.ForwardRefExoticComponent<BundleProductDetailsModalProps & React.RefAttributes<HTMLDivElement>>;
|
|
33
34
|
export default BundleProductDetailsModal;
|