
  
import * as _lib from "./pkg_wasm";

const _qpToInternalCtx = (ctx) => {
    const sym = ctx.sym.toJSON();
    const bars = ctx.ohlcv.bars.map(r => r.toJSON());
    
    const internalSym = _lib.Sym.fromJSON(sym);
    const internalOhlcv = _lib.Ohlcv.fromBars(bars.map(r => _lib.OhlcvBar.fromJSON(r)));
    const internalCtx = new _lib.Ctx(internalOhlcv, internalSym);

    return internalCtx;
}

  
export function accdist(ctx) {
    return _lib.Incr_fn_accdist_f39f2f.make(_qpToInternalCtx(ctx)).collect()
  }

class AccdistLocals {
    constructor(inner) {
        self.__inner = inner
    }

    

      
}

export class Accdist {
  constructor(ctx) {
    this.ctx = _qpToInternalCtx(ctx);
    this.inner = _lib.Incr_fn_accdist_f39f2f.make(this.ctx)
    this.locals = AccdistLocals(this.inner)
  }

/* 
getCtx() {
    throw new Error("Not implemented yet");
  }
    */

  next() {
    return this.inner.next()
  }
}
    

export function rsi(ctx, src, length) {
    return _lib.Incr_fn_rsi_3efcf2.make(_qpToInternalCtx(ctx)).collect(src, length)
  }

class RsiLocals {
    constructor(inner) {
        self.__inner = inner
    }

    

      
}

export class Rsi {
  constructor(ctx) {
    this.ctx = _qpToInternalCtx(ctx);
    this.inner = _lib.Incr_fn_rsi_3efcf2.make(this.ctx)
    this.locals = RsiLocals(this.inner)
  }

/* 
getCtx() {
    throw new Error("Not implemented yet");
  }
    */

  next(src, length) {
    return this.inner.next(src, length)
  }
}
    
  
 /* module.exports = {
      accdist,Accdist,rsi,Rsi
  }*/
          