"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[6800],{96800:(e,t,a)=>{a.r(t),a.d(t,{default:()=>c});var n=a(75466),i=a(46377),r=a(99546),s=a(99834),o=a(66885);class c extends i.BaseFeatureDataAdapter{async configurePre(){const e=this.pluginManager,t=this.getConf("bedGraphGzLocation"),a=this.getConf(["index","location"]),i=this.getConf(["index","indexType"]),r=(0,s.openLocation)(t,e),o="CSI"===i,c=new n.wD({filehandle:r,csiFilehandle:o?(0,s.openLocation)(a,e):void 0,tbiFilehandle:o?void 0:(0,s.openLocation)(a,e),chunkCacheSize:52428800}),d=this.getConf("columnNames"),h=await c.getHeader();return{columnNames:d,bedGraph:c,header:h}}async configure(){return this.configured||(this.configured=this.configurePre().catch(e=>{throw this.configured=void 0,e})),this.configured}async getNames(){const{bedGraph:e,columnNames:t}=await this.configure();if(t.length)return t;const a=(await e.getHeader()).split(/\n|\r\n|\r/).filter(e=>!!e).at(-1);return a?.includes("\t")?a.slice(1).split("\t").map(e=>e.trim()):void 0}async getRefNames(e={}){const{bedGraph:t}=await this.configure();return t.getReferenceSequenceNames(e)}async getHeader(){const{bedGraph:e}=await this.configure();return e.getHeader()}getFeatures(e,t={}){return(0,o.ObservableCreate)(async a=>{const{bedGraph:n}=await this.configure(),i=await n.getMetadata(),{columnNumbers:s}=i,o=s.ref-1,c=s.start-1,d=s.end-1,h=c===d,u=(await this.getNames())?.slice(h?2:3)||[];await n.getLines(e.refName,e.start+(h?-1:0),e.end,{lineCallback:(e,t)=>{const n=e.split("\t"),i=n[o],s=+n[c],l=+(h?s+1:n[d]),g=n.slice(d+1);if(Number.isNaN(s)||Number.isNaN(l))throw new Error(`start/end NaN on line "${e}", with colStart:${c} and colEnd:${d}. run "tabix -p bed" to ensure bed preset`);for(let e=0;e<g.length;e++){const n=`${this.id}-${t}-${e}`,o=Math.abs(+g[e]),c=u[e]||`col${e}`;o&&a.next(new r.SimpleFeature({id:n,data:{refName:i,start:s,end:l,score:o,source:c}}))}},...t}),a.complete()})}}}}]);
//# sourceMappingURL=6800.22efb34e.chunk.js.map