import{b as G}from"./@babel.49d8906a.js";import{_ as x,a as M}from"./babel-runtime.4773988a.js";var H=/%[sdj%]/g;function v(){for(var e=arguments.length,r=Array(e),t=0;t=i)return l;switch(l){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch{return"[Circular]"}break;default:return l}}),p=r[n];n()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,url:new RegExp("^(?!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]*)?$","i"),hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},N={integer:function(r){return N.number(r)&&parseInt(r,10)===r},float:function(r){return N.number(r)&&!N.integer(r)},array:function(r){return Array.isArray(r)},regexp:function(r){if(r instanceof RegExp)return!0;try{return!!new RegExp(r)}catch{return!1}},date:function(r){return typeof r.getTime=="function"&&typeof r.getMonth=="function"&&typeof r.getYear=="function"},number:function(r){return isNaN(r)?!1:typeof r=="number"},object:function(r){return(typeof r=="undefined"?"undefined":x(r))==="object"&&!N.array(r)},method:function(r){return typeof r=="function"},email:function(r){return typeof r=="string"&&!!r.match(D.email)&&r.length<255},url:function(r){return typeof r=="string"&&!!r.match(D.url)},hex:function(r){return typeof r=="string"&&!!r.match(D.hex)}};function ee(e,r,t,n,f){if(e.required&&r===void 0){B(e,r,t,n,f);return}var i=["integer","float","array","regexp","object","method","email","number","date","url","hex"],a=e.type;i.indexOf(a)>-1?N[a](r)||n.push(v(f.messages.types[a],e.fullField,e.type)):a&&(typeof r=="undefined"?"undefined":x(r))!==e.type&&n.push(v(f.messages.types[a],e.fullField,e.type))}function re(e,r,t,n,f){var i=typeof e.len=="number",a=typeof e.min=="number",p=typeof e.max=="number",l=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,g=r,h=null,b=typeof r=="number",q=typeof r=="string",$=Array.isArray(r);if(b?h="number":q?h="string":$&&(h="array"),!h)return!1;$&&(g=r.length),q&&(g=r.replace(l,"_").length),i?g!==e.len&&n.push(v(f.messages[h].len,e.fullField,e.len)):a&&!p&&ge.max?n.push(v(f.messages[h].max,e.fullField,e.max)):a&&p&&(ge.max)&&n.push(v(f.messages[h].range,e.fullField,e.min,e.max))}var P="enum";function ne(e,r,t,n,f){e[P]=Array.isArray(e[P])?e[P]:[],e[P].indexOf(r)===-1&&n.push(v(f.messages[P],e.fullField,e[P].join(", ")))}function te(e,r,t,n,f){if(e.pattern){if(e.pattern instanceof RegExp)e.pattern.lastIndex=0,e.pattern.test(r)||n.push(v(f.messages.pattern.mismatch,e.fullField,r,e.pattern));else if(typeof e.pattern=="string"){var i=new RegExp(e.pattern);i.test(r)||n.push(v(f.messages.pattern.mismatch,e.fullField,r,e.pattern))}}}var d={required:B,whitespace:k,type:ee,range:re,enum:ne,pattern:te};function ie(e,r,t,n,f){var i=[],a=e.required||!e.required&&n.hasOwnProperty(e.field);if(a){if(y(r,"string")&&!e.required)return t();d.required(e,r,n,i,f,"string"),y(r,"string")||(d.type(e,r,n,i,f),d.range(e,r,n,i,f),d.pattern(e,r,n,i,f),e.whitespace===!0&&d.whitespace(e,r,n,i,f))}t(i)}function fe(e,r,t,n,f){var i=[],a=e.required||!e.required&&n.hasOwnProperty(e.field);if(a){if(y(r)&&!e.required)return t();d.required(e,r,n,i,f),r!==void 0&&d.type(e,r,n,i,f)}t(i)}function ae(e,r,t,n,f){var i=[],a=e.required||!e.required&&n.hasOwnProperty(e.field);if(a){if(y(r)&&!e.required)return t();d.required(e,r,n,i,f),r!==void 0&&(d.type(e,r,n,i,f),d.range(e,r,n,i,f))}t(i)}function se(e,r,t,n,f){var i=[],a=e.required||!e.required&&n.hasOwnProperty(e.field);if(a){if(y(r)&&!e.required)return t();d.required(e,r,n,i,f),r!==void 0&&d.type(e,r,n,i,f)}t(i)}function de(e,r,t,n,f){var i=[],a=e.required||!e.required&&n.hasOwnProperty(e.field);if(a){if(y(r)&&!e.required)return t();d.required(e,r,n,i,f),y(r)||d.type(e,r,n,i,f)}t(i)}function oe(e,r,t,n,f){var i=[],a=e.required||!e.required&&n.hasOwnProperty(e.field);if(a){if(y(r)&&!e.required)return t();d.required(e,r,n,i,f),r!==void 0&&(d.type(e,r,n,i,f),d.range(e,r,n,i,f))}t(i)}function pe(e,r,t,n,f){var i=[],a=e.required||!e.required&&n.hasOwnProperty(e.field);if(a){if(y(r)&&!e.required)return t();d.required(e,r,n,i,f),r!==void 0&&(d.type(e,r,n,i,f),d.range(e,r,n,i,f))}t(i)}function ye(e,r,t,n,f){var i=[],a=e.required||!e.required&&n.hasOwnProperty(e.field);if(a){if(y(r,"array")&&!e.required)return t();d.required(e,r,n,i,f,"array"),y(r,"array")||(d.type(e,r,n,i,f),d.range(e,r,n,i,f))}t(i)}function ue(e,r,t,n,f){var i=[],a=e.required||!e.required&&n.hasOwnProperty(e.field);if(a){if(y(r)&&!e.required)return t();d.required(e,r,n,i,f),r!==void 0&&d.type(e,r,n,i,f)}t(i)}var ge="enum";function me(e,r,t,n,f){var i=[],a=e.required||!e.required&&n.hasOwnProperty(e.field);if(a){if(y(r)&&!e.required)return t();d.required(e,r,n,i,f),r&&d[ge](e,r,n,i,f)}t(i)}function he(e,r,t,n,f){var i=[],a=e.required||!e.required&&n.hasOwnProperty(e.field);if(a){if(y(r,"string")&&!e.required)return t();d.required(e,r,n,i,f),y(r,"string")||d.pattern(e,r,n,i,f)}t(i)}function ce(e,r,t,n,f){var i=[],a=e.required||!e.required&&n.hasOwnProperty(e.field);if(a){if(y(r)&&!e.required)return t();if(d.required(e,r,n,i,f),!y(r)){var p=void 0;typeof r=="number"?p=new Date(r):p=r,d.type(e,p,n,i,f),p&&d.range(e,p.getTime(),n,i,f)}}t(i)}function ve(e,r,t,n,f){var i=[],a=Array.isArray(r)?"array":typeof r=="undefined"?"undefined":x(r);d.required(e,r,n,i,f,a),t(i)}function V(e,r,t,n,f){var i=e.type,a=[],p=e.required||!e.required&&n.hasOwnProperty(e.field);if(p){if(y(r,i)&&!e.required)return t();d.required(e,r,n,a,f,i),y(r,i)||d.type(e,r,n,a,f)}t(a)}var _={string:ie,method:fe,number:ae,boolean:se,regexp:de,integer:oe,float:pe,array:ye,object:ue,enum:me,pattern:he,date:ce,url:V,hex:V,email:V,required:ve};function C(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone:function(){var r=JSON.parse(JSON.stringify(this));return r.clone=this.clone,r}}}var J=C();function T(e){this.rules=null,this._messages=J,this.define(e)}T.prototype={messages:function(r){return r&&(this._messages=z(C(),r)),this._messages},define:function(r){if(!r)throw new Error("Cannot configure a schema with no rules");if((typeof r=="undefined"?"undefined":x(r))!=="object"||Array.isArray(r))throw new Error("Rules must be an object");this.rules={};var t=void 0,n=void 0;for(t in r)r.hasOwnProperty(t)&&(n=r[t],this.rules[t]=Array.isArray(n)?n:[n])},validate:function(r){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},f=arguments[2],i=r,a=n,p=f;if(typeof a=="function"&&(p=a,a={}),!this.rules||Object.keys(this.rules).length===0){p&&p();return}function l(o){var m=void 0,s=void 0,c=[],O={};function j(F){Array.isArray(F)?c=c.concat.apply(c,F):c.push(F)}for(m=0;m0&&arguments[0]!==void 0?arguments[0]:[],u=E;if(Array.isArray(u)||(u=[u]),u.length,u.length&&s.message&&(u=[].concat(s.message)),u=u.map(Z(s)),a.first&&u.length)return K[s.field]=1,m(u);if(!c)m(u);else{if(s.required&&!o.value)return s.message?u=[].concat(s.message).map(Z(s)):a.error?u=[a.error(s,v(a.messages.required,s.field))]:u=[],m(u);var w={};if(s.defaultField)for(var L in o.value)o.value.hasOwnProperty(L)&&(w[L]=s.defaultField);w=M({},w,o.rule.fields);for(var A in w)if(w.hasOwnProperty(A)){var Y=Array.isArray(w[A])?w[A]:[w[A]];w[A]=Y.map(O.bind(null,A))}var S=new T(w);S.messages(a.messages),o.rule.options&&(o.rule.options.messages=a.messages,o.rule.options.error=a.error),S.validate(o.value,o.rule.options||a,function(R){m(R&&R.length?u.concat(R):R)})}}var F=s.validator(s,o.value,j,o.source,a);F&&F.then&&F.then(function(){return j()},function(E){return j(E)})},function(o){l(o)})},getType:function(r){if(r.type===void 0&&r.pattern instanceof RegExp&&(r.type="pattern"),typeof r.validator!="function"&&r.type&&!_.hasOwnProperty(r.type))throw new Error(v("Unknown rule type %s",r.type));return r.type||"string"},getValidationMethod:function(r){if(typeof r.validator=="function")return r.validator;var t=Object.keys(r),n=t.indexOf("message");return n!==-1&&t.splice(n,1),t.length===1&&t[0]==="required"?_.required:_[this.getType(r)]||!1}};T.register=function(r,t){if(typeof t!="function")throw new Error("Cannot register a validator by type, validator is not a function");_[r]=t};T.messages=J;var qe=Object.freeze(Object.defineProperty({__proto__:null,default:T},Symbol.toStringTag,{value:"Module"})),we=G(qe);export{we as r};