yt-uikit 0.8.28 → 0.8.29-volume-bundle-variant-init.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +2 -2
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -3893,7 +3893,7 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
|
|
|
3893
3893
|
scrollbar-width: none;
|
|
3894
3894
|
|
|
3895
3895
|
-ms-overflow-style: none;
|
|
3896
|
-
`,Kf=(e,t)=>{if(!t)return{};for(const n of t)if(n.productId==e)return n;return{}};function Jf({bundle:e,addToCartFunction:n,currentProductId:r}){const s=i(()=>{if(r){const t="gid://shopify/Product/"+r,n=e.products?.some(e=>e.productId===t);return n?t:e.products?.[0]?.productId}return e.products?.[0]?.productId},[r,e.products]),d=i(()=>Kf(s,e.products),[s,e.products]),p=o(null),u=o(null),m=o({});document.querySelector("#ProductSelect-product-template"),document.querySelector('form[action="/cart/add"]');const[f,g]=c(0),[x,h]=c(""),y=e.customizations??{},b=!1===y?.general?.showDecimalsInBundlePricing,v=i(()=>d?.productDetails?.tracksInventory??!0,[d?.productDetails?.tracksInventory]),w=a(e=>{if(!v)return 1/0;if(!e)return 0;if(!e.inventoryItem?.tracked)return 1/0;let t=e.inventoryQuantity??0;return t>0?t:"continue"===e.inventoryPolicy?1/0:0},[v]),C=(i(()=>d?.productDetails?.variants?.edges?.reduce((e,{node:t})=>w(t)>0?e+1:e,0),[d,w]),i(()=>Kf(s,e.products)?.id,[s,e.products]));i(()=>C?Kf(s,e.products):void 0,[s,e.products,C]),i(()=>e.products?.some(e=>e.productDetails?.options?.some(e=>e.values.length>1))||!1,[e.products]),y.volumeBundle;const k=i(()=>e?.volumeTiers||[],[e?.volumeTiers]),E=k.findIndex(e=>e.isDefault),[S,T]=c(-1!==E?k[E].tier:k?.[0]?.tier||1),[$,B]=c(d?.productDetails?.variants?.edges?.find(e=>w(e?.node)>0)?.node?.id||d?.productDetails?.variants?.edges?.[0]?.node?.id||""),[z,I]=c({}),[N,D]=c(k.reduce((e,t,n)=>(e[t.tier-1]=Array.from({length:t.minimumQuantity},()=>d?.productDetails?.options?.map(e=>e.values[0])||[]),e),{})||{}),[_,P]=c(!1),[F,O]=c(window.innerWidth<550),[A,M]=c(null),[R,L]=c(null);o([]);const j=o([]),V=o(S);l(()=>{const e=()=>{O(window.innerWidth<550)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),l(()=>{const e=e=>{A&&j.current[A.index]&&j.current[A.index][A.optionIndex]&&!j.current[A.index][A.optionIndex]?.contains(e.target)&&M(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[A]);const W=a(e=>{const t=k.find(t=>t.tier===e);if(!t)return null;const n=t.minimumQuantity,r=d?.productDetails?.variants?.edges||[];for(const e of r){const t=e.node;if(w(t)>=n){const e=t.title.split(" / ");return Array(n).fill(e)}}const o=[],a={},i=[...r].sort((e,t)=>{const n=w(e.node),r=w(t.node);return n===1/0&&r===1/0?0:n===1/0?-1:r===1/0?1:r-n});for(let e=0;e<n&&o.length<n;e++){let e=!1;for(const t of i){const n=t.node,r=a[n.id]||0;if(w(n)>r&&n.availableForSale){const t=n.title.split(" / ");o.push(t),a[n.id]=r+1,e=!0;break}}if(!e)return null}return o.length===n?o:null},[d,k,w]),H=a(e=>{const t=k.find(t=>t.tier===e);if(!t)return!1;const n=t.minimumQuantity,r=d?.productDetails?.variants?.edges||[];let o=0;for(const e of r){const t=w(e.node);if(t===1/0){o=1/0;break}o+=t}return o>=n},[k,d,w]);l(()=>{const e={},t=d?.productDetails?.variants?.edges?.find(e=>w(e?.node)>0)?.node?.id||d?.productDetails?.variants?.edges?.[0]?.node?.id||"";t&&k.forEach(n=>{e[n.tier]={};for(let r=0;r<n.minimumQuantity;r++)e[n.tier][r]=t}),I(e)},[d?.id,k?.map(e=>`${e.tier}-${e.minimumQuantity}`).join("|"),w]),l(()=>{if(!m.current[S]){const e=W(S);if(e){const t=S-1;D(n=>({...n,[t]:e}));const n={};e.forEach((e,t)=>{const r=e.join(" / "),o=d?.productDetails?.variants?.edges?.find(e=>e.node.title===r)?.node.id||$;n[t]=o}),I(e=>({...e,[S]:n}))}m.current[S]=!0}},[S,d,$,W]);const q=(e,t)=>e?.productDetails?.variants?.edges?.find(e=>e.node.id===t)?.node,U=a((e,t,n,r,o)=>{const a=k.find(t=>t.tier===e);if(!a)return!1;const i=a.minimumQuantity,l=[...n];l[r]=o;const c=l.join(" / "),s=d?.productDetails?.variants?.edges?.find(e=>e.node.title===c)?.node;if(!s||0===w(s))return!1;const p={},u=z[e]||{};for(let e=0;e<i;e++){let n;if(e===t)n=s.id;else{const t=u[e]||$,r=q(d,t);if(!r)return!1;n=r.id}p[n]=(p[n]||0)+1}for(const[e,t]of Object.entries(p)){const n=q(d,e),r=w(n);if(r!==1/0&&t>r)return!1}return!0},[k,d,N,N,z,$,w]),Q=a(e=>{const t=k.find(t=>t.tier===e);if(!t)return!1;const n=t.minimumQuantity,r=e-1,o={};for(let e=0;e<n;e++){const t=(N[r]?.[e]||d.productDetails.options.map(e=>e.values[0])).join(" / "),n=d?.productDetails?.variants?.edges?.find(e=>e.node.title===t);if(!n)return!1;const a=n.node.id;o[a]=(o[a]||0)+1}for(const[e,t]of Object.entries(o)){const n=q(d,e),r=w(n);if(r!==1/0&&t>r)return!1}return!0},[k,d,N,w]);l(()=>{g(e=>e+1)},[z]);const Y=(e,t,n)=>{I(r=>({...r,[e]:{...r[e]||{},[t]:n}}))},G=a(()=>d?.productDetails?.variants?.edges?.find(e=>w(e.node)>0)?.node||d?.productDetails?.variants?.edges?.[0]?.node,[d,w]),Z=a(()=>new URLSearchParams(window.location.search).get("variant")||"",[]);l(()=>{V.current=S},[S]),l(()=>{R?(L(null),X()):X()},[S]),l(()=>{if(e){const e=G();if(e)h(e.id),B(e.id);else{const e=d?.productDetails?.variants?.edges?.[0]?.node?.id||"";h(e),B(e)}}},[e,d,G]);const X=()=>{const e=Z();if(e){const t=d?.productDetails?.variants?.edges?.find(t=>String(t.node.id)==="gid://shopify/ProductVariant/"+String(e));let n=t?.node;if(n)B(String(n.id)),g(e=>e+1);else{const e=G();e&&(B(String(e.id)),n=e),g(e=>e+1)}if(n){0===w(n)?(L(null),setTimeout(()=>{L({tier:V.current,index:0,optionIndex:0,value:n.title})},0)):R&&L(null)}}};l(()=>{X();const e=new Event("urlChange");let t=!0;const n=window.history.pushState,r=window.history.replaceState;return window.history.pushState=function(){t&&(n.apply(this,arguments),window.dispatchEvent(e))},window.history.replaceState=function(){t&&(r.apply(this,arguments),window.dispatchEvent(e))},window.addEventListener("urlChange",X),()=>{t=!1,window.removeEventListener("urlChange",X),window.history.pushState=n,window.history.replaceState=r}},[Z,d?.id,G,w]);const K=t=>{const n=k.find(e=>e.tier===t);if(!n)return{original:0,discounted:0};let r=0,o=0;const a=z[t]||{};for(let e=0;e<n.minimumQuantity;e++){const t=a[e]||$,n=q(d,t);n&&(n.compareAtPrice?r+=Number.parseFloat(n.compareAtPrice):r+=Number.parseFloat(n.price),o+=Number.parseFloat(n.price))}return"percentOff"===e?.discountType?o*=1-n.discountValue/100:"amountOff"===e?.discountType&&(o-=n.discountValue),o<0&&(o=0),{original:r,discounted:o,discountValue:n.discountValue}},J=(e,t,n,r)=>{let o=q(e,t);if(r){const a=z[r]?.[n||0]||t;o=q(e,a)}return o?.image?.url?o.image.url:e.productDetails?.media?.edges[0]?.node?.preview?.image?.url||""};function ee(e){if(e.startsWith("gid://")){const t=e.split("/");return t[t.length-1]}return e}l(()=>{const e=()=>{if("shopify_atc_button"!==y.volumeBundle?.addtoCartMethod&&"06cf02-81.myshopify.com"!==window.ytBundleApp?.storeDomain)return;const e=document.querySelector('form[action="/cart/add"]');if(!e)return;const t=document.querySelector("#Quantity-product-template")||document.querySelector('input[name="quantity"]')||document.querySelector('input[type="number"][min="1"]');let n=1;t&&t.value&&(n=parseInt(t.value,10)||1);const r=k.find(e=>e.tier===S);if(!r)return;e.querySelectorAll('.bundle-input-field, [name^="properties["], [name="id"], [name="quantity"]').forEach(e=>e.remove());const o=r.minimumQuantity;let a={};const i=Math.max(o,n);if("vertical"===y.volumeBundle.cardStyle){const e=x||$;if(!e)return;a[e]=i}else if(n>o){const e=x||$;if(!e)return;a[e]=i}else{const e=z[r.tier]||{};for(let t=0;t<o;t++){let n=e[t];n||(n=$),n&&(a[n]=(a[n]||0)+1)}}const l=K(r.tier),c=Object.fromEntries(Object.entries(a).map(([e,t])=>[ee(e),Math.round(t)])),s=(t,n,r="bundle-input-field")=>{const o=document.createElement("input");o.type="hidden",o.name=t,o.value=n,o.className=r,e.appendChild(o)};if(n>o){const e=x||$;e&&s("id",ee(e))}s("properties[_bundle_price]",String(l.original)),s("properties[_bundle_tier]",String(r.tier)),s("properties[_bundle_items]",JSON.stringify(c));let d=0;Object.entries(c).forEach(([e,t])=>{t>0&&(s(`items[${d}][id]`,e),s(`items[${d}][quantity]`,String(t)),d++)}),requestAnimationFrame(()=>{const t=e.querySelector('[type="submit"]'),r=e.querySelector('[name="checkout"]'),a=e.querySelector(".noti-btn-main-wrap"),i=(e,t,n)=>{if(!e)return;e.disabled=t,e.classList.toggle("disabled",t);const r=e.querySelector("[data-add-to-cart-text]")||e.querySelector("span");r&&(r.textContent=n)};n<=o&&(R?(i(t,!0,"Sold out"),i(r,!0,"Sold out"),t&&t.classList.add("btn--sold-out","hidden"),a&&(a.style.display="block",a.classList.remove("hidden"),a.classList.add("block"))):(i(t,!1,"Add to cart"),i(r,!1,"Buy it now"),t&&t.classList.remove("btn--sold-out","hidden"),a&&(a.style.display="none",a.classList.add("hidden"))))})};e();const t=document.querySelector("#Quantity-product-template")||document.querySelector('input[name="quantity"]')||document.querySelector('input[type="number"][min="1"]');if(t){const n=()=>{requestAnimationFrame(()=>{e()})};return t.addEventListener("input",n),t.addEventListener("change",n),()=>{t.removeEventListener("input",n),t.removeEventListener("change",n)}}return()=>{}},[S,JSON.stringify(z),$,y.volumeBundle?.cardStyle,r,x,R]);const te=i(()=>k.find(e=>e.tier===S),[k,S]),ne=i(()=>te?K(te.tier):null,[te,z,$]),re=i(()=>{if(!te||!ne)return;const e=z[te.tier]||{},t={};for(let n=0;n<te.minimumQuantity;n++){const r=e[n]||$;t[r]=(t[r]||0)+1}return t},[te?.minimumQuantity,$,z,ne]),oe=i(()=>Object.entries(re??{}).map(([e,t])=>({variantId:e,quantity:t})),[re]);if(l(()=>{if(!te||!ne)return;const e={tier:S,items:te.minimumQuantity,discountedPrice:ne.discounted,originalPrice:ne.original,variants:oe,productId:d?.id??null,tierMeta:{title:te.title,subtitle:te.subtitle,badgeTitle:te.badgeTitle},productData:d,tierData:te},t=u.current;return t&&JSON.stringify(t)===JSON.stringify(e)?void 0:(p.current&&clearTimeout(p.current),p.current=window.setTimeout(()=>{u.current=e;const t=new CustomEvent("ytBundleTierChange",{detail:e});window.dispatchEvent(t)},50),()=>{p.current&&clearTimeout(p.current)})},[S,te?.tier,te?.minimumQuantity,ne?.discounted,ne?.original,d?.id,JSON.stringify(oe)]),l(()=>{if(!$||!te)return;const e=q(d,$);if(!e)return;const t={};for(let e=0;e<te.minimumQuantity;e++)t[e]=$;I(e=>({...e,[S]:{...t}}));const n=e.title.split(" / "),r=Array.from({length:te.minimumQuantity},()=>[...n]);D(e=>({...e,[S-1]:r}))},[$,S,d,te]),!n)return t.createElement(t.Fragment,null);const ae=y.volumeBundle?.cardStyle,ie=y.general?.primaryColor,le=y.general?.secondaryColor,ce=y.general.primaryContrastColor,se=y.general.secondaryContrastColor,de="high"===e.cornerRadiusType?"20px":"medium"===e.cornerRadiusType?"6px":"0px",pe="bundles"==e.appName?e.pageHeader?.title:e?.title,ue="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return l(()=>{Q(S)&&R?.tier===S&&L(null)},[S,oe,Q,R]),t.createElement(kf,{verticalMargin:y.volumeBundle?.verticalMargin,$backgroundColor:y.volumeBundle?.sectionBackgroundColor,className:"yt-bundle-container"},t.createElement(Ef,{className:"yt-bundle-header"},pe&&pe.trim().length>0&&t.createElement(Sf,{fontSize:y.volumeBundle?.titleFontSize,$backgroundColor:y.volumeBundle?.titleBackgroundColor,textColor:y.volumeBundle?.titleTextColor,className:"yt-bundle-header-title"},pe),t.createElement(Tf,{className:"yt-bundle-header-subtitle",fontSize:y.volumeBundle?.subtitleFontSize},ue)),"vertical"===ae?t.createElement("div",{style:{display:"grid",gridTemplateColumns:F||4===k.length?"repeat(2, 1fr)":k.length>4?"repeat(3, 1fr)":`repeat(${k.length}, 1fr)`,justifyItems:"center",gap:F?"10px":"16px",paddingTop:"10px"},className:"yt-bundle-vertical-container"},k.map(n=>{const r=K(n.tier),o=r.original-r.discounted,a=S===n.tier,i=!H(n.tier);return t.createElement(t.Fragment,{key:n.tier},t.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"8px",borderRadius:de||"24px",...a?{border:`2px solid ${ie}`}:{border:`1px solid ${le}`},boxShadow:`6px 6px 0px -1px ${a?ie:le}20`,...n.badgeTitle&&{position:"relative"},zIndex:5,backgroundColor:i?"#f5f5f5":"white",cursor:i?"not-allowed":"pointer",position:"relative",height:"100%",maxHeight:"350px",width:"100%",opacity:i?.6:1},className:"yt-volume-vertical-tier-item "+(a?"yt-volume-vertical-tier-item-active":""),"data-tier":n.tier,"data-discount-value":r.discountValue,"data-discount-type":e?.discountType,"data-minimum-quantity":n.minimumQuantity,"data-original-price":r.original.toFixed(b?0:2),"data-discounted-price":r.discounted.toFixed(b?0:2),onClick:()=>!i&&T(n.tier)},n.badgeTitle&&t.createElement("div",{style:{position:"absolute",top:"-15px",zIndex:-1,left:"0",right:"0",width:"80%",textAlign:"center",margin:"0 auto",fontSize:"10px",clipPath:"polygon(2% 0%, 98% 0%, 100% 100%, 0% 100%)",backgroundColor:a?ie:le,color:a?ce:se,padding:"2px 0",borderRadius:"12px 12px 0px 0px",lineHeight:"normal"},className:a?"yt-volume-vertical-tier-badge-active":"yt-volume-vertical-tier-badge","data-tier":n.tier,"data-badge-title":n.badgeTitle},n.badgeTitle),t.createElement("div",{style:{position:"relative",width:"100%",display:"flex",justifyContent:"center",height:"fit-content"},className:"yt-volume-vertical-tier-save-badge-container"},0!==r.discountValue&&t.createElement(t.Fragment,null,F&&o>0&&!!r?.discountValue&&"Enabled"===y.volumeBundle?.discountBadgeVisibility&&t.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"5px",top:"8px"}},t.createElement(Nf,{primaryBackgroundColorCta:a?ie:le,isSelected:a,style:{height:"fit-content",fontSize:"10px",lineHeight:"normal",color:a?ce:se},className:"yt-volume-vertical-tier-save-badge","data-tier":n.tier,"data-discount-value":r.discountValue,"data-discount-type":e?.discountType}," ","percentOff"===e?.discountType?`${r.discountValue}% Off`:`Save ${nh(y.general.currencySymbol,e.storeCurrencyCode)}${th(r.discountValue)}`))),n.imageUrl&&t.createElement("img",{src:rh(n.imageUrl),style:{objectFit:"cover",aspectRatio:"1/1",width:"100%",maxHeight:"160px",maxWidth:"160px",height:"fit-content",borderTopLeftRadius:de||"24px",borderTopRightRadius:de||"24px"},className:"yt-volume-vertical-tier-badge"})),t.createElement("div",{style:{padding:"8px",paddingTop:"0"}},t.createElement(Df,{style:{display:"flex",width:"100%",gap:"4px"},className:"yt-volume-vertical-details-container"},t.createElement("div",{style:{display:"flex",alignItems:"center",position:"relative",width:"100%"},className:"yt-volume-vertical-details-title-container"},t.createElement(_f,{style:{fontSize:F?"12px":"14px",lineHeight:"normal"},className:"yt-volume-vertical-details-title"},n.title?n.title:t.createElement(t.Fragment,null,"Buy ",n.minimumQuantity,", Get"," ",n.discountValue,"% Off")),!F&&o>0&&!!r?.discountValue&&"Enabled"===y.volumeBundle?.discountBadgeVisibility&&t.createElement(Nf,{primaryBackgroundColorCta:a?ie:le,isSelected:a,style:{height:"fit-content",fontSize:"10px",lineHeight:"normal",color:a?ce:se},className:"yt-volume-vertical-tier-save-badge","data-tier":n.tier,"data-discount-value":r.discountValue,"data-discount-type":e?.discountType}," ","percentOff"===e?.discountType?`${r.discountValue}% Off`:`Save ${nh(y.general.currencySymbol,e.storeCurrencyCode)}${th(r.discountValue)}`),a&&n.imageUrl&&t.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"0px"},className:"yt-volume-vertical-tier-selected-check"},t.createElement("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",borderRadius:"50%",backgroundColor:ie,color:ce,padding:"2px"}},t.createElement(ho,{style:{paddingBottom:"1px"},size:20,fontWeight:20})))),t.createElement(Pf,{style:{lineHeight:"normal",fontSize:F?"10px":"14px",color:"#666"},className:"yt-volume-vertical-details-subtitle"},n.subtitle?n.subtitle:t.createElement(t.Fragment,null))),H(n.tier)?t.createElement(Ff,{style:{textAlign:"left",marginTop:"4px",display:"flex",flexDirection:"row",flexWrap:"wrap",alignItems:"center"},className:"yt-volume-vertical-details-price","data-tier":n.tier,"data-original-price":r.original.toFixed(b?0:2),"data-discounted-price":r.discounted.toFixed(b?0:2),"data-savings":o.toFixed(b?0:2)},t.createElement(Of,{style:{marginLeft:"0",lineHeight:"normal",marginRight:"8px"},className:"yt-volume-vertical-details-price-discount"},nh(y.general.currencySymbol,e.storeCurrencyCode),th(r.discounted.toFixed(b?0:2))),o>0?t.createElement(Af,{style:{lineHeight:"normal"},className:"yt-volume-vertical-details-price-original"},nh(y.general.currencySymbol,e.storeCurrencyCode),th(r.original.toFixed(b?0:2))):""):t.createElement("div",{style:{textAlign:"center",color:"#999",fontSize:"14px",fontWeight:"500",padding:"4px 0",lineHeight:"normal"}},"Out of Stock")),a&&!n.imageUrl&&t.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"10px",bottom:"10px"},className:"yt-volume-vertical-tier-selected-check"},t.createElement("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",borderRadius:"50%",backgroundColor:ie,color:ce,padding:"2px"}},t.createElement(ho,{style:{paddingBottom:"1px"},size:20,fontWeight:20})))))})):t.createElement(t.Fragment,null,k.map(n=>{const r=K(n.tier),o=r.original-r.discounted,a=!H(n.tier);return t.createElement(t.Fragment,{key:n.tier},n.badgeTitle&&t.createElement($f,{primaryTextColorCta:ce,primaryBackgroundColorCta:ie,style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-badge","data-tier":n.tier,"data-badge-title":n.badgeTitle},n.badgeTitle),t.createElement(Bf,{cornerRadiusType:e?.cornerRadiusType??"",key:n.tier,primaryBackgroundColorCta:ie??"",isSelected:S===n.tier,onClick:()=>T(n.tier),style:{borderRadius:de,cursor:"pointer",backgroundColor:a?"#f5f5f5":"white",opacity:a?.6:1},className:"yt-volume-horizontal-tier-container "+(S===n.tier?"yt-volume-horizontal-tier-container-active":""),"data-tier":n.tier,"data-discount-value":r.discountValue,"data-discount-type":e?.discountType,"data-minimum-quantity":n.minimumQuantity,"data-original-price":r.original.toFixed(b?0:2),"data-discounted-price":r.discounted.toFixed(b?0:2)},t.createElement(zf,{cornerRadiusType:e?.cornerRadiusType??"",style:{borderRadius:de,borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"},className:"yt-volume-horizontal-tier-header"},t.createElement(If,{className:"yt-volume-horizontal-tier-info"},t.createElement(Vf,{"data-active":S===n.tier,accentColor:ie,className:"yt-volume-horizontal-tier-radio-wrapper"},t.createElement(Wf,{name:"tier",checked:S===n.tier,onChange:()=>!a&&T(n.tier),disabled:a,className:"yt-volume-horizontal-tier-radio-hidden"}),t.createElement(Hf,{accentColor:ie,className:"yt-volume-horizontal-tier-radio-custom"})),t.createElement(Df,{className:"yt-volume-horizontal-tier-details"},t.createElement("div",{style:{display:"flex"},className:"yt-volume-horizontal-tier-title-container"},t.createElement(_f,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-title"},n.title?n.title:t.createElement(t.Fragment,null,"Buy ",n.minimumQuantity,", Get"," ",n.discountValue,"% Off")),o>0&&r?.discountValue&&"Enabled"===y.volumeBundle?.discountBadgeVisibility?t.createElement(Nf,{primaryBackgroundColorCta:ie,isSelected:S===n.tier,style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-save-badge","data-tier":n.tier,"data-discount-value":r.discountValue,"data-discount-type":e?.discountType}," ","percentOff"===e?.discountType?`${r.discountValue}% Off`:`Save ${nh(y.general.currencySymbol,e.storeCurrencyCode)}${th(r.discountValue)}`):""),t.createElement(Pf,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-subtitle"},n.subtitle?n.subtitle:t.createElement(t.Fragment,null)))),H(n.tier)?t.createElement(Ff,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-price","data-tier":n.tier,"data-original-price":r.original.toFixed(b?0:2),"data-discounted-price":r.discounted.toFixed(b?0:2),"data-savings":o.toFixed(0)},o>0?t.createElement(Af,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-original-price"},nh(y.general.currencySymbol,e.storeCurrencyCode),th(r.original.toFixed(b?0:2))):"",t.createElement(Of,{className:"yt-volume-horizontal-tier-discounted-price"},nh(y.general.currencySymbol,e.storeCurrencyCode),th(r.discounted.toFixed(b?0:2)))):t.createElement("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",lineHeight:"normal"}},t.createElement("span",{style:{color:"#999",fontSize:"14px",fontWeight:"500"}},"Out of Stock"))),S===n.tier&&t.createElement(Mf,{className:"yt-volume-horizontal-tier-product-grid",style:{padding:d.productDetails.variants.edges.length<=1?"0":"10px 15px",gap:d.productDetails.variants.edges.length<=1?"0":"10px"}},Array.from({length:n.minimumQuantity}).map((r,o)=>{const i=n.tier-1,l=(N[i]||[])[o]||d.productDetails.options?.map(e=>e.values[0])||[],c=d?.productDetails?.options.some(e=>e.values.length>1);return t.createElement("div",{key:o,style:{display:"flex",gap:"10px",alignItems:"center",position:"relative"},className:"yt-volume-horizontal-tier-product-item"},c&&t.createElement(qf,{src:rh(J(d,$,o,n.tier)),alt:d?.productDetails?.title||"Product",className:"yt-volume-horizontal-tier-product-image"}),"auto"===y?.volumeBundle?.variantSelectorType?t.createElement("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"}},d?.productDetails?.options?.map((r,s)=>{if(!c)return null;const p=A?.tier===n.tier&&A?.index===o&&A?.optionIndex===s,u=e?.variantOptions?.options?.find(e=>e.name===r.name);let m="";return"color"===u?.type&&(m=u?.values?.find(e=>e.name===l[s])?.value||""),t.createElement(Gf,{key:s,ref:e=>{j.current[o]||(j.current[o]=[]),j.current[o][s]=e},style:{zIndex:p?1e3:"auto",display:"flex"},isActive:p},t.createElement(Zf,{onClick:e=>{e.stopPropagation(),M(p?null:{tier:n.tier,index:o,optionIndex:s})},isActive:p,disabled:a},"color"===u?.type&&m&&t.createElement("div",{className:"yt-fixedBundle-product-card_color-swatch",style:{display:"inline-block",width:20,height:20,borderRadius:"50%",backgroundColor:m||"transparent",border:"1px solid #ddd"}}),l[s],t.createElement(lo,null)),p&&t.createElement(Xf,{style:{zIndex:1001}},r.values.map((e,r)=>{const c=[...l];c[s]=e;const p=!U(n.tier,o,l,s,e)||a;d.productDetails.variants.edges.find(({node:e})=>e.title===c.join(" / "));const m=t=>{if(t.preventDefault(),t.stopPropagation(),D(e=>{const t={...e},n=[...t[i]||[]];return n[o]=c,t[i]=n,t}),p){L({tier:S,index:o,optionIndex:s,value:e}),M(null);const t=c.join(" / "),r=d.productDetails.variants.edges.find(e=>e.node.title===t)?.node.id||$;return void Y(n.tier,o,r)}const r=c.join(" / "),a=d.productDetails.variants.edges.find(e=>e.node.title===r)?.node.id||$;Y(n.tier,o,a),M(null)},f=u?.values.find(t=>t.name===e);return"image"===u?.type&&f?.value?t.createElement(Uf,{key:e,onClick:m,style:{cursor:"pointer"}},t.createElement(Qf,{src:f.value,alt:e}),e):"color"===u?.type&&f?.value?t.createElement(Uf,{key:e,onClick:m,style:{cursor:"pointer"}},t.createElement(Yf,{style:{backgroundColor:f.value}}),e):t.createElement(Uf,{key:e,onClick:m,style:{cursor:"pointer"}},e)})))})):t.createElement(Rf,{style:{display:"flex",flexDirection:"column",gap:"5px"},className:"yt-volume-horizontal-tier-variant-selector"},d?.productDetails?.options.map((r,c)=>{if(!(r.values.length>1))return null;const s=e.variantOptions?.options?.find(e=>e.name===r.name)||null;return t.createElement("div",{key:r.name,style:{width:"100%",display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"},className:"yt-volume-horizontal-tier-variant-option"},t.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"},className:"yt-volume-horizontal-tier-variant-values"},r.values.map(e=>{const r=l[c]===e,p=!U(n.tier,o,l,c,e)||a,u=s?.values.find(t=>t.name===e),m=t=>{if(t.preventDefault(),t.stopPropagation(),p)return;const r=[...l];r[c]=e,D(e=>{const t={...e},n=[...t[i]||[]];return n[o]=r,t[i]=n,t});const a=r.join(" / "),s=d.productDetails.variants.edges.find(e=>e.node.title===a)?.node.id||$;Y(n.tier,o,s)},f={opacity:p?.5:1,cursor:p?"not-allowed":"pointer"};return"color"===s?.type&&u?.value?t.createElement("button",{key:e,onClick:m,style:{...f,borderRadius:"50%",padding:"1px",backgroundColor:"white",border:r?`1px solid ${y.general?.ctaBackgroundColor||"#121212"}`:"1px solid transparent",lineHeight:"normal"},className:"yt-volume-horizontal-tier-variant-color-button",disabled:p},t.createElement("div",{style:{width:r?"24px":"20px",height:r?"24px":"20px",borderRadius:"50%",backgroundColor:u.value,lineHeight:"normal",boxShadow:"rgba(9, 30, 66, 0.25) 0px 4px 8px -2px, rgba(9, 30, 66, 0.08) 0px 0px 0px 2px"}},t.createElement("span",null))):"image"===s?.type&&u?.value?t.createElement("button",{key:e,onClick:m,style:{...f,border:r?`1px solid ${y.general?.ctaBackgroundColor||"#121212"}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:r?"#F7F7F7":"transparent",padding:"0px",width:r?"20px":"18px",height:r?"20px":"18px",overflow:"hidden"},className:"yt-volume-horizontal-tier-variant-image-button",disabled:p},t.createElement("img",{src:u.value,alt:e,style:{width:r?"26px":"24px",height:r?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}})):t.createElement(Lf,{key:e,isSelected:r,onClick:m,style:{...f,padding:"4px 8px",border:r?`1px solid ${y.general?.ctaBackgroundColor||"#121212"}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:r?"#F7F7F7":"transparent",color:"#707070",cursor:"pointer",fontSize:"12px",fontWeight:"600",lineHeight:"normal"},className:"yt-volume-horizontal-tier-variant-button-default",disabled:p},e)})))})))})),R&&R.tier===n.tier&&t.createElement("div",{style:{color:ie,textAlign:"center",fontSize:"14px",fontStyle:"normal",fontWeight:"500",lineHeight:"110%",background:`${ie}1A`,padding:"12px",borderBottomLeftRadius:de,borderBottomRightRadius:de}},"There aren’t enough items in our stock for select option, please select smaller bundle.")))})),e?.showCta&&(!y.volumeBundle?.addtoCartMethod||"shopify_atc_button"!==y.volumeBundle?.addtoCartMethod)&&!("devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain||"06cf02-81.myshopify.com"===window.ytBundleApp?.storeDomain)&&t.createElement("div",{style:{position:"relative"}},t.createElement(jf,{bgColor:Q(S)?y.general?.ctaBackgroundColor:"#ccc",textColor:Q(S)?y.general?.ctaTextColor:"#666",border:`1px solid ${Q(S)?y.general?.ctaBorderColor||"#121212":"#999"}`,shadow:y.general.ctaShadowType,padding:y.general?.ctaPadding,width:y.general?.ctaWidth,hoverProperties:{customizeHoverState:!!Q(S)&&y.general?.customizeHoverState,backgroundColor:y.general?.ctaHoverBackgroundColor,textColor:y.general?.ctaHoverTextColor},onClick:async()=>{if(Q(S))try{P(!0);const e=k.find(e=>e.tier===S);if(!e)return;const t={},r=z[e.tier]||{};for(let n=0;n<e.minimumQuantity;n++){const e=r[n]||$;t[e]?t[e].quantity+=1:t[e]={quantity:1}}const o=K(e.tier),a=Array.from({length:e.minimumQuantity},(e,t)=>r[t]||$);n&&await n(o.original,a)}catch(e){console.error("VolumeBundle handleAddToCart error:",e)}finally{P(!1)}else console.error("Selected tier is out of stock")},borderRadius:y.general.ctaBorderRadius??"",disabled:_||!Q(S),className:"yt-volume-add-to-cart-button"},Q(S)?t.createElement(t.Fragment,null,_?t.createElement(da,{color:"white",loading:_,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):t.createElement("div",{style:{display:"flex",flexDirection:"row",gap:"8px",justifyContent:"center",alignItems:"center"}},t.createElement("span",null,y.volumeBundle?.ctaTitle??"Add Bundle to Cart")," ","•",t.createElement("div",{className:"yt-volume-add-to-cart-button-info"},(()=>{const n=K(S);return t.createElement(t.Fragment,null,nh(y.general.currencySymbol,e.storeCurrencyCode),th(n.discounted.toFixed(b?0:2))," ",n?.original!==n.discounted&&t.createElement("span",{style:{lineHeight:"normal",textDecoration:"line-through",fontWeight:"550"}},nh(y.general.currencySymbol,e.storeCurrencyCode),th(n?.original.toFixed(b?0:2))," "))})()))):t.createElement(t.Fragment,null,"Out of Stock"))))}const eg=h.div`
|
|
3896
|
+
`,Kf=(e,t)=>{if(!t)return{};for(const n of t)if(n.productId==e)return n;return{}};function Jf({bundle:e,addToCartFunction:n,currentProductId:r}){const s=i(()=>{if(r){const t="gid://shopify/Product/"+r,n=e.products?.some(e=>e.productId===t);return n?t:e.products?.[0]?.productId}return e.products?.[0]?.productId},[r,e.products]),d=i(()=>Kf(s,e.products),[s,e.products]),p=o(null),u=o(null);o({}),document.querySelector("#ProductSelect-product-template"),document.querySelector('form[action="/cart/add"]');const[m,f]=c(0),[g,x]=c(""),h=e.customizations??{},y=!1===h?.general?.showDecimalsInBundlePricing,b=i(()=>d?.productDetails?.tracksInventory??!0,[d?.productDetails?.tracksInventory]),v=a(e=>{if(!b)return 1/0;if(!e)return 0;if(!e.inventoryItem?.tracked)return 1/0;let t=e.inventoryQuantity??0;return t>0?t:"continue"===e.inventoryPolicy?1/0:0},[b]),w=(i(()=>d?.productDetails?.variants?.edges?.reduce((e,{node:t})=>v(t)>0?e+1:e,0),[d,v]),i(()=>Kf(s,e.products)?.id,[s,e.products]));i(()=>w?Kf(s,e.products):void 0,[s,e.products,w]),i(()=>e.products?.some(e=>e.productDetails?.options?.some(e=>e.values.length>1))||!1,[e.products]),h.volumeBundle;const C=i(()=>e?.volumeTiers||[],[e?.volumeTiers]),k=C.findIndex(e=>e.isDefault),[E,S]=c(-1!==k?C[k].tier:C?.[0]?.tier||1),[T,$]=c(d?.productDetails?.variants?.edges?.find(e=>v(e?.node)>0)?.node?.id||d?.productDetails?.variants?.edges?.[0]?.node?.id||""),[B,z]=c({}),[I,N]=c(C.reduce((e,t,n)=>(e[t.tier-1]=Array.from({length:t.minimumQuantity},()=>d?.productDetails?.options?.map(e=>e.values[0])||[]),e),{})||{}),[D,_]=c(!1),[P,F]=c(window.innerWidth<550),[O,A]=c(null),[M,R]=c(null);o([]);const L=o([]),j=o(E);l(()=>{const e=()=>{F(window.innerWidth<550)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),l(()=>{const e=e=>{O&&L.current[O.index]&&L.current[O.index][O.optionIndex]&&!L.current[O.index][O.optionIndex]?.contains(e.target)&&A(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[O]),a(e=>{const t=C.find(t=>t.tier===e);if(!t)return null;const n=t.minimumQuantity,r=d?.productDetails?.variants?.edges||[];for(const e of r){const t=e.node;if(v(t)>=n){const e=t.title.split(" / ");return Array(n).fill(e)}}const o=[],a={},i=[...r].sort((e,t)=>{const n=v(e.node),r=v(t.node);return n===1/0&&r===1/0?0:n===1/0?-1:r===1/0?1:r-n});for(let e=0;e<n&&o.length<n;e++){let e=!1;for(const t of i){const n=t.node,r=a[n.id]||0;if(v(n)>r&&n.availableForSale){const t=n.title.split(" / ");o.push(t),a[n.id]=r+1,e=!0;break}}if(!e)return null}return o.length===n?o:null},[d,C,v]);const V=a(e=>{const t=C.find(t=>t.tier===e);if(!t)return!1;const n=t.minimumQuantity,r=d?.productDetails?.variants?.edges||[];let o=0;for(const e of r){const t=v(e.node);if(t===1/0){o=1/0;break}o+=t}return o>=n},[C,d,v]);l(()=>{const e={},t=d?.productDetails?.variants?.edges?.find(e=>v(e?.node)>0)?.node?.id||d?.productDetails?.variants?.edges?.[0]?.node?.id||"";t&&C.forEach(n=>{e[n.tier]={};for(let r=0;r<n.minimumQuantity;r++)e[n.tier][r]=t}),z(e)},[d?.id,C?.map(e=>`${e.tier}-${e.minimumQuantity}`).join("|"),v]);const W=(e,t)=>e?.productDetails?.variants?.edges?.find(e=>e.node.id===t)?.node,H=a((e,t,n,r,o)=>{const a=C.find(t=>t.tier===e);if(!a)return!1;const i=a.minimumQuantity,l=[...n];l[r]=o;const c=l.join(" / "),s=d?.productDetails?.variants?.edges?.find(e=>e.node.title===c)?.node;if(!s||0===v(s))return!1;const p={},u=B[e]||{};for(let e=0;e<i;e++){let n;if(e===t)n=s.id;else{const t=u[e]||T,r=W(d,t);if(!r)return!1;n=r.id}p[n]=(p[n]||0)+1}for(const[e,t]of Object.entries(p)){const n=W(d,e),r=v(n);if(r!==1/0&&t>r)return!1}return!0},[C,d,I,I,B,T,v]),q=a(e=>{const t=C.find(t=>t.tier===e);if(!t)return!1;const n=t.minimumQuantity,r=e-1,o={};for(let e=0;e<n;e++){const t=(I[r]?.[e]||d.productDetails.options.map(e=>e.values[0])).join(" / "),n=d?.productDetails?.variants?.edges?.find(e=>e.node.title===t);if(!n)return!1;const a=n.node.id;o[a]=(o[a]||0)+1}for(const[e,t]of Object.entries(o)){const n=W(d,e),r=v(n);if(r!==1/0&&t>r)return!1}return!0},[C,d,I,v]);l(()=>{f(e=>e+1)},[B]);const U=(e,t,n)=>{z(r=>({...r,[e]:{...r[e]||{},[t]:n}}))},Q=a(()=>d?.productDetails?.variants?.edges?.find(e=>v(e.node)>0)?.node||d?.productDetails?.variants?.edges?.[0]?.node,[d,v]),Y=a(()=>new URLSearchParams(window.location.search).get("variant")||"",[]);l(()=>{j.current=E},[E]),l(()=>{M?(R(null),G()):G()},[E]),l(()=>{if(e){const e=Q();if(e)x(e.id),$(e.id);else{const e=d?.productDetails?.variants?.edges?.[0]?.node?.id||"";x(e),$(e)}}},[e,d,Q]);const G=()=>{const e=Y();if(e){const t=d?.productDetails?.variants?.edges?.find(t=>String(t.node.id)==="gid://shopify/ProductVariant/"+String(e));let n=t?.node;if(n)$(String(n.id)),f(e=>e+1);else{const e=Q();e&&($(String(e.id)),n=e),f(e=>e+1)}if(n){0===v(n)?(R(null),setTimeout(()=>{R({tier:j.current,index:0,optionIndex:0,value:n.title})},0)):M&&R(null)}}};l(()=>{G();const e=new Event("urlChange");let t=!0;const n=window.history.pushState,r=window.history.replaceState;return window.history.pushState=function(){t&&(n.apply(this,arguments),window.dispatchEvent(e))},window.history.replaceState=function(){t&&(r.apply(this,arguments),window.dispatchEvent(e))},window.addEventListener("urlChange",G),()=>{t=!1,window.removeEventListener("urlChange",G),window.history.pushState=n,window.history.replaceState=r}},[Y,d?.id,Q,v]);const Z=t=>{const n=C.find(e=>e.tier===t);if(!n)return{original:0,discounted:0};let r=0,o=0;const a=B[t]||{};for(let e=0;e<n.minimumQuantity;e++){const t=a[e]||T,n=W(d,t);n&&(n.compareAtPrice?r+=Number.parseFloat(n.compareAtPrice):r+=Number.parseFloat(n.price),o+=Number.parseFloat(n.price))}return"percentOff"===e?.discountType?o*=1-n.discountValue/100:"amountOff"===e?.discountType&&(o-=n.discountValue),o<0&&(o=0),{original:r,discounted:o,discountValue:n.discountValue}},X=(e,t,n,r)=>{let o=W(e,t);if(r){const a=B[r]?.[n||0]||t;o=W(e,a)}return o?.image?.url?o.image.url:e.productDetails?.media?.edges[0]?.node?.preview?.image?.url||""};function K(e){if(e.startsWith("gid://")){const t=e.split("/");return t[t.length-1]}return e}l(()=>{const e=()=>{if("shopify_atc_button"!==h.volumeBundle?.addtoCartMethod&&"06cf02-81.myshopify.com"!==window.ytBundleApp?.storeDomain)return;const e=document.querySelector('form[action="/cart/add"]');if(!e)return;const t=document.querySelector("#Quantity-product-template")||document.querySelector('input[name="quantity"]')||document.querySelector('input[type="number"][min="1"]');let n=1;t&&t.value&&(n=parseInt(t.value,10)||1);const r=C.find(e=>e.tier===E);if(!r)return;e.querySelectorAll('.bundle-input-field, [name^="properties["], [name="id"], [name="quantity"]').forEach(e=>e.remove());const o=r.minimumQuantity;let a={};const i=Math.max(o,n);if("vertical"===h.volumeBundle.cardStyle){const e=g||T;if(!e)return;a[e]=i}else if(n>o){const e=g||T;if(!e)return;a[e]=i}else{const e=B[r.tier]||{};for(let t=0;t<o;t++){let n=e[t];n||(n=T),n&&(a[n]=(a[n]||0)+1)}}const l=Z(r.tier),c=Object.fromEntries(Object.entries(a).map(([e,t])=>[K(e),Math.round(t)])),s=(t,n,r="bundle-input-field")=>{const o=document.createElement("input");o.type="hidden",o.name=t,o.value=n,o.className=r,e.appendChild(o)};if(n>o){const e=g||T;e&&s("id",K(e))}s("properties[_bundle_price]",String(l.original)),s("properties[_bundle_tier]",String(r.tier)),s("properties[_bundle_items]",JSON.stringify(c));let d=0;Object.entries(c).forEach(([e,t])=>{t>0&&(s(`items[${d}][id]`,e),s(`items[${d}][quantity]`,String(t)),d++)}),requestAnimationFrame(()=>{const t=e.querySelector('[type="submit"]'),r=e.querySelector('[name="checkout"]'),a=e.querySelector(".noti-btn-main-wrap"),i=(e,t,n)=>{if(!e)return;e.disabled=t,e.classList.toggle("disabled",t);const r=e.querySelector("[data-add-to-cart-text]")||e.querySelector("span");r&&(r.textContent=n)};n<=o&&(M?(i(t,!0,"Sold out"),i(r,!0,"Sold out"),t&&t.classList.add("btn--sold-out","hidden"),a&&(a.style.display="block",a.classList.remove("hidden"),a.classList.add("block"))):(i(t,!1,"Add to cart"),i(r,!1,"Buy it now"),t&&t.classList.remove("btn--sold-out","hidden"),a&&(a.style.display="none",a.classList.add("hidden"))))})};e();const t=document.querySelector("#Quantity-product-template")||document.querySelector('input[name="quantity"]')||document.querySelector('input[type="number"][min="1"]');if(t){const n=()=>{requestAnimationFrame(()=>{e()})};return t.addEventListener("input",n),t.addEventListener("change",n),()=>{t.removeEventListener("input",n),t.removeEventListener("change",n)}}return()=>{}},[E,JSON.stringify(B),T,h.volumeBundle?.cardStyle,r,g,M]);const J=i(()=>C.find(e=>e.tier===E),[C,E]),ee=i(()=>J?Z(J.tier):null,[J,B,T]),te=i(()=>{if(!J||!ee)return;const e=B[J.tier]||{},t={};for(let n=0;n<J.minimumQuantity;n++){const r=e[n]||T;t[r]=(t[r]||0)+1}return t},[J?.minimumQuantity,T,B,ee]),ne=i(()=>Object.entries(te??{}).map(([e,t])=>({variantId:e,quantity:t})),[te]);if(l(()=>{if(!J||!ee)return;const e={tier:E,items:J.minimumQuantity,discountedPrice:ee.discounted,originalPrice:ee.original,variants:ne,productId:d?.id??null,tierMeta:{title:J.title,subtitle:J.subtitle,badgeTitle:J.badgeTitle},productData:d,tierData:J},t=u.current;return t&&JSON.stringify(t)===JSON.stringify(e)?void 0:(p.current&&clearTimeout(p.current),p.current=window.setTimeout(()=>{u.current=e;const t=new CustomEvent("ytBundleTierChange",{detail:e});window.dispatchEvent(t)},50),()=>{p.current&&clearTimeout(p.current)})},[E,J?.tier,J?.minimumQuantity,ee?.discounted,ee?.original,d?.id,JSON.stringify(ne)]),l(()=>{if(!T||!d)return;const e=W(d,T);if(!e)return;const t=e.title.split(" / "),n={},r={};C.forEach(e=>{const o=e.tier-1,a={};for(let t=0;t<e.minimumQuantity;t++)a[t]=T;n[e.tier]=a,r[o]=Array(e.minimumQuantity).fill(t)}),z(e=>({...e,...n})),N(e=>({...e,...r}))},[T,d?.id,C.length]),!n)return t.createElement(t.Fragment,null);const re=h.volumeBundle?.cardStyle,oe=h.general?.primaryColor,ae=h.general?.secondaryColor,ie=h.general.primaryContrastColor,le=h.general.secondaryContrastColor,ce="high"===e.cornerRadiusType?"20px":"medium"===e.cornerRadiusType?"6px":"0px",se="bundles"==e.appName?e.pageHeader?.title:e?.title,de="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return l(()=>{q(E)&&M?.tier===E&&R(null)},[E,ne,q,M]),t.createElement(kf,{verticalMargin:h.volumeBundle?.verticalMargin,$backgroundColor:h.volumeBundle?.sectionBackgroundColor,className:"yt-bundle-container"},t.createElement(Ef,{className:"yt-bundle-header"},se&&se.trim().length>0&&t.createElement(Sf,{fontSize:h.volumeBundle?.titleFontSize,$backgroundColor:h.volumeBundle?.titleBackgroundColor,textColor:h.volumeBundle?.titleTextColor,className:"yt-bundle-header-title"},se),t.createElement(Tf,{className:"yt-bundle-header-subtitle",fontSize:h.volumeBundle?.subtitleFontSize},de)),"vertical"===re?t.createElement("div",{style:{display:"grid",gridTemplateColumns:P||4===C.length?"repeat(2, 1fr)":C.length>4?"repeat(3, 1fr)":`repeat(${C.length}, 1fr)`,justifyItems:"center",gap:P?"10px":"16px",paddingTop:"10px"},className:"yt-bundle-vertical-container"},C.map(n=>{const r=Z(n.tier),o=r.original-r.discounted,a=E===n.tier,i=!V(n.tier);return t.createElement(t.Fragment,{key:n.tier},t.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"8px",borderRadius:ce||"24px",...a?{border:`2px solid ${oe}`}:{border:`1px solid ${ae}`},boxShadow:`6px 6px 0px -1px ${a?oe:ae}20`,...n.badgeTitle&&{position:"relative"},zIndex:5,backgroundColor:i?"#f5f5f5":"white",cursor:i?"not-allowed":"pointer",position:"relative",height:"100%",maxHeight:"350px",width:"100%",opacity:i?.6:1},className:"yt-volume-vertical-tier-item "+(a?"yt-volume-vertical-tier-item-active":""),"data-tier":n.tier,"data-discount-value":r.discountValue,"data-discount-type":e?.discountType,"data-minimum-quantity":n.minimumQuantity,"data-original-price":r.original.toFixed(y?0:2),"data-discounted-price":r.discounted.toFixed(y?0:2),onClick:()=>!i&&S(n.tier)},n.badgeTitle&&t.createElement("div",{style:{position:"absolute",top:"-15px",zIndex:-1,left:"0",right:"0",width:"80%",textAlign:"center",margin:"0 auto",fontSize:"10px",clipPath:"polygon(2% 0%, 98% 0%, 100% 100%, 0% 100%)",backgroundColor:a?oe:ae,color:a?ie:le,padding:"2px 0",borderRadius:"12px 12px 0px 0px",lineHeight:"normal"},className:a?"yt-volume-vertical-tier-badge-active":"yt-volume-vertical-tier-badge","data-tier":n.tier,"data-badge-title":n.badgeTitle},n.badgeTitle),t.createElement("div",{style:{position:"relative",width:"100%",display:"flex",justifyContent:"center",height:"fit-content"},className:"yt-volume-vertical-tier-save-badge-container"},0!==r.discountValue&&t.createElement(t.Fragment,null,P&&o>0&&!!r?.discountValue&&"Enabled"===h.volumeBundle?.discountBadgeVisibility&&t.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"5px",top:"8px"}},t.createElement(Nf,{primaryBackgroundColorCta:a?oe:ae,isSelected:a,style:{height:"fit-content",fontSize:"10px",lineHeight:"normal",color:a?ie:le},className:"yt-volume-vertical-tier-save-badge","data-tier":n.tier,"data-discount-value":r.discountValue,"data-discount-type":e?.discountType}," ","percentOff"===e?.discountType?`${r.discountValue}% Off`:`Save ${nh(h.general.currencySymbol,e.storeCurrencyCode)}${th(r.discountValue)}`))),n.imageUrl&&t.createElement("img",{src:rh(n.imageUrl),style:{objectFit:"cover",aspectRatio:"1/1",width:"100%",maxHeight:"160px",maxWidth:"160px",height:"fit-content",borderTopLeftRadius:ce||"24px",borderTopRightRadius:ce||"24px"},className:"yt-volume-vertical-tier-badge"})),t.createElement("div",{style:{padding:"8px",paddingTop:"0"}},t.createElement(Df,{style:{display:"flex",width:"100%",gap:"4px"},className:"yt-volume-vertical-details-container"},t.createElement("div",{style:{display:"flex",alignItems:"center",position:"relative",width:"100%"},className:"yt-volume-vertical-details-title-container"},t.createElement(_f,{style:{fontSize:P?"12px":"14px",lineHeight:"normal"},className:"yt-volume-vertical-details-title"},n.title?n.title:t.createElement(t.Fragment,null,"Buy ",n.minimumQuantity,", Get"," ",n.discountValue,"% Off")),!P&&o>0&&!!r?.discountValue&&"Enabled"===h.volumeBundle?.discountBadgeVisibility&&t.createElement(Nf,{primaryBackgroundColorCta:a?oe:ae,isSelected:a,style:{height:"fit-content",fontSize:"10px",lineHeight:"normal",color:a?ie:le},className:"yt-volume-vertical-tier-save-badge","data-tier":n.tier,"data-discount-value":r.discountValue,"data-discount-type":e?.discountType}," ","percentOff"===e?.discountType?`${r.discountValue}% Off`:`Save ${nh(h.general.currencySymbol,e.storeCurrencyCode)}${th(r.discountValue)}`),a&&n.imageUrl&&t.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"0px"},className:"yt-volume-vertical-tier-selected-check"},t.createElement("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",borderRadius:"50%",backgroundColor:oe,color:ie,padding:"2px"}},t.createElement(ho,{style:{paddingBottom:"1px"},size:20,fontWeight:20})))),t.createElement(Pf,{style:{lineHeight:"normal",fontSize:P?"10px":"14px",color:"#666"},className:"yt-volume-vertical-details-subtitle"},n.subtitle?n.subtitle:t.createElement(t.Fragment,null))),V(n.tier)?t.createElement(Ff,{style:{textAlign:"left",marginTop:"4px",display:"flex",flexDirection:"row",flexWrap:"wrap",alignItems:"center"},className:"yt-volume-vertical-details-price","data-tier":n.tier,"data-original-price":r.original.toFixed(y?0:2),"data-discounted-price":r.discounted.toFixed(y?0:2),"data-savings":o.toFixed(y?0:2)},t.createElement(Of,{style:{marginLeft:"0",lineHeight:"normal",marginRight:"8px"},className:"yt-volume-vertical-details-price-discount"},nh(h.general.currencySymbol,e.storeCurrencyCode),th(r.discounted.toFixed(y?0:2))),o>0?t.createElement(Af,{style:{lineHeight:"normal"},className:"yt-volume-vertical-details-price-original"},nh(h.general.currencySymbol,e.storeCurrencyCode),th(r.original.toFixed(y?0:2))):""):t.createElement("div",{style:{textAlign:"center",color:"#999",fontSize:"14px",fontWeight:"500",padding:"4px 0",lineHeight:"normal"}},"Out of Stock")),a&&!n.imageUrl&&t.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"10px",bottom:"10px"},className:"yt-volume-vertical-tier-selected-check"},t.createElement("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",borderRadius:"50%",backgroundColor:oe,color:ie,padding:"2px"}},t.createElement(ho,{style:{paddingBottom:"1px"},size:20,fontWeight:20})))))})):t.createElement(t.Fragment,null,C.map(n=>{const r=Z(n.tier),o=r.original-r.discounted,a=!V(n.tier);return t.createElement(t.Fragment,{key:n.tier},n.badgeTitle&&t.createElement($f,{primaryTextColorCta:ie,primaryBackgroundColorCta:oe,style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-badge","data-tier":n.tier,"data-badge-title":n.badgeTitle},n.badgeTitle),t.createElement(Bf,{cornerRadiusType:e?.cornerRadiusType??"",key:n.tier,primaryBackgroundColorCta:oe??"",isSelected:E===n.tier,onClick:()=>S(n.tier),style:{borderRadius:ce,cursor:"pointer",backgroundColor:a?"#f5f5f5":"white",opacity:a?.6:1},className:"yt-volume-horizontal-tier-container "+(E===n.tier?"yt-volume-horizontal-tier-container-active":""),"data-tier":n.tier,"data-discount-value":r.discountValue,"data-discount-type":e?.discountType,"data-minimum-quantity":n.minimumQuantity,"data-original-price":r.original.toFixed(y?0:2),"data-discounted-price":r.discounted.toFixed(y?0:2)},t.createElement(zf,{cornerRadiusType:e?.cornerRadiusType??"",style:{borderRadius:ce,borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"},className:"yt-volume-horizontal-tier-header"},t.createElement(If,{className:"yt-volume-horizontal-tier-info"},t.createElement(Vf,{"data-active":E===n.tier,accentColor:oe,className:"yt-volume-horizontal-tier-radio-wrapper"},t.createElement(Wf,{name:"tier",checked:E===n.tier,onChange:()=>!a&&S(n.tier),disabled:a,className:"yt-volume-horizontal-tier-radio-hidden"}),t.createElement(Hf,{accentColor:oe,className:"yt-volume-horizontal-tier-radio-custom"})),t.createElement(Df,{className:"yt-volume-horizontal-tier-details"},t.createElement("div",{style:{display:"flex"},className:"yt-volume-horizontal-tier-title-container"},t.createElement(_f,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-title"},n.title?n.title:t.createElement(t.Fragment,null,"Buy ",n.minimumQuantity,", Get"," ",n.discountValue,"% Off")),o>0&&r?.discountValue&&"Enabled"===h.volumeBundle?.discountBadgeVisibility?t.createElement(Nf,{primaryBackgroundColorCta:oe,isSelected:E===n.tier,style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-save-badge","data-tier":n.tier,"data-discount-value":r.discountValue,"data-discount-type":e?.discountType}," ","percentOff"===e?.discountType?`${r.discountValue}% Off`:`Save ${nh(h.general.currencySymbol,e.storeCurrencyCode)}${th(r.discountValue)}`):""),t.createElement(Pf,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-subtitle"},n.subtitle?n.subtitle:t.createElement(t.Fragment,null)))),V(n.tier)?t.createElement(Ff,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-price","data-tier":n.tier,"data-original-price":r.original.toFixed(y?0:2),"data-discounted-price":r.discounted.toFixed(y?0:2),"data-savings":o.toFixed(0)},o>0?t.createElement(Af,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-original-price"},nh(h.general.currencySymbol,e.storeCurrencyCode),th(r.original.toFixed(y?0:2))):"",t.createElement(Of,{className:"yt-volume-horizontal-tier-discounted-price"},nh(h.general.currencySymbol,e.storeCurrencyCode),th(r.discounted.toFixed(y?0:2)))):t.createElement("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",lineHeight:"normal"}},t.createElement("span",{style:{color:"#999",fontSize:"14px",fontWeight:"500"}},"Out of Stock"))),E===n.tier&&t.createElement(Mf,{className:"yt-volume-horizontal-tier-product-grid",style:{padding:d.productDetails.variants.edges.length<=1?"0":"10px 15px",gap:d.productDetails.variants.edges.length<=1?"0":"10px"}},Array.from({length:n.minimumQuantity}).map((r,o)=>{const i=n.tier-1,l=(I[i]||[])[o]||d.productDetails.options?.map(e=>e.values[0])||[],c=d?.productDetails?.options.some(e=>e.values.length>1);return t.createElement("div",{key:o,style:{display:"flex",gap:"10px",alignItems:"center",position:"relative"},className:"yt-volume-horizontal-tier-product-item"},c&&t.createElement(qf,{src:rh(X(d,T,o,n.tier)),alt:d?.productDetails?.title||"Product",className:"yt-volume-horizontal-tier-product-image"}),"auto"===h?.volumeBundle?.variantSelectorType?t.createElement("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"}},d?.productDetails?.options?.map((r,s)=>{if(!c)return null;const p=O?.tier===n.tier&&O?.index===o&&O?.optionIndex===s,u=e?.variantOptions?.options?.find(e=>e.name===r.name);let m="";return"color"===u?.type&&(m=u?.values?.find(e=>e.name===l[s])?.value||""),t.createElement(Gf,{key:s,ref:e=>{L.current[o]||(L.current[o]=[]),L.current[o][s]=e},style:{zIndex:p?1e3:"auto",display:"flex"},isActive:p},t.createElement(Zf,{onClick:e=>{e.stopPropagation(),A(p?null:{tier:n.tier,index:o,optionIndex:s})},isActive:p,disabled:a},"color"===u?.type&&m&&t.createElement("div",{className:"yt-fixedBundle-product-card_color-swatch",style:{display:"inline-block",width:20,height:20,borderRadius:"50%",backgroundColor:m||"transparent",border:"1px solid #ddd"}}),l[s],t.createElement(lo,null)),p&&t.createElement(Xf,{style:{zIndex:1001}},r.values.map((e,r)=>{const c=[...l];c[s]=e;const p=!H(n.tier,o,l,s,e)||a;d.productDetails.variants.edges.find(({node:e})=>e.title===c.join(" / "));const m=t=>{if(t.preventDefault(),t.stopPropagation(),N(e=>{const t={...e},n=[...t[i]||[]];return n[o]=c,t[i]=n,t}),p){R({tier:E,index:o,optionIndex:s,value:e}),A(null);const t=c.join(" / "),r=d.productDetails.variants.edges.find(e=>e.node.title===t)?.node.id||T;return void U(n.tier,o,r)}const r=c.join(" / "),a=d.productDetails.variants.edges.find(e=>e.node.title===r)?.node.id||T;U(n.tier,o,a),A(null)},f=u?.values.find(t=>t.name===e);return"image"===u?.type&&f?.value?t.createElement(Uf,{key:e,onClick:m,style:{cursor:"pointer"}},t.createElement(Qf,{src:f.value,alt:e}),e):"color"===u?.type&&f?.value?t.createElement(Uf,{key:e,onClick:m,style:{cursor:"pointer"}},t.createElement(Yf,{style:{backgroundColor:f.value}}),e):t.createElement(Uf,{key:e,onClick:m,style:{cursor:"pointer"}},e)})))})):t.createElement(Rf,{style:{display:"flex",flexDirection:"column",gap:"5px"},className:"yt-volume-horizontal-tier-variant-selector"},d?.productDetails?.options.map((r,c)=>{if(!(r.values.length>1))return null;const s=e.variantOptions?.options?.find(e=>e.name===r.name)||null;return t.createElement("div",{key:r.name,style:{width:"100%",display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"},className:"yt-volume-horizontal-tier-variant-option"},t.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"},className:"yt-volume-horizontal-tier-variant-values"},r.values.map(e=>{const r=l[c]===e,p=!H(n.tier,o,l,c,e)||a,u=s?.values.find(t=>t.name===e),m=t=>{if(t.preventDefault(),t.stopPropagation(),p)return;const r=[...l];r[c]=e,N(e=>{const t={...e},n=[...t[i]||[]];return n[o]=r,t[i]=n,t});const a=r.join(" / "),s=d.productDetails.variants.edges.find(e=>e.node.title===a)?.node.id||T;U(n.tier,o,s)},f={opacity:p?.5:1,cursor:p?"not-allowed":"pointer"};return"color"===s?.type&&u?.value?t.createElement("button",{key:e,onClick:m,style:{...f,borderRadius:"50%",padding:"1px",backgroundColor:"white",border:r?`1px solid ${h.general?.ctaBackgroundColor||"#121212"}`:"1px solid transparent",lineHeight:"normal"},className:"yt-volume-horizontal-tier-variant-color-button",disabled:p},t.createElement("div",{style:{width:r?"24px":"20px",height:r?"24px":"20px",borderRadius:"50%",backgroundColor:u.value,lineHeight:"normal",boxShadow:"rgba(9, 30, 66, 0.25) 0px 4px 8px -2px, rgba(9, 30, 66, 0.08) 0px 0px 0px 2px"}},t.createElement("span",null))):"image"===s?.type&&u?.value?t.createElement("button",{key:e,onClick:m,style:{...f,border:r?`1px solid ${h.general?.ctaBackgroundColor||"#121212"}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:r?"#F7F7F7":"transparent",padding:"0px",width:r?"20px":"18px",height:r?"20px":"18px",overflow:"hidden"},className:"yt-volume-horizontal-tier-variant-image-button",disabled:p},t.createElement("img",{src:u.value,alt:e,style:{width:r?"26px":"24px",height:r?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}})):t.createElement(Lf,{key:e,isSelected:r,onClick:m,style:{...f,padding:"4px 8px",border:r?`1px solid ${h.general?.ctaBackgroundColor||"#121212"}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:r?"#F7F7F7":"transparent",color:"#707070",cursor:"pointer",fontSize:"12px",fontWeight:"600",lineHeight:"normal"},className:"yt-volume-horizontal-tier-variant-button-default",disabled:p},e)})))})))})),M&&M.tier===n.tier&&t.createElement("div",{style:{color:oe,textAlign:"center",fontSize:"14px",fontStyle:"normal",fontWeight:"500",lineHeight:"110%",background:`${oe}1A`,padding:"12px",borderBottomLeftRadius:ce,borderBottomRightRadius:ce}},"There aren’t enough items in our stock for select option, please select smaller bundle.")))})),e?.showCta&&(!h.volumeBundle?.addtoCartMethod||"shopify_atc_button"!==h.volumeBundle?.addtoCartMethod)&&!("devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain||"06cf02-81.myshopify.com"===window.ytBundleApp?.storeDomain)&&t.createElement("div",{style:{position:"relative"}},t.createElement(jf,{bgColor:q(E)?h.general?.ctaBackgroundColor:"#ccc",textColor:q(E)?h.general?.ctaTextColor:"#666",border:`1px solid ${q(E)?h.general?.ctaBorderColor||"#121212":"#999"}`,shadow:h.general.ctaShadowType,padding:h.general?.ctaPadding,width:h.general?.ctaWidth,hoverProperties:{customizeHoverState:!!q(E)&&h.general?.customizeHoverState,backgroundColor:h.general?.ctaHoverBackgroundColor,textColor:h.general?.ctaHoverTextColor},onClick:async()=>{if(q(E))try{_(!0);const e=C.find(e=>e.tier===E);if(!e)return;const t={},r=B[e.tier]||{};for(let n=0;n<e.minimumQuantity;n++){const e=r[n]||T;t[e]?t[e].quantity+=1:t[e]={quantity:1}}const o=Z(e.tier),a=Array.from({length:e.minimumQuantity},(e,t)=>r[t]||T);n&&await n(o.original,a)}catch(e){console.error("VolumeBundle handleAddToCart error:",e)}finally{_(!1)}else console.error("Selected tier is out of stock")},borderRadius:h.general.ctaBorderRadius??"",disabled:D||!q(E),className:"yt-volume-add-to-cart-button"},q(E)?t.createElement(t.Fragment,null,D?t.createElement(da,{color:"white",loading:D,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):t.createElement("div",{style:{display:"flex",flexDirection:"row",gap:"8px",justifyContent:"center",alignItems:"center"}},t.createElement("span",null,h.volumeBundle?.ctaTitle??"Add Bundle to Cart")," ","•",t.createElement("div",{className:"yt-volume-add-to-cart-button-info"},(()=>{const n=Z(E);return t.createElement(t.Fragment,null,nh(h.general.currencySymbol,e.storeCurrencyCode),th(n.discounted.toFixed(y?0:2))," ",n?.original!==n.discounted&&t.createElement("span",{style:{lineHeight:"normal",textDecoration:"line-through",fontWeight:"550"}},nh(h.general.currencySymbol,e.storeCurrencyCode),th(n?.original.toFixed(y?0:2))," "))})()))):t.createElement(t.Fragment,null,"Out of Stock"))))}const eg=h.div`
|
|
3897
3897
|
container-type: inline-size;
|
|
3898
3898
|
border-radius: ${e=>e.borderRadius?e.borderRadius:"8px"};
|
|
3899
3899
|
max-width: 800px;
|
|
@@ -5090,4 +5090,4 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
|
|
|
5090
5090
|
}
|
|
5091
5091
|
`,jx=h.span`
|
|
5092
5092
|
font-size: 12px;
|
|
5093
|
-
`,Vx=({productsWithIndices:e,isOpen:n,onClose:r,cta:o,variantOptions:a,onVariantChange:s,handleAddToCart:d,primaryProductId:p,variantId:u})=>{const m=i(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?1/0:0:1/0:0},[]),[f,g]=c({}),[x,h]=c({});l(()=>{const t={},n={};e?.forEach(({product:e,index:r})=>{let o,a=[];if(e.productId===p&&u){const t=e?.productDetails?.variants?.edges.find(e=>e?.node?.id?.includes(u))?.node;t&&m(e.productDetails,t.id)>0&&(a=t.title.split(" / "),o=t)}if(!a.length){const t=e.productDetails.variants.edges.find(t=>m(e.productDetails,t?.node?.id)>0)?.node||e?.productDetails?.variants?.edges?.[0]?.node;t?(a=t.title.split(" / "),o=t):a=e?.productDetails?.options?.map(e=>e.values[0]??"")}t[r]=a,o&&(n[r]={node:o},s(r,o.id))}),g(t),h(n)},[e,p,u,s,m]),l(()=>{if(!p||!u)return;const t=e?.find(({product:e})=>e?.productId===p);if(!t)return;const{product:n,index:r}=t,o=n?.productDetails?.variants?.edges?.find(e=>e.node.id.includes(u))?.node;if(o&&m(n.productDetails,o.id)>0){const e=o.title.split(" / ");g(t=>({...t,[r]:e})),h(e=>({...e,[r]:{node:o}})),s(r,o.id)}},[u,p,e,s,m]);const y=(e,t,n,r)=>{const o=[...f[e]||[]];o[t]=n;const a=o.join(" / "),i=r.productDetails.variants.edges.find(e=>e.node.title===a)?.node;return!!i&&m(r.productDetails,i.id)>0},b=(t,n,r)=>{const{product:o}=e?.find(e=>e.index===t)||{product:{productDetails:{variants:{edges:[]}}}};if(!o?.productDetails)return;if(!y(t,r,n,o))return;const a={...f};a[t][r]=n,g(a);const i=o?.productDetails?.variants?.edges?.find(e=>e.node.title===a[t].join(" / "))?.node;i&&(s(t,i.id),h(e=>({...e,[t]:{node:i}})))};if(!n)return null;const w=t.createElement($x,{className:"yt-fixedBundle-variant-modal_overlay",onClick:r},t.createElement(Bx,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},t.createElement(zx,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:o.backgroundColor,color:o.textColor}},"Select Options"),e?.map(({product:n,index:r},o)=>t.createElement(t.Fragment,null,t.createElement(Nx,{className:"yt-fixedBundle-variant-modal_product-block"},t.createElement(Dx,{className:"yt-fixedBundle-variant-modal_thumbnail",src:x[r]?.node?.image?.url||n.productDetails.featuredMedia?.preview?.image?.url,alt:n.productDetails.title}),t.createElement(_x,{className:"yt-fixedBundle-variant-modal_product-info"},t.createElement(Px,{className:"yt-fixedBundle-variant-modal_product-name"},n.productDetails.title,n.productDetails.variants.edges.length>1&&t.createElement(Ox,{className:"yt-fixedBundle-variant-modal_selected-value"},f[r]?.join(" / "))),n.productDetails.options.map((e,o)=>{const i=a&&a?.options?.find(t=>t.name===e.name);return e.values.length<=1?t.createElement(t.Fragment,null):i&&"color"===i?.type?t.createElement(Ax,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(jx,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map((e,a)=>{const l=!y(r,o,e,n);return t.createElement(t.Fragment,null,i.values.find(t=>t.name===e)?.value?t.createElement(Mx,{className:"yt-fixedBundle-variant-modal_color-swatch",key:a,color:i.values.find(t=>t.name===e)?.value||e,selected:f[r]?.[o]==e,disabled:l,onClick:()=>{b(r,e,o)}},t.createElement("span",null)):t.createElement(Rx,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:f[r]?.[o]==e,disabled:l,onClick:()=>{b(r,e,o)}},e))})):i&&"image"===i?.type?t.createElement(Ax,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(jx,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map((e,a)=>{const l=!y(r,o,e,n);return t.createElement(t.Fragment,null,i?.values.find(t=>t.name===e)?.value?t.createElement(Lx,{className:"yt-fixedBundle-variant-modal_image-swatch",key:a,selected:f[r]?.[o]==e,disabled:l,onClick:()=>{b(r,e,o)},src:i.values.find(t=>t.name===e)?.value},t.createElement("span",null)):t.createElement(Rx,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:f[r]?.[o]==e,disabled:l,onClick:()=>{b(r,e,o)}},e))})):t.createElement(Ax,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(jx,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map((e,a)=>{const i=!y(r,o,e,n);return t.createElement(Rx,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:f[r]?.[o]==e,disabled:i,onClick:()=>{b(r,e,o)}},e)}))}))),o<e.length-1&&t.createElement(Fx,{className:"yt-fixedBundle-variant-modal_divider"}))),t.createElement(Ix,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:o.backgroundColor,color:o.textColor},onClick:d},"Add bundle to cart")));return v.createPortal(w,document.body)},Wx=({options:e,selectedValue:n,onChange:r,type:a="text"})=>{const[i,s]=c(!1),d=o(null);l(()=>{const e=e=>{d.current&&!d.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const p=e=>"color"===a?t.createElement(yx,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:e.value},t.createElement("span",null)):"image"===a?t.createElement(bx,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:e.value||"/placeholder.svg",alt:e.name},t.createElement("span",null)):null;return t.createElement(px,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:d},t.createElement(ux,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>s(!i)},t.createElement(mx,{className:"yt-fixedBundle-variant-dropdown-horizontal_content"},n&&("color"===a||"image"===a)&&p(n),t.createElement("span",{className:"yt-fixedBundle-variant-dropdown-horizontal_selected-text"},n&&n.name)),t.createElement(fx,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:i})),i&&t.createElement(gx,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},e?.map(e=>t.createElement(xx,{className:"yt-fixedBundle-variant-selector_dropdown-item "+(n?.name===e.name?"yt-fixedBundle-variant-selector_dropdown-item--selected":""),key:e.name,$isSelected:n?.name===e.name,onClick:()=>{r(e),s(!1)}},("color"===a||"image"===a)&&p(e),t.createElement(hx,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},e.name)))))},Hx=({product:e,variantOptions:n,selectedVariants:r,onVariantChange:o,variantId:a,primaryProductId:i,variantType:s="dropdown"})=>{const[d,p]=c(r||[]);l(()=>{if(a&&e.variants.edges.some(e=>e.node.id.includes(a))){const t=e.variants.edges.find(e=>e.node.id.includes(a))?.node;if(t){const e=t.title.split(" / ");p(e)}}},[a,e]);const u=e=>{if(!n?.options)return"text";const t=n.options.find(t=>t.name===e);return t?.type||"text"},m=(e,t)=>{if(!n?.options)return e.values.map(e=>({name:e,value:e}));const r=n.options.find(t=>t.name===e.name);return e.values.map(e=>{const t=r?.values?.find(t=>t.name===e);return{name:e,value:t?.value||e}})},f=(e,t)=>{const n=d[t];if(!n)return null;return m(e).find(e=>e.name===n)||null};return t.createElement(vx,{className:"yt-fixedBundle-variant-selector-horizontal_container"},e.options.map((n,r)=>t.createElement(wx,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:n.name,$isFirst:0===r},n?.values?.length>1&&t.createElement(Wx,{options:m(n),selectedValue:f(n,r),onChange:t=>{console.log(t),((t,n)=>{const r=[...d];r[t]=n.name,p(r);const a=e.variants.edges.find(n=>n.node.title===(e.options?.length>0?r.join(" / "):r[t]))?.node.id;o(a||"")})(r,t)},type:u(n.name)}))))},qx=({product:e,selectedVariantId:n,isChecked:r,canCustomize:o,styles:a,onVariantChange:s,onCheckChange:d,isMobile:p,isHorizontal:u,index:m,variantOptions:f,productsLength:g,handleOpenModal:x,storeCurrencyCode:h,primaryProductId:y,variantId:b})=>{const v=i(()=>t=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?1/0:0:1/0:0},[e]),[w,C]=c(e?.variants?.edges.find(e=>v(e?.node?.id)>0)?.node||e?.variants?.edges?.[0]?.node),[k]=c(e?.options?.map(e=>e?.values?.[0])||[]),E=e?.id===y;l(()=>{if(b&&e.id===y){const t=e?.variants?.edges?.find(e=>e?.node?.id?.includes(b))?.node;t&&v(t.id)>0&&(C(t),s(t.id))}else{const t=e?.variants?.edges?.find(e=>v(e?.node?.id)>0)?.node||e?.variants?.edges?.[0]?.node;C(t)}},[e,y,n,b,s,v]);const S="undefined"!=typeof window&&"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain||"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,T=w?.image?.url||e.featuredMedia?.preview?.image?.url;return t.createElement(t.Fragment,null,u?t.createElement("div",{className:""+(e.id===y?"yt-fixedBundle-product-card--horizontal-primary":"yt-fixedBundle-product-card--horizontal-associated"),style:{display:"flex",alignItems:"center",gap:"10px",backgroundColor:a.fixedBundle?.cardBackgroundColor}},o&&t.createElement(Sx,{className:"yt-fixedBundle-product-card_checkbox-wrapper--horizontal"},t.createElement(kx,{className:"yt-fixedBundle-product-card_checkbox-hidden",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}-${m}`,defaultChecked:r,onChange:e=>d(e.target.checked),disabled:E}),t.createElement(Ex,{className:"yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${e.id}-${m}`,isChecked:r,borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.general?.ctaBackgroundColor},t.createElement(ct,null))),t.createElement(Ag,{className:"yt-fixedBundle-product-card-horizontal_item",style:{borderRadius:a.fixedBundle?.borderRadius,border:`1px solid ${a.fixedBundle?.borderColor}80`,backgroundColor:a.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`8px 8px 8px -6px ${a.fixedBundle.borderColor}`,"no-spread":`4px 4px 0px -1px ${a.fixedBundle.borderColor}80`}[a.fixedBundle.shadowType]||"none"},canCustomize:o},"undefined"!=typeof window&&"devansh-test123.myshopify.com"!==window.ytBundleApp?.storeDomain&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&t.createElement(Mg,{className:"yt-fixedBundle-product-card-horizontal_image",src:rh(T),alt:e.title,style:{borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,aspectRatio:a.general.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),t.createElement(Rg,{className:"yt-fixedBundle-product-card-horizontal_details"},t.createElement(Lg,{className:"yt-fixedBundle-product-card-horizontal_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement(jg,{className:"yt-fixedBundle-product-card-horizontal_price-section"},t.createElement(Vg,{className:"yt-fixedBundle-product-card-horizontal_price--new"},nh(a.general.currencySymbol,h)," ",th(w?.price)),a.fixedBundle.compareAtPriceVisibility&&w?.compareAtPrice&&parseFloat(w.compareAtPrice)>parseFloat(w?.price)&&t.createElement(Wg,{className:"yt-fixedBundle-product-card-horizontal_price--old"},nh(a.general.currencySymbol,h),th(w?.compareAtPrice))),t.createElement(Hx,{product:e,variantOptions:f,selectedVariants:k,onVariantChange:t=>{const n=e?.variants?.edges?.find(e=>e.node.id===t)?.node;n&&v(t)>0&&s(t)},variantId:b,primaryProductId:y})))):t.createElement(t.Fragment,null,t.createElement(Kg,{className:""+(e.id===y?"yt-fixedBundle-product-card--vertical-primary":"yt-fixedBundle-product-card--vertical-associated"),productsLength:g,style:{borderRadius:a.fixedBundle?.borderRadius,border:`1px solid ${a.fixedBundle?.borderColor}50`,backgroundColor:a.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`0 4px 10px -6px ${a.fixedBundle.borderColor}50`,"no-spread":`4px 4px 0px -1px ${a.fixedBundle.borderColor}50`}[a.fixedBundle.shadowType]||"none",...o&&{position:"relative"},...S&&{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",minWidth:"max-content",paddingLeft:"2px"}},borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.fixedBundle?.cardBackgroundColor},o&&t.createElement(Tx,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:S},t.createElement(kx,{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}-${m}`,defaultChecked:r,onChange:e=>d(e.target.checked),disabled:E}),t.createElement(Ex,{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${e.id}-${m}`,isChecked:r,borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.general?.ctaBackgroundColor},t.createElement(ct,{size:10}))),"undefined"!=typeof window&&"devansh-test123.myshopify.com"!==window.ytBundleApp?.storeDomain&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&t.createElement(Jg,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:a.general.imageAspectRatio,height:"fit-content"}},t.createElement(ex,{className:"yt-fixedBundle-product-card_image--vertical",src:rh(T),style:{aspectRatio:a.general.imageAspectRatio},alt:e.title}),e.variants.edges.length>1&&t.createElement(tx,{className:"yt-fixedBundle-product-card_badge-container"},t.createElement(nx,{className:"yt-fixedBundle-product-card_circle-button"},t.createElement("span",null)),t.createElement(rx,{className:"yt-fixedBundle-product-card_circle-button-two"},t.createElement("span",null)),t.createElement(ox,{className:"yt-fixedBundle-product-card_count-badge"},e.variants.edges.length,"+"))),t.createElement(ax,{className:"yt-fixedBundle-product-card-vertical_info"},t.createElement(ix,{className:"yt-fixedBundle-product-card-vertical_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement(cx,{className:"yt-fixedBundle-product-card-vertical_price-line"},t.createElement(lx,{className:"yt-fixedBundle-product-card-vertical_price--new"},nh(a.general.currencySymbol,h),th(w?.price)),a.fixedBundle.compareAtPriceVisibility&&w?.compareAtPrice&&parseFloat(w.compareAtPrice)>parseFloat(w?.price)&&t.createElement(Wg,{className:"yt-fixedBundle-product-card-vertical_price--old"},nh(a.general.currencySymbol,h),th(w.compareAtPrice))))),(g<=3||!p)&&m<g-1&&t.createElement(sx,{className:"yt-fixedBundle-plus-wrapper"}," ",t.createElement(dx,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},Ux=({bundle:e,addToCartFunction:n})=>{const[r,o]=c(!1),[s,d]=c(window.innerWidth<786),[p,u]=c(null),[m,f]=c(!1),g="undefined"!=typeof window?window.location.href:null,x=e?.products?.find(e=>e.productDetails?.handle===g?.split("/").pop()?.split("?")[0]),h=x?.productId,y=i(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?1/0:0:1/0:0},[]),[b,v]=c(Object.fromEntries(e?.products?.map((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find(t=>y(e.productDetails,t?.node?.id)>0)?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id]))),w="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain),C=e?.showIndividualProductSelector||!0,[k,E]=c(new Set(e.products.reduce((e,t,n)=>(w&&t?.productId!==h&&!C||e.push(n),e),[])));l(()=>{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)}},[]),l(()=>{p&&h&&v(t=>{const n={...t};return e?.products?.forEach((e,t)=>{e.productId===h&&(n[t.toString()]=p)}),n})},[p,h,e?.products]),l(()=>{const e=()=>{d(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const S=a((e,t)=>{v(n=>({...n,[e.toString()]:t}))},[]),T=(t,n)=>{const r=e.products[n].productId;w&&C&&r===h||E(e=>{const r=new Set(e);return t?r.add(n):r.delete(n),r})},$=i(()=>(e,t)=>y(e.productDetails,t)>0,[y]),B=i(()=>e.products.some((e,t)=>k.has(t)&&e.productDetails.variants.edges.length>1),[e.products,k]),{originalPrice:z,dealPrice:I,offerValue:N}=i(()=>{const{price:t,compareAtPrice:n}=e.products.reduce((e,t,n)=>{if(!k.has(n))return e;const r=b[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}),r=Math.max(t,n);let o=Math.min(t,n);k.size===e.products.length&&(e?.percentageOff?o=t*(1-e.percentageOff/100):e?.dealAmount?o=e.dealAmount:e?.amountOff&&(o=t-e.amountOff));const a=n-o;return{originalPrice:r.toFixed(2),dealPrice:o.toFixed(2),offerValue:a.toFixed(2)}},[e.products,b,k,e.percentageOff,e.dealAmount,e.amountOff]),D=i(()=>e.products.map((e,t)=>({product:e,index:t})).filter(({index:e})=>k.has(e)),[e.products,k]),_=D.every(({product:e,index:t})=>$(e,b[t.toString()])),P=async e=>{if(_){e.preventDefault(),e.stopPropagation(),o(!0),f(!1);try{const e=Object.entries(b).map(([e,t])=>{const n=parseInt(e);return isNaN(n)||!k.has(n)?null:t}).filter(Boolean);n&&await n(Number(z),e)}catch(e){console.error("Error adding to cart:",e)}o(!1)}};if(!n)return t.createElement(t.Fragment,null);const F=e.customizations,O=F.fixedBundle?.cardLayoutStyle||"auto",A="horizontal"===O||"auto"===O&&s,M="bundles"==e.appName?e.pageHeader?.title:e?.title,R="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return t.createElement(_g,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:F.fixedBundle.sectionBackgroundColor,..."transparent"!==F.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},M&&t.createElement(Pg,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:F.fixedBundle?.titleBackgroundColor||"none",color:F.fixedBundle?.titleTextColor||"black",textAlign:F.fixedBundle.infoAlignment??"center",fontSize:F.fixedBundle?.titleFontSize,..."transparent"!==F.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===F.fixedBundle.infoAlignment&&"transparent"!==F.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===F.fixedBundle.infoAlignment&&"transparent"!==F.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===F.fixedBundle.infoAlignment&&"transparent"===F.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},M),R&&t.createElement(Fg,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:F.fixedBundle?.subtitleFontSize,textAlign:F.fixedBundle.infoAlignment??"center",..."left"===F.fixedBundle.infoAlignment&&"transparent"!==F.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===F.fixedBundle.infoAlignment&&"transparent"!==F.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===F.fixedBundle.infoAlignment&&"transparent"===F.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},R),A?t.createElement(Og,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},e?.products?.map((n,r)=>t.createElement(t.Fragment,{key:`${n.productId}-${r}`},t.createElement(qx,{isChecked:k.has(r),product:n.productDetails,selectedVariantId:b[r.toString()]||"",canCustomize:e?.canCustomizeFixedBundle||!1,styles:F,onVariantChange:e=>S(r,e),onCheckChange:e=>{T(e,r)},isMobile:s,index:r,isHorizontal:A,variantOptions:e.variantOptions,productsLength:e.products.length,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:h,variantId:p||void 0})))):t.createElement(Zg,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},t.createElement(Xg,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===F.fixedBundle.infoAlignment?"flex-start":"right"===F.fixedBundle.infoAlignment?"flex-end":"center"}},e?.products?.map((n,r)=>t.createElement(qx,{key:`${n.productId}-${r}`,isChecked:k.has(r),product:n.productDetails,selectedVariantId:b[r.toString()]||"",canCustomize:e?.canCustomizeFixedBundle||!1,styles:F,onVariantChange:e=>S(r,e),onCheckChange:e=>T(e,r),isMobile:s,index:r,isHorizontal:A,productsLength:e.products.length,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:h,variantId:p||void 0})),B&&t.createElement(Vx,{productsWithIndices:D,isOpen:m,onClose:()=>f(!1),variantOptions:e.variantOptions,cta:{textColor:F.general.ctaTextColor,backgroundColor:F.general.ctaBackgroundColor},onVariantChange:S,handleAddToCart:P,primaryProductId:h,variantId:p||void 0}))),t.createElement(Hg,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===F.fixedBundle.infoAlignment?"flex-start":"right"===F.fixedBundle.infoAlignment?"flex-end":"center"}},Number(z)>0&&Number(N)>0&&F.fixedBundle.compareAtPriceVisibility&&t.createElement(qg,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",t.createElement(Qg,{className:"yt-fixedBundle-summary_price"},nh(F.general.currencySymbol,e?.storeCurrencyCode),th(z))),0!==k.size&&t.createElement(Ug,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",t.createElement(Qg,{className:"yt-fixedBundle-summary_price"},nh(F.general.currencySymbol,e?.storeCurrencyCode),th(I))," ",Number(N)>0&&t.createElement(Yg,{className:"yt-fixedBundle-summary_save-tag"},"Save:"," ",nh(F.general.currencySymbol,e?.storeCurrencyCode),th(N)))),t.createElement(Gg,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),A||!B?P(e):f(!0)},disabled:k.size<1||r||!_,style:{backgroundColor:F.general?.ctaBackgroundColor||"#121212",color:F.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${F.general?.ctaBackgroundColor||"#121212"}`,boxShadow:F.general.ctaShadowType,paddingTop:F.general?.ctaPadding,paddingBottom:F.general?.ctaPadding,borderRadius:F.general.ctaBorderRadius,width:F.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{F.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=F.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=F.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{F.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=F.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=F.general?.ctaTextColor||"#FFFFFF")}},r?t.createElement(da,{color:"white",loading:r,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):_?t.createElement(t.Fragment,null,F.fixedBundle?.ctaTitle??"Add Bundle to cart"):t.createElement(t.Fragment,null,"Out of Stock")))},Qx=()=>t.createElement(t.Fragment,null,t.createElement("style",null,"@keyframes spin { to { transform: rotate(360deg); } }"),t.createElement("div",{className:"yt-collection-bundle-loader-spinner",style:{width:"14px",height:"14px",border:"2px solid #f3f3f3",borderTop:"2px solid #007bff",borderRadius:"50%",animation:"spin 1s linear infinite",display:"block"}})),Yx=({product:e,tierIdx:n,isOpen:r,onClose:o,onAddToBundle:a,canAdd:i,isSelected:s,customizations:d,isMobile:p})=>{const[u,m]=c(0),[f,g]=c(e.variants[0].id.toString()),x=e.variants.find(e=>e.id.toString()===f)||e.variants[0],h=e.images.filter(Boolean);if(l(()=>(r&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=""}),[r]),l(()=>{if(x&&x?.featured_image?.src){const e=document.querySelector(".yt-collection-bundle-modal-image");e?.setAttribute("src",x?.featured_image?.src)}},[x]),!r)return null;const y=t.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:o},t.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()},t.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:o,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"}},t.createElement(ft,{size:22})),t.createElement("div",{className:"yt-collection-bundle-modal-image-container",style:{flex:1,position:"relative",margin:"20px 0 20px 20px",borderRadius:d?.borderRadius||"12px"}},h.length>0&&t.createElement("img",{className:"yt-collection-bundle-modal-image",src:rh(h[u]||e.images[0]),alt:e.title,style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:d?.borderRadius||"12px"}}),h.length>1&&t.createElement("div",{className:"yt-collection-bundle-modal-image-dots",style:{position:"absolute",bottom:16,left:"50%",transform:"translateX(-50%)",display:"flex",gap:8,background:"rgba(0,0,0,0.4)",padding:"6px 12px",borderRadius:20}},h.map((e,n)=>t.createElement("div",{key:n,className:"yt-collection-bundle-modal-image-dot",onClick:()=>m(n),style:{width:10,height:10,borderRadius:"50%",background:n===u?"#fff":"#fff8",cursor:"pointer",display:"block"}})))),t.createElement("div",{className:"yt-collection-bundle-modal-content",style:{flex:1,padding:"30px",overflowY:"auto",display:"flex",flexDirection:"column",scrollbarWidth:"none"}},t.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"6px 0",fontSize:24,fontWeight:600,lineHeight:"normal"}},e.title),e.variants.length>1&&t.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative"}},t.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee",lineHeight:"normal"}},e?.options?.join(" & "),":"," ",t.createElement("strong",null,x.title)),t.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:f,onChange:e=>g(e.target.value),style:{position:"absolute",inset:0,opacity:0,cursor:"pointer",lineHeight:"normal"}},e.variants.map(e=>t.createElement("option",{key:e.id,value:e.id,disabled:!e.available},e.title," ",!e.available&&"(Out of stock)")))),t.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0",lineHeight:"normal"}},"₹",(x.price/100).toFixed(0),x.compare_at_price&&x.compare_at_price>x.price&&t.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999",lineHeight:"normal"}},"₹",(x.compare_at_price/100).toFixed(0))),t.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"white"}},t.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!i?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>a(e,n),disabled:!i||!x.available,style:{width:"100%",padding:"12px",fontSize:17,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:x.available?s||!i?"#28a745":d?.atcBg||"#007bff":"rgb(204, 204, 204)",color:d?.atcText||"#fff",cursor:i&&x.available?"pointer":"not-allowed",textAlign:"center",lineHeight:"normal"}},s?"Added to Box":x.available?"Add to Box":"Out of Stock")),e.description&&t.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:e.description},style:{lineHeight:"normal",color:"#444",marginTop:"10px"}})))),b=t.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:o},t.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()},t.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:o,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"}},t.createElement(ft,{size:22})),t.createElement("div",{className:"yt-collection-bundle-modal-scroll-container",style:{flex:1,overflowY:"auto",paddingBottom:100}},h.length>0&&t.createElement("div",{className:"yt-collection-bundle-modal-image-wrapper",style:{position:"relative"}},t.createElement("img",{className:"yt-collection-bundle-modal-image",src:x.featured_image?.src||h[u]||e.images[0],alt:e.title,style:{width:"100%",display:"block",maxHeight:"50vh",objectFit:"cover",objectPosition:"center"}}),h.length>1&&t.createElement("div",{className:"yt-collection-bundle-modal-image-dots",style:{position:"absolute",bottom:16,left:"50%",transform:"translateX(-50%)",display:"flex",gap:8,background:"rgba(0,0,0,0.4)",padding:"6px 12px",borderRadius:20}},h.map((e,n)=>t.createElement("div",{key:n,className:"yt-collection-bundle-modal-image-dot",onClick:()=>m(n),style:{width:10,height:10,borderRadius:"50%",background:n===u?"#fff":"#fff8",cursor:"pointer"}})))),t.createElement("div",{className:"yt-collection-bundle-modal-content",style:{padding:"20px"}},t.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"0 0 12px",fontSize:22,fontWeight:600}},e.title),e.variants.length>1&&t.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative",marginBottom:20}},t.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee"}},"Variant: ",t.createElement("strong",null,x.title)),t.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:f,onChange:e=>g(e.target.value),style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}},e.variants.map(e=>t.createElement("option",{key:e.id,value:e.id,disabled:!e.available},e.title," ",!e.available&&"(Out of stock)")))),t.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0"}},"₹",(x.price/100).toFixed(0),x.compare_at_price&&x.compare_at_price>x.price&&t.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999"}},"₹",(x.compare_at_price/100).toFixed(0))),e.description&&t.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:e.description},style:{lineHeight:1.7,color:"#444"}}))),t.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)"}},t.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!i?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>a(e,n),disabled:!i||!x.available,style:{width:"100%",padding:"10px",fontSize:14,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:!s&&i&&x.available?d?.atcBg||"#007bff":"#28a745",color:d?.atcText||"#fff",cursor:i&&x.available?"pointer":"not-allowed"}},s?"Added to Box":x.available?"Add to Box":"Out of Stock"))));return v.createPortal(p?b:y,document.body)},Gx=({title:e,uploadState:n,onUpload:r,onRemove:o,onRetry:a})=>{const i="object"==typeof n&&n?.loading,l="object"==typeof n&&n?.error,c="object"==typeof n&&n?.url;return t.createElement("div",{className:"yt-collection-bundle-upload-field",style:{padding:"20px",border:"2px dashed #ccc",borderRadius:"8px",textAlign:"center",background:"#fafafa"}},t.createElement("div",{className:"yt-collection-bundle-upload-title",style:{fontWeight:500,color:"#333",marginBottom:"4px"}},e),i&&t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-collection-bundle-upload-loading",style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",color:"#007bff",fontSize:"13px",margin:"12px 0"}},t.createElement(Qx,null)," Uploading ",n?.name,"...")),l&&t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-collection-bundle-upload-error",style:{color:"#dc3545",fontSize:"13px",margin:"8px 0"}},"Upload failed. Try again."),t.createElement("button",{type:"button",className:"yt-collection-bundle-upload-retry-btn",onClick:a,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Retry Upload")),c&&!i&&!l&&t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-collection-bundle-upload-image-container",style:{margin:"12px 0"}},t.createElement("img",{className:"yt-collection-bundle-upload-image",src:n.url,alt:"Uploaded",style:{maxWidth:"100%",maxHeight:"150px",borderRadius:"6px"}})),t.createElement("div",{className:"yt-collection-bundle-upload-filename",style:{fontSize:"12px",color:"#28a745",marginBottom:"8px"}},n.name),t.createElement("button",{type:"button",className:"yt-collection-bundle-upload-remove-btn",onClick:o,style:{background:"#dc3545",color:"white",border:"none",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",cursor:"pointer"}},"Remove")),!n&&t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-collection-bundle-upload-hint",style:{color:"#888",fontSize:"12px",marginBottom:"12px"}},"jpeg/png (max 5MB)"),t.createElement("button",{type:"button",className:"yt-collection-bundle-upload-btn",onClick:r,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Upload")))},Zx=({config:e,bundleAddToCartLoading:n,addCustomBundleToCart:r})=>{const[i,s]=c(1),[d,p]=c([]),[u,m]=c(null),[f,g]=c({}),[x,h]=c(window.innerWidth<640),[y,b]=c({}),v=o(new Map),[w,C]=c(!1),k=o(null),E=o(new Map),[S,T]=c(160),$=x?8:20,{customizations:B}=e,z=e.config.builderTiers.collectionTier.sort((e,t)=>e.tier-t.tier),I=!!e.config.form,N=z.length+(I?1:0),D=B.hideSelectedProducts,_=B.allowMultipleQty,P=B.hideOutOfStockProducts,F=e=>z[e-1]?.products||[],O=a(e=>{const t=F(e),n=P?t.filter(e=>e.available).length:t.length;b(t=>{const r=t[e]||0,o=Math.min(r+8,n);return o<=r?t:{...t,[e]:o}})},[8,P]);l(()=>(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===i&&O(e)}},{root:null,threshold:0,rootMargin:"100px 0px"}),()=>{k.current?.disconnect()}),[O,i]),l(()=>{if(I&&i===N)return;const e=i,t=F(e);if(0===t.length)return;const n=P?t.filter(e=>e.available).length:t.length;if(0===(y[e]||0)){const t=Math.min($,n);b(n=>({...n,[e]:t}))}},[i,$,P,y]),l(()=>{const e=document.querySelector(".box-loader-scene");e&&e.setAttribute("style","display: none;");const t=()=>h(window.innerWidth<640);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const A=a(e=>{T(e+10)},[]),M=d.reduce((e,t)=>e+t.quantity,0),R=d.reduce((e,t)=>e+t.price*t.quantity,0)/100,L=d.reduce((e,t)=>{const n=z.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)/100,j=(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())},V=(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());p(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=q[t],c=W(t);return c!==1/0&&l>=c?n:[...n,{productId:e.id.toString(),variantId:r,price:o,quantity:1,tierIndex:t}]})},W=e=>{const t=z[e];return t.maximumQuantity>0?t.maximumQuantity:1/0},H=(e,t)=>{const n=W(t);if(n===1/0)return!0;const r=q[t],o=d.some(n=>n.productId===e.id.toString()&&n.tierIndex===t);return!!o||r<n},q=z.map((e,t)=>d.filter(e=>e.tierIndex===t).reduce((e,t)=>e+t.quantity,0)),U=(e,t,n)=>{const r=W(n);if(r===1/0)return!0;return q[n]<r},Q=e=>{if(!v.current.has(e)){const t=document.createElement("input");t.type="file",t.accept="image/jpeg,image/png",t.style.display="none",t.onchange=async t=>{const n=t.target.files?.[0];if(n){if(n.size>5242880)return alert("Max 5MB");if(!n.type.match(/^image\/(jpeg|png)$/i))return alert("JPEG/PNG only");g(t=>({...t,[e]:{loading:!0,name:n.name}}));try{const t=await(async e=>{const t=new FormData;t.append("file",e),C(!0);try{const e=window?.Shopify?.shop||"falah-devstore.myshopify.com",n=window?.Shopify?.shop?"https://products.yourtoken.io":"http://localhost:8000",r=await fetch(`${n}/shopify/upload?shop=${e}`,{method:"POST",headers:{"x-yourtoken-app-name":"bundles"},body:t});if(!r.ok)throw new Error("Upload failed");return(await r.json()).url}catch(e){throw C(!1),alert("Upload failed. Try again."),e}finally{C(!1)}})(n);g(r=>({...r,[e]:{url:t,name:n.name}}))}catch{g(t=>({...t,[e]:{error:!0,name:n.name}}))}}},document.body.appendChild(t),v.current.set(e,t)}return v.current.get(e)},Y=I&&i===N,G=(Y?null:z[i-1])?W(i-1):0,Z=z.map((e,t)=>{const n=d.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},[]);return{tier:e,items:n,count:q[t]}});return t.createElement("div",{className:"yt-collection-bundle-builder",style:{margin:"0 auto",maxWidth:"1600px"}},B.headerImage&&!B.headerImage.includes("Liquid error")&&t.createElement("img",{className:"yt-collection-bundle-header-img",src:B.headerImage,alt:"Collection Bundle header",style:{width:"100%"}}),B.showTierSteps&&t.createElement("div",{style:{paddingTop:B.headerImage&&!B.headerImage.includes("Liquid error")?"20px":"0"}},t.createElement(Xx,{totalSteps:N,isFormStep:Y,currentStep:i,getStepTitle:e=>I&&e===N?"Customize Gift Details":z[e-1]?.title||`Step ${e}`,isMobile:x,formTitle:e?.config?.form?.title,hasForm:I,onStepClick:e=>{if(e>1&&!d.length)return alert("Add at least one product first");s(e),window.scrollTo(0,0)}})),Array.from({length:N},(e,t)=>t+1).map(n=>{const r=I&&n===N,o=r?[]:F(n),a=P?o.filter(e=>e.available):o,l=n-1,c=a.slice(0,y[n]||0);return t.createElement("div",{key:n,className:"yt-collection-bundle-step-content "+(i===n?"yt-collection-bundle-step-content-active":""),style:{display:i===n?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},r&&e.config.form?t.createElement("div",{className:"yt-collection-bundle-customize-form",style:{maxWidth:"80%",margin:"0 auto",padding:"1rem",marginBottom:`${S}px`}},e?.config?.form?.sections?.map((e,n)=>t.createElement("div",{key:`sec_${n}`,className:"yt-collection-bundle-form-group",style:{marginBottom:"32px"}},t.createElement("label",{className:"yt-collection-bundle-label",style:{display:"block",fontWeight:600,marginBottom:"12px",color:"#333",fontSize:"16px",lineHeight:"normal"}},e?.title),"text"===e.type&&t.createElement("div",{className:"yt-collection-bundle-form-fields",style:{display:"flex",flexDirection:"column",gap:"12px"}},e.fields.map((e,n)=>{const r=e?.title??"Field "+n;return t.createElement("textarea",{key:r,className:"yt-collection-bundle-textarea",placeholder:e?.title,rows:3,maxLength:500,onChange:e=>g(t=>({...t,[r]:e.target.value})),style:{padding:"12px",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px",resize:"vertical",lineHeight:"normal"}})})),"image"===e.type&&t.createElement("div",{className:"yt-collection-bundle-image-section",style:{marginBottom:"24px"}},t.createElement("sub",{className:"yt-collection-bundle-upload-hint",style:{display:"block",color:"#666",fontSize:"12px",marginBottom:"8px",lineHeight:"normal"}},"jpeg/png (max 5MB)"),t.createElement("div",{className:"yt-collection-bundle-form-fields",style:{display:"flex",flexDirection:"column",gap:"16px"}},e.fields.map((e,n)=>{const r=e?.title??"Field "+n,o=f[r];return t.createElement(Gx,{key:r,title:e?.title,uploadState:o,onUpload:()=>Q(r).click(),onRemove:()=>g(e=>{const{[r]:t,...n}=e;return n}),onRetry:()=>Q(r).click()})})))))):t.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:x?"grid":"flex",gridTemplateColumns:x?"repeat(2,1fr)":"",flexWrap:x?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:`${S}px`}},c.map(e=>t.createElement(Kx,{key:e.id,product:e,tierIdx:l,customizations:B,isMobile:x,hoveredCard:u,setHoveredCard:m,selectedProducts:d,handleAddToBundle:V,canAddProduct:H,allowMultipleQty:_,handleVariantChange:j,canIncrement:U,setSelectedProducts:p})),i===n&&(y[n]||0)<a.length&&t.createElement("div",{ref:e=>{const t=E.current.get(n);t&&k.current?.unobserve(t),e?(E.current.set(n,e),k.current?.observe(e)):E.current.delete(n)},"data-sentinel-step":n.toString(),style:{height:"20px",width:"100%",display:"block"}})))}),t.createElement(Jx,{config:e,selectedProducts:d,selectedByTier:Z,totalItems:M,totalPrice:R,totalCompareAtPrice:L,currentStep:i,totalSteps:N,currentTierMax:G,tierSelectedCounts:q,isMobile:x,bundleAddToCartLoading:n,isUploading:w,hoveredCard:u,setHoveredCard:m,hideSelectedProducts:D,getProductStep:e=>{for(let t=0;t<z.length;t++)if(z[t].products.some(t=>t.id.toString()===e))return t+1;return I?N:z.length},setCurrentStep:s,handleRemoveItem:(e,t,n)=>{p(r=>r.filter(r=>!(r.productId===e&&r.variantId===t&&r.tierIndex===n)))},handleCheckout:async()=>{if(i!==N||!d.length)return;const e={};I&&Object.entries(f).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=d.map(t=>({variantId:t.variantId,quantity:t.quantity,properties:e}));r(t)},hasForm:I,onHeightChange:A}))},Xx=({totalSteps:e,isFormStep:n,currentStep:r,getStepTitle:o,isMobile:a,formTitle:i,hasForm:l,onStepClick:c})=>t.createElement("div",{className:"yt-collection-bundle-steps-nav-container",style:{display:"flex",justifyContent:"center",flexDirection:"column",gap:a?"0":"1rem",overflowX:"auto",scrollbarWidth:"none",borderBottom:"1px solid #878787",marginInline:a?"0":"2%",paddingBottom:"1rem",textAlign:"center"}},t.createElement("div",{className:"yt-collection-bundle-steps-nav",style:{display:"flex",justifyContent:"center",gap:a?"0":"2rem",overflowX:"auto",scrollbarWidth:"none"}},Array.from({length:e},(e,t)=>t+1).map(n=>t.createElement("div",{key:n,className:"yt-collection-bundle-step-item "+(r===n?"yt-collection-bundle-step-item-active":""),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.5rem",minWidth:"120px",cursor:"pointer",opacity:r===n?1:.5,transition:"opacity 0.2s"},onClick:()=>c(n)},t.createElement("div",{className:"yt-collection-bundle-step-icon "+(r===n?"yt-collection-bundle-step-icon-active":""),style:{width:"40px",height:"40px",background:r===n?"#000":"#fff",border:"2px solid #ccc",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center"}},l&&n===e?t.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},t.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"})):t.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},t.createElement("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}))),t.createElement("div",{className:"yt-collection-bundle-step-label",style:{fontSize:"14px",textAlign:"center",color:"#333",fontWeight:"600",lineHeight:"normal"}},o(n))))),i&&l&&n&&t.createElement("p",{className:"yt-collection-bundle-steps-nav-description",style:{fontSize:a?"14px":"16px",marginBottom:a?"0":"14px",fontWeight:"400",color:"#000",lineHeight:"normal"}},i)),Kx=({product:e,tierIdx:n,customizations:r,isMobile:o,hoveredCard:a,setHoveredCard:i,selectedProducts:l,handleAddToBundle:s,canAddProduct:d,allowMultipleQty:p,handleVariantChange:u,canIncrement:m,setSelectedProducts:f})=>{const[g,x]=c(!1),h=document.querySelector(`[data-product-id="${e.id}"]`),y=h?.dataset.selectedVariant||e.variants[0].id.toString(),b=e.variants.find(e=>e.id.toString()===y)||e.variants[0],v=l.some(t=>t.productId===e.id.toString()&&t.variantId===y&&t.tierIndex===n),w=a===e.id,C=l.filter(t=>t.productId===e.id.toString()&&t.variantId===b.id.toString()&&t.tierIndex===n).reduce((e,t)=>e+t.quantity,0);return t.createElement(t.Fragment,null,t.createElement("div",{key:e.id,className:"yt-collection-bundle-product-item","data-product-id":e.id,"data-selected-variant":b.id,"data-current-price":b.price,style:{display:"flex",flexDirection:"column",border:r?.productCardBorder||"1px solid #ddd",background:r?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:o?0:"250px",maxWidth:o?"none":"250px",borderRadius:r?.borderRadius||"8px",boxShadow:"spread"===r?.productCardShadow?"8px 8px 8px -6px #0000004D":"no-spread"===r?.productCardShadow?"6px 6px 0px -1px #00000033":"none",width:o?"100%":""}},t.createElement("div",{className:"yt-collection-bundle-product-image",style:{position:"relative",width:"100%",aspectRatio:r?.productImageRatio||"1/1",overflow:"hidden",cursor:"pointer",background:"#f9f9f9"},onClick:()=>x(!0),onMouseEnter:()=>i(e.id),onMouseLeave:()=>i(null)},t.createElement("img",{src:rh(e.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:w?0:1,transform:w?"scale(1.05)":"scale(1)"},alt:e.title}),t.createElement("img",{src:rh(e.images[1]||e.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:w?1:0,transform:"scale(1.05)"},alt:e.title}),e.variants.length>1&&t.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:t=>u(e,t.target.value),defaultValue:b.id,onClick:e=>{e.stopPropagation()}},e.variants.map(e=>t.createElement("option",{key:e.id,value:e.id,disabled:!e.available},e.title," ",!e.available&&"(Out of stock)")))),t.createElement("div",{className:"yt-collection-bundle-product-info",style:{padding:"12px",flexGrow:1,display:"flex",flexDirection:"column"}},t.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:o?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:"normal",color:"#333",flexGrow:1}},e.title),t.createElement("div",{className:"yt-collection-bundle-product-prices",style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"nowrap",whiteSpace:"nowrap",overflow:"hidden",lineHeight:"normal"}},t.createElement("span",{className:"yt-collection-bundle-product-price",style:{fontSize:o?"14px":"16px",fontWeight:"bold",color:"#000",flexShrink:0,lineHeight:"normal"}},"₹",(b.price/100).toFixed(0)),b.compare_at_price&&b.compare_at_price>b.price&&t.createElement("span",{className:"yt-collection-bundle-product-compare",style:{fontSize:"14px",textDecoration:"line-through",color:"#999",flexShrink:0,lineHeight:"normal"}},"₹",(b.compare_at_price/100).toFixed(0)))),p&&C>0?t.createElement("div",{className:"yt-collection-bundle-quantity-row",style:{display:"flex",alignItems:"center",flexWrap:"nowrap",background:"#cccccc"}},t.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-minus",style:{width:"40%",height:b.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:o?"6px":"12px",fontSize:o?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{f(t=>{const r=`${e.id}-${b.id}-${n}`,o=t.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===r);return o&&o.quantity>1?t.map(e=>e===o?{...e,quantity:e.quantity-1}:e):o?t.filter(e=>e!==o):t})}},"-"),t.createElement("span",{className:"yt-collection-bundle-qty-display",style:{minWidth:"24px",textAlign:"center",fontWeight:600,width:"100%",lineHeight:"normal"}},C),t.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-plus",style:{width:"40%",height:b.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:o?"6px":"12px",fontSize:o?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{b.available&&m(e,b.id.toString(),n)&&f(t=>{const r=`${e.id}-${b.id}-${n}`,o=t.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===r);return o?t.map(e=>e===o?{...e,quantity:e.quantity+1}:e):[...t,{productId:e.id.toString(),variantId:b.id.toString(),price:b.price,quantity:1,tierIndex:n}]})},disabled:!b.available||!m(e,b.id.toString(),n)},"+")):t.createElement("button",{className:"yt-collection-bundle-add-btn "+(v?"yt-collection-bundle-add-btn-added":""),style:{background:v?"#28a745":d(e,n)&&b.available?r?.atcBg||"#007bff":"#ccc",color:r?.atcText||"#fff",border:"none",padding:o?"6px":"12px",fontSize:o?"12px":"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",opacity:b.available?1:.6,lineHeight:"normal",textAlign:"center"},onClick:()=>{b.available&&d(e,n)&&s(e,n)},disabled:!b.available||!d(e,n)},v?"Added":b.available?"ADD TO BOX":"Out of Stock")),g&&t.createElement(Yx,{product:e,tierIdx:n,isOpen:g,onClose:()=>x(!1),onAddToBundle:(e,t)=>{s(e,t),x(!1)},canAdd:d(e,n),isSelected:v,customizations:r,isMobile:o}))},Jx=e=>{const{config:n,selectedProducts:r,selectedByTier:a,totalItems:i,totalPrice:s,totalCompareAtPrice:d,currentStep:p,totalSteps:u,currentTierMax:m,tierSelectedCounts:f,isMobile:g,bundleAddToCartLoading:x,isUploading:h,hoveredCard:y,setHoveredCard:b,getProductStep:v,setCurrentStep:w,handleRemoveItem:C,handleCheckout:k,hasForm:E,onHeightChange:S}=e,{customizations:T}=n,[$,B]=c(!1),z=o(null),I=o(null),{totalOriginal:N,hasSavings:D,formattedSavings:_,totalAfterDiscount:P}=(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)/100,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),n=t.discountValue/100;i=a*(1-n)}}n+=i});const r=Math.round(t-n),o=r>0;return{savings:r,totalOriginal:t,totalAfterDiscount:n,hasSavings:o,formattedSavings:o?`₹${r.toLocaleString()}`:"",calculatedDiscountedTotal:Math.round(n)}})(a),F=a.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)/100;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 ₹${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=`₹${e.discountValue} OFF`;break;case"fixed_price_collection":t=`Fixed ₹${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=`₹${l.discountValue} OFF`;break;case"fixed_price_collection":n=`Fixed ₹${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 l(()=>{const e=m!==1/0&&f[p-1]===m-2&&m>1;let t=null;return e?(B(!0),t=setTimeout(()=>{B(!1)},3e3)):B(!1),()=>{t&&clearTimeout(t)}},[m,f,p]),l(()=>{if(z.current&&S){const e=z.current.offsetHeight;S(e)}},[g,S,r]),l(()=>{const e=Math.max(...a.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<(I.current??0)&&(I.current=e),e>(I.current??0)){I.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;ro({particleCount:100,spread:70,origin:{x:r,y:o},zIndex:9999})}},[a]),t.createElement("div",{ref:z,className:"yt-collection-bundle-bar",style:{background:T?.bundleBg||"#fff",color:T?.bundleText||"#333",border:T?.bundleBorder||"1px solid #878787",display:"flex",flexDirection:"column",position:"fixed",bottom:"10px",left:"50%",transform:"translateX(-50%)",width:"compact"==T.stickyBarWidth?"600px":"90%",maxWidth:"95%",zIndex:899,boxShadow:"0 -2px 10px rgba(0,0,0,0.1)",transition:"bottom 0.3s ease",borderRadius:T?.borderRadius||"8px",overflow:"hidden"}},F.length>0&&t.createElement("div",{style:{padding:"4px 8px",background:"#dbdbdbc5",color:"#6c757d",textAlign:"center",fontSize:"12px",fontWeight:500}},F.join(" + ")),t.createElement("div",{className:"yt-collection-bundle-bar-header",style:{position:"relative",textAlign:"center"}},$&&t.createElement(t.Fragment,null,t.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 "),t.createElement("div",{className:"yt-collection-bundle-ctx",style:{position:"absolute",top:"-40px",left:"50%",transform:"translateX(-50%)",background:T?.atcBg||"#007bff",color:T?.atcText||"#fff",padding:"4px 8px",borderRadius:T?.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"," ",t.createElement("span",{style:{fontWeight:600}},m," item",m>1?"s":"")))),r.length>0&&t.createElement("div",{className:"yt-collection-bundle-bar-top",style:{display:"flex",alignItems:"center",padding:"8px 8px 0",position:"relative",borderRadius:T?.borderRadius||"8px"}},t.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"}},a.filter(({count:e})=>e>0).map(({items:e},r,o)=>t.createElement(t.Fragment,{key:r},t.createElement("div",{className:"yt-collection-bundle-tier-images",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",minWidth:"fit-content"}},t.createElement("div",{style:{display:"flex",gap:"4px"}},e.map((e,o)=>{const a=n.config.builderTiers.collectionTier.flatMap(e=>e.products).find(t=>t.id.toString()===e.productId);if(!a)return null;const i=v(e.productId),l=p===i;return t.createElement("div",{key:o,className:"yt-collection-bundle-img-wrapper",style:{position:"relative",flexShrink:0,height:"65px"}},t.createElement("div",{style:{position:"relative",width:"67px",height:"67px",borderRadius:`calc(${T?.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&&w(i)},t.createElement("img",{src:rh(a.images[0]),style:{width:"65px",height:"65px",objectFit:"cover",borderRadius:`calc(${T?.borderRadius||"8px"} / 2)`,transition:"opacity 0.2s",pointerEvents:"none",border:"1px solid #ddd"},alt:"Selected"}),e.quantity>1&&t.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",e.quantity),t.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:t=>{t.stopPropagation(),C(e.productId,e.variantId,r)}},"×")))}))),r<o.length-1&&o[r+1].count>0&&t.createElement("div",{style:{color:"#666",paddingInline:"6px",lineHeight:"normal"}},t.createElement(ut,null)))))),g?t.createElement("div",{className:"yt-collection-bundle-mobile-bar-content",style:{display:"flex",flexDirection:i>0&&(E||n?.config?.builderTiers?.collectionTier?.length>1)?"column":"row",margin:"4px",gap:i>0?"10px":"0",background:"#dbdbdb",borderRadius:T?.borderRadius||"8px",overflow:"hidden"}},t.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:r.length>0?"space-between":"center",alignItems:"center",borderRadius:T?.borderRadius||"8px"}},t.createElement(t.Fragment,null,0===i&&t.createElement("div",{style:{fontSize:"14px",color:"#6c757d",lineHeight:"normal",...0===i&&{padding:"8px 0 12px 0",background:"#dbdbdb",color:"#6c757d",width:"100%",borderRadius:T?.borderRadius||"8px"}}},"Add Items to Checkout"),i>0&&t.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",justifyContent:"center",flexWrap:"wrap"}},t.createElement("div",{style:{fontSize:"14px",color:"#000",fontWeight:600}},"₹",(P??s).toLocaleString()),D?t.createElement(t.Fragment,null,t.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",N.toLocaleString()),t.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:T?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",_)):t.createElement(t.Fragment,null,d>s&&t.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",d.toLocaleString())),t.createElement("span",{style:{fontSize:"12px",color:"#000",fontWeight:500}},"(",i," items)")))),t.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"4px"}},(n?.config?.builderTiers?.collectionTier?.length>1||E)&&i>0&&t.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:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>b(-1),onMouseLeave:()=>b(null),disabled:1===p},"Back"),i>0&&t.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===i||h?"yt-collection-bundle-next-btn-disabled":""),style:{background:T?.btnPrimaryBg||"#28a745",color:T?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",opacity:p===u&&0===i||h?.6:1,textAlign:"center",lineHeight:"normal"},onClick:p===u?k:()=>w(p+1),disabled:p===u&&0===i||x||h},x?t.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},t.createElement(Qx,null)):p===u?"Checkout":"Next"))):t.createElement("div",{className:"yt-collection-bundle-bar-bottom",style:{display:"flex",alignItems:"center",padding:"0px",background:"#dbdbdb",margin:"8px",borderRadius:T?.borderRadius||"8px",overflow:"hidden",scrollbarWidth:"none"}},(n?.config?.builderTiers?.collectionTier?.length>1||E)&&i>0&&t.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===y&&{filter:"brightness(60%)"},textAlign:"center",lineHeight:"normal"},onClick:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>b(-1),onMouseLeave:()=>b(null),disabled:1===p},"Back"),t.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:r.length>0?"space-between":"center",paddingInline:"6px",alignItems:"center",...0===i&&{padding:"12px 24px"}}},0===i&&t.createElement("div",{style:{fontSize:"16px",color:"#6c757d",lineHeight:"normal"}},"Add Items to Checkout"),i>0&&t.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",justifyContent:"center"}},t.createElement("div",{style:{fontSize:"16px",color:"#000",fontWeight:600}},"₹",(P??s).toLocaleString()),D?t.createElement(t.Fragment,null,t.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",N.toLocaleString()),t.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:T?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",_)):t.createElement(t.Fragment,null,d>s&&t.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",d.toLocaleString())),t.createElement("span",{style:{fontSize:"16px",color:"#000",fontWeight:500}},"(",i," items)"))),i>0&&t.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===i||h?"yt-collection-bundle-next-btn-disabled":""),style:{background:T?.btnPrimaryBg||"#28a745",color:T?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",opacity:p===u&&0===i||h?.6:1,...-2===y&&{filter:"brightness(90%)"},textAlign:"center",lineHeight:"normal"},onClick:p===u?k:()=>w(p+1),disabled:p===u&&0===i||x||h,onMouseEnter:()=>b(-2),onMouseLeave:()=>b(null)},x?t.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},t.createElement(Qx,null)):p===u?"Checkout":"Next")))},eh=window?.Shopify?.currency||{rate:1,active:"INR"},th=e=>{if(!e)return;const t=navigator.language||"en-US",n=Number((Number(e)*eh.rate).toFixed(2));return new Intl.NumberFormat(t).format(n)},nh=(e,t)=>t==eh.active?e:Bn(eh.active)||eh.active,rh=(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"}`}},oh=(e,t,n,r,o,a)=>{const i=r.findIndex(t=>t.variantId===e);o(0===n?e=>e.filter((e,t)=>t!==i):-1===i?r=>[...r,{product:t,variantId:e,quantity:n,isFree:a}]:e=>e.map((e,t)=>t===i?{...e,quantity:e.quantity+n,isFree:a}:e))},ah=({bundle:e,currentProductId:n,addToCartFunction:r,addCustomBundleToCart:o,selectedItems:a,setSelectedItems:i,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:s,renderingOnPage:d,bundleSubtotal:p})=>"fixed"!==e.type&&e.type&&0!==e?.type?.length?"builder"===e.type?t.createElement(vf,{bundleAddToCartLoading:l,bundle:e,selectedItems:a,setSelectedItems:i,handleAddToCart:o,handleRemoveItem:c,renderingOnPage:d,selectedItemsQuantity:s??0,bundleSubtotal:p??{price:0,compareAtPrice:0}}):"combo"===e.type?t.createElement(Cf,{bundle:e,addToCartFunction:r}):"mixAndMatch"===e.type?t.createElement(Dg,{bundle:e,addToCartFunction:r}):"collection"===e.type?t.createElement(Zx,{config:e,addCustomBundleToCart:o,bundleAddToCartLoading:l}):t.createElement(Jf,{bundle:e,currentProductId:n,addToCartFunction:r}):t.createElement(Ux,{addToCartFunction:r,bundle:e});q(".scene {\n width: 100%;\n height: 60vh;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.floating {\n animation: float 3s ease-in-out infinite;\n}\n\n@keyframes float {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(-10px);\n }\n}\n.cube {\n position: relative;\n width: 50px;\n height: 50px;\n transform-style: preserve-3d;\n transform: rotateX(-45deg) rotateY(50deg) rotateZ(0deg);\n}\n\n.side,\n.lid,\n.flap {\n position: absolute;\n width: 100px;\n height: 100px;\n border: 4px solid #333366;\n background: transparent;\n box-sizing: border-box;\n}\n\n.side {\n background: #fff;\n backface-visibility: hidden;\n}\n\n.side.front {\n transform: translateZ(50px);\n}\n\n.side.back {\n transform: rotateY(180deg) translateZ(50px);\n}\n\n.side.left {\n transform: rotateY(-90deg) translateZ(50px);\n}\n\n.side.right {\n transform: rotateY(90deg) translateZ(50px);\n}\n\n.side.bottom {\n transform: rotateX(-90deg) translateZ(50px);\n}\n\n.lid {\n transform: rotateX(90deg) translateZ(50px);\n transform-style: preserve-3d;\n}\n\n.flap.north {\n top: 0;\n left: 0;\n width: 100%;\n height: 50%;\n transform-origin: top center;\n animation: openNorth 3s ease-in-out infinite;\n}\n\n.flap.south {\n bottom: 0;\n left: 0;\n width: 100%;\n height: 50%;\n transform-origin: bottom center;\n animation: openSouth 3s ease-in-out infinite;\n}\n\n.flap.east {\n top: 0;\n right: 0;\n width: 50%;\n height: 100%;\n transform-origin: right center;\n animation: openEast 3s ease-in-out infinite;\n}\n\n.flap.west {\n top: 0;\n left: 0;\n width: 50%;\n height: 100%;\n transform-origin: left center;\n animation: openWest 3s ease-in-out infinite;\n}\n\n@keyframes openNorth {\n 0%, 100% {\n transform: rotateX(0deg);\n }\n 50% {\n transform: rotateX(180deg);\n }\n}\n@keyframes openSouth {\n 0%, 100% {\n transform: rotateX(0deg);\n }\n 50% {\n transform: rotateX(-180deg);\n }\n}\n@keyframes openEast {\n 0%, 100% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(180deg);\n }\n}\n@keyframes openWest {\n 0%, 100% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(-180deg);\n }\n}");const ih=()=>t.createElement("div",{className:"scene"},t.createElement("div",{className:"floating"},t.createElement("div",{className:"cube"},t.createElement("div",{className:"side front"},""),t.createElement("div",{className:"side back"},""),t.createElement("div",{className:"side left"},""),t.createElement("div",{className:"side right"},""),t.createElement("div",{className:"side bottom"},""),t.createElement("div",{className:"lid"},t.createElement("div",{className:"flap north"},""),t.createElement("div",{className:"flap south"},""),t.createElement("div",{className:"flap east"},""),t.createElement("div",{className:"flap west"},""))))),lh=({showPopup:e,selectedOffer:n,selectedOfferTerms:r,onClose:o,offersConfig:a})=>{if(!e||!n||!r)return null;const i=t.createElement("div",{className:"yt-product-offers-isolated",style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2147483647},onClick:o},t.createElement("div",{style:{width:"90vw",minWidth:"375px",maxWidth:"480px",maxHeight:"90vh",backgroundColor:"#fff",borderRadius:"12px",padding:"16px",boxShadow:"0 4px 15px rgba(0,0,0,0.3)",position:"relative",flexDirection:"column",display:"flex"},onClick:e=>e.stopPropagation()},t.createElement("img",{src:"https://feature-products-offers.shopify-product-blocks.pages.dev/assets/confetti.jpg",alt:"confetti",style:{width:"100%",height:"clamp(150px, 20vh, 230px)",objectFit:"cover",objectPosition:"top",borderTopLeftRadius:"12px",borderTopRightRadius:"12px",marginBottom:"10px",flexShrink:0}}),t.createElement("div",{style:{fontSize:"clamp(32px, 8vw, 40px)",color:"#4C4C4C",marginTop:"clamp(-150px, -20vh, -200px)",marginBottom:"8px",display:"flex",justifyContent:"center",position:"relative"}},t.createElement(H,null)),t.createElement("div",{style:{fontSize:"clamp(16px, 4vw, 20px)",fontWeight:500,color:"#4C4C4C",lineHeight:"normal",textAlign:"center"}},n.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")),t.createElement("div",{style:{fontSize:"clamp(28px, 7vw, 40px)",fontWeight:"600",color:a?.textColor||"#EE8E35",lineHeight:"normal",textAlign:"center"}},n.name),t.createElement("div",{style:{fontSize:"clamp(16px, 4vw, 20px)",color:"#000000",textAlign:"center",fontWeight:500}},r.offerMessage),t.createElement("hr",{style:{border:"none",height:"2px",width:"100%",margin:"10px 0 18px 0",backgroundColor:"transparent",backgroundImage:"repeating-linear-gradient(to right, #ccc 0, #ccc 12px, transparent 12px, transparent 20px)",backgroundSize:"100% 2px",backgroundPosition:"0 0",backgroundRepeat:"repeat-x"}}),t.createElement("div",{style:{marginTop:"15px",fontSize:"clamp(14px, 3.5vw, 16px)",textAlign:"center",display:"flex",flexDirection:"column"}},t.createElement("strong",{style:{color:"#888"}},"Terms & Conditions"),t.createElement("ul",{style:{marginTop:"5px",paddingLeft:"20px",textAlign:"left",display:"inline-block",color:"#000",lineHeight:"1.3",marginBottom:"0"}},r.terms.map((e,n)=>t.createElement("li",{key:n,style:{marginBottom:"4px"}},e)))),t.createElement("button",{onClick:o,style:{width:"100%",padding:"10px 20px",marginTop:"10px",backgroundColor:"#fff",border:"none",borderTop:"1px solid #ddd",borderRadius:"0",fontSize:"16px",fontWeight:"600",color:"#333",cursor:"pointer",textAlign:"center",flexShrink:0}},"Close")));return w(i,document.body)},ch=({showPopup:e,selectedOffer:n,selectedOfferTerms:r,onClose:o,offersConfig:a})=>{if(!e||!n||!r)return null;const i=t.createElement("div",{className:"yt-product-offers-isolated",style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"flex-end",justifyContent:"center",zIndex:2147483647,animation:"fadeIn 0.3s ease"},onClick:o},t.createElement("style",null,"\n @keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n @keyframes slideUp {\n from { transform: translateY(100%); }\n to { transform: translateY(0); }\n }\n "),t.createElement("div",{style:{width:"100%",maxHeight:"85vh",backgroundColor:"#fff",borderTopLeftRadius:"20px",borderTopRightRadius:"20px",borderTop:"1px solid #E5E5E5",position:"relative",flexDirection:"column",display:"flex",animation:"slideUp 0.3s ease",overflow:"hidden"},onClick:e=>e.stopPropagation()},t.createElement("div",{style:{width:"40px",height:"4px",backgroundColor:"#ddd",borderRadius:"2px",margin:"12px auto 16px",flexShrink:0}}),t.createElement("div",{style:{overflowY:"auto",flex:1}},t.createElement("div",{style:{padding:"0 20px 20px",backgroundColor:"#fff"}},t.createElement("div",{style:{fontSize:"48px",color:"#4C4C4C",display:"flex",justifyContent:"center",margin:"16px"}},t.createElement(H,null)),t.createElement("div",{style:{fontSize:"14px",fontWeight:500,color:"#888",textAlign:"center"}},n.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")),t.createElement("div",{style:{fontSize:"32px",fontWeight:"700",color:a?.textColor||"#EE8E35",textAlign:"center",lineHeight:"1.2"}},n.name),t.createElement("div",{style:{fontSize:"18px",color:"#000000",textAlign:"center",fontWeight:500}},r.offerMessage)),t.createElement("div",{style:{backgroundColor:"#F5F5F5",padding:"16px 20px"}},t.createElement("div",{style:{fontSize:"16px",fontWeight:"600",color:"#333",textAlign:"center"}},"Terms & Conditions")),t.createElement("div",{style:{padding:"20px",backgroundColor:"#fff"}},t.createElement("ul",{style:{margin:"0",paddingLeft:"20px",color:"#333",lineHeight:"1.6",fontSize:"14px"}},r.terms.map((e,n)=>t.createElement("li",{key:n,style:{marginBottom:"4px"}},e))))),t.createElement("button",{onClick:o,style:{width:"100%",padding:"18px 20px",backgroundColor:"#F5F5F5",border:"none",borderTop:"1px solid #E5E5E5",fontSize:"16px",fontWeight:"600",color:"#333",cursor:"pointer",textAlign:"center",fontFamily:"'Poppins', sans-serif",flexShrink:0}},"Close")));return w(i,document.body)},sh=({offersToShow:e,offersConfig:n,getOfferCardMessage:r,setSelectedOffer:a,setShowPopup:i})=>{const s=o(null),[d,p]=c(!1),[u,m]=c(!0),[f,g]=c("undefined"!=typeof window&&window.innerWidth<=768),x=()=>{if(s.current){const{scrollLeft:e,scrollWidth:t,clientWidth:n}=s.current;p(e>0),m(e<t-n-10)}};l(()=>{x();const e=s.current;if(e)return e.addEventListener("scroll",x),()=>e.removeEventListener("scroll",x)},[e]),l(()=>{const e=()=>{g(window.innerWidth<=768)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const h=e=>{if(s.current){const t=f?280:365,n=16,r="right"===e?t+n:-(t+n);s.current.scrollBy({left:r,behavior:"smooth"})}};return t.createElement("div",{style:{position:"relative"}},t.createElement("svg",{style:{position:"absolute",width:0,height:0}},t.createElement("defs",null,t.createElement("mask",{id:"coupon-cut-mask-desktop"},t.createElement("rect",{width:"365",height:"138",fill:"white"}),t.createElement("circle",{cx:"80",cy:"0",r:"12",fill:"black"}),t.createElement("circle",{cx:"80",cy:"138",r:"12",fill:"black"})),t.createElement("mask",{id:"coupon-cut-mask-mobile"},t.createElement("rect",{width:"280",height:"120",fill:"white"}),t.createElement("circle",{cx:"60",cy:"0",r:"10",fill:"black"}),t.createElement("circle",{cx:"60",cy:"120",r:"10",fill:"black"})))),d&&t.createElement("button",{onClick:()=>h("left"),style:{position:"absolute",left:"5px",top:"50%",transform:"translateY(-50%)",background:"#fff",border:"1px solid #e0e0e0",borderRadius:"50%",width:"clamp(28px, 5vw, 38px)",height:"clamp(28px, 5vw, 38px)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)",color:"#333"}},t.createElement(M,{size:20})),u&&t.createElement("button",{onClick:()=>h("right"),style:{position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",background:"#fff",border:"1px solid #e0e0e0",borderRadius:"50%",width:"clamp(28px, 5vw, 38px)",height:"clamp(28px, 5vw, 38px)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)",color:"#333"}},t.createElement(j,{size:20})),t.createElement("div",{ref:s,className:"hide-scrollbar",style:{display:"flex",alignItems:"stretch",overflowX:"auto",gap:"16px",scrollbarWidth:"none",msOverflowStyle:"none",minHeight:f?"110px":"128px"}},e?.map(e=>t.createElement("div",{key:e.discountId,style:{flexShrink:0,width:f?"280px":"365px",minWidth:f?"280px":"365px",minHeight:f?"110px":"128px",backgroundColor:"transparent",borderRadius:`${n?.roundness||0}px`,border:"1px solid #e0e0e0",display:"flex",position:"relative",overflow:"visible",mask:`url(#${f?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,WebkitMask:`url(#${f?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,maskImage:`url(#${f?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,WebkitMaskImage:`url(#${f?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`}},t.createElement("div",{style:{width:f?"60px":"80px",minHeight:f?"110px":"128px",backgroundColor:n?.accentColor||"#EE8E35",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:f?"10px 6px":"12px 8px",position:"relative",borderTopLeftRadius:`${n?.roundness||0}px`,borderBottomLeftRadius:`${n?.roundness||0}px`}},t.createElement("div",{style:{position:"absolute",right:"-2px",top:"12px",bottom:"12px",width:"2px",borderLeft:"2px dashed #FFFFFF"}})),n?.iconVisibility&&t.createElement("div",{style:{position:"absolute",left:f?"42.5px":"57.5px",top:"35%",transform:"translateY(-50%)",width:f?"32px":"40px",height:f?"32px":"40px",backgroundColor:"#FFFFFF",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:f?"16px":"20px",color:"#333333",zIndex:10,boxShadow:"0 2px 5px rgba(0,0,0,0.1)",border:"1px solid #E0E0E0"}},"free_product"===e.couponType?t.createElement(W,null):t.createElement(wo,null)),t.createElement("div",{style:{flex:1,padding:f?"12px 12px":"15px 15px",paddingLeft:f?"25px":"35px",display:"flex",flexDirection:"column",justifyContent:"space-between",borderTopRightRadius:`${n?.roundness||0}px`,borderBottomRightRadius:`${n?.roundness||0}px`,overflow:"hidden",backgroundColor:n?.cardBackgroundColor||"#ffffff",minWidth:0}},t.createElement("div",{style:{display:"flex",flexDirection:"column",gap:f?"4px":"6px",lineHeight:"normal"}},t.createElement("div",{style:{fontSize:f?"9px":"10px",color:"#666666",fontWeight:"400"}},"free_product"===e.couponType?"Free Gift":"Special Deal"),t.createElement("div",{style:{fontSize:f?"13px":"15px",fontWeight:"600",color:n?.textColor||"#2c3e50"}},e.name),t.createElement("div",{style:{fontSize:f?"11px":"12px",color:n?.accentColor||"#EE8E35",wordWrap:"break-word",overflowWrap:"break-word",whiteSpace:"normal",minHeight:f?"28px":"32px"}},r(e))),t.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},t.createElement("div",{style:{borderTop:"1px solid #999999",marginTop:"4px",width:"100%",height:"0",display:"block"}}),t.createElement("a",{href:"#",onClick:t=>{t.preventDefault(),a(e),i(!0)},style:{fontSize:f?"11px":"12px",color:"#2c3e50",fontWeight:"500",textDecoration:"none",cursor:"pointer",textAlign:"center",marginTop:"0"}},n?.viewDetailsTitle||"View Details")))))),t.createElement("style",null,"\n .hide-scrollbar::-webkit-scrollbar {\n display: none;\n }\n .hide-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n "))},dh=({offersToShow:e,offersConfig:n,getOfferCardMessage:r,setSelectedOffer:o,setShowPopup:a})=>{const[i,s]=c("undefined"!=typeof window&&window.innerWidth<=768);return l(()=>{const e=()=>{s(window.innerWidth<=768)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),t.createElement("div",{style:{borderRadius:`${n?.roundness||8}px`}},e?.map((l,c)=>t.createElement("div",{key:l.discountId,style:{display:"flex",alignItems:"flex-start",gap:i?"8px":"12px",padding:i?"12px 0":"16px 0",paddingLeft:i?"10px":"20px",backgroundColor:!0===n?.cardBackgroundTransparent||"true"===String(n?.cardBackgroundTransparent)?"transparent":n?.cardBackgroundColor||"#ffffff",borderBottom:c<(e?.length||0)-1?"1px solid rgb(225 218 218)":"none",marginBottom:"4px",borderRadius:`${n?.roundness||0}px`}},n?.iconVisibility&&t.createElement("div",{style:{width:i?"40px":"50px",height:i?"40px":"50px",backgroundColor:"#f8f9fa",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:i?"20px":"25px",marginTop:i?"5px":"10px",border:"2px solid #4a4a4a",color:"#4a4a4a"}},"free_product"===l.couponType?t.createElement(W,null):t.createElement(wo,null)),t.createElement("div",{style:{flex:1}},t.createElement("div",{style:{fontSize:i?"14px":"15px",fontWeight:600,color:"#000000",lineHeight:"1"}},l.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "),":"," ",t.createElement("span",{style:{fontWeight:600,color:n?.textColor||"#34495e"}},l.name)),t.createElement("div",{style:{fontSize:i?"12px":"13px",color:"#7f8c8d",marginBottom:"6px"}},r(l)),t.createElement("div",{style:{fontSize:i?"11px":"12px",color:"#000000"}},"offer auto applied",t.createElement("a",{href:"#",onClick:e=>{e.preventDefault(),o(l),a(!0)},style:{color:n?.accentColor||"#7f8c8d",fontWeight:700,textDecoration:"none",marginLeft:"2px"}},n?.viewDetailsTitle||"T&C"))))))},ph=e=>{const t="free_product"===e.couponType;let n="";t?n="Get this product for free!":e.discountPercentage?n=`Get ${e.discountPercentage}% off`:e.discountValue&&(n=`Get ${e.discountValue} off`);const r=["Limited Time Offer","Applies automatically when criteria is met"];return"quantity"===e.customCartProgressBarCriteria&&e.quantityThreshold?r.push(`Unlock when you add ${e.quantityThreshold} ${e.quantityThreshold>1?"items":"item"} to cart`):"minimum_order_value"===e.customCartProgressBarCriteria&&e.minimumOrderValue&&r.push(`Unlock at order value of ${e.minimumOrderValue}`),t&&r.push("Combines with other order discounts"),t||r.push("Not applicable if other offer with higher discount applied on same product"),{offerMessage:n,terms:r}},uh=e=>"quantity"===e.customCartProgressBarCriteria&&e.quantityThreshold?`add ${e.quantityThreshold} ${e.quantityThreshold>1?"items":"item"} to unlock`:"minimum_order_value"===e.customCartProgressBarCriteria&&e.minimumOrderValue?`unlocks on orders above ${e.minimumOrderValue}`:"Special offer available",mh=({offersConfig:e,offers:n})=>{const[r,a]=c(!1),[i,s]=c(null),[d,p]=c(null),[u,m]=c("undefined"!=typeof window&&window.innerWidth<=768),[f,g]=c("undefined"!=typeof window&&window.innerWidth<=450),x=o(null);l(()=>{const e=()=>{m(window.innerWidth<=768),g(window.innerWidth<=450)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),l(()=>{x.current&&Ln(x.current)},[e?.sectionBgContrastColor]);const h=(e=>{if(!e||0===e.length)return e;const t={};e.forEach(e=>{const n=e.customCartProgressBarCriteria||"none";t[n]=(t[n]||0)+1});let n="none",r=-1;Object.keys(t).forEach(e=>{t[e]>r&&(r=t[e],n=e)});const o=e.map((e,t)=>({o:e,idx:t})),a=e=>"minimum_order_value"===n?void 0!==e.minimumOrderValue&&null!==e.minimumOrderValue?Number(e.minimumOrderValue):1/0:"quantity"===n&&void 0!==e.quantityThreshold&&null!==e.quantityThreshold?Number(e.quantityThreshold):1/0;return o.sort((e,t)=>{const r=e.o.customCartProgressBarCriteria===n,o=t.o.customCartProgressBarCriteria===n;if(r&&o){const n=a(e.o),r=a(t.o);return n!==r?n-r:e.idx-t.idx}return r&&!o?-1:!r&&o?1:e.idx-t.idx}),o.map(e=>e.o)})(n||[]);return t.createElement("div",null,t.createElement("div",{style:{position:"relative",width:"100%",maxWidth:"450px",borderRadius:"list"===e?.sectionType?`${e?.roundness||0}px`:"0px",boxSizing:"border-box",backgroundColor:e?.sectionBackgroundColor||"#fff"}},t.createElement("div",{style:{border:"coupon"===e?.sectionType?"none":"1px solid rgb(169, 163, 163)",borderTop:"1px solid rgb(169, 163, 163)",padding:null!=e?.cardPadding?`${e.cardPadding}px`:u?"20px 10px 15px":"30px 15px 20px",position:"relative",borderRadius:"list"===e?.sectionType?`${e?.roundness||8}px`:"0px"}},t.createElement("span",{ref:x,className:"yt-product-offers-section-title",style:{position:"absolute",top:"0",left:"left"===e?.alignment?"coupon"===e?.sectionType?"0px":u?"10px":"20px":"right"===e?.alignment?"auto":"50%",right:"right"===e?.alignment?"coupon"===e?.sectionType?"0px":u?"10px":"20px":"auto",transform:"middle"===e?.alignment?"translateX(-50%) translateY(-50%)":"translateY(-50%)",background:e?.sectionBgContrastColor||"#fff",padding:u?"0 8px":"0 10px",fontWeight:"500",fontSize:u?"14px":"16px",textTransform:"uppercase",textAlign:"center"}},e?.sectionTitle||"Available Deals and Offers"),(()=>{const n=e?.sectionType;return"list"===n?t.createElement(dh,{offersToShow:h,offersConfig:e||{},getOfferCardMessage:uh,setSelectedOffer:e=>{s(e),e&&p(ph(e))},setShowPopup:a}):"coupon"===n?t.createElement(sh,{offersToShow:h,offersConfig:e||{},getOfferCardMessage:uh,setSelectedOffer:e=>{s(e),e&&p(ph(e))},setShowPopup:a}):null})(),f?t.createElement(ch,{selectedOffer:i,selectedOfferTerms:d,showPopup:r,offersConfig:e,onClose:()=>{a(!1),s(null),p(null)}}):t.createElement(lh,{selectedOffer:i,selectedOfferTerms:d,showPopup:r,offersConfig:e,onClose:()=>{a(!1),s(null),p(null)}}))))};export{ah as Bundle,ih as BundleLoader,Su as Cart,Xe as Nudge,mh as ProductOffers,ot as SpinnerWheel};
|
|
5093
|
+
`,Vx=({productsWithIndices:e,isOpen:n,onClose:r,cta:o,variantOptions:a,onVariantChange:s,handleAddToCart:d,primaryProductId:p,variantId:u})=>{const m=i(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?1/0:0:1/0:0},[]),[f,g]=c({}),[x,h]=c({});l(()=>{const t={},n={};e?.forEach(({product:e,index:r})=>{let o,a=[];if(e.productId===p&&u){const t=e?.productDetails?.variants?.edges.find(e=>e?.node?.id?.includes(u))?.node;t&&m(e.productDetails,t.id)>0&&(a=t.title.split(" / "),o=t)}if(!a.length){const t=e.productDetails.variants.edges.find(t=>m(e.productDetails,t?.node?.id)>0)?.node||e?.productDetails?.variants?.edges?.[0]?.node;t?(a=t.title.split(" / "),o=t):a=e?.productDetails?.options?.map(e=>e.values[0]??"")}t[r]=a,o&&(n[r]={node:o},s(r,o.id))}),g(t),h(n)},[e,p,u,s,m]),l(()=>{if(!p||!u)return;const t=e?.find(({product:e})=>e?.productId===p);if(!t)return;const{product:n,index:r}=t,o=n?.productDetails?.variants?.edges?.find(e=>e.node.id.includes(u))?.node;if(o&&m(n.productDetails,o.id)>0){const e=o.title.split(" / ");g(t=>({...t,[r]:e})),h(e=>({...e,[r]:{node:o}})),s(r,o.id)}},[u,p,e,s,m]);const y=(e,t,n,r)=>{const o=[...f[e]||[]];o[t]=n;const a=o.join(" / "),i=r.productDetails.variants.edges.find(e=>e.node.title===a)?.node;return!!i&&m(r.productDetails,i.id)>0},b=(t,n,r)=>{const{product:o}=e?.find(e=>e.index===t)||{product:{productDetails:{variants:{edges:[]}}}};if(!o?.productDetails)return;if(!y(t,r,n,o))return;const a={...f};a[t][r]=n,g(a);const i=o?.productDetails?.variants?.edges?.find(e=>e.node.title===a[t].join(" / "))?.node;i&&(s(t,i.id),h(e=>({...e,[t]:{node:i}})))};if(!n)return null;const w=t.createElement($x,{className:"yt-fixedBundle-variant-modal_overlay",onClick:r},t.createElement(Bx,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},t.createElement(zx,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:o.backgroundColor,color:o.textColor}},"Select Options"),e?.map(({product:n,index:r},o)=>t.createElement(t.Fragment,null,t.createElement(Nx,{className:"yt-fixedBundle-variant-modal_product-block"},t.createElement(Dx,{className:"yt-fixedBundle-variant-modal_thumbnail",src:x[r]?.node?.image?.url||n.productDetails.featuredMedia?.preview?.image?.url,alt:n.productDetails.title}),t.createElement(_x,{className:"yt-fixedBundle-variant-modal_product-info"},t.createElement(Px,{className:"yt-fixedBundle-variant-modal_product-name"},n.productDetails.title,n.productDetails.variants.edges.length>1&&t.createElement(Ox,{className:"yt-fixedBundle-variant-modal_selected-value"},f[r]?.join(" / "))),n.productDetails.options.map((e,o)=>{const i=a&&a?.options?.find(t=>t.name===e.name);return e.values.length<=1?t.createElement(t.Fragment,null):i&&"color"===i?.type?t.createElement(Ax,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(jx,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map((e,a)=>{const l=!y(r,o,e,n);return t.createElement(t.Fragment,null,i.values.find(t=>t.name===e)?.value?t.createElement(Mx,{className:"yt-fixedBundle-variant-modal_color-swatch",key:a,color:i.values.find(t=>t.name===e)?.value||e,selected:f[r]?.[o]==e,disabled:l,onClick:()=>{b(r,e,o)}},t.createElement("span",null)):t.createElement(Rx,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:f[r]?.[o]==e,disabled:l,onClick:()=>{b(r,e,o)}},e))})):i&&"image"===i?.type?t.createElement(Ax,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(jx,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map((e,a)=>{const l=!y(r,o,e,n);return t.createElement(t.Fragment,null,i?.values.find(t=>t.name===e)?.value?t.createElement(Lx,{className:"yt-fixedBundle-variant-modal_image-swatch",key:a,selected:f[r]?.[o]==e,disabled:l,onClick:()=>{b(r,e,o)},src:i.values.find(t=>t.name===e)?.value},t.createElement("span",null)):t.createElement(Rx,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:f[r]?.[o]==e,disabled:l,onClick:()=>{b(r,e,o)}},e))})):t.createElement(Ax,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(jx,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map((e,a)=>{const i=!y(r,o,e,n);return t.createElement(Rx,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:f[r]?.[o]==e,disabled:i,onClick:()=>{b(r,e,o)}},e)}))}))),o<e.length-1&&t.createElement(Fx,{className:"yt-fixedBundle-variant-modal_divider"}))),t.createElement(Ix,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:o.backgroundColor,color:o.textColor},onClick:d},"Add bundle to cart")));return v.createPortal(w,document.body)},Wx=({options:e,selectedValue:n,onChange:r,type:a="text"})=>{const[i,s]=c(!1),d=o(null);l(()=>{const e=e=>{d.current&&!d.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const p=e=>"color"===a?t.createElement(yx,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:e.value},t.createElement("span",null)):"image"===a?t.createElement(bx,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:e.value||"/placeholder.svg",alt:e.name},t.createElement("span",null)):null;return t.createElement(px,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:d},t.createElement(ux,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>s(!i)},t.createElement(mx,{className:"yt-fixedBundle-variant-dropdown-horizontal_content"},n&&("color"===a||"image"===a)&&p(n),t.createElement("span",{className:"yt-fixedBundle-variant-dropdown-horizontal_selected-text"},n&&n.name)),t.createElement(fx,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:i})),i&&t.createElement(gx,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},e?.map(e=>t.createElement(xx,{className:"yt-fixedBundle-variant-selector_dropdown-item "+(n?.name===e.name?"yt-fixedBundle-variant-selector_dropdown-item--selected":""),key:e.name,$isSelected:n?.name===e.name,onClick:()=>{r(e),s(!1)}},("color"===a||"image"===a)&&p(e),t.createElement(hx,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},e.name)))))},Hx=({product:e,variantOptions:n,selectedVariants:r,onVariantChange:o,variantId:a,primaryProductId:i,variantType:s="dropdown"})=>{const[d,p]=c(r||[]);l(()=>{if(a&&e.variants.edges.some(e=>e.node.id.includes(a))){const t=e.variants.edges.find(e=>e.node.id.includes(a))?.node;if(t){const e=t.title.split(" / ");p(e)}}},[a,e]);const u=e=>{if(!n?.options)return"text";const t=n.options.find(t=>t.name===e);return t?.type||"text"},m=(e,t)=>{if(!n?.options)return e.values.map(e=>({name:e,value:e}));const r=n.options.find(t=>t.name===e.name);return e.values.map(e=>{const t=r?.values?.find(t=>t.name===e);return{name:e,value:t?.value||e}})},f=(e,t)=>{const n=d[t];if(!n)return null;return m(e).find(e=>e.name===n)||null};return t.createElement(vx,{className:"yt-fixedBundle-variant-selector-horizontal_container"},e.options.map((n,r)=>t.createElement(wx,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:n.name,$isFirst:0===r},n?.values?.length>1&&t.createElement(Wx,{options:m(n),selectedValue:f(n,r),onChange:t=>{console.log(t),((t,n)=>{const r=[...d];r[t]=n.name,p(r);const a=e.variants.edges.find(n=>n.node.title===(e.options?.length>0?r.join(" / "):r[t]))?.node.id;o(a||"")})(r,t)},type:u(n.name)}))))},qx=({product:e,selectedVariantId:n,isChecked:r,canCustomize:o,styles:a,onVariantChange:s,onCheckChange:d,isMobile:p,isHorizontal:u,index:m,variantOptions:f,productsLength:g,handleOpenModal:x,storeCurrencyCode:h,primaryProductId:y,variantId:b})=>{const v=i(()=>t=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?1/0:0:1/0:0},[e]),[w,C]=c(e?.variants?.edges.find(e=>v(e?.node?.id)>0)?.node||e?.variants?.edges?.[0]?.node),[k]=c(e?.options?.map(e=>e?.values?.[0])||[]),E=e?.id===y;l(()=>{if(e.id===y){const t=e?.variants?.edges?.find(e=>e?.node?.id?.includes(n))?.node;t&&v(t.id)>0&&(C(t),s(t.id))}else{const t=e?.variants?.edges?.find(e=>e?.node?.id===n)?.node||e?.variants?.edges?.find(e=>v(e?.node?.id)>0)?.node||e?.variants?.edges?.[0]?.node;C(t)}},[e,y,n,b,s,v]);const S="undefined"!=typeof window&&"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain||"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,T=w?.image?.url||e.featuredMedia?.preview?.image?.url;return t.createElement(t.Fragment,null,u?t.createElement("div",{className:""+(e.id===y?"yt-fixedBundle-product-card--horizontal-primary":"yt-fixedBundle-product-card--horizontal-associated"),style:{display:"flex",alignItems:"center",gap:"10px",backgroundColor:a.fixedBundle?.cardBackgroundColor}},o&&t.createElement(Sx,{className:"yt-fixedBundle-product-card_checkbox-wrapper--horizontal"},t.createElement(kx,{className:"yt-fixedBundle-product-card_checkbox-hidden",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}-${m}`,defaultChecked:r,onChange:e=>d(e.target.checked),disabled:E}),t.createElement(Ex,{className:"yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${e.id}-${m}`,isChecked:r,borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.general?.ctaBackgroundColor},t.createElement(ct,null))),t.createElement(Ag,{className:"yt-fixedBundle-product-card-horizontal_item",style:{borderRadius:a.fixedBundle?.borderRadius,border:`1px solid ${a.fixedBundle?.borderColor}80`,backgroundColor:a.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`8px 8px 8px -6px ${a.fixedBundle.borderColor}`,"no-spread":`4px 4px 0px -1px ${a.fixedBundle.borderColor}80`}[a.fixedBundle.shadowType]||"none"},canCustomize:o},"undefined"!=typeof window&&"devansh-test123.myshopify.com"!==window.ytBundleApp?.storeDomain&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&t.createElement(Mg,{className:"yt-fixedBundle-product-card-horizontal_image",src:rh(T),alt:e.title,style:{borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,aspectRatio:a.general.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),t.createElement(Rg,{className:"yt-fixedBundle-product-card-horizontal_details"},t.createElement(Lg,{className:"yt-fixedBundle-product-card-horizontal_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement(jg,{className:"yt-fixedBundle-product-card-horizontal_price-section"},t.createElement(Vg,{className:"yt-fixedBundle-product-card-horizontal_price--new"},nh(a.general.currencySymbol,h)," ",th(w?.price)),a.fixedBundle.compareAtPriceVisibility&&w?.compareAtPrice&&parseFloat(w.compareAtPrice)>parseFloat(w?.price)&&t.createElement(Wg,{className:"yt-fixedBundle-product-card-horizontal_price--old"},nh(a.general.currencySymbol,h),th(w?.compareAtPrice))),t.createElement(Hx,{product:e,variantOptions:f,selectedVariants:k,onVariantChange:t=>{const n=e?.variants?.edges?.find(e=>e.node.id===t)?.node;n&&s(t)},variantId:b,primaryProductId:y})))):t.createElement(t.Fragment,null,t.createElement(Kg,{className:""+(e.id===y?"yt-fixedBundle-product-card--vertical-primary":"yt-fixedBundle-product-card--vertical-associated"),productsLength:g,style:{borderRadius:a.fixedBundle?.borderRadius,border:`1px solid ${a.fixedBundle?.borderColor}50`,backgroundColor:a.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`0 4px 10px -6px ${a.fixedBundle.borderColor}50`,"no-spread":`4px 4px 0px -1px ${a.fixedBundle.borderColor}50`}[a.fixedBundle.shadowType]||"none",...o&&{position:"relative"},...S&&{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",minWidth:"max-content",paddingLeft:"2px"}},borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.fixedBundle?.cardBackgroundColor},o&&t.createElement(Tx,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:S},t.createElement(kx,{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}-${m}`,defaultChecked:r,onChange:e=>d(e.target.checked),disabled:E}),t.createElement(Ex,{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${e.id}-${m}`,isChecked:r,borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.general?.ctaBackgroundColor},t.createElement(ct,{size:10}))),"undefined"!=typeof window&&"devansh-test123.myshopify.com"!==window.ytBundleApp?.storeDomain&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&t.createElement(Jg,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:a.general.imageAspectRatio,height:"fit-content"}},t.createElement(ex,{className:"yt-fixedBundle-product-card_image--vertical",src:rh(T),style:{aspectRatio:a.general.imageAspectRatio},alt:e.title}),e.variants.edges.length>1&&t.createElement(tx,{className:"yt-fixedBundle-product-card_badge-container"},t.createElement(nx,{className:"yt-fixedBundle-product-card_circle-button"},t.createElement("span",null)),t.createElement(rx,{className:"yt-fixedBundle-product-card_circle-button-two"},t.createElement("span",null)),t.createElement(ox,{className:"yt-fixedBundle-product-card_count-badge"},e.variants.edges.length,"+"))),t.createElement(ax,{className:"yt-fixedBundle-product-card-vertical_info"},t.createElement(ix,{className:"yt-fixedBundle-product-card-vertical_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement(cx,{className:"yt-fixedBundle-product-card-vertical_price-line"},t.createElement(lx,{className:"yt-fixedBundle-product-card-vertical_price--new"},nh(a.general.currencySymbol,h),th(w?.price)),a.fixedBundle.compareAtPriceVisibility&&w?.compareAtPrice&&parseFloat(w.compareAtPrice)>parseFloat(w?.price)&&t.createElement(Wg,{className:"yt-fixedBundle-product-card-vertical_price--old"},nh(a.general.currencySymbol,h),th(w.compareAtPrice))))),(g<=3||!p)&&m<g-1&&t.createElement(sx,{className:"yt-fixedBundle-plus-wrapper"}," ",t.createElement(dx,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},Ux=({bundle:e,addToCartFunction:n})=>{const[r,o]=c(!1),[s,d]=c(window.innerWidth<786),[p,u]=c(null),[m,f]=c(!1),g="undefined"!=typeof window?window.location.href:null,x=e?.products?.find(e=>e.productDetails?.handle===g?.split("/").pop()?.split("?")[0]),h=x?.productId,y=i(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?1/0:0:1/0:0},[]),[b,v]=c(Object.fromEntries(e?.products?.map((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find(t=>y(e.productDetails,t?.node?.id)>0)?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id]))),w="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain),C=e?.showIndividualProductSelector||!0,[k,E]=c(new Set(e.products.reduce((e,t,n)=>(w&&t?.productId!==h&&!C||e.push(n),e),[])));l(()=>{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)}},[]),l(()=>{p&&h&&v(t=>{const n={...t};return e?.products?.forEach((e,t)=>{e.productId===h&&(n[t.toString()]=p)}),n})},[p,h,e?.products]),l(()=>{const e=()=>{d(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const S=a((e,t)=>{v(n=>({...n,[e.toString()]:t}))},[]),T=(t,n)=>{const r=e.products[n].productId;w&&C&&r===h||E(e=>{const r=new Set(e);return t?r.add(n):r.delete(n),r})},$=i(()=>(e,t)=>y(e.productDetails,t)>0,[y]),B=i(()=>e.products.some((e,t)=>k.has(t)&&e.productDetails.variants.edges.length>1),[e.products,k]),{originalPrice:z,dealPrice:I,offerValue:N}=i(()=>{const{price:t,compareAtPrice:n}=e.products.reduce((e,t,n)=>{if(!k.has(n))return e;const r=b[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}),r=Math.max(t,n);let o=Math.min(t,n);k.size===e.products.length&&(e?.percentageOff?o=t*(1-e.percentageOff/100):e?.dealAmount?o=e.dealAmount:e?.amountOff&&(o=t-e.amountOff));const a=n-o;return{originalPrice:r.toFixed(2),dealPrice:o.toFixed(2),offerValue:a.toFixed(2)}},[e.products,b,k,e.percentageOff,e.dealAmount,e.amountOff]),D=i(()=>e.products.map((e,t)=>({product:e,index:t})).filter(({index:e})=>k.has(e)),[e.products,k]),_=D.every(({product:e,index:t})=>$(e,b[t.toString()])),P=async e=>{if(_){e.preventDefault(),e.stopPropagation(),o(!0),f(!1);try{const e=Object.entries(b).map(([e,t])=>{const n=parseInt(e);return isNaN(n)||!k.has(n)?null:t}).filter(Boolean);n&&await n(Number(z),e)}catch(e){console.error("Error adding to cart:",e)}o(!1)}};if(!n)return t.createElement(t.Fragment,null);const F=e.customizations,O=F.fixedBundle?.cardLayoutStyle||"auto",A="horizontal"===O||"auto"===O&&s,M="bundles"==e.appName?e.pageHeader?.title:e?.title,R="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return t.createElement(_g,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:F.fixedBundle.sectionBackgroundColor,..."transparent"!==F.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},M&&t.createElement(Pg,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:F.fixedBundle?.titleBackgroundColor||"none",color:F.fixedBundle?.titleTextColor||"black",textAlign:F.fixedBundle.infoAlignment??"center",fontSize:F.fixedBundle?.titleFontSize,..."transparent"!==F.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===F.fixedBundle.infoAlignment&&"transparent"!==F.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===F.fixedBundle.infoAlignment&&"transparent"!==F.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===F.fixedBundle.infoAlignment&&"transparent"===F.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},M),R&&t.createElement(Fg,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:F.fixedBundle?.subtitleFontSize,textAlign:F.fixedBundle.infoAlignment??"center",..."left"===F.fixedBundle.infoAlignment&&"transparent"!==F.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===F.fixedBundle.infoAlignment&&"transparent"!==F.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===F.fixedBundle.infoAlignment&&"transparent"===F.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},R),A?t.createElement(Og,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},e?.products?.map((n,r)=>t.createElement(t.Fragment,{key:`${n.productId}-${r}`},t.createElement(qx,{isChecked:k.has(r),product:n.productDetails,selectedVariantId:b[r.toString()]||"",canCustomize:e?.canCustomizeFixedBundle||!1,styles:F,onVariantChange:e=>S(r,e),onCheckChange:e=>{T(e,r)},isMobile:s,index:r,isHorizontal:A,variantOptions:e.variantOptions,productsLength:e.products.length,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:h,variantId:p||void 0})))):t.createElement(Zg,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},t.createElement(Xg,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===F.fixedBundle.infoAlignment?"flex-start":"right"===F.fixedBundle.infoAlignment?"flex-end":"center"}},e?.products?.map((n,r)=>t.createElement(qx,{key:`${n.productId}-${r}`,isChecked:k.has(r),product:n.productDetails,selectedVariantId:b[r.toString()]||"",canCustomize:e?.canCustomizeFixedBundle||!1,styles:F,onVariantChange:e=>{console.log("variantId :",e),S(r,e)},onCheckChange:e=>T(e,r),isMobile:s,index:r,isHorizontal:A,productsLength:e.products.length,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:h,variantId:p||void 0})),B&&t.createElement(Vx,{productsWithIndices:D,isOpen:m,onClose:()=>f(!1),variantOptions:e.variantOptions,cta:{textColor:F.general.ctaTextColor,backgroundColor:F.general.ctaBackgroundColor},onVariantChange:S,handleAddToCart:P,primaryProductId:h,variantId:p||void 0}))),t.createElement(Hg,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===F.fixedBundle.infoAlignment?"flex-start":"right"===F.fixedBundle.infoAlignment?"flex-end":"center"}},Number(z)>0&&Number(N)>0&&F.fixedBundle.compareAtPriceVisibility&&t.createElement(qg,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",t.createElement(Qg,{className:"yt-fixedBundle-summary_price"},nh(F.general.currencySymbol,e?.storeCurrencyCode),th(z))),0!==k.size&&t.createElement(Ug,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",t.createElement(Qg,{className:"yt-fixedBundle-summary_price"},nh(F.general.currencySymbol,e?.storeCurrencyCode),th(I))," ",Number(N)>0&&t.createElement(Yg,{className:"yt-fixedBundle-summary_save-tag"},"Save:"," ",nh(F.general.currencySymbol,e?.storeCurrencyCode),th(N)))),t.createElement(Gg,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),A||!B?P(e):f(!0)},disabled:k.size<1||r||!_,style:{backgroundColor:F.general?.ctaBackgroundColor||"#121212",color:F.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${F.general?.ctaBackgroundColor||"#121212"}`,boxShadow:F.general.ctaShadowType,paddingTop:F.general?.ctaPadding,paddingBottom:F.general?.ctaPadding,borderRadius:F.general.ctaBorderRadius,width:F.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{F.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=F.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=F.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{F.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=F.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=F.general?.ctaTextColor||"#FFFFFF")}},r?t.createElement(da,{color:"white",loading:r,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):_?t.createElement(t.Fragment,null,F.fixedBundle?.ctaTitle??"Add Bundle to cart"):t.createElement(t.Fragment,null,"Out of Stock")))},Qx=()=>t.createElement(t.Fragment,null,t.createElement("style",null,"@keyframes spin { to { transform: rotate(360deg); } }"),t.createElement("div",{className:"yt-collection-bundle-loader-spinner",style:{width:"14px",height:"14px",border:"2px solid #f3f3f3",borderTop:"2px solid #007bff",borderRadius:"50%",animation:"spin 1s linear infinite",display:"block"}})),Yx=({product:e,tierIdx:n,isOpen:r,onClose:o,onAddToBundle:a,canAdd:i,isSelected:s,customizations:d,isMobile:p})=>{const[u,m]=c(0),[f,g]=c(e.variants[0].id.toString()),x=e.variants.find(e=>e.id.toString()===f)||e.variants[0],h=e.images.filter(Boolean);if(l(()=>(r&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=""}),[r]),l(()=>{if(x&&x?.featured_image?.src){const e=document.querySelector(".yt-collection-bundle-modal-image");e?.setAttribute("src",x?.featured_image?.src)}},[x]),!r)return null;const y=t.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:o},t.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()},t.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:o,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"}},t.createElement(ft,{size:22})),t.createElement("div",{className:"yt-collection-bundle-modal-image-container",style:{flex:1,position:"relative",margin:"20px 0 20px 20px",borderRadius:d?.borderRadius||"12px"}},h.length>0&&t.createElement("img",{className:"yt-collection-bundle-modal-image",src:rh(h[u]||e.images[0]),alt:e.title,style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:d?.borderRadius||"12px"}}),h.length>1&&t.createElement("div",{className:"yt-collection-bundle-modal-image-dots",style:{position:"absolute",bottom:16,left:"50%",transform:"translateX(-50%)",display:"flex",gap:8,background:"rgba(0,0,0,0.4)",padding:"6px 12px",borderRadius:20}},h.map((e,n)=>t.createElement("div",{key:n,className:"yt-collection-bundle-modal-image-dot",onClick:()=>m(n),style:{width:10,height:10,borderRadius:"50%",background:n===u?"#fff":"#fff8",cursor:"pointer",display:"block"}})))),t.createElement("div",{className:"yt-collection-bundle-modal-content",style:{flex:1,padding:"30px",overflowY:"auto",display:"flex",flexDirection:"column",scrollbarWidth:"none"}},t.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"6px 0",fontSize:24,fontWeight:600,lineHeight:"normal"}},e.title),e.variants.length>1&&t.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative"}},t.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee",lineHeight:"normal"}},e?.options?.join(" & "),":"," ",t.createElement("strong",null,x.title)),t.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:f,onChange:e=>g(e.target.value),style:{position:"absolute",inset:0,opacity:0,cursor:"pointer",lineHeight:"normal"}},e.variants.map(e=>t.createElement("option",{key:e.id,value:e.id,disabled:!e.available},e.title," ",!e.available&&"(Out of stock)")))),t.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0",lineHeight:"normal"}},"₹",(x.price/100).toFixed(0),x.compare_at_price&&x.compare_at_price>x.price&&t.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999",lineHeight:"normal"}},"₹",(x.compare_at_price/100).toFixed(0))),t.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"white"}},t.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!i?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>a(e,n),disabled:!i||!x.available,style:{width:"100%",padding:"12px",fontSize:17,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:x.available?s||!i?"#28a745":d?.atcBg||"#007bff":"rgb(204, 204, 204)",color:d?.atcText||"#fff",cursor:i&&x.available?"pointer":"not-allowed",textAlign:"center",lineHeight:"normal"}},s?"Added to Box":x.available?"Add to Box":"Out of Stock")),e.description&&t.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:e.description},style:{lineHeight:"normal",color:"#444",marginTop:"10px"}})))),b=t.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:o},t.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()},t.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:o,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"}},t.createElement(ft,{size:22})),t.createElement("div",{className:"yt-collection-bundle-modal-scroll-container",style:{flex:1,overflowY:"auto",paddingBottom:100}},h.length>0&&t.createElement("div",{className:"yt-collection-bundle-modal-image-wrapper",style:{position:"relative"}},t.createElement("img",{className:"yt-collection-bundle-modal-image",src:x.featured_image?.src||h[u]||e.images[0],alt:e.title,style:{width:"100%",display:"block",maxHeight:"50vh",objectFit:"cover",objectPosition:"center"}}),h.length>1&&t.createElement("div",{className:"yt-collection-bundle-modal-image-dots",style:{position:"absolute",bottom:16,left:"50%",transform:"translateX(-50%)",display:"flex",gap:8,background:"rgba(0,0,0,0.4)",padding:"6px 12px",borderRadius:20}},h.map((e,n)=>t.createElement("div",{key:n,className:"yt-collection-bundle-modal-image-dot",onClick:()=>m(n),style:{width:10,height:10,borderRadius:"50%",background:n===u?"#fff":"#fff8",cursor:"pointer"}})))),t.createElement("div",{className:"yt-collection-bundle-modal-content",style:{padding:"20px"}},t.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"0 0 12px",fontSize:22,fontWeight:600}},e.title),e.variants.length>1&&t.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative",marginBottom:20}},t.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee"}},"Variant: ",t.createElement("strong",null,x.title)),t.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:f,onChange:e=>g(e.target.value),style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}},e.variants.map(e=>t.createElement("option",{key:e.id,value:e.id,disabled:!e.available},e.title," ",!e.available&&"(Out of stock)")))),t.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0"}},"₹",(x.price/100).toFixed(0),x.compare_at_price&&x.compare_at_price>x.price&&t.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999"}},"₹",(x.compare_at_price/100).toFixed(0))),e.description&&t.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:e.description},style:{lineHeight:1.7,color:"#444"}}))),t.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)"}},t.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!i?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>a(e,n),disabled:!i||!x.available,style:{width:"100%",padding:"10px",fontSize:14,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:!s&&i&&x.available?d?.atcBg||"#007bff":"#28a745",color:d?.atcText||"#fff",cursor:i&&x.available?"pointer":"not-allowed"}},s?"Added to Box":x.available?"Add to Box":"Out of Stock"))));return v.createPortal(p?b:y,document.body)},Gx=({title:e,uploadState:n,onUpload:r,onRemove:o,onRetry:a})=>{const i="object"==typeof n&&n?.loading,l="object"==typeof n&&n?.error,c="object"==typeof n&&n?.url;return t.createElement("div",{className:"yt-collection-bundle-upload-field",style:{padding:"20px",border:"2px dashed #ccc",borderRadius:"8px",textAlign:"center",background:"#fafafa"}},t.createElement("div",{className:"yt-collection-bundle-upload-title",style:{fontWeight:500,color:"#333",marginBottom:"4px"}},e),i&&t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-collection-bundle-upload-loading",style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",color:"#007bff",fontSize:"13px",margin:"12px 0"}},t.createElement(Qx,null)," Uploading ",n?.name,"...")),l&&t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-collection-bundle-upload-error",style:{color:"#dc3545",fontSize:"13px",margin:"8px 0"}},"Upload failed. Try again."),t.createElement("button",{type:"button",className:"yt-collection-bundle-upload-retry-btn",onClick:a,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Retry Upload")),c&&!i&&!l&&t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-collection-bundle-upload-image-container",style:{margin:"12px 0"}},t.createElement("img",{className:"yt-collection-bundle-upload-image",src:n.url,alt:"Uploaded",style:{maxWidth:"100%",maxHeight:"150px",borderRadius:"6px"}})),t.createElement("div",{className:"yt-collection-bundle-upload-filename",style:{fontSize:"12px",color:"#28a745",marginBottom:"8px"}},n.name),t.createElement("button",{type:"button",className:"yt-collection-bundle-upload-remove-btn",onClick:o,style:{background:"#dc3545",color:"white",border:"none",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",cursor:"pointer"}},"Remove")),!n&&t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-collection-bundle-upload-hint",style:{color:"#888",fontSize:"12px",marginBottom:"12px"}},"jpeg/png (max 5MB)"),t.createElement("button",{type:"button",className:"yt-collection-bundle-upload-btn",onClick:r,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Upload")))},Zx=({config:e,bundleAddToCartLoading:n,addCustomBundleToCart:r})=>{const[i,s]=c(1),[d,p]=c([]),[u,m]=c(null),[f,g]=c({}),[x,h]=c(window.innerWidth<640),[y,b]=c({}),v=o(new Map),[w,C]=c(!1),k=o(null),E=o(new Map),[S,T]=c(160),$=x?8:20,{customizations:B}=e,z=e.config.builderTiers.collectionTier.sort((e,t)=>e.tier-t.tier),I=!!e.config.form,N=z.length+(I?1:0),D=B.hideSelectedProducts,_=B.allowMultipleQty,P=B.hideOutOfStockProducts,F=e=>z[e-1]?.products||[],O=a(e=>{const t=F(e),n=P?t.filter(e=>e.available).length:t.length;b(t=>{const r=t[e]||0,o=Math.min(r+8,n);return o<=r?t:{...t,[e]:o}})},[8,P]);l(()=>(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===i&&O(e)}},{root:null,threshold:0,rootMargin:"100px 0px"}),()=>{k.current?.disconnect()}),[O,i]),l(()=>{if(I&&i===N)return;const e=i,t=F(e);if(0===t.length)return;const n=P?t.filter(e=>e.available).length:t.length;if(0===(y[e]||0)){const t=Math.min($,n);b(n=>({...n,[e]:t}))}},[i,$,P,y]),l(()=>{const e=document.querySelector(".box-loader-scene");e&&e.setAttribute("style","display: none;");const t=()=>h(window.innerWidth<640);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const A=a(e=>{T(e+10)},[]),M=d.reduce((e,t)=>e+t.quantity,0),R=d.reduce((e,t)=>e+t.price*t.quantity,0)/100,L=d.reduce((e,t)=>{const n=z.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)/100,j=(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())},V=(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());p(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=q[t],c=W(t);return c!==1/0&&l>=c?n:[...n,{productId:e.id.toString(),variantId:r,price:o,quantity:1,tierIndex:t}]})},W=e=>{const t=z[e];return t.maximumQuantity>0?t.maximumQuantity:1/0},H=(e,t)=>{const n=W(t);if(n===1/0)return!0;const r=q[t],o=d.some(n=>n.productId===e.id.toString()&&n.tierIndex===t);return!!o||r<n},q=z.map((e,t)=>d.filter(e=>e.tierIndex===t).reduce((e,t)=>e+t.quantity,0)),U=(e,t,n)=>{const r=W(n);if(r===1/0)return!0;return q[n]<r},Q=e=>{if(!v.current.has(e)){const t=document.createElement("input");t.type="file",t.accept="image/jpeg,image/png",t.style.display="none",t.onchange=async t=>{const n=t.target.files?.[0];if(n){if(n.size>5242880)return alert("Max 5MB");if(!n.type.match(/^image\/(jpeg|png)$/i))return alert("JPEG/PNG only");g(t=>({...t,[e]:{loading:!0,name:n.name}}));try{const t=await(async e=>{const t=new FormData;t.append("file",e),C(!0);try{const e=window?.Shopify?.shop||"falah-devstore.myshopify.com",n=window?.Shopify?.shop?"https://products.yourtoken.io":"http://localhost:8000",r=await fetch(`${n}/shopify/upload?shop=${e}`,{method:"POST",headers:{"x-yourtoken-app-name":"bundles"},body:t});if(!r.ok)throw new Error("Upload failed");return(await r.json()).url}catch(e){throw C(!1),alert("Upload failed. Try again."),e}finally{C(!1)}})(n);g(r=>({...r,[e]:{url:t,name:n.name}}))}catch{g(t=>({...t,[e]:{error:!0,name:n.name}}))}}},document.body.appendChild(t),v.current.set(e,t)}return v.current.get(e)},Y=I&&i===N,G=(Y?null:z[i-1])?W(i-1):0,Z=z.map((e,t)=>{const n=d.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},[]);return{tier:e,items:n,count:q[t]}});return t.createElement("div",{className:"yt-collection-bundle-builder",style:{margin:"0 auto",maxWidth:"1600px"}},B.headerImage&&!B.headerImage.includes("Liquid error")&&t.createElement("img",{className:"yt-collection-bundle-header-img",src:B.headerImage,alt:"Collection Bundle header",style:{width:"100%"}}),B.showTierSteps&&t.createElement("div",{style:{paddingTop:B.headerImage&&!B.headerImage.includes("Liquid error")?"20px":"0"}},t.createElement(Xx,{totalSteps:N,isFormStep:Y,currentStep:i,getStepTitle:e=>I&&e===N?"Customize Gift Details":z[e-1]?.title||`Step ${e}`,isMobile:x,formTitle:e?.config?.form?.title,hasForm:I,onStepClick:e=>{if(e>1&&!d.length)return alert("Add at least one product first");s(e),window.scrollTo(0,0)}})),Array.from({length:N},(e,t)=>t+1).map(n=>{const r=I&&n===N,o=r?[]:F(n),a=P?o.filter(e=>e.available):o,l=n-1,c=a.slice(0,y[n]||0);return t.createElement("div",{key:n,className:"yt-collection-bundle-step-content "+(i===n?"yt-collection-bundle-step-content-active":""),style:{display:i===n?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},r&&e.config.form?t.createElement("div",{className:"yt-collection-bundle-customize-form",style:{maxWidth:"80%",margin:"0 auto",padding:"1rem",marginBottom:`${S}px`}},e?.config?.form?.sections?.map((e,n)=>t.createElement("div",{key:`sec_${n}`,className:"yt-collection-bundle-form-group",style:{marginBottom:"32px"}},t.createElement("label",{className:"yt-collection-bundle-label",style:{display:"block",fontWeight:600,marginBottom:"12px",color:"#333",fontSize:"16px",lineHeight:"normal"}},e?.title),"text"===e.type&&t.createElement("div",{className:"yt-collection-bundle-form-fields",style:{display:"flex",flexDirection:"column",gap:"12px"}},e.fields.map((e,n)=>{const r=e?.title??"Field "+n;return t.createElement("textarea",{key:r,className:"yt-collection-bundle-textarea",placeholder:e?.title,rows:3,maxLength:500,onChange:e=>g(t=>({...t,[r]:e.target.value})),style:{padding:"12px",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px",resize:"vertical",lineHeight:"normal"}})})),"image"===e.type&&t.createElement("div",{className:"yt-collection-bundle-image-section",style:{marginBottom:"24px"}},t.createElement("sub",{className:"yt-collection-bundle-upload-hint",style:{display:"block",color:"#666",fontSize:"12px",marginBottom:"8px",lineHeight:"normal"}},"jpeg/png (max 5MB)"),t.createElement("div",{className:"yt-collection-bundle-form-fields",style:{display:"flex",flexDirection:"column",gap:"16px"}},e.fields.map((e,n)=>{const r=e?.title??"Field "+n,o=f[r];return t.createElement(Gx,{key:r,title:e?.title,uploadState:o,onUpload:()=>Q(r).click(),onRemove:()=>g(e=>{const{[r]:t,...n}=e;return n}),onRetry:()=>Q(r).click()})})))))):t.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:x?"grid":"flex",gridTemplateColumns:x?"repeat(2,1fr)":"",flexWrap:x?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:`${S}px`}},c.map(e=>t.createElement(Kx,{key:e.id,product:e,tierIdx:l,customizations:B,isMobile:x,hoveredCard:u,setHoveredCard:m,selectedProducts:d,handleAddToBundle:V,canAddProduct:H,allowMultipleQty:_,handleVariantChange:j,canIncrement:U,setSelectedProducts:p})),i===n&&(y[n]||0)<a.length&&t.createElement("div",{ref:e=>{const t=E.current.get(n);t&&k.current?.unobserve(t),e?(E.current.set(n,e),k.current?.observe(e)):E.current.delete(n)},"data-sentinel-step":n.toString(),style:{height:"20px",width:"100%",display:"block"}})))}),t.createElement(Jx,{config:e,selectedProducts:d,selectedByTier:Z,totalItems:M,totalPrice:R,totalCompareAtPrice:L,currentStep:i,totalSteps:N,currentTierMax:G,tierSelectedCounts:q,isMobile:x,bundleAddToCartLoading:n,isUploading:w,hoveredCard:u,setHoveredCard:m,hideSelectedProducts:D,getProductStep:e=>{for(let t=0;t<z.length;t++)if(z[t].products.some(t=>t.id.toString()===e))return t+1;return I?N:z.length},setCurrentStep:s,handleRemoveItem:(e,t,n)=>{p(r=>r.filter(r=>!(r.productId===e&&r.variantId===t&&r.tierIndex===n)))},handleCheckout:async()=>{if(i!==N||!d.length)return;const e={};I&&Object.entries(f).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=d.map(t=>({variantId:t.variantId,quantity:t.quantity,properties:e}));r(t)},hasForm:I,onHeightChange:A}))},Xx=({totalSteps:e,isFormStep:n,currentStep:r,getStepTitle:o,isMobile:a,formTitle:i,hasForm:l,onStepClick:c})=>t.createElement("div",{className:"yt-collection-bundle-steps-nav-container",style:{display:"flex",justifyContent:"center",flexDirection:"column",gap:a?"0":"1rem",overflowX:"auto",scrollbarWidth:"none",borderBottom:"1px solid #878787",marginInline:a?"0":"2%",paddingBottom:"1rem",textAlign:"center"}},t.createElement("div",{className:"yt-collection-bundle-steps-nav",style:{display:"flex",justifyContent:"center",gap:a?"0":"2rem",overflowX:"auto",scrollbarWidth:"none"}},Array.from({length:e},(e,t)=>t+1).map(n=>t.createElement("div",{key:n,className:"yt-collection-bundle-step-item "+(r===n?"yt-collection-bundle-step-item-active":""),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.5rem",minWidth:"120px",cursor:"pointer",opacity:r===n?1:.5,transition:"opacity 0.2s"},onClick:()=>c(n)},t.createElement("div",{className:"yt-collection-bundle-step-icon "+(r===n?"yt-collection-bundle-step-icon-active":""),style:{width:"40px",height:"40px",background:r===n?"#000":"#fff",border:"2px solid #ccc",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center"}},l&&n===e?t.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},t.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"})):t.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},t.createElement("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}))),t.createElement("div",{className:"yt-collection-bundle-step-label",style:{fontSize:"14px",textAlign:"center",color:"#333",fontWeight:"600",lineHeight:"normal"}},o(n))))),i&&l&&n&&t.createElement("p",{className:"yt-collection-bundle-steps-nav-description",style:{fontSize:a?"14px":"16px",marginBottom:a?"0":"14px",fontWeight:"400",color:"#000",lineHeight:"normal"}},i)),Kx=({product:e,tierIdx:n,customizations:r,isMobile:o,hoveredCard:a,setHoveredCard:i,selectedProducts:l,handleAddToBundle:s,canAddProduct:d,allowMultipleQty:p,handleVariantChange:u,canIncrement:m,setSelectedProducts:f})=>{const[g,x]=c(!1),h=document.querySelector(`[data-product-id="${e.id}"]`),y=h?.dataset.selectedVariant||e.variants[0].id.toString(),b=e.variants.find(e=>e.id.toString()===y)||e.variants[0],v=l.some(t=>t.productId===e.id.toString()&&t.variantId===y&&t.tierIndex===n),w=a===e.id,C=l.filter(t=>t.productId===e.id.toString()&&t.variantId===b.id.toString()&&t.tierIndex===n).reduce((e,t)=>e+t.quantity,0);return t.createElement(t.Fragment,null,t.createElement("div",{key:e.id,className:"yt-collection-bundle-product-item","data-product-id":e.id,"data-selected-variant":b.id,"data-current-price":b.price,style:{display:"flex",flexDirection:"column",border:r?.productCardBorder||"1px solid #ddd",background:r?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:o?0:"250px",maxWidth:o?"none":"250px",borderRadius:r?.borderRadius||"8px",boxShadow:"spread"===r?.productCardShadow?"8px 8px 8px -6px #0000004D":"no-spread"===r?.productCardShadow?"6px 6px 0px -1px #00000033":"none",width:o?"100%":""}},t.createElement("div",{className:"yt-collection-bundle-product-image",style:{position:"relative",width:"100%",aspectRatio:r?.productImageRatio||"1/1",overflow:"hidden",cursor:"pointer",background:"#f9f9f9"},onClick:()=>x(!0),onMouseEnter:()=>i(e.id),onMouseLeave:()=>i(null)},t.createElement("img",{src:rh(e.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:w?0:1,transform:w?"scale(1.05)":"scale(1)"},alt:e.title}),t.createElement("img",{src:rh(e.images[1]||e.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:w?1:0,transform:"scale(1.05)"},alt:e.title}),e.variants.length>1&&t.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:t=>u(e,t.target.value),defaultValue:b.id,onClick:e=>{e.stopPropagation()}},e.variants.map(e=>t.createElement("option",{key:e.id,value:e.id,disabled:!e.available},e.title," ",!e.available&&"(Out of stock)")))),t.createElement("div",{className:"yt-collection-bundle-product-info",style:{padding:"12px",flexGrow:1,display:"flex",flexDirection:"column"}},t.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:o?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:"normal",color:"#333",flexGrow:1}},e.title),t.createElement("div",{className:"yt-collection-bundle-product-prices",style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"nowrap",whiteSpace:"nowrap",overflow:"hidden",lineHeight:"normal"}},t.createElement("span",{className:"yt-collection-bundle-product-price",style:{fontSize:o?"14px":"16px",fontWeight:"bold",color:"#000",flexShrink:0,lineHeight:"normal"}},"₹",(b.price/100).toFixed(0)),b.compare_at_price&&b.compare_at_price>b.price&&t.createElement("span",{className:"yt-collection-bundle-product-compare",style:{fontSize:"14px",textDecoration:"line-through",color:"#999",flexShrink:0,lineHeight:"normal"}},"₹",(b.compare_at_price/100).toFixed(0)))),p&&C>0?t.createElement("div",{className:"yt-collection-bundle-quantity-row",style:{display:"flex",alignItems:"center",flexWrap:"nowrap",background:"#cccccc"}},t.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-minus",style:{width:"40%",height:b.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:o?"6px":"12px",fontSize:o?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{f(t=>{const r=`${e.id}-${b.id}-${n}`,o=t.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===r);return o&&o.quantity>1?t.map(e=>e===o?{...e,quantity:e.quantity-1}:e):o?t.filter(e=>e!==o):t})}},"-"),t.createElement("span",{className:"yt-collection-bundle-qty-display",style:{minWidth:"24px",textAlign:"center",fontWeight:600,width:"100%",lineHeight:"normal"}},C),t.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-plus",style:{width:"40%",height:b.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:o?"6px":"12px",fontSize:o?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{b.available&&m(e,b.id.toString(),n)&&f(t=>{const r=`${e.id}-${b.id}-${n}`,o=t.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===r);return o?t.map(e=>e===o?{...e,quantity:e.quantity+1}:e):[...t,{productId:e.id.toString(),variantId:b.id.toString(),price:b.price,quantity:1,tierIndex:n}]})},disabled:!b.available||!m(e,b.id.toString(),n)},"+")):t.createElement("button",{className:"yt-collection-bundle-add-btn "+(v?"yt-collection-bundle-add-btn-added":""),style:{background:v?"#28a745":d(e,n)&&b.available?r?.atcBg||"#007bff":"#ccc",color:r?.atcText||"#fff",border:"none",padding:o?"6px":"12px",fontSize:o?"12px":"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",opacity:b.available?1:.6,lineHeight:"normal",textAlign:"center"},onClick:()=>{b.available&&d(e,n)&&s(e,n)},disabled:!b.available||!d(e,n)},v?"Added":b.available?"ADD TO BOX":"Out of Stock")),g&&t.createElement(Yx,{product:e,tierIdx:n,isOpen:g,onClose:()=>x(!1),onAddToBundle:(e,t)=>{s(e,t),x(!1)},canAdd:d(e,n),isSelected:v,customizations:r,isMobile:o}))},Jx=e=>{const{config:n,selectedProducts:r,selectedByTier:a,totalItems:i,totalPrice:s,totalCompareAtPrice:d,currentStep:p,totalSteps:u,currentTierMax:m,tierSelectedCounts:f,isMobile:g,bundleAddToCartLoading:x,isUploading:h,hoveredCard:y,setHoveredCard:b,getProductStep:v,setCurrentStep:w,handleRemoveItem:C,handleCheckout:k,hasForm:E,onHeightChange:S}=e,{customizations:T}=n,[$,B]=c(!1),z=o(null),I=o(null),{totalOriginal:N,hasSavings:D,formattedSavings:_,totalAfterDiscount:P}=(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)/100,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),n=t.discountValue/100;i=a*(1-n)}}n+=i});const r=Math.round(t-n),o=r>0;return{savings:r,totalOriginal:t,totalAfterDiscount:n,hasSavings:o,formattedSavings:o?`₹${r.toLocaleString()}`:"",calculatedDiscountedTotal:Math.round(n)}})(a),F=a.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)/100;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 ₹${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=`₹${e.discountValue} OFF`;break;case"fixed_price_collection":t=`Fixed ₹${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=`₹${l.discountValue} OFF`;break;case"fixed_price_collection":n=`Fixed ₹${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 l(()=>{const e=m!==1/0&&f[p-1]===m-2&&m>1;let t=null;return e?(B(!0),t=setTimeout(()=>{B(!1)},3e3)):B(!1),()=>{t&&clearTimeout(t)}},[m,f,p]),l(()=>{if(z.current&&S){const e=z.current.offsetHeight;S(e)}},[g,S,r]),l(()=>{const e=Math.max(...a.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<(I.current??0)&&(I.current=e),e>(I.current??0)){I.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;ro({particleCount:100,spread:70,origin:{x:r,y:o},zIndex:9999})}},[a]),t.createElement("div",{ref:z,className:"yt-collection-bundle-bar",style:{background:T?.bundleBg||"#fff",color:T?.bundleText||"#333",border:T?.bundleBorder||"1px solid #878787",display:"flex",flexDirection:"column",position:"fixed",bottom:"10px",left:"50%",transform:"translateX(-50%)",width:"compact"==T.stickyBarWidth?"600px":"90%",maxWidth:"95%",zIndex:899,boxShadow:"0 -2px 10px rgba(0,0,0,0.1)",transition:"bottom 0.3s ease",borderRadius:T?.borderRadius||"8px",overflow:"hidden"}},F.length>0&&t.createElement("div",{style:{padding:"4px 8px",background:"#dbdbdbc5",color:"#6c757d",textAlign:"center",fontSize:"12px",fontWeight:500}},F.join(" + ")),t.createElement("div",{className:"yt-collection-bundle-bar-header",style:{position:"relative",textAlign:"center"}},$&&t.createElement(t.Fragment,null,t.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 "),t.createElement("div",{className:"yt-collection-bundle-ctx",style:{position:"absolute",top:"-40px",left:"50%",transform:"translateX(-50%)",background:T?.atcBg||"#007bff",color:T?.atcText||"#fff",padding:"4px 8px",borderRadius:T?.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"," ",t.createElement("span",{style:{fontWeight:600}},m," item",m>1?"s":"")))),r.length>0&&t.createElement("div",{className:"yt-collection-bundle-bar-top",style:{display:"flex",alignItems:"center",padding:"8px 8px 0",position:"relative",borderRadius:T?.borderRadius||"8px"}},t.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"}},a.filter(({count:e})=>e>0).map(({items:e},r,o)=>t.createElement(t.Fragment,{key:r},t.createElement("div",{className:"yt-collection-bundle-tier-images",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",minWidth:"fit-content"}},t.createElement("div",{style:{display:"flex",gap:"4px"}},e.map((e,o)=>{const a=n.config.builderTiers.collectionTier.flatMap(e=>e.products).find(t=>t.id.toString()===e.productId);if(!a)return null;const i=v(e.productId),l=p===i;return t.createElement("div",{key:o,className:"yt-collection-bundle-img-wrapper",style:{position:"relative",flexShrink:0,height:"65px"}},t.createElement("div",{style:{position:"relative",width:"67px",height:"67px",borderRadius:`calc(${T?.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&&w(i)},t.createElement("img",{src:rh(a.images[0]),style:{width:"65px",height:"65px",objectFit:"cover",borderRadius:`calc(${T?.borderRadius||"8px"} / 2)`,transition:"opacity 0.2s",pointerEvents:"none",border:"1px solid #ddd"},alt:"Selected"}),e.quantity>1&&t.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",e.quantity),t.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:t=>{t.stopPropagation(),C(e.productId,e.variantId,r)}},"×")))}))),r<o.length-1&&o[r+1].count>0&&t.createElement("div",{style:{color:"#666",paddingInline:"6px",lineHeight:"normal"}},t.createElement(ut,null)))))),g?t.createElement("div",{className:"yt-collection-bundle-mobile-bar-content",style:{display:"flex",flexDirection:i>0&&(E||n?.config?.builderTiers?.collectionTier?.length>1)?"column":"row",margin:"4px",gap:i>0?"10px":"0",background:"#dbdbdb",borderRadius:T?.borderRadius||"8px",overflow:"hidden"}},t.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:r.length>0?"space-between":"center",alignItems:"center",borderRadius:T?.borderRadius||"8px"}},t.createElement(t.Fragment,null,0===i&&t.createElement("div",{style:{fontSize:"14px",color:"#6c757d",lineHeight:"normal",...0===i&&{padding:"8px 0 12px 0",background:"#dbdbdb",color:"#6c757d",width:"100%",borderRadius:T?.borderRadius||"8px"}}},"Add Items to Checkout"),i>0&&t.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",justifyContent:"center",flexWrap:"wrap"}},t.createElement("div",{style:{fontSize:"14px",color:"#000",fontWeight:600}},"₹",(P??s).toLocaleString()),D?t.createElement(t.Fragment,null,t.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",N.toLocaleString()),t.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:T?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",_)):t.createElement(t.Fragment,null,d>s&&t.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",d.toLocaleString())),t.createElement("span",{style:{fontSize:"12px",color:"#000",fontWeight:500}},"(",i," items)")))),t.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"4px"}},(n?.config?.builderTiers?.collectionTier?.length>1||E)&&i>0&&t.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:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>b(-1),onMouseLeave:()=>b(null),disabled:1===p},"Back"),i>0&&t.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===i||h?"yt-collection-bundle-next-btn-disabled":""),style:{background:T?.btnPrimaryBg||"#28a745",color:T?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",opacity:p===u&&0===i||h?.6:1,textAlign:"center",lineHeight:"normal"},onClick:p===u?k:()=>w(p+1),disabled:p===u&&0===i||x||h},x?t.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},t.createElement(Qx,null)):p===u?"Checkout":"Next"))):t.createElement("div",{className:"yt-collection-bundle-bar-bottom",style:{display:"flex",alignItems:"center",padding:"0px",background:"#dbdbdb",margin:"8px",borderRadius:T?.borderRadius||"8px",overflow:"hidden",scrollbarWidth:"none"}},(n?.config?.builderTiers?.collectionTier?.length>1||E)&&i>0&&t.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===y&&{filter:"brightness(60%)"},textAlign:"center",lineHeight:"normal"},onClick:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>b(-1),onMouseLeave:()=>b(null),disabled:1===p},"Back"),t.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:r.length>0?"space-between":"center",paddingInline:"6px",alignItems:"center",...0===i&&{padding:"12px 24px"}}},0===i&&t.createElement("div",{style:{fontSize:"16px",color:"#6c757d",lineHeight:"normal"}},"Add Items to Checkout"),i>0&&t.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",justifyContent:"center"}},t.createElement("div",{style:{fontSize:"16px",color:"#000",fontWeight:600}},"₹",(P??s).toLocaleString()),D?t.createElement(t.Fragment,null,t.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",N.toLocaleString()),t.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:T?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",_)):t.createElement(t.Fragment,null,d>s&&t.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",d.toLocaleString())),t.createElement("span",{style:{fontSize:"16px",color:"#000",fontWeight:500}},"(",i," items)"))),i>0&&t.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===i||h?"yt-collection-bundle-next-btn-disabled":""),style:{background:T?.btnPrimaryBg||"#28a745",color:T?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",opacity:p===u&&0===i||h?.6:1,...-2===y&&{filter:"brightness(90%)"},textAlign:"center",lineHeight:"normal"},onClick:p===u?k:()=>w(p+1),disabled:p===u&&0===i||x||h,onMouseEnter:()=>b(-2),onMouseLeave:()=>b(null)},x?t.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},t.createElement(Qx,null)):p===u?"Checkout":"Next")))},eh=window?.Shopify?.currency||{rate:1,active:"INR"},th=e=>{if(!e)return;const t=navigator.language||"en-US",n=Number((Number(e)*eh.rate).toFixed(2));return new Intl.NumberFormat(t).format(n)},nh=(e,t)=>t==eh.active?e:Bn(eh.active)||eh.active,rh=(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"}`}},oh=(e,t,n,r,o,a)=>{const i=r.findIndex(t=>t.variantId===e);o(0===n?e=>e.filter((e,t)=>t!==i):-1===i?r=>[...r,{product:t,variantId:e,quantity:n,isFree:a}]:e=>e.map((e,t)=>t===i?{...e,quantity:e.quantity+n,isFree:a}:e))},ah=({bundle:e,currentProductId:n,addToCartFunction:r,addCustomBundleToCart:o,selectedItems:a,setSelectedItems:i,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:s,renderingOnPage:d,bundleSubtotal:p})=>"fixed"!==e.type&&e.type&&0!==e?.type?.length?"builder"===e.type?t.createElement(vf,{bundleAddToCartLoading:l,bundle:e,selectedItems:a,setSelectedItems:i,handleAddToCart:o,handleRemoveItem:c,renderingOnPage:d,selectedItemsQuantity:s??0,bundleSubtotal:p??{price:0,compareAtPrice:0}}):"combo"===e.type?t.createElement(Cf,{bundle:e,addToCartFunction:r}):"mixAndMatch"===e.type?t.createElement(Dg,{bundle:e,addToCartFunction:r}):"collection"===e.type?t.createElement(Zx,{config:e,addCustomBundleToCart:o,bundleAddToCartLoading:l}):t.createElement(Jf,{bundle:e,currentProductId:n,addToCartFunction:r}):t.createElement(Ux,{addToCartFunction:r,bundle:e});q(".scene {\n width: 100%;\n height: 60vh;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.floating {\n animation: float 3s ease-in-out infinite;\n}\n\n@keyframes float {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(-10px);\n }\n}\n.cube {\n position: relative;\n width: 50px;\n height: 50px;\n transform-style: preserve-3d;\n transform: rotateX(-45deg) rotateY(50deg) rotateZ(0deg);\n}\n\n.side,\n.lid,\n.flap {\n position: absolute;\n width: 100px;\n height: 100px;\n border: 4px solid #333366;\n background: transparent;\n box-sizing: border-box;\n}\n\n.side {\n background: #fff;\n backface-visibility: hidden;\n}\n\n.side.front {\n transform: translateZ(50px);\n}\n\n.side.back {\n transform: rotateY(180deg) translateZ(50px);\n}\n\n.side.left {\n transform: rotateY(-90deg) translateZ(50px);\n}\n\n.side.right {\n transform: rotateY(90deg) translateZ(50px);\n}\n\n.side.bottom {\n transform: rotateX(-90deg) translateZ(50px);\n}\n\n.lid {\n transform: rotateX(90deg) translateZ(50px);\n transform-style: preserve-3d;\n}\n\n.flap.north {\n top: 0;\n left: 0;\n width: 100%;\n height: 50%;\n transform-origin: top center;\n animation: openNorth 3s ease-in-out infinite;\n}\n\n.flap.south {\n bottom: 0;\n left: 0;\n width: 100%;\n height: 50%;\n transform-origin: bottom center;\n animation: openSouth 3s ease-in-out infinite;\n}\n\n.flap.east {\n top: 0;\n right: 0;\n width: 50%;\n height: 100%;\n transform-origin: right center;\n animation: openEast 3s ease-in-out infinite;\n}\n\n.flap.west {\n top: 0;\n left: 0;\n width: 50%;\n height: 100%;\n transform-origin: left center;\n animation: openWest 3s ease-in-out infinite;\n}\n\n@keyframes openNorth {\n 0%, 100% {\n transform: rotateX(0deg);\n }\n 50% {\n transform: rotateX(180deg);\n }\n}\n@keyframes openSouth {\n 0%, 100% {\n transform: rotateX(0deg);\n }\n 50% {\n transform: rotateX(-180deg);\n }\n}\n@keyframes openEast {\n 0%, 100% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(180deg);\n }\n}\n@keyframes openWest {\n 0%, 100% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(-180deg);\n }\n}");const ih=()=>t.createElement("div",{className:"scene"},t.createElement("div",{className:"floating"},t.createElement("div",{className:"cube"},t.createElement("div",{className:"side front"},""),t.createElement("div",{className:"side back"},""),t.createElement("div",{className:"side left"},""),t.createElement("div",{className:"side right"},""),t.createElement("div",{className:"side bottom"},""),t.createElement("div",{className:"lid"},t.createElement("div",{className:"flap north"},""),t.createElement("div",{className:"flap south"},""),t.createElement("div",{className:"flap east"},""),t.createElement("div",{className:"flap west"},""))))),lh=({showPopup:e,selectedOffer:n,selectedOfferTerms:r,onClose:o,offersConfig:a})=>{if(!e||!n||!r)return null;const i=t.createElement("div",{className:"yt-product-offers-isolated",style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2147483647},onClick:o},t.createElement("div",{style:{width:"90vw",minWidth:"375px",maxWidth:"480px",maxHeight:"90vh",backgroundColor:"#fff",borderRadius:"12px",padding:"16px",boxShadow:"0 4px 15px rgba(0,0,0,0.3)",position:"relative",flexDirection:"column",display:"flex"},onClick:e=>e.stopPropagation()},t.createElement("img",{src:"https://feature-products-offers.shopify-product-blocks.pages.dev/assets/confetti.jpg",alt:"confetti",style:{width:"100%",height:"clamp(150px, 20vh, 230px)",objectFit:"cover",objectPosition:"top",borderTopLeftRadius:"12px",borderTopRightRadius:"12px",marginBottom:"10px",flexShrink:0}}),t.createElement("div",{style:{fontSize:"clamp(32px, 8vw, 40px)",color:"#4C4C4C",marginTop:"clamp(-150px, -20vh, -200px)",marginBottom:"8px",display:"flex",justifyContent:"center",position:"relative"}},t.createElement(H,null)),t.createElement("div",{style:{fontSize:"clamp(16px, 4vw, 20px)",fontWeight:500,color:"#4C4C4C",lineHeight:"normal",textAlign:"center"}},n.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")),t.createElement("div",{style:{fontSize:"clamp(28px, 7vw, 40px)",fontWeight:"600",color:a?.textColor||"#EE8E35",lineHeight:"normal",textAlign:"center"}},n.name),t.createElement("div",{style:{fontSize:"clamp(16px, 4vw, 20px)",color:"#000000",textAlign:"center",fontWeight:500}},r.offerMessage),t.createElement("hr",{style:{border:"none",height:"2px",width:"100%",margin:"10px 0 18px 0",backgroundColor:"transparent",backgroundImage:"repeating-linear-gradient(to right, #ccc 0, #ccc 12px, transparent 12px, transparent 20px)",backgroundSize:"100% 2px",backgroundPosition:"0 0",backgroundRepeat:"repeat-x"}}),t.createElement("div",{style:{marginTop:"15px",fontSize:"clamp(14px, 3.5vw, 16px)",textAlign:"center",display:"flex",flexDirection:"column"}},t.createElement("strong",{style:{color:"#888"}},"Terms & Conditions"),t.createElement("ul",{style:{marginTop:"5px",paddingLeft:"20px",textAlign:"left",display:"inline-block",color:"#000",lineHeight:"1.3",marginBottom:"0"}},r.terms.map((e,n)=>t.createElement("li",{key:n,style:{marginBottom:"4px"}},e)))),t.createElement("button",{onClick:o,style:{width:"100%",padding:"10px 20px",marginTop:"10px",backgroundColor:"#fff",border:"none",borderTop:"1px solid #ddd",borderRadius:"0",fontSize:"16px",fontWeight:"600",color:"#333",cursor:"pointer",textAlign:"center",flexShrink:0}},"Close")));return w(i,document.body)},ch=({showPopup:e,selectedOffer:n,selectedOfferTerms:r,onClose:o,offersConfig:a})=>{if(!e||!n||!r)return null;const i=t.createElement("div",{className:"yt-product-offers-isolated",style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"flex-end",justifyContent:"center",zIndex:2147483647,animation:"fadeIn 0.3s ease"},onClick:o},t.createElement("style",null,"\n @keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n @keyframes slideUp {\n from { transform: translateY(100%); }\n to { transform: translateY(0); }\n }\n "),t.createElement("div",{style:{width:"100%",maxHeight:"85vh",backgroundColor:"#fff",borderTopLeftRadius:"20px",borderTopRightRadius:"20px",borderTop:"1px solid #E5E5E5",position:"relative",flexDirection:"column",display:"flex",animation:"slideUp 0.3s ease",overflow:"hidden"},onClick:e=>e.stopPropagation()},t.createElement("div",{style:{width:"40px",height:"4px",backgroundColor:"#ddd",borderRadius:"2px",margin:"12px auto 16px",flexShrink:0}}),t.createElement("div",{style:{overflowY:"auto",flex:1}},t.createElement("div",{style:{padding:"0 20px 20px",backgroundColor:"#fff"}},t.createElement("div",{style:{fontSize:"48px",color:"#4C4C4C",display:"flex",justifyContent:"center",margin:"16px"}},t.createElement(H,null)),t.createElement("div",{style:{fontSize:"14px",fontWeight:500,color:"#888",textAlign:"center"}},n.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")),t.createElement("div",{style:{fontSize:"32px",fontWeight:"700",color:a?.textColor||"#EE8E35",textAlign:"center",lineHeight:"1.2"}},n.name),t.createElement("div",{style:{fontSize:"18px",color:"#000000",textAlign:"center",fontWeight:500}},r.offerMessage)),t.createElement("div",{style:{backgroundColor:"#F5F5F5",padding:"16px 20px"}},t.createElement("div",{style:{fontSize:"16px",fontWeight:"600",color:"#333",textAlign:"center"}},"Terms & Conditions")),t.createElement("div",{style:{padding:"20px",backgroundColor:"#fff"}},t.createElement("ul",{style:{margin:"0",paddingLeft:"20px",color:"#333",lineHeight:"1.6",fontSize:"14px"}},r.terms.map((e,n)=>t.createElement("li",{key:n,style:{marginBottom:"4px"}},e))))),t.createElement("button",{onClick:o,style:{width:"100%",padding:"18px 20px",backgroundColor:"#F5F5F5",border:"none",borderTop:"1px solid #E5E5E5",fontSize:"16px",fontWeight:"600",color:"#333",cursor:"pointer",textAlign:"center",fontFamily:"'Poppins', sans-serif",flexShrink:0}},"Close")));return w(i,document.body)},sh=({offersToShow:e,offersConfig:n,getOfferCardMessage:r,setSelectedOffer:a,setShowPopup:i})=>{const s=o(null),[d,p]=c(!1),[u,m]=c(!0),[f,g]=c("undefined"!=typeof window&&window.innerWidth<=768),x=()=>{if(s.current){const{scrollLeft:e,scrollWidth:t,clientWidth:n}=s.current;p(e>0),m(e<t-n-10)}};l(()=>{x();const e=s.current;if(e)return e.addEventListener("scroll",x),()=>e.removeEventListener("scroll",x)},[e]),l(()=>{const e=()=>{g(window.innerWidth<=768)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const h=e=>{if(s.current){const t=f?280:365,n=16,r="right"===e?t+n:-(t+n);s.current.scrollBy({left:r,behavior:"smooth"})}};return t.createElement("div",{style:{position:"relative"}},t.createElement("svg",{style:{position:"absolute",width:0,height:0}},t.createElement("defs",null,t.createElement("mask",{id:"coupon-cut-mask-desktop"},t.createElement("rect",{width:"365",height:"138",fill:"white"}),t.createElement("circle",{cx:"80",cy:"0",r:"12",fill:"black"}),t.createElement("circle",{cx:"80",cy:"138",r:"12",fill:"black"})),t.createElement("mask",{id:"coupon-cut-mask-mobile"},t.createElement("rect",{width:"280",height:"120",fill:"white"}),t.createElement("circle",{cx:"60",cy:"0",r:"10",fill:"black"}),t.createElement("circle",{cx:"60",cy:"120",r:"10",fill:"black"})))),d&&t.createElement("button",{onClick:()=>h("left"),style:{position:"absolute",left:"5px",top:"50%",transform:"translateY(-50%)",background:"#fff",border:"1px solid #e0e0e0",borderRadius:"50%",width:"clamp(28px, 5vw, 38px)",height:"clamp(28px, 5vw, 38px)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)",color:"#333"}},t.createElement(M,{size:20})),u&&t.createElement("button",{onClick:()=>h("right"),style:{position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",background:"#fff",border:"1px solid #e0e0e0",borderRadius:"50%",width:"clamp(28px, 5vw, 38px)",height:"clamp(28px, 5vw, 38px)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)",color:"#333"}},t.createElement(j,{size:20})),t.createElement("div",{ref:s,className:"hide-scrollbar",style:{display:"flex",alignItems:"stretch",overflowX:"auto",gap:"16px",scrollbarWidth:"none",msOverflowStyle:"none",minHeight:f?"110px":"128px"}},e?.map(e=>t.createElement("div",{key:e.discountId,style:{flexShrink:0,width:f?"280px":"365px",minWidth:f?"280px":"365px",minHeight:f?"110px":"128px",backgroundColor:"transparent",borderRadius:`${n?.roundness||0}px`,border:"1px solid #e0e0e0",display:"flex",position:"relative",overflow:"visible",mask:`url(#${f?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,WebkitMask:`url(#${f?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,maskImage:`url(#${f?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,WebkitMaskImage:`url(#${f?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`}},t.createElement("div",{style:{width:f?"60px":"80px",minHeight:f?"110px":"128px",backgroundColor:n?.accentColor||"#EE8E35",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:f?"10px 6px":"12px 8px",position:"relative",borderTopLeftRadius:`${n?.roundness||0}px`,borderBottomLeftRadius:`${n?.roundness||0}px`}},t.createElement("div",{style:{position:"absolute",right:"-2px",top:"12px",bottom:"12px",width:"2px",borderLeft:"2px dashed #FFFFFF"}})),n?.iconVisibility&&t.createElement("div",{style:{position:"absolute",left:f?"42.5px":"57.5px",top:"35%",transform:"translateY(-50%)",width:f?"32px":"40px",height:f?"32px":"40px",backgroundColor:"#FFFFFF",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:f?"16px":"20px",color:"#333333",zIndex:10,boxShadow:"0 2px 5px rgba(0,0,0,0.1)",border:"1px solid #E0E0E0"}},"free_product"===e.couponType?t.createElement(W,null):t.createElement(wo,null)),t.createElement("div",{style:{flex:1,padding:f?"12px 12px":"15px 15px",paddingLeft:f?"25px":"35px",display:"flex",flexDirection:"column",justifyContent:"space-between",borderTopRightRadius:`${n?.roundness||0}px`,borderBottomRightRadius:`${n?.roundness||0}px`,overflow:"hidden",backgroundColor:n?.cardBackgroundColor||"#ffffff",minWidth:0}},t.createElement("div",{style:{display:"flex",flexDirection:"column",gap:f?"4px":"6px",lineHeight:"normal"}},t.createElement("div",{style:{fontSize:f?"9px":"10px",color:"#666666",fontWeight:"400"}},"free_product"===e.couponType?"Free Gift":"Special Deal"),t.createElement("div",{style:{fontSize:f?"13px":"15px",fontWeight:"600",color:n?.textColor||"#2c3e50"}},e.name),t.createElement("div",{style:{fontSize:f?"11px":"12px",color:n?.accentColor||"#EE8E35",wordWrap:"break-word",overflowWrap:"break-word",whiteSpace:"normal",minHeight:f?"28px":"32px"}},r(e))),t.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},t.createElement("div",{style:{borderTop:"1px solid #999999",marginTop:"4px",width:"100%",height:"0",display:"block"}}),t.createElement("a",{href:"#",onClick:t=>{t.preventDefault(),a(e),i(!0)},style:{fontSize:f?"11px":"12px",color:"#2c3e50",fontWeight:"500",textDecoration:"none",cursor:"pointer",textAlign:"center",marginTop:"0"}},n?.viewDetailsTitle||"View Details")))))),t.createElement("style",null,"\n .hide-scrollbar::-webkit-scrollbar {\n display: none;\n }\n .hide-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n "))},dh=({offersToShow:e,offersConfig:n,getOfferCardMessage:r,setSelectedOffer:o,setShowPopup:a})=>{const[i,s]=c("undefined"!=typeof window&&window.innerWidth<=768);return l(()=>{const e=()=>{s(window.innerWidth<=768)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),t.createElement("div",{style:{borderRadius:`${n?.roundness||8}px`}},e?.map((l,c)=>t.createElement("div",{key:l.discountId,style:{display:"flex",alignItems:"flex-start",gap:i?"8px":"12px",padding:i?"12px 0":"16px 0",paddingLeft:i?"10px":"20px",backgroundColor:!0===n?.cardBackgroundTransparent||"true"===String(n?.cardBackgroundTransparent)?"transparent":n?.cardBackgroundColor||"#ffffff",borderBottom:c<(e?.length||0)-1?"1px solid rgb(225 218 218)":"none",marginBottom:"4px",borderRadius:`${n?.roundness||0}px`}},n?.iconVisibility&&t.createElement("div",{style:{width:i?"40px":"50px",height:i?"40px":"50px",backgroundColor:"#f8f9fa",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:i?"20px":"25px",marginTop:i?"5px":"10px",border:"2px solid #4a4a4a",color:"#4a4a4a"}},"free_product"===l.couponType?t.createElement(W,null):t.createElement(wo,null)),t.createElement("div",{style:{flex:1}},t.createElement("div",{style:{fontSize:i?"14px":"15px",fontWeight:600,color:"#000000",lineHeight:"1"}},l.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "),":"," ",t.createElement("span",{style:{fontWeight:600,color:n?.textColor||"#34495e"}},l.name)),t.createElement("div",{style:{fontSize:i?"12px":"13px",color:"#7f8c8d",marginBottom:"6px"}},r(l)),t.createElement("div",{style:{fontSize:i?"11px":"12px",color:"#000000"}},"offer auto applied",t.createElement("a",{href:"#",onClick:e=>{e.preventDefault(),o(l),a(!0)},style:{color:n?.accentColor||"#7f8c8d",fontWeight:700,textDecoration:"none",marginLeft:"2px"}},n?.viewDetailsTitle||"T&C"))))))},ph=e=>{const t="free_product"===e.couponType;let n="";t?n="Get this product for free!":e.discountPercentage?n=`Get ${e.discountPercentage}% off`:e.discountValue&&(n=`Get ${e.discountValue} off`);const r=["Limited Time Offer","Applies automatically when criteria is met"];return"quantity"===e.customCartProgressBarCriteria&&e.quantityThreshold?r.push(`Unlock when you add ${e.quantityThreshold} ${e.quantityThreshold>1?"items":"item"} to cart`):"minimum_order_value"===e.customCartProgressBarCriteria&&e.minimumOrderValue&&r.push(`Unlock at order value of ${e.minimumOrderValue}`),t&&r.push("Combines with other order discounts"),t||r.push("Not applicable if other offer with higher discount applied on same product"),{offerMessage:n,terms:r}},uh=e=>"quantity"===e.customCartProgressBarCriteria&&e.quantityThreshold?`add ${e.quantityThreshold} ${e.quantityThreshold>1?"items":"item"} to unlock`:"minimum_order_value"===e.customCartProgressBarCriteria&&e.minimumOrderValue?`unlocks on orders above ${e.minimumOrderValue}`:"Special offer available",mh=({offersConfig:e,offers:n})=>{const[r,a]=c(!1),[i,s]=c(null),[d,p]=c(null),[u,m]=c("undefined"!=typeof window&&window.innerWidth<=768),[f,g]=c("undefined"!=typeof window&&window.innerWidth<=450),x=o(null);l(()=>{const e=()=>{m(window.innerWidth<=768),g(window.innerWidth<=450)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),l(()=>{x.current&&Ln(x.current)},[e?.sectionBgContrastColor]);const h=(e=>{if(!e||0===e.length)return e;const t={};e.forEach(e=>{const n=e.customCartProgressBarCriteria||"none";t[n]=(t[n]||0)+1});let n="none",r=-1;Object.keys(t).forEach(e=>{t[e]>r&&(r=t[e],n=e)});const o=e.map((e,t)=>({o:e,idx:t})),a=e=>"minimum_order_value"===n?void 0!==e.minimumOrderValue&&null!==e.minimumOrderValue?Number(e.minimumOrderValue):1/0:"quantity"===n&&void 0!==e.quantityThreshold&&null!==e.quantityThreshold?Number(e.quantityThreshold):1/0;return o.sort((e,t)=>{const r=e.o.customCartProgressBarCriteria===n,o=t.o.customCartProgressBarCriteria===n;if(r&&o){const n=a(e.o),r=a(t.o);return n!==r?n-r:e.idx-t.idx}return r&&!o?-1:!r&&o?1:e.idx-t.idx}),o.map(e=>e.o)})(n||[]);return t.createElement("div",null,t.createElement("div",{style:{position:"relative",width:"100%",maxWidth:"450px",borderRadius:"list"===e?.sectionType?`${e?.roundness||0}px`:"0px",boxSizing:"border-box",backgroundColor:e?.sectionBackgroundColor||"#fff"}},t.createElement("div",{style:{border:"coupon"===e?.sectionType?"none":"1px solid rgb(169, 163, 163)",borderTop:"1px solid rgb(169, 163, 163)",padding:null!=e?.cardPadding?`${e.cardPadding}px`:u?"20px 10px 15px":"30px 15px 20px",position:"relative",borderRadius:"list"===e?.sectionType?`${e?.roundness||8}px`:"0px"}},t.createElement("span",{ref:x,className:"yt-product-offers-section-title",style:{position:"absolute",top:"0",left:"left"===e?.alignment?"coupon"===e?.sectionType?"0px":u?"10px":"20px":"right"===e?.alignment?"auto":"50%",right:"right"===e?.alignment?"coupon"===e?.sectionType?"0px":u?"10px":"20px":"auto",transform:"middle"===e?.alignment?"translateX(-50%) translateY(-50%)":"translateY(-50%)",background:e?.sectionBgContrastColor||"#fff",padding:u?"0 8px":"0 10px",fontWeight:"500",fontSize:u?"14px":"16px",textTransform:"uppercase",textAlign:"center"}},e?.sectionTitle||"Available Deals and Offers"),(()=>{const n=e?.sectionType;return"list"===n?t.createElement(dh,{offersToShow:h,offersConfig:e||{},getOfferCardMessage:uh,setSelectedOffer:e=>{s(e),e&&p(ph(e))},setShowPopup:a}):"coupon"===n?t.createElement(sh,{offersToShow:h,offersConfig:e||{},getOfferCardMessage:uh,setSelectedOffer:e=>{s(e),e&&p(ph(e))},setShowPopup:a}):null})(),f?t.createElement(ch,{selectedOffer:i,selectedOfferTerms:d,showPopup:r,offersConfig:e,onClose:()=>{a(!1),s(null),p(null)}}):t.createElement(lh,{selectedOffer:i,selectedOfferTerms:d,showPopup:r,offersConfig:e,onClose:()=>{a(!1),s(null),p(null)}}))))};export{ah as Bundle,ih as BundleLoader,Su as Cart,Xe as Nudge,mh as ProductOffers,ot as SpinnerWheel};
|