import { __exports as m } from "../../../../../../../../_virtual/traverse.js";
import { __require as n } from "../definitions/index.js";
Object.defineProperty(m, "__esModule", {
  value: !0
});
m.default = c;
var v = n();
function c(r, f, p) {
  typeof f == "function" && (f = {
    enter: f
  });
  const {
    enter: u,
    exit: i
  } = f;
  _(r, u, i, p, []);
}
function _(r, f, p, u, i) {
  const y = v.VISITOR_KEYS[r.type];
  if (!!y) {
    f && f(r, i, u);
    for (const t of y) {
      const e = r[t];
      if (Array.isArray(e))
        for (let o = 0; o < e.length; o++) {
          const l = e[o];
          !l || (i.push({
            node: r,
            key: t,
            index: o
          }), _(l, f, p, u, i), i.pop());
        }
      else
        e && (i.push({
          node: r,
          key: t
        }), _(e, f, p, u, i), i.pop());
    }
    p && p(r, i, u);
  }
}
//# sourceMappingURL=traverse.js.map
