{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { messages as defaultMessages, newMessages } from \"./messages\";\nimport { asyncMap, complementError, convertFieldsError, deepMerge, format, warning } from \"./util\";\nimport validators from \"./validator/index\";\nexport * from \"./interface\";\n\n/**\n * Encapsulates a validation schema.\n *\n * @param descriptor An object declaring validation rules\n * for this schema.\n */\nvar Schema = /*#__PURE__*/function () {\n function Schema(descriptor) {\n _classCallCheck(this, Schema);\n // ======================== Instance ========================\n _defineProperty(this, \"rules\", null);\n _defineProperty(this, \"_messages\", defaultMessages);\n this.define(descriptor);\n }\n _createClass(Schema, [{\n key: \"define\",\n value: function define(rules) {\n var _this = this;\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 Object.keys(rules).forEach(function (name) {\n var item = rules[name];\n _this.rules[name] = Array.isArray(item) ? item : [item];\n });\n }\n }, {\n key: \"messages\",\n value: function messages(_messages) {\n if (_messages) {\n this._messages = deepMerge(newMessages(), _messages);\n }\n return this._messages;\n }\n }, {\n key: \"validate\",\n value: function validate(source_) {\n var _this2 = this;\n var o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var oc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};\n var source = source_;\n var options = o;\n var callback = 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 function complete(results) {\n var errors = [];\n var fields = {};\n function add(e) {\n if (Array.isArray(e)) {\n var _errors;\n errors = (_errors = errors).concat.apply(_errors, _toConsumableArray(e));\n } else {\n errors.push(e);\n }\n }\n for (var 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(errors, fields);\n }\n }\n if (options.messages) {\n var 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 var series = {};\n var keys = options.keys || Object.keys(this.rules);\n keys.forEach(function (z) {\n var arr = _this2.rules[z];\n var value = source[z];\n arr.forEach(function (r) {\n var rule = r;\n if (typeof rule.transform === 'function') {\n if (source === source_) {\n source = _objectSpread({}, source);\n }\n value = source[z] = rule.transform(value);\n if (value !== undefined && value !== null) {\n rule.type = rule.type || (Array.isArray(value) ? 'array' : _typeof(value));\n }\n }\n if (typeof rule === 'function') {\n rule = {\n validator: rule\n };\n } else {\n rule = _objectSpread({}, rule);\n }\n\n // Fill validator. Skip if nothing need to validate\n rule.validator = _this2.getValidationMethod(rule);\n if (!rule.validator) {\n return;\n }\n rule.field = z;\n rule.fullField = rule.fullField || z;\n rule.type = _this2.getType(rule);\n series[z] = series[z] || [];\n series[z].push({\n rule: rule,\n value: value,\n source: source,\n field: z\n });\n });\n });\n var errorFields = {};\n return asyncMap(series, options, function (data, doIt) {\n var rule = data.rule;\n var deep = (rule.type === 'object' || rule.type === 'array') && (_typeof(rule.fields) === 'object' || _typeof(rule.defaultField) === 'object');\n deep = deep && (rule.required || !rule.required && data.value);\n rule.field = data.field;\n function addFullField(key, schema) {\n return _objectSpread(_objectSpread({}, schema), {}, {\n fullField: \"\".concat(rule.fullField, \".\").concat(key),\n fullFields: rule.fullFields ? [].concat(_toConsumableArray(rule.fullFields), [key]) : [key]\n });\n }\n function cb() {\n var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var 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 var filledErrors = errorList.map(complementError(rule, source));\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 = [].concat(rule.message).map(complementError(rule, source));\n } else if (options.error) {\n filledErrors = [options.error(rule, format(options.messages.required, rule.field))];\n }\n return doIt(filledErrors);\n }\n var fieldsSchema = {};\n if (rule.defaultField) {\n Object.keys(data.value).map(function (key) {\n fieldsSchema[key] = rule.defaultField;\n });\n }\n fieldsSchema = _objectSpread(_objectSpread({}, fieldsSchema), data.rule.fields);\n var paredFieldsSchema = {};\n Object.keys(fieldsSchema).forEach(function (field) {\n var fieldSchema = fieldsSchema[field];\n var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];\n paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));\n });\n var 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, function (errs) {\n var finalErrors = [];\n if (filledErrors && filledErrors.length) {\n finalErrors.push.apply(finalErrors, _toConsumableArray(filledErrors));\n }\n if (errs && errs.length) {\n finalErrors.push.apply(finalErrors, _toConsumableArray(errs));\n }\n doIt(finalErrors.length ? finalErrors : null);\n });\n }\n }\n var res;\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 var _console$error, _console;\n (_console$error = (_console = console).error) === null || _console$error === void 0 || _console$error.call(_console, error);\n // rethrow to report error\n if (!options.suppressValidatorError) {\n setTimeout(function () {\n throw error;\n }, 0);\n }\n cb(error.message);\n }\n if (res === true) {\n cb();\n } else if (res === false) {\n cb(typeof rule.message === 'function' ? rule.message(rule.fullField || rule.field) : rule.message || \"\".concat(rule.fullField || rule.field, \" fails\"));\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.then) {\n res.then(function () {\n return cb();\n }, function (e) {\n return cb(e);\n });\n }\n }, function (results) {\n complete(results);\n }, source);\n }\n }, {\n key: \"getType\",\n value: function getType(rule) {\n if (rule.type === undefined && rule.pattern instanceof RegExp) {\n rule.type = 'pattern';\n }\n if (typeof rule.validator !== 'function' && rule.type && !validators.hasOwnProperty(rule.type)) {\n throw new Error(format('Unknown rule type %s', rule.type));\n }\n return rule.type || 'string';\n }\n }, {\n key: \"getValidationMethod\",\n value: function getValidationMethod(rule) {\n if (typeof rule.validator === 'function') {\n return rule.validator;\n }\n var keys = Object.keys(rule);\n var 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 return Schema;\n}();\n// ========================= Static =========================\n_defineProperty(Schema, \"register\", function register(type, validator) {\n if (typeof validator !== 'function') {\n throw new Error('Cannot register a validator by type, validator is not a function');\n }\n validators[type] = validator;\n});\n_defineProperty(Schema, \"warning\", warning);\n_defineProperty(Schema, \"messages\", defaultMessages);\n_defineProperty(Schema, \"validators\", validators);\nexport default Schema;","map":{"version":3,"names":["_objectSpread","_toConsumableArray","_typeof","_classCallCheck","_createClass","_defineProperty","messages","defaultMessages","newMessages","asyncMap","complementError","convertFieldsError","deepMerge","format","warning","validators","Schema","descriptor","define","key","value","rules","_this","Error","Array","isArray","Object","keys","forEach","name","item","_messages","validate","source_","_this2","o","arguments","length","undefined","oc","source","options","callback","Promise","resolve","complete","results","errors","fields","add","e","_errors","concat","apply","push","i","series","z","arr","r","rule","transform","type","validator","getValidationMethod","field","fullField","getType","errorFields","data","doIt","deep","defaultField","required","addFullField","schema","fullFields","cb","errorList","suppressWarning","message","filledErrors","map","first","error","fieldsSchema","paredFieldsSchema","fieldSchema","fieldSchemaList","bind","errs","finalErrors","res","asyncValidator","_console$error","_console","console","call","suppressValidatorError","setTimeout","then","pattern","RegExp","hasOwnProperty","messageIndex","indexOf","splice","register"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/@rc-component/async-validator/es/index.js"],"sourcesContent":["import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { messages as defaultMessages, newMessages } from \"./messages\";\nimport { asyncMap, complementError, convertFieldsError, deepMerge, format, warning } from \"./util\";\nimport validators from \"./validator/index\";\nexport * from \"./interface\";\n\n/**\n * Encapsulates a validation schema.\n *\n * @param descriptor An object declaring validation rules\n * for this schema.\n */\nvar Schema = /*#__PURE__*/function () {\n function Schema(descriptor) {\n _classCallCheck(this, Schema);\n // ======================== Instance ========================\n _defineProperty(this, \"rules\", null);\n _defineProperty(this, \"_messages\", defaultMessages);\n this.define(descriptor);\n }\n _createClass(Schema, [{\n key: \"define\",\n value: function define(rules) {\n var _this = this;\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 Object.keys(rules).forEach(function (name) {\n var item = rules[name];\n _this.rules[name] = Array.isArray(item) ? item : [item];\n });\n }\n }, {\n key: \"messages\",\n value: function messages(_messages) {\n if (_messages) {\n this._messages = deepMerge(newMessages(), _messages);\n }\n return this._messages;\n }\n }, {\n key: \"validate\",\n value: function validate(source_) {\n var _this2 = this;\n var o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var oc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};\n var source = source_;\n var options = o;\n var callback = 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 function complete(results) {\n var errors = [];\n var fields = {};\n function add(e) {\n if (Array.isArray(e)) {\n var _errors;\n errors = (_errors = errors).concat.apply(_errors, _toConsumableArray(e));\n } else {\n errors.push(e);\n }\n }\n for (var 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(errors, fields);\n }\n }\n if (options.messages) {\n var 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 var series = {};\n var keys = options.keys || Object.keys(this.rules);\n keys.forEach(function (z) {\n var arr = _this2.rules[z];\n var value = source[z];\n arr.forEach(function (r) {\n var rule = r;\n if (typeof rule.transform === 'function') {\n if (source === source_) {\n source = _objectSpread({}, source);\n }\n value = source[z] = rule.transform(value);\n if (value !== undefined && value !== null) {\n rule.type = rule.type || (Array.isArray(value) ? 'array' : _typeof(value));\n }\n }\n if (typeof rule === 'function') {\n rule = {\n validator: rule\n };\n } else {\n rule = _objectSpread({}, rule);\n }\n\n // Fill validator. Skip if nothing need to validate\n rule.validator = _this2.getValidationMethod(rule);\n if (!rule.validator) {\n return;\n }\n rule.field = z;\n rule.fullField = rule.fullField || z;\n rule.type = _this2.getType(rule);\n series[z] = series[z] || [];\n series[z].push({\n rule: rule,\n value: value,\n source: source,\n field: z\n });\n });\n });\n var errorFields = {};\n return asyncMap(series, options, function (data, doIt) {\n var rule = data.rule;\n var deep = (rule.type === 'object' || rule.type === 'array') && (_typeof(rule.fields) === 'object' || _typeof(rule.defaultField) === 'object');\n deep = deep && (rule.required || !rule.required && data.value);\n rule.field = data.field;\n function addFullField(key, schema) {\n return _objectSpread(_objectSpread({}, schema), {}, {\n fullField: \"\".concat(rule.fullField, \".\").concat(key),\n fullFields: rule.fullFields ? [].concat(_toConsumableArray(rule.fullFields), [key]) : [key]\n });\n }\n function cb() {\n var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var 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 var filledErrors = errorList.map(complementError(rule, source));\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 = [].concat(rule.message).map(complementError(rule, source));\n } else if (options.error) {\n filledErrors = [options.error(rule, format(options.messages.required, rule.field))];\n }\n return doIt(filledErrors);\n }\n var fieldsSchema = {};\n if (rule.defaultField) {\n Object.keys(data.value).map(function (key) {\n fieldsSchema[key] = rule.defaultField;\n });\n }\n fieldsSchema = _objectSpread(_objectSpread({}, fieldsSchema), data.rule.fields);\n var paredFieldsSchema = {};\n Object.keys(fieldsSchema).forEach(function (field) {\n var fieldSchema = fieldsSchema[field];\n var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];\n paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));\n });\n var 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, function (errs) {\n var finalErrors = [];\n if (filledErrors && filledErrors.length) {\n finalErrors.push.apply(finalErrors, _toConsumableArray(filledErrors));\n }\n if (errs && errs.length) {\n finalErrors.push.apply(finalErrors, _toConsumableArray(errs));\n }\n doIt(finalErrors.length ? finalErrors : null);\n });\n }\n }\n var res;\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 var _console$error, _console;\n (_console$error = (_console = console).error) === null || _console$error === void 0 || _console$error.call(_console, error);\n // rethrow to report error\n if (!options.suppressValidatorError) {\n setTimeout(function () {\n throw error;\n }, 0);\n }\n cb(error.message);\n }\n if (res === true) {\n cb();\n } else if (res === false) {\n cb(typeof rule.message === 'function' ? rule.message(rule.fullField || rule.field) : rule.message || \"\".concat(rule.fullField || rule.field, \" fails\"));\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.then) {\n res.then(function () {\n return cb();\n }, function (e) {\n return cb(e);\n });\n }\n }, function (results) {\n complete(results);\n }, source);\n }\n }, {\n key: \"getType\",\n value: function getType(rule) {\n if (rule.type === undefined && rule.pattern instanceof RegExp) {\n rule.type = 'pattern';\n }\n if (typeof rule.validator !== 'function' && rule.type && !validators.hasOwnProperty(rule.type)) {\n throw new Error(format('Unknown rule type %s', rule.type));\n }\n return rule.type || 'string';\n }\n }, {\n key: \"getValidationMethod\",\n value: function getValidationMethod(rule) {\n if (typeof rule.validator === 'function') {\n return rule.validator;\n }\n var keys = Object.keys(rule);\n var 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 return Schema;\n}();\n// ========================= Static =========================\n_defineProperty(Schema, \"register\", function register(type, validator) {\n if (typeof validator !== 'function') {\n throw new Error('Cannot register a validator by type, validator is not a function');\n }\n validators[type] = validator;\n});\n_defineProperty(Schema, \"warning\", warning);\n_defineProperty(Schema, \"messages\", defaultMessages);\n_defineProperty(Schema, \"validators\", validators);\nexport default Schema;"],"mappings":"AAAA,OAAOA,aAAa,MAAM,0CAA0C;AACpE,OAAOC,kBAAkB,MAAM,8CAA8C;AAC7E,OAAOC,OAAO,MAAM,mCAAmC;AACvD,OAAOC,eAAe,MAAM,2CAA2C;AACvE,OAAOC,YAAY,MAAM,wCAAwC;AACjE,OAAOC,eAAe,MAAM,2CAA2C;AACvE,SAASC,QAAQ,IAAIC,eAAe,EAAEC,WAAW,QAAQ,YAAY;AACrE,SAASC,QAAQ,EAAEC,eAAe,EAAEC,kBAAkB,EAAEC,SAAS,EAAEC,MAAM,EAAEC,OAAO,QAAQ,QAAQ;AAClG,OAAOC,UAAU,MAAM,mBAAmB;AAC1C,cAAc,aAAa;;AAE3B;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,MAAM,GAAG,aAAa,YAAY;EACpC,SAASA,MAAMA,CAACC,UAAU,EAAE;IAC1Bd,eAAe,CAAC,IAAI,EAAEa,MAAM,CAAC;IAC7B;IACAX,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC;IACpCA,eAAe,CAAC,IAAI,EAAE,WAAW,EAAEE,eAAe,CAAC;IACnD,IAAI,CAACW,MAAM,CAACD,UAAU,CAAC;EACzB;EACAb,YAAY,CAACY,MAAM,EAAE,CAAC;IACpBG,GAAG,EAAE,QAAQ;IACbC,KAAK,EAAE,SAASF,MAAMA,CAACG,KAAK,EAAE;MAC5B,IAAIC,KAAK,GAAG,IAAI;MAChB,IAAI,CAACD,KAAK,EAAE;QACV,MAAM,IAAIE,KAAK,CAAC,yCAAyC,CAAC;MAC5D;MACA,IAAIrB,OAAO,CAACmB,KAAK,CAAC,KAAK,QAAQ,IAAIG,KAAK,CAACC,OAAO,CAACJ,KAAK,CAAC,EAAE;QACvD,MAAM,IAAIE,KAAK,CAAC,yBAAyB,CAAC;MAC5C;MACA,IAAI,CAACF,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