(()=>{const e=document.querySelectorAll(".category-card"),t=document.querySelector(".top-categories-grid");if(e.length&&t){e.forEach((e=>{t.appendChild(e)}));const r=new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting&&(e.target.classList.add("is-visible"),r.unobserve(e.target))}))}),{threshold:.15});t.querySelectorAll(".category-card").forEach((e=>r.observe(e)))}})(),(()=>{const e=document.querySelector(".create-account-left"),t=document.querySelector(".create-account-right");if(e&&t){const r=new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting&&(e.target.classList.add("is-visible"),r.unobserve(e.target))}))}),{threshold:.2});r.observe(e),r.observe(t)}})(),(()=>{const e=document.querySelectorAll(".finder-card");if(e.length){const t=new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting&&(e.target.classList.add("is-visible"),t.unobserve(e.target))}))}),{threshold:.15});e.forEach((e=>t.observe(e)))}})(),(()=>{const e=document.querySelectorAll(".theme-image-boxes-wrapper .col");if(e.length){const t=new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting&&(e.target.classList.add("is-visible"),t.unobserve(e.target))}))}),{threshold:.15});e.forEach((e=>t.observe(e)))}})(),(()=>{const e=document.querySelectorAll(".promo-banners a");if(e.length){const t=new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting&&(e.target.classList.add("is-visible"),t.unobserve(e.target))}))}),{threshold:.15});e.forEach((e=>t.observe(e)))}})(),document.querySelectorAll(".tabbed-content").forEach((e=>{const t=e.querySelector(".tabbed-content__tabs"),r=e.querySelector(".tabbed-content__panels"),n=e.querySelector(".tabbed-content__image-img");if(!t||!r)return;document.querySelectorAll(".tabbed-content-panel").forEach((e=>{r.appendChild(e)}));const o=Array.from(r.querySelectorAll(".tabbed-content-panel"));if(!o.length)return;function s(){o.forEach((e=>{e.style.cssText="display:block !important; visibility:hidden !important; position:absolute !important; width:100% !important; animation:none !important;"})),r.offsetHeight;const e=Math.max(...o.map((e=>e.offsetHeight)));o.forEach((e=>{e.style.cssText=""})),r.style.height=`${e}px`}let c;function a(e){const r=o[e];if(n){const e=r.dataset.tabImage||"",t=r.dataset.tabImageAlt||"";n.classList.add("is-swapping"),setTimeout((()=>{n.src=e,n.alt=t,n.classList.remove("is-swapping")}),350)}o.forEach((e=>e.classList.remove("is-active"))),r.classList.add("is-active"),t.querySelectorAll(".tabbed-content__tab").forEach(((t,r)=>{t.classList.toggle("is-active",r===e),t.setAttribute("aria-selected",r===e)}))}"complete"===document.readyState?s():window.addEventListener("load",s,{once:!0}),window.addEventListener("resize",(()=>{clearTimeout(c),c=setTimeout(s,100)})),o.forEach(((e,r)=>{const n=document.createElement("button");n.className="tabbed-content__tab",n.textContent=e.dataset.tabTitle||`Tab ${r+1}`,n.setAttribute("role","tab"),n.setAttribute("aria-selected","false"),n.addEventListener("click",(()=>a(r))),t.appendChild(n)})),a(0);const i=new IntersectionObserver((t=>{t.forEach((t=>{t.isIntersecting&&(e.classList.add("is-visible"),i.unobserve(e))}))}),{threshold:.15});i.observe(e)})),document.querySelectorAll(".catalog-single.custom-brands").forEach((e=>{const t=e.querySelector(":scope > h3"),r=document.querySelector(".header-full .search-form");e.insertAdjacentHTML("afterbegin",`\n
\n
${(null==t?void 0:t.textContent)||"Our Brands"}
\n
Dependable products from trusted manufacturers.
\n
\n
\n `),r&&e.querySelector(".custom-brands-search").appendChild(r.cloneNode(!0)),null==t||t.remove();const n=e.querySelectorAll(".tileparent");if(n.length){const e=new IntersectionObserver((t=>{t.forEach((t=>{t.isIntersecting&&(t.target.classList.add("is-visible"),e.unobserve(t.target))}))}),{threshold:.1});n.forEach((t=>e.observe(t)))}}));const e=()=>{document.querySelectorAll(".product-shopping-actions").forEach((e=>{const t=e.querySelector(".uom"),r=e.querySelector(".product-shopping-actions-prices");t&&r&&r.appendChild(t)}))},t=()=>{document.querySelectorAll(".live-inventory-v2-shipping.out-stock").forEach((e=>{const t=e.querySelector("small"),r=t?t.textContent.replace(/[^0-9/]/g,""):null;e.childNodes.forEach((e=>{e.nodeType===Node.TEXT_NODE&&(e.textContent="Out of Stock")})),t&&r&&(t.textContent=`Stock expected: (${r})`)}))},r=()=>{document.querySelectorAll(".product-shopping-actions").forEach((e=>{const t=e.querySelector(".product-shopping-actions-tierpricing");if(!t)return;const r=t.getAttribute("data-tierpricing");if(!r)return;const n=JSON.parse(r);if(!n||!n.length)return;const o=e.querySelector(".product-shopping-actions-prices .has-price").textContent,s=parseFloat(o.replace(/[^0-9.]/g,"")),c=[...n].sort(((e,t)=>e.quantity-t.quantity)),a=(e,t,r)=>`\n \n
${e}
\n
${t}
\n
${r?`-${r}%`:""}
\n
\n `;let i='\n \n \n
\n \n ';i+=a("1 - "+(c[0].quantity-1),o,0),c.forEach(((e,t)=>{const r=t===c.length-1?`${e.quantity}+`:`${e.quantity} - ${c[t+1].quantity-1}`,n=(o=parseFloat(String(e.price).replace(/[^0-9.]/g,"")),Math.round(100*(1-parseFloat(String(o).replace(/[^0-9.]/g,""))/s)));var o;i+=a(r,e.price,n)})),i+="
",t.insertAdjacentHTML("afterbegin",i);const l=e.querySelector(".inputquantity");if(!l)return;const d=t.querySelectorAll(".custom-quantity-break:not(.custom-quantity-break-header)"),u=()=>{const e=parseInt(l.value,10);!e||e<1||(e=>{let t=0;c.forEach(((r,n)=>{e>=r.quantity&&(t=n+1)})),d.forEach(((e,r)=>{e.classList.toggle("is-active",r===t)}))})(e)};l.addEventListener("change",u),l.addEventListener("input",u),e.querySelectorAll(".incr-btn").forEach((e=>{e.addEventListener("click",(()=>setTimeout(u,0)))}))}))},n=()=>{const e=document.querySelectorAll(".pdp-delivery-timer");if(!e.length)return;const t=(()=>{if(!document.querySelector(".product-shopping-actions.supplier_1001"))return null;const e=new Date,t=new Intl.DateTimeFormat("en-GB",{timeZone:"Europe/London",hour:"numeric",minute:"numeric",weekday:"short",year:"numeric",month:"2-digit",day:"2-digit",hour12:!1}).formatToParts(e),r=Object.fromEntries(t.map((({type:e,value:t})=>[e,t]))),n={Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6,Sun:0}[r.weekday],o=60*parseInt(r.hour,10)+parseInt(r.minute,10),s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],c=new Set(window.UK_BANK_HOLIDAYS||[]),a=new Intl.DateTimeFormat("en-GB",{timeZone:"Europe/London",year:"numeric",month:"2-digit",day:"2-digit"}),i=e=>{const t=Object.fromEntries(a.formatToParts(e).map((({type:e,value:t})=>[e,t])));return`${t.year}-${t.month}-${t.day}`},l=e=>{const t=e.getDay();return 0===t||6===t||c.has(i(e))},d=e=>{const t=new Date(e);for(t.setDate(t.getDate()+1);l(t);)t.setDate(t.getDate()+1);return t},u=e=>`${e.getDate()} ${s[e.getMonth()]} ${e.getFullYear()}`,p=0===n||6===n,m=c.has(i(e)),h=960-o;let y="";if(!p&&!m&&h>0){const t=d(e),r=Math.floor(h/60),n=h%60;y=`Order within ${r>0?`${r}h${n>0?` ${n}m`:""}`.trim():`${n}m`} for earliest delivery ${u(t)}`}else{const t=d(e);y=`Order now for earliest delivery ${u(d(t))}`}return`\n \n
Delivery Info
\n ${y}\n Available on in-stock items only\n \n `})();t&&e.forEach((e=>{e.insertAdjacentHTML("afterbegin",t)}))};document.querySelector(".ex-product")&&(document.querySelector(".has-live-pricing")?document.addEventListener("live-pricing-done",(()=>{console.log("live pricing has just finished running"),e(),r()}),!1):document.addEventListener("DOMContentLoaded",(()=>{e(),r()}),!1),document.querySelector(".has-live-inventory")?document.addEventListener("live-inventory-done",(()=>{console.log("live inventory has just finished running"),t()}),!1):document.addEventListener("DOMContentLoaded",(()=>{t()}),!1),document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll(".product-shopping-actions").forEach((e=>{const t=e.querySelector(".product-shopping-actions-addtoquicklist"),r=e.querySelector(".product-compare-action");t&&r&&(t.classList.remove("col-md-12"),t.parentElement.className="quicklist-comparisons-wrapper",t.insertAdjacentElement("afterend",r))})),document.querySelectorAll(".catalog-single").forEach((e=>{const t=e.querySelector(".product-shopping-actions"),r=e.querySelector(".pdp-delivery-info");r&&t&&t.insertAdjacentElement("beforeend",r)})),document.querySelectorAll(".catalog-single").forEach((e=>{const t=e.querySelector(".product-summary"),r=e.querySelector(".product-shopping-actions .live-inventory-v2-wrapper");if(!t)return;if(r){const e=t.querySelector(".productdetails .prod-code"),n=t.querySelector(".product-indicators"),o=document.createElement("div");o.className="product-summary-top";const s=t.querySelector(".product-title-wrapper");s?s.insertAdjacentElement("afterend",o):t.prepend(o),[e,r,n].forEach((e=>{e&&o.appendChild(e)}))}const n=t.querySelector(".product-brand"),o=t.querySelector(".prod-category");n&&o&&(n.insertAdjacentHTML("afterbegin","Brand "),o.insertAdjacentElement("afterend",n))})),document.querySelectorAll(".catalog-single").forEach((e=>{const t=e.querySelector(".pdp-promo-banner"),r=e.querySelector(".productdetails");t&&r&&r.insertAdjacentElement("beforeend",t)})),n()})));