/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define((function(){"use strict";let t=function(){function t(t){const e=this;e._keys=[],e._values=[],e.length=0,t&&t.forEach((t=>{e.set(t[0],t[1])}))}var e=t.prototype;return e.entries=function(){return[].slice.call(this.keys().map((t=>[t,this.get(t)])))},e.keys=function(){return[].slice.call(this._keys)},e.values=function(){return[].slice.call(this._values)},e.has=function(t){return this._keys.includes(t)},e.get=function(t){const e=this._keys.indexOf(t);return e>-1?this._values[e]:void 0},e.deepGet=function(e){if(!e||!e.length)return null;const s=(e,i)=>null==e?null:i.length?s(e instanceof t?e.get(i[0]):e[i[0]],i.slice(1)):e;return s(this.get(e[0]),e.slice(1))},e.set=function(t,e){const s=this,i=this._keys.indexOf(t);return i>-1?s._values[i]=e:(s._keys.push(t),s._values.push(e),s.length=s._values.length),this},e.sortedSet=function(t,e,s,i){const n=this,h=this._keys.length,u=s||0,r=void 0!==i?i:h-1;if(0===h)return n._keys.push(t),n._values.push(e),n;if(t===this._keys[u])return this._values.splice(u,0,e),this;if(t===this._keys[r])return this._values.splice(r,0,e),this;if(t>this._keys[r])return this._keys.splice(r+1,0,t),this._values.splice(r+1,0,e),this;if(t<this._keys[u])return this._values.splice(u,0,e),this._keys.splice(u,0,t),this;if(u>=r)return this;const l=u+Math.floor((r-u)/2);return t<this._keys[l]?this.sortedSet(t,e,u,l-1):t>this._keys[l]?this.sortedSet(t,e,l+1,r):this},e.size=function(){return this.length},e.clear=function(){const t=this;return t._keys.length=t.length=t._values.length=0,this},e.delete=function(t){const e=this,s=e._keys.indexOf(t);return s>-1&&(e._keys.splice(s,1),e._values.splice(s,1),e.length=e._keys.length,!0)},e.forEach=function(t){this._keys.forEach(((e,s)=>{t(this.get(e),e,s)}))},e.map=function(t){return this.keys().map(((e,s)=>t(this.get(e),e,s)))},e.filter=function(t){const e=this;return e._keys.forEach(((s,i)=>{!1===t(e.get(s),s,i)&&e.delete(s)})),this},e.clone=function(){return new t(this.entries())},t}(),e=function(){function e(e=20){this.maxEntries=e,this.values=new t}var s=e.prototype;return s.delete=function(t){this.values.has(t)&&this.values.delete(t)},s.get=function(t){let e=null;return this.values.has(t)&&(e=this.values.get(t),this.values.delete(t),this.values.set(t,e)),e},s.put=function(t,e){if(this.values.size()>=this.maxEntries){const t=this.values.keys()[0];this.values.delete(t)}this.values.set(t,e)},e}();return function(){function t(t=20){this.maxEntries=t,this._cache=new e(this.maxEntries)}var s=t.prototype;return s.clear=function(){this._cache=new e(this.maxEntries)},s.addToCache=function(t,e){this._cache.put(t,e)},s.removeFromCache=function(t){this._cache.delete(t)},s.getFromCache=function(t){return this._cache.get(t)},t}()}));
