@pactflow/openapi-pact-comparator 1.13.1 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.cjs CHANGED
@@ -4321,7 +4321,7 @@ const {
4321
4321
  Help,
4322
4322
  } = commander;
4323
4323
 
4324
- var version = "1.13.1";
4324
+ var version = "1.15.0";
4325
4325
  var packageJson = {
4326
4326
  version: version};
4327
4327
 
@@ -11276,7 +11276,7 @@ function setCacheAdd(value) {
11276
11276
  * @name has
11277
11277
  * @memberOf SetCache
11278
11278
  * @param {*} value The value to search for.
11279
- * @returns {number} Returns `true` if `value` is found, else `false`.
11279
+ * @returns {boolean} Returns `true` if `value` is found, else `false`.
11280
11280
  */
11281
11281
  function setCacheHas(value) {
11282
11282
  return this.__data__.has(value);
@@ -11774,7 +11774,9 @@ var hasOwnProperty = objectProto.hasOwnProperty;
11774
11774
  function baseUnset(object, path) {
11775
11775
  path = castPath(path, object);
11776
11776
 
11777
- // Prevent prototype pollution, see: https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg
11777
+ // Prevent prototype pollution:
11778
+ // https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg
11779
+ // https://github.com/lodash/lodash/security/advisories/GHSA-f23m-r3pf-42rh
11778
11780
  var index = -1,
11779
11781
  length = path.length;
11780
11782
 
@@ -11782,32 +11784,17 @@ function baseUnset(object, path) {
11782
11784
  return true;
11783
11785
  }
11784
11786
 
11785
- var isRootPrimitive = object == null || (typeof object !== 'object' && typeof object !== 'function');
11786
-
11787
11787
  while (++index < length) {
11788
- var key = path[index];
11789
-
11790
- // skip non-string keys (e.g., Symbols, numbers)
11791
- if (typeof key !== 'string') {
11792
- continue;
11793
- }
11788
+ var key = toKey(path[index]);
11794
11789
 
11795
11790
  // Always block "__proto__" anywhere in the path if it's not expected
11796
11791
  if (key === '__proto__' && !hasOwnProperty.call(object, '__proto__')) {
11797
11792
  return false;
11798
11793
  }
11799
11794
 
11800
- // Block "constructor.prototype" chains
11801
- if (key === 'constructor' &&
11802
- (index + 1) < length &&
11803
- typeof path[index + 1] === 'string' &&
11804
- path[index + 1] === 'prototype') {
11805
-
11806
- // Allow ONLY when the path starts at a primitive root, e.g., _.unset(0, 'constructor.prototype.a')
11807
- if (isRootPrimitive && index === 0) {
11808
- continue;
11809
- }
11810
-
11795
+ // Block constructor/prototype as non-terminal traversal keys to prevent
11796
+ // escaping the object graph into built-in constructors and prototypes.
11797
+ if ((key === 'constructor' || key === 'prototype') && index < length - 1) {
11811
11798
  return false;
11812
11799
  }
11813
11800
  }
@@ -12144,6 +12131,25 @@ const transformResponseSchema = (schema, noTransformNonNullableResponseSchema) =
12144
12131
  return schema;
12145
12132
  };
12146
12133
 
12134
+ function _inlinePropertyRefs(s, root) {
12135
+ if (!s.properties)
12136
+ return s;
12137
+ const properties = {};
12138
+ let changed = false;
12139
+ for (const key in s.properties) {
12140
+ const prop = s.properties[key];
12141
+ if (prop.$ref && Object.keys(prop).length === 1) {
12142
+ const deref = get$1(root, splitPath(prop.$ref));
12143
+ if (deref) {
12144
+ properties[key] = _flat(deref, root);
12145
+ changed = true;
12146
+ continue;
12147
+ }
12148
+ }
12149
+ properties[key] = prop;
12150
+ }
12151
+ return changed ? { ...s, properties } : s;
12152
+ }
12147
12153
  function _flat(s, root) {
12148
12154
  if (s.allOf) {
12149
12155
  const { allOf, ...others } = s;
@@ -12156,7 +12162,10 @@ function _flat(s, root) {
12156
12162
  ...get$1(root, splitPath($ref)),
12157
12163
  };
12158
12164
  }
12159
- return _flat(dereferenced || ss, root);
12165
+ // Inline pure $ref property schemas before merging so that lodash merge
12166
+ // doesn't produce broken { $ref, properties } hybrids when two allOf
12167
+ // branches define the same property key differently.
12168
+ return _inlinePropertyRefs(_flat(dereferenced || ss, root), root);
12160
12169
  }));
12161
12170
  }
12162
12171
  if (s.properties) {
@@ -12953,9 +12962,8 @@ function requireSideChannelList () {
12953
12962
  }
12954
12963
  },
12955
12964
  'delete': function (key) {
12956
- var root = $o && $o.next;
12957
12965
  var deletedNode = listDelete($o, key);
12958
- if (deletedNode && root && root === deletedNode) {
12966
+ if (deletedNode && $o && !$o.next) {
12959
12967
  $o = void undefined;
12960
12968
  }
12961
12969
  return !!deletedNode;
@@ -12977,7 +12985,6 @@ function requireSideChannelList () {
12977
12985
  listSet(/** @type {NonNullable<typeof $o>} */ ($o), key, value);
12978
12986
  }
12979
12987
  };
12980
- // @ts-expect-error TODO: figure out why this is erroring
12981
12988
  return channel;
12982
12989
  };
12983
12990
  return sideChannelList;
@@ -15052,10 +15059,10 @@ function requireParse$1 () {
15052
15059
  var limit = options.parameterLimit === Infinity ? void undefined : options.parameterLimit;
15053
15060
  var parts = cleanStr.split(
15054
15061
  options.delimiter,
15055
- options.throwOnLimitExceeded ? limit + 1 : limit
15062
+ options.throwOnLimitExceeded && typeof limit !== 'undefined' ? limit + 1 : limit
15056
15063
  );
15057
15064
 
15058
- if (options.throwOnLimitExceeded && parts.length > limit) {
15065
+ if (options.throwOnLimitExceeded && typeof limit !== 'undefined' && parts.length > limit) {
15059
15066
  throw new RangeError('Parameter limit exceeded. Only ' + limit + ' parameter' + (limit === 1 ? '' : 's') + ' allowed.');
15060
15067
  }
15061
15068
 
@@ -16037,7 +16044,7 @@ function* compareReqBody(ajv, route, interaction, index, config) {
16037
16044
  pathName: path,
16038
16045
  value: get$1(operation, "requestBody.content"),
16039
16046
  },
16040
- type: "error",
16047
+ type: "warning",
16041
16048
  };
16042
16049
  }
16043
16050
  }
@@ -20535,18 +20542,18 @@ var hasRequiredCode$1;
20535
20542
  function requireCode$1 () {
20536
20543
  if (hasRequiredCode$1) return code$1;
20537
20544
  hasRequiredCode$1 = 1;
20538
- (function (exports$1) {
20539
- Object.defineProperty(exports$1, "__esModule", { value: true });
20540
- exports$1.regexpCode = exports$1.getEsmExportName = exports$1.getProperty = exports$1.safeStringify = exports$1.stringify = exports$1.strConcat = exports$1.addCodeArg = exports$1.str = exports$1._ = exports$1.nil = exports$1._Code = exports$1.Name = exports$1.IDENTIFIER = exports$1._CodeOrName = void 0;
20545
+ (function (exports) {
20546
+ Object.defineProperty(exports, "__esModule", { value: true });
20547
+ exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
20541
20548
  // eslint-disable-next-line @typescript-eslint/no-extraneous-class
20542
20549
  class _CodeOrName {
20543
20550
  }
20544
- exports$1._CodeOrName = _CodeOrName;
20545
- exports$1.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
20551
+ exports._CodeOrName = _CodeOrName;
20552
+ exports.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
20546
20553
  class Name extends _CodeOrName {
20547
20554
  constructor(s) {
20548
20555
  super();
20549
- if (!exports$1.IDENTIFIER.test(s))
20556
+ if (!exports.IDENTIFIER.test(s))
20550
20557
  throw new Error("CodeGen: name must be a valid identifier");
20551
20558
  this.str = s;
20552
20559
  }
@@ -20560,7 +20567,7 @@ function requireCode$1 () {
20560
20567
  return { [this.str]: 1 };
20561
20568
  }
20562
20569
  }
20563
- exports$1.Name = Name;
20570
+ exports.Name = Name;
20564
20571
  class _Code extends _CodeOrName {
20565
20572
  constructor(code) {
20566
20573
  super();
@@ -20588,8 +20595,8 @@ function requireCode$1 () {
20588
20595
  }, {})));
20589
20596
  }
20590
20597
  }
20591
- exports$1._Code = _Code;
20592
- exports$1.nil = new _Code("");
20598
+ exports._Code = _Code;
20599
+ exports.nil = new _Code("");
20593
20600
  function _(strs, ...args) {
20594
20601
  const code = [strs[0]];
20595
20602
  let i = 0;
@@ -20599,7 +20606,7 @@ function requireCode$1 () {
20599
20606
  }
20600
20607
  return new _Code(code);
20601
20608
  }
20602
- exports$1._ = _;
20609
+ exports._ = _;
20603
20610
  const plus = new _Code("+");
20604
20611
  function str(strs, ...args) {
20605
20612
  const expr = [safeStringify(strs[0])];
@@ -20612,7 +20619,7 @@ function requireCode$1 () {
20612
20619
  optimize(expr);
20613
20620
  return new _Code(expr);
20614
20621
  }
20615
- exports$1.str = str;
20622
+ exports.str = str;
20616
20623
  function addCodeArg(code, arg) {
20617
20624
  if (arg instanceof _Code)
20618
20625
  code.push(...arg._items);
@@ -20621,7 +20628,7 @@ function requireCode$1 () {
20621
20628
  else
20622
20629
  code.push(interpolate(arg));
20623
20630
  }
20624
- exports$1.addCodeArg = addCodeArg;
20631
+ exports.addCodeArg = addCodeArg;
20625
20632
  function optimize(expr) {
20626
20633
  let i = 1;
20627
20634
  while (i < expr.length - 1) {
@@ -20657,7 +20664,7 @@ function requireCode$1 () {
20657
20664
  function strConcat(c1, c2) {
20658
20665
  return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str `${c1}${c2}`;
20659
20666
  }
20660
- exports$1.strConcat = strConcat;
20667
+ exports.strConcat = strConcat;
20661
20668
  // TODO do not allow arrays here
20662
20669
  function interpolate(x) {
20663
20670
  return typeof x == "number" || typeof x == "boolean" || x === null
@@ -20667,29 +20674,29 @@ function requireCode$1 () {
20667
20674
  function stringify(x) {
20668
20675
  return new _Code(safeStringify(x));
20669
20676
  }
20670
- exports$1.stringify = stringify;
20677
+ exports.stringify = stringify;
20671
20678
  function safeStringify(x) {
20672
20679
  return JSON.stringify(x)
20673
20680
  .replace(/\u2028/g, "\\u2028")
20674
20681
  .replace(/\u2029/g, "\\u2029");
20675
20682
  }
20676
- exports$1.safeStringify = safeStringify;
20683
+ exports.safeStringify = safeStringify;
20677
20684
  function getProperty(key) {
20678
- return typeof key == "string" && exports$1.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _ `[${key}]`;
20685
+ return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _ `[${key}]`;
20679
20686
  }
20680
- exports$1.getProperty = getProperty;
20687
+ exports.getProperty = getProperty;
20681
20688
  //Does best effort to format the name properly
20682
20689
  function getEsmExportName(key) {
20683
- if (typeof key == "string" && exports$1.IDENTIFIER.test(key)) {
20690
+ if (typeof key == "string" && exports.IDENTIFIER.test(key)) {
20684
20691
  return new _Code(`${key}`);
20685
20692
  }
20686
20693
  throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`);
20687
20694
  }
20688
- exports$1.getEsmExportName = getEsmExportName;
20695
+ exports.getEsmExportName = getEsmExportName;
20689
20696
  function regexpCode(rx) {
20690
20697
  return new _Code(rx.toString());
20691
20698
  }
20692
- exports$1.regexpCode = regexpCode;
20699
+ exports.regexpCode = regexpCode;
20693
20700
 
20694
20701
  } (code$1));
20695
20702
  return code$1;
@@ -20702,9 +20709,9 @@ var hasRequiredScope;
20702
20709
  function requireScope () {
20703
20710
  if (hasRequiredScope) return scope;
20704
20711
  hasRequiredScope = 1;
20705
- (function (exports$1) {
20706
- Object.defineProperty(exports$1, "__esModule", { value: true });
20707
- exports$1.ValueScope = exports$1.ValueScopeName = exports$1.Scope = exports$1.varKinds = exports$1.UsedValueState = void 0;
20712
+ (function (exports) {
20713
+ Object.defineProperty(exports, "__esModule", { value: true });
20714
+ exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = void 0;
20708
20715
  const code_1 = /*@__PURE__*/ requireCode$1();
20709
20716
  class ValueError extends Error {
20710
20717
  constructor(name) {
@@ -20716,8 +20723,8 @@ function requireScope () {
20716
20723
  (function (UsedValueState) {
20717
20724
  UsedValueState[UsedValueState["Started"] = 0] = "Started";
20718
20725
  UsedValueState[UsedValueState["Completed"] = 1] = "Completed";
20719
- })(UsedValueState || (exports$1.UsedValueState = UsedValueState = {}));
20720
- exports$1.varKinds = {
20726
+ })(UsedValueState || (exports.UsedValueState = UsedValueState = {}));
20727
+ exports.varKinds = {
20721
20728
  const: new code_1.Name("const"),
20722
20729
  let: new code_1.Name("let"),
20723
20730
  var: new code_1.Name("var"),
@@ -20746,7 +20753,7 @@ function requireScope () {
20746
20753
  return (this._names[prefix] = { prefix, index: 0 });
20747
20754
  }
20748
20755
  }
20749
- exports$1.Scope = Scope;
20756
+ exports.Scope = Scope;
20750
20757
  class ValueScopeName extends code_1.Name {
20751
20758
  constructor(prefix, nameStr) {
20752
20759
  super(nameStr);
@@ -20757,7 +20764,7 @@ function requireScope () {
20757
20764
  this.scopePath = (0, code_1._) `.${new code_1.Name(property)}[${itemIndex}]`;
20758
20765
  }
20759
20766
  }
20760
- exports$1.ValueScopeName = ValueScopeName;
20767
+ exports.ValueScopeName = ValueScopeName;
20761
20768
  const line = (0, code_1._) `\n`;
20762
20769
  class ValueScope extends Scope {
20763
20770
  constructor(opts) {
@@ -20828,7 +20835,7 @@ function requireScope () {
20828
20835
  nameSet.set(name, UsedValueState.Started);
20829
20836
  let c = valueCode(name);
20830
20837
  if (c) {
20831
- const def = this.opts.es5 ? exports$1.varKinds.var : exports$1.varKinds.const;
20838
+ const def = this.opts.es5 ? exports.varKinds.var : exports.varKinds.const;
20832
20839
  code = (0, code_1._) `${code}${def} ${name} = ${c};${this.opts._n}`;
20833
20840
  }
20834
20841
  else if ((c = getCode === null || getCode === void 0 ? void 0 : getCode(name))) {
@@ -20843,7 +20850,7 @@ function requireScope () {
20843
20850
  return code;
20844
20851
  }
20845
20852
  }
20846
- exports$1.ValueScope = ValueScope;
20853
+ exports.ValueScope = ValueScope;
20847
20854
 
20848
20855
  } (scope));
20849
20856
  return scope;
@@ -20854,26 +20861,26 @@ var hasRequiredCodegen;
20854
20861
  function requireCodegen () {
20855
20862
  if (hasRequiredCodegen) return codegen;
20856
20863
  hasRequiredCodegen = 1;
20857
- (function (exports$1) {
20858
- Object.defineProperty(exports$1, "__esModule", { value: true });
20859
- exports$1.or = exports$1.and = exports$1.not = exports$1.CodeGen = exports$1.operators = exports$1.varKinds = exports$1.ValueScopeName = exports$1.ValueScope = exports$1.Scope = exports$1.Name = exports$1.regexpCode = exports$1.stringify = exports$1.getProperty = exports$1.nil = exports$1.strConcat = exports$1.str = exports$1._ = void 0;
20864
+ (function (exports) {
20865
+ Object.defineProperty(exports, "__esModule", { value: true });
20866
+ exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.regexpCode = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = void 0;
20860
20867
  const code_1 = /*@__PURE__*/ requireCode$1();
20861
20868
  const scope_1 = /*@__PURE__*/ requireScope();
20862
20869
  var code_2 = /*@__PURE__*/ requireCode$1();
20863
- Object.defineProperty(exports$1, "_", { enumerable: true, get: function () { return code_2._; } });
20864
- Object.defineProperty(exports$1, "str", { enumerable: true, get: function () { return code_2.str; } });
20865
- Object.defineProperty(exports$1, "strConcat", { enumerable: true, get: function () { return code_2.strConcat; } });
20866
- Object.defineProperty(exports$1, "nil", { enumerable: true, get: function () { return code_2.nil; } });
20867
- Object.defineProperty(exports$1, "getProperty", { enumerable: true, get: function () { return code_2.getProperty; } });
20868
- Object.defineProperty(exports$1, "stringify", { enumerable: true, get: function () { return code_2.stringify; } });
20869
- Object.defineProperty(exports$1, "regexpCode", { enumerable: true, get: function () { return code_2.regexpCode; } });
20870
- Object.defineProperty(exports$1, "Name", { enumerable: true, get: function () { return code_2.Name; } });
20870
+ Object.defineProperty(exports, "_", { enumerable: true, get: function () { return code_2._; } });
20871
+ Object.defineProperty(exports, "str", { enumerable: true, get: function () { return code_2.str; } });
20872
+ Object.defineProperty(exports, "strConcat", { enumerable: true, get: function () { return code_2.strConcat; } });
20873
+ Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return code_2.nil; } });
20874
+ Object.defineProperty(exports, "getProperty", { enumerable: true, get: function () { return code_2.getProperty; } });
20875
+ Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return code_2.stringify; } });
20876
+ Object.defineProperty(exports, "regexpCode", { enumerable: true, get: function () { return code_2.regexpCode; } });
20877
+ Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return code_2.Name; } });
20871
20878
  var scope_2 = /*@__PURE__*/ requireScope();
20872
- Object.defineProperty(exports$1, "Scope", { enumerable: true, get: function () { return scope_2.Scope; } });
20873
- Object.defineProperty(exports$1, "ValueScope", { enumerable: true, get: function () { return scope_2.ValueScope; } });
20874
- Object.defineProperty(exports$1, "ValueScopeName", { enumerable: true, get: function () { return scope_2.ValueScopeName; } });
20875
- Object.defineProperty(exports$1, "varKinds", { enumerable: true, get: function () { return scope_2.varKinds; } });
20876
- exports$1.operators = {
20879
+ Object.defineProperty(exports, "Scope", { enumerable: true, get: function () { return scope_2.Scope; } });
20880
+ Object.defineProperty(exports, "ValueScope", { enumerable: true, get: function () { return scope_2.ValueScope; } });
20881
+ Object.defineProperty(exports, "ValueScopeName", { enumerable: true, get: function () { return scope_2.ValueScopeName; } });
20882
+ Object.defineProperty(exports, "varKinds", { enumerable: true, get: function () { return scope_2.varKinds; } });
20883
+ exports.operators = {
20877
20884
  GT: new code_1._Code(">"),
20878
20885
  GTE: new code_1._Code(">="),
20879
20886
  LT: new code_1._Code("<"),
@@ -21287,7 +21294,7 @@ function requireCodegen () {
21287
21294
  }
21288
21295
  // `+=` code
21289
21296
  add(lhs, rhs) {
21290
- return this._leafNode(new AssignOp(lhs, exports$1.operators.ADD, rhs));
21297
+ return this._leafNode(new AssignOp(lhs, exports.operators.ADD, rhs));
21291
21298
  }
21292
21299
  // appends passed SafeExpr to code or executes Block
21293
21300
  code(c) {
@@ -21489,7 +21496,7 @@ function requireCodegen () {
21489
21496
  ns[ns.length - 1] = node;
21490
21497
  }
21491
21498
  }
21492
- exports$1.CodeGen = CodeGen;
21499
+ exports.CodeGen = CodeGen;
21493
21500
  function addNames(names, from) {
21494
21501
  for (const n in from)
21495
21502
  names[n] = (names[n] || 0) + (from[n] || 0);
@@ -21531,19 +21538,19 @@ function requireCodegen () {
21531
21538
  function not(x) {
21532
21539
  return typeof x == "boolean" || typeof x == "number" || x === null ? !x : (0, code_1._) `!${par(x)}`;
21533
21540
  }
21534
- exports$1.not = not;
21535
- const andCode = mappend(exports$1.operators.AND);
21541
+ exports.not = not;
21542
+ const andCode = mappend(exports.operators.AND);
21536
21543
  // boolean AND (&&) expression with the passed arguments
21537
21544
  function and(...args) {
21538
21545
  return args.reduce(andCode);
21539
21546
  }
21540
- exports$1.and = and;
21541
- const orCode = mappend(exports$1.operators.OR);
21547
+ exports.and = and;
21548
+ const orCode = mappend(exports.operators.OR);
21542
21549
  // boolean OR (||) expression with the passed arguments
21543
21550
  function or(...args) {
21544
21551
  return args.reduce(orCode);
21545
21552
  }
21546
- exports$1.or = or;
21553
+ exports.or = or;
21547
21554
  function mappend(op) {
21548
21555
  return (x, y) => (x === code_1.nil ? y : y === code_1.nil ? x : (0, code_1._) `${par(x)} ${op} ${par(y)}`);
21549
21556
  }
@@ -21784,21 +21791,21 @@ var hasRequiredErrors;
21784
21791
  function requireErrors () {
21785
21792
  if (hasRequiredErrors) return errors;
21786
21793
  hasRequiredErrors = 1;
21787
- (function (exports$1) {
21788
- Object.defineProperty(exports$1, "__esModule", { value: true });
21789
- exports$1.extendErrors = exports$1.resetErrorsCount = exports$1.reportExtraError = exports$1.reportError = exports$1.keyword$DataError = exports$1.keywordError = void 0;
21794
+ (function (exports) {
21795
+ Object.defineProperty(exports, "__esModule", { value: true });
21796
+ exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = void 0;
21790
21797
  const codegen_1 = /*@__PURE__*/ requireCodegen();
21791
21798
  const util_1 = /*@__PURE__*/ requireUtil$1();
21792
21799
  const names_1 = /*@__PURE__*/ requireNames();
21793
- exports$1.keywordError = {
21800
+ exports.keywordError = {
21794
21801
  message: ({ keyword }) => (0, codegen_1.str) `must pass "${keyword}" keyword validation`,
21795
21802
  };
21796
- exports$1.keyword$DataError = {
21803
+ exports.keyword$DataError = {
21797
21804
  message: ({ keyword, schemaType }) => schemaType
21798
21805
  ? (0, codegen_1.str) `"${keyword}" keyword must be ${schemaType} ($data)`
21799
21806
  : (0, codegen_1.str) `"${keyword}" keyword is invalid ($data)`,
21800
21807
  };
21801
- function reportError(cxt, error = exports$1.keywordError, errorPaths, overrideAllErrors) {
21808
+ function reportError(cxt, error = exports.keywordError, errorPaths, overrideAllErrors) {
21802
21809
  const { it } = cxt;
21803
21810
  const { gen, compositeRule, allErrors } = it;
21804
21811
  const errObj = errorObjectCode(cxt, error, errorPaths);
@@ -21809,8 +21816,8 @@ function requireErrors () {
21809
21816
  returnErrors(it, (0, codegen_1._) `[${errObj}]`);
21810
21817
  }
21811
21818
  }
21812
- exports$1.reportError = reportError;
21813
- function reportExtraError(cxt, error = exports$1.keywordError, errorPaths) {
21819
+ exports.reportError = reportError;
21820
+ function reportExtraError(cxt, error = exports.keywordError, errorPaths) {
21814
21821
  const { it } = cxt;
21815
21822
  const { gen, compositeRule, allErrors } = it;
21816
21823
  const errObj = errorObjectCode(cxt, error, errorPaths);
@@ -21819,12 +21826,12 @@ function requireErrors () {
21819
21826
  returnErrors(it, names_1.default.vErrors);
21820
21827
  }
21821
21828
  }
21822
- exports$1.reportExtraError = reportExtraError;
21829
+ exports.reportExtraError = reportExtraError;
21823
21830
  function resetErrorsCount(gen, errsCount) {
21824
21831
  gen.assign(names_1.default.errors, errsCount);
21825
21832
  gen.if((0, codegen_1._) `${names_1.default.vErrors} !== null`, () => gen.if(errsCount, () => gen.assign((0, codegen_1._) `${names_1.default.vErrors}.length`, errsCount), () => gen.assign(names_1.default.vErrors, null)));
21826
21833
  }
21827
- exports$1.resetErrorsCount = resetErrorsCount;
21834
+ exports.resetErrorsCount = resetErrorsCount;
21828
21835
  function extendErrors({ gen, keyword, schemaValue, data, errsCount, it, }) {
21829
21836
  /* istanbul ignore if */
21830
21837
  if (errsCount === undefined)
@@ -21840,7 +21847,7 @@ function requireErrors () {
21840
21847
  }
21841
21848
  });
21842
21849
  }
21843
- exports$1.extendErrors = extendErrors;
21850
+ exports.extendErrors = extendErrors;
21844
21851
  function addError(gen, errObj) {
21845
21852
  const err = gen.const("err", errObj);
21846
21853
  gen.if((0, codegen_1._) `${names_1.default.vErrors} === null`, () => gen.assign(names_1.default.vErrors, (0, codegen_1._) `[${err}]`), (0, codegen_1._) `${names_1.default.vErrors}.push(${err})`);
@@ -23834,6 +23841,15 @@ function requireUtils () {
23834
23841
  /** @type {(value: string) => boolean} */
23835
23842
  const isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
23836
23843
 
23844
+ /** @type {(value: string) => boolean} */
23845
+ const isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
23846
+
23847
+ /** @type {(value: string) => boolean} */
23848
+ const isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
23849
+
23850
+ /** @type {(value: string) => boolean} */
23851
+ const isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
23852
+
23837
23853
  /**
23838
23854
  * @param {Array<string>} input
23839
23855
  * @returns {string}
@@ -24092,31 +24108,126 @@ function requireUtils () {
24092
24108
  }
24093
24109
 
24094
24110
  /**
24095
- * @param {import('../types/index').URIComponent} component
24096
- * @param {boolean} esc
24097
- * @returns {import('../types/index').URIComponent}
24111
+ * Re-escape RFC 3986 gen-delims that must not appear literally in the host.
24112
+ * After the URI regex parses, these characters cannot be literal in the host
24113
+ * field, so any that appear after decoding came from percent-encoding and
24114
+ * must be restored to prevent authority structure changes.
24115
+ *
24116
+ * @param {string} host
24117
+ * @param {boolean} isIP - true for IPv4/IPv6 hosts (skip colon re-escaping)
24118
+ * @returns {string}
24098
24119
  */
24099
- function normalizeComponentEncoding (component, esc) {
24100
- const func = esc !== true ? escape : unescape;
24101
- if (component.scheme !== undefined) {
24102
- component.scheme = func(component.scheme);
24103
- }
24104
- if (component.userinfo !== undefined) {
24105
- component.userinfo = func(component.userinfo);
24106
- }
24107
- if (component.host !== undefined) {
24108
- component.host = func(component.host);
24120
+ const HOST_DELIMS = { '@': '%40', '/': '%2F', '?': '%3F', '#': '%23', ':': '%3A' };
24121
+ const HOST_DELIM_RE = /[@/?#:]/g;
24122
+ const HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
24123
+
24124
+ function reescapeHostDelimiters (host, isIP) {
24125
+ const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
24126
+ re.lastIndex = 0;
24127
+ return host.replace(re, (ch) => HOST_DELIMS[ch])
24128
+ }
24129
+
24130
+ /**
24131
+ * Normalizes percent escapes and optionally decodes only unreserved ASCII bytes.
24132
+ * Reserved delimiters such as `%2F` and `%2E` stay escaped.
24133
+ *
24134
+ * @param {string} input
24135
+ * @param {boolean} [decodeUnreserved=false]
24136
+ * @returns {string}
24137
+ */
24138
+ function normalizePercentEncoding (input, decodeUnreserved = false) {
24139
+ if (input.indexOf('%') === -1) {
24140
+ return input
24109
24141
  }
24110
- if (component.path !== undefined) {
24111
- component.path = func(component.path);
24142
+
24143
+ let output = '';
24144
+
24145
+ for (let i = 0; i < input.length; i++) {
24146
+ if (input[i] === '%' && i + 2 < input.length) {
24147
+ const hex = input.slice(i + 1, i + 3);
24148
+ if (isHexPair(hex)) {
24149
+ const normalizedHex = hex.toUpperCase();
24150
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
24151
+
24152
+ if (decodeUnreserved && isUnreserved(decoded)) {
24153
+ output += decoded;
24154
+ } else {
24155
+ output += '%' + normalizedHex;
24156
+ }
24157
+
24158
+ i += 2;
24159
+ continue
24160
+ }
24161
+ }
24162
+
24163
+ output += input[i];
24112
24164
  }
24113
- if (component.query !== undefined) {
24114
- component.query = func(component.query);
24165
+
24166
+ return output
24167
+ }
24168
+
24169
+ /**
24170
+ * Normalizes path data without turning reserved escapes into live path syntax.
24171
+ * Valid escapes are uppercased, raw unsafe characters are escaped, and only
24172
+ * unreserved bytes that are not `.` are decoded.
24173
+ *
24174
+ * @param {string} input
24175
+ * @returns {string}
24176
+ */
24177
+ function normalizePathEncoding (input) {
24178
+ let output = '';
24179
+
24180
+ for (let i = 0; i < input.length; i++) {
24181
+ if (input[i] === '%' && i + 2 < input.length) {
24182
+ const hex = input.slice(i + 1, i + 3);
24183
+ if (isHexPair(hex)) {
24184
+ const normalizedHex = hex.toUpperCase();
24185
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
24186
+
24187
+ if (decoded !== '.' && isUnreserved(decoded)) {
24188
+ output += decoded;
24189
+ } else {
24190
+ output += '%' + normalizedHex;
24191
+ }
24192
+
24193
+ i += 2;
24194
+ continue
24195
+ }
24196
+ }
24197
+
24198
+ if (isPathCharacter(input[i])) {
24199
+ output += input[i];
24200
+ } else {
24201
+ output += escape(input[i]);
24202
+ }
24115
24203
  }
24116
- if (component.fragment !== undefined) {
24117
- component.fragment = func(component.fragment);
24204
+
24205
+ return output
24206
+ }
24207
+
24208
+ /**
24209
+ * Escapes a component while preserving existing valid percent escapes.
24210
+ *
24211
+ * @param {string} input
24212
+ * @returns {string}
24213
+ */
24214
+ function escapePreservingEscapes (input) {
24215
+ let output = '';
24216
+
24217
+ for (let i = 0; i < input.length; i++) {
24218
+ if (input[i] === '%' && i + 2 < input.length) {
24219
+ const hex = input.slice(i + 1, i + 3);
24220
+ if (isHexPair(hex)) {
24221
+ output += '%' + hex.toUpperCase();
24222
+ i += 2;
24223
+ continue
24224
+ }
24225
+ }
24226
+
24227
+ output += escape(input[i]);
24118
24228
  }
24119
- return component
24229
+
24230
+ return output
24120
24231
  }
24121
24232
 
24122
24233
  /**
@@ -24138,7 +24249,7 @@ function requireUtils () {
24138
24249
  if (ipV6res.isIPV6 === true) {
24139
24250
  host = `[${ipV6res.escapedHost}]`;
24140
24251
  } else {
24141
- host = component.host;
24252
+ host = reescapeHostDelimiters(host, false);
24142
24253
  }
24143
24254
  }
24144
24255
  uriTokens.push(host);
@@ -24154,7 +24265,10 @@ function requireUtils () {
24154
24265
  utils = {
24155
24266
  nonSimpleDomain,
24156
24267
  recomposeAuthority,
24157
- normalizeComponentEncoding,
24268
+ reescapeHostDelimiters,
24269
+ normalizePercentEncoding,
24270
+ normalizePathEncoding,
24271
+ escapePreservingEscapes,
24158
24272
  removeDotSegments,
24159
24273
  isIPv4,
24160
24274
  isUUID,
@@ -24445,7 +24559,7 @@ function requireFastUri () {
24445
24559
  if (hasRequiredFastUri) return fastUri.exports;
24446
24560
  hasRequiredFastUri = 1;
24447
24561
 
24448
- const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = requireUtils();
24562
+ const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = requireUtils();
24449
24563
  const { SCHEMES, getSchemeHandler } = requireSchemes();
24450
24564
 
24451
24565
  /**
@@ -24456,7 +24570,7 @@ function requireFastUri () {
24456
24570
  */
24457
24571
  function normalize (uri, options) {
24458
24572
  if (typeof uri === 'string') {
24459
- uri = /** @type {T} */ (serialize(parse(uri, options), options));
24573
+ uri = /** @type {T} */ (normalizeString(uri, options));
24460
24574
  } else if (typeof uri === 'object') {
24461
24575
  uri = /** @type {T} */ (parse(serialize(uri, options), options));
24462
24576
  }
@@ -24551,21 +24665,10 @@ function requireFastUri () {
24551
24665
  * @returns {boolean}
24552
24666
  */
24553
24667
  function equal (uriA, uriB, options) {
24554
- if (typeof uriA === 'string') {
24555
- uriA = unescape(uriA);
24556
- uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true });
24557
- } else if (typeof uriA === 'object') {
24558
- uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
24559
- }
24560
-
24561
- if (typeof uriB === 'string') {
24562
- uriB = unescape(uriB);
24563
- uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true });
24564
- } else if (typeof uriB === 'object') {
24565
- uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
24566
- }
24668
+ const normalizedA = normalizeComparableURI(uriA, options);
24669
+ const normalizedB = normalizeComparableURI(uriB, options);
24567
24670
 
24568
- return uriA.toLowerCase() === uriB.toLowerCase()
24671
+ return normalizedA !== undefined && normalizedB !== undefined && normalizedA.toLowerCase() === normalizedB.toLowerCase()
24569
24672
  }
24570
24673
 
24571
24674
  /**
@@ -24601,13 +24704,13 @@ function requireFastUri () {
24601
24704
 
24602
24705
  if (component.path !== undefined) {
24603
24706
  if (!options.skipEscape) {
24604
- component.path = escape(component.path);
24707
+ component.path = escapePreservingEscapes(component.path);
24605
24708
 
24606
24709
  if (component.scheme !== undefined) {
24607
24710
  component.path = component.path.split('%3A').join(':');
24608
24711
  }
24609
24712
  } else {
24610
- component.path = unescape(component.path);
24713
+ component.path = normalizePercentEncoding(component.path);
24611
24714
  }
24612
24715
  }
24613
24716
 
@@ -24658,12 +24761,29 @@ function requireFastUri () {
24658
24761
 
24659
24762
  const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
24660
24763
 
24764
+ /**
24765
+ * @param {import('./types/index').URIComponent} parsed
24766
+ * @param {RegExpMatchArray} matches
24767
+ * @returns {string|undefined}
24768
+ */
24769
+ function getParseError (parsed, matches) {
24770
+ if (matches[2] !== undefined && parsed.path && parsed.path[0] !== '/') {
24771
+ return 'URI path must start with "/" when authority is present.'
24772
+ }
24773
+
24774
+ if (typeof parsed.port === 'number' && (parsed.port < 0 || parsed.port > 65535)) {
24775
+ return 'URI port is malformed.'
24776
+ }
24777
+
24778
+ return undefined
24779
+ }
24780
+
24661
24781
  /**
24662
24782
  * @param {string} uri
24663
24783
  * @param {import('./types/index').Options} [opts]
24664
- * @returns
24784
+ * @returns {{ parsed: import('./types/index').URIComponent, malformedAuthorityOrPort: boolean }}
24665
24785
  */
24666
- function parse (uri, opts) {
24786
+ function parseWithStatus (uri, opts) {
24667
24787
  const options = Object.assign({}, opts);
24668
24788
  /** @type {import('./types/index').URIComponent} */
24669
24789
  const parsed = {
@@ -24676,6 +24796,8 @@ function requireFastUri () {
24676
24796
  fragment: undefined
24677
24797
  };
24678
24798
 
24799
+ let malformedAuthorityOrPort = false;
24800
+
24679
24801
  let isIP = false;
24680
24802
  if (options.reference === 'suffix') {
24681
24803
  if (options.scheme) {
@@ -24701,6 +24823,13 @@ function requireFastUri () {
24701
24823
  if (isNaN(parsed.port)) {
24702
24824
  parsed.port = matches[5];
24703
24825
  }
24826
+
24827
+ const parseError = getParseError(parsed, matches);
24828
+ if (parseError !== undefined) {
24829
+ parsed.error = parsed.error || parseError;
24830
+ malformedAuthorityOrPort = true;
24831
+ }
24832
+
24704
24833
  if (parsed.host) {
24705
24834
  const ipv4result = isIPv4(parsed.host);
24706
24835
  if (ipv4result === false) {
@@ -24749,14 +24878,18 @@ function requireFastUri () {
24749
24878
  parsed.scheme = unescape(parsed.scheme);
24750
24879
  }
24751
24880
  if (parsed.host !== undefined) {
24752
- parsed.host = unescape(parsed.host);
24881
+ parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
24753
24882
  }
24754
24883
  }
24755
24884
  if (parsed.path) {
24756
- parsed.path = escape(unescape(parsed.path));
24885
+ parsed.path = normalizePathEncoding(parsed.path);
24757
24886
  }
24758
24887
  if (parsed.fragment) {
24759
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
24888
+ try {
24889
+ parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
24890
+ } catch {
24891
+ parsed.error = parsed.error || 'URI malformed';
24892
+ }
24760
24893
  }
24761
24894
  }
24762
24895
 
@@ -24767,7 +24900,54 @@ function requireFastUri () {
24767
24900
  } else {
24768
24901
  parsed.error = parsed.error || 'URI can not be parsed.';
24769
24902
  }
24770
- return parsed
24903
+ return { parsed, malformedAuthorityOrPort }
24904
+ }
24905
+
24906
+ /**
24907
+ * @param {string} uri
24908
+ * @param {import('./types/index').Options} [opts]
24909
+ * @returns
24910
+ */
24911
+ function parse (uri, opts) {
24912
+ return parseWithStatus(uri, opts).parsed
24913
+ }
24914
+
24915
+ /**
24916
+ * @param {string} uri
24917
+ * @param {import('./types/index').Options} [opts]
24918
+ * @returns {string}
24919
+ */
24920
+ function normalizeString (uri, opts) {
24921
+ return normalizeStringWithStatus(uri, opts).normalized
24922
+ }
24923
+
24924
+ /**
24925
+ * @param {string} uri
24926
+ * @param {import('./types/index').Options} [opts]
24927
+ * @returns {{ normalized: string, malformedAuthorityOrPort: boolean }}
24928
+ */
24929
+ function normalizeStringWithStatus (uri, opts) {
24930
+ const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
24931
+ return {
24932
+ normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
24933
+ malformedAuthorityOrPort
24934
+ }
24935
+ }
24936
+
24937
+ /**
24938
+ * @param {import ('./types/index').URIComponent|string} uri
24939
+ * @param {import('./types/index').Options} [opts]
24940
+ * @returns {string|undefined}
24941
+ */
24942
+ function normalizeComparableURI (uri, opts) {
24943
+ if (typeof uri === 'string') {
24944
+ const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
24945
+ return malformedAuthorityOrPort ? undefined : normalized
24946
+ }
24947
+
24948
+ if (typeof uri === 'object') {
24949
+ return serialize(uri, opts)
24950
+ }
24771
24951
  }
24772
24952
 
24773
24953
  const fastUri$1 = {
@@ -24804,18 +24984,18 @@ var hasRequiredCore$1;
24804
24984
  function requireCore$1 () {
24805
24985
  if (hasRequiredCore$1) return core$1;
24806
24986
  hasRequiredCore$1 = 1;
24807
- (function (exports$1) {
24808
- Object.defineProperty(exports$1, "__esModule", { value: true });
24809
- exports$1.CodeGen = exports$1.Name = exports$1.nil = exports$1.stringify = exports$1.str = exports$1._ = exports$1.KeywordCxt = void 0;
24987
+ (function (exports) {
24988
+ Object.defineProperty(exports, "__esModule", { value: true });
24989
+ exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
24810
24990
  var validate_1 = /*@__PURE__*/ requireValidate();
24811
- Object.defineProperty(exports$1, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
24991
+ Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
24812
24992
  var codegen_1 = /*@__PURE__*/ requireCodegen();
24813
- Object.defineProperty(exports$1, "_", { enumerable: true, get: function () { return codegen_1._; } });
24814
- Object.defineProperty(exports$1, "str", { enumerable: true, get: function () { return codegen_1.str; } });
24815
- Object.defineProperty(exports$1, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
24816
- Object.defineProperty(exports$1, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
24817
- Object.defineProperty(exports$1, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
24818
- Object.defineProperty(exports$1, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
24993
+ Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } });
24994
+ Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } });
24995
+ Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
24996
+ Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
24997
+ Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
24998
+ Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
24819
24999
  const validation_error_1 = /*@__PURE__*/ requireValidation_error();
24820
25000
  const ref_error_1 = /*@__PURE__*/ requireRef_error();
24821
25001
  const rules_1 = /*@__PURE__*/ requireRules();
@@ -24900,7 +25080,7 @@ function requireCore$1 () {
24900
25080
  constructor(opts = {}) {
24901
25081
  this.schemas = {};
24902
25082
  this.refs = {};
24903
- this.formats = {};
25083
+ this.formats = Object.create(null);
24904
25084
  this._compilations = new Set();
24905
25085
  this._loading = {};
24906
25086
  this._cache = new Map();
@@ -25295,7 +25475,7 @@ function requireCore$1 () {
25295
25475
  }
25296
25476
  Ajv.ValidationError = validation_error_1.default;
25297
25477
  Ajv.MissingRefError = ref_error_1.default;
25298
- exports$1.default = Ajv;
25478
+ exports.default = Ajv;
25299
25479
  function checkOptions(checkOpts, options, msg, log = "error") {
25300
25480
  for (const key in checkOpts) {
25301
25481
  const opt = key;
@@ -26453,13 +26633,13 @@ var hasRequiredDependencies;
26453
26633
  function requireDependencies () {
26454
26634
  if (hasRequiredDependencies) return dependencies;
26455
26635
  hasRequiredDependencies = 1;
26456
- (function (exports$1) {
26457
- Object.defineProperty(exports$1, "__esModule", { value: true });
26458
- exports$1.validateSchemaDeps = exports$1.validatePropertyDeps = exports$1.error = void 0;
26636
+ (function (exports) {
26637
+ Object.defineProperty(exports, "__esModule", { value: true });
26638
+ exports.validateSchemaDeps = exports.validatePropertyDeps = exports.error = void 0;
26459
26639
  const codegen_1 = /*@__PURE__*/ requireCodegen();
26460
26640
  const util_1 = /*@__PURE__*/ requireUtil$1();
26461
26641
  const code_1 = /*@__PURE__*/ requireCode();
26462
- exports$1.error = {
26642
+ exports.error = {
26463
26643
  message: ({ params: { property, depsCount, deps } }) => {
26464
26644
  const property_ies = depsCount === 1 ? "property" : "properties";
26465
26645
  return (0, codegen_1.str) `must have ${property_ies} ${deps} when property ${property} is present`;
@@ -26473,7 +26653,7 @@ function requireDependencies () {
26473
26653
  keyword: "dependencies",
26474
26654
  type: "object",
26475
26655
  schemaType: "object",
26476
- error: exports$1.error,
26656
+ error: exports.error,
26477
26657
  code(cxt) {
26478
26658
  const [propDeps, schDeps] = splitDependencies(cxt);
26479
26659
  validatePropertyDeps(cxt, propDeps);
@@ -26520,7 +26700,7 @@ function requireDependencies () {
26520
26700
  }
26521
26701
  }
26522
26702
  }
26523
- exports$1.validatePropertyDeps = validatePropertyDeps;
26703
+ exports.validatePropertyDeps = validatePropertyDeps;
26524
26704
  function validateSchemaDeps(cxt, schemaDeps = cxt.schema) {
26525
26705
  const { gen, data, keyword, it } = cxt;
26526
26706
  const valid = gen.name("valid");
@@ -26535,8 +26715,8 @@ function requireDependencies () {
26535
26715
  cxt.ok(valid);
26536
26716
  }
26537
26717
  }
26538
- exports$1.validateSchemaDeps = validateSchemaDeps;
26539
- exports$1.default = def;
26718
+ exports.validateSchemaDeps = validateSchemaDeps;
26719
+ exports.default = def;
26540
26720
 
26541
26721
  } (dependencies));
26542
26722
  return dependencies;
@@ -27711,9 +27891,9 @@ var hasRequiredAjv;
27711
27891
  function requireAjv () {
27712
27892
  if (hasRequiredAjv) return ajv$1.exports;
27713
27893
  hasRequiredAjv = 1;
27714
- (function (module, exports$1) {
27715
- Object.defineProperty(exports$1, "__esModule", { value: true });
27716
- exports$1.MissingRefError = exports$1.ValidationError = exports$1.CodeGen = exports$1.Name = exports$1.nil = exports$1.stringify = exports$1.str = exports$1._ = exports$1.KeywordCxt = exports$1.Ajv = void 0;
27894
+ (function (module, exports) {
27895
+ Object.defineProperty(exports, "__esModule", { value: true });
27896
+ exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv = void 0;
27717
27897
  const core_1 = /*@__PURE__*/ requireCore$1();
27718
27898
  const draft7_1 = /*@__PURE__*/ requireDraft7();
27719
27899
  const discriminator_1 = /*@__PURE__*/ requireDiscriminator();
@@ -27742,24 +27922,24 @@ function requireAjv () {
27742
27922
  super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined));
27743
27923
  }
27744
27924
  }
27745
- exports$1.Ajv = Ajv;
27746
- module.exports = exports$1 = Ajv;
27925
+ exports.Ajv = Ajv;
27926
+ module.exports = exports = Ajv;
27747
27927
  module.exports.Ajv = Ajv;
27748
- Object.defineProperty(exports$1, "__esModule", { value: true });
27749
- exports$1.default = Ajv;
27928
+ Object.defineProperty(exports, "__esModule", { value: true });
27929
+ exports.default = Ajv;
27750
27930
  var validate_1 = /*@__PURE__*/ requireValidate();
27751
- Object.defineProperty(exports$1, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
27931
+ Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
27752
27932
  var codegen_1 = /*@__PURE__*/ requireCodegen();
27753
- Object.defineProperty(exports$1, "_", { enumerable: true, get: function () { return codegen_1._; } });
27754
- Object.defineProperty(exports$1, "str", { enumerable: true, get: function () { return codegen_1.str; } });
27755
- Object.defineProperty(exports$1, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
27756
- Object.defineProperty(exports$1, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
27757
- Object.defineProperty(exports$1, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
27758
- Object.defineProperty(exports$1, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
27933
+ Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } });
27934
+ Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } });
27935
+ Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
27936
+ Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
27937
+ Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
27938
+ Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
27759
27939
  var validation_error_1 = /*@__PURE__*/ requireValidation_error();
27760
- Object.defineProperty(exports$1, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } });
27940
+ Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } });
27761
27941
  var ref_error_1 = /*@__PURE__*/ requireRef_error();
27762
- Object.defineProperty(exports$1, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } });
27942
+ Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } });
27763
27943
 
27764
27944
  } (ajv$1, ajv$1.exports));
27765
27945
  return ajv$1.exports;
@@ -28857,9 +29037,9 @@ var hasRequired_2019;
28857
29037
  function require_2019 () {
28858
29038
  if (hasRequired_2019) return _2019.exports;
28859
29039
  hasRequired_2019 = 1;
28860
- (function (module, exports$1) {
28861
- Object.defineProperty(exports$1, "__esModule", { value: true });
28862
- exports$1.MissingRefError = exports$1.ValidationError = exports$1.CodeGen = exports$1.Name = exports$1.nil = exports$1.stringify = exports$1.str = exports$1._ = exports$1.KeywordCxt = exports$1.Ajv2019 = void 0;
29040
+ (function (module, exports) {
29041
+ Object.defineProperty(exports, "__esModule", { value: true });
29042
+ exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv2019 = void 0;
28863
29043
  const core_1 = /*@__PURE__*/ requireCore$1();
28864
29044
  const draft7_1 = /*@__PURE__*/ requireDraft7();
28865
29045
  const dynamic_1 = /*@__PURE__*/ requireDynamic();
@@ -28899,24 +29079,24 @@ function require_2019 () {
28899
29079
  super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined));
28900
29080
  }
28901
29081
  }
28902
- exports$1.Ajv2019 = Ajv2019;
28903
- module.exports = exports$1 = Ajv2019;
29082
+ exports.Ajv2019 = Ajv2019;
29083
+ module.exports = exports = Ajv2019;
28904
29084
  module.exports.Ajv2019 = Ajv2019;
28905
- Object.defineProperty(exports$1, "__esModule", { value: true });
28906
- exports$1.default = Ajv2019;
29085
+ Object.defineProperty(exports, "__esModule", { value: true });
29086
+ exports.default = Ajv2019;
28907
29087
  var validate_1 = /*@__PURE__*/ requireValidate();
28908
- Object.defineProperty(exports$1, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
29088
+ Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
28909
29089
  var codegen_1 = /*@__PURE__*/ requireCodegen();
28910
- Object.defineProperty(exports$1, "_", { enumerable: true, get: function () { return codegen_1._; } });
28911
- Object.defineProperty(exports$1, "str", { enumerable: true, get: function () { return codegen_1.str; } });
28912
- Object.defineProperty(exports$1, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
28913
- Object.defineProperty(exports$1, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
28914
- Object.defineProperty(exports$1, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
28915
- Object.defineProperty(exports$1, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
29090
+ Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } });
29091
+ Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } });
29092
+ Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
29093
+ Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
29094
+ Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
29095
+ Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
28916
29096
  var validation_error_1 = /*@__PURE__*/ requireValidation_error();
28917
- Object.defineProperty(exports$1, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } });
29097
+ Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } });
28918
29098
  var ref_error_1 = /*@__PURE__*/ requireRef_error();
28919
- Object.defineProperty(exports$1, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } });
29099
+ Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } });
28920
29100
 
28921
29101
  } (_2019, _2019.exports));
28922
29102
  return _2019.exports;
@@ -28934,13 +29114,13 @@ var hasRequiredFormats;
28934
29114
  function requireFormats () {
28935
29115
  if (hasRequiredFormats) return formats;
28936
29116
  hasRequiredFormats = 1;
28937
- (function (exports$1) {
28938
- Object.defineProperty(exports$1, "__esModule", { value: true });
28939
- exports$1.formatNames = exports$1.fastFormats = exports$1.fullFormats = void 0;
29117
+ (function (exports) {
29118
+ Object.defineProperty(exports, "__esModule", { value: true });
29119
+ exports.formatNames = exports.fastFormats = exports.fullFormats = void 0;
28940
29120
  function fmtDef(validate, compare) {
28941
29121
  return { validate, compare };
28942
29122
  }
28943
- exports$1.fullFormats = {
29123
+ exports.fullFormats = {
28944
29124
  // date: http://tools.ietf.org/html/rfc3339#section-5.6
28945
29125
  date: fmtDef(date, compareDate),
28946
29126
  // date-time: http://tools.ietf.org/html/rfc3339#section-5.6
@@ -28987,8 +29167,8 @@ function requireFormats () {
28987
29167
  // unchecked string payload
28988
29168
  binary: true,
28989
29169
  };
28990
- exports$1.fastFormats = {
28991
- ...exports$1.fullFormats,
29170
+ exports.fastFormats = {
29171
+ ...exports.fullFormats,
28992
29172
  date: fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/, compareDate),
28993
29173
  time: fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareTime),
28994
29174
  "date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareDateTime),
@@ -29002,7 +29182,7 @@ function requireFormats () {
29002
29182
  // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'wilful violation')
29003
29183
  email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,
29004
29184
  };
29005
- exports$1.formatNames = Object.keys(exports$1.fullFormats);
29185
+ exports.formatNames = Object.keys(exports.fullFormats);
29006
29186
  function isLeapYear(year) {
29007
29187
  // https://tools.ietf.org/html/rfc3339#appendix-C
29008
29188
  return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
@@ -29153,9 +29333,9 @@ var hasRequiredLimit;
29153
29333
  function requireLimit () {
29154
29334
  if (hasRequiredLimit) return limit;
29155
29335
  hasRequiredLimit = 1;
29156
- (function (exports$1) {
29157
- Object.defineProperty(exports$1, "__esModule", { value: true });
29158
- exports$1.formatLimitDefinition = void 0;
29336
+ (function (exports) {
29337
+ Object.defineProperty(exports, "__esModule", { value: true });
29338
+ exports.formatLimitDefinition = void 0;
29159
29339
  const ajv_1 = /*@__PURE__*/ requireAjv();
29160
29340
  const codegen_1 = /*@__PURE__*/ requireCodegen();
29161
29341
  const ops = codegen_1.operators;
@@ -29169,7 +29349,7 @@ function requireLimit () {
29169
29349
  message: ({ keyword, schemaCode }) => (0, codegen_1.str) `should be ${KWDs[keyword].okStr} ${schemaCode}`,
29170
29350
  params: ({ keyword, schemaCode }) => (0, codegen_1._) `{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`,
29171
29351
  };
29172
- exports$1.formatLimitDefinition = {
29352
+ exports.formatLimitDefinition = {
29173
29353
  keyword: Object.keys(KWDs),
29174
29354
  type: "string",
29175
29355
  schemaType: "string",
@@ -29217,10 +29397,10 @@ function requireLimit () {
29217
29397
  dependencies: ["format"],
29218
29398
  };
29219
29399
  const formatLimitPlugin = (ajv) => {
29220
- ajv.addKeyword(exports$1.formatLimitDefinition);
29400
+ ajv.addKeyword(exports.formatLimitDefinition);
29221
29401
  return ajv;
29222
29402
  };
29223
- exports$1.default = formatLimitPlugin;
29403
+ exports.default = formatLimitPlugin;
29224
29404
 
29225
29405
  } (limit));
29226
29406
  return limit;
@@ -29231,8 +29411,8 @@ var hasRequiredDist$1;
29231
29411
  function requireDist$1 () {
29232
29412
  if (hasRequiredDist$1) return dist$2.exports;
29233
29413
  hasRequiredDist$1 = 1;
29234
- (function (module, exports$1) {
29235
- Object.defineProperty(exports$1, "__esModule", { value: true });
29414
+ (function (module, exports) {
29415
+ Object.defineProperty(exports, "__esModule", { value: true });
29236
29416
  const formats_1 = requireFormats();
29237
29417
  const limit_1 = requireLimit();
29238
29418
  const codegen_1 = /*@__PURE__*/ requireCodegen();
@@ -29264,9 +29444,9 @@ function requireDist$1 () {
29264
29444
  for (const f of list)
29265
29445
  ajv.addFormat(f, fs[f]);
29266
29446
  }
29267
- module.exports = exports$1 = formatsPlugin;
29268
- Object.defineProperty(exports$1, "__esModule", { value: true });
29269
- exports$1.default = formatsPlugin;
29447
+ module.exports = exports = formatsPlugin;
29448
+ Object.defineProperty(exports, "__esModule", { value: true });
29449
+ exports.default = formatsPlugin;
29270
29450
 
29271
29451
  } (dist$2, dist$2.exports));
29272
29452
  return dist$2.exports;
@@ -29768,9 +29948,9 @@ var hasRequiredTypes$1;
29768
29948
  function requireTypes$1 () {
29769
29949
  if (hasRequiredTypes$1) return types;
29770
29950
  hasRequiredTypes$1 = 1;
29771
- (function (exports$1) {
29772
- Object.defineProperty(exports$1, "__esModule", { value: true });
29773
- exports$1.types = void 0;
29951
+ (function (exports) {
29952
+ Object.defineProperty(exports, "__esModule", { value: true });
29953
+ exports.types = void 0;
29774
29954
  (function (types) {
29775
29955
  types[types["ROOT"] = 0] = "ROOT";
29776
29956
  types[types["GROUP"] = 1] = "GROUP";
@@ -29780,7 +29960,7 @@ function requireTypes$1 () {
29780
29960
  types[types["REPETITION"] = 5] = "REPETITION";
29781
29961
  types[types["REFERENCE"] = 6] = "REFERENCE";
29782
29962
  types[types["CHAR"] = 7] = "CHAR";
29783
- })(exports$1.types || (exports$1.types = {}));
29963
+ })(exports.types || (exports.types = {}));
29784
29964
 
29785
29965
  } (types));
29786
29966
  return types;
@@ -29803,7 +29983,7 @@ var hasRequiredTypes;
29803
29983
  function requireTypes () {
29804
29984
  if (hasRequiredTypes) return types$1;
29805
29985
  hasRequiredTypes = 1;
29806
- (function (exports$1) {
29986
+ (function (exports) {
29807
29987
  var __createBinding = (types$1 && types$1.__createBinding) || (Object.create ? (function(o, m, k, k2) {
29808
29988
  if (k2 === undefined) k2 = k;
29809
29989
  Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
@@ -29811,13 +29991,13 @@ function requireTypes () {
29811
29991
  if (k2 === undefined) k2 = k;
29812
29992
  o[k2] = m[k];
29813
29993
  }));
29814
- var __exportStar = (types$1 && types$1.__exportStar) || function(m, exports$1) {
29815
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p)) __createBinding(exports$1, m, p);
29994
+ var __exportStar = (types$1 && types$1.__exportStar) || function(m, exports) {
29995
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
29816
29996
  };
29817
- Object.defineProperty(exports$1, "__esModule", { value: true });
29818
- __exportStar(requireTokens(), exports$1);
29819
- __exportStar(requireTypes$1(), exports$1);
29820
- __exportStar(requireSetLookup(), exports$1);
29997
+ Object.defineProperty(exports, "__esModule", { value: true });
29998
+ __exportStar(requireTokens(), exports);
29999
+ __exportStar(requireTypes$1(), exports);
30000
+ __exportStar(requireSetLookup(), exports);
29821
30001
 
29822
30002
  } (types$1));
29823
30003
  return types$1;
@@ -30520,12 +30700,12 @@ var hasRequiredReconstruct;
30520
30700
  function requireReconstruct () {
30521
30701
  if (hasRequiredReconstruct) return reconstruct;
30522
30702
  hasRequiredReconstruct = 1;
30523
- (function (exports$1) {
30524
- Object.defineProperty(exports$1, "__esModule", { value: true });
30525
- exports$1.reconstruct = void 0;
30703
+ (function (exports) {
30704
+ Object.defineProperty(exports, "__esModule", { value: true });
30705
+ exports.reconstruct = void 0;
30526
30706
  const types_1 = requireTypes();
30527
30707
  const write_set_tokens_1 = requireWriteSetTokens();
30528
- const reduceStack = (stack) => stack.map(exports$1.reconstruct).join('');
30708
+ const reduceStack = (stack) => stack.map(exports.reconstruct).join('');
30529
30709
  const createAlternate = (token) => {
30530
30710
  if ('options' in token) {
30531
30711
  return token.options.map(reduceStack).join('|');
@@ -30537,7 +30717,7 @@ function requireReconstruct () {
30537
30717
  throw new Error(`options or stack must be Root or Group token`);
30538
30718
  }
30539
30719
  };
30540
- exports$1.reconstruct = (token) => {
30720
+ exports.reconstruct = (token) => {
30541
30721
  switch (token.type) {
30542
30722
  case types_1.types.ROOT:
30543
30723
  return createAlternate(token);
@@ -30588,7 +30768,7 @@ function requireReconstruct () {
30588
30768
  else {
30589
30769
  endWith = `{${min},${max}}`;
30590
30770
  }
30591
- return `${exports$1.reconstruct(token.value)}${endWith}`;
30771
+ return `${exports.reconstruct(token.value)}${endWith}`;
30592
30772
  }
30593
30773
  case types_1.types.RANGE:
30594
30774
  return `${write_set_tokens_1.setChar(token.from)}-${write_set_tokens_1.setChar(token.to)}`;
@@ -30608,7 +30788,7 @@ var hasRequiredDist;
30608
30788
  function requireDist () {
30609
30789
  if (hasRequiredDist) return dist$1.exports;
30610
30790
  hasRequiredDist = 1;
30611
- (function (module, exports$1) {
30791
+ (function (module, exports) {
30612
30792
  var __createBinding = (dist && dist.__createBinding) || (Object.create ? (function(o, m, k, k2) {
30613
30793
  if (k2 === undefined) k2 = k;
30614
30794
  Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
@@ -30616,20 +30796,20 @@ function requireDist () {
30616
30796
  if (k2 === undefined) k2 = k;
30617
30797
  o[k2] = m[k];
30618
30798
  }));
30619
- var __exportStar = (dist && dist.__exportStar) || function(m, exports$1) {
30620
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p)) __createBinding(exports$1, m, p);
30799
+ var __exportStar = (dist && dist.__exportStar) || function(m, exports) {
30800
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
30621
30801
  };
30622
- Object.defineProperty(exports$1, "__esModule", { value: true });
30623
- exports$1.types = void 0;
30802
+ Object.defineProperty(exports, "__esModule", { value: true });
30803
+ exports.types = void 0;
30624
30804
  /* istanbul ignore file */
30625
30805
  const types_1 = requireTypes();
30626
- Object.defineProperty(exports$1, "types", { enumerable: true, get: function () { return types_1.types; } });
30627
- __exportStar(requireTokenizer(), exports$1);
30628
- __exportStar(requireReconstruct(), exports$1);
30806
+ Object.defineProperty(exports, "types", { enumerable: true, get: function () { return types_1.types; } });
30807
+ __exportStar(requireTokenizer(), exports);
30808
+ __exportStar(requireReconstruct(), exports);
30629
30809
  const tokenizer_1 = requireTokenizer();
30630
30810
  const reconstruct_1 = requireReconstruct();
30631
- __exportStar(requireTypes(), exports$1);
30632
- exports$1.default = tokenizer_1.tokenizer;
30811
+ __exportStar(requireTypes(), exports);
30812
+ exports.default = tokenizer_1.tokenizer;
30633
30813
  module.exports = tokenizer_1.tokenizer;
30634
30814
  module.exports.types = types_1.types;
30635
30815
  module.exports.reconstruct = reconstruct_1.reconstruct;
@@ -30645,52 +30825,74 @@ function requireSafeRegex2 () {
30645
30825
  hasRequiredSafeRegex2 = 1;
30646
30826
 
30647
30827
  const parse = requireDist();
30648
- const types = parse.types;
30649
-
30650
- function safeRegex (re, opts) {
30651
- if (!opts) opts = {};
30652
- /* c8 ignore next */
30653
- const replimit = opts.limit === undefined ? 25 : opts.limit;
30828
+ const { types } = requireDist();
30654
30829
 
30655
- /* c8 ignore next 2 */
30656
- if (isRegExp(re)) re = re.source;
30657
- else if (typeof re !== 'string') re = String(re);
30658
-
30659
- try { re = parse(re); } catch { return false }
30830
+ /**
30831
+ * @param {*} node
30832
+ * @param {object} opts
30833
+ * @param {number} opts.reps - The number of repetitions encountered
30834
+ * @param {number} opts.limit - The maximum number of repetitions allowed
30835
+ * @param {number} starHeight - The current height of the star in the regex tree
30836
+ * @returns {boolean}
30837
+ */
30838
+ function walk (node, opts, starHeight) {
30839
+ let i;
30840
+ let ok;
30841
+ let len;
30842
+
30843
+ if (node.type === types.REPETITION) {
30844
+ starHeight++;
30845
+ opts.reps++;
30846
+ if (starHeight > 1) return false
30847
+ if (opts.reps > opts.limit) return false
30848
+ }
30849
+
30850
+ const options = node.options || node.value?.options;
30851
+ if (options) {
30852
+ for (i = 0, len = options.length; i < len; i++) {
30853
+ ok = walk({ stack: options[i] }, opts, starHeight);
30854
+ if (!ok) return false
30855
+ }
30856
+ }
30857
+ const stack = node.stack || node.value?.stack;
30858
+ if (!stack) return true
30660
30859
 
30661
- let reps = 0;
30662
- return (function walk (node, starHeight) {
30663
- let i;
30664
- let ok;
30665
- let len;
30860
+ for (i = 0, len = stack.length; i < len; i++) {
30861
+ ok = walk(stack[i], opts, starHeight);
30862
+ if (!ok) return false
30863
+ }
30666
30864
 
30667
- if (node.type === types.REPETITION) {
30668
- starHeight++;
30669
- reps++;
30670
- if (starHeight > 1) return false
30671
- if (reps > replimit) return false
30672
- }
30865
+ return true
30866
+ }
30673
30867
 
30674
- if (node.options) {
30675
- for (i = 0, len = node.options.length; i < len; i++) {
30676
- ok = walk({ stack: node.options[i] }, starHeight);
30677
- if (!ok) return false
30678
- }
30679
- }
30680
- const stack = node.stack || node.value?.stack;
30681
- if (!stack) return true
30868
+ /**
30869
+ * @param {string|RegExp} re - The regular expression to check, can be a string or RegExp object
30870
+ * @param {object} [options]
30871
+ * @param {number} [options.limit=25] - The maximum number of repetitions allowed
30872
+ * @returns {boolean} - Returns true if the regex is safe, false if it is unsafe or invalid
30873
+ */
30874
+ function safeRegex (re, options) {
30875
+ const opts = {
30876
+ reps: 0,
30877
+ limit: options?.limit ?? 25
30878
+ };
30682
30879
 
30683
- for (i = 0; i < stack.length; i++) {
30684
- ok = walk(stack[i], starHeight);
30685
- if (!ok) return false
30686
- }
30880
+ if (isRegExp(re)) re = re.source;
30881
+ else if (typeof re !== 'string') re = String(re);
30687
30882
 
30688
- return true
30689
- })(re, 0)
30883
+ try {
30884
+ return walk(parse(re), opts, 0)
30885
+ } catch {
30886
+ return false
30887
+ }
30690
30888
  }
30691
30889
 
30890
+ /**
30891
+ * @param {*} x
30892
+ * @returns {x is RegExp}
30893
+ */
30692
30894
  function isRegExp (x) {
30693
- return {}.toString.call(x) === '[object RegExp]'
30895
+ return Object.prototype.toString.call(x) === '[object RegExp]'
30694
30896
  }
30695
30897
 
30696
30898
  safeRegex2.exports = safeRegex;
@@ -31079,14 +31281,15 @@ function requireHandlerStorage () {
31079
31281
  // An example: a request comes in for version 1.x, and this node has a handler that matches the path, but there's no version constraint. For SemVer, the find-my-way semantics do not match this handler to that request.
31080
31282
  // This function is used by Nodes with handlers to match when they don't have any constrained routes to exclude request that do have must match derived constraints present.
31081
31283
  for (const constraint in constrainer.strategies) {
31284
+ if (!Object.hasOwn(constrainer.strategies, constraint)) continue
31082
31285
  const strategy = constrainer.strategies[constraint];
31083
31286
  if (strategy.mustMatchWhenDerived && !this.constraints.includes(constraint)) {
31084
31287
  lines.push(`if (derivedConstraints.${constraint} !== undefined) return null`);
31085
31288
  }
31086
31289
  }
31087
31290
 
31088
- // Return the first handler who's bit is set in the candidates https://stackoverflow.com/questions/18134985/how-to-find-index-of-first-set-bit
31089
- lines.push('return this.handlers[Math.floor(Math.log2(candidates))]');
31291
+ // Return the highest set bit index in the candidates bitmask.
31292
+ lines.push('return this.handlers[31 - Math.clz32(candidates)]');
31090
31293
 
31091
31294
  this._getHandlerMatchingConstraints = new Function('derivedConstraints', lines.join('\n')); // eslint-disable-line
31092
31295
  }
@@ -31532,6 +31735,7 @@ function requireConstrainer () {
31532
31735
  if (constraints) {
31533
31736
  const beforeSize = this.strategiesInUse.size;
31534
31737
  for (const key in constraints) {
31738
+ if (!Object.hasOwn(constraints, key)) continue
31535
31739
  const strategy = this.strategies[key];
31536
31740
  if (strategy.isAsync) {
31537
31741
  this.asyncStrategiesInUse.add(key);
@@ -31554,6 +31758,7 @@ function requireConstrainer () {
31554
31758
 
31555
31759
  validateConstraints (constraints) {
31556
31760
  for (const key in constraints) {
31761
+ if (!Object.hasOwn(constraints, key)) continue
31557
31762
  const value = constraints[key];
31558
31763
  if (typeof value === 'undefined') {
31559
31764
  throw new Error('Can\'t pass an undefined constraint value, must pass null or no key at all')
@@ -31863,6 +32068,7 @@ function requireFindMyWay () {
31863
32068
  this.ignoreTrailingSlash = opts.ignoreTrailingSlash || false;
31864
32069
  this.ignoreDuplicateSlashes = opts.ignoreDuplicateSlashes || false;
31865
32070
  this.maxParamLength = opts.maxParamLength || 100;
32071
+ this.onMaxParamLength = opts.onMaxParamLength || null;
31866
32072
  this.allowUnsafeRegex = opts.allowUnsafeRegex || false;
31867
32073
  this.constrainer = new Constrainer(opts.constraints);
31868
32074
  this.useSemicolonDelimiter = opts.useSemicolonDelimiter || false;
@@ -32370,6 +32576,7 @@ function requireFindMyWay () {
32370
32576
  const pathLen = path.length;
32371
32577
 
32372
32578
  const brothersNodesStack = [];
32579
+ let maxParamLengthExceeded = false;
32373
32580
 
32374
32581
  while (true) {
32375
32582
  if (pathIndex === pathLen && currentNode.isLeafNode) {
@@ -32388,6 +32595,9 @@ function requireFindMyWay () {
32388
32595
 
32389
32596
  if (node === null) {
32390
32597
  if (brothersNodesStack.length === 0) {
32598
+ if (maxParamLengthExceeded && this.onMaxParamLength) {
32599
+ return this._onMaxParamLength(originPath)
32600
+ }
32391
32601
  return null
32392
32602
  }
32393
32603
 
@@ -32429,18 +32639,34 @@ function requireFindMyWay () {
32429
32639
 
32430
32640
  if (currentNode.isRegex) {
32431
32641
  const matchedParameters = currentNode.regex.exec(param);
32432
- if (matchedParameters === null) continue
32642
+ if (matchedParameters === null) {
32643
+ node = null;
32644
+ continue
32645
+ }
32433
32646
 
32647
+ let regexMaxParamLengthExceeded = false;
32434
32648
  for (let i = 1; i < matchedParameters.length; i++) {
32435
32649
  const matchedParam = matchedParameters[i];
32436
32650
  if (matchedParam.length > maxParamLength) {
32437
- return null
32651
+ regexMaxParamLengthExceeded = true;
32652
+ break
32438
32653
  }
32439
- params.push(matchedParam);
32654
+ }
32655
+
32656
+ if (regexMaxParamLengthExceeded) {
32657
+ maxParamLengthExceeded = true;
32658
+ node = null;
32659
+ continue
32660
+ }
32661
+
32662
+ for (let i = 1; i < matchedParameters.length; i++) {
32663
+ params.push(matchedParameters[i]);
32440
32664
  }
32441
32665
  } else {
32442
32666
  if (param.length > maxParamLength) {
32443
- return null
32667
+ maxParamLengthExceeded = true;
32668
+ node = null;
32669
+ continue
32444
32670
  }
32445
32671
  params.push(param);
32446
32672
  }
@@ -32481,6 +32707,18 @@ function requireFindMyWay () {
32481
32707
  }
32482
32708
  };
32483
32709
 
32710
+ Router.prototype._onMaxParamLength = function (path) {
32711
+ if (this.onMaxParamLength === null) {
32712
+ return null
32713
+ }
32714
+ const onMaxParamLength = this.onMaxParamLength;
32715
+ return {
32716
+ handler: (req, res, ctx) => onMaxParamLength(path, req, res),
32717
+ params: {},
32718
+ store: null
32719
+ }
32720
+ };
32721
+
32484
32722
  Router.prototype.prettyPrint = function (options = {}) {
32485
32723
  const method = options.method;
32486
32724
 
@@ -32532,6 +32770,9 @@ function requireFindMyWay () {
32532
32770
  return decoded.path
32533
32771
  };
32534
32772
 
32773
+ Router.removeDuplicateSlashes = removeDuplicateSlashes;
32774
+ Router.trimLastSlash = trimLastSlash;
32775
+
32535
32776
  findMyWay = Router;
32536
32777
 
32537
32778
  function escapeRegExp (string) {