'use client';
import * as React from 'react';
import { jsx } from 'react/jsx-runtime';
import resolveProps from '../../../utils/esm/resolveProps/resolveProps.mjs';

const PropsContext = /*#__PURE__*/React.createContext(undefined);
function DefaultPropsProvider({
  value,
  children
}) {
  return /*#__PURE__*/jsx(PropsContext.Provider, {
    value: value,
    children: children
  });
}
function getThemeProps(params) {
  const {
    theme,
    name,
    props
  } = params;
  if (!theme || !theme.components || !theme.components[name]) {
    return props;
  }
  const config = theme.components[name];
  if (config.defaultProps) {
    // compatible with v5 signature
    return resolveProps(config.defaultProps, props);
  }
  if (!config.styleOverrides && !config.variants) {
    // v6 signature, no property 'defaultProps'
    return resolveProps(config, props);
  }
  return props;
}
function useDefaultProps$1({
  props,
  name
}) {
  const ctx = React.useContext(PropsContext);
  return getThemeProps({
    props,
    name,
    theme: {
      components: ctx
    }
  });
}

export { DefaultPropsProvider as default, useDefaultProps$1 as useDefaultProps };
//# sourceMappingURL=DefaultPropsProvider.mjs.map
