jbrowse-plugin-graphgenomeviewer 8.1.0 → 8.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 (72) hide show
  1. package/dist/chunks/{AddTrackWorkflow-RJSOQZYQ.js → AddTrackWorkflow-7CXTSSMR.js} +2 -2
  2. package/dist/chunks/{GbzBaseSyntenyAdapter-OHJ4QDMX.js → GbzBaseSyntenyAdapter-EJIR3HZM.js} +2 -2
  3. package/dist/chunks/{GraphGenomeView-RWQUR473.js → GraphGenomeView-2AKRM74B.js} +2 -2
  4. package/dist/chunks/{GraphTrackSettingsDialog-IQZGEFCA.js → GraphTrackSettingsDialog-7XRZQW6T.js} +2 -2
  5. package/dist/chunks/{LinearGraphDisplay-YDUG4J53.js → LinearGraphDisplay-WWQ73BO5.js} +2 -2
  6. package/dist/chunks/{MinigraphBubbleAdapter-EVYS6XUZ.js → MinigraphBubbleAdapter-4OOBJ44C.js} +2 -2
  7. package/dist/chunks/RgfaTabixAdapter-CEGFN2QY.js +2 -0
  8. package/dist/chunks/RgfaTabixAdapter-CEGFN2QY.js.map +7 -0
  9. package/dist/chunks/{WalkFormsAdapter-SG4LLHHS.js → WalkFormsAdapter-LTAKACZD.js} +2 -2
  10. package/dist/chunks/{WalkTabixSyntenyAdapter-NEZMRCRO.js → WalkTabixSyntenyAdapter-B6V3YNW7.js} +2 -2
  11. package/dist/chunks/chunk-5FNGR33G.js +2 -0
  12. package/dist/chunks/chunk-5FNGR33G.js.map +7 -0
  13. package/dist/chunks/chunk-6VNDP3UB.js +2 -0
  14. package/dist/chunks/chunk-6VNDP3UB.js.map +7 -0
  15. package/dist/chunks/chunk-CZXJXNZN.js +3 -0
  16. package/dist/chunks/chunk-CZXJXNZN.js.map +7 -0
  17. package/dist/chunks/{chunk-5EWKB2JM.js → chunk-MCBYBZZJ.js} +2 -2
  18. package/dist/chunks/{chunk-IL5HOUFN.js → chunk-NOXHIOIM.js} +2 -2
  19. package/dist/chunks/{chunk-OG7MODXE.js → chunk-OLZZDBQJ.js} +2 -2
  20. package/dist/chunks/{chunk-PKMASUMB.js → chunk-PTOKTIQG.js} +2 -2
  21. package/dist/chunks/{chunk-B7MGDESF.js → chunk-QWG7NASD.js} +2 -2
  22. package/dist/chunks/chunk-SL4JJJQJ.js +3 -0
  23. package/dist/chunks/chunk-SL4JJJQJ.js.map +7 -0
  24. package/dist/chunks/{chunk-6ZZJCKX5.js → chunk-UECOGSWM.js} +2 -2
  25. package/dist/chunks/{chunk-MK3U4D2U.js → chunk-UHV6XIDG.js} +2 -2
  26. package/dist/chunks/{chunk-PDLKFVVK.js → chunk-WUOXZAGN.js} +2 -2
  27. package/dist/chunks/{renderSvg-APVNMW6O.js → renderSvg-E5Q7MLCH.js} +2 -2
  28. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +5 -5
  29. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +3 -3
  30. package/package.json +2 -2
  31. package/src/GraphAddTrackWorkflow/buildTrackConfig.ts +12 -2
  32. package/src/GraphAddTrackWorkflow/graphManifest.ts +16 -9
  33. package/src/GraphGenomeView/pane/paneBase.ts +14 -9
  34. package/src/RgfaTabixAdapter/RgfaTabixAdapter.ts +94 -41
  35. package/src/RgfaTabixAdapter/configSchema.ts +35 -4
  36. package/src/RgfaTabixAdapter/format2.test.ts +128 -0
  37. package/src/RgfaTabixAdapter/test_data/pggb_ecoli_f1.links.bed.gz +0 -0
  38. package/src/RgfaTabixAdapter/test_data/pggb_ecoli_f1.links.bed.gz.tbi +0 -0
  39. package/src/RgfaTabixAdapter/test_data/pggb_ecoli_f1.segs.bed.gz +0 -0
  40. package/src/RgfaTabixAdapter/test_data/pggb_ecoli_f1.segs.bed.gz.tbi +0 -0
  41. package/src/RgfaTabixAdapter/test_data/pggb_ecoli_f2.graph.bed.gz +0 -0
  42. package/src/RgfaTabixAdapter/test_data/pggb_ecoli_f2.graph.bed.gz.tbi +0 -0
  43. package/src/graphTrackDefaults/index.ts +2 -2
  44. package/src/locationName.ts +2 -0
  45. package/src/version.ts +1 -1
  46. package/dist/chunks/RgfaTabixAdapter-QD2AJSBK.js +0 -2
  47. package/dist/chunks/RgfaTabixAdapter-QD2AJSBK.js.map +0 -7
  48. package/dist/chunks/chunk-AH5UWTAV.js +0 -2
  49. package/dist/chunks/chunk-AH5UWTAV.js.map +0 -7
  50. package/dist/chunks/chunk-IKJZPPOA.js +0 -2
  51. package/dist/chunks/chunk-IKJZPPOA.js.map +0 -7
  52. package/dist/chunks/chunk-MJS65EKE.js +0 -3
  53. package/dist/chunks/chunk-MJS65EKE.js.map +0 -7
  54. package/dist/chunks/chunk-TBNAAP6E.js +0 -3
  55. package/dist/chunks/chunk-TBNAAP6E.js.map +0 -7
  56. /package/dist/chunks/{AddTrackWorkflow-RJSOQZYQ.js.map → AddTrackWorkflow-7CXTSSMR.js.map} +0 -0
  57. /package/dist/chunks/{GbzBaseSyntenyAdapter-OHJ4QDMX.js.map → GbzBaseSyntenyAdapter-EJIR3HZM.js.map} +0 -0
  58. /package/dist/chunks/{GraphGenomeView-RWQUR473.js.map → GraphGenomeView-2AKRM74B.js.map} +0 -0
  59. /package/dist/chunks/{GraphTrackSettingsDialog-IQZGEFCA.js.map → GraphTrackSettingsDialog-7XRZQW6T.js.map} +0 -0
  60. /package/dist/chunks/{LinearGraphDisplay-YDUG4J53.js.map → LinearGraphDisplay-WWQ73BO5.js.map} +0 -0
  61. /package/dist/chunks/{MinigraphBubbleAdapter-EVYS6XUZ.js.map → MinigraphBubbleAdapter-4OOBJ44C.js.map} +0 -0
  62. /package/dist/chunks/{WalkFormsAdapter-SG4LLHHS.js.map → WalkFormsAdapter-LTAKACZD.js.map} +0 -0
  63. /package/dist/chunks/{WalkTabixSyntenyAdapter-NEZMRCRO.js.map → WalkTabixSyntenyAdapter-B6V3YNW7.js.map} +0 -0
  64. /package/dist/chunks/{chunk-5EWKB2JM.js.map → chunk-MCBYBZZJ.js.map} +0 -0
  65. /package/dist/chunks/{chunk-IL5HOUFN.js.map → chunk-NOXHIOIM.js.map} +0 -0
  66. /package/dist/chunks/{chunk-OG7MODXE.js.map → chunk-OLZZDBQJ.js.map} +0 -0
  67. /package/dist/chunks/{chunk-PKMASUMB.js.map → chunk-PTOKTIQG.js.map} +0 -0
  68. /package/dist/chunks/{chunk-B7MGDESF.js.map → chunk-QWG7NASD.js.map} +0 -0
  69. /package/dist/chunks/{chunk-6ZZJCKX5.js.map → chunk-UECOGSWM.js.map} +0 -0
  70. /package/dist/chunks/{chunk-MK3U4D2U.js.map → chunk-UHV6XIDG.js.map} +0 -0
  71. /package/dist/chunks/{chunk-PDLKFVVK.js.map → chunk-WUOXZAGN.js.map} +0 -0
  72. /package/dist/chunks/{renderSvg-APVNMW6O.js.map → renderSvg-E5Q7MLCH.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{i as M,l as W,p as F}from"./chunk-PDLKFVVK.js";import{b as O,h as A}from"./chunk-T2VC3EEL.js";import{K as b,Q as _,X as B}from"./chunk-CVHKXFVS.js";import{f as R}from"./chunk-NIEZKWQV.js";import{D as E,E as P,H as m,d as v,o as T,q as I,r as L,s as w,t as N,w as D,y as G,z as x}from"./chunk-5Z4VIKXZ.js";import{b as t,c as r,d as C}from"./chunk-JMBDTNUR.js";var S=[{value:0,label:"Fastest"},{value:1,label:"Fast"},{value:2,label:"Default"},{value:3,label:"Fine"},{value:4,label:"Best"}];function f({label:o,value:n,options:e,testId:s,size:d,sx:p,disabled:a,title:h,shown:g,onChange:z}){let k=R();return r(w,{size:d,sx:p,disabled:a,title:h,children:[t(D,{id:k,shrink:!0,children:o}),t(E,{labelId:k,value:n,label:o,notched:!0,displayEmpty:!0,"data-testid":s,renderValue:i=>g??e.find(H=>H.value===i)?.label??i,onChange:i=>{z(i.target.value)},children:e.map(i=>t(x,{value:i.value,disabled:i.disabled,title:i.disabled?void 0:i.description,children:t(G,{primary:i.label,secondary:i.disabled?i.description:void 0})},i.value))})]})}var u=F()({section:{marginBottom:24},group:{marginBottom:16},heading:{marginBottom:8}});function l({warn:o=!1,children:n}){return t(m,{variant:"caption",component:"div",color:o?"warning.main":"text.secondary",children:n})}function y({title:o,children:n}){let{classes:e}=u();return r("section",{className:e.group,children:[t(m,{variant:"subtitle1",className:e.heading,children:o}),n]})}function U({label:o,checked:n,onChange:e,children:s}){let{classes:d}=u();return r("div",{className:d.section,children:[t(N,{control:t(P,{checked:n,onChange:p=>{e(p.target.checked)}}),label:o}),s]})}function c({children:o,...n}){let{classes:e}=u();return r("div",{className:e.section,children:[t(f,{sx:{minWidth:200},...n}),o]})}var Y=[5e3,2e4,5e4,1e5];function $(o){return[...new Set([...Y,o])].sort((n,e)=>n-e).map(n=>({value:String(n),label:n.toLocaleString()}))}function Q({label:o,choices:n,stored:e,auto:s,testId:d,onChange:p,children:a}){return n.length>0?t(c,{label:o,value:n.some(h=>h.trackId===e)?e:"",options:[{value:"",label:`Automatic (${s?.name??"none"})`},...n.map(({trackId:h,name:g})=>({value:h,label:g}))],testId:d,onChange:p,children:a}):null}var q=C(function(n){let{model:e,onClose:s,children:d}=n,{classes:p}=u();return r(v,{open:!0,onClose:s,title:"Graph settings",children:[r(L,{children:[r(y,{title:"Subgraph",children:[d,t(c,{label:"Node limit",value:String(e.maxGraphNodes),options:$(e.maxGraphNodes),testId:"graph-node-limit-select",onChange:a=>{e.setMaxGraphNodes(Number(a))},children:t(l,{children:"The most nodes a layout draws; past it the graph is declined. Walk rows take no limit."})})]}),r(y,{title:"Drawing",children:[e.anchorPaths.length>1?t(c,{label:"Reference path",value:e.activeReferencePath??"",options:e.anchorPaths.map(({name:a})=>({value:a,label:a})),testId:"graph-reference-path-select",onChange:a=>{e.setReferencePath(a),e.recomputeLayout()},children:t(l,{children:"The path the anchored layouts place x along"})}):null,t(c,{label:"Node width",value:e.nodeWidth,options:_,testId:"graph-node-width-select",onChange:a=>{e.setNodeWidth(a)},children:t(l,{children:"Depth as width. In a cut with walks, depth is how many haplotypes carry the node."})}),t(c,{label:"Link width",value:e.linkWidth,options:B,testId:"graph-link-width-select",onChange:a=>{e.setLinkWidth(a)},children:t(l,{children:"Walks as width, so a common route reads heavy and a private one thin."})}),r(U,{label:"Draw paths",checked:e.drawPaths,onChange:a=>{e.setLayer("paths",a)},children:[t(l,{children:"Color each node by the paths through it, one lane per path"}),e.drawPaths&&!e.effectiveDrawPaths?t(l,{warn:!0,children:e.pathCount>b?`Off: ${e.pathCount.toLocaleString()} paths is past the ${b} this can tell apart`:"Off: this graph states no paths"}):null]}),t(Q,{label:"Gene track",choices:e.geneTrackChoices,stored:e.geneTrackId,auto:W(e.geneTrackChoices,""),testId:"graph-gene-track-select",onChange:a=>{e.setGeneTrackId(a)},children:t(l,{children:"Where genes on the backbone come from"})}),t(Q,{label:"Repeat track",choices:e.repeatTrackChoices,stored:e.repeatTrackId,auto:M(e.repeatTrackChoices,""),testId:"graph-repeat-track-select",onChange:a=>{e.setRepeatTrackId(a)},children:t(l,{children:"The tandem repeat annotation walk rows measure and tile by"})})]}),r(y,{title:"Force-directed layout",children:[e.hasGraph&&!e.usesLayoutEngine?t("div",{className:p.section,children:t(l,{warn:!0,children:"No effect on the current layout until Layout is Force-directed"})}):null,t(c,{label:"Engine",value:e.layoutEngine,options:O,testId:"graph-layout-engine-select",onChange:a=>{e.setLayoutEngine(a)},children:t(l,{children:"Stress keeps the reference straight, so a zoom keeps the picture; FMMM lets the whole graph settle."})}),t(c,{label:"Layout quality",value:String(e.layoutQuality),options:S.map(a=>({value:String(a.value),label:a.label})),testId:"graph-layout-quality-select",onChange:a=>{e.setLayoutQuality(Number(a))},children:t(l,{children:"The engine's iteration budget; higher is slower"})}),t(c,{label:"Bubble spread",value:e.bubbleSpread,options:A,testId:"graph-bubble-spread-select",onChange:a=>{e.setBubbleSpread(a)},children:t(l,{children:"How far the layout opens a bubble"})}),e.layoutEngine==="stress"?null:t(U,{label:"Linear layout",checked:e.linearLayout,onChange:a=>{e.setLinearLayout(a)},children:t(l,{children:"Keeps a chain of nodes on one line where it can"})})]})]}),t(I,{children:t(T,{variant:"contained",color:"primary",onClick:s,children:"Close"})})]})}),ge=q;export{f as a,ge as b};
2
- //# sourceMappingURL=chunk-6ZZJCKX5.js.map
1
+ import{i as M,l as W,p as F}from"./chunk-WUOXZAGN.js";import{b as O,h as A}from"./chunk-T2VC3EEL.js";import{K as b,Q as _,X as B}from"./chunk-CVHKXFVS.js";import{f as R}from"./chunk-NIEZKWQV.js";import{D as E,E as P,H as m,d as v,o as T,q as I,r as L,s as w,t as N,w as D,y as G,z as x}from"./chunk-5Z4VIKXZ.js";import{b as t,c as r,d as C}from"./chunk-JMBDTNUR.js";var S=[{value:0,label:"Fastest"},{value:1,label:"Fast"},{value:2,label:"Default"},{value:3,label:"Fine"},{value:4,label:"Best"}];function f({label:o,value:n,options:e,testId:s,size:d,sx:p,disabled:a,title:h,shown:g,onChange:z}){let k=R();return r(w,{size:d,sx:p,disabled:a,title:h,children:[t(D,{id:k,shrink:!0,children:o}),t(E,{labelId:k,value:n,label:o,notched:!0,displayEmpty:!0,"data-testid":s,renderValue:i=>g??e.find(H=>H.value===i)?.label??i,onChange:i=>{z(i.target.value)},children:e.map(i=>t(x,{value:i.value,disabled:i.disabled,title:i.disabled?void 0:i.description,children:t(G,{primary:i.label,secondary:i.disabled?i.description:void 0})},i.value))})]})}var u=F()({section:{marginBottom:24},group:{marginBottom:16},heading:{marginBottom:8}});function l({warn:o=!1,children:n}){return t(m,{variant:"caption",component:"div",color:o?"warning.main":"text.secondary",children:n})}function y({title:o,children:n}){let{classes:e}=u();return r("section",{className:e.group,children:[t(m,{variant:"subtitle1",className:e.heading,children:o}),n]})}function U({label:o,checked:n,onChange:e,children:s}){let{classes:d}=u();return r("div",{className:d.section,children:[t(N,{control:t(P,{checked:n,onChange:p=>{e(p.target.checked)}}),label:o}),s]})}function c({children:o,...n}){let{classes:e}=u();return r("div",{className:e.section,children:[t(f,{sx:{minWidth:200},...n}),o]})}var Y=[5e3,2e4,5e4,1e5];function $(o){return[...new Set([...Y,o])].sort((n,e)=>n-e).map(n=>({value:String(n),label:n.toLocaleString()}))}function Q({label:o,choices:n,stored:e,auto:s,testId:d,onChange:p,children:a}){return n.length>0?t(c,{label:o,value:n.some(h=>h.trackId===e)?e:"",options:[{value:"",label:`Automatic (${s?.name??"none"})`},...n.map(({trackId:h,name:g})=>({value:h,label:g}))],testId:d,onChange:p,children:a}):null}var q=C(function(n){let{model:e,onClose:s,children:d}=n,{classes:p}=u();return r(v,{open:!0,onClose:s,title:"Graph settings",children:[r(L,{children:[r(y,{title:"Subgraph",children:[d,t(c,{label:"Node limit",value:String(e.maxGraphNodes),options:$(e.maxGraphNodes),testId:"graph-node-limit-select",onChange:a=>{e.setMaxGraphNodes(Number(a))},children:t(l,{children:"The most nodes a layout draws; past it the graph is declined. Walk rows take no limit."})})]}),r(y,{title:"Drawing",children:[e.anchorPaths.length>1?t(c,{label:"Reference path",value:e.activeReferencePath??"",options:e.anchorPaths.map(({name:a})=>({value:a,label:a})),testId:"graph-reference-path-select",onChange:a=>{e.setReferencePath(a),e.recomputeLayout()},children:t(l,{children:"The path the anchored layouts place x along"})}):null,t(c,{label:"Node width",value:e.nodeWidth,options:_,testId:"graph-node-width-select",onChange:a=>{e.setNodeWidth(a)},children:t(l,{children:"Depth as width. In a cut with walks, depth is how many haplotypes carry the node."})}),t(c,{label:"Link width",value:e.linkWidth,options:B,testId:"graph-link-width-select",onChange:a=>{e.setLinkWidth(a)},children:t(l,{children:"Walks as width, so a common route reads heavy and a private one thin."})}),r(U,{label:"Draw paths",checked:e.drawPaths,onChange:a=>{e.setLayer("paths",a)},children:[t(l,{children:"Color each node by the paths through it, one lane per path"}),e.drawPaths&&!e.effectiveDrawPaths?t(l,{warn:!0,children:e.pathCount>b?`Off: ${e.pathCount.toLocaleString()} paths is past the ${b} this can tell apart`:"Off: this graph states no paths"}):null]}),t(Q,{label:"Gene track",choices:e.geneTrackChoices,stored:e.geneTrackId,auto:W(e.geneTrackChoices,""),testId:"graph-gene-track-select",onChange:a=>{e.setGeneTrackId(a)},children:t(l,{children:"Where genes on the backbone come from"})}),t(Q,{label:"Repeat track",choices:e.repeatTrackChoices,stored:e.repeatTrackId,auto:M(e.repeatTrackChoices,""),testId:"graph-repeat-track-select",onChange:a=>{e.setRepeatTrackId(a)},children:t(l,{children:"The tandem repeat annotation walk rows measure and tile by"})})]}),r(y,{title:"Force-directed layout",children:[e.hasGraph&&!e.usesLayoutEngine?t("div",{className:p.section,children:t(l,{warn:!0,children:"No effect on the current layout until Layout is Force-directed"})}):null,t(c,{label:"Engine",value:e.layoutEngine,options:O,testId:"graph-layout-engine-select",onChange:a=>{e.setLayoutEngine(a)},children:t(l,{children:"Stress keeps the reference straight, so a zoom keeps the picture; FMMM lets the whole graph settle."})}),t(c,{label:"Layout quality",value:String(e.layoutQuality),options:S.map(a=>({value:String(a.value),label:a.label})),testId:"graph-layout-quality-select",onChange:a=>{e.setLayoutQuality(Number(a))},children:t(l,{children:"The engine's iteration budget; higher is slower"})}),t(c,{label:"Bubble spread",value:e.bubbleSpread,options:A,testId:"graph-bubble-spread-select",onChange:a=>{e.setBubbleSpread(a)},children:t(l,{children:"How far the layout opens a bubble"})}),e.layoutEngine==="stress"?null:t(U,{label:"Linear layout",checked:e.linearLayout,onChange:a=>{e.setLinearLayout(a)},children:t(l,{children:"Keeps a chain of nodes on one line where it can"})})]})]}),t(I,{children:t(T,{variant:"contained",color:"primary",onClick:s,children:"Close"})})]})}),ge=q;export{f as a,ge as b};
2
+ //# sourceMappingURL=chunk-UECOGSWM.js.map
@@ -1,2 +1,2 @@
1
- import{a as W,b as vt}from"./chunk-6ZZJCKX5.js";import{B as St,C as xt,a as tt,b as nt,c as ee,d as ot,e as rt,f as te,h as at,i as it,j as st,k as lt,l as ct,m as pt,o as ne,p as ut,q as oe,r as dt,t as ue,u as ft,v as ht,w as yt,x as bt,z as wt}from"./chunk-5EWKB2JM.js";import{N as Je,O as Qe,R as pe,T as et,U as mt,V as gt,a as x,c as He,f as J,g as Ae,h as _e,q as ze,r as Oe,t as $e,u as je,v as Ke,w as qe}from"./chunk-OG7MODXE.js";import{p as z}from"./chunk-PDLKFVVK.js";import{Ca as Ye,Fb as A,J as se,Ja as Ze,Jb as le,Lb as ce,N as Q,Nb as F,R as Xe,T as Be,a as X,b as be,ca as Fe,gc as Ue,q as We,r as Ne,va as Ve}from"./chunk-MJS65EKE.js";import{n as De}from"./chunk-W7IHIVSE.js";import{e as T}from"./chunk-3WG3GF2A.js";import{j as K}from"./chunk-J5RMHLFJ.js";import{a as Ie,e as H,f as Ge,g as Te,h as k,i as C}from"./chunk-NIEZKWQV.js";import{D as Ee,G as U,H as B,b as we,c as Se,e as ie,k as xe,o as Pe,p as Me,s as ke,v as q,w as Re,y as Ce,z as Le}from"./chunk-5Z4VIKXZ.js";import{a as G,b as n,c as f,d as h}from"./chunk-JMBDTNUR.js";function Pt(t){return Promise.resolve(new A(t))}var _=JBrowseExports["@jbrowse/render-core/useRenderingBackend"],hn=t=>_!=null&&t in Object(_)?_[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/render-core/useRenderingBackend' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t});var Mt=hn("useRenderingBackend"),bo=_&&_.__esModule?_.default:_;var de=nt(1);function fe({model:t}){let[e,o]=C(null);return H(()=>{if(!e)return;let i=new A(e),r=X(()=>{Fe(Ue()),i.resize(t.paneWidth,t.canvasHeight),t.paintHover(i,t.drawnBatch)});return()=>{r(),i.dispose()}},[e,t]),n("canvas",{ref:o,"data-testid":"graph-hover-layer",style:de})}function re({row:t,at:e,hint:o,after:i,column:r}){let c=r===void 0?void 0:{paddingLeft:r+5};return t.swatch?f("div",{title:[t.title,o].filter(Boolean).join(" \xB7 ")||void 0,children:[f("div",{style:oe,children:[n("span",{style:{display:"flex",flex:"none",justifyContent:"center",width:r},children:n(ne,{swatch:t.swatch})}),f("span",{children:[t.strong?n("strong",{children:t.strong}):null,t.label]}),i]}),e?n("div",{style:c,"data-testid":"graph-walk-at",children:e}):t.under?n("div",{style:c,children:t.under}):null]}):n("div",{style:dt,children:t.label})}var mn={pointerEvents:"auto",cursor:"pointer",border:"none",background:"none",padding:"0 2px",font:"inherit",textDecoration:"underline"},kt=h(function({model:e}){let o=pt(e);if(o.length===0)return null;let i=o.flatMap(l=>l.rows),r=it(i),c=at(i);return n("div",{style:{...ut,lineHeight:`${r}px`},children:o.map(({testid:l,rows:p,heading:s,spaced:u},m)=>f(Ie,{children:[s?n("div",{style:{...ft,paddingTop:m===0?0:ue},children:s}):null,n("div",{"data-testid":l,style:u?{paddingTop:ue}:void 0,children:p.map(w=>n(re,{row:w,column:c,at:w.walk?e.hoveredOn(w.walk):void 0,after:w.closesBubble?n("button",{type:"button",style:mn,"data-testid":"graph-close-bubble",onClick:()=>{e.closeBubbles()},children:"close"}):null},w.key))})]},l))})});var gn={position:"absolute",left:0,top:0,zIndex:4,display:"grid",gap:We,lineHeight:"normal"},vn={height:Ne,padding:"2px 6px",boxSizing:"border-box",fontFamily:"inherit",fontSize:11,color:"inherit",cursor:"pointer",border:"none",background:"none",textAlign:"left",display:"block"},yn={position:"relative"},bn={gridColumn:"1 / -1",height:Qe,padding:"2px 6px",boxSizing:"border-box",display:"flex",gap:14,fontSize:11,lineHeight:"15px"},wn=h(function({model:e,lift:o,width:i,height:r,cell:c,handlers:l,canvasStyle:p}){let[s,u]=C(null),[m,w]=C(null),S=o.walks[0];H(()=>{if(!s||!m)return;let I=new A(s),O=new A(m),D=be(()=>e.buildDrawing(o,!1)),Z,$=[X(()=>{let R=e.facetGrid;R&&I.resize(R.width,R.height);let L=D.get();L&&(L!==Z&&(I.uploadGeometry(L.batch),Z=L),e.applySelection(I),e.paint(I))}),X(()=>{let R=e.facetGrid;R&&O.resize(R.width,R.height);let L=D.get();L&&e.paintHover(O,L.batch)})];return()=>{for(let R of $)R();I.dispose(),O.dispose()}},[s,m,e,o]);let N=e.walkLabel(S.name);return f("div",{style:c,children:[n("button",{type:"button",style:vn,"data-testid":"graph-facet-title",onClick:()=>{e.liftWalks([S.name]),e.setFacet("")},children:n(re,{row:lt(e,S),hint:`click to lift ${N} alone`,at:e.hoveredOn(S)})}),f("div",{style:yn,children:[n("canvas",{ref:u,"data-testid":"graph-facet-canvas",style:{...p,width:i,height:r,display:"block"},...l}),n("canvas",{ref:w,style:de})]})]})}),Sn=h(function({model:e,handlers:o,canvasStyle:i}){let r=e.facetPanels,c=e.facetGrid,l=e.facetPlacement;if(!r||!c||!l)return null;let{columns:p,width:s,height:u}=c;return f("div",{"data-testid":"graph-facet-panels",style:{...gn,width:e.paneWidth,minHeight:e.canvasHeight,gridTemplateColumns:`repeat(${p}, ${s}px)`,background:Q},children:[r.map((m,w)=>n(wn,{model:e,lift:m,width:s,height:u,cell:{gridRow:Math.floor(l.cells[w]/p)+1,gridColumn:l.cells[w]%p+1},handlers:o,canvasStyle:i},m.walks[0].name)),n("div",{style:{...bn,gridRow:Math.floor(l.cells.reduce((m,w)=>Math.max(m,w),-1/0)/p)+2},"data-testid":"graph-facet-key",children:ct(e).map(m=>n(re,{row:m},m.key))})]})}),Rt=Sn;var Ct=x(n("path",{d:"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2m2 10H3v4c0 1.1.9 2 2 2h4v-2H5zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2"}),"CropFree");var Lt=x([n("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"},"0"),n("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var Et=x(n("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14M7 9h5v1H7z"}),"ZoomOut");var xn=h(function({model:e}){let o=e.colorSchemeLock;return n(W,{label:"Color",size:"small",sx:{minWidth:100},disabled:o!==void 0,title:o?.why,shown:o?.value,value:e.chosenColorScheme,options:ze.map(({value:i})=>({value:i,label:e.colorSchemeLabel(i)})),testId:"graph-color-select",onChange:i=>{e.setColorScheme(i)}})}),It=xn;var Gt=z()({stats:{marginLeft:"auto"},perf:{color:"#888",fontVariantNumeric:"tabular-nums"}});function he(t){return t===void 0?"\u2013":`${Math.round(t)}ms`}var Pn=h(function({model:e}){let{classes:o}=Gt(),{lastFetchMs:i,lastLayoutMs:r,lastGeometryMs:c}=e,l=i!==void 0||r!==void 0||c!==void 0;return e.showPerf&&l?f(B,{variant:"caption",className:o.perf,"data-testid":"graph-perf-stats",children:["fetch ",he(i)," \xB7 layout ",he(r)," \xB7 geom"," ",he(c)]}):null}),Mn=h(function({model:e}){let{classes:o}=Gt();return f("div",{className:o.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:[f(B,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",n(Pn,{model:e})]})}),Tt=Mn;var kn=h(function({model:e}){let{graph:o}=e;return n(W,{label:"Layout",size:"small",sx:{minWidth:140},testId:"graph-layout-select",value:e.chosenLayoutMode,options:He.map(({value:i,label:r,description:c,available:l})=>({value:i,label:r,description:c,disabled:o?!l(o):!1})),onChange:i=>{e.switchLayout(i)}})}),Ht=kn;var Rn=h(function({model:e}){return e.chosenLayoutMode!=="walkrows"||e.repeatChoices.length===0?null:n(W,{label:"Repeat",size:"small",sx:{minWidth:130,maxWidth:260},testId:"graph-repeat-select",value:e.selectedRepeat?.key??"",options:e.repeatOptions,onChange:o=>{e.setRepeatKey(o)}})}),At=Rn;var _t=x(n("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close");var zt=x(n("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreVert");var Cn=h(function({model:e}){let o=e.highlightMenuItems({picks:!1});return n(we,{size:"small",tooltip:"Graph options",menuItems:[...o.length>0?[{label:"Haplotypes",icon:mt,subMenu:o}]:[],...e.layoutOptionMenuItems({repeat:!1}),{label:"Show",icon:Oe,subMenu:[...e.showMenuItems(),...e.modeDrawsNodes&&e.walkChoices.length>1?[{type:"checkbox",label:"Show walk rows under the graph",checked:e.walkStrip,onClick:()=>{e.setWalkStrip(!e.walkStrip)}}]:[],{type:"checkbox",label:"Show timings",checked:e.showPerf,onClick:()=>{e.setShowPerf(!e.showPerf)}}]},{type:"divider"},{label:"Graph settings...",icon:gt,helpText:"Subgraph node limit; node width and path colors; the force-directed layout engine",onClick:()=>{K(e).queueDialog(i=>[vt,{model:e,onClose:i}])}},{type:"divider"},{label:"Close graph",icon:_t,onClick:()=>{e.clearGraph()}}],children:n(zt,{})})}),Wt=Cn;var Ln=z()({formControl:{minWidth:130,maxWidth:260}}),En=h(function({model:e}){let{classes:o}=Ln(),i=Ge(),{walkChoices:r}=e;if(r.length===0||!e.liftsWalks)return null;let c=new Set(r.map(s=>s.name)),l=new Map(r.map(s=>[s.name,s.label])),p=e.walkLayers.map(s=>s.walk).filter(s=>c.has(s));return r.length>Be?n(Pe,{size:"small",variant:"outlined",color:"inherit","data-testid":"graph-walk-choose",onClick:()=>{K(e).queueDialog(s=>[Xe,{model:e,onClose:s}])},children:p.length>0?`${p.length} of ${r.length} haplotypes`:"Highlight haplotypes..."}):f(ke,{size:"small",className:o.formControl,children:[n(Re,{id:i,children:"Highlight"}),n(Ee,{labelId:i,multiple:!0,value:p,label:"Highlight","data-testid":"graph-walk-select",renderValue:s=>s.map(u=>l.get(u)).join(", "),onChange:s=>{let{value:u}=s.target;e.liftAmongChoices(typeof u=="string"?u.split(","):u)},children:r.map(({name:s,label:u})=>f(Le,{value:s,dense:!0,children:[n(Me,{size:"small",checked:p.includes(s)}),n(Ce,{primary:u})]},s))})]})}),Nt=En;var In=z()({toolbar:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:"1px solid #ddd"}}),Gn=h(function({model:e}){return n(B,{variant:"body2",children:e.zoomPercent})}),Tn=h(function({model:e}){let{classes:o}=In(),i=r=>{e.zoom(r,e.viewBox.width/2,e.viewBox.height/2)};return f("div",{className:o.toolbar,children:[n(Ht,{model:e}),n(It,{model:e}),n(Nt,{model:e}),n(At,{model:e}),n(U,{title:"Zoom in",children:n(q,{size:"small",onClick:()=>{i(1.5)},children:n(Lt,{})})}),n(U,{title:"Zoom out",children:n(q,{size:"small",onClick:()=>{i(1/1.5)},children:n(Et,{})})}),n(U,{title:"Zoom to fit",children:n(q,{size:"small",onClick:()=>{e.refitView()},children:n(Ct,{})})}),n(Gn,{model:e}),n(Tt,{model:e}),n(Wt,{model:e})]})}),Ot=Tn;var Hn={position:"absolute",bottom:Je,lineHeight:"normal",background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",zIndex:6};function me({label:t,readout:e}){return f(G,{children:[n("strong",{children:t})," \u2014 ",e]})}function An(t,e){if(e)return{testId:"graph-chip-tooltip",body:me(e)};let o=t.hoveredNode?t.hoverNodeById?.get(t.hoveredNode):void 0;if(o){let l=t.hoverDrawing?.members.get(o.id),p=_e(o);return{body:f(G,{children:[n("strong",{children:o.name}),l?` and ${l.length-1} more`:""," \u2014"," ",o.length.toLocaleString()," bp, depth ",o.depth.toFixed(1),p?f(G,{children:[n("br",{}),p.sample," ",J(p)," (rank ",o.stable?.rank,")"]}):null,o.moved?f(G,{children:[n("br",{}),"End of a component too large to draw here"]}):null]})}}let i=t.hoveredEdge===null?void 0:t.graph?.edges[t.hoveredEdge];if(i){let l=Ae(i,t.deletions.find(p=>p.edgeIndex===t.hoveredEdge),p=>t.nodeById?.get(p)?.name??p);return{body:l.deletion?f(G,{children:[n("strong",{children:"Deletion"})," ",l.deletion.bp,n("br",{}),l.deletion.where]}):f(G,{children:["Edge: ",l.ends]})}}let r=t.hoveredWalkRowText;if(r)return{testId:"graph-walk-row-tooltip",body:me(r)};let c=t.hoveredTubeText;return c?{testId:"graph-tube-tooltip",body:me(c)}:void 0}var _n=h(function({model:e,chip:o}){let i=An(e,o);return i?n("div",{style:{...Hn,right:e.tooltipRightPx},"data-testid":i.testId,children:i.body}):null}),Dt=_n;var Xt=x(n("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}),"FilterList");var Bt=x(n("path",{d:"M10.83 8H21V6H8.83zm5 5H18v-2h-4.17zM14 16.83V18h-4v-2h3.17l-3-3H6v-2h2.17l-3-3H3V6h.17L1.39 4.22 2.8 2.81l18.38 18.38-1.41 1.41z"}),"FilterListOff");var Ft=x(n("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info");var zn={x:0,y:0};function Wn(t,e){let{own:o,reference:i,highlight:r}=t.nodeLaunchTargets(e);return[{label:"Node details",icon:Ft,onClick:()=>{t.showNodeDetails(e)}},...et({own:o,reference:i,highlight:r,onShowLinear:c=>{t.showInLinearView(c)},onHighlight:t.canHighlightInLinearView?c=>{t.highlightInLinearView(c)}:void 0})]}function Nn(t){return t>=1e3?`${Math.round(t/1e3)} k`:`${t}`}function On(t,e,o){let i=o??t.walkRowBars,r=t.walkRowLaunchTarget(e,i),c=r?.assembly,l=e>0?i?.rows[e-1]:void 0,p=l?.sample,s=!o&&t.walkRowBars,u=t.walkRowSamples;return[r&&c?{label:`Linear genome view \u2014 ${c} ${J(r.location)}`,icon:pe,onClick:()=>{t.showInLinearView({location:r.location,assembly:c})}}:{label:"Linear genome view",icon:pe,disabled:!0,disabledHelpText:r?`No assembly in this session is ${r.location.haplotype??r.label}`:"This walk states no contig coordinates",onClick:()=>{}},...l?.abridgedSteps?[{label:`Load the ${Nn(l.abridgedSteps)} abridged steps`,onClick:()=>{t.expandWalk(l.name)}}]:[],...l&&t.liftsWalks&&t.modeDrawsNodes?[{type:"checkbox",label:`Highlight ${l.label}`,checked:t.walkLayers.some(m=>m.walk===l.name),onClick:()=>{t.toggleWalk(l.name)}}]:[],...s&&p&&!(u?.length===1&&u[0]===p)?[{label:`Show only ${p}`,icon:Xt,onClick:()=>{t.setWalkRowSamples([p])}}]:[],...s&&u?[{label:"Show every sample",icon:Bt,onClick:()=>{t.setWalkRowSamples(void 0)}}]:[]]}function V({model:t,at:e,onClose:o}){return n(Se,{anchor:e,offset:zn,onClose:o,menuItems:()=>e===void 0?[]:"nodeId"in e?Wn(t,e.nodeId):On(t,e.row,e.bars)})}var Dn={display:"flex",flexWrap:"wrap",gap:"2px 14px",padding:"2px 8px 6px",fontSize:11,color:"#333"},Xn={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},Bn=h(function({bars:e,frame:o,ramp:i,rowGenes:r}){let c=rt(),l=Te(()=>Ze(e,o,{ramp:i,rowGenes:r,idPrefix:c}),[e,o,i,r,c]);return n(te,{el:l})}),Fn=h(function({model:e}){let o=e.walkStripRows,i=e.walkStripFrame,r=e.stripHover,c=o?[o.reference,...o.rows]:[],l=r?c.findIndex(m=>m.name===r.row):-1,p=c[l];if(!o||!i||i.labelled||!r||!p)return null;let s=(o.origin+r.offset)*i.scaleX+i.translateX,u=s>i.width/2?{right:i.width-s+12}:{left:s+12};return f("div",{"data-testid":"graph-walk-strip-tip",style:{...Xn,...u,top:l*i.rowPx+i.translateY-18},children:[p.label," \xB7"," ",Ve(p,l===0?void 0:o.reference)]})}),Vn=h(function({model:e,bars:o,frame:i}){return n(te,{el:je(o,i,e.walkStripMarks)})}),Yn=h(function({model:e}){let o=e.walkStripRows,i=e.walkStripFrame,[r,c]=C();if(!o||!i)return null;let l=s=>{let u=s.currentTarget.getBoundingClientRect();return $e(o,i,s.clientX-u.left,s.clientY-u.top)},p=Ye(o,{ramp:e.referenceRampDomain,rampCss:De,genes:qe(i,e.walkRowGenes,e.walkRowGeneGaps),annotation:e.walkRowAnnotation});return f("div",{"data-testid":"graph-walk-strip",style:{position:"relative",borderTop:"1px solid #ddd"},onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{T(e)&&(e.setPointerInPane(!1),e.setStripHover(null))},children:[f("svg",{width:i.width,height:i.height,style:{display:"block"},onMouseMove:s=>{let u=l(s);s.currentTarget.style.cursor=u&&u.index>0?"pointer":"",e.setStripHover(u?{row:u.row.name,offset:u.offset}:null)},onClick:s=>{let u=l(s);u&&u.index>0&&e.toggleWalk(u.row.name)},onContextMenu:s=>{let u=l(s);u&&(s.preventDefault(),c({clientX:s.clientX,clientY:s.clientY,row:u.index}))},children:[n(Bn,{bars:o,frame:i,ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes}),n(Vn,{model:e,bars:o,frame:i}),n(te,{el:Ke(o,i,new Set(e.walkLayers.map(s=>s.walk)))})]}),n(Fn,{model:e}),f("div",{style:Dn,"data-testid":"graph-walk-strip-key",children:[p.map(s=>f("div",{style:oe,children:[n(ne,{swatch:st(s.swatch)}),n("span",{children:s.label})]},s.label)),n("span",{style:{color:"#777"},children:"Ticks mark where each walk passes the node under the pointer; click a haplotype's bar to lift its walk"})]}),n(V,{model:e,at:r&&{...r,bars:o},onClose:()=>{c(void 0)}})]})}),Vt=Yn;var Zn=h(function({model:e}){let o=e.walkStripLocator;return o?f(ee,{model:e,zIndex:4,overflow:"visible",testId:"graph-walk-strip-locator",children:[n("circle",{cx:o.x,cy:o.y,r:11,fill:"none",stroke:"white",strokeWidth:4}),n("circle",{cx:o.x,cy:o.y,r:11,fill:"none",stroke:"#111",strokeWidth:1.75})]}):null}),Yt=Zn;var $n=1.1,jn=100,Kn=40,qn=800,Un=10,Zt=2;function ge(t){let e=t.deltaY*(t.deltaMode===1?Kn:t.deltaMode===2?qn:1),o=(t.ctrlKey?Un:1)*e/jn;return $n**-Math.max(-Zt,Math.min(Zt,o))}var Jn=40,Qn=100,eo=24,$t=Math.log(16);function to(t,e){let o=t*Math.exp(-Math.max(0,e)/eo);return Math.abs(o)<.001?t:t-o}function no(t,e){let o=Math.abs(t.deltaX)>Math.abs(t.deltaY);return t.ctrlKey||t.metaKey||!o&&(!e||e.scrollZoom)?"zoom":o?"pan":"page"}function qt(t,e,o){H(()=>{if(!t)return;let i=-1/0,r={backlog:0,x:0,y:0,frame:0,last:0},c=p=>{let s=to(r.backlog,Math.min(100,p-r.last));r.backlog-=s,r.last=p,r.frame=r.backlog?requestAnimationFrame(c):0,T(o)&&o.zoom(Math.exp(s),r.x,r.y)},l=p=>{if(o.hostPlacesX||o.followsHostView)return;let m=((p.target instanceof Element?p.target.closest("canvas"):null)??(o.facetPanels?null:e))?.getBoundingClientRect();if(m&&p.clientY-m.top<o.referenceStripZonePx)return;let w=no(p,o.host);if(w!=="page"){if(o.host&&p.stopPropagation(),p.preventDefault(),w==="pan"){if(p.timeStamp-i>Qn){let S=p.deltaMode===1?Jn:1;o.setTransform(o.scale,o.translateX-p.deltaX*S,o.translateY)}return}i=p.timeStamp,m&&(r.x=p.clientX-m.left,r.y=p.clientY-m.top,r.backlog=Math.max(-$t,Math.min($t,r.backlog+Math.log(ge(p)))),r.frame||(r.last=performance.now()-1e3/60,r.frame=requestAnimationFrame(c)))}};return t.addEventListener("wheel",l,{passive:!1}),()=>{cancelAnimationFrame(r.frame),t.removeEventListener("wheel",l)}},[t,e,o])}var jt=3,ve="data-gesture-owner",Y=t=>({x:t.clientX,y:t.clientY});function Kt(t){let[e,o]=[...t.values()];return{spread:Math.hypot(e.x-o.x,e.y-o.y),mid:{x:(e.x+o.x)/2,y:(e.y+o.y)/2}}}function Ut(t){let e=k({x:0,y:0}),o=k({x:0,y:0}),i=k(!1),r=k(void 0),c=a=>r.current!==void 0&&a.pointerId!==r.current,l=k(new Map),p=k(null),s=k(null),u=k(!1),m=k(null),w=k(!1),S=k({frame:0,pan:null,hover:null,pinch:!1});H(()=>()=>{cancelAnimationFrame(S.current.frame)},[]);let[N,I]=C(),[O,D]=C(!1),[Z,$]=C(void 0);function R(a){let d=a.currentTarget.getBoundingClientRect();return{x:a.clientX-d.left,y:a.clientY-d.top}}function L(a,d){if(t.layoutResult?.tubeMap)return t.tubeMapNodeAt(a,d);let g=t.referenceStripNodeAt(a,d);if(g)return g;let{nodePositions:v}=t;if(!v)return null;let{x:y,y:b}=se(a,d,t,t.axisScale);return le(v,y,b,t.axisScale,t.positionsVersion,t.nodeInk)}function en(a,d){let{nodePositions:g,graph:v}=t;if(!g||!v)return null;let{x:y,y:b}=se(a,d,t,t.axisScale);return ce(g,v,y,b,t.axisScale,t.effectiveDrawPaths&&!t.facetPanels,t.positionsVersion,t.deletionEdgeIndexes,t.hiddenEdgeIndexes,t.deletionRoutes,t.layoutResult?.stranded)}function tn(a){a.button===0&&a.preventDefault()}function nn(a){if(a.button!==0)return;let d=l.current;if(c(a)){t.isPanning&&!w.current&&a.pointerType==="touch"&&d.size===1&&(a.currentTarget.setPointerCapture(a.pointerId),d.set(a.pointerId,Y(a)),s.current=Kt(d),i.current=!0);return}i.current=!1,o.current={x:a.clientX,y:a.clientY},a.currentTarget.removeAttribute(ve);let g=t.followsHostView;if(t.hostPlacesX||g&&a.shiftKey)return;a.currentTarget.setPointerCapture(a.pointerId),r.current=a.pointerId,p.current=a.currentTarget,d.clear(),d.set(a.pointerId,Y(a));let{x:v,y}=R(a),b=y<t.referenceStripZonePx,P=t.layoutResult?.tubeMap||b?null:L(v,y);g&&P&&a.currentTarget.setAttribute(ve,""),w.current=g,u.current=b&&!g,P?t.setDraggingNode(P):t.setPanning(!0),e.current={x:a.clientX,y:a.clientY}}function ye(){let a=s.current,d=p.current;if(!a||!d)return;let g=Kt(l.current),v=d.getBoundingClientRect();a.spread>0&&g.spread>0&&t.zoom(g.spread/a.spread,a.mid.x-v.left,a.mid.y-v.top),t.setTransform(t.scale,t.translateX+g.mid.x-a.mid.x,t.translateY+g.mid.y-a.mid.y),s.current=g}function on(){let a=S.current,{pan:d,hover:g,pinch:v}=a;if(a.frame=0,a.pan=null,a.hover=null,a.pinch=!1,v&&ye(),d&&u.current?t.host?.horizontalScroll(-d.dx):d&&w.current?t.setTransform(t.scale,t.translateX,t.translateY+d.dy):d&&t.setTransform(t.scale,t.translateX+d.dx,t.translateY+d.dy),!g)return;let{x:y,y:b}=g,P=t.facetPanels?void 0:yt(t.overlayLabels,y,b);$(M=>M?.label===P?.label&&M?.readout===P?.readout?M:P);let E=t.walkRowBars;if(E){let M=t.walkRowAt(y,b);t.setHoveredWalkRow(M===void 0?null:[E.reference,...E.rows][M].name)}if(t.nodePositions&&t.graph){let M=L(y,b);t.setHoveredPanel(t.tubeMapPanelAt(b)),t.setHoveredNode(M,{x:y,y:b}),D(M!==null&&!t.hostPlacesX&&!t.layoutResult?.tubeMap&&b>=t.referenceStripZonePx),t.setHoveredTube(M===null&&t.layoutResult?.tubeMap?t.tubeAt(y,b):null),t.setHoveredEdge(M||t.layoutResult?.tubeMap||!t.hoverLightsEverything?null:en(y,b))}}function j(){S.current.frame||(S.current.frame=requestAnimationFrame(on))}function rn(){let a=S.current;cancelAnimationFrame(a.frame),a.frame=0,a.pan=null,a.hover=null,a.pinch=!1}function an(a){let d=l.current;if(s.current&&d.has(a.pointerId)){d.set(a.pointerId,Y(a)),S.current.pinch=!0,j();return}if(c(a)||m.current)return;let g=a.clientX-e.current.x,v=a.clientY-e.current.y;e.current={x:a.clientX,y:a.clientY},Math.hypot(a.clientX-o.current.x,a.clientY-o.current.y)>jt&&(i.current=!0);let y=S.current;if(t.draggingNode)t.moveNode(t.draggingNode,g/t.scaleX,v/t.scaleY);else if(t.isPanning)y.pan={dx:(y.pan?.dx??0)+g,dy:(y.pan?.dy??0)+v},j();else{let b=a.currentTarget.getBoundingClientRect();y.hover={x:a.clientX-b.left,y:a.clientY-b.top},j()}}function ae(a){let d=l.current;if(s.current&&d.has(a.pointerId)){S.current.pinch&&(S.current.pinch=!1,ye()),d.delete(a.pointerId),s.current=null;let[[g,v]]=[...d];r.current=g,e.current=v;return}c(a)||(r.current=void 0,d.clear(),T(t)&&t.stopDragging())}function sn(a){c(a)||(r.current=void 0,l.current.clear(),s.current=null,rn(),$(void 0),D(!1),T(t)&&(t.stopDragging(),t.clearHover()))}function ln(a){let{x:d,y:g}=R(a),v=L(d,g),{clientX:y,clientY:b}=a;if(v){a.preventDefault(),I({clientX:y,clientY:b,nodeId:v});return}let P=t.walkRowAt(d,g);P!==void 0&&(a.preventDefault(),I({clientX:y,clientY:b,row:P}))}function cn(a){if(!i.current){let{x:d,y:g}=R(a),v=L(d,g);t.setSelectedNode(v),v&&t.showNodeDetails(v)}}H(()=>()=>{m.current?.end()},[]);function pn(a){if(a.button!==0||t.hostPlacesX||t.followsHostView||!(a.target instanceof Element)||!a.target.closest(`[${tt}]`))return;m.current?.end(),u.current=!1,w.current=!1;let d=a.pointerId,g=Y(a),v=g,y={moved:!1,end:()=>{window.removeEventListener("pointermove",b,!0),window.removeEventListener("pointerup",P,!0),window.removeEventListener("pointercancel",P,!0),y.moved&&T(t)&&t.stopDragging()}};function b(E){if(E.pointerId!==d)return;if(!y.moved){if(Math.hypot(E.clientX-g.x,E.clientY-g.y)<=jt)return;y.moved=!0,t.setPanning(!0)}let M=S.current;M.pan={dx:(M.pan?.dx??0)+E.clientX-v.x,dy:(M.pan?.dy??0)+E.clientY-v.y},v=Y(E),j()}function P(E){E.pointerId===d&&(y.end(),setTimeout(()=>{m.current===y&&(m.current=null)},0))}m.current=y,window.addEventListener("pointermove",b,!0),window.addEventListener("pointerup",P,!0),window.addEventListener("pointercancel",P,!0)}function un(a){m.current?.moved&&(m.current=null,a.stopPropagation())}let dn={cursor:t.isPanning||t.draggingNode?"grabbing":O?"move":"grab",touchAction:t.hostPlacesX?"auto":"none",overscrollBehavior:"contain"},fn=t.host!==void 0&&!t.hostPlacesX&&!t.followsHostView?{[ve]:"",onMouseDown:a=>{a.stopPropagation()}}:{};return{canvasStyle:dn,surfaceProps:fn,handlers:{onMouseDown:tn,onPointerDown:nn,onPointerMove:an,onPointerUp:ae,onPointerCancel:ae,onLostPointerCapture:ae,onPointerLeave:sn,onClick:cn,onContextMenu:ln},contextMenu:N,hoveredChip:Z,labelHandlers:{onPointerDown:pn,onClickCapture:un},closeContextMenu:()=>{I(void 0)}}}var oo={position:"relative"},ro={position:"relative",lineHeight:0,isolation:"isolate"},ao={position:"absolute",left:0,right:0,bottom:0,zIndex:0},io={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},so={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},lo=h(function({model:e}){return n(G,{children:e.visibleRowLabels.map(({label:o,y:i,top:r})=>n("div",{"data-testid":"graph-row-label",style:{...so,top:r},children:o},i))})}),co={position:"absolute",top:F,right:F,display:"flex",flexDirection:"column",borderRadius:3,overflowX:"hidden",overflowY:"auto",zIndex:4},Jt={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},po={...Jt,color:"#18181c",fontWeight:600},uo=h(function({model:e}){let o=k(null),i=e.legendAtRest;return H(()=>{let r=o.current;if(!r||!i)return;let c=()=>{T(e)&&e.legendAtRest&&e.setLegendSize({width:r.offsetWidth,height:r.scrollHeight})};c();let l=new ResizeObserver(c);return l.observe(r),r.firstElementChild&&l.observe(r.firstElementChild),()=>{l.disconnect()}},[e,i]),n("div",{ref:o,style:{...co,top:F+e.referenceStripZonePx,maxHeight:e.canvasHeight-2*F-e.referenceStripZonePx},children:n(kt,{model:e})})}),fo=h(function({model:e}){let o=e.overlayLabels.sizes,i=o.flatMap(({key:r,leader:c})=>c?[{key:r,...c}]:[]);return f(G,{children:[i.length>0?n(ee,{model:e,zIndex:2,overflow:"visible",children:i.map(({key:r,arcX:c,arcY:l,labelX:p,labelY:s})=>n("line",{"data-testid":"graph-label-leader",x1:c,y1:l,x2:p,y2:s,stroke:"#18181c",strokeWidth:1},r))}):null,o.map(({key:r,text:c,x:l,y:p,kind:s})=>n("div",{"data-testid":"graph-size-label",style:{...s==="deletion"?po:Jt,left:l,top:p},children:c},r))]})}),Qt=h(function({model:e,handle:{canvasRef:o,canvas:i},ownChrome:r}){let{handlers:c,canvasStyle:l,surfaceProps:p,labelHandlers:s,contextMenu:u,closeContextMenu:m,hoveredChip:w}=Ut(e),[S,N]=C(null);qt(S,i,e);let I=e.facetPanels!==void 0;return f("div",{style:oo,...p,children:[r?n(Ot,{model:e}):null,f("div",{ref:N,style:ro,...s,onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{T(e)&&e.setPointerInPane(!1)},children:[e.referenceStripShown?n("div",{style:{...ao,top:e.referenceStripZonePx,background:Q}}):null,n("canvas",{ref:o,"data-testid":"graph-genome-canvas",style:{...l,width:e.paneWidth,height:e.canvasHeight,display:"block",position:"relative",zIndex:1},...c}),I?n(Rt,{model:e,handlers:c,canvasStyle:l}):f(G,{children:[n(St,{model:e}),n(fe,{model:e}),n(wt,{model:e}),n(lo,{model:e}),n(fo,{model:e}),n(ot,{model:e}),n(ht,{model:e}),n(bt,{model:e}),n(xt,{model:e}),n(Yt,{model:e}),n(uo,{model:e})]}),r?n("div",{style:io,children:n(xe,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null,n(Dt,{model:e,chip:w})]}),e.walkStripShown?n(Vt,{model:e}):null,n(V,{model:e,at:u,onClose:m}),r?.renderError?n(ie,{error:r.renderError,onReset:r.retryRender}):null,r&&e.error?n(ie,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),ho=h(function({model:e}){let{canvasRef:o,canvas:i,error:r,retry:c}=Mt(Pt,e);return n(Qt,{model:e,handle:{canvasRef:o,canvas:i},ownChrome:{renderError:r,retryRender:c}})}),mo=h(function({model:e,handle:o}){return o?n(Qt,{model:e,handle:o}):n(ho,{model:e})}),$i=mo;export{Pt as a,$i as b};
2
- //# sourceMappingURL=chunk-MK3U4D2U.js.map
1
+ import{a as W,b as vt}from"./chunk-UECOGSWM.js";import{B as St,C as xt,a as tt,b as nt,c as ee,d as ot,e as rt,f as te,h as at,i as it,j as st,k as lt,l as ct,m as pt,o as ne,p as ut,q as oe,r as dt,t as ue,u as ft,v as ht,w as yt,x as bt,z as wt}from"./chunk-MCBYBZZJ.js";import{N as Je,O as Qe,R as pe,T as et,U as mt,V as gt,a as x,c as He,f as J,g as Ae,h as _e,q as ze,r as Oe,t as $e,u as je,v as Ke,w as qe}from"./chunk-OLZZDBQJ.js";import{p as z}from"./chunk-WUOXZAGN.js";import{Ca as Ye,Fb as A,J as se,Ja as Ze,Jb as le,Lb as ce,N as Q,Nb as F,R as Xe,T as Be,a as X,b as be,ca as Fe,gc as Ue,q as We,r as Ne,va as Ve}from"./chunk-SL4JJJQJ.js";import{n as De}from"./chunk-W7IHIVSE.js";import{e as T}from"./chunk-3WG3GF2A.js";import{j as K}from"./chunk-J5RMHLFJ.js";import{a as Ie,e as H,f as Ge,g as Te,h as k,i as C}from"./chunk-NIEZKWQV.js";import{D as Ee,G as U,H as B,b as we,c as Se,e as ie,k as xe,o as Pe,p as Me,s as ke,v as q,w as Re,y as Ce,z as Le}from"./chunk-5Z4VIKXZ.js";import{a as G,b as n,c as f,d as h}from"./chunk-JMBDTNUR.js";function Pt(t){return Promise.resolve(new A(t))}var _=JBrowseExports["@jbrowse/render-core/useRenderingBackend"],hn=t=>_!=null&&t in Object(_)?_[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/render-core/useRenderingBackend' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t});var Mt=hn("useRenderingBackend"),bo=_&&_.__esModule?_.default:_;var de=nt(1);function fe({model:t}){let[e,o]=C(null);return H(()=>{if(!e)return;let i=new A(e),r=X(()=>{Fe(Ue()),i.resize(t.paneWidth,t.canvasHeight),t.paintHover(i,t.drawnBatch)});return()=>{r(),i.dispose()}},[e,t]),n("canvas",{ref:o,"data-testid":"graph-hover-layer",style:de})}function re({row:t,at:e,hint:o,after:i,column:r}){let c=r===void 0?void 0:{paddingLeft:r+5};return t.swatch?f("div",{title:[t.title,o].filter(Boolean).join(" \xB7 ")||void 0,children:[f("div",{style:oe,children:[n("span",{style:{display:"flex",flex:"none",justifyContent:"center",width:r},children:n(ne,{swatch:t.swatch})}),f("span",{children:[t.strong?n("strong",{children:t.strong}):null,t.label]}),i]}),e?n("div",{style:c,"data-testid":"graph-walk-at",children:e}):t.under?n("div",{style:c,children:t.under}):null]}):n("div",{style:dt,children:t.label})}var mn={pointerEvents:"auto",cursor:"pointer",border:"none",background:"none",padding:"0 2px",font:"inherit",textDecoration:"underline"},kt=h(function({model:e}){let o=pt(e);if(o.length===0)return null;let i=o.flatMap(l=>l.rows),r=it(i),c=at(i);return n("div",{style:{...ut,lineHeight:`${r}px`},children:o.map(({testid:l,rows:p,heading:s,spaced:u},m)=>f(Ie,{children:[s?n("div",{style:{...ft,paddingTop:m===0?0:ue},children:s}):null,n("div",{"data-testid":l,style:u?{paddingTop:ue}:void 0,children:p.map(w=>n(re,{row:w,column:c,at:w.walk?e.hoveredOn(w.walk):void 0,after:w.closesBubble?n("button",{type:"button",style:mn,"data-testid":"graph-close-bubble",onClick:()=>{e.closeBubbles()},children:"close"}):null},w.key))})]},l))})});var gn={position:"absolute",left:0,top:0,zIndex:4,display:"grid",gap:We,lineHeight:"normal"},vn={height:Ne,padding:"2px 6px",boxSizing:"border-box",fontFamily:"inherit",fontSize:11,color:"inherit",cursor:"pointer",border:"none",background:"none",textAlign:"left",display:"block"},yn={position:"relative"},bn={gridColumn:"1 / -1",height:Qe,padding:"2px 6px",boxSizing:"border-box",display:"flex",gap:14,fontSize:11,lineHeight:"15px"},wn=h(function({model:e,lift:o,width:i,height:r,cell:c,handlers:l,canvasStyle:p}){let[s,u]=C(null),[m,w]=C(null),S=o.walks[0];H(()=>{if(!s||!m)return;let I=new A(s),O=new A(m),D=be(()=>e.buildDrawing(o,!1)),Z,$=[X(()=>{let R=e.facetGrid;R&&I.resize(R.width,R.height);let L=D.get();L&&(L!==Z&&(I.uploadGeometry(L.batch),Z=L),e.applySelection(I),e.paint(I))}),X(()=>{let R=e.facetGrid;R&&O.resize(R.width,R.height);let L=D.get();L&&e.paintHover(O,L.batch)})];return()=>{for(let R of $)R();I.dispose(),O.dispose()}},[s,m,e,o]);let N=e.walkLabel(S.name);return f("div",{style:c,children:[n("button",{type:"button",style:vn,"data-testid":"graph-facet-title",onClick:()=>{e.liftWalks([S.name]),e.setFacet("")},children:n(re,{row:lt(e,S),hint:`click to lift ${N} alone`,at:e.hoveredOn(S)})}),f("div",{style:yn,children:[n("canvas",{ref:u,"data-testid":"graph-facet-canvas",style:{...p,width:i,height:r,display:"block"},...l}),n("canvas",{ref:w,style:de})]})]})}),Sn=h(function({model:e,handlers:o,canvasStyle:i}){let r=e.facetPanels,c=e.facetGrid,l=e.facetPlacement;if(!r||!c||!l)return null;let{columns:p,width:s,height:u}=c;return f("div",{"data-testid":"graph-facet-panels",style:{...gn,width:e.paneWidth,minHeight:e.canvasHeight,gridTemplateColumns:`repeat(${p}, ${s}px)`,background:Q},children:[r.map((m,w)=>n(wn,{model:e,lift:m,width:s,height:u,cell:{gridRow:Math.floor(l.cells[w]/p)+1,gridColumn:l.cells[w]%p+1},handlers:o,canvasStyle:i},m.walks[0].name)),n("div",{style:{...bn,gridRow:Math.floor(l.cells.reduce((m,w)=>Math.max(m,w),-1/0)/p)+2},"data-testid":"graph-facet-key",children:ct(e).map(m=>n(re,{row:m},m.key))})]})}),Rt=Sn;var Ct=x(n("path",{d:"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2m2 10H3v4c0 1.1.9 2 2 2h4v-2H5zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2"}),"CropFree");var Lt=x([n("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"},"0"),n("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var Et=x(n("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14M7 9h5v1H7z"}),"ZoomOut");var xn=h(function({model:e}){let o=e.colorSchemeLock;return n(W,{label:"Color",size:"small",sx:{minWidth:100},disabled:o!==void 0,title:o?.why,shown:o?.value,value:e.chosenColorScheme,options:ze.map(({value:i})=>({value:i,label:e.colorSchemeLabel(i)})),testId:"graph-color-select",onChange:i=>{e.setColorScheme(i)}})}),It=xn;var Gt=z()({stats:{marginLeft:"auto"},perf:{color:"#888",fontVariantNumeric:"tabular-nums"}});function he(t){return t===void 0?"\u2013":`${Math.round(t)}ms`}var Pn=h(function({model:e}){let{classes:o}=Gt(),{lastFetchMs:i,lastLayoutMs:r,lastGeometryMs:c}=e,l=i!==void 0||r!==void 0||c!==void 0;return e.showPerf&&l?f(B,{variant:"caption",className:o.perf,"data-testid":"graph-perf-stats",children:["fetch ",he(i)," \xB7 layout ",he(r)," \xB7 geom"," ",he(c)]}):null}),Mn=h(function({model:e}){let{classes:o}=Gt();return f("div",{className:o.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:[f(B,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",n(Pn,{model:e})]})}),Tt=Mn;var kn=h(function({model:e}){let{graph:o}=e;return n(W,{label:"Layout",size:"small",sx:{minWidth:140},testId:"graph-layout-select",value:e.chosenLayoutMode,options:He.map(({value:i,label:r,description:c,available:l})=>({value:i,label:r,description:c,disabled:o?!l(o):!1})),onChange:i=>{e.switchLayout(i)}})}),Ht=kn;var Rn=h(function({model:e}){return e.chosenLayoutMode!=="walkrows"||e.repeatChoices.length===0?null:n(W,{label:"Repeat",size:"small",sx:{minWidth:130,maxWidth:260},testId:"graph-repeat-select",value:e.selectedRepeat?.key??"",options:e.repeatOptions,onChange:o=>{e.setRepeatKey(o)}})}),At=Rn;var _t=x(n("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close");var zt=x(n("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreVert");var Cn=h(function({model:e}){let o=e.highlightMenuItems({picks:!1});return n(we,{size:"small",tooltip:"Graph options",menuItems:[...o.length>0?[{label:"Haplotypes",icon:mt,subMenu:o}]:[],...e.layoutOptionMenuItems({repeat:!1}),{label:"Show",icon:Oe,subMenu:[...e.showMenuItems(),...e.modeDrawsNodes&&e.walkChoices.length>1?[{type:"checkbox",label:"Show walk rows under the graph",checked:e.walkStrip,onClick:()=>{e.setWalkStrip(!e.walkStrip)}}]:[],{type:"checkbox",label:"Show timings",checked:e.showPerf,onClick:()=>{e.setShowPerf(!e.showPerf)}}]},{type:"divider"},{label:"Graph settings...",icon:gt,helpText:"Subgraph node limit; node width and path colors; the force-directed layout engine",onClick:()=>{K(e).queueDialog(i=>[vt,{model:e,onClose:i}])}},{type:"divider"},{label:"Close graph",icon:_t,onClick:()=>{e.clearGraph()}}],children:n(zt,{})})}),Wt=Cn;var Ln=z()({formControl:{minWidth:130,maxWidth:260}}),En=h(function({model:e}){let{classes:o}=Ln(),i=Ge(),{walkChoices:r}=e;if(r.length===0||!e.liftsWalks)return null;let c=new Set(r.map(s=>s.name)),l=new Map(r.map(s=>[s.name,s.label])),p=e.walkLayers.map(s=>s.walk).filter(s=>c.has(s));return r.length>Be?n(Pe,{size:"small",variant:"outlined",color:"inherit","data-testid":"graph-walk-choose",onClick:()=>{K(e).queueDialog(s=>[Xe,{model:e,onClose:s}])},children:p.length>0?`${p.length} of ${r.length} haplotypes`:"Highlight haplotypes..."}):f(ke,{size:"small",className:o.formControl,children:[n(Re,{id:i,children:"Highlight"}),n(Ee,{labelId:i,multiple:!0,value:p,label:"Highlight","data-testid":"graph-walk-select",renderValue:s=>s.map(u=>l.get(u)).join(", "),onChange:s=>{let{value:u}=s.target;e.liftAmongChoices(typeof u=="string"?u.split(","):u)},children:r.map(({name:s,label:u})=>f(Le,{value:s,dense:!0,children:[n(Me,{size:"small",checked:p.includes(s)}),n(Ce,{primary:u})]},s))})]})}),Nt=En;var In=z()({toolbar:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:"1px solid #ddd"}}),Gn=h(function({model:e}){return n(B,{variant:"body2",children:e.zoomPercent})}),Tn=h(function({model:e}){let{classes:o}=In(),i=r=>{e.zoom(r,e.viewBox.width/2,e.viewBox.height/2)};return f("div",{className:o.toolbar,children:[n(Ht,{model:e}),n(It,{model:e}),n(Nt,{model:e}),n(At,{model:e}),n(U,{title:"Zoom in",children:n(q,{size:"small",onClick:()=>{i(1.5)},children:n(Lt,{})})}),n(U,{title:"Zoom out",children:n(q,{size:"small",onClick:()=>{i(1/1.5)},children:n(Et,{})})}),n(U,{title:"Zoom to fit",children:n(q,{size:"small",onClick:()=>{e.refitView()},children:n(Ct,{})})}),n(Gn,{model:e}),n(Tt,{model:e}),n(Wt,{model:e})]})}),Ot=Tn;var Hn={position:"absolute",bottom:Je,lineHeight:"normal",background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",zIndex:6};function me({label:t,readout:e}){return f(G,{children:[n("strong",{children:t})," \u2014 ",e]})}function An(t,e){if(e)return{testId:"graph-chip-tooltip",body:me(e)};let o=t.hoveredNode?t.hoverNodeById?.get(t.hoveredNode):void 0;if(o){let l=t.hoverDrawing?.members.get(o.id),p=_e(o);return{body:f(G,{children:[n("strong",{children:o.name}),l?` and ${l.length-1} more`:""," \u2014"," ",o.length.toLocaleString()," bp, depth ",o.depth.toFixed(1),p?f(G,{children:[n("br",{}),p.sample," ",J(p)," (rank ",o.stable?.rank,")"]}):null,o.moved?f(G,{children:[n("br",{}),"End of a component too large to draw here"]}):null]})}}let i=t.hoveredEdge===null?void 0:t.graph?.edges[t.hoveredEdge];if(i){let l=Ae(i,t.deletions.find(p=>p.edgeIndex===t.hoveredEdge),p=>t.nodeById?.get(p)?.name??p);return{body:l.deletion?f(G,{children:[n("strong",{children:"Deletion"})," ",l.deletion.bp,n("br",{}),l.deletion.where]}):f(G,{children:["Edge: ",l.ends]})}}let r=t.hoveredWalkRowText;if(r)return{testId:"graph-walk-row-tooltip",body:me(r)};let c=t.hoveredTubeText;return c?{testId:"graph-tube-tooltip",body:me(c)}:void 0}var _n=h(function({model:e,chip:o}){let i=An(e,o);return i?n("div",{style:{...Hn,right:e.tooltipRightPx},"data-testid":i.testId,children:i.body}):null}),Dt=_n;var Xt=x(n("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}),"FilterList");var Bt=x(n("path",{d:"M10.83 8H21V6H8.83zm5 5H18v-2h-4.17zM14 16.83V18h-4v-2h3.17l-3-3H6v-2h2.17l-3-3H3V6h.17L1.39 4.22 2.8 2.81l18.38 18.38-1.41 1.41z"}),"FilterListOff");var Ft=x(n("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info");var zn={x:0,y:0};function Wn(t,e){let{own:o,reference:i,highlight:r}=t.nodeLaunchTargets(e);return[{label:"Node details",icon:Ft,onClick:()=>{t.showNodeDetails(e)}},...et({own:o,reference:i,highlight:r,onShowLinear:c=>{t.showInLinearView(c)},onHighlight:t.canHighlightInLinearView?c=>{t.highlightInLinearView(c)}:void 0})]}function Nn(t){return t>=1e3?`${Math.round(t/1e3)} k`:`${t}`}function On(t,e,o){let i=o??t.walkRowBars,r=t.walkRowLaunchTarget(e,i),c=r?.assembly,l=e>0?i?.rows[e-1]:void 0,p=l?.sample,s=!o&&t.walkRowBars,u=t.walkRowSamples;return[r&&c?{label:`Linear genome view \u2014 ${c} ${J(r.location)}`,icon:pe,onClick:()=>{t.showInLinearView({location:r.location,assembly:c})}}:{label:"Linear genome view",icon:pe,disabled:!0,disabledHelpText:r?`No assembly in this session is ${r.location.haplotype??r.label}`:"This walk states no contig coordinates",onClick:()=>{}},...l?.abridgedSteps?[{label:`Load the ${Nn(l.abridgedSteps)} abridged steps`,onClick:()=>{t.expandWalk(l.name)}}]:[],...l&&t.liftsWalks&&t.modeDrawsNodes?[{type:"checkbox",label:`Highlight ${l.label}`,checked:t.walkLayers.some(m=>m.walk===l.name),onClick:()=>{t.toggleWalk(l.name)}}]:[],...s&&p&&!(u?.length===1&&u[0]===p)?[{label:`Show only ${p}`,icon:Xt,onClick:()=>{t.setWalkRowSamples([p])}}]:[],...s&&u?[{label:"Show every sample",icon:Bt,onClick:()=>{t.setWalkRowSamples(void 0)}}]:[]]}function V({model:t,at:e,onClose:o}){return n(Se,{anchor:e,offset:zn,onClose:o,menuItems:()=>e===void 0?[]:"nodeId"in e?Wn(t,e.nodeId):On(t,e.row,e.bars)})}var Dn={display:"flex",flexWrap:"wrap",gap:"2px 14px",padding:"2px 8px 6px",fontSize:11,color:"#333"},Xn={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},Bn=h(function({bars:e,frame:o,ramp:i,rowGenes:r}){let c=rt(),l=Te(()=>Ze(e,o,{ramp:i,rowGenes:r,idPrefix:c}),[e,o,i,r,c]);return n(te,{el:l})}),Fn=h(function({model:e}){let o=e.walkStripRows,i=e.walkStripFrame,r=e.stripHover,c=o?[o.reference,...o.rows]:[],l=r?c.findIndex(m=>m.name===r.row):-1,p=c[l];if(!o||!i||i.labelled||!r||!p)return null;let s=(o.origin+r.offset)*i.scaleX+i.translateX,u=s>i.width/2?{right:i.width-s+12}:{left:s+12};return f("div",{"data-testid":"graph-walk-strip-tip",style:{...Xn,...u,top:l*i.rowPx+i.translateY-18},children:[p.label," \xB7"," ",Ve(p,l===0?void 0:o.reference)]})}),Vn=h(function({model:e,bars:o,frame:i}){return n(te,{el:je(o,i,e.walkStripMarks)})}),Yn=h(function({model:e}){let o=e.walkStripRows,i=e.walkStripFrame,[r,c]=C();if(!o||!i)return null;let l=s=>{let u=s.currentTarget.getBoundingClientRect();return $e(o,i,s.clientX-u.left,s.clientY-u.top)},p=Ye(o,{ramp:e.referenceRampDomain,rampCss:De,genes:qe(i,e.walkRowGenes,e.walkRowGeneGaps),annotation:e.walkRowAnnotation});return f("div",{"data-testid":"graph-walk-strip",style:{position:"relative",borderTop:"1px solid #ddd"},onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{T(e)&&(e.setPointerInPane(!1),e.setStripHover(null))},children:[f("svg",{width:i.width,height:i.height,style:{display:"block"},onMouseMove:s=>{let u=l(s);s.currentTarget.style.cursor=u&&u.index>0?"pointer":"",e.setStripHover(u?{row:u.row.name,offset:u.offset}:null)},onClick:s=>{let u=l(s);u&&u.index>0&&e.toggleWalk(u.row.name)},onContextMenu:s=>{let u=l(s);u&&(s.preventDefault(),c({clientX:s.clientX,clientY:s.clientY,row:u.index}))},children:[n(Bn,{bars:o,frame:i,ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes}),n(Vn,{model:e,bars:o,frame:i}),n(te,{el:Ke(o,i,new Set(e.walkLayers.map(s=>s.walk)))})]}),n(Fn,{model:e}),f("div",{style:Dn,"data-testid":"graph-walk-strip-key",children:[p.map(s=>f("div",{style:oe,children:[n(ne,{swatch:st(s.swatch)}),n("span",{children:s.label})]},s.label)),n("span",{style:{color:"#777"},children:"Ticks mark where each walk passes the node under the pointer; click a haplotype's bar to lift its walk"})]}),n(V,{model:e,at:r&&{...r,bars:o},onClose:()=>{c(void 0)}})]})}),Vt=Yn;var Zn=h(function({model:e}){let o=e.walkStripLocator;return o?f(ee,{model:e,zIndex:4,overflow:"visible",testId:"graph-walk-strip-locator",children:[n("circle",{cx:o.x,cy:o.y,r:11,fill:"none",stroke:"white",strokeWidth:4}),n("circle",{cx:o.x,cy:o.y,r:11,fill:"none",stroke:"#111",strokeWidth:1.75})]}):null}),Yt=Zn;var $n=1.1,jn=100,Kn=40,qn=800,Un=10,Zt=2;function ge(t){let e=t.deltaY*(t.deltaMode===1?Kn:t.deltaMode===2?qn:1),o=(t.ctrlKey?Un:1)*e/jn;return $n**-Math.max(-Zt,Math.min(Zt,o))}var Jn=40,Qn=100,eo=24,$t=Math.log(16);function to(t,e){let o=t*Math.exp(-Math.max(0,e)/eo);return Math.abs(o)<.001?t:t-o}function no(t,e){let o=Math.abs(t.deltaX)>Math.abs(t.deltaY);return t.ctrlKey||t.metaKey||!o&&(!e||e.scrollZoom)?"zoom":o?"pan":"page"}function qt(t,e,o){H(()=>{if(!t)return;let i=-1/0,r={backlog:0,x:0,y:0,frame:0,last:0},c=p=>{let s=to(r.backlog,Math.min(100,p-r.last));r.backlog-=s,r.last=p,r.frame=r.backlog?requestAnimationFrame(c):0,T(o)&&o.zoom(Math.exp(s),r.x,r.y)},l=p=>{if(o.hostPlacesX||o.followsHostView)return;let m=((p.target instanceof Element?p.target.closest("canvas"):null)??(o.facetPanels?null:e))?.getBoundingClientRect();if(m&&p.clientY-m.top<o.referenceStripZonePx)return;let w=no(p,o.host);if(w!=="page"){if(o.host&&p.stopPropagation(),p.preventDefault(),w==="pan"){if(p.timeStamp-i>Qn){let S=p.deltaMode===1?Jn:1;o.setTransform(o.scale,o.translateX-p.deltaX*S,o.translateY)}return}i=p.timeStamp,m&&(r.x=p.clientX-m.left,r.y=p.clientY-m.top,r.backlog=Math.max(-$t,Math.min($t,r.backlog+Math.log(ge(p)))),r.frame||(r.last=performance.now()-1e3/60,r.frame=requestAnimationFrame(c)))}};return t.addEventListener("wheel",l,{passive:!1}),()=>{cancelAnimationFrame(r.frame),t.removeEventListener("wheel",l)}},[t,e,o])}var jt=3,ve="data-gesture-owner",Y=t=>({x:t.clientX,y:t.clientY});function Kt(t){let[e,o]=[...t.values()];return{spread:Math.hypot(e.x-o.x,e.y-o.y),mid:{x:(e.x+o.x)/2,y:(e.y+o.y)/2}}}function Ut(t){let e=k({x:0,y:0}),o=k({x:0,y:0}),i=k(!1),r=k(void 0),c=a=>r.current!==void 0&&a.pointerId!==r.current,l=k(new Map),p=k(null),s=k(null),u=k(!1),m=k(null),w=k(!1),S=k({frame:0,pan:null,hover:null,pinch:!1});H(()=>()=>{cancelAnimationFrame(S.current.frame)},[]);let[N,I]=C(),[O,D]=C(!1),[Z,$]=C(void 0);function R(a){let d=a.currentTarget.getBoundingClientRect();return{x:a.clientX-d.left,y:a.clientY-d.top}}function L(a,d){if(t.layoutResult?.tubeMap)return t.tubeMapNodeAt(a,d);let g=t.referenceStripNodeAt(a,d);if(g)return g;let{nodePositions:v}=t;if(!v)return null;let{x:y,y:b}=se(a,d,t,t.axisScale);return le(v,y,b,t.axisScale,t.positionsVersion,t.nodeInk)}function en(a,d){let{nodePositions:g,graph:v}=t;if(!g||!v)return null;let{x:y,y:b}=se(a,d,t,t.axisScale);return ce(g,v,y,b,t.axisScale,t.effectiveDrawPaths&&!t.facetPanels,t.positionsVersion,t.deletionEdgeIndexes,t.hiddenEdgeIndexes,t.deletionRoutes,t.layoutResult?.stranded)}function tn(a){a.button===0&&a.preventDefault()}function nn(a){if(a.button!==0)return;let d=l.current;if(c(a)){t.isPanning&&!w.current&&a.pointerType==="touch"&&d.size===1&&(a.currentTarget.setPointerCapture(a.pointerId),d.set(a.pointerId,Y(a)),s.current=Kt(d),i.current=!0);return}i.current=!1,o.current={x:a.clientX,y:a.clientY},a.currentTarget.removeAttribute(ve);let g=t.followsHostView;if(t.hostPlacesX||g&&a.shiftKey)return;a.currentTarget.setPointerCapture(a.pointerId),r.current=a.pointerId,p.current=a.currentTarget,d.clear(),d.set(a.pointerId,Y(a));let{x:v,y}=R(a),b=y<t.referenceStripZonePx,P=t.layoutResult?.tubeMap||b?null:L(v,y);g&&P&&a.currentTarget.setAttribute(ve,""),w.current=g,u.current=b&&!g,P?t.setDraggingNode(P):t.setPanning(!0),e.current={x:a.clientX,y:a.clientY}}function ye(){let a=s.current,d=p.current;if(!a||!d)return;let g=Kt(l.current),v=d.getBoundingClientRect();a.spread>0&&g.spread>0&&t.zoom(g.spread/a.spread,a.mid.x-v.left,a.mid.y-v.top),t.setTransform(t.scale,t.translateX+g.mid.x-a.mid.x,t.translateY+g.mid.y-a.mid.y),s.current=g}function on(){let a=S.current,{pan:d,hover:g,pinch:v}=a;if(a.frame=0,a.pan=null,a.hover=null,a.pinch=!1,v&&ye(),d&&u.current?t.host?.horizontalScroll(-d.dx):d&&w.current?t.setTransform(t.scale,t.translateX,t.translateY+d.dy):d&&t.setTransform(t.scale,t.translateX+d.dx,t.translateY+d.dy),!g)return;let{x:y,y:b}=g,P=t.facetPanels?void 0:yt(t.overlayLabels,y,b);$(M=>M?.label===P?.label&&M?.readout===P?.readout?M:P);let E=t.walkRowBars;if(E){let M=t.walkRowAt(y,b);t.setHoveredWalkRow(M===void 0?null:[E.reference,...E.rows][M].name)}if(t.nodePositions&&t.graph){let M=L(y,b);t.setHoveredPanel(t.tubeMapPanelAt(b)),t.setHoveredNode(M,{x:y,y:b}),D(M!==null&&!t.hostPlacesX&&!t.layoutResult?.tubeMap&&b>=t.referenceStripZonePx),t.setHoveredTube(M===null&&t.layoutResult?.tubeMap?t.tubeAt(y,b):null),t.setHoveredEdge(M||t.layoutResult?.tubeMap||!t.hoverLightsEverything?null:en(y,b))}}function j(){S.current.frame||(S.current.frame=requestAnimationFrame(on))}function rn(){let a=S.current;cancelAnimationFrame(a.frame),a.frame=0,a.pan=null,a.hover=null,a.pinch=!1}function an(a){let d=l.current;if(s.current&&d.has(a.pointerId)){d.set(a.pointerId,Y(a)),S.current.pinch=!0,j();return}if(c(a)||m.current)return;let g=a.clientX-e.current.x,v=a.clientY-e.current.y;e.current={x:a.clientX,y:a.clientY},Math.hypot(a.clientX-o.current.x,a.clientY-o.current.y)>jt&&(i.current=!0);let y=S.current;if(t.draggingNode)t.moveNode(t.draggingNode,g/t.scaleX,v/t.scaleY);else if(t.isPanning)y.pan={dx:(y.pan?.dx??0)+g,dy:(y.pan?.dy??0)+v},j();else{let b=a.currentTarget.getBoundingClientRect();y.hover={x:a.clientX-b.left,y:a.clientY-b.top},j()}}function ae(a){let d=l.current;if(s.current&&d.has(a.pointerId)){S.current.pinch&&(S.current.pinch=!1,ye()),d.delete(a.pointerId),s.current=null;let[[g,v]]=[...d];r.current=g,e.current=v;return}c(a)||(r.current=void 0,d.clear(),T(t)&&t.stopDragging())}function sn(a){c(a)||(r.current=void 0,l.current.clear(),s.current=null,rn(),$(void 0),D(!1),T(t)&&(t.stopDragging(),t.clearHover()))}function ln(a){let{x:d,y:g}=R(a),v=L(d,g),{clientX:y,clientY:b}=a;if(v){a.preventDefault(),I({clientX:y,clientY:b,nodeId:v});return}let P=t.walkRowAt(d,g);P!==void 0&&(a.preventDefault(),I({clientX:y,clientY:b,row:P}))}function cn(a){if(!i.current){let{x:d,y:g}=R(a),v=L(d,g);t.setSelectedNode(v),v&&t.showNodeDetails(v)}}H(()=>()=>{m.current?.end()},[]);function pn(a){if(a.button!==0||t.hostPlacesX||t.followsHostView||!(a.target instanceof Element)||!a.target.closest(`[${tt}]`))return;m.current?.end(),u.current=!1,w.current=!1;let d=a.pointerId,g=Y(a),v=g,y={moved:!1,end:()=>{window.removeEventListener("pointermove",b,!0),window.removeEventListener("pointerup",P,!0),window.removeEventListener("pointercancel",P,!0),y.moved&&T(t)&&t.stopDragging()}};function b(E){if(E.pointerId!==d)return;if(!y.moved){if(Math.hypot(E.clientX-g.x,E.clientY-g.y)<=jt)return;y.moved=!0,t.setPanning(!0)}let M=S.current;M.pan={dx:(M.pan?.dx??0)+E.clientX-v.x,dy:(M.pan?.dy??0)+E.clientY-v.y},v=Y(E),j()}function P(E){E.pointerId===d&&(y.end(),setTimeout(()=>{m.current===y&&(m.current=null)},0))}m.current=y,window.addEventListener("pointermove",b,!0),window.addEventListener("pointerup",P,!0),window.addEventListener("pointercancel",P,!0)}function un(a){m.current?.moved&&(m.current=null,a.stopPropagation())}let dn={cursor:t.isPanning||t.draggingNode?"grabbing":O?"move":"grab",touchAction:t.hostPlacesX?"auto":"none",overscrollBehavior:"contain"},fn=t.host!==void 0&&!t.hostPlacesX&&!t.followsHostView?{[ve]:"",onMouseDown:a=>{a.stopPropagation()}}:{};return{canvasStyle:dn,surfaceProps:fn,handlers:{onMouseDown:tn,onPointerDown:nn,onPointerMove:an,onPointerUp:ae,onPointerCancel:ae,onLostPointerCapture:ae,onPointerLeave:sn,onClick:cn,onContextMenu:ln},contextMenu:N,hoveredChip:Z,labelHandlers:{onPointerDown:pn,onClickCapture:un},closeContextMenu:()=>{I(void 0)}}}var oo={position:"relative"},ro={position:"relative",lineHeight:0,isolation:"isolate"},ao={position:"absolute",left:0,right:0,bottom:0,zIndex:0},io={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},so={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},lo=h(function({model:e}){return n(G,{children:e.visibleRowLabels.map(({label:o,y:i,top:r})=>n("div",{"data-testid":"graph-row-label",style:{...so,top:r},children:o},i))})}),co={position:"absolute",top:F,right:F,display:"flex",flexDirection:"column",borderRadius:3,overflowX:"hidden",overflowY:"auto",zIndex:4},Jt={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},po={...Jt,color:"#18181c",fontWeight:600},uo=h(function({model:e}){let o=k(null),i=e.legendAtRest;return H(()=>{let r=o.current;if(!r||!i)return;let c=()=>{T(e)&&e.legendAtRest&&e.setLegendSize({width:r.offsetWidth,height:r.scrollHeight})};c();let l=new ResizeObserver(c);return l.observe(r),r.firstElementChild&&l.observe(r.firstElementChild),()=>{l.disconnect()}},[e,i]),n("div",{ref:o,style:{...co,top:F+e.referenceStripZonePx,maxHeight:e.canvasHeight-2*F-e.referenceStripZonePx},children:n(kt,{model:e})})}),fo=h(function({model:e}){let o=e.overlayLabels.sizes,i=o.flatMap(({key:r,leader:c})=>c?[{key:r,...c}]:[]);return f(G,{children:[i.length>0?n(ee,{model:e,zIndex:2,overflow:"visible",children:i.map(({key:r,arcX:c,arcY:l,labelX:p,labelY:s})=>n("line",{"data-testid":"graph-label-leader",x1:c,y1:l,x2:p,y2:s,stroke:"#18181c",strokeWidth:1},r))}):null,o.map(({key:r,text:c,x:l,y:p,kind:s})=>n("div",{"data-testid":"graph-size-label",style:{...s==="deletion"?po:Jt,left:l,top:p},children:c},r))]})}),Qt=h(function({model:e,handle:{canvasRef:o,canvas:i},ownChrome:r}){let{handlers:c,canvasStyle:l,surfaceProps:p,labelHandlers:s,contextMenu:u,closeContextMenu:m,hoveredChip:w}=Ut(e),[S,N]=C(null);qt(S,i,e);let I=e.facetPanels!==void 0;return f("div",{style:oo,...p,children:[r?n(Ot,{model:e}):null,f("div",{ref:N,style:ro,...s,onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{T(e)&&e.setPointerInPane(!1)},children:[e.referenceStripShown?n("div",{style:{...ao,top:e.referenceStripZonePx,background:Q}}):null,n("canvas",{ref:o,"data-testid":"graph-genome-canvas",style:{...l,width:e.paneWidth,height:e.canvasHeight,display:"block",position:"relative",zIndex:1},...c}),I?n(Rt,{model:e,handlers:c,canvasStyle:l}):f(G,{children:[n(St,{model:e}),n(fe,{model:e}),n(wt,{model:e}),n(lo,{model:e}),n(fo,{model:e}),n(ot,{model:e}),n(ht,{model:e}),n(bt,{model:e}),n(xt,{model:e}),n(Yt,{model:e}),n(uo,{model:e})]}),r?n("div",{style:io,children:n(xe,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null,n(Dt,{model:e,chip:w})]}),e.walkStripShown?n(Vt,{model:e}):null,n(V,{model:e,at:u,onClose:m}),r?.renderError?n(ie,{error:r.renderError,onReset:r.retryRender}):null,r&&e.error?n(ie,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),ho=h(function({model:e}){let{canvasRef:o,canvas:i,error:r,retry:c}=Mt(Pt,e);return n(Qt,{model:e,handle:{canvasRef:o,canvas:i},ownChrome:{renderError:r,retryRender:c}})}),mo=h(function({model:e,handle:o}){return o?n(Qt,{model:e,handle:o}):n(ho,{model:e})}),$i=mo;export{Pt as a,$i as b};
2
+ //# sourceMappingURL=chunk-UHV6XIDG.js.map
@@ -1,2 +1,2 @@
1
- import{d as A}from"./chunk-ROZPEXN4.js";import{a as x,d as O}from"./chunk-3VGXCEMQ.js";import{e as I}from"./chunk-IKJZPPOA.js";function G(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function se(e){let t=x(e).slice(1);return t.length>0?t:void 0}function M(e){return e.type==="WalkTabixSyntenyAdapter"||e.type==="RgfaTabixAdapter"&&(typeof e.walksUri=="string"&&e.walksUri!==""||I(e.walksLocation))}function oe(e){return e.type==="GbzBaseSyntenyAdapter"||M(e)}function ie(e){let{defaultHaplotypes:t}=e;return M(e)&&G(t)&&t.length>0?t:void 0}function ae(e){return x(e)[0]}function ce(e){return O(e).adapter}function ue(e,t){return e===void 0||e===t?void 0:`The graph is cut on its reference, ${e}: open it from a view of ${e}`}function i(e,t){return typeof e.get=="function"?e.get(t):e[t]}function b(e,t){return e.find(n=>n.trackId===t)}function l(e){return`${e.trackId} ${e.name??""}`}var U=new Set(["BedAdapter","BedTabixAdapter","BigBedAdapter","VcfAdapter","VcfTabixAdapter"]),R=/repeat|tandem|\bstr\b|vntr|trf|trgt|vamos|expansion|microsat/i;function Ge(e,t){let n=t?b(e,t):void 0;return n||e.filter(s=>U.has(s.adapterType)).find(s=>R.test(l(s)))}var B=/^\w+=[^;]*(;\w+=[^;]*)*$/;function H(e){let t=i(e,"name");if(!(typeof t!="string"||!B.test(t)))return Object.fromEntries(t.split(";").map(n=>{let r=n.indexOf("=");return[n.slice(0,r),n.slice(r+1)]}))}function d(e,t){let n=i(e,t);return n!==void 0?n:i(e,"INFO")?.[t]??H(e)?.[t]}var P=["RUS","MOTIFS","RU","motifs","motif","sequence","consensus"],v=["RUL","period","PERIOD","consensusSize","unit","unitLength"],j=["TRID","REPID","VARID","ID","name","id"];function h(e,t){for(let n of t){let r=d(e,n),s=String((Array.isArray(r)?r[0]:r)??"").split(",")[0].trim();if(s!==""&&s!==".")return s}}var $=/^[ACGTURYSWKMBDHVN]+$/i;function V(e){let t=Number(h(e,v));if(Number.isFinite(t)&&t>0)return Math.round(t);let n=h(e,P);return n&&$.test(n)?n.length:void 0}function m(e){return(Array.isArray(e)?e:String(e??"").split(",")).map(n=>{let r=n===""||n===null||n===void 0?NaN:Number(n);return Number.isFinite(r)?r:void 0})}function N(e){return(Array.isArray(e)?e:String(e??"").split(",")).map(n=>{let r=String(n??"").trim();return r===""||r==="."?void 0:r})}var w="<CNV:TR>";function K(e){let t=N(i(e,"ALT"));if(!t.includes(w))return;let n=m(d(e,"RN")),r=N(d(e,"RUS")),s=m(d(e,"RUL")),o=m(d(e,"RUC")),a=m(d(e,"RB")),c=0;return t.map((u,f)=>{let p=n[f]??(u===w?1:0),k=0,S=0;for(let F=0;F<p;F++,c++){let y=r[c],L=s[c]??(y&&$.test(y)?y.length:void 0),_=o[c],C=a[c]??(L&&_!==void 0?Math.round(L*_):void 0);C!==void 0&&(k+=C,S++)}return u===w&&p>0&&S===p?k:void 0})}function Y(e,t,n){let r=e?.includes("|");return(e??"").split(/[/|]/).flatMap((s,o)=>{let a=s===""?NaN:Number(s),c=a>0?t[a-1]:n;return!Number.isInteger(a)||c===void 0?[]:[{bp:c,...r?{haplotype:o+1}:{}}]})}function W(e,t,n){let r=i(e,"samples"),s={};for(let[o,a]of Object.entries(r??{})){let c=m(a.SD),u=m(a.AL).flatMap((p,k)=>p!==void 0&&p>0?[c[k]===void 0?{bp:p}:{bp:p,spanningReads:c[k]}]:[]),f=u.length>0||!t?u:Y(N(a.GT)[0],t,n);f.length>0&&(s[o]=f)}return Object.keys(s).length>0?s:void 0}function J(e,t){let n=d(e,"start"),r=d(e,"end"),s=m(d(e,"SVLEN"))[0];return t&&s!==void 0?{start:n+1,end:n+1+s}:{start:n,end:r}}function Ue(e){let t=[];for(let n of e){let r=K(n),{start:s,end:o}=J(n,r!==void 0),a=V(n);if(!(o>s)||a===void 0)continue;let c=d(n,"refName"),u=h(n,P),f=h(n,j);t.push({key:`${c}:${s}-${o}`,name:(f&&!B.test(f)?f:void 0)??(u&&u.length<=12?`(${u})n`:`${c}:${(s+1).toLocaleString("en-US")}-${o.toLocaleString("en-US")}`),refName:c,start:s,end:o,unit:a,motif:u,calls:W(n,r,o-s)})}return t.sort((n,r)=>n.start-r.start)}function T(e){let t=[];for(let n of[...e].sort((r,s)=>r.start-s.start)){let r=t.at(-1);r&&n.start<=r.end?r.end=Math.max(r.end,n.end):t.push({...n})}return t}function E(e){let t=[],n=new Map;for(let r of[...e].sort((s,o)=>s.start-o.start)){let s=`${r.refName} ${r.strand} ${r.name}`,o=n.get(s);if(o&&r.start<o.end)o.end=Math.max(o.end,r.end),o.exons=T([...o.exons,...r.exons]);else{let a={...r,exons:T(r.exons)};t.push(a),n.set(s,a)}}return t}var q=new Set(["Gff3TabixAdapter","Gff3Adapter","BedTabixAdapter","BedAdapter","GtfTabixAdapter","GtfAdapter","BigBedAdapter","NCListAdapter"]),z=/gene|refseq|gencode|ensembl|annotation/i,X=new Set(["BedTabixAdapter","BedAdapter"]);function Qe(e,t){let n=t?b(e,t):void 0;if(n)return n;let r=e.filter(s=>q.has(s.adapterType)&&!R.test(l(s)));return r.find(s=>z.test(l(s)))??r.find(s=>!X.has(s.adapterType))}var Q=/\bTEs?\b|transpos/i;function Ze(e){return e&&Q.test(l(e))?"TE":"gene"}function en(e,t){let n=e.tracks?.find(r=>A(r.configuration,"trackId")===t)?.displays[0];return n?A(n.configuration,"filter")??[]:[]}var Z=new Set(["chromosome","region","contig","supercontig","scaffold"]),ee=new Set(["exon","CDS","five_prime_UTR","three_prime_UTR","UTR"]);function D(e,t){let n=i(e,"type");typeof n=="string"&&ee.has(n)&&t.push({start:i(e,"start"),end:i(e,"end")});let r=i(e,"subfeatures");for(let s of r??[])D(s,t)}function nn(e){let t=[];for(let n of e){let r=i(n,"gene_name")??i(n,"name")??i(n,"gene")??i(n,"gene_id"),s=i(n,"start"),o=i(n,"end");if(!r||!(o>s)||Z.has(i(n,"type")))continue;let a=[];D(n,a),t.push({name:r,refName:i(n,"refName"),start:s,end:o,strand:i(n,"strand")??0,exons:a.length?T(a):[{start:s,end:o}]})}return E(t)}var g=JBrowseExports["tss-react/mui"],ne=e=>g!=null&&e in Object(g)?g[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from 'tss-react/mui' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e});var rn=ne("makeStyles"),sn=g&&g.__esModule?g.default:g;export{se as a,M as b,oe as c,ie as d,ae as e,ce as f,ue as g,U as h,Ge as i,Ue as j,q as k,Qe as l,Ze as m,en as n,nn as o,rn as p};
2
- //# sourceMappingURL=chunk-PDLKFVVK.js.map
1
+ import{d as A}from"./chunk-ROZPEXN4.js";import{a as x,d as O}from"./chunk-3VGXCEMQ.js";import{f as I}from"./chunk-6VNDP3UB.js";function G(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function se(e){let t=x(e).slice(1);return t.length>0?t:void 0}function M(e){return e.type==="WalkTabixSyntenyAdapter"||e.type==="RgfaTabixAdapter"&&(typeof e.walksUri=="string"&&e.walksUri!==""||I(e.walksLocation))}function oe(e){return e.type==="GbzBaseSyntenyAdapter"||M(e)}function ie(e){let{defaultHaplotypes:t}=e;return M(e)&&G(t)&&t.length>0?t:void 0}function ae(e){return x(e)[0]}function ce(e){return O(e).adapter}function ue(e,t){return e===void 0||e===t?void 0:`The graph is cut on its reference, ${e}: open it from a view of ${e}`}function i(e,t){return typeof e.get=="function"?e.get(t):e[t]}function b(e,t){return e.find(n=>n.trackId===t)}function l(e){return`${e.trackId} ${e.name??""}`}var U=new Set(["BedAdapter","BedTabixAdapter","BigBedAdapter","VcfAdapter","VcfTabixAdapter"]),R=/repeat|tandem|\bstr\b|vntr|trf|trgt|vamos|expansion|microsat/i;function Ge(e,t){let n=t?b(e,t):void 0;return n||e.filter(s=>U.has(s.adapterType)).find(s=>R.test(l(s)))}var B=/^\w+=[^;]*(;\w+=[^;]*)*$/;function H(e){let t=i(e,"name");if(!(typeof t!="string"||!B.test(t)))return Object.fromEntries(t.split(";").map(n=>{let r=n.indexOf("=");return[n.slice(0,r),n.slice(r+1)]}))}function d(e,t){let n=i(e,t);return n!==void 0?n:i(e,"INFO")?.[t]??H(e)?.[t]}var P=["RUS","MOTIFS","RU","motifs","motif","sequence","consensus"],v=["RUL","period","PERIOD","consensusSize","unit","unitLength"],j=["TRID","REPID","VARID","ID","name","id"];function h(e,t){for(let n of t){let r=d(e,n),s=String((Array.isArray(r)?r[0]:r)??"").split(",")[0].trim();if(s!==""&&s!==".")return s}}var $=/^[ACGTURYSWKMBDHVN]+$/i;function V(e){let t=Number(h(e,v));if(Number.isFinite(t)&&t>0)return Math.round(t);let n=h(e,P);return n&&$.test(n)?n.length:void 0}function m(e){return(Array.isArray(e)?e:String(e??"").split(",")).map(n=>{let r=n===""||n===null||n===void 0?NaN:Number(n);return Number.isFinite(r)?r:void 0})}function N(e){return(Array.isArray(e)?e:String(e??"").split(",")).map(n=>{let r=String(n??"").trim();return r===""||r==="."?void 0:r})}var w="<CNV:TR>";function K(e){let t=N(i(e,"ALT"));if(!t.includes(w))return;let n=m(d(e,"RN")),r=N(d(e,"RUS")),s=m(d(e,"RUL")),o=m(d(e,"RUC")),a=m(d(e,"RB")),c=0;return t.map((u,f)=>{let p=n[f]??(u===w?1:0),k=0,S=0;for(let F=0;F<p;F++,c++){let y=r[c],L=s[c]??(y&&$.test(y)?y.length:void 0),_=o[c],C=a[c]??(L&&_!==void 0?Math.round(L*_):void 0);C!==void 0&&(k+=C,S++)}return u===w&&p>0&&S===p?k:void 0})}function Y(e,t,n){let r=e?.includes("|");return(e??"").split(/[/|]/).flatMap((s,o)=>{let a=s===""?NaN:Number(s),c=a>0?t[a-1]:n;return!Number.isInteger(a)||c===void 0?[]:[{bp:c,...r?{haplotype:o+1}:{}}]})}function W(e,t,n){let r=i(e,"samples"),s={};for(let[o,a]of Object.entries(r??{})){let c=m(a.SD),u=m(a.AL).flatMap((p,k)=>p!==void 0&&p>0?[c[k]===void 0?{bp:p}:{bp:p,spanningReads:c[k]}]:[]),f=u.length>0||!t?u:Y(N(a.GT)[0],t,n);f.length>0&&(s[o]=f)}return Object.keys(s).length>0?s:void 0}function J(e,t){let n=d(e,"start"),r=d(e,"end"),s=m(d(e,"SVLEN"))[0];return t&&s!==void 0?{start:n+1,end:n+1+s}:{start:n,end:r}}function Ue(e){let t=[];for(let n of e){let r=K(n),{start:s,end:o}=J(n,r!==void 0),a=V(n);if(!(o>s)||a===void 0)continue;let c=d(n,"refName"),u=h(n,P),f=h(n,j);t.push({key:`${c}:${s}-${o}`,name:(f&&!B.test(f)?f:void 0)??(u&&u.length<=12?`(${u})n`:`${c}:${(s+1).toLocaleString("en-US")}-${o.toLocaleString("en-US")}`),refName:c,start:s,end:o,unit:a,motif:u,calls:W(n,r,o-s)})}return t.sort((n,r)=>n.start-r.start)}function T(e){let t=[];for(let n of[...e].sort((r,s)=>r.start-s.start)){let r=t.at(-1);r&&n.start<=r.end?r.end=Math.max(r.end,n.end):t.push({...n})}return t}function E(e){let t=[],n=new Map;for(let r of[...e].sort((s,o)=>s.start-o.start)){let s=`${r.refName} ${r.strand} ${r.name}`,o=n.get(s);if(o&&r.start<o.end)o.end=Math.max(o.end,r.end),o.exons=T([...o.exons,...r.exons]);else{let a={...r,exons:T(r.exons)};t.push(a),n.set(s,a)}}return t}var q=new Set(["Gff3TabixAdapter","Gff3Adapter","BedTabixAdapter","BedAdapter","GtfTabixAdapter","GtfAdapter","BigBedAdapter","NCListAdapter"]),z=/gene|refseq|gencode|ensembl|annotation/i,X=new Set(["BedTabixAdapter","BedAdapter"]);function Qe(e,t){let n=t?b(e,t):void 0;if(n)return n;let r=e.filter(s=>q.has(s.adapterType)&&!R.test(l(s)));return r.find(s=>z.test(l(s)))??r.find(s=>!X.has(s.adapterType))}var Q=/\bTEs?\b|transpos/i;function Ze(e){return e&&Q.test(l(e))?"TE":"gene"}function en(e,t){let n=e.tracks?.find(r=>A(r.configuration,"trackId")===t)?.displays[0];return n?A(n.configuration,"filter")??[]:[]}var Z=new Set(["chromosome","region","contig","supercontig","scaffold"]),ee=new Set(["exon","CDS","five_prime_UTR","three_prime_UTR","UTR"]);function D(e,t){let n=i(e,"type");typeof n=="string"&&ee.has(n)&&t.push({start:i(e,"start"),end:i(e,"end")});let r=i(e,"subfeatures");for(let s of r??[])D(s,t)}function nn(e){let t=[];for(let n of e){let r=i(n,"gene_name")??i(n,"name")??i(n,"gene")??i(n,"gene_id"),s=i(n,"start"),o=i(n,"end");if(!r||!(o>s)||Z.has(i(n,"type")))continue;let a=[];D(n,a),t.push({name:r,refName:i(n,"refName"),start:s,end:o,strand:i(n,"strand")??0,exons:a.length?T(a):[{start:s,end:o}]})}return E(t)}var g=JBrowseExports["tss-react/mui"],ne=e=>g!=null&&e in Object(g)?g[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from 'tss-react/mui' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e});var rn=ne("makeStyles"),sn=g&&g.__esModule?g.default:g;export{se as a,M as b,oe as c,ie as d,ae as e,ce as f,ue as g,U as h,Ge as i,Ue as j,q as k,Qe as l,Ze as m,en as n,nn as o,rn as p};
2
+ //# sourceMappingURL=chunk-WUOXZAGN.js.map
@@ -1,2 +1,2 @@
1
- import{A as N,C as I,d as H,g as _,h as A,i as W,k as X,l as j,m as z,n as F,s as O,t as E,v as Y,x as J,y as K}from"./chunk-5EWKB2JM.js";import{Db as R,Fb as B,Nb as D,q as S,r as M}from"./chunk-MJS65EKE.js";import"./chunk-W7IHIVSE.js";import"./chunk-T2VC3EEL.js";import{o as P}from"./chunk-CVHKXFVS.js";import"./chunk-BJHWGRMP.js";import"./chunk-OGXVDZPS.js";import"./chunk-CZI7IP5S.js";import"./chunk-IK3MQ4ZJ.js";import"./chunk-VKZALU57.js";import"./chunk-IKJZPPOA.js";import"./chunk-3WG3GF2A.js";import"./chunk-NIEZKWQV.js";import{a as k,b as e,c as f}from"./chunk-JMBDTNUR.js";var m=JBrowseExports["@jbrowse/display-kit/renderDisplaySvg"],rt=t=>m!=null&&t in Object(m)?m[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/display-kit/renderDisplaySvg' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t});var U=rt("renderDisplaySvg");var dt=m&&m.__esModule?m.default:m;var w=JBrowseExports["@jbrowse/core/util/paintLayer"],ot=t=>w!=null&&t in Object(w)?w[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/core/util/paintLayer' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t}),C=ot("PaintLayer"),yt=w&&w.__esModule?w.default:w;var L={fontFamily:"sans-serif",fontSize:11},Z=16,at=2,V=t=>t;function q({model:t,lift:a,drawPaths:i,width:n,height:r,rasterize:l}){let o=t.buildDrawing(a,i);if(!o)return null;let s=l?at:1,c=l?void 0:R(n,r),y=c?.canvas??document.createElement("canvas");c||(y.width=Math.round(n*s),y.height=Math.round(r*s));let{scaleX:b,scaleY:x,translateX:d,translateY:g}=t.screenTransform,h=new B(y);return h.uploadGeometry(o.batch),h.updateTransform({scaleX:b*s,scaleY:x*s,translateX:d*s,translateY:g*s,dpr:s}),h.render([0,0,0,0]),c?e("svg",{width:n,height:r,overflow:"hidden",children:e("g",{dangerouslySetInnerHTML:{__html:c.markup()}})}):e("image",{width:n,height:r,href:y.toDataURL("image/png")})}function it(t,a,i,n){let r=n?0:E,l=t.toUpperCase();return{key:a,width:l.length*P,height:i+r,draw:o=>e("text",{fontFamily:"sans-serif",fontSize:9.5,fontWeight:600,letterSpacing:"0.06em",x:o,y:r,fill:O,children:l},a)}}function $(t,a,i=Z,n){if(!t.swatch)return{key:t.key,width:t.label.length*P,height:i,draw:c=>e("text",{...L,x:c,y:0,fill:"#666",children:t.label},t.key)};let r=t.swatch,l=n??_(r),o=n===void 0?0:n+5,s=(t.strong??"")+t.label;return{key:t.key,width:Math.max(l+5+s.length*P,o+(t.under?.length??0)*P),height:t.under?i*2:i,draw:c=>f("g",{...L,children:[e(F,{swatch:r,x:c+(l-_(r))/2,id:a}),f("text",{x:c+l+5,y:0,children:[t.strong?e("tspan",{fontWeight:"bold",children:t.strong}):null,t.label]}),t.under?e("text",{x:c+o,y:i,children:t.under}):null]},t.key)}}function st({model:t,idPrefix:a}){let i=z(t);if(i.length===0)return null;let n=i.flatMap(p=>p.rows),r=W(n),l=A(n),o=i.flatMap(({testid:p,rows:u,heading:v,spaced:G},tt)=>[...v?[it(v,`${p}-heading`,r,tt===0)]:[],...G?[{key:`${p}-gap`,width:0,height:E,draw:()=>null}]:[],...u.map((et,nt)=>$(et,`${a}-${p}-${nt}`,r,l))]),s=6,c=o.reduce((p,u)=>Math.max(p,u.width),-1/0)+s*2,y=o.reduce((p,u)=>p+u.height,0)+s,x=t.paneWidth-D-c+s,d=D+t.referenceStripZonePx,g=[],h=d+s/2+r/2+4;for(let p of o)g.push({row:p,y:h}),h+=p.height;return f("g",{"data-testid":"graph-svg-keys",children:[e("rect",{x:x-s,y:d,width:c,height:y,rx:3,fill:"#fff"}),g.map(({row:p,y:u})=>e("g",{transform:`translate(0 ${u})`,children:p.draw(x)},p.key))]})}function Q({x:t,y:a,text:i,fontSize:n,anchor:r,bold:l}){let o=i.length*n*.56+6,s=r==="middle"?t-o/2:t-3;return f(k,{children:[e("rect",{x:s,y:a-n*.65,width:o,height:n*1.3,rx:3,fill:"#fff",fillOpacity:.8}),e("text",{x:t,y:a+n*.35,textAnchor:r,fontSize:n,fontWeight:l?600:void 0,fill:"#18181c",children:i})]})}function lt({model:t}){return e("g",{fontFamily:L.fontFamily,children:t.overlayLabels.sizes.map(({key:a,text:i,x:n,y:r,kind:l,leader:o})=>f("g",{children:[o?e("line",{x1:o.arcX,y1:o.arcY,x2:o.labelX,y2:o.labelY,stroke:"#18181c"}):null,e(Q,{x:n,y:r,text:i,fontSize:10,anchor:"middle",bold:l==="deletion"})]},a))})}function pt({model:t}){return e("g",{fontFamily:L.fontFamily,children:t.visibleRowLabels.map(({label:a,y:i,top:n})=>e(Q,{x:10,y:n,text:a,fontSize:11,anchor:"start"},i))})}function ct({model:t,rasterize:a,idPrefix:i}){let n=t.facetPanels,r=t.facetGrid,l=t.facetPlacement;if(!n||!r||!l)return null;let{columns:o,width:s,height:c}=r,y=r.total+S+14,b=j(t).map((d,g)=>$(d,`${i}-facet-key-${g}`)),x=b.map((d,g)=>b.slice(0,g).reduce((h,p)=>h+p.width+14,6));return f(k,{children:[e("g",{transform:`translate(0 ${y})`,children:b.map((d,g)=>d.draw(x[g]))}),n.map((d,g)=>{let h=l.cells[g],p=h%o*(s+S),u=Math.floor(h/o)*(M+c+S),v=d.walks[0],G=$(X(t,v),`${i}-facet-${g}`);return f("g",{transform:`translate(${p} ${u})`,children:[e("g",{transform:`translate(0 ${Z-2})`,children:G.draw(6)}),e("g",{transform:`translate(0 ${M})`,children:e(q,{model:t,lift:d,drawPaths:!1,width:s,height:c,rasterize:a})})]},v.name)})]})}function T({model:t,rasterize:a=!1,idPrefix:i}){let n=t.paneWidth,r=t.canvasHeight,l=!!t.layoutResult?.tubeMap,o={rasterizeLayers:a};return f("g",{"data-testid":"graph-pane-svg",children:[t.facetPanels?e(ct,{model:t,rasterize:a,idPrefix:i}):l?e(C,{width:n,height:r,opts:o,paint:s=>{N(V(s),t,{highlightNode:null})}}):e(q,{model:t,lift:t.drawnHighlight,drawPaths:t.effectiveDrawPaths,width:n,height:r,rasterize:a}),t.facetPanels?null:f(k,{children:[e(H,{model:t}),e(Y,{model:t}),e(lt,{model:t}),e(J,{model:t}),e(I,{model:t,vector:!0}),e(pt,{model:t})]}),t.referenceStripShown?e(C,{width:n,height:r,opts:o,paint:s=>{K(V(s),t,{lit:void 0,dpr:1})}}):null,t.facetPanels?null:e(st,{model:t,idPrefix:i})]})}function gt({model:t,opts:a}){return e(T,{model:t,rasterize:!!a?.rasterizeLayers,idPrefix:`graph-${t.id}`})}function At(t,a){return U(t,a,gt)}export{At as renderGraphTrackSvg};
2
- //# sourceMappingURL=renderSvg-APVNMW6O.js.map
1
+ import{A as N,C as I,d as H,g as _,h as A,i as W,k as X,l as j,m as z,n as F,s as O,t as E,v as Y,x as J,y as K}from"./chunk-MCBYBZZJ.js";import{Db as R,Fb as B,Nb as D,q as S,r as M}from"./chunk-SL4JJJQJ.js";import"./chunk-W7IHIVSE.js";import"./chunk-T2VC3EEL.js";import{o as P}from"./chunk-CVHKXFVS.js";import"./chunk-BJHWGRMP.js";import"./chunk-OGXVDZPS.js";import"./chunk-CZI7IP5S.js";import"./chunk-IK3MQ4ZJ.js";import"./chunk-VKZALU57.js";import"./chunk-6VNDP3UB.js";import"./chunk-3WG3GF2A.js";import"./chunk-NIEZKWQV.js";import{a as k,b as e,c as f}from"./chunk-JMBDTNUR.js";var m=JBrowseExports["@jbrowse/display-kit/renderDisplaySvg"],rt=t=>m!=null&&t in Object(m)?m[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/display-kit/renderDisplaySvg' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t});var U=rt("renderDisplaySvg");var dt=m&&m.__esModule?m.default:m;var w=JBrowseExports["@jbrowse/core/util/paintLayer"],ot=t=>w!=null&&t in Object(w)?w[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/core/util/paintLayer' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t}),C=ot("PaintLayer"),yt=w&&w.__esModule?w.default:w;var L={fontFamily:"sans-serif",fontSize:11},Z=16,at=2,V=t=>t;function q({model:t,lift:a,drawPaths:i,width:n,height:r,rasterize:l}){let o=t.buildDrawing(a,i);if(!o)return null;let s=l?at:1,c=l?void 0:R(n,r),y=c?.canvas??document.createElement("canvas");c||(y.width=Math.round(n*s),y.height=Math.round(r*s));let{scaleX:b,scaleY:x,translateX:d,translateY:g}=t.screenTransform,h=new B(y);return h.uploadGeometry(o.batch),h.updateTransform({scaleX:b*s,scaleY:x*s,translateX:d*s,translateY:g*s,dpr:s}),h.render([0,0,0,0]),c?e("svg",{width:n,height:r,overflow:"hidden",children:e("g",{dangerouslySetInnerHTML:{__html:c.markup()}})}):e("image",{width:n,height:r,href:y.toDataURL("image/png")})}function it(t,a,i,n){let r=n?0:E,l=t.toUpperCase();return{key:a,width:l.length*P,height:i+r,draw:o=>e("text",{fontFamily:"sans-serif",fontSize:9.5,fontWeight:600,letterSpacing:"0.06em",x:o,y:r,fill:O,children:l},a)}}function $(t,a,i=Z,n){if(!t.swatch)return{key:t.key,width:t.label.length*P,height:i,draw:c=>e("text",{...L,x:c,y:0,fill:"#666",children:t.label},t.key)};let r=t.swatch,l=n??_(r),o=n===void 0?0:n+5,s=(t.strong??"")+t.label;return{key:t.key,width:Math.max(l+5+s.length*P,o+(t.under?.length??0)*P),height:t.under?i*2:i,draw:c=>f("g",{...L,children:[e(F,{swatch:r,x:c+(l-_(r))/2,id:a}),f("text",{x:c+l+5,y:0,children:[t.strong?e("tspan",{fontWeight:"bold",children:t.strong}):null,t.label]}),t.under?e("text",{x:c+o,y:i,children:t.under}):null]},t.key)}}function st({model:t,idPrefix:a}){let i=z(t);if(i.length===0)return null;let n=i.flatMap(p=>p.rows),r=W(n),l=A(n),o=i.flatMap(({testid:p,rows:u,heading:v,spaced:G},tt)=>[...v?[it(v,`${p}-heading`,r,tt===0)]:[],...G?[{key:`${p}-gap`,width:0,height:E,draw:()=>null}]:[],...u.map((et,nt)=>$(et,`${a}-${p}-${nt}`,r,l))]),s=6,c=o.reduce((p,u)=>Math.max(p,u.width),-1/0)+s*2,y=o.reduce((p,u)=>p+u.height,0)+s,x=t.paneWidth-D-c+s,d=D+t.referenceStripZonePx,g=[],h=d+s/2+r/2+4;for(let p of o)g.push({row:p,y:h}),h+=p.height;return f("g",{"data-testid":"graph-svg-keys",children:[e("rect",{x:x-s,y:d,width:c,height:y,rx:3,fill:"#fff"}),g.map(({row:p,y:u})=>e("g",{transform:`translate(0 ${u})`,children:p.draw(x)},p.key))]})}function Q({x:t,y:a,text:i,fontSize:n,anchor:r,bold:l}){let o=i.length*n*.56+6,s=r==="middle"?t-o/2:t-3;return f(k,{children:[e("rect",{x:s,y:a-n*.65,width:o,height:n*1.3,rx:3,fill:"#fff",fillOpacity:.8}),e("text",{x:t,y:a+n*.35,textAnchor:r,fontSize:n,fontWeight:l?600:void 0,fill:"#18181c",children:i})]})}function lt({model:t}){return e("g",{fontFamily:L.fontFamily,children:t.overlayLabels.sizes.map(({key:a,text:i,x:n,y:r,kind:l,leader:o})=>f("g",{children:[o?e("line",{x1:o.arcX,y1:o.arcY,x2:o.labelX,y2:o.labelY,stroke:"#18181c"}):null,e(Q,{x:n,y:r,text:i,fontSize:10,anchor:"middle",bold:l==="deletion"})]},a))})}function pt({model:t}){return e("g",{fontFamily:L.fontFamily,children:t.visibleRowLabels.map(({label:a,y:i,top:n})=>e(Q,{x:10,y:n,text:a,fontSize:11,anchor:"start"},i))})}function ct({model:t,rasterize:a,idPrefix:i}){let n=t.facetPanels,r=t.facetGrid,l=t.facetPlacement;if(!n||!r||!l)return null;let{columns:o,width:s,height:c}=r,y=r.total+S+14,b=j(t).map((d,g)=>$(d,`${i}-facet-key-${g}`)),x=b.map((d,g)=>b.slice(0,g).reduce((h,p)=>h+p.width+14,6));return f(k,{children:[e("g",{transform:`translate(0 ${y})`,children:b.map((d,g)=>d.draw(x[g]))}),n.map((d,g)=>{let h=l.cells[g],p=h%o*(s+S),u=Math.floor(h/o)*(M+c+S),v=d.walks[0],G=$(X(t,v),`${i}-facet-${g}`);return f("g",{transform:`translate(${p} ${u})`,children:[e("g",{transform:`translate(0 ${Z-2})`,children:G.draw(6)}),e("g",{transform:`translate(0 ${M})`,children:e(q,{model:t,lift:d,drawPaths:!1,width:s,height:c,rasterize:a})})]},v.name)})]})}function T({model:t,rasterize:a=!1,idPrefix:i}){let n=t.paneWidth,r=t.canvasHeight,l=!!t.layoutResult?.tubeMap,o={rasterizeLayers:a};return f("g",{"data-testid":"graph-pane-svg",children:[t.facetPanels?e(ct,{model:t,rasterize:a,idPrefix:i}):l?e(C,{width:n,height:r,opts:o,paint:s=>{N(V(s),t,{highlightNode:null})}}):e(q,{model:t,lift:t.drawnHighlight,drawPaths:t.effectiveDrawPaths,width:n,height:r,rasterize:a}),t.facetPanels?null:f(k,{children:[e(H,{model:t}),e(Y,{model:t}),e(lt,{model:t}),e(J,{model:t}),e(I,{model:t,vector:!0}),e(pt,{model:t})]}),t.referenceStripShown?e(C,{width:n,height:r,opts:o,paint:s=>{K(V(s),t,{lit:void 0,dpr:1})}}):null,t.facetPanels?null:e(st,{model:t,idPrefix:i})]})}function gt({model:t,opts:a}){return e(T,{model:t,rasterize:!!a?.rasterizeLayers,idPrefix:`graph-${t.id}`})}function At(t,a){return U(t,a,gt)}export{At as renderGraphTrackSvg};
2
+ //# sourceMappingURL=renderSvg-E5Q7MLCH.js.map