import { j } from "./chunk-ALDCDSPV.js"; import { d, e, n2 as n, y3 as y } from "./chunk-Y3WMVFTW.js"; import { q } from "./chunk-GZT4BVFP.js"; // node_modules/@arcgis/core/core/Handles.js var h = class extends y { constructor(r) { super(r), this._groups = new Map(); } destroy() { this.removeAll(); } get size() { let r = 0; return this._groups.forEach((e2) => { r += e2.length; }), r; } add(r, e2) { if (!this._isHandle(r) && !Array.isArray(r) && !j.isCollection(r)) return this; const t = this._getOrCreateGroup(e2); return Array.isArray(r) || j.isCollection(r) ? r.forEach((r2) => this._isHandle(r2) && t.push(r2)) : t.push(r), this.notifyChange("size"), this; } forEach(r, e2) { if (typeof r == "function") this._groups.forEach((e3) => e3.forEach(r)); else { const s = this._getGroup(r); s && e2 && s.forEach(e2); } } has(r) { return this._groups.has(this._ensureGroupKey(r)); } remove(r) { if (Array.isArray(r) || j.isCollection(r)) return r.forEach(this.remove, this), this; if (!this.has(r)) return this; const e2 = this._getGroup(r); for (let s = 0; s < e2.length; s++) e2[s].remove(); return this._deleteGroup(r), this.notifyChange("size"), this; } removeAll() { return this._groups.forEach((r) => { for (let e2 = 0; e2 < r.length; e2++) r[e2].remove(); }), this._groups.clear(), this.notifyChange("size"), this; } _isHandle(r) { return r && !!r.remove; } _getOrCreateGroup(r) { if (this.has(r)) return this._getGroup(r); const e2 = []; return this._groups.set(this._ensureGroupKey(r), e2), e2; } _getGroup(r) { return q(this._groups.get(this._ensureGroupKey(r))); } _deleteGroup(r) { return this._groups.delete(this._ensureGroupKey(r)); } _ensureGroupKey(r) { return r || "_default_"; } }; e([d({ readOnly: true })], h.prototype, "size", null), h = e([n("esri.core.Handles")], h); var u = h; export { u }; //# sourceMappingURL=chunk-NE3ESGA6.js.map