import{c as u}from"./rpcWorker-CVTx5FIM.js";import{B as c}from"./index-P3rx-5SH.js";import{r as m}from"./rxjs-Dgg09m9e.js";import{S as i}from"./simpleFeature-DW3q5zmr.js";function p(f){const e=new Map;for(const r of f){const t=new i(r),s=t.get("refName");let a=e.get(s);a||(a=[],e.set(s,a)),a.push(t)}for(const r of e.values())r.sort((t,s)=>t.get("start")-s.get("start"));return e}class N extends c.BaseFeatureDataAdapter{constructor(e,r,t){super(e,r,t);const s=u.readConfObject(e,"features");this.features=p(s)}async getRefNames(){return[...this.features.keys()]}async getRefNameAliases(){return[...this.features.values()].map(e=>({refName:e[0].get("refName"),aliases:e[0].get("aliases")}))}getFeatures(e){const{refName:r,start:t,end:s}=e;return m.ObservableCreate(async a=>{const n=this.features.get(r)||[];for(const o of n)o.get("end")>t&&o.get("start")<s&&a.next(o);a.complete()})}freeResources(){}}export{N as default,p as makeFeatures};
