yt-uikit 0.8.55 → 0.8.56
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 +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -5108,4 +5108,4 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
|
|
|
5108
5108
|
}
|
|
5109
5109
|
`,hp=c.span`
|
|
5110
5110
|
font-size: 12px;
|
|
5111
|
-
`,vp=({productsWithIndices:r,isOpen:i,onClose:a,cta:l,variantOptions:c,onVariantChange:d,handleAddToCart:s,primaryProductId:p,variantId:u})=>{const m=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e?.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?1/0:0:1/0:0},[]),[g,x]=t({}),[f,y]=t({});n(()=>{const e={},t={};r?.forEach(({product:n,index:o})=>{let r,i=[];if(n.productId===p&&u){const e=n?.productDetails?.variants?.edges.find(e=>e?.node?.id?.includes(u))?.node;e&&m(n.productDetails,e.id)>0&&(i=e.title.split(" / "),r=e)}if(!i.length){const e=n.productDetails.variants.edges.find(e=>m(n.productDetails,e?.node?.id)>0)?.node||n?.productDetails?.variants?.edges?.[0]?.node;e?(i=e.title.split(" / "),r=e):i=n?.productDetails?.options?.map(e=>e.values[0]??"")}e[o]=i,r&&(t[o]={node:r},d(o,r.id))}),x(e),y(t)},[r,p,u,d,m]),n(()=>{if(!p||!u)return;const e=r?.find(({product:e})=>e?.productId===p);if(!e)return;const{product:t,index:n}=e,o=t?.productDetails?.variants?.edges?.find(e=>e.node.id.includes(u))?.node;if(o&&m(t.productDetails,o.id)>0){const e=o.title.split(" / ");x(t=>({...t,[n]:e})),y(e=>({...e,[n]:{node:o}})),d(n,o.id)}},[u,p,r,d,m]);const b=(e,t,n,o)=>{const r=[...g[e]||[]];r[t]=n;const i=r.join(" / "),a=o.productDetails.variants.edges.find(e=>e.node.title===i)?.node;return!!a&&m(o.productDetails,a.id)>0},h=(e,t,n)=>{const{product:o}=r?.find(t=>t.index===e)||{product:{productDetails:{variants:{edges:[]}}}};if(!o?.productDetails)return;if(!b(e,n,t,o))return;const i={...g};i[e][n]=t,x(i);const a=o?.productDetails?.variants?.edges?.find(t=>t.node.title===i[e].join(" / "))?.node;a&&(d(e,a.id),y(t=>({...t,[e]:{node:a}})))};if(!i)return null;const v=e.createElement(ip,{className:"yt-fixedBundle-variant-modal_overlay",onClick:a},e.createElement(ap,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},e.createElement(lp,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:l.backgroundColor,color:l.textColor}},"Select Options"),r?.map(({product:t,index:n},o)=>e.createElement(e.Fragment,null,e.createElement(dp,{className:"yt-fixedBundle-variant-modal_product-block"},e.createElement(sp,{className:"yt-fixedBundle-variant-modal_thumbnail",src:f[n]?.node?.image?.url||t.productDetails.featuredMedia?.preview?.image?.url,alt:t.productDetails.title}),e.createElement(pp,{className:"yt-fixedBundle-variant-modal_product-info"},e.createElement(up,{className:"yt-fixedBundle-variant-modal_product-name"},t.productDetails.title,t.productDetails.variants.edges.length>1&&e.createElement(gp,{className:"yt-fixedBundle-variant-modal_selected-value"},g[n]?.join(" / "))),t.productDetails.options.map((o,r)=>{const i=c&&c?.options?.find(e=>e.name===o.name);return o.values.length<=1?e.createElement(e.Fragment,null):i&&"color"===i?.type?e.createElement(xp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(hp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),o.values.map((o,a)=>{const l=!b(n,r,o,t);return e.createElement(e.Fragment,null,i.values.find(e=>e.name===o)?.value?e.createElement(fp,{className:"yt-fixedBundle-variant-modal_color-swatch",key:a,color:i.values.find(e=>e.name===o)?.value||o,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},e.createElement("span",null)):e.createElement(yp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},o))})):i&&"image"===i?.type?e.createElement(xp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(hp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),o.values.map((o,a)=>{const l=!b(n,r,o,t);return e.createElement(e.Fragment,null,i?.values.find(e=>e.name===o)?.value?e.createElement(bp,{className:"yt-fixedBundle-variant-modal_image-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)},src:i.values.find(e=>e.name===o)?.value},e.createElement("span",null)):e.createElement(yp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},o))})):e.createElement(xp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(hp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),o.values.map((o,i)=>{const a=!b(n,r,o,t);return e.createElement(yp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:i,selected:g[n]?.[r]==o,disabled:a,onClick:()=>{h(n,o,r)}},o)}))}))),o<r.length-1&&e.createElement(mp,{className:"yt-fixedBundle-variant-modal_divider"}))),e.createElement(cp,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:l.backgroundColor,color:l.textColor},onClick:s},"Add bundle to cart")));return ot.createPortal(v,document.body)},wp=({options:o,selectedValue:i,onChange:a,type:l="text"})=>{const[c,d]=t(!1),s=r(null);n(()=>{const e=e=>{s.current&&!s.current.contains(e.target)&&d(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const p=t=>"color"===l?e.createElement(Xs,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:t.value},e.createElement("span",null)):"image"===l?e.createElement(Zs,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:t.value||"/placeholder.svg",alt:t.name},e.createElement("span",null)):null;return e.createElement(Ws,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:s},e.createElement(Hs,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>d(!c)},e.createElement(qs,{className:"yt-fixedBundle-variant-dropdown-horizontal_content"},i&&("color"===l||"image"===l)&&p(i),e.createElement("span",{className:"yt-fixedBundle-variant-dropdown-horizontal_selected-text"},i&&i.name)),e.createElement(Qs,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:c})),c&&e.createElement(Us,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},o?.map(t=>e.createElement(Ys,{className:"yt-fixedBundle-variant-selector_dropdown-item "+(i?.name===t.name?"yt-fixedBundle-variant-selector_dropdown-item--selected":""),key:t.name,$isSelected:i?.name===t.name,onClick:()=>{a(t),d(!1)}},("color"===l||"image"===l)&&p(t),e.createElement(Gs,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},t.name)))))},Cp=({product:o,variantOptions:r,selectedVariants:i,onVariantChange:a,variantId:l,primaryProductId:c,variantType:d="dropdown"})=>{const[s,p]=t(i||[]);n(()=>{if(l&&o.variants.edges.some(e=>e.node.id.includes(l))){const e=o.variants.edges.find(e=>e.node.id.includes(l))?.node;if(e){const t=e.title.split(" / ");p(t)}}},[l,o]);const u=e=>{if(!r?.options)return"text";const t=r.options.find(t=>t.name===e);return t?.type||"text"},m=(e,t)=>{if(!r?.options)return e.values.map(e=>({name:e,value:e}));const n=r.options.find(t=>t.name===e.name);return e.values.map(e=>{const t=n?.values?.find(t=>t.name===e);return{name:e,value:t?.value||e}})},g=(e,t)=>{const n=s[t];if(!n)return null;return m(e).find(e=>e.name===n)||null};return e.createElement(Js,{className:"yt-fixedBundle-variant-selector-horizontal_container"},o.options.map((t,n)=>e.createElement(Ks,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:t.name,$isFirst:0===n},t?.values?.length>1&&e.createElement(wp,{options:m(t),selectedValue:g(t,n),onChange:e=>{console.log(e),((e,t)=>{const n=[...s];n[e]=t.name,p(n);const r=o.variants.edges.find(t=>t.node.title===(o.options?.length>0?n.join(" / "):n[e]))?.node.id;a(r||"")})(n,e)},type:u(t.name)}))))},Ep=({product:r,selectedVariantId:a,isChecked:l,canCustomize:c,styles:d,onVariantChange:s,onCheckChange:p,isMobile:u,isHorizontal:m,index:g,variantOptions:x,productsLength:f,handleOpenModal:y,storeCurrencyCode:b,primaryProductId:h,variantId:v,checkedProducts:w,bundleDiscountValue:C,bundleDiscountType:E,bundleProductsCount:k,totalSelectedOriginal:T})=>{const S=o(()=>e=>{const t=r?.variants?.edges?.find(t=>t.node.id===e),n=t?.node;return n?r?.tracksInventory&&n.inventoryItem?.tracked?n.inventoryQuantity>0?n.inventoryQuantity:n.inventoryQuantity<=0&&"continue"===n.inventoryPolicy?1/0:0:1/0:0},[r]),[$,B]=t(r?.variants?.edges.find(e=>S(e?.node?.id)>0)?.node||r?.variants?.edges?.[0]?.node),[I]=t(r?.options?.map(e=>e?.values?.[0])||[]),z=r?.id===h;n(()=>{if(r.id===h){const e=r?.variants?.edges?.find(e=>e?.node?.id?.includes(a))?.node;e&&S(e.id)>0&&(B(e),s(e.id))}else{const e=r?.variants?.edges?.find(e=>e?.node?.id===a)?.node||r?.variants?.edges?.find(e=>S(e?.node?.id)>0)?.node||r?.variants?.edges?.[0]?.node;B(e)}},[r,h,a,v,s,S]);const N=i(e=>{const t=r?.variants?.edges?.find(t=>t.node.id===e)?.node;t&&s(e)},[r,s]),F=parseFloat($?.price??"0"),P=((e,t,n,o,r,i)=>{if(0===o||!n)return e;if(o!==r)return e;switch(t){case"percentOff":case"percentageOff":case"percentage":case"Percentage":return e*(1-n/100);case"amountOff":case"amount":case"Amount Off":{if(i<=0)return e;const t=e/i*n;return Math.max(0,e-t)}case"fixedPrice":case"fixed":case"fixedPrice":return n*(e/i);default:return e}})(F,E,C??0,w?.size,k,T),D=P,A=D<F&&d?.fixedBundle?.compareAtPriceVisibility,_=D.toFixed(2),R="undefined"!=typeof window&&"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,O=$?.image?.url||r.featuredMedia?.preview?.image?.url;return e.createElement(e.Fragment,null,m?e.createElement("div",{className:""+(r.id===h?"yt-fixedBundle-product-card--horizontal-primary":"yt-fixedBundle-product-card--horizontal-associated"),style:{display:"flex",alignItems:"center",gap:"10px",backgroundColor:d.fixedBundle?.cardBackgroundColor}},c&&e.createElement(op,{className:"yt-fixedBundle-product-card_checkbox-wrapper--horizontal"},e.createElement(tp,{className:"yt-fixedBundle-product-card_checkbox-hidden",style:{display:"none"},type:"checkbox",id:`checkbox-${r.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:z}),e.createElement(np,{className:"yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${r.id}-${g}`,isChecked:l,borderRadius:d.fixedBundle?.borderRadius,borderColor:d.fixedBundle?.borderColor,backgroundColor:d.general?.ctaBackgroundColor},e.createElement(W,null))),e.createElement(xs,{className:"yt-fixedBundle-product-card-horizontal_item",style:{borderRadius:d.fixedBundle?.borderRadius,border:`1px solid ${d.fixedBundle?.borderColor}80`,backgroundColor:d.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`8px 8px 8px -6px ${d.fixedBundle.borderColor}`,"no-spread":`4px 4px 0px -1px ${d.fixedBundle.borderColor}80`}[d.fixedBundle.shadowType]||"none"},canCustomize:c},"undefined"!=typeof window&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&e.createElement(fs,{className:"yt-fixedBundle-product-card-horizontal_image",src:Ap(O),alt:r.title,style:{borderRadius:d.fixedBundle?.borderRadius,borderColor:d.fixedBundle?.borderColor,aspectRatio:d.general.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),e.createElement(ys,{className:"yt-fixedBundle-product-card-horizontal_details"},e.createElement(bs,{className:"yt-fixedBundle-product-card-horizontal_title"},r.title),d.fixedBundle.productsPriceVisibility&&e.createElement(hs,{className:"yt-fixedBundle-product-card-horizontal_price-section"},e.createElement(vs,{className:"yt-fixedBundle-product-card-horizontal_price--new"},Dp(d.general.currencySymbol,b)," ",Pp(_)),A&&parseFloat($.price)>parseFloat(_)&&e.createElement(ws,{className:"yt-fixedBundle-product-card-horizontal_price--old"},Dp(d.general.currencySymbol,b),Pp($.price))),e.createElement(Cp,{product:r,variantOptions:x,selectedVariants:I,onVariantChange:N,variantId:v,primaryProductId:h})))):e.createElement(e.Fragment,null,e.createElement(zs,{className:""+(r.id===h?"yt-fixedBundle-product-card--vertical-primary":"yt-fixedBundle-product-card--vertical-associated"),productsLength:f,style:{borderRadius:d.fixedBundle?.borderRadius,border:`1px solid ${d.fixedBundle?.borderColor}50`,backgroundColor:d.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`0 4px 10px -6px ${d.fixedBundle.borderColor}50`,"no-spread":`4px 4px 0px -1px ${d.fixedBundle.borderColor}50`}[d.fixedBundle.shadowType]||"none",...c&&{position:"relative"},...R&&{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",minWidth:"max-content",paddingLeft:"2px"}},borderRadius:d.fixedBundle?.borderRadius,borderColor:d.fixedBundle?.borderColor,backgroundColor:d.fixedBundle?.cardBackgroundColor},c&&e.createElement(rp,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:R},e.createElement(tp,{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${r.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:z}),e.createElement(np,{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${r.id}-${g}`,isChecked:l,borderRadius:d.fixedBundle?.borderRadius,borderColor:d.fixedBundle?.borderColor,backgroundColor:d.general?.ctaBackgroundColor},e.createElement(W,{size:10}))),"undefined"!=typeof window&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&e.createElement(Ns,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:d.general.imageAspectRatio,height:"fit-content"}},e.createElement(Fs,{className:"yt-fixedBundle-product-card_image--vertical",src:Ap(O),style:{aspectRatio:d.general.imageAspectRatio},alt:r.title}),r.variants.edges.length>1&&e.createElement(Ps,{className:"yt-fixedBundle-product-card_badge-container"},e.createElement(Ds,{className:"yt-fixedBundle-product-card_circle-button"},e.createElement("span",null)),e.createElement(As,{className:"yt-fixedBundle-product-card_circle-button-two"},e.createElement("span",null)),e.createElement(_s,{className:"yt-fixedBundle-product-card_count-badge"},r.variants.edges.length,"+"))),e.createElement(Rs,{className:"yt-fixedBundle-product-card-vertical_info"},e.createElement(Os,{className:"yt-fixedBundle-product-card-vertical_title"},r.title),d.fixedBundle.productsPriceVisibility&&e.createElement(Ms,{className:"yt-fixedBundle-product-card-vertical_price-line"},e.createElement(Ls,{className:"yt-fixedBundle-product-card-vertical_price--new"},Dp(d.general.currencySymbol,b),Pp(_)),d.fixedBundle.compareAtPriceVisibility&&A&&parseFloat($.price)>parseFloat(_)&&e.createElement(ws,{className:"yt-fixedBundle-product-card-vertical_price--old"},Dp(d.general.currencySymbol,b),Pp($.price))))),(f<=3||!u)&&g<f-1&&e.createElement(js,{className:"yt-fixedBundle-plus-wrapper"}," ",e.createElement(Vs,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},kp=({bundle:r,addToCartFunction:a,dispatchAnalyticsEvent:l})=>{const[c,d]=t(!1),[s,p]=t(window.innerWidth<786),[u,m]=t(null),[g,x]=t(!1),f="undefined"!=typeof window?window.location.href:null,y=r?.products?.find(e=>e.productDetails?.handle===f?.split("/").pop()?.split("?")[0]),b=y?.productId,h=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e?.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?1/0:0:1/0:0},[]),[v,w]=t(Object.fromEntries(r?.products?.map((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find(t=>h(e.productDetails,t?.node?.id)>0)?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id]))),C="undefined"!=typeof window&&"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"beautywiseshop.myshopify.com"===window.ytBundleApp?.storeDomain,E=r?.showIndividualProductSelector||!0,[k,T]=t(new Set(r.products.reduce((e,t,n)=>(C&&t?.productId!==b&&!E||e.push(n),e),[])));n(()=>{l?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:r._id,bundleType:"fixed-bundle"}});const e=()=>{const e=new URL(window.location.href).searchParams.get("variant");m(e)},t=e=>{const t=history[e];return function(...n){const o=t.apply(this,n);return window.dispatchEvent(new Event(e.toLowerCase())),o}};return history.pushState=t("pushState"),history.replaceState=t("replaceState"),window.addEventListener("pushstate",e),window.addEventListener("replacestate",e),e(),()=>{window.removeEventListener("pushstate",e),window.removeEventListener("replacestate",e)}},[]),n(()=>{u&&b&&w(e=>{const t={...e};return r?.products?.forEach((e,n)=>{e.productId===b&&(t[n.toString()]=u)}),t})},[u,b,r?.products]),n(()=>{const e=()=>{p(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const S=i((e,t)=>{w(n=>({...n,[e.toString()]:t}))},[]),$=(e,t)=>{const n=r.products[t].productId;C&&E&&n===b||T(n=>{const o=new Set(n);return e?o.add(t):o.delete(t),o})},B=o(()=>(e,t)=>h(e.productDetails,t)>0,[h]),I=o(()=>r.products.some((e,t)=>k.has(t)&&e.productDetails.variants.edges.length>1),[r.products,k]),{originalPrice:z,dealPrice:N,offerValue:F}=o(()=>{const{price:e,compareAtPrice:t}=r.products.reduce((e,t,n)=>{if(!k.has(n))return e;const o=v[n.toString()];if(!o)return e;const r=t.productDetails.variants.edges?.find(e=>e.node.id===o)?.node;if(!r)return e;const i=parseFloat(r?.price??"0"),a=parseFloat(r?.compareAtPrice||i.toString());return e.price+=i,e.compareAtPrice+=a,e},{price:0,compareAtPrice:0}),n=Math.max(e,t);let o=Math.min(e,t);k.size===r.products.length&&(r?.percentageOff?o=e*(1-r.percentageOff/100):r?.dealAmount?o=r.dealAmount:r?.amountOff&&(o=e-r.amountOff));const i=t-o;return{originalPrice:n.toFixed(2),dealPrice:o.toFixed(2),offerValue:i.toFixed(2)}},[r.products,v,k,r.percentageOff,r.dealAmount,r.amountOff]),P=o(()=>r.products.map((e,t)=>({product:e,index:t})).filter(({index:e})=>k.has(e)),[r.products,k]),D=P.every(({product:e,index:t})=>B(e,v[t.toString()])),A=o(()=>{let e=0;return r.products.forEach((t,n)=>{if(k.has(n)){const o=v[n.toString()],r=t.productDetails.variants.edges.find(e=>e.node.id===o)?.node.price??"0";e+=parseFloat(r)}}),e},[r.products,k,v]),_=async e=>{if(D){e.preventDefault(),e.stopPropagation(),d(!0),x(!1),l?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:r._id,bundleType:"fixed-bundle",selectedProducts:P?.map(e=>({id:e?.product?.productId,title:e?.product?.productDetails?.title}))}});try{const e=Object.entries(v).map(([e,t])=>{const n=parseInt(e);return isNaN(n)||!k.has(n)?null:t}).filter(Boolean);a&&await a(Number(z),e)}catch(e){console.error("Error adding to cart:",e)}d(!1)}};if(!a)return e.createElement(e.Fragment,null);const R=r.customizations,O=R.fixedBundle?.cardLayoutStyle||"auto",L="horizontal"===O||"auto"===O&&s,M="bundles"==r.appName?r.pageHeader?.title:r?.title,j="bundles"==r.appName?r.pageHeader?.description:r?.subtitle;return e.createElement(ps,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:R.fixedBundle.sectionBackgroundColor,..."transparent"!==R.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},M&&e.createElement(us,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:R.fixedBundle?.titleBackgroundColor||"none",color:R.fixedBundle?.titleTextColor||"black",textAlign:R.fixedBundle.infoAlignment??"center",fontSize:R.fixedBundle?.titleFontSize,..."transparent"!==R.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===R.fixedBundle.infoAlignment&&"transparent"!==R.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===R.fixedBundle.infoAlignment&&"transparent"!==R.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===R.fixedBundle.infoAlignment&&"transparent"===R.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},M),j&&e.createElement(ms,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:R.fixedBundle?.subtitleFontSize,textAlign:R.fixedBundle.infoAlignment??"center",..."left"===R.fixedBundle.infoAlignment&&"transparent"!==R.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===R.fixedBundle.infoAlignment&&"transparent"!==R.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===R.fixedBundle.infoAlignment&&"transparent"===R.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},j),L?e.createElement(gs,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},r?.products?.map((t,n)=>e.createElement(e.Fragment,{key:`${t.productId}-${n}`},e.createElement(Ep,{isChecked:k.has(n),product:t.productDetails,selectedVariantId:v[n.toString()]||"",canCustomize:r?.canCustomizeFixedBundle||!1,styles:R,onVariantChange:e=>S(n,e),onCheckChange:e=>{$(e,n)},isMobile:s,index:n,isHorizontal:L,variantOptions:r.variantOptions,productsLength:r.products.length,storeCurrencyCode:r.storeCurrencyCode,primaryProductId:b,variantId:u||void 0,bundleDiscountType:r.discountType??"none",checkedProducts:k,bundleProductsCount:r.products.length,bundleDiscountValue:r.percentageOff||r.amountOff||r.dealAmount,totalSelectedOriginal:A})))):e.createElement(Bs,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},e.createElement(Is,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===R.fixedBundle.infoAlignment?"flex-start":"right"===R.fixedBundle.infoAlignment?"flex-end":"center"}},r?.products?.map((t,n)=>e.createElement(Ep,{key:`${t.productId}-${n}`,isChecked:k.has(n),product:t.productDetails,selectedVariantId:v[n.toString()]||"",canCustomize:r?.canCustomizeFixedBundle||!1,styles:R,onVariantChange:e=>{S(n,e)},onCheckChange:e=>$(e,n),isMobile:s,index:n,isHorizontal:L,productsLength:r.products.length,storeCurrencyCode:r.storeCurrencyCode,primaryProductId:b,variantId:u||void 0,bundleDiscountType:r.discountType??"none",checkedProducts:k,bundleProductsCount:r.products.length,bundleDiscountValue:r.percentageOff||r.amountOff||r.dealAmount,totalSelectedOriginal:A})),I&&e.createElement(vp,{productsWithIndices:P,isOpen:g,onClose:()=>x(!1),variantOptions:r.variantOptions,cta:{textColor:R.general.ctaTextColor,backgroundColor:R.general.ctaBackgroundColor},onVariantChange:S,handleAddToCart:_,primaryProductId:b,variantId:u||void 0}))),e.createElement(Cs,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===R.fixedBundle.infoAlignment?"flex-start":"right"===R.fixedBundle.infoAlignment?"flex-end":"center"}},Number(z)>0&&Number(F)>0&&R.fixedBundle.compareAtPriceVisibility&&e.createElement(Es,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",e.createElement(Ts,{className:"yt-fixedBundle-summary_price"},Dp(R.general.currencySymbol,r?.storeCurrencyCode),Pp(z))),0!==k.size&&e.createElement(ks,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",e.createElement(Ts,{className:"yt-fixedBundle-summary_price"},Dp(R.general.currencySymbol,r?.storeCurrencyCode),Pp(N))," ",Number(F)>0&&e.createElement(Ss,{className:"yt-fixedBundle-summary_save-tag"},"Save:"," ",Dp(R.general.currencySymbol,r?.storeCurrencyCode),Pp(F)))),e.createElement($s,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),L||!I?_(e):x(!0)},disabled:k.size<1||c||!D,style:{backgroundColor:R.general?.ctaBackgroundColor||"#121212",color:R.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${R.general?.ctaBackgroundColor||"#121212"}`,boxShadow:R.general.ctaShadowType,paddingTop:R.general?.ctaPadding,paddingBottom:R.general?.ctaPadding,borderRadius:R.general.ctaBorderRadius,width:R.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{R.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=R.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=R.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{R.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=R.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=R.general?.ctaTextColor||"#FFFFFF")}},c?e.createElement(Je,{color:"white",loading:c,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):D?e.createElement(e.Fragment,null,R.fixedBundle?.ctaTitle??"Add Bundle to cart"):e.createElement(e.Fragment,null,"Out of Stock")))},Tp=()=>e.createElement(e.Fragment,null,e.createElement("style",null,"@keyframes spin { to { transform: rotate(360deg); } }"),e.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"}})),Sp=({product:o,tierIdx:r,isOpen:i,onClose:a,onAddToBundle:l,canAdd:c,isSelected:d,customizations:s,isMobile:p})=>{const[u,m]=t(0),[g,x]=t(o.variants[0]?.id.toString()||""),[f,y]=t(!0),b=o.variants.find(e=>e.id.toString()===g)||o.variants[0],h=o.images.filter(Boolean),v=()=>{h.length<=1||(m(e=>0===e?h.length-1:e-1),y(!0))},w=()=>{h.length<=1||(m(e=>e===h.length-1?0:e+1),y(!0))};if(n(()=>(i&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=""}),[i]),n(()=>{if(b&&b?.featured_image?.src){const e=document.querySelector(".yt-collection-bundle-modal-image"),t=Ap(b?.featured_image?.src);e?.setAttribute("src",t)}},[b]),!i)return null;const C=h.length>1,E=e.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:a},e.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",borderRadius:s?.borderRadius||"12px",maxWidth:1e3,width:"100%",height:"72dvh",margin:"auto",display:"flex",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:a,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"}},e.createElement(V,{size:22})),e.createElement("div",{className:"yt-collection-bundle-modal-image-container",style:{flex:1,position:"relative",margin:"20px 0 20px 20px",borderRadius:s?.borderRadius||"12px",background:"#f5f5f5"}},h.length>0&&e.createElement(e.Fragment,null,f&&e.createElement("style",null,"\n @keyframes shimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n }\n "),f&&e.createElement("div",{style:{position:"absolute",inset:0,background:"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s infinite",borderRadius:s?.borderRadius||"12px"}}),e.createElement("img",{className:"yt-collection-bundle-modal-image",src:Ap(h[u]||o.images[0]),alt:o.title,onLoad:()=>y(!1),style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:s?.borderRadius||"12px",opacity:f?0:1,transition:"opacity 0.3s"}}),C&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:v,disabled:0===u,style:{position:"absolute",left:16,top:"50%",transform:"translateY(-50%)",background:0===u?"rgba(0,0,0,0.2)":"rgba(0,0,0,0.4)",border:"none",borderRadius:"50%",width:44,height:44,display:"flex",alignItems:"center",justifyContent:"center",cursor:0===u?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:0===u?.5:1}},e.createElement(H,{size:24})),e.createElement("button",{onClick:w,disabled:u===h.length-1,style:{position:"absolute",right:16,top:"50%",transform:"translateY(-50%)",background:u===h.length-1?"rgba(0,0,0,0.2)":"rgba(0,0,0,0.4)",border:"none",borderRadius:"50%",width:44,height:44,display:"flex",alignItems:"center",justifyContent:"center",cursor:u===h.length-1?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:u===h.length-1?.5:1}},e.createElement(q,{size:24}))))),e.createElement("div",{className:"yt-collection-bundle-modal-content",style:{flex:1,padding:"30px",overflowY:"auto",display:"flex",flexDirection:"column",scrollbarWidth:"none"}},e.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"6px 0",fontSize:24,fontWeight:600,lineHeight:"normal"}},o.title),o.variants.length>1&&e.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative"}},e.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee",lineHeight:"normal"}},o?.options?.join(" & "),":"," ",e.createElement("strong",null,b.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:g,onChange:e=>{x(e.target.value),y(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer",lineHeight:"normal"}},o.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0",lineHeight:"normal"}},"₹",(b.price/100).toLocaleString(),b.compare_at_price&&b.compare_at_price>b.price&&e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999",lineHeight:"normal"}},"₹",(b.compare_at_price/100).toLocaleString())),e.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"white"}},e.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(d||!c?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>l(o,r),disabled:!c||!b.available,style:{width:"100%",padding:"12px",fontSize:17,fontWeight:600,border:"none",borderRadius:s?.borderRadius||"8px",background:b.available?d||!c?"#28a745":s?.atcBg||"#007bff":"rgb(204, 204, 204)",color:s?.atcText||"#fff",cursor:c&&b.available?"pointer":"not-allowed",textAlign:"center",lineHeight:"normal"}},d?"Added to Box":b.available?"Add to Box":"Out of Stock")),o.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:o.description},style:{lineHeight:"normal",color:"#444",marginTop:"10px"}})))),k=e.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:a},e.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",width:"100%",height:"100dvh",display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:a,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement(V,{size:22})),e.createElement("div",{className:"yt-collection-bundle-modal-scroll-container",style:{flex:1,overflowY:"auto",paddingBottom:100}},h.length>0&&e.createElement("div",{className:"yt-collection-bundle-modal-image-wrapper",style:{position:"relative",background:"#f5f5f5"}},f&&e.createElement("div",{style:{position:"absolute",inset:0,background:"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s infinite"}}),e.createElement("img",{className:"yt-collection-bundle-modal-image",src:h[u]||o.images[0],alt:o.title,onLoad:()=>y(!1),style:{width:"100%",minWidth:"100%",display:"block",maxHeight:"50vh",minHeight:"50vh",objectFit:"cover",objectPosition:"center",opacity:f?0:1,transition:"opacity 0.3s"}}),C&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:v,disabled:0===u,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",background:0===u?"rgba(0,0,0,0.3)":"rgba(0,0,0,0.5)",border:"none",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",zIndex:5,opacity:0===u?.5:1,cursor:0===u?"not-allowed":"pointer"}},e.createElement(H,{size:20})),e.createElement("button",{onClick:w,disabled:u===h.length-1,style:{position:"absolute",right:12,top:"50%",transform:"translateY(-50%)",background:u===h.length-1?"rgba(0,0,0,0.3)":"rgba(0,0,0,0.5)",border:"none",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",zIndex:5,opacity:u===h.length-1?.5:1,cursor:u===h.length-1?"not-allowed":"pointer"}},e.createElement(q,{size:20})))),e.createElement("div",{className:"yt-collection-bundle-modal-content",style:{padding:"20px"}},e.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"0 0 12px",fontSize:22,fontWeight:600}},o.title),o.variants.length>1&&e.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative",marginBottom:20}},e.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee"}},o?.options?.join(" & "),":"," ",e.createElement("strong",null,b.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:g,onChange:e=>{x(e.target.value),y(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}},o.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0"}},"₹",(b.price/100).toLocaleString(),b.compare_at_price&&b.compare_at_price>b.price&&e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999"}},"₹",(b.compare_at_price/100).toLocaleString())),o.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:o.description},style:{lineHeight:1.7,color:"#444"}}))),e.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"#fff",padding:"8px 10px",borderTop:"1px solid #eee",boxShadow:"0 -4px 10px rgba(0,0,0,0.05)"}},e.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(d||!c?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>l(o,r),disabled:!c||!b.available,style:{width:"100%",padding:"10px",fontSize:14,fontWeight:600,border:"none",borderRadius:s?.borderRadius||"8px",background:!d&&c&&b.available?s?.atcBg||"#007bff":"#28a745",color:s?.atcText||"#fff",cursor:c&&b.available?"pointer":"not-allowed"}},d?"Added to Box":b.available?"Add to Box":"Out of Stock"))));return ot.createPortal(p?k:E,document.body)},$p=({title:t,uploadState:n,onUpload:o,onRemove:r,onRetry:i})=>{const a="object"==typeof n&&n?.loading,l="object"==typeof n&&n?.error,c="object"==typeof n&&n?.url;return e.createElement("div",{className:"yt-collection-bundle-upload-field",style:{padding:"20px",border:"2px dashed #ccc",borderRadius:"8px",textAlign:"center",background:"#fafafa"}},e.createElement("div",{className:"yt-collection-bundle-upload-title",style:{fontWeight:500,color:"#333",marginBottom:"4px"}},t),a&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-collection-bundle-upload-loading",style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",color:"#007bff",fontSize:"13px",margin:"12px 0"}},e.createElement(Tp,null)," Uploading ",n?.name,"...")),l&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-collection-bundle-upload-error",style:{color:"#dc3545",fontSize:"13px",margin:"8px 0"}},"Upload failed. Try again."),e.createElement("button",{type:"button",className:"yt-collection-bundle-upload-retry-btn",onClick:i,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Retry Upload")),c&&!a&&!l&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-collection-bundle-upload-image-container",style:{margin:"12px 0"}},e.createElement("img",{className:"yt-collection-bundle-upload-image",src:n.url,alt:"Uploaded",style:{maxWidth:"100%",maxHeight:"150px",borderRadius:"6px"}})),e.createElement("div",{className:"yt-collection-bundle-upload-filename",style:{fontSize:"12px",color:"#28a745",marginBottom:"8px"}},n.name),e.createElement("button",{type:"button",className:"yt-collection-bundle-upload-remove-btn",onClick:r,style:{background:"#dc3545",color:"white",border:"none",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",cursor:"pointer"}},"Remove")),!n&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-collection-bundle-upload-hint",style:{color:"#888",fontSize:"12px",marginBottom:"12px"}},"jpeg/png (max 5MB)"),e.createElement("button",{type:"button",className:"yt-collection-bundle-upload-btn",onClick:o,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Upload")))},Bp=({config:o,bundleAddToCartLoading:a,addCustomBundleToCart:l})=>{const[c,d]=t(1),[s,p]=t([]),[u,m]=t(null),[g,x]=t({}),[f,y]=t(window.innerWidth<640),[b,h]=t({}),v=r(new Map),[w,C]=t(!1),E=r(null),k=r(new Map),[T,S]=t(160),$=f?8:20,{customizations:B}=o,I=o.config.builderTiers.collectionTier.sort((e,t)=>e.tier-t.tier),z=!!o.config.form,N=I.length+(z?1:0),F=B.hideSelectedProducts,P=B.allowMultipleQty,D=B.hideOutOfStockProducts,A=e=>I[e-1]?.products||[],_=i(e=>{const t=A(e),n=D?t.filter(e=>e.available).length:t.length;h(t=>{const o=t[e]||0,r=Math.min(o+8,n);return r<=o?t:{...t,[e]:r}})},[8,D]);n(()=>(E.current=new IntersectionObserver(e=>{for(const t of e)if(t.isIntersecting){const e=parseInt(t.target.getAttribute("data-sentinel-step")||"0");e>0&&e===c&&_(e)}},{root:null,threshold:0,rootMargin:"100px 0px"}),()=>{E.current?.disconnect()}),[_,c]),n(()=>{if(z&&c===N)return;const e=c,t=A(e);if(0===t.length)return;const n=D?t.filter(e=>e.available).length:t.length;if(0===(b[e]||0)){const t=Math.min($,n);h(n=>({...n,[e]:t}))}},[c,$,D,b]),n(()=>{const e=document.querySelector(".box-loader-scene");e&&e.setAttribute("style","display: none;");const t=()=>y(window.innerWidth<640);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const R=i(e=>{S(e+10)},[]),O=s.reduce((e,t)=>e+t.quantity,0),L=s.reduce((e,t)=>e+t.price*t.quantity,0)/100,M=s.reduce((e,t)=>{const n=I.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId),o=n?.variants.find(e=>e.id.toString()===t.variantId);return e+(o?.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 o=document.querySelector(`[data-product-id="${e.id}"]`);o&&(o.dataset.selectedVariant=t,o.dataset.currentPrice=n.price.toString())},V=(e,t)=>{const n=document.querySelector(`[data-product-id="${e.id}"]`);if(!n)return;const o=n.dataset.selectedVariant||e.variants[0].id.toString(),r=parseInt(n.dataset.currentPrice||e.variants[0].price.toString());p(n=>{const i=`${e.id}-${o}-${t}`,a=n.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===i);if(a)return n.filter(e=>e!==a);const l=q[t],c=W(t);return c!==1/0&&l>=c?n:[...n,{productId:e.id.toString(),variantId:o,price:r,quantity:1,tierIndex:t}]})},W=e=>{const t=I[e];return t.maximumQuantity>0?t.maximumQuantity:1/0},H=(e,t)=>{const n=W(t);if(n===1/0)return!0;const o=q[t];return!!s.some(n=>n.productId===e.id.toString()&&n.tierIndex===t)||o<n},q=I.map((e,t)=>s.filter(e=>e.tierIndex===t).reduce((e,t)=>e+t.quantity,0)),Q=(e,t,n)=>{const o=W(n);if(o===1/0)return!0;return q[n]<o},U=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");x(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",o=await fetch(`${n}/shopify/upload?shop=${e}`,{method:"POST",headers:{"x-yourtoken-app-name":"bundles"},body:t});if(!o.ok)throw new Error("Upload failed");return(await o.json()).url}catch(e){throw C(!1),alert("Upload failed. Try again."),e}finally{C(!1)}})(n);x(o=>({...o,[e]:{url:t,name:n.name}}))}catch{x(t=>({...t,[e]:{error:!0,name:n.name}}))}}},document.body.appendChild(t),v.current.set(e,t)}return v.current.get(e)},Y=z&&c===N,G=(Y?null:I[c-1])?W(c-1):0,X=I.map((e,t)=>({tier:e,items:s.filter(e=>e.tierIndex===t).reduce((e,t)=>{const n=`${t.productId}-${t.variantId}`,o=e.find(e=>`${e.productId}-${e.variantId}`===n);return o?o.quantity+=t.quantity:e.push({...t,quantity:t.quantity}),e},[]),count:q[t]}));return e.createElement("div",{className:"yt-collection-bundle-builder",style:{margin:"0 auto",maxWidth:"1600px"}},B.headerImage&&!B.headerImage.includes("Liquid error")&&e.createElement("img",{className:"yt-collection-bundle-header-img",src:B.headerImage,alt:"Collection Bundle header",style:{width:"100%"}}),B.showTierSteps&&e.createElement("div",{style:{paddingTop:B.headerImage&&!B.headerImage.includes("Liquid error")?"20px":"0"}},e.createElement(Ip,{totalSteps:N,isFormStep:Y,currentStep:c,getStepTitle:e=>z&&e===N?"Customize Gift Details":I[e-1]?.title||`Step ${e}`,isMobile:f,formTitle:o?.config?.form?.title,hasForm:z,onStepClick:e=>{if(e>1&&!s.length)return alert("Add at least one product first");d(e),window.scrollTo(0,0)}})),Array.from({length:N},(e,t)=>t+1).map(t=>{const n=z&&t===N,r=n?[]:A(t),i=D?r.filter(e=>e.available):r,a=t-1,l=i.slice(0,b[t]||0);return e.createElement("div",{key:t,className:"yt-collection-bundle-step-content "+(c===t?"yt-collection-bundle-step-content-active":""),style:{display:c===t?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},n&&o.config.form?e.createElement("div",{className:"yt-collection-bundle-customize-form",style:{maxWidth:"80%",margin:"0 auto",padding:"1rem",marginBottom:`${T}px`}},o?.config?.form?.sections?.map((t,n)=>e.createElement("div",{key:`sec_${n}`,className:"yt-collection-bundle-form-group",style:{marginBottom:"32px"}},e.createElement("label",{className:"yt-collection-bundle-label",style:{display:"block",fontWeight:600,marginBottom:"12px",color:"#333",fontSize:"16px",lineHeight:"normal"}},t?.title),"text"===t.type&&e.createElement("div",{className:"yt-collection-bundle-form-fields",style:{display:"flex",flexDirection:"column",gap:"12px"}},t.fields.map((t,n)=>{const o=t?.title??"Field "+n;return e.createElement("textarea",{key:o,className:"yt-collection-bundle-textarea",placeholder:t?.title,rows:3,maxLength:500,onChange:e=>x(t=>({...t,[o]:e.target.value})),style:{padding:"12px",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px",resize:"vertical",lineHeight:"normal"}})})),"image"===t.type&&e.createElement("div",{className:"yt-collection-bundle-image-section",style:{marginBottom:"24px"}},e.createElement("sub",{className:"yt-collection-bundle-upload-hint",style:{display:"block",color:"#666",fontSize:"12px",marginBottom:"8px",lineHeight:"normal"}},"jpeg/png (max 5MB)"),e.createElement("div",{className:"yt-collection-bundle-form-fields",style:{display:"flex",flexDirection:"column",gap:"16px"}},t.fields.map((t,n)=>{const o=t?.title??"Field "+n,r=g[o];return e.createElement($p,{key:o,title:t?.title,uploadState:r,onUpload:()=>U(o).click(),onRemove:()=>x(e=>{const{[o]:t,...n}=e;return n}),onRetry:()=>U(o).click()})})))))):e.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:f?"grid":"flex",gridTemplateColumns:f?"repeat(2,1fr)":"",flexWrap:f?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:`${T}px`}},l.map(t=>e.createElement(zp,{key:t.id,product:t,tierIdx:a,customizations:B,isMobile:f,hoveredCard:u,setHoveredCard:m,selectedProducts:s,handleAddToBundle:V,canAddProduct:H,allowMultipleQty:P,handleVariantChange:j,canIncrement:Q,setSelectedProducts:p})),c===t&&(b[t]||0)<i.length&&e.createElement("div",{ref:e=>{const n=k.current.get(t);n&&E.current?.unobserve(n),e?(k.current.set(t,e),E.current?.observe(e)):k.current.delete(t)},"data-sentinel-step":t.toString(),style:{height:"20px",width:"100%",display:"block"}})))}),e.createElement(Np,{config:o,selectedProducts:s,selectedByTier:X,totalItems:O,totalPrice:L,totalCompareAtPrice:M,currentStep:c,totalSteps:N,currentTierMax:G,tierSelectedCounts:q,isMobile:f,bundleAddToCartLoading:a,isUploading:w,hoveredCard:u,setHoveredCard:m,hideSelectedProducts:F,getProductStep:e=>{for(let t=0;t<I.length;t++)if(I[t].products.some(t=>t.id.toString()===e))return t+1;return z?N:I.length},setCurrentStep:d,handleRemoveItem:(e,t,n)=>{p(o=>o.filter(o=>!(o.productId===e&&o.variantId===t&&o.tierIndex===n)))},handleCheckout:async()=>{if(c!==N||!s.length)return;const e={};z&&Object.entries(g).forEach(([t,n])=>{const o=t.split("|").pop()?.replace(/^f_\d+$/,"")||t;"string"==typeof n&&n.trim()?e[o]=n:n&&"object"==typeof n&&"url"in n&&(e[o]=n.url)});const t=s.map(t=>({variantId:t.variantId,quantity:t.quantity,properties:e}));l(t)},hasForm:z,onHeightChange:R}))},Ip=({totalSteps:t,isFormStep:o,currentStep:r,getStepTitle:i,isMobile:a,formTitle:l,hasForm:c,onStepClick:d})=>{const s=e.useRef(null);return n(()=>{if(!a||!s.current)return;const e=s.current.querySelector(".yt-collection-bundle-step-item-active");e&&e.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})},[r,a]),e.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"}},e.createElement("div",{ref:s,className:"yt-collection-bundle-steps-nav",style:{display:"flex",justifyContent:a?"flex-start":"center",gap:a?"1rem":"2rem",minWidth:a?100*t+"px":"auto",paddingInline:a?"calc(50% - 60px)":"0",scrollPaddingInline:a?"calc(50% - 60px)":"0",scrollBehavior:"smooth",overflowX:"auto",scrollbarWidth:"none"}},Array.from({length:t},(e,t)=>t+1).map(n=>e.createElement("div",{key:n,className:"yt-collection-bundle-step-item "+(r===n?"yt-collection-bundle-step-item-active":""),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.5rem",minWidth:a?"100px":"120px",flexShrink:0,cursor:"pointer",opacity:r===n?1:.5,transition:"opacity 0.2s"},onClick:()=>d(n)},e.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"}},c&&n===t?e.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},e.createElement("path",{d:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.67C10.96 2.54 10.05 2 9 2c-1.66 0-3 1.34-3 3 0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1h-2c-.55 0-1-.45-1-1s.45-1 1-1h2zm-6 0c.55 0 1 .45 1 1s-.45 1-1 1H7c-.55 0-1-.45-1-1s.45-1 1-1h2zM20 19H4V8h16v11z"})):e.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},e.createElement("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}))),e.createElement("div",{className:"yt-collection-bundle-step-label",style:{fontSize:"14px",textAlign:"center",color:"#333",fontWeight:"600",lineHeight:"normal"}},i(n))))),l&&c&&o&&e.createElement("p",{className:"yt-collection-bundle-steps-nav-description",style:{fontSize:a?"14px":"16px",marginBottom:a?"0":"14px",fontWeight:"400",color:"#000",lineHeight:"normal"}},l))},zp=({product:n,tierIdx:o,customizations:r,isMobile:i,hoveredCard:a,setHoveredCard:l,selectedProducts:c,handleAddToBundle:d,canAddProduct:s,allowMultipleQty:p,handleVariantChange:u,canIncrement:m,setSelectedProducts:g})=>{const[x,f]=t(!1),y=document.querySelector(`[data-product-id="${n.id}"]`),b=y?.dataset.selectedVariant||n.variants[0].id.toString(),h=n.variants.find(e=>e.id.toString()===b)||n.variants[0],v=c.some(e=>e.productId===n.id.toString()&&e.variantId===b&&e.tierIndex===o),w=a===n.id,C=c.filter(e=>e.productId===n.id.toString()&&e.variantId===h.id.toString()&&e.tierIndex===o).reduce((e,t)=>e+t.quantity,0);return e.createElement(e.Fragment,null,e.createElement("div",{key:n.id,className:"yt-collection-bundle-product-item","data-product-id":n.id,"data-selected-variant":h.id,"data-current-price":h.price,style:{display:"flex",flexDirection:"column",border:r?.productCardBorder||"1px solid #ddd",background:r?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:i?0:"250px",maxWidth:i?"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:i?"100%":""}},e.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:()=>f(!0),onMouseEnter:()=>l(n.id),onMouseLeave:()=>l(null)},e.createElement("img",{src:Ap(n.images[0]||"https://cdn.shopify.com/s/files/1/0750/9937/3789/files/placeholder-thumbnail.png?width=250px"),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:w?0:1,transform:w?"scale(1.05)":"scale(1)"},alt:n.title}),e.createElement("img",{src:Ap(n.images[1]||n.images[0]),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:w?1:0,transform:"scale(1.05)"},alt:n.title}),n.variants.length>1&&e.createElement("select",{className:"yt-collection-bundle-variant-selector",style:{position:"absolute",bottom:"10px",left:"10px",right:"10px",background:"rgba(255,255,255,0.9)",border:"none",borderRadius:"4px",padding:"8px",fontSize:"12px",fontWeight:"600",zIndex:2,lineHeight:"normal"},onChange:e=>u(n,e.target.value),defaultValue:h.id,onClick:e=>{e.stopPropagation()}},n.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-product-info",style:{padding:"12px",flexGrow:1,display:"flex",flexDirection:"column"}},e.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:i?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:"normal",color:"#333",flexGrow:1}},n.title),e.createElement("div",{className:"yt-collection-bundle-product-prices",style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"nowrap",whiteSpace:"nowrap",overflow:"hidden",lineHeight:"normal"}},e.createElement("span",{className:"yt-collection-bundle-product-price",style:{fontSize:i?"14px":"16px",fontWeight:"bold",color:"#000",flexShrink:0,lineHeight:"normal"}},"₹",(h.price/100).toLocaleString()),h.compare_at_price&&h.compare_at_price>h.price&&e.createElement("span",{className:"yt-collection-bundle-product-compare",style:{fontSize:"14px",textDecoration:"line-through",color:"#999",flexShrink:0,lineHeight:"normal"}},"₹",(h.compare_at_price/100).toLocaleString()))),p&&C>0?e.createElement("div",{className:"yt-collection-bundle-quantity-row",style:{display:"flex",alignItems:"center",flexWrap:"nowrap",background:"#cccccc"}},e.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-minus",style:{width:"40%",height:h.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:i?"6px":"12px",fontSize:i?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{g(e=>{const t=`${n.id}-${h.id}-${o}`,r=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return r&&r.quantity>1?e.map(e=>e===r?{...e,quantity:e.quantity-1}:e):r?e.filter(e=>e!==r):e})}},"-"),e.createElement("span",{className:"yt-collection-bundle-qty-display",style:{minWidth:"24px",textAlign:"center",fontWeight:600,width:"100%",lineHeight:"normal"}},C),e.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-plus",style:{width:"40%",height:h.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:i?"6px":"12px",fontSize:i?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{h.available&&m(n,h.id.toString(),o)&&g(e=>{const t=`${n.id}-${h.id}-${o}`,r=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return r?e.map(e=>e===r?{...e,quantity:e.quantity+1}:e):[...e,{productId:n.id.toString(),variantId:h.id.toString(),price:h.price,quantity:1,tierIndex:o}]})},disabled:!h.available||!m(n,h.id.toString(),o)},"+")):e.createElement("button",{className:"yt-collection-bundle-add-btn "+(v?"yt-collection-bundle-add-btn-added":""),style:{background:v?"#28a745":s(n,o)&&h.available?r?.atcBg||"#007bff":"#ccc",color:r?.atcText||"#fff",border:"none",padding:i?"6px":"12px",fontSize:i?"12px":"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",opacity:h.available?1:.6,lineHeight:"normal",textAlign:"center"},onClick:()=>{h.available&&s(n,o)&&d(n,o)},disabled:!h.available||!s(n,o)},v?"Added":h.available?"ADD TO BOX":"Out of Stock")),x&&e.createElement(Sp,{product:n,tierIdx:o,isOpen:x,onClose:()=>f(!1),onAddToBundle:(e,t)=>{d(e,t),f(!1)},canAdd:s(n,o),isSelected:v,customizations:r,isMobile:i}))},Np=o=>{const{config:i,selectedProducts:a,selectedByTier:l,totalItems:c,totalPrice:d,totalCompareAtPrice:s,currentStep:p,totalSteps:u,currentTierMax:m,tierSelectedCounts:g,isMobile:x,bundleAddToCartLoading:f,isUploading:y,hoveredCard:b,setHoveredCard:h,getProductStep:v,setCurrentStep:w,handleRemoveItem:C,handleCheckout:E,hasForm:k,onHeightChange:T}=o,{customizations:S}=i,[$,B]=t(!1),I=r(null),z=r(null),{totalOriginal:N,hasSavings:F,formattedSavings:P,totalAfterDiscount:D}=(e=>{let t=0,n=0;e.forEach(({items:e,tier:o})=>{const r=o?.discountData;let i=0;e.forEach(e=>{const t=(e.price||0)/100,n=e.quantity||1;i+=t*n}),t+=i;let a=i;if("mov_percentage"===r?.type&&r.tiers?.length){const e=[...r.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity).filter(e=>i>=e.minimumQuantity);if(e.length>0){const t=e.reduce((e,t)=>t.discountValue>e.discountValue?t:e).discountValue/100;a=i*(1-t)}}n+=a});const o=Math.round(t-n),r=o>0;return{savings:o,totalOriginal:t,totalAfterDiscount:n,hasSavings:r,formattedSavings:r?`₹${o.toLocaleString()}`:"",calculatedDiscountedTotal:Math.round(n)}})(l),A=l.filter(({count:e})=>e>0).map(({tier:e,items:t})=>{const n=t.reduce((e,t)=>{if(!t)return e;return e+(t.price||0)*(t.quantity||1)},0)/100;return((e,t,n)=>{const o=e.discountData;if(!o||!o.tiers?.length)return null;const r=[...o.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity),i=[];if("mov_percentage"===o.type){if("number"!=typeof n)return null;const e=r.filter(e=>n>=e.minimumQuantity).pop();e&&i.push(`${e.discountValue}% OFF`);const t=r.find(e=>n<e.minimumQuantity);if(t){const e=t.minimumQuantity-n;i.push(`Add ₹${e} more to get ${t.discountValue}% OFF`)}return i.length?i.join(" + "):null}const a=r.filter(e=>t>=e.minimumQuantity);if(a.length>0){const e=a.reduce((e,t)=>e.minimumQuantity>t.minimumQuantity?e:t);let t=null;switch(o.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&&i.push(t)}const l=r.find(e=>t<e.minimumQuantity);if(l){const e=l.minimumQuantity-t;let n=null;switch(o.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&&i.push(`Add ${e} more item${1!==e?"s":""} to get ${n}`)}return i.length?i.join(" + "):null})(e,t.length,n)}).filter(Boolean);return n(()=>{const e=m!==1/0&&g[p-1]===m-2&&m>1;let t=null;return e?(B(!0),t=setTimeout(()=>{B(!1)},3e3)):B(!1),()=>{t&&clearTimeout(t)}},[m,g,p]),n(()=>{if(I.current&&T){const e=I.current.offsetHeight;T(e)}},[x,T,a]),n(()=>{const e=Math.max(...l.map(({tier:e,items:t})=>{if("mov_percentage"!==e?.discountData?.type)return 0;const n=t.reduce((e,t)=>e+(t.price||0)*(t.quantity||1),0)/100,o=(e?.discountData?.tiers||[]).filter(e=>n>=e.minimumQuantity).sort((e,t)=>t.discountValue-e.discountValue)[0];return o?.discountValue??0}));if(e<(z.current??0)&&(z.current=e),e>(z.current??0)){z.current=e;const t=document.querySelector(".yt-collection-bundle-next-btn");if(!t)return;const n=t.getBoundingClientRect(),o=(n.left+n.width/2)/window.innerWidth,r=(n.top+n.height/2)/window.innerHeight;ge({particleCount:100,spread:70,origin:{x:o,y:r},zIndex:9999})}},[l]),e.createElement("div",{ref:I,className:"yt-collection-bundle-bar",style:{background:S?.bundleBg||"#fff",color:S?.bundleText||"#333",border:S?.bundleBorder||"1px solid #878787",display:"flex",flexDirection:"column",position:"fixed",bottom:"10px",left:"50%",transform:"translateX(-50%)",width:"compact"==S.stickyBarWidth?"600px":"90%",maxWidth:"95%",zIndex:899,boxShadow:"0 -2px 10px rgba(0,0,0,0.1)",transition:"bottom 0.3s ease",borderRadius:S?.borderRadius||"8px",overflow:"hidden"}},A.length>0&&e.createElement("div",{style:{padding:"4px 8px",background:"#dbdbdbc5",color:"#6c757d",textAlign:"center",fontSize:"12px",fontWeight:500}},A.join(" + ")),e.createElement("div",{className:"yt-collection-bundle-bar-header",style:{position:"relative",textAlign:"center"}},$&&e.createElement(e.Fragment,null,e.createElement("style",null,"\n @keyframes fadeIn {\n from { opacity: 0; transform: translateX(-50%) translateY(10px); }\n to { opacity: 1; transform: translateX(-50%) translateY(0); }\n }\n "),e.createElement("div",{className:"yt-collection-bundle-ctx",style:{position:"absolute",top:"-40px",left:"50%",transform:"translateX(-50%)",background:S?.atcBg||"#007bff",color:S?.atcText||"#fff",padding:"4px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"14px",whiteSpace:"nowrap",zIndex:10,boxShadow:"0 4px 12px rgba(0,0,0,0.2)",animation:"fadeIn 0.3s ease-out",minWidth:"300px",textAlign:"center",border:"1px solid rgba(0,0,0,0.1)",lineHeight:"normal"}},"Add up to"," ",e.createElement("span",{style:{fontWeight:600}},m," item",m>1?"s":"")))),a.length>0&&e.createElement("div",{className:"yt-collection-bundle-bar-top",style:{display:"flex",alignItems:"center",padding:"8px 8px 0",position:"relative",borderRadius:S?.borderRadius||"8px"}},e.createElement("div",{className:"yt-collection-bundle-images",style:{display:"flex",flex:1,gap:"5px",justifyContent:"center",alignItems:"center",overflowX:"auto",padding:"4px 0",scrollbarWidth:"none"}},l.filter(({count:e})=>e>0).map(({items:t},n,o)=>e.createElement(e.Fragment,{key:n},e.createElement("div",{className:"yt-collection-bundle-tier-images",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",minWidth:"fit-content"}},e.createElement("div",{style:{display:"flex",gap:"4px"}},t.map((t,o)=>{const r=i.config.builderTiers.collectionTier.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId);if(!r)return null;const a=v(t.productId),l=p===a;return e.createElement("div",{key:o,className:"yt-collection-bundle-img-wrapper",style:{position:"relative",flexShrink:0,height:"65px"}},e.createElement("div",{style:{position:"relative",width:"67px",height:"67px",borderRadius:`calc(${S?.borderRadius||"8px"} / 2)`,overflow:"hidden",cursor:l?"default":"pointer",transition:"transform 0.2s ease"},onMouseEnter:e=>!l&&(e.currentTarget.style.transform="scale(1.08)"),onMouseLeave:e=>e.currentTarget.style.transform="scale(1)",onClick:()=>!l&&w(a)},e.createElement("img",{src:Ap(r.images[0]),style:{width:"65px",height:"65px",objectFit:"cover",borderRadius:`calc(${S?.borderRadius||"8px"} / 2)`,transition:"opacity 0.2s",pointerEvents:"none",border:"1px solid #ddd"},alt:"Selected"}),t.quantity>1&&e.createElement("div",{className:"yt-collection-bundle-qty-badge",style:{position:"absolute",bottom:"4px",right:"4px",background:"rgba(0,0,0,0.7)",color:"#fff",borderRadius:"10px",padding:"2px 6px",fontSize:"10px",fontWeight:600,lineHeight:"normal"}},"x",t.quantity),e.createElement("button",{className:"yt-collection-bundle-remove-btn",style:{position:"absolute",top:"4px",right:"4px",width:"20px",height:"20px",background:"rgba(220,53,69,0.95)",color:"white",border:"none",borderRadius:"50%",fontSize:"12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.3)",textAlign:"center",lineHeight:"normal"},onClick:e=>{e.stopPropagation(),C(t.productId,t.variantId,n)}},"×")))}))),n<o.length-1&&o[n+1].count>0&&e.createElement("div",{style:{color:"#666",paddingInline:"6px",lineHeight:"normal"}},e.createElement(Q,null)))))),x?e.createElement("div",{className:"yt-collection-bundle-mobile-bar-content",style:{display:"flex",flexDirection:c>0&&(k||i?.config?.builderTiers?.collectionTier?.length>1)?"column":"row",margin:"4px",gap:c>0?"10px":"0",background:"#dbdbdb",borderRadius:S?.borderRadius||"8px",overflow:"hidden"}},e.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:a.length>0?"space-between":"center",alignItems:"center",borderRadius:S?.borderRadius||"8px"}},e.createElement(e.Fragment,null,0===c&&e.createElement("div",{style:{fontSize:"14px",color:"#6c757d",lineHeight:"normal",...0===c&&{padding:"8px 0 12px 0",background:"#dbdbdb",color:"#6c757d",width:"100%",borderRadius:S?.borderRadius||"8px"}}},"Add Items to Checkout"),c>0&&e.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"6px",width:"100%",justifyContent:"center",flexWrap:"wrap"}},e.createElement("div",{style:{fontSize:"14px",color:"#000",fontWeight:600}},"₹",(D??d).toLocaleString()),F?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",N.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",P)):e.createElement(e.Fragment,null,s>d&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",s.toLocaleString())),e.createElement("span",{style:{fontSize:"12px",color:"#000",fontWeight:500}},"(",c," items)")))),e.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"4px"}},(i?.config?.builderTiers?.collectionTier?.length>1||k)&&c>0&&e.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:1===p?"not-allowed":"pointer",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",textAlign:"center",lineHeight:"normal"},onClick:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>h(-1),onMouseLeave:()=>h(null),disabled:1===p},"Back"),c>0&&e.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===c||y?"yt-collection-bundle-next-btn-disabled":""),style:{background:S?.btnPrimaryBg||"#28a745",color:S?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",opacity:p===u&&0===c||y?.6:1,textAlign:"center",lineHeight:"normal"},onClick:p===u?E:()=>w(p+1),disabled:p===u&&0===c||f||y},f?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(Tp,null)):p===u?"Checkout":"Next"))):e.createElement("div",{className:"yt-collection-bundle-bar-bottom",style:{display:"flex",alignItems:"center",padding:"0px",background:"#dbdbdb",margin:"8px",borderRadius:S?.borderRadius||"8px",overflow:"hidden",scrollbarWidth:"none"}},(i?.config?.builderTiers?.collectionTier?.length>1||k)&&c>0&&e.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:1===p?"not-allowed":"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",...-1===b&&{filter:"brightness(60%)"},textAlign:"center",lineHeight:"normal"},onClick:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>h(-1),onMouseLeave:()=>h(null),disabled:1===p},"Back"),e.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:a.length>0?"space-between":"center",paddingInline:"6px",alignItems:"center",...0===c&&{padding:"12px 24px"}}},0===c&&e.createElement("div",{style:{fontSize:"16px",color:"#6c757d",lineHeight:"normal"}},"Add Items to Checkout"),c>0&&e.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",justifyContent:"center"}},e.createElement("div",{style:{fontSize:"16px",color:"#000",fontWeight:600}},"₹",(D??d).toLocaleString()),F?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",N.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",P)):e.createElement(e.Fragment,null,s>d&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",s.toLocaleString())),e.createElement("span",{style:{fontSize:"16px",color:"#000",fontWeight:500}},"(",c," items)"))),c>0&&e.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===c||y?"yt-collection-bundle-next-btn-disabled":""),style:{background:S?.btnPrimaryBg||"#28a745",color:S?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",opacity:p===u&&0===c||y?.6:1,...-2===b&&{filter:"brightness(90%)"},textAlign:"center",lineHeight:"normal"},onClick:p===u?E:()=>w(p+1),disabled:p===u&&0===c||f||y,onMouseEnter:()=>h(-2),onMouseLeave:()=>h(null)},f?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(Tp,null)):p===u?"Checkout":"Next")))},Fp=window?.Shopify?.currency||{rate:1,active:"INR"},Pp=e=>{if(!e)return;const t=navigator.language||"en-US",n=Number((Number(e)*Fp.rate).toFixed(2));return new Intl.NumberFormat(t).format(n)},Dp=(e,t)=>t==Fp.active?e:oe(Fp.active)||Fp.active,Ap=(e,t)=>{if(!e||!e.includes("cdn.shopify")&&!e.includes("/cdn/shop/files/"))return e;try{const n=new URL(e),o=n.searchParams;return o.has("format")||o.set("format","webp"),o.has("quality")||o.set("quality",t?.toString()||"70"),o.has("width")||o.set("width","600"),n.toString()}catch{const n=e.includes("?")?"&":"?";return e+n+`format=webp&quality=70&width=${t?.toString()||"600"}`}},_p=(e,t,n,o,r,i)=>{const a=o.findIndex(t=>t.variantId===e);r(0===n?e=>e.filter((e,t)=>t!==a):-1===a?o=>[...o,{product:t,variantId:e,quantity:n,isFree:i}]:e=>e.map((e,t)=>t===a?{...e,quantity:e.quantity+n,isFree:i}:e))},Rp=({bundle:t,currentProductId:n,addToCartFunction:o,addCustomBundleToCart:r,selectedItems:i,setSelectedItems:a,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:d,renderingOnPage:s,bundleSubtotal:p,dispatchAnalyticsEvent:u,fetchStoreDetails:m})=>"fixed"!==t.type&&t.type&&0!==t?.type?.length?"builder"===t.type?e.createElement(Jc,{bundleAddToCartLoading:l,bundle:t,selectedItems:i,setSelectedItems:a,handleAddToCart:r,handleRemoveItem:c,renderingOnPage:s,selectedItemsQuantity:d??0,bundleSubtotal:p??{price:0,compareAtPrice:0},dispatchAnalyticsEvent:u,fetchStoreDetails:m}):"combo"===t.type?e.createElement(ed,{bundle:t,addToCartFunction:o,dispatchAnalyticsEvent:u}):"mixAndMatch"===t.type?e.createElement(ss,{bundle:t,addToCartFunction:o,dispatchAnalyticsEvent:u}):"collection"===t.type?e.createElement(Bp,{config:t,addCustomBundleToCart:r,bundleAddToCartLoading:l}):e.createElement(Nd,{bundle:t,currentProductId:n,addToCartFunction:o,dispatchAnalyticsEvent:u}):e.createElement(kp,{addToCartFunction:o,bundle:t,dispatchAnalyticsEvent:u});st(".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 Op=()=>e.createElement("div",{className:"scene"},e.createElement("div",{className:"floating"},e.createElement("div",{className:"cube"},e.createElement("div",{className:"side front"},""),e.createElement("div",{className:"side back"},""),e.createElement("div",{className:"side left"},""),e.createElement("div",{className:"side right"},""),e.createElement("div",{className:"side bottom"},""),e.createElement("div",{className:"lid"},e.createElement("div",{className:"flap north"},""),e.createElement("div",{className:"flap south"},""),e.createElement("div",{className:"flap east"},""),e.createElement("div",{className:"flap west"},""))))),Lp=({config:t,brandConfig:n})=>{const{heroDesktopImage:o,heroMobileImage:r,heroTitle:i="ZERO WASTE PREMIUM PET CARE",heroSubtitle:a="Earn Doglycoins for exclusive rewards every time you shop.",heroTextAlignment:l="left",heroSubtitleFontSize:c="18px",heroSubtitleColor:d="#000000",heroSubtitleFontWeight:s="400",heroTitleFontSize:p="48px",heroTitleColor:u="#000000",heroRegistrationCTAVisibility:m=!0,primaryColor:g="#1C1C1D",primaryContrastColor:x="#FFFFFF",secondaryColor:f="#FFFFFF",secondaryContrastColor:y="#000000",accentColor:b="#FFFFFF",borderColor:I="#E5E5E5",themeRoundness:z="0px",heroBannerVisibility:N="show",stepsVisibility:F="show",waysToEarnVisibility:P="show",waysToEarnCustomText:D="Individual rewards of 750 points or more ship FREE. No merchandise purchase required.",customSectionVisibility:A="show",footerSignupVisibility:_="show",customSectionImagePosition:R="left",customSectionTitle:O="Earn Doglycoins every time you shop",customSectionSubtitle:L="Collect more Doglycoins by entering your birthday, following us on social or referring a friend (details below)\n\nRedeem your Doglycoins for cash off at checkout by signing in or creating an account. Did you shop without registering? No worries, your Credits have been saved for you",customSectionTitleFontSize:M="36px",customSectionSubtitleFontSize:j="18px",customSectionImage:V,customSectionTextAlignment:W="left",customSectionTitleColor:H="#000000",customSectionSubtitleColor:q="#000000",stepsTitle:Q="Getting started is easy",stepsSubtitle:U="Earn Stars and get rewarded in a few easy steps.",step1Title:Y="CREATE AN ACCOUNT",step1Description:G="To get started, Join Now. You can also register on the mobile app to get access to the full range of reward benefits",step2Title:X="ORDER AND EARN REWARDS POINTS",step2Description:Z="Use cash, credit/debit card or save some time and pay right through the app. You'll collect Stars all ways.",step3Title:J="UNLOCK REWARDS AND OFFERS",step3Description:K="As you earn Stars, you can redeem them for Rewards—like free food, drinks, and more. Start redeeming with as little as 25 Stars!",footerCustomText:ee="Individual rewards of 750 points or more ship FREE. No merchandise purchase required.",footerSignupSubtext:te="Use your points to redeem samples and more."}=t||{},ne="undefined"!=typeof window&&window.innerWidth<=768,oe=e=>e&&e.startsWith("//")?`https:${e}`:e,re={padding:"12px 32px",borderRadius:"30px",fontSize:"14px",fontWeight:600,cursor:"pointer",textTransform:"uppercase",border:`1px solid ${g}`,transition:"all 0.3s ease"},ie={...re,backgroundColor:g,color:x,borderColor:g},ae={...re,backgroundColor:f,color:y,borderColor:I},{newSignupTokens:le,firstOrderTokens:ce,instagramFollowPoints:de,twitterFollowPoints:se,facebookFollowPoints:pe,youtubeSubscriptionPoints:ue,rewardToLeaveReview:me,birthdayPoints:ge,referralPointsForReferrer:xe,tokenCreditPercentage:fe,brandTokenName:ye}=n||{},be=[...le?[{icon:e.createElement(h,null),title:`${le} ${ye}`,subtitle:"Create an account"}]:[],...ce?[{icon:e.createElement(v,null),title:`${ce} ${ye}`,subtitle:"Place your first order"}]:[],...fe?[{icon:e.createElement(v,null),title:`${fe}% ${ye}`,subtitle:`Earn ${fe}% back on every order`}]:[],...xe?[{icon:e.createElement(w,null),title:`${xe} ${ye}`,subtitle:"Refer a friend and get"}]:[],...ge?[{icon:e.createElement(C,null),title:`${ge} ${ye}`,subtitle:"Get on your birthday to spend"}]:[],...me?[{icon:e.createElement(E,null),title:`${me} ${ye}`,subtitle:"Write a Review"}]:[],...pe?[{icon:e.createElement(k,null),title:`${pe} ${ye}`,subtitle:"Like on Facebook"}]:[],...de?[{icon:e.createElement(T,null),title:`${de} ${ye}`,subtitle:"Follow on Instagram"}]:[],...se?[{icon:e.createElement(S,null),title:`${se} ${ye}`,subtitle:"Follow on Twitter"}]:[],...ue?[{icon:e.createElement($,null),title:`${ue} ${ye}`,subtitle:"Subscribe on YouTube"}]:[]];return e.createElement("div",{className:"yt-loyalty-page-container",style:{fontFamily:"'Poppins', sans-serif",width:"100%",overflow:"hidden"}},"show"===N&&e.createElement("div",{className:"yt-loyalty-page-hero",style:{position:"relative",minHeight:"500px",display:"flex",alignItems:"center",justifyContent:"center"===l?"center":"right"===l?"flex-end":"flex-start",backgroundImage:`url(${oe(ne&&r?r:o)})`,backgroundSize:"cover",backgroundPosition:"center",padding:ne?"40px 20px":"60px 80px"}},e.createElement("div",{className:"yt-loyalty-page-hero-content",style:{maxWidth:"600px",zIndex:2,textAlign:l}},e.createElement("h1",{className:"yt-loyalty-page-hero-title",style:{fontSize:ne?"32px":p,color:u,marginBottom:"16px",lineHeight:1.1,fontWeight:800,textTransform:"uppercase"}},i),e.createElement("p",{className:"yt-loyalty-page-hero-subtitle",style:{fontSize:c,color:d,fontWeight:Number(s)||400,marginBottom:"32px"}},a),m&&e.createElement("div",{className:"yt-loyalty-page-hero-button-wrapper",style:{display:"flex",gap:"16px",justifyContent:"center"===l?"center":"right"===l?"flex-end":"flex-start"}},e.createElement("button",{className:"yt-loyalty-page-hero-button",style:ie,onClick:()=>{"undefined"!=typeof window&&window.ytapp&&(window.ytapp.loyaltyWidgetOpen=!0,window.dispatchEvent(new Event("loyaltyWidgetOpenChanged")))}},"Join Now")))),"show"===F&&e.createElement("div",{className:"yt-loyalty-page-steps",style:{padding:"40px 20px",position:"relative",textAlign:"center"}},e.createElement("div",{className:"yt-loyalty-page-steps-background-text",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",fontSize:"12vw",fontWeight:900,color:"#F5F5F5",zIndex:0,whiteSpace:"nowrap",pointerEvents:"none",opacity:.5}},"GETTING STARTED"),e.createElement("div",{className:"yt-loyalty-page-steps-content",style:{position:"relative",zIndex:1}},e.createElement("h2",{className:"yt-loyalty-page-steps-title",style:{fontSize:"32px",fontWeight:700,marginBottom:"8px",color:"#000"}},Q),e.createElement("p",{className:"yt-loyalty-page-steps-subtitle",style:{color:g,marginBottom:"24px"}},U),e.createElement("div",{className:"yt-loyalty-page-steps-grid",style:{display:"flex",flexDirection:ne?"column":"row",justifyContent:"center",gap:"40px",maxWidth:"1200px",margin:"0 auto"}},[{icon:e.createElement(v,null),title:Y,desc:G},{icon:e.createElement(B,null),title:X,desc:Z},{icon:e.createElement(C,null),title:J,desc:K}].map((t,n)=>e.createElement("div",{key:n,className:"yt-loyalty-page-step-item",style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center"}},e.createElement("div",{className:"yt-loyalty-page-step-icon",style:{width:"80px",height:"80px",borderRadius:"50%",border:"4px solid #ccc",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"32px",color:"#666",marginBottom:"12px"}},t.icon),e.createElement("div",{className:"yt-loyalty-page-step-title",style:{fontSize:"16px",fontWeight:700,color:g,textTransform:"uppercase",lineHeight:"normal"}},t.title),e.createElement("p",{className:"yt-loyalty-page-step-description",style:{fontSize:"13px",color:g,lineHeight:1.2,maxWidth:"300px"}},t.desc)))))),"show"===P&&e.createElement("div",{className:"yt-loyalty-page-ways-to-earn",style:{padding:"40px 20px",position:"relative",borderTop:"1px solid #eee"}},e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-background-text",style:{position:"absolute",top:ne?"10%":"50%",left:"50%",transform:"translate(-50%, -50%)",fontSize:"12vw",fontWeight:900,color:"#F5F5F5",zIndex:0,whiteSpace:"nowrap",pointerEvents:"none",opacity:.5}},"WAYS TO EARN"),e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-grid",style:{position:"relative",zIndex:1,maxWidth:"1000px",margin:"0 auto",display:"flex",flexWrap:"wrap",justifyContent:"center",gap:"12px"}},be.map((t,n)=>e.createElement("div",{key:n,className:"yt-loyalty-page-ways-to-earn-item",style:{width:ne?"100%":"220px",border:"2px solid #ddd",padding:"12px 8px",display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",borderRadius:z,boxShadow:"-1px 2px 3px rgba(0,0,0,0.1)"}},e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-icon",style:{fontSize:"32px",marginBottom:"4px",color:"#1a1a2e"}},t.icon),e.createElement("h3",{className:"yt-loyalty-page-ways-to-earn-title",style:{fontSize:"13px",fontWeight:700,marginBottom:"2px",textTransform:"uppercase",color:"#000"}},t.title),e.createElement("p",{className:"yt-loyalty-page-ways-to-earn-subtitle",style:{fontSize:"11px",color:"#666"}},t.subtitle)))),D&&e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-custom-text",style:{maxWidth:"1000px",margin:"24px auto 0",backgroundColor:b,color:"#fff",padding:"16px",textAlign:"center",fontSize:"12px",fontStyle:"italic",borderRadius:"4px"}},D)),"show"===A&&e.createElement("div",{className:"yt-loyalty-page-custom-section",style:{padding:ne?"40px 0px":"40px 20px",borderTop:"1px solid #eee"}},e.createElement("div",{className:"yt-loyalty-page-custom-section-container",style:{maxWidth:"1200px",margin:"0 auto",display:"flex",flexDirection:ne?"column":"row",alignItems:"center",gap:"40px",borderRadius:z,overflow:"hidden",backgroundColor:"#F9F9F9"}},e.createElement("div",{className:"yt-loyalty-page-custom-section-image-wrapper",style:{flex:1,width:"100%",order:ne||"left"===R?0:1}},e.createElement("div",{className:"yt-loyalty-page-custom-section-image",style:{display:"flex",width:"100%",height:"300px",backgroundColor:"#ddd",backgroundImage:V?`url(${oe(V)})`:o?`url(${oe(o)})`:void 0,backgroundSize:"cover",backgroundPosition:"center"}})),e.createElement("div",{className:"yt-loyalty-page-custom-section-content",style:{flex:1,paddingInline:ne?"20px":"10px",textAlign:ne?"center":W,order:ne||"left"===R?1:0,marginBottom:ne?"20px":"0px"}},e.createElement("h2",{className:"yt-loyalty-page-custom-section-title",style:{fontSize:M,fontWeight:700,marginBottom:"16px",color:H}},O),e.createElement("p",{className:"yt-loyalty-page-custom-section-subtitle",style:{fontSize:j,color:q,marginBottom:"24px",lineHeight:1.6,whiteSpace:"pre-line"}},L)))),"show"===_&&e.createElement("div",{className:"yt-loyalty-page-footer",style:{marginBottom:"20px"}},e.createElement("div",{className:"yt-loyalty-page-footer-container",style:{maxWidth:"1200px",margin:"0 auto"}},e.createElement("div",{className:"yt-loyalty-page-footer-custom-text",style:{backgroundColor:b,color:"#fff",padding:"16px",textAlign:"center",fontSize:"12px",fontStyle:"italic",borderRadius:"4px"}},ee),e.createElement("div",{className:"yt-loyalty-page-footer-signup",style:{display:"flex",flexDirection:ne?"column":"row",justifyContent:"space-between",alignItems:"center",marginTop:"40px",padding:"20px",border:"1px solid #eee",borderRadius:"4px",gap:"20px",textAlign:ne?"center":"left"}},e.createElement("div",{className:"yt-loyalty-page-footer-signup-content"},e.createElement("h3",{style:{fontSize:"20px",fontWeight:700,marginBottom:"4px",color:"#000",textAlign:ne?"center":"left"}},"Rewards Program"),e.createElement("p",{style:{fontSize:"14px",color:"#666"}},te)),e.createElement("button",{className:"yt-loyalty-page-footer-signup-button",style:ae,onClick:()=>{"undefined"!=typeof window&&window.ytapp&&(window.ytapp.loyaltyWidgetOpen=!0,window.dispatchEvent(new Event("loyaltyWidgetOpenChanged")))}},"JOIN NOW")))))},Mp=({showPopup:n,selectedOffer:o,selectedOfferTerms:r,onClose:i,offersConfig:a})=>{const[l,c]=t(!1);if(!n||!o||!r)return null;const d=o._customOffer,s=d?.code||o.code,p=e.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:i},e.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()},e.createElement("div",{style:{fontSize:"clamp(32px, 8vw, 40px)",color:"#4C4C4C",marginTop:"16px",marginBottom:"8px",display:"flex",justifyContent:"center",position:"relative"}},"free_product"===o.couponType?e.createElement(y,null):e.createElement(Ae,null)),e.createElement("div",{style:{fontSize:"clamp(16px, 4vw, 20px)",fontWeight:500,color:"#4C4C4C",lineHeight:"normal",textAlign:"center"}},o.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")),e.createElement("div",{style:{fontSize:"clamp(28px, 7vw, 40px)",fontWeight:"600",color:a?.textColor||"#EE8E35",lineHeight:"normal",textAlign:"center"}},o.name),e.createElement("div",{style:{fontSize:"clamp(16px, 4vw, 20px)",color:"#000000",textAlign:"center",fontWeight:500}},r.offerMessage),s&&e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",marginTop:"16px",padding:"12px 20px",backgroundColor:a?.cardBackgroundColor||"#F5F5F5",borderRadius:`${a?.roundness||8}px`,border:`1px dashed ${a?.accentColor||"#EE8E35"}`}},e.createElement("span",{style:{fontSize:"clamp(16px, 4vw, 18px)",fontWeight:"600",color:a?.textColor||"#333",letterSpacing:"1px"}},s),e.createElement("button",{onClick:async()=>{if(s)try{await navigator.clipboard.writeText(s),c(!0),setTimeout(()=>c(!1),2e3)}catch(e){console.error("Failed to copy:",e)}},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:l?"#22c55e":a?.accentColor||"#EE8E35",fontSize:"20px",transition:"color 0.2s ease"},title:l?"Copied!":"Copy code"},l?e.createElement(I,null):e.createElement(z,null))),r.terms.length>0&&e.createElement(e.Fragment,null,e.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"}}),e.createElement("div",{style:{marginTop:"15px",fontSize:"clamp(14px, 3.5vw, 16px)",textAlign:"center",display:"flex",flexDirection:"column"}},e.createElement("strong",{style:{color:"#888"}},"Terms & Conditions"),e.createElement("ul",{style:{marginTop:"5px",paddingLeft:"20px",textAlign:"left",display:"inline-block",color:"#000",lineHeight:"1.3",marginBottom:"0"}},r.terms.map((t,n)=>e.createElement("li",{key:n,style:{marginBottom:"4px"}},t))))),e.createElement("button",{onClick:i,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 rt(p,document.body)},jp=({showPopup:n,selectedOffer:o,selectedOfferTerms:r,onClose:i,offersConfig:a})=>{const[l,c]=t(!1);if(!n||!o||!r)return null;const d=o._customOffer,s=d?.code||o.code,p=e.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:i},e.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 "),e.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()},e.createElement("div",{style:{width:"40px",height:"4px",backgroundColor:"#ddd",borderRadius:"2px",margin:"12px auto 16px",flexShrink:0}}),e.createElement("div",{style:{overflowY:"auto",flex:1}},e.createElement("div",{style:{padding:"0 20px 20px",backgroundColor:"#fff"}},e.createElement("div",{style:{fontSize:"48px",color:"#4C4C4C",display:"flex",justifyContent:"center",margin:"16px"}},"free_product"===o.couponType?e.createElement(y,null):e.createElement(Ae,null)),e.createElement("div",{style:{fontSize:"14px",fontWeight:500,color:"#888",textAlign:"center"}},o.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")),e.createElement("div",{style:{fontSize:"32px",fontWeight:"700",color:a?.textColor||"#EE8E35",textAlign:"center",lineHeight:"1.2"}},o.name),e.createElement("div",{style:{fontSize:"18px",color:"#000000",textAlign:"center",fontWeight:500}},r.offerMessage),s&&e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",marginTop:"20px",padding:"14px 20px",backgroundColor:a?.cardBackgroundColor||"#F5F5F5",borderRadius:`${a?.roundness||8}px`,border:`1px dashed ${a?.accentColor||"#EE8E35"}`}},e.createElement("span",{style:{fontSize:"18px",fontWeight:"600",color:a?.textColor||"#333",letterSpacing:"1px"}},s),e.createElement("button",{onClick:async()=>{if(s)try{await navigator.clipboard.writeText(s),c(!0),setTimeout(()=>c(!1),2e3)}catch(e){console.error("Failed to copy:",e)}},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:l?"#22c55e":a?.accentColor||"#EE8E35",fontSize:"22px",transition:"color 0.2s ease"},title:l?"Copied!":"Copy code"},l?e.createElement(I,null):e.createElement(z,null)))),r.terms.length>0&&e.createElement(e.Fragment,null,e.createElement("div",{style:{backgroundColor:"#F5F5F5",padding:"16px 20px"}},e.createElement("div",{style:{fontSize:"16px",fontWeight:"600",color:"#333",textAlign:"center"}},"Terms & Conditions")),e.createElement("div",{style:{padding:"20px",backgroundColor:"#fff"}},e.createElement("ul",{style:{margin:"0",paddingLeft:"20px",color:"#333",lineHeight:"1.6",fontSize:"14px"}},r.terms.map((t,n)=>e.createElement("li",{key:n,style:{marginBottom:"4px"}},t)))))),e.createElement("button",{onClick:i,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 rt(p,document.body)},Vp=({offersToShow:o,offersConfig:i,getOfferCardMessage:a,setSelectedOffer:l,setShowPopup:c})=>{const d=r(null),[s,p]=t(!1),[u,m]=t(!0),[g,x]=t("undefined"!=typeof window&&window.innerWidth<=768),f=()=>{if(d.current){const{scrollLeft:e,scrollWidth:t,clientWidth:n}=d.current;p(e>0),m(e<t-n-10)}};n(()=>{f();const e=d.current;if(e)return e.addEventListener("scroll",f),()=>e.removeEventListener("scroll",f)},[o]),n(()=>{const e=()=>{x(window.innerWidth<=768)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const b=e=>{if(d.current){const t=g?280:365,n=16,o="right"===e?t+n:-(t+n);d.current.scrollBy({left:o,behavior:"smooth"})}};return e.createElement("div",{style:{position:"relative"}},e.createElement("svg",{style:{position:"absolute",width:0,height:0}},e.createElement("defs",null,e.createElement("mask",{id:"coupon-cut-mask-desktop"},e.createElement("rect",{width:"365",height:"138",fill:"white"}),e.createElement("circle",{cx:"80",cy:"0",r:"12",fill:"black"}),e.createElement("circle",{cx:"80",cy:"138",r:"12",fill:"black"})),e.createElement("mask",{id:"coupon-cut-mask-mobile"},e.createElement("rect",{width:"280",height:"120",fill:"white"}),e.createElement("circle",{cx:"60",cy:"0",r:"10",fill:"black"}),e.createElement("circle",{cx:"60",cy:"120",r:"10",fill:"black"})))),s&&e.createElement("button",{onClick:()=>b("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"}},e.createElement(N,{size:20})),u&&e.createElement("button",{onClick:()=>b("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"}},e.createElement(F,{size:20})),e.createElement("div",{ref:d,className:"hide-scrollbar",style:{display:"flex",alignItems:"stretch",overflowX:"auto",gap:"16px",scrollbarWidth:"none",msOverflowStyle:"none",minHeight:g?"110px":"128px"}},o?.map(t=>e.createElement("div",{key:t.discountId,style:{flexShrink:0,width:g?"280px":"365px",minWidth:g?"280px":"365px",minHeight:g?"110px":"128px",backgroundColor:"transparent",borderRadius:`${i?.roundness||0}px`,border:"1px solid #e0e0e0",display:"flex",position:"relative",overflow:"visible",mask:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,WebkitMask:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,maskImage:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,WebkitMaskImage:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`}},e.createElement("div",{style:{width:g?"60px":"80px",minHeight:g?"110px":"128px",backgroundColor:i?.accentColor||"#EE8E35",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:g?"10px 6px":"12px 8px",position:"relative",borderTopLeftRadius:`${i?.roundness||0}px`,borderBottomLeftRadius:`${i?.roundness||0}px`}},e.createElement("div",{style:{position:"absolute",right:"-2px",top:"12px",bottom:"12px",width:"2px",borderLeft:"2px dashed #FFFFFF"}})),i?.iconVisibility&&e.createElement("div",{style:{position:"absolute",left:g?"42.5px":"57.5px",top:"35%",transform:"translateY(-50%)",width:g?"32px":"40px",height:g?"32px":"40px",backgroundColor:"#FFFFFF",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:g?"16px":"20px",color:"#333333",zIndex:10,boxShadow:"0 2px 5px rgba(0,0,0,0.1)",border:"1px solid #E0E0E0"}},"free_product"===t.couponType?e.createElement(y,null):e.createElement(Ae,null)),e.createElement("div",{style:{flex:1,padding:g?"12px 12px":"15px 15px",paddingLeft:g?"25px":"35px",display:"flex",flexDirection:"column",justifyContent:"space-between",borderTopRightRadius:`${i?.roundness||0}px`,borderBottomRightRadius:`${i?.roundness||0}px`,overflow:"hidden",backgroundColor:i?.cardBackgroundColor||"#ffffff",minWidth:0}},e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:g?"4px":"6px",lineHeight:"normal"}},e.createElement("div",{style:{fontSize:g?"9px":"10px",color:"#666666",fontWeight:"400"}},"free_product"===t.couponType?"Free Gift":t._customOffer?.code?"Coupon":"Special Deal"),e.createElement("div",{style:{fontSize:g?"13px":"15px",fontWeight:"600",color:i?.textColor||"#2c3e50"}},t.name),e.createElement("div",{style:{fontSize:g?"11px":"12px",color:i?.accentColor||"#EE8E35",wordWrap:"break-word",overflowWrap:"break-word",whiteSpace:"normal",minHeight:g?"28px":"32px"}},a(t))),e.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},e.createElement("div",{style:{borderTop:"1px solid #999999",marginTop:"4px",width:"100%",height:"0",display:"block"}}),e.createElement("a",{href:"#",onClick:e=>{e.preventDefault(),l(t),c(!0)},style:{fontSize:g?"11px":"12px",color:"#2c3e50",fontWeight:"500",textDecoration:"none",cursor:"pointer",textAlign:"center",marginTop:"0"}},i?.viewDetailsTitle||"View Details")))))),e.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 "))},Wp=({offersToShow:o,offersConfig:r,getOfferCardMessage:i,setSelectedOffer:a,setShowPopup:l})=>{const[c,d]=t("undefined"!=typeof window&&window.innerWidth<=768);return n(()=>{const e=()=>{d(window.innerWidth<=768)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e.createElement("div",{style:{borderRadius:`${r?.roundness||8}px`}},o?.map((t,n)=>e.createElement("div",{key:t.discountId,style:{display:"flex",alignItems:"flex-start",gap:c?"8px":"12px",padding:c?"12px 0":"16px 0",paddingLeft:c?"10px":"20px",backgroundColor:!0===r?.cardBackgroundTransparent||"true"===String(r?.cardBackgroundTransparent)?"transparent":r?.cardBackgroundColor||"#ffffff",borderBottom:n<(o?.length||0)-1?"1px solid rgb(225 218 218)":"none",marginBottom:"4px",borderRadius:`${r?.roundness||0}px`}},r?.iconVisibility&&e.createElement("div",{style:{width:c?"40px":"50px",height:c?"40px":"50px",backgroundColor:"#f8f9fa",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:c?"20px":"25px",marginTop:c?"5px":"10px",border:"2px solid #4a4a4a",color:"#4a4a4a"}},"free_product"===t.couponType?e.createElement(y,null):e.createElement(Ae,null)),e.createElement("div",{style:{flex:1}},e.createElement("div",{style:{fontSize:c?"14px":"15px",fontWeight:600,color:"#000000",lineHeight:"1"}},t.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "),":"," ",e.createElement("span",{style:{fontWeight:600,color:r?.textColor||"#34495e"}},t.name)),e.createElement("div",{style:{fontSize:c?"12px":"13px",color:"#7f8c8d",marginBottom:"6px"}},i(t)),e.createElement("div",{style:{fontSize:c?"11px":"12px",color:"#000000"}},"offer auto applied",e.createElement("a",{href:"#",onClick:e=>{e.preventDefault(),a(t),l(!0)},style:{color:r?.accentColor||"#7f8c8d",fontWeight:700,textDecoration:"none",marginLeft:"2px"}},r?.viewDetailsTitle||"T&C"))))))},Hp=({offersConfig:o,offers:i})=>{const[a,l]=t(!1),[c,d]=t(null),[s,p]=t(null),[u,m]=t("undefined"!=typeof window&&window.innerWidth<=768),[g,x]=t("undefined"!=typeof window&&window.innerWidth<=450),f=r(null);n(()=>{const e=()=>{m(window.innerWidth<=768),x(window.innerWidth<=450)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),n(()=>{f.current&&ln(f.current)},[o?.sectionBgContrastColor]);const y=(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",o=-1;Object.keys(t).forEach(e=>{t[e]>o&&(o=t[e],n=e)});const r=e.map((e,t)=>({o:e,idx:t})),i=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 r.sort((e,t)=>{const o=e.o.customCartProgressBarCriteria===n,r=t.o.customCartProgressBarCriteria===n;if(o&&r){const n=i(e.o),o=i(t.o);return n!==o?n-o:e.idx-t.idx}return o&&!r?-1:!o&&r?1:e.idx-t.idx}),r.map(e=>e.o)})((!1===o?.showBackendOffers&&o?.customOffers&&o.customOffers.length>0?o.customOffers.map((e,t)=>{return{discountId:-(t+1),name:(n=e).title,couponType:n.code?"discount_code":"special_deal",customCartProgressBarCriteria:null,discountPercentage:null,couponTemplateId:0,minimumOrderValue:0,quantityThreshold:0,_allVariantIds:[],description:n.description,_customOffer:n};var n}):i)||[]),b=e=>{if(d(e),e){const t=e._customOffer;p(t?(e=>({offerMessage:e.description||"Special offer available",terms:e.terms?e.terms.split("\n").filter(e=>""!==e.trim()):[]}))(t):(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 o=["Limited Time Offer","Applies automatically when criteria is met"];return"quantity"===e.customCartProgressBarCriteria&&e.quantityThreshold?o.push(`Unlock when you add ${e.quantityThreshold} ${e.quantityThreshold>1?"items":"item"} to cart`):"minimum_order_value"===e.customCartProgressBarCriteria&&e.minimumOrderValue&&o.push(`Unlock at order value of ${e.minimumOrderValue}`),t&&o.push("Combines with other order discounts"),t||o.push("Not applicable if other offer with higher discount applied on same product"),{offerMessage:n,terms:o}})(e))}},h=e=>{const t=e._customOffer;return t?t.description||"Special offer available":(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")(e)};return e.createElement("div",null,e.createElement("div",{style:{position:"relative",width:"100%",maxWidth:"450px",borderRadius:"list"===o?.sectionType?`${o?.roundness||0}px`:"0px",boxSizing:"border-box",backgroundColor:o?.sectionBackgroundColor||"#fff"}},e.createElement("div",{style:{border:"coupon"===o?.sectionType?"none":"1px solid rgb(169, 163, 163)",borderTop:"1px solid rgb(169, 163, 163)",padding:null!=o?.cardPadding?`${o.cardPadding}px`:u?"20px 10px 15px":"30px 15px 20px",position:"relative",borderRadius:"list"===o?.sectionType?`${o?.roundness||8}px`:"0px"}},e.createElement("span",{ref:f,className:"yt-product-offers-section-title",style:{position:"absolute",top:"0",left:"left"===o?.alignment?"coupon"===o?.sectionType?"0px":u?"10px":"20px":"right"===o?.alignment?"auto":"50%",right:"right"===o?.alignment?"coupon"===o?.sectionType?"0px":u?"10px":"20px":"auto",transform:"middle"===o?.alignment?"translateX(-50%) translateY(-50%)":"translateY(-50%)",background:o?.sectionBgContrastColor||"#fff",padding:u?"0 8px":"0 10px",fontWeight:"500",fontSize:u?"14px":"16px",textTransform:"uppercase",textAlign:"center"}},o?.sectionTitle||"Available Deals and Offers"),(()=>{const t=o?.sectionType;return"list"===t?e.createElement(Wp,{offersToShow:y,offersConfig:o||{},getOfferCardMessage:h,setSelectedOffer:b,setShowPopup:l}):"coupon"===t?e.createElement(Vp,{offersToShow:y,offersConfig:o||{},getOfferCardMessage:h,setSelectedOffer:b,setShowPopup:l}):null})(),g?e.createElement(jp,{selectedOffer:c,selectedOfferTerms:s,showPopup:a,offersConfig:o,onClose:()=>{l(!1),d(null),p(null)}}):e.createElement(Mp,{selectedOffer:c,selectedOfferTerms:s,showPopup:a,offersConfig:o,onClose:()=>{l(!1),d(null),p(null)}}))))};export{Rp as Bundle,Op as BundleLoader,Ol as Cart,Lp as LoyaltyPageBlock,At as Nudge,Hp as ProductOffers,Vt as SpinnerWheel};
|
|
5111
|
+
`,vp=({productsWithIndices:r,isOpen:i,onClose:a,cta:l,variantOptions:c,onVariantChange:d,handleAddToCart:s,primaryProductId:p,variantId:u})=>{const m=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e?.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?1/0:0:1/0:0},[]),[g,x]=t({}),[f,y]=t({});n(()=>{const e={},t={};r?.forEach(({product:n,index:o})=>{let r,i=[];if(n.productId===p&&u){const e=n?.productDetails?.variants?.edges.find(e=>e?.node?.id?.includes(u))?.node;e&&m(n.productDetails,e.id)>0&&(i=e.title.split(" / "),r=e)}if(!i.length){const e=n.productDetails.variants.edges.find(e=>m(n.productDetails,e?.node?.id)>0)?.node||n?.productDetails?.variants?.edges?.[0]?.node;e?(i=e.title.split(" / "),r=e):i=n?.productDetails?.options?.map(e=>e.values[0]??"")}e[o]=i,r&&(t[o]={node:r},d(o,r.id))}),x(e),y(t)},[r,p,u,d,m]),n(()=>{if(!p||!u)return;const e=r?.find(({product:e})=>e?.productId===p);if(!e)return;const{product:t,index:n}=e,o=t?.productDetails?.variants?.edges?.find(e=>e.node.id.includes(u))?.node;if(o&&m(t.productDetails,o.id)>0){const e=o.title.split(" / ");x(t=>({...t,[n]:e})),y(e=>({...e,[n]:{node:o}})),d(n,o.id)}},[u,p,r,d,m]);const b=(e,t,n,o)=>{const r=[...g[e]||[]];r[t]=n;const i=r.join(" / "),a=o.productDetails.variants.edges.find(e=>e.node.title===i)?.node;return!!a&&m(o.productDetails,a.id)>0},h=(e,t,n)=>{const{product:o}=r?.find(t=>t.index===e)||{product:{productDetails:{variants:{edges:[]}}}};if(!o?.productDetails)return;if(!b(e,n,t,o))return;const i={...g};i[e][n]=t,x(i);const a=o?.productDetails?.variants?.edges?.find(t=>t.node.title===i[e].join(" / "))?.node;a&&(d(e,a.id),y(t=>({...t,[e]:{node:a}})))};if(!i)return null;const v=e.createElement(ip,{className:"yt-fixedBundle-variant-modal_overlay",onClick:a},e.createElement(ap,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},e.createElement(lp,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:l.backgroundColor,color:l.textColor}},"Select Options"),r?.map(({product:t,index:n},o)=>e.createElement(e.Fragment,null,e.createElement(dp,{className:"yt-fixedBundle-variant-modal_product-block"},e.createElement(sp,{className:"yt-fixedBundle-variant-modal_thumbnail",src:f[n]?.node?.image?.url||t.productDetails.featuredMedia?.preview?.image?.url,alt:t.productDetails.title}),e.createElement(pp,{className:"yt-fixedBundle-variant-modal_product-info"},e.createElement(up,{className:"yt-fixedBundle-variant-modal_product-name"},t.productDetails.title,t.productDetails.variants.edges.length>1&&e.createElement(gp,{className:"yt-fixedBundle-variant-modal_selected-value"},g[n]?.join(" / "))),t.productDetails.options.map((o,r)=>{const i=c&&c?.options?.find(e=>e.name===o.name);return o.values.length<=1?e.createElement(e.Fragment,null):i&&"color"===i?.type?e.createElement(xp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(hp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),o.values.map((o,a)=>{const l=!b(n,r,o,t);return e.createElement(e.Fragment,null,i.values.find(e=>e.name===o)?.value?e.createElement(fp,{className:"yt-fixedBundle-variant-modal_color-swatch",key:a,color:i.values.find(e=>e.name===o)?.value||o,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},e.createElement("span",null)):e.createElement(yp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},o))})):i&&"image"===i?.type?e.createElement(xp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(hp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),o.values.map((o,a)=>{const l=!b(n,r,o,t);return e.createElement(e.Fragment,null,i?.values.find(e=>e.name===o)?.value?e.createElement(bp,{className:"yt-fixedBundle-variant-modal_image-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)},src:i.values.find(e=>e.name===o)?.value},e.createElement("span",null)):e.createElement(yp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},o))})):e.createElement(xp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(hp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),o.values.map((o,i)=>{const a=!b(n,r,o,t);return e.createElement(yp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:i,selected:g[n]?.[r]==o,disabled:a,onClick:()=>{h(n,o,r)}},o)}))}))),o<r.length-1&&e.createElement(mp,{className:"yt-fixedBundle-variant-modal_divider"}))),e.createElement(cp,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:l.backgroundColor,color:l.textColor},onClick:s},"Add bundle to cart")));return ot.createPortal(v,document.body)},wp=({options:o,selectedValue:i,onChange:a,type:l="text"})=>{const[c,d]=t(!1),s=r(null);n(()=>{const e=e=>{s.current&&!s.current.contains(e.target)&&d(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const p=t=>"color"===l?e.createElement(Xs,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:t.value},e.createElement("span",null)):"image"===l?e.createElement(Zs,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:t.value||"/placeholder.svg",alt:t.name},e.createElement("span",null)):null;return e.createElement(Ws,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:s},e.createElement(Hs,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>d(!c)},e.createElement(qs,{className:"yt-fixedBundle-variant-dropdown-horizontal_content"},i&&("color"===l||"image"===l)&&p(i),e.createElement("span",{className:"yt-fixedBundle-variant-dropdown-horizontal_selected-text"},i&&i.name)),e.createElement(Qs,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:c})),c&&e.createElement(Us,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},o?.map(t=>e.createElement(Ys,{className:"yt-fixedBundle-variant-selector_dropdown-item "+(i?.name===t.name?"yt-fixedBundle-variant-selector_dropdown-item--selected":""),key:t.name,$isSelected:i?.name===t.name,onClick:()=>{a(t),d(!1)}},("color"===l||"image"===l)&&p(t),e.createElement(Gs,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},t.name)))))},Cp=({product:o,variantOptions:r,selectedVariants:i,onVariantChange:a,variantId:l,primaryProductId:c,variantType:d="dropdown"})=>{const[s,p]=t(i||[]);n(()=>{if(l&&o.variants.edges.some(e=>e.node.id.includes(l))){const e=o.variants.edges.find(e=>e.node.id.includes(l))?.node;if(e){const t=e.title.split(" / ");p(t)}}},[l,o]);const u=e=>{if(!r?.options)return"text";const t=r.options.find(t=>t.name===e);return t?.type||"text"},m=(e,t)=>{if(!r?.options)return e.values.map(e=>({name:e,value:e}));const n=r.options.find(t=>t.name===e.name);return e.values.map(e=>{const t=n?.values?.find(t=>t.name===e);return{name:e,value:t?.value||e}})},g=(e,t)=>{const n=s[t];if(!n)return null;return m(e).find(e=>e.name===n)||null};return e.createElement(Js,{className:"yt-fixedBundle-variant-selector-horizontal_container"},o.options.map((t,n)=>e.createElement(Ks,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:t.name,$isFirst:0===n},t?.values?.length>1&&e.createElement(wp,{options:m(t),selectedValue:g(t,n),onChange:e=>{console.log(e),((e,t)=>{const n=[...s];n[e]=t.name,p(n);const r=o.variants.edges.find(t=>t.node.title===(o.options?.length>0?n.join(" / "):n[e]))?.node.id;a(r||"")})(n,e)},type:u(t.name)}))))},Ep=({product:r,selectedVariantId:a,isChecked:l,canCustomize:c,styles:d,onVariantChange:s,onCheckChange:p,isMobile:u,isHorizontal:m,index:g,variantOptions:x,productsLength:f,handleOpenModal:y,storeCurrencyCode:b,primaryProductId:h,variantId:v,checkedProducts:w,bundleDiscountValue:C,bundleDiscountType:E,bundleProductsCount:k,totalSelectedOriginal:T})=>{const S=o(()=>e=>{const t=r?.variants?.edges?.find(t=>t.node.id===e),n=t?.node;return n?r?.tracksInventory&&n.inventoryItem?.tracked?n.inventoryQuantity>0?n.inventoryQuantity:n.inventoryQuantity<=0&&"continue"===n.inventoryPolicy?1/0:0:1/0:0},[r]),[$,B]=t(r?.variants?.edges.find(e=>S(e?.node?.id)>0)?.node||r?.variants?.edges?.[0]?.node),[I]=t(r?.options?.map(e=>e?.values?.[0])||[]),z=r?.id===h;n(()=>{if(r.id===h){const e=r?.variants?.edges?.find(e=>e?.node?.id?.includes(a))?.node;e&&S(e.id)>0&&(B(e),s(e.id))}else{const e=r?.variants?.edges?.find(e=>e?.node?.id===a)?.node||r?.variants?.edges?.find(e=>S(e?.node?.id)>0)?.node||r?.variants?.edges?.[0]?.node;B(e)}},[r,h,a,v,s,S]);const N=i(e=>{const t=r?.variants?.edges?.find(t=>t.node.id===e)?.node;t&&s(e)},[r,s]),F=parseFloat($?.price??"0"),P=((e,t,n,o,r,i)=>{if(0===o||!n)return e;if(o!==r)return e;switch(t){case"percentOff":case"percentageOff":case"percentage":case"Percentage":return e*(1-n/100);case"amountOff":case"amount":case"Amount Off":{if(i<=0)return e;const t=e/i*n;return Math.max(0,e-t)}case"fixedPrice":case"fixed":case"fixedPrice":return n*(e/i);default:return e}})(F,E,C??0,w?.size,k,T),D=P,A=D<F&&d?.fixedBundle?.compareAtPriceVisibility,_=D.toFixed(2),R="undefined"!=typeof window&&"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,O=$?.image?.url||r.featuredMedia?.preview?.image?.url;return e.createElement(e.Fragment,null,m?e.createElement("div",{className:""+(r.id===h?"yt-fixedBundle-product-card--horizontal-primary":"yt-fixedBundle-product-card--horizontal-associated"),style:{display:"flex",alignItems:"center",gap:"10px",backgroundColor:d.fixedBundle?.cardBackgroundColor}},c&&e.createElement(op,{className:"yt-fixedBundle-product-card_checkbox-wrapper--horizontal"},e.createElement(tp,{className:"yt-fixedBundle-product-card_checkbox-hidden",style:{display:"none"},type:"checkbox",id:`checkbox-${r.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:z}),e.createElement(np,{className:"yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${r.id}-${g}`,isChecked:l,borderRadius:d.fixedBundle?.borderRadius,borderColor:d.fixedBundle?.borderColor,backgroundColor:d.general?.ctaBackgroundColor},e.createElement(W,null))),e.createElement(xs,{className:"yt-fixedBundle-product-card-horizontal_item",style:{borderRadius:d.fixedBundle?.borderRadius,border:`1px solid ${d.fixedBundle?.borderColor}80`,backgroundColor:d.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`8px 8px 8px -6px ${d.fixedBundle.borderColor}`,"no-spread":`4px 4px 0px -1px ${d.fixedBundle.borderColor}80`}[d.fixedBundle.shadowType]||"none"},canCustomize:c},"undefined"!=typeof window&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&e.createElement(fs,{className:"yt-fixedBundle-product-card-horizontal_image",src:Ap(O),alt:r.title,style:{borderRadius:d.fixedBundle?.borderRadius,borderColor:d.fixedBundle?.borderColor,aspectRatio:d.general.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),e.createElement(ys,{className:"yt-fixedBundle-product-card-horizontal_details"},e.createElement(bs,{className:"yt-fixedBundle-product-card-horizontal_title"},r.title),d.fixedBundle.productsPriceVisibility&&e.createElement(hs,{className:"yt-fixedBundle-product-card-horizontal_price-section"},e.createElement(vs,{className:"yt-fixedBundle-product-card-horizontal_price--new"},Dp(d.general.currencySymbol,b)," ",Pp(_)),A&&parseFloat($.price)>parseFloat(_)&&e.createElement(ws,{className:"yt-fixedBundle-product-card-horizontal_price--old"},Dp(d.general.currencySymbol,b),Pp($.price))),e.createElement(Cp,{product:r,variantOptions:x,selectedVariants:I,onVariantChange:N,variantId:v,primaryProductId:h})))):e.createElement(e.Fragment,null,e.createElement(zs,{className:""+(r.id===h?"yt-fixedBundle-product-card--vertical-primary":"yt-fixedBundle-product-card--vertical-associated"),productsLength:f,style:{borderRadius:d.fixedBundle?.borderRadius,border:`1px solid ${d.fixedBundle?.borderColor}50`,backgroundColor:d.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`0 4px 10px -6px ${d.fixedBundle.borderColor}50`,"no-spread":`4px 4px 0px -1px ${d.fixedBundle.borderColor}50`}[d.fixedBundle.shadowType]||"none",...c&&{position:"relative"},...R&&{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",minWidth:"max-content",paddingLeft:"2px"}},borderRadius:d.fixedBundle?.borderRadius,borderColor:d.fixedBundle?.borderColor,backgroundColor:d.fixedBundle?.cardBackgroundColor},c&&e.createElement(rp,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:R},e.createElement(tp,{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${r.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:z}),e.createElement(np,{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${r.id}-${g}`,isChecked:l,borderRadius:d.fixedBundle?.borderRadius,borderColor:d.fixedBundle?.borderColor,backgroundColor:d.general?.ctaBackgroundColor},e.createElement(W,{size:10}))),"undefined"!=typeof window&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&e.createElement(Ns,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:d.general.imageAspectRatio,height:"fit-content"}},e.createElement(Fs,{className:"yt-fixedBundle-product-card_image--vertical",src:Ap(O),style:{aspectRatio:d.general.imageAspectRatio},alt:r.title}),r.variants.edges.length>1&&e.createElement(Ps,{className:"yt-fixedBundle-product-card_badge-container"},e.createElement(Ds,{className:"yt-fixedBundle-product-card_circle-button"},e.createElement("span",null)),e.createElement(As,{className:"yt-fixedBundle-product-card_circle-button-two"},e.createElement("span",null)),e.createElement(_s,{className:"yt-fixedBundle-product-card_count-badge"},r.variants.edges.length,"+"))),e.createElement(Rs,{className:"yt-fixedBundle-product-card-vertical_info"},e.createElement(Os,{className:"yt-fixedBundle-product-card-vertical_title"},r.title),d.fixedBundle.productsPriceVisibility&&e.createElement(Ms,{className:"yt-fixedBundle-product-card-vertical_price-line"},e.createElement(Ls,{className:"yt-fixedBundle-product-card-vertical_price--new"},Dp(d.general.currencySymbol,b),Pp(_)),d.fixedBundle.compareAtPriceVisibility&&A&&parseFloat($.price)>parseFloat(_)&&e.createElement(ws,{className:"yt-fixedBundle-product-card-vertical_price--old"},Dp(d.general.currencySymbol,b),Pp($.price))))),(f<=3||!u)&&g<f-1&&e.createElement(js,{className:"yt-fixedBundle-plus-wrapper"}," ",e.createElement(Vs,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},kp=({bundle:r,addToCartFunction:a,dispatchAnalyticsEvent:l})=>{const[c,d]=t(!1),[s,p]=t(window.innerWidth<786),[u,m]=t(null),[g,x]=t(!1),f="undefined"!=typeof window?window.location.href:null,y=r?.products?.find(e=>e.productDetails?.handle===f?.split("/").pop()?.split("?")[0]),b=y?.productId,h=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e?.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?1/0:0:1/0:0},[]),[v,w]=t(Object.fromEntries(r?.products?.map((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find(t=>h(e.productDetails,t?.node?.id)>0)?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id]))),C="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"beautywiseshop.myshopify.com"===window.ytBundleApp?.storeDomain),E=r?.showIndividualProductSelector??!0,[k,T]=t(new Set(r.products.reduce((e,t,n)=>(C&&t?.productId!==b&&!E||e.push(n),e),[])));n(()=>{l?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:r._id,bundleType:"fixed-bundle"}});const e=()=>{const e=new URL(window.location.href).searchParams.get("variant");m(e)},t=e=>{const t=history[e];return function(...n){const o=t.apply(this,n);return window.dispatchEvent(new Event(e.toLowerCase())),o}};return history.pushState=t("pushState"),history.replaceState=t("replaceState"),window.addEventListener("pushstate",e),window.addEventListener("replacestate",e),e(),()=>{window.removeEventListener("pushstate",e),window.removeEventListener("replacestate",e)}},[]),n(()=>{u&&b&&w(e=>{const t={...e};return r?.products?.forEach((e,n)=>{e.productId===b&&(t[n.toString()]=u)}),t})},[u,b,r?.products]),n(()=>{const e=()=>{p(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const S=i((e,t)=>{w(n=>({...n,[e.toString()]:t}))},[]),$=(e,t)=>{const n=r.products[t].productId;C&&n===b||T(n=>{const o=new Set(n);return e?o.add(t):o.delete(t),o})},B=o(()=>(e,t)=>h(e.productDetails,t)>0,[h]),I=o(()=>r.products.some((e,t)=>k.has(t)&&e.productDetails.variants.edges.length>1),[r.products,k]),{originalPrice:z,dealPrice:N,offerValue:F}=o(()=>{const{price:e,compareAtPrice:t}=r.products.reduce((e,t,n)=>{if(!k.has(n))return e;const o=v[n.toString()];if(!o)return e;const r=t.productDetails.variants.edges?.find(e=>e.node.id===o)?.node;if(!r)return e;const i=parseFloat(r?.price??"0"),a=parseFloat(r?.compareAtPrice||i.toString());return e.price+=i,e.compareAtPrice+=a,e},{price:0,compareAtPrice:0}),n=Math.max(e,t);let o=Math.min(e,t);k.size===r.products.length&&(r?.percentageOff?o=e*(1-r.percentageOff/100):r?.dealAmount?o=r.dealAmount:r?.amountOff&&(o=e-r.amountOff));const i=t-o;return{originalPrice:n.toFixed(2),dealPrice:o.toFixed(2),offerValue:i.toFixed(2)}},[r.products,v,k,r.percentageOff,r.dealAmount,r.amountOff]),P=o(()=>r.products.map((e,t)=>({product:e,index:t})).filter(({index:e})=>k.has(e)),[r.products,k]),D=P.every(({product:e,index:t})=>B(e,v[t.toString()])),A=o(()=>{let e=0;return r.products.forEach((t,n)=>{if(k.has(n)){const o=v[n.toString()],r=t.productDetails.variants.edges.find(e=>e.node.id===o)?.node.price??"0";e+=parseFloat(r)}}),e},[r.products,k,v]),_=async e=>{if(D){e.preventDefault(),e.stopPropagation(),d(!0),x(!1),l?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:r._id,bundleType:"fixed-bundle",selectedProducts:P?.map(e=>({id:e?.product?.productId,title:e?.product?.productDetails?.title}))}});try{const e=Object.entries(v).map(([e,t])=>{const n=parseInt(e);return isNaN(n)||!k.has(n)?null:t}).filter(Boolean);a&&await a(Number(z),e)}catch(e){console.error("Error adding to cart:",e)}d(!1)}};if(!a)return e.createElement(e.Fragment,null);const R=r.customizations,O=R.fixedBundle?.cardLayoutStyle||"auto",L="horizontal"===O||"auto"===O&&s,M="bundles"==r.appName?r.pageHeader?.title:r?.title,j="bundles"==r.appName?r.pageHeader?.description:r?.subtitle;return e.createElement(ps,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:R.fixedBundle.sectionBackgroundColor,..."transparent"!==R.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},M&&e.createElement(us,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:R.fixedBundle?.titleBackgroundColor||"none",color:R.fixedBundle?.titleTextColor||"black",textAlign:R.fixedBundle.infoAlignment??"center",fontSize:R.fixedBundle?.titleFontSize,..."transparent"!==R.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===R.fixedBundle.infoAlignment&&"transparent"!==R.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===R.fixedBundle.infoAlignment&&"transparent"!==R.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===R.fixedBundle.infoAlignment&&"transparent"===R.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},M),j&&e.createElement(ms,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:R.fixedBundle?.subtitleFontSize,textAlign:R.fixedBundle.infoAlignment??"center",..."left"===R.fixedBundle.infoAlignment&&"transparent"!==R.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===R.fixedBundle.infoAlignment&&"transparent"!==R.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===R.fixedBundle.infoAlignment&&"transparent"===R.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},j),L?e.createElement(gs,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},r?.products?.map((t,n)=>e.createElement(e.Fragment,{key:`${t.productId}-${n}`},e.createElement(Ep,{isChecked:k.has(n),product:t.productDetails,selectedVariantId:v[n.toString()]||"",canCustomize:r?.canCustomizeFixedBundle||!1,styles:R,onVariantChange:e=>S(n,e),onCheckChange:e=>{$(e,n)},isMobile:s,index:n,isHorizontal:L,variantOptions:r.variantOptions,productsLength:r.products.length,storeCurrencyCode:r.storeCurrencyCode,primaryProductId:b,variantId:u||void 0,bundleDiscountType:r.discountType??"none",checkedProducts:k,bundleProductsCount:r.products.length,bundleDiscountValue:r.percentageOff||r.amountOff||r.dealAmount,totalSelectedOriginal:A})))):e.createElement(Bs,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},e.createElement(Is,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===R.fixedBundle.infoAlignment?"flex-start":"right"===R.fixedBundle.infoAlignment?"flex-end":"center"}},r?.products?.map((t,n)=>e.createElement(Ep,{key:`${t.productId}-${n}`,isChecked:k.has(n),product:t.productDetails,selectedVariantId:v[n.toString()]||"",canCustomize:r?.canCustomizeFixedBundle||!1,styles:R,onVariantChange:e=>{S(n,e)},onCheckChange:e=>$(e,n),isMobile:s,index:n,isHorizontal:L,productsLength:r.products.length,storeCurrencyCode:r.storeCurrencyCode,primaryProductId:b,variantId:u||void 0,bundleDiscountType:r.discountType??"none",checkedProducts:k,bundleProductsCount:r.products.length,bundleDiscountValue:r.percentageOff||r.amountOff||r.dealAmount,totalSelectedOriginal:A})),I&&e.createElement(vp,{productsWithIndices:P,isOpen:g,onClose:()=>x(!1),variantOptions:r.variantOptions,cta:{textColor:R.general.ctaTextColor,backgroundColor:R.general.ctaBackgroundColor},onVariantChange:S,handleAddToCart:_,primaryProductId:b,variantId:u||void 0}))),e.createElement(Cs,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===R.fixedBundle.infoAlignment?"flex-start":"right"===R.fixedBundle.infoAlignment?"flex-end":"center"}},Number(z)>0&&Number(F)>0&&R.fixedBundle.compareAtPriceVisibility&&e.createElement(Es,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",e.createElement(Ts,{className:"yt-fixedBundle-summary_price"},Dp(R.general.currencySymbol,r?.storeCurrencyCode),Pp(z))),0!==k.size&&e.createElement(ks,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",e.createElement(Ts,{className:"yt-fixedBundle-summary_price"},Dp(R.general.currencySymbol,r?.storeCurrencyCode),Pp(N))," ",Number(F)>0&&e.createElement(Ss,{className:"yt-fixedBundle-summary_save-tag"},"Save:"," ",Dp(R.general.currencySymbol,r?.storeCurrencyCode),Pp(F)))),e.createElement($s,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),L||!I?_(e):x(!0)},disabled:k.size<1||c||!D,style:{backgroundColor:R.general?.ctaBackgroundColor||"#121212",color:R.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${R.general?.ctaBackgroundColor||"#121212"}`,boxShadow:R.general.ctaShadowType,paddingTop:R.general?.ctaPadding,paddingBottom:R.general?.ctaPadding,borderRadius:R.general.ctaBorderRadius,width:R.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{R.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=R.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=R.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{R.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=R.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=R.general?.ctaTextColor||"#FFFFFF")}},c?e.createElement(Je,{color:"white",loading:c,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):D?e.createElement(e.Fragment,null,R.fixedBundle?.ctaTitle??"Add Bundle to cart"):e.createElement(e.Fragment,null,"Out of Stock")))},Tp=()=>e.createElement(e.Fragment,null,e.createElement("style",null,"@keyframes spin { to { transform: rotate(360deg); } }"),e.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"}})),Sp=({product:o,tierIdx:r,isOpen:i,onClose:a,onAddToBundle:l,canAdd:c,isSelected:d,customizations:s,isMobile:p})=>{const[u,m]=t(0),[g,x]=t(o.variants[0]?.id.toString()||""),[f,y]=t(!0),b=o.variants.find(e=>e.id.toString()===g)||o.variants[0],h=o.images.filter(Boolean),v=()=>{h.length<=1||(m(e=>0===e?h.length-1:e-1),y(!0))},w=()=>{h.length<=1||(m(e=>e===h.length-1?0:e+1),y(!0))};if(n(()=>(i&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=""}),[i]),n(()=>{if(b&&b?.featured_image?.src){const e=document.querySelector(".yt-collection-bundle-modal-image"),t=Ap(b?.featured_image?.src);e?.setAttribute("src",t)}},[b]),!i)return null;const C=h.length>1,E=e.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:a},e.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",borderRadius:s?.borderRadius||"12px",maxWidth:1e3,width:"100%",height:"72dvh",margin:"auto",display:"flex",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:a,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"}},e.createElement(V,{size:22})),e.createElement("div",{className:"yt-collection-bundle-modal-image-container",style:{flex:1,position:"relative",margin:"20px 0 20px 20px",borderRadius:s?.borderRadius||"12px",background:"#f5f5f5"}},h.length>0&&e.createElement(e.Fragment,null,f&&e.createElement("style",null,"\n @keyframes shimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n }\n "),f&&e.createElement("div",{style:{position:"absolute",inset:0,background:"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s infinite",borderRadius:s?.borderRadius||"12px"}}),e.createElement("img",{className:"yt-collection-bundle-modal-image",src:Ap(h[u]||o.images[0]),alt:o.title,onLoad:()=>y(!1),style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:s?.borderRadius||"12px",opacity:f?0:1,transition:"opacity 0.3s"}}),C&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:v,disabled:0===u,style:{position:"absolute",left:16,top:"50%",transform:"translateY(-50%)",background:0===u?"rgba(0,0,0,0.2)":"rgba(0,0,0,0.4)",border:"none",borderRadius:"50%",width:44,height:44,display:"flex",alignItems:"center",justifyContent:"center",cursor:0===u?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:0===u?.5:1}},e.createElement(H,{size:24})),e.createElement("button",{onClick:w,disabled:u===h.length-1,style:{position:"absolute",right:16,top:"50%",transform:"translateY(-50%)",background:u===h.length-1?"rgba(0,0,0,0.2)":"rgba(0,0,0,0.4)",border:"none",borderRadius:"50%",width:44,height:44,display:"flex",alignItems:"center",justifyContent:"center",cursor:u===h.length-1?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:u===h.length-1?.5:1}},e.createElement(q,{size:24}))))),e.createElement("div",{className:"yt-collection-bundle-modal-content",style:{flex:1,padding:"30px",overflowY:"auto",display:"flex",flexDirection:"column",scrollbarWidth:"none"}},e.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"6px 0",fontSize:24,fontWeight:600,lineHeight:"normal"}},o.title),o.variants.length>1&&e.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative"}},e.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee",lineHeight:"normal"}},o?.options?.join(" & "),":"," ",e.createElement("strong",null,b.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:g,onChange:e=>{x(e.target.value),y(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer",lineHeight:"normal"}},o.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0",lineHeight:"normal"}},"₹",(b.price/100).toLocaleString(),b.compare_at_price&&b.compare_at_price>b.price&&e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999",lineHeight:"normal"}},"₹",(b.compare_at_price/100).toLocaleString())),e.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"white"}},e.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(d||!c?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>l(o,r),disabled:!c||!b.available,style:{width:"100%",padding:"12px",fontSize:17,fontWeight:600,border:"none",borderRadius:s?.borderRadius||"8px",background:b.available?d||!c?"#28a745":s?.atcBg||"#007bff":"rgb(204, 204, 204)",color:s?.atcText||"#fff",cursor:c&&b.available?"pointer":"not-allowed",textAlign:"center",lineHeight:"normal"}},d?"Added to Box":b.available?"Add to Box":"Out of Stock")),o.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:o.description},style:{lineHeight:"normal",color:"#444",marginTop:"10px"}})))),k=e.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:a},e.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",width:"100%",height:"100dvh",display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:a,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement(V,{size:22})),e.createElement("div",{className:"yt-collection-bundle-modal-scroll-container",style:{flex:1,overflowY:"auto",paddingBottom:100}},h.length>0&&e.createElement("div",{className:"yt-collection-bundle-modal-image-wrapper",style:{position:"relative",background:"#f5f5f5"}},f&&e.createElement("div",{style:{position:"absolute",inset:0,background:"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s infinite"}}),e.createElement("img",{className:"yt-collection-bundle-modal-image",src:h[u]||o.images[0],alt:o.title,onLoad:()=>y(!1),style:{width:"100%",minWidth:"100%",display:"block",maxHeight:"50vh",minHeight:"50vh",objectFit:"cover",objectPosition:"center",opacity:f?0:1,transition:"opacity 0.3s"}}),C&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:v,disabled:0===u,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",background:0===u?"rgba(0,0,0,0.3)":"rgba(0,0,0,0.5)",border:"none",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",zIndex:5,opacity:0===u?.5:1,cursor:0===u?"not-allowed":"pointer"}},e.createElement(H,{size:20})),e.createElement("button",{onClick:w,disabled:u===h.length-1,style:{position:"absolute",right:12,top:"50%",transform:"translateY(-50%)",background:u===h.length-1?"rgba(0,0,0,0.3)":"rgba(0,0,0,0.5)",border:"none",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",zIndex:5,opacity:u===h.length-1?.5:1,cursor:u===h.length-1?"not-allowed":"pointer"}},e.createElement(q,{size:20})))),e.createElement("div",{className:"yt-collection-bundle-modal-content",style:{padding:"20px"}},e.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"0 0 12px",fontSize:22,fontWeight:600}},o.title),o.variants.length>1&&e.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative",marginBottom:20}},e.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee"}},o?.options?.join(" & "),":"," ",e.createElement("strong",null,b.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:g,onChange:e=>{x(e.target.value),y(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}},o.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0"}},"₹",(b.price/100).toLocaleString(),b.compare_at_price&&b.compare_at_price>b.price&&e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999"}},"₹",(b.compare_at_price/100).toLocaleString())),o.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:o.description},style:{lineHeight:1.7,color:"#444"}}))),e.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"#fff",padding:"8px 10px",borderTop:"1px solid #eee",boxShadow:"0 -4px 10px rgba(0,0,0,0.05)"}},e.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(d||!c?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>l(o,r),disabled:!c||!b.available,style:{width:"100%",padding:"10px",fontSize:14,fontWeight:600,border:"none",borderRadius:s?.borderRadius||"8px",background:!d&&c&&b.available?s?.atcBg||"#007bff":"#28a745",color:s?.atcText||"#fff",cursor:c&&b.available?"pointer":"not-allowed"}},d?"Added to Box":b.available?"Add to Box":"Out of Stock"))));return ot.createPortal(p?k:E,document.body)},$p=({title:t,uploadState:n,onUpload:o,onRemove:r,onRetry:i})=>{const a="object"==typeof n&&n?.loading,l="object"==typeof n&&n?.error,c="object"==typeof n&&n?.url;return e.createElement("div",{className:"yt-collection-bundle-upload-field",style:{padding:"20px",border:"2px dashed #ccc",borderRadius:"8px",textAlign:"center",background:"#fafafa"}},e.createElement("div",{className:"yt-collection-bundle-upload-title",style:{fontWeight:500,color:"#333",marginBottom:"4px"}},t),a&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-collection-bundle-upload-loading",style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",color:"#007bff",fontSize:"13px",margin:"12px 0"}},e.createElement(Tp,null)," Uploading ",n?.name,"...")),l&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-collection-bundle-upload-error",style:{color:"#dc3545",fontSize:"13px",margin:"8px 0"}},"Upload failed. Try again."),e.createElement("button",{type:"button",className:"yt-collection-bundle-upload-retry-btn",onClick:i,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Retry Upload")),c&&!a&&!l&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-collection-bundle-upload-image-container",style:{margin:"12px 0"}},e.createElement("img",{className:"yt-collection-bundle-upload-image",src:n.url,alt:"Uploaded",style:{maxWidth:"100%",maxHeight:"150px",borderRadius:"6px"}})),e.createElement("div",{className:"yt-collection-bundle-upload-filename",style:{fontSize:"12px",color:"#28a745",marginBottom:"8px"}},n.name),e.createElement("button",{type:"button",className:"yt-collection-bundle-upload-remove-btn",onClick:r,style:{background:"#dc3545",color:"white",border:"none",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",cursor:"pointer"}},"Remove")),!n&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-collection-bundle-upload-hint",style:{color:"#888",fontSize:"12px",marginBottom:"12px"}},"jpeg/png (max 5MB)"),e.createElement("button",{type:"button",className:"yt-collection-bundle-upload-btn",onClick:o,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Upload")))},Bp=({config:o,bundleAddToCartLoading:a,addCustomBundleToCart:l})=>{const[c,d]=t(1),[s,p]=t([]),[u,m]=t(null),[g,x]=t({}),[f,y]=t(window.innerWidth<640),[b,h]=t({}),v=r(new Map),[w,C]=t(!1),E=r(null),k=r(new Map),[T,S]=t(160),$=f?8:20,{customizations:B}=o,I=o.config.builderTiers.collectionTier.sort((e,t)=>e.tier-t.tier),z=!!o.config.form,N=I.length+(z?1:0),F=B.hideSelectedProducts,P=B.allowMultipleQty,D=B.hideOutOfStockProducts,A=e=>I[e-1]?.products||[],_=i(e=>{const t=A(e),n=D?t.filter(e=>e.available).length:t.length;h(t=>{const o=t[e]||0,r=Math.min(o+8,n);return r<=o?t:{...t,[e]:r}})},[8,D]);n(()=>(E.current=new IntersectionObserver(e=>{for(const t of e)if(t.isIntersecting){const e=parseInt(t.target.getAttribute("data-sentinel-step")||"0");e>0&&e===c&&_(e)}},{root:null,threshold:0,rootMargin:"100px 0px"}),()=>{E.current?.disconnect()}),[_,c]),n(()=>{if(z&&c===N)return;const e=c,t=A(e);if(0===t.length)return;const n=D?t.filter(e=>e.available).length:t.length;if(0===(b[e]||0)){const t=Math.min($,n);h(n=>({...n,[e]:t}))}},[c,$,D,b]),n(()=>{const e=document.querySelector(".box-loader-scene");e&&e.setAttribute("style","display: none;");const t=()=>y(window.innerWidth<640);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const R=i(e=>{S(e+10)},[]),O=s.reduce((e,t)=>e+t.quantity,0),L=s.reduce((e,t)=>e+t.price*t.quantity,0)/100,M=s.reduce((e,t)=>{const n=I.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId),o=n?.variants.find(e=>e.id.toString()===t.variantId);return e+(o?.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 o=document.querySelector(`[data-product-id="${e.id}"]`);o&&(o.dataset.selectedVariant=t,o.dataset.currentPrice=n.price.toString())},V=(e,t)=>{const n=document.querySelector(`[data-product-id="${e.id}"]`);if(!n)return;const o=n.dataset.selectedVariant||e.variants[0].id.toString(),r=parseInt(n.dataset.currentPrice||e.variants[0].price.toString());p(n=>{const i=`${e.id}-${o}-${t}`,a=n.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===i);if(a)return n.filter(e=>e!==a);const l=q[t],c=W(t);return c!==1/0&&l>=c?n:[...n,{productId:e.id.toString(),variantId:o,price:r,quantity:1,tierIndex:t}]})},W=e=>{const t=I[e];return t.maximumQuantity>0?t.maximumQuantity:1/0},H=(e,t)=>{const n=W(t);if(n===1/0)return!0;const o=q[t];return!!s.some(n=>n.productId===e.id.toString()&&n.tierIndex===t)||o<n},q=I.map((e,t)=>s.filter(e=>e.tierIndex===t).reduce((e,t)=>e+t.quantity,0)),Q=(e,t,n)=>{const o=W(n);if(o===1/0)return!0;return q[n]<o},U=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");x(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",o=await fetch(`${n}/shopify/upload?shop=${e}`,{method:"POST",headers:{"x-yourtoken-app-name":"bundles"},body:t});if(!o.ok)throw new Error("Upload failed");return(await o.json()).url}catch(e){throw C(!1),alert("Upload failed. Try again."),e}finally{C(!1)}})(n);x(o=>({...o,[e]:{url:t,name:n.name}}))}catch{x(t=>({...t,[e]:{error:!0,name:n.name}}))}}},document.body.appendChild(t),v.current.set(e,t)}return v.current.get(e)},Y=z&&c===N,G=(Y?null:I[c-1])?W(c-1):0,X=I.map((e,t)=>({tier:e,items:s.filter(e=>e.tierIndex===t).reduce((e,t)=>{const n=`${t.productId}-${t.variantId}`,o=e.find(e=>`${e.productId}-${e.variantId}`===n);return o?o.quantity+=t.quantity:e.push({...t,quantity:t.quantity}),e},[]),count:q[t]}));return e.createElement("div",{className:"yt-collection-bundle-builder",style:{margin:"0 auto",maxWidth:"1600px"}},B.headerImage&&!B.headerImage.includes("Liquid error")&&e.createElement("img",{className:"yt-collection-bundle-header-img",src:B.headerImage,alt:"Collection Bundle header",style:{width:"100%"}}),B.showTierSteps&&e.createElement("div",{style:{paddingTop:B.headerImage&&!B.headerImage.includes("Liquid error")?"20px":"0"}},e.createElement(Ip,{totalSteps:N,isFormStep:Y,currentStep:c,getStepTitle:e=>z&&e===N?"Customize Gift Details":I[e-1]?.title||`Step ${e}`,isMobile:f,formTitle:o?.config?.form?.title,hasForm:z,onStepClick:e=>{if(e>1&&!s.length)return alert("Add at least one product first");d(e),window.scrollTo(0,0)}})),Array.from({length:N},(e,t)=>t+1).map(t=>{const n=z&&t===N,r=n?[]:A(t),i=D?r.filter(e=>e.available):r,a=t-1,l=i.slice(0,b[t]||0);return e.createElement("div",{key:t,className:"yt-collection-bundle-step-content "+(c===t?"yt-collection-bundle-step-content-active":""),style:{display:c===t?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},n&&o.config.form?e.createElement("div",{className:"yt-collection-bundle-customize-form",style:{maxWidth:"80%",margin:"0 auto",padding:"1rem",marginBottom:`${T}px`}},o?.config?.form?.sections?.map((t,n)=>e.createElement("div",{key:`sec_${n}`,className:"yt-collection-bundle-form-group",style:{marginBottom:"32px"}},e.createElement("label",{className:"yt-collection-bundle-label",style:{display:"block",fontWeight:600,marginBottom:"12px",color:"#333",fontSize:"16px",lineHeight:"normal"}},t?.title),"text"===t.type&&e.createElement("div",{className:"yt-collection-bundle-form-fields",style:{display:"flex",flexDirection:"column",gap:"12px"}},t.fields.map((t,n)=>{const o=t?.title??"Field "+n;return e.createElement("textarea",{key:o,className:"yt-collection-bundle-textarea",placeholder:t?.title,rows:3,maxLength:500,onChange:e=>x(t=>({...t,[o]:e.target.value})),style:{padding:"12px",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px",resize:"vertical",lineHeight:"normal"}})})),"image"===t.type&&e.createElement("div",{className:"yt-collection-bundle-image-section",style:{marginBottom:"24px"}},e.createElement("sub",{className:"yt-collection-bundle-upload-hint",style:{display:"block",color:"#666",fontSize:"12px",marginBottom:"8px",lineHeight:"normal"}},"jpeg/png (max 5MB)"),e.createElement("div",{className:"yt-collection-bundle-form-fields",style:{display:"flex",flexDirection:"column",gap:"16px"}},t.fields.map((t,n)=>{const o=t?.title??"Field "+n,r=g[o];return e.createElement($p,{key:o,title:t?.title,uploadState:r,onUpload:()=>U(o).click(),onRemove:()=>x(e=>{const{[o]:t,...n}=e;return n}),onRetry:()=>U(o).click()})})))))):e.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:f?"grid":"flex",gridTemplateColumns:f?"repeat(2,1fr)":"",flexWrap:f?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:`${T}px`}},l.map(t=>e.createElement(zp,{key:t.id,product:t,tierIdx:a,customizations:B,isMobile:f,hoveredCard:u,setHoveredCard:m,selectedProducts:s,handleAddToBundle:V,canAddProduct:H,allowMultipleQty:P,handleVariantChange:j,canIncrement:Q,setSelectedProducts:p})),c===t&&(b[t]||0)<i.length&&e.createElement("div",{ref:e=>{const n=k.current.get(t);n&&E.current?.unobserve(n),e?(k.current.set(t,e),E.current?.observe(e)):k.current.delete(t)},"data-sentinel-step":t.toString(),style:{height:"20px",width:"100%",display:"block"}})))}),e.createElement(Np,{config:o,selectedProducts:s,selectedByTier:X,totalItems:O,totalPrice:L,totalCompareAtPrice:M,currentStep:c,totalSteps:N,currentTierMax:G,tierSelectedCounts:q,isMobile:f,bundleAddToCartLoading:a,isUploading:w,hoveredCard:u,setHoveredCard:m,hideSelectedProducts:F,getProductStep:e=>{for(let t=0;t<I.length;t++)if(I[t].products.some(t=>t.id.toString()===e))return t+1;return z?N:I.length},setCurrentStep:d,handleRemoveItem:(e,t,n)=>{p(o=>o.filter(o=>!(o.productId===e&&o.variantId===t&&o.tierIndex===n)))},handleCheckout:async()=>{if(c!==N||!s.length)return;const e={};z&&Object.entries(g).forEach(([t,n])=>{const o=t.split("|").pop()?.replace(/^f_\d+$/,"")||t;"string"==typeof n&&n.trim()?e[o]=n:n&&"object"==typeof n&&"url"in n&&(e[o]=n.url)});const t=s.map(t=>({variantId:t.variantId,quantity:t.quantity,properties:e}));l(t)},hasForm:z,onHeightChange:R}))},Ip=({totalSteps:t,isFormStep:o,currentStep:r,getStepTitle:i,isMobile:a,formTitle:l,hasForm:c,onStepClick:d})=>{const s=e.useRef(null);return n(()=>{if(!a||!s.current)return;const e=s.current.querySelector(".yt-collection-bundle-step-item-active");e&&e.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})},[r,a]),e.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"}},e.createElement("div",{ref:s,className:"yt-collection-bundle-steps-nav",style:{display:"flex",justifyContent:a?"flex-start":"center",gap:a?"1rem":"2rem",minWidth:a?100*t+"px":"auto",paddingInline:a?"calc(50% - 60px)":"0",scrollPaddingInline:a?"calc(50% - 60px)":"0",scrollBehavior:"smooth",overflowX:"auto",scrollbarWidth:"none"}},Array.from({length:t},(e,t)=>t+1).map(n=>e.createElement("div",{key:n,className:"yt-collection-bundle-step-item "+(r===n?"yt-collection-bundle-step-item-active":""),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.5rem",minWidth:a?"100px":"120px",flexShrink:0,cursor:"pointer",opacity:r===n?1:.5,transition:"opacity 0.2s"},onClick:()=>d(n)},e.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"}},c&&n===t?e.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},e.createElement("path",{d:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.67C10.96 2.54 10.05 2 9 2c-1.66 0-3 1.34-3 3 0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1h-2c-.55 0-1-.45-1-1s.45-1 1-1h2zm-6 0c.55 0 1 .45 1 1s-.45 1-1 1H7c-.55 0-1-.45-1-1s.45-1 1-1h2zM20 19H4V8h16v11z"})):e.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},e.createElement("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}))),e.createElement("div",{className:"yt-collection-bundle-step-label",style:{fontSize:"14px",textAlign:"center",color:"#333",fontWeight:"600",lineHeight:"normal"}},i(n))))),l&&c&&o&&e.createElement("p",{className:"yt-collection-bundle-steps-nav-description",style:{fontSize:a?"14px":"16px",marginBottom:a?"0":"14px",fontWeight:"400",color:"#000",lineHeight:"normal"}},l))},zp=({product:n,tierIdx:o,customizations:r,isMobile:i,hoveredCard:a,setHoveredCard:l,selectedProducts:c,handleAddToBundle:d,canAddProduct:s,allowMultipleQty:p,handleVariantChange:u,canIncrement:m,setSelectedProducts:g})=>{const[x,f]=t(!1),y=document.querySelector(`[data-product-id="${n.id}"]`),b=y?.dataset.selectedVariant||n.variants[0].id.toString(),h=n.variants.find(e=>e.id.toString()===b)||n.variants[0],v=c.some(e=>e.productId===n.id.toString()&&e.variantId===b&&e.tierIndex===o),w=a===n.id,C=c.filter(e=>e.productId===n.id.toString()&&e.variantId===h.id.toString()&&e.tierIndex===o).reduce((e,t)=>e+t.quantity,0);return e.createElement(e.Fragment,null,e.createElement("div",{key:n.id,className:"yt-collection-bundle-product-item","data-product-id":n.id,"data-selected-variant":h.id,"data-current-price":h.price,style:{display:"flex",flexDirection:"column",border:r?.productCardBorder||"1px solid #ddd",background:r?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:i?0:"250px",maxWidth:i?"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:i?"100%":""}},e.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:()=>f(!0),onMouseEnter:()=>l(n.id),onMouseLeave:()=>l(null)},e.createElement("img",{src:Ap(n.images[0]||"https://cdn.shopify.com/s/files/1/0750/9937/3789/files/placeholder-thumbnail.png?width=250px"),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:w?0:1,transform:w?"scale(1.05)":"scale(1)"},alt:n.title}),e.createElement("img",{src:Ap(n.images[1]||n.images[0]),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:w?1:0,transform:"scale(1.05)"},alt:n.title}),n.variants.length>1&&e.createElement("select",{className:"yt-collection-bundle-variant-selector",style:{position:"absolute",bottom:"10px",left:"10px",right:"10px",background:"rgba(255,255,255,0.9)",border:"none",borderRadius:"4px",padding:"8px",fontSize:"12px",fontWeight:"600",zIndex:2,lineHeight:"normal"},onChange:e=>u(n,e.target.value),defaultValue:h.id,onClick:e=>{e.stopPropagation()}},n.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-product-info",style:{padding:"12px",flexGrow:1,display:"flex",flexDirection:"column"}},e.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:i?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:"normal",color:"#333",flexGrow:1}},n.title),e.createElement("div",{className:"yt-collection-bundle-product-prices",style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"nowrap",whiteSpace:"nowrap",overflow:"hidden",lineHeight:"normal"}},e.createElement("span",{className:"yt-collection-bundle-product-price",style:{fontSize:i?"14px":"16px",fontWeight:"bold",color:"#000",flexShrink:0,lineHeight:"normal"}},"₹",(h.price/100).toLocaleString()),h.compare_at_price&&h.compare_at_price>h.price&&e.createElement("span",{className:"yt-collection-bundle-product-compare",style:{fontSize:"14px",textDecoration:"line-through",color:"#999",flexShrink:0,lineHeight:"normal"}},"₹",(h.compare_at_price/100).toLocaleString()))),p&&C>0?e.createElement("div",{className:"yt-collection-bundle-quantity-row",style:{display:"flex",alignItems:"center",flexWrap:"nowrap",background:"#cccccc"}},e.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-minus",style:{width:"40%",height:h.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:i?"6px":"12px",fontSize:i?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{g(e=>{const t=`${n.id}-${h.id}-${o}`,r=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return r&&r.quantity>1?e.map(e=>e===r?{...e,quantity:e.quantity-1}:e):r?e.filter(e=>e!==r):e})}},"-"),e.createElement("span",{className:"yt-collection-bundle-qty-display",style:{minWidth:"24px",textAlign:"center",fontWeight:600,width:"100%",lineHeight:"normal"}},C),e.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-plus",style:{width:"40%",height:h.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:i?"6px":"12px",fontSize:i?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{h.available&&m(n,h.id.toString(),o)&&g(e=>{const t=`${n.id}-${h.id}-${o}`,r=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return r?e.map(e=>e===r?{...e,quantity:e.quantity+1}:e):[...e,{productId:n.id.toString(),variantId:h.id.toString(),price:h.price,quantity:1,tierIndex:o}]})},disabled:!h.available||!m(n,h.id.toString(),o)},"+")):e.createElement("button",{className:"yt-collection-bundle-add-btn "+(v?"yt-collection-bundle-add-btn-added":""),style:{background:v?"#28a745":s(n,o)&&h.available?r?.atcBg||"#007bff":"#ccc",color:r?.atcText||"#fff",border:"none",padding:i?"6px":"12px",fontSize:i?"12px":"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",opacity:h.available?1:.6,lineHeight:"normal",textAlign:"center"},onClick:()=>{h.available&&s(n,o)&&d(n,o)},disabled:!h.available||!s(n,o)},v?"Added":h.available?"ADD TO BOX":"Out of Stock")),x&&e.createElement(Sp,{product:n,tierIdx:o,isOpen:x,onClose:()=>f(!1),onAddToBundle:(e,t)=>{d(e,t),f(!1)},canAdd:s(n,o),isSelected:v,customizations:r,isMobile:i}))},Np=o=>{const{config:i,selectedProducts:a,selectedByTier:l,totalItems:c,totalPrice:d,totalCompareAtPrice:s,currentStep:p,totalSteps:u,currentTierMax:m,tierSelectedCounts:g,isMobile:x,bundleAddToCartLoading:f,isUploading:y,hoveredCard:b,setHoveredCard:h,getProductStep:v,setCurrentStep:w,handleRemoveItem:C,handleCheckout:E,hasForm:k,onHeightChange:T}=o,{customizations:S}=i,[$,B]=t(!1),I=r(null),z=r(null),{totalOriginal:N,hasSavings:F,formattedSavings:P,totalAfterDiscount:D}=(e=>{let t=0,n=0;e.forEach(({items:e,tier:o})=>{const r=o?.discountData;let i=0;e.forEach(e=>{const t=(e.price||0)/100,n=e.quantity||1;i+=t*n}),t+=i;let a=i;if("mov_percentage"===r?.type&&r.tiers?.length){const e=[...r.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity).filter(e=>i>=e.minimumQuantity);if(e.length>0){const t=e.reduce((e,t)=>t.discountValue>e.discountValue?t:e).discountValue/100;a=i*(1-t)}}n+=a});const o=Math.round(t-n),r=o>0;return{savings:o,totalOriginal:t,totalAfterDiscount:n,hasSavings:r,formattedSavings:r?`₹${o.toLocaleString()}`:"",calculatedDiscountedTotal:Math.round(n)}})(l),A=l.filter(({count:e})=>e>0).map(({tier:e,items:t})=>{const n=t.reduce((e,t)=>{if(!t)return e;return e+(t.price||0)*(t.quantity||1)},0)/100;return((e,t,n)=>{const o=e.discountData;if(!o||!o.tiers?.length)return null;const r=[...o.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity),i=[];if("mov_percentage"===o.type){if("number"!=typeof n)return null;const e=r.filter(e=>n>=e.minimumQuantity).pop();e&&i.push(`${e.discountValue}% OFF`);const t=r.find(e=>n<e.minimumQuantity);if(t){const e=t.minimumQuantity-n;i.push(`Add ₹${e} more to get ${t.discountValue}% OFF`)}return i.length?i.join(" + "):null}const a=r.filter(e=>t>=e.minimumQuantity);if(a.length>0){const e=a.reduce((e,t)=>e.minimumQuantity>t.minimumQuantity?e:t);let t=null;switch(o.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&&i.push(t)}const l=r.find(e=>t<e.minimumQuantity);if(l){const e=l.minimumQuantity-t;let n=null;switch(o.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&&i.push(`Add ${e} more item${1!==e?"s":""} to get ${n}`)}return i.length?i.join(" + "):null})(e,t.length,n)}).filter(Boolean);return n(()=>{const e=m!==1/0&&g[p-1]===m-2&&m>1;let t=null;return e?(B(!0),t=setTimeout(()=>{B(!1)},3e3)):B(!1),()=>{t&&clearTimeout(t)}},[m,g,p]),n(()=>{if(I.current&&T){const e=I.current.offsetHeight;T(e)}},[x,T,a]),n(()=>{const e=Math.max(...l.map(({tier:e,items:t})=>{if("mov_percentage"!==e?.discountData?.type)return 0;const n=t.reduce((e,t)=>e+(t.price||0)*(t.quantity||1),0)/100,o=(e?.discountData?.tiers||[]).filter(e=>n>=e.minimumQuantity).sort((e,t)=>t.discountValue-e.discountValue)[0];return o?.discountValue??0}));if(e<(z.current??0)&&(z.current=e),e>(z.current??0)){z.current=e;const t=document.querySelector(".yt-collection-bundle-next-btn");if(!t)return;const n=t.getBoundingClientRect(),o=(n.left+n.width/2)/window.innerWidth,r=(n.top+n.height/2)/window.innerHeight;ge({particleCount:100,spread:70,origin:{x:o,y:r},zIndex:9999})}},[l]),e.createElement("div",{ref:I,className:"yt-collection-bundle-bar",style:{background:S?.bundleBg||"#fff",color:S?.bundleText||"#333",border:S?.bundleBorder||"1px solid #878787",display:"flex",flexDirection:"column",position:"fixed",bottom:"10px",left:"50%",transform:"translateX(-50%)",width:"compact"==S.stickyBarWidth?"600px":"90%",maxWidth:"95%",zIndex:899,boxShadow:"0 -2px 10px rgba(0,0,0,0.1)",transition:"bottom 0.3s ease",borderRadius:S?.borderRadius||"8px",overflow:"hidden"}},A.length>0&&e.createElement("div",{style:{padding:"4px 8px",background:"#dbdbdbc5",color:"#6c757d",textAlign:"center",fontSize:"12px",fontWeight:500}},A.join(" + ")),e.createElement("div",{className:"yt-collection-bundle-bar-header",style:{position:"relative",textAlign:"center"}},$&&e.createElement(e.Fragment,null,e.createElement("style",null,"\n @keyframes fadeIn {\n from { opacity: 0; transform: translateX(-50%) translateY(10px); }\n to { opacity: 1; transform: translateX(-50%) translateY(0); }\n }\n "),e.createElement("div",{className:"yt-collection-bundle-ctx",style:{position:"absolute",top:"-40px",left:"50%",transform:"translateX(-50%)",background:S?.atcBg||"#007bff",color:S?.atcText||"#fff",padding:"4px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"14px",whiteSpace:"nowrap",zIndex:10,boxShadow:"0 4px 12px rgba(0,0,0,0.2)",animation:"fadeIn 0.3s ease-out",minWidth:"300px",textAlign:"center",border:"1px solid rgba(0,0,0,0.1)",lineHeight:"normal"}},"Add up to"," ",e.createElement("span",{style:{fontWeight:600}},m," item",m>1?"s":"")))),a.length>0&&e.createElement("div",{className:"yt-collection-bundle-bar-top",style:{display:"flex",alignItems:"center",padding:"8px 8px 0",position:"relative",borderRadius:S?.borderRadius||"8px"}},e.createElement("div",{className:"yt-collection-bundle-images",style:{display:"flex",flex:1,gap:"5px",justifyContent:"center",alignItems:"center",overflowX:"auto",padding:"4px 0",scrollbarWidth:"none"}},l.filter(({count:e})=>e>0).map(({items:t},n,o)=>e.createElement(e.Fragment,{key:n},e.createElement("div",{className:"yt-collection-bundle-tier-images",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",minWidth:"fit-content"}},e.createElement("div",{style:{display:"flex",gap:"4px"}},t.map((t,o)=>{const r=i.config.builderTiers.collectionTier.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId);if(!r)return null;const a=v(t.productId),l=p===a;return e.createElement("div",{key:o,className:"yt-collection-bundle-img-wrapper",style:{position:"relative",flexShrink:0,height:"65px"}},e.createElement("div",{style:{position:"relative",width:"67px",height:"67px",borderRadius:`calc(${S?.borderRadius||"8px"} / 2)`,overflow:"hidden",cursor:l?"default":"pointer",transition:"transform 0.2s ease"},onMouseEnter:e=>!l&&(e.currentTarget.style.transform="scale(1.08)"),onMouseLeave:e=>e.currentTarget.style.transform="scale(1)",onClick:()=>!l&&w(a)},e.createElement("img",{src:Ap(r.images[0]),style:{width:"65px",height:"65px",objectFit:"cover",borderRadius:`calc(${S?.borderRadius||"8px"} / 2)`,transition:"opacity 0.2s",pointerEvents:"none",border:"1px solid #ddd"},alt:"Selected"}),t.quantity>1&&e.createElement("div",{className:"yt-collection-bundle-qty-badge",style:{position:"absolute",bottom:"4px",right:"4px",background:"rgba(0,0,0,0.7)",color:"#fff",borderRadius:"10px",padding:"2px 6px",fontSize:"10px",fontWeight:600,lineHeight:"normal"}},"x",t.quantity),e.createElement("button",{className:"yt-collection-bundle-remove-btn",style:{position:"absolute",top:"4px",right:"4px",width:"20px",height:"20px",background:"rgba(220,53,69,0.95)",color:"white",border:"none",borderRadius:"50%",fontSize:"12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.3)",textAlign:"center",lineHeight:"normal"},onClick:e=>{e.stopPropagation(),C(t.productId,t.variantId,n)}},"×")))}))),n<o.length-1&&o[n+1].count>0&&e.createElement("div",{style:{color:"#666",paddingInline:"6px",lineHeight:"normal"}},e.createElement(Q,null)))))),x?e.createElement("div",{className:"yt-collection-bundle-mobile-bar-content",style:{display:"flex",flexDirection:c>0&&(k||i?.config?.builderTiers?.collectionTier?.length>1)?"column":"row",margin:"4px",gap:c>0?"10px":"0",background:"#dbdbdb",borderRadius:S?.borderRadius||"8px",overflow:"hidden"}},e.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:a.length>0?"space-between":"center",alignItems:"center",borderRadius:S?.borderRadius||"8px"}},e.createElement(e.Fragment,null,0===c&&e.createElement("div",{style:{fontSize:"14px",color:"#6c757d",lineHeight:"normal",...0===c&&{padding:"8px 0 12px 0",background:"#dbdbdb",color:"#6c757d",width:"100%",borderRadius:S?.borderRadius||"8px"}}},"Add Items to Checkout"),c>0&&e.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"6px",width:"100%",justifyContent:"center",flexWrap:"wrap"}},e.createElement("div",{style:{fontSize:"14px",color:"#000",fontWeight:600}},"₹",(D??d).toLocaleString()),F?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",N.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",P)):e.createElement(e.Fragment,null,s>d&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",s.toLocaleString())),e.createElement("span",{style:{fontSize:"12px",color:"#000",fontWeight:500}},"(",c," items)")))),e.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"4px"}},(i?.config?.builderTiers?.collectionTier?.length>1||k)&&c>0&&e.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:1===p?"not-allowed":"pointer",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",textAlign:"center",lineHeight:"normal"},onClick:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>h(-1),onMouseLeave:()=>h(null),disabled:1===p},"Back"),c>0&&e.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===c||y?"yt-collection-bundle-next-btn-disabled":""),style:{background:S?.btnPrimaryBg||"#28a745",color:S?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",opacity:p===u&&0===c||y?.6:1,textAlign:"center",lineHeight:"normal"},onClick:p===u?E:()=>w(p+1),disabled:p===u&&0===c||f||y},f?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(Tp,null)):p===u?"Checkout":"Next"))):e.createElement("div",{className:"yt-collection-bundle-bar-bottom",style:{display:"flex",alignItems:"center",padding:"0px",background:"#dbdbdb",margin:"8px",borderRadius:S?.borderRadius||"8px",overflow:"hidden",scrollbarWidth:"none"}},(i?.config?.builderTiers?.collectionTier?.length>1||k)&&c>0&&e.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:1===p?"not-allowed":"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",...-1===b&&{filter:"brightness(60%)"},textAlign:"center",lineHeight:"normal"},onClick:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>h(-1),onMouseLeave:()=>h(null),disabled:1===p},"Back"),e.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:a.length>0?"space-between":"center",paddingInline:"6px",alignItems:"center",...0===c&&{padding:"12px 24px"}}},0===c&&e.createElement("div",{style:{fontSize:"16px",color:"#6c757d",lineHeight:"normal"}},"Add Items to Checkout"),c>0&&e.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",justifyContent:"center"}},e.createElement("div",{style:{fontSize:"16px",color:"#000",fontWeight:600}},"₹",(D??d).toLocaleString()),F?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",N.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",P)):e.createElement(e.Fragment,null,s>d&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",s.toLocaleString())),e.createElement("span",{style:{fontSize:"16px",color:"#000",fontWeight:500}},"(",c," items)"))),c>0&&e.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===c||y?"yt-collection-bundle-next-btn-disabled":""),style:{background:S?.btnPrimaryBg||"#28a745",color:S?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",opacity:p===u&&0===c||y?.6:1,...-2===b&&{filter:"brightness(90%)"},textAlign:"center",lineHeight:"normal"},onClick:p===u?E:()=>w(p+1),disabled:p===u&&0===c||f||y,onMouseEnter:()=>h(-2),onMouseLeave:()=>h(null)},f?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(Tp,null)):p===u?"Checkout":"Next")))},Fp=window?.Shopify?.currency||{rate:1,active:"INR"},Pp=e=>{if(!e)return;const t=navigator.language||"en-US",n=Number((Number(e)*Fp.rate).toFixed(2));return new Intl.NumberFormat(t).format(n)},Dp=(e,t)=>t==Fp.active?e:oe(Fp.active)||Fp.active,Ap=(e,t)=>{if(!e||!e.includes("cdn.shopify")&&!e.includes("/cdn/shop/files/"))return e;try{const n=new URL(e),o=n.searchParams;return o.has("format")||o.set("format","webp"),o.has("quality")||o.set("quality",t?.toString()||"70"),o.has("width")||o.set("width","600"),n.toString()}catch{const n=e.includes("?")?"&":"?";return e+n+`format=webp&quality=70&width=${t?.toString()||"600"}`}},_p=(e,t,n,o,r,i)=>{const a=o.findIndex(t=>t.variantId===e);r(0===n?e=>e.filter((e,t)=>t!==a):-1===a?o=>[...o,{product:t,variantId:e,quantity:n,isFree:i}]:e=>e.map((e,t)=>t===a?{...e,quantity:e.quantity+n,isFree:i}:e))},Rp=({bundle:t,currentProductId:n,addToCartFunction:o,addCustomBundleToCart:r,selectedItems:i,setSelectedItems:a,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:d,renderingOnPage:s,bundleSubtotal:p,dispatchAnalyticsEvent:u,fetchStoreDetails:m})=>"fixed"!==t.type&&t.type&&0!==t?.type?.length?"builder"===t.type?e.createElement(Jc,{bundleAddToCartLoading:l,bundle:t,selectedItems:i,setSelectedItems:a,handleAddToCart:r,handleRemoveItem:c,renderingOnPage:s,selectedItemsQuantity:d??0,bundleSubtotal:p??{price:0,compareAtPrice:0},dispatchAnalyticsEvent:u,fetchStoreDetails:m}):"combo"===t.type?e.createElement(ed,{bundle:t,addToCartFunction:o,dispatchAnalyticsEvent:u}):"mixAndMatch"===t.type?e.createElement(ss,{bundle:t,addToCartFunction:o,dispatchAnalyticsEvent:u}):"collection"===t.type?e.createElement(Bp,{config:t,addCustomBundleToCart:r,bundleAddToCartLoading:l}):e.createElement(Nd,{bundle:t,currentProductId:n,addToCartFunction:o,dispatchAnalyticsEvent:u}):e.createElement(kp,{addToCartFunction:o,bundle:t,dispatchAnalyticsEvent:u});st(".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 Op=()=>e.createElement("div",{className:"scene"},e.createElement("div",{className:"floating"},e.createElement("div",{className:"cube"},e.createElement("div",{className:"side front"},""),e.createElement("div",{className:"side back"},""),e.createElement("div",{className:"side left"},""),e.createElement("div",{className:"side right"},""),e.createElement("div",{className:"side bottom"},""),e.createElement("div",{className:"lid"},e.createElement("div",{className:"flap north"},""),e.createElement("div",{className:"flap south"},""),e.createElement("div",{className:"flap east"},""),e.createElement("div",{className:"flap west"},""))))),Lp=({config:t,brandConfig:n})=>{const{heroDesktopImage:o,heroMobileImage:r,heroTitle:i="ZERO WASTE PREMIUM PET CARE",heroSubtitle:a="Earn Doglycoins for exclusive rewards every time you shop.",heroTextAlignment:l="left",heroSubtitleFontSize:c="18px",heroSubtitleColor:d="#000000",heroSubtitleFontWeight:s="400",heroTitleFontSize:p="48px",heroTitleColor:u="#000000",heroRegistrationCTAVisibility:m=!0,primaryColor:g="#1C1C1D",primaryContrastColor:x="#FFFFFF",secondaryColor:f="#FFFFFF",secondaryContrastColor:y="#000000",accentColor:b="#FFFFFF",borderColor:I="#E5E5E5",themeRoundness:z="0px",heroBannerVisibility:N="show",stepsVisibility:F="show",waysToEarnVisibility:P="show",waysToEarnCustomText:D="Individual rewards of 750 points or more ship FREE. No merchandise purchase required.",customSectionVisibility:A="show",footerSignupVisibility:_="show",customSectionImagePosition:R="left",customSectionTitle:O="Earn Doglycoins every time you shop",customSectionSubtitle:L="Collect more Doglycoins by entering your birthday, following us on social or referring a friend (details below)\n\nRedeem your Doglycoins for cash off at checkout by signing in or creating an account. Did you shop without registering? No worries, your Credits have been saved for you",customSectionTitleFontSize:M="36px",customSectionSubtitleFontSize:j="18px",customSectionImage:V,customSectionTextAlignment:W="left",customSectionTitleColor:H="#000000",customSectionSubtitleColor:q="#000000",stepsTitle:Q="Getting started is easy",stepsSubtitle:U="Earn Stars and get rewarded in a few easy steps.",step1Title:Y="CREATE AN ACCOUNT",step1Description:G="To get started, Join Now. You can also register on the mobile app to get access to the full range of reward benefits",step2Title:X="ORDER AND EARN REWARDS POINTS",step2Description:Z="Use cash, credit/debit card or save some time and pay right through the app. You'll collect Stars all ways.",step3Title:J="UNLOCK REWARDS AND OFFERS",step3Description:K="As you earn Stars, you can redeem them for Rewards—like free food, drinks, and more. Start redeeming with as little as 25 Stars!",footerCustomText:ee="Individual rewards of 750 points or more ship FREE. No merchandise purchase required.",footerSignupSubtext:te="Use your points to redeem samples and more."}=t||{},ne="undefined"!=typeof window&&window.innerWidth<=768,oe=e=>e&&e.startsWith("//")?`https:${e}`:e,re={padding:"12px 32px",borderRadius:"30px",fontSize:"14px",fontWeight:600,cursor:"pointer",textTransform:"uppercase",border:`1px solid ${g}`,transition:"all 0.3s ease"},ie={...re,backgroundColor:g,color:x,borderColor:g},ae={...re,backgroundColor:f,color:y,borderColor:I},{newSignupTokens:le,firstOrderTokens:ce,instagramFollowPoints:de,twitterFollowPoints:se,facebookFollowPoints:pe,youtubeSubscriptionPoints:ue,rewardToLeaveReview:me,birthdayPoints:ge,referralPointsForReferrer:xe,tokenCreditPercentage:fe,brandTokenName:ye}=n||{},be=[...le?[{icon:e.createElement(h,null),title:`${le} ${ye}`,subtitle:"Create an account"}]:[],...ce?[{icon:e.createElement(v,null),title:`${ce} ${ye}`,subtitle:"Place your first order"}]:[],...fe?[{icon:e.createElement(v,null),title:`${fe}% ${ye}`,subtitle:`Earn ${fe}% back on every order`}]:[],...xe?[{icon:e.createElement(w,null),title:`${xe} ${ye}`,subtitle:"Refer a friend and get"}]:[],...ge?[{icon:e.createElement(C,null),title:`${ge} ${ye}`,subtitle:"Get on your birthday to spend"}]:[],...me?[{icon:e.createElement(E,null),title:`${me} ${ye}`,subtitle:"Write a Review"}]:[],...pe?[{icon:e.createElement(k,null),title:`${pe} ${ye}`,subtitle:"Like on Facebook"}]:[],...de?[{icon:e.createElement(T,null),title:`${de} ${ye}`,subtitle:"Follow on Instagram"}]:[],...se?[{icon:e.createElement(S,null),title:`${se} ${ye}`,subtitle:"Follow on Twitter"}]:[],...ue?[{icon:e.createElement($,null),title:`${ue} ${ye}`,subtitle:"Subscribe on YouTube"}]:[]];return e.createElement("div",{className:"yt-loyalty-page-container",style:{fontFamily:"'Poppins', sans-serif",width:"100%",overflow:"hidden"}},"show"===N&&e.createElement("div",{className:"yt-loyalty-page-hero",style:{position:"relative",minHeight:"500px",display:"flex",alignItems:"center",justifyContent:"center"===l?"center":"right"===l?"flex-end":"flex-start",backgroundImage:`url(${oe(ne&&r?r:o)})`,backgroundSize:"cover",backgroundPosition:"center",padding:ne?"40px 20px":"60px 80px"}},e.createElement("div",{className:"yt-loyalty-page-hero-content",style:{maxWidth:"600px",zIndex:2,textAlign:l}},e.createElement("h1",{className:"yt-loyalty-page-hero-title",style:{fontSize:ne?"32px":p,color:u,marginBottom:"16px",lineHeight:1.1,fontWeight:800,textTransform:"uppercase"}},i),e.createElement("p",{className:"yt-loyalty-page-hero-subtitle",style:{fontSize:c,color:d,fontWeight:Number(s)||400,marginBottom:"32px"}},a),m&&e.createElement("div",{className:"yt-loyalty-page-hero-button-wrapper",style:{display:"flex",gap:"16px",justifyContent:"center"===l?"center":"right"===l?"flex-end":"flex-start"}},e.createElement("button",{className:"yt-loyalty-page-hero-button",style:ie,onClick:()=>{"undefined"!=typeof window&&window.ytapp&&(window.ytapp.loyaltyWidgetOpen=!0,window.dispatchEvent(new Event("loyaltyWidgetOpenChanged")))}},"Join Now")))),"show"===F&&e.createElement("div",{className:"yt-loyalty-page-steps",style:{padding:"40px 20px",position:"relative",textAlign:"center"}},e.createElement("div",{className:"yt-loyalty-page-steps-background-text",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",fontSize:"12vw",fontWeight:900,color:"#F5F5F5",zIndex:0,whiteSpace:"nowrap",pointerEvents:"none",opacity:.5}},"GETTING STARTED"),e.createElement("div",{className:"yt-loyalty-page-steps-content",style:{position:"relative",zIndex:1}},e.createElement("h2",{className:"yt-loyalty-page-steps-title",style:{fontSize:"32px",fontWeight:700,marginBottom:"8px",color:"#000"}},Q),e.createElement("p",{className:"yt-loyalty-page-steps-subtitle",style:{color:g,marginBottom:"24px"}},U),e.createElement("div",{className:"yt-loyalty-page-steps-grid",style:{display:"flex",flexDirection:ne?"column":"row",justifyContent:"center",gap:"40px",maxWidth:"1200px",margin:"0 auto"}},[{icon:e.createElement(v,null),title:Y,desc:G},{icon:e.createElement(B,null),title:X,desc:Z},{icon:e.createElement(C,null),title:J,desc:K}].map((t,n)=>e.createElement("div",{key:n,className:"yt-loyalty-page-step-item",style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center"}},e.createElement("div",{className:"yt-loyalty-page-step-icon",style:{width:"80px",height:"80px",borderRadius:"50%",border:"4px solid #ccc",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"32px",color:"#666",marginBottom:"12px"}},t.icon),e.createElement("div",{className:"yt-loyalty-page-step-title",style:{fontSize:"16px",fontWeight:700,color:g,textTransform:"uppercase",lineHeight:"normal"}},t.title),e.createElement("p",{className:"yt-loyalty-page-step-description",style:{fontSize:"13px",color:g,lineHeight:1.2,maxWidth:"300px"}},t.desc)))))),"show"===P&&e.createElement("div",{className:"yt-loyalty-page-ways-to-earn",style:{padding:"40px 20px",position:"relative",borderTop:"1px solid #eee"}},e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-background-text",style:{position:"absolute",top:ne?"10%":"50%",left:"50%",transform:"translate(-50%, -50%)",fontSize:"12vw",fontWeight:900,color:"#F5F5F5",zIndex:0,whiteSpace:"nowrap",pointerEvents:"none",opacity:.5}},"WAYS TO EARN"),e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-grid",style:{position:"relative",zIndex:1,maxWidth:"1000px",margin:"0 auto",display:"flex",flexWrap:"wrap",justifyContent:"center",gap:"12px"}},be.map((t,n)=>e.createElement("div",{key:n,className:"yt-loyalty-page-ways-to-earn-item",style:{width:ne?"100%":"220px",border:"2px solid #ddd",padding:"12px 8px",display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",borderRadius:z,boxShadow:"-1px 2px 3px rgba(0,0,0,0.1)"}},e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-icon",style:{fontSize:"32px",marginBottom:"4px",color:"#1a1a2e"}},t.icon),e.createElement("h3",{className:"yt-loyalty-page-ways-to-earn-title",style:{fontSize:"13px",fontWeight:700,marginBottom:"2px",textTransform:"uppercase",color:"#000"}},t.title),e.createElement("p",{className:"yt-loyalty-page-ways-to-earn-subtitle",style:{fontSize:"11px",color:"#666"}},t.subtitle)))),D&&e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-custom-text",style:{maxWidth:"1000px",margin:"24px auto 0",backgroundColor:b,color:"#fff",padding:"16px",textAlign:"center",fontSize:"12px",fontStyle:"italic",borderRadius:"4px"}},D)),"show"===A&&e.createElement("div",{className:"yt-loyalty-page-custom-section",style:{padding:ne?"40px 0px":"40px 20px",borderTop:"1px solid #eee"}},e.createElement("div",{className:"yt-loyalty-page-custom-section-container",style:{maxWidth:"1200px",margin:"0 auto",display:"flex",flexDirection:ne?"column":"row",alignItems:"center",gap:"40px",borderRadius:z,overflow:"hidden",backgroundColor:"#F9F9F9"}},e.createElement("div",{className:"yt-loyalty-page-custom-section-image-wrapper",style:{flex:1,width:"100%",order:ne||"left"===R?0:1}},e.createElement("div",{className:"yt-loyalty-page-custom-section-image",style:{display:"flex",width:"100%",height:"300px",backgroundColor:"#ddd",backgroundImage:V?`url(${oe(V)})`:o?`url(${oe(o)})`:void 0,backgroundSize:"cover",backgroundPosition:"center"}})),e.createElement("div",{className:"yt-loyalty-page-custom-section-content",style:{flex:1,paddingInline:ne?"20px":"10px",textAlign:ne?"center":W,order:ne||"left"===R?1:0,marginBottom:ne?"20px":"0px"}},e.createElement("h2",{className:"yt-loyalty-page-custom-section-title",style:{fontSize:M,fontWeight:700,marginBottom:"16px",color:H}},O),e.createElement("p",{className:"yt-loyalty-page-custom-section-subtitle",style:{fontSize:j,color:q,marginBottom:"24px",lineHeight:1.6,whiteSpace:"pre-line"}},L)))),"show"===_&&e.createElement("div",{className:"yt-loyalty-page-footer",style:{marginBottom:"20px"}},e.createElement("div",{className:"yt-loyalty-page-footer-container",style:{maxWidth:"1200px",margin:"0 auto"}},e.createElement("div",{className:"yt-loyalty-page-footer-custom-text",style:{backgroundColor:b,color:"#fff",padding:"16px",textAlign:"center",fontSize:"12px",fontStyle:"italic",borderRadius:"4px"}},ee),e.createElement("div",{className:"yt-loyalty-page-footer-signup",style:{display:"flex",flexDirection:ne?"column":"row",justifyContent:"space-between",alignItems:"center",marginTop:"40px",padding:"20px",border:"1px solid #eee",borderRadius:"4px",gap:"20px",textAlign:ne?"center":"left"}},e.createElement("div",{className:"yt-loyalty-page-footer-signup-content"},e.createElement("h3",{style:{fontSize:"20px",fontWeight:700,marginBottom:"4px",color:"#000",textAlign:ne?"center":"left"}},"Rewards Program"),e.createElement("p",{style:{fontSize:"14px",color:"#666"}},te)),e.createElement("button",{className:"yt-loyalty-page-footer-signup-button",style:ae,onClick:()=>{"undefined"!=typeof window&&window.ytapp&&(window.ytapp.loyaltyWidgetOpen=!0,window.dispatchEvent(new Event("loyaltyWidgetOpenChanged")))}},"JOIN NOW")))))},Mp=({showPopup:n,selectedOffer:o,selectedOfferTerms:r,onClose:i,offersConfig:a})=>{const[l,c]=t(!1);if(!n||!o||!r)return null;const d=o._customOffer,s=d?.code||o.code,p=e.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:i},e.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()},e.createElement("div",{style:{fontSize:"clamp(32px, 8vw, 40px)",color:"#4C4C4C",marginTop:"16px",marginBottom:"8px",display:"flex",justifyContent:"center",position:"relative"}},"free_product"===o.couponType?e.createElement(y,null):e.createElement(Ae,null)),e.createElement("div",{style:{fontSize:"clamp(16px, 4vw, 20px)",fontWeight:500,color:"#4C4C4C",lineHeight:"normal",textAlign:"center"}},o.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")),e.createElement("div",{style:{fontSize:"clamp(28px, 7vw, 40px)",fontWeight:"600",color:a?.textColor||"#EE8E35",lineHeight:"normal",textAlign:"center"}},o.name),e.createElement("div",{style:{fontSize:"clamp(16px, 4vw, 20px)",color:"#000000",textAlign:"center",fontWeight:500}},r.offerMessage),s&&e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",marginTop:"16px",padding:"12px 20px",backgroundColor:a?.cardBackgroundColor||"#F5F5F5",borderRadius:`${a?.roundness||8}px`,border:`1px dashed ${a?.accentColor||"#EE8E35"}`}},e.createElement("span",{style:{fontSize:"clamp(16px, 4vw, 18px)",fontWeight:"600",color:a?.textColor||"#333",letterSpacing:"1px"}},s),e.createElement("button",{onClick:async()=>{if(s)try{await navigator.clipboard.writeText(s),c(!0),setTimeout(()=>c(!1),2e3)}catch(e){console.error("Failed to copy:",e)}},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:l?"#22c55e":a?.accentColor||"#EE8E35",fontSize:"20px",transition:"color 0.2s ease"},title:l?"Copied!":"Copy code"},l?e.createElement(I,null):e.createElement(z,null))),r.terms.length>0&&e.createElement(e.Fragment,null,e.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"}}),e.createElement("div",{style:{marginTop:"15px",fontSize:"clamp(14px, 3.5vw, 16px)",textAlign:"center",display:"flex",flexDirection:"column"}},e.createElement("strong",{style:{color:"#888"}},"Terms & Conditions"),e.createElement("ul",{style:{marginTop:"5px",paddingLeft:"20px",textAlign:"left",display:"inline-block",color:"#000",lineHeight:"1.3",marginBottom:"0"}},r.terms.map((t,n)=>e.createElement("li",{key:n,style:{marginBottom:"4px"}},t))))),e.createElement("button",{onClick:i,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 rt(p,document.body)},jp=({showPopup:n,selectedOffer:o,selectedOfferTerms:r,onClose:i,offersConfig:a})=>{const[l,c]=t(!1);if(!n||!o||!r)return null;const d=o._customOffer,s=d?.code||o.code,p=e.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:i},e.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 "),e.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()},e.createElement("div",{style:{width:"40px",height:"4px",backgroundColor:"#ddd",borderRadius:"2px",margin:"12px auto 16px",flexShrink:0}}),e.createElement("div",{style:{overflowY:"auto",flex:1}},e.createElement("div",{style:{padding:"0 20px 20px",backgroundColor:"#fff"}},e.createElement("div",{style:{fontSize:"48px",color:"#4C4C4C",display:"flex",justifyContent:"center",margin:"16px"}},"free_product"===o.couponType?e.createElement(y,null):e.createElement(Ae,null)),e.createElement("div",{style:{fontSize:"14px",fontWeight:500,color:"#888",textAlign:"center"}},o.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")),e.createElement("div",{style:{fontSize:"32px",fontWeight:"700",color:a?.textColor||"#EE8E35",textAlign:"center",lineHeight:"1.2"}},o.name),e.createElement("div",{style:{fontSize:"18px",color:"#000000",textAlign:"center",fontWeight:500}},r.offerMessage),s&&e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",marginTop:"20px",padding:"14px 20px",backgroundColor:a?.cardBackgroundColor||"#F5F5F5",borderRadius:`${a?.roundness||8}px`,border:`1px dashed ${a?.accentColor||"#EE8E35"}`}},e.createElement("span",{style:{fontSize:"18px",fontWeight:"600",color:a?.textColor||"#333",letterSpacing:"1px"}},s),e.createElement("button",{onClick:async()=>{if(s)try{await navigator.clipboard.writeText(s),c(!0),setTimeout(()=>c(!1),2e3)}catch(e){console.error("Failed to copy:",e)}},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:l?"#22c55e":a?.accentColor||"#EE8E35",fontSize:"22px",transition:"color 0.2s ease"},title:l?"Copied!":"Copy code"},l?e.createElement(I,null):e.createElement(z,null)))),r.terms.length>0&&e.createElement(e.Fragment,null,e.createElement("div",{style:{backgroundColor:"#F5F5F5",padding:"16px 20px"}},e.createElement("div",{style:{fontSize:"16px",fontWeight:"600",color:"#333",textAlign:"center"}},"Terms & Conditions")),e.createElement("div",{style:{padding:"20px",backgroundColor:"#fff"}},e.createElement("ul",{style:{margin:"0",paddingLeft:"20px",color:"#333",lineHeight:"1.6",fontSize:"14px"}},r.terms.map((t,n)=>e.createElement("li",{key:n,style:{marginBottom:"4px"}},t)))))),e.createElement("button",{onClick:i,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 rt(p,document.body)},Vp=({offersToShow:o,offersConfig:i,getOfferCardMessage:a,setSelectedOffer:l,setShowPopup:c})=>{const d=r(null),[s,p]=t(!1),[u,m]=t(!0),[g,x]=t("undefined"!=typeof window&&window.innerWidth<=768),f=()=>{if(d.current){const{scrollLeft:e,scrollWidth:t,clientWidth:n}=d.current;p(e>0),m(e<t-n-10)}};n(()=>{f();const e=d.current;if(e)return e.addEventListener("scroll",f),()=>e.removeEventListener("scroll",f)},[o]),n(()=>{const e=()=>{x(window.innerWidth<=768)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const b=e=>{if(d.current){const t=g?280:365,n=16,o="right"===e?t+n:-(t+n);d.current.scrollBy({left:o,behavior:"smooth"})}};return e.createElement("div",{style:{position:"relative"}},e.createElement("svg",{style:{position:"absolute",width:0,height:0}},e.createElement("defs",null,e.createElement("mask",{id:"coupon-cut-mask-desktop"},e.createElement("rect",{width:"365",height:"138",fill:"white"}),e.createElement("circle",{cx:"80",cy:"0",r:"12",fill:"black"}),e.createElement("circle",{cx:"80",cy:"138",r:"12",fill:"black"})),e.createElement("mask",{id:"coupon-cut-mask-mobile"},e.createElement("rect",{width:"280",height:"120",fill:"white"}),e.createElement("circle",{cx:"60",cy:"0",r:"10",fill:"black"}),e.createElement("circle",{cx:"60",cy:"120",r:"10",fill:"black"})))),s&&e.createElement("button",{onClick:()=>b("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"}},e.createElement(N,{size:20})),u&&e.createElement("button",{onClick:()=>b("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"}},e.createElement(F,{size:20})),e.createElement("div",{ref:d,className:"hide-scrollbar",style:{display:"flex",alignItems:"stretch",overflowX:"auto",gap:"16px",scrollbarWidth:"none",msOverflowStyle:"none",minHeight:g?"110px":"128px"}},o?.map(t=>e.createElement("div",{key:t.discountId,style:{flexShrink:0,width:g?"280px":"365px",minWidth:g?"280px":"365px",minHeight:g?"110px":"128px",backgroundColor:"transparent",borderRadius:`${i?.roundness||0}px`,border:"1px solid #e0e0e0",display:"flex",position:"relative",overflow:"visible",mask:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,WebkitMask:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,maskImage:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,WebkitMaskImage:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`}},e.createElement("div",{style:{width:g?"60px":"80px",minHeight:g?"110px":"128px",backgroundColor:i?.accentColor||"#EE8E35",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:g?"10px 6px":"12px 8px",position:"relative",borderTopLeftRadius:`${i?.roundness||0}px`,borderBottomLeftRadius:`${i?.roundness||0}px`}},e.createElement("div",{style:{position:"absolute",right:"-2px",top:"12px",bottom:"12px",width:"2px",borderLeft:"2px dashed #FFFFFF"}})),i?.iconVisibility&&e.createElement("div",{style:{position:"absolute",left:g?"42.5px":"57.5px",top:"35%",transform:"translateY(-50%)",width:g?"32px":"40px",height:g?"32px":"40px",backgroundColor:"#FFFFFF",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:g?"16px":"20px",color:"#333333",zIndex:10,boxShadow:"0 2px 5px rgba(0,0,0,0.1)",border:"1px solid #E0E0E0"}},"free_product"===t.couponType?e.createElement(y,null):e.createElement(Ae,null)),e.createElement("div",{style:{flex:1,padding:g?"12px 12px":"15px 15px",paddingLeft:g?"25px":"35px",display:"flex",flexDirection:"column",justifyContent:"space-between",borderTopRightRadius:`${i?.roundness||0}px`,borderBottomRightRadius:`${i?.roundness||0}px`,overflow:"hidden",backgroundColor:i?.cardBackgroundColor||"#ffffff",minWidth:0}},e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:g?"4px":"6px",lineHeight:"normal"}},e.createElement("div",{style:{fontSize:g?"9px":"10px",color:"#666666",fontWeight:"400"}},"free_product"===t.couponType?"Free Gift":t._customOffer?.code?"Coupon":"Special Deal"),e.createElement("div",{style:{fontSize:g?"13px":"15px",fontWeight:"600",color:i?.textColor||"#2c3e50"}},t.name),e.createElement("div",{style:{fontSize:g?"11px":"12px",color:i?.accentColor||"#EE8E35",wordWrap:"break-word",overflowWrap:"break-word",whiteSpace:"normal",minHeight:g?"28px":"32px"}},a(t))),e.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},e.createElement("div",{style:{borderTop:"1px solid #999999",marginTop:"4px",width:"100%",height:"0",display:"block"}}),e.createElement("a",{href:"#",onClick:e=>{e.preventDefault(),l(t),c(!0)},style:{fontSize:g?"11px":"12px",color:"#2c3e50",fontWeight:"500",textDecoration:"none",cursor:"pointer",textAlign:"center",marginTop:"0"}},i?.viewDetailsTitle||"View Details")))))),e.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 "))},Wp=({offersToShow:o,offersConfig:r,getOfferCardMessage:i,setSelectedOffer:a,setShowPopup:l})=>{const[c,d]=t("undefined"!=typeof window&&window.innerWidth<=768);return n(()=>{const e=()=>{d(window.innerWidth<=768)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e.createElement("div",{style:{borderRadius:`${r?.roundness||8}px`}},o?.map((t,n)=>e.createElement("div",{key:t.discountId,style:{display:"flex",alignItems:"flex-start",gap:c?"8px":"12px",padding:c?"12px 0":"16px 0",paddingLeft:c?"10px":"20px",backgroundColor:!0===r?.cardBackgroundTransparent||"true"===String(r?.cardBackgroundTransparent)?"transparent":r?.cardBackgroundColor||"#ffffff",borderBottom:n<(o?.length||0)-1?"1px solid rgb(225 218 218)":"none",marginBottom:"4px",borderRadius:`${r?.roundness||0}px`}},r?.iconVisibility&&e.createElement("div",{style:{width:c?"40px":"50px",height:c?"40px":"50px",backgroundColor:"#f8f9fa",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:c?"20px":"25px",marginTop:c?"5px":"10px",border:"2px solid #4a4a4a",color:"#4a4a4a"}},"free_product"===t.couponType?e.createElement(y,null):e.createElement(Ae,null)),e.createElement("div",{style:{flex:1}},e.createElement("div",{style:{fontSize:c?"14px":"15px",fontWeight:600,color:"#000000",lineHeight:"1"}},t.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "),":"," ",e.createElement("span",{style:{fontWeight:600,color:r?.textColor||"#34495e"}},t.name)),e.createElement("div",{style:{fontSize:c?"12px":"13px",color:"#7f8c8d",marginBottom:"6px"}},i(t)),e.createElement("div",{style:{fontSize:c?"11px":"12px",color:"#000000"}},"offer auto applied",e.createElement("a",{href:"#",onClick:e=>{e.preventDefault(),a(t),l(!0)},style:{color:r?.accentColor||"#7f8c8d",fontWeight:700,textDecoration:"none",marginLeft:"2px"}},r?.viewDetailsTitle||"T&C"))))))},Hp=({offersConfig:o,offers:i})=>{const[a,l]=t(!1),[c,d]=t(null),[s,p]=t(null),[u,m]=t("undefined"!=typeof window&&window.innerWidth<=768),[g,x]=t("undefined"!=typeof window&&window.innerWidth<=450),f=r(null);n(()=>{const e=()=>{m(window.innerWidth<=768),x(window.innerWidth<=450)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),n(()=>{f.current&&ln(f.current)},[o?.sectionBgContrastColor]);const y=(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",o=-1;Object.keys(t).forEach(e=>{t[e]>o&&(o=t[e],n=e)});const r=e.map((e,t)=>({o:e,idx:t})),i=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 r.sort((e,t)=>{const o=e.o.customCartProgressBarCriteria===n,r=t.o.customCartProgressBarCriteria===n;if(o&&r){const n=i(e.o),o=i(t.o);return n!==o?n-o:e.idx-t.idx}return o&&!r?-1:!o&&r?1:e.idx-t.idx}),r.map(e=>e.o)})((!1===o?.showBackendOffers&&o?.customOffers&&o.customOffers.length>0?o.customOffers.map((e,t)=>{return{discountId:-(t+1),name:(n=e).title,couponType:n.code?"discount_code":"special_deal",customCartProgressBarCriteria:null,discountPercentage:null,couponTemplateId:0,minimumOrderValue:0,quantityThreshold:0,_allVariantIds:[],description:n.description,_customOffer:n};var n}):i)||[]),b=e=>{if(d(e),e){const t=e._customOffer;p(t?(e=>({offerMessage:e.description||"Special offer available",terms:e.terms?e.terms.split("\n").filter(e=>""!==e.trim()):[]}))(t):(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 o=["Limited Time Offer","Applies automatically when criteria is met"];return"quantity"===e.customCartProgressBarCriteria&&e.quantityThreshold?o.push(`Unlock when you add ${e.quantityThreshold} ${e.quantityThreshold>1?"items":"item"} to cart`):"minimum_order_value"===e.customCartProgressBarCriteria&&e.minimumOrderValue&&o.push(`Unlock at order value of ${e.minimumOrderValue}`),t&&o.push("Combines with other order discounts"),t||o.push("Not applicable if other offer with higher discount applied on same product"),{offerMessage:n,terms:o}})(e))}},h=e=>{const t=e._customOffer;return t?t.description||"Special offer available":(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")(e)};return e.createElement("div",null,e.createElement("div",{style:{position:"relative",width:"100%",maxWidth:"450px",borderRadius:"list"===o?.sectionType?`${o?.roundness||0}px`:"0px",boxSizing:"border-box",backgroundColor:o?.sectionBackgroundColor||"#fff"}},e.createElement("div",{style:{border:"coupon"===o?.sectionType?"none":"1px solid rgb(169, 163, 163)",borderTop:"1px solid rgb(169, 163, 163)",padding:null!=o?.cardPadding?`${o.cardPadding}px`:u?"20px 10px 15px":"30px 15px 20px",position:"relative",borderRadius:"list"===o?.sectionType?`${o?.roundness||8}px`:"0px"}},e.createElement("span",{ref:f,className:"yt-product-offers-section-title",style:{position:"absolute",top:"0",left:"left"===o?.alignment?"coupon"===o?.sectionType?"0px":u?"10px":"20px":"right"===o?.alignment?"auto":"50%",right:"right"===o?.alignment?"coupon"===o?.sectionType?"0px":u?"10px":"20px":"auto",transform:"middle"===o?.alignment?"translateX(-50%) translateY(-50%)":"translateY(-50%)",background:o?.sectionBgContrastColor||"#fff",padding:u?"0 8px":"0 10px",fontWeight:"500",fontSize:u?"14px":"16px",textTransform:"uppercase",textAlign:"center"}},o?.sectionTitle||"Available Deals and Offers"),(()=>{const t=o?.sectionType;return"list"===t?e.createElement(Wp,{offersToShow:y,offersConfig:o||{},getOfferCardMessage:h,setSelectedOffer:b,setShowPopup:l}):"coupon"===t?e.createElement(Vp,{offersToShow:y,offersConfig:o||{},getOfferCardMessage:h,setSelectedOffer:b,setShowPopup:l}):null})(),g?e.createElement(jp,{selectedOffer:c,selectedOfferTerms:s,showPopup:a,offersConfig:o,onClose:()=>{l(!1),d(null),p(null)}}):e.createElement(Mp,{selectedOffer:c,selectedOfferTerms:s,showPopup:a,offersConfig:o,onClose:()=>{l(!1),d(null),p(null)}}))))};export{Rp as Bundle,Op as BundleLoader,Ol as Cart,Lp as LoyaltyPageBlock,At as Nudge,Hp as ProductOffers,Vt as SpinnerWheel};
|