/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{estimateNumberMemory as s}from"../../../../core/memoryEstimations.js";import{r as t}from"../../../../chunks/rbush.js";import{create as e}from"../../../../geometry/support/aaBoundingBox.js";class n{static fromReader(s){const o=[],r=s.copy(),i=e();for(;r.next();){r.getBounds(i)&&o.push(r.getIndex())}const m=t(9,s=>(r.setIndex(s),{minX:r.getBoundsXMin(),minY:r.getBoundsYMin(),maxX:r.getBoundsXMax(),maxY:r.getBoundsYMax()}));return m.load(o),new n(m,o.length)}constructor(s,t){this._index=s,this._size=t}get usedMemory(){return this._size*s}search(s){const t={minX:s[0],minY:s[1],maxX:s[2],maxY:s[3]};return this._index.search(t)}}export{n as FeatureSpatialIndex};
