import { $ as i } from "./mergeProps-Dsl8k3Ig.es.js";
import { $ as n } from "./filterDOMProps-BSVCO5jK.es.js";
import { $ as s } from "./number-dMxJejI6.es.js";
import { $ as u } from "./useLabel-DQaRD22u.es.js";
import { $ as x } from "./context-DW7UvQ8z.es.js";
import { $ as v } from "./NumberFormatter-DgOUVrge.es.js";
import { useMemo as P } from "react";
function V(a = {}) {
  let { locale: e } = x();
  return P(() => new v(e, a), [
    e,
    a
  ]);
}
function B(a) {
  let { value: e = 0, minValue: r = 0, maxValue: t = 100, valueLabel: o, isIndeterminate: l, formatOptions: f = {
    style: "percent"
  } } = a, $ = n(a, {
    labelable: !0
  }), { labelProps: m, fieldProps: d } = u({
    ...a,
    // Progress bar is not an HTML input element so it
    // shouldn't be labeled by a <label> element.
    labelElementType: "span"
  });
  e = s(e, r, t);
  let p = (e - r) / (t - r), b = V(f);
  if (!l && !o) {
    let c = f.style === "percent" ? p : e;
    o = b.format(c);
  }
  return {
    progressBarProps: i($, {
      ...d,
      "aria-valuenow": l ? void 0 : e,
      "aria-valuemin": r,
      "aria-valuemax": t,
      "aria-valuetext": l ? void 0 : o,
      role: "progressbar"
    }),
    labelProps: m
  };
}
export {
  B as $,
  V as a
};
//# sourceMappingURL=useProgressBar--OvVKto2.es.js.map
