import { getTag as l } from "./get-tag.js";
const i = (e, r, t = "Unknown", n, c, h) => {
  const g = e.summary || t, o = c({ name: t, method: r }, h);
  return n.set(o, g), {
    id: o,
    title: g,
    name: t,
    webhook: e,
    method: r
  };
}, x = (e, r, t, n) => {
  const c = [];
  return Object.entries(e.webhooks ?? {}).forEach(([h, g]) => {
    Object.entries(g ?? {}).forEach(([u, s]) => {
      var f;
      s["x-internal"] || s["x-scalar-ignore"] || ((f = s.tags) != null && f.length ? s.tags.forEach((E) => {
        var b;
        const { tag: k } = l(r, E);
        (b = r.get(E)) == null || b.entries.push(i(s, u, h, t, n, k));
      }) : c.push(i(s, u, h, t, n)));
    });
  }), c;
};
export {
  x as traverseWebhooks
};
