"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const types = require("../../../../utils/types.js");
const constants$1 = require("../../../form/src/constants.js");
const useFormCommonProps = require("../../../form/src/hooks/use-form-common-props.js");
const constants = require("../constants.js");
const vue = require("vue");
const useCheckboxDisabled = ({ model, isChecked }) => {
  const checkboxGroup = vue.inject(constants.checkboxGroupContextKey, void 0);
  const formContext = vue.inject(constants$1.formContextKey, void 0);
  const isLimitDisabled = vue.computed(() => {
    var _a, _b;
    const max = (_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value;
    const min = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value;
    return !types.isUndefined(max) && model.value.length >= max && !isChecked.value || !types.isUndefined(min) && model.value.length <= min && isChecked.value;
  });
  return {
    isDisabled: useFormCommonProps.useFormDisabled(vue.computed(() => {
      var _a;
      if (checkboxGroup === void 0) return (formContext == null ? void 0 : formContext.disabled) ?? isLimitDisabled.value;
      else return ((_a = checkboxGroup.disabled) == null ? void 0 : _a.value) || isLimitDisabled.value;
    })),
    isLimitDisabled
  };
};
exports.useCheckboxDisabled = useCheckboxDisabled;
