import * as n from "react";
import { SafeReact as f } from "./safeReact.js";
let o = 0;
function l(u, t = "mui") {
  const [e, s] = n.useState(u), c = u || e;
  return n.useEffect(() => {
    e == null && (o += 1, s(`${t}-${o}`));
  }, [e, t]), c;
}
const a = f.useId;
function I(u, t) {
  if (a !== void 0) {
    const e = a();
    return u ?? (t ? `${t}-${e}` : e);
  }
  return l(u, t);
}
export {
  I as useId
};
