import { useMemo, useRef } from 'react';
import { useNetwork } from "ahooks";
var useIsLowSpeedNetwork = function useIsLowSpeedNetwork() {
  var networkState = useNetwork();
  var isLowSpeedNetwork = useRef(false);

  // 低速网络
  var isLowSpeedNetworkMemo = useMemo(function () {
    return ['slow-2g', '2g', '3g'].includes((networkState === null || networkState === void 0 ? void 0 : networkState.effectiveType) || '') || ((networkState === null || networkState === void 0 ? void 0 : networkState.downlink) || 20) <= 1 || ((networkState === null || networkState === void 0 ? void 0 : networkState.rtt) || 0) > 500;
  }, [networkState]);
  isLowSpeedNetwork.current = isLowSpeedNetworkMemo;
  return isLowSpeedNetwork;
};
export default useIsLowSpeedNetwork;