"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[6861],{46861:(e,o,t)=>{t.r(o),t.d(o,{default:()=>M});var r=t(7552),n=t(68584),u=t(99546),s=t(68446),a=t(80208),c=t(69500);function i({feature:e,config:o,layoutRecord:{y:t,data:{anchorX:r,radiusPx:u,score:s}}}){const i=(0,n.readConfObject)(o,"innerColor",{feature:e}),d=String(s),l=2*u/d.length*1.1;return l<12?null:(0,c.jsx)("text",{style:{fontSize:l,fill:(0,a.contrastingTextColor)(i)},x:r,y:t+u-l/2.4,textAnchor:"middle",dominantBaseline:"hanging",children:d})}const d=(0,s.observer)((function(e){const{feature:o,config:t,layoutRecord:r,selectedFeatureId:u}=e,{anchorLocation:s,y:a,data:{radiusPx:d}}=r,l=o=>{const{onFeatureMouseDown:t,feature:r}=e;return t?.(o,r.id())},f=o=>{const{onFeatureMouseEnter:t,feature:r}=e;return t?.(o,r.id())},M=o=>{const{onFeatureMouseOut:t,feature:r}=e;return t?.(o,r.id())},g=o=>{const{onFeatureMouseOver:t,feature:r}=e;return t?.(o,r.id())},x=o=>{const{onFeatureMouseUp:t,feature:r}=e;return t?.(o,r.id())},b=o=>{const{onFeatureMouseLeave:t,feature:r}=e;return t?.(o,r.id())},h=o=>{const{onFeatureMouseMove:t,feature:r}=e;return t?.(o,r.id())},y=o=>{const{onFeatureClick:t,feature:r}=e;return o.stopPropagation(),t?.(o,r.id())},j={fill:(0,n.readConfObject)(t,"strokeColor",{feature:o})};String(u)===String(o.id())&&(j.fill="red");const p={fill:(0,n.readConfObject)(t,"innerColor",{feature:o})},v=(0,n.readConfObject)(t,"strokeWidth",{feature:o});return(0,c.jsxs)("g",{"data-testid":o.id(),children:[(0,c.jsx)("title",{children:(0,n.readConfObject)(t,"caption",{feature:o})}),(0,c.jsx)("circle",{cx:s,cy:a+d,r:d,style:j,onMouseDown:l,onMouseEnter:f,onMouseOut:M,onMouseOver:g,onMouseUp:x,onMouseLeave:b,onMouseMove:h,onClick:y,onFocus:g,onBlur:M}),d-v<=2?null:(0,c.jsx)("circle",{cx:s,cy:a+d,r:d-v,style:p,onMouseDown:l,onMouseEnter:f,onMouseOut:M,onMouseOver:g,onMouseUp:x,onMouseLeave:b,onMouseMove:h,onClick:y,onFocus:g,onBlur:M}),(0,c.jsx)(i,{feature:o,config:t,layoutRecord:r})]})})),l=(0,s.observer)((function({feature:e,config:o,layoutRecord:{anchorLocation:t,y:r,data:{radiusPx:u}}}){return(0,c.jsx)("line",{x1:t,y1:0,x2:t,y2:r+2*u,stroke:(0,n.readConfObject)(o,"stickColor",{feature:e}),strokeWidth:(0,n.readConfObject)(o,"stickWidth",{feature:e})})}));function f(e){const{feature:o,bpPerPx:t,config:r,region:s,layout:a}=e,c=Math.abs(o.get("end")+o.get("start"))/2,i=(0,u.bpToPx)(c,s,t),d=(0,n.readConfObject)(r,"radius",{feature:o});d||console.error(new Error(`lollipop radius ${d} configured for feature ${o.id()}`)),a.add(o.id(),i,2*d,2*d,{featureId:o.id(),anchorX:i,radiusPx:d,score:(0,n.readConfObject)(e.config,"score",{feature:o})})}const M=(0,s.observer)((function(e){const o=o=>{const{onMouseEnter:t}=e;return t?.(o)},t=o=>{const{onMouseLeave:t}=e;return t?.(o)},{regions:n,bpPerPx:u,layout:s,config:a,features:i=new Map,displayModel:M={}}=e,{selectedFeatureId:g}=M,x=n[0];for(const e of i.values())f({feature:e,bpPerPx:u,region:x,config:a,layout:s});const b=(x.end-x.start)/u,h=[...s.getLayout(a).values()],y=s.getTotalHeight();return(0,c.jsx)("svg",{width:b,height:y,style:{position:"relative"},onMouseDown:o=>{const{onMouseDown:t}=e;return t?.(o)},onMouseUp:o=>{const{onMouseUp:t}=e;return t?.(o)},onMouseEnter:o,onMouseLeave:t,onMouseOver:o=>{const{onMouseOver:t}=e;return t?.(o)},onMouseOut:o=>{const{onMouseOut:t}=e;return t?.(o)},onFocus:o,onBlur:t,onClick:o=>{const{onClick:t}=e;return t?.(o)},children:h.map((o=>{const t=i.get(o.data.featureId);return(0,c.jsxs)(r.Fragment,{children:[(0,c.jsx)(l,{...e,config:a,layoutRecord:o,feature:t},`stick-${t.id()}`),(0,c.jsx)(d,{...e,layoutRecord:o,feature:t,selectedFeatureId:g},`body-${t.id()}`)]},t.id())}))})}))}}]);
//# sourceMappingURL=6861.3437b130.chunk.js.map