jbrowse-plugin-graphgenomeviewer 10.0.2 → 10.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/chunks/{GraphGenomeView-2WSTZQNY.js → GraphGenomeView-7KODXFCZ.js} +2 -2
  2. package/dist/chunks/{LinearGraphDisplay-VYCJVUW4.js → LinearGraphDisplay-ZAIMEATG.js} +2 -2
  3. package/dist/chunks/chunk-4MTS65XF.js +3 -0
  4. package/dist/chunks/{chunk-ZKQLPKNN.js.map → chunk-4MTS65XF.js.map} +3 -3
  5. package/dist/chunks/{chunk-NDWP2KNR.js → chunk-JJ2TPWSH.js} +2 -2
  6. package/dist/chunks/{chunk-EVYIBH4N.js → chunk-TMF6JHCE.js} +2 -2
  7. package/dist/chunks/{chunk-AVUNIRM5.js → chunk-TP6OXTXD.js} +5 -5
  8. package/dist/chunks/chunk-TP6OXTXD.js.map +7 -0
  9. package/dist/chunks/chunk-VV5LVNCP.js +9 -0
  10. package/dist/chunks/chunk-VV5LVNCP.js.map +7 -0
  11. package/dist/chunks/renderSvg-SEYWHXD7.js +2 -0
  12. package/dist/chunks/renderSvg-SEYWHXD7.js.map +7 -0
  13. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +1 -1
  14. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +1 -1
  15. package/package.json +1 -1
  16. package/src/GraphGenomeView/components/PaneSvg.tsx +2 -1
  17. package/src/GraphGenomeView/model.facetRebuild.test.ts +10 -7
  18. package/src/GraphGenomeView/model.fold.test.ts +2 -5
  19. package/src/GraphGenomeView/model.geneNames.test.ts +4 -4
  20. package/src/GraphGenomeView/model.layout.test.ts +6 -13
  21. package/src/GraphGenomeView/model.passes.test.tsx +2 -5
  22. package/src/GraphGenomeView/model.ts +2 -8
  23. package/src/GraphGenomeView/pane/fitViews.ts +63 -20
  24. package/src/GraphGenomeView/pane/graphViews.ts +1 -18
  25. package/src/GraphGenomeView/pane/paneBase.ts +28 -13
  26. package/src/GraphGenomeView/pane/renderingActions.ts +34 -66
  27. package/src/GraphGenomeView/pane/settingActions.ts +47 -28
  28. package/src/GraphGenomeView/renderPipeline.test.ts +28 -9
  29. package/src/LinearGraphDisplay/LinearGraphDisplay.test.ts +6 -6
  30. package/src/version.ts +1 -1
  31. package/dist/chunks/chunk-AVUNIRM5.js.map +0 -7
  32. package/dist/chunks/chunk-EUXYBAW2.js +0 -9
  33. package/dist/chunks/chunk-EUXYBAW2.js.map +0 -7
  34. package/dist/chunks/chunk-ZKQLPKNN.js +0 -3
  35. package/dist/chunks/renderSvg-X3BRMJX3.js +0 -2
  36. package/dist/chunks/renderSvg-X3BRMJX3.js.map +0 -7
  37. /package/dist/chunks/{GraphGenomeView-2WSTZQNY.js.map → GraphGenomeView-7KODXFCZ.js.map} +0 -0
  38. /package/dist/chunks/{LinearGraphDisplay-VYCJVUW4.js.map → LinearGraphDisplay-ZAIMEATG.js.map} +0 -0
  39. /package/dist/chunks/{chunk-NDWP2KNR.js.map → chunk-JJ2TPWSH.js.map} +0 -0
  40. /package/dist/chunks/{chunk-EVYIBH4N.js.map → chunk-TMF6JHCE.js.map} +0 -0
@@ -1,5 +1,5 @@
1
- import{$ as rt,$c as Et,Ab as ct,Ac as Se,Bb as dt,Db as ut,Ha as st,Hb as bt,Ib as ht,Ic as _e,Lb as ft,Lc as _t,O as qe,P as Ze,Q as Je,R as we,T as Qe,U as et,V as Re,Vb as gt,Wc as Ee,Xb as xe,Xc as Me,Ya as te,Z as tt,_ as nt,a as We,aa as ot,b as j,bc as mt,cd as Mt,da as at,e as De,ec as kt,fc as Pe,fd as Lt,jc as wt,kc as Rt,lc as xt,nb as it,o as Fe,qb as O,r as be,s as he,sb as lt,sc as Pt,tc as yt,ub as pt,vc as St,wc as ye}from"./chunk-AVUNIRM5.js";import{$ as je,F as A,G as Ve,O as ee,c as ze,f as Z,n as J,o as ge,p as me,q as ke,w as Q,z as K}from"./chunk-JWIFJIPZ.js";import{V as Ye,W as Ue,w as X,y as q,z as fe}from"./chunk-4RZCYOCW.js";import{b as G,c as $}from"./chunk-NTXLYTF6.js";import{d as V}from"./chunk-WKD7ALOU.js";import{b as He,d as L,e as Xe,f as Ke,g as ue,h as $e}from"./chunk-J2PN6CG3.js";import{a as I,b as l,c as y,d as m}from"./chunk-DUU6T2I5.js";var jt="data-pans-with-drawing";function Ct(e,t){return{position:"absolute",left:0,top:0,pointerEvents:"none",overflow:t,zIndex:e}}var N=m(function({model:t,zIndex:n,overflow:r="hidden",testId:o,pansWithDrawing:a,children:i}){return l("svg",{style:{...Ct(n,r),userSelect:a?"none":void 0,clipPath:t.drawingClip},width:t.paneWidth,height:t.canvasHeight,"data-testid":o,...a?{[jt]:""}:{},children:i})}),ne=m(function({model:t,children:n}){let{scaleX:r,scaleY:o,translateX:a,translateY:i}=t;return l("g",{transform:`translate(${a} ${i}) scale(${r} ${o})`,children:n})}),At=m(function({model:t,drawnAt:n,children:r}){let o=t.translateX-n.translateX,a=t.translateY-n.translateY;return l("g",{transform:`translate(${o} ${a})`,children:r})}),C=m(function({model:t,zIndex:n,shown:r=!0,testId:o,paint:a}){let i=$e(null);return Xe(()=>{if(r)return We(()=>{let s=i.current,p=s?.getContext("2d");if(s&&p){let b=t.paneWidth,f=t.canvasHeight;te(Et());let h=gt(s,b,f);p.setTransform(h,0,0,h,0,0),p.clearRect(0,0,b,f),a(p,h)}})},[t,r,a]),l("canvas",{ref:i,"data-testid":r?o:void 0,style:{...Ct(n),display:r?"block":"none"}})});var qt=m(function({model:t}){let{bubbleHalos:n,hoveredBubble:r}=t;if(n.length===0)return null;let o=t.contigThickness*ut;return l(N,{model:t,zIndex:2,testId:"graph-bubble-halos",children:l(ne,{model:t,children:n.filter(a=>!a.whole&&(!a.tick||r&&G(a.bubble,r))).map(a=>l("path",{d:a.path,fill:"none",stroke:O,strokeOpacity:r&&G(a.bubble,r)?.45:t.bubbleFaded(a)?.06:.22,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"},$(a.bubble)))})})}),Er=qt;var Zt="#18181c";function Jt(e,t){let n=t.edgeMarks;n&&it(e,n,{top:t.referenceStripZonePx,bottom:t.canvasHeight},{ink:Zt,paper:st})}var Qt=m(function({model:t}){let n=L(r=>{Jt(r,t)},[t]);return l(C,{model:t,zIndex:5,shown:t.runsPastEdge,testId:"graph-edge-marks",paint:n})}),vr=Qt;function en(e){return e==="class"?"className":/^(data|aria)-/.test(e)?e:e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function tn(e,t){let n={key:t};for(let[r,o]of Object.entries(e.attrs))o!==void 0&&(n[en(r)]=o);return n}var Ce="pane";function Le(e,t,n){return typeof e=="string"?e:n&&e.attrs.transform===Ce?l(ne,{model:n,children:e.children.map((r,o)=>Le(r,o,n))},t):He(e.tag,tn(e,t),e.children.map((r,o)=>Le(r,o,n)))}function D(){return Ke().replaceAll(/[^\w-]/g,"")}function F({el:e,pane:t}){return Le(e,0,t)}var nn=m(function({model:t}){let n=`exon-outline-${D()}`,r=pt(t.exonOutlines,{id:n,width:t.paneWidth,height:t.canvasHeight,transform:Ce});return r?l(N,{model:t,zIndex:2,testId:"graph-gene-pins",children:l(F,{el:r,pane:t})}):null}),Yr=nn;function Ot(e,t,n){return{x:e-n/2,y:t-X-q+2,width:n,height:X+q*2-2}}function Nt(e,t,n){let r=Ot(e.x,e.y,e.w);return t>=r.x&&t<=r.x+r.width&&n>=r.y&&n<=r.y+r.height}var Y=m(function({x:t,y:n,w:r,text:o,note:a,color:i,edge:s=i,italic:p,bold:b,dimmed:f,title:h,testId:d,onClick:u,onHover:k}){return y("g",{style:{pointerEvents:u||k?"auto":"none",cursor:u?"pointer":void 0,opacity:f?.35:1},"data-testid":d,onClick:u,onMouseEnter:()=>{k?.(!0)},onMouseLeave:()=>{k?.(!1)},...u&&{role:"button",tabIndex:0,"aria-label":(h??o).replaceAll(`
1
+ import{$ as rt,Cb as ct,Cc as Se,Db as dt,Fb as ut,Ha as st,Jb as bt,Kb as ht,Kc as _e,Nb as ft,Nc as _t,O as qe,P as Ze,Q as Je,R as we,T as Qe,U as et,V as Re,Xb as gt,Ya as te,Yc as Ee,Z as tt,Zb as xe,Zc as Me,_ as nt,a as We,aa as ot,b as j,bd as Et,da as at,dc as mt,e as De,ed as Mt,gc as kt,hc as Pe,hd as Lt,lc as wt,mc as Rt,nc as xt,o as Fe,pb as it,r as be,s as he,sb as O,ub as lt,uc as Pt,vc as yt,wb as pt,xc as St,yc as ye}from"./chunk-TP6OXTXD.js";import{$ as je,F as A,G as Ve,O as ee,c as ze,f as Z,n as J,o as ge,p as me,q as ke,w as Q,z as K}from"./chunk-JWIFJIPZ.js";import{V as Ye,W as Ue,w as X,y as q,z as fe}from"./chunk-4RZCYOCW.js";import{b as G,c as $}from"./chunk-NTXLYTF6.js";import{d as V}from"./chunk-WKD7ALOU.js";import{b as He,d as L,e as Xe,f as Ke,g as ue,h as $e}from"./chunk-J2PN6CG3.js";import{a as I,b as l,c as y,d as m}from"./chunk-DUU6T2I5.js";var jt="data-pans-with-drawing";function Ct(e,t){return{position:"absolute",left:0,top:0,pointerEvents:"none",overflow:t,zIndex:e}}var N=m(function({model:t,zIndex:n,overflow:r="hidden",testId:o,pansWithDrawing:a,children:i}){return l("svg",{style:{...Ct(n,r),userSelect:a?"none":void 0,clipPath:t.drawingClip},width:t.paneWidth,height:t.canvasHeight,"data-testid":o,...a?{[jt]:""}:{},children:i})}),ne=m(function({model:t,children:n}){let{scaleX:r,scaleY:o,translateX:a,translateY:i}=t;return l("g",{transform:`translate(${a} ${i}) scale(${r} ${o})`,children:n})}),At=m(function({model:t,drawnAt:n,children:r}){let o=t.translateX-n.translateX,a=t.translateY-n.translateY;return l("g",{transform:`translate(${o} ${a})`,children:r})}),C=m(function({model:t,zIndex:n,shown:r=!0,testId:o,paint:a}){let i=$e(null);return Xe(()=>{if(r)return We(()=>{let s=i.current,p=s?.getContext("2d");if(s&&p){let b=t.paneWidth,f=t.canvasHeight;te(Et());let h=gt(s,b,f);p.setTransform(h,0,0,h,0,0),p.clearRect(0,0,b,f),a(p,h)}})},[t,r,a]),l("canvas",{ref:i,"data-testid":r?o:void 0,style:{...Ct(n),display:r?"block":"none"}})});var qt=m(function({model:t}){let{bubbleHalos:n,hoveredBubble:r}=t;if(n.length===0)return null;let o=t.contigThickness*ut;return l(N,{model:t,zIndex:2,testId:"graph-bubble-halos",children:l(ne,{model:t,children:n.filter(a=>!a.whole&&(!a.tick||r&&G(a.bubble,r))).map(a=>l("path",{d:a.path,fill:"none",stroke:O,strokeOpacity:r&&G(a.bubble,r)?.45:t.bubbleFaded(a)?.06:.22,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"},$(a.bubble)))})})}),Er=qt;var Zt="#18181c";function Jt(e,t){let n=t.edgeMarks;n&&it(e,n,{top:t.referenceStripZonePx,bottom:t.canvasHeight},{ink:Zt,paper:st})}var Qt=m(function({model:t}){let n=L(r=>{Jt(r,t)},[t]);return l(C,{model:t,zIndex:5,shown:t.runsPastEdge,testId:"graph-edge-marks",paint:n})}),vr=Qt;function en(e){return e==="class"?"className":/^(data|aria)-/.test(e)?e:e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function tn(e,t){let n={key:t};for(let[r,o]of Object.entries(e.attrs))o!==void 0&&(n[en(r)]=o);return n}var Ce="pane";function Le(e,t,n){return typeof e=="string"?e:n&&e.attrs.transform===Ce?l(ne,{model:n,children:e.children.map((r,o)=>Le(r,o,n))},t):He(e.tag,tn(e,t),e.children.map((r,o)=>Le(r,o,n)))}function D(){return Ke().replaceAll(/[^\w-]/g,"")}function F({el:e,pane:t}){return Le(e,0,t)}var nn=m(function({model:t}){let n=`exon-outline-${D()}`,r=pt(t.exonOutlines,{id:n,width:t.paneWidth,height:t.canvasHeight,transform:Ce});return r?l(N,{model:t,zIndex:2,testId:"graph-gene-pins",children:l(F,{el:r,pane:t})}):null}),Yr=nn;function Ot(e,t,n){return{x:e-n/2,y:t-X-q+2,width:n,height:X+q*2-2}}function Nt(e,t,n){let r=Ot(e.x,e.y,e.w);return t>=r.x&&t<=r.x+r.width&&n>=r.y&&n<=r.y+r.height}var Y=m(function({x:t,y:n,w:r,text:o,note:a,color:i,edge:s=i,italic:p,bold:b,dimmed:f,title:h,testId:d,onClick:u,onHover:k}){return y("g",{style:{pointerEvents:u||k?"auto":"none",cursor:u?"pointer":void 0,opacity:f?.35:1},"data-testid":d,onClick:u,onMouseEnter:()=>{k?.(!0)},onMouseLeave:()=>{k?.(!1)},...u&&{role:"button",tabIndex:0,"aria-label":(h??o).replaceAll(`
2
2
  `,", "),onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),u())},onFocus:()=>{k?.(!0)},onBlur:()=>{k?.(!1)}},children:[h?l("title",{children:h}):null,l("rect",{...Ot(t,n,r),rx:3,fill:"rgba(255,255,255,0.85)",stroke:s,strokeWidth:1}),y("text",{x:t,y:n,fontSize:X,fontFamily:"sans-serif",fontStyle:p?"italic":void 0,fontWeight:p?600:b?"bold":void 0,fill:i,textAnchor:"middle",children:[o,a?l("tspan",{fontStyle:"normal",fontWeight:"normal",children:a}):null]})]})});var Ae="#1c1c22",Oe=9,Ne=3;function co({genes:e},t,n){let r=e.find(a=>Nt(a,t,n))?.item,o=r&&bt(r.pin);return r?{label:r.name,readout:`${r.pin.gene.refName}:${r.pin.gene.start.toLocaleString()}-${r.pin.gene.end.toLocaleString()}${o?`, ${o} in the cut`:""}`}:void 0}var rn=m(function({model:t}){let{bubbles:n,genes:r,ticks:o,passes:a,sizes:i}=t.overlayLabels,s=i.flatMap(c=>{let g=Ue(c);return g?[{key:c.key,...g}]:[]});if(n.length+r.length+o.length+a.length+s.length===0)return null;let{scaleX:p,scaleY:b,translateX:f,translateY:h,contigThickness:d,hoveredBubble:u}=t,k=u?o.find(c=>G(c.item.bubble,u)):void 0,w=c=>{let g=c instanceof Element?c.getAttribute("data-tick"):null;return g===null?void 0:o[Number(g)]},E=c=>t.bubbleFaded(c),x=c=>t.bubbleIsOpen(c.bubble);return y(N,{model:t,zIndex:3,testId:"graph-label-layer",pansWithDrawing:!0,children:[l("g",{"data-testid":"graph-bubble-ticks",onClick:c=>{let g=w(c.target);g&&t.toggleBubble(g.item.bubble)},onMouseOver:c=>{let g=w(c.target);g&&t.setHoveredBubble(g.item.bubble)},onMouseOut:()=>{V(t)&&t.setHoveredBubble(null)},onFocus:c=>{let g=w(c.target);g&&t.setHoveredBubble(g.item.bubble)},onBlur:()=>{V(t)&&t.setHoveredBubble(null)},onKeyDown:c=>{let g=w(c.target);g&&(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),t.toggleBubble(g.item.bubble))},children:o.map(({item:c,x:g,y:P},M)=>l("rect",{"data-tick":M,role:"button",tabIndex:0,"aria-label":`${c.label}, ${x(c)?"close":"open"} bubble`,x:g-Ne/2,y:P-Oe,width:Ne,height:Oe,rx:Ne/2,fill:O,opacity:E(c)?.35:1,style:{pointerEvents:"all",cursor:"pointer"}},$(c.bubble)))}),s.map(({key:c,x1:g,y1:P,x2:M,y2:T})=>l("line",{"data-testid":"graph-size-leader",x1:g,x2:M,y1:P,y2:T,stroke:Ae,strokeWidth:.8,strokeOpacity:.6},c)),r.map(({item:{pin:c,name:g},x:P,y:M,w:T,text:v})=>{let{gene:H}=c,{x1:pe,y1:ce,x2:de,y2:Vt}=ht({x:P,y:M},{x:c.at.x*p+f,y:c.at.y*b+h},d);return y("g",{children:[l("line",{x1:pe,x2:de,y1:ce,y2:Vt,stroke:Ae,strokeWidth:.8,strokeOpacity:.6}),l(Y,{x:P,y:M,w:T,text:g,note:v.slice(g.length)||void 0,color:Ae,edge:lt,italic:!0,testId:"graph-gene-pin-label"})]},`${H.name}-${H.refName}-${H.start}`)}),a.map(({item:c,x:g,y:P,w:M,text:T})=>{let v=Z(c.ink),{x1:H,y1:pe,x2:ce,y2:de}=ft({x:g,y:P},c.at);return y("g",{"data-testid":"graph-pass-label",style:{pointerEvents:"none"},children:[l("line",{x1:H,x2:ce,y1:pe,y2:de,stroke:v,strokeWidth:1}),l("circle",{cx:c.at.x,cy:c.at.y,r:2,fill:v}),l(Y,{x:g,y:P,w:M,text:T,color:v,bold:!0})]},`${c.walk}-${c.pass}`)}),n.map(({item:c,x:g,y:P,w:M,text:T})=>l(Y,{x:g,y:P,w:M,text:T,color:O,dimmed:E(c),title:`${c.label}
3
3
  ${c.bubble.segmentCount} segments${c.bubble.covering?"":x(c)?" \xB7 click to close":" \xB7 click to open"}`,testId:"graph-bubble-halo-label",onClick:c.bubble.covering?void 0:()=>{t.toggleBubble(c.bubble)},onHover:v=>{V(t)&&t.setHoveredBubble(v?c.bubble:null)}},$(c.bubble))),k?l(Y,{x:k.x,y:k.y-Oe-4,w:fe(k.item.label),text:k.item.label,color:O,testId:"graph-bubble-tick-label"}):null]})}),uo=rn;var Tt=["#d4735e","#d8a94a","#c98aa4"],on="#e6e6e6",an="#555",sn="bold 11px sans-serif";var Te=e=>Tt[e]??on;function re(e){let t=String.fromCharCode(65+e%26);return e<26?t:re(Math.floor(e/26)-1)+t}var oe=Tt.length;function vt(e,t,n){e.font=sn,e.textAlign="center",e.textBaseline="middle";for(let{row:r,start:o,bp:a,block:i}of t){let s=n.x(o),p=n.x(o+a)-s,b=n.rowCentre(r)-n.barPx/2;e.fillStyle=Te(i),e.fillRect(s,b,p,n.barPx),e.strokeStyle=an,e.lineWidth=1,e.strokeRect(s+.5,b+.5,p-1,n.barPx-1),p>=12&&n.barPx>=9&&(e.fillStyle="#111",e.fillText(re(i),s+p/2,n.rowCentre(r)))}}var R=18,It=32,pn=6,Bt=7,cn="#b8b8c0",ae=Ze-4,dn=15,se=10,Gt=8;function ie(e){return e.kind==="fill"?e.width??R:R}var Ge=e=>e.length>1?3:4;function z(e){switch(e.kind){case"fill":return e.height??8;case"bands":return Ge(e.bands)*e.bands.length;case"line":return 3;case"halo":case"overhang":return 10;case"outline":case"tick":return e.height;case"glyph":return 15;case"bracket":return 7;case"threads":return 8;case"heads":return e.haloPx===void 0?e.lanePx:J+e.haloPx;case"blank":return 0}}function Ga(e){return e.reduce((t,n)=>n.swatch?Math.max(t,ie(n.swatch)):t,0)}function Ba(e){return e.reduce((t,n)=>n.swatch?Math.max(t,Math.ceil(z(n.swatch))+3):t,dn)}var S=e=>[{offset:0,color:e}];function un(e,t,n){return{key:e,label:n,swatch:{kind:"fill",stops:S(t),width:se,height:se,edged:!0}}}function ve(e){return e.flatMap((t,n)=>[{offset:n/e.length,color:t},{offset:(n+1)/e.length,color:t}])}var _=Z,bn=e=>e.map(({offset:t,ink:n})=>({offset:t,color:_(n)}));function hn(e,t){let n=t?J:Gt,r=n*ge,o=(t?[r,R]:[R-1]).map(a=>`M${xe({x:a,y:0,angle:0,length:r,halfWidth:n/2,color:e},{scaleX:1,scaleY:1,translateX:0,translateY:0,dpr:1}).map(s=>`${+s.x.toFixed(1)},${+s.y.toFixed(1)}`).join("L")}Z`).join("");return{kind:"heads",lane:_(e),lanePx:t?K:Gt,heads:o,fill:_(ke(e,!t)),...t?{haloPx:2*me}:{}}}function fn(e){switch(e.kind){case"scale":return{kind:"fill",stops:bn(e.stops),width:It};case"swatch":return{kind:"fill",stops:S(_(e.ink)),width:R};case"chip":return{kind:"fill",stops:S(_(e.ink)),width:se,height:se,edged:!0};case"width":return{kind:"fill",stops:S(_(e.ink)),width:It,height:e.px};case"hollow":return{kind:"fill",stops:S(_(e.ink)),rim:_(e.rim)};case"line":return e.dashed?{kind:"line",color:_(e.ink),dashed:!0}:{kind:"line",color:_(e.ink),short:!0};case"outline":return{kind:"outline",color:_(e.ink),stroke:2,radius:5,height:8};case"halo":return{kind:"halo",color:_(e.ink)};case"threads":return{kind:"threads"};case"overhang":return{kind:"overhang"};case"heads":return hn(e.ink,e.haloed)}}function Ie(e){return{key:e.key,label:e.text,...e.swatch?{swatch:fn(e.swatch)}:{},...e.strong===void 0?{}:{strong:e.strong},...e.under===void 0?{}:{under:e.under},...e.hover===void 0?{}:{title:e.hover},...e.walk?{walk:e.walk}:{}}}var Wa=e=>e?`\xB7 ${e}`:"",Wt=e=>e>0?`${e.toLocaleString("en-US")} unlabelled`:"";function gn(e){return Wt((e.drawnGraph?.nodes??[]).filter(t=>t.placeholder).length)}function U(e,t){return e.graphKey.find(n=>n.id===t)?.entries.map(({under:n,...r})=>n===""?{...Ie(r),count:"",sizer:gn(e)}:Ie(n===void 0?r:{...r,under:n}))??[]}function mn(e){let t=e.openBubble;if(!t)return[];let n=e.bubbleHalos.find(r=>G(r.bubble,t));return[{key:"open",label:`open: ${n?.label??"bubble"}`,swatch:n?{kind:"halo",color:O}:{kind:"blank"},closesBubble:!0}]}function kn(e){let t=e.walkLift;if(t)return t.walks.map(o=>je(o.encoding));if(e.effectiveColorScheme==="reference-position")return[Q];let n=e.referenceStripBlocks.map(o=>o.colors[0]).filter((o,a,i)=>o!==i[a-1]),r=Math.min(pn,n.length);return[r===0?S(A):Array.from({length:r},(o,a)=>({offset:r>1?a/(r-1):0,color:n[r>1?Math.round(a*(n.length-1)/(r-1)):0]}))]}function wn(e){let t=e.find(r=>r.colors.includes(A))?.colors.indexOf(A),n=t===void 0?void 0:e.map(r=>r.colors[t]).find(r=>r&&r!==A);return n?ve([n,A,n]):void 0}function Rn(e){if(!e.referenceStripShown)return[];let t=e.walkLift?.walks??[],n=t.length>1,r=t.length>0&&wn(e.referenceStripBlocks);return[{key:"strip",label:n?"reference each walk passes through":t[0]&&!t[0].reference?`reference ${e.liftedWalksLabel} passes through`:"reference",swatch:{kind:"bands",bands:kn(e)}},...e.referenceStripFaded?[t.length>0?{key:"strip-faded",label:`grey where ${n?"a walk":e.liftedWalksLabel} does not pass through`,swatch:{kind:"bands",bands:[r||S(A)]}}:un("strip-faded",A,"reference outside the open bubble")]:[],...U(e,"overhang")]}function xn(e){let t=e.layoutResult?.tubeMap?Lt(e.graph,e.abridged):void 0;return t?[{key:"tube-not-shown",label:t}]:[]}function Pn(e){let t=e.foldNote;return t?[{key:"fold",label:t}]:[]}function yn(e){return e.pathLegend.map(({name:t,label:n,color:r})=>({key:`path-${t}`,label:n,swatch:{kind:"line",color:r}}))}function B(e,t,n){return{key:e,label:n,swatch:{kind:"fill",stops:t,height:Bt,square:!0}}}function Sn(e){let{roles:t,haplotypeTube:n,bundled:r,values:o,logWidths:a,foldBp:i,forwardReads:s,reverseReads:p,substitution:b,insertion:f,deletion:h}=e.tubeMapKeys,d=e.readsShown,u=[];if(o){u.push(B("value-reference",S(_e),"reference"));for(let{value:k,color:w}of o)u.push(B(`value-${k}`,S(w),k))}return t&&u.push(B("ref",S(_e),"reference"),B("hap",S(n),r?"shared route, \xD7n haplotypes":"haplotype")),s&&u.push(B("fwd",ve(be),"read on the forward strand")),p&&u.push(B("rev",ve(he),"read on the reverse strand")),d&&d.shown<d.total&&u.push({key:"sampled",label:`${d.shown.toLocaleString("en-US")} of ${d.total.toLocaleString("en-US")} reads shown`,swatch:{kind:"blank"}}),b&&u.push({key:"sub",label:"read mismatch",swatch:{kind:"glyph",char:"A"}}),f&&u.push({key:"ins",label:"read insertion",swatch:{kind:"glyph",char:"*"}}),h&&u.push(B("del",S("grey"),"read deletion")),i!==void 0&&u.push({key:"tube-fold",label:`haplotype variant < ${Ye(i)}`,swatch:{kind:"tick",color:St(),height:Bt,backing:cn}}),a&&u.push({key:"log",label:"width grows with log of length",swatch:{kind:"bracket"}}),u}function _n(e){return e.kind==="gene"?{kind:"outline",color:qe,stroke:1.5,radius:0,height:ae}:{kind:"fill",stops:e.kind==="bar"&&e.ramp?Q:S(e.fill),height:e.kind==="gap"?e.px:ae,...e.kind==="bar"&&e.rim?{rim:e.rim}:{}}}function En(e){let t=new Set(e.sharedBlocks?.map(r=>r.block)),n=r=>({kind:"fill",stops:S(Te(r)),height:ae});return[...[...t].filter(r=>r<oe).sort((r,o)=>r-o).map(r=>({key:`block-${r}`,label:`${re(r)}: off the reference, walked by several rows`,swatch:n(r)})),...[...t].some(r=>r>=oe)?[{key:"block-more",label:"more shared blocks",swatch:n(oe)}]:[]]}function Mn(e){let t=e.walkRowBars;if(!t)return[];let n=[t.reference,...t.rows].flatMap(o=>o.call??[]),r=(o,a,i)=>({key:o,label:i,swatch:{kind:"tick",color:a,height:ae}});return[...tt(t,{ramp:e.referenceRampDomain,genes:e.walkRowGeneKey,annotation:e.walkRowAnnotation,...e.rowVisitsNeeded?{comparing:{fetchLimit:Fe}}:{}}).map(o=>({key:`rows-${o.label}`,label:o.label,swatch:o.note?void 0:_n(o.swatch)})),...En(e),...n.some(o=>o.spanningReads!==0)?[r("call",nt,"allele length called for this walk")]:[],...n.some(o=>o.spanningReads===0)?[r("unbacked",rt,"called with no read spanning it")]:[],...n.some(o=>o.agrees===!1)?[r("disagrees",ot,`walk and call over ${Math.round(.1*100)}% apart`)]:[]]}function Da(e,t){return Ie(dt(t,e.walkLabel(t.name),e.walkReference))}function Ha(e){return e.facetPanels?[...U(e,"walks"),...U(e,"skips"),...U(e,"too-small")]:[]}function Ln(e){let t=(a,i,s)=>({testid:a,rows:e.facetPanels&&i==="walks"?[]:U(e,i),group:s}),n=[{testid:"graph-open-bubble-legend",rows:mn(e)},t("graph-ramp-legend","ramp","Color"),t("graph-walk-readout","walks","Walks"),t("graph-width-legend","node-width","Node thickness"),t("graph-link-width-legend","link-width","Link thickness"),t("graph-halo-legend","halo","Marks"),t("graph-deletion-legend","skips","Marks"),t("graph-not-shown-legend","not-shown","Marks"),t("graph-gene-legend","exon","Marks"),{testid:"graph-path-legend",rows:yn(e),group:"Paths"},{testid:"graph-tube-map-legend",rows:[...Sn(e),...xn(e)],group:"Tube map"},{testid:"graph-walk-rows-legend",rows:Mn(e),group:"Walk rows"},{testid:"graph-reference-strip-legend",rows:Rn(e),group:"Reference strip"},t("graph-compressed-legend","compressed"),{testid:"graph-fold-legend",rows:Pn(e)},t("graph-too-small-legend","too-small")].filter(a=>a.rows.length>0);if(new Set(n.flatMap(a=>a.group??[])).size<2)return n;let o=new Set;return n.map((a,i)=>{let{group:s}=a;return s?o.has(s)?a:(o.add(s),{...a,heading:s}):i===0?a:{...a,spaced:!0}})}function Xa(e){let{unlabelled:t}=e.overlayLabels,n=Wt(t?.count??0),r=ct(t);return Ln(e).map(o=>({...o,rows:o.rows.map(a=>a.count===void 0?a:{...a,count:n,...r?{title:a.title?`${a.title}
4
4
  ${r}`:r}:{}})}))}var Cn="rgba(0, 0, 0, 0.28)";function Dt({id:e,x:t,y:n,stops:r,width:o,height:a,square:i,edged:s,rim:p}){let b=p?ee:s?1:0,f=b/2,h=d=>l("rect",{x:t+f,y:n+f,width:o-f*2,height:a-f*2,rx:i?0:2,fill:d,stroke:p??(s?Cn:void 0),strokeWidth:p?b:void 0});return r.length>1?y(I,{children:[l("defs",{children:l("linearGradient",{id:e,children:r.map((d,u)=>l("stop",{offset:d.offset,stopColor:d.color},u))})}),h(`url(#${e})`)]}):h(r[0].color)}function An({swatch:e,x:t,id:n}){switch(e.kind){case"fill":{let o=z(e);return l(Dt,{id:n,x:t,y:-5-o/2,stops:e.stops,width:ie(e),height:o,square:e.square,edged:e.edged,rim:e.rim})}case"bands":{let o=Ge(e.bands),a=-5-z(e)/2;return l(I,{children:e.bands.map((i,s)=>l(Dt,{id:`${n}-${s}`,x:t,y:a+s*o,stops:i,width:R,height:o,square:!0},s))})}case"line":return e.short?l("line",{x1:t+5,x2:t+R-5,y1:-5,y2:-5,stroke:e.color,strokeWidth:1.5}):e.dashed?l("line",{x1:t+1,x2:t+R,y1:-5,y2:-5,stroke:e.color,strokeWidth:3,strokeDasharray:"4 3"}):l("rect",{x:t,y:-5-1.5,width:R,height:3,rx:2,fill:e.color});case"halo":return l("line",{x1:t+5,x2:t+13,y1:-5,y2:-5,stroke:e.color,strokeOpacity:.35,strokeWidth:8,strokeLinecap:"round"});case"outline":{let o=e.stroke/2;return l("rect",{x:t+o,y:-5-e.height/2+o,width:R-e.stroke,height:e.height-e.stroke,rx:Math.max(0,e.radius-o),fill:"none",stroke:e.color,strokeWidth:e.stroke})}case"overhang":return l("path",{transform:`translate(${t} -10)`,d:"M0,5 L8,0 L8,10 Z M18,5 L10,0 L10,10 Z",fill:"#18181c"});case"glyph":return l("text",{x:t+R/2,y:-1,textAnchor:"middle",fontFamily:"monospace",fontSize:12,fill:"currentColor",children:e.char});case"tick":{let o=-5-e.height/2;return y(I,{children:[e.backing?l("rect",{x:t,y:o,width:R,height:e.height,fill:e.backing}):null,l("rect",{x:t+R/2-1,y:o,width:2,height:e.height,fill:e.color})]})}case"bracket":return l("path",{transform:`translate(${t} ${-5-3.5})`,d:`M0.5,6 V1.5 H5.5 V6 M8.5,6 V1.5 H${R-.5} V6`,fill:"none",stroke:kt()});case"blank":return null;case"threads":return l(I,{children:[-3,0,3].map(o=>l("line",{x1:t,x2:t+R,y1:-5+o,y2:-5+o,stroke:"#444",strokeWidth:K},o))});case"heads":return y("g",{transform:`translate(${t} -5)`,children:[l("line",{x2:R,stroke:e.lane,strokeWidth:e.lanePx}),e.haloPx===void 0?null:l("path",{d:e.heads,fill:"none",stroke:"#ffffff",strokeWidth:e.haloPx,strokeLinejoin:"round"}),l("path",{d:e.heads,fill:e.fill})]})}}var ja=m(function({swatch:t}){let n=D(),r=z(t);return l("svg",{width:ie(t),height:r,overflow:"visible",style:{flex:"none"},children:l("g",{transform:`translate(0 ${r/2+5})`,children:l(An,{swatch:t,x:0,id:n})})})});function On(e,t,{lit:n,dpr:r}){let o=t.hostBpFrame;o&&mt(e,t.referenceStripBlocks,o,{width:t.paneWidth,lit:n,dpr:r})}var Nn=m(function({model:t}){let n=L((r,o)=>{On(r,t,{lit:t.referenceStripLit,dpr:o})},[t]);return l(C,{model:t,zIndex:5,shown:t.referenceStripShown,testId:"graph-reference-strip",paint:n})}),ns=Nn;var Tn=.45;function vn(e,t,{highlightNode:n}){let r=t.tubeMapPicture,o=t.tubeMapFrame;if(!r||!o)return;let a=t.paneWidth,i=t.tubeMapPanelViews;if(i){In(e,t,i,n);return}let s={...o,width:a,highlightNode:n,tubeColors:t.tubeMapTubeColors,nodeColors:t.tubeMapNodeColors};Se(e,r,s);let p=t.layoutResult?.tubeMap;p&&(Ee(e,r,p.graph,s),Me(e,p,s)),ye(e,t.tubeMapDeviations,s),Mt(e,t.tubeMapConnectors,t.connectorZoneBottom,s);let{bounds:b}=r;wt(e,t.tubeMapGenes,s,o.y(b.minY)-2);let f=t.tubeMapRulerBoxes;f&&Pe(e,f,s,o.y(b.maxY)+4,t.layoutResult?.referenceAxis)}function In(e,t,n,r){let o=t.paneWidth;for(let s of n){if(s.bottom<0||s.titleTop>t.canvasHeight)continue;let p={...s.frame,width:o,highlightNode:r,tubeColors:s.tubeColors,nodeColors:s.nodeColors};Se(e,s.picture,p),Ee(e,s.picture,s.panel.result.tubeMap.graph,p),Me(e,s.panel.result.tubeMap,p),e.globalAlpha=Tn,ye(e,s.deviations,p),e.globalAlpha=1,e.strokeStyle="rgba(0,0,0,0.15)",e.lineWidth=1,e.beginPath(),e.moveTo(0,Math.round(s.titleTop)+.5),e.lineTo(o,Math.round(s.titleTop)+.5),e.stroke(),e.font=_t,e.textAlign="left",e.textBaseline="top",e.fillStyle="rgba(0,0,0,0.85)",e.fillText(s.label,6,s.titleTop+4)}let a=n.at(-1),i=t.tubeMapPanelRulerBoxes;a&&i&&Pe(e,i,{...a.frame,width:o},a.bottom+4,!0)}var Gn=m(function({model:t}){let n=L(r=>{vn(r,t,{highlightNode:t.selectedNode})},[t]);return l(C,{model:t,zIndex:1,shown:!!t.tubeMapPicture,testId:"graph-tube-map",paint:n})}),hs=Gn;var W=JBrowseExports["@jbrowse/render-core/marks"],Ht=e=>W!=null&&e in Object(W)?W[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/render-core/marks' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e});var Xt=Ht("makeAbgrFill");var Be=Ht("spanMark");var ms=W&&W.__esModule?W.default:W;var Bn=["bars","hollows","gaps","hairlines"],Kt=e=>(e.match(/-?\d*\.?\d+(?:e[-+]?\d+)?/gi)??[]).map(Number);function $t(e){if(e.startsWith("#")){let o=Number.parseInt(e.slice(1),16);return[o>>16&255,o>>8&255,o&255]}let[t=0,n=0,r=0]=Kt(e);return e.startsWith("hsl")?Ve(t,n/100,r/100).map(o=>o*255):[t,n,r]}var Ft=([e,t,n])=>ze(Math.round(e),Math.round(t),Math.round(n),255),Yt=e=>Ft($t(e));function Wn(){let e=new Map;return t=>{let n=e.get(t);return n===void 0&&(n=Yt(t),e.set(t,n)),n}}function Dn(e,t,n,r=!1,o=Yt){let a=e.start+e.bp,i=Re(e,t,r);if("fill"in i)return[[e.start,a,o(i.rim??i.fill)]];let s=i.stops.map($t),p=i.stops.map(d=>Kt(d)[0]),b=Math.abs(p.at(-1)-p[0]),f=Math.max(1,Math.min(Math.ceil(e.bp*n),Math.ceil(b),e.bp)),h=[];for(let d=0;d<f;d++){let u=(d+.5)/f*(s.length-1),k=Math.min(Math.floor(u),s.length-2),w=s[k],E=s[k+1],x=u-k;h.push([Math.round(e.start+e.bp*d/f),Math.round(e.start+e.bp*(d+1)/f),Ft([0,1,2].map(c=>w[c]+(E[c]-w[c])*x))])}return h}function le(e){return{x:new Uint32Array(e),x2:new Uint32Array(e),row:new Uint32Array(e),color:new Uint32Array(e),inner:new Uint32Array(e),count:0}}function Hn(e,t,n){return{x:e.x.subarray(t,n),x2:e.x2.subarray(t,n),row:e.row.subarray(t,n),color:e.color.subarray(t,n),inner:e.inner.subarray(t,n),count:n-t}}function Xn(e,t,n,r){let o=Re(e,t,n);return"fill"in o&&o.rim!==void 0?r(o.fill):void 0}var Kn=(e,t)=>e.gap?et(e.cause).px===we?"hairlines":"gaps":t===void 0?"bars":"hollows";function Ut(e,t,n,r=!1){let o=Wn(),a=e.map(f=>at(f.runs,t,r).map(h=>{let d=Xn(h,n,r,o);return{kind:Kn(h,d),inner:d??0,pieces:Dn(h,n,t,r,o)}})),i={bars:0,hollows:0,gaps:0,hairlines:0};for(let f of a)for(let h of f)i[h.kind]+=h.pieces.length;let s={bars:le(i.bars),hollows:le(i.hollows),gaps:le(i.gaps),hairlines:le(i.hairlines)},p={bars:new Uint32Array(e.length+1),hollows:new Uint32Array(e.length+1),gaps:new Uint32Array(e.length+1),hairlines:new Uint32Array(e.length+1)},b=1;return a.forEach((f,h)=>{for(let d of f){let u=s[d.kind];for(let[k,w,E]of d.pieces){let x=u.count++;u.x[x]=k,u.x2[x]=w,u.row[x]=h,u.color[x]=E,u.inner[x]=d.inner,b=Math.max(b,w)}}for(let d of Bn)p[d][h+1]=s[d].count}),{...s,barRows:p.bars,hollowRows:p.hollows,gapRows:p.gaps,hairlineRows:p.hairlines,longest:b}}function $n(e,t,n){let r=ee,o=Xt(e);for(let a=0;a<t.count;a++){let i=n(a);i&&i.width>2*r&&i.height>2*r&&(o(t.inner[a]),e.fillRect(i.left+r,i.top+r,i.width-2*r,i.height-2*r))}}function zt(e,t,n){let{longest:r}=t,o={start:0,end:r,screenStartPx:n.origin*n.scaleX+n.translateX,screenEndPx:(n.origin+r)*n.scaleX+n.translateX,reversed:!1,displayedRegionIndex:0},a={canvasWidth:n.width,canvasHeight:n.height},i=n.rowPx*n.scaleY;for(let{first:s,count:p,rowY:b}of n.blocks){let f=i/2-n.translateY-(b-s*n.rowPx)*n.scaleY,h=(b-n.rowPx/2)*n.scaleY+n.translateY;if(!(h>n.height||h+p*i<0))for(let[d,u,k]of[[t.bars,t.barRows,n.barPx],[t.hollows,t.hollowRows,n.barPx],[t.gaps,t.gapRows,Math.min(Je,n.barPx)],[t.hairlines,t.hairlineRows,Math.min(we,n.barPx)]]){let w=Hn(d,u[s],u[s+p]),E={rowHeight:i,rowProportion:k/i,minWidthPx:1,seamPx:0,scrollTop:f};Be.paintBlock(e,w,o,a,E),d===t.hollows&&$n(e,w,x=>Be.ink?.(w,o,a,E,x))}}}var Fn=m(function({model:t}){let n=ue(()=>j(()=>t.walkRowBars?Ut(t.walkRowList,t.scaleX,t.referenceRampDomain):void 0),[t]),r=L(o=>{let a=t.walkRowBars,i=t.walkRowPlacement,s=t.walkRowPitch,p=n.get();!a||!i||!s||!p||zt(o,p,{...t.screenTransform,width:t.drawingWidth,height:t.canvasHeight,rowPx:s.rowPx,barPx:s.barPx,origin:a.origin,blocks:i.blocks(a.rows.length+1)})},[t,n]);return l(C,{model:t,zIndex:3,testId:"graph-walk-rows-spans",paint:r})}),Yn="rgba(160, 196, 232, 0.55)",Un="rgba(160, 140, 220, 0.55)",zn=m(function({model:t}){let n=L(r=>{let o=t.walkRowRibbons,a=t.walkRowBars,i=t.walkRowPlacement,s=t.walkRowPitch;if(!o||!a||!i||!s)return;let{scaleX:p,scaleY:b,translateX:f,translateY:h}=t.screenTransform,d=k=>(a.origin+k)*p+f,u=s.barPx/2;for(let{row:k,a0:w,a1:E,b0:x,b1:c}of o){let g=i.rowY(k)*b+h+u,P=i.rowY(k+1)*b+h-u;r.fillStyle=x>c?Un:Yn,r.beginPath(),r.moveTo(d(w),g),r.lineTo(d(E),g),r.lineTo(d(c),P),r.lineTo(d(x),P),r.closePath(),r.fill()}},[t]);return l(C,{model:t,zIndex:2,testId:"graph-walk-rows-ribbons",paint:n})}),Vn=m(function({model:t}){let n=L(r=>{let o=t.sharedBlocks,a=t.walkRowBars,i=t.walkRowPlacement,s=t.walkRowPitch;if(!o||!a||!i||!s)return;let{scaleX:p,scaleY:b,translateX:f,translateY:h}=t.screenTransform;vt(r,o,{x:d=>(a.origin+d)*p+f,rowCentre:d=>i.rowY(d)*b+h,barPx:s.barPx})},[t]);return l(C,{model:t,zIndex:3,testId:"graph-walk-rows-blocks",paint:n})}),jn=m(function({model:t}){let n=t.walkRowBars,r=t.walkRowPlacement,o=t.walkRowPitch;if(!n||!r||!o||!t.hoveredWalkRowText)return null;let a=t.walkRowList,i=a.findIndex(b=>b.name===t.hoveredWalkRow),s=a[i];if(!s)return null;let p=t.toScreen({x:n.origin,y:r.rowY(i)});return l("rect",{"data-testid":"graph-walk-row-hovered",x:p.x-2,y:p.y-o.rowPx/2-1,width:Qe(s)*t.scaleX+4,height:o.rowPx+2,fill:"none",stroke:"#111",strokeWidth:1})});function qn(e,t,n){let r=()=>({translateX:e.translateX,translateY:e.translateY}),o=(i,s)=>({scaleX:e.scaleX,scaleY:e.scaleY,translateX:s.translateX,translateY:s.translateY,width:e.drawingWidth,height:e.canvasHeight,...i,bars:n,measure:Rt}),a=j(()=>{let i=e.walkRowBars,s=e.walkRowPlacement,p=e.walkRowPitch;return i&&s&&p?yt(i,s.rowY,o(p,r()),{comparing:e.rowVisitsNeeded}):void 0});return j(()=>{let i=e.walkRowBars,s=e.walkRowPlacement,p=e.walkRowPitch;te(a.get());let b=De(r);return i&&s&&p?{at:b,trees:Pt(i,e.walkRowGroups?.sections??[],s.rowY,o(p,b),{ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes,idPrefix:t,comparing:e.rowVisitsNeeded})}:void 0})}var Zn=m(function({model:t}){return t.walkRowPlacement?.headers.map(n=>l("text",{x:10,y:t.toScreen({x:0,y:n.top}).y+xt-4,fontFamily:"sans-serif",fontSize:11,fontWeight:"bold",fill:"#333","data-testid":"graph-walk-section",children:n.title},n.key))}),Jn=m(function({model:t,vector:n=!1}){let r=D(),o=ue(()=>qn(t,r,n),[t,r,n]).get();return o?y(I,{children:[n||!t.walkRowRibbons?null:l(zn,{model:t}),n?null:l(Fn,{model:t}),n||!t.sharedBlocks?null:l(Vn,{model:t}),y(N,{model:t,zIndex:3,overflow:"visible",testId:"graph-walk-rows",children:[l(At,{model:t,drawnAt:o.at,children:o.trees.map((a,i)=>l(F,{el:a},i))}),l(Zn,{model:t}),l(jn,{model:t})]})]}):null}),Is=Jn;var Ws={background:"#fff",padding:"3px 6px",fontSize:11,lineHeight:"15px",whiteSpace:"nowrap"},Ds={display:"flex",alignItems:"center",gap:5},Qn=260,Hs={color:"#666",maxWidth:Qn,whiteSpace:"normal"},er="#6b7479",Xs=4,Ks={color:er,fontSize:9.5,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase"};export{jt as a,Ct as b,N as c,Er as d,Jt as e,vr as f,D as g,F as h,Yr as i,co as j,uo as k,ie as l,Ga as m,Ba as n,Wa as o,_n as p,Da as q,Ha as r,Ln as s,Xa as t,An as u,ja as v,On as w,ns as x,vn as y,hs as z,Is as A,Ws as B,Ds as C,Hs as D,er as E,Xs as F,Ks as G};
5
- //# sourceMappingURL=chunk-NDWP2KNR.js.map
5
+ //# sourceMappingURL=chunk-JJ2TPWSH.js.map
@@ -1,2 +1,2 @@
1
- import{a as W,b as ut}from"./chunk-OIGMGVI6.js";import{A as It,B as Gt,C as te,D as Tt,F as fe,G as Ht,a as dt,b as ft,c as ht,d as mt,f as gt,g as yt,h as B,i as vt,j as bt,k as wt,m as St,n as xt,o as de,p as kt,q as Pt,r as Mt,s as Rt,t as Ct,v as ee,x as Lt,z as Et}from"./chunk-NDWP2KNR.js";import{$ as ct,E as qe,F as et,H as tt,I as nt,J as rt,K as ot,L as at,M as it,_ as lt,a as P,c as Xe,ca as ue,ea as pt,f as Ze,g as $e,p as Y,q as je,r as Ke,s as Ue}from"./chunk-ZKQLPKNN.js";import{q as O}from"./chunk-OP2PTYDR.js";import{$c as st,Ba as pe,Eb as Q,Ha as J,J as ce,La as Fe,Mb as Je,Na as Ve,Nb as Qe,S as We,Wb as _,Ya as Ye,Z as Be,a as F,b as ke,d as Pe,ea as De}from"./chunk-AVUNIRM5.js";import{x as Oe}from"./chunk-JWIFJIPZ.js";import{M as se,Q as le}from"./chunk-4RZCYOCW.js";import{c as Se}from"./chunk-LRBNBP2K.js";import{w as we}from"./chunk-RQSCKHNS.js";import{d as E}from"./chunk-WKD7ALOU.js";import{C as xe}from"./chunk-CTQBRAQH.js";import{j as K}from"./chunk-5L276I7O.js";import{a as _e,e as G,f as ze,g as Ne,h as C,i as L}from"./chunk-J2PN6CG3.js";import{A as He,E as Ae,H as q,I as V,b as Me,c as Re,e as ie,k as Ce,o as Le,p as Ee,t as Ie,w as U,x as Ge,z as Te}from"./chunk-H42TSPVA.js";import{a as M,b as n,c as h,d}from"./chunk-DUU6T2I5.js";function At(t){return Promise.resolve(new _(t))}var z=JBrowseExports["@jbrowse/render-core/useRenderingBackend"],Mn=t=>z!=null&&t in Object(z)?z[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/render-core/useRenderingBackend' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t});var _t=Mn("useRenderingBackend"),Tr=z&&z.__esModule?z.default:z;var he=ft(1),zt=d(function({model:e}){let[r,i]=L(null);return G(()=>{if(!r)return;let a=new _(r),c=F(()=>{Ye(st()),a.resize(e.paneWidth,e.canvasHeight),e.paintHover(a,e.drawnBatch)});return()=>{c(),a.dispose()}},[r,e]),n("canvas",{ref:i,"data-testid":"graph-hover-layer",style:{...he,clipPath:e.drawingClip}})});var ne=d(function({row:e,at:r,hint:i,after:a,column:c}){let l=c===void 0?void 0:{paddingLeft:c+5};return e.swatch?h("div",{title:[e.title,i].filter(Boolean).join(" \xB7 ")||void 0,children:[h("div",{style:te,children:[n("span",{style:{display:"flex",flex:"none",justifyContent:"center",width:c},children:n(ee,{swatch:e.swatch})}),h("span",{children:[e.strong?n("strong",{children:e.strong}):null,e.label]}),e.sizer===void 0?null:h("span",{style:Rn,children:[n("span",{style:Cn,"aria-hidden":!0,"data-testid":"graph-key-sizer",children:de(e.sizer)}),n("span",{style:Ln,"data-testid":"graph-key-count",children:de(e.count)})]}),a]}),r?n("div",{style:l,"data-testid":"graph-walk-at",children:r}):e.under?n("div",{style:l,children:e.under}):null]}):n("div",{style:Tt,children:e.label})}),Rn={display:"grid"},Cn={gridArea:"1 / 1",visibility:"hidden"},Ln={gridArea:"1 / 1",width:0,minWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"},En={pointerEvents:"auto",cursor:"pointer",border:"none",background:"none",padding:"0 2px",font:"inherit",textDecoration:"underline"},Nt=d(function({model:e,sections:r}){if(r.length===0)return null;let i=r.flatMap(l=>l.rows),a=xt(i),c=St(i);return n("div",{style:{...Gt,lineHeight:`${a}px`},children:r.map(({testid:l,rows:p,heading:s,spaced:u},m)=>h(_e,{children:[s?n("div",{style:{...Ht,paddingTop:m===0?0:fe},children:s}):null,n("div",{"data-testid":l,style:u?{paddingTop:fe}:void 0,children:p.map(g=>n(ne,{row:g,column:c,at:g.walk?e.hoveredOn(g.walk):void 0,after:g.closesBubble?n("button",{type:"button",style:En,"data-testid":"graph-close-bubble",onClick:()=>{e.closeBubbles()},children:"close"}):null},g.key))})]},l))})});var In={position:"absolute",left:0,top:0,zIndex:4,display:"grid",gap:Je,lineHeight:"normal"},Gn={height:Qe,padding:"2px 6px",boxSizing:"border-box",fontFamily:"inherit",fontSize:11,color:"inherit",cursor:"pointer",border:"none",background:"none",textAlign:"left",display:"block"},Tn={position:"relative"},Hn={gridColumn:"1 / -1",height:ct,padding:"2px 6px",boxSizing:"border-box",display:"flex",gap:14,fontSize:11,lineHeight:"15px"},An=d(function({model:e,lift:r,index:i,width:a,height:c,cell:l,handlers:p,canvasStyle:s}){let[u,m]=L(null),[g,S]=L(null),I=r.walks[0];G(()=>{if(!u||!g)return;let A=new _(u),N=new _(g),$=ke(()=>e.facetDrawings?.[i]),D,X=[F(()=>{let R=e.facetGrid;R&&A.resize(R.width,R.height);let T=$.get();T&&(T!==D&&(A.uploadGeometry(T.batch),D=T),e.applySelection(A),e.paint(A))}),F(()=>{let R=e.facetGrid;R&&N.resize(R.width,R.height);let T=$.get();T&&e.paintHover(N,T.batch)})];return()=>{for(let R of X)R();A.dispose(),N.dispose()}},[u,g,e,i]);let H=e.walkLabel(I.name);return h("div",{style:l,children:[n("button",{type:"button",style:Gn,"data-testid":"graph-facet-title",onClick:()=>{e.liftWalks([I.name]),e.setFacet("")},children:n(ne,{row:Pt(e,I),hint:`click to lift ${H} alone`,at:e.hoveredOn(I)})}),h("div",{style:Tn,children:[n("canvas",{ref:m,"data-testid":"graph-facet-canvas",style:{...s,width:a,height:c,display:"block"},...p}),n("canvas",{ref:S,style:he})]})]})}),_n=d(function({model:e,handlers:r,canvasStyle:i}){let a=e.facetPanels,c=e.facetGrid,l=e.facetPlacement;if(!a||!c||!l)return null;let{columns:p,width:s,height:u}=c;return h("div",{"data-testid":"graph-facet-panels",style:{...In,width:e.paneWidth,minHeight:e.canvasHeight,gridTemplateColumns:`repeat(${p}, ${s}px)`,background:J},children:[a.map((m,g)=>n(An,{model:e,lift:m,index:g,width:s,height:u,cell:{gridRow:Math.floor(l.cells[g]/p)+1,gridColumn:l.cells[g]%p+1},handlers:r,canvasStyle:i},m.walks[0].name)),n("div",{style:{...Hn,gridRow:Math.floor(l.cells.reduce((m,g)=>Math.max(m,g),-1/0)/p)+2},"data-testid":"graph-facet-key",children:Mt(e).map(m=>n(ne,{row:m},m.key))})]})}),Ot=_n;var Wt=P(n("path",{d:"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2m2 10H3v4c0 1.1.9 2 2 2h4v-2H5zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2"}),"CropFree");var Bt=P([n("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"},"0"),n("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var Dt=P(n("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14M7 9h5v1H7z"}),"ZoomOut");var zn=d(function({model:e}){let r=e.colorSchemeLock;return n(W,{label:"Color",size:"small",sx:{minWidth:100},disabled:r!==void 0,title:r?.why,shown:r?.value,value:e.chosenColorScheme,options:qe.map(({value:i})=>({value:i,label:e.colorSchemeLabel(i)})),testId:"graph-color-select",onChange:i=>{e.setColorScheme(i)}})}),Xt=zn;var Ft=O()(t=>({stats:{marginLeft:"auto"},perf:{color:t.palette.text.secondary,fontVariantNumeric:"tabular-nums"}}));function me(t){return t===void 0?"\u2013":`${Math.round(t)}ms`}var Nn=d(function({model:e}){let{classes:r}=Ft(),{lastFetchMs:i,lastLayoutMs:a,lastGeometryMs:c}=e,l=i!==void 0||a!==void 0||c!==void 0;return e.showPerf&&l?h(V,{variant:"caption",className:r.perf,"data-testid":"graph-perf-stats",children:["fetch ",me(i)," \xB7 layout ",me(a)," \xB7 geom"," ",me(c)]}):null}),On=d(function({model:e}){let{classes:r}=Ft();return h("div",{className:r.stats,"data-testid":"graph-stats","data-node-count":e.nodeCount,"data-edge-count":e.edgeCount,"data-path-count":e.pathCount,"data-fetch-ms":e.lastFetchMs??"","data-layout-ms":e.lastLayoutMs??"","data-geometry-ms":e.lastGeometryMs??"","data-geometry-strokes":e.lastGeometryStrokeCount??"",children:[h(V,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",n(Nn,{model:e})]})}),Vt=On;var Wn=d(function({model:e}){let{graph:r}=e;return n(W,{label:"Layout",size:"small",sx:{minWidth:140},testId:"graph-layout-select",value:e.chosenLayoutMode,options:Xe.map(({value:i,label:a,description:c,available:l})=>({value:i,label:a,description:c,disabled:r?!l(r):!1})),onChange:i=>{e.switchLayout(i)}})}),Yt=Wn;var Bn=d(function({model:e}){return e.chosenLayoutMode!=="walkrows"||e.repeatChoices.length===0?null:n(W,{label:"Repeat",size:"small",sx:{minWidth:130,maxWidth:260},testId:"graph-repeat-select",value:e.selectedRepeat?.key??"",options:e.repeatOptions,onChange:r=>{e.setRepeatKey(r)}})}),Zt=Bn;var $t=P(n("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close");var jt=P(n("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreVert");var Dn=d(function({model:e}){let r=e.highlightMenuItems({picks:!1});return n(Me,{size:"small",tooltip:"Graph options",menuItems:[...r.length>0?[{label:"Haplotypes",icon:Ze,subMenu:r}]:[],...e.layoutOptionMenuItems({repeat:!1}),{label:"Show",icon:et,subMenu:[...e.showMenuItems(),...e.modeDrawsNodes&&e.walkChoices.length>1?[{type:"checkbox",label:"Show walk rows under the graph",checked:e.walkStrip,onClick:()=>{e.setWalkStrip(!e.walkStrip)}}]:[],{type:"checkbox",label:"Show timings",checked:e.showPerf,onClick:()=>{e.setShowPerf(!e.showPerf)}}]},{type:"divider"},{label:"Graph settings...",icon:$e,helpText:"Subgraph node limit; node width and path colors; the force-directed layout engine",onClick:()=>{K(e).queueDialog(i=>[ut,{model:e,onClose:i}])}},{type:"divider"},{label:"Close graph",icon:$t,onClick:()=>{e.clearGraph()}}],children:n(jt,{})})}),Kt=Dn;var Xn=O()({formControl:{minWidth:130,maxWidth:260}}),Fn=d(function({model:e}){let{classes:r}=Xn(),i=ze(),{walkChoices:a}=e;if(a.length===0||!e.liftsWalks)return null;let c=new Set(a.map(s=>s.name)),l=new Map(a.map(s=>[s.name,s.label])),p=e.walkLayers.map(s=>s.walk).filter(s=>c.has(s));return a.length>Ve?n(Le,{size:"small",variant:"outlined",color:"inherit","data-testid":"graph-walk-choose",onClick:()=>{K(e).queueDialog(s=>[Fe,{model:e,onClose:s}])},children:p.length>0?`${p.length} of ${a.length} haplotypes`:"Highlight haplotypes..."}):h(Ie,{size:"small",className:r.formControl,children:[n(Ge,{id:i,children:"Highlight"}),n(Ae,{labelId:i,multiple:!0,value:p,label:"Highlight","data-testid":"graph-walk-select",renderValue:s=>s.map(u=>l.get(u)).join(", "),onChange:s=>{let{value:u}=s.target;e.liftAmongChoices(typeof u=="string"?u.split(","):u)},children:a.map(({name:s,label:u})=>h(He,{value:s,dense:!0,children:[n(Ee,{size:"small",checked:p.includes(s)}),n(Te,{primary:u})]},s))})]})}),Ut=Fn;var Vn=O()(t=>({toolbar:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:`1px solid ${t.palette.divider}`}})),Yn=d(function({model:e}){return n(V,{variant:"body2",children:e.zoomPercent})}),Zn=d(function({model:e}){let{classes:r}=Vn(),i=a=>{e.zoom(a,e.viewBox.width/2,e.viewBox.height/2)};return h("div",{className:r.toolbar,children:[n(Yt,{model:e}),n(Xt,{model:e}),n(Ut,{model:e}),n(Zt,{model:e}),n(q,{title:"Zoom in",children:n(U,{size:"small",onClick:()=>{i(1.5)},children:n(Bt,{})})}),n(q,{title:"Zoom out",children:n(U,{size:"small",onClick:()=>{i(1/1.5)},children:n(Dt,{})})}),n(q,{title:"Zoom to fit",children:n(U,{size:"small",onClick:()=>{e.refitView()},children:n(Wt,{})})}),n(Yn,{model:e}),n(Vt,{model:e}),n(Kt,{model:e})]})}),qt=Zn;var $n={position:"absolute",bottom:lt,lineHeight:"normal",background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",zIndex:6};function ge({label:t,readout:e}){return h(M,{children:[n("strong",{children:t})," \u2014 ",e]})}function jn(t,e){if(e)return{testId:"graph-chip-tooltip",body:ge(e)};let r=t.hoveredNode?t.hoverNodeById?.get(t.hoveredNode):void 0;if(r){let l=Ke(r),p=t.hoverDrawing?.members.get(r.id),s=Ue(r),u=t.graphRegion,m=t.hoveredSpan,g=u&&m&&!we(r)?`${u.assemblyName} ${Y({refName:u.refName,...m})}`:void 0,S=ce(t.genePins,r.id),I=S.length>0?h(M,{children:[n("br",{}),n("em",{children:S.join(", ")})]}):null;return l?{body:h(M,{children:[l,I]})}:{body:h(M,{children:[n("strong",{children:r.name}),p?` and ${p.length-1} more`:""," \u2014"," ",r.length.toLocaleString()," bp, depth ",r.depth.toFixed(1),s?h(M,{children:[n("br",{}),s.sample," ",Y(s)," (rank ",r.stable?.rank,")"]}):null,g?h(M,{children:[n("br",{}),"Reference ",g]}):null,I,r.moved?h(M,{children:[n("br",{}),"End of a component too large to draw here"]}):null]})}}let i=t.hoveredEdge===null?void 0:t.graph?.edges[t.hoveredEdge];if(i){let l=je(i,t.deletions.find(s=>s.edgeIndex===t.hoveredEdge),s=>t.nodeById?.get(s)?.name??s),p=t.graph?Se(t.graph):void 0;return{body:l.deletion?h(M,{children:[`skips ${l.deletion.bp} of ${p??"the reference"} sequence`,n("br",{}),l.deletion.where]}):h(M,{children:["Edge: ",l.ends]})}}let a=t.hoveredWalkRowText;if(a)return{testId:"graph-walk-row-tooltip",body:ge(a)};let c=t.hoveredTubeText;return c?{testId:"graph-tube-tooltip",body:ge(c)}:void 0}var Kn=d(function({model:e,chip:r}){let i=jn(e,r);return i?n("div",{style:{...$n,right:e.tooltipRightPx},"data-testid":i.testId,children:i.body}):null}),Jt=Kn;var Qt=P(n("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}),"FilterList");var en=P(n("path",{d:"M10.83 8H21V6H8.83zm5 5H18v-2h-4.17zM14 16.83V18h-4v-2h3.17l-3-3H6v-2h2.17l-3-3H3V6h.17L1.39 4.22 2.8 2.81l18.38 18.38-1.41 1.41z"}),"FilterListOff");var tn=P(n("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info");var Un={x:0,y:0};function qn(t,e){let{own:r,reference:i,highlight:a}=t.nodeLaunchTargets(e);return[{label:"Node details",icon:tn,onClick:()=>{t.showNodeDetails(e)}},...pt({own:r,reference:i,highlight:a,onShowLinear:c=>{t.showInLinearView(c)},onHighlight:t.canHighlightInLinearView?c=>{t.highlightInLinearView(c)}:void 0})]}function Jn(t,e,r){let i=r??t.walkRowBars,a=t.walkRowLaunchTarget(e,i),c=a?.assembly,l=e>0?i?.rows[e-1]:void 0,p=l?.sample,s=t.abridged.find(g=>g.name===l?.name),u=!r&&t.walkRowBars,m=t.walkRowSamples;return[a&&c?{label:`Linear genome view \u2014 ${c} ${Y(a.location)}`,icon:ue,onClick:()=>{t.showInLinearView({location:a.location,assembly:c})}}:{label:"Linear genome view",icon:ue,disabled:!0,disabledHelpText:a?`No assembly in this session is ${a.location.haplotype??a.label}`:"This walk states no contig coordinates",onClick:()=>{}},...r&&l&&s?[{label:"Load its steps",subLabel:xe(s,l.label),onClick:()=>{t.expandWalk(l.name)}}]:[],...l&&t.liftsWalks&&t.modeDrawsNodes?[{type:"checkbox",label:`Highlight ${l.label}`,checked:t.walkLayers.some(g=>g.walk===l.name),onClick:()=>{t.toggleWalk(l.name)}}]:[],...u&&p&&!(m?.length===1&&m[0]===p)?[{label:`Show only ${p}`,icon:Qt,onClick:()=>{t.setWalkRowSamples([p])}}]:[],...u&&m?[{label:"Show every sample",icon:en,onClick:()=>{t.setWalkRowSamples(void 0)}}]:[]]}var re=d(function({model:e,at:r,onClose:i}){return n(Re,{anchor:r,offset:Un,onClose:i,menuItems:()=>r===void 0?[]:"nodeId"in r?qn(e,r.nodeId):Jn(e,r.row,r.bars)})});var Qn=d(function({model:e}){return n(M,{children:e.passBars.map(r=>n("svg",{"data-testid":"graph-pass-bar",width:e.paneWidth,height:at,style:{display:"block",borderTop:"1px solid #ddd"},children:n(B,{el:it(r,e.walkLabel(r.walk),e.paneWidth)})},r.walk))})}),nn=Qn;var er={display:"flex",flexWrap:"wrap",gap:"2px 14px",padding:"2px 8px 6px",fontSize:11,color:"#333"},tr={position:"absolute",pointerEvents:"none",background:"rgba(255,255,255,0.92)",border:"1px solid #ccc",borderRadius:3,padding:"1px 6px",fontSize:11,whiteSpace:"nowrap",zIndex:4},nr=d(function({bars:e,frame:r,ramp:i,rowGenes:a,inks:c}){let l=yt(),p=Ne(()=>De(e,r,{ramp:i,rowGenes:a,idPrefix:l,markUnloaded:!0,inks:c}),[e,r,i,a,l,c]);return n(B,{el:p})}),rr=d(function({model:e}){let r=e.walkStripRows,i=e.walkStripFrame,a=e.stripHover,c=r?[r.reference,...r.rows]:[],l=a?c.findIndex(g=>g.name===a.row):-1,p=c[l],s=r&&i&&p?We(r,l,i):void 0;if(!r||!i||!a||!p||!s||i.labelled&&!s.cut)return null;let u=(r.origin+a.offset)*i.scaleX+i.translateX,m=u>i.width/2?{right:i.width-u+12}:{left:u+12};return h("div",{"data-testid":"graph-walk-strip-tip",style:{...tr,...m,top:l*i.rowPx+i.translateY-18},children:[p.label," \xB7 ",s.text]})}),or=d(function({model:e,bars:r,frame:i}){return n(B,{el:nt(r,i,e.walkStripMarks)})}),ar=d(function({model:e}){let r=e.walkStripRows,i=e.walkStripFrame,[a,c]=L();if(!r||!i)return null;let l=s=>{let u=s.currentTarget.getBoundingClientRect();return tt(r,i,s.clientX-u.left,s.clientY-u.top)},p=Be(r,{ramp:e.referenceRampDomain,rampCss:Oe,genes:ot(i,e.walkRowGenes,e.walkRowGeneGaps),annotation:e.walkRowAnnotation,markUnloaded:!0,inks:e.walkStripInks});return h("div",{"data-testid":"graph-walk-strip",style:{position:"relative",borderTop:"1px solid #ddd"},onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{E(e)&&(e.setPointerInPane(!1),e.setStripHover(null))},children:[h("svg",{width:i.width,height:i.height,style:{display:"block"},onMouseLeave:()=>{E(e)&&e.setStripHover(null)},onMouseMove:s=>{let u=l(s);s.currentTarget.style.cursor=u&&u.index>0?"pointer":"",e.setStripHover(u?{row:u.row.name,offset:u.offset}:null)},onClick:s=>{let u=l(s);u&&u.index>0&&e.toggleWalk(u.row.name)},onContextMenu:s=>{let u=l(s);u&&(s.preventDefault(),c({clientX:s.clientX,clientY:s.clientY,row:u.index}))},children:[n(nr,{bars:r,frame:i,ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes,inks:e.walkStripInks}),n(or,{model:e,bars:r,frame:i}),n(B,{el:rt(r,i,new Set(e.walkLayers.map(s=>s.walk)))})]}),n(rr,{model:e}),h("div",{style:er,"data-testid":"graph-walk-strip-key",children:[p.map(s=>h("div",{style:te,children:[n(ee,{swatch:kt(s.swatch)}),n("span",{children:s.label})]},s.label)),n("span",{style:{color:"#777"},children:"Ticks mark where each walk passes the node under the pointer; click a haplotype's bar to lift its walk"})]}),n(re,{model:e,at:a&&{...a,bars:r},onClose:()=>{c(void 0)}})]})}),rn=ar;var ir=d(function({model:e}){let r=e.walkStripLocator;return r?h(ht,{model:e,zIndex:4,overflow:"visible",testId:"graph-walk-strip-locator",children:[n("circle",{cx:r.x,cy:r.y,r:11,fill:"none",stroke:"white",strokeWidth:4}),n("circle",{cx:r.x,cy:r.y,r:11,fill:"none",stroke:"#111",strokeWidth:1.75})]}):null}),on=ir;var sr=1.1,lr=100,cr=40,pr=800,ur=10,an=2;function ye(t){let e=t.deltaY*(t.deltaMode===1?cr:t.deltaMode===2?pr:1),r=(t.ctrlKey?ur:1)*e/lr;return sr**-Math.max(-an,Math.min(an,r))}var dr=40,fr=100,hr=24,sn=Math.log(16);function mr(t,e){let r=t*Math.exp(-Math.max(0,e)/hr);return Math.abs(r)<.001?t:t-r}function gr(t,e){let r=Math.abs(t.deltaX)>Math.abs(t.deltaY);return t.ctrlKey||t.metaKey||!r&&(!e||e.scrollZoom)?"zoom":r?"pan":"page"}function pn(t,e,r){G(()=>{if(!t)return;let i=-1/0,a={backlog:0,x:0,y:0,frame:0,last:0},c=p=>{let s=mr(a.backlog,Math.min(100,p-a.last));a.backlog-=s,a.last=p,a.frame=a.backlog?requestAnimationFrame(c):0,E(r)&&r.zoom(Math.exp(s),a.x,a.y)},l=p=>{if(r.hostPlacesX||r.followsHostView)return;let m=((p.target instanceof Element?p.target.closest("canvas"):null)??(r.facetPanels?null:e))?.getBoundingClientRect();if(m&&p.clientY-m.top<r.referenceStripZonePx)return;let g=gr(p,r.host);if(g!=="page"){if(r.host&&p.stopPropagation(),p.preventDefault(),g==="pan"){if(p.timeStamp-i>fr){let S=p.deltaMode===1?dr:1;r.setTransform(r.scale,r.translateX-p.deltaX*S,r.translateY)}return}i=p.timeStamp,m&&(a.x=p.clientX-m.left,a.y=p.clientY-m.top,a.backlog=Math.max(-sn,Math.min(sn,a.backlog+Math.log(ye(p)))),a.frame||(a.last=performance.now()-1e3/60,a.frame=requestAnimationFrame(c)))}};return t.addEventListener("wheel",l,{passive:!1}),()=>{cancelAnimationFrame(a.frame),t.removeEventListener("wheel",l)}},[t,e,r])}var ln=3,ve="data-gesture-owner",Z=t=>({x:t.clientX,y:t.clientY});function cn(t){let[e,r]=[...t.values()];return{spread:Math.hypot(e.x-r.x,e.y-r.y),mid:{x:(e.x+r.x)/2,y:(e.y+r.y)/2}}}function un(t){let e=C({x:0,y:0}),r=C({x:0,y:0}),i=C(!1),a=C(void 0),c=o=>a.current!==void 0&&o.pointerId!==a.current,l=C(new Map),p=C(null),s=C(null),u=C(!1),m=C(null),g=C(!1),S=C({frame:0,pan:null,hover:null,pinch:!1});G(()=>()=>{cancelAnimationFrame(S.current.frame)},[]);let[I,H]=L(),[A,N]=L(!1),[$,D]=L(void 0);function X(o){let f=o.currentTarget.getBoundingClientRect();return{x:o.clientX-f.left,y:o.clientY-f.top}}function R(o,f){if(t.layoutResult?.tubeMap)return t.tubeMapNodeAt(o,f);let y=t.referenceStripNodeAt(o,f);if(y)return y;let{nodePositions:v}=t;if(!v)return null;let{x:b,y:w}=pe(o,f,t,t.axisScale);return se(v,b,w,t.axisScale,t.positionsVersion,t.nodeInk,t.drawnFold)}function T(o,f){let{nodePositions:y,graph:v}=t;if(!y||!v)return null;let{x:b,y:w}=pe(o,f,t,t.axisScale);return le(y,v,b,w,t.axisScale,t.effectiveDrawPaths&&!t.facetPanels,t.positionsVersion,t.deletionEdgeIndexes,t.hiddenEdgeIndexes,t.deletionRoutes,t.layoutResult?.stranded,t.drawnFold)}function fn(o){o.button===0&&o.preventDefault()}function hn(o){if(o.button!==0)return;let f=l.current;if(c(o)){t.isPanning&&!g.current&&o.pointerType==="touch"&&f.size===1&&(o.currentTarget.setPointerCapture(o.pointerId),f.set(o.pointerId,Z(o)),s.current=cn(f),i.current=!0);return}i.current=!1,r.current={x:o.clientX,y:o.clientY},o.currentTarget.removeAttribute(ve);let y=t.followsHostView,{x:v,y:b}=X(o),w=b<t.referenceStripZonePx,k=t.hostPlacesX||t.layoutResult?.tubeMap||w?null:R(v,b);t.hostPlacesX||y&&o.shiftKey||t.followsWindow&&!k||(o.currentTarget.setPointerCapture(o.pointerId),a.current=o.pointerId,p.current=o.currentTarget,f.clear(),f.set(o.pointerId,Z(o)),y&&k&&o.currentTarget.setAttribute(ve,""),g.current=y,u.current=w&&!y,k?t.setDraggingNode(k):t.setPanning(!0),e.current={x:o.clientX,y:o.clientY})}function be(){let o=s.current,f=p.current;if(!o||!f)return;let y=cn(l.current),v=f.getBoundingClientRect();o.spread>0&&y.spread>0&&t.zoom(y.spread/o.spread,o.mid.x-v.left,o.mid.y-v.top),t.setTransform(t.scale,t.translateX+y.mid.x-o.mid.x,t.translateY+y.mid.y-o.mid.y),s.current=y}function mn(){let o=S.current,{pan:f,hover:y,pinch:v}=o;if(o.frame=0,o.pan=null,o.hover=null,o.pinch=!1,v&&be(),f&&u.current?t.host?.horizontalScroll(-f.dx):f&&g.current?t.setTransform(t.scale,t.translateX,t.translateY+f.dy):f&&t.setTransform(t.scale,t.translateX+f.dx,t.translateY+f.dy),!y)return;let{x:b,y:w}=y,k=t.facetPanels?void 0:bt(t.overlayLabels,b,w);D(x=>x?.label===k?.label&&x?.readout===k?.readout?x:k),Pe(()=>{if(t.walkRowBars){let x=t.walkRowAt(b,w);t.setHoveredWalkRow(x===void 0?null:t.walkRowList[x].name)}if(t.nodePositions&&t.graph){let x=R(b,w);t.setHoveredPanel(t.tubeMapPanelAt(w)),t.setHoveredNode(x,{x:b,y:w}),N(x!==null&&!t.hostPlacesX&&!t.layoutResult?.tubeMap&&w>=t.referenceStripZonePx),t.setHoveredTube(x===null&&t.layoutResult?.tubeMap?t.tubeAt(b,w):null),t.setHoveredEdge(x||t.layoutResult?.tubeMap||!t.hoverLightsEverything?null:T(b,w))}})}function j(){S.current.frame||(S.current.frame=requestAnimationFrame(mn))}function gn(){let o=S.current;cancelAnimationFrame(o.frame),o.frame=0,o.pan=null,o.hover=null,o.pinch=!1}function yn(o){let f=l.current;if(s.current&&f.has(o.pointerId)){f.set(o.pointerId,Z(o)),S.current.pinch=!0,j();return}if(c(o)||m.current)return;let y=o.clientX-e.current.x,v=o.clientY-e.current.y;e.current={x:o.clientX,y:o.clientY},Math.hypot(o.clientX-r.current.x,o.clientY-r.current.y)>ln&&(i.current=!0);let b=S.current;if(t.draggingNode)t.moveNode(t.draggingNode,y/t.scaleX,v/t.scaleY);else if(t.isPanning)b.pan={dx:(b.pan?.dx??0)+y,dy:(b.pan?.dy??0)+v},j();else{let w=o.currentTarget.getBoundingClientRect();b.hover={x:o.clientX-w.left,y:o.clientY-w.top},j()}}function oe(o){let f=l.current;if(s.current&&f.has(o.pointerId)){S.current.pinch&&(S.current.pinch=!1,be()),f.delete(o.pointerId),s.current=null;let[[y,v]]=[...f];a.current=y,e.current=v;return}c(o)||(a.current=void 0,f.clear(),E(t)&&t.stopDragging())}function vn(o){c(o)||(D(void 0),N(!1),m.current?S.current.hover=null:(a.current=void 0,l.current.clear(),s.current=null,gn(),E(t)&&t.stopDragging()),E(t)&&t.clearHover())}function bn(o){let{x:f,y}=X(o),v=R(f,y),{clientX:b,clientY:w}=o;if(v){o.preventDefault(),H({clientX:b,clientY:w,nodeId:v});return}let k=t.walkRowAt(f,y);k!==void 0&&(o.preventDefault(),H({clientX:b,clientY:w,row:k}))}function wn(o){if(!i.current){let{x:f,y}=X(o),v=R(f,y);t.setSelectedNode(v),v&&t.showNodeDetails(v)}}G(()=>()=>{m.current?.end()},[]);function Sn(o){if(o.button!==0||t.hostPlacesX||t.followsHostView||!(o.target instanceof Element)||!o.target.closest(`[${dt}]`))return;m.current?.end(),u.current=!1,g.current=!1;let f=o.pointerId,y=Z(o),v=y,b={moved:!1,end:()=>{window.removeEventListener("pointermove",w,!0),window.removeEventListener("pointerup",k,!0),window.removeEventListener("pointercancel",k,!0),b.moved&&E(t)&&t.stopDragging()}};function w(x){if(x.pointerId!==f)return;if(!b.moved){if(Math.hypot(x.clientX-y.x,x.clientY-y.y)<=ln)return;b.moved=!0,t.setPanning(!0)}let ae=S.current;ae.pan={dx:(ae.pan?.dx??0)+x.clientX-v.x,dy:(ae.pan?.dy??0)+x.clientY-v.y},v=Z(x),j()}function k(x){x.pointerId===f&&(b.end(),setTimeout(()=>{m.current===b&&(m.current=null)},0))}m.current=b,window.addEventListener("pointermove",w,!0),window.addEventListener("pointerup",k,!0),window.addEventListener("pointercancel",k,!0)}function xn(o){m.current?.moved&&(m.current=null,o.stopPropagation())}let kn={cursor:t.isPanning||t.draggingNode?"grabbing":A?"move":"grab",touchAction:t.hostPlacesX?"auto":"none",overscrollBehavior:"contain"},Pn=t.host!==void 0&&!t.hostPlacesX&&!t.followsHostView?{[ve]:"",onMouseDown:o=>{o.stopPropagation()}}:{};return{canvasStyle:kn,surfaceProps:Pn,handlers:{onMouseDown:fn,onPointerDown:hn,onPointerMove:yn,onPointerUp:oe,onPointerCancel:oe,onLostPointerCapture:oe,onPointerLeave:vn,onClick:wn,onContextMenu:bn},contextMenu:I,hoveredChip:$,labelHandlers:{onPointerDown:Sn,onClickCapture:xn},closeContextMenu:()=>{H(void 0)}}}var yr={position:"relative"},vr={position:"relative",lineHeight:0,isolation:"isolate"},br={position:"absolute",left:0,right:0,bottom:0,zIndex:0},wr={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},Sr={position:"absolute",left:6,transform:"translateY(-50%)",background:"rgba(255,255,255,0.82)",padding:"0 4px",borderRadius:3,fontSize:11,lineHeight:"16px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:4},xr=d(function({model:e}){return n(M,{children:e.visibleRowLabels.map(({label:r,y:i,top:a})=>n("div",{"data-testid":"graph-row-label",style:{...Sr,top:a},children:r},i))})}),kr={position:"absolute",display:"flex",flexDirection:"column",borderRadius:3,overflowX:"hidden",overflowY:"auto",zIndex:4},Pr={position:"absolute",transform:"translate(-50%, -50%)",background:"rgba(255,255,255,0.78)",padding:"0 3px",borderRadius:3,fontSize:10,lineHeight:"13px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:3},Mr=d(function({model:e}){let r=C(null),i=e.legendAtRest,a=e.keyShape;return G(()=>{e.setKeyShapeOf(()=>JSON.stringify(Rt(e)))},[e]),G(()=>{let c=r.current;if(!c||!i)return;let l=new ResizeObserver(()=>{p()}),p=()=>{c.firstElementChild&&l.observe(c.firstElementChild),E(e)&&e.legendAtRest&&e.setLegendSize({width:c.offsetWidth,height:c.scrollHeight},a)};return l.observe(c),p(),()=>{l.disconnect()}},[e,i,a]),n("div",{ref:r,style:{...kr,top:Q+e.referenceStripZonePx,right:Q,maxHeight:e.canvasHeight-2*Q-e.referenceStripZonePx},children:n(Nt,{model:e,sections:Ct(e)})})}),Rr=d(function({model:e}){return n(M,{children:e.overlayLabels.sizes.map(({key:r,text:i,x:a,y:c})=>n("div",{"data-testid":"graph-size-label",style:{...Pr,left:a,top:c},children:i},r))})}),dn=d(function({model:e,handle:{canvasRef:r,canvas:i},ownChrome:a}){let{handlers:c,canvasStyle:l,surfaceProps:p,labelHandlers:s,contextMenu:u,closeContextMenu:m,hoveredChip:g}=un(e),[S,I]=L(null);pn(S,i,e);let H=e.facetPanels!==void 0;return h("div",{style:yr,...p,children:[a?n(qt,{model:e}):null,h("div",{ref:I,style:vr,...s,onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{E(e)&&e.setPointerInPane(!1)},children:[e.referenceStripShown?n("div",{style:{...br,top:e.referenceStripZonePx,background:J}}):null,n("canvas",{ref:r,"data-testid":"graph-genome-canvas",style:{...l,width:e.paneWidth,height:e.canvasHeight,clipPath:e.drawingClip,display:"block",position:"relative",zIndex:1},...c}),H?n(Ot,{model:e,handlers:c,canvasStyle:l}):h(M,{children:[n(Et,{model:e}),n(zt,{model:e}),n(Lt,{model:e}),n(gt,{model:e}),n(xr,{model:e}),n(Rr,{model:e}),n(mt,{model:e}),n(vt,{model:e}),n(wt,{model:e}),n(It,{model:e}),n(on,{model:e}),n(Mr,{model:e})]}),a?n("div",{style:wr,children:n(Ce,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null,n(Jt,{model:e,chip:g})]}),n(nn,{model:e}),e.walkStripShown?n(rn,{model:e}):null,n(re,{model:e,at:u,onClose:m}),a?.renderError?n(ie,{error:a.renderError,onReset:a.retryRender}):null,a&&e.error?n(ie,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),Cr=d(function({model:e}){let{canvasRef:r,canvas:i,error:a,retry:c}=_t(At,e);return n(dn,{model:e,handle:{canvasRef:r,canvas:i},ownChrome:{renderError:a,retryRender:c}})}),Lr=d(function({model:e,handle:r}){return r?n(dn,{model:e,handle:r}):n(Cr,{model:e})}),Ns=Lr;export{At as a,Ns as b};
2
- //# sourceMappingURL=chunk-EVYIBH4N.js.map
1
+ import{a as W,b as ut}from"./chunk-OIGMGVI6.js";import{A as It,B as Gt,C as te,D as Tt,F as fe,G as Ht,a as dt,b as ft,c as ht,d as mt,f as gt,g as yt,h as B,i as vt,j as bt,k as wt,m as St,n as xt,o as de,p as kt,q as Pt,r as Mt,s as Rt,t as Ct,v as ee,x as Lt,z as Et}from"./chunk-JJ2TPWSH.js";import{$ as ct,E as qe,F as et,H as tt,I as nt,J as rt,K as ot,L as at,M as it,_ as lt,a as P,c as Xe,ca as ue,ea as pt,f as Ze,g as $e,p as Y,q as je,r as Ke,s as Ue}from"./chunk-4MTS65XF.js";import{q as O}from"./chunk-OP2PTYDR.js";import{Ba as pe,Gb as Q,Ha as J,J as ce,La as Fe,Na as Ve,Ob as Je,Pb as Qe,S as We,Ya as Ye,Yb as _,Z as Be,a as F,b as ke,bd as st,d as Pe,ea as De}from"./chunk-TP6OXTXD.js";import{x as Oe}from"./chunk-JWIFJIPZ.js";import{M as se,Q as le}from"./chunk-4RZCYOCW.js";import{c as Se}from"./chunk-LRBNBP2K.js";import{w as we}from"./chunk-RQSCKHNS.js";import{d as E}from"./chunk-WKD7ALOU.js";import{C as xe}from"./chunk-CTQBRAQH.js";import{j as K}from"./chunk-5L276I7O.js";import{a as _e,e as G,f as ze,g as Ne,h as C,i as L}from"./chunk-J2PN6CG3.js";import{A as He,E as Ae,H as q,I as V,b as Me,c as Re,e as ie,k as Ce,o as Le,p as Ee,t as Ie,w as U,x as Ge,z as Te}from"./chunk-H42TSPVA.js";import{a as M,b as n,c as h,d}from"./chunk-DUU6T2I5.js";function At(t){return Promise.resolve(new _(t))}var z=JBrowseExports["@jbrowse/render-core/useRenderingBackend"],Mn=t=>z!=null&&t in Object(z)?z[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/render-core/useRenderingBackend' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t});var _t=Mn("useRenderingBackend"),Tr=z&&z.__esModule?z.default:z;var he=ft(1),zt=d(function({model:e}){let[r,i]=L(null);return G(()=>{if(!r)return;let a=new _(r),c=F(()=>{Ye(st()),a.resize(e.paneWidth,e.canvasHeight),e.paintHover(a,e.drawnBatch)});return()=>{c(),a.dispose()}},[r,e]),n("canvas",{ref:i,"data-testid":"graph-hover-layer",style:{...he,clipPath:e.drawingClip}})});var ne=d(function({row:e,at:r,hint:i,after:a,column:c}){let l=c===void 0?void 0:{paddingLeft:c+5};return e.swatch?h("div",{title:[e.title,i].filter(Boolean).join(" \xB7 ")||void 0,children:[h("div",{style:te,children:[n("span",{style:{display:"flex",flex:"none",justifyContent:"center",width:c},children:n(ee,{swatch:e.swatch})}),h("span",{children:[e.strong?n("strong",{children:e.strong}):null,e.label]}),e.sizer===void 0?null:h("span",{style:Rn,children:[n("span",{style:Cn,"aria-hidden":!0,"data-testid":"graph-key-sizer",children:de(e.sizer)}),n("span",{style:Ln,"data-testid":"graph-key-count",children:de(e.count)})]}),a]}),r?n("div",{style:l,"data-testid":"graph-walk-at",children:r}):e.under?n("div",{style:l,children:e.under}):null]}):n("div",{style:Tt,children:e.label})}),Rn={display:"grid"},Cn={gridArea:"1 / 1",visibility:"hidden"},Ln={gridArea:"1 / 1",width:0,minWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"},En={pointerEvents:"auto",cursor:"pointer",border:"none",background:"none",padding:"0 2px",font:"inherit",textDecoration:"underline"},Nt=d(function({model:e,sections:r}){if(r.length===0)return null;let i=r.flatMap(l=>l.rows),a=xt(i),c=St(i);return n("div",{style:{...Gt,lineHeight:`${a}px`},children:r.map(({testid:l,rows:p,heading:s,spaced:u},m)=>h(_e,{children:[s?n("div",{style:{...Ht,paddingTop:m===0?0:fe},children:s}):null,n("div",{"data-testid":l,style:u?{paddingTop:fe}:void 0,children:p.map(g=>n(ne,{row:g,column:c,at:g.walk?e.hoveredOn(g.walk):void 0,after:g.closesBubble?n("button",{type:"button",style:En,"data-testid":"graph-close-bubble",onClick:()=>{e.closeBubbles()},children:"close"}):null},g.key))})]},l))})});var In={position:"absolute",left:0,top:0,zIndex:4,display:"grid",gap:Je,lineHeight:"normal"},Gn={height:Qe,padding:"2px 6px",boxSizing:"border-box",fontFamily:"inherit",fontSize:11,color:"inherit",cursor:"pointer",border:"none",background:"none",textAlign:"left",display:"block"},Tn={position:"relative"},Hn={gridColumn:"1 / -1",height:ct,padding:"2px 6px",boxSizing:"border-box",display:"flex",gap:14,fontSize:11,lineHeight:"15px"},An=d(function({model:e,lift:r,index:i,width:a,height:c,cell:l,handlers:p,canvasStyle:s}){let[u,m]=L(null),[g,S]=L(null),I=r.walks[0];G(()=>{if(!u||!g)return;let A=new _(u),N=new _(g),$=ke(()=>e.facetDrawings?.[i]),D,X=[F(()=>{let R=e.facetGrid;R&&A.resize(R.width,R.height);let T=$.get();T&&(T!==D&&(A.uploadGeometry(T.batch),D=T),e.applySelection(A),e.paint(A))}),F(()=>{let R=e.facetGrid;R&&N.resize(R.width,R.height);let T=$.get();T&&e.paintHover(N,T.batch)})];return()=>{for(let R of X)R();A.dispose(),N.dispose()}},[u,g,e,i]);let H=e.walkLabel(I.name);return h("div",{style:l,children:[n("button",{type:"button",style:Gn,"data-testid":"graph-facet-title",onClick:()=>{e.liftWalks([I.name]),e.setFacet("")},children:n(ne,{row:Pt(e,I),hint:`click to lift ${H} alone`,at:e.hoveredOn(I)})}),h("div",{style:Tn,children:[n("canvas",{ref:m,"data-testid":"graph-facet-canvas",style:{...s,width:a,height:c,display:"block"},...p}),n("canvas",{ref:S,style:he})]})]})}),_n=d(function({model:e,handlers:r,canvasStyle:i}){let a=e.facetPanels,c=e.facetGrid,l=e.facetPlacement;if(!a||!c||!l)return null;let{columns:p,width:s,height:u}=c;return h("div",{"data-testid":"graph-facet-panels",style:{...In,width:e.paneWidth,minHeight:e.canvasHeight,gridTemplateColumns:`repeat(${p}, ${s}px)`,background:J},children:[a.map((m,g)=>n(An,{model:e,lift:m,index:g,width:s,height:u,cell:{gridRow:Math.floor(l.cells[g]/p)+1,gridColumn:l.cells[g]%p+1},handlers:r,canvasStyle:i},m.walks[0].name)),n("div",{style:{...Hn,gridRow:Math.floor(l.cells.reduce((m,g)=>Math.max(m,g),-1/0)/p)+2},"data-testid":"graph-facet-key",children:Mt(e).map(m=>n(ne,{row:m},m.key))})]})}),Ot=_n;var Wt=P(n("path",{d:"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2m2 10H3v4c0 1.1.9 2 2 2h4v-2H5zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2"}),"CropFree");var Bt=P([n("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"},"0"),n("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var Dt=P(n("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14M7 9h5v1H7z"}),"ZoomOut");var zn=d(function({model:e}){let r=e.colorSchemeLock;return n(W,{label:"Color",size:"small",sx:{minWidth:100},disabled:r!==void 0,title:r?.why,shown:r?.value,value:e.chosenColorScheme,options:qe.map(({value:i})=>({value:i,label:e.colorSchemeLabel(i)})),testId:"graph-color-select",onChange:i=>{e.setColorScheme(i)}})}),Xt=zn;var Ft=O()(t=>({stats:{marginLeft:"auto"},perf:{color:t.palette.text.secondary,fontVariantNumeric:"tabular-nums"}}));function me(t){return t===void 0?"\u2013":`${Math.round(t)}ms`}var Nn=d(function({model:e}){let{classes:r}=Ft(),{lastFetchMs:i,lastLayoutMs:a,lastGeometryMs:c}=e,l=i!==void 0||a!==void 0||c!==void 0;return e.showPerf&&l?h(V,{variant:"caption",className:r.perf,"data-testid":"graph-perf-stats",children:["fetch ",me(i)," \xB7 layout ",me(a)," \xB7 geom"," ",me(c)]}):null}),On=d(function({model:e}){let{classes:r}=Ft();return h("div",{className:r.stats,"data-testid":"graph-stats","data-node-count":e.nodeCount,"data-edge-count":e.edgeCount,"data-path-count":e.pathCount,"data-fetch-ms":e.lastFetchMs??"","data-layout-ms":e.lastLayoutMs??"","data-geometry-ms":e.lastGeometryMs??"","data-geometry-strokes":e.lastGeometryStrokeCount??"",children:[h(V,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",n(Nn,{model:e})]})}),Vt=On;var Wn=d(function({model:e}){let{graph:r}=e;return n(W,{label:"Layout",size:"small",sx:{minWidth:140},testId:"graph-layout-select",value:e.chosenLayoutMode,options:Xe.map(({value:i,label:a,description:c,available:l})=>({value:i,label:a,description:c,disabled:r?!l(r):!1})),onChange:i=>{e.switchLayout(i)}})}),Yt=Wn;var Bn=d(function({model:e}){return e.chosenLayoutMode!=="walkrows"||e.repeatChoices.length===0?null:n(W,{label:"Repeat",size:"small",sx:{minWidth:130,maxWidth:260},testId:"graph-repeat-select",value:e.selectedRepeat?.key??"",options:e.repeatOptions,onChange:r=>{e.setRepeatKey(r)}})}),Zt=Bn;var $t=P(n("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close");var jt=P(n("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreVert");var Dn=d(function({model:e}){let r=e.highlightMenuItems({picks:!1});return n(Me,{size:"small",tooltip:"Graph options",menuItems:[...r.length>0?[{label:"Haplotypes",icon:Ze,subMenu:r}]:[],...e.layoutOptionMenuItems({repeat:!1}),{label:"Show",icon:et,subMenu:[...e.showMenuItems(),...e.modeDrawsNodes&&e.walkChoices.length>1?[{type:"checkbox",label:"Show walk rows under the graph",checked:e.walkStrip,onClick:()=>{e.setWalkStrip(!e.walkStrip)}}]:[],{type:"checkbox",label:"Show timings",checked:e.showPerf,onClick:()=>{e.setShowPerf(!e.showPerf)}}]},{type:"divider"},{label:"Graph settings...",icon:$e,helpText:"Subgraph node limit; node width and path colors; the force-directed layout engine",onClick:()=>{K(e).queueDialog(i=>[ut,{model:e,onClose:i}])}},{type:"divider"},{label:"Close graph",icon:$t,onClick:()=>{e.clearGraph()}}],children:n(jt,{})})}),Kt=Dn;var Xn=O()({formControl:{minWidth:130,maxWidth:260}}),Fn=d(function({model:e}){let{classes:r}=Xn(),i=ze(),{walkChoices:a}=e;if(a.length===0||!e.liftsWalks)return null;let c=new Set(a.map(s=>s.name)),l=new Map(a.map(s=>[s.name,s.label])),p=e.walkLayers.map(s=>s.walk).filter(s=>c.has(s));return a.length>Ve?n(Le,{size:"small",variant:"outlined",color:"inherit","data-testid":"graph-walk-choose",onClick:()=>{K(e).queueDialog(s=>[Fe,{model:e,onClose:s}])},children:p.length>0?`${p.length} of ${a.length} haplotypes`:"Highlight haplotypes..."}):h(Ie,{size:"small",className:r.formControl,children:[n(Ge,{id:i,children:"Highlight"}),n(Ae,{labelId:i,multiple:!0,value:p,label:"Highlight","data-testid":"graph-walk-select",renderValue:s=>s.map(u=>l.get(u)).join(", "),onChange:s=>{let{value:u}=s.target;e.liftAmongChoices(typeof u=="string"?u.split(","):u)},children:a.map(({name:s,label:u})=>h(He,{value:s,dense:!0,children:[n(Ee,{size:"small",checked:p.includes(s)}),n(Te,{primary:u})]},s))})]})}),Ut=Fn;var Vn=O()(t=>({toolbar:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:`1px solid ${t.palette.divider}`}})),Yn=d(function({model:e}){return n(V,{variant:"body2",children:e.zoomPercent})}),Zn=d(function({model:e}){let{classes:r}=Vn(),i=a=>{e.zoom(a,e.viewBox.width/2,e.viewBox.height/2)};return h("div",{className:r.toolbar,children:[n(Yt,{model:e}),n(Xt,{model:e}),n(Ut,{model:e}),n(Zt,{model:e}),n(q,{title:"Zoom in",children:n(U,{size:"small",onClick:()=>{i(1.5)},children:n(Bt,{})})}),n(q,{title:"Zoom out",children:n(U,{size:"small",onClick:()=>{i(1/1.5)},children:n(Dt,{})})}),n(q,{title:"Zoom to fit",children:n(U,{size:"small",onClick:()=>{e.refitView()},children:n(Wt,{})})}),n(Yn,{model:e}),n(Vt,{model:e}),n(Kt,{model:e})]})}),qt=Zn;var $n={position:"absolute",bottom:lt,lineHeight:"normal",background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",zIndex:6};function ge({label:t,readout:e}){return h(M,{children:[n("strong",{children:t})," \u2014 ",e]})}function jn(t,e){if(e)return{testId:"graph-chip-tooltip",body:ge(e)};let r=t.hoveredNode?t.hoverNodeById?.get(t.hoveredNode):void 0;if(r){let l=Ke(r),p=t.hoverDrawing?.members.get(r.id),s=Ue(r),u=t.graphRegion,m=t.hoveredSpan,g=u&&m&&!we(r)?`${u.assemblyName} ${Y({refName:u.refName,...m})}`:void 0,S=ce(t.genePins,r.id),I=S.length>0?h(M,{children:[n("br",{}),n("em",{children:S.join(", ")})]}):null;return l?{body:h(M,{children:[l,I]})}:{body:h(M,{children:[n("strong",{children:r.name}),p?` and ${p.length-1} more`:""," \u2014"," ",r.length.toLocaleString()," bp, depth ",r.depth.toFixed(1),s?h(M,{children:[n("br",{}),s.sample," ",Y(s)," (rank ",r.stable?.rank,")"]}):null,g?h(M,{children:[n("br",{}),"Reference ",g]}):null,I,r.moved?h(M,{children:[n("br",{}),"End of a component too large to draw here"]}):null]})}}let i=t.hoveredEdge===null?void 0:t.graph?.edges[t.hoveredEdge];if(i){let l=je(i,t.deletions.find(s=>s.edgeIndex===t.hoveredEdge),s=>t.nodeById?.get(s)?.name??s),p=t.graph?Se(t.graph):void 0;return{body:l.deletion?h(M,{children:[`skips ${l.deletion.bp} of ${p??"the reference"} sequence`,n("br",{}),l.deletion.where]}):h(M,{children:["Edge: ",l.ends]})}}let a=t.hoveredWalkRowText;if(a)return{testId:"graph-walk-row-tooltip",body:ge(a)};let c=t.hoveredTubeText;return c?{testId:"graph-tube-tooltip",body:ge(c)}:void 0}var Kn=d(function({model:e,chip:r}){let i=jn(e,r);return i?n("div",{style:{...$n,right:e.tooltipRightPx},"data-testid":i.testId,children:i.body}):null}),Jt=Kn;var Qt=P(n("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}),"FilterList");var en=P(n("path",{d:"M10.83 8H21V6H8.83zm5 5H18v-2h-4.17zM14 16.83V18h-4v-2h3.17l-3-3H6v-2h2.17l-3-3H3V6h.17L1.39 4.22 2.8 2.81l18.38 18.38-1.41 1.41z"}),"FilterListOff");var tn=P(n("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info");var Un={x:0,y:0};function qn(t,e){let{own:r,reference:i,highlight:a}=t.nodeLaunchTargets(e);return[{label:"Node details",icon:tn,onClick:()=>{t.showNodeDetails(e)}},...pt({own:r,reference:i,highlight:a,onShowLinear:c=>{t.showInLinearView(c)},onHighlight:t.canHighlightInLinearView?c=>{t.highlightInLinearView(c)}:void 0})]}function Jn(t,e,r){let i=r??t.walkRowBars,a=t.walkRowLaunchTarget(e,i),c=a?.assembly,l=e>0?i?.rows[e-1]:void 0,p=l?.sample,s=t.abridged.find(g=>g.name===l?.name),u=!r&&t.walkRowBars,m=t.walkRowSamples;return[a&&c?{label:`Linear genome view \u2014 ${c} ${Y(a.location)}`,icon:ue,onClick:()=>{t.showInLinearView({location:a.location,assembly:c})}}:{label:"Linear genome view",icon:ue,disabled:!0,disabledHelpText:a?`No assembly in this session is ${a.location.haplotype??a.label}`:"This walk states no contig coordinates",onClick:()=>{}},...r&&l&&s?[{label:"Load its steps",subLabel:xe(s,l.label),onClick:()=>{t.expandWalk(l.name)}}]:[],...l&&t.liftsWalks&&t.modeDrawsNodes?[{type:"checkbox",label:`Highlight ${l.label}`,checked:t.walkLayers.some(g=>g.walk===l.name),onClick:()=>{t.toggleWalk(l.name)}}]:[],...u&&p&&!(m?.length===1&&m[0]===p)?[{label:`Show only ${p}`,icon:Qt,onClick:()=>{t.setWalkRowSamples([p])}}]:[],...u&&m?[{label:"Show every sample",icon:en,onClick:()=>{t.setWalkRowSamples(void 0)}}]:[]]}var re=d(function({model:e,at:r,onClose:i}){return n(Re,{anchor:r,offset:Un,onClose:i,menuItems:()=>r===void 0?[]:"nodeId"in r?qn(e,r.nodeId):Jn(e,r.row,r.bars)})});var Qn=d(function({model:e}){return n(M,{children:e.passBars.map(r=>n("svg",{"data-testid":"graph-pass-bar",width:e.paneWidth,height:at,style:{display:"block",borderTop:"1px solid #ddd"},children:n(B,{el:it(r,e.walkLabel(r.walk),e.paneWidth)})},r.walk))})}),nn=Qn;var er={display:"flex",flexWrap:"wrap",gap:"2px 14px",padding:"2px 8px 6px",fontSize:11,color:"#333"},tr={position:"absolute",pointerEvents:"none",background:"rgba(255,255,255,0.92)",border:"1px solid #ccc",borderRadius:3,padding:"1px 6px",fontSize:11,whiteSpace:"nowrap",zIndex:4},nr=d(function({bars:e,frame:r,ramp:i,rowGenes:a,inks:c}){let l=yt(),p=Ne(()=>De(e,r,{ramp:i,rowGenes:a,idPrefix:l,markUnloaded:!0,inks:c}),[e,r,i,a,l,c]);return n(B,{el:p})}),rr=d(function({model:e}){let r=e.walkStripRows,i=e.walkStripFrame,a=e.stripHover,c=r?[r.reference,...r.rows]:[],l=a?c.findIndex(g=>g.name===a.row):-1,p=c[l],s=r&&i&&p?We(r,l,i):void 0;if(!r||!i||!a||!p||!s||i.labelled&&!s.cut)return null;let u=(r.origin+a.offset)*i.scaleX+i.translateX,m=u>i.width/2?{right:i.width-u+12}:{left:u+12};return h("div",{"data-testid":"graph-walk-strip-tip",style:{...tr,...m,top:l*i.rowPx+i.translateY-18},children:[p.label," \xB7 ",s.text]})}),or=d(function({model:e,bars:r,frame:i}){return n(B,{el:nt(r,i,e.walkStripMarks)})}),ar=d(function({model:e}){let r=e.walkStripRows,i=e.walkStripFrame,[a,c]=L();if(!r||!i)return null;let l=s=>{let u=s.currentTarget.getBoundingClientRect();return tt(r,i,s.clientX-u.left,s.clientY-u.top)},p=Be(r,{ramp:e.referenceRampDomain,rampCss:Oe,genes:ot(i,e.walkRowGenes,e.walkRowGeneGaps),annotation:e.walkRowAnnotation,markUnloaded:!0,inks:e.walkStripInks});return h("div",{"data-testid":"graph-walk-strip",style:{position:"relative",borderTop:"1px solid #ddd"},onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{E(e)&&(e.setPointerInPane(!1),e.setStripHover(null))},children:[h("svg",{width:i.width,height:i.height,style:{display:"block"},onMouseLeave:()=>{E(e)&&e.setStripHover(null)},onMouseMove:s=>{let u=l(s);s.currentTarget.style.cursor=u&&u.index>0?"pointer":"",e.setStripHover(u?{row:u.row.name,offset:u.offset}:null)},onClick:s=>{let u=l(s);u&&u.index>0&&e.toggleWalk(u.row.name)},onContextMenu:s=>{let u=l(s);u&&(s.preventDefault(),c({clientX:s.clientX,clientY:s.clientY,row:u.index}))},children:[n(nr,{bars:r,frame:i,ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes,inks:e.walkStripInks}),n(or,{model:e,bars:r,frame:i}),n(B,{el:rt(r,i,new Set(e.walkLayers.map(s=>s.walk)))})]}),n(rr,{model:e}),h("div",{style:er,"data-testid":"graph-walk-strip-key",children:[p.map(s=>h("div",{style:te,children:[n(ee,{swatch:kt(s.swatch)}),n("span",{children:s.label})]},s.label)),n("span",{style:{color:"#777"},children:"Ticks mark where each walk passes the node under the pointer; click a haplotype's bar to lift its walk"})]}),n(re,{model:e,at:a&&{...a,bars:r},onClose:()=>{c(void 0)}})]})}),rn=ar;var ir=d(function({model:e}){let r=e.walkStripLocator;return r?h(ht,{model:e,zIndex:4,overflow:"visible",testId:"graph-walk-strip-locator",children:[n("circle",{cx:r.x,cy:r.y,r:11,fill:"none",stroke:"white",strokeWidth:4}),n("circle",{cx:r.x,cy:r.y,r:11,fill:"none",stroke:"#111",strokeWidth:1.75})]}):null}),on=ir;var sr=1.1,lr=100,cr=40,pr=800,ur=10,an=2;function ye(t){let e=t.deltaY*(t.deltaMode===1?cr:t.deltaMode===2?pr:1),r=(t.ctrlKey?ur:1)*e/lr;return sr**-Math.max(-an,Math.min(an,r))}var dr=40,fr=100,hr=24,sn=Math.log(16);function mr(t,e){let r=t*Math.exp(-Math.max(0,e)/hr);return Math.abs(r)<.001?t:t-r}function gr(t,e){let r=Math.abs(t.deltaX)>Math.abs(t.deltaY);return t.ctrlKey||t.metaKey||!r&&(!e||e.scrollZoom)?"zoom":r?"pan":"page"}function pn(t,e,r){G(()=>{if(!t)return;let i=-1/0,a={backlog:0,x:0,y:0,frame:0,last:0},c=p=>{let s=mr(a.backlog,Math.min(100,p-a.last));a.backlog-=s,a.last=p,a.frame=a.backlog?requestAnimationFrame(c):0,E(r)&&r.zoom(Math.exp(s),a.x,a.y)},l=p=>{if(r.hostPlacesX||r.followsHostView)return;let m=((p.target instanceof Element?p.target.closest("canvas"):null)??(r.facetPanels?null:e))?.getBoundingClientRect();if(m&&p.clientY-m.top<r.referenceStripZonePx)return;let g=gr(p,r.host);if(g!=="page"){if(r.host&&p.stopPropagation(),p.preventDefault(),g==="pan"){if(p.timeStamp-i>fr){let S=p.deltaMode===1?dr:1;r.setTransform(r.scale,r.translateX-p.deltaX*S,r.translateY)}return}i=p.timeStamp,m&&(a.x=p.clientX-m.left,a.y=p.clientY-m.top,a.backlog=Math.max(-sn,Math.min(sn,a.backlog+Math.log(ye(p)))),a.frame||(a.last=performance.now()-1e3/60,a.frame=requestAnimationFrame(c)))}};return t.addEventListener("wheel",l,{passive:!1}),()=>{cancelAnimationFrame(a.frame),t.removeEventListener("wheel",l)}},[t,e,r])}var ln=3,ve="data-gesture-owner",Z=t=>({x:t.clientX,y:t.clientY});function cn(t){let[e,r]=[...t.values()];return{spread:Math.hypot(e.x-r.x,e.y-r.y),mid:{x:(e.x+r.x)/2,y:(e.y+r.y)/2}}}function un(t){let e=C({x:0,y:0}),r=C({x:0,y:0}),i=C(!1),a=C(void 0),c=o=>a.current!==void 0&&o.pointerId!==a.current,l=C(new Map),p=C(null),s=C(null),u=C(!1),m=C(null),g=C(!1),S=C({frame:0,pan:null,hover:null,pinch:!1});G(()=>()=>{cancelAnimationFrame(S.current.frame)},[]);let[I,H]=L(),[A,N]=L(!1),[$,D]=L(void 0);function X(o){let f=o.currentTarget.getBoundingClientRect();return{x:o.clientX-f.left,y:o.clientY-f.top}}function R(o,f){if(t.layoutResult?.tubeMap)return t.tubeMapNodeAt(o,f);let y=t.referenceStripNodeAt(o,f);if(y)return y;let{nodePositions:v}=t;if(!v)return null;let{x:b,y:w}=pe(o,f,t,t.axisScale);return se(v,b,w,t.axisScale,t.positionsVersion,t.nodeInk,t.drawnFold)}function T(o,f){let{nodePositions:y,graph:v}=t;if(!y||!v)return null;let{x:b,y:w}=pe(o,f,t,t.axisScale);return le(y,v,b,w,t.axisScale,t.effectiveDrawPaths&&!t.facetPanels,t.positionsVersion,t.deletionEdgeIndexes,t.hiddenEdgeIndexes,t.deletionRoutes,t.layoutResult?.stranded,t.drawnFold)}function fn(o){o.button===0&&o.preventDefault()}function hn(o){if(o.button!==0)return;let f=l.current;if(c(o)){t.isPanning&&!g.current&&o.pointerType==="touch"&&f.size===1&&(o.currentTarget.setPointerCapture(o.pointerId),f.set(o.pointerId,Z(o)),s.current=cn(f),i.current=!0);return}i.current=!1,r.current={x:o.clientX,y:o.clientY},o.currentTarget.removeAttribute(ve);let y=t.followsHostView,{x:v,y:b}=X(o),w=b<t.referenceStripZonePx,k=t.hostPlacesX||t.layoutResult?.tubeMap||w?null:R(v,b);t.hostPlacesX||y&&o.shiftKey||t.followsWindow&&!k||(o.currentTarget.setPointerCapture(o.pointerId),a.current=o.pointerId,p.current=o.currentTarget,f.clear(),f.set(o.pointerId,Z(o)),y&&k&&o.currentTarget.setAttribute(ve,""),g.current=y,u.current=w&&!y,k?t.setDraggingNode(k):t.setPanning(!0),e.current={x:o.clientX,y:o.clientY})}function be(){let o=s.current,f=p.current;if(!o||!f)return;let y=cn(l.current),v=f.getBoundingClientRect();o.spread>0&&y.spread>0&&t.zoom(y.spread/o.spread,o.mid.x-v.left,o.mid.y-v.top),t.setTransform(t.scale,t.translateX+y.mid.x-o.mid.x,t.translateY+y.mid.y-o.mid.y),s.current=y}function mn(){let o=S.current,{pan:f,hover:y,pinch:v}=o;if(o.frame=0,o.pan=null,o.hover=null,o.pinch=!1,v&&be(),f&&u.current?t.host?.horizontalScroll(-f.dx):f&&g.current?t.setTransform(t.scale,t.translateX,t.translateY+f.dy):f&&t.setTransform(t.scale,t.translateX+f.dx,t.translateY+f.dy),!y)return;let{x:b,y:w}=y,k=t.facetPanels?void 0:bt(t.overlayLabels,b,w);D(x=>x?.label===k?.label&&x?.readout===k?.readout?x:k),Pe(()=>{if(t.walkRowBars){let x=t.walkRowAt(b,w);t.setHoveredWalkRow(x===void 0?null:t.walkRowList[x].name)}if(t.nodePositions&&t.graph){let x=R(b,w);t.setHoveredPanel(t.tubeMapPanelAt(w)),t.setHoveredNode(x,{x:b,y:w}),N(x!==null&&!t.hostPlacesX&&!t.layoutResult?.tubeMap&&w>=t.referenceStripZonePx),t.setHoveredTube(x===null&&t.layoutResult?.tubeMap?t.tubeAt(b,w):null),t.setHoveredEdge(x||t.layoutResult?.tubeMap||!t.hoverLightsEverything?null:T(b,w))}})}function j(){S.current.frame||(S.current.frame=requestAnimationFrame(mn))}function gn(){let o=S.current;cancelAnimationFrame(o.frame),o.frame=0,o.pan=null,o.hover=null,o.pinch=!1}function yn(o){let f=l.current;if(s.current&&f.has(o.pointerId)){f.set(o.pointerId,Z(o)),S.current.pinch=!0,j();return}if(c(o)||m.current)return;let y=o.clientX-e.current.x,v=o.clientY-e.current.y;e.current={x:o.clientX,y:o.clientY},Math.hypot(o.clientX-r.current.x,o.clientY-r.current.y)>ln&&(i.current=!0);let b=S.current;if(t.draggingNode)t.moveNode(t.draggingNode,y/t.scaleX,v/t.scaleY);else if(t.isPanning)b.pan={dx:(b.pan?.dx??0)+y,dy:(b.pan?.dy??0)+v},j();else{let w=o.currentTarget.getBoundingClientRect();b.hover={x:o.clientX-w.left,y:o.clientY-w.top},j()}}function oe(o){let f=l.current;if(s.current&&f.has(o.pointerId)){S.current.pinch&&(S.current.pinch=!1,be()),f.delete(o.pointerId),s.current=null;let[[y,v]]=[...f];a.current=y,e.current=v;return}c(o)||(a.current=void 0,f.clear(),E(t)&&t.stopDragging())}function vn(o){c(o)||(D(void 0),N(!1),m.current?S.current.hover=null:(a.current=void 0,l.current.clear(),s.current=null,gn(),E(t)&&t.stopDragging()),E(t)&&t.clearHover())}function bn(o){let{x:f,y}=X(o),v=R(f,y),{clientX:b,clientY:w}=o;if(v){o.preventDefault(),H({clientX:b,clientY:w,nodeId:v});return}let k=t.walkRowAt(f,y);k!==void 0&&(o.preventDefault(),H({clientX:b,clientY:w,row:k}))}function wn(o){if(!i.current){let{x:f,y}=X(o),v=R(f,y);t.setSelectedNode(v),v&&t.showNodeDetails(v)}}G(()=>()=>{m.current?.end()},[]);function Sn(o){if(o.button!==0||t.hostPlacesX||t.followsHostView||!(o.target instanceof Element)||!o.target.closest(`[${dt}]`))return;m.current?.end(),u.current=!1,g.current=!1;let f=o.pointerId,y=Z(o),v=y,b={moved:!1,end:()=>{window.removeEventListener("pointermove",w,!0),window.removeEventListener("pointerup",k,!0),window.removeEventListener("pointercancel",k,!0),b.moved&&E(t)&&t.stopDragging()}};function w(x){if(x.pointerId!==f)return;if(!b.moved){if(Math.hypot(x.clientX-y.x,x.clientY-y.y)<=ln)return;b.moved=!0,t.setPanning(!0)}let ae=S.current;ae.pan={dx:(ae.pan?.dx??0)+x.clientX-v.x,dy:(ae.pan?.dy??0)+x.clientY-v.y},v=Z(x),j()}function k(x){x.pointerId===f&&(b.end(),setTimeout(()=>{m.current===b&&(m.current=null)},0))}m.current=b,window.addEventListener("pointermove",w,!0),window.addEventListener("pointerup",k,!0),window.addEventListener("pointercancel",k,!0)}function xn(o){m.current?.moved&&(m.current=null,o.stopPropagation())}let kn={cursor:t.isPanning||t.draggingNode?"grabbing":A?"move":"grab",touchAction:t.hostPlacesX?"auto":"none",overscrollBehavior:"contain"},Pn=t.host!==void 0&&!t.hostPlacesX&&!t.followsHostView?{[ve]:"",onMouseDown:o=>{o.stopPropagation()}}:{};return{canvasStyle:kn,surfaceProps:Pn,handlers:{onMouseDown:fn,onPointerDown:hn,onPointerMove:yn,onPointerUp:oe,onPointerCancel:oe,onLostPointerCapture:oe,onPointerLeave:vn,onClick:wn,onContextMenu:bn},contextMenu:I,hoveredChip:$,labelHandlers:{onPointerDown:Sn,onClickCapture:xn},closeContextMenu:()=>{H(void 0)}}}var yr={position:"relative"},vr={position:"relative",lineHeight:0,isolation:"isolate"},br={position:"absolute",left:0,right:0,bottom:0,zIndex:0},wr={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},Sr={position:"absolute",left:6,transform:"translateY(-50%)",background:"rgba(255,255,255,0.82)",padding:"0 4px",borderRadius:3,fontSize:11,lineHeight:"16px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:4},xr=d(function({model:e}){return n(M,{children:e.visibleRowLabels.map(({label:r,y:i,top:a})=>n("div",{"data-testid":"graph-row-label",style:{...Sr,top:a},children:r},i))})}),kr={position:"absolute",display:"flex",flexDirection:"column",borderRadius:3,overflowX:"hidden",overflowY:"auto",zIndex:4},Pr={position:"absolute",transform:"translate(-50%, -50%)",background:"rgba(255,255,255,0.78)",padding:"0 3px",borderRadius:3,fontSize:10,lineHeight:"13px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:3},Mr=d(function({model:e}){let r=C(null),i=e.legendAtRest,a=e.keyShape;return G(()=>{e.setKeyShapeOf(()=>JSON.stringify(Rt(e)))},[e]),G(()=>{let c=r.current;if(!c||!i)return;let l=new ResizeObserver(()=>{p()}),p=()=>{c.firstElementChild&&l.observe(c.firstElementChild),E(e)&&e.legendAtRest&&e.setLegendSize({width:c.offsetWidth,height:c.scrollHeight},a)};return l.observe(c),p(),()=>{l.disconnect()}},[e,i,a]),n("div",{ref:r,style:{...kr,top:Q+e.referenceStripZonePx,right:Q,maxHeight:e.canvasHeight-2*Q-e.referenceStripZonePx},children:n(Nt,{model:e,sections:Ct(e)})})}),Rr=d(function({model:e}){return n(M,{children:e.overlayLabels.sizes.map(({key:r,text:i,x:a,y:c})=>n("div",{"data-testid":"graph-size-label",style:{...Pr,left:a,top:c},children:i},r))})}),dn=d(function({model:e,handle:{canvasRef:r,canvas:i},ownChrome:a}){let{handlers:c,canvasStyle:l,surfaceProps:p,labelHandlers:s,contextMenu:u,closeContextMenu:m,hoveredChip:g}=un(e),[S,I]=L(null);pn(S,i,e);let H=e.facetPanels!==void 0;return h("div",{style:yr,...p,children:[a?n(qt,{model:e}):null,h("div",{ref:I,style:vr,...s,onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{E(e)&&e.setPointerInPane(!1)},children:[e.referenceStripShown?n("div",{style:{...br,top:e.referenceStripZonePx,background:J}}):null,n("canvas",{ref:r,"data-testid":"graph-genome-canvas",style:{...l,width:e.paneWidth,height:e.canvasHeight,clipPath:e.drawingClip,display:"block",position:"relative",zIndex:1},...c}),H?n(Ot,{model:e,handlers:c,canvasStyle:l}):h(M,{children:[n(Et,{model:e}),n(zt,{model:e}),n(Lt,{model:e}),n(gt,{model:e}),n(xr,{model:e}),n(Rr,{model:e}),n(mt,{model:e}),n(vt,{model:e}),n(wt,{model:e}),n(It,{model:e}),n(on,{model:e}),n(Mr,{model:e})]}),a?n("div",{style:wr,children:n(Ce,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null,n(Jt,{model:e,chip:g})]}),n(nn,{model:e}),e.walkStripShown?n(rn,{model:e}):null,n(re,{model:e,at:u,onClose:m}),a?.renderError?n(ie,{error:a.renderError,onReset:a.retryRender}):null,a&&e.error?n(ie,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),Cr=d(function({model:e}){let{canvasRef:r,canvas:i,error:a,retry:c}=_t(At,e);return n(dn,{model:e,handle:{canvasRef:r,canvas:i},ownChrome:{renderError:a,retryRender:c}})}),Lr=d(function({model:e,handle:r}){return r?n(dn,{model:e,handle:r}):n(Cr,{model:e})}),Ns=Lr;export{At as a,Ns as b};
2
+ //# sourceMappingURL=chunk-TMF6JHCE.js.map