async function onMedia(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);
    }
  };
  if (options.value) {
    const mql = matchMedia(options.value);
    if (mql.matches) {
      cb();
    } else {
      mql.addEventListener("change", cb, {once: true});
    }
  }
}
export {
  onMedia as default
};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vc3JjL3J1bnRpbWUvY2xpZW50L21lZGlhLnRzIl0sCiAgIm1hcHBpbmdzIjogIkFBS0EsdUJBQXNDLFNBQWlCLFNBQXlCLG9CQUF3QztBQUx4SDtBQU1FLFFBQU0sUUFBUSxTQUFTLGlCQUFpQixtQkFBbUI7QUFDM0QsUUFBTSxZQUFZLGtCQUFNLEdBQUcsY0FBYyxzQkFBdkIsbUJBQTBDLGNBQTFDLFlBQXVEO0FBRXpFLFFBQU0sS0FBSyxZQUFZO0FBQ3JCLFVBQU0sVUFBVSxNQUFNO0FBQ3RCLGVBQVcsUUFBUSxPQUFPO0FBQ3hCLGNBQVEsTUFBTTtBQUFBO0FBQUE7QUFJbEIsTUFBSSxRQUFRLE9BQU87QUFDakIsVUFBTSxNQUFNLFdBQVcsUUFBUTtBQUMvQixRQUFJLElBQUksU0FBUztBQUNmO0FBQUEsV0FDSztBQUNMLFVBQUksaUJBQWlCLFVBQVUsSUFBSSxDQUFFLE1BQU07QUFBQTtBQUFBO0FBQUE7IiwKICAibmFtZXMiOiBbXQp9Cg==
