/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import "@arcgis/toolkit/intl";
import "lodash-es";
import "luxon";
import "d3-array";
import "@arcgis/toolkit/type";
import { W as h } from "./series-types.js";
import { bn as d, bb as n, bR as o, aJ as S, ar as c } from "./index.js";
import "@arcgis/core/Graphic.js";
import "@arcgis/core/renderers/support/jsonUtils.js";
import "@arcgis/core/symbols/support/symbolUtils.js";
import "@esri/arcgis-html-sanitizer";
import "@arcgis/core/intl.js";
import "@arcgis/core/layers/support/FeatureFilter.js";
import "@arcgis/core/smartMapping/statistics/histogram.js";
import "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
import "simple-statistics";
import "@arcgis/core/request.js";
import "@arcgis/core/core/sql.js";
import "@arcgis/core/AttributeBinsGraphic.js";
import "@arcgis/core/geometry/support/jsonUtils.js";
import "@arcgis/core/rest/support/AttributeBinsQuery.js";
import "@arcgis/core/rest/support/StatisticDefinition.js";
import "@arcgis/core/time/TimeExtent.js";
import "@arcgis/core/core/promiseUtils.js";
import "./runtime.js";
import "@arcgis/toolkit/dom";
import { a as p } from "./utils.js";
import { S as y, s as g, a as u } from "./serial-chart-model.js";
import { s as b, a as v, b as I, c as _, d as C, W as M } from "./negative-values-stacked-to-baseline.js";
import { g as m } from "./serial-chart-data.js";
import { m as k } from "./model-setter.js";
import { M as D } from "./model-with-line-marker-styling.js";
var F = Object.defineProperty, L = Object.getOwnPropertyDescriptor, x = (a, e, r, t) => {
  for (var i = L(e, r), s = a.length - 1, l; s >= 0; s--)
    (l = a[s]) && (i = l(e, r, i) || i);
  return i && F(e, r, i), i;
};
class f extends y {
  constructor() {
    super(...arguments), this._chartType = h.RadarSeries;
  }
  async setup(e) {
    await this.loadConfigFromLayer(e), this.setupLocalProps(), e.config !== void 0 && await this.updateSeriesFromLayerFilter(), this.initDefaultSeries(), typeof this.resolveSetup == "function" && this.resolveSetup();
  }
  // ---------------------------------------------------------------------------------------------
  // Protected methods
  // ---------------------------------------------------------------------------------------------
  /** @private */
  generateDefaultConfig() {
    const e = d(this.commonStrings);
    return e.series = [
      n({
        commonStrings: this.commonStrings,
        objectIDField: o(this.layerInfo.layer).idField
      })
    ], e;
  }
  /**
   * Initializes the default series for the radar chart. Used in resetting the series styling.
   * @private
   */
  initDefaultSeries() {
    this.defaultSeries = n({
      commonStrings: this.commonStrings,
      objectIDField: o(this.layerInfo.layer).idField
    });
  }
  resetSeriesStyling() {
    for (let e = 0; e < this.seriesLength; e += 1) {
      const r = S({
        colorIndex: e,
        opacity: c
      });
      if (g(r, e, this._config), b(r, e, this._config), this.layerInfo !== void 0) {
        const t = this.getSeriesId(e), i = m({
          config: this._config,
          seriesIndex: e,
          layerInfo: this.layerInfo,
          commonStrings: this.commonStrings
        });
        i !== o(this.layerInfo.layer).idField && u(i ?? t, e, this._config);
      }
      v(this.defaultSeries?.lineSymbol?.style, e, this._config), I(this.defaultSeries?.lineSymbol?.width, e, this._config), _(this.defaultSeries?.markerSymbol?.style, e, this._config), C(this.defaultSeries?.markerSymbol?.size, e, this._config);
    }
    this._config.colorMatch = !0;
  }
  /**
   * Returns whether the series styling is able to be reset.
   */
  resetAvailable() {
    const e = !this.colorMatch;
    let r = !1;
    if (!e)
      for (let t = 0; t < this.seriesLength; t += 1) {
        if (this.layerInfo !== void 0) {
          const i = m({
            config: this._config,
            seriesIndex: t,
            layerInfo: this.layerInfo,
            commonStrings: this.commonStrings
          }), s = this.getSeriesName(t);
          i !== void 0 && i !== o(this.layerInfo.layer).idField && i !== s && (r = !0);
        }
        if (this.defaultSeries?.lineSymbol?.style !== void 0 && this.defaultSeries?.lineSymbol.style !== this.getSeriesLineStyle(t) || this.defaultSeries?.lineSymbol?.width !== void 0 && this.defaultSeries?.lineSymbol.width !== this.getSeriesLineWidth(t) || this.defaultSeries?.markerSymbol?.style !== void 0 && this.defaultSeries?.markerSymbol?.style !== this.getSeriesMarkerStyle(t) || this.defaultSeries?.markerSymbol?.size !== void 0 && this.defaultSeries?.markerSymbol?.size !== this.getSeriesMarkerSize(t)) {
          r = !0;
          break;
        }
      }
    return e || r;
  }
}
x([
  k
], f.prototype, "resetSeriesStyling");
const w = [M, D];
p(f, w);
export {
  f as RadarChartModel
};
