"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[7809],{37809:(e,t,a)=>{a.r(t),a.d(t,{default:()=>u});var r=a(46377),s=a(99834),n=a(66885),i=a(32598),o=a(6434),c=a(52645),l=a(99546),d=a(77744);class u extends r.BaseFeatureDataAdapter{calculatedIntervalTreeMap={};async loadDataP(e){const{statusCallback:t=()=>{}}=e||{},a=await(0,l.fetchAndMaybeUnzip)((0,s.openLocation)(this.getConf("gffLocation"),this.pluginManager)),r=[],n={},u=new TextDecoder("utf8");let h=0,f=0;for(;h<a.length;){const e=a.indexOf("\n",h),s=-1===e?a.subarray(h):a.subarray(h,e),i=u.decode(s).trim();if(i)if(i.startsWith("#"))r.push(i);else{if(i.startsWith(">"))break;{const e=i.indexOf("\t"),t=i.slice(0,e);n[t]||(n[t]=""),n[t]+=`${i}\n`}}f++%1e4==0&&t(`Loading ${Math.floor(h/1e6).toLocaleString("en-US")}/${Math.floor(a.length/1e6).toLocaleString("en-US")} MB`),h=e+1}const p=Object.fromEntries(Object.entries(n).map((([e,t])=>[e,a=>{if(!this.calculatedIntervalTreeMap[e]){a?.("Parsing GFF data");const r=new i.Ay;(0,c.g)(t).flat().map(((t,a)=>new o.A({data:(0,d.d)(t),id:`${this.id}-${e}-${a}`}))).forEach((e=>r.insert([e.get("start"),e.get("end")],e))),this.calculatedIntervalTreeMap[e]=r}return this.calculatedIntervalTreeMap[e]}])));return{header:r.join("\n"),intervalTreeMap:p}}async loadData(e){return this.gffFeatures||(this.gffFeatures=this.loadDataP(e).catch((e=>{throw this.gffFeatures=void 0,e}))),this.gffFeatures}async getRefNames(e={}){const{intervalTreeMap:t}=await this.loadData(e);return Object.keys(t)}async getHeader(e={}){const{header:t}=await this.loadData(e);return t}getFeatures(e,t={}){return(0,n.ObservableCreate)((async a=>{try{const{start:r,end:s,refName:n}=e,{intervalTreeMap:i}=await this.loadData(t);i[n]?.(t.statusCallback).search([r,s]).forEach((e=>{a.next(e)})),a.complete()}catch(e){a.error(e)}}),t.signal)}freeResources(){}}},77744:(e,t,a)=>{function r(e){const{end:t,start:a,child_features:s,derived_features:n,attributes:i,type:o,source:c,phase:l,seq_id:d,score:u,strand:h}=e;let f;"+"===h?f=1:"-"===h?f=-1:"."===h&&(f=0);const p=new Set(["start","end","seq_id","score","type","source","phase","strand"]),g=i||{},b={};for(const e of Object.keys(g)){let t=e.toLowerCase();if(p.has(t)&&(t+="2"),g[e]&&"_lineHash"!==e){let a=g[e];Array.isArray(a)&&1===a.length&&([a]=a),b[t]=a}}return{...b,start:a-1,end:t,strand:f,type:o,source:c,refName:d,derived_features:n,phase:null===l?void 0:Number(l),score:null===u?void 0:u,subfeatures:s.flatMap((e=>e.map((e=>r(e)))))}}a.d(t,{d:()=>r})}}]);
//# sourceMappingURL=7809.41965eb6.chunk.js.map