• Build the gear container hierarchy: route each gear item into the container named by its containerId, or into the virtual "On Body" list when its containerId is empty or names no known container.

    allGear is expected to include the containers themselves (as in the sheet), so a top-level container appears both as a ContainerNode and in onBodyItems — matching the existing render behavior.

    Type Parameters

    • T

    Parameters

    • containers: readonly T[]

      The container items, in display order.

    • allGear: readonly T[]

      Every gear item (including containers) to place.

    • getId: (item: T) => undefined | null | string

      Resolves a container's id.

    • getContainerId: (item: T) => undefined | null | string

      Resolves the container id a gear item belongs to.

    Returns ContainerTree<T>

    The containers with their contents and the "On Body" list.