"use strict";(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[4223],{97202:(e,t,r)=>{r.d(t,{Z:()=>g});r(41867);var a=r(3762),n=r(90872),s=r(71472),i=r(17280),l=r(47192),o=r(80838);const c=(0,l.ZL)()({rulerLabel:{fontSize:"0.8rem",fontWeight:500,lineHeight:1.6,letterSpacing:"0.0075em"}});function d(e,t,r,a){e.flipped&&([r,a]=[a,r]);const n=e.bpToXY(r,t),s=e.bpToXY(a,t);return["M",...n,"A",t,t,"0",Math.abs(a-r)/e.bpPerRadian>Math.PI?"1":"0","1",...s].join(" ")}const h=(0,a.observer)((function(e){let{model:t,slice:r,region:a}=e;const s=(0,i.Z)(),{radiusPx:l}=t,c=l+1,{endRadians:d,startRadians:h}=r,x=(0,n.polarToCartesian)(c,h),g=(0,n.polarToCartesian)(c,d),u=(d-h)*c,f=d-h>Math.PI?"1":"0",p=(d+h)/2,w="[".concat(Number(a.regions.length).toLocaleString(),"]");return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(m,{text:w,view:t,maxWidthPx:u,radians:p,radiusPx:c,title:"".concat(w," more regions"),color:s.palette.text.primary}),(0,o.jsx)("path",{d:["M",...x,"A",c,c,"0",f,"1",...g].join(" "),stroke:s.palette.text.secondary,strokeWidth:2,strokeDasharray:"2,2",fill:"none"})]})})),m=(0,a.observer)((function(e){let{view:t,text:r,maxWidthPx:a,radians:s,radiusPx:i,title:l,color:d}=e;const{classes:h}=c(),m=(0,n.polarToCartesian)(i+5,s);if(!r)return null;if(6.5*r.length<a)return(0,o.jsxs)("text",{x:0,y:0,className:h.rulerLabel,textAnchor:"middle",dominantBaseline:"baseline",transform:"translate(".concat(m,") rotate(").concat((0,n.radToDeg)(s)+90,")"),style:{fill:d},children:[r,(0,o.jsx)("title",{children:l||r})]});if(a>4){return(0,n.radToDeg)(s+t.offsetRadians-Math.PI/2)>=180?(0,o.jsxs)("text",{x:0,y:0,className:h.rulerLabel,textAnchor:"start",dominantBaseline:"middle",transform:"translate(".concat(m,") rotate(").concat((0,n.radToDeg)(s),")"),style:{fill:d},children:[r,(0,o.jsx)("title",{children:l||r})]}):(0,o.jsxs)("text",{x:0,y:0,className:h.rulerLabel,textAnchor:"end",dominantBaseline:"middle",transform:"translate(".concat(m,") rotate(").concat((0,n.radToDeg)(s)+180,")"),style:{fill:d},children:[r,(0,o.jsx)("title",{children:l||r})]})}return null})),x=(0,a.observer)((function(e){let{model:t,slice:r,region:a}=e;const l=(0,i.Z)(),{radiusPx:c}=t,{endRadians:h,startRadians:x}=r,g=(h+x)/2,u=(h-x)*c;let f;const p=(0,n.getSession)(t).assemblyManager.get(a.assemblyName);if(p&&(f=p.getRefNameColor(a.refName)),f)try{f=(0,s.makeContrasting)(f,l.palette.background.paper)}catch(w){f=l.palette.text.primary}else f=l.palette.text.primary;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(m,{text:a.refName,view:t,maxWidthPx:u,radians:g,radiusPx:c,color:f}),(0,o.jsx)("path",{d:d(r,c+1,a.start,a.end),stroke:f,strokeWidth:2,fill:"none"})]})})),g=(0,a.observer)((function(e){let{model:t,slice:r}=e;return r.region.elided?(0,o.jsx)(h,{model:t,region:r.region,slice:r},(0,n.assembleLocString)(r.region.regions[0])):(0,o.jsx)(x,{region:r.region,model:t,slice:r},(0,n.assembleLocString)(r.region))}))},64223:(e,t,r)=>{r.d(t,{renderToSvg:()=>x});var a=r(41867),n=r(81096),s=r(49665),i=r(85815),l=r(90872),o=r(35421),c=r(17280),d=r(80838);function h(e){let{width:t,height:r,shift:a}=e;const n=(0,c.Z)();return(0,d.jsx)("rect",{width:t+2*a,height:r,fill:(0,l.stripAlpha)(n.palette.background.default)})}var m=r(97202);async function x(e,t){var r;await(0,i.when)((()=>e.initialized));const{themeName:c="default",Wrapper:x=(e=>{let{children:t}=e;return(0,d.jsx)(d.Fragment,{children:t})})}=t,g=(0,l.getSession)(e),u=null===(r=g.allThemes)||void 0===r?void 0:r.call(g)[c],{width:f,tracks:p,height:w}=e,j=await Promise.all(p.map((async e=>{const r=e.displays[0];return await(0,i.when)((()=>void 0===r.ready||r.ready)),{track:e,result:await r.renderSvg({...t,theme:u})}}))),{staticSlices:b,offsetRadians:v,centerXY:y}=e,k=(0,l.radToDeg)(v);return(0,s.uS)((0,d.jsx)(n.Z,{theme:(0,o.createJBrowseTheme)(u),children:(0,d.jsx)(x,{children:(0,d.jsxs)("svg",{width:f,height:w,xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:[0,0,f+100,w].toString(),children:[(0,d.jsx)(h,{width:f,height:w,shift:50}),(0,d.jsxs)("g",{transform:"translate(".concat(y,") rotate(").concat(k,")"),children:[b.map(((t,r)=>(0,d.jsx)(m.Z,{model:e,slice:t},r))),j.map(((e,t)=>{let{result:r}=e;return(0,d.jsx)(a.Fragment,{children:r},t)}))]})]})})}))}}}]);
//# sourceMappingURL=4223.c1045d6f.chunk.js.map