import { FlowBlock, Layout, LayoutSourceIdentity, LayoutStoryLocator, Measure, SourceAnchor } from '../../../../../layout-engine/contracts/src/index.js';
import { LayoutFragmentOpaqueRange, LayoutHit, LayoutRangeMapping, PmOpaqueRange, PageGeometryHelper, Point, PositionHit } from '../../../../../layout-engine/layout-bridge/src/index.js';
/**
 * Project an editor-neutral `LayoutHit` into the v1 `PositionHit` shape.
 *
 * Today the neutral substrate carries `legacyPm` for every hit that
 * resolved against a PM-aware fragment. v1 callers can therefore continue
 * to consume `PositionHit` while interacting with the neutral entry points.
 *
 * Returns `null` when the neutral hit could not be projected — typically
 * because the underlying fragment did not carry `pmStart`/`pmEnd` (which
 * surfaces as a `pm-position-unavailable` diagnostic on the neutral hit).
 * Callers should treat `null` as the same "no v1 mapping" signal they get
 * from the existing `clickToPositionGeometry` path.
 */
export declare function layoutHitToPositionHit(hit: LayoutHit | null | undefined): PositionHit | null;
/**
 * Editor-neutral pointer hit resolution.
 *
 * Mirrors {@link resolvePointerPositionHit} from
 * `presentation-editor/input/PositionHitResolver` but returns a
 * `LayoutHit` (with `legacyPm` populated for v1 callers). This is additive
 * — `resolvePointerPositionHit` keeps the historical signature and v1 call
 * sites are not switched today.
 */
export declare function resolvePointerLayoutHit(options: {
    layout: Layout;
    blocks: FlowBlock[];
    measures: Measure[];
    containerPoint: Point;
    domContainer?: HTMLElement | null;
    clientX?: number;
    clientY?: number;
    geometryHelper?: PageGeometryHelper;
}): LayoutHit | null;
/**
 * Map a v1 PM selection range onto editor-neutral fragment subranges.
 *
 * Wraps `mapRangeToFragmentsNeutral` and supplies `selectionToRects` as the
 * PM-rect producer so callers do not need to know about that internal
 * dependency. Existing v1 selection painting continues to call
 * `selectionToRects` directly; this entry point is additive and used by
 * future neutral consumers and by tests proving parity.
 */
export declare function mapPmRangeToLayoutFragments(layout: Layout, blocks: FlowBlock[], measures: Measure[], range: PmOpaqueRange): LayoutRangeMapping;
/**
 * Variant overload for already-known fragment ids — useful when a future
 * neutral consumer holds opaque fragment identifiers and wants their
 * page-positioned rectangles back.
 */
export declare function mapFragmentIdsToLayoutFragments(layout: Layout, blocks: FlowBlock[], measures: Measure[], range: LayoutFragmentOpaqueRange): LayoutRangeMapping;
/**
 * Result of reading a rendered element's identity through the explicit
 * compatibility helper.
 *
 * The neutral fields (`fragmentId`, `blockRef`, `story`) come from the
 * `data-layout-*` datasets stamped by DomPainter (prep-001). The legacy
 * `pm` field is the existing `data-pm-start`/`data-pm-end` pair, preserved
 * so v1 consumers do not need to fork their reads.
 */
export type RenderedElementIdentity = {
    fragmentId?: string;
    blockRef?: string;
    story?: LayoutStoryLocator;
    sourceAnchor?: SourceAnchor;
    pm?: {
        start: number;
        end: number;
    };
};
/**
 * Read both the neutral identity datasets and the legacy PM datasets from a
 * rendered element.
 *
 * v1 consumers that today reach for `dataset.pmStart` / `dataset.pmEnd`
 * directly can call this helper to pick up the parallel neutral identity
 * without rewriting their hot paths. The function is intentionally cheap —
 * just dataset reads, no DOM walks.
 *
 * `data-pm-*` reads remain available regardless of whether neutral datasets
 * are present.
 */
export declare function readRenderedElementIdentity(element: HTMLElement | null | undefined): RenderedElementIdentity;
/**
 * Read the nearest neutral identity from `element` or any of its ancestors
 * up to (and including) `container`.
 *
 * Returns `undefined` when no element in the chain carries a usable neutral
 * identity. Callers that still need PM positions should fall back to
 * `data-pm-*` (which {@link readRenderedElementIdentity} continues to
 * expose).
 */
export declare function findNearestRenderedElementIdentity(element: HTMLElement | null | undefined, container?: HTMLElement | null): LayoutSourceIdentity | undefined;
/**
 * Find a rendered element by neutral `LayoutFragmentId`.
 *
 * v1 today locates elements by PM range via {@link DomPositionIndex}.
 * Neutral consumers should locate elements by fragment id; this helper is
 * the explicit adapter they call. Returns the first element whose
 * `data-layout-fragment-id` matches, or `null`.
 */
export declare function findElementByLayoutFragmentId(container: HTMLElement | null | undefined, fragmentId: string | null | undefined): HTMLElement | null;
//# sourceMappingURL=LayoutHitV1Compat.d.ts.map