/**
 * Stage 3 port of Base UI React's `FloatingTreeStore`
 * (`packages/react/src/floating-ui-react/components/FloatingTreeStore.ts`).
 *
 * Stores and manages floating elements in a tree structure. Used as the
 * backing store for the `FloatingTree` component, and consumed by the
 * `useDismiss` / nested `useHover` paths (Stage 4) to traverse parent /
 * child relationships.
 *
 * Port notes:
 * - The React source uses a plain mutable `nodesRef: RefObject<Array<...>>`
 *   for the node list. The Solid port keeps the exact same shape —
 *   `MutableRef<FloatingNodeType[]>` — so call sites (`tree.nodesRef.current`)
 *   look identical. This is a ref-like, not a signal: consumers that need
 *   reactivity subscribe to the `events` emitter for `"addnode"` /
 *   `"removenode"` instead. Matches React (the original has no signal-style
 *   subscription either; `FloatingTree` itself is just a context carrier).
 * - Events are emitted via the same shared `createEventEmitter` utility.
 */

import { createEventEmitter } from "../utils/create-event-emitter.jsx";
export class FloatingTreeStore {
  nodesRef = {
    current: []
  };
  events = createEventEmitter();
  addNode(node) {
    this.nodesRef.current.push(node);
  }
  removeNode(node) {
    const index = this.nodesRef.current.indexOf(node);
    if (index !== -1) {
      this.nodesRef.current.splice(index, 1);
    }
  }
}
//# sourceMappingURL=floating-tree-store.jsx.map
