import type { Edge, Node, ReactFlowInstance } from '../xyflow/react.ts';
import type { NodeManifest } from '../schema/node-definition';
import type { PreviewEndpoint, PreviewGraphOverrides } from './createPreviewGraph';
export interface NodeDimensions {
    width: number;
    height: number;
}
export interface ContainerFitGeometry {
    minWidth: number;
    minHeight: number;
    padding?: {
        left?: number;
        right?: number;
        top?: number;
        bottom?: number;
    };
}
export interface ContainerSafeArea {
    x: number;
    y: number;
    width: number;
    height: number;
    padding?: {
        left?: number;
        right?: number;
        top?: number;
        bottom?: number;
    };
}
export interface ContainerSizeChange {
    containerId: string;
    previousSize: NodeDimensions;
    nextSize: NodeDimensions;
}
export interface ContainerResizeMinimums {
    left: number;
    right: number;
    top: number;
    bottom: number;
}
export interface EnsureContainersFitChildrenResult {
    nodes: Node[];
    changes: ContainerSizeChange[];
}
export interface ContainerPlacement {
    containerId: string;
    sourceNodeId?: string;
    targetNodeId?: string;
    mode: 'first-child' | 'sequence';
}
interface ContainerPreviewContext {
    source: PreviewEndpoint;
    sourceHandleType: 'source' | 'target';
    reactFlowInstance: ReactFlowInstance;
}
interface ContainerPreviewOptions {
    isContainerNode?: (node: Node) => boolean;
    allowedContainerId?: string;
    replacedEdge?: Edge;
    getContainerSafeArea?: (containerNode: Node) => ContainerSafeArea | undefined;
    getContainerContinuationTarget?: (context: {
        containerNode: Node;
        sourceNode: Node;
        source: PreviewEndpoint;
        reactFlowInstance: ReactFlowInstance;
    }) => PreviewEndpoint | null | undefined;
    previewNodeSize?: NodeDimensions;
    gap?: number;
    avoidSiblings?: boolean;
    getNodeDimensions?: (node: Node) => NodeDimensions;
}
type SequenceEdgePredicate = (edge: Edge) => boolean;
interface NextNodeContext {
    nodeId: string;
    edges: Edge[];
    nodesById: Map<string, Node>;
    parentId: string | undefined;
}
type NextNodeResolver = (context: NextNodeContext) => string | null | undefined;
export declare const DEFAULT_CONTAINER_WIDTH: number;
export declare const DEFAULT_CONTAINER_HEIGHT: number;
export declare const DEFAULT_CONTAINER_MIN_WIDTH: number;
export declare const DEFAULT_CONTAINER_MIN_HEIGHT: number;
export declare const CONTAINER_FRAME_INSET_PX = 10;
export declare const CONTAINER_SEQUENCE_GAP_PX: number;
export declare function getNodeDimensions(node: Pick<Node, 'width' | 'height' | 'measured' | 'style'>, fallback?: NodeDimensions): NodeDimensions;
export declare function getContainerSafeArea(containerNode: Pick<Node, 'width' | 'height' | 'measured' | 'style'>, fallback?: NodeDimensions): ContainerSafeArea;
export declare function getContainerFitGeometry(): ContainerFitGeometry;
export declare function getContainerResizeMinimums(containerNode: Pick<Node, 'id' | 'width' | 'height' | 'measured' | 'style'>, nodes: Node[], { minWidth, minHeight, ignoredNodeTypes, }?: {
    minWidth?: number;
    minHeight?: number;
    ignoredNodeTypes?: string[];
}): ContainerResizeMinimums;
export declare function isContainerNodeManifest(manifest: Pick<NodeManifest, 'display'> | undefined): boolean;
export declare function ensureContainersFitChildren(nodes: Node[], { containerIds, getContainerFitGeometry: resolveContainerFitGeometry, getNodeDimensions: resolveNodeDimensions, ignoredNodeTypes, includeAncestors, }?: {
    containerIds?: Iterable<string>;
    getContainerFitGeometry?: (containerNode: Node) => ContainerFitGeometry | null | undefined;
    getNodeDimensions?: (node: Node) => NodeDimensions;
    ignoredNodeTypes?: string[];
    includeAncestors?: boolean;
}): EnsureContainersFitChildrenResult;
export declare function getContainerNodeForEdge(sourceNode: Node, targetNode: Node, nodes: Node[]): Node | null;
export declare function collectLinearDownstreamSiblings({ startNodeId, parentId, nodes, edges, isSequenceEdge, getNextNodeId, }: {
    startNodeId: string | undefined;
    parentId: string | undefined;
    nodes: Node[];
    edges: Edge[];
    isSequenceEdge?: SequenceEdgePredicate;
    getNextNodeId?: NextNodeResolver;
}): string[];
export declare function resolveContainerPreview({ source, sourceHandleType, reactFlowInstance, ...options }: ContainerPreviewContext & ContainerPreviewOptions): PreviewGraphOverrides | null;
export declare function fitContainersAndPushSiblings({ nodes, containerIds, getContainerFitGeometry, getNodeDimensions, ignoredNodeTypes, gap, }: {
    nodes: Node[];
    containerIds: Iterable<string>;
    getContainerFitGeometry: (containerNode: Node) => ContainerFitGeometry | null | undefined;
    getNodeDimensions: (node: Node) => NodeDimensions;
    ignoredNodeTypes?: string[];
    gap: number;
}): Node[];
export declare function getContainerPlacement(previewNode: Pick<Node, 'data' | 'parentId'>): ContainerPlacement | null;
export declare function placeContainerNode({ nodes, insertedNode, placement, safeArea, getContainerFitGeometry: resolveContainerFitGeometry, getNodeDimensions: resolveNodeDimensions, gap, downstreamNodeIds, ignoredNodeTypes, edges, }: {
    nodes: Node[];
    insertedNode: Node;
    placement: ContainerPlacement;
    safeArea?: ContainerSafeArea;
    getContainerFitGeometry?: (containerNode: Node) => ContainerFitGeometry | null | undefined;
    getNodeDimensions?: (node: Node) => NodeDimensions;
    gap?: number;
    downstreamNodeIds?: Iterable<string>;
    ignoredNodeTypes?: string[];
    edges?: Edge[];
}): Node[];
export {};
//# sourceMappingURL=container.d.ts.map