"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const usePropsAlias = require("./use-props-alias.js");
const vue = require("vue");
const useComputedData = (props) => {
  const propsAlias = usePropsAlias.usePropsAlias(props);
  const dataObj = vue.computed(() => props.data.reduce((o, cur) => (o[cur[propsAlias.value.key]] = cur) && o, {}));
  return {
    sourceData: vue.computed(() => props.data.filter((item) => !props.modelValue.includes(item[propsAlias.value.key]))),
    targetData: vue.computed(() => {
      if (props.targetOrder === "original") return props.data.filter((item) => props.modelValue.includes(item[propsAlias.value.key]));
      else return props.modelValue.reduce((arr, cur) => {
        const val = dataObj.value[cur];
        if (val) arr.push(val);
        return arr;
      }, []);
    })
  };
};
exports.useComputedData = useComputedData;
