@hyperjump/json-schema 0.23.0 → 0.23.1

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.
@@ -6,7 +6,7 @@
6
6
 
7
7
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
8
8
 
9
- var justCurryIt = curry$a;
9
+ var justCurryIt$2 = curry$j;
10
10
 
11
11
  /*
12
12
  function add(a, b, c) {
@@ -31,7 +31,7 @@
31
31
  milesToKm(10); // 16.2
32
32
  */
33
33
 
34
- function curry$a(fn, arity) {
34
+ function curry$j(fn, arity) {
35
35
  return function curried() {
36
36
  if (arity == null) {
37
37
  arity = fn.length;
@@ -1902,84 +1902,84 @@
1902
1902
 
1903
1903
  var common$1 = { jsonTypeOf: jsonTypeOf$2, resolveUrl: resolveUrl$3, urlFragment: urlFragment$1, pathRelative: pathRelative$1 };
1904
1904
 
1905
- const curry$9 = justCurryIt;
1905
+ const curry$i = justCurryIt$2;
1906
1906
 
1907
1907
 
1908
- const nil$2 = "";
1908
+ const nil$3 = "";
1909
1909
 
1910
- const compile$P = (pointer) => {
1910
+ const compile$Q = (pointer) => {
1911
1911
  if (pointer.length > 0 && pointer[0] !== "/") {
1912
1912
  throw Error("Invalid JSON Pointer");
1913
1913
  }
1914
1914
 
1915
- return pointer.split("/").slice(1).map(unescape);
1915
+ return pointer.split("/").slice(1).map(unescape$1);
1916
1916
  };
1917
1917
 
1918
- const get$2 = (pointer, value = undefined) => {
1919
- const ptr = compile$P(pointer);
1918
+ const get$3 = (pointer, value = undefined) => {
1919
+ const ptr = compile$Q(pointer);
1920
1920
 
1921
1921
  const fn = (value) => ptr.reduce(([value, pointer], segment) => {
1922
- return [applySegment(value, segment, pointer), append(segment, pointer)];
1922
+ return [applySegment$1(value, segment, pointer), append$1(segment, pointer)];
1923
1923
  }, [value, ""])[0];
1924
1924
 
1925
1925
  return value === undefined ? fn : fn(value);
1926
1926
  };
1927
1927
 
1928
- const set = (pointer, subject = undefined, value = undefined) => {
1929
- const ptr = compile$P(pointer);
1930
- const fn = curry$9((subject, value) => _set(ptr, subject, value, nil$2));
1928
+ const set$1 = (pointer, subject = undefined, value = undefined) => {
1929
+ const ptr = compile$Q(pointer);
1930
+ const fn = curry$i((subject, value) => _set$1(ptr, subject, value, nil$3));
1931
1931
  return subject === undefined ? fn : fn(subject, value);
1932
1932
  };
1933
1933
 
1934
- const _set = (pointer, subject, value, cursor) => {
1934
+ const _set$1 = (pointer, subject, value, cursor) => {
1935
1935
  if (pointer.length === 0) {
1936
1936
  return value;
1937
1937
  } else if (pointer.length > 1) {
1938
1938
  const segment = pointer.shift();
1939
- return { ...subject, [segment]: _set(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor)) };
1939
+ return { ...subject, [segment]: _set$1(pointer, applySegment$1(subject, segment, cursor), value, append$1(segment, cursor)) };
1940
1940
  } else if (Array.isArray(subject)) {
1941
1941
  const clonedSubject = [...subject];
1942
- const segment = computeSegment(subject, pointer[0]);
1942
+ const segment = computeSegment$1(subject, pointer[0]);
1943
1943
  clonedSubject[segment] = value;
1944
1944
  return clonedSubject;
1945
1945
  } else if (typeof subject === "object" && subject !== null) {
1946
1946
  return { ...subject, [pointer[0]]: value };
1947
1947
  } else {
1948
- return applySegment(subject, pointer[0], cursor);
1948
+ return applySegment$1(subject, pointer[0], cursor);
1949
1949
  }
1950
1950
  };
1951
1951
 
1952
- const assign = (pointer, subject = undefined, value = undefined) => {
1953
- const ptr = compile$P(pointer);
1954
- const fn = curry$9((subject, value) => _assign(ptr, subject, value, nil$2));
1952
+ const assign$1 = (pointer, subject = undefined, value = undefined) => {
1953
+ const ptr = compile$Q(pointer);
1954
+ const fn = curry$i((subject, value) => _assign$1(ptr, subject, value, nil$3));
1955
1955
  return subject === undefined ? fn : fn(subject, value);
1956
1956
  };
1957
1957
 
1958
- const _assign = (pointer, subject, value, cursor) => {
1958
+ const _assign$1 = (pointer, subject, value, cursor) => {
1959
1959
  if (pointer.length === 0) {
1960
1960
  return;
1961
- } else if (pointer.length === 1 && !isScalar(subject)) {
1962
- const segment = computeSegment(subject, pointer[0]);
1961
+ } else if (pointer.length === 1 && !isScalar$1(subject)) {
1962
+ const segment = computeSegment$1(subject, pointer[0]);
1963
1963
  subject[segment] = value;
1964
1964
  } else {
1965
1965
  const segment = pointer.shift();
1966
- _assign(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor));
1966
+ _assign$1(pointer, applySegment$1(subject, segment, cursor), value, append$1(segment, cursor));
1967
1967
  }
1968
1968
  };
1969
1969
 
1970
- const unset = (pointer, subject = undefined) => {
1971
- const ptr = compile$P(pointer);
1972
- const fn = (subject) => _unset(ptr, subject, nil$2);
1970
+ const unset$1 = (pointer, subject = undefined) => {
1971
+ const ptr = compile$Q(pointer);
1972
+ const fn = (subject) => _unset$1(ptr, subject, nil$3);
1973
1973
  return subject === undefined ? fn : fn(subject);
1974
1974
  };
1975
1975
 
1976
- const _unset = (pointer, subject, cursor) => {
1976
+ const _unset$1 = (pointer, subject, cursor) => {
1977
1977
  if (pointer.length == 0) {
1978
1978
  return undefined;
1979
1979
  } else if (pointer.length > 1) {
1980
1980
  const segment = pointer.shift();
1981
- const value = applySegment(subject, segment, cursor);
1982
- return { ...subject, [segment]: _unset(pointer, value, append(segment, cursor)) };
1981
+ const value = applySegment$1(subject, segment, cursor);
1982
+ return { ...subject, [segment]: _unset$1(pointer, value, append$1(segment, cursor)) };
1983
1983
  } else if (Array.isArray(subject)) {
1984
1984
  return subject.filter((_, ndx) => ndx != pointer[0]);
1985
1985
  } else if (typeof subject === "object" && subject !== null) {
@@ -1987,54 +1987,54 @@
1987
1987
  const { [pointer[0]]: _, ...result } = subject;
1988
1988
  return result;
1989
1989
  } else {
1990
- return applySegment(subject, pointer[0], cursor);
1990
+ return applySegment$1(subject, pointer[0], cursor);
1991
1991
  }
1992
1992
  };
1993
1993
 
1994
- const remove = (pointer, subject = undefined) => {
1995
- const ptr = compile$P(pointer);
1996
- const fn = (subject) => _remove(ptr, subject, nil$2);
1994
+ const remove$1 = (pointer, subject = undefined) => {
1995
+ const ptr = compile$Q(pointer);
1996
+ const fn = (subject) => _remove$1(ptr, subject, nil$3);
1997
1997
  return subject === undefined ? fn : fn(subject);
1998
1998
  };
1999
1999
 
2000
- const _remove = (pointer, subject, cursor) => {
2000
+ const _remove$1 = (pointer, subject, cursor) => {
2001
2001
  if (pointer.length === 0) {
2002
2002
  return;
2003
2003
  } else if (pointer.length > 1) {
2004
2004
  const segment = pointer.shift();
2005
- const value = applySegment(subject, segment, cursor);
2006
- _remove(pointer, value, append(segment, cursor));
2005
+ const value = applySegment$1(subject, segment, cursor);
2006
+ _remove$1(pointer, value, append$1(segment, cursor));
2007
2007
  } else if (Array.isArray(subject)) {
2008
2008
  subject.splice(pointer[0], 1);
2009
2009
  } else if (typeof subject === "object" && subject !== null) {
2010
2010
  delete subject[pointer[0]];
2011
2011
  } else {
2012
- applySegment(subject, pointer[0], cursor);
2012
+ applySegment$1(subject, pointer[0], cursor);
2013
2013
  }
2014
2014
  };
2015
2015
 
2016
- const append = curry$9((segment, pointer) => pointer + "/" + escape(segment));
2016
+ const append$1 = curry$i((segment, pointer) => pointer + "/" + escape$2(segment));
2017
2017
 
2018
- const escape = (segment) => segment.toString().replace(/~/g, "~0").replace(/\//g, "~1");
2019
- const unescape = (segment) => segment.toString().replace(/~1/g, "/").replace(/~0/g, "~");
2020
- const computeSegment = (value, segment) => Array.isArray(value) && segment === "-" ? value.length : segment;
2018
+ const escape$2 = (segment) => segment.toString().replace(/~/g, "~0").replace(/\//g, "~1");
2019
+ const unescape$1 = (segment) => segment.toString().replace(/~1/g, "/").replace(/~0/g, "~");
2020
+ const computeSegment$1 = (value, segment) => Array.isArray(value) && segment === "-" ? value.length : segment;
2021
2021
 
2022
- const applySegment = (value, segment, cursor = "") => {
2022
+ const applySegment$1 = (value, segment, cursor = "") => {
2023
2023
  if (value === undefined) {
2024
2024
  throw TypeError(`Value at '${cursor}' is undefined and does not have property '${segment}'`);
2025
2025
  } else if (value === null) {
2026
2026
  throw TypeError(`Value at '${cursor}' is null and does not have property '${segment}'`);
2027
- } else if (isScalar(value)) {
2027
+ } else if (isScalar$1(value)) {
2028
2028
  throw TypeError(`Value at '${cursor}' is a ${typeof value} and does not have property '${segment}'`);
2029
2029
  } else {
2030
- const computedSegment = computeSegment(value, segment);
2030
+ const computedSegment = computeSegment$1(value, segment);
2031
2031
  return value[computedSegment];
2032
2032
  }
2033
2033
  };
2034
2034
 
2035
- const isScalar = (value) => value === null || typeof value !== "object";
2035
+ const isScalar$1 = (value) => value === null || typeof value !== "object";
2036
2036
 
2037
- var lib$3 = { nil: nil$2, append, get: get$2, set, assign, unset, remove };
2037
+ var lib$6 = { nil: nil$3, append: append$1, get: get$3, set: set$1, assign: assign$1, unset: unset$1, remove: remove$1 };
2038
2038
 
2039
2039
  const $__value = Symbol("$__value");
2040
2040
  const $__href = Symbol("$__href");
@@ -2050,16 +2050,16 @@
2050
2050
 
2051
2051
  var reference = { cons: cons$1, isReference, href, value: value$2 };
2052
2052
 
2053
- const JsonPointer$1 = lib$3;
2054
- const curry$8 = justCurryIt;
2053
+ const JsonPointer$3 = lib$6;
2054
+ const curry$h = justCurryIt$2;
2055
2055
  const { resolveUrl: resolveUrl$2, jsonTypeOf: jsonTypeOf$1 } = common$1;
2056
2056
  const Reference$2 = reference;
2057
2057
 
2058
2058
 
2059
- const nil$1 = Object.freeze({ id: "", pointer: "", instance: undefined, value: undefined });
2060
- const cons = (instance, id = "") => Object.freeze({ ...nil$1, id: resolveUrl$2(id, ""), instance, value: instance });
2059
+ const nil$2 = Object.freeze({ id: "", pointer: "", instance: undefined, value: undefined });
2060
+ const cons = (instance, id = "") => Object.freeze({ ...nil$2, id: resolveUrl$2(id, ""), instance, value: instance });
2061
2061
 
2062
- const get$1 = (url, instance = nil$1) => {
2062
+ const get$2 = (url, instance = nil$2) => {
2063
2063
  if (!url.startsWith("#")) {
2064
2064
  throw Error(`No JSON document found at '${url.split("#")[0]}'`);
2065
2065
  }
@@ -2070,252 +2070,1275 @@
2070
2070
  const uri$1 = (doc) => `${doc.id}#${encodeURI(doc.pointer)}`;
2071
2071
  const value$1 = (doc) => Reference$2.isReference(doc.value) ? Reference$2.value(doc.value) : doc.value;
2072
2072
  const has$1 = (key, doc) => key in value$1(doc);
2073
- const typeOf$1 = curry$8((doc, type) => jsonTypeOf$1(value$1(doc), type));
2073
+ const typeOf$1 = curry$h((doc, type) => jsonTypeOf$1(value$1(doc), type));
2074
2074
 
2075
2075
  const step$1 = (key, doc) => Object.freeze({
2076
2076
  ...doc,
2077
- pointer: JsonPointer$1.append(key, doc.pointer),
2077
+ pointer: JsonPointer$3.append(key, doc.pointer),
2078
2078
  value: value$1(doc)[key]
2079
2079
  });
2080
2080
 
2081
- const entries$3 = (doc) => Object.keys(value$1(doc))
2081
+ const entries$5 = (doc) => Object.keys(value$1(doc))
2082
2082
  .map((key) => [key, step$1(key, doc)]);
2083
2083
 
2084
2084
  const keys$1 = (doc) => Object.keys(value$1(doc));
2085
2085
 
2086
- const map$4 = curry$8((fn, doc) => value$1(doc)
2086
+ const map$7 = curry$h((fn, doc) => value$1(doc)
2087
2087
  .map((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
2088
2088
 
2089
- const forEach = curry$8((fn, doc) => value$1(doc)
2089
+ const forEach = curry$h((fn, doc) => value$1(doc)
2090
2090
  .forEach((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
2091
2091
 
2092
- const filter$1 = curry$8((fn, doc) => value$1(doc)
2092
+ const filter$2 = curry$h((fn, doc) => value$1(doc)
2093
2093
  .map((item, ndx, array, thisArg) => step$1(ndx, doc))
2094
2094
  .filter((item, ndx, array, thisArg) => fn(item, ndx, array, thisArg)));
2095
2095
 
2096
- const reduce$3 = curry$8((fn, acc, doc) => value$1(doc)
2096
+ const reduce$6 = curry$h((fn, acc, doc) => value$1(doc)
2097
2097
  .reduce((acc, item, ndx) => fn(acc, step$1(ndx, doc), ndx), acc));
2098
2098
 
2099
- const every$1 = curry$8((fn, doc) => value$1(doc)
2099
+ const every$2 = curry$h((fn, doc) => value$1(doc)
2100
2100
  .every((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
2101
2101
 
2102
- const some$1 = curry$8((fn, doc) => value$1(doc)
2102
+ const some$2 = curry$h((fn, doc) => value$1(doc)
2103
2103
  .some((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
2104
2104
 
2105
2105
  const length$1 = (doc) => value$1(doc).length;
2106
2106
 
2107
2107
  var instance = {
2108
- nil: nil$1, cons, get: get$1, uri: uri$1, value: value$1, has: has$1, typeOf: typeOf$1, length: length$1,
2109
- step: step$1, entries: entries$3, keys: keys$1, map: map$4, forEach, filter: filter$1, reduce: reduce$3, every: every$1, some: some$1
2108
+ nil: nil$2, cons, get: get$2, uri: uri$1, value: value$1, has: has$1, typeOf: typeOf$1, length: length$1,
2109
+ step: step$1, entries: entries$5, keys: keys$1, map: map$7, forEach, filter: filter$2, reduce: reduce$6, every: every$2, some: some$2
2110
2110
  };
2111
2111
 
2112
- var entries$2 = async (doc) => Object.entries(await doc);
2112
+ var entries$4 = async (doc) => Object.entries(await doc);
2113
2113
 
2114
- const curry$7 = justCurryIt;
2114
+ const curry$g = justCurryIt$2;
2115
2115
 
2116
2116
 
2117
- var map$3 = curry$7(async (fn, doc) => (await doc).map(fn));
2117
+ var map$6 = curry$g(async (fn, doc) => (await doc).map(fn));
2118
2118
 
2119
- const curry$6 = justCurryIt;
2119
+ const curry$f = justCurryIt$2;
2120
2120
 
2121
2121
 
2122
- var reduce$2 = curry$6(async (fn, acc, doc) => {
2122
+ var reduce$5 = curry$f(async (fn, acc, doc) => {
2123
2123
  return (await doc).reduce(async (acc, item) => fn(await acc, item), acc);
2124
2124
  });
2125
2125
 
2126
- const curry$5 = justCurryIt;
2127
- const reduce$1 = reduce$2;
2126
+ const curry$e = justCurryIt$2;
2127
+ const reduce$4 = reduce$5;
2128
2128
 
2129
2129
 
2130
- var filter = curry$5(async (fn, doc, options = {}) => {
2131
- return reduce$1(async (acc, item) => {
2130
+ var filter$1 = curry$e(async (fn, doc, options = {}) => {
2131
+ return reduce$4(async (acc, item) => {
2132
2132
  return (await fn(item)) ? acc.concat([item]) : acc;
2133
2133
  }, [], doc, options);
2134
2134
  });
2135
2135
 
2136
- const curry$4 = justCurryIt;
2137
- const map$2 = map$3;
2136
+ const curry$d = justCurryIt$2;
2137
+ const map$5 = map$6;
2138
2138
 
2139
2139
 
2140
- var some = curry$4(async (fn, doc) => {
2141
- const results = await map$2(fn, doc);
2140
+ var some$1 = curry$d(async (fn, doc) => {
2141
+ const results = await map$5(fn, doc);
2142
2142
  return (await Promise.all(results))
2143
2143
  .some((a) => a);
2144
2144
  });
2145
2145
 
2146
- const curry$3 = justCurryIt;
2147
- const map$1 = map$3;
2146
+ const curry$c = justCurryIt$2;
2147
+ const map$4 = map$6;
2148
2148
 
2149
2149
 
2150
- var every = curry$3(async (fn, doc) => {
2151
- const results = await map$1(fn, doc);
2150
+ var every$1 = curry$c(async (fn, doc) => {
2151
+ const results = await map$4(fn, doc);
2152
2152
  return (await Promise.all(results))
2153
2153
  .every((a) => a);
2154
2154
  });
2155
2155
 
2156
- const curry$2 = justCurryIt;
2156
+ const curry$b = justCurryIt$2;
2157
2157
 
2158
2158
 
2159
- var pipeline$1 = curry$2((fns, doc) => {
2159
+ var pipeline$3 = curry$b((fns, doc) => {
2160
2160
  return fns.reduce(async (acc, fn) => fn(await acc), doc);
2161
2161
  });
2162
2162
 
2163
- var all = (doc) => Promise.all(doc);
2163
+ var all$1 = (doc) => Promise.all(doc);
2164
2164
 
2165
- const pipeline = pipeline$1;
2166
- const entries$1 = entries$2;
2167
- const reduce = reduce$2;
2165
+ const pipeline$2 = pipeline$3;
2166
+ const entries$3 = entries$4;
2167
+ const reduce$3 = reduce$5;
2168
2168
 
2169
2169
 
2170
- var allValues = (doc) => {
2171
- return pipeline([
2172
- entries$1,
2173
- reduce(async (acc, [propertyName, propertyValue]) => {
2170
+ var allValues$1 = (doc) => {
2171
+ return pipeline$2([
2172
+ entries$3,
2173
+ reduce$3(async (acc, [propertyName, propertyValue]) => {
2174
2174
  acc[propertyName] = await propertyValue;
2175
2175
  return acc;
2176
2176
  }, {})
2177
2177
  ], doc);
2178
2178
  };
2179
2179
 
2180
- var lib$2 = {
2181
- entries: entries$2,
2182
- map: map$3,
2183
- filter: filter,
2184
- reduce: reduce$2,
2185
- some: some,
2186
- every: every,
2187
- pipeline: pipeline$1,
2188
- all: all,
2189
- allValues: allValues
2180
+ var lib$5 = {
2181
+ entries: entries$4,
2182
+ map: map$6,
2183
+ filter: filter$1,
2184
+ reduce: reduce$5,
2185
+ some: some$1,
2186
+ every: every$1,
2187
+ pipeline: pipeline$3,
2188
+ all: all$1,
2189
+ allValues: allValues$1
2190
2190
  };
2191
2191
 
2192
- var fetch_browser = fetch;
2193
-
2194
- var contentType = {};
2195
-
2196
- /*!
2197
- * content-type
2198
- * Copyright(c) 2015 Douglas Christopher Wilson
2199
- * MIT Licensed
2200
- */
2192
+ var justCurryIt$1 = curry$a;
2201
2193
 
2202
- /**
2203
- * RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1
2204
- *
2205
- * parameter = token "=" ( token / quoted-string )
2206
- * token = 1*tchar
2207
- * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
2208
- * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
2209
- * / DIGIT / ALPHA
2210
- * ; any VCHAR, except delimiters
2211
- * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE
2212
- * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text
2213
- * obs-text = %x80-FF
2214
- * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
2215
- */
2216
- var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
2217
- var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
2218
- var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
2194
+ /*
2195
+ function add(a, b, c) {
2196
+ return a + b + c;
2197
+ }
2198
+ curry(add)(1)(2)(3); // 6
2199
+ curry(add)(1)(2)(2); // 5
2200
+ curry(add)(2)(4, 3); // 9
2219
2201
 
2220
- /**
2221
- * RegExp to match quoted-pair in RFC 7230 sec 3.2.6
2222
- *
2223
- * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
2224
- * obs-text = %x80-FF
2225
- */
2226
- var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
2202
+ function add(...args) {
2203
+ return args.reduce((sum, n) => sum + n, 0)
2204
+ }
2205
+ var curryAdd4 = curry(add, 4)
2206
+ curryAdd4(1)(2, 3)(4); // 10
2227
2207
 
2228
- /**
2229
- * RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6
2230
- */
2231
- var QUOTE_REGEXP = /([\\"])/g;
2208
+ function converter(ratio, input) {
2209
+ return (input*ratio).toFixed(1);
2210
+ }
2211
+ const curriedConverter = curry(converter)
2212
+ const milesToKm = curriedConverter(1.62);
2213
+ milesToKm(35); // 56.7
2214
+ milesToKm(10); // 16.2
2215
+ */
2232
2216
 
2233
- /**
2234
- * RegExp to match type in RFC 7231 sec 3.1.1.1
2235
- *
2236
- * media-type = type "/" subtype
2237
- * type = token
2238
- * subtype = token
2239
- */
2240
- var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
2217
+ function curry$a(fn, arity) {
2218
+ return function curried() {
2219
+ if (arity == null) {
2220
+ arity = fn.length;
2221
+ }
2222
+ var args = [].slice.call(arguments);
2223
+ if (args.length >= arity) {
2224
+ return fn.apply(this, args);
2225
+ } else {
2226
+ return function() {
2227
+ return curried.apply(this, args.concat([].slice.call(arguments)));
2228
+ };
2229
+ }
2230
+ };
2231
+ }
2241
2232
 
2242
- /**
2243
- * Module exports.
2244
- * @public
2245
- */
2233
+ const curry$9 = justCurryIt$1;
2246
2234
 
2247
- contentType.format = format$1;
2248
- contentType.parse = parse$1;
2249
2235
 
2250
- /**
2251
- * Format object to media type.
2252
- *
2253
- * @param {object} obj
2254
- * @return {string}
2255
- * @public
2256
- */
2236
+ const nil$1 = "";
2257
2237
 
2258
- function format$1 (obj) {
2259
- if (!obj || typeof obj !== 'object') {
2260
- throw new TypeError('argument obj is required')
2238
+ const compile$P = (pointer) => {
2239
+ if (pointer.length > 0 && pointer[0] !== "/") {
2240
+ throw Error("Invalid JSON Pointer");
2261
2241
  }
2262
2242
 
2263
- var parameters = obj.parameters;
2264
- var type = obj.type;
2265
-
2266
- if (!type || !TYPE_REGEXP.test(type)) {
2267
- throw new TypeError('invalid type')
2268
- }
2243
+ return pointer.split("/").slice(1).map(unescape);
2244
+ };
2269
2245
 
2270
- var string = type;
2246
+ const get$1 = (pointer, value = undefined) => {
2247
+ const ptr = compile$P(pointer);
2271
2248
 
2272
- // append parameters
2273
- if (parameters && typeof parameters === 'object') {
2274
- var param;
2275
- var params = Object.keys(parameters).sort();
2249
+ const fn = (value) => ptr.reduce(([value, pointer], segment) => {
2250
+ return [applySegment(value, segment, pointer), append(segment, pointer)];
2251
+ }, [value, ""])[0];
2276
2252
 
2277
- for (var i = 0; i < params.length; i++) {
2278
- param = params[i];
2253
+ return value === undefined ? fn : fn(value);
2254
+ };
2279
2255
 
2280
- if (!TOKEN_REGEXP.test(param)) {
2281
- throw new TypeError('invalid parameter name')
2282
- }
2256
+ const set = (pointer, subject = undefined, value = undefined) => {
2257
+ const ptr = compile$P(pointer);
2258
+ const fn = curry$9((subject, value) => _set(ptr, subject, value, nil$1));
2259
+ return subject === undefined ? fn : fn(subject, value);
2260
+ };
2283
2261
 
2284
- string += '; ' + param + '=' + qstring(parameters[param]);
2262
+ const _set = (pointer, subject, value, cursor) => {
2263
+ if (pointer.length === 0) {
2264
+ return value;
2265
+ } else if (pointer.length > 1) {
2266
+ if (Array.isArray(subject)) {
2267
+ const index = pointer.shift();
2268
+ const clonedSubject = [...subject];
2269
+ clonedSubject[index] = _set(pointer, applySegment(subject, index, cursor), value, append(index, cursor));
2270
+ return clonedSubject;
2271
+ } else {
2272
+ const segment = pointer.shift();
2273
+ return { ...subject, [segment]: _set(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor)) };
2285
2274
  }
2275
+ } else if (Array.isArray(subject)) {
2276
+ const clonedSubject = [...subject];
2277
+ const segment = computeSegment(subject, pointer[0]);
2278
+ clonedSubject[segment] = value;
2279
+ return clonedSubject;
2280
+ } else if (typeof subject === "object" && subject !== null) {
2281
+ return { ...subject, [pointer[0]]: value };
2282
+ } else {
2283
+ return applySegment(subject, pointer[0], cursor);
2286
2284
  }
2285
+ };
2287
2286
 
2288
- return string
2289
- }
2290
-
2291
- /**
2292
- * Parse media type to object.
2293
- *
2294
- * @param {string|object} string
2295
- * @return {Object}
2296
- * @public
2297
- */
2287
+ const assign = (pointer, subject = undefined, value = undefined) => {
2288
+ const ptr = compile$P(pointer);
2289
+ const fn = curry$9((subject, value) => _assign(ptr, subject, value, nil$1));
2290
+ return subject === undefined ? fn : fn(subject, value);
2291
+ };
2298
2292
 
2299
- function parse$1 (string) {
2300
- if (!string) {
2301
- throw new TypeError('argument string is required')
2293
+ const _assign = (pointer, subject, value, cursor) => {
2294
+ if (pointer.length === 0) {
2295
+ return;
2296
+ } else if (pointer.length === 1 && !isScalar(subject)) {
2297
+ const segment = computeSegment(subject, pointer[0]);
2298
+ subject[segment] = value;
2299
+ } else {
2300
+ const segment = pointer.shift();
2301
+ _assign(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor));
2302
2302
  }
2303
+ };
2303
2304
 
2304
- // support req/res-like objects as argument
2305
- var header = typeof string === 'object'
2306
- ? getcontenttype(string)
2307
- : string;
2305
+ const unset = (pointer, subject = undefined) => {
2306
+ const ptr = compile$P(pointer);
2307
+ const fn = (subject) => _unset(ptr, subject, nil$1);
2308
+ return subject === undefined ? fn : fn(subject);
2309
+ };
2308
2310
 
2309
- if (typeof header !== 'string') {
2310
- throw new TypeError('argument string is required to be a string')
2311
+ const _unset = (pointer, subject, cursor) => {
2312
+ if (pointer.length == 0) {
2313
+ return undefined;
2314
+ } else if (pointer.length > 1) {
2315
+ const segment = pointer.shift();
2316
+ const value = applySegment(subject, segment, cursor);
2317
+ return { ...subject, [segment]: _unset(pointer, value, append(segment, cursor)) };
2318
+ } else if (Array.isArray(subject)) {
2319
+ return subject.filter((_, ndx) => ndx != pointer[0]);
2320
+ } else if (typeof subject === "object" && subject !== null) {
2321
+ // eslint-disable-next-line no-unused-vars
2322
+ const { [pointer[0]]: _, ...result } = subject;
2323
+ return result;
2324
+ } else {
2325
+ return applySegment(subject, pointer[0], cursor);
2311
2326
  }
2327
+ };
2312
2328
 
2313
- var index = header.indexOf(';');
2314
- var type = index !== -1
2315
- ? header.substr(0, index).trim()
2316
- : header.trim();
2317
-
2318
- if (!TYPE_REGEXP.test(type)) {
2329
+ const remove = (pointer, subject = undefined) => {
2330
+ const ptr = compile$P(pointer);
2331
+ const fn = (subject) => _remove(ptr, subject, nil$1);
2332
+ return subject === undefined ? fn : fn(subject);
2333
+ };
2334
+
2335
+ const _remove = (pointer, subject, cursor) => {
2336
+ if (pointer.length === 0) {
2337
+ return;
2338
+ } else if (pointer.length > 1) {
2339
+ const segment = pointer.shift();
2340
+ const value = applySegment(subject, segment, cursor);
2341
+ _remove(pointer, value, append(segment, cursor));
2342
+ } else if (Array.isArray(subject)) {
2343
+ subject.splice(pointer[0], 1);
2344
+ } else if (typeof subject === "object" && subject !== null) {
2345
+ delete subject[pointer[0]];
2346
+ } else {
2347
+ applySegment(subject, pointer[0], cursor);
2348
+ }
2349
+ };
2350
+
2351
+ const append = curry$9((segment, pointer) => pointer + "/" + escape$1(segment));
2352
+
2353
+ const escape$1 = (segment) => segment.toString().replace(/~/g, "~0").replace(/\//g, "~1");
2354
+ const unescape = (segment) => segment.toString().replace(/~1/g, "/").replace(/~0/g, "~");
2355
+ const computeSegment = (value, segment) => Array.isArray(value) && segment === "-" ? value.length : segment;
2356
+
2357
+ const applySegment = (value, segment, cursor = "") => {
2358
+ if (value === undefined) {
2359
+ throw TypeError(`Value at '${cursor}' is undefined and does not have property '${segment}'`);
2360
+ } else if (value === null) {
2361
+ throw TypeError(`Value at '${cursor}' is null and does not have property '${segment}'`);
2362
+ } else if (isScalar(value)) {
2363
+ throw TypeError(`Value at '${cursor}' is a ${typeof value} and does not have property '${segment}'`);
2364
+ } else {
2365
+ const computedSegment = computeSegment(value, segment);
2366
+ return value[computedSegment];
2367
+ }
2368
+ };
2369
+
2370
+ const isScalar = (value) => value === null || typeof value !== "object";
2371
+
2372
+ var lib$4 = { nil: nil$1, append, get: get$1, set, assign, unset, remove };
2373
+
2374
+ var moo$1 = {exports: {}};
2375
+
2376
+ (function (module) {
2377
+ (function(root, factory) {
2378
+ if (module.exports) {
2379
+ module.exports = factory();
2380
+ } else {
2381
+ root.moo = factory();
2382
+ }
2383
+ }(commonjsGlobal, function() {
2384
+
2385
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
2386
+ var toString = Object.prototype.toString;
2387
+ var hasSticky = typeof new RegExp().sticky === 'boolean';
2388
+
2389
+ /***************************************************************************/
2390
+
2391
+ function isRegExp(o) { return o && toString.call(o) === '[object RegExp]' }
2392
+ function isObject(o) { return o && typeof o === 'object' && !isRegExp(o) && !Array.isArray(o) }
2393
+
2394
+ function reEscape(s) {
2395
+ return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')
2396
+ }
2397
+ function reGroups(s) {
2398
+ var re = new RegExp('|' + s);
2399
+ return re.exec('').length - 1
2400
+ }
2401
+ function reCapture(s) {
2402
+ return '(' + s + ')'
2403
+ }
2404
+ function reUnion(regexps) {
2405
+ if (!regexps.length) return '(?!)'
2406
+ var source = regexps.map(function(s) {
2407
+ return "(?:" + s + ")"
2408
+ }).join('|');
2409
+ return "(?:" + source + ")"
2410
+ }
2411
+
2412
+ function regexpOrLiteral(obj) {
2413
+ if (typeof obj === 'string') {
2414
+ return '(?:' + reEscape(obj) + ')'
2415
+
2416
+ } else if (isRegExp(obj)) {
2417
+ // TODO: consider /u support
2418
+ if (obj.ignoreCase) throw new Error('RegExp /i flag not allowed')
2419
+ if (obj.global) throw new Error('RegExp /g flag is implied')
2420
+ if (obj.sticky) throw new Error('RegExp /y flag is implied')
2421
+ if (obj.multiline) throw new Error('RegExp /m flag is implied')
2422
+ return obj.source
2423
+
2424
+ } else {
2425
+ throw new Error('Not a pattern: ' + obj)
2426
+ }
2427
+ }
2428
+
2429
+ function objectToRules(object) {
2430
+ var keys = Object.getOwnPropertyNames(object);
2431
+ var result = [];
2432
+ for (var i = 0; i < keys.length; i++) {
2433
+ var key = keys[i];
2434
+ var thing = object[key];
2435
+ var rules = [].concat(thing);
2436
+ if (key === 'include') {
2437
+ for (var j = 0; j < rules.length; j++) {
2438
+ result.push({include: rules[j]});
2439
+ }
2440
+ continue
2441
+ }
2442
+ var match = [];
2443
+ rules.forEach(function(rule) {
2444
+ if (isObject(rule)) {
2445
+ if (match.length) result.push(ruleOptions(key, match));
2446
+ result.push(ruleOptions(key, rule));
2447
+ match = [];
2448
+ } else {
2449
+ match.push(rule);
2450
+ }
2451
+ });
2452
+ if (match.length) result.push(ruleOptions(key, match));
2453
+ }
2454
+ return result
2455
+ }
2456
+
2457
+ function arrayToRules(array) {
2458
+ var result = [];
2459
+ for (var i = 0; i < array.length; i++) {
2460
+ var obj = array[i];
2461
+ if (obj.include) {
2462
+ var include = [].concat(obj.include);
2463
+ for (var j = 0; j < include.length; j++) {
2464
+ result.push({include: include[j]});
2465
+ }
2466
+ continue
2467
+ }
2468
+ if (!obj.type) {
2469
+ throw new Error('Rule has no type: ' + JSON.stringify(obj))
2470
+ }
2471
+ result.push(ruleOptions(obj.type, obj));
2472
+ }
2473
+ return result
2474
+ }
2475
+
2476
+ function ruleOptions(type, obj) {
2477
+ if (!isObject(obj)) {
2478
+ obj = { match: obj };
2479
+ }
2480
+ if (obj.include) {
2481
+ throw new Error('Matching rules cannot also include states')
2482
+ }
2483
+
2484
+ // nb. error and fallback imply lineBreaks
2485
+ var options = {
2486
+ defaultType: type,
2487
+ lineBreaks: !!obj.error || !!obj.fallback,
2488
+ pop: false,
2489
+ next: null,
2490
+ push: null,
2491
+ error: false,
2492
+ fallback: false,
2493
+ value: null,
2494
+ type: null,
2495
+ shouldThrow: false,
2496
+ };
2497
+
2498
+ // Avoid Object.assign(), so we support IE9+
2499
+ for (var key in obj) {
2500
+ if (hasOwnProperty.call(obj, key)) {
2501
+ options[key] = obj[key];
2502
+ }
2503
+ }
2504
+
2505
+ // type transform cannot be a string
2506
+ if (typeof options.type === 'string' && type !== options.type) {
2507
+ throw new Error("Type transform cannot be a string (type '" + options.type + "' for token '" + type + "')")
2508
+ }
2509
+
2510
+ // convert to array
2511
+ var match = options.match;
2512
+ options.match = Array.isArray(match) ? match : match ? [match] : [];
2513
+ options.match.sort(function(a, b) {
2514
+ return isRegExp(a) && isRegExp(b) ? 0
2515
+ : isRegExp(b) ? -1 : isRegExp(a) ? +1 : b.length - a.length
2516
+ });
2517
+ return options
2518
+ }
2519
+
2520
+ function toRules(spec) {
2521
+ return Array.isArray(spec) ? arrayToRules(spec) : objectToRules(spec)
2522
+ }
2523
+
2524
+ var defaultErrorRule = ruleOptions('error', {lineBreaks: true, shouldThrow: true});
2525
+ function compileRules(rules, hasStates) {
2526
+ var errorRule = null;
2527
+ var fast = Object.create(null);
2528
+ var fastAllowed = true;
2529
+ var unicodeFlag = null;
2530
+ var groups = [];
2531
+ var parts = [];
2532
+
2533
+ // If there is a fallback rule, then disable fast matching
2534
+ for (var i = 0; i < rules.length; i++) {
2535
+ if (rules[i].fallback) {
2536
+ fastAllowed = false;
2537
+ }
2538
+ }
2539
+
2540
+ for (var i = 0; i < rules.length; i++) {
2541
+ var options = rules[i];
2542
+
2543
+ if (options.include) {
2544
+ // all valid inclusions are removed by states() preprocessor
2545
+ throw new Error('Inheritance is not allowed in stateless lexers')
2546
+ }
2547
+
2548
+ if (options.error || options.fallback) {
2549
+ // errorRule can only be set once
2550
+ if (errorRule) {
2551
+ if (!options.fallback === !errorRule.fallback) {
2552
+ throw new Error("Multiple " + (options.fallback ? "fallback" : "error") + " rules not allowed (for token '" + options.defaultType + "')")
2553
+ } else {
2554
+ throw new Error("fallback and error are mutually exclusive (for token '" + options.defaultType + "')")
2555
+ }
2556
+ }
2557
+ errorRule = options;
2558
+ }
2559
+
2560
+ var match = options.match.slice();
2561
+ if (fastAllowed) {
2562
+ while (match.length && typeof match[0] === 'string' && match[0].length === 1) {
2563
+ var word = match.shift();
2564
+ fast[word.charCodeAt(0)] = options;
2565
+ }
2566
+ }
2567
+
2568
+ // Warn about inappropriate state-switching options
2569
+ if (options.pop || options.push || options.next) {
2570
+ if (!hasStates) {
2571
+ throw new Error("State-switching options are not allowed in stateless lexers (for token '" + options.defaultType + "')")
2572
+ }
2573
+ if (options.fallback) {
2574
+ throw new Error("State-switching options are not allowed on fallback tokens (for token '" + options.defaultType + "')")
2575
+ }
2576
+ }
2577
+
2578
+ // Only rules with a .match are included in the RegExp
2579
+ if (match.length === 0) {
2580
+ continue
2581
+ }
2582
+ fastAllowed = false;
2583
+
2584
+ groups.push(options);
2585
+
2586
+ // Check unicode flag is used everywhere or nowhere
2587
+ for (var j = 0; j < match.length; j++) {
2588
+ var obj = match[j];
2589
+ if (!isRegExp(obj)) {
2590
+ continue
2591
+ }
2592
+
2593
+ if (unicodeFlag === null) {
2594
+ unicodeFlag = obj.unicode;
2595
+ } else if (unicodeFlag !== obj.unicode && options.fallback === false) {
2596
+ throw new Error('If one rule is /u then all must be')
2597
+ }
2598
+ }
2599
+
2600
+ // convert to RegExp
2601
+ var pat = reUnion(match.map(regexpOrLiteral));
2602
+
2603
+ // validate
2604
+ var regexp = new RegExp(pat);
2605
+ if (regexp.test("")) {
2606
+ throw new Error("RegExp matches empty string: " + regexp)
2607
+ }
2608
+ var groupCount = reGroups(pat);
2609
+ if (groupCount > 0) {
2610
+ throw new Error("RegExp has capture groups: " + regexp + "\nUse (?: … ) instead")
2611
+ }
2612
+
2613
+ // try and detect rules matching newlines
2614
+ if (!options.lineBreaks && regexp.test('\n')) {
2615
+ throw new Error('Rule should declare lineBreaks: ' + regexp)
2616
+ }
2617
+
2618
+ // store regex
2619
+ parts.push(reCapture(pat));
2620
+ }
2621
+
2622
+
2623
+ // If there's no fallback rule, use the sticky flag so we only look for
2624
+ // matches at the current index.
2625
+ //
2626
+ // If we don't support the sticky flag, then fake it using an irrefutable
2627
+ // match (i.e. an empty pattern).
2628
+ var fallbackRule = errorRule && errorRule.fallback;
2629
+ var flags = hasSticky && !fallbackRule ? 'ym' : 'gm';
2630
+ var suffix = hasSticky || fallbackRule ? '' : '|';
2631
+
2632
+ if (unicodeFlag === true) flags += "u";
2633
+ var combined = new RegExp(reUnion(parts) + suffix, flags);
2634
+ return {regexp: combined, groups: groups, fast: fast, error: errorRule || defaultErrorRule}
2635
+ }
2636
+
2637
+ function compile(rules) {
2638
+ var result = compileRules(toRules(rules));
2639
+ return new Lexer({start: result}, 'start')
2640
+ }
2641
+
2642
+ function checkStateGroup(g, name, map) {
2643
+ var state = g && (g.push || g.next);
2644
+ if (state && !map[state]) {
2645
+ throw new Error("Missing state '" + state + "' (in token '" + g.defaultType + "' of state '" + name + "')")
2646
+ }
2647
+ if (g && g.pop && +g.pop !== 1) {
2648
+ throw new Error("pop must be 1 (in token '" + g.defaultType + "' of state '" + name + "')")
2649
+ }
2650
+ }
2651
+ function compileStates(states, start) {
2652
+ var all = states.$all ? toRules(states.$all) : [];
2653
+ delete states.$all;
2654
+
2655
+ var keys = Object.getOwnPropertyNames(states);
2656
+ if (!start) start = keys[0];
2657
+
2658
+ var ruleMap = Object.create(null);
2659
+ for (var i = 0; i < keys.length; i++) {
2660
+ var key = keys[i];
2661
+ ruleMap[key] = toRules(states[key]).concat(all);
2662
+ }
2663
+ for (var i = 0; i < keys.length; i++) {
2664
+ var key = keys[i];
2665
+ var rules = ruleMap[key];
2666
+ var included = Object.create(null);
2667
+ for (var j = 0; j < rules.length; j++) {
2668
+ var rule = rules[j];
2669
+ if (!rule.include) continue
2670
+ var splice = [j, 1];
2671
+ if (rule.include !== key && !included[rule.include]) {
2672
+ included[rule.include] = true;
2673
+ var newRules = ruleMap[rule.include];
2674
+ if (!newRules) {
2675
+ throw new Error("Cannot include nonexistent state '" + rule.include + "' (in state '" + key + "')")
2676
+ }
2677
+ for (var k = 0; k < newRules.length; k++) {
2678
+ var newRule = newRules[k];
2679
+ if (rules.indexOf(newRule) !== -1) continue
2680
+ splice.push(newRule);
2681
+ }
2682
+ }
2683
+ rules.splice.apply(rules, splice);
2684
+ j--;
2685
+ }
2686
+ }
2687
+
2688
+ var map = Object.create(null);
2689
+ for (var i = 0; i < keys.length; i++) {
2690
+ var key = keys[i];
2691
+ map[key] = compileRules(ruleMap[key], true);
2692
+ }
2693
+
2694
+ for (var i = 0; i < keys.length; i++) {
2695
+ var name = keys[i];
2696
+ var state = map[name];
2697
+ var groups = state.groups;
2698
+ for (var j = 0; j < groups.length; j++) {
2699
+ checkStateGroup(groups[j], name, map);
2700
+ }
2701
+ var fastKeys = Object.getOwnPropertyNames(state.fast);
2702
+ for (var j = 0; j < fastKeys.length; j++) {
2703
+ checkStateGroup(state.fast[fastKeys[j]], name, map);
2704
+ }
2705
+ }
2706
+
2707
+ return new Lexer(map, start)
2708
+ }
2709
+
2710
+ function keywordTransform(map) {
2711
+ var reverseMap = Object.create(null);
2712
+ var byLength = Object.create(null);
2713
+ var types = Object.getOwnPropertyNames(map);
2714
+ for (var i = 0; i < types.length; i++) {
2715
+ var tokenType = types[i];
2716
+ var item = map[tokenType];
2717
+ var keywordList = Array.isArray(item) ? item : [item];
2718
+ keywordList.forEach(function(keyword) {
2719
+ (byLength[keyword.length] = byLength[keyword.length] || []).push(keyword);
2720
+ if (typeof keyword !== 'string') {
2721
+ throw new Error("keyword must be string (in keyword '" + tokenType + "')")
2722
+ }
2723
+ reverseMap[keyword] = tokenType;
2724
+ });
2725
+ }
2726
+
2727
+ // fast string lookup
2728
+ // https://jsperf.com/string-lookups
2729
+ function str(x) { return JSON.stringify(x) }
2730
+ var source = '';
2731
+ source += 'switch (value.length) {\n';
2732
+ for (var length in byLength) {
2733
+ var keywords = byLength[length];
2734
+ source += 'case ' + length + ':\n';
2735
+ source += 'switch (value) {\n';
2736
+ keywords.forEach(function(keyword) {
2737
+ var tokenType = reverseMap[keyword];
2738
+ source += 'case ' + str(keyword) + ': return ' + str(tokenType) + '\n';
2739
+ });
2740
+ source += '}\n';
2741
+ }
2742
+ source += '}\n';
2743
+ return Function('value', source) // type
2744
+ }
2745
+
2746
+ /***************************************************************************/
2747
+
2748
+ var Lexer = function(states, state) {
2749
+ this.startState = state;
2750
+ this.states = states;
2751
+ this.buffer = '';
2752
+ this.stack = [];
2753
+ this.reset();
2754
+ };
2755
+
2756
+ Lexer.prototype.reset = function(data, info) {
2757
+ this.buffer = data || '';
2758
+ this.index = 0;
2759
+ this.line = info ? info.line : 1;
2760
+ this.col = info ? info.col : 1;
2761
+ this.queuedToken = info ? info.queuedToken : null;
2762
+ this.queuedThrow = info ? info.queuedThrow : null;
2763
+ this.setState(info ? info.state : this.startState);
2764
+ this.stack = info && info.stack ? info.stack.slice() : [];
2765
+ return this
2766
+ };
2767
+
2768
+ Lexer.prototype.save = function() {
2769
+ return {
2770
+ line: this.line,
2771
+ col: this.col,
2772
+ state: this.state,
2773
+ stack: this.stack.slice(),
2774
+ queuedToken: this.queuedToken,
2775
+ queuedThrow: this.queuedThrow,
2776
+ }
2777
+ };
2778
+
2779
+ Lexer.prototype.setState = function(state) {
2780
+ if (!state || this.state === state) return
2781
+ this.state = state;
2782
+ var info = this.states[state];
2783
+ this.groups = info.groups;
2784
+ this.error = info.error;
2785
+ this.re = info.regexp;
2786
+ this.fast = info.fast;
2787
+ };
2788
+
2789
+ Lexer.prototype.popState = function() {
2790
+ this.setState(this.stack.pop());
2791
+ };
2792
+
2793
+ Lexer.prototype.pushState = function(state) {
2794
+ this.stack.push(this.state);
2795
+ this.setState(state);
2796
+ };
2797
+
2798
+ var eat = hasSticky ? function(re, buffer) { // assume re is /y
2799
+ return re.exec(buffer)
2800
+ } : function(re, buffer) { // assume re is /g
2801
+ var match = re.exec(buffer);
2802
+ // will always match, since we used the |(?:) trick
2803
+ if (match[0].length === 0) {
2804
+ return null
2805
+ }
2806
+ return match
2807
+ };
2808
+
2809
+ Lexer.prototype._getGroup = function(match) {
2810
+ var groupCount = this.groups.length;
2811
+ for (var i = 0; i < groupCount; i++) {
2812
+ if (match[i + 1] !== undefined) {
2813
+ return this.groups[i]
2814
+ }
2815
+ }
2816
+ throw new Error('Cannot find token type for matched text')
2817
+ };
2818
+
2819
+ function tokenToString() {
2820
+ return this.value
2821
+ }
2822
+
2823
+ Lexer.prototype.next = function() {
2824
+ var index = this.index;
2825
+
2826
+ // If a fallback token matched, we don't need to re-run the RegExp
2827
+ if (this.queuedGroup) {
2828
+ var token = this._token(this.queuedGroup, this.queuedText, index);
2829
+ this.queuedGroup = null;
2830
+ this.queuedText = "";
2831
+ return token
2832
+ }
2833
+
2834
+ var buffer = this.buffer;
2835
+ if (index === buffer.length) {
2836
+ return // EOF
2837
+ }
2838
+
2839
+ // Fast matching for single characters
2840
+ var group = this.fast[buffer.charCodeAt(index)];
2841
+ if (group) {
2842
+ return this._token(group, buffer.charAt(index), index)
2843
+ }
2844
+
2845
+ // Execute RegExp
2846
+ var re = this.re;
2847
+ re.lastIndex = index;
2848
+ var match = eat(re, buffer);
2849
+
2850
+ // Error tokens match the remaining buffer
2851
+ var error = this.error;
2852
+ if (match == null) {
2853
+ return this._token(error, buffer.slice(index, buffer.length), index)
2854
+ }
2855
+
2856
+ var group = this._getGroup(match);
2857
+ var text = match[0];
2858
+
2859
+ if (error.fallback && match.index !== index) {
2860
+ this.queuedGroup = group;
2861
+ this.queuedText = text;
2862
+
2863
+ // Fallback tokens contain the unmatched portion of the buffer
2864
+ return this._token(error, buffer.slice(index, match.index), index)
2865
+ }
2866
+
2867
+ return this._token(group, text, index)
2868
+ };
2869
+
2870
+ Lexer.prototype._token = function(group, text, offset) {
2871
+ // count line breaks
2872
+ var lineBreaks = 0;
2873
+ if (group.lineBreaks) {
2874
+ var matchNL = /\n/g;
2875
+ var nl = 1;
2876
+ if (text === '\n') {
2877
+ lineBreaks = 1;
2878
+ } else {
2879
+ while (matchNL.exec(text)) { lineBreaks++; nl = matchNL.lastIndex; }
2880
+ }
2881
+ }
2882
+
2883
+ var token = {
2884
+ type: (typeof group.type === 'function' && group.type(text)) || group.defaultType,
2885
+ value: typeof group.value === 'function' ? group.value(text) : text,
2886
+ text: text,
2887
+ toString: tokenToString,
2888
+ offset: offset,
2889
+ lineBreaks: lineBreaks,
2890
+ line: this.line,
2891
+ col: this.col,
2892
+ };
2893
+ // nb. adding more props to token object will make V8 sad!
2894
+
2895
+ var size = text.length;
2896
+ this.index += size;
2897
+ this.line += lineBreaks;
2898
+ if (lineBreaks !== 0) {
2899
+ this.col = size - nl + 1;
2900
+ } else {
2901
+ this.col += size;
2902
+ }
2903
+
2904
+ // throw, if no rule with {error: true}
2905
+ if (group.shouldThrow) {
2906
+ throw new Error(this.formatError(token, "invalid syntax"))
2907
+ }
2908
+
2909
+ if (group.pop) this.popState();
2910
+ else if (group.push) this.pushState(group.push);
2911
+ else if (group.next) this.setState(group.next);
2912
+
2913
+ return token
2914
+ };
2915
+
2916
+ if (typeof Symbol !== 'undefined' && Symbol.iterator) {
2917
+ var LexerIterator = function(lexer) {
2918
+ this.lexer = lexer;
2919
+ };
2920
+
2921
+ LexerIterator.prototype.next = function() {
2922
+ var token = this.lexer.next();
2923
+ return {value: token, done: !token}
2924
+ };
2925
+
2926
+ LexerIterator.prototype[Symbol.iterator] = function() {
2927
+ return this
2928
+ };
2929
+
2930
+ Lexer.prototype[Symbol.iterator] = function() {
2931
+ return new LexerIterator(this)
2932
+ };
2933
+ }
2934
+
2935
+ Lexer.prototype.formatError = function(token, message) {
2936
+ if (token == null) {
2937
+ // An undefined token indicates EOF
2938
+ var text = this.buffer.slice(this.index);
2939
+ var token = {
2940
+ text: text,
2941
+ offset: this.index,
2942
+ lineBreaks: text.indexOf('\n') === -1 ? 0 : 1,
2943
+ line: this.line,
2944
+ col: this.col,
2945
+ };
2946
+ }
2947
+ var start = Math.max(0, token.offset - token.col + 1);
2948
+ var eol = token.lineBreaks ? token.text.indexOf('\n') : token.text.length;
2949
+ var firstLine = this.buffer.substring(start, token.offset + eol);
2950
+ message += " at line " + token.line + " col " + token.col + ":\n\n";
2951
+ message += " " + firstLine + "\n";
2952
+ message += " " + Array(token.col).join(" ") + "^";
2953
+ return message
2954
+ };
2955
+
2956
+ Lexer.prototype.clone = function() {
2957
+ return new Lexer(this.states, this.state)
2958
+ };
2959
+
2960
+ Lexer.prototype.has = function(tokenType) {
2961
+ return true
2962
+ };
2963
+
2964
+
2965
+ return {
2966
+ compile: compile,
2967
+ states: compileStates,
2968
+ error: Object.freeze({error: true}),
2969
+ fallback: Object.freeze({fallback: true}),
2970
+ keywords: keywordTransform,
2971
+ }
2972
+
2973
+ }));
2974
+ } (moo$1));
2975
+
2976
+ const moo = moo$1.exports;
2977
+
2978
+
2979
+ const digit = `[0-9]`;
2980
+ const digit19 = `[1-9]`;
2981
+ const hexdig = `[0-9a-fA-F]`;
2982
+
2983
+ // String
2984
+ const unescaped = `[\\x20-\\x21\\x23-\\x5b\\x5d-\\u{10ffff}]`;
2985
+ const escape = `\\\\`;
2986
+ const escaped = `${escape}(?:["\\/\\\\brfnt]|u${hexdig}{4})`;
2987
+ const char = `(?:${unescaped}|${escaped})`;
2988
+ const string = `"${char}*"`;
2989
+
2990
+ // Number
2991
+ const int = `(?:0|${digit19}${digit}*)`;
2992
+ const frac = `\\.${digit}+`;
2993
+ const e = `[eE]`;
2994
+ const exp = `${e}[-+]?${digit}+`;
2995
+ const number = `-?${int}(?:${frac})?(?:${exp})?`;
2996
+
2997
+ // Whitespace
2998
+ const whitespace = `(?:(?:\\r?\\n)|[ \\t])+`;
2999
+
3000
+ var lexer = (json) => {
3001
+ const lexer = moo.states({
3002
+ main: {
3003
+ WS: { match: new RegExp(whitespace, "u"), lineBreaks: true },
3004
+ true: { match: "true", value: () => true },
3005
+ false: { match: "false", value: () => false },
3006
+ null: { match: "null", value: () => null },
3007
+ number: { match: new RegExp(number, "u"), value: parseFloat },
3008
+ string: { match: new RegExp(string, "u"), value: JSON.parse },
3009
+ "{": "{",
3010
+ "}": "}",
3011
+ "[": "[",
3012
+ "]": "]",
3013
+ ":": ":",
3014
+ ",": ",",
3015
+ error: moo.error
3016
+ }
3017
+ });
3018
+ lexer.reset(json);
3019
+
3020
+ const _next = () => {
3021
+ let token;
3022
+ do {
3023
+ token = lexer.next();
3024
+ if (token?.type === "error") {
3025
+ throw SyntaxError(lexer.formatError(token, "Unrecognized token"));
3026
+ }
3027
+ } while (token?.type === "WS");
3028
+
3029
+ return token;
3030
+ };
3031
+
3032
+ let previous;
3033
+ let nextToken = _next();
3034
+
3035
+ const next = (expectedType = undefined) => {
3036
+ previous = nextToken;
3037
+ nextToken = _next();
3038
+ if (expectedType && previous?.type !== expectedType) {
3039
+ throw SyntaxError(lexer.formatError(previous, `Expected a '${expectedType}'`));
3040
+ }
3041
+ return previous;
3042
+ };
3043
+
3044
+ const peek = () => nextToken;
3045
+
3046
+ const defaultErrorToken = { offset: 0, line: 1, col: 0, text: "" };
3047
+ const syntaxError = (message) => {
3048
+ const referenceToken = previous || defaultErrorToken;
3049
+ const errorToken = {
3050
+ ...referenceToken,
3051
+ offset: referenceToken.offset + referenceToken.text.length,
3052
+ col: referenceToken.col + referenceToken.text.length
3053
+ };
3054
+ throw new SyntaxError(lexer.formatError(errorToken, message));
3055
+ };
3056
+
3057
+ return { next, peek, syntaxError };
3058
+ };
3059
+
3060
+ const JsonPointer$2 = lib$4;
3061
+ const jsonLexer = lexer;
3062
+
3063
+
3064
+ const defaultReviver = (key, value) => value;
3065
+ const parse$3 = (json, reviver = defaultReviver) => {
3066
+ const lexer = jsonLexer(json);
3067
+ const value = parseValue(lexer, "", JsonPointer$2.nil, reviver);
3068
+
3069
+ const token = lexer.peek();
3070
+ if (token) {
3071
+ lexer.syntaxError("A value has been parsed, but more tokens were found");
3072
+ }
3073
+ return value;
3074
+ };
3075
+
3076
+ const parseValue = (lexer, key, pointer, reviver) => {
3077
+ let value;
3078
+ const token = lexer.next();
3079
+ switch (token?.type) {
3080
+ case "true":
3081
+ case "false":
3082
+ case "null":
3083
+ case "number":
3084
+ case "string":
3085
+ value = token.value;
3086
+ break;
3087
+ case "{":
3088
+ value = parseObject(lexer, key, pointer, reviver);
3089
+ break;
3090
+ case "[":
3091
+ value = parseArray(lexer, key, pointer, reviver);
3092
+ break;
3093
+ default:
3094
+ lexer.syntaxError("Expected a JSON value");
3095
+ }
3096
+
3097
+ return reviver(key, value, pointer);
3098
+ };
3099
+
3100
+ const parseObject = (lexer, key, pointer, reviver) => {
3101
+ const value = {};
3102
+
3103
+ if (lexer.peek()?.type !== "}") {
3104
+ parseProperties(lexer, key, pointer, reviver, value);
3105
+ }
3106
+
3107
+ lexer.next("}");
3108
+
3109
+ return value;
3110
+ };
3111
+
3112
+ const parseProperties = (lexer, key, pointer, reviver, value) => {
3113
+ const propertyName = lexer.next("string").value;
3114
+ lexer.next(":");
3115
+ if (!isValueToken(lexer.peek())) {
3116
+ lexer.syntaxError("Expected a JSON value");
3117
+ }
3118
+ value[propertyName] = parseValue(lexer, propertyName, JsonPointer$2.append(propertyName, pointer), reviver);
3119
+
3120
+ if (lexer.peek()?.type === ",") {
3121
+ lexer.next(); // burn comma
3122
+ parseProperties(lexer, propertyName, pointer, reviver, value);
3123
+ } else if (isValueToken(lexer.peek())) {
3124
+ lexer.next(",");
3125
+ }
3126
+ };
3127
+
3128
+ const parseArray = (lexer, key, pointer, reviver) => {
3129
+ const value = [];
3130
+
3131
+ if (lexer.peek()?.type !== "]") {
3132
+ parseItems(lexer, 0, pointer, reviver, value);
3133
+ }
3134
+
3135
+ lexer.next("]");
3136
+
3137
+ return value;
3138
+ };
3139
+
3140
+ const parseItems = (lexer, key, pointer, reviver, value) => {
3141
+ if (!isValueToken(lexer.peek())) {
3142
+ lexer.syntaxError("Expected a JSON value");
3143
+ }
3144
+ value[key] = parseValue(lexer, key, JsonPointer$2.append(key, pointer), reviver);
3145
+ if (lexer.peek()?.type === ",") {
3146
+ lexer.next(); // burn comma
3147
+ parseItems(lexer, key + 1, pointer, reviver, value);
3148
+ } else if (isValueToken(lexer.peek())) {
3149
+ lexer.next(",");
3150
+ }
3151
+ };
3152
+
3153
+ const valueType = new Set(["string", "number", "true", "false", "null", "[", "{"]);
3154
+ const isValueToken = (token) => valueType.has(token?.type);
3155
+
3156
+ var parse_1 = parse$3;
3157
+
3158
+ const JsonPointer$1 = lib$4;
3159
+
3160
+
3161
+ const defaultReplacer = (key, value) => value;
3162
+ const stringify$2 = (value, replacer = defaultReplacer, space = "") => {
3163
+ return stringifyValue(value, replacer, space, "", JsonPointer$1.nil, 1);
3164
+ };
3165
+
3166
+ const stringifyValue = (value, replacer, space, key, pointer, depth) => {
3167
+ value = replacer(key, value, pointer);
3168
+ let result;
3169
+ if (Array.isArray(value)) {
3170
+ result = stringifyArray(value, replacer, space, pointer, depth);
3171
+ } else if (typeof value === "object" && value !== null) {
3172
+ result = stringifyObject(value, replacer, space, pointer, depth);
3173
+ } else {
3174
+ result = JSON.stringify(value);
3175
+ }
3176
+
3177
+ return result;
3178
+ };
3179
+
3180
+ const stringifyArray = (value, replacer, space, pointer, depth) => {
3181
+ if (value.length === 0) {
3182
+ space = "";
3183
+ }
3184
+ const padding = space ? `\n${space.repeat(depth - 1)}` : "";
3185
+ return "[" + padding + space + value
3186
+ .map((item, index) => {
3187
+ const indexPointer = JsonPointer$1.append(index, pointer);
3188
+ return stringifyValue(item, replacer, space, index, indexPointer, depth + 1);
3189
+ })
3190
+ .join(`,${padding}${space}`) + padding + "]";
3191
+ };
3192
+
3193
+ const stringifyObject = (value, replacer, space, pointer, depth) => {
3194
+ if (Object.keys(value).length === 0) {
3195
+ space = "";
3196
+ }
3197
+ const padding = space ? `\n${space.repeat(depth - 1)}` : "";
3198
+ const spacing = space ? " " : "";
3199
+ return "{" + padding + space + Object.entries(value)
3200
+ .map(([key, value]) => {
3201
+ const keyPointer = JsonPointer$1.append(key, pointer);
3202
+ return JSON.stringify(key) + ":" + spacing + stringifyValue(value, replacer, space, key, keyPointer, depth + 1);
3203
+ })
3204
+ .join(`,${padding}${space}`) + padding + "}";
3205
+ };
3206
+
3207
+ var stringify_1 = stringify$2;
3208
+
3209
+ const parse$2 = parse_1;
3210
+ const stringify$1 = stringify_1;
3211
+
3212
+
3213
+ var lib$3 = { parse: parse$2, stringify: stringify$1 };
3214
+
3215
+ var fetch_browser = fetch;
3216
+
3217
+ var contentType = {};
3218
+
3219
+ /*!
3220
+ * content-type
3221
+ * Copyright(c) 2015 Douglas Christopher Wilson
3222
+ * MIT Licensed
3223
+ */
3224
+
3225
+ /**
3226
+ * RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1
3227
+ *
3228
+ * parameter = token "=" ( token / quoted-string )
3229
+ * token = 1*tchar
3230
+ * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
3231
+ * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
3232
+ * / DIGIT / ALPHA
3233
+ * ; any VCHAR, except delimiters
3234
+ * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE
3235
+ * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text
3236
+ * obs-text = %x80-FF
3237
+ * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
3238
+ */
3239
+ var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
3240
+ var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
3241
+ var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
3242
+
3243
+ /**
3244
+ * RegExp to match quoted-pair in RFC 7230 sec 3.2.6
3245
+ *
3246
+ * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
3247
+ * obs-text = %x80-FF
3248
+ */
3249
+ var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
3250
+
3251
+ /**
3252
+ * RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6
3253
+ */
3254
+ var QUOTE_REGEXP = /([\\"])/g;
3255
+
3256
+ /**
3257
+ * RegExp to match type in RFC 7231 sec 3.1.1.1
3258
+ *
3259
+ * media-type = type "/" subtype
3260
+ * type = token
3261
+ * subtype = token
3262
+ */
3263
+ var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
3264
+
3265
+ /**
3266
+ * Module exports.
3267
+ * @public
3268
+ */
3269
+
3270
+ contentType.format = format$1;
3271
+ contentType.parse = parse$1;
3272
+
3273
+ /**
3274
+ * Format object to media type.
3275
+ *
3276
+ * @param {object} obj
3277
+ * @return {string}
3278
+ * @public
3279
+ */
3280
+
3281
+ function format$1 (obj) {
3282
+ if (!obj || typeof obj !== 'object') {
3283
+ throw new TypeError('argument obj is required')
3284
+ }
3285
+
3286
+ var parameters = obj.parameters;
3287
+ var type = obj.type;
3288
+
3289
+ if (!type || !TYPE_REGEXP.test(type)) {
3290
+ throw new TypeError('invalid type')
3291
+ }
3292
+
3293
+ var string = type;
3294
+
3295
+ // append parameters
3296
+ if (parameters && typeof parameters === 'object') {
3297
+ var param;
3298
+ var params = Object.keys(parameters).sort();
3299
+
3300
+ for (var i = 0; i < params.length; i++) {
3301
+ param = params[i];
3302
+
3303
+ if (!TOKEN_REGEXP.test(param)) {
3304
+ throw new TypeError('invalid parameter name')
3305
+ }
3306
+
3307
+ string += '; ' + param + '=' + qstring(parameters[param]);
3308
+ }
3309
+ }
3310
+
3311
+ return string
3312
+ }
3313
+
3314
+ /**
3315
+ * Parse media type to object.
3316
+ *
3317
+ * @param {string|object} string
3318
+ * @return {Object}
3319
+ * @public
3320
+ */
3321
+
3322
+ function parse$1 (string) {
3323
+ if (!string) {
3324
+ throw new TypeError('argument string is required')
3325
+ }
3326
+
3327
+ // support req/res-like objects as argument
3328
+ var header = typeof string === 'object'
3329
+ ? getcontenttype(string)
3330
+ : string;
3331
+
3332
+ if (typeof header !== 'string') {
3333
+ throw new TypeError('argument string is required to be a string')
3334
+ }
3335
+
3336
+ var index = header.indexOf(';');
3337
+ var type = index !== -1
3338
+ ? header.substr(0, index).trim()
3339
+ : header.trim();
3340
+
3341
+ if (!TYPE_REGEXP.test(type)) {
2319
3342
  throw new TypeError('invalid media type')
2320
3343
  }
2321
3344
 
@@ -2443,9 +3466,10 @@
2443
3466
 
2444
3467
  var mediaTypes = { addPlugin, parse, getContentType };
2445
3468
 
2446
- const curry$1 = justCurryIt;
2447
- const Pact$a = lib$2;
2448
- const JsonPointer = lib$3;
3469
+ const curry$8 = justCurryIt$2;
3470
+ const Pact$a = lib$5;
3471
+ const Json = lib$3;
3472
+ const JsonPointer = lib$6;
2449
3473
  const { jsonTypeOf, resolveUrl: resolveUrl$1, urlFragment, pathRelative } = common$1;
2450
3474
  const fetch$1 = fetch_browser;
2451
3475
  const Reference$1 = reference;
@@ -2476,64 +3500,61 @@
2476
3500
  // Schema Management
2477
3501
  const schemaStore = {};
2478
3502
  const schemaStoreAlias = {};
3503
+ const add$1 = (schema, retrievalUri = "", defaultDialectId = "") => {
3504
+ const dialectId = getDialectId(schema, retrievalUri, defaultDialectId);
2479
3505
 
2480
- const add$1 = (schema, url = "", defaultSchemaVersion = "") => {
2481
- schema = JSON.parse(JSON.stringify(schema));
2482
- const externalId = resolveUrl$1(url, "");
3506
+ const id = getBaseUri(schema, retrievalUri, dialectJsonSchemaVersion[dialectId]);
2483
3507
 
2484
- // Dialect / JSON Schema Version
2485
- const dialectId = resolveUrl$1(schema["$schema"] || defaultSchemaVersion, "");
2486
- if (!dialectId) {
2487
- throw Error("Couldn't determine schema dialect");
2488
- }
2489
- delete schema["$schema"];
3508
+ // Extract embedded schemas and collect anchors
3509
+ const embeddedToken = getConfig(dialectId, "embeddedToken");
3510
+ const baseToken = getConfig(dialectId, "baseToken");
3511
+ const anchorToken = getConfig(dialectId, "anchorToken");
3512
+ const dynamicAnchorToken = getConfig(dialectId, "dynamicAnchorToken");
3513
+ const jrefToken = getConfig(dialectId, "jrefToken");
2490
3514
 
2491
- // Determine JSON Schema version
2492
- if (!(dialectId in dialectJsonSchemaVersion)) {
2493
- if (schema?.$vocabulary?.[core201909Id] === true && dialectId === getSchemaIdentifier(schema, externalId, core201909Id)[0]) {
2494
- // Self describing 2019-09 meta-schema
2495
- dialectJsonSchemaVersion[dialectId] = core201909Id;
2496
- } else if (schema?.$vocabulary?.[core202012Id] === true && dialectId === getSchemaIdentifier(schema, externalId, core202012Id)[0]) {
2497
- // Self describing 2020-12 meta-schema
2498
- dialectJsonSchemaVersion[dialectId] = core202012Id;
2499
- } else {
2500
- // Need to look at meta-schema to determine version
2501
- const metaSchema = schemaStore[dialectId];
2502
- if (!metaSchema) {
2503
- throw Error(`Couldn't determine JSON Schema version for dialect: '${dialectId}'`);
2504
- } else if (metaSchema.vocabulary[core201909Id] === true) {
2505
- dialectJsonSchemaVersion[dialectId] = core201909Id;
2506
- } else if (metaSchema.vocabulary[core202012Id] === true) {
2507
- dialectJsonSchemaVersion[dialectId] = core202012Id;
2508
- } else {
2509
- // Assume the jsonSchemaVersion is the meta-schema's dialectId (non-standard behavior)
2510
- dialectJsonSchemaVersion[dialectId] = dialectJsonSchemaVersion[metaSchema.dialectId];
3515
+ const dynamicAnchors = {};
3516
+ const anchors = { "": "" };
3517
+
3518
+ schema = Json.parse(JSON.stringify(schema), (key, value, pointer) => {
3519
+ if (jsonTypeOf(value, "object")) {
3520
+ // Embedded Schema
3521
+ const embeddedSchemaDialectId = typeof value.$schema === "string" ? resolveUrl$1(value.$schema, "") : dialectId;
3522
+ const embeddedEmbeddedToken = getConfig(embeddedSchemaDialectId, "embeddedToken");
3523
+ const embeddedAnchorToken = getConfig(embeddedSchemaDialectId, "anchorToken");
3524
+ if (typeof value[embeddedEmbeddedToken] === "string" && (embeddedEmbeddedToken !== embeddedAnchorToken || value[embeddedEmbeddedToken][0] !== "#") && pointer !== "") {
3525
+ const embeddedRetrievalUri = resolveUrl$1(id, value[embeddedEmbeddedToken]);
3526
+ add$1(value, embeddedRetrievalUri, dialectId);
3527
+ return Reference$1.cons(value[embeddedEmbeddedToken], value);
3528
+ }
3529
+
3530
+ if (typeof value[jrefToken] === "string") {
3531
+ return Reference$1.cons(value[jrefToken], value);
3532
+ }
3533
+
3534
+ if (typeof value[anchorToken] === "string" && pointer !== JsonPointer.nil) {
3535
+ const anchor = anchorToken !== embeddedToken ? value[anchorToken] : value[anchorToken].slice(1);
3536
+ anchors[anchor] = pointer;
3537
+ delete value[anchorToken];
3538
+ }
3539
+
3540
+ if (typeof value[dynamicAnchorToken] === "string") {
3541
+ dynamicAnchors[value[dynamicAnchorToken]] = `${id}#${pointer}`;
3542
+ anchors[value[dynamicAnchorToken]] = pointer;
3543
+ delete value[dynamicAnchorToken];
2511
3544
  }
2512
3545
  }
2513
- }
2514
3546
 
2515
- // Internal Identifier
2516
- const [id, fragment] = getSchemaIdentifier(schema, externalId, dialectJsonSchemaVersion[dialectId]);
2517
- if (!id) {
2518
- throw Error("Couldn't determine an identifier for the schema");
2519
- }
2520
- const baseToken = getConfig(dialectId, "baseToken");
2521
- delete schema[baseToken];
2522
- if (externalId) {
2523
- schemaStoreAlias[externalId] = id;
2524
- }
3547
+ return value;
3548
+ });
3549
+ console.log(embeddedIds);
2525
3550
 
2526
- const anchorToken = getConfig(dialectId, "anchorToken");
2527
- if (fragment && baseToken === anchorToken) {
2528
- schema[anchorToken] = anchorToken !== baseToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`;
2529
- }
3551
+ delete schema.$schema;
3552
+ delete schema[baseToken];
2530
3553
 
2531
3554
  // recursiveAnchor
2532
- const dynamicAnchors = {};
2533
3555
  const recursiveAnchorToken = getConfig(dialectId, "recursiveAnchorToken");
2534
3556
  if (schema[recursiveAnchorToken] === true) {
2535
3557
  dynamicAnchors[""] = `${id}#`;
2536
- schema[anchorToken] = "";
2537
3558
  delete schema[recursiveAnchorToken];
2538
3559
  }
2539
3560
 
@@ -2548,69 +3569,66 @@
2548
3569
  }
2549
3570
 
2550
3571
  // Store Schema
2551
- const anchors = { "": "" };
2552
3572
  schemaStore[id] = {
2553
- id: id,
2554
- dialectId: dialectId,
2555
- schema: processSchema(schema, id, dialectId, JsonPointer.nil, anchors, dynamicAnchors),
2556
- anchors: anchors,
2557
- dynamicAnchors: dynamicAnchors,
2558
- vocabulary: vocabulary,
3573
+ id,
3574
+ dialectId,
3575
+ schema,
3576
+ anchors,
3577
+ dynamicAnchors,
3578
+ vocabulary,
2559
3579
  validated: false
2560
3580
  };
3581
+ if (id === "https://example.com/schema/root") {
3582
+ console.log(Object.keys(schemaStore).filter((id) => !/json-schema\.org/.test(id)));
3583
+ }
2561
3584
 
2562
- return id;
3585
+ if (retrievalUri) {
3586
+ schemaStoreAlias[resolveUrl$1(retrievalUri, "")] = id;
3587
+ }
2563
3588
  };
2564
3589
 
2565
- const getSchemaIdentifier = (schema, externalId, jsonSchemaVersion) => {
2566
- const baseToken = config[jsonSchemaVersion]?.["baseToken"];
2567
- const internalUrl = resolveUrl$1(externalId, schema[baseToken] || "");
2568
- return [resolveUrl$1(internalUrl, ""), urlFragment(internalUrl)];
2569
- };
2570
-
2571
- const processSchema = (subject, id, dialectId, pointer, anchors, dynamicAnchors) => {
2572
- if (jsonTypeOf(subject, "object")) {
2573
- const embeddedSchemaDialectId = typeof subject.$schema === "string" ? resolveUrl$1(subject.$schema, "") : dialectId;
2574
- const embeddedEmbeddedToken = getConfig(embeddedSchemaDialectId, "embeddedToken");
2575
- const embeddedAnchorToken = getConfig(embeddedSchemaDialectId, "anchorToken");
2576
- if (typeof subject[embeddedEmbeddedToken] === "string" && (embeddedEmbeddedToken !== embeddedAnchorToken || subject[embeddedEmbeddedToken][0] !== "#")) {
2577
- const ref = resolveUrl$1(id, subject[embeddedEmbeddedToken]);
2578
- const embeddedBaseToken = getConfig(embeddedSchemaDialectId, "baseToken");
2579
- subject[embeddedBaseToken] = ref;
2580
- add$1(subject, ref, dialectId);
2581
- return Reference$1.cons(subject[embeddedEmbeddedToken], subject);
2582
- }
2583
-
2584
- const anchorToken = getConfig(dialectId, "anchorToken");
2585
- const dynamicAnchorToken = getConfig(dialectId, "dynamicAnchorToken");
2586
- if (typeof subject[dynamicAnchorToken] === "string") {
2587
- dynamicAnchors[subject[dynamicAnchorToken]] = `${id}#${encodeURI(pointer)}`;
2588
- anchors[subject[dynamicAnchorToken]] = pointer;
2589
- delete subject[dynamicAnchorToken];
2590
- }
2591
-
2592
- const embeddedToken = getConfig(dialectId, "embeddedToken");
2593
- if (typeof subject[anchorToken] === "string") {
2594
- const anchor = anchorToken !== embeddedToken ? subject[anchorToken] : subject[anchorToken].slice(1);
2595
- anchors[anchor] = pointer;
2596
- delete subject[anchorToken];
2597
- }
3590
+ const getDialectId = (schema, retrievalUri, defaultDialectId) => {
3591
+ const dialectId = resolveUrl$1(schema.$schema || defaultDialectId, "");
3592
+ if (!dialectId) {
3593
+ throw Error("Couldn't determine schema dialect");
3594
+ }
2598
3595
 
2599
- const jrefToken = getConfig(dialectId, "jrefToken");
2600
- if (typeof subject[jrefToken] === "string") {
2601
- return Reference$1.cons(subject[jrefToken], subject);
3596
+ // Determine JSON Schema version
3597
+ if (!(dialectId in dialectJsonSchemaVersion)) {
3598
+ if (schema?.$vocabulary?.[core201909Id] === true && dialectId === getBaseUri(schema, retrievalUri, core201909Id)) {
3599
+ // Self describing 2019-09 meta-schema
3600
+ dialectJsonSchemaVersion[dialectId] = core201909Id;
3601
+ } else if (schema?.$vocabulary?.[core202012Id] === true && dialectId === getBaseUri(schema, retrievalUri, core202012Id)) {
3602
+ // Self describing 2020-12 meta-schema
3603
+ dialectJsonSchemaVersion[dialectId] = core202012Id;
3604
+ } else {
3605
+ // Need to look at meta-schema to determine version
3606
+ const metaSchema = schemaStore[dialectId];
3607
+ if (!metaSchema) {
3608
+ throw Error(`Couldn't determine JSON Schema version for dialect: '${dialectId}'`);
3609
+ } else if (metaSchema.vocabulary[core201909Id] === true) {
3610
+ dialectJsonSchemaVersion[dialectId] = core201909Id;
3611
+ } else if (metaSchema.vocabulary[core202012Id] === true) {
3612
+ dialectJsonSchemaVersion[dialectId] = core202012Id;
3613
+ } else {
3614
+ // Assume the jsonSchemaVersion is the meta-schema's dialectId (non-standard behavior)
3615
+ dialectJsonSchemaVersion[dialectId] = dialectJsonSchemaVersion[metaSchema.dialectId];
3616
+ }
2602
3617
  }
3618
+ }
2603
3619
 
2604
- for (const key in subject) {
2605
- subject[key] = processSchema(subject[key], id, dialectId, JsonPointer.append(key, pointer), anchors, dynamicAnchors);
2606
- }
3620
+ return dialectId;
3621
+ };
2607
3622
 
2608
- return subject;
2609
- } else if (Array.isArray(subject)) {
2610
- return subject.map((item, ndx) => processSchema(item, id, dialectId, JsonPointer.append(ndx, pointer), anchors, dynamicAnchors));
2611
- } else {
2612
- return subject;
3623
+ const getBaseUri = (schema, retrievalUri, jsonSchemaVersion) => {
3624
+ const baseToken = config[jsonSchemaVersion]?.["baseToken"];
3625
+ const relativeBaseUri = typeof schema[baseToken] === "string" ? schema[baseToken] : "";
3626
+ const baseUri = resolveUrl$1(resolveUrl$1(retrievalUri, relativeBaseUri), "");
3627
+ if (!baseUri) {
3628
+ throw Error("Couldn't determine an identifier for the schema");
2613
3629
  }
3630
+
3631
+ return baseUri;
2614
3632
  };
2615
3633
 
2616
3634
  const hasStoredSchema = (id) => id in schemaStore || id in schemaStoreAlias;
@@ -2647,13 +3665,21 @@
2647
3665
 
2648
3666
  const [schema, defaultDialectId] = await MediaTypes$1.parse(response);
2649
3667
 
3668
+ let dialectId;
3669
+ if (schema.$schema) {
3670
+ dialectId = resolveUrl$1(schema.$schema, "");
3671
+ } else if (defaultDialectId) {
3672
+ dialectId = resolveUrl$1(id, defaultDialectId);
3673
+ } else {
3674
+ dialectId = "";
3675
+ }
3676
+
2650
3677
  // Make sure the meta-schema is loaded if this isn't a known dialect
2651
- const dialectId = resolveUrl$1(schema.$schema, "") || defaultDialectId;
2652
- if (id !== dialectId && !(dialectId in dialectJsonSchemaVersion)) {
3678
+ if (dialectId && id !== dialectId && !(dialectId in dialectJsonSchemaVersion)) {
2653
3679
  await get(dialectId);
2654
3680
  }
2655
3681
 
2656
- add$1(schema, id);
3682
+ add$1(schema, id, dialectId);
2657
3683
  }
2658
3684
 
2659
3685
  const storedSchema = getStoredSchema(id);
@@ -2696,14 +3722,14 @@
2696
3722
 
2697
3723
  const keys = (doc) => Object.keys(value(doc));
2698
3724
 
2699
- const entries = (doc) => Pact$a.pipeline([
3725
+ const entries$2 = (doc) => Pact$a.pipeline([
2700
3726
  value,
2701
3727
  Object.keys,
2702
3728
  Pact$a.map(async (key) => [key, await step(key, doc)]),
2703
3729
  Pact$a.all
2704
3730
  ], doc);
2705
3731
 
2706
- const map = curry$1((fn, doc) => Pact$a.pipeline([
3732
+ const map$3 = curry$8((fn, doc) => Pact$a.pipeline([
2707
3733
  value,
2708
3734
  Pact$a.map(async (item, ndx) => fn(await step(ndx, doc), ndx)),
2709
3735
  Pact$a.all
@@ -2719,41 +3745,43 @@
2719
3745
  const toSchema = (schemaDoc, options = {}) => {
2720
3746
  const fullOptions = { ...toSchemaDefaultOptions, ...options };
2721
3747
 
2722
- const schema = JSON.parse(JSON.stringify(schemaDoc.schema, (key, value) => {
2723
- if (!Reference$1.isReference(value)) {
2724
- return value;
3748
+ const anchorToken = getConfig(schemaDoc.dialectId, "anchorToken");
3749
+ const dynamicAnchorToken = getConfig(schemaDoc.dialectId, "dynamicAnchorToken");
3750
+
3751
+ const anchors = {};
3752
+ for (const anchor in schemaDoc.anchors) {
3753
+ if (anchor !== "" && !schemaDoc.dynamicAnchors[anchor]) {
3754
+ anchors[schemaDoc.anchors[anchor]] = anchor;
2725
3755
  }
3756
+ }
3757
+
3758
+ const dynamicAnchors = {};
3759
+ for (const anchor in schemaDoc.dynamicAnchors) {
3760
+ const pointer = urlFragment(schemaDoc.dynamicAnchors[anchor]);
3761
+ dynamicAnchors[pointer] = anchor;
3762
+ }
2726
3763
 
2727
- const refValue = Reference$1.value(value);
2728
- const embeddedDialect = typeof refValue.$schema === "string" ? resolveUrl$1(refValue.$schema, "") : schemaDoc.dialectId;
2729
- const embeddedToken = getConfig(embeddedDialect, "embeddedToken");
2730
- if (!fullOptions.includeEmbedded && embeddedToken in refValue) {
2731
- return;
3764
+ const schema = JSON.parse(Json.stringify(schemaDoc.schema, (key, value, pointer) => {
3765
+ if (Reference$1.isReference(value)) {
3766
+ const refValue = Reference$1.value(value);
3767
+ const embeddedDialect = typeof refValue.$schema === "string" ? resolveUrl$1(refValue.$schema, "") : schemaDoc.dialectId;
3768
+ const embeddedToken = getConfig(embeddedDialect, "embeddedToken");
3769
+ if (!fullOptions.includeEmbedded && embeddedToken in refValue) {
3770
+ return;
3771
+ } else {
3772
+ return Reference$1.value(value);
3773
+ }
2732
3774
  } else {
2733
- return Reference$1.value(value);
3775
+ if (pointer in anchors) {
3776
+ value = { [anchorToken]: anchors[pointer], ...value };
3777
+ }
3778
+ if (pointer in dynamicAnchors) {
3779
+ value = { [dynamicAnchorToken]: dynamicAnchors[pointer], ...value };
3780
+ }
3781
+ return value;
2734
3782
  }
2735
3783
  }));
2736
3784
 
2737
- const dynamicAnchorToken = getConfig(schemaDoc.dialectId, "dynamicAnchorToken");
2738
- Object.entries(schemaDoc.dynamicAnchors)
2739
- .forEach(([anchor, uri]) => {
2740
- const pointer = urlFragment(uri);
2741
- JsonPointer.assign(pointer, schema, {
2742
- [dynamicAnchorToken]: anchor,
2743
- ...JsonPointer.get(pointer, schema)
2744
- });
2745
- });
2746
-
2747
- const anchorToken = getConfig(schemaDoc.dialectId, "anchorToken");
2748
- Object.entries(schemaDoc.anchors)
2749
- .filter(([anchor]) => anchor !== "")
2750
- .forEach(([anchor, pointer]) => {
2751
- JsonPointer.assign(pointer, schema, {
2752
- [anchorToken]: anchor,
2753
- ...JsonPointer.get(pointer, schema)
2754
- });
2755
- });
2756
-
2757
3785
  const baseToken = getConfig(schemaDoc.dialectId, "baseToken");
2758
3786
  const id = relativeUri(fullOptions.parentId, schemaDoc.id);
2759
3787
  const dialect = fullOptions.parentDialect === schemaDoc.dialectId ? "" : schemaDoc.dialectId;
@@ -2776,7 +3804,7 @@
2776
3804
  var schema$5 = {
2777
3805
  setConfig, getConfig,
2778
3806
  add: add$1, get, markValidated,
2779
- uri, value, getAnchorPointer, typeOf, has, step, keys, entries, map, length,
3807
+ uri, value, getAnchorPointer, typeOf, has, step, keys, entries: entries$2, map: map$3, length,
2780
3808
  toSchema
2781
3809
  };
2782
3810
 
@@ -2798,7 +3826,7 @@
2798
3826
 
2799
3827
  var metaData$4 = { compile: compile$O, interpret: interpret$O };
2800
3828
 
2801
- const curry = justCurryIt;
3829
+ const curry$7 = justCurryIt$2;
2802
3830
  const PubSub$1 = pubsub.exports;
2803
3831
  const { resolveUrl } = common$1;
2804
3832
  const Instance$E = instance;
@@ -2834,7 +3862,7 @@
2834
3862
  return { ast, schemaUri };
2835
3863
  };
2836
3864
 
2837
- const interpret$N = curry(({ ast, schemaUri }, value, outputFormat = FLAG) => {
3865
+ const interpret$N = curry$7(({ ast, schemaUri }, value, outputFormat = FLAG) => {
2838
3866
  if (![FLAG, BASIC, DETAILED, VERBOSE].includes(outputFormat)) {
2839
3867
  throw Error(`The '${outputFormat}' error format is not supported`);
2840
3868
  }
@@ -3004,7 +4032,7 @@
3004
4032
  addMediaTypePlugin: MediaTypes.addPlugin
3005
4033
  };
3006
4034
 
3007
- const Pact$9 = lib$2;
4035
+ const Pact$9 = lib$5;
3008
4036
  const PubSub = pubsub.exports;
3009
4037
  const Core$x = core$2;
3010
4038
  const Instance$D = instance;
@@ -3117,9 +4145,9 @@
3117
4145
  const InvalidSchemaError$1 = invalidSchemaError;
3118
4146
 
3119
4147
 
3120
- var lib$1 = { Core: Core$w, Schema: Schema$O, Instance: Instance$C, Reference, Keywords: Keywords$2, InvalidSchemaError: InvalidSchemaError$1 };
4148
+ var lib$2 = { Core: Core$w, Schema: Schema$O, Instance: Instance$C, Reference, Keywords: Keywords$2, InvalidSchemaError: InvalidSchemaError$1 };
3121
4149
 
3122
- const { Core: Core$v, Schema: Schema$N, Instance: Instance$B } = lib$1;
4150
+ const { Core: Core$v, Schema: Schema$N, Instance: Instance$B } = lib$2;
3123
4151
 
3124
4152
 
3125
4153
  const compile$L = async (schema, ast, parentSchema) => {
@@ -3147,7 +4175,7 @@
3147
4175
 
3148
4176
  var additionalItems = { compile: compile$L, interpret: interpret$L };
3149
4177
 
3150
- const { Core: Core$u, Schema: Schema$M, Instance: Instance$A } = lib$1;
4178
+ const { Core: Core$u, Schema: Schema$M, Instance: Instance$A } = lib$2;
3151
4179
 
3152
4180
 
3153
4181
  const compile$K = async (schema, ast, parentSchema) => {
@@ -3171,7 +4199,7 @@
3171
4199
 
3172
4200
  var additionalItems6 = { compile: compile$K, interpret: interpret$K, collectEvaluatedItems: collectEvaluatedItems$d };
3173
4201
 
3174
- const { Core: Core$t, Schema: Schema$L, Instance: Instance$z } = lib$1;
4202
+ const { Core: Core$t, Schema: Schema$L, Instance: Instance$z } = lib$2;
3175
4203
 
3176
4204
 
3177
4205
  const compile$J = async (schema, ast, parentSchema) => {
@@ -3205,7 +4233,7 @@
3205
4233
 
3206
4234
  var additionalProperties = { compile: compile$J, interpret: interpret$J };
3207
4235
 
3208
- const { Core: Core$s, Schema: Schema$K, Instance: Instance$y } = lib$1;
4236
+ const { Core: Core$s, Schema: Schema$K, Instance: Instance$y } = lib$2;
3209
4237
 
3210
4238
 
3211
4239
  const compile$I = async (schema, ast, parentSchema) => {
@@ -3234,8 +4262,129 @@
3234
4262
 
3235
4263
  var additionalProperties6 = { compile: compile$I, interpret: interpret$I, collectEvaluatedProperties: collectEvaluatedProperties$c };
3236
4264
 
3237
- const { Core: Core$r, Schema: Schema$J } = lib$1;
3238
- const Pact$8 = lib$2;
4265
+ var entries$1 = async (doc) => Object.entries(await doc);
4266
+
4267
+ var justCurryIt = curry$6;
4268
+
4269
+ /*
4270
+ function add(a, b, c) {
4271
+ return a + b + c;
4272
+ }
4273
+ curry(add)(1)(2)(3); // 6
4274
+ curry(add)(1)(2)(2); // 5
4275
+ curry(add)(2)(4, 3); // 9
4276
+
4277
+ function add(...args) {
4278
+ return args.reduce((sum, n) => sum + n, 0)
4279
+ }
4280
+ var curryAdd4 = curry(add, 4)
4281
+ curryAdd4(1)(2, 3)(4); // 10
4282
+
4283
+ function converter(ratio, input) {
4284
+ return (input*ratio).toFixed(1);
4285
+ }
4286
+ const curriedConverter = curry(converter)
4287
+ const milesToKm = curriedConverter(1.62);
4288
+ milesToKm(35); // 56.7
4289
+ milesToKm(10); // 16.2
4290
+ */
4291
+
4292
+ function curry$6(fn, arity) {
4293
+ return function curried() {
4294
+ if (arity == null) {
4295
+ arity = fn.length;
4296
+ }
4297
+ var args = [].slice.call(arguments);
4298
+ if (args.length >= arity) {
4299
+ return fn.apply(this, args);
4300
+ } else {
4301
+ return function() {
4302
+ return curried.apply(this, args.concat([].slice.call(arguments)));
4303
+ };
4304
+ }
4305
+ };
4306
+ }
4307
+
4308
+ const curry$5 = justCurryIt;
4309
+
4310
+
4311
+ var map$2 = curry$5(async (fn, doc) => (await doc).map(fn));
4312
+
4313
+ const curry$4 = justCurryIt;
4314
+
4315
+
4316
+ var reduce$2 = curry$4(async (fn, acc, doc) => {
4317
+ return (await doc).reduce(async (acc, item) => fn(await acc, item), acc);
4318
+ });
4319
+
4320
+ const curry$3 = justCurryIt;
4321
+ const reduce$1 = reduce$2;
4322
+
4323
+
4324
+ var filter = curry$3(async (fn, doc, options = {}) => {
4325
+ return reduce$1(async (acc, item) => {
4326
+ return (await fn(item)) ? acc.concat([item]) : acc;
4327
+ }, [], doc, options);
4328
+ });
4329
+
4330
+ const curry$2 = justCurryIt;
4331
+ const map$1 = map$2;
4332
+
4333
+
4334
+ var some = curry$2(async (fn, doc) => {
4335
+ const results = await map$1(fn, doc);
4336
+ return (await Promise.all(results))
4337
+ .some((a) => a);
4338
+ });
4339
+
4340
+ const curry$1 = justCurryIt;
4341
+ const map = map$2;
4342
+
4343
+
4344
+ var every = curry$1(async (fn, doc) => {
4345
+ const results = await map(fn, doc);
4346
+ return (await Promise.all(results))
4347
+ .every((a) => a);
4348
+ });
4349
+
4350
+ const curry = justCurryIt;
4351
+
4352
+
4353
+ var pipeline$1 = curry((fns, doc) => {
4354
+ return fns.reduce(async (acc, fn) => fn(await acc), doc);
4355
+ });
4356
+
4357
+ var all = (doc) => Promise.all(doc);
4358
+
4359
+ const pipeline = pipeline$1;
4360
+ const entries = entries$1;
4361
+ const reduce = reduce$2;
4362
+
4363
+
4364
+ var allValues = (doc) => {
4365
+ return pipeline([
4366
+ entries,
4367
+ reduce(async (acc, [propertyName, propertyValue]) => {
4368
+ acc[propertyName] = await propertyValue;
4369
+ return acc;
4370
+ }, {})
4371
+ ], doc);
4372
+ };
4373
+
4374
+ var lib$1 = {
4375
+ entries: entries$1,
4376
+ map: map$2,
4377
+ filter: filter,
4378
+ reduce: reduce$2,
4379
+ some: some,
4380
+ every: every,
4381
+ pipeline: pipeline$1,
4382
+ all: all,
4383
+ allValues: allValues
4384
+ };
4385
+
4386
+ const { Core: Core$r, Schema: Schema$J } = lib$2;
4387
+ const Pact$8 = lib$1;
3239
4388
 
3240
4389
 
3241
4390
  const compile$H = (schema, ast) => Pact$8.pipeline([
@@ -3263,8 +4412,8 @@
3263
4412
 
3264
4413
  var allOf = { compile: compile$H, interpret: interpret$H, collectEvaluatedProperties: collectEvaluatedProperties$b, collectEvaluatedItems: collectEvaluatedItems$c };
3265
4414
 
3266
- const { Core: Core$q, Schema: Schema$I } = lib$1;
3267
- const Pact$7 = lib$2;
4415
+ const { Core: Core$q, Schema: Schema$I } = lib$2;
4416
+ const Pact$7 = lib$1;
3268
4417
 
3269
4418
 
3270
4419
  const compile$G = (schema, ast) => Pact$7.pipeline([
@@ -3352,7 +4501,7 @@
3352
4501
 
3353
4502
  var fastestStableStringify = function(obj) { return '' + stringify(obj, false); };
3354
4503
 
3355
- const { Schema: Schema$H, Instance: Instance$x } = lib$1;
4504
+ const { Schema: Schema$H, Instance: Instance$x } = lib$2;
3356
4505
  const jsonStringify$2 = fastestStableStringify;
3357
4506
 
3358
4507
 
@@ -3361,7 +4510,7 @@
3361
4510
 
3362
4511
  var _const = { compile: compile$F, interpret: interpret$F };
3363
4512
 
3364
- const { Core: Core$p, Instance: Instance$w } = lib$1;
4513
+ const { Core: Core$p, Instance: Instance$w } = lib$2;
3365
4514
 
3366
4515
 
3367
4516
  const compile$E = (schema, ast) => Core$p.compileSchema(schema, ast);
@@ -3372,7 +4521,7 @@
3372
4521
 
3373
4522
  var contains = { compile: compile$E, interpret: interpret$E };
3374
4523
 
3375
- const { Core: Core$o, Schema: Schema$G, Instance: Instance$v } = lib$1;
4524
+ const { Core: Core$o, Schema: Schema$G, Instance: Instance$v } = lib$2;
3376
4525
 
3377
4526
 
3378
4527
  const compile$D = async (schema, ast, parentSchema) => {
@@ -3406,8 +4555,8 @@
3406
4555
 
3407
4556
  var containsMinContainsMaxContains = { compile: compile$D, interpret: interpret$D, collectEvaluatedItems: collectEvaluatedItems$a };
3408
4557
 
3409
- const { Core: Core$n, Schema: Schema$F } = lib$1;
3410
- const Pact$6 = lib$2;
4558
+ const { Core: Core$n, Schema: Schema$F } = lib$2;
4559
+ const Pact$6 = lib$1;
3411
4560
 
3412
4561
 
3413
4562
  const compile$C = async (schema, ast) => {
@@ -3422,8 +4571,8 @@
3422
4571
 
3423
4572
  var definitions = { compile: compile$C, interpret: interpret$C };
3424
4573
 
3425
- const { Core: Core$m, Schema: Schema$E, Instance: Instance$u } = lib$1;
3426
- const Pact$5 = lib$2;
4574
+ const { Core: Core$m, Schema: Schema$E, Instance: Instance$u } = lib$2;
4575
+ const Pact$5 = lib$1;
3427
4576
 
3428
4577
 
3429
4578
  const compile$B = (schema, ast) => Pact$5.pipeline([
@@ -3452,8 +4601,8 @@
3452
4601
 
3453
4602
  var dependencies = { compile: compile$B, interpret: interpret$B };
3454
4603
 
3455
- const { Schema: Schema$D, Instance: Instance$t } = lib$1;
3456
- const Pact$4 = lib$2;
4604
+ const { Schema: Schema$D, Instance: Instance$t } = lib$2;
4605
+ const Pact$4 = lib$1;
3457
4606
 
3458
4607
 
3459
4608
  const compile$A = (schema) => Pact$4.pipeline([
@@ -3472,8 +4621,8 @@
3472
4621
 
3473
4622
  var dependentRequired = { compile: compile$A, interpret: interpret$A };
3474
4623
 
3475
- const { Core: Core$l, Schema: Schema$C, Instance: Instance$s } = lib$1;
3476
- const Pact$3 = lib$2;
4624
+ const { Core: Core$l, Schema: Schema$C, Instance: Instance$s } = lib$2;
4625
+ const Pact$3 = lib$1;
3477
4626
 
3478
4627
 
3479
4628
  const compile$z = (schema, ast) => Pact$3.pipeline([
@@ -3503,7 +4652,7 @@
3503
4652
 
3504
4653
  var dependentSchemas = { compile: compile$z, interpret: interpret$z, collectEvaluatedProperties: collectEvaluatedProperties$9 };
3505
4654
 
3506
- const { Schema: Schema$B, Instance: Instance$r } = lib$1;
4655
+ const { Schema: Schema$B, Instance: Instance$r } = lib$2;
3507
4656
  const jsonStringify$1 = fastestStableStringify;
3508
4657
 
3509
4658
 
@@ -3512,7 +4661,7 @@
3512
4661
 
3513
4662
  var _enum = { compile: compile$y, interpret: interpret$y };
3514
4663
 
3515
- const { Schema: Schema$A, Instance: Instance$q } = lib$1;
4664
+ const { Schema: Schema$A, Instance: Instance$q } = lib$2;
3516
4665
 
3517
4666
 
3518
4667
  const compile$x = async (schema) => Schema$A.value(schema);
@@ -3520,7 +4669,7 @@
3520
4669
 
3521
4670
  var exclusiveMaximum = { compile: compile$x, interpret: interpret$x };
3522
4671
 
3523
- const { Schema: Schema$z, Instance: Instance$p } = lib$1;
4672
+ const { Schema: Schema$z, Instance: Instance$p } = lib$2;
3524
4673
 
3525
4674
 
3526
4675
  const compile$w = async (schema) => Schema$z.value(schema);
@@ -3528,7 +4677,7 @@
3528
4677
 
3529
4678
  var exclusiveMinimum = { compile: compile$w, interpret: interpret$w };
3530
4679
 
3531
- const { Core: Core$k } = lib$1;
4680
+ const { Core: Core$k } = lib$2;
3532
4681
 
3533
4682
 
3534
4683
  const compile$v = (schema, ast) => Core$k.compileSchema(schema, ast);
@@ -3548,7 +4697,7 @@
3548
4697
 
3549
4698
  var _if = { compile: compile$v, interpret: interpret$v, collectEvaluatedProperties: collectEvaluatedProperties$8, collectEvaluatedItems: collectEvaluatedItems$9 };
3550
4699
 
3551
- const { Core: Core$j, Schema: Schema$y } = lib$1;
4700
+ const { Core: Core$j, Schema: Schema$y } = lib$2;
3552
4701
 
3553
4702
 
3554
4703
  const compile$u = async (schema, ast, parentSchema) => {
@@ -3592,7 +4741,7 @@
3592
4741
 
3593
4742
  var then = { compile: compile$u, interpret: interpret$u, collectEvaluatedProperties: collectEvaluatedProperties$7, collectEvaluatedItems: collectEvaluatedItems$8 };
3594
4743
 
3595
- const { Core: Core$i, Schema: Schema$x } = lib$1;
4744
+ const { Core: Core$i, Schema: Schema$x } = lib$2;
3596
4745
 
3597
4746
 
3598
4747
  const compile$t = async (schema, ast, parentSchema) => {
@@ -3636,7 +4785,7 @@
3636
4785
 
3637
4786
  var _else = { compile: compile$t, interpret: interpret$t, collectEvaluatedProperties: collectEvaluatedProperties$6, collectEvaluatedItems: collectEvaluatedItems$7 };
3638
4787
 
3639
- const { Core: Core$h, Schema: Schema$w, Instance: Instance$o } = lib$1;
4788
+ const { Core: Core$h, Schema: Schema$w, Instance: Instance$o } = lib$2;
3640
4789
 
3641
4790
 
3642
4791
  const compile$s = async (schema, ast) => {
@@ -3668,7 +4817,7 @@
3668
4817
 
3669
4818
  var items = { compile: compile$s, interpret: interpret$s, collectEvaluatedItems: collectEvaluatedItems$6 };
3670
4819
 
3671
- const { Core: Core$g, Schema: Schema$v, Instance: Instance$n } = lib$1;
4820
+ const { Core: Core$g, Schema: Schema$v, Instance: Instance$n } = lib$2;
3672
4821
 
3673
4822
 
3674
4823
  const compile$r = async (schema, ast, parentSchema) => {
@@ -3692,7 +4841,7 @@
3692
4841
 
3693
4842
  var items202012 = { compile: compile$r, interpret: interpret$r, collectEvaluatedItems: collectEvaluatedItems$5 };
3694
4843
 
3695
- const { Schema: Schema$u, Instance: Instance$m } = lib$1;
4844
+ const { Schema: Schema$u, Instance: Instance$m } = lib$2;
3696
4845
 
3697
4846
 
3698
4847
  const compile$q = (schema) => Schema$u.value(schema);
@@ -3700,7 +4849,7 @@
3700
4849
 
3701
4850
  var maxItems = { compile: compile$q, interpret: interpret$q };
3702
4851
 
3703
- const { Schema: Schema$t, Instance: Instance$l } = lib$1;
4852
+ const { Schema: Schema$t, Instance: Instance$l } = lib$2;
3704
4853
 
3705
4854
 
3706
4855
  const compile$p = (schema) => Schema$t.value(schema);
@@ -3708,7 +4857,7 @@
3708
4857
 
3709
4858
  var maxLength = { compile: compile$p, interpret: interpret$p };
3710
4859
 
3711
- const { Schema: Schema$s, Instance: Instance$k } = lib$1;
4860
+ const { Schema: Schema$s, Instance: Instance$k } = lib$2;
3712
4861
 
3713
4862
 
3714
4863
  const compile$o = (schema) => Schema$s.value(schema);
@@ -3716,7 +4865,7 @@
3716
4865
 
3717
4866
  var maxLength6 = { compile: compile$o, interpret: interpret$o };
3718
4867
 
3719
- const { Schema: Schema$r, Instance: Instance$j } = lib$1;
4868
+ const { Schema: Schema$r, Instance: Instance$j } = lib$2;
3720
4869
 
3721
4870
 
3722
4871
  const compile$n = (schema) => Schema$r.value(schema);
@@ -3724,7 +4873,7 @@
3724
4873
 
3725
4874
  var maxProperties = { compile: compile$n, interpret: interpret$n };
3726
4875
 
3727
- const { Schema: Schema$q, Instance: Instance$i } = lib$1;
4876
+ const { Schema: Schema$q, Instance: Instance$i } = lib$2;
3728
4877
 
3729
4878
 
3730
4879
  const compile$m = async (schema, ast, parentSchema) => {
@@ -3745,7 +4894,7 @@
3745
4894
 
3746
4895
  var maximumExclusiveMaximum = { compile: compile$m, interpret: interpret$m };
3747
4896
 
3748
- const { Schema: Schema$p, Instance: Instance$h } = lib$1;
4897
+ const { Schema: Schema$p, Instance: Instance$h } = lib$2;
3749
4898
 
3750
4899
 
3751
4900
  const compile$l = async (schema) => Schema$p.value(schema);
@@ -3753,7 +4902,7 @@
3753
4902
 
3754
4903
  var maximum = { compile: compile$l, interpret: interpret$l };
3755
4904
 
3756
- const { Schema: Schema$o, Instance: Instance$g } = lib$1;
4905
+ const { Schema: Schema$o, Instance: Instance$g } = lib$2;
3757
4906
 
3758
4907
 
3759
4908
  const compile$k = (schema) => Schema$o.value(schema);
@@ -3761,7 +4910,7 @@
3761
4910
 
3762
4911
  var minItems = { compile: compile$k, interpret: interpret$k };
3763
4912
 
3764
- const { Schema: Schema$n, Instance: Instance$f } = lib$1;
4913
+ const { Schema: Schema$n, Instance: Instance$f } = lib$2;
3765
4914
 
3766
4915
 
3767
4916
  const compile$j = (schema) => Schema$n.value(schema);
@@ -3769,7 +4918,7 @@
3769
4918
 
3770
4919
  var minLength = { compile: compile$j, interpret: interpret$j };
3771
4920
 
3772
- const { Schema: Schema$m, Instance: Instance$e } = lib$1;
4921
+ const { Schema: Schema$m, Instance: Instance$e } = lib$2;
3773
4922
 
3774
4923
 
3775
4924
  const compile$i = (schema) => Schema$m.value(schema);
@@ -3777,7 +4926,7 @@
3777
4926
 
3778
4927
  var minLength6 = { compile: compile$i, interpret: interpret$i };
3779
4928
 
3780
- const { Schema: Schema$l, Instance: Instance$d } = lib$1;
4929
+ const { Schema: Schema$l, Instance: Instance$d } = lib$2;
3781
4930
 
3782
4931
 
3783
4932
  const compile$h = (schema) => Schema$l.value(schema);
@@ -3785,7 +4934,7 @@
3785
4934
 
3786
4935
  var minProperties = { compile: compile$h, interpret: interpret$h };
3787
4936
 
3788
- const { Schema: Schema$k, Instance: Instance$c } = lib$1;
4937
+ const { Schema: Schema$k, Instance: Instance$c } = lib$2;
3789
4938
 
3790
4939
 
3791
4940
  const compile$g = async (schema, ast, parentSchema) => {
@@ -3806,7 +4955,7 @@
3806
4955
 
3807
4956
  var minimumExclusiveMinimum = { compile: compile$g, interpret: interpret$g };
3808
4957
 
3809
- const { Schema: Schema$j, Instance: Instance$b } = lib$1;
4958
+ const { Schema: Schema$j, Instance: Instance$b } = lib$2;
3810
4959
 
3811
4960
 
3812
4961
  const compile$f = async (schema) => Schema$j.value(schema);
@@ -3814,7 +4963,7 @@
3814
4963
 
3815
4964
  var minimum = { compile: compile$f, interpret: interpret$f };
3816
4965
 
3817
- const { Schema: Schema$i, Instance: Instance$a } = lib$1;
4966
+ const { Schema: Schema$i, Instance: Instance$a } = lib$2;
3818
4967
 
3819
4968
 
3820
4969
  const compile$e = (schema) => Schema$i.value(schema);
@@ -3832,7 +4981,7 @@
3832
4981
 
3833
4982
  var multipleOf = { compile: compile$e, interpret: interpret$e };
3834
4983
 
3835
- const { Core: Core$f } = lib$1;
4984
+ const { Core: Core$f } = lib$2;
3836
4985
 
3837
4986
 
3838
4987
  const compile$d = Core$f.compileSchema;
@@ -3840,7 +4989,7 @@
3840
4989
 
3841
4990
  var not = { compile: compile$d, interpret: interpret$d };
3842
4991
 
3843
- const { Core: Core$e, Schema: Schema$h } = lib$1;
4992
+ const { Core: Core$e, Schema: Schema$h } = lib$2;
3844
4993
 
3845
4994
 
3846
4995
  const compile$c = async (schema, ast) => {
@@ -3889,7 +5038,7 @@
3889
5038
 
3890
5039
  var oneOf = { compile: compile$c, interpret: interpret$c, collectEvaluatedProperties: collectEvaluatedProperties$5, collectEvaluatedItems: collectEvaluatedItems$4 };
3891
5040
 
3892
- const { Schema: Schema$g, Instance: Instance$9 } = lib$1;
5041
+ const { Schema: Schema$g, Instance: Instance$9 } = lib$2;
3893
5042
 
3894
5043
 
3895
5044
  const compile$b = (schema) => new RegExp(Schema$g.value(schema), "u");
@@ -3897,8 +5046,8 @@
3897
5046
 
3898
5047
  var pattern = { compile: compile$b, interpret: interpret$b };
3899
5048
 
3900
- const { Core: Core$d, Schema: Schema$f, Instance: Instance$8 } = lib$1;
3901
- const Pact$2 = lib$2;
5049
+ const { Core: Core$d, Schema: Schema$f, Instance: Instance$8 } = lib$2;
5050
+ const Pact$2 = lib$1;
3902
5051
 
3903
5052
 
3904
5053
  const compile$a = (schema, ast) => Pact$2.pipeline([
@@ -3935,8 +5084,8 @@
3935
5084
 
3936
5085
  var common = { isObject, escapeRegExp: escapeRegExp$1, splitUrl: splitUrl$1 };
3937
5086
 
3938
- const { Core: Core$c, Schema: Schema$e, Instance: Instance$7 } = lib$1;
3939
- const Pact$1 = lib$2;
5087
+ const { Core: Core$c, Schema: Schema$e, Instance: Instance$7 } = lib$2;
5088
+ const Pact$1 = lib$1;
3940
5089
  const { escapeRegExp } = common;
3941
5090
 
3942
5091
 
@@ -3961,7 +5110,7 @@
3961
5110
 
3962
5111
  var properties = { compile: compile$9, interpret: interpret$9, collectEvaluatedProperties: collectEvaluatedProperties$3 };
3963
5112
 
3964
- const { Core: Core$b, Instance: Instance$6 } = lib$1;
5113
+ const { Core: Core$b, Instance: Instance$6 } = lib$2;
3965
5114
 
3966
5115
 
3967
5116
  const compile$8 = (schema, ast) => Core$b.compileSchema(schema, ast);
@@ -3973,7 +5122,7 @@
3973
5122
 
3974
5123
  var propertyNames = { compile: compile$8, interpret: interpret$8 };
3975
5124
 
3976
- const { Core: Core$a, Schema: Schema$d } = lib$1;
5125
+ const { Core: Core$a, Schema: Schema$d } = lib$2;
3977
5126
  const { splitUrl } = common;
3978
5127
 
3979
5128
 
@@ -3998,7 +5147,7 @@
3998
5147
 
3999
5148
  var dynamicRef = { compile: compile$7, interpret: interpret$7, collectEvaluatedProperties: collectEvaluatedProperties$2, collectEvaluatedItems: collectEvaluatedItems$3 };
4000
5149
 
4001
- const { Core: Core$9, Schema: Schema$c } = lib$1;
5150
+ const { Core: Core$9, Schema: Schema$c } = lib$2;
4002
5151
 
4003
5152
 
4004
5153
  const compile$6 = async (ref, ast) => {
@@ -4012,7 +5161,7 @@
4012
5161
 
4013
5162
  var ref = { compile: compile$6, interpret: interpret$6, collectEvaluatedProperties: collectEvaluatedProperties$1, collectEvaluatedItems: collectEvaluatedItems$2 };
4014
5163
 
4015
- const { Schema: Schema$b, Instance: Instance$5 } = lib$1;
5164
+ const { Schema: Schema$b, Instance: Instance$5 } = lib$2;
4016
5165
 
4017
5166
 
4018
5167
  const compile$5 = (schema) => Schema$b.value(schema);
@@ -4023,8 +5172,8 @@
4023
5172
 
4024
5173
  var required = { compile: compile$5, interpret: interpret$5 };
4025
5174
 
4026
- const { Core: Core$8, Schema: Schema$a, Instance: Instance$4 } = lib$1;
4027
- const Pact = lib$2;
5175
+ const { Core: Core$8, Schema: Schema$a, Instance: Instance$4 } = lib$2;
5176
+ const Pact = lib$1;
4028
5177
 
4029
5178
 
4030
5179
  const compile$4 = (schema, ast) => {
@@ -4048,7 +5197,7 @@
4048
5197
 
4049
5198
  var tupleItems = { compile: compile$4, interpret: interpret$4, collectEvaluatedItems: collectEvaluatedItems$1 };
4050
5199
 
4051
- const { Schema: Schema$9, Instance: Instance$3 } = lib$1;
5200
+ const { Schema: Schema$9, Instance: Instance$3 } = lib$2;
4052
5201
 
4053
5202
 
4054
5203
  const compile$3 = (schema) => Schema$9.value(schema);
@@ -4056,7 +5205,7 @@
4056
5205
 
4057
5206
  var type = { compile: compile$3, interpret: interpret$3 };
4058
5207
 
4059
- const { Core: Core$7, Schema: Schema$8, Instance: Instance$2 } = lib$1;
5208
+ const { Core: Core$7, Schema: Schema$8, Instance: Instance$2 } = lib$2;
4060
5209
 
4061
5210
 
4062
5211
  const compile$2 = async (schema, ast, parentSchema) => {
@@ -4080,7 +5229,7 @@
4080
5229
 
4081
5230
  var unevaluatedItems = { compile: compile$2, interpret: interpret$2, collectEvaluatedItems };
4082
5231
 
4083
- const { Core: Core$6, Schema: Schema$7, Instance: Instance$1 } = lib$1;
5232
+ const { Core: Core$6, Schema: Schema$7, Instance: Instance$1 } = lib$2;
4084
5233
 
4085
5234
 
4086
5235
  const compile$1 = async (schema, ast, parentSchema) => {
@@ -4105,7 +5254,7 @@
4105
5254
 
4106
5255
  var unevaluatedProperties = { compile: compile$1, interpret: interpret$1, collectEvaluatedProperties };
4107
5256
 
4108
- const { Schema: Schema$6, Instance } = lib$1;
5257
+ const { Schema: Schema$6, Instance } = lib$2;
4109
5258
  const jsonStringify = fastestStableStringify;
4110
5259
 
4111
5260
 
@@ -4122,7 +5271,7 @@
4122
5271
 
4123
5272
  var uniqueItems = { compile, interpret };
4124
5273
 
4125
- const { Keywords: Keywords$1 } = lib$1;
5274
+ const { Keywords: Keywords$1 } = lib$2;
4126
5275
 
4127
5276
 
4128
5277
  var keywords$5 = {
@@ -4328,7 +5477,7 @@
4328
5477
  "default": {}
4329
5478
  }`;
4330
5479
 
4331
- const { Core: Core$5, Schema: Schema$5 } = lib$1;
5480
+ const { Core: Core$5, Schema: Schema$5 } = lib$2;
4332
5481
  const keywords$4 = keywords$5;
4333
5482
  const metaSchema$4 = schema$4;
4334
5483
 
@@ -4530,7 +5679,7 @@
4530
5679
  "default": {}
4531
5680
  }`;
4532
5681
 
4533
- const { Core: Core$4, Schema: Schema$4 } = lib$1;
5682
+ const { Core: Core$4, Schema: Schema$4 } = lib$2;
4534
5683
  const keywords$3 = keywords$5;
4535
5684
  const metaSchema$3 = schema$3;
4536
5685
 
@@ -4755,7 +5904,7 @@
4755
5904
  "default": true
4756
5905
  }`;
4757
5906
 
4758
- const { Core: Core$3, Schema: Schema$3 } = lib$1;
5907
+ const { Core: Core$3, Schema: Schema$3 } = lib$2;
4759
5908
  const keywords$2 = keywords$5;
4760
5909
  const metaSchema$2 = schema$2;
4761
5910
 
@@ -5138,7 +6287,7 @@
5138
6287
  }
5139
6288
  }`;
5140
6289
 
5141
- const { Core: Core$2, Schema: Schema$2 } = lib$1;
6290
+ const { Core: Core$2, Schema: Schema$2 } = lib$2;
5142
6291
  const keywords$1 = keywords$5;
5143
6292
  const metaSchema$1 = schema$1;
5144
6293
  const coreMetaSchema$1 = core$1;
@@ -5585,7 +6734,7 @@
5585
6734
  }
5586
6735
  }`;
5587
6736
 
5588
- const { Core: Core$1, Schema: Schema$1 } = lib$1;
6737
+ const { Core: Core$1, Schema: Schema$1 } = lib$2;
5589
6738
  const keywords = keywords$5;
5590
6739
  const metaSchema = schema;
5591
6740
  const coreMetaSchema = core;
@@ -5689,7 +6838,7 @@
5689
6838
  "unevaluatedProperties": keywords.unevaluatedProperties
5690
6839
  });
5691
6840
 
5692
- const { Core, Schema, InvalidSchemaError } = lib$1;
6841
+ const { Core, Schema, InvalidSchemaError } = lib$2;
5693
6842
  const Keywords = keywords$5;
5694
6843
 
5695
6844