function f({
  trackingObjects: t,
  chatAppId: c,
  getMessageById: a,
  onMessageVisible: g
}) {
  const d = (e) => {
    e.forEach((n) => {
      if (n.isIntersecting) {
        const s = n.target.id, v = s.startsWith("msg-") ? s.slice(4) : s, i = a(v);
        i && g(i);
      }
    });
  }, l = {
    root: document.getElementById("feed-container-" + c),
    rootMargin: "5px",
    threshold: 0
  }, o = new IntersectionObserver(d, l), r = () => {
    t.value && t.value.forEach((e) => o.observe(e));
  };
  return {
    observer: o,
    observeMessages: r,
    restartObserving: () => {
      r();
    }
  };
}
export {
  f as useFeedMessageVisibility
};
