import { B as g } from "./BaseColumnSeries.C7jwOxIJ.js";
import { G as D, L as k, T as w, R as C, m as _, e as O } from "./am-chart.H2jnOzFc.js";
class m extends g {
  constructor() {
    super(...arguments), this.allColumns = this.children.push(D.new(this._root, {})), this.allColumnsData = [], this.columns = this.addDisposer(new k(w.new({}), () => C._new(this._root, {
      position: "absolute",
      themeTags: _(this.columns.template.get("themeTags", []), ["series", "column"])
    }, [this.columns.template])));
  }
  /**
   * @ignore
   */
  makeColumn(e, t) {
    const s = t.make();
    return this.get("turboMode") ? s.virtualParent = this.chart : this.mainContainer.children.push(s), s._setDataItem(e), t.push(s), s;
  }
  _processAxisRange(e) {
    super._processAxisRange(e), e.columns = new k(w.new({}), () => C._new(this._root, {
      position: "absolute",
      themeTags: _(e.columns.template.get("themeTags", []), ["series", "column"])
    }, [this.columns.template, e.columns.template]));
  }
  _beforeColumnsDraw() {
    this.allColumnsData = [];
  }
  _afterColumnsDraw() {
    this.get("turboMode") && this.allColumns.set("draw", (e) => {
      e.clear(), O(this.allColumnsData, (t) => {
        const s = t.width, o = t.height, i = t.x, n = t.y, a = t.stroke, r = t.fill, h = t.strokeWidth, u = t.strokeOpacity, c = t.fillOpacity;
        e.beginFill(r, c), e.beginPath(), e.lineStyle(h, a, u), e.drawRect(i, n, s, o), e.endStroke(), e.endFill();
      });
    });
  }
  _updateChildren() {
    this.isDirty("turboMode") && (this.markDirtyValues(), this.get("turboMode") || this.allColumns.set("draw", void 0)), super._updateChildren();
  }
  _updateSeriesGraphics(e, t, s, o, i, n, a, r) {
    if (this.get("turboMode")) {
      t.virtualParent = this.chart, t.parent && (this.mainContainer.children.removeValue(t), t._parent = void 0);
      const h = t.get("stroke"), u = t.get("fillOpacity", 1), c = t.get("strokeOpacity", 1), y = t.get("strokeWidth", 1), x = t.get("fill"), p = this.getPoint(s, i), d = this.getPoint(o, n), l = e.get("point");
      if (l) {
        const f = this.getPoint(l.x, l.y);
        l.x = f.x + this._x, l.y = f.y + this._y;
      }
      s = p.x, o = d.x, i = p.y, n = d.y, e.setRaw("left", s), e.setRaw("right", o), e.setRaw("top", i), e.setRaw("bottom", n), this.allColumnsData.push({ width: o - s, height: n - i, x: s, y: i, stroke: h, fill: x, strokeWidth: y, strokeOpacity: c, fillOpacity: u });
    } else
      t.parent || this.mainContainer.children.push(t), super._updateSeriesGraphics(e, t, s, o, i, n, a, r);
  }
}
m.className = "ColumnSeries";
m.classNames = g.classNames.concat([m.className]);
export {
  m as C
};
