jbrowse-plugin-graphgenomeviewer 8.2.0 → 8.3.1
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/dist/chunks/{AddTrackWorkflow-7CXTSSMR.js → AddTrackWorkflow-JAIB6H2T.js} +2 -2
- package/dist/chunks/{GbzBaseSyntenyAdapter-EJIR3HZM.js → GbzBaseSyntenyAdapter-Y5VUDFZP.js} +2 -2
- package/dist/chunks/{GbzBaseSyntenyAdapter-EJIR3HZM.js.map → GbzBaseSyntenyAdapter-Y5VUDFZP.js.map} +1 -1
- package/dist/chunks/{GraphGenomeView-2AKRM74B.js → GraphGenomeView-VW3PEHFP.js} +2 -2
- package/dist/chunks/{GraphTrackSettingsDialog-7XRZQW6T.js → GraphTrackSettingsDialog-TT5TXM5I.js} +2 -2
- package/dist/chunks/{HighlightColorDialog-LCBGD2ZA.js → HighlightColorDialog-R3EIOO2M.js} +2 -2
- package/dist/chunks/{LinearGraphDisplay-WWQ73BO5.js → LinearGraphDisplay-OBD4R5G3.js} +2 -2
- package/dist/chunks/{MinigraphBubbleAdapter-4OOBJ44C.js → MinigraphBubbleAdapter-QXISPSHM.js} +2 -2
- package/dist/chunks/{RgfaTabixAdapter-CEGFN2QY.js → RgfaTabixAdapter-SVZ5SSEY.js} +2 -2
- package/dist/chunks/{WalkFormsAdapter-LTAKACZD.js → WalkFormsAdapter-6LK2XCHQ.js} +2 -2
- package/dist/chunks/{WalkTabixSyntenyAdapter-B6V3YNW7.js → WalkTabixSyntenyAdapter-LA22PX4I.js} +2 -2
- package/dist/chunks/{chunk-MCBYBZZJ.js → chunk-5ZGRAPN5.js} +2 -2
- package/dist/chunks/{chunk-NOXHIOIM.js → chunk-73B6AYVV.js} +2 -2
- package/dist/chunks/{chunk-W7IHIVSE.js → chunk-AUQISDXJ.js} +2 -2
- package/dist/chunks/{chunk-W7IHIVSE.js.map → chunk-AUQISDXJ.js.map} +1 -1
- package/dist/chunks/{chunk-VKZALU57.js → chunk-B2MJV7HN.js} +1 -1
- package/dist/chunks/{chunk-VKZALU57.js.map → chunk-B2MJV7HN.js.map} +1 -1
- package/dist/chunks/{chunk-CNCYMJ5E.js → chunk-DL2S7QKE.js} +2 -2
- package/dist/chunks/{chunk-CNCYMJ5E.js.map → chunk-DL2S7QKE.js.map} +1 -1
- package/dist/chunks/{chunk-OGXVDZPS.js → chunk-DSKPOCCE.js} +2 -2
- package/dist/chunks/{chunk-OGXVDZPS.js.map → chunk-DSKPOCCE.js.map} +1 -1
- package/dist/chunks/{chunk-UHV6XIDG.js → chunk-EKGY6PG2.js} +2 -2
- package/dist/chunks/{chunk-UHV6XIDG.js.map → chunk-EKGY6PG2.js.map} +1 -1
- package/dist/chunks/{chunk-QWG7NASD.js → chunk-G3L2L62S.js} +2 -2
- package/dist/chunks/{chunk-OLZZDBQJ.js → chunk-GIIUVBOH.js} +2 -2
- package/dist/chunks/{chunk-OLZZDBQJ.js.map → chunk-GIIUVBOH.js.map} +2 -2
- package/dist/chunks/{chunk-CZXJXNZN.js → chunk-HAVM67SF.js} +2 -2
- package/dist/chunks/{chunk-UECOGSWM.js → chunk-IUBWMYUA.js} +2 -2
- package/dist/chunks/{chunk-UECOGSWM.js.map → chunk-IUBWMYUA.js.map} +1 -1
- package/dist/chunks/{chunk-SL4JJJQJ.js → chunk-MHIKXNVU.js} +3 -3
- package/dist/chunks/{chunk-SL4JJJQJ.js.map → chunk-MHIKXNVU.js.map} +2 -2
- package/dist/chunks/{chunk-IK3MQ4ZJ.js → chunk-NAC3EXT4.js} +2 -2
- package/dist/chunks/{chunk-IK3MQ4ZJ.js.map → chunk-NAC3EXT4.js.map} +1 -1
- package/dist/chunks/{chunk-CVHKXFVS.js → chunk-NSBH4FIW.js} +2 -2
- package/dist/chunks/{chunk-CVHKXFVS.js.map → chunk-NSBH4FIW.js.map} +1 -1
- package/dist/chunks/{chunk-BJHWGRMP.js → chunk-PEE2MP7K.js} +1 -1
- package/dist/chunks/{chunk-BJHWGRMP.js.map → chunk-PEE2MP7K.js.map} +1 -1
- package/dist/chunks/{chunk-T2VC3EEL.js → chunk-PMM6BEKY.js} +1 -1
- package/dist/chunks/{chunk-T2VC3EEL.js.map → chunk-PMM6BEKY.js.map} +1 -1
- package/dist/chunks/chunk-QATGAV57.js +2 -0
- package/dist/chunks/chunk-QATGAV57.js.map +7 -0
- package/dist/chunks/{chunk-PTOKTIQG.js → chunk-TMFUYJFG.js} +2 -2
- package/dist/chunks/{chunk-WUOXZAGN.js → chunk-WA7FCDLQ.js} +1 -1
- package/dist/chunks/{chunk-WUOXZAGN.js.map → chunk-WA7FCDLQ.js.map} +1 -1
- package/dist/chunks/chunk-WO3MEQ25.js +2 -0
- package/dist/chunks/chunk-ZEE3HTOT.js +2 -0
- package/dist/chunks/chunk-ZEE3HTOT.js.map +7 -0
- package/dist/chunks/{renderSvg-E5Q7MLCH.js → renderSvg-2DPRP5UX.js} +2 -2
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +2 -2
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +2 -2
- package/package.json +2 -2
- package/src/GraphAddTrackWorkflow/buildTrackConfig.test.ts +18 -0
- package/src/GraphAddTrackWorkflow/buildTrackConfig.ts +10 -0
- package/src/GraphAddTrackWorkflow/graphManifest.test.ts +12 -0
- package/src/GraphAddTrackWorkflow/graphManifest.ts +10 -2
- package/src/version.ts +1 -1
- package/dist/chunks/chunk-5FNGR33G.js +0 -2
- package/dist/chunks/chunk-5FNGR33G.js.map +0 -7
- package/dist/chunks/chunk-CZI7IP5S.js +0 -2
- package/dist/chunks/chunk-CZI7IP5S.js.map +0 -7
- package/dist/chunks/chunk-HAAABGE7.js +0 -2
- /package/dist/chunks/{AddTrackWorkflow-7CXTSSMR.js.map → AddTrackWorkflow-JAIB6H2T.js.map} +0 -0
- /package/dist/chunks/{GraphGenomeView-2AKRM74B.js.map → GraphGenomeView-VW3PEHFP.js.map} +0 -0
- /package/dist/chunks/{GraphTrackSettingsDialog-7XRZQW6T.js.map → GraphTrackSettingsDialog-TT5TXM5I.js.map} +0 -0
- /package/dist/chunks/{HighlightColorDialog-LCBGD2ZA.js.map → HighlightColorDialog-R3EIOO2M.js.map} +0 -0
- /package/dist/chunks/{LinearGraphDisplay-WWQ73BO5.js.map → LinearGraphDisplay-OBD4R5G3.js.map} +0 -0
- /package/dist/chunks/{MinigraphBubbleAdapter-4OOBJ44C.js.map → MinigraphBubbleAdapter-QXISPSHM.js.map} +0 -0
- /package/dist/chunks/{RgfaTabixAdapter-CEGFN2QY.js.map → RgfaTabixAdapter-SVZ5SSEY.js.map} +0 -0
- /package/dist/chunks/{WalkFormsAdapter-LTAKACZD.js.map → WalkFormsAdapter-6LK2XCHQ.js.map} +0 -0
- /package/dist/chunks/{WalkTabixSyntenyAdapter-B6V3YNW7.js.map → WalkTabixSyntenyAdapter-LA22PX4I.js.map} +0 -0
- /package/dist/chunks/{chunk-MCBYBZZJ.js.map → chunk-5ZGRAPN5.js.map} +0 -0
- /package/dist/chunks/{chunk-NOXHIOIM.js.map → chunk-73B6AYVV.js.map} +0 -0
- /package/dist/chunks/{chunk-QWG7NASD.js.map → chunk-G3L2L62S.js.map} +0 -0
- /package/dist/chunks/{chunk-CZXJXNZN.js.map → chunk-HAVM67SF.js.map} +0 -0
- /package/dist/chunks/{chunk-PTOKTIQG.js.map → chunk-TMFUYJFG.js.map} +0 -0
- /package/dist/chunks/{chunk-HAAABGE7.js.map → chunk-WO3MEQ25.js.map} +0 -0
- /package/dist/chunks/{renderSvg-E5Q7MLCH.js.map → renderSvg-2DPRP5UX.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as C}from"./chunk-
|
|
1
|
+
import{b as C}from"./chunk-EKGY6PG2.js";import"./chunk-IUBWMYUA.js";import"./chunk-5ZGRAPN5.js";import"./chunk-GIIUVBOH.js";import{p as d}from"./chunk-WA7FCDLQ.js";import"./chunk-MHIKXNVU.js";import"./chunk-AUQISDXJ.js";import"./chunk-PMM6BEKY.js";import"./chunk-NSBH4FIW.js";import"./chunk-PEE2MP7K.js";import"./chunk-DSKPOCCE.js";import"./chunk-YBLNN5FU.js";import"./chunk-QATGAV57.js";import"./chunk-NAC3EXT4.js";import"./chunk-YBLNN5FU.js";import"./chunk-ROZPEXN4.js";import"./chunk-B2MJV7HN.js";import"./chunk-3VGXCEMQ.js";import"./chunk-6VNDP3UB.js";import"./chunk-3WG3GF2A.js";import"./chunk-J5RMHLFJ.js";import{i as L}from"./chunk-NIEZKWQV.js";import{A as l,F as G,H as p,e as s,j as v,o as n,x as y}from"./chunk-5Z4VIKXZ.js";import{a as h,b as e,c as r,d as i}from"./chunk-JMBDTNUR.js";var N=d()({paper:{padding:16,margin:8,maxWidth:560,marginInline:"auto",display:"flex",flexDirection:"column",gap:12},row:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8}}),S=i(function({model:a}){let{classes:t}=N();return!a.error&&!a.loadCanceled?r(l,{className:t.paper,"data-testid":"graph-genome-loading",children:[r("div",{className:t.row,children:[e(v,{variant:"h6",message:a.statusMessage||void 0}),a.canCancelLoad?e(n,{size:"small","data-testid":"graph-genome-cancel",onClick:()=>{a.cancelLoad()},children:"Cancel"}):null]}),e(y,{variant:"indeterminate"})]}):a.error?e(l,{className:t.paper,children:e(s,{error:a.error,onReset:()=>{a.retryLoad()}})}):e(l,{className:t.paper,"data-testid":"graph-genome-load-canceled",children:r("div",{className:t.row,children:[e(p,{variant:"h6",children:"Loading canceled"}),e(n,{variant:"contained",size:"small","data-testid":"graph-genome-retry",onClick:()=>{a.retryLoad()},children:"Retry"})]})})}),f=S;var T=`H VN:Z:1.0
|
|
2
2
|
S 1 ACGT
|
|
3
3
|
S 2 GGCC
|
|
4
4
|
S 3 TTAA
|
|
@@ -7,4 +7,4 @@ L 1 + 2 + 0M
|
|
|
7
7
|
L 1 + 3 + 0M
|
|
8
8
|
L 2 + 4 + 0M
|
|
9
9
|
L 3 + 4 + 0M`,E=d()({column:{display:"flex",flexDirection:"column",gap:8},rowEnd:{display:"flex",gap:8,alignItems:"flex-end"},rowCenter:{display:"flex",gap:8,alignItems:"center"},flex1:{flex:1},paper:{padding:16,margin:8,maxWidth:560,marginInline:"auto"},header:{marginBottom:12},footer:{marginTop:12,display:"flex",justifyContent:"flex-end"}}),F=i(function({model:a}){let{classes:t}=E(),[m,w]=L("");function u(){let o=m.trim();o&&a.openGfaLocation({uri:o,locationType:"UriLocation"})}function M(o){let c=o.target.files?.[0];o.target.value="",c&&a.loadGFAFile(c,c.name)}return r(l,{className:t.paper,children:[e("div",{className:t.header,children:e(p,{variant:"h6",children:"Load a GFA graph"})}),r("div",{className:t.column,children:[r("div",{className:t.rowCenter,children:[r(n,{variant:"outlined",component:"label",size:"small",children:["Choose file",e("input",{type:"file",accept:".gfa,.gfa1,.gfa2,.gz",hidden:!0,onChange:o=>{M(o)}})]}),e(p,{variant:"caption",color:"text.secondary",children:"Whole-file GFA; best for small/medium graphs."})]}),r("div",{className:t.rowEnd,children:[e(G,{size:"small",label:"URL",placeholder:"https://example.com/graph.gfa",value:m,onChange:o=>{w(o.target.value)},onKeyDown:o=>{o.key==="Enter"&&u()},className:t.flex1}),e(n,{variant:"contained",onClick:()=>{u()},disabled:!m.trim(),children:"Open"})]})]}),e("div",{className:t.footer,children:e(n,{size:"small",onClick:()=>{a.loadGFA(T,"Example graph")},children:"Load 4-node example"})}),a.error?e(s,{error:a.error}):null]})}),x=F;var B=i(function({model:a}){return a.hasGraph?e(C,{model:a}):a.canRetryLoad?e(f,{model:a}):r(h,{children:[a.isLoading?e(f,{model:a}):null,e("div",{hidden:a.isLoading,children:e(x,{model:a})})]})}),q=B;export{q as default};
|
|
10
|
-
//# sourceMappingURL=GraphGenomeView-
|
|
10
|
+
//# sourceMappingURL=GraphGenomeView-VW3PEHFP.js.map
|
package/dist/chunks/{GraphTrackSettingsDialog-7XRZQW6T.js → GraphTrackSettingsDialog-TT5TXM5I.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as G,b as L}from"./chunk-
|
|
1
|
+
import{a as G,b as L}from"./chunk-IUBWMYUA.js";import{b as v,c as x,p as f}from"./chunk-WA7FCDLQ.js";import"./chunk-PMM6BEKY.js";import"./chunk-NSBH4FIW.js";import"./chunk-NAC3EXT4.js";import"./chunk-ROZPEXN4.js";import"./chunk-B2MJV7HN.js";import"./chunk-3VGXCEMQ.js";import"./chunk-6VNDP3UB.js";import{h as g,i as d}from"./chunk-NIEZKWQV.js";import{F as m,H as h,n as H}from"./chunk-5Z4VIKXZ.js";import{b as p,c as l,d as u}from"./chunk-JMBDTNUR.js";var k=f()({section:{marginBottom:24}}),w=[{value:"0",label:"None"},{value:"1",label:"1 hop"},{value:"2",label:"2 hops"}],F=u(function({model:t}){let{classes:n}=k(),e=t.sourceAdapter;return e?.type==="RgfaTabixAdapter"&&!v(e)?l("div",{className:n.section,children:[p(G,{label:"Graph context",sx:{minWidth:200},value:String(t.subgraphContext),options:w,testId:"graph-context-select",onChange:a=>{t.setSubgraphContext(Number(a)),t.recut()}}),p(h,{variant:"caption",component:"div",color:"text.secondary",children:"How far the cut follows links out of the region. At none, a detour that leaves the window draws as two stubs. No effect on gfa-to-tabix's default anchored index."})]}):null}),M=F;var I=f()({section:{marginBottom:24}});function A(o){return o.split(/[\s,]+/).filter(t=>t!=="")}var N=(o,t)=>o.join(`
|
|
2
2
|
`)===t.join(`
|
|
3
3
|
`);function P(o,t){let n=o.cutHaplotypes??[],[e,a]=d(n);return N(n,e)||(a(n),t()),r=>{N(r,n)||(a(r),o.setSubgraphHaplotypes(r),o.recut())}}var D=u(function({model:t}){let[n,e]=d(t.cutHaplotypes?.join(", ")??""),a=P(t,()=>{e(t.cutHaplotypes?.join(", ")??"")}),r=()=>{a(A(n))};return p(m,{fullWidth:!0,label:"Haplotypes",placeholder:"every haplotype",value:n,slotProps:{htmlInput:{"data-testid":"graph-haplotypes-field"}},onChange:i=>{e(i.target.value)},onBlur:()=>{r()},onKeyDown:i=>{i.key==="Enter"&&r()}})}),B=u(function({model:t,names:n}){let[e,a]=d(t.cutHaplotypes??[]),r=g(e),i=g(""),[S,b]=d(!1),C=P(t,()=>{r.current=t.cutHaplotypes??[],a(r.current)});return p(H,{multiple:!0,freeSolo:!0,disableCloseOnSelect:!0,options:n,value:e,open:S,onOpen:()=>{b(!0)},onInputChange:(c,s)=>{i.current=s},onClose:(c,s)=>{b(!1);let y=i.current.trim();s==="blur"&&y&&!r.current.includes(y)&&(r.current=[...r.current,y],a(r.current)),C(r.current)},onChange:(c,s)=>{r.current=s,a(s),S||C(s)},renderInput:c=>p(m,{...c,label:"Haplotypes",placeholder:e.length===0?"every haplotype":void 0,slotProps:{...c.slotProps,htmlInput:{...c.slotProps.htmlInput,"data-testid":"graph-haplotypes-field"}}})})}),O=u(function({model:t}){let{classes:n}=I(),e=t.haplotypeNames,a=t.sourceAdapter;return a&&x(a)?l("div",{className:n.section,children:[e?p(B,{model:t,names:e}):p(D,{model:t}),l(h,{variant:"caption",component:"div",color:"text.secondary",children:[e?`Which of the graph's ${e.length.toLocaleString()} haplotypes to cut, or a PanSN prefix (HG002 for both).`:"Which haplotypes to cut, as lane assembly names or PanSN prefixes (HG002#1, or HG002 for both) separated by commas."," ","Empty is every haplotype."]})]}):null}),T=O;function R({model:o,onClose:t}){return l(L,{model:o,onClose:t,children:[p(M,{model:o}),p(T,{model:o})]})}export{R as default};
|
|
4
|
-
//# sourceMappingURL=GraphTrackSettingsDialog-
|
|
4
|
+
//# sourceMappingURL=GraphTrackSettingsDialog-TT5TXM5I.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{x as v,y as C}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=HighlightColorDialog-
|
|
1
|
+
import{x as v,y as C}from"./chunk-AUQISDXJ.js";import"./chunk-NSBH4FIW.js";import"./chunk-NAC3EXT4.js";import"./chunk-B2MJV7HN.js";import{F as g,H as t,d as u,o as y,q as c,r as d,z as s}from"./chunk-5Z4VIKXZ.js";import{a as h,b as l,c as p,d as m}from"./chunk-JMBDTNUR.js";var b=m(function({model:o,onClose:r}){return p(u,{open:!0,onClose:r,title:"Color highlighted haplotypes",children:[p(d,{sx:{display:"grid",gridTemplateColumns:"auto 1fr 1fr",alignItems:"center",gap:1.5},children:[l(t,{variant:"subtitle2",children:"Haplotype"}),l(t,{variant:"subtitle2",children:"Color by"}),l(t,{variant:"subtitle2",children:"Palette"}),o.drawnWalks.map(({name:a,encoding:n})=>l(f,{label:o.walkLabel(a),field:n.field,scheme:n.scheme,onField:e=>{o.setWalkColor(a,{field:e})},onScheme:e=>{o.setWalkColor(a,{scheme:e})}},a))]}),l(c,{children:l(y,{variant:"contained",onClick:r,children:"Done"})})]})});function f({label:i,field:o,scheme:r,onField:a,onScheme:n}){return p(h,{children:[l(t,{variant:"body2",children:i}),l(g,{select:!0,size:"small",value:o,slotProps:{select:{SelectDisplayProps:{"aria-label":`Color ${i} by`}}},onChange:e=>{a(e.target.value)},children:v.map(e=>l(s,{value:e.value,children:e.label},e.value))}),l(g,{select:!0,size:"small",value:r,slotProps:{select:{SelectDisplayProps:{"aria-label":`Palette for ${i}`}}},onChange:e=>{n(e.target.value)},children:C.filter(e=>e.value!=="rainbow"||o==="reference").map(e=>l(s,{value:e.value,children:e.label},e.value))})]})}var P=b;export{P as default};
|
|
2
|
+
//# sourceMappingURL=HighlightColorDialog-R3EIOO2M.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b as i}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=LinearGraphDisplay-
|
|
1
|
+
import{a,b as i}from"./chunk-EKGY6PG2.js";import"./chunk-IUBWMYUA.js";import"./chunk-5ZGRAPN5.js";import"./chunk-GIIUVBOH.js";import"./chunk-WA7FCDLQ.js";import"./chunk-MHIKXNVU.js";import"./chunk-AUQISDXJ.js";import"./chunk-PMM6BEKY.js";import"./chunk-NSBH4FIW.js";import"./chunk-PEE2MP7K.js";import"./chunk-DSKPOCCE.js";import"./chunk-YBLNN5FU.js";import"./chunk-QATGAV57.js";import"./chunk-NAC3EXT4.js";import"./chunk-YBLNN5FU.js";import"./chunk-ROZPEXN4.js";import"./chunk-B2MJV7HN.js";import"./chunk-3VGXCEMQ.js";import"./chunk-6VNDP3UB.js";import"./chunk-3WG3GF2A.js";import"./chunk-J5RMHLFJ.js";import"./chunk-NIEZKWQV.js";import"./chunk-5Z4VIKXZ.js";import{b as o,d as t}from"./chunk-JMBDTNUR.js";var e=JBrowseExports["@jbrowse/display-kit/DisplayChrome"];var s=e&&e.__esModule?e.default:e;var p=t(function({model:r}){return o(s,{model:r,factory:a,testid:"linear-graph-display","data-layout":r.chosenLayoutMode,"data-cut-tier":r.cutTier,"data-recuts":r.recuts,"data-node-count":r.hasGraph?r.nodeCount:void 0,"data-loading":r.isLoading?"":void 0,style:{width:r.paneWidth,height:r.height,overflow:"hidden"},children:n=>o(i,{model:r,handle:n})})}),c=p;export{c as default};
|
|
2
|
+
//# sourceMappingURL=LinearGraphDisplay-OBD4R5G3.js.map
|
package/dist/chunks/{MinigraphBubbleAdapter-4OOBJ44C.js → MinigraphBubbleAdapter-QXISPSHM.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as f,d as c,f as d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=MinigraphBubbleAdapter-
|
|
1
|
+
import{a as f,d as c,f as d}from"./chunk-PEE2MP7K.js";import{a as g}from"./chunk-KOB7YIMR.js";import{E as p,F as u,b,z as m}from"./chunk-HAVM67SF.js";import"./chunk-YBLNN5FU.js";import"./chunk-ROZPEXN4.js";import"./chunk-B2MJV7HN.js";import"./chunk-OGQ6OQDN.js";import"./chunk-3WG3GF2A.js";import{a as i,o as l}from"./chunk-J5RMHLFJ.js";var a=class extends b{constructor(){super(...arguments);this.bubbles=p(this,["bubblesLocation"],["index"]);this.refNames=new u(this.bubbles,this)}static{this.capabilities=["getFeatures","getRefNames"]}async getRefNames(t={}){return this.refNames.assemblyRefNames(t)}async getRegionByteSize(t,s={}){return this.refNames.regionBytes(t,s)}async hasDataForRefName(){return!0}getFeatures(t,s={}){let{signal:n,statusCallback:h}=s;return g(async r=>{let o=await this.refNames.resolveMapped(t,s);o!==void 0&&await l("Downloading bubbles",h,()=>m(this.bubbles,o,t.start,t.end,{signal:n,lineCallback:(N,y)=>{let e=f(N);r.next(new i({uniqueId:`bubble-${y}`,refName:t.refName,start:e.start,end:e.end,name:c(e),description:d(e),type:"bubble",score:e.segmentCount,segmentCount:e.segmentCount,pathCount:e.pathCount,inversion:e.inversion,shortestAlleleLength:e.shortestAlleleLength,longestAlleleLength:e.longestAlleleLength,segments:e.segments,shortestAllele:e.shortestAllele,longestAllele:e.longestAllele}))}})),r.complete()},n)}};export{a as default};
|
|
2
|
+
//# sourceMappingURL=MinigraphBubbleAdapter-QXISPSHM.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as F}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=RgfaTabixAdapter-
|
|
1
|
+
import{a as F}from"./chunk-73B6AYVV.js";import"./chunk-WO3MEQ25.js";import{a as N}from"./chunk-KOB7YIMR.js";import"./chunk-YBLNN5FU.js";import"./chunk-QATGAV57.js";import"./chunk-NAC3EXT4.js";import{E as p,F as d,b as h,u,v as w,w as k,x,y as b,z as g}from"./chunk-HAVM67SF.js";import"./chunk-YBLNN5FU.js";import"./chunk-ROZPEXN4.js";import"./chunk-B2MJV7HN.js";import{e as f}from"./chunk-6VNDP3UB.js";import"./chunk-OGQ6OQDN.js";import"./chunk-3WG3GF2A.js";import{a as l,o as m}from"./chunk-J5RMHLFJ.js";var c=class extends h{constructor(){super(...arguments);this.fine=this.openIndex([])}static{this.capabilities=["getFeatures","getRefNames"]}openIndex(e){let t=this.getConf("walksLocation"),n=e.length===0&&f(t)?new F(p(this,["walksLocation"],["walksIndex"]),this):void 0,r=e.length===0?this.getConf("graphLocation"):this.getConf(["coarse","graphLocation"]);if(f(r)){let s=p(this,[...e,"graphLocation"],[...e,"graphIndex"]);return{graph:s,walks:n,refNames:new d(n?.file??s,this)}}let a=p(this,[...e,"segmentsLocation"],[...e,"segmentsIndex"]),i=p(this,[...e,"linksLocation"],[...e,"linksIndex"]);return{segments:a,links:i,walks:n,refNames:new d(n?.file??a,this)}}async getHaplotypeNames(e={}){return this.fine.walks?.haplotypeNames(e)}index(e="fine"){return e==="fine"?this.fine:(this.coarse??=this.openIndex(["coarse"]),this.coarse)}async getRefNames(e={}){return this.fine.refNames.assemblyRefNames(e)}async getRegionByteSize(e,t={}){let{walks:n,refNames:r}=this.fine;return r.regionBytes(e,t,n&&((a,{start:i,end:s})=>n.reader.queryStart(i,{...t,refName:a,end:s})))}async hasDataForRefName(){return!0}getFeatures(e,t={}){return N(async n=>{let r=await this.fine.refNames.resolveMapped(e,t);if(r!==void 0){let{walks:a}=this.fine,i=s=>{n.next(s)};await(a?this.walkFeatures(a,r,e,t,i):this.segmentFeatures(r,e,t,i))}n.complete()},t.signal)}async walkFeatures(e,t,n,r,a){let i=await m("Downloading walks",r.statusCallback,()=>e.referenceNodes(t,n,r));for(let s of i){let o=String(s.id);a(new l({uniqueId:o,refName:n.refName,start:s.start,end:s.end,name:o,type:"segment",rank:0,stableName:s.refName}))}}async segmentRows(e,t,n,r){let a=this.fine;if("graph"in a){let i=k(await a.graph.getHeaderLines({signal:n.signal}));return g(a.graph,e,t.start,t.end,{signal:n.signal,lineCallback:s=>{let o=x(s,i);o?.kind==="N"&&r(o.segment,i.anchored)}})}return g(a.segments,e,t.start,t.end,{signal:n.signal,lineCallback:i=>{let{segment:s,anchored:o}=u(i);r(s,o)}})}async segmentFeatures(e,t,n,r){await m("Downloading segments",n.statusCallback,()=>this.segmentRows(e,t,n,(a,i)=>{if(i&&a.refName!==e)return;let s=w(a);r(new l({uniqueId:a.id,refName:t.refName,start:a.start,end:a.end,name:a.id,type:"segment",rank:a.rank,stableName:a.refName,...s&&{samples:s,sampleCount:s.length}}))}))}async getSubgraph(e,t={}){let{hops:n,signal:r,tier:a}=t,i=this.index(a),s=await i.refNames.resolveForCut(e,{signal:r});return i.walks?i.walks.subgraph(s,e,t):b(i,{refName:s,start:e.start,end:e.end},{hops:n,signal:r})}};export{c as default};
|
|
2
|
+
//# sourceMappingURL=RgfaTabixAdapter-SVZ5SSEY.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as x,b,c as N,d as R,f as c,g as C,h as P,i as T}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=WalkFormsAdapter-
|
|
1
|
+
import{a as x,b,c as N,d as R,f as c,g as C,h as P,i as T}from"./chunk-TMFUYJFG.js";import{a as k}from"./chunk-KOB7YIMR.js";import{E as $,b as l,d as g,e as w,f as h,g as p,k as y,o as B,s as F,t as S}from"./chunk-HAVM67SF.js";import"./chunk-YBLNN5FU.js";import"./chunk-ROZPEXN4.js";import"./chunk-B2MJV7HN.js";import"./chunk-OGQ6OQDN.js";import"./chunk-3WG3GF2A.js";import{a as m,o as u}from"./chunk-J5RMHLFJ.js";var v=r=>`${(r/1e6).toFixed(1)} MB`,O=r=>`${(r/1e6).toFixed(1)} M`;function E(r,f){if(!(r instanceof g))return r;let t=N(f);if(r instanceof F)return new Error(`The pinned window ${t} is too large to read every walk in full for structural forms: its walks take ${O(r.steps)} steps, over the ${O(r.limit)} step budget, and about ${p(r.fitsBp)} of it fits. Pin a narrower window`);let e=`walkByteBudget, ${v(r.limit)}`;return new Error(`The pinned window ${t} is too large to cut for structural forms: ${r.zoomHelps?`about ${p(r.fitsBp)} of it fits in ${e}. Pin a narrower window or raise walkByteBudget`:`its cut fetches ${v(r.bytes??0)}, over ${e}. Raise walkByteBudget`}`)}var L=8,i=new Map;function A(r,f){let t=i.get(r),e=t??f();if(i.delete(r),i.set(r,e),!t){e.catch(()=>{i.get(r)===e&&i.delete(r)});for(let s of i.keys()){if(i.size<=L)break;i.delete(s)}}return e}var d=class extends l{constructor(){super(...arguments);this.reader=new y($(this,["walksLocation"],["walksIndex"]))}static{this.capabilities=["getFeatures","getRefNames"]}async referenceSample(t){let{references:e}=await this.reader.header(t);return e[0]??""}async getRefNames(t={}){let e=await this.reader.referenceSequences(t),s=await this.referenceSample(t),a=e.filter(o=>h(o,s)).map(o=>w(o));return a.length>0?[...new Set(a)]:e}pinned(){let t=x(this.getConf("pinned"));if(!t)throw new Error("WalkFormsAdapter needs `pinned`, the window its forms come from: { refName, start, end }");return t}forms(t){if(!this.formsRead){let e=this.pinned(),s=`${JSON.stringify(this.getConf("walksLocation"))} ${e.refName}:${e.start}-${e.end}`,a=this.getConf("walkByteBudget"),o=A(`${s} ${a}`,()=>u("Cutting walks",t.statusCallback,()=>S(this.reader,e,{byteBudget:a,partial:!1}).catch(n=>{throw E(n,e)}))).then(n=>B(n,{window:e,floorBp:b(this.getConf("floorBp")),exclude:this.getConf("exclude")}));o.catch(()=>{this.formsRead===o&&(this.formsRead=void 0)}),this.formsRead=o}return this.formsRead}maxForms(){return this.getConf("maxForms")}async getSourcesAndWarnings(t={}){let e=await this.forms(t),s=R(this.pinned());return{sources:c(e,this.maxForms()),warnings:C(e,this.maxForms()).map(a=>s+a)}}async getSources(t,e={}){return c(await this.forms(e),this.maxForms())}async onPinnedSequence(t,e){let s=await this.referenceSample(e),[a,o]=await Promise.all([this.reader.sequenceFor(s,t,e),this.reader.sequenceFor(s,this.pinned().refName,e)]);return a!==void 0&&a===o}getFeatures(t,e={}){return k(async s=>{let a=await this.forms(e),o=await this.onPinnedSequence(t.refName,e)?T(a,this.maxForms()).filter(n=>n.start<t.end&&n.end>t.start):[];for(let n of o)s.next(new m({uniqueId:`forms-${a.floorBp}-${n.id}`,refName:t.refName,start:n.start,end:n.end,name:n.name,description:n.description,type:n.type,svType:n.svType,consequence:n.consequence,REF:"N",ALT:[n.alt],INFO:{SVTYPE:[n.svType],SVLEN:[n.mark.delta]},mark:n.mark,genotypes:n.genotypes}));if(o.length===0){let n=Math.floor(t.start);s.next(new m({uniqueId:`forms-reference-${t.refName}-${n}`,refName:t.refName,start:n,end:n+1,REF:"N",ALT:["."],genotypes:P(a,this.maxForms())}))}s.complete()},e.signal)}};export{d as default};
|
|
2
|
+
//# sourceMappingURL=WalkFormsAdapter-6LK2XCHQ.js.map
|
package/dist/chunks/{WalkTabixSyntenyAdapter-B6V3YNW7.js → WalkTabixSyntenyAdapter-LA22PX4I.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as K}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=WalkTabixSyntenyAdapter-
|
|
1
|
+
import{a as K}from"./chunk-73B6AYVV.js";import{b as $,d as U,e as X,f as O,g as z,h as G}from"./chunk-G3L2L62S.js";import"./chunk-WO3MEQ25.js";import{a as q}from"./chunk-KOB7YIMR.js";import{p as M,q as _,r as T}from"./chunk-M2D7NUOY.js";import"./chunk-YBLNN5FU.js";import"./chunk-QATGAV57.js";import"./chunk-NAC3EXT4.js";import{E as D,F as H,i as j}from"./chunk-HAVM67SF.js";import"./chunk-YBLNN5FU.js";import"./chunk-ROZPEXN4.js";import{a as S,c as I,d as W,g as F,h as w,i as x}from"./chunk-B2MJV7HN.js";import"./chunk-OTBDKJEA.js";import"./chunk-3VGXCEMQ.js";import"./chunk-OGQ6OQDN.js";import"./chunk-3WG3GF2A.js";import{o as R}from"./chunk-J5RMHLFJ.js";var se=50;function re(r){let i=[];for(let e=0;e<r.length;e++){let[t,a]=r[e],[s,n]=r[e+1]??[];a===n&&a<=se&&(t==="I"&&s==="D"||t==="D"&&s==="I")?(i.push(["X",a]),e++):i.push([t,a])}return i}function E(r){return Array.from(r.ids,(i,e)=>2*i+r.rev[e])}function A(r,i){let e=r.get(i);return e===void 0?0:e.end-e.start}function V(r){let i=new Map,e=s=>{let n=A(r,s),o=i.get(n);return o===void 0&&(o="N".repeat(n),i.set(n,o)),o},t=new Map,a=s=>{let n=t.get(s);return n===void 0&&(n=E(s),t.set(s,n)),n};return(s,n)=>_({query:a(s),target:a(n),sequenceOf:e,bases:!1})}var B=100;function v(r,i,e){let t=r.at(-1);e>0&&(t?.[0]===i?t[1]+=e:r.push([i,e]))}function Z(r){let i=t=>A(r,t>>1),e=t=>{let a=new Float64Array(t.length+1);return t.forEach((s,n)=>{a[n+1]=a[n]+i(s)}),a};return(t,a)=>{let s=E(a),n=E(t),[o,l]=M(n,s,i),[u,f]=M(n.map(g=>g^1).reverse(),s,i),c=f>l,p=c?u:o,N=Math.max(l,f);if(N<B)return[];let h=e(s),d=e(n),y=g=>c?n.length-1-p[g][0]:p[g][0],m=[];p.forEach(([,g],k)=>{if(k>0){let[ee,te]=[y(k-1),y(k)].sort((ae,ne)=>ae-ne);v(m,"I",d[te]-d[ee+1]),v(m,"D",h[g]-h[p[k-1][1]+1])}v(m,"=",i(s[g]))});let[b,P]=[y(0),y(p.length-1)].sort((g,k)=>g-k);return[{queryStart:d[b],queryEnd:d[P+1],targetStart:h[p[0][1]],targetEnd:h[p.at(-1)[1]+1],strand:c?"-":"+",edits:m,sharedBases:N}]}}function oe(r){let i=new Map,e=new Set;r.ids.forEach((t,a)=>{i.has(t)?e.add(t):i.set(t,r.rev[a])});for(let t of e)i.delete(t);return i}function J(r){let i=new Map,e=t=>{let a=i.get(t);return a===void 0&&(a=oe(t),i.set(t,a)),a};return(t,a)=>{let s=e(a),n=0,o=0;for(let[l,u]of e(t)){let f=s.get(l);f===u?n+=A(r,l):f!==void 0&&(o+=A(r,l))}return{same:n,opposite:o}}}function Q(r){let i=Z(r),e=V(r),t=J(r);return(a,s)=>{let{same:n,opposite:o}=t(a,s);return n>=B&&o>=B?e(a,s):i(a,s)}}var ie=1e4;function Y(r){let i=Z(r),e=V(r),t=J(r);return(a,s)=>{let n=i(a,s),o=n[0]?.strand,{same:l,opposite:u}=t(a,s);return o===void 0||Math.min(l,u)<ie?n:[...n,...e(a,s).filter(f=>f.strand!==o)]}}function C({chain:r,target:i,query:e,assemblyName:t,refName:a,mateAssemblyName:s}){let n=re(r.edits);return G({target:{name:i.name,assemblyName:t,refName:a,start:i.hapStart+r.targetStart,end:i.hapStart+r.targetEnd},query:{name:e.name,assemblyName:s,refName:W(e.name),start:e.hapStart+r.queryStart,end:e.hapStart+r.queryEnd},strand:r.strand,cigar:T(n),matches:n.reduce((o,[l,u])=>o+(l==="="?u:0),0),columns:n.reduce((o,[,l])=>o+l,0)})}var me=r=>I(r.name)??r.name,L=class extends ${constructor(){super(...arguments);this.walks=new K(D(this,["walksLocation"],["walksIndex"]),this);this.refNames=new H(this.walks.file,this)}get anchor(){let e=this.getConf("assemblyNames")[0];if(e===void 0)throw new Error("WalkTabixSyntenyAdapter needs assemblyNames: its first entry is the assembly the reference sample is loaded as");return e}async getHaplotypeNames(e={}){return this.walks.haplotypeNames(e)}async getHeader(e={}){let{haplotypes:t}=await this.walks.reader.header(e),{anchor:a}=this,s=w(this,a),n=x(this);return{hasCoarseTier:!1,anchorAssemblyName:a,lanes:t.filter(o=>o!==s&&S(o)!==s).map(o=>({name:O(n,o),label:o,group:S(o)}))}}async getRefNames(e={}){let{assemblyName:t}=e;return t===void 0||t===this.anchor?this.refNames.assemblyRefNames({...e,assemblyName:this.anchor}):[]}async getSubgraph(e,t={}){let a=await this.refNames.resolveForCut(e,{signal:t.signal});return this.walks.subgraph(a,e,t)}async laneWalks(e,t,a,s,n){let o=j(a,e);return R(n,s.statusCallback,()=>this.walks.reader.cut(e,t,{...this.walks.budgets(),signal:s.signal,keep:o,expand:o,links:!1}).catch(l=>{throw z(l,t.end-t.start)}))}async anchorFeatures(e,t,a){let s=a.haplotypes?.length?a.haplotypes.map(m=>w(this,m)):void 0,n=w(this,a.targetAssemblyName),o=n===void 0?s:s===void 0||s.some(m=>F(n,m)||F(m,n))?[n]:[];if(o?.length===0)return[];let{start:l,end:u}=t,{graph:f,fragments:c}=await this.laneWalks(e,t,o,a,`Reading walks ${t.refName}:${l.toLocaleString()}-${u.toLocaleString()}`),p=Y(f.nodes),N=x(this),h=c.filter(m=>m.name===e),d=m=>o===void 0?0:o.findIndex(b=>F(m.name,b));return c.filter(m=>m.name!==e&&d(m)>=0).sort((m,b)=>d(m)-d(b)).flatMap(m=>h.flatMap(b=>p(m,b).map(P=>C({chain:P,target:b,query:m,assemblyName:t.assemblyName,refName:t.refName,mateAssemblyName:O(N,me(m))}))))}async pairFeatures(e,t,a,s){let n=a.map(c=>({pair:c,featurePrefix:w(this,c.queryAssemblyName),matePrefix:w(this,c.targetAssemblyName)})),{graph:o,fragments:l}=await this.laneWalks(e,t,n.flatMap(c=>[c.featurePrefix,c.matePrefix]),s,X(a)),u=Q(o.nodes),f=c=>l.filter(p=>F(p.name,c));return n.flatMap(({pair:c,featurePrefix:p,matePrefix:N})=>f(p).flatMap(h=>f(N).flatMap(d=>u(d,h).map(y=>C({chain:y,target:h,query:d,assemblyName:c.queryAssemblyName,refName:W(h.name),mateAssemblyName:c.targetAssemblyName})))))}getFeatures(e,t={}){return q(async a=>{let s=e.assemblyName===this.anchor?await this.refNames.resolve(e,t):void 0;if(s!==void 0){let n=U(t),o=n.length>0?await this.pairFeatures(s,e,n,t):await this.anchorFeatures(s,e,t);for(let l of o)a.next(l)}a.complete()},t.signal)}};export{L as default};
|
|
2
|
+
//# sourceMappingURL=WalkTabixSyntenyAdapter-LA22PX4I.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Ca as He,Da as $e,Ea as Ke,Eb as Je,Fa as Xe,Gb as G,Hb as be,Ia as Ue,Ib as fe,Ma as Fe,Mb as Ze,Na as ie,Ob as Qe,Qa as Ye,Rb as he,Ta as ze,Ua as le,Vb as et,Ya as ce,_b as tt,a as Se,b as X,ca as Ae,cb as Ve,ec as nt,f as Q,g as ee,gc as rt,ib as qe,ka as S,kb as pe,la as ae,nb as je,ra as Ie,sa as Be,ta as We,ua as se,wa as Ge,xa as De,yb as ue,zb as de}from"./chunk-SL4JJJQJ.js";import{D as oe,f as Ee,m as I,p as re,q as Te,r as B}from"./chunk-W7IHIVSE.js";import{E as ne,T as Oe,U as Ne,Z as ve,n as E,p as F,q as te,y as _e}from"./chunk-CVHKXFVS.js";import{b as O,c as W}from"./chunk-BJHWGRMP.js";import{c as Z}from"./chunk-OGXVDZPS.js";import{e as K}from"./chunk-3WG3GF2A.js";import{b as Pe,d as M,e as Le,f as Me,g as U,h as Ce}from"./chunk-NIEZKWQV.js";import{a as T,b as u,c as k,d as m}from"./chunk-JMBDTNUR.js";var Lt="data-pans-with-drawing";function ot(e,t){return{position:"absolute",left:0,top:0,pointerEvents:"none",overflow:t,zIndex:e}}var C=m(function({model:t,zIndex:n,overflow:o="hidden",testId:r,pansWithDrawing:a,children:l}){return u("svg",{style:{...ot(n,o),userSelect:a?"none":void 0},width:t.paneWidth,height:t.canvasHeight,"data-testid":r,...a?{[Lt]:""}:{},children:l})}),at=m(function({model:t,children:n}){let{scaleX:o,scaleY:r,translateX:a,translateY:l}=t;return u("g",{transform:`translate(${a} ${l}) scale(${o} ${r})`,children:n})});function _({model:e,zIndex:t,shown:n=!0,testId:o,paint:r}){let a=Ce(null);return Le(()=>{if(n)return Se(()=>{let l=a.current,i=l?.getContext("2d");if(l&&i){let d=e.paneWidth,c=e.canvasHeight;Ae(rt());let p=Je(l,d,c);i.setTransform(p,0,0,p,0,0),i.clearRect(0,0,d,c),r(i,p)}})},[e,n,r]),u("canvas",{ref:a,"data-testid":n?o:void 0,style:{...ot(t),display:n?"block":"none"}})}var Mt=m(function({model:t}){let{bubbleHalos:n,hoveredBubble:o}=t;if(n.length===0)return null;let r=t.contigThickness*Ze;return u(C,{model:t,zIndex:2,testId:"graph-bubble-halos",children:u(at,{model:t,children:n.filter(a=>!a.whole&&(!a.tick||o&&O(a.bubble,o))).map(a=>u("path",{d:a.path,fill:"none",stroke:S[a.kind],strokeOpacity:o&&O(a.bubble,o)?.45:t.bubbleFaded(a)?.06:.22,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"},W(a.bubble)))})})}),In=Mt;var st=["#d4735e","#d8a94a","#c98aa4"],Ct="#e6e6e6",_t="#555",Et="bold 11px sans-serif";var ge=e=>st[e]??Ct;function Y(e){let t=String.fromCharCode(65+e%26);return e<26?t:Y(Math.floor(e/26)-1)+t}var z=st.length;function it(e,t,n){e.font=Et,e.textAlign="center",e.textBaseline="middle";for(let{row:o,start:r,bp:a,block:l}of t){let i=n.x(r),d=n.x(r+a)-i,c=n.rowCentre(o)-n.barPx/2;e.fillStyle=ge(l),e.fillRect(i,c,d,n.barPx),e.strokeStyle=_t,e.lineWidth=1,e.strokeRect(i+.5,c+.5,d-1,n.barPx-1),d>=12&&n.barPx>=9&&(e.fillStyle="#111",e.fillText(Y(l),i+d/2,n.rowCentre(o)))}}var R=18,me=32,pt="rgba(160, 160, 160, 0.45)",Nt="#18181c",vt=6,ut=7,Tt="#b8b8c0",V=Be-4,At="rgba(119, 119, 119, 0.85)",It=15,lt=10;function j(e){return e.kind==="fill"?e.width??R:R}var ke=e=>e.length>1?3:4;function D(e){switch(e.kind){case"fill":return e.height??8;case"bands":return ke(e.bands)*e.bands.length;case"line":return 3;case"halo":case"overhang":return 10;case"outline":case"tick":return e.height;case"glyph":return 15;case"bracket":return 7;case"blank":return 0}}function Nr(e){return e.reduce((t,n)=>n.swatch?Math.max(t,j(n.swatch)):t,0)}function vr(e){return e.reduce((t,n)=>n.swatch?Math.max(t,Math.ceil(D(n.swatch))+3):t,It)}var y=e=>[{offset:0,color:e}];function q(e,t,n){return{key:e,label:n,swatch:{kind:"fill",stops:y(t),width:lt,height:lt,edged:!0}}}function ct(e){return e.flatMap((t,n)=>[{offset:n/e.length,color:t},{offset:(n+1)/e.length,color:t}])}function Bt(e){let t=e.openBubble;if(!t)return[];let n=e.bubbleHalos.find(o=>O(o.bubble,t));return[{key:"open",label:`open: ${n?.label??"bubble"}`,swatch:n?{kind:"halo",color:S[n.kind]}:{kind:"blank"},closesBubble:!0}]}function Wt(e){let t=e.walkLift?void 0:e.referenceRampDomain;if(!t)return[];let n=Math.round(t.start),o=Math.round(t.end);return[{key:"ramp",label:`position on ${e.graph?Z(e.graph):"reference"}`,swatch:{kind:"fill",stops:I,width:me},under:`${n.toLocaleString("en-US")}-${o.toLocaleString("en-US")} (${ne(o-n)})`},...e.referenceRampDrawsOffReference?[q("off",B,"off the reference")]:[]]}function Gt(e){let t=e.walkLift;if(t)return t.walks.map(r=>oe(r.encoding));if(e.effectiveColorScheme==="reference-position")return[I];let n=e.referenceStripBlocks.map(r=>r.colors[0]).filter((r,a,l)=>r!==l[a-1]),o=Math.min(vt,n.length);return[o===0?y(re):Array.from({length:o},(r,a)=>({offset:o>1?a/(o-1):0,color:n[o>1?Math.round(a*(n.length-1)/(o-1)):0]}))]}function Dt(e){if(!e.referenceStripShown)return[];let t=(e.walkLift?.walks.length??0)>1;return[{key:"strip",label:`reference${t?", a row per walk":""}`,swatch:{kind:"bands",bands:Gt(e)}},...e.referenceStripFaded?[q("strip-faded",re,e.walkLift?`reference not on ${t?"that row's walk":e.liftedWalksLabel}`:"reference outside the open bubble")]:[],...e.referenceStripOverhangs?[{key:"overhang",label:"graph runs past this edge",swatch:{kind:"overhang"}}]:[]]}function Ht(e){let t=new Map;for(let n of e.bubbleHalos)if(!n.whole){let o=S[n.kind],r=t.get(o)??new Set;r.add(ae[n.kind]),t.set(o,r)}return[...t].map(([n,o])=>{let r=[...o].join(" or ");return{key:`halo-${n}`,label:r===ae.superbubble?r:`${r} bubble`,swatch:{kind:"halo",color:n}}})}function dt(e){let{graph:t}=e;return t&&e.deletions.length>0?[{key:"deletion",label:_e(Z(t)),swatch:{kind:"line",color:e.walkLift?pt:Nt,dashed:!0}}]:[]}function we(e,t,n,o){return{key:e,label:t,swatch:{kind:"fill",stops:y(o),width:me,height:n}}}var $t=e=>e>=10?Math.round(e):Math.round(e*10)/10;function Kt(e){let{graph:t,contigThickness:n,depthRange:o}=e;if(!t||!e.drawsNodes||e.walkRowBars)return[];if(e.nodeWidth==="frequency"){let c=t.nodes.some(p=>p.frequency!==void 0);return Oe(n).map(({label:p,widthPx:b})=>we(`width-${p}`,c?`AF ${p}`:`${p} of haplotypes`,b,B))}if(e.nodeWidth!=="depth"||!o||o.min===o.max)return[];let r=t.paths?.length??0,a=r>0,l=[...new Set([o.max,o.mean,o.min].map(a?Math.round:$t))],i=l[0]>r,d=c=>i?`${c.toLocaleString("en-US")} walk pass${c===1?"":"es"}`:`${c.toLocaleString("en-US")} walk${c===1?"":"s"}`;return l.map(c=>we(`width-${c}`,a?d(c):`depth ${c.toLocaleString("en-US")}`,Ne({depth:c},n,"depth",o.mean),B))}function Xt(e){let t=e.busiestLink;return!e.drawsNodes||e.walkRowBars||e.linkWidth!=="walks"||t===0?[]:(t>1?[t,1]:[1]).map(o=>we(`link-width-${o}`,`${o.toLocaleString("en-US")} walk${o===1?"":"s"}`,e.connectorThickness*ve(o,t,"walks"),At))}function Ut(e){return e.genePins.some(t=>t.exonsByNode.length>0)?[{key:"exon",label:"exon",swatch:{kind:"outline",color:G,stroke:2,radius:5,height:8}}]:[]}function Ft(e){let t=e.foldNote;return t?[{key:"fold",label:t}]:[]}function Yt(e){return e.pathLegend.map(({name:t,label:n,color:o})=>({key:`path-${t}`,label:n,swatch:{kind:"line",color:o}}))}function N(e,t,n){return{key:e,label:n,swatch:{kind:"fill",stops:t,height:ut,square:!0}}}function zt(e){let{roles:t,haplotypeTube:n,bundled:o,values:r,logWidths:a,foldBp:l,forwardReads:i,reverseReads:d,substitution:c,insertion:p,deletion:b}=e.tubeMapKeys,h=e.readsShown,s=[];if(r){s.push(N("value-reference",y(pe),"reference"));for(let{value:f,color:g}of r)s.push(N(`value-${f}`,y(g),f))}return t&&s.push(N("ref",y(pe),"reference"),N("hap",y(n),o?"shared route, \xD7n haplotypes":"haplotype")),i&&s.push(N("fwd",ct(Q),"read on the forward strand")),d&&s.push(N("rev",ct(ee),"read on the reverse strand")),h&&h.shown<h.total&&s.push({key:"sampled",label:`${h.shown.toLocaleString("en-US")} of ${h.total.toLocaleString("en-US")} reads shown`,swatch:{kind:"blank"}}),c&&s.push({key:"sub",label:"read mismatch",swatch:{kind:"glyph",char:"A"}}),p&&s.push({key:"ins",label:"read insertion",swatch:{kind:"glyph",char:"*"}}),b&&s.push(N("del",y("grey"),"read deletion")),l!==void 0&&s.push({key:"tube-fold",label:`haplotype variant < ${ne(l)}`,swatch:{kind:"tick",color:ze(),height:ut,backing:Tt}}),a&&s.push({key:"log",label:"width grows with log of length",swatch:{kind:"bracket"}}),s}function Vt(e){return e.kind==="gene"?{kind:"outline",color:Ie,stroke:1.5,radius:0,height:V}:{kind:"fill",stops:e.kind==="bar"&&e.ramp?I:y(e.fill),height:e.kind==="gap"?e.px:V}}function qt(e){let t=new Set(e.sharedBlocks?.map(o=>o.block)),n=o=>({kind:"fill",stops:y(ge(o)),height:V});return[...[...t].filter(o=>o<z).sort((o,r)=>o-r).map(o=>({key:`block-${o}`,label:`${Y(o)}: off the reference, walked by several rows`,swatch:n(o)})),...[...t].some(o=>o>=z)?[{key:"block-more",label:"more shared blocks",swatch:n(z)}]:[]]}function jt(e){let t=e.walkRowBars;if(!t)return[];let n=[t.reference,...t.rows].flatMap(r=>r.call??[]),o=(r,a,l)=>({key:r,label:l,swatch:{kind:"tick",color:a,height:V}});return[...He(t,{ramp:e.referenceRampDomain,genes:e.walkRowGeneKey,annotation:e.walkRowAnnotation}).map(r=>({key:`rows-${r.label}`,label:r.label,swatch:r.note?void 0:Vt(r.swatch)})),...qt(e),...n.some(r=>r.spanningReads!==0)?[o("call",$e,"allele length called for this walk")]:[],...n.some(r=>r.spanningReads===0)?[o("unbacked",Ke,"called with no read spanning it")]:[],...n.some(r=>r.agrees===!1)?[o("disagrees",Xe,`walk and call over ${Math.round(.1*100)}% apart`)]:[]]}function Jt(e,t){let n=et(t,e.walkReference);return{key:`walk-${t.name}`,strong:e.walkLabel(t.name),label:n.delta+n.gaps+n.reversed,swatch:{kind:"fill",stops:oe(t.encoding),width:n.shades?me:R},under:n.scale,title:n.hover,walk:t}}function bt(e,t){return[...e.liftPaintsOffReference?[q("lift-off",B,"off the reference")]:[],q("faded",pt,t)]}function Zt(e){let t=e.walkLift;if(!t||e.facetPanels)return[];let n=t.walks.map(r=>Jt(e,r)),o=e.graph?he(e.graph,t,e.liftedWalksLabel):`not on ${e.liftedWalksLabel}`;return[...n,...bt(e,o)]}function Tr(e){let{graph:t,facetPanels:n}=e;if(!t||!n)return[];let o=new Set(n.map(r=>he(t,r,"the panel's walk")));return[...bt(e,o.size===1?[...o][0]:"not on the panel's walk"),...dt(e)]}function Ar(e){let t=[{testid:"graph-open-bubble-legend",rows:Bt(e)},{testid:"graph-ramp-legend",rows:Wt(e),group:"Color"},{testid:"graph-walk-readout",rows:Zt(e),group:"Walks"},{testid:"graph-width-legend",rows:Kt(e),group:"Node thickness"},{testid:"graph-link-width-legend",rows:Xt(e),group:"Link thickness"},{testid:"graph-halo-legend",rows:Ht(e),group:"Marks"},{testid:"graph-deletion-legend",rows:dt(e),group:"Marks"},{testid:"graph-gene-legend",rows:Ut(e),group:"Marks"},{testid:"graph-path-legend",rows:Yt(e),group:"Paths"},{testid:"graph-tube-map-legend",rows:zt(e),group:"Tube map"},{testid:"graph-walk-rows-legend",rows:jt(e),group:"Walk rows"},{testid:"graph-reference-strip-legend",rows:Dt(e),group:"Top strip"},{testid:"graph-fold-legend",rows:Ft(e)}].filter(r=>r.rows.length>0);if(new Set(t.flatMap(r=>r.group??[])).size<2)return t;let o=new Set;return t.map((r,a)=>{let{group:l}=r;return l?o.has(l)?r:(o.add(l),{...r,heading:l}):a===0?r:{...r,spaced:!0}})}function Qt(e){return e==="class"?"className":/^(data|aria)-/.test(e)?e:e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function ft(e,t){if(typeof e=="string")return e;let n={key:t};for(let[o,r]of Object.entries(e.attrs))r!==void 0&&(n[Qt(o)]=r);return Pe(e.tag,n,e.children.map(ft))}function A(){return Me().replaceAll(/[^\w-]/g,"")}function H({el:e}){return ft(e,0)}var en="rgba(0, 0, 0, 0.28)";function ht({id:e,x:t,y:n,stops:o,width:r,height:a,square:l,edged:i}){let d=i?.5:0,c=p=>u("rect",{x:t+d,y:n+d,width:r-d*2,height:a-d*2,rx:l?0:2,fill:p,stroke:i?en:void 0});return o.length>1?k(T,{children:[u("defs",{children:u("linearGradient",{id:e,children:o.map((p,b)=>u("stop",{offset:p.offset,stopColor:p.color},b))})}),c(`url(#${e})`)]}):c(o[0].color)}function tn({swatch:e,x:t,id:n}){switch(e.kind){case"fill":{let r=D(e);return u(ht,{id:n,x:t,y:-5-r/2,stops:e.stops,width:j(e),height:r,square:e.square,edged:e.edged})}case"bands":{let r=ke(e.bands),a=-5-D(e)/2;return u(T,{children:e.bands.map((l,i)=>u(ht,{id:`${n}-${i}`,x:t,y:a+i*r,stops:l,width:R,height:r,square:!0},i))})}case"line":return e.dashed?u("line",{x1:t+1,x2:t+R,y1:-5,y2:-5,stroke:e.color,strokeWidth:3,strokeDasharray:"4 3"}):u("rect",{x:t,y:-5-1.5,width:R,height:3,rx:2,fill:e.color});case"halo":return u("line",{x1:t+5,x2:t+13,y1:-5,y2:-5,stroke:e.color,strokeOpacity:.35,strokeWidth:8,strokeLinecap:"round"});case"outline":{let r=e.stroke/2;return u("rect",{x:t+r,y:-5-e.height/2+r,width:R-e.stroke,height:e.height-e.stroke,rx:Math.max(0,e.radius-r),fill:"none",stroke:e.color,strokeWidth:e.stroke})}case"overhang":return u("path",{transform:`translate(${t} -10)`,d:"M0,5 L8,0 L8,10 Z M18,5 L10,0 L10,10 Z",fill:"#18181c"});case"glyph":return u("text",{x:t+R/2,y:-1,textAnchor:"middle",fontFamily:"monospace",fontSize:12,fill:"currentColor",children:e.char});case"tick":{let r=-5-e.height/2;return k(T,{children:[e.backing?u("rect",{x:t,y:r,width:R,height:e.height,fill:e.backing}):null,u("rect",{x:t+R/2-1,y:r,width:2,height:e.height,fill:e.color})]})}case"bracket":return u("path",{transform:`translate(${t} ${-5-3.5})`,d:`M0.5,6 V1.5 H5.5 V6 M8.5,6 V1.5 H${R-.5} V6`,fill:"none",stroke:Fe()});case"blank":return null}}function $r({swatch:e}){let t=A(),n=D(e);return u("svg",{width:j(e),height:n,overflow:"visible",style:{flex:"none"},children:u("g",{transform:`translate(0 ${n/2+5})`,children:u(tn,{swatch:e,x:0,id:t})})})}var Ur={background:"#fff",padding:"3px 6px",fontSize:11,lineHeight:"15px",whiteSpace:"nowrap"},Fr={display:"flex",alignItems:"center",gap:5},Yr={color:"#666"},nn="#6b7479",zr=4,Vr={color:nn,fontSize:9.5,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase"};var rn=m(function({model:t}){let n=`exon-outline-${A()}`,o=U(()=>X(()=>{let{genePins:b,walkLift:h}=t,s=h?void 0:t.openBubbleFocus,f=s?b.map(g=>({...g,exonsByNode:g.exonsByNode.filter(w=>s.nodeIds.has(w.nodeId))})):b;return be(f,t.nodeInk.halfWidthPx,h)}),[t]),{scaleX:r,scaleY:a,translateX:l,translateY:i,paneWidth:d,canvasHeight:c}=t,p=fe(o.get(),{id:n,width:d,height:c,transform:`translate(${l} ${i}) scale(${r} ${a})`});return p?u(C,{model:t,zIndex:2,testId:"graph-gene-pins",children:u(H,{el:p})}):null}),no=rn;function gt(e,t,n){return{x:e-n/2,y:t-E-F+2,width:n,height:E+F*2-2}}function wt(e,t,n){let o=gt(e.x,e.y,e.w);return t>=o.x&&t<=o.x+o.width&&n>=o.y&&n<=o.y+o.height}function $({x:e,y:t,w:n,text:o,note:r,color:a,edge:l=a,italic:i,dimmed:d,title:c,testId:p,onClick:b,onHover:h}){return k("g",{style:{pointerEvents:b||h?"auto":"none",cursor:b?"pointer":void 0,opacity:d?.35:1},"data-testid":p,onClick:b,onMouseEnter:()=>{h?.(!0)},onMouseLeave:()=>{h?.(!1)},...b&&{role:"button",tabIndex:0,"aria-label":(c??o).replaceAll(`
|
|
1
|
+
import{Ca as He,Da as $e,Ea as Ke,Eb as Je,Fa as Xe,Gb as G,Hb as be,Ia as Ue,Ib as fe,Ma as Fe,Mb as Ze,Na as ie,Ob as Qe,Qa as Ye,Rb as he,Ta as ze,Ua as le,Vb as et,Ya as ce,_b as tt,a as Se,b as X,ca as Ae,cb as Ve,ec as nt,f as Q,g as ee,gc as rt,ib as qe,ka as S,kb as pe,la as ae,nb as je,ra as Ie,sa as Be,ta as We,ua as se,wa as Ge,xa as De,yb as ue,zb as de}from"./chunk-MHIKXNVU.js";import{D as oe,f as Ee,m as I,p as re,q as Te,r as B}from"./chunk-AUQISDXJ.js";import{E as ne,T as Oe,U as Ne,Z as ve,n as E,p as F,q as te,y as _e}from"./chunk-NSBH4FIW.js";import{b as O,c as W}from"./chunk-PEE2MP7K.js";import{c as Z}from"./chunk-DSKPOCCE.js";import{e as K}from"./chunk-3WG3GF2A.js";import{b as Pe,d as M,e as Le,f as Me,g as U,h as Ce}from"./chunk-NIEZKWQV.js";import{a as T,b as u,c as k,d as m}from"./chunk-JMBDTNUR.js";var Lt="data-pans-with-drawing";function ot(e,t){return{position:"absolute",left:0,top:0,pointerEvents:"none",overflow:t,zIndex:e}}var C=m(function({model:t,zIndex:n,overflow:o="hidden",testId:r,pansWithDrawing:a,children:l}){return u("svg",{style:{...ot(n,o),userSelect:a?"none":void 0},width:t.paneWidth,height:t.canvasHeight,"data-testid":r,...a?{[Lt]:""}:{},children:l})}),at=m(function({model:t,children:n}){let{scaleX:o,scaleY:r,translateX:a,translateY:l}=t;return u("g",{transform:`translate(${a} ${l}) scale(${o} ${r})`,children:n})});function _({model:e,zIndex:t,shown:n=!0,testId:o,paint:r}){let a=Ce(null);return Le(()=>{if(n)return Se(()=>{let l=a.current,i=l?.getContext("2d");if(l&&i){let d=e.paneWidth,c=e.canvasHeight;Ae(rt());let p=Je(l,d,c);i.setTransform(p,0,0,p,0,0),i.clearRect(0,0,d,c),r(i,p)}})},[e,n,r]),u("canvas",{ref:a,"data-testid":n?o:void 0,style:{...ot(t),display:n?"block":"none"}})}var Mt=m(function({model:t}){let{bubbleHalos:n,hoveredBubble:o}=t;if(n.length===0)return null;let r=t.contigThickness*Ze;return u(C,{model:t,zIndex:2,testId:"graph-bubble-halos",children:u(at,{model:t,children:n.filter(a=>!a.whole&&(!a.tick||o&&O(a.bubble,o))).map(a=>u("path",{d:a.path,fill:"none",stroke:S[a.kind],strokeOpacity:o&&O(a.bubble,o)?.45:t.bubbleFaded(a)?.06:.22,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"},W(a.bubble)))})})}),In=Mt;var st=["#d4735e","#d8a94a","#c98aa4"],Ct="#e6e6e6",_t="#555",Et="bold 11px sans-serif";var ge=e=>st[e]??Ct;function Y(e){let t=String.fromCharCode(65+e%26);return e<26?t:Y(Math.floor(e/26)-1)+t}var z=st.length;function it(e,t,n){e.font=Et,e.textAlign="center",e.textBaseline="middle";for(let{row:o,start:r,bp:a,block:l}of t){let i=n.x(r),d=n.x(r+a)-i,c=n.rowCentre(o)-n.barPx/2;e.fillStyle=ge(l),e.fillRect(i,c,d,n.barPx),e.strokeStyle=_t,e.lineWidth=1,e.strokeRect(i+.5,c+.5,d-1,n.barPx-1),d>=12&&n.barPx>=9&&(e.fillStyle="#111",e.fillText(Y(l),i+d/2,n.rowCentre(o)))}}var R=18,me=32,pt="rgba(160, 160, 160, 0.45)",Nt="#18181c",vt=6,ut=7,Tt="#b8b8c0",V=Be-4,At="rgba(119, 119, 119, 0.85)",It=15,lt=10;function j(e){return e.kind==="fill"?e.width??R:R}var ke=e=>e.length>1?3:4;function D(e){switch(e.kind){case"fill":return e.height??8;case"bands":return ke(e.bands)*e.bands.length;case"line":return 3;case"halo":case"overhang":return 10;case"outline":case"tick":return e.height;case"glyph":return 15;case"bracket":return 7;case"blank":return 0}}function Nr(e){return e.reduce((t,n)=>n.swatch?Math.max(t,j(n.swatch)):t,0)}function vr(e){return e.reduce((t,n)=>n.swatch?Math.max(t,Math.ceil(D(n.swatch))+3):t,It)}var y=e=>[{offset:0,color:e}];function q(e,t,n){return{key:e,label:n,swatch:{kind:"fill",stops:y(t),width:lt,height:lt,edged:!0}}}function ct(e){return e.flatMap((t,n)=>[{offset:n/e.length,color:t},{offset:(n+1)/e.length,color:t}])}function Bt(e){let t=e.openBubble;if(!t)return[];let n=e.bubbleHalos.find(o=>O(o.bubble,t));return[{key:"open",label:`open: ${n?.label??"bubble"}`,swatch:n?{kind:"halo",color:S[n.kind]}:{kind:"blank"},closesBubble:!0}]}function Wt(e){let t=e.walkLift?void 0:e.referenceRampDomain;if(!t)return[];let n=Math.round(t.start),o=Math.round(t.end);return[{key:"ramp",label:`position on ${e.graph?Z(e.graph):"reference"}`,swatch:{kind:"fill",stops:I,width:me},under:`${n.toLocaleString("en-US")}-${o.toLocaleString("en-US")} (${ne(o-n)})`},...e.referenceRampDrawsOffReference?[q("off",B,"off the reference")]:[]]}function Gt(e){let t=e.walkLift;if(t)return t.walks.map(r=>oe(r.encoding));if(e.effectiveColorScheme==="reference-position")return[I];let n=e.referenceStripBlocks.map(r=>r.colors[0]).filter((r,a,l)=>r!==l[a-1]),o=Math.min(vt,n.length);return[o===0?y(re):Array.from({length:o},(r,a)=>({offset:o>1?a/(o-1):0,color:n[o>1?Math.round(a*(n.length-1)/(o-1)):0]}))]}function Dt(e){if(!e.referenceStripShown)return[];let t=(e.walkLift?.walks.length??0)>1;return[{key:"strip",label:`reference${t?", a row per walk":""}`,swatch:{kind:"bands",bands:Gt(e)}},...e.referenceStripFaded?[q("strip-faded",re,e.walkLift?`reference not on ${t?"that row's walk":e.liftedWalksLabel}`:"reference outside the open bubble")]:[],...e.referenceStripOverhangs?[{key:"overhang",label:"graph runs past this edge",swatch:{kind:"overhang"}}]:[]]}function Ht(e){let t=new Map;for(let n of e.bubbleHalos)if(!n.whole){let o=S[n.kind],r=t.get(o)??new Set;r.add(ae[n.kind]),t.set(o,r)}return[...t].map(([n,o])=>{let r=[...o].join(" or ");return{key:`halo-${n}`,label:r===ae.superbubble?r:`${r} bubble`,swatch:{kind:"halo",color:n}}})}function dt(e){let{graph:t}=e;return t&&e.deletions.length>0?[{key:"deletion",label:_e(Z(t)),swatch:{kind:"line",color:e.walkLift?pt:Nt,dashed:!0}}]:[]}function we(e,t,n,o){return{key:e,label:t,swatch:{kind:"fill",stops:y(o),width:me,height:n}}}var $t=e=>e>=10?Math.round(e):Math.round(e*10)/10;function Kt(e){let{graph:t,contigThickness:n,depthRange:o}=e;if(!t||!e.drawsNodes||e.walkRowBars)return[];if(e.nodeWidth==="frequency"){let c=t.nodes.some(p=>p.frequency!==void 0);return Oe(n).map(({label:p,widthPx:b})=>we(`width-${p}`,c?`AF ${p}`:`${p} of haplotypes`,b,B))}if(e.nodeWidth!=="depth"||!o||o.min===o.max)return[];let r=t.paths?.length??0,a=r>0,l=[...new Set([o.max,o.mean,o.min].map(a?Math.round:$t))],i=l[0]>r,d=c=>i?`${c.toLocaleString("en-US")} walk pass${c===1?"":"es"}`:`${c.toLocaleString("en-US")} walk${c===1?"":"s"}`;return l.map(c=>we(`width-${c}`,a?d(c):`depth ${c.toLocaleString("en-US")}`,Ne({depth:c},n,"depth",o.mean),B))}function Xt(e){let t=e.busiestLink;return!e.drawsNodes||e.walkRowBars||e.linkWidth!=="walks"||t===0?[]:(t>1?[t,1]:[1]).map(o=>we(`link-width-${o}`,`${o.toLocaleString("en-US")} walk${o===1?"":"s"}`,e.connectorThickness*ve(o,t,"walks"),At))}function Ut(e){return e.genePins.some(t=>t.exonsByNode.length>0)?[{key:"exon",label:"exon",swatch:{kind:"outline",color:G,stroke:2,radius:5,height:8}}]:[]}function Ft(e){let t=e.foldNote;return t?[{key:"fold",label:t}]:[]}function Yt(e){return e.pathLegend.map(({name:t,label:n,color:o})=>({key:`path-${t}`,label:n,swatch:{kind:"line",color:o}}))}function N(e,t,n){return{key:e,label:n,swatch:{kind:"fill",stops:t,height:ut,square:!0}}}function zt(e){let{roles:t,haplotypeTube:n,bundled:o,values:r,logWidths:a,foldBp:l,forwardReads:i,reverseReads:d,substitution:c,insertion:p,deletion:b}=e.tubeMapKeys,h=e.readsShown,s=[];if(r){s.push(N("value-reference",y(pe),"reference"));for(let{value:f,color:g}of r)s.push(N(`value-${f}`,y(g),f))}return t&&s.push(N("ref",y(pe),"reference"),N("hap",y(n),o?"shared route, \xD7n haplotypes":"haplotype")),i&&s.push(N("fwd",ct(Q),"read on the forward strand")),d&&s.push(N("rev",ct(ee),"read on the reverse strand")),h&&h.shown<h.total&&s.push({key:"sampled",label:`${h.shown.toLocaleString("en-US")} of ${h.total.toLocaleString("en-US")} reads shown`,swatch:{kind:"blank"}}),c&&s.push({key:"sub",label:"read mismatch",swatch:{kind:"glyph",char:"A"}}),p&&s.push({key:"ins",label:"read insertion",swatch:{kind:"glyph",char:"*"}}),b&&s.push(N("del",y("grey"),"read deletion")),l!==void 0&&s.push({key:"tube-fold",label:`haplotype variant < ${ne(l)}`,swatch:{kind:"tick",color:ze(),height:ut,backing:Tt}}),a&&s.push({key:"log",label:"width grows with log of length",swatch:{kind:"bracket"}}),s}function Vt(e){return e.kind==="gene"?{kind:"outline",color:Ie,stroke:1.5,radius:0,height:V}:{kind:"fill",stops:e.kind==="bar"&&e.ramp?I:y(e.fill),height:e.kind==="gap"?e.px:V}}function qt(e){let t=new Set(e.sharedBlocks?.map(o=>o.block)),n=o=>({kind:"fill",stops:y(ge(o)),height:V});return[...[...t].filter(o=>o<z).sort((o,r)=>o-r).map(o=>({key:`block-${o}`,label:`${Y(o)}: off the reference, walked by several rows`,swatch:n(o)})),...[...t].some(o=>o>=z)?[{key:"block-more",label:"more shared blocks",swatch:n(z)}]:[]]}function jt(e){let t=e.walkRowBars;if(!t)return[];let n=[t.reference,...t.rows].flatMap(r=>r.call??[]),o=(r,a,l)=>({key:r,label:l,swatch:{kind:"tick",color:a,height:V}});return[...He(t,{ramp:e.referenceRampDomain,genes:e.walkRowGeneKey,annotation:e.walkRowAnnotation}).map(r=>({key:`rows-${r.label}`,label:r.label,swatch:r.note?void 0:Vt(r.swatch)})),...qt(e),...n.some(r=>r.spanningReads!==0)?[o("call",$e,"allele length called for this walk")]:[],...n.some(r=>r.spanningReads===0)?[o("unbacked",Ke,"called with no read spanning it")]:[],...n.some(r=>r.agrees===!1)?[o("disagrees",Xe,`walk and call over ${Math.round(.1*100)}% apart`)]:[]]}function Jt(e,t){let n=et(t,e.walkReference);return{key:`walk-${t.name}`,strong:e.walkLabel(t.name),label:n.delta+n.gaps+n.reversed,swatch:{kind:"fill",stops:oe(t.encoding),width:n.shades?me:R},under:n.scale,title:n.hover,walk:t}}function bt(e,t){return[...e.liftPaintsOffReference?[q("lift-off",B,"off the reference")]:[],q("faded",pt,t)]}function Zt(e){let t=e.walkLift;if(!t||e.facetPanels)return[];let n=t.walks.map(r=>Jt(e,r)),o=e.graph?he(e.graph,t,e.liftedWalksLabel):`not on ${e.liftedWalksLabel}`;return[...n,...bt(e,o)]}function Tr(e){let{graph:t,facetPanels:n}=e;if(!t||!n)return[];let o=new Set(n.map(r=>he(t,r,"the panel's walk")));return[...bt(e,o.size===1?[...o][0]:"not on the panel's walk"),...dt(e)]}function Ar(e){let t=[{testid:"graph-open-bubble-legend",rows:Bt(e)},{testid:"graph-ramp-legend",rows:Wt(e),group:"Color"},{testid:"graph-walk-readout",rows:Zt(e),group:"Walks"},{testid:"graph-width-legend",rows:Kt(e),group:"Node thickness"},{testid:"graph-link-width-legend",rows:Xt(e),group:"Link thickness"},{testid:"graph-halo-legend",rows:Ht(e),group:"Marks"},{testid:"graph-deletion-legend",rows:dt(e),group:"Marks"},{testid:"graph-gene-legend",rows:Ut(e),group:"Marks"},{testid:"graph-path-legend",rows:Yt(e),group:"Paths"},{testid:"graph-tube-map-legend",rows:zt(e),group:"Tube map"},{testid:"graph-walk-rows-legend",rows:jt(e),group:"Walk rows"},{testid:"graph-reference-strip-legend",rows:Dt(e),group:"Top strip"},{testid:"graph-fold-legend",rows:Ft(e)}].filter(r=>r.rows.length>0);if(new Set(t.flatMap(r=>r.group??[])).size<2)return t;let o=new Set;return t.map((r,a)=>{let{group:l}=r;return l?o.has(l)?r:(o.add(l),{...r,heading:l}):a===0?r:{...r,spaced:!0}})}function Qt(e){return e==="class"?"className":/^(data|aria)-/.test(e)?e:e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function ft(e,t){if(typeof e=="string")return e;let n={key:t};for(let[o,r]of Object.entries(e.attrs))r!==void 0&&(n[Qt(o)]=r);return Pe(e.tag,n,e.children.map(ft))}function A(){return Me().replaceAll(/[^\w-]/g,"")}function H({el:e}){return ft(e,0)}var en="rgba(0, 0, 0, 0.28)";function ht({id:e,x:t,y:n,stops:o,width:r,height:a,square:l,edged:i}){let d=i?.5:0,c=p=>u("rect",{x:t+d,y:n+d,width:r-d*2,height:a-d*2,rx:l?0:2,fill:p,stroke:i?en:void 0});return o.length>1?k(T,{children:[u("defs",{children:u("linearGradient",{id:e,children:o.map((p,b)=>u("stop",{offset:p.offset,stopColor:p.color},b))})}),c(`url(#${e})`)]}):c(o[0].color)}function tn({swatch:e,x:t,id:n}){switch(e.kind){case"fill":{let r=D(e);return u(ht,{id:n,x:t,y:-5-r/2,stops:e.stops,width:j(e),height:r,square:e.square,edged:e.edged})}case"bands":{let r=ke(e.bands),a=-5-D(e)/2;return u(T,{children:e.bands.map((l,i)=>u(ht,{id:`${n}-${i}`,x:t,y:a+i*r,stops:l,width:R,height:r,square:!0},i))})}case"line":return e.dashed?u("line",{x1:t+1,x2:t+R,y1:-5,y2:-5,stroke:e.color,strokeWidth:3,strokeDasharray:"4 3"}):u("rect",{x:t,y:-5-1.5,width:R,height:3,rx:2,fill:e.color});case"halo":return u("line",{x1:t+5,x2:t+13,y1:-5,y2:-5,stroke:e.color,strokeOpacity:.35,strokeWidth:8,strokeLinecap:"round"});case"outline":{let r=e.stroke/2;return u("rect",{x:t+r,y:-5-e.height/2+r,width:R-e.stroke,height:e.height-e.stroke,rx:Math.max(0,e.radius-r),fill:"none",stroke:e.color,strokeWidth:e.stroke})}case"overhang":return u("path",{transform:`translate(${t} -10)`,d:"M0,5 L8,0 L8,10 Z M18,5 L10,0 L10,10 Z",fill:"#18181c"});case"glyph":return u("text",{x:t+R/2,y:-1,textAnchor:"middle",fontFamily:"monospace",fontSize:12,fill:"currentColor",children:e.char});case"tick":{let r=-5-e.height/2;return k(T,{children:[e.backing?u("rect",{x:t,y:r,width:R,height:e.height,fill:e.backing}):null,u("rect",{x:t+R/2-1,y:r,width:2,height:e.height,fill:e.color})]})}case"bracket":return u("path",{transform:`translate(${t} ${-5-3.5})`,d:`M0.5,6 V1.5 H5.5 V6 M8.5,6 V1.5 H${R-.5} V6`,fill:"none",stroke:Fe()});case"blank":return null}}function $r({swatch:e}){let t=A(),n=D(e);return u("svg",{width:j(e),height:n,overflow:"visible",style:{flex:"none"},children:u("g",{transform:`translate(0 ${n/2+5})`,children:u(tn,{swatch:e,x:0,id:t})})})}var Ur={background:"#fff",padding:"3px 6px",fontSize:11,lineHeight:"15px",whiteSpace:"nowrap"},Fr={display:"flex",alignItems:"center",gap:5},Yr={color:"#666"},nn="#6b7479",zr=4,Vr={color:nn,fontSize:9.5,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase"};var rn=m(function({model:t}){let n=`exon-outline-${A()}`,o=U(()=>X(()=>{let{genePins:b,walkLift:h}=t,s=h?void 0:t.openBubbleFocus,f=s?b.map(g=>({...g,exonsByNode:g.exonsByNode.filter(w=>s.nodeIds.has(w.nodeId))})):b;return be(f,t.nodeInk.halfWidthPx,h)}),[t]),{scaleX:r,scaleY:a,translateX:l,translateY:i,paneWidth:d,canvasHeight:c}=t,p=fe(o.get(),{id:n,width:d,height:c,transform:`translate(${l} ${i}) scale(${r} ${a})`});return p?u(C,{model:t,zIndex:2,testId:"graph-gene-pins",children:u(H,{el:p})}):null}),no=rn;function gt(e,t,n){return{x:e-n/2,y:t-E-F+2,width:n,height:E+F*2-2}}function wt(e,t,n){let o=gt(e.x,e.y,e.w);return t>=o.x&&t<=o.x+o.width&&n>=o.y&&n<=o.y+o.height}function $({x:e,y:t,w:n,text:o,note:r,color:a,edge:l=a,italic:i,dimmed:d,title:c,testId:p,onClick:b,onHover:h}){return k("g",{style:{pointerEvents:b||h?"auto":"none",cursor:b?"pointer":void 0,opacity:d?.35:1},"data-testid":p,onClick:b,onMouseEnter:()=>{h?.(!0)},onMouseLeave:()=>{h?.(!1)},...b&&{role:"button",tabIndex:0,"aria-label":(c??o).replaceAll(`
|
|
2
2
|
`,", "),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),b())},onFocus:()=>{h?.(!0)},onBlur:()=>{h?.(!1)}},children:[c?u("title",{children:c}):null,u("rect",{...gt(e,t,n),rx:3,fill:"rgba(255,255,255,0.85)",stroke:l,strokeWidth:1}),k("text",{x:e,y:t,fontSize:E,fontFamily:"sans-serif",fontStyle:i?"italic":void 0,fontWeight:i?600:void 0,fill:a,textAnchor:"middle",children:[o,r?u("tspan",{fontStyle:"normal",fontWeight:"normal",children:r}):null]})]})}var mt="#1c1c22",Re=9,xe=3;function Po({genes:e},t,n){let o=e.find(l=>wt(l,t,n))?.item;if(!o)return;let{gene:r}=o,a=Qe(o);return{label:r.name,readout:`${r.refName}:${r.start.toLocaleString()}-${r.end.toLocaleString()}${a?`, ${a} in the cut`:""}`}}var on=m(function({model:t}){let{bubbles:n,genes:o,ticks:r}=t.overlayLabels;if(n.length+o.length+r.length===0)return null;let{scaleY:a,translateY:l,contigThickness:i,hoveredBubble:d}=t,c=d?r.find(s=>O(s.item.bubble,d)):void 0,p=s=>r[Number(s.getAttribute("data-tick"))],b=s=>t.bubbleFaded(s),h=s=>t.bubbleIsOpen(s.bubble);return k(C,{model:t,zIndex:3,testId:"graph-label-layer",pansWithDrawing:!0,children:[u("g",{"data-testid":"graph-bubble-ticks",onClick:s=>{let f=p(s.target);f&&t.toggleBubble(f.item.bubble)},onMouseOver:s=>{let f=p(s.target);f&&t.setHoveredBubble(f.item.bubble)},onMouseOut:()=>{K(t)&&t.setHoveredBubble(null)},onFocus:s=>{let f=p(s.target);f&&t.setHoveredBubble(f.item.bubble)},onBlur:()=>{K(t)&&t.setHoveredBubble(null)},onKeyDown:s=>{let f=p(s.target);f&&(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),t.toggleBubble(f.item.bubble))},children:r.map(({item:s,x:f,y:g},w)=>u("rect",{"data-tick":w,role:"button",tabIndex:0,"aria-label":`${s.label}, ${h(s)?"close":"open"} bubble`,x:f-xe/2,y:g-Re,width:xe,height:Re,rx:xe/2,fill:S[s.kind],opacity:b(s)?.35:1,style:{pointerEvents:"all",cursor:"pointer"}},W(s.bubble)))}),o.map(({item:s,x:f,y:g,w,text:P})=>{let{gene:x}=s;return k("g",{children:[u("line",{x1:f,x2:f,y1:g-E-2,y2:s.at.y*a+l+i/2,stroke:mt,strokeWidth:.8,strokeOpacity:.6}),u($,{x:f,y:g,w,text:x.name,note:P.slice(x.name.length)||void 0,color:mt,edge:G,italic:!0,testId:"graph-gene-pin-label"})]},`${x.name}-${x.start}`)}),n.map(({item:s,x:f,y:g,w,text:P})=>u($,{x:f,y:g,w,text:P,color:S[s.kind],dimmed:b(s),title:`${s.label}
|
|
3
3
|
${s.bubble.segmentCount} segments${s.bubble.covering?"":h(s)?" \xB7 click to close":" \xB7 click to open"}`,testId:"graph-bubble-halo-label",onClick:s.bubble.covering?void 0:()=>{t.toggleBubble(s.bubble)},onHover:x=>{K(t)&&t.setHoveredBubble(x?s.bubble:null)}},W(s.bubble))),c?u($,{x:c.x,y:c.y-Re-4,w:te(c.item.label),text:c.item.label,color:S[c.item.kind],testId:"graph-bubble-tick-label"}):null]})}),Lo=on;function an(e,t,{lit:n,dpr:o}){let r=t.hostBpFrame;r&&nt(e,t.referenceStripBlocks,r,{width:t.paneWidth,lit:n,dpr:o})}var sn=m(function({model:t}){let n=M((o,r)=>{an(o,t,{lit:t.referenceStripLit,dpr:r})},[t]);return u(_,{model:t,zIndex:5,shown:t.referenceStripShown,testId:"graph-reference-strip",paint:n})}),vo=sn;var ln=.45;function cn(e,t,{highlightNode:n}){let o=t.tubeMapPicture,r=t.tubeMapFrame;if(!o||!r)return;let a=t.paneWidth,l=t.tubeMapPanelViews;if(l){pn(e,t,l,n);return}let i={...r,width:a,highlightNode:n,tubeColors:t.tubeMapTubeColors,nodeColors:t.tubeMapNodeColors};ce(e,o,i);let d=t.layoutResult?.tubeMap;d&&(ue(e,o,d.graph,i),de(e,d,i)),le(e,t.tubeMapDeviations,i),Ye(e,t.tubeMapConnectors,t.connectorZoneBottom,i);let{bounds:c}=o;tt(e,t.tubeMapGenes,i,r.y(c.minY)-2);let p=t.tubeMapRulerBoxes;p&&ie(e,p,i,r.y(c.maxY)+4,t.layoutResult?.referenceAxis)}function pn(e,t,n,o){let r=t.paneWidth;for(let i of n){if(i.bottom<0||i.titleTop>t.canvasHeight)continue;let d={...i.frame,width:r,highlightNode:o,tubeColors:i.tubeColors,nodeColors:i.nodeColors};ce(e,i.picture,d),ue(e,i.picture,i.panel.result.tubeMap.graph,d),de(e,i.panel.result.tubeMap,d),e.globalAlpha=ln,le(e,i.deviations,d),e.globalAlpha=1,e.strokeStyle="rgba(0,0,0,0.15)",e.lineWidth=1,e.beginPath(),e.moveTo(0,Math.round(i.titleTop)+.5),e.lineTo(r,Math.round(i.titleTop)+.5),e.stroke(),e.font=je,e.textAlign="left",e.textBaseline="top",e.fillStyle="rgba(0,0,0,0.85)",e.fillText(i.label,6,i.titleTop+4)}let a=n.at(-1),l=t.tubeMapPanelRulerBoxes;a&&l&&ie(e,l,{...a.frame,width:r},a.bottom+4,!0)}var un=m(function({model:t}){let n=M(o=>{cn(o,t,{highlightNode:t.selectedNode})},[t]);return u(_,{model:t,zIndex:1,shown:!!t.tubeMapPicture,testId:"graph-tube-map",paint:n})}),Uo=un;var v=JBrowseExports["@jbrowse/render-core/marks"],dn=e=>v!=null&&e in Object(v)?v[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/render-core/marks' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e});var kt=dn("spanMark");var zo=v&&v.__esModule?v.default:v;function xt(e){if(e.startsWith("#")){let r=Number.parseInt(e.slice(1),16);return[r>>16&255,r>>8&255,r&255]}let[t=0,n=0,o=0]=e.match(/[\d.]+/g).map(Number);return e.startsWith("hsl")?Te(t,n/100,o/100).map(r=>r*255):[t,n,o]}var yt=([e,t,n])=>Ee(Math.round(e),Math.round(t),Math.round(n),255),Rt=new Map;function bn(e){let t=Rt.get(e);return t===void 0&&(t=yt(xt(e)),Rt.set(e,t)),t}function fn(e,t,n){let o=e.start+e.bp,r=De(e,t);if("fill"in r)return[[e.start,o,bn(r.fill)]];let a=r.stops.map(xt),l=r.stops.map(p=>Number(/[\d.]+/.exec(p)[0])),i=Math.abs(l.at(-1)-l[0]),d=Math.max(1,Math.min(Math.ceil(e.bp*n),Math.ceil(i),e.bp)),c=[];for(let p=0;p<d;p++){let b=(p+.5)/d*(a.length-1),h=Math.min(Math.floor(b),a.length-2),s=a[h],f=a[h+1],g=b-h;c.push([Math.round(e.start+e.bp*p/d),Math.round(e.start+e.bp*(p+1)/d),yt([0,1,2].map(w=>s[w]+(f[w]-s[w])*g))])}return c}function ye(e){return{x:new Uint32Array(e),x2:new Uint32Array(e),row:new Uint32Array(e),color:new Uint32Array(e),count:0}}function J(e,t,n){return{x:e.x.subarray(t,n),x2:e.x2.subarray(t,n),row:e.row.subarray(t,n),color:e.color.subarray(t,n),count:n-t}}function St(e,t,n){let o=e.map(h=>Ue(h.runs,t).map(s=>({gap:s.gap,hairline:s.gap&&Ge(s.cause).px===se,pieces:fn(s,n,t)}))),r=0;for(let h of o)for(let s of h)r+=s.pieces.length;let a=ye(r),l=ye(r),i=ye(r),d=new Uint32Array(e.length+1),c=new Uint32Array(e.length+1),p=new Uint32Array(e.length+1),b=1;return o.forEach((h,s)=>{for(let f of h){let g=f.hairline?i:f.gap?l:a;for(let[w,P,x]of f.pieces){let L=g.count++;g.x[L]=w,g.x2[L]=P,g.row[L]=s,g.color[L]=x,b=Math.max(b,g.x2[L])}}d[s+1]=a.count,c[s+1]=l.count,p[s+1]=i.count}),{bars:J(a,0,a.count),gaps:J(l,0,l.count),hairlines:J(i,0,i.count),barRows:d,gapRows:c,hairlineRows:p,longest:b}}function Pt(e,t,n){let{longest:o}=t,r={start:0,end:o,screenStartPx:n.origin*n.scaleX+n.translateX,screenEndPx:(n.origin+o)*n.scaleX+n.translateX,reversed:!1,displayedRegionIndex:0},a={canvasWidth:n.width,canvasHeight:n.height},l=n.rowPx*n.scaleY;for(let{first:i,count:d,rowY:c}of n.blocks){let p=l/2-n.translateY-(c-i*n.rowPx)*n.scaleY,b=(c-n.rowPx/2)*n.scaleY+n.translateY;if(!(b>n.height||b+d*l<0))for(let[h,s,f]of[[t.bars,t.barRows,n.barPx],[t.gaps,t.gapRows,Math.min(We,n.barPx)],[t.hairlines,t.hairlineRows,Math.min(se,n.barPx)]])kt.paintBlock(e,J(h,s[i],s[i+d]),r,a,{rowHeight:l,rowProportion:f/l,minWidthPx:1,seamPx:0,scrollTop:p})}}function hn({model:e}){let t=U(()=>X(()=>{let o=e.walkRowBars;return o?St([o.reference,...o.rows],e.scaleX,e.referenceRampDomain):void 0}),[e]),n=M(o=>{let r=e.walkRowBars,a=e.walkRowPlacement,l=e.walkRowPitch,i=t.get();if(!r||!a||!l||!i)return;let d=e.walkRowGroups?.sections,c=d?.length?[{first:0,count:1,rowY:a.rowY(0)},...d.map(p=>({first:p.first,count:p.count,rowY:a.rowY(p.first)}))]:[{first:0,count:r.rows.length+1,rowY:a.rowY(0)}];Pt(o,i,{...e.screenTransform,width:e.paneWidth,height:e.canvasHeight,rowPx:l.rowPx,barPx:l.barPx,origin:r.origin,blocks:c})},[e,t]);return u(_,{model:e,zIndex:3,testId:"graph-walk-rows-spans",paint:n})}var gn="rgba(160, 196, 232, 0.55)",wn="rgba(160, 140, 220, 0.55)";function mn({model:e}){let t=M(n=>{let o=e.walkRowRibbons,r=e.walkRowBars,a=e.walkRowPlacement,l=e.walkRowPitch;if(!o||!r||!a||!l)return;let{scaleX:i,scaleY:d,translateX:c,translateY:p}=e.screenTransform,b=s=>(r.origin+s)*i+c,h=l.barPx/2;for(let{row:s,a0:f,a1:g,b0:w,b1:P}of o){let x=a.rowY(s)*d+p+h,L=a.rowY(s+1)*d+p-h;n.fillStyle=w>P?wn:gn,n.beginPath(),n.moveTo(b(f),x),n.lineTo(b(g),x),n.lineTo(b(P),L),n.lineTo(b(w),L),n.closePath(),n.fill()}},[e]);return u(_,{model:e,zIndex:2,testId:"graph-walk-rows-ribbons",paint:t})}function kn({model:e}){let t=M(n=>{let o=e.sharedBlocks,r=e.walkRowBars,a=e.walkRowPlacement,l=e.walkRowPitch;if(!o||!r||!a||!l)return;let{scaleX:i,scaleY:d,translateX:c,translateY:p}=e.screenTransform;it(n,o,{x:b=>(r.origin+b)*i+c,rowCentre:b=>a.rowY(b)*d+p,barPx:l.barPx})},[e]);return u(_,{model:e,zIndex:3,testId:"graph-walk-rows-blocks",paint:t})}var Rn=m(function({model:t}){let n=t.walkRowBars,o=t.walkRowPlacement,r=t.walkRowPitch;if(!n||!o||!r||!t.hoveredWalkRowText)return null;let a=[n.reference,...n.rows],l=a.findIndex(c=>c.name===t.hoveredWalkRow),i=a[l];if(!i)return null;let d=t.toScreen({x:n.origin,y:o.rowY(l)});return u("rect",{"data-testid":"graph-walk-row-hovered",x:d.x-2,y:d.y-r.rowPx/2-1,width:i.bp*t.scaleX+4,height:r.rowPx+2,fill:"none",stroke:"#111",strokeWidth:1})}),xn=m(function({model:t,vector:n=!1}){let o=A(),r=t.walkRowBars,a=t.walkRowPlacement,l=t.walkRowPitch;if(!r||!a||!l)return null;let{paneWidth:i,canvasHeight:d}=t,c={...t.screenTransform,width:i,height:d,...l,bars:n};return k(T,{children:[n||!t.walkRowRibbons?null:u(mn,{model:t}),n?null:u(hn,{model:t}),n||!t.sharedBlocks?null:u(kn,{model:t}),k(C,{model:t,zIndex:3,overflow:"visible",testId:"graph-walk-rows",children:[qe(r,t.walkRowGroups?.sections??[],a.rowY,c,{ramp:t.referenceRampDomain,rowGenes:t.walkRowGenes,idPrefix:o}).map((p,b)=>u(H,{el:p},b)),a.headers.map(p=>u("text",{x:10,y:t.toScreen({x:0,y:p.top}).y+Ve-4,fontFamily:"sans-serif",fontSize:11,fontWeight:"bold",fill:"#333","data-testid":"graph-walk-section",children:p.title},p.key)),u(Rn,{model:t})]})]})}),la=xn;export{Lt as a,ot as b,C as c,In as d,A as e,H as f,j as g,Nr as h,vr as i,Vt as j,Jt as k,Tr as l,Ar as m,tn as n,$r as o,Ur as p,Fr as q,Yr as r,nn as s,zr as t,Vr as u,no as v,Po as w,Lo as x,an as y,vo as z,cn as A,Uo as B,la as C};
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
4
|
+
//# sourceMappingURL=chunk-5ZGRAPN5.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as f}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as f}from"./chunk-WO3MEQ25.js";import{h as l,i as c,k as m,z as b}from"./chunk-HAVM67SF.js";import{h as g}from"./chunk-B2MJV7HN.js";var S={steps:"walkStepBudget",bytes:"walkByteBudget"},x=64,h=class{constructor(t,e){this.file=t;this.adapter=e;this.reader=new m(t)}async haplotypeNames(t={}){let{haplotypes:e}=await this.reader.header(t);return e.length>0?e:void 0}budgets(){return{stepBudget:this.adapter.getConf("walkStepBudget"),byteBudget:this.adapter.getConf("walkByteBudget"),budgetNames:S}}async subgraph(t,e,{signal:i,haplotypes:n,walkRows:a,expand:r}){let d=this.budgets(),p=c(n?.map(s=>g(this.adapter,s)),t),u=a&&p&&(n?.length??0)<=x?p:void 0,o=r?.length?s=>r.includes(s):void 0,{graph:B,kept:y,fragments:k,skips:w}=await this.reader.cut(t,e,{...d,stepBudget:a?1/0:d.stepBudget,signal:i,keep:p,...u||o?{expand:s=>!!u?.(s)||!!o?.(s)}:{}});return f(B.tables(y,k,w),e,a)}async referenceNodes(t,e,i){let n=[];await b(this.file,t,await this.reader.queryStart(e.start,{...i,refName:t,end:e.end}),e.end,{signal:i.signal,lineCallback:r=>{let d=r.split(" ");d[3]==="ref"&&n.push(d)}});let a=new Set;return l(n).filter(r=>r.refName!==t||r.end<=e.start||r.start>=e.end||a.has(r.id)?!1:(a.add(r.id),!0))}};export{h as a};
|
|
2
|
+
//# sourceMappingURL=chunk-73B6AYVV.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{G as Qn,H as Zn,I as mn,J as pn,S as to,U as tn,V as gn,Y as no,Z as oo,d as Kn,e as Un,f as Yn,g as dn,i as qn,j as Vn,k as zn,l as jn,m as Yt,z as Jn}from"./chunk-CVHKXFVS.js";import{a as Kt,g as Ut}from"./chunk-IK3MQ4ZJ.js";var Rt=2,io=1.5,qo=4,eo=12,Vo=64,so=24,zo=48,ro="a thread per pass through a node",yn=t=>t.length>1&&t.some(n=>n.mostPasses>1),lo=t=>t*Rt+Math.max(0,t-1)*io,ao=t=>t.reduce((n,e)=>n+e,0);function fo(t,n,e){let o=t.map((a,c)=>n[c]>1?lo(a):e*Math.min(1,a)),s=0,r=t.map(a=>{let c=Math.min(1,a),i=qo*c*s;return s=Math.max(s,c),i});return{widths:o,gaps:r,band:ao(o)+ao(r)}}var xn=Rt+io;function qt(t,n,e=t){let{widths:o,gaps:s,band:r}=fo(t,n,Rt),a=-r/2;return o.map((c,i)=>{a+=s[i];let f=n[i]>1?Math.max(0,c-lo(e[i])):0,l=a+f/2+Rt/2;return a+=c,l})}var en=t=>fo(t,t,Rt).band,sn=t=>Math.min(1,zo/(en(t)||1)),ls=t=>sn(t.map(n=>n.mostPasses))<1?`${ro}, thinned to fit`:ro;function wn(t,n,e){let o=({normal:c,offsetX:i})=>({dx:c.nx*i,dy:c.ny*i}),{dx:s,dy:r}=Un(o(t),o(n),e),a=Math.hypot(s,r);return a>0?{normal:{nx:s/a,ny:r/a},offsetX:a}:{normal:{nx:0,ny:0},offsetX:0}}function nn(t,n){let e=t.stepOf[n],o=n-t.starts[e];return t.forward[e]?o:t.starts[e+1]-t.starts[e]-1-o}var Lt=(t,n)=>{let e=n.x-t.x,o=n.y-t.y;return Math.sqrt(e*e+o*o)};function Ht(t){let n=new Float64Array(t.length);for(let e=1;e<t.length;e++)n[e]=n[e-1]+Lt(t[e-1],t[e]);return n}function Mn(t,n){let e=new Set;return t.map(o=>{let s=new Map;return o.map(r=>r.map(a=>{let c=s.get(a)??0;s.set(a,c+1);let i=n[a],f=!!i?.length&&!e.has(a);return f&&e.add(a),{id:a,visit:c,owned:f,segments:i}}))})}function jo(t,n,e){let o=[];return t.forEach((s,r)=>{let a=0;for(let M of s)for(let{segments:A}of M)a+=A?.length??0;let c=new Float64Array(a),i=new Float64Array(a),f=0,l=0,h=u();function u(){return{walk:r,ids:[],visits:[],forward:[],owned:[],starts:[0]}}let m=()=>{if(h.ids.length){let M=new Int32Array(f-l);for(let A=0;A<h.ids.length;A++)M.fill(A,h.starts[A],h.starts[A+1]);o.push({...h,xs:c.subarray(l,f),ys:i.subarray(l,f),stepOf:M})}h=u(),l=f},w=(M,A,R)=>{let P=R.x-M,k=R.y*n-A;return Math.sqrt(P*P+k*k)};for(let M of s)M.forEach(({id:A,visit:R,owned:P,segments:k},W)=>{if(!k?.length){m();return}let F=k[0],S=k.at(-1),b;if(f>l){let g=c[f-1],E=i[f-1],x=w(g,E,F),C=w(g,E,S);b=x<=C,Math.min(x,C)>e&&m()}else{let g=M[W+1]?.segments,E=x=>g?.length?Math.min(w(x.x,x.y*n,g[0]),w(x.x,x.y*n,g.at(-1))):0;b=E(S)<=E(F)}h.ids.push(A),h.visits.push(R),h.forward.push(b),h.owned.push(P);for(let g=0;g<k.length;g++){let E=k[b?g:k.length-1-g];c[f]=E.x,i[f]=E.y*n,f++}h.starts.push(f-l)}),m()}),o}function An(t,n,e){let o=[];for(let s=0;s<n.length;s++){if(!n[s])continue;let r=s;for(;r+1<n.length&&n[r+1];)r++;let a=o.at(-1),c=a?a[1]:0,i=s;for(;i>c&&t[s]-t[i-1]<=e;)i--;let f=r;for(;f+1<t.length&&t[f+1]-t[r]<=e;)f++;a&&i<=a[1]+1?a[1]=f:o.push([i,f]),s=r}return o}function Jo(t,n){let e=Ht(t),o=e.at(-1),s=(c,i)=>{let f=t[i],l=t[Math.min(i+1,t.length-1)],h=e[Math.min(i+1,t.length-1)]-e[i],u=h>0?(c-e[i])/h:0;return{x:f.x+(l.x-f.x)*u,y:f.y+(l.y-f.y)*u}},r=0,a=0;return t.map((c,i)=>{let f=Math.max(0,e[i]-n/2),l=Math.min(o,e[i]+n/2);for(;r<t.length-1&&e[r+1]<=f;)r++;for(;a<t.length-1&&e[a+1]<=l;)a++;let h=s(f,r),u=s(l,a),m=Lt(h,u);return m>0?{nx:-(u.y-h.y)/m,ny:(u.x-h.x)/m}:void 0})}function Qo(t,n,e){let o=Ht(t),s=t.slice(),r=[];o.forEach((c,i)=>{let f=r.at(-1);(f===void 0||c-o[f]>=n/4)&&r.push(i)}),r.at(-1)!==t.length-1&&r.push(t.length-1);let a=0;for(;a<r.length;){let c=r[a],i=-1;for(let u=a+1;u<r.length&&o[r[u]]-o[c]<=e;u++){let m=r[u];o[m]-o[c]>Math.PI*n&&Lt(t[c],t[m])<=n&&(i=u)}if(i<0){a++;continue}let f=r[i],l=t[c],h=t[f];for(let u=c+1;u<f;u++){let m=(o[u]-o[c])/(o[f]-o[c]);s[u]={...t[u],x:l.x+(h.x-l.x)*m,y:l.y+(h.y-l.y)*m}}a=i}return s}function ho(t,n){let e=t.length,o=Ht(t),s=o[e-1],r=new Float64Array(e+1),a=new Float64Array(e+1),c=new Float64Array(e+1);for(let h=0;h<e;h++){let u=t[h],m=(o[Math.min(h+1,e-1)]-o[Math.max(h-1,0)])/2;r[h+1]=r[h]+m,a[h+1]=a[h]+m*u.x,c[h+1]=c[h]+m*u.y}let i=new Array(e),f=0,l=0;for(let h=0;h<e;h++){let u=t[h],m=Math.min(n,o[h],s-o[h]),w=o[h]-m,M=o[h]+m+1e-9*(1+s);for(;f<e&&o[f]<w;)f++;for(;l<e&&o[l]<M;)l++;let A=r[l]-r[f];i[h]=A>0?{x:(a[l]-a[f])/A,y:(c[l]-c[f])/A}:{x:u.x,y:u.y}}return i}function co(t,n){let e=t.length,o=Ht(t),s=o[e-1],r=new Uint8Array(e),a=(f,l)=>{let h=t[f],u=t[f+1];if(!u)return h;let m=o[f+1]-o[f],w=m>0?(l-o[f])/m:0;return{x:h.x+(u.x-h.x)*w,y:h.y+(u.y-h.y)*w}},c=0,i=0;for(let f=0;f<e;f++){if(o[f]<n||s-o[f]<n)continue;for(;c+1<e&&o[c+1]<=o[f]-n;)c++;for(;i+1<e&&o[i+1]<=o[f]+n;)i++;let l=t[f],h=a(c,o[f]-n),u=a(i,o[f]+n),m=Math.abs((u.x-h.x)*(l.y-h.y)-(u.y-h.y)*(l.x-h.x));r[f]=m>0&&Lt(h,u)*Lt(h,l)*Lt(l,u)/(2*m)<n?1:0}return{tight:r,s:o}}function Zo(t,n){let e=t.slice(),{tight:o,s}=co(e,n),r=An(s,Array.from(o,a=>a>0),3*n);for(let a=0;a<8&&r.length;a++)r=r.filter(([c,i])=>{let f=e.slice(c,i+1),l=co(f,n);if(!l.tight.includes(1))return!1;let h=on(l.s,l.tight,n),u=ho(f,n);for(let m=0;m<f.length;m++){let w=Math.min(1,3*h[m]);if(w>0){let M=f[m],A=u[m];e[c+m]={x:M.x+(A.x-M.x)*w,y:M.y+(A.y-M.y)*w}}}return!0});return e}function te(t,n,e,o,s,r){let a=n.length,c=new Float64Array(a),i=0,f=0,l=0,h=0,u=0;for(let m=0;m<a;m++){for(;i<a&&t[i]-t[m]<=r;){let w=e(i),M=n[i];c[i]=w&&M?w.nx*M.nx+w.ny*M.ny:0,l+=c[i],i++}for(;t[m]-t[f]>r;)l-=c[f++];if(Math.abs(l)>1e-9&&(h=l<0?-1:1),!!h)for(;u<=m;u++)s(u,h)}if(u<a){let m=0;for(let w=0;w<a;w++)m+=o(w)?1:-1;for(;u<a;u++)s(u,m<0?-1:1)}}function ne(t,n,e,o,s=!0){let r=Math.max(e,2*o),a=Math.PI*o,c=s?a+3*o+r/2:r/2,i=new Map,f=new Map,l=[],h=[],u=w=>({normals:new Array(w),shifts:s?new Array(w):[]}),m=(w,M,A,R)=>{let P=i.get(w);P||(P=[],i.set(w,P)),(P[M]??=[])[A]=R};return t.forEach((w,M)=>{let{walk:A,ids:R,visits:P,owned:k,starts:W,xs:F,ys:S,stepOf:b}=w,g=R.length,E=F.length,x=new Array(g);for(let d=0;d<g;d++)k[d]&&(x[d]=u(W[d+1]-W[d]),f.set(R[d],{run:M,step:d,frame:x[d]}),m(R[d],A,P[d],x[d]));let C=new Float64Array(E);for(let d=1;d<E;d++){let I=F[d]-F[d-1],N=S[d]-S[d-1];C[d]=C[d-1]+Math.sqrt(I*I+N*N)}let Z=C[E-1],D=new Int32Array(g).fill(-1),G=new Int32Array(g),q=new Array(g);for(let d=0;d<g;d++){let I=k[d]?void 0:f.get(R[d]);I&&(D[d]=I.run,G[d]=I.step,q[d]=I.frame)}let st=new Int32Array(g),it=new Int32Array(g);for(let d=0;d+1<g;d++){let N=D[d]>=0&&D[d+1]===D[d]?G[d+1]-G[d]:0;st[d+1]=st[d]+(N===1?1:0),it[d+1]=it[d]+(N===-1?1:0)}let ot=new Array(g),_=0,L=0;for(let d=0;d<g;d++){if(!s){ot[d]=!k[d];continue}let I=C[W[d]]-c,N=C[W[d+1]-1]+c;for(;C[_]<I;)_++;for(;L+1<E&&C[L+1]<=N;)L++;let j=b[Math.max(0,_-1)],at=b[Math.min(E-1,L+1)],H=at-j,ft=st[at]-st[j],wt=it[at]-it[j];ot[d]=!k[d]&&I>=0&&N<=Z&&H>0&&(ft===H||wt===H)}for(let d=0;d<g;d++){if(k[d])continue;let I=q[d];x[d]=!s&&ot[d]?I:ot[d]?{normals:I.normals,shifts:I.shifts}:u(I.normals.length),m(R[d],A,P[d],x[d])}h.push(x);let V=new Array(E);for(let d=0;d<E;d++)V[d]=!ot[b[d]];for(let[d,I]of An(C,V,c)){let N=[];for(let H=d;H<=I;H++)N.push({x:F[H],y:S[H]});let j=s?Zo(ho(Qo(N,o/2,a),o/2),o/2):N,at=Jo(j,r);te(Ht(j),at,H=>{let ft=b[d+H];return(k[ft]?x[ft]:q[ft])?.normals[nn(w,d+H)]},H=>w.forward[b[d+H]],(H,ft)=>{let wt=d+H,Dt=b[wt];if(ot[Dt])return;let Wt=nn(w,wt),Ot=at[H];x[Dt].normals[Wt]=Ot&&(ft>0?Ot:{nx:-Ot.nx,ny:-Ot.ny}),s&&(x[Dt].shifts[Wt]={dx:j[H].x-N[H].x,dy:(j[H].y-N[H].y)/n})},r)}if(!s){l.push(C);return}let rt=new Float64Array(E),X=0,z=0;for(let d=0;d<E;d++){let I=x[b[d]].shifts[nn(w,d)],N=F[d]+(I?.dx??0),j=S[d]+(I?.dy??0)*n;rt[d]=d?rt[d-1]+Math.sqrt((N-X)**2+(j-z)**2):0,X=N,z=j}l.push(rt)}),{frames:i,arcs:l,stepFrames:h}}function uo(t,n,e,o){let s=new Array(n.length),r=[],a=0,c=0;for(let i=0;i<n.length;i++){for(;c<n.length&&t[c]-t[i]<=e;){for(;r.length>a&&o*n[r.at(-1)]<=o*n[c];)r.pop();r.push(c++)}for(;t[i]-t[r[a]]>e;)a++;s[i]=n[r[a]]}return s}function on(t,n,e,o=()=>!0){let s=n.length,r=new Float64Array(s+1),a=new Float64Array(s+1);for(let l=0;l<s;l++){let h=o(n[l])?s>1?(t[Math.min(l+1,s-1)]-t[Math.max(l-1,0)])/2:1:0;r[l+1]=r[l]+h,a[l+1]=a[l]+h*n[l]}let c=new Float64Array(s),i=0,f=0;for(let l=0;l<s;l++){for(;t[l]-t[i]>e;)i++;for(;f<s&&t[f]-t[l]<=e;)f++;let h=r[f]-r[i];c[l]=h>0?(a[f]-a[i])/h:n[l]}return c}var oe=[0];function ee(t){for(let n of t.values())if(n>1)return!0;return!1}function se(t,n,e,o,s){if(!ee(n))return{span:n,nodeThreads:new Map,threadPasses:new Map,threadAt:new Map,linkThreads:new Map};let r=new Map,a=[],c=[],i=[],f=[],l=[],h=[],u=[];for(let S of t){let b=[],g=[];for(let _ of S){let L=r.get(_);L===void 0&&(L=a.length,r.set(_,L),a.push(_),c.push(0),i.push(0)),g.push(L);let V=e[_],rt=V?.[Math.floor(V.length/2)];b.push(rt?{x:rt.x,y:rt.y*o}:b.at(-1)??{x:0,y:0})}let E=Ht(b),x=S.map(_=>n.get(_)??1),C=uo(E,x,s/2,1),Z=g.map(_=>++i[_]),D=S.length,G=new Int32Array(D),q=-1;for(let _=0;_<D;_++)q=x[_]===C[_]?_:q,G[_]=q;let st=new Int32Array(D);q=-1;for(let _=D-1;_>=0;_--)q=x[_]===C[_]?_:q,st[_]=q;let it=new Array(D),ot=new Array(D).fill(NaN);for(let _=0;_<D;_++){let L=G[_],V=st[_],rt=L<0?V:V<0||E[_]-E[L]<=E[V]-E[_]?L:V,X=z=>Math.min(Z[z],C[_])-1;if(it[_]=X(rt),x[_]===1&&L>=0&&V>=0&&X(V)!==X(L)){let z=(E[_]-E[L])/(E[V]-E[L]||1);ot[_]=X(L)+(X(V)-X(L))*z}c[g[_]]=Math.max(c[g[_]],C[_])}f.push(g),l.push(Z),h.push(it),u.push(ot)}let m=[],w=[],M=(S,b)=>{let g=c[S],E=m[S]??=new Set;for(let x=0;x<g;x++)for(let C of[b-x,b+x])if(C>=0&&C<g&&!E.has(C))return C;return b},A=[];f.forEach((S,b)=>{S.forEach((g,E)=>{if(c[g]>1){let x=u[b][E],C=M(g,Number.isNaN(x)?h[b][E]:Math.round(x));m[g].add(C),(w[g]??=[])[l[b][E]]=C,Number.isNaN(x)||((A[g]??=[])[C]=x)}})});let R=new Map,P=new Map,k=new Map,W=new Map;a.forEach((S,b)=>{A[b]&&W.set(S,A[b]),R.set(S,c[b]),P.set(S,m[b]?[...m[b]].sort((E,x)=>E-x):oe);let g=[];w[b]?.forEach((E,x)=>{g[E]=x-1}),k.set(S,g)});let F=new Map;return f.forEach((S,b)=>{let g=l[b];for(let E=1;E<S.length;E++){let x=S[E-1],C=S[E],Z=[w[x]?.[g[E-1]]??0,w[C]?.[g[E]]??0],D=F.get(a[x]);D||(D=new Map,F.set(a[x],D));let G=D.get(a[C]);G?G.some(([q,st])=>q===Z[0]&&st===Z[1])||G.push(Z):D.set(a[C],[Z])}}),{span:R,nodeThreads:P,threadPasses:k,threadAt:W,linkThreads:F}}function re(t,n,e,{reach:o,taper:s}){let r=new Map;return t.forEach((a,c)=>{let i=n[c],f=a.ids.map((l,h)=>{let u=a.starts[h+1]-a.starts[h],m=Math.floor(u/2);return i[a.starts[h]+(a.forward[h]?m:u-1-m)]});for(let[l,h]of An(f,a.owned,o/2+s/2)){let u=f.slice(l,h+1),m=a.ids.slice(l,h+1),w=e.map(M=>{let A=m.map(R=>M.get(R)??0);return A.every(R=>R===A[0])?{slot:A,held:A}:{slot:on(u,uo(u,A,o/2,1),s/2),held:on(u,A,s/2,R=>R>0)}});m.forEach((M,A)=>{a.owned[l+A]&&r.set(M,{slot:w.map(R=>R.slot[A]),held:w.map(R=>R.held[A])})})}}),r}function ae(t,n,e,o,s,r,a){let c=qt(s,s),i=new Map,f=l=>{let h=i.get(l);if(!h){let u=o.get(l);h=u?qt(u.slot,s,u.held):c,i.set(l,h)}return h};t.forEach((l,h)=>{let{walk:u,ids:m,visits:w,starts:M}=l,{threadPasses:A,threadAt:R}=r[u],P=new Float64Array(l.xs.length);m.forEach((W,F)=>{let S=Math.max(0,A.get(W)?.indexOf(w[F])??0),b=R.get(W)?.[S]??S;P.fill(f(W)[u]+b*xn,M[F],M[F+1])});let k=on(e[h],P,a);n[h].forEach((W,F)=>{let S=M[F],b=M[F+1],g=!0;for(let x=S+1;g&&x<b;x++)g=Math.abs(k[x]-k[S])<1e-9;if(g){W.offset=k[S];return}let E=new Array(b-S);for(let x=S;x<b;x++)E[nn(l,x)]=k[x];W.offsets=E})})}function mo(t,n,e,o,s=Mn(t.map(r=>r.route),n)){let r=yn(t),a=t.map(M=>M.mostPasses),c=Vo*o,i=jo(s,e,eo*o),f=en(a)*(r?sn(a):1)*o,l=ne(i,e,eo*o,f,r),h=r?t.map(M=>se(M.route,M.passes,n,e,c)):void 0,u=h?re(i,l.arcs,h.map(M=>M.span),{reach:c,taper:so*o}):void 0;u&&h&&ae(i,l.stepFrames,l.arcs,u,a,h,so/2*o);let m={dx:0,dy:0},w=new Set;for(let M of l.frames.values())for(let{shifts:A}of M.flat())if(!w.has(A)){w.add(A);for(let R of A)m.dx=Math.max(m.dx,Math.abs(R?.dx??0)),m.dy=Math.max(m.dy,Math.abs(R?.dy??0))}return{lines:l,threads:h,spans:u,furthestShift:m}}function Y(t,n,e,o){return(o<<24|e<<16|n<<8|t)>>>0}function En(t){return t&255}function vn(t){return t>>>8&255}function bn(t){return t>>>16&255}function _n(t){return t>>>24&255}function po(t){return`rgba(${En(t)},${vn(t)},${bn(t)},${_n(t)/255})`}function hs(t,n){return`rgba(${Math.round(t[0]*255)},${Math.round(t[1]*255)},${Math.round(t[2]*255)},${n})`}function St(t,n){return Y(En(t),vn(t),bn(t),Math.round(_n(t)*n))}function us(t,n){let e=Math.max(0,1-1/n),o=s=>Math.round(s+(255-s)*e);return Y(o(En(t)),o(vn(t)),o(bn(t)),_n(t))}var go=300,Vt=.7,zt=.5;function ce(t){return`hsl(${t}, ${Vt*100}%, ${zt*100}%)`}function jt(t){return Math.max(0,Math.min(1,t))*go}function Rn(t,n){return jt((t-n.start)/(n.end-n.start))}var ie=30;function ms({start:t,bp:n,reversed:e},o){let s=Rn(t,o),r=Rn(t+n,o);if(r-s<1)return[(s+r)/2];let a=Math.ceil((r-s)/ie);return Array.from({length:a+1},(c,i)=>Rn(t+n*(e?a-i:i)/a,o))}var le=Array.from({length:7},(t,n)=>({offset:n/6,color:ce(n/6*go)})),ps=`linear-gradient(to right, ${le.map(t=>`${t.color} ${t.offset*100}%`).join(", ")})`;var fe=Yt();function yo(t,n,e,o,s,r,a=!1){return fe(t,[n,e.scaleX,e.scaleY,o,r,a,s],()=>{let c=new Map;for(let i=0;i<n.edges.length;i++){let f=o?.get(i),l=Jn(t,n.edges[i],e,f,f&&r?.[i],a);l&&c.set(i,l)}return c})}var he=4;function ue(t){let n=new Map;for(let e of t.edges)Kt(n,e.from,e.to),Kt(n,e.to,e.from);return n}function de({nodeId:t,nodeById:n,neighbors:e}){let o=new Set([t]),s=[t],r=1/0,a=-1/0;for(let c=0;c<he&&s.length>0;c++){let i=[];for(let f of s){let l=e.get(f);if(l){for(let h of l)if(!o.has(h)){o.add(h);let u=n.get(h);u&&Ut(u)?(r=Math.min(r,u.stable.start+u.length),a=Math.max(a,u.stable.start)):i.push(h)}}}s=i}return r===1/0?void 0:{start:Math.min(r,a),end:Math.max(r,a)}}function me({nodeId:t,nodeById:n,neighbors:e}){let o=n.get(t);return o===void 0?void 0:Ut(o)?{start:o.stable.start,end:o.stable.start+o.length}:de({nodeId:t,nodeById:n,neighbors:e})}function xo(t){let n=new Map(t.nodes.map(s=>[s.id,s])),e=ue(t),o=new Map;for(let s of t.nodes){let r=me({nodeId:s.id,nodeById:n,neighbors:e});r&&o.set(s.id,(r.start+r.end)/2)}return o}var pe=Y(119,119,119,217),wo=Y(136,136,136,217),ge=Y(24,24,28,240),Mo=2.2,Io=Y(160,160,160,255),Jt=.18,ye=.45,Fs=po(St(Io,Jt)),xe=11,we=1.2,Me=1e-6,Ae=7,Ee=3,ve=3,be=1.5,Ao=3,_e=.5,Re=.45,Sn=12,Se=1e-6,xt=new Float64Array(64),Ct=new Float64Array(64),Tt=new Float64Array(64);function Ce(t,n,e,o){let s=t.length*Sn+1;xt.length<s&&(xt=new Float64Array(s),Ct=new Float64Array(s),Tt=new Float64Array(s));let r=t[t.length-1];xt[0]=r.x1,Ct[0]=r.y1,Tt[0]=0;let a=1,c=0;for(let i=t.length-1;i>=0&&c<o;i--){let f=t[i];for(let l=1;l<=Sn&&c<o;l++){let h=1-(l/Sn)**2,u=1-h,m=u*u*u,w=3*u*u*h,M=3*u*h*h,A=h*h*h,R=m*f.x0+w*f.cx0+M*f.cx1+A*f.x1,P=m*f.y0+w*f.cy0+M*f.cy1+A*f.y1;c+=Math.hypot(R-xt[a-1],(P-Ct[a-1])*e)*n,xt[a]=R,Ct[a]=P,Tt[a]=c,a++}}return a}function Eo(t,n){let e=1;for(;e<t-1&&Tt[e]<n;)e++;let o=Tt[e-1],s=Tt[e],r=s>o?Math.min(1,Math.max(0,(n-o)/(s-o))):0;return{x:xt[e-1]+(xt[e]-xt[e-1])*r,y:Ct[e-1]+(Ct[e]-Ct[e-1])*r}}function Te({curves:t,edgeHalfWidth:n,nodeHalfWidth:e,scale:o,yToX:s,color:r,fromSegments:a,toSegments:c}){let i=Ae+Ee*n,f=Ce(t,o,s,e+Ao*i),l=Tt[f-1],h=l<Se,u=Math.min(e,l),m=h?Math.min(1,jn(a,o,o*s)/i):1;if(h?m<_e:l<Ao*i)return;let w=Eo(f,u),M=Eo(f,u+i*m),A=w.x-M.x,R=(w.y-M.y)*s,P=t[t.length-1];return{x:w.x,y:w.y,angle:Math.hypot(A,R)>0?Math.atan2(R,A):Xe(P,s,Ie(P,c)),length:i*m,halfWidth:(ve+be*n)*m,color:r}}var vo=[[0,0]],Oe=[0],bo={dx:0,dy:0};function Po(t,n,e){let o=s=>Math.hypot(s.x-t.x,(s.y-t.y)*e);return o(n[0])<o(n.at(-1))}function ke(t,n,e,o,s){return o?qn(t).from==="start":Po({x:e.x0,y:e.y0},n,s)}function Ie(t,n){if(n.length<2)return;let e=n[0],o=n[n.length-1];return Math.hypot(t.x1-e.x,t.y1-e.y)<=Math.hypot(t.x1-o.x,t.y1-o.y)?{from:e,to:n[1]}:{from:o,to:n[n.length-2]}}function _o(t,n){if(!t||!n)return;let e=n.x-t.x,o=n.y-t.y,s=Math.hypot(e,o);return s>0?{nx:-o/s,ny:e/s}:void 0}var No=.1,Pe=1/Math.sqrt(No);function Ro(t,n=1){let e=n===1?t:t.map(o=>({x:o.x,y:o.y*n}));return e.map((o,s)=>{let r=_o(e[s-1],o),a=_o(o,e[s+1]);if(r&&a){let c=(r.nx+a.nx)/2,i=(r.ny+a.ny)/2,f=r.nx*c+r.ny*i;return f>No?{nx:c/f,ny:i/f}:{nx:c,ny:i}}return r??a??{nx:0,ny:0}})}function So(t,n,e,o=1){let s=new Array(t.length);for(let r=0;r<t.length;r++){let a=typeof e=="number"?e:e[r];s[r]={x:t[r].x+n[r].nx*a,y:t[r].y+n[r].ny*a/o}}return s}function Tn(t,n,e){let o=(1-Math.abs(2*e-1))*n,s=o*(1-Math.abs(t/60%2-1)),r=e-o/2,a=0,c=0,i=0;return t<60?(a=o,c=s):t<120?(a=s,c=o):t<180?(c=o,i=s):t<240?(c=s,i=o):t<300?(a=s,i=o):(a=o,i=s),[a+r,c+r,i+r]}function rn(t,n,e,o=1){let[s,r,a]=Tn(t,n,e);return Y(Math.round(s*255),Math.round(r*255),Math.round(a*255),Math.round(o*255))}var Ne=[[68,1,84],[59,82,139],[33,145,140],[94,201,98],[253,231,37]],Fe=[[237,137,44],[158,42,122]],Le=[[220,50,50],[50,120,220]];function Cn(t,n){let e=Math.max(0,Math.min(1,n))*(t.length-1),o=Math.min(t.length-2,Math.floor(e)),s=e-o,r=t[o],a=t[o+1];return Y(Math.round(r[0]+(a[0]-r[0])*s),Math.round(r[1]+(a[1]-r[1])*s),Math.round(r[2]+(a[2]-r[2])*s),255)}function He(t,n){return rn(Qn(t),mn,pn,n)}var Fo=[60,65,72],On=Y(...Fo,255),Ls=`rgb(${Fo.join(", ")})`;function De(t,n){let e=n.midpoints.get(t.id);return Ut(t)&&e!==void 0?(e-n.start)/n.span:void 0}function Hs(t,n){let e=xo(t);if(n&&n.end>n.start)return{start:n.start,span:n.end-n.start,midpoints:e};let o=1/0,s=-1/0;for(let r of e.values())o=Math.min(o,r),s=Math.max(s,r);return{start:o===1/0?0:o,span:s>o?s-o:1,midpoints:e}}function We(t,n){let e=1/0,o=-1/0,s=1/0,r=-1/0,a=0;for(let c of t.nodes)c.stable!==void 0&&c.stable.rank>a&&(a=c.stable.rank),c.depth<e&&(e=c.depth),c.depth>o&&(o=c.depth),c.length<s&&(s=c.length),c.length>r&&(r=c.length);return{minDepth:e,maxDepth:o,minLength:s,maxLength:r,maxRank:a,nodeCount:t.nodes.length,referenceRamp:n}}function Ge(t,n,e,o){switch(e){case"random":return He(t.id,1);case"depth":return Cn(Ne,o.maxDepth>o.minDepth?(t.depth-o.minDepth)/(o.maxDepth-o.minDepth):.5);case"node-length":return Cn(Le,o.maxLength>o.minLength?(t.length-o.minLength)/(o.maxLength-o.minLength):.5);case"stable-rank":return t.stable===void 0?Y(160,160,160,255):t.stable.rank===0?Y(52,152,219,255):Cn(Fe,o.maxRank>1?(t.stable.rank-1)/(o.maxRank-1):0);case"reference-position":{let s=o.referenceRamp;if(s===void 0)return Y(160,160,160,255);let r=De(t,s);return r===void 0?On:rn(jt(r),Vt,zt)}case"grey":return Y(160,160,160,255);case"rainbow":{let s=o.nodeCount>1?n/o.nodeCount*360:0;return rn(s,.75,.5)}default:return Y(52,152,219,255)}}function Xe(t,n=1,e){let o=[[t.cx1,t.cy1],[t.cx0,t.cy0],[t.x0,t.y0]];for(let[s,r]of o){let a=t.x1-s,c=(t.y1-r)*n;if(Math.hypot(a,c)>0)return Math.atan2(c,a)}return e?Math.atan2((e.to.y-e.from.y)*n,e.to.x-e.from.x):0}function Be(t,n){let e=!1;for(let o=0;o<t.length-1&&!e;o++){let s=t[o],r=t[o+1];e=Math.max(s.x,r.x)>=n.minX&&Math.min(s.x,r.x)<=n.maxX&&Math.max(s.y,r.y)>=n.minY&&Math.min(s.y,r.y)<=n.maxY}return e}function Co(t,n,e=0,o=0){for(let s of t){let r=Math.min(s.x0,s.cx0,s.cx1,s.x1),a=Math.max(s.x0,s.cx0,s.cx1,s.x1),c=Math.min(s.y0,s.cy0,s.cy1,s.y1),i=Math.max(s.y0,s.cy0,s.cy1,s.y1);if(a>=n.minX-e&&r<=n.maxX+e&&i>=n.minY-o&&c<=n.maxY+o)return!0}return!1}var To=new WeakMap;function $e(t){let n=To.get(t);if(!n){let e=[],o=new Map,s=t.paths??[];for(let r=0;r<s.length;r++)e.push(rn(Zn(r,s.length),mn,pn,.85)),o.has(s[r].name)||o.set(s[r].name,r);n={pathColorByIndex:e,pathIndexByName:o},To.set(t,n)}return n}var Oo=new WeakMap,Ke=new Map;function Ue(t){let n=Oo.get(t);if(!n){n=new Map;for(let[e,o]of(t.paths??[]).entries())for(let s of new Set(o.nodeIds))Kt(n,s,e);Oo.set(t,n)}return n}var Ye=Yt(),qe=Yt(),ko=new WeakMap;function Ve(t){let n=ko.get(t);if(!n){n=new Map;for(let{from:e,to:o}of t.edges){let s=n.get(e);s||(s=new Set,n.set(e,s)),s.add(o)}ko.set(t,n)}return n}function Ds(t){let{nodePositions:n,graph:e,nodeById:o,colorScheme:s,contigThickness:r,connectorThickness:a,drawPaths:c,nodeWidth:i="uniform",edgeWidth:f="uniform",highlight:l,axis:h,linearLayout:u,viewportBounds:m,referenceRamp:w,deletions:M,deletionRoutes:A,stranded:R,hiddenEdges:P,version:k=0}=t,W=to(e,i),F=f==="walks"?no(e):0,S=h.scaleX,b=1/Math.max(S,Me),g=Vn(h),E=yo(n,e,h,M,k,A,R),x=[],C=new Map,Z=[],D=new Map,G=[],q=new Map,st=We(e,w),it=new Map;if(s==="rainbow")for(let p=0;p<e.nodes.length;p++)it.set(e.nodes[p].id,p);let ot=e.paths?.length??0,{pathColorByIndex:_,pathIndexByName:L}=$e(e),V=p=>_[L.get(p)??-1]??wo,rt=c&&ot>1?Ue(e):Ke,X=l?.walks??[],z=yn(X),d=X.map(p=>p.mostPasses),I=z?sn(d):1,N=l&&X.length>1?Ye(l,[n,k,h.scaleX,h.scaleY],()=>mo(X,n,g,b,qe(l,[n,k],()=>Mn(X.map(p=>p.route),n)))):void 0,j=N?.lines,at=N?.threads,H=N?.spans,ft=z?qt(d,d):[],wt=new Map,Dt=p=>{let y=wt.get(p);if(!y){let v=H?.get(p);y=v?qt(v.slot,d,v.held):ft,wt.set(p,y)}return y},Wt=(p,y,v,T)=>z?(Dt(p)[v]+T*xn)*I:(v-(X.length-1)/2)*y,Ot=(p,y,v)=>{let T=p?.offsets?.[y]??p?.offset;return T===void 0?v:T*I},Ln=p=>z?Rt/2*I:p/2,Hn=new Map,Dn=new WeakMap,Wn=(p,y,v)=>at?.[p]?.threadPasses.get(y)?.[v]??0,cn=(p,y)=>{let v=Hn.get(p);return v||(v=Ro(y,g),Hn.set(p,v)),v},Bo=(p,y,v)=>{if(!v)return cn(p,y);let T=Dn.get(v.normals);return T||(T=cn(p,y).map((O,$)=>v.normals[$]??O),Dn.set(v.normals,T)),T},Gn=new Map,ln=p=>{let y=Gn.get(p);if(y===void 0){let v=o.get(p);y=gn(v?tn(v,r,i,W):r,X.length),Gn.set(p,y)}return y},Xn=(p,y,v,T,O,$)=>{let tt=T?0:v.length-1,K=y?.[O]?.[Wn(O,p,$)],ct=K?.offsets?.[tt]??K?.offset;return{normal:K?.normals[tt]??cn(p,v)[tt]??{nx:0,ny:0},shift:K?.shifts[tt]??bo,offset:ct===void 0?Wt(p,ln(p),O,$):ct*I}},$o=(p,y)=>{if(!m)return!0;let v=z?en(d)*I:(X.length-1)/2*ln(y),T=Pe*v*b;return Co(p,m,T+(N?.furthestShift.dx??0),T/g+(N?.furthestShift.dy??0))},Ko=(p,y,v)=>{let T=at?.[p]?.linkThreads;if(!T?.size)return vo;let O=T.get(y)?.get(v),$=Ve(e).get(v)?.has(y)?void 0:T.get(v)?.get(y);if(!$)return O??vo;let tt=$.map(([K,ct])=>[ct,K]);return O?[...O,...tt]:tt},fn=(p,y,v)=>X[p]?.passColors.get(y)?.[at?.[p]?.threadPasses.get(y)?.[v]??0],Bn=new WeakMap,Uo=(p,y)=>{if(!y||!z)return p;let v=Bn.get(y.shifts);if(!v){let{shifts:T}=y;v=p.map((O,$)=>{let{dx:tt,dy:K}=T[$]??bo;return{...O,x:O.x+tt,y:O.y+K}}),Bn.set(y.shifts,v)}return v},Yo=S>(u?1:Re);for(let p=0;p<e.edges.length;p++){let y=e.edges[p],v=n[y.from],T=n[y.to],O=E.get(p);if(!v?.length||!T?.length||!O||P?.has(p))continue;let $=y.pathIds?.length??0,K=M?.get(p)!==void 0,ct=l?.edgeIndexes.has(p)??!1,Gt=a/2*(K?Mo:1),kt=oo($,F,f),It=a/2*(K?f==="walks"&&F>0?Math.max(1,kt):Mo:kt),ht=c&&$>0,Pt=K?ge:pe,Mt=!l||ct?Pt:St(Pt,Jt),pt=o.get(y.to),Xt=(pt?tn(pt,r,i,W):r)/2,U=B=>!m||Co(B,m),Bt=B=>Kn(B,xe/S,g,m),Qt=(B,J,nt)=>{if(!K){G.push({curves:B,thickness:J,color:nt});return}for(let dt of Bt(B))G.push({curves:dt.curves,thickness:J,color:nt})},At=(B,J,nt,dt,vt,yt,bt,et,hn)=>{if(!K){G.push({curves:B,thickness:J,color:nt,walk:dt,pass:vt,normal:yt,offsetX:bt,endNormal:et,endOffsetX:hn});return}let _t={normal:yt,offsetX:bt},Ft={normal:et,offsetX:hn};for(let Q of Bt(B)){let mt=Q.startAlong===0?_t:wn(_t,Ft,Q.startAlong),lt=Q.endAlong===1?Ft:wn(_t,Ft,Q.endAlong);G.push({curves:Q.curves,thickness:J,color:nt,walk:dt,pass:vt,normal:mt.normal,offsetX:mt.offsetX,endNormal:lt.normal,endOffsetX:lt.offsetX})}},Nt=B=>{let J=Yo?Te({curves:B,edgeHalfWidth:K||ht?a/2:It,nodeHalfWidth:Xt,scale:S,yToX:g,color:Mt,fromSegments:v,toSegments:T}):void 0;J&&Z.push(J)},gt=G.length,$t=Z.length,Et=l?.walks.length&&ct&&!ht?l.walks:void 0;if(Et&&!$o(O,y.from))continue;if(Et){let B=ke(y,v,O[0],R,g),J=O.at(-1),nt=Po({x:J.x1,y:J.y1},T,g),dt=Et.length===1,vt=Ln(ln(y.from)),yt=j?.frames.get(y.from),bt=j?.frames.get(y.to);for(let et=0;et<Et.length;et++)if(Et[et].edgeIndexes.has(p))for(let[_t,Ft]of Ko(et,y.from,y.to)){let Q=Xn(y.from,yt,v,B,et,_t),mt=z?Xn(y.to,bt,T,nt,et,Ft):Q,lt=dt?0:Q.offset*b,un=z?mt.offset*b:lt,$n=z?Yn(O,Q.shift.dx+Q.normal.nx*lt,Q.shift.dy+Q.normal.ny*lt/g,mt.shift.dx+mt.normal.nx*un,mt.shift.dy+mt.normal.ny*un/g):lt===0?O:dn(O,Q.normal.nx*lt,Q.normal.ny*lt/g);U($n)&&At($n,vt,fn(et,y.from,_t)??fn(et,y.to,Ft)??Pt,et,_t,Q.normal,lt,mt.normal,un)}G.length>gt&&Nt(O)}else if(!ht)U(O)&&(Qt(O,It,Mt),Nt(O));else{let B=zn(v,T,$,h),J=Math.floor(($-1)/2);for(let nt=0;nt<$;nt++){let{x:dt,y:vt}=B[nt],yt=dt===0&&vt===0?O:dn(O,dt,vt);if(!U(yt))continue;let bt=V(y.pathIds[nt]);Qt(yt,Gt,l&&(l.walks.length?!l.names.has(y.pathIds[nt]):!ct)?St(bt,Jt):bt),nt===J&&Nt(yt)}}let Zt=G.length-gt;Zt>0&&q.set(p,{start:gt,count:Zt});let ut=Z.length-$t;ut>0&&D.set(p,{start:$t,count:ut})}for(let[p,y]of Object.entries(n)){let v=o.get(p);if(!v||m&&!Be(y,m))continue;let T=l!==void 0&&!l.nodeIds.has(p),O=T?Io:Ge(v,it.get(p)??0,s,st),$=T?St(O,Jt):v.moved?St(O,ye):O,tt=tn(v,r,i,W),K=tt/2,ct=x.length,Gt=rt.get(p),kt=tt/ot,It=y.length>=2,ht=l?.walks.length&&!T&&!Gt?.length?l.walks:void 0;if(It&&ht){let Mt=gn(tt,ht.length),pt=Ln(Mt),Xt=j?.frames.get(p);for(let U=0;U<ht.length;U++){let Bt=ht[U].colors.get(p);if(Bt===void 0)continue;let Qt=at?.[U]?.nodeThreads.get(p)??Oe;for(let At of Qt){let Nt=fn(U,p,At)??Bt;if(ht.length===1){x.push({points:y,thickness:pt,color:Nt,walk:U,pass:At});continue}let gt=Xt?.[U]?.[Wn(U,p,At)],$t=Bo(p,y,gt),Et=Uo(y,gt),Zt=Wt(p,Mt,U,At),ut=gt?.offsets?.map(J=>J*I*b),B=ut?ut[Math.floor(ut.length/2)]:Ot(gt,0,Zt)*b;x.push({points:So(Et,$t,ut??B,g),thickness:pt,color:Nt,walk:U,pass:At,normals:$t,offsetX:B,...ut&&{offsets:ut}})}}}else if(It&&Gt?.length&&kt>=we){let Mt=Ro(y,g);for(let pt of Gt){let Xt=(pt-(ot-1)/2)*kt*b,U=_[pt]??wo;x.push({points:So(y,Mt,Xt,g),thickness:kt/2,color:T?St(U,Jt):U})}}else It&&x.push({points:y,thickness:K,color:$});let Pt=x.length-ct;Pt>0&&C.set(p,{start:ct,count:Pt})}return{nodeStrokes:x,nodeStrokeRuns:C,arrows:Z,arrowRuns:D,edgeCurves:G,edgeCurveRuns:q}}var Do=[{value:"progress",label:"Progress along the walk"},{value:"walk",label:"One colour for the walk"},{value:"reference",label:"Reference position"}],Pn=[{value:"grey",label:"Grey to black",ends:["#a3a3a3","#151515"]},{value:"blue",label:"Cyan to navy",ends:["#6ee0f0","#0b2c7a"]},{value:"red",label:"Yellow to red",ends:["#ffd24a","#b3121b"]},{value:"purple",label:"Pink to plum",ends:["#f5a3d8","#5e1a6e"]},{value:"green",label:"Lime to forest",ends:["#b6e36c","#0b5d3b"]},{value:"orange",label:"Peach to rust",ends:["#ffc285","#8f3a00"]},{value:"rainbow",label:"Rainbow"}],kn=["blue","red","purple","green"],ze=t=>Do.some(n=>n.value===t),je=t=>Pn.some(n=>n.value===t);function Je(t,n,e,o=!0){let{field:s,scheme:r}=t.color??{},a=ze(s)?s:o?"progress":"walk",c=n?"grey":kn[e%kn.length],i=je(r)?r==="rainbow"&&a!=="reference"?c:r:c,f=Math.floor(e/kn.length)%Lo.length;return a==="walk"&&i===c&&f>0?{field:a,scheme:i,shade:Lo[f]}:o||a==="walk"?{field:a,scheme:i}:{field:a,scheme:i,darkest:Qe}}var Qe=.55,Nn=.5,Lo=[Nn,.85,.2],Ze=.08,Ho=({field:t,scheme:n})=>t!=="walk"&&n!=="rainbow";function ts(t){let n=new Map;for(let o of t)Ho(o)&&n.set(o.scheme,(n.get(o.scheme)??0)+1);let e=new Map;return t.map(o=>{let s=Ho(o)?n.get(o.scheme):1;if(s<2)return o;let r=e.get(o.scheme)??0;e.set(o.scheme,r+1);let a=Ze/2;return{...o,stretch:[r/s+(r>0?a:0),(r+1)/s-(r<s-1?a:0)]}})}var Wo=({stretch:t},n)=>t?t[0]+(t[1]-t[0])*n:n,ns=t=>t<=.04045?t/12.92:((t+.055)/1.055)**2.4,os=t=>t<=.0031308?t*12.92:1.055*t**(1/2.4)-.055;function es(t){let[n,e,o]=[1,3,5].map(c=>ns(Number.parseInt(t.slice(c,c+2),16)/255)),s=Math.cbrt(.4122214708*n+.5363325363*e+.0514459929*o),r=Math.cbrt(.2119034982*n+.6806995451*e+.1073969566*o),a=Math.cbrt(.0883024619*n+.2817188376*e+.6299787005*o);return[.2104542553*s+.793617785*r-.0040720468*a,1.9779984951*s-2.428592205*r+.4505937099*a,.0259040371*s+.7827717662*r-.808675766*a]}function ss([t,n,e]){let o=(t+.3963377774*n+.2158037573*e)**3,s=(t-.1055613458*n-.0638541728*e)**3,r=(t-.0894841775*n-1.291485548*e)**3;return[4.0767416621*o-3.3077115913*s+.2309699292*r,-1.2684380046*o+2.6097574011*s-.3413193965*r,-.0041960863*o-.7034186147*s+1.707614701*r].map(a=>os(Math.max(0,Math.min(1,a)))*255)}var In=new Map;function rs(t){if(!In.has(t)){let n=Pn.find(e=>e.value===t);In.set(t,n&&"ends"in n?n.ends.map(es):void 0)}return In.get(t)}function Fn(t,n,e=0){let o=Math.max(0,Math.min(1,n)),s=rs(t);if(!s)return Tn(jt(o),Vt,zt).map(l=>l*255);let[r,a]=s,c=r[0],i=a[0],f=i<e&&c>e?(c-e)/(c-i):1;return ss(r.map((l,h)=>l+(a[h]-l)*o*f))}function Go(t,n,e){let[o,s,r]=Fn(t,n,e).map(Math.round);return`rgb(${o}, ${s}, ${r})`}function an(t,n,e){let[o,s,r]=Fn(t,n,e).map(Math.round);return Y(o,s,r,255)}function as(t,n){let{field:e,scheme:o,darkest:s,shade:r=Nn}=t;return e==="walk"?an(o,r):n===void 0?Xo:an(o,Wo(t,n),s)}var Xo=On;function cs(t){let{field:n,scheme:e,darkest:o,shade:s=Nn}=t,r=(a,c)=>({offset:a,color:Go(e,c,o),abgr:an(e,c,o)});return n==="walk"?[r(0,s)]:Array.from({length:7},(a,c)=>r(c/6,Wo(t,c/6)))}export{ue as a,me as b,Rt as c,yn as d,ls as e,Y as f,po as g,hs as h,St as i,us as j,ce as k,ms as l,le as m,ps as n,yo as o,Fs as p,Tn as q,Ls as r,De as s,Hs as t,We as u,Ge as v,Ds as w,Do as x,Pn as y,Je as z,ts as A,as as B,Xo as C,cs as D};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{G as Qn,H as Zn,I as mn,J as pn,S as to,U as tn,V as gn,Y as no,Z as oo,d as Kn,e as Un,f as Yn,g as dn,i as qn,j as Vn,k as zn,l as jn,m as Yt,z as Jn}from"./chunk-NSBH4FIW.js";import{a as Kt,g as Ut}from"./chunk-NAC3EXT4.js";var Rt=2,io=1.5,qo=4,eo=12,Vo=64,so=24,zo=48,ro="a thread per pass through a node",yn=t=>t.length>1&&t.some(n=>n.mostPasses>1),lo=t=>t*Rt+Math.max(0,t-1)*io,ao=t=>t.reduce((n,e)=>n+e,0);function fo(t,n,e){let o=t.map((a,c)=>n[c]>1?lo(a):e*Math.min(1,a)),s=0,r=t.map(a=>{let c=Math.min(1,a),i=qo*c*s;return s=Math.max(s,c),i});return{widths:o,gaps:r,band:ao(o)+ao(r)}}var xn=Rt+io;function qt(t,n,e=t){let{widths:o,gaps:s,band:r}=fo(t,n,Rt),a=-r/2;return o.map((c,i)=>{a+=s[i];let f=n[i]>1?Math.max(0,c-lo(e[i])):0,l=a+f/2+Rt/2;return a+=c,l})}var en=t=>fo(t,t,Rt).band,sn=t=>Math.min(1,zo/(en(t)||1)),ls=t=>sn(t.map(n=>n.mostPasses))<1?`${ro}, thinned to fit`:ro;function wn(t,n,e){let o=({normal:c,offsetX:i})=>({dx:c.nx*i,dy:c.ny*i}),{dx:s,dy:r}=Un(o(t),o(n),e),a=Math.hypot(s,r);return a>0?{normal:{nx:s/a,ny:r/a},offsetX:a}:{normal:{nx:0,ny:0},offsetX:0}}function nn(t,n){let e=t.stepOf[n],o=n-t.starts[e];return t.forward[e]?o:t.starts[e+1]-t.starts[e]-1-o}var Lt=(t,n)=>{let e=n.x-t.x,o=n.y-t.y;return Math.sqrt(e*e+o*o)};function Ht(t){let n=new Float64Array(t.length);for(let e=1;e<t.length;e++)n[e]=n[e-1]+Lt(t[e-1],t[e]);return n}function Mn(t,n){let e=new Set;return t.map(o=>{let s=new Map;return o.map(r=>r.map(a=>{let c=s.get(a)??0;s.set(a,c+1);let i=n[a],f=!!i?.length&&!e.has(a);return f&&e.add(a),{id:a,visit:c,owned:f,segments:i}}))})}function jo(t,n,e){let o=[];return t.forEach((s,r)=>{let a=0;for(let M of s)for(let{segments:A}of M)a+=A?.length??0;let c=new Float64Array(a),i=new Float64Array(a),f=0,l=0,h=u();function u(){return{walk:r,ids:[],visits:[],forward:[],owned:[],starts:[0]}}let m=()=>{if(h.ids.length){let M=new Int32Array(f-l);for(let A=0;A<h.ids.length;A++)M.fill(A,h.starts[A],h.starts[A+1]);o.push({...h,xs:c.subarray(l,f),ys:i.subarray(l,f),stepOf:M})}h=u(),l=f},w=(M,A,R)=>{let P=R.x-M,k=R.y*n-A;return Math.sqrt(P*P+k*k)};for(let M of s)M.forEach(({id:A,visit:R,owned:P,segments:k},W)=>{if(!k?.length){m();return}let F=k[0],S=k.at(-1),b;if(f>l){let g=c[f-1],E=i[f-1],x=w(g,E,F),C=w(g,E,S);b=x<=C,Math.min(x,C)>e&&m()}else{let g=M[W+1]?.segments,E=x=>g?.length?Math.min(w(x.x,x.y*n,g[0]),w(x.x,x.y*n,g.at(-1))):0;b=E(S)<=E(F)}h.ids.push(A),h.visits.push(R),h.forward.push(b),h.owned.push(P);for(let g=0;g<k.length;g++){let E=k[b?g:k.length-1-g];c[f]=E.x,i[f]=E.y*n,f++}h.starts.push(f-l)}),m()}),o}function An(t,n,e){let o=[];for(let s=0;s<n.length;s++){if(!n[s])continue;let r=s;for(;r+1<n.length&&n[r+1];)r++;let a=o.at(-1),c=a?a[1]:0,i=s;for(;i>c&&t[s]-t[i-1]<=e;)i--;let f=r;for(;f+1<t.length&&t[f+1]-t[r]<=e;)f++;a&&i<=a[1]+1?a[1]=f:o.push([i,f]),s=r}return o}function Jo(t,n){let e=Ht(t),o=e.at(-1),s=(c,i)=>{let f=t[i],l=t[Math.min(i+1,t.length-1)],h=e[Math.min(i+1,t.length-1)]-e[i],u=h>0?(c-e[i])/h:0;return{x:f.x+(l.x-f.x)*u,y:f.y+(l.y-f.y)*u}},r=0,a=0;return t.map((c,i)=>{let f=Math.max(0,e[i]-n/2),l=Math.min(o,e[i]+n/2);for(;r<t.length-1&&e[r+1]<=f;)r++;for(;a<t.length-1&&e[a+1]<=l;)a++;let h=s(f,r),u=s(l,a),m=Lt(h,u);return m>0?{nx:-(u.y-h.y)/m,ny:(u.x-h.x)/m}:void 0})}function Qo(t,n,e){let o=Ht(t),s=t.slice(),r=[];o.forEach((c,i)=>{let f=r.at(-1);(f===void 0||c-o[f]>=n/4)&&r.push(i)}),r.at(-1)!==t.length-1&&r.push(t.length-1);let a=0;for(;a<r.length;){let c=r[a],i=-1;for(let u=a+1;u<r.length&&o[r[u]]-o[c]<=e;u++){let m=r[u];o[m]-o[c]>Math.PI*n&&Lt(t[c],t[m])<=n&&(i=u)}if(i<0){a++;continue}let f=r[i],l=t[c],h=t[f];for(let u=c+1;u<f;u++){let m=(o[u]-o[c])/(o[f]-o[c]);s[u]={...t[u],x:l.x+(h.x-l.x)*m,y:l.y+(h.y-l.y)*m}}a=i}return s}function ho(t,n){let e=t.length,o=Ht(t),s=o[e-1],r=new Float64Array(e+1),a=new Float64Array(e+1),c=new Float64Array(e+1);for(let h=0;h<e;h++){let u=t[h],m=(o[Math.min(h+1,e-1)]-o[Math.max(h-1,0)])/2;r[h+1]=r[h]+m,a[h+1]=a[h]+m*u.x,c[h+1]=c[h]+m*u.y}let i=new Array(e),f=0,l=0;for(let h=0;h<e;h++){let u=t[h],m=Math.min(n,o[h],s-o[h]),w=o[h]-m,M=o[h]+m+1e-9*(1+s);for(;f<e&&o[f]<w;)f++;for(;l<e&&o[l]<M;)l++;let A=r[l]-r[f];i[h]=A>0?{x:(a[l]-a[f])/A,y:(c[l]-c[f])/A}:{x:u.x,y:u.y}}return i}function co(t,n){let e=t.length,o=Ht(t),s=o[e-1],r=new Uint8Array(e),a=(f,l)=>{let h=t[f],u=t[f+1];if(!u)return h;let m=o[f+1]-o[f],w=m>0?(l-o[f])/m:0;return{x:h.x+(u.x-h.x)*w,y:h.y+(u.y-h.y)*w}},c=0,i=0;for(let f=0;f<e;f++){if(o[f]<n||s-o[f]<n)continue;for(;c+1<e&&o[c+1]<=o[f]-n;)c++;for(;i+1<e&&o[i+1]<=o[f]+n;)i++;let l=t[f],h=a(c,o[f]-n),u=a(i,o[f]+n),m=Math.abs((u.x-h.x)*(l.y-h.y)-(u.y-h.y)*(l.x-h.x));r[f]=m>0&&Lt(h,u)*Lt(h,l)*Lt(l,u)/(2*m)<n?1:0}return{tight:r,s:o}}function Zo(t,n){let e=t.slice(),{tight:o,s}=co(e,n),r=An(s,Array.from(o,a=>a>0),3*n);for(let a=0;a<8&&r.length;a++)r=r.filter(([c,i])=>{let f=e.slice(c,i+1),l=co(f,n);if(!l.tight.includes(1))return!1;let h=on(l.s,l.tight,n),u=ho(f,n);for(let m=0;m<f.length;m++){let w=Math.min(1,3*h[m]);if(w>0){let M=f[m],A=u[m];e[c+m]={x:M.x+(A.x-M.x)*w,y:M.y+(A.y-M.y)*w}}}return!0});return e}function te(t,n,e,o,s,r){let a=n.length,c=new Float64Array(a),i=0,f=0,l=0,h=0,u=0;for(let m=0;m<a;m++){for(;i<a&&t[i]-t[m]<=r;){let w=e(i),M=n[i];c[i]=w&&M?w.nx*M.nx+w.ny*M.ny:0,l+=c[i],i++}for(;t[m]-t[f]>r;)l-=c[f++];if(Math.abs(l)>1e-9&&(h=l<0?-1:1),!!h)for(;u<=m;u++)s(u,h)}if(u<a){let m=0;for(let w=0;w<a;w++)m+=o(w)?1:-1;for(;u<a;u++)s(u,m<0?-1:1)}}function ne(t,n,e,o,s=!0){let r=Math.max(e,2*o),a=Math.PI*o,c=s?a+3*o+r/2:r/2,i=new Map,f=new Map,l=[],h=[],u=w=>({normals:new Array(w),shifts:s?new Array(w):[]}),m=(w,M,A,R)=>{let P=i.get(w);P||(P=[],i.set(w,P)),(P[M]??=[])[A]=R};return t.forEach((w,M)=>{let{walk:A,ids:R,visits:P,owned:k,starts:W,xs:F,ys:S,stepOf:b}=w,g=R.length,E=F.length,x=new Array(g);for(let d=0;d<g;d++)k[d]&&(x[d]=u(W[d+1]-W[d]),f.set(R[d],{run:M,step:d,frame:x[d]}),m(R[d],A,P[d],x[d]));let C=new Float64Array(E);for(let d=1;d<E;d++){let I=F[d]-F[d-1],N=S[d]-S[d-1];C[d]=C[d-1]+Math.sqrt(I*I+N*N)}let Z=C[E-1],D=new Int32Array(g).fill(-1),G=new Int32Array(g),q=new Array(g);for(let d=0;d<g;d++){let I=k[d]?void 0:f.get(R[d]);I&&(D[d]=I.run,G[d]=I.step,q[d]=I.frame)}let st=new Int32Array(g),it=new Int32Array(g);for(let d=0;d+1<g;d++){let N=D[d]>=0&&D[d+1]===D[d]?G[d+1]-G[d]:0;st[d+1]=st[d]+(N===1?1:0),it[d+1]=it[d]+(N===-1?1:0)}let ot=new Array(g),_=0,L=0;for(let d=0;d<g;d++){if(!s){ot[d]=!k[d];continue}let I=C[W[d]]-c,N=C[W[d+1]-1]+c;for(;C[_]<I;)_++;for(;L+1<E&&C[L+1]<=N;)L++;let j=b[Math.max(0,_-1)],at=b[Math.min(E-1,L+1)],H=at-j,ft=st[at]-st[j],wt=it[at]-it[j];ot[d]=!k[d]&&I>=0&&N<=Z&&H>0&&(ft===H||wt===H)}for(let d=0;d<g;d++){if(k[d])continue;let I=q[d];x[d]=!s&&ot[d]?I:ot[d]?{normals:I.normals,shifts:I.shifts}:u(I.normals.length),m(R[d],A,P[d],x[d])}h.push(x);let V=new Array(E);for(let d=0;d<E;d++)V[d]=!ot[b[d]];for(let[d,I]of An(C,V,c)){let N=[];for(let H=d;H<=I;H++)N.push({x:F[H],y:S[H]});let j=s?Zo(ho(Qo(N,o/2,a),o/2),o/2):N,at=Jo(j,r);te(Ht(j),at,H=>{let ft=b[d+H];return(k[ft]?x[ft]:q[ft])?.normals[nn(w,d+H)]},H=>w.forward[b[d+H]],(H,ft)=>{let wt=d+H,Dt=b[wt];if(ot[Dt])return;let Wt=nn(w,wt),Ot=at[H];x[Dt].normals[Wt]=Ot&&(ft>0?Ot:{nx:-Ot.nx,ny:-Ot.ny}),s&&(x[Dt].shifts[Wt]={dx:j[H].x-N[H].x,dy:(j[H].y-N[H].y)/n})},r)}if(!s){l.push(C);return}let rt=new Float64Array(E),X=0,z=0;for(let d=0;d<E;d++){let I=x[b[d]].shifts[nn(w,d)],N=F[d]+(I?.dx??0),j=S[d]+(I?.dy??0)*n;rt[d]=d?rt[d-1]+Math.sqrt((N-X)**2+(j-z)**2):0,X=N,z=j}l.push(rt)}),{frames:i,arcs:l,stepFrames:h}}function uo(t,n,e,o){let s=new Array(n.length),r=[],a=0,c=0;for(let i=0;i<n.length;i++){for(;c<n.length&&t[c]-t[i]<=e;){for(;r.length>a&&o*n[r.at(-1)]<=o*n[c];)r.pop();r.push(c++)}for(;t[i]-t[r[a]]>e;)a++;s[i]=n[r[a]]}return s}function on(t,n,e,o=()=>!0){let s=n.length,r=new Float64Array(s+1),a=new Float64Array(s+1);for(let l=0;l<s;l++){let h=o(n[l])?s>1?(t[Math.min(l+1,s-1)]-t[Math.max(l-1,0)])/2:1:0;r[l+1]=r[l]+h,a[l+1]=a[l]+h*n[l]}let c=new Float64Array(s),i=0,f=0;for(let l=0;l<s;l++){for(;t[l]-t[i]>e;)i++;for(;f<s&&t[f]-t[l]<=e;)f++;let h=r[f]-r[i];c[l]=h>0?(a[f]-a[i])/h:n[l]}return c}var oe=[0];function ee(t){for(let n of t.values())if(n>1)return!0;return!1}function se(t,n,e,o,s){if(!ee(n))return{span:n,nodeThreads:new Map,threadPasses:new Map,threadAt:new Map,linkThreads:new Map};let r=new Map,a=[],c=[],i=[],f=[],l=[],h=[],u=[];for(let S of t){let b=[],g=[];for(let _ of S){let L=r.get(_);L===void 0&&(L=a.length,r.set(_,L),a.push(_),c.push(0),i.push(0)),g.push(L);let V=e[_],rt=V?.[Math.floor(V.length/2)];b.push(rt?{x:rt.x,y:rt.y*o}:b.at(-1)??{x:0,y:0})}let E=Ht(b),x=S.map(_=>n.get(_)??1),C=uo(E,x,s/2,1),Z=g.map(_=>++i[_]),D=S.length,G=new Int32Array(D),q=-1;for(let _=0;_<D;_++)q=x[_]===C[_]?_:q,G[_]=q;let st=new Int32Array(D);q=-1;for(let _=D-1;_>=0;_--)q=x[_]===C[_]?_:q,st[_]=q;let it=new Array(D),ot=new Array(D).fill(NaN);for(let _=0;_<D;_++){let L=G[_],V=st[_],rt=L<0?V:V<0||E[_]-E[L]<=E[V]-E[_]?L:V,X=z=>Math.min(Z[z],C[_])-1;if(it[_]=X(rt),x[_]===1&&L>=0&&V>=0&&X(V)!==X(L)){let z=(E[_]-E[L])/(E[V]-E[L]||1);ot[_]=X(L)+(X(V)-X(L))*z}c[g[_]]=Math.max(c[g[_]],C[_])}f.push(g),l.push(Z),h.push(it),u.push(ot)}let m=[],w=[],M=(S,b)=>{let g=c[S],E=m[S]??=new Set;for(let x=0;x<g;x++)for(let C of[b-x,b+x])if(C>=0&&C<g&&!E.has(C))return C;return b},A=[];f.forEach((S,b)=>{S.forEach((g,E)=>{if(c[g]>1){let x=u[b][E],C=M(g,Number.isNaN(x)?h[b][E]:Math.round(x));m[g].add(C),(w[g]??=[])[l[b][E]]=C,Number.isNaN(x)||((A[g]??=[])[C]=x)}})});let R=new Map,P=new Map,k=new Map,W=new Map;a.forEach((S,b)=>{A[b]&&W.set(S,A[b]),R.set(S,c[b]),P.set(S,m[b]?[...m[b]].sort((E,x)=>E-x):oe);let g=[];w[b]?.forEach((E,x)=>{g[E]=x-1}),k.set(S,g)});let F=new Map;return f.forEach((S,b)=>{let g=l[b];for(let E=1;E<S.length;E++){let x=S[E-1],C=S[E],Z=[w[x]?.[g[E-1]]??0,w[C]?.[g[E]]??0],D=F.get(a[x]);D||(D=new Map,F.set(a[x],D));let G=D.get(a[C]);G?G.some(([q,st])=>q===Z[0]&&st===Z[1])||G.push(Z):D.set(a[C],[Z])}}),{span:R,nodeThreads:P,threadPasses:k,threadAt:W,linkThreads:F}}function re(t,n,e,{reach:o,taper:s}){let r=new Map;return t.forEach((a,c)=>{let i=n[c],f=a.ids.map((l,h)=>{let u=a.starts[h+1]-a.starts[h],m=Math.floor(u/2);return i[a.starts[h]+(a.forward[h]?m:u-1-m)]});for(let[l,h]of An(f,a.owned,o/2+s/2)){let u=f.slice(l,h+1),m=a.ids.slice(l,h+1),w=e.map(M=>{let A=m.map(R=>M.get(R)??0);return A.every(R=>R===A[0])?{slot:A,held:A}:{slot:on(u,uo(u,A,o/2,1),s/2),held:on(u,A,s/2,R=>R>0)}});m.forEach((M,A)=>{a.owned[l+A]&&r.set(M,{slot:w.map(R=>R.slot[A]),held:w.map(R=>R.held[A])})})}}),r}function ae(t,n,e,o,s,r,a){let c=qt(s,s),i=new Map,f=l=>{let h=i.get(l);if(!h){let u=o.get(l);h=u?qt(u.slot,s,u.held):c,i.set(l,h)}return h};t.forEach((l,h)=>{let{walk:u,ids:m,visits:w,starts:M}=l,{threadPasses:A,threadAt:R}=r[u],P=new Float64Array(l.xs.length);m.forEach((W,F)=>{let S=Math.max(0,A.get(W)?.indexOf(w[F])??0),b=R.get(W)?.[S]??S;P.fill(f(W)[u]+b*xn,M[F],M[F+1])});let k=on(e[h],P,a);n[h].forEach((W,F)=>{let S=M[F],b=M[F+1],g=!0;for(let x=S+1;g&&x<b;x++)g=Math.abs(k[x]-k[S])<1e-9;if(g){W.offset=k[S];return}let E=new Array(b-S);for(let x=S;x<b;x++)E[nn(l,x)]=k[x];W.offsets=E})})}function mo(t,n,e,o,s=Mn(t.map(r=>r.route),n)){let r=yn(t),a=t.map(M=>M.mostPasses),c=Vo*o,i=jo(s,e,eo*o),f=en(a)*(r?sn(a):1)*o,l=ne(i,e,eo*o,f,r),h=r?t.map(M=>se(M.route,M.passes,n,e,c)):void 0,u=h?re(i,l.arcs,h.map(M=>M.span),{reach:c,taper:so*o}):void 0;u&&h&&ae(i,l.stepFrames,l.arcs,u,a,h,so/2*o);let m={dx:0,dy:0},w=new Set;for(let M of l.frames.values())for(let{shifts:A}of M.flat())if(!w.has(A)){w.add(A);for(let R of A)m.dx=Math.max(m.dx,Math.abs(R?.dx??0)),m.dy=Math.max(m.dy,Math.abs(R?.dy??0))}return{lines:l,threads:h,spans:u,furthestShift:m}}function Y(t,n,e,o){return(o<<24|e<<16|n<<8|t)>>>0}function En(t){return t&255}function vn(t){return t>>>8&255}function bn(t){return t>>>16&255}function _n(t){return t>>>24&255}function po(t){return`rgba(${En(t)},${vn(t)},${bn(t)},${_n(t)/255})`}function hs(t,n){return`rgba(${Math.round(t[0]*255)},${Math.round(t[1]*255)},${Math.round(t[2]*255)},${n})`}function St(t,n){return Y(En(t),vn(t),bn(t),Math.round(_n(t)*n))}function us(t,n){let e=Math.max(0,1-1/n),o=s=>Math.round(s+(255-s)*e);return Y(o(En(t)),o(vn(t)),o(bn(t)),_n(t))}var go=300,Vt=.7,zt=.5;function ce(t){return`hsl(${t}, ${Vt*100}%, ${zt*100}%)`}function jt(t){return Math.max(0,Math.min(1,t))*go}function Rn(t,n){return jt((t-n.start)/(n.end-n.start))}var ie=30;function ms({start:t,bp:n,reversed:e},o){let s=Rn(t,o),r=Rn(t+n,o);if(r-s<1)return[(s+r)/2];let a=Math.ceil((r-s)/ie);return Array.from({length:a+1},(c,i)=>Rn(t+n*(e?a-i:i)/a,o))}var le=Array.from({length:7},(t,n)=>({offset:n/6,color:ce(n/6*go)})),ps=`linear-gradient(to right, ${le.map(t=>`${t.color} ${t.offset*100}%`).join(", ")})`;var fe=Yt();function yo(t,n,e,o,s,r,a=!1){return fe(t,[n,e.scaleX,e.scaleY,o,r,a,s],()=>{let c=new Map;for(let i=0;i<n.edges.length;i++){let f=o?.get(i),l=Jn(t,n.edges[i],e,f,f&&r?.[i],a);l&&c.set(i,l)}return c})}var he=4;function ue(t){let n=new Map;for(let e of t.edges)Kt(n,e.from,e.to),Kt(n,e.to,e.from);return n}function de({nodeId:t,nodeById:n,neighbors:e}){let o=new Set([t]),s=[t],r=1/0,a=-1/0;for(let c=0;c<he&&s.length>0;c++){let i=[];for(let f of s){let l=e.get(f);if(l){for(let h of l)if(!o.has(h)){o.add(h);let u=n.get(h);u&&Ut(u)?(r=Math.min(r,u.stable.start+u.length),a=Math.max(a,u.stable.start)):i.push(h)}}}s=i}return r===1/0?void 0:{start:Math.min(r,a),end:Math.max(r,a)}}function me({nodeId:t,nodeById:n,neighbors:e}){let o=n.get(t);return o===void 0?void 0:Ut(o)?{start:o.stable.start,end:o.stable.start+o.length}:de({nodeId:t,nodeById:n,neighbors:e})}function xo(t){let n=new Map(t.nodes.map(s=>[s.id,s])),e=ue(t),o=new Map;for(let s of t.nodes){let r=me({nodeId:s.id,nodeById:n,neighbors:e});r&&o.set(s.id,(r.start+r.end)/2)}return o}var pe=Y(119,119,119,217),wo=Y(136,136,136,217),ge=Y(24,24,28,240),Mo=2.2,Io=Y(160,160,160,255),Jt=.18,ye=.45,Fs=po(St(Io,Jt)),xe=11,we=1.2,Me=1e-6,Ae=7,Ee=3,ve=3,be=1.5,Ao=3,_e=.5,Re=.45,Sn=12,Se=1e-6,xt=new Float64Array(64),Ct=new Float64Array(64),Tt=new Float64Array(64);function Ce(t,n,e,o){let s=t.length*Sn+1;xt.length<s&&(xt=new Float64Array(s),Ct=new Float64Array(s),Tt=new Float64Array(s));let r=t[t.length-1];xt[0]=r.x1,Ct[0]=r.y1,Tt[0]=0;let a=1,c=0;for(let i=t.length-1;i>=0&&c<o;i--){let f=t[i];for(let l=1;l<=Sn&&c<o;l++){let h=1-(l/Sn)**2,u=1-h,m=u*u*u,w=3*u*u*h,M=3*u*h*h,A=h*h*h,R=m*f.x0+w*f.cx0+M*f.cx1+A*f.x1,P=m*f.y0+w*f.cy0+M*f.cy1+A*f.y1;c+=Math.hypot(R-xt[a-1],(P-Ct[a-1])*e)*n,xt[a]=R,Ct[a]=P,Tt[a]=c,a++}}return a}function Eo(t,n){let e=1;for(;e<t-1&&Tt[e]<n;)e++;let o=Tt[e-1],s=Tt[e],r=s>o?Math.min(1,Math.max(0,(n-o)/(s-o))):0;return{x:xt[e-1]+(xt[e]-xt[e-1])*r,y:Ct[e-1]+(Ct[e]-Ct[e-1])*r}}function Te({curves:t,edgeHalfWidth:n,nodeHalfWidth:e,scale:o,yToX:s,color:r,fromSegments:a,toSegments:c}){let i=Ae+Ee*n,f=Ce(t,o,s,e+Ao*i),l=Tt[f-1],h=l<Se,u=Math.min(e,l),m=h?Math.min(1,jn(a,o,o*s)/i):1;if(h?m<_e:l<Ao*i)return;let w=Eo(f,u),M=Eo(f,u+i*m),A=w.x-M.x,R=(w.y-M.y)*s,P=t[t.length-1];return{x:w.x,y:w.y,angle:Math.hypot(A,R)>0?Math.atan2(R,A):Xe(P,s,Ie(P,c)),length:i*m,halfWidth:(ve+be*n)*m,color:r}}var vo=[[0,0]],Oe=[0],bo={dx:0,dy:0};function Po(t,n,e){let o=s=>Math.hypot(s.x-t.x,(s.y-t.y)*e);return o(n[0])<o(n.at(-1))}function ke(t,n,e,o,s){return o?qn(t).from==="start":Po({x:e.x0,y:e.y0},n,s)}function Ie(t,n){if(n.length<2)return;let e=n[0],o=n[n.length-1];return Math.hypot(t.x1-e.x,t.y1-e.y)<=Math.hypot(t.x1-o.x,t.y1-o.y)?{from:e,to:n[1]}:{from:o,to:n[n.length-2]}}function _o(t,n){if(!t||!n)return;let e=n.x-t.x,o=n.y-t.y,s=Math.hypot(e,o);return s>0?{nx:-o/s,ny:e/s}:void 0}var No=.1,Pe=1/Math.sqrt(No);function Ro(t,n=1){let e=n===1?t:t.map(o=>({x:o.x,y:o.y*n}));return e.map((o,s)=>{let r=_o(e[s-1],o),a=_o(o,e[s+1]);if(r&&a){let c=(r.nx+a.nx)/2,i=(r.ny+a.ny)/2,f=r.nx*c+r.ny*i;return f>No?{nx:c/f,ny:i/f}:{nx:c,ny:i}}return r??a??{nx:0,ny:0}})}function So(t,n,e,o=1){let s=new Array(t.length);for(let r=0;r<t.length;r++){let a=typeof e=="number"?e:e[r];s[r]={x:t[r].x+n[r].nx*a,y:t[r].y+n[r].ny*a/o}}return s}function Tn(t,n,e){let o=(1-Math.abs(2*e-1))*n,s=o*(1-Math.abs(t/60%2-1)),r=e-o/2,a=0,c=0,i=0;return t<60?(a=o,c=s):t<120?(a=s,c=o):t<180?(c=o,i=s):t<240?(c=s,i=o):t<300?(a=s,i=o):(a=o,i=s),[a+r,c+r,i+r]}function rn(t,n,e,o=1){let[s,r,a]=Tn(t,n,e);return Y(Math.round(s*255),Math.round(r*255),Math.round(a*255),Math.round(o*255))}var Ne=[[68,1,84],[59,82,139],[33,145,140],[94,201,98],[253,231,37]],Fe=[[237,137,44],[158,42,122]],Le=[[220,50,50],[50,120,220]];function Cn(t,n){let e=Math.max(0,Math.min(1,n))*(t.length-1),o=Math.min(t.length-2,Math.floor(e)),s=e-o,r=t[o],a=t[o+1];return Y(Math.round(r[0]+(a[0]-r[0])*s),Math.round(r[1]+(a[1]-r[1])*s),Math.round(r[2]+(a[2]-r[2])*s),255)}function He(t,n){return rn(Qn(t),mn,pn,n)}var Fo=[60,65,72],On=Y(...Fo,255),Ls=`rgb(${Fo.join(", ")})`;function De(t,n){let e=n.midpoints.get(t.id);return Ut(t)&&e!==void 0?(e-n.start)/n.span:void 0}function Hs(t,n){let e=xo(t);if(n&&n.end>n.start)return{start:n.start,span:n.end-n.start,midpoints:e};let o=1/0,s=-1/0;for(let r of e.values())o=Math.min(o,r),s=Math.max(s,r);return{start:o===1/0?0:o,span:s>o?s-o:1,midpoints:e}}function We(t,n){let e=1/0,o=-1/0,s=1/0,r=-1/0,a=0;for(let c of t.nodes)c.stable!==void 0&&c.stable.rank>a&&(a=c.stable.rank),c.depth<e&&(e=c.depth),c.depth>o&&(o=c.depth),c.length<s&&(s=c.length),c.length>r&&(r=c.length);return{minDepth:e,maxDepth:o,minLength:s,maxLength:r,maxRank:a,nodeCount:t.nodes.length,referenceRamp:n}}function Ge(t,n,e,o){switch(e){case"random":return He(t.id,1);case"depth":return Cn(Ne,o.maxDepth>o.minDepth?(t.depth-o.minDepth)/(o.maxDepth-o.minDepth):.5);case"node-length":return Cn(Le,o.maxLength>o.minLength?(t.length-o.minLength)/(o.maxLength-o.minLength):.5);case"stable-rank":return t.stable===void 0?Y(160,160,160,255):t.stable.rank===0?Y(52,152,219,255):Cn(Fe,o.maxRank>1?(t.stable.rank-1)/(o.maxRank-1):0);case"reference-position":{let s=o.referenceRamp;if(s===void 0)return Y(160,160,160,255);let r=De(t,s);return r===void 0?On:rn(jt(r),Vt,zt)}case"grey":return Y(160,160,160,255);case"rainbow":{let s=o.nodeCount>1?n/o.nodeCount*360:0;return rn(s,.75,.5)}default:return Y(52,152,219,255)}}function Xe(t,n=1,e){let o=[[t.cx1,t.cy1],[t.cx0,t.cy0],[t.x0,t.y0]];for(let[s,r]of o){let a=t.x1-s,c=(t.y1-r)*n;if(Math.hypot(a,c)>0)return Math.atan2(c,a)}return e?Math.atan2((e.to.y-e.from.y)*n,e.to.x-e.from.x):0}function Be(t,n){let e=!1;for(let o=0;o<t.length-1&&!e;o++){let s=t[o],r=t[o+1];e=Math.max(s.x,r.x)>=n.minX&&Math.min(s.x,r.x)<=n.maxX&&Math.max(s.y,r.y)>=n.minY&&Math.min(s.y,r.y)<=n.maxY}return e}function Co(t,n,e=0,o=0){for(let s of t){let r=Math.min(s.x0,s.cx0,s.cx1,s.x1),a=Math.max(s.x0,s.cx0,s.cx1,s.x1),c=Math.min(s.y0,s.cy0,s.cy1,s.y1),i=Math.max(s.y0,s.cy0,s.cy1,s.y1);if(a>=n.minX-e&&r<=n.maxX+e&&i>=n.minY-o&&c<=n.maxY+o)return!0}return!1}var To=new WeakMap;function $e(t){let n=To.get(t);if(!n){let e=[],o=new Map,s=t.paths??[];for(let r=0;r<s.length;r++)e.push(rn(Zn(r,s.length),mn,pn,.85)),o.has(s[r].name)||o.set(s[r].name,r);n={pathColorByIndex:e,pathIndexByName:o},To.set(t,n)}return n}var Oo=new WeakMap,Ke=new Map;function Ue(t){let n=Oo.get(t);if(!n){n=new Map;for(let[e,o]of(t.paths??[]).entries())for(let s of new Set(o.nodeIds))Kt(n,s,e);Oo.set(t,n)}return n}var Ye=Yt(),qe=Yt(),ko=new WeakMap;function Ve(t){let n=ko.get(t);if(!n){n=new Map;for(let{from:e,to:o}of t.edges){let s=n.get(e);s||(s=new Set,n.set(e,s)),s.add(o)}ko.set(t,n)}return n}function Ds(t){let{nodePositions:n,graph:e,nodeById:o,colorScheme:s,contigThickness:r,connectorThickness:a,drawPaths:c,nodeWidth:i="uniform",edgeWidth:f="uniform",highlight:l,axis:h,linearLayout:u,viewportBounds:m,referenceRamp:w,deletions:M,deletionRoutes:A,stranded:R,hiddenEdges:P,version:k=0}=t,W=to(e,i),F=f==="walks"?no(e):0,S=h.scaleX,b=1/Math.max(S,Me),g=Vn(h),E=yo(n,e,h,M,k,A,R),x=[],C=new Map,Z=[],D=new Map,G=[],q=new Map,st=We(e,w),it=new Map;if(s==="rainbow")for(let p=0;p<e.nodes.length;p++)it.set(e.nodes[p].id,p);let ot=e.paths?.length??0,{pathColorByIndex:_,pathIndexByName:L}=$e(e),V=p=>_[L.get(p)??-1]??wo,rt=c&&ot>1?Ue(e):Ke,X=l?.walks??[],z=yn(X),d=X.map(p=>p.mostPasses),I=z?sn(d):1,N=l&&X.length>1?Ye(l,[n,k,h.scaleX,h.scaleY],()=>mo(X,n,g,b,qe(l,[n,k],()=>Mn(X.map(p=>p.route),n)))):void 0,j=N?.lines,at=N?.threads,H=N?.spans,ft=z?qt(d,d):[],wt=new Map,Dt=p=>{let y=wt.get(p);if(!y){let v=H?.get(p);y=v?qt(v.slot,d,v.held):ft,wt.set(p,y)}return y},Wt=(p,y,v,T)=>z?(Dt(p)[v]+T*xn)*I:(v-(X.length-1)/2)*y,Ot=(p,y,v)=>{let T=p?.offsets?.[y]??p?.offset;return T===void 0?v:T*I},Ln=p=>z?Rt/2*I:p/2,Hn=new Map,Dn=new WeakMap,Wn=(p,y,v)=>at?.[p]?.threadPasses.get(y)?.[v]??0,cn=(p,y)=>{let v=Hn.get(p);return v||(v=Ro(y,g),Hn.set(p,v)),v},Bo=(p,y,v)=>{if(!v)return cn(p,y);let T=Dn.get(v.normals);return T||(T=cn(p,y).map((O,$)=>v.normals[$]??O),Dn.set(v.normals,T)),T},Gn=new Map,ln=p=>{let y=Gn.get(p);if(y===void 0){let v=o.get(p);y=gn(v?tn(v,r,i,W):r,X.length),Gn.set(p,y)}return y},Xn=(p,y,v,T,O,$)=>{let tt=T?0:v.length-1,K=y?.[O]?.[Wn(O,p,$)],ct=K?.offsets?.[tt]??K?.offset;return{normal:K?.normals[tt]??cn(p,v)[tt]??{nx:0,ny:0},shift:K?.shifts[tt]??bo,offset:ct===void 0?Wt(p,ln(p),O,$):ct*I}},$o=(p,y)=>{if(!m)return!0;let v=z?en(d)*I:(X.length-1)/2*ln(y),T=Pe*v*b;return Co(p,m,T+(N?.furthestShift.dx??0),T/g+(N?.furthestShift.dy??0))},Ko=(p,y,v)=>{let T=at?.[p]?.linkThreads;if(!T?.size)return vo;let O=T.get(y)?.get(v),$=Ve(e).get(v)?.has(y)?void 0:T.get(v)?.get(y);if(!$)return O??vo;let tt=$.map(([K,ct])=>[ct,K]);return O?[...O,...tt]:tt},fn=(p,y,v)=>X[p]?.passColors.get(y)?.[at?.[p]?.threadPasses.get(y)?.[v]??0],Bn=new WeakMap,Uo=(p,y)=>{if(!y||!z)return p;let v=Bn.get(y.shifts);if(!v){let{shifts:T}=y;v=p.map((O,$)=>{let{dx:tt,dy:K}=T[$]??bo;return{...O,x:O.x+tt,y:O.y+K}}),Bn.set(y.shifts,v)}return v},Yo=S>(u?1:Re);for(let p=0;p<e.edges.length;p++){let y=e.edges[p],v=n[y.from],T=n[y.to],O=E.get(p);if(!v?.length||!T?.length||!O||P?.has(p))continue;let $=y.pathIds?.length??0,K=M?.get(p)!==void 0,ct=l?.edgeIndexes.has(p)??!1,Gt=a/2*(K?Mo:1),kt=oo($,F,f),It=a/2*(K?f==="walks"&&F>0?Math.max(1,kt):Mo:kt),ht=c&&$>0,Pt=K?ge:pe,Mt=!l||ct?Pt:St(Pt,Jt),pt=o.get(y.to),Xt=(pt?tn(pt,r,i,W):r)/2,U=B=>!m||Co(B,m),Bt=B=>Kn(B,xe/S,g,m),Qt=(B,J,nt)=>{if(!K){G.push({curves:B,thickness:J,color:nt});return}for(let dt of Bt(B))G.push({curves:dt.curves,thickness:J,color:nt})},At=(B,J,nt,dt,vt,yt,bt,et,hn)=>{if(!K){G.push({curves:B,thickness:J,color:nt,walk:dt,pass:vt,normal:yt,offsetX:bt,endNormal:et,endOffsetX:hn});return}let _t={normal:yt,offsetX:bt},Ft={normal:et,offsetX:hn};for(let Q of Bt(B)){let mt=Q.startAlong===0?_t:wn(_t,Ft,Q.startAlong),lt=Q.endAlong===1?Ft:wn(_t,Ft,Q.endAlong);G.push({curves:Q.curves,thickness:J,color:nt,walk:dt,pass:vt,normal:mt.normal,offsetX:mt.offsetX,endNormal:lt.normal,endOffsetX:lt.offsetX})}},Nt=B=>{let J=Yo?Te({curves:B,edgeHalfWidth:K||ht?a/2:It,nodeHalfWidth:Xt,scale:S,yToX:g,color:Mt,fromSegments:v,toSegments:T}):void 0;J&&Z.push(J)},gt=G.length,$t=Z.length,Et=l?.walks.length&&ct&&!ht?l.walks:void 0;if(Et&&!$o(O,y.from))continue;if(Et){let B=ke(y,v,O[0],R,g),J=O.at(-1),nt=Po({x:J.x1,y:J.y1},T,g),dt=Et.length===1,vt=Ln(ln(y.from)),yt=j?.frames.get(y.from),bt=j?.frames.get(y.to);for(let et=0;et<Et.length;et++)if(Et[et].edgeIndexes.has(p))for(let[_t,Ft]of Ko(et,y.from,y.to)){let Q=Xn(y.from,yt,v,B,et,_t),mt=z?Xn(y.to,bt,T,nt,et,Ft):Q,lt=dt?0:Q.offset*b,un=z?mt.offset*b:lt,$n=z?Yn(O,Q.shift.dx+Q.normal.nx*lt,Q.shift.dy+Q.normal.ny*lt/g,mt.shift.dx+mt.normal.nx*un,mt.shift.dy+mt.normal.ny*un/g):lt===0?O:dn(O,Q.normal.nx*lt,Q.normal.ny*lt/g);U($n)&&At($n,vt,fn(et,y.from,_t)??fn(et,y.to,Ft)??Pt,et,_t,Q.normal,lt,mt.normal,un)}G.length>gt&&Nt(O)}else if(!ht)U(O)&&(Qt(O,It,Mt),Nt(O));else{let B=zn(v,T,$,h),J=Math.floor(($-1)/2);for(let nt=0;nt<$;nt++){let{x:dt,y:vt}=B[nt],yt=dt===0&&vt===0?O:dn(O,dt,vt);if(!U(yt))continue;let bt=V(y.pathIds[nt]);Qt(yt,Gt,l&&(l.walks.length?!l.names.has(y.pathIds[nt]):!ct)?St(bt,Jt):bt),nt===J&&Nt(yt)}}let Zt=G.length-gt;Zt>0&&q.set(p,{start:gt,count:Zt});let ut=Z.length-$t;ut>0&&D.set(p,{start:$t,count:ut})}for(let[p,y]of Object.entries(n)){let v=o.get(p);if(!v||m&&!Be(y,m))continue;let T=l!==void 0&&!l.nodeIds.has(p),O=T?Io:Ge(v,it.get(p)??0,s,st),$=T?St(O,Jt):v.moved?St(O,ye):O,tt=tn(v,r,i,W),K=tt/2,ct=x.length,Gt=rt.get(p),kt=tt/ot,It=y.length>=2,ht=l?.walks.length&&!T&&!Gt?.length?l.walks:void 0;if(It&&ht){let Mt=gn(tt,ht.length),pt=Ln(Mt),Xt=j?.frames.get(p);for(let U=0;U<ht.length;U++){let Bt=ht[U].colors.get(p);if(Bt===void 0)continue;let Qt=at?.[U]?.nodeThreads.get(p)??Oe;for(let At of Qt){let Nt=fn(U,p,At)??Bt;if(ht.length===1){x.push({points:y,thickness:pt,color:Nt,walk:U,pass:At});continue}let gt=Xt?.[U]?.[Wn(U,p,At)],$t=Bo(p,y,gt),Et=Uo(y,gt),Zt=Wt(p,Mt,U,At),ut=gt?.offsets?.map(J=>J*I*b),B=ut?ut[Math.floor(ut.length/2)]:Ot(gt,0,Zt)*b;x.push({points:So(Et,$t,ut??B,g),thickness:pt,color:Nt,walk:U,pass:At,normals:$t,offsetX:B,...ut&&{offsets:ut}})}}}else if(It&&Gt?.length&&kt>=we){let Mt=Ro(y,g);for(let pt of Gt){let Xt=(pt-(ot-1)/2)*kt*b,U=_[pt]??wo;x.push({points:So(y,Mt,Xt,g),thickness:kt/2,color:T?St(U,Jt):U})}}else It&&x.push({points:y,thickness:K,color:$});let Pt=x.length-ct;Pt>0&&C.set(p,{start:ct,count:Pt})}return{nodeStrokes:x,nodeStrokeRuns:C,arrows:Z,arrowRuns:D,edgeCurves:G,edgeCurveRuns:q}}var Do=[{value:"progress",label:"Progress along the walk"},{value:"walk",label:"One colour for the walk"},{value:"reference",label:"Reference position"}],Pn=[{value:"grey",label:"Grey to black",ends:["#a3a3a3","#151515"]},{value:"blue",label:"Cyan to navy",ends:["#6ee0f0","#0b2c7a"]},{value:"red",label:"Yellow to red",ends:["#ffd24a","#b3121b"]},{value:"purple",label:"Pink to plum",ends:["#f5a3d8","#5e1a6e"]},{value:"green",label:"Lime to forest",ends:["#b6e36c","#0b5d3b"]},{value:"orange",label:"Peach to rust",ends:["#ffc285","#8f3a00"]},{value:"rainbow",label:"Rainbow"}],kn=["blue","red","purple","green"],ze=t=>Do.some(n=>n.value===t),je=t=>Pn.some(n=>n.value===t);function Je(t,n,e,o=!0){let{field:s,scheme:r}=t.color??{},a=ze(s)?s:o?"progress":"walk",c=n?"grey":kn[e%kn.length],i=je(r)?r==="rainbow"&&a!=="reference"?c:r:c,f=Math.floor(e/kn.length)%Lo.length;return a==="walk"&&i===c&&f>0?{field:a,scheme:i,shade:Lo[f]}:o||a==="walk"?{field:a,scheme:i}:{field:a,scheme:i,darkest:Qe}}var Qe=.55,Nn=.5,Lo=[Nn,.85,.2],Ze=.08,Ho=({field:t,scheme:n})=>t!=="walk"&&n!=="rainbow";function ts(t){let n=new Map;for(let o of t)Ho(o)&&n.set(o.scheme,(n.get(o.scheme)??0)+1);let e=new Map;return t.map(o=>{let s=Ho(o)?n.get(o.scheme):1;if(s<2)return o;let r=e.get(o.scheme)??0;e.set(o.scheme,r+1);let a=Ze/2;return{...o,stretch:[r/s+(r>0?a:0),(r+1)/s-(r<s-1?a:0)]}})}var Wo=({stretch:t},n)=>t?t[0]+(t[1]-t[0])*n:n,ns=t=>t<=.04045?t/12.92:((t+.055)/1.055)**2.4,os=t=>t<=.0031308?t*12.92:1.055*t**(1/2.4)-.055;function es(t){let[n,e,o]=[1,3,5].map(c=>ns(Number.parseInt(t.slice(c,c+2),16)/255)),s=Math.cbrt(.4122214708*n+.5363325363*e+.0514459929*o),r=Math.cbrt(.2119034982*n+.6806995451*e+.1073969566*o),a=Math.cbrt(.0883024619*n+.2817188376*e+.6299787005*o);return[.2104542553*s+.793617785*r-.0040720468*a,1.9779984951*s-2.428592205*r+.4505937099*a,.0259040371*s+.7827717662*r-.808675766*a]}function ss([t,n,e]){let o=(t+.3963377774*n+.2158037573*e)**3,s=(t-.1055613458*n-.0638541728*e)**3,r=(t-.0894841775*n-1.291485548*e)**3;return[4.0767416621*o-3.3077115913*s+.2309699292*r,-1.2684380046*o+2.6097574011*s-.3413193965*r,-.0041960863*o-.7034186147*s+1.707614701*r].map(a=>os(Math.max(0,Math.min(1,a)))*255)}var In=new Map;function rs(t){if(!In.has(t)){let n=Pn.find(e=>e.value===t);In.set(t,n&&"ends"in n?n.ends.map(es):void 0)}return In.get(t)}function Fn(t,n,e=0){let o=Math.max(0,Math.min(1,n)),s=rs(t);if(!s)return Tn(jt(o),Vt,zt).map(l=>l*255);let[r,a]=s,c=r[0],i=a[0],f=i<e&&c>e?(c-e)/(c-i):1;return ss(r.map((l,h)=>l+(a[h]-l)*o*f))}function Go(t,n,e){let[o,s,r]=Fn(t,n,e).map(Math.round);return`rgb(${o}, ${s}, ${r})`}function an(t,n,e){let[o,s,r]=Fn(t,n,e).map(Math.round);return Y(o,s,r,255)}function as(t,n){let{field:e,scheme:o,darkest:s,shade:r=Nn}=t;return e==="walk"?an(o,r):n===void 0?Xo:an(o,Wo(t,n),s)}var Xo=On;function cs(t){let{field:n,scheme:e,darkest:o,shade:s=Nn}=t,r=(a,c)=>({offset:a,color:Go(e,c,o),abgr:an(e,c,o)});return n==="walk"?[r(0,s)]:Array.from({length:7},(a,c)=>r(c/6,Wo(t,c/6)))}export{ue as a,me as b,Rt as c,yn as d,ls as e,Y as f,po as g,hs as h,St as i,us as j,ce as k,ms as l,le as m,ps as n,yo as o,Fs as p,Tn as q,Ls as r,De as s,Hs as t,We as u,Ge as v,Ds as w,Do as x,Pn as y,Je as z,ts as A,as as B,Xo as C,cs as D};
|
|
2
|
+
//# sourceMappingURL=chunk-AUQISDXJ.js.map
|