import O from "./Colors.js";
class D extends O {
  constructor(i, _, r, C, v, h, u, g, a, e, f, x, p) {
    if (super(r, C, v, g, a), this._manualColor = {}, this._manualColor[x] = e ? e.Overall : null, i != "csv") {
      const y = (t) => {
        const o = [...h][t];
        o && (c = o.items), e != null && e != null && Object.keys(e).forEach((s) => {
          const l = c.filter((n) => n.code === s);
          if (l.length > 0 && l[0].labels) {
            let n;
            f && (n = l[0].labels[f.toUpperCase()]), n ? this._manualColor[n] = e[s] : this._manualColor[l[0].value] = e[s];
          }
        });
      }, b = () => {
        c = u, Object.keys(e).forEach((t) => {
          const o = [...c].filter((s) => s.value === t);
          if (o.length > 0 && o[0].labels) {
            const s = p[t];
            p && s && (this._manualColor[s] = e[t]);
            let l;
            f && (l = o[0].labels[f.toUpperCase()]), l ? this._manualColor[l] = e[t] : this._manualColor[o[0].label] = e[t];
          }
        });
      }, B = () => {
        Object.keys(e).forEach((t) => {
          this._manualColor[t] = e[t];
        });
      };
      let c = [];
      const m = _ == "line" ? 1 : r === "index" ? 0 : 1;
      !h && !u ? B() : h ? h.size == 1 && m == 1 ? a == "measure" ? y(0) : b() : y(m) : b();
    } else
      this._manualColor = e && e[r] ? e[r] : {};
  }
  getColor(i, _) {
    if (this.colorBy === "index") {
      const r = this._manualColor[i] || this._manualColor[_[this.indexBy]];
      return r || "#5555";
    }
    return this.colorBy === "id" && this._manualColor[i] ? this._manualColor[i] : "#5555";
  }
  getColorByIndex(i) {
  }
  getColorByKey(i) {
    return this._manualColor[i] ? this._manualColor[i] : "#5555";
  }
}
export {
  D as default
};
