import{a as W,a7 as J}from"./index.a33cbbbf.js";import{J as L,C as P,o as q}from"./rasterProjectionHelper.881d9a5a.js";class F{constructor(n=15e3,t=5e3){this._timer=null,this._cachedBlocks=new Map,this._size=-1,this._duration=n,this._interval=Math.min(n,t)}decreaseRefCount(n,t){const e=n+"/"+t,r=this._cachedBlocks;if(r.has(e)){const o=r.get(e);return o.refCount--,o.refCount<=0&&(r.delete(e),o.controller&&o.controller.abort()),o.refCount}return 0}getBlock(n,t){const e=n+"/"+t,r=this._cachedBlocks;if(r.has(e)){const o=r.get(e);return o.ts=Date.now(),o.refCount++,r.delete(e),r.set(e,o),o.block}return null}putBlock(n,t,e,r){const o=this._cachedBlocks,s=n+"/"+t;if(o.has(s)){const i=o.get(s);i.ts=Date.now(),i.refCount++}else o.set(s,{block:e,ts:Date.now(),refCount:1,controller:r});this._trim(),this._updateTimer()}deleteBlock(n,t){const e=this._cachedBlocks,r=n+"/"+t;e.has(r)&&e.delete(r)}updateMaxSize(n){this._size=n,this._trim()}empty(){this._cachedBlocks.clear(),this._clearTimer()}getCurrentSize(){return this._cachedBlocks.size}_updateTimer(){if(this._timer!=null)return;const n=this._cachedBlocks;this._timer=setInterval(()=>{const t=Array.from(n),e=Date.now();for(let r=0;r=n.size)return;const t=Array.from(n);for(let e=0;ee!=null)||f.delete(l))}function V(l,n,t){var s,i;const e=f.get(l);if(!e)return n==null?d.decreaseRefCount(l,t):0;if(n==null||e[n]==null)return d.decreaseRefCount(l,t);const r=(s=e[n])==null?void 0:s.cache,o=r==null?void 0:r.get(t);if(r&&o){if(o.refCount--,o.refCount===0){r.delete(t);for(let c=0;cs.isResolved=!0).catch(()=>s.isRejected=!0),(i=o[n])==null||i.cache.set(t,s)}function Z(l,n,t){var r;const e=f.get(l);e?n!=null&&e[n]!=null?(r=e[n])==null||r.cache.delete(t):d.deleteBlock(l,t):n==null&&d.deleteBlock(l,t)}function G(l,n){var e;const t=f.get(l);return t&&(e=t[n])!=null?e:null}function ee(l,n,t,e,r,o,s=null){const i=G(l,n);if(!i)return;const c=i.extent,{cache:a,rasterInfo:m}=i;if(c&&c.xmin===t.xmin&&c.xmax===t.xmax&&c.ymin===t.ymin&&c.ymax===t.ymax)return;e=e!=null?e:0;const M=t.clone().normalize(),{spatialReference:R,transform:v}=m,w=new Set;for(let g=0;g0?x.pyramidBlockWidth:x.blockWidth,$=p>0?x.pyramidBlockHeight:x.blockHeight,y=1,H=Math.max(0,Math.floor(k.x/z)-y),S=Math.max(0,Math.floor(k.y/$)-y),A=Math.floor((k.x+j-1)/z)+y,E=Math.floor((k.y+D-1)/$)+y;for(let B=S;B<=E;B++)for(let C=H;C<=A;C++)w.add(`${p}/${B}/${C}`)}a.forEach((g,h)=>{if(!w.has(h)){const u=a.get(h);(u==null||u.isResolved||u.isRejected)&&a.delete(h)}}),i.extent={xmin:t.xmin,ymin:t.ymin,xmax:t.xmax,ymax:t.ymax}}export{O as a,Z as d,U as f,ee as g,Y as h,V as m,Q as u,X as x};