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

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var vue = require('vue');
var isString = require('lodash/isString');
var isNumber = require('lodash/isNumber');
var isFunction = require('lodash/isFunction');
var hooks_useConfig = require('../hooks/useConfig.js');
var hooks_tnode = require('../hooks/tnode.js');
var inputAdornment_props = require('./props.js');
require('../config-provider/useConfig.js');
require('lodash/cloneDeep');
require('../config-provider/context.js');
require('lodash/mergeWith');
require('lodash/merge');
require('lodash/isArray');
require('../_common/js/global-config/default-config.js');
require('../_common/js/global-config/locale/zh_CN.js');
require('@babel/runtime/helpers/typeof');
require('../_chunks/dep-f4db2590.js');
require('dayjs');
require('lodash/camelCase');
require('lodash/kebabCase');
require('../utils/render-tnode.js');
require('lodash/isEmpty');
require('lodash/isObject');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
var isString__default = /*#__PURE__*/_interopDefaultLegacy(isString);
var isNumber__default = /*#__PURE__*/_interopDefaultLegacy(isNumber);
var isFunction__default = /*#__PURE__*/_interopDefaultLegacy(isFunction);

var _InputAdornment = vue.defineComponent({
  name: "TInputAdornment",
  inheritAttrs: false,
  props: inputAdornment_props["default"],
  setup: function setup(props2, _ref) {
    var slots = _ref.slots;
    var COMPONENT_NAME = hooks_useConfig.usePrefixClass("input-adornment");
    var renderTNodeJSX = hooks_tnode.useTNodeJSX();
    var renderAddon = function renderAddon(h2, type, addon) {
      var addonNode;
      var isContentNode = isString__default["default"](addon) || isNumber__default["default"](addon);
      if (slots[type]) {
        addonNode = slots[type](null);
      } else if (isFunction__default["default"](addon)) {
        addonNode = addon(h2);
      } else {
        addonNode = isContentNode ? vue.createVNode("span", {
          "class": "".concat(COMPONENT_NAME.value, "__text")
        }, [addon]) : addon;
      }
      return addonNode ? vue.createVNode("span", {
        "class": "".concat(COMPONENT_NAME.value, "__").concat(type)
      }, [addonNode]) : addonNode;
    };
    return function () {
      var _ref2;
      var prepend = renderAddon(vue.h, "prepend", props2.prepend);
      var append = renderAddon(vue.h, "append", props2.append);
      var defaultSlot = renderTNodeJSX("default") || [null];
      var className = [COMPONENT_NAME.value, (_ref2 = {}, _defineProperty__default["default"](_ref2, "".concat(COMPONENT_NAME.value, "--prepend"), prepend), _defineProperty__default["default"](_ref2, "".concat(COMPONENT_NAME.value, "--append"), append), _ref2)];
      if (!prepend && !append) return defaultSlot[0];
      return vue.createVNode("div", {
        "class": className
      }, [prepend, defaultSlot[0], append]);
    };
  }
});

exports["default"] = _InputAdornment;
//# sourceMappingURL=input-adornment.js.map
