"use strict";(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[8550],{18550:function(e,a,t){t.r(a),t.d(a,{drawFeats:function(){return c}});var o=t(81073),r=t(71124),n=t(96234),f=t(41361),i=t(9077);function s(e,a,t,o,r,n){t<0&&(e+=t,t=-t),o<0&&(a+=o,o=-o),n&&(r.fillStyle=n),r.fillRect(e,a,t,o)}function l(e,a,t,o,r,n){t<0&&(e+=t,t=-t),o<0&&(a+=o,o=-o),n&&(r.strokeStyle=n),r.strokeRect(e,a,t,o)}var v=t(58203);function d(e){var a=e.type,t=e.v0,o=e.v1,r=e.stats;if("insertSizeAndOrientation"===a)return(0,v.k5)(t,o,r);if("orientation"===a)return(0,v.uE)(t);if("insertSize"===a)return(0,v.Wh)(t,o,r);if("gradient"===a){var n=Math.min(t.start,o.start),f=Math.max(t.end,o.end);return["hsl(".concat(10*Math.log10(Math.abs(f-n)),",50%,50%)"),"hsl(".concat(10*Math.log10(Math.abs(f-n)),",50%,30%)")]}}function c(e,a){var t=e.chainData;if(t){var c=(0,o.getSession)(e).assemblyManager,h=(0,o.getContainingView)(e),m=h.assemblyNames[0],u=c.get(m);if(u)(0,r.F)(t)?function(e){var a,t,r=e.ctx,v=e.self,c=e.chainData,h=e.view,m=e.asm,u=[],x=(0,i.getConf)(v,"featureHeight"),g=(null===(a=v.colorBy)||void 0===a?void 0:a.type)||"insertSizeAndOrientation",N=c.chains,P=c.stats,M=(0,f.Z)(N);try{for(M.s();!(t=M.n()).done;){var b=t.value;if(b.length>1){var p,y,w,C,T=b[0],_=b[1],k=m.getCanonicalRefName(T.refName)||T.refName,S=m.getCanonicalRefName(_.refName)||_.refName,R=null===(p=h.bpToPx({refName:k,coord:T.start}))||void 0===p?void 0:p.offsetPx,A=null===(y=h.bpToPx({refName:k,coord:T.end}))||void 0===y?void 0:y.offsetPx,Z=null===(w=h.bpToPx({refName:S,coord:_.start}))||void 0===w?void 0:w.offsetPx,D=null===(C=h.bpToPx({refName:S,coord:_.end}))||void 0===C?void 0:C.offsetPx,z=0;if(void 0!==R&&void 0!==A&&void 0!==Z&&void 0!==D){if(T.refName===_.refName){var E=Math.min(T.start,_.start),F=Math.max(T.end,_.end);z=Math.abs(F-E)}u.push({r1s:R,r1e:A,r2s:Z,r2e:D,v0:T,v1:_,distance:z})}}else if(v.drawSingletons){var V,j,H=b[0],I=m.getCanonicalRefName(H.refName)||H.refName,L=null===(V=h.bpToPx({refName:I,coord:H.start}))||void 0===V?void 0:V.offsetPx,O=null===(j=h.bpToPx({refName:I,coord:H.end}))||void 0===j?void 0:j.offsetPx;if(void 0!==L&&void 0!==O){var U=Math.max(O-L,2);s(L-h.offsetPx,0,U,x,r,"#f00"),l(L-h.offsetPx,0,U,x,r,"#a00")}}}}catch(ce){M.e(ce)}finally{M.f()}for(var B=Math.log((0,o.max)(u.map((function(e){return e.distance})))),W=Math.max(Math.log((0,o.min)(u.map((function(e){return e.distance}))))-1,0),X=(v.height-20)/(B-W),q=0,G=u;q<G.length;q++){var J=G[q],K=J.r1e,Q=J.r1s,Y=J.r2e,$=J.r2s,ee=J.distance,ae=J.v0,te=J.v1,oe=Math.max(K-Q,2),re=Math.max(Y-$,2),ne=d({type:g,v0:ae,v1:te,stats:P})||[],fe=(0,n.Z)(ne,2),ie=fe[0],se=fe[1],le=(Math.log(ee)-W)*X,ve=x/2-.5,de=$-K;s(K-h.offsetPx,le+ve,de,1,r,"black"),l(Q-h.offsetPx,le,oe,x,r,se),l($-h.offsetPx,le,re,x,r,se),s(Q-h.offsetPx,le,oe,x,r,ie),s($-h.offsetPx,le,re,x,r,ie)}}({self:e,view:h,asm:u,ctx:a,chainData:t}):function(e){var a,t=e.ctx,r=e.self,n=e.chainData,d=e.view,c=e.asm,h=[],m=[],u=n.chains,x=r.height,g=(0,i.getConf)(r,"featureHeight"),N=(0,f.Z)(u);try{for(N.s();!(a=N.n()).done;){var P,M=a.value,b=Number.MAX_VALUE,p=Number.MIN_VALUE,y=(0,f.Z)(M);try{for(y.s();!(P=y.n()).done;){var w,C,T=P.value,_=c.getCanonicalRefName(T.refName)||T.refName,k=null===(w=d.bpToPx({refName:_,coord:T.start}))||void 0===w?void 0:w.offsetPx,S=null===(C=d.bpToPx({refName:_,coord:T.end}))||void 0===C?void 0:C.offsetPx;void 0!==k&&void 0!==S&&(b=Math.min(b,k),p=Math.max(p,S))}}catch($){y.e($)}finally{y.f()}var R=Math.abs(p-b);h.push(R),m.push(b)}}catch($){N.e($)}finally{N.f()}for(var A=Math.log((0,o.max)(h)),Z=Math.max(Math.log((0,o.min)(h))-1,0),D=(x-20)/(A-Z),z=g/2-.5,E=0;E<u.length;E++){var F=u[E],V=h[E],j=(Math.log(V)-Z)*D;s(m[E]-d.offsetPx,j+z,V,1,t,"black");var H,I=F[0],L=void 0;L=2048&I.flags?"-"===(null===(H=I.SA)||void 0===H?void 0:H.split(";")[0].split(",")[2])?-1:1:I.strand;var O,U=(0,f.Z)(F);try{for(U.s();!(O=U.n()).done;){var B,W,X=O.value,q=c.getCanonicalRefName(X.refName)||X.refName,G=null===(B=d.bpToPx({refName:q,coord:X.start}))||void 0===B?void 0:B.offsetPx,J=null===(W=d.bpToPx({refName:q,coord:X.end}))||void 0===W?void 0:W.offsetPx;if(void 0!==G&&void 0!==J){var K=Math.max(J-G,2),Q=G-d.offsetPx,Y=-1===X.strand*L?"color_rev_strand":"color_fwd_strand";l(Q,j,K,g,t,v.ue[Y]),s(Q,j,K,g,t,v.If[Y])}}}catch($){U.e($)}finally{U.f()}}}({self:e,view:h,asm:u,ctx:a,chainData:t})}}},71124:function(e,a,t){t.d(a,{F:function(){return r}});var o=t(41361);function r(e){var a,t=(0,o.Z)(e.chains.values());try{for(t.s();!(a=t.n()).done;){if(1&a.value[0].flags)return!0}}catch(r){t.e(r)}finally{t.f()}return!1}}}]);
//# sourceMappingURL=8550.31dc705b.chunk.js.map