import { CharacterClassifier } from "./characterClassifier.mjs";
class WordCharacterClassifier extends CharacterClassifier {
  constructor(wordSeparators) {
    super(
      0
      /* Regular */
    );
    for (let i = 0, len = wordSeparators.length; i < len; i++) {
      this.set(
        wordSeparators.charCodeAt(i),
        2
        /* WordSeparator */
      );
    }
    this.set(
      32,
      1
      /* Whitespace */
    );
    this.set(
      9,
      1
      /* Whitespace */
    );
  }
}
function once(computeFn) {
  const cache = {};
  return (input) => {
    if (!cache.hasOwnProperty(input)) {
      cache[input] = computeFn(input);
    }
    return cache[input];
  };
}
const getMapForWordSeparators = once((input) => new WordCharacterClassifier(input));
export {
  WordCharacterClassifier,
  getMapForWordSeparators
};
