<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import BuilderType from"./BuilderType.js";import Executor from"./Executor.js";import{buffer,createEmpty,extendCoordinate}from"../../extent.js";import{compose as composeTransform,create as createTransform}from"../../transform.js";import{createCanvasContext2D}from"../../dom.js";import{isEmpty}from"../../obj.js";import{numberSafeCompareFunction}from"../../array.js";import{transform2D}from"../../geom/flat/transform.js";var ORDER=[BuilderType.POLYGON,BuilderType.CIRCLE,BuilderType.LINE_STRING,BuilderType.IMAGE,BuilderType.TEXT,BuilderType.DEFAULT],ExecutorGroup=function(){function e(e,r,t,o,i,n){this.maxExtent_=e,this.overlaps_=o,this.pixelRatio_=t,this.resolution_=r,this.renderBuffer_=n,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=createTransform(),this.createExecutors_(i)}return e.prototype.clip=function(e,r){r=this.getClipCoords(r);e.beginPath(),e.moveTo(r[0],r[1]),e.lineTo(r[2],r[3]),e.lineTo(r[4],r[5]),e.lineTo(r[6],r[7]),e.clip()},e.prototype.createExecutors_=function(e){for(var r in e){var t,o=this.executorsByZIndex_[r],i=(void 0===o&amp;&amp;(this.executorsByZIndex_[r]=o={}),e[r]),n=[this.renderBuffer_||0,this.renderBuffer_||0];for(t in i){var a=i[t];o[t]=new Executor(this.resolution_,this.pixelRatio_,this.overlaps_,a,n)}}},e.prototype.hasExecutors=function(e){for(var r in this.executorsByZIndex_)for(var t=this.executorsByZIndex_[r],o=0,i=e.length;o&lt;i;++o)if(e[o]in t)return!0;return!1},e.prototype.forEachFeatureAtCoordinate=function(e,r,t,o,n,a){var i,c,s=2*(o=Math.round(o))+1,l=composeTransform(this.hitDetectionTransform_,o+.5,o+.5,1/r,-1/r,-t,-e[0],-e[1]),u=(this.hitDetectionContext_||(this.hitDetectionContext_=createCanvasContext2D(s,s)),this.hitDetectionContext_),f=(u.canvas.width!==s||u.canvas.height!==s?(u.canvas.width=s,u.canvas.height=s):u.clearRect(0,0,s,s),void 0!==this.renderBuffer_&amp;&amp;(i=createEmpty(),extendCoordinate(i,e),buffer(i,r*(this.renderBuffer_+o),i)),getCircleArray(o));function d(e){for(var r=u.getImageData(0,0,s,s).data,t=0;t&lt;s;t++)for(var o,i=0;i&lt;s;i++)if(f[t][i])if(0&lt;r[4*(i*s+t)+3])return o=void 0,(o=a&amp;&amp;(c==BuilderType.IMAGE||c==BuilderType.TEXT)&amp;&amp;-1===a.indexOf(e)?o:n(e))||void u.clearRect(0,0,s,s)}var p,h,m=Object.keys(this.executorsByZIndex_).map(Number);for(m.sort(numberSafeCompareFunction),p=m.length-1;0&lt;=p;--p)for(var y=m[p].toString(),x=this.executorsByZIndex_[y],v=ORDER.length-1;0&lt;=v;--v)if(void 0!==(h=x[c=ORDER[v]])&amp;&amp;(h=h.executeHitDetection(u,l,t,d,i)))return h},e.prototype.getClipCoords=function(e){var r=this.maxExtent_;if(!r)return null;var t=r[0],o=r[1],i=r[2],r=r[3],t=[t,o,t,r,i,r,i,o];return transform2D(t,0,8,2,e,t),t},e.prototype.isEmpty=function(){return isEmpty(this.executorsByZIndex_)},e.prototype.execute=function(e,r,t,o,i,n,a){for(var c=Object.keys(this.executorsByZIndex_).map(Number),s=(c.sort(numberSafeCompareFunction),this.maxExtent_&amp;&amp;(e.save(),this.clip(e,t)),n||ORDER),l=0,u=c.length;l&lt;u;++l)for(var f=c[l].toString(),d=this.executorsByZIndex_[f],p=0,h=s.length;p&lt;h;++p){var m,y=s[p];void 0!==(m=d[y])&amp;&amp;(!a||y!=BuilderType.IMAGE&amp;&amp;y!=BuilderType.TEXT?m.execute(e,r,t,o,i):(y=a[f])?y.push(m,t.slice(0)):a[f]=[m,t.slice(0)])}this.maxExtent_&amp;&amp;e.restore()},e}(),circleArrayCache={0:[[!0]]};function fillCircleArrayRowToMiddle(e,r,t){var o,i=Math.floor(e.length/2);if(i&lt;=r)for(o=i;o&lt;r;o++)e[o][t]=!0;else if(r&lt;i)for(o=r+1;o&lt;i;o++)e[o][t]=!0}function getCircleArray(e){if(void 0!==circleArrayCache[e])return circleArrayCache[e];for(var r=2*e+1,t=new Array(r),o=0;o&lt;r;o++)t[o]=new Array(r);for(var i=e,n=0,a=0;n&lt;=i;)fillCircleArrayRowToMiddle(t,e+i,e+n),fillCircleArrayRowToMiddle(t,e+n,e+i),fillCircleArrayRowToMiddle(t,e-n,e+i),fillCircleArrayRowToMiddle(t,e-i,e+n),fillCircleArrayRowToMiddle(t,e-i,e-n),fillCircleArrayRowToMiddle(t,e-n,e-i),fillCircleArrayRowToMiddle(t,e+n,e-i),fillCircleArrayRowToMiddle(t,e+i,e-n),0&lt;2*((a+=1+2*++n)-i)+1&amp;&amp;(a+=1-2*--i);return circleArrayCache[e]=t}function replayDeclutter(e,r,t,o,i,n){for(var a=Object.keys(e).map(Number).sort(numberSafeCompareFunction),c=0,s=a.length;c&lt;s;++c)for(var l=e[a[c].toString()],u=void 0,f=0,d=l.length;f&lt;d;){var p=l[f++],h=l[f++];p.execute(r,1,h,t,i),p!==u&amp;&amp;0&lt;p.declutterItems.length&amp;&amp;n.push({items:(u=p).declutterItems,opacity:o})}}export default ExecutorGroup;export{getCircleArray,replayDeclutter};</pre></body></html>