text: import {useEffect, useMemo, useState} from "react";
  import {_getMediaManager} from "../lib/media";
  import {useTheme} from "../theme";
  function useMediaIndex() {
    const theme = useTheme();
    const {media} = theme.sanity;
    const manager = useMemo(() => _getMediaManager(media), [media]);
    const [index, setIndex] = useState(manager.getCurrentIndex);
    useEffect(() => manager.subscribe(setIndex), [manager]);
    return index;
  }
  export {
    useMediaIndex
  };
  