import { inject, h, computed } from 'vue';
import '../context/index.mjs';
import { DefaultRenderEmpty } from '../renderEmpty.mjs';
import { useInjectSize } from '../context/sizeContext.mjs';
import { useInjectDisabled } from '../context/disabledContext.mjs';
import { defaultConfigProvider } from '../context/context.mjs';

const configProviderKey = Symbol("configProvider");
var useConfigInject = (name, props) => {
  const sizeContext = useInjectSize();
  const disabledContext = useInjectDisabled();
  const configProvider = inject(configProviderKey, {
    ...defaultConfigProvider,
    renderEmpty: (n) => h(DefaultRenderEmpty, { componentName: n, prefixCls: props.prefixCls })
  });
  const prefixCls = computed(() => configProvider.getPrefixCls(name, props.prefixCls));
  const customizePrefixCls = computed(() => props.customizePrefixCls);
  const direction = computed(() => {
    var _a, _b;
    return (_b = props.direction) != null ? _b : (_a = configProvider.direction) == null ? void 0 : _a.value;
  });
  const iconPrefixCls = computed(() => {
    var _a;
    return (_a = props.iconPrefixCls) != null ? _a : configProvider.iconPrefixCls.value;
  });
  const rootPrefixCls = computed(() => configProvider.getPrefixCls());
  const autoInsertSpaceInButton = computed(() => {
    var _a;
    return (_a = configProvider.autoInsertSpaceInButton) == null ? void 0 : _a.value;
  });
  const renderEmpty = configProvider.renderEmpty;
  const space = configProvider.space;
  const pageHeader = configProvider.pageHeader;
  const form = configProvider.form;
  const getTargetContainer = computed(
    () => {
      var _a, _b;
      return (_b = props.getTargetContainer) != null ? _b : (_a = configProvider.getTargetContainer) == null ? void 0 : _a.value;
    }
  );
  const getPopupContainer = computed(
    () => {
      var _a, _b, _c;
      return (_c = (_a = props.getContainer) != null ? _a : props.getPopupContainer) != null ? _c : (_b = configProvider.getPopupContainer) == null ? void 0 : _b.value;
    }
  );
  const dropdownMatchSelectWidth = computed(
    () => {
      var _a, _b;
      return (_b = props.dropdownMatchSelectWidth) != null ? _b : (_a = configProvider.dropdownMatchSelectWidth) == null ? void 0 : _a.value;
    }
  );
  const virtual = computed(
    () => {
      var _a;
      return (props.virtual === void 0 ? ((_a = configProvider.virtual) == null ? void 0 : _a.value) !== false : props.virtual !== false) && dropdownMatchSelectWidth.value !== false;
    }
  );
  const size = computed(() => props.size || sizeContext.value);
  const autocomplete = computed(
    () => {
      var _a, _b, _c;
      return (_c = props.autocomplete) != null ? _c : (_b = (_a = configProvider.input) == null ? void 0 : _a.value) == null ? void 0 : _b.autocomplete;
    }
  );
  const disabled = computed(() => {
    var _a;
    return (_a = props.disabled) != null ? _a : disabledContext.value;
  });
  const csp = computed(() => {
    var _a;
    return (_a = props.csp) != null ? _a : configProvider.csp;
  });
  const wave = computed(() => {
    var _a, _b;
    return (_b = props.wave) != null ? _b : (_a = configProvider == null ? void 0 : configProvider.wave) == null ? void 0 : _a.value;
  });
  return {
    configProvider,
    prefixCls,
    customizePrefixCls,
    direction,
    size,
    getTargetContainer,
    getPopupContainer,
    space,
    pageHeader,
    form,
    autoInsertSpaceInButton,
    renderEmpty,
    virtual,
    dropdownMatchSelectWidth,
    rootPrefixCls,
    getPrefixCls: configProvider.getPrefixCls,
    autocomplete,
    csp,
    iconPrefixCls,
    disabled,
    select: configProvider.select,
    wave
  };
};

export { configProviderKey, useConfigInject as default };
//# sourceMappingURL=useConfigInject.mjs.map
