import { __exports as n } from "../../../../../../../../_virtual/oneOf.js";
import { __require as O } from "../../compile/codegen/index.js";
import { __require as v } from "../../compile/util.js";
var m;
function k() {
  if (m) return n;
  m = 1, Object.defineProperty(n, "__esModule", { value: !0 });
  const s = O(), f = v(), d = {
    keyword: "oneOf",
    schemaType: "array",
    trackErrors: !0,
    error: {
      message: "must match exactly one schema in oneOf",
      params: ({ params: e }) => (0, s._)`{passingSchemas: ${e.passing}}`
    },
    code(e) {
      const { gen: r, schema: c, parentSchema: p, it: l } = e;
      if (!Array.isArray(c))
        throw new Error("ajv implementation error");
      if (l.opts.discriminator && p.discriminator)
        return;
      const _ = c, a = r.let("valid", !1), o = r.let("passing", null), i = r.name("_valid");
      e.setParams({ passing: o }), r.block(h), e.result(a, () => e.reset(), () => e.error(!0));
      function h() {
        _.forEach((g, t) => {
          let u;
          (0, f.alwaysValidSchema)(l, g) ? r.var(i, !0) : u = e.subschema({
            keyword: "oneOf",
            schemaProp: t,
            compositeRule: !0
          }, i), t > 0 && r.if((0, s._)`${i} && ${a}`).assign(a, !1).assign(o, (0, s._)`[${o}, ${t}]`).else(), r.if(i, () => {
            r.assign(a, !0), r.assign(o, t), u && e.mergeEvaluated(u, s.Name);
          });
        });
      }
    }
  };
  return n.default = d, n;
}
export {
  k as __require
};
//# sourceMappingURL=oneOf.js.map
