import { i } from "./chunk-QU433TMZ.js"; import { l } from "./chunk-JQUWFKNU.js"; import { n as n2 } from "./chunk-CC74Y7ET.js"; import { e } from "./chunk-TFHLTN6F.js"; import { n } from "./chunk-IM3LVQXV.js"; import { has } from "./chunk-SPWQ3AWG.js"; // node_modules/@arcgis/core/views/2d/layers/features/support/TileStore.js var h = { added: [], removed: [] }; var n3 = /* @__PURE__ */ new Set(); var r = new e(0, 0, 0, 0); var d = class extends n { constructor(e2) { super(), this._tiles = /* @__PURE__ */ new Map(), this._index = i(9, has("esri-csp-restrictions") ? (e3) => ({ minX: e3.bounds[0], minY: e3.bounds[1], maxX: e3.bounds[2], maxY: e3.bounds[3] }) : [".bounds[0]", ".bounds[1]", ".bounds[2]", ".bounds[3]"]), this.tiles = [], this.tileScheme = e2; } destroy() { this.clear(); } clear() { this.tiles.length = 0, this._tiles.clear(), this._index.clear(); } has(e2) { return this._tiles.has(e2); } get(e2) { return this._tiles.get(e2); } boundsIntersections(e2) { return this._index.search({ minX: e2[0], minY: e2[1], maxX: e2[2], maxY: e2[3] }); } updateTiles(e2) { const t = { added: [], removed: [] }; for (const i2 of e2.added) if (!this.has(i2)) { const e3 = new n2(this.tileScheme, i2); this._tiles.set(i2, e3), this._index.insert(e3), t.added.push(e3); } for (const s of e2.removed) if (this.has(s)) { const e3 = this.get(s); this._tiles.delete(s), this._index.remove(e3), t.removed.push(e3); } this.tiles.length = 0, this._tiles.forEach((e3) => this.tiles.push(e3)), (t.added.length || t.removed.length) && this.emit("update", t); } setViewState(e2) { const t = this.tileScheme.getTileCoverage(e2, 0); if (!t) return; const { spans: o, lodInfo: d2 } = t, { level: l2 } = d2; if (o.length > 0) for (const { row: i2, colFrom: a, colTo: m } of o) for (let e3 = a; e3 <= m; e3++) { const t2 = r.set(l2, i2, d2.normalizeCol(e3), d2.getWorldForColumn(e3)).id; if (n3.add(t2), !this.has(t2)) { const e4 = new n2(this.tileScheme, t2); this._tiles.set(t2, e4), this._index.insert(e4), this.tiles.push(e4), h.added.push(e4); } } for (let s = this.tiles.length - 1; s >= 0; s--) { const e3 = this.tiles[s]; n3.has(e3.id) || (this._tiles.delete(e3.id), this.tiles.splice(s, 1), this._index.remove(e3), h.removed.push(e3)); } (h.added.length || h.removed.length) && this.emit("update", h), l.pool.release(t), n3.clear(), h.added.length = 0, h.removed.length = 0; } }; export { d }; //# sourceMappingURL=chunk-JJ4RRNEA.js.map