z-schema-esm
Version:
ESM fork of z-schema. JSON schema validator
1,785 lines (1,591 loc) • 431 kB
JavaScript
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function getDefaultExportFromCjs (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}
// Number.isFinite polyfill
// http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite
if (typeof Number.isFinite !== "function") {
Number.isFinite = function isFinite(value) {
// 1. If Type(number) is not Number, return false.
if (typeof value !== "number") {
return false;
}
// 2. If number is NaN, +∞, or −∞, return false.
if (value !== value || value === Infinity || value === -Infinity) {
return false;
}
// 3. Otherwise, return true.
return true;
};
}
/**
* lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
/** Used as the `TypeError` message for "Functions" methods. */
var FUNC_ERROR_TEXT = 'Expected a function';
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
/** `Object#toString` result references. */
var funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
symbolTag = '[object Symbol]';
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/,
reLeadingDot = /^\./,
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
/** Used to match backslashes in property paths. */
var reEscapeChar = /\\(\\)?/g;
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
/**
* Gets the value at `key` of `object`.
*
* @private
* @param {Object} [object] The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function getValue(object, key) {
return object == null ? undefined : object[key];
}
/**
* Checks if `value` is a host object in IE < 9.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
*/
function isHostObject(value) {
// Many host objects are `Object` objects that can coerce to strings
// despite having improperly defined `toString` methods.
var result = false;
if (value != null && typeof value.toString != 'function') {
try {
result = !!(value + '');
} catch (e) {}
}
return result;
}
/** Used for built-in method references. */
var arrayProto = Array.prototype,
funcProto = Function.prototype,
objectProto = Object.prototype;
/** Used to detect overreaching core-js shims. */
var coreJsData = root['__core-js_shared__'];
/** Used to detect methods masquerading as native. */
var maskSrcKey = (function() {
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
return uid ? ('Symbol(src)_1.' + uid) : '';
}());
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/** Built-in value references. */
var Symbol$1 = root.Symbol,
splice = arrayProto.splice;
/* Built-in method references that are verified to be native. */
var Map$1 = getNative(root, 'Map'),
nativeCreate = getNative(Object, 'create');
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
symbolToString = symbolProto ? symbolProto.toString : undefined;
/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the hash.
*
* @private
* @name clear
* @memberOf Hash
*/
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
}
/**
* Removes `key` and its value from the hash.
*
* @private
* @name delete
* @memberOf Hash
* @param {Object} hash The hash to modify.
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function hashDelete(key) {
return this.has(key) && delete this.__data__[key];
}
/**
* Gets the hash value for `key`.
*
* @private
* @name get
* @memberOf Hash
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? undefined : result;
}
return hasOwnProperty.call(data, key) ? data[key] : undefined;
}
/**
* Checks if a hash value for `key` exists.
*
* @private
* @name has
* @memberOf Hash
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function hashHas(key) {
var data = this.__data__;
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
}
/**
* Sets the hash `key` to `value`.
*
* @private
* @name set
* @memberOf Hash
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the hash instance.
*/
function hashSet(key, value) {
var data = this.__data__;
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
return this;
}
// Add methods to `Hash`.
Hash.prototype.clear = hashClear;
Hash.prototype['delete'] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the list cache.
*
* @private
* @name clear
* @memberOf ListCache
*/
function listCacheClear() {
this.__data__ = [];
}
/**
* Removes `key` and its value from the list cache.
*
* @private
* @name delete
* @memberOf ListCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function listCacheDelete(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
return true;
}
/**
* Gets the list cache value for `key`.
*
* @private
* @name get
* @memberOf ListCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function listCacheGet(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}
/**
* Checks if a list cache value for `key` exists.
*
* @private
* @name has
* @memberOf ListCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
/**
* Sets the list cache `key` to `value`.
*
* @private
* @name set
* @memberOf ListCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the list cache instance.
*/
function listCacheSet(key, value) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the map.
*
* @private
* @name clear
* @memberOf MapCache
*/
function mapCacheClear() {
this.__data__ = {
'hash': new Hash,
'map': new (Map$1 || ListCache),
'string': new Hash
};
}
/**
* Removes `key` and its value from the map.
*
* @private
* @name delete
* @memberOf MapCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function mapCacheDelete(key) {
return getMapData(this, key)['delete'](key);
}
/**
* Gets the map value for `key`.
*
* @private
* @name get
* @memberOf MapCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}
/**
* Checks if a map value for `key` exists.
*
* @private
* @name has
* @memberOf MapCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}
/**
* Sets the map `key` to `value`.
*
* @private
* @name set
* @memberOf MapCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the map cache instance.
*/
function mapCacheSet(key, value) {
getMapData(this, key).set(key, value);
return this;
}
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
/**
* The base implementation of `_.get` without support for default values.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path) {
path = isKey(path, object) ? [path] : castPath(path);
var index = 0,
length = path.length;
while (object != null && index < length) {
object = object[toKey(path[index++])];
}
return (index && index == length) ? object : undefined;
}
/**
* The base implementation of `_.isNative` without bad shim checks.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function,
* else `false`.
*/
function baseIsNative(value) {
if (!isObject(value) || isMasked(value)) {
return false;
}
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
/**
* The base implementation of `_.toString` which doesn't convert nullish
* values to empty strings.
*
* @private
* @param {*} value The value to process.
* @returns {string} Returns the string.
*/
function baseToString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
}
if (isSymbol(value)) {
return symbolToString ? symbolToString.call(value) : '';
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
/**
* Casts `value` to a path array if it's not one.
*
* @private
* @param {*} value The value to inspect.
* @returns {Array} Returns the cast property path array.
*/
function castPath(value) {
return isArray(value) ? value : stringToPath(value);
}
/**
* Gets the data for `map`.
*
* @private
* @param {Object} map The map to query.
* @param {string} key The reference key.
* @returns {*} Returns the map data.
*/
function getMapData(map, key) {
var data = map.__data__;
return isKeyable(key)
? data[typeof key == 'string' ? 'string' : 'hash']
: data.map;
}
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = getValue(object, key);
return baseIsNative(value) ? value : undefined;
}
/**
* Checks if `value` is a property name and not a property path.
*
* @private
* @param {*} value The value to check.
* @param {Object} [object] The object to query keys on.
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
*/
function isKey(value, object) {
if (isArray(value)) {
return false;
}
var type = typeof value;
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
value == null || isSymbol(value)) {
return true;
}
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
(object != null && value in Object(object));
}
/**
* Checks if `value` is suitable for use as unique object key.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
*/
function isKeyable(value) {
var type = typeof value;
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
? (value !== '__proto__')
: (value === null);
}
/**
* Checks if `func` has its source masked.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
*/
function isMasked(func) {
return !!maskSrcKey && (maskSrcKey in func);
}
/**
* Converts `string` to a property path array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the property path array.
*/
var stringToPath = memoize(function(string) {
string = toString$2(string);
var result = [];
if (reLeadingDot.test(string)) {
result.push('');
}
string.replace(rePropName, function(match, number, quote, string) {
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
});
return result;
});
/**
* Converts `value` to a string key if it's not a string or symbol.
*
* @private
* @param {*} value The value to inspect.
* @returns {string|symbol} Returns the key.
*/
function toKey(value) {
if (typeof value == 'string' || isSymbol(value)) {
return value;
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to process.
* @returns {string} Returns the source code.
*/
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {}
try {
return (func + '');
} catch (e) {}
}
return '';
}
/**
* Creates a function that memoizes the result of `func`. If `resolver` is
* provided, it determines the cache key for storing the result based on the
* arguments provided to the memoized function. By default, the first argument
* provided to the memoized function is used as the map cache key. The `func`
* is invoked with the `this` binding of the memoized function.
*
* **Note:** The cache is exposed as the `cache` property on the memoized
* function. Its creation may be customized by replacing the `_.memoize.Cache`
* constructor with one whose instances implement the
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
* method interface of `delete`, `get`, `has`, and `set`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to have its output memoized.
* @param {Function} [resolver] The function to resolve the cache key.
* @returns {Function} Returns the new memoized function.
* @example
*
* var object = { 'a': 1, 'b': 2 };
* var other = { 'c': 3, 'd': 4 };
*
* var values = _.memoize(_.values);
* values(object);
* // => [1, 2]
*
* values(other);
* // => [3, 4]
*
* object.a = 2;
* values(object);
* // => [1, 2]
*
* // Modify the result cache.
* values.cache.set(object, ['a', 'b']);
* values(object);
* // => ['a', 'b']
*
* // Replace `_.memoize.Cache`.
* _.memoize.Cache = WeakMap;
*/
function memoize(func, resolver) {
if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
throw new TypeError(FUNC_ERROR_TEXT);
}
var memoized = function() {
var args = arguments,
key = resolver ? resolver.apply(this, args) : args[0],
cache = memoized.cache;
if (cache.has(key)) {
return cache.get(key);
}
var result = func.apply(this, args);
memoized.cache = cache.set(key, result);
return result;
};
memoized.cache = new (memoize.Cache || MapCache);
return memoized;
}
// Assign cache to `_.memoize`.
memoize.Cache = MapCache;
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq(value, other) {
return value === other || (value !== value && other !== other);
}
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 8-9 which returns 'object' for typed array and other constructors.
var tag = isObject(value) ? objectToString.call(value) : '';
return tag == funcTag || tag == genTag;
}
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
(isObjectLike(value) && objectToString.call(value) == symbolTag);
}
/**
* Converts `value` to a string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {string} Returns the string.
* @example
*
* _.toString(null);
* // => ''
*
* _.toString(-0);
* // => '-0'
*
* _.toString([1, 2, 3]);
* // => '1,2,3'
*/
function toString$2(value) {
return value == null ? '' : baseToString(value);
}
/**
* Gets the value at `path` of `object`. If the resolved value is
* `undefined`, the `defaultValue` is returned in its place.
*
* @static
* @memberOf _
* @since 3.7.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
* @returns {*} Returns the resolved value.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
*
* _.get(object, 'a[0].b.c');
* // => 3
*
* _.get(object, ['a', '0', 'b', 'c']);
* // => 3
*
* _.get(object, 'a.b.c', 'default');
* // => 'default'
*/
function get$2(object, path, defaultValue) {
var result = object == null ? undefined : baseGet(object, path);
return result === undefined ? defaultValue : result;
}
var lodash_get = get$2;
var Errors$1 = {
INVALID_TYPE: "Expected type {0} but found type {1}",
INVALID_FORMAT: "Object didn't pass validation for format {0}: {1}",
ENUM_MISMATCH: "No enum match for: {0}",
ENUM_CASE_MISMATCH: "Enum does not match case for: {0}",
ANY_OF_MISSING: "Data does not match any schemas from 'anyOf'",
ONE_OF_MISSING: "Data does not match any schemas from 'oneOf'",
ONE_OF_MULTIPLE: "Data is valid against more than one schema from 'oneOf'",
NOT_PASSED: "Data matches schema from 'not'",
// Array errors
ARRAY_LENGTH_SHORT: "Array is too short ({0}), minimum {1}",
ARRAY_LENGTH_LONG: "Array is too long ({0}), maximum {1}",
ARRAY_UNIQUE: "Array items are not unique (indexes {0} and {1})",
ARRAY_ADDITIONAL_ITEMS: "Additional items not allowed",
// Numeric errors
MULTIPLE_OF: "Value {0} is not a multiple of {1}",
MINIMUM: "Value {0} is less than minimum {1}",
MINIMUM_EXCLUSIVE: "Value {0} is equal or less than exclusive minimum {1}",
MAXIMUM: "Value {0} is greater than maximum {1}",
MAXIMUM_EXCLUSIVE: "Value {0} is equal or greater than exclusive maximum {1}",
// Object errors
OBJECT_PROPERTIES_MINIMUM: "Too few properties defined ({0}), minimum {1}",
OBJECT_PROPERTIES_MAXIMUM: "Too many properties defined ({0}), maximum {1}",
OBJECT_MISSING_REQUIRED_PROPERTY: "Missing required property: {0}",
OBJECT_ADDITIONAL_PROPERTIES: "Additional properties not allowed: {0}",
OBJECT_DEPENDENCY_KEY: "Dependency failed - key must exist: {0} (due to key: {1})",
// String errors
MIN_LENGTH: "String is too short ({0} chars), minimum {1}",
MAX_LENGTH: "String is too long ({0} chars), maximum {1}",
PATTERN: "String does not match pattern {0}: {1}",
// Schema validation errors
KEYWORD_TYPE_EXPECTED: "Keyword '{0}' is expected to be of type '{1}'",
KEYWORD_UNDEFINED_STRICT: "Keyword '{0}' must be defined in strict mode",
KEYWORD_UNEXPECTED: "Keyword '{0}' is not expected to appear in the schema",
KEYWORD_MUST_BE: "Keyword '{0}' must be {1}",
KEYWORD_DEPENDENCY: "Keyword '{0}' requires keyword '{1}'",
KEYWORD_PATTERN: "Keyword '{0}' is not a valid RegExp pattern: {1}",
KEYWORD_VALUE_TYPE: "Each element of keyword '{0}' array must be a '{1}'",
UNKNOWN_FORMAT: "There is no validation function for format '{0}'",
CUSTOM_MODE_FORCE_PROPERTIES: "{0} must define at least one property if present",
// Remote errors
REF_UNRESOLVED: "Reference has not been resolved during compilation: {0}",
UNRESOLVABLE_REFERENCE: "Reference could not be resolved: {0}",
SCHEMA_NOT_REACHABLE: "Validator was not able to read schema with uri: {0}",
SCHEMA_TYPE_EXPECTED: "Schema is expected to be of type 'object'",
SCHEMA_NOT_AN_OBJECT: "Schema is not an object: {0}",
ASYNC_TIMEOUT: "{0} asynchronous task(s) have timed out after {1} ms",
PARENT_SCHEMA_VALIDATION_FAILED: "Schema failed to validate against its parent schema, see inner errors for details.",
REMOTE_NOT_VALID: "Remote reference didn't compile successfully: {0}"
};
var Utils$2 = {};
(function (exports) {
exports.jsonSymbol = Symbol.for("z-schema/json");
exports.schemaSymbol = Symbol.for("z-schema/schema");
/**
* @param {object} obj
*
* @returns {string[]}
*/
var sortedKeys = exports.sortedKeys = function (obj) {
return Object.keys(obj).sort();
};
/**
*
* @param {string} uri
*
* @returns {boolean}
*/
exports.isAbsoluteUri = function (uri) {
return /^https?:\/\//.test(uri);
};
/**
*
* @param {string} uri
*
* @returns {boolean}
*/
exports.isRelativeUri = function (uri) {
// relative URIs that end with a hash sign, issue #56
return /.+#/.test(uri);
};
exports.whatIs = function (what) {
var to = typeof what;
if (to === "object") {
if (what === null) {
return "null";
}
if (Array.isArray(what)) {
return "array";
}
return "object"; // typeof what === 'object' && what === Object(what) && !Array.isArray(what);
}
if (to === "number") {
if (Number.isFinite(what)) {
if (what % 1 === 0) {
return "integer";
} else {
return "number";
}
}
if (Number.isNaN(what)) {
return "not-a-number";
}
return "unknown-number";
}
return to; // undefined, boolean, string, function
};
/**
*
* @param {*} json1
* @param {*} json2
* @param {*} [options]
*
* @returns {boolean}
*/
exports.areEqual = function areEqual(json1, json2, options) {
options = options || {};
var caseInsensitiveComparison = options.caseInsensitiveComparison || false;
// http://json-schema.org/latest/json-schema-core.html#rfc.section.3.6
// Two JSON values are said to be equal if and only if:
// both are nulls; or
// both are booleans, and have the same value; or
// both are strings, and have the same value; or
// both are numbers, and have the same mathematical value; or
if (json1 === json2) {
return true;
}
if (
caseInsensitiveComparison === true &&
typeof json1 === "string" && typeof json2 === "string" &&
json1.toUpperCase() === json2.toUpperCase()) {
return true;
}
var i, len;
// both are arrays, and:
if (Array.isArray(json1) && Array.isArray(json2)) {
// have the same number of items; and
if (json1.length !== json2.length) {
return false;
}
// items at the same index are equal according to this definition; or
len = json1.length;
for (i = 0; i < len; i++) {
if (!areEqual(json1[i], json2[i], { caseInsensitiveComparison: caseInsensitiveComparison })) {
return false;
}
}
return true;
}
// both are objects, and:
if (exports.whatIs(json1) === "object" && exports.whatIs(json2) === "object") {
// have the same set of property names; and
var keys1 = sortedKeys(json1);
var keys2 = sortedKeys(json2);
if (!areEqual(keys1, keys2, { caseInsensitiveComparison: caseInsensitiveComparison })) {
return false;
}
// values for a same property name are equal according to this definition.
len = keys1.length;
for (i = 0; i < len; i++) {
if (!areEqual(json1[keys1[i]], json2[keys1[i]], { caseInsensitiveComparison: caseInsensitiveComparison })) {
return false;
}
}
return true;
}
return false;
};
/**
*
* @param {*[]} arr
* @param {number[]} [indexes]
*
* @returns {boolean}
*/
exports.isUniqueArray = function (arr, indexes) {
var i, j, l = arr.length;
for (i = 0; i < l; i++) {
for (j = i + 1; j < l; j++) {
if (exports.areEqual(arr[i], arr[j])) {
if (indexes) { indexes.push(i, j); }
return false;
}
}
}
return true;
};
/**
*
* @param {*} bigSet
* @param {*} subSet
*
* @returns {*[]}
*/
exports.difference = function (bigSet, subSet) {
var arr = [],
idx = bigSet.length;
while (idx--) {
if (subSet.indexOf(bigSet[idx]) === -1) {
arr.push(bigSet[idx]);
}
}
return arr;
};
// NOT a deep version of clone
exports.clone = function (src) {
if (typeof src === "undefined") { return void 0; }
if (typeof src !== "object" || src === null) { return src; }
var res, idx;
if (Array.isArray(src)) {
res = [];
idx = src.length;
while (idx--) {
res[idx] = src[idx];
}
} else {
res = {};
var keys = Object.keys(src);
idx = keys.length;
while (idx--) {
var key = keys[idx];
res[key] = src[key];
}
}
return res;
};
exports.cloneDeep = function (src) {
var vidx = 0, visited = new Map(), cloned = [];
function cloneDeep(src) {
if (typeof src !== "object" || src === null) { return src; }
var res, idx, cidx;
cidx = visited.get(src);
if (cidx !== undefined) { return cloned[cidx]; }
visited.set(src, vidx++);
if (Array.isArray(src)) {
res = [];
cloned.push(res);
idx = src.length;
while (idx--) {
res[idx] = cloneDeep(src[idx]);
}
} else {
res = {};
cloned.push(res);
var keys = Object.keys(src);
idx = keys.length;
while (idx--) {
var key = keys[idx];
res[key] = cloneDeep(src[key]);
}
}
return res;
}
return cloneDeep(src);
};
/*
following function comes from punycode.js library
see: https://github.com/bestiejs/punycode.js
*/
/*jshint -W016*/
/**
* Creates an array containing the numeric code points of each Unicode
* character in the string. While JavaScript uses UCS-2 internally,
* this function will convert a pair of surrogate halves (each of which
* UCS-2 exposes as separate characters) into a single code point,
* matching UTF-16.
* @see `punycode.ucs2.encode`
* @see <https://mathiasbynens.be/notes/javascript-encoding>
* @memberOf punycode.ucs2
* @name decode
* @param {String} string The Unicode input string (UCS-2).
* @returns {Array} The new array of code points.
*/
exports.ucs2decode = function (string) {
var output = [],
counter = 0,
length = string.length,
value,
extra;
while (counter < length) {
value = string.charCodeAt(counter++);
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
// high surrogate, and there is a next character
extra = string.charCodeAt(counter++);
if ((extra & 0xFC00) == 0xDC00) { // low surrogate
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
} else {
// unmatched surrogate; only append this code unit, in case the next
// code unit is the high surrogate of a surrogate pair
output.push(value);
counter--;
}
} else {
output.push(value);
}
}
return output;
};
/*jshint +W016*/
} (Utils$2));
var get$1 = lodash_get;
var Errors = Errors$1;
var Utils$1 = Utils$2;
/**
* @class
*
* @param {Report|object} parentOrOptions
* @param {object} [reportOptions]
*/
function Report$1(parentOrOptions, reportOptions) {
this.parentReport = parentOrOptions instanceof Report$1 ?
parentOrOptions :
undefined;
this.options = parentOrOptions instanceof Report$1 ?
parentOrOptions.options :
parentOrOptions || {};
this.reportOptions = reportOptions || {};
this.errors = [];
/**
* @type {string[]}
*/
this.path = [];
this.asyncTasks = [];
this.rootSchema = undefined;
this.commonErrorMessage = undefined;
this.json = undefined;
}
/**
* @returns {boolean}
*/
Report$1.prototype.isValid = function () {
if (this.asyncTasks.length > 0) {
throw new Error("Async tasks pending, can't answer isValid");
}
return this.errors.length === 0;
};
/**
*
* @param {*} fn
* @param {*} args
* @param {*} asyncTaskResultProcessFn
*/
Report$1.prototype.addAsyncTask = function (fn, args, asyncTaskResultProcessFn) {
this.asyncTasks.push([fn, args, asyncTaskResultProcessFn]);
};
Report$1.prototype.getAncestor = function (id) {
if (!this.parentReport) {
return undefined;
}
if (this.parentReport.getSchemaId() === id) {
return this.parentReport;
}
return this.parentReport.getAncestor(id);
};
/**
*
* @param {*} timeout
* @param {function(*, *)} callback
*
* @returns {void}
*/
Report$1.prototype.processAsyncTasks = function (timeout, callback) {
var validationTimeout = timeout || 2000,
tasksCount = this.asyncTasks.length,
idx = tasksCount,
timedOut = false,
self = this;
function finish() {
process.nextTick(function () {
var valid = self.errors.length === 0,
err = valid ? null : self.errors;
callback(err, valid);
});
}
function respond(asyncTaskResultProcessFn) {
return function (asyncTaskResult) {
if (timedOut) { return; }
asyncTaskResultProcessFn(asyncTaskResult);
if (--tasksCount === 0) {
finish();
}
};
}
// finish if tasks are completed or there are any errors and breaking on first error was requested
if (tasksCount === 0 || (this.errors.length > 0 && this.options.breakOnFirstError)) {
finish();
return;
}
while (idx--) {
var task = this.asyncTasks[idx];
task[0].apply(null, task[1].concat(respond(task[2])));
}
setTimeout(function () {
if (tasksCount > 0) {
timedOut = true;
self.addError("ASYNC_TIMEOUT", [tasksCount, validationTimeout]);
callback(self.errors, false);
}
}, validationTimeout);
};
/**
*
* @param {*} returnPathAsString
*
* @return {string[]|string}
*/
Report$1.prototype.getPath = function (returnPathAsString) {
/**
* @type {string[]|string}
*/
var path = [];
if (this.parentReport) {
path = path.concat(this.parentReport.path);
}
path = path.concat(this.path);
if (returnPathAsString !== true) {
// Sanitize the path segments (http://tools.ietf.org/html/rfc6901#section-4)
path = "#/" + path.map(function (segment) {
segment = segment.toString();
if (Utils$1.isAbsoluteUri(segment)) {
return "uri(" + segment + ")";
}
return segment.replace(/\~/g, "~0").replace(/\//g, "~1");
}).join("/");
}
return path;
};
Report$1.prototype.getSchemaId = function () {
if (!this.rootSchema) {
return null;
}
// get the error path as an array
var path = [];
if (this.parentReport) {
path = path.concat(this.parentReport.path);
}
path = path.concat(this.path);
// try to find id in the error path
while (path.length > 0) {
var obj = get$1(this.rootSchema, path);
if (obj && obj.id) { return obj.id; }
path.pop();
}
// return id of the root
return this.rootSchema.id;
};
/**
*
* @param {*} errorCode
* @param {*} params
*
* @return {boolean}
*/
Report$1.prototype.hasError = function (errorCode, params) {
var idx = this.errors.length;
while (idx--) {
if (this.errors[idx].code === errorCode) {
// assume match
var match = true;
// check the params too
var idx2 = this.errors[idx].params.length;
while (idx2--) {
if (this.errors[idx].params[idx2] !== params[idx2]) {
match = false;
}
}
// if match, return true
if (match) { return match; }
}
}
return false;
};
/**
*
* @param {*} errorCode
* @param {*} params
* @param {Report[]|Report} [subReports]
* @param {*} [schema]
*
* @return {void}
*/
Report$1.prototype.addError = function (errorCode, params, subReports, schema) {
if (!errorCode) { throw new Error("No errorCode passed into addError()"); }
this.addCustomError(errorCode, Errors[errorCode], params, subReports, schema);
};
Report$1.prototype.getJson = function () {
var self = this;
while (self.json === undefined) {
self = self.parentReport;
if (self === undefined) {
return undefined;
}
}
return self.json;
};
/**
*
* @param {*} errorCode
* @param {*} errorMessage
* @param {*[]} params
* @param {Report[]|Report} subReports
* @param {*} schema
*
* @returns {void}
*/
Report$1.prototype.addCustomError = function (errorCode, errorMessage, params, subReports, schema) {
if (this.errors.length >= this.reportOptions.maxErrors) {
return;
}
if (!errorMessage) { throw new Error("No errorMessage known for code " + errorCode); }
params = params || [];
var idx = params.length;
while (idx--) {
var whatIs = Utils$1.whatIs(params[idx]);
var param = (whatIs === "object" || whatIs === "null") ? JSON.stringify(params[idx]) : params[idx];
errorMessage = errorMessage.replace("{" + idx + "}", param);
}
var err = {
code: errorCode,
params: params,
message: errorMessage,
path: this.getPath(this.options.reportPathAsArray),
schemaId: this.getSchemaId()
};
err[Utils$1.schemaSymbol] = schema;
err[Utils$1.jsonSymbol] = this.getJson();
if (schema && typeof schema === "string") {
err.description = schema;
} else if (schema && typeof schema === "object") {
if (schema.title) {
err.title = schema.title;
}
if (schema.description) {
err.description = schema.description;
}
}
if (subReports != null) {
if (!Array.isArray(subReports)) {
subReports = [subReports];
}
err.inner = [];
idx = subReports.length;
while (idx--) {
var subReport = subReports[idx],
idx2 = subReport.errors.length;
while (idx2--) {
err.inner.push(subReport.errors[idx2]);
}
}
if (err.inner.length === 0) {
err.inner = undefined;
}
}
this.errors.push(err);
};
var Report_1 = Report$1;
var validator$1 = {exports: {}};
var toDate = {exports: {}};
var assertString = {exports: {}};
assertString.exports;
(function (module, exports) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = assertString;
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function assertString(input) {
var isString = typeof input === 'string' || input instanceof String;
if (!isString) {
var invalidType = _typeof(input);
if (input === null) invalidType = 'null';else if (invalidType === 'object') invalidType = input.constructor.name;
throw new TypeError("Expected a string but received a ".concat(invalidType));
}
}
module.exports = exports.default;
module.exports.default = exports.default;
} (assertString, assertString.exports));
var assertStringExports = assertString.exports;
toDate.exports;
(function (module, exports) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = toDate;
var _assertString = _interopRequireDefault(assertStringExports);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function toDate(date) {
(0, _assertString.default)(date);
date = Date.parse(date);
return !isNaN(date) ? new Date(date) : null;
}
module.exports = exports.default;
module.exports.default = exports.default;
} (toDate, toDate.exports));
var toDateExports = toDate.exports;
var toFloat = {exports: {}};
var isFloat$1 = {};
var alpha$1 = {};
Object.defineProperty(alpha$1, "__esModule", {
value: true
});
alpha$1.commaDecimal = alpha$1.dotDecimal = alpha$1.bengaliLocales = alpha$1.farsiLocales = alpha$1.arabicLocales = alpha$1.englishLocales = alpha$1.decimal = alpha$1.alphanumeric = alpha$1.alpha = void 0;
var alpha = {
'en-US': /^[A-Z]+$/i,
'az-AZ': /^[A-VXYZÇƏĞİıÖŞÜ]+$/i,
'bg-BG': /^[А-Я]+$/i,
'cs-CZ': /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
'da-DK': /^[A-ZÆØÅ]+$/i,
'de-DE': /^[A-ZÄÖÜß]+$/i,
'el-GR': /^[Α-ώ]+$/i,
'es-ES': /^[A-ZÁÉÍÑÓÚÜ]+$/i,
'fa-IR': /^[ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهی]+$/i,
'fi-FI': /^[A-ZÅÄÖ]+$/i,
'fr-FR': /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,
'it-IT': /^[A-ZÀÉÈÌÎÓÒÙ]+$/i,
'ja-JP': /^[ぁ-んァ-ヶヲ-゚一-龠ー・。、]+$/i,
'nb-NO': /^[A-ZÆØÅ]+$/i,
'nl-NL': /^[A-ZÁÉËÏÓÖÜÚ]+$/i,
'nn-NO': /^[A-ZÆØÅ]+$/i,
'hu-HU': /^[A-ZÁÉÍÓÖŐÚÜŰ]+$/i,
'pl-PL': /^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i,
'pt-PT': /^[A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,
'ru-RU': /^[А-ЯЁ]+$/i,
'sl-SI': /^[A-ZČĆĐŠŽ]+$/i,
'sk-SK': /^[A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,
'sr-RS@latin': /^[A-ZČĆŽŠĐ]+$/i,
'sr-RS': /^[А-ЯЂЈЉЊЋЏ]+$/i,
'sv-SE': /^[A-ZÅÄÖ]+$/i,
'th-TH': /^[ก-๐\s]+$/i,
'tr-TR': /^[A-ZÇĞİıÖŞÜ]+$/i,
'uk-UA': /^[А-ЩЬЮЯЄIЇҐі]+$/i,
'vi-VN': /^[A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,
'ko-KR': /^[ㄱ-ㅎㅏ-ㅣ가-힣]*$/,
'ku-IQ': /^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,
he: /^[א-ת]+$/,
fa: /^['آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی']+$/i,
bn: /^['ঀঁংঃঅআইঈউঊঋঌএঐওঔকখগঘঙচছজঝঞটঠডঢণতথদধনপফবভমযরলশষসহ়ঽািীুূৃৄেৈোৌ্ৎৗড়ঢ়য়ৠৡৢৣৰৱ৲৳৴৵৶৷৸৹৺৻']+$/,
'hi-IN': /^[\u0900-\u0961]+[\u0972-\u097F]*$/i,
'si-LK': /^[\u0D80-\u0DFF]+$/
};
alpha$1.alpha = alpha;
var alphanumeric = {
'en-US': /^[0-9A-Z]+$/i,
'az-AZ': /^[0-9A-VXYZÇƏĞİıÖŞÜ]+$/i,
'bg-BG': /^[0-9А-Я]+$/i,
'cs-CZ': /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
'da-DK': /^[0-9A-ZÆØÅ]+$/i,
'de-DE': /^[0-9A-ZÄÖÜß]+$/i,
'el-GR': /^[0-9Α-ω]+$/i,
'es-ES': /^[0-9A-ZÁÉÍÑÓÚÜ]+$/i,
'fi-FI': /^[0-9A-ZÅÄÖ]+$/i,
'fr-FR': /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,
'it-IT': /^[0-9A-ZÀÉÈÌÎÓÒÙ]+$/i,
'ja-JP': /^[0-90-9ぁ-んァ-ヶヲ-゚一-龠ー・。、]+$/i,
'hu-HU': /^[0-9A-ZÁÉÍÓÖŐÚÜŰ]+$/i,
'nb-NO': /^[0-9A-ZÆØÅ]+$/i,
'nl-NL': /^[0-9A-ZÁÉËÏÓÖÜÚ]+$/i,
'nn-NO': /^[0-9A-ZÆØÅ]+$/i,
'pl-PL': /^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i,
'pt-PT': /^[0-9A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,
'ru-RU': /^[0-9А-ЯЁ]+$/i,
'sl-SI': /^[0-9A-ZČĆĐŠŽ]+$/i,
'sk-SK': /^[0-9A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,
'sr-RS@latin': /^[0-9A-ZČĆŽŠĐ]+$/i,
'sr-RS': /^[0-9А-ЯЂЈЉЊЋЏ]+$/i,
'sv-SE': /^[0-9A-ZÅÄÖ]+$/i,
'th-TH': /^[ก-๙\s]+$/i,
'tr-TR': /^[0-9A-ZÇĞİıÖŞÜ]+$/i,
'uk-UA': /^[0-9А-ЩЬЮЯЄIЇҐі]+$/i,
'ko-KR': /^[0-9ㄱ-ㅎㅏ-ㅣ가-힣]*$/,
'ku-IQ': /^[٠١٢٣٤٥٦٧٨٩0-9ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
'vi-VN': /^[0-9A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,
ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,
he: /^[0-9א-ת]+$/,
fa: /^['0-9آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی۱۲۳۴۵۶۷۸۹۰']+$/i,
bn: /^['ঀঁংঃঅআইঈউঊঋঌএঐওঔকখগঘঙচছজঝঞটঠডঢণতথদধনপফবভমযরলশষসহ়ঽািীুূৃৄেৈোৌ্ৎৗড়ঢ়য়ৠৡৢৣ০১২৩৪৫৬৭৮৯ৰৱ৲৳৴৵৶৷৸৹৺৻']+$/,
'hi-IN': /^[\u0900-\u0963]+[\u0966-\u097F]*$/i,
'si-LK': /^[0-9\u0D80-\u0DFF]+$/
};
alpha$1.alphanumeric = alphanumeric;
var decimal = {
'en-US': '.',
ar: '٫'
};
alpha$1.decimal = decimal;
var englishLocales = ['AU', 'GB', 'HK', 'IN', 'NZ', 'ZA', 'ZM'];
alpha$1.englishLocales = englishLocales;
for (var locale, i = 0; i < englishLocales.length; i++) {
locale = "en-".concat(englishLocales[i]);
alpha[locale] = alpha['en-US'];
alphanumeric[locale] = alphanumeric['en-US'];
decimal[locale] = decimal['en-US'];
} // Source: http://www.localeplanet.com/java/
var arabicLocales = ['AE', 'BH', 'DZ', 'EG', 'IQ', 'JO', 'KW', 'LB', 'LY', 'MA', 'QM', 'QA', 'SA', 'SD', 'SY', 'TN', 'YE'];
alpha$1.arabicLocales = arabicLocales;
for (var _locale, _i = 0; _i < arabicLocales.length; _i++) {
_locale = "ar-".concat(arabicLocales[_i]);
alpha[_locale] = alpha.ar;
alphanumeric[_locale] = alphanumeric.ar;
decimal[_locale] = decimal.ar;
}
var farsiLocales = ['IR', 'AF'];
alpha$1.farsiLocales = farsiLocales;
for (var _locale2, _i2 = 0; _i2 < farsiLocales.length; _i2++) {
_locale2 = "fa-".concat(farsiLocales[_i2]);
alphanumeric[_locale2] = alphanumeric.fa;
decimal[_locale2] = decimal.ar;
}
var bengaliLocales = ['BD', 'IN'];
alpha$1.bengaliLocales = bengaliLocales;
for (var _locale3, _i3 = 0; _i3 < bengaliLocales.length; _i3++) {
_locale3 = "bn-".concat(bengaliLocales[_i3]);
alpha[_locale3] = alpha.bn;
alphanumeric[_locale3] = alphanumeric.bn;
decimal[_locale3] = decimal['en-US'];
} // Source: https://en.wikipedia.org/wiki/Decimal_mark
var dotDecimal = ['ar-EG', 'ar-LB', 'ar