yt-uikit 0.10.10 → 0.10.11

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.
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { AnalyticsEventParams } from "../Bundle";
2
3
  export type Product = {
3
4
  id: number;
4
5
  title: string;
@@ -64,6 +65,8 @@ type DiscountData = {
64
65
  };
65
66
  } | null;
66
67
  export type BundleConfig = {
68
+ id: string;
69
+ type: string;
67
70
  config: {
68
71
  shop: string;
69
72
  collectionIds: string[];
@@ -124,6 +127,7 @@ interface CollectionBundleProps {
124
127
  config: BundleConfig;
125
128
  addCustomBundleToCart: (items: any) => void;
126
129
  bundleAddToCartLoading: boolean;
130
+ dispatchAnalyticsEvent?: (params: AnalyticsEventParams) => void;
127
131
  }
128
- declare const CollectionBundle: ({ config, bundleAddToCartLoading, addCustomBundleToCart, }: CollectionBundleProps) => React.JSX.Element;
132
+ declare const CollectionBundle: ({ config, bundleAddToCartLoading, addCustomBundleToCart, dispatchAnalyticsEvent, }: CollectionBundleProps) => React.JSX.Element;
129
133
  export default CollectionBundle;
package/dist/esm/index.js CHANGED
@@ -4676,7 +4676,7 @@ import e,{useState as t,useEffect as n,useMemo as r,useRef as o,useCallback as a
4676
4676
  }
4677
4677
  `,em=s.span`
4678
4678
  font-size: 12px;
4679
- `,tm=({productsWithIndices:o,isOpen:a,onClose:i,cta:l,variantOptions:c,onVariantChange:s,handleAddToCart:d,primaryProductId:p,variantId:m})=>{const u=r(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),[g,f]=t({}),[x,y]=t({});n(()=>{const e={},t={};o?.forEach(({product:n,index:r})=>{let o,a=[];if(n.productId===p&&m){const e=n?.productDetails?.variants?.edges.find(e=>e?.node?.id?.includes(m))?.node;e&&u(n.productDetails,e.id)>0&&(a=e.title.split(" / "),o=e)}if(!a.length){const e=n.productDetails.variants.edges.find(e=>u(n.productDetails,e?.node?.id)>0)?.node||n?.productDetails?.variants?.edges?.[0]?.node;e?(a=e.title.split(" / "),o=e):a=n?.productDetails?.options?.map(e=>e.values[0]??"")}e[r]=a,o&&(t[r]={node:o},s(r,o.id))}),f(e),y(t)},[o,p,m,s,u]),n(()=>{if(!p||!m)return;const e=o?.find(({product:e})=>e?.productId===p);if(!e)return;const{product:t,index:n}=e,r=t?.productDetails?.variants?.edges?.find(e=>e.node.id.includes(m))?.node;if(r&&u(t.productDetails,r.id)>0){const e=r.title.split(" / ");f(t=>({...t,[n]:e})),y(e=>({...e,[n]:{node:r}})),s(n,r.id)}},[m,p,o,s,u]);const h=(e,t,n,r)=>{const o=[...g[e]||[]];o[t]=n;const a=o.join(" / "),i=r.productDetails.variants.edges.find(e=>e.node.title===a)?.node;return!!i&&u(r.productDetails,i.id)>0},b=(e,t,n)=>{const{product:r}=o?.find(t=>t.index===e)||{product:{productDetails:{variants:{edges:[]}}}};if(!r?.productDetails)return;if(!h(e,n,t,r))return;const a={...g};a[e][n]=t,f(a);const i=r?.productDetails?.variants?.edges?.find(t=>t.node.title===a[e].join(" / "))?.node;i&&(s(e,i.id),y(t=>({...t,[e]:{node:i}})))};if(!a)return null;const w=e.createElement(Op,{className:"yt-fixedBundle-variant-modal_overlay",onClick:i},e.createElement(Vp,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},e.createElement(Wp,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:l.backgroundColor,color:l.textColor}},"Select Options"),o?.map(({product:t,index:n},r)=>e.createElement(e.Fragment,null,e.createElement(jp,{className:"yt-fixedBundle-variant-modal_product-block"},e.createElement(qp,{className:"yt-fixedBundle-variant-modal_thumbnail",src:x[n]?.node?.image?.url||t.productDetails.featuredMedia?.preview?.image?.url,alt:t.productDetails.title}),e.createElement(Up,{className:"yt-fixedBundle-variant-modal_product-info"},e.createElement(Zp,{className:"yt-fixedBundle-variant-modal_product-name"},t.productDetails.title,t?.productDetails?.variants?.edges?.filter(e=>"Default Title"!==e.node.title)?.length>0&&e.createElement(Gp,{className:"yt-fixedBundle-variant-modal_selected-value"},g[n]?.join(" / "))),t.productDetails.options.map((r,o)=>{const a=c&&c?.options?.find(e=>e.name===r.name),i=r.values.filter(e=>t.productDetails.variants.edges.some(t=>t.node.title.split(" / ")[o]===e));return 0===i.length||1===i.length&&"Default Title"===i[0]?e.createElement(e.Fragment,null):a&&"color"===a?.type?e.createElement(Yp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(em,{className:"yt-fixedBundle-variant-modal_option-name"},r.name," :"," "),i.map((r,i)=>{const l=!h(n,o,r,t);return e.createElement(e.Fragment,null,a.values.find(e=>e.name===r)?.value?e.createElement(Xp,{className:"yt-fixedBundle-variant-modal_color-swatch",key:i,color:a.values.find(e=>e.name===r)?.value||r,selected:g[n]?.[o]==r,disabled:l,onClick:()=>{b(n,r,o)}},e.createElement("span",null)):e.createElement(Kp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:i,selected:g[n]?.[o]==r,disabled:l,onClick:()=>{b(n,r,o)}},r))})):a&&"image"===a?.type?e.createElement(Yp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(em,{className:"yt-fixedBundle-variant-modal_option-name"},r.name," :"," "),i.map((r,i)=>{const l=!h(n,o,r,t);return e.createElement(e.Fragment,null,a?.values.find(e=>e.name===r)?.value?e.createElement(Jp,{className:"yt-fixedBundle-variant-modal_image-swatch",key:i,selected:g[n]?.[o]==r,disabled:l,onClick:()=>{b(n,r,o)},src:a.values.find(e=>e.name===r)?.value},e.createElement("span",null)):e.createElement(Kp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:i,selected:g[n]?.[o]==r,disabled:l,onClick:()=>{b(n,r,o)}},r))})):e.createElement(Yp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(em,{className:"yt-fixedBundle-variant-modal_option-name"},r.name," :"," "),i.map((r,i)=>{const l=!h(n,o,r,t);return e.createElement(Kp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:i,selected:g[n]?.[o]==r,disabled:l,onClick:()=>{b(n,r,o)}},"text"===a?.type&&a.values.find(e=>e.name===r)?.value||r)}))}))),r<o.length-1&&e.createElement(Qp,{className:"yt-fixedBundle-variant-modal_divider"}))),e.createElement(Hp,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:l.backgroundColor,color:l.textColor},onClick:d},"Add bundle to cart")));return D.createPortal(w,document.body)},nm=(e,t=64)=>{if(!e)return"/placeholder.svg";try{const n=new URL(e);return n.searchParams.set("width",String(t)),n.toString()}catch{return e}},rm=({options:r,selectedValue:a,onChange:i,type:l="text"})=>{const[c,s]=t(!1),d=o(null);n(()=>{const e=e=>{d.current&&!d.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const p=t=>"color"===l?e.createElement(Ap,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:t.value},e.createElement("span",null)):"image"===l?e.createElement(Lp,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:t.value||"/placeholder.svg",alt:t.name},e.createElement("span",null)):null;return e.createElement(Bp,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:d},e.createElement(zp,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>s(!c)},e.createElement($p,{className:"yt-fixedBundle-variant-dropdown-horizontal_content"},a&&("color"===l||"image"===l)&&p(a),e.createElement("span",{className:"yt-fixedBundle-variant-dropdown-horizontal_selected-text"},a&&a.name)),e.createElement(Fp,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:c})),c&&e.createElement(Ip,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},r?.map(t=>e.createElement(Pp,{className:"yt-fixedBundle-variant-selector_dropdown-item "+(a?.name===t.name?"yt-fixedBundle-variant-selector_dropdown-item--selected":""),key:t.name,$isSelected:a?.name===t.name,onClick:()=>{t.disabled||(i(t),s(!1))},style:{opacity:t.disabled?.5:1,cursor:t.disabled?"not-allowed":"pointer"}},("color"===l||"image"===l)&&p(t),e.createElement(Dp,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},t.name)))))},om=({product:r,variantOptions:o,selectedVariants:a,onVariantChange:i,variantId:l,primaryProductId:c,variantType:s="dropdown",accentColor:d="#000000"})=>{const p=(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?.toLocaleLowerCase()?1/0:0:1/0:0},[m,u]=t(a||[]);n(()=>{a&&a.length>0&&u(a)},[a]),n(()=>{if(l&&r.variants.edges.some(e=>e.node.id.includes(l))){const e=r.variants.edges.find(e=>e.node.id.includes(l))?.node;if(e){const t=e.title.split(" / ");u(t)}}},[l,r]);const g=e=>{if(!o?.options)return"text";const t=o.options.find(t=>t.name===e);return t?.type||"text"},f=(e,t)=>{const n=m[t];if(!n)return null;return x(e,t).find(e=>e.name===n)||null},x=(e,t)=>{const n=o?.options?.find(t=>t.name===e.name);return e.values.filter(e=>r.variants.edges.some(n=>n.node.title.split(" / ")[t]===e)).map(e=>{const o=n?.values?.find(t=>t.name===e),a=!((e,t,n)=>{const r=[...m||[]];r[e]=t;const o=r.join(" / "),a=n.variants.edges.find(e=>e.node.title===o)?.node;return!!a&&p(n,a.id)>0})(t,e,r);return{name:e,value:o?.value||e,disabled:a}})},y=(e,t)=>e.values.filter(e=>r.variants.edges.some(n=>n.node.title.split(" / ")[t]===e));return"swatches"===s||"auto"===s?e.createElement(e.Fragment,null,r.options.map((t,n)=>{const a=o?.options?.find(e=>e.name===t.name);return e.createElement("div",{key:t.name,className:"yt-fixedBundle-product-option-group-horizontal",style:{...t?.values?.length>1&&{marginTop:"10px"},display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"}},r.options.length>1&&y(t,n)?.length>1&&e.createElement("label",{className:"yt-fixedBundle-product-option-label",style:{fontSize:"12px",fontWeight:"500",color:"#333"}},t.name,":"),y(t,n)?.length>1&&e.createElement("div",{className:"yt-fixedBundle-product-option-values-horizontal",style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"}},y(t,n).map(t=>{const o=[...m];o[n]=t;const l=r.options.length>0?o.join(" / "):o[n],c=r.variants.edges.find(e=>e.node.title===l)?.node,s=0===(c?p(r,c.id):0),u=m[n]===t;if("color"===a?.type){const n=a.values.find(e=>e.name===t)?.value;return e.createElement("button",{key:t,className:`yt-fixedBundle-product-option-button-color${u?" yt-fixedBundle-product-option-button-selected":""}${s?" yt-fixedBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&i(c.id)},disabled:s,style:{borderRadius:"50%",padding:"1px",backgroundColor:"white",border:u&&!s?`1px solid ${d}`:"1px solid transparent",opacity:s?.5:1,cursor:s?"not-allowed":"pointer"}},n?e.createElement("div",{className:"yt-fixedBundle-product-option-color-swatch",style:{width:u&&!s?"26px":"24px",height:u&&!s?"26px":"24px",borderRadius:"50%",backgroundColor:n}},e.createElement("span",null)):e.createElement("span",{className:"yt-fixedBundle-product-option-text",style:{padding:"4px 8px",border:u&&!s?`1px solid ${d}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},t))}if("image"===a?.type){const n=a.values.find(e=>e.name===t)?.value;return e.createElement("button",{key:t,className:`yt-fixedBundle-product-option-button-image${u?" yt-fixedBundle-product-option-button-selected":""}${s?" yt-fixedBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&i(c.id)},disabled:s,style:{border:u&&!s?`1px solid ${d}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:u&&!s?"#F7F7F7":"transparent",cursor:s?"not-allowed":"pointer",padding:"0px",width:u&&!s?"26px":"24px",height:u&&!s?"26px":"24px",overflow:"hidden",opacity:s?.5:1}},n?e.createElement("img",{className:"yt-fixedBundle-product-option-image",src:nm(n),alt:t,style:{width:u&&!s?"26px":"24px",height:u&&!s?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}}):e.createElement("span",{className:"yt-fixedBundle-product-option-text",style:{padding:"4px 8px",border:u&&!s?`1px solid ${d}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},t))}return e.createElement("button",{key:t,className:`yt-fixedBundle-product-option-button-text${u?" yt-fixedBundle-product-option-button-selected":""}${s?" yt-fixedBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&i(c.id)},disabled:s,style:{padding:"4px 8px",border:u&&!s?`1px solid ${d}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",cursor:s?"not-allowed":"pointer",fontSize:"10px",fontWeight:"600",opacity:s?.5:1}},"text"===a?.type&&a.values.find(e=>e.name===t)?.value||t)})))})):e.createElement(_p,{className:"yt-fixedBundle-variant-selector-horizontal_container"},r.options.map((t,n)=>{const o=x(t,n);return 0===o.length||1===o.length&&"Default Title"===o[0].name?null:e.createElement(Rp,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:t.name,$isFirst:0===n},e.createElement(rm,{options:o,selectedValue:f(t,n),onChange:e=>{((e,t)=>{const n=[...m];n[e]=t.name,u(n);const o=r.variants.edges.find(t=>t.node.title===(r.options?.length>0?n.join(" / "):n[e]))?.node.id;i(o||"")})(n,e)},type:g(t.name)}))}))},am=({product:o,selectedVariantId:i,isChecked:l,canCustomize:c,styles:s,onVariantChange:d,onCheckChange:p,isMobile:m,isHorizontal:u,index:g,variantOptions:f,productsLength:x,handleOpenModal:y,storeCurrencyCode:h,primaryProductId:b,variantId:w,checkedProducts:v,bundleDiscountValue:C,bundleDiscountType:E,bundleProductsCount:k,totalSelectedOriginal:T,reviewRatingType:S})=>{const N="23e4dd-58.myshopify.com"!==window.Shopify?.shop,B=r(()=>e=>{const t=o?.variants?.edges?.find(t=>t.node.id===e),n=t?.node;return n?o?.tracksInventory&&n.inventoryItem?.tracked?n.inventoryQuantity>0?n.inventoryQuantity:n.inventoryQuantity<=0&&"continue"===n.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[o]),[z,$]=t(o?.variants?.edges.find(e=>B(e?.node?.id)>0)?.node||o?.variants?.edges?.[0]?.node),F=r(()=>z?.title?.split(" / ")||[],[z]),I=o?.id===b;n(()=>{if(o.id===b){const e=o?.variants?.edges?.find(e=>e?.node?.id?.includes(i))?.node;e&&B(e.id)>0&&($(e),d(e.id))}else{const e=o?.variants?.edges?.find(e=>e?.node?.id===i)?.node||o?.variants?.edges?.find(e=>B(e?.node?.id)>0)?.node||o?.variants?.edges?.[0]?.node;$(e)}},[o,b,i,w,d,B]);const P=a(e=>{const t=o?.variants?.edges?.find(t=>t.node.id===e)?.node;t&&d(e)},[o,d]),D=s?.fixedBundle?.discountBadgeDisplay,A=parseFloat(z?.price??"0"),L=v?.size===k,_=((e,t,n,r,o,a)=>{if(0===r||!n)return e;if(r!==o)return e;switch(t){case"percentOff":case"percentageOff":case"percentage":case"Percentage":return e*(1-n/100);case"amountOff":case"amount":case"Amount Off":{if(a<=0)return e;const t=e/a*n;return Math.max(0,e-t)}case"fixedPrice":case"fixed":case"fixedPrice":return n*(e/a);default:return e}})(A,E,C??0,v?.size,k,T),R=L?_:parseFloat(z?.price??"0"),M="discount-on-compare"===D?parseFloat(z?.compareAtPrice||z?.price||"0"):parseFloat(z?.price??"0"),O=s?.fixedBundle?.compareAtPriceVisibility&&M>R,V=(e=>{const t="string"==typeof e?parseFloat(e):e;return N?t.toFixed(2):Math.round(t).toString()})(R),W="undefined"!=typeof window&&"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,H=z?.image?.url||o.featuredMedia?.preview?.image?.url;return e.createElement(e.Fragment,null,u?e.createElement("div",{className:""+(o.id===b?"yt-fixedBundle-product-card--horizontal-primary":"yt-fixedBundle-product-card--horizontal-associated"),style:{display:"flex",alignItems:"center",gap:"10px"}},c&&e.createElement("div",{className:"yt-fixedBundle-product-card_checkbox-wrapper--horizontal"},e.createElement("input",{type:"checkbox",style:{display:"none"},className:"yt-fixedBundle-product-card_checkbox-hidden",id:`checkbox-${o.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:I}),e.createElement("label",{className:"yt-fixed-bundle-checkbox-label yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${o.id}-${g}`,style:{width:"18px",height:"18px",border:"1.5px solid "+((s.fixedBundle?.borderColor??"#ccc")+"80"),borderRadius:s.fixedBundle?.borderRadius??"4px",backgroundColor:l?s.general?.ctaBackgroundColor??"#d3122a":"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.2s ease",color:"white"}},e.createElement(Y,{style:{fontSize:"14px",visibility:l?"visible":"hidden"}}))),e.createElement(ep,{className:"yt-fixedBundle-product-card-horizontal_item",style:{borderRadius:s.fixedBundle?.borderRadius,border:`1px solid ${s.fixedBundle?.borderColor}80`,backgroundColor:s.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`8px 8px 8px -6px ${s.fixedBundle.borderColor}`,"no-spread":`4px 4px 0px -1px ${s.fixedBundle.borderColor}80`}[s.fixedBundle.shadowType]||"none"},canCustomize:c},"undefined"!=typeof window&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&e.createElement(tp,{className:"yt-fixedBundle-product-card-horizontal_image",src:vm(H),alt:o.title,style:{borderRadius:s.fixedBundle?.borderRadius,borderColor:s.fixedBundle?.borderColor,aspectRatio:s.general?.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),e.createElement(np,{className:"yt-fixedBundle-product-card-horizontal_details"},e.createElement(rp,{className:"yt-fixedBundle-product-card-horizontal_title"},o.title),"ratingOnly"===S&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-fixedBundle-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333",paddingBottom:"4px",lineHeight:"normal"}},e.createElement(Fe,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6,lineHeight:"normal"}},o?.rating?.averageRating," ",e.createElement("span",null," rating"))),"ratingAndReviewCount"===S&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-fixedBundle-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333",paddingBottom:"4px",lineHeight:"normal"}},e.createElement(Fe,{color:"gold",size:14})," ",o?.rating?.averageRating,e.createElement(ke,{className:"yt-fixedBundle-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",o?.rating?.ratingCount," ",e.createElement("span",{style:{marginLeft:"2px"}},"reviews")," ",")"),s.fixedBundle.productsPriceVisibility&&e.createElement(op,{className:"yt-fixedBundle-product-card-horizontal_price-section"},e.createElement(ap,{className:"yt-fixedBundle-product-card-horizontal_price--new"},wm(s.general.currencySymbol,h)," ",bm(V)),O&&M>R&&e.createElement(ip,{className:"yt-fixedBundle-product-card-horizontal_price--old"},wm(s.general.currencySymbol,h),bm(N?M.toFixed(2):Math.round(M).toString()))),e.createElement(om,{product:o,variantOptions:f,selectedVariants:F,onVariantChange:P,variantId:w,primaryProductId:b,variantType:s?.fixedBundle?.variantSelectorType,accentColor:s?.general?.ctaBackgroundColor})))):e.createElement(e.Fragment,null,e.createElement(fp,{className:""+(o.id===b?"yt-fixedBundle-product-card--vertical-primary":"yt-fixedBundle-product-card--vertical-associated"),productsLength:x,style:{borderRadius:s.fixedBundle?.borderRadius,border:`1px solid ${s.fixedBundle?.borderColor}50`,backgroundColor:s.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`0 4px 10px -6px ${s.fixedBundle.borderColor}50`,"no-spread":`4px 4px 0px -1px ${s.fixedBundle.borderColor}50`}[s.fixedBundle.shadowType]||"none",...c&&{position:"relative"},...W&&{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",minWidth:"max-content",paddingLeft:"2px"}},borderRadius:s.fixedBundle?.borderRadius,borderColor:s.fixedBundle?.borderColor,backgroundColor:s.fixedBundle?.cardBackgroundColor},c&&e.createElement(Mp,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:W},e.createElement("input",{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${o.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:I}),e.createElement("label",{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${o.id}-${g}`,style:{width:"18px",height:"18px",border:"1.5px solid "+((s.fixedBundle?.borderColor??"#ccc")+"80"),borderRadius:s.fixedBundle?.borderRadius??"4px",backgroundColor:l?s.general?.ctaBackgroundColor??"#d3122a":"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.2s ease",color:"white"}},e.createElement(Y,{size:10,style:{fontSize:"14px",visibility:l?"visible":"hidden"}}))),"undefined"!=typeof window&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&e.createElement(xp,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:s.general.imageAspectRatio,height:"fit-content"}},e.createElement(yp,{className:"yt-fixedBundle-product-card_image--vertical",src:vm(H),style:{aspectRatio:s.general.imageAspectRatio},alt:o.title}),o.variants.edges.length>1&&e.createElement(hp,{className:"yt-fixedBundle-product-card_badge-container"},e.createElement(bp,{className:"yt-fixedBundle-product-card_circle-button"},e.createElement("span",null)),e.createElement(wp,{className:"yt-fixedBundle-product-card_circle-button-two"},e.createElement("span",null)),e.createElement(vp,{className:"yt-fixedBundle-product-card_count-badge"},o.variants.edges.length,"+"))),e.createElement(Cp,{className:"yt-fixedBundle-product-card-vertical_info"},e.createElement(Ep,{className:"yt-fixedBundle-product-card-vertical_title"},o.title),"ratingOnly"===S&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-fixedBundle-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333",paddingTop:"4px",paddingBottom:"6px",lineHeight:"normal"}},e.createElement(Fe,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6,lineHeight:"normal"}},o?.rating?.averageRating," ",e.createElement("span",null,"rating"))),"ratingAndReviewCount"===S&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-fixedBundle-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333",paddingTop:"4px",paddingBottom:"6px",lineHeight:"normal"}},e.createElement(Fe,{color:"gold",size:14})," ",o?.rating?.averageRating,e.createElement(ke,{className:"yt-fixedBundle-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",o?.rating?.ratingCount," ",e.createElement("span",{style:{marginLeft:"2px"}},"reviews"),")"),s.fixedBundle.productsPriceVisibility&&e.createElement(Tp,{className:"yt-fixedBundle-product-card-vertical_price-line"},e.createElement(kp,{className:"yt-fixedBundle-product-card-vertical_price--new"},wm(s.general.currencySymbol,h),bm(V)),s.fixedBundle.compareAtPriceVisibility&&O&&M>R&&e.createElement(ip,{className:"yt-fixedBundle-product-card-vertical_price--old"},wm(s.general.currencySymbol,h),bm(M))))),(x<=3||!m)&&g<x-1&&e.createElement(Sp,{className:"yt-fixedBundle-plus-wrapper"}," ",e.createElement(Np,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},im=({bundle:o,addToCartFunction:i,dispatchAnalyticsEvent:l})=>{const[c,s]=t(!1),[d,p]=t(window.innerWidth<786),[m,u]=t(null),[g,f]=t(!1),[x,y]=t(!1),h="undefined"!=typeof window?window.location.href:null,b=o?.products?.find(e=>e.productDetails?.handle===h?.split("/").pop()?.split("?")[0]),w=b?.productId,v=r(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),[C,E]=t(Object.fromEntries(o?.products?.map((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find(t=>v(e.productDetails,t?.node?.id)>0)?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id]))),k="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"beautywiseshop.myshopify.com"===window.ytBundleApp?.storeDomain||"swashaa.myshopify.com"===window.ytBundleApp?.storeDomain),T=o?.showIndividualProductSelector??!0,[S,N]=t(new Set(o.products.reduce((e,t,n)=>(k&&t?.productId!==w&&!T||e.push(n),e),[])));n(()=>{l?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:o._id,bundleType:"fixed-bundle"}});const e=()=>{const e=new URL(window.location.href).searchParams.get("variant");u(e)},t=e=>{const t=history[e];return function(...n){const r=t.apply(this,n);return window.dispatchEvent(new Event(e.toLowerCase())),r}};return history.pushState=t("pushState"),history.replaceState=t("replaceState"),window.addEventListener("pushstate",e),window.addEventListener("replacestate",e),e(),()=>{window.removeEventListener("pushstate",e),window.removeEventListener("replacestate",e)}},[]),n(()=>{m&&w&&E(e=>{const t={...e};return o?.products?.forEach((e,n)=>{e.productId===w&&(t[n.toString()]=m)}),t})},[m,w,o?.products]),n(()=>{const e=()=>{p(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const B=a((e,t)=>{E(n=>({...n,[e.toString()]:t}))},[]),z=(e,t)=>{const n=o.products[t].productId;k&&n===w||N(n=>{const r=new Set(n);return e?r.add(t):r.delete(t),r})},$=r(()=>(e,t)=>v(e.productDetails,t)>0,[v]),F=r(()=>o.products.some((e,t)=>S.has(t)&&e.productDetails.variants.edges.length>1),[o.products,S]),I="23e4dd-58.myshopify.com"!==window.Shopify?.shop,P=e=>{const t="string"==typeof e?parseFloat(e):e;return I?t.toFixed(2):Math.round(t).toString()},{originalPrice:D,dealPrice:A,offerValue:L,totalCompareAtPrice:_,totalPrice:R}=r(()=>{const{price:e,compareAtPrice:t}=o.products.reduce((e,t,n)=>{if(!S.has(n))return e;const r=C[n.toString()];if(!r)return e;const o=t.productDetails.variants.edges?.find(e=>e.node.id===r)?.node;if(!o)return e;const a=parseFloat(o?.price??"0"),i=parseFloat(o?.compareAtPrice||a.toString());return e.price+=a,e.compareAtPrice+=i,e},{price:0,compareAtPrice:0}),n=o?.customizations?.fixedBundle?.discountBadgeDisplay||"discount-on-price";let r=e;S.size===o.products.length&&(o?.percentageOff?r=e*(1-o.percentageOff/100):o?.dealAmount?r=o.dealAmount:o?.amountOff&&(r=e-o.amountOff));const a=o?.customizations?.fixedBundle?.discountBadgeVisibility,i=!1===a?r:"discount-on-compare"===n?t:e,l=i-r;return{originalPrice:P(i),dealPrice:P(r),offerValue:P(l),totalPrice:e,totalCompareAtPrice:t}},[o.products,C,S,o.percentageOff,o.dealAmount,o.amountOff,o?.customizations?.fixedBundle?.discountBadgeDisplay,o?.customizations?.fixedBundle?.discountBadgeVisibility]),M=r(()=>o.products.map((e,t)=>({product:e,index:t})).filter(({index:e})=>S.has(e)),[o.products,S]),O=M.every(({product:e,index:t})=>$(e,C[t.toString()])),V=r(()=>{let e=0;return o.products.forEach((t,n)=>{if(S.has(n)){const r=C[n.toString()],o=t.productDetails.variants.edges.find(e=>e.node.id===r)?.node;o&&(e+=parseFloat(o.price??"0"))}}),e},[o.products,S,C]),W=async e=>{s(!0),f(!1),l?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:o._id,bundleType:"fixed-bundle",selectedProducts:M?.map(e=>({id:e?.product?.productId,title:e?.product?.productDetails?.title}))}});try{const t=Object.entries(C).map(([e,t])=>{const n=parseInt(e);return isNaN(n)||!S.has(n)?null:t}).filter(Boolean);i&&await i(Number(D),t,void 0,void 0,e)}catch(e){console.error("Error adding to cart:",e)}s(!1)},H=async e=>{if(O){if(e&&(e.preventDefault(),e.stopPropagation()),o?.personalizedForm?.title)return f(!1),void y(!0);await W()}};if(!i)return e.createElement(e.Fragment,null);const j=o.customizations,q=j.fixedBundle?.cardLayoutStyle||"auto",U="horizontal"===q||"auto"===q&&d,Z="bundles"==o.appName?o.pageHeader?.title:o?.title,Q="bundles"==o.appName?o.pageHeader?.description:o?.subtitle;return e.createElement(Yd,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:j.fixedBundle.sectionBackgroundColor,..."transparent"!==j.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},Z&&e.createElement(Xd,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:j.fixedBundle?.titleBackgroundColor||"none",color:j.fixedBundle?.titleTextColor||"black",textAlign:j.fixedBundle.infoAlignment??"center",fontSize:j.fixedBundle?.titleFontSize,..."transparent"!==j.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===j.fixedBundle.infoAlignment&&"transparent"!==j.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===j.fixedBundle.infoAlignment&&"transparent"!==j.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===j.fixedBundle.infoAlignment&&"transparent"===j.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},Z),Q&&e.createElement(Kd,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:j.fixedBundle?.subtitleFontSize,textAlign:j.fixedBundle.infoAlignment??"center",..."left"===j.fixedBundle.infoAlignment&&"transparent"!==j.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===j.fixedBundle.infoAlignment&&"transparent"!==j.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===j.fixedBundle.infoAlignment&&"transparent"===j.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},Q),U?e.createElement(Jd,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},o?.products?.map((t,n,r)=>e.createElement(e.Fragment,{key:`${t.productId}-${n}`},e.createElement(am,{isChecked:S.has(n),product:t.productDetails,selectedVariantId:C[n.toString()]||"",canCustomize:o?.canCustomizeFixedBundle||!1,styles:j,onVariantChange:e=>B(n,e),onCheckChange:e=>{z(e,n)},isMobile:d,index:n,isHorizontal:U,variantOptions:o.variantOptions,productsLength:o.products.length,storeCurrencyCode:o.storeCurrencyCode,primaryProductId:w,variantId:m||void 0,bundleDiscountType:o.discountType??"none",checkedProducts:S,bundleProductsCount:o.products.length,bundleDiscountValue:o.percentageOff||o.amountOff||o.dealAmount,totalSelectedOriginal:V,reviewRatingType:j?.fixedBundle?.productRatingsDisplay??o?.reviewRatingType}),n<r.length-1&&e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"},className:"yt-fixedBundle-plus-icon-container"},e.createElement("span",{style:{padding:d?"1px":"2px",background:"#0000000D",..."none"!==j?.fixedBundle?.shadowType&&{marginTop:"2px"},display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center"},className:"yt-fixedBundle-plus-icon-wrapper"},e.createElement(_e,{color:"black",style:{height:d?"16px":"24px",width:d?"16px":"24px",color:"black",lineHeight:"nomal"},className:"yt-fixedBundle-plus-icon-svg"})))))):e.createElement(up,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},e.createElement(gp,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===j.fixedBundle.infoAlignment?"flex-start":"right"===j.fixedBundle.infoAlignment?"flex-end":"center"}},o?.products?.map((t,n)=>e.createElement(am,{key:`${t.productId}-${n}`,isChecked:S.has(n),product:t.productDetails,selectedVariantId:C[n.toString()]||"",canCustomize:o?.canCustomizeFixedBundle||!1,styles:j,onVariantChange:e=>{B(n,e)},onCheckChange:e=>z(e,n),isMobile:d,index:n,isHorizontal:U,productsLength:o.products.length,storeCurrencyCode:o.storeCurrencyCode,primaryProductId:w,variantId:m||void 0,bundleDiscountType:o.discountType??"none",checkedProducts:S,bundleProductsCount:o.products.length,bundleDiscountValue:o.percentageOff||o.amountOff||o.dealAmount,totalSelectedOriginal:V,reviewRatingType:j?.fixedBundle.productRatingsDisplay??o?.reviewRatingType})),F&&e.createElement(tm,{productsWithIndices:M,isOpen:g,onClose:()=>f(!1),variantOptions:o.variantOptions,cta:{textColor:j.general.ctaTextColor,backgroundColor:j.general.ctaBackgroundColor},onVariantChange:B,handleAddToCart:H,primaryProductId:w,variantId:m||void 0}))),e.createElement(lp,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===j.fixedBundle.infoAlignment?"flex-start":"right"===j.fixedBundle.infoAlignment?"flex-end":"center"}},Number(D)>0&&Number(L)>0&&j.fixedBundle.compareAtPriceVisibility&&e.createElement(cp,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",e.createElement(dp,{className:"yt-fixedBundle-summary_price"},wm(j.general.currencySymbol,o?.storeCurrencyCode),bm(D))),0!==S.size&&e.createElement(sp,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",e.createElement(dp,{className:"yt-fixedBundle-summary_price"},wm(j.general.currencySymbol,o?.storeCurrencyCode),bm(A))," ",Number(L)>0&&(()=>{let t="";if("percentage"===(j?.fixedBundle?.discountDisplayType||"amount")){const e="discount-on-compare"===(j?.fixedBundle?.discountBadgeDisplay||"discount-on-price")?_:R,n=e>0?Math.round(Number(L)/e*100):0;t=n>0?`${n}% Off`:""}else t=`Save: ${wm(j.general.currencySymbol,o?.storeCurrencyCode)}${bm(L)}`;return t?e.createElement(pp,{className:"yt-fixedBundle-summary_save-tag"},t):null})())),e.createElement(mp,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),U||!F?H(e):f(!0)},disabled:S.size<1||c||!O,style:{backgroundColor:j.general?.ctaBackgroundColor||"#121212",color:j.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${j.general?.ctaBackgroundColor||"#121212"}`,boxShadow:j.general.ctaShadowType,paddingTop:j.general?.ctaPadding,paddingBottom:j.general?.ctaPadding,borderRadius:j.general.ctaBorderRadius,width:j.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{j.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=j.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=j.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{j.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=j.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=j.general?.ctaTextColor||"#FFFFFF")}},c?e.createElement(fe,{color:"white",loading:c,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):O?e.createElement(e.Fragment,null,j.fixedBundle?.ctaTitle??"Add Bundle to cart"):e.createElement(e.Fragment,null,"Out of Stock")),o?.personalizedForm?.title&&e.createElement(_s,{isOpen:x,onClose:()=>y(!1),formConfig:o.personalizedForm,onCheckout:async e=>{await W(e),y(!1)},cta:{backgroundColor:j.general?.ctaBackgroundColor||"#121212",textColor:j.general?.ctaTextColor||"#FFFFFF"},isMobile:d}))},lm=()=>window?.ShopifyAnalytics?.meta?.currency||window?.Shopify?.currency?.active||"USD",cm=({product:r,tierIdx:o,isOpen:a,onClose:i,onAddToBundle:l,canAdd:c,isSelected:s,customizations:d,isMobile:p,splitVariants:m=!1})=>{const[u,g]=t(0),[f,x]=t(r.variants[0]?.id.toString()||""),[y,h]=t(!0),b=r.variants.find(e=>e.id.toString()===f)||r.variants[0],w=r.images.filter(Boolean),v=(e=>{try{const t=new Intl.NumberFormat(void 0,{style:"currency",currency:e}).resolvedOptions().maximumFractionDigits??2;return Math.pow(10,t)}catch{return 100}})(lm()),C=(()=>{const e=lm();return me(e)??e})(),E=()=>{w.length<=1||(g(e=>0===e?w.length-1:e-1),h(!0))},k=()=>{w.length<=1||(g(e=>e===w.length-1?0:e+1),h(!0))};if(n(()=>(a&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=""}),[a]),n(()=>{if(b&&b?.featured_image?.src){const e=document.querySelector(".yt-collection-bundle-modal-image"),t=vm(b?.featured_image?.src);e?.setAttribute("src",t)}},[b]),!a)return null;const T=w.length>1,S=e.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:i},e.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",borderRadius:d?.borderRadius||"12px",maxWidth:1e3,width:"100%",height:"72dvh",margin:"auto",display:"flex",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:i,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"}},e.createElement(G,{size:22})),e.createElement("div",{className:"yt-collection-bundle-modal-image-container",style:{flex:1,position:"relative",margin:"20px 0 20px 20px",borderRadius:d?.borderRadius||"12px",background:"#f5f5f5"}},w.length>0&&e.createElement(e.Fragment,null,y&&e.createElement("style",null,"\n @keyframes shimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n }\n "),y&&e.createElement("div",{style:{position:"absolute",inset:0,background:"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s infinite",borderRadius:d?.borderRadius||"12px"}}),e.createElement("img",{className:"yt-collection-bundle-modal-image",src:vm(w[u]||r.images[0]),alt:r.title,onLoad:()=>h(!1),style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:d?.borderRadius||"12px",opacity:y?0:1,transition:"opacity 0.3s"}}),T&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:E,disabled:0===u,style:{position:"absolute",left:16,top:"50%",transform:"translateY(-50%)",background:0===u?"rgba(0,0,0,0.2)":"rgba(0,0,0,0.4)",border:"none",borderRadius:"50%",width:44,height:44,display:"flex",alignItems:"center",justifyContent:"center",cursor:0===u?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:0===u?.5:1}},e.createElement(X,{size:24})),e.createElement("button",{onClick:k,disabled:u===w.length-1,style:{position:"absolute",right:16,top:"50%",transform:"translateY(-50%)",background:u===w.length-1?"rgba(0,0,0,0.2)":"rgba(0,0,0,0.4)",border:"none",borderRadius:"50%",width:44,height:44,display:"flex",alignItems:"center",justifyContent:"center",cursor:u===w.length-1?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:u===w.length-1?.5:1}},e.createElement(M,{size:24}))))),e.createElement("div",{className:"yt-collection-bundle-modal-content",style:{flex:1,padding:"30px",overflowY:"auto",display:"flex",flexDirection:"column",scrollbarWidth:"none"}},e.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"6px 0",fontSize:24,fontWeight:600,lineHeight:"normal"}},m&&b?.name||r.title),!m&&r.variants.length>1&&e.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative"}},e.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee",lineHeight:"normal"}},r?.options?.join(" & "),":"," ",e.createElement("strong",null,b.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:f,onChange:e=>{x(e.target.value),h(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer",lineHeight:"normal"}},r.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0",lineHeight:"normal"}},C,(b.price/v).toLocaleString(),b.compare_at_price&&b.compare_at_price>b.price?e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999",lineHeight:"normal"}},C,(b.compare_at_price/v).toLocaleString()):null),e.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"white"}},e.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!c?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>l(r,o),disabled:!c||!b.available,style:{width:"100%",padding:"12px",fontSize:17,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:b.available?s||!c?"#28a745":d?.atcBg||"#007bff":"rgb(204, 204, 204)",color:d?.atcText||"#fff",cursor:c&&b.available?"pointer":"not-allowed",textAlign:"center",lineHeight:"normal"}},s?"Added to Box":b.available?"Add to Box":"Out of Stock")),r.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:r.description},style:{lineHeight:"normal",color:"#444",marginTop:"10px"}})))),N=e.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:i},e.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",width:"100%",height:"100dvh",display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:i,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement(G,{size:22})),e.createElement("div",{className:"yt-collection-bundle-modal-scroll-container",style:{flex:1,overflowY:"auto",paddingBottom:100}},w.length>0&&e.createElement("div",{className:"yt-collection-bundle-modal-image-wrapper",style:{position:"relative",background:"#f5f5f5"}},y&&e.createElement("div",{style:{position:"absolute",inset:0,background:"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s infinite"}}),e.createElement("img",{className:"yt-collection-bundle-modal-image",src:w[u]||r.images[0],alt:r.title,onLoad:()=>h(!1),style:{width:"100%",minWidth:"100%",display:"block",maxHeight:"50vh",minHeight:"50vh",objectFit:"cover",objectPosition:"center",opacity:y?0:1,transition:"opacity 0.3s"}}),T&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:E,disabled:0===u,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",background:0===u?"rgba(0,0,0,0.3)":"rgba(0,0,0,0.5)",border:"none",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",zIndex:5,opacity:0===u?.5:1,cursor:0===u?"not-allowed":"pointer"}},e.createElement(X,{size:20})),e.createElement("button",{onClick:k,disabled:u===w.length-1,style:{position:"absolute",right:12,top:"50%",transform:"translateY(-50%)",background:u===w.length-1?"rgba(0,0,0,0.3)":"rgba(0,0,0,0.5)",border:"none",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",zIndex:5,opacity:u===w.length-1?.5:1,cursor:u===w.length-1?"not-allowed":"pointer"}},e.createElement(M,{size:20})))),e.createElement("div",{className:"yt-collection-bundle-modal-content",style:{padding:"20px"}},e.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"0 0 12px",fontSize:22,fontWeight:600}},r.title),!m&&r.variants.length>1&&e.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative",marginBottom:20}},e.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee"}},r?.options?.join(" & "),":"," ",e.createElement("strong",null,b.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:f,onChange:e=>{x(e.target.value),h(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}},r.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0"}},C,(b.price/v).toLocaleString(),b.compare_at_price?b.compare_at_price>b.price&&e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999"}},C,(b.compare_at_price/v).toLocaleString()):null),r.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:r.description},style:{lineHeight:1.7,color:"#444"}}))),e.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"#fff",padding:"8px 10px",borderTop:"1px solid #eee",boxShadow:"0 -4px 10px rgba(0,0,0,0.05)"}},e.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!c?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>l(r,o),disabled:!c||!b.available,style:{width:"100%",padding:"10px",fontSize:14,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:!s&&c&&b.available?d?.atcBg||"#007bff":"#28a745",color:d?.atcText||"#fff",cursor:c&&b.available?"pointer":"not-allowed"}},s?"Added to Box":b.available?"Add to Box":"Out of Stock"))));return D.createPortal(p?N:S,document.body)},sm=({styles:t,isMobile:n,categories:r,activeCategory:o,onCategoryChange:a})=>{const i=e=>{a(e)},l=(e,t)=>{const n=e.replace("#","");return`rgba(${parseInt(n.substring(0,2),16)||0}, ${parseInt(n.substring(2,4),16)||0}, ${parseInt(n.substring(4,6),16)||0}, ${t})`};return"tabs"===t?.categoryFilterOnPage?e.createElement("div",{className:"yt-collection-bundle-category-filter-wrapper",style:{overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",width:"100%"}},e.createElement("div",{className:"yt-collection-bundle-category-tabs-container",style:{display:"flex",gap:"0px",minWidth:"max-content",paddingBottom:"1px",flexWrap:"nowrap",justifyContent:"center",borderBottom:"1px solid #e0e0e0",width:"auto",height:n?"28px":"45px"}},["All",...r].map(r=>{const a=o===r,c=t.btnPrimaryBg||"#111";return e.createElement("button",{key:r,onClick:()=>i(r),className:"yt-collection-bundle-category-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:a?"600":"400",color:a?c:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:a?l(c,.07):"transparent",borderBottom:a?`2px solid ${c}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:e=>{a||(e.currentTarget.style.color=c)},onMouseLeave:e=>{a||(e.currentTarget.style.color="#666")}},e.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},r.charAt(0).toUpperCase()+r.slice(1)),e.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},r.charAt(0).toUpperCase()+r.slice(1)))}))):e.createElement("div",{className:"yt-collection-bundle-category-filter-wrapper",style:{overflowX:n?"auto":"visible",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",paddingBottom:"5px"}},e.createElement("div",{className:"yt-collection-bundle-category-buttons-container",style:{display:"flex",gap:"8px",minWidth:"max-content",flexWrap:"nowrap",justifyContent:"center",paddingRight:n?"10px":"0px"}},["All",...r].map(r=>{const a=t.btnPrimaryBg||"#111",l=t.borderRadius||"8px";return e.createElement("button",{key:r,onClick:()=>i(r),className:"yt-collection-bundle-category-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${o===r?a:"#e0e0e0"}`,borderRadius:l,backgroundColor:o===r?a:"white",color:o===r?"white":"#333",cursor:"pointer"}},r.charAt(0).toUpperCase()+r.slice(1))})))},dm=e=>{if(e.metafields&&e.metafields.yourtoken_bundles_app&&e.metafields.yourtoken_bundles_app.categories){const t=e.metafields.yourtoken_bundles_app.categories;if(Array.isArray(t))return t;if("string"==typeof t)try{const e=JSON.parse(t);if(Array.isArray(e))return e}catch(e){console.error("Failed to parse categories:",e)}}return[]},pm=()=>window?.ShopifyAnalytics?.meta?.currency||window?.Shopify?.currency?.active||"USD",mm=e=>{try{const t=new Intl.NumberFormat(void 0,{style:"currency",currency:e}).resolvedOptions().maximumFractionDigits??2;return Math.pow(10,t)}catch{return 100}},um=()=>{const e=pm();return me(e)??e},gm=({config:r,bundleAddToCartLoading:i,addCustomBundleToCart:l})=>{const[c,s]=t(1),[d,p]=t("All"),[m,u]=t([]),[g,f]=t(null),[x,y]=t({}),[h,b]=t(!1),[w,v]=t(window.innerWidth<640),[C,E]=t({}),k=o(null),T=o(new Map),[S,N]=t(160),[B,z]=t(""),[$,F]=t(""),[I,P]=t(!1),[D,A]=t("none"),L=w?8:20,{customizations:_}=r,R=r.config.builderTiers.collectionTier.sort((e,t)=>e.tier-t.tier),M=!!r.config.form,O=R.length+(M?1:0),W=_.hideSelectedProducts,H=_.allowMultipleQty,j=_.hideOutOfStockProducts,q=r.config.splitVariants??!1,U=o(new Set),Z=a((e,t=d,n=$,r=D)=>{const o=R[e-1]?.products||[];let a="All"===t?o:o.filter(e=>dm(e).includes(t));if(n.trim()){const e=n.toLowerCase();a=a.filter(t=>t.title.toLowerCase().includes(e))}return j&&(a=a.filter(e=>e.available)),"none"!==r&&(a=[...a].sort((e,t)=>{if("asc"===r||"desc"===r){const n=e.price||e.price_min||0,o=t.price||t.price_min||0;return"asc"===r?n-o:o-n}{const n=(e.title||"").toLowerCase(),o=(t.title||"").toLowerCase();return"alpha-asc"===r?n.localeCompare(o):o.localeCompare(n)}})),a},[R,d,$,D,j]),Q=a(e=>{const t=Z(e).length;E(n=>{const r=n[e]||0,o=Math.min(r+8,t);return o<=r?n:{...n,[e]:o}})},[8,Z]);n(()=>(k.current=new IntersectionObserver(e=>{for(const t of e)if(t.isIntersecting){const e=parseInt(t.target.getAttribute("data-sentinel-step")||"0");e>0&&e===c&&Q(e)}},{root:null,threshold:0,rootMargin:"100px 0px"}),()=>{k.current?.disconnect()}),[Q,c]),n(()=>{p("All"),z(""),F(""),P(!1),A("none")},[c]),n(()=>{const e=setTimeout(()=>{F(B)},300);return()=>clearTimeout(e)},[B]),n(()=>{if(M&&c===O)return;const e=c-1;if(!R[e])return;if(U.current.has(e))return;const t=Z(c);if(console.log("filteredProducts",t),1!==t.length)return;const n=t[0],r=n.variants.filter(e=>e.available);if(1!==r.length)return;const o=r[0],a=ie(e),i=ce[e];if(a!==1/0&&i>=a)return;if(!m.some(t=>t.productId===n.id.toString()&&t.variantId===o.id.toString()&&t.tierIndex===e)&&(U.current.add(e),u(t=>[...t,{productId:n.id.toString(),variantId:o.id.toString(),price:o.price,quantity:1,tierIndex:e}]),c<O)){const e=setTimeout(()=>{s(e=>e+1),window.scrollTo(0,0)},50);return()=>clearTimeout(e)}},[c]),n(()=>{if(M&&c===O)return;const e=c,t=Z(e).length;E(n=>{const r=n[`${e}_category`]!==d;return 0===(n[e]||0)||r?{...n,[e]:Math.min(L,t),[`${e}_category`]:d}:n})},[c,L,d,Z]),n(()=>{const e=document.querySelector(".box-loader-scene");e&&e.setAttribute("style","display: none;");const t=()=>v(window.innerWidth<640);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const Y=a(e=>{N(e+10)},[]),X=mm(pm()),ee=m.reduce((e,t)=>e+t.quantity,0),te=m.reduce((e,t)=>e+t.price*t.quantity,0)/X,ne=m.reduce((e,t)=>{const n=R.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId),r=n?.variants.find(e=>e.id.toString()===t.variantId);return e+(r?.compare_at_price??t.price)*t.quantity},0)/X,re=e=>{for(let t=0;t<R.length;t++)if(R[t].products.some(t=>t.id.toString()===e))return t+1;return M?O:R.length},oe=(e,t)=>{const n=e.variants.find(e=>e.id===parseInt(t));if(!n)return;const r=document.querySelector(`[data-product-id="${e.id}"]`);r&&(r.dataset.selectedVariant=t,r.dataset.currentPrice=n.price.toString())},ae=(e,t)=>{const n=document.querySelector(`[data-product-id="${e.id}"]`);if(!n)return;const r=n.dataset.selectedVariant||e.variants[0].id.toString(),o=parseInt(n.dataset.currentPrice||e.variants[0].price.toString());u(n=>{const a=`${e.id}-${r}-${t}`,i=n.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===a);if(i)return n.filter(e=>e!==i);const l=ce[t],c=ie(t);return c!==1/0&&l>=c?n:[...n,{productId:e.id.toString(),variantId:r,price:o,quantity:1,tierIndex:t}]})},ie=e=>{const t=R[e];return t.maximumQuantity>0?t.maximumQuantity:1/0},le=(e,t)=>{const n=ie(t);if(n===1/0)return!0;const r=ce[t];return!!m.some(n=>n.productId===e.id.toString()&&n.tierIndex===t)||r<n},ce=R.map((e,t)=>m.filter(e=>e.tierIndex===t).reduce((e,t)=>e+t.quantity,0)),se=(e,t,n)=>{const r=ie(n);if(r===1/0)return!0;return ce[n]<r},de=(e,t,n)=>{u(r=>r.filter(r=>!(r.productId===e&&r.variantId===t&&r.tierIndex===n)))},pe=async()=>{if(c!==O||!m.length)return;const e={};M&&Object.entries(x).forEach(([t,n])=>{const r=t.split("|").pop()?.replace(/^f_\d+$/,"")||t;"string"==typeof n&&n.trim()?e[r]=n:n&&"object"==typeof n&&"url"in n&&(e[r]=n.url)});const t=m.map(t=>({variantId:t.variantId,quantity:t.quantity,properties:e}));l(t)},me=M&&c===O,ue=(me?null:R[c-1])?ie(c-1):0,ge=R.map((e,t)=>({tier:e,items:m.filter(e=>e.tierIndex===t).reduce((e,t)=>{const n=`${t.productId}-${t.variantId}`,r=e.find(e=>`${e.productId}-${e.variantId}`===n);return r?r.quantity+=t.quantity:e.push({...t,quantity:t.quantity}),e},[]),count:ce[t]}));return e.createElement("div",{className:"yt-collection-bundle-builder",style:{margin:"0 auto",maxWidth:"1600px"}},_.headerImage&&!_.headerImage.includes("Liquid error")&&e.createElement("img",{className:"yt-collection-bundle-header-img",src:_.headerImage,alt:"Collection Bundle header",style:{width:"100%"}}),_.showTierSteps&&e.createElement("div",{style:{paddingTop:_.headerImage&&!_.headerImage.includes("Liquid error")?"20px":"0"}},e.createElement(fm,{totalSteps:O,isFormStep:me,currentStep:c,getStepTitle:e=>M&&e===O?"Customize Gift Details":R[e-1]?.title||`Step ${e}`,isMobile:w,formTitle:r?.config?.form?.title,hasForm:M,onStepClick:e=>{s(e),window.scrollTo(0,0)}})),Array.from({length:O},(e,t)=>t+1).map(t=>{const n=M&&t===O,o=n?[]:(e=>R[e-1]?.products||[])(t);let a=[];if(!n&&_.enableProductCategories){const e=new Set;o.forEach(t=>dm(t).forEach(t=>e.add(t))),a=Array.from(e).sort()}const l=n?[]:Z(t),v=t-1,E=l.slice(0,C[t]||0);return e.createElement("div",{key:t,className:"yt-collection-bundle-step-content "+(c===t?"yt-collection-bundle-step-content-active":""),style:{display:c===t?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},n&&r.config.form?e.createElement($s,{form:r.config.form,formData:x,setFormData:y,barHeight:S,isUploading:h,setIsUploading:b}):e.createElement(e.Fragment,null,_.enableProductCategories&&a.length>0&&e.createElement(sm,{styles:_,isMobile:w,categories:a,activeCategory:d,onCategoryChange:p}),(_.enableSearch||_.enableSort)&&e.createElement("div",{className:"yt-collection-bundle-controls",style:{display:"flex",alignItems:"center",justifyContent:w?"flex-end":"space-between",gap:"12px",padding:"0 16px",marginBottom:"16px",flexWrap:"nowrap",height:"45px"}},w?e.createElement(e.Fragment,null,I?e.createElement("div",{style:{position:"relative",flex:1,display:"flex",alignItems:"center",gap:"8px"}},e.createElement("input",{type:"text",autoFocus:!0,placeholder:"Search...",value:B,onChange:e=>z(e.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:_.borderRadius||"8px",border:`1px solid ${_.bundleBorder||"#878787"}`,background:_.productCardBg||"#fff",color:"#333",fontSize:"14px",outline:"none"}}),e.createElement("button",{onClick:()=>{P(!1),z(""),F("")},style:{background:"none",border:"none",color:"#888",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center"}},e.createElement(G,null))):e.createElement("div",{style:{display:"flex",gap:"20px",alignItems:"center"}},_.enableSearch&&e.createElement("button",{onClick:()=>P(!0),style:{background:"none",border:"none",color:"#333",fontSize:"20px",cursor:"pointer",display:"flex",alignItems:"center"},className:"yt-collection-bundle-search-btn-mobile"},e.createElement(K,null)),_.enableSort&&e.createElement("div",{style:{position:"relative",display:"flex",alignItems:"center"},className:"yt-collection-bundle-sort-selecter-mobile-wrapper"},e.createElement("select",{value:D,onChange:e=>A(e.target.value),style:{position:"absolute",opacity:0,width:"100%",height:"100%",cursor:"pointer",left:0,top:0,zIndex:1},className:"yt-collection-bundle-sort-selecter-mobile"},e.createElement("option",{value:"none"},"Featured"),e.createElement("option",{value:"asc"},"Price: Low to High"),e.createElement("option",{value:"desc"},"Price: High to Low"),e.createElement("option",{value:"alpha-asc"},"Alphabetical: A-Z"),e.createElement("option",{value:"alpha-desc"},"Alphabetical: Z-A")),e.createElement("div",{style:{fontSize:"20px",color:"#333",pointerEvents:"none",display:"flex",alignItems:"center"}},e.createElement(J,null))))):e.createElement(e.Fragment,null,_.enableSort&&e.createElement("div",{style:{position:"relative",flex:"0 1 200px",marginLeft:"12px",padding:"10px 16px",borderRadius:_.borderRadius||"8px",border:"1px solid #878787",background:_.productCardBg||"#fff",display:"flex",flexDirection:"row",alignItems:"center",gap:"6px"},className:"yt-collection-bundle-sort-wrapper"},e.createElement("span",{style:{fontWeight:"500",minWidth:"fit-content",fontSize:"14px"}},"Sort By"),e.createElement("select",{value:D,onChange:e=>A(e.target.value),style:{width:"100%",color:"#333",fontSize:"14px",outline:"none",cursor:"pointer",appearance:"none",boxSizing:"border-box",lineHeight:"normal",border:"none",fontFamily:"inherit"},className:"yt-collection-bundle-sort-selector"},e.createElement("option",{value:"none"}," Featured"),e.createElement("option",{value:"asc"},"Price: Low to High"),e.createElement("option",{value:"desc"},"Price: High to Low"),e.createElement("option",{value:"alpha-asc"},"Alphabetical: A-Z"),e.createElement("option",{value:"alpha-desc"},"Alphabetical: Z-A")),e.createElement("div",{style:{position:"absolute",right:"12px",top:"50%",transform:"translateY(-50%)",color:"#888",pointerEvents:"none"}},e.createElement(V,null))),_.enableSearch&&e.createElement("div",{style:{position:"relative",flex:"0 1 300px"},className:"yt-collection-bundle-search-wrapper"},e.createElement("input",{type:"text",placeholder:"Search products...",value:B,onChange:e=>z(e.target.value),style:{width:"100%",padding:"10px 16px",paddingRight:"40px",borderRadius:_.borderRadius||"8px",border:"1px solid #878787",background:_.productCardBg||"#fff",color:"#333",fontSize:"14px",outline:"none",boxSizing:"border-box",lineHeight:"normal"},className:"yt-collection-bundle-search-input"}),e.createElement("div",{style:{position:"absolute",right:"12px",top:"50%",transform:"translateY(-50%)",color:"#888"}},e.createElement(K,null))))),e.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:w?"grid":"flex",gridTemplateColumns:w?"repeat(2,1fr)":"",flexWrap:w?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:`${S}px`}},0===l.length&&""!==$.trim()?e.createElement("div",{style:{padding:"60px 20px",textAlign:"center",width:"100%",gridColumn:"1 / -1"}},e.createElement("div",{style:{fontSize:"18px",color:"#333",marginBottom:"8px",fontWeight:600}},'No results found for "',B,'"'),e.createElement("div",{style:{fontSize:"14px",color:"#666",marginBottom:"24px"}},"Try checking your spelling or using more general terms."),e.createElement("button",{onClick:()=>{z(""),F(""),P(!1)},style:{background:_.atcBg||"#000",color:_.atcText||"#fff",padding:"12px 32px",borderRadius:_.borderRadius||"8px",border:"none",cursor:"pointer",fontSize:"14px",fontWeight:600,transition:"opacity 0.2s"},onMouseEnter:e=>e.currentTarget.style.opacity="0.8",onMouseLeave:e=>e.currentTarget.style.opacity="1"},"Clear Search")):q?E.flatMap(t=>t.variants.filter(e=>!j||e.available).map(n=>e.createElement(xm,{key:`${t.id}-${n.id}`,product:{...t,variants:[n]},tierIdx:v,customizations:_,isMobile:w,hoveredCard:g,setHoveredCard:f,selectedProducts:m,handleAddToBundle:ae,canAddProduct:le,allowMultipleQty:H,handleVariantChange:oe,canIncrement:se,setSelectedProducts:u,splitVariants:!0}))):E.map(t=>e.createElement(xm,{key:t.id,product:t,tierIdx:v,customizations:_,isMobile:w,hoveredCard:g,setHoveredCard:f,selectedProducts:m,handleAddToBundle:ae,canAddProduct:le,allowMultipleQty:H,handleVariantChange:oe,canIncrement:se,setSelectedProducts:u,splitVariants:!1})),c===t&&(C[t]||0)<l.length&&e.createElement("div",{ref:e=>{const n=T.current.get(t);n&&k.current?.unobserve(n),e?(T.current.set(t,e),k.current?.observe(e)):T.current.delete(t)},"data-sentinel-step":t.toString(),style:{height:"20px",width:"100%",display:"block"}}))),c===t&&e.createElement(ym,{config:r,selectedProducts:m,selectedByTier:ge,totalItems:ee,totalPrice:te,totalCompareAtPrice:ne,currentStep:c,totalSteps:O,currentTierMax:ue,tierSelectedCounts:ce,isMobile:w,bundleAddToCartLoading:i,isUploading:h,hoveredCard:g,setHoveredCard:f,hideSelectedProducts:W,getProductStep:re,setCurrentStep:s,handleRemoveItem:de,handleCheckout:pe,hasForm:M,onHeightChange:Y}))}))},fm=({totalSteps:t,isFormStep:r,currentStep:o,getStepTitle:a,isMobile:i,formTitle:l,hasForm:c,onStepClick:s})=>{const d=e.useRef(null);return n(()=>{if(!i||!d.current)return;const e=d.current.querySelector(".yt-collection-bundle-step-item-active");e&&e.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})},[o,i]),e.createElement("div",{className:"yt-collection-bundle-steps-nav-container",style:{display:"flex",justifyContent:"center",flexDirection:"column",gap:i?"0":"1rem",overflowX:"auto",scrollbarWidth:"none",borderBottom:"1px solid #878787",marginInline:i?"0":"2%",paddingBottom:"1rem",textAlign:"center"}},e.createElement("div",{ref:d,className:"yt-collection-bundle-steps-nav",style:{display:"flex",justifyContent:i?"flex-start":"center",gap:i?"1rem":"2rem",minWidth:i?100*t+"px":"auto",paddingInline:i?"calc(50% - 60px)":"0",scrollPaddingInline:i?"calc(50% - 60px)":"0",scrollBehavior:"smooth",overflowX:"auto",scrollbarWidth:"none"}},Array.from({length:t},(e,t)=>t+1).map(n=>e.createElement("div",{key:n,className:"yt-collection-bundle-step-item "+(o===n?"yt-collection-bundle-step-item-active":""),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.5rem",minWidth:i?"100px":"120px",flexShrink:0,cursor:"pointer",opacity:o===n?1:.5,transition:"opacity 0.2s"},onClick:()=>s(n)},e.createElement("div",{className:"yt-collection-bundle-step-icon "+(o===n?"yt-collection-bundle-step-icon-active":""),style:{width:"40px",height:"40px",background:o===n?"#000":"#fff",border:"2px solid #ccc",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center"}},c&&n===t?e.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:o===n?"#fff":"#999"}},e.createElement("path",{d:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.67C10.96 2.54 10.05 2 9 2c-1.66 0-3 1.34-3 3 0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1h-2c-.55 0-1-.45-1-1s.45-1 1-1h2zm-6 0c.55 0 1 .45 1 1s-.45 1-1 1H7c-.55 0-1-.45-1-1s.45-1 1-1h2zM20 19H4V8h16v11z"})):e.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:o===n?"#fff":"#999"}},e.createElement("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}))),e.createElement("div",{className:"yt-collection-bundle-step-label",style:{fontSize:"14px",textAlign:"center",color:"#333",fontWeight:"600",lineHeight:"normal"}},a(n))))),l&&c&&r&&e.createElement("p",{className:"yt-collection-bundle-steps-nav-description",style:{fontSize:i?"14px":"16px",marginBottom:i?"0":"14px",fontWeight:"400",color:"#000",lineHeight:"normal"}},l))},xm=({product:n,tierIdx:r,customizations:o,isMobile:a,hoveredCard:i,setHoveredCard:l,selectedProducts:c,handleAddToBundle:s,canAddProduct:d,allowMultipleQty:p,handleVariantChange:m,canIncrement:u,setSelectedProducts:g,splitVariants:f=!1})=>{const[x,y]=t(!1),h=f?null:document.querySelector(`[data-product-id="${n.id}"]`),b=f?n.variants[0].id.toString():h?.dataset.selectedVariant??n.variants[0].id.toString(),w=n.variants.find(e=>e.id.toString()===b)||n.variants[0],v=mm(pm()),C=um(),E=f?`${n.id}-${w.id}`:n.id,k=c.some(e=>e.productId===n.id.toString()&&e.variantId===b&&e.tierIndex===r),T=i===E,S=c.filter(e=>e.productId===n.id.toString()&&e.variantId===w.id.toString()&&e.tierIndex===r).reduce((e,t)=>e+t.quantity,0);return e.createElement(e.Fragment,null,e.createElement("div",{key:E,className:"yt-collection-bundle-product-item","data-product-id":n.id,"data-selected-variant":w.id,"data-current-price":w.price,style:{display:"flex",flexDirection:"column",border:o?.productCardBorder||"1px solid #ddd",background:o?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:a?0:"250px",maxWidth:a?"none":"250px",borderRadius:o?.borderRadius||"8px",boxShadow:"spread"===o?.productCardShadow?"8px 8px 8px -6px #0000004D":"no-spread"===o?.productCardShadow?"6px 6px 0px -1px #00000033":"none",width:a?"100%":""}},e.createElement("div",{className:"yt-collection-bundle-product-image",style:{position:"relative",width:"100%",aspectRatio:o?.productImageRatio||"1/1",overflow:"hidden",cursor:"pointer",background:"#f9f9f9"},onClick:()=>y(!0),onMouseEnter:()=>l(E),onMouseLeave:()=>l(null)},e.createElement("img",{src:vm(n.images[0]||"https://cdn.shopify.com/s/files/1/0750/9937/3789/files/placeholder-thumbnail.png?width=250px"),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:T?0:1,transform:T?"scale(1.05)":"scale(1)"},alt:n.title}),e.createElement("img",{src:vm(n.images[1]||n.images[0]),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:T?1:0,transform:"scale(1.05)"},alt:n.title}),!f&&n.variants.length>1&&e.createElement("select",{className:"yt-collection-bundle-variant-selector",style:{position:"absolute",bottom:"10px",left:"10px",right:"10px",background:"rgba(255,255,255,0.9)",border:"none",borderRadius:"4px",padding:"8px",fontSize:"12px",fontWeight:"600",zIndex:2,lineHeight:"normal"},onChange:e=>m(n,e.target.value),defaultValue:w.id,onClick:e=>{e.stopPropagation()}},n.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-product-info",style:{padding:"12px",flexGrow:1,display:"flex",flexDirection:"column"}},o.productCardCategoryVisibility&&dm(n).length>0&&e.createElement("div",{className:"yt-collection-bundle-product-categories-wrapper",style:{paddingBottom:"8px"}},e.createElement("div",{className:"yt-collection-bundle-product-categories",style:{display:"flex",flexWrap:"wrap",gap:"4px"}},dm(n).slice(0,2).map((t,n)=>e.createElement("span",{className:"yt-collection-bundle-category-tag",key:n,style:{fontSize:a?"10px":"12px",color:"#666",fontWeight:"500"}},t.charAt(0).toUpperCase()+t.slice(1))),dm(n).length>2&&e.createElement("span",{className:"yt-collection-bundle-more-categories",style:{fontSize:"10px",padding:"2px 6px",backgroundColor:"rgba(0, 0, 0, 0.05)",borderRadius:"8px",color:"#666",fontWeight:"500"}},"+",dm(n).length-2," more"))),e.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:a?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:"normal",color:"#333",flexGrow:f?0:1}},n.title),f&&"Default Title"!==w.title&&e.createElement("p",{className:"yt-collection-bundle-variant-label",style:{fontSize:a?"10px":"12px",color:"#666",margin:"0 0 4px",lineHeight:"normal",flexGrow:1}},w.title),e.createElement("div",{className:"yt-collection-bundle-product-prices",style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"nowrap",whiteSpace:"nowrap",overflow:"hidden",lineHeight:"normal"}},e.createElement("span",{className:"yt-collection-bundle-product-price",style:{fontSize:a?"14px":"16px",fontWeight:"bold",color:"#000",flexShrink:0,lineHeight:"normal"}},C,(w.price/v).toLocaleString()),w.compare_at_price&&0!==w.compare_at_price&&w.compare_at_price>w.price?e.createElement("span",{className:"yt-collection-bundle-product-compare",style:{fontSize:"14px",textDecoration:"line-through",color:"#999",flexShrink:0,lineHeight:"normal"}},C,(w.compare_at_price/v).toLocaleString()):null)),p&&S>0?e.createElement("div",{className:"yt-collection-bundle-quantity-row",style:{display:"flex",alignItems:"center",flexWrap:"nowrap",background:"#cccccc"}},e.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-minus",style:{width:"40%",height:w.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:a?"6px":"12px",fontSize:a?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{g(e=>{const t=`${n.id}-${w.id}-${r}`,o=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return o&&o.quantity>1?e.map(e=>e===o?{...e,quantity:e.quantity-1}:e):o?e.filter(e=>e!==o):e})}},"-"),e.createElement("span",{className:"yt-collection-bundle-qty-display",style:{minWidth:"24px",textAlign:"center",fontWeight:600,width:"100%",lineHeight:"normal"}},S),e.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-plus",style:{width:"40%",height:w.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:a?"6px":"12px",fontSize:a?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{w.available&&u(n,w.id.toString(),r)&&g(e=>{const t=`${n.id}-${w.id}-${r}`,o=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return o?e.map(e=>e===o?{...e,quantity:e.quantity+1}:e):[...e,{productId:n.id.toString(),variantId:w.id.toString(),price:w.price,quantity:1,tierIndex:r}]})},disabled:!w.available||!u(n,w.id.toString(),r)},"+")):e.createElement("button",{className:"yt-collection-bundle-add-btn "+(k?"yt-collection-bundle-add-btn-added":""),style:{background:k?"#28a745":d(n,r)&&w.available?o?.atcBg||"#007bff":"#ccc",color:o?.atcText||"#fff",border:"none",padding:a?"6px":"12px",fontSize:a?"12px":"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",opacity:w.available?1:.6,lineHeight:"normal",textAlign:"center"},onClick:()=>{if(f)w.available&&d(n,r)&&g(e=>{const t=`${n.id}-${w.id}-${r}`,o=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return o?e.filter(e=>e!==o):[...e,{productId:n.id.toString(),variantId:w.id.toString(),price:w.price,quantity:1,tierIndex:r}]});else{if(!w.available||!d(n,r))return;s(n,r)}},disabled:!w.available||!d(n,r)},k?"Added":w.available?"ADD TO BOX":"Out of Stock")),x&&e.createElement(cm,{product:n,tierIdx:r,isOpen:x,onClose:()=>y(!1),onAddToBundle:(e,t)=>{s(e,t),y(!1)},canAdd:d(n,r),isSelected:k,customizations:o,isMobile:a,splitVariants:f}))},ym=r=>{const{config:a,selectedProducts:i,selectedByTier:l,totalItems:c,totalPrice:s,totalCompareAtPrice:d,currentStep:p,totalSteps:m,currentTierMax:u,tierSelectedCounts:g,isMobile:f,bundleAddToCartLoading:x,isUploading:y,hoveredCard:h,setHoveredCard:b,getProductStep:w,setCurrentStep:v,handleRemoveItem:C,handleCheckout:E,hasForm:k,onHeightChange:T}=r,{customizations:S}=a,[N,B]=t(!1),z=o(null),$=o(null),F=mm(pm()),I=um(),{totalOriginal:P,hasSavings:D,formattedSavings:A,totalAfterDiscount:L}=(e=>{let t=0,n=0;e.forEach(({items:e,tier:r})=>{const o=r?.discountData;let a=0;e.forEach(e=>{const t=(e.price||0)/F,n=e.quantity||1;a+=t*n}),t+=a;let i=a;if("mov_percentage"===o?.type&&o.tiers?.length){const e=[...o.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity).filter(e=>a>=e.minimumQuantity);if(e.length>0){const t=e.reduce((e,t)=>t.discountValue>e.discountValue?t:e).discountValue/100;i=a*(1-t)}}n+=i});const r=Math.round(t-n),o=r>0;return{savings:r,totalOriginal:t,totalAfterDiscount:n,hasSavings:o,formattedSavings:o?`${I}${r.toLocaleString()}`:"",calculatedDiscountedTotal:Math.round(n)}})(l),_=l.filter(({count:e})=>e>0).map(({tier:e,items:t})=>{const n=t.reduce((e,t)=>{if(!t)return e;return e+(t.price||0)*(t.quantity||1)},0)/F;return((e,t,n)=>{const r=e.discountData;if(!r||!r.tiers?.length)return null;const o=[...r.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity),a=[];if("mov_percentage"===r.type){if("number"!=typeof n)return null;const e=o.filter(e=>n>=e.minimumQuantity).pop();e&&a.push(`${e.discountValue}% OFF`);const t=o.find(e=>n<e.minimumQuantity);if(t){const e=t.minimumQuantity-n;a.push(`Add ${I}${e} more to get ${t.discountValue}% OFF`)}return a.length?a.join(" + "):null}const i=o.filter(e=>t>=e.minimumQuantity);if(i.length>0){const e=i.reduce((e,t)=>e.minimumQuantity>t.minimumQuantity?e:t);let t=null;switch(r.type){case"percentage_discount_coupon":t=`${e.discountValue}% OFF`;break;case"amount_discount_coupon":t=`${I}${e.discountValue} OFF`;break;case"fixed_price_collection":t=`Fixed ${I}${e.discountValue}`;break;case"dummy_coupon":t="Discount Applied"}t&&a.push(t)}const l=o.find(e=>t<e.minimumQuantity);if(l){const e=l.minimumQuantity-t;let n=null;switch(r.type){case"percentage_discount_coupon":n=`${l.discountValue}% OFF`;break;case"amount_discount_coupon":n=`${I}${l.discountValue} OFF`;break;case"fixed_price_collection":n=`Fixed ${I}${l.discountValue}`;break;case"dummy_coupon":n="Discount"}n&&a.push(`Add ${e} more item${1!==e?"s":""} to get ${n}`)}return a.length?a.join(" + "):null})(e,t.length,n)}).filter(Boolean);return n(()=>{const e=u!==1/0&&g[p-1]===u-2&&u>1;let t=null;return e?(B(!0),t=setTimeout(()=>{B(!1)},3e3)):B(!1),()=>{t&&clearTimeout(t)}},[u,g,p]),n(()=>{if(z.current&&T){const e=z.current.offsetHeight;T(e)}},[f,T,i]),n(()=>{const e=Math.max(...l.map(({tier:e,items:t})=>{if("mov_percentage"!==e?.discountData?.type)return 0;const n=t.reduce((e,t)=>e+(t.price||0)*(t.quantity||1),0)/100,r=(e?.discountData?.tiers||[]).filter(e=>n>=e.minimumQuantity).sort((e,t)=>t.discountValue-e.discountValue)[0];return r?.discountValue??0}));if(e<($.current??0)&&($.current=e),e>($.current??0)){$.current=e;const t=document.querySelector(".yt-collection-bundle-next-btn");if(!t)return;const n=t.getBoundingClientRect(),r=(n.left+n.width/2)/window.innerWidth,o=(n.top+n.height/2)/window.innerHeight;Te({particleCount:100,spread:70,origin:{x:r,y:o},zIndex:9999})}},[l]),e.createElement("div",{ref:z,className:"yt-collection-bundle-bar",style:{background:S?.bundleBg||"#fff",color:S?.bundleText||"#333",border:S?.bundleBorder||"1px solid #878787",display:"flex",flexDirection:"column",position:"sticky",bottom:"10px",left:"0",right:"0",marginInline:"auto",width:"compact"==S.stickyBarWidth?"600px":"90%",maxWidth:"95%",zIndex:899,boxShadow:"0 -2px 10px rgba(0,0,0,0.1)",transition:"bottom 0.3s ease",borderRadius:S?.borderRadius||"8px",overflow:"hidden"}},_.length>0&&e.createElement("div",{style:{padding:"4px 8px",background:"#dbdbdbc5",color:"#6c757d",textAlign:"center",fontSize:"12px",fontWeight:500}},_.join(" + ")),e.createElement("div",{className:"yt-collection-bundle-bar-header",style:{position:"relative",textAlign:"center"}},N&&e.createElement(e.Fragment,null,e.createElement("style",null,"\n @keyframes fadeIn {\n from { opacity: 0; transform: translateX(-50%) translateY(10px); }\n to { opacity: 1; transform: translateX(-50%) translateY(0); }\n }\n "),e.createElement("div",{className:"yt-collection-bundle-ctx",style:{position:"absolute",top:"-40px",left:"50%",transform:"translateX(-50%)",background:S?.atcBg||"#007bff",color:S?.atcText||"#fff",padding:"4px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"14px",whiteSpace:"nowrap",zIndex:10,boxShadow:"0 4px 12px rgba(0,0,0,0.2)",animation:"fadeIn 0.3s ease-out",minWidth:"300px",textAlign:"center",border:"1px solid rgba(0,0,0,0.1)",lineHeight:"normal"}},"Add up to"," ",e.createElement("span",{style:{fontWeight:600}},u," item",u>1?"s":"")))),i.length>0&&e.createElement("div",{className:"yt-collection-bundle-bar-top",style:{display:"flex",alignItems:"center",padding:"8px 8px 0",position:"relative",borderRadius:S?.borderRadius||"8px"}},e.createElement("div",{className:"yt-collection-bundle-images",style:{display:"flex",flex:1,gap:"5px",justifyContent:"center",alignItems:"center",overflowX:"auto",padding:"4px 0",scrollbarWidth:"none"}},l.filter(({count:e})=>e>0).map(({items:t},n,r)=>e.createElement(e.Fragment,{key:n},e.createElement("div",{className:"yt-collection-bundle-tier-images",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",minWidth:"fit-content"}},e.createElement("div",{style:{display:"flex",gap:"4px"}},t.map((t,r)=>{const o=a.config.builderTiers.collectionTier.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId);if(!o)return null;const i=w(t.productId),l=p===i;return e.createElement("div",{key:r,className:"yt-collection-bundle-img-wrapper",style:{position:"relative",flexShrink:0,height:"65px"}},e.createElement("div",{style:{position:"relative",width:"67px",height:"67px",borderRadius:`calc(${S?.borderRadius||"8px"} / 2)`,overflow:"hidden",cursor:l?"default":"pointer",transition:"transform 0.2s ease"},onMouseEnter:e=>!l&&(e.currentTarget.style.transform="scale(1.08)"),onMouseLeave:e=>e.currentTarget.style.transform="scale(1)",onClick:()=>!l&&v(i)},e.createElement("img",{src:vm(o.images[0]),style:{width:"65px",height:"65px",objectFit:"cover",borderRadius:`calc(${S?.borderRadius||"8px"} / 2)`,transition:"opacity 0.2s",pointerEvents:"none",border:"1px solid #ddd"},alt:"Selected"}),t.quantity>1&&e.createElement("div",{className:"yt-collection-bundle-qty-badge",style:{position:"absolute",bottom:"4px",right:"4px",background:"rgba(0,0,0,0.7)",color:"#fff",borderRadius:"10px",padding:"2px 6px",fontSize:"10px",fontWeight:600,lineHeight:"normal"}},"x",t.quantity),e.createElement("button",{className:"yt-collection-bundle-remove-btn",style:{position:"absolute",top:"4px",right:"4px",width:"20px",height:"20px",background:"rgba(220,53,69,0.95)",color:"white",border:"none",borderRadius:"50%",fontSize:"12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.3)",textAlign:"center",lineHeight:"normal"},onClick:e=>{e.stopPropagation(),C(t.productId,t.variantId,n)}},"×")))}))),n<r.length-1&&r[n+1].count>0&&e.createElement("div",{style:{color:"#666",paddingInline:"6px",lineHeight:"normal"}},e.createElement(Z,null)))))),f?e.createElement("div",{className:"yt-collection-bundle-mobile-bar-content",style:{display:"flex",flexDirection:c>0&&(k||a?.config?.builderTiers?.collectionTier?.length>1)?"column":"row",margin:"4px",gap:c>0?"10px":"0",background:"#dbdbdb",borderRadius:S?.borderRadius||"8px",overflow:"hidden"}},e.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:i.length>0?"space-between":"center",alignItems:"center",borderRadius:S?.borderRadius||"8px"}},e.createElement(e.Fragment,null,0===c&&e.createElement("div",{style:{fontSize:"14px",color:"#6c757d",lineHeight:"normal",...0===c&&{padding:"8px 0 12px 0",background:"#dbdbdb",color:"#6c757d",width:"100%",borderRadius:S?.borderRadius||"8px"}}},"Add Items to Checkout"),c>0&&e.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"6px",width:"100%",justifyContent:"center",flexWrap:"wrap"}},e.createElement("div",{style:{fontSize:"14px",color:"#000",fontWeight:600}},I,(L??s).toLocaleString()),D?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},I,P.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",A)):e.createElement(e.Fragment,null,d>s&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},I,d.toLocaleString())),e.createElement("span",{style:{fontSize:"12px",color:"#000",fontWeight:500}},"(",c," items)")))),e.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"4px"}},(a?.config?.builderTiers?.collectionTier?.length>1||k)&&c>0&&e.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:1===p?"not-allowed":"pointer",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",textAlign:"center",lineHeight:"normal"},onClick:()=>v(e=>Math.max(1,e-1)),onMouseEnter:()=>b(-1),onMouseLeave:()=>b(null),disabled:1===p},"Back"),c>0&&e.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===m&&0===c||y?"yt-collection-bundle-next-btn-disabled":""),style:{background:S?.btnPrimaryBg||"#28a745",color:S?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",opacity:p===m&&0===c||y?.6:1,textAlign:"center",lineHeight:"normal"},onClick:p===m?E:()=>v(p+1),disabled:p===m&&0===c||x||y},x?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(Bs,null)):p===m?"Checkout":"Next"))):e.createElement("div",{className:"yt-collection-bundle-bar-bottom",style:{display:"flex",alignItems:"center",padding:"0px",background:"#dbdbdb",margin:"8px",borderRadius:S?.borderRadius||"8px",overflow:"hidden",scrollbarWidth:"none"}},(a?.config?.builderTiers?.collectionTier?.length>1||k)&&c>0&&e.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:1===p?"not-allowed":"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",...-1===h&&{filter:"brightness(60%)"},textAlign:"center",lineHeight:"normal"},onClick:()=>v(e=>Math.max(1,e-1)),onMouseEnter:()=>b(-1),onMouseLeave:()=>b(null),disabled:1===p},"Back"),e.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:i.length>0?"space-between":"center",paddingInline:"6px",alignItems:"center",...0===c&&{padding:"12px 24px"}}},0===c&&e.createElement("div",{style:{fontSize:"16px",color:"#6c757d",lineHeight:"normal"}},"Add Items to Checkout"),c>0&&e.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",justifyContent:"center"}},e.createElement("div",{style:{fontSize:"16px",color:"#000",fontWeight:600}},I,(L??s).toLocaleString()),D?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},I,P.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",A)):e.createElement(e.Fragment,null,d>s&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},I,d.toLocaleString())),e.createElement("span",{style:{fontSize:"16px",color:"#000",fontWeight:500}},"(",c," items)"))),c>0&&e.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===m&&0===c||y?"yt-collection-bundle-next-btn-disabled":""),style:{background:S?.btnPrimaryBg||"#28a745",color:S?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",opacity:p===m&&0===c||y?.6:1,...-2===h&&{filter:"brightness(90%)"},textAlign:"center",lineHeight:"normal"},onClick:p===m?E:()=>v(p+1),disabled:p===m&&0===c||x||y,onMouseEnter:()=>b(-2),onMouseLeave:()=>b(null)},x?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(Bs,null)):p===m?"Checkout":"Next")))},hm=window?.Shopify?.currency||{rate:1,active:window?.ShopifyAnalytics?.meta?.currency||"INR"},bm=e=>{if(!e)return;const t=navigator.language||"en-US";return new Intl.NumberFormat(t).format(Number(e))},wm=(e,t)=>t==hm.active?e:me(hm.active)||hm.active,vm=(e,t)=>{if(!e||!e.includes("cdn.shopify")&&!e.includes("/cdn/shop/files/"))return e;try{const n=new URL(e),r=n.searchParams;return r.has("format")||r.set("format","webp"),r.has("quality")||r.set("quality",t?.toString()||"70"),r.has("width")||r.set("width","600"),n.toString()}catch{const n=e.includes("?")?"&":"?";return e+n+`format=webp&quality=70&width=${t?.toString()||"600"}`}},Cm=(e,t,n,r,o,a,i)=>{const l=r.findIndex(t=>t.variantId===e&&(void 0===i||t.tierIndex===i));o(0===n?e=>e.filter((e,t)=>t!==l):-1===l?r=>[...r,{product:t,variantId:e,quantity:n,isFree:a,tierIndex:i}]:e=>e.map((e,t)=>t===l?{...e,quantity:e.quantity+n,isFree:a,tierIndex:i}:e))},Em=({bundle:t,currentProductId:n,addToCartFunction:r,addCustomBundleToCart:o,selectedItems:a,setSelectedItems:i,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:s,renderingOnPage:d,bundleSubtotal:p,dispatchAnalyticsEvent:m,fetchStoreDetails:u,productsPagination:g})=>"fixed"!==t.type&&t.type&&0!==t?.type?.length?"builder"===t.type?e.createElement(Ls,{bundleAddToCartLoading:l,bundle:t,selectedItems:a,setSelectedItems:i,handleAddToCart:o,handleRemoveItem:c,renderingOnPage:d,selectedItemsQuantity:s??0,bundleSubtotal:p??{price:0,compareAtPrice:0},dispatchAnalyticsEvent:m,fetchStoreDetails:u,productsPagination:g}):"combo"===t.type?e.createElement(Ms,{bundle:t,addToCartFunction:r,dispatchAnalyticsEvent:m}):"mixAndMatch"===t.type?e.createElement(Gd,{bundle:t,addToCartFunction:r,dispatchAnalyticsEvent:m}):"collection"===t.type?e.createElement(gm,{config:t,addCustomBundleToCart:o,bundleAddToCartLoading:l}):e.createElement(xd,{bundle:t,currentProductId:n,addToCartFunction:r,dispatchAnalyticsEvent:m}):e.createElement(im,{addToCartFunction:r,bundle:t,dispatchAnalyticsEvent:m}),km=s.div`
4679
+ `,tm=({productsWithIndices:o,isOpen:a,onClose:i,cta:l,variantOptions:c,onVariantChange:s,handleAddToCart:d,primaryProductId:p,variantId:m})=>{const u=r(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),[g,f]=t({}),[x,y]=t({});n(()=>{const e={},t={};o?.forEach(({product:n,index:r})=>{let o,a=[];if(n.productId===p&&m){const e=n?.productDetails?.variants?.edges.find(e=>e?.node?.id?.includes(m))?.node;e&&u(n.productDetails,e.id)>0&&(a=e.title.split(" / "),o=e)}if(!a.length){const e=n.productDetails.variants.edges.find(e=>u(n.productDetails,e?.node?.id)>0)?.node||n?.productDetails?.variants?.edges?.[0]?.node;e?(a=e.title.split(" / "),o=e):a=n?.productDetails?.options?.map(e=>e.values[0]??"")}e[r]=a,o&&(t[r]={node:o},s(r,o.id))}),f(e),y(t)},[o,p,m,s,u]),n(()=>{if(!p||!m)return;const e=o?.find(({product:e})=>e?.productId===p);if(!e)return;const{product:t,index:n}=e,r=t?.productDetails?.variants?.edges?.find(e=>e.node.id.includes(m))?.node;if(r&&u(t.productDetails,r.id)>0){const e=r.title.split(" / ");f(t=>({...t,[n]:e})),y(e=>({...e,[n]:{node:r}})),s(n,r.id)}},[m,p,o,s,u]);const h=(e,t,n,r)=>{const o=[...g[e]||[]];o[t]=n;const a=o.join(" / "),i=r.productDetails.variants.edges.find(e=>e.node.title===a)?.node;return!!i&&u(r.productDetails,i.id)>0},b=(e,t,n)=>{const{product:r}=o?.find(t=>t.index===e)||{product:{productDetails:{variants:{edges:[]}}}};if(!r?.productDetails)return;if(!h(e,n,t,r))return;const a={...g};a[e][n]=t,f(a);const i=r?.productDetails?.variants?.edges?.find(t=>t.node.title===a[e].join(" / "))?.node;i&&(s(e,i.id),y(t=>({...t,[e]:{node:i}})))};if(!a)return null;const w=e.createElement(Op,{className:"yt-fixedBundle-variant-modal_overlay",onClick:i},e.createElement(Vp,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},e.createElement(Wp,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:l.backgroundColor,color:l.textColor}},"Select Options"),o?.map(({product:t,index:n},r)=>e.createElement(e.Fragment,null,e.createElement(jp,{className:"yt-fixedBundle-variant-modal_product-block"},e.createElement(qp,{className:"yt-fixedBundle-variant-modal_thumbnail",src:x[n]?.node?.image?.url||t.productDetails.featuredMedia?.preview?.image?.url,alt:t.productDetails.title}),e.createElement(Up,{className:"yt-fixedBundle-variant-modal_product-info"},e.createElement(Zp,{className:"yt-fixedBundle-variant-modal_product-name"},t.productDetails.title,t?.productDetails?.variants?.edges?.filter(e=>"Default Title"!==e.node.title)?.length>0&&e.createElement(Gp,{className:"yt-fixedBundle-variant-modal_selected-value"},g[n]?.join(" / "))),t.productDetails.options.map((r,o)=>{const a=c&&c?.options?.find(e=>e.name===r.name),i=r.values.filter(e=>t.productDetails.variants.edges.some(t=>t.node.title.split(" / ")[o]===e));return 0===i.length||1===i.length&&"Default Title"===i[0]?e.createElement(e.Fragment,null):a&&"color"===a?.type?e.createElement(Yp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(em,{className:"yt-fixedBundle-variant-modal_option-name"},r.name," :"," "),i.map((r,i)=>{const l=!h(n,o,r,t);return e.createElement(e.Fragment,null,a.values.find(e=>e.name===r)?.value?e.createElement(Xp,{className:"yt-fixedBundle-variant-modal_color-swatch",key:i,color:a.values.find(e=>e.name===r)?.value||r,selected:g[n]?.[o]==r,disabled:l,onClick:()=>{b(n,r,o)}},e.createElement("span",null)):e.createElement(Kp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:i,selected:g[n]?.[o]==r,disabled:l,onClick:()=>{b(n,r,o)}},r))})):a&&"image"===a?.type?e.createElement(Yp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(em,{className:"yt-fixedBundle-variant-modal_option-name"},r.name," :"," "),i.map((r,i)=>{const l=!h(n,o,r,t);return e.createElement(e.Fragment,null,a?.values.find(e=>e.name===r)?.value?e.createElement(Jp,{className:"yt-fixedBundle-variant-modal_image-swatch",key:i,selected:g[n]?.[o]==r,disabled:l,onClick:()=>{b(n,r,o)},src:a.values.find(e=>e.name===r)?.value},e.createElement("span",null)):e.createElement(Kp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:i,selected:g[n]?.[o]==r,disabled:l,onClick:()=>{b(n,r,o)}},r))})):e.createElement(Yp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(em,{className:"yt-fixedBundle-variant-modal_option-name"},r.name," :"," "),i.map((r,i)=>{const l=!h(n,o,r,t);return e.createElement(Kp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:i,selected:g[n]?.[o]==r,disabled:l,onClick:()=>{b(n,r,o)}},"text"===a?.type&&a.values.find(e=>e.name===r)?.value||r)}))}))),r<o.length-1&&e.createElement(Qp,{className:"yt-fixedBundle-variant-modal_divider"}))),e.createElement(Hp,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:l.backgroundColor,color:l.textColor},onClick:d},"Add bundle to cart")));return D.createPortal(w,document.body)},nm=(e,t=64)=>{if(!e)return"/placeholder.svg";try{const n=new URL(e);return n.searchParams.set("width",String(t)),n.toString()}catch{return e}},rm=({options:r,selectedValue:a,onChange:i,type:l="text"})=>{const[c,s]=t(!1),d=o(null);n(()=>{const e=e=>{d.current&&!d.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const p=t=>"color"===l?e.createElement(Ap,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:t.value},e.createElement("span",null)):"image"===l?e.createElement(Lp,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:t.value||"/placeholder.svg",alt:t.name},e.createElement("span",null)):null;return e.createElement(Bp,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:d},e.createElement(zp,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>s(!c)},e.createElement($p,{className:"yt-fixedBundle-variant-dropdown-horizontal_content"},a&&("color"===l||"image"===l)&&p(a),e.createElement("span",{className:"yt-fixedBundle-variant-dropdown-horizontal_selected-text"},a&&a.name)),e.createElement(Fp,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:c})),c&&e.createElement(Ip,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},r?.map(t=>e.createElement(Pp,{className:"yt-fixedBundle-variant-selector_dropdown-item "+(a?.name===t.name?"yt-fixedBundle-variant-selector_dropdown-item--selected":""),key:t.name,$isSelected:a?.name===t.name,onClick:()=>{t.disabled||(i(t),s(!1))},style:{opacity:t.disabled?.5:1,cursor:t.disabled?"not-allowed":"pointer"}},("color"===l||"image"===l)&&p(t),e.createElement(Dp,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},t.name)))))},om=({product:r,variantOptions:o,selectedVariants:a,onVariantChange:i,variantId:l,primaryProductId:c,variantType:s="dropdown",accentColor:d="#000000"})=>{const p=(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?.toLocaleLowerCase()?1/0:0:1/0:0},[m,u]=t(a||[]);n(()=>{a&&a.length>0&&u(a)},[a]),n(()=>{if(l&&r.variants.edges.some(e=>e.node.id.includes(l))){const e=r.variants.edges.find(e=>e.node.id.includes(l))?.node;if(e){const t=e.title.split(" / ");u(t)}}},[l,r]);const g=e=>{if(!o?.options)return"text";const t=o.options.find(t=>t.name===e);return t?.type||"text"},f=(e,t)=>{const n=m[t];if(!n)return null;return x(e,t).find(e=>e.name===n)||null},x=(e,t)=>{const n=o?.options?.find(t=>t.name===e.name);return e.values.filter(e=>r.variants.edges.some(n=>n.node.title.split(" / ")[t]===e)).map(e=>{const o=n?.values?.find(t=>t.name===e),a=!((e,t,n)=>{const r=[...m||[]];r[e]=t;const o=r.join(" / "),a=n.variants.edges.find(e=>e.node.title===o)?.node;return!!a&&p(n,a.id)>0})(t,e,r);return{name:e,value:o?.value||e,disabled:a}})},y=(e,t)=>e.values.filter(e=>r.variants.edges.some(n=>n.node.title.split(" / ")[t]===e));return"swatches"===s||"auto"===s?e.createElement(e.Fragment,null,r.options.map((t,n)=>{const a=o?.options?.find(e=>e.name===t.name);return e.createElement("div",{key:t.name,className:"yt-fixedBundle-product-option-group-horizontal",style:{...t?.values?.length>1&&{marginTop:"10px"},display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"}},r.options.length>1&&y(t,n)?.length>1&&e.createElement("label",{className:"yt-fixedBundle-product-option-label",style:{fontSize:"12px",fontWeight:"500",color:"#333"}},t.name,":"),y(t,n)?.length>1&&e.createElement("div",{className:"yt-fixedBundle-product-option-values-horizontal",style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"}},y(t,n).map(t=>{const o=[...m];o[n]=t;const l=r.options.length>0?o.join(" / "):o[n],c=r.variants.edges.find(e=>e.node.title===l)?.node,s=0===(c?p(r,c.id):0),u=m[n]===t;if("color"===a?.type){const n=a.values.find(e=>e.name===t)?.value;return e.createElement("button",{key:t,className:`yt-fixedBundle-product-option-button-color${u?" yt-fixedBundle-product-option-button-selected":""}${s?" yt-fixedBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&i(c.id)},disabled:s,style:{borderRadius:"50%",padding:"1px",backgroundColor:"white",border:u&&!s?`1px solid ${d}`:"1px solid transparent",opacity:s?.5:1,cursor:s?"not-allowed":"pointer"}},n?e.createElement("div",{className:"yt-fixedBundle-product-option-color-swatch",style:{width:u&&!s?"26px":"24px",height:u&&!s?"26px":"24px",borderRadius:"50%",backgroundColor:n}},e.createElement("span",null)):e.createElement("span",{className:"yt-fixedBundle-product-option-text",style:{padding:"4px 8px",border:u&&!s?`1px solid ${d}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},t))}if("image"===a?.type){const n=a.values.find(e=>e.name===t)?.value;return e.createElement("button",{key:t,className:`yt-fixedBundle-product-option-button-image${u?" yt-fixedBundle-product-option-button-selected":""}${s?" yt-fixedBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&i(c.id)},disabled:s,style:{border:u&&!s?`1px solid ${d}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:u&&!s?"#F7F7F7":"transparent",cursor:s?"not-allowed":"pointer",padding:"0px",width:u&&!s?"26px":"24px",height:u&&!s?"26px":"24px",overflow:"hidden",opacity:s?.5:1}},n?e.createElement("img",{className:"yt-fixedBundle-product-option-image",src:nm(n),alt:t,style:{width:u&&!s?"26px":"24px",height:u&&!s?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}}):e.createElement("span",{className:"yt-fixedBundle-product-option-text",style:{padding:"4px 8px",border:u&&!s?`1px solid ${d}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},t))}return e.createElement("button",{key:t,className:`yt-fixedBundle-product-option-button-text${u?" yt-fixedBundle-product-option-button-selected":""}${s?" yt-fixedBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&i(c.id)},disabled:s,style:{padding:"4px 8px",border:u&&!s?`1px solid ${d}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",cursor:s?"not-allowed":"pointer",fontSize:"10px",fontWeight:"600",opacity:s?.5:1}},"text"===a?.type&&a.values.find(e=>e.name===t)?.value||t)})))})):e.createElement(_p,{className:"yt-fixedBundle-variant-selector-horizontal_container"},r.options.map((t,n)=>{const o=x(t,n);return 0===o.length||1===o.length&&"Default Title"===o[0].name?null:e.createElement(Rp,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:t.name,$isFirst:0===n},e.createElement(rm,{options:o,selectedValue:f(t,n),onChange:e=>{((e,t)=>{const n=[...m];n[e]=t.name,u(n);const o=r.variants.edges.find(t=>t.node.title===(r.options?.length>0?n.join(" / "):n[e]))?.node.id;i(o||"")})(n,e)},type:g(t.name)}))}))},am=({product:o,selectedVariantId:i,isChecked:l,canCustomize:c,styles:s,onVariantChange:d,onCheckChange:p,isMobile:m,isHorizontal:u,index:g,variantOptions:f,productsLength:x,handleOpenModal:y,storeCurrencyCode:h,primaryProductId:b,variantId:w,checkedProducts:v,bundleDiscountValue:C,bundleDiscountType:E,bundleProductsCount:k,totalSelectedOriginal:T,reviewRatingType:S})=>{const N="23e4dd-58.myshopify.com"!==window.Shopify?.shop,B=r(()=>e=>{const t=o?.variants?.edges?.find(t=>t.node.id===e),n=t?.node;return n?o?.tracksInventory&&n.inventoryItem?.tracked?n.inventoryQuantity>0?n.inventoryQuantity:n.inventoryQuantity<=0&&"continue"===n.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[o]),[z,$]=t(o?.variants?.edges.find(e=>B(e?.node?.id)>0)?.node||o?.variants?.edges?.[0]?.node),F=r(()=>z?.title?.split(" / ")||[],[z]),I=o?.id===b;n(()=>{if(o.id===b){const e=o?.variants?.edges?.find(e=>e?.node?.id?.includes(i))?.node;e&&B(e.id)>0&&($(e),d(e.id))}else{const e=o?.variants?.edges?.find(e=>e?.node?.id===i)?.node||o?.variants?.edges?.find(e=>B(e?.node?.id)>0)?.node||o?.variants?.edges?.[0]?.node;$(e)}},[o,b,i,w,d,B]);const P=a(e=>{const t=o?.variants?.edges?.find(t=>t.node.id===e)?.node;t&&d(e)},[o,d]),D=s?.fixedBundle?.discountBadgeDisplay,A=parseFloat(z?.price??"0"),L=v?.size===k,_=((e,t,n,r,o,a)=>{if(0===r||!n)return e;if(r!==o)return e;switch(t){case"percentOff":case"percentageOff":case"percentage":case"Percentage":return e*(1-n/100);case"amountOff":case"amount":case"Amount Off":{if(a<=0)return e;const t=e/a*n;return Math.max(0,e-t)}case"fixedPrice":case"fixed":case"fixedPrice":return n*(e/a);default:return e}})(A,E,C??0,v?.size,k,T),R=L?_:parseFloat(z?.price??"0"),M="discount-on-compare"===D?parseFloat(z?.compareAtPrice||z?.price||"0"):parseFloat(z?.price??"0"),O=s?.fixedBundle?.compareAtPriceVisibility&&M>R,V=(e=>{const t="string"==typeof e?parseFloat(e):e;return N?t.toFixed(2):Math.round(t).toString()})(R),W="undefined"!=typeof window&&"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,H=z?.image?.url||o.featuredMedia?.preview?.image?.url;return e.createElement(e.Fragment,null,u?e.createElement("div",{className:""+(o.id===b?"yt-fixedBundle-product-card--horizontal-primary":"yt-fixedBundle-product-card--horizontal-associated"),style:{display:"flex",alignItems:"center",gap:"10px"}},c&&e.createElement("div",{className:"yt-fixedBundle-product-card_checkbox-wrapper--horizontal"},e.createElement("input",{type:"checkbox",style:{display:"none"},className:"yt-fixedBundle-product-card_checkbox-hidden",id:`checkbox-${o.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:I}),e.createElement("label",{className:"yt-fixed-bundle-checkbox-label yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${o.id}-${g}`,style:{width:"18px",height:"18px",border:"1.5px solid "+((s.fixedBundle?.borderColor??"#ccc")+"80"),borderRadius:s.fixedBundle?.borderRadius??"4px",backgroundColor:l?s.general?.ctaBackgroundColor??"#d3122a":"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.2s ease",color:"white"}},e.createElement(Y,{style:{fontSize:"14px",visibility:l?"visible":"hidden"}}))),e.createElement(ep,{className:"yt-fixedBundle-product-card-horizontal_item",style:{borderRadius:s.fixedBundle?.borderRadius,border:`1px solid ${s.fixedBundle?.borderColor}80`,backgroundColor:s.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`8px 8px 8px -6px ${s.fixedBundle.borderColor}`,"no-spread":`4px 4px 0px -1px ${s.fixedBundle.borderColor}80`}[s.fixedBundle.shadowType]||"none"},canCustomize:c},"undefined"!=typeof window&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&e.createElement(tp,{className:"yt-fixedBundle-product-card-horizontal_image",src:vm(H),alt:o.title,style:{borderRadius:s.fixedBundle?.borderRadius,borderColor:s.fixedBundle?.borderColor,aspectRatio:s.general?.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),e.createElement(np,{className:"yt-fixedBundle-product-card-horizontal_details"},e.createElement(rp,{className:"yt-fixedBundle-product-card-horizontal_title"},o.title),"ratingOnly"===S&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-fixedBundle-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333",paddingBottom:"4px",lineHeight:"normal"}},e.createElement(Fe,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6,lineHeight:"normal"}},o?.rating?.averageRating," ",e.createElement("span",null," rating"))),"ratingAndReviewCount"===S&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-fixedBundle-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333",paddingBottom:"4px",lineHeight:"normal"}},e.createElement(Fe,{color:"gold",size:14})," ",o?.rating?.averageRating,e.createElement(ke,{className:"yt-fixedBundle-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",o?.rating?.ratingCount," ",e.createElement("span",{style:{marginLeft:"2px"}},"reviews")," ",")"),s.fixedBundle.productsPriceVisibility&&e.createElement(op,{className:"yt-fixedBundle-product-card-horizontal_price-section"},e.createElement(ap,{className:"yt-fixedBundle-product-card-horizontal_price--new"},wm(s.general.currencySymbol,h)," ",bm(V)),O&&M>R&&e.createElement(ip,{className:"yt-fixedBundle-product-card-horizontal_price--old"},wm(s.general.currencySymbol,h),bm(N?M.toFixed(2):Math.round(M).toString()))),e.createElement(om,{product:o,variantOptions:f,selectedVariants:F,onVariantChange:P,variantId:w,primaryProductId:b,variantType:s?.fixedBundle?.variantSelectorType,accentColor:s?.general?.ctaBackgroundColor})))):e.createElement(e.Fragment,null,e.createElement(fp,{className:""+(o.id===b?"yt-fixedBundle-product-card--vertical-primary":"yt-fixedBundle-product-card--vertical-associated"),productsLength:x,style:{borderRadius:s.fixedBundle?.borderRadius,border:`1px solid ${s.fixedBundle?.borderColor}50`,backgroundColor:s.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`0 4px 10px -6px ${s.fixedBundle.borderColor}50`,"no-spread":`4px 4px 0px -1px ${s.fixedBundle.borderColor}50`}[s.fixedBundle.shadowType]||"none",...c&&{position:"relative"},...W&&{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",minWidth:"max-content",paddingLeft:"2px"}},borderRadius:s.fixedBundle?.borderRadius,borderColor:s.fixedBundle?.borderColor,backgroundColor:s.fixedBundle?.cardBackgroundColor},c&&e.createElement(Mp,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:W},e.createElement("input",{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${o.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:I}),e.createElement("label",{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${o.id}-${g}`,style:{width:"18px",height:"18px",border:"1.5px solid "+((s.fixedBundle?.borderColor??"#ccc")+"80"),borderRadius:s.fixedBundle?.borderRadius??"4px",backgroundColor:l?s.general?.ctaBackgroundColor??"#d3122a":"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.2s ease",color:"white"}},e.createElement(Y,{size:10,style:{fontSize:"14px",visibility:l?"visible":"hidden"}}))),"undefined"!=typeof window&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&e.createElement(xp,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:s.general.imageAspectRatio,height:"fit-content"}},e.createElement(yp,{className:"yt-fixedBundle-product-card_image--vertical",src:vm(H),style:{aspectRatio:s.general.imageAspectRatio},alt:o.title}),o.variants.edges.length>1&&e.createElement(hp,{className:"yt-fixedBundle-product-card_badge-container"},e.createElement(bp,{className:"yt-fixedBundle-product-card_circle-button"},e.createElement("span",null)),e.createElement(wp,{className:"yt-fixedBundle-product-card_circle-button-two"},e.createElement("span",null)),e.createElement(vp,{className:"yt-fixedBundle-product-card_count-badge"},o.variants.edges.length,"+"))),e.createElement(Cp,{className:"yt-fixedBundle-product-card-vertical_info"},e.createElement(Ep,{className:"yt-fixedBundle-product-card-vertical_title"},o.title),"ratingOnly"===S&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-fixedBundle-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333",paddingTop:"4px",paddingBottom:"6px",lineHeight:"normal"}},e.createElement(Fe,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6,lineHeight:"normal"}},o?.rating?.averageRating," ",e.createElement("span",null,"rating"))),"ratingAndReviewCount"===S&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-fixedBundle-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333",paddingTop:"4px",paddingBottom:"6px",lineHeight:"normal"}},e.createElement(Fe,{color:"gold",size:14})," ",o?.rating?.averageRating,e.createElement(ke,{className:"yt-fixedBundle-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",o?.rating?.ratingCount," ",e.createElement("span",{style:{marginLeft:"2px"}},"reviews"),")"),s.fixedBundle.productsPriceVisibility&&e.createElement(Tp,{className:"yt-fixedBundle-product-card-vertical_price-line"},e.createElement(kp,{className:"yt-fixedBundle-product-card-vertical_price--new"},wm(s.general.currencySymbol,h),bm(V)),s.fixedBundle.compareAtPriceVisibility&&O&&M>R&&e.createElement(ip,{className:"yt-fixedBundle-product-card-vertical_price--old"},wm(s.general.currencySymbol,h),bm(M))))),(x<=3||!m)&&g<x-1&&e.createElement(Sp,{className:"yt-fixedBundle-plus-wrapper"}," ",e.createElement(Np,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},im=({bundle:o,addToCartFunction:i,dispatchAnalyticsEvent:l})=>{const[c,s]=t(!1),[d,p]=t(window.innerWidth<786),[m,u]=t(null),[g,f]=t(!1),[x,y]=t(!1),h="undefined"!=typeof window?window.location.href:null,b=o?.products?.find(e=>e.productDetails?.handle===h?.split("/").pop()?.split("?")[0]),w=b?.productId,v=r(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),[C,E]=t(Object.fromEntries(o?.products?.map((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find(t=>v(e.productDetails,t?.node?.id)>0)?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id]))),k="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"beautywiseshop.myshopify.com"===window.ytBundleApp?.storeDomain||"swashaa.myshopify.com"===window.ytBundleApp?.storeDomain),T=o?.showIndividualProductSelector??!0,[S,N]=t(new Set(o.products.reduce((e,t,n)=>(k&&t?.productId!==w&&!T||e.push(n),e),[])));n(()=>{l?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:o._id,bundleType:"fixed-bundle"}});const e=()=>{const e=new URL(window.location.href).searchParams.get("variant");u(e)},t=e=>{const t=history[e];return function(...n){const r=t.apply(this,n);return window.dispatchEvent(new Event(e.toLowerCase())),r}};return history.pushState=t("pushState"),history.replaceState=t("replaceState"),window.addEventListener("pushstate",e),window.addEventListener("replacestate",e),e(),()=>{window.removeEventListener("pushstate",e),window.removeEventListener("replacestate",e)}},[]),n(()=>{m&&w&&E(e=>{const t={...e};return o?.products?.forEach((e,n)=>{e.productId===w&&(t[n.toString()]=m)}),t})},[m,w,o?.products]),n(()=>{const e=()=>{p(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const B=a((e,t)=>{E(n=>({...n,[e.toString()]:t}))},[]),z=(e,t)=>{const n=o.products[t].productId;k&&n===w||N(n=>{const r=new Set(n);return e?r.add(t):r.delete(t),r})},$=r(()=>(e,t)=>v(e.productDetails,t)>0,[v]),F=r(()=>o.products.some((e,t)=>S.has(t)&&e.productDetails.variants.edges.length>1),[o.products,S]),I="23e4dd-58.myshopify.com"!==window.Shopify?.shop,P=e=>{const t="string"==typeof e?parseFloat(e):e;return I?t.toFixed(2):Math.round(t).toString()},{originalPrice:D,dealPrice:A,offerValue:L,totalCompareAtPrice:_,totalPrice:R}=r(()=>{const{price:e,compareAtPrice:t}=o.products.reduce((e,t,n)=>{if(!S.has(n))return e;const r=C[n.toString()];if(!r)return e;const o=t.productDetails.variants.edges?.find(e=>e.node.id===r)?.node;if(!o)return e;const a=parseFloat(o?.price??"0"),i=parseFloat(o?.compareAtPrice||a.toString());return e.price+=a,e.compareAtPrice+=i,e},{price:0,compareAtPrice:0}),n=o?.customizations?.fixedBundle?.discountBadgeDisplay||"discount-on-price";let r=e;S.size===o.products.length&&(o?.percentageOff?r=e*(1-o.percentageOff/100):o?.dealAmount?r=o.dealAmount:o?.amountOff&&(r=e-o.amountOff));const a=o?.customizations?.fixedBundle?.discountBadgeVisibility,i=!1===a?r:"discount-on-compare"===n?t:e,l=i-r;return{originalPrice:P(i),dealPrice:P(r),offerValue:P(l),totalPrice:e,totalCompareAtPrice:t}},[o.products,C,S,o.percentageOff,o.dealAmount,o.amountOff,o?.customizations?.fixedBundle?.discountBadgeDisplay,o?.customizations?.fixedBundle?.discountBadgeVisibility]),M=r(()=>o.products.map((e,t)=>({product:e,index:t})).filter(({index:e})=>S.has(e)),[o.products,S]),O=M.every(({product:e,index:t})=>$(e,C[t.toString()])),V=r(()=>{let e=0;return o.products.forEach((t,n)=>{if(S.has(n)){const r=C[n.toString()],o=t.productDetails.variants.edges.find(e=>e.node.id===r)?.node;o&&(e+=parseFloat(o.price??"0"))}}),e},[o.products,S,C]),W=async e=>{s(!0),f(!1),l?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:o._id,bundleType:"fixed-bundle",selectedProducts:M?.map(e=>({id:e?.product?.productId,title:e?.product?.productDetails?.title}))}});try{const t=Object.entries(C).map(([e,t])=>{const n=parseInt(e);return isNaN(n)||!S.has(n)?null:t}).filter(Boolean);i&&await i(Number(D),t,void 0,void 0,e)}catch(e){console.error("Error adding to cart:",e)}s(!1)},H=async e=>{if(O){if(e&&(e.preventDefault(),e.stopPropagation()),o?.personalizedForm?.title)return f(!1),void y(!0);await W()}};if(!i)return e.createElement(e.Fragment,null);const j=o.customizations,q=j.fixedBundle?.cardLayoutStyle||"auto",U="horizontal"===q||"auto"===q&&d,Z="bundles"==o.appName?o.pageHeader?.title:o?.title,Q="bundles"==o.appName?o.pageHeader?.description:o?.subtitle;return e.createElement(Yd,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:j.fixedBundle.sectionBackgroundColor,..."transparent"!==j.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},Z&&e.createElement(Xd,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:j.fixedBundle?.titleBackgroundColor||"none",color:j.fixedBundle?.titleTextColor||"black",textAlign:j.fixedBundle.infoAlignment??"center",fontSize:j.fixedBundle?.titleFontSize,..."transparent"!==j.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===j.fixedBundle.infoAlignment&&"transparent"!==j.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===j.fixedBundle.infoAlignment&&"transparent"!==j.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===j.fixedBundle.infoAlignment&&"transparent"===j.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},Z),Q&&e.createElement(Kd,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:j.fixedBundle?.subtitleFontSize,textAlign:j.fixedBundle.infoAlignment??"center",..."left"===j.fixedBundle.infoAlignment&&"transparent"!==j.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===j.fixedBundle.infoAlignment&&"transparent"!==j.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===j.fixedBundle.infoAlignment&&"transparent"===j.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},Q),U?e.createElement(Jd,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},o?.products?.map((t,n,r)=>e.createElement(e.Fragment,{key:`${t.productId}-${n}`},e.createElement(am,{isChecked:S.has(n),product:t.productDetails,selectedVariantId:C[n.toString()]||"",canCustomize:o?.canCustomizeFixedBundle||!1,styles:j,onVariantChange:e=>B(n,e),onCheckChange:e=>{z(e,n)},isMobile:d,index:n,isHorizontal:U,variantOptions:o.variantOptions,productsLength:o.products.length,storeCurrencyCode:o.storeCurrencyCode,primaryProductId:w,variantId:m||void 0,bundleDiscountType:o.discountType??"none",checkedProducts:S,bundleProductsCount:o.products.length,bundleDiscountValue:o.percentageOff||o.amountOff||o.dealAmount,totalSelectedOriginal:V,reviewRatingType:j?.fixedBundle?.productRatingsDisplay??o?.reviewRatingType}),n<r.length-1&&e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"},className:"yt-fixedBundle-plus-icon-container"},e.createElement("span",{style:{padding:d?"1px":"2px",background:"#0000000D",..."none"!==j?.fixedBundle?.shadowType&&{marginTop:"2px"},display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center"},className:"yt-fixedBundle-plus-icon-wrapper"},e.createElement(_e,{color:"black",style:{height:d?"16px":"24px",width:d?"16px":"24px",color:"black",lineHeight:"nomal"},className:"yt-fixedBundle-plus-icon-svg"})))))):e.createElement(up,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},e.createElement(gp,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===j.fixedBundle.infoAlignment?"flex-start":"right"===j.fixedBundle.infoAlignment?"flex-end":"center"}},o?.products?.map((t,n)=>e.createElement(am,{key:`${t.productId}-${n}`,isChecked:S.has(n),product:t.productDetails,selectedVariantId:C[n.toString()]||"",canCustomize:o?.canCustomizeFixedBundle||!1,styles:j,onVariantChange:e=>{B(n,e)},onCheckChange:e=>z(e,n),isMobile:d,index:n,isHorizontal:U,productsLength:o.products.length,storeCurrencyCode:o.storeCurrencyCode,primaryProductId:w,variantId:m||void 0,bundleDiscountType:o.discountType??"none",checkedProducts:S,bundleProductsCount:o.products.length,bundleDiscountValue:o.percentageOff||o.amountOff||o.dealAmount,totalSelectedOriginal:V,reviewRatingType:j?.fixedBundle.productRatingsDisplay??o?.reviewRatingType})),F&&e.createElement(tm,{productsWithIndices:M,isOpen:g,onClose:()=>f(!1),variantOptions:o.variantOptions,cta:{textColor:j.general.ctaTextColor,backgroundColor:j.general.ctaBackgroundColor},onVariantChange:B,handleAddToCart:H,primaryProductId:w,variantId:m||void 0}))),e.createElement(lp,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===j.fixedBundle.infoAlignment?"flex-start":"right"===j.fixedBundle.infoAlignment?"flex-end":"center"}},Number(D)>0&&Number(L)>0&&j.fixedBundle.compareAtPriceVisibility&&e.createElement(cp,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",e.createElement(dp,{className:"yt-fixedBundle-summary_price"},wm(j.general.currencySymbol,o?.storeCurrencyCode),bm(D))),0!==S.size&&e.createElement(sp,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",e.createElement(dp,{className:"yt-fixedBundle-summary_price"},wm(j.general.currencySymbol,o?.storeCurrencyCode),bm(A))," ",Number(L)>0&&(()=>{let t="";if("percentage"===(j?.fixedBundle?.discountDisplayType||"amount")){const e="discount-on-compare"===(j?.fixedBundle?.discountBadgeDisplay||"discount-on-price")?_:R,n=e>0?Math.round(Number(L)/e*100):0;t=n>0?`${n}% Off`:""}else t=`Save: ${wm(j.general.currencySymbol,o?.storeCurrencyCode)}${bm(L)}`;return t?e.createElement(pp,{className:"yt-fixedBundle-summary_save-tag"},t):null})())),e.createElement(mp,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),U||!F?H(e):f(!0)},disabled:S.size<1||c||!O,style:{backgroundColor:j.general?.ctaBackgroundColor||"#121212",color:j.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${j.general?.ctaBackgroundColor||"#121212"}`,boxShadow:j.general.ctaShadowType,paddingTop:j.general?.ctaPadding,paddingBottom:j.general?.ctaPadding,borderRadius:j.general.ctaBorderRadius,width:j.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{j.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=j.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=j.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{j.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=j.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=j.general?.ctaTextColor||"#FFFFFF")}},c?e.createElement(fe,{color:"white",loading:c,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):O?e.createElement(e.Fragment,null,j.fixedBundle?.ctaTitle??"Add Bundle to cart"):e.createElement(e.Fragment,null,"Out of Stock")),o?.personalizedForm?.title&&e.createElement(_s,{isOpen:x,onClose:()=>y(!1),formConfig:o.personalizedForm,onCheckout:async e=>{await W(e),y(!1)},cta:{backgroundColor:j.general?.ctaBackgroundColor||"#121212",textColor:j.general?.ctaTextColor||"#FFFFFF"},isMobile:d}))},lm=()=>window?.ShopifyAnalytics?.meta?.currency||window?.Shopify?.currency?.active||"USD",cm=({product:r,tierIdx:o,isOpen:a,onClose:i,onAddToBundle:l,canAdd:c,isSelected:s,customizations:d,isMobile:p,splitVariants:m=!1})=>{const[u,g]=t(0),[f,x]=t(r.variants[0]?.id.toString()||""),[y,h]=t(!0),b=r.variants.find(e=>e.id.toString()===f)||r.variants[0],w=r.images.filter(Boolean),v=(e=>{try{const t=new Intl.NumberFormat(void 0,{style:"currency",currency:e}).resolvedOptions().maximumFractionDigits??2;return Math.pow(10,t)}catch{return 100}})(lm()),C=(()=>{const e=lm();return me(e)??e})(),E=()=>{w.length<=1||(g(e=>0===e?w.length-1:e-1),h(!0))},k=()=>{w.length<=1||(g(e=>e===w.length-1?0:e+1),h(!0))};if(n(()=>(a&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=""}),[a]),n(()=>{if(b&&b?.featured_image?.src){const e=document.querySelector(".yt-collection-bundle-modal-image"),t=vm(b?.featured_image?.src);e?.setAttribute("src",t)}},[b]),!a)return null;const T=w.length>1,S=e.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:i},e.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",borderRadius:d?.borderRadius||"12px",maxWidth:1e3,width:"100%",height:"72dvh",margin:"auto",display:"flex",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:i,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"}},e.createElement(G,{size:22})),e.createElement("div",{className:"yt-collection-bundle-modal-image-container",style:{flex:1,position:"relative",margin:"20px 0 20px 20px",borderRadius:d?.borderRadius||"12px",background:"#f5f5f5"}},w.length>0&&e.createElement(e.Fragment,null,y&&e.createElement("style",null,"\n @keyframes shimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n }\n "),y&&e.createElement("div",{style:{position:"absolute",inset:0,background:"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s infinite",borderRadius:d?.borderRadius||"12px"}}),e.createElement("img",{className:"yt-collection-bundle-modal-image",src:vm(w[u]||r.images[0]),alt:r.title,onLoad:()=>h(!1),style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:d?.borderRadius||"12px",opacity:y?0:1,transition:"opacity 0.3s"}}),T&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:E,disabled:0===u,style:{position:"absolute",left:16,top:"50%",transform:"translateY(-50%)",background:0===u?"rgba(0,0,0,0.2)":"rgba(0,0,0,0.4)",border:"none",borderRadius:"50%",width:44,height:44,display:"flex",alignItems:"center",justifyContent:"center",cursor:0===u?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:0===u?.5:1}},e.createElement(X,{size:24})),e.createElement("button",{onClick:k,disabled:u===w.length-1,style:{position:"absolute",right:16,top:"50%",transform:"translateY(-50%)",background:u===w.length-1?"rgba(0,0,0,0.2)":"rgba(0,0,0,0.4)",border:"none",borderRadius:"50%",width:44,height:44,display:"flex",alignItems:"center",justifyContent:"center",cursor:u===w.length-1?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:u===w.length-1?.5:1}},e.createElement(M,{size:24}))))),e.createElement("div",{className:"yt-collection-bundle-modal-content",style:{flex:1,padding:"30px",overflowY:"auto",display:"flex",flexDirection:"column",scrollbarWidth:"none"}},e.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"6px 0",fontSize:24,fontWeight:600,lineHeight:"normal"}},m&&b?.name||r.title),!m&&r.variants.length>1&&e.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative"}},e.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee",lineHeight:"normal"}},r?.options?.join(" & "),":"," ",e.createElement("strong",null,b.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:f,onChange:e=>{x(e.target.value),h(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer",lineHeight:"normal"}},r.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0",lineHeight:"normal"}},C,(b.price/v).toLocaleString(),b.compare_at_price&&b.compare_at_price>b.price?e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999",lineHeight:"normal"}},C,(b.compare_at_price/v).toLocaleString()):null),e.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"white"}},e.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!c?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>l(r,o),disabled:!c||!b.available,style:{width:"100%",padding:"12px",fontSize:17,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:b.available?s||!c?"#28a745":d?.atcBg||"#007bff":"rgb(204, 204, 204)",color:d?.atcText||"#fff",cursor:c&&b.available?"pointer":"not-allowed",textAlign:"center",lineHeight:"normal"}},s?"Added to Box":b.available?"Add to Box":"Out of Stock")),r.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:r.description},style:{lineHeight:"normal",color:"#444",marginTop:"10px"}})))),N=e.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:i},e.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",width:"100%",height:"100dvh",display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:i,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement(G,{size:22})),e.createElement("div",{className:"yt-collection-bundle-modal-scroll-container",style:{flex:1,overflowY:"auto",paddingBottom:100}},w.length>0&&e.createElement("div",{className:"yt-collection-bundle-modal-image-wrapper",style:{position:"relative",background:"#f5f5f5"}},y&&e.createElement("div",{style:{position:"absolute",inset:0,background:"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s infinite"}}),e.createElement("img",{className:"yt-collection-bundle-modal-image",src:w[u]||r.images[0],alt:r.title,onLoad:()=>h(!1),style:{width:"100%",minWidth:"100%",display:"block",maxHeight:"50vh",minHeight:"50vh",objectFit:"cover",objectPosition:"center",opacity:y?0:1,transition:"opacity 0.3s"}}),T&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:E,disabled:0===u,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",background:0===u?"rgba(0,0,0,0.3)":"rgba(0,0,0,0.5)",border:"none",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",zIndex:5,opacity:0===u?.5:1,cursor:0===u?"not-allowed":"pointer"}},e.createElement(X,{size:20})),e.createElement("button",{onClick:k,disabled:u===w.length-1,style:{position:"absolute",right:12,top:"50%",transform:"translateY(-50%)",background:u===w.length-1?"rgba(0,0,0,0.3)":"rgba(0,0,0,0.5)",border:"none",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",zIndex:5,opacity:u===w.length-1?.5:1,cursor:u===w.length-1?"not-allowed":"pointer"}},e.createElement(M,{size:20})))),e.createElement("div",{className:"yt-collection-bundle-modal-content",style:{padding:"20px"}},e.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"0 0 12px",fontSize:22,fontWeight:600}},r.title),!m&&r.variants.length>1&&e.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative",marginBottom:20}},e.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee"}},r?.options?.join(" & "),":"," ",e.createElement("strong",null,b.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:f,onChange:e=>{x(e.target.value),h(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}},r.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0"}},C,(b.price/v).toLocaleString(),b.compare_at_price?b.compare_at_price>b.price&&e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999"}},C,(b.compare_at_price/v).toLocaleString()):null),r.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:r.description},style:{lineHeight:1.7,color:"#444"}}))),e.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"#fff",padding:"8px 10px",borderTop:"1px solid #eee",boxShadow:"0 -4px 10px rgba(0,0,0,0.05)"}},e.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!c?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>l(r,o),disabled:!c||!b.available,style:{width:"100%",padding:"10px",fontSize:14,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:!s&&c&&b.available?d?.atcBg||"#007bff":"#28a745",color:d?.atcText||"#fff",cursor:c&&b.available?"pointer":"not-allowed"}},s?"Added to Box":b.available?"Add to Box":"Out of Stock"))));return D.createPortal(p?N:S,document.body)},sm=({styles:t,isMobile:n,categories:r,activeCategory:o,onCategoryChange:a})=>{const i=e=>{a(e)},l=(e,t)=>{const n=e.replace("#","");return`rgba(${parseInt(n.substring(0,2),16)||0}, ${parseInt(n.substring(2,4),16)||0}, ${parseInt(n.substring(4,6),16)||0}, ${t})`};return"tabs"===t?.categoryFilterOnPage?e.createElement("div",{className:"yt-collection-bundle-category-filter-wrapper",style:{overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",width:"100%"}},e.createElement("div",{className:"yt-collection-bundle-category-tabs-container",style:{display:"flex",gap:"0px",minWidth:"max-content",paddingBottom:"1px",flexWrap:"nowrap",justifyContent:"center",borderBottom:"1px solid #e0e0e0",width:"auto",height:n?"28px":"45px"}},["All",...r].map(r=>{const a=o===r,c=t.btnPrimaryBg||"#111";return e.createElement("button",{key:r,onClick:()=>i(r),className:"yt-collection-bundle-category-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:a?"600":"400",color:a?c:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:a?l(c,.07):"transparent",borderBottom:a?`2px solid ${c}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:e=>{a||(e.currentTarget.style.color=c)},onMouseLeave:e=>{a||(e.currentTarget.style.color="#666")}},e.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},r.charAt(0).toUpperCase()+r.slice(1)),e.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},r.charAt(0).toUpperCase()+r.slice(1)))}))):e.createElement("div",{className:"yt-collection-bundle-category-filter-wrapper",style:{overflowX:n?"auto":"visible",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",paddingBottom:"5px"}},e.createElement("div",{className:"yt-collection-bundle-category-buttons-container",style:{display:"flex",gap:"8px",minWidth:"max-content",flexWrap:"nowrap",justifyContent:"center",paddingRight:n?"10px":"0px"}},["All",...r].map(r=>{const a=t.btnPrimaryBg||"#111",l=t.borderRadius||"8px";return e.createElement("button",{key:r,onClick:()=>i(r),className:"yt-collection-bundle-category-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${o===r?a:"#e0e0e0"}`,borderRadius:l,backgroundColor:o===r?a:"white",color:o===r?"white":"#333",cursor:"pointer"}},r.charAt(0).toUpperCase()+r.slice(1))})))},dm=e=>{if(e.metafields&&e.metafields.yourtoken_bundles_app&&e.metafields.yourtoken_bundles_app.categories){const t=e.metafields.yourtoken_bundles_app.categories;if(Array.isArray(t))return t;if("string"==typeof t)try{const e=JSON.parse(t);if(Array.isArray(e))return e}catch(e){console.error("Failed to parse categories:",e)}}return[]},pm=()=>window?.ShopifyAnalytics?.meta?.currency||window?.Shopify?.currency?.active||"USD",mm=e=>{try{const t=new Intl.NumberFormat(void 0,{style:"currency",currency:e}).resolvedOptions().maximumFractionDigits??2;return Math.pow(10,t)}catch{return 100}},um=()=>{const e=pm();return me(e)??e},gm=({config:r,bundleAddToCartLoading:i,addCustomBundleToCart:l,dispatchAnalyticsEvent:c})=>{const[s,d]=t(1),[p,m]=t("All"),[u,g]=t([]),[f,x]=t(null),[y,h]=t({}),[b,w]=t(!1),[v,C]=t(window.innerWidth<640),[E,k]=t({}),T=o(null),S=o(new Map),[N,B]=t(160),[z,$]=t(""),[F,I]=t(""),[P,D]=t(!1),[A,L]=t("none"),_=v?8:20,{customizations:R}=r,M=r.config.builderTiers.collectionTier.sort((e,t)=>e.tier-t.tier),O=!!r.config.form,W=M.length+(O?1:0),H=R.hideSelectedProducts,j=R.allowMultipleQty,q=R.hideOutOfStockProducts,U=r.config.splitVariants??!1,Z=o(new Set),Q=a((e,t=p,n=F,r=A)=>{const o=M[e-1]?.products||[];let a="All"===t?o:o.filter(e=>dm(e).includes(t));if(n.trim()){const e=n.toLowerCase();a=a.filter(t=>t.title.toLowerCase().includes(e))}return q&&(a=a.filter(e=>e.available)),"none"!==r&&(a=[...a].sort((e,t)=>{if("asc"===r||"desc"===r){const n=e.price||e.price_min||0,o=t.price||t.price_min||0;return"asc"===r?n-o:o-n}{const n=(e.title||"").toLowerCase(),o=(t.title||"").toLowerCase();return"alpha-asc"===r?n.localeCompare(o):o.localeCompare(n)}})),a},[M,p,F,A,q]),Y=a(e=>{const t=Q(e).length;k(n=>{const r=n[e]||0,o=Math.min(r+8,t);return o<=r?n:{...n,[e]:o}})},[8,Q]);n(()=>{c?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:r?.id,bundleType:"collection-bundle"}})},[]),n(()=>(T.current=new IntersectionObserver(e=>{for(const t of e)if(t.isIntersecting){const e=parseInt(t.target.getAttribute("data-sentinel-step")||"0");e>0&&e===s&&Y(e)}},{root:null,threshold:0,rootMargin:"100px 0px"}),()=>{T.current?.disconnect()}),[Y,s]),n(()=>{m("All"),$(""),I(""),D(!1),L("none")},[s]),n(()=>{const e=setTimeout(()=>{I(z)},300);return()=>clearTimeout(e)},[z]),n(()=>{if(O&&s===W)return;const e=s-1;if(!M[e])return;if(Z.current.has(e))return;const t=Q(s);if(console.log("filteredProducts",t),1!==t.length)return;const n=t[0],r=n.variants.filter(e=>e.available);if(1!==r.length)return;const o=r[0],a=le(e),i=se[e];if(a!==1/0&&i>=a)return;if(!u.some(t=>t.productId===n.id.toString()&&t.variantId===o.id.toString()&&t.tierIndex===e)&&(Z.current.add(e),g(t=>[...t,{productId:n.id.toString(),variantId:o.id.toString(),price:o.price,quantity:1,tierIndex:e}]),s<W)){const e=setTimeout(()=>{d(e=>e+1),window.scrollTo(0,0)},50);return()=>clearTimeout(e)}},[s]),n(()=>{if(O&&s===W)return;const e=s,t=Q(e).length;k(n=>{const r=n[`${e}_category`]!==p;return 0===(n[e]||0)||r?{...n,[e]:Math.min(_,t),[`${e}_category`]:p}:n})},[s,_,p,Q]),n(()=>{const e=document.querySelector(".box-loader-scene");e&&e.setAttribute("style","display: none;");const t=()=>C(window.innerWidth<640);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const X=a(e=>{B(e+10)},[]),ee=mm(pm()),te=u.reduce((e,t)=>e+t.quantity,0),ne=u.reduce((e,t)=>e+t.price*t.quantity,0)/ee,re=u.reduce((e,t)=>{const n=M.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId),r=n?.variants.find(e=>e.id.toString()===t.variantId);return e+(r?.compare_at_price??t.price)*t.quantity},0)/ee,oe=e=>{for(let t=0;t<M.length;t++)if(M[t].products.some(t=>t.id.toString()===e))return t+1;return O?W:M.length},ae=(e,t)=>{const n=e.variants.find(e=>e.id===parseInt(t));if(!n)return;const r=document.querySelector(`[data-product-id="${e.id}"]`);r&&(r.dataset.selectedVariant=t,r.dataset.currentPrice=n.price.toString())},ie=(e,t)=>{const n=document.querySelector(`[data-product-id="${e.id}"]`);if(!n)return;const o=n.dataset.selectedVariant||e.variants[0].id.toString(),a=parseInt(n.dataset.currentPrice||e.variants[0].price.toString());g(n=>{const i=`${e.id}-${o}-${t}`,l=n.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===i);if(l)return n.filter(e=>e!==l);const s=se[t],d=le(t);return d!==1/0&&s>=d?n:(c?.({eventNameCustom:"byob_add_to_bundle",eventTypeCustom:"clicks",data:{bundleId:r?.id,bundleType:"collection-bundle",addedProduct:{id:e.id,title:e.title},tierIndex:t}}),[...n,{productId:e.id.toString(),variantId:o,price:a,quantity:1,tierIndex:t}])})},le=e=>{const t=M[e];return t.maximumQuantity>0?t.maximumQuantity:1/0},ce=(e,t)=>{const n=le(t);if(n===1/0)return!0;const r=se[t];return!!u.some(n=>n.productId===e.id.toString()&&n.tierIndex===t)||r<n},se=M.map((e,t)=>u.filter(e=>e.tierIndex===t).reduce((e,t)=>e+t.quantity,0)),de=(e,t,n)=>{const r=le(n);if(r===1/0)return!0;return se[n]<r},pe=(e,t,n)=>{g(r=>r.filter(r=>!(r.productId===e&&r.variantId===t&&r.tierIndex===n)))},me=async()=>{if(s!==W||!u.length)return;const e={};O&&Object.entries(y).forEach(([t,n])=>{const r=t.split("|").pop()?.replace(/^f_\d+$/,"")||t;"string"==typeof n&&n.trim()?e[r]=n:n&&"object"==typeof n&&"url"in n&&(e[r]=n.url)}),c?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:r?.id,bundleType:"collection-bundle",selectedProducts:u.map(e=>({id:e.productId,variantId:e.variantId,quantity:e.quantity,tierIndex:e.tierIndex}))}});const t=u.map(t=>({variantId:t.variantId,quantity:t.quantity,properties:e}));l(t)},ue=O&&s===W,ge=(ue?null:M[s-1])?le(s-1):0,fe=M.map((e,t)=>({tier:e,items:u.filter(e=>e.tierIndex===t).reduce((e,t)=>{const n=`${t.productId}-${t.variantId}`,r=e.find(e=>`${e.productId}-${e.variantId}`===n);return r?r.quantity+=t.quantity:e.push({...t,quantity:t.quantity}),e},[]),count:se[t]}));return e.createElement("div",{className:"yt-collection-bundle-builder",style:{margin:"0 auto",maxWidth:"1600px"}},R.headerImage&&!R.headerImage.includes("Liquid error")&&e.createElement("img",{className:"yt-collection-bundle-header-img",src:R.headerImage,alt:"Collection Bundle header",style:{width:"100%"}}),R.showTierSteps&&e.createElement("div",{style:{paddingTop:R.headerImage&&!R.headerImage.includes("Liquid error")?"20px":"0"}},e.createElement(fm,{totalSteps:W,isFormStep:ue,currentStep:s,getStepTitle:e=>O&&e===W?"Customize Gift Details":M[e-1]?.title||`Step ${e}`,isMobile:v,formTitle:r?.config?.form?.title,hasForm:O,onStepClick:e=>{d(e),window.scrollTo(0,0)}})),Array.from({length:W},(e,t)=>t+1).map(t=>{const n=O&&t===W,o=n?[]:(e=>M[e-1]?.products||[])(t);let a=[];if(!n&&R.enableProductCategories){const e=new Set;o.forEach(t=>dm(t).forEach(t=>e.add(t))),a=Array.from(e).sort()}const l=n?[]:Q(t),c=t-1,C=l.slice(0,E[t]||0);return e.createElement("div",{key:t,className:"yt-collection-bundle-step-content "+(s===t?"yt-collection-bundle-step-content-active":""),style:{display:s===t?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},n&&r.config.form?e.createElement($s,{form:r.config.form,formData:y,setFormData:h,barHeight:N,isUploading:b,setIsUploading:w}):e.createElement(e.Fragment,null,R.enableProductCategories&&a.length>0&&e.createElement(sm,{styles:R,isMobile:v,categories:a,activeCategory:p,onCategoryChange:m}),(R.enableSearch||R.enableSort)&&e.createElement("div",{className:"yt-collection-bundle-controls",style:{display:"flex",alignItems:"center",justifyContent:v?"flex-end":"space-between",gap:"12px",padding:"0 16px",marginBottom:"16px",flexWrap:"nowrap",height:"45px"}},v?e.createElement(e.Fragment,null,P?e.createElement("div",{style:{position:"relative",flex:1,display:"flex",alignItems:"center",gap:"8px"}},e.createElement("input",{type:"text",autoFocus:!0,placeholder:"Search...",value:z,onChange:e=>$(e.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:R.borderRadius||"8px",border:`1px solid ${R.bundleBorder||"#878787"}`,background:R.productCardBg||"#fff",color:"#333",fontSize:"14px",outline:"none"}}),e.createElement("button",{onClick:()=>{D(!1),$(""),I("")},style:{background:"none",border:"none",color:"#888",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center"}},e.createElement(G,null))):e.createElement("div",{style:{display:"flex",gap:"20px",alignItems:"center"}},R.enableSearch&&e.createElement("button",{onClick:()=>D(!0),style:{background:"none",border:"none",color:"#333",fontSize:"20px",cursor:"pointer",display:"flex",alignItems:"center"},className:"yt-collection-bundle-search-btn-mobile"},e.createElement(K,null)),R.enableSort&&e.createElement("div",{style:{position:"relative",display:"flex",alignItems:"center"},className:"yt-collection-bundle-sort-selecter-mobile-wrapper"},e.createElement("select",{value:A,onChange:e=>L(e.target.value),style:{position:"absolute",opacity:0,width:"100%",height:"100%",cursor:"pointer",left:0,top:0,zIndex:1},className:"yt-collection-bundle-sort-selecter-mobile"},e.createElement("option",{value:"none"},"Featured"),e.createElement("option",{value:"asc"},"Price: Low to High"),e.createElement("option",{value:"desc"},"Price: High to Low"),e.createElement("option",{value:"alpha-asc"},"Alphabetical: A-Z"),e.createElement("option",{value:"alpha-desc"},"Alphabetical: Z-A")),e.createElement("div",{style:{fontSize:"20px",color:"#333",pointerEvents:"none",display:"flex",alignItems:"center"}},e.createElement(J,null))))):e.createElement(e.Fragment,null,R.enableSort&&e.createElement("div",{style:{position:"relative",flex:"0 1 200px",marginLeft:"12px",padding:"10px 16px",borderRadius:R.borderRadius||"8px",border:"1px solid #878787",background:R.productCardBg||"#fff",display:"flex",flexDirection:"row",alignItems:"center",gap:"6px"},className:"yt-collection-bundle-sort-wrapper"},e.createElement("span",{style:{fontWeight:"500",minWidth:"fit-content",fontSize:"14px"}},"Sort By"),e.createElement("select",{value:A,onChange:e=>L(e.target.value),style:{width:"100%",color:"#333",fontSize:"14px",outline:"none",cursor:"pointer",appearance:"none",boxSizing:"border-box",lineHeight:"normal",border:"none",fontFamily:"inherit"},className:"yt-collection-bundle-sort-selector"},e.createElement("option",{value:"none"}," Featured"),e.createElement("option",{value:"asc"},"Price: Low to High"),e.createElement("option",{value:"desc"},"Price: High to Low"),e.createElement("option",{value:"alpha-asc"},"Alphabetical: A-Z"),e.createElement("option",{value:"alpha-desc"},"Alphabetical: Z-A")),e.createElement("div",{style:{position:"absolute",right:"12px",top:"50%",transform:"translateY(-50%)",color:"#888",pointerEvents:"none"}},e.createElement(V,null))),R.enableSearch&&e.createElement("div",{style:{position:"relative",flex:"0 1 300px"},className:"yt-collection-bundle-search-wrapper"},e.createElement("input",{type:"text",placeholder:"Search products...",value:z,onChange:e=>$(e.target.value),style:{width:"100%",padding:"10px 16px",paddingRight:"40px",borderRadius:R.borderRadius||"8px",border:"1px solid #878787",background:R.productCardBg||"#fff",color:"#333",fontSize:"14px",outline:"none",boxSizing:"border-box",lineHeight:"normal"},className:"yt-collection-bundle-search-input"}),e.createElement("div",{style:{position:"absolute",right:"12px",top:"50%",transform:"translateY(-50%)",color:"#888"}},e.createElement(K,null))))),e.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:v?"grid":"flex",gridTemplateColumns:v?"repeat(2,1fr)":"",flexWrap:v?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:`${N}px`}},0===l.length&&""!==F.trim()?e.createElement("div",{style:{padding:"60px 20px",textAlign:"center",width:"100%",gridColumn:"1 / -1"}},e.createElement("div",{style:{fontSize:"18px",color:"#333",marginBottom:"8px",fontWeight:600}},'No results found for "',z,'"'),e.createElement("div",{style:{fontSize:"14px",color:"#666",marginBottom:"24px"}},"Try checking your spelling or using more general terms."),e.createElement("button",{onClick:()=>{$(""),I(""),D(!1)},style:{background:R.atcBg||"#000",color:R.atcText||"#fff",padding:"12px 32px",borderRadius:R.borderRadius||"8px",border:"none",cursor:"pointer",fontSize:"14px",fontWeight:600,transition:"opacity 0.2s"},onMouseEnter:e=>e.currentTarget.style.opacity="0.8",onMouseLeave:e=>e.currentTarget.style.opacity="1"},"Clear Search")):U?C.flatMap(t=>t.variants.filter(e=>!q||e.available).map(n=>e.createElement(xm,{key:`${t.id}-${n.id}`,product:{...t,variants:[n]},tierIdx:c,customizations:R,isMobile:v,hoveredCard:f,setHoveredCard:x,selectedProducts:u,handleAddToBundle:ie,canAddProduct:ce,allowMultipleQty:j,handleVariantChange:ae,canIncrement:de,setSelectedProducts:g,splitVariants:!0}))):C.map(t=>e.createElement(xm,{key:t.id,product:t,tierIdx:c,customizations:R,isMobile:v,hoveredCard:f,setHoveredCard:x,selectedProducts:u,handleAddToBundle:ie,canAddProduct:ce,allowMultipleQty:j,handleVariantChange:ae,canIncrement:de,setSelectedProducts:g,splitVariants:!1})),s===t&&(E[t]||0)<l.length&&e.createElement("div",{ref:e=>{const n=S.current.get(t);n&&T.current?.unobserve(n),e?(S.current.set(t,e),T.current?.observe(e)):S.current.delete(t)},"data-sentinel-step":t.toString(),style:{height:"20px",width:"100%",display:"block"}}))),s===t&&e.createElement(ym,{config:r,selectedProducts:u,selectedByTier:fe,totalItems:te,totalPrice:ne,totalCompareAtPrice:re,currentStep:s,totalSteps:W,currentTierMax:ge,tierSelectedCounts:se,isMobile:v,bundleAddToCartLoading:i,isUploading:b,hoveredCard:f,setHoveredCard:x,hideSelectedProducts:H,getProductStep:oe,setCurrentStep:d,handleRemoveItem:pe,handleCheckout:me,hasForm:O,onHeightChange:X}))}))},fm=({totalSteps:t,isFormStep:r,currentStep:o,getStepTitle:a,isMobile:i,formTitle:l,hasForm:c,onStepClick:s})=>{const d=e.useRef(null);return n(()=>{if(!i||!d.current)return;const e=d.current.querySelector(".yt-collection-bundle-step-item-active");e&&e.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})},[o,i]),e.createElement("div",{className:"yt-collection-bundle-steps-nav-container",style:{display:"flex",justifyContent:"center",flexDirection:"column",gap:i?"0":"1rem",overflowX:"auto",scrollbarWidth:"none",borderBottom:"1px solid #878787",marginInline:i?"0":"2%",paddingBottom:"1rem",textAlign:"center"}},e.createElement("div",{ref:d,className:"yt-collection-bundle-steps-nav",style:{display:"flex",justifyContent:i?"flex-start":"center",gap:i?"1rem":"2rem",minWidth:i?100*t+"px":"auto",paddingInline:i?"calc(50% - 60px)":"0",scrollPaddingInline:i?"calc(50% - 60px)":"0",scrollBehavior:"smooth",overflowX:"auto",scrollbarWidth:"none"}},Array.from({length:t},(e,t)=>t+1).map(n=>e.createElement("div",{key:n,className:"yt-collection-bundle-step-item "+(o===n?"yt-collection-bundle-step-item-active":""),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.5rem",minWidth:i?"100px":"120px",flexShrink:0,cursor:"pointer",opacity:o===n?1:.5,transition:"opacity 0.2s"},onClick:()=>s(n)},e.createElement("div",{className:"yt-collection-bundle-step-icon "+(o===n?"yt-collection-bundle-step-icon-active":""),style:{width:"40px",height:"40px",background:o===n?"#000":"#fff",border:"2px solid #ccc",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center"}},c&&n===t?e.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:o===n?"#fff":"#999"}},e.createElement("path",{d:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.67C10.96 2.54 10.05 2 9 2c-1.66 0-3 1.34-3 3 0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1h-2c-.55 0-1-.45-1-1s.45-1 1-1h2zm-6 0c.55 0 1 .45 1 1s-.45 1-1 1H7c-.55 0-1-.45-1-1s.45-1 1-1h2zM20 19H4V8h16v11z"})):e.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:o===n?"#fff":"#999"}},e.createElement("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}))),e.createElement("div",{className:"yt-collection-bundle-step-label",style:{fontSize:"14px",textAlign:"center",color:"#333",fontWeight:"600",lineHeight:"normal"}},a(n))))),l&&c&&r&&e.createElement("p",{className:"yt-collection-bundle-steps-nav-description",style:{fontSize:i?"14px":"16px",marginBottom:i?"0":"14px",fontWeight:"400",color:"#000",lineHeight:"normal"}},l))},xm=({product:n,tierIdx:r,customizations:o,isMobile:a,hoveredCard:i,setHoveredCard:l,selectedProducts:c,handleAddToBundle:s,canAddProduct:d,allowMultipleQty:p,handleVariantChange:m,canIncrement:u,setSelectedProducts:g,splitVariants:f=!1})=>{const[x,y]=t(!1),h=f?null:document.querySelector(`[data-product-id="${n.id}"]`),b=f?n.variants[0].id.toString():h?.dataset.selectedVariant??n.variants[0].id.toString(),w=n.variants.find(e=>e.id.toString()===b)||n.variants[0],v=mm(pm()),C=um(),E=f?`${n.id}-${w.id}`:n.id,k=c.some(e=>e.productId===n.id.toString()&&e.variantId===b&&e.tierIndex===r),T=i===E,S=c.filter(e=>e.productId===n.id.toString()&&e.variantId===w.id.toString()&&e.tierIndex===r).reduce((e,t)=>e+t.quantity,0);return e.createElement(e.Fragment,null,e.createElement("div",{key:E,className:"yt-collection-bundle-product-item","data-product-id":n.id,"data-selected-variant":w.id,"data-current-price":w.price,style:{display:"flex",flexDirection:"column",border:o?.productCardBorder||"1px solid #ddd",background:o?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:a?0:"250px",maxWidth:a?"none":"250px",borderRadius:o?.borderRadius||"8px",boxShadow:"spread"===o?.productCardShadow?"8px 8px 8px -6px #0000004D":"no-spread"===o?.productCardShadow?"6px 6px 0px -1px #00000033":"none",width:a?"100%":""}},e.createElement("div",{className:"yt-collection-bundle-product-image",style:{position:"relative",width:"100%",aspectRatio:o?.productImageRatio||"1/1",overflow:"hidden",cursor:"pointer",background:"#f9f9f9"},onClick:()=>y(!0),onMouseEnter:()=>l(E),onMouseLeave:()=>l(null)},e.createElement("img",{src:vm(n.images[0]||"https://cdn.shopify.com/s/files/1/0750/9937/3789/files/placeholder-thumbnail.png?width=250px"),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:T?0:1,transform:T?"scale(1.05)":"scale(1)"},alt:n.title}),e.createElement("img",{src:vm(n.images[1]||n.images[0]),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:T?1:0,transform:"scale(1.05)"},alt:n.title}),!f&&n.variants.length>1&&e.createElement("select",{className:"yt-collection-bundle-variant-selector",style:{position:"absolute",bottom:"10px",left:"10px",right:"10px",background:"rgba(255,255,255,0.9)",border:"none",borderRadius:"4px",padding:"8px",fontSize:"12px",fontWeight:"600",zIndex:2,lineHeight:"normal"},onChange:e=>m(n,e.target.value),defaultValue:w.id,onClick:e=>{e.stopPropagation()}},n.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-product-info",style:{padding:"12px",flexGrow:1,display:"flex",flexDirection:"column"}},o.productCardCategoryVisibility&&dm(n).length>0&&e.createElement("div",{className:"yt-collection-bundle-product-categories-wrapper",style:{paddingBottom:"8px"}},e.createElement("div",{className:"yt-collection-bundle-product-categories",style:{display:"flex",flexWrap:"wrap",gap:"4px"}},dm(n).slice(0,2).map((t,n)=>e.createElement("span",{className:"yt-collection-bundle-category-tag",key:n,style:{fontSize:a?"10px":"12px",color:"#666",fontWeight:"500"}},t.charAt(0).toUpperCase()+t.slice(1))),dm(n).length>2&&e.createElement("span",{className:"yt-collection-bundle-more-categories",style:{fontSize:"10px",padding:"2px 6px",backgroundColor:"rgba(0, 0, 0, 0.05)",borderRadius:"8px",color:"#666",fontWeight:"500"}},"+",dm(n).length-2," more"))),e.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:a?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:"normal",color:"#333",flexGrow:f?0:1}},n.title),f&&"Default Title"!==w.title&&e.createElement("p",{className:"yt-collection-bundle-variant-label",style:{fontSize:a?"10px":"12px",color:"#666",margin:"0 0 4px",lineHeight:"normal",flexGrow:1}},w.title),e.createElement("div",{className:"yt-collection-bundle-product-prices",style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"nowrap",whiteSpace:"nowrap",overflow:"hidden",lineHeight:"normal"}},e.createElement("span",{className:"yt-collection-bundle-product-price",style:{fontSize:a?"14px":"16px",fontWeight:"bold",color:"#000",flexShrink:0,lineHeight:"normal"}},C,(w.price/v).toLocaleString()),w.compare_at_price&&0!==w.compare_at_price&&w.compare_at_price>w.price?e.createElement("span",{className:"yt-collection-bundle-product-compare",style:{fontSize:"14px",textDecoration:"line-through",color:"#999",flexShrink:0,lineHeight:"normal"}},C,(w.compare_at_price/v).toLocaleString()):null)),p&&S>0?e.createElement("div",{className:"yt-collection-bundle-quantity-row",style:{display:"flex",alignItems:"center",flexWrap:"nowrap",background:"#cccccc"}},e.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-minus",style:{width:"40%",height:w.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:a?"6px":"12px",fontSize:a?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{g(e=>{const t=`${n.id}-${w.id}-${r}`,o=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return o&&o.quantity>1?e.map(e=>e===o?{...e,quantity:e.quantity-1}:e):o?e.filter(e=>e!==o):e})}},"-"),e.createElement("span",{className:"yt-collection-bundle-qty-display",style:{minWidth:"24px",textAlign:"center",fontWeight:600,width:"100%",lineHeight:"normal"}},S),e.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-plus",style:{width:"40%",height:w.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:a?"6px":"12px",fontSize:a?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{w.available&&u(n,w.id.toString(),r)&&g(e=>{const t=`${n.id}-${w.id}-${r}`,o=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return o?e.map(e=>e===o?{...e,quantity:e.quantity+1}:e):[...e,{productId:n.id.toString(),variantId:w.id.toString(),price:w.price,quantity:1,tierIndex:r}]})},disabled:!w.available||!u(n,w.id.toString(),r)},"+")):e.createElement("button",{className:"yt-collection-bundle-add-btn "+(k?"yt-collection-bundle-add-btn-added":""),style:{background:k?"#28a745":d(n,r)&&w.available?o?.atcBg||"#007bff":"#ccc",color:o?.atcText||"#fff",border:"none",padding:a?"6px":"12px",fontSize:a?"12px":"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",opacity:w.available?1:.6,lineHeight:"normal",textAlign:"center"},onClick:()=>{if(f)w.available&&d(n,r)&&g(e=>{const t=`${n.id}-${w.id}-${r}`,o=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return o?e.filter(e=>e!==o):[...e,{productId:n.id.toString(),variantId:w.id.toString(),price:w.price,quantity:1,tierIndex:r}]});else{if(!w.available||!d(n,r))return;s(n,r)}},disabled:!w.available||!d(n,r)},k?"Added":w.available?"ADD TO BOX":"Out of Stock")),x&&e.createElement(cm,{product:n,tierIdx:r,isOpen:x,onClose:()=>y(!1),onAddToBundle:(e,t)=>{s(e,t),y(!1)},canAdd:d(n,r),isSelected:k,customizations:o,isMobile:a,splitVariants:f}))},ym=r=>{const{config:a,selectedProducts:i,selectedByTier:l,totalItems:c,totalPrice:s,totalCompareAtPrice:d,currentStep:p,totalSteps:m,currentTierMax:u,tierSelectedCounts:g,isMobile:f,bundleAddToCartLoading:x,isUploading:y,hoveredCard:h,setHoveredCard:b,getProductStep:w,setCurrentStep:v,handleRemoveItem:C,handleCheckout:E,hasForm:k,onHeightChange:T}=r,{customizations:S}=a,[N,B]=t(!1),z=o(null),$=o(null),F=mm(pm()),I=um(),{totalOriginal:P,hasSavings:D,formattedSavings:A,totalAfterDiscount:L}=(e=>{let t=0,n=0;e.forEach(({items:e,tier:r})=>{const o=r?.discountData;let a=0;e.forEach(e=>{const t=(e.price||0)/F,n=e.quantity||1;a+=t*n}),t+=a;let i=a;if("mov_percentage"===o?.type&&o.tiers?.length){const e=[...o.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity).filter(e=>a>=e.minimumQuantity);if(e.length>0){const t=e.reduce((e,t)=>t.discountValue>e.discountValue?t:e).discountValue/100;i=a*(1-t)}}n+=i});const r=Math.round(t-n),o=r>0;return{savings:r,totalOriginal:t,totalAfterDiscount:n,hasSavings:o,formattedSavings:o?`${I}${r.toLocaleString()}`:"",calculatedDiscountedTotal:Math.round(n)}})(l),_=l.filter(({count:e})=>e>0).map(({tier:e,items:t})=>{const n=t.reduce((e,t)=>{if(!t)return e;return e+(t.price||0)*(t.quantity||1)},0)/F;return((e,t,n)=>{const r=e.discountData;if(!r||!r.tiers?.length)return null;const o=[...r.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity),a=[];if("mov_percentage"===r.type){if("number"!=typeof n)return null;const e=o.filter(e=>n>=e.minimumQuantity).pop();e&&a.push(`${e.discountValue}% OFF`);const t=o.find(e=>n<e.minimumQuantity);if(t){const e=t.minimumQuantity-n;a.push(`Add ${I}${e} more to get ${t.discountValue}% OFF`)}return a.length?a.join(" + "):null}const i=o.filter(e=>t>=e.minimumQuantity);if(i.length>0){const e=i.reduce((e,t)=>e.minimumQuantity>t.minimumQuantity?e:t);let t=null;switch(r.type){case"percentage_discount_coupon":t=`${e.discountValue}% OFF`;break;case"amount_discount_coupon":t=`${I}${e.discountValue} OFF`;break;case"fixed_price_collection":t=`Fixed ${I}${e.discountValue}`;break;case"dummy_coupon":t="Discount Applied"}t&&a.push(t)}const l=o.find(e=>t<e.minimumQuantity);if(l){const e=l.minimumQuantity-t;let n=null;switch(r.type){case"percentage_discount_coupon":n=`${l.discountValue}% OFF`;break;case"amount_discount_coupon":n=`${I}${l.discountValue} OFF`;break;case"fixed_price_collection":n=`Fixed ${I}${l.discountValue}`;break;case"dummy_coupon":n="Discount"}n&&a.push(`Add ${e} more item${1!==e?"s":""} to get ${n}`)}return a.length?a.join(" + "):null})(e,t.length,n)}).filter(Boolean);return n(()=>{const e=u!==1/0&&g[p-1]===u-2&&u>1;let t=null;return e?(B(!0),t=setTimeout(()=>{B(!1)},3e3)):B(!1),()=>{t&&clearTimeout(t)}},[u,g,p]),n(()=>{if(z.current&&T){const e=z.current.offsetHeight;T(e)}},[f,T,i]),n(()=>{const e=Math.max(...l.map(({tier:e,items:t})=>{if("mov_percentage"!==e?.discountData?.type)return 0;const n=t.reduce((e,t)=>e+(t.price||0)*(t.quantity||1),0)/100,r=(e?.discountData?.tiers||[]).filter(e=>n>=e.minimumQuantity).sort((e,t)=>t.discountValue-e.discountValue)[0];return r?.discountValue??0}));if(e<($.current??0)&&($.current=e),e>($.current??0)){$.current=e;const t=document.querySelector(".yt-collection-bundle-next-btn");if(!t)return;const n=t.getBoundingClientRect(),r=(n.left+n.width/2)/window.innerWidth,o=(n.top+n.height/2)/window.innerHeight;Te({particleCount:100,spread:70,origin:{x:r,y:o},zIndex:9999})}},[l]),e.createElement("div",{ref:z,className:"yt-collection-bundle-bar",style:{background:S?.bundleBg||"#fff",color:S?.bundleText||"#333",border:S?.bundleBorder||"1px solid #878787",display:"flex",flexDirection:"column",position:"sticky",bottom:"10px",left:"0",right:"0",marginInline:"auto",width:"compact"==S.stickyBarWidth?"600px":"90%",maxWidth:"95%",zIndex:899,boxShadow:"0 -2px 10px rgba(0,0,0,0.1)",transition:"bottom 0.3s ease",borderRadius:S?.borderRadius||"8px",overflow:"hidden"}},_.length>0&&e.createElement("div",{style:{padding:"4px 8px",background:"#dbdbdbc5",color:"#6c757d",textAlign:"center",fontSize:"12px",fontWeight:500}},_.join(" + ")),e.createElement("div",{className:"yt-collection-bundle-bar-header",style:{position:"relative",textAlign:"center"}},N&&e.createElement(e.Fragment,null,e.createElement("style",null,"\n @keyframes fadeIn {\n from { opacity: 0; transform: translateX(-50%) translateY(10px); }\n to { opacity: 1; transform: translateX(-50%) translateY(0); }\n }\n "),e.createElement("div",{className:"yt-collection-bundle-ctx",style:{position:"absolute",top:"-40px",left:"50%",transform:"translateX(-50%)",background:S?.atcBg||"#007bff",color:S?.atcText||"#fff",padding:"4px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"14px",whiteSpace:"nowrap",zIndex:10,boxShadow:"0 4px 12px rgba(0,0,0,0.2)",animation:"fadeIn 0.3s ease-out",minWidth:"300px",textAlign:"center",border:"1px solid rgba(0,0,0,0.1)",lineHeight:"normal"}},"Add up to"," ",e.createElement("span",{style:{fontWeight:600}},u," item",u>1?"s":"")))),i.length>0&&e.createElement("div",{className:"yt-collection-bundle-bar-top",style:{display:"flex",alignItems:"center",padding:"8px 8px 0",position:"relative",borderRadius:S?.borderRadius||"8px"}},e.createElement("div",{className:"yt-collection-bundle-images",style:{display:"flex",flex:1,gap:"5px",justifyContent:"center",alignItems:"center",overflowX:"auto",padding:"4px 0",scrollbarWidth:"none"}},l.filter(({count:e})=>e>0).map(({items:t},n,r)=>e.createElement(e.Fragment,{key:n},e.createElement("div",{className:"yt-collection-bundle-tier-images",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",minWidth:"fit-content"}},e.createElement("div",{style:{display:"flex",gap:"4px"}},t.map((t,r)=>{const o=a.config.builderTiers.collectionTier.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId);if(!o)return null;const i=w(t.productId),l=p===i;return e.createElement("div",{key:r,className:"yt-collection-bundle-img-wrapper",style:{position:"relative",flexShrink:0,height:"65px"}},e.createElement("div",{style:{position:"relative",width:"67px",height:"67px",borderRadius:`calc(${S?.borderRadius||"8px"} / 2)`,overflow:"hidden",cursor:l?"default":"pointer",transition:"transform 0.2s ease"},onMouseEnter:e=>!l&&(e.currentTarget.style.transform="scale(1.08)"),onMouseLeave:e=>e.currentTarget.style.transform="scale(1)",onClick:()=>!l&&v(i)},e.createElement("img",{src:vm(o.images[0]),style:{width:"65px",height:"65px",objectFit:"cover",borderRadius:`calc(${S?.borderRadius||"8px"} / 2)`,transition:"opacity 0.2s",pointerEvents:"none",border:"1px solid #ddd"},alt:"Selected"}),t.quantity>1&&e.createElement("div",{className:"yt-collection-bundle-qty-badge",style:{position:"absolute",bottom:"4px",right:"4px",background:"rgba(0,0,0,0.7)",color:"#fff",borderRadius:"10px",padding:"2px 6px",fontSize:"10px",fontWeight:600,lineHeight:"normal"}},"x",t.quantity),e.createElement("button",{className:"yt-collection-bundle-remove-btn",style:{position:"absolute",top:"4px",right:"4px",width:"20px",height:"20px",background:"rgba(220,53,69,0.95)",color:"white",border:"none",borderRadius:"50%",fontSize:"12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.3)",textAlign:"center",lineHeight:"normal"},onClick:e=>{e.stopPropagation(),C(t.productId,t.variantId,n)}},"×")))}))),n<r.length-1&&r[n+1].count>0&&e.createElement("div",{style:{color:"#666",paddingInline:"6px",lineHeight:"normal"}},e.createElement(Z,null)))))),f?e.createElement("div",{className:"yt-collection-bundle-mobile-bar-content",style:{display:"flex",flexDirection:c>0&&(k||a?.config?.builderTiers?.collectionTier?.length>1)?"column":"row",margin:"4px",gap:c>0?"10px":"0",background:"#dbdbdb",borderRadius:S?.borderRadius||"8px",overflow:"hidden"}},e.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:i.length>0?"space-between":"center",alignItems:"center",borderRadius:S?.borderRadius||"8px"}},e.createElement(e.Fragment,null,0===c&&e.createElement("div",{style:{fontSize:"14px",color:"#6c757d",lineHeight:"normal",...0===c&&{padding:"8px 0 12px 0",background:"#dbdbdb",color:"#6c757d",width:"100%",borderRadius:S?.borderRadius||"8px"}}},"Add Items to Checkout"),c>0&&e.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"6px",width:"100%",justifyContent:"center",flexWrap:"wrap"}},e.createElement("div",{style:{fontSize:"14px",color:"#000",fontWeight:600}},I,(L??s).toLocaleString()),D?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},I,P.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",A)):e.createElement(e.Fragment,null,d>s&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},I,d.toLocaleString())),e.createElement("span",{style:{fontSize:"12px",color:"#000",fontWeight:500}},"(",c," items)")))),e.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"4px"}},(a?.config?.builderTiers?.collectionTier?.length>1||k)&&c>0&&e.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:1===p?"not-allowed":"pointer",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",textAlign:"center",lineHeight:"normal"},onClick:()=>v(e=>Math.max(1,e-1)),onMouseEnter:()=>b(-1),onMouseLeave:()=>b(null),disabled:1===p},"Back"),c>0&&e.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===m&&0===c||y?"yt-collection-bundle-next-btn-disabled":""),style:{background:S?.btnPrimaryBg||"#28a745",color:S?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",opacity:p===m&&0===c||y?.6:1,textAlign:"center",lineHeight:"normal"},onClick:p===m?E:()=>v(p+1),disabled:p===m&&0===c||x||y},x?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(Bs,null)):p===m?"Checkout":"Next"))):e.createElement("div",{className:"yt-collection-bundle-bar-bottom",style:{display:"flex",alignItems:"center",padding:"0px",background:"#dbdbdb",margin:"8px",borderRadius:S?.borderRadius||"8px",overflow:"hidden",scrollbarWidth:"none"}},(a?.config?.builderTiers?.collectionTier?.length>1||k)&&c>0&&e.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:1===p?"not-allowed":"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",...-1===h&&{filter:"brightness(60%)"},textAlign:"center",lineHeight:"normal"},onClick:()=>v(e=>Math.max(1,e-1)),onMouseEnter:()=>b(-1),onMouseLeave:()=>b(null),disabled:1===p},"Back"),e.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:i.length>0?"space-between":"center",paddingInline:"6px",alignItems:"center",...0===c&&{padding:"12px 24px"}}},0===c&&e.createElement("div",{style:{fontSize:"16px",color:"#6c757d",lineHeight:"normal"}},"Add Items to Checkout"),c>0&&e.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",justifyContent:"center"}},e.createElement("div",{style:{fontSize:"16px",color:"#000",fontWeight:600}},I,(L??s).toLocaleString()),D?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},I,P.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",A)):e.createElement(e.Fragment,null,d>s&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},I,d.toLocaleString())),e.createElement("span",{style:{fontSize:"16px",color:"#000",fontWeight:500}},"(",c," items)"))),c>0&&e.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===m&&0===c||y?"yt-collection-bundle-next-btn-disabled":""),style:{background:S?.btnPrimaryBg||"#28a745",color:S?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",opacity:p===m&&0===c||y?.6:1,...-2===h&&{filter:"brightness(90%)"},textAlign:"center",lineHeight:"normal"},onClick:p===m?E:()=>v(p+1),disabled:p===m&&0===c||x||y,onMouseEnter:()=>b(-2),onMouseLeave:()=>b(null)},x?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(Bs,null)):p===m?"Checkout":"Next")))},hm=window?.Shopify?.currency||{rate:1,active:window?.ShopifyAnalytics?.meta?.currency||"INR"},bm=e=>{if(!e)return;const t=navigator.language||"en-US";return new Intl.NumberFormat(t).format(Number(e))},wm=(e,t)=>t==hm.active?e:me(hm.active)||hm.active,vm=(e,t)=>{if(!e||!e.includes("cdn.shopify")&&!e.includes("/cdn/shop/files/"))return e;try{const n=new URL(e),r=n.searchParams;return r.has("format")||r.set("format","webp"),r.has("quality")||r.set("quality",t?.toString()||"70"),r.has("width")||r.set("width","600"),n.toString()}catch{const n=e.includes("?")?"&":"?";return e+n+`format=webp&quality=70&width=${t?.toString()||"600"}`}},Cm=(e,t,n,r,o,a,i)=>{const l=r.findIndex(t=>t.variantId===e&&(void 0===i||t.tierIndex===i));o(0===n?e=>e.filter((e,t)=>t!==l):-1===l?r=>[...r,{product:t,variantId:e,quantity:n,isFree:a,tierIndex:i}]:e=>e.map((e,t)=>t===l?{...e,quantity:e.quantity+n,isFree:a,tierIndex:i}:e))},Em=({bundle:t,currentProductId:n,addToCartFunction:r,addCustomBundleToCart:o,selectedItems:a,setSelectedItems:i,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:s,renderingOnPage:d,bundleSubtotal:p,dispatchAnalyticsEvent:m,fetchStoreDetails:u,productsPagination:g})=>"fixed"!==t.type&&t.type&&0!==t?.type?.length?"builder"===t.type?e.createElement(Ls,{bundleAddToCartLoading:l,bundle:t,selectedItems:a,setSelectedItems:i,handleAddToCart:o,handleRemoveItem:c,renderingOnPage:d,selectedItemsQuantity:s??0,bundleSubtotal:p??{price:0,compareAtPrice:0},dispatchAnalyticsEvent:m,fetchStoreDetails:u,productsPagination:g}):"combo"===t.type?e.createElement(Ms,{bundle:t,addToCartFunction:r,dispatchAnalyticsEvent:m}):"mixAndMatch"===t.type?e.createElement(Gd,{bundle:t,addToCartFunction:r,dispatchAnalyticsEvent:m}):"collection"===t.type?e.createElement(gm,{config:t,addCustomBundleToCart:o,bundleAddToCartLoading:l,dispatchAnalyticsEvent:m}):e.createElement(xd,{bundle:t,currentProductId:n,addToCartFunction:r,dispatchAnalyticsEvent:m}):e.createElement(im,{addToCartFunction:r,bundle:t,dispatchAnalyticsEvent:m}),km=s.div`
4680
4680
  position: relative;
4681
4681
  `,Tm=s.button`
4682
4682
  border: 1px solid #ccc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yt-uikit",
3
- "version": "0.10.10",
3
+ "version": "0.10.11",
4
4
  "description": "YourToken UI Kit",
5
5
  "scripts": {
6
6
  "rollup": "rm -rf dist && tsc && rollup -c",