import { getHeadingsFromMarkdown as c, getLowestHeadingLevel as d } from "../../../libs/markdown.js";
const f = "introduction", v = (n, l, u) => {
  var i;
  if (!(n != null && n.trim()))
    return [];
  const h = c(n), o = d(h), r = [];
  let s = null;
  if (n && !n.trim().startsWith("#")) {
    const e = {
      depth: 1,
      value: "Introduction",
      slug: f
    }, t = u(e), a = e.value;
    r.push({
      id: t,
      title: a
    }), l.set(t, a);
  }
  for (const e of h) {
    if (e.depth !== o && e.depth !== o + 1)
      continue;
    const t = {
      id: u(e),
      title: e.value
    };
    l.set(t.id, t.title), e.depth === o ? (t.children = [], r.push(t), s = t) : s && ((i = s.children) == null || i.push(t));
  }
  return r;
};
export {
  f as DEFAULT_INTRODUCTION_SLUG,
  v as traverseDescription
};
