import{Z as e}from"./C9tvkk7Y2.js";var t=(e,t,n=!1)=>(Array.isArray(e)||(e=[e]),t?e.map(e=>typeof e==`string`||n?t(e):e):e),n=new class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(e){return this._cache.has(e)}get(t){let n=this._cache.get(t);return n||e(`[Assets] Asset id ${t} was not found in the Cache`),n}set(n,r){let i=t(n),a;for(let e=0;e<this.parsers.length;e++){let t=this.parsers[e];if(t.test(r)){a=t.getCacheableAssets(i,r);break}}let o=new Map(Object.entries(a||{}));a||i.forEach(e=>{o.set(e,r)});let s=[...o.keys()],c={cacheKeys:s,keys:i};i.forEach(e=>{this._cacheMap.set(e,c)}),s.forEach(t=>{let n=a?a[t]:r;this._cache.has(t)&&this._cache.get(t)!==n&&e(`[Cache] already has key:`,t),this._cache.set(t,o.get(t))})}remove(t){if(!this._cacheMap.has(t)){e(`[Assets] Asset id ${t} was not found in the Cache`);return}let n=this._cacheMap.get(t);n.cacheKeys.forEach(e=>{this._cache.delete(e)}),n.keys.forEach(e=>{this._cacheMap.delete(e)})}get parsers(){return this._parsers}};export{t as n,n as t};