"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const array = require("./dist-es-utils-array.cjs");
const compareByDepth = require("./dist-es-render-utils-compare-by-depth.cjs");
class FlatTree {
  constructor() {
    this.children = [];
    this.isDirty = false;
  }
  add(child) {
    array.addUniqueItem(this.children, child);
    this.isDirty = true;
  }
  remove(child) {
    array.removeItem(this.children, child);
    this.isDirty = true;
  }
  forEach(callback) {
    this.isDirty && this.children.sort(compareByDepth.compareByDepth);
    this.isDirty = false;
    this.children.forEach(callback);
  }
}
exports.FlatTree = FlatTree;
//# sourceMappingURL=dist-es-render-utils-flat-tree.cjs.map
