import { getTag as x } from "./get-tag.js";
const u = (o, e = "Unkown", r, i, t) => {
  const s = i({ name: e }, t), c = o.title ?? e;
  return r.set(s, c), {
    id: s,
    title: c,
    name: e,
    schema: o
  };
}, m = (o, e, r, i) => {
  var c, a;
  const t = ((c = o.components) == null ? void 0 : c.schemas) ?? {}, s = [];
  for (const n in t)
    t[n]["x-internal"] || t[n]["x-scalar-ignore"] || !Object.hasOwn(t, n) || ((a = t[n]["x-tags"]) != null && a.length ? t[n]["x-tags"].forEach((h) => {
      var g;
      const { tag: f } = x(e, h);
      (g = e.get(h)) == null || g.entries.push(u(t[n], n, r, i, f));
    }) : s.push(u(t[n], n, r, i)));
  return s;
};
export {
  m as traverseSchemas
};
