"use client";
import { createSelector as e } from "../../../../reselect/dist/reselect.js";
import { combineScaleFunction as W, combineDisplayedData as F, selectHasBar as H, combineRealScaleType as K, selectAxisRange as U, combineDuplicateDomain as j, combineCategoricalDomain as q, combineAxisDomainWithNiceTicks as z, combineGraphicalItemsData as J, combineAppliedValues as M, combineAxisDomain as Q, combineNiceTicks as X, combineGraphicalItemsSettings as Y, combineNumericalDomain as Z, itemAxisPredicate as _, getDomainDefinition as $, combineDomainOfStackGroups as ee, selectAllErrorBarSettings as te, combineAppliedNumericalValuesIncludingErrorValues as ie, mergeDomains as oe, combineStackGroups as ae, filterGraphicalNotStackedItems as re, combineDotsDomain as le, combineLinesDomain as ce, combineAreasDomain as se, selectReferenceDots as ne, filterReferenceElements as A, selectReferenceLines as me, selectReferenceAreas as pe } from "./axisSelectors.js";
import { selectChartLayout as s } from "../../context/chartLayoutContext.js";
import { isCategoricalAxis as fe } from "../../util/ChartUtils.js";
import { selectChartDataWithIndexes as d } from "./dataSelectors.js";
import { selectChartName as de, selectStackOffsetType as y } from "./rootPropsSelectors.js";
import { mathSign as ve } from "../../util/DataUtils.js";
import { combineAxisRangeWithReverse as Te } from "./combiners/combineAxisRangeWithReverse.js";
import { selectDefaultTooltipEventType as ue, selectValidateTooltipEventTypes as Ae, combineTooltipEventType as De } from "./selectTooltipEventType.js";
import { combineActiveLabel as be } from "./combiners/combineActiveLabel.js";
import { selectTooltipSettings as xe } from "./selectTooltipSettings.js";
import { combineTooltipInteractionState as he } from "./combiners/combineTooltipInteractionState.js";
import { combineActiveTooltipIndex as ge } from "./combiners/combineActiveTooltipIndex.js";
import { combineCoordinateForDefaultIndex as Se } from "./combiners/combineCoordinateForDefaultIndex.js";
import { selectChartWidth as Ie, selectChartHeight as ye } from "./containerSelectors.js";
import { selectChartOffsetInternal as Re } from "./selectChartOffsetInternal.js";
import { combineTooltipPayloadConfigurations as ke } from "./combiners/combineTooltipPayloadConfigurations.js";
import { selectTooltipPayloadSearcher as R } from "./selectTooltipPayloadSearcher.js";
import { selectTooltipState as k } from "./selectTooltipState.js";
import { combineTooltipPayload as Ce } from "./combiners/combineTooltipPayload.js";
import { selectTooltipAxisId as p } from "./selectTooltipAxisId.js";
import { selectTooltipAxisType as i } from "./selectTooltipAxisType.js";
import { selectTooltipAxis as o, selectTooltipAxisDataKey as Ge } from "./selectTooltipAxis.js";
import { combineDisplayedStackedData as Ee } from "./combiners/combineDisplayedStackedData.js";
import { isStacked as C } from "../types/StackedGraphicalItem.js";
var D = e([o, s, H, de, i], K), Ne = e([(t) => t.graphicalItems.cartesianItems, (t) => t.graphicalItems.polarItems], (t, a) => [...t, ...a]), Pe = e([i, p], _), f = e([Ne, o, Pe], Y), Be = e([f], (t) => t.filter(C)), Le = e([f], J), v = e([Le, d], F), Ve = e([Be, d, o], Ee), b = e([v, o, f], M), we = e([o], $), Oe = e([f], (t) => t.filter(C)), We = e([Ve, Oe, y], ae), Fe = e([We, d, i], ee), He = e([f], re), Ke = e([v, o, He, te, i], ie), Ue = e([ne, i, p], A), je = e([Ue, i], le), qe = e([pe, i, p], A), ze = e([qe, i], se), Je = e([me, i, p], A), Me = e([Je, i], ce), Qe = e([je, Me, ze], oe), Xe = e([o, we, Fe, Ke, Qe, s, i], Z), G = e([o, s, v, b, y, i, Xe], Q), Ye = e([G, o, D], X), Ze = e([o, G, Ye, i], z), E = (t) => {
  var a = i(t), l = p(t), r = !1;
  return U(t, a, l, r);
}, _e = e([o, E], Te), $e = e([o, D, Ze, _e], W), et = e([s, b, o, i], j), tt = e([s, b, o, i], q), it = (t, a, l, r, n, g, S, I) => {
  if (a) {
    var {
      type: V
    } = a, w = fe(t, I);
    if (r) {
      var O = l === "scaleBand" && r.bandwidth ? r.bandwidth() / 2 : 2, c = V === "category" && r.bandwidth ? r.bandwidth() / O : 0;
      return c = I === "angleAxis" && n != null && n?.length >= 2 ? ve(n[0] - n[1]) * 2 * c : c, w && S ? S.map((m, u) => ({
        coordinate: r(m) + c,
        value: m,
        index: u,
        offset: c
      })) : r.domain().map((m, u) => ({
        coordinate: r(m) + c,
        value: g ? g[m] : m,
        index: u,
        offset: c
      }));
    }
  }
}, N = e([s, o, D, $e, E, et, tt, i], it), x = e([ue, Ae, xe], (t, a, l) => De(l.shared, t, a)), P = (t) => t.tooltip.settings.trigger, h = (t) => t.tooltip.settings.defaultIndex, T = e([k, x, P, h], he), B = e([T, v], ge), ot = e([N, B], be);
e([T], (t) => {
  if (t)
    return t.dataKey;
});
var L = e([k, x, P, h], ke), at = e([Ie, ye, s, Re, N, h, L, R], Se);
e([T, at], (t, a) => t != null && t.coordinate ? t.coordinate : a);
e([T], (t) => t.active);
var rt = e([L, B, d, Ge, ot, R, x], Ce);
e([rt], (t) => {
  if (t != null) {
    var a = t.map((l) => l.payload).filter((l) => l != null);
    return Array.from(new Set(a));
  }
});
export {
  ot as selectActiveLabel,
  B as selectActiveTooltipIndex,
  rt as selectActiveTooltipPayload,
  f as selectAllGraphicalItemsSettings,
  Ne as selectAllUnfilteredGraphicalItems,
  G as selectTooltipAxisDomain,
  Ze as selectTooltipAxisDomainIncludingNiceTicks,
  _e as selectTooltipAxisRangeWithReverse,
  D as selectTooltipAxisRealScaleType,
  $e as selectTooltipAxisScale,
  N as selectTooltipAxisTicks,
  tt as selectTooltipCategoricalDomain,
  v as selectTooltipDisplayedData,
  Le as selectTooltipGraphicalItemsData
};
