import * as r from "react";
import { r as h, m, u as E, a as g, b as v, d as w, T as S } from "./Stack-CdVfRhco.js";
function $(e, o, n, s, t) {
  if (process.env.NODE_ENV === "production")
    return null;
  const c = t || o;
  return typeof e[o] < "u" ? new Error(`The prop \`${c}\` is not supported. Please remove it.`) : null;
}
function O({
  controlled: e,
  default: o,
  name: n,
  state: s = "value"
}) {
  const {
    current: t
  } = r.useRef(e !== void 0), [c, i] = r.useState(o), u = t ? e : c;
  if (process.env.NODE_ENV !== "production") {
    r.useEffect(() => {
      t !== (e !== void 0) && console.error([`MUI: A component is changing the ${t ? "" : "un"}controlled ${s} state of ${n} to be ${t ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${n} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join(`
`));
    }, [s, n, e]);
    const {
      current: l
    } = r.useRef(o);
    r.useEffect(() => {
      !t && !Object.is(l, o) && console.error([`MUI: A component is changing the default ${s} state of an uncontrolled ${n} after being initialized. To suppress this warning opt to use a controlled ${n}.`].join(`
`));
    }, [JSON.stringify(o)]);
  }
  const a = r.useCallback((l) => {
    t || i(l);
  }, []);
  return [u, a];
}
function T(e) {
  var f;
  const {
    elementType: o,
    externalSlotProps: n,
    ownerState: s,
    skipResolvingSlotProps: t = !1,
    ...c
  } = e, i = t ? {} : h(n, s), {
    props: u,
    internalRef: a
  } = m({
    ...c,
    externalSlotProps: i
  }), l = E(a, i == null ? void 0 : i.ref, (f = e.additionalProps) == null ? void 0 : f.ref);
  return g(o, {
    ...u,
    ref: l
  }, s);
}
function b({
  props: e,
  name: o
}) {
  return v({
    props: e,
    name: o,
    defaultTheme: w,
    themeId: S
  });
}
const p = /* @__PURE__ */ r.createContext(void 0);
process.env.NODE_ENV !== "production" && (p.displayName = "FormControlContext");
function P() {
  return r.useContext(p);
}
const d = /* @__PURE__ */ new Set();
function x(e, o = "warning") {
  if (process.env.NODE_ENV === "production")
    return;
  const n = Array.isArray(e) ? e.join(`
`) : e;
  d.has(n) || (d.add(n), o === "error" ? console.error(n) : console.warn(n));
}
export {
  p as F,
  P as a,
  b,
  T as c,
  $ as d,
  O as u,
  x as w
};
