import * as n from "react";
import "../../../rc-util/es/hooks/useLayoutEffect.mjs";
import { supportNodeRef as i, useComposeRef as m } from "../../../rc-util/es/ref.mjs";
import "../../../rc-util/es/warning.mjs";
import { NoCompactStyle as p } from "../space/Compact.mjs";
var u = globalThis && globalThis.__rest || function(t, l) {
  var o = {};
  for (var e in t)
    Object.prototype.hasOwnProperty.call(t, e) && l.indexOf(e) < 0 && (o[e] = t[e]);
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, e = Object.getOwnPropertySymbols(t); r < e.length; r++)
      l.indexOf(e[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, e[r]) && (o[e[r]] = t[e[r]]);
  return o;
};
const a = /* @__PURE__ */ n.createContext(null), y = /* @__PURE__ */ n.forwardRef((t, l) => {
  const {
    children: o
  } = t, e = u(t, ["children"]), r = n.useContext(a), s = n.useMemo(() => Object.assign(Object.assign({}, r), e), [
    r,
    e.prefixCls,
    // restProps.expandIcon, Not mark as deps since this is a ReactNode
    e.mode,
    e.selectable,
    e.rootClassName
    // restProps.validator, Not mark as deps since this is a function
  ]), c = i(o), f = m(l, c ? o.ref : null);
  return /* @__PURE__ */ n.createElement(a.Provider, {
    value: s
  }, /* @__PURE__ */ n.createElement(p, null, c ? /* @__PURE__ */ n.cloneElement(o, {
    ref: f
  }) : o));
});
export {
  y as OverrideProvider,
  a as default
};
