import * as a from "d3";
class d {
  constructor(i) {
    const { breaks: t, defaultFillColor: l, defaultBorderColor: o, defaultSize: h } = i;
    this.breaks = t, this.defaultFillColor = l, this.defaultBorderColor = o, this.defaultSize = h;
    const r = t.filter((e) => e.type !== "graterThan"), s = t.filter((e) => e.type === "graterThan");
    s.length > 0 && (this.graterThanStyle = s[0]), this.domain = r.map((e) => Number(e.end)), this.sizeScale = a.scaleThreshold().domain(this.domain).range(r.map((e) => e.size)), this.colorScale = a.scaleThreshold().domain(r.map((e) => e.end)).range(t.map((e) => e.color)), this.getSize = this.getSize.bind(this), this.getColor = this.getColor.bind(this);
  }
  getSize(i) {
    let t = 0;
    if (this.breaks.length > 0) {
      if (i > Math.max(...this.domain))
        return this.graterThanStyle.size;
      t = this.defaultSize + this.sizeScale(i);
    } else
      t = this.defaultSize;
    return console.log("size", t), t;
  }
  getColor(i, t) {
    return this.breaks.length > 0 ? i > Math.max(...this.domain) ? this.graterThanStyle.color : this.colorScale(i) : this.defaultFillColor;
  }
}
export {
  d as default
};
