text: 'use strict';
  
  Object.defineProperty(exports, '__esModule', { value: true });
  
  var vue = require('vue');
  var constants = require('../../utils/constants');
  var validators = require('../../utils/validators');
  var shared = require('@vue/shared');
  var util = require('../../utils/util');
  var tokens = require('../../tokens');
  
  const useCheckboxProps = {
    modelValue: {
      type: [Boolean, Number, String],
      default: () => void 0
    },
    label: {
      type: [String, Boolean, Number, Object]
    },
    indeterminate: Boolean,
    disabled: Boolean,
    checked: Boolean,
    name: {
      type: String,
      default: void 0
    },
    trueLabel: {
      type: [String, Number],
      default: void 0
    },
    falseLabel: {
      type: [String, Number],
      default: void 0
    },
    size: String
  };
  const useCheckboxGroup = () => {
    const ELEMENT = util.useGlobalConfig();
    const elForm = vue.inject(tokens.elFormKey, {});
    const elFormItem = vue.inject(tokens.elFormItemKey, {});
    const checkboxGroup = vue.inject("CheckboxGroup", {});
    const isGroup = vue.computed(() => checkboxGroup && (checkboxGroup == null ? void 0 : checkboxGroup.name) === "ElCheckboxGroup");
    const elFormItemSize = vue.computed(() => {
      return elFormItem.size;
    });
    return {
      isGroup,
      checkboxGroup,
      elForm,
      ELEMENT,
      elFormItemSize,
      elFormItem
    };
  };
  const useModel = (props) => {
    const selfModel = vue.ref(false);
    const { emit } = vue.getCurrentInstance();
    const { isGroup, checkboxGroup } = useCheckboxGroup();
    const isLimitExceeded = vue.ref(false);
    const store = vue.computed(() => {
      var _a;
      return checkboxGroup ? (_a = checkboxGroup.modelValue) == null ? void 0 : _a.value : props.modelValue;
    });
    const model = vue.computed({
      get() {
        var _a;
        return isGroup.value ? store.value : (_a = props.modelValue) != null ? _a : selfModel.value;
      },
      set(val) {
        var _a;
        if (isGroup.value && Array.isArray(val)) {
          isLimitExceeded.value = false;
          if (checkboxGroup.min !== void 0 && val.length < checkboxGroup.min.value) {
            isLimitExceeded.value = true;
          }
          if (checkboxGroup.max !== void 0 && val.length > checkboxGroup.max.value) {
            isLimitExceeded.value = true;
          }
          isLimitExceeded.value === false && ((_a = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _a.call(checkboxGroup, val));
        } else {
          emit(constants.UPDATE_MODEL_EVENT, val);
          selfModel.value = val;
        }
      }
    });
    return {
      model,
      isLimitExceeded
    };
  };
  const useCheckboxStatus = (props, { model }) => {
    const { isGroup, checkboxGroup, elFormItemSize, ELEMENT } = useCheckboxGroup();
    const focus = vue.ref(false);
    const size = vue.computed(() => {
      var _a;
      return ((_a = checkboxGroup == null ? void 0 : checkboxGroup.checkboxGroupSize) == null ? void 0 : _a.value) || elFormItemSize.value || ELEMENT.size;
    });
    const isChecked = vue.computed(() => {
      const value = model.value;
      if (shared.toTypeString(value) === "[object Boolean]") {
        return value;
      } else if (Array.isArray(value)) {
        return value.includes(props.label);
      } else if (value !== null && value !== void 0) {
        return value === props.trueLabel;
      } else {
        return !!value;
      }
    });
    const checkboxSize = vue.computed(() => {
      var _a;
      const temCheckboxSize = props.size || elFormItemSize.value || ELEMENT.size;
      return isGroup.value ? ((_a = checkboxGroup == null ? void 0 : checkboxGroup.checkboxGroupSize) == null ? void 0 : _a.value) || temCheckboxSize : temCheckboxSize;
    });
    return {
      isChecked,
      focus,
      size,
      checkboxSize
    };
  };
  const useDisabled = (props, { model, isChecked }) => {
    const { elForm, isGroup, checkboxGroup } = useCheckboxGroup();
    const isLimitDisabled = vue.computed(() => {
      var _a, _b;
      const max = (_a = checkboxGroup.max) == null ? void 0 : _a.value;
      const min = (_b = checkboxGroup.min) == null ? void 0 : _b.value;
      return !!(max || min) && (model.value.length >= max && !isChecked.value) || model.value.length <= min && isChecked.value;
    });
    const isDisabled = vue.computed(() => {
      var _a;
      const disabled = props.disabled || elForm.disabled;
      return isGroup.value ? ((_a = checkboxGroup.disabled) == null ? void 0 : _a.value) || disabled || isLimitDisabled.value : props.disabled || elForm.disabled;
    });
    return {
      isDisabled,
      isLimitDisabled
    };
  };
  const setStoreValue = (props, { model }) => {
    function addToStore() {
      if (Array.isArray(model.value) && !model.value.includes(props.label)) {
        model.value.push(props.label);
      } else {
        model.value = props.trueLabel || true;
      }
    }
    props.checked && addToStore();
  };
  const useEvent = (props, { isLimitExceeded }) => {
    const { elFormItem } = useCheckboxGroup();
    const { emit } = vue.getCurrentInstance();
    function handleChange(e) {
      var _a, _b;
      if (isLimitExceeded.value)
        return;
      const target = e.target;
      const value = target.checked ? (_a = props.trueLabel) != null ? _a : true : (_b = props.falseLabel) != null ? _b : false;
      emit("change", value, e);
    }
    vue.watch(() => props.modelValue, (val) => {
      var _a;
      (_a = elFormItem.formItemMitt) == null ? void 0 : _a.emit("el.form.change", [val]);
    });
    return {
      handleChange
    };
  };
  const useCheckbox = (props) => {
    const { model, isLimitExceeded } = useModel(props);
    const { focus, size, isChecked, checkboxSize } = useCheckboxStatus(props, { model });
    const { isDisabled } = useDisabled(props, { model, isChecked });
    const { handleChange } = useEvent(props, { isLimitExceeded });
    setStoreValue(props, { model });
    return {
      isChecked,
      isDisabled,
      checkboxSize,
      model,
      handleChange,
      focus,
      size
    };
  };
  
  var script = vue.defineComponent({
    name: "ElCheckbox",
    props: {
      modelValue: {
        type: [Boolean, Number, String],
        default: () => void 0
      },
      label: {
        type: [String, Boolean, Number, Object]
      },
      indeterminate: Boolean,
      disabled: Boolean,
      checked: Boolean,
      name: {
        type: String,
        default: void 0
      },
      trueLabel: {
        type: [String, Number],
        default: void 0
      },
      falseLabel: {
        type: [String, Number],
        default: void 0
      },
      id: {
        type: String,
        default: void 0
      },
      controls: {
        type: String,
        default: void 0
      },
      border: Boolean,
      size: {
        type: String,
        validator: validators.isValidComponentSize
      }
    },
    emits: [constants.UPDATE_MODEL_EVENT, "change"],
    setup(props) {
      return useCheckbox(props);
    }
  });
  
  const _hoisted_1 = ["id", "aria-controls"];
  const _hoisted_2 = ["tabindex", "role", "aria-checked"];
  const _hoisted_3 = /* @__PURE__ */ vue.createElementVNode("span", { class: "el-checkbox__inner" }, null, -1);
  const _hoisted_4 = ["aria-hidden", "name", "disabled", "true-value", "false-value"];
  const _hoisted_5 = ["aria-hidden", "disabled", "value", "name"];
  const _hoisted_6 = {
    key: 0,
    class: "el-checkbox__label"
  };
  function render(_ctx, _cache, $props, $setup, $data, $options) {
    return vue.openBlock(), vue.createElementBlock("label", {
      id: _ctx.id,
      class: vue.normalizeClass(["el-checkbox", [
        _ctx.checkboxSize ? "el-checkbox--" + _ctx.checkboxSize : "",
        { "is-disabled": _ctx.isDisabled },
        { "is-bordered": _ctx.border },
        { "is-checked": _ctx.isChecked }
      ]]),
      "aria-controls": _ctx.indeterminate ? _ctx.controls : null
    }, [
      vue.createElementVNode("span", {
        class: vue.normalizeClass(["el-checkbox__input", {
          "is-disabled": _ctx.isDisabled,
          "is-checked": _ctx.isChecked,
          "is-indeterminate": _ctx.indeterminate,
          "is-focus": _ctx.focus
        }]),
        tabindex: _ctx.indeterminate ? 0 : void 0,
        role: _ctx.indeterminate ? "checkbox" : void 0,
        "aria-checked": _ctx.indeterminate ? "mixed" : false
      }, [
        _hoisted_3,
        _ctx.trueLabel || _ctx.falseLabel ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
          key: 0,
          "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model = $event),
          class: "el-checkbox__original",
          type: "checkbox",
          "aria-hidden": _ctx.indeterminate ? "true" : "false",
          name: _ctx.name,
          disabled: _ctx.isDisabled,
          "true-value": _ctx.trueLabel,
          "false-value": _ctx.falseLabel,
          onChange: _cache[1] || (_cache[1] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
          onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.focus = true),
          onBlur: _cache[3] || (_cache[3] = ($event) => _ctx.focus = false)
        }, null, 40, _hoisted_4)), [
          [vue.vModelCheckbox, _ctx.model]
        ]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
          key: 1,
          "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.model = $event),
          class: "el-checkbox__original",
          type: "checkbox",
          "aria-hidden": _ctx.indeterminate ? "true" : "false",
          disabled: _ctx.isDisabled,
          value: _ctx.label,
          name: _ctx.name,
          onChange: _cache[5] || (_cache[5] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
          onFocus: _cache[6] || (_cache[6] = ($event) => _ctx.focus = true),
          onBlur: _cache[7] || (_cache[7] = ($event) => _ctx.focus = false)
        }, null, 40, _hoisted_5)), [
          [vue.vModelCheckbox, _ctx.model]
        ])
      ], 10, _hoisted_2),
      _ctx.$slots.default || _ctx.label ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_6, [
        vue.renderSlot(_ctx.$slots, "default"),
        !_ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
          vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
        ], 2112)) : vue.createCommentVNode("v-if", true)
      ])) : vue.createCommentVNode("v-if", true)
    ], 10, _hoisted_1);
  }
  
  script.render = render;
  script.__file = "packages/components/checkbox/src/checkbox.vue";
  
  var script$1 = vue.defineComponent({
    name: "ElCheckboxButton",
    props: useCheckboxProps,
    emits: [constants.UPDATE_MODEL_EVENT, "change"],
    setup(props) {
      const { focus, isChecked, isDisabled, size, model, handleChange } = useCheckbox(props);
      const { checkboxGroup } = useCheckboxGroup();
      const activeStyle = vue.computed(() => {
        var _a, _b, _c, _d;
        const fillValue = (_b = (_a = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a.value) != null ? _b : "";
        return {
          backgroundColor: fillValue,
          borderColor: fillValue,
          color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
          boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : null
        };
      });
      return {
        focus,
        isChecked,
        isDisabled,
        model,
        handleChange,
        activeStyle,
        size
      };
    }
  });
  
  const _hoisted_1$1 = ["aria-checked", "aria-disabled"];
  const _hoisted_2$1 = ["name", "disabled", "true-value", "false-value"];
  const _hoisted_3$1 = ["name", "disabled", "value"];
  function render$1(_ctx, _cache, $props, $setup, $data, $options) {
    return vue.openBlock(), vue.createElementBlock("label", {
      class: vue.normalizeClass(["el-checkbox-button", [
        _ctx.size ? "el-checkbox-button--" + _ctx.size : "",
        { "is-disabled": _ctx.isDisabled },
        { "is-checked": _ctx.isChecked },
        { "is-focus": _ctx.focus }
      ]]),
      role: "checkbox",
      "aria-checked": _ctx.isChecked,
      "aria-disabled": _ctx.isDisabled
    }, [
      _ctx.trueLabel || _ctx.falseLabel ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
        key: 0,
        "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model = $event),
        class: "el-checkbox-button__original",
        type: "checkbox",
        name: _ctx.name,
        disabled: _ctx.isDisabled,
        "true-value": _ctx.trueLabel,
        "false-value": _ctx.falseLabel,
        onChange: _cache[1] || (_cache[1] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
        onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.focus = true),
        onBlur: _cache[3] || (_cache[3] = ($event) => _ctx.focus = false)
      }, null, 40, _hoisted_2$1)), [
        [vue.vModelCheckbox, _ctx.model]
      ]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
        key: 1,
        "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.model = $event),
        class: "el-checkbox-button__original",
        type: "checkbox",
        name: _ctx.name,
        disabled: _ctx.isDisabled,
        value: _ctx.label,
        onChange: _cache[5] || (_cache[5] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
        onFocus: _cache[6] || (_cache[6] = ($event) => _ctx.focus = true),
        onBlur: _cache[7] || (_cache[7] = ($event) => _ctx.focus = false)
      }, null, 40, _hoisted_3$1)), [
        [vue.vModelCheckbox, _ctx.model]
      ]),
      _ctx.$slots.default || _ctx.label ? (vue.openBlock(), vue.createElementBlock("span", {
        key: 2,
        class: "el-checkbox-button__inner",
        style: vue.normalizeStyle(_ctx.isChecked ? _ctx.activeStyle : null)
      }, [
        vue.renderSlot(_ctx.$slots, "default", {}, () => [
          vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
        ])
      ], 4)) : vue.createCommentVNode("v-if", true)
    ], 10, _hoisted_1$1);
  }
  
  script$1.render = render$1;
  script$1.__file = "packages/components/checkbox/src/checkbox-button.vue";
  
  var __defProp = Object.defineProperty;
  var __defProps = Object.defineProperties;
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  var __hasOwnProp = Object.prototype.hasOwnProperty;
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  var __spreadValues = (a, b) => {
    for (var prop in b || (b = {}))
      if (__hasOwnProp.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    if (__getOwnPropSymbols)
      for (var prop of __getOwnPropSymbols(b)) {
        if (__propIsEnum.call(b, prop))
          __defNormalProp(a, prop, b[prop]);
      }
    return a;
  };
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
  var script$2 = vue.defineComponent({
    name: "ElCheckboxGroup",
    props: {
      modelValue: {
        type: [Object, Boolean, Array],
        default: () => void 0
      },
      disabled: Boolean,
      min: {
        type: Number,
        default: void 0
      },
      max: {
        type: Number,
        default: void 0
      },
      size: {
        type: String,
        validator: validators.isValidComponentSize
      },
      fill: {
        type: String,
        default: void 0
      },
      textColor: {
        type: String,
        default: void 0
      }
    },
    emits: [constants.UPDATE_MODEL_EVENT, "change"],
    setup(props, ctx) {
      const { elFormItem, elFormItemSize, ELEMENT } = useCheckboxGroup();
      const checkboxGroupSize = vue.computed(() => props.size || elFormItemSize.value || ELEMENT.size);
      const changeEvent = (value) => {
        ctx.emit(constants.UPDATE_MODEL_EVENT, value);
        vue.nextTick(() => {
          ctx.emit("change", value);
        });
      };
      const modelValue = vue.computed({
        get() {
          return props.modelValue;
        },
        set(val) {
          changeEvent(val);
        }
      });
      vue.provide("CheckboxGroup", __spreadProps(__spreadValues({
        name: "ElCheckboxGroup",
        modelValue
      }, vue.toRefs(props)), {
        checkboxGroupSize,
        changeEvent
      }));
      vue.watch(() => props.modelValue, (val) => {
        var _a;
        (_a = elFormItem.formItemMitt) == null ? void 0 : _a.emit("el.form.change", [val]);
      });
    }
  });
  
  const _hoisted_1$2 = {
    class: "el-checkbox-group",
    role: "group",
    "aria-label": "checkbox-group"
  };
  function render$2(_ctx, _cache, $props, $setup, $data, $options) {
    return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
      vue.renderSlot(_ctx.$slots, "default")
    ]);
  }
  
  script$2.render = render$2;
  script$2.__file = "packages/components/checkbox/src/checkbox-group.vue";
  
  script.install = (app) => {
    app.component(script.name, script);
    app.component(script$1.name, script$1);
    app.component(script$2.name, script$2);
  };
  script.CheckboxButton = script$1;
  script.CheckboxGroup = script$2;
  const _Checkbox = script;
  const ElCheckbox = _Checkbox;
  const ElCheckboxButton = script$1;
  const ElCheckboxGroup = script$2;
  
  exports.ElCheckbox = ElCheckbox;
  exports.ElCheckboxButton = ElCheckboxButton;
  exports.ElCheckboxGroup = ElCheckboxGroup;
  exports.default = _Checkbox;
  