function autoLoader(){const current_url=window.location.pathname;if(current_url.includes("collections")||current_url.includes("search")){let loadMoreProducts2=function(){fetch(next_url).then(response=>(loadmore_btn.style.display="none",response.text())).then(data=>{var parser=new DOMParser,doc=parser.parseFromString(data,"text/html"),return_html=doc.body,main_html=return_html.querySelector("#product-grid"),main_html_child=main_html.querySelectorAll(".grid__item"),new_url=main_html.getAttribute("data-next-url");new_url&&(document.querySelector("#product-grid").setAttribute("data-next-url",main_html.getAttribute("data-next-url")),loadmore_btn.style.display="none"),document.documentElement.classList.remove("loading"),next_url=new_url;let mainProductWrapper=document.querySelector(".product-grid");setTimeout(()=>{main_html_child.forEach(function(value,index){document.querySelector(".product-grid").append(value)}),productGridSlider(),manageAddToBag(),new_url?(loadmore_btn.style.display="block",document.querySelector("body").classList.remove("loading")):(document.querySelector("body").classList.remove("loading"),loadmore_btn.style.display="block",loadmore_btn.classList.add("ds-no-more-products-left"),loadmore_btn.classList.add("ds-no-more-products-left"),loadmore_btn.textContent="No more products")},600)}).catch(err=>{console.log(err)})};var loadMoreProducts=loadMoreProducts2,products_on_page=document.getElementById("product-grid");console.log(products_on_page);var next_url=products_on_page.getAttribute("data-next-url"),loadmore_btn=document.querySelector(".load-more-cstm-btn");console.log(next_url),document.querySelectorAll("#load-more-cstm-btn").length>0&&(document.querySelector("#load-more-cstm-btn").classList.contains("ds-no-more-products-left")||document.querySelector("#load-more-cstm-btn").addEventListener("click",()=>{setTimeout(loadMoreProducts2,500)}));var btnClick=new Event("click");document.addEventListener("scroll",function(){var collectionTplElm=document.querySelector(".collection_top-wrapper"),collectionTop=window.innerHeight,collectionHeight=collectionTplElm.clientHeight,posTop=collectionTop+collectionHeight-window.innerHeight;window.pageYOffset>posTop-1e3&&window.pageYOffset