/**
 * Pack a body index and generation into a single integer handle.
 *
 * @param {number} index
 * @param {number} generation
 * @returns {number}
 */
export function pack_body_id(index: number, generation: number): number;
/**
 *
 * @param {number} packed
 * @returns {number}
 */
export function body_id_index(packed: number): number;
/**
 *
 * @param {number} packed
 * @returns {number}
 */
export function body_id_generation(packed: number): number;
/**
 * Sentinel returned by {@link BodyStorage#awake_position_of} and friends when a
 * body is not in the awake set.
 * @type {number}
 */
export const BODY_INDEX_ABSENT: number;
/**
 * Structure-of-arrays pool for rigid bodies.
 *
 * Owns:
 *  - per-body identity (entity, generation, kind, flags),
 *  - a dense list of awake body indices (the simulation hot iteration target),
 *  - a min-heap of free body indices so reuse order is deterministic regardless
 *    of how interleaved allocate / free calls have been.
 *
 * The pool grows by doubling when the high-water mark reaches capacity; arrays
 * are replaced wholesale on grow, so callers must not retain references to the
 * raw typed arrays across allocate-after-grow boundaries.
 *
 * Determinism: allocate always reuses the lowest free index. Two pools given the
 * same sequence of allocate/free calls observe identical body indices.
 *
 * @author Alex Goldring
 * @copyright Company Named Limited (c) 2026
 */
export class BodyStorage {
    /**
     *
     * @param {number} [initial_capacity]
     */
    constructor(initial_capacity?: number);
    __capacity: number;
    __count: number;
    __entities: Int32Array;
    __generations: Uint8Array;
    __kinds: Uint8Array;
    __flags: Uint32Array;
    __alive: Uint8Array;
    __awake_list: Uint32Array;
    __awake_pos: Int32Array;
    __awake_count: number;
    __free_heap: Uint32Array;
    __free_count: number;
    __entity_to_index: Map<any, any>;
    /**
     * Currently allocated body count (live, regardless of awake/sleeping).
     * @returns {number}
     */
    get size(): number;
    /**
     * Total slot capacity. Starts at the (power-of-two) default and grows by
     * doubling; a caller-supplied non-power-of-two initial capacity is honoured
     * as-is, so this is not guaranteed to be a power of two.
     * @returns {number}
     */
    get capacity(): number;
    /**
     * Number of awake bodies.
     * @returns {number}
     */
    get awake_count(): number;
    /**
     * High-water mark of slot indices ever issued. Useful when callers maintain
     * per-slot side-tables.
     * @returns {number}
     */
    get high_water_mark(): number;
    /**
     * Allocate a body slot for `entity`. The new body starts in the awake set
     * with default kind {@link BodyKind.Dynamic} and zero flags; the caller
     * may override these via {@link set_kind} / {@link set_flags}.
     *
     * @param {number} entity
     * @returns {number} packed body id
     */
    allocate(entity: number): number;
    /**
     * Release a body slot previously returned by {@link allocate}. Bumps the
     * generation so any old packed id becomes stale.
     *
     * @param {number} packed_body_id
     */
    free(packed_body_id: number): void;
    /**
     *
     * @param {number} packed_body_id
     * @returns {boolean}
     */
    is_valid(packed_body_id: number): boolean;
    /**
     * @param {number} index body index (NOT a packed id)
     * @returns {number} entity for the body, or -1 if the slot is free.
     */
    entity_at(index: number): number;
    /**
     * Body index for `entity`, or {@link BODY_INDEX_ABSENT} if no live body owns
     * it. O(1) reverse of {@link entity_at} — the lookup callers use on the
     * link / attach / joint paths instead of scanning the slot table.
     * @param {number} entity
     * @returns {number}
     */
    index_of_entity(entity: number): number;
    /**
     * @param {number} index
     * @returns {number}
     */
    generation_at(index: number): number;
    /**
     * @param {number} index
     * @returns {BodyKind|number}
     */
    kind_at(index: number): BodyKind | number;
    /**
     * @param {number} index
     * @param {BodyKind|number} kind
     */
    set_kind(index: number, kind: BodyKind | number): void;
    /**
     * @param {number} index
     * @returns {number}
     */
    flags_at(index: number): number;
    /**
     * @param {number} index
     * @param {number} flags
     */
    set_flags(index: number, flags: number): void;
    /**
     * Index of `index` in the awake list, or {@link BODY_INDEX_ABSENT} if asleep.
     * @param {number} index
     * @returns {number}
     */
    awake_position_of(index: number): number;
    /**
     *
     * @param {number} index
     * @returns {boolean}
     */
    is_awake(index: number): boolean;
    /**
     * Read the body index at position `i` in the dense awake list (0-based).
     * @param {number} i
     * @returns {number}
     */
    awake_at(i: number): number;
    /**
     * Add `index` to the awake set if not already present.
     * @param {number} index
     */
    mark_awake(index: number): void;
    /**
     * Remove `index` from the awake set if present.
     * @param {number} index
     */
    mark_sleeping(index: number): void;
    /**
     * Swap-with-last removal at position `pos` in the dense awake list.
     * @private
     * @param {number} pos
     */
    private __awake_remove_at;
    /**
     * @private
     */
    private __grow;
    /**
     * @private
     * @param {number} index
     */
    private __heap_push;
    /**
     * @private
     * @returns {number}
     */
    private __heap_pop;
}
import { BodyKind } from "../ecs/BodyKind.js";
//# sourceMappingURL=BodyStorage.d.ts.map