jbrowse-plugin-graphgenomeviewer 10.7.0 → 10.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{GraphGenomeView-JFOE3MJS.js → GraphGenomeView-E6DXGHOP.js} +2 -2
- package/dist/chunks/{LinearGraphDisplay-2SFOGOMC.js → LinearGraphDisplay-I2OGTWEE.js} +2 -2
- package/dist/chunks/{chunk-S4LEC3L2.js → chunk-N7IFEWBH.js} +2 -2
- package/dist/chunks/{chunk-TFTHD5Q7.js → chunk-NADDU5FF.js} +3 -3
- package/dist/chunks/{chunk-TFTHD5Q7.js.map → chunk-NADDU5FF.js.map} +2 -2
- package/dist/chunks/chunk-SIIXH4RQ.js +9 -0
- package/dist/chunks/chunk-SIIXH4RQ.js.map +7 -0
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +1 -1
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/GraphGenomeView/pane/fitViews.ts +6 -2
- package/src/GraphGenomeView/pane/graphViews.ts +19 -9
- package/src/LinearGraphDisplay/LinearGraphDisplay.test.ts +39 -0
- package/src/LinearGraphDisplay/haplotypeColors.test.ts +51 -0
- package/src/LinearGraphDisplay/haplotypeColors.ts +32 -0
- package/src/LinearGraphDisplay/model.ts +4 -0
- package/src/version.ts +1 -1
- package/dist/chunks/chunk-N7FQ5XTS.js +0 -9
- package/dist/chunks/chunk-N7FQ5XTS.js.map +0 -7
- /package/dist/chunks/{GraphGenomeView-JFOE3MJS.js.map → GraphGenomeView-E6DXGHOP.js.map} +0 -0
- /package/dist/chunks/{LinearGraphDisplay-2SFOGOMC.js.map → LinearGraphDisplay-I2OGTWEE.js.map} +0 -0
- /package/dist/chunks/{chunk-S4LEC3L2.js.map → chunk-N7IFEWBH.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as $}from"./chunk-
|
|
1
|
+
import{b as $}from"./chunk-N7IFEWBH.js";import"./chunk-C4TQY75A.js";import"./chunk-ZODTL6LR.js";import{g as R,h as U}from"./chunk-SIIXH4RQ.js";import"./chunk-IK5G3JHR.js";import{a as V}from"./chunk-NADDU5FF.js";import"./chunk-URABWLDD.js";import{q as v}from"./chunk-KDXDNZIG.js";import"./chunk-FHGE3WRM.js";import"./chunk-OYOCY5OD.js";import"./chunk-RYH67LFD.js";import"./chunk-NPR3MVWA.js";import"./chunk-RDBFVH4P.js";import"./chunk-ZQOMV674.js";import"./chunk-JM4W4PKP.js";import"./chunk-FVSTWGYB.js";import"./chunk-4YTN4QEH.js";import"./chunk-YBLNN5FU.js";import"./chunk-EDOGXURN.js";import"./chunk-CZM4UYQX.js";import"./chunk-Z4V6YBFJ.js";import"./chunk-D3QZGLZ3.js";import"./chunk-WKD7ALOU.js";import"./chunk-KGAZZNZC.js";import"./chunk-TMM73K4C.js";import"./chunk-D6TY2QEG.js";import"./chunk-YBLNN5FU.js";import"./chunk-EGZZ3ADM.js";import"./chunk-IGNSPHNO.js";import{j as A,o as F}from"./chunk-5L276I7O.js";import{e as O,i as c}from"./chunk-J2PN6CG3.js";import{B as y,G as x,I as p,e as N,j as B,m as E,n as D,o as l,s as P,y as z}from"./chunk-H42TSPVA.js";import{a as L,b as e,c as n,d}from"./chunk-DUU6T2I5.js";var K=v()({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},actions:{display:"flex",justifyContent:"flex-end",gap:8}}),_=d(function({model:t}){return e(l,{size:"small","data-testid":"graph-genome-choose-another",onClick:()=>{t.clearGraph()},children:"Choose another graph"})}),X=d(function({model:t}){let{classes:r}=K();return!t.error&&!t.loadCanceled?n(y,{className:r.paper,"data-testid":"graph-genome-loading",children:[n("div",{className:r.row,children:[e(B,{variant:"h6",message:t.statusMessage||void 0}),t.canCancelLoad?e(l,{size:"small","data-testid":"graph-genome-cancel",onClick:()=>{t.cancelLoad()},children:"Cancel"}):null]}),e(z,{variant:"indeterminate"})]}):t.error?n(y,{className:r.paper,children:[e(N,{error:t.error,onReset:()=>{t.retryLoad()}}),e("div",{className:r.actions,children:e(_,{model:t})})]}):e(y,{className:r.paper,"data-testid":"graph-genome-load-canceled",children:n("div",{className:r.row,children:[e(p,{variant:"h6",children:"Loading canceled"}),n("div",{className:r.actions,children:[e(_,{model:t}),e(l,{variant:"contained",size:"small","data-testid":"graph-genome-retry",onClick:()=>{t.retryLoad()},children:"Retry"})]})]})})}),I=X;var q=V(e("path",{d:"M9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9zm3-19C8.14 2 5 5.14 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7m2.85 11.1-.85.6V16h-4v-2.3l-.85-.6C7.8 12.16 7 10.63 7 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.63-.8 3.16-2.15 4.1"}),"LightbulbOutlined");var Z=v()({column:{display:"flex",flexDirection:"column",gap:12},actions:{display:"flex",justifyContent:"flex-end"}}),J=d(function({model:t,choices:r}){let{classes:T}=Z(),f=A(t),{assemblyManager:g}=f,[S,G]=c(r[0]?.trackId),[w,k]=c(),[C,h]=c(),a=r.find(o=>o.trackId===S)??r[0],i=a?.assembly,M=(i?g.get(i):void 0)?.regions?.[0],b=w??(a?R(f.views,a.assembly)??(M?U(a,M):""):"");O(()=>{i&&g.waitForAssembly(i).catch(()=>{})},[g,i]);async function W(){if(a)try{let o=await g.waitForAssembly(a.assembly),s=o?F(b,u=>o.isValidRefName(u)):void 0;!o||!s||!o.isValidRefName(s.refName)?h(`No sequence ${s?.refName??b} in ${a.assembly}`):t.showTrackInLinearView(a.trackId,a.assembly,b)}catch(o){h(String(o instanceof Error?o.message:o))}}return n("form",{className:T.column,"data-testid":"graph-track-picker",onSubmit:o=>{o.preventDefault(),W()},children:[e(D,{options:r,value:a??null,getOptionLabel:o=>o.name,isOptionEqualToValue:(o,s)=>o.trackId===s.trackId,onChange:(o,s)=>{s&&(G(s.trackId),k(void 0),h(void 0))},renderOption:({key:o,...s},u)=>e("li",{...s,children:n("div",{children:[e(p,{variant:"body2",children:u.name}),n(p,{variant:"caption",color:"text.secondary",children:[u.assembly," \xB7 ",u.reach]})]})},u.trackId),renderInput:o=>e(x,{...o,size:"small",label:"Graph track",helperText:a?`${a.assembly} \xB7 ${a.reach}`:""})}),e(x,{size:"small",label:"Region",name:"region",value:b,placeholder:"chr1:1,000,001-1,020,000",error:C!==void 0,helperText:C??"A sequence name, or name:start-end",onChange:o=>{k(o.target.value),h(void 0)}}),e("div",{className:T.actions,children:e(l,{type:"submit",variant:"contained","data-testid":"graph-track-show",disabled:!a||!b.trim(),children:"Show in linear genome view"})})]})}),H=J;var Q=`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`,Y=v()(m=>({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},tip:{marginBottom:16},divider:{marginBlock:16},footer:{marginTop:12,display:"flex",justifyContent:"flex-end"},dragging:{outline:`2px dashed ${m.palette.primary.main}`,outlineOffset:-4}})),ee=d(function({model:t}){let{classes:r,cx:T}=Y(),[f,g]=c(""),[S,G]=c(!1),{graphTracks:w}=t;function k(){let a=f.trim();a&&t.openGfaLocation({uri:a,locationType:"UriLocation"})}function C(a){let i=a.target.files?.[0];a.target.value="",i&&t.loadGFAFile(i,i.name)}function h(a){a.preventDefault(),G(!1);let i=a.dataTransfer.files[0];i&&t.loadGFAFile(i,i.name)}return n(y,{className:T(r.paper,S&&r.dragging),"data-testid":"graph-import-form",onDragOver:a=>{a.preventDefault(),G(a.dataTransfer.types.includes("Files"))},onDragLeave:a=>{(!(a.relatedTarget instanceof Node)||!a.currentTarget.contains(a.relatedTarget))&&G(!1)},onDrop:a=>{h(a)},children:[n(E,{severity:"info",icon:e(q,{fontSize:"inherit"}),className:r.tip,"data-testid":"graph-import-tip",children:["A pangenome graph usually reads best as a track in a linear genome view, which redraws it as you pan and zoom."," ",w.length>0?"Pick a graph track and a region below.":"Index it with gfa-to-tabix and open it with File \u2192 Open track."]}),w.length>0?n(L,{children:[e("div",{className:r.header,children:e(p,{variant:"h6",children:"Show a graph track"})}),e(H,{model:t,choices:w}),e(P,{className:r.divider}),e("div",{className:r.header,children:e(p,{variant:"subtitle1",children:"Or open a small GFA file"})})]}):e("div",{className:r.header,children:e(p,{variant:"h6",children:"Open a small GFA file"})}),n("div",{className:r.column,children:[n("div",{className:r.rowCenter,children:[n(l,{variant:"outlined",component:"label",size:"small",children:["Choose file",e("input",{type:"file",accept:".gfa,.gfa1,.gfa2,.gz",hidden:!0,onChange:a=>{C(a)}})]}),e(p,{variant:"caption",color:"text.secondary",children:"Or drop one here. The whole file is drawn at once."})]}),n("div",{className:r.rowEnd,children:[e(x,{size:"small",label:"URL",placeholder:"https://example.com/graph.gfa",value:f,onChange:a=>{g(a.target.value)},onKeyDown:a=>{a.key==="Enter"&&k()},className:r.flex1}),e(l,{variant:"contained",onClick:()=>{k()},disabled:!f.trim(),children:"Open"})]})]}),e("div",{className:r.footer,children:e(l,{size:"small",onClick:()=>{t.loadGFA(Q,"Example graph")},children:"Load 4-node example"})}),t.error?e(N,{error:t.error}):null]})}),j=ee;var ae=d(function({model:t}){return t.hasGraph?e($,{model:t}):t.canRetryLoad?e(I,{model:t}):n(L,{children:[t.isLoading?e(I,{model:t}):null,e("div",{hidden:t.isLoading,children:e(j,{model:t})})]})}),Ve=ae;export{Ve as default};
|
|
10
|
-
//# sourceMappingURL=GraphGenomeView-
|
|
10
|
+
//# sourceMappingURL=GraphGenomeView-E6DXGHOP.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-N7IFEWBH.js";import"./chunk-C4TQY75A.js";import"./chunk-ZODTL6LR.js";import"./chunk-NADDU5FF.js";import"./chunk-URABWLDD.js";import"./chunk-KDXDNZIG.js";import"./chunk-FHGE3WRM.js";import"./chunk-OYOCY5OD.js";import"./chunk-RYH67LFD.js";import"./chunk-NPR3MVWA.js";import"./chunk-RDBFVH4P.js";import"./chunk-ZQOMV674.js";import"./chunk-FVSTWGYB.js";import"./chunk-4YTN4QEH.js";import"./chunk-YBLNN5FU.js";import"./chunk-EDOGXURN.js";import"./chunk-CZM4UYQX.js";import"./chunk-Z4V6YBFJ.js";import"./chunk-D3QZGLZ3.js";import"./chunk-WKD7ALOU.js";import"./chunk-KGAZZNZC.js";import"./chunk-TMM73K4C.js";import"./chunk-YBLNN5FU.js";import"./chunk-EGZZ3ADM.js";import"./chunk-IGNSPHNO.js";import"./chunk-5L276I7O.js";import"./chunk-J2PN6CG3.js";import"./chunk-H42TSPVA.js";import{b as o,d as t}from"./chunk-DUU6T2I5.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-I2OGTWEE.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as W,b as St}from"./chunk-C4TQY75A.js";import{A as Dt,B as Xt,C as X,D as re,E as Ft,F as K,G as ve,H as ae,a as kt,b as Pt,c as Mt,d as Rt,f as Ct,g as Lt,h as D,i as It,j as Et,k as Gt,l as Tt,n as Ht,o as Nt,p as be,q as At,r as _t,s as zt,t as Bt,u as Ot,w as oe,y as Wt}from"./chunk-ZODTL6LR.js";import{B as at,C as lt,E as ct,F as pt,G as ut,H as dt,I as ft,J as ht,L as mt,M as gt,N as yt,a as M,ba as vt,c as Ue,ca as wt,f as et,fa as ye,g as tt,ha as xt,p as rt}from"./chunk-TFTHD5Q7.js";import{q as H}from"./chunk-KDXDNZIG.js";import{Ba as ge,Ia as te,Jb as ne,K as me,Ma as qe,Oa as Je,Rb as $,Sb as nt,T as $e,Tb as ot,Ub as it,Vb as st,Za as Qe,_ as Ke,a as Y,b as Te,cc as _,d as He,fa as je,id as bt}from"./chunk-FHGE3WRM.js";import{v as Ze}from"./chunk-OYOCY5OD.js";import{Q as fe,U as he}from"./chunk-NPR3MVWA.js";import{c as Ee}from"./chunk-4YTN4QEH.js";import{y as Ie}from"./chunk-Z4V6YBFJ.js";import{d as I}from"./chunk-WKD7ALOU.js";import{C as Ge}from"./chunk-KGAZZNZC.js";import{j as J}from"./chunk-5L276I7O.js";import{a as Fe,e as G,f as Ve,g as Ye,h as C,i as L}from"./chunk-J2PN6CG3.js";import{A as De,E as Xe,H as ee,I as Z,b as O,c as Ne,e as de,k as Ae,o as _e,p as ze,t as Be,w as Q,x as Oe,z as We}from"./chunk-H42TSPVA.js";import{a as S,b as n,c as d,d as f}from"./chunk-DUU6T2I5.js";function Vt(t){return Promise.resolve(new _(t))}var z=JBrowseExports["@jbrowse/render-core/useRenderingBackend"],_n=t=>z!=null&&t in Object(z)?z[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/render-core/useRenderingBackend' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t});var Yt=_n("useRenderingBackend"),qo=z&&z.__esModule?z.default:z;var we=Pt(1),Zt=f(function({model:e}){let[o,r]=L(null);return G(()=>{if(!o)return;let a=new _(o),c=Y(()=>{Qe(bt()),a.resize(e.paneWidth,e.canvasHeight),e.paintHover(a,e.drawnBatch)});return()=>{c(),a.dispose()}},[o,e]),n("canvas",{ref:r,"data-testid":"graph-hover-layer",style:{...we,clipPath:e.drawingClip}})});var ie=f(function({row:e,at:o,hint:r,after:a,column:c}){let l=c===void 0?void 0:{paddingLeft:c+5};return e.swatch?d("div",{title:[e.title,r].filter(Boolean).join(" \xB7 ")||void 0,children:[d("div",{style:re,children:[n("span",{style:{display:"flex",flex:"none",justifyContent:"center",width:c},children:n(oe,{swatch:e.swatch})}),d("span",{children:[e.strong?n("strong",{children:e.strong}):null,e.label]}),e.sizer===void 0?null:d("span",{style:zn,children:[n("span",{style:Bn,"aria-hidden":!0,"data-testid":"graph-key-sizer",children:be(e.sizer)}),n("span",{style:On,"data-testid":"graph-key-count",children:be(e.count)})]}),a]}),o?n("div",{style:l,"data-testid":"graph-walk-at",children:o}):e.under?n("div",{style:l,children:e.under}):null]}):n("div",{style:Ft,children:e.label})}),zn={display:"grid"},Bn={gridArea:"1 / 1",visibility:"hidden"},On={gridArea:"1 / 1",width:0,minWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"},Wn={pointerEvents:"auto",cursor:"pointer",border:"none",background:"none",padding:"0 2px",font:"inherit",textDecoration:"underline"},$t=f(function({model:e,sections:o}){if(o.length===0)return null;let r=o.flatMap(l=>l.rows),a=Nt(r),c=Ht(r);return n("div",{style:{...X,lineHeight:`${a}px`},children:o.map(({testid:l,rows:p,heading:s,spaced:u},y)=>d(Fe,{children:[s?n("div",{style:{...ae,paddingTop:y===0?0:ve},children:s}):null,n("div",{"data-testid":l,style:u?{paddingTop:ve}:void 0,children:p.map(m=>n(ie,{row:m,column:c,at:m.walk?e.hoveredOn(m.walk):void 0,after:m.closesBubble?n("button",{type:"button",style:Wn,"data-testid":"graph-close-bubble",onClick:()=>{e.closeBubbles()},children:"close"}):null},m.key))})]},l))})});var Dn={position:"absolute",left:0,top:0,zIndex:4,display:"grid",gap:it,lineHeight:"normal"},Xn={height:st,padding:"2px 6px",boxSizing:"border-box",fontFamily:"inherit",fontSize:11,color:"inherit",cursor:"pointer",border:"none",background:"none",textAlign:"left",display:"block"},Fn={position:"relative"},Vn={gridColumn:"1 / -1",height:wt,padding:"2px 6px",boxSizing:"border-box",display:"flex",alignItems:"center",gap:14,fontSize:11,lineHeight:"15px"},Yn={display:"flex",gap:14,marginLeft:"auto"},Zn=f(function({model:e,lift:o,index:r,width:a,height:c,cell:l,handlers:p,canvasStyle:s}){let[u,y]=L(null),[m,w]=L(null),E=o.walks[0];G(()=>{if(!u||!m)return;let A=new _(u),B=new _(m),U=Te(()=>e.facetDrawings?.[r]),F,V=[Y(()=>{let R=e.facetGrid;R&&A.resize(R.width,R.height);let T=U.get();T&&(T!==F&&(A.uploadGeometry(T.batch),F=T),e.applySelection(A),e.paint(A))}),Y(()=>{let R=e.facetGrid;R&&B.resize(R.width,R.height);let T=U.get();T&&e.paintHover(B,T.batch)})];return()=>{for(let R of V)R();A.dispose(),B.dispose()}},[u,m,e,r]);let N=e.walkLabel(E.name);return d("div",{style:l,children:[n("button",{type:"button",style:Xn,"data-testid":"graph-facet-title",onClick:()=>{e.liftWalks([E.name]),e.setFacet("")},children:n(ie,{row:_t(e,E),hint:`click to lift ${N} alone`,at:e.hoveredOn(E)})}),d("div",{style:Fn,children:[n("canvas",{ref:y,"data-testid":"graph-facet-canvas",style:{...s,width:a,height:c,display:"block"},...p}),n("canvas",{ref:w,style:we})]})]})}),$n=f(function({model:e,handlers:o,canvasStyle:r,controls:a}){let c=e.facetPanels,l=e.facetGrid,p=e.facetPlacement;if(!c||!l||!p)return null;let{columns:s,width:u,height:y}=l;return d("div",{"data-testid":"graph-facet-panels",style:{...Dn,width:e.paneWidth,minHeight:e.canvasHeight,gridTemplateColumns:`repeat(${s}, ${u}px)`,background:te},children:[c.map((m,w)=>n(Zn,{model:e,lift:m,index:w,width:u,height:y,cell:{gridRow:Math.floor(p.cells[w]/s)+1,gridColumn:p.cells[w]%s+1},handlers:o,canvasStyle:r},`${w}:${m.walks[0].name}`)),d("div",{style:{...Vn,gridRow:Math.floor(p.cells.reduce((m,w)=>Math.max(m,w),-1/0)/s)+2},"data-testid":"graph-facet-key",children:[zt(e).map(m=>n(ie,{row:m},m.key)),a?n("span",{style:Yn,children:a}):null]})]})}),Kt=$n;var jt=M(n("path",{d:"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2m2 10H3v4c0 1.1.9 2 2 2h4v-2H5zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2"}),"CropFree");var Ut=M([n("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"},"0"),n("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var qt=M(n("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14M7 9h5v1H7z"}),"ZoomOut");var Kn=f(function({model:e}){let o=e.colorSchemeLock;return n(W,{label:"Color",size:"small",sx:{minWidth:100},disabled:o!==void 0,title:o?.why,shown:o?.value,value:e.chosenColorScheme,options:at.map(({value:r})=>({value:r,label:e.colorSchemeLabel(r)})),testId:"graph-color-select",onChange:r=>{e.setColorScheme(r)}})}),Jt=Kn;var Qt=H()(t=>({stats:{marginLeft:"auto"},perf:{color:t.palette.text.secondary,fontVariantNumeric:"tabular-nums"}}));function xe(t){return t===void 0?"\u2013":`${Math.round(t)}ms`}var jn=f(function({model:e}){let{classes:o}=Qt(),{lastFetchMs:r,lastLayoutMs:a,lastGeometryMs:c}=e,l=r!==void 0||a!==void 0||c!==void 0;return e.showPerf&&l?d(Z,{variant:"caption",className:o.perf,"data-testid":"graph-perf-stats",children:["fetch ",xe(r)," \xB7 layout ",xe(a)," \xB7 geom"," ",xe(c)]}):null}),Un=f(function({model:e}){let{classes:o}=Qt();return d("div",{className:o.stats,"data-testid":"graph-stats","data-node-count":e.nodeCount,"data-edge-count":e.edgeCount,"data-path-count":e.pathCount,"data-fetch-ms":e.lastFetchMs??"","data-layout-ms":e.lastLayoutMs??"","data-geometry-ms":e.lastGeometryMs??"","data-geometry-strokes":e.lastGeometryStrokeCount??"",children:[d(Z,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",n(jn,{model:e})]})}),en=Un;var qn=f(function({model:e}){let{graph:o}=e;return n(W,{label:"Layout",size:"small",sx:{minWidth:140},testId:"graph-layout-select",value:e.chosenLayoutMode,options:Ue.map(({value:r,label:a,description:c,available:l})=>({value:r,label:a,description:c,disabled:o?!l(o):!1})),onChange:r=>{e.switchLayout(r)}})}),tn=qn;var Jn=f(function({model:e}){return e.chosenLayoutMode!=="walkrows"||e.repeatChoices.length===0?null:n(W,{label:"Repeat",size:"small",sx:{minWidth:130,maxWidth:260},testId:"graph-repeat-select",value:e.selectedRepeat?.key??"",options:e.repeatOptions,onChange:o=>{e.setRepeatKey(o)}})}),nn=Jn;var on=M(n("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close");var rn=M(n("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreVert");var Qn=f(function({model:e}){let o=e.highlightMenuItems({picks:!1});return n(O,{size:"small",tooltip:"Graph options",menuItems:[...o.length>0?[{label:"Haplotypes",icon:et,subMenu:o}]:[],...e.layoutOptionMenuItems({repeat:!1}),...e.linksMenuItems(),{label:"Show",icon:lt,subMenu:[...e.showMenuItems(),...e.modeDrawsNodes&&e.walkChoices.length>1?[{type:"checkbox",label:"Show walk rows under the graph",checked:e.walkStrip,onClick:()=>{e.setWalkStrip(!e.walkStrip)}}]:[],{type:"checkbox",label:"Show timings",checked:e.showPerf,onClick:()=>{e.setShowPerf(!e.showPerf)}}]},{type:"divider"},{label:"Graph settings...",icon:tt,helpText:"Subgraph node limit; node width and path colors; the force-directed layout engine",onClick:()=>{J(e).queueDialog(r=>[St,{model:e,onClose:r}])}},{type:"divider"},{label:"Close graph",icon:on,onClick:()=>{e.clearGraph()}}],children:n(rn,{})})}),an=Qn;var eo=H()({formControl:{minWidth:130,maxWidth:260}}),to=f(function({model:e}){let{classes:o}=eo(),r=Ve(),{walkChoices:a}=e;if(a.length===0||!e.liftsWalks)return null;let c=new Set(a.map(s=>s.name)),l=new Map(a.map(s=>[s.name,s.label])),p=e.walkLayers.map(s=>s.walk).filter(s=>c.has(s));return a.length>Je?n(_e,{size:"small",variant:"outlined",color:"inherit","data-testid":"graph-walk-choose",onClick:()=>{J(e).queueDialog(s=>[qe,{model:e,onClose:s}])},children:p.length>0?`${p.length} of ${a.length} haplotypes`:"Highlight haplotypes..."}):d(Be,{size:"small",className:o.formControl,children:[n(Oe,{id:r,children:"Highlight"}),n(Xe,{labelId:r,multiple:!0,value:p,label:"Highlight","data-testid":"graph-walk-select",renderValue:s=>s.map(u=>l.get(u)).join(", "),onChange:s=>{let{value:u}=s.target;e.liftAmongChoices(typeof u=="string"?u.split(","):u)},children:a.map(({name:s,label:u})=>d(De,{value:s,dense:!0,children:[n(ze,{size:"small",checked:p.includes(s)}),n(We,{primary:u})]},s))})]})}),sn=to;var no=H()(t=>({toolbar:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:`1px solid ${t.palette.divider}`}})),oo=f(function({model:e}){return n(Z,{variant:"body2",children:e.zoomPercent})}),ro=f(function({model:e}){let{classes:o}=no(),r=a=>{e.zoom(a,e.viewBox.width/2,e.viewBox.height/2)};return d("div",{className:o.toolbar,children:[n(tn,{model:e}),n(Jt,{model:e}),n(sn,{model:e}),n(nn,{model:e}),n(ee,{title:"Zoom in",children:n(Q,{size:"small",onClick:()=>{r(1.5)},children:n(Ut,{})})}),n(ee,{title:"Zoom out",children:n(Q,{size:"small",onClick:()=>{r(1/1.5)},children:n(qt,{})})}),n(ee,{title:"Zoom to fit",children:n(Q,{size:"small",onClick:()=>{e.refitView()},children:n(jt,{})})}),n(oo,{model:e}),n(en,{model:e}),n(an,{model:e})]})}),ln=ro;var ao="#1c1c22",io="#eef1f3",so="#1a56c4",se=H()({row:{...X,display:"flex",alignItems:"center",gap:6,color:ao},inline:{padding:0,background:"none"},heading:ae,joined:{display:"flex","& > button + button":{marginLeft:-1},"& > button:first-of-type":{borderRadius:"3px 0 0 3px"},"& > button:last-of-type":{borderRadius:"0 3px 3px 0"}},button:{display:"flex",alignItems:"center",gap:4,font:"inherit",color:"inherit",background:X.background,border:`1px solid ${K}`,borderRadius:3,padding:"0 6px",cursor:"pointer","&:hover":{background:io},"&:disabled":{color:K,cursor:"default"},"&:focus-visible":{outline:`2px solid ${so}`,outlineOffset:1,position:"relative",zIndex:1}},on:{color:X.background,background:K,"&:hover":{background:K}}}),le=f(function(e){return n("button",{type:"button",...e})});var lo=f(function({model:e,inline:o=!1}){let{classes:r,cx:a}=se(),{walkChoices:c}=e,l=e.walkLayers.filter(p=>c.some(s=>s.name===p.walk)).length;return e.highlightMenuItems().length>0?d("div",{className:a(r.row,o&&r.inline),role:"group","aria-label":"Haplotypes","data-testid":"graph-haplotype-switch",children:[n("span",{className:r.heading,children:"Haplotypes"}),d(O,{ButtonComponent:le,menuItems:()=>e.highlightMenuItems(),className:a(r.button,l>0&&r.on),title:"Highlight haplotypes","aria-haspopup":"menu",children:[n("span",{children:l>0?`${l} of ${c.length}`:"highlight"}),n("span",{"aria-hidden":!0,children:"\u25BE"})]})]}):null}),Se=lo;var co={position:"absolute",bottom:vt,lineHeight:"normal",background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",zIndex:6};function ke({label:t,readout:e}){return d(S,{children:[n("strong",{children:t})," \u2014 ",e]})}var Pe=6;function cn(t){return t.map(e=>d("span",{children:[n("br",{}),e.text]},e.text))}function po(t,e,o){let r=t.graph,a=r?.threadFold?mt(r,e,c=>t.walkLabel(c)).sort((c,l)=>l.count-c.count):[];return r?.threadFold?d(S,{children:[o&&o>1?d(S,{children:[n("br",{}),o.toLocaleString()," nodes folded into it"]}):null,cn(gt(t.threadEvents??[],e)),a.slice(0,Pe).map(c=>d("span",{children:[n("br",{}),c.count>1?c.variation:c.label]},c.name)),a.length>Pe?d(S,{children:[n("br",{}),"and ",a.length-Pe," more threads"]}):null]}):null}function uo(t,e){if(e)return{testId:"graph-chip-tooltip",body:ke(e)};let o=t.hoveredNode?t.hoverNodeById?.get(t.hoveredNode):void 0;if(o){let l=ot(o),p=t.hoverDrawing?.members.get(o.id),s=rt(o),u=t.graphRegion,y=t.hoveredSpan,m=u&&y&&!Ie(o)?`${u.assemblyName} ${$({refName:u.refName,...y})}`:void 0,w=me(t.genePins,o.id),E=w.length>0?d(S,{children:[n("br",{}),n("em",{children:w.join(", ")})]}):null;return l?{body:d(S,{children:[l,E]})}:{body:d(S,{children:[n("strong",{children:o.name}),p?` and ${p.length-1} more`:""," \u2014"," ",o.length.toLocaleString()," bp, depth ",o.depth.toFixed(1),s?d(S,{children:[n("br",{}),s.sample," ",$(s)," (rank ",o.stable?.rank,")"]}):null,m?d(S,{children:[n("br",{}),"Reference ",m]}):null,E,po(t,o.id,o.members?.length),o.moved?d(S,{children:[n("br",{}),"End of a component too large to draw here"]}):null]})}}let r=t.hoveredEdge===null?void 0:t.graph?.edges[t.hoveredEdge];if(r){let l=nt(r,t.deletions.find(s=>s.edgeIndex===t.hoveredEdge),s=>t.nodeById?.get(s)?.name??s),p=t.graph?Ee(t.graph):void 0;return{body:l.deletion?d(S,{children:[`skips ${l.deletion.bp} of ${p??"the reference"} sequence`,n("br",{}),l.deletion.where]}):d(S,{children:["Edge: ",l.ends,cn(yt(t.threadEvents??[],r))]})}}let a=t.hoveredWalkRowText;if(a)return{testId:"graph-walk-row-tooltip",body:ke(a)};let c=t.hoveredTubeText;return c?{testId:"graph-tube-tooltip",body:ke(c)}:void 0}var fo=f(function({model:e,chip:o}){let r=uo(e,o);return r?n("div",{style:{...co,right:e.tooltipRightPx},"data-testid":r.testId,children:r.body}):null}),pn=fo;var ho=f(function({model:e,inline:o=!1}){let{classes:r,cx:a}=se(),c=e.forceEngineRows(),l=!c.some(p=>p.row.checked);return d("div",{className:a(r.row,o&&r.inline),role:"group","aria-label":"Layout","data-testid":"graph-layout-switch",children:[n("span",{className:r.heading,children:"Layout"}),n("span",{className:r.joined,children:c.map(({name:p,about:s,row:u})=>n("button",{type:"button",className:a(r.button,u.checked&&r.on),"aria-pressed":u.checked,disabled:u.disabled,title:u.disabled?u.disabledHelpText:`${u.label}. ${s}`,onClick:u.onClick,children:p},p))}),d(O,{ButtonComponent:le,menuItems:()=>e.layoutMenuItems(),className:a(r.button,l&&r.on),title:"Every layout","aria-haspopup":"menu",children:[n("span",{children:l?e.layoutLabel():"more"}),n("span",{"aria-hidden":!0,children:"\u25BE"})]})]})}),Me=ho;var un=M(n("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}),"FilterList");var dn=M(n("path",{d:"M10.83 8H21V6H8.83zm5 5H18v-2h-4.17zM14 16.83V18h-4v-2h3.17l-3-3H6v-2h2.17l-3-3H3V6h.17L1.39 4.22 2.8 2.81l18.38 18.38-1.41 1.41z"}),"FilterListOff");var fn=M(n("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info");var mo={x:0,y:0};function go(t,e){let{own:o,reference:r,highlight:a}=t.nodeLaunchTargets(e);return[{label:"Node details",icon:fn,onClick:()=>{t.showNodeDetails(e)}},...xt({own:o,reference:r,highlight:a,onShowLinear:c=>{t.showInLinearView(c)},onHighlight:t.canHighlightInLinearView?c=>{t.highlightInLinearView(c)}:void 0})]}function yo(t,e,o){let r=o??t.walkRowBars,a=t.walkRowLaunchTarget(e,r),c=a?.assembly,l=e>0?r?.rows[e-1]:void 0,p=l?.sample,s=t.abridged.find(m=>m.name===l?.name),u=!o&&t.walkRowBars,y=t.walkRowSamples;return[a&&c?{label:`Linear genome view \u2014 ${c} ${$(a.location)}`,icon:ye,onClick:()=>{t.showInLinearView({location:a.location,assembly:c})}}:{label:"Linear genome view",icon:ye,disabled:!0,disabledHelpText:a?`No assembly in this session is ${a.location.haplotype??a.label}`:"This walk states no contig coordinates",onClick:()=>{}},...o&&l&&s?[{label:"Load its steps",subLabel:Ge(s,l.label),onClick:()=>{t.expandWalk(l.name)}}]:[],...l&&t.liftsWalks&&t.modeDrawsNodes?[{type:"checkbox",label:`Highlight ${l.label}`,checked:t.walkLayers.some(m=>m.walk===l.name),onClick:()=>{t.toggleWalk(l.name)}}]:[],...u&&p&&!(y?.length===1&&y[0]===p)?[{label:`Show only ${p}`,icon:un,onClick:()=>{t.setWalkRowSamples([p])}}]:[],...u&&y?[{label:"Show every sample",icon:dn,onClick:()=>{t.setWalkRowSamples(void 0)}}]:[]]}var ce=f(function({model:e,at:o,onClose:r}){return n(Ne,{anchor:o,offset:mo,onClose:r,menuItems:()=>o===void 0?[]:"nodeId"in o?go(e,o.nodeId):yo(e,o.row,o.bars)})});var bo=f(function({model:e}){return n(S,{children:e.passBars.map(o=>n("svg",{"data-testid":"graph-pass-bar",width:e.paneWidth,height:ft,style:{display:"block",borderTop:"1px solid #ddd"},children:n(D,{el:ht(o,e.walkLabel(o.walk),e.paneWidth)})},o.walk))})}),hn=bo;var vo={display:"flex",flexWrap:"wrap",gap:"2px 14px",padding:"2px 8px 6px",fontSize:11,color:"#333"},wo={position:"absolute",pointerEvents:"none",background:"rgba(255,255,255,0.92)",border:"1px solid #ccc",borderRadius:3,padding:"1px 6px",fontSize:11,whiteSpace:"nowrap",zIndex:4},xo=f(function({bars:e,frame:o,ramp:r,rowGenes:a,inks:c}){let l=Lt(),p=Ye(()=>je(e,o,{ramp:r,rowGenes:a,idPrefix:l,markUnloaded:!0,inks:c}),[e,o,r,a,l,c]);return n(D,{el:p})}),So=f(function({model:e}){let o=e.walkStripRows,r=e.walkStripFrame,a=e.stripHover,c=o?[o.reference,...o.rows]:[],l=a?c.findIndex(m=>m.name===a.row):-1,p=c[l],s=o&&r&&p?$e(o,l,r):void 0;if(!o||!r||!a||!p||!s||r.labelled&&!s.cut)return null;let u=(o.origin+a.offset)*r.scaleX+r.translateX,y=u>r.width/2?{right:r.width-u+12}:{left:u+12};return d("div",{"data-testid":"graph-walk-strip-tip",style:{...wo,...y,top:l*r.rowPx+r.translateY-18},children:[p.label," \xB7 ",s.text]})}),ko=f(function({model:e,bars:o,frame:r}){return n(D,{el:pt(o,r,e.walkStripMarks)})}),Po=f(function({model:e}){let o=e.walkStripRows,r=e.walkStripFrame,[a,c]=L();if(!o||!r)return null;let l=s=>{let u=s.currentTarget.getBoundingClientRect();return ct(o,r,s.clientX-u.left,s.clientY-u.top)},p=Ke(o,{ramp:e.referenceRampDomain,rampCss:Ze,genes:dt(r,e.walkRowGenes,e.walkRowGeneGaps),annotation:e.walkRowAnnotation,markUnloaded:!0,inks:e.walkStripInks});return d("div",{"data-testid":"graph-walk-strip",style:{position:"relative",borderTop:"1px solid #ddd"},onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{I(e)&&(e.setPointerInPane(!1),e.setStripHover(null))},children:[d("svg",{width:r.width,height:r.height,style:{display:"block"},onMouseLeave:()=>{I(e)&&e.setStripHover(null)},onMouseMove:s=>{let u=l(s);s.currentTarget.style.cursor=u&&u.index>0?"pointer":"",e.setStripHover(u?{row:u.row.name,offset:u.offset}:null)},onClick:s=>{let u=l(s);u&&u.index>0&&e.toggleWalk(u.row.name)},onContextMenu:s=>{let u=l(s);u&&(s.preventDefault(),c({clientX:s.clientX,clientY:s.clientY,row:u.index}))},children:[n(xo,{bars:o,frame:r,ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes,inks:e.walkStripInks}),n(ko,{model:e,bars:o,frame:r}),n(D,{el:ut(o,r,new Set(e.walkLayers.map(s=>s.walk)))})]}),n(So,{model:e}),d("div",{style:vo,"data-testid":"graph-walk-strip-key",children:[p.map(s=>d("div",{style:re,children:[n(oe,{swatch:At(s.swatch)}),n("span",{children:s.label})]},s.label)),n("span",{style:{color:"#777"},children:"Ticks mark where each walk passes the node under the pointer; click a haplotype's bar to lift its walk"})]}),n(ce,{model:e,at:a&&{...a,bars:o},onClose:()=>{c(void 0)}})]})}),mn=Po;var Mo=f(function({model:e}){let o=e.walkStripLocator;return o?d(Mt,{model:e,zIndex:4,overflow:"visible",testId:"graph-walk-strip-locator",children:[n("circle",{cx:o.x,cy:o.y,r:11,fill:"none",stroke:"white",strokeWidth:4}),n("circle",{cx:o.x,cy:o.y,r:11,fill:"none",stroke:"#111",strokeWidth:1.75})]}):null}),gn=Mo;var Ro=1.1,Co=100,Lo=40,Io=800,Eo=10,yn=2;function Re(t){let e=t.deltaY*(t.deltaMode===1?Lo:t.deltaMode===2?Io:1),o=(t.ctrlKey?Eo:1)*e/Co;return Ro**-Math.max(-yn,Math.min(yn,o))}var Go=40,To=100,Ho=24,bn=Math.log(16);function No(t,e){let o=t*Math.exp(-Math.max(0,e)/Ho);return Math.abs(o)<.001?t:t-o}function Ao(t,e){let o=Math.abs(t.deltaX)>Math.abs(t.deltaY);return t.ctrlKey||t.metaKey||!o&&(!e||e.scrollZoom)?"zoom":o?"pan":"page"}function xn(t,e,o){G(()=>{if(!t)return;let r=-1/0,a={backlog:0,x:0,y:0,frame:0,last:0},c=p=>{let s=No(a.backlog,Math.min(100,p-a.last));a.backlog-=s,a.last=p,a.frame=a.backlog?requestAnimationFrame(c):0,I(o)&&o.zoom(Math.exp(s),a.x,a.y)},l=p=>{if(o.hostPlacesX||o.followsHostView)return;let y=((p.target instanceof Element?p.target.closest("canvas"):null)??(o.facetPanels?null:e))?.getBoundingClientRect();if(y&&p.clientY-y.top<o.referenceStripZonePx)return;let m=Ao(p,o.host);if(m!=="page"){if(o.host&&p.stopPropagation(),p.preventDefault(),m==="pan"){if(p.timeStamp-r>To){let w=p.deltaMode===1?Go:1;o.setTransform(o.scale,o.translateX-p.deltaX*w,o.translateY)}return}r=p.timeStamp,y&&(a.x=p.clientX-y.left,a.y=p.clientY-y.top,a.backlog=Math.max(-bn,Math.min(bn,a.backlog+Math.log(Re(p)))),a.frame||(a.last=performance.now()-1e3/60,a.frame=requestAnimationFrame(c)))}};return t.addEventListener("wheel",l,{passive:!1}),()=>{cancelAnimationFrame(a.frame),t.removeEventListener("wheel",l)}},[t,e,o])}var vn=3,Ce="data-gesture-owner",j=t=>({x:t.clientX,y:t.clientY});function wn(t){let[e,o]=[...t.values()];return{spread:Math.hypot(e.x-o.x,e.y-o.y),mid:{x:(e.x+o.x)/2,y:(e.y+o.y)/2}}}function Sn(t){let e=C({x:0,y:0}),o=C({x:0,y:0}),r=C(!1),a=C(void 0),c=i=>a.current!==void 0&&i.pointerId!==a.current,l=C(new Map),p=C(null),s=C(null),u=C(!1),y=C(null),m=C(!1),w=C({frame:0,pan:null,hover:null,pinch:!1});G(()=>()=>{cancelAnimationFrame(w.current.frame)},[]);let[E,N]=L(),[A,B]=L(!1),[U,F]=L(void 0);function V(i){let h=i.currentTarget.getBoundingClientRect();return{x:i.clientX-h.left,y:i.clientY-h.top}}function R(i,h){if(t.layoutResult?.tubeMap)return t.tubeMapNodeAt(i,h);let g=t.referenceStripNodeAt(i,h);if(g)return g;let{nodePositions:b}=t;if(!b)return null;let{x:v,y:x}=ge(i,h,t,t.axisScale);return fe(b,v,x,t.axisScale,t.positionsVersion,t.nodeInk,t.drawnFold)}function T(i,h){let{nodePositions:g,graph:b}=t;if(!g||!b)return null;let{x:v,y:x}=ge(i,h,t,t.axisScale);return he(g,b,v,x,t.axisScale,t.effectiveDrawPaths&&!t.facetPanels,t.positionsVersion,t.deletionEdgeIndexes,t.hiddenEdgeIndexes,t.deletionRoutes,t.layoutResult?.stranded,t.drawnFold)}function Pn(i){i.button===0&&i.preventDefault()}function Mn(i){if(i.button!==0)return;let h=l.current;if(c(i)){t.isPanning&&!m.current&&i.pointerType==="touch"&&h.size===1&&(i.currentTarget.setPointerCapture(i.pointerId),h.set(i.pointerId,j(i)),s.current=wn(h),r.current=!0);return}r.current=!1,o.current={x:i.clientX,y:i.clientY},i.currentTarget.removeAttribute(Ce);let g=t.followsHostView,{x:b,y:v}=V(i),x=v<t.referenceStripZonePx,P=t.hostPlacesX||t.layoutResult?.tubeMap||x?null:R(b,v);t.hostPlacesX||g&&i.shiftKey||t.followsWindow&&!P||(i.currentTarget.setPointerCapture(i.pointerId),a.current=i.pointerId,p.current=i.currentTarget,h.clear(),h.set(i.pointerId,j(i)),g&&P&&i.currentTarget.setAttribute(Ce,""),m.current=g,u.current=x&&!g,P?t.setDraggingNode(P):t.setPanning(!0),e.current={x:i.clientX,y:i.clientY})}function Le(){let i=s.current,h=p.current;if(!i||!h)return;let g=wn(l.current),b=h.getBoundingClientRect();i.spread>0&&g.spread>0&&t.zoom(g.spread/i.spread,i.mid.x-b.left,i.mid.y-b.top),t.setTransform(t.scale,t.translateX+g.mid.x-i.mid.x,t.translateY+g.mid.y-i.mid.y),s.current=g}function Rn(){let i=w.current,{pan:h,hover:g,pinch:b}=i;if(i.frame=0,i.pan=null,i.hover=null,i.pinch=!1,b&&Le(),h&&u.current?t.host?.horizontalScroll(-h.dx):h&&m.current?t.setTransform(t.scale,t.translateX,t.translateY+h.dy):h&&t.setTransform(t.scale,t.translateX+h.dx,t.translateY+h.dy),!g)return;let{x:v,y:x}=g,P=t.facetPanels?void 0:Gt(t.overlayLabels,v,x);F(k=>k?.label===P?.label&&k?.readout===P?.readout?k:P),He(()=>{if(t.walkRowBars){let k=t.walkRowAt(v,x);t.setHoveredWalkRow(k===void 0?null:t.walkRowList[k].name)}if(t.nodePositions&&t.graph){let k=R(v,x);t.setHoveredPanel(t.tubeMapPanelAt(x)),t.setHoveredNode(k,{x:v,y:x}),B(k!==null&&!t.hostPlacesX&&!t.layoutResult?.tubeMap&&x>=t.referenceStripZonePx),t.setHoveredTube(k===null&&t.layoutResult?.tubeMap?t.tubeAt(v,x):null),t.setHoveredEdge(k||t.layoutResult?.tubeMap||!t.hoverLightsEverything?null:T(v,x))}})}function q(){w.current.frame||(w.current.frame=requestAnimationFrame(Rn))}function Cn(){let i=w.current;cancelAnimationFrame(i.frame),i.frame=0,i.pan=null,i.hover=null,i.pinch=!1}function Ln(i){let h=l.current;if(s.current&&h.has(i.pointerId)){h.set(i.pointerId,j(i)),w.current.pinch=!0,q();return}if(c(i)||y.current)return;let g=i.clientX-e.current.x,b=i.clientY-e.current.y;e.current={x:i.clientX,y:i.clientY},Math.hypot(i.clientX-o.current.x,i.clientY-o.current.y)>vn&&(r.current=!0);let v=w.current;if(t.draggingNode)t.moveNode(t.draggingNode,g/t.scaleX,b/t.scaleY);else if(t.isPanning)v.pan={dx:(v.pan?.dx??0)+g,dy:(v.pan?.dy??0)+b},q();else{let x=i.currentTarget.getBoundingClientRect();v.hover={x:i.clientX-x.left,y:i.clientY-x.top},q()}}function pe(i){let h=l.current;if(s.current&&h.has(i.pointerId)){w.current.pinch&&(w.current.pinch=!1,Le()),h.delete(i.pointerId),s.current=null;let[[g,b]]=[...h];a.current=g,e.current=b;return}c(i)||(a.current=void 0,h.clear(),I(t)&&t.stopDragging())}function In(i){c(i)||(F(void 0),B(!1),y.current?w.current.hover=null:(a.current=void 0,l.current.clear(),s.current=null,Cn(),I(t)&&t.stopDragging()),I(t)&&t.clearHover())}function En(i){let{x:h,y:g}=V(i),b=R(h,g),{clientX:v,clientY:x}=i;if(b){i.preventDefault(),N({clientX:v,clientY:x,nodeId:b});return}let P=t.walkRowAt(h,g);P!==void 0&&(i.preventDefault(),N({clientX:v,clientY:x,row:P}))}function Gn(i){if(!r.current){let{x:h,y:g}=V(i),b=R(h,g);t.setSelectedNode(b),b&&t.showNodeDetails(b)}}G(()=>()=>{y.current?.end()},[]);function Tn(i){if(i.button!==0||t.hostPlacesX||t.followsHostView||!(i.target instanceof Element)||!i.target.closest(`[${kt}]`))return;y.current?.end(),u.current=!1,m.current=!1;let h=i.pointerId,g=j(i),b=g,v={moved:!1,end:()=>{window.removeEventListener("pointermove",x,!0),window.removeEventListener("pointerup",P,!0),window.removeEventListener("pointercancel",P,!0),v.moved&&I(t)&&t.stopDragging()}};function x(k){if(k.pointerId!==h)return;if(!v.moved){if(Math.hypot(k.clientX-g.x,k.clientY-g.y)<=vn)return;v.moved=!0,t.setPanning(!0)}let ue=w.current;ue.pan={dx:(ue.pan?.dx??0)+k.clientX-b.x,dy:(ue.pan?.dy??0)+k.clientY-b.y},b=j(k),q()}function P(k){k.pointerId===h&&(v.end(),setTimeout(()=>{y.current===v&&(y.current=null)},0))}y.current=v,window.addEventListener("pointermove",x,!0),window.addEventListener("pointerup",P,!0),window.addEventListener("pointercancel",P,!0)}function Hn(i){y.current?.moved&&(y.current=null,i.stopPropagation())}let Nn={cursor:t.isPanning||t.draggingNode?"grabbing":A?"move":"grab",touchAction:t.hostPlacesX?"auto":"none",overscrollBehavior:"contain"},An=t.host!==void 0&&!t.hostPlacesX&&!t.followsHostView?{[Ce]:"",onMouseDown:i=>{i.stopPropagation()}}:{};return{canvasStyle:Nn,surfaceProps:An,handlers:{onMouseDown:Pn,onPointerDown:Mn,onPointerMove:Ln,onPointerUp:pe,onPointerCancel:pe,onLostPointerCapture:pe,onPointerLeave:In,onClick:Gn,onContextMenu:En},contextMenu:E,hoveredChip:U,labelHandlers:{onPointerDown:Tn,onClickCapture:Hn},closeContextMenu:()=>{N(void 0)}}}var _o={position:"relative"},zo={position:"relative",lineHeight:0,isolation:"isolate"},Bo={position:"absolute",left:0,right:0,bottom:0,zIndex:0},Oo={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},Wo={position:"absolute",left:6,transform:"translateY(-50%)",background:"rgba(255,255,255,0.82)",padding:"0 4px",borderRadius:3,fontSize:11,lineHeight:"16px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:4},Do=f(function({model:e}){return n(S,{children:e.visibleRowLabels.map(({label:o,y:r,top:a})=>n("div",{"data-testid":"graph-row-label",style:{...Wo,top:a},children:o},r))})}),Xo={position:"absolute",display:"flex",flexDirection:"column",borderRadius:3,overflowX:"hidden",overflowY:"auto",zIndex:4},Fo={position:"absolute",transform:"translate(-50%, -50%)",background:"rgba(255,255,255,0.78)",padding:"0 3px",borderRadius:3,fontSize:10,lineHeight:"13px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:3},Vo=f(function({model:e,children:o}){let r=C(null),a=e.legendAtRest,c=e.keyShape;return G(()=>{e.setKeyShapeOf(()=>JSON.stringify(Bt(e)))},[e]),G(()=>{let l=r.current;if(!l||!a)return;let p=new ResizeObserver(()=>{s()}),s=()=>{for(let u of l.children)p.observe(u);I(e)&&e.legendAtRest&&e.setLegendSize({width:l.offsetWidth,height:l.scrollHeight},c)};return p.observe(l),s(),()=>{p.disconnect()}},[e,a,c]),d("div",{ref:r,style:{...Xo,top:ne+e.referenceStripZonePx,right:ne,maxHeight:e.canvasHeight-2*ne-e.referenceStripZonePx},children:[o,e.keyPlacement==="hidden"?null:n($t,{model:e,sections:Ot(e)})]})}),Yo=f(function({model:e}){return n(S,{children:e.overlayLabels.sizes.map(({key:o,node:r,text:a,x:c,y:l})=>n("div",{"data-testid":"graph-size-label",style:{...Fo,left:c,top:l,opacity:e.nodeFaded(r)?Et:void 0},children:a},o))})}),kn=f(function({model:e,handle:{canvasRef:o,canvas:r},ownChrome:a}){let{handlers:c,canvasStyle:l,surfaceProps:p,labelHandlers:s,contextMenu:u,closeContextMenu:y,hoveredChip:m}=Sn(e),[w,E]=L(null);xn(w,r,e);let N=e.facetPanels!==void 0;return d("div",{style:_o,...p,children:[a?n(ln,{model:e}):null,d("div",{ref:E,style:zo,...s,onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{I(e)&&e.setPointerInPane(!1)},children:[e.referenceStripShown?n("div",{style:{...Bo,top:e.referenceStripZonePx,background:te}}):null,n("canvas",{ref:o,"data-testid":"graph-genome-canvas",style:{...l,width:e.paneWidth,height:e.canvasHeight,clipPath:e.drawingClip,display:"block",position:"relative",zIndex:1},...c}),N?n(Kt,{model:e,handlers:c,canvasStyle:l,controls:a?null:d(S,{children:[n(Me,{model:e,inline:!0}),n(Se,{model:e,inline:!0})]})}):d(S,{children:[n(Dt,{model:e}),n(Zt,{model:e}),n(Wt,{model:e}),n(Ct,{model:e}),n(Do,{model:e}),n(Yo,{model:e}),n(Rt,{model:e}),n(It,{model:e}),n(Tt,{model:e}),n(Xt,{model:e}),n(gn,{model:e}),n(Vo,{model:e,children:a?null:d(S,{children:[n(Me,{model:e}),n(Se,{model:e})]})})]}),a?n("div",{style:Oo,children:n(Ae,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null,n(pn,{model:e,chip:m})]}),n(hn,{model:e}),e.walkStripShown?n(mn,{model:e}):null,n(ce,{model:e,at:u,onClose:y}),a?.renderError?n(de,{error:a.renderError,onReset:a.retryRender}):null,a&&e.error?n(de,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),Zo=f(function({model:e}){let{canvasRef:o,canvas:r,error:a,retry:c}=Yt(Vt,e);return n(kn,{model:e,handle:{canvasRef:o,canvas:r},ownChrome:{renderError:a,retryRender:c}})}),$o=f(function({model:e,handle:o}){return o?n(kn,{model:e,handle:o}):n(Zo,{model:e})}),kl=$o;export{Vt as a,kl as b};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as W,b as St}from"./chunk-C4TQY75A.js";import{A as Dt,B as Xt,C as X,D as re,E as Ft,F as K,G as ve,H as ae,a as kt,b as Pt,c as Mt,d as Rt,f as Ct,g as Lt,h as D,i as It,j as Et,k as Gt,l as Tt,n as Ht,o as Nt,p as be,q as At,r as _t,s as zt,t as Bt,u as Ot,w as oe,y as Wt}from"./chunk-ZODTL6LR.js";import{B as at,C as lt,E as ct,F as pt,G as ut,H as dt,I as ft,J as ht,L as mt,M as gt,N as yt,a as M,ba as vt,c as Ue,ca as wt,f as et,fa as ye,g as tt,ha as xt,p as rt}from"./chunk-NADDU5FF.js";import{q as H}from"./chunk-KDXDNZIG.js";import{Ba as ge,Ia as te,Jb as ne,K as me,Ma as qe,Oa as Je,Rb as $,Sb as nt,T as $e,Tb as ot,Ub as it,Vb as st,Za as Qe,_ as Ke,a as Y,b as Te,cc as _,d as He,fa as je,id as bt}from"./chunk-FHGE3WRM.js";import{v as Ze}from"./chunk-OYOCY5OD.js";import{Q as fe,U as he}from"./chunk-NPR3MVWA.js";import{c as Ee}from"./chunk-4YTN4QEH.js";import{y as Ie}from"./chunk-Z4V6YBFJ.js";import{d as I}from"./chunk-WKD7ALOU.js";import{C as Ge}from"./chunk-KGAZZNZC.js";import{j as J}from"./chunk-5L276I7O.js";import{a as Fe,e as G,f as Ve,g as Ye,h as C,i as L}from"./chunk-J2PN6CG3.js";import{A as De,E as Xe,H as ee,I as Z,b as O,c as Ne,e as de,k as Ae,o as _e,p as ze,t as Be,w as Q,x as Oe,z as We}from"./chunk-H42TSPVA.js";import{a as S,b as n,c as d,d as f}from"./chunk-DUU6T2I5.js";function Vt(t){return Promise.resolve(new _(t))}var z=JBrowseExports["@jbrowse/render-core/useRenderingBackend"],_n=t=>z!=null&&t in Object(z)?z[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/render-core/useRenderingBackend' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t});var Yt=_n("useRenderingBackend"),qo=z&&z.__esModule?z.default:z;var we=Pt(1),Zt=f(function({model:e}){let[o,r]=L(null);return G(()=>{if(!o)return;let a=new _(o),c=Y(()=>{Qe(bt()),a.resize(e.paneWidth,e.canvasHeight),e.paintHover(a,e.drawnBatch)});return()=>{c(),a.dispose()}},[o,e]),n("canvas",{ref:r,"data-testid":"graph-hover-layer",style:{...we,clipPath:e.drawingClip}})});var ie=f(function({row:e,at:o,hint:r,after:a,column:c}){let l=c===void 0?void 0:{paddingLeft:c+5};return e.swatch?d("div",{title:[e.title,r].filter(Boolean).join(" \xB7 ")||void 0,children:[d("div",{style:re,children:[n("span",{style:{display:"flex",flex:"none",justifyContent:"center",width:c},children:n(oe,{swatch:e.swatch})}),d("span",{children:[e.strong?n("strong",{children:e.strong}):null,e.label]}),e.sizer===void 0?null:d("span",{style:zn,children:[n("span",{style:Bn,"aria-hidden":!0,"data-testid":"graph-key-sizer",children:be(e.sizer)}),n("span",{style:On,"data-testid":"graph-key-count",children:be(e.count)})]}),a]}),o?n("div",{style:l,"data-testid":"graph-walk-at",children:o}):e.under?n("div",{style:l,children:e.under}):null]}):n("div",{style:Ft,children:e.label})}),zn={display:"grid"},Bn={gridArea:"1 / 1",visibility:"hidden"},On={gridArea:"1 / 1",width:0,minWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"},Wn={pointerEvents:"auto",cursor:"pointer",border:"none",background:"none",padding:"0 2px",font:"inherit",textDecoration:"underline"},$t=f(function({model:e,sections:o}){if(o.length===0)return null;let r=o.flatMap(l=>l.rows),a=Nt(r),c=Ht(r);return n("div",{style:{...X,lineHeight:`${a}px`},children:o.map(({testid:l,rows:p,heading:s,spaced:u},y)=>d(Fe,{children:[s?n("div",{style:{...ae,paddingTop:y===0?0:ve},children:s}):null,n("div",{"data-testid":l,style:u?{paddingTop:ve}:void 0,children:p.map(m=>n(ie,{row:m,column:c,at:m.walk?e.hoveredOn(m.walk):void 0,after:m.closesBubble?n("button",{type:"button",style:Wn,"data-testid":"graph-close-bubble",onClick:()=>{e.closeBubbles()},children:"close"}):null},m.key))})]},l))})});var Dn={position:"absolute",left:0,top:0,zIndex:4,display:"grid",gap:it,lineHeight:"normal"},Xn={height:st,padding:"2px 6px",boxSizing:"border-box",fontFamily:"inherit",fontSize:11,color:"inherit",cursor:"pointer",border:"none",background:"none",textAlign:"left",display:"block"},Fn={position:"relative"},Vn={gridColumn:"1 / -1",height:wt,padding:"2px 6px",boxSizing:"border-box",display:"flex",alignItems:"center",gap:14,fontSize:11,lineHeight:"15px"},Yn={display:"flex",gap:14,marginLeft:"auto"},Zn=f(function({model:e,lift:o,index:r,width:a,height:c,cell:l,handlers:p,canvasStyle:s}){let[u,y]=L(null),[m,w]=L(null),E=o.walks[0];G(()=>{if(!u||!m)return;let A=new _(u),B=new _(m),U=Te(()=>e.facetDrawings?.[r]),F,V=[Y(()=>{let R=e.facetGrid;R&&A.resize(R.width,R.height);let T=U.get();T&&(T!==F&&(A.uploadGeometry(T.batch),F=T),e.applySelection(A),e.paint(A))}),Y(()=>{let R=e.facetGrid;R&&B.resize(R.width,R.height);let T=U.get();T&&e.paintHover(B,T.batch)})];return()=>{for(let R of V)R();A.dispose(),B.dispose()}},[u,m,e,r]);let N=e.walkLabel(E.name);return d("div",{style:l,children:[n("button",{type:"button",style:Xn,"data-testid":"graph-facet-title",onClick:()=>{e.liftWalks([E.name]),e.setFacet("")},children:n(ie,{row:_t(e,E),hint:`click to lift ${N} alone`,at:e.hoveredOn(E)})}),d("div",{style:Fn,children:[n("canvas",{ref:y,"data-testid":"graph-facet-canvas",style:{...s,width:a,height:c,display:"block"},...p}),n("canvas",{ref:w,style:we})]})]})}),$n=f(function({model:e,handlers:o,canvasStyle:r,controls:a}){let c=e.facetPanels,l=e.facetGrid,p=e.facetPlacement;if(!c||!l||!p)return null;let{columns:s,width:u,height:y}=l;return d("div",{"data-testid":"graph-facet-panels",style:{...Dn,width:e.paneWidth,minHeight:e.canvasHeight,gridTemplateColumns:`repeat(${s}, ${u}px)`,background:te},children:[c.map((m,w)=>n(Zn,{model:e,lift:m,index:w,width:u,height:y,cell:{gridRow:Math.floor(p.cells[w]/s)+1,gridColumn:p.cells[w]%s+1},handlers:o,canvasStyle:r},`${w}:${m.walks[0].name}`)),d("div",{style:{...Vn,gridRow:Math.floor(p.cells.reduce((m,w)=>Math.max(m,w),-1/0)/s)+2},"data-testid":"graph-facet-key",children:[zt(e).map(m=>n(ie,{row:m},m.key)),a?n("span",{style:Yn,children:a}):null]})]})}),Kt=$n;var jt=M(n("path",{d:"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2m2 10H3v4c0 1.1.9 2 2 2h4v-2H5zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2"}),"CropFree");var Ut=M([n("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"},"0"),n("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var qt=M(n("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14M7 9h5v1H7z"}),"ZoomOut");var Kn=f(function({model:e}){let o=e.colorSchemeLock;return n(W,{label:"Color",size:"small",sx:{minWidth:100},disabled:o!==void 0,title:o?.why,shown:o?.value,value:e.chosenColorScheme,options:at.map(({value:r})=>({value:r,label:e.colorSchemeLabel(r)})),testId:"graph-color-select",onChange:r=>{e.setColorScheme(r)}})}),Jt=Kn;var Qt=H()(t=>({stats:{marginLeft:"auto"},perf:{color:t.palette.text.secondary,fontVariantNumeric:"tabular-nums"}}));function xe(t){return t===void 0?"\u2013":`${Math.round(t)}ms`}var jn=f(function({model:e}){let{classes:o}=Qt(),{lastFetchMs:r,lastLayoutMs:a,lastGeometryMs:c}=e,l=r!==void 0||a!==void 0||c!==void 0;return e.showPerf&&l?d(Z,{variant:"caption",className:o.perf,"data-testid":"graph-perf-stats",children:["fetch ",xe(r)," \xB7 layout ",xe(a)," \xB7 geom"," ",xe(c)]}):null}),Un=f(function({model:e}){let{classes:o}=Qt();return d("div",{className:o.stats,"data-testid":"graph-stats","data-node-count":e.nodeCount,"data-edge-count":e.edgeCount,"data-path-count":e.pathCount,"data-fetch-ms":e.lastFetchMs??"","data-layout-ms":e.lastLayoutMs??"","data-geometry-ms":e.lastGeometryMs??"","data-geometry-strokes":e.lastGeometryStrokeCount??"",children:[d(Z,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",n(jn,{model:e})]})}),en=Un;var qn=f(function({model:e}){let{graph:o}=e;return n(W,{label:"Layout",size:"small",sx:{minWidth:140},testId:"graph-layout-select",value:e.chosenLayoutMode,options:Ue.map(({value:r,label:a,description:c,available:l})=>({value:r,label:a,description:c,disabled:o?!l(o):!1})),onChange:r=>{e.switchLayout(r)}})}),tn=qn;var Jn=f(function({model:e}){return e.chosenLayoutMode!=="walkrows"||e.repeatChoices.length===0?null:n(W,{label:"Repeat",size:"small",sx:{minWidth:130,maxWidth:260},testId:"graph-repeat-select",value:e.selectedRepeat?.key??"",options:e.repeatOptions,onChange:o=>{e.setRepeatKey(o)}})}),nn=Jn;var on=M(n("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close");var rn=M(n("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreVert");var Qn=f(function({model:e}){let o=e.highlightMenuItems({picks:!1});return n(O,{size:"small",tooltip:"Graph options",menuItems:[...o.length>0?[{label:"Haplotypes",icon:et,subMenu:o}]:[],...e.layoutOptionMenuItems({repeat:!1}),...e.linksMenuItems(),{label:"Show",icon:lt,subMenu:[...e.showMenuItems(),...e.modeDrawsNodes&&e.walkChoices.length>1?[{type:"checkbox",label:"Show walk rows under the graph",checked:e.walkStrip,onClick:()=>{e.setWalkStrip(!e.walkStrip)}}]:[],{type:"checkbox",label:"Show timings",checked:e.showPerf,onClick:()=>{e.setShowPerf(!e.showPerf)}}]},{type:"divider"},{label:"Graph settings...",icon:tt,helpText:"Subgraph node limit; node width and path colors; the force-directed layout engine",onClick:()=>{J(e).queueDialog(r=>[St,{model:e,onClose:r}])}},{type:"divider"},{label:"Close graph",icon:on,onClick:()=>{e.clearGraph()}}],children:n(rn,{})})}),an=Qn;var eo=H()({formControl:{minWidth:130,maxWidth:260}}),to=f(function({model:e}){let{classes:o}=eo(),r=Ve(),{walkChoices:a}=e;if(a.length===0||!e.liftsWalks)return null;let c=new Set(a.map(s=>s.name)),l=new Map(a.map(s=>[s.name,s.label])),p=e.walkLayers.map(s=>s.walk).filter(s=>c.has(s));return a.length>Je?n(_e,{size:"small",variant:"outlined",color:"inherit","data-testid":"graph-walk-choose",onClick:()=>{J(e).queueDialog(s=>[qe,{model:e,onClose:s}])},children:p.length>0?`${p.length} of ${a.length} haplotypes`:"Highlight haplotypes..."}):d(Be,{size:"small",className:o.formControl,children:[n(Oe,{id:r,children:"Highlight"}),n(Xe,{labelId:r,multiple:!0,value:p,label:"Highlight","data-testid":"graph-walk-select",renderValue:s=>s.map(u=>l.get(u)).join(", "),onChange:s=>{let{value:u}=s.target;e.liftAmongChoices(typeof u=="string"?u.split(","):u)},children:a.map(({name:s,label:u})=>d(De,{value:s,dense:!0,children:[n(ze,{size:"small",checked:p.includes(s)}),n(We,{primary:u})]},s))})]})}),sn=to;var no=H()(t=>({toolbar:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:`1px solid ${t.palette.divider}`}})),oo=f(function({model:e}){return n(Z,{variant:"body2",children:e.zoomPercent})}),ro=f(function({model:e}){let{classes:o}=no(),r=a=>{e.zoom(a,e.viewBox.width/2,e.viewBox.height/2)};return d("div",{className:o.toolbar,children:[n(tn,{model:e}),n(Jt,{model:e}),n(sn,{model:e}),n(nn,{model:e}),n(ee,{title:"Zoom in",children:n(Q,{size:"small",onClick:()=>{r(1.5)},children:n(Ut,{})})}),n(ee,{title:"Zoom out",children:n(Q,{size:"small",onClick:()=>{r(1/1.5)},children:n(qt,{})})}),n(ee,{title:"Zoom to fit",children:n(Q,{size:"small",onClick:()=>{e.refitView()},children:n(jt,{})})}),n(oo,{model:e}),n(en,{model:e}),n(an,{model:e})]})}),ln=ro;var ao="#1c1c22",io="#eef1f3",so="#1a56c4",se=H()({row:{...X,display:"flex",alignItems:"center",gap:6,color:ao},inline:{padding:0,background:"none"},heading:ae,joined:{display:"flex","& > button + button":{marginLeft:-1},"& > button:first-of-type":{borderRadius:"3px 0 0 3px"},"& > button:last-of-type":{borderRadius:"0 3px 3px 0"}},button:{display:"flex",alignItems:"center",gap:4,font:"inherit",color:"inherit",background:X.background,border:`1px solid ${K}`,borderRadius:3,padding:"0 6px",cursor:"pointer","&:hover":{background:io},"&:disabled":{color:K,cursor:"default"},"&:focus-visible":{outline:`2px solid ${so}`,outlineOffset:1,position:"relative",zIndex:1}},on:{color:X.background,background:K,"&:hover":{background:K}}}),le=f(function(e){return n("button",{type:"button",...e})});var lo=f(function({model:e,inline:o=!1}){let{classes:r,cx:a}=se(),{walkChoices:c}=e,l=e.walkLayers.filter(p=>c.some(s=>s.name===p.walk)).length;return e.highlightMenuItems().length>0?d("div",{className:a(r.row,o&&r.inline),role:"group","aria-label":"Haplotypes","data-testid":"graph-haplotype-switch",children:[n("span",{className:r.heading,children:"Haplotypes"}),d(O,{ButtonComponent:le,menuItems:()=>e.highlightMenuItems(),className:a(r.button,l>0&&r.on),title:"Highlight haplotypes","aria-haspopup":"menu",children:[n("span",{children:l>0?`${l} of ${c.length}`:"highlight"}),n("span",{"aria-hidden":!0,children:"\u25BE"})]})]}):null}),Se=lo;var co={position:"absolute",bottom:vt,lineHeight:"normal",background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",zIndex:6};function ke({label:t,readout:e}){return d(S,{children:[n("strong",{children:t})," \u2014 ",e]})}var Pe=6;function cn(t){return t.map(e=>d("span",{children:[n("br",{}),e.text]},e.text))}function po(t,e,o){let r=t.graph,a=r?.threadFold?mt(r,e,c=>t.walkLabel(c)).sort((c,l)=>l.count-c.count):[];return r?.threadFold?d(S,{children:[o&&o>1?d(S,{children:[n("br",{}),o.toLocaleString()," nodes folded into it"]}):null,cn(gt(t.threadEvents??[],e)),a.slice(0,Pe).map(c=>d("span",{children:[n("br",{}),c.count>1?c.variation:c.label]},c.name)),a.length>Pe?d(S,{children:[n("br",{}),"and ",a.length-Pe," more threads"]}):null]}):null}function uo(t,e){if(e)return{testId:"graph-chip-tooltip",body:ke(e)};let o=t.hoveredNode?t.hoverNodeById?.get(t.hoveredNode):void 0;if(o){let l=ot(o),p=t.hoverDrawing?.members.get(o.id),s=rt(o),u=t.graphRegion,y=t.hoveredSpan,m=u&&y&&!Ie(o)?`${u.assemblyName} ${$({refName:u.refName,...y})}`:void 0,w=me(t.genePins,o.id),E=w.length>0?d(S,{children:[n("br",{}),n("em",{children:w.join(", ")})]}):null;return l?{body:d(S,{children:[l,E]})}:{body:d(S,{children:[n("strong",{children:o.name}),p?` and ${p.length-1} more`:""," \u2014"," ",o.length.toLocaleString()," bp, depth ",o.depth.toFixed(1),s?d(S,{children:[n("br",{}),s.sample," ",$(s)," (rank ",o.stable?.rank,")"]}):null,m?d(S,{children:[n("br",{}),"Reference ",m]}):null,E,po(t,o.id,o.members?.length),o.moved?d(S,{children:[n("br",{}),"End of a component too large to draw here"]}):null]})}}let r=t.hoveredEdge===null?void 0:t.graph?.edges[t.hoveredEdge];if(r){let l=nt(r,t.deletions.find(s=>s.edgeIndex===t.hoveredEdge),s=>t.nodeById?.get(s)?.name??s),p=t.graph?Ee(t.graph):void 0;return{body:l.deletion?d(S,{children:[`skips ${l.deletion.bp} of ${p??"the reference"} sequence`,n("br",{}),l.deletion.where]}):d(S,{children:["Edge: ",l.ends,cn(yt(t.threadEvents??[],r))]})}}let a=t.hoveredWalkRowText;if(a)return{testId:"graph-walk-row-tooltip",body:ke(a)};let c=t.hoveredTubeText;return c?{testId:"graph-tube-tooltip",body:ke(c)}:void 0}var fo=f(function({model:e,chip:o}){let r=uo(e,o);return r?n("div",{style:{...co,right:e.tooltipRightPx},"data-testid":r.testId,children:r.body}):null}),pn=fo;var ho=f(function({model:e,inline:o=!1}){let{classes:r,cx:a}=se(),c=e.forceEngineRows(),l=!c.some(p=>p.row.checked);return d("div",{className:a(r.row,o&&r.inline),role:"group","aria-label":"Layout","data-testid":"graph-layout-switch",children:[n("span",{className:r.heading,children:"Layout"}),n("span",{className:r.joined,children:c.map(({name:p,about:s,row:u})=>n("button",{type:"button",className:a(r.button,u.checked&&r.on),"aria-pressed":u.checked,disabled:u.disabled,title:u.disabled?u.disabledHelpText:`${u.label}. ${s}`,onClick:u.onClick,children:p},p))}),d(O,{ButtonComponent:le,menuItems:()=>e.layoutMenuItems(),className:a(r.button,l&&r.on),title:"Every layout","aria-haspopup":"menu",children:[n("span",{children:l?e.layoutLabel():"more"}),n("span",{"aria-hidden":!0,children:"\u25BE"})]})]})}),Me=ho;var un=M(n("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}),"FilterList");var dn=M(n("path",{d:"M10.83 8H21V6H8.83zm5 5H18v-2h-4.17zM14 16.83V18h-4v-2h3.17l-3-3H6v-2h2.17l-3-3H3V6h.17L1.39 4.22 2.8 2.81l18.38 18.38-1.41 1.41z"}),"FilterListOff");var fn=M(n("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info");var mo={x:0,y:0};function go(t,e){let{own:o,reference:r,highlight:a}=t.nodeLaunchTargets(e);return[{label:"Node details",icon:fn,onClick:()=>{t.showNodeDetails(e)}},...xt({own:o,reference:r,highlight:a,onShowLinear:c=>{t.showInLinearView(c)},onHighlight:t.canHighlightInLinearView?c=>{t.highlightInLinearView(c)}:void 0})]}function yo(t,e,o){let r=o??t.walkRowBars,a=t.walkRowLaunchTarget(e,r),c=a?.assembly,l=e>0?r?.rows[e-1]:void 0,p=l?.sample,s=t.abridged.find(m=>m.name===l?.name),u=!o&&t.walkRowBars,y=t.walkRowSamples;return[a&&c?{label:`Linear genome view \u2014 ${c} ${$(a.location)}`,icon:ye,onClick:()=>{t.showInLinearView({location:a.location,assembly:c})}}:{label:"Linear genome view",icon:ye,disabled:!0,disabledHelpText:a?`No assembly in this session is ${a.location.haplotype??a.label}`:"This walk states no contig coordinates",onClick:()=>{}},...o&&l&&s?[{label:"Load its steps",subLabel:Ge(s,l.label),onClick:()=>{t.expandWalk(l.name)}}]:[],...l&&t.liftsWalks&&t.modeDrawsNodes?[{type:"checkbox",label:`Highlight ${l.label}`,checked:t.walkLayers.some(m=>m.walk===l.name),onClick:()=>{t.toggleWalk(l.name)}}]:[],...u&&p&&!(y?.length===1&&y[0]===p)?[{label:`Show only ${p}`,icon:un,onClick:()=>{t.setWalkRowSamples([p])}}]:[],...u&&y?[{label:"Show every sample",icon:dn,onClick:()=>{t.setWalkRowSamples(void 0)}}]:[]]}var ce=f(function({model:e,at:o,onClose:r}){return n(Ne,{anchor:o,offset:mo,onClose:r,menuItems:()=>o===void 0?[]:"nodeId"in o?go(e,o.nodeId):yo(e,o.row,o.bars)})});var bo=f(function({model:e}){return n(S,{children:e.passBars.map(o=>n("svg",{"data-testid":"graph-pass-bar",width:e.paneWidth,height:ft,style:{display:"block",borderTop:"1px solid #ddd"},children:n(D,{el:ht(o,e.walkLabel(o.walk),e.paneWidth)})},o.walk))})}),hn=bo;var vo={display:"flex",flexWrap:"wrap",gap:"2px 14px",padding:"2px 8px 6px",fontSize:11,color:"#333"},wo={position:"absolute",pointerEvents:"none",background:"rgba(255,255,255,0.92)",border:"1px solid #ccc",borderRadius:3,padding:"1px 6px",fontSize:11,whiteSpace:"nowrap",zIndex:4},xo=f(function({bars:e,frame:o,ramp:r,rowGenes:a,inks:c}){let l=Lt(),p=Ye(()=>je(e,o,{ramp:r,rowGenes:a,idPrefix:l,markUnloaded:!0,inks:c}),[e,o,r,a,l,c]);return n(D,{el:p})}),So=f(function({model:e}){let o=e.walkStripRows,r=e.walkStripFrame,a=e.stripHover,c=o?[o.reference,...o.rows]:[],l=a?c.findIndex(m=>m.name===a.row):-1,p=c[l],s=o&&r&&p?$e(o,l,r):void 0;if(!o||!r||!a||!p||!s||r.labelled&&!s.cut)return null;let u=(o.origin+a.offset)*r.scaleX+r.translateX,y=u>r.width/2?{right:r.width-u+12}:{left:u+12};return d("div",{"data-testid":"graph-walk-strip-tip",style:{...wo,...y,top:l*r.rowPx+r.translateY-18},children:[p.label," \xB7 ",s.text]})}),ko=f(function({model:e,bars:o,frame:r}){return n(D,{el:pt(o,r,e.walkStripMarks)})}),Po=f(function({model:e}){let o=e.walkStripRows,r=e.walkStripFrame,[a,c]=L();if(!o||!r)return null;let l=s=>{let u=s.currentTarget.getBoundingClientRect();return ct(o,r,s.clientX-u.left,s.clientY-u.top)},p=Ke(o,{ramp:e.referenceRampDomain,rampCss:Ze,genes:dt(r,e.walkRowGenes,e.walkRowGeneGaps),annotation:e.walkRowAnnotation,markUnloaded:!0,inks:e.walkStripInks});return d("div",{"data-testid":"graph-walk-strip",style:{position:"relative",borderTop:"1px solid #ddd"},onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{I(e)&&(e.setPointerInPane(!1),e.setStripHover(null))},children:[d("svg",{width:r.width,height:r.height,style:{display:"block"},onMouseLeave:()=>{I(e)&&e.setStripHover(null)},onMouseMove:s=>{let u=l(s);s.currentTarget.style.cursor=u&&u.index>0?"pointer":"",e.setStripHover(u?{row:u.row.name,offset:u.offset}:null)},onClick:s=>{let u=l(s);u&&u.index>0&&e.toggleWalk(u.row.name)},onContextMenu:s=>{let u=l(s);u&&(s.preventDefault(),c({clientX:s.clientX,clientY:s.clientY,row:u.index}))},children:[n(xo,{bars:o,frame:r,ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes,inks:e.walkStripInks}),n(ko,{model:e,bars:o,frame:r}),n(D,{el:ut(o,r,new Set(e.walkLayers.map(s=>s.walk)))})]}),n(So,{model:e}),d("div",{style:vo,"data-testid":"graph-walk-strip-key",children:[p.map(s=>d("div",{style:re,children:[n(oe,{swatch:At(s.swatch)}),n("span",{children:s.label})]},s.label)),n("span",{style:{color:"#777"},children:"Ticks mark where each walk passes the node under the pointer; click a haplotype's bar to lift its walk"})]}),n(ce,{model:e,at:a&&{...a,bars:o},onClose:()=>{c(void 0)}})]})}),mn=Po;var Mo=f(function({model:e}){let o=e.walkStripLocator;return o?d(Mt,{model:e,zIndex:4,overflow:"visible",testId:"graph-walk-strip-locator",children:[n("circle",{cx:o.x,cy:o.y,r:11,fill:"none",stroke:"white",strokeWidth:4}),n("circle",{cx:o.x,cy:o.y,r:11,fill:"none",stroke:"#111",strokeWidth:1.75})]}):null}),gn=Mo;var Ro=1.1,Co=100,Lo=40,Io=800,Eo=10,yn=2;function Re(t){let e=t.deltaY*(t.deltaMode===1?Lo:t.deltaMode===2?Io:1),o=(t.ctrlKey?Eo:1)*e/Co;return Ro**-Math.max(-yn,Math.min(yn,o))}var Go=40,To=100,Ho=24,bn=Math.log(16);function No(t,e){let o=t*Math.exp(-Math.max(0,e)/Ho);return Math.abs(o)<.001?t:t-o}function Ao(t,e){let o=Math.abs(t.deltaX)>Math.abs(t.deltaY);return t.ctrlKey||t.metaKey||!o&&(!e||e.scrollZoom)?"zoom":o?"pan":"page"}function xn(t,e,o){G(()=>{if(!t)return;let r=-1/0,a={backlog:0,x:0,y:0,frame:0,last:0},c=p=>{let s=No(a.backlog,Math.min(100,p-a.last));a.backlog-=s,a.last=p,a.frame=a.backlog?requestAnimationFrame(c):0,I(o)&&o.zoom(Math.exp(s),a.x,a.y)},l=p=>{if(o.hostPlacesX||o.followsHostView)return;let y=((p.target instanceof Element?p.target.closest("canvas"):null)??(o.facetPanels?null:e))?.getBoundingClientRect();if(y&&p.clientY-y.top<o.referenceStripZonePx)return;let m=Ao(p,o.host);if(m!=="page"){if(o.host&&p.stopPropagation(),p.preventDefault(),m==="pan"){if(p.timeStamp-r>To){let w=p.deltaMode===1?Go:1;o.setTransform(o.scale,o.translateX-p.deltaX*w,o.translateY)}return}r=p.timeStamp,y&&(a.x=p.clientX-y.left,a.y=p.clientY-y.top,a.backlog=Math.max(-bn,Math.min(bn,a.backlog+Math.log(Re(p)))),a.frame||(a.last=performance.now()-1e3/60,a.frame=requestAnimationFrame(c)))}};return t.addEventListener("wheel",l,{passive:!1}),()=>{cancelAnimationFrame(a.frame),t.removeEventListener("wheel",l)}},[t,e,o])}var vn=3,Ce="data-gesture-owner",j=t=>({x:t.clientX,y:t.clientY});function wn(t){let[e,o]=[...t.values()];return{spread:Math.hypot(e.x-o.x,e.y-o.y),mid:{x:(e.x+o.x)/2,y:(e.y+o.y)/2}}}function Sn(t){let e=C({x:0,y:0}),o=C({x:0,y:0}),r=C(!1),a=C(void 0),c=i=>a.current!==void 0&&i.pointerId!==a.current,l=C(new Map),p=C(null),s=C(null),u=C(!1),y=C(null),m=C(!1),w=C({frame:0,pan:null,hover:null,pinch:!1});G(()=>()=>{cancelAnimationFrame(w.current.frame)},[]);let[E,N]=L(),[A,B]=L(!1),[U,F]=L(void 0);function V(i){let h=i.currentTarget.getBoundingClientRect();return{x:i.clientX-h.left,y:i.clientY-h.top}}function R(i,h){if(t.layoutResult?.tubeMap)return t.tubeMapNodeAt(i,h);let g=t.referenceStripNodeAt(i,h);if(g)return g;let{nodePositions:b}=t;if(!b)return null;let{x:v,y:x}=ge(i,h,t,t.axisScale);return fe(b,v,x,t.axisScale,t.positionsVersion,t.nodeInk,t.drawnFold)}function T(i,h){let{nodePositions:g,graph:b}=t;if(!g||!b)return null;let{x:v,y:x}=ge(i,h,t,t.axisScale);return he(g,b,v,x,t.axisScale,t.effectiveDrawPaths&&!t.facetPanels,t.positionsVersion,t.deletionEdgeIndexes,t.hiddenEdgeIndexes,t.deletionRoutes,t.layoutResult?.stranded,t.drawnFold)}function Pn(i){i.button===0&&i.preventDefault()}function Mn(i){if(i.button!==0)return;let h=l.current;if(c(i)){t.isPanning&&!m.current&&i.pointerType==="touch"&&h.size===1&&(i.currentTarget.setPointerCapture(i.pointerId),h.set(i.pointerId,j(i)),s.current=wn(h),r.current=!0);return}r.current=!1,o.current={x:i.clientX,y:i.clientY},i.currentTarget.removeAttribute(Ce);let g=t.followsHostView,{x:b,y:v}=V(i),x=v<t.referenceStripZonePx,P=t.hostPlacesX||t.layoutResult?.tubeMap||x?null:R(b,v);t.hostPlacesX||g&&i.shiftKey||t.followsWindow&&!P||(i.currentTarget.setPointerCapture(i.pointerId),a.current=i.pointerId,p.current=i.currentTarget,h.clear(),h.set(i.pointerId,j(i)),g&&P&&i.currentTarget.setAttribute(Ce,""),m.current=g,u.current=x&&!g,P?t.setDraggingNode(P):t.setPanning(!0),e.current={x:i.clientX,y:i.clientY})}function Le(){let i=s.current,h=p.current;if(!i||!h)return;let g=wn(l.current),b=h.getBoundingClientRect();i.spread>0&&g.spread>0&&t.zoom(g.spread/i.spread,i.mid.x-b.left,i.mid.y-b.top),t.setTransform(t.scale,t.translateX+g.mid.x-i.mid.x,t.translateY+g.mid.y-i.mid.y),s.current=g}function Rn(){let i=w.current,{pan:h,hover:g,pinch:b}=i;if(i.frame=0,i.pan=null,i.hover=null,i.pinch=!1,b&&Le(),h&&u.current?t.host?.horizontalScroll(-h.dx):h&&m.current?t.setTransform(t.scale,t.translateX,t.translateY+h.dy):h&&t.setTransform(t.scale,t.translateX+h.dx,t.translateY+h.dy),!g)return;let{x:v,y:x}=g,P=t.facetPanels?void 0:Gt(t.overlayLabels,v,x);F(k=>k?.label===P?.label&&k?.readout===P?.readout?k:P),He(()=>{if(t.walkRowBars){let k=t.walkRowAt(v,x);t.setHoveredWalkRow(k===void 0?null:t.walkRowList[k].name)}if(t.nodePositions&&t.graph){let k=R(v,x);t.setHoveredPanel(t.tubeMapPanelAt(x)),t.setHoveredNode(k,{x:v,y:x}),B(k!==null&&!t.hostPlacesX&&!t.layoutResult?.tubeMap&&x>=t.referenceStripZonePx),t.setHoveredTube(k===null&&t.layoutResult?.tubeMap?t.tubeAt(v,x):null),t.setHoveredEdge(k||t.layoutResult?.tubeMap||!t.hoverLightsEverything?null:T(v,x))}})}function q(){w.current.frame||(w.current.frame=requestAnimationFrame(Rn))}function Cn(){let i=w.current;cancelAnimationFrame(i.frame),i.frame=0,i.pan=null,i.hover=null,i.pinch=!1}function Ln(i){let h=l.current;if(s.current&&h.has(i.pointerId)){h.set(i.pointerId,j(i)),w.current.pinch=!0,q();return}if(c(i)||y.current)return;let g=i.clientX-e.current.x,b=i.clientY-e.current.y;e.current={x:i.clientX,y:i.clientY},Math.hypot(i.clientX-o.current.x,i.clientY-o.current.y)>vn&&(r.current=!0);let v=w.current;if(t.draggingNode)t.moveNode(t.draggingNode,g/t.scaleX,b/t.scaleY);else if(t.isPanning)v.pan={dx:(v.pan?.dx??0)+g,dy:(v.pan?.dy??0)+b},q();else{let x=i.currentTarget.getBoundingClientRect();v.hover={x:i.clientX-x.left,y:i.clientY-x.top},q()}}function pe(i){let h=l.current;if(s.current&&h.has(i.pointerId)){w.current.pinch&&(w.current.pinch=!1,Le()),h.delete(i.pointerId),s.current=null;let[[g,b]]=[...h];a.current=g,e.current=b;return}c(i)||(a.current=void 0,h.clear(),I(t)&&t.stopDragging())}function In(i){c(i)||(F(void 0),B(!1),y.current?w.current.hover=null:(a.current=void 0,l.current.clear(),s.current=null,Cn(),I(t)&&t.stopDragging()),I(t)&&t.clearHover())}function En(i){let{x:h,y:g}=V(i),b=R(h,g),{clientX:v,clientY:x}=i;if(b){i.preventDefault(),N({clientX:v,clientY:x,nodeId:b});return}let P=t.walkRowAt(h,g);P!==void 0&&(i.preventDefault(),N({clientX:v,clientY:x,row:P}))}function Gn(i){if(!r.current){let{x:h,y:g}=V(i),b=R(h,g);t.setSelectedNode(b),b&&t.showNodeDetails(b)}}G(()=>()=>{y.current?.end()},[]);function Tn(i){if(i.button!==0||t.hostPlacesX||t.followsHostView||!(i.target instanceof Element)||!i.target.closest(`[${kt}]`))return;y.current?.end(),u.current=!1,m.current=!1;let h=i.pointerId,g=j(i),b=g,v={moved:!1,end:()=>{window.removeEventListener("pointermove",x,!0),window.removeEventListener("pointerup",P,!0),window.removeEventListener("pointercancel",P,!0),v.moved&&I(t)&&t.stopDragging()}};function x(k){if(k.pointerId!==h)return;if(!v.moved){if(Math.hypot(k.clientX-g.x,k.clientY-g.y)<=vn)return;v.moved=!0,t.setPanning(!0)}let ue=w.current;ue.pan={dx:(ue.pan?.dx??0)+k.clientX-b.x,dy:(ue.pan?.dy??0)+k.clientY-b.y},b=j(k),q()}function P(k){k.pointerId===h&&(v.end(),setTimeout(()=>{y.current===v&&(y.current=null)},0))}y.current=v,window.addEventListener("pointermove",x,!0),window.addEventListener("pointerup",P,!0),window.addEventListener("pointercancel",P,!0)}function Hn(i){y.current?.moved&&(y.current=null,i.stopPropagation())}let Nn={cursor:t.isPanning||t.draggingNode?"grabbing":A?"move":"grab",touchAction:t.hostPlacesX?"auto":"none",overscrollBehavior:"contain"},An=t.host!==void 0&&!t.hostPlacesX&&!t.followsHostView?{[Ce]:"",onMouseDown:i=>{i.stopPropagation()}}:{};return{canvasStyle:Nn,surfaceProps:An,handlers:{onMouseDown:Pn,onPointerDown:Mn,onPointerMove:Ln,onPointerUp:pe,onPointerCancel:pe,onLostPointerCapture:pe,onPointerLeave:In,onClick:Gn,onContextMenu:En},contextMenu:E,hoveredChip:U,labelHandlers:{onPointerDown:Tn,onClickCapture:Hn},closeContextMenu:()=>{N(void 0)}}}var _o={position:"relative"},zo={position:"relative",lineHeight:0,isolation:"isolate"},Bo={position:"absolute",left:0,right:0,bottom:0,zIndex:0},Oo={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},Wo={position:"absolute",left:6,transform:"translateY(-50%)",background:"rgba(255,255,255,0.82)",padding:"0 4px",borderRadius:3,fontSize:11,lineHeight:"16px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:4},Do=f(function({model:e}){return n(S,{children:e.visibleRowLabels.map(({label:o,y:r,top:a})=>n("div",{"data-testid":"graph-row-label",style:{...Wo,top:a},children:o},r))})}),Xo={position:"absolute",display:"flex",flexDirection:"column",borderRadius:3,overflowX:"hidden",overflowY:"auto",zIndex:4},Fo={position:"absolute",transform:"translate(-50%, -50%)",background:"rgba(255,255,255,0.78)",padding:"0 3px",borderRadius:3,fontSize:10,lineHeight:"13px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:3},Vo=f(function({model:e,children:o}){let r=C(null),a=e.legendAtRest,c=e.keyShape;return G(()=>{e.setKeyShapeOf(()=>JSON.stringify(Bt(e)))},[e]),G(()=>{let l=r.current;if(!l||!a)return;let p=new ResizeObserver(()=>{s()}),s=()=>{for(let u of l.children)p.observe(u);I(e)&&e.legendAtRest&&e.setLegendSize({width:l.offsetWidth,height:l.scrollHeight},c)};return p.observe(l),s(),()=>{p.disconnect()}},[e,a,c]),d("div",{ref:r,style:{...Xo,top:ne+e.referenceStripZonePx,right:ne,maxHeight:e.canvasHeight-2*ne-e.referenceStripZonePx},children:[o,e.keyPlacement==="hidden"?null:n($t,{model:e,sections:Ot(e)})]})}),Yo=f(function({model:e}){return n(S,{children:e.overlayLabels.sizes.map(({key:o,node:r,text:a,x:c,y:l})=>n("div",{"data-testid":"graph-size-label",style:{...Fo,left:c,top:l,opacity:e.nodeFaded(r)?Et:void 0},children:a},o))})}),kn=f(function({model:e,handle:{canvasRef:o,canvas:r},ownChrome:a}){let{handlers:c,canvasStyle:l,surfaceProps:p,labelHandlers:s,contextMenu:u,closeContextMenu:y,hoveredChip:m}=Sn(e),[w,E]=L(null);xn(w,r,e);let N=e.facetPanels!==void 0;return d("div",{style:_o,...p,children:[a?n(ln,{model:e}):null,d("div",{ref:E,style:zo,...s,onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{I(e)&&e.setPointerInPane(!1)},children:[e.referenceStripShown?n("div",{style:{...Bo,top:e.referenceStripZonePx,background:te}}):null,n("canvas",{ref:o,"data-testid":"graph-genome-canvas",style:{...l,width:e.paneWidth,height:e.canvasHeight,clipPath:e.drawingClip,display:"block",position:"relative",zIndex:1},...c}),N?n(Kt,{model:e,handlers:c,canvasStyle:l,controls:a?null:d(S,{children:[n(Me,{model:e,inline:!0}),n(Se,{model:e,inline:!0})]})}):d(S,{children:[n(Dt,{model:e}),n(Zt,{model:e}),n(Wt,{model:e}),n(Ct,{model:e}),n(Do,{model:e}),n(Yo,{model:e}),n(Rt,{model:e}),n(It,{model:e}),n(Tt,{model:e}),n(Xt,{model:e}),n(gn,{model:e}),n(Vo,{model:e,children:a?null:d(S,{children:[n(Me,{model:e}),n(Se,{model:e})]})})]}),a?n("div",{style:Oo,children:n(Ae,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null,n(pn,{model:e,chip:m})]}),n(hn,{model:e}),e.walkStripShown?n(mn,{model:e}):null,n(ce,{model:e,at:u,onClose:y}),a?.renderError?n(de,{error:a.renderError,onReset:a.retryRender}):null,a&&e.error?n(de,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),Zo=f(function({model:e}){let{canvasRef:o,canvas:r,error:a,retry:c}=Yt(Vt,e);return n(kn,{model:e,handle:{canvasRef:o,canvas:r},ownChrome:{renderError:a,retryRender:c}})}),$o=f(function({model:e,handle:o}){return o?n(kn,{model:e,handle:o}):n(Zo,{model:e})}),kl=$o;export{Vt as a,kl as b};
|
|
2
|
+
//# sourceMappingURL=chunk-N7IFEWBH.js.map
|