import { useMemo as n } from "react";
import { valueToPercent as F, resolveLabels as H, fillClipInset as p } from "./index-utils3.js";
const j = (h) => {
  const {
    min: d,
    max: u,
    markers: r,
    orientation: b = "horizontal",
    showLabels: f,
    compactLabels: v,
    startLabel: L,
    endLabel: M,
    gradient: t,
    progressMarkerId: i,
    legendInteraction: S
  } = h, g = b === "vertical", y = r.length, {
    hoverHighlights: P = !0,
    dimsItems: x = !0,
    dimsMarkers: I = !0
  } = S ?? {}, w = n(() => new Map([...r].sort((e, o) => e.value - o.value).map((e, o) => [e.id, o])), [r]), m = n(() => i ? r.find((e) => e.id === i) : void 0, [r, i]), s = m ? F(m.value, d, u) : null, l = s !== null, c = s !== null && s > 0, a = n(() => t ? {
    background: t
  } : {}, [t]), k = g ? `inset(${p(s ?? 100)} 0 0 0 round var(--benchmark-gauge-track-radius, 90px))` : `inset(0 ${p(s ?? 100)} 0 0 round var(--benchmark-gauge-track-radius, 90px))`, B = l ? void 0 : a, C = n(() => ({
    ...a,
    ...l ? void 0 : {
      opacity: 0
    }
  }), [a, l]), G = c && !t, T = n(() => ({
    ...c && t ? a : {},
    clipPath: k
  }), [c, t, a, k]), {
    startLabel: V,
    endLabel: $
  } = H({
    showLabels: f,
    startLabel: L,
    endLabel: M,
    min: d,
    max: u,
    compactLabels: v
  }), z = r.some((e) => !!e.renderLegend), E = n(() => r.filter((e) => !!e.renderLegend).sort((e, o) => e.value - o.value), [r]);
  return {
    isVertical: g,
    rankCount: y,
    isProgressMode: l,
    hoverHighlights: P,
    dimsItems: x,
    dimsMarkers: I,
    rankMap: w,
    trackBarStyle: B,
    ghostStyle: C,
    shouldUseTrackGradient: G,
    fillStyle: T,
    effectiveStartLabel: V,
    effectiveEndLabel: $,
    hasLegend: z,
    legendMarkers: E
  };
};
export {
  j as useBenchmarkGaugeRenderState
};
