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

'use strict';

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

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
var vue = require('vue');
var hooks_useConfig = require('../hooks/useConfig.js');
var hooks_useVModel = require('../hooks/useVModel.js');
var hooks_tnode = require('../hooks/tnode.js');
var tag_checkTagProps = require('./check-tag-props.js');
require('../config-provider/useConfig.js');
require('lodash/cloneDeep');
require('lodash/isFunction');
require('lodash/isString');
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-7f0559c3.js');
require('dayjs');
require('lodash/kebabCase');
require('lodash/camelCase');
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 _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);

var _CheckTag = vue.defineComponent({
  name: "TCheckTag",
  props: tag_checkTagProps["default"],
  setup: function setup(props2) {
    var COMPONENT_NAME = hooks_useConfig.usePrefixClass("tag");
    var _useCommonClassName = hooks_useConfig.useCommonClassName(),
      SIZE = _useCommonClassName.SIZE;
    var renderContent = hooks_tnode.useContent();
    var _toRefs = vue.toRefs(props2),
      checked = _toRefs.checked,
      modelValue = _toRefs.modelValue;
    var _useVModel = hooks_useVModel["default"](checked, modelValue, props2.defaultChecked, props2.onChange, "checked"),
      _useVModel2 = _slicedToArray__default["default"](_useVModel, 2),
      innerChecked = _useVModel2[0],
      setInnerChecked = _useVModel2[1];
    var tagClass = vue.computed(function () {
      var _ref;
      return ["".concat(COMPONENT_NAME.value), "".concat(COMPONENT_NAME.value, "--check"), "".concat(COMPONENT_NAME.value, "--default"), SIZE.value[props2.size], (_ref = {}, _defineProperty__default["default"](_ref, "".concat(COMPONENT_NAME.value, "--checked"), !props2.disabled && innerChecked.value), _defineProperty__default["default"](_ref, "".concat(COMPONENT_NAME.value, "--disabled"), props2.disabled), _ref)];
    });
    var handleClick = function handleClick(e) {
      if (!props2.disabled) {
        var _props2$onClick;
        (_props2$onClick = props2.onClick) === null || _props2$onClick === void 0 ? void 0 : _props2$onClick.call(props2, {
          e: e
        });
        setInnerChecked(!innerChecked.value);
      }
    };
    return function () {
      var tagContent = renderContent("default", "content");
      return vue.createVNode("span", {
        "class": tagClass.value,
        "onClick": handleClick
      }, [tagContent]);
    };
  }
});

exports["default"] = _CheckTag;
//# sourceMappingURL=check-tag.js.map
