"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(32598),s=a(46377),n=a(99546),o=a(99834),i=a(66885),c=a(6434),l=a(52645),d=a(77744);class u extends s.BaseFeatureDataAdapter{calculatedIntervalTreeMap={};async loadDataP(e){const{statusCallback:t=()=>{}}=e||{},a=await(0,n.fetchAndMaybeUnzip)((0,o.openLocation)(this.getConf("gffLocation"),this.pluginManager)),s=[],i={},u=new TextDecoder("utf8");let h=0,f=0;for(;h<a.length;){const e=a.indexOf(10,h),r=-1===e?a.subarray(h):a.subarray(h,e),n=u.decode(r).trim();if(n)if(n.startsWith("#"))s.push(n);else{if(n.startsWith(">"))break;{const e=n.indexOf("\t"),t=n.slice(0,e);i[t]||(i[t]=""),i[t]+=`${n}\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(i).map((([e,t])=>[e,a=>{if(!this.calculatedIntervalTreeMap[e]){a?.("Parsing GFF data");const s=new r.Ay;(0,l.g)(t).flat().map(((t,a)=>new c.A({data:(0,d.d)(t),id:`${this.id}-${e}-${a}`}))).forEach((e=>s.insert([e.get("start"),e.get("end")],e))),this.calculatedIntervalTreeMap[e]=s}return this.calculatedIntervalTreeMap[e]}])));return{header:s.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,i.ObservableCreate)((async a=>{try{const{start:r,end:s,refName:n}=e,{intervalTreeMap:o}=await this.loadData(t);o[n]?.(t.statusCallback).search([r,s]).forEach((e=>{a.next(e)})),a.complete()}catch(e){a.error(e)}}),t.stopToken)}freeResources(){}}},77744:(e,t,a)=>{function r(e){const{end:t,start:a,child_features:s,derived_features:n,attributes:o,type:i,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"]),b=o||{},g={};for(const e of Object.keys(b)){let t=e.toLowerCase();if(p.has(t)&&(t+="2"),b[e]&&"_lineHash"!==e){let a=b[e];Array.isArray(a)&&1===a.length&&([a]=a),g[t]=a}}return{...g,start:a-1,end:t,strand:f,type:i,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.d8bc1c52.chunk.js.map