import M from "./index-objectWithoutPropertiesLoose.js";
import l from "./index-extends.js";
import * as T from "react";
import a from "./index-_virtual16.js";
import { clsx as q } from "./index-clsx.js";
import { c as k } from "./index-colorManipulator2.js";
import { useRtl as j } from "./index-RtlProvider.js";
import p from "./index-styled.js";
import { getLinearProgressUtilityClass as E } from "./index-linearProgressClasses.js";
import { jsxs as z, jsx as g } from "react/jsx-runtime";
import { useDefaultProps as U } from "./index-DefaultPropsProvider.js";
import n from "./index-capitalize.js";
import w from "./index-composeClasses.js";
import { css as y, keyframes as C } from "./index-emotion-react.browser.esm.js";
const A = ["className", "color", "value", "valueBuffer", "variant"];
let f = (r) => r, L, N, _, B, O, I;
const h = 4, K = C(L || (L = f`
  0% {
    left: -35%;
    right: 100%;
  }

  60% {
    left: 100%;
    right: -90%;
  }

  100% {
    left: 100%;
    right: -90%;
  }
`)), V = C(N || (N = f`
  0% {
    left: -200%;
    right: 100%;
  }

  60% {
    left: 107%;
    right: -8%;
  }

  100% {
    left: 107%;
    right: -8%;
  }
`)), X = C(_ || (_ = f`
  0% {
    opacity: 1;
    background-position: 0 -23px;
  }

  60% {
    opacity: 0;
    background-position: 0 -23px;
  }

  100% {
    opacity: 1;
    background-position: -200px -23px;
  }
`)), Y = (r) => {
  const {
    classes: e,
    variant: o,
    color: t
  } = r, b = {
    root: ["root", `color${n(t)}`, o],
    dashed: ["dashed", `dashedColor${n(t)}`],
    bar1: ["bar", `barColor${n(t)}`, (o === "indeterminate" || o === "query") && "bar1Indeterminate", o === "determinate" && "bar1Determinate", o === "buffer" && "bar1Buffer"],
    bar2: ["bar", o !== "buffer" && `barColor${n(t)}`, o === "buffer" && `color${n(t)}`, (o === "indeterminate" || o === "query") && "bar2Indeterminate", o === "buffer" && "bar2Buffer"]
  };
  return w(b, E, e);
}, P = (r, e) => e === "inherit" ? "currentColor" : r.vars ? r.vars.palette.LinearProgress[`${e}Bg`] : r.palette.mode === "light" ? k.lighten(r.palette[e].main, 0.62) : k.darken(r.palette[e].main, 0.5), W = p("span", {
  name: "MuiLinearProgress",
  slot: "Root",
  overridesResolver: (r, e) => {
    const {
      ownerState: o
    } = r;
    return [e.root, e[`color${n(o.color)}`], e[o.variant]];
  }
})(({
  ownerState: r,
  theme: e
}) => l({
  position: "relative",
  overflow: "hidden",
  display: "block",
  height: 4,
  zIndex: 0,
  // Fix Safari's bug during composition of different paint.
  "@media print": {
    colorAdjust: "exact"
  },
  backgroundColor: P(e, r.color)
}, r.color === "inherit" && r.variant !== "buffer" && {
  backgroundColor: "none",
  "&::before": {
    content: '""',
    position: "absolute",
    left: 0,
    top: 0,
    right: 0,
    bottom: 0,
    backgroundColor: "currentColor",
    opacity: 0.3
  }
}, r.variant === "buffer" && {
  backgroundColor: "transparent"
}, r.variant === "query" && {
  transform: "rotate(180deg)"
})), F = p("span", {
  name: "MuiLinearProgress",
  slot: "Dashed",
  overridesResolver: (r, e) => {
    const {
      ownerState: o
    } = r;
    return [e.dashed, e[`dashedColor${n(o.color)}`]];
  }
})(({
  ownerState: r,
  theme: e
}) => {
  const o = P(e, r.color);
  return l({
    position: "absolute",
    marginTop: 0,
    height: "100%",
    width: "100%"
  }, r.color === "inherit" && {
    opacity: 0.3
  }, {
    backgroundImage: `radial-gradient(${o} 0%, ${o} 16%, transparent 42%)`,
    backgroundSize: "10px 10px",
    backgroundPosition: "0 -23px"
  });
}, y(B || (B = f`
    animation: ${0} 3s infinite linear;
  `), X)), G = p("span", {
  name: "MuiLinearProgress",
  slot: "Bar1",
  overridesResolver: (r, e) => {
    const {
      ownerState: o
    } = r;
    return [e.bar, e[`barColor${n(o.color)}`], (o.variant === "indeterminate" || o.variant === "query") && e.bar1Indeterminate, o.variant === "determinate" && e.bar1Determinate, o.variant === "buffer" && e.bar1Buffer];
  }
})(({
  ownerState: r,
  theme: e
}) => l({
  width: "100%",
  position: "absolute",
  left: 0,
  bottom: 0,
  top: 0,
  transition: "transform 0.2s linear",
  transformOrigin: "left",
  backgroundColor: r.color === "inherit" ? "currentColor" : (e.vars || e).palette[r.color].main
}, r.variant === "determinate" && {
  transition: `transform .${h}s linear`
}, r.variant === "buffer" && {
  zIndex: 1,
  transition: `transform .${h}s linear`
}), ({
  ownerState: r
}) => (r.variant === "indeterminate" || r.variant === "query") && y(O || (O = f`
      width: auto;
      animation: ${0} 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
    `), K)), H = p("span", {
  name: "MuiLinearProgress",
  slot: "Bar2",
  overridesResolver: (r, e) => {
    const {
      ownerState: o
    } = r;
    return [e.bar, e[`barColor${n(o.color)}`], (o.variant === "indeterminate" || o.variant === "query") && e.bar2Indeterminate, o.variant === "buffer" && e.bar2Buffer];
  }
})(({
  ownerState: r,
  theme: e
}) => l({
  width: "100%",
  position: "absolute",
  left: 0,
  bottom: 0,
  top: 0,
  transition: "transform 0.2s linear",
  transformOrigin: "left"
}, r.variant !== "buffer" && {
  backgroundColor: r.color === "inherit" ? "currentColor" : (e.vars || e).palette[r.color].main
}, r.color === "inherit" && {
  opacity: 0.3
}, r.variant === "buffer" && {
  backgroundColor: P(e, r.color),
  transition: `transform .${h}s linear`
}), ({
  ownerState: r
}) => (r.variant === "indeterminate" || r.variant === "query") && y(I || (I = f`
      width: auto;
      animation: ${0} 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite;
    `), V)), J = /* @__PURE__ */ T.forwardRef(function(e, o) {
  const t = U({
    props: e,
    name: "MuiLinearProgress"
  }), {
    className: b,
    color: R = "primary",
    value: v,
    valueBuffer: $,
    variant: s = "indeterminate"
  } = t, D = M(t, A), u = l({}, t, {
    color: R,
    variant: s
  }), c = Y(u), x = j(), m = {}, d = {
    bar1: {},
    bar2: {}
  };
  if (s === "determinate" || s === "buffer")
    if (v !== void 0) {
      m["aria-valuenow"] = Math.round(v), m["aria-valuemin"] = 0, m["aria-valuemax"] = 100;
      let i = v - 100;
      x && (i = -i), d.bar1.transform = `translateX(${i}%)`;
    } else process.env.NODE_ENV;
  if (s === "buffer")
    if ($ !== void 0) {
      let i = ($ || 0) - 100;
      x && (i = -i), d.bar2.transform = `translateX(${i}%)`;
    } else process.env.NODE_ENV;
  return /* @__PURE__ */ z(W, l({
    className: q(c.root, b),
    ownerState: u,
    role: "progressbar"
  }, m, {
    ref: o
  }, D, {
    children: [s === "buffer" ? /* @__PURE__ */ g(F, {
      className: c.dashed,
      ownerState: u
    }) : null, /* @__PURE__ */ g(G, {
      className: c.bar1,
      ownerState: u,
      style: d.bar1
    }), s === "determinate" ? null : /* @__PURE__ */ g(H, {
      className: c.bar2,
      ownerState: u,
      style: d.bar2
    })]
  }));
});
process.env.NODE_ENV !== "production" && (J.propTypes = {
  // ┌────────────────────────────── Warning ──────────────────────────────┐
  // │ These PropTypes are generated from the TypeScript type definitions. │
  // │    To update them, edit the d.ts file and run `pnpm proptypes`.     │
  // └─────────────────────────────────────────────────────────────────────┘
  /**
   * Override or extend the styles applied to the component.
   */
  classes: a.object,
  /**
   * @ignore
   */
  className: a.string,
  /**
   * The color of the component.
   * It supports both default and custom theme colors, which can be added as shown in the
   * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
   * @default 'primary'
   */
  color: a.oneOfType([a.oneOf(["inherit", "primary", "secondary"]), a.string]),
  /**
   * The system prop that allows defining system overrides as well as additional CSS styles.
   */
  sx: a.oneOfType([a.arrayOf(a.oneOfType([a.func, a.object, a.bool])), a.func, a.object]),
  /**
   * The value of the progress indicator for the determinate and buffer variants.
   * Value between 0 and 100.
   */
  value: a.number,
  /**
   * The value for the buffer variant.
   * Value between 0 and 100.
   */
  valueBuffer: a.number,
  /**
   * The variant to use.
   * Use indeterminate or query when there is no progress value.
   * @default 'indeterminate'
   */
  variant: a.oneOf(["buffer", "determinate", "indeterminate", "query"])
});
export {
  J as default
};
