/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
class t{constructor(t){this.size=0,this._start=0,this.maxSize=t,this._buffer=new Array(t)}get entries(){return this._buffer}enqueue(t){if(this.size===this.maxSize){const s=this._buffer[this._start];return this._buffer[this._start]=t,this._start=(this._start+1)%this.maxSize,s}return this._buffer[(this._start+this.size++)%this.maxSize]=t,null}dequeue(){if(0===this.size)return null;const t=this._buffer[this._start];return this._buffer[this._start]=null,this.size--,this._start=(this._start+1)%this.maxSize,t}peek(){return 0===this.size?null:this._buffer[this._start]}peekLast(){return 0===this.size?null:this._buffer[(this._start+(this.size-1))%this.maxSize]}find(t){if(0===this.size)return null;for(const s of this._buffer)if(null!=s&&t(s))return s;return null}clear(t){let s=this.dequeue();for(;null!=s;)t&&t(s),s=this.dequeue()}}export{t as default};
