'use strict';

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

var vue = require('vue');

function useTextValueMapping({
  valueTexts,
  onTextChange
}) {
  const text = vue.ref("");
  function triggerTextChange(value) {
    text.value = value;
    onTextChange(value);
  }
  function resetText() {
    text.value = valueTexts.value[0];
  }
  vue.watch(
    () => [...valueTexts.value],
    (cur, pre = []) => {
      if (cur.join("||") !== pre.join("||") && valueTexts.value.every((valText) => valText !== text.value))
        resetText();
    },
    { immediate: true }
  );
  return [text, triggerTextChange, resetText];
}

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