"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[7409],{27409:(e,t,s)=>{s.r(t),s.d(t,{default:()=>h});var a=s(46377),n=s(32595),r=s(99834),i=s(66885),o=s(6434),d=s(68120),c=s(52645),l=s(68584),f=s(77744);class h extends a.BaseFeatureDataAdapter{constructor(e,t,s){super(e,t,s);const a=(0,l.readConfObject)(e,"gffGzLocation"),n=(0,l.readConfObject)(e,["index","indexType"]),i=(0,l.readConfObject)(e,["index","location"]),o=(0,l.readConfObject)(e,"dontRedispatch");this.dontRedispatch=o||["chromosome","contig","region"],this.gff=new d.wD({filehandle:(0,r.openLocation)(a,this.pluginManager),csiFilehandle:"CSI"===n?(0,r.openLocation)(i,this.pluginManager):void 0,tbiFilehandle:"CSI"!==n?(0,r.openLocation)(i,this.pluginManager):void 0,chunkCacheSize:52428800,renameRefSeqs:e=>e})}async getRefNames(e={}){return this.gff.getReferenceSequenceNames(e)}async getHeader(){return this.gff.getHeader()}getFeatures(e,t={}){return(0,i.ObservableCreate)((async s=>{const a=await this.gff.getMetadata();await this.getFeaturesHelper(e,t,a,s,!0)}),t.signal)}async getFeaturesHelper(e,t,s,a,r,i=e){try{const d=[];if(await this.gff.getLines(e.refName,e.start,e.end,((e,t)=>{d.push(this.parseLine(s.columnNumbers,e,t))})),r&&d.length){let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(const e of d){const t=e.fields[2];if(!this.dontRedispatch.includes(t)){const t=e.start-1;t<n&&(n=t),e.end>r&&(r=e.end)}}if(r>e.end||n<e.start)return void await this.getFeaturesHelper({...e,start:n,end:r},t,s,a,!1,e)}const l=d.map((e=>(e.fields[8]&&"."!==e.fields[8]?e.fields[8].includes("_lineHash")||(e.fields[8]+=`;_lineHash=${e.lineHash}`):e.fields[8]=`_lineHash=${e.lineHash}`,e.fields.join("\t")))).join("\n");for(const e of(0,c.g)(l))for(const t of e){const e=new o.A({data:(0,f.d)(t),id:`${this.id}-offset-${t.attributes?._lineHash?.[0]}`});(0,n.R6)(e.get("start"),e.get("end"),i.start,i.end)&&a.next(e)}a.complete()}catch(e){a.error(e)}}parseLine(e,t,s){const a=t.split("\t");return{start:+a[e.start-1],end:+a[e.end-1],lineHash:s,fields:a}}freeResources(){}}},77744:(e,t,s)=>{function a(e){const{end:t,start:s,child_features:n,derived_features:r,attributes:i,type:o,source:d,phase:c,seq_id:l,score:f,strand:h}=e;let u;"+"===h?u=1:"-"===h?u=-1:"."===h&&(u=0);const g=new Set(["start","end","seq_id","score","type","source","phase","strand"]),p=i||{},b={};for(const e of Object.keys(p)){let t=e.toLowerCase();if(g.has(t)&&(t+="2"),p[e]&&"_lineHash"!==e){let s=p[e];Array.isArray(s)&&1===s.length&&([s]=s),b[t]=s}}return{...b,start:s-1,end:t,strand:u,type:o,source:d,refName:l,derived_features:r,phase:null===c?void 0:Number(c),score:null===f?void 0:f,subfeatures:n.flatMap((e=>e.map((e=>a(e)))))}}s.d(t,{d:()=>a})}}]);
//# sourceMappingURL=7409.8e71acc1.chunk.js.map