{"version":3,"sources":["../../../src/util.ts","../../../src/rule/required.ts","../../../src/rule/whitespace.ts","../../../src/rule/url.ts","../../../src/rule/type.ts","../../../src/rule/range.ts","../../../src/rule/enum.ts","../../../src/rule/pattern.ts","../../../src/rule/index.ts","../../../src/validator/string.ts","../../../src/validator/method.ts","../../../src/validator/number.ts","../../../src/validator/boolean.ts","../../../src/validator/regexp.ts","../../../src/validator/integer.ts","../../../src/validator/float.ts","../../../src/validator/array.ts","../../../src/validator/object.ts","../../../src/validator/enum.ts","../../../src/validator/pattern.ts","../../../src/validator/date.ts","../../../src/validator/required.ts","../../../src/validator/type.ts","../../../src/validator/any.ts","../../../src/validator/index.ts","../../../src/messages.ts","../../../src/index.ts"],"names":["formatRegExp","warning","process","console","errors","fields","field","error","args","i","len","template","str","x","String","Number","JSON","type","value","Array","isNativeStringType","results","total","arrLength","arr","callback","func","index","original","next","ret","Object","objArr","AsyncValidationError","option","pending","reject","convertFieldsError","resolve","flattenArr","flattenObjArr","asyncSerialArray","firstFields","objArrKeys","objArrLength","asyncParallelArray","obj","v","path","rule","fieldValue","getValue","source","oe","isErrorObj","message","fullField","target","required","isEmptyValue","format","options","whitespace","word","b","v4","v6seg","v6","v46Exact","v4exact","v6exact","ip","protocol","auth","ipv4","ipv6","host","domain","tld","port","regex","urlReg","pattern","email","hex","types","integer","parseInt","array","regexp","date","isNaN","number","object","method","url","getUrlRegex","custom","ruleType","range","min","max","spRegexp","val","key","num","ENUM","enumerable","_pattern","string","validate","rules","boolean","floatFn","dateObject","any","parse","invalid","mismatch","clone","cloned","messages","newMessages","Schema","_messages","defaultMessages","define","item","deepMerge","source_","o","oc","Promise","add","series","keys","validator","z","errorFields","asyncMap","data","deep","fullFields","e","errorList","filledErrors","complementError","doIt","fieldsSchema","paredFieldsSchema","fieldSchema","fieldSchemaList","addFullField","schema","finalErrors","errs","res","setTimeout","cb","complete","getType","validators","getValidationMethod","messageIndex","register"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;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AMoI,YAAY,GAAG5B,IAAI,CAAJA,QAArB,SAAqBA,CAArB;;IACA,IAAI4B,YAAY,KAAK,CAArB,GAAyB;MACvB5B,IAAI,CAAJA;IACD;;IACD,IAAIA,IAAI,CAAJA,gBAAqBA,IAAI,CAAJA,CAAI,CAAJA,KAAzB,YAAiD;MAC/C,OAAO0B,UAAU,CAAjB;IACD;;IACD,OAAOA,UAAU,CAAC,aAAXA,IAAW,CAAD,CAAVA,IAAP;;;;CA5TEtC,E;;AAAAA,OAEGyC,QAFHzC,GAEc,mCAA2C;EAC3D,IAAI,qBAAJ,YAAqC;IACnC,MAAM,UAAN,kEAAM,CAAN;EAGD;;EACDsC,UAAU,CAAVA,IAAU,CAAVA;AACD,CATGtC;;AAAAA,OAWG1H,OAXH0H,GAWa1H,OAXb0H;AAAAA,OAaGF,QAbHE,GAacE,QAbdF;AAAAA,OAeGsC,UAfHtC,GAegBsC,UAfhBtC","file":"static/js/vendors~main~33421299.4396a250.chunk.js","sourcesContent":["/* eslint no-console:0 */\n\nimport {\n ValidateError,\n ValidateOption,\n RuleValuePackage,\n InternalRuleItem,\n SyncErrorType,\n RuleType,\n Value,\n Values,\n} from './interface';\n\nconst formatRegExp = /%[sdj%]/g;\n\ndeclare var ASYNC_VALIDATOR_NO_WARNING;\n\nexport let warning: (type: string, errors: SyncErrorType[]) => void = () => {};\n\n// don't print warning message when in production env or node runtime\nif (\n typeof process !== 'undefined' &&\n process.env &&\n process.env.NODE_ENV !== 'production' &&\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n) {\n warning = (type, errors) => {\n if (\n typeof console !== 'undefined' &&\n console.warn &&\n typeof ASYNC_VALIDATOR_NO_WARNING === 'undefined'\n ) {\n if (errors.every(e => typeof e === 'string')) {\n console.warn(type, errors);\n }\n }\n };\n}\n\nexport function convertFieldsError(\n errors: ValidateError[],\n): Record {\n if (!errors || !errors.length) return null;\n const fields = {};\n errors.forEach(error => {\n const field = error.field;\n fields[field] = fields[field] || [];\n fields[field].push(error);\n });\n return fields;\n}\n\nexport function format(\n template: ((...args: any[]) => string) | string,\n ...args: any[]\n): string {\n let i = 0;\n const len = args.length;\n if (typeof template === 'function') {\n return template.apply(null, args);\n }\n if (typeof template === 'string') {\n let str = template.replace(formatRegExp, x => {\n if (x === '%%') {\n return '%';\n }\n if (i >= len) {\n return x;\n }\n switch (x) {\n case '%s':\n return String(args[i++]);\n case '%d':\n return (Number(args[i++]) as unknown) as string;\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n break;\n default:\n return x;\n }\n });\n return str;\n }\n return template;\n}\n\nfunction isNativeStringType(type: string) {\n return (\n type === 'string' ||\n type === 'url' ||\n type === 'hex' ||\n type === 'email' ||\n type === 'date' ||\n type === 'pattern'\n );\n}\n\nexport function isEmptyValue(value: Value, type?: string) {\n if (value === undefined || value === null) {\n return true;\n }\n if (type === 'array' && Array.isArray(value) && !value.length) {\n return true;\n }\n if (isNativeStringType(type) && typeof value === 'string' && !value) {\n return true;\n }\n return false;\n}\n\nexport function isEmptyObject(obj: object) {\n return Object.keys(obj).length === 0;\n}\n\nfunction asyncParallelArray(\n arr: RuleValuePackage[],\n func: ValidateFunc,\n callback: (errors: ValidateError[]) => void,\n) {\n const results: ValidateError[] = [];\n let total = 0;\n const arrLength = arr.length;\n\n function count(errors: ValidateError[]) {\n results.push(...(errors || []));\n total++;\n if (total === arrLength) {\n callback(results);\n }\n }\n\n arr.forEach(a => {\n func(a, count);\n });\n}\n\nfunction asyncSerialArray(\n arr: RuleValuePackage[],\n func: ValidateFunc,\n callback: (errors: ValidateError[]) => void,\n) {\n let index = 0;\n const arrLength = arr.length;\n\n function next(errors: ValidateError[]) {\n if (errors && errors.length) {\n callback(errors);\n return;\n }\n const original = index;\n index = index + 1;\n if (original < arrLength) {\n func(arr[original], next);\n } else {\n callback([]);\n }\n }\n\n next([]);\n}\n\nfunction flattenObjArr(objArr: Record) {\n const ret: RuleValuePackage[] = [];\n Object.keys(objArr).forEach(k => {\n ret.push(...(objArr[k] || []));\n });\n return ret;\n}\n\nexport class AsyncValidationError extends Error {\n errors: ValidateError[];\n fields: Record;\n\n constructor(\n errors: ValidateError[],\n fields: Record,\n ) {\n super('Async Validation Error');\n this.errors = errors;\n this.fields = fields;\n }\n}\n\ntype ValidateFunc = (\n data: RuleValuePackage,\n doIt: (errors: ValidateError[]) => void,\n) => void;\n\nexport function asyncMap(\n objArr: Record,\n option: ValidateOption,\n func: ValidateFunc,\n callback: (errors: ValidateError[]) => void,\n source: Values,\n): Promise {\n if (option.first) {\n const pending = new Promise((resolve, reject) => {\n const next = (errors: ValidateError[]) => {\n callback(errors);\n return errors.length\n ? reject(new AsyncValidationError(errors, convertFieldsError(errors)))\n : resolve(source);\n };\n const flattenArr = flattenObjArr(objArr);\n asyncSerialArray(flattenArr, func, next);\n });\n pending.catch(e => e);\n return pending;\n }\n const firstFields =\n option.firstFields === true\n ? Object.keys(objArr)\n : option.firstFields || [];\n\n const objArrKeys = Object.keys(objArr);\n const objArrLength = objArrKeys.length;\n let total = 0;\n const results: ValidateError[] = [];\n const pending = new Promise((resolve, reject) => {\n const next = (errors: ValidateError[]) => {\n results.push.apply(results, errors);\n total++;\n if (total === objArrLength) {\n callback(results);\n return results.length\n ? reject(\n new AsyncValidationError(results, convertFieldsError(results)),\n )\n : resolve(source);\n }\n };\n if (!objArrKeys.length) {\n callback(results);\n resolve(source);\n }\n objArrKeys.forEach(key => {\n const arr = objArr[key];\n if (firstFields.indexOf(key) !== -1) {\n asyncSerialArray(arr, func, next);\n } else {\n asyncParallelArray(arr, func, next);\n }\n });\n });\n pending.catch(e => e);\n return pending;\n}\n\nfunction isErrorObj(\n obj: ValidateError | string | (() => string),\n): obj is ValidateError {\n return !!(obj && (obj as ValidateError).message !== undefined);\n}\n\nfunction getValue(value: Values, path: string[]) {\n let v = value;\n for (let i = 0; i < path.length; i++) {\n if (v == undefined) {\n return v;\n }\n v = v[path[i]];\n }\n return v;\n}\n\nexport function complementError(rule: InternalRuleItem, source: Values) {\n return (oe: ValidateError | (() => string) | string): ValidateError => {\n let fieldValue;\n if (rule.fullFields) {\n fieldValue = getValue(source, rule.fullFields);\n } else {\n fieldValue = source[(oe as any).field || rule.fullField];\n }\n if (isErrorObj(oe)) {\n oe.field = oe.field || rule.fullField;\n oe.fieldValue = fieldValue;\n return oe;\n }\n return {\n message: typeof oe === 'function' ? oe() : oe,\n fieldValue,\n field: ((oe as unknown) as ValidateError).field || rule.fullField,\n };\n };\n}\n\nexport function deepMerge(target: T, source: Partial): T {\n if (source) {\n for (const s in source) {\n if (source.hasOwnProperty(s)) {\n const value = source[s];\n if (typeof value === 'object' && typeof target[s] === 'object') {\n target[s] = {\n ...target[s],\n ...value,\n };\n } else {\n target[s] = value;\n }\n }\n }\n }\n return target;\n}\n","import { ExecuteRule } from '../interface';\nimport { format, isEmptyValue } from '../util';\n\nconst required: ExecuteRule = (rule, value, source, errors, options, type) => {\n if (\n rule.required &&\n (!source.hasOwnProperty(rule.field) ||\n isEmptyValue(value, type || rule.type))\n ) {\n errors.push(format(options.messages.required, rule.fullField));\n }\n};\n\nexport default required;\n","import { ExecuteRule } from '../interface';\nimport { format } from '../util';\n\n/**\n * Rule for validating whitespace.\n *\n * @param rule The validation rule.\n * @param value The value of the field on the source object.\n * @param source The source object being validated.\n * @param errors An array of errors that this rule may add\n * validation errors to.\n * @param options The validation options.\n * @param options.messages The validation messages.\n */\nconst whitespace: ExecuteRule = (rule, value, source, errors, options) => {\n if (/^\\s+$/.test(value) || value === '') {\n errors.push(format(options.messages.whitespace, rule.fullField));\n }\n};\n\nexport default whitespace;\n","// https://github.com/kevva/url-regex/blob/master/index.js\nlet urlReg: RegExp;\n\nexport default () => {\n if (urlReg) {\n return urlReg;\n }\n\n const word = '[a-fA-F\\\\d:]';\n const b = options =>\n options && options.includeBoundaries\n ? `(?:(?<=\\\\s|^)(?=${word})|(?<=${word})(?=\\\\s|$))`\n : '';\n\n const v4 =\n '(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)(?:\\\\.(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)){3}';\n\n const v6seg = '[a-fA-F\\\\d]{1,4}';\n const v6 = `\n(?:\n(?:${v6seg}:){7}(?:${v6seg}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${v6seg}:){6}(?:${v4}|:${v6seg}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${v6seg}:){5}(?::${v4}|(?::${v6seg}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${v6seg}:){4}(?:(?::${v6seg}){0,1}:${v4}|(?::${v6seg}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${v6seg}:){3}(?:(?::${v6seg}){0,2}:${v4}|(?::${v6seg}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${v6seg}:){2}(?:(?::${v6seg}){0,3}:${v4}|(?::${v6seg}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${v6seg}:){1}(?:(?::${v6seg}){0,4}:${v4}|(?::${v6seg}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::${v6seg}){0,5}:${v4}|(?::${v6seg}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n`\n .replace(/\\s*\\/\\/.*$/gm, '')\n .replace(/\\n/g, '')\n .trim();\n\n // Pre-compile only the exact regexes because adding a global flag make regexes stateful\n const v46Exact = new RegExp(`(?:^${v4}$)|(?:^${v6}$)`);\n const v4exact = new RegExp(`^${v4}$`);\n const v6exact = new RegExp(`^${v6}$`);\n\n const ip = options =>\n options && options.exact\n ? v46Exact\n : new RegExp(\n `(?:${b(options)}${v4}${b(options)})|(?:${b(options)}${v6}${b(\n options,\n )})`,\n 'g',\n );\n\n ip.v4 = (options?) =>\n options && options.exact\n ? v4exact\n : new RegExp(`${b(options)}${v4}${b(options)}`, 'g');\n ip.v6 = (options?) =>\n options && options.exact\n ? v6exact\n : new RegExp(`${b(options)}${v6}${b(options)}`, 'g');\n\n const protocol = `(?:(?:[a-z]+:)?//)`;\n const auth = '(?:\\\\S+(?::\\\\S*)?@)?';\n const ipv4 = ip.v4().source;\n const ipv6 = ip.v6().source;\n const host = '(?:(?:[a-z\\\\u00a1-\\\\uffff0-9][-_]*)*[a-z\\\\u00a1-\\\\uffff0-9]+)';\n const domain =\n '(?:\\\\.(?:[a-z\\\\u00a1-\\\\uffff0-9]-*)*[a-z\\\\u00a1-\\\\uffff0-9]+)*';\n const tld = `(?:\\\\.(?:[a-z\\\\u00a1-\\\\uffff]{2,}))`;\n const port = '(?::\\\\d{2,5})?';\n const path = '(?:[/?#][^\\\\s\"]*)?';\n const regex = `(?:${protocol}|www\\\\.)${auth}(?:localhost|${ipv4}|${ipv6}|${host}${domain}${tld})${port}${path}`;\n urlReg = new RegExp(`(?:^${regex}$)`, 'i');\n return urlReg;\n};\n","import { ExecuteRule, Value } from '../interface';\nimport { format } from '../util';\nimport required from './required';\nimport getUrlRegex from './url';\n/* eslint max-len:0 */\n\nconst pattern = {\n // http://emailregex.com/\n email: /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+\\.)+[a-zA-Z\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]{2,}))$/,\n // url: new RegExp(\n // '^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\\\S+(?::\\\\S*)?@)?(?:(?:(?:[1-9]\\\\d?|1\\\\d\\\\d|2[01]\\\\d|22[0-3])(?:\\\\.(?:1?\\\\d{1,2}|2[0-4]\\\\d|25[0-5])){2}(?:\\\\.(?:[0-9]\\\\d?|1\\\\d\\\\d|2[0-4]\\\\d|25[0-4]))|(?:(?:[a-z\\\\u00a1-\\\\uffff0-9]+-*)*[a-z\\\\u00a1-\\\\uffff0-9]+)(?:\\\\.(?:[a-z\\\\u00a1-\\\\uffff0-9]+-*)*[a-z\\\\u00a1-\\\\uffff0-9]+)*(?:\\\\.(?:[a-z\\\\u00a1-\\\\uffff]{2,})))|localhost)(?::\\\\d{2,5})?(?:(/|\\\\?|#)[^\\\\s]*)?$',\n // 'i',\n // ),\n hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i,\n};\n\nconst types = {\n integer(value: Value) {\n return types.number(value) && parseInt(value, 10) === value;\n },\n float(value: Value) {\n return types.number(value) && !types.integer(value);\n },\n array(value: Value) {\n return Array.isArray(value);\n },\n regexp(value: Value) {\n if (value instanceof RegExp) {\n return true;\n }\n try {\n return !!new RegExp(value);\n } catch (e) {\n return false;\n }\n },\n date(value: Value) {\n return (\n typeof value.getTime === 'function' &&\n typeof value.getMonth === 'function' &&\n typeof value.getYear === 'function' &&\n !isNaN(value.getTime())\n );\n },\n number(value: Value) {\n if (isNaN(value)) {\n return false;\n }\n return typeof value === 'number';\n },\n object(value: Value) {\n return typeof value === 'object' && !types.array(value);\n },\n method(value: Value) {\n return typeof value === 'function';\n },\n email(value: Value) {\n return (\n typeof value === 'string' &&\n value.length <= 320 &&\n !!value.match(pattern.email)\n );\n },\n url(value: Value) {\n return (\n typeof value === 'string' &&\n value.length <= 2048 &&\n !!value.match(getUrlRegex())\n );\n },\n hex(value: Value) {\n return typeof value === 'string' && !!value.match(pattern.hex);\n },\n};\n\nconst type: ExecuteRule = (rule, value, source, errors, options) => {\n if (rule.required && value === undefined) {\n required(rule, value, source, errors, options);\n return;\n }\n const custom = [\n 'integer',\n 'float',\n 'array',\n 'regexp',\n 'object',\n 'method',\n 'email',\n 'number',\n 'date',\n 'url',\n 'hex',\n ];\n const ruleType = rule.type;\n if (custom.indexOf(ruleType) > -1) {\n if (!types[ruleType](value)) {\n errors.push(\n format(options.messages.types[ruleType], rule.fullField, rule.type),\n );\n }\n // straight typeof check\n } else if (ruleType && typeof value !== rule.type) {\n errors.push(\n format(options.messages.types[ruleType], rule.fullField, rule.type),\n );\n }\n};\n\nexport default type;\n","import { ExecuteRule } from '../interface';\nimport { format } from '../util';\n\nconst range: ExecuteRule = (rule, value, source, errors, options) => {\n const len = typeof rule.len === 'number';\n const min = typeof rule.min === 'number';\n const max = typeof rule.max === 'number';\n // 正则匹配码点范围从U+010000一直到U+10FFFF的文字(补充平面Supplementary Plane)\n const spRegexp = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g;\n let val = value;\n let key = null;\n const num = typeof value === 'number';\n const str = typeof value === 'string';\n const arr = Array.isArray(value);\n if (num) {\n key = 'number';\n } else if (str) {\n key = 'string';\n } else if (arr) {\n key = 'array';\n }\n // if the value is not of a supported type for range validation\n // the validation rule rule should use the\n // type property to also test for a particular type\n if (!key) {\n return false;\n }\n if (arr) {\n val = value.length;\n }\n if (str) {\n // 处理码点大于U+010000的文字length属性不准确的bug,如\"𠮷𠮷𠮷\".lenght !== 3\n val = value.replace(spRegexp, '_').length;\n }\n if (len) {\n if (val !== rule.len) {\n errors.push(format(options.messages[key].len, rule.fullField, rule.len));\n }\n } else if (min && !max && val < rule.min) {\n errors.push(format(options.messages[key].min, rule.fullField, rule.min));\n } else if (max && !min && val > rule.max) {\n errors.push(format(options.messages[key].max, rule.fullField, rule.max));\n } else if (min && max && (val < rule.min || val > rule.max)) {\n errors.push(\n format(options.messages[key].range, rule.fullField, rule.min, rule.max),\n );\n }\n};\n\nexport default range;\n","import { ExecuteRule } from '../interface';\nimport { format } from '../util';\n\nconst ENUM = 'enum' as const;\n\nconst enumerable: ExecuteRule = (rule, value, source, errors, options) => {\n rule[ENUM] = Array.isArray(rule[ENUM]) ? rule[ENUM] : [];\n if (rule[ENUM].indexOf(value) === -1) {\n errors.push(\n format(options.messages[ENUM], rule.fullField, rule[ENUM].join(', ')),\n );\n }\n};\n\nexport default enumerable;\n","import { ExecuteRule } from '../interface';\nimport { format } from '../util';\n\nconst pattern: ExecuteRule = (rule, value, source, errors, options) => {\n if (rule.pattern) {\n if (rule.pattern instanceof RegExp) {\n // if a RegExp instance is passed, reset `lastIndex` in case its `global`\n // flag is accidentally set to `true`, which in a validation scenario\n // is not necessary and the result might be misleading\n rule.pattern.lastIndex = 0;\n if (!rule.pattern.test(value)) {\n errors.push(\n format(\n options.messages.pattern.mismatch,\n rule.fullField,\n value,\n rule.pattern,\n ),\n );\n }\n } else if (typeof rule.pattern === 'string') {\n const _pattern = new RegExp(rule.pattern);\n if (!_pattern.test(value)) {\n errors.push(\n format(\n options.messages.pattern.mismatch,\n rule.fullField,\n value,\n rule.pattern,\n ),\n );\n }\n }\n }\n};\n\nexport default pattern;\n","import required from './required';\nimport whitespace from './whitespace';\nimport type from './type';\nimport range from './range';\nimport enumRule from './enum';\nimport pattern from './pattern';\n\nexport default {\n required,\n whitespace,\n type,\n range,\n enum: enumRule,\n pattern,\n};\n","import { ExecuteValidator } from '../interface';\nimport rules from '../rule';\nimport { isEmptyValue } from '../util';\n\nconst string: ExecuteValidator = (rule, value, callback, source, options) => {\n const errors: string[] = [];\n const validate =\n rule.required || (!rule.required && source.hasOwnProperty(rule.field));\n if (validate) {\n if (isEmptyValue(value, 'string') && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options, 'string');\n if (!isEmptyValue(value, 'string')) {\n rules.type(rule, value, source, errors, options);\n rules.range(rule, value, source, errors, options);\n rules.pattern(rule, value, source, errors, options);\n if (rule.whitespace === true) {\n rules.whitespace(rule, value, source, errors, options);\n }\n }\n }\n callback(errors);\n};\n\nexport default string;\n","import { ExecuteValidator } from '../interface';\nimport rules from '../rule';\nimport { isEmptyValue } from '../util';\n\nconst method: ExecuteValidator = (rule, value, callback, source, options) => {\n const errors: string[] = [];\n const validate =\n rule.required || (!rule.required && source.hasOwnProperty(rule.field));\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options);\n if (value !== undefined) {\n rules.type(rule, value, source, errors, options);\n }\n }\n callback(errors);\n};\n\nexport default method;\n","import { ExecuteValidator } from '../interface';\nimport rules from '../rule';\nimport { isEmptyValue } from '../util';\n\nconst number: ExecuteValidator = (rule, value, callback, source, options) => {\n const errors: string[] = [];\n const validate =\n rule.required || (!rule.required && source.hasOwnProperty(rule.field));\n if (validate) {\n if (value === '') {\n value = undefined;\n }\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options);\n if (value !== undefined) {\n rules.type(rule, value, source, errors, options);\n rules.range(rule, value, source, errors, options);\n }\n }\n callback(errors);\n};\n\nexport default number;\n","import { isEmptyValue } from '../util';\nimport rules from '../rule';\nimport { ExecuteValidator } from '../interface';\n\nconst boolean: ExecuteValidator = (rule, value, callback, source, options) => {\n const errors: string[] = [];\n const validate =\n rule.required || (!rule.required && source.hasOwnProperty(rule.field));\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options);\n if (value !== undefined) {\n rules.type(rule, value, source, errors, options);\n }\n }\n callback(errors);\n};\n\nexport default boolean;\n","import { ExecuteValidator } from '../interface';\nimport rules from '../rule';\nimport { isEmptyValue } from '../util';\n\nconst regexp: ExecuteValidator = (rule, value, callback, source, options) => {\n const errors: string[] = [];\n const validate =\n rule.required || (!rule.required && source.hasOwnProperty(rule.field));\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options);\n if (!isEmptyValue(value)) {\n rules.type(rule, value, source, errors, options);\n }\n }\n callback(errors);\n};\n\nexport default regexp;\n","import { ExecuteValidator } from '../interface';\nimport rules from '../rule';\nimport { isEmptyValue } from '../util';\n\nconst integer: ExecuteValidator = (rule, value, callback, source, options) => {\n const errors: string[] = [];\n const validate =\n rule.required || (!rule.required && source.hasOwnProperty(rule.field));\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options);\n if (value !== undefined) {\n rules.type(rule, value, source, errors, options);\n rules.range(rule, value, source, errors, options);\n }\n }\n callback(errors);\n};\n\nexport default integer;\n","import { ExecuteValidator } from '../interface';\nimport rules from '../rule';\nimport { isEmptyValue } from '../util';\n\nconst floatFn: ExecuteValidator = (rule, value, callback, source, options) => {\n const errors: string[] = [];\n const validate =\n rule.required || (!rule.required && source.hasOwnProperty(rule.field));\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options);\n if (value !== undefined) {\n rules.type(rule, value, source, errors, options);\n rules.range(rule, value, source, errors, options);\n }\n }\n callback(errors);\n};\n\nexport default floatFn;\n","import { ExecuteValidator } from '../interface';\nimport rules from '../rule/index';\n\nconst array: ExecuteValidator = (rule, value, callback, source, options) => {\n const errors: string[] = [];\n const validate =\n rule.required || (!rule.required && source.hasOwnProperty(rule.field));\n if (validate) {\n if ((value === undefined || value === null) && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options, 'array');\n if (value !== undefined && value !== null) {\n rules.type(rule, value, source, errors, options);\n rules.range(rule, value, source, errors, options);\n }\n }\n callback(errors);\n};\n\nexport default array;\n","import { ExecuteValidator } from '../interface';\nimport rules from '../rule';\nimport { isEmptyValue } from '../util';\n\nconst object: ExecuteValidator = (rule, value, callback, source, options) => {\n const errors: string[] = [];\n const validate =\n rule.required || (!rule.required && source.hasOwnProperty(rule.field));\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options);\n if (value !== undefined) {\n rules.type(rule, value, source, errors, options);\n }\n }\n callback(errors);\n};\n\nexport default object;\n","import { ExecuteValidator } from '../interface';\nimport rules from '../rule';\nimport { isEmptyValue } from '../util';\n\nconst ENUM = 'enum' as const;\n\nconst enumerable: ExecuteValidator = (\n rule,\n value,\n callback,\n source,\n options,\n) => {\n const errors: string[] = [];\n const validate =\n rule.required || (!rule.required && source.hasOwnProperty(rule.field));\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options);\n if (value !== undefined) {\n rules[ENUM](rule, value, source, errors, options);\n }\n }\n callback(errors);\n};\n\nexport default enumerable;\n","import { ExecuteValidator } from '../interface';\nimport rules from '../rule';\nimport { isEmptyValue } from '../util';\n\nconst pattern: ExecuteValidator = (rule, value, callback, source, options) => {\n const errors: string[] = [];\n const validate =\n rule.required || (!rule.required && source.hasOwnProperty(rule.field));\n if (validate) {\n if (isEmptyValue(value, 'string') && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options);\n if (!isEmptyValue(value, 'string')) {\n rules.pattern(rule, value, source, errors, options);\n }\n }\n callback(errors);\n};\n\nexport default pattern;\n","import { ExecuteValidator } from '../interface';\nimport rules from '../rule';\nimport { isEmptyValue } from '../util';\n\nconst date: ExecuteValidator = (rule, value, callback, source, options) => {\n // console.log('integer rule called %j', rule);\n const errors: string[] = [];\n const validate =\n rule.required || (!rule.required && source.hasOwnProperty(rule.field));\n // console.log('validate on %s value', value);\n if (validate) {\n if (isEmptyValue(value, 'date') && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options);\n if (!isEmptyValue(value, 'date')) {\n let dateObject;\n\n if (value instanceof Date) {\n dateObject = value;\n } else {\n dateObject = new Date(value);\n }\n\n rules.type(rule, dateObject, source, errors, options);\n if (dateObject) {\n rules.range(rule, dateObject.getTime(), source, errors, options);\n }\n }\n }\n callback(errors);\n};\n\nexport default date;\n","import { ExecuteValidator } from '../interface';\nimport rules from '../rule';\n\nconst required: ExecuteValidator = (rule, value, callback, source, options) => {\n const errors: string[] = [];\n const type = Array.isArray(value) ? 'array' : typeof value;\n rules.required(rule, value, source, errors, options, type);\n callback(errors);\n};\n\nexport default required;\n","import { ExecuteValidator } from '../interface';\nimport rules from '../rule';\nimport { isEmptyValue } from '../util';\n\nconst type: ExecuteValidator = (rule, value, callback, source, options) => {\n const ruleType = rule.type;\n const errors: string[] = [];\n const validate =\n rule.required || (!rule.required && source.hasOwnProperty(rule.field));\n if (validate) {\n if (isEmptyValue(value, ruleType) && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options, ruleType);\n if (!isEmptyValue(value, ruleType)) {\n rules.type(rule, value, source, errors, options);\n }\n }\n callback(errors);\n};\n\nexport default type;\n","import { ExecuteValidator } from '../interface';\nimport rules from '../rule';\nimport { isEmptyValue } from '../util';\n\nconst any: ExecuteValidator = (rule, value, callback, source, options) => {\n const errors: string[] = [];\n const validate =\n rule.required || (!rule.required && source.hasOwnProperty(rule.field));\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options);\n }\n callback(errors);\n};\n\nexport default any;\n","import string from './string';\nimport method from './method';\nimport number from './number';\nimport boolean from './boolean';\nimport regexp from './regexp';\nimport integer from './integer';\nimport float from './float';\nimport array from './array';\nimport object from './object';\nimport enumValidator from './enum';\nimport pattern from './pattern';\nimport date from './date';\nimport required from './required';\nimport type from './type';\nimport any from './any';\n\nexport default {\n string,\n method,\n number,\n boolean,\n regexp,\n integer,\n float,\n array,\n object,\n enum: enumValidator,\n pattern,\n date,\n url: type,\n hex: type,\n email: type,\n required,\n any,\n};\n","import { InternalValidateMessages } from './interface';\n\nexport function newMessages(): InternalValidateMessages {\n return {\n default: 'Validation error on field %s',\n required: '%s is required',\n enum: '%s must be one of %s',\n whitespace: '%s cannot be empty',\n date: {\n format: '%s date %s is invalid for format %s',\n parse: '%s date could not be parsed, %s is invalid ',\n invalid: '%s date %s is invalid',\n },\n types: {\n string: '%s is not a %s',\n method: '%s is not a %s (function)',\n array: '%s is not an %s',\n object: '%s is not an %s',\n number: '%s is not a %s',\n date: '%s is not a %s',\n boolean: '%s is not a %s',\n integer: '%s is not an %s',\n float: '%s is not a %s',\n regexp: '%s is not a valid %s',\n email: '%s is not a valid %s',\n url: '%s is not a valid %s',\n hex: '%s is not a valid %s',\n },\n string: {\n len: '%s must be exactly %s characters',\n min: '%s must be at least %s characters',\n max: '%s cannot be longer than %s characters',\n range: '%s must be between %s and %s characters',\n },\n number: {\n len: '%s must equal %s',\n min: '%s cannot be less than %s',\n max: '%s cannot be greater than %s',\n range: '%s must be between %s and %s',\n },\n array: {\n len: '%s must be exactly %s in length',\n min: '%s cannot be less than %s in length',\n max: '%s cannot be greater than %s in length',\n range: '%s must be between %s and %s in length',\n },\n pattern: {\n mismatch: '%s value %s does not match pattern %s',\n },\n clone() {\n const cloned = JSON.parse(JSON.stringify(this));\n cloned.clone = this.clone;\n return cloned;\n },\n };\n}\n\nexport const messages = newMessages();\n","import {\n format,\n complementError,\n asyncMap,\n warning,\n deepMerge,\n convertFieldsError,\n} from './util';\nimport validators from './validator/index';\nimport { messages as defaultMessages, newMessages } from './messages';\nimport {\n InternalRuleItem,\n InternalValidateMessages,\n Rule,\n RuleItem,\n Rules,\n ValidateCallback,\n ValidateMessages,\n ValidateOption,\n Values,\n RuleValuePackage,\n ValidateError,\n ValidateFieldsError,\n SyncErrorType,\n ValidateResult,\n} from './interface';\n\nexport * from './interface';\n\n/**\n * Encapsulates a validation schema.\n *\n * @param descriptor An object declaring validation rules\n * for this schema.\n */\nclass Schema {\n // ========================= Static =========================\n static register = function register(type: string, validator) {\n if (typeof validator !== 'function') {\n throw new Error(\n 'Cannot register a validator by type, validator is not a function',\n );\n }\n validators[type] = validator;\n };\n\n static warning = warning;\n\n static messages = defaultMessages;\n\n static validators = validators;\n\n // ======================== Instance ========================\n rules: Record = null;\n _messages: InternalValidateMessages = defaultMessages;\n\n constructor(descriptor: Rules) {\n this.define(descriptor);\n }\n\n define(rules: Rules) {\n if (!rules) {\n throw new Error('Cannot configure a schema with no rules');\n }\n if (typeof rules !== 'object' || Array.isArray(rules)) {\n throw new Error('Rules must be an object');\n }\n this.rules = {};\n\n Object.keys(rules).forEach(name => {\n const item: Rule = rules[name];\n this.rules[name] = Array.isArray(item) ? item : [item];\n });\n }\n\n messages(messages?: ValidateMessages) {\n if (messages) {\n this._messages = deepMerge(newMessages(), messages);\n }\n return this._messages;\n }\n\n validate(\n source: Values,\n option?: ValidateOption,\n callback?: ValidateCallback,\n ): Promise;\n validate(source: Values, callback: ValidateCallback): Promise;\n validate(source: Values): Promise;\n\n validate(source_: Values, o: any = {}, oc: any = () => {}): Promise {\n let source: Values = source_;\n let options: ValidateOption = o;\n let callback: ValidateCallback = oc;\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n if (!this.rules || Object.keys(this.rules).length === 0) {\n if (callback) {\n callback(null, source);\n }\n return Promise.resolve(source);\n }\n\n function complete(results: (ValidateError | ValidateError[])[]) {\n let errors: ValidateError[] = [];\n let fields: ValidateFieldsError = {};\n\n function add(e: ValidateError | ValidateError[]) {\n if (Array.isArray(e)) {\n errors = errors.concat(...e);\n } else {\n errors.push(e);\n }\n }\n\n for (let i = 0; i < results.length; i++) {\n add(results[i]);\n }\n if (!errors.length) {\n callback(null, source);\n } else {\n fields = convertFieldsError(errors);\n (callback as (\n errors: ValidateError[],\n fields: ValidateFieldsError,\n ) => void)(errors, fields);\n }\n }\n\n if (options.messages) {\n let messages = this.messages();\n if (messages === defaultMessages) {\n messages = newMessages();\n }\n deepMerge(messages, options.messages);\n options.messages = messages;\n } else {\n options.messages = this.messages();\n }\n\n const series: Record = {};\n const keys = options.keys || Object.keys(this.rules);\n keys.forEach(z => {\n const arr = this.rules[z];\n let value = source[z];\n arr.forEach(r => {\n let rule: InternalRuleItem = r;\n if (typeof rule.transform === 'function') {\n if (source === source_) {\n source = { ...source };\n }\n value = source[z] = rule.transform(value);\n }\n if (typeof rule === 'function') {\n rule = {\n validator: rule,\n };\n } else {\n rule = { ...rule };\n }\n\n // Fill validator. Skip if nothing need to validate\n rule.validator = this.getValidationMethod(rule);\n if (!rule.validator) {\n return;\n }\n\n rule.field = z;\n rule.fullField = rule.fullField || z;\n rule.type = this.getType(rule);\n series[z] = series[z] || [];\n series[z].push({\n rule,\n value,\n source,\n field: z,\n });\n });\n });\n const errorFields = {};\n return asyncMap(\n series,\n options,\n (data, doIt) => {\n const rule = data.rule;\n let deep =\n (rule.type === 'object' || rule.type === 'array') &&\n (typeof rule.fields === 'object' ||\n typeof rule.defaultField === 'object');\n deep = deep && (rule.required || (!rule.required && data.value));\n rule.field = data.field;\n\n function addFullField(key: string, schema: RuleItem) {\n return {\n ...schema,\n fullField: `${rule.fullField}.${key}`,\n fullFields: rule.fullFields ? [...rule.fullFields, key] : [key],\n };\n }\n\n function cb(e: SyncErrorType | SyncErrorType[] = []) {\n let errorList = Array.isArray(e) ? e : [e];\n if (!options.suppressWarning && errorList.length) {\n Schema.warning('async-validator:', errorList);\n }\n if (errorList.length && rule.message !== undefined) {\n errorList = [].concat(rule.message);\n }\n\n // Fill error info\n let filledErrors = errorList.map(complementError(rule, source));\n\n if (options.first && filledErrors.length) {\n errorFields[rule.field] = 1;\n return doIt(filledErrors);\n }\n if (!deep) {\n doIt(filledErrors);\n } else {\n // if rule is required but the target object\n // does not exist fail at the rule level and don't\n // go deeper\n if (rule.required && !data.value) {\n if (rule.message !== undefined) {\n filledErrors = []\n .concat(rule.message)\n .map(complementError(rule, source));\n } else if (options.error) {\n filledErrors = [\n options.error(\n rule,\n format(options.messages.required, rule.field),\n ),\n ];\n }\n return doIt(filledErrors);\n }\n\n let fieldsSchema: Record = {};\n if (rule.defaultField) {\n Object.keys(data.value).map(key => {\n fieldsSchema[key] = rule.defaultField;\n });\n }\n fieldsSchema = {\n ...fieldsSchema,\n ...data.rule.fields,\n };\n\n const paredFieldsSchema: Record = {};\n\n Object.keys(fieldsSchema).forEach(field => {\n const fieldSchema = fieldsSchema[field];\n const fieldSchemaList = Array.isArray(fieldSchema)\n ? fieldSchema\n : [fieldSchema];\n paredFieldsSchema[field] = fieldSchemaList.map(\n addFullField.bind(null, field),\n );\n });\n const schema = new Schema(paredFieldsSchema);\n schema.messages(options.messages);\n if (data.rule.options) {\n data.rule.options.messages = options.messages;\n data.rule.options.error = options.error;\n }\n schema.validate(data.value, data.rule.options || options, errs => {\n const finalErrors = [];\n if (filledErrors && filledErrors.length) {\n finalErrors.push(...filledErrors);\n }\n if (errs && errs.length) {\n finalErrors.push(...errs);\n }\n doIt(finalErrors.length ? finalErrors : null);\n });\n }\n }\n\n let res: ValidateResult;\n if (rule.asyncValidator) {\n res = rule.asyncValidator(rule, data.value, cb, data.source, options);\n } else if (rule.validator) {\n try {\n res = rule.validator(rule, data.value, cb, data.source, options);\n } catch (error) {\n console.error?.(error);\n // rethrow to report error\n if (!options.suppressValidatorError) {\n setTimeout(() => {\n throw error;\n }, 0);\n }\n cb(error.message);\n }\n if (res === true) {\n cb();\n } else if (res === false) {\n cb(\n typeof rule.message === 'function'\n ? rule.message(rule.fullField || rule.field)\n : rule.message || `${rule.fullField || rule.field} fails`,\n );\n } else if (res instanceof Array) {\n cb(res);\n } else if (res instanceof Error) {\n cb(res.message);\n }\n }\n if (res && (res as Promise).then) {\n (res as Promise).then(\n () => cb(),\n e => cb(e),\n );\n }\n },\n results => {\n complete(results);\n },\n source,\n );\n }\n\n getType(rule: InternalRuleItem) {\n if (rule.type === undefined && rule.pattern instanceof RegExp) {\n rule.type = 'pattern';\n }\n if (\n typeof rule.validator !== 'function' &&\n rule.type &&\n !validators.hasOwnProperty(rule.type)\n ) {\n throw new Error(format('Unknown rule type %s', rule.type));\n }\n return rule.type || 'string';\n }\n\n getValidationMethod(rule: InternalRuleItem) {\n if (typeof rule.validator === 'function') {\n return rule.validator;\n }\n const keys = Object.keys(rule);\n const messageIndex = keys.indexOf('message');\n if (messageIndex !== -1) {\n keys.splice(messageIndex, 1);\n }\n if (keys.length === 1 && keys[0] === 'required') {\n return validators.required;\n }\n return validators[this.getType(rule)] || undefined;\n }\n}\n\nexport default Schema;\n"],"sourceRoot":""}