/**
 * ldesign v0.3.13
 * (c) 2023 ldesign
 * @license MIT
 */

import _defineProperty from '@babel/runtime/helpers/defineProperty';
import { computed, createVNode, mergeProps } from 'vue';
import isBoolean from 'lodash/isBoolean';
import { InputNumber } from '../../input-number/index.js';
import '../../utils/withInstall.js';
import '../../input-number/input-number.js';
import '@ldesign/icons-vue-next';
import '../../button/index.js';
import '../../button/button.js';
import '@babel/runtime/helpers/toConsumableArray';
import '../../loading/index.js';
import '../../loading/directive.js';
import '../../loading/plugin.js';
import '../../utils/dom.js';
import '../../_chunks/dep-512eb181.js';
import 'lodash/isString';
import 'lodash/isFunction';
import 'lodash/isArray';
import '../../utils/easing.js';
import '../../hooks/useConfig.js';
import '../../config-provider/useConfig.js';
import 'lodash/cloneDeep';
import '../../config-provider/context.js';
import 'lodash/mergeWith';
import 'lodash/merge';
import '../../_common/js/global-config/default-config.js';
import '../../_common/js/global-config/locale/zh_CN.js';
import '@babel/runtime/helpers/typeof';
import 'dayjs';
import '../../_chunks/dep-ac28b67c.js';
import '../../config-provider/type.js';
import '../../loading/loading.js';
import '@babel/runtime/helpers/slicedToArray';
import '../../utils/render-tnode.js';
import 'lodash/isEmpty';
import 'lodash/isObject';
import 'lodash/camelCase';
import 'lodash/kebabCase';
import '../../hooks/useTeleport.js';
import '../../loading/props.js';
import '../../loading/icon/gradient.js';
import '../../_common/js/loading/circle-adapter.js';
import '../../_common/js/utils/set-style.js';
import '../../_common/js/utils/helper.js';
import '@babel/runtime/helpers/objectWithoutProperties';
import 'lodash/isNull';
import 'lodash/isUndefined';
import 'lodash/isNumber';
import '../../loading/style';
import '../../loading/type.js';
import '../../hooks/useRipple.js';
import '../../utils/set-style.js';
import '../../hooks/useKeepAnimation.js';
import '../../form/hooks.js';
import '../../hooks/tnode.js';
import '../../button/props.js';
import '../../button/style';
import '../../button/type.js';
import '../../input/index.js';
import '../../input/input.js';
import '../../hooks/useGlobalIcon.js';
import '../../input/props.js';
import '../../input/useInput.js';
import '../../form/const.js';
import '../../hooks/index.js';
import '../../hooks/icon.js';
import '../../hooks/slot.js';
import '../../hooks/useCommonClassName.js';
import '../../hooks/useDefaultValue.js';
import '../../hooks/useDestroyOnClose.js';
import '../../hooks/useVirtualScroll.js';
import '../../hooks/useVModel.js';
import '../../input/useLengthLimit.js';
import '../../_common/js/log/index.js';
import '../../_common/js/log/log.js';
import '../../input/useInputEventHandler.js';
import '../../input/useInputWidth.js';
import '../../input/input-group.js';
import '../../input/input-group-props.js';
import '../../input/style';
import '../../input/type.js';
import '../../input-number/props.js';
import '../../input-number/useInputNumber.js';
import '../../_common/js/input-number/number.js';
import 'lodash/isNil';
import '../../_common/js/input-number/large-number.js';
import '../../input-number/style';
import '../../input-number/type.js';

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var INPUT_NUMBER_PROPS_INITIAL_STATE = {
  decimalPlaces: 0,
  format: void 0,
  placeholder: "",
  theme: "column"
};
var useSliderInput = function useSliderInput(config) {
  var name = config.value.prefixName;
  var sliderInputState = computed(function () {
    var initialState = _objectSpread({}, INPUT_NUMBER_PROPS_INITIAL_STATE);
    var inputProps = config.value;
    if (!isBoolean(inputProps.inputNumberProps)) {
      var _inputProps$inputNumb;
      var inputTheme = (_inputProps$inputNumb = inputProps.inputNumberProps) === null || _inputProps$inputNumb === void 0 ? void 0 : _inputProps$inputNumb.theme;
      initialState = _objectSpread(_objectSpread({}, initialState), inputProps.inputNumberProps);
      if (["column", "row", "normal"].includes(inputTheme)) initialState.theme = inputTheme;
    }
    return initialState;
  });
  var sliderNumberClass = computed(function () {
    return ["".concat(name, "__input"), {
      "is-vertical": config.value.vertical
    }];
  });
  var renderInputNumber = function renderInputNumber(val, changeFn) {
    var normalizeChangeFn = function normalizeChangeFn(num) {
      if (num !== void 0 && !isNaN(num)) changeFn(num);
    };
    return createVNode(InputNumber, mergeProps(sliderInputState.value, {
      "class": sliderNumberClass.value,
      "value": val,
      "step": config.value.step,
      "onChange": normalizeChangeFn,
      "disabled": config.value.disabled,
      "min": config.value.min,
      "max": config.value.max
    }), null);
  };
  return renderInputNumber;
};

export { useSliderInput };
//# sourceMappingURL=useSliderInput.js.map
