import { normalizeString } from "./normalizeString.js";
function createIdGenerator(type = "kebab") {
  const existingIds = /* @__PURE__ */ new Set();
  const separator = (() => {
    switch (type) {
      case "camel":
        return "";
      case "kebab":
        return "-";
      case "spaceDelimited":
        return " ";
    }
  })();
  return (input = "") => {
    const normalizedString = normalizeString(input, type);
    let id = normalizedString;
    let count = 0;
    while (id === "" || existingIds.has(id)) {
      count++;
      id = `${normalizedString}${normalizedString ? separator : ""}${count}`;
    }
    existingIds.add(id);
    return id;
  };
}
export {
  createIdGenerator
};
