jbrowse-plugin-graphgenomeviewer 10.4.2 → 10.4.3
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-P5APNL32.js → AddTrackWorkflow-X3FDV4YC.js} +2 -2
- package/dist/chunks/{GbzBaseSyntenyAdapter-46A4LMVD.js → GbzBaseSyntenyAdapter-KBJM7TL2.js} +2 -2
- package/dist/chunks/{GbzBaseSyntenyAdapter-46A4LMVD.js.map → GbzBaseSyntenyAdapter-KBJM7TL2.js.map} +1 -1
- package/dist/chunks/{GraphGenomeView-MXRAP7QB.js → GraphGenomeView-4IRT4GUJ.js} +2 -2
- package/dist/chunks/GraphSettingsDialog-MRKEIR65.js +2 -0
- package/dist/chunks/{HighlightColorDialog-UKFUS5S4.js → HighlightColorDialog-PRM7R6C5.js} +2 -2
- package/dist/chunks/LinearGraphDisplay-BHLFORWW.js +2 -0
- package/dist/chunks/{MinigraphBubbleAdapter-QSPPG4LG.js → MinigraphBubbleAdapter-XVYXCC76.js} +2 -2
- package/dist/chunks/{RgfaTabixAdapter-UPCOXYVG.js → RgfaTabixAdapter-DTLYU5IT.js} +2 -2
- package/dist/chunks/{WalkFormsAdapter-LHKGRYC6.js → WalkFormsAdapter-PT6SRY4G.js} +2 -2
- package/dist/chunks/{WalkTabixSyntenyAdapter-ELTYD73I.js → WalkTabixSyntenyAdapter-CGRHEJV4.js} +2 -2
- package/dist/chunks/{chunk-YIGESHTA.js → chunk-2LE4HMDX.js} +2 -2
- package/dist/chunks/{chunk-YIGESHTA.js.map → chunk-2LE4HMDX.js.map} +1 -1
- package/dist/chunks/{chunk-L7ZSEA4T.js → chunk-3PVSP3VV.js} +2 -2
- package/dist/chunks/{chunk-L7ZSEA4T.js.map → chunk-3PVSP3VV.js.map} +1 -1
- package/dist/chunks/{chunk-N2TMTGYP.js → chunk-3SHFFRNZ.js} +2 -2
- package/dist/chunks/{chunk-WBDZVWK4.js → chunk-5FHTS7YG.js} +2 -2
- package/dist/chunks/{chunk-WBDZVWK4.js.map → chunk-5FHTS7YG.js.map} +1 -1
- package/dist/chunks/{chunk-5N4B6FEH.js → chunk-7OHJQC5U.js} +2 -2
- package/dist/chunks/{chunk-TM22QR6V.js → chunk-D7OYDVIT.js} +2 -2
- package/dist/chunks/{chunk-TM22QR6V.js.map → chunk-D7OYDVIT.js.map} +1 -1
- package/dist/chunks/{chunk-RDTLCMD2.js → chunk-DAIBR3K3.js} +1 -1
- package/dist/chunks/{chunk-RDTLCMD2.js.map → chunk-DAIBR3K3.js.map} +1 -1
- package/dist/chunks/{chunk-2TMZO3P5.js → chunk-DFFDIHCP.js} +2 -2
- package/dist/chunks/{chunk-VY7G4FSX.js → chunk-F3NT4VYA.js} +2 -2
- package/dist/chunks/{chunk-VY7G4FSX.js.map → chunk-F3NT4VYA.js.map} +2 -2
- package/dist/chunks/chunk-FQ5DWNNX.js +5 -0
- package/dist/chunks/chunk-FQ5DWNNX.js.map +7 -0
- package/dist/chunks/{chunk-52BUFQHJ.js → chunk-HY5KSOGM.js} +6 -6
- package/dist/chunks/{chunk-52BUFQHJ.js.map → chunk-HY5KSOGM.js.map} +2 -2
- package/dist/chunks/{chunk-SMZZWPRX.js → chunk-NK76Y6IN.js} +2 -2
- package/dist/chunks/{chunk-SMZZWPRX.js.map → chunk-NK76Y6IN.js.map} +3 -3
- package/dist/chunks/{chunk-E3GNTGWW.js → chunk-OA3GUDDC.js} +1 -1
- package/dist/chunks/{chunk-E3GNTGWW.js.map → chunk-OA3GUDDC.js.map} +1 -1
- package/dist/chunks/{chunk-YLB6GKFG.js → chunk-QY7CN2N2.js} +2 -2
- package/dist/chunks/{chunk-YLB6GKFG.js.map → chunk-QY7CN2N2.js.map} +1 -1
- package/dist/chunks/{chunk-4QYWBDUL.js → chunk-RCTMI22R.js} +2 -2
- package/dist/chunks/{chunk-4QYWBDUL.js.map → chunk-RCTMI22R.js.map} +1 -1
- package/dist/chunks/{chunk-QOMV5OG7.js → chunk-RTLOZXOH.js} +2 -2
- package/dist/chunks/{chunk-DZXYOIGJ.js → chunk-SOOC7T5G.js} +2 -2
- package/dist/chunks/{chunk-43EUXRKZ.js → chunk-UBN7IANP.js} +2 -2
- package/dist/chunks/{chunk-43EUXRKZ.js.map → chunk-UBN7IANP.js.map} +1 -1
- package/dist/chunks/{chunk-AC5KEN36.js → chunk-UFFIQB3D.js} +2 -2
- package/dist/chunks/{chunk-AC5KEN36.js.map → chunk-UFFIQB3D.js.map} +1 -1
- package/dist/chunks/{chunk-E5ERNAYL.js → chunk-USYII6RS.js} +1 -1
- package/dist/chunks/{chunk-E5ERNAYL.js.map → chunk-USYII6RS.js.map} +1 -1
- package/dist/chunks/chunk-XO54F7NK.js +2 -0
- package/dist/chunks/chunk-XO54F7NK.js.map +7 -0
- package/dist/chunks/{chunk-RUKWE5MB.js → chunk-XZ4HLR4N.js} +2 -2
- package/dist/chunks/{renderSvg-4AG3PPI5.js → renderSvg-ZXYKGJ7N.js} +2 -2
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +1 -1
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/version.ts +1 -1
- package/dist/chunks/GraphSettingsDialog-HIOYWTO7.js +0 -2
- package/dist/chunks/LinearGraphDisplay-KPWFPVFK.js +0 -2
- package/dist/chunks/chunk-BLE63OIT.js +0 -2
- package/dist/chunks/chunk-BLE63OIT.js.map +0 -7
- package/dist/chunks/chunk-M5XKM6D2.js +0 -5
- package/dist/chunks/chunk-M5XKM6D2.js.map +0 -7
- /package/dist/chunks/{AddTrackWorkflow-P5APNL32.js.map → AddTrackWorkflow-X3FDV4YC.js.map} +0 -0
- /package/dist/chunks/{GraphGenomeView-MXRAP7QB.js.map → GraphGenomeView-4IRT4GUJ.js.map} +0 -0
- /package/dist/chunks/{GraphSettingsDialog-HIOYWTO7.js.map → GraphSettingsDialog-MRKEIR65.js.map} +0 -0
- /package/dist/chunks/{HighlightColorDialog-UKFUS5S4.js.map → HighlightColorDialog-PRM7R6C5.js.map} +0 -0
- /package/dist/chunks/{LinearGraphDisplay-KPWFPVFK.js.map → LinearGraphDisplay-BHLFORWW.js.map} +0 -0
- /package/dist/chunks/{MinigraphBubbleAdapter-QSPPG4LG.js.map → MinigraphBubbleAdapter-XVYXCC76.js.map} +0 -0
- /package/dist/chunks/{RgfaTabixAdapter-UPCOXYVG.js.map → RgfaTabixAdapter-DTLYU5IT.js.map} +0 -0
- /package/dist/chunks/{WalkFormsAdapter-LHKGRYC6.js.map → WalkFormsAdapter-PT6SRY4G.js.map} +0 -0
- /package/dist/chunks/{WalkTabixSyntenyAdapter-ELTYD73I.js.map → WalkTabixSyntenyAdapter-CGRHEJV4.js.map} +0 -0
- /package/dist/chunks/{chunk-N2TMTGYP.js.map → chunk-3SHFFRNZ.js.map} +0 -0
- /package/dist/chunks/{chunk-5N4B6FEH.js.map → chunk-7OHJQC5U.js.map} +0 -0
- /package/dist/chunks/{chunk-2TMZO3P5.js.map → chunk-DFFDIHCP.js.map} +0 -0
- /package/dist/chunks/{chunk-QOMV5OG7.js.map → chunk-RTLOZXOH.js.map} +0 -0
- /package/dist/chunks/{chunk-DZXYOIGJ.js.map → chunk-SOOC7T5G.js.map} +0 -0
- /package/dist/chunks/{chunk-RUKWE5MB.js.map → chunk-XZ4HLR4N.js.map} +0 -0
- /package/dist/chunks/{renderSvg-4AG3PPI5.js.map → renderSvg-ZXYKGJ7N.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{f as Y,g as X,h as De,i as He,j as Ie,k as ce,l as qe,n as $e}from"./chunk-KGAZZNZC.js";import{a as ae,b as Oe}from"./chunk-D6TY2QEG.js";import{e as Fe,j as Le}from"./chunk-EGZZ3ADM.js";import{d as ze,g as ye,h as re}from"./chunk-RDTLCMD2.js";var D=JBrowseExports["@jbrowse/core/data_adapters/BaseAdapter"],Ue=i=>D!=null&&i in Object(D)?D[i]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+i+"' from '@jbrowse/core/data_adapters/BaseAdapter' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:i});var Mt=Ue("BaseFeatureDataAdapter");var je=Ue("cachedSetup");var Bt=D&&D.__esModule?D.default:D;async function Et(i,e,t,n,s){return Ie(e,t,n),i.getLines(e,t,n,s)}async function Ve(i,e,t){for(let{refName:n,start:s,end:o}of e)Ie(n,s,o);return i.bytesForRegions(e,t)}function H(i){if(i?.aborted)throw ke(i)}function ke(i){let e=i.reason;return e===void 0?new DOMException("This operation was aborted","AbortError"):e}function Ge(i){return typeof i?.addEventListener=="function"}var z=class{entries=new Map;total=0;settledCount=0;limit;shared;fill;sizeOf;toCacheKey;idleTimeoutMs;sweepTimer;constructor({fill:e,maxSize:t=1/0,sizeOf:n=()=>1,cacheKey:s=a=>String(a),idleTimeoutMs:o=0,budget:r}={}){this.fill=e,this.limit=t,this.shared=r&&{budget:r,membership:r.register(this)},this.sizeOf=n,this.toCacheKey=s,this.idleTimeoutMs=o>0&&Number.isFinite(o)?o:void 0}get size(){return this.entries.size}get totalSize(){return this.total}get maxSize(){return this.limit}set maxSize(e){this.limit=e,this.evict()}waiterCount(e){return this.entries.get(this.toCacheKey(e))?.pending?.signals.size??0}async get(e,t,n){H(t);let s=this.toCacheKey(e),o=this.entries.get(s);o&&this.isDoomed(o)&&(this.release(s),o=void 0),o?this.touch(s,o):o=this.start(s,e,n),o.pending&&this.join(o.pending,t);try{return await this.settleFor(o,t)}finally{H(t)}}settleFor(e,t){if(!e.pending||!Ge(t))return e.promise;let n,s=new Promise((r,a)=>{n=a}),o=()=>{n(ke(t))};return t.addEventListener("abort",o,{once:!0}),Promise.race([e.promise,s]).finally(()=>{t.removeEventListener("abort",o)})}getIfCached(e){let t=this.toCacheKey(e),n=this.entries.get(t);if(n){if(this.isDoomed(n)){this.release(t);return}return this.touch(t,n),n.promise}}has(e){let t=this.entries.get(this.toCacheKey(e));return t!==void 0&&!this.isDoomed(t)}delete(e){this.release(this.toCacheKey(e))}clear(){this.entries.clear(),this.shared?.budget.charge(this.shared.membership,-this.total),this.total=0,this.settledCount=0,this.stopSweep()}touch(e,t){this.entries.delete(e),this.entries.set(e,t),t.lastTouched=Date.now(),t.seq=this.stamp()}stamp(){return this.shared?.budget.nextSeq()??0}isDoomed(e){return e.pending?.controller.signal.aborted===!0}sweepIdle(){let e=this.idleTimeoutMs;if(e===void 0)return;let t=Date.now()-e;for(let[n,s]of this.entries)!s.pending&&s.lastTouched<=t&&this.release(n);this.settledCount===0&&this.stopSweep()}startSweep(){let e=this.idleTimeoutMs;if(e===void 0||this.sweepTimer!==void 0)return;let t=Math.min(2**31-1,Math.max(1e3,Math.floor(e/4))),n=new WeakRef(this),s=setInterval(()=>{let o=n.deref();o?o.sweepIdle():clearInterval(s)},t);this.sweepTimer=s,s.unref?.()}stopSweep(){this.sweepTimer!==void 0&&(clearInterval(this.sweepTimer),this.sweepTimer=void 0)}start(e,t,n){let s=n??(this.fill&&(h=>this.fill(t,h)));if(!s)throw new Error("SharedReadCache needs a fill, either on the cache or on the get() call");let o={signals:new Map,pinned:!1,controller:new AbortController},r={promise:Promise.resolve(s(o.controller.signal)),pending:o,size:0,lastTouched:Date.now(),seq:this.stamp()};this.entries.set(e,r);let a=()=>this.entries.get(e)===r,l=()=>{for(let[h,c]of o.signals)h.removeEventListener("abort",c);r.pending=void 0};return r.promise.then(h=>{let c=a()?this.weigh(h):void 0,d=a();l(),d&&(c===void 0?this.entries.delete(e):(r.lastTouched=Date.now(),r.size=c,this.settledCount++,this.total+=c,this.shared?.budget.charge(this.shared.membership,c),this.startSweep())),this.evict(),this.shared?.budget.evict()},()=>{a()&&this.release(e),l()}),r}weigh(e){try{let t=this.sizeOf(e);return Number.isFinite(t)&&t>=0?t:void 0}catch{return}}join(e,t){if(!Ge(t))e.pinned=!0;else if(!t.aborted&&!e.signals.has(t)){let n=()=>{e.signals.delete(t),!e.pinned&&e.signals.size===0&&e.controller.abort(t.reason)};e.signals.set(t,n),t.addEventListener("abort",n,{once:!0})}}release(e){let t=this.entries.get(e);t&&(this.entries.delete(e),t.pending||this.settledCount--,this.total-=t.size,this.shared?.budget.charge(this.shared.membership,-t.size))}lruSpare(e=!1){if(!(this.settledCount<=(e?0:1))){for(let[t,n]of this.entries)if(!n.pending)return{cacheKey:t,seq:n.seq,last:this.settledCount===1}}}evict(){if(!(this.total<=this.limit))for(let[e,t]of this.entries){if(this.total<=this.limit||this.settledCount<=1)break;t.pending||this.release(e)}}};var A=class{minv;maxv;bin;endPosition;constructor(e,t,n,s=t.blockPosition+65536){this.minv=e,this.maxv=t,this.bin=n,this.endPosition=s}toString(){return`${this.minv.toString()}..${this.maxv.toString()} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`}fetchedSize(){return this.endPosition-this.minv.blockPosition}};function ve(i,e){if(!(e>0))throw new TypeError(`\`${i}\` must be a number greater than 0`)}var Q=class{#e=new Map;#t=new Map;#n;#s;#o;constructor(e){let t=e.maxAge??Number.POSITIVE_INFINITY;ve("maxSize",e.maxSize),ve("maxAge",t),this.#n=e.maxSize,this.#s=t,this.#o=e.onEviction}#r(e){let t=this.#o;if(t)for(let[n,s]of e)t(n,s.value)}#i(e,t){return t.expiry!==void 0&&t.expiry<=Date.now()?(this.#o?.(e,t.value),this.delete(e),!0):!1}#c(e,t){return this.#i(e,t)?void 0:t.value}#l(e,t){if(this.#t.delete(e),this.#e.set(e,t),this.#e.size>=this.#n){let n=this.#t;this.#t=this.#e,this.#e=new Map,this.#r(n)}}#h(e){this.#t=new Map(e),this.#e=new Map}*#a(){for(let e of[this.#t,this.#e])for(let t of e)this.#i(...t)||(yield t)}get(e){let t=this.#e.get(e);if(t)return this.#c(e,t);let n=this.#t.get(e);if(n&&!this.#i(e,n))return this.#l(e,n),n.value}set(e,t,{maxAge:n=this.#s}={}){let s={value:t,expiry:n===Number.POSITIVE_INFINITY?void 0:Date.now()+n};return this.#e.has(e)?this.#e.set(e,s):this.#l(e,s),this}has(e){let t=this.#e.get(e)??this.#t.get(e);return t!==void 0&&!this.#i(e,t)}peek(e){let t=this.#e.get(e)??this.#t.get(e);return t?this.#c(e,t):void 0}expiresIn(e){let t=this.#e.get(e)??this.#t.get(e);if(t)return t.expiry===void 0?Number.POSITIVE_INFINITY:t.expiry-Date.now()}delete(e){return this.#e.delete(e)||this.#t.delete(e)}clear(){this.#e.clear(),this.#t.clear()}resize(e){ve("maxSize",e);let t=[...this.#a()],n=t.length-e;n<0?(this.#e=new Map(t),this.#t=new Map):(this.#r(t.slice(0,n)),this.#h(t.slice(n))),this.#n=e}evict(e=1){if(!(e>0))return;let t=[...this.#a()],n=Math.trunc(Math.min(e,t.length-1));n>0&&(this.#r(t.slice(0,n)),this.#h(t.slice(n)))}get size(){return Math.min(this.#e.size+this.#t.size,this.#n)}get maxSize(){return this.#n}get maxAge(){return this.#s}*entriesAscending(){for(let[e,t]of this.#a())yield[e,t.value]}*entriesDescending(){for(let e of[this.#e,this.#t])for(let[t,n]of[...e].reverse())this.#i(t,n)||(yield[t,n.value])}entries(){return this.entriesAscending()}[Symbol.iterator](){return this.entriesAscending()}*keys(){for(let[e]of this)yield e}*values(){for(let[,e]of this)yield e}forEach(e,t=this){for(let[n,s]of this)e.call(t,s,n,this)}get[Symbol.toStringTag](){return"QuickLRU"}toString(){return`QuickLRU(${this.size}/${this.maxSize})`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}};function We(i,e=0){let t=i[e]|i[e+1]<<8|i[e+2]<<16|i[e+3]<<24;return((i[e+4]|i[e+5]<<8|i[e+6]<<16|i[e+7]<<24)>>>0)*4294967296+(t>>>0)}var G=class{blockPosition;dataPosition;constructor(e,t){this.blockPosition=e,this.dataPosition=t}toString(){return`${this.blockPosition}:${this.dataPosition}`}compareTo(e){return this.blockPosition-e.blockPosition||this.dataPosition-e.dataPosition}};function O(i,e=0){return new G(i[e+7]*1099511627776+i[e+6]*4294967296+i[e+5]*16777216+i[e+4]*65536+i[e+3]*256+i[e+2],i[e+1]<<8|i[e])}function le(i,e){let t=i.length;if(t===0)return i;let n;if(e){let a=e.blockPosition,l=e.dataPosition;n=[];for(let h=0;h<t;h++){let c=i[h];(c.maxv.blockPosition-a||c.maxv.dataPosition-l)>0&&n.push(c)}if(n.length===0)return n}else n=i;n.sort((a,l)=>{let h=a.minv.blockPosition-l.minv.blockPosition;return h===0?a.minv.dataPosition-l.minv.dataPosition:h});let s=[n[0]],o=n[0].minv.blockPosition,r=n[0].maxv.blockPosition;for(let a=1;a<n.length;a++){let l=n[a],h=l.minv.blockPosition,c=l.maxv.blockPosition;if(h-r<65e3&&c-o<5e6){let d=s.at(-1);(c-r||l.maxv.dataPosition-d.maxv.dataPosition)>0&&(s[s.length-1]=new A(d.minv,l.maxv,d.bin,l.endPosition),r=c)}else s.push(l),o=h,r=c}return at(s)}function at(i){let e=[i[0]];for(let t=1;t<i.length;t++){let n=i[t],s=e.at(-1).maxv;if((n.minv.blockPosition-s.blockPosition||n.minv.dataPosition-s.dataPosition)>=0){e.push(n);continue}(n.maxv.blockPosition-s.blockPosition||n.maxv.dataPosition-s.dataPosition)>0&&e.push(new A(s,n.maxv,n.bin,n.endPosition))}return e}function he(i,e=[]){let t=[...e];for(let n of i)t.push(n.minv.blockPosition,n.maxv.blockPosition);t.sort((n,s)=>n-s);for(let n of i){let s=n.maxv.blockPosition,o=0,r=t.length;for(;o<r;){let a=o+r>>>1;t[a]>s?r=a:o=a+1}o<t.length&&(n.endPosition=Math.min(n.endPosition,t[o]))}}function de(i,e,t,n,s=8){let o=n?n.blockPosition:1/0,r=n?n.dataPosition:0,a=!1;for(let l=0;l<t;l++){let h=e+l*s,c=i[h+7]*1099511627776+i[h+6]*4294967296+i[h+5]*16777216+i[h+4]*65536+i[h+3]*256+i[h+2],d=i[h+1]<<8|i[h];(c<o||c===o&&d<r)&&(o=c,r=d,a=!0)}return a?new G(o,r):n}function ct(i){let e=new TextDecoder("utf-8"),t=[],n={},s=0,o=0;for(;o<i.length;){let r=i.indexOf(0,o);if(r===-1)break;if(r>o){let a=e.decode(i.subarray(o,r));t[s]=a,n[a]=s}o=r+1,s++}return{refNameToId:n,refIdToName:t}}var lt={0:"generic",1:"SAM",2:"VCF",3:"GAF"};function fe(i,e){let t=new DataView(i.buffer,i.byteOffset,i.byteLength),n=t.getInt32(e,!0),s=n&65536?"zero-based-half-open":"1-based-closed",o=lt[n&15];if(!o)throw new Error(`invalid Tabix preset format flags ${n}`);let r={ref:t.getInt32(e+4,!0),start:t.getInt32(e+8,!0),end:t.getInt32(e+12,!0)},a=t.getInt32(e+16,!0),l=a?String.fromCharCode(a):void 0,h=t.getInt32(e+20,!0),c=t.getInt32(e+24,!0),{refIdToName:d,refNameToId:p}=ct(i.subarray(e+28,e+28+c));return{refIdToName:d,refNameToId:p,skipLines:h,metaChar:l,columnNumbers:r,format:o,coordinateType:s}}function ue(i,e){return{lineCount:We(i,e)}}function me(i,e=5){let t=new Q({maxSize:e});return n=>{let s=t.get(n);if(s!==void 0)return s;let o=i(n);return o!==void 0&&t.set(n,o),o}}function Ke(i){let e=0;for(let s of i)e+=s.length;let t=new Uint8Array(e),n=0;for(let s of i)t.set(s,n),n+=s.length;return t}var Je=10;function Se(i,e,t){let n,s=0;for(let o of i){let r=0;if(n){let h=o.indexOf(Je);if(h===-1){n=Ke([n,o]),e+=o.length;continue}if(t(Ke([n,o.subarray(0,h+1)]),s))return!0;r=h+1,n=void 0}let a=o.lastIndexOf(Je);if(a>=r&&t(o.subarray(r,a+1),e+r))return!0;let l=Math.max(r,a+1);l<o.length&&(n=o.slice(l),s=e+l),e+=o.length}return!1}function Ye(i,e,t){let n=[],s=0;for(let o of i){let r=Math.max(e-s,0),a=Math.min(t-s,o.length);r<a&&n.push(o.subarray(r,a)),s+=o.length}return n}function Pe(i,e,t){let n=0,s=i.length-1;for(;n<s;){let r=n+s+1>>>1;i[r]<=t.blockPosition?n=r:s=r-1}return(n===0?0:e[n])-e[0]+t.dataPosition}function ht(i,e,t,n){if(e>2**(t+n*3))return;let s=(8**(n+1)-1)/7,o=(8**n-1)/7+Math.floor((e-1)/2**t)+1;for(o>=s&&(o=0);;){for(;o%8===1;)o=(o-1)/8;if(o===0)return;let r=i[o];if(r?.length){let a=r[0].minv;for(let l=1;l<r.length;l++){let h=r[l].minv;h.compareTo(a)<0&&(a=h)}return a}o++}}function Xe(i,e){return i.format==="GAF"?0:i.refNameToId[e]}var q=class{filehandle;parseCache=new z({});constructor({filehandle:e}){this.filehandle=e}async readIndexBytes(e){let t=await this.filehandle.readFile({signal:e.signal,onProgress:e.onProgress}),n=await ce(t);return{bytes:n,dataView:new DataView(n.buffer,n.byteOffset,n.byteLength)}}async lineCount(e,t={}){let n=await this.parse(t),s=Xe(n,e);return s===void 0?-1:n.indices(s)?.stats?.lineCount??-1}async getMetadata(e={}){let{indices:t,...n}=await this.parse(e);return n}async blocksForRange(e,t,n,s={}){let o=await this.parse(s),r=Xe(o,e);if(r===void 0)return[];let a=o.indices(r);if(!a)return[];o.format==="GAF"&&(t=Math.max(t-1,0));let l=[];for(let[m,f]of this.reg2bins(t,n,o))for(let x=m;x<=f;x++){let b=a.binIndex[x];if(b)for(let v of b)l.push(v)}let h=this.lowestOffset(a,t,o),c=le(l,h),d=ht(a.binIndex,n,o.minShift,o.depth);if(d){let m=c.length;for(;m>0&&c[m-1].minv.compareTo(d)>=0;)m--;c.length=m}let p=c[0];if(p&&h){let m=2**(o.minShift+3),f=this.lowestOffset(a,Math.floor(t/m)*m,o),x=f&&f.compareTo(h)<0?f:h;p.minv.compareTo(x)<0&&(c[0]=new A(x,p.maxv,p.bin,p.endPosition))}return c}parse(e={}){return this.parseCache.get("index",e.signal,t=>this._parse({...e,signal:t}))}async hasRefSeq(e,t={}){return!!(await this.parse(t)).indices(e)?.binIndex}};var dt=21582659,ft=38359875;function Qe(i,e){return i*2**e}function Te(i,e){return Math.floor(i/2**e)}var $=class extends q{async _parse(e={}){let{bytes:t,dataView:n}=await this.readIndexBytes(e),s=n.getUint32(0,!0),o;if(s===dt)o=1;else if(s===ft)o=2;else throw new Error(`Not a CSI file (magic=${s})`);let r=n.getInt32(4,!0),a=n.getInt32(8,!0),l=(8**(a+1)-1)/7,h=2**(r+a*3),c=n.getInt32(12,!0),d=c>=28&&(n.getInt32(16,!0)&15)===3;if(c<30&&!d)throw new Error("CSI index has no tabix header, so it names no references; it may be a BAM or BCF index");let p=fe(t,16),m=n.getInt32(16+c,!0),f=16+c+4,x,b=[];for(let y=0;y<m;y++){b.push(f);let I=n.getInt32(f,!0);f+=4;for(let u=0;u<I;u++){let S=n.getUint32(f,!0);if(f+=4,S>l)f+=44;else{x=de(t,f,1,x),f+=8;let g=n.getInt32(f,!0);f+=4+16*g}}}function v(y){let I=b[y];if(I===void 0)return;let u=I,S=n.getInt32(u,!0);u+=4;let g={},C={},w;for(let F=0;F<S;F++){let k=n.getUint32(u,!0);if(u+=4,k>l)w=ue(t,u+28),u+=44;else{C[k]=O(t,u),u+=8;let R=n.getInt32(u,!0);u+=4;let T=Array.from({length:R});for(let _=0;_<R;_++)T[_]=new A(O(t,u),O(t,u+8),k),u+=16;g[k]=T}}return he(Object.values(g).flat()),{binIndex:g,loffsets:C,stats:w}}return{...p,csi:!0,refCount:m,maxBlockSize:65536,firstDataLine:x,csiVersion:o,indices:me(v),minShift:r,depth:a,maxBinNumber:l,maxRefLength:h}}lowestOffset(e,t,{minShift:n,depth:s}){let{loffsets:o}=e,r;if(o){let a=(Qe(1,3*s)-1)/7+Te(Math.max(t,0),n);for(;r===void 0&&a>0;)if(r=o[a],r===void 0){let l=Math.floor((a-1)/8),h=l*8+1;a=a>h?a-1:l}r??=o[0]}return r}reg2bins(e,t,{minShift:n,depth:s,maxBinNumber:o}){e=Math.max(e,0);let r=2**(n+s*3);t>r&&(t=r),t-=1;let a=0,l=0,h=n+s*3,c=[];for(;a<=s;h-=3,l+=Qe(1,a*3),a+=1){let d=l+Te(e,h),p=l+Te(t,h);if(p-d+c.length>o)throw new Error(`query ${e}-${t} is too large for current binning scheme (shift ${n}, depth ${s}), try a smaller query or a coarser index binning scheme`);c.push([d,p])}return c}};var ut=21578324,Ae=5,_e=14,pe=2**(_e+Ae*3);function Ze(i){return Math.min(Math.max(i,0),pe)}var L=class extends q{reg2bins(e,t){e>pe&&console.warn("querying outside of possible tabix range");let n=Ze(e),s=Math.min(t,pe)-1,o=[];return n<=s&&o.push([0,0],[1+(n>>26),1+(s>>26)],[9+(n>>23),9+(s>>23)],[73+(n>>20),73+(s>>20)],[585+(n>>17),585+(s>>17)],[4681+(n>>14),4681+(s>>14)]),o}lowestOffset(e,t){let n=e.linearIndex;return n?.[Math.min(Ze(t)>>_e,n.length-1)]}async _parse(e={}){let{bytes:t,dataView:n}=await this.readIndexBytes(e);if(n.getUint32(0,!0)!==ut)throw new Error("Not a TBI file");let s=n.getUint32(4,!0),o=((1<<(Ae+1)*3)-1)/7,{refNameToId:r,refIdToName:a,coordinateType:l,format:h,columnNumbers:c,metaChar:d,skipLines:p}=fe(t,8),f=36+n.getInt32(32,!0),x,b=[];for(let y=0;y<s;y++){b.push(f);let I=n.getInt32(f,!0);f+=4;for(let S=0;S<I;S++){let g=n.getUint32(f,!0);f+=4;let C=n.getInt32(f,!0);if(f+=4,g>o+1)throw new Error("tabix index contains too many bins, please use a CSI index");g<=o&&(x=de(t,f,C,x,16)),f+=16*C}let u=n.getInt32(f,!0);f+=4+8*u}function v(y){let I=b[y];if(I===void 0)return;let u=I,S=n.getInt32(u,!0);u+=4;let g={},C;for(let k=0;k<S;k++){let R=n.getUint32(u,!0);if(u+=4,R>o+1)throw new Error("tabix index contains too many bins, please use a CSI index");if(R===o+1){let T=n.getInt32(u,!0);u+=4,T===2&&(C=ue(t,u+16)),u+=16*T}else{let T=n.getInt32(u,!0);u+=4;let _=Array.from({length:T});for(let U=0;U<T;U++)_[U]=new A(O(t,u),O(t,u+8),R),u+=16;g[R]=_}}let w=n.getInt32(u,!0);u+=4;let F=Array.from({length:w});for(let k=0;k<w;k++)F[k]=O(t,u),u+=8;return he(Object.values(g).flat(),F.map(k=>k.blockPosition)),{binIndex:g,linearIndex:F,stats:C}}return{indices:me(v),metaChar:d,minShift:_e,depth:Ae,maxBinNumber:o,maxRefLength:pe,skipLines:p,firstDataLine:x,columnNumbers:c,coordinateType:l,format:h,refIdToName:a,refNameToId:r,maxBlockSize:65536}}};var Me=9,xe=10,nt=13,mt=59,pt=60,gt=62,xt=6,wt=1024*2**20,bt=180*1e3;function Ct(i,e,t){if(i)return i;if(e)return new X(e);if(t)return new Y(t);throw new TypeError("must provide either filehandle, path, or url")}function yt({tbiFilehandle:i,csiFilehandle:e,tbiPath:t,csiPath:n,tbiUrl:s,csiUrl:o,path:r,url:a}){if(i)return new L({filehandle:i});if(e)return new $({filehandle:e});if(t)return new L({filehandle:new X(t)});if(n)return new $({filehandle:new X(n)});if(o)return new $({filehandle:new Y(o)});if(s)return new L({filehandle:new Y(s)});if(r)return new L({filehandle:new X(`${r}.tbi`)});if(a)return new L({filehandle:new Y(`${a}.tbi`)});throw new TypeError("must provide one of tbiFilehandle, tbiPath, csiFilehandle, csiPath, tbiUrl, csiUrl")}function it(i,e,t,n,s){return i[t]*256+(n-e[t])+s+1}function It(i,e,t,n,s,o,r){let a=n-t,l=e+a,h=0;if(i[s]===46)return l;let c=s;for(let d=s;d<=o;d++)if(d===o||i[d]===mt){let p=d-c;if(p>=10&&i[c]===83&&i[c+1]===86&&i[c+2]===84&&i[c+3]===89&&i[c+4]===80&&i[c+5]===69&&i[c+6]===61&&i[c+7]===84&&i[c+8]===82&&i[c+9]===65)return e+1;if(p>=4&&i[c]===69&&i[c+1]===78&&i[c+2]===68&&i[c+3]===61){let m=ge(i,c+4,d);m>e&&(l=m)}else p>=6&&i[c]===83&&i[c+1]===86&&i[c+2]===76&&i[c+3]===69&&i[c+4]===78&&i[c+5]===61&&(h=vt(i,c+6,d,n+1,r));c=d+1}return Math.max(l,e+h)}var et=44;function kt(i,e,t){if(t-e<5||i[e]!==60||i[t-1]!==62)return!1;let n=i[e+4];if(n!==62&&n!==58)return!1;let s=i[e+1],o=i[e+2],r=i[e+3];return s===67&&o===78&&r===86||s===68&&o===69&&r===76||s===68&&o===85&&r===80||s===73&&o===78&&r===86}function vt(i,e,t,n,s){let o=0,r=e,a=n;for(;r<t&&a<s;){let l=i.indexOf(et,r);(l===-1||l>t)&&(l=t);let h=i.indexOf(et,a);if((h===-1||h>s)&&(h=s),kt(i,a,h)){let c=ge(i,i[r]===45?r+1:r,l);c>o&&(o=c)}r=l+1,a=h+1}return o}var st=new TextDecoder;function tt(i,e){let t=-1,n=e.charCodeAt(0);for(let s=0,o=i.length;s<o;s++){let r=i[s];if(s===t+1&&r!==n)break;r===xe&&(t=s)}return i.subarray(0,t+1)}function St(i,e){let t=0;for(let n=0;n<e;n++){let s=i.indexOf(xe,t);if(s===-1){t=i.length;break}t=s+1}return st.decode(i.subarray(0,t)).split(/\r?\n/).slice(0,e)}function ge(i,e,t){let n=0;for(let s=e;s<t;s++){let o=i[s];if(o>=48&&o<=57)n=n*10+(o-48);else break}return n}function Pt(i,e,t,n,s,{start:o,end:r,pathCol:a,metaCharCode:l,decoder:h,callback:c}){let d=0,p=0;for(;d<i.length;){let m=i.indexOf(xe,d);if(m===-1)break;let f=d;d=m+1;let x=f+e+s;for(;p<n.length&&x>=n[p];)p++;if(i[f]===l)continue;let b=f;for(let g=1;g<a;g++){let C=i.indexOf(Me,b);if(C===-1||C>=m){b=m;break}b=C+1}let v=i[b];if(v!==gt&&v!==pt)continue;let y=i.indexOf(Me,b);(y===-1||y>m)&&(y=m);let I=1/0,u=-1,S=b;for(;S<y;){let g=0,C=S+1;for(;C<y;C++){let w=i[C]-48;if(w<0||w>9)break;g=g*10+w}g<I&&(I=g),g>u&&(u=g),S=C}if(I>=r)return!0;if(u>=o){let g=i[m-1]===nt?m-1:m;c(h.decode(i.subarray(f,g)),it(t,n,p,f+e,s),I,u+1)}}return!1}var W=class{filehandle;index;chunkCache;requested=new Map;headerCache=new z({});bgzfWorkerPool;constructor({path:e,filehandle:t,url:n,tbiPath:s,tbiUrl:o,tbiFilehandle:r,csiPath:a,csiUrl:l,csiFilehandle:h,chunkCacheSize:c=wt,chunkCacheIdleTimeoutMs:d=bt,chunkCacheBudget:p,bgzfWorkerPool:m}){this.bgzfWorkerPool=m,this.filehandle=Ct(t,e,n),this.index=yt({tbiFilehandle:r,csiFilehandle:h,tbiPath:s,csiPath:a,tbiUrl:o,csiUrl:l,path:e,url:n}),this.chunkCache=new z({maxSize:c,sizeOf:f=>{let x=0;for(let b of f.segments)x+=b.byteLength;return x},cacheKey:f=>f.toString(),idleTimeoutMs:d,budget:p,fill:(f,x)=>this.readChunk(f,{signal:x})})}clearChunkCache(){this.chunkCache.clear(),this.requested.clear()}withCachedContainers(e){if(this.requested.size>2*this.chunkCache.size)for(let[n,s]of this.requested)this.chunkCache.has(s)||this.requested.delete(n);let t=[];for(let n=0;n<e.length;n++){let s=e[n],o=t[t.length-1],r=e[n+1],a;if(!this.chunkCache.has(s))for(let l of this.requested.values())l.minv.compareTo(s.minv)<=0&&l.maxv.compareTo(s.maxv)>=0&&(!o||l.minv.compareTo(o.maxv)>=0)&&(!r||l.maxv.compareTo(r.minv)<=0)&&(!a||l.fetchedSize()<a.fetchedSize())&&this.chunkCache.has(l)&&(a=l);t.push(a??s)}return t}async bytesForRegions(e,t={}){let n=[];for(let{refName:o,start:r,end:a}of e){let l=await this.index.blocksForRange(o,r,a,t);for(let h of l)n.push(h)}let s=0;for(let o of le(n))s+=o.fetchedSize();return s}async getLines(e,t,n,s){let o,r={},a,l;typeof s=="function"?a=s:(r=s,a=s.lineCallback,o=s.signal,l=s.onProgress);let h=await this.index.getMetadata(r),c=t??0,d=n??h.maxRefLength;if(c>d)throw new TypeError("invalid start and end coordinates. start must be less than or equal to end");if(c===d)return;let p=await this.index.blocksForRange(e,c,d,r),m=this.withCachedContainers(p),f=h.format==="VCF",x=h.columnNumbers.ref||0,b=h.columnNumbers.start||0,v=f?8:h.columnNumbers.end||0,y=Math.max(x,b,v),I=h.metaChar?.charCodeAt(0),u=h.coordinateType==="1-based-closed"?-1:0,S=new TextEncoder,g=new TextDecoder,C=S.encode(e),w=new Int32Array(y+1),F=h.format==="GAF"?{start:c,end:d,pathCol:b,metaCharCode:I,decoder:g,callback:a}:void 0,k=0;for(let E of m)k+=E.fetchedSize();let R=0;l?.(0,k);let T=1,_=[],U=E=>{for(;_.length<Math.min(E,m.length);){let K=m[_.length];this.requested.set(K.toString(),K);let j=this.chunkCache.get(K,o);j.catch(()=>{}),_.push(j)}};U(1);for(let E=0,K=m.length;E<K;E++){let j=m[E],Be=await _[E],{cpositions:Z,dpositions:V}=Be;R+=j.fetchedSize(),l?.(R,k);let we=j.minv.dataPosition,be=p[E],ee=Be.segments,te=0;if(be!==j){te=Pe(Z,V,be.minv);let P=Pe(Z,V,be.maxv)+1;ee=Ye(ee,te,P)}if(F){if(Se(ee,te,(P,ne)=>Pt(P,ne,Z,V,we,F)))return}else if(Se(ee,te,(P,ne)=>{let M=0,ie=0;for(;M<P.length;){let B=P.indexOf(xe,M);if(B===-1)break;let rt=M+ne+we;for(;ie<V.length&&rt>=V[ie];)ie++;if(I!==void 0&&P[M]===I){M=B+1;continue}w[0]=M-1;for(let N=0;N<y;N++){let oe=w[N],Ce=oe<B?P.indexOf(Me,oe+1):-1;w[N+1]=Ce===-1||Ce>=B?B:Ce}let Ne=w[x-1]+1,Re=w[x]-Ne;if(Re!==C.length){M=B+1;continue}let Ee=!0;for(let N=0;N<Re;N++)if(P[Ne+N]!==C[N]){Ee=!1;break}if(!Ee){M=B+1;continue}let se=ge(P,w[b-1]+1,w[b])+u;if(se>=d)return!0;let J;if(v===0||v===b?J=se+1:f?J=It(P,se,w[3]+1,w[4],w[v-1]+1,w[v],w[5]):J=ge(P,w[v-1]+1,w[v]),J>c){let N=P[B-1]===nt?B-1:B,oe=g.decode(P.subarray(M,N));a(oe,it(Z,V,ie,M+ne,we),se,J)}M=B+1}return!1}))return;T=Math.min(T*2,xt),U(E+1+T)}}async getMetadata(e={}){return this.index.getMetadata(e)}async readHeaderBytes(e){let{firstDataLine:t,maxBlockSize:n}=await this.getMetadata(e);if(t?.blockPosition===0&&t.dataPosition===0)return new Uint8Array(0);let s=(t?.blockPosition??0)+n,o=await this.filehandle.read(s,0,e);return ce(o)}async parseHeader(e){let{metaChar:t,skipLines:n=0}=await this.getMetadata(e),s=await this.readHeaderBytes(e);return{header:st.decode(t?tt(s,t):s),skippedLines:n>0?St(s,n):[]}}getParsedHeader(e={}){return this.headerCache.get("header",e.signal,t=>this.parseHeader({...e,signal:t}))}async getHeaderBuffer(e={}){let{metaChar:t}=await this.getMetadata(e),n=await this.readHeaderBytes(e);return t?tt(n,t):n}async getSkippedLines(e={}){let{skipLines:t=0}=await this.getMetadata(e);return t<=0?[]:(await this.getParsedHeader(e)).skippedLines}async getHeader(e={}){return(await this.getParsedHeader(e)).header}async getHeaderLines(e={}){let{header:t,skippedLines:n}=await this.getParsedHeader(e);return(t?t.split(/\r?\n/):n).filter(Boolean)}async getReferenceSequenceNames(e={}){return(await this.getMetadata(e)).refIdToName}async lineCount(e,t={}){return this.index.lineCount(e,t)}async readChunk(e,t={}){let n=await this.filehandle.read(e.fetchedSize(),e.minv.blockPosition,t);H(t.signal);let s=await this.bgzfWorkerPool;return qe(n,e,s)}};function Mn(i,e,t){let n=i.pluginManager;return new W({filehandle:ae(i.getConf(e),n),...Oe(i.getConf([...t,"location"]),i.getConf([...t,"indexType"]),n)})}function Bn(i){let e=i.getConf("walksIndex");return Tt(i.getConf("walksLocation"),Fe(e)?e:void 0,i.pluginManager)}function Tt(i,e,t){return $e.fromFilehandles({data:ae(i,t),directory:ae(e??Le(i,n=>`${n}.idx`),t)})}function Nn(i){return{names:e=>i.getReferenceSequenceNames(e),bytes:(e,t)=>Ve(i,e,t)}}function At(i){return`${i.assemblyName} ${i.refName} is not in this graph's index; a graph with PanSN names (GRCh38#0#chr1) needs ${i.assemblyName} mapped to its prefix in assemblyNameToPanSN`}var ot=class{constructor(e,t){this.source=e;this.adapter=t;this.lookup=je({setup:async e=>De(await this.source.names(e))})}async assemblyRefNames(e={}){let t=await this.source.names(e),n=re(this.adapter,e.assemblyName),s=t.filter(o=>ye(o,n)).map(o=>ze(o));return s.length>0?[...new Set(s)]:t}async resolve(e,t){let n=await this.lookup(t);return He(n,re(this.adapter,e.assemblyName),e.refName)}async resolveMapped(e,t){let n=await this.resolve(e,t);if(n===void 0&&e.assemblyName){let s=await this.source.names(t),o=re(this.adapter,e.assemblyName);if(s.length>0&&s.every(r=>r.includes("#"))&&!s.some(r=>ye(r,o)))throw new Error(At(e))}return n}async resolveForCut(e,t){let n=await this.resolveMapped(e,t);if(n===void 0)throw new Error(`This graph has nothing on ${e.assemblyName} ${e.refName}`);return n}async regionBytes(e,t={}){let n=[];for(let s of e){let o=await this.resolve(s,t);o!==void 0&&n.push({refName:o,start:s.start,end:s.end})}return this.source.bytes(n,t)}};export{Mt as a,je as b,Et as c,Mn as d,Bn as e,Tt as f,Nn as g,ot as h};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{f as Y,g as X,h as De,i as He,j as Ie,k as ce,l as qe,n as $e}from"./chunk-KGAZZNZC.js";import{a as ae,b as Oe}from"./chunk-D6TY2QEG.js";import{e as Fe,j as Le}from"./chunk-EGZZ3ADM.js";import{d as ze,g as ye,h as re}from"./chunk-DAIBR3K3.js";var D=JBrowseExports["@jbrowse/core/data_adapters/BaseAdapter"],Ue=i=>D!=null&&i in Object(D)?D[i]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+i+"' from '@jbrowse/core/data_adapters/BaseAdapter' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:i});var Mt=Ue("BaseFeatureDataAdapter");var je=Ue("cachedSetup");var Bt=D&&D.__esModule?D.default:D;async function Et(i,e,t,n,s){return Ie(e,t,n),i.getLines(e,t,n,s)}async function Ve(i,e,t){for(let{refName:n,start:s,end:o}of e)Ie(n,s,o);return i.bytesForRegions(e,t)}function H(i){if(i?.aborted)throw ke(i)}function ke(i){let e=i.reason;return e===void 0?new DOMException("This operation was aborted","AbortError"):e}function Ge(i){return typeof i?.addEventListener=="function"}var z=class{entries=new Map;total=0;settledCount=0;limit;shared;fill;sizeOf;toCacheKey;idleTimeoutMs;sweepTimer;constructor({fill:e,maxSize:t=1/0,sizeOf:n=()=>1,cacheKey:s=a=>String(a),idleTimeoutMs:o=0,budget:r}={}){this.fill=e,this.limit=t,this.shared=r&&{budget:r,membership:r.register(this)},this.sizeOf=n,this.toCacheKey=s,this.idleTimeoutMs=o>0&&Number.isFinite(o)?o:void 0}get size(){return this.entries.size}get totalSize(){return this.total}get maxSize(){return this.limit}set maxSize(e){this.limit=e,this.evict()}waiterCount(e){return this.entries.get(this.toCacheKey(e))?.pending?.signals.size??0}async get(e,t,n){H(t);let s=this.toCacheKey(e),o=this.entries.get(s);o&&this.isDoomed(o)&&(this.release(s),o=void 0),o?this.touch(s,o):o=this.start(s,e,n),o.pending&&this.join(o.pending,t);try{return await this.settleFor(o,t)}finally{H(t)}}settleFor(e,t){if(!e.pending||!Ge(t))return e.promise;let n,s=new Promise((r,a)=>{n=a}),o=()=>{n(ke(t))};return t.addEventListener("abort",o,{once:!0}),Promise.race([e.promise,s]).finally(()=>{t.removeEventListener("abort",o)})}getIfCached(e){let t=this.toCacheKey(e),n=this.entries.get(t);if(n){if(this.isDoomed(n)){this.release(t);return}return this.touch(t,n),n.promise}}has(e){let t=this.entries.get(this.toCacheKey(e));return t!==void 0&&!this.isDoomed(t)}delete(e){this.release(this.toCacheKey(e))}clear(){this.entries.clear(),this.shared?.budget.charge(this.shared.membership,-this.total),this.total=0,this.settledCount=0,this.stopSweep()}touch(e,t){this.entries.delete(e),this.entries.set(e,t),t.lastTouched=Date.now(),t.seq=this.stamp()}stamp(){return this.shared?.budget.nextSeq()??0}isDoomed(e){return e.pending?.controller.signal.aborted===!0}sweepIdle(){let e=this.idleTimeoutMs;if(e===void 0)return;let t=Date.now()-e;for(let[n,s]of this.entries)!s.pending&&s.lastTouched<=t&&this.release(n);this.settledCount===0&&this.stopSweep()}startSweep(){let e=this.idleTimeoutMs;if(e===void 0||this.sweepTimer!==void 0)return;let t=Math.min(2**31-1,Math.max(1e3,Math.floor(e/4))),n=new WeakRef(this),s=setInterval(()=>{let o=n.deref();o?o.sweepIdle():clearInterval(s)},t);this.sweepTimer=s,s.unref?.()}stopSweep(){this.sweepTimer!==void 0&&(clearInterval(this.sweepTimer),this.sweepTimer=void 0)}start(e,t,n){let s=n??(this.fill&&(h=>this.fill(t,h)));if(!s)throw new Error("SharedReadCache needs a fill, either on the cache or on the get() call");let o={signals:new Map,pinned:!1,controller:new AbortController},r={promise:Promise.resolve(s(o.controller.signal)),pending:o,size:0,lastTouched:Date.now(),seq:this.stamp()};this.entries.set(e,r);let a=()=>this.entries.get(e)===r,l=()=>{for(let[h,c]of o.signals)h.removeEventListener("abort",c);r.pending=void 0};return r.promise.then(h=>{let c=a()?this.weigh(h):void 0,d=a();l(),d&&(c===void 0?this.entries.delete(e):(r.lastTouched=Date.now(),r.size=c,this.settledCount++,this.total+=c,this.shared?.budget.charge(this.shared.membership,c),this.startSweep())),this.evict(),this.shared?.budget.evict()},()=>{a()&&this.release(e),l()}),r}weigh(e){try{let t=this.sizeOf(e);return Number.isFinite(t)&&t>=0?t:void 0}catch{return}}join(e,t){if(!Ge(t))e.pinned=!0;else if(!t.aborted&&!e.signals.has(t)){let n=()=>{e.signals.delete(t),!e.pinned&&e.signals.size===0&&e.controller.abort(t.reason)};e.signals.set(t,n),t.addEventListener("abort",n,{once:!0})}}release(e){let t=this.entries.get(e);t&&(this.entries.delete(e),t.pending||this.settledCount--,this.total-=t.size,this.shared?.budget.charge(this.shared.membership,-t.size))}lruSpare(e=!1){if(!(this.settledCount<=(e?0:1))){for(let[t,n]of this.entries)if(!n.pending)return{cacheKey:t,seq:n.seq,last:this.settledCount===1}}}evict(){if(!(this.total<=this.limit))for(let[e,t]of this.entries){if(this.total<=this.limit||this.settledCount<=1)break;t.pending||this.release(e)}}};var A=class{minv;maxv;bin;endPosition;constructor(e,t,n,s=t.blockPosition+65536){this.minv=e,this.maxv=t,this.bin=n,this.endPosition=s}toString(){return`${this.minv.toString()}..${this.maxv.toString()} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`}fetchedSize(){return this.endPosition-this.minv.blockPosition}};function ve(i,e){if(!(e>0))throw new TypeError(`\`${i}\` must be a number greater than 0`)}var Q=class{#e=new Map;#t=new Map;#n;#s;#o;constructor(e){let t=e.maxAge??Number.POSITIVE_INFINITY;ve("maxSize",e.maxSize),ve("maxAge",t),this.#n=e.maxSize,this.#s=t,this.#o=e.onEviction}#r(e){let t=this.#o;if(t)for(let[n,s]of e)t(n,s.value)}#i(e,t){return t.expiry!==void 0&&t.expiry<=Date.now()?(this.#o?.(e,t.value),this.delete(e),!0):!1}#c(e,t){return this.#i(e,t)?void 0:t.value}#l(e,t){if(this.#t.delete(e),this.#e.set(e,t),this.#e.size>=this.#n){let n=this.#t;this.#t=this.#e,this.#e=new Map,this.#r(n)}}#h(e){this.#t=new Map(e),this.#e=new Map}*#a(){for(let e of[this.#t,this.#e])for(let t of e)this.#i(...t)||(yield t)}get(e){let t=this.#e.get(e);if(t)return this.#c(e,t);let n=this.#t.get(e);if(n&&!this.#i(e,n))return this.#l(e,n),n.value}set(e,t,{maxAge:n=this.#s}={}){let s={value:t,expiry:n===Number.POSITIVE_INFINITY?void 0:Date.now()+n};return this.#e.has(e)?this.#e.set(e,s):this.#l(e,s),this}has(e){let t=this.#e.get(e)??this.#t.get(e);return t!==void 0&&!this.#i(e,t)}peek(e){let t=this.#e.get(e)??this.#t.get(e);return t?this.#c(e,t):void 0}expiresIn(e){let t=this.#e.get(e)??this.#t.get(e);if(t)return t.expiry===void 0?Number.POSITIVE_INFINITY:t.expiry-Date.now()}delete(e){return this.#e.delete(e)||this.#t.delete(e)}clear(){this.#e.clear(),this.#t.clear()}resize(e){ve("maxSize",e);let t=[...this.#a()],n=t.length-e;n<0?(this.#e=new Map(t),this.#t=new Map):(this.#r(t.slice(0,n)),this.#h(t.slice(n))),this.#n=e}evict(e=1){if(!(e>0))return;let t=[...this.#a()],n=Math.trunc(Math.min(e,t.length-1));n>0&&(this.#r(t.slice(0,n)),this.#h(t.slice(n)))}get size(){return Math.min(this.#e.size+this.#t.size,this.#n)}get maxSize(){return this.#n}get maxAge(){return this.#s}*entriesAscending(){for(let[e,t]of this.#a())yield[e,t.value]}*entriesDescending(){for(let e of[this.#e,this.#t])for(let[t,n]of[...e].reverse())this.#i(t,n)||(yield[t,n.value])}entries(){return this.entriesAscending()}[Symbol.iterator](){return this.entriesAscending()}*keys(){for(let[e]of this)yield e}*values(){for(let[,e]of this)yield e}forEach(e,t=this){for(let[n,s]of this)e.call(t,s,n,this)}get[Symbol.toStringTag](){return"QuickLRU"}toString(){return`QuickLRU(${this.size}/${this.maxSize})`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}};function We(i,e=0){let t=i[e]|i[e+1]<<8|i[e+2]<<16|i[e+3]<<24;return((i[e+4]|i[e+5]<<8|i[e+6]<<16|i[e+7]<<24)>>>0)*4294967296+(t>>>0)}var G=class{blockPosition;dataPosition;constructor(e,t){this.blockPosition=e,this.dataPosition=t}toString(){return`${this.blockPosition}:${this.dataPosition}`}compareTo(e){return this.blockPosition-e.blockPosition||this.dataPosition-e.dataPosition}};function O(i,e=0){return new G(i[e+7]*1099511627776+i[e+6]*4294967296+i[e+5]*16777216+i[e+4]*65536+i[e+3]*256+i[e+2],i[e+1]<<8|i[e])}function le(i,e){let t=i.length;if(t===0)return i;let n;if(e){let a=e.blockPosition,l=e.dataPosition;n=[];for(let h=0;h<t;h++){let c=i[h];(c.maxv.blockPosition-a||c.maxv.dataPosition-l)>0&&n.push(c)}if(n.length===0)return n}else n=i;n.sort((a,l)=>{let h=a.minv.blockPosition-l.minv.blockPosition;return h===0?a.minv.dataPosition-l.minv.dataPosition:h});let s=[n[0]],o=n[0].minv.blockPosition,r=n[0].maxv.blockPosition;for(let a=1;a<n.length;a++){let l=n[a],h=l.minv.blockPosition,c=l.maxv.blockPosition;if(h-r<65e3&&c-o<5e6){let d=s.at(-1);(c-r||l.maxv.dataPosition-d.maxv.dataPosition)>0&&(s[s.length-1]=new A(d.minv,l.maxv,d.bin,l.endPosition),r=c)}else s.push(l),o=h,r=c}return at(s)}function at(i){let e=[i[0]];for(let t=1;t<i.length;t++){let n=i[t],s=e.at(-1).maxv;if((n.minv.blockPosition-s.blockPosition||n.minv.dataPosition-s.dataPosition)>=0){e.push(n);continue}(n.maxv.blockPosition-s.blockPosition||n.maxv.dataPosition-s.dataPosition)>0&&e.push(new A(s,n.maxv,n.bin,n.endPosition))}return e}function he(i,e=[]){let t=[...e];for(let n of i)t.push(n.minv.blockPosition,n.maxv.blockPosition);t.sort((n,s)=>n-s);for(let n of i){let s=n.maxv.blockPosition,o=0,r=t.length;for(;o<r;){let a=o+r>>>1;t[a]>s?r=a:o=a+1}o<t.length&&(n.endPosition=Math.min(n.endPosition,t[o]))}}function de(i,e,t,n,s=8){let o=n?n.blockPosition:1/0,r=n?n.dataPosition:0,a=!1;for(let l=0;l<t;l++){let h=e+l*s,c=i[h+7]*1099511627776+i[h+6]*4294967296+i[h+5]*16777216+i[h+4]*65536+i[h+3]*256+i[h+2],d=i[h+1]<<8|i[h];(c<o||c===o&&d<r)&&(o=c,r=d,a=!0)}return a?new G(o,r):n}function ct(i){let e=new TextDecoder("utf-8"),t=[],n={},s=0,o=0;for(;o<i.length;){let r=i.indexOf(0,o);if(r===-1)break;if(r>o){let a=e.decode(i.subarray(o,r));t[s]=a,n[a]=s}o=r+1,s++}return{refNameToId:n,refIdToName:t}}var lt={0:"generic",1:"SAM",2:"VCF",3:"GAF"};function fe(i,e){let t=new DataView(i.buffer,i.byteOffset,i.byteLength),n=t.getInt32(e,!0),s=n&65536?"zero-based-half-open":"1-based-closed",o=lt[n&15];if(!o)throw new Error(`invalid Tabix preset format flags ${n}`);let r={ref:t.getInt32(e+4,!0),start:t.getInt32(e+8,!0),end:t.getInt32(e+12,!0)},a=t.getInt32(e+16,!0),l=a?String.fromCharCode(a):void 0,h=t.getInt32(e+20,!0),c=t.getInt32(e+24,!0),{refIdToName:d,refNameToId:p}=ct(i.subarray(e+28,e+28+c));return{refIdToName:d,refNameToId:p,skipLines:h,metaChar:l,columnNumbers:r,format:o,coordinateType:s}}function ue(i,e){return{lineCount:We(i,e)}}function me(i,e=5){let t=new Q({maxSize:e});return n=>{let s=t.get(n);if(s!==void 0)return s;let o=i(n);return o!==void 0&&t.set(n,o),o}}function Ke(i){let e=0;for(let s of i)e+=s.length;let t=new Uint8Array(e),n=0;for(let s of i)t.set(s,n),n+=s.length;return t}var Je=10;function Se(i,e,t){let n,s=0;for(let o of i){let r=0;if(n){let h=o.indexOf(Je);if(h===-1){n=Ke([n,o]),e+=o.length;continue}if(t(Ke([n,o.subarray(0,h+1)]),s))return!0;r=h+1,n=void 0}let a=o.lastIndexOf(Je);if(a>=r&&t(o.subarray(r,a+1),e+r))return!0;let l=Math.max(r,a+1);l<o.length&&(n=o.slice(l),s=e+l),e+=o.length}return!1}function Ye(i,e,t){let n=[],s=0;for(let o of i){let r=Math.max(e-s,0),a=Math.min(t-s,o.length);r<a&&n.push(o.subarray(r,a)),s+=o.length}return n}function Pe(i,e,t){let n=0,s=i.length-1;for(;n<s;){let r=n+s+1>>>1;i[r]<=t.blockPosition?n=r:s=r-1}return(n===0?0:e[n])-e[0]+t.dataPosition}function ht(i,e,t,n){if(e>2**(t+n*3))return;let s=(8**(n+1)-1)/7,o=(8**n-1)/7+Math.floor((e-1)/2**t)+1;for(o>=s&&(o=0);;){for(;o%8===1;)o=(o-1)/8;if(o===0)return;let r=i[o];if(r?.length){let a=r[0].minv;for(let l=1;l<r.length;l++){let h=r[l].minv;h.compareTo(a)<0&&(a=h)}return a}o++}}function Xe(i,e){return i.format==="GAF"?0:i.refNameToId[e]}var q=class{filehandle;parseCache=new z({});constructor({filehandle:e}){this.filehandle=e}async readIndexBytes(e){let t=await this.filehandle.readFile({signal:e.signal,onProgress:e.onProgress}),n=await ce(t);return{bytes:n,dataView:new DataView(n.buffer,n.byteOffset,n.byteLength)}}async lineCount(e,t={}){let n=await this.parse(t),s=Xe(n,e);return s===void 0?-1:n.indices(s)?.stats?.lineCount??-1}async getMetadata(e={}){let{indices:t,...n}=await this.parse(e);return n}async blocksForRange(e,t,n,s={}){let o=await this.parse(s),r=Xe(o,e);if(r===void 0)return[];let a=o.indices(r);if(!a)return[];o.format==="GAF"&&(t=Math.max(t-1,0));let l=[];for(let[m,f]of this.reg2bins(t,n,o))for(let x=m;x<=f;x++){let b=a.binIndex[x];if(b)for(let v of b)l.push(v)}let h=this.lowestOffset(a,t,o),c=le(l,h),d=ht(a.binIndex,n,o.minShift,o.depth);if(d){let m=c.length;for(;m>0&&c[m-1].minv.compareTo(d)>=0;)m--;c.length=m}let p=c[0];if(p&&h){let m=2**(o.minShift+3),f=this.lowestOffset(a,Math.floor(t/m)*m,o),x=f&&f.compareTo(h)<0?f:h;p.minv.compareTo(x)<0&&(c[0]=new A(x,p.maxv,p.bin,p.endPosition))}return c}parse(e={}){return this.parseCache.get("index",e.signal,t=>this._parse({...e,signal:t}))}async hasRefSeq(e,t={}){return!!(await this.parse(t)).indices(e)?.binIndex}};var dt=21582659,ft=38359875;function Qe(i,e){return i*2**e}function Te(i,e){return Math.floor(i/2**e)}var $=class extends q{async _parse(e={}){let{bytes:t,dataView:n}=await this.readIndexBytes(e),s=n.getUint32(0,!0),o;if(s===dt)o=1;else if(s===ft)o=2;else throw new Error(`Not a CSI file (magic=${s})`);let r=n.getInt32(4,!0),a=n.getInt32(8,!0),l=(8**(a+1)-1)/7,h=2**(r+a*3),c=n.getInt32(12,!0),d=c>=28&&(n.getInt32(16,!0)&15)===3;if(c<30&&!d)throw new Error("CSI index has no tabix header, so it names no references; it may be a BAM or BCF index");let p=fe(t,16),m=n.getInt32(16+c,!0),f=16+c+4,x,b=[];for(let y=0;y<m;y++){b.push(f);let I=n.getInt32(f,!0);f+=4;for(let u=0;u<I;u++){let S=n.getUint32(f,!0);if(f+=4,S>l)f+=44;else{x=de(t,f,1,x),f+=8;let g=n.getInt32(f,!0);f+=4+16*g}}}function v(y){let I=b[y];if(I===void 0)return;let u=I,S=n.getInt32(u,!0);u+=4;let g={},C={},w;for(let F=0;F<S;F++){let k=n.getUint32(u,!0);if(u+=4,k>l)w=ue(t,u+28),u+=44;else{C[k]=O(t,u),u+=8;let R=n.getInt32(u,!0);u+=4;let T=Array.from({length:R});for(let _=0;_<R;_++)T[_]=new A(O(t,u),O(t,u+8),k),u+=16;g[k]=T}}return he(Object.values(g).flat()),{binIndex:g,loffsets:C,stats:w}}return{...p,csi:!0,refCount:m,maxBlockSize:65536,firstDataLine:x,csiVersion:o,indices:me(v),minShift:r,depth:a,maxBinNumber:l,maxRefLength:h}}lowestOffset(e,t,{minShift:n,depth:s}){let{loffsets:o}=e,r;if(o){let a=(Qe(1,3*s)-1)/7+Te(Math.max(t,0),n);for(;r===void 0&&a>0;)if(r=o[a],r===void 0){let l=Math.floor((a-1)/8),h=l*8+1;a=a>h?a-1:l}r??=o[0]}return r}reg2bins(e,t,{minShift:n,depth:s,maxBinNumber:o}){e=Math.max(e,0);let r=2**(n+s*3);t>r&&(t=r),t-=1;let a=0,l=0,h=n+s*3,c=[];for(;a<=s;h-=3,l+=Qe(1,a*3),a+=1){let d=l+Te(e,h),p=l+Te(t,h);if(p-d+c.length>o)throw new Error(`query ${e}-${t} is too large for current binning scheme (shift ${n}, depth ${s}), try a smaller query or a coarser index binning scheme`);c.push([d,p])}return c}};var ut=21578324,Ae=5,_e=14,pe=2**(_e+Ae*3);function Ze(i){return Math.min(Math.max(i,0),pe)}var L=class extends q{reg2bins(e,t){e>pe&&console.warn("querying outside of possible tabix range");let n=Ze(e),s=Math.min(t,pe)-1,o=[];return n<=s&&o.push([0,0],[1+(n>>26),1+(s>>26)],[9+(n>>23),9+(s>>23)],[73+(n>>20),73+(s>>20)],[585+(n>>17),585+(s>>17)],[4681+(n>>14),4681+(s>>14)]),o}lowestOffset(e,t){let n=e.linearIndex;return n?.[Math.min(Ze(t)>>_e,n.length-1)]}async _parse(e={}){let{bytes:t,dataView:n}=await this.readIndexBytes(e);if(n.getUint32(0,!0)!==ut)throw new Error("Not a TBI file");let s=n.getUint32(4,!0),o=((1<<(Ae+1)*3)-1)/7,{refNameToId:r,refIdToName:a,coordinateType:l,format:h,columnNumbers:c,metaChar:d,skipLines:p}=fe(t,8),f=36+n.getInt32(32,!0),x,b=[];for(let y=0;y<s;y++){b.push(f);let I=n.getInt32(f,!0);f+=4;for(let S=0;S<I;S++){let g=n.getUint32(f,!0);f+=4;let C=n.getInt32(f,!0);if(f+=4,g>o+1)throw new Error("tabix index contains too many bins, please use a CSI index");g<=o&&(x=de(t,f,C,x,16)),f+=16*C}let u=n.getInt32(f,!0);f+=4+8*u}function v(y){let I=b[y];if(I===void 0)return;let u=I,S=n.getInt32(u,!0);u+=4;let g={},C;for(let k=0;k<S;k++){let R=n.getUint32(u,!0);if(u+=4,R>o+1)throw new Error("tabix index contains too many bins, please use a CSI index");if(R===o+1){let T=n.getInt32(u,!0);u+=4,T===2&&(C=ue(t,u+16)),u+=16*T}else{let T=n.getInt32(u,!0);u+=4;let _=Array.from({length:T});for(let U=0;U<T;U++)_[U]=new A(O(t,u),O(t,u+8),R),u+=16;g[R]=_}}let w=n.getInt32(u,!0);u+=4;let F=Array.from({length:w});for(let k=0;k<w;k++)F[k]=O(t,u),u+=8;return he(Object.values(g).flat(),F.map(k=>k.blockPosition)),{binIndex:g,linearIndex:F,stats:C}}return{indices:me(v),metaChar:d,minShift:_e,depth:Ae,maxBinNumber:o,maxRefLength:pe,skipLines:p,firstDataLine:x,columnNumbers:c,coordinateType:l,format:h,refIdToName:a,refNameToId:r,maxBlockSize:65536}}};var Me=9,xe=10,nt=13,mt=59,pt=60,gt=62,xt=6,wt=1024*2**20,bt=180*1e3;function Ct(i,e,t){if(i)return i;if(e)return new X(e);if(t)return new Y(t);throw new TypeError("must provide either filehandle, path, or url")}function yt({tbiFilehandle:i,csiFilehandle:e,tbiPath:t,csiPath:n,tbiUrl:s,csiUrl:o,path:r,url:a}){if(i)return new L({filehandle:i});if(e)return new $({filehandle:e});if(t)return new L({filehandle:new X(t)});if(n)return new $({filehandle:new X(n)});if(o)return new $({filehandle:new Y(o)});if(s)return new L({filehandle:new Y(s)});if(r)return new L({filehandle:new X(`${r}.tbi`)});if(a)return new L({filehandle:new Y(`${a}.tbi`)});throw new TypeError("must provide one of tbiFilehandle, tbiPath, csiFilehandle, csiPath, tbiUrl, csiUrl")}function it(i,e,t,n,s){return i[t]*256+(n-e[t])+s+1}function It(i,e,t,n,s,o,r){let a=n-t,l=e+a,h=0;if(i[s]===46)return l;let c=s;for(let d=s;d<=o;d++)if(d===o||i[d]===mt){let p=d-c;if(p>=10&&i[c]===83&&i[c+1]===86&&i[c+2]===84&&i[c+3]===89&&i[c+4]===80&&i[c+5]===69&&i[c+6]===61&&i[c+7]===84&&i[c+8]===82&&i[c+9]===65)return e+1;if(p>=4&&i[c]===69&&i[c+1]===78&&i[c+2]===68&&i[c+3]===61){let m=ge(i,c+4,d);m>e&&(l=m)}else p>=6&&i[c]===83&&i[c+1]===86&&i[c+2]===76&&i[c+3]===69&&i[c+4]===78&&i[c+5]===61&&(h=vt(i,c+6,d,n+1,r));c=d+1}return Math.max(l,e+h)}var et=44;function kt(i,e,t){if(t-e<5||i[e]!==60||i[t-1]!==62)return!1;let n=i[e+4];if(n!==62&&n!==58)return!1;let s=i[e+1],o=i[e+2],r=i[e+3];return s===67&&o===78&&r===86||s===68&&o===69&&r===76||s===68&&o===85&&r===80||s===73&&o===78&&r===86}function vt(i,e,t,n,s){let o=0,r=e,a=n;for(;r<t&&a<s;){let l=i.indexOf(et,r);(l===-1||l>t)&&(l=t);let h=i.indexOf(et,a);if((h===-1||h>s)&&(h=s),kt(i,a,h)){let c=ge(i,i[r]===45?r+1:r,l);c>o&&(o=c)}r=l+1,a=h+1}return o}var st=new TextDecoder;function tt(i,e){let t=-1,n=e.charCodeAt(0);for(let s=0,o=i.length;s<o;s++){let r=i[s];if(s===t+1&&r!==n)break;r===xe&&(t=s)}return i.subarray(0,t+1)}function St(i,e){let t=0;for(let n=0;n<e;n++){let s=i.indexOf(xe,t);if(s===-1){t=i.length;break}t=s+1}return st.decode(i.subarray(0,t)).split(/\r?\n/).slice(0,e)}function ge(i,e,t){let n=0;for(let s=e;s<t;s++){let o=i[s];if(o>=48&&o<=57)n=n*10+(o-48);else break}return n}function Pt(i,e,t,n,s,{start:o,end:r,pathCol:a,metaCharCode:l,decoder:h,callback:c}){let d=0,p=0;for(;d<i.length;){let m=i.indexOf(xe,d);if(m===-1)break;let f=d;d=m+1;let x=f+e+s;for(;p<n.length&&x>=n[p];)p++;if(i[f]===l)continue;let b=f;for(let g=1;g<a;g++){let C=i.indexOf(Me,b);if(C===-1||C>=m){b=m;break}b=C+1}let v=i[b];if(v!==gt&&v!==pt)continue;let y=i.indexOf(Me,b);(y===-1||y>m)&&(y=m);let I=1/0,u=-1,S=b;for(;S<y;){let g=0,C=S+1;for(;C<y;C++){let w=i[C]-48;if(w<0||w>9)break;g=g*10+w}g<I&&(I=g),g>u&&(u=g),S=C}if(I>=r)return!0;if(u>=o){let g=i[m-1]===nt?m-1:m;c(h.decode(i.subarray(f,g)),it(t,n,p,f+e,s),I,u+1)}}return!1}var W=class{filehandle;index;chunkCache;requested=new Map;headerCache=new z({});bgzfWorkerPool;constructor({path:e,filehandle:t,url:n,tbiPath:s,tbiUrl:o,tbiFilehandle:r,csiPath:a,csiUrl:l,csiFilehandle:h,chunkCacheSize:c=wt,chunkCacheIdleTimeoutMs:d=bt,chunkCacheBudget:p,bgzfWorkerPool:m}){this.bgzfWorkerPool=m,this.filehandle=Ct(t,e,n),this.index=yt({tbiFilehandle:r,csiFilehandle:h,tbiPath:s,csiPath:a,tbiUrl:o,csiUrl:l,path:e,url:n}),this.chunkCache=new z({maxSize:c,sizeOf:f=>{let x=0;for(let b of f.segments)x+=b.byteLength;return x},cacheKey:f=>f.toString(),idleTimeoutMs:d,budget:p,fill:(f,x)=>this.readChunk(f,{signal:x})})}clearChunkCache(){this.chunkCache.clear(),this.requested.clear()}withCachedContainers(e){if(this.requested.size>2*this.chunkCache.size)for(let[n,s]of this.requested)this.chunkCache.has(s)||this.requested.delete(n);let t=[];for(let n=0;n<e.length;n++){let s=e[n],o=t[t.length-1],r=e[n+1],a;if(!this.chunkCache.has(s))for(let l of this.requested.values())l.minv.compareTo(s.minv)<=0&&l.maxv.compareTo(s.maxv)>=0&&(!o||l.minv.compareTo(o.maxv)>=0)&&(!r||l.maxv.compareTo(r.minv)<=0)&&(!a||l.fetchedSize()<a.fetchedSize())&&this.chunkCache.has(l)&&(a=l);t.push(a??s)}return t}async bytesForRegions(e,t={}){let n=[];for(let{refName:o,start:r,end:a}of e){let l=await this.index.blocksForRange(o,r,a,t);for(let h of l)n.push(h)}let s=0;for(let o of le(n))s+=o.fetchedSize();return s}async getLines(e,t,n,s){let o,r={},a,l;typeof s=="function"?a=s:(r=s,a=s.lineCallback,o=s.signal,l=s.onProgress);let h=await this.index.getMetadata(r),c=t??0,d=n??h.maxRefLength;if(c>d)throw new TypeError("invalid start and end coordinates. start must be less than or equal to end");if(c===d)return;let p=await this.index.blocksForRange(e,c,d,r),m=this.withCachedContainers(p),f=h.format==="VCF",x=h.columnNumbers.ref||0,b=h.columnNumbers.start||0,v=f?8:h.columnNumbers.end||0,y=Math.max(x,b,v),I=h.metaChar?.charCodeAt(0),u=h.coordinateType==="1-based-closed"?-1:0,S=new TextEncoder,g=new TextDecoder,C=S.encode(e),w=new Int32Array(y+1),F=h.format==="GAF"?{start:c,end:d,pathCol:b,metaCharCode:I,decoder:g,callback:a}:void 0,k=0;for(let E of m)k+=E.fetchedSize();let R=0;l?.(0,k);let T=1,_=[],U=E=>{for(;_.length<Math.min(E,m.length);){let K=m[_.length];this.requested.set(K.toString(),K);let j=this.chunkCache.get(K,o);j.catch(()=>{}),_.push(j)}};U(1);for(let E=0,K=m.length;E<K;E++){let j=m[E],Be=await _[E],{cpositions:Z,dpositions:V}=Be;R+=j.fetchedSize(),l?.(R,k);let we=j.minv.dataPosition,be=p[E],ee=Be.segments,te=0;if(be!==j){te=Pe(Z,V,be.minv);let P=Pe(Z,V,be.maxv)+1;ee=Ye(ee,te,P)}if(F){if(Se(ee,te,(P,ne)=>Pt(P,ne,Z,V,we,F)))return}else if(Se(ee,te,(P,ne)=>{let M=0,ie=0;for(;M<P.length;){let B=P.indexOf(xe,M);if(B===-1)break;let rt=M+ne+we;for(;ie<V.length&&rt>=V[ie];)ie++;if(I!==void 0&&P[M]===I){M=B+1;continue}w[0]=M-1;for(let N=0;N<y;N++){let oe=w[N],Ce=oe<B?P.indexOf(Me,oe+1):-1;w[N+1]=Ce===-1||Ce>=B?B:Ce}let Ne=w[x-1]+1,Re=w[x]-Ne;if(Re!==C.length){M=B+1;continue}let Ee=!0;for(let N=0;N<Re;N++)if(P[Ne+N]!==C[N]){Ee=!1;break}if(!Ee){M=B+1;continue}let se=ge(P,w[b-1]+1,w[b])+u;if(se>=d)return!0;let J;if(v===0||v===b?J=se+1:f?J=It(P,se,w[3]+1,w[4],w[v-1]+1,w[v],w[5]):J=ge(P,w[v-1]+1,w[v]),J>c){let N=P[B-1]===nt?B-1:B,oe=g.decode(P.subarray(M,N));a(oe,it(Z,V,ie,M+ne,we),se,J)}M=B+1}return!1}))return;T=Math.min(T*2,xt),U(E+1+T)}}async getMetadata(e={}){return this.index.getMetadata(e)}async readHeaderBytes(e){let{firstDataLine:t,maxBlockSize:n}=await this.getMetadata(e);if(t?.blockPosition===0&&t.dataPosition===0)return new Uint8Array(0);let s=(t?.blockPosition??0)+n,o=await this.filehandle.read(s,0,e);return ce(o)}async parseHeader(e){let{metaChar:t,skipLines:n=0}=await this.getMetadata(e),s=await this.readHeaderBytes(e);return{header:st.decode(t?tt(s,t):s),skippedLines:n>0?St(s,n):[]}}getParsedHeader(e={}){return this.headerCache.get("header",e.signal,t=>this.parseHeader({...e,signal:t}))}async getHeaderBuffer(e={}){let{metaChar:t}=await this.getMetadata(e),n=await this.readHeaderBytes(e);return t?tt(n,t):n}async getSkippedLines(e={}){let{skipLines:t=0}=await this.getMetadata(e);return t<=0?[]:(await this.getParsedHeader(e)).skippedLines}async getHeader(e={}){return(await this.getParsedHeader(e)).header}async getHeaderLines(e={}){let{header:t,skippedLines:n}=await this.getParsedHeader(e);return(t?t.split(/\r?\n/):n).filter(Boolean)}async getReferenceSequenceNames(e={}){return(await this.getMetadata(e)).refIdToName}async lineCount(e,t={}){return this.index.lineCount(e,t)}async readChunk(e,t={}){let n=await this.filehandle.read(e.fetchedSize(),e.minv.blockPosition,t);H(t.signal);let s=await this.bgzfWorkerPool;return qe(n,e,s)}};function Mn(i,e,t){let n=i.pluginManager;return new W({filehandle:ae(i.getConf(e),n),...Oe(i.getConf([...t,"location"]),i.getConf([...t,"indexType"]),n)})}function Bn(i){let e=i.getConf("walksIndex");return Tt(i.getConf("walksLocation"),Fe(e)?e:void 0,i.pluginManager)}function Tt(i,e,t){return $e.fromFilehandles({data:ae(i,t),directory:ae(e??Le(i,n=>`${n}.idx`),t)})}function Nn(i){return{names:e=>i.getReferenceSequenceNames(e),bytes:(e,t)=>Ve(i,e,t)}}function At(i){return`${i.assemblyName} ${i.refName} is not in this graph's index; a graph with PanSN names (GRCh38#0#chr1) needs ${i.assemblyName} mapped to its prefix in assemblyNameToPanSN`}var ot=class{constructor(e,t){this.source=e;this.adapter=t;this.lookup=je({setup:async e=>De(await this.source.names(e))})}async assemblyRefNames(e={}){let t=await this.source.names(e),n=re(this.adapter,e.assemblyName),s=t.filter(o=>ye(o,n)).map(o=>ze(o));return s.length>0?[...new Set(s)]:t}async resolve(e,t){let n=await this.lookup(t);return He(n,re(this.adapter,e.assemblyName),e.refName)}async resolveMapped(e,t){let n=await this.resolve(e,t);if(n===void 0&&e.assemblyName){let s=await this.source.names(t),o=re(this.adapter,e.assemblyName);if(s.length>0&&s.every(r=>r.includes("#"))&&!s.some(r=>ye(r,o)))throw new Error(At(e))}return n}async resolveForCut(e,t){let n=await this.resolveMapped(e,t);if(n===void 0)throw new Error(`This graph has nothing on ${e.assemblyName} ${e.refName}`);return n}async regionBytes(e,t={}){let n=[];for(let s of e){let o=await this.resolve(s,t);o!==void 0&&n.push({refName:o,start:s.start,end:s.end})}return this.source.bytes(n,t)}};export{Mt as a,je as b,Et as c,Mn as d,Bn as e,Tt as f,Nn as g,ot as h};
|
|
2
|
+
//# sourceMappingURL=chunk-XZ4HLR4N.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{B as Z,F as q,G as C,d as W,e as j,i as z,j as F,l as O,m as _,n as X,o as I,p as $,r as J,s as K,u as N,v as Y,x as V,z as U}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=renderSvg-
|
|
1
|
+
import{B as Z,F as q,G as C,d as W,e as j,i as z,j as F,l as O,m as _,n as X,o as I,p as $,r as J,s as K,u as N,v as Y,x as V,z as U}from"./chunk-D7OYDVIT.js";import{Hb as D,Sb as S,Tb as R,_b as E,ac as H}from"./chunk-FQ5DWNNX.js";import"./chunk-F3NT4VYA.js";import"./chunk-2LE4HMDX.js";import{H as b}from"./chunk-XO54F7NK.js";import"./chunk-OA3GUDDC.js";import"./chunk-5FHTS7YG.js";import"./chunk-3PVSP3VV.js";import"./chunk-USYII6RS.js";import"./chunk-UBN7IANP.js";import"./chunk-WKD7ALOU.js";import"./chunk-YBLNN5FU.js";import"./chunk-EGZZ3ADM.js";import"./chunk-DAIBR3K3.js";import"./chunk-J2PN6CG3.js";import{a as k,b as e,c as u}from"./chunk-DUU6T2I5.js";var m=JBrowseExports["@jbrowse/display-kit/renderDisplaySvg"],it=t=>m!=null&&t in Object(m)?m[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/display-kit/renderDisplaySvg' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t});var Q=it("renderDisplaySvg");var ft=m&&m.__esModule?m.default:m;var w=JBrowseExports["@jbrowse/core/util/paintLayer"],ot=t=>w!=null&&t in Object(w)?w[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/core/util/paintLayer' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t}),L=ot("PaintLayer"),wt=w&&w.__esModule?w.default:w;var M={fontFamily:"sans-serif",fontSize:11},tt=16,st=2,T=t=>t;function et({model:t,lift:i,drawPaths:a,width:n,height:r,rasterize:s}){let p=t.buildDrawing(i,a,t.liveBuildView);if(!p)return null;let l=s?st:1,c=s?void 0:E(n,r),d=c?.canvas??document.createElement("canvas");c||(d.width=Math.round(n*l),d.height=Math.round(r*l));let{scaleX:y,scaleY:v,translateX:h,translateY:g}=t.screenTransform,o=new H(d);return o.uploadGeometry(p.batch),o.updateTransform({scaleX:y*l,scaleY:v*l,translateX:h*l,translateY:g*l,dpr:l}),o.render([0,0,0,0]),c?e("svg",{width:n,height:r,overflow:"hidden",children:e("g",{dangerouslySetInnerHTML:{__html:c.markup()}})}):e("image",{width:n,height:r,href:d.toDataURL("image/png")})}function lt(t,i,a,n){let r=n?0:C,s=t.toUpperCase();return{key:i,width:s.length*b,height:a+r,draw:p=>e("text",{fontFamily:"sans-serif",fontSize:9.5,fontWeight:600,letterSpacing:"0.06em",x:p,y:r,fill:q,children:s},i)}}function B(t,i,a=tt,n){if(!t.swatch)return{key:t.key,width:t.label.length*b,height:a,draw:d=>e("text",{...M,x:d,y:0,fill:"#666",children:t.label},t.key)};let r=t.swatch,s=n??_(r),p=n===void 0?0:n+5,l=(t.strong??"")+t.label,c=t.sizer===void 0?"":` ${$(t.sizer)}`;return{key:t.key,width:Math.max(s+5+(l.length+c.length)*b,p+(t.under?.length??0)*b),height:t.under?a*2:a,draw:d=>u("g",{...M,children:[t.count&&t.title?e("title",{children:t.title}):null,e(Y,{swatch:r,x:d+(s-_(r))/2,id:i}),u("text",{x:d+s+5,y:0,children:[t.strong?e("tspan",{fontWeight:"bold",children:t.strong}):null,t.label,t.count?e("tspan",{children:` ${$(t.count)}`}):null]}),t.under?e("text",{x:d+p,y:a,children:t.under}):null]},t.key)}}function pt({model:t,idPrefix:i}){let a=N(t);if(a.length===0)return null;let n=a.flatMap(o=>o.rows),r=I(n),s=X(n),p=a.flatMap(({testid:o,rows:f,heading:x,spaced:P},G)=>[...x?[lt(x,`${o}-heading`,r,G===0)]:[],...P?[{key:`${o}-gap`,width:0,height:C,draw:()=>null}]:[],...f.map((rt,at)=>B(rt,`${i}-${o}-${at}`,r,s))]),l=6,c=p.reduce((o,f)=>Math.max(o,f.width),-1/0)+l*2,d=p.reduce((o,f)=>o+f.height,0)+l,y=t.paneWidth-D-c+l,v=D+t.referenceStripZonePx,h=[],g=v+l/2+r/2+4;for(let o of p)h.push({row:o,y:g}),g+=o.height;return u("g",{"data-testid":"graph-svg-keys",children:[e("rect",{x:y-l,y:v,width:c,height:d,rx:3,fill:"#fff"}),h.map(({row:o,y:f})=>e("g",{transform:`translate(0 ${f})`,children:o.draw(y)},o.key))]})}function nt({x:t,y:i,text:a,fontSize:n,anchor:r}){let s=a.length*n*.56+6,p=r==="middle"?t-s/2:t-3;return u(k,{children:[e("rect",{x:p,y:i-n*.65,width:s,height:n*1.3,rx:3,fill:"#fff",fillOpacity:.8}),e("text",{x:t,y:i+n*.35,textAnchor:r,fontSize:n,fill:"#18181c",children:a})]})}function dt({model:t}){return e("g",{fontFamily:M.fontFamily,children:t.overlayLabels.sizes.map(({key:i,node:a,text:n,x:r,y:s})=>e("g",{opacity:t.nodeFaded(a)?F:void 0,children:e(nt,{x:r,y:s,text:n,fontSize:10,anchor:"middle"})},i))})}function ct({model:t}){return e("g",{fontFamily:M.fontFamily,children:t.visibleRowLabels.map(({label:i,y:a,top:n})=>e(nt,{x:10,y:n,text:i,fontSize:11,anchor:"start"},a))})}function gt({model:t,rasterize:i,idPrefix:a}){let n=t.facetPanels,r=t.facetGrid,s=t.facetPlacement;if(!n||!r||!s)return null;let{columns:p,width:l,height:c}=r,d=r.total+S+14,y=K(t).map((h,g)=>B(h,`${a}-facet-key-${g}`)),v=y.map((h,g)=>y.slice(0,g).reduce((o,f)=>o+f.width+14,6));return u(k,{children:[e("g",{transform:`translate(0 ${d})`,children:y.map((h,g)=>h.draw(v[g]))}),n.map((h,g)=>{let o=s.cells[g],f=o%p*(l+S),x=Math.floor(o/p)*(R+c+S),P=h.walks[0],G=B(J(t,P),`${a}-facet-${g}`);return u("g",{transform:`translate(${f} ${x})`,children:[e("g",{transform:`translate(0 ${tt-2})`,children:G.draw(6)}),e("g",{transform:`translate(0 ${R})`,children:e(et,{model:t,lift:h,drawPaths:!1,width:l,height:c,rasterize:i})})]},P.name)})]})}function A({model:t,rasterize:i=!1,idPrefix:a}){let n=t.paneWidth,r=t.canvasHeight,s=!!t.layoutResult?.tubeMap,p={rasterizeLayers:i},l=`${a}-drawing-clip`,c=t.drawingClip!==void 0;return u("g",{"data-testid":"graph-pane-svg",children:[c?e("defs",{children:e("clipPath",{id:l,children:e("rect",{width:t.drawingWidth,height:r})})}):null,u("g",{clipPath:c?`url(#${l})`:void 0,children:[t.facetPanels?e(gt,{model:t,rasterize:i,idPrefix:a}):s?e(L,{width:n,height:r,opts:p,paint:d=>{U(T(d),t,{highlightNode:null})}}):e(et,{model:t,lift:t.drawnHighlight,drawPaths:t.effectiveDrawPaths,width:n,height:r,rasterize:i}),t.facetPanels?null:u(k,{children:[e(W,{model:t}),e(z,{model:t}),e(dt,{model:t}),e(O,{model:t}),e(Z,{model:t,vector:!0}),e(ct,{model:t})]})]}),t.referenceStripShown?e(L,{width:n,height:r,opts:p,paint:d=>{V(T(d),t,{lit:void 0,dpr:1})}}):null,t.runsPastEdge?e(L,{width:n,height:r,opts:p,paint:d=>{j(T(d),t)}}):null,t.facetPanels?null:e(pt,{model:t,idPrefix:a})]})}function ht({model:t,opts:i}){return e(A,{model:t,rasterize:!!i?.rasterizeLayers,idPrefix:`graph-${t.id}`})}function Ft(t,i){return Q(t,i,ht)}export{Ft as renderGraphTrackSvg};
|
|
2
|
+
//# sourceMappingURL=renderSvg-ZXYKGJ7N.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as Ae,b as Ve,c as H,d as Xe,e as Ze,f as Qe}from"./chunks/chunk-52BUFQHJ.js";import"./chunks/chunk-IK5G3JHR.js";import{L as Ke,M as Ye,d as E,h as Oe,i as Je,q as m,s as Ue,v as Z,y as $e}from"./chunks/chunk-SMZZWPRX.js";import"./chunks/chunk-QOMV5OG7.js";import{b as d,g as N,h as We,q as qe}from"./chunks/chunk-AC5KEN36.js";import{$a as q,Ca as j,Da as _e,Ea as M,ab as v,g as Ie,i as L,ib as De,j as V,k as Ce,l as Pe,m as Be,n as Re,p as Ne}from"./chunks/chunk-M5XKM6D2.js";import"./chunks/chunk-VY7G4FSX.js";import"./chunks/chunk-YIGESHTA.js";import"./chunks/chunk-BLE63OIT.js";import"./chunks/chunk-E3GNTGWW.js";import{a as Q,d as z}from"./chunks/chunk-ZQOMV674.js";import{a as x,b as B,c as Me,d as ee,e as eo,f as W,g as oo}from"./chunks/chunk-ZVMXECJA.js";import"./chunks/chunk-JM4W4PKP.js";import"./chunks/chunk-DZXYOIGJ.js";import"./chunks/chunk-WBDZVWK4.js";import"./chunks/chunk-YBLNN5FU.js";import"./chunks/chunk-L7ZSEA4T.js";import"./chunks/chunk-E5ERNAYL.js";import"./chunks/chunk-43EUXRKZ.js";import{b as Ee,g as je}from"./chunks/chunk-YROUE32O.js";import{a as ve,c as ze,h as He}from"./chunks/chunk-D3QZGLZ3.js";import{d as $,e as n}from"./chunks/chunk-WKD7ALOU.js";import{a as Fe}from"./chunks/chunk-TMM73K4C.js";import"./chunks/chunk-D6TY2QEG.js";import"./chunks/chunk-YBLNN5FU.js";import{b as K,c as T,d as Ge,g as P,h as Y,i as Le}from"./chunks/chunk-EGZZ3ADM.js";import"./chunks/chunk-RDTLCMD2.js";import{f as we,g as ke,j as g,k as Te,m as xe}from"./chunks/chunk-5L276I7O.js";import{c as S}from"./chunks/chunk-J2PN6CG3.js";import{J as R}from"./chunks/chunk-H42TSPVA.js";import{a as Se,b as k,d as X}from"./chunks/chunk-DUU6T2I5.js";var _=JBrowseExports["@jbrowse/core/Plugin"];var to=_&&_.__esModule?_.default:_;var D=JBrowseExports["@jbrowse/core/pluggableElementTypes/AdapterType"];var u=D&&D.__esModule?D.default:D;var p=e=>({type:"fileLocation",defaultValue:{uri:e,locationType:"UriLocation"}}),l=(e,o="")=>d(e,{indexType:{model:n.enumeration("IndexType",["TBI","CSI"]),type:"stringEnum",defaultValue:"TBI"},location:p(o)});function A(e,o,t){return{indexType:t?"CSI":"TBI",location:{uri:`${e}.${t?"csi":"tbi"}`,baseUri:o}}}function G(e){let{walksUri:o,baseUri:t}=e;if(typeof o!="string")return e;let r=`${o}${T}`;return{...e,walksLocation:{uri:r,baseUri:t},walksIndex:{uri:`${r}.idx`,baseUri:t}}}var Co=d("GbzBaseSyntenyAdapter",{assemblyNames:{type:"stringArray",defaultValue:[]},gbzDbLocation:p("/path/to/graph.gbz.db"),haplotypeIndexLocation:p(""),readsLocation:p(""),readsIndex:l("GbzBaseReadsIndex"),samplesTsvLocation:p(""),subgraphSnarls:{type:"stringEnum",model:n.enumeration("SnarlOutput",["none","contained","overlapping"]),defaultValue:B.snarls},referenceSample:{type:"string",defaultValue:""},assemblyNameToPanSN:{type:"frozen",defaultValue:{}},context:{type:"number",defaultValue:B.context,advanced:!0},nodeLimit:{type:"number",defaultValue:B.limit,advanced:!0}},{explicitlyTyped:!0,preProcessSnapshot:e=>{let{uri:o,baseUri:t,reads:r}=e;return{...e,...o?{gbzDbLocation:{uri:o,baseUri:t}}:{},...typeof r=="string"?{readsLocation:{uri:r,baseUri:t},...Po(r,t)}:{}}}});function Po(e,o){let{name:t,query:r}=P(e);return t.endsWith(".gz")?{readsIndex:{location:{uri:`${t}.tbi${r}`,baseUri:o}}}:{}}var ro=Co;function oe(e){e.addAdapterType(()=>new u({name:"GbzBaseSyntenyAdapter",displayName:"gbz-base pangenome adapter",configSchema:ro,adapterCapabilities:["getSubgraph","headerLanes","lanePairsOnAnchor","lanePairBatches"],adapterMetadata:{category:"Synteny adapters"},getAdapterClass:()=>import("./chunks/GbzBaseSyntenyAdapter-46A4LMVD.js").then(o=>o.default)}))}var F=class extends V{constructor(){super(...arguments);this.name="GetGraphHaplotypes"}async execute(t){let{adapter:r}=await Re(this.pluginManager,t,"getHaplotypeNames");return r?.getHaplotypeNames({signal:t.signal})}};var Bo=S(()=>import("./chunks/AddTrackWorkflow-P5APNL32.js"));function te(e){e.addAddTrackWorkflowType(()=>new Ie({name:"Pangenome graph track",displayName:"Add pangenome graph track",ReactComponent:Bo,stateModel:n.model({})}))}var I=class extends V{constructor(){super(...arguments);this.name="GraphComputeLayout"}async execute(t){let{graph:r,options:a,signal:s,statusCallback:i}=t;return await new Promise(c=>setTimeout(c,0)),s?.throwIfAborted(),i?.("Computing layout"),We({graph:r,options:a})}};var O=JBrowseExports["@jbrowse/core/pluggableElementTypes/ViewType"];var ao=O&&O.__esModule?O.default:O;var f=JBrowseExports["@jbrowse/core/util/withLaunchInput"],Ro=e=>f!=null&&e in Object(f)?f[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/core/util/withLaunchInput' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),no=Ro("defineLaunchKeys");var Nt=f&&f.__esModule?f.default:f;var y=JBrowseExports["@jbrowse/core/pluggableElementTypes/models"],Vo=e=>y!=null&&e in Object(y)?y[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/core/pluggableElementTypes/models' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e});var io=Vo("BaseViewModel");var jt=y&&y.__esModule?y.default:y;function re(){return n.compose("GraphGenomeView",io,Xe,n.model({type:n.literal("GraphGenomeView"),gfaLocation:n.maybe(n.frozen()),loadedRegion:n.maybe(n.frozen()),loadedTrackId:n.optional(n.string,""),layoutMode:j(E),layoutEngine:_e(N,"fmmm"),color:n.maybe(n.frozen()),size:n.maybe(n.frozen()),layers:n.maybe(n.frozen()),facet:n.maybe(n.frozen()),rows:n.maybe(n.frozen()),hover:j(H),links:j(z),walks:n.maybe(n.frozen())})).views(e=>({get grammar(){return{layoutMode:e.layoutMode,layoutEngine:e.layoutEngine,encoding:{color:e.color},size:e.size,layers:e.layers,facet:e.facet,rows:e.rows,hover:e.hover,links:e.links,walks:e.walks}}})).actions(e=>({writeGrammar({encoding:o,...t}){Object.assign(e,o?{...t,color:o.color}:t)}})).volatile(()=>({widthMeasured:!1})).actions(e=>{let o=e.setWidth;return{setWidth(t){o(t),e.widthMeasured=!0}}}).views(e=>({get rpcSessionId(){return e.id},get paneWidth(){return e.width},get paneMeasured(){return e.widthMeasured},get sourceTrack(){return e.loadedTrackId?e.sessionTrack(e.loadedTrackId):void 0},get graphTracks(){return Qe(g(e).tracks)},get canRetryLoad(){return e.gfaLocation!==void 0||e.loadedTrackId!==""&&e.loadedRegion!==void 0}})).views(e=>({get hasPendingSource(){return e.canRetryLoad&&!e.graph&&!e.loadCanceled},menuItems(){return[...e.exportMenuItems(),...e.launchMenuItems()]}})).actions(e=>{let o=e.clearGraph;function t(r){if(e.gfaLocation)return e.displayName||e.setDisplayName(v(e.gfaLocation)),e.loadGFAFromLocation(e.gfaLocation,r);if(!e.loadedTrackId||!r)return;let a=e.sourceAdapter,s=r.end-r.start,i=e.offReference(r);if(!a)e.setError(new Error(`The track this graph was cut from, "${e.loadedTrackId}", is not in this session`));else if(i)e.setError(new Error(i));else if(s>e.maxRegionBp)e.setError(new Error(`Region too large (${q(s)}) \u2014 zoom in to view graph (max ${q(e.maxRegionBp)})`));else return e.markCut(),e.cutSubgraph(a,r,e.cutOptions)}return{clearGraph(){o(),e.gfaLocation&&e.displayName===v(e.gfaLocation)&&(e.displayName=void 0),e.gfaLocation=void 0,e.loadedRegion=void 0,e.loadedTrackId=""},load(){let r=e.loadedRegion,a=g(e),{assemblyManager:s}=a,i=r&&s.has(r.assemblyName)?s.get(r.assemblyName):void 0;return r&&i?.initialized===!1?s.waitForAssembly(r.assemblyName).catch(()=>{}).then(()=>$(e)&&e.loadedRegion===r?t(Z(a,r)):void 0):t(r&&Z(a,r))}}}).actions(e=>({retryLoad(){e.load()},setGfaLocation(o){e.gfaLocation=o},relayoutFrom(o){return e.loadedTrackId&&e.cutStale?e.load():e.recomputeLayout()},async openGfaLocation(o){await e.loadGFAFromLocation(o),$(e)&&e.hasGraph&&(this.setGfaLocation(o),e.displayName||e.setDisplayName(v(o)))},showTrackInLinearView(o,t,r){let a=g(e);$e({session:a,trackId:o,assembly:t,loc:r}),xe(a)&&a.removeView(e)},afterAttach(){e.graph||e.load()}}))}var No=no()({});function ae(e){e.addViewType(()=>new ao({name:"GraphGenomeView",displayName:"Graph genome view",stateModel:re(),launchKeys:No,ReactComponent:S(()=>import("./chunks/GraphGenomeView-MXRAP7QB.js"))}))}var ne=["MultiWaySyntenyDisplay","LinearSyntenyDisplay","DotplotDisplay","ChordSyntenyDisplay"];function Eo(e){let o=e.getElementTypesInGroup("display"),t=a=>o.find(s=>s.name===a),r=(a,s)=>s&&Object.assign(Object.create(s),{adapterCapabilities:[a]});return[t("LinearGraphDisplay"),r("referenceSegments",t("LinearBasicDisplay")),...ne.map(a=>r("headerLanes",t(a)))].filter(a=>a!==void 0)}function ie(e){e.addTrackType(()=>{let o=d("GraphTrack",{},{baseConfiguration:Pe(e),explicitIdentifier:"trackId"}),t=new Ce({name:"GraphTrack",displayName:"Pangenome graph track",configSchema:o,stateModel:Be(e,"GraphTrack",o)});for(let r of Eo(e))t.addDisplayType(r);return t})}function se(e){e.addToExtensionPoint("LaunchView-GraphGenomeView",o=>{let{session:t,...r}=o;return t.addView("GraphGenomeView",r),o})}var J=JBrowseExports["@jbrowse/core/pluggableElementTypes/DisplayType"];var so=J&&J.__esModule?J.default:J;var h=JBrowseExports["@jbrowse/display-kit/heightModeConfigSchemaFields"],jo=e=>h!=null&&e in Object(h)?h[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/display-kit/heightModeConfigSchemaFields' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),po=jo("heightModeConfigSchemaFields"),sr=h&&h.__esModule?h.default:h;var b=JBrowseExports["@jbrowse/display-kit/trackHeightConfigSchemaFields"],vo=e=>b!=null&&e in Object(b)?b[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/display-kit/trackHeightConfigSchemaFields' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),co=vo("trackHeightConfigSchemaFields"),dr=b&&b.__esModule?b.default:b;var w=JBrowseExports["@jbrowse/display-kit/facetConfigSchema"],zo=e=>w!=null&&e in Object(w)?w[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/display-kit/facetConfigSchema' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),mo=zo("facetConfigSchema");var mr=w&&w.__esModule?w.default:w;var lo=d("GraphFacet",{columns:{type:"maybeNumber",description:"panels per row of a node layout's grid; unset fits them"}},{baseConfiguration:mo});function uo(){return d("LinearGraphDisplay",{layoutMode:{type:"stringEnum",model:M(E,"force"),defaultValue:"force"},layoutEngine:{type:"stringEnum",model:M(N,"fmmm"),defaultValue:"fmmm"},encoding:{type:"frozen",defaultValue:{},plot:!0},size:{type:"frozen",defaultValue:{field:"depth",value:6},plot:!0},layers:{type:"frozen",defaultValue:{},plot:!0},facet:lo,rows:{type:"frozen",defaultValue:{},plot:!0},walks:{type:"frozen",defaultValue:[],plot:!0},hover:{type:"stringEnum",model:M(H,"nodes"),defaultValue:"nodes"},links:{type:"stringEnum",model:M(z,Q),defaultValue:Q},...co({defaultHeight:300,height:"the height of the track the graph is drawn in"}),...po({heightMode:"how a force drawing the view's window places meets the track's height: `fit` shrinks the whole cut to the track's height; `fixed` draws it at the window's scale, so a zoom magnifies it, lowered only as far as keeps the reference the window shows inside the track, which it holds whole, and marks where what hangs off that reference runs past the top or bottom; `grow` does the same in a track grown to hold the cut, up to `growMaxHeight`",growMaxHeight:"the tallest `grow` makes the track, in px",defaultHeightMode:De})},{explicitlyTyped:!0,explicitIdentifier:"displayId",misnamed:{walkLayers:"walks"}})}function pe(e){e.addDisplayType(()=>{let o=uo();return Object.assign(new so({name:"LinearGraphDisplay",displayName:"Graph",configSchema:o,stateModel:Ze(o),trackType:"GraphTrack",viewType:"LinearGenomeView",ReactComponent:S(()=>import("./chunks/LinearGraphDisplay-KPWFPVFK.js"))}),{adapterCapabilities:["getSubgraph"]})})}function Ho(e){let{uri:o,baseUri:t,csi:r}=e;return typeof o=="string"?{...e,bubblesLocation:{uri:o,baseUri:t},index:A(o,t,r)}:e}var Wo=d("MinigraphBubbleAdapter",{bubblesLocation:p("/path/to/graph.bb.bed.gz"),index:l("MinigraphBubbleIndex","/path/to/graph.bb.bed.gz.tbi"),assemblyNameToPanSN:{type:"frozen",defaultValue:{}}},{explicitlyTyped:!0,preProcessSnapshot:Ho}),go=Wo;function de(e){e.addAdapterType(()=>new u({name:"MinigraphBubbleAdapter",displayName:"Minigraph bubble BED adapter",configSchema:go,adapterMetadata:{category:"Graph adapters"},getAdapterClass:()=>import("./chunks/MinigraphBubbleAdapter-QSPPG4LG.js").then(o=>o.default)}))}function fo(e){let{uri:o,baseUri:t,csi:r,format:a}=e;return typeof o!="string"?e:a===2?{...e,graphLocation:{uri:`${o}${K}`,baseUri:t},graphIndex:A(`${o}${K}`,t,r)}:{...e,segmentsLocation:{uri:`${o}.segs.bed.gz`,baseUri:t},segmentsIndex:A(`${o}.segs.bed.gz`,t,r),linksLocation:{uri:`${o}.links.bed.gz`,baseUri:t},linksIndex:A(`${o}.links.bed.gz`,t,r)}}function _o(e){let{coarse:o,baseUri:t,csi:r}=e;return G(fo(typeof o=="object"&&o!==null?{...e,coarse:fo({baseUri:t,csi:r,...o})}:e))}var Do=d("RgfaTabixCoarseTier",{uri:{type:"maybeString"},format:{type:"maybeNumber"},aboveBpPerPx:{type:"maybeNumber"},foldBelowBp:{type:"maybeNumber"},segmentsLocation:p("/path/to/graph.tier.segs.bed.gz"),segmentsIndex:l("RgfaCoarseSegmentsIndex","/path/to/graph.tier.segs.bed.gz.tbi"),linksLocation:p("/path/to/graph.tier.links.bed.gz"),linksIndex:l("RgfaCoarseLinksIndex","/path/to/graph.tier.links.bed.gz.tbi"),graphLocation:p(""),graphIndex:l("RgfaCoarseGraphIndex")}),Oo=d("RgfaTabixAdapter",{segmentsLocation:p("/path/to/graph.segs.bed.gz"),segmentsIndex:l("RgfaSegmentsIndex","/path/to/graph.segs.bed.gz.tbi"),linksLocation:p("/path/to/graph.links.bed.gz"),linksIndex:l("RgfaLinksIndex","/path/to/graph.links.bed.gz.tbi"),graphLocation:p(""),graphIndex:l("RgfaGraphIndex"),walksLocation:p(""),walksIndex:p(""),walkStepBudget:{type:"integer",defaultValue:x.stepBudget},walkByteBudget:{type:"integer",defaultValue:x.byteBudget},defaultHaplotypes:{type:"stringArray",defaultValue:[]},samplesTsvLocation:p(""),assemblyNameToPanSN:{type:"frozen",defaultValue:{}},coarse:Do},{explicitlyTyped:!0,preProcessSnapshot:_o}),yo=Oo;function ce(e){e.addAdapterType(()=>new u({name:"RgfaTabixAdapter",displayName:"Indexed rGFA adapter",configSchema:yo,adapterCapabilities:["getSubgraph","referenceSegments"],adapterMetadata:{category:"Graph adapters"},getAdapterClass:()=>import("./chunks/RgfaTabixAdapter-UPCOXYVG.js").then(o=>o.default)}))}function ho(e){return e.viewType==="LinearGenomeView"&&[e.trackType].flat().includes("VariantTrack")}var Jo=[{label:"Auto",value:"auto"},{label:"50 bp",value:50},{label:"1 kb",value:1e3},{label:"10 kb",value:1e4}];function Uo(e,o){return e?`Pinned to ${W(e)}${o===void 0?"":` \xB7 ${o} form${o===1?"":"s"}`}`:"Not pinned"}function $o(e,o){let t=g(e),r=o.flatMap(a=>a?[oo(a)]:[]);for(let{message:a}of[...t.snackbarMessages??[]])r.some(s=>a.startsWith(s))&&t.removeSnackbarMessage?.(a)}function Ko(e){return e.props({formsPinned:n.maybe(n.frozen()),formsFloorBp:n.maybe(n.frozen())}).views(o=>({get configuredAdapter(){return He(o.parentTrack.configuration)},get walkForms(){return this.configuredAdapter.type==="WalkFormsAdapter"}})).views(o=>({get pinnedAliases(){let t=ee(o.formsPinned??o.configuredAdapter.pinned),[r]=Fe(o.parentTrack.configuration),a=t&&r?g(o).assemblyManager.get(r):void 0;return t&&a?a.getAliasesForRefName(t.refName):[]}})).views(o=>({get adapterConfig(){let t=o.configuredAdapter;return o.walkForms?{...t,...o.formsPinned?{pinned:o.formsPinned}:{},...o.pinnedAliases.length>0?{pinnedAliases:o.pinnedAliases}:{},...o.formsFloorBp===void 0?{}:{floorBp:o.formsFloorBp}}:t},get formsWindow(){return ee(this.adapterConfig.pinned)},get formsFloor(){return eo(this.adapterConfig.floorBp)},get formsCount(){return o.sourcesBase?.reduce((t,r)=>t+(Number(r.forms)||1),0)},get visibleWindow(){let t=ke(o),r=Oe(t)?Je(t):void 0;return r&&r.end>r.start?{refName:r.refName,start:Math.max(0,Math.floor(r.start)),end:Math.ceil(r.end)}:void 0}})).volatile(()=>({warnedWindow:void 0})).actions(o=>{let{setSources:t}=o,r=()=>{$o(o,[o.warnedWindow,o.formsWindow])};return{setFormsPinned(a){r(),o.formsPinned=a},setFormsFloorBp(a){r(),o.formsFloorBp=a},setSources(a,s){o.walkForms&&(r(),o.warnedWindow=o.formsWindow),t?.(a,s)}}}).views(o=>{let{trackMenuItems:t}=o;return{formsMenuItems(){let r=o.formsWindow,a=o.visibleWindow;return[{label:Uo(r,o.formsCount),disabled:!0,onClick:()=>{}},{label:"Re-pin to visible region",helpText:"Cut the forms from the region the view shows. Panning and zooming leave the forms alone",disabled:!a||r!==void 0&&W(a)===W(r),onClick:()=>{a&&o.setFormsPinned(a)}},{label:"Hide changes under",subMenu:Jo.map(({label:s,value:i})=>({label:s,type:"radio",checked:o.formsFloor===i,onClick:()=>{o.setFormsFloorBp(i)}}))}]},trackMenuItems(){return o.walkForms?[...t(),...this.formsMenuItems()]:t()}}})}function me(e){e.addToExtensionPoint("Core-extendPluggableElement",o=>(o instanceof L&&ho(o)&&o.extendStateModel(Ko),o))}function bo(e){e.getElementTypesInGroup("display").some(t=>t instanceof L&&ho(t))||console.warn("jbrowse-plugin-graphgenomeviewer: no linear VariantTrack display is registered, so WalkFormsAdapter tracks get no pin or floor menu")}var Yo=d("WalkFormsAdapter",{walksLocation:p("/path/to/graph.walks.gz"),walksIndex:p(""),pinned:{type:"frozen",defaultValue:{}},pinnedAliases:{type:"stringArray",defaultValue:[]},floorBp:{type:"frozen",defaultValue:"auto"},exclude:{type:"stringArray",defaultValue:[]},maxForms:{type:"integer",defaultValue:Me},walkByteBudget:{type:"integer",defaultValue:15e5}},{explicitlyTyped:!0,preProcessSnapshot:G}),wo=Yo;function le(e){e.addAdapterType(()=>new u({name:"WalkFormsAdapter",displayName:"Walk-file structural forms adapter",configSchema:wo,adapterMetadata:{category:"Variant adapters"},getAdapterClass:()=>import("./chunks/WalkFormsAdapter-LHKGRYC6.js").then(o=>o.default)}))}var Xo=d("WalkTabixSyntenyAdapter",{assemblyNames:{type:"stringArray",defaultValue:[]},walksLocation:p("/path/to/graph.walks.gz"),walksIndex:p(""),walkStepBudget:{type:"integer",defaultValue:x.stepBudget},walkByteBudget:{type:"integer",defaultValue:x.byteBudget},defaultHaplotypes:{type:"stringArray",defaultValue:[]},samplesTsvLocation:p(""),assemblyNameToPanSN:{type:"frozen",defaultValue:{}}},{explicitlyTyped:!0,preProcessSnapshot:G}),ko=Xo;function ue(e){e.addAdapterType(()=>new u({name:"WalkTabixSyntenyAdapter",displayName:"Walk-indexed graph adapter",configSchema:ko,adapterCapabilities:["getSubgraph","headerLanes","lanePairsOnAnchor","lanePairBatches"],adapterMetadata:{category:"Synteny adapters"},getAdapterClass:()=>import("./chunks/WalkTabixSyntenyAdapter-ELTYD73I.js").then(o=>o.default)}))}var qo=".bubbles.bed.gz";function Zo(e){return Y(e).toLowerCase().endsWith(".gbz.db")}function Qo(e,o,t){let r=Y(e),a=i=>!t||t===i,s=o!==void 0||Le(e);return Zo(e)?a("GbzBaseSyntenyAdapter")?"GbzBaseSyntenyAdapter":void 0:Ee(e)?a("RgfaTabixAdapter")?"RgfaTabixAdapter":void 0:s?r.endsWith(T)?t==="RgfaTabixAdapter"?"RgfaTabixWalks":a("WalkTabixSyntenyAdapter")?"WalkTabixSyntenyAdapter":void 0:a("MinigraphBubbleAdapter")&&(r.endsWith(qo)||t!==void 0)?"MinigraphBubbleAdapter":void 0:void 0}function To(e,o,t){let r=Qo(e,o,t);return r?je({choice:r,loc:e,indexLoc:o,assembly:"",sample:""}):void 0}function et(e){let o=e.adapter;return o?.type!==void 0&&Ke.has(o.type)&&!o.assemblyNames?.length&&Array.isArray(e.assemblyNames)&&e.assemblyNames.length>0?{...e,adapter:{...o,assemblyNames:e.assemblyNames}}:e}function ot({walksUri:e,walksLocation:o}){let{uri:t,localPath:r,name:a}=m(o)?o:{};return typeof e=="string"&&e!==""?`${e}${T}`:typeof t=="string"?P(t).name:typeof r=="string"?r:typeof a=="string"?a:void 0}function tt(e){let o=m(e.adapter)?e.adapter:void 0,[t]=Array.isArray(e.assemblyNames)?e.assemblyNames:[],r=o&&ze(o)?ot(o):void 0,a=r?Ge(r):void 0;return o&&t&&a&&a!==t&&o.assemblyNameToPanSN===void 0?{...e,adapter:{...o,assemblyNameToPanSN:{[t]:a}}}:e}function ge(e){e.addToExtensionPoint("Core-preProcessTrackConfig",et),e.addToExtensionPoint("Core-preProcessTrackConfig",tt),e.addToExtensionPoint("Core-guessAdapterForLocation",o=>(t,r,a)=>To(t,r,a)??o(t,r,a)),e.addToExtensionPoint("Core-guessTrackTypeForLocation",o=>(t,r)=>ve.has(t)?"GraphTrack":t==="MinigraphBubbleAdapter"?"FeatureTrack":o(t,r))}function fe(e){let o;if(m(e)){let{refName:t,start:r,end:a,assemblyName:s}=e;typeof t=="string"&&typeof r=="number"&&typeof a=="number"&&(o={refName:t,start:r,end:a,assemblyName:typeof s=="string"?s:void 0})}return o}function rt(e,o,t){let r=e.connectedViewId;return r===void 0||r===o||!t.has(r)}function xo(e,o){return e.assemblyName===void 0||o===void 0||o.includes(e.assemblyName)}function So(e){return(Array.isArray(e.tracks)?e.tracks:[]).flatMap(t=>m(t)&&Array.isArray(t.displays)?t.displays.filter(r=>m(r)&&r.type==="LinearGraphDisplay"):[])}function Ao(e,o,t){let r=[],a=Ue(e),s=new Set(a.map(i=>m(i)?i.id:void 0));for(let i of a){if(m(i)&&i.id===o)for(let c of So(i)){let C=fe(c.hoverHighlight);C&&xo(C,t)&&r.push({key:typeof c.id=="string"?c.id:"graph-track",region:C})}for(let c of m(i)?[...So(i),...i.type==="GraphGenomeView"?[i]:[]]:[])(Array.isArray(c.assemblyHoverHighlights)?c.assemblyHoverHighlights:[]).forEach((Fo,Io)=>{let U=fe(Fo);U?.assemblyName!==void 0&&t?.includes(U.assemblyName)&&r.push({key:`${typeof c.id=="string"?c.id:"graph"}-${Io}`,region:U})});if(m(i)&&i.type==="GraphGenomeView"&&rt(i,o,s)){let c=fe(i.hoverHighlight);c&&xo(c,t)&&r.push({key:typeof i.id=="string"?i.id:"graph",region:c})}}return r}var at=qe()(e=>({highlight:{height:"100%",position:"absolute",background:R(e.palette.primary.main,.08),borderLeft:`1px solid ${R(e.palette.primary.main,.4)}`,borderRight:`1px solid ${R(e.palette.primary.main,.4)}`,pointerEvents:"none",zIndex:10}})),nt=X(function({model:o,region:t}){let{classes:r}=at(),a=o.getHighlightCoords(t);return a?k("div",{"data-testid":"graph-node-highlight",className:r.highlight,style:{left:a.left,width:a.width}}):null}),it=X(function({model:o}){let{views:t}=g(o);return k(Se,{children:Ao([...t],o.id,o.assemblyNames).map(({key:r,region:a})=>k(nt,{model:o,region:a},`graph-hover-${r}`))})}),Go=it;var st="LinearGenomeView-TracksContainerComponent";function ye(e){e.contributeToExtensionPoint(st,({model:o})=>k(Go,{model:o},"graphgenomeview-hover-highlight"))}function pt(e){return e.views(o=>({get adapterConfig(){return Ye(o,we(o).configuration)}}))}function he(e){e.addToExtensionPoint("Core-extendPluggableElement",o=>(o instanceof L&&ne.includes(o.name)&&o.extendStateModel(pt),o))}var Lo="GraphGenomeView";var Mo="10.4.2";var be=class extends to{constructor(){super(...arguments);this.name=Lo;this.version=Mo}install(t){ae(t),pe(t),ie(t),se(t),ye(t),ce(t),de(t),oe(t),ue(t),le(t),me(t),te(t),ge(t),he(t),t.addRpcMethod(()=>new I(t)),t.addRpcMethod(()=>new Ne(t)),t.addRpcMethod(()=>new Ve(t)),t.addRpcMethod(()=>new F(t))}configure(t){bo(t);try{Te(t.rootModel)&&t.rootModel.appendToSubMenu(["Add"],{label:"Graph genome view",icon:Ae,onClick:r=>{r.addView("GraphGenomeView",{})}})}catch(r){console.warn("[GraphGenomeView] could not add the Add menu entry",r)}}};export{be as default};
|
|
1
|
+
import{a as Ae,b as Ve,c as H,d as Xe,e as Ze,f as Qe}from"./chunks/chunk-HY5KSOGM.js";import"./chunks/chunk-IK5G3JHR.js";import{L as Ke,M as Ye,d as E,h as Oe,i as Je,q as m,s as Ue,v as Z,y as $e}from"./chunks/chunk-NK76Y6IN.js";import"./chunks/chunk-RTLOZXOH.js";import{b as d,g as N,h as We,q as qe}from"./chunks/chunk-UFFIQB3D.js";import{$a as q,Ca as j,Da as _e,Ea as M,ab as v,g as Ie,i as L,ib as De,j as V,k as Ce,l as Pe,m as Be,n as Re,p as Ne}from"./chunks/chunk-FQ5DWNNX.js";import"./chunks/chunk-F3NT4VYA.js";import"./chunks/chunk-2LE4HMDX.js";import"./chunks/chunk-XO54F7NK.js";import"./chunks/chunk-OA3GUDDC.js";import{a as Q,d as z}from"./chunks/chunk-ZQOMV674.js";import{a as x,b as B,c as Me,d as ee,e as eo,f as W,g as oo}from"./chunks/chunk-ZVMXECJA.js";import"./chunks/chunk-JM4W4PKP.js";import"./chunks/chunk-SOOC7T5G.js";import"./chunks/chunk-5FHTS7YG.js";import"./chunks/chunk-YBLNN5FU.js";import"./chunks/chunk-3PVSP3VV.js";import"./chunks/chunk-USYII6RS.js";import"./chunks/chunk-UBN7IANP.js";import{b as Ee,g as je}from"./chunks/chunk-YROUE32O.js";import{a as ve,c as ze,h as He}from"./chunks/chunk-D3QZGLZ3.js";import{d as $,e as n}from"./chunks/chunk-WKD7ALOU.js";import{a as Fe}from"./chunks/chunk-TMM73K4C.js";import"./chunks/chunk-D6TY2QEG.js";import"./chunks/chunk-YBLNN5FU.js";import{b as K,c as T,d as Ge,g as P,h as Y,i as Le}from"./chunks/chunk-EGZZ3ADM.js";import"./chunks/chunk-DAIBR3K3.js";import{f as we,g as ke,j as g,k as Te,m as xe}from"./chunks/chunk-5L276I7O.js";import{c as S}from"./chunks/chunk-J2PN6CG3.js";import{J as R}from"./chunks/chunk-H42TSPVA.js";import{a as Se,b as k,d as X}from"./chunks/chunk-DUU6T2I5.js";var _=JBrowseExports["@jbrowse/core/Plugin"];var to=_&&_.__esModule?_.default:_;var D=JBrowseExports["@jbrowse/core/pluggableElementTypes/AdapterType"];var u=D&&D.__esModule?D.default:D;var p=e=>({type:"fileLocation",defaultValue:{uri:e,locationType:"UriLocation"}}),l=(e,o="")=>d(e,{indexType:{model:n.enumeration("IndexType",["TBI","CSI"]),type:"stringEnum",defaultValue:"TBI"},location:p(o)});function A(e,o,t){return{indexType:t?"CSI":"TBI",location:{uri:`${e}.${t?"csi":"tbi"}`,baseUri:o}}}function G(e){let{walksUri:o,baseUri:t}=e;if(typeof o!="string")return e;let r=`${o}${T}`;return{...e,walksLocation:{uri:r,baseUri:t},walksIndex:{uri:`${r}.idx`,baseUri:t}}}var Co=d("GbzBaseSyntenyAdapter",{assemblyNames:{type:"stringArray",defaultValue:[]},gbzDbLocation:p("/path/to/graph.gbz.db"),haplotypeIndexLocation:p(""),readsLocation:p(""),readsIndex:l("GbzBaseReadsIndex"),samplesTsvLocation:p(""),subgraphSnarls:{type:"stringEnum",model:n.enumeration("SnarlOutput",["none","contained","overlapping"]),defaultValue:B.snarls},referenceSample:{type:"string",defaultValue:""},assemblyNameToPanSN:{type:"frozen",defaultValue:{}},context:{type:"number",defaultValue:B.context,advanced:!0},nodeLimit:{type:"number",defaultValue:B.limit,advanced:!0}},{explicitlyTyped:!0,preProcessSnapshot:e=>{let{uri:o,baseUri:t,reads:r}=e;return{...e,...o?{gbzDbLocation:{uri:o,baseUri:t}}:{},...typeof r=="string"?{readsLocation:{uri:r,baseUri:t},...Po(r,t)}:{}}}});function Po(e,o){let{name:t,query:r}=P(e);return t.endsWith(".gz")?{readsIndex:{location:{uri:`${t}.tbi${r}`,baseUri:o}}}:{}}var ro=Co;function oe(e){e.addAdapterType(()=>new u({name:"GbzBaseSyntenyAdapter",displayName:"gbz-base pangenome adapter",configSchema:ro,adapterCapabilities:["getSubgraph","headerLanes","lanePairsOnAnchor","lanePairBatches"],adapterMetadata:{category:"Synteny adapters"},getAdapterClass:()=>import("./chunks/GbzBaseSyntenyAdapter-KBJM7TL2.js").then(o=>o.default)}))}var F=class extends V{constructor(){super(...arguments);this.name="GetGraphHaplotypes"}async execute(t){let{adapter:r}=await Re(this.pluginManager,t,"getHaplotypeNames");return r?.getHaplotypeNames({signal:t.signal})}};var Bo=S(()=>import("./chunks/AddTrackWorkflow-X3FDV4YC.js"));function te(e){e.addAddTrackWorkflowType(()=>new Ie({name:"Pangenome graph track",displayName:"Add pangenome graph track",ReactComponent:Bo,stateModel:n.model({})}))}var I=class extends V{constructor(){super(...arguments);this.name="GraphComputeLayout"}async execute(t){let{graph:r,options:a,signal:s,statusCallback:i}=t;return await new Promise(c=>setTimeout(c,0)),s?.throwIfAborted(),i?.("Computing layout"),We({graph:r,options:a})}};var O=JBrowseExports["@jbrowse/core/pluggableElementTypes/ViewType"];var ao=O&&O.__esModule?O.default:O;var f=JBrowseExports["@jbrowse/core/util/withLaunchInput"],Ro=e=>f!=null&&e in Object(f)?f[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/core/util/withLaunchInput' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),no=Ro("defineLaunchKeys");var Nt=f&&f.__esModule?f.default:f;var y=JBrowseExports["@jbrowse/core/pluggableElementTypes/models"],Vo=e=>y!=null&&e in Object(y)?y[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/core/pluggableElementTypes/models' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e});var io=Vo("BaseViewModel");var jt=y&&y.__esModule?y.default:y;function re(){return n.compose("GraphGenomeView",io,Xe,n.model({type:n.literal("GraphGenomeView"),gfaLocation:n.maybe(n.frozen()),loadedRegion:n.maybe(n.frozen()),loadedTrackId:n.optional(n.string,""),layoutMode:j(E),layoutEngine:_e(N,"fmmm"),color:n.maybe(n.frozen()),size:n.maybe(n.frozen()),layers:n.maybe(n.frozen()),facet:n.maybe(n.frozen()),rows:n.maybe(n.frozen()),hover:j(H),links:j(z),walks:n.maybe(n.frozen())})).views(e=>({get grammar(){return{layoutMode:e.layoutMode,layoutEngine:e.layoutEngine,encoding:{color:e.color},size:e.size,layers:e.layers,facet:e.facet,rows:e.rows,hover:e.hover,links:e.links,walks:e.walks}}})).actions(e=>({writeGrammar({encoding:o,...t}){Object.assign(e,o?{...t,color:o.color}:t)}})).volatile(()=>({widthMeasured:!1})).actions(e=>{let o=e.setWidth;return{setWidth(t){o(t),e.widthMeasured=!0}}}).views(e=>({get rpcSessionId(){return e.id},get paneWidth(){return e.width},get paneMeasured(){return e.widthMeasured},get sourceTrack(){return e.loadedTrackId?e.sessionTrack(e.loadedTrackId):void 0},get graphTracks(){return Qe(g(e).tracks)},get canRetryLoad(){return e.gfaLocation!==void 0||e.loadedTrackId!==""&&e.loadedRegion!==void 0}})).views(e=>({get hasPendingSource(){return e.canRetryLoad&&!e.graph&&!e.loadCanceled},menuItems(){return[...e.exportMenuItems(),...e.launchMenuItems()]}})).actions(e=>{let o=e.clearGraph;function t(r){if(e.gfaLocation)return e.displayName||e.setDisplayName(v(e.gfaLocation)),e.loadGFAFromLocation(e.gfaLocation,r);if(!e.loadedTrackId||!r)return;let a=e.sourceAdapter,s=r.end-r.start,i=e.offReference(r);if(!a)e.setError(new Error(`The track this graph was cut from, "${e.loadedTrackId}", is not in this session`));else if(i)e.setError(new Error(i));else if(s>e.maxRegionBp)e.setError(new Error(`Region too large (${q(s)}) \u2014 zoom in to view graph (max ${q(e.maxRegionBp)})`));else return e.markCut(),e.cutSubgraph(a,r,e.cutOptions)}return{clearGraph(){o(),e.gfaLocation&&e.displayName===v(e.gfaLocation)&&(e.displayName=void 0),e.gfaLocation=void 0,e.loadedRegion=void 0,e.loadedTrackId=""},load(){let r=e.loadedRegion,a=g(e),{assemblyManager:s}=a,i=r&&s.has(r.assemblyName)?s.get(r.assemblyName):void 0;return r&&i?.initialized===!1?s.waitForAssembly(r.assemblyName).catch(()=>{}).then(()=>$(e)&&e.loadedRegion===r?t(Z(a,r)):void 0):t(r&&Z(a,r))}}}).actions(e=>({retryLoad(){e.load()},setGfaLocation(o){e.gfaLocation=o},relayoutFrom(o){return e.loadedTrackId&&e.cutStale?e.load():e.recomputeLayout()},async openGfaLocation(o){await e.loadGFAFromLocation(o),$(e)&&e.hasGraph&&(this.setGfaLocation(o),e.displayName||e.setDisplayName(v(o)))},showTrackInLinearView(o,t,r){let a=g(e);$e({session:a,trackId:o,assembly:t,loc:r}),xe(a)&&a.removeView(e)},afterAttach(){e.graph||e.load()}}))}var No=no()({});function ae(e){e.addViewType(()=>new ao({name:"GraphGenomeView",displayName:"Graph genome view",stateModel:re(),launchKeys:No,ReactComponent:S(()=>import("./chunks/GraphGenomeView-4IRT4GUJ.js"))}))}var ne=["MultiWaySyntenyDisplay","LinearSyntenyDisplay","DotplotDisplay","ChordSyntenyDisplay"];function Eo(e){let o=e.getElementTypesInGroup("display"),t=a=>o.find(s=>s.name===a),r=(a,s)=>s&&Object.assign(Object.create(s),{adapterCapabilities:[a]});return[t("LinearGraphDisplay"),r("referenceSegments",t("LinearBasicDisplay")),...ne.map(a=>r("headerLanes",t(a)))].filter(a=>a!==void 0)}function ie(e){e.addTrackType(()=>{let o=d("GraphTrack",{},{baseConfiguration:Pe(e),explicitIdentifier:"trackId"}),t=new Ce({name:"GraphTrack",displayName:"Pangenome graph track",configSchema:o,stateModel:Be(e,"GraphTrack",o)});for(let r of Eo(e))t.addDisplayType(r);return t})}function se(e){e.addToExtensionPoint("LaunchView-GraphGenomeView",o=>{let{session:t,...r}=o;return t.addView("GraphGenomeView",r),o})}var J=JBrowseExports["@jbrowse/core/pluggableElementTypes/DisplayType"];var so=J&&J.__esModule?J.default:J;var h=JBrowseExports["@jbrowse/display-kit/heightModeConfigSchemaFields"],jo=e=>h!=null&&e in Object(h)?h[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/display-kit/heightModeConfigSchemaFields' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),po=jo("heightModeConfigSchemaFields"),sr=h&&h.__esModule?h.default:h;var b=JBrowseExports["@jbrowse/display-kit/trackHeightConfigSchemaFields"],vo=e=>b!=null&&e in Object(b)?b[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/display-kit/trackHeightConfigSchemaFields' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),co=vo("trackHeightConfigSchemaFields"),dr=b&&b.__esModule?b.default:b;var w=JBrowseExports["@jbrowse/display-kit/facetConfigSchema"],zo=e=>w!=null&&e in Object(w)?w[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/display-kit/facetConfigSchema' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),mo=zo("facetConfigSchema");var mr=w&&w.__esModule?w.default:w;var lo=d("GraphFacet",{columns:{type:"maybeNumber",description:"panels per row of a node layout's grid; unset fits them"}},{baseConfiguration:mo});function uo(){return d("LinearGraphDisplay",{layoutMode:{type:"stringEnum",model:M(E,"force"),defaultValue:"force"},layoutEngine:{type:"stringEnum",model:M(N,"fmmm"),defaultValue:"fmmm"},encoding:{type:"frozen",defaultValue:{},plot:!0},size:{type:"frozen",defaultValue:{field:"depth",value:6},plot:!0},layers:{type:"frozen",defaultValue:{},plot:!0},facet:lo,rows:{type:"frozen",defaultValue:{},plot:!0},walks:{type:"frozen",defaultValue:[],plot:!0},hover:{type:"stringEnum",model:M(H,"nodes"),defaultValue:"nodes"},links:{type:"stringEnum",model:M(z,Q),defaultValue:Q},...co({defaultHeight:300,height:"the height of the track the graph is drawn in"}),...po({heightMode:"how a force drawing the view's window places meets the track's height: `fit` shrinks the whole cut to the track's height; `fixed` draws it at the window's scale, so a zoom magnifies it, lowered only as far as keeps the reference the window shows inside the track, which it holds whole, and marks where what hangs off that reference runs past the top or bottom; `grow` does the same in a track grown to hold the cut, up to `growMaxHeight`",growMaxHeight:"the tallest `grow` makes the track, in px",defaultHeightMode:De})},{explicitlyTyped:!0,explicitIdentifier:"displayId",misnamed:{walkLayers:"walks"}})}function pe(e){e.addDisplayType(()=>{let o=uo();return Object.assign(new so({name:"LinearGraphDisplay",displayName:"Graph",configSchema:o,stateModel:Ze(o),trackType:"GraphTrack",viewType:"LinearGenomeView",ReactComponent:S(()=>import("./chunks/LinearGraphDisplay-BHLFORWW.js"))}),{adapterCapabilities:["getSubgraph"]})})}function Ho(e){let{uri:o,baseUri:t,csi:r}=e;return typeof o=="string"?{...e,bubblesLocation:{uri:o,baseUri:t},index:A(o,t,r)}:e}var Wo=d("MinigraphBubbleAdapter",{bubblesLocation:p("/path/to/graph.bb.bed.gz"),index:l("MinigraphBubbleIndex","/path/to/graph.bb.bed.gz.tbi"),assemblyNameToPanSN:{type:"frozen",defaultValue:{}}},{explicitlyTyped:!0,preProcessSnapshot:Ho}),go=Wo;function de(e){e.addAdapterType(()=>new u({name:"MinigraphBubbleAdapter",displayName:"Minigraph bubble BED adapter",configSchema:go,adapterMetadata:{category:"Graph adapters"},getAdapterClass:()=>import("./chunks/MinigraphBubbleAdapter-XVYXCC76.js").then(o=>o.default)}))}function fo(e){let{uri:o,baseUri:t,csi:r,format:a}=e;return typeof o!="string"?e:a===2?{...e,graphLocation:{uri:`${o}${K}`,baseUri:t},graphIndex:A(`${o}${K}`,t,r)}:{...e,segmentsLocation:{uri:`${o}.segs.bed.gz`,baseUri:t},segmentsIndex:A(`${o}.segs.bed.gz`,t,r),linksLocation:{uri:`${o}.links.bed.gz`,baseUri:t},linksIndex:A(`${o}.links.bed.gz`,t,r)}}function _o(e){let{coarse:o,baseUri:t,csi:r}=e;return G(fo(typeof o=="object"&&o!==null?{...e,coarse:fo({baseUri:t,csi:r,...o})}:e))}var Do=d("RgfaTabixCoarseTier",{uri:{type:"maybeString"},format:{type:"maybeNumber"},aboveBpPerPx:{type:"maybeNumber"},foldBelowBp:{type:"maybeNumber"},segmentsLocation:p("/path/to/graph.tier.segs.bed.gz"),segmentsIndex:l("RgfaCoarseSegmentsIndex","/path/to/graph.tier.segs.bed.gz.tbi"),linksLocation:p("/path/to/graph.tier.links.bed.gz"),linksIndex:l("RgfaCoarseLinksIndex","/path/to/graph.tier.links.bed.gz.tbi"),graphLocation:p(""),graphIndex:l("RgfaCoarseGraphIndex")}),Oo=d("RgfaTabixAdapter",{segmentsLocation:p("/path/to/graph.segs.bed.gz"),segmentsIndex:l("RgfaSegmentsIndex","/path/to/graph.segs.bed.gz.tbi"),linksLocation:p("/path/to/graph.links.bed.gz"),linksIndex:l("RgfaLinksIndex","/path/to/graph.links.bed.gz.tbi"),graphLocation:p(""),graphIndex:l("RgfaGraphIndex"),walksLocation:p(""),walksIndex:p(""),walkStepBudget:{type:"integer",defaultValue:x.stepBudget},walkByteBudget:{type:"integer",defaultValue:x.byteBudget},defaultHaplotypes:{type:"stringArray",defaultValue:[]},samplesTsvLocation:p(""),assemblyNameToPanSN:{type:"frozen",defaultValue:{}},coarse:Do},{explicitlyTyped:!0,preProcessSnapshot:_o}),yo=Oo;function ce(e){e.addAdapterType(()=>new u({name:"RgfaTabixAdapter",displayName:"Indexed rGFA adapter",configSchema:yo,adapterCapabilities:["getSubgraph","referenceSegments"],adapterMetadata:{category:"Graph adapters"},getAdapterClass:()=>import("./chunks/RgfaTabixAdapter-DTLYU5IT.js").then(o=>o.default)}))}function ho(e){return e.viewType==="LinearGenomeView"&&[e.trackType].flat().includes("VariantTrack")}var Jo=[{label:"Auto",value:"auto"},{label:"50 bp",value:50},{label:"1 kb",value:1e3},{label:"10 kb",value:1e4}];function Uo(e,o){return e?`Pinned to ${W(e)}${o===void 0?"":` \xB7 ${o} form${o===1?"":"s"}`}`:"Not pinned"}function $o(e,o){let t=g(e),r=o.flatMap(a=>a?[oo(a)]:[]);for(let{message:a}of[...t.snackbarMessages??[]])r.some(s=>a.startsWith(s))&&t.removeSnackbarMessage?.(a)}function Ko(e){return e.props({formsPinned:n.maybe(n.frozen()),formsFloorBp:n.maybe(n.frozen())}).views(o=>({get configuredAdapter(){return He(o.parentTrack.configuration)},get walkForms(){return this.configuredAdapter.type==="WalkFormsAdapter"}})).views(o=>({get pinnedAliases(){let t=ee(o.formsPinned??o.configuredAdapter.pinned),[r]=Fe(o.parentTrack.configuration),a=t&&r?g(o).assemblyManager.get(r):void 0;return t&&a?a.getAliasesForRefName(t.refName):[]}})).views(o=>({get adapterConfig(){let t=o.configuredAdapter;return o.walkForms?{...t,...o.formsPinned?{pinned:o.formsPinned}:{},...o.pinnedAliases.length>0?{pinnedAliases:o.pinnedAliases}:{},...o.formsFloorBp===void 0?{}:{floorBp:o.formsFloorBp}}:t},get formsWindow(){return ee(this.adapterConfig.pinned)},get formsFloor(){return eo(this.adapterConfig.floorBp)},get formsCount(){return o.sourcesBase?.reduce((t,r)=>t+(Number(r.forms)||1),0)},get visibleWindow(){let t=ke(o),r=Oe(t)?Je(t):void 0;return r&&r.end>r.start?{refName:r.refName,start:Math.max(0,Math.floor(r.start)),end:Math.ceil(r.end)}:void 0}})).volatile(()=>({warnedWindow:void 0})).actions(o=>{let{setSources:t}=o,r=()=>{$o(o,[o.warnedWindow,o.formsWindow])};return{setFormsPinned(a){r(),o.formsPinned=a},setFormsFloorBp(a){r(),o.formsFloorBp=a},setSources(a,s){o.walkForms&&(r(),o.warnedWindow=o.formsWindow),t?.(a,s)}}}).views(o=>{let{trackMenuItems:t}=o;return{formsMenuItems(){let r=o.formsWindow,a=o.visibleWindow;return[{label:Uo(r,o.formsCount),disabled:!0,onClick:()=>{}},{label:"Re-pin to visible region",helpText:"Cut the forms from the region the view shows. Panning and zooming leave the forms alone",disabled:!a||r!==void 0&&W(a)===W(r),onClick:()=>{a&&o.setFormsPinned(a)}},{label:"Hide changes under",subMenu:Jo.map(({label:s,value:i})=>({label:s,type:"radio",checked:o.formsFloor===i,onClick:()=>{o.setFormsFloorBp(i)}}))}]},trackMenuItems(){return o.walkForms?[...t(),...this.formsMenuItems()]:t()}}})}function me(e){e.addToExtensionPoint("Core-extendPluggableElement",o=>(o instanceof L&&ho(o)&&o.extendStateModel(Ko),o))}function bo(e){e.getElementTypesInGroup("display").some(t=>t instanceof L&&ho(t))||console.warn("jbrowse-plugin-graphgenomeviewer: no linear VariantTrack display is registered, so WalkFormsAdapter tracks get no pin or floor menu")}var Yo=d("WalkFormsAdapter",{walksLocation:p("/path/to/graph.walks.gz"),walksIndex:p(""),pinned:{type:"frozen",defaultValue:{}},pinnedAliases:{type:"stringArray",defaultValue:[]},floorBp:{type:"frozen",defaultValue:"auto"},exclude:{type:"stringArray",defaultValue:[]},maxForms:{type:"integer",defaultValue:Me},walkByteBudget:{type:"integer",defaultValue:15e5}},{explicitlyTyped:!0,preProcessSnapshot:G}),wo=Yo;function le(e){e.addAdapterType(()=>new u({name:"WalkFormsAdapter",displayName:"Walk-file structural forms adapter",configSchema:wo,adapterMetadata:{category:"Variant adapters"},getAdapterClass:()=>import("./chunks/WalkFormsAdapter-PT6SRY4G.js").then(o=>o.default)}))}var Xo=d("WalkTabixSyntenyAdapter",{assemblyNames:{type:"stringArray",defaultValue:[]},walksLocation:p("/path/to/graph.walks.gz"),walksIndex:p(""),walkStepBudget:{type:"integer",defaultValue:x.stepBudget},walkByteBudget:{type:"integer",defaultValue:x.byteBudget},defaultHaplotypes:{type:"stringArray",defaultValue:[]},samplesTsvLocation:p(""),assemblyNameToPanSN:{type:"frozen",defaultValue:{}}},{explicitlyTyped:!0,preProcessSnapshot:G}),ko=Xo;function ue(e){e.addAdapterType(()=>new u({name:"WalkTabixSyntenyAdapter",displayName:"Walk-indexed graph adapter",configSchema:ko,adapterCapabilities:["getSubgraph","headerLanes","lanePairsOnAnchor","lanePairBatches"],adapterMetadata:{category:"Synteny adapters"},getAdapterClass:()=>import("./chunks/WalkTabixSyntenyAdapter-CGRHEJV4.js").then(o=>o.default)}))}var qo=".bubbles.bed.gz";function Zo(e){return Y(e).toLowerCase().endsWith(".gbz.db")}function Qo(e,o,t){let r=Y(e),a=i=>!t||t===i,s=o!==void 0||Le(e);return Zo(e)?a("GbzBaseSyntenyAdapter")?"GbzBaseSyntenyAdapter":void 0:Ee(e)?a("RgfaTabixAdapter")?"RgfaTabixAdapter":void 0:s?r.endsWith(T)?t==="RgfaTabixAdapter"?"RgfaTabixWalks":a("WalkTabixSyntenyAdapter")?"WalkTabixSyntenyAdapter":void 0:a("MinigraphBubbleAdapter")&&(r.endsWith(qo)||t!==void 0)?"MinigraphBubbleAdapter":void 0:void 0}function To(e,o,t){let r=Qo(e,o,t);return r?je({choice:r,loc:e,indexLoc:o,assembly:"",sample:""}):void 0}function et(e){let o=e.adapter;return o?.type!==void 0&&Ke.has(o.type)&&!o.assemblyNames?.length&&Array.isArray(e.assemblyNames)&&e.assemblyNames.length>0?{...e,adapter:{...o,assemblyNames:e.assemblyNames}}:e}function ot({walksUri:e,walksLocation:o}){let{uri:t,localPath:r,name:a}=m(o)?o:{};return typeof e=="string"&&e!==""?`${e}${T}`:typeof t=="string"?P(t).name:typeof r=="string"?r:typeof a=="string"?a:void 0}function tt(e){let o=m(e.adapter)?e.adapter:void 0,[t]=Array.isArray(e.assemblyNames)?e.assemblyNames:[],r=o&&ze(o)?ot(o):void 0,a=r?Ge(r):void 0;return o&&t&&a&&a!==t&&o.assemblyNameToPanSN===void 0?{...e,adapter:{...o,assemblyNameToPanSN:{[t]:a}}}:e}function ge(e){e.addToExtensionPoint("Core-preProcessTrackConfig",et),e.addToExtensionPoint("Core-preProcessTrackConfig",tt),e.addToExtensionPoint("Core-guessAdapterForLocation",o=>(t,r,a)=>To(t,r,a)??o(t,r,a)),e.addToExtensionPoint("Core-guessTrackTypeForLocation",o=>(t,r)=>ve.has(t)?"GraphTrack":t==="MinigraphBubbleAdapter"?"FeatureTrack":o(t,r))}function fe(e){let o;if(m(e)){let{refName:t,start:r,end:a,assemblyName:s}=e;typeof t=="string"&&typeof r=="number"&&typeof a=="number"&&(o={refName:t,start:r,end:a,assemblyName:typeof s=="string"?s:void 0})}return o}function rt(e,o,t){let r=e.connectedViewId;return r===void 0||r===o||!t.has(r)}function xo(e,o){return e.assemblyName===void 0||o===void 0||o.includes(e.assemblyName)}function So(e){return(Array.isArray(e.tracks)?e.tracks:[]).flatMap(t=>m(t)&&Array.isArray(t.displays)?t.displays.filter(r=>m(r)&&r.type==="LinearGraphDisplay"):[])}function Ao(e,o,t){let r=[],a=Ue(e),s=new Set(a.map(i=>m(i)?i.id:void 0));for(let i of a){if(m(i)&&i.id===o)for(let c of So(i)){let C=fe(c.hoverHighlight);C&&xo(C,t)&&r.push({key:typeof c.id=="string"?c.id:"graph-track",region:C})}for(let c of m(i)?[...So(i),...i.type==="GraphGenomeView"?[i]:[]]:[])(Array.isArray(c.assemblyHoverHighlights)?c.assemblyHoverHighlights:[]).forEach((Fo,Io)=>{let U=fe(Fo);U?.assemblyName!==void 0&&t?.includes(U.assemblyName)&&r.push({key:`${typeof c.id=="string"?c.id:"graph"}-${Io}`,region:U})});if(m(i)&&i.type==="GraphGenomeView"&&rt(i,o,s)){let c=fe(i.hoverHighlight);c&&xo(c,t)&&r.push({key:typeof i.id=="string"?i.id:"graph",region:c})}}return r}var at=qe()(e=>({highlight:{height:"100%",position:"absolute",background:R(e.palette.primary.main,.08),borderLeft:`1px solid ${R(e.palette.primary.main,.4)}`,borderRight:`1px solid ${R(e.palette.primary.main,.4)}`,pointerEvents:"none",zIndex:10}})),nt=X(function({model:o,region:t}){let{classes:r}=at(),a=o.getHighlightCoords(t);return a?k("div",{"data-testid":"graph-node-highlight",className:r.highlight,style:{left:a.left,width:a.width}}):null}),it=X(function({model:o}){let{views:t}=g(o);return k(Se,{children:Ao([...t],o.id,o.assemblyNames).map(({key:r,region:a})=>k(nt,{model:o,region:a},`graph-hover-${r}`))})}),Go=it;var st="LinearGenomeView-TracksContainerComponent";function ye(e){e.contributeToExtensionPoint(st,({model:o})=>k(Go,{model:o},"graphgenomeview-hover-highlight"))}function pt(e){return e.views(o=>({get adapterConfig(){return Ye(o,we(o).configuration)}}))}function he(e){e.addToExtensionPoint("Core-extendPluggableElement",o=>(o instanceof L&&ne.includes(o.name)&&o.extendStateModel(pt),o))}var Lo="GraphGenomeView";var Mo="10.4.3";var be=class extends to{constructor(){super(...arguments);this.name=Lo;this.version=Mo}install(t){ae(t),pe(t),ie(t),se(t),ye(t),ce(t),de(t),oe(t),ue(t),le(t),me(t),te(t),ge(t),he(t),t.addRpcMethod(()=>new I(t)),t.addRpcMethod(()=>new Ne(t)),t.addRpcMethod(()=>new Ve(t)),t.addRpcMethod(()=>new F(t))}configure(t){bo(t);try{Te(t.rootModel)&&t.rootModel.appendToSubMenu(["Add"],{label:"Graph genome view",icon:Ae,onClick:r=>{r.addView("GraphGenomeView",{})}})}catch(r){console.warn("[GraphGenomeView] could not add the Add menu entry",r)}}};export{be as default};
|
|
2
2
|
//# sourceMappingURL=jbrowse-plugin-graphgenomeviewer.esm.js.map
|