/* Scoped to: home-appliances-template-business_counter */
(function() {
  'use strict';
  var componentRoots = document.querySelectorAll('[data-component-slug="home-appliances-template-business_counter"]');
  componentRoots.forEach(function(componentRoot) {
    // Helper to query within component, with fallback to document for sibling elements
    var $ = function(sel) { 
      return componentRoot.querySelector(sel) || document.querySelector('[data-component-slug="home-appliances-template-business_counter"] ~ ' + sel) || document.querySelector(sel);
    };
    var $$ = function(sel) { 
      var results = componentRoot.querySelectorAll(sel);
      return results.length ? results : document.querySelectorAll(sel);
    };
    // Original component JS runs in this scope
    (function () { setTimeout(function () { var CONFIG = { counter1: parseInt("{{counter_1_value}}") || 1500, counter2: parseInt("{{counter_2_value}}") || 250, counter3: parseInt("{{counter_3_value}}") || 50, counter4: parseInt("{{counter_4_value}}") || 99, duration: parseInt("{{animation_duration}}") || 2000, }; var counters = document.querySelectorAll("[data-counter]"); if (!counters.length) return; function easeOutQuart(t) { return 1 - Math.pow(1 - t, 4); } function animateCounter(element, target, duration) { var startTime = null; function step(timestamp) { if (!startTime) startTime = timestamp; var progress = Math.min((timestamp - startTime) / duration, 1); var easedProgress = easeOutQuart(progress); var current = Math.floor(easedProgress * target); element.textContent = current.toLocaleString(); if (progress < 1) { requestAnimationFrame(step); } else { element.textContent = target.toLocaleString(); } } requestAnimationFrame(step); } var observer = new IntersectionObserver( function (entries) { entries.forEach(function (entry) { if (entry.isIntersecting) { var counterEl = entry.target; var counterNum = counterEl.getAttribute("data-counter"); var target = CONFIG["counter" + counterNum]; animateCounter(counterEl, target, CONFIG.duration); observer.unobserve(counterEl); } }); }, { threshold: 0.3 }, ); counters.forEach(function (counter) { observer.observe(counter); }); }, 0); })();
  });
})();