/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","./maybe"],(function(t,e){"use strict";const o=(t,e)=>{const o=Math.floor(e/8),i=e-8*o,s=t[o],n=1<<i;t[o]=s|n},i=(t,e)=>{const o=Math.floor(e/8),i=e-8*o,s=t[o],n=1<<i,l=(s&n)>>i;return t[o]=s&~n|n*(1-l),l};let s=function(){function t(t){this._size=t,this._levels=Math.log2(this._size),this._index=new Uint8Array(Math.ceil(t/8)),this._data=new Array(t),this._lookupTable=new Map}var s=t.prototype;return s.with=function(t,e){return this.has(e)?this.get(e):this.set(e,t(e))},s.has=function(t){return this._lookupTable.has(t)},s.get=function(t){const o=this._lookupTable.get(t),i=e.isSome(o)?this._getData(o):null;return"object"==typeof i?i:null},s.set=function(t,o){const i=this._freeIndex(),s=this._data[i]=e.isSome(o)?o:t;return this._lookupTable.set("object"==typeof s?s.cacheKey:s,i),o},s.clear=function(){for(let t=0;t<this._index.length;t++)this._index[t]=0;for(let t=0;t<this._data.length;t++)this._data[t]=null;this._lookupTable.clear()},s._getData=function(t){const e=(1<<this._levels)-1,i=t;let s=Math.floor((e+i)/2);for(let n=this._levels-1;n>=0;n--)o(this._index,s),s=Math.floor(s/2);return this._data[t]},s._freeIndex=function(){let t=0,e=0;for(let n=0;n<this._levels;n++)e=i(this._index,t),t=2*t+1+e;const o=t-((1<<this._levels)-1),s=this._data[o];if(s){const t="object"==typeof s?s.cacheKey:s;this._lookupTable.delete(t)}return o},t}();t.PLRUCache=s,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
