"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[3304],{63304:(e,t,n)=>{n.d(t,{drawFeats:()=>f});var o=n(99546),r=n(36917),s=n(80544),a=n(91476);function i(e){return 2*Math.random()*e-e}function l(e,t,n,o){e.strokeStyle=o,e.beginPath(),e.moveTo(t,0),e.lineTo(t,n),e.stroke()}function f(e,t,n,f){const{chainData:d,colorBy:c,drawInter:g,drawLongRange:h,lineWidthSetting:b,jitterVal:m}=e;if(!d)return;const u=(0,o.getContainingView)(e),{assemblyManager:k}=(0,o.getSession)(e),{chains:S,stats:y}=d,P=(0,a.d)(d),p=k.get(u.assemblyNames[0]),v=c?.type||"insertSizeAndOrientation";if(p){t.lineWidth=b;for(const e of S)if(1===e.length&&h){const t=e[0];if(!P||8&t.flags){const e=[t,...(0,s.featurizeSA)(t.SA,t.id,t.strand,t.name)].sort(((e,t)=>e.clipPos-t.clipPos));for(let t=0;t<e.length-1;t++)w(e[t],e[t+1],p,!0)}else w(t,{refName:t.next_ref||"",start:t.next_pos||0,end:t.next_pos||0,strand:t.strand},p,!0)}else{const t=P?e.filter((e=>!(2048&e.flags||8&e.flags))):e.sort(((e,t)=>e.clipPos-t.clipPos)).filter((e=>!(256&e.flags)));for(let e=0;e<t.length-1;e++)w(t[e],t[e+1],p,!1)}}function w(e,n,o,s){const a=e.strand,d=n.strand,c=-1===d,h=-1===a?e.start:e.end,b=P?c?n.start:n.end:c?n.end:n.start,k=o.getCanonicalRefName(e.refName)||e.refName,S=o.getCanonicalRefName(n.refName)||n.refName,p=u.bpToPx({refName:k,coord:h})?.offsetPx,w=u.bpToPx({refName:S,coord:b})?.offsetPx;if(void 0!==p&&void 0!==w){const o=(w-p)/2,c=Math.abs(o),g=p-u.offsetPx,h=w-u.offsetPx,b=c>1e4;s&&b?(t.moveTo(g,0),t.beginPath()):(t.beginPath(),t.moveTo(g,0)),s&&b?t.strokeStyle="red":P?"insertSizeAndOrientation"===v?t.strokeStyle=(0,r.sY)(e,n,y)[0]:"orientation"===v?t.strokeStyle=(0,r.DW)(e)[0]:"insertSize"===v?t.strokeStyle=(0,r.L9)(e,n,y)?.[0]||"grey":"gradient"===v&&(t.strokeStyle=`hsl(${10*Math.log10(c)},50%,50%)`):"orientation"===v||"insertSizeAndOrientation"===v?t.strokeStyle=-1===a&&1===d?"navy":1===a&&-1===d?"green":"grey":"gradient"===v&&(t.strokeStyle=`hsl(${10*Math.log10(c)},50%,50%)`);const k=g+2*o,S=Math.min(f+i(m),c);s?c>1e5?(l(t,g+i(m),f,"red"),l(t,h+i(m),f,"red")):b?(t.arc(g+o+i(m),0,c,0,Math.PI),t.stroke()):(t.bezierCurveTo(g+i(m),S,k,S,k+i(m),0),t.stroke()):(t.bezierCurveTo(g+i(m),S,k,S,k+i(m),0),t.stroke())}else p&&g&&l(t,p-u.offsetPx,f,"purple")}}},91476:(e,t,n)=>{function o(e){for(const t of e.chains.values())if(1&t[0].flags)return!0;return!1}n.d(t,{d:()=>o})}}]);
//# sourceMappingURL=3304.65e5d8dd.chunk.js.map