"use strict";(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[6530],{36530:(e,t,o)=>{o.d(t,{drawFeats:()=>l});var a=o(90872),n=o(89327),s=o(43800);function f(e,t,o,a,n,s){o<0&&(e+=o,o=-o),a<0&&(t+=a,a=-a),s&&(n.fillStyle=s),n.fillRect(e,t,o,a)}function i(e,t,o,a,n,s){o<0&&(e+=o,o=-o),a<0&&(t+=a,a=-a),s&&(n.strokeStyle=s),n.strokeRect(e,t,o,a)}var r=o(69349);function c(e){let{type:t,v0:o,v1:a,stats:n}=e;if("insertSizeAndOrientation"===t)return(0,r.k5)(o,a,n);if("orientation"===t)return(0,r.uE)(o);if("insertSize"===t)return(0,r.Wh)(o,a,n);if("gradient"===t){const e=Math.min(o.start,a.start),t=Math.max(o.end,a.end);return["hsl(".concat(10*Math.log10(Math.abs(t-e)),",50%,50%)"),"hsl(".concat(10*Math.log10(Math.abs(t-e)),",50%,30%)")]}}function l(e,t){const{chainData:o}=e;if(!o)return;const{assemblyManager:l}=(0,a.getSession)(e),d=(0,a.getContainingView)(e),v=d.assemblyNames[0],m=l.get(v);if(!m)return;(0,n.F)(o)?function(e){var t;let{ctx:o,self:n,chainData:r,view:l,asm:d}=e;const v=[],m=(0,s.getConf)(n,"featureHeight"),h=(null===(t=n.colorBy)||void 0===t?void 0:t.type)||"insertSizeAndOrientation",{chains:x,stats:u}=r;for(const a of x)if(a.length>1){var N,g,P,M;const e=a[0],t=a[1],o=d.getCanonicalRefName(e.refName)||e.refName,n=d.getCanonicalRefName(t.refName)||t.refName,s=null===(N=l.bpToPx({refName:o,coord:e.start}))||void 0===N?void 0:N.offsetPx,f=null===(g=l.bpToPx({refName:o,coord:e.end}))||void 0===g?void 0:g.offsetPx,i=null===(P=l.bpToPx({refName:n,coord:t.start}))||void 0===P?void 0:P.offsetPx,r=null===(M=l.bpToPx({refName:n,coord:t.end}))||void 0===M?void 0:M.offsetPx;let c=0;if(void 0!==s&&void 0!==f&&void 0!==i&&void 0!==r){if(e.refName===t.refName){const o=Math.min(e.start,t.start),a=Math.max(e.end,t.end);c=Math.abs(a-o)}v.push({r1s:s,r1e:f,r2s:i,r2e:r,v0:e,v1:t,distance:c})}}else if(n.drawSingletons){var b,p;const e=a[0],t=d.getCanonicalRefName(e.refName)||e.refName,n=null===(b=l.bpToPx({refName:t,coord:e.start}))||void 0===b?void 0:b.offsetPx,s=null===(p=l.bpToPx({refName:t,coord:e.end}))||void 0===p?void 0:p.offsetPx;if(void 0!==n&&void 0!==s){const e=Math.max(s-n,2);f(n-l.offsetPx,0,e,m,o,"#f00"),i(n-l.offsetPx,0,e,m,o,"#a00")}}const w=Math.log((0,a.max)(v.map((e=>e.distance)))),C=Math.max(Math.log((0,a.min)(v.map((e=>e.distance))))-1,0),T=(n.height-20)/(w-C);for(const{r1e:a,r1s:s,r2e:_,r2s:k,distance:y,v0:S,v1:R}of v){const e=Math.max(a-s,2),t=Math.max(_-k,2),[n,r]=c({type:h,v0:S,v1:R,stats:u})||[],d=(Math.log(y)-C)*T,v=m/2-.5,x=k-a;f(a-l.offsetPx,d+v,x,1,o,"black"),i(s-l.offsetPx,d,e,m,o,r),i(k-l.offsetPx,d,t,m,o,r),f(s-l.offsetPx,d,e,m,o,n),f(k-l.offsetPx,d,t,m,o,n)}}({self:e,view:d,asm:m,ctx:t,chainData:o}):function(e){let{ctx:t,self:o,chainData:n,view:c,asm:l}=e;const d=[],v=[],{chains:m}=n,{height:h}=o,x=(0,s.getConf)(o,"featureHeight");for(const a of m){let e=Number.MAX_VALUE,t=Number.MIN_VALUE;for(const n of a){var u,N;const o=l.getCanonicalRefName(n.refName)||n.refName,a=null===(u=c.bpToPx({refName:o,coord:n.start}))||void 0===u?void 0:u.offsetPx,s=null===(N=c.bpToPx({refName:o,coord:n.end}))||void 0===N?void 0:N.offsetPx;void 0!==a&&void 0!==s&&(e=Math.min(e,a),t=Math.max(t,s))}const o=Math.abs(t-e);d.push(o),v.push(e)}const g=Math.log((0,a.max)(d)),P=Math.max(Math.log((0,a.min)(d))-1,0),M=(h-20)/(g-P),b=x/2-.5;for(let a=0;a<m.length;a++){const e=m[a],o=d[a],n=(Math.log(o)-P)*M;f(v[a]-c.offsetPx,n+b,o,1,t,"black");const s=e[0];let h;var p;if(2048&s.flags)h="-"===(null===(p=s.SA)||void 0===p?void 0:p.split(";")[0].split(",")[2])?-1:1;else h=s.strand;for(const a of e){var w,C;const e=l.getCanonicalRefName(a.refName)||a.refName,o=null===(w=c.bpToPx({refName:e,coord:a.start}))||void 0===w?void 0:w.offsetPx,s=null===(C=c.bpToPx({refName:e,coord:a.end}))||void 0===C?void 0:C.offsetPx;if(void 0!==o&&void 0!==s){const e=Math.max(s-o,2),l=o-c.offsetPx,d=-1===a.strand*h?"color_rev_strand":"color_fwd_strand";i(l,n,e,x,t,r.ue[d]),f(l,n,e,x,t,r.If[d])}}}}({self:e,view:d,asm:m,ctx:t,chainData:o})}},89327:(e,t,o)=>{function a(e){for(const t of e.chains.values())if(1&t[0].flags)return!0;return!1}o.d(t,{F:()=>a})}}]);
//# sourceMappingURL=6530.2ae47531.chunk.js.map