import { __exports as f } from "../../../../../../../../../_virtual/removeTypeDuplicates.js";
import "../../validators/generated/index.js";
import { __exports as m } from "../../../../../../../../../_virtual/index35.js";
Object.defineProperty(f, "__esModule", {
  value: !0
});
f.default = y;
var s = m;
function u(t) {
  return (0, s.isIdentifier)(t) ? t.name : `${t.id.name}.${u(t.qualification)}`;
}
function y(t) {
  const i = {}, o = {}, c = /* @__PURE__ */ new Set(), a = [];
  for (let n = 0; n < t.length; n++) {
    const e = t[n];
    if (!!e && !(a.indexOf(e) >= 0)) {
      if ((0, s.isAnyTypeAnnotation)(e))
        return [e];
      if ((0, s.isFlowBaseAnnotation)(e)) {
        o[e.type] = e;
        continue;
      }
      if ((0, s.isUnionTypeAnnotation)(e)) {
        c.has(e.types) || (t = t.concat(e.types), c.add(e.types));
        continue;
      }
      if ((0, s.isGenericTypeAnnotation)(e)) {
        const p = u(e.id);
        if (i[p]) {
          let r = i[p];
          r.typeParameters ? e.typeParameters && (r.typeParameters.params = y(r.typeParameters.params.concat(e.typeParameters.params))) : r = e.typeParameters;
        } else
          i[p] = e;
        continue;
      }
      a.push(e);
    }
  }
  for (const n of Object.keys(o))
    a.push(o[n]);
  for (const n of Object.keys(i))
    a.push(i[n]);
  return a;
}
//# sourceMappingURL=removeTypeDuplicates.js.map
