import '../../../assert/js/assert.js';
import '../../../tandem/js/PhetioIDUtils.js';
import '../../../globals.js';
import TEmitter from '../../../axon/js/TEmitter.js';
import Vector2 from '../../../dot/js/Vector2.js';
import { EmptySelfOptions } from '../../../phet-core/js/optionize.js';
import PickOptional from '../../../phet-core/js/types/PickOptional.js';
import PhetioObject, { PhetioObjectOptions } from '../../../tandem/js/PhetioObject.js';
import IOType from '../../../tandem/js/types/IOType.js';
import { BatchedDOMEventCallback, BatchedDOMEventType, Display, EventContext, Mouse, Node, PDOMPointer, Pointer, SceneryEvent, Trail, WindowTouch } from '../imports.js';
declare const domEventPropertiesToSerialize: readonly ["altKey", "button", "charCode", "clientX", "clientY", "code", "ctrlKey", "deltaMode", "deltaX", "deltaY", "deltaZ", "key", "keyCode", "metaKey", "pageX", "pageY", "pointerId", "pointerType", "scale", "shiftKey", "target", "type", "relatedTarget", "which"];
type SerializedPropertiesForDeserialization = typeof domEventPropertiesToSerialize[number];
type SerializedDOMEvent = {
    constructorName: string;
} & {
    [key in SerializedPropertiesForDeserialization]?: unknown;
};
type SelfOptions = EmptySelfOptions;
export type InputOptions = SelfOptions & PickOptional<PhetioObjectOptions, 'tandem'>;
export default class Input extends PhetioObject {
    readonly display: Display;
    readonly rootNode: Node;
    readonly attachToWindow: boolean;
    readonly batchDOMEvents: boolean;
    readonly assumeFullWindow: boolean;
    readonly passiveEvents: boolean | null;
    pdomPointer: PDOMPointer | null;
    mouse: Mouse | null;
    pointers: Pointer[];
    pointerAddedEmitter: TEmitter<[Pointer]>;
    currentlyFiringEvents: boolean;
    currentSceneryEvent: SceneryEvent | null;
    private batchedEvents;
    private upTimeStamp;
    private readonly validatePointersAction;
    private readonly mouseUpAction;
    private readonly mouseDownAction;
    private readonly mouseMoveAction;
    private readonly mouseOverAction;
    private readonly mouseOutAction;
    private readonly wheelScrollAction;
    private readonly touchStartAction;
    private readonly touchEndAction;
    private readonly touchMoveAction;
    private readonly touchCancelAction;
    private readonly penStartAction;
    private readonly penEndAction;
    private readonly penMoveAction;
    private readonly penCancelAction;
    private readonly gotPointerCaptureAction;
    private readonly lostPointerCaptureAction;
    private readonly focusinAction;
    private readonly focusoutAction;
    private readonly clickAction;
    private readonly inputAction;
    private readonly changeAction;
    private readonly keydownAction;
    private readonly keyupAction;
    static readonly InputIO: IOType<Input, any, any>;
    /**
     * @param display
     * @param attachToWindow - Whether to add listeners to the window (instead of the Display's domElement).
     * @param batchDOMEvents - If true, most event types will be batched until otherwise triggered.
     * @param assumeFullWindow - We can optimize certain things like computing points if we know the display
     *                                     fills the entire window.
     * @param passiveEvents - See Display's documentation (controls the presence of the passive flag for
     *                                       events, which has some advanced considerations).
     *
     * @param [providedOptions]
     */
    constructor(display: Display, attachToWindow: boolean, batchDOMEvents: boolean, assumeFullWindow: boolean, passiveEvents: boolean | null, providedOptions?: InputOptions);
    /**
     * Interrupts any input actions that are currently taking place (should stop drags, etc.)
     *
     * If excludePointer is provided, it will NOT be interrupted along with the others
     */
    interruptPointers(excludePointer?: Pointer | null): void;
    /**
     * Called to batch a raw DOM event (which may be immediately fired, depending on the settings). (scenery-internal)
     *
     * @param context
     * @param batchType - See BatchedDOMEvent's "enumeration"
     * @param callback - Parameter types defined by the batchType. See BatchedDOMEvent for details
     * @param triggerImmediate - Certain events can force immediate action, since browsers like Chrome
     *                                     only allow certain operations in the callback for a user gesture (e.g. like
     *                                     a mouseup to open a window).
     */
    batchEvent(context: EventContext, batchType: BatchedDOMEventType, callback: BatchedDOMEventCallback, triggerImmediate: boolean): void;
    /**
     * Fires all of our events that were batched into the batchedEvents array. (scenery-internal)
     */
    fireBatchedEvents(): void;
    /**
     * Clears any batched events that we don't want to process. (scenery-internal)
     *
     * NOTE: It is HIGHLY recommended to interrupt pointers and remove non-Mouse pointers before doing this, as
     * otherwise it can cause incorrect state in certain types of listeners (e.g. ones that count how many pointers
     * are over them).
     */
    clearBatchedEvents(): void;
    /**
     * Checks all pointers to see whether they are still "over" the same nodes (trail). If not, it will fire the usual
     * enter/exit events. (scenery-internal)
     */
    validatePointers(): void;
    /**
     * Removes all non-Mouse pointers from internal tracking. (scenery-internal)
     */
    removeTemporaryPointers(): void;
    /**
     * Hooks up DOM listeners to whatever type of object we are going to listen to. (scenery-internal)
     */
    connectListeners(): void;
    /**
     * Removes DOM listeners from whatever type of object we were listening to. (scenery-internal)
     */
    disconnectListeners(): void;
    /**
     * Extract a {Vector2} global coordinate point from an arbitrary DOM event. (scenery-internal)
     */
    pointFromEvent(domEvent: MouseEvent | WindowTouch): Vector2;
    /**
     * Adds a pointer to our list.
     */
    private addPointer;
    /**
     * Removes a pointer from our list. If we get future events for it (based on the ID) it will be ignored.
     */
    private removePointer;
    /**
     * Given a pointer's ID (given by the pointer/touch specifications to be unique to a specific pointer/touch),
     * returns the given pointer (if we have one).
     *
     * NOTE: There are some cases where we may have prematurely "removed" a pointer.
     */
    private findPointerById;
    private getPDOMEventTrail;
    /**
     * Initializes the Mouse object on the first mouse event (this may never happen on touch devices).
     */
    private initMouse;
    private ensureMouse;
    /**
     * Initializes the accessible pointer object on the first pdom event.
     */
    private initPDOMPointer;
    private ensurePDOMPointer;
    /**
     * Steps to dispatch a pdom-related event. Before dispatch, the PDOMPointer is initialized if it
     * hasn't been created yet and a userGestureEmitter emits to indicate that a user has begun an interaction.
     */
    private dispatchPDOMEvent;
    /**
     * From a DOM Event, get its relatedTarget and map that to the scenery Node. Will return null if relatedTarget
     * is not provided, or if relatedTarget is not under PDOM, or there is no associated Node with trail id on the
     * relatedTarget element. (scenery-internal)
     *
     * @param domEvent - DOM Event, not a SceneryEvent!
     */
    getRelatedTargetTrail(domEvent: FocusEvent | MouseEvent): Trail | null;
    /**
     * Get the trail ID of the node represented by a DOM element who is the target of a DOM Event in the accessible PDOM.
     * This is a bit of a misnomer, because the domEvent doesn't have to be under the PDOM. Returns null if not in the PDOM.
     */
    private getTrailFromPDOMEvent;
    /**
     * Triggers a logical mousedown event. (scenery-internal)
     *
     * NOTE: This may also be called from the pointer event handler (pointerDown) or from things like fuzzing or
     * playback. The event may be "faked" for certain purposes.
     */
    mouseDown(id: number, point: Vector2, context: EventContext<MouseEvent | PointerEvent>): void;
    /**
     * Triggers a logical mouseup event. (scenery-internal)
     *
     * NOTE: This may also be called from the pointer event handler (pointerUp) or from things like fuzzing or
     * playback. The event may be "faked" for certain purposes.
     */
    mouseUp(point: Vector2, context: EventContext<MouseEvent | PointerEvent>): void;
    /**
     * Triggers a logical mousemove event. (scenery-internal)
     *
     * NOTE: This may also be called from the pointer event handler (pointerMove) or from things like fuzzing or
     * playback. The event may be "faked" for certain purposes.
     */
    mouseMove(point: Vector2, context: EventContext<MouseEvent | PointerEvent>): void;
    /**
     * Triggers a logical mouseover event (this does NOT correspond to the Scenery event, since this is for the display) (scenery-internal)
     */
    mouseOver(point: Vector2, context: EventContext<MouseEvent | PointerEvent>): void;
    /**
     * Triggers a logical mouseout event (this does NOT correspond to the Scenery event, since this is for the display) (scenery-internal)
     */
    mouseOut(point: Vector2, context: EventContext<MouseEvent | PointerEvent>): void;
    /**
     * Triggers a logical mouse-wheel/scroll event. (scenery-internal)
     */
    wheel(context: EventContext<WheelEvent>): void;
    /**
     * Triggers a logical touchstart event. This is called for each touch point in a 'raw' event. (scenery-internal)
     *
     * NOTE: This may also be called from the pointer event handler (pointerDown) or from things like fuzzing or
     * playback. The event may be "faked" for certain purposes.
     */
    touchStart(id: number, point: Vector2, context: EventContext<TouchEvent | PointerEvent>): void;
    /**
     * Triggers a logical touchend event. This is called for each touch point in a 'raw' event. (scenery-internal)
     *
     * NOTE: This may also be called from the pointer event handler (pointerUp) or from things like fuzzing or
     * playback. The event may be "faked" for certain purposes.
     */
    touchEnd(id: number, point: Vector2, context: EventContext<TouchEvent | PointerEvent>): void;
    /**
     * Triggers a logical touchmove event. This is called for each touch point in a 'raw' event. (scenery-internal)
     *
     * NOTE: This may also be called from the pointer event handler (pointerMove) or from things like fuzzing or
     * playback. The event may be "faked" for certain purposes.
     */
    touchMove(id: number, point: Vector2, context: EventContext<TouchEvent | PointerEvent>): void;
    /**
     * Triggers a logical touchcancel event. This is called for each touch point in a 'raw' event. (scenery-internal)
     *
     * NOTE: This may also be called from the pointer event handler (pointerCancel) or from things like fuzzing or
     * playback. The event may be "faked" for certain purposes.
     */
    touchCancel(id: number, point: Vector2, context: EventContext<TouchEvent | PointerEvent>): void;
    /**
     * Triggers a logical penstart event (e.g. a stylus). This is called for each pen point in a 'raw' event. (scenery-internal)
     *
     * NOTE: This may also be called from the pointer event handler (pointerDown) or from things like fuzzing or
     * playback. The event may be "faked" for certain purposes.
     */
    penStart(id: number, point: Vector2, context: EventContext<PointerEvent>): void;
    /**
     * Triggers a logical penend event (e.g. a stylus). This is called for each pen point in a 'raw' event. (scenery-internal)
     *
     * NOTE: This may also be called from the pointer event handler (pointerUp) or from things like fuzzing or
     * playback. The event may be "faked" for certain purposes.
     */
    penEnd(id: number, point: Vector2, context: EventContext<PointerEvent>): void;
    /**
     * Triggers a logical penmove event (e.g. a stylus). This is called for each pen point in a 'raw' event. (scenery-internal)
     *
     * NOTE: This may also be called from the pointer event handler (pointerMove) or from things like fuzzing or
     * playback. The event may be "faked" for certain purposes.
     */
    penMove(id: number, point: Vector2, context: EventContext<PointerEvent>): void;
    /**
     * Triggers a logical pencancel event (e.g. a stylus). This is called for each pen point in a 'raw' event. (scenery-internal)
     *
     * NOTE: This may also be called from the pointer event handler (pointerCancel) or from things like fuzzing or
     * playback. The event may be "faked" for certain purposes.
     */
    penCancel(id: number, point: Vector2, context: EventContext<PointerEvent>): void;
    /**
     * Handles a pointerdown event, forwarding it to the proper logical event. (scenery-internal)
     */
    pointerDown(id: number, type: string, point: Vector2, context: EventContext<PointerEvent>): void;
    /**
     * Handles a pointerup event, forwarding it to the proper logical event. (scenery-internal)
     */
    pointerUp(id: number, type: string, point: Vector2, context: EventContext<PointerEvent>): void;
    /**
     * Handles a pointercancel event, forwarding it to the proper logical event. (scenery-internal)
     */
    pointerCancel(id: number, type: string, point: Vector2, context: EventContext<PointerEvent>): void;
    /**
     * Handles a gotpointercapture event, forwarding it to the proper logical event. (scenery-internal)
     */
    gotPointerCapture(id: number, type: string, point: Vector2, context: EventContext): void;
    /**
     * Handles a lostpointercapture event, forwarding it to the proper logical event. (scenery-internal)
     */
    lostPointerCapture(id: number, type: string, point: Vector2, context: EventContext): void;
    /**
     * Handles a pointermove event, forwarding it to the proper logical event. (scenery-internal)
     */
    pointerMove(id: number, type: string, point: Vector2, context: EventContext<PointerEvent>): void;
    /**
     * Handles a pointerover event, forwarding it to the proper logical event. (scenery-internal)
     */
    pointerOver(id: number, type: string, point: Vector2, context: EventContext<PointerEvent>): void;
    /**
     * Handles a pointerout event, forwarding it to the proper logical event. (scenery-internal)
     */
    pointerOut(id: number, type: string, point: Vector2, context: EventContext<PointerEvent>): void;
    /**
     * Handles a pointerenter event, forwarding it to the proper logical event. (scenery-internal)
     */
    pointerEnter(id: number, type: string, point: Vector2, context: EventContext<PointerEvent>): void;
    /**
     * Handles a pointerleave event, forwarding it to the proper logical event. (scenery-internal)
     */
    pointerLeave(id: number, type: string, point: Vector2, context: EventContext<PointerEvent>): void;
    /**
     * Handles a focusin event, forwarding it to the proper logical event. (scenery-internal)
     */
    focusIn(context: EventContext<FocusEvent>): void;
    /**
     * Handles a focusout event, forwarding it to the proper logical event. (scenery-internal)
     */
    focusOut(context: EventContext<FocusEvent>): void;
    /**
     * Handles an input event, forwarding it to the proper logical event. (scenery-internal)
     */
    input(context: EventContext<Event | InputEvent>): void;
    /**
     * Handles a change event, forwarding it to the proper logical event. (scenery-internal)
     */
    change(context: EventContext): void;
    /**
     * Handles a click event, forwarding it to the proper logical event. (scenery-internal)
     */
    click(context: EventContext<MouseEvent>): void;
    /**
     * Handles a keydown event, forwarding it to the proper logical event. (scenery-internal)
     */
    keyDown(context: EventContext<KeyboardEvent>): void;
    /**
     * Handles a keyup event, forwarding it to the proper logical event. (scenery-internal)
     */
    keyUp(context: EventContext<KeyboardEvent>): void;
    /**
     * When we get an unknown pointer event type (allowed in the spec, see
     * https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType), we'll try to guess the pointer type
     * so that we can properly start/end the interaction. NOTE: this can happen for an 'up' where we received a
     * proper type for a 'down', so thus we need the detection.
     */
    private handleUnknownPointerType;
    /**
     * Given a pointer reference, hit test it and determine the Trail that the pointer is over.
     */
    private getPointerTrail;
    /**
     * Called for each logical "up" event, for any pointer type.
     */
    private upEvent;
    /**
     * Called for each logical "down" event, for any pointer type.
     */
    private downEvent;
    /**
     * Called for each logical "move" event, for any pointer type.
     */
    private moveEvent;
    /**
     * Called for each logical "cancel" event, for any pointer type.
     */
    private cancelEvent;
    /**
     * Dispatches any necessary events that would result from the pointer's trail changing.
     *
     * This will send the necessary exit/enter events (on subtrails that have diverged between before/after), the
     * out/over events, and if flagged a move event.
     *
     * @param pointer
     * @param context
     * @param sendMove - Whether to send move events
     * @returns - The current trail of the pointer
     */
    private branchChangeEvents;
    /**
     * Triggers 'enter' events along a trail change, and an 'over' event on the leaf.
     *
     * For example, if we change from a trail [ a, b, c, d, e ] => [ a, b, x, y ], it will fire:
     *
     * - enter x
     * - enter y
     * - over y (bubbles)
     *
     * @param pointer
     * @param event
     * @param trail - The "new" trail
     * @param branchIndex - The first index where the old and new trails have a different node. We will notify
     *                               for this node and all "descendant" nodes in the relevant trail.
     * @param lastNodeChanged - If the last node didn't change, we won't sent an over event.
     */
    private enterEvents;
    /**
     * Triggers 'exit' events along a trail change, and an 'out' event on the leaf.
     *
     * For example, if we change from a trail [ a, b, c, d, e ] => [ a, b, x, y ], it will fire:
     *
     * - out e (bubbles)
     * - exit c
     * - exit d
     * - exit e
     *
     * @param pointer
     * @param event
     * @param trail - The "old" trail
     * @param branchIndex - The first index where the old and new trails have a different node. We will notify
     *                               for this node and all "descendant" nodes in the relevant trail.
     * @param lastNodeChanged - If the last node didn't change, we won't sent an out event.
     */
    private exitEvents;
    /**
     * Dispatch to all nodes in the Trail, optionally bubbling down from the leaf to the root.
     *
     * @param trail
     * @param type
     * @param pointer
     * @param context
     * @param bubbles - If bubbles is false, the event is only dispatched to the leaf node of the trail.
     * @param fireOnInputDisabled - Whether to fire this event even if nodes have inputEnabled:false
     */
    private dispatchEvent;
    /**
     * Notifies an array of listeners with a specific event.
     *
     * @param pointer
     * @param listeners - Should be a defensive array copy already.
     * @param type
     * @param inputEvent
     */
    private dispatchToListeners;
    /**
     * Dispatch to all nodes in the Trail, optionally bubbling down from the leaf to the root.
     *
     * @param trail
     * @param type
     * @param pointer
     * @param inputEvent
     * @param bubbles - If bubbles is false, the event is only dispatched to the leaf node of the trail.
     * @param [fireOnInputDisabled]
     */
    private dispatchToTargets;
    /**
     * Saves the main information we care about from a DOM `Event` into a JSON-like structure. To support
     * polymorphism, all supported DOM event keys that scenery uses will always be included in this serialization. If
     * the particular Event interface for the instance being serialized doesn't have a certain property, then it will be
     * set as `null`. See domEventPropertiesToSerialize for the full list of supported Event properties.
     *
     * @returns - see domEventPropertiesToSerialize for list keys that are serialized
     */
    static serializeDomEvent(domEvent: Event): SerializedDOMEvent;
    /**
     * From a serialized dom event, return a recreated window.Event (scenery-internal)
     */
    static deserializeDomEvent(eventObject: SerializedDOMEvent): Event;
    /**
     * Convenience function for logging out a point/event combination.
     *
     * @param point - Not logged if null
     * @param domEvent
     */
    private static debugText;
    /**
     * Maps the current MS pointer types onto the pointer spec. (scenery-internal)
     */
    static msPointerType(event: PointerEvent): string;
}
export {};
//# sourceMappingURL=Input.d.ts.map