"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[5524],{15524:(e,o,t)=>{t.d(o,{drawXY:()=>u});var r=t(68584),n=t(99546),a=t(87485),c=t(37347),s=t(75429);function l(e,o){const t=e.toHsl(),r=t.l*(1+o);return(0,a.M)({...t,l:(0,n.clamp)(r,0,100)})}function f(e,o){const t=e.toHsl(),r=t.l*(1-o);return(0,a.M)({...t,l:(0,n.clamp)(r,0,100)})}const i=.3,m=2;function u(e,o){const{features:t,bpPerPx:u,regions:p,scaleOpts:g,height:x,config:h,ticks:w,displayCrossHatches:d,offset:S=0,colorCallback:b,inverted:C}=o,M=p[0],v=(M.end-M.start)/u,y=x-2*S,k=(0,r.readConfObject)(h,"filled"),P=(0,r.readConfObject)(h,"clipColor"),R=(0,r.readConfObject)(h,"summaryScoreMode"),T=(0,r.readConfObject)(h,"bicolorPivotValue"),j=(0,r.readConfObject)(h,"minSize"),O=(0,s.getScale)({...g,range:[0,y],inverted:C}),W=(0,s.getOrigin)(g.scaleType),H=O.domain(),_=H[0],I=H[1],N=e=>(0,n.clamp)(y-(O(e)||0),0,y)+S,E=e=>k?(e=>N(W)-N(e))(e):Math.max(j,1);let F=!1,V=Number.NEGATIVE_INFINITY;const Y=[],z=_<T&&I>T;let A=performance.now();if("whiskers"===R){let o,r;A=performance.now();for(const f of t.values()){performance.now()-A>400&&((0,c.SW)(),A=performance.now());const[t,m]=(0,n.featureSpanPx)(f,M,u);if(f.get("summary")){const n=Math.max(m-t+i,j),c=f.get("maxScore"),u=b(f,c),p=z?u:u===o?r:r=l((0,a.M)(u),.4).toHex();(0,s.fillRectCtx)(t,N(c),n,E(c),e,p),o=u}}r=void 0,o=void 0,A=performance.now();for(const l of t.values()){performance.now()-A>400&&((0,c.SW)(),A=performance.now());const[t,f]=(0,n.featureSpanPx)(l,M,u),m=l.get("score"),p=l.get("maxScore"),g=l.get("minScore"),x=l.get("summary"),h=b(l,m),w=z&&x?h===o?r:r=(0,a.M)(b(l,p)).mix((0,a.M)(b(l,g))).toString():h,d=Math.max(f-t+i,j);Math.floor(t)!==Math.floor(V)&&(Y.push(l),V=t),F=F||m<_||m>I,(0,s.fillRectCtx)(t,N(m),d,E(m),e,w),o=h}r=void 0,o=void 0,A=performance.now();for(const l of t.values()){performance.now()-A>400&&((0,c.SW)(),A=performance.now());const[t,m]=(0,n.featureSpanPx)(l,M,u);if(l.get("summary")){const n=l.get("minScore"),c=b(l,n),u=Math.max(m-t+i,j),p=z?c:c===o?r:r=f((0,a.M)(c),.4).toHex();(0,s.fillRectCtx)(t,N(n),u,E(n),e,p),o=c}}}else{A=performance.now();for(const o of t.values()){performance.now()-A>400&&((0,c.SW)(),A=performance.now());const[t,r]=(0,n.featureSpanPx)(o,M,u);Math.floor(t)!==Math.floor(V)&&(Y.push(o),V=t);const a=o.get("score"),l=b(o,a);F=F||a<_||a>I;const f=Math.max(r-t+i,j);if("max"===R){const r=o.get("summary")?o.get("maxScore"):a;(0,s.fillRectCtx)(t,N(r),f,E(r),e,l)}else if("min"===R){const r=o.get("summary")?o.get("minScore"):a;(0,s.fillRectCtx)(t,N(r),f,E(r),e,l)}else(0,s.fillRectCtx)(t,N(a),f,E(a),e,l)}}if(e.save(),F){e.fillStyle=P,A=performance.now();for(const o of t.values()){performance.now()-A>400&&((0,c.SW)(),A=performance.now());const[t,r]=(0,n.featureSpanPx)(o,M,u),a=r-t+i,l=o.get("score");l>I?(0,s.fillRectCtx)(t,S,a,m,e):l<_&&"log"!==g.scaleType&&(0,s.fillRectCtx)(t,x,a,m,e)}}return e.restore(),d&&(e.lineWidth=1,e.strokeStyle="rgba(200,200,200,0.5)",w.values.forEach((o=>{e.beginPath(),e.moveTo(0,Math.round(N(o))),e.lineTo(v,Math.round(N(o))),e.stroke()}))),{reducedFeatures:Y}}}}]);
//# sourceMappingURL=5524.4d3a2a8f.chunk.js.map