/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{loadFont as e}from"../../core/fontUtils.js";import{getImageData as t}from"../../core/imageUtils.js";class i{constructor(){this._resourceMap=new Map,this._inFlightResourceMap=new Map}destroy(){this._inFlightResourceMap.clear(),this._resourceMap.clear()}getResource(e){return this._resourceMap.get(e)??null}async fetchResource(e,i){const h=this._resourceMap.get(e);if(h)return{width:h.width,height:h.height};let r=this._inFlightResourceMap.get(e);return r?r.then(e=>({width:e.width,height:e.height})):(r=t(e,i),this._inFlightResourceMap.set(e,r),r.then(t=>(this._inFlightResourceMap.delete(e),this._resourceMap.set(e,t),{width:t.width,height:t.height}),()=>({width:0,height:0})))}deleteResource(e){this._inFlightResourceMap.delete(e),this._resourceMap.delete(e)}loadFont(t){return e(t)}}export{i as default};
