"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[4345],{53740:(e,t,n)=>{n.d(t,{A:()=>d});var r=n(7552),o=n(68446),a=n(99546),l=n(68584),s=n(9502);function i(e,t){const n=t?(0,s.h)(t):void 0,r=e.get("start");let o=e.get("end");const a=e.get("strand"),l=e.get("mate"),i=e.get("refName");let c,m=0,u=0,f=0,g=0;if(["<TRA","<DEL","<INV","<INS","<DUP","<CNV"].some((e=>t?.startsWith(e)))){const t=e.get("INFO"),n=t?.END?.[0]??o;c=t?.CHR2?.[0]??i,m=n,u=n-1,o=r+1}else if(n?.MatePosition){const e=n.MatePosition.split(":");g="left"===n.MateDirection?1:-1,f="left"===n.Join?-1:1,m=+e[1],u=+e[1]-1,c=e[0]}return{k1:{refName:i,start:r,end:o,strand:a,mateDirection:g},k2:l??{refName:c||"unknown",end:m,start:u,mateDirection:f}}}function c(e,t){const{k1:n,k2:r}=i(e,t);return[e.get("name"),e.get("id"),(0,a.assembleLocString)(n),(0,a.assembleLocString)(r),e.get("INFO")?.SVTYPE,t].filter((e=>!!e)).join(" - ")}function m(){return m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},m.apply(null,arguments)}const u=(0,r.lazy)((()=>n.e(2241).then(n.bind(n,72241)))),f=(0,o.observer)((function({model:e,feature:t,alt:n,assembly:o,view:s}){const[f,g]=(0,r.useState)(!1),{height:d}=e,{k1:h,k2:b}=i(t,n),k=(0,r.useRef)(null),p=(0,l.getConf)(e,"color",{feature:t,alt:n}),v=o.getCanonicalRefName(h.refName)||h.refName,E=o.getCanonicalRefName(b.refName)||b.refName,w=h.start,y=b.start,N=s.bpToPx({refName:v,coord:w})?.offsetPx,P=s.bpToPx({refName:E,coord:y})?.offsetPx;if(void 0!==N&&void 0!==P){const o=(P-N)/2,l=Math.abs(o),i=Math.min(d,l),v=N-s.offsetPx,E=P-s.offsetPx,w=f?"black":p,y=3;return l>1?r.createElement(r.Fragment,null,r.createElement("path",m({d:`M ${v} 0 C ${v} ${i}, ${E} ${i}, ${E} 0`,ref:k},(0,a.getStrokeProps)(w),{strokeWidth:y,onMouseOut:()=>{g(!1)},onMouseOver:()=>{g(!0)},onClick:()=>{e.selectFeature(t)},fill:"none",pointerEvents:"stroke"})),h.mateDirection?r.createElement("line",m({},(0,a.getStrokeProps)(w),{strokeWidth:y,onMouseOut:()=>{g(!1)},onMouseOver:()=>{g(!0)},onClick:()=>{e.selectFeature(t)},x1:v,x2:v+20*h.mateDirection,y1:1.5,y2:1.5})):null,b.mateDirection?r.createElement("line",m({},(0,a.getStrokeProps)(w),{strokeWidth:y,onMouseOut:()=>{g(!1)},onMouseOver:()=>{g(!0)},onClick:()=>{e.selectFeature(t)},x1:E,x2:E+20*b.mateDirection,y1:1.5,y2:1.5})):null,f?r.createElement(r.Suspense,{fallback:null},r.createElement(u,{contents:c(t,n)})):null):null}return null})),g=(0,o.observer)((function({model:e,exportSVG:t,children:n}){const{height:o}=e,l=(0,a.getContainingView)(e),s=Math.round(l.dynamicBlocks.totalWidthPx);return t?n:r.createElement("svg",{width:s,height:o},n)})),d=(0,o.observer)((function({model:e,exportSVG:t}){const n=(0,a.getContainingView)(e),o=(0,a.getSession)(e),{assemblyManager:l}=o,{features:s}=e,i=l.get(n.assemblyNames[0]);return i?r.createElement(g,{model:e,exportSVG:t},s?.map((t=>{const a=t.get("ALT");return a?.map((a=>r.createElement(f,{key:`${t.id()}-${a}`,session:o,feature:t,alt:a,view:n,model:e,assembly:i})))??r.createElement(f,{key:t.id(),session:o,feature:t,view:n,model:e,assembly:i})}))):null}))},44345:(e,t,n)=>{n.d(t,{renderArcSvg:()=>l});var r=n(7552),o=n(99546),a=n(53740);async function l(e,t){await(0,o.when)((()=>!e.loading));const n=(0,o.getContainingView)(e).dynamicBlocks.totalWidthPx,l=e.height,s=`arc-${e.id}`;return r.createElement(r.Fragment,null,r.createElement("defs",null,r.createElement("clipPath",{id:s},r.createElement("rect",{x:0,y:0,width:n,height:l}))),r.createElement("g",{clipPath:`url(#${s})`},r.createElement(a.A,{model:e,exportSVG:!0})))}}}]);
//# sourceMappingURL=4345.0a9072cc.chunk.js.map