import{B as v}from"./index-P3rx-5SH.js";import{f as F,t as E,u as n}from"./rpcWorker-CVTx5FIM.js";import{r as $}from"./rxjs-Dgg09m9e.js";class B extends v.BaseFeatureDataAdapter{async configure(){var e;const o=await((e=this.getSubAdapter)===null||e===void 0?void 0:e.call(this,this.getConf("sequenceAdapter")));if(!o)throw new Error("Error getting subadapter");return o.dataAdapter}async getRefNames(){return(await this.configure()).getRefNames()}getFeatures(e,o){return $.ObservableCreate(async c=>{var d;const g=await this.configure(),h=1e4,r=e.end+h,i=Math.max(0,e.start-h);if(r<0||i>r){c.complete();return}const l=g.getFeatures({...e,start:i,end:r},o),m=((d=(await F(l.pipe(E())))[0])===null||d===void 0?void 0:d.get("seq"))||"",p=this.getConf("search"),x=this.getConf("searchForward"),w=this.getConf("searchReverse"),A=this.getConf("caseInsensitive"),u=new RegExp(p,`g${A?"i":""}`);if(p){if(x){const f=m.matchAll(u);for(const t of f){const s=i+t.index,a=i+t.index+t[0].length;n.doesIntersect2(s,a,e.start,e.end)&&c.next(new n.SimpleFeature({uniqueId:`${this.id}-${s}-${t[0]}-pos`,refName:e.refName,start:s,end:a,name:t[0],strand:1}))}}if(w){const f=n.revcom(m).matchAll(u);for(const t of f){const s=r-t.index,a=r-t.index-t[0].length;n.doesIntersect2(a,s,e.start,e.end)&&c.next(new n.SimpleFeature({uniqueId:`${this.id}-${a}-${t[0]}-neg`,refName:e.refName,start:a,end:s,name:t[0],strand:-1}))}}}c.complete()})}freeResources(){}}export{B as default};
