yt-uikit 0.8.45 → 0.8.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +2 -2
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -2146,7 +2146,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
|
|
|
2146
2146
|
object-fit: cover;
|
|
2147
2147
|
display: block;
|
|
2148
2148
|
}
|
|
2149
|
-
`,Ba=({imageUrls:t,redirectionLink:n,cartOffersCarouselHeight:o,enableMarquee:r=!0})=>{if(!t||0===t.length)return null;const i=()=>{n&&(window.location.href=n)};if(!r)return e.createElement($a,{onClick:i,style:{cursor:n?"pointer":"default"},$cartOffersCarouselHeight:o},e.createElement("img",{src:t[0],alt:"banner"}));const a=[...t,...t];return e.createElement(Sa,{onClick:i,style:{cursor:n?"pointer":"default"},$cartOffersCarouselHeight:o},e.createElement("div",{className:"marquee-wrapper"},e.createElement("div",{className:"marquee-content"},a.map((t,n)=>e.createElement("img",{key:`marquee-img-${n}`,src:t,alt:`banner ${n+1}`})))))},Ia=({backgroundColor:o,titleText:r,descriptionText:i,criteria:a=[],pauseTimer:l,textAlignment:c="center",redirectionUrl:d,enableCustomCriteria:s=!0,cartData:p})=>{const[m,u]=t(0),g=e.useRef(null),x=e.useRef([]),f=s?a.filter(e=>{if(!p)return!1;if("mov"===e.type){return Xt(p?.items_subtotal_price??0,p?.currency??"INR")>=e.value}if("moq"===e.type){return p.items.filter(e=>!e.properties?._isYtFreebie).reduce((e,t)=>e+(t.quantity||1),0)>=e.value}return!1}):[],y=Boolean(r&&r.trim()||i&&i.trim()),b=[...y?[{type:"default",titleText:r,descriptionText:i}]:[],...f.map(e=>({type:"criteria",titleText:e.message,descriptionText:"",redirectionUrl:e.redirectionUrl}))],h=b.length,v=h>0,w=h>1,C=e=>{"criteria"===e.type&&e.redirectionUrl?window.location.href=e.redirectionUrl:"default"===e.type&&d&&(window.location.href=d)};let E,k=!1;h>0&&(E=b[m]??b[0],k="criteria"===E.type&&Boolean(E.redirectionUrl)||"default"===E.type&&Boolean(d)),n(()=>{const e=f.filter(e=>!x.current.some(t=>t.id===e.id));if(e.length>0){const t=e[0],n=f.findIndex(e=>e.id===t.id);if(-1!==n){const e=(y?1:0)+n;e<b.length&&u(e)}}x.current=f},[f,b,y]),n(()=>{h>0&&m>=h&&u(h-1)},[m,h]),n(()=>{g.current&&an(g.current)},[o,b,m]),n(()=>{if(!w)return void u(0);const e=setInterval(()=>{u(e=>(e+1)%h)},1e3*l);return()=>clearInterval(e)},[w,h,l]);return v?e.createElement(ua,{ref:g,$backgroundColor:o},e.createElement(xa,null,w?e.createElement(wa,null,e.createElement(ka,{$position:"left",onClick:()=>{u(e=>0===e?h-1:e-1)}},e.createElement(ye,null)),e.createElement(Ca,{$currentIndex:m},b.map((t,n)=>e.createElement(Ea,{key:n,onClick:()=>C(t),style:{cursor:"criteria"===t.type&&t.redirectionUrl||"default"===t.type&&d?"pointer":"default"}},e.createElement(ya,null,e.createElement(ba,{style:{textAlign:c}},t.titleText),t.descriptionText&&e.createElement(ha,{style:{textAlign:c}},t.descriptionText))))),e.createElement(ka,{$position:"right",onClick:()=>{u(e=>(e+1)%h)}},e.createElement(be,null))):e.createElement(ya,{onClick:()=>E&&C(E),style:{cursor:k?"pointer":"default"}},(()=>{const t=b[m]??b[0];return e.createElement(e.Fragment,null,e.createElement(ba,{style:{textAlign:c}},t.titleText),t.descriptionText&&e.createElement(ha,{style:{textAlign:c}},t.descriptionText))})()))):null},za=({backgroundColor:t,imageUrl:o,titleText:r,descriptionText:i,textAlignment:a,redirectionUrl:l})=>{const c=e.useRef(null);n(()=>{c.current&&an(c.current)},[t]);return e.createElement(ma,{ref:c,$backgroundColor:t,onClick:()=>{l&&(window.location.href=l)},style:{cursor:l?"pointer":"default"}},e.createElement(ga,null,e.createElement(fa,{$imageUrl:o}),e.createElement(ya,null,e.createElement(ba,{style:{textAlign:a}},r),e.createElement(ha,{style:{textAlign:a}},i))))},Na=({backgroundColor:t,couponCode:o,copySuccess:r,setCopySuccess:i,titleText:a,descriptionText:l,textAlignment:c="
|
|
2149
|
+
`,Ba=({imageUrls:t,redirectionLink:n,cartOffersCarouselHeight:o,enableMarquee:r=!0})=>{if(!t||0===t.length)return null;const i=()=>{n&&(window.location.href=n)};if(!r)return e.createElement($a,{onClick:i,style:{cursor:n?"pointer":"default"},$cartOffersCarouselHeight:o},e.createElement("img",{src:t[0],alt:"banner"}));const a=[...t,...t];return e.createElement(Sa,{onClick:i,style:{cursor:n?"pointer":"default"},$cartOffersCarouselHeight:o},e.createElement("div",{className:"marquee-wrapper"},e.createElement("div",{className:"marquee-content"},a.map((t,n)=>e.createElement("img",{key:`marquee-img-${n}`,src:t,alt:`banner ${n+1}`})))))},Ia=({backgroundColor:o,titleText:r,descriptionText:i,criteria:a=[],pauseTimer:l,textAlignment:c="center",redirectionUrl:d,enableCustomCriteria:s=!0,cartData:p})=>{const[m,u]=t(0),g=e.useRef(null),x=e.useRef([]),f=s?a.filter(e=>{if(!p)return!1;if("mov"===e.type){return Xt(p?.items_subtotal_price??0,p?.currency??"INR")>=e.value}if("moq"===e.type){return p.items.filter(e=>!e.properties?._isYtFreebie).reduce((e,t)=>e+(t.quantity||1),0)>=e.value}return!1}):[],y=Boolean(r&&r.trim()||i&&i.trim()),b=[...y?[{type:"default",titleText:r,descriptionText:i}]:[],...f.map(e=>({type:"criteria",titleText:e.message,descriptionText:"",redirectionUrl:e.redirectionUrl}))],h=b.length,v=h>0,w=h>1,C=e=>{"criteria"===e.type&&e.redirectionUrl?window.location.href=e.redirectionUrl:"default"===e.type&&d&&(window.location.href=d)};let E,k=!1;h>0&&(E=b[m]??b[0],k="criteria"===E.type&&Boolean(E.redirectionUrl)||"default"===E.type&&Boolean(d)),n(()=>{const e=f.filter(e=>!x.current.some(t=>t.id===e.id));if(e.length>0){const t=e[0],n=f.findIndex(e=>e.id===t.id);if(-1!==n){const e=(y?1:0)+n;e<b.length&&u(e)}}x.current=f},[f,b,y]),n(()=>{h>0&&m>=h&&u(h-1)},[m,h]),n(()=>{g.current&&an(g.current)},[o,b,m]),n(()=>{if(!w)return void u(0);const e=setInterval(()=>{u(e=>(e+1)%h)},1e3*l);return()=>clearInterval(e)},[w,h,l]);return v?e.createElement(ua,{ref:g,$backgroundColor:o},e.createElement(xa,null,w?e.createElement(wa,null,e.createElement(ka,{$position:"left",onClick:()=>{u(e=>0===e?h-1:e-1)}},e.createElement(ye,null)),e.createElement(Ca,{$currentIndex:m},b.map((t,n)=>e.createElement(Ea,{key:n,onClick:()=>C(t),style:{cursor:"criteria"===t.type&&t.redirectionUrl||"default"===t.type&&d?"pointer":"default"}},e.createElement(ya,null,e.createElement(ba,{style:{textAlign:c}},t.titleText),t.descriptionText&&e.createElement(ha,{style:{textAlign:c}},t.descriptionText))))),e.createElement(ka,{$position:"right",onClick:()=>{u(e=>(e+1)%h)}},e.createElement(be,null))):e.createElement(ya,{onClick:()=>E&&C(E),style:{cursor:k?"pointer":"default"}},(()=>{const t=b[m]??b[0];return e.createElement(e.Fragment,null,e.createElement(ba,{style:{textAlign:c}},t.titleText),t.descriptionText&&e.createElement(ha,{style:{textAlign:c}},t.descriptionText))})()))):null},za=({backgroundColor:t,imageUrl:o,titleText:r,descriptionText:i,textAlignment:a="left",redirectionUrl:l})=>{const c=e.useRef(null);n(()=>{c.current&&an(c.current)},[t]);return e.createElement(ma,{ref:c,$backgroundColor:t,onClick:()=>{l&&(window.location.href=l)},style:{cursor:l?"pointer":"default"}},e.createElement(ga,null,e.createElement(fa,{$imageUrl:o}),e.createElement(ya,null,e.createElement(ba,{style:{textAlign:a}},r),e.createElement(ha,{style:{textAlign:a}},i))))},Na=({backgroundColor:t,couponCode:o,copySuccess:r,setCopySuccess:i,titleText:a,descriptionText:l,textAlignment:c="left"})=>{const d=e.useRef(null);n(()=>{d.current&&an(d.current)},[t]);return e.createElement(ma,{ref:d,$backgroundColor:t,style:{position:"relative"}},e.createElement(ga,{style:{filter:r?"blur(5px)":"none",zIndex:1}},e.createElement(ya,{style:{borderRight:"1px solid #d9d9d9",paddingRight:"5px"}},e.createElement(ba,{style:{textAlign:c}},a),e.createElement(ha,{style:{textAlign:c}},l)),e.createElement(va,null,e.createElement(re,{className:"copy-icon",size:24,onClick:()=>(e=>{navigator.clipboard.writeText(e).then(()=>{i(!0)},e=>{i(!1)}),setTimeout(()=>{i(!1)},3e3)})(o),style:{height:"24px",width:"24px"}}))))},Fa=({children:o,autoSlide:r=!0,autoSlideInterval:i,copySuccess:a,themeColor:l})=>{const[c,d]=t(0),s=e.Children.count(o),[p,m]=t(!1),[u,g]=t(r),x=()=>{d(e=>e===s-1?0:e+1)};return n(()=>{if(!u)return;const e=setInterval(x,i);return()=>clearInterval(e)},[u,i]),e.createElement(Ta,null,a&&e.createElement("div",{className:"coupon-code-copied",style:{position:"absolute",top:"20%",left:"50%",transform:"translate(-50%, -20%)",backgroundColor:l,display:"flex",alignItems:"center",justifyContent:"center",gap:"9px",borderRadius:"9px",padding:"12px 30px",color:"#FFF",fontFamily:"Poppins",fontSize:"12px",fontWeight:"400",lineHeight:"118%",zIndex:2,minWidth:"70%"}},e.createElement(j,{size:20,color:"white",style:{height:"24px",width:"24px"}}),"Coupon Code Copied"),e.createElement("div",{onMouseEnter:()=>{m(!0),g(!1)},onMouseLeave:()=>{m(!1),g(!0)},style:{display:"flex",transition:p?"none":"transform 0.5s ease",transform:`translateX(-${100*c}%)`,cursor:"pointer"}},e.Children.toArray(o)))};function Pa({cartOffersCarousalData:n,themeColor:o,cartOffersCarouselHeight:r,cartData:i}){const[a,l]=t(!1),{enableCartOffersCarousel:c,pauseTimer:d,backgroundColor:s,slides:p}=n,m=p.filter(e=>"ImageOnly"===e.slideType).map(e=>e.imageUrl).filter(e=>!!e),u=p.findIndex(e=>"ImageOnly"===e.slideType),g=[];let x=!1;return p.forEach((t,n)=>{if("ImageOnly"===t.slideType)n===u&&m.length>0&&!x&&(g.push(e.createElement(Ba,{key:`image-only-marquee-${t.slideNumber}`,imageUrls:m,redirectionLink:t.redirectionUrl||t.carouselRedirectionLink,cartOffersCarouselHeight:r,enableMarquee:!1!==t.enableMarquee})),x=!0);else switch(t.slideType){case"TextFieldOnly":g.push(e.createElement(Ia,{key:t.slideNumber,backgroundColor:s,titleText:t.titleTextField??"",descriptionText:t.descriptionTextField??"",criteria:t.criteria,pauseTimer:d,textAlignment:t.textAlignment,redirectionUrl:t.redirectionUrl||t.carouselRedirectionLink,enableCustomCriteria:t.enableCustomCriteria,cartData:i}));break;case"TextImage":g.push(e.createElement(za,{key:t.slideNumber,backgroundColor:s,titleText:t.titleTextField??"",descriptionText:t.descriptionTextField??"",imageUrl:t.imageUrl||"",textAlignment:t.textAlignment,redirectionUrl:t.redirectionUrl||t.carouselRedirectionLink}));break;case"TextCode":g.push(e.createElement(Na,{key:t.slideNumber,backgroundColor:s,couponCode:t.campaignCode??"",titleText:t.titleTextField??"",descriptionText:t.descriptionTextField??"",copySuccess:a,setCopySuccess:l,textAlignment:t.textAlignment}))}}),c&&0!==g.length?e.createElement(Fa,{copySuccess:a,autoSlideInterval:1e3*d,themeColor:o},g):null}const Da=d`
|
|
2150
2150
|
0% {
|
|
2151
2151
|
background-position: 200% 0;
|
|
2152
2152
|
}
|
|
@@ -3565,7 +3565,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
|
|
|
3565
3565
|
font-size: 1em;
|
|
3566
3566
|
justify-content: center;
|
|
3567
3567
|
align-items: center;
|
|
3568
|
-
`;const _c=l((r,i)=>{const[a,l]=J(Nc),c=o(()=>e=>{const t=r?.customVariantsQuantity?.find(t=>t.variantId===e?.id)?.quantity;return void 0!==t?t:r?.bundleProductsCustomQuantity?r?.bundleProductsCustomQuantity:e?a?.tracksInventory&&e.inventoryItem?.tracked?e.inventoryQuantity>0?e.inventoryQuantity:e.inventoryQuantity<=0&&"continue"===e.inventoryPolicy?1/0:0:1/0:0},[a?.tracksInventory,r?.customVariantsQuantity,r?.bundleProductsCustomQuantity]),d=a?.variants.edges?.filter(e=>c(e.node)>0)||[],[s,p]=t(d?.[0]?.node),[m,u]=t(0),[g,x]=t("undefined"!=typeof window&&window.innerWidth<=600),[f,y]=t(1),[b,h]=t("idle"),[v,w]=t(null),[C,E]=t(null);n(()=>{if(a){const e=a.variants.edges?.filter(e=>c(e.node)>0);p(a?.selectedVariant??e[0]?.node)}},[a,c]),n(()=>{const e=r.selectedProducts.find(e=>e.variantId===s?.id);y(e?e.quantity:0)},[f,r.selectedProducts,s]);const k=()=>{s?.id&&a&&(h("check"),r.handleAddToBundle(s?.id,a,1),setTimeout(()=>{h("idle"),l(void 0)},500))};if(n(()=>{const e=()=>x(window.innerWidth<=600);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),!a)return null;const{title:T,descriptionHtml:S,media:$,variants:B}=a,I=$.edges.map(e=>e?.node.preview.image??e?.node.image).filter(e=>e?.url?.length>0);n(()=>{if(a&&s?.image?.url&&Array.isArray(I)){const e=I.findIndex(e=>e?.url===s?.image?.url);-1!==e&&e!==m&&u(e)}},[s]);const z=e=>{const t=e.target.value,n=d?.find(e=>e.node.id===t)?.node;n&&c(n)>0&&p(n)};n(()=>{if(a){window.history.pushState({modalOpen:!0},"",window.location.href);const e=e=>{l(void 0),e.preventDefault()};return window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e),window.history.state?.modalOpen&&window.history.back()}}},[a,l]);const N=e=>{w(e.targetTouches[0].clientX),E(null)},F=e=>{E(e.targetTouches[0].clientX)},P=()=>{if(null!==v&&null!==C&&I.length>1){const e=v-C,t=50;e>t?u(e=>e<I.length-1?e+1:0):e<-t&&u(e=>e>0?e-1:I.length-1)}w(null),E(null)},D=r.selectedProducts.filter(e=>e.variantId===s?.id).reduce((e,t)=>e+t.quantity,0),A=r.customVariantsQuantity?.find(e=>e.variantId===s?.id)?.quantity??r.bundleProductsCustomQuantity??1/0,_=A!==1/0&&D>=A,R=r.hideAddToBundle||!s||c(s)<=0||_||"idle"!==b||r?.disableQuantitySelector&&1===f,O=e.createElement(Pc,{className:"yt-byob-modal-desktop-overlay"},e.createElement(Dc,{$isSmallScreen:g,ref:i},e.createElement(Ac,{ref:i,className:"yt-byob-modal-desktop-container yt-variant-selection-modal"},e.createElement("div",{className:"yt-byob-modal-desktop yt-variant-selection-modal "+(g?"small-screen":"large-screen")},e.createElement(Fc,{className:"yt-byob-modal-desktop-close",onClick:()=>{l(void 0)},style:{backgroundColor:"white"}},e.createElement(M,{size:"25"})),e.createElement("div",{className:"yt-byob-modal-desktop-image-section image-section"},e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-modal-desktop-image-swipe",onTouchStart:N,onTouchMove:F,onTouchEnd:P},e.createElement(lt,{small:Dp(I[m]?.url),medium:Dp(I[m]?.url),large:Dp(I[m]?.url),hideDownload:!0,className:"yt-byob-modal-desktop-main-image main-image",imageBackgroundColor:"#000"})),e.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((t,n)=>e.createElement("img",{key:n,className:"yt-byob-modal-desktop-gallery-thumb "+(m===n?"active":""),src:Dp(t?.url),alt:t.altText||`${T} - Image ${n+1}`,onClick:()=>u(n),style:{width:"73px",height:"73px",cursor:"pointer",borderRadius:"7px",border:"1px solid lightgray",...m===n&&{border:`2px solid ${r.themeColor||"#111"}`},objectFit:"cover"},loading:"lazy"}))))),e.createElement("div",{className:"yt-byob-modal-desktop-details-section details-section",style:{marginLeft:"20px",minHeight:"100%",maxHeight:"70vh",scrollbarWidth:"none",overflowY:"auto",display:"flex",flexDirection:"column"}},e.createElement("h2",{className:"yt-byob-modal-desktop-title"},"product-title"===r?.styles?.byob?.productVariantTitleType?a?.title:"variant-title"===r?.styles?.byob?.productVariantTitleType?a?.selectedVariant?.title:a?.selectedVariant?.displayName),"ratingOnly"===r.reviewRatingType&&(a?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-modal-desktop-rating",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(he,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6}},a?.rating?.averageRating,"rating")),"ratingAndReviewCount"===r.reviewRatingType&&(a?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-modal-desktop-rating-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(he,{color:"gold",size:14})," ",a?.rating?.averageRating,e.createElement(me,{size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",a?.rating?.ratingCount," reviews)"),e.createElement("div",{className:"yt-byob-modal-desktop-variant-price-wrapper",style:{display:"flex",flexDirection:"column",gap:"2px",marginTop:"20px"}},a?.variants?.edges?.length>1&&e.createElement("div",{className:"yt-byob-modal-desktop-variant-selector"},e.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"}},e.createElement("span",{style:{flexShrink:0}},a.options[0].name," :"," ",e.createElement("strong",{style:{color:"#000",paddingLeft:"5px"}},s?.title)),e.createElement("select",{className:"yt-byob-modal-desktop-variant-select",value:s?.id||"",onChange:z,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}},a?.variants?.edges?.map(({node:t})=>e.createElement("option",{key:t.id,value:t.id,disabled:0===c(t)},t.title))),e.createElement("span",{className:"yt-byob-modal-desktop-variant-chevron",style:{position:"absolute",right:5,pointerEvents:"none",fontSize:"12px",color:"#000"}},e.createElement(Me,null)))),e.createElement("div",{className:"yt-byob-modal-desktop-price-atc-wrapper",style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"}},e.createElement("div",{className:"yt-byob-modal-desktop-price",style:{width:"fit-content",minWidth:"fit-content",paddingRight:"10px",display:"flex",flexDirection:"row",alignItems:"baseline",gap:"6px"}},r?.isFreebieTier&&!r.showFreebieTierProductPrices?e.createElement(e.Fragment,null,e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"20px",textDecoration:"line-through",color:"#888",marginRight:"6px"}},Pp(r.styles.general.currencySymbol,r.styles.general.currencySymbol),Fp(s?.price)),e.createElement("span",{className:"yt-byob-current-price",style:{color:r.styles.general.primaryColor||"#d32f2f",fontWeight:"bold",fontSize:"20px"}},"FREE")):e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-modal-desktop-current-price"},e.createElement("span",{style:{fontSize:"20px",fontWeight:"600",color:"#000",textAlign:"center",lineHeight:"normal"}},Pp(r.styles.general.currencySymbol,r.styles.general.currencySymbol),Fp(s?.price))),s?.compareAtPrice&&parseFloat(s.compareAtPrice)>parseFloat(s?.price)&&e.createElement("div",{className:"yt-byob-modal-desktop-compare-price",style:{textDecoration:"line-through",opacity:"0.5",lineHeight:"normal"}},Pp(r.styles.general.currencySymbol,r.styles.general.currencySymbol),Fp(s?.compareAtPrice)))),e.createElement("div",{className:"yt-byob-modal-desktop-atc-wrapper yt-product-modal-atc-wrapper",style:{width:"80%"}},e.createElement("button",{className:"yt-byob-modal-desktop-atc-button yt-product-modal-atc-button",style:{textTransform:"uppercase",fontWeight:"800",width:"100%",border:"none",backgroundColor:r.themeColor||"#111",borderRadius:r.cornerRadius,color:r.primaryTextColorCta||"#fff",minHeight:"40px",padding:"0px 15px",position:"relative",overflow:"hidden",opacity:R?.5:1,cursor:R?"not-allowed":"pointer"},onClick:e=>{e.stopPropagation(),e.preventDefault(),k()},disabled:R},r.styles.byob.addToBundleCTAText??"Add to bundle")))),e.createElement("div",{className:"yt-byob-modal-desktop-divider",style:{height:"10px",minHeight:"10px",border:"none",backgroundColor:"#D9D9D96B",margin:"20px 0 10px 0",display:"block !important"}},e.createElement("span",null)),e.createElement("span",{className:"yt-byob-modal-desktop-description yt-description-content",style:{scrollBehavior:"smooth"},dangerouslySetInnerHTML:{__html:S}})))))),L=e.createElement(Pc,{className:"yt-byob-modal-mobile-overlay"},e.createElement(Dc,{className:"yt-byob-modal-mobile-content",style:{padding:"0px",position:"relative"},$isSmallScreen:g,ref:i},e.createElement(Ac,{ref:i,className:"yt-byob-modal-mobile-container yt-variant-selection-modal"},e.createElement("button",{className:"yt-byob-modal-mobile-close-btn",style:{position:"fixed",top:"20px",right:"20px",zIndex:9999999999,backgroundColor:"#FFFFFF",padding:"4px",borderRadius:"50%",border:"1px solid lightgray",display:"flex",justifyContent:"center",alignItems:"center"},onClick:()=>{l(void 0)}},e.createElement(Ve,{className:"yt-byob-modal-mobile-close-icon",style:{height:"22px",width:"22px",padding:"4px",color:"black"},onMouseEnter:e=>e.currentTarget.style.color="black"})),e.createElement("div",{className:"yt-byob-modal-mobile yt-variant-selection-modal small-screen",style:{padding:"0px"}},e.createElement("div",{className:"yt-byob-modal-mobile-image-section image-section"},e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-modal-mobile-image-swipe",style:{position:"relative"},onTouchStart:N,onTouchMove:F,onTouchEnd:P},e.createElement(lt,{small:Dp(I[m]?.url),medium:Dp(I[m]?.url),large:Dp(I[m]?.url),hideDownload:!0,className:"yt-byob-modal-mobile-main-image main-image",imageBackgroundColor:"#000"}),e.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((t,n)=>e.createElement("span",{key:n,className:"yt-byob-modal-mobile-indicator "+(m===n?"active":""),style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:m===n?"#FFFFFF":"#EBEBEB",margin:"0 3px",cursor:"pointer",backdropFilter:"blur(10px)"}})))),e.createElement("div",{className:"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((t,n)=>e.createElement("img",{key:n,className:"yt-byob-modal-mobile-gallery-thumb "+(m===n?"active":""),src:Dp(t?.url),alt:t.altText||`${T} - Image ${n+1}`,onClick:()=>u(n),style:{width:"60px",height:"60px",cursor:"pointer",borderRadius:"7px",border:"1px solid lightgray",...m===n&&{border:`2px solid ${r.themeColor||"#111"}`},objectFit:"cover"},loading:"lazy"}))))),e.createElement("div",{className:"yt-byob-modal-mobile-details-section details-section",style:{padding:"0 30px",margin:"15px 0",paddingBottom:"120px"}},e.createElement("h2",{className:"yt-byob-modal-mobile-title",style:{margin:"0px"}},"product-title"===r?.styles?.byob?.productVariantTitleType?a?.title:"variant-title"===r?.styles?.byob?.productVariantTitleType?a?.selectedVariant?.title:a?.selectedVariant?.displayName),"ratingOnly"===r.reviewRatingType&&(r?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-modal-mobile-rating",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(he,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6}},r?.rating?.averageRating," rating")),"ratingAndReviewCount"===r.reviewRatingType&&(r?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-modal-mobile-rating-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(he,{color:"gold",size:14})," ",r?.rating?.averageRating,e.createElement(me,{className:"yt-byob-modal-mobile-verified-icon",style:{color:"dodgerblue",marginLeft:"4px"},size:14})," ","(",r?.rating?.ratingCount," reviews)"),e.createElement("div",{className:"yt-byob-modal-mobile-divider",style:{opacity:"0.2",border:"none",height:"2px",backgroundColor:"#000000",margin:"10px 0px",display:"block !important"}},e.createElement("span",null)),e.createElement("div",{className:"yt-byob-modal-mobile-description yt-description-content",style:{scrollbarWidth:"none",scrollBehavior:"smooth",margin:"0px"},dangerouslySetInnerHTML:{__html:S}})))),e.createElement("div",{className:"yt-byob-modal-mobile-bottom-bar",style:{position:"fixed",bottom:"0px",left:"0px",right:"0px",padding:"12px 15px",borderTop:"1px solid lightgray",boxShadow:"0px -4px 5px rgba(0, 0, 0, 0.1)",backgroundColor:"#fff",display:"flex",flexDirection:"column",gap:"2px",zIndex:9999999999}},a?.variants?.edges?.length>1&&e.createElement("div",{className:"yt-byob-modal-mobile-variant-selector"},e.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"}},e.createElement("span",{style:{flexShrink:0}},a.options[0].name," :"," ",e.createElement("strong",{style:{color:"#000",paddingLeft:"5px"}},s?.title)),e.createElement("select",{className:"yt-byob-modal-mobile-variant-select",value:s?.id||"",onChange:z,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}},a?.variants?.edges?.map(({node:t})=>e.createElement("option",{key:t.id,value:t.id,disabled:0===c(t)},t.title))),e.createElement("span",{className:"yt-byob-modal-mobile-variant-chevron",style:{position:"absolute",right:5,pointerEvents:"none",fontSize:"12px",color:"#000"}},e.createElement(Me,null)))),e.createElement("div",{className:"yt-byob-modal-mobile-price-atc-wrapper",style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"}},e.createElement("div",{className:"yt-byob-modal-mobile-price",style:{width:"fit-content",minWidth:"fit-content",display:"flex",flexDirection:"row",paddingRight:"10px",alignItems:"center"}},r?.isFreebieTier&&!r.showFreebieTierProductPrices?e.createElement(e.Fragment,null,e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"20px",textDecoration:"line-through",color:"#888",marginRight:"6px"}},Pp(r.styles.general.currencySymbol,r.styles.general.currencySymbol),Fp(s?.price)),e.createElement("span",{className:"yt-byob-current-price",style:{color:r.styles.general.primaryColor||"#d32f2f",fontWeight:"bold",fontSize:"20px"}},"FREE")):e.createElement(e.Fragment,null,s?.compareAtPrice&&e.createElement("div",{className:"yt-byob-modal-mobile-compare-price",style:{textDecoration:"line-through",opacity:"0.5",lineHeight:"normal"}},Pp(r.styles.general.currencySymbol,r.styles.general.currencySymbol),Fp(s?.compareAtPrice)),e.createElement("div",{className:"yt-byob-modal-mobile-current-price"},e.createElement("span",{style:{fontSize:"20px",fontWeight:"600",color:"#000",textAlign:"center",lineHeight:"normal"}},Pp(r.styles.general.currencySymbol,r.styles.general.currencySymbol),Fp(s?.price))))),e.createElement("div",{className:"yt-byob-modal-mobile-atc-wrapper",style:{width:"100%"}},e.createElement("button",{className:"yt-byob-modal-mobile-atc-button",style:{textTransform:"uppercase",fontWeight:"800",width:"100%",border:"none",backgroundColor:r.themeColor||"#111",borderRadius:r.cornerRadius,color:r.primaryTextColorCta||"#fff",minHeight:"40px",padding:"0px 15px",position:"relative",overflow:"hidden",opacity:R?.5:1,cursor:R?"not-allowed":"pointer"},onClick:e=>{e.stopPropagation(),e.preventDefault(),k()},disabled:R},r.styles.byob.addToBundleCTAText||"Add to Bundle"))))));return nt.createPortal(g?L:O,document.body)}),Rc=({options:t,selectedValue:n,onChange:o,type:r="text",isOptionAvailable:i,isMobile:a})=>e.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"}},t?.map(t=>{const a=!i||i(t.name);return e.createElement("div",{key:t.name,onClick:()=>{a&&o(t)},style:{cursor:a?"pointer":"not-allowed"}},((t,n)=>{const o=!i||i(t.name),a={cursor:o?"pointer":"not-allowed",border:n?"2px solid #333":"1px solid #d1d5db",transition:"all 0.2s ease",opacity:o?1:.5};if("color"===r)return t.value&&(()=>{if(!t.value.trim())return!1;if(t.value===t.name||t.value.length<3)return!1;try{const e=document.createElement("div");return e.style.color=t.value,""!==e.style.color}catch{return!1}})()?e.createElement("div",{style:{...a,width:24,height:24,borderRadius:"50%",backgroundColor:t.value}}):e.createElement("div",{style:{...a,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"}},t.name);return"image"===r?e.createElement("img",{src:dn(t.value,48,85,"webp")||"/placeholder.svg",alt:t.name,style:{...a,width:24,height:24,borderRadius:"50%",objectFit:"cover"}}):e.createElement("div",{style:{...a,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"}},t.name)})(t,n?.name===t.name))})),Oc=({product:r,isOpen:i,onClose:a,variantOptions:l,cta:c,onConfirm:d})=>{const s=o(()=>e=>e?r?.tracksInventory&&e?.inventoryItem?.tracked?e.inventoryQuantity>0?e?.inventoryQuantity:e.inventoryQuantity<=0&&"continue"===e.inventoryPolicy?1/0:0:1/0:0,[r?.tracksInventory]),p=o(()=>{const e=r.variants.edges.find(e=>{const t=e.node;return s(t)>0})?.node;return e?.title&&"Default Title"!==e.title?e.title.split(" / "):r.options?.map(e=>e.values[0])||[]},[r,s]),[m,u]=t(p),[g,x]=t(window.innerWidth<1024);n(()=>{const e=()=>x(window.innerWidth<1024);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),n(()=>{const e=e=>{"Escape"===e.key&&a()};return i&&document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[i,a]);const f=r.variants.edges.find(e=>e.node.title===(r.options?.length>0?m.join(" / "):m[0]))?.node,y=f?.image?.url||r.featuredMedia?.preview?.image?.url,b=dn(y,150,85,"webp"),h=e=>{if(!l?.options)return"text";const t=l.options.find(t=>t.name===e);return t?.type||"text"},v=e=>{if(!l?.options)return e.values.map(e=>({name:e,value:e}));const t=l.options.find(t=>t.name===e.name);return e.values.map(e=>{const n=t?.values?.find(t=>t.name===e);return{name:e,value:n?.value||e}})},w=(e,t)=>{const n=m[t];if(!n)return null;return v(e).find(e=>e.name===n)||null};if(!i)return null;const C=e.createElement("div",{onClick:a,style:{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100vw",height:"100vh",background:"rgba(0, 0, 0, 0.4)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center"},role:"dialog","aria-modal":"true","aria-labelledby":"yt-variant-options-modal-title"},e.createElement("div",{onClick:e=>e.stopPropagation(),style:{background:"white",borderRadius:16,width:"fit-content",minWidth:350,maxWidth:450,maxHeight:"90vh",overflowY:"auto",position:"relative",zIndex:999,...window.innerWidth<=600&&{width:"90vw",maxWidth:"90vw",minWidth:"90vw"}}},e.createElement("div",{id:"yt-variant-options-modal-title",style:{width:"100%",padding:"16px 0",fontWeight:600,fontSize:14,textTransform:"uppercase",backgroundColor:"rgba(217, 217, 217)",color:"black",textAlign:"center",borderTopLeftRadius:16,borderTopRightRadius:16}},"Select Options"),e.createElement("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"16px 20px",borderBottom:"1px solid #f0f0f0"}},e.createElement("img",{src:b,alt:r.title,style:{width:60,height:60,borderRadius:8,objectFit:"cover",flexShrink:0,transition:"opacity 0.3s ease"}}),e.createElement("div",{style:{display:"flex",flexDirection:"column",flex:1,gap:4}},e.createElement("div",{style:{fontSize:14,fontWeight:600,color:"#333"}},r.title))),e.createElement("div",{style:{padding:"20px"}},r.options.map((t,n)=>e.createElement("div",{key:t.name,style:{display:"flex",flexDirection:"column",gap:8,marginBottom:t?.values?.length>1?16:0}},t?.values?.length>1&&e.createElement(e.Fragment,null,e.createElement("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8}},e.createElement("span",{style:{fontSize:14,fontWeight:500,color:"#333"}},"Select ",t.name),e.createElement("span",{style:{fontSize:12,fontWeight:500,color:"#666",backgroundColor:"#f5f5f5",padding:"4px 12px",borderRadius:16,textTransform:"capitalize"}},w(t,n)?.name||t.values[0])),e.createElement(Rc,{options:v(t),selectedValue:w(t,n),onChange:e=>{((e,t)=>{const n=[...m];n[e]=t.name,u(n)})(n,e)},type:h(t.name),isOptionAvailable:e=>((e,t)=>{const n=[...m];n[e]=t;const o=r.options?.length>0?n.join(" / "):n[0],i=r.variants.edges.find(e=>e.node.title===o)?.node;return!!i&&s(i)>0})(n,e),isMobile:g}))))),e.createElement("button",{onClick:()=>{const e=r.variants.edges.find(e=>e.node.title===(r.options?.length>0?m.join(" / "):m[0]))?.node,t=!!e&&s(e)>0;if(e?.id&&t)d(e.id),a();else{console.warn("yt::variant options modal - selected variant not available or out of stock:",m);const e=r.variants.edges.find(e=>s(e.node)>0)?.node.id;e&&(d(e),a())}},style:{width:"100%",fontSize:14,fontWeight:600,textTransform:"uppercase",backgroundColor:c.backgroundColor,color:c.textColor,textAlign:"center",padding:"16px 0",border:"none",cursor:"pointer",borderBottomLeftRadius:16,borderBottomRightRadius:16},onMouseEnter:e=>{e.currentTarget.style.opacity="0.9"},onMouseLeave:e=>{e.currentTarget.style.opacity="1"}},"Add to Bundle")));return nt.createPortal(C,document.body)},Lc=({coverImageUrl:t,mobileCoverImageUrl:n,alt:o="Background",styles:r})=>{const i=[{imageWidth:21,descriptor:36},{imageWidth:48,descriptor:80},{imageWidth:99,descriptor:165},{imageWidth:216,descriptor:360},{imageWidth:225,descriptor:375},{imageWidth:319,descriptor:533},{imageWidth:330,descriptor:550},{imageWidth:432,descriptor:720},{imageWidth:564,descriptor:940},{imageWidth:639,descriptor:1066},{imageWidth:648,descriptor:1080},{imageWidth:900,descriptor:1500},{imageWidth:1068,descriptor:1780},{imageWidth:1296,descriptor:2160}],a=(e,t)=>{if(e&&e.includes("cdn.shopify"))try{const n=new URL(e),o=n.searchParams;return o.has("format")||o.set("format","webp"),o.has("quality")||o.set("quality","80"),o.set("width",t.toString()),n.toString()}catch{const n=e.includes("?")?"&":"?";return`${e}${n}format=webp&quality=80&width=${t}`}},l=e=>e?i.map(({imageWidth:t,descriptor:n})=>{const o=a(e,t);return o?`${o} ${n}w`:""}).filter(Boolean).join(", "):"";if(!t&&!n)return null;const c=t||n||"",d=a(c,800)||c,s=[];if(n&&n!==t){const t=l(n);t&&s.push(e.createElement("source",{key:"mobile",media:"(max-width: 768px)",srcSet:t}))}if(t){const n=l(t);n&&(s.length>0?s.push(e.createElement("source",{key:"desktop",media:"(min-width: 769px)",srcSet:n})):s.push(e.createElement("source",{key:"desktop",srcSet:n})))}else if(n){const t=l(n);t&&s.push(e.createElement("source",{key:"mobile",srcSet:t}))}return e.createElement("div",{style:{width:"100%",display:"block"}},e.createElement("picture",{style:{display:"block",width:"100%"}},s,e.createElement("img",{src:d,alt:o,style:{width:"100%",height:"auto",display:"block",...r},loading:"eager",fetchPriority:"high",sizes:"100vw"})))},jc=({title:t,isOpen:n,onToggle:o,children:r})=>e.createElement("div",{className:"yt-byob-filter-section",style:{borderBottom:"1px solid #eee",paddingBottom:n?"20px":"12px",marginBottom:"12px"}},e.createElement("div",{className:"yt-byob-filter-section-header",onClick:o,style:{display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",padding:"8px 0"}},e.createElement("span",{className:"yt-byob-filter-section-title",style:{fontSize:"16px",fontWeight:500,color:"#111"}},t),n?e.createElement(Ie,{className:"yt-byob-icon-minus",size:20}):e.createElement(Te,{className:"yt-byob-icon-plus",size:20})),n&&e.createElement("div",{className:"yt-byob-filter-section-body",style:{marginTop:"16px"}},r)),Mc=({availableFilters:n,appliedFilters:o,toggleFilter:r,clearAllFilters:i,applyPriceFilter:a,priceMin:l,setPriceMin:c,priceMax:d,setPriceMax:s,maxPossiblePrice:p,styles:m,availableProductCount:u,products:g,unavailableProductCount:x,storeCurrencyCode:f,showActions:y=!0,openSections:b,toggleSection:h})=>{const[v,w]=t(null),C=Pp(m?.general?.currencySymbol,f)??"₹";return e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-filters-content-wrapper",style:{overflowY:"auto",scrollbarWidth:"none",padding:"20px",flex:1,minHeight:0,overscrollBehavior:"contain"}},n.map(t=>e.createElement(jc,{key:t.id,title:t.label,isOpen:!!b[t.id],onToggle:()=>h(t.id)},"LIST"===t.type&&e.createElement("div",{className:"yt-byob-filter-list",style:{display:"flex",flexDirection:"column",gap:"14px"}},t.values.map(n=>{const i=o[t.id]?.includes(n.id)||!1,a="filter.v.availability.1"===n.id?u??g.length:"filter.v.availability.0"===n.id?x??0:n.count;return e.createElement("label",{key:n.id,className:"yt-byob-filter-item-label",style:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer"}},e.createElement("div",{className:"yt-byob-filter-item-left",style:{display:"flex",alignItems:"center",gap:"10px"}},e.createElement("input",{className:"yt-byob-filter-checkbox",type:"checkbox",checked:i,onChange:()=>r(t.id,n.id),style:{width:"18px",height:"18px",accentColor:m?.general?.primaryColor||"#333",cursor:"pointer"}}),e.createElement("span",{className:"yt-byob-filter-item-text",style:{fontSize:"15px",color:"#333"}},n.label)),e.createElement("span",{className:"yt-byob-filter-item-count",style:{fontSize:"12px",background:"#f3f4f6",padding:"2px 8px",borderRadius:"4px",color:"#666",minWidth:"24px",textAlign:"center"}},a))})),"PRICE_RANGE"===t.type&&e.createElement("div",{className:"yt-byob-price-filter",style:{padding:"0 4px"}},e.createElement("div",{className:"yt-byob-price-range-display",style:{fontSize:"15px",color:"#333",marginBottom:"24px",fontWeight:500}},C,l.toLocaleString()," – ",C,d.toLocaleString(),d>=p?"+":""),e.createElement("div",{className:"yt-byob-price-slider-container",style:{position:"relative",width:"100%",height:"4px",background:"#e5e7eb",borderRadius:"4px",marginBottom:"10px"}},e.createElement("div",{className:"yt-byob-price-slider-track",style:{position:"absolute",height:"100%",background:"#333",borderRadius:"4px",left:l/p*100+"%",right:100-d/p*100+"%"}}),e.createElement("input",{type:"range",min:0,max:p,value:l,onMouseDown:()=>w("min"),onTouchStart:()=>w("min"),onChange:e=>{const t=Math.min(Number(e.target.value),d-10);c(t)},style:{position:"absolute",width:"100%",height:"0px",top:"50%",transform:"translateY(-50%)",background:"none",pointerEvents:"none",appearance:"none",WebkitAppearance:"none",zIndex:"min"===v?11:5,margin:0},className:"yt-byob-dual-range-input-min"}),e.createElement("input",{type:"range",min:0,max:p,value:d,onMouseDown:()=>w("max"),onTouchStart:()=>w("max"),onChange:e=>{const t=Math.max(Number(e.target.value),l+10);s(t)},style:{position:"absolute",width:"100%",height:"0px",top:"50%",transform:"translateY(-50%)",background:"none",pointerEvents:"none",appearance:"none",WebkitAppearance:"none",zIndex:"max"===v?11:4,margin:0},className:"yt-byob-dual-range-input-max"})),e.createElement("style",null,"\n .yt-byob-dual-range-input-min::-webkit-slider-thumb,\n .yt-byob-dual-range-input-max::-webkit-slider-thumb {\n pointer-events: auto;\n appearance: none;\n width: 22px;\n height: 22px;\n border-radius: 50%;\n background: #444;\n border: 3px solid white;\n cursor: pointer;\n box-shadow: 0 2px 5px rgba(0,0,0,0.2);\n position: relative;\n z-index: 20;\n }\n .yt-byob-dual-range-input-min::-moz-range-thumb,\n .yt-byob-dual-range-input-max::-moz-range-thumb {\n pointer-events: auto;\n width: 22px;\n height: 22px;\n border-radius: 50%;\n background: #444;\n border: 3px solid white;\n cursor: pointer;\n box-shadow: 0 2px 5px rgba(0,0,0,0.2);\n position: relative;\n z-index: 20;\n }\n "))))),y&&e.createElement("div",{className:"yt-byob-filter-actions",style:{display:"flex",gap:"12px",borderTop:"1px solid #eee",padding:"16px 0px",position:"sticky",bottom:"2px",paddingInline:"10px"}},e.createElement("button",{className:"yt-byob-filter-clear-button",onClick:i,style:{flex:1,padding:"8px",background:"#f3f4f6",border:"none",borderRadius:m?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px",color:"#333",fontFamily:"inherit"}},"Clear All"),e.createElement("button",{className:"yt-byob-filter-apply-button",onClick:a,style:{flex:1,padding:"8px",background:m?.general?.primaryColor||"#333",color:"white",border:"none",borderRadius:m?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px",fontFamily:"inherit"}},"Apply")))},Vc=t=>{const{showFiltersDrawer:n,handleClose:o,isAnimating:r,isMobile:i}=t;return n?ot(e.createElement("div",{className:"yt-byob-filter-drawer-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:1e3,display:"flex",justifyContent:"flex-end",opacity:r?1:0,transition:"opacity 300ms ease-in-out"},onClick:o},e.createElement("div",{className:"yt-byob-filter-drawer-content",style:{width:i?"85%":"380px",height:"100%",background:"white",boxShadow:"-4px 0 12px rgba(0,0,0,0.15)",transform:r?"translateX(0)":"translateX(100%)",transition:"transform 300ms ease-in-out",display:"flex",flexDirection:"column",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement(Mc,{...t,applyPriceFilter:()=>{t.applyPriceFilter(),o()},openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})}))),document.body):null},Wc=t=>{const{showFiltersDrawer:n}=t;return n&&0!==t?.availableFilters?.length?e.createElement("div",{className:"yt-byob-filters-sidebar",style:{width:"280px",minWidth:"280px",padding:"0",height:"auto",maxHeight:"calc(100vh - 40px)",position:"sticky",top:"20px",display:"flex",flexDirection:"column",borderRight:"1px solid #eee",marginRight:"20px"}},e.createElement(Mc,{...t,showActions:!0,openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})})):null},Hc=({enableSortAndFilter:o,isMobile:r,setSearchTerm:i,searchTerm:a,styles:l,setSortBy:c,appliedFilters:d,setAppliedFilters:s,availableFilters:p=[],products:m,availableProductCount:u,unavailableProductCount:g,maxPossiblePrice:x,storeCurrencyCode:f,sharedFiltersState:y,openSections:h,toggleSection:v,sortBy:w})=>{const[C,E]=t(!1),[k,T]=t(a),{showFilters:S,setShowFilters:$,priceMax:B,setPriceMax:I,priceMin:z,setPriceMin:N}=y,[F,P]=t(!1),D=l?.byob?.productFiltersDisplay||"drawer",A=!r&&"sidebar"===D,_="none"===D;n(()=>{d["filter.v.price"]||(I(x),N(0))},[x,d]);n(()=>{const e=setTimeout(()=>{i(k)},300);return()=>clearTimeout(e)},[k,i]),n(()=>(S&&!A?(document.body.style.overflow="hidden",P(!0)):(document.body.style.overflow="",P(!1)),()=>{document.body.style.overflow=""}),[S,A]);const R=Object.entries(d).reduce((e,[t,n])=>"filter.v.price"===t?z>0||B<x?e+1:e:e+(n?n.length:0),0);return e.createElement("div",{className:"yt-byob-sort-filter-container",style:{display:"flex",flexDirection:r?"column":"row",justifyContent:"space-between",alignItems:r?"flex-end":"center",marginBottom:"20px",width:"100%",gap:r?"10px":"0"}},e.createElement("div",{className:"yt-byob-search-filter-controls",style:{display:"flex",flexDirection:o?"row-reverse":"row",justifyContent:"space-between",alignItems:C?void 0:"center",gap:"12px",width:"100%"}},o&&e.createElement("div",{className:"yt-byob-search-wrapper",style:{position:"relative",display:"flex",alignItems:"center",width:r?C?"100%":"auto":"400px",transition:"width 0.3s ease-in-out"}},r&&!C?e.createElement(Se,{className:"yt-byob-search-icon-trigger",fontSize:"20px",color:"#555",style:{cursor:"pointer"},onClick:()=>E(!0)}):e.createElement(e.Fragment,null,e.createElement("input",{className:"yt-byob-search-input",style:{width:"100%",padding:r?"10px 12px":"10px 14px",fontSize:"14px",outline:"none",color:"#333",border:"1px solid #c7c7c7",borderRadius:l?.byob.borderRadius,boxShadow:l?.byob.borderColor?"0 2px 4px rgba(0,0,0,0.1)":"none"},placeholder:"Search by Product Name",value:k,onChange:e=>T(e.target.value)}),!C&&e.createElement(Se,{className:"yt-byob-search-icon",fontSize:"18px",style:{position:"absolute",right:"12px",color:"#aaa",pointerEvents:"none"}})),r&&C&&e.createElement("span",{className:"yt-byob-search-close",style:{position:"absolute",right:"12px",color:"#aaa",fontSize:"16px",cursor:"pointer"},onClick:()=>E(!1)},"X")),e.createElement("div",{className:"yt-byob-actions-wrapper",style:{display:"flex",flexDirection:"row",gap:"10px"}},p?.length>0&&e.createElement("button",{className:"yt-byob-filter-toggle-button",onClick:()=>$(!S),style:{display:_?"none":"flex",alignItems:"center",gap:r?"0px":"6px",background:S&&A?"#f3f4f6":"white",cursor:"pointer",fontSize:"14px",color:"#333",whiteSpace:"nowrap",border:"1px solid #d1d5db",padding:"8px 12px",borderRadius:l?.byob.borderRadius,boxShadow:"0 2px 4px rgba(0,0,0,0.1)"}},e.createElement($e,{className:"yt-byob-filter-toggle-icon",size:18}),!r&&"Filters",R>0&&e.createElement("span",{className:"yt-byob-active-filter-badge",style:{background:l?.general?.primaryColor||"#ef4444",color:"white",borderRadius:"999px",padding:"2px 8px",fontSize:"12px",lineHeight:1}},R)),o&&e.createElement("div",{className:"yt-byob-sort-wrapper",style:{display:"flex",alignItems:"center",border:"1px solid #d1d5db",padding:"8px 12px",borderRadius:l?.byob.borderRadius,boxShadow:"0 2px 4px rgba(0,0,0,0.1)",position:"relative"}},!r&&e.createElement("span",{className:"yt-byob-sort-label",style:{fontSize:"14px",color:"#555",marginRight:"6px"}},"Sort:"),r&&e.createElement(Be,{className:"yt-byob-sort-icon",size:18,style:{color:"#555"}}),e.createElement("select",{className:"yt-byob-sort-select",style:{border:"none",background:"transparent",fontSize:"14px",color:"#333",cursor:"pointer",outline:"none",appearance:"none",WebkitAppearance:"none",paddingRight:"20px"},value:w,onChange:e=>c(e.target.value)},e.createElement("option",{className:"yt-byob-sort-option",value:""},"Featured"),e.createElement("option",{className:"yt-byob-sort-option",value:"price-low-to-high"},"Price: Low to High"),e.createElement("option",{className:"yt-byob-sort-option",value:"price-high-to-low"},"Price: High to Low"),e.createElement("option",{className:"yt-byob-sort-option",value:"title-asc"},"Alphabetical: A-Z"),e.createElement("option",{className:"yt-byob-sort-option",value:"title-desc"},"Alphabetical: Z-A")),e.createElement(b,{className:"yt-byob-sort-chevron",size:14,style:{position:"absolute",right:"10px",pointerEvents:"none",color:"#555"}})))),!A&&!_&&e.createElement(Vc,{showFiltersDrawer:S,handleClose:()=>{A?$(!1):(document.body.style.overflow="",P(!1),setTimeout(()=>{$(!1)},300))},isAnimating:F,isMobile:r,availableFilters:p,appliedFilters:d,toggleFilter:(e,t)=>{s(n=>{const o=n[e]||[],r=o.includes(t)?o.filter(e=>e!==t):[...o,t],i={...n,[e]:r.length?r:void 0};return Object.fromEntries(Object.entries(i).filter(([,e])=>void 0!==e))})},clearAllFilters:()=>{I(x),N(0),s({})},applyPriceFilter:()=>{s(e=>{const t={...e};return t["filter.v.price"]=[`min:${z}-max:${B}`],t})},priceMin:z,setPriceMin:N,priceMax:B,setPriceMax:I,maxPossiblePrice:x,styles:l,availableProductCount:u,products:m,unavailableProductCount:g,storeCurrencyCode:f,openSections:h,toggleSection:v}))};function qc({quantity:t,setQuantity:n,remainingQuantity:o,handleAddToBundle:r,variantId:i,product:a,handleRemoveItem:l,hideAddToBundle:c,selectedVariantInventoryQty:d}){const s={display:"flex",alignItems:"center",justifyContent:"center",width:"33%",cursor:"pointer",backgroundColor:"#f2f2f2",userSelect:"none",border:"none",padding:"8px",margin:"0",fontSize:"20px",color:"#333",textDecoration:"none",boxShadow:"none",outline:"none",borderRadius:"0",boxSizing:"border-box"},p=t<d;return e.createElement(Ol,{className:"yt-byob-quantity-selector-container"},e.createElement("button",{className:"yt-byob-quantity-minus-button",onClick:e=>{e.stopPropagation();const o=Math.max(0,t-1);n(o),l&&i&&l(i,1)},style:s},"-"),e.createElement(Ll,{className:"yt-byob-quantity-display"},t," added"),e.createElement("button",{className:"yt-byob-quantity-plus-button",onClick:e=>{e.stopPropagation();const l=Math.min(o,t+1,d);n(l),r&&i&&a&&r(i,a,1)},disabled:!p||c,style:{...s,cursor:!p||c?"not-allowed":"pointer",opacity:!p||c?.6:1}},"+"))}const Qc=({product:r,styles:i,selectedVariant:a})=>{const[l,c]=t(!1),d=o(()=>Dp(a?.image?.url||r?.featuredMedia?.preview?.image?.url||r?.media?.edges?.[0]?.node?.image?.url)||"",[a?.image?.url,r?.featuredMedia?.preview?.image?.url,r?.media?.edges]),s=o(()=>r?.media?.edges?.map(e=>Dp(e?.node?.preview?.image?.url??e?.node?.image?.url)).filter(Boolean)??[],[r?.media?.edges]),p=o(()=>s?.[1]??d??"",[s,d]);n(()=>{if(d){(new Image).src=d}},[d]);const m=o(()=>d||s?.[0],[d,s]);return e.createElement("div",{className:"yt-byob-image-hover-container",style:{position:"relative",width:"100%",overflow:"hidden",aspectRatio:i.general.imageAspectRatio||"1/1"},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1)},e.createElement("div",{className:"yt-byob-image-inner-container",style:{width:"100%",height:"100%",position:"relative"}},e.createElement("img",{className:"yt-byob-image-main",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",objectPosition:"top",opacity:l&&m!==p?0:1,transition:s?.length>0?"opacity 300ms ease, transform 300ms ease":"",transform:l?"scale(1.1)":"scale(1)"},src:m,alt:r.title}),m!==p&&e.createElement("img",{className:"yt-byob-image-hover",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",opacity:l?1:0,transition:"opacity 400ms ease, transform 400ms ease",transform:l?"scale(1.1)":"scale(1)",position:"absolute",top:0,left:0,objectPosition:"top"},src:p,alt:r.title})))},Uc=({product:o,bundle:r,handleAddToBundle:a,hideAddToBundle:l,remainingQuantity:c,themeColor:d,handleRemoveItem:s,transitionActive:p,idx:m,selecteditems:u,customVariantsQuantity:g,currentProductTier:x,showFreebieTierProductPrices:f})=>{const y=ee(Nc),h=r.customizations,v=h?.byob?.variantSelectorType,[w,C]=t(!1),E=h.general?.variantTitleSuffix?o?.variants?.edges:(e=>{if(!e||e.length<2)return e;const t=e.map(e=>e.node.title).map(e=>e.split(" "));let n=[...t[0]];for(let e=1;e<t.length;e++){const o=t[e];let r=0;for(;r<n.length&&r<o.length&&n[n.length-1-r]===o[o.length-1-r];)r++;n=n.slice(n.length-r)}return n.length<1?e:e.map(e=>{const t=e.node.title.split(" "),o=t.slice(0,t.length-n.length).join(" ");return{...e,node:{...e.node,title:o,commonSuffix:n.join(" ")}}})})(o?.variants?.edges);if(!E||!E.length)return e.createElement(e.Fragment,null);const k=i(e=>{const t=g?.find(t=>t.variantId===e)?.quantity;if(void 0!==t)return t;if(r?.customProductsQuantity)return r?.customProductsQuantity;const n=E?.find(t=>t.node.id===e),i=n?.node;return i?o.tracksInventory&&i.inventoryItem?.tracked?i.inventoryQuantity>0?i.inventoryQuantity:i.inventoryQuantity<=0&&"continue"===i.inventoryPolicy?1/0:0:1/0:0},[E,g,o.tracksInventory]),T=E?.find(e=>k(e.node.id)>0)?.node?.id;if(!T&&!h.general.showOutOfStockProducts)return e.createElement(e.Fragment,null);const[S,$]=t(E?.find(e=>k(e.node.id)>0)?.node?.id||E[0]?.node?.id),[B,I]=t(0),[z,N]=t(window.innerWidth<450),[F,P]=t("normal"),D=E?.find(e=>e?.node?.id===S)?.node,A=k(S||"");n(()=>{const e=u.find(e=>e.variantId===S);I(e?e.quantity:0)},[B,u,S]),n(()=>{const e=()=>{N(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{CSS.supports("font-weight","500")?P("500"):CSS.supports("font-weight","400")?P("400"):CSS.supports("font-weight","600")&&P("600")},[]),n(()=>{document.documentElement.style.setProperty("--yt-bundle-font-weight",F)},[F]),n(()=>{if(S&&!E?.some(e=>e.node.id===S)){const e=E.find(e=>k(e.node.id)>0)?.node.id||E[0]?.node?.id;e&&$(e)}},[S,E,k]);const _=o.variants&&o.variants.edges?.length>1&&"customOptions"!==v,R="undefined"!=typeof window?(window?.ytapp||window?.ytBundleApp)?.storeId:void 0,O="53933408435"===R,L="75851235630"===R,j=(e=>{if(e.metafield&&"yourtoken_bundles_app"===e.metafield.namespace&&"categories"===e.metafield.key){if(e.metafield.jsonValue&&Array.isArray(e.metafield.jsonValue))return e.metafield.jsonValue;if(e.metafield.value)try{const t=JSON.parse(e.metafield.value);if(Array.isArray(t))return t}catch(e){console.error("Failed to parse categories:",e)}}return[]})(o),M=j.length>0;return e.createElement(e.Fragment,null,e.createElement(Vl,{borderRadius:h?.byob.borderRadius,borderColor:h?.byob.borderColor,shadowType:h?.byob.shadowType,backgroundColor:h?.byob.cardBackgroundColor,className:"yt-byob-product-container bundle-builder-product-container "+(p?"yt-product-card-transition-active":m%2==0?"yt-product-card-transition":"yt-product-card-transition-up"),onClick:()=>{if(A<=0)return;const e={...o,variants:{...o.variants,edges:E},selectedVariant:D};y(e)},onMouseEnter:e=>{e.currentTarget.style.transform="scale(1.01)"},onMouseLeave:e=>{e.currentTarget.style.transform="scale(1)"},style:{WebkitTapHighlightColor:"transparent",textAlign:h?.byob?.productCardDetailsAlignment||"left"}},e.createElement(Wl,{className:"yt-byob-image-wrapper"},e.createElement(Qc,{product:o,styles:h,selectedVariant:D}),r?.productCardBadgeText&&e.createElement("div",{className:"yt-byob-product-badge",style:{position:"absolute",top:"0px",left:"0px",backgroundColor:h?.general.primaryColor||"#111",color:h?.general.primaryContrastColor||"#fff",zIndex:1,margin:"0px",whiteSpace:"pre",padding:"4px 8px",fontSize:"12px",borderTopLeftRadius:h.byob.borderRadius}},r.productCardBadgeText),_&&e.createElement("div",{className:"yt-byob-variant-selector-wrapper",style:{position:"relative",width:"100%"}},e.createElement(Hl,{className:"yt-byob-variant-selector",isCoralHaze:O,onClick:e=>{e.preventDefault(),e.stopPropagation()},value:S||"",onChange:e=>{e.stopPropagation(),e.preventDefault(),$(e.target.value)}},E?.map(t=>{const n=window.innerWidth<=320?10:window.innerWidth<=420?15:22,o=t.node.title.length>n?t.node.title.substring(0,n)+"...":t.node.title;return e.createElement("option",{key:t.node.id,value:t.node.id},o)})),e.createElement("div",{className:"yt-byob-variant-chevron",style:{position:"absolute",right:"16px",bottom:"10px",pointerEvents:"none"}},e.createElement(b,null)))),e.createElement("div",{className:"yt-byob-product-content"},"enabled"===r?.customizations?.byob?.productCardCategoryVisibility&&M&&e.createElement("div",{className:"yt-byob-product-categories-wrapper",style:{padding:"2px 4px"}},e.createElement("div",{className:"yt-byob-product-categories",style:{display:"flex",flexWrap:"wrap",gap:"4px"}},j.slice(0,2).map((t,n)=>e.createElement("span",{className:"yt-byob-category-tag",key:n,style:{fontSize:z?"8px":"12px",color:"#666",fontWeight:"500"}},t.charAt(0).toUpperCase()+t.slice(1))),j.length>2&&e.createElement("span",{className:"yt-byob-more-categories",style:{fontSize:"10px",padding:"2px 6px",backgroundColor:"rgba(0, 0, 0, 0.05)",borderRadius:"8px",color:"#666",fontWeight:"500"}},"+",j.length-2," more"))),e.createElement(ql,{isMobile:z,showBorder:r?.showBorder??!0,style:{...!h?.byob.productsPriceVisibility&&{padding:"8px"},...h?.byob.productTitleFontSize&&{fontSize:h?.byob.productTitleFontSize||"18px"}},className:"yt-byob-product-title-wrapper"},e.createElement("div",{style:{display:"-webkit-box",WebkitLineClamp:h?.byob?.productTitleWrapLines||2,WebkitBoxOrient:"vertical",overflow:"hidden",lineHeight:"normal"},className:"yt-byob-product-title"},L?String(D?.displayName).replace("- Default Title",""):o.title,D?.commonSuffix?" -"+D?.commonSuffix:""))),"Default Title"!==D?.title&&h?.byob?.showVariantTitleInCard&&e.createElement("p",{style:{padding:r?.showBorder??1?"0px 10px":"0 4px",fontSize:"12px",margin:"0",fontWeight:"600",color:"#888",lineHeight:"normal"},className:"yt-byob-product-variant-title"},D?.title),"ratingOnly"===r?.reviewRatingType&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(he,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6}},o?.rating?.averageRating," rating")),"ratingAndReviewCount"===r?.reviewRatingType&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(he,{color:"gold",size:14})," ",o?.rating?.averageRating,e.createElement(me,{className:"yt-byob-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",o?.rating?.ratingCount," reviews)"),h?.byob.productsPriceVisibility&&e.createElement("div",{className:"yt-byob-product-price yt-bundle-builder-product-price",style:{marginBottom:"5px",padding:r?.showBorder?"0px 10px":"0 4px"}},x?.isFreebieTier&&!f?e.createElement(e.Fragment,null,e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"14px",textDecoration:"line-through",color:"#888",marginRight:"6px"}},Pp(h.general.currencySymbol,r?.storeCurrencyCode)??"Rs.",Fp(D?.price)),e.createElement("span",{className:"yt-byob-current-price",style:{color:h.general.primaryColor||"#d32f2f",fontWeight:"bold"}},"FREE")):parseFloat(D?.price??"0")>0?e.createElement("span",{className:"yt-byob-current-price"},Pp(h.general.currencySymbol,r?.storeCurrencyCode)??"Rs.",Fp(D?.price)):e.createElement("span",{className:"yt-byob-free-price"},"Free"),(!x?.isFreebieTier||f)&&D?.compareAtPrice&&h?.byob.compareAtPriceVisibility&&parseFloat(D.compareAtPrice)>parseFloat(D?.price)&&e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"14px"}},Pp(h.general.currencySymbol,r?.storeCurrencyCode)??"Rs.",Fp(D.compareAtPrice))),(A>0||A===1/0)&&e.createElement(Ql,{borderRadius:h?.byob.borderRadius,className:"yt-byob-add-to-bundle-wrapper yt-product-atc-wrapper"},(0===B||void 0===B)&&e.createElement(jl,{style:{...!l&&{backgroundColor:h?.general.primaryColor||"#111",color:h?.general.primaryContrastColor||"#fff"}},disabled:l,onClick:e=>{e.stopPropagation(),e.preventDefault(),I(1),(()=>{if(!S)return;"customOptions"===v&&E.length>1?C(!0):a(S,o,1)})()},className:"yt-byob-add-to-bundle-button yt-product-atc-button"},h?.byob.addToBundleCTAText),!r?.disableQuantitySelector&&B>0&&S&&e.createElement(Ml,{className:"yt-byob-quantity-selector-container visible",style:{overflow:"hidden"}},e.createElement(qc,{remainingQuantity:c,setQuantity:I,quantity:B,handleAddToBundle:a,variantId:S,product:o,handleRemoveItem:s,hideAddToBundle:l,selectedVariantInventoryQty:A})),r?.disableQuantitySelector&&B>0&&S&&e.createElement(jl,{style:{backgroundColor:"#747474",color:h?.general.primaryContrastColor||"#fff",display:"flex",justifyContent:"space-between",overflow:"hidden",height:"40px"},className:"yt-byob-added-button yt-product-atc-single-qty-selector"},e.createElement(Ul,{className:"yt-byob-added-text yt-product-atc-single-qty-selector-added"},"ADDED"),e.createElement(Yl,{className:"yt-byob-single-qty-remove yt-product-atc-single-qty-selector-remove",onClick:e=>{e.stopPropagation();const t=Math.max(0,B-1);I(t),s&&S&&s(S,1)}},e.createElement(ze,{style:{color:"#fff",fontSize:"20px"}})))),A<=0&&A!==1/0&&e.createElement(jl,{style:{backgroundColor:h.general.disabledButtonColor,color:"#fff",cursor:"not-allowed",transition:"transform 0.2s ease-in-out"},className:"yt-product-atc-disabled"},h?.general.outOfStockLabel||"Out of Stock")),"customOptions"===v&&w&&E.length>1&&e.createElement(Oc,{product:o,isOpen:w,onClose:()=>C(!1),variantOptions:r.variantOptions,cta:{textColor:h.general.ctaTextColor,backgroundColor:h.general.primaryColor},onConfirm:e=>{$(e),a(e,o,1)}}))},Yc=({currentStep:t,setCurrentProductTier:n,totalSteps:o,tiers:r,isMobile:i,selectedProductsByTier:a,primaryColor:l="#000",primaryTextColorCta:c="#fff",tierNavigation:d})=>e.createElement("div",{className:"yt-byob-stepper-container",style:{textAlign:"center",fontSize:"20px"}},e.createElement("div",{className:"yt-byob-stepper-steps",style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"center"}},Array.from({length:o}).map((c,s)=>{const p=s+1,m=r[s].minimumQuantity-(a[s]?.length??0)===0,u=s===t;return l="black"===l?"#000000":l,e.createElement(e.Fragment,{key:p},e.createElement("div",{className:"yt-byob-stepper-step-wrapper",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:"pointer",gap:i?"4px":"8px"},onClick:()=>!1===d?()=>{}:n(p-1)},e.createElement("div",{className:"yt-byob-stepper-step-number",style:{fontSize:"14px"}},"Step ",p),e.createElement("div",{className:"yt-byob-stepper-step-bar",style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"center",cursor:"pointer"}},e.createElement("div",{className:"yt-byob-stepper-step-left-bar",style:{height:"3px",width:i?"30px":"50px",backgroundColor:m?l:u?"#666666":"#CBD5E0",display:"block",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px"}}),e.createElement("div",{className:"yt-byob-stepper-step-circle",style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:m?`${l}50`:"white",border:`2px solid ${m?l:u?"#666666":"#CBD5E0"}`,display:"flex",alignItems:"center",justifyContent:"center"}}),e.createElement("div",{className:"yt-byob-stepper-step-right-bar",style:{height:"3px",width:i?"30px":"50px",backgroundColor:m?l:u?"#666666":"#CBD5E0",display:"block",marginRight:s<o?i?"4px":"6px":"",borderTopRightRadius:"5px",borderBottomRightRadius:"5px"}}))))})),e.createElement("div",{className:"yt-byob-stepper-title",style:{margin:i?"16px 0px":"15px 0px",fontSize:i?"16px":"18px",padding:"4px",background:"rgba(0, 0, 0, 0.03)",borderBottom:"1px solid rgba(130, 130, 130, 0.28)"}},r[t]?.title)),Gc=({styles:t,isMobile:n,categories:o,activeCategory:r,onCategoryChange:i})=>{const a=e=>{i(e)},l=(e,t)=>{const n=e.replace("#","");return`rgba(${parseInt(n.substring(0,2),16)}, ${parseInt(n.substring(2,4),16)}, ${parseInt(n.substring(4,6),16)}, ${t})`};return"tabs"===t?.byob?.categoryFilterOnPage?e.createElement("div",{className:"yt-byob-category-filter-wrapper",style:{overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",width:"100%"}},e.createElement("div",{className:"yt-byob-category-tabs-container",style:{display:"flex",gap:"0px",minWidth:"max-content",paddingBottom:"1px",flexWrap:"nowrap",justifyContent:"center",borderBottom:"1px solid #e0e0e0",width:"auto",height:n?"28px":"45px"}},["All",...o].map(o=>{const i=r===o;return e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-byob-category-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:i?"600":"400",color:i?t.general.primaryColor:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:i?l(t.general.primaryColor,.07):"transparent",borderBottom:i?`2px solid ${t?.general.primaryColor}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:e=>{i||(e.currentTarget.style.color=t?.general.primaryColor)},onMouseLeave:e=>{i||(e.currentTarget.style.color="#666")}},e.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},o.charAt(0).toUpperCase()+o.slice(1)),e.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},o.charAt(0).toUpperCase()+o.slice(1)))}))):e.createElement("div",{className:"yt-byob-category-filter-wrapper",style:{overflowX:n?"auto":"visible",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",paddingBottom:"5px"}},e.createElement("div",{className:"yt-byob-category-buttons-container",style:{display:"flex",gap:"8px",minWidth:"max-content",flexWrap:"nowrap",justifyContent:"center",paddingRight:n?"10px":"0px"}},["All",...o].map(o=>e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-byob-category-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${r===o?t?.general.primaryColor:"#e0e0e0"}`,borderRadius:t?.general.ctaBorderRadius,backgroundColor:r===o?t?.general.primaryColor:"white",color:r===o?"white":"#333",cursor:"pointer",transition:"all 0.3s ease",outline:"none",whiteSpace:"nowrap",minWidth:"fit-content",flexShrink:0},onMouseEnter:e=>{r!==o&&(e.currentTarget.style.borderColor=t?.general.primaryColor,e.currentTarget.style.color=t?.general.primaryColor)},onMouseLeave:e=>{r!==o&&(e.currentTarget.style.borderColor="#e0e0e0",e.currentTarget.style.color="#333")}},o.charAt(0).toUpperCase()+o.slice(1)))))},Xc=(e,t)=>{const n=[],o=e=>!t||0===t.length||t.includes(e);let r=0,i=0;e.forEach(e=>{const t=e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id)),n=t?.some(e=>e.node.availableForSale);n?r++:i++}),o("Availability")&&n.push({id:"filter.v.availability",label:"Availability",type:"LIST",values:[{id:"filter.v.availability.1",label:"In stock",count:r,input:'{"available":true}'},{id:"filter.v.availability.0",label:"Out of stock",count:i,input:'{"available":false}'}]});let a=0;e.forEach(e=>{const t=e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id));t?.forEach(e=>{const t=parseFloat(e.node.price);t>a&&(a=t)})}),o("Price")&&n.push({id:"filter.v.price",label:"Price",type:"PRICE_RANGE",values:[{id:"filter.v.price",label:"Price",count:e.length,input:JSON.stringify({price:{min:0,max:a}})}]});const l={};e.forEach(e=>{const t=e.productDetails.productType;t&&(l[t]=(l[t]||0)+1)}),Object.keys(l).length>0&&o("Product Type")&&n.push({id:"filter.p.product_type",label:"Product Type",type:"LIST",values:Object.entries(l).map(([e,t])=>({id:`filter.p.product_type.${e}`,label:e,count:t,input:JSON.stringify({productType:e})}))});const c={};e.forEach(e=>{const t=e.productDetails.vendor;t&&(c[t]=(c[t]||0)+1)}),Object.keys(c).length>0&&o("Vendor")&&n.push({id:"filter.p.vendor",label:"Vendor",type:"LIST",values:Object.entries(c).map(([e,t])=>({id:`filter.p.vendor.${e}`,label:e,count:t,input:JSON.stringify({vendor:e})}))});const d={};e.forEach(e=>{e.productDetails.tags?.forEach(e=>{e&&(d[e]=(d[e]||0)+1)})}),Object.keys(d).length>0&&o("Tags")&&n.push({id:"filter.p.tag",label:"Tag",type:"LIST",values:Object.entries(d).map(([e,t])=>({id:`filter.p.tag.${e}`,label:e,count:t,input:JSON.stringify({tag:e})}))});const s={};return e.forEach(e=>{(e.productDetails.options||[]).forEach((t,n)=>{if("Title"===t.name)return;s[t.name]||(s[t.name]={});const o=e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id))||[];t.values?.forEach(e=>{void 0===s[t.name][e]&&(s[t.name][e]=0);o.some(t=>(t.node.title.split(" / ")[n]||t.node.title).toLowerCase()===e.toLowerCase())&&s[t.name][e]++})})}),o("Variant Options")&&Object.entries(s).forEach(([e,t])=>{const o=Object.entries(t).filter(([e,t])=>t>0).map(([t,n])=>({id:`${e.toLowerCase()}.${t}`,label:t,count:n,input:JSON.stringify({variantOption:{name:e,value:t}})}));o.length>0&&n.push({id:`filter.v.option.${e.toLowerCase()}`,label:e,type:"LIST",values:o})}),n},Zc=({bundle:a,selectedItems:l,setSelectedItems:c,handleAddToCart:d,bundleAddToCartLoading:s,renderingOnPage:p,selectedItemsQuantity:m,handleRemoveItem:u,bundleSubtotal:g,dispatchAnalyticsEvent:x,fetchStoreDetails:f})=>{const[y,b]=t(void 0),[h,v]=t(window.innerWidth<450),[w,C]=t(0),[E,k]=t({}),T=a.builderTiers?.type,S=a.customizations,$=a.builderTiers?.productTier??[],B=a.builderTiers?.offerTier??[],[I,z]=t([]),[N,F]=t(!1),[P,D]=t("All"),[A,_]=t(0),R=r(null),[O,L]=t({}),[j,M]=t([]),[V,W]=t(!1),[H,q]=t(0),[Q,U]=t(0),[Y,G]=t({}),X=e=>{G(t=>{const n=!1!==t[e];return{...t,[e]:!n}})};n(()=>{j.length>0&&G(e=>{const t={...e};return j.forEach(e=>{void 0===t[e.id]&&(t[e.id]=!1)}),t})},[j]);const Z=a.customStoreDetails?.fixedInventoryDetails;n(()=>{const e=new Set;let t=!1;a?.products?.forEach(n=>{const o=n.productDetails;if(o.metafield&&"yourtoken_bundles_app"===o.metafield.namespace&&"categories"===o.metafield.key){let n=[];if(o.metafield.jsonValue&&Array.isArray(o.metafield.jsonValue))n=o.metafield.jsonValue;else if(o.metafield.value)try{const e=JSON.parse(o.metafield.value);Array.isArray(e)&&(n=e)}catch(e){console.error("Failed to parse categories:",e)}n.length>0&&(t=!0,n.forEach(t=>e.add(t)))}}),z(Array.from(e)),F(t);S?.byob?.productFiltersDisplay&&"none"!==S?.byob?.productFiltersDisplay&&(async()=>{const e=S?.byob?.filtersProvider??"products-data",t=S?.byob?.selectedFilterOptions;if("search-and-discovery-app-sync"===e)try{const e=await(f?.());e?.productFilters&&M(e.productFilters??[])}catch(e){M(Xc(a.products,t))}else M(Xc(a.products,t))})()},[a.products,S?.byob,f]),n(()=>{L({})},[w,P]);const K=((e,t)=>"All"===t?e:e.filter(e=>{const n=e.productDetails;if(n.metafield&&"yourtoken_bundles_app"===n.metafield.namespace&&"categories"===n.metafield.key){let e=[];if(n.metafield.jsonValue&&Array.isArray(n.metafield.jsonValue))e=n.metafield.jsonValue;else if(n.metafield.value)try{const t=JSON.parse(n.metafield.value);Array.isArray(t)&&(e=t)}catch(e){console.error("Failed to parse categories:",e)}return e.includes(t)}return!1}))(a.products.filter(e=>"active"===e.productDetails.status?.toLowerCase()||"unlisted"===e.productDetails.status?.toLowerCase()||void 0===e.productDetails.status||""===e.productDetails.status),P),ee="productTier"===T?$.reduce((e,t)=>e+t.minimumQuantity,0):"offerTier"===T?B.reduce((e,t)=>e+t.minimumQuantity,0):a.minimumQuantity,te=i((e,t)=>{const n=Z?.find(e=>e.variantId===t)?.quantity;if(void 0!==n)return n;const o=(e.variants?.edges||[]).find(e=>e.node.id===t),r=o?.node;return r?e.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?1/0:0:1/0:0},[Z]),[ne,oe]=t(3e3);n(()=>{let e=0;a.products.forEach(t=>{const n=Number(t.productDetails.variants?.edges?.[0]?.node?.price||0);n>e&&(e=n)}),oe(100*Math.ceil(e/100)||5e3)},[a.products]);const[re,ie]=t(""),[ae,le]=t(""),ce=((e,t)=>e.filter(e=>e?.productDetails?.title?.toLowerCase().includes(t?.toLowerCase())))(K,re),de=((e,t)=>[...e].sort((e,n)=>{const o=e?.productDetails?.title?.toLowerCase(),r=n?.productDetails?.title?.toLowerCase(),i=parseFloat(e?.productDetails?.variants?.edges?.[0]?.node?.price||"0"),a=parseFloat(n?.productDetails?.variants?.edges?.[0]?.node?.price||"0");switch(t){case"title-asc":return o.localeCompare(r);case"title-desc":return r.localeCompare(o);case"price-low-to-high":return i-a;case"price-high-to-low":return a-i;default:return 0}}))(ce,ae),se=de.filter(e=>((e,t,n,o)=>{if(0===Object.keys(t).length)return!0;for(const[r,i]of Object.entries(t)){if(0===i.length)continue;const a=n.find(e=>e.id===r);if(!a)continue;let l=!1;if("filter.v.price"===r){const n=t[r][0];if(!n)continue;const[o,i]=n.split("-"),a=parseFloat(o.replace("min:",""))||0,c="max:∞"===i?1/0:parseFloat(i.replace("max:",""))||1/0;(e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id))||[]).some(e=>{const t=Number(e.node.price||0);return t>=a&&t<=c})&&(l=!0)}else for(const t of i){const n=a.values.find(e=>e.id===t);if(n)try{const t=JSON.parse(n.input);if(void 0!==t.available){const n=e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id))||[];if(!0===t.available){if(n.some(t=>o(e.productDetails,t.node.id)>0)){l=!0;break}}else if(!1===t.available&&n.every(t=>0===o(e.productDetails,t.node.id))){l=!0;break}}else if(t.productType){if(e.productDetails.productType===t.productType){l=!0;break}}else if(t.vendor){if(e.productDetails.vendor===t.vendor){l=!0;break}}else if(t.tag){if(e.productDetails.tags?.includes(t.tag)){l=!0;break}}else if(t.variantOption){const{name:n,value:o}=t.variantOption,r=e.productDetails.options?.findIndex(e=>e.name===n);if(void 0!==r&&-1!==r){if((e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id))||[]).some(e=>{const t=(e.node.title||"").split(" / ")[r]||e.node.title;return t?.toLowerCase()===o.toLowerCase()})){l=!0;break}}}}catch(e){console.warn("Bad filter input",n.input)}}if(!l)return!1}return!0})(e,O,j,te)),pe=((e,t,n,o,r)=>(e[r]?.products.filter(e=>t.some(t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0]))&&t?.productDetails.title.toLowerCase().includes(n?.toLowerCase())))||[]).sort((e,n)=>{let r=t.find(t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0]))),i=t.find(e=>e.productId===n.productId&&(n.variantIds.length<1||e.variantIds.includes(n.variantIds[0])));if(!r||!i)return 0;const a=r.productDetails?.title?.toLowerCase(),l=i.productDetails?.title?.toLowerCase(),c=parseFloat(r?.productDetails?.variants?.edges?.[0]?.node?.price||"0"),d=parseFloat(i?.productDetails?.variants?.edges?.[0]?.node?.price||"0");switch(o){case"title-asc":return a.localeCompare(l);case"title-desc":return l.localeCompare(a);case"price-low-to-high":return c-d;case"price-high-to-low":return d-c;default:return 0}}))($,se,re,ae,w);n(()=>{console.log("appliedFilters",O)},[O]),n(()=>{console.log("appfilteredByShopifyFilters",se)},[se]);const[me,ue]=J(Nc),[ge,xe]=t(!1),fe="productTier"===T?pe:se,ye=fe.slice(0,20*(A+1));n(()=>{x?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:a?._id,bundleType:"byob-page-bundle",byobBundleType:a.builderTiers?.type??"builder"}}),setTimeout(()=>{xe(!0)},100)},[]);const be=r(null);n(()=>{const e=()=>{v(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{if(a.coverImageUrl){const e=new Image;e.src=Dp(a.coverImageUrl)??"",e.onload=()=>{b(e.width/e.height)}}},[a.coverImageUrl]),n(()=>{xe(!1),setTimeout(()=>xe(!0),100)},[w]);const he=(e,t)=>{if("productTier"===T){let n={...E},o=!1;if(n[t]){const r=n[t].indexOf(e);-1!==r&&(n[t]=[...n[t]],n[t].splice(r,1),o=!0)}if(!o)for(let t=$.length;t>=0;t--){const o=n[t].indexOf(e);if(-1!==o){n[t]=[...n[t]],n[t].splice(o,1);break}}k(n);const r=$.findIndex((e,t)=>n[t]?.length<e.minimumQuantity);-1!==r&&C(r)}u(e)},ve=()=>{const e=document.querySelector(".products-display");e&&e.scrollIntoView({behavior:"smooth"})};n(()=>{if("productTier"===T){const e=Object.fromEntries($.map(e=>[e.tier,[]]));k(e)}},[a]),n(()=>{if("productTier"!==T||!$[w])return;if(ee===m)return;const e=$.findIndex((e,t)=>{const n=E[t]||[];return t>=w&&n.length<e.minimumQuantity});-1!==e&&e!==w&&(C(e),ve())},[E,$,T]),n(()=>{ie("")},[w]),n(()=>{function e(e){if(!be.current||!e.target)return;!be.current.contains(e.target)&&ue(void 0)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const we=(e,t,n)=>{var o;"productTier"===T&&(o=e,k(e=>{const t={...e},n=$.findIndex((e,n)=>{const o=t[n]||[];return n>=w&&o.length<e.minimumQuantity});return-1!==n&&C(n),t[n]||(t[n]=[]),t[n].push(o),t}));const r=!0===$[w]?.isFreebieTier;x?.({eventNameCustom:"byob_add_to_bundle",eventTypeCustom:"clicks",data:{bundleId:a._id,bundleType:"byob-page-bundle",byobBundleType:a.builderTiers?.type??"builder",addedProduct:{id:t?.id,title:t?.title}}}),Ap(e,t,n,l,c,r)},Ce=(()=>{if(!a?.builderTiers)return a.minimumQuantity;const{type:e,offerTier:t,productTier:n}=a.builderTiers,o="offerTier"===e?t:"productTier"===e?n:null;if(!o)return a.minimumQuantity;let r=0;return o.map(e=>{r+=e.minimumQuantity}),r})(),Ee=h&&a.mobileCoverImageUrl?Dp(a.mobileCoverImageUrl):Dp(a.coverImageUrl??"")||null,ke=i(e=>{const t=S?.general?.showOutOfStockProducts;if(t)return!0;const n=e.productDetails,o=n?.variants?.edges||[];if(Z){if(o.some(e=>Z.some(t=>t.variantId===e.node.id&&t.quantity>0)))return!0}return o.some(e=>te(n,e.node.id)>0)},[S?.general?.showOutOfStockProducts,Z,te]);n(()=>{if("productTier"!==T)return;const e=$[w];if(!e)return;if(1!==e.minimumQuantity)return;if(1!==e.products.length)return;const t=e.products[0],n=a.products.find(e=>e.productId===t.productId)?.productDetails;if(!n)return;if(n.variants?.edges?.length>1)return;const o=n.variants?.edges?.find(e=>te(n,e.node.id)>0)?.node;if(!o)return;const r=o.id,i=E[w]?.includes(r);i||(we(r,n,1),w<$.length-1&&(C(w+1),ve()))},[T,$,w,a.products,E,te,we]);const Te=o(()=>K.filter(e=>{const t=e.productDetails;return(t.variants?.edges||[]).some(e=>te(t,e.node.id)>0)}).length,[K,te]),Se=o(()=>K.length-Te,[K,Te]),$e="bundles"==a.appName?a.pageHeader?.title:a?.title,Be="bundles"==a.appName?a.pageHeader?.description:a?.subtitle;n(()=>{_(0)},[re,ae,P,w,O]);const Ie=i(()=>{ye.length<fe.length&&_(e=>e+1)},[ye.length,fe.length]);n(()=>{const e=new IntersectionObserver(([e])=>{e.isIntersecting&&Ie()},{threshold:.1});return R.current&&e.observe(R.current),()=>{R.current&&e.unobserve(R.current)}},[Ie]);const ze=()=>{x?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:a._id,bundleType:"byob-page-bundle",byobBundleType:a.builderTiers?.type??"builder",selectedProducts:l.map(e=>({id:e?.product?.id,title:e?.product?.title,quantity:e?.quantity}))}})};return e.createElement(e.Fragment,null,e.createElement("div",{style:{display:"flex",flexDirection:"column",width:"100%",alignItems:"center",justifyContent:"center",rowGap:"15px",padding:"20px 0px",marginBottom:"20px",backgroundColor:S.byob.sectionBackgroundColor,..."transparent"!==S.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},Ee?e.createElement("div",{style:{position:"relative",width:"100%",display:"flex",justifyContent:"center",alignItems:"center",textAlign:"center",overflow:"hidden",...a?.coverImageVerticalMargin&&{marginBottom:a?.coverImageVerticalMargin,marginTop:a?.coverImageVerticalMargin}}},Ee&&e.createElement(Lc,{coverImageUrl:Ee,alt:"Background",styles:{width:"100%",height:"auto",display:"block"}}),e.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",width:"90%",maxWidth:"1000px",textShadow:"2px 2px 8px rgba(0, 0, 0, 0.4)"}},e.createElement("span",{style:{lineHeight:"normal",fontSize:S?.byob?.titleFontSize??"3rem",fontWeight:"700",color:S?.byob?.titleTextColor??"#000",marginBottom:"15px",backgroundColor:S?.byob?.titleBackgroundColor??"transparent",width:"100%",textAlign:"center"},className:"bundle-builder-title"},$e),e.createElement("span",{style:{lineHeight:"normal",fontSize:S?.byob?.subtitleFontSize??"1.5rem",color:S?.byob?.titleTextColor??"#000"},className:"bundle-builder-subtitle"},Be))):($e||Be)&&e.createElement("div",{style:{zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",width:"90%",maxWidth:"1000px"}},$e&&e.createElement("span",{style:{lineHeight:"normal",fontSize:S?.byob?.titleFontSize??"3rem",fontWeight:"700",color:S?.byob?.titleTextColor??"#000",marginBottom:"15px",textAlign:"center",width:"100%",backgroundColor:S?.byob?.titleBackgroundColor??"transparent"}},$e),Be&&e.createElement("span",{style:{lineHeight:"normal",fontSize:S?.byob?.subtitleFontSize??"1.5rem",color:S?.byob?.titleTextColor??"#000"}},Be)),e.createElement("div",{style:{fontSize:"20px",width:"100%"},className:"products-display"},"productTier"===T&&$.length>0&&S?.byob.productTiersVisibility&&e.createElement(e.Fragment,null,e.createElement("div",null,e.createElement(Yc,{currentStep:w,totalSteps:$.length,tiers:$,isMobile:h,primaryColor:S?.general?.primaryColor,primaryTextColorCta:S?.general?.primaryContrastColor,setCurrentProductTier:C,selectedProductsByTier:E,tierNavigation:S.byob.tierNavigation})))),e.createElement("div",{style:{display:"flex",flexDirection:"row",width:h?"100%":"90%",marginInline:"auto"}},"sidebar"===S?.byob?.productFiltersDisplay&&!h&&e.createElement(Wc,{showFiltersDrawer:V,handleClose:()=>W(!1),isAnimating:!1,isMobile:!1,availableFilters:j,appliedFilters:O,toggleFilter:(e,t)=>{L(n=>{const o=n[e]||[],r=o.includes(t)?o.filter(e=>e!==t):[...o,t],i={...n,[e]:r.length?r:void 0};return Object.fromEntries(Object.entries(i).filter(([,e])=>void 0!==e))})},clearAllFilters:()=>{L({}),U(0),q(ne)},applyPriceFilter:()=>{L(e=>{const t={...e};return t["filter.v.price"]=[`min:${Q}-max:${H}`],t})},priceMin:Q,setPriceMin:U,priceMax:H,setPriceMax:q,maxPossiblePrice:ne,styles:S,products:a.products,unavailableProductCount:Se,storeCurrencyCode:a?.storeCurrencyCode,openSections:Y,toggleSection:X}),e.createElement("div",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0}},e.createElement("div",{style:{width:"100%",marginBottom:"20px",display:"flex",flexDirection:"column",gap:"20px"}},e.createElement(Hc,{enableSortAndFilter:a?.enableSortAndFilter??!1,isMobile:h,searchTerm:re,setSearchTerm:ie,setSortBy:le,styles:S,appliedFilters:O,setAppliedFilters:L,availableFilters:j,products:a.products,availableProductCount:Te,unavailableProductCount:Se,maxPossiblePrice:ne,storeCurrencyCode:a?.storeCurrencyCode,sharedFiltersState:{showFilters:V,setShowFilters:W,priceMax:H,setPriceMax:q,priceMin:Q,setPriceMin:U},openSections:Y,toggleSection:X}),a?.customizations?.byob?.enableProductCategories&&N&&e.createElement("div",null,e.createElement(Gc,{styles:S,isMobile:h,categories:I,activeCategory:P,onCategoryChange:e=>{D(e)}}))),e.createElement("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"12px",justifyContent:V&&"sidebar"===S?.byob?.productFiltersDisplay?"flex-start":"center",width:"100%",height:"fit-content",paddingBottom:p?"100px":"20px"},className:"products-display"},0===fe?.length?e.createElement("p",{style:{fontSize:"20px",color:"#333",textAlign:"center",width:"100%"}},"No products found"):"productTier"===T&&$.length>0?ye.filter(e=>ke(se.find(t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0]))))).map((t,n)=>{const o=($[w]?.minimumQuantity??0)>(E[w]?.length??0),r=se.find(e=>e.productId===t.productId&&(t.variantIds.length<1||e.variantIds.includes(t.variantIds[0])));return r?e.createElement(Uc,{bundle:a,idx:n,key:t?.variantIds?.[0]??t.productId,product:r?.productDetails,handleAddToBundle:we,hideAddToBundle:!o,remainingQuantity:Ce-m,themeColor:a?.dealTextColor,handleRemoveItem:e=>he(e,w),selecteditems:l,transitionActive:ge,customVariantsQuantity:Z,currentProductTier:$[w],showFreebieTierProductPrices:a?.customStoreDetails?.showFreebieTierProductPrices}):null}):ye.filter(ke).map((t,n)=>e.createElement(Uc,{bundle:a,idx:n,key:t.productId,product:t?.productDetails,handleAddToBundle:we,hideAddToBundle:m>=Ce,remainingQuantity:Ce-m,themeColor:a?.dealTextColor,handleRemoveItem:u,selecteditems:l,transitionActive:ge,customVariantsQuantity:Z})),ye.length<fe.length&&e.createElement("div",{ref:R,style:{height:"1px",width:"100%",display:"block"}})),!p&&e.createElement(zc,{builderTiers:a?.builderTiers,handleAddToCart:async e=>{await d(e),ze()},minimumQuantity:ee,selectedProducts:l,showProductDetailsInTracker:a.showProductDetailsInTracker,handleRemoveItem:u,handleRemoveItemProductTier:he,selectedItemsQuantity:m,percentageOff:a.percentageOff,loading:s,bundleSubtotal:g,amountOff:a.amountOff,styles:a.customizations,dealAmount:a.dealAmount,themeColor:a?.dealTextColor??"#333",primaryTextColorCta:a?.primaryTextColorCta??"#fff",cornerRadiusType:a?.cornerRadiusType??"",selectedProductsByTier:E,renderingOnPage:p}),p&&e.createElement("div",{style:{width:"100%",marginTop:"20px",position:"sticky",bottom:"10px",zIndex:999}},e.createElement(zc,{handleAddToCart:async e=>{await d(e),ze()},minimumQuantity:ee,builderTiers:a?.builderTiers,selectedProducts:l,showProductDetailsInTracker:a.showProductDetailsInTracker,loading:s,handleRemoveItem:u,handleRemoveItemProductTier:he,percentageOff:a.percentageOff,selectedItemsQuantity:m??0,bundleSubtotal:g??{price:0,compareAtPrice:0},amountOff:a.amountOff,styles:a.customizations,dealAmount:a.dealAmount,themeColor:S?.general.primaryColor||"#000",primaryTextColorCta:S.general.primaryContrastColor??"#fff",cornerRadiusType:a?.cornerRadiusType??"",selectedProductsByTier:E,renderingOnPage:p})))),me&&void 0!==m&&(()=>{let t=m<a.minimumQuantity;return"productTier"==T?t=($[w]?.minimumQuantity??0)>(E[w]?.length??0):"offerTier"==T&&(t=m<B.reduce((e,t)=>e+t.minimumQuantity,0)),e.createElement(_c,{handleAddToBundle:we,ref:be,remainingQuantity:a.minimumQuantity-m,hideAddToBundle:!t,disableQuantitySelector:a?.disableQuantitySelector??!1,selectedProducts:l,selectedProductsByTier:E,themeColor:S?.general.primaryColor||"#000",primaryTextColorCta:a?.customizations?.general.primaryContrastColor??"#fff",primaryBackgroundColorCta:S?.general.primaryColor||"#000",cornerRadius:a?.customizations.byob.borderRadius,styles:a.customizations,reviewRatingType:a?.reviewRatingType??"none",customVariantsQuantity:Z,bundleProductsCustomQuantity:a?.customProductsQuantity,isFreebieTier:$?.[w]?.isFreebieTier,showFreebieTierProductPrices:a?.customStoreDetails?.showFreebieTierProductPrices})})()))},Jc=({product:t,selectedVariantId:n,onVariantChange:r,styles:i,originalPrice:a,dealPrice:l,isVertical:c=!1,variantOptions:d,storeCurrencyCode:s})=>{const p=o(()=>e=>{const n=t?.productDetails?.variants?.edges?.find(t=>t.node.id===e),o=n?.node;return o?t.productDetails.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?1/0:0:1/0:0},[t.productDetails]),m=t?.productDetails?.variants?.edges?.find(e=>e?.node?.id===n)?.node;p(n);const u=o(()=>{if(m?.title&&t.productDetails.options){const e=m.title.split(" / ");if(e.length===t.productDetails.options.length)return e}return t.productDetails.options?.map(e=>e.values[0])||[]},[m,t.productDetails.options]),g=e=>{r(e)};return c?e.createElement("div",{className:"yt-comboBundle-product-card-vertical",style:{display:"flex",flexDirection:"column",alignItems:"center",lineHeight:"normal",width:"165px",backgroundColor:"#F6F6F6",borderRadius:"20px",border:"1px solid #B3B3B3",boxShadow:"4px 4px 0px -1px #00000033",overflow:"hidden"}},e.createElement("div",{className:"yt-comboBundle-product-card-image-container-vertical",style:{position:"relative",width:"100%"}},i.comboBundle.subProductsImageVisibility&&e.createElement(e.Fragment,null,e.createElement("img",{className:"yt-comboBundle-product-image-vertical",src:Dp(m?.image?.url||t?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg"),alt:t?.productDetails?.featuredMedia?.alt,width:165,height:165,style:{objectFit:"cover",borderRadius:"20px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",height:"100%",aspectRatio:i.general?.imageAspectRatio||"1/1"}}),e.createElement("div",{className:"yt-comboBundle-product-variant-selector-container-vertical",style:{marginTop:"8px",position:"absolute",bottom:"10px",left:"5px",right:"5px"}},t?.productDetails?.variants?.edges?.length>1&&e.createElement(e.Fragment,null,e.createElement("select",{className:"yt-comboBundle-product-variant-select-vertical",value:n,onChange:e=>g(e.target.value),style:{padding:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",width:"100%",appearance:"none",marginRight:"30px",fontSize:"12px",fontWeight:600}},t?.productDetails?.variants?.edges.map(t=>{const n=p(t?.node?.id);return e.createElement("option",{key:t?.node?.id,value:t?.node?.id,disabled:0===n,className:"yt-comboBundle-product-variant-option"},t?.node?.title)})),e.createElement("div",{className:"yt-comboBundle-product-variant-select-icon-vertical",style:{position:"absolute",right:"1px",top:"2px",bottom:"0px",pointerEvents:"none",backgroundColor:"#F3F3F3",width:"15%",height:"calc(100% - 4px)",display:"flex",justifyContent:"center",alignItems:"center"}},e.createElement(b,null)))))),(i.comboBundle.subProductsProductTitleVisibility||i.comboBundle.subProductsProductPriceVisibility)&&e.createElement("div",{className:"yt-comboBundle-product-info-container-vertical",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"40px",width:"100%",paddingBlock:"5px"}},i.comboBundle.subProductsProductTitleVisibility&&e.createElement("span",{className:"yt-comboBundle-product-title-vertical",style:{fontSize:"12px",color:"#333",fontWeight:"600",lineHeight:"normal",textAlign:"center",width:"fit-content"}},t?.productDetails?.title),i.comboBundle.subProductsProductPriceVisibility&&e.createElement("div",{className:"yt-comboBundle-product-price-container-vertical",style:{display:"flex",alignItems:"center",gap:"8px",lineHeight:"normal",fontSize:"14px"}},e.createElement("span",{className:"yt-comboBundle-product-deal-price-vertical",style:{lineHeight:"normal"}},Pp(i.general.currencySymbol,s),Fp((Number(m?.compareAtPrice?Number(m?.compareAtPrice):m?.price)/Number(a)*Number(l)).toFixed(2))),m?.compareAtPrice&&Number(m.compareAtPrice)>Number(m.price)&&e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},Pp(i.general.currencySymbol,s),m.compareAtPrice?Fp(m.compareAtPrice):Fp(m.price))))):e.createElement("div",{className:"yt-comboBundle-product-card-horizontal",style:{display:"flex",alignItems:"center",gap:"16px",padding:"4px",lineHeight:"normal",borderRadius:"8px",transition:"background-color 0.3s",width:"100%",border:"1px solid transparent",..."right"===i.comboBundle.infoAlignment&&{flexDirection:"row-reverse"},..."center"===i.comboBundle.infoAlignment&&{justifyContent:"center"}},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#fafafa",e.currentTarget.style.border="1px solid #DFDFDF"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent",e.currentTarget.style.border="1px solid transparent"}},i.comboBundle.subProductsImageVisibility&&e.createElement("div",{className:"yt-comboBundle-product-image-wrapper-horizontal"},e.createElement("img",{className:"yt-comboBundle-product-image-horizontal",src:Dp(m?.image?.url||t?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg"),alt:t?.productDetails?.featuredMedia?.alt,height:80,style:{objectFit:"cover",borderRadius:"10px",border:"1px solid #DEDEDE",aspectRatio:"1/1",width:"90px",height:"90px"}})),e.createElement("div",{className:"yt-comboBundle-product-info-horizontal",style:{display:"flex",flexDirection:"column",alignItems:"left"===i.comboBundle?.infoAlignment?"flex-start":"right"===i.comboBundle?.infoAlignment?"flex-end":"center"===i.comboBundle?.infoAlignment?"flex-start":void 0}},i.comboBundle.subProductsProductTitleVisibility&&e.createElement("span",{className:"yt-comboBundle-product-title-horizontal",style:{fontSize:"14px",fontWeight:"600",lineHeight:"normal",display:"flex",alignItems:"center",gap:"8px"}},e.createElement("span",{className:"yt-comboBundle-product-title-text"}," ",t?.productDetails?.title," "),"dropdown"!==i.comboBundle.comboVariantTypeSelector&&t.productDetails.variants.edges.length>1&&d&&u&&e.createElement("span",{className:"yt-comboBundle-product-variant-tag-horizontal",style:{fontSize:"10px",color:"#666",backgroundColor:"#F4F4F4",padding:"2px 8px",borderRadius:"10px",border:"1px solid #ddd"}},u.length>1?u.join(" / "):u)),i.comboBundle.subProductsProductPriceVisibility&&e.createElement("div",{className:"yt-comboBundle-product-price-wrapper-horizontal",style:{display:"flex",gap:"8px",marginTop:"5px",alignItems:"baseline"}},e.createElement("span",{className:"yt-comboBundle-product-deal-price-horizontal",style:{lineHeight:"normal"}},Pp(i.general.currencySymbol,s),Fp((Number(m?.compareAtPrice?Number(m?.compareAtPrice):m?.price)/Number(a)*Number(l)).toFixed(2))),m?.compareAtPrice&&Number(m.compareAtPrice)>Number(m.price)&&e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},Pp(i.general.currencySymbol,s),Fp(m?.compareAtPrice?m?.compareAtPrice:m?.price))),t.productDetails.variants.edges.length>1&&("dropdown"===i.comboBundle.comboVariantTypeSelector?e.createElement("div",{className:"yt-comboBundle-product-variant-dropdown-horizontal",style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},e.createElement("select",{className:"yt-comboBundle-product-variant-select-horizontal",value:n,onChange:e=>g(e.target.value),style:{padding:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",fontSize:"12px",fontWeight:600,borderRadius:"4px"}},t.productDetails.variants.edges.map(t=>{const n=p(t?.node?.id);return e.createElement("option",{key:t?.node?.id,value:t?.node?.id,disabled:0===n,className:"yt-comboBundle-product-variant-option"},t?.node?.title)})),e.createElement("div",{className:"yt-comboBundle-product-variant-select-icon-horizontal",style:{position:"absolute",right:"1px",top:"2px",bottom:"0px",pointerEvents:"none",backgroundColor:"#F3F3F3",width:"15%",height:"calc(100% - 4px)",display:"flex",justifyContent:"center",alignItems:"center"}},e.createElement(b,null))):t.productDetails.options.length>0?e.createElement(e.Fragment,null,t.productDetails.options.map((n,o)=>e.createElement("div",{key:n.name,className:"yt-comboBundle-product-option-group-horizontal",style:{...n?.values?.length>1&&{marginTop:"10px"},display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"}},t.productDetails.options.length>1&&n?.values?.length>1&&e.createElement("label",{className:"yt-comboBundle-product-option-label",style:{fontSize:"12px",fontWeight:"500",color:"#333"}},n.name,":"),n?.values?.length>1&&e.createElement("div",{className:"yt-comboBundle-product-option-values-horizontal",style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"}},n.values.map(r=>{const a=[...u];a[o]=r;const l=t.productDetails.options.length>0?a.join(" / "):a[o],c=t.productDetails.variants.edges.find(e=>e.node.title===l)?.node,s=0===(c?p(c.id):0),m=u[o]===r,x=d&&d?.options?.find(e=>e.name===n.name);return x&&"color"===x?.type?e.createElement("button",{key:r,className:`yt-comboBundle-product-option-button-color ${m?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&g(c.id)},disabled:s,style:{borderRadius:"50%",padding:"1px",backgroundColor:"white",border:m&&!s?`1px solid ${i.general?.ctaBackgroundColor}`:"1px solid transparent",opacity:s?.5:1,cursor:s?"not-allowed":"pointer"}},x?.values.find(e=>e.name===r)?.value?e.createElement("div",{className:"yt-comboBundle-product-option-color-swatch",style:{width:m&&!s?"26px":"24px",height:m&&!s?"26px":"24px",borderRadius:"50%",backgroundColor:x?.values.find(e=>e.name===r)?.value}},e.createElement("span",null)):e.createElement("span",{key:r,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:m&&!s?`1px solid ${i.general?.ctaBackgroundColor}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:m&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},r)):x&&"image"===x?.type?e.createElement("button",{key:r,className:`yt-comboBundle-product-option-button-image ${m?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&g(c.id)},disabled:s,style:{border:m&&!s?`1px solid ${i.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:m&&!s?"#F7F7F7":"transparent",cursor:s?"not-allowed":"pointer",padding:"0px",width:m&&!s?"26px":"24px",height:m&&!s?"26px":"24px",overflow:"hidden",opacity:s?.5:1}},x?.values.find(e=>e.name===r)?.value?e.createElement("img",{className:"yt-comboBundle-product-option-image",src:Dp(x?.values.find(e=>e.name===r)?.value||"/placeholder.svg"),alt:r,style:{width:m&&!s?"26px":"24px",height:m&&!s?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}}):e.createElement("span",{key:r,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:m&&!s?`1px solid ${i.general?.ctaBackgroundColor}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:m&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},r)):e.createElement("button",{key:r,className:`yt-comboBundle-product-option-button-text ${m?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&g(c.id)},disabled:s,style:{padding:"4px 8px",border:m&&!s?`1px solid ${i.general?.ctaBackgroundColor}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:m&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",cursor:s?"not-allowed":"pointer",fontSize:"10px",fontWeight:"600",opacity:s?.5:1}},r)}))))):e.createElement(e.Fragment,null,t?.productDetails?.variants?.edges?.length>1&&e.createElement("div",{className:"yt-comboBundle-product-variant-buttons-horizontal",style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},t?.productDetails?.variants?.edges.map(t=>{const o=0===p(t?.node?.id);return e.createElement("button",{key:t?.node?.id,className:`yt-comboBundle-product-variant-button ${n===t?.node?.id?"yt-comboBundle-product-variant-button-selected":""} ${o?"yt-comboBundle-product-variant-button-disabled":""}`,onClick:()=>g(t?.node?.id),disabled:o,style:{padding:"4px 8px",border:n===t?.node?.id?`1px solid ${i.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:n===t?.node?.id?"#F7F7F7":"transparent",color:o?"#ccc":"#707070",cursor:o?"not-allowed":"pointer",fontSize:"12px",fontWeight:"500",opacity:o?.5:1}},t?.node?.title)}))))))},Kc=({bundle:r,addToCartFunction:i,dispatchAnalyticsEvent:a})=>{const[l,c]=t(!1),[d,s]=t(window.innerWidth<786),p=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?1/0:0:1/0:0},[]),[m,u]=t(()=>{const e={};return r.products.forEach((t,n)=>{const o=t.productDetails?.variants?.edges?.find(e=>p(t.productDetails,e?.node?.id)>0)?.node;e[n]=o?o.id:t?.productDetails?.variants?.edges[0]?.node?.id}),e});n(()=>(i&&(window.ytComboBundle={bundle:r,addToCart:i,selectedVariants:m},window.dispatchEvent(new CustomEvent("yt-combo-bundle-updated",{detail:window.ytComboBundle}))),()=>{window.ytComboBundle=void 0,window.dispatchEvent(new CustomEvent("yt-combo-bundle-updated",{detail:void 0}))}),[r,i,m]);const g=r.products?.every((e,t)=>{const n=m[t];return p(e.productDetails,n)>0}),x=(e,t)=>{u(n=>({...n,[e]:t}))},{originalPrice:f,dealPrice:y,offerValue:b}=o(()=>{const{price:e,compareAtPrice:t}=Object.entries(m).reduce((e,[t,n])=>{const o=r.products[parseInt(t)],i=o.productDetails.variants.edges?.find(e=>e.node.id===n)?.node,a=parseFloat(i?.price??"0"),l=parseFloat(i?.compareAtPrice||a.toString());return e.price+=a,e.compareAtPrice+=l,e},{price:0,compareAtPrice:0}),n=Math.max(e,t);let o=Math.min(e,t);r?.percentageOff?o=e*(1-r.percentageOff/100):r?.dealAmount?o=r.dealAmount:r?.amountOff&&(o=e-r.amountOff);const i=t-o;return{originalPrice:n.toFixed(2),dealPrice:o.toFixed(2),offerValue:i.toFixed(2)}},[m,r.products,r.percentageOff,r.dealAmount,r.amountOff]);n(()=>{a?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:r._id,bundleType:"combo-bundle"}});const e=()=>{s(window.innerWidth<786)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const h=r.customizations,v=h.comboBundle?.comboCardStyle||"auto",w="vertical"===v||"auto"===v&&!d,C=h.comboBundle?.embedContentVisibility,E="bundles"==r.appName?r.pageHeader?.title:r?.title,k="bundles"==r.appName?r.pageHeader?.description:r?.subtitle;return e.createElement("div",{className:`yt-comboBundle-bundle-container ${"left"===h.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-left":"right"===h.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-right":"center"===h.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-center":void 0}`,style:{lineHeight:"normal",maxWidth:"800px",marginBlock:h.comboBundle?.verticalMargin||"0px",display:"flex",flexDirection:"column",alignItems:"left"===h.comboBundle?.infoAlignment?"flex-start":"right"===h.comboBundle?.infoAlignment?"flex-end":"center"===h.comboBundle?.infoAlignment?"center":void 0,textAlign:h.comboBundle?.infoAlignment??"left",fontFamily:"system-ui, -apple-system, sans-serif"}},C&&h.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Title")&&e.createElement("div",{className:"yt-comboBundle-bundle-title-container",style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"10px"}},e.createElement("h2",{className:"yt-comboBundle-bundle-title",style:{fontSize:h.comboBundle?.productTitleFontSize||"28px",color:h.comboBundle?.titleTextColor||"#000",fontWeight:"bold",lineHeight:"1.6",margin:0}},E)),C&&h?.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Price")&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-comboBundle-bundle-price-container",style:{display:"flex",alignItems:"center",gap:"8px",color:h.comboBundle?.titleTextColor||"#000",fontSize:(parseInt(h.comboBundle?.productTitleFontSize?.replace("px",""))||28)-4+"px"}},e.createElement("div",{className:"yt-comboBundle-bundle-price-details",style:{display:"flex",alignItems:"center",gap:"5px",flexWrap:"wrap"}},e.createElement("span",{className:"yt-comboBundle-bundle-deal-price-text",style:{fontWeight:"bold",lineHeight:"1",minWidth:"fit-content"}},Pp(h.general.currencySymbol,r.storeCurrencyCode),Fp(y)),!isNaN(Number(f))&&!isNaN(Number(y))&&Number(f)>Number(y)&&e.createElement("div",{className:"yt-comboBundle-bundle-original-price-text",style:{color:h.comboBundle?.titleTextColor||"#666",textDecoration:"line-through",verticalAlign:"middle",display:"inline-block",minWidth:"fit-content"}},Pp(h.general.currencySymbol,r.storeCurrencyCode),Fp(f)),Number(b)>0&&e.createElement("span",{className:"yt-comboBundle-bundle-offer-badge",style:{backgroundColor:"#D3122A",color:"white",padding:"4px 8px",fontSize:"14px",borderRadius:"20px",fontWeight:"500",lineHeight:"1",minWidth:"fit-content"}},r?.percentageOff?`${r?.percentageOff}% Off`:r?.amountOff?`${Pp(h.general.currencySymbol,r.storeCurrencyCode)}${Fp(r?.amountOff)} Off`:`Save ${Pp(h.general.currencySymbol,r.storeCurrencyCode)}${Fp(b)}`))),e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",margin:"15px 0px"},className:"yt-comboBundle-checkoutSpecific-container"},e.createElement("div",{style:{display:"flex",width:"12px",height:"12px",justifyContent:"center",alignItems:"center",alignContent:"center",borderRadius:"50%",backgroundColor:h.general?.ctaBackgroundColor||"#1e1e1e",flexShrink:0},className:"yt-comboBundle-checkoutSpecific-dot"},e.createElement("span",null)),e.createElement("p",{style:{fontSize:h.comboBundle.productDescriptionFontSize||"16px",color:h.comboBundle?.descriptionTextColor||"#000",alignItems:"center",margin:0,lineHeight:"1.2"},className:"yt-comboBundle-checkoutSpecific-text"},"Tax included. ",e.createElement("u",null,"Shipping")," calculated at checkout."))),h.comboBundle.subProductsSectionVisibility&&e.createElement(e.Fragment,null,w?e.createElement("div",{className:"yt-comboBundle-products-grid-vertical "+(d?"yt-comboBundle-products-grid-mobile":""),style:{display:"flex",flexDirection:"row",gap:"20px",marginTop:"10px",flexWrap:"wrap"}},r.products.map((t,n)=>{const o=t?.productDetails?.variants?.edges?.find(e=>e?.node?.id===m[n])?.node;return o?e.createElement(Jc,{key:`combo-product-${n}-${t.productId}`,product:t,styles:h,originalPrice:f,dealPrice:y,selectedVariantId:m[n],onVariantChange:e=>x(n,e),isVertical:w,variantOptions:r.variantOptions,storeCurrencyCode:r.storeCurrencyCode}):null})):e.createElement("div",{className:"yt-comboBundle-products-list-horizontal "+(d?"yt-comboBundle-products-list-mobile":""),style:{display:"flex",flexDirection:"column",gap:"10px",width:"100%"}},h.comboBundle.subProductsSectionVisibility&&r.products.map((t,n)=>e.createElement(Jc,{key:`combo-product-horizontal-${n}-${t.productId}`,product:t,styles:h,originalPrice:f,dealPrice:y,selectedVariantId:m[n],onVariantChange:e=>x(n,e),variantOptions:r.variantOptions})))),e.createElement("div",{className:"yt-comboBundle-bundle-cta-section",style:{borderTop:"1px solid #eee",display:"flex",flexDirection:"column",rowGap:"5px",marginTop:"20px",width:"100%"}},e.createElement("button",{className:`yt-comboBundle-bundle-cta-button ${g?"":"yt-comboBundle-bundle-cta-button-disabled"} ${d?"yt-comboBundle-bundle-cta-button-mobile":""}`,style:{backgroundColor:g?h.general?.ctaBackgroundColor||"#121212":h.general.disabledButtonColor,color:h.general?.ctaTextColor||"#FFFFFF",fontSize:"16px",borderRadius:h.general.ctaBorderRadius??"20px",fontWeight:"bold",cursor:g?"pointer":"not-allowed",border:`1px solid ${g?h.general?.ctaBackgroundColor||"#121212":h.general.disabledButtonColor}`,boxShadow:h.general.ctaShadowType,padding:h.general?.ctaPadding,width:h.general?.ctaWidth,margin:"0"},disabled:!g,onMouseOver:e=>{h.general.customizeHoverState&&g&&(e.currentTarget.style.backgroundColor=h.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=h.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{h.general.customizeHoverState&&g&&(e.currentTarget.style.backgroundColor=h.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=h.general?.ctaTextColor||"#FFFFFF")},onClick:async()=>{const e=Object.entries(m).map(([e])=>({id:r.products[parseInt(e)].productId,title:r.products[parseInt(e)]?.productDetails?.title}));a?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:r._id,bundleType:"combo-bundle",selectedProducts:e}});try{if(c(!0),!i)return console.error("[ComboBundle.tsx] No addToCartFunction available"),void c(!1);const e=Object.entries(m).map(([e,t])=>{const n=r.products[parseInt(e)],o=n.productDetails.variants.edges.find(e=>e.node.id===t)?.node;return o?{variantId:t,price:Number(o.price)}:null}).filter(e=>null!==e),t=Object.values(m);await i(Number(f),t,Number(y),e)}catch(e){console.error("[ComboBundle.tsx] Error adding to cart:",e)}c(!1)}},l?e.createElement(Ze,{color:"white",loading:l,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):e.createElement(e.Fragment,null,g?h.comboBundle?.ctaTitle??"Add Bundle to cart":h.general.outOfStockLabel||"Out of Stock"," "))),C&&h.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Description")&&e.createElement("div",{className:"yt-comboBundle-bundle-description-section",style:{margin:"20px 0px"}},e.createElement("h4",{className:"yt-comboBundle-bundle-description-header",style:{fontSize:"16px",color:h.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",margin:0,padding:"8px",backgroundColor:h.general.primaryColor+"20"}},"Description"),e.createElement("div",{className:"yt-comboBundle-bundle-description-content",style:{fontSize:h.comboBundle.productDescriptionFontSize||"16px",color:h.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",padding:"8px",backgroundColor:h.general.primaryColor+"08"}},e.createElement("p",null,k))))},ed=c.div`
|
|
3568
|
+
`;const _c=l((r,i)=>{const[a,l]=J(Nc),c=o(()=>e=>{const t=r?.customVariantsQuantity?.find(t=>t.variantId===e?.id)?.quantity;return void 0!==t?t:r?.bundleProductsCustomQuantity?r?.bundleProductsCustomQuantity:e?a?.tracksInventory&&e.inventoryItem?.tracked?e.inventoryQuantity>0?e.inventoryQuantity:e.inventoryQuantity<=0&&"continue"===e.inventoryPolicy?1/0:0:1/0:0},[a?.tracksInventory,r?.customVariantsQuantity,r?.bundleProductsCustomQuantity]),d=a?.variants.edges?.filter(e=>c(e.node)>0)||[],[s,p]=t(d?.[0]?.node),[m,u]=t(0),[g,x]=t("undefined"!=typeof window&&window.innerWidth<=600),[f,y]=t(1),[b,h]=t("idle"),[v,w]=t(null),[C,E]=t(null);n(()=>{if(a){const e=a.variants.edges?.filter(e=>c(e.node)>0);p(a?.selectedVariant??e[0]?.node)}},[a,c]),n(()=>{const e=r.selectedProducts.find(e=>e.variantId===s?.id);y(e?e.quantity:0)},[f,r.selectedProducts,s]);const k=()=>{s?.id&&a&&(h("check"),r.handleAddToBundle(s?.id,a,1),setTimeout(()=>{h("idle"),l(void 0)},500))};if(n(()=>{const e=()=>x(window.innerWidth<=600);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),!a)return null;const{title:T,descriptionHtml:S,media:$,variants:B}=a,I=$.edges.map(e=>e?.node.preview.image??e?.node.image).filter(e=>e?.url?.length>0);n(()=>{if(a&&s?.image?.url&&Array.isArray(I)){const e=I.findIndex(e=>e?.url===s?.image?.url);-1!==e&&e!==m&&u(e)}},[s]);const z=e=>{const t=e.target.value,n=d?.find(e=>e.node.id===t)?.node;n&&c(n)>0&&p(n)};n(()=>{if(a){window.history.pushState({modalOpen:!0},"",window.location.href);const e=e=>{l(void 0),e.preventDefault()};return window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e),window.history.state?.modalOpen&&window.history.back()}}},[a,l]);const N=e=>{w(e.targetTouches[0].clientX),E(null)},F=e=>{E(e.targetTouches[0].clientX)},P=()=>{if(null!==v&&null!==C&&I.length>1){const e=v-C,t=50;e>t?u(e=>e<I.length-1?e+1:0):e<-t&&u(e=>e>0?e-1:I.length-1)}w(null),E(null)},D=r.selectedProducts.filter(e=>e.variantId===s?.id).reduce((e,t)=>e+t.quantity,0),A=r.customVariantsQuantity?.find(e=>e.variantId===s?.id)?.quantity??r.bundleProductsCustomQuantity??1/0,_=A!==1/0&&D>=A,R=r.hideAddToBundle||!s||c(s)<=0||_||"idle"!==b||r?.disableQuantitySelector&&1===f,O=e.createElement(Pc,{className:"yt-byob-modal-desktop-overlay"},e.createElement(Dc,{$isSmallScreen:g,ref:i},e.createElement(Ac,{ref:i,className:"yt-byob-modal-desktop-container yt-variant-selection-modal"},e.createElement("div",{className:"yt-byob-modal-desktop yt-variant-selection-modal "+(g?"small-screen":"large-screen")},e.createElement(Fc,{className:"yt-byob-modal-desktop-close",onClick:()=>{l(void 0)},style:{backgroundColor:"white"}},e.createElement(M,{size:"25"})),e.createElement("div",{className:"yt-byob-modal-desktop-image-section image-section"},e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-modal-desktop-image-swipe",onTouchStart:N,onTouchMove:F,onTouchEnd:P},e.createElement(lt,{small:Dp(I[m]?.url),medium:Dp(I[m]?.url),large:Dp(I[m]?.url),hideDownload:!0,className:"yt-byob-modal-desktop-main-image main-image",imageBackgroundColor:"#000"})),e.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((t,n)=>e.createElement("img",{key:n,className:"yt-byob-modal-desktop-gallery-thumb "+(m===n?"active":""),src:Dp(t?.url),alt:t.altText||`${T} - Image ${n+1}`,onClick:()=>u(n),style:{width:"73px",height:"73px",cursor:"pointer",borderRadius:"7px",border:"1px solid lightgray",...m===n&&{border:`2px solid ${r.themeColor||"#111"}`},objectFit:"cover"},loading:"lazy"}))))),e.createElement("div",{className:"yt-byob-modal-desktop-details-section details-section",style:{marginLeft:"20px",minHeight:"100%",maxHeight:"70vh",scrollbarWidth:"none",overflowY:"auto",display:"flex",flexDirection:"column"}},e.createElement("h2",{className:"yt-byob-modal-desktop-title"},"variant-display-name"===r?.styles?.byob?.productVariantTitleType?a?.selectedVariant?.displayName:"variant-title"===r?.styles?.byob?.productVariantTitleType?a?.selectedVariant?.title:a?.title),"ratingOnly"===r.reviewRatingType&&(a?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-modal-desktop-rating",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(he,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6}},a?.rating?.averageRating,"rating")),"ratingAndReviewCount"===r.reviewRatingType&&(a?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-modal-desktop-rating-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(he,{color:"gold",size:14})," ",a?.rating?.averageRating,e.createElement(me,{size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",a?.rating?.ratingCount," reviews)"),e.createElement("div",{className:"yt-byob-modal-desktop-variant-price-wrapper",style:{display:"flex",flexDirection:"column",gap:"2px",marginTop:"20px"}},a?.variants?.edges?.length>1&&e.createElement("div",{className:"yt-byob-modal-desktop-variant-selector"},e.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"}},e.createElement("span",{style:{flexShrink:0}},a.options[0].name," :"," ",e.createElement("strong",{style:{color:"#000",paddingLeft:"5px"}},s?.title)),e.createElement("select",{className:"yt-byob-modal-desktop-variant-select",value:s?.id||"",onChange:z,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}},a?.variants?.edges?.map(({node:t})=>e.createElement("option",{key:t.id,value:t.id,disabled:0===c(t)},t.title))),e.createElement("span",{className:"yt-byob-modal-desktop-variant-chevron",style:{position:"absolute",right:5,pointerEvents:"none",fontSize:"12px",color:"#000"}},e.createElement(Me,null)))),e.createElement("div",{className:"yt-byob-modal-desktop-price-atc-wrapper",style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"}},e.createElement("div",{className:"yt-byob-modal-desktop-price",style:{width:"fit-content",minWidth:"fit-content",paddingRight:"10px",display:"flex",flexDirection:"row",alignItems:"baseline",gap:"6px"}},r?.isFreebieTier&&!r.showFreebieTierProductPrices?e.createElement(e.Fragment,null,e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"20px",textDecoration:"line-through",color:"#888",marginRight:"6px"}},Pp(r.styles.general.currencySymbol,r.styles.general.currencySymbol),Fp(s?.price)),e.createElement("span",{className:"yt-byob-current-price",style:{color:r.styles.general.primaryColor||"#d32f2f",fontWeight:"bold",fontSize:"20px"}},"FREE")):e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-modal-desktop-current-price"},e.createElement("span",{style:{fontSize:"20px",fontWeight:"600",color:"#000",textAlign:"center",lineHeight:"normal"}},Pp(r.styles.general.currencySymbol,r.styles.general.currencySymbol),Fp(s?.price))),s?.compareAtPrice&&parseFloat(s.compareAtPrice)>parseFloat(s?.price)&&e.createElement("div",{className:"yt-byob-modal-desktop-compare-price",style:{textDecoration:"line-through",opacity:"0.5",lineHeight:"normal"}},Pp(r.styles.general.currencySymbol,r.styles.general.currencySymbol),Fp(s?.compareAtPrice)))),e.createElement("div",{className:"yt-byob-modal-desktop-atc-wrapper yt-product-modal-atc-wrapper",style:{width:"80%"}},e.createElement("button",{className:"yt-byob-modal-desktop-atc-button yt-product-modal-atc-button",style:{textTransform:"uppercase",fontWeight:"800",width:"100%",border:"none",backgroundColor:r.themeColor||"#111",borderRadius:r.cornerRadius,color:r.primaryTextColorCta||"#fff",minHeight:"40px",padding:"0px 15px",position:"relative",overflow:"hidden",opacity:R?.5:1,cursor:R?"not-allowed":"pointer"},onClick:e=>{e.stopPropagation(),e.preventDefault(),k()},disabled:R},r.styles.byob.addToBundleCTAText??"Add to bundle")))),e.createElement("div",{className:"yt-byob-modal-desktop-divider",style:{height:"10px",minHeight:"10px",border:"none",backgroundColor:"#D9D9D96B",margin:"20px 0 10px 0",display:"block !important"}},e.createElement("span",null)),e.createElement("span",{className:"yt-byob-modal-desktop-description yt-description-content",style:{scrollBehavior:"smooth"},dangerouslySetInnerHTML:{__html:S}})))))),L=e.createElement(Pc,{className:"yt-byob-modal-mobile-overlay"},e.createElement(Dc,{className:"yt-byob-modal-mobile-content",style:{padding:"0px",position:"relative"},$isSmallScreen:g,ref:i},e.createElement(Ac,{ref:i,className:"yt-byob-modal-mobile-container yt-variant-selection-modal"},e.createElement("button",{className:"yt-byob-modal-mobile-close-btn",style:{position:"fixed",top:"20px",right:"20px",zIndex:9999999999,backgroundColor:"#FFFFFF",padding:"4px",borderRadius:"50%",border:"1px solid lightgray",display:"flex",justifyContent:"center",alignItems:"center"},onClick:()=>{l(void 0)}},e.createElement(Ve,{className:"yt-byob-modal-mobile-close-icon",style:{height:"22px",width:"22px",padding:"4px",color:"black"},onMouseEnter:e=>e.currentTarget.style.color="black"})),e.createElement("div",{className:"yt-byob-modal-mobile yt-variant-selection-modal small-screen",style:{padding:"0px"}},e.createElement("div",{className:"yt-byob-modal-mobile-image-section image-section"},e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-modal-mobile-image-swipe",style:{position:"relative"},onTouchStart:N,onTouchMove:F,onTouchEnd:P},e.createElement(lt,{small:Dp(I[m]?.url),medium:Dp(I[m]?.url),large:Dp(I[m]?.url),hideDownload:!0,className:"yt-byob-modal-mobile-main-image main-image",imageBackgroundColor:"#000"}),e.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((t,n)=>e.createElement("span",{key:n,className:"yt-byob-modal-mobile-indicator "+(m===n?"active":""),style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:m===n?"#FFFFFF":"#EBEBEB",margin:"0 3px",cursor:"pointer",backdropFilter:"blur(10px)"}})))),e.createElement("div",{className:"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((t,n)=>e.createElement("img",{key:n,className:"yt-byob-modal-mobile-gallery-thumb "+(m===n?"active":""),src:Dp(t?.url),alt:t.altText||`${T} - Image ${n+1}`,onClick:()=>u(n),style:{width:"60px",height:"60px",cursor:"pointer",borderRadius:"7px",border:"1px solid lightgray",...m===n&&{border:`2px solid ${r.themeColor||"#111"}`},objectFit:"cover"},loading:"lazy"}))))),e.createElement("div",{className:"yt-byob-modal-mobile-details-section details-section",style:{padding:"0 30px",margin:"15px 0",paddingBottom:"120px"}},e.createElement("h2",{className:"yt-byob-modal-mobile-title",style:{margin:"0px"}},"variant-display-name"===r?.styles?.byob?.productVariantTitleType?a?.selectedVariant?.displayName:"variant-title"===r?.styles?.byob?.productVariantTitleType?a?.selectedVariant?.title:a?.title),"ratingOnly"===r.reviewRatingType&&(r?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-modal-mobile-rating",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(he,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6}},r?.rating?.averageRating," rating")),"ratingAndReviewCount"===r.reviewRatingType&&(r?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-modal-mobile-rating-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(he,{color:"gold",size:14})," ",r?.rating?.averageRating,e.createElement(me,{className:"yt-byob-modal-mobile-verified-icon",style:{color:"dodgerblue",marginLeft:"4px"},size:14})," ","(",r?.rating?.ratingCount," reviews)"),e.createElement("div",{className:"yt-byob-modal-mobile-divider",style:{opacity:"0.2",border:"none",height:"2px",backgroundColor:"#000000",margin:"10px 0px",display:"block !important"}},e.createElement("span",null)),e.createElement("div",{className:"yt-byob-modal-mobile-description yt-description-content",style:{scrollbarWidth:"none",scrollBehavior:"smooth",margin:"0px"},dangerouslySetInnerHTML:{__html:S}})))),e.createElement("div",{className:"yt-byob-modal-mobile-bottom-bar",style:{position:"fixed",bottom:"0px",left:"0px",right:"0px",padding:"12px 15px",borderTop:"1px solid lightgray",boxShadow:"0px -4px 5px rgba(0, 0, 0, 0.1)",backgroundColor:"#fff",display:"flex",flexDirection:"column",gap:"2px",zIndex:9999999999}},a?.variants?.edges?.length>1&&e.createElement("div",{className:"yt-byob-modal-mobile-variant-selector"},e.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"}},e.createElement("span",{style:{flexShrink:0}},a.options[0].name," :"," ",e.createElement("strong",{style:{color:"#000",paddingLeft:"5px"}},s?.title)),e.createElement("select",{className:"yt-byob-modal-mobile-variant-select",value:s?.id||"",onChange:z,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}},a?.variants?.edges?.map(({node:t})=>e.createElement("option",{key:t.id,value:t.id,disabled:0===c(t)},t.title))),e.createElement("span",{className:"yt-byob-modal-mobile-variant-chevron",style:{position:"absolute",right:5,pointerEvents:"none",fontSize:"12px",color:"#000"}},e.createElement(Me,null)))),e.createElement("div",{className:"yt-byob-modal-mobile-price-atc-wrapper",style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"}},e.createElement("div",{className:"yt-byob-modal-mobile-price",style:{width:"fit-content",minWidth:"fit-content",display:"flex",flexDirection:"row",paddingRight:"10px",alignItems:"center"}},r?.isFreebieTier&&!r.showFreebieTierProductPrices?e.createElement(e.Fragment,null,e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"20px",textDecoration:"line-through",color:"#888",marginRight:"6px"}},Pp(r.styles.general.currencySymbol,r.styles.general.currencySymbol),Fp(s?.price)),e.createElement("span",{className:"yt-byob-current-price",style:{color:r.styles.general.primaryColor||"#d32f2f",fontWeight:"bold",fontSize:"20px"}},"FREE")):e.createElement(e.Fragment,null,s?.compareAtPrice&&e.createElement("div",{className:"yt-byob-modal-mobile-compare-price",style:{textDecoration:"line-through",opacity:"0.5",lineHeight:"normal"}},Pp(r.styles.general.currencySymbol,r.styles.general.currencySymbol),Fp(s?.compareAtPrice)),e.createElement("div",{className:"yt-byob-modal-mobile-current-price"},e.createElement("span",{style:{fontSize:"20px",fontWeight:"600",color:"#000",textAlign:"center",lineHeight:"normal"}},Pp(r.styles.general.currencySymbol,r.styles.general.currencySymbol),Fp(s?.price))))),e.createElement("div",{className:"yt-byob-modal-mobile-atc-wrapper",style:{width:"100%"}},e.createElement("button",{className:"yt-byob-modal-mobile-atc-button",style:{textTransform:"uppercase",fontWeight:"800",width:"100%",border:"none",backgroundColor:r.themeColor||"#111",borderRadius:r.cornerRadius,color:r.primaryTextColorCta||"#fff",minHeight:"40px",padding:"0px 15px",position:"relative",overflow:"hidden",opacity:R?.5:1,cursor:R?"not-allowed":"pointer"},onClick:e=>{e.stopPropagation(),e.preventDefault(),k()},disabled:R},r.styles.byob.addToBundleCTAText||"Add to Bundle"))))));return nt.createPortal(g?L:O,document.body)}),Rc=({options:t,selectedValue:n,onChange:o,type:r="text",isOptionAvailable:i,isMobile:a})=>e.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"}},t?.map(t=>{const a=!i||i(t.name);return e.createElement("div",{key:t.name,onClick:()=>{a&&o(t)},style:{cursor:a?"pointer":"not-allowed"}},((t,n)=>{const o=!i||i(t.name),a={cursor:o?"pointer":"not-allowed",border:n?"2px solid #333":"1px solid #d1d5db",transition:"all 0.2s ease",opacity:o?1:.5};if("color"===r)return t.value&&(()=>{if(!t.value.trim())return!1;if(t.value===t.name||t.value.length<3)return!1;try{const e=document.createElement("div");return e.style.color=t.value,""!==e.style.color}catch{return!1}})()?e.createElement("div",{style:{...a,width:24,height:24,borderRadius:"50%",backgroundColor:t.value}}):e.createElement("div",{style:{...a,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"}},t.name);return"image"===r?e.createElement("img",{src:dn(t.value,48,85,"webp")||"/placeholder.svg",alt:t.name,style:{...a,width:24,height:24,borderRadius:"50%",objectFit:"cover"}}):e.createElement("div",{style:{...a,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"}},t.name)})(t,n?.name===t.name))})),Oc=({product:r,isOpen:i,onClose:a,variantOptions:l,cta:c,onConfirm:d})=>{const s=o(()=>e=>e?r?.tracksInventory&&e?.inventoryItem?.tracked?e.inventoryQuantity>0?e?.inventoryQuantity:e.inventoryQuantity<=0&&"continue"===e.inventoryPolicy?1/0:0:1/0:0,[r?.tracksInventory]),p=o(()=>{const e=r.variants.edges.find(e=>{const t=e.node;return s(t)>0})?.node;return e?.title&&"Default Title"!==e.title?e.title.split(" / "):r.options?.map(e=>e.values[0])||[]},[r,s]),[m,u]=t(p),[g,x]=t(window.innerWidth<1024);n(()=>{const e=()=>x(window.innerWidth<1024);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),n(()=>{const e=e=>{"Escape"===e.key&&a()};return i&&document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[i,a]);const f=r.variants.edges.find(e=>e.node.title===(r.options?.length>0?m.join(" / "):m[0]))?.node,y=f?.image?.url||r.featuredMedia?.preview?.image?.url,b=dn(y,150,85,"webp"),h=e=>{if(!l?.options)return"text";const t=l.options.find(t=>t.name===e);return t?.type||"text"},v=e=>{if(!l?.options)return e.values.map(e=>({name:e,value:e}));const t=l.options.find(t=>t.name===e.name);return e.values.map(e=>{const n=t?.values?.find(t=>t.name===e);return{name:e,value:n?.value||e}})},w=(e,t)=>{const n=m[t];if(!n)return null;return v(e).find(e=>e.name===n)||null};if(!i)return null;const C=e.createElement("div",{onClick:a,style:{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100vw",height:"100vh",background:"rgba(0, 0, 0, 0.4)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center"},role:"dialog","aria-modal":"true","aria-labelledby":"yt-variant-options-modal-title"},e.createElement("div",{onClick:e=>e.stopPropagation(),style:{background:"white",borderRadius:16,width:"fit-content",minWidth:350,maxWidth:450,maxHeight:"90vh",overflowY:"auto",position:"relative",zIndex:999,...window.innerWidth<=600&&{width:"90vw",maxWidth:"90vw",minWidth:"90vw"}}},e.createElement("div",{id:"yt-variant-options-modal-title",style:{width:"100%",padding:"16px 0",fontWeight:600,fontSize:14,textTransform:"uppercase",backgroundColor:"rgba(217, 217, 217)",color:"black",textAlign:"center",borderTopLeftRadius:16,borderTopRightRadius:16}},"Select Options"),e.createElement("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"16px 20px",borderBottom:"1px solid #f0f0f0"}},e.createElement("img",{src:b,alt:r.title,style:{width:60,height:60,borderRadius:8,objectFit:"cover",flexShrink:0,transition:"opacity 0.3s ease"}}),e.createElement("div",{style:{display:"flex",flexDirection:"column",flex:1,gap:4}},e.createElement("div",{style:{fontSize:14,fontWeight:600,color:"#333"}},r.title))),e.createElement("div",{style:{padding:"20px"}},r.options.map((t,n)=>e.createElement("div",{key:t.name,style:{display:"flex",flexDirection:"column",gap:8,marginBottom:t?.values?.length>1?16:0}},t?.values?.length>1&&e.createElement(e.Fragment,null,e.createElement("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8}},e.createElement("span",{style:{fontSize:14,fontWeight:500,color:"#333"}},"Select ",t.name),e.createElement("span",{style:{fontSize:12,fontWeight:500,color:"#666",backgroundColor:"#f5f5f5",padding:"4px 12px",borderRadius:16,textTransform:"capitalize"}},w(t,n)?.name||t.values[0])),e.createElement(Rc,{options:v(t),selectedValue:w(t,n),onChange:e=>{((e,t)=>{const n=[...m];n[e]=t.name,u(n)})(n,e)},type:h(t.name),isOptionAvailable:e=>((e,t)=>{const n=[...m];n[e]=t;const o=r.options?.length>0?n.join(" / "):n[0],i=r.variants.edges.find(e=>e.node.title===o)?.node;return!!i&&s(i)>0})(n,e),isMobile:g}))))),e.createElement("button",{onClick:()=>{const e=r.variants.edges.find(e=>e.node.title===(r.options?.length>0?m.join(" / "):m[0]))?.node,t=!!e&&s(e)>0;if(e?.id&&t)d(e.id),a();else{console.warn("yt::variant options modal - selected variant not available or out of stock:",m);const e=r.variants.edges.find(e=>s(e.node)>0)?.node.id;e&&(d(e),a())}},style:{width:"100%",fontSize:14,fontWeight:600,textTransform:"uppercase",backgroundColor:c.backgroundColor,color:c.textColor,textAlign:"center",padding:"16px 0",border:"none",cursor:"pointer",borderBottomLeftRadius:16,borderBottomRightRadius:16},onMouseEnter:e=>{e.currentTarget.style.opacity="0.9"},onMouseLeave:e=>{e.currentTarget.style.opacity="1"}},"Add to Bundle")));return nt.createPortal(C,document.body)},Lc=({coverImageUrl:t,mobileCoverImageUrl:n,alt:o="Background",styles:r})=>{const i=[{imageWidth:21,descriptor:36},{imageWidth:48,descriptor:80},{imageWidth:99,descriptor:165},{imageWidth:216,descriptor:360},{imageWidth:225,descriptor:375},{imageWidth:319,descriptor:533},{imageWidth:330,descriptor:550},{imageWidth:432,descriptor:720},{imageWidth:564,descriptor:940},{imageWidth:639,descriptor:1066},{imageWidth:648,descriptor:1080},{imageWidth:900,descriptor:1500},{imageWidth:1068,descriptor:1780},{imageWidth:1296,descriptor:2160}],a=(e,t)=>{if(e&&e.includes("cdn.shopify"))try{const n=new URL(e),o=n.searchParams;return o.has("format")||o.set("format","webp"),o.has("quality")||o.set("quality","80"),o.set("width",t.toString()),n.toString()}catch{const n=e.includes("?")?"&":"?";return`${e}${n}format=webp&quality=80&width=${t}`}},l=e=>e?i.map(({imageWidth:t,descriptor:n})=>{const o=a(e,t);return o?`${o} ${n}w`:""}).filter(Boolean).join(", "):"";if(!t&&!n)return null;const c=t||n||"",d=a(c,800)||c,s=[];if(n&&n!==t){const t=l(n);t&&s.push(e.createElement("source",{key:"mobile",media:"(max-width: 768px)",srcSet:t}))}if(t){const n=l(t);n&&(s.length>0?s.push(e.createElement("source",{key:"desktop",media:"(min-width: 769px)",srcSet:n})):s.push(e.createElement("source",{key:"desktop",srcSet:n})))}else if(n){const t=l(n);t&&s.push(e.createElement("source",{key:"mobile",srcSet:t}))}return e.createElement("div",{style:{width:"100%",display:"block"}},e.createElement("picture",{style:{display:"block",width:"100%"}},s,e.createElement("img",{src:d,alt:o,style:{width:"100%",height:"auto",display:"block",...r},loading:"eager",fetchPriority:"high",sizes:"100vw"})))},jc=({title:t,isOpen:n,onToggle:o,children:r})=>e.createElement("div",{className:"yt-byob-filter-section",style:{borderBottom:"1px solid #eee",paddingBottom:n?"20px":"12px",marginBottom:"12px"}},e.createElement("div",{className:"yt-byob-filter-section-header",onClick:o,style:{display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",padding:"8px 0"}},e.createElement("span",{className:"yt-byob-filter-section-title",style:{fontSize:"16px",fontWeight:500,color:"#111"}},t),n?e.createElement(Ie,{className:"yt-byob-icon-minus",size:20}):e.createElement(Te,{className:"yt-byob-icon-plus",size:20})),n&&e.createElement("div",{className:"yt-byob-filter-section-body",style:{marginTop:"16px"}},r)),Mc=({availableFilters:n,appliedFilters:o,toggleFilter:r,clearAllFilters:i,applyPriceFilter:a,priceMin:l,setPriceMin:c,priceMax:d,setPriceMax:s,maxPossiblePrice:p,styles:m,availableProductCount:u,products:g,unavailableProductCount:x,storeCurrencyCode:f,showActions:y=!0,openSections:b,toggleSection:h})=>{const[v,w]=t(null),C=Pp(m?.general?.currencySymbol,f)??"₹";return e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-filters-content-wrapper",style:{overflowY:"auto",scrollbarWidth:"none",padding:"20px",flex:1,minHeight:0,overscrollBehavior:"contain"}},n.map(t=>e.createElement(jc,{key:t.id,title:t.label,isOpen:!!b[t.id],onToggle:()=>h(t.id)},"LIST"===t.type&&e.createElement("div",{className:"yt-byob-filter-list",style:{display:"flex",flexDirection:"column",gap:"14px"}},t.values.map(n=>{const i=o[t.id]?.includes(n.id)||!1,a="filter.v.availability.1"===n.id?u??g.length:"filter.v.availability.0"===n.id?x??0:n.count;return e.createElement("label",{key:n.id,className:"yt-byob-filter-item-label",style:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer"}},e.createElement("div",{className:"yt-byob-filter-item-left",style:{display:"flex",alignItems:"center",gap:"10px"}},e.createElement("input",{className:"yt-byob-filter-checkbox",type:"checkbox",checked:i,onChange:()=>r(t.id,n.id),style:{width:"18px",height:"18px",accentColor:m?.general?.primaryColor||"#333",cursor:"pointer"}}),e.createElement("span",{className:"yt-byob-filter-item-text",style:{fontSize:"15px",color:"#333"}},n.label)),e.createElement("span",{className:"yt-byob-filter-item-count",style:{fontSize:"12px",background:"#f3f4f6",padding:"2px 8px",borderRadius:"4px",color:"#666",minWidth:"24px",textAlign:"center"}},a))})),"PRICE_RANGE"===t.type&&e.createElement("div",{className:"yt-byob-price-filter",style:{padding:"0 4px"}},e.createElement("div",{className:"yt-byob-price-range-display",style:{fontSize:"15px",color:"#333",marginBottom:"24px",fontWeight:500}},C,l.toLocaleString()," – ",C,d.toLocaleString(),d>=p?"+":""),e.createElement("div",{className:"yt-byob-price-slider-container",style:{position:"relative",width:"100%",height:"4px",background:"#e5e7eb",borderRadius:"4px",marginBottom:"10px"}},e.createElement("div",{className:"yt-byob-price-slider-track",style:{position:"absolute",height:"100%",background:"#333",borderRadius:"4px",left:l/p*100+"%",right:100-d/p*100+"%"}}),e.createElement("input",{type:"range",min:0,max:p,value:l,onMouseDown:()=>w("min"),onTouchStart:()=>w("min"),onChange:e=>{const t=Math.min(Number(e.target.value),d-10);c(t)},style:{position:"absolute",width:"100%",height:"0px",top:"50%",transform:"translateY(-50%)",background:"none",pointerEvents:"none",appearance:"none",WebkitAppearance:"none",zIndex:"min"===v?11:5,margin:0},className:"yt-byob-dual-range-input-min"}),e.createElement("input",{type:"range",min:0,max:p,value:d,onMouseDown:()=>w("max"),onTouchStart:()=>w("max"),onChange:e=>{const t=Math.max(Number(e.target.value),l+10);s(t)},style:{position:"absolute",width:"100%",height:"0px",top:"50%",transform:"translateY(-50%)",background:"none",pointerEvents:"none",appearance:"none",WebkitAppearance:"none",zIndex:"max"===v?11:4,margin:0},className:"yt-byob-dual-range-input-max"})),e.createElement("style",null,"\n .yt-byob-dual-range-input-min::-webkit-slider-thumb,\n .yt-byob-dual-range-input-max::-webkit-slider-thumb {\n pointer-events: auto;\n appearance: none;\n width: 22px;\n height: 22px;\n border-radius: 50%;\n background: #444;\n border: 3px solid white;\n cursor: pointer;\n box-shadow: 0 2px 5px rgba(0,0,0,0.2);\n position: relative;\n z-index: 20;\n }\n .yt-byob-dual-range-input-min::-moz-range-thumb,\n .yt-byob-dual-range-input-max::-moz-range-thumb {\n pointer-events: auto;\n width: 22px;\n height: 22px;\n border-radius: 50%;\n background: #444;\n border: 3px solid white;\n cursor: pointer;\n box-shadow: 0 2px 5px rgba(0,0,0,0.2);\n position: relative;\n z-index: 20;\n }\n "))))),y&&e.createElement("div",{className:"yt-byob-filter-actions",style:{display:"flex",gap:"12px",borderTop:"1px solid #eee",padding:"16px 0px",position:"sticky",bottom:"2px",paddingInline:"10px"}},e.createElement("button",{className:"yt-byob-filter-clear-button",onClick:i,style:{flex:1,padding:"8px",background:"#f3f4f6",border:"none",borderRadius:m?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px",color:"#333",fontFamily:"inherit"}},"Clear All"),e.createElement("button",{className:"yt-byob-filter-apply-button",onClick:a,style:{flex:1,padding:"8px",background:m?.general?.primaryColor||"#333",color:"white",border:"none",borderRadius:m?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px",fontFamily:"inherit"}},"Apply")))},Vc=t=>{const{showFiltersDrawer:n,handleClose:o,isAnimating:r,isMobile:i}=t;return n?ot(e.createElement("div",{className:"yt-byob-filter-drawer-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:1e3,display:"flex",justifyContent:"flex-end",opacity:r?1:0,transition:"opacity 300ms ease-in-out"},onClick:o},e.createElement("div",{className:"yt-byob-filter-drawer-content",style:{width:i?"85%":"380px",height:"100%",background:"white",boxShadow:"-4px 0 12px rgba(0,0,0,0.15)",transform:r?"translateX(0)":"translateX(100%)",transition:"transform 300ms ease-in-out",display:"flex",flexDirection:"column",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement(Mc,{...t,applyPriceFilter:()=>{t.applyPriceFilter(),o()},openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})}))),document.body):null},Wc=t=>{const{showFiltersDrawer:n}=t;return n&&0!==t?.availableFilters?.length?e.createElement("div",{className:"yt-byob-filters-sidebar",style:{width:"280px",minWidth:"280px",padding:"0",height:"auto",maxHeight:"calc(100vh - 40px)",position:"sticky",top:"20px",display:"flex",flexDirection:"column",borderRight:"1px solid #eee",marginRight:"20px"}},e.createElement(Mc,{...t,showActions:!0,openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})})):null},Hc=({enableSortAndFilter:o,isMobile:r,setSearchTerm:i,searchTerm:a,styles:l,setSortBy:c,appliedFilters:d,setAppliedFilters:s,availableFilters:p=[],products:m,availableProductCount:u,unavailableProductCount:g,maxPossiblePrice:x,storeCurrencyCode:f,sharedFiltersState:y,openSections:h,toggleSection:v,sortBy:w})=>{const[C,E]=t(!1),[k,T]=t(a),{showFilters:S,setShowFilters:$,priceMax:B,setPriceMax:I,priceMin:z,setPriceMin:N}=y,[F,P]=t(!1),D=l?.byob?.productFiltersDisplay||"drawer",A=!r&&"sidebar"===D,_="none"===D;n(()=>{d["filter.v.price"]||(I(x),N(0))},[x,d]);n(()=>{const e=setTimeout(()=>{i(k)},300);return()=>clearTimeout(e)},[k,i]),n(()=>(S&&!A?(document.body.style.overflow="hidden",P(!0)):(document.body.style.overflow="",P(!1)),()=>{document.body.style.overflow=""}),[S,A]);const R=Object.entries(d).reduce((e,[t,n])=>"filter.v.price"===t?z>0||B<x?e+1:e:e+(n?n.length:0),0);return e.createElement("div",{className:"yt-byob-sort-filter-container",style:{display:"flex",flexDirection:r?"column":"row",justifyContent:"space-between",alignItems:r?"flex-end":"center",marginBottom:"20px",width:"100%",gap:r?"10px":"0"}},e.createElement("div",{className:"yt-byob-search-filter-controls",style:{display:"flex",flexDirection:o?"row-reverse":"row",justifyContent:"space-between",alignItems:C?void 0:"center",gap:"12px",width:"100%"}},o&&e.createElement("div",{className:"yt-byob-search-wrapper",style:{position:"relative",display:"flex",alignItems:"center",width:r?C?"100%":"auto":"400px",transition:"width 0.3s ease-in-out"}},r&&!C?e.createElement(Se,{className:"yt-byob-search-icon-trigger",fontSize:"20px",color:"#555",style:{cursor:"pointer"},onClick:()=>E(!0)}):e.createElement(e.Fragment,null,e.createElement("input",{className:"yt-byob-search-input",style:{width:"100%",padding:r?"10px 12px":"10px 14px",fontSize:"14px",outline:"none",color:"#333",border:"1px solid #c7c7c7",borderRadius:l?.byob.borderRadius,boxShadow:l?.byob.borderColor?"0 2px 4px rgba(0,0,0,0.1)":"none"},placeholder:"Search by Product Name",value:k,onChange:e=>T(e.target.value)}),!C&&e.createElement(Se,{className:"yt-byob-search-icon",fontSize:"18px",style:{position:"absolute",right:"12px",color:"#aaa",pointerEvents:"none"}})),r&&C&&e.createElement("span",{className:"yt-byob-search-close",style:{position:"absolute",right:"12px",color:"#aaa",fontSize:"16px",cursor:"pointer"},onClick:()=>E(!1)},"X")),e.createElement("div",{className:"yt-byob-actions-wrapper",style:{display:"flex",flexDirection:"row",gap:"10px"}},p?.length>0&&e.createElement("button",{className:"yt-byob-filter-toggle-button",onClick:()=>$(!S),style:{display:_?"none":"flex",alignItems:"center",gap:r?"0px":"6px",background:S&&A?"#f3f4f6":"white",cursor:"pointer",fontSize:"14px",color:"#333",whiteSpace:"nowrap",border:"1px solid #d1d5db",padding:"8px 12px",borderRadius:l?.byob.borderRadius,boxShadow:"0 2px 4px rgba(0,0,0,0.1)"}},e.createElement($e,{className:"yt-byob-filter-toggle-icon",size:18}),!r&&"Filters",R>0&&e.createElement("span",{className:"yt-byob-active-filter-badge",style:{background:l?.general?.primaryColor||"#ef4444",color:"white",borderRadius:"999px",padding:"2px 8px",fontSize:"12px",lineHeight:1}},R)),o&&e.createElement("div",{className:"yt-byob-sort-wrapper",style:{display:"flex",alignItems:"center",border:"1px solid #d1d5db",padding:"8px 12px",borderRadius:l?.byob.borderRadius,boxShadow:"0 2px 4px rgba(0,0,0,0.1)",position:"relative"}},!r&&e.createElement("span",{className:"yt-byob-sort-label",style:{fontSize:"14px",color:"#555",marginRight:"6px"}},"Sort:"),r&&e.createElement(Be,{className:"yt-byob-sort-icon",size:18,style:{color:"#555"}}),e.createElement("select",{className:"yt-byob-sort-select",style:{border:"none",background:"transparent",fontSize:"14px",color:"#333",cursor:"pointer",outline:"none",appearance:"none",WebkitAppearance:"none",paddingRight:"20px"},value:w,onChange:e=>c(e.target.value)},e.createElement("option",{className:"yt-byob-sort-option",value:""},"Featured"),e.createElement("option",{className:"yt-byob-sort-option",value:"price-low-to-high"},"Price: Low to High"),e.createElement("option",{className:"yt-byob-sort-option",value:"price-high-to-low"},"Price: High to Low"),e.createElement("option",{className:"yt-byob-sort-option",value:"title-asc"},"Alphabetical: A-Z"),e.createElement("option",{className:"yt-byob-sort-option",value:"title-desc"},"Alphabetical: Z-A")),e.createElement(b,{className:"yt-byob-sort-chevron",size:14,style:{position:"absolute",right:"10px",pointerEvents:"none",color:"#555"}})))),!A&&!_&&e.createElement(Vc,{showFiltersDrawer:S,handleClose:()=>{A?$(!1):(document.body.style.overflow="",P(!1),setTimeout(()=>{$(!1)},300))},isAnimating:F,isMobile:r,availableFilters:p,appliedFilters:d,toggleFilter:(e,t)=>{s(n=>{const o=n[e]||[],r=o.includes(t)?o.filter(e=>e!==t):[...o,t],i={...n,[e]:r.length?r:void 0};return Object.fromEntries(Object.entries(i).filter(([,e])=>void 0!==e))})},clearAllFilters:()=>{I(x),N(0),s({})},applyPriceFilter:()=>{s(e=>{const t={...e};return t["filter.v.price"]=[`min:${z}-max:${B}`],t})},priceMin:z,setPriceMin:N,priceMax:B,setPriceMax:I,maxPossiblePrice:x,styles:l,availableProductCount:u,products:m,unavailableProductCount:g,storeCurrencyCode:f,openSections:h,toggleSection:v}))};function qc({quantity:t,setQuantity:n,remainingQuantity:o,handleAddToBundle:r,variantId:i,product:a,handleRemoveItem:l,hideAddToBundle:c,selectedVariantInventoryQty:d}){const s={display:"flex",alignItems:"center",justifyContent:"center",width:"33%",cursor:"pointer",backgroundColor:"#f2f2f2",userSelect:"none",border:"none",padding:"8px",margin:"0",fontSize:"20px",color:"#333",textDecoration:"none",boxShadow:"none",outline:"none",borderRadius:"0",boxSizing:"border-box"},p=t<d;return e.createElement(Ol,{className:"yt-byob-quantity-selector-container"},e.createElement("button",{className:"yt-byob-quantity-minus-button",onClick:e=>{e.stopPropagation();const o=Math.max(0,t-1);n(o),l&&i&&l(i,1)},style:s},"-"),e.createElement(Ll,{className:"yt-byob-quantity-display"},t," added"),e.createElement("button",{className:"yt-byob-quantity-plus-button",onClick:e=>{e.stopPropagation();const l=Math.min(o,t+1,d);n(l),r&&i&&a&&r(i,a,1)},disabled:!p||c,style:{...s,cursor:!p||c?"not-allowed":"pointer",opacity:!p||c?.6:1}},"+"))}const Qc=({product:r,styles:i,selectedVariant:a})=>{const[l,c]=t(!1),d=o(()=>Dp(a?.image?.url||r?.featuredMedia?.preview?.image?.url||r?.media?.edges?.[0]?.node?.image?.url)||"",[a?.image?.url,r?.featuredMedia?.preview?.image?.url,r?.media?.edges]),s=o(()=>r?.media?.edges?.map(e=>Dp(e?.node?.preview?.image?.url??e?.node?.image?.url)).filter(Boolean)??[],[r?.media?.edges]),p=o(()=>s?.[1]??d??"",[s,d]);n(()=>{if(d){(new Image).src=d}},[d]);const m=o(()=>d||s?.[0],[d,s]);return e.createElement("div",{className:"yt-byob-image-hover-container",style:{position:"relative",width:"100%",overflow:"hidden",aspectRatio:i.general.imageAspectRatio||"1/1"},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1)},e.createElement("div",{className:"yt-byob-image-inner-container",style:{width:"100%",height:"100%",position:"relative"}},e.createElement("img",{className:"yt-byob-image-main",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",objectPosition:"top",opacity:l&&m!==p?0:1,transition:s?.length>0?"opacity 300ms ease, transform 300ms ease":"",transform:l?"scale(1.1)":"scale(1)"},src:m,alt:r.title}),m!==p&&e.createElement("img",{className:"yt-byob-image-hover",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",opacity:l?1:0,transition:"opacity 400ms ease, transform 400ms ease",transform:l?"scale(1.1)":"scale(1)",position:"absolute",top:0,left:0,objectPosition:"top"},src:p,alt:r.title})))},Uc=({product:o,bundle:r,handleAddToBundle:a,hideAddToBundle:l,remainingQuantity:c,themeColor:d,handleRemoveItem:s,transitionActive:p,idx:m,selecteditems:u,customVariantsQuantity:g,currentProductTier:x,showFreebieTierProductPrices:f})=>{const y=ee(Nc),h=r.customizations,v=h?.byob?.variantSelectorType,[w,C]=t(!1),E=h.general?.variantTitleSuffix?o?.variants?.edges:(e=>{if(!e||e.length<2)return e;const t=e.map(e=>e.node.title).map(e=>e.split(" "));let n=[...t[0]];for(let e=1;e<t.length;e++){const o=t[e];let r=0;for(;r<n.length&&r<o.length&&n[n.length-1-r]===o[o.length-1-r];)r++;n=n.slice(n.length-r)}return n.length<1?e:e.map(e=>{const t=e.node.title.split(" "),o=t.slice(0,t.length-n.length).join(" ");return{...e,node:{...e.node,title:o,commonSuffix:n.join(" ")}}})})(o?.variants?.edges);if(!E||!E.length)return e.createElement(e.Fragment,null);const k=i(e=>{const t=g?.find(t=>t.variantId===e)?.quantity;if(void 0!==t)return t;if(r?.customProductsQuantity)return r?.customProductsQuantity;const n=E?.find(t=>t.node.id===e),i=n?.node;return i?o.tracksInventory&&i.inventoryItem?.tracked?i.inventoryQuantity>0?i.inventoryQuantity:i.inventoryQuantity<=0&&"continue"===i.inventoryPolicy?1/0:0:1/0:0},[E,g,o.tracksInventory]),T=E?.find(e=>k(e.node.id)>0)?.node?.id;if(!T&&!h.general.showOutOfStockProducts)return e.createElement(e.Fragment,null);const[S,$]=t(E?.find(e=>k(e.node.id)>0)?.node?.id||E[0]?.node?.id),[B,I]=t(0),[z,N]=t(window.innerWidth<450),[F,P]=t("normal"),D=E?.find(e=>e?.node?.id===S)?.node,A=k(S||"");n(()=>{const e=u.find(e=>e.variantId===S);I(e?e.quantity:0)},[B,u,S]),n(()=>{const e=()=>{N(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{CSS.supports("font-weight","500")?P("500"):CSS.supports("font-weight","400")?P("400"):CSS.supports("font-weight","600")&&P("600")},[]),n(()=>{document.documentElement.style.setProperty("--yt-bundle-font-weight",F)},[F]),n(()=>{if(S&&!E?.some(e=>e.node.id===S)){const e=E.find(e=>k(e.node.id)>0)?.node.id||E[0]?.node?.id;e&&$(e)}},[S,E,k]);const _=o.variants&&o.variants.edges?.length>1&&"customOptions"!==v,R="undefined"!=typeof window?(window?.ytapp||window?.ytBundleApp)?.storeId:void 0,O="53933408435"===R,L="75851235630"===R,j=(e=>{if(e.metafield&&"yourtoken_bundles_app"===e.metafield.namespace&&"categories"===e.metafield.key){if(e.metafield.jsonValue&&Array.isArray(e.metafield.jsonValue))return e.metafield.jsonValue;if(e.metafield.value)try{const t=JSON.parse(e.metafield.value);if(Array.isArray(t))return t}catch(e){console.error("Failed to parse categories:",e)}}return[]})(o),M=j.length>0;return e.createElement(e.Fragment,null,e.createElement(Vl,{borderRadius:h?.byob.borderRadius,borderColor:h?.byob.borderColor,shadowType:h?.byob.shadowType,backgroundColor:h?.byob.cardBackgroundColor,className:"yt-byob-product-container bundle-builder-product-container "+(p?"yt-product-card-transition-active":m%2==0?"yt-product-card-transition":"yt-product-card-transition-up"),onClick:()=>{if(A<=0)return;const e={...o,variants:{...o.variants,edges:E},selectedVariant:D};y(e)},onMouseEnter:e=>{e.currentTarget.style.transform="scale(1.01)"},onMouseLeave:e=>{e.currentTarget.style.transform="scale(1)"},style:{WebkitTapHighlightColor:"transparent",textAlign:h?.byob?.productCardDetailsAlignment||"left"}},e.createElement(Wl,{className:"yt-byob-image-wrapper"},e.createElement(Qc,{product:o,styles:h,selectedVariant:D}),r?.productCardBadgeText&&e.createElement("div",{className:"yt-byob-product-badge",style:{position:"absolute",top:"0px",left:"0px",backgroundColor:h?.general.primaryColor||"#111",color:h?.general.primaryContrastColor||"#fff",zIndex:1,margin:"0px",whiteSpace:"pre",padding:"4px 8px",fontSize:"12px",borderTopLeftRadius:h.byob.borderRadius}},r.productCardBadgeText),_&&e.createElement("div",{className:"yt-byob-variant-selector-wrapper",style:{position:"relative",width:"100%"}},e.createElement(Hl,{className:"yt-byob-variant-selector",isCoralHaze:O,onClick:e=>{e.preventDefault(),e.stopPropagation()},value:S||"",onChange:e=>{e.stopPropagation(),e.preventDefault(),$(e.target.value)}},E?.map(t=>{const n=window.innerWidth<=320?10:window.innerWidth<=420?15:22,o=t.node.title.length>n?t.node.title.substring(0,n)+"...":t.node.title;return e.createElement("option",{key:t.node.id,value:t.node.id},o)})),e.createElement("div",{className:"yt-byob-variant-chevron",style:{position:"absolute",right:"16px",bottom:"10px",pointerEvents:"none"}},e.createElement(b,null)))),e.createElement("div",{className:"yt-byob-product-content"},"enabled"===r?.customizations?.byob?.productCardCategoryVisibility&&M&&e.createElement("div",{className:"yt-byob-product-categories-wrapper",style:{padding:"2px 4px"}},e.createElement("div",{className:"yt-byob-product-categories",style:{display:"flex",flexWrap:"wrap",gap:"4px"}},j.slice(0,2).map((t,n)=>e.createElement("span",{className:"yt-byob-category-tag",key:n,style:{fontSize:z?"8px":"12px",color:"#666",fontWeight:"500"}},t.charAt(0).toUpperCase()+t.slice(1))),j.length>2&&e.createElement("span",{className:"yt-byob-more-categories",style:{fontSize:"10px",padding:"2px 6px",backgroundColor:"rgba(0, 0, 0, 0.05)",borderRadius:"8px",color:"#666",fontWeight:"500"}},"+",j.length-2," more"))),e.createElement(ql,{isMobile:z,showBorder:r?.showBorder??!0,style:{...!h?.byob.productsPriceVisibility&&{padding:"8px"},...h?.byob.productTitleFontSize&&{fontSize:h?.byob.productTitleFontSize||"18px"}},className:"yt-byob-product-title-wrapper"},e.createElement("div",{style:{display:"-webkit-box",WebkitLineClamp:h?.byob?.productTitleWrapLines||2,WebkitBoxOrient:"vertical",overflow:"hidden",lineHeight:"normal"},className:"yt-byob-product-title"},L?String(D?.displayName).replace("- Default Title",""):o.title,D?.commonSuffix?" -"+D?.commonSuffix:""))),"Default Title"!==D?.title&&h?.byob?.showVariantTitleInCard&&e.createElement("p",{style:{padding:r?.showBorder??1?"0px 10px":"0 4px",fontSize:"12px",margin:"0",fontWeight:"600",color:"#888",lineHeight:"normal"},className:"yt-byob-product-variant-title"},D?.title),"ratingOnly"===r?.reviewRatingType&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(he,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6}},o?.rating?.averageRating," rating")),"ratingAndReviewCount"===r?.reviewRatingType&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(he,{color:"gold",size:14})," ",o?.rating?.averageRating,e.createElement(me,{className:"yt-byob-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",o?.rating?.ratingCount," reviews)"),h?.byob.productsPriceVisibility&&e.createElement("div",{className:"yt-byob-product-price yt-bundle-builder-product-price",style:{marginBottom:"5px",padding:r?.showBorder?"0px 10px":"0 4px"}},x?.isFreebieTier&&!f?e.createElement(e.Fragment,null,e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"14px",textDecoration:"line-through",color:"#888",marginRight:"6px"}},Pp(h.general.currencySymbol,r?.storeCurrencyCode)??"Rs.",Fp(D?.price)),e.createElement("span",{className:"yt-byob-current-price",style:{color:h.general.primaryColor||"#d32f2f",fontWeight:"bold"}},"FREE")):parseFloat(D?.price??"0")>0?e.createElement("span",{className:"yt-byob-current-price"},Pp(h.general.currencySymbol,r?.storeCurrencyCode)??"Rs.",Fp(D?.price)):e.createElement("span",{className:"yt-byob-free-price"},"Free"),(!x?.isFreebieTier||f)&&D?.compareAtPrice&&h?.byob.compareAtPriceVisibility&&parseFloat(D.compareAtPrice)>parseFloat(D?.price)&&e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"14px"}},Pp(h.general.currencySymbol,r?.storeCurrencyCode)??"Rs.",Fp(D.compareAtPrice))),(A>0||A===1/0)&&e.createElement(Ql,{borderRadius:h?.byob.borderRadius,className:"yt-byob-add-to-bundle-wrapper yt-product-atc-wrapper"},(0===B||void 0===B)&&e.createElement(jl,{style:{...!l&&{backgroundColor:h?.general.primaryColor||"#111",color:h?.general.primaryContrastColor||"#fff"}},disabled:l,onClick:e=>{e.stopPropagation(),e.preventDefault(),I(1),(()=>{if(!S)return;"customOptions"===v&&E.length>1?C(!0):a(S,o,1)})()},className:"yt-byob-add-to-bundle-button yt-product-atc-button"},h?.byob.addToBundleCTAText),!r?.disableQuantitySelector&&B>0&&S&&e.createElement(Ml,{className:"yt-byob-quantity-selector-container visible",style:{overflow:"hidden"}},e.createElement(qc,{remainingQuantity:c,setQuantity:I,quantity:B,handleAddToBundle:a,variantId:S,product:o,handleRemoveItem:s,hideAddToBundle:l,selectedVariantInventoryQty:A})),r?.disableQuantitySelector&&B>0&&S&&e.createElement(jl,{style:{backgroundColor:"#747474",color:h?.general.primaryContrastColor||"#fff",display:"flex",justifyContent:"space-between",overflow:"hidden",height:"40px"},className:"yt-byob-added-button yt-product-atc-single-qty-selector"},e.createElement(Ul,{className:"yt-byob-added-text yt-product-atc-single-qty-selector-added"},"ADDED"),e.createElement(Yl,{className:"yt-byob-single-qty-remove yt-product-atc-single-qty-selector-remove",onClick:e=>{e.stopPropagation();const t=Math.max(0,B-1);I(t),s&&S&&s(S,1)}},e.createElement(ze,{style:{color:"#fff",fontSize:"20px"}})))),A<=0&&A!==1/0&&e.createElement(jl,{style:{backgroundColor:h.general.disabledButtonColor,color:"#fff",cursor:"not-allowed",transition:"transform 0.2s ease-in-out"},className:"yt-product-atc-disabled"},h?.general.outOfStockLabel||"Out of Stock")),"customOptions"===v&&w&&E.length>1&&e.createElement(Oc,{product:o,isOpen:w,onClose:()=>C(!1),variantOptions:r.variantOptions,cta:{textColor:h.general.ctaTextColor,backgroundColor:h.general.primaryColor},onConfirm:e=>{$(e),a(e,o,1)}}))},Yc=({currentStep:t,setCurrentProductTier:n,totalSteps:o,tiers:r,isMobile:i,selectedProductsByTier:a,primaryColor:l="#000",primaryTextColorCta:c="#fff",tierNavigation:d})=>e.createElement("div",{className:"yt-byob-stepper-container",style:{textAlign:"center",fontSize:"20px"}},e.createElement("div",{className:"yt-byob-stepper-steps",style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"center"}},Array.from({length:o}).map((c,s)=>{const p=s+1,m=r[s].minimumQuantity-(a[s]?.length??0)===0,u=s===t;return l="black"===l?"#000000":l,e.createElement(e.Fragment,{key:p},e.createElement("div",{className:"yt-byob-stepper-step-wrapper",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:"pointer",gap:i?"4px":"8px"},onClick:()=>!1===d?()=>{}:n(p-1)},e.createElement("div",{className:"yt-byob-stepper-step-number",style:{fontSize:"14px"}},"Step ",p),e.createElement("div",{className:"yt-byob-stepper-step-bar",style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"center",cursor:"pointer"}},e.createElement("div",{className:"yt-byob-stepper-step-left-bar",style:{height:"3px",width:i?"30px":"50px",backgroundColor:m?l:u?"#666666":"#CBD5E0",display:"block",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px"}}),e.createElement("div",{className:"yt-byob-stepper-step-circle",style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:m?`${l}50`:"white",border:`2px solid ${m?l:u?"#666666":"#CBD5E0"}`,display:"flex",alignItems:"center",justifyContent:"center"}}),e.createElement("div",{className:"yt-byob-stepper-step-right-bar",style:{height:"3px",width:i?"30px":"50px",backgroundColor:m?l:u?"#666666":"#CBD5E0",display:"block",marginRight:s<o?i?"4px":"6px":"",borderTopRightRadius:"5px",borderBottomRightRadius:"5px"}}))))})),e.createElement("div",{className:"yt-byob-stepper-title",style:{margin:i?"16px 0px":"15px 0px",fontSize:i?"16px":"18px",padding:"4px",background:"rgba(0, 0, 0, 0.03)",borderBottom:"1px solid rgba(130, 130, 130, 0.28)"}},r[t]?.title)),Gc=({styles:t,isMobile:n,categories:o,activeCategory:r,onCategoryChange:i})=>{const a=e=>{i(e)},l=(e,t)=>{const n=e.replace("#","");return`rgba(${parseInt(n.substring(0,2),16)}, ${parseInt(n.substring(2,4),16)}, ${parseInt(n.substring(4,6),16)}, ${t})`};return"tabs"===t?.byob?.categoryFilterOnPage?e.createElement("div",{className:"yt-byob-category-filter-wrapper",style:{overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",width:"100%"}},e.createElement("div",{className:"yt-byob-category-tabs-container",style:{display:"flex",gap:"0px",minWidth:"max-content",paddingBottom:"1px",flexWrap:"nowrap",justifyContent:"center",borderBottom:"1px solid #e0e0e0",width:"auto",height:n?"28px":"45px"}},["All",...o].map(o=>{const i=r===o;return e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-byob-category-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:i?"600":"400",color:i?t.general.primaryColor:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:i?l(t.general.primaryColor,.07):"transparent",borderBottom:i?`2px solid ${t?.general.primaryColor}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:e=>{i||(e.currentTarget.style.color=t?.general.primaryColor)},onMouseLeave:e=>{i||(e.currentTarget.style.color="#666")}},e.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},o.charAt(0).toUpperCase()+o.slice(1)),e.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},o.charAt(0).toUpperCase()+o.slice(1)))}))):e.createElement("div",{className:"yt-byob-category-filter-wrapper",style:{overflowX:n?"auto":"visible",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",paddingBottom:"5px"}},e.createElement("div",{className:"yt-byob-category-buttons-container",style:{display:"flex",gap:"8px",minWidth:"max-content",flexWrap:"nowrap",justifyContent:"center",paddingRight:n?"10px":"0px"}},["All",...o].map(o=>e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-byob-category-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${r===o?t?.general.primaryColor:"#e0e0e0"}`,borderRadius:t?.general.ctaBorderRadius,backgroundColor:r===o?t?.general.primaryColor:"white",color:r===o?"white":"#333",cursor:"pointer",transition:"all 0.3s ease",outline:"none",whiteSpace:"nowrap",minWidth:"fit-content",flexShrink:0},onMouseEnter:e=>{r!==o&&(e.currentTarget.style.borderColor=t?.general.primaryColor,e.currentTarget.style.color=t?.general.primaryColor)},onMouseLeave:e=>{r!==o&&(e.currentTarget.style.borderColor="#e0e0e0",e.currentTarget.style.color="#333")}},o.charAt(0).toUpperCase()+o.slice(1)))))},Xc=(e,t)=>{const n=[],o=e=>!t||0===t.length||t.includes(e);let r=0,i=0;e.forEach(e=>{const t=e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id)),n=t?.some(e=>e.node.availableForSale);n?r++:i++}),o("Availability")&&n.push({id:"filter.v.availability",label:"Availability",type:"LIST",values:[{id:"filter.v.availability.1",label:"In stock",count:r,input:'{"available":true}'},{id:"filter.v.availability.0",label:"Out of stock",count:i,input:'{"available":false}'}]});let a=0;e.forEach(e=>{const t=e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id));t?.forEach(e=>{const t=parseFloat(e.node.price);t>a&&(a=t)})}),o("Price")&&n.push({id:"filter.v.price",label:"Price",type:"PRICE_RANGE",values:[{id:"filter.v.price",label:"Price",count:e.length,input:JSON.stringify({price:{min:0,max:a}})}]});const l={};e.forEach(e=>{const t=e.productDetails.productType;t&&(l[t]=(l[t]||0)+1)}),Object.keys(l).length>0&&o("Product Type")&&n.push({id:"filter.p.product_type",label:"Product Type",type:"LIST",values:Object.entries(l).map(([e,t])=>({id:`filter.p.product_type.${e}`,label:e,count:t,input:JSON.stringify({productType:e})}))});const c={};e.forEach(e=>{const t=e.productDetails.vendor;t&&(c[t]=(c[t]||0)+1)}),Object.keys(c).length>0&&o("Vendor")&&n.push({id:"filter.p.vendor",label:"Vendor",type:"LIST",values:Object.entries(c).map(([e,t])=>({id:`filter.p.vendor.${e}`,label:e,count:t,input:JSON.stringify({vendor:e})}))});const d={};e.forEach(e=>{e.productDetails.tags?.forEach(e=>{e&&(d[e]=(d[e]||0)+1)})}),Object.keys(d).length>0&&o("Tags")&&n.push({id:"filter.p.tag",label:"Tag",type:"LIST",values:Object.entries(d).map(([e,t])=>({id:`filter.p.tag.${e}`,label:e,count:t,input:JSON.stringify({tag:e})}))});const s={};return e.forEach(e=>{(e.productDetails.options||[]).forEach((t,n)=>{if("Title"===t.name)return;s[t.name]||(s[t.name]={});const o=e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id))||[];t.values?.forEach(e=>{void 0===s[t.name][e]&&(s[t.name][e]=0);o.some(t=>(t.node.title.split(" / ")[n]||t.node.title).toLowerCase()===e.toLowerCase())&&s[t.name][e]++})})}),o("Variant Options")&&Object.entries(s).forEach(([e,t])=>{const o=Object.entries(t).filter(([e,t])=>t>0).map(([t,n])=>({id:`${e.toLowerCase()}.${t}`,label:t,count:n,input:JSON.stringify({variantOption:{name:e,value:t}})}));o.length>0&&n.push({id:`filter.v.option.${e.toLowerCase()}`,label:e,type:"LIST",values:o})}),n},Zc=({bundle:a,selectedItems:l,setSelectedItems:c,handleAddToCart:d,bundleAddToCartLoading:s,renderingOnPage:p,selectedItemsQuantity:m,handleRemoveItem:u,bundleSubtotal:g,dispatchAnalyticsEvent:x,fetchStoreDetails:f})=>{const[y,b]=t(void 0),[h,v]=t(window.innerWidth<450),[w,C]=t(0),[E,k]=t({}),T=a.builderTiers?.type,S=a.customizations,$=a.builderTiers?.productTier??[],B=a.builderTiers?.offerTier??[],[I,z]=t([]),[N,F]=t(!1),[P,D]=t("All"),[A,_]=t(0),R=r(null),[O,L]=t({}),[j,M]=t([]),[V,W]=t(!1),[H,q]=t(0),[Q,U]=t(0),[Y,G]=t({}),X=e=>{G(t=>{const n=!1!==t[e];return{...t,[e]:!n}})};n(()=>{j.length>0&&G(e=>{const t={...e};return j.forEach(e=>{void 0===t[e.id]&&(t[e.id]=!1)}),t})},[j]);const Z=a.customStoreDetails?.fixedInventoryDetails;n(()=>{const e=new Set;let t=!1;a?.products?.forEach(n=>{const o=n.productDetails;if(o.metafield&&"yourtoken_bundles_app"===o.metafield.namespace&&"categories"===o.metafield.key){let n=[];if(o.metafield.jsonValue&&Array.isArray(o.metafield.jsonValue))n=o.metafield.jsonValue;else if(o.metafield.value)try{const e=JSON.parse(o.metafield.value);Array.isArray(e)&&(n=e)}catch(e){console.error("Failed to parse categories:",e)}n.length>0&&(t=!0,n.forEach(t=>e.add(t)))}}),z(Array.from(e)),F(t);S?.byob?.productFiltersDisplay&&"none"!==S?.byob?.productFiltersDisplay&&(async()=>{const e=S?.byob?.filtersProvider??"products-data",t=S?.byob?.selectedFilterOptions;if("search-and-discovery-app-sync"===e)try{const e=await(f?.());e?.productFilters&&M(e.productFilters??[])}catch(e){M(Xc(a.products,t))}else M(Xc(a.products,t))})()},[a.products,S?.byob,f]),n(()=>{L({})},[w,P]);const K=((e,t)=>"All"===t?e:e.filter(e=>{const n=e.productDetails;if(n.metafield&&"yourtoken_bundles_app"===n.metafield.namespace&&"categories"===n.metafield.key){let e=[];if(n.metafield.jsonValue&&Array.isArray(n.metafield.jsonValue))e=n.metafield.jsonValue;else if(n.metafield.value)try{const t=JSON.parse(n.metafield.value);Array.isArray(t)&&(e=t)}catch(e){console.error("Failed to parse categories:",e)}return e.includes(t)}return!1}))(a.products.filter(e=>"active"===e.productDetails.status?.toLowerCase()||"unlisted"===e.productDetails.status?.toLowerCase()||void 0===e.productDetails.status||""===e.productDetails.status),P),ee="productTier"===T?$.reduce((e,t)=>e+t.minimumQuantity,0):"offerTier"===T?B.reduce((e,t)=>e+t.minimumQuantity,0):a.minimumQuantity,te=i((e,t)=>{const n=Z?.find(e=>e.variantId===t)?.quantity;if(void 0!==n)return n;const o=(e.variants?.edges||[]).find(e=>e.node.id===t),r=o?.node;return r?e.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?1/0:0:1/0:0},[Z]),[ne,oe]=t(3e3);n(()=>{let e=0;a.products.forEach(t=>{const n=Number(t.productDetails.variants?.edges?.[0]?.node?.price||0);n>e&&(e=n)}),oe(100*Math.ceil(e/100)||5e3)},[a.products]);const[re,ie]=t(""),[ae,le]=t(""),ce=((e,t)=>e.filter(e=>e?.productDetails?.title?.toLowerCase().includes(t?.toLowerCase())))(K,re),de=((e,t)=>[...e].sort((e,n)=>{const o=e?.productDetails?.title?.toLowerCase(),r=n?.productDetails?.title?.toLowerCase(),i=parseFloat(e?.productDetails?.variants?.edges?.[0]?.node?.price||"0"),a=parseFloat(n?.productDetails?.variants?.edges?.[0]?.node?.price||"0");switch(t){case"title-asc":return o.localeCompare(r);case"title-desc":return r.localeCompare(o);case"price-low-to-high":return i-a;case"price-high-to-low":return a-i;default:return 0}}))(ce,ae),se=de.filter(e=>((e,t,n,o)=>{if(0===Object.keys(t).length)return!0;for(const[r,i]of Object.entries(t)){if(0===i.length)continue;const a=n.find(e=>e.id===r);if(!a)continue;let l=!1;if("filter.v.price"===r){const n=t[r][0];if(!n)continue;const[o,i]=n.split("-"),a=parseFloat(o.replace("min:",""))||0,c="max:∞"===i?1/0:parseFloat(i.replace("max:",""))||1/0;(e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id))||[]).some(e=>{const t=Number(e.node.price||0);return t>=a&&t<=c})&&(l=!0)}else for(const t of i){const n=a.values.find(e=>e.id===t);if(n)try{const t=JSON.parse(n.input);if(void 0!==t.available){const n=e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id))||[];if(!0===t.available){if(n.some(t=>o(e.productDetails,t.node.id)>0)){l=!0;break}}else if(!1===t.available&&n.every(t=>0===o(e.productDetails,t.node.id))){l=!0;break}}else if(t.productType){if(e.productDetails.productType===t.productType){l=!0;break}}else if(t.vendor){if(e.productDetails.vendor===t.vendor){l=!0;break}}else if(t.tag){if(e.productDetails.tags?.includes(t.tag)){l=!0;break}}else if(t.variantOption){const{name:n,value:o}=t.variantOption,r=e.productDetails.options?.findIndex(e=>e.name===n);if(void 0!==r&&-1!==r){if((e.productDetails.variants?.edges?.filter(t=>e.variantIds.includes(t.node.id))||[]).some(e=>{const t=(e.node.title||"").split(" / ")[r]||e.node.title;return t?.toLowerCase()===o.toLowerCase()})){l=!0;break}}}}catch(e){console.warn("Bad filter input",n.input)}}if(!l)return!1}return!0})(e,O,j,te)),pe=((e,t,n,o,r)=>(e[r]?.products.filter(e=>t.some(t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0]))&&t?.productDetails.title.toLowerCase().includes(n?.toLowerCase())))||[]).sort((e,n)=>{let r=t.find(t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0]))),i=t.find(e=>e.productId===n.productId&&(n.variantIds.length<1||e.variantIds.includes(n.variantIds[0])));if(!r||!i)return 0;const a=r.productDetails?.title?.toLowerCase(),l=i.productDetails?.title?.toLowerCase(),c=parseFloat(r?.productDetails?.variants?.edges?.[0]?.node?.price||"0"),d=parseFloat(i?.productDetails?.variants?.edges?.[0]?.node?.price||"0");switch(o){case"title-asc":return a.localeCompare(l);case"title-desc":return l.localeCompare(a);case"price-low-to-high":return c-d;case"price-high-to-low":return d-c;default:return 0}}))($,se,re,ae,w);n(()=>{console.log("appliedFilters",O)},[O]),n(()=>{console.log("appfilteredByShopifyFilters",se)},[se]);const[me,ue]=J(Nc),[ge,xe]=t(!1),fe="productTier"===T?pe:se,ye=fe.slice(0,20*(A+1));n(()=>{x?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:a?._id,bundleType:"byob-page-bundle",byobBundleType:a.builderTiers?.type??"builder"}}),setTimeout(()=>{xe(!0)},100)},[]);const be=r(null);n(()=>{const e=()=>{v(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{if(a.coverImageUrl){const e=new Image;e.src=Dp(a.coverImageUrl)??"",e.onload=()=>{b(e.width/e.height)}}},[a.coverImageUrl]),n(()=>{xe(!1),setTimeout(()=>xe(!0),100)},[w]);const he=(e,t)=>{if("productTier"===T){let n={...E},o=!1;if(n[t]){const r=n[t].indexOf(e);-1!==r&&(n[t]=[...n[t]],n[t].splice(r,1),o=!0)}if(!o)for(let t=$.length;t>=0;t--){const o=n[t].indexOf(e);if(-1!==o){n[t]=[...n[t]],n[t].splice(o,1);break}}k(n);const r=$.findIndex((e,t)=>n[t]?.length<e.minimumQuantity);-1!==r&&C(r)}u(e)},ve=()=>{const e=document.querySelector(".products-display");e&&e.scrollIntoView({behavior:"smooth"})};n(()=>{if("productTier"===T){const e=Object.fromEntries($.map(e=>[e.tier,[]]));k(e)}},[a]),n(()=>{if("productTier"!==T||!$[w])return;if(ee===m)return;const e=$.findIndex((e,t)=>{const n=E[t]||[];return t>=w&&n.length<e.minimumQuantity});-1!==e&&e!==w&&(C(e),ve())},[E,$,T]),n(()=>{ie("")},[w]),n(()=>{function e(e){if(!be.current||!e.target)return;!be.current.contains(e.target)&&ue(void 0)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const we=(e,t,n)=>{var o;"productTier"===T&&(o=e,k(e=>{const t={...e},n=$.findIndex((e,n)=>{const o=t[n]||[];return n>=w&&o.length<e.minimumQuantity});return-1!==n&&C(n),t[n]||(t[n]=[]),t[n].push(o),t}));const r=!0===$[w]?.isFreebieTier;x?.({eventNameCustom:"byob_add_to_bundle",eventTypeCustom:"clicks",data:{bundleId:a._id,bundleType:"byob-page-bundle",byobBundleType:a.builderTiers?.type??"builder",addedProduct:{id:t?.id,title:t?.title}}}),Ap(e,t,n,l,c,r)},Ce=(()=>{if(!a?.builderTiers)return a.minimumQuantity;const{type:e,offerTier:t,productTier:n}=a.builderTiers,o="offerTier"===e?t:"productTier"===e?n:null;if(!o)return a.minimumQuantity;let r=0;return o.map(e=>{r+=e.minimumQuantity}),r})(),Ee=h&&a.mobileCoverImageUrl?Dp(a.mobileCoverImageUrl):Dp(a.coverImageUrl??"")||null,ke=i(e=>{const t=S?.general?.showOutOfStockProducts;if(t)return!0;const n=e.productDetails,o=n?.variants?.edges||[];if(Z){if(o.some(e=>Z.some(t=>t.variantId===e.node.id&&t.quantity>0)))return!0}return o.some(e=>te(n,e.node.id)>0)},[S?.general?.showOutOfStockProducts,Z,te]);n(()=>{if("productTier"!==T)return;const e=$[w];if(!e)return;if(1!==e.minimumQuantity)return;if(1!==e.products.length)return;const t=e.products[0],n=a.products.find(e=>e.productId===t.productId)?.productDetails;if(!n)return;if(n.variants?.edges?.length>1)return;const o=n.variants?.edges?.find(e=>te(n,e.node.id)>0)?.node;if(!o)return;const r=o.id,i=E[w]?.includes(r);i||(we(r,n,1),w<$.length-1&&(C(w+1),ve()))},[T,$,w,a.products,E,te,we]);const Te=o(()=>K.filter(e=>{const t=e.productDetails;return(t.variants?.edges||[]).some(e=>te(t,e.node.id)>0)}).length,[K,te]),Se=o(()=>K.length-Te,[K,Te]),$e="bundles"==a.appName?a.pageHeader?.title:a?.title,Be="bundles"==a.appName?a.pageHeader?.description:a?.subtitle;n(()=>{_(0)},[re,ae,P,w,O]);const Ie=i(()=>{ye.length<fe.length&&_(e=>e+1)},[ye.length,fe.length]);n(()=>{const e=new IntersectionObserver(([e])=>{e.isIntersecting&&Ie()},{threshold:.1});return R.current&&e.observe(R.current),()=>{R.current&&e.unobserve(R.current)}},[Ie]);const ze=()=>{x?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:a._id,bundleType:"byob-page-bundle",byobBundleType:a.builderTiers?.type??"builder",selectedProducts:l.map(e=>({id:e?.product?.id,title:e?.product?.title,quantity:e?.quantity}))}})};return e.createElement(e.Fragment,null,e.createElement("div",{style:{display:"flex",flexDirection:"column",width:"100%",alignItems:"center",justifyContent:"center",rowGap:"15px",padding:"20px 0px",marginBottom:"20px",backgroundColor:S.byob.sectionBackgroundColor,..."transparent"!==S.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},Ee?e.createElement("div",{style:{position:"relative",width:"100%",display:"flex",justifyContent:"center",alignItems:"center",textAlign:"center",overflow:"hidden",...a?.coverImageVerticalMargin&&{marginBottom:a?.coverImageVerticalMargin,marginTop:a?.coverImageVerticalMargin}}},Ee&&e.createElement(Lc,{coverImageUrl:Ee,alt:"Background",styles:{width:"100%",height:"auto",display:"block"}}),e.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",width:"90%",maxWidth:"1000px",textShadow:"2px 2px 8px rgba(0, 0, 0, 0.4)"}},e.createElement("span",{style:{lineHeight:"normal",fontSize:S?.byob?.titleFontSize??"3rem",fontWeight:"700",color:S?.byob?.titleTextColor??"#000",marginBottom:"15px",backgroundColor:S?.byob?.titleBackgroundColor??"transparent",width:"100%",textAlign:"center"},className:"bundle-builder-title"},$e),e.createElement("span",{style:{lineHeight:"normal",fontSize:S?.byob?.subtitleFontSize??"1.5rem",color:S?.byob?.titleTextColor??"#000"},className:"bundle-builder-subtitle"},Be))):($e||Be)&&e.createElement("div",{style:{zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",width:"90%",maxWidth:"1000px"}},$e&&e.createElement("span",{style:{lineHeight:"normal",fontSize:S?.byob?.titleFontSize??"3rem",fontWeight:"700",color:S?.byob?.titleTextColor??"#000",marginBottom:"15px",textAlign:"center",width:"100%",backgroundColor:S?.byob?.titleBackgroundColor??"transparent"}},$e),Be&&e.createElement("span",{style:{lineHeight:"normal",fontSize:S?.byob?.subtitleFontSize??"1.5rem",color:S?.byob?.titleTextColor??"#000"}},Be)),e.createElement("div",{style:{fontSize:"20px",width:"100%"},className:"products-display"},"productTier"===T&&$.length>0&&S?.byob.productTiersVisibility&&e.createElement(e.Fragment,null,e.createElement("div",null,e.createElement(Yc,{currentStep:w,totalSteps:$.length,tiers:$,isMobile:h,primaryColor:S?.general?.primaryColor,primaryTextColorCta:S?.general?.primaryContrastColor,setCurrentProductTier:C,selectedProductsByTier:E,tierNavigation:S.byob.tierNavigation})))),e.createElement("div",{style:{display:"flex",flexDirection:"row",width:h?"100%":"90%",marginInline:"auto"}},"sidebar"===S?.byob?.productFiltersDisplay&&!h&&e.createElement(Wc,{showFiltersDrawer:V,handleClose:()=>W(!1),isAnimating:!1,isMobile:!1,availableFilters:j,appliedFilters:O,toggleFilter:(e,t)=>{L(n=>{const o=n[e]||[],r=o.includes(t)?o.filter(e=>e!==t):[...o,t],i={...n,[e]:r.length?r:void 0};return Object.fromEntries(Object.entries(i).filter(([,e])=>void 0!==e))})},clearAllFilters:()=>{L({}),U(0),q(ne)},applyPriceFilter:()=>{L(e=>{const t={...e};return t["filter.v.price"]=[`min:${Q}-max:${H}`],t})},priceMin:Q,setPriceMin:U,priceMax:H,setPriceMax:q,maxPossiblePrice:ne,styles:S,products:a.products,unavailableProductCount:Se,storeCurrencyCode:a?.storeCurrencyCode,openSections:Y,toggleSection:X}),e.createElement("div",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0}},e.createElement("div",{style:{width:"100%",marginBottom:"20px",display:"flex",flexDirection:"column",gap:"20px"}},e.createElement(Hc,{enableSortAndFilter:a?.enableSortAndFilter??!1,isMobile:h,searchTerm:re,setSearchTerm:ie,setSortBy:le,styles:S,appliedFilters:O,setAppliedFilters:L,availableFilters:j,products:a.products,availableProductCount:Te,unavailableProductCount:Se,maxPossiblePrice:ne,storeCurrencyCode:a?.storeCurrencyCode,sharedFiltersState:{showFilters:V,setShowFilters:W,priceMax:H,setPriceMax:q,priceMin:Q,setPriceMin:U},openSections:Y,toggleSection:X}),a?.customizations?.byob?.enableProductCategories&&N&&e.createElement("div",null,e.createElement(Gc,{styles:S,isMobile:h,categories:I,activeCategory:P,onCategoryChange:e=>{D(e)}}))),e.createElement("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"12px",justifyContent:V&&"sidebar"===S?.byob?.productFiltersDisplay?"flex-start":"center",width:"100%",height:"fit-content",paddingBottom:p?"100px":"20px"},className:"products-display"},0===fe?.length?e.createElement("p",{style:{fontSize:"20px",color:"#333",textAlign:"center",width:"100%"}},"No products found"):"productTier"===T&&$.length>0?ye.filter(e=>ke(se.find(t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0]))))).map((t,n)=>{const o=($[w]?.minimumQuantity??0)>(E[w]?.length??0),r=se.find(e=>e.productId===t.productId&&(t.variantIds.length<1||e.variantIds.includes(t.variantIds[0])));return r?e.createElement(Uc,{bundle:a,idx:n,key:t?.variantIds?.[0]??t.productId,product:r?.productDetails,handleAddToBundle:we,hideAddToBundle:!o,remainingQuantity:Ce-m,themeColor:a?.dealTextColor,handleRemoveItem:e=>he(e,w),selecteditems:l,transitionActive:ge,customVariantsQuantity:Z,currentProductTier:$[w],showFreebieTierProductPrices:a?.customStoreDetails?.showFreebieTierProductPrices}):null}):ye.filter(ke).map((t,n)=>e.createElement(Uc,{bundle:a,idx:n,key:t.productId,product:t?.productDetails,handleAddToBundle:we,hideAddToBundle:m>=Ce,remainingQuantity:Ce-m,themeColor:a?.dealTextColor,handleRemoveItem:u,selecteditems:l,transitionActive:ge,customVariantsQuantity:Z})),ye.length<fe.length&&e.createElement("div",{ref:R,style:{height:"1px",width:"100%",display:"block"}})),!p&&e.createElement(zc,{builderTiers:a?.builderTiers,handleAddToCart:async e=>{await d(e),ze()},minimumQuantity:ee,selectedProducts:l,showProductDetailsInTracker:a.showProductDetailsInTracker,handleRemoveItem:u,handleRemoveItemProductTier:he,selectedItemsQuantity:m,percentageOff:a.percentageOff,loading:s,bundleSubtotal:g,amountOff:a.amountOff,styles:a.customizations,dealAmount:a.dealAmount,themeColor:a?.dealTextColor??"#333",primaryTextColorCta:a?.primaryTextColorCta??"#fff",cornerRadiusType:a?.cornerRadiusType??"",selectedProductsByTier:E,renderingOnPage:p}),p&&e.createElement("div",{style:{width:"100%",marginTop:"20px",position:"sticky",bottom:"10px",zIndex:999}},e.createElement(zc,{handleAddToCart:async e=>{await d(e),ze()},minimumQuantity:ee,builderTiers:a?.builderTiers,selectedProducts:l,showProductDetailsInTracker:a.showProductDetailsInTracker,loading:s,handleRemoveItem:u,handleRemoveItemProductTier:he,percentageOff:a.percentageOff,selectedItemsQuantity:m??0,bundleSubtotal:g??{price:0,compareAtPrice:0},amountOff:a.amountOff,styles:a.customizations,dealAmount:a.dealAmount,themeColor:S?.general.primaryColor||"#000",primaryTextColorCta:S.general.primaryContrastColor??"#fff",cornerRadiusType:a?.cornerRadiusType??"",selectedProductsByTier:E,renderingOnPage:p})))),me&&void 0!==m&&(()=>{let t=m<a.minimumQuantity;return"productTier"==T?t=($[w]?.minimumQuantity??0)>(E[w]?.length??0):"offerTier"==T&&(t=m<B.reduce((e,t)=>e+t.minimumQuantity,0)),e.createElement(_c,{handleAddToBundle:we,ref:be,remainingQuantity:a.minimumQuantity-m,hideAddToBundle:!t,disableQuantitySelector:a?.disableQuantitySelector??!1,selectedProducts:l,selectedProductsByTier:E,themeColor:S?.general.primaryColor||"#000",primaryTextColorCta:a?.customizations?.general.primaryContrastColor??"#fff",primaryBackgroundColorCta:S?.general.primaryColor||"#000",cornerRadius:a?.customizations.byob.borderRadius,styles:a.customizations,reviewRatingType:a?.reviewRatingType??"none",customVariantsQuantity:Z,bundleProductsCustomQuantity:a?.customProductsQuantity,isFreebieTier:$?.[w]?.isFreebieTier,showFreebieTierProductPrices:a?.customStoreDetails?.showFreebieTierProductPrices})})()))},Jc=({product:t,selectedVariantId:n,onVariantChange:r,styles:i,originalPrice:a,dealPrice:l,isVertical:c=!1,variantOptions:d,storeCurrencyCode:s})=>{const p=o(()=>e=>{const n=t?.productDetails?.variants?.edges?.find(t=>t.node.id===e),o=n?.node;return o?t.productDetails.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?1/0:0:1/0:0},[t.productDetails]),m=t?.productDetails?.variants?.edges?.find(e=>e?.node?.id===n)?.node;p(n);const u=o(()=>{if(m?.title&&t.productDetails.options){const e=m.title.split(" / ");if(e.length===t.productDetails.options.length)return e}return t.productDetails.options?.map(e=>e.values[0])||[]},[m,t.productDetails.options]),g=e=>{r(e)};return c?e.createElement("div",{className:"yt-comboBundle-product-card-vertical",style:{display:"flex",flexDirection:"column",alignItems:"center",lineHeight:"normal",width:"165px",backgroundColor:"#F6F6F6",borderRadius:"20px",border:"1px solid #B3B3B3",boxShadow:"4px 4px 0px -1px #00000033",overflow:"hidden"}},e.createElement("div",{className:"yt-comboBundle-product-card-image-container-vertical",style:{position:"relative",width:"100%"}},i.comboBundle.subProductsImageVisibility&&e.createElement(e.Fragment,null,e.createElement("img",{className:"yt-comboBundle-product-image-vertical",src:Dp(m?.image?.url||t?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg"),alt:t?.productDetails?.featuredMedia?.alt,width:165,height:165,style:{objectFit:"cover",borderRadius:"20px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",height:"100%",aspectRatio:i.general?.imageAspectRatio||"1/1"}}),e.createElement("div",{className:"yt-comboBundle-product-variant-selector-container-vertical",style:{marginTop:"8px",position:"absolute",bottom:"10px",left:"5px",right:"5px"}},t?.productDetails?.variants?.edges?.length>1&&e.createElement(e.Fragment,null,e.createElement("select",{className:"yt-comboBundle-product-variant-select-vertical",value:n,onChange:e=>g(e.target.value),style:{padding:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",width:"100%",appearance:"none",marginRight:"30px",fontSize:"12px",fontWeight:600}},t?.productDetails?.variants?.edges.map(t=>{const n=p(t?.node?.id);return e.createElement("option",{key:t?.node?.id,value:t?.node?.id,disabled:0===n,className:"yt-comboBundle-product-variant-option"},t?.node?.title)})),e.createElement("div",{className:"yt-comboBundle-product-variant-select-icon-vertical",style:{position:"absolute",right:"1px",top:"2px",bottom:"0px",pointerEvents:"none",backgroundColor:"#F3F3F3",width:"15%",height:"calc(100% - 4px)",display:"flex",justifyContent:"center",alignItems:"center"}},e.createElement(b,null)))))),(i.comboBundle.subProductsProductTitleVisibility||i.comboBundle.subProductsProductPriceVisibility)&&e.createElement("div",{className:"yt-comboBundle-product-info-container-vertical",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"40px",width:"100%",paddingBlock:"5px"}},i.comboBundle.subProductsProductTitleVisibility&&e.createElement("span",{className:"yt-comboBundle-product-title-vertical",style:{fontSize:"12px",color:"#333",fontWeight:"600",lineHeight:"normal",textAlign:"center",width:"fit-content"}},t?.productDetails?.title),i.comboBundle.subProductsProductPriceVisibility&&e.createElement("div",{className:"yt-comboBundle-product-price-container-vertical",style:{display:"flex",alignItems:"center",gap:"8px",lineHeight:"normal",fontSize:"14px"}},e.createElement("span",{className:"yt-comboBundle-product-deal-price-vertical",style:{lineHeight:"normal"}},Pp(i.general.currencySymbol,s),Fp((Number(m?.compareAtPrice?Number(m?.compareAtPrice):m?.price)/Number(a)*Number(l)).toFixed(2))),m?.compareAtPrice&&Number(m.compareAtPrice)>Number(m.price)&&e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},Pp(i.general.currencySymbol,s),m.compareAtPrice?Fp(m.compareAtPrice):Fp(m.price))))):e.createElement("div",{className:"yt-comboBundle-product-card-horizontal",style:{display:"flex",alignItems:"center",gap:"16px",padding:"4px",lineHeight:"normal",borderRadius:"8px",transition:"background-color 0.3s",width:"100%",border:"1px solid transparent",..."right"===i.comboBundle.infoAlignment&&{flexDirection:"row-reverse"},..."center"===i.comboBundle.infoAlignment&&{justifyContent:"center"}},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#fafafa",e.currentTarget.style.border="1px solid #DFDFDF"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent",e.currentTarget.style.border="1px solid transparent"}},i.comboBundle.subProductsImageVisibility&&e.createElement("div",{className:"yt-comboBundle-product-image-wrapper-horizontal"},e.createElement("img",{className:"yt-comboBundle-product-image-horizontal",src:Dp(m?.image?.url||t?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg"),alt:t?.productDetails?.featuredMedia?.alt,height:80,style:{objectFit:"cover",borderRadius:"10px",border:"1px solid #DEDEDE",aspectRatio:"1/1",width:"90px",height:"90px"}})),e.createElement("div",{className:"yt-comboBundle-product-info-horizontal",style:{display:"flex",flexDirection:"column",alignItems:"left"===i.comboBundle?.infoAlignment?"flex-start":"right"===i.comboBundle?.infoAlignment?"flex-end":"center"===i.comboBundle?.infoAlignment?"flex-start":void 0}},i.comboBundle.subProductsProductTitleVisibility&&e.createElement("span",{className:"yt-comboBundle-product-title-horizontal",style:{fontSize:"14px",fontWeight:"600",lineHeight:"normal",display:"flex",alignItems:"center",gap:"8px"}},e.createElement("span",{className:"yt-comboBundle-product-title-text"}," ",t?.productDetails?.title," "),"dropdown"!==i.comboBundle.comboVariantTypeSelector&&t.productDetails.variants.edges.length>1&&d&&u&&e.createElement("span",{className:"yt-comboBundle-product-variant-tag-horizontal",style:{fontSize:"10px",color:"#666",backgroundColor:"#F4F4F4",padding:"2px 8px",borderRadius:"10px",border:"1px solid #ddd"}},u.length>1?u.join(" / "):u)),i.comboBundle.subProductsProductPriceVisibility&&e.createElement("div",{className:"yt-comboBundle-product-price-wrapper-horizontal",style:{display:"flex",gap:"8px",marginTop:"5px",alignItems:"baseline"}},e.createElement("span",{className:"yt-comboBundle-product-deal-price-horizontal",style:{lineHeight:"normal"}},Pp(i.general.currencySymbol,s),Fp((Number(m?.compareAtPrice?Number(m?.compareAtPrice):m?.price)/Number(a)*Number(l)).toFixed(2))),m?.compareAtPrice&&Number(m.compareAtPrice)>Number(m.price)&&e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},Pp(i.general.currencySymbol,s),Fp(m?.compareAtPrice?m?.compareAtPrice:m?.price))),t.productDetails.variants.edges.length>1&&("dropdown"===i.comboBundle.comboVariantTypeSelector?e.createElement("div",{className:"yt-comboBundle-product-variant-dropdown-horizontal",style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},e.createElement("select",{className:"yt-comboBundle-product-variant-select-horizontal",value:n,onChange:e=>g(e.target.value),style:{padding:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",fontSize:"12px",fontWeight:600,borderRadius:"4px"}},t.productDetails.variants.edges.map(t=>{const n=p(t?.node?.id);return e.createElement("option",{key:t?.node?.id,value:t?.node?.id,disabled:0===n,className:"yt-comboBundle-product-variant-option"},t?.node?.title)})),e.createElement("div",{className:"yt-comboBundle-product-variant-select-icon-horizontal",style:{position:"absolute",right:"1px",top:"2px",bottom:"0px",pointerEvents:"none",backgroundColor:"#F3F3F3",width:"15%",height:"calc(100% - 4px)",display:"flex",justifyContent:"center",alignItems:"center"}},e.createElement(b,null))):t.productDetails.options.length>0?e.createElement(e.Fragment,null,t.productDetails.options.map((n,o)=>e.createElement("div",{key:n.name,className:"yt-comboBundle-product-option-group-horizontal",style:{...n?.values?.length>1&&{marginTop:"10px"},display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"}},t.productDetails.options.length>1&&n?.values?.length>1&&e.createElement("label",{className:"yt-comboBundle-product-option-label",style:{fontSize:"12px",fontWeight:"500",color:"#333"}},n.name,":"),n?.values?.length>1&&e.createElement("div",{className:"yt-comboBundle-product-option-values-horizontal",style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"}},n.values.map(r=>{const a=[...u];a[o]=r;const l=t.productDetails.options.length>0?a.join(" / "):a[o],c=t.productDetails.variants.edges.find(e=>e.node.title===l)?.node,s=0===(c?p(c.id):0),m=u[o]===r,x=d&&d?.options?.find(e=>e.name===n.name);return x&&"color"===x?.type?e.createElement("button",{key:r,className:`yt-comboBundle-product-option-button-color ${m?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&g(c.id)},disabled:s,style:{borderRadius:"50%",padding:"1px",backgroundColor:"white",border:m&&!s?`1px solid ${i.general?.ctaBackgroundColor}`:"1px solid transparent",opacity:s?.5:1,cursor:s?"not-allowed":"pointer"}},x?.values.find(e=>e.name===r)?.value?e.createElement("div",{className:"yt-comboBundle-product-option-color-swatch",style:{width:m&&!s?"26px":"24px",height:m&&!s?"26px":"24px",borderRadius:"50%",backgroundColor:x?.values.find(e=>e.name===r)?.value}},e.createElement("span",null)):e.createElement("span",{key:r,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:m&&!s?`1px solid ${i.general?.ctaBackgroundColor}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:m&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},r)):x&&"image"===x?.type?e.createElement("button",{key:r,className:`yt-comboBundle-product-option-button-image ${m?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&g(c.id)},disabled:s,style:{border:m&&!s?`1px solid ${i.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:m&&!s?"#F7F7F7":"transparent",cursor:s?"not-allowed":"pointer",padding:"0px",width:m&&!s?"26px":"24px",height:m&&!s?"26px":"24px",overflow:"hidden",opacity:s?.5:1}},x?.values.find(e=>e.name===r)?.value?e.createElement("img",{className:"yt-comboBundle-product-option-image",src:Dp(x?.values.find(e=>e.name===r)?.value||"/placeholder.svg"),alt:r,style:{width:m&&!s?"26px":"24px",height:m&&!s?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}}):e.createElement("span",{key:r,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:m&&!s?`1px solid ${i.general?.ctaBackgroundColor}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:m&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},r)):e.createElement("button",{key:r,className:`yt-comboBundle-product-option-button-text ${m?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&g(c.id)},disabled:s,style:{padding:"4px 8px",border:m&&!s?`1px solid ${i.general?.ctaBackgroundColor}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:m&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",cursor:s?"not-allowed":"pointer",fontSize:"10px",fontWeight:"600",opacity:s?.5:1}},r)}))))):e.createElement(e.Fragment,null,t?.productDetails?.variants?.edges?.length>1&&e.createElement("div",{className:"yt-comboBundle-product-variant-buttons-horizontal",style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},t?.productDetails?.variants?.edges.map(t=>{const o=0===p(t?.node?.id);return e.createElement("button",{key:t?.node?.id,className:`yt-comboBundle-product-variant-button ${n===t?.node?.id?"yt-comboBundle-product-variant-button-selected":""} ${o?"yt-comboBundle-product-variant-button-disabled":""}`,onClick:()=>g(t?.node?.id),disabled:o,style:{padding:"4px 8px",border:n===t?.node?.id?`1px solid ${i.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:n===t?.node?.id?"#F7F7F7":"transparent",color:o?"#ccc":"#707070",cursor:o?"not-allowed":"pointer",fontSize:"12px",fontWeight:"500",opacity:o?.5:1}},t?.node?.title)}))))))},Kc=({bundle:r,addToCartFunction:i,dispatchAnalyticsEvent:a})=>{const[l,c]=t(!1),[d,s]=t(window.innerWidth<786),p=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?1/0:0:1/0:0},[]),[m,u]=t(()=>{const e={};return r.products.forEach((t,n)=>{const o=t.productDetails?.variants?.edges?.find(e=>p(t.productDetails,e?.node?.id)>0)?.node;e[n]=o?o.id:t?.productDetails?.variants?.edges[0]?.node?.id}),e});n(()=>(i&&(window.ytComboBundle={bundle:r,addToCart:i,selectedVariants:m},window.dispatchEvent(new CustomEvent("yt-combo-bundle-updated",{detail:window.ytComboBundle}))),()=>{window.ytComboBundle=void 0,window.dispatchEvent(new CustomEvent("yt-combo-bundle-updated",{detail:void 0}))}),[r,i,m]);const g=r.products?.every((e,t)=>{const n=m[t];return p(e.productDetails,n)>0}),x=(e,t)=>{u(n=>({...n,[e]:t}))},{originalPrice:f,dealPrice:y,offerValue:b}=o(()=>{const{price:e,compareAtPrice:t}=Object.entries(m).reduce((e,[t,n])=>{const o=r.products[parseInt(t)],i=o.productDetails.variants.edges?.find(e=>e.node.id===n)?.node,a=parseFloat(i?.price??"0"),l=parseFloat(i?.compareAtPrice||a.toString());return e.price+=a,e.compareAtPrice+=l,e},{price:0,compareAtPrice:0}),n=Math.max(e,t);let o=Math.min(e,t);r?.percentageOff?o=e*(1-r.percentageOff/100):r?.dealAmount?o=r.dealAmount:r?.amountOff&&(o=e-r.amountOff);const i=t-o;return{originalPrice:n.toFixed(2),dealPrice:o.toFixed(2),offerValue:i.toFixed(2)}},[m,r.products,r.percentageOff,r.dealAmount,r.amountOff]);n(()=>{a?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:r._id,bundleType:"combo-bundle"}});const e=()=>{s(window.innerWidth<786)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const h=r.customizations,v=h.comboBundle?.comboCardStyle||"auto",w="vertical"===v||"auto"===v&&!d,C=h.comboBundle?.embedContentVisibility,E="bundles"==r.appName?r.pageHeader?.title:r?.title,k="bundles"==r.appName?r.pageHeader?.description:r?.subtitle;return e.createElement("div",{className:`yt-comboBundle-bundle-container ${"left"===h.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-left":"right"===h.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-right":"center"===h.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-center":void 0}`,style:{lineHeight:"normal",maxWidth:"800px",marginBlock:h.comboBundle?.verticalMargin||"0px",display:"flex",flexDirection:"column",alignItems:"left"===h.comboBundle?.infoAlignment?"flex-start":"right"===h.comboBundle?.infoAlignment?"flex-end":"center"===h.comboBundle?.infoAlignment?"center":void 0,textAlign:h.comboBundle?.infoAlignment??"left",fontFamily:"system-ui, -apple-system, sans-serif"}},C&&h.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Title")&&e.createElement("div",{className:"yt-comboBundle-bundle-title-container",style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"10px"}},e.createElement("h2",{className:"yt-comboBundle-bundle-title",style:{fontSize:h.comboBundle?.productTitleFontSize||"28px",color:h.comboBundle?.titleTextColor||"#000",fontWeight:"bold",lineHeight:"1.6",margin:0}},E)),C&&h?.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Price")&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-comboBundle-bundle-price-container",style:{display:"flex",alignItems:"center",gap:"8px",color:h.comboBundle?.titleTextColor||"#000",fontSize:(parseInt(h.comboBundle?.productTitleFontSize?.replace("px",""))||28)-4+"px"}},e.createElement("div",{className:"yt-comboBundle-bundle-price-details",style:{display:"flex",alignItems:"center",gap:"5px",flexWrap:"wrap"}},e.createElement("span",{className:"yt-comboBundle-bundle-deal-price-text",style:{fontWeight:"bold",lineHeight:"1",minWidth:"fit-content"}},Pp(h.general.currencySymbol,r.storeCurrencyCode),Fp(y)),!isNaN(Number(f))&&!isNaN(Number(y))&&Number(f)>Number(y)&&e.createElement("div",{className:"yt-comboBundle-bundle-original-price-text",style:{color:h.comboBundle?.titleTextColor||"#666",textDecoration:"line-through",verticalAlign:"middle",display:"inline-block",minWidth:"fit-content"}},Pp(h.general.currencySymbol,r.storeCurrencyCode),Fp(f)),Number(b)>0&&e.createElement("span",{className:"yt-comboBundle-bundle-offer-badge",style:{backgroundColor:"#D3122A",color:"white",padding:"4px 8px",fontSize:"14px",borderRadius:"20px",fontWeight:"500",lineHeight:"1",minWidth:"fit-content"}},r?.percentageOff?`${r?.percentageOff}% Off`:r?.amountOff?`${Pp(h.general.currencySymbol,r.storeCurrencyCode)}${Fp(r?.amountOff)} Off`:`Save ${Pp(h.general.currencySymbol,r.storeCurrencyCode)}${Fp(b)}`))),e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",margin:"15px 0px"},className:"yt-comboBundle-checkoutSpecific-container"},e.createElement("div",{style:{display:"flex",width:"12px",height:"12px",justifyContent:"center",alignItems:"center",alignContent:"center",borderRadius:"50%",backgroundColor:h.general?.ctaBackgroundColor||"#1e1e1e",flexShrink:0},className:"yt-comboBundle-checkoutSpecific-dot"},e.createElement("span",null)),e.createElement("p",{style:{fontSize:h.comboBundle.productDescriptionFontSize||"16px",color:h.comboBundle?.descriptionTextColor||"#000",alignItems:"center",margin:0,lineHeight:"1.2"},className:"yt-comboBundle-checkoutSpecific-text"},"Tax included. ",e.createElement("u",null,"Shipping")," calculated at checkout."))),h.comboBundle.subProductsSectionVisibility&&e.createElement(e.Fragment,null,w?e.createElement("div",{className:"yt-comboBundle-products-grid-vertical "+(d?"yt-comboBundle-products-grid-mobile":""),style:{display:"flex",flexDirection:"row",gap:"20px",marginTop:"10px",flexWrap:"wrap"}},r.products.map((t,n)=>{const o=t?.productDetails?.variants?.edges?.find(e=>e?.node?.id===m[n])?.node;return o?e.createElement(Jc,{key:`combo-product-${n}-${t.productId}`,product:t,styles:h,originalPrice:f,dealPrice:y,selectedVariantId:m[n],onVariantChange:e=>x(n,e),isVertical:w,variantOptions:r.variantOptions,storeCurrencyCode:r.storeCurrencyCode}):null})):e.createElement("div",{className:"yt-comboBundle-products-list-horizontal "+(d?"yt-comboBundle-products-list-mobile":""),style:{display:"flex",flexDirection:"column",gap:"10px",width:"100%"}},h.comboBundle.subProductsSectionVisibility&&r.products.map((t,n)=>e.createElement(Jc,{key:`combo-product-horizontal-${n}-${t.productId}`,product:t,styles:h,originalPrice:f,dealPrice:y,selectedVariantId:m[n],onVariantChange:e=>x(n,e),variantOptions:r.variantOptions})))),e.createElement("div",{className:"yt-comboBundle-bundle-cta-section",style:{borderTop:"1px solid #eee",display:"flex",flexDirection:"column",rowGap:"5px",marginTop:"20px",width:"100%"}},e.createElement("button",{className:`yt-comboBundle-bundle-cta-button ${g?"":"yt-comboBundle-bundle-cta-button-disabled"} ${d?"yt-comboBundle-bundle-cta-button-mobile":""}`,style:{backgroundColor:g?h.general?.ctaBackgroundColor||"#121212":h.general.disabledButtonColor,color:h.general?.ctaTextColor||"#FFFFFF",fontSize:"16px",borderRadius:h.general.ctaBorderRadius??"20px",fontWeight:"bold",cursor:g?"pointer":"not-allowed",border:`1px solid ${g?h.general?.ctaBackgroundColor||"#121212":h.general.disabledButtonColor}`,boxShadow:h.general.ctaShadowType,padding:h.general?.ctaPadding,width:h.general?.ctaWidth,margin:"0"},disabled:!g,onMouseOver:e=>{h.general.customizeHoverState&&g&&(e.currentTarget.style.backgroundColor=h.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=h.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{h.general.customizeHoverState&&g&&(e.currentTarget.style.backgroundColor=h.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=h.general?.ctaTextColor||"#FFFFFF")},onClick:async()=>{const e=Object.entries(m).map(([e])=>({id:r.products[parseInt(e)].productId,title:r.products[parseInt(e)]?.productDetails?.title}));a?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:r._id,bundleType:"combo-bundle",selectedProducts:e}});try{if(c(!0),!i)return console.error("[ComboBundle.tsx] No addToCartFunction available"),void c(!1);const e=Object.entries(m).map(([e,t])=>{const n=r.products[parseInt(e)],o=n.productDetails.variants.edges.find(e=>e.node.id===t)?.node;return o?{variantId:t,price:Number(o.price)}:null}).filter(e=>null!==e),t=Object.values(m);await i(Number(f),t,Number(y),e)}catch(e){console.error("[ComboBundle.tsx] Error adding to cart:",e)}c(!1)}},l?e.createElement(Ze,{color:"white",loading:l,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):e.createElement(e.Fragment,null,g?h.comboBundle?.ctaTitle??"Add Bundle to cart":h.general.outOfStockLabel||"Out of Stock"," "))),C&&h.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Description")&&e.createElement("div",{className:"yt-comboBundle-bundle-description-section",style:{margin:"20px 0px"}},e.createElement("h4",{className:"yt-comboBundle-bundle-description-header",style:{fontSize:"16px",color:h.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",margin:0,padding:"8px",backgroundColor:h.general.primaryColor+"20"}},"Description"),e.createElement("div",{className:"yt-comboBundle-bundle-description-content",style:{fontSize:h.comboBundle.productDescriptionFontSize||"16px",color:h.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",padding:"8px",backgroundColor:h.general.primaryColor+"08"}},e.createElement("p",null,k))))},ed=c.div`
|
|
3569
3569
|
max-width: 800px;
|
|
3570
3570
|
container-type: inline-size;
|
|
3571
3571
|
margin-top: ${e=>e.verticalMargin||"0px"};
|