import { Component, FieldDescriptor } from "../../pageModel";
import type { BridgeGeometrySnapshot, SerializablePageStructure } from "../../bridge/protocol";
export type OverlayRect = {
    x: number;
    y: number;
    width: number;
    height: number;
};
/**
 * Overlay frames (selection frame, drag parent outline) extend this many
 * pixels beyond the measured component rect on every side.
 */
export declare const FRAME_OUTSET = 2;
export type OverlayMetrics = {
    scrollLeft: number;
    scrollTop: number;
    scrollScale: number;
    visualScale: number;
    viewportWidth: number;
    viewportHeight: number;
    scrollWidth: number;
    scrollHeight: number;
};
type DOMRectLike = Pick<DOMRect, "left" | "top" | "width" | "height">;
export declare function getOverlayScrollMetrics(_iframe: HTMLIFrameElement | null | undefined, scrollScale: number, visualScale: number): Pick<OverlayMetrics, "scrollLeft" | "scrollTop" | "scrollScale" | "visualScale">;
export declare function getOverlayMetrics(iframe: HTMLIFrameElement | null | undefined, scrollScale: number, visualScale: number): OverlayMetrics;
export declare function toOverlayRect(viewportRect: DOMRectLike, metrics: OverlayMetrics): OverlayRect;
export declare function rectEquals(a: OverlayRect | null | undefined, b: OverlayRect | null | undefined, tolerance?: number): boolean;
export declare function rectListEquals(a: readonly OverlayRect[] | null | undefined, b: readonly OverlayRect[] | null | undefined, tolerance?: number): boolean;
export declare function getTextNodeAtOffset(root: Node, offset: number, affinity?: "forward" | "backward"): {
    node: Text;
    offset: number;
} | null;
export declare function createRangeFromTextOffsets(iframeDocument: Document, root: Node, start: number, end: number): Range | null;
export declare function measureTextRangeRects(iframeDocument: Document, root: Node, start: number, end: number, metrics: OverlayMetrics): OverlayRect[];
export declare function measureCollapsedTextOffsetRect(iframeDocument: Document, root: Node, offset: number, metrics: OverlayMetrics): OverlayRect | null;
export declare function measureElementRect(element: Element | null | undefined, metrics: OverlayMetrics): OverlayRect | null;
/**
 * Find the bridge geometry target for a component (carries its `elementKey` and
 * raw host-viewport rect). Used by the sibling-shift preview to address elements
 * inside the iframe and size the gap.
 */
export declare function findBridgeComponentTarget(geometry: BridgeGeometrySnapshot | undefined, component: Component): import("../../..").BridgeGeometryTarget | null;
export declare function measureBridgeComponentRect(geometry: BridgeGeometrySnapshot | undefined, component: Component, metrics: OverlayMetrics): {
    rect: OverlayRect;
    elements: never[];
} | null;
export declare function measureBridgePlaceholderRect(geometry: BridgeGeometrySnapshot | undefined, placeholderKey: string, metrics: OverlayMetrics): {
    rect: OverlayRect;
    target: import("../../..").BridgeGeometryTarget;
} | null;
export declare function measureBridgeFieldRect(geometry: BridgeGeometrySnapshot | undefined, structure: SerializablePageStructure | undefined, fieldDescriptor: FieldDescriptor, metrics: OverlayMetrics): OverlayRect | null;
export declare function measureBridgeTextRangeRects(geometry: BridgeGeometrySnapshot | undefined, key: string, metrics: OverlayMetrics): OverlayRect[];
export declare function bridgeRectToOverlayRect(geometry: BridgeGeometrySnapshot, rect: BridgeGeometrySnapshot["targets"][number]["rect"], metrics: OverlayMetrics): OverlayRect;
/**
 * Map a point expressed in the host iframe's viewport coordinate space - the
 * same space `getBoundingClientRect` uses inside the host, i.e. the space of
 * the measured target rects - into overlay/document space.
 *
 * Used for pointer coordinates forwarded by the bridge host during a canvas
 * drag gesture. It reuses {@link bridgeRectToOverlayRect} (which already folds
 * in scroll plus the rect/scroll/visual scales) by treating the point as a
 * zero-size rect, so scroll is never added twice.
 */
export declare function hostViewportToOverlay(point: {
    x: number;
    y: number;
}, geometry: BridgeGeometrySnapshot, metrics: OverlayMetrics): {
    x: number;
    y: number;
};
/**
 * Map a parent-document client point (e.g. a pointer/drag event over the
 * iframe) into overlay/document space so it can be compared with computed zone
 * positions.
 *
 * The overlay layer is only translated (by the scaled scroll); its children are
 * positioned at coordinates that already include the visual scale. So mapping a
 * client point is just its offset from the layer's on-screen origin - there is
 * no scale to divide out and no scroll term to add (both are already baked into
 * the layer's rect and the zone positions). Pass the overlay *layer* element's
 * bounding rect.
 */
export declare function clientToOverlay(clientX: number, clientY: number, overlayLayerRect: Pick<DOMRect, "left" | "top">): {
    x: number;
    y: number;
};
export {};
