/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import "@arcgis/toolkit/type";
import { a as s, j as o } from "./series-types.js";
import { a as u } from "./rest-js-object-literals.js";
import { cU as p, de as f, b } from "./index.js";
import "@arcgis/toolkit/intl";
import "lodash-es";
import "luxon";
import "d3-array";
import "@arcgis/core/Graphic.js";
import "@arcgis/core/renderers/support/jsonUtils.js";
import "@arcgis/core/symbols/support/symbolUtils.js";
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 { i as y } from "./utils.js";
import { F as m, W as d } from "./interfaces.js";
import { F as r } from "./common.js";
const G = {
  DebounceTimer: 400,
  SliderTimer: 100,
  PopoverTimer: 60,
  customSortLimit: 100
}, R = 10, q = {
  style: "decimal",
  minimumFractionDigits: 0,
  maximumFractionDigits: 3
}, X = [
  s.Count,
  s.Sum,
  s.Average,
  s.ContinuousPercentile,
  s.Minimum,
  s.Maximum,
  s.NoAggregation
], $ = [s.Count, s.Sum];
function J(e) {
  let t;
  switch (e) {
    case r.Title:
    case r.XAxisTitle:
    case r.YAxisTitle:
    case r.LegendTitle: {
      t = m.Title;
      break;
    }
    case r.Description:
    case r.LegendText: {
      t = m.Text;
      break;
    }
    case r.AxisLabels:
    case r.GuideLabels:
    case r.DataLabels: {
      t = m.Label;
      break;
    }
    case r.Background:
    case r.LeaderLines:
    case r.AxisLines:
    case r.GridLines: {
      t = m.Palette;
      break;
    }
  }
  return t;
}
function Q(e, t, i) {
  let a = !1;
  const n = typeof e == "string" ? Number.parseFloat(e) : e, c = typeof t == "string" ? Number.parseFloat(t) : t, l = typeof i == "string" ? Number.parseFloat(i) : i;
  return Number.isNaN(n) || (a = (c === void 0 || Number.isNaN(c) || n >= c) && (l === void 0 || Number.isNaN(l) || n <= l)), a;
}
function Z(e, t) {
  let i;
  if (e !== null) {
    const a = typeof e == "string" ? Number.parseFloat(e) : e;
    f(a) ? i = a : f(t) && (i = t);
  }
  return i === void 0 ? "" : `${i}`;
}
function _(e) {
  const { inputElement: t, status: i } = e;
  t.status = i;
}
const ee = {
  IDLE: "idle",
  INVALID: "invalid"
};
function te(e, t) {
  let i = "";
  if (e !== void 0 && !Number.isNaN(e)) {
    const a = p(document.documentElement);
    i = Intl.NumberFormat(a, t).format(e);
  }
  return i;
}
function ie(e, t) {
  let i = !1;
  if (t !== void 0) {
    const a = typeof t == "string" ? t.trim() : t, n = e.trim();
    typeof t == "string" ? i = a === n || a === b && n === "" : i = a.includes(n);
  }
  return i;
}
function ae(e) {
  let t;
  switch (e) {
    case "trailing":
      t = -200;
      break;
    case "leading":
      t = 20;
      break;
    default:
      t = 0;
      break;
  }
  return t;
}
function re(e) {
  return e === void 0 || Number.isNaN(e.r) || Number.isNaN(e.g) || Number.isNaN(e.b) ? null : e;
}
const ne = (e) => {
  ["e", "E"].includes(e.key) && e.preventDefault();
}, se = (e) => {
  if (e.pickListElement !== void 0) {
    const t = e.pickListElement.selectedItems;
    e.eventEmitter.emit({
      contentKind: e.contentKind,
      value: t.map((i) => i.value)
    });
  }
};
function oe(e) {
  let t = "solid";
  switch (e) {
    case u.Dash:
      t = "dashed";
      break;
    case u.Dot:
      t = "dotted";
      break;
    case u.Solid:
    default:
      t = "solid";
      break;
  }
  return t;
}
function me(e, t) {
  const i = document.createElement("a");
  i.style.display = "none", i.download = t, i.setAttribute("href", e), i.click(), i.remove(), URL.revokeObjectURL(e);
}
function ce(e) {
  return e != null && (e.style.removeProperty("opacity"), e.remove()), null;
}
function le(e) {
  const t = !y(e?.config), i = e.xTemporalBinning?.unit, a = e.yTemporalBinning?.unit;
  let n;
  return t && i !== void 0 && a !== void 0 && (i === o.HourOfDay && a === o.DayOfWeek ? n = d.WeekByDayOfWeekAndHourOfDay : i === o.DayOfMonth && a === o.MonthOfYear && (n = d.YearByMonthAndDayOfMonth)), n;
}
export {
  q as D,
  ee as U,
  G as a,
  X as b,
  ie as c,
  ce as d,
  se as e,
  re as f,
  oe as g,
  ne as h,
  Q as i,
  le as j,
  te as k,
  ae as l,
  _ as m,
  J as n,
  me as o,
  $ as p,
  R as q,
  Z as s
};
