/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import { C as h, m as s } from "./model-setter.js";
import "@arcgis/toolkit/intl";
import "lodash-es";
import "luxon";
import "d3-array";
import "@arcgis/toolkit/type";
import { d as m } from "./series-types.js";
import { aP as b, bI as r, aN as v, aX as d } 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 { C as f } from "./chart-model.js";
var y = Object.defineProperty, L = Object.getOwnPropertyDescriptor, u = (t, e, i, p) => {
  for (var o = L(e, i), l = t.length - 1, n; l >= 0; l--)
    (n = t[l]) && (o = n(e, i, o) || o);
  return o && y(e, i, o), o;
};
const x = (t) => t.colorMatch ?? !0, D = (t, e) => {
  e.colorMatch = t;
};
class M extends h {
  /**
   * Whether the chart should attempt to match the data source's colors.
   *
   * `true`: Attempt to match the data source's colors.
   * `false`: Use the colors defined in the config.
   */
  get colorMatch() {
    return x(this._config);
  }
  set colorMatch(e) {
    D(e, this._config);
  }
}
u([
  s
], M.prototype, "colorMatch");
var V = Object.defineProperty, P = Object.getOwnPropertyDescriptor, C = (t, e, i, p) => {
  for (var o = P(e, i), l = t.length - 1, n; l >= 0; l--)
    (n = t[l]) && (o = n(e, i, o) || o);
  return o && V(e, i, o), o;
};
const O = (t) => t.series[0]?.dataLabels?.visible ?? !1, R = (t, e) => {
  e.series.forEach((i) => {
    i.dataLabels !== void 0 ? i.dataLabels.visible = t : i.dataLabels = b({
      text: "",
      visible: t,
      font: v(r.DataLabels),
      type: r.DataLabels
    });
  });
};
class w extends h {
  /**
   * Whether data labels are visible.
   */
  get dataLabelsVisibility() {
    return O(this._config);
  }
  set dataLabelsVisibility(e) {
    R(e, this._config);
  }
}
C([
  s
], w.prototype, "dataLabelsVisibility");
const S = (t) => {
  let e = !1;
  return t.legend !== void 0 && (e = t.legend.visible ?? !0), e;
}, $ = (t, e) => {
  e.legend === void 0 && (e.legend = d()), e.legend.visible = t;
}, j = (t) => t.legend?.title?.content, H = (t, e) => {
  e.legend === void 0 && (e.legend = d()), (e.legend.title === void 0 || t === void 0) && (e.legend.title = b({
    text: "",
    visible: !0,
    font: v(r.LegendTitle),
    type: r.LegendTitle
  })), t !== void 0 && (e.legend.title.content = t);
}, W = (t) => t.legend?.body, E = (t, e) => {
  e.legend === void 0 && (e.legend = d()), e.legend.body = t ?? b({
    text: "",
    visible: !0,
    font: v(r.LegendText),
    type: r.LegendText
  }).content;
}, c = (t) => t.legend?.title?.content.text ?? "", k = (t, e) => {
  if (e.legend?.title !== void 0)
    e.legend.title.content.text = t;
  else if (e.legend === void 0 && t !== void 0) {
    const i = d();
    i.title !== void 0 && (i.title.content.text = t, i.title.visible = !0, e.legend = i);
  }
}, B = (t) => t.legend?.title?.visible ?? !1, F = (t, e) => {
  if (e.legend?.title !== void 0)
    e.legend.title.visible = t;
  else if (e.legend !== void 0 && e.legend?.title === void 0 && t)
    e.legend.title = b({
      text: c(e),
      visible: t,
      font: v(r.LegendTitle),
      type: r.LegendTitle
    });
  else if (e.legend === void 0) {
    const i = d();
    i.title = b({
      text: c(e),
      visible: t,
      font: v(r.LegendTitle),
      type: r.LegendTitle
    }), e.legend = i;
  }
}, N = (t) => t.legend?.position ?? m.Right, X = (t, e) => {
  if (e.legend !== void 0)
    e.legend.position = t;
  else if (e.legend === void 0) {
    const i = d();
    i.position = t, e.legend = i;
  }
}, q = (t) => t.legend?.roundMarkers ?? !1, z = (t, e) => {
  e.legend === void 0 && (e.legend = d()), e.legend.roundMarkers = t;
}, A = (t) => t.legend?.maxHeight ?? void 0, G = (t, e) => {
  e.legend === void 0 && (e.legend = d()), e.legend.maxHeight = t;
};
var J = Object.defineProperty, K = Object.getOwnPropertyDescriptor, a = (t, e, i, p) => {
  for (var o = K(e, i), l = t.length - 1, n; l >= 0; l--)
    (n = t[l]) && (o = n(e, i, o) || o);
  return o && J(e, i, o), o;
};
class g extends f {
  // ---------------------------------------------------------------------------------------------
  // Data Props
  // ---------------------------------------------------------------------------------------------
  /**
   * Whether the legend title is visible.
   */
  get legendVisibility() {
    return S(this._config);
  }
  set legendVisibility(e) {
    $(e, this._config);
  }
  // ---------------------------------------------------------------------------------------------
  // General Props
  // ---------------------------------------------------------------------------------------------
  /**
   * The legend title text.
   */
  get legendTitleText() {
    return c(this._config);
  }
  set legendTitleText(e) {
    k(e, this._config);
  }
  /**
   * Whether the legend title is visible.
   */
  get legendTitleVisibility() {
    return B(this._config);
  }
  set legendTitleVisibility(e) {
    F(e, this._config);
  }
  /**
   * Legend position: `top`, `bottom`, `left`, or `right`.
   */
  get legendPosition() {
    return N(this._config);
  }
  set legendPosition(e) {
    X(e, this._config);
  }
  // ---------------------------------------------------------------------------------------------
  // Format Props
  // ---------------------------------------------------------------------------------------------
  /**
   * Legend title text symbol (font, color, style).
   */
  get legendTitleSymbol() {
    return j(this._config);
  }
  set legendTitleSymbol(e) {
    H(e, this._config);
  }
  /**
   * Legend item text symbol (font, color, style).
   */
  get legendTextSymbol() {
    return W(this._config);
  }
  set legendTextSymbol(e) {
    E(e, this._config);
  }
  /**
   * Maximum legend height.
   */
  get legendMaxHeight() {
    return A(this._config);
  }
  set legendMaxHeight(e) {
    e !== void 0 && G(e, this._config);
  }
  /**
   * Whether legend markers are rounded.
   */
  get legendRoundMarker() {
    return q(this._config);
  }
  set legendRoundMarker(e) {
    z(e, this._config);
  }
}
a([
  s
], g.prototype, "legendVisibility");
a([
  s
], g.prototype, "legendTitleText");
a([
  s
], g.prototype, "legendTitleVisibility");
a([
  s
], g.prototype, "legendPosition");
a([
  s
], g.prototype, "legendTitleSymbol");
a([
  s
], g.prototype, "legendTextSymbol");
a([
  s
], g.prototype, "legendMaxHeight");
a([
  s
], g.prototype, "legendRoundMarker");
const Q = (t, e) => t.series?.[e ?? 0]?.dataTooltipVisible ?? !0, U = (t, e, i) => {
  i && t.series?.[i] ? t.series[i].dataTooltipVisible = e : t.series && t.series.forEach((p) => {
    p.dataTooltipVisible = e;
  });
}, Y = (t, e) => t.series?.[e ?? 0]?.dataTooltipReverseColor ?? !1, Z = (t, e, i) => {
  i && t.series?.[i] ? t.series[i].dataTooltipReverseColor = e : t.series && t.series.forEach((p) => {
    p.dataTooltipReverseColor = e;
  });
};
var I = Object.defineProperty, ee = Object.getOwnPropertyDescriptor, T = (t, e, i, p) => {
  for (var o = ee(e, i), l = t.length - 1, n; l >= 0; l--)
    (n = t[l]) && (o = n(e, i, o) || o);
  return o && I(e, i, o), o;
};
class _ extends f {
  /**
   * Gets the visibility of the data tooltips.
   * - If the `seriesIndex` is provided, the visibility for that series will be returned. Otherwise, the visibility of the first series will be returned.
   * - If the visibility is not set on the series, the default value of `true` will be returned.
   *
   * @param seriesIndex - The index of the series.
   */
  getDataTooltipVisibility(e) {
    return Q(this._config, e);
  }
  setDataTooltipVisibility(e, i) {
    U(this._config, e, i);
  }
  /**
   * Gets the setting of the `dataTooltipReverseColor` property.
   * - If the `seriesIndex` is provided, the `dataTooltipReverseColor` for that series will be returned. Otherwise, the same property of the first series will be returned.
   * - If the `dataTooltipReverseColor` is not set on the series, the default value of `false` will be returned.
   *
   * @param seriesIndex - The index of the series.
   */
  getDataTooltipReverseColor(e) {
    return Y(this._config, e);
  }
  setDataTooltipReverseColor(e, i) {
    Z(this._config, e, i);
  }
}
T([
  s
], _.prototype, "setDataTooltipVisibility");
T([
  s
], _.prototype, "setDataTooltipReverseColor");
export {
  g as M,
  M as W,
  _ as a,
  w as b
};
