import { __exports as n } from "../../../../../../../../_virtual/patternProperties.js";
import { __require as k } from "../code.js";
import { __require as M } from "../../compile/codegen/index.js";
import { __require as v } from "../../compile/util.js";
var y;
function C() {
  if (y) return n;
  y = 1, Object.defineProperty(n, "__esModule", { value: !0 });
  const c = k(), s = M(), l = v(), u = v(), q = {
    keyword: "patternProperties",
    type: "object",
    schemaType: "object",
    code(p) {
      const { gen: t, schema: f, data: w, parentSchema: S, it: e } = p, { opts: d } = e, a = (0, c.allSchemaProperties)(f), P = a.filter((r) => (0, l.alwaysValidSchema)(e, f[r]));
      if (a.length === 0 || P.length === a.length && (!e.opts.unevaluated || e.props === !0))
        return;
      const m = d.strictSchema && !d.allowMatchingProperties && S.properties, i = t.name("valid");
      e.props !== !0 && !(e.props instanceof s.Name) && (e.props = (0, u.evaluatedPropsToName)(t, e.props));
      const { props: h } = e;
      $();
      function $() {
        for (const r of a)
          m && b(r), e.allErrors ? _(r) : (t.var(i, !0), _(r), t.if(i));
      }
      function b(r) {
        for (const o in m)
          new RegExp(r).test(o) && (0, l.checkStrictMode)(e, `property ${o} matches pattern ${r} (use allowMatchingProperties)`);
      }
      function _(r) {
        t.forIn("key", w, (o) => {
          t.if((0, s._)`${(0, c.usePattern)(p, r)}.test(${o})`, () => {
            const g = P.includes(r);
            g || p.subschema({
              keyword: "patternProperties",
              schemaProp: r,
              dataProp: o,
              dataPropType: u.Type.Str
            }, i), e.opts.unevaluated && h !== !0 ? t.assign((0, s._)`${h}[${o}]`, !0) : !g && !e.allErrors && t.if((0, s.not)(i), () => t.break());
          });
        });
      }
    }
  };
  return n.default = q, n;
}
export {
  C as __require
};
//# sourceMappingURL=patternProperties.js.map
