jbrowse-plugin-graphgenomeviewer 4.0.13 → 4.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +5 -1
  2. package/dist/chunks/{GbzBaseSyntenyAdapter-Y5NBXK7P.js → GbzBaseSyntenyAdapter-3ZTHTTHA.js} +2 -2
  3. package/dist/chunks/{GraphGenomeView-TTQEJJQD.js → GraphGenomeView-5SMMNFD4.js} +2 -2
  4. package/dist/chunks/{GraphTrackSettingsDialog-3A2PKZRI.js → GraphTrackSettingsDialog-2QV6TPX7.js} +2 -2
  5. package/dist/chunks/{LinearGraphDisplay-MJ5XZFE5.js → LinearGraphDisplay-BEOEIUGA.js} +2 -2
  6. package/dist/chunks/{MinigraphBubbleAdapter-APC7JYOM.js → MinigraphBubbleAdapter-NRDD66AK.js} +2 -2
  7. package/dist/chunks/{RgfaTabixAdapter-4E365PXO.js → RgfaTabixAdapter-NQEERXXI.js} +2 -2
  8. package/dist/chunks/{chunk-5DP7IXD3.js → chunk-33VHHB43.js} +2 -2
  9. package/dist/chunks/{chunk-LA7MQS33.js → chunk-5E7TVPCI.js} +2 -2
  10. package/dist/chunks/chunk-IUIIYSGF.js +2 -0
  11. package/dist/chunks/{chunk-M4YEAXSR.js.map → chunk-IUIIYSGF.js.map} +3 -3
  12. package/dist/chunks/chunk-JXAJ7YLT.js +2 -0
  13. package/dist/chunks/chunk-JXAJ7YLT.js.map +7 -0
  14. package/dist/chunks/chunk-KULNKXPT.js +2 -0
  15. package/dist/chunks/chunk-KULNKXPT.js.map +7 -0
  16. package/dist/chunks/chunk-QSH263Y6.js +2 -0
  17. package/dist/chunks/chunk-QSH263Y6.js.map +7 -0
  18. package/dist/chunks/chunk-UQEPPJEO.js +2 -0
  19. package/dist/chunks/{chunk-VAGPKHHS.js.map → chunk-UQEPPJEO.js.map} +3 -3
  20. package/dist/chunks/chunk-UQN2NWT5.js +4 -0
  21. package/dist/chunks/chunk-UQN2NWT5.js.map +7 -0
  22. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +2 -2
  23. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +3 -3
  24. package/package.json +2 -2
  25. package/src/GraphGenomeView/components/BubbleHalos.tsx +67 -3
  26. package/src/GraphGenomeView/components/BubbleOverlay.tsx +10 -0
  27. package/src/GraphGenomeView/components/GraphCanvas.tsx +46 -9
  28. package/src/GraphGenomeView/components/LabelChip.tsx +9 -1
  29. package/src/GraphGenomeView/components/LabelLayer.tsx +7 -0
  30. package/src/GraphGenomeView/components/ReferenceStripOverlay.tsx +116 -0
  31. package/src/GraphGenomeView/components/TubeMapOverlay.tsx +109 -41
  32. package/src/GraphGenomeView/model.test.ts +3 -0
  33. package/src/GraphGenomeView/model.ts +204 -43
  34. package/src/LinearGraphDisplay/model.ts +2 -0
  35. package/src/version.ts +1 -1
  36. package/dist/chunks/chunk-CJ56O2VG.js +0 -2
  37. package/dist/chunks/chunk-CJ56O2VG.js.map +0 -7
  38. package/dist/chunks/chunk-IFRDWMQ2.js +0 -2
  39. package/dist/chunks/chunk-IFRDWMQ2.js.map +0 -7
  40. package/dist/chunks/chunk-M4YEAXSR.js +0 -2
  41. package/dist/chunks/chunk-MUK3KYB4.js +0 -2
  42. package/dist/chunks/chunk-MUK3KYB4.js.map +0 -7
  43. package/dist/chunks/chunk-VAGPKHHS.js +0 -2
  44. package/dist/chunks/chunk-XDOIZTY6.js +0 -4
  45. package/dist/chunks/chunk-XDOIZTY6.js.map +0 -7
  46. /package/dist/chunks/{GbzBaseSyntenyAdapter-Y5NBXK7P.js.map → GbzBaseSyntenyAdapter-3ZTHTTHA.js.map} +0 -0
  47. /package/dist/chunks/{GraphGenomeView-TTQEJJQD.js.map → GraphGenomeView-5SMMNFD4.js.map} +0 -0
  48. /package/dist/chunks/{GraphTrackSettingsDialog-3A2PKZRI.js.map → GraphTrackSettingsDialog-2QV6TPX7.js.map} +0 -0
  49. /package/dist/chunks/{LinearGraphDisplay-MJ5XZFE5.js.map → LinearGraphDisplay-BEOEIUGA.js.map} +0 -0
  50. /package/dist/chunks/{MinigraphBubbleAdapter-APC7JYOM.js.map → MinigraphBubbleAdapter-NRDD66AK.js.map} +0 -0
  51. /package/dist/chunks/{RgfaTabixAdapter-4E365PXO.js.map → RgfaTabixAdapter-NQEERXXI.js.map} +0 -0
  52. /package/dist/chunks/{chunk-5DP7IXD3.js.map → chunk-33VHHB43.js.map} +0 -0
  53. /package/dist/chunks/{chunk-LA7MQS33.js.map → chunk-5E7TVPCI.js.map} +0 -0
@@ -0,0 +1,2 @@
1
+ function o(t){return t.split("#")[0]}var i=new Set(["_gbwt_ref"]);function u(t){return i.has(t)}function p(t){let e=t.split("#");return e.length>=3?`${e[0]}#${e[1]}`:void 0}function d(t){let e=t.split("#");return e.length>=3?e.slice(2).join("#"):e.length===2?e[1]:t}function f(t,e){return e!==void 0&&(t===e||t.startsWith(e+"#"))}function s(t){return t.getConf("assemblyNameToPanSN")??{}}function c(t,e){return e===void 0?void 0:s(t)[e]??e}var a=new WeakMap;function g(t){let e=a.get(t);if(e===void 0){let r=s(t);e={};for(let n of new Set([...Object.keys(r),...t.getConf("assemblyNames")]))e[r[n]??n]=n;a.set(t,e)}return e}export{o as a,u as b,p as c,d,f as e,c as f,g};
2
+ //# sourceMappingURL=chunk-KULNKXPT.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../packages/core/src/pansn.ts"],
4
+ "sourcesContent": ["import type { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'\n\n// PanSN naming convention: `sample#haplotype#contig`. Shared by the all-vs-all\n// PAF adapters (in-memory and tabix-indexed), which anchor on the sample prefix\n// and strip it to recover each assembly's own refName.\nconst SEP = '#'\n\n// The PanSN sample name is the token before the first separator, e.g.\n// `grape#1#chr1` -> `grape`.\nexport function panSNSample(refName: string) {\n return refName.split(SEP)[0]!\n}\n\n// vg names a reference path that states no sample `_gbwt_ref`, and gbz-base\n// writes its walk as `W _gbwt_ref 0 chr6`\nconst GENERIC_SAMPLES = new Set(['_gbwt_ref'])\n\nexport function isGenericSample(sample: string) {\n return GENERIC_SAMPLES.has(sample)\n}\n\n// The haplotype a three-part PanSN name belongs to, `sample#hap`, which is the\n// assembly that contributed it where one sample is two haplotypes (HPRC release\n// 2.1 names every node `NA20809#2#CM094351.1`); undefined for a name that\n// states no haplotype.\nexport function panSNHaplotype(refName: string) {\n const parts = refName.split(SEP)\n return parts.length >= 3 ? `${parts[0]}${SEP}${parts[1]}` : undefined\n}\n\n// Strip the PanSN prefix to recover the assembly's own refName: `sample#hap#chr1`\n// -> `chr1`, `sample#chr1` -> `chr1`. A contig that itself contains the\n// separator is assumed not to occur (PanSN uses `#` only as the delimiter).\nexport function panSNContig(refName: string) {\n const parts = refName.split(SEP)\n return parts.length >= 3\n ? parts.slice(2).join(SEP)\n : parts.length === 2\n ? parts[1]!\n : refName\n}\n\n// Whether a PanSN name belongs to a prefix at either depth: `grape#1#chr1`\n// matches `grape` and `grape#1`, not `grape#2` or `grapefruit`. An undefined\n// prefix is \"no assembly supplied\", which nothing belongs to.\nexport function panSNMatchesPrefix(\n refName: string,\n prefix: string | undefined,\n) {\n return (\n prefix !== undefined &&\n (refName === prefix || refName.startsWith(prefix + SEP))\n )\n}\n\n// How a config maps the session's assembly names onto the PanSN spelling a\n// graph uses, and back. Every adapter here declares an `assemblyNameToPanSN`\n// slot for it \u2014 the graph says `GRCh38#0` where the assembly is `hg38` \u2014 so\n// resolving a name is the same question in all of them, and it used to be\n// answered by two copies of these functions in two directories.\n//\n// `?? {}` so an adapter whose schema lacks the slot identity-maps rather than\n// throwing a TypeError deep inside a query.\nfunction assemblyNameToPanSN(adapter: BaseFeatureDataAdapter) {\n return (adapter.getConf('assemblyNameToPanSN') ?? {}) as Record<\n string,\n string\n >\n}\n\n// One assembly name as its PanSN sample prefix, identity when the config maps\n// it to nothing. Overloaded rather than widened: undefined passes through, so a\n// caller can express \"no anchor/target supplied\", and a caller that has a name\n// gets a `string` back instead of having to re-assert one.\nexport function resolvePanSNPrefix(\n adapter: BaseFeatureDataAdapter,\n name: string,\n): string\nexport function resolvePanSNPrefix(\n adapter: BaseFeatureDataAdapter,\n name: string | undefined,\n): string | undefined\nexport function resolvePanSNPrefix(\n adapter: BaseFeatureDataAdapter,\n name: string | undefined,\n) {\n return name === undefined\n ? undefined\n : (assemblyNameToPanSN(adapter)[name] ?? name)\n}\n\nconst asmByPrefixCache = new WeakMap<\n BaseFeatureDataAdapter,\n Record<string, string>\n>()\n\n// The inverse: PanSN prefix -> the assembly name this session loads it as, for\n// naming the lane a haplotype draws on. A mapped assembly counts whether or not\n// `assemblyNames` also lists it.\nexport function assemblyByPanSNPrefix(adapter: BaseFeatureDataAdapter) {\n let out = asmByPrefixCache.get(adapter)\n if (out === undefined) {\n const map = assemblyNameToPanSN(adapter)\n out = {}\n for (const asm of new Set([\n ...Object.keys(map),\n ...(adapter.getConf('assemblyNames') as string[]),\n ])) {\n out[map[asm] ?? asm] = asm\n }\n asmByPrefixCache.set(adapter, out)\n }\n return out\n}\n"],
5
+ "mappings": "AASO,SAASA,EAAYC,EAAiB,CAC3C,OAAOA,EAAQ,MAAM,GAAG,EAAE,CAAC,CAC7B,CAIA,IAAMC,EAAkB,IAAI,IAAI,CAAC,WAAW,CAAC,EAEtC,SAASC,EAAgBC,EAAgB,CAC9C,OAAOF,EAAgB,IAAIE,CAAM,CACnC,CAMO,SAASC,EAAeJ,EAAiB,CAC9C,IAAMK,EAAQL,EAAQ,MAAM,GAAG,EAC/B,OAAOK,EAAM,QAAU,EAAI,GAAGA,EAAM,CAAC,CAAC,IAASA,EAAM,CAAC,CAAC,GAAK,MAC9D,CAKO,SAASC,EAAYN,EAAiB,CAC3C,IAAMK,EAAQL,EAAQ,MAAM,GAAG,EAC/B,OAAOK,EAAM,QAAU,EACnBA,EAAM,MAAM,CAAC,EAAE,KAAK,GAAG,EACvBA,EAAM,SAAW,EACfA,EAAM,CAAC,EACPL,CACR,CAKO,SAASO,EACdP,EACAQ,EACA,CACA,OACEA,IAAW,SACVR,IAAYQ,GAAUR,EAAQ,WAAWQ,EAAS,GAAG,EAE1D,CAUA,SAASC,EAAoBC,EAAiC,CAC5D,OAAQA,EAAQ,QAAQ,qBAAqB,GAAK,CAAC,CAIrD,CAcO,SAASC,EACdD,EACAE,EACA,CACA,OAAOA,IAAS,OACZ,OACCH,EAAoBC,CAAO,EAAEE,CAAI,GAAKA,CAC7C,CAEA,IAAMC,EAAmB,IAAI,QAQtB,SAASC,EAAsBJ,EAAiC,CACrE,IAAIK,EAAMF,EAAiB,IAAIH,CAAO,EACtC,GAAIK,IAAQ,OAAW,CACrB,IAAMC,EAAMP,EAAoBC,CAAO,EACvCK,EAAM,CAAC,EACP,QAAWE,KAAO,IAAI,IAAI,CACxB,GAAG,OAAO,KAAKD,CAAG,EAClB,GAAIN,EAAQ,QAAQ,eAAe,CACrC,CAAC,EACCK,EAAIC,EAAIC,CAAG,GAAKA,CAAG,EAAIA,EAEzBJ,EAAiB,IAAIH,EAASK,CAAG,CACnC,CACA,OAAOA,CACT",
6
+ "names": ["panSNSample", "refName", "GENERIC_SAMPLES", "isGenericSample", "sample", "panSNHaplotype", "parts", "panSNContig", "panSNMatchesPrefix", "prefix", "assemblyNameToPanSN", "adapter", "resolvePanSNPrefix", "name", "asmByPrefixCache", "assemblyByPanSNPrefix", "out", "map", "asm"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{b as u}from"./chunk-EFVAQ2KM.js";import{a as p,b as d,c as m,d as c}from"./chunk-KULNKXPT.js";var N=new Map([["hg38","GRCh38"],["hg19","GRCh37"],["hs1","CHM13"],["t2t-chm13","CHM13"],["chm13v2","CHM13"]]);function x(n){return N.get(n.toLowerCase())}function g(n){let t=n.includes("#")?p(n):void 0;return t===void 0||d(t)?void 0:t}function l(n){return m(n)??p(n)}function h(n){let t=new Set((n.anchorPaths??[]).map(e=>e.name));for(let e of n.nodes)e.stable&&t.add(e.stable.refName);let s=new Map;for(let e of t){let o=g(e);o!==void 0&&(s.get(o)??s.set(o,new Set).get(o)).add(l(e))}return s}function b(n,t){let s=new Set(n.map(f=>g(f.refName))),[e]=s;if(s.size!==1||e===void 0)return{contigs:n,prefixes:[],named:!1};let o=new Set(n.map(f=>l(f.refName))),i=[...t.get(e)??[]].every(f=>o.has(f)),r=new Set(n.map(f=>m(f.refName))),[a]=r;return{contigs:n,prefixes:[...i?[e]:[],...r.size===1&&a?[a]:[]],named:!0}}function B(n){let t=new Map;for(let e of n.nodes)if(u(e)){let{refName:o,start:i}=e.stable,r=i+e.length,a=t.get(o);a?(a.start=Math.min(a.start,i),a.end=Math.max(a.end,r)):t.set(o,{refName:o,contig:c(o),start:i,end:r})}let s=[...t.values()];return s.length?b(s,h(n)):void 0}function y(n,t){let s=r=>[r.name,...r.aliases??[]],e=r=>a=>s(a).some(f=>f.toLowerCase()===r.toLowerCase()),o=[...n?.prefixes??[]].reverse(),i=n?.prefixes.find(r=>!r.includes("#"))?.toLowerCase();for(let r of o){let a=t.find(e(r));if(a)return a}return i===void 0?void 0:t.find(r=>s(r).some(a=>x(a)?.toLowerCase()===i))}function M(n,t){let s=h(n);return n.anchorPaths?.find(e=>y(b([{refName:e.name,contig:c(e.name),start:e.start,end:e.start+e.length}],s),[t]))}function S(n){let t=new Set(n),s=new Map;for(let e of t){let o=c(e);s.set(o,s.has(o)?void 0:e)}return e=>t.has(e)?e:s.get(e)}function k(n,t){let s=S(t.contigs.map(e=>e.refName));return n.flatMap(e=>{let o=s(e.refName);return o===void 0?[]:[o===e.refName?e:{...e,refName:o}]})}export{x as a,B as b,y as c,M as d,k as e};
2
+ //# sourceMappingURL=chunk-QSH263Y6.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../packages/core/src/reference.ts"],
4
+ "sourcesContent": ["import { isBackbone } from './anchoredNodes'\nimport {\n isGenericSample,\n panSNContig,\n panSNHaplotype,\n panSNSample,\n} from './pansn'\n\nimport type { Graph, PathOrigin } from './types'\n\n// A graph's backbone names the sample it lies on (`GRCh38#0#chr6`), not an\n// assembly, and a bare contig (`chr6`) is in every human assembly at once. A\n// backbone binds to an assembly where its PanSN prefix is that assembly's name,\n// one of its aliases, or its well-known sample. One that names no sample binds\n// only where the host knows the assembly otherwise, as a track's config does.\n\nexport interface BackboneContig {\n // as the graph names it, `GRCh38#0#chr6`\n refName: string\n // as an assembly names it, `chr6`\n contig: string\n start: number\n end: number\n}\n\nexport interface Backbone {\n contigs: BackboneContig[]\n // The PanSN prefixes that name the backbone, sample then haplotype:\n // `GRCh38`, `GRCh38#0`. The sample drops out where the graph walks another\n // haplotype of it, as a diploid's `HG002` names `HG002#1` and `HG002#2`.\n prefixes: string[]\n // Whether the contigs name one real sample: false where every contig is bare\n // (`chr6`) or generic (`_gbwt_ref#0#chr6`), or where the samples differ\n named: boolean\n}\n\nexport interface AssemblyNames {\n name: string\n aliases?: string[]\n}\n\n// The sample a reference assembly's graphs name it by, keyed by the assembly's\n// name in lower case: HPRC writes `CHM13` where UCSC's assembly is `hs1`.\nexport const WELL_KNOWN_SAMPLES: ReadonlyMap<string, string> = new Map([\n ['hg38', 'GRCh38'],\n ['hg19', 'GRCh37'],\n ['hs1', 'CHM13'],\n ['t2t-chm13', 'CHM13'],\n ['chm13v2', 'CHM13'],\n])\n\nexport function wellKnownSample(assemblyName: string) {\n return WELL_KNOWN_SAMPLES.get(assemblyName.toLowerCase())\n}\n\nfunction sampleOf(refName: string) {\n const sample = refName.includes('#') ? panSNSample(refName) : undefined\n return sample === undefined || isGenericSample(sample) ? undefined : sample\n}\n\n// `HG002#1`, or the sample of a two-part name, which states no haplotype\nfunction haplotypeOf(refName: string) {\n return panSNHaplotype(refName) ?? panSNSample(refName)\n}\n\n// Each sample's haplotypes among the graph's walks and node refNames\nfunction graphHaplotypes(graph: Graph) {\n const refNames = new Set((graph.anchorPaths ?? []).map(p => p.name))\n for (const node of graph.nodes) {\n if (node.stable) {\n refNames.add(node.stable.refName)\n }\n }\n const bySample = new Map<string, Set<string>>()\n for (const refName of refNames) {\n const sample = sampleOf(refName)\n if (sample !== undefined) {\n const haplotypes =\n bySample.get(sample) ?? bySample.set(sample, new Set()).get(sample)!\n haplotypes.add(haplotypeOf(refName))\n }\n }\n return bySample\n}\n\nfunction backboneFrom(\n contigs: BackboneContig[],\n haplotypes: Map<string, Set<string>>,\n): Backbone {\n const samples = new Set(contigs.map(c => sampleOf(c.refName)))\n const [sample] = samples\n if (samples.size !== 1 || sample === undefined) {\n return { contigs, prefixes: [], named: false }\n }\n const own = new Set(contigs.map(c => haplotypeOf(c.refName)))\n const unique = [...(haplotypes.get(sample) ?? [])].every(h => own.has(h))\n const shared = new Set(contigs.map(c => panSNHaplotype(c.refName)))\n const [haplotype] = shared\n return {\n contigs,\n prefixes: [\n ...(unique ? [sample] : []),\n ...(shared.size === 1 && haplotype ? [haplotype] : []),\n ],\n named: true,\n }\n}\n\n// The rank-0 nodes' refNames and the span each covers\nexport function graphBackbone(graph: Graph): Backbone | undefined {\n const spans = new Map<string, BackboneContig>()\n for (const node of graph.nodes) {\n if (isBackbone(node)) {\n const { refName, start } = node.stable\n const end = start + node.length\n const span = spans.get(refName)\n if (span) {\n span.start = Math.min(span.start, start)\n span.end = Math.max(span.end, end)\n } else {\n spans.set(refName, {\n refName,\n contig: panSNContig(refName),\n start,\n end,\n })\n }\n }\n }\n const contigs = [...spans.values()]\n return contigs.length\n ? backboneFrom(contigs, graphHaplotypes(graph))\n : undefined\n}\n\n// The assembly the backbone's haplotype names by its name or an alias, else\n// the one its sample names, else the one whose well-known sample it is. A\n// backbone with no prefix binds to none.\nexport function backboneAssembly<T extends AssemblyNames>(\n backbone: Backbone | undefined,\n assemblies: T[],\n): T | undefined {\n const names = (a: T) => [a.name, ...(a.aliases ?? [])]\n const naming = (prefix: string) => (a: T) =>\n names(a).some(n => n.toLowerCase() === prefix.toLowerCase())\n const prefixes = [...(backbone?.prefixes ?? [])].reverse()\n const sample = backbone?.prefixes.find(p => !p.includes('#'))?.toLowerCase()\n for (const prefix of prefixes) {\n const assembly = assemblies.find(naming(prefix))\n if (assembly) {\n return assembly\n }\n }\n return sample === undefined\n ? undefined\n : assemblies.find(a =>\n names(a).some(n => wellKnownSample(n)?.toLowerCase() === sample),\n )\n}\n\n// The first of the graph's walks that a backbone along it would bind to\n// `assembly`, for putting x on the assembly a cut was made for\nexport function assemblyWalk(\n graph: Graph,\n assembly: AssemblyNames,\n): PathOrigin | undefined {\n const haplotypes = graphHaplotypes(graph)\n return graph.anchorPaths?.find(walk =>\n backboneAssembly(\n backboneFrom(\n [\n {\n refName: walk.name,\n contig: panSNContig(walk.name),\n start: walk.start,\n end: walk.start + walk.length,\n },\n ],\n haplotypes,\n ),\n [assembly],\n ),\n )\n}\n\n// Which of `refNames` a feature's refName names: the one it equals, else the\n// only one whose contig it is. A contig two refNames share names neither.\nexport function refNameBinding(refNames: Iterable<string>) {\n const exact = new Set(refNames)\n const byContig = new Map<string, string | undefined>()\n for (const refName of exact) {\n const contig = panSNContig(refName)\n byContig.set(contig, byContig.has(contig) ? undefined : refName)\n }\n return (name: string) => (exact.has(name) ? name : byContig.get(name))\n}\n\n// An assembly's features on a backbone that binds to it, each renamed to the\n// backbone's refName for it, so the assembly's `chr6` becomes the graph's\n// `GRCh38#0#chr6`. genePins and tubeMapGenes take only the renamed.\nexport function featuresOnBackbone<T extends { refName: string }>(\n features: readonly T[],\n backbone: Backbone,\n): T[] {\n const bind = refNameBinding(backbone.contigs.map(c => c.refName))\n return features.flatMap(f => {\n const refName = bind(f.refName)\n return refName === undefined\n ? []\n : [refName === f.refName ? f : { ...f, refName }]\n })\n}\n"],
5
+ "mappings": "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",
6
+ "names": ["WELL_KNOWN_SAMPLES", "wellKnownSample", "assemblyName", "sampleOf", "refName", "sample", "panSNSample", "isGenericSample", "haplotypeOf", "panSNHaplotype", "graphHaplotypes", "graph", "refNames", "p", "node", "bySample", "backboneFrom", "contigs", "haplotypes", "samples", "c", "own", "unique", "h", "shared", "haplotype", "graphBackbone", "spans", "isBackbone", "start", "end", "span", "panSNContig", "backboneAssembly", "backbone", "assemblies", "names", "a", "naming", "prefix", "n", "prefixes", "assembly", "assemblyWalk", "walk", "refNameBinding", "exact", "byContig", "contig", "name", "featuresOnBackbone", "features", "bind", "f"]
7
+ }
@@ -0,0 +1,2 @@
1
+ function r(n){return n===void 0||n==="*"?void 0:n}function l(n){let e=n.split(" ");return{refName:e[0],start:+e[1],end:+e[2],segmentCount:+e[3],pathCount:+e[4],inversion:e[5]==="1",shortestAlleleLength:+e[6],longestAlleleLength:+e[7],segments:e[11],shortestAllele:r(e[12]),longestAllele:r(e[13])}}function i(n,e){return n.refName===e.refName&&n.start===e.start&&n.end===e.end}function u(n){let{shortestAlleleLength:e,longestAlleleLength:t}=n;return e===t?`${t.toLocaleString()} bp`:`${e.toLocaleString()}-${t.toLocaleString()} bp`}var s=2147483647;function b(n){let{pathCount:e,segmentCount:t,inversion:o}=n;return[`${t} segments`,e===s?"more paths than gfatools counts":`up to ${e.toLocaleString()} paths`,...o?["inversion"]:[]].join(", ")}export{l as a,i as b,u as c,s as d,b as e};
2
+ //# sourceMappingURL=chunk-UQEPPJEO.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../packages/core/src/bubbles/bubbleLine.ts"],
4
- "sourcesContent": ["// One row of `gfatools bubble` output. Column order is fixed by gfatools\n// main.c (main_bubble): stable sequence, span, then the bubble's shape, three\n// `-1` placeholders, the segments it spans, and the two extreme alleles.\n//\n// 1 stable sequence name 8 longest allele length\n// 2 start 9 -1\n// 3 end 10 -1\n// 4 segments in the bubble 11 -1\n// 5 paths through it 12 comma-separated segment ids\n// 6 1 if it involves an inversion 13 shortest allele sequence, or *\n// 7 shortest allele length 14 longest allele sequence, or *\nexport interface MinigraphBubble {\n refName: string\n start: number\n end: number\n segmentCount: number\n pathCount: number\n inversion: boolean\n shortestAlleleLength: number\n longestAlleleLength: number\n segments: string\n shortestAllele: string | undefined\n longestAllele: string | undefined\n // Set on a bubble derived from the graph itself (bubblesFromGraph.ts) whose\n // reference route leaves the cut, so its lengths are a floor, not a fact.\n partial?: boolean\n // Every distinct route the walks take through a derived bubble, with the\n // walks that take it. Only a graph with walks can state this.\n routes?: BubbleRoute[]\n}\n\nexport interface BubbleRoute {\n // the node ids between the bubble's two ends, in walk order\n steps: string[]\n bp: number\n walks: string[]\n}\n\n// gfatools writes `*` for a zero-length allele (a pure insertion has no\n// shorter side), which is the GFA spec's \"no sequence here\" rather than a\n// sequence to show.\nfunction sequence(field: string | undefined) {\n return field === undefined || field === '*' ? undefined : field\n}\n\nexport function parseBubbleLine(line: string): MinigraphBubble {\n const cols = line.split('\\t')\n return {\n refName: cols[0]!,\n start: +cols[1]!,\n end: +cols[2]!,\n segmentCount: +cols[3]!,\n pathCount: +cols[4]!,\n inversion: cols[5] === '1',\n shortestAlleleLength: +cols[6]!,\n longestAlleleLength: +cols[7]!,\n segments: cols[11]!,\n shortestAllele: sequence(cols[12]),\n longestAllele: sequence(cols[13]),\n }\n}\n\n// How far apart the two extreme alleles are, which is the concrete thing a\n// bubble says: this stretch is between min and max bases long depending on the\n// haplotype.\nexport function bubbleLabel(bubble: MinigraphBubble) {\n const { shortestAlleleLength: min, longestAlleleLength: max } = bubble\n return min === max\n ? `${max.toLocaleString()} bp`\n : `${min.toLocaleString()}-${max.toLocaleString()} bp`\n}\n\n// gfatools counts paths into an int32 and clamps at its maximum rather than\n// overflowing, so this exact value is a \"more than I can count\" sentinel and not\n// a measurement. 406 of HPRC release 2's 130,510 bubbles hit it.\nexport const SATURATED_PATH_COUNT = 2147483647\n\n// The rest of the shape, for the description line. `pathCount` is the number of\n// ways through the bubble, which is combinatorial rather than a count of\n// observed haplotypes: one HLA class II bubble reports over 510 million across\n// its 91 segments. Hence \"up to\", and hence the label above leading with\n// lengths.\nexport function bubbleDescription(bubble: MinigraphBubble) {\n const { pathCount, segmentCount, inversion } = bubble\n return [\n `${segmentCount} segments`,\n pathCount === SATURATED_PATH_COUNT\n ? 'more paths than gfatools counts'\n : `up to ${pathCount.toLocaleString()} paths`,\n ...(inversion ? ['inversion'] : []),\n ].join(', ')\n}\n"],
5
- "mappings": "AAyCA,SAASA,EAASC,EAA2B,CAC3C,OAAOA,IAAU,QAAaA,IAAU,IAAM,OAAYA,CAC5D,CAEO,SAASC,EAAgBC,EAA+B,CAC7D,IAAMC,EAAOD,EAAK,MAAM,GAAI,EAC5B,MAAO,CACL,QAASC,EAAK,CAAC,EACf,MAAO,CAACA,EAAK,CAAC,EACd,IAAK,CAACA,EAAK,CAAC,EACZ,aAAc,CAACA,EAAK,CAAC,EACrB,UAAW,CAACA,EAAK,CAAC,EAClB,UAAWA,EAAK,CAAC,IAAM,IACvB,qBAAsB,CAACA,EAAK,CAAC,EAC7B,oBAAqB,CAACA,EAAK,CAAC,EAC5B,SAAUA,EAAK,EAAE,EACjB,eAAgBJ,EAASI,EAAK,EAAE,CAAC,EACjC,cAAeJ,EAASI,EAAK,EAAE,CAAC,CAClC,CACF,CAKO,SAASC,EAAYC,EAAyB,CACnD,GAAM,CAAE,qBAAsBC,EAAK,oBAAqBC,CAAI,EAAIF,EAChE,OAAOC,IAAQC,EACX,GAAGA,EAAI,eAAe,CAAC,MACvB,GAAGD,EAAI,eAAe,CAAC,IAAIC,EAAI,eAAe,CAAC,KACrD,CAKO,IAAMC,EAAuB,WAO7B,SAASC,EAAkBJ,EAAyB,CACzD,GAAM,CAAE,UAAAK,EAAW,aAAAC,EAAc,UAAAC,CAAU,EAAIP,EAC/C,MAAO,CACL,GAAGM,CAAY,YACfD,IAAcF,EACV,kCACA,SAASE,EAAU,eAAe,CAAC,SACvC,GAAIE,EAAY,CAAC,WAAW,EAAI,CAAC,CACnC,EAAE,KAAK,IAAI,CACb",
6
- "names": ["sequence", "field", "parseBubbleLine", "line", "cols", "bubbleLabel", "bubble", "min", "max", "SATURATED_PATH_COUNT", "bubbleDescription", "pathCount", "segmentCount", "inversion"]
4
+ "sourcesContent": ["// One row of `gfatools bubble` output. Column order is fixed by gfatools\n// main.c (main_bubble): stable sequence, span, then the bubble's shape, three\n// `-1` placeholders, the segments it spans, and the two extreme alleles.\n//\n// 1 stable sequence name 8 longest allele length\n// 2 start 9 -1\n// 3 end 10 -1\n// 4 segments in the bubble 11 -1\n// 5 paths through it 12 comma-separated segment ids\n// 6 1 if it involves an inversion 13 shortest allele sequence, or *\n// 7 shortest allele length 14 longest allele sequence, or *\nexport interface MinigraphBubble {\n refName: string\n start: number\n end: number\n segmentCount: number\n pathCount: number\n inversion: boolean\n shortestAlleleLength: number\n longestAlleleLength: number\n segments: string\n shortestAllele: string | undefined\n longestAllele: string | undefined\n // Set on a bubble derived from the graph itself (bubblesFromGraph.ts) whose\n // reference route leaves the cut, so its lengths are a floor, not a fact.\n partial?: boolean\n // Every distinct route the walks take through a derived bubble, with the\n // walks that take it. Only a graph with walks can state this.\n routes?: BubbleRoute[]\n}\n\nexport interface BubbleRoute {\n // the node ids between the bubble's two ends, in walk order\n steps: string[]\n bp: number\n walks: string[]\n}\n\n// gfatools writes `*` for a zero-length allele (a pure insertion has no\n// shorter side), which is the GFA spec's \"no sequence here\" rather than a\n// sequence to show.\nfunction sequence(field: string | undefined) {\n return field === undefined || field === '*' ? undefined : field\n}\n\nexport function parseBubbleLine(line: string): MinigraphBubble {\n const cols = line.split('\\t')\n return {\n refName: cols[0]!,\n start: +cols[1]!,\n end: +cols[2]!,\n segmentCount: +cols[3]!,\n pathCount: +cols[4]!,\n inversion: cols[5] === '1',\n shortestAlleleLength: +cols[6]!,\n longestAlleleLength: +cols[7]!,\n segments: cols[11]!,\n shortestAllele: sequence(cols[12]),\n longestAllele: sequence(cols[13]),\n }\n}\n\n// A bubble is its span on the reference, whichever array it was read into\nexport function sameBubble(a: MinigraphBubble, b: MinigraphBubble) {\n return a.refName === b.refName && a.start === b.start && a.end === b.end\n}\n\n// How far apart the two extreme alleles are, which is the concrete thing a\n// bubble says: this stretch is between min and max bases long depending on the\n// haplotype.\nexport function bubbleLabel(bubble: MinigraphBubble) {\n const { shortestAlleleLength: min, longestAlleleLength: max } = bubble\n return min === max\n ? `${max.toLocaleString()} bp`\n : `${min.toLocaleString()}-${max.toLocaleString()} bp`\n}\n\n// gfatools counts paths into an int32 and clamps at its maximum rather than\n// overflowing, so this exact value is a \"more than I can count\" sentinel and not\n// a measurement. 406 of HPRC release 2's 130,510 bubbles hit it.\nexport const SATURATED_PATH_COUNT = 2147483647\n\n// The rest of the shape, for the description line. `pathCount` is the number of\n// ways through the bubble, which is combinatorial rather than a count of\n// observed haplotypes: one HLA class II bubble reports over 510 million across\n// its 91 segments. Hence \"up to\", and hence the label above leading with\n// lengths.\nexport function bubbleDescription(bubble: MinigraphBubble) {\n const { pathCount, segmentCount, inversion } = bubble\n return [\n `${segmentCount} segments`,\n pathCount === SATURATED_PATH_COUNT\n ? 'more paths than gfatools counts'\n : `up to ${pathCount.toLocaleString()} paths`,\n ...(inversion ? ['inversion'] : []),\n ].join(', ')\n}\n"],
5
+ "mappings": "AAyCA,SAASA,EAASC,EAA2B,CAC3C,OAAOA,IAAU,QAAaA,IAAU,IAAM,OAAYA,CAC5D,CAEO,SAASC,EAAgBC,EAA+B,CAC7D,IAAMC,EAAOD,EAAK,MAAM,GAAI,EAC5B,MAAO,CACL,QAASC,EAAK,CAAC,EACf,MAAO,CAACA,EAAK,CAAC,EACd,IAAK,CAACA,EAAK,CAAC,EACZ,aAAc,CAACA,EAAK,CAAC,EACrB,UAAW,CAACA,EAAK,CAAC,EAClB,UAAWA,EAAK,CAAC,IAAM,IACvB,qBAAsB,CAACA,EAAK,CAAC,EAC7B,oBAAqB,CAACA,EAAK,CAAC,EAC5B,SAAUA,EAAK,EAAE,EACjB,eAAgBJ,EAASI,EAAK,EAAE,CAAC,EACjC,cAAeJ,EAASI,EAAK,EAAE,CAAC,CAClC,CACF,CAGO,SAASC,EAAWC,EAAoBC,EAAoB,CACjE,OAAOD,EAAE,UAAYC,EAAE,SAAWD,EAAE,QAAUC,EAAE,OAASD,EAAE,MAAQC,EAAE,GACvE,CAKO,SAASC,EAAYC,EAAyB,CACnD,GAAM,CAAE,qBAAsBC,EAAK,oBAAqBC,CAAI,EAAIF,EAChE,OAAOC,IAAQC,EACX,GAAGA,EAAI,eAAe,CAAC,MACvB,GAAGD,EAAI,eAAe,CAAC,IAAIC,EAAI,eAAe,CAAC,KACrD,CAKO,IAAMC,EAAuB,WAO7B,SAASC,EAAkBJ,EAAyB,CACzD,GAAM,CAAE,UAAAK,EAAW,aAAAC,EAAc,UAAAC,CAAU,EAAIP,EAC/C,MAAO,CACL,GAAGM,CAAY,YACfD,IAAcF,EACV,kCACA,SAASE,EAAU,eAAe,CAAC,SACvC,GAAIE,EAAY,CAAC,WAAW,EAAI,CAAC,CACnC,EAAE,KAAK,IAAI,CACb",
6
+ "names": ["sequence", "field", "parseBubbleLine", "line", "cols", "sameBubble", "a", "b", "bubbleLabel", "bubble", "min", "max", "SATURATED_PATH_COUNT", "bubbleDescription", "pathCount", "segmentCount", "inversion"]
7
7
  }
@@ -0,0 +1,4 @@
1
+ import{C as at,D as it,F as lt,J as be,K as ct,L as Ne,M as Ge,U as ut,X as dt,Y as pt,a as A,aa as ht,b as Je,c as lo,ca as ft,da as mt,f as V,fa as gt,g as tt,j as nt,k as ot,l as Be,la as bt,m as fe,ma as _e,oa as yt,t as me,ta as vt,u as st,v as ge,va as xt,wa as St}from"./chunk-JXAJ7YLT.js";import{b as et}from"./chunk-UQEPPJEO.js";import{a as He}from"./chunk-FCWXYIFC.js";import{a as Mt}from"./chunk-5E7TVPCI.js";import{B as se,f as rt}from"./chunk-IUIIYSGF.js";import{a as k,b as $,c as te,d as Qe,e as pe}from"./chunk-XEJ47DLD.js";import{a as je,b as p}from"./chunk-FY3BTKY4.js";var Gt=je((qr,Nt)=>{Nt.exports=JBrowseExports["@jbrowse/render-core/useRenderingBackend"]});var eo=je((ca,Qn)=>{Qn.exports=JBrowseExports["@jbrowse/render-core/renderingBackendBase"]});var Y=p(pe(),1);var co=50;function wt(r,e){return e>0?Math.max(1,r/e):co}function uo(r){let e=new Set,t=1/0,n=-1/0;for(let o of r)e.add(o.minY),t=Math.min(t,o.minY),n=Math.max(n,o.minY);return e.size>1?(n-t)/(e.size-1):void 0}function po(r,e,t){let n=wt(e,r.length);return{x:n,y:t>0?wt(t,r.length):uo(r)??n}}function kt(r,e,t,n){return r===void 0?po(e,t,n):typeof r=="number"?{x:r,y:r}:r}function ho(r,e,t){let n=r.get(e);n||(n=new Map,r.set(e,n));let o=n.get(t);return o||(o=[],n.set(t,o)),o}function Ct(r,e,t,n,o,s,a){let i=Math.floor(t/e.x),l=Math.floor(o/e.x),c=Math.floor(n/e.y),d=Math.floor(s/e.y);for(let u=i;u<=l;u++)for(let g=c;g<=d;g++)ho(r,u,g).push(a)}function Rt(r,e,t,n,o,s){let a=Math.floor((t-o)/e.x),i=Math.floor((t+o)/e.x),l=Math.floor((n-s)/e.y),c=Math.floor((n+s)/e.y),d=[],u=new Set;for(let g=a;g<=i;g++){let b=r.get(g);if(b)for(let x=l;x<=c;x++){let v=b.get(x);if(v)for(let m of v)u.has(m)||(u.add(m),d.push(m))}}return d}var ye=class{constructor(e,t){this.cells=new Map;let n=[],o=0,s=0;for(let[a,i]of Object.entries(e))for(let l=0;l<i.length-1;l++){let c=i[l],d=i[l+1],u=Math.min(c.x,d.x),g=Math.min(c.y,d.y),b=Math.max(c.x,d.x),x=Math.max(c.y,d.y);o+=b-u,s+=x-g,n.push({entry:{nodeId:a,segmentIdx:l},minX:u,minY:g,maxX:b,maxY:x})}this.cellSize=kt(t,n,o,s);for(let a of n)Ct(this.cells,this.cellSize,a.minX,a.minY,a.maxX,a.maxY,a.entry)}query(e,t,n,o=n){return Rt(this.cells,this.cellSize,e,t,n,o)}},ve=class{constructor(e,t,n,o,s,a,i=0){this.cells=new Map;this.edgeCurves=ct(e,t,o,a,i);let l=[],c=0,d=0;for(let u=0;u<t.edges.length;u++){let g=t.edges[u],b=e[g.from],x=e[g.to],v=this.edgeCurves.get(u);if(b?.length&&x?.length&&v){let{minX:m,minY:R,maxX:T,maxY:N}=nt(v),H=g.pathIds?.length??0;if(n&&H>0){let L=0,E=0;for(let _ of fe(b,x,H,o))L=Math.max(L,Math.abs(_.x)),E=Math.max(E,Math.abs(_.y));m-=L,R-=E,T+=L,N+=E}c+=T-m,d+=N-R,l.push({ei:u,minX:m,minY:R,maxX:T,maxY:N})}}this.cellSize=kt(s,l,c,d);for(let u of l)Ct(this.cells,this.cellSize,u.minX,u.minY,u.maxX,u.maxY,u.ei)}getCurves(e){return this.edgeCurves.get(e)}query(e,t,n,o=n){return Rt(this.cells,this.cellSize,e,t,n,o)}};function Pt(r,e,t,n,o,s){let a=o-t,i=s-n,l=a*a+i*i;if(l===0)return Math.hypot(r-t,e-n);let c=Math.max(0,Math.min(1,((r-t)*a+(e-n)*i)/l));return Math.hypot(r-(t+c*a),e-(n+c*i))}function fo(r,e,t,n,o,s,a,i,l,c){let d=1/0,u=20,g=t,b=n;for(let x=1;x<=u;x++){let v=x/u,m=1-v,R=m*m*m*t+3*m*m*v*o+3*m*v*v*a+v*v*v*l,T=m*m*m*n+3*m*m*v*s+3*m*v*v*i+v*v*v*c;d=Math.min(d,Pt(r,e,g,b,R,T)),g=R,b=T}return d}function mo(r,e,t){return fo(r,e,t.x0,t.y0,t.cx0,t.cy0,t.cx1,t.cy1,t.x1,t.y1)}function Lt(r,e,t,n=1){let o=1/0;for(let s of t){let a=mo(r,e,n===1?s:{x0:s.x0,y0:s.y0*n,cx0:s.cx0,cy0:s.cy0*n,cx1:s.cx1,cy1:s.cy1*n,x1:s.x1,y1:s.y1*n});a<o&&(o=a)}return o}var Et=new WeakMap;function go(r,e){let t=Et.get(r);if(t?.version===e)return t.index;let n=new ye(r);return Et.set(r,{version:e,index:n}),n}var It=new WeakMap;function bo(r,e,t,n,o,s){let a=It.get(r);if(a?.graph===e&&a.drawPaths===t&&a.scaleX===n.scaleX&&a.scaleY===n.scaleY&&a.version===o&&a.deletions===s)return a.index;let i=new ve(r,e,t,n,void 0,s,o);return It.set(r,{graph:e,drawPaths:t,scaleX:n.scaleX,scaleY:n.scaleY,version:o,index:i,deletions:s}),i}var yo=5;function Tt(r,e,t,n,o=0,s){let a=Be(n),i=go(r,o),l=b=>Math.max(yo,b)/n.scaleX,c=l(s?.maxHalfWidthPx??0),d=i.query(e,t,c,c/a),u=null,g=1/0;for(let{nodeId:b,segmentIdx:x}of d){let v=r[b],m=Pt(e,t*a,v[x].x,v[x].y*a,v[x+1].x,v[x+1].y*a);m<g&&m<l(s?.halfWidthPx(b)??0)&&(g=m,u=b)}return u}function Ht(r,e,t,n,o,s,a=0,i,l){let c=Be(o),d=10/o.scaleX,u=bo(r,e,s,o,a,i),g=u.query(t,n,d,d/c),b=null,x=d;for(let v of g){let m=e.edges[v],R=r[m.from],T=r[m.to];if(!R?.length||!T?.length||l?.has(v))continue;let N=m.pathIds?.length??0,H=u.getCurves(v);if(!H)continue;let L;if(!s||N===0)L=Lt(t,n*c,H,c);else{let E=1/0;for(let _ of fe(R,T,N,o)){let h=_.x===0&&_.y===0?H:ot(H,_.x,_.y),M=Lt(t,n*c,h,c);M<E&&(E=M)}L=E}L<x&&(x=L,b=v)}return b}function Bt(r){let e=r.deltaY*(r.deltaMode===1?40:r.deltaMode===2?800:1),t=(r.ctrlKey?10:1)*e/100;return 1.1**-Math.max(-2,Math.min(2,t))}var re=p(Qe(),1),Te=p(He(),1),so=p(Gt(),1);var _t=p(k(),1),$t=(0,A.createSvgIcon)((0,_t.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info");var F=p($(),1);var $e=p($(),1),X=p(k(),1),vo={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:2},xo=(0,$e.observer)(function({model:e}){let{bubbleHalos:t,walkHighlight:n,hoveredBubble:o}=e;if(t.length===0)return null;let{scaleX:s,scaleY:a,translateX:i,translateY:l,paneWidth:c,canvasHeight:d}=e,u=e.contigThickness*st,g=b=>n!==void 0&&!b.nodeIds.some(x=>n.nodeIds.has(x));return(0,X.jsx)("svg",{style:vo,width:c,height:d,"data-testid":"graph-bubble-halos",children:(0,X.jsx)("g",{transform:`translate(${i} ${l}) scale(${s} ${a})`,children:t.filter(b=>!b.whole).map(b=>(0,X.jsx)("path",{d:b.path,fill:"none",stroke:V[b.kind],strokeOpacity:o&&et(b.bubble,o)?.45:g(b)?.06:.22,strokeWidth:u,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"},`${b.bubble.start}-${b.bubble.end}`))})})}),zt=xo,So={background:"rgba(255,255,255,0.82)",padding:"4px 6px",borderRadius:3,fontSize:11,lineHeight:"15px",whiteSpace:"nowrap"},Mo={display:"flex",alignItems:"center",gap:5};function wo({color:r}){return(0,X.jsx)("svg",{width:18,height:10,style:{flex:"none"},children:(0,X.jsx)("line",{x1:5,y1:5,x2:13,y2:5,stroke:r,strokeOpacity:.35,strokeWidth:8,strokeLinecap:"round"})})}var Ot=(0,$e.observer)(function({model:e}){let t=new Map;for(let n of e.bubbleHalos)if(!n.whole){let o=V[n.kind],s=t.get(o)??new Set;s.add(tt[n.kind]),t.set(o,s)}return t.size>0?(0,X.jsx)("div",{style:So,"data-testid":"graph-halo-legend",children:[...t].map(([n,o])=>(0,X.jsxs)("div",{style:Mo,children:[(0,X.jsx)(wo,{color:n}),(0,X.jsxs)("span",{children:["bubble: ",[...o].join(", ")]})]},n))}):null});var Xt=p(He(),1),Yt=p(te(),1),Wt=p($(),1),z=p(k(),1),ko={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible",zIndex:3},Co={position:"absolute",left:8,top:8,zIndex:5,background:"rgba(255,255,255,0.9)",textTransform:"none"},Ro=10;function At(r,e){let t=12+26*Math.log10(1+r);return Math.min(t,e)}var Lo=(0,Wt.observer)(function({model:e}){let{bubbleGlyphs:t,poppedFrom:n}=e,o=n?(0,z.jsxs)(Yt.Button,{size:"small",variant:"outlined",style:Co,"data-testid":"graph-unpop-bubble",onClick:()=>{e.unpopBubble()},children:["\u25C0 Back to ",n.label]}):null;if(t.length===0)return o;let{scaleX:s,translateX:a,translateY:i,paneWidth:l,canvasHeight:c}=e,d=i,u=m=>m*s+a,g=e.overlayLabels.glyphs,b=Math.max(0,...g.map(m=>m.y+4)),x=Math.max(24,d-b-14),v=[...t].sort((m,R)=>R.bubble.end-R.bubble.start-(m.bubble.end-m.bubble.start));return(0,z.jsxs)(z.Fragment,{children:[o,(0,z.jsxs)("svg",{style:ko,width:l,height:c,"data-testid":"graph-bubble-overlay",children:[v.map(({bubble:m,kind:R,label:T})=>{let N=u(m.start),H=u(m.end),L=Math.max(H-N,Ro),E=(N+H)/2,_=At(m.longestAlleleLength,x),h=V[R],w=m.end-m.start-m.shortestAlleleLength,y=w>0?6+10*Math.log10(1+w):0,I=`${m.start}-${m.end}`;return(0,z.jsxs)("g",{children:[(0,z.jsx)("path",{d:`M${E-L/2},${d} C${E-L/2},${d-_} ${E+L/2},${d-_} ${E+L/2},${d} Z`,fill:h,fillOpacity:.18,stroke:h,strokeWidth:2,style:{pointerEvents:"auto",cursor:"pointer"},onClick:()=>{e.popBubble(m)},onMouseEnter:()=>{e.setHoveredBubble(m)},onMouseLeave:()=>{(0,Xt.isAlive)(e)&&e.setHoveredBubble(null)},children:(0,z.jsx)("title",{children:`${T}
2
+ ${m.segmentCount} segments \xB7 click to open`})}),y>0?(0,z.jsx)("path",{d:`M${E-L/2},${d} C${E-L/2},${d+y} ${E+L/2},${d+y} ${E+L/2},${d}`,fill:"none",stroke:h,strokeWidth:2,strokeDasharray:"4 3"}):null]},I)}),g.map(({item:{glyph:m,glyphX:R},x:T,y:N})=>{let H=V[m.kind],L=d-At(m.bubble.longestAlleleLength,x);return(0,z.jsxs)("g",{children:[(0,z.jsx)("line",{x1:R,x2:R,y1:N+4,y2:L-2,stroke:H,strokeWidth:.7,strokeOpacity:.5}),(0,z.jsx)("text",{x:T,y:N,fontSize:11,fontFamily:"sans-serif",fill:H,textAnchor:"middle",children:m.label})]},`${m.bubble.start}-${m.bubble.end}-label`)})]})]})}),Dt=Lo;var Ft=p($(),1),Se=p(k(),1),Eo={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:2},Me="#1c1c22",Io=(0,Ft.observer)(function({model:e}){let{genePins:t}=e;if(t.length===0)return null;let{scaleX:n,scaleY:o,translateX:s,translateY:a,paneWidth:i,canvasHeight:l,contigThickness:c}=e;return(0,Se.jsx)("svg",{style:Eo,width:i,height:l,"data-testid":"graph-gene-pins",children:(0,Se.jsx)("g",{transform:`translate(${s} ${a}) scale(${n} ${o})`,children:t.map(d=>d.exons?(0,Se.jsx)("path",{d:d.exons,fill:"none",stroke:Me,strokeOpacity:.9,strokeWidth:c*.55,strokeLinecap:"round",vectorEffect:"non-scaling-stroke"},`${d.gene.name}-${d.gene.start}`):null)})})}),Vt=Io;var Ut=p(k(),1),Zt=(0,A.createSvgIcon)((0,Ut.jsx)("path",{d:"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2m2 10H3v4c0 1.1.9 2 2 2h4v-2H5zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2"}),"CropFree");var ze=p(k(),1),qt=(0,A.createSvgIcon)([(0,ze.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"},"0"),(0,ze.jsx)("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var Kt=p(k(),1),jt=(0,A.createSvgIcon)((0,Kt.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14M7 9h5v1H7z"}),"ZoomOut");var D=p(te(),1),Ye=p($(),1),Mn=p(se(),1);var q=p(te(),1),Jt=p($(),1),Qt=p(se(),1),ae=p(k(),1),Po=(0,Qt.makeStyles)()({formControl:{minWidth:100}}),To=(0,Jt.observer)(function({model:e}){let{classes:t}=Po();return(0,ae.jsxs)(q.FormControl,{size:"small",className:t.formControl,children:[(0,ae.jsx)(q.InputLabel,{children:"Color"}),(0,ae.jsx)(q.Select,{value:e.chosenColorScheme,label:"Color",onChange:n=>{e.setColorScheme(n.target.value)},children:rt.map(({value:n,label:o})=>(0,ae.jsx)(q.MenuItem,{value:n,children:o},n))})]})}),en=To;var Ae=p(te(),1),Xe=p($(),1),tn=p(se(),1),ie=p(k(),1),nn=(0,tn.makeStyles)()({stats:{marginLeft:"auto"},perf:{color:"#888",fontVariantNumeric:"tabular-nums"}});function Oe(r){return r===void 0?"\u2013":`${Math.round(r)}ms`}var Ho=(0,Xe.observer)(function({model:e}){let{classes:t}=nn(),{lastFetchMs:n,lastLayoutMs:o,lastGeometryMs:s}=e,a=n!==void 0||o!==void 0||s!==void 0;return e.showPerf&&a?(0,ie.jsxs)(Ae.Typography,{variant:"caption",className:t.perf,"data-testid":"graph-perf-stats",children:["fetch ",Oe(n)," \xB7 layout ",Oe(o)," \xB7 geom"," ",Oe(s)]}):null}),Bo=(0,Xe.observer)(function({model:e}){let{classes:t}=nn();return(0,ie.jsxs)("div",{className:t.stats,"data-testid":"graph-stats","data-node-count":e.nodeCount,"data-edge-count":e.edgeCount,"data-path-count":e.pathCount,"data-fetch-ms":e.lastFetchMs??"","data-layout-ms":e.lastLayoutMs??"","data-geometry-ms":e.lastGeometryMs??"","data-geometry-strokes":e.lastGeometryStrokeCount??"",children:[(0,ie.jsxs)(Ae.Typography,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",(0,ie.jsx)(Ho,{model:e})]})}),on=Bo;var W=p(te(),1),rn=p($(),1),sn=p(se(),1),K=p(k(),1),No=(0,sn.makeStyles)()({formControl:{minWidth:150}}),Go=(0,rn.observer)(function({model:e}){let{classes:t}=No(),{graph:n}=e;return(0,K.jsxs)(W.FormControl,{size:"small",className:t.formControl,children:[(0,K.jsx)(W.InputLabel,{children:"Layout"}),(0,K.jsx)(W.Select,{value:e.chosenLayoutMode,label:"Layout","data-testid":"graph-layout-select",onChange:o=>{e.switchLayout(o.target.value)},children:lt.map(({value:o,label:s,description:a,available:i})=>(0,K.jsx)(W.MenuItem,{value:o,disabled:n?!i(n):!1,children:(0,K.jsx)(W.Tooltip,{title:a,placement:"right",children:(0,K.jsx)("span",{children:s})})},o))})]})}),an=Go;var U=p(te(),1),ln=p($(),1),cn=p(se(),1),j=p(k(),1),_o=(0,cn.makeStyles)()({formControl:{minWidth:130,maxWidth:240}}),$o=(0,ln.observer)(function({model:e}){let{classes:t}=_o(),{repeatChoices:n}=e;if(e.chosenLayoutMode!=="walkrows"||n.length===0)return null;let o=new Set(n.map(s=>s.key));return(0,j.jsxs)(U.FormControl,{size:"small",className:t.formControl,children:[(0,j.jsx)(U.InputLabel,{children:"Repeat"}),(0,j.jsxs)(U.Select,{value:o.has(e.repeatKey)?e.repeatKey:"",label:"Repeat","data-testid":"graph-repeat-select",onChange:s=>{e.setRepeatKey(s.target.value)},children:[(0,j.jsx)(U.MenuItem,{value:"",children:(0,j.jsx)("em",{children:"Whole window"})}),n.map(({key:s,name:a,unit:i})=>(0,j.jsxs)(U.MenuItem,{value:s,children:[a," \xB7 ",i.toLocaleString()," bp unit"]},s))]})]})}),un=$o;var mn=p(pe(),1),gn=p(Qe(),1);var dn=p(k(),1),pn=(0,A.createSvgIcon)((0,dn.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"}),"Delete");var hn=p(k(),1),fn=(0,A.createSvgIcon)((0,hn.jsx)("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreVert");var bn=p($(),1);var J=p(k(),1),zo=(0,bn.observer)(function({model:e}){let[t,n]=(0,mn.useState)(!1);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(gn.CascadingMenuButton,{size:"small",menuItems:[{type:"checkbox",label:"Linear layout",checked:e.linearLayout,onClick:()=>{e.setLinearLayout(!e.linearLayout),e.recomputeLayout()}},{type:"checkbox",label:"Show deletion edges",checked:e.showDeletionEdges,onClick:()=>{e.setShowDeletionEdges(!e.showDeletionEdges)}},{type:"checkbox",label:"Show timings",checked:e.showPerf,onClick:()=>{e.setShowPerf(!e.showPerf)}},{type:"divider"},{label:"Settings",icon:St,onClick:()=>{n(!0)}},{type:"divider"},{label:"Return to import form",icon:pn,onClick:()=>{e.clearGraph()}}],children:(0,J.jsx)(fn,{})}),(0,J.jsx)(Mt,{model:e,open:t,onClose:()=>{n(!1)}})]})}),yn=zo;var Z=p(te(),1),vn=p($(),1),xn=p(se(),1),Q=p(k(),1),Oo=(0,xn.makeStyles)()({formControl:{minWidth:130,maxWidth:220}}),Ao=(0,vn.observer)(function({model:e}){let{classes:t}=Oo(),{walkChoices:n}=e;if(n.length===0)return null;let o=new Set(n.map(s=>s.name));return(0,Q.jsxs)(Z.FormControl,{size:"small",className:t.formControl,children:[(0,Q.jsx)(Z.InputLabel,{children:"Walk"}),(0,Q.jsxs)(Z.Select,{value:o.has(e.highlightedPath)?e.highlightedPath:"",label:"Walk","data-testid":"graph-walk-select",onChange:s=>{e.setHighlightedPath(s.target.value)},children:[(0,Q.jsx)(Z.MenuItem,{value:"",children:(0,Q.jsx)("em",{children:"None"})}),n.map(({name:s,label:a})=>(0,Q.jsx)(Z.MenuItem,{value:s,children:a},s))]})]})}),Sn=Ao;var P=p(k(),1),Xo=(0,Mn.makeStyles)()({toolbar:{display:"flex",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:"1px solid #ddd"}}),Yo=(0,Ye.observer)(function({model:e}){return(0,P.jsx)(D.Typography,{variant:"body2",children:e.zoomPercent})}),Wo=(0,Ye.observer)(function({model:e}){let{classes:t}=Xo();return(0,P.jsxs)("div",{className:t.toolbar,children:[(0,P.jsx)(an,{model:e}),(0,P.jsx)(en,{model:e}),(0,P.jsx)(Sn,{model:e}),(0,P.jsx)(un,{model:e}),(0,P.jsx)(D.Tooltip,{title:"Zoom in",children:(0,P.jsx)(D.IconButton,{size:"small",onClick:()=>{e.zoom(1.5,e.paneWidth/2,e.canvasHeight/2)},children:(0,P.jsx)(qt,{})})}),(0,P.jsx)(D.Tooltip,{title:"Zoom out",children:(0,P.jsx)(D.IconButton,{size:"small",onClick:()=>{e.zoom(1/1.5,e.paneWidth/2,e.canvasHeight/2)},children:(0,P.jsx)(jt,{})})}),(0,P.jsx)(D.Tooltip,{title:"Zoom to fit",children:(0,P.jsx)(D.IconButton,{size:"small",onClick:()=>{e.zoomToFit()},children:(0,P.jsx)(Zt,{})})}),(0,P.jsx)(Yo,{model:e}),(0,P.jsx)(on,{model:e}),(0,P.jsx)(yn,{model:e})]})}),wn=Wo;var kn=p(He(),1),Cn=p($(),1);var ce=p(k(),1);function he({x:r,y:e,w:t,text:n,color:o,italic:s,small:a,dimmed:i,title:l,testId:c,onClick:d,onHover:u}){return(0,ce.jsxs)("g",{style:{pointerEvents:d||u?"auto":"none",cursor:d?"pointer":void 0,opacity:i?.35:1},"data-testid":c,onClick:d,onMouseEnter:()=>{u?.(!0)},onMouseLeave:()=>{u?.(!1)},children:[l?(0,ce.jsx)("title",{children:l}):null,(0,ce.jsx)("rect",{x:r-t/2,y:e-11-4+2,width:t,height:17,rx:3,fill:"rgba(255,255,255,0.85)",stroke:o,strokeWidth:a?.6:1}),(0,ce.jsx)("text",{x:r,y:e,fontSize:a?10:11,fontFamily:"sans-serif",fontStyle:s?"italic":void 0,fontWeight:s?600:void 0,fill:o,textAnchor:"middle",children:n})]})}var ee=p(k(),1),Do={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:3},Fo=(0,Cn.observer)(function({model:e}){let{bubbles:t,genes:n,routes:o}=e.overlayLabels;if(t.length+n.length+o.length===0)return null;let{walkHighlight:s,scaleY:a,translateY:i,contigThickness:l}=e,c=u=>s!==void 0&&!u.nodeIds.some(g=>s.nodeIds.has(g)),d=u=>s!==void 0&&!u.route.walks.includes(s.name);return(0,ee.jsxs)("svg",{style:Do,width:e.paneWidth,height:e.canvasHeight,"data-testid":"graph-label-layer",children:[n.map(({item:u,x:g,y:b,w:x,text:v})=>(0,ee.jsxs)("g",{children:[(0,ee.jsx)("line",{x1:g,x2:g,y1:b-11-2,y2:u.at.y*a+i+l/2,stroke:Me,strokeWidth:.8,strokeOpacity:.6}),(0,ee.jsx)(he,{x:g,y:b,w:x,text:v,color:Me,italic:!0,title:`${u.gene.name} ${u.gene.refName}:${u.gene.start.toLocaleString()}-${u.gene.end.toLocaleString()}${u.covered<.98?", runs past the cut":""}`,testId:"graph-gene-pin-label"})]},`${u.gene.name}-${u.gene.start}`)),o.map(({item:{halo:u,route:g},x:b,y:x,w:v,text:m})=>(0,ee.jsx)(he,{x:b,y:x,w:v,text:m,color:V[u.kind],small:!0,dimmed:d(g),title:`${g.route.walks.length} walk(s): ${g.route.walks.join(", ")}`,testId:"graph-route-label"},`${u.bubble.start}-${u.bubble.end}-${g.route.steps.join(",")}`)),t.map(({item:u,x:g,y:b,w:x,text:v})=>(0,ee.jsx)(he,{x:g,y:b,w:x,text:v,color:V[u.kind],dimmed:c(u),title:`${u.label}
3
+ ${u.bubble.segmentCount} segments \xB7 click to open`,testId:"graph-bubble-halo-label",onClick:()=>{e.popBubble(u.bubble)},onHover:m=>{(0,kn.isAlive)(e)&&e.setHoveredBubble(m?u.bubble:null)}},`${u.bubble.start}-${u.bubble.end}`))]})}),Rn=Fo;var we=p(pe(),1);var En=p(_e(),1),In=p(Je(),1),We=p($(),1),G=p(k(),1),Vo={position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:5},Uo=(0,We.observer)(function({model:e}){let t=(0,we.useRef)(null),{referenceStripShown:n,paneWidth:o,canvasHeight:s}=e;return(0,we.useEffect)(()=>(0,In.autorun)(()=>{let a=t.current,i=e.referenceStripFrame,l=a?.getContext("2d");if(a&&l&&i&&e.referenceStripShown){let c=(0,En.getDpr)(),d=e.paneWidth,u=e.canvasHeight;a.width=Math.round(d*c),a.height=Math.round(u*c),l.setTransform(c,0,0,c,0,0),l.clearRect(0,0,d,u),ut(l,e.referenceStripBlocks,i,{width:d,lit:e.referenceStripLit,darkMode:e.darkMode})}}),[e]),(0,G.jsx)("canvas",{ref:t,"data-testid":n?"graph-reference-strip":void 0,style:{...Vo,width:o,height:s,display:n?"block":"none"}})}),Pn=Uo,Zo={background:"rgba(255,255,255,0.82)",padding:"4px 6px",borderRadius:3,fontSize:11,lineHeight:"15px",whiteSpace:"nowrap"},Ln={display:"flex",alignItems:"center",gap:5},Tn=18;function qo(){return(0,G.jsxs)("svg",{width:Tn,height:4,style:{flex:"none"},children:[(0,G.jsx)("rect",{x:0,y:0,width:6,height:4,fill:"hsl(0, 70%, 50%)"}),(0,G.jsx)("rect",{x:6,y:0,width:5,height:4,fill:"hsl(120, 70%, 50%)"}),(0,G.jsx)("rect",{x:11,y:0,width:7,height:4,fill:"hsl(240, 70%, 50%)"})]})}function Ko(){return(0,G.jsx)("svg",{width:Tn,height:8,style:{flex:"none"},children:(0,G.jsx)("path",{d:"M0,4 L5,0.5 L5,7.5 Z M18,4 L13,0.5 L13,7.5 Z",fill:"#18181c"})})}var Hn=(0,We.observer)(function({model:e}){return e.referenceStripShown?(0,G.jsxs)("div",{style:Zo,"data-testid":"graph-reference-strip-legend",children:[(0,G.jsxs)("div",{style:Ln,children:[(0,G.jsx)(qo,{}),(0,G.jsx)("span",{children:"top strip: reference segments at their bp"})]}),e.referenceStripOverhangs?(0,G.jsxs)("div",{style:Ln,children:[(0,G.jsx)(Ko,{}),(0,G.jsx)("span",{children:"the graph runs past this edge"})]}):null]}):null});var Ce=p(pe(),1);var Gn=p(_e(),1),_n=p(Je(),1),De=p($(),1),C=p(k(),1),jo={position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:1},Jo=(0,De.observer)(function({model:e}){let t=(0,Ce.useRef)(null),{tubeMapPicture:n,paneWidth:o,canvasHeight:s}=e;return(0,Ce.useEffect)(()=>(0,_n.autorun)(()=>{let a=t.current,i=e.tubeMapPicture,l=e.tubeMapFrame,c=a?.getContext("2d");if(a&&c&&i&&l){let d=(0,Gn.getDpr)(),u=e.paneWidth,g=e.canvasHeight;a.width=Math.round(u*d),a.height=Math.round(g*d),c.setTransform(d,0,0,d,0,0),c.clearRect(0,0,u,g);let b={...l,width:u,highlightNode:e.hoveredNode??e.selectedNode,darkMode:e.darkMode};gt(c,i,b),mt(c,e.tubeMapDeviations,b),ht(c,e.tubeMapConnectors,e.connectorZoneBottom,b);let{bounds:x}=i;bt(c,e.tubeMapGenes,b,l.y(x.minY)-2);let v=e.tubeMapRulerBoxes;v&&pt(c,v,b,l.y(x.maxY)+4,e.layoutResult?.referenceAxis)}}),[e]),(0,C.jsx)("canvas",{ref:t,"data-testid":n?"graph-tube-map":void 0,style:{...jo,width:o,height:s,display:n?"block":"none"}})}),$n=Jo,Qo={background:"rgba(255,255,255,0.82)",padding:"4px 6px",borderRadius:3,fontSize:11,lineHeight:"15px",whiteSpace:"nowrap"},er={display:"flex",alignItems:"center",gap:5},ke=18;function tr(){let r=[[.5,5.5],[8.5,ke-.5]];return(0,C.jsx)("svg",{width:ke,height:7,style:{flex:"none"},children:(0,C.jsx)("path",{d:r.map(([e,t])=>`M${e},6 V1.5 H${t} V6`).join(" "),fill:"none",stroke:dt(),strokeWidth:1})})}var Fe={width:ke,height:7,flex:"none"},nr={...Fe,display:"flex",justifyContent:"center",backgroundColor:"#b8b8c0"};function or(){return(0,C.jsx)("div",{style:nr,children:(0,C.jsx)("div",{style:{width:2,backgroundColor:ft()}})})}function Bn({colors:r}){let e=100/r.length,t=r.map((n,o)=>`${n} ${o*e}% ${(o+1)*e}%`);return(0,C.jsx)("div",{style:{...Fe,background:`linear-gradient(to right, ${t.join(", ")})`}})}var Nn={width:ke,flex:"none",textAlign:"center",fontFamily:"monospace",fontSize:12};function rr(){return(0,C.jsx)("div",{style:{...Fe,backgroundColor:"grey"}})}function ne({swatch:r,children:e}){return(0,C.jsxs)("div",{style:er,children:[r,(0,C.jsx)("span",{children:e})]})}var zn=(0,De.observer)(function({model:e}){let{logWidths:t,foldBp:n,forwardReads:o,reverseReads:s,mismatches:a}=e.tubeMapKeys,i=[o&&(0,C.jsx)(ne,{swatch:(0,C.jsx)(Bn,{colors:at}),children:"read on the forward strand"},"fwd"),s&&(0,C.jsx)(ne,{swatch:(0,C.jsx)(Bn,{colors:it}),children:"read on the reverse strand"},"rev"),a.has("substitution")&&(0,C.jsx)(ne,{swatch:(0,C.jsx)("span",{style:Nn,children:"A"}),children:"a read's base unlike the node's"},"sub"),a.has("insertion")&&(0,C.jsx)(ne,{swatch:(0,C.jsx)("span",{style:Nn,children:"*"}),children:"bases a read inserts"},"ins"),a.has("deletion")&&(0,C.jsx)(ne,{swatch:(0,C.jsx)(rr,{}),children:"bases a read skips"},"del"),n!==void 0&&(0,C.jsxs)(ne,{swatch:(0,C.jsx)(or,{}),children:["a haplotype's variant under ",me(n)]},"fold"),t&&(0,C.jsx)(ne,{swatch:(0,C.jsx)(tr,{}),children:"width grows with log of length"},"log")].filter(Boolean);return i.length>0?(0,C.jsx)("div",{style:Qo,"data-testid":"graph-tube-map-legend",children:i}):null});var Yn=p(pe(),1);var Ue=p($(),1);function Re(r){return`hsl(${r}, 70%, 50%)`}function Ve(r,e){let t=(r-e.start)/(e.end-e.start);return Math.max(0,Math.min(1,t))*Ne}var sr=30;function On({start:r,bp:e,reversed:t},n){let o=Ve(r,n),s=Ve(r+e,n);if(s-o<1)return[(o+s)/2];let a=Math.ceil((s-o)/sr);return Array.from({length:a+1},(i,l)=>Ve(r+e*(t?a-l:l)/a,n))}var Le=`linear-gradient(to right, ${Array.from({length:7},(r,e)=>`${Re(e/6*Ne)} ${e/6*100}%`).join(", ")})`;var S=p(k(),1),cr={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible",zIndex:3},Wn="#2f8fd6",Dn="#111",Fn="#9e9e9e",Vn="#c62828",Un="#8e3fbf",O=12,An=["#4e79a7","#f28e2b","#59a14f","#e15759","#76b7b2","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Ze="#d0d0d0",ur="rgb(160, 160, 160)";function Zn(r,e){let t=r.findIndex(n=>n.unit===e);return t<0?Ze:An[t%An.length]}var dr={background:"rgba(255,255,255,0.82)",padding:"4px 6px",borderRadius:3,fontSize:11,lineHeight:"15px",whiteSpace:"nowrap"},oe={display:"flex",alignItems:"center",gap:5},ue={width:18,height:O-4,borderRadius:2},pr={...ue,display:"flex",justifyContent:"center"};function Xn({color:r}){return(0,S.jsx)("div",{style:pr,children:(0,S.jsx)("div",{style:{width:2,backgroundColor:r}})})}var qn=(0,Ue.observer)(function({model:e}){let t=e.walkRowBars;if(!t)return null;let n=e.referenceRampDomain,o=e.walkRowUnits,s=[t.reference,...t.rows],a=s.flatMap(i=>i.call&&!i.call.sequences?i.call:[]);return(0,S.jsxs)("div",{style:dr,"data-testid":"graph-walk-rows-legend",children:[o?(0,S.jsxs)(S.Fragment,{children:[o.map((i,l)=>(0,S.jsxs)("div",{style:oe,children:[(0,S.jsx)("div",{style:{...ue,backgroundColor:Zn(o,i.unit)}}),(0,S.jsxs)("span",{children:["unit ",l+1," \xB7 ",i.unitLength.toLocaleString()," bp"]})]},i.unit)),s.some(i=>!i.call?.sequences)?(0,S.jsxs)("div",{style:oe,children:[(0,S.jsx)("div",{style:{...ue,backgroundColor:Ze}}),(0,S.jsx)("span",{children:"no allele in the repeat track"})]}):null]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("div",{style:oe,children:[(0,S.jsx)("div",{style:{...ue,background:n?Le:Wn}}),(0,S.jsxs)("span",{children:["shared with ",t.reference.label]})]}),(0,S.jsxs)("div",{style:oe,children:[(0,S.jsx)("div",{style:{...ue,backgroundColor:n?Ge:Un}}),(0,S.jsx)("span",{children:"carried by haplotypes only"})]})]}),a.some(i=>i.spanningReads!==0)?(0,S.jsxs)("div",{style:oe,children:[(0,S.jsx)(Xn,{color:Dn}),(0,S.jsx)("span",{children:"allele length called for this walk"})]}):null,a.some(i=>i.spanningReads===0)?(0,S.jsxs)("div",{style:oe,children:[(0,S.jsx)(Xn,{color:Fn}),(0,S.jsx)("span",{children:"called with no read spanning it"})]}):null,a.some(i=>i.agrees===!1)?(0,S.jsxs)("div",{style:oe,children:[(0,S.jsx)("div",{style:ue}),(0,S.jsxs)("span",{style:{color:Vn},children:["walk and call over ",Math.round(.1*100),"% apart"]})]}):null]})});function Ee(r){return`${(r/1e3).toFixed(r<1e4?1:0)} kb`}function hr(r,e){return e?` \u2248 ${Math.round(r/e)} units`:""}function Kn(r,e,t){if(!t?.sequences)return hr(r,e);let n=t.sequences.reduce((o,s)=>o+s.count,0);return` \xB7 ${Number.isInteger(n)?n:n.toFixed(1)} copies`}function fr(r,e,t){let{bp:n,complete:o,call:s}=r,a=n-e,i=a===0?"":` (${a>0?"+":"\u2212"}${Ee(Math.abs(a))})`,l=s&&!s.sequences?mr(s):"";return`${Ee(n)}${Kn(n,t,s)}${i}${o?"":" \xB7 partial walk"}${l}`}function mr(r){let e=r.spanningReads===0?" \xB7 no spanning read":"";return` \xB7 called ${Ee(r.bp)}${e}`}function gr(r){let e=0;return r.map(t=>{let n=e,o=t.copyBp??Array.from({length:Math.ceil(t.count)},()=>t.unitLength),s=[],a=n;for(let i of o)s.push(a),a+=i;return e+=t.bp,{start:n,bp:t.bp,unit:t.unit,copyStarts:s}})}var jn=3;function br(r,e,t){if(t(e)-t(0)<jn)return[];let n=[];for(let o=e;o<r;o+=e)n.push(o);return n}function yr(r,e,t){if(!e)return{fill:r.onReference?Wn:Un};if(r.referenceStart===void 0)return{fill:Ge};let n=On({...r,start:r.referenceStart},e);return n.length===1?{fill:Re(n[0])}:{fill:`url(#${t})`,gradient:(0,S.jsx)("linearGradient",{id:t,children:n.map((o,s)=>(0,S.jsx)("stop",{offset:s/(n.length-1),stopColor:Re(o)},s))})}}var vr=(0,Ue.observer)(function({model:e}){let t=(0,Yn.useId)().replace(/[^\w-]/g,""),{walkRowBars:n,referenceRampDomain:o}=e;if(!n)return null;let{scaleX:s,scaleY:a,translateX:i,translateY:l,paneWidth:c,canvasHeight:d}=e,u=h=>h*s+i,g=h=>h*20*a+l,{origin:b,unit:x,reference:v,rows:m}=n,R=e.walkRowUnits,T=Math.min(b,e.graphRegion?.start??b),N=Math.max(b+v.bp,e.graphRegion?.end??0),H=(h,M,w,y="#333")=>{let I=u(M)+6,B=I+h.length*6.2<c;return(0,S.jsx)("text",{x:B?I:u(M)-6,y:w+4,fontSize:11,fontFamily:"sans-serif",fill:y,stroke:B?void 0:"white",strokeWidth:B?void 0:3,paintOrder:"stroke",textAnchor:B?"start":"end",children:h})},L=(h,M,w)=>h.filter(y=>y>0&&y<M).map(y=>(0,S.jsx)("line",{x1:u(b+y),x2:u(b+y),y1:w-O/2,y2:w+O/2,stroke:"white",strokeWidth:1},y)),E=(h,M,w,y)=>(0,S.jsx)("rect",{x:u(b+h),y:w-O/2,width:Math.max(1,M*s),height:O,fill:y},h),_=(h,M,w)=>{let y=h.call?.sequences?gr(h.call.sequences):[],I=x!==void 0&&x*s>=jn;return(0,S.jsxs)(S.Fragment,{children:[E(0,h.bp,M,Ze),y.filter(B=>B.start<h.bp).map(B=>E(B.start,Math.min(B.bp,h.bp-B.start),M,Zn(w,B.unit))),I?L(y.flatMap(B=>B.copyStarts),h.bp,M):null]})};return(0,S.jsxs)("svg",{style:cr,width:c,height:d,"data-testid":"graph-walk-rows",children:[R?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("rect",{x:u(T)-O/2,y:g(0)-O/2,width:(N-T)*s+O,height:O,rx:O/2,fill:ur}),_(v,g(0),R)]}):null,H(`${Ee(v.bp)}${Kn(v.bp,x,v.call)}`,N,g(0)),m.map((h,M)=>{let w=g(M+1);if(w<-O||w>d+O)return null;let{call:y}=h;return(0,S.jsxs)("g",{"data-testid":"graph-walk-row",children:[R?_(h,w,R):(0,S.jsxs)(S.Fragment,{children:[h.runs.map(I=>{let{fill:B,gradient:io}=yr(I,o,`${t}-${M}-${I.start}`);return(0,S.jsxs)("g",{children:[io,E(I.start,I.bp,w,B)]},I.start)}),x?L(br(h.bp,x,I=>I*s),h.bp,w):null]}),y&&!y.sequences?(0,S.jsx)("rect",{"data-testid":"graph-walk-call",x:u(b+y.bp)-1,y:w-O/2-3,width:2,height:O+6,fill:y.spanningReads===0?Fn:Dn}):null,H(fr(h,v.bp,x),b+h.bp,w,y?.agrees===!1?Vn:void 0)]},h.name)})]})}),Jn=vr;var de=p(lo(),1),to=p(_e(),1),no=p(eo(),1);var Pe=class extends no.Canvas2DRenderingBackendBase{constructor(){super(...arguments);this.transform=null;this.batch=null;this.nodeHighlights=new Map;this.highlightedEdge=null;this.highlightFactor=1}resize(t,n){(0,to.syncCanvasSize)(this.ctx.canvas,t,n)}uploadGeometry(t){this.batch=t,this.highlightedEdge=null}setNodeHighlights(t){this.nodeHighlights=t}setEdgeHighlight(t,n){this.highlightedEdge=t,this.highlightFactor=n}updateTransform(t){this.transform=t}render(t){if(!this.transform)return;let o=this.ctx,{width:s,height:a}=o.canvas;o.fillStyle=(0,de.normalizedRgbToCssRgba)([t[0],t[1],t[2]],t[3]),o.fillRect(0,0,s,a);let i=this.batch;i&&(o.lineCap="round",o.lineJoin="round",this.renderEdges(i),this.renderNodes(i),this.renderArrows(i))}renderEdges(t){let n=this.transform,o=this.ctx,s=this.highlightedEdge===null?void 0:t.edgeCurveRuns.get(this.highlightedEdge);for(let{color:a,items:i}of qe(t.edgeCurves,(l,c)=>({color:Ie(s,c)?be(l.color,this.highlightFactor):l.color,weight:l.thickness,last:Ie(s,c)}))){o.strokeStyle=(0,de.abgrToCssRgba)(a),o.lineWidth=i[0].thickness*2*n.dpr,o.beginPath();for(let l of i){let c=l.curves[0];o.moveTo(c.x0*n.scaleX+n.translateX,c.y0*n.scaleY+n.translateY);for(let d of l.curves)o.bezierCurveTo(d.cx0*n.scaleX+n.translateX,d.cy0*n.scaleY+n.translateY,d.cx1*n.scaleX+n.translateX,d.cy1*n.scaleY+n.translateY,d.x1*n.scaleX+n.translateX,d.y1*n.scaleY+n.translateY)}o.stroke()}}renderNodes(t){let n=this.transform,o=this.ctx,s=new Map;for(let[a,i]of this.nodeHighlights){let l=t.nodeStrokeRuns.get(a);if(l)for(let c=l.start;c<l.start+l.count;c++)s.set(c,i)}for(let{color:a,items:i}of qe(t.nodeStrokes,(l,c)=>{let d=s.get(c);return{color:d===void 0?l.color:be(l.color,d),weight:l.thickness,last:d!==void 0}})){o.strokeStyle=(0,de.abgrToCssRgba)(a),o.lineWidth=i[0].thickness*2*n.dpr,o.beginPath();for(let l of i){let c=l.points[0];o.moveTo(c.x*n.scaleX+n.translateX,c.y*n.scaleY+n.translateY);for(let d=1,u=l.points.length;d<u;d++){let g=l.points[d];o.lineTo(g.x*n.scaleX+n.translateX,g.y*n.scaleY+n.translateY)}}o.stroke()}}renderArrows(t){let n=this.transform,o=this.ctx,s=this.highlightedEdge===null?void 0:t.arrowRuns.get(this.highlightedEdge);for(let{color:a,items:i}of qe(t.arrows,(l,c)=>({color:Ie(s,c)?be(l.color,this.highlightFactor):l.color,weight:0,last:Ie(s,c)}))){o.fillStyle=(0,de.abgrToCssRgba)(a),o.beginPath();for(let l of i){let[c,d,u,g]=Sr(l,n);o.moveTo(c.x,c.y),o.lineTo(d.x,d.y),o.lineTo(u.x,u.y),o.lineTo(g.x,g.y),o.closePath()}o.fill()}}dispose(){super.dispose(),this.batch=null,this.nodeHighlights=new Map,this.highlightedEdge=null}},xr=.25;function Sr(r,e){let t=Math.cos(r.angle),n=Math.sin(r.angle),o=r.x*e.scaleX+e.translateX,s=r.y*e.scaleY+e.translateY,a=r.length*e.dpr,i=r.halfWidth*e.dpr,l=o-t*a,c=s-n*a,d=a*(1-xr);return[{x:o,y:s},{x:l-n*i,y:c+t*i},{x:o-t*d,y:s-n*d},{x:l+n*i,y:c-t*i}]}function Ie(r,e){return r!==void 0&&e>=r.start&&e<r.start+r.count}function qe(r,e){let t=new Map,n=new Map;for(let o=0,s=r.length;o<s;o++){let a=r[o],{color:i,weight:l,last:c}=e(a,o),d=c?n:t,u=`${i}:${l}`,g=d.get(u);g?g.items.push(a):d.set(u,{color:i,items:[a]})}return[...t.values(),...n.values()]}function oo(r){return Promise.resolve(new Pe(r))}var f=p(k(),1),ro={position:"absolute",bottom:8,right:8,background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none"},Mr={position:"relative"},wr={position:"relative",lineHeight:0},kr={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},Cr={position:"absolute",left:6,transform:"translateY(-50%)",background:"rgba(255,255,255,0.82)",padding:"0 4px",borderRadius:3,fontSize:11,lineHeight:"16px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:4},Rr=(0,F.observer)(function({model:e}){let t=e.drawnRowLabels;return(0,f.jsx)(f.Fragment,{children:t.map(({label:n,y:o})=>{let s=o*e.scaleY+e.translateY;return s>=0&&s<=e.canvasHeight?(0,f.jsx)("div",{"data-testid":"graph-row-label",style:{...Cr,top:s},children:n},o):null})})}),Lr={position:"absolute",top:ge,right:ge,display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4,pointerEvents:"none",zIndex:4},Ke={background:"rgba(255,255,255,0.82)",padding:"4px 6px",borderRadius:3,fontSize:11,lineHeight:"15px",whiteSpace:"nowrap"},Er={display:"flex",alignItems:"center",gap:5},Ir={width:18,height:3,borderRadius:2},Pr=(0,F.observer)(function({model:e}){let{pathLegend:t}=e;return t.length>0?(0,f.jsx)("div",{style:Ke,"data-testid":"graph-path-legend",children:t.map(({name:n,label:o,color:s})=>(0,f.jsxs)("div",{style:Er,children:[(0,f.jsx)("div",{style:{...Ir,backgroundColor:s}}),(0,f.jsx)("span",{children:o})]},n))}):null}),Tr=(0,F.observer)(function({model:e}){let t=e.walkHighlight;if(!t)return null;let n=e.walkChoices.find(s=>s.name===t.name)?.label??t.name,o=t.referenceBp===void 0?"":t.bp===t.referenceBp?", the reference length":`, ${t.bp>t.referenceBp?"+":"\u2212"}${Math.abs(t.bp-t.referenceBp).toLocaleString()} bp against the reference`;return(0,f.jsxs)("div",{style:Ke,"data-testid":"graph-walk-readout",children:[(0,f.jsx)("strong",{children:n}),": ",t.steps.toLocaleString()," steps,"," ",t.bp.toLocaleString()," bp",o,(0,f.jsx)("br",{}),"paler: what ",n," does not carry"]})}),Hr={minWidth:90,height:8,borderRadius:2,background:Le},Br={display:"flex",justifyContent:"space-between",gap:8},Nr=(0,F.observer)(function({model:e}){let t=e.referenceRampDomain;return t?(0,f.jsxs)("div",{style:Ke,"data-testid":"graph-ramp-legend",children:[(0,f.jsx)("div",{style:Hr}),(0,f.jsxs)("div",{style:Br,children:[(0,f.jsx)("span",{children:t.start.toLocaleString()}),(0,f.jsxs)("span",{children:["(",me(t.end-t.start),")"]}),(0,f.jsx)("span",{children:t.end.toLocaleString()})]})]}):null}),ao={position:"absolute",transform:"translate(-50%, -50%)",background:"rgba(255,255,255,0.78)",padding:"0 3px",borderRadius:3,fontSize:10,lineHeight:"13px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:3},Gr={...ao,color:"#18181c",fontWeight:600},_r={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible",zIndex:2},$r=(0,F.observer)(function({model:e}){let t=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{let n=t.current;if(!n)return;let o=new ResizeObserver(()=>{(0,Te.isAlive)(e)&&e.setLegendSize({width:n.offsetWidth,height:n.offsetHeight})});return o.observe(n),()=>{o.disconnect()}},[e]),(0,f.jsxs)("div",{ref:t,style:{...Lr,top:ge+e.referenceStripZonePx},children:[(0,f.jsx)(Nr,{model:e}),(0,f.jsx)(Hn,{model:e}),(0,f.jsx)(Ot,{model:e}),(0,f.jsx)(Pr,{model:e}),(0,f.jsx)(zn,{model:e}),(0,f.jsx)(qn,{model:e}),(0,f.jsx)(Tr,{model:e})]})}),zr=(0,F.observer)(function({model:e}){let t=e.overlayLabels.sizes,n=t.flatMap(({key:o,leader:s})=>s?[{key:o,...s}]:[]);return(0,f.jsxs)(f.Fragment,{children:[n.length>0?(0,f.jsx)("svg",{style:_r,width:e.paneWidth,height:e.canvasHeight,children:n.map(({key:o,arcX:s,arcY:a,labelX:i,labelY:l})=>(0,f.jsx)("line",{"data-testid":"graph-label-leader",x1:s,y1:a,x2:i,y2:l,stroke:"#18181c",strokeWidth:1},o))}):null,t.map(({key:o,text:s,x:a,y:i,kind:l})=>(0,f.jsx)("div",{"data-testid":"graph-size-label",style:{...l==="deletion"?Gr:ao,left:a,top:i},children:s},o))]})}),Or=(0,F.observer)(function({model:e}){let t=e.hoveredNode?e.nodeById?.get(e.hoveredNode):null,n=e.hoveredEdge!==null&&e.graph?e.graph.edges[e.hoveredEdge]:null,o=t?yt(t):void 0,s=e.hoveredEdge===null?void 0:e.deletions.find(a=>a.edgeIndex===e.hoveredEdge);return(0,f.jsxs)(f.Fragment,{children:[t?(0,f.jsxs)("div",{style:ro,children:[(0,f.jsx)("strong",{children:t.name})," \u2014 length:"," ",t.length.toLocaleString(),", depth:"," ",t.depth.toFixed(1),o?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("br",{}),o.sample," ",vt(o)," (rank"," ",t.stable?.rank,")"]}):null]}):null,n?(0,f.jsx)("div",{style:ro,children:s?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("strong",{children:"Deletion"})," ",s.bp.toLocaleString()," bp",(0,f.jsx)("br",{}),s.refName,":",s.start.toLocaleString(),"-",s.end.toLocaleString()]}):(0,f.jsxs)(f.Fragment,{children:["Edge: ",n.from," \u2192 ",n.to]})}):null]})}),Ar=(0,F.observer)(function({model:e,nodeId:t,top:n,left:o,onClose:s}){let{own:a,reference:i,highlight:l}=e.nodeLaunchTargets(t);return(0,f.jsx)(re.Menu,{open:!0,anchorReference:"anchorPosition",anchorPosition:{top:n,left:o},onClose:()=>{s()},onMenuItemClick:c=>{c()},menuItems:[{label:"Node details",icon:$t,onClick:()=>{e.showNodeDetails(t)}},...xt({own:a,reference:i,highlight:l,onShowLinear:c=>{e.showInLinearView(c)},onHighlight:e.canHighlightInLinearView?c=>{e.highlightInLinearView(c)}:void 0})]})}),Xr=(0,F.observer)(function({model:e,ownChrome:t=!0}){let{canvasRef:n,canvas:o,error:s,retry:a}=(0,so.useRenderingBackend)(oo,e),i=(0,Y.useRef)({x:0,y:0}),l=(0,Y.useRef)(!1),c=(0,Y.useRef)({frame:0,pan:null,hover:null});(0,Y.useEffect)(()=>()=>{cancelAnimationFrame(c.current.frame)},[]);let[d,u]=(0,Y.useState)(void 0);(0,Y.useEffect)(()=>{if(o){let w=function(y){if(e.hostPlacesX)return;e.host&&y.stopPropagation(),y.preventDefault();let I=M.getBoundingClientRect();e.zoom(Bt(y),y.clientX-I.left,y.clientY-I.top)};var h=w;let M=o;return M.addEventListener("wheel",w,{passive:!1}),()=>{M.removeEventListener("wheel",w)}}},[o,e]);function g(h,M){return{x:(h-e.translateX)/e.scaleX,y:(M-e.translateY)/e.scaleY}}function b(h){let M=h.currentTarget.getBoundingClientRect();return g(h.clientX-M.left,h.clientY-M.top)}function x(h,M){let{nodePositions:w}=e,y=h*e.scaleX+e.translateX,I=M*e.scaleY+e.translateY;if(e.layoutResult?.tubeMap)return e.tubeMapNodeAt(y,I);let B=e.referenceStripNodeAt(y,I);return B||(w?Tt(w,h,M,e.axisScale,e.positionsVersion,e.nodeInk):null)}function v(h){if(h.button===0){if(l.current=!1,e.hostPlacesX)return;e.host&&h.stopPropagation();let{x:M,y:w}=b(h),y=e.layoutResult?.tubeMap||h.nativeEvent.offsetY<e.referenceStripZonePx?null:x(M,w);y?e.setDraggingNode(y):e.setPanning(!0),i.current={x:h.clientX,y:h.clientY}}}function m(){let h=c.current;if(h.frame=0,h.pan&&(e.setTransform(e.scale,e.translateX+h.pan.dx,e.translateY+h.pan.dy),h.pan=null),h.hover&&e.nodePositions&&e.graph){let{x:M,y:w}=g(h.hover.x,h.hover.y);h.hover=null;let y=x(M,w);e.setHoveredNode(y),e.setHoveredEdge(y||e.layoutResult?.tubeMap?null:Ht(e.nodePositions,e.graph,M,w,e.axisScale,e.effectiveDrawPaths,e.positionsVersion,e.deletionEdgeIndexes,e.hiddenEdgeIndexes))}}function R(){c.current.frame||(c.current.frame=requestAnimationFrame(m))}function T(){let h=c.current;cancelAnimationFrame(h.frame),h.frame=0,h.pan=null,h.hover=null}function N(h){let M=h.clientX-i.current.x,w=h.clientY-i.current.y;i.current={x:h.clientX,y:h.clientY},(Math.abs(M)>1||Math.abs(w)>1)&&(l.current=!0);let y=c.current;if(e.draggingNode)e.moveNode(e.draggingNode,M/e.scaleX,w/e.scaleY);else if(e.isPanning)y.pan={dx:(y.pan?.dx??0)+M,dy:(y.pan?.dy??0)+w},R();else{let I=h.currentTarget.getBoundingClientRect();y.hover={x:h.clientX-I.left,y:h.clientY-I.top},R()}}function H(){e.stopDragging()}function L(){T(),(0,Te.isAlive)(e)&&(e.stopDragging(),e.setHoveredNode(null),e.setHoveredEdge(null))}function E(h){let{x:M,y:w}=b(h),y=x(M,w);y&&(h.preventDefault(),u({nodeId:y,top:h.clientY,left:h.clientX}))}function _(h){if(!l.current){let{x:M,y:w}=b(h),y=x(M,w);e.setSelectedNode(y),y&&e.showNodeDetails(y)}}return(0,f.jsxs)("div",{style:Mr,children:[t?(0,f.jsx)(wn,{model:e}):null,(0,f.jsxs)("div",{style:wr,onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{(0,Te.isAlive)(e)&&e.setPointerInPane(!1)},children:[(0,f.jsx)("canvas",{ref:n,"data-testid":"graph-genome-canvas",style:{width:e.paneWidth,height:e.canvasHeight,cursor:e.isPanning||e.draggingNode?"grabbing":"grab",display:"block"},onMouseDown:v,onMouseMove:N,onMouseUp:H,onMouseLeave:L,onClick:_,onContextMenu:E}),(0,f.jsx)($n,{model:e}),(0,f.jsx)(Pn,{model:e}),(0,f.jsx)(Rr,{model:e}),(0,f.jsx)(zr,{model:e}),(0,f.jsx)(zt,{model:e}),(0,f.jsx)(Vt,{model:e}),(0,f.jsx)(Rn,{model:e}),(0,f.jsx)(Dt,{model:e}),(0,f.jsx)(Jn,{model:e}),(0,f.jsx)($r,{model:e}),t?(0,f.jsx)("div",{style:kr,children:(0,f.jsx)(re.LoadingOverlay,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null]}),(0,f.jsx)(Or,{model:e}),d?(0,f.jsx)(Ar,{model:e,nodeId:d.nodeId,top:d.top,left:d.left,onClose:()=>{u(void 0)}}):null,s?(0,f.jsx)(re.ErrorBanner,{error:s,onReset:a}):null,t&&e.error?(0,f.jsx)(re.ErrorBanner,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),Ta=Xr;export{Ta as a};
4
+ //# sourceMappingURL=chunk-UQN2NWT5.js.map