"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[6621],{66621:(e,t,a)=>{a.r(t),a.d(t,{default:()=>g});var n=a(35505),i=a(6854),s=a(46377),r=a(99546),c=a(99834),o=a(66885),u=a(54702);class g extends s.BaseFeatureDataAdapter{async configurePre(e){const t=this.getConf("vcfGzLocation"),a=this.getConf(["index","location"]),s=this.getConf(["index","indexType"]),r=(0,c.openLocation)(t,this.pluginManager),o="CSI"===s,u=new n.wD({filehandle:r,csiFilehandle:o?(0,c.openLocation)(a,this.pluginManager):void 0,tbiFilehandle:o?void 0:(0,c.openLocation)(a,this.pluginManager),chunkCacheSize:52428800});return{vcf:u,parser:new i.A({header:await u.getHeader()})}}async configurePre2(){return this.configured||(this.configured=this.configurePre().catch((e=>{throw this.configured=void 0,e}))),this.configured}async configure(e){const{statusCallback:t=()=>{}}=e||{};return(0,r.updateStatus)("Downloading index",t,(()=>this.configurePre2()))}async getRefNames(e={}){const{vcf:t}=await this.configure(e);return t.getReferenceSequenceNames(e)}async getHeader(e){const{vcf:t}=await this.configure(e);return t.getHeader()}async getMetadata(e){const{parser:t}=await this.configure(e);return t.getMetadata()}getFeatures(e,t={}){return(0,o.ObservableCreate)((async a=>{const{refName:n,start:i,end:s}=e,{statusCallback:c=()=>{}}=t,{vcf:o,parser:g}=await this.configure(t);await(0,r.updateStatus)("Downloading variants",c,(()=>o.getLines(n,i,s,{lineCallback:(e,t)=>{a.next(new u.A({variant:g.parseLine(e),parser:g,id:`${this.id}-vcf-${t}`}))},...t}))),a.complete()}),t.stopToken)}async getSources(){const e=this.getConf("samplesTsvLocation");if(""===e.uri||"/path/to/samples.tsv"===e.uri){const{parser:e}=await this.configure();return e.samples.map((e=>({name:e})))}{const t=(await(0,r.fetchAndMaybeUnzipText)((0,c.openLocation)(e,this.pluginManager))).split(/\n|\r\n|\r/),a=t[0].split("\t"),{parser:n}=await this.configure(),i=new Set(n.samples);return t.slice(1).map((e=>{const t=e.split("\t");return{name:t[0],...Object.fromEntries(t.slice(1).map(((e,t)=>[a[t+1],e])))}})).filter((e=>i.has(e.name)))}}freeResources(){}}}}]);
//# sourceMappingURL=6621.da2981b4.chunk.js.map