function R(){return R=Object.assign?Object.assign.bind():function(i){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function M(i,e,r){return re()?M=Reflect.construct.bind():M=function(n,f,a){var s=[null];s.push.apply(s,f);var d=Function.bind.apply(n,s),q=new d;return a&&T(q,a.prototype),q},M.apply(null,arguments)}function te(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function J(i){var e=typeof Map=="function"?new Map:void 0;return J=function(t){if(t===null||!te(t))return t;if(typeof t!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return M(t,arguments,U(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),T(n,t)},J(i)}var ne=/%[sdj%]/g,ie=function(){};function W(i){if(!i||!i.length)return null;var e={};return i.forEach(function(r){var t=r.field;e[t]=e[t]||[],e[t].push(r)}),e}function F(i){for(var e=arguments.length,r=new Array(e>1?e-1:0),t=1;t=f)return s;switch(s){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 s}});return a}return i}function ae(i){return i==="string"||i==="url"||i==="hex"||i==="email"||i==="date"||i==="pattern"}function h(i,e){return!!(i==null||e==="array"&&Array.isArray(i)&&!i.length||ae(e)&&typeof i=="string"&&!i)}function fe(i,e,r){var t=[],n=0,f=i.length;function a(s){t.push.apply(t,s||[]),n++,n===f&&r(t)}i.forEach(function(s){e(s,a)})}function G(i,e,r){var t=0,n=i.length;function f(a){if(a&&a.length){r(a);return}var s=t;t=t+1,s()\[\]\\.,;:\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,}))$/,hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},D={integer:function(e){return D.number(e)&&parseInt(e,10)===e},float:function(e){return D.number(e)&&!D.integer(e)},array:function(e){return Array.isArray(e)},regexp:function(e){if(e instanceof RegExp)return!0;try{return!!new RegExp(e)}catch{return!1}},date:function(e){return typeof e.getTime=="function"&&typeof e.getMonth=="function"&&typeof e.getYear=="function"&&!isNaN(e.getTime())},number:function(e){return isNaN(e)?!1:typeof e=="number"},object:function(e){return typeof e=="object"&&!D.array(e)},method:function(e){return typeof e=="function"},email:function(e){return typeof e=="string"&&e.length<=320&&!!e.match(X.email)},url:function(e){return typeof e=="string"&&e.length<=2048&&!!e.match(pe())},hex:function(e){return typeof e=="string"&&!!e.match(X.hex)}},ye=function(e,r,t,n,f){if(e.required&&r===void 0){C(e,r,t,n,f);return}var a=["integer","float","array","regexp","object","method","email","number","date","url","hex"],s=e.type;a.indexOf(s)>-1?D[s](r)||n.push(F(f.messages.types[s],e.fullField,e.type)):s&&typeof r!==e.type&&n.push(F(f.messages.types[s],e.fullField,e.type))},ge=function(e,r,t,n,f){var a=typeof e.len=="number",s=typeof e.min=="number",d=typeof e.max=="number",q=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,v=r,m=null,l=typeof r=="number",O=typeof r=="string",x=Array.isArray(r);if(l?m="number":O?m="string":x&&(m="array"),!m)return!1;x&&(v=r.length),O&&(v=r.replace(q,"_").length),a?v!==e.len&&n.push(F(f.messages[m].len,e.fullField,e.len)):s&&!d&&ve.max?n.push(F(f.messages[m].max,e.fullField,e.max)):s&&d&&(ve.max)&&n.push(F(f.messages[m].range,e.fullField,e.min,e.max))},N="enum",ve=function(e,r,t,n,f){e[N]=Array.isArray(e[N])?e[N]:[],e[N].indexOf(r)===-1&&n.push(F(f.messages[N],e.fullField,e[N].join(", ")))},he=function(e,r,t,n,f){if(e.pattern){if(e.pattern instanceof RegExp)e.pattern.lastIndex=0,e.pattern.test(r)||n.push(F(f.messages.pattern.mismatch,e.fullField,r,e.pattern));else if(typeof e.pattern=="string"){var a=new RegExp(e.pattern);a.test(r)||n.push(F(f.messages.pattern.mismatch,e.fullField,r,e.pattern))}}},c={required:C,whitespace:ce,type:ye,range:ge,enum:ve,pattern:he},me=function(e,r,t,n,f){var a=[],s=e.required||!e.required&&n.hasOwnProperty(e.field);if(s){if(h(r,"string")&&!e.required)return t();c.required(e,r,n,a,f,"string"),h(r,"string")||(c.type(e,r,n,a,f),c.range(e,r,n,a,f),c.pattern(e,r,n,a,f),e.whitespace===!0&&c.whitespace(e,r,n,a,f))}t(a)},le=function(e,r,t,n,f){var a=[],s=e.required||!e.required&&n.hasOwnProperty(e.field);if(s){if(h(r)&&!e.required)return t();c.required(e,r,n,a,f),r!==void 0&&c.type(e,r,n,a,f)}t(a)},qe=function(e,r,t,n,f){var a=[],s=e.required||!e.required&&n.hasOwnProperty(e.field);if(s){if(r===""&&(r=void 0),h(r)&&!e.required)return t();c.required(e,r,n,a,f),r!==void 0&&(c.type(e,r,n,a,f),c.range(e,r,n,a,f))}t(a)},we=function(e,r,t,n,f){var a=[],s=e.required||!e.required&&n.hasOwnProperty(e.field);if(s){if(h(r)&&!e.required)return t();c.required(e,r,n,a,f),r!==void 0&&c.type(e,r,n,a,f)}t(a)},be=function(e,r,t,n,f){var a=[],s=e.required||!e.required&&n.hasOwnProperty(e.field);if(s){if(h(r)&&!e.required)return t();c.required(e,r,n,a,f),h(r)||c.type(e,r,n,a,f)}t(a)},Fe=function(e,r,t,n,f){var a=[],s=e.required||!e.required&&n.hasOwnProperty(e.field);if(s){if(h(r)&&!e.required)return t();c.required(e,r,n,a,f),r!==void 0&&(c.type(e,r,n,a,f),c.range(e,r,n,a,f))}t(a)},xe=function(e,r,t,n,f){var a=[],s=e.required||!e.required&&n.hasOwnProperty(e.field);if(s){if(h(r)&&!e.required)return t();c.required(e,r,n,a,f),r!==void 0&&(c.type(e,r,n,a,f),c.range(e,r,n,a,f))}t(a)},Oe=function(e,r,t,n,f){var a=[],s=e.required||!e.required&&n.hasOwnProperty(e.field);if(s){if(r==null&&!e.required)return t();c.required(e,r,n,a,f,"array"),r!=null&&(c.type(e,r,n,a,f),c.range(e,r,n,a,f))}t(a)},Ee=function(e,r,t,n,f){var a=[],s=e.required||!e.required&&n.hasOwnProperty(e.field);if(s){if(h(r)&&!e.required)return t();c.required(e,r,n,a,f),r!==void 0&&c.type(e,r,n,a,f)}t(a)},Ae="enum",Pe=function(e,r,t,n,f){var a=[],s=e.required||!e.required&&n.hasOwnProperty(e.field);if(s){if(h(r)&&!e.required)return t();c.required(e,r,n,a,f),r!==void 0&&c[Ae](e,r,n,a,f)}t(a)},je=function(e,r,t,n,f){var a=[],s=e.required||!e.required&&n.hasOwnProperty(e.field);if(s){if(h(r,"string")&&!e.required)return t();c.required(e,r,n,a,f),h(r,"string")||c.pattern(e,r,n,a,f)}t(a)},_e=function(e,r,t,n,f){var a=[],s=e.required||!e.required&&n.hasOwnProperty(e.field);if(s){if(h(r,"date")&&!e.required)return t();if(c.required(e,r,n,a,f),!h(r,"date")){var d;r instanceof Date?d=r:d=new Date(r),c.type(e,d,n,a,f),d&&c.range(e,d.getTime(),n,a,f)}}t(a)},Re=function(e,r,t,n,f){var a=[],s=Array.isArray(r)?"array":typeof r;c.required(e,r,n,a,f,s),t(a)},B=function(e,r,t,n,f){var a=e.type,s=[],d=e.required||!e.required&&n.hasOwnProperty(e.field);if(d){if(h(r,a)&&!e.required)return t();c.required(e,r,n,s,f,a),h(r,a)||c.type(e,r,n,s,f)}t(s)},Ne=function(e,r,t,n,f){var a=[],s=e.required||!e.required&&n.hasOwnProperty(e.field);if(s){if(h(r)&&!e.required)return t();c.required(e,r,n,a,f)}t(a)},S={string:me,method:le,number:qe,boolean:we,regexp:be,integer:Fe,float:xe,array:Oe,object:Ee,enum:Pe,pattern:je,date:_e,url:B,hex:B,email:B,required:Re,any:Ne};function Z(){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 e=JSON.parse(JSON.stringify(this));return e.clone=this.clone,e}}}var I=Z(),L=function(){function i(r){this.rules=null,this._messages=I,this.define(r)}var e=i.prototype;return e.define=function(t){var n=this;if(!t)throw new Error("Cannot configure a schema with no rules");if(typeof t!="object"||Array.isArray(t))throw new Error("Rules must be an object");this.rules={},Object.keys(t).forEach(function(f){var a=t[f];n.rules[f]=Array.isArray(a)?a:[a]})},e.messages=function(t){return t&&(this._messages=Q(Z(),t)),this._messages},e.validate=function(t,n,f){var a=this;n===void 0&&(n={}),f===void 0&&(f=function(){});var s=t,d=n,q=f;if(typeof d=="function"&&(q=d,d={}),!this.rules||Object.keys(this.rules).length===0)return q&&q(null,s),Promise.resolve(s);function v(u){var g=[],o={};function A(y){if(Array.isArray(y)){var b;g=(b=g).concat.apply(b,y)}else g.push(y)}for(var p=0;p