yt-uikit 0.8.15-loyalty-page-block.15 → 0.8.15-loyalty-page-block.17
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
|
@@ -5081,4 +5081,4 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
|
|
|
5081
5081
|
}
|
|
5082
5082
|
`,ix=x.span`
|
|
5083
5083
|
font-size: 12px;
|
|
5084
|
-
`,lx=({productsWithIndices:e,isOpen:n,onClose:r,cta:o,variantOptions:a,onVariantChange:s,handleAddToCart:d,primaryProductId:p,variantId:u})=>{const m=i(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?1/0:0:1/0:0},[]),[f,g]=c({}),[h,x]=c({});l(()=>{const t={},n={};e?.forEach(({product:e,index:r})=>{let o,a=[];if(e.productId===p&&u){const t=e?.productDetails?.variants?.edges.find(e=>e?.node?.id?.includes(u))?.node;t&&m(e.productDetails,t.id)>0&&(a=t.title.split(" / "),o=t)}if(!a.length){const t=e.productDetails.variants.edges.find(t=>m(e.productDetails,t?.node?.id)>0)?.node||e?.productDetails?.variants?.edges?.[0]?.node;t?(a=t.title.split(" / "),o=t):a=e?.productDetails?.options?.map(e=>e.values[0]??"")}t[r]=a,o&&(n[r]={node:o},s(r,o.id))}),g(t),x(n)},[e,p,u,s,m]),l(()=>{if(!p||!u)return;const t=e?.find(({product:e})=>e?.productId===p);if(!t)return;const{product:n,index:r}=t,o=n?.productDetails?.variants?.edges?.find(e=>e.node.id.includes(u))?.node;if(o&&m(n.productDetails,o.id)>0){const e=o.title.split(" / ");g(t=>({...t,[r]:e})),x(e=>({...e,[r]:{node:o}})),s(r,o.id)}},[u,p,e,s,m]);const y=(e,t,n,r)=>{const o=[...f[e]||[]];o[t]=n;const a=o.join(" / "),i=r.productDetails.variants.edges.find(e=>e.node.title===a)?.node;return!!i&&m(r.productDetails,i.id)>0},b=(t,n,r)=>{const{product:o}=e?.find(e=>e.index===t)||{product:{productDetails:{variants:{edges:[]}}}};if(!o?.productDetails)return;if(!y(t,r,n,o))return;const a={...f};a[t][r]=n,g(a);const i=o?.productDetails?.variants?.edges?.find(e=>e.node.title===a[t].join(" / "))?.node;i&&(s(t,i.id),x(e=>({...e,[t]:{node:i}})))};if(!n)return null;const w=t.createElement(Uh,{className:"yt-fixedBundle-variant-modal_overlay",onClick:r},t.createElement(Gh,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},t.createElement(Qh,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:o.backgroundColor,color:o.textColor}},"Select Options"),e?.map(({product:n,index:r},o)=>t.createElement(t.Fragment,null,t.createElement(Zh,{className:"yt-fixedBundle-variant-modal_product-block"},t.createElement(Xh,{className:"yt-fixedBundle-variant-modal_thumbnail",src:h[r]?.node?.image?.url||n.productDetails.featuredMedia?.preview?.image?.url,alt:n.productDetails.title}),t.createElement(Kh,{className:"yt-fixedBundle-variant-modal_product-info"},t.createElement(Jh,{className:"yt-fixedBundle-variant-modal_product-name"},n.productDetails.title,n.productDetails.variants.edges.length>1&&t.createElement(tx,{className:"yt-fixedBundle-variant-modal_selected-value"},f[r]?.join(" / "))),n.productDetails.options.map((e,o)=>{const i=a&&a?.options?.find(t=>t.name===e.name);return e.values.length<=1?t.createElement(t.Fragment,null):i&&"color"===i?.type?t.createElement(nx,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(ix,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map((e,a)=>{const l=!y(r,o,e,n);return t.createElement(t.Fragment,null,i.values.find(t=>t.name===e)?.value?t.createElement(rx,{className:"yt-fixedBundle-variant-modal_color-swatch",key:a,color:i.values.find(t=>t.name===e)?.value||e,selected:f[r]?.[o]==e,disabled:l,onClick:()=>{b(r,e,o)}},t.createElement("span",null)):t.createElement(ox,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:f[r]?.[o]==e,disabled:l,onClick:()=>{b(r,e,o)}},e))})):i&&"image"===i?.type?t.createElement(nx,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(ix,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map((e,a)=>{const l=!y(r,o,e,n);return t.createElement(t.Fragment,null,i?.values.find(t=>t.name===e)?.value?t.createElement(ax,{className:"yt-fixedBundle-variant-modal_image-swatch",key:a,selected:f[r]?.[o]==e,disabled:l,onClick:()=>{b(r,e,o)},src:i.values.find(t=>t.name===e)?.value},t.createElement("span",null)):t.createElement(ox,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:f[r]?.[o]==e,disabled:l,onClick:()=>{b(r,e,o)}},e))})):t.createElement(nx,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(ix,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map((e,a)=>{const i=!y(r,o,e,n);return t.createElement(ox,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:f[r]?.[o]==e,disabled:i,onClick:()=>{b(r,e,o)}},e)}))}))),o<e.length-1&&t.createElement(ex,{className:"yt-fixedBundle-variant-modal_divider"}))),t.createElement(Yh,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:o.backgroundColor,color:o.textColor},onClick:d},"Add bundle to cart")));return v.createPortal(w,document.body)},cx=({options:e,selectedValue:n,onChange:r,type:a="text"})=>{const[i,s]=c(!1),d=o(null);l(()=>{const e=e=>{d.current&&!d.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const p=e=>"color"===a?t.createElement(Oh,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:e.value},t.createElement("span",null)):"image"===a?t.createElement(Mh,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:e.value||"/placeholder.svg",alt:e.name},t.createElement("span",null)):null;return t.createElement(Nh,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:d},t.createElement(Ih,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>s(!i)},t.createElement(Dh,{className:"yt-fixedBundle-variant-dropdown-horizontal_content"},n&&("color"===a||"image"===a)&&p(n),t.createElement("span",{className:"yt-fixedBundle-variant-dropdown-horizontal_selected-text"},n&&n.name)),t.createElement(_h,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:i})),i&&t.createElement(Ph,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},e?.map(e=>t.createElement(Ah,{className:"yt-fixedBundle-variant-selector_dropdown-item "+(n?.name===e.name?"yt-fixedBundle-variant-selector_dropdown-item--selected":""),key:e.name,$isSelected:n?.name===e.name,onClick:()=>{r(e),s(!1)}},("color"===a||"image"===a)&&p(e),t.createElement(Fh,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},e.name)))))},sx=({product:e,variantOptions:n,selectedVariants:r,onVariantChange:o,variantId:a,primaryProductId:i,variantType:s="dropdown"})=>{const[d,p]=c(r||[]);l(()=>{if(a&&e.variants.edges.some(e=>e.node.id.includes(a))){const t=e.variants.edges.find(e=>e.node.id.includes(a))?.node;if(t){const e=t.title.split(" / ");p(e)}}},[a,e]);const u=e=>{if(!n?.options)return"text";const t=n.options.find(t=>t.name===e);return t?.type||"text"},m=(e,t)=>{if(!n?.options)return e.values.map(e=>({name:e,value:e}));const r=n.options.find(t=>t.name===e.name);return e.values.map(e=>{const t=r?.values?.find(t=>t.name===e);return{name:e,value:t?.value||e}})},f=(e,t)=>{const n=d[t];if(!n)return null;return m(e).find(e=>e.name===n)||null};return t.createElement(Rh,{className:"yt-fixedBundle-variant-selector-horizontal_container"},e.options.map((n,r)=>t.createElement(Lh,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:n.name,$isFirst:0===r},n?.values?.length>1&&t.createElement(cx,{options:m(n),selectedValue:f(n,r),onChange:t=>{console.log(t),((t,n)=>{const r=[...d];r[t]=n.name,p(r);const a=e.variants.edges.find(n=>n.node.title===(e.options?.length>0?r.join(" / "):r[t]))?.node.id;o(a||"")})(r,t)},type:u(n.name)}))))},dx=({product:e,selectedVariantId:n,isChecked:r,canCustomize:o,styles:a,onVariantChange:s,onCheckChange:d,isMobile:p,isHorizontal:u,index:m,variantOptions:f,productsLength:g,handleOpenModal:h,storeCurrencyCode:x,primaryProductId:y,variantId:b})=>{const v=i(()=>t=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?1/0:0:1/0:0},[e]),[w,C]=c(e?.variants?.edges.find(e=>v(e?.node?.id)>0)?.node||e?.variants?.edges?.[0]?.node),[k]=c(e?.options?.map(e=>e?.values?.[0])||[]),E=e?.id===y;l(()=>{if(b&&e.id===y){const t=e?.variants?.edges?.find(e=>e?.node?.id?.includes(b))?.node;t&&v(t.id)>0&&(C(t),s(t.id))}else{const t=e?.variants?.edges?.find(e=>v(e?.node?.id)>0)?.node||e?.variants?.edges?.[0]?.node;C(t)}},[e,y,n,b,s,v]);const S="undefined"!=typeof window&&"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain||"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,T=w?.image?.url||e.featuredMedia?.preview?.image?.url;return t.createElement(t.Fragment,null,u?t.createElement("div",{className:""+(e.id===y?"yt-fixedBundle-product-card--horizontal-primary":"yt-fixedBundle-product-card--horizontal-associated"),style:{display:"flex",alignItems:"center",gap:"10px",backgroundColor:a.fixedBundle?.cardBackgroundColor}},o&&t.createElement(Hh,{className:"yt-fixedBundle-product-card_checkbox-wrapper--horizontal"},t.createElement(Vh,{className:"yt-fixedBundle-product-card_checkbox-hidden",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}-${m}`,defaultChecked:r,onChange:e=>d(e.target.checked),disabled:E}),t.createElement(Wh,{className:"yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${e.id}-${m}`,isChecked:r,borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.general?.ctaBackgroundColor},t.createElement(yt,null))),t.createElement(nh,{className:"yt-fixedBundle-product-card-horizontal_item",style:{borderRadius:a.fixedBundle?.borderRadius,border:`1px solid ${a.fixedBundle?.borderColor}80`,backgroundColor:a.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`8px 8px 8px -6px ${a.fixedBundle.borderColor}`,"no-spread":`4px 4px 0px -1px ${a.fixedBundle.borderColor}80`}[a.fixedBundle.shadowType]||"none"},canCustomize:o},"undefined"!=typeof window&&"devansh-test123.myshopify.com"!==window.ytBundleApp?.storeDomain&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&t.createElement(rh,{className:"yt-fixedBundle-product-card-horizontal_image",src:Cx(T),alt:e.title,style:{borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,aspectRatio:a.general.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),t.createElement(oh,{className:"yt-fixedBundle-product-card-horizontal_details"},t.createElement(ah,{className:"yt-fixedBundle-product-card-horizontal_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement(ih,{className:"yt-fixedBundle-product-card-horizontal_price-section"},t.createElement(lh,{className:"yt-fixedBundle-product-card-horizontal_price--new"},wx(a.general.currencySymbol,x)," ",vx(w?.price)),a.fixedBundle.compareAtPriceVisibility&&w?.compareAtPrice&&parseFloat(w.compareAtPrice)>parseFloat(w?.price)&&t.createElement(ch,{className:"yt-fixedBundle-product-card-horizontal_price--old"},wx(a.general.currencySymbol,x),vx(w?.compareAtPrice))),t.createElement(sx,{product:e,variantOptions:f,selectedVariants:k,onVariantChange:t=>{const n=e?.variants?.edges?.find(e=>e.node.id===t)?.node;n&&v(t)>0&&s(t)},variantId:b,primaryProductId:y})))):t.createElement(t.Fragment,null,t.createElement(xh,{className:""+(e.id===y?"yt-fixedBundle-product-card--vertical-primary":"yt-fixedBundle-product-card--vertical-associated"),productsLength:g,style:{borderRadius:a.fixedBundle?.borderRadius,border:`1px solid ${a.fixedBundle?.borderColor}50`,backgroundColor:a.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`0 4px 10px -6px ${a.fixedBundle.borderColor}50`,"no-spread":`4px 4px 0px -1px ${a.fixedBundle.borderColor}50`}[a.fixedBundle.shadowType]||"none",...o&&{position:"relative"},...S&&{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",minWidth:"max-content",paddingLeft:"2px"}},borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.fixedBundle?.cardBackgroundColor},o&&t.createElement(qh,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:S},t.createElement(Vh,{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}-${m}`,defaultChecked:r,onChange:e=>d(e.target.checked),disabled:E}),t.createElement(Wh,{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${e.id}-${m}`,isChecked:r,borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.general?.ctaBackgroundColor},t.createElement(yt,{size:10}))),"undefined"!=typeof window&&"devansh-test123.myshopify.com"!==window.ytBundleApp?.storeDomain&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&t.createElement(yh,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:a.general.imageAspectRatio,height:"fit-content"}},t.createElement(bh,{className:"yt-fixedBundle-product-card_image--vertical",src:Cx(T),style:{aspectRatio:a.general.imageAspectRatio},alt:e.title}),e.variants.edges.length>1&&t.createElement(vh,{className:"yt-fixedBundle-product-card_badge-container"},t.createElement(wh,{className:"yt-fixedBundle-product-card_circle-button"},t.createElement("span",null)),t.createElement(Ch,{className:"yt-fixedBundle-product-card_circle-button-two"},t.createElement("span",null)),t.createElement(kh,{className:"yt-fixedBundle-product-card_count-badge"},e.variants.edges.length,"+"))),t.createElement(Eh,{className:"yt-fixedBundle-product-card-vertical_info"},t.createElement(Sh,{className:"yt-fixedBundle-product-card-vertical_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement($h,{className:"yt-fixedBundle-product-card-vertical_price-line"},t.createElement(Th,{className:"yt-fixedBundle-product-card-vertical_price--new"},wx(a.general.currencySymbol,x),vx(w?.price)),a.fixedBundle.compareAtPriceVisibility&&w?.compareAtPrice&&parseFloat(w.compareAtPrice)>parseFloat(w?.price)&&t.createElement(ch,{className:"yt-fixedBundle-product-card-vertical_price--old"},wx(a.general.currencySymbol,x),vx(w.compareAtPrice))))),(g<=3||!p)&&m<g-1&&t.createElement(Bh,{className:"yt-fixedBundle-plus-wrapper"}," ",t.createElement(zh,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},px=({bundle:e,addToCartFunction:n})=>{const[r,o]=c(!1),[s,d]=c(window.innerWidth<786),[p,u]=c(null),[m,f]=c(!1),g="undefined"!=typeof window?window.location.href:null,h=e?.products?.find(e=>e.productDetails?.handle===g?.split("/").pop()?.split("?")[0]),x=h?.productId,y=i(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?1/0:0:1/0:0},[]),[b,v]=c(Object.fromEntries(e?.products?.map((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find(t=>y(e.productDetails,t?.node?.id)>0)?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id]))),w="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain),C=e?.showIndividualProductSelector||!0,[k,E]=c(new Set(e.products.reduce((e,t,n)=>(w&&t?.productId!==x&&!C||e.push(n),e),[])));l(()=>{const e=()=>{const e=new URL(window.location.href).searchParams.get("variant");u(e)},t=e=>{const t=history[e];return function(...n){const r=t.apply(this,n);return window.dispatchEvent(new Event(e.toLowerCase())),r}};return history.pushState=t("pushState"),history.replaceState=t("replaceState"),window.addEventListener("pushstate",e),window.addEventListener("replacestate",e),e(),()=>{window.removeEventListener("pushstate",e),window.removeEventListener("replacestate",e)}},[]),l(()=>{p&&x&&v(t=>{const n={...t};return e?.products?.forEach((e,t)=>{e.productId===x&&(n[t.toString()]=p)}),n})},[p,x,e?.products]),l(()=>{const e=()=>{d(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const S=a((e,t)=>{v(n=>({...n,[e.toString()]:t}))},[]),T=(t,n)=>{const r=e.products[n].productId;w&&C&&r===x||E(e=>{const r=new Set(e);return t?r.add(n):r.delete(n),r})},$=i(()=>(e,t)=>y(e.productDetails,t)>0,[y]),B=i(()=>e.products.some((e,t)=>k.has(t)&&e.productDetails.variants.edges.length>1),[e.products,k]),{originalPrice:z,dealPrice:N,offerValue:I}=i(()=>{const{price:t,compareAtPrice:n}=e.products.reduce((e,t,n)=>{if(!k.has(n))return e;const r=b[n.toString()];if(!r)return e;const o=t.productDetails.variants.edges?.find(e=>e.node.id===r)?.node;if(!o)return e;const a=parseFloat(o?.price??"0"),i=parseFloat(o?.compareAtPrice||a.toString());return e.price+=a,e.compareAtPrice+=i,e},{price:0,compareAtPrice:0}),r=Math.max(t,n);let o=Math.min(t,n);k.size===e.products.length&&(e?.percentageOff?o=t*(1-e.percentageOff/100):e?.dealAmount?o=e.dealAmount:e?.amountOff&&(o=t-e.amountOff));const a=n-o;return{originalPrice:r.toFixed(2),dealPrice:o.toFixed(2),offerValue:a.toFixed(2)}},[e.products,b,k,e.percentageOff,e.dealAmount,e.amountOff]),D=i(()=>e.products.map((e,t)=>({product:e,index:t})).filter(({index:e})=>k.has(e)),[e.products,k]),_=D.every(({product:e,index:t})=>$(e,b[t.toString()])),P=async e=>{if(_){e.preventDefault(),e.stopPropagation(),o(!0),f(!1);try{const e=Object.entries(b).map(([e,t])=>{const n=parseInt(e);return isNaN(n)||!k.has(n)?null:t}).filter(Boolean);n&&await n(Number(z),e)}catch(e){console.error("Error adding to cart:",e)}o(!1)}};if(!n)return t.createElement(t.Fragment,null);const A=e.customizations,F=A.fixedBundle?.cardLayoutStyle||"auto",O="horizontal"===F||"auto"===F&&s,M="bundles"==e.appName?e.pageHeader?.title:e?.title,R="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return t.createElement(Kg,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:A.fixedBundle.sectionBackgroundColor,..."transparent"!==A.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},M&&t.createElement(Jg,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:A.fixedBundle?.titleBackgroundColor||"none",color:A.fixedBundle?.titleTextColor||"black",textAlign:A.fixedBundle.infoAlignment??"center",fontSize:A.fixedBundle?.titleFontSize,..."transparent"!==A.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===A.fixedBundle.infoAlignment&&"transparent"!==A.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===A.fixedBundle.infoAlignment&&"transparent"!==A.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===A.fixedBundle.infoAlignment&&"transparent"===A.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},M),R&&t.createElement(eh,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:A.fixedBundle?.subtitleFontSize,textAlign:A.fixedBundle.infoAlignment??"center",..."left"===A.fixedBundle.infoAlignment&&"transparent"!==A.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===A.fixedBundle.infoAlignment&&"transparent"!==A.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===A.fixedBundle.infoAlignment&&"transparent"===A.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},R),O?t.createElement(th,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},e?.products?.map((n,r)=>t.createElement(t.Fragment,{key:`${n.productId}-${r}`},t.createElement(dx,{isChecked:k.has(r),product:n.productDetails,selectedVariantId:b[r.toString()]||"",canCustomize:e?.canCustomizeFixedBundle||!1,styles:A,onVariantChange:e=>S(r,e),onCheckChange:e=>{T(e,r)},isMobile:s,index:r,isHorizontal:O,variantOptions:e.variantOptions,productsLength:e.products.length,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:x,variantId:p||void 0})))):t.createElement(gh,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},t.createElement(hh,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===A.fixedBundle.infoAlignment?"flex-start":"right"===A.fixedBundle.infoAlignment?"flex-end":"center"}},e?.products?.map((n,r)=>t.createElement(dx,{key:`${n.productId}-${r}`,isChecked:k.has(r),product:n.productDetails,selectedVariantId:b[r.toString()]||"",canCustomize:e?.canCustomizeFixedBundle||!1,styles:A,onVariantChange:e=>S(r,e),onCheckChange:e=>T(e,r),isMobile:s,index:r,isHorizontal:O,productsLength:e.products.length,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:x,variantId:p||void 0})),B&&t.createElement(lx,{productsWithIndices:D,isOpen:m,onClose:()=>f(!1),variantOptions:e.variantOptions,cta:{textColor:A.general.ctaTextColor,backgroundColor:A.general.ctaBackgroundColor},onVariantChange:S,handleAddToCart:P,primaryProductId:x,variantId:p||void 0}))),t.createElement(sh,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===A.fixedBundle.infoAlignment?"flex-start":"right"===A.fixedBundle.infoAlignment?"flex-end":"center"}},Number(z)>0&&Number(I)>0&&A.fixedBundle.compareAtPriceVisibility&&t.createElement(dh,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",t.createElement(uh,{className:"yt-fixedBundle-summary_price"},wx(A.general.currencySymbol,e?.storeCurrencyCode),vx(z))),0!==k.size&&t.createElement(ph,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",t.createElement(uh,{className:"yt-fixedBundle-summary_price"},wx(A.general.currencySymbol,e?.storeCurrencyCode),vx(N))," ",Number(I)>0&&t.createElement(mh,{className:"yt-fixedBundle-summary_save-tag"},"Save:"," ",wx(A.general.currencySymbol,e?.storeCurrencyCode),vx(I)))),t.createElement(fh,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),O||!B?P(e):f(!0)},disabled:k.size<1||r||!_,style:{backgroundColor:A.general?.ctaBackgroundColor||"#121212",color:A.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${A.general?.ctaBackgroundColor||"#121212"}`,boxShadow:A.general.ctaShadowType,paddingTop:A.general?.ctaPadding,paddingBottom:A.general?.ctaPadding,borderRadius:A.general.ctaBorderRadius,width:A.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{A.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=A.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=A.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{A.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=A.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=A.general?.ctaTextColor||"#FFFFFF")}},r?t.createElement(Ea,{color:"white",loading:r,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):_?t.createElement(t.Fragment,null,A.fixedBundle?.ctaTitle??"Add Bundle to cart"):t.createElement(t.Fragment,null,"Out of Stock")))},ux=()=>t.createElement(t.Fragment,null,t.createElement("style",null,"@keyframes spin { to { transform: rotate(360deg); } }"),t.createElement("div",{className:"yt-collection-bundle-loader-spinner",style:{width:"14px",height:"14px",border:"2px solid #f3f3f3",borderTop:"2px solid #007bff",borderRadius:"50%",animation:"spin 1s linear infinite",display:"block"}})),mx=({product:e,tierIdx:n,isOpen:r,onClose:o,onAddToBundle:a,canAdd:i,isSelected:s,customizations:d,isMobile:p})=>{const[u,m]=c(0),[f,g]=c(e.variants[0].id.toString()),h=e.variants.find(e=>e.id.toString()===f)||e.variants[0],x=e.images.filter(Boolean);if(l(()=>(r&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=""}),[r]),l(()=>{if(h&&h?.featured_image?.src){const e=document.querySelector(".yt-collection-bundle-modal-image");e?.setAttribute("src",h?.featured_image?.src)}},[h]),!r)return null;const y=t.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:o},t.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",borderRadius:d?.borderRadius||"12px",maxWidth:1e3,width:"100%",height:"72dvh",margin:"auto",display:"flex",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},t.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:o,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"}},t.createElement(Et,{size:22})),t.createElement("div",{className:"yt-collection-bundle-modal-image-container",style:{flex:1,position:"relative",margin:"20px 0 20px 20px",borderRadius:d?.borderRadius||"12px"}},x.length>0&&t.createElement("img",{className:"yt-collection-bundle-modal-image",src:Cx(x[u]||e.images[0]),alt:e.title,style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:d?.borderRadius||"12px"}}),x.length>1&&t.createElement("div",{className:"yt-collection-bundle-modal-image-dots",style:{position:"absolute",bottom:16,left:"50%",transform:"translateX(-50%)",display:"flex",gap:8,background:"rgba(0,0,0,0.4)",padding:"6px 12px",borderRadius:20}},x.map((e,n)=>t.createElement("div",{key:n,className:"yt-collection-bundle-modal-image-dot",onClick:()=>m(n),style:{width:10,height:10,borderRadius:"50%",background:n===u?"#fff":"#fff8",cursor:"pointer",display:"block"}})))),t.createElement("div",{className:"yt-collection-bundle-modal-content",style:{flex:1,padding:"30px",overflowY:"auto",display:"flex",flexDirection:"column",scrollbarWidth:"none"}},t.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"6px 0",fontSize:24,fontWeight:600,lineHeight:"normal"}},e.title),e.variants.length>1&&t.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative"}},t.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee",lineHeight:"normal"}},e?.options?.join(" & "),":"," ",t.createElement("strong",null,h.title)),t.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:f,onChange:e=>g(e.target.value),style:{position:"absolute",inset:0,opacity:0,cursor:"pointer",lineHeight:"normal"}},e.variants.map(e=>t.createElement("option",{key:e.id,value:e.id,disabled:!e.available},e.title," ",!e.available&&"(Out of stock)")))),t.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0",lineHeight:"normal"}},"₹",(h.price/100).toFixed(0),h.compare_at_price&&h.compare_at_price>h.price&&t.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999",lineHeight:"normal"}},"₹",(h.compare_at_price/100).toFixed(0))),t.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"white"}},t.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!i?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>a(e,n),disabled:!i||!h.available,style:{width:"100%",padding:"12px",fontSize:17,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:h.available?s||!i?"#28a745":d?.atcBg||"#007bff":"rgb(204, 204, 204)",color:d?.atcText||"#fff",cursor:i&&h.available?"pointer":"not-allowed",textAlign:"center",lineHeight:"normal"}},s?"Added to Box":h.available?"Add to Box":"Out of Stock")),e.description&&t.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:e.description},style:{lineHeight:"normal",color:"#444",marginTop:"10px"}})))),b=t.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:o},t.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",width:"100%",height:"100dvh",display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},t.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:o,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center"}},t.createElement(Et,{size:22})),t.createElement("div",{className:"yt-collection-bundle-modal-scroll-container",style:{flex:1,overflowY:"auto",paddingBottom:100}},x.length>0&&t.createElement("div",{className:"yt-collection-bundle-modal-image-wrapper",style:{position:"relative"}},t.createElement("img",{className:"yt-collection-bundle-modal-image",src:h.featured_image?.src||x[u]||e.images[0],alt:e.title,style:{width:"100%",display:"block",maxHeight:"50vh",objectFit:"cover",objectPosition:"center"}}),x.length>1&&t.createElement("div",{className:"yt-collection-bundle-modal-image-dots",style:{position:"absolute",bottom:16,left:"50%",transform:"translateX(-50%)",display:"flex",gap:8,background:"rgba(0,0,0,0.4)",padding:"6px 12px",borderRadius:20}},x.map((e,n)=>t.createElement("div",{key:n,className:"yt-collection-bundle-modal-image-dot",onClick:()=>m(n),style:{width:10,height:10,borderRadius:"50%",background:n===u?"#fff":"#fff8",cursor:"pointer"}})))),t.createElement("div",{className:"yt-collection-bundle-modal-content",style:{padding:"20px"}},t.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"0 0 12px",fontSize:22,fontWeight:600}},e.title),e.variants.length>1&&t.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative",marginBottom:20}},t.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee"}},"Variant: ",t.createElement("strong",null,h.title)),t.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:f,onChange:e=>g(e.target.value),style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}},e.variants.map(e=>t.createElement("option",{key:e.id,value:e.id,disabled:!e.available},e.title," ",!e.available&&"(Out of stock)")))),t.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0"}},"₹",(h.price/100).toFixed(0),h.compare_at_price&&h.compare_at_price>h.price&&t.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999"}},"₹",(h.compare_at_price/100).toFixed(0))),e.description&&t.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:e.description},style:{lineHeight:1.7,color:"#444"}}))),t.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"#fff",padding:"8px 10px",borderTop:"1px solid #eee",boxShadow:"0 -4px 10px rgba(0,0,0,0.05)"}},t.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!i?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>a(e,n),disabled:!i||!h.available,style:{width:"100%",padding:"10px",fontSize:14,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:!s&&i&&h.available?d?.atcBg||"#007bff":"#28a745",color:d?.atcText||"#fff",cursor:i&&h.available?"pointer":"not-allowed"}},s?"Added to Box":h.available?"Add to Box":"Out of Stock"))));return v.createPortal(p?b:y,document.body)},fx=({title:e,uploadState:n,onUpload:r,onRemove:o,onRetry:a})=>{const i="object"==typeof n&&n?.loading,l="object"==typeof n&&n?.error,c="object"==typeof n&&n?.url;return t.createElement("div",{className:"yt-collection-bundle-upload-field",style:{padding:"20px",border:"2px dashed #ccc",borderRadius:"8px",textAlign:"center",background:"#fafafa"}},t.createElement("div",{className:"yt-collection-bundle-upload-title",style:{fontWeight:500,color:"#333",marginBottom:"4px"}},e),i&&t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-collection-bundle-upload-loading",style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",color:"#007bff",fontSize:"13px",margin:"12px 0"}},t.createElement(ux,null)," Uploading ",n?.name,"...")),l&&t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-collection-bundle-upload-error",style:{color:"#dc3545",fontSize:"13px",margin:"8px 0"}},"Upload failed. Try again."),t.createElement("button",{type:"button",className:"yt-collection-bundle-upload-retry-btn",onClick:a,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Retry Upload")),c&&!i&&!l&&t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-collection-bundle-upload-image-container",style:{margin:"12px 0"}},t.createElement("img",{className:"yt-collection-bundle-upload-image",src:n.url,alt:"Uploaded",style:{maxWidth:"100%",maxHeight:"150px",borderRadius:"6px"}})),t.createElement("div",{className:"yt-collection-bundle-upload-filename",style:{fontSize:"12px",color:"#28a745",marginBottom:"8px"}},n.name),t.createElement("button",{type:"button",className:"yt-collection-bundle-upload-remove-btn",onClick:o,style:{background:"#dc3545",color:"white",border:"none",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",cursor:"pointer"}},"Remove")),!n&&t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-collection-bundle-upload-hint",style:{color:"#888",fontSize:"12px",marginBottom:"12px"}},"jpeg/png (max 5MB)"),t.createElement("button",{type:"button",className:"yt-collection-bundle-upload-btn",onClick:r,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Upload")))},gx=({config:e,bundleAddToCartLoading:n,addCustomBundleToCart:r})=>{const[i,s]=c(1),[d,p]=c([]),[u,m]=c(null),[f,g]=c({}),[h,x]=c(window.innerWidth<640),[y,b]=c({}),v=o(new Map),[w,C]=c(!1),k=o(null),E=o(new Map),[S,T]=c(160),$=h?8:20,{customizations:B}=e,z=e.config.builderTiers.collectionTier.sort((e,t)=>e.tier-t.tier),N=!!e.config.form,I=z.length+(N?1:0),D=B.hideSelectedProducts,_=B.allowMultipleQty,P=B.hideOutOfStockProducts,A=e=>z[e-1]?.products||[],F=a(e=>{const t=A(e),n=P?t.filter(e=>e.available).length:t.length;b(t=>{const r=t[e]||0,o=Math.min(r+8,n);return o<=r?t:{...t,[e]:o}})},[8,P]);l(()=>(k.current=new IntersectionObserver(e=>{for(const t of e)if(t.isIntersecting){const e=parseInt(t.target.getAttribute("data-sentinel-step")||"0");e>0&&e===i&&F(e)}},{root:null,threshold:0,rootMargin:"100px 0px"}),()=>{k.current?.disconnect()}),[F,i]),l(()=>{if(N&&i===I)return;const e=i,t=A(e);if(0===t.length)return;const n=P?t.filter(e=>e.available).length:t.length;if(0===(y[e]||0)){const t=Math.min($,n);b(n=>({...n,[e]:t}))}},[i,$,P,y]),l(()=>{const e=document.querySelector(".box-loader-scene");e&&e.setAttribute("style","display: none;");const t=()=>x(window.innerWidth<640);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const O=a(e=>{T(e+10)},[]),M=d.reduce((e,t)=>e+t.quantity,0),R=d.reduce((e,t)=>e+t.price*t.quantity,0)/100,L=d.reduce((e,t)=>{const n=z.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId),r=n?.variants.find(e=>e.id.toString()===t.variantId);return e+(r?.compare_at_price??t.price)*t.quantity},0)/100,j=(e,t)=>{const n=e.variants.find(e=>e.id===parseInt(t));if(!n)return;const r=document.querySelector(`[data-product-id="${e.id}"]`);r&&(r.dataset.selectedVariant=t,r.dataset.currentPrice=n.price.toString())},V=(e,t)=>{const n=document.querySelector(`[data-product-id="${e.id}"]`);if(!n)return;const r=n.dataset.selectedVariant||e.variants[0].id.toString(),o=parseInt(n.dataset.currentPrice||e.variants[0].price.toString());p(n=>{const a=`${e.id}-${r}-${t}`,i=n.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===a);if(i)return n.filter(e=>e!==i);const l=q[t],c=W(t);return c!==1/0&&l>=c?n:[...n,{productId:e.id.toString(),variantId:r,price:o,quantity:1,tierIndex:t}]})},W=e=>{const t=z[e];return t.maximumQuantity>0?t.maximumQuantity:1/0},H=(e,t)=>{const n=W(t);if(n===1/0)return!0;const r=q[t],o=d.some(n=>n.productId===e.id.toString()&&n.tierIndex===t);return!!o||r<n},q=z.map((e,t)=>d.filter(e=>e.tierIndex===t).reduce((e,t)=>e+t.quantity,0)),U=(e,t,n)=>{const r=W(n);if(r===1/0)return!0;return q[n]<r},G=e=>{if(!v.current.has(e)){const t=document.createElement("input");t.type="file",t.accept="image/jpeg,image/png",t.style.display="none",t.onchange=async t=>{const n=t.target.files?.[0];if(n){if(n.size>5242880)return alert("Max 5MB");if(!n.type.match(/^image\/(jpeg|png)$/i))return alert("JPEG/PNG only");g(t=>({...t,[e]:{loading:!0,name:n.name}}));try{const t=await(async e=>{const t=new FormData;t.append("file",e),C(!0);try{const e=window?.Shopify?.shop||"falah-devstore.myshopify.com",n=window?.Shopify?.shop?"https://products.yourtoken.io":"http://localhost:8000",r=await fetch(`${n}/shopify/upload?shop=${e}`,{method:"POST",headers:{"x-yourtoken-app-name":"bundles"},body:t});if(!r.ok)throw new Error("Upload failed");return(await r.json()).url}catch(e){throw C(!1),alert("Upload failed. Try again."),e}finally{C(!1)}})(n);g(r=>({...r,[e]:{url:t,name:n.name}}))}catch{g(t=>({...t,[e]:{error:!0,name:n.name}}))}}},document.body.appendChild(t),v.current.set(e,t)}return v.current.get(e)},Q=N&&i===I,Y=(Q?null:z[i-1])?W(i-1):0,Z=z.map((e,t)=>{const n=d.filter(e=>e.tierIndex===t).reduce((e,t)=>{const n=`${t.productId}-${t.variantId}`,r=e.find(e=>`${e.productId}-${e.variantId}`===n);return r?r.quantity+=t.quantity:e.push({...t,quantity:t.quantity}),e},[]);return{tier:e,items:n,count:q[t]}});return t.createElement("div",{className:"yt-collection-bundle-builder",style:{margin:"0 auto",maxWidth:"1600px"}},B.headerImage&&!B.headerImage.includes("Liquid error")&&t.createElement("img",{className:"yt-collection-bundle-header-img",src:B.headerImage,alt:"Collection Bundle header",style:{width:"100%"}}),B.showTierSteps&&t.createElement("div",{style:{paddingTop:B.headerImage&&!B.headerImage.includes("Liquid error")?"20px":"0"}},t.createElement(hx,{totalSteps:I,isFormStep:Q,currentStep:i,getStepTitle:e=>N&&e===I?"Customize Gift Details":z[e-1]?.title||`Step ${e}`,isMobile:h,formTitle:e?.config?.form?.title,hasForm:N,onStepClick:e=>{if(e>1&&!d.length)return alert("Add at least one product first");s(e),window.scrollTo(0,0)}})),Array.from({length:I},(e,t)=>t+1).map(n=>{const r=N&&n===I,o=r?[]:A(n),a=P?o.filter(e=>e.available):o,l=n-1,c=a.slice(0,y[n]||0);return t.createElement("div",{key:n,className:"yt-collection-bundle-step-content "+(i===n?"yt-collection-bundle-step-content-active":""),style:{display:i===n?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},r&&e.config.form?t.createElement("div",{className:"yt-collection-bundle-customize-form",style:{maxWidth:"80%",margin:"0 auto",padding:"1rem",marginBottom:`${S}px`}},e?.config?.form?.sections?.map((e,n)=>t.createElement("div",{key:`sec_${n}`,className:"yt-collection-bundle-form-group",style:{marginBottom:"32px"}},t.createElement("label",{className:"yt-collection-bundle-label",style:{display:"block",fontWeight:600,marginBottom:"12px",color:"#333",fontSize:"16px",lineHeight:"normal"}},e?.title),"text"===e.type&&t.createElement("div",{className:"yt-collection-bundle-form-fields",style:{display:"flex",flexDirection:"column",gap:"12px"}},e.fields.map((e,n)=>{const r=e?.title??"Field "+n;return t.createElement("textarea",{key:r,className:"yt-collection-bundle-textarea",placeholder:e?.title,rows:3,maxLength:500,onChange:e=>g(t=>({...t,[r]:e.target.value})),style:{padding:"12px",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px",resize:"vertical",lineHeight:"normal"}})})),"image"===e.type&&t.createElement("div",{className:"yt-collection-bundle-image-section",style:{marginBottom:"24px"}},t.createElement("sub",{className:"yt-collection-bundle-upload-hint",style:{display:"block",color:"#666",fontSize:"12px",marginBottom:"8px",lineHeight:"normal"}},"jpeg/png (max 5MB)"),t.createElement("div",{className:"yt-collection-bundle-form-fields",style:{display:"flex",flexDirection:"column",gap:"16px"}},e.fields.map((e,n)=>{const r=e?.title??"Field "+n,o=f[r];return t.createElement(fx,{key:r,title:e?.title,uploadState:o,onUpload:()=>G(r).click(),onRemove:()=>g(e=>{const{[r]:t,...n}=e;return n}),onRetry:()=>G(r).click()})})))))):t.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:h?"grid":"flex",gridTemplateColumns:h?"repeat(2,1fr)":"",flexWrap:h?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:`${S}px`}},c.map(e=>t.createElement(xx,{key:e.id,product:e,tierIdx:l,customizations:B,isMobile:h,hoveredCard:u,setHoveredCard:m,selectedProducts:d,handleAddToBundle:V,canAddProduct:H,allowMultipleQty:_,handleVariantChange:j,canIncrement:U,setSelectedProducts:p})),i===n&&(y[n]||0)<a.length&&t.createElement("div",{ref:e=>{const t=E.current.get(n);t&&k.current?.unobserve(t),e?(E.current.set(n,e),k.current?.observe(e)):E.current.delete(n)},"data-sentinel-step":n.toString(),style:{height:"20px",width:"100%",display:"block"}})))}),t.createElement(yx,{config:e,selectedProducts:d,selectedByTier:Z,totalItems:M,totalPrice:R,totalCompareAtPrice:L,currentStep:i,totalSteps:I,currentTierMax:Y,tierSelectedCounts:q,isMobile:h,bundleAddToCartLoading:n,isUploading:w,hoveredCard:u,setHoveredCard:m,hideSelectedProducts:D,getProductStep:e=>{for(let t=0;t<z.length;t++)if(z[t].products.some(t=>t.id.toString()===e))return t+1;return N?I:z.length},setCurrentStep:s,handleRemoveItem:(e,t,n)=>{p(r=>r.filter(r=>!(r.productId===e&&r.variantId===t&&r.tierIndex===n)))},handleCheckout:async()=>{if(i!==I||!d.length)return;const e={};N&&Object.entries(f).forEach(([t,n])=>{const r=t.split("|").pop()?.replace(/^f_\d+$/,"")||t;"string"==typeof n&&n.trim()?e[r]=n:n&&"object"==typeof n&&"url"in n&&(e[r]=n.url)});const t=d.map(t=>({variantId:t.variantId,quantity:t.quantity,properties:e}));r(t)},hasForm:N,onHeightChange:O}))},hx=({totalSteps:e,isFormStep:n,currentStep:r,getStepTitle:o,isMobile:a,formTitle:i,hasForm:l,onStepClick:c})=>t.createElement("div",{className:"yt-collection-bundle-steps-nav-container",style:{display:"flex",justifyContent:"center",flexDirection:"column",gap:a?"0":"1rem",overflowX:"auto",scrollbarWidth:"none",borderBottom:"1px solid #878787",marginInline:a?"0":"2%",paddingBottom:"1rem",textAlign:"center"}},t.createElement("div",{className:"yt-collection-bundle-steps-nav",style:{display:"flex",justifyContent:"center",gap:a?"0":"2rem",overflowX:"auto",scrollbarWidth:"none"}},Array.from({length:e},(e,t)=>t+1).map(n=>t.createElement("div",{key:n,className:"yt-collection-bundle-step-item "+(r===n?"yt-collection-bundle-step-item-active":""),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.5rem",minWidth:"120px",cursor:"pointer",opacity:r===n?1:.5,transition:"opacity 0.2s"},onClick:()=>c(n)},t.createElement("div",{className:"yt-collection-bundle-step-icon "+(r===n?"yt-collection-bundle-step-icon-active":""),style:{width:"40px",height:"40px",background:r===n?"#000":"#fff",border:"2px solid #ccc",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center"}},l&&n===e?t.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},t.createElement("path",{d:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.67C10.96 2.54 10.05 2 9 2c-1.66 0-3 1.34-3 3 0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1h-2c-.55 0-1-.45-1-1s.45-1 1-1h2zm-6 0c.55 0 1 .45 1 1s-.45 1-1 1H7c-.55 0-1-.45-1-1s.45-1 1-1h2zM20 19H4V8h16v11z"})):t.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},t.createElement("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}))),t.createElement("div",{className:"yt-collection-bundle-step-label",style:{fontSize:"14px",textAlign:"center",color:"#333",fontWeight:"600",lineHeight:"normal"}},o(n))))),i&&l&&n&&t.createElement("p",{className:"yt-collection-bundle-steps-nav-description",style:{fontSize:a?"14px":"16px",marginBottom:a?"0":"14px",fontWeight:"400",color:"#000",lineHeight:"normal"}},i)),xx=({product:e,tierIdx:n,customizations:r,isMobile:o,hoveredCard:a,setHoveredCard:i,selectedProducts:l,handleAddToBundle:s,canAddProduct:d,allowMultipleQty:p,handleVariantChange:u,canIncrement:m,setSelectedProducts:f})=>{const[g,h]=c(!1),x=document.querySelector(`[data-product-id="${e.id}"]`),y=x?.dataset.selectedVariant||e.variants[0].id.toString(),b=e.variants.find(e=>e.id.toString()===y)||e.variants[0],v=l.some(t=>t.productId===e.id.toString()&&t.variantId===y&&t.tierIndex===n),w=a===e.id,C=l.filter(t=>t.productId===e.id.toString()&&t.variantId===b.id.toString()&&t.tierIndex===n).reduce((e,t)=>e+t.quantity,0);return t.createElement(t.Fragment,null,t.createElement("div",{key:e.id,className:"yt-collection-bundle-product-item","data-product-id":e.id,"data-selected-variant":b.id,"data-current-price":b.price,style:{display:"flex",flexDirection:"column",border:r?.productCardBorder||"1px solid #ddd",background:r?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:o?0:"250px",maxWidth:o?"none":"250px",borderRadius:r?.borderRadius||"8px",boxShadow:"spread"===r?.productCardShadow?"8px 8px 8px -6px #0000004D":"no-spread"===r?.productCardShadow?"6px 6px 0px -1px #00000033":"none",width:o?"100%":""}},t.createElement("div",{className:"yt-collection-bundle-product-image",style:{position:"relative",width:"100%",aspectRatio:r?.productImageRatio||"1/1",overflow:"hidden",cursor:"pointer",background:"#f9f9f9"},onClick:()=>h(!0),onMouseEnter:()=>i(e.id),onMouseLeave:()=>i(null)},t.createElement("img",{src:Cx(e.images[0]||"https://cdn.shopify.com/s/files/1/0750/9937/3789/files/placeholder-thumbnail.png?width=250px"),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:w?0:1,transform:w?"scale(1.05)":"scale(1)"},alt:e.title}),t.createElement("img",{src:Cx(e.images[1]||e.images[0]),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:w?1:0,transform:"scale(1.05)"},alt:e.title}),e.variants.length>1&&t.createElement("select",{className:"yt-collection-bundle-variant-selector",style:{position:"absolute",bottom:"10px",left:"10px",right:"10px",background:"rgba(255,255,255,0.9)",border:"none",borderRadius:"4px",padding:"8px",fontSize:"12px",fontWeight:"600",zIndex:2,lineHeight:"normal"},onChange:t=>u(e,t.target.value),defaultValue:b.id,onClick:e=>{e.stopPropagation()}},e.variants.map(e=>t.createElement("option",{key:e.id,value:e.id,disabled:!e.available},e.title," ",!e.available&&"(Out of stock)")))),t.createElement("div",{className:"yt-collection-bundle-product-info",style:{padding:"12px",flexGrow:1,display:"flex",flexDirection:"column"}},t.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:o?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:"normal",color:"#333",flexGrow:1}},e.title),t.createElement("div",{className:"yt-collection-bundle-product-prices",style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"nowrap",whiteSpace:"nowrap",overflow:"hidden",lineHeight:"normal"}},t.createElement("span",{className:"yt-collection-bundle-product-price",style:{fontSize:o?"14px":"16px",fontWeight:"bold",color:"#000",flexShrink:0,lineHeight:"normal"}},"₹",(b.price/100).toFixed(0)),b.compare_at_price&&b.compare_at_price>b.price&&t.createElement("span",{className:"yt-collection-bundle-product-compare",style:{fontSize:"14px",textDecoration:"line-through",color:"#999",flexShrink:0,lineHeight:"normal"}},"₹",(b.compare_at_price/100).toFixed(0)))),p&&C>0?t.createElement("div",{className:"yt-collection-bundle-quantity-row",style:{display:"flex",alignItems:"center",flexWrap:"nowrap",background:"#cccccc"}},t.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-minus",style:{width:"40%",height:b.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:o?"6px":"12px",fontSize:o?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{f(t=>{const r=`${e.id}-${b.id}-${n}`,o=t.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===r);return o&&o.quantity>1?t.map(e=>e===o?{...e,quantity:e.quantity-1}:e):o?t.filter(e=>e!==o):t})}},"-"),t.createElement("span",{className:"yt-collection-bundle-qty-display",style:{minWidth:"24px",textAlign:"center",fontWeight:600,width:"100%",lineHeight:"normal"}},C),t.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-plus",style:{width:"40%",height:b.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:o?"6px":"12px",fontSize:o?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{b.available&&m(e,b.id.toString(),n)&&f(t=>{const r=`${e.id}-${b.id}-${n}`,o=t.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===r);return o?t.map(e=>e===o?{...e,quantity:e.quantity+1}:e):[...t,{productId:e.id.toString(),variantId:b.id.toString(),price:b.price,quantity:1,tierIndex:n}]})},disabled:!b.available||!m(e,b.id.toString(),n)},"+")):t.createElement("button",{className:"yt-collection-bundle-add-btn "+(v?"yt-collection-bundle-add-btn-added":""),style:{background:v?"#28a745":d(e,n)&&b.available?r?.atcBg||"#007bff":"#ccc",color:r?.atcText||"#fff",border:"none",padding:o?"6px":"12px",fontSize:o?"12px":"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",opacity:b.available?1:.6,lineHeight:"normal",textAlign:"center"},onClick:()=>{b.available&&d(e,n)&&s(e,n)},disabled:!b.available||!d(e,n)},v?"Added":b.available?"ADD TO BOX":"Out of Stock")),g&&t.createElement(mx,{product:e,tierIdx:n,isOpen:g,onClose:()=>h(!1),onAddToBundle:(e,t)=>{s(e,t),h(!1)},canAdd:d(e,n),isSelected:v,customizations:r,isMobile:o}))},yx=e=>{const{config:n,selectedProducts:r,selectedByTier:a,totalItems:i,totalPrice:s,totalCompareAtPrice:d,currentStep:p,totalSteps:u,currentTierMax:m,tierSelectedCounts:f,isMobile:g,bundleAddToCartLoading:h,isUploading:x,hoveredCard:y,setHoveredCard:b,getProductStep:v,setCurrentStep:w,handleRemoveItem:C,handleCheckout:k,hasForm:E,onHeightChange:S}=e,{customizations:T}=n,[$,B]=c(!1),z=o(null),N=a.filter(({count:e})=>e>0).map(({tier:e,count:t})=>((e,t)=>{const n=e.discountData;if(!n||!n.tiers?.length)return null;const r=[...n.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity),o=r.filter(e=>t>=e.minimumQuantity),a=[];if(o.length>0){const e=o.reduce((e,t)=>e.minimumQuantity>t.minimumQuantity?e:t).discountValue,{type:t}=n;let r;switch(t){case"percentage_discount_coupon":r=`${e}% OFF`;break;case"amount_discount_coupon":r=`₹${e} OFF`;break;case"fixed_price_collection":r=`Fixed ₹${e}`;break;case"dummy_coupon":r="Discount Applied";break;default:r=null}r&&a.push(r)}const i=r.find(e=>e.minimumQuantity>t);if(i){const e=i.minimumQuantity-t,r=i.discountValue,{type:o}=n;let l;switch(o){case"percentage_discount_coupon":l=`${r}% OFF`;break;case"amount_discount_coupon":l=`₹${r} OFF`;break;case"fixed_price_collection":l=`Fixed ₹${r}`;break;case"dummy_coupon":l="Discount";break;default:l=null}l&&a.push(`Add ${e} more item${1!==e?"s":""} to get ${l}`)}return a.length>0?a.join(" + "):null})(e,t)).filter(Boolean);return l(()=>{const e=m!==1/0&&f[p-1]===m-2&&m>1;let t=null;return e?(B(!0),t=setTimeout(()=>{B(!1)},3e3)):B(!1),()=>{t&&clearTimeout(t)}},[m,f,p]),l(()=>{if(z.current&&S){const e=z.current.offsetHeight;S(e)}},[g,S,r]),t.createElement("div",{ref:z,className:"yt-collection-bundle-bar",style:{background:T?.bundleBg||"#fff",color:T?.bundleText||"#333",border:T?.bundleBorder||"1px solid #878787",display:"flex",flexDirection:"column",position:"fixed",bottom:"10px",left:"50%",transform:"translateX(-50%)",width:"compact"==T.stickyBarWidth?"600px":"90%",maxWidth:"95%",zIndex:899,boxShadow:"0 -2px 10px rgba(0,0,0,0.1)",transition:"bottom 0.3s ease",borderRadius:T?.borderRadius||"8px",overflow:"hidden"}},N.length>0&&t.createElement("div",{style:{padding:"4px 8px",background:"#dbdbdbc5",color:"#6c757d",textAlign:"center",fontSize:"12px",fontWeight:500}},N.join(" + ")),t.createElement("div",{className:"yt-collection-bundle-bar-header",style:{position:"relative",textAlign:"center"}},$&&t.createElement(t.Fragment,null,t.createElement("style",null,"\n @keyframes fadeIn {\n from { opacity: 0; transform: translateX(-50%) translateY(10px); }\n to { opacity: 1; transform: translateX(-50%) translateY(0); }\n }\n "),t.createElement("div",{className:"yt-collection-bundle-ctx",style:{position:"absolute",top:"-40px",left:"50%",transform:"translateX(-50%)",background:T?.atcBg||"#007bff",color:T?.atcText||"#fff",padding:"4px 8px",borderRadius:T?.borderRadius||"8px",fontSize:"14px",whiteSpace:"nowrap",zIndex:10,boxShadow:"0 4px 12px rgba(0,0,0,0.2)",animation:"fadeIn 0.3s ease-out",minWidth:"300px",textAlign:"center",border:"1px solid rgba(0,0,0,0.1)",lineHeight:"normal"}},"Add up to"," ",t.createElement("span",{style:{fontWeight:600}},m," item",m>1?"s":"")))),r.length>0&&t.createElement("div",{className:"yt-collection-bundle-bar-top",style:{display:"flex",alignItems:"center",padding:"8px 8px 0",position:"relative",borderRadius:T?.borderRadius||"8px"}},t.createElement("div",{className:"yt-collection-bundle-images",style:{display:"flex",flex:1,gap:"5px",justifyContent:"center",alignItems:"center",overflowX:"auto",padding:"4px 0",scrollbarWidth:"none"}},a.filter(({count:e})=>e>0).map(({items:e},r,o)=>t.createElement(t.Fragment,{key:r},t.createElement("div",{className:"yt-collection-bundle-tier-images",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",minWidth:"fit-content"}},t.createElement("div",{style:{display:"flex",gap:"4px"}},e.map((e,o)=>{const a=n.config.builderTiers.collectionTier.flatMap(e=>e.products).find(t=>t.id.toString()===e.productId);if(!a)return null;const i=v(e.productId),l=p===i;return t.createElement("div",{key:o,className:"yt-collection-bundle-img-wrapper",style:{position:"relative",flexShrink:0,height:"65px"}},t.createElement("div",{style:{position:"relative",width:"67px",height:"67px",borderRadius:`calc(${T?.borderRadius||"8px"} / 2)`,overflow:"hidden",cursor:l?"default":"pointer",transition:"transform 0.2s ease"},onMouseEnter:e=>!l&&(e.currentTarget.style.transform="scale(1.08)"),onMouseLeave:e=>e.currentTarget.style.transform="scale(1)",onClick:()=>!l&&w(i)},t.createElement("img",{src:Cx(a.images[0]),style:{width:"65px",height:"65px",objectFit:"cover",borderRadius:`calc(${T?.borderRadius||"8px"} / 2)`,transition:"opacity 0.2s",pointerEvents:"none",border:"1px solid #ddd"},alt:"Selected"}),e.quantity>1&&t.createElement("div",{className:"yt-collection-bundle-qty-badge",style:{position:"absolute",bottom:"4px",right:"4px",background:"rgba(0,0,0,0.7)",color:"#fff",borderRadius:"10px",padding:"2px 6px",fontSize:"10px",fontWeight:600,lineHeight:"normal"}},"x",e.quantity),t.createElement("button",{className:"yt-collection-bundle-remove-btn",style:{position:"absolute",top:"4px",right:"4px",width:"20px",height:"20px",background:"rgba(220,53,69,0.95)",color:"white",border:"none",borderRadius:"50%",fontSize:"12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.3)",textAlign:"center",lineHeight:"normal"},onClick:t=>{t.stopPropagation(),C(e.productId,e.variantId,r)}},"×")))}))),r<o.length-1&&o[r+1].count>0&&t.createElement("div",{style:{color:"#666",paddingInline:"6px",lineHeight:"normal"}},t.createElement(Ct,null)))))),g?t.createElement("div",{className:"yt-collection-bundle-mobile-bar-content",style:{display:"flex",flexDirection:i>0&&(E||n?.config?.builderTiers?.collectionTier?.length>1)?"column":"row",margin:"4px",gap:i>0?"10px":"0",background:"#dbdbdb",borderRadius:T?.borderRadius||"8px",overflow:"hidden"}},t.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:r.length>0?"space-between":"center",...0!==i&&{paddingInline:"6px"},alignItems:"center",borderRadius:T?.borderRadius||"8px"}},t.createElement(t.Fragment,null,0===i&&t.createElement("div",{style:{fontSize:"14px",color:"#6c757d",lineHeight:"normal",...0===i&&{padding:"8px 0 12px 0",background:"#dbdbdb",color:"#6c757d",width:"100%",borderRadius:T?.borderRadius||"8px"}}},"Add Items to Checkout"),i>0&&t.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"4px",width:"100%",justifyContent:"center"}},t.createElement("div",{style:{fontSize:"14px",color:"#000000",fontWeight:600,lineHeight:"normal"}},"₹",s.toLocaleString()),d>s&&t.createElement("div",{style:{fontSize:"14px",color:"#787878",fontWeight:500,textDecoration:"line-through",lineHeight:"normal"}},"₹",d.toLocaleString()),i>0&&t.createElement("span",{style:{fontSize:"14px",color:"#000000",fontWeight:500,lineHeight:"normal"}},`(${i} Added)`)))),t.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"4px"}},(n?.config?.builderTiers?.collectionTier?.length>1||E)&&i>0&&t.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:1===p?"not-allowed":"pointer",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",textAlign:"center",lineHeight:"normal"},onClick:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>b(-1),onMouseLeave:()=>b(null),disabled:1===p},"Back"),i>0&&t.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===i||x?"yt-collection-bundle-next-btn-disabled":""),style:{background:T?.btnPrimaryBg||"#28a745",color:T?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",opacity:p===u&&0===i||x?.6:1,textAlign:"center",lineHeight:"normal"},onClick:p===u?k:()=>w(p+1),disabled:p===u&&0===i||h||x},h?t.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},t.createElement(ux,null)):p===u?"Checkout":"Next"))):t.createElement("div",{className:"yt-collection-bundle-bar-bottom",style:{display:"flex",alignItems:"center",padding:"0px",background:"#dbdbdb",margin:"8px",borderRadius:T?.borderRadius||"8px",overflow:"hidden",scrollbarWidth:"none"}},(n?.config?.builderTiers?.collectionTier?.length>1||E)&&i>0&&t.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:1===p?"not-allowed":"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",...-1===y&&{filter:"brightness(60%)"},textAlign:"center",lineHeight:"normal"},onClick:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>b(-1),onMouseLeave:()=>b(null),disabled:1===p},"Back"),t.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:r.length>0?"space-between":"center",paddingInline:"6px",alignItems:"center",...0===i&&{padding:"12px 24px"}}},0===i&&t.createElement("div",{style:{fontSize:"16px",color:"#6c757d",lineHeight:"normal"}},"Add Items to Checkout"),i>0&&t.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"6px"}},t.createElement("div",{style:{fontSize:"16px",color:"#000000",fontWeight:600,lineHeight:"normal"}},"₹",s.toLocaleString()),d>s&&t.createElement("div",{style:{fontSize:"15px",color:"#787878",fontWeight:500,textDecoration:"line-through",lineHeight:"normal"}},"₹",d.toLocaleString()),i>0&&t.createElement("span",{style:{fontSize:"16px",color:"#000000",fontWeight:500,lineHeight:"normal"}},`(${i} Added)`))),i>0&&t.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===i||x?"yt-collection-bundle-next-btn-disabled":""),style:{background:T?.btnPrimaryBg||"#28a745",color:T?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",opacity:p===u&&0===i||x?.6:1,...-2===y&&{filter:"brightness(90%)"},textAlign:"center",lineHeight:"normal"},onClick:p===u?k:()=>w(p+1),disabled:p===u&&0===i||h||x,onMouseEnter:()=>b(-2),onMouseLeave:()=>b(null)},h?t.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},t.createElement(ux,null)):p===u?"Checkout":"Next")))},bx=window?.Shopify?.currency||{rate:1,active:"INR"},vx=e=>{if(!e)return;const t=navigator.language||"en-US",n=Number((Number(e)*bx.rate).toFixed(2));return new Intl.NumberFormat(t).format(n)},wx=(e,t)=>t==bx.active?e:Rn(bx.active)||bx.active,Cx=(e,t)=>{if(!e||!e.includes("cdn.shopify")&&!e.includes("/cdn/shop/files/"))return e;try{const n=new URL(e),r=n.searchParams;return r.has("format")||r.set("format","webp"),r.has("quality")||r.set("quality",t?.toString()||"70"),r.has("width")||r.set("width","600"),n.toString()}catch{const n=e.includes("?")?"&":"?";return e+n+`format=webp&quality=70&width=${t?.toString()||"600"}`}},kx=(e,t,n,r,o,a)=>{const i=r.findIndex(t=>t.variantId===e);o(0===n?e=>e.filter((e,t)=>t!==i):-1===i?r=>[...r,{product:t,variantId:e,quantity:n,isFree:a}]:e=>e.map((e,t)=>t===i?{...e,quantity:e.quantity+n,isFree:a}:e))},Ex=({bundle:e,currentProductId:n,addToCartFunction:r,addCustomBundleToCart:o,selectedItems:a,setSelectedItems:i,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:s,renderingOnPage:d,bundleSubtotal:p})=>"fixed"!==e.type&&e.type&&0!==e?.type?.length?"builder"===e.type?t.createElement(Rf,{bundleAddToCartLoading:l,bundle:e,selectedItems:a,setSelectedItems:i,handleAddToCart:o,handleRemoveItem:c,renderingOnPage:d,selectedItemsQuantity:s??0,bundleSubtotal:p??{price:0,compareAtPrice:0}}):"combo"===e.type?t.createElement(jf,{bundle:e,addToCartFunction:r}):"mixAndMatch"===e.type?t.createElement(Xg,{bundle:e,addToCartFunction:r}):"collection"===e.type?t.createElement(gx,{config:e,addCustomBundleToCart:o,bundleAddToCartLoading:l}):t.createElement(yg,{bundle:e,currentProductId:n,addToCartFunction:r}):t.createElement(px,{addToCartFunction:r,bundle:e});te(".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 Sx=()=>t.createElement("div",{className:"scene"},t.createElement("div",{className:"floating"},t.createElement("div",{className:"cube"},t.createElement("div",{className:"side front"},""),t.createElement("div",{className:"side back"},""),t.createElement("div",{className:"side left"},""),t.createElement("div",{className:"side right"},""),t.createElement("div",{className:"side bottom"},""),t.createElement("div",{className:"lid"},t.createElement("div",{className:"flap north"},""),t.createElement("div",{className:"flap south"},""),t.createElement("div",{className:"flap east"},""),t.createElement("div",{className:"flap west"},""))))),Tx=({config:e,brandConfig:n})=>{const{heroDesktopImage:r,heroMobileImage:o,heroTitle:a="ZERO WASTE PREMIUM PET CARE",heroSubtitle:i="Earn Doglycoins for exclusive rewards every time you shop.",heroTextAlignment:l="left",heroSubtitleFontSize:c="18px",heroSubtitleColor:s="#000000",heroSubtitleFontWeight:d="400",heroTitleFontSize:p="48px",heroTitleColor:u="#000000",heroRegistrationCTAVisibility:m=!0,primaryColor:f="#1C1C1D",primaryContrastColor:g="#FFFFFF",secondaryColor:h="#FFFFFF",secondaryContrastColor:x="#000000",accentColor:y="#FFFFFF",borderColor:b="#E5E5E5",themeRoundness:v="0px",heroBannerVisibility:w="show",stepsVisibility:C="show",waysToEarnVisibility:k="show",customSectionVisibility:E="show",footerSignupVisibility:S="show",customSectionImagePosition:T="left",customSectionTitle:$="Earn Doglycoins every time you shop",customSectionSubtitle:B="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:z="36px",customSectionSubtitleFontSize:N="18px",customSectionImage:I,customSectionTextAlignment:D="left",customSectionTitleColor:_="#000000",customSectionSubtitleColor:P="#000000",stepsTitle:A="Getting started is easy",stepsSubtitle:F="Earn Stars and get rewarded in a few easy steps.",step1Title:O="CREATE AN ACCOUNT",step1Description:M="To get started, Join Now. You can also register on the mobile app to get access to the full range of reward benefits",step2Title:R="ORDER AND EARN REWARDS POINTS",step2Description:L="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:V="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:U="Individual rewards of 750 points or more ship FREE. No merchandise purchase required.",footerSignupSubtext:G="Use your points to redeem samples and more."}=e||{},te="undefined"!=typeof window&&window.innerWidth<=768,ne=e=>e&&e.startsWith("//")?`https:${e}`:e,re={padding:"12px 32px",borderRadius:"30px",fontSize:"14px",fontWeight:600,cursor:"pointer",textTransform:"uppercase",border:`1px solid ${f}`,transition:"all 0.3s ease"},oe={...re,backgroundColor:f,color:g,borderColor:f},ae={...re,backgroundColor:h,color:x,borderColor:b},{newSignupTokens:ie,firstOrderTokens:le,instagramFollowPoints:ce,twitterFollowPoints:se,facebookFollowPoints:de,youtubeSubscriptionPoints:pe,rewardToLeaveReview:ue,birthdayPoints:me,referralPointsForReferrer:fe,tokenCreditPercentage:ge,brandTokenName:he}=n||{},xe=[...ie?[{icon:t.createElement(K,null),title:`${ie} ${he}`,subtitle:"Create an account"}]:[],...le?[{icon:t.createElement(ee,null),title:`${le} ${he}`,subtitle:"Place your first order"}]:[],...ge?[{icon:t.createElement(ee,null),title:`${ge}% ${he}`,subtitle:`Earn ${ge}% back on every order`}]:[],...fe?[{icon:t.createElement(J,null),title:`${fe} ${he}`,subtitle:"Refer a friend and get"}]:[],...me?[{icon:t.createElement(q,null),title:`${me} ${he}`,subtitle:"Get on your birthday to spend"}]:[],...ue?[{icon:t.createElement(W,null),title:`${ue} ${he}`,subtitle:"Write a Review"}]:[],...de?[{icon:t.createElement(Q,null),title:`${de} ${he}`,subtitle:"Like on Facebook"}]:[],...ce?[{icon:t.createElement(Y,null),title:`${ce} ${he}`,subtitle:"Follow on Instagram"}]:[],...se?[{icon:t.createElement(Z,null),title:`${se} ${he}`,subtitle:"Follow on Twitter"}]:[],...pe?[{icon:t.createElement(X,null),title:`${pe} ${he}`,subtitle:"Subscribe on YouTube"}]:[]];return t.createElement("div",{className:"yt-loyalty-page-container",style:{fontFamily:"'Poppins', sans-serif",width:"100%",overflow:"hidden"}},"show"===w&&t.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(${ne(te&&o?o:r)})`,backgroundSize:"cover",backgroundPosition:"center",padding:te?"40px 20px":"60px 80px"}},t.createElement("div",{className:"yt-loyalty-page-hero-content",style:{maxWidth:"600px",zIndex:2,textAlign:l}},t.createElement("h1",{className:"yt-loyalty-page-hero-title",style:{fontSize:te?"32px":p,color:u,marginBottom:"16px",lineHeight:1.1,fontWeight:800,textTransform:"uppercase"}},a),t.createElement("p",{className:"yt-loyalty-page-hero-subtitle",style:{fontSize:c,color:s,fontWeight:Number(d)||400,marginBottom:"32px"}},i),m&&t.createElement("div",{className:"yt-loyalty-page-hero-button-wrapper",style:{display:"flex",gap:"16px",justifyContent:"center"===l?"center":"right"===l?"flex-end":"flex-start"}},t.createElement("button",{className:"yt-loyalty-page-hero-button",style:oe,onClick:()=>{"undefined"!=typeof window&&window.ytapp&&(window.ytapp.loyaltyWidgetOpen=!0,window.dispatchEvent(new Event("loyaltyWidgetOpenChanged")))}},"Join Now")))),"show"===C&&t.createElement("div",{className:"yt-loyalty-page-steps",style:{padding:"80px 20px",position:"relative",textAlign:"center"}},t.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"),t.createElement("div",{className:"yt-loyalty-page-steps-content",style:{position:"relative",zIndex:1}},t.createElement("h2",{className:"yt-loyalty-page-steps-title",style:{fontSize:"32px",fontWeight:700,marginBottom:"8px",color:"#000"}},A),t.createElement("p",{className:"yt-loyalty-page-steps-subtitle",style:{color:f,marginBottom:"60px"}},F),t.createElement("div",{className:"yt-loyalty-page-steps-grid",style:{display:"flex",flexDirection:te?"column":"row",justifyContent:"center",gap:"40px",maxWidth:"1200px",margin:"0 auto"}},[{icon:t.createElement(ee,null),title:O,desc:M},{icon:t.createElement(H,null),title:R,desc:L},{icon:t.createElement(q,null),title:j,desc:V}].map((e,n)=>t.createElement("div",{key:n,className:"yt-loyalty-page-step-item",style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center"}},t.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:"24px"}},e.icon),t.createElement("h3",{className:"yt-loyalty-page-step-title",style:{fontSize:"16px",fontWeight:700,marginBottom:"16px",color:f,textTransform:"uppercase"}},e.title),t.createElement("p",{className:"yt-loyalty-page-step-description",style:{fontSize:"13px",color:f,lineHeight:1.5,maxWidth:"300px"}},e.desc)))))),"show"===k&&t.createElement("div",{className:"yt-loyalty-page-ways-to-earn",style:{padding:"80px 20px",position:"relative",borderTop:"1px solid #eee"}},t.createElement("div",{className:"yt-loyalty-page-ways-to-earn-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}},"WAYS TO EARN"),t.createElement("div",{className:"yt-loyalty-page-ways-to-earn-grid",style:{position:"relative",zIndex:1,maxWidth:"1000px",margin:"0 auto",display:"grid",gridTemplateColumns:te?"1fr":"repeat(auto-fit, minmax(250px, 1fr))",gap:"20px"}},xe.map((e,n)=>t.createElement("div",{key:n,className:"yt-loyalty-page-ways-to-earn-item",style:{border:"2px solid #c8c8c8",padding:"30px 20px",display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",borderRadius:v,boxShadow:"-1px 2px 5px 2px lightgrey"}},t.createElement("div",{className:"yt-loyalty-page-ways-to-earn-icon",style:{fontSize:"32px",marginBottom:"16px",color:"#1a1a2e"}},e.icon),t.createElement("h3",{className:"yt-loyalty-page-ways-to-earn-title",style:{fontSize:"14px",fontWeight:700,marginBottom:"8px",textTransform:"uppercase",color:"#000"}},e.title),t.createElement("p",{className:"yt-loyalty-page-ways-to-earn-subtitle",style:{fontSize:"12px",color:"#666"}},e.subtitle))))),"show"===E&&t.createElement("div",{className:"yt-loyalty-page-custom-section",style:{padding:"60px 20px",borderTop:"1px solid #eee"}},t.createElement("div",{className:"yt-loyalty-page-custom-section-container",style:{maxWidth:"1200px",margin:"0 auto",display:"flex",flexDirection:te?"column":"row",alignItems:"center",gap:"40px",borderRadius:v,overflow:"hidden",backgroundColor:"#F9F9F9"}},t.createElement("div",{className:"yt-loyalty-page-custom-section-image-wrapper",style:{flex:1,width:"100%",order:te||"left"===T?0:1}},t.createElement("div",{className:"yt-loyalty-page-custom-section-image",style:{display:"flex",width:"100%",height:"300px",backgroundColor:"#ddd",backgroundImage:I?`url(${ne(I)})`:r?`url(${ne(r)})`:void 0,backgroundSize:"cover",backgroundPosition:"center"}})),t.createElement("div",{className:"yt-loyalty-page-custom-section-content",style:{flex:1,padding:"40px",textAlign:te?"center":D,order:te||"left"===T?1:0}},t.createElement("h2",{className:"yt-loyalty-page-custom-section-title",style:{fontSize:z,fontWeight:700,marginBottom:"16px",color:_}},$),t.createElement("p",{className:"yt-loyalty-page-custom-section-subtitle",style:{fontSize:N,color:P,marginBottom:"24px",lineHeight:1.6,whiteSpace:"pre-line"}},B)))),"show"===S&&t.createElement("div",{className:"yt-loyalty-page-footer",style:{padding:"60px 20px",backgroundColor:"#fff"}},t.createElement("div",{className:"yt-loyalty-page-footer-container",style:{maxWidth:"1200px",margin:"0 auto"}},t.createElement("div",{className:"yt-loyalty-page-footer-custom-text",style:{backgroundColor:y,color:"#fff",padding:"16px",textAlign:"center",fontSize:"12px",fontStyle:"italic",borderRadius:"4px"}},U),t.createElement("div",{className:"yt-loyalty-page-footer-signup",style:{display:"flex",flexDirection:te?"column":"row",justifyContent:"space-between",alignItems:"center",marginTop:"40px",padding:"20px",border:"1px solid #eee",borderRadius:"4px",gap:"20px",textAlign:te?"center":"left"}},t.createElement("div",{className:"yt-loyalty-page-footer-signup-content"},t.createElement("h3",{style:{fontSize:"20px",fontWeight:700,marginBottom:"4px",color:"#000"}},"Rewards Program"),t.createElement("p",{style:{fontSize:"14px",color:"#666"}},G)),t.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")))))},$x=({showPopup:e,selectedOffer:n,selectedOfferTerms:r,onClose:o,offersConfig:a})=>{if(!e||!n||!r)return null;const i=t.createElement("div",{className:"yt-product-offers-isolated",style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2147483647},onClick:o},t.createElement("div",{style:{width:"90vw",minWidth:"375px",maxWidth:"480px",maxHeight:"90vh",backgroundColor:"#fff",borderRadius:"12px",padding:"16px",boxShadow:"0 4px 15px rgba(0,0,0,0.3)",position:"relative",flexDirection:"column",display:"flex"},onClick:e=>e.stopPropagation()},t.createElement("img",{src:"https://feature-products-offers.shopify-product-blocks.pages.dev/assets/confetti.jpg",alt:"confetti",style:{width:"100%",height:"clamp(150px, 20vh, 230px)",objectFit:"cover",objectPosition:"top",borderTopLeftRadius:"12px",borderTopRightRadius:"12px",marginBottom:"10px",flexShrink:0}}),t.createElement("div",{style:{fontSize:"clamp(32px, 8vw, 40px)",color:"#4C4C4C",marginTop:"clamp(-150px, -20vh, -200px)",marginBottom:"8px",display:"flex",justifyContent:"center",position:"relative"}},t.createElement(G,null)),t.createElement("div",{style:{fontSize:"clamp(16px, 4vw, 20px)",fontWeight:500,color:"#4C4C4C",lineHeight:"normal",textAlign:"center"}},n.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")),t.createElement("div",{style:{fontSize:"clamp(28px, 7vw, 40px)",fontWeight:"600",color:a?.textColor||"#EE8E35",lineHeight:"normal",textAlign:"center"}},n.name),t.createElement("div",{style:{fontSize:"clamp(16px, 4vw, 20px)",color:"#000000",textAlign:"center",fontWeight:500}},r.offerMessage),t.createElement("hr",{style:{border:"none",height:"2px",width:"100%",margin:"10px 0 18px 0",backgroundColor:"transparent",backgroundImage:"repeating-linear-gradient(to right, #ccc 0, #ccc 12px, transparent 12px, transparent 20px)",backgroundSize:"100% 2px",backgroundPosition:"0 0",backgroundRepeat:"repeat-x"}}),t.createElement("div",{style:{marginTop:"15px",fontSize:"clamp(14px, 3.5vw, 16px)",textAlign:"center",display:"flex",flexDirection:"column"}},t.createElement("strong",{style:{color:"#888"}},"Terms & Conditions"),t.createElement("ul",{style:{marginTop:"5px",paddingLeft:"20px",textAlign:"left",display:"inline-block",color:"#000",lineHeight:"1.3",marginBottom:"0"}},r.terms.map((e,n)=>t.createElement("li",{key:n,style:{marginBottom:"4px"}},e)))),t.createElement("button",{onClick:o,style:{width:"100%",padding:"10px 20px",marginTop:"10px",backgroundColor:"#fff",border:"none",borderTop:"1px solid #ddd",borderRadius:"0",fontSize:"16px",fontWeight:"600",color:"#333",cursor:"pointer",textAlign:"center",flexShrink:0}},"Close")));return w(i,document.body)},Bx=({showPopup:e,selectedOffer:n,selectedOfferTerms:r,onClose:o,offersConfig:a})=>{if(!e||!n||!r)return null;const i=t.createElement("div",{className:"yt-product-offers-isolated",style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"flex-end",justifyContent:"center",zIndex:2147483647,animation:"fadeIn 0.3s ease"},onClick:o},t.createElement("style",null,"\n @keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n @keyframes slideUp {\n from { transform: translateY(100%); }\n to { transform: translateY(0); }\n }\n "),t.createElement("div",{style:{width:"100%",maxHeight:"85vh",backgroundColor:"#fff",borderTopLeftRadius:"20px",borderTopRightRadius:"20px",borderTop:"1px solid #E5E5E5",position:"relative",flexDirection:"column",display:"flex",animation:"slideUp 0.3s ease",overflow:"hidden"},onClick:e=>e.stopPropagation()},t.createElement("div",{style:{width:"40px",height:"4px",backgroundColor:"#ddd",borderRadius:"2px",margin:"12px auto 16px",flexShrink:0}}),t.createElement("div",{style:{overflowY:"auto",flex:1}},t.createElement("div",{style:{padding:"0 20px 20px",backgroundColor:"#fff"}},t.createElement("div",{style:{fontSize:"48px",color:"#4C4C4C",display:"flex",justifyContent:"center",margin:"16px"}},t.createElement(G,null)),t.createElement("div",{style:{fontSize:"14px",fontWeight:500,color:"#888",textAlign:"center"}},n.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")),t.createElement("div",{style:{fontSize:"32px",fontWeight:"700",color:a?.textColor||"#EE8E35",textAlign:"center",lineHeight:"1.2"}},n.name),t.createElement("div",{style:{fontSize:"18px",color:"#000000",textAlign:"center",fontWeight:500}},r.offerMessage)),t.createElement("div",{style:{backgroundColor:"#F5F5F5",padding:"16px 20px"}},t.createElement("div",{style:{fontSize:"16px",fontWeight:"600",color:"#333",textAlign:"center"}},"Terms & Conditions")),t.createElement("div",{style:{padding:"20px",backgroundColor:"#fff"}},t.createElement("ul",{style:{margin:"0",paddingLeft:"20px",color:"#333",lineHeight:"1.6",fontSize:"14px"}},r.terms.map((e,n)=>t.createElement("li",{key:n,style:{marginBottom:"4px"}},e))))),t.createElement("button",{onClick:o,style:{width:"100%",padding:"18px 20px",backgroundColor:"#F5F5F5",border:"none",borderTop:"1px solid #E5E5E5",fontSize:"16px",fontWeight:"600",color:"#333",cursor:"pointer",textAlign:"center",fontFamily:"'Poppins', sans-serif",flexShrink:0}},"Close")));return w(i,document.body)},zx=({offersToShow:e,offersConfig:n,getOfferCardMessage:r,setSelectedOffer:a,setShowPopup:i})=>{const s=o(null),[d,p]=c(!1),[u,m]=c(!0),[f,g]=c("undefined"!=typeof window&&window.innerWidth<=768),h=()=>{if(s.current){const{scrollLeft:e,scrollWidth:t,clientWidth:n}=s.current;p(e>0),m(e<t-n-10)}};l(()=>{h();const e=s.current;if(e)return e.addEventListener("scroll",h),()=>e.removeEventListener("scroll",h)},[e]),l(()=>{const e=()=>{g(window.innerWidth<=768)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const x=e=>{if(s.current){const t=f?280:365,n=16,r="right"===e?t+n:-(t+n);s.current.scrollBy({left:r,behavior:"smooth"})}};return t.createElement("div",{style:{position:"relative"}},t.createElement("svg",{style:{position:"absolute",width:0,height:0}},t.createElement("defs",null,t.createElement("mask",{id:"coupon-cut-mask-desktop"},t.createElement("rect",{width:"365",height:"138",fill:"white"}),t.createElement("circle",{cx:"80",cy:"0",r:"12",fill:"black"}),t.createElement("circle",{cx:"80",cy:"138",r:"12",fill:"black"})),t.createElement("mask",{id:"coupon-cut-mask-mobile"},t.createElement("rect",{width:"280",height:"120",fill:"white"}),t.createElement("circle",{cx:"60",cy:"0",r:"10",fill:"black"}),t.createElement("circle",{cx:"60",cy:"120",r:"10",fill:"black"})))),d&&t.createElement("button",{onClick:()=>x("left"),style:{position:"absolute",left:"5px",top:"50%",transform:"translateY(-50%)",background:"#fff",border:"1px solid #e0e0e0",borderRadius:"50%",width:"clamp(28px, 5vw, 38px)",height:"clamp(28px, 5vw, 38px)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)",color:"#333"}},t.createElement(M,{size:20})),u&&t.createElement("button",{onClick:()=>x("right"),style:{position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",background:"#fff",border:"1px solid #e0e0e0",borderRadius:"50%",width:"clamp(28px, 5vw, 38px)",height:"clamp(28px, 5vw, 38px)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)",color:"#333"}},t.createElement(j,{size:20})),t.createElement("div",{ref:s,className:"hide-scrollbar",style:{display:"flex",alignItems:"stretch",overflowX:"auto",gap:"16px",scrollbarWidth:"none",msOverflowStyle:"none",minHeight:f?"110px":"128px"}},e?.map(e=>t.createElement("div",{key:e.discountId,style:{flexShrink:0,width:f?"280px":"365px",minWidth:f?"280px":"365px",minHeight:f?"110px":"128px",backgroundColor:"transparent",borderRadius:`${n?.roundness||0}px`,border:"1px solid #e0e0e0",display:"flex",position:"relative",overflow:"visible",mask:`url(#${f?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,WebkitMask:`url(#${f?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,maskImage:`url(#${f?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,WebkitMaskImage:`url(#${f?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`}},t.createElement("div",{style:{width:f?"60px":"80px",minHeight:f?"110px":"128px",backgroundColor:n?.accentColor||"#EE8E35",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:f?"10px 6px":"12px 8px",position:"relative",borderTopLeftRadius:`${n?.roundness||0}px`,borderBottomLeftRadius:`${n?.roundness||0}px`}},t.createElement("div",{style:{position:"absolute",right:"-2px",top:"12px",bottom:"12px",width:"2px",borderLeft:"2px dashed #FFFFFF"}})),n?.iconVisibility&&t.createElement("div",{style:{position:"absolute",left:f?"42.5px":"57.5px",top:"35%",transform:"translateY(-50%)",width:f?"32px":"40px",height:f?"32px":"40px",backgroundColor:"#FFFFFF",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:f?"16px":"20px",color:"#333333",zIndex:10,boxShadow:"0 2px 5px rgba(0,0,0,0.1)",border:"1px solid #E0E0E0"}},"free_product"===e.couponType?t.createElement(U,null):t.createElement(Ao,null)),t.createElement("div",{style:{flex:1,padding:f?"12px 12px":"15px 15px",paddingLeft:f?"25px":"35px",display:"flex",flexDirection:"column",justifyContent:"space-between",borderTopRightRadius:`${n?.roundness||0}px`,borderBottomRightRadius:`${n?.roundness||0}px`,overflow:"hidden",backgroundColor:n?.cardBackgroundColor||"#ffffff",minWidth:0}},t.createElement("div",{style:{display:"flex",flexDirection:"column",gap:f?"4px":"6px",lineHeight:"normal"}},t.createElement("div",{style:{fontSize:f?"9px":"10px",color:"#666666",fontWeight:"400"}},"free_product"===e.couponType?"Free Gift":"Special Deal"),t.createElement("div",{style:{fontSize:f?"13px":"15px",fontWeight:"600",color:n?.textColor||"#2c3e50"}},e.name),t.createElement("div",{style:{fontSize:f?"11px":"12px",color:n?.accentColor||"#EE8E35",wordWrap:"break-word",overflowWrap:"break-word",whiteSpace:"normal",minHeight:f?"28px":"32px"}},r(e))),t.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},t.createElement("div",{style:{borderTop:"1px solid #999999",marginTop:"4px",width:"100%",height:"0",display:"block"}}),t.createElement("a",{href:"#",onClick:t=>{t.preventDefault(),a(e),i(!0)},style:{fontSize:f?"11px":"12px",color:"#2c3e50",fontWeight:"500",textDecoration:"none",cursor:"pointer",textAlign:"center",marginTop:"0"}},n?.viewDetailsTitle||"View Details")))))),t.createElement("style",null,"\n .hide-scrollbar::-webkit-scrollbar {\n display: none;\n }\n .hide-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n "))},Nx=({offersToShow:e,offersConfig:n,getOfferCardMessage:r,setSelectedOffer:o,setShowPopup:a})=>{const[i,s]=c("undefined"!=typeof window&&window.innerWidth<=768);return l(()=>{const e=()=>{s(window.innerWidth<=768)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),t.createElement("div",{style:{borderRadius:`${n?.roundness||8}px`}},e?.map((l,c)=>t.createElement("div",{key:l.discountId,style:{display:"flex",alignItems:"flex-start",gap:i?"8px":"12px",padding:i?"12px 0":"16px 0",paddingLeft:i?"10px":"20px",backgroundColor:!0===n?.cardBackgroundTransparent||"true"===String(n?.cardBackgroundTransparent)?"transparent":n?.cardBackgroundColor||"#ffffff",borderBottom:c<(e?.length||0)-1?"1px solid rgb(225 218 218)":"none",marginBottom:"4px",borderRadius:`${n?.roundness||0}px`}},n?.iconVisibility&&t.createElement("div",{style:{width:i?"40px":"50px",height:i?"40px":"50px",backgroundColor:"#f8f9fa",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:i?"20px":"25px",marginTop:i?"5px":"10px",border:"2px solid #4a4a4a",color:"#4a4a4a"}},"free_product"===l.couponType?t.createElement(U,null):t.createElement(Ao,null)),t.createElement("div",{style:{flex:1}},t.createElement("div",{style:{fontSize:i?"14px":"15px",fontWeight:600,color:"#000000",lineHeight:"1"}},l.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "),":"," ",t.createElement("span",{style:{fontWeight:600,color:n?.textColor||"#34495e"}},l.name)),t.createElement("div",{style:{fontSize:i?"12px":"13px",color:"#7f8c8d",marginBottom:"6px"}},r(l)),t.createElement("div",{style:{fontSize:i?"11px":"12px",color:"#000000"}},"offer auto applied",t.createElement("a",{href:"#",onClick:e=>{e.preventDefault(),o(l),a(!0)},style:{color:n?.accentColor||"#7f8c8d",fontWeight:700,textDecoration:"none",marginLeft:"2px"}},n?.viewDetailsTitle||"T&C"))))))},Ix=e=>{const t="free_product"===e.couponType;let n="";t?n="Get this product for free!":e.discountPercentage?n=`Get ${e.discountPercentage}% off`:e.discountValue&&(n=`Get ${e.discountValue} off`);const r=["Limited Time Offer","Applies automatically when criteria is met"];return"quantity"===e.customCartProgressBarCriteria&&e.quantityThreshold?r.push(`Unlock when you add ${e.quantityThreshold} ${e.quantityThreshold>1?"items":"item"} to cart`):"minimum_order_value"===e.customCartProgressBarCriteria&&e.minimumOrderValue&&r.push(`Unlock at order value of ${e.minimumOrderValue}`),t&&r.push("Combines with other order discounts"),t||r.push("Not applicable if other offer with higher discount applied on same product"),{offerMessage:n,terms:r}},Dx=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",_x=({offersConfig:e,offers:n})=>{const[r,a]=c(!1),[i,s]=c(null),[d,p]=c(null),[u,m]=c("undefined"!=typeof window&&window.innerWidth<=768),[f,g]=c("undefined"!=typeof window&&window.innerWidth<=450),h=o(null);l(()=>{const e=()=>{m(window.innerWidth<=768),g(window.innerWidth<=450)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),l(()=>{h.current&&Xn(h.current)},[e?.sectionBgContrastColor]);const x=(e=>{if(!e||0===e.length)return e;const t={};e.forEach(e=>{const n=e.customCartProgressBarCriteria||"none";t[n]=(t[n]||0)+1});let n="none",r=-1;Object.keys(t).forEach(e=>{t[e]>r&&(r=t[e],n=e)});const o=e.map((e,t)=>({o:e,idx:t})),a=e=>"minimum_order_value"===n?void 0!==e.minimumOrderValue&&null!==e.minimumOrderValue?Number(e.minimumOrderValue):1/0:"quantity"===n&&void 0!==e.quantityThreshold&&null!==e.quantityThreshold?Number(e.quantityThreshold):1/0;return o.sort((e,t)=>{const r=e.o.customCartProgressBarCriteria===n,o=t.o.customCartProgressBarCriteria===n;if(r&&o){const n=a(e.o),r=a(t.o);return n!==r?n-r:e.idx-t.idx}return r&&!o?-1:!r&&o?1:e.idx-t.idx}),o.map(e=>e.o)})(n||[]);return t.createElement("div",null,t.createElement("div",{style:{position:"relative",width:"100%",maxWidth:"450px",borderRadius:"list"===e?.sectionType?`${e?.roundness||0}px`:"0px",boxSizing:"border-box",backgroundColor:e?.sectionBackgroundColor||"#fff"}},t.createElement("div",{style:{border:"coupon"===e?.sectionType?"none":"1px solid rgb(169, 163, 163)",borderTop:"1px solid rgb(169, 163, 163)",padding:null!=e?.cardPadding?`${e.cardPadding}px`:u?"20px 10px 15px":"30px 15px 20px",position:"relative",borderRadius:"list"===e?.sectionType?`${e?.roundness||8}px`:"0px"}},t.createElement("span",{ref:h,className:"yt-product-offers-section-title",style:{position:"absolute",top:"0",left:"left"===e?.alignment?"coupon"===e?.sectionType?"0px":u?"10px":"20px":"right"===e?.alignment?"auto":"50%",right:"right"===e?.alignment?"coupon"===e?.sectionType?"0px":u?"10px":"20px":"auto",transform:"middle"===e?.alignment?"translateX(-50%) translateY(-50%)":"translateY(-50%)",background:e?.sectionBgContrastColor||"#fff",padding:u?"0 8px":"0 10px",fontWeight:"500",fontSize:u?"14px":"16px",textTransform:"uppercase",textAlign:"center"}},e?.sectionTitle||"Available Deals and Offers"),(()=>{const n=e?.sectionType;return"list"===n?t.createElement(Nx,{offersToShow:x,offersConfig:e||{},getOfferCardMessage:Dx,setSelectedOffer:e=>{s(e),e&&p(Ix(e))},setShowPopup:a}):"coupon"===n?t.createElement(zx,{offersToShow:x,offersConfig:e||{},getOfferCardMessage:Dx,setSelectedOffer:e=>{s(e),e&&p(Ix(e))},setShowPopup:a}):null})(),f?t.createElement(Bx,{selectedOffer:i,selectedOfferTerms:d,showPopup:r,offersConfig:e,onClose:()=>{a(!1),s(null),p(null)}}):t.createElement($x,{selectedOffer:i,selectedOfferTerms:d,showPopup:r,offersConfig:e,onClose:()=>{a(!1),s(null),p(null)}}))))};export{Ex as Bundle,Sx as BundleLoader,Hu as Cart,Fa as CouponFrame,Tx as LoyaltyPageBlock,lt as Nudge,_x as ProductOffers,ft as SpinnerWheel};
|
|
5084
|
+
`,lx=({productsWithIndices:e,isOpen:n,onClose:r,cta:o,variantOptions:a,onVariantChange:s,handleAddToCart:d,primaryProductId:p,variantId:u})=>{const m=i(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?1/0:0:1/0:0},[]),[f,g]=c({}),[h,x]=c({});l(()=>{const t={},n={};e?.forEach(({product:e,index:r})=>{let o,a=[];if(e.productId===p&&u){const t=e?.productDetails?.variants?.edges.find(e=>e?.node?.id?.includes(u))?.node;t&&m(e.productDetails,t.id)>0&&(a=t.title.split(" / "),o=t)}if(!a.length){const t=e.productDetails.variants.edges.find(t=>m(e.productDetails,t?.node?.id)>0)?.node||e?.productDetails?.variants?.edges?.[0]?.node;t?(a=t.title.split(" / "),o=t):a=e?.productDetails?.options?.map(e=>e.values[0]??"")}t[r]=a,o&&(n[r]={node:o},s(r,o.id))}),g(t),x(n)},[e,p,u,s,m]),l(()=>{if(!p||!u)return;const t=e?.find(({product:e})=>e?.productId===p);if(!t)return;const{product:n,index:r}=t,o=n?.productDetails?.variants?.edges?.find(e=>e.node.id.includes(u))?.node;if(o&&m(n.productDetails,o.id)>0){const e=o.title.split(" / ");g(t=>({...t,[r]:e})),x(e=>({...e,[r]:{node:o}})),s(r,o.id)}},[u,p,e,s,m]);const y=(e,t,n,r)=>{const o=[...f[e]||[]];o[t]=n;const a=o.join(" / "),i=r.productDetails.variants.edges.find(e=>e.node.title===a)?.node;return!!i&&m(r.productDetails,i.id)>0},b=(t,n,r)=>{const{product:o}=e?.find(e=>e.index===t)||{product:{productDetails:{variants:{edges:[]}}}};if(!o?.productDetails)return;if(!y(t,r,n,o))return;const a={...f};a[t][r]=n,g(a);const i=o?.productDetails?.variants?.edges?.find(e=>e.node.title===a[t].join(" / "))?.node;i&&(s(t,i.id),x(e=>({...e,[t]:{node:i}})))};if(!n)return null;const w=t.createElement(Uh,{className:"yt-fixedBundle-variant-modal_overlay",onClick:r},t.createElement(Gh,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},t.createElement(Qh,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:o.backgroundColor,color:o.textColor}},"Select Options"),e?.map(({product:n,index:r},o)=>t.createElement(t.Fragment,null,t.createElement(Zh,{className:"yt-fixedBundle-variant-modal_product-block"},t.createElement(Xh,{className:"yt-fixedBundle-variant-modal_thumbnail",src:h[r]?.node?.image?.url||n.productDetails.featuredMedia?.preview?.image?.url,alt:n.productDetails.title}),t.createElement(Kh,{className:"yt-fixedBundle-variant-modal_product-info"},t.createElement(Jh,{className:"yt-fixedBundle-variant-modal_product-name"},n.productDetails.title,n.productDetails.variants.edges.length>1&&t.createElement(tx,{className:"yt-fixedBundle-variant-modal_selected-value"},f[r]?.join(" / "))),n.productDetails.options.map((e,o)=>{const i=a&&a?.options?.find(t=>t.name===e.name);return e.values.length<=1?t.createElement(t.Fragment,null):i&&"color"===i?.type?t.createElement(nx,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(ix,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map((e,a)=>{const l=!y(r,o,e,n);return t.createElement(t.Fragment,null,i.values.find(t=>t.name===e)?.value?t.createElement(rx,{className:"yt-fixedBundle-variant-modal_color-swatch",key:a,color:i.values.find(t=>t.name===e)?.value||e,selected:f[r]?.[o]==e,disabled:l,onClick:()=>{b(r,e,o)}},t.createElement("span",null)):t.createElement(ox,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:f[r]?.[o]==e,disabled:l,onClick:()=>{b(r,e,o)}},e))})):i&&"image"===i?.type?t.createElement(nx,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(ix,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map((e,a)=>{const l=!y(r,o,e,n);return t.createElement(t.Fragment,null,i?.values.find(t=>t.name===e)?.value?t.createElement(ax,{className:"yt-fixedBundle-variant-modal_image-swatch",key:a,selected:f[r]?.[o]==e,disabled:l,onClick:()=>{b(r,e,o)},src:i.values.find(t=>t.name===e)?.value},t.createElement("span",null)):t.createElement(ox,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:f[r]?.[o]==e,disabled:l,onClick:()=>{b(r,e,o)}},e))})):t.createElement(nx,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(ix,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map((e,a)=>{const i=!y(r,o,e,n);return t.createElement(ox,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:f[r]?.[o]==e,disabled:i,onClick:()=>{b(r,e,o)}},e)}))}))),o<e.length-1&&t.createElement(ex,{className:"yt-fixedBundle-variant-modal_divider"}))),t.createElement(Yh,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:o.backgroundColor,color:o.textColor},onClick:d},"Add bundle to cart")));return v.createPortal(w,document.body)},cx=({options:e,selectedValue:n,onChange:r,type:a="text"})=>{const[i,s]=c(!1),d=o(null);l(()=>{const e=e=>{d.current&&!d.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const p=e=>"color"===a?t.createElement(Oh,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:e.value},t.createElement("span",null)):"image"===a?t.createElement(Mh,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:e.value||"/placeholder.svg",alt:e.name},t.createElement("span",null)):null;return t.createElement(Nh,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:d},t.createElement(Ih,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>s(!i)},t.createElement(Dh,{className:"yt-fixedBundle-variant-dropdown-horizontal_content"},n&&("color"===a||"image"===a)&&p(n),t.createElement("span",{className:"yt-fixedBundle-variant-dropdown-horizontal_selected-text"},n&&n.name)),t.createElement(_h,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:i})),i&&t.createElement(Ph,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},e?.map(e=>t.createElement(Ah,{className:"yt-fixedBundle-variant-selector_dropdown-item "+(n?.name===e.name?"yt-fixedBundle-variant-selector_dropdown-item--selected":""),key:e.name,$isSelected:n?.name===e.name,onClick:()=>{r(e),s(!1)}},("color"===a||"image"===a)&&p(e),t.createElement(Fh,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},e.name)))))},sx=({product:e,variantOptions:n,selectedVariants:r,onVariantChange:o,variantId:a,primaryProductId:i,variantType:s="dropdown"})=>{const[d,p]=c(r||[]);l(()=>{if(a&&e.variants.edges.some(e=>e.node.id.includes(a))){const t=e.variants.edges.find(e=>e.node.id.includes(a))?.node;if(t){const e=t.title.split(" / ");p(e)}}},[a,e]);const u=e=>{if(!n?.options)return"text";const t=n.options.find(t=>t.name===e);return t?.type||"text"},m=(e,t)=>{if(!n?.options)return e.values.map(e=>({name:e,value:e}));const r=n.options.find(t=>t.name===e.name);return e.values.map(e=>{const t=r?.values?.find(t=>t.name===e);return{name:e,value:t?.value||e}})},f=(e,t)=>{const n=d[t];if(!n)return null;return m(e).find(e=>e.name===n)||null};return t.createElement(Rh,{className:"yt-fixedBundle-variant-selector-horizontal_container"},e.options.map((n,r)=>t.createElement(Lh,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:n.name,$isFirst:0===r},n?.values?.length>1&&t.createElement(cx,{options:m(n),selectedValue:f(n,r),onChange:t=>{console.log(t),((t,n)=>{const r=[...d];r[t]=n.name,p(r);const a=e.variants.edges.find(n=>n.node.title===(e.options?.length>0?r.join(" / "):r[t]))?.node.id;o(a||"")})(r,t)},type:u(n.name)}))))},dx=({product:e,selectedVariantId:n,isChecked:r,canCustomize:o,styles:a,onVariantChange:s,onCheckChange:d,isMobile:p,isHorizontal:u,index:m,variantOptions:f,productsLength:g,handleOpenModal:h,storeCurrencyCode:x,primaryProductId:y,variantId:b})=>{const v=i(()=>t=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?1/0:0:1/0:0},[e]),[w,C]=c(e?.variants?.edges.find(e=>v(e?.node?.id)>0)?.node||e?.variants?.edges?.[0]?.node),[k]=c(e?.options?.map(e=>e?.values?.[0])||[]),E=e?.id===y;l(()=>{if(b&&e.id===y){const t=e?.variants?.edges?.find(e=>e?.node?.id?.includes(b))?.node;t&&v(t.id)>0&&(C(t),s(t.id))}else{const t=e?.variants?.edges?.find(e=>v(e?.node?.id)>0)?.node||e?.variants?.edges?.[0]?.node;C(t)}},[e,y,n,b,s,v]);const S="undefined"!=typeof window&&"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain||"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,T=w?.image?.url||e.featuredMedia?.preview?.image?.url;return t.createElement(t.Fragment,null,u?t.createElement("div",{className:""+(e.id===y?"yt-fixedBundle-product-card--horizontal-primary":"yt-fixedBundle-product-card--horizontal-associated"),style:{display:"flex",alignItems:"center",gap:"10px",backgroundColor:a.fixedBundle?.cardBackgroundColor}},o&&t.createElement(Hh,{className:"yt-fixedBundle-product-card_checkbox-wrapper--horizontal"},t.createElement(Vh,{className:"yt-fixedBundle-product-card_checkbox-hidden",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}-${m}`,defaultChecked:r,onChange:e=>d(e.target.checked),disabled:E}),t.createElement(Wh,{className:"yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${e.id}-${m}`,isChecked:r,borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.general?.ctaBackgroundColor},t.createElement(yt,null))),t.createElement(nh,{className:"yt-fixedBundle-product-card-horizontal_item",style:{borderRadius:a.fixedBundle?.borderRadius,border:`1px solid ${a.fixedBundle?.borderColor}80`,backgroundColor:a.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`8px 8px 8px -6px ${a.fixedBundle.borderColor}`,"no-spread":`4px 4px 0px -1px ${a.fixedBundle.borderColor}80`}[a.fixedBundle.shadowType]||"none"},canCustomize:o},"undefined"!=typeof window&&"devansh-test123.myshopify.com"!==window.ytBundleApp?.storeDomain&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&t.createElement(rh,{className:"yt-fixedBundle-product-card-horizontal_image",src:Cx(T),alt:e.title,style:{borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,aspectRatio:a.general.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),t.createElement(oh,{className:"yt-fixedBundle-product-card-horizontal_details"},t.createElement(ah,{className:"yt-fixedBundle-product-card-horizontal_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement(ih,{className:"yt-fixedBundle-product-card-horizontal_price-section"},t.createElement(lh,{className:"yt-fixedBundle-product-card-horizontal_price--new"},wx(a.general.currencySymbol,x)," ",vx(w?.price)),a.fixedBundle.compareAtPriceVisibility&&w?.compareAtPrice&&parseFloat(w.compareAtPrice)>parseFloat(w?.price)&&t.createElement(ch,{className:"yt-fixedBundle-product-card-horizontal_price--old"},wx(a.general.currencySymbol,x),vx(w?.compareAtPrice))),t.createElement(sx,{product:e,variantOptions:f,selectedVariants:k,onVariantChange:t=>{const n=e?.variants?.edges?.find(e=>e.node.id===t)?.node;n&&v(t)>0&&s(t)},variantId:b,primaryProductId:y})))):t.createElement(t.Fragment,null,t.createElement(xh,{className:""+(e.id===y?"yt-fixedBundle-product-card--vertical-primary":"yt-fixedBundle-product-card--vertical-associated"),productsLength:g,style:{borderRadius:a.fixedBundle?.borderRadius,border:`1px solid ${a.fixedBundle?.borderColor}50`,backgroundColor:a.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`0 4px 10px -6px ${a.fixedBundle.borderColor}50`,"no-spread":`4px 4px 0px -1px ${a.fixedBundle.borderColor}50`}[a.fixedBundle.shadowType]||"none",...o&&{position:"relative"},...S&&{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",minWidth:"max-content",paddingLeft:"2px"}},borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.fixedBundle?.cardBackgroundColor},o&&t.createElement(qh,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:S},t.createElement(Vh,{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}-${m}`,defaultChecked:r,onChange:e=>d(e.target.checked),disabled:E}),t.createElement(Wh,{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${e.id}-${m}`,isChecked:r,borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.general?.ctaBackgroundColor},t.createElement(yt,{size:10}))),"undefined"!=typeof window&&"devansh-test123.myshopify.com"!==window.ytBundleApp?.storeDomain&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&t.createElement(yh,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:a.general.imageAspectRatio,height:"fit-content"}},t.createElement(bh,{className:"yt-fixedBundle-product-card_image--vertical",src:Cx(T),style:{aspectRatio:a.general.imageAspectRatio},alt:e.title}),e.variants.edges.length>1&&t.createElement(vh,{className:"yt-fixedBundle-product-card_badge-container"},t.createElement(wh,{className:"yt-fixedBundle-product-card_circle-button"},t.createElement("span",null)),t.createElement(Ch,{className:"yt-fixedBundle-product-card_circle-button-two"},t.createElement("span",null)),t.createElement(kh,{className:"yt-fixedBundle-product-card_count-badge"},e.variants.edges.length,"+"))),t.createElement(Eh,{className:"yt-fixedBundle-product-card-vertical_info"},t.createElement(Sh,{className:"yt-fixedBundle-product-card-vertical_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement($h,{className:"yt-fixedBundle-product-card-vertical_price-line"},t.createElement(Th,{className:"yt-fixedBundle-product-card-vertical_price--new"},wx(a.general.currencySymbol,x),vx(w?.price)),a.fixedBundle.compareAtPriceVisibility&&w?.compareAtPrice&&parseFloat(w.compareAtPrice)>parseFloat(w?.price)&&t.createElement(ch,{className:"yt-fixedBundle-product-card-vertical_price--old"},wx(a.general.currencySymbol,x),vx(w.compareAtPrice))))),(g<=3||!p)&&m<g-1&&t.createElement(Bh,{className:"yt-fixedBundle-plus-wrapper"}," ",t.createElement(zh,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},px=({bundle:e,addToCartFunction:n})=>{const[r,o]=c(!1),[s,d]=c(window.innerWidth<786),[p,u]=c(null),[m,f]=c(!1),g="undefined"!=typeof window?window.location.href:null,h=e?.products?.find(e=>e.productDetails?.handle===g?.split("/").pop()?.split("?")[0]),x=h?.productId,y=i(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?1/0:0:1/0:0},[]),[b,v]=c(Object.fromEntries(e?.products?.map((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find(t=>y(e.productDetails,t?.node?.id)>0)?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id]))),w="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain),C=e?.showIndividualProductSelector||!0,[k,E]=c(new Set(e.products.reduce((e,t,n)=>(w&&t?.productId!==x&&!C||e.push(n),e),[])));l(()=>{const e=()=>{const e=new URL(window.location.href).searchParams.get("variant");u(e)},t=e=>{const t=history[e];return function(...n){const r=t.apply(this,n);return window.dispatchEvent(new Event(e.toLowerCase())),r}};return history.pushState=t("pushState"),history.replaceState=t("replaceState"),window.addEventListener("pushstate",e),window.addEventListener("replacestate",e),e(),()=>{window.removeEventListener("pushstate",e),window.removeEventListener("replacestate",e)}},[]),l(()=>{p&&x&&v(t=>{const n={...t};return e?.products?.forEach((e,t)=>{e.productId===x&&(n[t.toString()]=p)}),n})},[p,x,e?.products]),l(()=>{const e=()=>{d(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const S=a((e,t)=>{v(n=>({...n,[e.toString()]:t}))},[]),T=(t,n)=>{const r=e.products[n].productId;w&&C&&r===x||E(e=>{const r=new Set(e);return t?r.add(n):r.delete(n),r})},$=i(()=>(e,t)=>y(e.productDetails,t)>0,[y]),B=i(()=>e.products.some((e,t)=>k.has(t)&&e.productDetails.variants.edges.length>1),[e.products,k]),{originalPrice:z,dealPrice:N,offerValue:I}=i(()=>{const{price:t,compareAtPrice:n}=e.products.reduce((e,t,n)=>{if(!k.has(n))return e;const r=b[n.toString()];if(!r)return e;const o=t.productDetails.variants.edges?.find(e=>e.node.id===r)?.node;if(!o)return e;const a=parseFloat(o?.price??"0"),i=parseFloat(o?.compareAtPrice||a.toString());return e.price+=a,e.compareAtPrice+=i,e},{price:0,compareAtPrice:0}),r=Math.max(t,n);let o=Math.min(t,n);k.size===e.products.length&&(e?.percentageOff?o=t*(1-e.percentageOff/100):e?.dealAmount?o=e.dealAmount:e?.amountOff&&(o=t-e.amountOff));const a=n-o;return{originalPrice:r.toFixed(2),dealPrice:o.toFixed(2),offerValue:a.toFixed(2)}},[e.products,b,k,e.percentageOff,e.dealAmount,e.amountOff]),D=i(()=>e.products.map((e,t)=>({product:e,index:t})).filter(({index:e})=>k.has(e)),[e.products,k]),_=D.every(({product:e,index:t})=>$(e,b[t.toString()])),P=async e=>{if(_){e.preventDefault(),e.stopPropagation(),o(!0),f(!1);try{const e=Object.entries(b).map(([e,t])=>{const n=parseInt(e);return isNaN(n)||!k.has(n)?null:t}).filter(Boolean);n&&await n(Number(z),e)}catch(e){console.error("Error adding to cart:",e)}o(!1)}};if(!n)return t.createElement(t.Fragment,null);const A=e.customizations,F=A.fixedBundle?.cardLayoutStyle||"auto",O="horizontal"===F||"auto"===F&&s,M="bundles"==e.appName?e.pageHeader?.title:e?.title,R="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return t.createElement(Kg,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:A.fixedBundle.sectionBackgroundColor,..."transparent"!==A.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},M&&t.createElement(Jg,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:A.fixedBundle?.titleBackgroundColor||"none",color:A.fixedBundle?.titleTextColor||"black",textAlign:A.fixedBundle.infoAlignment??"center",fontSize:A.fixedBundle?.titleFontSize,..."transparent"!==A.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===A.fixedBundle.infoAlignment&&"transparent"!==A.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===A.fixedBundle.infoAlignment&&"transparent"!==A.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===A.fixedBundle.infoAlignment&&"transparent"===A.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},M),R&&t.createElement(eh,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:A.fixedBundle?.subtitleFontSize,textAlign:A.fixedBundle.infoAlignment??"center",..."left"===A.fixedBundle.infoAlignment&&"transparent"!==A.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===A.fixedBundle.infoAlignment&&"transparent"!==A.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===A.fixedBundle.infoAlignment&&"transparent"===A.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},R),O?t.createElement(th,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},e?.products?.map((n,r)=>t.createElement(t.Fragment,{key:`${n.productId}-${r}`},t.createElement(dx,{isChecked:k.has(r),product:n.productDetails,selectedVariantId:b[r.toString()]||"",canCustomize:e?.canCustomizeFixedBundle||!1,styles:A,onVariantChange:e=>S(r,e),onCheckChange:e=>{T(e,r)},isMobile:s,index:r,isHorizontal:O,variantOptions:e.variantOptions,productsLength:e.products.length,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:x,variantId:p||void 0})))):t.createElement(gh,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},t.createElement(hh,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===A.fixedBundle.infoAlignment?"flex-start":"right"===A.fixedBundle.infoAlignment?"flex-end":"center"}},e?.products?.map((n,r)=>t.createElement(dx,{key:`${n.productId}-${r}`,isChecked:k.has(r),product:n.productDetails,selectedVariantId:b[r.toString()]||"",canCustomize:e?.canCustomizeFixedBundle||!1,styles:A,onVariantChange:e=>S(r,e),onCheckChange:e=>T(e,r),isMobile:s,index:r,isHorizontal:O,productsLength:e.products.length,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:x,variantId:p||void 0})),B&&t.createElement(lx,{productsWithIndices:D,isOpen:m,onClose:()=>f(!1),variantOptions:e.variantOptions,cta:{textColor:A.general.ctaTextColor,backgroundColor:A.general.ctaBackgroundColor},onVariantChange:S,handleAddToCart:P,primaryProductId:x,variantId:p||void 0}))),t.createElement(sh,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===A.fixedBundle.infoAlignment?"flex-start":"right"===A.fixedBundle.infoAlignment?"flex-end":"center"}},Number(z)>0&&Number(I)>0&&A.fixedBundle.compareAtPriceVisibility&&t.createElement(dh,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",t.createElement(uh,{className:"yt-fixedBundle-summary_price"},wx(A.general.currencySymbol,e?.storeCurrencyCode),vx(z))),0!==k.size&&t.createElement(ph,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",t.createElement(uh,{className:"yt-fixedBundle-summary_price"},wx(A.general.currencySymbol,e?.storeCurrencyCode),vx(N))," ",Number(I)>0&&t.createElement(mh,{className:"yt-fixedBundle-summary_save-tag"},"Save:"," ",wx(A.general.currencySymbol,e?.storeCurrencyCode),vx(I)))),t.createElement(fh,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),O||!B?P(e):f(!0)},disabled:k.size<1||r||!_,style:{backgroundColor:A.general?.ctaBackgroundColor||"#121212",color:A.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${A.general?.ctaBackgroundColor||"#121212"}`,boxShadow:A.general.ctaShadowType,paddingTop:A.general?.ctaPadding,paddingBottom:A.general?.ctaPadding,borderRadius:A.general.ctaBorderRadius,width:A.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{A.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=A.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=A.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{A.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=A.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=A.general?.ctaTextColor||"#FFFFFF")}},r?t.createElement(Ea,{color:"white",loading:r,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):_?t.createElement(t.Fragment,null,A.fixedBundle?.ctaTitle??"Add Bundle to cart"):t.createElement(t.Fragment,null,"Out of Stock")))},ux=()=>t.createElement(t.Fragment,null,t.createElement("style",null,"@keyframes spin { to { transform: rotate(360deg); } }"),t.createElement("div",{className:"yt-collection-bundle-loader-spinner",style:{width:"14px",height:"14px",border:"2px solid #f3f3f3",borderTop:"2px solid #007bff",borderRadius:"50%",animation:"spin 1s linear infinite",display:"block"}})),mx=({product:e,tierIdx:n,isOpen:r,onClose:o,onAddToBundle:a,canAdd:i,isSelected:s,customizations:d,isMobile:p})=>{const[u,m]=c(0),[f,g]=c(e.variants[0].id.toString()),h=e.variants.find(e=>e.id.toString()===f)||e.variants[0],x=e.images.filter(Boolean);if(l(()=>(r&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=""}),[r]),l(()=>{if(h&&h?.featured_image?.src){const e=document.querySelector(".yt-collection-bundle-modal-image");e?.setAttribute("src",h?.featured_image?.src)}},[h]),!r)return null;const y=t.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:o},t.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",borderRadius:d?.borderRadius||"12px",maxWidth:1e3,width:"100%",height:"72dvh",margin:"auto",display:"flex",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},t.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:o,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"}},t.createElement(Et,{size:22})),t.createElement("div",{className:"yt-collection-bundle-modal-image-container",style:{flex:1,position:"relative",margin:"20px 0 20px 20px",borderRadius:d?.borderRadius||"12px"}},x.length>0&&t.createElement("img",{className:"yt-collection-bundle-modal-image",src:Cx(x[u]||e.images[0]),alt:e.title,style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:d?.borderRadius||"12px"}}),x.length>1&&t.createElement("div",{className:"yt-collection-bundle-modal-image-dots",style:{position:"absolute",bottom:16,left:"50%",transform:"translateX(-50%)",display:"flex",gap:8,background:"rgba(0,0,0,0.4)",padding:"6px 12px",borderRadius:20}},x.map((e,n)=>t.createElement("div",{key:n,className:"yt-collection-bundle-modal-image-dot",onClick:()=>m(n),style:{width:10,height:10,borderRadius:"50%",background:n===u?"#fff":"#fff8",cursor:"pointer",display:"block"}})))),t.createElement("div",{className:"yt-collection-bundle-modal-content",style:{flex:1,padding:"30px",overflowY:"auto",display:"flex",flexDirection:"column",scrollbarWidth:"none"}},t.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"6px 0",fontSize:24,fontWeight:600,lineHeight:"normal"}},e.title),e.variants.length>1&&t.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative"}},t.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee",lineHeight:"normal"}},e?.options?.join(" & "),":"," ",t.createElement("strong",null,h.title)),t.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:f,onChange:e=>g(e.target.value),style:{position:"absolute",inset:0,opacity:0,cursor:"pointer",lineHeight:"normal"}},e.variants.map(e=>t.createElement("option",{key:e.id,value:e.id,disabled:!e.available},e.title," ",!e.available&&"(Out of stock)")))),t.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0",lineHeight:"normal"}},"₹",(h.price/100).toFixed(0),h.compare_at_price&&h.compare_at_price>h.price&&t.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999",lineHeight:"normal"}},"₹",(h.compare_at_price/100).toFixed(0))),t.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"white"}},t.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!i?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>a(e,n),disabled:!i||!h.available,style:{width:"100%",padding:"12px",fontSize:17,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:h.available?s||!i?"#28a745":d?.atcBg||"#007bff":"rgb(204, 204, 204)",color:d?.atcText||"#fff",cursor:i&&h.available?"pointer":"not-allowed",textAlign:"center",lineHeight:"normal"}},s?"Added to Box":h.available?"Add to Box":"Out of Stock")),e.description&&t.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:e.description},style:{lineHeight:"normal",color:"#444",marginTop:"10px"}})))),b=t.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:o},t.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",width:"100%",height:"100dvh",display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},t.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:o,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center"}},t.createElement(Et,{size:22})),t.createElement("div",{className:"yt-collection-bundle-modal-scroll-container",style:{flex:1,overflowY:"auto",paddingBottom:100}},x.length>0&&t.createElement("div",{className:"yt-collection-bundle-modal-image-wrapper",style:{position:"relative"}},t.createElement("img",{className:"yt-collection-bundle-modal-image",src:h.featured_image?.src||x[u]||e.images[0],alt:e.title,style:{width:"100%",display:"block",maxHeight:"50vh",objectFit:"cover",objectPosition:"center"}}),x.length>1&&t.createElement("div",{className:"yt-collection-bundle-modal-image-dots",style:{position:"absolute",bottom:16,left:"50%",transform:"translateX(-50%)",display:"flex",gap:8,background:"rgba(0,0,0,0.4)",padding:"6px 12px",borderRadius:20}},x.map((e,n)=>t.createElement("div",{key:n,className:"yt-collection-bundle-modal-image-dot",onClick:()=>m(n),style:{width:10,height:10,borderRadius:"50%",background:n===u?"#fff":"#fff8",cursor:"pointer"}})))),t.createElement("div",{className:"yt-collection-bundle-modal-content",style:{padding:"20px"}},t.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"0 0 12px",fontSize:22,fontWeight:600}},e.title),e.variants.length>1&&t.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative",marginBottom:20}},t.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee"}},"Variant: ",t.createElement("strong",null,h.title)),t.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:f,onChange:e=>g(e.target.value),style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}},e.variants.map(e=>t.createElement("option",{key:e.id,value:e.id,disabled:!e.available},e.title," ",!e.available&&"(Out of stock)")))),t.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0"}},"₹",(h.price/100).toFixed(0),h.compare_at_price&&h.compare_at_price>h.price&&t.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999"}},"₹",(h.compare_at_price/100).toFixed(0))),e.description&&t.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:e.description},style:{lineHeight:1.7,color:"#444"}}))),t.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"#fff",padding:"8px 10px",borderTop:"1px solid #eee",boxShadow:"0 -4px 10px rgba(0,0,0,0.05)"}},t.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!i?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>a(e,n),disabled:!i||!h.available,style:{width:"100%",padding:"10px",fontSize:14,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:!s&&i&&h.available?d?.atcBg||"#007bff":"#28a745",color:d?.atcText||"#fff",cursor:i&&h.available?"pointer":"not-allowed"}},s?"Added to Box":h.available?"Add to Box":"Out of Stock"))));return v.createPortal(p?b:y,document.body)},fx=({title:e,uploadState:n,onUpload:r,onRemove:o,onRetry:a})=>{const i="object"==typeof n&&n?.loading,l="object"==typeof n&&n?.error,c="object"==typeof n&&n?.url;return t.createElement("div",{className:"yt-collection-bundle-upload-field",style:{padding:"20px",border:"2px dashed #ccc",borderRadius:"8px",textAlign:"center",background:"#fafafa"}},t.createElement("div",{className:"yt-collection-bundle-upload-title",style:{fontWeight:500,color:"#333",marginBottom:"4px"}},e),i&&t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-collection-bundle-upload-loading",style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",color:"#007bff",fontSize:"13px",margin:"12px 0"}},t.createElement(ux,null)," Uploading ",n?.name,"...")),l&&t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-collection-bundle-upload-error",style:{color:"#dc3545",fontSize:"13px",margin:"8px 0"}},"Upload failed. Try again."),t.createElement("button",{type:"button",className:"yt-collection-bundle-upload-retry-btn",onClick:a,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Retry Upload")),c&&!i&&!l&&t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-collection-bundle-upload-image-container",style:{margin:"12px 0"}},t.createElement("img",{className:"yt-collection-bundle-upload-image",src:n.url,alt:"Uploaded",style:{maxWidth:"100%",maxHeight:"150px",borderRadius:"6px"}})),t.createElement("div",{className:"yt-collection-bundle-upload-filename",style:{fontSize:"12px",color:"#28a745",marginBottom:"8px"}},n.name),t.createElement("button",{type:"button",className:"yt-collection-bundle-upload-remove-btn",onClick:o,style:{background:"#dc3545",color:"white",border:"none",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",cursor:"pointer"}},"Remove")),!n&&t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-collection-bundle-upload-hint",style:{color:"#888",fontSize:"12px",marginBottom:"12px"}},"jpeg/png (max 5MB)"),t.createElement("button",{type:"button",className:"yt-collection-bundle-upload-btn",onClick:r,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Upload")))},gx=({config:e,bundleAddToCartLoading:n,addCustomBundleToCart:r})=>{const[i,s]=c(1),[d,p]=c([]),[u,m]=c(null),[f,g]=c({}),[h,x]=c(window.innerWidth<640),[y,b]=c({}),v=o(new Map),[w,C]=c(!1),k=o(null),E=o(new Map),[S,T]=c(160),$=h?8:20,{customizations:B}=e,z=e.config.builderTiers.collectionTier.sort((e,t)=>e.tier-t.tier),N=!!e.config.form,I=z.length+(N?1:0),D=B.hideSelectedProducts,_=B.allowMultipleQty,P=B.hideOutOfStockProducts,A=e=>z[e-1]?.products||[],F=a(e=>{const t=A(e),n=P?t.filter(e=>e.available).length:t.length;b(t=>{const r=t[e]||0,o=Math.min(r+8,n);return o<=r?t:{...t,[e]:o}})},[8,P]);l(()=>(k.current=new IntersectionObserver(e=>{for(const t of e)if(t.isIntersecting){const e=parseInt(t.target.getAttribute("data-sentinel-step")||"0");e>0&&e===i&&F(e)}},{root:null,threshold:0,rootMargin:"100px 0px"}),()=>{k.current?.disconnect()}),[F,i]),l(()=>{if(N&&i===I)return;const e=i,t=A(e);if(0===t.length)return;const n=P?t.filter(e=>e.available).length:t.length;if(0===(y[e]||0)){const t=Math.min($,n);b(n=>({...n,[e]:t}))}},[i,$,P,y]),l(()=>{const e=document.querySelector(".box-loader-scene");e&&e.setAttribute("style","display: none;");const t=()=>x(window.innerWidth<640);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const O=a(e=>{T(e+10)},[]),M=d.reduce((e,t)=>e+t.quantity,0),R=d.reduce((e,t)=>e+t.price*t.quantity,0)/100,L=d.reduce((e,t)=>{const n=z.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId),r=n?.variants.find(e=>e.id.toString()===t.variantId);return e+(r?.compare_at_price??t.price)*t.quantity},0)/100,j=(e,t)=>{const n=e.variants.find(e=>e.id===parseInt(t));if(!n)return;const r=document.querySelector(`[data-product-id="${e.id}"]`);r&&(r.dataset.selectedVariant=t,r.dataset.currentPrice=n.price.toString())},V=(e,t)=>{const n=document.querySelector(`[data-product-id="${e.id}"]`);if(!n)return;const r=n.dataset.selectedVariant||e.variants[0].id.toString(),o=parseInt(n.dataset.currentPrice||e.variants[0].price.toString());p(n=>{const a=`${e.id}-${r}-${t}`,i=n.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===a);if(i)return n.filter(e=>e!==i);const l=q[t],c=W(t);return c!==1/0&&l>=c?n:[...n,{productId:e.id.toString(),variantId:r,price:o,quantity:1,tierIndex:t}]})},W=e=>{const t=z[e];return t.maximumQuantity>0?t.maximumQuantity:1/0},H=(e,t)=>{const n=W(t);if(n===1/0)return!0;const r=q[t],o=d.some(n=>n.productId===e.id.toString()&&n.tierIndex===t);return!!o||r<n},q=z.map((e,t)=>d.filter(e=>e.tierIndex===t).reduce((e,t)=>e+t.quantity,0)),U=(e,t,n)=>{const r=W(n);if(r===1/0)return!0;return q[n]<r},G=e=>{if(!v.current.has(e)){const t=document.createElement("input");t.type="file",t.accept="image/jpeg,image/png",t.style.display="none",t.onchange=async t=>{const n=t.target.files?.[0];if(n){if(n.size>5242880)return alert("Max 5MB");if(!n.type.match(/^image\/(jpeg|png)$/i))return alert("JPEG/PNG only");g(t=>({...t,[e]:{loading:!0,name:n.name}}));try{const t=await(async e=>{const t=new FormData;t.append("file",e),C(!0);try{const e=window?.Shopify?.shop||"falah-devstore.myshopify.com",n=window?.Shopify?.shop?"https://products.yourtoken.io":"http://localhost:8000",r=await fetch(`${n}/shopify/upload?shop=${e}`,{method:"POST",headers:{"x-yourtoken-app-name":"bundles"},body:t});if(!r.ok)throw new Error("Upload failed");return(await r.json()).url}catch(e){throw C(!1),alert("Upload failed. Try again."),e}finally{C(!1)}})(n);g(r=>({...r,[e]:{url:t,name:n.name}}))}catch{g(t=>({...t,[e]:{error:!0,name:n.name}}))}}},document.body.appendChild(t),v.current.set(e,t)}return v.current.get(e)},Q=N&&i===I,Y=(Q?null:z[i-1])?W(i-1):0,Z=z.map((e,t)=>{const n=d.filter(e=>e.tierIndex===t).reduce((e,t)=>{const n=`${t.productId}-${t.variantId}`,r=e.find(e=>`${e.productId}-${e.variantId}`===n);return r?r.quantity+=t.quantity:e.push({...t,quantity:t.quantity}),e},[]);return{tier:e,items:n,count:q[t]}});return t.createElement("div",{className:"yt-collection-bundle-builder",style:{margin:"0 auto",maxWidth:"1600px"}},B.headerImage&&!B.headerImage.includes("Liquid error")&&t.createElement("img",{className:"yt-collection-bundle-header-img",src:B.headerImage,alt:"Collection Bundle header",style:{width:"100%"}}),B.showTierSteps&&t.createElement("div",{style:{paddingTop:B.headerImage&&!B.headerImage.includes("Liquid error")?"20px":"0"}},t.createElement(hx,{totalSteps:I,isFormStep:Q,currentStep:i,getStepTitle:e=>N&&e===I?"Customize Gift Details":z[e-1]?.title||`Step ${e}`,isMobile:h,formTitle:e?.config?.form?.title,hasForm:N,onStepClick:e=>{if(e>1&&!d.length)return alert("Add at least one product first");s(e),window.scrollTo(0,0)}})),Array.from({length:I},(e,t)=>t+1).map(n=>{const r=N&&n===I,o=r?[]:A(n),a=P?o.filter(e=>e.available):o,l=n-1,c=a.slice(0,y[n]||0);return t.createElement("div",{key:n,className:"yt-collection-bundle-step-content "+(i===n?"yt-collection-bundle-step-content-active":""),style:{display:i===n?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},r&&e.config.form?t.createElement("div",{className:"yt-collection-bundle-customize-form",style:{maxWidth:"80%",margin:"0 auto",padding:"1rem",marginBottom:`${S}px`}},e?.config?.form?.sections?.map((e,n)=>t.createElement("div",{key:`sec_${n}`,className:"yt-collection-bundle-form-group",style:{marginBottom:"32px"}},t.createElement("label",{className:"yt-collection-bundle-label",style:{display:"block",fontWeight:600,marginBottom:"12px",color:"#333",fontSize:"16px",lineHeight:"normal"}},e?.title),"text"===e.type&&t.createElement("div",{className:"yt-collection-bundle-form-fields",style:{display:"flex",flexDirection:"column",gap:"12px"}},e.fields.map((e,n)=>{const r=e?.title??"Field "+n;return t.createElement("textarea",{key:r,className:"yt-collection-bundle-textarea",placeholder:e?.title,rows:3,maxLength:500,onChange:e=>g(t=>({...t,[r]:e.target.value})),style:{padding:"12px",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px",resize:"vertical",lineHeight:"normal"}})})),"image"===e.type&&t.createElement("div",{className:"yt-collection-bundle-image-section",style:{marginBottom:"24px"}},t.createElement("sub",{className:"yt-collection-bundle-upload-hint",style:{display:"block",color:"#666",fontSize:"12px",marginBottom:"8px",lineHeight:"normal"}},"jpeg/png (max 5MB)"),t.createElement("div",{className:"yt-collection-bundle-form-fields",style:{display:"flex",flexDirection:"column",gap:"16px"}},e.fields.map((e,n)=>{const r=e?.title??"Field "+n,o=f[r];return t.createElement(fx,{key:r,title:e?.title,uploadState:o,onUpload:()=>G(r).click(),onRemove:()=>g(e=>{const{[r]:t,...n}=e;return n}),onRetry:()=>G(r).click()})})))))):t.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:h?"grid":"flex",gridTemplateColumns:h?"repeat(2,1fr)":"",flexWrap:h?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:`${S}px`}},c.map(e=>t.createElement(xx,{key:e.id,product:e,tierIdx:l,customizations:B,isMobile:h,hoveredCard:u,setHoveredCard:m,selectedProducts:d,handleAddToBundle:V,canAddProduct:H,allowMultipleQty:_,handleVariantChange:j,canIncrement:U,setSelectedProducts:p})),i===n&&(y[n]||0)<a.length&&t.createElement("div",{ref:e=>{const t=E.current.get(n);t&&k.current?.unobserve(t),e?(E.current.set(n,e),k.current?.observe(e)):E.current.delete(n)},"data-sentinel-step":n.toString(),style:{height:"20px",width:"100%",display:"block"}})))}),t.createElement(yx,{config:e,selectedProducts:d,selectedByTier:Z,totalItems:M,totalPrice:R,totalCompareAtPrice:L,currentStep:i,totalSteps:I,currentTierMax:Y,tierSelectedCounts:q,isMobile:h,bundleAddToCartLoading:n,isUploading:w,hoveredCard:u,setHoveredCard:m,hideSelectedProducts:D,getProductStep:e=>{for(let t=0;t<z.length;t++)if(z[t].products.some(t=>t.id.toString()===e))return t+1;return N?I:z.length},setCurrentStep:s,handleRemoveItem:(e,t,n)=>{p(r=>r.filter(r=>!(r.productId===e&&r.variantId===t&&r.tierIndex===n)))},handleCheckout:async()=>{if(i!==I||!d.length)return;const e={};N&&Object.entries(f).forEach(([t,n])=>{const r=t.split("|").pop()?.replace(/^f_\d+$/,"")||t;"string"==typeof n&&n.trim()?e[r]=n:n&&"object"==typeof n&&"url"in n&&(e[r]=n.url)});const t=d.map(t=>({variantId:t.variantId,quantity:t.quantity,properties:e}));r(t)},hasForm:N,onHeightChange:O}))},hx=({totalSteps:e,isFormStep:n,currentStep:r,getStepTitle:o,isMobile:a,formTitle:i,hasForm:l,onStepClick:c})=>t.createElement("div",{className:"yt-collection-bundle-steps-nav-container",style:{display:"flex",justifyContent:"center",flexDirection:"column",gap:a?"0":"1rem",overflowX:"auto",scrollbarWidth:"none",borderBottom:"1px solid #878787",marginInline:a?"0":"2%",paddingBottom:"1rem",textAlign:"center"}},t.createElement("div",{className:"yt-collection-bundle-steps-nav",style:{display:"flex",justifyContent:"center",gap:a?"0":"2rem",overflowX:"auto",scrollbarWidth:"none"}},Array.from({length:e},(e,t)=>t+1).map(n=>t.createElement("div",{key:n,className:"yt-collection-bundle-step-item "+(r===n?"yt-collection-bundle-step-item-active":""),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.5rem",minWidth:"120px",cursor:"pointer",opacity:r===n?1:.5,transition:"opacity 0.2s"},onClick:()=>c(n)},t.createElement("div",{className:"yt-collection-bundle-step-icon "+(r===n?"yt-collection-bundle-step-icon-active":""),style:{width:"40px",height:"40px",background:r===n?"#000":"#fff",border:"2px solid #ccc",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center"}},l&&n===e?t.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},t.createElement("path",{d:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.67C10.96 2.54 10.05 2 9 2c-1.66 0-3 1.34-3 3 0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1h-2c-.55 0-1-.45-1-1s.45-1 1-1h2zm-6 0c.55 0 1 .45 1 1s-.45 1-1 1H7c-.55 0-1-.45-1-1s.45-1 1-1h2zM20 19H4V8h16v11z"})):t.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},t.createElement("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}))),t.createElement("div",{className:"yt-collection-bundle-step-label",style:{fontSize:"14px",textAlign:"center",color:"#333",fontWeight:"600",lineHeight:"normal"}},o(n))))),i&&l&&n&&t.createElement("p",{className:"yt-collection-bundle-steps-nav-description",style:{fontSize:a?"14px":"16px",marginBottom:a?"0":"14px",fontWeight:"400",color:"#000",lineHeight:"normal"}},i)),xx=({product:e,tierIdx:n,customizations:r,isMobile:o,hoveredCard:a,setHoveredCard:i,selectedProducts:l,handleAddToBundle:s,canAddProduct:d,allowMultipleQty:p,handleVariantChange:u,canIncrement:m,setSelectedProducts:f})=>{const[g,h]=c(!1),x=document.querySelector(`[data-product-id="${e.id}"]`),y=x?.dataset.selectedVariant||e.variants[0].id.toString(),b=e.variants.find(e=>e.id.toString()===y)||e.variants[0],v=l.some(t=>t.productId===e.id.toString()&&t.variantId===y&&t.tierIndex===n),w=a===e.id,C=l.filter(t=>t.productId===e.id.toString()&&t.variantId===b.id.toString()&&t.tierIndex===n).reduce((e,t)=>e+t.quantity,0);return t.createElement(t.Fragment,null,t.createElement("div",{key:e.id,className:"yt-collection-bundle-product-item","data-product-id":e.id,"data-selected-variant":b.id,"data-current-price":b.price,style:{display:"flex",flexDirection:"column",border:r?.productCardBorder||"1px solid #ddd",background:r?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:o?0:"250px",maxWidth:o?"none":"250px",borderRadius:r?.borderRadius||"8px",boxShadow:"spread"===r?.productCardShadow?"8px 8px 8px -6px #0000004D":"no-spread"===r?.productCardShadow?"6px 6px 0px -1px #00000033":"none",width:o?"100%":""}},t.createElement("div",{className:"yt-collection-bundle-product-image",style:{position:"relative",width:"100%",aspectRatio:r?.productImageRatio||"1/1",overflow:"hidden",cursor:"pointer",background:"#f9f9f9"},onClick:()=>h(!0),onMouseEnter:()=>i(e.id),onMouseLeave:()=>i(null)},t.createElement("img",{src:Cx(e.images[0]||"https://cdn.shopify.com/s/files/1/0750/9937/3789/files/placeholder-thumbnail.png?width=250px"),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:w?0:1,transform:w?"scale(1.05)":"scale(1)"},alt:e.title}),t.createElement("img",{src:Cx(e.images[1]||e.images[0]),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:w?1:0,transform:"scale(1.05)"},alt:e.title}),e.variants.length>1&&t.createElement("select",{className:"yt-collection-bundle-variant-selector",style:{position:"absolute",bottom:"10px",left:"10px",right:"10px",background:"rgba(255,255,255,0.9)",border:"none",borderRadius:"4px",padding:"8px",fontSize:"12px",fontWeight:"600",zIndex:2,lineHeight:"normal"},onChange:t=>u(e,t.target.value),defaultValue:b.id,onClick:e=>{e.stopPropagation()}},e.variants.map(e=>t.createElement("option",{key:e.id,value:e.id,disabled:!e.available},e.title," ",!e.available&&"(Out of stock)")))),t.createElement("div",{className:"yt-collection-bundle-product-info",style:{padding:"12px",flexGrow:1,display:"flex",flexDirection:"column"}},t.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:o?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:"normal",color:"#333",flexGrow:1}},e.title),t.createElement("div",{className:"yt-collection-bundle-product-prices",style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"nowrap",whiteSpace:"nowrap",overflow:"hidden",lineHeight:"normal"}},t.createElement("span",{className:"yt-collection-bundle-product-price",style:{fontSize:o?"14px":"16px",fontWeight:"bold",color:"#000",flexShrink:0,lineHeight:"normal"}},"₹",(b.price/100).toFixed(0)),b.compare_at_price&&b.compare_at_price>b.price&&t.createElement("span",{className:"yt-collection-bundle-product-compare",style:{fontSize:"14px",textDecoration:"line-through",color:"#999",flexShrink:0,lineHeight:"normal"}},"₹",(b.compare_at_price/100).toFixed(0)))),p&&C>0?t.createElement("div",{className:"yt-collection-bundle-quantity-row",style:{display:"flex",alignItems:"center",flexWrap:"nowrap",background:"#cccccc"}},t.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-minus",style:{width:"40%",height:b.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:o?"6px":"12px",fontSize:o?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{f(t=>{const r=`${e.id}-${b.id}-${n}`,o=t.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===r);return o&&o.quantity>1?t.map(e=>e===o?{...e,quantity:e.quantity-1}:e):o?t.filter(e=>e!==o):t})}},"-"),t.createElement("span",{className:"yt-collection-bundle-qty-display",style:{minWidth:"24px",textAlign:"center",fontWeight:600,width:"100%",lineHeight:"normal"}},C),t.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-plus",style:{width:"40%",height:b.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:o?"6px":"12px",fontSize:o?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{b.available&&m(e,b.id.toString(),n)&&f(t=>{const r=`${e.id}-${b.id}-${n}`,o=t.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===r);return o?t.map(e=>e===o?{...e,quantity:e.quantity+1}:e):[...t,{productId:e.id.toString(),variantId:b.id.toString(),price:b.price,quantity:1,tierIndex:n}]})},disabled:!b.available||!m(e,b.id.toString(),n)},"+")):t.createElement("button",{className:"yt-collection-bundle-add-btn "+(v?"yt-collection-bundle-add-btn-added":""),style:{background:v?"#28a745":d(e,n)&&b.available?r?.atcBg||"#007bff":"#ccc",color:r?.atcText||"#fff",border:"none",padding:o?"6px":"12px",fontSize:o?"12px":"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",opacity:b.available?1:.6,lineHeight:"normal",textAlign:"center"},onClick:()=>{b.available&&d(e,n)&&s(e,n)},disabled:!b.available||!d(e,n)},v?"Added":b.available?"ADD TO BOX":"Out of Stock")),g&&t.createElement(mx,{product:e,tierIdx:n,isOpen:g,onClose:()=>h(!1),onAddToBundle:(e,t)=>{s(e,t),h(!1)},canAdd:d(e,n),isSelected:v,customizations:r,isMobile:o}))},yx=e=>{const{config:n,selectedProducts:r,selectedByTier:a,totalItems:i,totalPrice:s,totalCompareAtPrice:d,currentStep:p,totalSteps:u,currentTierMax:m,tierSelectedCounts:f,isMobile:g,bundleAddToCartLoading:h,isUploading:x,hoveredCard:y,setHoveredCard:b,getProductStep:v,setCurrentStep:w,handleRemoveItem:C,handleCheckout:k,hasForm:E,onHeightChange:S}=e,{customizations:T}=n,[$,B]=c(!1),z=o(null),N=a.filter(({count:e})=>e>0).map(({tier:e,count:t})=>((e,t)=>{const n=e.discountData;if(!n||!n.tiers?.length)return null;const r=[...n.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity),o=r.filter(e=>t>=e.minimumQuantity),a=[];if(o.length>0){const e=o.reduce((e,t)=>e.minimumQuantity>t.minimumQuantity?e:t).discountValue,{type:t}=n;let r;switch(t){case"percentage_discount_coupon":r=`${e}% OFF`;break;case"amount_discount_coupon":r=`₹${e} OFF`;break;case"fixed_price_collection":r=`Fixed ₹${e}`;break;case"dummy_coupon":r="Discount Applied";break;default:r=null}r&&a.push(r)}const i=r.find(e=>e.minimumQuantity>t);if(i){const e=i.minimumQuantity-t,r=i.discountValue,{type:o}=n;let l;switch(o){case"percentage_discount_coupon":l=`${r}% OFF`;break;case"amount_discount_coupon":l=`₹${r} OFF`;break;case"fixed_price_collection":l=`Fixed ₹${r}`;break;case"dummy_coupon":l="Discount";break;default:l=null}l&&a.push(`Add ${e} more item${1!==e?"s":""} to get ${l}`)}return a.length>0?a.join(" + "):null})(e,t)).filter(Boolean);return l(()=>{const e=m!==1/0&&f[p-1]===m-2&&m>1;let t=null;return e?(B(!0),t=setTimeout(()=>{B(!1)},3e3)):B(!1),()=>{t&&clearTimeout(t)}},[m,f,p]),l(()=>{if(z.current&&S){const e=z.current.offsetHeight;S(e)}},[g,S,r]),t.createElement("div",{ref:z,className:"yt-collection-bundle-bar",style:{background:T?.bundleBg||"#fff",color:T?.bundleText||"#333",border:T?.bundleBorder||"1px solid #878787",display:"flex",flexDirection:"column",position:"fixed",bottom:"10px",left:"50%",transform:"translateX(-50%)",width:"compact"==T.stickyBarWidth?"600px":"90%",maxWidth:"95%",zIndex:899,boxShadow:"0 -2px 10px rgba(0,0,0,0.1)",transition:"bottom 0.3s ease",borderRadius:T?.borderRadius||"8px",overflow:"hidden"}},N.length>0&&t.createElement("div",{style:{padding:"4px 8px",background:"#dbdbdbc5",color:"#6c757d",textAlign:"center",fontSize:"12px",fontWeight:500}},N.join(" + ")),t.createElement("div",{className:"yt-collection-bundle-bar-header",style:{position:"relative",textAlign:"center"}},$&&t.createElement(t.Fragment,null,t.createElement("style",null,"\n @keyframes fadeIn {\n from { opacity: 0; transform: translateX(-50%) translateY(10px); }\n to { opacity: 1; transform: translateX(-50%) translateY(0); }\n }\n "),t.createElement("div",{className:"yt-collection-bundle-ctx",style:{position:"absolute",top:"-40px",left:"50%",transform:"translateX(-50%)",background:T?.atcBg||"#007bff",color:T?.atcText||"#fff",padding:"4px 8px",borderRadius:T?.borderRadius||"8px",fontSize:"14px",whiteSpace:"nowrap",zIndex:10,boxShadow:"0 4px 12px rgba(0,0,0,0.2)",animation:"fadeIn 0.3s ease-out",minWidth:"300px",textAlign:"center",border:"1px solid rgba(0,0,0,0.1)",lineHeight:"normal"}},"Add up to"," ",t.createElement("span",{style:{fontWeight:600}},m," item",m>1?"s":"")))),r.length>0&&t.createElement("div",{className:"yt-collection-bundle-bar-top",style:{display:"flex",alignItems:"center",padding:"8px 8px 0",position:"relative",borderRadius:T?.borderRadius||"8px"}},t.createElement("div",{className:"yt-collection-bundle-images",style:{display:"flex",flex:1,gap:"5px",justifyContent:"center",alignItems:"center",overflowX:"auto",padding:"4px 0",scrollbarWidth:"none"}},a.filter(({count:e})=>e>0).map(({items:e},r,o)=>t.createElement(t.Fragment,{key:r},t.createElement("div",{className:"yt-collection-bundle-tier-images",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",minWidth:"fit-content"}},t.createElement("div",{style:{display:"flex",gap:"4px"}},e.map((e,o)=>{const a=n.config.builderTiers.collectionTier.flatMap(e=>e.products).find(t=>t.id.toString()===e.productId);if(!a)return null;const i=v(e.productId),l=p===i;return t.createElement("div",{key:o,className:"yt-collection-bundle-img-wrapper",style:{position:"relative",flexShrink:0,height:"65px"}},t.createElement("div",{style:{position:"relative",width:"67px",height:"67px",borderRadius:`calc(${T?.borderRadius||"8px"} / 2)`,overflow:"hidden",cursor:l?"default":"pointer",transition:"transform 0.2s ease"},onMouseEnter:e=>!l&&(e.currentTarget.style.transform="scale(1.08)"),onMouseLeave:e=>e.currentTarget.style.transform="scale(1)",onClick:()=>!l&&w(i)},t.createElement("img",{src:Cx(a.images[0]),style:{width:"65px",height:"65px",objectFit:"cover",borderRadius:`calc(${T?.borderRadius||"8px"} / 2)`,transition:"opacity 0.2s",pointerEvents:"none",border:"1px solid #ddd"},alt:"Selected"}),e.quantity>1&&t.createElement("div",{className:"yt-collection-bundle-qty-badge",style:{position:"absolute",bottom:"4px",right:"4px",background:"rgba(0,0,0,0.7)",color:"#fff",borderRadius:"10px",padding:"2px 6px",fontSize:"10px",fontWeight:600,lineHeight:"normal"}},"x",e.quantity),t.createElement("button",{className:"yt-collection-bundle-remove-btn",style:{position:"absolute",top:"4px",right:"4px",width:"20px",height:"20px",background:"rgba(220,53,69,0.95)",color:"white",border:"none",borderRadius:"50%",fontSize:"12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.3)",textAlign:"center",lineHeight:"normal"},onClick:t=>{t.stopPropagation(),C(e.productId,e.variantId,r)}},"×")))}))),r<o.length-1&&o[r+1].count>0&&t.createElement("div",{style:{color:"#666",paddingInline:"6px",lineHeight:"normal"}},t.createElement(Ct,null)))))),g?t.createElement("div",{className:"yt-collection-bundle-mobile-bar-content",style:{display:"flex",flexDirection:i>0&&(E||n?.config?.builderTiers?.collectionTier?.length>1)?"column":"row",margin:"4px",gap:i>0?"10px":"0",background:"#dbdbdb",borderRadius:T?.borderRadius||"8px",overflow:"hidden"}},t.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:r.length>0?"space-between":"center",...0!==i&&{paddingInline:"6px"},alignItems:"center",borderRadius:T?.borderRadius||"8px"}},t.createElement(t.Fragment,null,0===i&&t.createElement("div",{style:{fontSize:"14px",color:"#6c757d",lineHeight:"normal",...0===i&&{padding:"8px 0 12px 0",background:"#dbdbdb",color:"#6c757d",width:"100%",borderRadius:T?.borderRadius||"8px"}}},"Add Items to Checkout"),i>0&&t.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"4px",width:"100%",justifyContent:"center"}},t.createElement("div",{style:{fontSize:"14px",color:"#000000",fontWeight:600,lineHeight:"normal"}},"₹",s.toLocaleString()),d>s&&t.createElement("div",{style:{fontSize:"14px",color:"#787878",fontWeight:500,textDecoration:"line-through",lineHeight:"normal"}},"₹",d.toLocaleString()),i>0&&t.createElement("span",{style:{fontSize:"14px",color:"#000000",fontWeight:500,lineHeight:"normal"}},`(${i} Added)`)))),t.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"4px"}},(n?.config?.builderTiers?.collectionTier?.length>1||E)&&i>0&&t.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:1===p?"not-allowed":"pointer",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",textAlign:"center",lineHeight:"normal"},onClick:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>b(-1),onMouseLeave:()=>b(null),disabled:1===p},"Back"),i>0&&t.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===i||x?"yt-collection-bundle-next-btn-disabled":""),style:{background:T?.btnPrimaryBg||"#28a745",color:T?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",opacity:p===u&&0===i||x?.6:1,textAlign:"center",lineHeight:"normal"},onClick:p===u?k:()=>w(p+1),disabled:p===u&&0===i||h||x},h?t.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},t.createElement(ux,null)):p===u?"Checkout":"Next"))):t.createElement("div",{className:"yt-collection-bundle-bar-bottom",style:{display:"flex",alignItems:"center",padding:"0px",background:"#dbdbdb",margin:"8px",borderRadius:T?.borderRadius||"8px",overflow:"hidden",scrollbarWidth:"none"}},(n?.config?.builderTiers?.collectionTier?.length>1||E)&&i>0&&t.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:1===p?"not-allowed":"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",...-1===y&&{filter:"brightness(60%)"},textAlign:"center",lineHeight:"normal"},onClick:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>b(-1),onMouseLeave:()=>b(null),disabled:1===p},"Back"),t.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:r.length>0?"space-between":"center",paddingInline:"6px",alignItems:"center",...0===i&&{padding:"12px 24px"}}},0===i&&t.createElement("div",{style:{fontSize:"16px",color:"#6c757d",lineHeight:"normal"}},"Add Items to Checkout"),i>0&&t.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"6px"}},t.createElement("div",{style:{fontSize:"16px",color:"#000000",fontWeight:600,lineHeight:"normal"}},"₹",s.toLocaleString()),d>s&&t.createElement("div",{style:{fontSize:"15px",color:"#787878",fontWeight:500,textDecoration:"line-through",lineHeight:"normal"}},"₹",d.toLocaleString()),i>0&&t.createElement("span",{style:{fontSize:"16px",color:"#000000",fontWeight:500,lineHeight:"normal"}},`(${i} Added)`))),i>0&&t.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===i||x?"yt-collection-bundle-next-btn-disabled":""),style:{background:T?.btnPrimaryBg||"#28a745",color:T?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",opacity:p===u&&0===i||x?.6:1,...-2===y&&{filter:"brightness(90%)"},textAlign:"center",lineHeight:"normal"},onClick:p===u?k:()=>w(p+1),disabled:p===u&&0===i||h||x,onMouseEnter:()=>b(-2),onMouseLeave:()=>b(null)},h?t.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},t.createElement(ux,null)):p===u?"Checkout":"Next")))},bx=window?.Shopify?.currency||{rate:1,active:"INR"},vx=e=>{if(!e)return;const t=navigator.language||"en-US",n=Number((Number(e)*bx.rate).toFixed(2));return new Intl.NumberFormat(t).format(n)},wx=(e,t)=>t==bx.active?e:Rn(bx.active)||bx.active,Cx=(e,t)=>{if(!e||!e.includes("cdn.shopify")&&!e.includes("/cdn/shop/files/"))return e;try{const n=new URL(e),r=n.searchParams;return r.has("format")||r.set("format","webp"),r.has("quality")||r.set("quality",t?.toString()||"70"),r.has("width")||r.set("width","600"),n.toString()}catch{const n=e.includes("?")?"&":"?";return e+n+`format=webp&quality=70&width=${t?.toString()||"600"}`}},kx=(e,t,n,r,o,a)=>{const i=r.findIndex(t=>t.variantId===e);o(0===n?e=>e.filter((e,t)=>t!==i):-1===i?r=>[...r,{product:t,variantId:e,quantity:n,isFree:a}]:e=>e.map((e,t)=>t===i?{...e,quantity:e.quantity+n,isFree:a}:e))},Ex=({bundle:e,currentProductId:n,addToCartFunction:r,addCustomBundleToCart:o,selectedItems:a,setSelectedItems:i,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:s,renderingOnPage:d,bundleSubtotal:p})=>"fixed"!==e.type&&e.type&&0!==e?.type?.length?"builder"===e.type?t.createElement(Rf,{bundleAddToCartLoading:l,bundle:e,selectedItems:a,setSelectedItems:i,handleAddToCart:o,handleRemoveItem:c,renderingOnPage:d,selectedItemsQuantity:s??0,bundleSubtotal:p??{price:0,compareAtPrice:0}}):"combo"===e.type?t.createElement(jf,{bundle:e,addToCartFunction:r}):"mixAndMatch"===e.type?t.createElement(Xg,{bundle:e,addToCartFunction:r}):"collection"===e.type?t.createElement(gx,{config:e,addCustomBundleToCart:o,bundleAddToCartLoading:l}):t.createElement(yg,{bundle:e,currentProductId:n,addToCartFunction:r}):t.createElement(px,{addToCartFunction:r,bundle:e});te(".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 Sx=()=>t.createElement("div",{className:"scene"},t.createElement("div",{className:"floating"},t.createElement("div",{className:"cube"},t.createElement("div",{className:"side front"},""),t.createElement("div",{className:"side back"},""),t.createElement("div",{className:"side left"},""),t.createElement("div",{className:"side right"},""),t.createElement("div",{className:"side bottom"},""),t.createElement("div",{className:"lid"},t.createElement("div",{className:"flap north"},""),t.createElement("div",{className:"flap south"},""),t.createElement("div",{className:"flap east"},""),t.createElement("div",{className:"flap west"},""))))),Tx=({config:e,brandConfig:n})=>{const{heroDesktopImage:r,heroMobileImage:o,heroTitle:a="ZERO WASTE PREMIUM PET CARE",heroSubtitle:i="Earn Doglycoins for exclusive rewards every time you shop.",heroTextAlignment:l="left",heroSubtitleFontSize:c="18px",heroSubtitleColor:s="#000000",heroSubtitleFontWeight:d="400",heroTitleFontSize:p="48px",heroTitleColor:u="#000000",heroRegistrationCTAVisibility:m=!0,primaryColor:f="#1C1C1D",primaryContrastColor:g="#FFFFFF",secondaryColor:h="#FFFFFF",secondaryContrastColor:x="#000000",accentColor:y="#FFFFFF",borderColor:b="#E5E5E5",themeRoundness:v="0px",heroBannerVisibility:w="show",stepsVisibility:C="show",waysToEarnVisibility:k="show",customSectionVisibility:E="show",footerSignupVisibility:S="show",customSectionImagePosition:T="left",customSectionTitle:$="Earn Doglycoins every time you shop",customSectionSubtitle:B="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:z="36px",customSectionSubtitleFontSize:N="18px",customSectionImage:I,customSectionTextAlignment:D="left",customSectionTitleColor:_="#000000",customSectionSubtitleColor:P="#000000",stepsTitle:A="Getting started is easy",stepsSubtitle:F="Earn Stars and get rewarded in a few easy steps.",step1Title:O="CREATE AN ACCOUNT",step1Description:M="To get started, Join Now. You can also register on the mobile app to get access to the full range of reward benefits",step2Title:R="ORDER AND EARN REWARDS POINTS",step2Description:L="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:V="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:U="Individual rewards of 750 points or more ship FREE. No merchandise purchase required.",footerSignupSubtext:G="Use your points to redeem samples and more."}=e||{},te="undefined"!=typeof window&&window.innerWidth<=768,ne=e=>e&&e.startsWith("//")?`https:${e}`:e,re={padding:"12px 32px",borderRadius:"30px",fontSize:"14px",fontWeight:600,cursor:"pointer",textTransform:"uppercase",border:`1px solid ${f}`,transition:"all 0.3s ease"},oe={...re,backgroundColor:f,color:g,borderColor:f},ae={...re,backgroundColor:h,color:x,borderColor:b},{newSignupTokens:ie,firstOrderTokens:le,instagramFollowPoints:ce,twitterFollowPoints:se,facebookFollowPoints:de,youtubeSubscriptionPoints:pe,rewardToLeaveReview:ue,birthdayPoints:me,referralPointsForReferrer:fe,tokenCreditPercentage:ge,brandTokenName:he}=n||{},xe=[...ie?[{icon:t.createElement(K,null),title:`${ie} ${he}`,subtitle:"Create an account"}]:[],...le?[{icon:t.createElement(ee,null),title:`${le} ${he}`,subtitle:"Place your first order"}]:[],...ge?[{icon:t.createElement(ee,null),title:`${ge}% ${he}`,subtitle:`Earn ${ge}% back on every order`}]:[],...fe?[{icon:t.createElement(J,null),title:`${fe} ${he}`,subtitle:"Refer a friend and get"}]:[],...me?[{icon:t.createElement(q,null),title:`${me} ${he}`,subtitle:"Get on your birthday to spend"}]:[],...ue?[{icon:t.createElement(W,null),title:`${ue} ${he}`,subtitle:"Write a Review"}]:[],...de?[{icon:t.createElement(Q,null),title:`${de} ${he}`,subtitle:"Like on Facebook"}]:[],...ce?[{icon:t.createElement(Y,null),title:`${ce} ${he}`,subtitle:"Follow on Instagram"}]:[],...se?[{icon:t.createElement(Z,null),title:`${se} ${he}`,subtitle:"Follow on Twitter"}]:[],...pe?[{icon:t.createElement(X,null),title:`${pe} ${he}`,subtitle:"Subscribe on YouTube"}]:[]];return t.createElement("div",{className:"yt-loyalty-page-container",style:{fontFamily:"'Poppins', sans-serif",width:"100%",overflow:"hidden"}},"show"===w&&t.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(${ne(te&&o?o:r)})`,backgroundSize:"cover",backgroundPosition:"center",padding:te?"40px 20px":"60px 80px"}},t.createElement("div",{className:"yt-loyalty-page-hero-content",style:{maxWidth:"600px",zIndex:2,textAlign:l}},t.createElement("h1",{className:"yt-loyalty-page-hero-title",style:{fontSize:te?"32px":p,color:u,marginBottom:"16px",lineHeight:1.1,fontWeight:800,textTransform:"uppercase"}},a),t.createElement("p",{className:"yt-loyalty-page-hero-subtitle",style:{fontSize:c,color:s,fontWeight:Number(d)||400,marginBottom:"32px"}},i),m&&t.createElement("div",{className:"yt-loyalty-page-hero-button-wrapper",style:{display:"flex",gap:"16px",justifyContent:"center"===l?"center":"right"===l?"flex-end":"flex-start"}},t.createElement("button",{className:"yt-loyalty-page-hero-button",style:oe,onClick:()=>{"undefined"!=typeof window&&window.ytapp&&(window.ytapp.loyaltyWidgetOpen=!0,window.dispatchEvent(new Event("loyaltyWidgetOpenChanged")))}},"Join Now")))),"show"===C&&t.createElement("div",{className:"yt-loyalty-page-steps",style:{padding:"40px 20px",position:"relative",textAlign:"center"}},t.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"),t.createElement("div",{className:"yt-loyalty-page-steps-content",style:{position:"relative",zIndex:1}},t.createElement("h2",{className:"yt-loyalty-page-steps-title",style:{fontSize:"32px",fontWeight:700,marginBottom:"8px",color:"#000"}},A),t.createElement("p",{className:"yt-loyalty-page-steps-subtitle",style:{color:f,marginBottom:"60px"}},F),t.createElement("div",{className:"yt-loyalty-page-steps-grid",style:{display:"flex",flexDirection:te?"column":"row",justifyContent:"center",gap:"40px",maxWidth:"1200px",margin:"0 auto"}},[{icon:t.createElement(ee,null),title:O,desc:M},{icon:t.createElement(H,null),title:R,desc:L},{icon:t.createElement(q,null),title:j,desc:V}].map((e,n)=>t.createElement("div",{key:n,className:"yt-loyalty-page-step-item",style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center"}},t.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:"24px"}},e.icon),t.createElement("h3",{className:"yt-loyalty-page-step-title",style:{fontSize:"16px",fontWeight:700,marginBottom:"16px",color:f,textTransform:"uppercase"}},e.title),t.createElement("p",{className:"yt-loyalty-page-step-description",style:{fontSize:"13px",color:f,lineHeight:1.5,maxWidth:"300px"}},e.desc)))))),"show"===k&&t.createElement("div",{className:"yt-loyalty-page-ways-to-earn",style:{padding:"40px 20px",position:"relative",borderTop:"1px solid #eee"}},t.createElement("div",{className:"yt-loyalty-page-ways-to-earn-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}},"WAYS TO EARN"),t.createElement("div",{className:"yt-loyalty-page-ways-to-earn-grid",style:{position:"relative",zIndex:1,maxWidth:"1000px",margin:"0 auto",display:"grid",gridTemplateColumns:te?"1fr":"repeat(auto-fit, minmax(200px, 200px))",gap:"16px",justifyContent:"center"}},xe.map((e,n)=>t.createElement("div",{key:n,className:"yt-loyalty-page-ways-to-earn-item",style:{border:"2px solid #c8c8c8",padding:"20px 16px",display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",borderRadius:v,boxShadow:"-1px 2px 5px 2px lightgrey"}},t.createElement("div",{className:"yt-loyalty-page-ways-to-earn-icon",style:{fontSize:"32px",marginBottom:"16px",color:"#1a1a2e"}},e.icon),t.createElement("h3",{className:"yt-loyalty-page-ways-to-earn-title",style:{fontSize:"14px",fontWeight:700,marginBottom:"8px",textTransform:"uppercase",color:"#000"}},e.title),t.createElement("p",{className:"yt-loyalty-page-ways-to-earn-subtitle",style:{fontSize:"12px",color:"#666"}},e.subtitle))))),"show"===E&&t.createElement("div",{className:"yt-loyalty-page-custom-section",style:{padding:"40px 20px",borderTop:"1px solid #eee"}},t.createElement("div",{className:"yt-loyalty-page-custom-section-container",style:{maxWidth:"1200px",margin:"0 auto",display:"flex",flexDirection:te?"column":"row",alignItems:"center",gap:"40px",borderRadius:v,overflow:"hidden",backgroundColor:"#F9F9F9"}},t.createElement("div",{className:"yt-loyalty-page-custom-section-image-wrapper",style:{flex:1,width:"100%",order:te||"left"===T?0:1}},t.createElement("div",{className:"yt-loyalty-page-custom-section-image",style:{display:"flex",width:"100%",height:"300px",backgroundColor:"#ddd",backgroundImage:I?`url(${ne(I)})`:r?`url(${ne(r)})`:void 0,backgroundSize:"cover",backgroundPosition:"center"}})),t.createElement("div",{className:"yt-loyalty-page-custom-section-content",style:{flex:1,paddingInline:"10px",textAlign:te?"center":D,order:te||"left"===T?1:0}},t.createElement("h2",{className:"yt-loyalty-page-custom-section-title",style:{fontSize:z,fontWeight:700,marginBottom:"16px",color:_}},$),t.createElement("p",{className:"yt-loyalty-page-custom-section-subtitle",style:{fontSize:N,color:P,marginBottom:"24px",lineHeight:1.6,whiteSpace:"pre-line"}},B)))),"show"===S&&t.createElement("div",{className:"yt-loyalty-page-footer",style:{marginBottom:"20px"}},t.createElement("div",{className:"yt-loyalty-page-footer-container",style:{maxWidth:"1200px",margin:"0 auto"}},t.createElement("div",{className:"yt-loyalty-page-footer-custom-text",style:{backgroundColor:y,color:"#fff",padding:"16px",textAlign:"center",fontSize:"12px",fontStyle:"italic",borderRadius:"4px"}},U),t.createElement("div",{className:"yt-loyalty-page-footer-signup",style:{display:"flex",flexDirection:te?"column":"row",justifyContent:"space-between",alignItems:"center",marginTop:"40px",padding:"20px",border:"1px solid #eee",borderRadius:"4px",gap:"20px",textAlign:te?"center":"left"}},t.createElement("div",{className:"yt-loyalty-page-footer-signup-content"},t.createElement("h3",{style:{fontSize:"20px",fontWeight:700,marginBottom:"4px",color:"#000"}},"Rewards Program"),t.createElement("p",{style:{fontSize:"14px",color:"#666"}},G)),t.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")))))},$x=({showPopup:e,selectedOffer:n,selectedOfferTerms:r,onClose:o,offersConfig:a})=>{if(!e||!n||!r)return null;const i=t.createElement("div",{className:"yt-product-offers-isolated",style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2147483647},onClick:o},t.createElement("div",{style:{width:"90vw",minWidth:"375px",maxWidth:"480px",maxHeight:"90vh",backgroundColor:"#fff",borderRadius:"12px",padding:"16px",boxShadow:"0 4px 15px rgba(0,0,0,0.3)",position:"relative",flexDirection:"column",display:"flex"},onClick:e=>e.stopPropagation()},t.createElement("img",{src:"https://feature-products-offers.shopify-product-blocks.pages.dev/assets/confetti.jpg",alt:"confetti",style:{width:"100%",height:"clamp(150px, 20vh, 230px)",objectFit:"cover",objectPosition:"top",borderTopLeftRadius:"12px",borderTopRightRadius:"12px",marginBottom:"10px",flexShrink:0}}),t.createElement("div",{style:{fontSize:"clamp(32px, 8vw, 40px)",color:"#4C4C4C",marginTop:"clamp(-150px, -20vh, -200px)",marginBottom:"8px",display:"flex",justifyContent:"center",position:"relative"}},t.createElement(G,null)),t.createElement("div",{style:{fontSize:"clamp(16px, 4vw, 20px)",fontWeight:500,color:"#4C4C4C",lineHeight:"normal",textAlign:"center"}},n.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")),t.createElement("div",{style:{fontSize:"clamp(28px, 7vw, 40px)",fontWeight:"600",color:a?.textColor||"#EE8E35",lineHeight:"normal",textAlign:"center"}},n.name),t.createElement("div",{style:{fontSize:"clamp(16px, 4vw, 20px)",color:"#000000",textAlign:"center",fontWeight:500}},r.offerMessage),t.createElement("hr",{style:{border:"none",height:"2px",width:"100%",margin:"10px 0 18px 0",backgroundColor:"transparent",backgroundImage:"repeating-linear-gradient(to right, #ccc 0, #ccc 12px, transparent 12px, transparent 20px)",backgroundSize:"100% 2px",backgroundPosition:"0 0",backgroundRepeat:"repeat-x"}}),t.createElement("div",{style:{marginTop:"15px",fontSize:"clamp(14px, 3.5vw, 16px)",textAlign:"center",display:"flex",flexDirection:"column"}},t.createElement("strong",{style:{color:"#888"}},"Terms & Conditions"),t.createElement("ul",{style:{marginTop:"5px",paddingLeft:"20px",textAlign:"left",display:"inline-block",color:"#000",lineHeight:"1.3",marginBottom:"0"}},r.terms.map((e,n)=>t.createElement("li",{key:n,style:{marginBottom:"4px"}},e)))),t.createElement("button",{onClick:o,style:{width:"100%",padding:"10px 20px",marginTop:"10px",backgroundColor:"#fff",border:"none",borderTop:"1px solid #ddd",borderRadius:"0",fontSize:"16px",fontWeight:"600",color:"#333",cursor:"pointer",textAlign:"center",flexShrink:0}},"Close")));return w(i,document.body)},Bx=({showPopup:e,selectedOffer:n,selectedOfferTerms:r,onClose:o,offersConfig:a})=>{if(!e||!n||!r)return null;const i=t.createElement("div",{className:"yt-product-offers-isolated",style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"flex-end",justifyContent:"center",zIndex:2147483647,animation:"fadeIn 0.3s ease"},onClick:o},t.createElement("style",null,"\n @keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n @keyframes slideUp {\n from { transform: translateY(100%); }\n to { transform: translateY(0); }\n }\n "),t.createElement("div",{style:{width:"100%",maxHeight:"85vh",backgroundColor:"#fff",borderTopLeftRadius:"20px",borderTopRightRadius:"20px",borderTop:"1px solid #E5E5E5",position:"relative",flexDirection:"column",display:"flex",animation:"slideUp 0.3s ease",overflow:"hidden"},onClick:e=>e.stopPropagation()},t.createElement("div",{style:{width:"40px",height:"4px",backgroundColor:"#ddd",borderRadius:"2px",margin:"12px auto 16px",flexShrink:0}}),t.createElement("div",{style:{overflowY:"auto",flex:1}},t.createElement("div",{style:{padding:"0 20px 20px",backgroundColor:"#fff"}},t.createElement("div",{style:{fontSize:"48px",color:"#4C4C4C",display:"flex",justifyContent:"center",margin:"16px"}},t.createElement(G,null)),t.createElement("div",{style:{fontSize:"14px",fontWeight:500,color:"#888",textAlign:"center"}},n.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")),t.createElement("div",{style:{fontSize:"32px",fontWeight:"700",color:a?.textColor||"#EE8E35",textAlign:"center",lineHeight:"1.2"}},n.name),t.createElement("div",{style:{fontSize:"18px",color:"#000000",textAlign:"center",fontWeight:500}},r.offerMessage)),t.createElement("div",{style:{backgroundColor:"#F5F5F5",padding:"16px 20px"}},t.createElement("div",{style:{fontSize:"16px",fontWeight:"600",color:"#333",textAlign:"center"}},"Terms & Conditions")),t.createElement("div",{style:{padding:"20px",backgroundColor:"#fff"}},t.createElement("ul",{style:{margin:"0",paddingLeft:"20px",color:"#333",lineHeight:"1.6",fontSize:"14px"}},r.terms.map((e,n)=>t.createElement("li",{key:n,style:{marginBottom:"4px"}},e))))),t.createElement("button",{onClick:o,style:{width:"100%",padding:"18px 20px",backgroundColor:"#F5F5F5",border:"none",borderTop:"1px solid #E5E5E5",fontSize:"16px",fontWeight:"600",color:"#333",cursor:"pointer",textAlign:"center",fontFamily:"'Poppins', sans-serif",flexShrink:0}},"Close")));return w(i,document.body)},zx=({offersToShow:e,offersConfig:n,getOfferCardMessage:r,setSelectedOffer:a,setShowPopup:i})=>{const s=o(null),[d,p]=c(!1),[u,m]=c(!0),[f,g]=c("undefined"!=typeof window&&window.innerWidth<=768),h=()=>{if(s.current){const{scrollLeft:e,scrollWidth:t,clientWidth:n}=s.current;p(e>0),m(e<t-n-10)}};l(()=>{h();const e=s.current;if(e)return e.addEventListener("scroll",h),()=>e.removeEventListener("scroll",h)},[e]),l(()=>{const e=()=>{g(window.innerWidth<=768)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const x=e=>{if(s.current){const t=f?280:365,n=16,r="right"===e?t+n:-(t+n);s.current.scrollBy({left:r,behavior:"smooth"})}};return t.createElement("div",{style:{position:"relative"}},t.createElement("svg",{style:{position:"absolute",width:0,height:0}},t.createElement("defs",null,t.createElement("mask",{id:"coupon-cut-mask-desktop"},t.createElement("rect",{width:"365",height:"138",fill:"white"}),t.createElement("circle",{cx:"80",cy:"0",r:"12",fill:"black"}),t.createElement("circle",{cx:"80",cy:"138",r:"12",fill:"black"})),t.createElement("mask",{id:"coupon-cut-mask-mobile"},t.createElement("rect",{width:"280",height:"120",fill:"white"}),t.createElement("circle",{cx:"60",cy:"0",r:"10",fill:"black"}),t.createElement("circle",{cx:"60",cy:"120",r:"10",fill:"black"})))),d&&t.createElement("button",{onClick:()=>x("left"),style:{position:"absolute",left:"5px",top:"50%",transform:"translateY(-50%)",background:"#fff",border:"1px solid #e0e0e0",borderRadius:"50%",width:"clamp(28px, 5vw, 38px)",height:"clamp(28px, 5vw, 38px)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)",color:"#333"}},t.createElement(M,{size:20})),u&&t.createElement("button",{onClick:()=>x("right"),style:{position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",background:"#fff",border:"1px solid #e0e0e0",borderRadius:"50%",width:"clamp(28px, 5vw, 38px)",height:"clamp(28px, 5vw, 38px)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)",color:"#333"}},t.createElement(j,{size:20})),t.createElement("div",{ref:s,className:"hide-scrollbar",style:{display:"flex",alignItems:"stretch",overflowX:"auto",gap:"16px",scrollbarWidth:"none",msOverflowStyle:"none",minHeight:f?"110px":"128px"}},e?.map(e=>t.createElement("div",{key:e.discountId,style:{flexShrink:0,width:f?"280px":"365px",minWidth:f?"280px":"365px",minHeight:f?"110px":"128px",backgroundColor:"transparent",borderRadius:`${n?.roundness||0}px`,border:"1px solid #e0e0e0",display:"flex",position:"relative",overflow:"visible",mask:`url(#${f?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,WebkitMask:`url(#${f?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,maskImage:`url(#${f?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,WebkitMaskImage:`url(#${f?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`}},t.createElement("div",{style:{width:f?"60px":"80px",minHeight:f?"110px":"128px",backgroundColor:n?.accentColor||"#EE8E35",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:f?"10px 6px":"12px 8px",position:"relative",borderTopLeftRadius:`${n?.roundness||0}px`,borderBottomLeftRadius:`${n?.roundness||0}px`}},t.createElement("div",{style:{position:"absolute",right:"-2px",top:"12px",bottom:"12px",width:"2px",borderLeft:"2px dashed #FFFFFF"}})),n?.iconVisibility&&t.createElement("div",{style:{position:"absolute",left:f?"42.5px":"57.5px",top:"35%",transform:"translateY(-50%)",width:f?"32px":"40px",height:f?"32px":"40px",backgroundColor:"#FFFFFF",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:f?"16px":"20px",color:"#333333",zIndex:10,boxShadow:"0 2px 5px rgba(0,0,0,0.1)",border:"1px solid #E0E0E0"}},"free_product"===e.couponType?t.createElement(U,null):t.createElement(Ao,null)),t.createElement("div",{style:{flex:1,padding:f?"12px 12px":"15px 15px",paddingLeft:f?"25px":"35px",display:"flex",flexDirection:"column",justifyContent:"space-between",borderTopRightRadius:`${n?.roundness||0}px`,borderBottomRightRadius:`${n?.roundness||0}px`,overflow:"hidden",backgroundColor:n?.cardBackgroundColor||"#ffffff",minWidth:0}},t.createElement("div",{style:{display:"flex",flexDirection:"column",gap:f?"4px":"6px",lineHeight:"normal"}},t.createElement("div",{style:{fontSize:f?"9px":"10px",color:"#666666",fontWeight:"400"}},"free_product"===e.couponType?"Free Gift":"Special Deal"),t.createElement("div",{style:{fontSize:f?"13px":"15px",fontWeight:"600",color:n?.textColor||"#2c3e50"}},e.name),t.createElement("div",{style:{fontSize:f?"11px":"12px",color:n?.accentColor||"#EE8E35",wordWrap:"break-word",overflowWrap:"break-word",whiteSpace:"normal",minHeight:f?"28px":"32px"}},r(e))),t.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},t.createElement("div",{style:{borderTop:"1px solid #999999",marginTop:"4px",width:"100%",height:"0",display:"block"}}),t.createElement("a",{href:"#",onClick:t=>{t.preventDefault(),a(e),i(!0)},style:{fontSize:f?"11px":"12px",color:"#2c3e50",fontWeight:"500",textDecoration:"none",cursor:"pointer",textAlign:"center",marginTop:"0"}},n?.viewDetailsTitle||"View Details")))))),t.createElement("style",null,"\n .hide-scrollbar::-webkit-scrollbar {\n display: none;\n }\n .hide-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n "))},Nx=({offersToShow:e,offersConfig:n,getOfferCardMessage:r,setSelectedOffer:o,setShowPopup:a})=>{const[i,s]=c("undefined"!=typeof window&&window.innerWidth<=768);return l(()=>{const e=()=>{s(window.innerWidth<=768)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),t.createElement("div",{style:{borderRadius:`${n?.roundness||8}px`}},e?.map((l,c)=>t.createElement("div",{key:l.discountId,style:{display:"flex",alignItems:"flex-start",gap:i?"8px":"12px",padding:i?"12px 0":"16px 0",paddingLeft:i?"10px":"20px",backgroundColor:!0===n?.cardBackgroundTransparent||"true"===String(n?.cardBackgroundTransparent)?"transparent":n?.cardBackgroundColor||"#ffffff",borderBottom:c<(e?.length||0)-1?"1px solid rgb(225 218 218)":"none",marginBottom:"4px",borderRadius:`${n?.roundness||0}px`}},n?.iconVisibility&&t.createElement("div",{style:{width:i?"40px":"50px",height:i?"40px":"50px",backgroundColor:"#f8f9fa",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:i?"20px":"25px",marginTop:i?"5px":"10px",border:"2px solid #4a4a4a",color:"#4a4a4a"}},"free_product"===l.couponType?t.createElement(U,null):t.createElement(Ao,null)),t.createElement("div",{style:{flex:1}},t.createElement("div",{style:{fontSize:i?"14px":"15px",fontWeight:600,color:"#000000",lineHeight:"1"}},l.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "),":"," ",t.createElement("span",{style:{fontWeight:600,color:n?.textColor||"#34495e"}},l.name)),t.createElement("div",{style:{fontSize:i?"12px":"13px",color:"#7f8c8d",marginBottom:"6px"}},r(l)),t.createElement("div",{style:{fontSize:i?"11px":"12px",color:"#000000"}},"offer auto applied",t.createElement("a",{href:"#",onClick:e=>{e.preventDefault(),o(l),a(!0)},style:{color:n?.accentColor||"#7f8c8d",fontWeight:700,textDecoration:"none",marginLeft:"2px"}},n?.viewDetailsTitle||"T&C"))))))},Ix=e=>{const t="free_product"===e.couponType;let n="";t?n="Get this product for free!":e.discountPercentage?n=`Get ${e.discountPercentage}% off`:e.discountValue&&(n=`Get ${e.discountValue} off`);const r=["Limited Time Offer","Applies automatically when criteria is met"];return"quantity"===e.customCartProgressBarCriteria&&e.quantityThreshold?r.push(`Unlock when you add ${e.quantityThreshold} ${e.quantityThreshold>1?"items":"item"} to cart`):"minimum_order_value"===e.customCartProgressBarCriteria&&e.minimumOrderValue&&r.push(`Unlock at order value of ${e.minimumOrderValue}`),t&&r.push("Combines with other order discounts"),t||r.push("Not applicable if other offer with higher discount applied on same product"),{offerMessage:n,terms:r}},Dx=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",_x=({offersConfig:e,offers:n})=>{const[r,a]=c(!1),[i,s]=c(null),[d,p]=c(null),[u,m]=c("undefined"!=typeof window&&window.innerWidth<=768),[f,g]=c("undefined"!=typeof window&&window.innerWidth<=450),h=o(null);l(()=>{const e=()=>{m(window.innerWidth<=768),g(window.innerWidth<=450)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),l(()=>{h.current&&Xn(h.current)},[e?.sectionBgContrastColor]);const x=(e=>{if(!e||0===e.length)return e;const t={};e.forEach(e=>{const n=e.customCartProgressBarCriteria||"none";t[n]=(t[n]||0)+1});let n="none",r=-1;Object.keys(t).forEach(e=>{t[e]>r&&(r=t[e],n=e)});const o=e.map((e,t)=>({o:e,idx:t})),a=e=>"minimum_order_value"===n?void 0!==e.minimumOrderValue&&null!==e.minimumOrderValue?Number(e.minimumOrderValue):1/0:"quantity"===n&&void 0!==e.quantityThreshold&&null!==e.quantityThreshold?Number(e.quantityThreshold):1/0;return o.sort((e,t)=>{const r=e.o.customCartProgressBarCriteria===n,o=t.o.customCartProgressBarCriteria===n;if(r&&o){const n=a(e.o),r=a(t.o);return n!==r?n-r:e.idx-t.idx}return r&&!o?-1:!r&&o?1:e.idx-t.idx}),o.map(e=>e.o)})(n||[]);return t.createElement("div",null,t.createElement("div",{style:{position:"relative",width:"100%",maxWidth:"450px",borderRadius:"list"===e?.sectionType?`${e?.roundness||0}px`:"0px",boxSizing:"border-box",backgroundColor:e?.sectionBackgroundColor||"#fff"}},t.createElement("div",{style:{border:"coupon"===e?.sectionType?"none":"1px solid rgb(169, 163, 163)",borderTop:"1px solid rgb(169, 163, 163)",padding:null!=e?.cardPadding?`${e.cardPadding}px`:u?"20px 10px 15px":"30px 15px 20px",position:"relative",borderRadius:"list"===e?.sectionType?`${e?.roundness||8}px`:"0px"}},t.createElement("span",{ref:h,className:"yt-product-offers-section-title",style:{position:"absolute",top:"0",left:"left"===e?.alignment?"coupon"===e?.sectionType?"0px":u?"10px":"20px":"right"===e?.alignment?"auto":"50%",right:"right"===e?.alignment?"coupon"===e?.sectionType?"0px":u?"10px":"20px":"auto",transform:"middle"===e?.alignment?"translateX(-50%) translateY(-50%)":"translateY(-50%)",background:e?.sectionBgContrastColor||"#fff",padding:u?"0 8px":"0 10px",fontWeight:"500",fontSize:u?"14px":"16px",textTransform:"uppercase",textAlign:"center"}},e?.sectionTitle||"Available Deals and Offers"),(()=>{const n=e?.sectionType;return"list"===n?t.createElement(Nx,{offersToShow:x,offersConfig:e||{},getOfferCardMessage:Dx,setSelectedOffer:e=>{s(e),e&&p(Ix(e))},setShowPopup:a}):"coupon"===n?t.createElement(zx,{offersToShow:x,offersConfig:e||{},getOfferCardMessage:Dx,setSelectedOffer:e=>{s(e),e&&p(Ix(e))},setShowPopup:a}):null})(),f?t.createElement(Bx,{selectedOffer:i,selectedOfferTerms:d,showPopup:r,offersConfig:e,onClose:()=>{a(!1),s(null),p(null)}}):t.createElement($x,{selectedOffer:i,selectedOfferTerms:d,showPopup:r,offersConfig:e,onClose:()=>{a(!1),s(null),p(null)}}))))};export{Ex as Bundle,Sx as BundleLoader,Hu as Cart,Fa as CouponFrame,Tx as LoyaltyPageBlock,lt as Nudge,_x as ProductOffers,ft as SpinnerWheel};
|