import { unreachable } from "./../_shared/uncreachable.js";
const bulletMarkers = ["•", "◦", "▪"];
const toAlpha = (value) => {
  let current = value;
  let result = "";
  while (current > 0) {
    current -= 1;
    result = String.fromCharCode(65 + current % 26) + result;
    current = Math.floor(current / 26);
  }
  return result;
};
const romanNumerals = [
  ["M", 1e3],
  ["CM", 900],
  ["D", 500],
  ["CD", 400],
  ["C", 100],
  ["XC", 90],
  ["L", 50],
  ["XL", 40],
  ["X", 10],
  ["IX", 9],
  ["V", 5],
  ["IV", 4],
  ["I", 1]
];
const toRoman = (value) => {
  let current = value;
  let result = "";
  romanNumerals.forEach(([symbol, amount]) => {
    while (current >= amount) {
      result += symbol;
      current -= amount;
    }
  });
  return result || "I";
};
const getMarker = ({
  data,
  depth,
  indices,
  visibleIndex
}) => {
  switch (data.listStyle) {
    case "PLAIN":
      return null;
    case "BULLETED":
      return bulletMarkers[depth % bulletMarkers.length];
    case "NUMBERED":
      return indices.join(".");
    case "LETTERS":
      return indices.map((i) => toAlpha(i)).join(".");
    case "ROMAN":
      return toRoman(visibleIndex);
    case "ALPHABETICAL_INDEX":
    case "ALPHABETICAL_INDEX_COMPACT":
    case void 0:
      return null;
    default:
      unreachable(data.listStyle);
      return null;
  }
};
const getListTag = (listStyle) => {
  return listStyle === "BULLETED" || listStyle === "PLAIN" ? "ul" : "ol";
};
export {
  bulletMarkers,
  getListTag,
  getMarker,
  toAlpha,
  toRoman
};
//# sourceMappingURL=markers.js.map
