async function onVisible(astroId, _options, getHydrateCallback) {
  var _a, _b;
  const roots = document.querySelectorAll(`astro-root[uid="${astroId}"]`);
  const innerHTML = (_b = (_a = roots[0].querySelector(`astro-fragment`)) == null ? void 0 : _a.innerHTML) != null ? _b : null;
  const cb = async () => {
    const hydrate = await getHydrateCallback();
    for (const root of roots) {
      hydrate(root, innerHTML);
    }
  };
  const io = new IntersectionObserver(([entry]) => {
    if (!entry.isIntersecting)
      return;
    io.disconnect();
    cb();
  });
  for (const root of roots) {
    for (let i = 0; i < root.children.length; i++) {
      const child = root.children[i];
      io.observe(child);
    }
  }
}
export {
  onVisible as default
};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vc3JjL3J1bnRpbWUvY2xpZW50L3Zpc2libGUudHMiXSwKICAibWFwcGluZ3MiOiAiQUFPQSx5QkFBd0MsU0FBaUIsVUFBMEIsb0JBQXdDO0FBUDNIO0FBUUUsUUFBTSxRQUFRLFNBQVMsaUJBQWlCLG1CQUFtQjtBQUMzRCxRQUFNLFlBQVksa0JBQU0sR0FBRyxjQUFjLHNCQUF2QixtQkFBMEMsY0FBMUMsWUFBdUQ7QUFFekUsUUFBTSxLQUFLLFlBQVk7QUFDckIsVUFBTSxVQUFVLE1BQU07QUFDdEIsZUFBVyxRQUFRLE9BQU87QUFDeEIsY0FBUSxNQUFNO0FBQUE7QUFBQTtBQUlsQixRQUFNLEtBQUssSUFBSSxxQkFBcUIsQ0FBQyxDQUFDLFdBQVc7QUFDL0MsUUFBSSxDQUFDLE1BQU07QUFBZ0I7QUFFM0IsT0FBRztBQUNIO0FBQUE7QUFHRixhQUFXLFFBQVEsT0FBTztBQUN4QixhQUFTLElBQUksR0FBRyxJQUFJLEtBQUssU0FBUyxRQUFRLEtBQUs7QUFDN0MsWUFBTSxRQUFRLEtBQUssU0FBUztBQUM1QixTQUFHLFFBQVE7QUFBQTtBQUFBO0FBQUE7IiwKICAibmFtZXMiOiBbXQp9Cg==
