"use client";
import { checkBullet as I } from "../util/check-bullet.js";
import { checkListItemIndent as k } from "../util/check-list-item-indent.js";
function b(l, e, t, m) {
  const c = k(t);
  let r = t.bulletCurrent || I(t);
  e && e.type === "list" && e.ordered && (r = (typeof e.start == "number" && e.start > -1 ? e.start : 1) + (t.options.incrementListMarker === !1 ? 0 : e.children.indexOf(l)) + r);
  let i = r.length + 1;
  (c === "tab" || c === "mixed" && (e && e.type === "list" && e.spread || l.spread)) && (i = Math.ceil(i / 4) * 4);
  const n = t.createTracker(m);
  n.move(r + " ".repeat(i - r.length)), n.shift(i);
  const u = t.enter("listItem"), f = t.indentLines(
    t.containerFlow(l, n.current()),
    d
  );
  return u(), f;
  function d(o, h, s) {
    return h ? (s ? "" : " ".repeat(i)) + o : (s ? r : r + " ".repeat(i - r.length)) + o;
  }
}
export {
  b as listItem
};
