import { computed } from 'vue';
import { convertDataToEntities } from '../../../vc-tree/src/utils/treeUtil.mjs';
import { VALUE_SPLIT } from '../utils/commonUtil.mjs';

var useEntities = (options, fieldNames) => {
  const entities = computed(() => {
    return convertDataToEntities(options.value, {
      fieldNames: fieldNames.value,
      initWrapper: (wrapper) => ({
        ...wrapper,
        pathKeyEntities: {}
      }),
      processEntity: (entity, wrapper) => {
        const pathKey = entity.nodes.map((node) => node[fieldNames.value.value]).join(VALUE_SPLIT);
        wrapper.pathKeyEntities[pathKey] = entity;
        entity.key = pathKey;
      }
    }).pathKeyEntities;
  });
  return entities;
};

export { useEntities as default };
//# sourceMappingURL=useEntities.mjs.map
