import { a } from "./chunk-RMX2AZ4P.js"; import { j } from "./chunk-ALDCDSPV.js"; import { d, e, l2 as l, n2 as n } from "./chunk-Y3WMVFTW.js"; import { r, t } from "./chunk-GZT4BVFP.js"; // node_modules/@arcgis/core/core/CollectionFlattener.js var l2 = class extends a(j) { constructor(t2) { super(t2), this.getCollections = null; } initialize() { this.handles.add(l(() => this._refresh())); } destroy() { this.getCollections = null; } _refresh() { const t2 = r(this.getCollections) ? this.getCollections() : null; if (t(t2)) return void this.removeAll(); let o = 0; for (const s of t2) r(s) && (o = this._processCollection(o, s)); this.splice(o, this.length); } _createNewInstance(t2) { return new j(t2); } _processCollection(t2, o) { if (!o) return t2; const s = this.itemFilterFunction ? this.itemFilterFunction : (t3) => !!t3; for (const r2 of o) if (r2) { if (s(r2)) { const o2 = this.indexOf(r2, t2); o2 >= 0 ? o2 !== t2 && this.reorder(r2, t2) : this.add(r2, t2), ++t2; } if (this.getChildrenFunction) { const o2 = this.getChildrenFunction(r2); if (Array.isArray(o2)) for (const s2 of o2) t2 = this._processCollection(t2, s2); else t2 = this._processCollection(t2, o2); } } return t2; } }; e([d()], l2.prototype, "getCollections", void 0), e([d()], l2.prototype, "getChildrenFunction", void 0), e([d()], l2.prototype, "itemFilterFunction", void 0), l2 = e([n("esri.core.CollectionFlattener")], l2); var p = l2; export { p }; //# sourceMappingURL=chunk-V7H6CJ37.js.map