jbrowse-plugin-graphgenomeviewer 7.1.0 → 7.1.2
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.
- package/README.md +17 -8
- package/dist/chunks/AddTrackWorkflow-RPH4ZFSX.js +2 -0
- package/dist/chunks/{AddTrackWorkflow-Q6RY23LF.js.map → AddTrackWorkflow-RPH4ZFSX.js.map} +2 -2
- package/dist/chunks/{ChooseSamplesDialog-BNVYBGJQ.js → ChooseSamplesDialog-JRN4YLBY.js} +2 -2
- package/dist/chunks/{ChooseWalksDialog-EN3C6AQA.js → ChooseWalksDialog-UXLFZTZJ.js} +2 -2
- package/dist/chunks/GbzBaseSyntenyAdapter-LRECKL74.js +2 -0
- package/dist/chunks/GbzBaseSyntenyAdapter-LRECKL74.js.map +7 -0
- package/dist/chunks/{GraphGenomeView-Z2WZKEEO.js → GraphGenomeView-NJ5XCREB.js} +2 -2
- package/dist/chunks/GraphTrackSettingsDialog-47PQ6LM7.js +6 -0
- package/dist/chunks/GraphTrackSettingsDialog-47PQ6LM7.js.map +7 -0
- package/dist/chunks/{HighlightColorDialog-EYBKFSJU.js → HighlightColorDialog-UK5VDDV6.js} +2 -2
- package/dist/chunks/{LinearGraphDisplay-WIBVWRQE.js → LinearGraphDisplay-TXTKAACH.js} +2 -2
- package/dist/chunks/MinigraphBubbleAdapter-HW7XQMAI.js +2 -0
- package/dist/chunks/MinigraphBubbleAdapter-HW7XQMAI.js.map +7 -0
- package/dist/chunks/RgfaTabixAdapter-PSKYWD2X.js +3 -0
- package/dist/chunks/RgfaTabixAdapter-PSKYWD2X.js.map +7 -0
- package/dist/chunks/{TrackWarningsDialog-QT4YEXGD.js → TrackWarningsDialog-TRYBOIHX.js} +2 -2
- package/dist/chunks/WalkTabixSyntenyAdapter-U53JLYVU.js +2 -0
- package/dist/chunks/WalkTabixSyntenyAdapter-U53JLYVU.js.map +7 -0
- package/dist/chunks/chunk-2MCOY3YG.js +3 -0
- package/dist/chunks/chunk-2MCOY3YG.js.map +7 -0
- package/dist/chunks/{chunk-EWFJBQDV.js → chunk-5O6YRJHL.js} +2 -2
- package/dist/chunks/{chunk-EWFJBQDV.js.map → chunk-5O6YRJHL.js.map} +1 -1
- package/dist/chunks/chunk-BUY2PV7D.js +2 -0
- package/dist/chunks/chunk-BUY2PV7D.js.map +7 -0
- package/dist/chunks/chunk-DVCZ3BOC.js +2 -0
- package/dist/chunks/chunk-DVCZ3BOC.js.map +7 -0
- package/dist/chunks/{chunk-SAMJE6GH.js → chunk-EGDLEQ47.js} +3 -3
- package/dist/chunks/{chunk-SAMJE6GH.js.map → chunk-EGDLEQ47.js.map} +4 -4
- package/dist/chunks/chunk-FHZXW7IG.js +2 -0
- package/dist/chunks/chunk-FHZXW7IG.js.map +7 -0
- package/dist/chunks/{chunk-DZ4OUKQV.js → chunk-FITPB5X6.js} +2 -2
- package/dist/chunks/{chunk-DZ4OUKQV.js.map → chunk-FITPB5X6.js.map} +1 -1
- package/dist/chunks/chunk-FVK2THE4.js +2 -0
- package/dist/chunks/chunk-FVK2THE4.js.map +7 -0
- package/dist/chunks/{chunk-AHFQHYJI.js → chunk-IBWORBGY.js} +2 -2
- package/dist/chunks/chunk-MND7GAOG.js +2 -0
- package/dist/chunks/chunk-MND7GAOG.js.map +7 -0
- package/dist/chunks/chunk-MURN3JPK.js +2 -0
- package/dist/chunks/chunk-MURN3JPK.js.map +7 -0
- package/dist/chunks/{chunk-3Q4RBDCL.js → chunk-N6PQZSAX.js} +1 -1
- package/dist/chunks/{chunk-3Q4RBDCL.js.map → chunk-N6PQZSAX.js.map} +1 -1
- package/dist/chunks/chunk-NWJYLP6Z.js +4 -0
- package/dist/chunks/chunk-NWJYLP6Z.js.map +7 -0
- package/dist/chunks/{chunk-YJHYBDYF.js → chunk-S75W27NT.js} +2 -2
- package/dist/chunks/{chunk-YJHYBDYF.js.map → chunk-S75W27NT.js.map} +1 -1
- package/dist/chunks/{chunk-IXQK7JAW.js → chunk-T4HOC6O3.js} +1 -1
- package/dist/chunks/{chunk-IXQK7JAW.js.map → chunk-T4HOC6O3.js.map} +1 -1
- package/dist/chunks/{chunk-AU73K7LX.js → chunk-TUKJRVBS.js} +1 -1
- package/dist/chunks/{chunk-AU73K7LX.js.map → chunk-TUKJRVBS.js.map} +1 -1
- package/dist/chunks/chunk-UGCNPRKC.js +2 -0
- package/dist/chunks/{chunk-E3WYW7Z6.js.map → chunk-UGCNPRKC.js.map} +2 -2
- package/dist/chunks/{chunk-YSTMDXXX.js → chunk-VJ3SO4CH.js} +1 -1
- package/dist/chunks/{chunk-YSTMDXXX.js.map → chunk-VJ3SO4CH.js.map} +1 -1
- package/dist/chunks/{chunk-XT766CZ5.js → chunk-W6EQLQ6H.js} +1 -1
- package/dist/chunks/{chunk-XT766CZ5.js.map → chunk-W6EQLQ6H.js.map} +1 -1
- package/dist/chunks/chunk-WAMBI7OX.js +2 -0
- package/dist/chunks/chunk-WAMBI7OX.js.map +7 -0
- package/dist/chunks/chunk-WCGVUZWP.js +2 -0
- package/dist/chunks/chunk-WCGVUZWP.js.map +7 -0
- package/dist/chunks/chunk-WEGWTC52.js +2 -0
- package/dist/chunks/chunk-WEGWTC52.js.map +7 -0
- package/dist/chunks/chunk-YU7T5WOQ.js +2 -0
- package/dist/chunks/{chunk-6OPB7FOJ.js.map → chunk-YU7T5WOQ.js.map} +2 -2
- package/dist/chunks/{chunk-446RWIA3.js → chunk-ZMOMFU2B.js} +1 -1
- package/dist/chunks/{chunk-446RWIA3.js.map → chunk-ZMOMFU2B.js.map} +1 -1
- package/dist/chunks/renderSvg-KSQI5DH6.js +2 -0
- package/dist/chunks/renderSvg-KSQI5DH6.js.map +7 -0
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +4 -4
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +4 -4
- package/package.json +8 -9
- package/src/GbzBaseSyntenyAdapter/GbzBaseSyntenyAdapter.test.ts +12 -10
- package/src/GbzBaseSyntenyAdapter/GbzBaseSyntenyAdapter.ts +31 -39
- package/src/GbzBaseSyntenyAdapter/configSchema.ts +5 -29
- package/src/GetGraphHaplotypes.ts +6 -15
- package/src/GetGraphReads.ts +7 -14
- package/src/GetSubgraph.ts +11 -20
- package/src/GraphAddTrackWorkflow/AddTrackWorkflow.test.tsx +73 -0
- package/src/GraphAddTrackWorkflow/AddTrackWorkflow.tsx +1 -0
- package/src/GraphAddTrackWorkflow/buildTrackConfig.test.ts +3 -2
- package/src/GraphAddTrackWorkflow/buildTrackConfig.ts +2 -11
- package/src/GraphAddTrackWorkflow/graphManifest.ts +15 -3
- package/src/GraphGenomeView/components/BubbleHalos.tsx +5 -24
- package/src/GraphGenomeView/components/ElTree.tsx +6 -1
- package/src/GraphGenomeView/components/FacetPanels.test.tsx +65 -0
- package/src/GraphGenomeView/components/FacetPanels.tsx +17 -12
- package/src/GraphGenomeView/components/GenePins.tsx +5 -22
- package/src/GraphGenomeView/components/GraphCanvas.tsx +40 -234
- package/src/GraphGenomeView/components/GraphSettingsDialog.tsx +102 -108
- package/src/GraphGenomeView/components/GraphToolbar.tsx +5 -6
- package/src/GraphGenomeView/components/HoverLayer.tsx +3 -7
- package/src/GraphGenomeView/components/HoverTooltip.test.tsx +39 -0
- package/src/GraphGenomeView/components/HoverTooltip.tsx +122 -0
- package/src/GraphGenomeView/components/LabelChip.tsx +3 -5
- package/src/GraphGenomeView/components/LabelLayer.tsx +4 -17
- package/src/GraphGenomeView/components/LabelledSelect.tsx +1 -1
- package/src/GraphGenomeView/components/Legend.tsx +14 -23
- package/src/GraphGenomeView/components/PaneContextMenu.test.tsx +48 -0
- package/src/GraphGenomeView/components/PaneContextMenu.tsx +144 -0
- package/src/GraphGenomeView/components/PaneLayer.tsx +91 -0
- package/src/GraphGenomeView/components/PaneSvg.tsx +32 -50
- package/src/GraphGenomeView/components/ReferenceStripOverlay.test.tsx +48 -0
- package/src/GraphGenomeView/components/ReferenceStripOverlay.tsx +13 -42
- package/src/GraphGenomeView/components/SettingsMenu.test.tsx +29 -0
- package/src/GraphGenomeView/components/SettingsMenu.tsx +56 -65
- package/src/GraphGenomeView/components/TubeMapOverlay.tsx +15 -46
- package/src/GraphGenomeView/components/WalkRowsOverlay.tsx +58 -132
- package/src/GraphGenomeView/components/WalkStrip.tsx +17 -20
- package/src/GraphGenomeView/components/WalkStripLocator.tsx +8 -15
- package/src/GraphGenomeView/components/usePaneGestures.test.tsx +35 -0
- package/src/GraphGenomeView/components/usePaneGestures.ts +88 -91
- package/src/GraphGenomeView/genes/geneFeatures.ts +27 -45
- package/src/GraphGenomeView/graphLayers.ts +4 -4
- package/src/GraphGenomeView/host.ts +1 -1
- package/src/GraphGenomeView/legendSections.test.ts +23 -1
- package/src/GraphGenomeView/legendSections.ts +68 -74
- package/src/GraphGenomeView/model.test.ts +373 -39
- package/src/GraphGenomeView/model.ts +67 -11
- package/src/GraphGenomeView/pane/fitViews.ts +57 -514
- package/src/GraphGenomeView/pane/graphViews.ts +219 -160
- package/src/GraphGenomeView/pane/hostViews.ts +2 -10
- package/src/GraphGenomeView/pane/keepInView.ts +5 -4
- package/src/GraphGenomeView/pane/launchActions.ts +117 -139
- package/src/GraphGenomeView/pane/launchViews.ts +8 -27
- package/src/GraphGenomeView/pane/loadActions.ts +208 -187
- package/src/GraphGenomeView/pane/morph.ts +3 -9
- package/src/GraphGenomeView/pane/paneBase.ts +22 -11
- package/src/GraphGenomeView/pane/renderingActions.ts +65 -11
- package/src/GraphGenomeView/pane/settingActions.ts +17 -42
- package/src/GraphGenomeView/pane/tubeMapViews.ts +445 -0
- package/src/GraphGenomeView/pane/walkRowViews.ts +29 -37
- package/src/GraphGenomeView/renderPipeline.test.ts +1 -1
- package/src/GraphGenomeView/repeats/repeatFeatures.test.ts +23 -0
- package/src/GraphGenomeView/repeats/repeatFeatures.ts +16 -23
- package/src/GraphGenomeView/repeats/walkCalls.test.ts +18 -0
- package/src/GraphGenomeView/repeats/walkCalls.ts +46 -38
- package/src/GraphGenomeView/subgraphLoad.test.ts +67 -3
- package/src/GraphGenomeView/trackFeatures.ts +24 -0
- package/src/GraphGenomeView/tubeMapPanels.ts +28 -36
- package/src/GraphGenomeView/viewModel.ts +8 -56
- package/src/GraphGenomeView/walkRowGroups.ts +104 -30
- package/src/GraphGenomeView/walkRowSpans.test.ts +6 -0
- package/src/GraphGenomeView/walkRowSpans.ts +22 -31
- package/src/GraphGenomeView/walkRowsCut.ts +8 -17
- package/src/LinearGraphDisplay/LinearGraphDisplay.test.ts +173 -26
- package/src/LinearGraphDisplay/components/SubgraphContextSelect.test.tsx +1 -1
- package/src/LinearGraphDisplay/components/SubgraphContextSelect.tsx +3 -3
- package/src/LinearGraphDisplay/components/SubgraphHaplotypesField.test.tsx +3 -3
- package/src/LinearGraphDisplay/components/SubgraphHaplotypesField.tsx +7 -10
- package/src/LinearGraphDisplay/configSchema.ts +0 -3
- package/src/LinearGraphDisplay/denseWindow.ts +8 -11
- package/src/LinearGraphDisplay/model.ts +89 -82
- package/src/MinigraphBubbleAdapter/MinigraphBubbleAdapter.test.ts +21 -0
- package/src/MinigraphBubbleAdapter/MinigraphBubbleAdapter.ts +6 -14
- package/src/MinigraphBubbleAdapter/configSchema.ts +3 -9
- package/src/MinigraphBubbleAdapter/index.ts +1 -2
- package/src/RgfaTabixAdapter/RgfaTabixAdapter.test.ts +45 -1
- package/src/RgfaTabixAdapter/RgfaTabixAdapter.ts +111 -276
- package/src/RgfaTabixAdapter/configSchema.ts +15 -49
- package/src/RgfaTabixAdapter/index.ts +1 -2
- package/src/RgfaTabixAdapter/rgfaBed.ts +25 -15
- package/src/RgfaTabixAdapter/rgfaCut.ts +139 -0
- package/src/RgfaTabixAdapter/test_data/walks2_twopart.GRCh38.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks2_twopart.GRCh38.walks.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/walkFiles.test.ts +33 -0
- package/src/RgfaTabixAdapter/walkReader.ts +103 -27
- package/src/RgfaTabixAdapter/walkRowRuns.test.ts +53 -0
- package/src/RgfaTabixAdapter/walkRowRuns.ts +42 -24
- package/src/WalkTabixSyntenyAdapter/WalkTabixSyntenyAdapter.test.ts +37 -6
- package/src/WalkTabixSyntenyAdapter/WalkTabixSyntenyAdapter.ts +23 -45
- package/src/WalkTabixSyntenyAdapter/configSchema.ts +11 -24
- package/src/WalkTabixSyntenyAdapter/index.ts +1 -2
- package/src/WalkTabixSyntenyAdapter/walkLanes.ts +35 -43
- package/src/adapterImplementing.ts +27 -0
- package/src/graphTrackDefaults/index.ts +14 -20
- package/src/hoverSync/lgvHover.ts +2 -4
- package/src/launchFromGraph/contributors.ts +1 -5
- package/src/launchFromGraph/graphMenuItems.ts +3 -4
- package/src/launchFromGraph/launchFromGraph.test.ts +0 -1
- package/src/launchFromGraph/launchFromGraph.ts +8 -13
- package/src/panSNTabix.test.ts +1 -26
- package/src/panSNTabix.ts +54 -51
- package/src/synteny/lanePairs.ts +8 -0
- package/src/synteny/matchFeature.ts +52 -0
- package/src/tabixRange.ts +13 -10
- package/src/version.ts +1 -1
- package/dist/chunks/AddTrackWorkflow-Q6RY23LF.js +0 -2
- package/dist/chunks/GbzBaseSyntenyAdapter-TIXR4Y3J.js +0 -2
- package/dist/chunks/GbzBaseSyntenyAdapter-TIXR4Y3J.js.map +0 -7
- package/dist/chunks/GraphTrackSettingsDialog-TAM6PMXD.js +0 -6
- package/dist/chunks/GraphTrackSettingsDialog-TAM6PMXD.js.map +0 -7
- package/dist/chunks/MinigraphBubbleAdapter-AGI2UYQR.js +0 -2
- package/dist/chunks/MinigraphBubbleAdapter-AGI2UYQR.js.map +0 -7
- package/dist/chunks/RgfaTabixAdapter-2OL5X3HF.js +0 -3
- package/dist/chunks/RgfaTabixAdapter-2OL5X3HF.js.map +0 -7
- package/dist/chunks/WalkTabixSyntenyAdapter-UKFHCFOF.js +0 -2
- package/dist/chunks/WalkTabixSyntenyAdapter-UKFHCFOF.js.map +0 -7
- package/dist/chunks/chunk-5SFGHDQA.js +0 -2
- package/dist/chunks/chunk-5SFGHDQA.js.map +0 -7
- package/dist/chunks/chunk-6OPB7FOJ.js +0 -2
- package/dist/chunks/chunk-AMFIBQVR.js +0 -2
- package/dist/chunks/chunk-AMFIBQVR.js.map +0 -7
- package/dist/chunks/chunk-BJMRBVG3.js +0 -2
- package/dist/chunks/chunk-BJMRBVG3.js.map +0 -7
- package/dist/chunks/chunk-E3WYW7Z6.js +0 -2
- package/dist/chunks/chunk-EHCF6AXH.js +0 -2
- package/dist/chunks/chunk-EHCF6AXH.js.map +0 -7
- package/dist/chunks/chunk-GOFS7BXK.js +0 -3
- package/dist/chunks/chunk-GOFS7BXK.js.map +0 -7
- package/dist/chunks/chunk-IJQTSJGT.js +0 -4
- package/dist/chunks/chunk-IJQTSJGT.js.map +0 -7
- package/dist/chunks/chunk-J6NZIAZF.js +0 -2
- package/dist/chunks/chunk-J6NZIAZF.js.map +0 -7
- package/dist/chunks/chunk-LUTMKRXY.js +0 -2
- package/dist/chunks/chunk-LUTMKRXY.js.map +0 -7
- package/dist/chunks/chunk-MHPJB22Z.js +0 -2
- package/dist/chunks/chunk-MHPJB22Z.js.map +0 -7
- package/dist/chunks/chunk-TXI43PEN.js +0 -2
- package/dist/chunks/chunk-TXI43PEN.js.map +0 -7
- package/dist/chunks/chunk-WRH2EJKX.js +0 -2
- package/dist/chunks/chunk-WRH2EJKX.js.map +0 -7
- package/dist/chunks/chunk-WX26KTZM.js +0 -2
- package/dist/chunks/chunk-WX26KTZM.js.map +0 -7
- package/dist/chunks/renderSvg-ST2GBBOC.js +0 -2
- package/dist/chunks/renderSvg-ST2GBBOC.js.map +0 -7
- package/src/GraphGenomeView/components/WalkRowContextMenu.tsx +0 -105
- /package/dist/chunks/{ChooseSamplesDialog-BNVYBGJQ.js.map → ChooseSamplesDialog-JRN4YLBY.js.map} +0 -0
- /package/dist/chunks/{ChooseWalksDialog-EN3C6AQA.js.map → ChooseWalksDialog-UXLFZTZJ.js.map} +0 -0
- /package/dist/chunks/{GraphGenomeView-Z2WZKEEO.js.map → GraphGenomeView-NJ5XCREB.js.map} +0 -0
- /package/dist/chunks/{HighlightColorDialog-EYBKFSJU.js.map → HighlightColorDialog-UK5VDDV6.js.map} +0 -0
- /package/dist/chunks/{LinearGraphDisplay-WIBVWRQE.js.map → LinearGraphDisplay-TXTKAACH.js.map} +0 -0
- /package/dist/chunks/{TrackWarningsDialog-QT4YEXGD.js.map → TrackWarningsDialog-TRYBOIHX.js.map} +0 -0
- /package/dist/chunks/{chunk-AHFQHYJI.js.map → chunk-IBWORBGY.js.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["host:@jbrowse/render-core/useRenderingBackend", "../../src/GraphGenomeView/components/HoverLayer.tsx", "../../src/GraphGenomeView/components/legendStyles.ts", "../../src/GraphGenomeView/components/Legend.tsx", "../../node_modules/.pnpm/@jbrowse+bandage-core@10.2.6/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-TDQLINVI.js", "../../src/GraphGenomeView/components/usePaneGestures.ts", "../../src/GraphGenomeView/components/FacetPanels.tsx", "../../node_modules/.pnpm/@mui+icons-material@9.5.0_@mui+material@9.5.0_@emotion+react@11.14.0_@types+react@19.3._be9a1cae12a24c212d9554fb2bd39b80/node_modules/@mui/icons-material/CropFree.mjs", "../../node_modules/.pnpm/@mui+icons-material@9.5.0_@mui+material@9.5.0_@emotion+react@11.14.0_@types+react@19.3._be9a1cae12a24c212d9554fb2bd39b80/node_modules/@mui/icons-material/ZoomIn.mjs", "../../node_modules/.pnpm/@mui+icons-material@9.5.0_@mui+material@9.5.0_@emotion+react@11.14.0_@types+react@19.3._be9a1cae12a24c212d9554fb2bd39b80/node_modules/@mui/icons-material/ZoomOut.mjs", "../../src/GraphGenomeView/components/ColorSchemeSelect.tsx", "../../src/GraphGenomeView/components/GraphStats.tsx", "../../src/GraphGenomeView/components/LayoutSelect.tsx", "../../src/GraphGenomeView/components/RepeatSelect.tsx", "../../node_modules/.pnpm/@mui+icons-material@9.5.0_@mui+material@9.5.0_@emotion+react@11.14.0_@types+react@19.3._be9a1cae12a24c212d9554fb2bd39b80/node_modules/@mui/icons-material/Close.mjs", "../../node_modules/.pnpm/@mui+icons-material@9.5.0_@mui+material@9.5.0_@emotion+react@11.14.0_@types+react@19.3._be9a1cae12a24c212d9554fb2bd39b80/node_modules/@mui/icons-material/MoreVert.mjs", "../../src/GraphGenomeView/components/SettingsMenu.tsx", "../../src/GraphGenomeView/components/WalkSelect.tsx", "../../src/GraphGenomeView/components/GraphToolbar.tsx", "../../src/GraphGenomeView/components/HoverTooltip.tsx", "../../node_modules/.pnpm/@mui+icons-material@9.5.0_@mui+material@9.5.0_@emotion+react@11.14.0_@types+react@19.3._be9a1cae12a24c212d9554fb2bd39b80/node_modules/@mui/icons-material/FilterList.mjs", "../../node_modules/.pnpm/@mui+icons-material@9.5.0_@mui+material@9.5.0_@emotion+react@11.14.0_@types+react@19.3._be9a1cae12a24c212d9554fb2bd39b80/node_modules/@mui/icons-material/FilterListOff.mjs", "../../node_modules/.pnpm/@mui+icons-material@9.5.0_@mui+material@9.5.0_@emotion+react@11.14.0_@types+react@19.3._be9a1cae12a24c212d9554fb2bd39b80/node_modules/@mui/icons-material/Info.mjs", "../../src/GraphGenomeView/components/PaneContextMenu.tsx", "../../src/GraphGenomeView/components/WalkStrip.tsx", "../../src/GraphGenomeView/components/WalkStripLocator.tsx", "../../src/GraphGenomeView/renderer/GraphRenderer.ts", "../../src/GraphGenomeView/components/GraphCanvas.tsx"],
|
|
4
|
+
"sourcesContent": ["const host = JBrowseExports[\"@jbrowse/render-core/useRenderingBackend\"]\nconst read = name =>\n host != null && name in Object(host)\n ? host[name]\n : Object.assign(\n function () {\n throw new Error(\n \"This JBrowse does not provide '\" + name + \"' from '\" + \"@jbrowse/render-core/useRenderingBackend\" + \"' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse\",\n )\n },\n { jbrowseHostMissing: name },\n )\nexport const CONTEXT_LOST_REPORT_GRACE_MS = /* @__PURE__ */ read(\"CONTEXT_LOST_REPORT_GRACE_MS\")\nexport const OFFSCREEN_RELEASE_BAND = /* @__PURE__ */ read(\"OFFSCREEN_RELEASE_BAND\")\nexport const createGpuContextLostError = /* @__PURE__ */ read(\"createGpuContextLostError\")\nexport const createGpuDeviceLostError = /* @__PURE__ */ read(\"createGpuDeviceLostError\")\nexport const createGpuSurfaceLostError = /* @__PURE__ */ read(\"createGpuSurfaceLostError\")\nexport const isGpuContextLostError = /* @__PURE__ */ read(\"isGpuContextLostError\")\nexport const useRenderingBackend = /* @__PURE__ */ read(\"useRenderingBackend\")\nexport default host && host.__esModule ? host.default : host", "import { useEffect, useState } from 'react'\n\nimport { Canvas2DRenderer } from '@jbrowse/bandage-core/renderer/Canvas2DRenderer'\nimport { autorun } from 'mobx'\n\nimport { paneLayerStyle } from './PaneLayer'\n\nimport type { GraphPaneModel } from '../model'\n\nexport const hoverLayerStyle = paneLayerStyle(1)\n\n// The pane's hover, on a transparent canvas over its drawing and tube map\nexport default function HoverLayer({ model }: { model: GraphPaneModel }) {\n const [canvas, setCanvas] = useState<HTMLCanvasElement | null>(null)\n useEffect(() => {\n if (!canvas) {\n return undefined\n }\n const renderer = new Canvas2DRenderer(canvas)\n const dispose = autorun(() => {\n renderer.resize(model.paneWidth, model.canvasHeight)\n model.paintHover(renderer, model.drawnBatch)\n })\n return () => {\n dispose()\n renderer.dispose()\n }\n }, [canvas, model])\n return (\n <canvas\n ref={setCanvas}\n data-testid=\"graph-hover-layer\"\n style={hoverLayerStyle}\n />\n )\n}\n", "// A key's section of the legend panel, and one row in it: a swatch beside its\n// words\nexport const legendBoxStyle = {\n background: 'rgba(255,255,255,0.82)',\n padding: '3px 6px',\n fontSize: 11,\n lineHeight: '15px',\n whiteSpace: 'nowrap' as const,\n}\n\nexport const legendRowStyle = { display: 'flex', alignItems: 'center', gap: 5 }\n\n// A line with no swatch, such as what the drawing folded away\nexport const legendNoteStyle = { color: '#666' }\n", "import type { ReactNode } from 'react'\n\nimport { rulerInk } from '@jbrowse/bandage-core/tubeMap/axis'\nimport { observer } from 'mobx-react'\n\nimport { SWATCH_PX, legendSections, swatchWidth } from '../legendSections'\nimport { legendBoxStyle, legendNoteStyle, legendRowStyle } from './legendStyles'\n\nimport type { LegendRow, LegendSwatch, Stop } from '../legendSections'\nimport type { GraphPaneModel } from '../model'\n\nfunction stopsCss(stops: readonly Stop[]) {\n return stops.length === 1\n ? stops[0]!.color\n : `linear-gradient(to right, ${stops.map(s => `${s.color} ${s.offset * 100}%`).join(', ')})`\n}\n\nconst glyphStyle = {\n width: SWATCH_PX,\n flex: 'none',\n textAlign: 'center' as const,\n fontFamily: 'monospace',\n fontSize: 12,\n}\n\nexport function LegendSwatchView({ swatch }: { swatch: LegendSwatch }) {\n const width = swatchWidth(swatch)\n const box = { width, flex: 'none' }\n switch (swatch.kind) {\n case 'fill':\n return (\n <div\n style={{\n ...box,\n height: swatch.height ?? 8,\n borderRadius: swatch.square ? 0 : 2,\n background: stopsCss(swatch.stops),\n }}\n />\n )\n case 'bands':\n return (\n <div style={box}>\n {swatch.bands.map((stops, i) => (\n <div\n key={i}\n style={{\n height: swatch.bands.length > 1 ? 3 : 4,\n background: stopsCss(stops),\n }}\n />\n ))}\n </div>\n )\n case 'line':\n return (\n <div\n style={{\n ...box,\n height: 3,\n borderRadius: 2,\n background: swatch.color,\n }}\n />\n )\n case 'halo':\n return (\n <svg width={width} height={10} style={{ flex: 'none' }}>\n <line\n x1={5}\n y1={5}\n x2={13}\n y2={5}\n stroke={swatch.color}\n strokeOpacity={0.35}\n strokeWidth={8}\n strokeLinecap=\"round\"\n />\n </svg>\n )\n case 'outline':\n return (\n <div\n style={{\n ...box,\n height: swatch.height,\n boxSizing: 'border-box',\n border: `${swatch.stroke}px solid ${swatch.color}`,\n borderRadius: swatch.radius,\n }}\n />\n )\n case 'overhang':\n return (\n <svg width={width} height={10} style={{ flex: 'none' }}>\n <path d=\"M0,5 L8,0 L8,10 Z M18,5 L10,0 L10,10 Z\" fill=\"#18181c\" />\n </svg>\n )\n case 'glyph':\n return <span style={glyphStyle}>{swatch.char}</span>\n case 'tick':\n return (\n <div\n style={{\n ...box,\n height: swatch.height,\n display: 'flex',\n justifyContent: 'center',\n background: swatch.backing,\n }}\n >\n <div style={{ width: 2, backgroundColor: swatch.color }} />\n </div>\n )\n case 'bracket':\n return (\n <svg width={width} height={7} style={{ flex: 'none' }}>\n <path\n d={`M0.5,6 V1.5 H5.5 V6 M8.5,6 V1.5 H${SWATCH_PX - 0.5} V6`}\n fill=\"none\"\n stroke={rulerInk()}\n />\n </svg>\n )\n case 'blank':\n return <span style={box} />\n }\n}\n\n// One row: its swatch then its words, or a note with neither. `at`, where\n// the hovered node sits on a walk, stands in for the line under it.\nexport function LegendRowView({\n row,\n at,\n hint,\n after,\n}: {\n row: LegendRow\n at?: string\n hint?: string\n after?: ReactNode\n}) {\n return row.swatch ? (\n <div title={[row.title, hint].filter(Boolean).join(' \u00B7 ') || undefined}>\n <div style={legendRowStyle}>\n <LegendSwatchView swatch={row.swatch} />\n <span>\n {row.strong ? <strong>{row.strong}</strong> : null}\n {row.label}\n </span>\n {after}\n </div>\n {at ? (\n <div data-testid=\"graph-walk-at\">{at}</div>\n ) : row.under ? (\n <div>{row.under}</div>\n ) : null}\n </div>\n ) : (\n <div style={legendNoteStyle}>{row.label}</div>\n )\n}\n\nconst closeStyle = {\n pointerEvents: 'auto' as const,\n cursor: 'pointer',\n border: 'none',\n background: 'none',\n padding: '0 2px',\n font: 'inherit',\n textDecoration: 'underline',\n}\n\n// Every key the drawing needs, a section each\nexport const LegendPanel = observer(function LegendPanel({\n model,\n}: {\n model: GraphPaneModel\n}) {\n return (\n <>\n {legendSections(model).map(({ testid, rows }) => (\n <div key={testid} style={legendBoxStyle} data-testid={testid}>\n {rows.map(row => (\n <LegendRowView\n key={row.key}\n row={row}\n at={row.walk ? model.hoveredOn(row.walk) : undefined}\n after={\n row.closesBubble ? (\n <button\n type=\"button\"\n style={closeStyle}\n data-testid=\"graph-close-bubble\"\n onClick={() => {\n model.closeBubbles()\n }}\n >\n close\n </button>\n ) : null\n }\n />\n ))}\n </div>\n ))}\n </>\n )\n})\n", "// src/util/wheelZoom.ts\nvar ZOOM_PER_NOTCH = 1.1;\nvar NOTCH_PX = 100;\nvar LINE_PX = 40;\nvar PAGE_PX = 800;\nvar PINCH_GAIN = 10;\nvar MAX_NOTCHES_PER_EVENT = 2;\nfunction wheelZoomFactor(e) {\n const px = e.deltaY * (e.deltaMode === 1 ? LINE_PX : e.deltaMode === 2 ? PAGE_PX : 1);\n const notches = (e.ctrlKey ? PINCH_GAIN : 1) * px / NOTCH_PX;\n return ZOOM_PER_NOTCH ** -Math.max(-MAX_NOTCHES_PER_EVENT, Math.min(MAX_NOTCHES_PER_EVENT, notches));\n}\n\nexport {\n wheelZoomFactor\n};\n", "import { useEffect, useRef, useState } from 'react'\n\nimport {\n findHoveredEdge,\n findHoveredNode,\n} from '@jbrowse/bandage-core/util/hitDetection'\nimport { wheelZoomFactor } from '@jbrowse/bandage-core/util/wheelZoom'\nimport { screenToLayout } from '@jbrowse/bandage-core/viewport'\nimport { isAlive } from '@jbrowse/mobx-state-tree'\n\nimport { chipReadoutAt } from './LabelLayer'\n\nimport type { PaneContextAt } from './PaneContextMenu'\nimport type { GraphPaneModel } from '../model'\n\n// wheel events need passive:false to call preventDefault \u2014 React registers\n// wheel listeners as passive, so we must add this imperatively\nexport function useWheelZoom(\n canvas: HTMLCanvasElement | null | undefined,\n model: GraphPaneModel,\n) {\n useEffect(() => {\n if (!canvas) {\n return undefined\n }\n const handleWheel = (e: WheelEvent) => {\n if (model.hostPlacesX) {\n return\n }\n if (model.host) {\n e.stopPropagation()\n }\n e.preventDefault()\n const rect = canvas.getBoundingClientRect()\n model.zoom(\n wheelZoomFactor(e),\n e.clientX - rect.left,\n e.clientY - rect.top,\n )\n }\n canvas.addEventListener('wheel', handleWheel, { passive: false })\n return () => {\n canvas.removeEventListener('wheel', handleWheel)\n }\n }, [canvas, model])\n}\n\nconst CLICK_SLOP_PX = 3\n\n// The pointer on a canvas drawing the pane's transform: the pane's own, or any\n// facet panel, since the panels share it. Coordinates are read against the\n// canvas the event is on.\nexport function usePaneGestures(model: GraphPaneModel) {\n // Where the pointer was last, and whether it has travelled since mousedown \u2014\n // per-gesture scratch that nothing renders from, which is what a ref is for.\n // Whether a drag is in progress is model state (`isPanning`/`draggingNode`),\n // because the cursor renders from it.\n const lastMouseRef = useRef({ x: 0, y: 0 })\n const downRef = useRef({ x: 0, y: 0 })\n const hasMovedRef = useRef(false)\n // A pan and a hover are applied once per frame, not once per mousemove:\n // mousemove fires in bursts well above the frame rate, and each pan step\n // repainted the canvas and re-placed every overlay label, while each hover\n // step ran both hit indexes. The pending pan is the summed delta; the pending\n // hover is the last pointer position, since only the last one can be right.\n const pendingRef = useRef<{\n frame: number\n pan: { dx: number; dy: number } | null\n hover: { x: number; y: number } | null\n }>({ frame: 0, pan: null, hover: null })\n useEffect(\n () => () => {\n cancelAnimationFrame(pendingRef.current.frame)\n },\n [],\n )\n const [contextMenu, setContextMenu] = useState<PaneContextAt>()\n const [hoveredChip, setHoveredChip] =\n useState<ReturnType<typeof chipReadoutAt>>(undefined)\n\n // the event's point in pane px, against the canvas it is on\n function pointerAt(e: React.MouseEvent) {\n const rect = (e.currentTarget as HTMLCanvasElement).getBoundingClientRect()\n return { x: e.clientX - rect.left, y: e.clientY - rect.top }\n }\n\n // The node at a pane point, which mousedown, mousemove and click all need.\n // Takes the point rather than the event so a caller that already has one\n // does not pay for a second getBoundingClientRect.\n function nodeAt(sx: number, sy: number) {\n if (model.layoutResult?.tubeMap) {\n return model.tubeMapNodeAt(sx, sy)\n }\n const onStrip = model.referenceStripNodeAt(sx, sy)\n if (onStrip) {\n return onStrip\n }\n const { nodePositions } = model\n if (!nodePositions) {\n return null\n }\n const { x, y } = screenToLayout(sx, sy, model, model.axisScale)\n return findHoveredNode(\n nodePositions,\n x,\n y,\n model.axisScale,\n model.positionsVersion,\n model.nodeInk,\n )\n }\n\n function edgeAt(sx: number, sy: number) {\n const { nodePositions, graph } = model\n if (!nodePositions || !graph) {\n return null\n }\n const { x, y } = screenToLayout(sx, sy, model, model.axisScale)\n return findHoveredEdge(\n nodePositions,\n graph,\n x,\n y,\n model.axisScale,\n // resolved, so the hit index bounds the ribbons that are actually\n // drawn \u2014 see effectiveDrawPaths. Facet panels draw none.\n model.effectiveDrawPaths && !model.facetPanels,\n model.positionsVersion,\n model.deletionEdgeIndexes,\n model.hiddenEdgeIndexes,\n model.deletionRoutes,\n model.layoutResult?.stranded,\n )\n }\n\n // The linear view drags by mouse events, so a hosted pane that pans itself\n // keeps the mousedown from it; the gesture itself is the pointer's\n function onMouseDown(e: React.MouseEvent) {\n if (e.button === 0) {\n e.preventDefault()\n if (model.host && !model.hostPlacesX) {\n e.stopPropagation()\n }\n }\n }\n\n // Captured, so a drag keeps going over a bubble chip or the gap between\n // facet panels, and a finger drags as a mouse does\n function onPointerDown(e: React.PointerEvent) {\n if (e.button === 0) {\n hasMovedRef.current = false\n downRef.current = { x: e.clientX, y: e.clientY }\n if (model.hostPlacesX) {\n return\n }\n e.currentTarget.setPointerCapture(e.pointerId)\n const { x, y } = pointerAt(e)\n // a tube map's boxes are the layout's, and the strip's are bp, not\n // positions to drag\n const node =\n model.layoutResult?.tubeMap ||\n e.nativeEvent.offsetY < model.referenceStripZonePx\n ? null\n : nodeAt(x, y)\n if (node) {\n model.setDraggingNode(node)\n } else {\n model.setPanning(true)\n }\n lastMouseRef.current = { x: e.clientX, y: e.clientY }\n }\n }\n\n function applyPending() {\n const pending = pendingRef.current\n const { pan, hover } = pending\n pending.frame = 0\n pending.pan = null\n pending.hover = null\n if (pan) {\n model.setTransform(\n model.scale,\n model.translateX + pan.dx,\n model.translateY + pan.dy,\n )\n }\n if (!hover) {\n return\n }\n const { x: sx, y: sy } = hover\n const chip = model.facetPanels\n ? undefined\n : chipReadoutAt(model.overlayLabels, sx, sy)\n setHoveredChip(was =>\n was?.label === chip?.label && was?.readout === chip?.readout ? was : chip,\n )\n const bars = model.walkRowBars\n if (bars) {\n const i = model.walkRowAt(sx, sy)\n model.setHoveredWalkRow(\n i === undefined ? null : [bars.reference, ...bars.rows][i]!.name,\n )\n }\n if (model.nodePositions && model.graph) {\n const node = nodeAt(sx, sy)\n model.setHoveredPanel(model.tubeMapPanelAt(sy))\n model.setHoveredNode(node, { x: sx, y: sy })\n model.setHoveredTube(\n node === null && model.layoutResult?.tubeMap\n ? model.tubeAt(sx, sy)\n : null,\n )\n model.setHoveredEdge(\n node || model.layoutResult?.tubeMap || !model.hoverLightsEverything\n ? null\n : edgeAt(sx, sy),\n )\n }\n }\n\n function scheduleFrame() {\n if (!pendingRef.current.frame) {\n pendingRef.current.frame = requestAnimationFrame(applyPending)\n }\n }\n\n function dropPending() {\n const pending = pendingRef.current\n cancelAnimationFrame(pending.frame)\n pending.frame = 0\n pending.pan = null\n pending.hover = null\n }\n\n function onPointerMove(e: React.PointerEvent) {\n const dx = e.clientX - lastMouseRef.current.x\n const dy = e.clientY - lastMouseRef.current.y\n lastMouseRef.current = { x: e.clientX, y: e.clientY }\n\n // from where the button went down, not per event: a slow drag moves a\n // pixel at a time\n if (\n Math.hypot(e.clientX - downRef.current.x, e.clientY - downRef.current.y) >\n CLICK_SLOP_PX\n ) {\n hasMovedRef.current = true\n }\n\n const pending = pendingRef.current\n if (model.draggingNode) {\n model.moveNode(model.draggingNode, dx / model.scaleX, dy / model.scaleY)\n } else if (model.isPanning) {\n pending.pan = {\n dx: (pending.pan?.dx ?? 0) + dx,\n dy: (pending.pan?.dy ?? 0) + dy,\n }\n scheduleFrame()\n } else {\n const rect = (\n e.currentTarget as HTMLCanvasElement\n ).getBoundingClientRect()\n pending.hover = { x: e.clientX - rect.left, y: e.clientY - rect.top }\n scheduleFrame()\n }\n }\n\n // also the end of a capture the browser took back\n function onPointerUp() {\n if (isAlive(model)) {\n model.stopDragging()\n }\n }\n\n // also fired by the canvas unmounting under a resting pointer, after the\n // view closing it has destroyed the model\n function onPointerLeave() {\n dropPending()\n setHoveredChip(undefined)\n if (!isAlive(model)) {\n return\n }\n model.stopDragging()\n model.clearHover()\n }\n\n // Right-clicking a node is the gesture that asks \"where is this?\", and until\n // now the graph had no answer: a node named an assembly and an offset in its\n // tags that nothing surfaced. The items come from the model's launch targets,\n // so what is offered is what can actually be opened.\n function onContextMenu(e: React.MouseEvent) {\n const { x, y } = pointerAt(e)\n const node = nodeAt(x, y)\n const { clientX, clientY } = e\n if (node) {\n e.preventDefault()\n setContextMenu({ clientX, clientY, nodeId: node })\n return\n }\n const row = model.walkRowAt(x, y)\n if (row !== undefined) {\n e.preventDefault()\n setContextMenu({ clientX, clientY, row })\n }\n }\n\n function onClick(e: React.MouseEvent) {\n // a click that ended a drag selects nothing\n if (!hasMovedRef.current) {\n const { x, y } = pointerAt(e)\n const node = nodeAt(x, y)\n model.setSelectedNode(node)\n if (node) {\n model.showNodeDetails(node)\n }\n }\n }\n\n const canvasStyle: React.CSSProperties = {\n cursor: model.isPanning || model.draggingNode ? 'grabbing' : 'grab',\n // a pane the linear view drags leaves a finger its scroll\n touchAction: model.hostPlacesX ? 'auto' : 'none',\n overscrollBehavior: 'contain',\n }\n\n return {\n canvasStyle,\n handlers: {\n onMouseDown,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n onPointerCancel: onPointerUp,\n onLostPointerCapture: onPointerUp,\n onPointerLeave,\n onClick,\n onContextMenu,\n },\n contextMenu,\n hoveredChip,\n closeContextMenu: () => {\n setContextMenu(undefined)\n },\n }\n}\n\nexport type PaneHandlers = ReturnType<typeof usePaneGestures>['handlers']\n", "import { useEffect, useState } from 'react'\n\nimport { FACET_GAP_PX, FACET_TITLE_PX } from '@jbrowse/bandage-core/facetGrid'\nimport { Canvas2DRenderer } from '@jbrowse/bandage-core/renderer/Canvas2DRenderer'\nimport { autorun, computed } from 'mobx'\nimport { observer } from 'mobx-react'\n\nimport { hoverLayerStyle } from './HoverLayer'\nimport { LegendRowView } from './Legend'\nimport { useWheelZoom } from './usePaneGestures'\nimport { facetKeyRows, walkKeyRow } from '../legendSections'\nimport { FACET_KEY_ROW_PX } from '../pane/fitViews'\nimport { PAPER_CSS } from '../pane/paneBase'\n\nimport type { PaneHandlers } from './usePaneGestures'\nimport type { GraphPaneModel } from '../model'\nimport type { WalkLift } from '@jbrowse/bandage-core/walkHighlight'\n\n// The pane faceted by walk: the same layout drawn once per lifted walk, each\n// panel with that walk alone shading along itself, so walks compare by where\n// they go rather than by which lane is which colour. The panels share the\n// pane's transform, so a pan, zoom or hover in one is in all of them.\n\nconst gridStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n zIndex: 4,\n display: 'grid',\n gap: FACET_GAP_PX,\n lineHeight: 'normal',\n}\n\nconst titleStyle = {\n height: FACET_TITLE_PX,\n padding: '2px 6px',\n boxSizing: 'border-box' as const,\n fontFamily: 'inherit',\n fontSize: 11,\n color: 'inherit',\n cursor: 'pointer',\n border: 'none',\n background: 'none',\n textAlign: 'left' as const,\n display: 'block',\n}\n\nconst panelStyle = { position: 'relative' as const }\n\nconst keyStyle = {\n gridColumn: '1 / -1',\n height: FACET_KEY_ROW_PX,\n padding: '2px 6px',\n boxSizing: 'border-box' as const,\n display: 'flex',\n gap: 14,\n fontSize: 11,\n lineHeight: '15px',\n}\n\nconst FacetPanel = observer(function FacetPanel({\n model,\n lift,\n width,\n height,\n cell,\n handlers,\n canvasStyle,\n}: {\n model: GraphPaneModel\n lift: WalkLift\n width: number\n height: number\n cell: { gridRow: number; gridColumn: number }\n handlers: PaneHandlers\n canvasStyle: React.CSSProperties\n}) {\n const [canvas, setCanvas] = useState<HTMLCanvasElement | null>(null)\n const [hoverCanvas, setHoverCanvas] = useState<HTMLCanvasElement | null>(null)\n const walk = lift.walks[0]!\n useWheelZoom(canvas, model)\n\n useEffect(() => {\n if (!canvas || !hoverCanvas) {\n return undefined\n }\n const renderer = new Canvas2DRenderer(canvas)\n const hover = new Canvas2DRenderer(hoverCanvas)\n const drawing = computed(() => model.buildDrawing(lift, false))\n let uploaded: ReturnType<typeof model.buildDrawing>\n const disposers = [\n autorun(() => {\n const grid = model.facetGrid\n if (grid) {\n renderer.resize(grid.width, grid.height)\n }\n const built = drawing.get()\n if (!built) {\n return\n }\n if (built !== uploaded) {\n renderer.uploadGeometry(built.batch)\n uploaded = built\n }\n model.applySelection(renderer)\n model.paint(renderer)\n }),\n autorun(() => {\n const grid = model.facetGrid\n if (grid) {\n hover.resize(grid.width, grid.height)\n }\n const built = drawing.get()\n if (built) {\n model.paintHover(hover, built.batch)\n }\n }),\n ]\n return () => {\n for (const dispose of disposers) {\n dispose()\n }\n renderer.dispose()\n hover.dispose()\n }\n }, [canvas, hoverCanvas, model, lift])\n\n const label = model.walkLabel(walk.name)\n return (\n <div style={cell}>\n <button\n type=\"button\"\n style={titleStyle}\n data-testid=\"graph-facet-title\"\n onClick={() => {\n model.liftWalks([walk.name])\n model.setFacet('')\n }}\n >\n <LegendRowView\n row={walkKeyRow(model, walk)}\n hint={`click to lift ${label} alone`}\n at={model.hoveredOn(walk)}\n />\n </button>\n <div style={panelStyle}>\n <canvas\n ref={setCanvas}\n data-testid=\"graph-facet-canvas\"\n style={{ ...canvasStyle, width, height, display: 'block' }}\n {...handlers}\n />\n <canvas ref={setHoverCanvas} style={hoverLayerStyle} />\n </div>\n </div>\n )\n})\n\nconst FacetPanels = observer(function FacetPanels({\n model,\n handlers,\n canvasStyle,\n}: {\n model: GraphPaneModel\n handlers: PaneHandlers\n canvasStyle: React.CSSProperties\n}) {\n const panels = model.facetPanels\n const grid = model.facetGrid\n const place = model.facetPlacement\n if (!panels || !grid || !place) {\n return null\n }\n const { columns, width, height } = grid\n return (\n <div\n data-testid=\"graph-facet-panels\"\n style={{\n ...gridStyle,\n width: model.paneWidth,\n minHeight: model.canvasHeight,\n gridTemplateColumns: `repeat(${columns}, ${width}px)`,\n background: PAPER_CSS,\n }}\n >\n {panels.map((lift, i) => (\n <FacetPanel\n key={lift.walks[0]!.name}\n model={model}\n lift={lift}\n width={width}\n height={height}\n cell={{\n gridRow: Math.floor(place.cells[i]! / columns) + 1,\n gridColumn: (place.cells[i]! % columns) + 1,\n }}\n handlers={handlers}\n canvasStyle={canvasStyle}\n />\n ))}\n <div\n style={{\n ...keyStyle,\n gridRow: Math.floor(Math.max(...place.cells) / columns) + 2,\n }}\n data-testid=\"graph-facet-key\"\n >\n {facetKeyRows(model).map(row => (\n <LegendRowView key={row.key} row={row} />\n ))}\n </div>\n </div>\n )\n})\n\nexport default FacetPanels\n", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2m2 10H3v4c0 1.1.9 2 2 2h4v-2H5zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2\"\n}), 'CropFree');", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon([/*#__PURE__*/_jsx(\"path\", {\n d: \"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14\"\n}, \"0\"), /*#__PURE__*/_jsx(\"path\", {\n d: \"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z\"\n}, \"1\")], 'ZoomIn');", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14M7 9h5v1H7z\"\n}), 'ZoomOut');", "import { COLOR_SCHEMES } from '@jbrowse/bandage-core/colorSchemes'\nimport { observer } from 'mobx-react'\n\nimport LabelledSelect from './LabelledSelect'\n\nimport type { GraphPaneModel } from '../model'\n\nconst ColorSchemeSelect = observer(function ColorSchemeSelect({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const fixed = model.colorSchemeLock\n return (\n <LabelledSelect\n label=\"Color\"\n size=\"small\"\n sx={{ minWidth: 100 }}\n disabled={fixed !== undefined}\n title={fixed?.why}\n shown={fixed?.value}\n value={model.chosenColorScheme}\n options={COLOR_SCHEMES}\n onChange={scheme => {\n model.setColorScheme(scheme)\n }}\n />\n )\n})\n\nexport default ColorSchemeSelect\n", "import { Typography } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n stats: {\n marginLeft: 'auto',\n },\n perf: {\n color: '#888',\n fontVariantNumeric: 'tabular-nums',\n },\n})\n\nfunction fmtMs(ms: number | undefined) {\n return ms === undefined ? '\u2013' : `${Math.round(ms)}ms`\n}\n\n// The perf READOUT, off by default: it sat in the toolbar of every published\n// graph figure, where one machine's fetch time is a number a reader has to work\n// out is not about them. `showPerf` is in the settings menu.\n//\n// The numbers themselves are not conditional \u2014 they ride the stats element's\n// data-* attributes either way (see GraphStats), so a browser test asserting a\n// timing budget never depends on a display setting, and turning the text off\n// costs no coverage. They live there rather than on this element so that\n// switching the text off leaves no empty node behind to carry them.\nconst GraphPerf = observer(function GraphPerf({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const { lastFetchMs, lastLayoutMs, lastGeometryMs } = model\n const hasMetrics =\n lastFetchMs !== undefined ||\n lastLayoutMs !== undefined ||\n lastGeometryMs !== undefined\n return model.showPerf && hasMetrics ? (\n <Typography\n variant=\"caption\"\n className={classes.perf}\n data-testid=\"graph-perf-stats\"\n >\n fetch {fmtMs(lastFetchMs)} \u00B7 layout {fmtMs(lastLayoutMs)} \u00B7 geom{' '}\n {fmtMs(lastGeometryMs)}\n </Typography>\n ) : null\n})\n\nconst GraphStats = observer(function GraphStats({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n return (\n <div\n className={classes.stats}\n data-testid=\"graph-stats\"\n data-node-count={model.nodeCount}\n data-edge-count={model.edgeCount}\n data-path-count={model.pathCount}\n // unconditional, whatever `showPerf` is doing to the text beside them \u2014\n // see GraphPerf\n data-fetch-ms={model.lastFetchMs ?? ''}\n data-layout-ms={model.lastLayoutMs ?? ''}\n data-geometry-ms={model.lastGeometryMs ?? ''}\n data-geometry-strokes={model.lastGeometryStrokeCount ?? ''}\n >\n <Typography variant=\"body2\" component=\"span\">\n {model.nodeCount} nodes, {model.edgeCount} edges\n {model.pathCount > 0 ? `, ${model.pathCount} paths` : ''}\n </Typography>{' '}\n <GraphPerf model={model} />\n </div>\n )\n})\n\nexport default GraphStats\n", "import { LAYOUT_MODES } from '@jbrowse/bandage-core/layoutModes'\nimport { observer } from 'mobx-react'\n\nimport LabelledSelect from './LabelledSelect'\n\nimport type { GraphPaneModel } from '../model'\n\nconst LayoutSelect = observer(function LayoutSelect({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { graph } = model\n return (\n <LabelledSelect\n label=\"Layout\"\n size=\"small\"\n sx={{ minWidth: 140 }}\n testId=\"graph-layout-select\"\n value={model.chosenLayoutMode}\n options={LAYOUT_MODES.map(({ value, label, description, available }) => ({\n value,\n label,\n description,\n disabled: graph ? !available(graph) : false,\n }))}\n onChange={mode => {\n void model.switchLayout(mode)\n }}\n />\n )\n})\n\nexport default LayoutSelect\n", "import { observer } from 'mobx-react'\n\nimport LabelledSelect from './LabelledSelect'\n\nimport type { GraphPaneModel } from '../model'\n\n// Which tandem repeat array walk rows slice each walk by and tile, or the\n// whole window\nconst RepeatSelect = observer(function RepeatSelect({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { repeatChoices } = model\n if (model.chosenLayoutMode !== 'walkrows' || repeatChoices.length === 0) {\n return null\n }\n return (\n <LabelledSelect\n label=\"Repeat\"\n size=\"small\"\n sx={{ minWidth: 130, maxWidth: 260 }}\n testId=\"graph-repeat-select\"\n value={model.selectedRepeat?.key ?? ''}\n options={[\n { value: '', label: 'Whole window' },\n ...repeatChoices.map(({ key, name, unit }) => ({\n value: key,\n label: `${name} \u00B7 ${unit.toLocaleString()} bp unit`,\n })),\n ]}\n onChange={key => {\n model.setRepeatKey(key)\n }}\n />\n )\n})\n\nexport default RepeatSelect\n", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"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\"\n}), 'Close');", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2\"\n}), 'MoreVert');", "import { CascadingMenuButton } from '@jbrowse/core/ui'\nimport { getSession } from '@jbrowse/core/util'\nimport CloseIcon from '@mui/icons-material/Close'\nimport MoreVertIcon from '@mui/icons-material/MoreVert'\nimport RouteIcon from '@mui/icons-material/Route'\nimport SettingsIcon from '@mui/icons-material/Settings'\nimport VisibilityIcon from '@mui/icons-material/Visibility'\nimport { observer } from 'mobx-react'\n\nimport GraphSettingsDialog from './GraphSettingsDialog'\n\nimport type { GraphPaneModel } from '../model'\n\nconst SettingsMenu = observer(function SettingsMenu({\n model,\n}: {\n model: GraphPaneModel\n}) {\n // the toolbar beside this menu picks the walks and the repeat\n const haplotypes = model.highlightMenuItems({ picks: false })\n\n return (\n <CascadingMenuButton\n size=\"small\"\n tooltip=\"Graph options\"\n menuItems={[\n ...(haplotypes.length > 0\n ? [{ label: 'Haplotypes', icon: RouteIcon, subMenu: haplotypes }]\n : []),\n ...model.layoutOptionMenuItems({ repeat: false }),\n {\n label: 'Show...',\n icon: VisibilityIcon,\n subMenu: [\n ...model.showMenuItems(),\n ...(model.modeDrawsNodes && model.walkChoices.length > 1\n ? [\n {\n type: 'checkbox' as const,\n label: 'Show walk rows under the graph',\n checked: model.walkStrip,\n onClick: () => {\n model.setWalkStrip(!model.walkStrip)\n },\n },\n ]\n : []),\n {\n type: 'checkbox' as const,\n label: 'Show timings',\n checked: model.showPerf,\n onClick: () => {\n model.setShowPerf(!model.showPerf)\n },\n },\n ],\n },\n { type: 'divider' as const },\n {\n label: 'Graph settings...',\n icon: SettingsIcon,\n helpText:\n 'Subgraph node limit; node width and path colors; the force-directed layout engine',\n onClick: () => {\n getSession(model).queueDialog(onClose => [\n GraphSettingsDialog,\n { model, open: true, onClose },\n ])\n },\n },\n { type: 'divider' as const },\n {\n label: 'Close graph',\n icon: CloseIcon,\n onClick: () => {\n model.clearGraph()\n },\n },\n ]}\n >\n <MoreVertIcon />\n </CascadingMenuButton>\n )\n})\n\nexport default SettingsMenu\n", "import { useId } from 'react'\n\nimport { getSession } from '@jbrowse/core/util'\nimport {\n Button,\n Checkbox,\n FormControl,\n InputLabel,\n ListItemText,\n MenuItem,\n Select,\n} from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport { ChooseWalksDialog, WALK_MENU_ITEMS } from '../pane/paneBase'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n formControl: {\n minWidth: 130,\n maxWidth: 260,\n },\n})\n\n// Which walks to lift out of the drawing: Bandage's path highlight, for as many\n// of the haplotypes a GBZ cut carries as the reader picks. Absent from a graph\n// with no walks, and from a tube map, whose tubes are the walks.\nconst WalkSelect = observer(function WalkSelect({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const labelId = useId()\n const { walkChoices } = model\n if (walkChoices.length === 0 || !model.liftsWalks) {\n return null\n }\n const names = new Set(walkChoices.map(c => c.name))\n const labels = new Map(walkChoices.map(c => [c.name, c.label]))\n const picked = model.walkLayers\n .map(layer => layer.walk)\n .filter(name => names.has(name))\n if (walkChoices.length > WALK_MENU_ITEMS) {\n return (\n <Button\n size=\"small\"\n variant=\"outlined\"\n color=\"inherit\"\n data-testid=\"graph-walk-choose\"\n onClick={() => {\n getSession(model).queueDialog(onClose => [\n ChooseWalksDialog,\n { model, onClose },\n ])\n }}\n >\n {picked.length > 0\n ? `${picked.length} of ${walkChoices.length} haplotypes`\n : 'Highlight haplotypes...'}\n </Button>\n )\n }\n return (\n <FormControl size=\"small\" className={classes.formControl}>\n <InputLabel id={labelId}>Highlight</InputLabel>\n <Select\n labelId={labelId}\n multiple\n value={picked}\n label=\"Highlight\"\n data-testid=\"graph-walk-select\"\n renderValue={selected => selected.map(n => labels.get(n)).join(', ')}\n onChange={e => {\n const { value } = e.target\n model.liftWalks(typeof value === 'string' ? value.split(',') : value)\n }}\n >\n {walkChoices.map(({ name, label }) => (\n <MenuItem key={name} value={name} dense>\n <Checkbox size=\"small\" checked={picked.includes(name)} />\n <ListItemText primary={label} />\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n )\n})\n\nexport default WalkSelect\n", "import CropFreeIcon from '@mui/icons-material/CropFree'\nimport ZoomInIcon from '@mui/icons-material/ZoomIn'\nimport ZoomOutIcon from '@mui/icons-material/ZoomOut'\nimport { IconButton, Tooltip, Typography } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport ColorSchemeSelect from './ColorSchemeSelect'\nimport GraphStats from './GraphStats'\nimport LayoutSelect from './LayoutSelect'\nimport RepeatSelect from './RepeatSelect'\nimport SettingsMenu from './SettingsMenu'\nimport WalkSelect from './WalkSelect'\n\nimport type { GraphPaneModel } from '../model'\n\nconst useStyles = makeStyles()({\n toolbar: {\n display: 'flex',\n alignItems: 'center',\n gap: 4,\n padding: '2px 4px',\n borderBottom: '1px solid #ddd',\n },\n})\n\nconst ZoomDisplay = observer(function ZoomDisplay({\n model,\n}: {\n model: GraphPaneModel\n}) {\n return <Typography variant=\"body2\">{model.zoomPercent}</Typography>\n})\n\nconst GraphToolbar = observer(function GraphToolbar({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { classes } = useStyles()\n const zoomAboutCentre = (factor: number) => {\n model.zoom(factor, model.viewBox.width / 2, model.viewBox.height / 2)\n }\n return (\n <div className={classes.toolbar}>\n <LayoutSelect model={model} />\n <ColorSchemeSelect model={model} />\n <WalkSelect model={model} />\n <RepeatSelect model={model} />\n <Tooltip title=\"Zoom in\">\n <IconButton\n size=\"small\"\n onClick={() => {\n zoomAboutCentre(1.5)\n }}\n >\n <ZoomInIcon />\n </IconButton>\n </Tooltip>\n <Tooltip title=\"Zoom out\">\n <IconButton\n size=\"small\"\n onClick={() => {\n zoomAboutCentre(1 / 1.5)\n }}\n >\n <ZoomOutIcon />\n </IconButton>\n </Tooltip>\n <Tooltip title=\"Zoom to fit\">\n <IconButton\n size=\"small\"\n onClick={() => {\n model.refitView()\n }}\n >\n <CropFreeIcon />\n </IconButton>\n </Tooltip>\n <ZoomDisplay model={model} />\n <GraphStats model={model} />\n <SettingsMenu model={model} />\n </div>\n )\n})\n\nexport default GraphToolbar\n", "import type { ReactNode } from 'react'\n\nimport { edgeHoverText, regionLabel } from '@jbrowse/bandage-core/hoverText'\nimport { observer } from 'mobx-react'\n\nimport { nodeOwnLocation } from '../../launchFromGraph/contributors'\nimport { TOOLTIP_INSET_PX } from '../pane/fitViews'\n\nimport type { chipReadoutAt } from './LabelLayer'\nimport type { GraphPaneModel } from '../model'\n\n// Bottom right of the canvas, clear of the row labels on the left edge and of\n// a walk strip under the canvas. Where the legend reaches down to it, it moves\n// left of the legend.\nconst tooltipStyle = {\n position: 'absolute' as const,\n bottom: TOOLTIP_INSET_PX,\n lineHeight: 'normal',\n background: 'rgba(0,0,0,0.75)',\n color: 'white',\n padding: '4px 8px',\n borderRadius: 4,\n fontSize: 12,\n pointerEvents: 'none' as const,\n zIndex: 6,\n}\n\ntype Readout = NonNullable<ReturnType<typeof chipReadoutAt>>\n\nfunction labelled({ label, readout }: Readout) {\n return (\n <>\n <strong>{label}</strong> \u2014 {readout}\n </>\n )\n}\n\n// What the pointer is on, the most specific first: a gene chip, a node, an\n// edge, then a walk row or a tube\nfunction hoverTip(\n model: GraphPaneModel,\n chip: Readout | undefined,\n): { testId?: string; body: ReactNode } | undefined {\n if (chip) {\n return { testId: 'graph-chip-tooltip', body: labelled(chip) }\n }\n const node = model.hoveredNode\n ? model.hoverNodeById?.get(model.hoveredNode)\n : undefined\n if (node) {\n const merged = model.hoverDrawing?.members.get(node.id)\n const own = nodeOwnLocation(node)\n return {\n body: (\n <>\n <strong>{node.name}</strong>\n {merged ? ` and ${merged.length - 1} more` : ''} \u2014{' '}\n {node.length.toLocaleString()} bp, depth {node.depth.toFixed(1)}\n {/* the assembly that contributed the segment, and where on it */}\n {own ? (\n <>\n <br />\n {own.sample} {regionLabel(own)} (rank {node.stable?.rank})\n </>\n ) : null}\n </>\n ),\n }\n }\n const edge =\n model.hoveredEdge === null\n ? undefined\n : model.graph?.edges[model.hoveredEdge]\n if (edge) {\n const text = edgeHoverText(\n edge,\n model.deletions.find(d => d.edgeIndex === model.hoveredEdge),\n id => model.nodeById?.get(id)?.name ?? id,\n )\n // a deletion edge skips backbone that some haplotype lacks, so its\n // readout gives the bp skipped\n return {\n body: text.deletion ? (\n <>\n <strong>Deletion</strong> {text.deletion.bp}\n <br />\n {text.deletion.where}\n </>\n ) : (\n <>Edge: {text.ends}</>\n ),\n }\n }\n const walkRow = model.hoveredWalkRowText\n if (walkRow) {\n return { testId: 'graph-walk-row-tooltip', body: labelled(walkRow) }\n }\n const tube = model.hoveredTubeText\n return tube\n ? { testId: 'graph-tube-tooltip', body: labelled(tube) }\n : undefined\n}\n\nconst HoverTooltip = observer(function HoverTooltip({\n model,\n chip,\n}: {\n model: GraphPaneModel\n chip: Readout | undefined\n}) {\n const tip = hoverTip(model, chip)\n return tip ? (\n <div\n style={{ ...tooltipStyle, right: model.tooltipRightPx }}\n data-testid={tip.testId}\n >\n {tip.body}\n </div>\n ) : null\n})\n\nexport default HoverTooltip\n", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z\"\n}), 'FilterList');", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"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\"\n}), 'FilterListOff');", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z\"\n}), 'Info');", "import { regionLabel } from '@jbrowse/bandage-core/hoverText'\nimport { ContextMenu } from '@jbrowse/core/ui'\nimport FilterListIcon from '@mui/icons-material/FilterList'\nimport FilterListOffIcon from '@mui/icons-material/FilterListOff'\nimport InfoIcon from '@mui/icons-material/Info'\nimport LineStyleIcon from '@mui/icons-material/LineStyle'\n\nimport { nodeLaunchMenuItems } from '../../launchFromGraph/graphMenuItems'\n\nimport type { GraphPaneModel } from '../model'\nimport type { WalkRows } from '@jbrowse/bandage-core/layout/walkRows'\nimport type { ContextMenuAnchor, MenuItem } from '@jbrowse/core/ui'\n\n// What a right-click landed on: a node, or a row of `bars`, walk rows' own\n// unless a strip's\nexport type PaneContextAt = ContextMenuAnchor &\n ({ nodeId: string } | { row: number; bars?: WalkRows })\n\nconst AT_POINTER = { x: 0, y: 0 }\n\n// Flat rather than under a \"Launch view\" submenu, since its two or three items\n// are all about the node just clicked\nfunction nodeMenuItems(model: GraphPaneModel, nodeId: string): MenuItem[] {\n const { own, reference, highlight } = model.nodeLaunchTargets(nodeId)\n return [\n {\n label: 'Node details',\n icon: InfoIcon,\n onClick: () => {\n model.showNodeDetails(nodeId)\n },\n },\n ...nodeLaunchMenuItems({\n own,\n reference,\n highlight,\n onShowLinear: target => {\n model.showInLinearView(target)\n },\n onHighlight: model.canHighlightInLinearView\n ? target => {\n model.highlightInLinearView(target)\n }\n : undefined,\n }),\n ]\n}\n\n// A walk row's bar stands for a span of its haplotype's own contig, so the\n// question a right-click asks is answered by a linear view on that assembly,\n// with its genes\nfunction walkRowMenuItems(\n model: GraphPaneModel,\n row: number,\n bars: WalkRows | undefined,\n): MenuItem[] {\n const rows = bars ?? model.walkRowBars\n const target = model.walkRowLaunchTarget(row, rows)\n const assembly = target?.assembly\n const walk = row > 0 ? rows?.rows[row - 1] : undefined\n const sample = walk?.sample\n // the strip's rows are not walk rows', and take no sample filter\n const filters = !bars && model.walkRowBars\n const shown = model.walkRowSamples\n return [\n target && assembly\n ? {\n label: `Linear genome view \u2014 ${assembly} ${regionLabel(target.location)}`,\n icon: LineStyleIcon,\n onClick: () => {\n model.showInLinearView({ location: target.location, assembly })\n },\n }\n : {\n label: 'Linear genome view',\n icon: LineStyleIcon,\n disabled: true,\n disabledHelpText: target\n ? `No assembly in this session is ${target.location.haplotype ?? target.label}`\n : 'This walk states no contig coordinates',\n onClick: () => {},\n },\n ...(walk && model.liftsWalks && model.modeDrawsNodes\n ? [\n {\n type: 'checkbox' as const,\n label: `Highlight ${walk.label}`,\n checked: model.walkLayers.some(l => l.walk === walk.name),\n onClick: () => {\n model.toggleWalk(walk.name)\n },\n },\n ]\n : []),\n ...(filters && sample && !(shown?.length === 1 && shown[0] === sample)\n ? [\n {\n label: `Show only ${sample}`,\n icon: FilterListIcon,\n onClick: () => {\n model.setWalkRowSamples([sample])\n },\n },\n ]\n : []),\n ...(filters && shown\n ? [\n {\n label: 'Show every sample',\n icon: FilterListOffIcon,\n onClick: () => {\n model.setWalkRowSamples(undefined)\n },\n },\n ]\n : []),\n ]\n}\n\n// core's context menu, opened at the pointer itself rather than beside it\nexport default function PaneContextMenu({\n model,\n at,\n onClose,\n}: {\n model: GraphPaneModel\n at: PaneContextAt | undefined\n onClose: () => void\n}) {\n return (\n <ContextMenu\n anchor={at}\n offset={AT_POINTER}\n onClose={onClose}\n menuItems={() =>\n at === undefined\n ? []\n : 'nodeId' in at\n ? nodeMenuItems(model, at.nodeId)\n : walkRowMenuItems(model, at.row, at.bars)\n }\n />\n )\n}\n", "import { useMemo, useState } from 'react'\n\nimport {\n walkRowReadout,\n walkRowsKey,\n walkRowsTree,\n} from '@jbrowse/bandage-core/layout/walkRowDraw'\nimport {\n stripGeneGaps,\n stripRowAt,\n walkMarksTree,\n walkStripLabelsTree,\n} from '@jbrowse/bandage-core/layout/walkStrip'\nimport { RAMP_GRADIENT_CSS } from '@jbrowse/bandage-core/referenceRampCss'\nimport { isAlive } from '@jbrowse/mobx-state-tree'\nimport { observer } from 'mobx-react'\n\nimport ElTree, { useSvgId } from './ElTree'\nimport { LegendSwatchView } from './Legend'\nimport PaneContextMenu from './PaneContextMenu'\nimport { legendRowStyle } from './legendStyles'\nimport { walkRowSwatch } from '../legendSections'\n\nimport type { GraphPaneModel } from '../model'\nimport type { RowGene } from '@jbrowse/bandage-core/layout/walkRowDraw'\nimport type { WalkRows } from '@jbrowse/bandage-core/layout/walkRows'\nimport type { StripFrame } from '@jbrowse/bandage-core/layout/walkStrip'\n\n// Walk rows under a layout that draws nodes, each haplotype's walk on its own\n// bp, linked to the drawing above: the hovered node ticks every bar where its\n// walk passes it, and a point on a bar lights its node, ringed, above. The\n// bars share the drawing's colours, so under the reference-position ramp a hue\n// in the drawing is the same hue on each bar. Every row is shown; rows too\n// thin to letter say who they are on hover.\n\nconst keyStyle = {\n display: 'flex',\n flexWrap: 'wrap' as const,\n gap: '2px 14px',\n padding: '2px 8px 6px',\n fontSize: 11,\n color: '#333',\n}\n\nconst tipStyle = {\n position: 'absolute' as const,\n pointerEvents: 'none' as const,\n background: 'rgba(255,255,255,0.92)',\n border: '1px solid #ccc',\n borderRadius: 3,\n padding: '1px 6px',\n fontSize: 11,\n whiteSpace: 'nowrap' as const,\n zIndex: 4,\n}\n\n// The bars, built once per rows, frame, colouring and genes rather than per\n// hover\nconst StripBars = observer(function StripBars({\n bars,\n frame,\n ramp,\n rowGenes,\n}: {\n bars: WalkRows\n frame: StripFrame\n ramp: { start: number; end: number } | undefined\n rowGenes: Map<string, RowGene[]> | undefined\n}) {\n const idPrefix = useSvgId()\n const tree = useMemo(\n () => walkRowsTree(bars, frame, { ramp, rowGenes, idPrefix }),\n [bars, frame, ramp, rowGenes, idPrefix],\n )\n return <ElTree el={tree} />\n})\n\n// The hovered row's readout where the rows are too thin to letter, at the\n// pointer's place on its bar. Its own observer, so a move along a bar redraws\n// the tip and not the strip.\nexport const StripTip = observer(function StripTip({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const bars = model.walkStripRows\n const frame = model.walkStripFrame\n const hover = model.stripHover\n const all = bars ? [bars.reference, ...bars.rows] : []\n const index = hover ? all.findIndex(r => r.name === hover.row) : -1\n const row = all[index]\n if (!bars || !frame || frame.labelled || !hover || !row) {\n return null\n }\n return (\n <div\n data-testid=\"graph-walk-strip-tip\"\n style={{\n ...tipStyle,\n left:\n (bars.origin + hover.offset) * frame.scaleX + frame.translateX + 12,\n top: index * frame.rowPx + frame.translateY - 18,\n }}\n >\n {row.label} \u00B7{' '}\n {walkRowReadout(row, index === 0 ? undefined : bars.reference)}\n </div>\n )\n})\n\nconst WalkStrip = observer(function WalkStrip({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const bars = model.walkStripRows\n const frame = model.walkStripFrame\n const [menu, setMenu] = useState<{\n clientX: number\n clientY: number\n row: number\n }>()\n if (!bars || !frame) {\n return null\n }\n const hit = (e: React.MouseEvent<SVGSVGElement>) => {\n const box = e.currentTarget.getBoundingClientRect()\n return stripRowAt(bars, frame, e.clientX - box.left, e.clientY - box.top)\n }\n const key = walkRowsKey(bars, {\n ramp: model.referenceRampDomain,\n rampCss: RAMP_GRADIENT_CSS,\n genes: stripGeneGaps(frame, model.walkRowGenes, model.walkRowGeneGaps),\n })\n return (\n <div\n data-testid=\"graph-walk-strip\"\n style={{ position: 'relative', borderTop: '1px solid #ddd' }}\n onMouseEnter={() => {\n model.setPointerInPane(true)\n }}\n onMouseLeave={() => {\n if (isAlive(model)) {\n model.setPointerInPane(false)\n model.setStripHover(null)\n }\n }}\n >\n <svg\n width={frame.width}\n height={frame.height}\n style={{ display: 'block' }}\n onMouseMove={e => {\n const at = hit(e)\n e.currentTarget.style.cursor = at && at.index > 0 ? 'pointer' : ''\n model.setStripHover(\n at ? { row: at.row.name, offset: at.offset } : null,\n )\n }}\n onClick={e => {\n const at = hit(e)\n if (at && at.index > 0) {\n model.toggleWalk(at.row.name)\n }\n }}\n onContextMenu={e => {\n const at = hit(e)\n if (at) {\n e.preventDefault()\n setMenu({ clientX: e.clientX, clientY: e.clientY, row: at.index })\n }\n }}\n >\n <title>\n Ticks mark where each walk passes the node under the pointer. Click a\n bar to lift its walk.\n </title>\n <StripBars\n bars={bars}\n frame={frame}\n ramp={model.referenceRampDomain}\n rowGenes={model.walkRowGenes}\n />\n <ElTree el={walkMarksTree(bars, frame, model.walkStripMarks)} />\n <ElTree\n el={walkStripLabelsTree(\n bars,\n frame,\n new Set(model.walkLayers.map(l => l.walk)),\n )}\n />\n </svg>\n <StripTip model={model} />\n <div style={keyStyle} data-testid=\"graph-walk-strip-key\">\n {key.map(entry => (\n <div key={entry.label} style={legendRowStyle}>\n <LegendSwatchView swatch={walkRowSwatch(entry.swatch)} />\n <span>{entry.label}</span>\n </div>\n ))}\n </div>\n <PaneContextMenu\n model={model}\n at={menu && { ...menu, bars }}\n onClose={() => {\n setMenu(undefined)\n }}\n />\n </div>\n )\n})\n\nexport default WalkStrip\n", "import { observer } from 'mobx-react'\n\nimport { PaneSvgLayer } from './PaneLayer'\n\nimport type { GraphPaneModel } from '../model'\n\n// A ring round the node a point on the walk strip lights, so a one-bp node\n// can be found in a hairball\nconst WalkStripLocator = observer(function WalkStripLocator({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const at = model.walkStripLocator\n return at ? (\n <PaneSvgLayer\n model={model}\n zIndex={4}\n overflow=\"visible\"\n testId=\"graph-walk-strip-locator\"\n >\n <circle\n cx={at.x}\n cy={at.y}\n r={11}\n fill=\"none\"\n stroke=\"white\"\n strokeWidth={4}\n />\n <circle\n cx={at.x}\n cy={at.y}\n r={11}\n fill=\"none\"\n stroke=\"#111\"\n strokeWidth={1.75}\n />\n </PaneSvgLayer>\n ) : null\n})\n\nexport default WalkStripLocator\n", "import { Canvas2DRenderer } from '@jbrowse/bandage-core/renderer/Canvas2DRenderer'\n\n// Canvas2D only, and deliberately not through render-core's GPU ladder. The\n// batch is strokes and arrowheads in layout units, and stroking them batched by\n// colour is inside a frame budget at the node counts this view caps itself at\n// (agent-docs/reference/GRAPH_SCALE_AND_LOD.md), so a GPU backend would buy a few\n// milliseconds for ~30 KB of bundled HAL and a shader toolchain. If one is ever\n// wanted, it should take the same `Renderer` interface and draw the batch as\n// instances \u2014 a capsule per node segment, a bezier ribbon per edge stroke \u2014\n// rather than reviving a triangle mesh; agent-docs/ideas/waiting-on-a-number scopes it.\nexport function createGraphRenderer(canvas: HTMLCanvasElement) {\n return Promise.resolve(new Canvas2DRenderer(canvas))\n}\n", "import { useEffect, useRef } from 'react'\n\nimport { LEGEND_INSET_PX } from '@jbrowse/bandage-core/labelLayout'\nimport { ErrorBanner, LoadingOverlay } from '@jbrowse/core/ui'\nimport { isAlive } from '@jbrowse/mobx-state-tree'\nimport { useRenderingBackend } from '@jbrowse/render-core/useRenderingBackend'\nimport { observer } from 'mobx-react'\n\nimport BubbleHalos from './BubbleHalos'\nimport FacetPanels from './FacetPanels'\nimport GenePins from './GenePins'\nimport GraphToolbar from './GraphToolbar'\nimport HoverLayer from './HoverLayer'\nimport HoverTooltip from './HoverTooltip'\nimport LabelLayer from './LabelLayer'\nimport { LegendPanel } from './Legend'\nimport PaneContextMenu from './PaneContextMenu'\nimport { PaneSvgLayer } from './PaneLayer'\nimport ReferenceStripOverlay from './ReferenceStripOverlay'\nimport TubeMapOverlay from './TubeMapOverlay'\nimport WalkRowsOverlay from './WalkRowsOverlay'\nimport WalkStrip from './WalkStrip'\nimport WalkStripLocator from './WalkStripLocator'\nimport { usePaneGestures, useWheelZoom } from './usePaneGestures'\nimport { PAPER_CSS } from '../pane/paneBase'\nimport { createGraphRenderer } from '../renderer/GraphRenderer'\n\nimport type { GraphPaneModel } from '../model'\n\nconst wrapperStyle = { position: 'relative' as const }\n\n// The overlay origin has to be the canvas, not the wrapper: the wrapper also\n// holds the toolbar, so anything positioned against it is offset by the\n// toolbar's height, and a row label lands a whole row off the row it names.\nconst canvasAreaStyle = {\n position: 'relative' as const,\n lineHeight: 0,\n isolation: 'isolate' as const,\n}\n\n// Under a transparent canvas, from below the reference strip down, so the\n// linear view's gridlines show only behind the strip\nconst paperStyle = {\n position: 'absolute' as const,\n left: 0,\n right: 0,\n bottom: 0,\n zIndex: 0,\n}\n\n// Above the labels, pins and legends drawn over the canvas, and with the line\n// height the canvas area zeroes, which would collapse the overlay's label\nconst loadingLayerStyle = {\n position: 'absolute' as const,\n inset: 0,\n zIndex: 10,\n lineHeight: 'normal',\n pointerEvents: 'none' as const,\n}\n\nconst rowLabelStyle = {\n position: 'absolute' as const,\n left: 6,\n transform: 'translateY(-50%)',\n background: 'rgba(255,255,255,0.82)',\n padding: '0 4px',\n borderRadius: 3,\n fontSize: 11,\n // explicit, because the canvas container zeroes line-height to kill the\n // inline-block gap under the canvas. Inherited, that collapses the label to a\n // zero-height box: it still paints, but it has no layout, so anything asking\n // whether it is visible (a screenshot spec's waitForVisible, a11y tooling)\n // is told no.\n lineHeight: '16px',\n whiteSpace: 'nowrap' as const,\n pointerEvents: 'none' as const,\n zIndex: 4,\n}\n\n// Names the rows of a row-structured layout (anchored, sample rows). Without\n// them the layout draws real structure that cannot be read: a stack of bars\n// where every row means something and nothing says what.\n//\n// Positioned from the layout's own `rowLabels` through the same transform the\n// canvas draws with, so a label tracks its row across pan and zoom instead of\n// sitting at a measured pixel. It therefore has to be mounted in the canvas's\n// own positioning context (canvasAreaStyle) \u2014 against the wrapper it picks up\n// the toolbar's height and names the wrong row. Pinned to the left edge rather\n// than to the row's own x, because a row's leftmost node is wherever its first\n// allele happens to branch.\n//\n// Keyed on the row, not on the label: two rows can have the same words. The\n// sample-row layout names row 0 for the assembly the backbone comes from and\n// the rows below it for the samples contributing alleles, and a diploid\n// reference is in both lists \u2014 one haplotype is the reference path, the other\n// walks alleles of its own, and `parsePanSN` reduces both to one sample name.\nconst RowLabels = observer(function RowLabels({\n model,\n}: {\n model: GraphPaneModel\n}) {\n return (\n <>\n {model.visibleRowLabels.map(({ label, y, top }) => (\n <div\n key={y}\n data-testid=\"graph-row-label\"\n style={{ ...rowLabelStyle, top }}\n >\n {label}\n </div>\n ))}\n </>\n )\n})\n\n// Top RIGHT: the row labels own the left edge and the hover tooltip owns the\n// bottom right, so this is the one corner nothing else claims. Every key\n// stretches to the widest, so together they read as one panel. It takes the\n// pointer, for its rows' titles and its close button.\nconst legendStackStyle = {\n position: 'absolute' as const,\n top: LEGEND_INSET_PX,\n right: LEGEND_INSET_PX,\n display: 'flex',\n flexDirection: 'column' as const,\n borderRadius: 3,\n overflow: 'hidden' as const,\n zIndex: 4,\n}\n\nconst nodeLabelStyle = {\n position: 'absolute' as const,\n transform: 'translate(-50%, -50%)',\n background: 'rgba(255,255,255,0.78)',\n padding: '0 3px',\n borderRadius: 3,\n fontSize: 10,\n lineHeight: '13px',\n whiteSpace: 'nowrap' as const,\n pointerEvents: 'none' as const,\n zIndex: 3,\n}\n\n// Matches EDGE_DELETION_COLOR, so the words and the arc they name are one thing.\nconst deletionLabelStyle = {\n ...nodeLabelStyle,\n color: '#18181c',\n fontWeight: 600,\n}\n\n// Measures itself for the model, so no label is placed under a legend and\n// none gives way to one that is not drawn.\n//\n// At rest only: the walk keys' hover readout would otherwise refit the view,\n// and the refit clears the hover that grew it\nconst Legends = observer(function Legends({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const ref = useRef<HTMLDivElement>(null)\n useEffect(() => {\n const el = ref.current\n if (!el) {\n return\n }\n // the last callback can land after the track is closed\n const observer = new ResizeObserver(() => {\n if (isAlive(model) && model.hoveredNode === null) {\n model.setLegendSize({ width: el.offsetWidth, height: el.offsetHeight })\n }\n })\n observer.observe(el)\n return () => {\n observer.disconnect()\n }\n }, [model])\n return (\n <div\n ref={ref}\n style={{\n ...legendStackStyle,\n top: LEGEND_INSET_PX + model.referenceStripZonePx,\n }}\n >\n <LegendPanel model={model} />\n </div>\n )\n})\n\n// Writes each drawn thing's size onto it, which is what Bandage's Length label\n// does and what the tooltip alone could not: a graph you have to hover to read\n// is a graph nobody reads. graphLabels applies the same transform the canvas\n// draws with \u2014 so a label tracks its node across pan and zoom \u2014 and decides\n// which labels fit; this only paints them, mounted in the canvas's own\n// positioning context for the reason RowLabels is.\nconst GraphSizeLabels = observer(function GraphSizeLabels({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const labels = model.overlayLabels.sizes\n // A label too wide for the arc it names is placed clear of it and tethered\n // back; nothing else in the drawing carries one.\n const leaders = labels.flatMap(({ key, leader }) =>\n leader ? [{ key, ...leader }] : [],\n )\n return (\n <>\n {/* under the labels (z 3), so a leader runs beneath the text it points\n from; the placement culls a label past the canvas edge, so the\n layer leaves overflow visible */}\n {leaders.length > 0 ? (\n <PaneSvgLayer model={model} zIndex={2} overflow=\"visible\">\n {leaders.map(({ key, arcX, arcY, labelX, labelY }) => (\n <line\n key={key}\n data-testid=\"graph-label-leader\"\n x1={arcX}\n y1={arcY}\n x2={labelX}\n y2={labelY}\n stroke=\"#18181c\"\n strokeWidth={1}\n />\n ))}\n </PaneSvgLayer>\n ) : null}\n {labels.map(({ key, text, x, y, kind }) => (\n <div\n key={key}\n data-testid=\"graph-size-label\"\n style={{\n ...(kind === 'deletion' ? deletionLabelStyle : nodeLabelStyle),\n left: x,\n top: y,\n }}\n >\n {text}\n </div>\n ))}\n </>\n )\n})\n\n// `ownChrome` false for a pane inside a track, whose controls, loading state\n// and errors are the track's. A hosted pane whose x the host places takes no pan or wheel of its\n// own: those are the linear view's, as on any other track. One drawing its\n// own coordinates inside a track keeps them, and keeps them from the view.\nconst GraphCanvas = observer(function GraphCanvas({\n model,\n ownChrome = true,\n}: {\n model: GraphPaneModel\n ownChrome?: boolean\n}) {\n const {\n canvasRef,\n canvas,\n error: renderError,\n retry: retryRender,\n } = useRenderingBackend(createGraphRenderer, model)\n const { handlers, canvasStyle, contextMenu, closeContextMenu, hoveredChip } =\n usePaneGestures(model)\n useWheelZoom(canvas, model)\n const faceted = model.facetPanels !== undefined\n\n return (\n <div style={wrapperStyle}>\n {ownChrome ? <GraphToolbar model={model} /> : null}\n\n <div\n style={canvasAreaStyle}\n onMouseEnter={() => {\n model.setPointerInPane(true)\n }}\n onMouseLeave={() => {\n if (isAlive(model)) {\n model.setPointerInPane(false)\n }\n }}\n >\n {model.referenceStripShown ? (\n <div\n style={{\n ...paperStyle,\n top: model.referenceStripZonePx,\n background: PAPER_CSS,\n }}\n />\n ) : null}\n <canvas\n ref={canvasRef}\n data-testid=\"graph-genome-canvas\"\n style={{\n ...canvasStyle,\n width: model.paneWidth,\n height: model.canvasHeight,\n display: 'block',\n position: 'relative',\n zIndex: 1,\n }}\n {...handlers}\n />\n\n {faceted ? (\n <FacetPanels\n model={model}\n handlers={handlers}\n canvasStyle={canvasStyle}\n />\n ) : (\n <>\n <TubeMapOverlay model={model} />\n <HoverLayer model={model} />\n <ReferenceStripOverlay model={model} />\n <RowLabels model={model} />\n <GraphSizeLabels model={model} />\n <BubbleHalos model={model} />\n <GenePins model={model} />\n <LabelLayer model={model} />\n <WalkRowsOverlay model={model} />\n <WalkStripLocator model={model} />\n <Legends model={model} />\n </>\n )}\n\n {ownChrome ? (\n <div style={loadingLayerStyle}>\n <LoadingOverlay\n isVisible={model.isLoading}\n immediate={!model.layoutResult}\n statusMessage={model.statusMessage}\n onCancel={\n model.canCancelLoad\n ? () => {\n model.cancelLoad()\n }\n : undefined\n }\n />\n </div>\n ) : null}\n\n <HoverTooltip model={model} chip={hoveredChip} />\n </div>\n\n {model.walkStripShown ? <WalkStrip model={model} /> : null}\n\n <PaneContextMenu\n model={model}\n at={contextMenu}\n onClose={closeContextMenu}\n />\n\n {renderError ? (\n <ErrorBanner error={renderError} onReset={retryRender} />\n ) : null}\n\n {ownChrome && model.error ? (\n <ErrorBanner\n error={model.error}\n onReset={\n model.canRetryLoad\n ? () => {\n model.retryLoad()\n }\n : undefined\n }\n />\n ) : null}\n </div>\n )\n})\n\nexport default GraphCanvas\n"],
|
|
5
|
+
"mappings": "s7BAAA,I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3C,EAAM,eAAiBC,EAAC2D,GAAA,CAAU,MAAO5D,EAAO,EAAK,KAEtDC,EAAC4D,EAAA,CACC,MAAO7D,EACP,GAAIyC,EACJ,QAASC,EACX,EAECP,EACClC,EAAC6D,GAAA,CAAY,MAAO3B,EAAa,QAASC,EAAa,EACrD,KAEHJ,GAAahC,EAAM,MAClBC,EAAC6D,GAAA,CACC,MAAO9D,EAAM,MACb,QACEA,EAAM,aACF,IAAM,CACJA,EAAM,UAAU,CAClB,EACA,OAER,EACE,MACN,CAEJ,CAAC,EAEM+D,GAAQhC",
|
|
6
|
+
"names": ["host", "read", "name", "useRenderingBackend", "read", "useRenderingBackend_default", "host", "hoverLayerStyle", "paneLayerStyle", "HoverLayer", "model", "canvas", "setCanvas", "useState", "useEffect", "renderer", "Canvas2DRenderer", "dispose", "autorun", "jsx", "legendBoxStyle", "legendRowStyle", "legendNoteStyle", "stopsCss", "stops", "s", "glyphStyle", "SWATCH_PX", "LegendSwatchView", "swatch", "width", "swatchWidth", "box", "jsx", "i", "rulerInk", "LegendRowView", "row", "at", "hint", "after", "jsxs", "legendRowStyle", "legendNoteStyle", "closeStyle", "LegendPanel", "observer", "model", "Fragment", "legendSections", "testid", "rows", "legendBoxStyle", "ZOOM_PER_NOTCH", "NOTCH_PX", "LINE_PX", "PAGE_PX", "PINCH_GAIN", "MAX_NOTCHES_PER_EVENT", "wheelZoomFactor", "e", "px", "notches", "useWheelZoom", "canvas", "model", "useEffect", "handleWheel", "e", "rect", "wheelZoomFactor", "CLICK_SLOP_PX", "usePaneGestures", "lastMouseRef", "useRef", "downRef", "hasMovedRef", "pendingRef", "contextMenu", "setContextMenu", "useState", "hoveredChip", "setHoveredChip", "pointerAt", "nodeAt", "sx", "sy", "onStrip", "nodePositions", "x", "y", "screenToLayout", "findHoveredNode", "edgeAt", "graph", "findHoveredEdge", "onMouseDown", "onPointerDown", "node", "applyPending", "pending", "pan", "hover", "chip", "chipReadoutAt", "was", "bars", "i", "scheduleFrame", "dropPending", "onPointerMove", "dx", "dy", "onPointerUp", "isAlive", "onPointerLeave", "onContextMenu", "clientX", "clientY", "row", "onClick", "gridStyle", "FACET_GAP_PX", "titleStyle", "FACET_TITLE_PX", "panelStyle", "keyStyle", "FACET_KEY_ROW_PX", "FacetPanel", "observer", "model", "lift", "width", "height", "cell", "handlers", "canvasStyle", "canvas", "setCanvas", "useState", "hoverCanvas", "setHoverCanvas", "walk", "useWheelZoom", "useEffect", "renderer", "Canvas2DRenderer", "hover", "drawing", "computed", "uploaded", "disposers", "autorun", "grid", "built", "dispose", "label", "jsxs", "jsx", "LegendRowView", "walkKeyRow", "hoverLayerStyle", "FacetPanels", "panels", "place", "columns", "PAPER_CSS", "i", "facetKeyRows", "row", "FacetPanels_default", "CropFree_default", "createSvgIcon", "jsx", "ZoomIn_default", "createSvgIcon", "jsx", "ZoomOut_default", "createSvgIcon", "jsx", "ColorSchemeSelect", "observer", "model", "fixed", "jsx", "LabelledSelect", "COLOR_SCHEMES", "scheme", "ColorSchemeSelect_default", "useStyles", "makeStyles", "fmtMs", "ms", "GraphPerf", "observer", "model", "classes", "lastFetchMs", "lastLayoutMs", "lastGeometryMs", "hasMetrics", "jsxs", "Typography", "GraphStats", "jsx", "GraphStats_default", "LayoutSelect", "observer", "model", "graph", "jsx", "LabelledSelect", "LAYOUT_MODES", "value", "label", "description", "available", "mode", "LayoutSelect_default", "RepeatSelect", "observer", "model", "repeatChoices", "jsx", "LabelledSelect", "key", "name", "unit", "RepeatSelect_default", "Close_default", "createSvgIcon", "jsx", "MoreVert_default", "createSvgIcon", "jsx", "SettingsMenu", "observer", "model", "haplotypes", "jsx", "CascadingMenuButton", "Route_default", "Visibility_default", "Settings_default", "getSession", "onClose", "GraphSettingsDialog_default", "Close_default", "MoreVert_default", "SettingsMenu_default", "useStyles", "makeStyles", "WalkSelect", "observer", "model", "classes", "labelId", "useId", "walkChoices", "names", "c", "labels", "picked", "layer", "name", "WALK_MENU_ITEMS", "jsx", "Button", "getSession", "onClose", "ChooseWalksDialog", "jsxs", "FormControl", "InputLabel", "Select", "selected", "n", "e", "value", "label", "MenuItem", "Checkbox", "ListItemText", "WalkSelect_default", "useStyles", "makeStyles", "ZoomDisplay", "observer", "model", "jsx", "Typography", "GraphToolbar", "classes", "zoomAboutCentre", "factor", "jsxs", "LayoutSelect_default", "ColorSchemeSelect_default", "WalkSelect_default", "RepeatSelect_default", "Tooltip", "IconButton", "ZoomIn_default", "ZoomOut_default", "CropFree_default", "GraphStats_default", "SettingsMenu_default", "GraphToolbar_default", "tooltipStyle", "TOOLTIP_INSET_PX", "labelled", "label", "readout", "jsxs", "Fragment", "jsx", "hoverTip", "model", "chip", "node", "merged", "own", "nodeOwnLocation", "regionLabel", "edge", "text", "edgeHoverText", "d", "id", "walkRow", "tube", "HoverTooltip", "observer", "tip", "HoverTooltip_default", "FilterList_default", "createSvgIcon", "jsx", "FilterListOff_default", "createSvgIcon", "jsx", "Info_default", "createSvgIcon", "jsx", "AT_POINTER", "nodeMenuItems", "model", "nodeId", "own", "reference", "highlight", "Info_default", "nodeLaunchMenuItems", "target", "walkRowMenuItems", "row", "bars", "rows", "assembly", "walk", "sample", "filters", "shown", "regionLabel", "LineStyle_default", "l", "FilterList_default", "FilterListOff_default", "PaneContextMenu", "at", "onClose", "jsx", "ContextMenu", "keyStyle", "tipStyle", "StripBars", "observer", "bars", "frame", "ramp", "rowGenes", "idPrefix", "useSvgId", "tree", "useMemo", "walkRowsTree", "jsx", "ElTree", "StripTip", "model", "hover", "all", "index", "r", "row", "jsxs", "walkRowReadout", "WalkStrip", "menu", "setMenu", "useState", "hit", "e", "box", "stripRowAt", "key", "walkRowsKey", "RAMP_GRADIENT_CSS", "stripGeneGaps", "isAlive", "at", "walkMarksTree", "walkStripLabelsTree", "l", "entry", "legendRowStyle", "LegendSwatchView", "walkRowSwatch", "PaneContextMenu", "WalkStrip_default", "WalkStripLocator", "observer", "model", "at", "jsxs", "PaneSvgLayer", "jsx", "WalkStripLocator_default", "createGraphRenderer", "canvas", "Canvas2DRenderer", "wrapperStyle", "canvasAreaStyle", "paperStyle", "loadingLayerStyle", "rowLabelStyle", "RowLabels", "observer", "model", "jsx", "Fragment", "label", "y", "top", "legendStackStyle", "LEGEND_INSET_PX", "nodeLabelStyle", "deletionLabelStyle", "Legends", "ref", "useRef", "useEffect", "el", "isAlive", "LegendPanel", "GraphSizeLabels", "labels", "leaders", "key", "leader", "jsxs", "PaneSvgLayer", "arcX", "arcY", "labelX", "labelY", "text", "x", "kind", "GraphCanvas", "ownChrome", "canvasRef", "canvas", "renderError", "retryRender", "useRenderingBackend", "createGraphRenderer", "handlers", "canvasStyle", "contextMenu", "closeContextMenu", "hoveredChip", "usePaneGestures", "useWheelZoom", "faceted", "GraphToolbar_default", "PAPER_CSS", "FacetPanels_default", "TubeMapOverlay_default", "HoverLayer", "ReferenceStripOverlay_default", "BubbleHalos_default", "GenePins_default", "LabelLayer_default", "WalkRowsOverlay_default", "WalkStripLocator_default", "LoadingOverlay", "HoverTooltip_default", "WalkStrip_default", "PaneContextMenu", "ErrorBanner", "GraphCanvas_default"]
|
|
7
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
var i=/([><])([^><]+)/g;function h(s){if(!s.startsWith(">")&&!s.startsWith("<"))return;let t=[];for(let[,e,n]of s.matchAll(i))t.push({name:n,strand:e===">"?"+":"-"});return t}function p(s){let t=s.split(" ");if(t.length<12||s.startsWith("#"))return;let e=h(t[5]);if(!e)return;let n,a=!1;for(let o=12;o<t.length;o++){let r=t[o];r.startsWith("cs:Z:")?n=r.slice(5):r==="tp:A:S"&&(a=!0)}return{name:t[0],queryLength:+t[1],queryStart:+t[2],queryEnd:+t[3],strand:t[4]==="-"?"-":"+",path:e,pathLength:+t[6],pathStart:+t[7],pathEnd:+t[8],matches:+t[9],blockLength:+t[10],mappingQuality:+t[11],secondary:a,...n===void 0?{}:{cs:n}}}function l(s){let t=[];for(let e of s.split(`
|
|
2
2
|
`)){let n=p(e.trimEnd());n&&t.push(n)}return t}var f=/:(\d+)|=([A-Za-z]+)|\*[a-zA-Z]([a-zA-Z])|\+([A-Za-z]+)|-([A-Za-z]+)|~[a-z]{2}(\d+)[a-z]{2}/g;function c(s){let t=[];for(let e of s.matchAll(f))e[1]!==void 0?t.push({op:"match",length:+e[1]}):e[2]!==void 0?t.push({op:"match",length:e[2].length}):e[3]!==void 0?t.push({op:"substitution",seq:e[3].toUpperCase()}):e[4]!==void 0?t.push({op:"insertion",seq:e[4].toUpperCase()}):e[5]!==void 0?t.push({op:"deletion",length:e[5].length}):e[6]!==void 0&&t.push({op:"match",length:+e[6]});return t}export{p as a,l as b,c};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-N6PQZSAX.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@10.2.
|
|
3
|
+
"sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@10.2.6/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-C44YRP5F.js"],
|
|
4
4
|
"sourcesContent": ["// src/gaf/parseGaf.ts\nvar STEP = /([><])([^><]+)/g;\nfunction parseGafPath(column) {\n if (!column.startsWith(\">\") && !column.startsWith(\"<\")) {\n return void 0;\n }\n const steps = [];\n for (const [, arrow, name] of column.matchAll(STEP)) {\n steps.push({ name, strand: arrow === \">\" ? \"+\" : \"-\" });\n }\n return steps;\n}\nfunction parseGafLine(line) {\n const columns = line.split(\"\t\");\n if (columns.length < 12 || line.startsWith(\"#\")) {\n return void 0;\n }\n const path = parseGafPath(columns[5]);\n if (!path) {\n return void 0;\n }\n let cs;\n let secondary = false;\n for (let i = 12; i < columns.length; i++) {\n const tag = columns[i];\n if (tag.startsWith(\"cs:Z:\")) {\n cs = tag.slice(5);\n } else if (tag === \"tp:A:S\") {\n secondary = true;\n }\n }\n return {\n name: columns[0],\n queryLength: +columns[1],\n queryStart: +columns[2],\n queryEnd: +columns[3],\n strand: columns[4] === \"-\" ? \"-\" : \"+\",\n path,\n pathLength: +columns[6],\n pathStart: +columns[7],\n pathEnd: +columns[8],\n matches: +columns[9],\n blockLength: +columns[10],\n mappingQuality: +columns[11],\n secondary,\n ...cs === void 0 ? {} : { cs }\n };\n}\nfunction parseGaf(text) {\n const records = [];\n for (const line of text.split(\"\\n\")) {\n const record = parseGafLine(line.trimEnd());\n if (record) {\n records.push(record);\n }\n }\n return records;\n}\nvar CS_OP = /:(\\d+)|=([A-Za-z]+)|\\*[a-zA-Z]([a-zA-Z])|\\+([A-Za-z]+)|-([A-Za-z]+)|~[a-z]{2}(\\d+)[a-z]{2}/g;\nfunction parseCs(cs) {\n const ops = [];\n for (const m of cs.matchAll(CS_OP)) {\n if (m[1] !== void 0) {\n ops.push({ op: \"match\", length: +m[1] });\n } else if (m[2] !== void 0) {\n ops.push({ op: \"match\", length: m[2].length });\n } else if (m[3] !== void 0) {\n ops.push({ op: \"substitution\", seq: m[3].toUpperCase() });\n } else if (m[4] !== void 0) {\n ops.push({ op: \"insertion\", seq: m[4].toUpperCase() });\n } else if (m[5] !== void 0) {\n ops.push({ op: \"deletion\", length: m[5].length });\n } else if (m[6] !== void 0) {\n ops.push({ op: \"match\", length: +m[6] });\n }\n }\n return ops;\n}\n\nexport {\n parseGafPath,\n parseGafLine,\n parseGaf,\n parseCs\n};\n"],
|
|
5
5
|
"mappings": "AACA,IAAIA,EAAO,kBACX,SAASC,EAAaC,EAAQ,CAC5B,GAAI,CAACA,EAAO,WAAW,GAAG,GAAK,CAACA,EAAO,WAAW,GAAG,EACnD,OAEF,IAAMC,EAAQ,CAAC,EACf,OAAW,CAAC,CAAEC,EAAOC,CAAI,IAAKH,EAAO,SAASF,CAAI,EAChDG,EAAM,KAAK,CAAE,KAAAE,EAAM,OAAQD,IAAU,IAAM,IAAM,GAAI,CAAC,EAExD,OAAOD,CACT,CACA,SAASG,EAAaC,EAAM,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,CAAC,EAC9BA,EAAE,CAAC,IAAM,OAClBD,EAAI,KAAK,CAAE,GAAI,QAAS,OAAQC,EAAE,CAAC,EAAE,MAAO,CAAC,EACpCA,EAAE,CAAC,IAAM,OAClBD,EAAI,KAAK,CAAE,GAAI,eAAgB,IAAKC,EAAE,CAAC,EAAE,YAAY,CAAE,CAAC,EAC/CA,EAAE,CAAC,IAAM,OAClBD,EAAI,KAAK,CAAE,GAAI,YAAa,IAAKC,EAAE,CAAC,EAAE,YAAY,CAAE,CAAC,EAC5CA,EAAE,CAAC,IAAM,OAClBD,EAAI,KAAK,CAAE,GAAI,WAAY,OAAQC,EAAE,CAAC,EAAE,MAAO,CAAC,EACvCA,EAAE,CAAC,IAAM,QAClBD,EAAI,KAAK,CAAE,GAAI,QAAS,OAAQ,CAACC,EAAE,CAAC,CAAE,CAAC,EAG3C,OAAOD,CACT",
|
|
6
6
|
"names": ["STEP", "parseGafPath", "column", "steps", "arrow", "name", "parseGafLine", "line", "columns", "path", "cs", "secondary", "i", "tag", "parseGaf", "text", "records", "record", "CS_OP", "parseCs", "ops", "m"]
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as bo,c as wo,e as Tt,f as bn,g as Vo,i as jo,j as Yo}from"./chunk-VJ3SO4CH.js";import{$a as hr,A as Xo,B as vt,C as fn,Ca as kn,Ea as ir,Fa as cr,G as hn,Ga as dr,H as Mt,J as gn,K as je,L as Lt,M as ae,N as Nt,P as At,Q as Pt,Qa as pr,R as qo,Ra as lr,Sa as xn,Ta as ur,U as xe,Ua as mr,V as Jo,Wa as fr,X as Zo,Za as ue,ab as gr,b as go,bb as br,cb as wr,d as dn,da as Qo,db as yr,e as bt,eb as kr,f as yo,fb as xr,g as ko,gb as Sr,h as xo,i as So,ia as er,ib as Rr,jb as vr,kb as Mr,l as Bo,lb as Lr,m as mn,mb as Gt,n as He,ob as Nr,pa as tr,q as Ve,r as le,ra as nr,s as ke,sa as or,ta as rr,ua as sr,w as Do,y as Wo,z as Ho,za as ar}from"./chunk-WEGWTC52.js";import{a as pe,b as pn,d as Co,f as _o,i as St,l as Xe,m as $o,n as Fo,o as Rt,r as wn,s as Uo,t as zo,u as yn}from"./chunk-FITPB5X6.js";import{B as we,C as ye,D as Eo,F as Io,O as yt,P as Go,Q as Oo,R as We,S as kt,W as xt,a as oe,b as Ro,d as W,e as vo,h as Mo,i as Lo,j as Fe,k as Te,l as ln,n as No,o as Ao,p as De,t as wt,u as be,x as Po,y as To,z as un}from"./chunk-WAMBI7OX.js";import{b as Et,c as It,e as Ko}from"./chunk-W6EQLQ6H.js";import{b as nn,c as on,d as rn,f as sn,g as uo}from"./chunk-5O6YRJHL.js";import{b as Pe,c as I,d as _e,e as de,f as Qt,g as ge,h as en,i as tn,j as $e}from"./chunk-TUKJRVBS.js";import{c as ho,d as cn}from"./chunk-FVK2THE4.js";import{c as mo,e as q}from"./chunk-MVVXRZXV.js";import{a as Ne,c as lo,d as Ae}from"./chunk-ZMOMFU2B.js";import{a as an,b as fo}from"./chunk-5OI6LO4I.js";import{g as v}from"./chunk-NDRLCGPC.js";import{f as co,g as Zt,h as po,j as ne}from"./chunk-TENPGIPX.js";import{b as gt}from"./chunk-YU7T5WOQ.js";import{b as Z}from"./chunk-JMBDTNUR.js";var Se=JBrowseExports["@mui/material/SvgIcon"],wa=e=>Se!=null&&e in Object(Se)?Se[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@mui/material/SvgIcon' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),J=wa("createSvgIcon"),Mc=Se&&Se.__esModule?Se.default:Se;function Ar(e,t){let n=e.nodes.filter(g=>I(g)&&(t[g.id]?.length??0)>0);if(n.length<2)return t;let o=n.map(g=>{let m=t[g.id],y=m[Math.floor(m.length/2)];return{x:y.x,y:y.y,r:g.stable.start+g.length/2,w:g.length}}),s=o.reduce((g,m)=>g+m.w,0),r=o.reduce((g,m)=>g+m.x*m.w,0)/s,a=o.reduce((g,m)=>g+m.y*m.w,0)/s,i=o.reduce((g,m)=>g+m.r*m.w,0)/s,c=0,p=0;for(let g of o)c+=g.w*(g.x-r)*(g.r-i),p+=g.w*(g.y-a)*(g.r-i);let u=-Math.atan2(p,c),l=Math.cos(u),d=Math.sin(u),f={};for(let[g,m]of Object.entries(t))f[g]=m.map(y=>{let k=y.x-r,b=y.y-a;return{x:r+l*k-d*b,y:a+d*k+l*b}});let h=0,w=0;for(let g of e.nodes)if(!I(g))for(let m of f[g.id]??[])m.y>a?h++:w++;if(w>h)for(let g of Object.values(f))for(let m of g)m.y=2*a-m.y;return f}var Pr=30;function ya(e,t){let{opts:n}=t,o=new Map(t.nodes.map(d=>[d.id,Tt(n,d.length)])),s=d=>o.get(d)??n.minimumNodeLength,r=e.nodes.filter(I).sort((d,f)=>d.stable.start-f.stable.start),a=new Map,i=0;for(let d of r)a.set(d.id,{x:i,y:0}),i+=s(d.id)+n.edgeLength;let c=pe(e),p=new Map(r.map(d=>[d.id,0])),u=r.map(d=>d.id);for(let d of u){let f=a.get(d),h=p.get(d)+1;for(let w of c.get(d)??[])p.has(w)||(p.set(w,h),a.set(w,{x:f.x+s(d)/2,y:Pr*h}),u.push(w))}let l=0;for(let d of e.nodes)a.has(d.id)||a.set(d.id,{x:l++*i/e.nodes.length,y:Pr*3});return a}function Tr(e,t){let n=ya(e,t);return t.nodes.map(o=>({...o,...n.get(o.id)}))}var ka=Math.PI/24;function Er(e,t){let n=e[t-1],o=e[t],s=e[t+1];if(!n||!s)return 0;let r=Math.abs(Math.atan2(s.y-o.y,s.x-o.x)-Math.atan2(o.y-n.y,o.x-n.x));return r>Math.PI?2*Math.PI-r:r}function xa(e,t,n,o,s){let r=(h,w)=>Math.max(Math.hypot(w.x-h.x,w.y-h.y)**.5,1e-9),a=r(e,t),i=a+r(t,n),c=i+r(n,o),p=a+s*(i-a),u=(h,w,g,m)=>{let y=(p-g)/(m-g);return{x:h.x+(w.x-h.x)*y,y:h.y+(w.y-h.y)*y}},l=u(e,t,0,a),d=u(t,n,a,i),f=u(n,o,i,c);return u(u(l,d,0,i),u(d,f,a,c),a,i)}var Ir=(e,t)=>({x:2*t.x-e.x,y:2*t.y-e.y});function Gr(e){if(e.length<3)return e;let t=[e[0]];for(let n=0;n+1<e.length;n++){let o=e[n],s=e[n+1],r=Math.ceil(Math.max(Er(e,n),Er(e,n+1))/ka),a=e[n-1]??Ir(s,o),i=e[n+2]??Ir(o,s);for(let c=1;c<r;c++)t.push(xa(a,o,s,i,c/r));t.push(s)}return t}var Sa=.5;function Or(e,t,n=new Set){let o=new Map(t.map(r=>[r.edgeIndex,`${bo}${r.edgeIndex}`])),s=[];return e.edges.forEach((r,a)=>{let i=o.get(a);if(!n.has(a))if(i===void 0)s.push(r);else{let{fromStrand:c,toStrand:p}=r;s.push({from:r.from,to:i,...c?{fromStrand:c}:{}},{from:i,to:r.to,...p?{toStrand:p}:{}})}}),{graph:{...e,nodes:[...e.nodes,...[...o.values()].map(r=>({id:r,name:r,length:0,depth:0}))],edges:s},routes:o,ids:new Set(o.values())}}function Br(e,t,n,o,s){let r=new Map(e.nodes.map(a=>[a.id,a.length]));return t.map(a=>{let i=a.bypassed.reduce((u,l)=>u+(r.get(l)??0),0),c=Math.max(s.minimumNodeLength,o(i)*Sa),p=n.get(a.edgeIndex);return{id:p,name:p,length:Math.round(c*1e6/s.nodeLengthPerMegabase),depth:0}})}function Cr(e,t){let n={...e},o={};for(let[s,r]of t){let a=n[r];delete n[r],a?.length&&(o[s]=a)}return{nodePositions:n,deletionRoutes:o}}function Ra(e,t){let n=e.indexOf(":"),o=e.indexOf(":",n+1);if(n!==-1&&o!==-1){let s=e.slice(0,n),r=e.slice(n+1,o),a=e.slice(o+1);r==="i"||r==="f"?t[s]=+a:r==="Z"&&(t[s]=a)}}function Ye(e){let t={};for(let n of e)Ra(n,t);return t}function $r(e){let{SN:t,SO:n,SR:o}=e.tags;return typeof t=="string"&&typeof n=="number"&&typeof o=="number"?{refName:t,start:n,rank:o}:void 0}var _r=62,va=60;function Ma(e){let t=[],n="+",o=0;function s(r){r>o&&t.push({id:e.slice(o,r),strand:n})}for(let r=0;r<e.length;r++){let a=e.charCodeAt(r);(a===_r||a===va)&&(s(r),n=a===_r?"+":"-",o=r+1)}return s(e.length),t}function Fr(e){let t={nodes:[],links:[],paths:[],walks:[],header:[],id:""};for(let n of e.split(`
|
|
2
|
+
`)){let o=n.endsWith("\r")?n.slice(0,-1):n,s=o.split(" ",1)[0];if(s==="H"){let[,...r]=o.split(" ");t.header.push(Ye(r))}else if(s==="S"){let[,r,...a]=o.split(" "),i,c,p,u=!1,l=a[0]??"*";/^\d+$/.test(l)?(i=+l,c=a[1]??"*",p=a.slice(2)):(u=!0,c=l,i=c==="*"?0:c.length,p=a.slice(1));let d=Ye(p);u&&"LN"in d&&(i=+d.LN),t.nodes.push({id:r,length:i,sequence:c,tags:d})}else if(s==="E"){let[,,r,a,,,,,i,...c]=o.split(" ");r&&a&&t.links.push({source:r.slice(0,-1),target:a.slice(0,-1),strand1:r.at(-1),strand2:a.at(-1),cigar:i??"*",tags:Ye(c)})}else if(s==="L"){let[,r,a,i,c,p,...u]=o.split(" ");r&&i&&c&&t.links.push({source:r,target:i,strand1:a,strand2:c,cigar:p??"*",tags:Ye(u)})}else if(s==="W"){let[,r,a,i,c,p,u,...l]=o.split(" ");r&&a&&i&&c&&p&&u&&t.walks.push({sample:r,haplotype:+a,contig:i,start:c==="*"?-1:+c,end:p==="*"?-1:+p,segments:Ma(u),tags:Ye(l)})}else if(s==="P"){let[,r,a,...i]=o.split(" ");r&&a&&t.paths.push({name:r,path:a,rest:i})}}return t}function La(e){let t=new Map,n=new Map;function o(r,a){t.has(r)||t.set(r,a)}function s(r,a){let i=n.get(r);i===void 0&&o(r,a),n.set(r,(i??0)+1)}for(let r of e.links)o(r.source,r.strand1==="-"?"-":"+"),o(r.target,r.strand2==="-"?"-":"+");for(let r of e.paths)for(let a of r.path.split(","))s(a.slice(0,-1),a.endsWith("-")?"-":"+");for(let r of e.walks)for(let a of r.segments)s(a.id,a.strand==="-"?"-":"+");return{canonical:t,traversals:n}}var Dr=e=>e.start===-1?0:e.start,Na=e=>e.strand==="+"||e.strand==="-";function Aa(e){return[...e.paths.map(t=>({...W(t.name),steps:t.path.split(",").map(n=>({id:n.slice(0,-1),strand:n.endsWith("-")?"-":"+"}))})),...e.walks.map(t=>({name:`${t.sample}#${t.haplotype}#${t.contig}`,start:Dr(t),steps:t.segments.every(Na)?t.segments:t.segments.map(n=>({id:n.id,strand:n.strand==="-"?"-":"+"}))}))]}function Pa(e){let t=e.tags.SM;if(typeof t!="string")return;let n=t.split(",").map(o=>o.trim()).filter(Boolean);return n.length>0?n:void 0}var Ue=e=>typeof e=="number"&&e>0?e:void 0;function Ta({tags:e,length:t}){let n=Ue(e.RC)??Ue(e.FC)??Ue(e.KC);return Ue(e.dp)??Ue(e.DP)??(n!==void 0&&t>0?n/t:void 0)}function Ea(e,t,n){return{id:`${e.id}${t}`,name:e.id,length:e.length,depth:n,stable:$r(e),samples:Pa(e)}}function Wr(e,t="Imported GFA"){let n=[],o=[],{canonical:s,traversals:r}=La(e),a=new Map,i=m=>{let y=a.get(m);return y===void 0&&(y=`${m}${s.get(m)??"+"}`,a.set(m,y)),y},c=new Set;for(let m of e.nodes){if(c.has(m.id))continue;c.add(m.id);let y=Ta(m)??Math.max(r.get(m.id)??1,1);n.push(Ea(m,s.get(m.id)??"+",y))}for(let m of e.links)o.push({from:i(m.source),to:i(m.target),fromStrand:m.strand1==="-"?"-":"+",toStrand:m.strand2==="-"?"-":"+"});let p=[],u=new Map,l=(m,y)=>u.get(m)?.get(y);function d(m,y,k){let b=u.get(m);b||(b=new Map,u.set(m,b)),b.set(y,k)}let f=o.map(m=>{let y=l(m.from,m.to);return y||(y=new Set,d(m.from,m.to,y),d(m.to,m.from,y)),y});function h(m,y){for(let k=0;k<m.length-1;k++)l(m[k],m[k+1])?.add(y)}for(let m of e.paths){let y=m.path.split(",").map(k=>i(k.slice(0,-1)));p.push({name:m.name,nodeIds:y,start:W(m.name).start}),h(y,m.name)}for(let m of e.walks){let y=m.segments.map(b=>i(b.id)),k=`${m.sample}#${m.haplotype}#${m.contig}`;p.push({name:k,nodeIds:y,start:Dr(m),sample:m.sample,haplotype:m.haplotype,contig:m.contig}),h(y,k)}o.forEach((m,y)=>{let k=f[y];k.size>0&&(m.pathIds=[...k])});let w=new Map(e.nodes.map(m=>[m.id,m.length])),g=e.paths.length>0||e.walks.length>0?vo(Aa(e),m=>w.get(m)??0):void 0;return{name:t,nodes:n,edges:o,paths:p.length>0?p:void 0,anchorPaths:g?.anchorPaths,pathVisits:g?.pathVisits,anchoredBy:n.some(m=>m.stable)?"tags":void 0}}function Ia(e){let[t="",n="",...o]=e.split("#");return{sample:t,haplotype:n,contig:o.join("#")}}function Ga(e,t,n,o){let s=new Int32Array(n+1);for(let c of e)s[c+1]++;for(let c=0;c<n;c++)s[c+1]+=s[c];let r=s.slice(0,n),a=new Int32Array(e.length);e.forEach((c,p)=>{a[r[c]++]=t[p]});let i=new Int32Array(o.length).fill(-1);return Array.from({length:n},(c,p)=>{let u=[];for(let l=s[p];l<s[p+1];l++){let d=a[l];i[d]!==p&&(i[d]=p,u.push(o[d]))}return u})}function Sn({nodes:e,links:t,walks:n},o="Imported GFA"){let s=e.names.length,r=e.lengths.length,a=new Uint8Array(s),i=(R,N)=>{a[R]===0&&(a[R]=N?2:1)};for(let R=0;R<t.from.length;R++)i(t.from[R],t.strands[R]&1),i(t.to[R],t.strands[R]&2);let c=[];for(let R=0;R<n.names.length;R++)n.offsets[R+1]>n.offsets[R]&&c.push(R);let p=new Int32Array(s);for(let R of c)for(let N=n.offsets[R];N<n.offsets[R+1];N++){let A=n.steps[N];p[A]===0&&i(A,n.reversed[N]),p[A]++}let u=e.names.map((R,N)=>`${R}${a[N]===2?"-":"+"}`),l=[];for(let R=0;R<r;R++){let N=e.refs[R];l.push({id:u[R],name:e.names[R],length:e.lengths[R],depth:Math.max(p[R],1),stable:N<0?void 0:{refName:e.refNames[N],start:e.starts[R],rank:e.ranks[R]},samples:void 0})}let d=[],f=new Array(s),h=(R,N)=>{let A=f[R];if(A){for(let _=0;_<A.length;_+=2)if(A[_]===N)return A[_+1]}},w=(R,N,A)=>{let _=f[R];_?_.push(N,A):f[R]=[N,A]},g=[],m=0;for(let R=0;R<t.from.length;R++){let N=t.from[R],A=t.to[R];d.push({from:u[N],to:u[A],fromStrand:t.strands[R]&1?"-":"+",toStrand:t.strands[R]&2?"-":"+"});let _=h(N,A);_===void 0&&(_=m++,w(N,A,_),w(A,N,_)),g.push(_)}let y=new Int32Array(s+1);for(let R=0;R<s;R++)y[R+1]=y[R]+(f[R]?.length??0)/2;let k=new Int32Array(y[s]),b=new Int32Array(y[s]);f.forEach((R,N)=>{for(let A=0;A<R.length;A+=2)k[y[N]+A/2]=R[A],b[y[N]+A/2]=R[A+1]});let S=(R,N)=>{for(let A=y[R];A<y[R+1];A++)if(k[A]===N)return b[A];return-1},x=new Map,M=[],P=new Int32Array(n.offsets[n.names.length]??0),F=new Int32Array(P.length),B=0,C=new Int32Array(m).fill(-1),V=[],Y=[],T=n.offsets[n.names.length]??0,L=new Int32Array(T),O=new Float64Array(T),j=new Uint8Array(T),D=new Int32Array(s).fill(-1),z=[],E=[0],U=[];for(let R of c){let{sample:N,haplotype:A,contig:_}=Ia(n.names[R]),$=`${N}#${+A}#${_}`,K=x.get($);K===void 0&&(K=M.length,x.set($,K),M.push($),U.push(Ne($)));let ee=n.starts[R],Le=U[K],he=n.offsets[R],ft=new Array(n.offsets[R+1]-he),Kt=ee,qt=-1;for(let Ce=he;Ce<n.offsets[R+1];Ce++){let te=n.steps[Ce];ft[Ce-he]=u[te],D[te]===-1&&(D[te]=E.at(-1),E.push(D[te]+p[te]),z.push(te));let Jt=D[te]++;if(L[Jt]=K,O[Jt]=Kt,j[Jt]=n.reversed[Ce],Kt+=te<r?e.lengths[te]:0,qt>=0){let ht=S(qt,te);ht>=0&&C[ht]!==R&&(C[ht]=R,P[B]=ht,F[B++]=K)}qt=te}V.push({name:$,nodeIds:ft,start:ee,sample:N,haplotype:+A,contig:_}),Y.push({name:$,sample:Le,start:ee,length:Kt-ee})}let se=Ga(P.subarray(0,B),F,m,M);d.forEach((R,N)=>{let A=se[g[N]];A.length>0&&(R.pathIds=A)});let G=c.length>0;return{name:o,nodes:l,edges:d,paths:G?V:void 0,anchorPaths:G?Y:void 0,pathVisits:G?new Ro({segments:z.map(R=>e.names[R]),offsets:Int32Array.from(E),path:L.subarray(0,E.at(-1)),start:O.subarray(0,E.at(-1)),reversed:j.subarray(0,E.at(-1)),paths:M,samples:U}):void 0,anchoredBy:l.some(R=>R.stable)?"tags":void 0}}function Oa(e,t){if(typeof e!="string")return Sn(e,t);let n=uo(e);return n?Sn(n,t):Wr(Fr(e),t)}function Ba(e,t,n={}){let o=Mo(Oa(e,t),n.referencePath);if(o.nodes.length===0)throw new Error(`No graph segments in ${t}`);if(n.maxNodes!==void 0&&o.nodes.length>n.maxNodes)throw new Error(`Graph too large to draw: ${o.nodes.length.toLocaleString()} nodes (limit ${n.maxNodes.toLocaleString()}). Zoom in to a smaller region, or raise maxGraphNodes on this view.`);return o}var ie={engine:"fmmm",quality:2,linearLayout:!1,bubbleSpread:"auto",spacing:1,componentSeparation:1,showDeletionEdges:!0};function Ca(e={}){return{engine:e.engine??ie.engine,quality:e.quality??ie.quality,linearLayout:e.linearLayout??ie.linearLayout,bubbleSpread:e.bubbleSpread??ie.bubbleSpread,spacing:e.spacing??ie.spacing,componentSeparation:e.componentSeparation??ie.componentSeparation,showDeletionEdges:e.showDeletionEdges??ie.showDeletionEdges}}var _a=15;function Hr(e,t,n){let o=e.nodes.some(I),s={...t,opts:{...t.opts,edgeLength:t.opts.edgeLength*(n.spacing??1)}};return{graph:{nodes:o?Tr(e,s):s.nodes,edges:e.edges},options:{quality:n.quality,linearLayout:n.linearLayout,...s.opts,componentSeparation:_a*(n.componentSeparation??1),...o?{rotateComponents:!1}:{},engine:n.engine??"fmmm"}}}function Ot(e,t){let n=e.nodes.some(I);return`${t.engine??"fmmm"}|${t.quality}|${t.linearLayout}|${t.bubbleSpread}|${t.spacing??1}|${t.componentSeparation??1}|${t.showDeletionEdges!==!1}|${n}|${e.referencePath??""}`}async function Rn(e,t,n){let o=Yo(t.bubbleSpread),{shown:s,hidden:r}=ye(e,we(e),t.showDeletionEdges!==!1),a=Or(e,s,r),i=Po(a.graph,a.ids),c={...i.graph,nodes:i.graph.nodes.filter(y=>!a.ids.has(y.id))},p=bn(c,o),{result:u,duration:l}=await n(Hr(i.graph,{...p,nodes:[...p.nodes,...Br(e,s,a.routes,Vo(c,o),p.opts)]},t)),d=bn(e,o),f=new Map(d.nodes.map(y=>[y.id,Tt(d.opts,y.length)])),h=Object.fromEntries(Object.entries(u.nodePositions).map(([y,k])=>[y,Gr(k)])),w=To(h,i.runs,y=>f.get(y)??0),{nodePositions:g,deletionRoutes:m}=Cr(e.nodes.some(I)?Ar(e,w):w,a.routes);return{result:{...u,nodePositions:g,stranded:!0,...s.length?{deletionRoutes:m,extent:vn(m)}:{}},duration:l}}function vn(e){let t=1/0,n=1/0,o=-1/0,s=-1/0;for(let r of Object.values(e))for(let a of r)t=Math.min(t,a.x),n=Math.min(n,a.y),o=Math.max(o,a.x),s=Math.max(s,a.y);return{minX:t,minY:n,maxX:o,maxY:s}}var H=40,$a=1e-6,Fa=100;function Bt(e){return Math.max($a,Math.min(Fa,e))}function Xr(e,t,n,o=H){let s=t-e.h*n;return o-e.minY*n+Math.max(0,s)/2}function ze(e,t,n,o,{minScale:s=0,padLeft:r=H,padTop:a=H,padRight:i=H,padBottom:c=H}={}){let p=t-r-i,u=n-a-c;if(p<=0||u<=0||!(e.w>0||!o&&e.h>0))return;let l=e.w>0?p/e.w:1/0,d=e.h>0?u/e.h:1/0,f=Bt(Math.max(s,o?l:Math.min(l,d))),h=p-e.w*f;return{scale:f,translateX:r-e.minX*f+Math.max(0,h)/2,translateY:Xr(e,u,o?1:f,a)}}function Ke(e,t={}){let{minX:n,minY:o,maxX:s,maxY:r}=vn(e.nodePositions),{region:a}=t;e.referenceAxis&&a&&a.end>a.start&&(n=a.start,s=a.end);let i=t.extent??e.extent;return i&&(n=Math.min(n,i.minX??n),o=Math.min(o,i.minY??o),s=Math.max(s,i.maxX??s),r=Math.max(r,i.maxY??r)),{minX:n,minY:o,w:s-n,h:r-o}}var Da=4;function Mn(e=Da){let t=new WeakMap,n=o=>{let s=t.get(o);return s||(s=new Map,t.set(o,s)),s};return{layout(o,s,r){let a=n(o),i=Ot(o,s),c=a.get(i);if(c)return c.run;a.size>=e&&a.delete(a.keys().next().value);let p=performance.now(),u={run:Rn(o,s,r).then(l=>(u.done=l.result,{...l,duration:l.duration||performance.now()-p}))};return u.run.catch(()=>{a.get(i)===u&&a.delete(i)}),a.set(i,u),u.run},ready(o,s){return t.get(o)?.get(Ot(o,s))?.done},inherit(o,s){let r=t.get(o);r&&o!==s&&t.set(s,r)}}}function qe(e,t){return{scaleX:e,scaleY:t?1:e,pixelRows:t}}function Ln(e,t,n,o){return{minX:-e.translateX/t.scaleX,minY:-e.translateY/t.scaleY,maxX:(n-e.translateX)/t.scaleX,maxY:(o-e.translateY)/t.scaleY}}function Nn(e,t){let n=(e.maxX-e.minX)*t,o=(e.maxY-e.minY)*t;return{minX:e.minX-n,minY:e.minY-o,maxX:e.maxX+n,maxY:e.maxY+o}}function Wa(e,t){return t.minX>=e.minX&&t.maxX<=e.maxX&&t.minY>=e.minY&&t.maxY<=e.maxY}function Ha(e,t,n,o,s){let r=Bt(e.scale*t),a=r/e.scale;return{scale:r,translateX:n-(n-e.translateX)*a,translateY:s?e.translateY:o-(o-e.translateY)*a}}function Xa(e,t,n,o){return{x:(e-n.translateX)/o.scaleX,y:(t-n.translateY)/o.scaleY}}var Re=JBrowseExports["@jbrowse/render-core/RenderLifecycleMixin"],Va=e=>Re!=null&&e in Object(Re)?Re[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/render-core/RenderLifecycleMixin' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),Vr=Va("RenderLifecycleMixin"),ep=Re&&Re.__esModule?Re.default:Re;function jr(e){return t=>e.includes(t)?t:void 0}function op(e){return v.snapshotProcessor(v.maybe(v.enumeration(e)),{preProcessor:jr(e)})}function Ct(e,t){return v.snapshotProcessor(v.optional(v.enumeration(e),t),{preProcessor:jr(e)})}var Yr=600,_t=160,Ur=[1,1,1,1],fp="rgb(255, 255, 255)",zr=5,Kr=new Set(["tubemap","tubemapref"]),hp=gt(()=>import("./ChooseSamplesDialog-JRN4YLBY.js")),gp=gt(()=>import("./ChooseWalksDialog-UXLFZTZJ.js")),bp=gt(()=>import("./HighlightColorDialog-UK5VDDV6.js")),wp=12,yp=[{bp:0,label:"None"},{bp:3,label:"Under 3 bp"},{bp:10,label:"Under 10 bp"},{bp:50,label:"Under 50 bp, leaving structural variants"},{bp:1e3,label:"Under 1 kb"}];function kp(e){if(typeof e.uri=="string")return e.uri;let n=e.segmentsLocation?.uri;return typeof n=="string"&&n.endsWith(an)?n.slice(0,-an.length):void 0}var xp=1.15,qr=1.6,Sp=150,Jr=1,An=40,Rp=[{value:"each",label:"A tube per haplotype"},{value:"grouped",label:"A tube per haplotype, grouped by route"},{value:"bundled",label:"A tube per route"}],ja={nodeStrokes:[],nodeStrokeRuns:new Map,arrows:[],arrowRuns:new Map,edgeCurves:[],edgeCurveRuns:new Map};function Je(...e){}var Ya=5e6;function vp(e){return e>=1e6?`${+(e/1e6).toFixed(1)} Mb`:`${Math.round(e/1e3)} kb`}var Ua=2e4;function Mp(e){return("uri"in e?e.uri.split(/[?#]/)[0]:"localPath"in e?e.localPath:"name"in e?e.name:"").split(/[\\/]/).at(-1)??""}function Ee(e){return e&&"uri"in e&&e.uri?new URL(e.uri,e.baseUri??window.location.href).href:void 0}function Zr(e){return e.builtViewport!==void 0&&e.paintedViewport===e.builtViewport&&e.builtViewport.viewportDirty===e.viewportDirty&&!e.viewportRebuildPending}function Qr(e){let{width:t,height:n}=e.viewBox;return Ln(e,e.axisScale,t,n)}var Lp=Mn(),es=v.compose("GraphPane",Vr(),v.model({layoutQuality:v.optional(v.number,2),layoutEngine:Ct(wo,"fmmm"),linearLayout:v.optional(v.boolean,!1),bubbleSpread:Ct(jo,"auto"),tubeMapFold:v.optional(v.number,0),tubeMapRoutes:Ct(["each","grouped","bundled"],"each"),tubeMapColorBy:v.optional(v.string,""),geneTrackId:v.optional(v.string,""),repeatTrackId:v.optional(v.string,""),repeatKey:v.optional(v.string,""),walkLayers:v.optional(v.frozen(),[]),referencePath:v.optional(v.string,""),showPerf:v.optional(v.boolean,!1),connectorThickness:v.optional(v.number,2),scale:v.optional(v.number,1),translateX:v.optional(v.number,0),translateY:v.optional(v.number,0),paneHeight:v.maybe(v.number),maxGraphNodes:v.optional(v.number,Ua),connectedViewId:v.maybe(v.string),maxRegionBp:v.optional(v.number,Ya),subgraphContext:v.optional(v.number,1),subgraphHaplotypes:v.maybe(v.frozen())})).volatile(()=>({graph:void 0,walkCut:void 0,graphRegion:void 0,loadedReferencePath:void 0,layoutResult:void 0,drawnLayoutMode:void 0,legendSize:{width:0,height:0},indexBubbles:void 0,foldedBelowBp:void 0,geneTrackFeatures:void 0,walkGeneFeatures:void 0,walkRowSampleTable:void 0,repeatArrays:void 0,handledLayoutMode:void 0,openBubbles:[],error:void 0,isLoading:!1,loadCanceled:!1,statusMessage:"",hoveredNode:null,hoveredAt:null,hoveredTube:null,hoveredPanel:null,hoveredRowWalks:[],hoveredBubble:null,pointerInPane:!1,stripHover:null,hoveredWalkRow:null,hoveredEdge:null,selectedNode:null,viewportDirty:0,positionsVersion:0,morphEntering:void 0,drawnBatch:ja,builtViewport:void 0,paintedViewport:void 0,draggingNode:null,isPanning:!1,viewportOwner:"fit",viewportDirtyTimer:void 0,positionsDirtyFrame:0,lastFetchMs:void 0,readsShown:void 0,lastLayoutMs:void 0,lastGeometryMs:void 0,lastGeometryStrokeCount:void 0,viewportRebuildPending:!1}));var za=/^[^#]+#\d+$/;function Ka(e,t){let n=e.assemblyNameToPanSN??{},o=new Set(Object.values(n)),s={};for(let{name:r,aliases:a}of t){let i=a.find(c=>za.test(c));i!==void 0&&!o.has(i)&&(s[r]=i)}return Object.keys(s).length===0?e:{...e,assemblyNameToPanSN:{...s,...n}}}var qa=new Set(["GbzBaseSyntenyAdapter","WalkTabixSyntenyAdapter"]);function ts(e,t){let n=q(t,"adapter");return qa.has(n.type)?Ka(n,ne(e).assemblyManager.assemblyList.map(o=>({name:q(o,"name"),aliases:q(o,"aliases")??[]}))):n}var Ja=1,Za=.015;function $t({graph:e,span:t,rowY:n,positions:o}){let s=t*Za,r=yo(e),a=new Map(e.nodes.map(u=>[u.id,u])),i=[];for(let u of r){let l=u.refSpan-u.pathLength;l>=Ja&&i.push({nodeIds:u.nodeIds,bp:l});let d=Math.max(u.refSpan,s),f=u.pathLength>0?d/u.pathLength:0;u.nodeIds.forEach((h,w)=>{let g=a.get(h);if(g){let m=u.nodeOffsets[w],y=d/u.nodeIds.length,k=S=>u.start+S*f,b=n(g);o[h]=f?[{x:k(m),y:b},{x:k(m+g.length),y:b}]:[{x:u.start+w*y,y:b},{x:u.start+(w+1)*y,y:b}]}})}let c=pe(e),p=Object.keys(o);for(let u of p){let l=o[u].at(-1).x;for(let d of c.get(u)??[]){let f=a.get(d);if(f&&!(d in o)){let h=n(f);o[d]=[{x:l,y:h},{x:l+s,y:h}],p.push(d)}}}return i}function Qa(e,t){let n=new Map;for(let s of e.nodes)if(_e(s)){let{sample:r}=bt(s.stable.refName);n.set(r,(n.get(r)??0)+s.length)}let o=new Map(t.map((s,r)=>[s,r]));return[...n.keys()].sort((s,r)=>(o.get(s)??1/0)-(o.get(r)??1/0)||n.get(r)-n.get(s)||s.localeCompare(r))}function ns(e,t,n=[]){let o=de(e),s=Qa(e,n);if(o.length===0||s.length===0)return;let r=$e(o,t),a=new Map(s.map((d,f)=>[d,f+1])),i=ge(o),c=s.length+1,p=$t({graph:e,span:r,rowY:d=>{let f=d.stable;return((f?a.get(bt(f.refName).sample):void 0)??c)*oe},positions:i}),l=[{label:bt(o[0].stable.refName).sample,y:0},...s.map(d=>({label:d,y:a.get(d)*oe}))];return{nodePositions:i,rowLabels:l,sampleRows:s,referenceAxis:!0,pixelRows:!0,alleleDeletions:p}}function ei(e){let t=new Map(e.nodes.map(s=>[s.id,s])),n=e.pathVisits,o=n?.replay();return(e.paths??[]).map(s=>{let r=n?.pathIndex(W(s.name).name)??-1;return s.nodeIds.flatMap(a=>{let i=t.get(a);if(!i)return[];let c=n&&o?o(n.slot(i.name),r):-1;return[{node:i,strand:c>=0?n.strand(c):ko(i)}]})})}function ti(e){let t=ei(e),n=(e.paths??[]).flatMap((s,r)=>{let a=t[r].map(i=>xo(i.node,i.strand));return a.length>0?[{id:r,name:s.name,sequence:a,sourceTrackID:0,type:"haplotype",...s.members?{freq:s.members.length}:{}}]:[]}),o=n.findIndex(s=>W(s.name).name===e.referencePath);return o>0&&n.unshift(...n.splice(o,1)),n}function ni(e){return e.nodes.map(t=>({name:t.id,seq:"",sequenceLength:Math.max(1,t.length)}))}function Ze(e){return(e.paths?.length??0)>0}var oi=600,ri=3,si=15;function ai(e){return Math.max(ri,Math.min(si,Math.floor(oi/Math.max(1,e))))}function ii(e){let t=new Set,n=new Set;for(let o of e?.sequence??[])mn(o)?n.has(He(o))||t.add(He(o)):n.add(o);return t}function ci(e,t,n){let o=ii(n[0]),s=new Map;for(let{sequence:c,is_secondary:p}of n)p||c.forEach((u,l)=>{let d=He(u),h=mn(u)!==o.has(d)?c[l+1]:c[l-1];!t.nodeMap.has(d)&&h!==void 0&&s.set(d,He(h))});let r=new Map(e.nodes.map(c=>[c.id,Math.max(1,c.length)])),a=new Map([...s].map(([c,p])=>[p,c])),i=new Map;for(let c of a.keys()){let p=t.nodeMap.get(c);if(p!==void 0){let u=[c];for(let d=a.get(c);d!==void 0;d=a.get(d))u.push(d);u.reduce((d,f)=>d+(r.get(f)??0),0)===t.nodes[p].sequenceLength&&i.set(c,u)}}return{members:i,flipped:o}}var di={start:"end",end:"start"},os={"+":"-","-":"+"};function pi(e,{members:t,flipped:n}){if(t.size===0)return e;let o=new Map(e.nodes.map(d=>[d.id,d])),s=new Map,r=new Set,a=(d,f)=>n.has(d)?di[f]:f;for(let[d,f]of t)f.forEach((h,w)=>{s.set(h,d);let g=f[w+1];g!==void 0&&r.add(`${h}:${a(h,"end")} ${g}:${a(g,"start")}`)});let i=new Set([...s].filter(([d,f])=>d!==f).map(([d])=>d)),c=e.nodes.flatMap(d=>{let f=t.get(d.id);if(!f)return i.has(d.id)?[]:[d];let h=f.map(g=>o.get(g)),w=h.flatMap(g=>g.stable?[g.stable.start]:[]);return[{...d,length:h.reduce((g,m)=>g+m.length,0),stable:d.stable&&{...d.stable,start:Math.min(...w)}}]}),p=(d,f,h)=>a(f,a(d,h))==="end"?wt(f):os[wt(f)],u=e.edges.flatMap(d=>{let f=be(d),h=`${d.from}:${f.from}`,w=`${d.to}:${f.to}`;if(r.has(`${h} ${w}`)||r.has(`${w} ${h}`))return[];let g=s.get(d.from),m=s.get(d.to);return[{...d,...g===void 0?{}:{from:g,fromStrand:p(d.from,g,f.from)},...m===void 0?{}:{to:m,toStrand:os[p(d.to,m,f.to)]}}]}),l=new Set([...i].map(d=>o.get(d)?.name??d));return{...e,nodes:c,edges:u,paths:e.paths?.map(d=>({...d,nodeIds:d.nodeIds.filter(f=>!i.has(f))})),pathVisits:e.pathVisits?.filter(()=>!0,d=>!l.has(d))}}function rs(e){let t=e.paths??[],n=ti(e),o=e.reads?So(e,e.reads,t.length):[],s=o.length>0?Oo:Go,r=t.map((u,l)=>s(l,t.length)),a=t.some(u=>u.members),i=t.reduce((u,l)=>u+(l.members?.length??1),0),c=Bo(ni(e),n,o,{nodeWidthOption:"compressed",trackWidth:ai(a?i:n.length),...a?{freqWidth:"linear"}:{}});if(!c)return;let p=ci(e,c,[...n,...o]);return{layout:c,pathColors:r,members:p.members,graph:pi(e,p)}}function Pn(e){let t=[];return e.nodes.forEach(n=>{n.order>=0&&t.push(n)}),t}function ss(e,t,n,o){let s=e.y+e.contentHeight/2-t;return[{x:n,y:s},{x:o,y:s}]}function as(e,t){return{minY:e.bounds.minY-t,maxY:e.bounds.maxY-t}}function is(e){let t=Ze(e)?rs(e):void 0;if(!t)return;let{layout:n,...o}=t,s=n.bounds.minY,r={};for(let c of Pn(n))r[c.name]=ss(c,s,c.x,c.x+c.pixelWidth);let{minY:a,maxY:i}=as(n,s);return{nodePositions:r,tubeMap:{layout:n,yOffset:s,...o},extent:{minX:n.bounds.minX,maxX:n.bounds.maxX,minY:a,maxY:i}}}function li(e,t){let n=new Map(e.nodes.map(i=>[i.id,i])),o=new Map;for(let i of Pn(t)){let c=o.get(i.order);c?c.push(i):o.set(i.order,[i])}let s=[],r=-1/0;for(let i of[...o.keys()].sort((c,p)=>c-p)){let c=o.get(i),p=1/0,u=-1/0;for(let l of c){let d=n.get(l.name);d&&I(d)&&(p=Math.min(p,d.stable.start),u=Math.max(u,d.stable.start+d.length))}p===1/0&&(p=u=r),p<r&&(p=r,u=Math.max(r,u)),r=Math.max(r,u),s.push({order:i,x0:Math.min(...c.map(l=>l.x)),x1:Math.max(...c.map(l=>l.x+l.pixelWidth)),bp0:p,bp1:u})}let a=s.find(i=>i.bp0!==-1/0);for(let i of s)i.bp0===-1/0&&(i.bp0=i.bp1=a?.bp0??0);return s}function Ft(e){return Ze(e)&&e.nodes.some(I)}function cs(e){let t=Ft(e)?rs(e):void 0;if(!t)return;let{layout:n,...o}=t,s=li(o.graph,n),r=new Map(s.map(c=>[c.order,c])),a=n.bounds.minY,i={};for(let c of Pn(n)){let p=r.get(c.order);i[c.name]=ss(c,a,p.bp0,p.bp1)}return{nodePositions:i,tubeMap:{layout:n,yOffset:a,columns:s,...o},referenceAxis:!0,pixelRows:!0,extent:as(n,a)}}function ui(e){let t=new Set;for(let n of e.nodes)n.stable&&t.add(n.stable.rank);return new Map([...t].sort((n,o)=>n-o).map((n,o)=>[n,o]))}function ds(e,t){let n=de(e);if(n.length===0)return;let o=$e(n,t),s=ui(e),r=ge(n),a=$t({graph:e,span:o,rowY:c=>(c.stable?s.get(c.stable.rank)??s.size:s.size)*oe,positions:r}),i=[...s].map(([c,p])=>({label:c===0?"Reference (rank 0)":`Rank ${c}`,y:p*oe}));return{nodePositions:r,rowLabels:i,referenceAxis:!0,pixelRows:!0,alleleDeletions:a}}var mi=12,Tn=oe;function ps(e){return 10+8*Math.log2(1+e.length)}function me(e,t){return e<t?-1:e>t?1:0}function us(e,t){return me(e.at,t.at)||me(e.side,t.side)||me(e.hops,t.hops)}var ls={at:1/0,side:0,hops:0};function En(e){let t=new Map(e.nodes.map(o=>[o.id,o])),n=gi(e);return e.nodes.map(o=>o.id).sort((o,s)=>us(n.get(o)??ls,n.get(s)??ls)||me(t.get(o).name,t.get(s).name)||me(o,s))}function fi(e,t){let n=new Set(e.nodes.map(u=>u.id)),o=new Map(t.map(u=>[u.id,u.stable.start])),s=new Map,r=new Map;t.forEach((u,l)=>{r.set(u.id,t[l-1]?.id),s.set(u.id,t[l+1]?.id)});let a=t[0]?.id,i=(u,l)=>{let d=s.get(u);s.set(u,l),r.set(l,u),s.set(l,d),d!==void 0&&r.set(d,l)},c=(u,l)=>{let d=r.get(u);d===void 0?(a=l,r.set(l,void 0),s.set(l,u),r.set(u,l)):i(d,l)};for(let u of e.paths??[]){let l=0,d=0,f;for(let m of u.nodeIds){let y=o.get(m);y!==void 0&&(f!==void 0&&y!==f&&(y>f?l++:d++),f=y)}let h=d>l?[...u.nodeIds].reverse():u.nodeIds,w,g=new Set;for(let m of h)if(s.has(m)){if(w===void 0)for(let y of g)c(m,y);w=m}else n.has(m)&&(w===void 0?g.add(m):(i(w,m),w=m))}let p=[];for(let u=a;u!==void 0;u=s.get(u))p.push(u);return p}function hi(e,t){let n=[...t.entries()].sort(([a,i],[c,p])=>us(i,p)||me(a,c)).map(([a])=>a),o=n.length;for(let a of n){let i=t.get(a);for(let c of e.get(a)??[])t.has(c)||(t.set(c,{at:i.at,side:1,hops:i.hops+1}),n.push(c))}let s=new Set(n.slice(o)),r=new Set;for(let a of s){if(r.has(a))continue;let{at:i}=t.get(a),c=[a];r.add(a);let p=!0;for(let u of c){let{hops:l}=t.get(u),d=!0,f=!1;for(let h of e.get(u)??[]){let w=t.get(h);w.at===i&&s.has(h)?(d&&=w.hops<=l,r.has(h)||(r.add(h),c.push(h))):w.at!==i&&(f||=w.at<i,p&&=w.at<i)}p&&=!d||f}if(p)for(let u of c){let l=t.get(u);t.set(u,{...l,side:-1,hops:-l.hops})}}}function gi(e){let t=new Set(e.nodes.map(r=>r.id)),n=new Map;for(let r of e.edges)!t.has(r.from)||!t.has(r.to)||((n.get(r.from)??n.set(r.from,[]).get(r.from)).push(r.to),(n.get(r.to)??n.set(r.to,[]).get(r.to)).push(r.from));let o=e.nodes.filter(I).sort((r,a)=>me(r.stable.start,a.stable.start)||me(r.name,a.name)),s=new Map;return fi(e,o).forEach((r,a)=>{s.set(r,{at:a,side:0,hops:0})}),hi(n,s),s}function bi(e){let t=new Map(e.nodes.map(l=>[l.id,l])),n=En(e),o=new Map(n.map((l,d)=>[l,d])),s=l=>I(t.get(l)),r=new Map(n.map(l=>[l,[]])),a=new Map(n.map(l=>[l,[]])),i=(l,d)=>{r.get(d).push(l),a.get(l).push(d)};for(let l of e.edges)l.from===l.to||!o.has(l.from)||!o.has(l.to)||(o.get(l.from)<o.get(l.to)?i(l.from,l.to):i(l.to,l.from));let c=n.filter(s);for(let l=1;l<c.length;l++)i(c[l-1],c[l]);let p=new Map;for(let l of n){let d=0;for(let f of r.get(l))d=Math.max(d,p.get(f)+1);p.set(l,d)}for(let l=n.length-1;l>=0;l--){let d=n[l],f=a.get(d);if(s(d)||f.length===0)continue;let h=1/0;for(let m of f)h=Math.min(h,p.get(m));let w=p.get(d),g=Math.max(w,h-1);p.set(d,Math.floor((w+g)/2))}let u=[];for(let l of n)(u[p.get(l)]??=[]).push(l);return{layers:u,layerOf:p,preds:r}}function ms(e){if(!e.nodes.some(I))return;let t=new Map(e.nodes.map(l=>[l.id,l])),n=l=>I(t.get(l)),{layers:o,layerOf:s,preds:r}=bi(e),a=o.map(l=>{let d=0;for(let f of l)d=Math.max(d,ps(t.get(f)));return d}),i=[],c=0;for(let l=0;l<o.length;l++)i[l]=c,c+=a[l]+mi;let p=new Map;for(let l of o){let d=[];for(let h of l){if(n(h)){p.set(h,0);continue}let w=r.get(h).filter(m=>p.has(m)),g=0;for(let m of w)g+=p.get(m)/w.length;d.push({id:h,ideal:g===0?Tn:g})}d.sort((h,w)=>h.ideal-w.ideal);let f=new Set([0]);for(let{id:h,ideal:w}of d){let g=Math.round(w/Tn);g===0&&(g=w>=0?1:-1);for(let m=1;f.has(g);m++)f.has(g+m)?f.has(g-m)||(g-=m):g+=m;f.add(g),p.set(h,g*Tn)}}let u={};for(let l of e.nodes){let d=s.get(l.id),f=ps(l),h=i[d]+a[d]/2,w=p.get(l.id);u[l.id]=[{x:h-f/2,y:w},{x:h+f/2,y:w}]}return{nodePositions:u,referenceAxis:!1,pixelRows:!0}}function fs(e){return e.sample??Ne(e.name)}function wi(e){return e.haplotype!==void 0&&e.sample!==void 0?`${e.sample}#${e.haplotype}`:fs(e)}var yi=class{constructor(e){this.index=new Map,this.lengths=[],this.onReference=new Uint8Array(0),this.referenceStart=new Float64Array(0),this.referenceEnd=new Float64Array(0);for(let t of e.nodes)this.lengths[this.indexOf(t.id)]=t.length}indexOf(e){let t=this.index.get(e);return t===void 0&&(t=this.lengths.length,this.index.set(e,t),this.lengths.push(0)),t}nodesOf(e){let t=new Int32Array(e.nodeIds.length);return e.nodeIds.forEach((n,o)=>{t[o]=this.indexOf(n)}),t}spanAt(e,t){let n=t>=0&&t<e.length?e[t]:-1;return n>=0&&this.onReference[n]?{start:this.referenceStart[n],end:this.referenceEnd[n]}:void 0}};function ki(e,t){let n=[],o;for(let s of e){o!==void 0&&s.start!==void 0&&s.start>o&&n.push(o-s.start);let r=0;for(let a of s.nodes)n.push(a),r+=t.lengths[a];o=s.start===void 0?void 0:s.start+r}return Float64Array.from(n)}function xi(e,t,n){let o,s=0,r;for(let a of e){if(a.start===void 0||o!==void 0&&a.start<o)return;o!==void 0&&a.start>o&&s++===n&&(r={start:o,end:a.start});let i=a.start;for(let c of a.nodes){let p=t.lengths[c];s++===n&&(r={start:i,end:i+p}),i+=p}o=i}return r}function Si(e,t,n,o=!0){if(!n||!o)return{ids:e,complete:!0,from:-1,to:-1};let{onReference:s,referenceStart:r,referenceEnd:a}=t,i=-1,c=-1,p=-1/0,u=1/0;for(let b=0;b<e.length;b++){let S=e[b];if(S>=0&&s[S]){let x=a[S],M=r[S];x<=n.start&&x>p&&(p=x,i=b),M>=n.end&&M<u&&(u=M,c=b)}}if(i>=0&&c>=0){let b=e.slice(Math.min(i,c)+1,Math.max(i,c));return{ids:i<c?b:b.reverse(),complete:!0,from:i,to:c}}let l=b=>t.spanAt(e,b),d=i>=0?i:c,f=-1;for(let b=1;d>=0&&f<0&&b<e.length;b++)f=[d-b,d+b].find(S=>l(S)!==void 0)??-1;if(f<0)return{ids:e,complete:!1,from:-1,to:-1};let w=f>d==l(f).start>l(d).start===(d===i),g=w?e.slice(d+1):e.slice(0,d).reverse(),m=g.length>0?g.length-1:-1,y=m<0?l(d):l(w?d+1+m:0),k={contigEnds:y!==void 0,shortBp:y?Math.max(0,n.start-y.end,y.start-n.end):0};return{ids:g,complete:!1,from:d,to:w?e.length:-1,stop:k}}function Qe(e,t){return t?e.filter(n=>t.includes(n.sample)).sort((n,o)=>t.indexOf(n.sample)-t.indexOf(o.sample)||n.label.localeCompare(o.label)):e}function Ie(e,t,n){let o=e.paths??[],s=x=>W(x.name).name,r=new Set(e.nodes.flatMap(x=>x.stable?.rank===0?[x.stable.refName]:[])),a=o.map(s),i=e.referencePath!==void 0&&a.includes(e.referencePath)?e.referencePath:a.find(x=>r.has(x))??a[0],c=o.filter(x=>s(x)===i).sort((x,M)=>(x.start??0)-(M.start??0)),p=c[0],u=o.filter(x=>!c.includes(x));if(!p||u.length===0)return;let l=new Map;for(let x of u){let M=l.get(x.name);M?M.push(x):l.set(x.name,[x])}let d=new yi(e),f=p.start??0,h=t&&t.end>t.start?t:void 0,w=c.map(x=>d.nodesOf(x)),g=d.lengths.length;d.onReference=new Uint8Array(g),d.referenceStart=new Float64Array(g),d.referenceEnd=new Float64Array(g);let m=!1,y=!1;for(let[x,M]of c.entries()){let P=M.start??0;for(let F of w[x]){let B=d.lengths[F];d.onReference[F]||(d.onReference[F]=1,d.referenceStart[F]=P,d.referenceEnd[F]=P+B,m||=h!==void 0&&P+B<=h.start,y||=h!==void 0&&P>=h.end),P+=B}}let k=h===void 0||m&&y,b=(x,M)=>{let P=x[0],F=x.map(($,K)=>({start:$.start,nodes:M?.[K]??d.nodesOf($)})).sort(($,K)=>($.start??0)-(K.start??0)),{ids:B,complete:C,from:V,to:Y,stop:T}=Si(ki(F,d),d,h,k),L=P.contig??Ae(W(P.name).name),O=xi(F,d,V<0?0:V),j=O?V<0?{contig:L,start:O.start,reversed:!1}:V<Y?{contig:L,start:O.end,reversed:!1}:{contig:L,start:O.start,reversed:!0}:void 0,{lengths:D,onReference:z,referenceStart:E,referenceEnd:U}=d,se=[],G,R=0,N=0,A=0,_=0;for(let $ of B){if($<0){G={start:R,bp:-$,onReference:!1,gap:!0},se.push(G),R-=$,A-=$,_=0;continue}let K=D[$],ee=z[$]===1,Le=G?.referenceStart,he=ee&&Le!==void 0&&_>=0&&Le+G.bp===E[$],ft=ee&&Le!==void 0&&_<=0&&U[$]===Le;!ee&&G&&!G.onReference&&!G.gap?G.bp+=K:he||ft?(G.bp+=K,he||(G.referenceStart=E[$],G.reversed=!0),_=he?1:-1):(G={start:R,bp:K,onReference:ee,referenceStart:ee?E[$]:void 0},se.push(G),_=0),R+=K,ee||(N+=K)}return{name:P.name,label:wi(P),sample:fs(P),haplotype:P.haplotype,bp:R,offReferenceBp:N,gapBp:A,complete:C,stop:T,runs:se,axis:j}};return{origin:h?h.start:f,unit:n,reference:b(c,w),rows:[...l.values()].map(x=>b(x)).sort((x,M)=>Number(M.complete)-Number(x.complete)||M.bp-x.bp||x.label.localeCompare(M.label))}}var Dt=1.3;function Ge(e,t={rowPx:oe,readouts:!0}){let n=e.reference.bp;for(let o of e.rows)n=Math.max(n,o.bp);return{maxX:e.origin+n*(t.readouts?Dt:1),maxY:e.rows.length*t.rowPx}}function Oe(e,t,n){return e?n&&!n.labelled?[]:[e.reference,...e.rows].map((o,s)=>({label:o.label,y:s*(n?.rowPx??oe)})):t?.rowLabels??[]}function In(e,t){let n=de(e),o=Ie(e,t);if(n.length===0||!o)return;let s=t?n.filter(a=>Qt(a,t)):n;return{nodePositions:ge(s.length>0?s:n),rowLabels:Oe(o),referenceAxis:!0,pixelRows:!0,extent:Ge(o)}}var bs="Force-directed layout",Be=e=>e.nodes.some(I),hs=e=>Be(e)&&(e.paths?.length??0)>1,gs=e=>Be(e)&&e.nodes.some(_e),Wt=[{value:"auto",label:"Anchored",description:"x is reference bp, one row per stable rank. Needs rGFA tags or a reference path.",run:ds,cutMargins:!0,wholeWalks:!1,available:Be,drawsLocally:Be,drawsNodes:!0},{value:"samplerows",label:"Sample rows",description:"x is reference bp, one row per contributing assembly. Needs rGFA tags or a reference path.",run:ns,cutMargins:!0,wholeWalks:!1,available:gs,drawsLocally:gs,drawsNodes:!0},{value:"walkrows",label:"Walk rows",description:"x is each walk's own bp: one bar per haplotype, blue on the reference's path and purple off it, so a repeat expansion reads as bar length, and each bar boxes its haplotype's own genes where the session has them. Needs a reference and two or more walks.",run:In,cutMargins:!1,wholeWalks:!0,available:hs,drawsLocally:hs,drawsNodes:!1},{value:"ordered",label:"Ordered",description:"x is reference order, not bp: every node gets room, bubbles read as lenses. Needs rGFA tags or a reference path.",run:ms,cutMargins:!1,wholeWalks:!1,available:Be,drawsLocally:Be,drawsNodes:!0},{value:"tubemap",label:"Tube map",description:"sequenceTubeMap: every path a coloured tube through boxed nodes, columns in node order and node widths log-scaled. Needs P or W lines.",run:is,cutMargins:!1,wholeWalks:!1,available:Ze,drawsLocally:Ze,drawsNodes:!1},{value:"tubemapref",label:"Tube map on reference",description:"The tube map with each column at the reference bp it covers, so the tubes line up with the tracks around them. Needs P or W lines and a reference path.",run:cs,cutMargins:!0,wholeWalks:!1,available:Ft,drawsLocally:Ft,drawsNodes:!1},{value:"force",label:bs,description:"OGDF FMMM (wasm) or stress, whichever engine is chosen.",run:()=>{},cutMargins:!1,wholeWalks:!1,available:()=>!0,drawsLocally:()=>!1,drawsNodes:!0}],Ri=Wt.map(e=>e.value);function Gn(e,t){return!Q(e).drawsLocally(t)}function Q(e){return Wt.find(t=>t.value===e)??Wt[0]}function On(e){return e.walkStrip&&e.mode.drawsNodes&&!e.drawsPicture&&!e.popped&&!e.host&&e.walks>1}function Bn(e,t){return e.wholeWalks||t.walkStrip&&!t.host}var et=6,ks=260,vi=11,Mi=3,Li="#111",ws=3;function Cn(e,t,n){let o=e.pathVisits?.get(n.name)??[],s=[];for(let r of t){let a=r.axis;if(!a)continue;let i=W(r.name).name;for(let c of o){if(c.path!==i)continue;let{start:p,end:u}=Wo(a,c.start,c.start+n.length);u>0&&p<r.bp&&s.push({row:r.name,start:p,bp:u-p})}}return s}var ys=new WeakMap;function Ni(e,t){let n=ys.get(e);if(n||(n=new Map,ys.set(e,n)),n.has(t))return n.get(t);let o=new Map(e.nodes.map(i=>[i.id,i.length])),s=W(t).name,r=(e.paths??[]).filter(i=>s===e.referencePath?W(i.name).name===s:i.name===t),a;if(r.every(i=>i.start!==void 0)){a={ids:[],starts:[],ends:[]};for(let i of[...r].sort((c,p)=>c.start-p.start)){let c=i.start;for(let p of i.nodeIds){let u=o.get(p)??0;a.ids.push(p),a.starts.push(c),a.ends.push(c+u),c+=u}}}return n.set(t,a),a}function Ai(e,t,n,o){let s=t.axis,r=s&&Ni(e,t.name);if(!s||!r||n<0||n>t.bp)return;let a=s.reversed?s.start-n:s.start+n,i=.5/o,c=s.reversed?{start:s.start-t.bp,end:s.start}:{start:s.start,end:s.start+t.bp},p=Math.max(a-i,c.start),u=Math.min(a+i,c.end),l=0,d=r.starts.length;for(;l<d;){let g=l+d>>1;r.ends[g]<=p?l=g+1:d=g}let f,h=-1,w=!1;for(let g=l;g<r.starts.length&&r.starts[g]<u;g++){let m=r.ends[g]-r.starts[g],y=r.starts[g]<=a&&a<r.ends[g];(m>h||m===h&&y&&!w)&&(h=m,f=r.ids[g],w=y)}return f}function tt(e,t){let n=t.maxHeight??ks,o=t.labelPx??Math.max(...[e.reference,...e.rows].map(f=>f.label.length))*Te+16,s=e.rows.length+1,{rowPx:r,barPx:a,labelled:i,readouts:c}=Mt(s,n-2*et,Mi),p=Math.max(e.reference.bp,...e.rows.map(f=>f.bp),1),u=i?o:et,d=Math.max(1,t.width-u-et)/(p*(c?Dt:1));return{scaleX:d,scaleY:1,translateX:u-e.origin*d,translateY:et+r/2,width:t.width,height:s*r+2*et,rowPx:r,barPx:a,readouts:c,labelled:i,boxesGenes:vt(r,a)}}function Pi(e,t,n,o){let s=Math.round((o-t.translateY)/t.rowPx),r=[e.reference,...e.rows][s],a=(n-t.translateX)/t.scaleX-e.origin;return r&&s>=0&&a>=0&&a<=r.bp?{index:s,row:r,offset:a}:void 0}function Ti(e,t,n){let o=new Map([e.reference,...e.rows].map((r,a)=>[r.name,a])),s=r=>(e.origin+r)*t.scaleX+t.translateX;return Ve("g",{"data-testid":"graph-walk-marks"},...n.flatMap(r=>{let a=o.get(r.row);if(a===void 0)return[];let i=a*t.rowPx+t.translateY,c=s(r.start),p=Math.max(2,r.bp*t.scaleX),u=l=>Ve("rect",{x:c,y:l,width:p,height:ws,fill:Li});return[u(i-t.barPx/2-ws-1),u(i+t.barPx/2+1)]}))}function _n(e,t,n=new Set){return Ve("g",{"font-family":"sans-serif","font-size":vi,fill:"#333"},...(t.labelled?[e.reference,...e.rows]:[]).map((o,s)=>Ve("text",{x:6,y:s*t.rowPx+t.translateY+4,"font-weight":n.has(o.name)?600:void 0},o.label)))}function $n(e,t,n){if(t?.size)return e.boxesGenes?n:{untracked:0,unread:0,...n,crowded:!0}}function fe(e){return`${e.refName}:${(e.start+1).toLocaleString()}-${e.end.toLocaleString()}`}function Ei(e,t,n=o=>o){return t?{deletion:{bp:`${t.bp.toLocaleString()} bp`,where:fe(t)}}:{ends:`${n(e.from)}${e.fromStrand??""} \u2192 ${n(e.to)}${e.toStrand??""}`}}function xs(e){return Pe(e)?Ss(e):void 0}function Ss(e){return{sample:Ne(e.stable.refName),haplotype:lo(e.stable.refName),refName:Ae(e.stable.refName),start:e.stable.start,end:e.stable.start+e.length}}function Ii(e,t){let n=[...e].sort((r,a)=>r.start-a.start),o,s;for(let r of n)s=s&&r.start-s.end<=t?{start:s.start,end:Math.max(s.end,r.end)}:{start:r.start,end:r.end},(!o||s.end-s.start>o.end-o.start)&&(o=s);return o}function Gi(e){return`${e.haplotype??e.sample}\0${e.refName}`}function Rs(e,{maxGap:t=1/0}={}){let n=new Map;for(let s of e.nodes)if(Pe(s)){let r=Ss(s),a=Gi(r),i=n.get(a);i?(i.spans.push({start:r.start,end:r.end}),i.rank=Math.min(i.rank,s.stable.rank)):n.set(a,{sample:r.sample,haplotype:r.haplotype,refName:r.refName,rank:s.stable.rank,spans:[{start:r.start,end:r.end}]})}let o=new Map;for(let s of n.values()){let r=Ii(s.spans,t);if(r){let a={sample:s.sample,haplotype:s.haplotype,refName:s.refName,start:r.start,end:r.end,rank:s.rank,nodeCount:s.spans.length},i=s.haplotype??s.sample,c=o.get(i);(!c||a.nodeCount>c.nodeCount)&&o.set(i,a)}}return[...o.values()].sort((s,r)=>+(s.rank!==0)-+(r.rank!==0)||s.sample.localeCompare(r.sample)||(s.haplotype??"").localeCompare(r.haplotype??""))}function nt(e,t){return(t.haplotype===void 0?void 0:e(t.haplotype))??e(t.sample)}function vs(e,t){return e.flatMap(n=>{let o=nt(t,n);return o===void 0?[]:[{...n,sample:o}]})}function Ht(e){return`${e.refName}:${e.start+1}-${e.end}`}function Ms(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.horizontalScroll=="function"&&typeof t.zoomTo=="function"&&"coarseDynamicBlocks"in t&&"dynamicBlocks"in t}function Ls(e){return e.reduce((t,n)=>t&&t.end-t.start>=n.end-n.start?t:n,void 0)}function Ns(e,t){let n=Ls(e.dynamicBlocks.contentBlocks.filter(r=>r.refName===t.refName&&r.assemblyName===t.assemblyName)),{bpPerPx:o}=e;if(!n||!(o>0))return;let s=n.offsetPx-e.offsetPx;return n.reversed?{scale:-1/o,translateX:s+n.end/o}:{scale:1/o,translateX:s-n.start/o}}function Ru(e){let t=Ls(e.dynamicBlocks.contentBlocks),n=t?.displayedRegionIndex===void 0?void 0:e.displayedRegions[t.displayedRegionIndex];return t&&e.bpPerPx>0?{refName:t.refName,assemblyName:t.assemblyName,start:t.start,end:t.end,bpPerPx:e.bpPerPx,span:e.bpPerPx*e.width,regionStart:n?.start??t.start,regionEnd:n?.end??t.end}:void 0}function Oi(e,t,n=!0){let o=e.end-e.start,s=n?Math.max(0,Math.min(e.span,(t-o)/2)):0,r=Math.max(e.regionStart,Math.floor(e.start-s)),a=Math.min(e.regionEnd,Math.ceil(e.end+s)),i=a-r-t;return i>0&&(r+=Math.floor(i/2),a-=Math.ceil(i/2)),{refName:e.refName,assemblyName:e.assemblyName,start:r,end:a}}function vu(e,t,n=!0){if(e?.refName!==t.refName||e.assemblyName!==t.assemblyName)return!1;if(n)return e.start<=t.start+1&&t.end<=e.end+1;let o=Oi(t,1/0,!1);return Math.abs(e.start-o.start)<1&&Math.abs(e.end-o.end)<1}function ot(e,t,n){let o=new Map;for(let r of e.nodes)if(Pe(r)){let{refName:a}=r.stable;if(n[r.id]?.length){let i=o.get(a)??o.set(a,{nodes:[],reach:0}).get(a);i.nodes.push(r),i.reach=Math.max(i.reach,r.length)}}for(let{nodes:r}of o.values())r.sort((a,i)=>a.stable.start-i.stable.start);let s=[];for(let r of t){let a=o.get(r.refName);if(!a)continue;let i=[],c=[],p=new Set,u,l=1/0,d=0,f=(r.start+r.end)/2,{nodes:h,reach:w}=a;for(let g=en(h,r.start-w);g<h.length&&h[g].stable.start<r.end;g++){let m=h[g],y=m.stable.start,k=y+m.length;if(k<=r.start)continue;let b=n[m.id];p.add(m.id),d+=Math.min(k,r.end)-Math.max(y,r.start);let S=[];for(let P of r.exons){let F=Math.max(P.start,y),B=Math.min(P.end,k);if(B<=F)continue;let C=un(b,(F-y)/m.length,(B-y)/m.length);C.length===1&&C.push({...C[0]}),S.push(De(C))}S.length>0&&(i.push(...S),c.push({nodeId:m.id,d:S.join("")}));let x=Math.min(Math.max(f,y),k),M=Math.abs(x-f);if(M<l){l=M;let P=m.length?(x-y)/m.length:0;u=un(b,P,P)[0]}}u&&s.push({gene:r,exons:i.join(""),exonsByNode:c,nodeIds:p,at:u,covered:d/(r.end-r.start)})}return s}var As="10.2.6";function rt(e,t,n={}){return{nodePositions:n.drawsRows?{}:e.nodePositions,deletions:t.bypassed,deletionRoutes:e.deletionRoutes,stranded:e.stranded,hiddenEdges:t.hidden}}var Ps=(e,t)=>!!e.referencePath&&W(t).name===e.referencePath;function Bi(e,t){return(e.paths??[]).filter(n=>n.name===t).sort((n,o)=>(n.start??0)-(o.start??0))}function Ts(e,t){let n=Bi(e,t),o=n[0];if(!o)return;let s=new Map(e.nodes.map(k=>[k.id,k])),r=new Map;e.edges.forEach((k,b)=>{r.set(`${k.from}>${k.to}`,b)});let a=k=>s.get(k)?.length??0,i=k=>k.nodeIds.reduce((b,S)=>b+a(S),0),c=n.reduce((k,b)=>k+i(b),0),p=k=>{let b=Math.min(...k.map(S=>S.start??1/0));return Number.isFinite(b)?{start:b,end:Math.max(...k.map(S=>(S.start??0)+i(S)))}:void 0},u=p(n),l=u&&{contig:o.contig??Ae(W(t).name),...u},d=l?l.end-l.start:c,f=new Set,h=new Set,w=new Map,g=0;for(let k of n)l&&(g=Math.max(g,(k.start??0)-l.start)),k.nodeIds.forEach((b,S)=>{if(f.add(b),S>0){let M=k.nodeIds[S-1],P=r.get(`${M}>${b}`)??r.get(`${b}>${M}`);P!==void 0&&h.add(P)}let x=a(b);w.has(b)||w.set(b,d>0?(g+x/2)/d:0),g+=x});let m=Ps(e,t),y=()=>{let k=m?[]:(e.paths??[]).filter(S=>Ps(e,S.name));if(k.length===0)return;let b=p(k);return b?b.end-b.start:k.reduce((S,x)=>S+i(x),0)};return{name:t,reference:m,range:l,nodeIds:f,edgeIndexes:h,progress:w,steps:n.reduce((k,b)=>k+b.nodeIds.length,0),bp:c,referenceBp:y()}}function Es(e,t,n,o){let s=new Map(e.nodes.map(a=>[a.id,a])),r=new Map;for(let[a,i]of t.progress){let c=s.get(a),p=o?.midpoints.get(a),u=n.field==="progress"?i:o&&p!==void 0&&!(c?.stable&&c.stable.rank>0)?(p-o.start)/o.span:void 0;r.set(a,Uo(n,u))}return r}function Ci(e,t){let n=new Set,o=0,s=e.referencePath;if(!s||t.reference)return{reversed:n,bp:o};let r=e.pathVisits;if(!r)return{reversed:n,bp:o};let a=r.pathIndex(W(t.name).name),i=r.pathIndex(s),c=new Map(e.nodes.map(p=>[p.id,p]));for(let p of t.progress.keys()){let u=c.get(p),l=u?r.slot(u.name):-1,d=l<0?-1:r.firstBy(l,a),f=l<0?-1:r.firstBy(l,i);d>=0&&f>=0&&r.reversed[d]!==r.reversed[f]&&(n.add(p),o+=u.length)}return{reversed:n,bp:o}}function st(e,t,n){let o=new Set,s=t.filter(i=>!o.has(i.walk)&&o.add(i.walk)).flatMap(i=>{let c=Ts(e,i.walk);return c?[{walk:c,layer:i}]:[]}).sort((i,c)=>Number(c.walk.reference)-Number(i.walk.reference));if(s.length===0)return;let r=0,a=s.map(({walk:i,layer:c})=>{let p=wn(c,i.reference,i.reference?0:r++,s.length===1),{reversed:u,bp:l}=Ci(e,i);return{...i,encoding:p,colors:Es(e,i,p,n),reversed:u,reversedBp:l}});return Is(a,n)}var _i={field:"progress",scheme:"red"};function at(e,t,n,o){return t.walks.map(s=>{let r=n.find(i=>i.walk===s.name)?.color,a=wn({walk:s.name,color:{..._i,...r}},s.reference,0);return Is([{...s,encoding:a,colors:Es(e,s,a,o)}],o)})}function Is(e,t){return{walks:e,referenceDomain:t?{start:t.start,end:t.start+t.span}:void 0,nodeIds:new Set(e.flatMap(n=>[...n.nodeIds])),edgeIndexes:new Set(e.flatMap(n=>[...n.edgeIndexes])),names:new Set(e.map(n=>n.name))}}var ve={...ie,colorScheme:"auto",nodeWidth:"depth",contigThickness:6,connectorThickness:2};function Fn(e){let t=ve,n={};for(let[o,s]of Object.entries(e))s!==void 0&&s!==t[o]&&(n[o]=s);return n}var Gs=[{value:"auto",label:"Auto"},{value:"uniform",label:"Uniform"},{value:"random",label:"Random"},{value:"rainbow",label:"Rainbow"},{value:"depth",label:"Depth"},{value:"node-length",label:"Node length"},{value:"stable-rank",label:"Stable rank"},{value:"reference-position",label:"Reference position"},{value:"grey",label:"Grey"}],$i=Gs.map(e=>e.value);function it(e,t){return e!=="auto"?e:t?.anchoredBy?"reference-position":"uniform"}function Os(e,t,n){let o=n.region,s=n.colorDomain??o,r=n.walkRows,a=Ke(t,{region:n.fitToDrawing?void 0:o,extent:r&&t.extent?Ge(r,n.walkRowPitch):void 0}),i=new Map(e.nodes.map(b=>[b.id,b])),c=it(n.colorScheme??ve.colorScheme,e),p=c==="reference-position"&&!t.tubeMap?Xe(e,s):void 0,u=ye(e,t.tubeMap?[]:we(e),n.showDeletionEdges),l=n.walks??[],d=l.some(b=>b.color?.field==="reference")?p??Xe(e,s):void 0,f=l.length>0&&!t.tubeMap?st(e,l,d):void 0,h=At(n.facet),w=h.field&&f&&f.walks.length>1?at(e,f,l,d):void 0,g=kt(e.paths?.length?We(e.paths):[]),m=n.referenceName??on(e,o),y=n.contigThickness??ve.contigThickness,k=n.nodeWidth??ve.nodeWidth;return{bounds:a,nodeById:i,colorScheme:c,referenceRamp:p,drawnDeletions:u,layers:l,lift:f,facet:h,panels:w,labelOf:b=>g.get(b)??b,referenceName:m,reference:f?.referenceDomain&&{...f.referenceDomain,name:m},contigThickness:y,nodeWidth:k,geometry:(b,S)=>Rt({...rt(t,u,{drawsRows:!!r}),graph:e,nodeById:i,colorScheme:c,contigThickness:y,connectorThickness:n.connectorThickness??ve.connectorThickness,drawPaths:!1,nodeWidth:k,linearLayout:n.linearLayout,highlight:b,axis:S,referenceRamp:p})}}var Wn='font-family="Helvetica, Arial, sans-serif" font-size="11"',Fi=48,Xt=18,Di=16,Wi=22,Hi="rgb(160,160,160)",Cs="#1c1c22";function Dn(e,t,n,o,s,r,a,i=1){let c=o.length>1?Fi:Xt,p=o.length>1?`fill="url(#${e})"`:`fill="${o[0].color}"${i<1?` fill-opacity="${i}"`:""}`,u=o.length>1?`<linearGradient id="${e}">${o.map(d=>`<stop offset="${d.offset}" stop-color="${d.color}"/>`).join("")}</linearGradient>`:"";return{width:Math.max(c+5+(s.length+r.length)*Te,(a?.length??0)*Te),markup:`${u}<g transform="translate(${t} ${n})" ${Wn}><rect y="5" width="${c}" height="8" rx="2" ${p}/><text x="${c+5}" y="13"><tspan font-weight="bold">${le(s)}</tspan>${le(r)}</text>${a?`<text y="28">${le(a)}</text>`:""}</g>`}}function Xi(e,t){return{width:Xt+5+4*Te,markup:`<g transform="translate(${e} ${t})" ${Wn}><rect x="1" y="4" width="${Xt-2}" height="10" rx="4" fill="none" stroke="${xn}" stroke-width="2"/><text x="${Xt+5}" y="13">exon</text></g>`}}function Bs(e,t,n,o,s,r){let a=wr(o,r);return Dn(e,t,n,yn(o.encoding),s,a.delta+a.outside+a.reversed,a.scale)}function Vi(e,t){return e.replaceAll(/([ML])(-?[\d.e-]+),(-?[\d.e-]+)/g,(n,o,s,r)=>`${o}${+(Number(s)*t.scaleX+t.translateX).toFixed(1)},${+(Number(r)*t.scaleY+t.translateY).toFixed(1)}`)}function ji(e,t,n,o,s){return`<rect x="${e-n/2}" y="${t-Fe-ln+2}" width="${n}" height="${Fe+ln*2-2}" rx="3" fill="#fff" fill-opacity="0.85" stroke="${xn}"/><text x="${e}" y="${t}" font-family="Helvetica, Arial, sans-serif" font-size="${Fe}" fill="${Cs}" text-anchor="middle"><tspan font-style="italic" font-weight="600">${le(o)}</tspan>${s?le(s):""}</text>`}function Hn(e,t,n={}){let o=n.width??1200,s=n.height??800,r=n.walkRows,{bounds:a,nodeById:i,referenceRamp:c,layers:p,lift:u,facet:l,panels:d,labelOf:f,referenceName:h,reference:w,contigThickness:g,nodeWidth:m,geometry:y}=Os(e,t,n),k=t.pixelRows??!1,b=c&&{start:c.start,end:c.start+c.span},S=n.genes?.length&&!t.tubeMap&&!r?ot(e,n.genes,t.nodePositions):[],x=xt(e,i,g,m),M=0;function P(T,L,O,j){let D=[],z=mr(ur(S,x.halfWidthPx,T,G=>Vi(G,L)),{id:`exons${M++}`,width:O,height:j});z&&D.push(ke(z));let E=G=>({x:G.x*L.scaleX+L.translateX,y:G.y*L.scaleY+L.translateY}),U={width:O,height:j};for(let{item:G,x:R,y:N,w:A,text:_}of Ao(hr(S,E,g,fr(t.nodePositions,L)),U,No(U))){let $=E(G.at).y+g/2;D.push(`<line x1="${R}" x2="${R}" y1="${N-Fe-2}" y2="${$}" stroke="${Cs}" stroke-width="0.8" stroke-opacity="0.6"/>`,ji(R,N,A,G.gene.name,_.slice(G.gene.name.length)))}r&&D.push(ke(gn(r,{...L,width:O,height:j,...n.walkRowPitch},{ramp:b,rowGenes:n.rowGenes})));let se=Oe(r,t,n.walkRowPitch);for(let{label:G,y:R}of se){let N=R*L.scaleY+L.translateY;N>=0&&N<=j&&D.push(`<text x="6" y="${N+4}" ${Wn} stroke="#fff" stroke-width="3" paint-order="stroke">${le(G)}</text>`)}return D.join("")}function F(T,L,O){let j=ze(a,L,O,k,d?{padLeft:ae,padTop:ae,padRight:ae,padBottom:ae}:{});if(!j)return"";let D=qe(j.scale,k),{canvas:z,markup:E}=pr(L,O),U=new lr(z);U.uploadGeometry(y(T,D));let se={scaleX:D.scaleX,scaleY:D.scaleY,translateX:j.translateX,translateY:j.translateY};return U.updateTransform({...se,dpr:1}),U.render([1,1,1,1]),E()+P(T,se,L,O)}let B=[],C;if(d){let T=Pt(d.map(O=>O.walks[0].name),l.field||"walk",l.domain),L=Nt({count:T.count,bounds:a,pixelRows:k,width:o,room:s,columns:T.columns??l.columns});d.forEach((O,j)=>{let D=T.cells[j],z=D%L.columns*(L.width+je),E=Math.floor(D/L.columns)*(L.height+Lt+je),U=O.walks[0];B.push(Bs(`key${j}`,z+6,E+2,U,f(U.name),w).markup,`<svg x="${z}" y="${E+Lt}" width="${L.width}" height="${L.height}">${F(O,L.width,L.height)}</svg>`)}),C=L.total}else{let T=6,L=E=>{B.push(E.markup),T+=E.width+Di};if(u&&(u.walks.forEach((E,U)=>{L(Bs(`key${U}`,T,2,E,f(E.name),w))}),L(Dn("faded",T,2,[{offset:0,color:Hi}],"",`not on ${u.walks.length===1?f(u.walks[0].name):"these walks"}`,void 0,.3))),r){let E=hn(fn(r,{ramp:b,genes:n.rowGenes?.size?n.rowGeneGaps:void 0}),T,2,"rows-key");L({width:E.width,markup:ke(E.tree)})}else!u&&c&&L(Dn("ramp",T,2,yn({field:"reference",scheme:"rainbow"}),h?`${h} position`:"Reference position","",br(h,c.start,c.start+c.span)));S.some(E=>E.exonsByNode.length>0)&&L(Xi(T,2));let O=B.length>0?Lt:0,j=o-2*H,D=k||!(a.w>0)?a.h:a.h*j/a.w,z=Math.max(160,Math.min(s-O,Math.ceil(D+2*H)));B.push(`<svg y="${O}" width="${o}" height="${z}">${F(u,o,z)}</svg>`),C=O+z}let V=n.walkStrip;if(V&&!r&&!t.tubeMap){let T=tt(V.rows,{width:o}),L=hn(fn(V.rows,{ramp:b,genes:$n(T,V.rowGenes,V.rowGeneGaps)}),6,C+T.height,"strip-key");B.push(`<line x1="0" x2="${o}" y1="${C+.5}" y2="${C+.5}" stroke="#ddd"/>`,`<svg y="${C}" width="${o}" height="${T.height}">${ke(gn(V.rows,T,{ramp:b,rowGenes:V.rowGenes,idPrefix:"strip"}))}${ke(_n(V.rows,T,new Set(p.map(O=>O.walk))))}</svg>`,ke(L.tree)),C+=T.height+Wi}let Y=JSON.stringify({generator:`@jbrowse/bandage-core@${As}`,...n.spec===void 0?{}:{spec:n.spec}});return`<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${C}" viewBox="0 0 ${o} ${C}"><metadata>${le(Y)}</metadata><rect width="${o}" height="${C}" fill="#fff"/>${B.join("")}</svg>
|
|
3
|
+
`}var _s=.9;function ct(e,t){return e+2>=t||e>=_s*t}var $s=50;function Xn(e,t,n,o=[]){let s=new Map(e.nodes.map(a=>[a.name,a])),r=[];for(let a of t){let i=[],c=1/0,p=-1/0,u=1/0,l=[],d=xe(a);for(let[w,g]of d.entries()){let m=s.get(g),y=m&&n[m.id];if(!(!m||!y?.length)&&!(a.key?w===0||w===d.length-1:I(m)&&(m.stable.start<a.start||m.stable.start>=a.end))){l.push(m.id),i.push(De(y.length===1?[y[0],y[0]]:y));for(let k of y)c=Math.min(c,k.x),p=Math.max(p,k.x),u=Math.min(u,k.y)}}if(l.length===0)continue;let f={x:(c+p)/2,y:u},h=a.covering===!0||ct(l.length,e.nodes.length);r.push({bubble:a,...qo(a,o),path:i.join(""),labelAt:f,members:l.length,nodeIds:l,whole:h,tick:!h&&!a.partial&&a.longestAlleleLength<$s})}return r}function dt(e,t){let n=new Set(t),o=e.nodes.filter(c=>n.has(c.name)),s=new Set(o.map(c=>c.id)),r=new Map(e.nodes.map(c=>[c.id,c.length])),a=new Map,i=e.paths?.flatMap(c=>{let p=c.nodeIds.findIndex(d=>s.has(d));if(p<0)return[];let u=c.nodeIds.filter(d=>s.has(d));a.set(c.name,{first:p,nodeIds:u});let l=c.nodeIds.slice(0,p).reduce((d,f)=>d+(r.get(f)??0),0);return[{...c,nodeIds:u,...c.start===void 0?{}:{start:c.start+l}}]});return{name:e.name,nodes:o,edges:e.edges.filter(c=>s.has(c.from)&&s.has(c.to)),...i?.length?{paths:i}:{},anchorPaths:Lo(e,a),pathVisits:e.pathVisits,anchoredBy:e.anchoredBy,referencePath:e.referencePath}}function Vn(e,t,n,o){let s=e.get(t);e.set(t,{min:Math.min(s?.min??1/0,n.min+o),max:Math.max(s?.max??-1/0,n.max+o),n:Math.min(Ko,n.n+(s?.n??0))})}function Fs(e){if(!e.nodes.some(I))return[];let t=new Map(e.nodes.map(d=>[d.id,d])),n=En(e),o=new Map(n.map((d,f)=>[d,f])),s=new Int32Array(n.length+1),r=new Map,a=new Set;for(let d of e.edges){let f=o.get(d.from),h=o.get(d.to);if(f===void 0||h===void 0||f===h)continue;a.add(`${d.from}>${d.to}`).add(`${d.to}>${d.from}`);let[w,g]=f<h?[f,h]:[h,f];s[w+1]++,s[g]--;let[m,y]=f<h?[d.from,d.to]:[d.to,d.from];(r.get(m)??r.set(m,new Set).get(m)).add(y)}for(let d=1;d<s.length;d++)s[d]+=s[d-1];let i=e.nodes.filter(I).sort((d,f)=>d.stable.start-f.stable.start),c=new Set([i[0].id,i.at(-1).id]),p=i.map(d=>[d,o.get(d.id)]).filter(([d,f])=>c.has(d.id)||s[f]===0).sort(([d,f],[h,w])=>f-w||d.stable.start-h.stable.start),u=jn(e,p.map(([d])=>d.id)),l=[];for(let d=0;d+1<p.length;d++){let[f,h]=p[d],[w,g]=p[d+1],m=n.slice(h+1,g);if(m.length===0)continue;let y=new Map([[f.id,{min:0,max:0,n:1}]]);for(let Y of[f.id,...m]){let T=y.get(Y);if(T)for(let L of r.get(Y)??[])o.get(L)>g||Vn(y,L,T,L===w.id?0:t.get(L).length)}let k=u&&Yn(e,t,u,f.id,w.id),b=k?.n?k:void 0,S=b??y.get(w.id)??{min:0,max:0,n:0},x=k!==void 0&&k.left>0,M=f.stable.start+f.length,P=w.stable.start,F=[f.id,...m.filter(Y=>I(t.get(Y))),w.id],B=F.some((Y,T)=>T>0&&!a.has(`${F[T-1]}>${Y}`)),C=B||x,V=B&&!b;l.push({refName:f.stable.refName,start:M,end:P,segmentCount:m.length+2,pathCount:S.n,inversion:!1,shortestAlleleLength:V?P-M:S.min,longestAlleleLength:V?P-M:S.max,segments:[f,...m.map(Y=>t.get(Y)),w].map(Y=>Y.name).join(","),shortestAllele:void 0,longestAllele:void 0,partial:C,routes:b?.routes})}return l}function jn(e,t){let n=e.paths;if(!n)return;let o=new Map;for(let s of t)o.set(s,new Int32Array(n.length).fill(-1));return n.forEach((s,r)=>{let a=s.nodeIds;for(let i=0;i<a.length;i++){let c=o.get(a[i]);c?.[r]===-1&&(c[r]=i)}}),o}function Yn(e,t,n,o,s){let r=[],a=1/0,i=-1/0,c=0,p=n.get(o),u=n.get(s);return e.paths.forEach((l,d)=>{let f=p[d],h=u[d];if(f<0||h<0){(f>=0||h>=0)&&c++;return}let w=l.nodeIds,g=Math.min(f,h)+1,m=Math.max(f,h),y=h<f?b=>w[m-1-b]:b=>w[g+b],k=r.find(b=>b.steps.length===m-g&&b.steps.every((S,x)=>S===y(x)));if(!k){let b=Array.from({length:m-g},(x,M)=>y(M)),S=0;for(let x of b)S+=t.get(x)?.length??0;k={steps:b,bp:S,walks:[]},r.push(k)}k.walks.push(l.name),a=Math.min(a,k.bp),i=Math.max(i,k.bp)}),r.length||c?{min:a,max:i,n:r.length,left:c,routes:r}:void 0}function Yi(e,t){let n=e.nodes.length*2,o=new Set,s=[],r=new Int32Array(n);for(let p of e.edges){let u=t.get(p.from),l=t.get(p.to);if(u===void 0||l===void 0)continue;let d=be(p),f=u*2+(d.from==="end"?1:0),h=l*2+(d.to==="end"?1:0),w=Math.min(f,h)*n+Math.max(f,h);o.has(w)||(o.add(w),s.push(f,h),r[f]++,f!==h&&r[h]++)}let a=new Int32Array(n+1);for(let p=0;p<n;p++)a[p+1]=a[p]+r[p];let i=new Int32Array(a[n]),c=a.slice(0,n);for(let p=0;p<s.length;p+=2){let u=s[p],l=s[p+1];i[c[u]++]=l,u!==l&&(i[c[l]++]=u)}return{offset:a,next:i}}function Ui(e,t,n){let o=new Int32Array(e),s=new Uint8Array(e*2),r=new Int32Array(e*2),a=new Int32Array(e),i=[],c=0;return p=>{let u=p>>1;c++,i.length=0;let l=0,d=0,f=0,h,w=g=>{s[g]||(s[g]=1,l++,i.push(g))};w(p),r[d++]=p;e:for(;d>0;){let g=r[--d],m=g>>1;if(o[m]=c,m!==u&&(a[f++]=g),s[g]&&(s[g]=0,l--),t[g]===t[g+1])break;for(let y=t[g];y<t[g+1];y++){let k=n[y],b=k>>1;if(b===u)break e;if(w(k^1),o[b]===c)continue;let S=!0;for(let x=t[k];x<t[k+1];x++)if(o[n[x]>>1]!==c){S=!1;break}S&&(r[d++]=k^1)}if(d===1&&l===1){f>0&&(h={source:p,sink:r[0],inside:a.slice(0,f)});break}}for(let g of i)s[g]=0;return h}}function zi(e){return{source:e.sink^1,sink:e.source^1,inside:e.inside.map(t=>t^1).reverse()}}var Hs=new Intl.Collator(void 0,{numeric:!0});function Un(e,t){return I(e)&&I(t)&&e.stable.refName===t.stable.refName}function Ds(e,t){let n=t[e.source>>1],o=t[e.sink>>1],s=Un(n,o)?n.stable.start-o.stable.start:0,r=((e.sink^1)&1)-(e.source&1);return(s||r||Hs.compare(n.name,o.name))<0}function Ws(e){return[e.source>>1,...Array.from(e.inside,t=>t>>1),e.sink>>1]}function Ki(e){let{nodes:t}=e,n=new Map(t.map((c,p)=>[c.id,p])),{offset:o,next:s}=Yi(e,n),r=Ui(t.length,o,s),a=new Map;for(let c=0;c<t.length*2;c++){let p=r(c);if(!p)continue;let u=p.source>>1,l=p.sink>>1,d=Math.min(u,l)*t.length+Math.max(u,l);(Ds(p,t)||!a.has(d))&&a.set(d,p)}return{found:[...a.values()].map(c=>Ds(c,t)?c:zi(c)),offset:o,next:s}}function qi(e,t,n,o){let s=o.sink>>1,r=new Map([[o.source>>1,{min:0,max:0,n:1}]]);for(let a of[o.source,...o.inside]){let i=r.get(a>>1);if(i)for(let c=t[a];c<t[a+1];c++){let p=n[c]>>1;Vn(r,p,i,p===s?0:e[p].length)}}return r.get(s)??{min:0,max:0,n:0}}function zn(e,t){let{nodes:n}=e,{found:o,offset:s,next:r}=Ki(e),a=o.map(h=>ct(h.inside.length,n.length)),i=o.map(Ws),c=new Map;i.forEach((h,w)=>{for(let g of h)(c.get(g)??c.set(g,[]).get(g)).push(w)});let p=(h,w)=>c.get(h.inside[0]>>1).some(g=>g!==w&&!a[g]&&i[g].length>i[w].length&&i[w].every(m=>c.get(m).includes(g))),u=h=>t!==void 0||Un(n[h.source>>1],n[h.sink>>1]),l=o.filter((h,w)=>!a[w]&&u(h)&&!p(h,w)),d=new Map(n.map(h=>[h.id,h])),f=jn(e,l.flatMap(h=>[n[h.source>>1].id,n[h.sink>>1].id]));return l.map(h=>{let w=n[h.source>>1],g=n[h.sink>>1],m=f&&Yn(e,d,f,w.id,g.id),y=m?.n?m:void 0,k=y??qi(n,s,r,h),b=Un(w,g);return{refName:b?w.stable.refName:t.refName,start:b?w.stable.start+w.length:t.start,end:b?g.stable.start:t.end,segmentCount:h.inside.length+2,pathCount:k.n,inversion:!1,shortestAlleleLength:k.min,longestAlleleLength:k.max,segments:Ws(h).map(S=>n[S].name).join(","),shortestAllele:void 0,longestAllele:void 0,partial:m!==void 0&&m.left>0,routes:y?.routes,key:`${w.name}>${g.name}`,...b?{}:{offReference:!0}}}).sort((h,w)=>h.start-w.start||h.end-w.end||Hs.compare(h.key,w.key))}function Vt(e,t){let n=e.nodes.length,o=Fs(e);if(o.length===0){let s=zn(e,t);return t?[...s,{...t,covering:!0}]:s}return o.flatMap(s=>ct(s.segmentCount-2,n)?[...zn(s.segmentCount===n?e:dt(e,xe(s)),s),{...s,covering:!0}]:[s])}function Kn(e,t,n){if(t==="uniform"||t==="grey")return;let o={...$o(e),referenceRamp:n};return new Map(e.nodes.map((s,r)=>[s.id,Co(Fo(s,r,t,o))]))}var jt=JBrowseExports["@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain"];var Xs=jt&&jt.__esModule?jt.default:jt;function re(e){return typeof e=="object"&&e!==null}function Ji(e){return re(e)&&e.type==="LinearGenomeView"&&typeof e.id=="string"&&typeof e.navToLocString=="function"&&Array.isArray(e.assemblyNames)}function Zi(e){return e.flatMap(t=>re(t)&&Array.isArray(t.views)?[t,...t.views]:[t])}function pt({views:e,connectedViewId:t,assemblyName:n}){let o=Zi(e).filter(r=>Ji(r)).filter(r=>r.assemblyNames.includes(n));return o.find(r=>r.id===t)??(o.length===1?o[0]:void 0)}function qn(e,t){let n=e.assemblyManager;return n?.has(t)?n.get(t)?.name??t:t}function Jn(e,t){let n=q(t,"assemblyNames");return Array.isArray(n)?n.filter(o=>typeof o=="string").map(o=>qn(e,o)):[]}function js(e,t,n){n.catch(o=>{console.error(`[GraphGenomeView] ${t}`,o),e.notifyError?.(`${t}: ${o}`,o)})}var Qi=1e3;function Zn(e,t=Qi){let n=Math.max(0,Math.ceil((t-(e.end-e.start))/2));return{...e,start:Math.max(0,e.start-n),end:e.end+n}}function Ys(e,t){return t?e.map(n=>n.rank===0?{...n,sample:t.assemblyName,haplotype:void 0,refName:t.refName,start:t.start,end:t.end}:n):e}function jb({session:e,location:t,assembly:n,connectedViewId:o,tracks:s=[]}){let r=pt({views:e.views,connectedViewId:o,assemblyName:n}),a;return r?(js(e,`Could not show ${n} ${fe(t)}`,Promise.resolve(r.navToLocString(Ht(t),n))),a=r.id):a=e.addView("LinearGenomeView",{displayName:`${n} \u2014 ${fe(t)}`,init:{assembly:n,loc:Ht(t),tracks:s}}).id,a}function Yb({session:e,location:t,assembly:n,connectedViewId:o}){let s=pt({views:e.views,connectedViewId:o,assemblyName:n});return s&&e.addHighlight?.({refName:t.refName,start:t.start,end:t.end,assemblyName:n}),s!==void 0}function Vs(e,t){let n=t===void 0?void 0:e.tracks.find(o=>q(o,"trackId")===t);return n?Jn(e,n):[]}function Ub({session:e,contributors:t,trackId:n,graphTrackId:o}){let s=Vs(e,o),r=Vs(e,n),a=t.filter(p=>r.includes(p.sample)),i=a.length>=2?a:t,c={init:{views:i.map(p=>({assembly:p.sample,loc:Ht(p),...o!==void 0&&s.includes(p.sample)?{tracks:[o]}:{}})),tracks:n?i.slice(1).map(()=>[n]):[],collapseEmptyRows:!0}};e.launchView?js(e,"Could not open the synteny view",e.launchView("LinearSyntenyView",c)):e.addView("LinearSyntenyView",c)}function lt(e){let t=[];for(let n of[...e].sort((o,s)=>o.start-s.start)){let o=t.at(-1);o&&n.start<=o.end?o.end=Math.max(o.end,n.end):t.push({...n})}return t}function Qn(e){let t=[],n=new Map;for(let o of[...e].sort((s,r)=>s.start-r.start)){let s=`${o.refName} ${o.strand} ${o.name}`,r=n.get(s);if(r&&o.start<r.end)r.end=Math.max(r.end,o.end),r.exons=lt([...r.exons,...o.exons]);else{let a={...o,exons:lt(o.exons)};t.push(a),n.set(s,a)}}return t}function X(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Yt(e,t){return e.find(n=>n.trackId===t)}function ut(e){return`${e.trackId} ${e.name??""}`}var no=new Set(["BedAdapter","BedTabixAdapter","BigBedAdapter","VcfAdapter","VcfTabixAdapter"]),oo=/repeat|tandem|\bstr\b|vntr|trf|trgt|vamos|expansion|microsat/i;function Us(e,t){return t?Yt(e,t):e.filter(o=>no.has(o.adapterType)).find(o=>oo.test(ut(o)))}var zs=/^\w+=[^;]*(;\w+=[^;]*)*$/;function ec(e){let t=X(e,"name");if(!(typeof t!="string"||!zs.test(t)))return Object.fromEntries(t.split(";").map(n=>{let o=n.indexOf("=");return[n.slice(0,o),n.slice(o+1)]}))}function ce(e,t){let n=X(e,t);return n!==void 0?n:X(e,"INFO")?.[t]??ec(e)?.[t]}var Ks=["RUS","MOTIFS","RU","motifs","motif","sequence","consensus"],tc=["RUL","period","PERIOD","consensusSize","unit","unitLength"],nc=["TRID","REPID","VARID","ID","name","id"];function Ut(e,t){for(let n of t){let o=ce(e,n),s=String((Array.isArray(o)?o[0]:o)??"").split(",")[0].trim();if(s!==""&&s!==".")return s}}var qs=/^[ACGTURYSWKMBDHVN]+$/i;function oc(e){let t=Number(Ut(e,tc));if(Number.isFinite(t)&&t>0)return Math.round(t);let n=Ut(e,Ks);return n&&qs.test(n)?n.length:void 0}function Me(e){return(Array.isArray(e)?e:String(e??"").split(",")).map(n=>{let o=n===""||n===null||n===void 0?NaN:Number(n);return Number.isFinite(o)?o:void 0})}function to(e){return(Array.isArray(e)?e:String(e??"").split(",")).map(n=>{let o=String(n??"").trim();return o===""||o==="."?void 0:o})}var eo="<CNV:TR>";function rc(e){let t=to(X(e,"ALT"));if(!t.includes(eo))return;let n=Me(ce(e,"RN")),o=to(ce(e,"RUS")),s=Me(ce(e,"RUL")),r=Me(ce(e,"RUC")),a=Me(ce(e,"RB")),i=0;return t.map((c,p)=>{let u=n[p]??(c===eo?1:0),l=0,d=0;for(let f=0;f<u;f++,i++){let h=o[i],w=s[i]??(h&&qs.test(h)?h.length:void 0),g=r[i],m=a[i]??(w&&g!==void 0?Math.round(w*g):void 0);m!==void 0&&(l+=m,d++)}return c===eo&&u>0&&d===u?l:void 0})}function sc(e,t,n){let o=e?.includes("|");return(e??"").split(/[/|]/).flatMap((s,r)=>{let a=s===""?NaN:Number(s),i=a>0?t[a-1]:n;return!Number.isInteger(a)||i===void 0?[]:[{bp:i,...o?{haplotype:r+1}:{}}]})}function ac(e,t,n){let o=X(e,"samples"),s={};for(let[r,a]of Object.entries(o??{})){let i=Me(a.SD),c=Me(a.AL).flatMap((u,l)=>u!==void 0&&u>0?[i[l]===void 0?{bp:u}:{bp:u,spanningReads:i[l]}]:[]),p=c.length>0||!t?c:sc(to(a.GT)[0],t,n);p.length>0&&(s[r]=p)}return Object.keys(s).length>0?s:void 0}function ic(e,t){let n=ce(e,"start"),o=ce(e,"end"),s=Me(ce(e,"SVLEN"))[0];return t&&s!==void 0?{start:n+1,end:n+1+s}:{start:n,end:o}}function ow(e){let t=[];for(let n of e){let o=rc(n),{start:s,end:r}=ic(n,o!==void 0),a=oc(n);if(!(r>s)||a===void 0)continue;let i=ce(n,"refName"),c=Ut(n,Ks),p=Ut(n,nc);t.push({key:`${i}:${s}-${r}`,name:(p&&!zs.test(p)?p:void 0)??(c&&c.length<=12?`(${c})n`:`${i}:${(s+1).toLocaleString("en-US")}-${r.toLocaleString("en-US")}`),refName:i,start:s,end:r,unit:a,motif:c,calls:ac(n,o,r-s)})}return t.sort((n,o)=>n.start-o.start)}var mt=new Set(["Gff3TabixAdapter","Gff3Adapter","BedTabixAdapter","BedAdapter","GtfTabixAdapter","GtfAdapter","BigBedAdapter","NCListAdapter"]),cc=/gene|refseq|gencode|ensembl|annotation/i,dc=new Set(["BedTabixAdapter","BedAdapter"]);function zt(e,t){if(t)return Yt(e,t);let n=e.filter(o=>mt.has(o.adapterType)&&!oo.test(ut(o)));return n.find(o=>cc.test(ut(o)))??n.find(o=>!dc.has(o.adapterType))}function Js(e,t){let n=e.tracks?.find(o=>q(o.configuration,"trackId")===t)?.displays[0];return n?q(n.configuration,"filter")??[]:[]}var pc=new Set(["chromosome","region","contig","supercontig","scaffold"]),lc=new Set(["exon","CDS","five_prime_UTR","three_prime_UTR","UTR"]);function Zs(e,t){let n=X(e,"type");typeof n=="string"&&lc.has(n)&&t.push({start:X(e,"start"),end:X(e,"end")});let o=X(e,"subfeatures");for(let s of o??[])Zs(s,t)}function Qs(e){let t=[];for(let n of e){let o=X(n,"gene_name")??X(n,"name")??X(n,"gene")??X(n,"gene_id"),s=X(n,"start"),r=X(n,"end");if(!o||!(r>s)||pc.has(X(n,"type")))continue;let a=[];Zs(n,a),t.push({name:o,refName:X(n,"refName"),start:s,end:r,strand:X(n,"strand")??0,exons:a.length?lt(a):[{start:s,end:r}]})}return Qn(t)}var ro={paths:!1,bubbles:!1,deletions:!0,genes:!0,referenceStrip:!0,walkStrip:!1};function ea(e){let t=re(e)?e:{};return new Set(Object.keys(ro).filter(n=>t[n]??ro[n]))}function lw(e,t,n){let{[t]:o,...s}=re(e)?e:{};return n===ro[t]?s:{...s,[t]:n}}var so={depth:"depth",length:"node-length",rank:"stable-rank",position:"reference-position"},ta=Object.fromEntries(Object.entries(so).map(([e,t])=>[t,e]));function na(e){if(e==="grey"||e==="uniform")return e;if(re(e)){let{field:t,scheme:n}=e;if(t==="id")return n==="rainbow"?"rainbow":"random";if(typeof t=="string"&&t in so)return so[t]}return"auto"}function oa(e){return re(e)&&typeof e.domainMin=="number"&&typeof e.domainMax=="number"?{start:e.domainMin,end:e.domainMax}:void 0}function fw(e,t){return e==="grey"||e==="uniform"?e:e==="random"?{field:"id",scale:"categorical"}:e==="rainbow"?{field:"id",scheme:"rainbow"}:e==="reference-position"&&t?{field:"position",domainMin:t.start,domainMax:t.end}:ta[e]?{field:ta[e]}:{}}var ra=6;function ao(e){return typeof e=="number"?{width:"uniform",px:e}:re(e)?{width:e.field==="depth"?"depth":"uniform",px:typeof e.value=="number"?e.value:ra}:{width:"depth",px:ra}}function bw(e,t){return e==="depth"?{field:"depth",value:t}:t}function uc(e,t,n){let o=ho(e,t);return o?cn(o,n):void 0}function sa(e){try{return e()}catch{return}}function aa(e){let t=new Map;for(let n of e.nodes)t.set(n.id,n);return t}function ia(e,t,n){return t&&n?pn({nodeId:e,nodeById:t,neighbors:n}):void 0}var ca=es.views(e=>({get grammar(){return{}},get hasPendingSource(){return!1},get canRetryLoad(){return!1},get sourceTrack(){return sa(()=>co(e).configuration)},get containingView(){return sa(()=>Zt(e))}})).views(e=>{let t=r=>go(r,{equals:(a,i)=>JSON.stringify(a)===JSON.stringify(i)}),n=t(()=>oa(e.grammar.color)),o=t(()=>At(e.grammar.facet)),s=t(()=>{let r=or(e.grammar.facet);return r&&r.field!=="walk"&&r.field!=="sample"?r:void 0});return{get chosenLayoutMode(){return e.grammar.layoutMode??"force"},get chosenColorScheme(){return na(e.grammar.color)},get statedColorDomain(){return n.get()},get chosenHover(){return e.grammar.hover??"nodes"},get nodeWidth(){return ao(e.grammar.size).width},get contigThickness(){return ao(e.grammar.size).px},get layerSet(){return ea(e.grammar.layers)},get drawPaths(){return this.layerSet.has("paths")},get showBubbles(){return this.layerSet.has("bubbles")},get showDeletionEdges(){return this.layerSet.has("deletions")},get showGenes(){return this.layerSet.has("genes")},get showReferenceStrip(){return this.layerSet.has("referenceStrip")},get walkStrip(){return this.layerSet.has("walkStrip")},get facetSetting(){return o.get()},get walkRowGroupBy(){return s.get()},get walkRowSamples(){let r=e.grammar.rows?.kept;return Array.isArray(r)?r:void 0},get hoverLightsEverything(){return this.chosenHover==="everything"},get litNode(){return this.chosenHover==="off"?null:e.hoveredNode}}}).views(e=>({get paneWidth(){return Zt(e).width},get paneMeasured(){return!0},get drawnGraph(){return e.layoutResult?.tubeMap?.graph??e.graph}})).views(e=>({get nodeById(){return e.drawnGraph&&aa(e.drawnGraph)},get nodeLengths(){let t=new Map;for(let n of e.drawnGraph?.nodes??[])t.set(n.id,n.length);return t},get nodeCount(){return e.graph?.nodes.length??0},get edgeCount(){return e.graph?.edges.length??0},get pathCount(){return e.graph?.paths?.length??0},get hasGraph(){return e.graph!==void 0},get geometryPainted(){return Zr(e)},get showLoading(){return e.error===void 0&&(e.isLoading||e.hasPendingSource||e.graph!==void 0&&!this.geometryPainted)},get canCancelLoad(){return e.isLoading&&!e.layoutResult},get usesLayoutEngine(){return e.graph?Gn(e.chosenLayoutMode,e.graph):!1},get anchorPaths(){return e.graph?.anchorPaths??[]},get walkChoices(){let t=e.graph?.paths;return t?.length?We(t):[]},get effectiveDrawPaths(){return e.drawPaths&&yt(e.graph?.paths?.length??0)},get activeReferencePath(){return e.graph?.referencePath},get rampDomain(){let t=e.openBubbles.at(-1);return t&&!t.offReference&&t.end>t.start?{start:t.start,end:t.end}:e.statedColorDomain??e.graphRegion},get drawnReferenceRamp(){let t=e.drawnGraph;return t?Xe(t,this.rampDomain):void 0},get walkRamp(){return e.walkLayers.some(t=>t.color?.field==="reference")?this.drawnReferenceRamp:void 0},get modeDrawsNodes(){return Q(e.chosenLayoutMode).drawsNodes},get liftedWalkLayers(){return e.walkLayers.length>0||!this.modeDrawsNodes?e.walkLayers:e.hoveredRowWalks.map(t=>({walk:t}))},get walkLift(){let{graph:t}=e,n=this.liftedWalkLayers;return t&&!e.walkCut&&n.length>0&&!e.layoutResult?.tubeMap?st(t,n,this.walkRamp):void 0},get facetPanels(){let{graph:t}=e,n=this.walkLift;return e.facetSetting.field!==""&&this.modeDrawsNodes&&t&&n&&e.walkLayers.length>1&&n.walks.length>1?at(t,n,e.walkLayers,this.walkRamp):void 0},get drawnWalks(){return this.facetPanels?.map(t=>t.walks[0])??this.walkLift?.walks??[]},get liftsWalks(){return!Kr.has(e.chosenLayoutMode)},get walkReference(){let t=this.walkLift?.referenceDomain;return t&&{...t,name:e.graphRegion?.refName}},get walkLabels(){return kt(this.walkChoices)},walkLabel(t){return this.walkLabels.get(t)??t},get liftPaintsOffReference(){for(let t of this.walkLift?.walks??[])if(t.encoding.field!=="walk"){for(let n of t.colors.values())if(n===zo)return!0}return!1},get liftedWalksLabel(){let t=this.walkLift?.walks??[];return t.length===1?this.walkLabel(t[0].name):"these walks"},get effectiveColorScheme(){return e.layoutResult?.tubeMap&&(this.tubeMapReads||e.chosenColorScheme==="auto")?"uniform":it(e.chosenColorScheme,e.graph)},get tubeMapReads(){let t=e.layoutResult;return!t?.tubeMapPanels&&(t?.tubeMap?.layout.reads.length??0)>0},get colorSchemeLock(){return this.walkLift?{value:"By walk",why:"Each highlighted haplotype colours its own lane: set it under Haplotypes, Color highlighted..."}:this.tubeMapReads?{value:"By strand",why:"Reads take the reds and blues, so the tube map leaves its nodes clear"}:void 0},get nodePositions(){return e.layoutResult?.nodePositions},get labelsNodeSizes(){return!e.layoutResult?.tubeMap&&!this.walkLift},get alleleDeletions(){return e.layoutResult?.alleleDeletions??[]},get deletionRoutes(){return e.layoutResult?.deletionRoutes},get stranded(){return e.layoutResult?.stranded},get pixelRows(){return e.layoutResult?.pixelRows??!1},get zoomPercent(){return`${(e.scale*100).toFixed(1)}%`},get isDefaultViewport(){return e.scale===1&&e.translateX===0&&e.translateY===0}})).views(e=>({get derivedBubbles(){return e.graph?Vt(e.graph):[]},get openBubbleInsides(){let{graph:t}=e;return t?e.openBubbles.map(n=>Vt(dt(t,xe(n)),n).filter(o=>!o.covering)):[]},get openBubble(){return e.openBubbles.at(-1)},get openBubbleFocus(){let t=this.openBubble,{graph:n}=e;if(!t||!n)return;let o=new Set(xe(t)),s=new Set(n.nodes.filter(a=>o.has(a.name)).map(a=>a.id)),r=new Set;return n.edges.forEach((a,i)=>{s.has(a.from)&&s.has(a.to)&&r.add(i)}),{walks:[],nodeIds:s,edgeIndexes:r,names:new Set}},bubbleIsOpen(t){return e.openBubbles.some(n=>Et(n,t))},bubbleFaded({bubble:t,nodeIds:n}){let o=e.walkLift,s=this.openBubbleFocus;return o?!n.some(r=>o.nodeIds.has(r)):!!s&&!this.bubbleIsOpen(t)&&!n.every(r=>s.nodeIds.has(r))}})).views(e=>({get bubbles(){let t=e.indexBubbles?.length?e.indexBubbles:e.derivedBubbles,n=new Set(t.map(It));return[...t,...e.openBubbleInsides.flat().filter(o=>!n.has(It(o))&&n.add(It(o)))]},get foldNote(){let t=e.foldedBelowBp;return t===void 0?void 0:`variants under ${Io(t)} folded into the reference`}})).views(e=>({get cutHaplotypes(){},get sourceGfaLocation(){},get sourceAdapter(){let t=e.sourceTrack;return t?ts(e,t):void 0},get sourceTrackId(){let t=e.sourceTrack;return t?q(t,"trackId"):void 0},get sessionTracks(){let t=ne(e);return t.tracks.map(n=>({trackId:n.trackId,name:q(n,"name"),adapterType:q(n,"adapter").type,assemblies:Jn(t,n)}))}})).views(e=>({get assemblyTrackChoices(){let t=e.graphRegion,n=t&&qn(ne(e),t.assemblyName);return n?e.sessionTracks.filter(o=>o.assemblies.includes(n)):[]}})).views(e=>({get geneTrackChoices(){return e.assemblyTrackChoices.filter(t=>mt.has(t.adapterType))},get repeatTrackChoices(){return e.assemblyTrackChoices.filter(t=>no.has(t.adapterType))},get repeatChoices(){return e.repeatArrays??[]}})).views(e=>({get repeatTrack(){return Us(e.repeatTrackChoices,e.repeatTrackId)},get geneTrack(){return zt(e.geneTrackChoices,e.geneTrackId)},get selectedRepeat(){return e.repeatChoices.find(t=>t.key===e.repeatKey)},get backbone(){return e.graph?nn(e.graph):void 0},get cutWalkRows(){let t=e.walkCut?.walkRowRuns;return t?cn(t):e.graph?Ie(e.graph,e.graphRegion):void 0},assemblySpellings(t){let{assemblyManager:n}=ne(e),o=n.has(t)?n.get(t):void 0,s=e.sourceAdapter?.assemblyNameToPanSN??{},r=[t,...o?[o.name,...o.aliases]:[]];return{name:t,aliases:[...r,...r.flatMap(a=>s[a]??[])]}},get drawsLoadedReference(){let t=e.graph;return t?.anchoredBy==="tags"||t?.referencePath!==void 0&&t.referencePath===e.loadedReferencePath}})).views(e=>({get geneAssembly(){let t=e.graphRegion;return t?e.assemblySpellings(t.assemblyName):void 0},get geneLaneFilter(){let t=e.containingView;if(!t)return;let n=Js(t,e.geneTrack?.trackId);return n.length?new Xs({filters:n,jexl:po(e).pluginManager.jexl}):void 0},get geneFeatures(){let t=e.geneTrackFeatures,n=this.geneLaneFilter;return t?Qs(n?t.filter(o=>n.passes(o)):t):void 0},get backboneGenes(){let{backbone:t}=e,{geneAssembly:n,geneFeatures:o}=this,s=e.drawsLoadedReference||n!==void 0&&rn(t,[n])!==void 0;return t&&o&&s?sn(o,t):void 0}})).views(e=>({get nodeNeighbors(){return e.drawnGraph?pe(e.drawnGraph):void 0},get nodeInk(){return xt(e.drawnGraph,e.nodeById,e.contigThickness,e.nodeWidth)},get allDeletions(){return e.graph&&this.drawsNodes?we(e.graph):[]},get cohortWalkRows(){if(e.chosenLayoutMode!=="walkrows"||!e.graph)return;let t=e.selectedRepeat,n=e.walkCut,o=t?n?uc(n,t,t.unit):Ie(e.graph,t,t.unit):e.cutWalkRows;if(!o)return;let[s,...r]=Nr([o.reference,...o.rows],t?.calls);return{...o,reference:s,rows:r}},get walkRowSampleChoices(){let t=this.cohortWalkRows?.rows??[];return{samples:[...new Set(t.map(n=>n.sample))].sort(),disagreeing:[...new Set(t.filter(n=>n.call?.agrees===!1).map(n=>n.sample))]}},get walkRowSamplesTsv(){let t=e.sourceAdapter?.samplesTsvLocation;return t&&fo(t)?t:void 0},get walkRowGroupFields(){return nr(e.walkRowSampleTable)},get tubeMapColoring(){let t=e.tubeMapColorBy,n=e.walkRowSampleTable;if(!t||!n||!this.walkRowGroupFields.includes(t))return;let o=dr(t,n),s=(e.graph?.paths??[]).map(r=>W(r.name).name).filter(r=>r!==e.graph?.referencePath);return{field:t,valueOf:o,palette:ir(s.map(o)),unvalued:s.some(r=>o(r)==="")}},get tableGroupBy(){let t=e.walkRowGroupBy,n=e.walkRowSampleTable;return t&&n&&this.walkRowGroupFields.includes(t.field)?{groupBy:t,table:n}:void 0},get tubeMapPanelSplit(){let{field:t,domain:n}=e.facetSetting,o=this.tableGroupBy;return t!==""?{by:t,domain:n}:o?{by:"column",...o.groupBy,table:o.table}:void 0},get keptCohortRows(){let t=this.cohortWalkRows;return t&&Qe(t.rows,e.walkRowSamples)},get walkRowGroups(){let t=this.keptCohortRows,n=this.tableGroupBy;return t&&n?rr(t,n.table,n.groupBy):void 0},get walkRowBars(){let t=this.cohortWalkRows,n=this.keptCohortRows;return t&&n?{...t,rows:this.walkRowGroups?.rows??n}:void 0},get drawsNodes(){return Q(e.drawnLayoutMode??e.chosenLayoutMode).drawsNodes},get genePins(){Je(e.positionsVersion);let t=e.layoutResult?.nodePositions;return e.showGenes&&this.drawsNodes&&e.graph&&e.backboneGenes&&t?ot(e.graph,e.backboneGenes,t):[]},get bubbleHalos(){Je(e.positionsVersion);let t=e.layoutResult?.nodePositions;return!e.showBubbles||!this.drawsNodes||!e.graph||!t?[]:Xn(e.graph,e.bubbles,t,e.repeatArrays)},get referenceRamp(){return e.effectiveColorScheme==="reference-position"?e.drawnReferenceRamp:void 0},get assemblyNames(){let t=e.graphRegion;return t?[t.assemblyName]:[]},get axisScale(){return qe(e.scale,e.pixelRows)},get scaleX(){return this.axisScale.scaleX},get scaleY(){return this.axisScale.scaleY}})).views(e=>({get screenTransform(){return{scaleX:e.scaleX,scaleY:e.scaleY,translateX:e.translateX,translateY:e.translateY}},toScreen(t){return{x:t.x*e.scaleX+e.translateX,y:t.y*e.scaleY+e.translateY}},get deletionDrawing(){return e.graph?ye(e.graph,e.allDeletions,e.showDeletionEdges):void 0},get deletions(){return this.deletionDrawing?.shown??[]},get deletionEdgeIndexes(){return this.deletionDrawing?.bypassed},get hiddenEdgeIndexes(){return this.deletionDrawing?.hidden},get referenceRampDomain(){let t=e.referenceRamp;return t?{start:t.start,end:t.start+t.span}:void 0},get referenceRampOffKeys(){let t=e.referenceRamp,n=e.layoutResult,o=n?.tubeMap?n.nodePositions:void 0,s=!1,r=!1;if(t&&e.drawnGraph)for(let a of e.drawnGraph.nodes)o&&!o[a.id]||(t.midpoints.has(a.id)?a.stable&&a.stable.rank>0&&(s=!0):r=!0);return{offReference:s,unplaced:r}},get tubeMapNodeColors(){let t=e.drawnGraph;return e.layoutResult?.tubeMap&&t?Kn(t,e.effectiveColorScheme,e.referenceRamp):void 0},get tubeColorKind(){let t=e.layoutResult,n=e.drawnGraph?.paths??[],o=e.tubeMapReads;return t?.tubeMap?e.tubeMapColoring&&!o?"value":t.tubeMapPanels?"role":this.tubeMapNodeColors?"tinted":!o&&(!yt(n.length)||n.some(s=>s.members))?"role":"path":void 0},tubeColorsOf(t,n){let o=t.paths??[],s=this.tubeColorKind,r=e.tubeMapColoring;return s==="value"&&r?cr(o,t.referencePath,r.valueOf,r.palette):s==="tinted"?kn(o,t.referencePath,ar):s==="role"?kn(o,t.referencePath):n},fadeUnhovered(t,n,o){let s=new Set(e.hoveredRowWalks);return s.size>0?t.map((r,a)=>{let i=n[a]?.name??"";return s.has(i)||o!==void 0&&W(i).name===o?r:St}):t},get tubeMapTubeColors(){let t=e.layoutResult?.tubeMap,n=e.drawnGraph;return t&&n?this.fadeUnhovered(this.tubeColorsOf(n,t.pathColors),n.paths??[]):void 0},nodeSpan(t){return ia(t,e.nodeById,e.nodeNeighbors)},get hoverDrawing(){let t=e.hoveredPanel;return(t===null?void 0:e.layoutResult?.tubeMapPanels?.[t]?.result.tubeMap)??e.layoutResult?.tubeMap},get hoverGraph(){return this.hoverDrawing?.graph??e.drawnGraph},get hoverNodeById(){let t=this.hoverGraph;return t===e.drawnGraph?e.nodeById:t&&aa(t)},get hoverNeighbors(){let t=this.hoverGraph;return t===e.drawnGraph?e.nodeNeighbors:t&&pe(t)}})).views(e=>({get pathLegend(){let t=e.drawnGraph?.paths;return(e.layoutResult?.tubeMap?e.tubeColorKind==="path":e.drawPaths)&&t&&yt(t.length)&&!t.some(o=>o.members)?We(t,e.tubeMapTubeColors):[]},get hoveredSpan(){let t=e.hoveredNode,n=e.hoveredBubble;return t!==null?ia(t,e.hoverNodeById,e.hoverNeighbors):n&&!n.offReference?{start:n.start,end:n.end}:void 0},get hoverHighlight(){let t=e.graphRegion,n=this.hoveredSpan;return t&&n&&e.chosenHover!=="off"?{refName:t.refName,assemblyName:t.assemblyName,...n}:void 0}}));var da=ca.views(e=>({get host(){let t=e.containingView;return Ms(t)?t:void 0}})).views(e=>({get pairedViewId(){return e.host?.id??e.connectedViewId}})).views(e=>({get contributingAssemblies(){let t=e.graph,n=t?de(t):[];return t?Rs(t,{maxGap:n.length>0?tn(n):1/0}):[]}})).views(e=>({get assemblyResolver(){let{assemblyManager:t}=ne(e),n=e.sourceAdapter?.assemblyNameToPanSN,o=new Map(Object.entries(n??{}).map(([r,a])=>[a,r])),s=r=>r!==void 0&&t.has(r)?t.get(r)?.name??r:void 0;return r=>s(o.get(r))??s(r)},get geneTracksByAssembly(){let t=new Map;for(let n of e.sessionTracks)if(mt.has(n.adapterType))for(let o of n.assemblies)t.set(o,[...t.get(o)??[],n]);return new Map([...t].flatMap(([n,o])=>{let s=zt(o,"");return s?[[n,s]]:[]}))}})).views(e=>({get launchableAssemblies(){return vs(Ys(e.contributingAssemblies,e.graphRegion),e.assemblyResolver)},get canHighlightInLinearView(){let t=e.graphRegion;return t!==void 0&&pt({views:[...ne(e).views],connectedViewId:e.pairedViewId,assemblyName:t.assemblyName})!==void 0},nodeLaunchTargets(t){let n=e.nodeById?.get(t),o=n?xs(n):void 0,s=o?nt(e.assemblyResolver,o):void 0,r=e.graphRegion,a=r?e.nodeSpan(t):void 0,i=r&&a?{sample:r.assemblyName,haplotype:void 0,refName:r.refName,...a}:void 0;return{own:o&&s?{location:Zn(o),assembly:s}:void 0,reference:r&&i?{location:Zn(i),assembly:r.assemblyName}:void 0,highlight:r&&i?{location:i,assembly:r.assemblyName}:void 0}}}));var pa=da.views(e=>({get walkStripShown(){return On({walkStrip:e.walkStrip,mode:{drawsNodes:e.modeDrawsNodes},drawsPicture:!!e.layoutResult?.tubeMap||!!e.walkRowBars,walks:e.graph?.paths?.length??0,host:!!e.host})},get walkStripRows(){let t=this.walkStripShown?e.cutWalkRows:void 0;return t?{...t,rows:Qe(t.rows,e.walkRowSamples)}:void 0},get walkStripFrame(){let t=this.walkStripRows;if(t)return tt(t,{width:e.paneWidth})},get cutsWholeWalks(){return Bn(Q(e.chosenLayoutMode),{walkStrip:e.walkStrip,host:!!e.host})},get walkStripMarks(){let t=this.walkStripRows,n=e.hoveredNode??e.selectedNode,o=n===null?void 0:e.nodeById?.get(n);return t&&o&&e.graph?Cn(e.graph,[t.reference,...t.rows],o):[]},rowLocation(t,n){let o={sample:t.sample,haplotype:t.haplotype===void 0?void 0:`${t.sample}#${t.haplotype}`};return{...o,assembly:nt(e.assemblyResolver,o),span:{refName:n.contig,...Ho(n,t.bp)}}},get walkStripLocator(){let t=e.stripHover?e.hoveredNode:null;return t===null?void 0:Gt(e.nodePositions?.[t],e.toScreen)}})).views(e=>({get walkGeneReads(){let t=e.walkRowBars??e.walkStripRows;if(!t||!e.showGenes)return;let n=[],o=0,s=0;for(let r of t.rows){if(!r.axis){s++;continue}let{assembly:a,span:i}=e.rowLocation(r,r.axis),c=a?e.geneTracksByAssembly.get(a):void 0;if(!a||!c){o++;continue}n.push({row:r.name,trackId:c.trackId,region:{assemblyName:a,...i}})}return{reads:n.slice(0,An),gaps:{untracked:o,unplaced:s,unread:Math.max(0,n.length-An)}}},get walkRowGeneGaps(){return this.walkGeneReads?.gaps},walkRowLaunchTarget(t,n=e.walkRowBars){let o=n?[n.reference,...n.rows][t]:void 0;if(!o?.axis)return;let{sample:s,haplotype:r,assembly:a,span:i}=e.rowLocation(o,o.axis);return{label:o.label,assembly:t===0?e.graphRegion?.assemblyName:a,location:{sample:s,haplotype:r,...i}}},get walkRowGenes(){let t=e.walkRowBars??e.walkStripRows;if(!t||!e.showGenes)return;let n=new Map(e.walkGeneFeatures??[]);return e.geneFeatures&&n.set(t.reference.name,e.geneFeatures),n.size?Xo([t.reference,...t.rows],n):void 0}}));var la=pa.views(e=>({get xIsReferenceBp(){return e.layoutResult?.referenceAxis===!0&&Q(e.drawnLayoutMode??e.chosenLayoutMode).cutMargins}})).views(e=>({get hostPlacesX(){let{host:t,graphRegion:n}=e;return t!==void 0&&t.initialized&&n!==void 0&&e.xIsReferenceBp&&!t.dynamicBlocks.contentBlocks.some(o=>o.refName===n.refName&&o.reversed)}})).views(e=>({get hostBpFrame(){let{host:t,graphRegion:n}=e;return t?.initialized&&n?Ns(t,n):void 0}})).views(e=>({get hostFrame(){return e.hostPlacesX?e.hostBpFrame:void 0},get tubeMapPicture(){let t=e.layoutResult?.tubeMap;return t?er(t):void 0},get tubeMapReference(){let t=e.layoutResult?.tubeMap;return t?Zo(t):void 0},get tubeMapDeviations(){let t=e.layoutResult?.tubeMap;return t?.coarse?Qo(t,t.coarse.deviations):[]},get tubeMapConnectedBoxes(){let t=this.tubeMapReference,{layoutResult:n}=e;return t&&!n?.referenceAxis&&!n?.tubeMapPanels?[...t.values()].flat():void 0}})).views(e=>({get tubeMapGenes(){let t=e.tubeMapReference;return e.showGenes&&!e.host&&t&&e.backboneGenes&&!e.layoutResult?.tubeMapPanels?kr(t,e.backboneGenes):[]},get referenceStripApplies(){return!!e.host?.initialized&&!!e.layoutResult&&e.drawsNodes&&!e.hostPlacesX&&!e.facetPanels}})).views(e=>({get referenceStripBlocks(){let{graph:t}=e;if(!e.showReferenceStrip||!e.referenceStripApplies||!t)return[];let n=vr(t,{colorScheme:e.effectiveColorScheme,referenceRamp:e.referenceRamp,walks:e.walkLift?.walks}),o=e.walkLift?void 0:e.openBubbleFocus;return o?n.map(s=>o.nodeIds.has(s.node)?s:{...s,colors:[St],faded:!0}):n}})).views(e=>({get referenceStripShown(){return e.referenceStripBlocks.length>0&&e.hostBpFrame!==void 0},get referenceStripOverhangs(){let t=e.hostBpFrame;if(!t||e.referenceStripBlocks.length===0)return!1;let{left:n,right:o}=Mr(e.referenceStripBlocks,t,e.paneWidth);return n>0||o>0},get referenceStripFaded(){return e.referenceStripBlocks.some(t=>t.faded)}})).views(e=>({get referenceStripLit(){if(!e.referenceStripShown)return;let t=e.hoveredNode===null?e.hoveredBubble:null;if(t&&!t.offReference){let s=e.bubbleHalos.find(r=>Et(r.bubble,t));return{start:t.start,end:t.end,anchor:s?e.toScreen(s.labelAt):void 0}}let n=e.hoveredNode??e.selectedNode,o=n===null?void 0:e.nodeSpan(n);return o&&n!==null?{...o,anchor:Gt(e.nodePositions?.[n],e.toScreen)}:void 0},referenceStripNodeAt(t,n){let o=e.hostBpFrame;return e.referenceStripShown&&o?Lr(e.referenceStripBlocks,o,t,n):void 0},get referenceStripZonePx(){return e.referenceStripShown?Rr:0}}));var Qy=3e3,ek=350,tk=34;function mc(e){let t=[0];for(let n=1;n<e.length;n++)t.push(t[n-1]+Math.hypot(e[n].x-e[n-1].x,e[n].y-e[n-1].y));return t}function fc(e,t){if(e.length===1||t===1)return Array.from({length:t},()=>({...e[0]}));let n=mc(e),o=n.at(-1),s=[],r=1;for(let a=0;a<t;a++){let i=o*a/(t-1);for(;r<e.length-1&&n[r]<i;)r++;let c=n[r]-n[r-1],p=c>0?(i-n[r-1])/c:0,u=e[r-1],l=e[r];s.push({x:u.x+(l.x-u.x)*p,y:u.y+(l.y-u.y)*p})}return s}var hc=400,ua=1.8,gc=.1;function nk(e,t,n,o,s){let r=b=>({x:(b.x*t.scaleX+t.translateX-o.translateX)/o.scaleX,y:(b.y*t.scaleY+t.translateY-o.translateY)/o.scaleY}),a={};for(let[b,S]of Object.entries(n)){let x=e[b];x?.length&&S.length&&(a[b]=fc(x.map(r),S.length))}let i=new Map,c=(b,S)=>{let x=i.get(b);x?x.push(S):i.set(b,[S])};for(let b of s){let{from:S,to:x}=b;if(S!==x&&n[S]?.length&&n[x]?.length){let M=be(b);c(S,{id:x,side:M.to}),c(x,{id:S,side:M.from})}}let p=new Map,u=b=>p.get(b.id)??(b.side==="start"?a[b.id][0]:a[b.id].at(-1)),l=Object.keys(a),d=[];for(let b of l)for(let S of i.get(b)??[]){if(a[S.id]||p.has(S.id))continue;let x=i.get(S.id).find(M=>M.id===b);p.set(S.id,{...u(x)}),l.push(S.id),d.push(S.id)}let f=new Map(d.map((b,S)=>[b,S])),h=new Float64Array(d.map(b=>p.get(b).x)),w=new Float64Array(d.map(b=>p.get(b).y)),g=new Float64Array(d.length),m=new Float64Array(d.length),y=d.map((b,S)=>i.get(b).flatMap(x=>{let M=f.get(x.id);if(M===void 0){let P=u(x);return g[S]+=P.x,m[S]+=P.y,[]}return[M]})),k=d.map(b=>i.get(b).length);for(let b=0;b<hc;b++){let S=0;for(let x=0;x<d.length;x++){let M=g[x],P=m[x];for(let C of y[x])M+=h[C],P+=w[C];let F=ua*(M/k[x]-h[x]),B=ua*(P/k[x]-w[x]);S=Math.max(S,Math.abs(F*o.scaleX)+Math.abs(B*o.scaleY)),h[x]+=F,w[x]+=B}if(S<gc)break}d.forEach((b,S)=>{a[b]=n[b].map(()=>({x:h[S],y:w[S]}))});for(let[b,S]of Object.entries(n))a[b]??=S.map(x=>({...x}));return a}function bc(e,t){let n=0,o=1/0;return e.forEach((s,r)=>{let a=(s.x-t.x)**2+(s.y-t.y)**2;a<o&&(o=a,n=r)}),n}function ok(e,t,n,o){let s=(r,a)=>{let i=n[r],c=o[r];if(!i||!c||c.length===0)return{x:0,y:0};let p=bc(c,a);return{x:i[p].x-c[p].x,y:i[p].y-c[p].y}};return Object.fromEntries(Object.entries(e).map(([r,a])=>{let i=t[Number(r)],c=s(i?.from??"",a[0]),p=s(i?.to??"",a.at(-1));return[r,a.map((u,l)=>{let d=a.length>1?l/(a.length-1):0;return{x:u.x+c.x+(p.x-c.x)*d,y:u.y+c.y+(p.y-c.y)*d}})]}))}function ma(e,t,{ids:n,alpha:o}){let s=(r,a)=>{for(let i=0;a&&i<a.count;i++){let c=r[a.start+i];c.color=_o(c.color,o)}};for(let r of n)s(e.nodeStrokes,e.nodeStrokeRuns.get(r));t.forEach(({from:r,to:a},i)=>{(n.has(r)||n.has(a))&&(s(e.edgeCurves,e.edgeCurveRuns.get(i)),s(e.arrows,e.arrowRuns.get(i)))})}function rk(e){return e<.5?4*e*e*e:1-(-2*e+2)**3/2}function sk(e,t,n,o){for(let[s,r]of Object.entries(e)){let a=t[s],i=n[s];!a||!i||r.forEach((c,p)=>{c.x=o===1?i[p].x:a[p].x+(i[p].x-a[p].x)*o,c.y=o===1?i[p].y:a[p].y+(i[p].y-a[p].y)*o})}}var wc=8,yc=19,fa=je+yc,kc=48;function xc(e,t,n){if(!(!e||!t))return vt(e.rowPx,e.barPx)?n:{untracked:0,unread:0,...n,crowded:!0}}var Pk=la.views(e=>({get paneCeiling(){return Math.max(_t,e.paneHeight??Yr)},get fitRoom(){return e.host?this.canvasHeight:this.paneCeiling},get walkRowPitch(){let t=e.walkRowBars;if(!t)return;let n=this.fitRoom,o=(e.walkRowGroups?.sections.length??0)*tr;return Mt(t.rows.length+1,n-this.fitPadTopBase-H-o)},get walkRowPlacement(){let t=this.walkRowPitch;return t?sr(e.walkRowGroups?.sections??[],t.rowPx):void 0},get walkRowGeneKey(){return xc(this.walkRowPitch,!!e.walkRowGenes?.size,e.walkRowGeneGaps)},get drawnRowLabels(){let t=this.walkRowPlacement,n=Oe(e.walkRowBars,e.layoutResult,this.walkRowPitch);return e.walkRowBars&&t?n.map((o,s)=>({...o,y:t.rowY(s)})):n},get visibleRowLabels(){return this.drawnRowLabels.flatMap(({label:t,y:n})=>{let o=e.toScreen({x:0,y:n}).y;return o>=0&&o<=this.canvasHeight?[{label:t,y:n,top:o}]:[]})},get fitPadLeft(){return Math.max(H,...this.drawnRowLabels.map(t=>Eo(t.label,0).x1+6))},get layoutBounds(){let t=e.layoutResult,n=e.walkRowBars,o=n&&t?.extent?Ge(n,this.walkRowPitch):void 0;return t?Ke(t,{region:e.graphRegion,extent:o&&{...o,maxY:o.maxY+(this.walkRowPlacement?.headersPx??0)}}):void 0},get hoveredWalkRowText(){let t=e.walkRowBars,n=e.hoveredWalkRow;if(!t||n===null||this.walkRowPitch?.readouts!==!1)return;let o=t.reference.name===n,s=o?t.reference:t.rows.find(r=>r.name===n);return s?{label:s.label,readout:Do(s,o?void 0:t.reference,t.unit,s.call)}:void 0},walkRowAt(t,n){let o=e.walkRowBars,s=this.walkRowPitch,r=this.walkRowPlacement;if(!o||!s||!r)return;let a=r.rowAt((n-e.translateY)/e.scaleY,o.rows.length+1),i=[o.reference,...o.rows][a],c=r.rowY(a)*e.scaleY+e.translateY,p=(t-e.translateX)/e.scaleX-o.origin;return i&&Math.abs(n-c)<=s.barPx/2+2&&p>=0&&p<=i.bp?a:void 0},get fitPadTopBase(){let t=Sr(e.tubeMapGenes);return H+Math.max(0,t-1)*xr+e.referenceStripZonePx},get legendRoom(){let t=this.layoutBounds,{width:n,height:o}=e.legendSize;if(!t||t.w<=0||n===0||e.facetPanels||e.tubeMapReads)return;if(e.hostPlacesX)return"top";let s=this.fitPadTopBase,r=this.fitRoom,a=u=>(e.paneWidth-this.fitPadLeft-u)/t.w,i=u=>e.pixelRows?t.h+u+H<=r?1/0:0:(r-u-H)/t.h,c=Math.min(a(n+2*ue),i(s));return Math.min(a(H),i(s+o+ue))>=c?"top":"right"},get fitPadTop(){return this.fitPadTopBase+(this.legendRoom==="top"?e.legendSize.height+ue:0)},get fitPadRight(){return this.legendRoom==="right"?Math.max(H,e.legendSize.width+2*ue):H},get minFitScale(){let t=this.layoutBounds,n=e.layoutResult,o=n?.tubeMap?.layout.tracks[0]?.width;return t&&t.h>0&&o&&!n.referenceAxis?Math.min(zr/o,(this.paneCeiling-this.fitPadTop-H)/t.h):0},get facetSpec(){let{field:t,domain:n,columns:o}=e.facetSetting;return t===""?void 0:n.length===0&&o===void 0?t:{field:t,domain:[...n],...o===void 0?{}:{columns:o}}},get facetPlacement(){let t=e.facetPanels,{field:n,domain:o}=e.facetSetting;return t?Pt(t.map(s=>s.walks[0].name),e.hostPlacesX||n===""?"walk":n,o):void 0},facetGridIn(t){let n=this.facetPlacement,o=this.layoutBounds;return n&&o&&o.w>0?Nt({count:n.count,bounds:o,pixelRows:e.pixelRows,width:e.paneWidth,room:t,columns:e.hostPlacesX?1:n.columns??e.facetSetting.columns}):void 0},get facetGrid(){return this.facetGridIn(this.fitRoom-fa)},get tooltipRightPx(){let{width:t,height:n}=e.legendSize,o=ue+e.referenceStripZonePx+n;return!e.facetPanels&&t>0&&o>this.canvasHeight-kc?t+2*ue:wc},get canvasHeight(){let t=this.layoutBounds,n=this.paneCeiling;if(!t)return n;let o=this.facetGrid;if(o)return Math.max(_t,o.total+fa);let s=Math.max(_t,e.legendSize.height+2*ue+e.referenceStripZonePx),r=this.fitPads,a=r.top+r.bottom;if(e.pixelRows)return Math.min(n,Math.max(s,t.h+a));let i=e.paneWidth-r.left-r.right;return t.w>0&&i>0?Math.min(n,Math.max(s,t.h*Math.max(i/t.w,this.minFitScale)+a)):n},get viewBox(){let t=this.facetGrid;return t?{width:t.width,height:t.height}:{width:e.paneWidth,height:this.canvasHeight}},get fitPads(){return this.facetGrid?{left:ae,top:ae,right:ae,bottom:ae}:{left:this.fitPadLeft,top:this.fitPadTop,right:this.fitPadRight,bottom:H}},get usableHeight(){let{top:t,bottom:n}=this.fitPads;return this.viewBox.height-t-n},get fittedTransform(){let t=this.layoutBounds,{width:n,height:o}=this.viewBox,s=this.fitPads;return t?ze(t,n,o,e.pixelRows,{minScale:this.facetGrid?0:this.minFitScale,padLeft:s.left,padTop:s.top,padRight:s.right,padBottom:s.bottom}):void 0}})).views(e=>({viewportToBuild(){return Nn(Qr(e),Jr)},applySelection(t){let n=e.selectedNode;t.setNodeHighlights(n===null?new Map:new Map([[n,qr]]))},get hoverLayerNode(){let{litNode:t,selectedNode:n}=e;return t===n?null:t},get paintTransform(){let t=Jo();return{scaleX:e.scaleX*t,scaleY:e.scaleY*t,translateX:e.translateX*t,translateY:e.translateY*t,dpr:t}}})).views(e=>({paint(t){t.updateTransform(e.paintTransform),t.render(e.referenceStripShown?[0,0,0,0]:Ur)}})).views(e=>({buildDrawing(t,n){let{graph:o,nodeById:s,layoutResult:r,deletionDrawing:a}=e;if(!o||!s||!r||!a)return;Je(e.viewportDirty,e.positionsVersion);let i=dn(()=>e.viewportToBuild()),c=Rt({...rt(r,a,{drawsRows:!!e.walkRowBars}),graph:o,nodeById:s,colorScheme:e.effectiveColorScheme,contigThickness:e.contigThickness,connectorThickness:e.connectorThickness,drawPaths:n,nodeWidth:e.nodeWidth,highlight:t,axis:dn(()=>e.axisScale),linearLayout:e.linearLayout,viewportBounds:i,referenceRamp:e.referenceRamp,version:e.positionsVersion}),p=e.morphEntering;return p?.layout===r&&ma(c,o.edges,p),{batch:c,viewportBounds:i}},get overlayLabels(){return gr(e)},hoveredOn(t){let n=e.hoveredNode,o=n?e.nodeById?.get(n):void 0;return o?yr(t,o.id,o.length)??"not on this walk":void 0},figureSpec(){let t=e.graphRegion,n=e.sourceAdapter,o=n?.assemblyNameToPanSN,s=t&&`${t.refName}:${t.start}-${t.end}`,r=Ee(e.sourceGfaLocation),a=n?.type==="GbzBaseSyntenyAdapter"?Ee(n.gbzDbLocation):void 0,i=r?{gfa:r,region:s}:a&&t&&s?{gbz:{db:a,index:Ee(n.haplotypeIndexLocation),region:s,haplotypes:e.cutHaplotypes?.map(d=>o?.[d]??d),referenceSample:n.referenceSample||o?.[t.assemblyName]||t.assemblyName,context:n.context,snarls:e.cutsWholeWalks?"overlapping":n.subgraphSnarls}}:void 0;if(!i)return;let c=e.showGenes?e.geneTrack:void 0,p=c?ne(e).tracks.find(d=>d.trackId===c.trackId):void 0,u=p?mo(q(p,"adapter"),"gffGzLocation"):void 0,l=u?.type==="Gff3TabixAdapter"?{file:Ee(u.gffGzLocation),index:Ee(u.index?.location),format:"gff3"}:void 0;return JSON.parse(JSON.stringify({...i,genes:l?.file&&l.index?l:void 0,referencePath:e.referencePath||void 0,layout:e.chosenLayoutMode,...Fn({engine:e.layoutEngine,quality:e.layoutQuality,linearLayout:e.linearLayout,bubbleSpread:e.bubbleSpread,showDeletionEdges:e.showDeletionEdges,colorScheme:e.chosenColorScheme,nodeWidth:e.nodeWidth,contigThickness:e.contigThickness,connectorThickness:e.connectorThickness,colorDomain:e.statedColorDomain}),walks:e.walkLayers.length?e.walkLayers.map(d=>d.color?d:d.walk):void 0,facet:e.walkLayers.length>1?e.facetSpec:void 0,walkStrip:e.walkStripShown||void 0,walkRowSamples:e.walkStripShown?e.walkRowSamples:void 0,width:e.paneWidth,height:e.paneCeiling}))},get figureUnavailable(){return e.layoutResult?e.walkRowGroups?"The SVG export cannot group walk rows yet: set Group by... to None first":e.drawsNodes||e.walkRowBars?void 0:`${Q(e.chosenLayoutMode).label} draws a picture of its own, which the SVG export does not`:"Nothing is drawn yet"},get figureSpecUnavailable(){return e.drawsNodes?this.figureSpec()?void 0:"bandage-figure reads a graph cut from a gbz-base track or a GFA url":`bandage-figure draws no ${Q(e.chosenLayoutMode).label} layout`},figure(){let{graph:t,layoutResult:n}=e;return t&&n&&!this.figureUnavailable?Hn(t,n,{width:e.paneWidth,height:e.paneCeiling,walks:e.walkLayers,facet:e.facetSpec,colorScheme:e.effectiveColorScheme,nodeWidth:e.nodeWidth,showDeletionEdges:e.showDeletionEdges,linearLayout:e.linearLayout,contigThickness:e.contigThickness,connectorThickness:e.connectorThickness,region:e.graphRegion,colorDomain:e.statedColorDomain,genes:e.showGenes?e.backboneGenes:void 0,walkRows:e.walkRowBars,walkRowPitch:e.walkRowPitch,rowGenes:e.walkRowGenes,rowGeneGaps:e.walkRowGeneGaps,walkStrip:e.walkStripRows&&{rows:e.walkStripRows,rowGenes:e.walkRowGenes,rowGeneGaps:e.walkRowGeneGaps},spec:e.drawsNodes?this.figureSpec():void 0}):void 0}}));var io=J(Z("path",{d:"M3 16h5v-2H3zm6.5 0h5v-2h-5zm6.5 0h5v-2h-5zM3 20h2v-2H3zm4 0h2v-2H7zm4 0h2v-2h-2zm4 0h2v-2h-2zm4 0h2v-2h-2zM3 12h8v-2H3zm10 0h8v-2h-8zM3 4v4h18V4z"}),"LineStyle");var ha=J(Z("path",{d:"M9.01 14H2v2h7.01v3L13 15l-3.99-4zm5.98-1v-3H22V8h-7.01V5L11 9z"}),"CompareArrows");var ga=J(Z("path",{d:"M17 5h-2V3h2zm-2 16h2v-2.59L19.59 21 21 19.59 18.41 17H21v-2h-6zm4-12h2V7h-2zm0 4h2v-2h-2zm-8 8h2v-2h-2zM7 5h2V3H7zM3 17h2v-2H3zm2 4v-2H3c0 1.1.9 2 2 2M19 3v2h2c0-1.1-.9-2-2-2m-8 2h2V3h-2zM3 9h2V7H3zm4 12h2v-2H7zm-4-8h2v-2H3zm0-8h2V3c-1.1 0-2 .9-2 2"}),"HighlightAlt");var Sc="Linear genome view",Rc="Linear synteny view",vc="No synteny track in this session aligns these assemblies";function ba({label:e,icon:t,entries:n,entryLabel:o,onSelect:s,disabledHelpText:r,nameTheOnlyEntry:a=!0}){let[i]=n,c=r?[{label:e,icon:t,disabled:!0,disabledHelpText:r,onClick:()=>{}}]:[];return n.length===0?c:n.length===1&&i?[{label:a?`${e} \u2014 ${o(i)}`:e,icon:t,onClick:s(i)}]:[{label:e,icon:t,type:"subMenu",subMenu:n.map(p=>({label:o(p),onClick:s(p)}))}]}function Vk({contributors:e,syntenyTracks:t,onShowLinear:n,onShowSynteny:o}){let s=t[0]?.coverage??e.length;return[...ba({label:Sc,icon:io,entries:e,entryLabel:r=>`${r.sample} ${fe(r)}`,onSelect:r=>()=>{n({location:r,assembly:r.sample})}}),...e.length>=2?ba({label:`${Rc} (${s} assemblies)`,icon:ha,entries:t,entryLabel:r=>r.coverage<s?`${r.name} (${r.coverage} of ${s})`:r.name,nameTheOnlyEntry:!1,disabledHelpText:vc,onSelect:r=>()=>{o(r.trackId)}}):[]]}function jk({own:e,reference:t,highlight:n,onShowLinear:o,onHighlight:s}){let r=[e?{label:`Open in ${e.assembly} \u2014 ${fe(e.location)}`,target:e}:void 0,t&&t.assembly!==e?.assembly?{label:`Open in ${t.assembly} \u2014 around this node`,target:t}:void 0].filter(a=>a!==void 0);return[...s&&n?[{label:`Highlight in ${n.assembly}`,icon:ga,onClick:()=>{s(n)}}]:[],...r.map(({label:a,target:i})=>({label:a,icon:io,onClick:()=>{o(i)}}))]}var Kk=J(Z("path",{d:"M19 15.18V7c0-2.21-1.79-4-4-4s-4 1.79-4 4v10c0 1.1-.9 2-2 2s-2-.9-2-2V8.82C8.16 8.4 9 7.3 9 6c0-1.66-1.34-3-3-3S3 4.34 3 6c0 1.3.84 2.4 2 2.82V17c0 2.21 1.79 4 4 4s4-1.79 4-4V7c0-1.1.9-2 2-2s2 .9 2 2v8.18c-1.16.41-2 1.51-2 2.82 0 1.66 1.34 3 3 3s3-1.34 3-3c0-1.3-.84-2.4-2-2.82"}),"Route");var Qk=J(Z("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6"}),"Settings");var ox=J(Z("path",{d:"M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"}),"Visibility");export{J as a,ei as b,Ge as c,Oe as d,Wt as e,Ri as f,Q as g,op as h,Ct as i,Bn as j,Ai as k,Pi as l,Ti as m,_n as n,$n as o,fe as p,Ei as q,xs as r,re as s,Zi as t,qn as u,Jn as v,jb as w,Yb as x,Ub as y,Gs as z,ox as A,Ba as B,Ca as C,Bt as D,Xr as E,Wa as F,Ha as G,Xa as H,fp as I,Kr as J,hp as K,gp as L,bp as M,wp as N,yp as O,kp as P,xp as Q,Sp as R,Rp as S,ja as T,Je as U,vp as V,Mp as W,Qr as X,Lp as Y,es as Z,Qy as _,ek as $,tk as aa,nk as ba,ok as ca,rk as da,sk as ea,Kn as fa,Ru as ga,Oi as ha,vu as ia,ts as ja,ow as ka,Qs as la,lw as ma,fw as na,bw as oa,wc as pa,yc as qa,fa as ra,Pk as sa,io as ta,Vk as ua,jk as va,Kk as wa,Qk as xa};
|
|
4
|
+
//# sourceMappingURL=chunk-NWJYLP6Z.js.map
|