"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[5668],{95668:(t,e,a)=>{a.d(e,{renderToSvg:()=>m});var r=a(49823),s=a(99546),i=a(71328),n=a(20139),l=a(42489),c=a(48231),h=a(69500);function o({width:t,height:e,shift:a}){const r=(0,c.A)();return(0,h.jsx)("rect",{width:t+2*a,height:e,fill:(0,s.stripAlpha)(r.palette.background.default)})}var d=a(91468),f=a(95727);async function m(t,e){const{textHeight:a=18,headerHeight:c=30,rulerHeight:m=30,fontSize:x=13,trackLabels:g="offset",Wrapper:w=({children:t})=>t,themeName:u="default"}=e,p=(0,s.getSession)(t),j=p.allThemes?.()[u],{width:k,views:b}=t,v=c+m,y=b.map((t=>(0,i.mJ)(t.tracks,a,g)+v)),S=(0,s.sum)(y)+100,T=await Promise.all(b.map((async t=>({view:t,data:await Promise.all(t.tracks.map((async t=>{const a=t.displays[0];return await(0,l.when)((()=>void 0===a.ready||a.ready)),{track:t,result:await a.renderSvg({...e,theme:j})}})))})))),z=function(t,e,a){return(0,s.max)(t.flatMap((t=>t.tracks.map((t=>(0,s.measureText)((0,d.getTrackName)(t.configuration,a),e))))),0)}(b,x,p)+40,$="left"===g?z:0,H="offset"===g?a:0,L=b.map(((t,e)=>function(t,e,a=0){const r={};let s=e;for(const i of t.tracks)r[i.configuration.trackId]=s+a,s+=i.displays[0].height+e;return r}(t,H,x+(e>0?y[e-1]:0)+v))),P=k+$,A=(0,r.createJBrowseTheme)(j);return(0,s.renderToStaticMarkup)((0,h.jsx)(n.A,{theme:A,children:(0,h.jsx)(w,{children:(0,h.jsxs)("svg",{width:k,height:S,xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:[0,0,P+100,S].toString(),children:[(0,h.jsx)(o,{width:P,height:S,shift:50}),b[0]?(0,h.jsxs)("g",{transform:`translate(50 ${x})`,children:[(0,h.jsxs)("g",{transform:`translate(${$})`,children:[(0,h.jsx)("text",{x:0,fontSize:x,fill:A.palette.text.primary,children:b[0].assemblyNames.join(", ")}),(0,h.jsx)(i.$m,{model:T[0].view,fontSize:x})]}),(0,h.jsx)("g",{transform:`translate(0 ${v})`,children:(0,h.jsx)(i.zh,{textHeight:a,trackLabels:g,fontSize:x,model:T[0].view,displayResults:T[0].data,trackLabelOffset:$})})]}):null,b[1]?(0,h.jsxs)("g",{transform:`translate(50 ${x+y[0]})`,children:[(0,h.jsxs)("g",{transform:`translate(${$})`,children:[(0,h.jsx)("text",{x:0,fontSize:x,fill:A.palette.text.primary,children:b[1].assemblyNames.join(", ")}),(0,h.jsx)(i.$m,{model:T[1].view,fontSize:x})]}),(0,h.jsx)("g",{transform:`translate(0 ${v})`,children:(0,h.jsx)(i.zh,{textHeight:a,trackLabels:g,fontSize:x,model:T[1].view,displayResults:T[1].data,trackLabelOffset:$})})]}):null,(0,h.jsx)("defs",{children:(0,h.jsx)("clipPath",{id:"clip-bsv",children:(0,h.jsx)("rect",{x:0,y:0,width:k,height:S})})}),(0,h.jsx)("g",{transform:`translate(${$+50})`,clipPath:"url(#clip-bsv)",children:t.matchedTracks.map((e=>(0,h.jsx)(f.A,{parentRef:{current:null},model:t,trackId:e.configuration.trackId,getTrackYPosOverride:(t,e)=>L[e][t]},e.configuration.trackId)))})]})})}))}}}]);
//# sourceMappingURL=5668.0a0b236c.chunk.js.map