"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[5847],{65847:(e,o,r)=>{r.d(o,{drawDensity:()=>f});var t=r(68584),n=r(99546),c=r(37347),l=r(75429);const a=.3,s=2;function f(e,o){const{stopToken:r,features:f,regions:i,bpPerPx:b,scaleOpts:p,height:u,config:d}=o,g=i[0],C=(0,t.readConfObject)(d,"bicolorPivot"),w=(0,t.readConfObject)(d,"bicolorPivotValue"),h=(0,t.readConfObject)(d,"negColor"),j=(0,t.readConfObject)(d,"posColor"),S=(0,t.readConfObject)(d,"color"),m=(0,t.readConfObject)(d,"clipColor"),v="none"!==C&&"log"!==p.scaleType,O=(0,l.getScale)({...p,pivotValue:v?w:void 0,range:v?[h,"#eee",j]:["#eee",j]}),T="#f0f"===S?(e,o)=>O(o):(e,o)=>(0,t.readConfObject)(d,"color",{feature:e,score:o}),y=(0,l.getScale)({...p,range:[0,u]}).domain(),P=y[0],k=y[1];let _=Number.NEGATIVE_INFINITY,x=!1;const I=[];let N=performance.now();for(const o of f.values()){performance.now()-N>400&&((0,c.SW)(r),N=performance.now());const[t,l]=(0,n.featureSpanPx)(o,g,b);(Math.floor(t)!==Math.floor(_)||l-t>1)&&(I.push(o),_=t);const s=o.get("score");x=x||s>k||s<P;const f=l-t+a;s>=p.domain[0]?(e.fillStyle=T(o,s),e.fillRect(t,0,f,u)):(e.fillStyle="#eee",e.fillRect(t,0,f,u))}if(e.save(),x){e.fillStyle=m;for(const o of f.values()){performance.now()-N>400&&((0,c.SW)(r),N=performance.now());const[t,f]=(0,n.featureSpanPx)(o,g,b),i=f-t+a,u=o.get("score");(u>k||u<P&&"log"!==p.scaleType)&&(0,l.fillRectCtx)(t,0,i,s,e)}}return e.restore(),{reducedFeatures:I}}}}]);
//# sourceMappingURL=5847.696805be.chunk.js.map