jbrowse-plugin-graphgenomeviewer 5.0.1 → 5.2.0

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 (59) hide show
  1. package/README.md +3 -4
  2. package/dist/chunks/GbzBaseSyntenyAdapter-TQVDD3OC.js +8 -0
  3. package/dist/chunks/GbzBaseSyntenyAdapter-TQVDD3OC.js.map +7 -0
  4. package/dist/chunks/{GraphGenomeView-YYP4IFSI.js → GraphGenomeView-AY2FO4P2.js} +2 -2
  5. package/dist/chunks/{GraphTrackSettingsDialog-2WPJRAJC.js → GraphTrackSettingsDialog-QJXPMWYG.js} +2 -2
  6. package/dist/chunks/LinearGraphDisplay-GKVG72J4.js +2 -0
  7. package/dist/chunks/LinearGraphDisplay-GKVG72J4.js.map +7 -0
  8. package/dist/chunks/chunk-2V27PV25.js +3 -0
  9. package/dist/chunks/chunk-2V27PV25.js.map +7 -0
  10. package/dist/chunks/chunk-FNHKEAKB.js +5 -0
  11. package/dist/chunks/{chunk-LGFKHSVJ.js.map → chunk-FNHKEAKB.js.map} +3 -3
  12. package/dist/chunks/chunk-K5Z47YVI.js +2 -0
  13. package/dist/chunks/chunk-K5Z47YVI.js.map +7 -0
  14. package/dist/chunks/{chunk-SJNG2XK7.js → chunk-LJZDHT2C.js} +2 -2
  15. package/dist/chunks/chunk-NWJN4C4V.js +2 -0
  16. package/dist/chunks/chunk-NWJN4C4V.js.map +7 -0
  17. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +5 -5
  18. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +4 -4
  19. package/package.json +2 -2
  20. package/src/GbzBaseSyntenyAdapter/GbzBaseSyntenyAdapter.test.ts +20 -38
  21. package/src/GbzBaseSyntenyAdapter/GbzBaseSyntenyAdapter.ts +14 -65
  22. package/src/GraphGenomeView/components/GenePins.tsx +25 -80
  23. package/src/GraphGenomeView/components/usePaneGestures.ts +1 -0
  24. package/src/GraphGenomeView/genes/geneFeatures.ts +46 -7
  25. package/src/GraphGenomeView/genes/genes.test.ts +88 -1
  26. package/src/GraphGenomeView/model.test.ts +1 -1
  27. package/src/GraphGenomeView/pane/fitViews.ts +1 -0
  28. package/src/GraphGenomeView/pane/graphViews.ts +39 -5
  29. package/src/GraphGenomeView/pane/loadActions.ts +5 -5
  30. package/src/GraphGenomeView/pane/paneBase.ts +3 -2
  31. package/src/LinearGraphDisplay/LinearGraphDisplay.test.ts +160 -92
  32. package/src/LinearGraphDisplay/components/LinearGraphDisplay.tsx +2 -12
  33. package/src/LinearGraphDisplay/denseWindow.ts +40 -0
  34. package/src/LinearGraphDisplay/model.ts +34 -94
  35. package/src/index.ts +0 -2
  36. package/src/version.ts +1 -1
  37. package/dist/chunks/GbzBaseSyntenyAdapter-CKKVHC2R.js +0 -4
  38. package/dist/chunks/GbzBaseSyntenyAdapter-CKKVHC2R.js.map +0 -7
  39. package/dist/chunks/LinearGraphDisplay-7YE624D5.js +0 -2
  40. package/dist/chunks/LinearGraphDisplay-7YE624D5.js.map +0 -7
  41. package/dist/chunks/chunk-2H7GDQ3R.js +0 -6
  42. package/dist/chunks/chunk-2H7GDQ3R.js.map +0 -7
  43. package/dist/chunks/chunk-BZOIENU5.js +0 -2
  44. package/dist/chunks/chunk-BZOIENU5.js.map +0 -7
  45. package/dist/chunks/chunk-H54W6OQQ.js +0 -2
  46. package/dist/chunks/chunk-H54W6OQQ.js.map +0 -7
  47. package/dist/chunks/chunk-LGFKHSVJ.js +0 -5
  48. package/dist/chunks/chunk-O4XV3K35.js +0 -2
  49. package/dist/chunks/chunk-O4XV3K35.js.map +0 -7
  50. package/dist/chunks/chunk-WKVVIDCS.js +0 -3
  51. package/dist/chunks/chunk-WKVVIDCS.js.map +0 -7
  52. package/src/GetHaplotypeOverview.ts +0 -77
  53. package/src/HaplotypeOverview/HaplotypeOverviewCanvas.tsx +0 -203
  54. package/src/HaplotypeOverview/draw.test.ts +0 -136
  55. package/src/HaplotypeOverview/draw.ts +0 -433
  56. package/src/HaplotypeOverview/model.ts +0 -163
  57. /package/dist/chunks/{GraphGenomeView-YYP4IFSI.js.map → GraphGenomeView-AY2FO4P2.js.map} +0 -0
  58. /package/dist/chunks/{GraphTrackSettingsDialog-2WPJRAJC.js.map → GraphTrackSettingsDialog-QJXPMWYG.js.map} +0 -0
  59. /package/dist/chunks/{chunk-SJNG2XK7.js.map → chunk-LJZDHT2C.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{a as x}from"./chunk-WKVVIDCS.js";import"./chunk-SJNG2XK7.js";import"./chunk-O4XV3K35.js";import{Z as L}from"./chunk-H54W6OQQ.js";import"./chunk-UQEPPJEO.js";import"./chunk-SCMIJAAX.js";import"./chunk-7BKUWQE5.js";import"./chunk-KULNKXPT.js";import"./chunk-FCWXYIFC.js";import{a as B}from"./chunk-J6KYLXRD.js";import{a as s,b as v,c as g,d as G}from"./chunk-TYJTJGPO.js";import{b as a}from"./chunk-FY3BTKY4.js";var S=a(g(),1);var m=a(v(),1),n=a(G(),1),C=a(g(),1),P=a(L(),1),o=a(s(),1),I=(0,P.makeStyles)()({paper:{padding:16,margin:8,maxWidth:560,marginInline:"auto",display:"flex",flexDirection:"column",gap:12},row:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8}}),b=(0,C.observer)(function({model:e}){let{classes:r}=I();return e.isLoading?(0,o.jsxs)(n.Paper,{className:r.paper,"data-testid":"graph-genome-loading",children:[(0,o.jsxs)("div",{className:r.row,children:[(0,o.jsx)(m.LoadingEllipses,{variant:"h6",message:e.statusMessage}),(0,o.jsx)(n.Button,{size:"small","data-testid":"graph-genome-cancel",onClick:()=>{e.cancelLoad()},children:"Cancel"})]}),(0,o.jsx)(n.LinearProgress,{variant:"indeterminate"})]}):e.error?(0,o.jsx)(n.Paper,{className:r.paper,children:(0,o.jsx)(m.ErrorBanner,{error:e.error,onReset:()=>{e.retryLoad()}})}):(0,o.jsx)(n.Paper,{className:r.paper,"data-testid":"graph-genome-load-canceled",children:(0,o.jsxs)("div",{className:r.row,children:[(0,o.jsx)(n.Typography,{variant:"h6",children:"Loading canceled"}),(0,o.jsx)(n.Button,{variant:"contained",size:"small","data-testid":"graph-genome-retry",onClick:()=>{e.retryLoad()},children:"Retry"})]})})}),h=b;var M=a(B(),1),N=a(v(),1),i=a(G(),1),w=a(g(),1),E=a(L(),1),t=a(s(),1),k=`H VN:Z:1.0
1
+ import{a as x}from"./chunk-2V27PV25.js";import"./chunk-LJZDHT2C.js";import"./chunk-NWJN4C4V.js";import{_ as L}from"./chunk-K5Z47YVI.js";import"./chunk-UQEPPJEO.js";import"./chunk-SCMIJAAX.js";import"./chunk-7BKUWQE5.js";import"./chunk-KULNKXPT.js";import"./chunk-FCWXYIFC.js";import{a as B}from"./chunk-J6KYLXRD.js";import{a as s,b as v,c as g,d as G}from"./chunk-TYJTJGPO.js";import{b as a}from"./chunk-FY3BTKY4.js";var S=a(g(),1);var m=a(v(),1),n=a(G(),1),C=a(g(),1),P=a(L(),1),o=a(s(),1),I=(0,P.makeStyles)()({paper:{padding:16,margin:8,maxWidth:560,marginInline:"auto",display:"flex",flexDirection:"column",gap:12},row:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8}}),b=(0,C.observer)(function({model:e}){let{classes:r}=I();return e.isLoading?(0,o.jsxs)(n.Paper,{className:r.paper,"data-testid":"graph-genome-loading",children:[(0,o.jsxs)("div",{className:r.row,children:[(0,o.jsx)(m.LoadingEllipses,{variant:"h6",message:e.statusMessage}),(0,o.jsx)(n.Button,{size:"small","data-testid":"graph-genome-cancel",onClick:()=>{e.cancelLoad()},children:"Cancel"})]}),(0,o.jsx)(n.LinearProgress,{variant:"indeterminate"})]}):e.error?(0,o.jsx)(n.Paper,{className:r.paper,children:(0,o.jsx)(m.ErrorBanner,{error:e.error,onReset:()=>{e.retryLoad()}})}):(0,o.jsx)(n.Paper,{className:r.paper,"data-testid":"graph-genome-load-canceled",children:(0,o.jsxs)("div",{className:r.row,children:[(0,o.jsx)(n.Typography,{variant:"h6",children:"Loading canceled"}),(0,o.jsx)(n.Button,{variant:"contained",size:"small","data-testid":"graph-genome-retry",onClick:()=>{e.retryLoad()},children:"Retry"})]})})}),h=b;var M=a(B(),1),N=a(v(),1),i=a(G(),1),w=a(g(),1),E=a(L(),1),t=a(s(),1),k=`H VN:Z:1.0
2
2
  S 1 ACGT
3
3
  S 2 GGCC
4
4
  S 3 TTAA
@@ -7,4 +7,4 @@ L 1 + 2 + 0M
7
7
  L 1 + 3 + 0M
8
8
  L 2 + 4 + 0M
9
9
  L 3 + 4 + 0M`,z=(0,E.makeStyles)()({column:{display:"flex",flexDirection:"column",gap:8},rowEnd:{display:"flex",gap:8,alignItems:"flex-end"},rowCenter:{display:"flex",gap:8,alignItems:"center"},flex1:{flex:1},paper:{padding:16,margin:8,maxWidth:560,marginInline:"auto"},header:{marginBottom:12},footer:{marginTop:12,display:"flex",justifyContent:"flex-end"}}),R=(0,w.observer)(function({model:e}){let{classes:r}=z(),[d,T]=(0,M.useState)("");function y(){d.trim()&&e.loadGFAFromLocation({uri:d,locationType:"UriLocation"})}function A(p){let c=p.target.files?.[0];c&&c.text().then(f=>e.loadGFA(f,c.name)).catch(f=>{e.setError(f)})}return(0,t.jsxs)(i.Paper,{className:r.paper,children:[(0,t.jsx)("div",{className:r.header,children:(0,t.jsx)(i.Typography,{variant:"h6",children:"Load a GFA graph"})}),(0,t.jsxs)("div",{className:r.column,children:[(0,t.jsxs)("div",{className:r.rowCenter,children:[(0,t.jsxs)(i.Button,{variant:"outlined",component:"label",size:"small",children:["Choose file",(0,t.jsx)("input",{type:"file",accept:".gfa,.gfa1,.gfa2",hidden:!0,onChange:p=>{A(p)}})]}),(0,t.jsx)(i.Typography,{variant:"caption",color:"text.secondary",children:"Whole-file GFA; best for small/medium graphs."})]}),(0,t.jsxs)("div",{className:r.rowEnd,children:[(0,t.jsx)(i.TextField,{size:"small",label:"URL",placeholder:"https://example.com/graph.gfa",value:d,onChange:p=>{T(p.target.value)},onKeyDown:p=>{p.key==="Enter"&&y()},className:r.flex1}),(0,t.jsx)(i.Button,{variant:"contained",onClick:()=>{y()},disabled:!d.trim(),children:"Open"})]})]}),(0,t.jsx)("div",{className:r.footer,children:(0,t.jsx)(i.Button,{size:"small",onClick:()=>{e.loadGFA(k,"Example graph")},children:"Load 4-node example"})}),e.error?(0,t.jsx)(N.ErrorBanner,{error:e.error}):null]})}),F=R;var l=a(s(),1),U=(0,S.observer)(function({model:e}){return e.hasGraph?(0,l.jsx)(x,{model:e}):e.canRetryLoad&&(e.error||e.loadCanceled)?(0,l.jsx)(h,{model:e}):(0,l.jsxs)(l.Fragment,{children:[e.isLoading?(0,l.jsx)(h,{model:e}):null,(0,l.jsx)("div",{hidden:e.isLoading,children:(0,l.jsx)(F,{model:e})})]})}),O=U;export{O as default};
10
- //# sourceMappingURL=GraphGenomeView-YYP4IFSI.js.map
10
+ //# sourceMappingURL=GraphGenomeView-AY2FO4P2.js.map
@@ -1,4 +1,4 @@
1
- import{a as g}from"./chunk-SJNG2XK7.js";import{Z as f}from"./chunk-H54W6OQQ.js";import"./chunk-7BKUWQE5.js";import"./chunk-KULNKXPT.js";import{a as x}from"./chunk-J6KYLXRD.js";import{a as l,c as m,d as y}from"./chunk-TYJTJGPO.js";import{b as o}from"./chunk-FY3BTKY4.js";var a=o(y(),1),b=o(m(),1),S=o(f(),1),n=o(l(),1),L=(0,S.makeStyles)()({section:{marginBottom:24},formControl:{minWidth:200}}),w=[{value:0,label:"None"},{value:1,label:"1 hop"},{value:2,label:"2 hops"}],k=(0,b.observer)(function({model:e}){let{classes:t}=L();return(0,n.jsxs)("div",{className:t.section,children:[(0,n.jsxs)(a.FormControl,{className:t.formControl,children:[(0,n.jsx)(a.InputLabel,{children:"Graph context"}),(0,n.jsx)(a.Select,{value:e.subgraphContext,label:"Graph context","data-testid":"graph-context-select",onChange:p=>{e.setSubgraphContext(p.target.value),e.cut()},children:w.map(({value:p,label:u})=>(0,n.jsx)(a.MenuItem,{value:p,children:u},p))})]}),(0,n.jsx)(a.Typography,{variant:"caption",color:"text.secondary",children:"How far the cut follows links out of the region, one hop by default. A detour that leaves the reference before the window and rejoins after it is indexed under its own sequence, so at none its middle is missing and the one bubble draws as two unrelated stubs. Each hop costs a query per off-reference segment already reached."})]})}),v=k;var C=o(x(),1),d=o(y(),1),c=o(m(),1),G=o(f(),1),i=o(l(),1),T=(0,G.makeStyles)()({section:{marginBottom:24}});function M(r){let e=r.split(/[\s,]+/).map(t=>t.trim()).filter(t=>t!=="");return e.length===0?void 0:e}var F=(0,c.observer)(function({model:e}){let[t,p]=(0,C.useState)(e.chosenHaplotypes?.join(", ")??""),u=()=>{let s=M(t)??[];s.join(`
1
+ import{a as g}from"./chunk-LJZDHT2C.js";import{_ as f}from"./chunk-K5Z47YVI.js";import"./chunk-7BKUWQE5.js";import"./chunk-KULNKXPT.js";import{a as x}from"./chunk-J6KYLXRD.js";import{a as l,c as m,d as y}from"./chunk-TYJTJGPO.js";import{b as o}from"./chunk-FY3BTKY4.js";var a=o(y(),1),b=o(m(),1),S=o(f(),1),n=o(l(),1),L=(0,S.makeStyles)()({section:{marginBottom:24},formControl:{minWidth:200}}),w=[{value:0,label:"None"},{value:1,label:"1 hop"},{value:2,label:"2 hops"}],k=(0,b.observer)(function({model:e}){let{classes:t}=L();return(0,n.jsxs)("div",{className:t.section,children:[(0,n.jsxs)(a.FormControl,{className:t.formControl,children:[(0,n.jsx)(a.InputLabel,{children:"Graph context"}),(0,n.jsx)(a.Select,{value:e.subgraphContext,label:"Graph context","data-testid":"graph-context-select",onChange:p=>{e.setSubgraphContext(p.target.value),e.cut()},children:w.map(({value:p,label:u})=>(0,n.jsx)(a.MenuItem,{value:p,children:u},p))})]}),(0,n.jsx)(a.Typography,{variant:"caption",color:"text.secondary",children:"How far the cut follows links out of the region, one hop by default. A detour that leaves the reference before the window and rejoins after it is indexed under its own sequence, so at none its middle is missing and the one bubble draws as two unrelated stubs. Each hop costs a query per off-reference segment already reached."})]})}),v=k;var C=o(x(),1),d=o(y(),1),c=o(m(),1),G=o(f(),1),i=o(l(),1),T=(0,G.makeStyles)()({section:{marginBottom:24}});function M(r){let e=r.split(/[\s,]+/).map(t=>t.trim()).filter(t=>t!=="");return e.length===0?void 0:e}var F=(0,c.observer)(function({model:e}){let[t,p]=(0,C.useState)(e.chosenHaplotypes?.join(", ")??""),u=()=>{let s=M(t)??[];s.join(`
2
2
  `)===(e.chosenHaplotypes??[]).join(`
3
3
  `)||(e.setSubgraphHaplotypes(s),e.cut())};return(0,i.jsx)(d.TextField,{fullWidth:!0,label:"Haplotypes",placeholder:"every haplotype",value:t,slotProps:{htmlInput:{"data-testid":"graph-haplotypes-field"}},onChange:s=>{p(s.target.value)},onBlur:()=>{u()},onKeyDown:s=>{s.key==="Enter"&&u()}})}),N=(0,c.observer)(function({model:e}){let{classes:t}=T();return e.adapterConfig.type==="GbzBaseSyntenyAdapter"?(0,i.jsxs)("div",{className:t.section,children:[(0,i.jsx)(F,{model:e},e.chosenHaplotypes?.join(",")??""),(0,i.jsx)(d.Typography,{variant:"caption",color:"text.secondary",children:"The haplotypes the cut is for, as lane assembly names or PanSN prefixes (HG002#1, or HG002 for both), separated by commas. The cut keeps their walks and the nodes those walks visit, with the reference. Empty is every haplotype."})]}):null}),H=N;var h=o(l(),1);function B({model:r,open:e,onClose:t}){return(0,h.jsxs)(g,{model:r,open:e,onClose:t,children:[(0,h.jsx)(v,{model:r}),(0,h.jsx)(H,{model:r})]})}export{B as default};
4
- //# sourceMappingURL=GraphTrackSettingsDialog-2WPJRAJC.js.map
4
+ //# sourceMappingURL=GraphTrackSettingsDialog-QJXPMWYG.js.map
@@ -0,0 +1,2 @@
1
+ import{a as i}from"./chunk-2V27PV25.js";import"./chunk-LJZDHT2C.js";import"./chunk-NWJN4C4V.js";import"./chunk-K5Z47YVI.js";import"./chunk-UQEPPJEO.js";import"./chunk-SCMIJAAX.js";import"./chunk-7BKUWQE5.js";import"./chunk-KULNKXPT.js";import"./chunk-FCWXYIFC.js";import"./chunk-J6KYLXRD.js";import{a as e,c as d}from"./chunk-TYJTJGPO.js";import{a as h,b as t}from"./chunk-FY3BTKY4.js";var p=h((l,o)=>{o.exports=JBrowseExports["@jbrowse/display-kit/DisplayChrome"]});var s=t(p(),1),n=t(d(),1);var r=t(e(),1),y=(0,n.observer)(function({model:a}){return(0,r.jsx)(s.DisplayStatusChrome,{model:a,phase:a.displayPhase,drawn:a.painted&&a.geometryPainted,testid:"linear-graph-display","data-layout":a.chosenLayoutMode,"data-cut-tier":a.cutTier,"data-recuts":a.recuts,"data-node-count":a.hasGraph?a.nodeCount:void 0,"data-loading":a.isLoading?"":void 0,style:{width:a.paneWidth,height:a.height,overflow:"hidden"},children:(0,r.jsx)(i,{model:a,ownChrome:!1})})}),c=y;export{c as default};
2
+ //# sourceMappingURL=LinearGraphDisplay-GKVG72J4.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["global-externals:@jbrowse/display-kit/DisplayChrome", "../../src/LinearGraphDisplay/components/LinearGraphDisplay.tsx"],
4
+ "sourcesContent": ["module.exports = JBrowseExports[\"@jbrowse/display-kit/DisplayChrome\"];", "import { DisplayStatusChrome } from '@jbrowse/display-kit/DisplayChrome'\nimport { observer } from 'mobx-react'\n\nimport GraphCanvas from '../../GraphGenomeView/components/GraphCanvas'\n\nimport type { LinearGraphDisplayModel } from '../model'\n\nconst LinearGraphDisplay = observer(function LinearGraphDisplay({\n model,\n}: {\n model: LinearGraphDisplayModel\n}) {\n return (\n <DisplayStatusChrome\n model={model}\n phase={model.displayPhase}\n drawn={model.painted && model.geometryPainted}\n testid=\"linear-graph-display\"\n data-layout={model.chosenLayoutMode}\n data-cut-tier={model.cutTier}\n data-recuts={model.recuts}\n data-node-count={model.hasGraph ? model.nodeCount : undefined}\n data-loading={model.isLoading ? '' : undefined}\n style={{\n width: model.paneWidth,\n height: model.height,\n overflow: 'hidden',\n }}\n >\n <GraphCanvas model={model} ownChrome={false} />\n </DisplayStatusChrome>\n )\n})\n\nexport default LinearGraphDisplay\n"],
5
+ "mappings": "kYAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,CAAAA,EAAO,QAAU,eAAe,oCAAoC,ICApE,IAAAC,EAAoC,SACpCC,EAAyB,SA4BnB,IAAAC,EAAA,SAtBAC,KAAqB,YAAS,SAA4B,CAC9D,MAAAC,CACF,EAEG,CACD,SACE,OAAC,uBACC,MAAOA,EACP,MAAOA,EAAM,aACb,MAAOA,EAAM,SAAWA,EAAM,gBAC9B,OAAO,uBACP,cAAaA,EAAM,iBACnB,gBAAeA,EAAM,QACrB,cAAaA,EAAM,OACnB,kBAAiBA,EAAM,SAAWA,EAAM,UAAY,OACpD,eAAcA,EAAM,UAAY,GAAK,OACrC,MAAO,CACL,MAAOA,EAAM,UACb,OAAQA,EAAM,OACd,SAAU,QACZ,EAEA,mBAACC,EAAA,CAAY,MAAOD,EAAO,UAAW,GAAO,EAC/C,CAEJ,CAAC,EAEME,EAAQH",
6
+ "names": ["require_DisplayChrome", "__commonJSMin", "exports", "module", "import_DisplayChrome", "import_mobx_react", "import_jsx_runtime", "LinearGraphDisplay", "model", "GraphCanvas_default", "LinearGraphDisplay_default"]
7
+ }
@@ -0,0 +1,3 @@
1
+ import{a as Ht}from"./chunk-LJZDHT2C.js";import{$ as pt,$a as It,Aa as Mt,Ca as Rt,D as ye,Ia as Lt,J as oe,K as rt,N as re,O as at,Oa as Ct,P as st,Q as it,Qa as Pt,R as lt,Ra as Et,Ta as Gt,U as ve,V as ct,X as we,Ya as xe,Za as We,a as T,aa as dt,ab as Tt,b as Te,ba as ut,ca as ft,da as pe,ea as ht,fa as mt,ga as gt,h as Je,i as Qe,ia as bt,ja as yt,ka as ke,la as vt,n as et,oa as wt,pa as Se,r as ce,ra as kt,s as nt,va as St,wa as xt}from"./chunk-NWJN4C4V.js";import{M as tt,_ as ae,z as be}from"./chunk-K5Z47YVI.js";import{b as ot}from"./chunk-UQEPPJEO.js";import{a as ge}from"./chunk-FCWXYIFC.js";import{a as B}from"./chunk-J6KYLXRD.js";import{a as m,b as He,c as M,d as J}from"./chunk-TYJTJGPO.js";import{a as po,b as s}from"./chunk-FY3BTKY4.js";var Nt=po((Or,Wt)=>{Wt.exports=JBrowseExports["@jbrowse/render-core/useRenderingBackend"]});var Ie=s(B(),1);var ne=s(He(),1),Ue=s(ge(),1),ao=s(Nt(),1);var Bt=s(m(),1),_t=(0,T.createSvgIcon)((0,Bt.jsx)("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 N=s(M(),1);var Ne=s(M(),1);var I={background:"rgba(255,255,255,0.82)",padding:"4px 6px",borderRadius:3,fontSize:11,lineHeight:"15px",whiteSpace:"nowrap"},v={display:"flex",alignItems:"center",gap:5};var W=s(m(),1),uo={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:2},fo=(0,Ne.observer)(function({model:e}){let{bubbleHalos:n,walkLift:o,hoveredBubble:a}=e;if(n.length===0)return null;let{scaleX:r,scaleY:p,translateX:l,translateY:d,paneWidth:u,canvasHeight:f}=e,c=e.contigThickness*yt,b=g=>o!==void 0&&!g.nodeIds.some(E=>o.nodeIds.has(E));return(0,W.jsx)("svg",{style:uo,width:u,height:f,"data-testid":"graph-bubble-halos",children:(0,W.jsx)("g",{transform:`translate(${l} ${d}) scale(${r} ${p})`,children:n.filter(g=>!g.whole).map(g=>(0,W.jsx)("path",{d:g.path,fill:"none",stroke:oe[g.kind],strokeOpacity:a&&ot(g.bubble,a)?.45:b(g)?.06:.22,strokeWidth:c,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"},`${g.bubble.start}-${g.bubble.end}`))})})}),Ot=fo;function ho({color:t}){return(0,W.jsx)("svg",{width:18,height:10,style:{flex:"none"},children:(0,W.jsx)("line",{x1:5,y1:5,x2:13,y2:5,stroke:t,strokeOpacity:.35,strokeWidth:8,strokeLinecap:"round"})})}var zt=(0,Ne.observer)(function({model:e}){let n=new Map;for(let o of e.bubbleHalos)if(!o.whole){let a=oe[o.kind],r=n.get(a)??new Set;r.add(rt[o.kind]),n.set(a,r)}return n.size>0?(0,W.jsx)("div",{style:I,"data-testid":"graph-halo-legend",children:[...n].map(([o,a])=>(0,W.jsxs)("div",{style:v,children:[(0,W.jsx)(ho,{color:o}),(0,W.jsxs)("span",{children:["bubble: ",[...a].join(", ")]})]},o))}):null});var Re=s(B(),1);var Le=s(Te(),1),Be=s(M(),1);var A=s(m(),1),Q={width:18,height:8,borderRadius:2,flex:"none"},mo={marginBottom:2},go={...Q,width:48};function de({walk:t,label:e,reference:n,hint:o,at:a}){let r=kt(t,n);return(0,A.jsxs)("div",{style:mo,title:[r.hover,o].filter(Boolean).join(" \xB7 ")||void 0,children:[(0,A.jsxs)("div",{style:v,children:[(0,A.jsx)("div",{style:{...r.shades?go:Q,background:ye(t.encoding)}}),(0,A.jsxs)("span",{children:[(0,A.jsx)("strong",{children:e}),r.delta,r.outside,r.reversed]})]}),a?(0,A.jsx)("div",{"data-testid":"graph-walk-at",children:a}):r.scale?(0,A.jsx)("div",{children:r.scale}):null]})}var _=s(B(),1);function At(t){let e=t.deltaY*(t.deltaMode===1?40:t.deltaMode===2?800:1),n=(t.ctrlKey?10:1)*e/100;return 1.1**-Math.max(-2,Math.min(2,n))}var Dt=s(ge(),1);function Me(t,e){(0,_.useEffect)(()=>{if(!t)return;let n=t;function o(a){if(e.hostPlacesX)return;e.host&&a.stopPropagation(),a.preventDefault();let r=n.getBoundingClientRect();e.zoom(At(a),a.clientX-r.left,a.clientY-r.top)}return n.addEventListener("wheel",o,{passive:!1}),()=>{n.removeEventListener("wheel",o)}},[t,e])}function Xt(t){let e=(0,_.useRef)({x:0,y:0}),n=(0,_.useRef)(!1),o=(0,_.useRef)({frame:0,pan:null,hover:null});(0,_.useEffect)(()=>()=>{cancelAnimationFrame(o.current.frame)},[]);let[a,r]=(0,_.useState)(void 0),[p,l]=(0,_.useState)(void 0);function d(h,k){return{x:(h-t.translateX)/t.scaleX,y:(k-t.translateY)/t.scaleY}}function u(h){let k=h.currentTarget.getBoundingClientRect();return d(h.clientX-k.left,h.clientY-k.top)}function f(h,k){let{nodePositions:L}=t,S=h*t.scaleX+t.translateX,$=k*t.scaleY+t.translateY;if(t.layoutResult?.tubeMap)return t.tubeMapNodeAt(S,$);let qe=t.referenceStripNodeAt(S,$);return qe||(L?gt(L,h,k,t.axisScale,t.positionsVersion,t.nodeInk):null)}function c(h){if(h.button===0){if(n.current=!1,t.hostPlacesX)return;t.host&&h.stopPropagation();let{x:k,y:L}=u(h),S=t.layoutResult?.tubeMap||h.nativeEvent.offsetY<t.referenceStripZonePx?null:f(k,L);S?t.setDraggingNode(S):t.setPanning(!0),e.current={x:h.clientX,y:h.clientY}}}function b(){let h=o.current;if(h.frame=0,h.pan&&(t.setTransform(t.scale,t.translateX+h.pan.dx,t.translateY+h.pan.dy),h.pan=null),h.hover&&t.nodePositions&&t.graph){let{x:k,y:L}=d(h.hover.x,h.hover.y);h.hover=null;let S=f(k,L);t.setHoveredNode(S),t.setHoveredEdge(S||t.layoutResult?.tubeMap?null:bt(t.nodePositions,t.graph,k,L,t.axisScale,t.effectiveDrawPaths&&!t.facetPanels,t.positionsVersion,t.deletionEdgeIndexes,t.hiddenEdgeIndexes,t.deletionRoutes,t.layoutResult?.stranded))}}function g(){o.current.frame||(o.current.frame=requestAnimationFrame(b))}function E(){let h=o.current;cancelAnimationFrame(h.frame),h.frame=0,h.pan=null,h.hover=null}function P(h){let k=h.clientX-e.current.x,L=h.clientY-e.current.y;e.current={x:h.clientX,y:h.clientY},(Math.abs(k)>1||Math.abs(L)>1)&&(n.current=!0);let S=o.current;if(t.draggingNode)t.moveNode(t.draggingNode,k/t.scaleX,L/t.scaleY);else if(t.isPanning)S.pan={dx:(S.pan?.dx??0)+k,dy:(S.pan?.dy??0)+L},g();else{let $=h.currentTarget.getBoundingClientRect();S.hover={x:h.clientX-$.left,y:h.clientY-$.top},g()}}function G(){t.stopDragging()}function me(){E(),(0,Dt.isAlive)(t)&&(t.stopDragging(),t.setHoveredNode(null),t.setHoveredEdge(null))}function lo(h){let{x:k,y:L}=u(h),S=f(k,L);if(S){h.preventDefault(),r({nodeId:S,top:h.clientY,left:h.clientX});return}let $=t.walkRowAt(k*t.scaleX+t.translateX,L*t.scaleY+t.translateY);$!==void 0&&(h.preventDefault(),l({row:$,top:h.clientY,left:h.clientX}))}function co(h){if(!n.current){let{x:k,y:L}=u(h),S=f(k,L);t.setSelectedNode(S),S&&t.showNodeDetails(S)}}return{handlers:{onMouseDown:c,onMouseMove:P,onMouseUp:G,onMouseLeave:me,onClick:co,onContextMenu:lo},contextNode:a,contextRow:p,closeContextMenu:()=>{r(void 0),l(void 0)}}}var F=s(m(),1),vo={position:"absolute",left:0,top:0,zIndex:4,display:"grid",gap:8,lineHeight:"normal"},wo={height:34,padding:"2px 6px",boxSizing:"border-box",fontFamily:"inherit",fontSize:11,color:"inherit",cursor:"pointer",border:"none",background:"none",textAlign:"left",display:"block"},ko=(0,Be.observer)(function({model:e,lift:n,width:o,height:a,cell:r,handlers:p}){let[l,d]=(0,Re.useState)(null),u=n.walks[0];Me(l,e),(0,Re.useEffect)(()=>{if(!l)return;let c=new Se(l);c.resize(o,a);let b=(0,Le.computed)(()=>e.buildDrawing(n,!1)),g,E=(0,Le.autorun)(()=>{let P=b.get();P&&(P!==g&&(c.uploadGeometry(P.batch),g=P),e.applyHighlights(c),e.paint(c))});return()=>{E(),c.dispose()}},[l,e,n,o,a]);let f=e.walkLabel(u.name);return(0,F.jsxs)("div",{style:r,children:[(0,F.jsx)("button",{type:"button",style:wo,"data-testid":"graph-facet-title",onClick:()=>{e.liftWalks([u.name]),e.setFacet("")},children:(0,F.jsx)(de,{walk:u,label:f,reference:e.walkReference,hint:`click to lift ${f} alone`,at:e.hoveredOn(u)})}),(0,F.jsx)("canvas",{ref:d,"data-testid":"graph-facet-canvas",style:{width:o,height:a,display:"block",cursor:e.isPanning||e.draggingNode?"grabbing":"grab"},...p})]})}),So=(0,Be.observer)(function({model:e,handlers:n}){let o=e.facetPanels,a=e.facetGrid,r=e.facetPlacement;if(!o||!a||!r)return null;let{columns:p,width:l,height:d}=a;return(0,F.jsx)("div",{"data-testid":"graph-facet-panels",style:{...vo,width:e.paneWidth,minHeight:e.canvasHeight,gridTemplateColumns:`repeat(${p}, ${l}px)`,background:e.darkMode?"#1f1f1f":"white"},children:o.map((u,f)=>(0,F.jsx)(ko,{model:e,lift:u,width:l,height:d,cell:{gridRow:Math.floor(r.cells[f]/p)+1,gridColumn:r.cells[f]%p+1},handlers:n},u.walks[0].name))})}),$t=So;var Vt=s(B(),1);var Kt=s(M(),1);var Ft=s(B(),1);function xo(t){return t==="class"?"className":/^(data|aria)-/.test(t)?t:t.replace(/-([a-z])/g,(e,n)=>n.toUpperCase())}function Yt(t,e){if(typeof t=="string")return t;let n={key:e};for(let[o,a]of Object.entries(t.attrs))a!==void 0&&(n[xo(o)]=a);return(0,Ft.createElement)(t.tag,n,...t.children.map(Yt))}function D({el:t}){return Yt(t,0)}var _e=s(m(),1),Mo={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:2},Ro=(0,Kt.observer)(function({model:e}){let n=`exon-outline-${(0,Vt.useId)().replaceAll(/[^\w-]/g,"")}`,{genePins:o,walkLift:a,nodeInk:r}=e,{scaleX:p,scaleY:l,translateX:d,translateY:u,paneWidth:f,canvasHeight:c}=e,b=mt(ht(o,r.halfWidthPx,a),{id:n,width:f,height:c,transform:`translate(${d} ${u}) scale(${p} ${l})`});return b?(0,_e.jsx)("svg",{style:Mo,width:f,height:c,"data-testid":"graph-gene-pins",children:(0,_e.jsx)(D,{el:b})}):null}),Zt=Ro;var jt=s(m(),1),Ut=(0,T.createSvgIcon)((0,jt.jsx)("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 Oe=s(m(),1),qt=(0,T.createSvgIcon)([(0,Oe.jsx)("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"),(0,Oe.jsx)("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var Jt=s(m(),1),Qt=(0,T.createSvgIcon)((0,Jt.jsx)("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 z=s(J(),1),Xe=s(M(),1),Mn=s(ae(),1);var Y=s(J(),1),en=s(M(),1),tn=s(ae(),1),se=s(m(),1),Lo=(0,tn.makeStyles)()({formControl:{minWidth:100}}),Co=(0,en.observer)(function({model:e}){let{classes:n}=Lo(),o=e.colorSchemeLock;return(0,se.jsxs)(Y.FormControl,{size:"small",className:n.formControl,disabled:o!==void 0,title:o?.why,children:[(0,se.jsx)(Y.InputLabel,{children:"Color"}),(0,se.jsx)(Y.Select,{value:e.chosenColorScheme,label:"Color",renderValue:o?()=>o.value:void 0,onChange:a=>{e.setColorScheme(a.target.value)},children:tt.map(({value:a,label:r})=>(0,se.jsx)(Y.MenuItem,{value:a,children:r},a))})]})}),nn=Co;var Ae=s(J(),1),De=s(M(),1),on=s(ae(),1),ie=s(m(),1),rn=(0,on.makeStyles)()({stats:{marginLeft:"auto"},perf:{color:"#888",fontVariantNumeric:"tabular-nums"}});function ze(t){return t===void 0?"\u2013":`${Math.round(t)}ms`}var Po=(0,De.observer)(function({model:e}){let{classes:n}=rn(),{lastFetchMs:o,lastLayoutMs:a,lastGeometryMs:r}=e,p=o!==void 0||a!==void 0||r!==void 0;return e.showPerf&&p?(0,ie.jsxs)(Ae.Typography,{variant:"caption",className:n.perf,"data-testid":"graph-perf-stats",children:["fetch ",ze(o)," \xB7 layout ",ze(a)," \xB7 geom"," ",ze(r)]}):null}),Eo=(0,De.observer)(function({model:e}){let{classes:n}=rn();return(0,ie.jsxs)("div",{className:n.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:[(0,ie.jsxs)(Ae.Typography,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",(0,ie.jsx)(Po,{model:e})]})}),an=Eo;var O=s(J(),1),sn=s(M(),1),ln=s(ae(),1),V=s(m(),1),Go=(0,ln.makeStyles)()({formControl:{minWidth:150}}),Io=(0,sn.observer)(function({model:e}){let{classes:n}=Go(),{graph:o}=e;return(0,V.jsxs)(O.FormControl,{size:"small",className:n.formControl,children:[(0,V.jsx)(O.InputLabel,{children:"Layout"}),(0,V.jsx)(O.Select,{value:e.chosenLayoutMode,label:"Layout","data-testid":"graph-layout-select",onChange:a=>{e.switchLayout(a.target.value)},children:et.map(({value:a,label:r,description:p,available:l})=>(0,V.jsx)(O.MenuItem,{value:a,disabled:o?!l(o):!1,children:(0,V.jsx)(O.Tooltip,{title:p,placement:"right",children:(0,V.jsx)("span",{children:r})})},a))})]})}),cn=Io;var X=s(J(),1),pn=s(M(),1),dn=s(ae(),1),K=s(m(),1),To=(0,dn.makeStyles)()({formControl:{minWidth:130,maxWidth:240}}),Ho=(0,pn.observer)(function({model:e}){let{classes:n}=To(),{repeatChoices:o}=e;if(e.chosenLayoutMode!=="walkrows"||o.length===0)return null;let a=new Set(o.map(r=>r.key));return(0,K.jsxs)(X.FormControl,{size:"small",className:n.formControl,children:[(0,K.jsx)(X.InputLabel,{children:"Repeat"}),(0,K.jsxs)(X.Select,{value:a.has(e.repeatKey)?e.repeatKey:"",label:"Repeat","data-testid":"graph-repeat-select",onChange:r=>{e.setRepeatKey(r.target.value)},children:[(0,K.jsx)(X.MenuItem,{value:"",children:(0,K.jsx)("em",{children:"Whole window"})}),o.map(({key:r,name:p,unit:l})=>(0,K.jsxs)(X.MenuItem,{value:r,children:[p," \xB7 ",l.toLocaleString()," bp unit"]},r))]})]})}),un=Ho;var bn=s(B(),1),yn=s(He(),1);var fn=s(m(),1),hn=(0,T.createSvgIcon)((0,fn.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"}),"Delete");var mn=s(m(),1),gn=(0,T.createSvgIcon)((0,mn.jsx)("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 vn=s(M(),1);var Z=s(m(),1),Wo=(0,vn.observer)(function({model:e}){let[n,o]=(0,bn.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(yn.CascadingMenuButton,{size:"small",menuItems:[{type:"checkbox",label:"Linear layout",checked:e.linearLayout,onClick:()=>{e.setLinearLayout(!e.linearLayout),e.recomputeLayout()}},{type:"checkbox",label:"Show deletion edges",checked:e.showDeletionEdges,onClick:()=>{e.setShowDeletionEdges(!e.showDeletionEdges)}},{type:"checkbox",label:"Show timings",checked:e.showPerf,onClick:()=>{e.setShowPerf(!e.showPerf)}},{type:"divider"},{label:"Settings",icon:Tt,onClick:()=>{o(!0)}},{type:"divider"},{label:"Return to import form",icon:hn,onClick:()=>{e.clearGraph()}}],children:(0,Z.jsx)(gn,{})}),(0,Z.jsx)(Ht,{model:e,open:n,onClose:()=>{o(!1)}})]})}),wn=Wo;var H=s(J(),1),kn=s(M(),1),Sn=s(ae(),1),j=s(m(),1),No=(0,Sn.makeStyles)()({formControl:{minWidth:130,maxWidth:260}}),Bo=(0,kn.observer)(function({model:e}){let{classes:n}=No(),{walkChoices:o}=e;if(o.length===0||!e.liftsWalks)return null;let a=new Set(o.map(l=>l.name)),r=new Map(o.map(l=>[l.name,l.label])),p=e.walkLayers.map(l=>l.walk).filter(l=>a.has(l));return(0,j.jsxs)(H.FormControl,{size:"small",className:n.formControl,children:[(0,j.jsx)(H.InputLabel,{children:"Walks"}),(0,j.jsx)(H.Select,{multiple:!0,value:p,label:"Walks","data-testid":"graph-walk-select",renderValue:l=>l.map(d=>r.get(d)).join(", "),onChange:l=>{let{value:d}=l.target;e.liftWalks(typeof d=="string"?d.split(","):d)},children:o.map(({name:l,label:d})=>(0,j.jsxs)(H.MenuItem,{value:l,dense:!0,children:[(0,j.jsx)(H.Checkbox,{size:"small",checked:p.includes(l)}),(0,j.jsx)(H.ListItemText,{primary:d})]},l))})]})}),xn=Bo;var x=s(m(),1),_o=(0,Mn.makeStyles)()({toolbar:{display:"flex",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:"1px solid #ddd"}}),Oo=(0,Xe.observer)(function({model:e}){return(0,x.jsx)(z.Typography,{variant:"body2",children:e.zoomPercent})}),zo=(0,Xe.observer)(function({model:e}){let{classes:n}=_o();return(0,x.jsxs)("div",{className:n.toolbar,children:[(0,x.jsx)(cn,{model:e}),(0,x.jsx)(nn,{model:e}),(0,x.jsx)(xn,{model:e}),(0,x.jsx)(un,{model:e}),(0,x.jsx)(z.Tooltip,{title:"Zoom in",children:(0,x.jsx)(z.IconButton,{size:"small",onClick:()=>{e.zoom(1.5,e.viewBox.width/2,e.viewBox.height/2)},children:(0,x.jsx)(qt,{})})}),(0,x.jsx)(z.Tooltip,{title:"Zoom out",children:(0,x.jsx)(z.IconButton,{size:"small",onClick:()=>{e.zoom(1/1.5,e.viewBox.width/2,e.viewBox.height/2)},children:(0,x.jsx)(Qt,{})})}),(0,x.jsx)(z.Tooltip,{title:"Zoom to fit",children:(0,x.jsx)(z.IconButton,{size:"small",onClick:()=>{e.zoomToFit()},children:(0,x.jsx)(Ut,{})})}),(0,x.jsx)(Oo,{model:e}),(0,x.jsx)(an,{model:e}),(0,x.jsx)(wn,{model:e})]})}),Rn=zo;var Pn=s(ge(),1),En=s(M(),1);var ee=s(m(),1);function ue({x:t,y:e,w:n,text:o,note:a,color:r,edge:p=r,italic:l,small:d,dimmed:u,title:f,testId:c,onClick:b,onHover:g}){return(0,ee.jsxs)("g",{style:{pointerEvents:b||g?"auto":"none",cursor:b?"pointer":void 0,opacity:u?.35:1},"data-testid":c,onClick:b,onMouseEnter:()=>{g?.(!0)},onMouseLeave:()=>{g?.(!1)},children:[f?(0,ee.jsx)("title",{children:f}):null,(0,ee.jsx)("rect",{x:t-n/2,y:e-11-4+2,width:n,height:17,rx:3,fill:"rgba(255,255,255,0.85)",stroke:p,strokeWidth:d?.6:1}),(0,ee.jsxs)("text",{x:t,y:e,fontSize:d?10:11,fontFamily:"sans-serif",fontStyle:l?"italic":void 0,fontWeight:l?600:void 0,fill:r,textAnchor:"middle",children:[o,a?(0,ee.jsx)("tspan",{fontStyle:"normal",fontWeight:"normal",children:a}):null]})]})}var U=s(m(),1),Ao={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:3},Cn="#1c1c22",Do=(0,En.observer)(function({model:e}){let{bubbles:n,genes:o,routes:a}=e.overlayLabels;if(n.length+o.length+a.length===0)return null;let{walkLift:r,scaleY:p,translateY:l,contigThickness:d}=e,u=c=>r!==void 0&&!c.nodeIds.some(b=>r.nodeIds.has(b)),f=c=>r!==void 0&&!c.route.walks.some(b=>r.names.has(b));return(0,U.jsxs)("svg",{style:Ao,width:e.paneWidth,height:e.canvasHeight,"data-testid":"graph-label-layer",children:[o.map(({item:c,x:b,y:g,w:E,text:P})=>{let{gene:G}=c,me=vt(c);return(0,U.jsxs)("g",{children:[(0,U.jsx)("line",{x1:b,x2:b,y1:g-11-2,y2:c.at.y*p+l+d/2,stroke:Cn,strokeWidth:.8,strokeOpacity:.6}),(0,U.jsx)(ue,{x:b,y:g,w:E,text:G.name,note:P.slice(G.name.length)||void 0,color:Cn,edge:pe,italic:!0,title:`${G.name} ${G.refName}:${G.start.toLocaleString()}-${G.end.toLocaleString()}${me?`, ${me} in the cut`:""}`,testId:"graph-gene-pin-label"})]},`${G.name}-${G.start}`)}),a.map(({item:{halo:c,route:b},x:g,y:E,w:P,text:G})=>(0,U.jsx)(ue,{x:g,y:E,w:P,text:G,color:oe[c.kind],small:!0,dimmed:f(b),title:`${b.route.walks.length} walk(s): ${b.route.walks.join(", ")}`,testId:"graph-route-label"},`${c.bubble.start}-${c.bubble.end}-${b.route.steps.join(",")}`)),n.map(({item:c,x:b,y:g,w:E,text:P})=>(0,U.jsx)(ue,{x:b,y:g,w:E,text:P,color:oe[c.kind],dimmed:u(c),title:`${c.label}
2
+ ${c.bubble.segmentCount} segments \xB7 click to open`,testId:"graph-bubble-halo-label",onClick:()=>{e.popBubble(c.bubble)},onHover:G=>{(0,Pn.isAlive)(e)&&e.setHoveredBubble(G?c.bubble:null)}},`${c.bubble.start}-${c.bubble.end}`))]})}),Gn=Do;var Ce=s(B(),1);var Tn=s(wt(),1),Hn=s(Te(),1),$e=s(M(),1);var R=s(m(),1),Xo={position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:5},$o=(0,$e.observer)(function({model:e}){let n=(0,Ce.useRef)(null),{referenceStripShown:o,paneWidth:a,canvasHeight:r}=e;return(0,Ce.useEffect)(()=>(0,Hn.autorun)(()=>{let p=n.current,l=e.referenceStripFrame,d=p?.getContext("2d");if(p&&d&&l&&e.referenceStripShown){let u=(0,Tn.getDpr)(),f=e.paneWidth,c=e.canvasHeight;p.width=Math.round(f*u),p.height=Math.round(c*u),d.setTransform(u,0,0,u,0,0),d.clearRect(0,0,f,c),Ct(d,e.referenceStripBlocks,l,{width:f,lit:e.referenceStripLit,darkMode:e.darkMode,dpr:u})}}),[e]),(0,R.jsx)("canvas",{ref:n,"data-testid":o?"graph-reference-strip":void 0,style:{...Xo,width:a,height:r,display:o?"block":"none"}})}),Wn=$o,Nn=18,Fo="linear-gradient(to right, hsl(0, 70%, 50%) 0 33%, hsl(120, 70%, 50%) 33% 61%, hsl(240, 70%, 50%) 61%)",Yo=6;function Vo(t){let e=t.filter((a,r)=>a!==t[r-1]),n=Math.min(Yo,e.length),o=Array.from({length:n},(a,r)=>e[n>1?Math.round(r*(e.length-1)/(n-1)):0]);return o.length>1?`linear-gradient(to right, ${o.join(", ")})`:o[0]??ce}function In({rows:t}){return(0,R.jsx)("div",{style:{width:Nn,flex:"none"},children:t.map(({key:e,background:n})=>(0,R.jsx)("div",{style:{height:t.length>1?3:4,background:n}},e))})}function Ko(t){return t.walkLift?.walks.map(e=>({key:e.name,background:ye(e.encoding)}))??[{key:"scheme",background:t.effectiveColorScheme==="reference-position"?Fo:Vo(t.referenceStripBlocks.map(e=>e.colors[0]))}]}function Zo(){return(0,R.jsx)("svg",{width:Nn,height:10,style:{flex:"none"},children:(0,R.jsx)("path",{d:"M0,5 L8,0 L8,10 Z M18,5 L10,0 L10,10 Z",fill:"#18181c"})})}var Bn=(0,$e.observer)(function({model:e}){let n=(e.walkLift?.walks.length??0)>1;return e.referenceStripShown?(0,R.jsxs)("div",{style:I,"data-testid":"graph-reference-strip-legend",children:[(0,R.jsxs)("div",{style:v,children:[(0,R.jsx)(In,{rows:Ko(e)}),(0,R.jsxs)("span",{children:["top strip: reference segments at their bp",n?", a row per walk":""]})]}),e.referenceStripFaded?(0,R.jsxs)("div",{style:v,children:[(0,R.jsx)(In,{rows:[{key:"pale",background:ce}]}),(0,R.jsxs)("span",{children:["reference not on"," ",n?"that row's walk":e.liftedWalksLabel]})]}):null,e.referenceStripOverhangs?(0,R.jsxs)("div",{style:v,children:[(0,R.jsx)(Zo,{}),(0,R.jsx)("span",{children:"the graph draws reference past this edge"})]}):null]}):null});var Ee=s(B(),1);var On=s(wt(),1),zn=s(Te(),1),Ye=s(M(),1);var y=s(m(),1),jo={position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:1},Uo=(0,Ye.observer)(function({model:e}){let n=(0,Ee.useRef)(null),{tubeMapPicture:o,paneWidth:a,canvasHeight:r}=e;return(0,Ee.useEffect)(()=>(0,zn.autorun)(()=>{let p=n.current,l=e.tubeMapPicture,d=e.tubeMapFrame,u=p?.getContext("2d");if(p&&u&&l&&d){let f=(0,On.getDpr)(),c=e.paneWidth,b=e.canvasHeight;p.width=Math.round(c*f),p.height=Math.round(b*f),u.setTransform(f,0,0,f,0,0),u.clearRect(0,0,c,b);let g={...d,width:c,highlightNode:e.hoveredNode??e.selectedNode,darkMode:e.darkMode,tubeColors:e.tubeMapTubeColors,nodeColors:e.tubeMapNodeColors};Rt(u,l,g),Et(u,e.tubeMapDeviations,g),Mt(u,e.tubeMapConnectors,e.connectorZoneBottom,g);let{bounds:E}=l;Lt(u,e.tubeMapGenes,g,d.y(E.minY)-2);let P=e.tubeMapRulerBoxes;P&&xt(u,P,g,d.y(E.maxY)+4,e.layoutResult?.referenceAxis)}}),[e]),(0,y.jsx)("canvas",{ref:n,"data-testid":o?"graph-tube-map":void 0,style:{...jo,width:a,height:r,display:o?"block":"none"}})}),An=Uo,Pe=18;function qo(){let t=[[.5,5.5],[8.5,Pe-.5]];return(0,y.jsx)("svg",{width:Pe,height:7,style:{flex:"none"},children:(0,y.jsx)("path",{d:t.map(([e,n])=>`M${e},6 V1.5 H${n} V6`).join(" "),fill:"none",stroke:St(),strokeWidth:1})})}var Ve={width:Pe,height:7,flex:"none"},Jo={...Ve,display:"flex",justifyContent:"center",backgroundColor:"#b8b8c0"};function Qo(){return(0,y.jsx)("div",{style:Jo,children:(0,y.jsx)("div",{style:{width:2,backgroundColor:Pt()}})})}function _n({colors:t}){let e=100/t.length,n=t.map((o,a)=>`${o} ${a*e}% ${(a+1)*e}%`);return(0,y.jsx)("div",{style:{...Ve,background:`linear-gradient(to right, ${n.join(", ")})`}})}var Fe={width:Pe,flex:"none",textAlign:"center",fontFamily:"monospace",fontSize:12};function er(){return(0,y.jsx)("div",{style:{...Ve,backgroundColor:"grey"}})}function q({swatch:t,children:e}){return(0,y.jsxs)("div",{style:v,children:[t,(0,y.jsx)("span",{children:e})]})}var Dn=(0,Ye.observer)(function({model:e}){let{logWidths:n,foldBp:o,forwardReads:a,reverseReads:r,mismatches:p}=e.tubeMapKeys,l=e.readsShown,d=l&&l.shown<l.total?l:void 0,u=[a&&(0,y.jsx)(q,{swatch:(0,y.jsx)(_n,{colors:Je}),children:"read on the forward strand"},"fwd"),r&&(0,y.jsx)(q,{swatch:(0,y.jsx)(_n,{colors:Qe}),children:"read on the reverse strand"},"rev"),d&&(0,y.jsxs)(q,{swatch:(0,y.jsx)("span",{style:Fe}),children:[d.shown.toLocaleString("en-US")," of"," ",d.total.toLocaleString("en-US")," reads shown"]},"sampled"),p.has("substitution")&&(0,y.jsx)(q,{swatch:(0,y.jsx)("span",{style:Fe,children:"A"}),children:"a read's base unlike the node's"},"sub"),p.has("insertion")&&(0,y.jsx)(q,{swatch:(0,y.jsx)("span",{style:Fe,children:"*"}),children:"bases a read inserts"},"ins"),p.has("deletion")&&(0,y.jsx)(q,{swatch:(0,y.jsx)(er,{}),children:"bases a read skips"},"del"),o!==void 0&&(0,y.jsxs)(q,{swatch:(0,y.jsx)(Qo,{}),children:["a haplotype's variant under ",be(o)]},"fold"),n&&(0,y.jsx)(q,{swatch:(0,y.jsx)(qo,{}),children:"width grows with log of length"},"log")].filter(Boolean);return u.length>0?(0,y.jsx)("div",{style:I,"data-testid":"graph-tube-map-legend",children:u}):null});var Xn=s(J(),1),$n=s(M(),1),Yn=s(m(),1),tr={position:"absolute",left:8,zIndex:5,background:"rgba(255,255,255,0.9)",textTransform:"none"},nr=(0,$n.observer)(function({model:e}){let{poppedFrom:n}=e;return n?(0,Yn.jsxs)(Xn.Button,{size:"small",variant:"outlined",style:{...tr,...e.facetPanels?{bottom:8}:{top:8}},"data-testid":"graph-unpop-bubble",onClick:()=>{e.unpopBubble()},children:["\u25C0 Back to ",n.label]}):null}),Fn=nr;var Vn=s(He(),1);var Kn=s(M(),1);var Zn=s(m(),1),Ge=(0,Kn.observer)(function({model:e,row:n,bars:o,top:a,left:r,onClose:p}){let l=e.walkRowLaunchTarget(n,o??e.walkRowBars),d=l?.assembly;return(0,Zn.jsx)(Vn.Menu,{open:!0,anchorReference:"anchorPosition",anchorPosition:{top:a,left:r},onClose:()=>{p()},onMenuItemClick:u=>{u()},menuItems:[l&&d?{label:`Linear genome view \u2014 ${d} ${xe(l.location)}`,icon:We,onClick:()=>{e.showInLinearView({location:l.location,assembly:d})}}:{label:"Linear genome view",icon:We,disabled:!0,disabledHelpText:l?`No assembly in this session is ${l.location.haplotype??l.label}`:"This walk states no contig coordinates",onClick:()=>{}}]})});var Un=s(B(),1);var Ke=s(M(),1);var w=s(m(),1),rr={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible",zIndex:3},ar="#111",sr="#9e9e9e",fe={width:18,height:st-4,borderRadius:2},ir={...fe,display:"flex",justifyContent:"center"};function jn({color:t}){return(0,w.jsx)("div",{style:ir,children:(0,w.jsx)("div",{style:{width:2,backgroundColor:t}})})}function Ze({swatch:t}){return t.kind==="gene"?(0,w.jsx)("div",{style:{...fe,boxSizing:"border-box",border:`1.5px solid ${at}`,borderRadius:0}}):(0,w.jsx)("div",{style:{...fe,height:t.kind==="gap"?it:fe.height,background:t.fill}})}var qn=(0,Ke.observer)(function({model:e}){let n=e.walkRowBars;if(!n)return null;let o=[n.reference,...n.rows].flatMap(r=>r.call??[]),a=ve(n,{ramp:e.referenceRampDomain,rampCss:re,genes:e.walkRowGenes?.size?e.walkRowGeneGaps:void 0});return(0,w.jsxs)("div",{style:I,"data-testid":"graph-walk-rows-legend",children:[a.map(r=>r.note?(0,w.jsx)("div",{style:{color:"#666",fontStyle:"italic"},children:r.label},r.label):(0,w.jsxs)("div",{style:v,children:[(0,w.jsx)(Ze,{swatch:r.swatch}),(0,w.jsx)("span",{children:r.label})]},r.label)),o.some(r=>r.spanningReads!==0)?(0,w.jsxs)("div",{style:v,children:[(0,w.jsx)(jn,{color:ar}),(0,w.jsx)("span",{children:"allele length called for this walk"})]}):null,o.some(r=>r.spanningReads===0)?(0,w.jsxs)("div",{style:v,children:[(0,w.jsx)(jn,{color:sr}),(0,w.jsx)("span",{children:"called with no read spanning it"})]}):null,o.some(r=>r.agrees===!1)?(0,w.jsxs)("div",{style:v,children:[(0,w.jsx)("div",{style:fe}),(0,w.jsxs)("span",{style:{color:ct},children:["walk and call over ",Math.round(.1*100),"% apart"]})]}):null]})}),lr=(0,Ke.observer)(function({model:e}){let n=(0,Un.useId)().replace(/[^\w-]/g,""),o=e.walkRowBars;if(!o)return null;let{paneWidth:a,canvasHeight:r}=e;return(0,w.jsx)("svg",{style:rr,width:a,height:r,"data-testid":"graph-walk-rows",children:(0,w.jsx)(D,{el:we(o,{scaleX:e.scaleX,scaleY:e.scaleY,translateX:e.translateX,translateY:e.translateY,width:a,height:r},{ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes,idPrefix:n})})})}),Jn=lr;var te=s(B(),1);var Qn=s(ge(),1),je=s(M(),1);var C=s(m(),1),cr={display:"flex",flexWrap:"wrap",gap:"2px 14px",padding:"2px 8px 6px",fontSize:11,color:"#333"},pr={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},dr=(0,je.observer)(function({bars:e,frame:n,ramp:o,rowGenes:a}){let r=(0,te.useId)().replace(/[^\w-]/g,""),p=(0,te.useMemo)(()=>we(e,n,{ramp:o,rowGenes:a,idPrefix:r}),[e,n,o,a,r]);return(0,C.jsx)(D,{el:p})}),ur=(0,je.observer)(function({model:e}){let n=e.walkStripRows,o=e.walkStripFrame,[a,r]=(0,te.useState)(void 0),[p,l]=(0,te.useState)(void 0);if(!n||!o)return null;let d=f=>{let c=f.currentTarget.getBoundingClientRect(),b=f.clientX-c.left,g=f.clientY-c.top;return{...pt(n,o,b,g),x:b,y:g}},u=ve(n,{ramp:e.referenceRampDomain,rampCss:re,genes:ft(o,e.walkRowGenes,e.walkRowGeneGaps)});return(0,C.jsxs)("div",{"data-testid":"graph-walk-strip",style:{position:"relative",borderTop:"1px solid #ddd"},onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{(0,Qn.isAlive)(e)&&(e.setPointerInPane(!1),e.setStripHover(null)),l(void 0)},children:[(0,C.jsxs)("svg",{width:o.width,height:o.height,style:{display:"block",cursor:"pointer"},onMouseMove:f=>{let c=d(f);c.row?(e.setStripHover({row:c.row.name,offset:c.offset}),l(o.labelled?void 0:{text:`${c.row.label} \xB7 ${lt(c.row,c.index===0?void 0:n.reference)}`,x:c.x,y:c.y})):(e.setStripHover(null),l(void 0))},onClick:f=>{let c=d(f);c.row&&c.index>0&&e.toggleWalk(c.row.name)},onContextMenu:f=>{let c=d(f);c.row&&(f.preventDefault(),r({row:c.index,top:f.clientY,left:f.clientX}))},children:[(0,C.jsx)(dr,{bars:n,frame:o,ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes}),(0,C.jsx)(D,{el:dt(n,o,e.walkStripMarks)}),(0,C.jsx)(D,{el:ut(n,o,new Set(e.walkLayers.map(f=>f.walk)))})]}),p?(0,C.jsx)("div",{style:{...pr,left:p.x+12,top:p.y-18},children:p.text}):null,(0,C.jsxs)("div",{style:cr,"data-testid":"graph-walk-strip-key",children:[u.map(f=>(0,C.jsxs)("div",{style:v,children:[(0,C.jsx)(Ze,{swatch:f.swatch}),(0,C.jsx)("span",{children:f.label})]},f.label)),(0,C.jsx)("div",{style:v,children:(0,C.jsx)("span",{children:"\u25AE ticks: where each walk passes the node under the pointer \xB7 click a bar to lift its walk"})})]}),a?(0,C.jsx)(Ge,{model:e,row:a.row,bars:n,top:a.top,left:a.left,onClose:()=>{r(void 0)}}):null]})}),eo=ur;var to=s(M(),1),he=s(m(),1),fr={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible",zIndex:4},hr=(0,to.observer)(function({model:e}){let n=e.walkStripLocator;return n?(0,he.jsxs)("svg",{style:fr,width:e.paneWidth,height:e.canvasHeight,"data-testid":"graph-walk-strip-locator",children:[(0,he.jsx)("circle",{cx:n.x,cy:n.y,r:11,fill:"none",stroke:"white",strokeWidth:4}),(0,he.jsx)("circle",{cx:n.x,cy:n.y,r:11,fill:"none",stroke:"#111",strokeWidth:1.75})]}):null}),no=hr;function oo(t){return Promise.resolve(new Se(t))}var i=s(m(),1),ro={position:"absolute",bottom:8,right:8,background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",zIndex:6},mr={position:"relative"},gr={position:"relative",lineHeight:0,isolation:"isolate"},br={position:"absolute",left:0,right:0,bottom:0,zIndex:0},yr={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},vr={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},wr=(0,N.observer)(function({model:e}){let n=e.drawnRowLabels;return(0,i.jsx)(i.Fragment,{children:n.map(({label:o,y:a})=>{let r=a*e.scaleY+e.translateY;return r>=0&&r<=e.canvasHeight?(0,i.jsx)("div",{"data-testid":"graph-row-label",style:{...vr,top:r},children:o},a):null})})}),kr={position:"absolute",top:ke,right:ke,display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4,pointerEvents:"none",zIndex:4},Sr={width:18,height:3,borderRadius:2},xr=(0,N.observer)(function({model:e}){let{pathLegend:n}=e;return n.length>0?(0,i.jsx)("div",{style:I,"data-testid":"graph-path-legend",children:n.map(({name:o,label:a,color:r})=>(0,i.jsxs)("div",{style:v,children:[(0,i.jsx)("div",{style:{...Sr,backgroundColor:r}}),(0,i.jsx)("span",{children:a})]},o))}):null}),Mr=(0,N.observer)(function({model:e}){let n=e.walkLift;return n?(0,i.jsxs)("div",{style:I,"data-testid":"graph-walk-readout",children:[n.walks.map(o=>(0,i.jsx)(de,{walk:o,label:e.walkLabel(o.name),reference:e.walkReference,at:e.hoveredOn(o)},o.name)),e.liftPaintsOffReference?(0,i.jsx)(so,{}):null,(0,i.jsxs)("div",{style:v,children:[(0,i.jsx)("div",{style:{...Q,background:ce}}),(0,i.jsxs)("span",{children:["not on ",e.liftedWalksLabel]})]})]}):null}),Rr={minWidth:90,height:8,borderRadius:2,background:re},Lr={display:"flex",justifyContent:"space-between",gap:8},Cr=(0,N.observer)(function({model:e}){let n=e.walkLift?void 0:e.referenceRampDomain,{offReference:o,unplaced:a}=e.referenceRampOffKeys,r=Math.round(n?.start??0),p=Math.round(n?.end??0);return n?(0,i.jsxs)("div",{style:I,"data-testid":"graph-ramp-legend",children:[(0,i.jsx)("div",{style:Rr}),(0,i.jsxs)("div",{style:Lr,children:[(0,i.jsx)("span",{children:r.toLocaleString()}),(0,i.jsxs)("span",{children:["(",be(p-r),")"]}),(0,i.jsx)("span",{children:p.toLocaleString()})]}),o?(0,i.jsx)(so,{}):null,a?(0,i.jsxs)("div",{style:v,children:[(0,i.jsx)("div",{style:{...Q,background:Pr}}),(0,i.jsx)("span",{children:"no reference position"})]}):null]}):null}),Pr="rgb(160, 160, 160)";function so(){return(0,i.jsxs)("div",{style:v,children:[(0,i.jsx)("div",{style:{...Q,background:nt}}),(0,i.jsx)("span",{children:"off the reference"})]})}var Er={...Q,border:`2px solid ${pe}`,borderRadius:5,boxSizing:"border-box"},Gr=(0,N.observer)(function({model:e}){return e.genePins.some(n=>n.exonsByNode.length>0)?(0,i.jsx)("div",{style:I,"data-testid":"graph-gene-legend",children:(0,i.jsxs)("div",{style:v,children:[(0,i.jsx)("div",{style:Er}),(0,i.jsx)("span",{children:"exon"})]})}):null}),io={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},Ir={...io,color:"#18181c",fontWeight:600},Tr={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible",zIndex:2},Hr=(0,N.observer)(function({model:e}){let n=(0,Ie.useRef)(null);return(0,Ie.useEffect)(()=>{let o=n.current;if(!o)return;let a=new ResizeObserver(()=>{(0,Ue.isAlive)(e)&&e.hoveredNode===null&&e.setLegendSize({width:o.offsetWidth,height:o.offsetHeight})});return a.observe(o),()=>{a.disconnect()}},[e]),(0,i.jsxs)("div",{ref:n,style:{...kr,top:ke+e.referenceStripZonePx},children:[(0,i.jsx)(Cr,{model:e}),(0,i.jsx)(Bn,{model:e}),(0,i.jsx)(zt,{model:e}),(0,i.jsx)(Gr,{model:e}),(0,i.jsx)(xr,{model:e}),(0,i.jsx)(Dn,{model:e}),(0,i.jsx)(qn,{model:e}),(0,i.jsx)(Mr,{model:e})]})}),Wr=(0,N.observer)(function({model:e}){let n=e.overlayLabels.sizes,o=n.flatMap(({key:a,leader:r})=>r?[{key:a,...r}]:[]);return(0,i.jsxs)(i.Fragment,{children:[o.length>0?(0,i.jsx)("svg",{style:Tr,width:e.paneWidth,height:e.canvasHeight,children:o.map(({key:a,arcX:r,arcY:p,labelX:l,labelY:d})=>(0,i.jsx)("line",{"data-testid":"graph-label-leader",x1:r,y1:p,x2:l,y2:d,stroke:"#18181c",strokeWidth:1},a))}):null,n.map(({key:a,text:r,x:p,y:l,kind:d})=>(0,i.jsx)("div",{"data-testid":"graph-size-label",style:{...d==="deletion"?Ir:io,left:p,top:l},children:r},a))]})}),Nr=(0,N.observer)(function({model:e}){let n=e.hoveredNode?e.nodeById?.get(e.hoveredNode):null,o=e.hoveredEdge!==null&&e.graph?e.graph.edges[e.hoveredEdge]:null,a=n?Gt(n):void 0,r=e.hoveredEdge===null?void 0:e.deletions.find(p=>p.edgeIndex===e.hoveredEdge);return(0,i.jsxs)(i.Fragment,{children:[n?(0,i.jsxs)("div",{style:ro,children:[(0,i.jsx)("strong",{children:n.name})," \u2014"," ",n.length.toLocaleString()," bp, depth"," ",n.depth.toFixed(1),a?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("br",{}),a.sample," ",xe(a)," (rank"," ",n.stable?.rank,")"]}):null]}):null,o?(0,i.jsx)("div",{style:ro,children:r?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("strong",{children:"Deletion"})," ",r.bp.toLocaleString()," bp",(0,i.jsx)("br",{}),r.refName,":",r.start.toLocaleString(),"-",r.end.toLocaleString()]}):(0,i.jsxs)(i.Fragment,{children:["Edge: ",o.from," \u2192 ",o.to]})}):null]})}),Br=(0,N.observer)(function({model:e,nodeId:n,top:o,left:a,onClose:r}){let{own:p,reference:l,highlight:d}=e.nodeLaunchTargets(n);return(0,i.jsx)(ne.Menu,{open:!0,anchorReference:"anchorPosition",anchorPosition:{top:o,left:a},onClose:()=>{r()},onMenuItemClick:u=>{u()},menuItems:[{label:"Node details",icon:_t,onClick:()=>{e.showNodeDetails(n)}},...It({own:p,reference:l,highlight:d,onShowLinear:u=>{e.showInLinearView(u)},onHighlight:e.canHighlightInLinearView?u=>{e.highlightInLinearView(u)}:void 0})]})}),_r=(0,N.observer)(function({model:e,ownChrome:n=!0}){let{canvasRef:o,canvas:a,error:r,retry:p}=(0,ao.useRenderingBackend)(oo,e),{handlers:l,contextNode:d,contextRow:u,closeContextMenu:f}=Xt(e);Me(a,e);let c=e.facetPanels!==void 0;return(0,i.jsxs)("div",{style:mr,children:[n?(0,i.jsx)(Rn,{model:e}):null,(0,i.jsxs)("div",{style:gr,onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{(0,Ue.isAlive)(e)&&e.setPointerInPane(!1)},children:[e.referenceStripShown?(0,i.jsx)("div",{style:{...br,top:e.referenceStripZonePx,background:e.paperCss}}):null,(0,i.jsx)("canvas",{ref:o,"data-testid":"graph-genome-canvas",style:{width:e.paneWidth,height:e.canvasHeight,cursor:e.isPanning||e.draggingNode?"grabbing":"grab",display:"block",position:"relative",zIndex:1},...l}),c?(0,i.jsx)($t,{model:e,handlers:l}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(An,{model:e}),(0,i.jsx)(Wn,{model:e}),(0,i.jsx)(wr,{model:e}),(0,i.jsx)(Wr,{model:e}),(0,i.jsx)(Ot,{model:e}),(0,i.jsx)(Zt,{model:e}),(0,i.jsx)(Gn,{model:e}),(0,i.jsx)(Jn,{model:e}),(0,i.jsx)(no,{model:e}),(0,i.jsx)(Hr,{model:e})]}),(0,i.jsx)(Fn,{model:e}),n?(0,i.jsx)("div",{style:yr,children:(0,i.jsx)(ne.LoadingOverlay,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null]}),e.walkStripShown?(0,i.jsx)(eo,{model:e}):null,(0,i.jsx)(Nr,{model:e}),d?(0,i.jsx)(Br,{model:e,nodeId:d.nodeId,top:d.top,left:d.left,onClose:f}):null,u?(0,i.jsx)(Ge,{model:e,row:u.row,top:u.top,left:u.left,onClose:f}):null,r?(0,i.jsx)(ne.ErrorBanner,{error:r,onReset:p}):null,n&&e.error?(0,i.jsx)(ne.ErrorBanner,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),ti=_r;export{ti as a};
3
+ //# sourceMappingURL=chunk-2V27PV25.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["global-externals:@jbrowse/render-core/useRenderingBackend", "../../src/GraphGenomeView/components/GraphCanvas.tsx", "../../node_modules/.pnpm/@mui+icons-material@9.4.0_@mui+material@9.4.0_@emotion+react@11.14.0_@types+react@19.3._3766ec55733e6b150ee672ad270cc236/node_modules/@mui/icons-material/Info.mjs", "../../src/GraphGenomeView/components/BubbleHalos.tsx", "../../src/GraphGenomeView/components/legendStyles.ts", "../../src/GraphGenomeView/components/FacetPanels.tsx", "../../src/GraphGenomeView/components/WalkKey.tsx", "../../src/GraphGenomeView/components/usePaneGestures.ts", "../../packages/core/src/util/wheelZoom.ts", "../../src/GraphGenomeView/components/GenePins.tsx", "../../src/GraphGenomeView/components/ElTree.tsx", "../../node_modules/.pnpm/@mui+icons-material@9.4.0_@mui+material@9.4.0_@emotion+react@11.14.0_@types+react@19.3._3766ec55733e6b150ee672ad270cc236/node_modules/@mui/icons-material/CropFree.mjs", "../../node_modules/.pnpm/@mui+icons-material@9.4.0_@mui+material@9.4.0_@emotion+react@11.14.0_@types+react@19.3._3766ec55733e6b150ee672ad270cc236/node_modules/@mui/icons-material/ZoomIn.mjs", "../../node_modules/.pnpm/@mui+icons-material@9.4.0_@mui+material@9.4.0_@emotion+react@11.14.0_@types+react@19.3._3766ec55733e6b150ee672ad270cc236/node_modules/@mui/icons-material/ZoomOut.mjs", "../../src/GraphGenomeView/components/GraphToolbar.tsx", "../../src/GraphGenomeView/components/ColorSchemeSelect.tsx", "../../src/GraphGenomeView/components/GraphStats.tsx", "../../src/GraphGenomeView/components/LayoutSelect.tsx", "../../src/GraphGenomeView/components/RepeatSelect.tsx", "../../src/GraphGenomeView/components/SettingsMenu.tsx", "../../node_modules/.pnpm/@mui+icons-material@9.4.0_@mui+material@9.4.0_@emotion+react@11.14.0_@types+react@19.3._3766ec55733e6b150ee672ad270cc236/node_modules/@mui/icons-material/Delete.mjs", "../../node_modules/.pnpm/@mui+icons-material@9.4.0_@mui+material@9.4.0_@emotion+react@11.14.0_@types+react@19.3._3766ec55733e6b150ee672ad270cc236/node_modules/@mui/icons-material/MoreVert.mjs", "../../src/GraphGenomeView/components/WalkSelect.tsx", "../../src/GraphGenomeView/components/LabelLayer.tsx", "../../src/GraphGenomeView/components/LabelChip.tsx", "../../src/GraphGenomeView/components/ReferenceStripOverlay.tsx", "../../src/GraphGenomeView/components/TubeMapOverlay.tsx", "../../src/GraphGenomeView/components/UnpopButton.tsx", "../../src/GraphGenomeView/components/WalkRowContextMenu.tsx", "../../src/GraphGenomeView/components/WalkRowsOverlay.tsx", "../../src/GraphGenomeView/components/WalkStrip.tsx", "../../src/GraphGenomeView/components/WalkStripLocator.tsx", "../../src/GraphGenomeView/renderer/GraphRenderer.ts"],
4
+ "sourcesContent": ["module.exports = JBrowseExports[\"@jbrowse/render-core/useRenderingBackend\"];", "import { useEffect, useRef } from 'react'\n\nimport { formatBp } from '@jbrowse/bandage-core/graphLabels'\nimport { LEGEND_INSET_PX } from '@jbrowse/bandage-core/labelLayout'\nimport { RAMP_GRADIENT_CSS } from '@jbrowse/bandage-core/referenceRampCss'\nimport {\n LIFT_BACKDROP_CSS,\n REFERENCE_RAMP_ALT_CSS,\n} from '@jbrowse/bandage-core/renderer/GeometryBuilder'\nimport { ErrorBanner, LoadingOverlay, Menu } from '@jbrowse/core/ui'\nimport { isAlive } from '@jbrowse/mobx-state-tree'\nimport { useRenderingBackend } from '@jbrowse/render-core/useRenderingBackend'\nimport InfoIcon from '@mui/icons-material/Info'\nimport { observer } from 'mobx-react'\n\nimport BubbleHalos, { HaloLegend } from './BubbleHalos'\nimport FacetPanels from './FacetPanels'\nimport GenePins, { EXON_COLOR } from './GenePins'\nimport GraphToolbar from './GraphToolbar'\nimport LabelLayer from './LabelLayer'\nimport ReferenceStripOverlay, {\n ReferenceStripLegend,\n} from './ReferenceStripOverlay'\nimport TubeMapOverlay, { TubeMapLegend } from './TubeMapOverlay'\nimport UnpopButton from './UnpopButton'\nimport WalkKey, { walkSwatchStyle } from './WalkKey'\nimport { WalkRowContextMenu } from './WalkRowContextMenu'\nimport WalkRowsOverlay, { WalkRowsLegend } from './WalkRowsOverlay'\nimport WalkStrip from './WalkStrip'\nimport WalkStripLocator from './WalkStripLocator'\nimport { legendBoxStyle, legendRowStyle } from './legendStyles'\nimport { usePaneGestures, useWheelZoom } from './usePaneGestures'\nimport { locLabel, nodeOwnLocation } from '../../launchFromGraph/contributors'\nimport { nodeLaunchMenuItems } from '../../launchFromGraph/graphMenuItems'\nimport { createGraphRenderer } from '../renderer/GraphRenderer'\n\nimport type { GraphPaneModel } from '../model'\n\n// Bottom RIGHT, not bottom left: the row labels of a row-structured layout are\n// pinned to the left edge, so a bottom-left tooltip lands on top of them and\n// covers the one thing that says which haplotype a row is. Nothing is drawn\n// against the right edge.\nconst tooltipStyle = {\n position: 'absolute' as const,\n bottom: 8,\n right: 8,\n background: 'rgba(0,0,0,0.75)',\n color: 'white',\n padding: '4px 8px',\n borderRadius: 4,\n fontSize: 12,\n pointerEvents: 'none' as const,\n zIndex: 6,\n}\n\nconst wrapperStyle = { position: 'relative' as const }\n\n// The overlay origin has to be the canvas, not the wrapper: the wrapper also\n// holds the toolbar, so anything positioned against it is offset by the\n// toolbar's height, and a row label lands a whole row off the row it names.\nconst canvasAreaStyle = {\n position: 'relative' as const,\n lineHeight: 0,\n isolation: 'isolate' as const,\n}\n\n// Under a transparent canvas, from below the reference strip down, so the\n// linear view's gridlines show only behind the strip\nconst paperStyle = {\n position: 'absolute' as const,\n left: 0,\n right: 0,\n bottom: 0,\n zIndex: 0,\n}\n\n// Above the labels, pins and legends drawn over the canvas, and with the line\n// height the canvas area zeroes, which would collapse the overlay's label\nconst loadingLayerStyle = {\n position: 'absolute' as const,\n inset: 0,\n zIndex: 10,\n lineHeight: 'normal',\n pointerEvents: 'none' as const,\n}\n\nconst rowLabelStyle = {\n position: 'absolute' as const,\n left: 6,\n transform: 'translateY(-50%)',\n background: 'rgba(255,255,255,0.82)',\n padding: '0 4px',\n borderRadius: 3,\n fontSize: 11,\n // explicit, because the canvas container zeroes line-height to kill the\n // inline-block gap under the canvas. Inherited, that collapses the label to a\n // zero-height box: it still paints, but it has no layout, so anything asking\n // whether it is visible (a screenshot spec's waitForVisible, a11y tooling)\n // is told no.\n lineHeight: '16px',\n whiteSpace: 'nowrap' as const,\n pointerEvents: 'none' as const,\n zIndex: 4,\n}\n\n// Names the rows of a row-structured layout (anchored, sample rows). Without\n// them the layout draws real structure that cannot be read: a stack of bars\n// where every row means something and nothing says what.\n//\n// Positioned from the layout's own `rowLabels` through the same transform the\n// canvas draws with, so a label tracks its row across pan and zoom instead of\n// sitting at a measured pixel. It therefore has to be mounted in the canvas's\n// own positioning context (canvasAreaStyle) \u2014 against the wrapper it picks up\n// the toolbar's height and names the wrong row. Pinned to the left edge rather\n// than to the row's own x, because a row's leftmost node is wherever its first\n// allele happens to branch. Rows scrolled out of the canvas are dropped rather\n// than clamped to the edge, so a label never points at a row that is not\n// there.\nconst RowLabels = observer(function RowLabels({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const rowLabels = model.drawnRowLabels\n return (\n <>\n {rowLabels.map(({ label, y }) => {\n const screenY = y * model.scaleY + model.translateY\n return screenY >= 0 && screenY <= model.canvasHeight ? (\n // Keyed on the row, not on the label: two rows can carry the same\n // words. The sample-row layout names row 0 for the assembly the\n // backbone comes from and the rows below it for the samples\n // contributing alleles, and a diploid reference is in both lists \u2014\n // one haplotype is the reference path, the other walks alleles of its\n // own, and `parsePanSN` reduces both to one sample name.\n <div\n key={y}\n data-testid=\"graph-row-label\"\n style={{ ...rowLabelStyle, top: screenY }}\n >\n {label}\n </div>\n ) : null\n })}\n </>\n )\n})\n\n// Top RIGHT: the row labels own the left edge and the hover tooltip owns the\n// bottom right, so this is the one corner nothing else claims. A row-structured\n// layout draws its band across the middle, which is what the keys are for. The\n// two keys stack rather than each claiming the corner, since a path-coloured\n// graph can also be reference-position coloured.\nconst legendStackStyle = {\n position: 'absolute' as const,\n top: LEGEND_INSET_PX,\n right: LEGEND_INSET_PX,\n display: 'flex',\n flexDirection: 'column' as const,\n alignItems: 'flex-end',\n gap: 4,\n pointerEvents: 'none' as const,\n zIndex: 4,\n}\n\nconst pathSwatchStyle = { width: 18, height: 3, borderRadius: 2 }\n\n// Which haplotype each ribbon colour is. The ribbons are one stroke per path\n// fanned across every edge the path crosses, so without this the drawing states\n// that the alleles are taken by *different* samples and never which.\nconst PathLegend = observer(function PathLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { pathLegend } = model\n return pathLegend.length > 0 ? (\n <div style={legendBoxStyle} data-testid=\"graph-path-legend\">\n {pathLegend.map(({ name, label, color }) => (\n <div key={name} style={legendRowStyle}>\n <div style={{ ...pathSwatchStyle, backgroundColor: color }} />\n <span>{label}</span>\n </div>\n ))}\n </div>\n ) : null\n})\n\n// Each lifted walk's key, then what the faded rest is\nconst WalkReadout = observer(function WalkReadout({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const lift = model.walkLift\n if (!lift) {\n return null\n }\n return (\n <div style={legendBoxStyle} data-testid=\"graph-walk-readout\">\n {lift.walks.map(w => (\n <WalkKey\n key={w.name}\n walk={w}\n label={model.walkLabel(w.name)}\n reference={model.walkReference}\n at={model.hoveredOn(w)}\n />\n ))}\n {/* the ramp's own key, which names this, is off while walks are lifted */}\n {model.liftPaintsOffReference ? <OffReferenceRow /> : null}\n <div style={legendRowStyle}>\n <div style={{ ...walkSwatchStyle, background: LIFT_BACKDROP_CSS }} />\n <span>not on {model.liftedWalksLabel}</span>\n </div>\n </div>\n )\n})\n\n// The reference-position ramp, as a strip labelled with the interval it runs\n// over. Nothing on screen used to say that red-to-magenta means left-to-right of\n// the cut window, so two tutorials carried that sentence in prose and a reader\n// arriving at a figure had no way to know it at all.\nconst rampStripStyle = {\n minWidth: 90,\n height: 8,\n borderRadius: 2,\n background: RAMP_GRADIENT_CSS,\n}\n\nconst rampEndsStyle = {\n display: 'flex',\n justifyContent: 'space-between',\n gap: 8,\n}\n\nconst ReferenceRampLegend = observer(function ReferenceRampLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n // under lifted walks each lane states its own scale, and the rest is grey\n const domain = model.walkLift ? undefined : model.referenceRampDomain\n const { offReference, unplaced } = model.referenceRampOffKeys\n // a measured domain runs between node midpoints, which can fall on a half bp\n const start = Math.round(domain?.start ?? 0)\n const end = Math.round(domain?.end ?? 0)\n return domain ? (\n <div style={legendBoxStyle} data-testid=\"graph-ramp-legend\">\n <div style={rampStripStyle} />\n <div style={rampEndsStyle}>\n <span>{start.toLocaleString()}</span>\n <span>({formatBp(end - start)})</span>\n <span>{end.toLocaleString()}</span>\n </div>\n {offReference ? <OffReferenceRow /> : null}\n {unplaced ? (\n <div style={legendRowStyle}>\n <div style={{ ...walkSwatchStyle, background: UNPLACED_SWATCH }} />\n <span>no reference position</span>\n </div>\n ) : null}\n </div>\n ) : null\n})\n\n// getNodeColor's grey for a node the ramp cannot place\nconst UNPLACED_SWATCH = 'rgb(160, 160, 160)'\n\n// The charcoal both the ramp and a lane coloured by reference position give\n// sequence the reference does not carry\nfunction OffReferenceRow() {\n return (\n <div style={legendRowStyle}>\n <div style={{ ...walkSwatchStyle, background: REFERENCE_RAMP_ALT_CSS }} />\n <span>off the reference</span>\n </div>\n )\n}\n\nconst exonSwatchStyle = {\n ...walkSwatchStyle,\n border: `2px solid ${EXON_COLOR}`,\n borderRadius: 5,\n boxSizing: 'border-box' as const,\n}\n\nconst GeneLegend = observer(function GeneLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n return model.genePins.some(pin => pin.exonsByNode.length > 0) ? (\n <div style={legendBoxStyle} data-testid=\"graph-gene-legend\">\n <div style={legendRowStyle}>\n <div style={exonSwatchStyle} />\n <span>exon</span>\n </div>\n </div>\n ) : null\n})\n\nconst nodeLabelStyle = {\n position: 'absolute' as const,\n transform: 'translate(-50%, -50%)',\n background: 'rgba(255,255,255,0.78)',\n padding: '0 3px',\n borderRadius: 3,\n fontSize: 10,\n lineHeight: '13px',\n whiteSpace: 'nowrap' as const,\n pointerEvents: 'none' as const,\n zIndex: 3,\n}\n\n// Matches EDGE_DELETION_COLOR, so the words and the arc they name are one thing.\nconst deletionLabelStyle = {\n ...nodeLabelStyle,\n color: '#18181c',\n fontWeight: 600,\n}\n\n// Under the labels (z 3) and over the canvas, so a leader runs beneath the text\n// it points from rather than across it. `overflow: visible` because a label\n// displaced past the canvas edge is culled by the placement, not clipped here.\nconst leaderStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'visible' as const,\n zIndex: 2,\n}\n\n// Measures itself for the model, so no label is placed under a legend and\n// none gives way to one that is not drawn.\n//\n// At rest only: the walk keys' hover readout would otherwise refit the view,\n// and the refit clears the hover that grew it\nconst Legends = observer(function Legends({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const ref = useRef<HTMLDivElement>(null)\n useEffect(() => {\n const el = ref.current\n if (!el) {\n return\n }\n // the last callback can land after the track is closed\n const observer = new ResizeObserver(() => {\n if (isAlive(model) && model.hoveredNode === null) {\n model.setLegendSize({ width: el.offsetWidth, height: el.offsetHeight })\n }\n })\n observer.observe(el)\n return () => {\n observer.disconnect()\n }\n }, [model])\n return (\n <div\n ref={ref}\n style={{\n ...legendStackStyle,\n top: LEGEND_INSET_PX + model.referenceStripZonePx,\n }}\n >\n <ReferenceRampLegend model={model} />\n <ReferenceStripLegend model={model} />\n <HaloLegend model={model} />\n <GeneLegend model={model} />\n <PathLegend model={model} />\n <TubeMapLegend model={model} />\n <WalkRowsLegend model={model} />\n <WalkReadout model={model} />\n </div>\n )\n})\n\n// Writes each drawn thing's size onto it, which is what Bandage's Length label\n// does and what the tooltip alone could not: a graph you have to hover to read\n// is a graph nobody reads. graphLabels applies the same transform the canvas\n// draws with \u2014 so a label tracks its node across pan and zoom \u2014 and decides\n// which labels fit; this only paints them, mounted in the canvas's own\n// positioning context for the reason RowLabels is.\nconst GraphSizeLabels = observer(function GraphSizeLabels({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const labels = model.overlayLabels.sizes\n // A label too wide for the arc it names is placed clear of it and tethered\n // back; nothing else in the drawing carries one.\n const leaders = labels.flatMap(({ key, leader }) =>\n leader ? [{ key, ...leader }] : [],\n )\n return (\n <>\n {leaders.length > 0 ? (\n <svg\n style={leaderStyle}\n width={model.paneWidth}\n height={model.canvasHeight}\n >\n {leaders.map(({ key, arcX, arcY, labelX, labelY }) => (\n <line\n key={key}\n data-testid=\"graph-label-leader\"\n x1={arcX}\n y1={arcY}\n x2={labelX}\n y2={labelY}\n stroke=\"#18181c\"\n strokeWidth={1}\n />\n ))}\n </svg>\n ) : null}\n {labels.map(({ key, text, x, y, kind }) => (\n <div\n key={key}\n data-testid=\"graph-size-label\"\n style={{\n ...(kind === 'deletion' ? deletionLabelStyle : nodeLabelStyle),\n left: x,\n top: y,\n }}\n >\n {text}\n </div>\n ))}\n </>\n )\n})\n\nconst HoverTooltips = observer(function HoverTooltips({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const hoveredNodeData = model.hoveredNode\n ? model.nodeById?.get(model.hoveredNode)\n : null\n\n const hoveredEdgeData =\n model.hoveredEdge !== null && model.graph\n ? model.graph.edges[model.hoveredEdge]\n : null\n\n const ownLocation = hoveredNodeData\n ? nodeOwnLocation(hoveredNodeData)\n : undefined\n\n const hoveredDeletion =\n model.hoveredEdge === null\n ? undefined\n : model.deletions.find(d => d.edgeIndex === model.hoveredEdge)\n\n return (\n <>\n {hoveredNodeData ? (\n <div style={tooltipStyle}>\n <strong>{hoveredNodeData.name}</strong> \u2014{' '}\n {hoveredNodeData.length.toLocaleString()} bp, depth{' '}\n {hoveredNodeData.depth.toFixed(1)}\n {/* Which assembly contributed this segment, and where it sits on it.\n rGFA states both, and until now neither reached the screen: the\n node was a bare id in a picture. */}\n {ownLocation ? (\n <>\n <br />\n {ownLocation.sample} {locLabel(ownLocation)} (rank{' '}\n {hoveredNodeData.stable?.rank})\n </>\n ) : null}\n </div>\n ) : null}\n {hoveredEdgeData ? (\n <div style={tooltipStyle}>\n {/* A deletion edge is the one link that means something on its own \u2014\n the backbone it skips is sequence some haplotype does not carry \u2014\n so it says how much rather than just naming its endpoints. */}\n {hoveredDeletion ? (\n <>\n <strong>Deletion</strong> {hoveredDeletion.bp.toLocaleString()} bp\n <br />\n {hoveredDeletion.refName}:{hoveredDeletion.start.toLocaleString()}\n -{hoveredDeletion.end.toLocaleString()}\n </>\n ) : (\n <>\n Edge: {hoveredEdgeData.from} \u2192 {hoveredEdgeData.to}\n </>\n )}\n </div>\n ) : null}\n </>\n )\n})\n\n// Flat rather than under a \"Launch view\" submenu: this menu is two or three\n// items long and every one of them is contextual to the node just clicked. The\n// submenu grouping earns its keep in the long view and track menus.\nconst NodeContextMenu = observer(function NodeContextMenu({\n model,\n nodeId,\n top,\n left,\n onClose,\n}: {\n model: GraphPaneModel\n nodeId: string\n top: number\n left: number\n onClose: () => void\n}) {\n const { own, reference, highlight } = model.nodeLaunchTargets(nodeId)\n return (\n <Menu\n open\n anchorReference=\"anchorPosition\"\n anchorPosition={{ top, left }}\n onClose={() => {\n onClose()\n }}\n onMenuItemClick={callback => {\n callback()\n }}\n menuItems={[\n {\n label: 'Node details',\n icon: InfoIcon,\n onClick: () => {\n model.showNodeDetails(nodeId)\n },\n },\n ...nodeLaunchMenuItems({\n own,\n reference,\n highlight,\n onShowLinear: target => {\n model.showInLinearView(target)\n },\n onHighlight: model.canHighlightInLinearView\n ? target => {\n model.highlightInLinearView(target)\n }\n : undefined,\n }),\n ]}\n />\n )\n})\n\n// `ownChrome` false for a pane inside a track, whose controls, loading state\n// and errors are the track's. A hosted pane whose x the host places takes no pan or wheel of its\n// own: those are the linear view's, as on any other track. One drawing its\n// own coordinates inside a track keeps them, and keeps them from the view.\nconst GraphCanvas = observer(function GraphCanvas({\n model,\n ownChrome = true,\n}: {\n model: GraphPaneModel\n ownChrome?: boolean\n}) {\n const {\n canvasRef,\n canvas,\n error: renderError,\n retry: retryRender,\n } = useRenderingBackend(createGraphRenderer, model)\n const { handlers, contextNode, contextRow, closeContextMenu } =\n usePaneGestures(model)\n useWheelZoom(canvas, model)\n const faceted = model.facetPanels !== undefined\n\n return (\n <div style={wrapperStyle}>\n {ownChrome ? <GraphToolbar model={model} /> : null}\n\n <div\n style={canvasAreaStyle}\n onMouseEnter={() => {\n model.setPointerInPane(true)\n }}\n onMouseLeave={() => {\n if (isAlive(model)) {\n model.setPointerInPane(false)\n }\n }}\n >\n {model.referenceStripShown ? (\n <div\n style={{\n ...paperStyle,\n top: model.referenceStripZonePx,\n background: model.paperCss,\n }}\n />\n ) : null}\n <canvas\n ref={canvasRef}\n data-testid=\"graph-genome-canvas\"\n style={{\n width: model.paneWidth,\n height: model.canvasHeight,\n cursor: model.isPanning || model.draggingNode ? 'grabbing' : 'grab',\n display: 'block',\n position: 'relative',\n zIndex: 1,\n }}\n {...handlers}\n />\n\n {faceted ? (\n <FacetPanels model={model} handlers={handlers} />\n ) : (\n <>\n <TubeMapOverlay model={model} />\n <ReferenceStripOverlay model={model} />\n <RowLabels model={model} />\n <GraphSizeLabels model={model} />\n <BubbleHalos model={model} />\n <GenePins model={model} />\n <LabelLayer model={model} />\n <WalkRowsOverlay model={model} />\n <WalkStripLocator model={model} />\n <Legends model={model} />\n </>\n )}\n <UnpopButton model={model} />\n\n {ownChrome ? (\n <div style={loadingLayerStyle}>\n <LoadingOverlay\n isVisible={model.isLoading}\n immediate={!model.layoutResult}\n statusMessage={model.statusMessage}\n onCancel={\n model.canCancelLoad\n ? () => {\n model.cancelLoad()\n }\n : undefined\n }\n />\n </div>\n ) : null}\n </div>\n\n {model.walkStripShown ? <WalkStrip model={model} /> : null}\n\n <HoverTooltips model={model} />\n\n {contextNode ? (\n <NodeContextMenu\n model={model}\n nodeId={contextNode.nodeId}\n top={contextNode.top}\n left={contextNode.left}\n onClose={closeContextMenu}\n />\n ) : null}\n\n {contextRow ? (\n <WalkRowContextMenu\n model={model}\n row={contextRow.row}\n top={contextRow.top}\n left={contextRow.left}\n onClose={closeContextMenu}\n />\n ) : null}\n\n {renderError ? (\n <ErrorBanner error={renderError} onReset={retryRender} />\n ) : null}\n\n {ownChrome && model.error ? (\n <ErrorBanner\n error={model.error}\n onReset={\n model.canRetryLoad\n ? () => {\n model.retryLoad()\n }\n : undefined\n }\n />\n ) : null}\n </div>\n )\n})\n\nexport default GraphCanvas\n", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n 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\"\n}), 'Info');", "import { sameBubble } from '@jbrowse/bandage-core/bubbles/bubbleLine'\nimport {\n BUBBLE_KIND_COLORS,\n BUBBLE_KIND_NAMES,\n} from '@jbrowse/bandage-core/bubbles/classifyBubble'\nimport { HALO_FACTOR } from '@jbrowse/bandage-core/labelLayout'\nimport { observer } from 'mobx-react'\n\nimport { legendBoxStyle, legendRowStyle } from './legendStyles'\n\nimport type { GraphPaneModel } from '../model'\nimport type { BubbleHalo } from '@jbrowse/bandage-core/bubbles/bubbleHalos'\n\n// The bubbles over a node drawing: each a translucent halo along its nodes,\n// drawn once in layout units and moved with the canvas by one transform. The\n// halo takes no pointer events, so the nodes under it still hover and drag;\n// its name and its routes' chips are LabelLayer's.\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'hidden' as const,\n zIndex: 2,\n}\n\nconst BubbleHalos = observer(function BubbleHalos({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { bubbleHalos, walkLift, hoveredBubble } = model\n if (bubbleHalos.length === 0) {\n return null\n }\n const {\n scaleX,\n scaleY,\n translateX,\n translateY,\n paneWidth: width,\n canvasHeight,\n } = model\n const halo = model.contigThickness * HALO_FACTOR\n // lifted walks dim the bubbles none of them enters\n const dimmedBubble = (h: BubbleHalo) =>\n walkLift !== undefined && !h.nodeIds.some(id => walkLift.nodeIds.has(id))\n\n return (\n <svg\n style={svgStyle}\n width={width}\n height={canvasHeight}\n data-testid=\"graph-bubble-halos\"\n >\n <g\n transform={`translate(${translateX} ${translateY}) scale(${scaleX} ${scaleY})`}\n >\n {bubbleHalos\n .filter(h => !h.whole)\n .map(h => (\n <path\n key={`${h.bubble.start}-${h.bubble.end}`}\n d={h.path}\n fill=\"none\"\n stroke={BUBBLE_KIND_COLORS[h.kind]}\n strokeOpacity={\n hoveredBubble && sameBubble(h.bubble, hoveredBubble)\n ? 0.45\n : dimmedBubble(h)\n ? 0.06\n : 0.22\n }\n strokeWidth={halo}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n vectorEffect=\"non-scaling-stroke\"\n />\n ))}\n </g>\n </svg>\n )\n})\n\nexport default BubbleHalos\n\nfunction HaloSwatch({ color }: { color: string }) {\n return (\n <svg width={18} height={10} style={{ flex: 'none' }}>\n <line\n x1={5}\n y1={5}\n x2={13}\n y2={5}\n stroke={color}\n strokeOpacity={0.35}\n strokeWidth={8}\n strokeLinecap=\"round\"\n />\n </svg>\n )\n}\n\n// One row per halo colour on screen, naming the kinds it stands for\nexport const HaloLegend = observer(function HaloLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const kindsByColor = new Map<string, Set<string>>()\n for (const h of model.bubbleHalos) {\n if (!h.whole) {\n const color = BUBBLE_KIND_COLORS[h.kind]\n const kinds = kindsByColor.get(color) ?? new Set<string>()\n kinds.add(BUBBLE_KIND_NAMES[h.kind])\n kindsByColor.set(color, kinds)\n }\n }\n return kindsByColor.size > 0 ? (\n <div style={legendBoxStyle} data-testid=\"graph-halo-legend\">\n {[...kindsByColor].map(([color, kinds]) => (\n <div key={color} style={legendRowStyle}>\n <HaloSwatch color={color} />\n <span>bubble: {[...kinds].join(', ')}</span>\n </div>\n ))}\n </div>\n ) : null\n})\n", "// A key's box over the drawing, and one row in it: a swatch beside its words\nexport const legendBoxStyle = {\n background: 'rgba(255,255,255,0.82)',\n padding: '4px 6px',\n borderRadius: 3,\n fontSize: 11,\n lineHeight: '15px',\n whiteSpace: 'nowrap' as const,\n}\n\nexport const legendRowStyle = { display: 'flex', alignItems: 'center', gap: 5 }\n", "import { useEffect, useState } from 'react'\n\nimport { FACET_GAP_PX, FACET_TITLE_PX } from '@jbrowse/bandage-core/facetGrid'\nimport { Canvas2DRenderer } from '@jbrowse/bandage-core/renderer/Canvas2DRenderer'\nimport { autorun, computed } from 'mobx'\nimport { observer } from 'mobx-react'\n\nimport WalkKey from './WalkKey'\nimport { useWheelZoom } from './usePaneGestures'\n\nimport type { PaneHandlers } from './usePaneGestures'\nimport type { GraphPaneModel } from '../model'\nimport type { WalkLift } from '@jbrowse/bandage-core/walkHighlight'\n\n// The pane faceted by walk: the same layout drawn once per lifted walk, each\n// panel with that walk alone shading along itself, so walks compare by where\n// they go rather than by which lane is which colour. The panels share the\n// pane's transform, so a pan, zoom or hover in one is in all of them.\n\nconst gridStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n zIndex: 4,\n display: 'grid',\n gap: FACET_GAP_PX,\n lineHeight: 'normal',\n}\n\nconst titleStyle = {\n height: FACET_TITLE_PX,\n padding: '2px 6px',\n boxSizing: 'border-box' as const,\n fontFamily: 'inherit',\n fontSize: 11,\n color: 'inherit',\n cursor: 'pointer',\n border: 'none',\n background: 'none',\n textAlign: 'left' as const,\n display: 'block',\n}\n\nconst FacetPanel = observer(function FacetPanel({\n model,\n lift,\n width,\n height,\n cell,\n handlers,\n}: {\n model: GraphPaneModel\n lift: WalkLift\n width: number\n height: number\n cell: { gridRow: number; gridColumn: number }\n handlers: PaneHandlers\n}) {\n const [canvas, setCanvas] = useState<HTMLCanvasElement | null>(null)\n const walk = lift.walks[0]!\n useWheelZoom(canvas, model)\n\n useEffect(() => {\n if (!canvas) {\n return undefined\n }\n const renderer = new Canvas2DRenderer(canvas)\n renderer.resize(width, height)\n const drawing = computed(() => model.buildDrawing(lift, false))\n let uploaded: ReturnType<typeof model.buildDrawing>\n const dispose = autorun(() => {\n const built = drawing.get()\n if (!built) {\n return\n }\n if (built !== uploaded) {\n renderer.uploadGeometry(built.batch)\n uploaded = built\n }\n model.applyHighlights(renderer)\n model.paint(renderer)\n })\n return () => {\n dispose()\n renderer.dispose()\n }\n }, [canvas, model, lift, width, height])\n\n const label = model.walkLabel(walk.name)\n return (\n <div style={cell}>\n <button\n type=\"button\"\n style={titleStyle}\n data-testid=\"graph-facet-title\"\n onClick={() => {\n model.liftWalks([walk.name])\n model.setFacet('')\n }}\n >\n <WalkKey\n walk={walk}\n label={label}\n reference={model.walkReference}\n hint={`click to lift ${label} alone`}\n at={model.hoveredOn(walk)}\n />\n </button>\n <canvas\n ref={setCanvas}\n data-testid=\"graph-facet-canvas\"\n style={{\n width,\n height,\n display: 'block',\n cursor: model.isPanning || model.draggingNode ? 'grabbing' : 'grab',\n }}\n {...handlers}\n />\n </div>\n )\n})\n\nconst FacetPanels = observer(function FacetPanels({\n model,\n handlers,\n}: {\n model: GraphPaneModel\n handlers: PaneHandlers\n}) {\n const panels = model.facetPanels\n const grid = model.facetGrid\n const place = model.facetPlacement\n if (!panels || !grid || !place) {\n return null\n }\n const { columns, width, height } = grid\n return (\n <div\n data-testid=\"graph-facet-panels\"\n style={{\n ...gridStyle,\n width: model.paneWidth,\n minHeight: model.canvasHeight,\n gridTemplateColumns: `repeat(${columns}, ${width}px)`,\n background: model.darkMode ? '#1f1f1f' : 'white',\n }}\n >\n {panels.map((lift, i) => (\n <FacetPanel\n key={lift.walks[0]!.name}\n model={model}\n lift={lift}\n width={width}\n height={height}\n cell={{\n gridRow: Math.floor(place.cells[i]! / columns) + 1,\n gridColumn: (place.cells[i]! % columns) + 1,\n }}\n handlers={handlers}\n />\n ))}\n </div>\n )\n})\n\nexport default FacetPanels\n", "import { encodingSwatchCss } from '@jbrowse/bandage-core/walkEncoding'\nimport { walkKey } from '@jbrowse/bandage-core/walkKey'\n\nimport { legendRowStyle } from './legendStyles'\n\nimport type { LiftedWalk } from '@jbrowse/bandage-core/walkHighlight'\n\nexport const walkSwatchStyle = {\n width: 18,\n height: 8,\n borderRadius: 2,\n flex: 'none',\n}\nconst walkBlockStyle = { marginBottom: 2 }\nconst walkBarStyle = { ...walkSwatchStyle, width: 48 }\n\n// One walk's key: a swatch, or a short bar of the scale its lane shades by,\n// then its name; see walkKey for the words. `at`, where the hovered node sits\n// on the walk, stands in for the scale's stretch while there is one.\nexport default function WalkKey({\n walk,\n label,\n reference,\n hint,\n at,\n}: {\n walk: LiftedWalk\n label: string\n reference?: { name?: string; start: number; end: number }\n hint?: string\n at?: string\n}) {\n const key = walkKey(walk, reference)\n return (\n <div\n style={walkBlockStyle}\n title={[key.hover, hint].filter(Boolean).join(' \u00B7 ') || undefined}\n >\n <div style={legendRowStyle}>\n <div\n style={{\n ...(key.shades ? walkBarStyle : walkSwatchStyle),\n background: encodingSwatchCss(walk.encoding),\n }}\n />\n <span>\n <strong>{label}</strong>\n {key.delta}\n {key.outside}\n {key.reversed}\n </span>\n </div>\n {at ? (\n <div data-testid=\"graph-walk-at\">{at}</div>\n ) : key.scale ? (\n <div>{key.scale}</div>\n ) : null}\n </div>\n )\n}\n", "import { useEffect, useRef, useState } from 'react'\n\nimport {\n findHoveredEdge,\n findHoveredNode,\n} from '@jbrowse/bandage-core/util/hitDetection'\nimport { wheelZoomFactor } from '@jbrowse/bandage-core/util/wheelZoom'\nimport { isAlive } from '@jbrowse/mobx-state-tree'\n\nimport type { GraphPaneModel } from '../model'\n\n// wheel events need passive:false to call preventDefault \u2014 React registers\n// wheel listeners as passive, so we must add this imperatively\nexport function useWheelZoom(\n canvas: HTMLCanvasElement | null | undefined,\n model: GraphPaneModel,\n) {\n useEffect(() => {\n if (!canvas) {\n return undefined\n }\n const c = canvas\n function handleWheel(e: WheelEvent) {\n if (model.hostPlacesX) {\n return\n }\n if (model.host) {\n e.stopPropagation()\n }\n e.preventDefault()\n const rect = c.getBoundingClientRect()\n model.zoom(\n wheelZoomFactor(e),\n e.clientX - rect.left,\n e.clientY - rect.top,\n )\n }\n c.addEventListener('wheel', handleWheel, { passive: false })\n return () => {\n c.removeEventListener('wheel', handleWheel)\n }\n }, [canvas, model])\n}\n\n// The pointer on a canvas drawing the pane's transform: the pane's own, or any\n// facet panel, since the panels share it. Coordinates are read against the\n// canvas the event is on.\nexport function usePaneGestures(model: GraphPaneModel) {\n // Where the pointer was last, and whether it has travelled since mousedown \u2014\n // per-gesture scratch that nothing renders from, which is what a ref is for.\n // Whether a drag is in progress is model state (`isPanning`/`draggingNode`),\n // because the cursor renders from it.\n const lastMouseRef = useRef({ x: 0, y: 0 })\n const hasMovedRef = useRef(false)\n // A pan and a hover are applied once per frame, not once per mousemove:\n // mousemove fires in bursts well above the frame rate, and each pan step\n // repainted the canvas and re-placed every overlay label, while each hover\n // step ran both hit indexes. The pending pan is the summed delta; the pending\n // hover is the last pointer position, since only the last one can be right.\n const pendingRef = useRef<{\n frame: number\n pan: { dx: number; dy: number } | null\n hover: { x: number; y: number } | null\n }>({ frame: 0, pan: null, hover: null })\n useEffect(\n () => () => {\n cancelAnimationFrame(pendingRef.current.frame)\n },\n [],\n )\n const [contextNode, setContextNode] = useState<\n { nodeId: string; top: number; left: number } | undefined\n >(undefined)\n const [contextRow, setContextRow] = useState<\n { row: number; top: number; left: number } | undefined\n >(undefined)\n\n function screenToGraph(screenX: number, screenY: number) {\n return {\n x: (screenX - model.translateX) / model.scaleX,\n y: (screenY - model.translateY) / model.scaleY,\n }\n }\n\n function getMouseCoord(e: React.MouseEvent) {\n const rect = (e.currentTarget as HTMLCanvasElement).getBoundingClientRect()\n return screenToGraph(e.clientX - rect.left, e.clientY - rect.top)\n }\n\n // The node at a graph coordinate, which mousedown, mousemove and click all\n // need. Takes the coordinate rather than the event so a caller that already\n // has one does not pay for a second getBoundingClientRect.\n function nodeAt(x: number, y: number) {\n const { nodePositions } = model\n const sx = x * model.scaleX + model.translateX\n const sy = y * model.scaleY + model.translateY\n if (model.layoutResult?.tubeMap) {\n return model.tubeMapNodeAt(sx, sy)\n }\n const onStrip = model.referenceStripNodeAt(sx, sy)\n if (onStrip) {\n return onStrip\n }\n return nodePositions\n ? findHoveredNode(\n nodePositions,\n x,\n y,\n model.axisScale,\n model.positionsVersion,\n model.nodeInk,\n )\n : null\n }\n\n function onMouseDown(e: React.MouseEvent) {\n if (e.button === 0) {\n hasMovedRef.current = false\n if (model.hostPlacesX) {\n return\n }\n if (model.host) {\n e.stopPropagation()\n }\n const { x, y } = getMouseCoord(e)\n // a tube map's boxes are the layout's, and the strip's are bp, not\n // positions to drag\n const node =\n model.layoutResult?.tubeMap ||\n e.nativeEvent.offsetY < model.referenceStripZonePx\n ? null\n : nodeAt(x, y)\n if (node) {\n model.setDraggingNode(node)\n } else {\n model.setPanning(true)\n }\n lastMouseRef.current = { x: e.clientX, y: e.clientY }\n }\n }\n\n function applyPending() {\n const pending = pendingRef.current\n pending.frame = 0\n if (pending.pan) {\n model.setTransform(\n model.scale,\n model.translateX + pending.pan.dx,\n model.translateY + pending.pan.dy,\n )\n pending.pan = null\n }\n if (pending.hover && model.nodePositions && model.graph) {\n const { x, y } = screenToGraph(pending.hover.x, pending.hover.y)\n pending.hover = null\n const node = nodeAt(x, y)\n model.setHoveredNode(node)\n model.setHoveredEdge(\n node || model.layoutResult?.tubeMap\n ? null\n : findHoveredEdge(\n model.nodePositions,\n model.graph,\n x,\n y,\n model.axisScale,\n // resolved, so the hit index bounds the ribbons that are\n // actually drawn \u2014 see effectiveDrawPaths. Facet panels draw\n // none.\n model.effectiveDrawPaths && !model.facetPanels,\n model.positionsVersion,\n model.deletionEdgeIndexes,\n model.hiddenEdgeIndexes,\n model.deletionRoutes,\n model.layoutResult?.stranded,\n ),\n )\n }\n }\n\n function scheduleFrame() {\n if (!pendingRef.current.frame) {\n pendingRef.current.frame = requestAnimationFrame(applyPending)\n }\n }\n\n function dropPending() {\n const pending = pendingRef.current\n cancelAnimationFrame(pending.frame)\n pending.frame = 0\n pending.pan = null\n pending.hover = null\n }\n\n function onMouseMove(e: React.MouseEvent) {\n const dx = e.clientX - lastMouseRef.current.x\n const dy = e.clientY - lastMouseRef.current.y\n lastMouseRef.current = { x: e.clientX, y: e.clientY }\n\n if (Math.abs(dx) > 1 || Math.abs(dy) > 1) {\n hasMovedRef.current = true\n }\n\n const pending = pendingRef.current\n if (model.draggingNode) {\n model.moveNode(model.draggingNode, dx / model.scaleX, dy / model.scaleY)\n } else if (model.isPanning) {\n pending.pan = {\n dx: (pending.pan?.dx ?? 0) + dx,\n dy: (pending.pan?.dy ?? 0) + dy,\n }\n scheduleFrame()\n } else {\n const rect = (\n e.currentTarget as HTMLCanvasElement\n ).getBoundingClientRect()\n pending.hover = { x: e.clientX - rect.left, y: e.clientY - rect.top }\n scheduleFrame()\n }\n }\n\n function onMouseUp() {\n model.stopDragging()\n }\n\n // also fired by the canvas unmounting under a resting pointer, after the\n // view closing it has destroyed the model\n function onMouseLeave() {\n dropPending()\n if (!isAlive(model)) {\n return\n }\n model.stopDragging()\n model.setHoveredNode(null)\n model.setHoveredEdge(null)\n }\n\n // Right-clicking a node is the gesture that asks \"where is this?\", and until\n // now the graph had no answer: a node named an assembly and an offset in its\n // tags that nothing surfaced. The items come from the model's launch targets,\n // so what is offered is what can actually be opened.\n function onContextMenu(e: React.MouseEvent) {\n const { x, y } = getMouseCoord(e)\n const node = nodeAt(x, y)\n if (node) {\n e.preventDefault()\n setContextNode({ nodeId: node, top: e.clientY, left: e.clientX })\n return\n }\n const row = model.walkRowAt(\n x * model.scaleX + model.translateX,\n y * model.scaleY + model.translateY,\n )\n if (row !== undefined) {\n e.preventDefault()\n setContextRow({ row, top: e.clientY, left: e.clientX })\n }\n }\n\n function onClick(e: React.MouseEvent) {\n // a click that ended a drag selects nothing\n if (!hasMovedRef.current) {\n const { x, y } = getMouseCoord(e)\n const node = nodeAt(x, y)\n model.setSelectedNode(node)\n if (node) {\n model.showNodeDetails(node)\n }\n }\n }\n\n return {\n handlers: {\n onMouseDown,\n onMouseMove,\n onMouseUp,\n onMouseLeave,\n onClick,\n onContextMenu,\n },\n contextNode,\n contextRow,\n closeContextMenu: () => {\n setContextNode(undefined)\n setContextRow(undefined)\n },\n }\n}\n\nexport type PaneHandlers = ReturnType<typeof usePaneGestures>['handlers']\n", "const ZOOM_PER_NOTCH = 1.1\nconst NOTCH_PX = 100\nconst LINE_PX = 40\nconst PAGE_PX = 800\nconst PINCH_GAIN = 10\nconst MAX_NOTCHES_PER_EVENT = 2\n\n// Zoom by how far the wheel moved rather than by one step per event. A mouse\n// sends one event of about NOTCH_PX per notch and still zooms ZOOM_PER_NOTCH;\n// a trackpad sends sixty small ones a second, which at a step each compounded\n// to hundreds of times per second. A pinch arrives as ctrl+wheel with deltas a\n// tenth the size. The delta is normalized here rather than with core's\n// normalizeWheelDelta, which a released host may not export.\nexport function wheelZoomFactor(e: {\n deltaY: number\n deltaMode: number\n ctrlKey: boolean\n}) {\n const px =\n e.deltaY * (e.deltaMode === 1 ? LINE_PX : e.deltaMode === 2 ? PAGE_PX : 1)\n const notches = ((e.ctrlKey ? PINCH_GAIN : 1) * px) / NOTCH_PX\n return (\n ZOOM_PER_NOTCH **\n -Math.max(-MAX_NOTCHES_PER_EVENT, Math.min(MAX_NOTCHES_PER_EVENT, notches))\n )\n}\n", "import { useId } from 'react'\n\nimport {\n exonOutlineTree,\n exonStretches,\n} from '@jbrowse/bandage-core/genes/exonOutline'\nimport { observer } from 'mobx-react'\n\nimport ElTree from './ElTree'\n\nimport type { GraphPaneModel } from '../model'\n\n// The session's genes drawn onto the graph: each exon outlined round its\n// stretch of node, as core's exonOutlineTree draws it for every host, moved by\n// the same transform the halos use. Their names are LabelLayer's.\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'hidden' as const,\n zIndex: 2,\n}\n\nexport { EXON_COLOR } from '@jbrowse/bandage-core/genes/exonOutline'\n\nconst GenePins = observer(function GenePins({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const id = `exon-outline-${useId().replaceAll(/[^\\w-]/g, '')}`\n const { genePins, walkLift, nodeInk } = model\n const { scaleX, scaleY, translateX, translateY, paneWidth, canvasHeight } =\n model\n const tree = exonOutlineTree(\n exonStretches(genePins, nodeInk.halfWidthPx, walkLift),\n {\n id,\n width: paneWidth,\n height: canvasHeight,\n transform: `translate(${translateX} ${translateY}) scale(${scaleX} ${scaleY})`,\n },\n )\n return tree ? (\n <svg\n style={svgStyle}\n width={paneWidth}\n height={canvasHeight}\n data-testid=\"graph-gene-pins\"\n >\n <ElTree el={tree} />\n </svg>\n ) : null\n})\n\nexport default GenePins\n", "import { createElement } from 'react'\nimport type { ReactNode } from 'react'\n\nimport type { El } from '@jbrowse/bandage-core/el'\n\n// SVG's attribute names as React's props: `class` is className, `data-` and\n// `aria-` keep their dashes, the rest are camel-cased (`stroke-width` is\n// strokeWidth)\nfunction propName(name: string) {\n return name === 'class'\n ? 'className'\n : /^(data|aria)-/.test(name)\n ? name\n : name.replace(/-([a-z])/g, (_, c: string) => c.toUpperCase())\n}\n\nfunction toReact(node: El | string, key: number): ReactNode {\n if (typeof node === 'string') {\n return node\n }\n const props: Record<string, unknown> = { key }\n for (const [name, value] of Object.entries(node.attrs)) {\n if (value !== undefined) {\n props[propName(name)] = value\n }\n }\n return createElement(node.tag, props, ...node.children.map(toReact))\n}\n\n// A core element tree as React elements\nexport default function ElTree({ el }: { el: El }) {\n return toReact(el, 0)\n}\n", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n 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\"\n}), 'CropFree');", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon([/*#__PURE__*/_jsx(\"path\", {\n 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\"\n}, \"0\"), /*#__PURE__*/_jsx(\"path\", {\n d: \"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z\"\n}, \"1\")], 'ZoomIn');", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n 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\"\n}), 'ZoomOut');", "import CropFreeIcon from '@mui/icons-material/CropFree'\nimport ZoomInIcon from '@mui/icons-material/ZoomIn'\nimport ZoomOutIcon from '@mui/icons-material/ZoomOut'\nimport { IconButton, Tooltip, Typography } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport ColorSchemeSelect from './ColorSchemeSelect'\nimport GraphStats from './GraphStats'\nimport LayoutSelect from './LayoutSelect'\nimport RepeatSelect from './RepeatSelect'\nimport SettingsMenu from './SettingsMenu'\nimport WalkSelect from './WalkSelect'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n toolbar: {\n display: 'flex',\n alignItems: 'center',\n gap: 4,\n padding: '2px 4px',\n borderBottom: '1px solid #ddd',\n },\n})\n\nconst ZoomDisplay = observer(function ZoomDisplay({\n model,\n}: {\n model: GraphPaneModel\n}) {\n return <Typography variant=\"body2\">{model.zoomPercent}</Typography>\n})\n\nconst GraphToolbar = observer(function GraphToolbar({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n return (\n <div className={classes.toolbar}>\n <LayoutSelect model={model} />\n <ColorSchemeSelect model={model} />\n <WalkSelect model={model} />\n <RepeatSelect model={model} />\n <Tooltip title=\"Zoom in\">\n <IconButton\n size=\"small\"\n onClick={() => {\n model.zoom(1.5, model.viewBox.width / 2, model.viewBox.height / 2)\n }}\n >\n <ZoomInIcon />\n </IconButton>\n </Tooltip>\n <Tooltip title=\"Zoom out\">\n <IconButton\n size=\"small\"\n onClick={() => {\n model.zoom(\n 1 / 1.5,\n model.viewBox.width / 2,\n model.viewBox.height / 2,\n )\n }}\n >\n <ZoomOutIcon />\n </IconButton>\n </Tooltip>\n <Tooltip title=\"Zoom to fit\">\n <IconButton\n size=\"small\"\n onClick={() => {\n model.zoomToFit()\n }}\n >\n <CropFreeIcon />\n </IconButton>\n </Tooltip>\n <ZoomDisplay model={model} />\n <GraphStats model={model} />\n <SettingsMenu model={model} />\n </div>\n )\n})\n\nexport default GraphToolbar\n", "import { COLOR_SCHEMES } from '@jbrowse/bandage-core/colorSchemes'\nimport { FormControl, InputLabel, MenuItem, Select } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n formControl: {\n minWidth: 100,\n },\n})\n\nconst ColorSchemeSelect = observer(function ColorSchemeSelect({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const fixed = model.colorSchemeLock\n return (\n <FormControl\n size=\"small\"\n className={classes.formControl}\n disabled={fixed !== undefined}\n title={fixed?.why}\n >\n <InputLabel>Color</InputLabel>\n <Select\n value={model.chosenColorScheme}\n label=\"Color\"\n renderValue={fixed ? () => fixed.value : undefined}\n onChange={e => {\n model.setColorScheme(e.target.value)\n }}\n >\n {COLOR_SCHEMES.map(({ value, label }) => (\n <MenuItem key={value} value={value}>\n {label}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n )\n})\n\nexport default ColorSchemeSelect\n", "import { Typography } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n stats: {\n marginLeft: 'auto',\n },\n perf: {\n color: '#888',\n fontVariantNumeric: 'tabular-nums',\n },\n})\n\nfunction fmtMs(ms: number | undefined) {\n return ms === undefined ? '\u2013' : `${Math.round(ms)}ms`\n}\n\n// The perf READOUT, off by default: it sat in the toolbar of every published\n// graph figure, where one machine's fetch time is a number a reader has to work\n// out is not about them. `showPerf` is in the settings menu.\n//\n// The numbers themselves are not conditional \u2014 they ride the stats element's\n// data-* attributes either way (see GraphStats), so a browser test asserting a\n// timing budget never depends on a display setting, and turning the text off\n// costs no coverage. They live there rather than on this element so that\n// switching the text off leaves no empty node behind to carry them.\nconst GraphPerf = observer(function GraphPerf({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const { lastFetchMs, lastLayoutMs, lastGeometryMs } = model\n const hasMetrics =\n lastFetchMs !== undefined ||\n lastLayoutMs !== undefined ||\n lastGeometryMs !== undefined\n return model.showPerf && hasMetrics ? (\n <Typography\n variant=\"caption\"\n className={classes.perf}\n data-testid=\"graph-perf-stats\"\n >\n fetch {fmtMs(lastFetchMs)} \u00B7 layout {fmtMs(lastLayoutMs)} \u00B7 geom{' '}\n {fmtMs(lastGeometryMs)}\n </Typography>\n ) : null\n})\n\nconst GraphStats = observer(function GraphStats({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n return (\n <div\n className={classes.stats}\n data-testid=\"graph-stats\"\n data-node-count={model.nodeCount}\n data-edge-count={model.edgeCount}\n data-path-count={model.pathCount}\n // unconditional, whatever `showPerf` is doing to the text beside them \u2014\n // see GraphPerf\n data-fetch-ms={model.lastFetchMs ?? ''}\n data-layout-ms={model.lastLayoutMs ?? ''}\n data-geometry-ms={model.lastGeometryMs ?? ''}\n data-geometry-strokes={model.lastGeometryStrokeCount ?? ''}\n >\n <Typography variant=\"body2\" component=\"span\">\n {model.nodeCount} nodes, {model.edgeCount} edges\n {model.pathCount > 0 ? `, ${model.pathCount} paths` : ''}\n </Typography>{' '}\n <GraphPerf model={model} />\n </div>\n )\n})\n\nexport default GraphStats\n", "import { LAYOUT_MODES } from '@jbrowse/bandage-core/layoutModes'\nimport {\n FormControl,\n InputLabel,\n MenuItem,\n Select,\n Tooltip,\n} from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n formControl: {\n minWidth: 150,\n },\n})\n\nconst LayoutSelect = observer(function LayoutSelect({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const { graph } = model\n return (\n <FormControl size=\"small\" className={classes.formControl}>\n <InputLabel>Layout</InputLabel>\n <Select\n value={model.chosenLayoutMode}\n label=\"Layout\"\n data-testid=\"graph-layout-select\"\n onChange={e => {\n void model.switchLayout(e.target.value)\n }}\n >\n {LAYOUT_MODES.map(({ value, label, description, available }) => (\n <MenuItem\n key={value}\n value={value}\n disabled={graph ? !available(graph) : false}\n >\n <Tooltip title={description} placement=\"right\">\n <span>{label}</span>\n </Tooltip>\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n )\n})\n\nexport default LayoutSelect\n", "import { FormControl, InputLabel, MenuItem, Select } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n formControl: {\n minWidth: 130,\n maxWidth: 240,\n },\n})\n\n// Which tandem repeat array the walk rows measure between and tile by, from\n// the session's repeat annotation over the window. Only the walk rows read it.\nconst RepeatSelect = observer(function RepeatSelect({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const { repeatChoices } = model\n if (model.chosenLayoutMode !== 'walkrows' || repeatChoices.length === 0) {\n return null\n }\n const keys = new Set(repeatChoices.map(r => r.key))\n return (\n <FormControl size=\"small\" className={classes.formControl}>\n <InputLabel>Repeat</InputLabel>\n <Select\n value={keys.has(model.repeatKey) ? model.repeatKey : ''}\n label=\"Repeat\"\n data-testid=\"graph-repeat-select\"\n onChange={e => {\n model.setRepeatKey(e.target.value)\n }}\n >\n <MenuItem value=\"\">\n <em>Whole window</em>\n </MenuItem>\n {repeatChoices.map(({ key, name, unit }) => (\n <MenuItem key={key} value={key}>\n {name} \u00B7 {unit.toLocaleString()} bp unit\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n )\n})\n\nexport default RepeatSelect\n", "import { useState } from 'react'\n\nimport { CascadingMenuButton } from '@jbrowse/core/ui'\nimport DeleteIcon from '@mui/icons-material/Delete'\nimport MoreVertIcon from '@mui/icons-material/MoreVert'\nimport SettingsIcon from '@mui/icons-material/Settings'\nimport { observer } from 'mobx-react'\n\nimport GraphSettingsDialog from './GraphSettingsDialog'\n\nimport type { GraphPaneModel } from '../model'\n\nconst SettingsMenu = observer(function SettingsMenu({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const [settingsOpen, setSettingsOpen] = useState(false)\n\n return (\n <>\n <CascadingMenuButton\n size=\"small\"\n menuItems={[\n {\n type: 'checkbox' as const,\n label: 'Linear layout',\n checked: model.linearLayout,\n onClick: () => {\n model.setLinearLayout(!model.linearLayout)\n void model.recomputeLayout()\n },\n },\n {\n type: 'checkbox' as const,\n label: 'Show deletion edges',\n checked: model.showDeletionEdges,\n onClick: () => {\n model.setShowDeletionEdges(!model.showDeletionEdges)\n },\n },\n {\n type: 'checkbox' as const,\n label: 'Show timings',\n checked: model.showPerf,\n onClick: () => {\n model.setShowPerf(!model.showPerf)\n },\n },\n { type: 'divider' as const },\n {\n label: 'Settings',\n icon: SettingsIcon,\n onClick: () => {\n setSettingsOpen(true)\n },\n },\n { type: 'divider' as const },\n {\n label: 'Return to import form',\n icon: DeleteIcon,\n onClick: () => {\n model.clearGraph()\n },\n },\n ]}\n >\n <MoreVertIcon />\n </CascadingMenuButton>\n\n <GraphSettingsDialog\n model={model}\n open={settingsOpen}\n onClose={() => {\n setSettingsOpen(false)\n }}\n />\n </>\n )\n})\n\nexport default SettingsMenu\n", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z\"\n}), 'Delete');", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n 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\"\n}), 'MoreVert');", "import {\n Checkbox,\n FormControl,\n InputLabel,\n ListItemText,\n MenuItem,\n Select,\n} from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n formControl: {\n minWidth: 130,\n maxWidth: 260,\n },\n})\n\n// Which walks to lift out of the drawing: Bandage's path highlight, for as many\n// of the haplotypes a GBZ cut carries as the reader picks. Absent from a graph\n// with no walks, and from a tube map, whose tubes are the walks.\nconst WalkSelect = observer(function WalkSelect({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const { walkChoices } = model\n if (walkChoices.length === 0 || !model.liftsWalks) {\n return null\n }\n const names = new Set(walkChoices.map(c => c.name))\n const labels = new Map(walkChoices.map(c => [c.name, c.label]))\n const picked = model.walkLayers\n .map(layer => layer.walk)\n .filter(name => names.has(name))\n return (\n <FormControl size=\"small\" className={classes.formControl}>\n <InputLabel>Walks</InputLabel>\n <Select\n multiple\n value={picked}\n label=\"Walks\"\n data-testid=\"graph-walk-select\"\n renderValue={selected => selected.map(n => labels.get(n)).join(', ')}\n onChange={e => {\n const { value } = e.target\n model.liftWalks(typeof value === 'string' ? value.split(',') : value)\n }}\n >\n {walkChoices.map(({ name, label }) => (\n <MenuItem key={name} value={name} dense>\n <Checkbox size=\"small\" checked={picked.includes(name)} />\n <ListItemText primary={label} />\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n )\n})\n\nexport default WalkSelect\n", "import { BUBBLE_KIND_COLORS } from '@jbrowse/bandage-core/bubbles/classifyBubble'\nimport { geneCoverageNote } from '@jbrowse/bandage-core/labelLayout'\nimport { LABEL_PX } from '@jbrowse/bandage-core/overlayLabels'\nimport { isAlive } from '@jbrowse/mobx-state-tree'\nimport { observer } from 'mobx-react'\n\nimport { EXON_COLOR } from './GenePins'\nimport LabelChip from './LabelChip'\n\nimport type { GraphPaneModel } from '../model'\nimport type {\n BubbleHalo,\n RouteLabel,\n} from '@jbrowse/bandage-core/bubbles/bubbleHalos'\n\n// Every chip drawn over the graph, above all of its ink: bubble names, gene\n// names on their pins, and the routes' walkers. `overlayLabels` has placed\n// them against each other and against the row labels already.\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'hidden' as const,\n zIndex: 3,\n}\n\nconst GENE_INK = '#1c1c22'\n\nconst LabelLayer = observer(function LabelLayer({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { bubbles, genes, routes } = model.overlayLabels\n if (bubbles.length + genes.length + routes.length === 0) {\n return null\n }\n const { walkLift, scaleY, translateY, contigThickness } = model\n // lifted walks dim the bubbles none of them enters and the routes none of\n // them takes\n const dimmedBubble = (h: BubbleHalo) =>\n walkLift !== undefined && !h.nodeIds.some(id => walkLift.nodeIds.has(id))\n const dimmedRoute = (r: RouteLabel) =>\n walkLift !== undefined && !r.route.walks.some(w => walkLift.names.has(w))\n\n return (\n <svg\n style={svgStyle}\n width={model.paneWidth}\n height={model.canvasHeight}\n data-testid=\"graph-label-layer\"\n >\n {genes.map(({ item: pin, x, y, w, text }) => {\n const { gene } = pin\n const note = geneCoverageNote(pin)\n return (\n <g key={`${gene.name}-${gene.start}`}>\n <line\n x1={x}\n x2={x}\n y1={y - LABEL_PX - 2}\n y2={pin.at.y * scaleY + translateY + contigThickness / 2}\n stroke={GENE_INK}\n strokeWidth={0.8}\n strokeOpacity={0.6}\n />\n <LabelChip\n x={x}\n y={y}\n w={w}\n text={gene.name}\n note={text.slice(gene.name.length) || undefined}\n color={GENE_INK}\n edge={EXON_COLOR}\n italic\n title={`${gene.name} ${gene.refName}:${gene.start.toLocaleString()}-${gene.end.toLocaleString()}${note ? `, ${note} in the cut` : ''}`}\n testId=\"graph-gene-pin-label\"\n />\n </g>\n )\n })}\n {routes.map(({ item: { halo: h, route }, x, y, w, text }) => (\n <LabelChip\n key={`${h.bubble.start}-${h.bubble.end}-${route.route.steps.join(',')}`}\n x={x}\n y={y}\n w={w}\n text={text}\n color={BUBBLE_KIND_COLORS[h.kind]}\n small\n dimmed={dimmedRoute(route)}\n title={`${route.route.walks.length} walk(s): ${route.route.walks.join(', ')}`}\n testId=\"graph-route-label\"\n />\n ))}\n {bubbles.map(({ item: h, x, y, w, text }) => (\n <LabelChip\n key={`${h.bubble.start}-${h.bubble.end}`}\n x={x}\n y={y}\n w={w}\n text={text}\n color={BUBBLE_KIND_COLORS[h.kind]}\n dimmed={dimmedBubble(h)}\n title={`${h.label}\\n${h.bubble.segmentCount} segments \u00B7 click to open`}\n testId=\"graph-bubble-halo-label\"\n onClick={() => {\n void model.popBubble(h.bubble)\n }}\n // a leave also fires as the view closing it unmounts the chip\n onHover={hovered => {\n if (isAlive(model)) {\n model.setHoveredBubble(hovered ? h.bubble : null)\n }\n }}\n />\n ))}\n </svg>\n )\n})\n\nexport default LabelLayer\n", "import { LABEL_PAD, LABEL_PX } from '@jbrowse/bandage-core/overlayLabels'\n\n// One label on an overlay: a white chip with a coloured edge and text, its\n// baseline at y and centred on x. A note follows the text in plain type.\nexport default function LabelChip({\n x,\n y,\n w,\n text,\n note,\n color,\n edge = color,\n italic,\n small,\n dimmed,\n title,\n testId,\n onClick,\n onHover,\n}: {\n x: number\n y: number\n w: number\n text: string\n note?: string\n color: string\n edge?: string\n italic?: boolean\n small?: boolean\n dimmed?: boolean\n title?: string\n testId?: string\n onClick?: () => void\n onHover?: (hovered: boolean) => void\n}) {\n return (\n <g\n style={{\n pointerEvents: onClick || onHover ? 'auto' : 'none',\n cursor: onClick ? 'pointer' : undefined,\n opacity: dimmed ? 0.35 : 1,\n }}\n data-testid={testId}\n onClick={onClick}\n onMouseEnter={() => {\n onHover?.(true)\n }}\n onMouseLeave={() => {\n onHover?.(false)\n }}\n >\n {title ? <title>{title}</title> : null}\n <rect\n x={x - w / 2}\n y={y - LABEL_PX - LABEL_PAD + 2}\n width={w}\n height={LABEL_PX + LABEL_PAD * 2 - 2}\n rx={3}\n fill=\"rgba(255,255,255,0.85)\"\n stroke={edge}\n strokeWidth={small ? 0.6 : 1}\n />\n <text\n x={x}\n y={y}\n fontSize={small ? LABEL_PX - 1 : LABEL_PX}\n fontFamily=\"sans-serif\"\n fontStyle={italic ? 'italic' : undefined}\n fontWeight={italic ? 600 : undefined}\n fill={color}\n textAnchor=\"middle\"\n >\n {text}\n {note ? (\n <tspan fontStyle=\"normal\" fontWeight=\"normal\">\n {note}\n </tspan>\n ) : null}\n </text>\n </g>\n )\n}\n", "import { useEffect, useRef } from 'react'\n\nimport { drawReferenceStrip } from '@jbrowse/bandage-core/referenceStrip'\nimport { LIFT_BACKDROP_CSS } from '@jbrowse/bandage-core/renderer/GeometryBuilder'\nimport { encodingSwatchCss } from '@jbrowse/bandage-core/walkEncoding'\nimport { getDpr } from '@jbrowse/render-core/canvas2dUtils'\nimport { autorun } from 'mobx'\nimport { observer } from 'mobx-react'\n\nimport { legendBoxStyle, legendRowStyle } from './legendStyles'\n\nimport type { GraphPaneModel } from '../model'\n\nconst canvasStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n zIndex: 5,\n}\n\n// Each reference segment at its bp in the linear view, over a drawing that\n// has no bp axis of its own. Repainted by an autorun, so a pan in the linear\n// view moves the strip in the same frame as its other tracks.\nconst ReferenceStripOverlay = observer(function ReferenceStripOverlay({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const ref = useRef<HTMLCanvasElement>(null)\n const { referenceStripShown, paneWidth, canvasHeight } = model\n useEffect(\n () =>\n autorun(() => {\n const canvas = ref.current\n const frame = model.referenceStripFrame\n const ctx = canvas?.getContext('2d')\n if (canvas && ctx && frame && model.referenceStripShown) {\n const dpr = getDpr()\n const width = model.paneWidth\n const height = model.canvasHeight\n canvas.width = Math.round(width * dpr)\n canvas.height = Math.round(height * dpr)\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0)\n ctx.clearRect(0, 0, width, height)\n drawReferenceStrip(ctx, model.referenceStripBlocks, frame, {\n width,\n lit: model.referenceStripLit,\n darkMode: model.darkMode,\n dpr,\n })\n }\n }),\n [model],\n )\n return (\n <canvas\n ref={ref}\n data-testid={referenceStripShown ? 'graph-reference-strip' : undefined}\n style={{\n ...canvasStyle,\n width: paneWidth,\n height: canvasHeight,\n display: referenceStripShown ? 'block' : 'none',\n }}\n />\n )\n})\n\nexport default ReferenceStripOverlay\n\nconst SWATCH_PX = 18\n\nconst RAMP_SWATCH =\n 'linear-gradient(to right, hsl(0, 70%, 50%) 0 33%, hsl(120, 70%, 50%) 33% 61%, hsl(240, 70%, 50%) 61%)'\n\n// A scheme other than the ramp shows a few of the strip's own blocks in bp\n// order, as the strip draws them, rather than a rainbow it does not\nconst SAMPLED_BLOCKS = 6\n\nfunction sampledSwatch(colors: string[]) {\n const distinct = colors.filter((c, i) => c !== colors[i - 1])\n const n = Math.min(SAMPLED_BLOCKS, distinct.length)\n const picked = Array.from(\n { length: n },\n (_, i) =>\n distinct[n > 1 ? Math.round((i * (distinct.length - 1)) / (n - 1)) : 0]!,\n )\n return picked.length > 1\n ? `linear-gradient(to right, ${picked.join(', ')})`\n : (picked[0] ?? LIFT_BACKDROP_CSS)\n}\n\n// the strip's own colours: a row per lifted walk in its lane's, else the\n// node scheme's\nfunction StripSwatch({\n rows,\n}: {\n rows: { key: string; background: string }[]\n}) {\n return (\n <div style={{ width: SWATCH_PX, flex: 'none' }}>\n {rows.map(({ key, background }) => (\n <div\n key={key}\n style={{ height: rows.length > 1 ? 3 : 4, background }}\n />\n ))}\n </div>\n )\n}\n\nfunction stripRows(model: GraphPaneModel) {\n return (\n model.walkLift?.walks.map(w => ({\n key: w.name,\n background: encodingSwatchCss(w.encoding),\n })) ?? [\n {\n key: 'scheme',\n background:\n model.effectiveColorScheme === 'reference-position'\n ? RAMP_SWATCH\n : sampledSwatch(model.referenceStripBlocks.map(b => b.colors[0]!)),\n },\n ]\n )\n}\n\nfunction OverhangSwatch() {\n return (\n <svg width={SWATCH_PX} height={10} style={{ flex: 'none' }}>\n <path d=\"M0,5 L8,0 L8,10 Z M18,5 L10,0 L10,10 Z\" fill=\"#18181c\" />\n </svg>\n )\n}\n\n// Hovering a node boxes its span on the strip and draws a leader to it\nexport const ReferenceStripLegend = observer(function ReferenceStripLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const rowPerWalk = (model.walkLift?.walks.length ?? 0) > 1\n return model.referenceStripShown ? (\n <div style={legendBoxStyle} data-testid=\"graph-reference-strip-legend\">\n <div style={legendRowStyle}>\n <StripSwatch rows={stripRows(model)} />\n <span>\n top strip: reference segments at their bp\n {rowPerWalk ? ', a row per walk' : ''}\n </span>\n </div>\n {model.referenceStripFaded ? (\n <div style={legendRowStyle}>\n <StripSwatch\n rows={[{ key: 'pale', background: LIFT_BACKDROP_CSS }]}\n />\n <span>\n reference not on{' '}\n {rowPerWalk ? \"that row's walk\" : model.liftedWalksLabel}\n </span>\n </div>\n ) : null}\n {model.referenceStripOverhangs ? (\n <div style={legendRowStyle}>\n <OverhangSwatch />\n <span>the graph draws reference past this edge</span>\n </div>\n ) : null}\n </div>\n ) : null\n})\n", "import { useEffect, useRef } from 'react'\nimport type { ReactNode } from 'react'\n\nimport { formatBp } from '@jbrowse/bandage-core/graphLabels'\nimport { drawTubeMapRuler, rulerInk } from '@jbrowse/bandage-core/tubeMap/axis'\nimport { drawTubeMapConnectors } from '@jbrowse/bandage-core/tubeMap/connectors'\nimport {\n deviationInk,\n drawDeviationMarks,\n} from '@jbrowse/bandage-core/tubeMap/deviations'\nimport { drawTubeMap } from '@jbrowse/bandage-core/tubeMap/draw'\nimport { drawTubeMapGenes } from '@jbrowse/bandage-core/tubeMap/genes'\nimport {\n FORWARD_READ_COLORS,\n REVERSE_READ_COLORS,\n} from '@jbrowse/bandage-core/tubeMap/reads'\nimport { getDpr } from '@jbrowse/render-core/canvas2dUtils'\nimport { autorun } from 'mobx'\nimport { observer } from 'mobx-react'\n\nimport { legendBoxStyle, legendRowStyle } from './legendStyles'\n\nimport type { GraphPaneModel } from '../model'\n\nconst canvasStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n zIndex: 1,\n}\n\n// The tube map's ink, over the canvas, which draws nothing under a tube map\n// layout. Above the tubes go the session's genes in a view of its own, or in\n// a linear view the bands tying each reference box to its bp there; under\n// them a reference ruler, unless the linear view's is already the axis.\n// Repainted by an autorun on every change of transform, so a pan in the linear\n// view above moves the tubes in the same frame as its other tracks.\nconst TubeMapOverlay = observer(function TubeMapOverlay({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const ref = useRef<HTMLCanvasElement>(null)\n const { tubeMapPicture, paneWidth, canvasHeight } = model\n useEffect(\n () =>\n autorun(() => {\n const canvas = ref.current\n const picture = model.tubeMapPicture\n const frame = model.tubeMapFrame\n const ctx = canvas?.getContext('2d')\n if (canvas && ctx && picture && frame) {\n const dpr = getDpr()\n const width = model.paneWidth\n const height = model.canvasHeight\n canvas.width = Math.round(width * dpr)\n canvas.height = Math.round(height * dpr)\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0)\n ctx.clearRect(0, 0, width, height)\n const tubeFrame = {\n ...frame,\n width,\n highlightNode: model.hoveredNode ?? model.selectedNode,\n darkMode: model.darkMode,\n tubeColors: model.tubeMapTubeColors,\n nodeColors: model.tubeMapNodeColors,\n }\n drawTubeMap(ctx, picture, tubeFrame)\n drawDeviationMarks(ctx, model.tubeMapDeviations, tubeFrame)\n drawTubeMapConnectors(\n ctx,\n model.tubeMapConnectors,\n model.connectorZoneBottom,\n tubeFrame,\n )\n const { bounds } = picture\n drawTubeMapGenes(\n ctx,\n model.tubeMapGenes,\n tubeFrame,\n frame.y(bounds.minY) - 2,\n )\n const boxes = model.tubeMapRulerBoxes\n if (boxes) {\n drawTubeMapRuler(\n ctx,\n boxes,\n tubeFrame,\n frame.y(bounds.maxY) + 4,\n model.layoutResult?.referenceAxis,\n )\n }\n }\n }),\n [model],\n )\n // Mounted whether or not there is a tube map, so the autorun above has its\n // canvas the moment a layout brings one.\n return (\n <canvas\n ref={ref}\n data-testid={tubeMapPicture ? 'graph-tube-map' : undefined}\n style={{\n ...canvasStyle,\n width: paneWidth,\n height: canvasHeight,\n display: tubeMapPicture ? 'block' : 'none',\n }}\n />\n )\n})\n\nexport default TubeMapOverlay\n\nconst SWATCH_PX = 18\n\n// Two boxes' brackets, as the ruler draws them under every box\nfunction BracketSwatch() {\n const brackets = [\n [0.5, 5.5],\n [8.5, SWATCH_PX - 0.5],\n ]\n return (\n <svg width={SWATCH_PX} height={7} style={{ flex: 'none' }}>\n <path\n d={brackets.map(([x0, x1]) => `M${x0},6 V1.5 H${x1} V6`).join(' ')}\n fill=\"none\"\n stroke={rulerInk()}\n strokeWidth={1}\n />\n </svg>\n )\n}\n\nconst barSwatchStyle = { width: SWATCH_PX, height: 7, flex: 'none' }\n\nconst tubeSwatchStyle = {\n ...barSwatchStyle,\n display: 'flex',\n justifyContent: 'center',\n backgroundColor: '#b8b8c0',\n}\n\nfunction TickSwatch() {\n return (\n <div style={tubeSwatchStyle}>\n <div style={{ width: 2, backgroundColor: deviationInk() }} />\n </div>\n )\n}\n\n// A read takes one shade of its strand's palette, varied so neighbours differ\nfunction ReadSwatch({ colors }: { colors: readonly string[] }) {\n const step = 100 / colors.length\n const stops = colors.map((c, i) => `${c} ${i * step}% ${(i + 1) * step}%`)\n return (\n <div\n style={{\n ...barSwatchStyle,\n background: `linear-gradient(to right, ${stops.join(', ')})`,\n }}\n />\n )\n}\n\nconst glyphSwatchStyle = {\n width: SWATCH_PX,\n flex: 'none',\n textAlign: 'center' as const,\n fontFamily: 'monospace',\n fontSize: 12,\n}\n\nfunction DeletionSwatch() {\n return <div style={{ ...barSwatchStyle, backgroundColor: 'grey' }} />\n}\n\nfunction LegendRow({\n swatch,\n children,\n}: {\n swatch: ReactNode\n children: ReactNode\n}) {\n return (\n <div style={legendRowStyle}>\n {swatch}\n <span>{children}</span>\n </div>\n )\n}\n\n// What a tube map draws that nothing else on screen explains, each listed\n// only while it applies\nexport const TubeMapLegend = observer(function TubeMapLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { logWidths, foldBp, forwardReads, reverseReads, mismatches } =\n model.tubeMapKeys\n const reads = model.readsShown\n const sampled = reads && reads.shown < reads.total ? reads : undefined\n const rows = [\n forwardReads && (\n <LegendRow key=\"fwd\" swatch={<ReadSwatch colors={FORWARD_READ_COLORS} />}>\n read on the forward strand\n </LegendRow>\n ),\n reverseReads && (\n <LegendRow key=\"rev\" swatch={<ReadSwatch colors={REVERSE_READ_COLORS} />}>\n read on the reverse strand\n </LegendRow>\n ),\n sampled && (\n <LegendRow key=\"sampled\" swatch={<span style={glyphSwatchStyle} />}>\n {sampled.shown.toLocaleString('en-US')} of{' '}\n {sampled.total.toLocaleString('en-US')} reads shown\n </LegendRow>\n ),\n mismatches.has('substitution') && (\n <LegendRow key=\"sub\" swatch={<span style={glyphSwatchStyle}>A</span>}>\n a read's base unlike the node's\n </LegendRow>\n ),\n mismatches.has('insertion') && (\n <LegendRow key=\"ins\" swatch={<span style={glyphSwatchStyle}>*</span>}>\n bases a read inserts\n </LegendRow>\n ),\n mismatches.has('deletion') && (\n <LegendRow key=\"del\" swatch={<DeletionSwatch />}>\n bases a read skips\n </LegendRow>\n ),\n foldBp !== undefined && (\n <LegendRow key=\"fold\" swatch={<TickSwatch />}>\n a haplotype's variant under {formatBp(foldBp)}\n </LegendRow>\n ),\n logWidths && (\n <LegendRow key=\"log\" swatch={<BracketSwatch />}>\n width grows with log of length\n </LegendRow>\n ),\n ].filter(Boolean)\n return rows.length > 0 ? (\n <div style={legendBoxStyle} data-testid=\"graph-tube-map-legend\">\n {rows}\n </div>\n ) : null\n})\n", "import { Button } from '@mui/material'\nimport { observer } from 'mobx-react'\n\nimport type { GraphPaneModel } from '../model'\n\nconst style = {\n position: 'absolute' as const,\n left: 8,\n zIndex: 5,\n background: 'rgba(255,255,255,0.9)',\n textTransform: 'none' as const,\n}\n\nconst UnpopButton = observer(function UnpopButton({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { poppedFrom } = model\n return poppedFrom ? (\n <Button\n size=\"small\"\n variant=\"outlined\"\n style={{ ...style, ...(model.facetPanels ? { bottom: 8 } : { top: 8 }) }}\n data-testid=\"graph-unpop-bubble\"\n onClick={() => {\n void model.unpopBubble()\n }}\n >\n \u25C0 Back to {poppedFrom.label}\n </Button>\n ) : null\n})\n\nexport default UnpopButton\n", "import { Menu } from '@jbrowse/core/ui'\nimport LineStyleIcon from '@mui/icons-material/LineStyle'\nimport { observer } from 'mobx-react'\n\nimport { locLabel } from '../../launchFromGraph/contributors'\n\nimport type { GraphPaneModel } from '../model'\nimport type { WalkRows } from '@jbrowse/bandage-core/layout/walkRows'\n\n// A walk row's bar stands for a span of its haplotype's own contig, so the\n// question a right-click asks is answered by a linear view on that assembly,\n// with its genes\nexport const WalkRowContextMenu = observer(function WalkRowContextMenu({\n model,\n row,\n bars,\n top,\n left,\n onClose,\n}: {\n model: GraphPaneModel\n row: number\n // the rows `row` indexes, walk rows' own unless a strip's\n bars?: WalkRows\n top: number\n left: number\n onClose: () => void\n}) {\n const target = model.walkRowLaunchTarget(row, bars ?? model.walkRowBars)\n const assembly = target?.assembly\n return (\n <Menu\n open\n anchorReference=\"anchorPosition\"\n anchorPosition={{ top, left }}\n onClose={() => {\n onClose()\n }}\n onMenuItemClick={callback => {\n callback()\n }}\n menuItems={[\n target && assembly\n ? {\n label: `Linear genome view \u2014 ${assembly} ${locLabel(target.location)}`,\n icon: LineStyleIcon,\n onClick: () => {\n model.showInLinearView({ location: target.location, assembly })\n },\n }\n : {\n label: 'Linear genome view',\n icon: LineStyleIcon,\n disabled: true,\n disabledHelpText: target\n ? `No assembly in this session is ${target.location.haplotype ?? target.label}`\n : 'This walk states no contig coordinates',\n onClick: () => {},\n },\n ]}\n />\n )\n})\n", "import { useId } from 'react'\n\nimport {\n BAR_PX,\n DISAGREES,\n GAP_PX,\n GENE_INK,\n walkRowsKey,\n walkRowsTree,\n} from '@jbrowse/bandage-core/layout/walkRowDraw'\nimport { RAMP_GRADIENT_CSS } from '@jbrowse/bandage-core/referenceRampCss'\nimport { observer } from 'mobx-react'\n\nimport ElTree from './ElTree'\nimport { legendBoxStyle, legendRowStyle } from './legendStyles'\nimport { CALL_TOLERANCE } from '../repeats/walkCalls'\n\nimport type { GraphPaneModel } from '../model'\nimport type { KeySwatch } from '@jbrowse/bandage-core/layout/walkRowDraw'\n\n// The walk-rows layout's bars: one per haplotype walk under the reference\n// row, each on its own bp axis from the window's left edge, drawn from core's\n// walkRowsTree: runs coloured by whether they are on the reference walk's\n// path, unit separators, each row's genes from its own assembly's\n// annotation, the allele a repeat genotype called and a readout. Under the\n// reference-position ramp an aligned run takes the hue of the reference it is\n// threaded through. In a tandem array that is the aligner's pick among\n// near-identical copies, so the hue says which reference copy the graph used,\n// not which one a copy resembles.\n//\n// The walk rows pair a repeat record's allele with each walk \u2014 see\n// repeats/walkCalls.ts, which also holds the threshold a red readout is read\n// off. Colouring each copy by its unit is jbrowse-plugin-tandem-repeat's.\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'visible' as const,\n zIndex: 3,\n}\n\nconst CALL_TICK = '#111'\nconst UNBACKED_TICK = '#9e9e9e'\n\nconst swatchStyle = { width: 18, height: BAR_PX - 4, borderRadius: 2 }\nconst tickSwatchStyle = {\n ...swatchStyle,\n display: 'flex',\n justifyContent: 'center',\n}\n\nfunction TickSwatch({ color }: { color: string }) {\n return (\n <div style={tickSwatchStyle}>\n <div style={{ width: 2, backgroundColor: color }} />\n </div>\n )\n}\n\nexport function Swatch({ swatch }: { swatch: KeySwatch }) {\n return swatch.kind === 'gene' ? (\n <div\n style={{\n ...swatchStyle,\n boxSizing: 'border-box',\n border: `1.5px solid ${GENE_INK}`,\n borderRadius: 0,\n }}\n />\n ) : (\n <div\n style={{\n ...swatchStyle,\n height: swatch.kind === 'gap' ? GAP_PX : swatchStyle.height,\n background: swatch.fill,\n }}\n />\n )\n}\n\n// What the bar colours, genes and ticks mean, in the legend stack with the\n// other keys. Each tick row appears once the rows hold one, so a catalogue\n// with no genotypes keeps the plain key.\nexport const WalkRowsLegend = observer(function WalkRowsLegend({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const bars = model.walkRowBars\n if (!bars) {\n return null\n }\n const calls = [bars.reference, ...bars.rows].flatMap(row => row.call ?? [])\n const key = walkRowsKey(bars, {\n ramp: model.referenceRampDomain,\n rampCss: RAMP_GRADIENT_CSS,\n genes: model.walkRowGenes?.size ? model.walkRowGeneGaps : undefined,\n })\n return (\n <div style={legendBoxStyle} data-testid=\"graph-walk-rows-legend\">\n {key.map(entry =>\n entry.note ? (\n <div key={entry.label} style={{ color: '#666', fontStyle: 'italic' }}>\n {entry.label}\n </div>\n ) : (\n <div key={entry.label} style={legendRowStyle}>\n <Swatch swatch={entry.swatch} />\n <span>{entry.label}</span>\n </div>\n ),\n )}\n {calls.some(call => call.spanningReads !== 0) ? (\n <div style={legendRowStyle}>\n <TickSwatch color={CALL_TICK} />\n <span>allele length called for this walk</span>\n </div>\n ) : null}\n {calls.some(call => call.spanningReads === 0) ? (\n <div style={legendRowStyle}>\n <TickSwatch color={UNBACKED_TICK} />\n <span>called with no read spanning it</span>\n </div>\n ) : null}\n {calls.some(call => call.agrees === false) ? (\n <div style={legendRowStyle}>\n <div style={swatchStyle} />\n <span style={{ color: DISAGREES }}>\n walk and call over {Math.round(CALL_TOLERANCE * 100)}% apart\n </span>\n </div>\n ) : null}\n </div>\n )\n})\n\nconst WalkRowsOverlay = observer(function WalkRowsOverlay({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const idPrefix = useId().replace(/[^\\w-]/g, '')\n const bars = model.walkRowBars\n if (!bars) {\n return null\n }\n const { paneWidth: width, canvasHeight } = model\n return (\n <svg\n style={svgStyle}\n width={width}\n height={canvasHeight}\n data-testid=\"graph-walk-rows\"\n >\n <ElTree\n el={walkRowsTree(\n bars,\n {\n scaleX: model.scaleX,\n scaleY: model.scaleY,\n translateX: model.translateX,\n translateY: model.translateY,\n width,\n height: canvasHeight,\n },\n {\n ramp: model.referenceRampDomain,\n rowGenes: model.walkRowGenes,\n idPrefix,\n },\n )}\n />\n </svg>\n )\n})\n\nexport default WalkRowsOverlay\n", "import { useId, useMemo, useState } from 'react'\n\nimport {\n walkRowReadout,\n walkRowsKey,\n walkRowsTree,\n} from '@jbrowse/bandage-core/layout/walkRowDraw'\nimport {\n stripGeneGaps,\n stripRowAt,\n walkMarksTree,\n walkStripLabelsTree,\n} from '@jbrowse/bandage-core/layout/walkStrip'\nimport { RAMP_GRADIENT_CSS } from '@jbrowse/bandage-core/referenceRampCss'\nimport { isAlive } from '@jbrowse/mobx-state-tree'\nimport { observer } from 'mobx-react'\n\nimport ElTree from './ElTree'\nimport { WalkRowContextMenu } from './WalkRowContextMenu'\nimport { Swatch } from './WalkRowsOverlay'\nimport { legendRowStyle } from './legendStyles'\n\nimport type { GraphPaneModel } from '../model'\nimport type { RowGene } from '@jbrowse/bandage-core/layout/walkRowDraw'\nimport type { WalkRows } from '@jbrowse/bandage-core/layout/walkRows'\nimport type { StripFrame } from '@jbrowse/bandage-core/layout/walkStrip'\n\n// Walk rows under a layout that draws nodes, each haplotype's walk on its own\n// bp, linked to the drawing above: the hovered node ticks every bar where its\n// walk passes it, and a point on a bar lights its node, ringed, above. The\n// bars share the drawing's colours, so under the reference-position ramp a hue\n// in the drawing is the same hue on each bar. Every row is shown; rows too\n// thin to letter say who they are on hover.\n\nconst keyStyle = {\n display: 'flex',\n flexWrap: 'wrap' as const,\n gap: '2px 14px',\n padding: '2px 8px 6px',\n fontSize: 11,\n color: '#333',\n}\n\nconst tipStyle = {\n position: 'absolute' as const,\n pointerEvents: 'none' as const,\n background: 'rgba(255,255,255,0.92)',\n border: '1px solid #ccc',\n borderRadius: 3,\n padding: '1px 6px',\n fontSize: 11,\n whiteSpace: 'nowrap' as const,\n zIndex: 4,\n}\n\n// The bars, built once per rows, frame, colouring and genes rather than per\n// hover\nconst StripBars = observer(function StripBars({\n bars,\n frame,\n ramp,\n rowGenes,\n}: {\n bars: WalkRows\n frame: StripFrame\n ramp: { start: number; end: number } | undefined\n rowGenes: Map<string, RowGene[]> | undefined\n}) {\n const idPrefix = useId().replace(/[^\\w-]/g, '')\n const tree = useMemo(\n () => walkRowsTree(bars, frame, { ramp, rowGenes, idPrefix }),\n [bars, frame, ramp, rowGenes, idPrefix],\n )\n return <ElTree el={tree} />\n})\n\nconst WalkStrip = observer(function WalkStrip({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const bars = model.walkStripRows\n const frame = model.walkStripFrame\n const [menu, setMenu] = useState<\n { row: number; top: number; left: number } | undefined\n >(undefined)\n const [tip, setTip] = useState<\n { text: string; x: number; y: number } | undefined\n >(undefined)\n if (!bars || !frame) {\n return null\n }\n const hit = (e: React.MouseEvent<SVGSVGElement>) => {\n const box = e.currentTarget.getBoundingClientRect()\n const x = e.clientX - box.left\n const y = e.clientY - box.top\n return { ...stripRowAt(bars, frame, x, y), x, y }\n }\n const key = walkRowsKey(bars, {\n ramp: model.referenceRampDomain,\n rampCss: RAMP_GRADIENT_CSS,\n genes: stripGeneGaps(frame, model.walkRowGenes, model.walkRowGeneGaps),\n })\n return (\n <div\n data-testid=\"graph-walk-strip\"\n style={{ position: 'relative', borderTop: '1px solid #ddd' }}\n onMouseEnter={() => {\n model.setPointerInPane(true)\n }}\n onMouseLeave={() => {\n if (isAlive(model)) {\n model.setPointerInPane(false)\n model.setStripHover(null)\n }\n setTip(undefined)\n }}\n >\n <svg\n width={frame.width}\n height={frame.height}\n style={{ display: 'block', cursor: 'pointer' }}\n onMouseMove={e => {\n const at = hit(e)\n if (at.row) {\n model.setStripHover({ row: at.row.name, offset: at.offset! })\n setTip(\n frame.labelled\n ? undefined\n : {\n text: `${at.row.label} \u00B7 ${walkRowReadout(\n at.row,\n at.index === 0 ? undefined : bars.reference,\n )}`,\n x: at.x,\n y: at.y,\n },\n )\n } else {\n model.setStripHover(null)\n setTip(undefined)\n }\n }}\n onClick={e => {\n const at = hit(e)\n if (at.row && at.index! > 0) {\n model.toggleWalk(at.row.name)\n }\n }}\n onContextMenu={e => {\n const at = hit(e)\n if (at.row) {\n e.preventDefault()\n setMenu({ row: at.index!, top: e.clientY, left: e.clientX })\n }\n }}\n >\n <StripBars\n bars={bars}\n frame={frame}\n ramp={model.referenceRampDomain}\n rowGenes={model.walkRowGenes}\n />\n <ElTree el={walkMarksTree(bars, frame, model.walkStripMarks)} />\n <ElTree\n el={walkStripLabelsTree(\n bars,\n frame,\n new Set(model.walkLayers.map(l => l.walk)),\n )}\n />\n </svg>\n {tip ? (\n <div style={{ ...tipStyle, left: tip.x + 12, top: tip.y - 18 }}>\n {tip.text}\n </div>\n ) : null}\n <div style={keyStyle} data-testid=\"graph-walk-strip-key\">\n {key.map(entry => (\n <div key={entry.label} style={legendRowStyle}>\n <Swatch swatch={entry.swatch} />\n <span>{entry.label}</span>\n </div>\n ))}\n <div style={legendRowStyle}>\n <span>\n \u25AE ticks: where each walk passes the node under the pointer \u00B7 click a\n bar to lift its walk\n </span>\n </div>\n </div>\n {menu ? (\n <WalkRowContextMenu\n model={model}\n row={menu.row}\n bars={bars}\n top={menu.top}\n left={menu.left}\n onClose={() => {\n setMenu(undefined)\n }}\n />\n ) : null}\n </div>\n )\n})\n\nexport default WalkStrip\n", "import { observer } from 'mobx-react'\n\nimport type { GraphPaneModel } from '../model'\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'visible' as const,\n zIndex: 4,\n}\n\n// A ring round the node a point on the walk strip lights, so a one-bp node\n// can be found in a hairball\nconst WalkStripLocator = observer(function WalkStripLocator({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const at = model.walkStripLocator\n return at ? (\n <svg\n style={svgStyle}\n width={model.paneWidth}\n height={model.canvasHeight}\n data-testid=\"graph-walk-strip-locator\"\n >\n <circle\n cx={at.x}\n cy={at.y}\n r={11}\n fill=\"none\"\n stroke=\"white\"\n strokeWidth={4}\n />\n <circle\n cx={at.x}\n cy={at.y}\n r={11}\n fill=\"none\"\n stroke=\"#111\"\n strokeWidth={1.75}\n />\n </svg>\n ) : null\n})\n\nexport default WalkStripLocator\n", "import { Canvas2DRenderer } from '@jbrowse/bandage-core/renderer/Canvas2DRenderer'\n\n// Canvas2D only, and deliberately not through render-core's GPU ladder. The\n// batch is strokes and arrowheads in layout units, and stroking them batched by\n// colour is inside a frame budget at the node counts this view caps itself at\n// (agent-docs/GRAPH_SCALE_AND_LOD.md), so a GPU backend would buy a few\n// milliseconds for ~30 KB of bundled HAL and a shader toolchain. If one is ever\n// wanted, it should take the same `Renderer` interface and draw the batch as\n// instances \u2014 a capsule per node segment, a bezier ribbon per edge stroke \u2014\n// rather than reviving a triangle mesh; agent-docs/IDEAS.md scopes it.\nexport function createGraphRenderer(canvas: HTMLCanvasElement) {\n return Promise.resolve(new Canvas2DRenderer(canvas))\n}\n"],
5
+ "mappings": "qvBAAA,IAAAA,GAAAC,GAAA,CAAAC,GAAAC,KAAA,CAAAA,GAAO,QAAU,eAAe,0CAA0C,ICA1E,IAAAC,GAAkC,SASlC,IAAAC,GAAkD,UAClDC,GAAwB,UACxBC,GAAoC,UCRpC,IAAAC,GAA4B,SACrBC,MAAQ,oBAA2B,GAAAC,KAAK,OAAQ,CACrD,EAAG,6FACL,CAAC,EAAG,MAAM,EDOV,IAAAC,EAAyB,SEPzB,IAAAC,GAAyB,SCLlB,IAAMC,EAAiB,CAC5B,WAAY,yBACZ,QAAS,UACT,aAAc,EACd,SAAU,GACV,WAAY,OACZ,WAAY,QACd,EAEaC,EAAiB,CAAE,QAAS,OAAQ,WAAY,SAAU,IAAK,CAAE,EDoDlE,IAAAC,EAAA,SA5CNC,GAAW,CACf,SAAU,WACV,KAAM,EACN,IAAK,EACL,cAAe,OACf,SAAU,SACV,OAAQ,CACV,EAEMC,MAAc,aAAS,SAAqB,CAChD,MAAAC,CACF,EAEG,CACD,GAAM,CAAE,YAAAC,EAAa,SAAAC,EAAU,cAAAC,CAAc,EAAIH,EACjD,GAAIC,EAAY,SAAW,EACzB,OAAO,KAET,GAAM,CACJ,OAAAG,EACA,OAAAC,EACA,WAAAC,EACA,WAAAC,EACA,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,CAACA,EAAM,aAClB,cAAeA,EAAM,cACrB,SACEA,EAAM,cACF,IAAM,CACJA,EAAM,WAAW,CACnB,EACA,OAER,EACF,EACE,MACN,EAECA,EAAM,kBAAiB,OAACwG,GAAA,CAAU,MAAOxG,EAAO,EAAK,QAEtD,OAAC4D,GAAA,CAAc,MAAO5D,EAAO,EAE5BwF,KACC,OAACpB,GAAA,CACC,MAAOpE,EACP,OAAQwF,EAAY,OACpB,IAAKA,EAAY,IACjB,KAAMA,EAAY,KAClB,QAASE,EACX,EACE,KAEHD,KACC,OAACgB,GAAA,CACC,MAAOzG,EACP,IAAKyF,EAAW,IAChB,IAAKA,EAAW,IAChB,KAAMA,EAAW,KACjB,QAASC,EACX,EACE,KAEHN,KACC,OAAC,gBAAY,MAAOA,EAAa,QAASC,EAAa,EACrD,KAEHJ,GAAajF,EAAM,SAClB,OAAC,gBACC,MAAOA,EAAM,MACb,QACEA,EAAM,aACF,IAAM,CACJA,EAAM,UAAU,CAClB,EACA,OAER,EACE,MACN,CAEJ,CAAC,EAEM0G,GAAQ1B",
6
+ "names": ["require_useRenderingBackend", "__commonJSMin", "exports", "module", "import_react", "import_ui", "import_mobx_state_tree", "import_useRenderingBackend", "import_jsx_runtime", "Info_default", "_jsx", "import_mobx_react", "import_mobx_react", "legendBoxStyle", "legendRowStyle", "import_jsx_runtime", "svgStyle", "BubbleHalos", "model", "bubbleHalos", "walkLift", "hoveredBubble", "scaleX", "scaleY", "translateX", "translateY", "width", "canvasHeight", "halo", "HALO_FACTOR", "dimmedBubble", "h", "id", "BUBBLE_KIND_COLORS", "sameBubble", "BubbleHalos_default", "HaloSwatch", "color", "HaloLegend", "kindsByColor", "kinds", "BUBBLE_KIND_NAMES", "legendBoxStyle", "legendRowStyle", "import_react", "import_mobx", "import_mobx_react", "import_jsx_runtime", "walkSwatchStyle", "walkBlockStyle", "walkBarStyle", "WalkKey", "walk", "label", "reference", "hint", "at", "key", "walkKey", "legendRowStyle", "encodingSwatchCss", "import_react", "wheelZoomFactor", "e", "px", "notches", "import_mobx_state_tree", "useWheelZoom", "canvas", "model", "c", "handleWheel", "e", "rect", "wheelZoomFactor", "usePaneGestures", "lastMouseRef", "hasMovedRef", "pendingRef", "contextNode", "setContextNode", "contextRow", "setContextRow", "screenToGraph", "screenX", "screenY", "getMouseCoord", "nodeAt", "x", "y", "nodePositions", "sx", "sy", "onStrip", "findHoveredNode", "onMouseDown", "node", "applyPending", "pending", "findHoveredEdge", "scheduleFrame", "dropPending", "onMouseMove", "dx", "dy", "onMouseUp", "onMouseLeave", "onContextMenu", "row", "onClick", "import_jsx_runtime", "gridStyle", "titleStyle", "FacetPanel", "model", "lift", "width", "height", "cell", "handlers", "canvas", "setCanvas", "walk", "useWheelZoom", "renderer", "Canvas2DRenderer", "drawing", "uploaded", "dispose", "built", "label", "WalkKey", "FacetPanels", "panels", "grid", "place", "columns", "i", "FacetPanels_default", "import_react", "import_mobx_react", "import_react", "propName", "name", "_", "c", "toReact", "node", "key", "props", "value", "ElTree", "el", "import_jsx_runtime", "svgStyle", "GenePins", "model", "id", "genePins", "walkLift", "nodeInk", "scaleX", "scaleY", "translateX", "translateY", "paneWidth", "canvasHeight", "tree", "exonOutlineTree", "exonStretches", "ElTree", "GenePins_default", "import_jsx_runtime", "CropFree_default", "_jsx", "import_jsx_runtime", "ZoomIn_default", "_jsx", "import_jsx_runtime", "ZoomOut_default", "_jsx", "import_material", "import_mobx_react", "import_mui", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "ColorSchemeSelect", "model", "classes", "fixed", "e", "COLOR_SCHEMES", "value", "label", "ColorSchemeSelect_default", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "fmtMs", "ms", "GraphPerf", "model", "classes", "lastFetchMs", "lastLayoutMs", "lastGeometryMs", "hasMetrics", "GraphStats", "GraphStats_default", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "LayoutSelect", "model", "classes", "graph", "e", "LAYOUT_MODES", "value", "label", "description", "available", "LayoutSelect_default", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "RepeatSelect", "model", "classes", "repeatChoices", "keys", "e", "key", "name", "unit", "RepeatSelect_default", "import_react", "import_ui", "import_jsx_runtime", "Delete_default", "_jsx", "import_jsx_runtime", "MoreVert_default", "_jsx", "import_mobx_react", "import_jsx_runtime", "SettingsMenu", "model", "settingsOpen", "setSettingsOpen", "Settings_default", "Delete_default", "MoreVert_default", "GraphSettingsDialog_default", "SettingsMenu_default", "import_material", "import_mobx_react", "import_mui", "import_jsx_runtime", "useStyles", "WalkSelect", "model", "classes", "walkChoices", "names", "c", "labels", "picked", "layer", "name", "selected", "n", "e", "value", "label", "WalkSelect_default", "import_jsx_runtime", "useStyles", "ZoomDisplay", "model", "GraphToolbar", "classes", "LayoutSelect_default", "ColorSchemeSelect_default", "WalkSelect_default", "RepeatSelect_default", "ZoomIn_default", "ZoomOut_default", "CropFree_default", "GraphStats_default", "SettingsMenu_default", "GraphToolbar_default", "import_mobx_state_tree", "import_mobx_react", "import_jsx_runtime", "LabelChip", "x", "y", "w", "text", "note", "color", "edge", "italic", "small", "dimmed", "title", "testId", "onClick", "onHover", "import_jsx_runtime", "svgStyle", "GENE_INK", "LabelLayer", "model", "bubbles", "genes", "routes", "walkLift", "scaleY", "translateY", "contigThickness", "dimmedBubble", "h", "id", "dimmedRoute", "r", "w", "pin", "x", "y", "text", "gene", "note", "geneCoverageNote", "LabelChip", "EXON_COLOR", "route", "BUBBLE_KIND_COLORS", "hovered", "LabelLayer_default", "import_react", "import_canvas2dUtils", "import_mobx", "import_mobx_react", "import_jsx_runtime", "canvasStyle", "ReferenceStripOverlay", "model", "ref", "referenceStripShown", "paneWidth", "canvasHeight", "canvas", "frame", "ctx", "dpr", "width", "height", "drawReferenceStrip", "ReferenceStripOverlay_default", "SWATCH_PX", "RAMP_SWATCH", "SAMPLED_BLOCKS", "sampledSwatch", "colors", "distinct", "c", "i", "picked", "_", "LIFT_BACKDROP_CSS", "StripSwatch", "rows", "key", "background", "stripRows", "w", "encodingSwatchCss", "b", "OverhangSwatch", "ReferenceStripLegend", "rowPerWalk", "legendBoxStyle", "legendRowStyle", "import_react", "import_canvas2dUtils", "import_mobx", "import_mobx_react", "import_jsx_runtime", "canvasStyle", "TubeMapOverlay", "model", "ref", "tubeMapPicture", "paneWidth", "canvasHeight", "canvas", "picture", "frame", "ctx", "dpr", "width", "height", "tubeFrame", "drawTubeMap", "drawDeviationMarks", "drawTubeMapConnectors", "bounds", "drawTubeMapGenes", "boxes", "drawTubeMapRuler", "TubeMapOverlay_default", "SWATCH_PX", "BracketSwatch", "brackets", "x0", "x1", "rulerInk", "barSwatchStyle", "tubeSwatchStyle", "TickSwatch", "deviationInk", "ReadSwatch", "colors", "step", "stops", "c", "i", "glyphSwatchStyle", "DeletionSwatch", "LegendRow", "swatch", "children", "legendRowStyle", "TubeMapLegend", "logWidths", "foldBp", "forwardReads", "reverseReads", "mismatches", "reads", "sampled", "rows", "FORWARD_READ_COLORS", "REVERSE_READ_COLORS", "formatBp", "legendBoxStyle", "import_material", "import_mobx_react", "import_jsx_runtime", "style", "UnpopButton", "model", "poppedFrom", "UnpopButton_default", "import_ui", "import_mobx_react", "import_jsx_runtime", "WalkRowContextMenu", "model", "row", "bars", "top", "left", "onClose", "target", "assembly", "callback", "locLabel", "LineStyle_default", "import_react", "import_mobx_react", "import_jsx_runtime", "svgStyle", "CALL_TICK", "UNBACKED_TICK", "swatchStyle", "BAR_PX", "tickSwatchStyle", "TickSwatch", "color", "Swatch", "swatch", "GENE_INK", "GAP_PX", "WalkRowsLegend", "model", "bars", "calls", "row", "key", "walkRowsKey", "RAMP_GRADIENT_CSS", "legendBoxStyle", "entry", "legendRowStyle", "call", "DISAGREES", "WalkRowsOverlay", "idPrefix", "width", "canvasHeight", "ElTree", "walkRowsTree", "WalkRowsOverlay_default", "import_react", "import_mobx_state_tree", "import_mobx_react", "import_jsx_runtime", "keyStyle", "tipStyle", "StripBars", "bars", "frame", "ramp", "rowGenes", "idPrefix", "tree", "walkRowsTree", "ElTree", "WalkStrip", "model", "menu", "setMenu", "tip", "setTip", "hit", "e", "box", "x", "y", "stripRowAt", "key", "walkRowsKey", "RAMP_GRADIENT_CSS", "stripGeneGaps", "at", "walkRowReadout", "walkMarksTree", "walkStripLabelsTree", "l", "entry", "legendRowStyle", "Swatch", "WalkRowContextMenu", "WalkStrip_default", "import_mobx_react", "import_jsx_runtime", "svgStyle", "WalkStripLocator", "model", "at", "WalkStripLocator_default", "createGraphRenderer", "canvas", "Canvas2DRenderer", "import_jsx_runtime", "tooltipStyle", "wrapperStyle", "canvasAreaStyle", "paperStyle", "loadingLayerStyle", "rowLabelStyle", "RowLabels", "model", "rowLabels", "label", "y", "screenY", "legendStackStyle", "LEGEND_INSET_PX", "pathSwatchStyle", "PathLegend", "pathLegend", "legendBoxStyle", "name", "color", "legendRowStyle", "WalkReadout", "lift", "w", "WalkKey", "OffReferenceRow", "walkSwatchStyle", "LIFT_BACKDROP_CSS", "rampStripStyle", "RAMP_GRADIENT_CSS", "rampEndsStyle", "ReferenceRampLegend", "domain", "offReference", "unplaced", "start", "end", "formatBp", "UNPLACED_SWATCH", "REFERENCE_RAMP_ALT_CSS", "exonSwatchStyle", "EXON_COLOR", "GeneLegend", "pin", "nodeLabelStyle", "deletionLabelStyle", "leaderStyle", "Legends", "ref", "el", "observer", "ReferenceStripLegend", "HaloLegend", "TubeMapLegend", "WalkRowsLegend", "GraphSizeLabels", "labels", "leaders", "key", "leader", "arcX", "arcY", "labelX", "labelY", "text", "x", "kind", "HoverTooltips", "hoveredNodeData", "hoveredEdgeData", "ownLocation", "nodeOwnLocation", "hoveredDeletion", "d", "locLabel", "NodeContextMenu", "nodeId", "top", "left", "onClose", "own", "reference", "highlight", "callback", "Info_default", "nodeLaunchMenuItems", "target", "GraphCanvas", "ownChrome", "canvasRef", "canvas", "renderError", "retryRender", "createGraphRenderer", "handlers", "contextNode", "contextRow", "closeContextMenu", "usePaneGestures", "useWheelZoom", "faceted", "GraphToolbar_default", "FacetPanels_default", "TubeMapOverlay_default", "ReferenceStripOverlay_default", "BubbleHalos_default", "GenePins_default", "LabelLayer_default", "WalkRowsOverlay_default", "WalkStripLocator_default", "UnpopButton_default", "WalkStrip_default", "WalkRowContextMenu", "GraphCanvas_default"]
7
+ }
@@ -0,0 +1,5 @@
1
+ import{b as M}from"./chunk-7BKUWQE5.js";import{a as d,b as k,c as w,d as u,e as N}from"./chunk-KULNKXPT.js";var O="unknown";function T(e){let t=e.split(" ");return{fields:t,name:t.slice(1,4).join(" "),start:+t[4],end:+t[5]}}var P=e=>e.fields[6].match(/[<>][^<>]+/g)??[];function j(e){let t=new Map;for(let s of e)if(s.startsWith("S ")){let[,n,o,...i]=s.split(" "),a=i.find(r=>r.startsWith("LN:i:"));t.set(n,o==="*"&&a?+a.slice(5):o.length)}return t}function v(e,t,s){if(t.end<=e.end)return e;let n=P(t),o=t.start;for(let[i,a]of n.entries()){if(o===e.end){let f=[...e.fields];return f[5]=String(t.end),f[6]=e.fields[6]+n.slice(i).join(""),{...e,fields:f,end:t.end}}let r=s.get(a.slice(1));if(o>e.end||r===void 0)return;o+=r}}function A(e,t,s){let n=[];for(let o of e.sort((i,a)=>i.start-a.start)){let i=n.at(-1),[,a,r,f]=o.fields,m=i!==void 0&&(o.start<i.end||o.start===i.end&&!s(a,+r,f,o.start))?v(i,o,t):void 0;m?n[n.length-1]=m:n.push(o)}return n}var L=e=>e==="+"?"-":"+";function*_(e){let t=P(e).map(s=>({id:s.slice(1),sign:s.startsWith(">")?"+":"-"}));for(let s=1;s<t.length;s++){let n=t[s-1],o=t[s];yield{forward:`L ${n.id} ${n.sign} ${o.id} ${o.sign} 0M`,reverse:`L ${o.id} ${L(o.sign)} ${n.id} ${L(n.sign)} 0M`}}}function B(e,t){if(e.length<=1)return e[0]??"";let s=e.map(c=>c.split(`
2
+ `).filter(p=>p!=="")),n=(c,p)=>c.filter(b=>b.startsWith(`${p} `)),o=j(s.flat()),i=0,a=s.map(c=>{let p=n(c,"W").map(T),b=i;for(let g of p.filter(h=>h.fields[1]===O)){let h=+g.fields[2]+b;g.fields[2]=String(h),g.name=g.fields.slice(1,4).join(" "),i=Math.max(i,h)}return p}),r=new Map;for(let c of[...a.flatMap(p=>p.slice(0,1)),...a.flatMap(p=>p.slice(1))]){let p=r.get(c.name);p?p.push(c):r.set(c.name,[c])}let f=[...r.values()].flatMap(c=>A(c,o,t)),l=new Set(s.flatMap(c=>n(c,"L")));for(let c of f)for(let p of _(c))!l.has(p.forward)&&!l.has(p.reverse)&&l.add(p.forward);return`${[...new Set([...n(s[0],"H"),...s.flatMap(c=>n(c,"S")),...l,...f.map(c=>c.fields.join(" "))])].join(`
3
+ `)}
4
+ `}var E=new Map([["hg38","GRCh38"],["hg19","GRCh37"],["hs1","CHM13"],["t2t-chm13","CHM13"],["chm13v2","CHM13"]]);function x(e){return E.get(e.toLowerCase())}function W(e){let t=e.includes("#")?d(e):void 0;return t===void 0||k(t)?void 0:t}function C(e){return w(e)??d(e)}function $(e){let t=new Set((e.anchorPaths??[]).map(n=>n.name));for(let n of e.nodes)n.stable&&t.add(n.stable.refName);let s=new Map;for(let n of t){let o=W(n);o!==void 0&&(s.get(o)??s.set(o,new Set).get(o)).add(C(n))}return s}function G(e,t){let s=new Set(e.map(f=>W(f.refName))),[n]=s;if(s.size!==1||n===void 0)return{contigs:e,prefixes:[],named:!1};let o=new Set(e.map(f=>C(f.refName))),i=[...t.get(n)??[]].every(f=>o.has(f)),a=new Set(e.map(f=>w(f.refName))),[r]=a;return{contigs:e,prefixes:[...i?[n]:[],...a.size===1&&r?[r]:[]],named:!0}}function z(e){let t=new Map;for(let n of e.nodes)if(M(n)){let{refName:o,start:i}=n.stable,a=i+n.length,r=t.get(o);r?(r.start=Math.min(r.start,i),r.end=Math.max(r.end,a)):t.set(o,{refName:o,contig:u(o),start:i,end:a})}let s=[...t.values()];return s.length?G(s,$(e)):void 0}function D(e,t){let s=z(e),n=t?u(t.refName):s?.contigs.length===1?s.contigs[0].contig:void 0,o=s?.named?d(s.contigs[0].refName):void 0;return n&&(o?`${o} ${n}`:n)}function H(e,t){let s=a=>[a.name,...a.aliases??[]],n=a=>r=>s(r).some(f=>f.toLowerCase()===a.toLowerCase()),o=[...e?.prefixes??[]].reverse(),i=e?.prefixes.find(a=>!a.includes("#"))?.toLowerCase();for(let a of o){let r=t.find(n(a));if(r)return r}return i===void 0?void 0:t.find(a=>s(a).some(r=>x(r)?.toLowerCase()===i))}function J(e,t){let s=$(e);return e.anchorPaths?.find(n=>H(G([{refName:n.name,contig:u(n.name),start:n.start,end:n.start+n.length}],s),[t]))}function R(e){let t=e.replace(/^chr/i,""),s=t?/^(M|MT)$/i.test(t)?["M","MT"]:[t]:[];return[...new Set([e,...s.flatMap(n=>[n,`chr${n}`])])]}function Z(e,t={}){let s=new Set(e),n=new Map;for(let o of s){let i=u(o),a=t[i];for(let r of new Set([...R(i),...a?[a]:[]]))n.set(r,n.has(r)?void 0:o)}return o=>s.has(o)?o:n.get(o)}function V(e,t,s){let n=Z(t.contigs.map(o=>o.refName),s);return e.flatMap(o=>{let i=n(o.refName);return i===void 0?[]:[i===o.refName?o:{...o,refName:i}]})}var y=class extends Error{constructor(s,n){super(n.length===0?`the graph names no reference sample (gbwt_reference_samples) and the anchor "${s}" maps to none; set referenceSample`:`the anchor "${s}" is none of the graph's reference samples (${n.join(", ")}); set referenceSample or map it through assemblyNameToPanSN`);this.name="NoReferenceSampleError"}},S=class extends Error{constructor(s,n,o){super(`this ${n.toLocaleString()} bp window reads more than nodeLimit (${s.toLocaleString()}) graph nodes; zoom in to about ${o.toLocaleString()} bp or raise nodeLimit`);this.fitsBp=o;this.name="NodeLimitError";this.regionTooLarge=!0}};function F(e){return`${e.sample}#${e.haplotype}`}function te(e,t){let s=F(e);return t===void 0||t.some(n=>N(s,n))}async function se(e){return(await e.tag("gbwt_reference_samples")??"").split(/\s+/).filter(t=>t!=="")}function K(e,t){let s=e.toLowerCase(),n=x(e)?.toLowerCase();return t.find(o=>o===e)??t.find(o=>o.toLowerCase()===s)??t.find(o=>o.toLowerCase()===n)}function oe({configured:e,anchorPrefix:t,referenceSamples:s}){if(e!=="")return e;let n=K(d(t),s)??(s.length===1?s[0]:void 0);if(n===void 0)throw new y(t,s);return n}async function re(e,t,s){let n=(await e.paths()).find(o=>o.isIndexed&&o.name.sample===t&&o.name.contig===s);return n?{sample:n.name.sample,contig:s,haplotype:n.name.haplotype}:void 0}function Q(e,t,s){if(e instanceof Error&&(e.name==="SubgraphLimitError"||/^Subgraph size limit of \d+ nodes exceeded/.test(e.message))){let o=e.walkedBp,i=typeof o=="number"&&o>0?Math.floor(o*.8):Math.floor(s/2);return new S(t,s,Math.max(i,1))}else return}var ie={context:1e3,snarls:"contained",limit:1e5};async function ae(e,t,s,n,o){if(!t)return"";let i=await e.getSubgraphs({...o,path:t,start:s,end:n,haplotypes:"all"}).catch(r=>{throw Q(r,o.limit,n-s)??r}),a=await e.paths();return B(await Promise.all(i.map(r=>r.toGFA())),(r,f,l,m)=>a.some(({name:c})=>c.sample===r&&c.haplotype===f&&c.contig===l&&c.fragment===m))}export{z as a,D as b,H as c,J as d,V as e,y as f,S as g,F as h,te as i,se as j,oe as k,re as l,Q as m,ie as n,ae as o};
5
+ //# sourceMappingURL=chunk-FNHKEAKB.js.map