/**
 * @license
 * Copyright 2022-2024 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { ElementTag } from "../index.js";
import { Model } from "./Model.js";
/**
 * Children of a model.  This is a {@link Model} array with some specialization for model-specific operations.
 *
 * @template T the type of model that owns the children
 */
export interface Children<T extends Model = Model> extends Array<T> {
    /**
     * Add children.
     *
     * Operates like a standard array push but we adjust the type to allow insertion of elements as well as models.
     */
    push(...children: Model.Definition<T>[]): number;
    /**
     * Array splice.
     *
     * Allows splicing in elements or models.
     */
    splice(index: number, deleteCount?: number, ...toAdd: Model.Definition<T>[]): T[];
    /**
     * Access a model of specific type by ID or name.  This is an optimized operation that uses internal index lookup.
     */
    get<C extends Model.ChildOf<T>>(type: Model.Type<C>, idOrName: number | string): C | undefined;
    /**
     * Access all models of a specific type, optionally filtered to a specific ID or number.  Even if filtered there
     * may be multiple return values if there are different variants of the element defined.
     */
    all<C extends Model.ChildOf<T>>(type: Model.Type<C>, idOrName?: number | string): C[];
    /**
     * Access a model using a {@link Children.Selector}.  This is an optimized primitive used by various tree traversal
     * algorithms.
     */
    select(selector: Children.Selector, allowedTags?: Children.TagSelector, except?: Set<Model>): Model.ChildOf<T> | undefined;
    /**
     * Like {@link select} but retrieves all models for which selection applies.
     */
    selectAll(selector: Children.Selector, allowedTags?: Children.TagSelector, except?: Set<Model>): Model.ChildOf<T>[];
    /**
     * Models invoke this when their ID changes so we can update internal bookkeeping.
     */
    updateId(child: Model, oldId: number | undefined): void;
    /**
     * Models invoke this when their name changes so we can update internal bookkeeping.
     */
    updateName(child: Model, oldName: string): void;
    /**
     * Freeze the set of children.
     */
    freeze(): void;
}
/**
 * Invoked by {@link Model} to instantiate a new child array.
 */
export declare function Children<T extends Model = Model>(initial: Children.InputIterable<T>, adopt: (child: Model) => void, disown: (child: Model) => boolean): Children<T>;
export declare namespace Children {
    /**
     * A model selector designates models for retrieval.  It may be a model name, number, or a predicate function.
     */
    type Selector = string | number | ((child: Model) => boolean);
    /**
     * A tag selector filters models based on type.  It may be a tag name, a list of tag names, or "*" or undefined to
     * disable type filtering.
     */
    type TagSelector = undefined | ElementTag | "*" | ElementTag[];
    /**
     * An iterable of input definitions.
     */
    type InputIterable<T extends Model> = Iterable<Model.Definition<T>>;
}
//# sourceMappingURL=Children.d.ts.map