import { addUniqueItem, removeItem } from "./dist-es-utils-array.js";
import { compareByDepth } from "./dist-es-render-utils-compare-by-depth.js";
class FlatTree {
  constructor() {
    this.children = [];
    this.isDirty = false;
  }
  add(child) {
    addUniqueItem(this.children, child);
    this.isDirty = true;
  }
  remove(child) {
    removeItem(this.children, child);
    this.isDirty = true;
  }
  forEach(callback) {
    this.isDirty && this.children.sort(compareByDepth);
    this.isDirty = false;
    this.children.forEach(callback);
  }
}
export {
  FlatTree
};
//# sourceMappingURL=dist-es-render-utils-flat-tree.js.map
