// import { h } from '@stencil/core';
var listeners = [];
var visible = [];
var observer = new IntersectionObserver(function (entries, observer) {
    entries.forEach(function (e) {
        if (e.intersectionRatio > 0) {
            if (visible.indexOf(e.target) < 0) {
                visible.push(e.target);
            }
        }
        else {
            visible.splice(visible.indexOf(e.target), 1);
        }
    });
    listeners.forEach(function (l) { return l({ entries: entries, observer: observer, visible: visible }); });
}, { threshold: [0, 1] });
var addListener = function (listener) { return listeners.push(listener); };
var removeListener = function (listener) { return listeners.splice(listeners.indexOf(listener), 1); };
var observe = function (el) { return el && observer.observe(el); };
var IntersectionHelper = /*#__PURE__*/ Object.freeze({
    __proto__: null,
    observer: observer,
    addListener: addListener,
    removeListener: removeListener,
    observe: observe
});
export { IntersectionHelper as I, addListener as a, observe as o };
