'use strict';

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

var vue = require('vue');
var conductUtil = require('../../../vc-tree/src/utils/conductUtil.cjs');

var useCheckedKeys = (rawLabeledValues, rawHalfCheckedValues, treeConduction, keyEntities, maxLevel, levelEntities) => {
  const newRawCheckedValues = vue.shallowRef([]);
  const newRawHalfCheckedValues = vue.shallowRef([]);
  vue.watchEffect(() => {
    let checkedKeys = rawLabeledValues.value.map(({ value }) => value);
    let halfCheckedKeys = rawHalfCheckedValues.value.map(({ value }) => value);
    const missingValues = checkedKeys.filter((key) => !keyEntities.value[key]);
    if (treeConduction.value) {
      ({ checkedKeys, halfCheckedKeys } = conductUtil.conductCheck(
        checkedKeys,
        true,
        keyEntities.value,
        maxLevel.value,
        levelEntities.value
      ));
    }
    newRawCheckedValues.value = Array.from(/* @__PURE__ */ new Set([...missingValues, ...checkedKeys]));
    newRawHalfCheckedValues.value = halfCheckedKeys;
  });
  return [newRawCheckedValues, newRawHalfCheckedValues];
};

exports.default = useCheckedKeys;
//# sourceMappingURL=useCheckedKeys.cjs.map
