/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */
import type { CallbackRef } from '../../__types__';
import { useCallback } from 'react';
import { addEvent, removeEvent } from '#internal/addEvent';
import dispatchCustomEvent from '#internal/dispatchCustomEvent';
import { getModality } from '#internal/modality';
import supportsPointerEvent from '#internal/supportsPointerEvent';
import { useRefCallback } from '#internal/useRefCallback';
/**
 * Types
 */

type HoverConfig = {
  bubbles?: ?boolean,
  disabled?: ?boolean,
  onHoverStart?: ?(e: any) => void,
  onHoverChange?: ?(bool: boolean) => void,
  onHoverUpdate?: ?(e: any) => void,
  onHoverEnd?: ?(e: any) => void,
};
/**
 * Implementation
 */

const opts = {
  passive: true
};
const lockEventType = 'react-gui:hover:lock';
const unlockEventType = 'react-gui:hover:unlock'; // This accounts for the non-PointerEvent fallback events.

declare function getPointerType(event: any): any;
declare export function useHover(config: HoverConfig): CallbackRef;