/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../../../core/maybe","../../../../../core/MemCache","../../../../../core/uid","../../lib/StaticFloat32ArrayObject"],(function(e,t,o,r,n){"use strict";const c=o.MIN_PRIORITY+1;let i=function(){function e(e,t,o){this._rctx=e,this._locations=t,this._layout=o,this._cache=e.newCache(`MergedRenderer pool ${r.generateUID()}`,s)}var o=e.prototype;return o.dispose=function(){this._cache.destroy()},o.newBuffer=function(e){const o=e.toString(),r=this._cache.pop(o);if(t.isSome(r)){const e=r.pop();return r.length>0&&this._cache.put(o,r,e.array.byteLength*r.length,c),e}return new n.StaticFloat32ArrayObject(this._rctx,this._locations,this._layout,e)},o.deleteBuffer=function(e){const o=e.array.byteLength,r=e.array.length.toString(),n=this._cache.pop(r);return t.isSome(n)?(n.push(e),this._cache.put(r,n,o*n.length,-1)):this._cache.put(r,[e],o,-1),null},e}();function s(e,t){if(t===o.RemoveMode.ALL)return void e.forEach((e=>e.dispose()));const r=e.pop(),n=e.length*r.array.byteLength;return r.dispose(),n}e.MergedGeometryBufferPool=i,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
