function B(t,r){for(var n=0;n<r.length;n++){var e=r[n];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}function S(t,r,n){return n&&B(t,n),t}function T(){return(T=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}return t}).apply(this,arguments)}function E(t,r){t.prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r}function N(t,r){if(t==null)return{};var n,e,u={},o=Object.keys(t);for(e=0;e<o.length;e++)r.indexOf(n=o[e])>=0||(u[n]=t[n]);return u}function x(t){return((r=t)!=null&&typeof r=="object"&&Array.isArray(r)===!1)==1&&Object.prototype.toString.call(t)==="[object Object]";var r}var V=Object.prototype,F=V.toString,D=V.hasOwnProperty,L=/^\s*function (\w+)/;function A(t){var r,n=(r=t?.type)!==null&&r!==void 0?r:t;if(n){var e=n.toString().match(L);return e?e[1]:""}return""}var b=function(t){var r,n;return x(t)!==!1&&typeof(r=t.constructor)=="function"&&x(n=r.prototype)!==!1&&n.hasOwnProperty("isPrototypeOf")!==!1},I=function(t){return t},l=I,j=function(t,r){return D.call(t,r)},J=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t},O=Array.isArray||function(t){return F.call(t)==="[object Array]"},m=function(t){return F.call(t)==="[object Function]"},w=function(t){return b(t)&&j(t,"_vueTypes_name")},Y=function(t){return b(t)&&(j(t,"type")||["_vueTypes_name","validator","default","required"].some(function(r){return j(t,r)}))};function P(t,r){return Object.defineProperty(t.bind(r),"__original",{value:t})}function g(t,r,n){var e,u=!0,o="";e=b(t)?t:{type:t};var f=w(e)?e._vueTypes_name+" - ":"";if(Y(e)&&e.type!==null){if(e.type===void 0||e.type===!0||!e.required&&r===void 0)return u;O(e.type)?(u=e.type.some(function(a){return g(a,r)===!0}),o=e.type.map(function(a){return A(a)}).join(" or ")):u=(o=A(e))==="Array"?O(r):o==="Object"?b(r):o==="String"||o==="Number"||o==="Boolean"||o==="Function"?(function(a){if(a==null)return"";var v=a.constructor.toString().match(L);return v?v[1]:""})(r)===o:r instanceof e.type}if(!u){var c=f+'value "'+r+'" should be of type "'+o+'"';return c}if(j(e,"validator")&&m(e.validator)){var i=l,s=[];if(l=function(a){s.push(a)},u=e.validator(r),l=i,!u){var p=(s.length>1?"* ":"")+s.join(`
* `);return s.length=0,p}}return u}function y(t,r){var n=Object.defineProperties(r,{_vueTypes_name:{value:t,writable:!0},isRequired:{get:function(){return this.required=!0,this}},def:{value:function(u){return u!==void 0||this.default?m(u)||g(this,u)===!0?(this.default=O(u)?function(){return[].concat(u)}:b(u)?function(){return Object.assign({},u)}:u,this):(l(this._vueTypes_name+' - invalid default value: "'+u+'"'),this):this}}}),e=n.validator;return m(e)&&(n.validator=P(e,n)),n}function h(t,r){var n=y(t,r);return Object.defineProperty(n,"validate",{value:function(e){return m(this.validator)&&l(this._vueTypes_name+` - calling .validate() will overwrite the current custom validator function. Validator info:
`+JSON.stringify(this)),this.validator=P(e,this),this}})}function q(t,r,n){var e,u,o=(e=r,u={},Object.getOwnPropertyNames(e).forEach(function(a){u[a]=Object.getOwnPropertyDescriptor(e,a)}),Object.defineProperties({},u));if(o._vueTypes_name=t,!b(n))return o;var f,c,i=n.validator,s=N(n,["validator"]);if(m(i)){var p=o.validator;p&&(p=(c=(f=p).__original)!==null&&c!==void 0?c:f),o.validator=P(p?function(a){return p.call(this,a)&&i.call(this,a)}:i,o)}return Object.assign(o,s)}function k(t){return t.replace(/^(?!\s*$)/gm,"  ")}var M=function(){return h("any",{})},R=function(){return h("function",{type:Function})},$=function(){return h("boolean",{type:Boolean})},z=function(){return h("string",{type:String})},C=function(){return h("number",{type:Number})},G=function(){return h("array",{type:Array})},H=function(){return h("object",{type:Object})},K=function(){return y("integer",{type:Number,validator:function(t){return J(t)}})},Q=function(){return y("symbol",{validator:function(t){return typeof t=="symbol"}})};function U(t,r){if(r===void 0&&(r="custom validation failed"),typeof t!="function")throw new TypeError("[VueTypes error]: You must provide a function as argument");return y(t.name||"<<anonymous function>>",{validator:function(n){var e=t(n);return e||l(this._vueTypes_name+" - "+r),e}})}function W(t){if(!O(t))throw new TypeError("[VueTypes error]: You must provide an array as argument.");var r='oneOf - value should be one of "'+t.join('", "')+'".',n=t.reduce(function(e,u){if(u!=null){var o=u.constructor;e.indexOf(o)===-1&&e.push(o)}return e},[]);return y("oneOf",{type:n.length>0?n:void 0,validator:function(e){var u=t.indexOf(e)!==-1;return u||l(r),u}})}function X(t){if(!O(t))throw new TypeError("[VueTypes error]: You must provide an array as argument");for(var r=!1,n=[],e=0;e<t.length;e+=1){var u=t[e];if(Y(u)){if(w(u)&&u._vueTypes_name==="oneOf"){n=n.concat(u.type);continue}if(m(u.validator)&&(r=!0),u.type!==!0&&u.type){n=n.concat(u.type);continue}}n.push(u)}return n=n.filter(function(o,f){return n.indexOf(o)===f}),y("oneOfType",r?{type:n,validator:function(o){var f=[],c=t.some(function(i){var s=g(w(i)&&i._vueTypes_name==="oneOf"?i.type||null:i,o);return typeof s=="string"&&f.push(s),s===!0});return c||l("oneOfType - provided value does not match any of the "+f.length+` passed-in validators:
`+k(f.join(`
`))),c}}:{type:n})}function Z(t){return y("arrayOf",{type:Array,validator:function(r){var n,e=r.every(function(u){return(n=g(t,u))===!0});return e||l(`arrayOf - value validation error:
`+k(n)),e}})}function tt(t){return y("instanceOf",{type:t})}function et(t){return y("objectOf",{type:Object,validator:function(r){var n,e=Object.keys(r).every(function(u){return(n=g(t,r[u]))===!0});return e||l(`objectOf - value validation error:
`+k(n)),e}})}function rt(t){var r=Object.keys(t),n=r.filter(function(u){var o;return!!(!((o=t[u])===null||o===void 0)&&o.required)}),e=y("shape",{type:Object,validator:function(u){var o=this;if(!b(u))return!1;var f=Object.keys(u);if(n.length>0&&n.some(function(i){return f.indexOf(i)===-1})){var c=n.filter(function(i){return f.indexOf(i)===-1});return l(c.length===1?'shape - required property "'+c[0]+'" is not defined.':'shape - required properties "'+c.join('", "')+'" are not defined.'),!1}return f.every(function(i){if(r.indexOf(i)===-1)return o._vueTypes_isLoose===!0||(l('shape - shape definition does not include a "'+i+'" property. Allowed keys: "'+r.join('", "')+'".'),!1);var s=g(t[i],u[i]);return typeof s=="string"&&l('shape - "'+i+`" property validation error:
 `+k(s)),s===!0})}});return Object.defineProperty(e,"_vueTypes_isLoose",{writable:!0,value:!1}),Object.defineProperty(e,"loose",{get:function(){return this._vueTypes_isLoose=!0,this}}),e}var d=(function(){function t(){}return t.extend=function(r){var n=this;if(O(r))return r.forEach(function(a){return n.extend(a)}),this;var e=r.name,u=r.validate,o=u!==void 0&&u,f=r.getter,c=f!==void 0&&f,i=N(r,["name","validate","getter"]);if(j(this,e))throw new TypeError('[VueTypes error]: Type "'+e+'" already defined');var s,p=i.type;return w(p)?(delete i.type,Object.defineProperty(this,e,c?{get:function(){return q(e,p,i)}}:{value:function(){var a,v=q(e,p,i);return v.validator&&(v.validator=(a=v.validator).bind.apply(a,[v].concat([].slice.call(arguments)))),v}})):(s=c?{get:function(){var a=Object.assign({},i);return o?h(e,a):y(e,a)},enumerable:!0}:{value:function(){var a,v,_=Object.assign({},i);return a=o?h(e,_):y(e,_),_.validator&&(a.validator=(v=_.validator).bind.apply(v,[a].concat([].slice.call(arguments)))),a},enumerable:!0},Object.defineProperty(this,e,s))},S(t,null,[{key:"any",get:function(){return M()}},{key:"func",get:function(){return R().def(this.defaults.func)}},{key:"bool",get:function(){return $().def(this.defaults.bool)}},{key:"string",get:function(){return z().def(this.defaults.string)}},{key:"number",get:function(){return C().def(this.defaults.number)}},{key:"array",get:function(){return G().def(this.defaults.array)}},{key:"object",get:function(){return H().def(this.defaults.object)}},{key:"integer",get:function(){return K().def(this.defaults.integer)}},{key:"symbol",get:function(){return Q()}}]),t})();function nt(t){var r;return t===void 0&&(t={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),(r=(function(n){function e(){return n.apply(this,arguments)||this}return E(e,n),S(e,null,[{key:"sensibleDefaults",get:function(){return T({},this.defaults)},set:function(u){this.defaults=u!==!1?T({},u!==!0?u:t):{}}}]),e})(d)).defaults=T({},t),r}d.defaults={},d.custom=U,d.oneOf=W,d.instanceOf=tt,d.oneOfType=X,d.arrayOf=Z,d.objectOf=et,d.shape=rt,d.utils={validate:function(t,r){return g(r,t)===!0},toType:function(t,r,n){return n===void 0&&(n=!1),n?h(t,r):y(t,r)}};(function(t){function r(){return t.apply(this,arguments)||this}return E(r,t),r})(nt());export{M as any,G as array,Z as arrayOf,$ as bool,nt as createTypes,U as custom,q as fromType,R as func,tt as instanceOf,K as integer,C as number,H as object,et as objectOf,W as oneOf,X as oneOfType,rt as shape,z as string,Q as symbol,y as toType,h as toValidableType,g as validateType};
