Socket
Socket
Sign inDemoInstall

vee-validate

Package Overview
Dependencies
Maintainers
1
Versions
339
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vee-validate - npm Package Compare versions

Comparing version 2.0.0-beta.13 to 2.0.0-beta.14

__tests__/dictionary.js

12

contributing.md

@@ -13,3 +13,3 @@ # Contributing to Vee-Validate

`npm install`
`npm install` or `yarn`

@@ -28,3 +28,3 @@ Check the `scripts` section of `package.json` for any npm scripts that might find useful.

- `dist` contains the unminified and the minified build of the repository.
- `test` contains the test files for the project, it uses [avajs](https://github.com/avajs/ava) for testing. it contains a similar folder structure as the `src` folder.
- `__tests__` contains the test files for the project, it uses [jest](https://facebook.github.io/jest/) for testing. it contains a similar folder structure as the `src` folder.

@@ -35,3 +35,3 @@ If you want to contribute to the docs you can find it [here](https://github.com/logaretm/vee-validate-docs).

Currently we are using ES2015 (ES6) for the source code, using Babel and Rollup to convert it to ES5.
Currently we are using ES2015 (ES6) for the source code, using Babel and Rollup to convert it to ES5, the available builds are: non-minified, minified and es6.

@@ -46,6 +46,2 @@ ### Testing

or
`npm run test:watch`
Currently I'm not testing the directive and the mixin, I will work on adding those tests later if I can, help will be appreciated.

@@ -55,2 +51,2 @@

Use `npm run build` to build the project both minified and unminified versions.
Use `npm run build` to build the project both minified and unminified versions as well as the es6 version.

@@ -5,2 +5,3 @@ export default {

alpha_num: (field) => `${field} قد يحتوي فقط على حروف وارقام.`,
alpha_spaces: (field) => `${field} قد يحتوي فقط على حروف ومسافات.`,
alpha: (field) => `${field} يجب ان يحتوي على حروف فقط.`,

@@ -7,0 +8,0 @@ before: (field, [target]) => `${field} يجب ان يكون قبل ${target}.`,

export default {
after: (field, [target]) => ` ${field} muss nach ${target} liegen.`,
after: (field, [target]) => `${field} muss nach ${target} liegen.`,
alpha_dash: (field) => `${field} darf alphanumerische Zeichen sowie Striche und Unterstriche enthalten.`,
alpha_num: (field) => `${field} darf nur alphanumerische Zeichen enthalten.`,
alpha: (field) => `${field} darf nur alphabetische Zeichen enthalten.`,
before: (field, [target]) => `${field} muss vor ${target} liegen.`,
before: (field, [target]) => `${field} muss vor ${target} liegen.`,
between: (field, [min, max]) => `${field} muss zwischen ${min} und ${max} liegen.`,

@@ -11,11 +11,11 @@ confirmed: (field, [confirmedField]) => `${field} passt nicht zum Inhalt von ${confirmedField}.`,

date_format: (field, [format]) => `${field} muss das Format ${format} haben.`,
decimal: (field, [decimals] = ['*']) => `${field} muss numerisch darf ${decimals === '*' ? '' : decimals} Dezimalpunkte enthalten.`,
decimal: (field, [decimals] = ['*']) => `${field} muss numerisch sein und darf ${decimals === '*' ? '' : decimals} Dezimalpunkte enthalten.`,
digits: (field, [length]) => `${field} muss numerisch sein und exakt ${length} Ziffern enthalten.`,
dimensions: (field, [width, height]) => `${field} muss ${width} x ${height} Bildpunkte groß sein.`,
email: (field) => `${field} muss eine gültige Emailadresse sein.`,
ext: (field) => ` ${field} muss eine gültige Datei sein.`,
email: (field) => `${field} muss eine gültige E-Mail-Adresse sein.`,
ext: (field) => `${field} muss eine gültige Datei sein.`,
image: (field) => `${field} muss eine Grafik sein.`,
in: (field) => `${field} muss ein gültiger Wert sein.`,
ip: (field) => `${field} muss eine gültige IP-Adresse sein.`,
max: (field, [length]) => `${field} darf nicht größer als ${length} Zeichen sein.`,
max: (field, [length]) => `${field} darf nicht länger als ${length} Zeichen sein.`,
mimes: (field) => `${field} muss einen gültigen Dateityp haben.`,

@@ -28,3 +28,3 @@ min: (field, [length]) => `${field} muss mindestens ${length} Zeichen lang sein.`,

size: (field, [size]) => `${field} muss kleiner als ${size} KB sein.`,
url: (field) => `${field} ist keine gültige URL.`
url: (field) => `${field} ist keine gültige URL.`,
};

@@ -5,2 +5,3 @@ export default {

alpha_num: (field) => `The ${field} may only contain alpha-numeric characters.`,
alpha_spaces: (field) => `The ${field} may only contain alphabetic characters as well as spaces.`,
alpha: (field) => `The ${field} may only contain alphabetic characters.`,

@@ -7,0 +8,0 @@ before: (field, [target]) => `The ${field} must be before ${target}.`,

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.VeeValidate=t()}(this,function(){"use strict";var e=function(e){return/^(([^<>()[\]\\.,;:#\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,6}))$/.test(e)},t=function(e,t){return!!t.filter(function(t){return t==e}).length},n=function(e){return Array.isArray(e)?!!e.length:void 0!==e&&null!==e&&!!String(e).trim().length},i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},r=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},o=function(){function e(e,t){var n=[],i=!0,r=!1,a=void 0;try{for(var s,o=e[Symbol.iterator]();!(i=(s=o.next()).done)&&(n.push(s.value),!t||n.length!==t);i=!0);}catch(u){r=!0,a=u}finally{try{!i&&o["return"]&&o["return"]()}finally{if(r)throw a}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=function(e){return Array.isArray(e)?e:Array.from(e)},l=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},c=function(e,t){var n=o(t,1),i=n[0];return void 0!==e&&null!==e&&String(e).length>=i},f=function(e,t){var n=o(t,1),i=n[0];return void 0===e||null===e?i>=0:String(e).length<=i},d=function(e,t){return!t.filter(function(t){return t==e}).length},h=function(e){return!Array.isArray(e)&&/^[a-zA-Z]*$/.test(e)},v=function(e){return!Array.isArray(e)&&/^[a-zA-Z0-9]*$/.test(e)},m=function(e){return!Array.isArray(e)&&/^[a-zA-Z0-9_-]*$/.test(e)},y=function(e){return!Array.isArray(e)&&/^[0-9]*$/.test(e)},g=function(e,t){var n=u(t),i=n[0],r=n.slice(1);return i instanceof RegExp?i.test(e):new RegExp(i,r).test(String(e))},p=function(e){return/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(e)},b=function(e,t){for(var n=new RegExp(".("+t.join("|")+")$","i"),i=0;i<e.length;i++)if(!n.test(e[i].name))return!1;return!0},k=function(e,t){for(var n=new RegExp(t.join("|").replace("*",".+")+"$","i"),i=0;i<e.length;i++)if(!n.test(e[i].type))return!1;return!0},_=function(e,t){var n=o(t,1),i=n[0];if(isNaN(i))return!1;for(var r=1024*Number(i),a=0;a<e.length;a++)if(e[a].size>r)return!1;return!0},$=function(e,t){var n=o(t,1),i=n[0],r=String(e);return/^[0-9]*$/.test(r)&&r.length===Number(i)},x=function(e){for(var t=0;t<e.length;t++)if(!/\.(jpg|svg|jpeg|png|bmp|gif)$/i.test(e[t].name))return!1;return!0},w=function(e,t,n){var i=window.URL||window.webkitURL;return new Promise(function(r){var a=new Image;a.onerror=function(){return r({valid:!1})},a.onload=function(){return r({valid:a.width===Number(t)&&a.height===Number(n)})},a.src=i.createObjectURL(e)})},A=function(e,t){for(var n=o(t,2),i=n[0],r=n[1],a=[],s=0;s<e.length;s++){if(!/\.(jpg|svg|jpeg|png|bmp|gif)$/i.test(e[s].name))return!1;a.push(e[s])}return Promise.all(a.map(function(e){return w(e,i,r)}))},E=function(e,t){var n=o(t,2),i=n[0],r=n[1];return Number(i)<=e&&Number(r)>=e},T=function(e,t){var n=o(t,1),i=n[0],r=document.querySelector("input[name='"+i+"']");return!(!r||String(e)!==r.value)},L=function(e,t){var n=/^https?:\/\/([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w\.\(\)%-]*)*\/?$/.test(e),i=t&&t[0];return i&&n?new RegExp("^https?://(([da-z.-]+).)*("+t[0].replace(".","\\$&")+")").test(e):n},j=function(e){var t=arguments.length<=1||void 0===arguments[1]?["*"]:arguments[1],n=o(t,1),i=n[0];if(Array.isArray(e))return!1;if(null===e||void 0===e||""===e)return!0;var r="*"===i?"*":"{0,"+i+"}",a=new RegExp("^[0-9]*.?[0-9]"+r+"$");return!!a.test(e)&&!Number.isNaN(parseFloat(e))},S={email:e,min:c,max:f,required:n,"in":t,not_in:d,alpha:h,alpha_num:v,alpha_dash:m,numeric:y,regex:g,ip:p,ext:b,mimes:k,size:_,digits:$,image:x,dimensions:A,between:E,confirmed:T,url:L,decimal:j},N=function(){function e(){r(this,e),this.errors=[]}return a(e,[{key:"add",value:function(e,t,n){var i={field:e,msg:t};n&&(i.scope=n),this.errors.push(i)}},{key:"all",value:function(e){return e?this.errors.filter(function(t){return t.scope===e}).map(function(e){return e.msg}):this.errors.map(function(e){return e.msg})}},{key:"any",value:function(e){return e?!!this.errors.filter(function(t){return t.scope===e}).length:!!this.errors.length}},{key:"clear",value:function(e){return e?void(this.errors=this.errors.filter(function(t){return t.scope!==e})):void(this.errors=[])}},{key:"collect",value:function(e,t){var n=this;if(!e){var r=function(){var e={};return n.errors.forEach(function(t){e[t.field]||(e[t.field]=[]),e[t.field].push(t.msg)}),{v:e}}();if("object"===("undefined"==typeof r?"undefined":i(r)))return r.v}return t?this.errors.filter(function(n){return n.field===e&&n.scope===t}).map(function(e){return e.msg}):this.errors.filter(function(t){return t.field===e}).map(function(e){return e.msg})}},{key:"count",value:function(){return this.errors.length}},{key:"first",value:function(e,t){for(var n=0;n<this.errors.length;n++)if(this.errors[n].field===e){if(!t)return this.errors[n].msg;if(this.errors[n].scope===t)return this.errors[n].msg}return null}},{key:"has",value:function(e,t){for(var n=0;n<this.errors.length;n++)if(this.errors[n].field===e){if(!t)return!0;if(this.errors[n].scope===t)return!0}return!1}},{key:"remove",value:function(e,t){return t?void(this.errors=this.errors.filter(function(n){return n.field!==e||n.scope!==t})):void(this.errors=this.errors.filter(function(t){return t.field!==e}))}}]),e}(),B=function(){function e(t){r(this,e),this.msg=t}return a(e,[{key:"toString",value:function(){return this.msg}}]),e}(),O=function(){function e(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];r(this,e),this.dictionary={},this.merge(t)}return a(e,[{key:"hasLocale",value:function(e){return!!this.dictionary[e]}},{key:"getMessage",value:function(e,t){var n=arguments.length<=2||void 0===arguments[2]?"":arguments[2];return this.hasMessage(e,t)?this.dictionary[e].messages[t]:n}},{key:"getAttribute",value:function(e,t){var n=arguments.length<=2||void 0===arguments[2]?"":arguments[2];return this.hasAttribute(e,t)?this.dictionary[e].attributes[t]:n}},{key:"hasMessage",value:function(e,t){return!!(this.hasLocale(e)&&this.dictionary[e].messages&&this.dictionary[e].messages[t])}},{key:"hasAttribute",value:function(e,t){return!!(this.hasLocale(e)&&this.dictionary[e].attributes&&this.dictionary[e].attributes[t])}},{key:"merge",value:function(e){this._merge(this.dictionary,e)}},{key:"setMessage",value:function(e,t,n){this.hasLocale(e)||(this.dictionary[e]={messages:{},attributes:{}}),this.dictionary[e].messages[t]=n}},{key:"setAttribute",value:function(e,t,n){this.hasLocale(e)||(this.dictionary[e]={messages:{},attributes:{}}),this.dictionary[e].attributes[t]=n}},{key:"_isObject",value:function(e){return e&&"object"===("undefined"==typeof e?"undefined":i(e))&&!Array.isArray(e)&&null!==e}},{key:"_merge",value:function(e,t){var n=this;if(!this._isObject(e)||!this._isObject(t))return e;var i=Object.assign||this._assign;return Object.keys(t).forEach(function(r){return n._isObject(t[r])?(e[r]||i(e,s({},r,{})),void n._merge(e[r],t[r])):void i(e,s({},r,t[r]))}),e}},{key:"_assign",value:function(e){for(var t=arguments,n=Object(e),i=function(e){var i=t[e];void 0!==i&&null!==i&&Object.keys(i).forEach(function(e){({}).hasOwnProperty.call(i,e)&&(n[e]=i[e])})},r=1;r<arguments.length;r++)i(r);return n}}]),e}(),M={alpha_dash:function(e){return"The "+e+" may contain alpha-numeric characters as well as dashes and underscores."},alpha_num:function(e){return"The "+e+" may only contain alpha-numeric characters."},alpha:function(e){return"The "+e+" may only contain alphabetic characters."},between:function(e,t){var n=o(t,2),i=n[0],r=n[1];return"The "+e+" must be between "+i+" and "+r+"."},confirmed:function(e,t){var n=o(t,1),i=n[0];return"The "+e+" does not match the "+i+"."},decimal:function(e){var t=arguments.length<=1||void 0===arguments[1]?["*"]:arguments[1],n=o(t,1),i=n[0];return"The "+e+" must be numeric and may contain "+("*"===i?"":i)+" decimal points."},digits:function(e,t){var n=o(t,1),i=n[0];return"The "+e+" must be numeric and exactly contain "+i+" digits."},dimensions:function(e,t){var n=o(t,2),i=n[0],r=n[1];return"The "+e+" must be "+i+" pixels by "+r+" pixels."},email:function(e){return"The "+e+" must be a valid email."},ext:function(e){return"The "+e+" must be a valid file."},image:function(e){return"The "+e+" must be an image."},"in":function(e){return"The "+e+" must be a valid value."},ip:function(e){return"The "+e+" must be a valid ip address."},max:function(e,t){var n=o(t,1),i=n[0];return"The "+e+" may not be greater than "+i+" characters."},mimes:function(e){return"The "+e+" must have a valid file type."},min:function(e,t){var n=o(t,1),i=n[0];return"The "+e+" must be at least "+i+" characters."},not_in:function(e){return"The "+e+" must be a valid value."},numeric:function(e){return"The "+e+" may only contain numeric characters."},regex:function(e){return"The "+e+" format is invalid."},required:function(e){return"The "+e+" is required."},size:function(e,t){var n=o(t,1),i=n[0];return"The "+e+" must be less than "+i+" KB."},url:function(e){return"The "+e+" is not a valid URL."}},V=function(e){return e.dataset.scope||e.form&&e.form.dataset.scope},F=function(e){var t=arguments.length<=1||void 0===arguments[1]?100:arguments[1],n=!(arguments.length<=2||void 0===arguments[2])&&arguments[2];if(!t)return e;var i=void 0;return function(r){function a(){n||e.apply(c,o),i=null}var s=u(r),o=s,c=this;i?clearTimeout(i):n&&e.apply.apply(e,[c].concat(l(o))),i=setTimeout(a,t||100)}},D=function(e){console&&console.warn("vee-validate: "+e)},R=function(e){return function(t,n){var i=o(n,2),r=i[0],a=i[1],s=e(t,a,!0),u=document.querySelector("input[name='"+r+"']");if(!s.isValid()||!u)return!1;var l=e(u.value,a,!0);return!!l.isValid()&&s.isAfter(l)}},q=function(e){return function(t,n){var i=o(n,2),r=i[0],a=i[1],s=e(t,a,!0),u=document.querySelector("input[name='"+r+"']");if(!s.isValid()||!u)return!1;var l=e(u.value,a,!0);return!!l.isValid()&&s.isBefore(l)}},z=function(e){return function(t,n){var i=o(n,1),r=i[0];return e(t,r,!0).isValid()}},P=function(e){return function(t,n){var i=o(n,3),r=i[0],a=i[1],s=i[2],u=e(r,s,!0),l=e(a,s,!0),c=e(t,s,!0);return!!(u.isValid()&&l.isValid()&&c.isValid())&&c.isBetween(u,l)}},U={after:function(e,t){var n=o(t,1),i=n[0];return"The "+e+" must be after "+i+"."},before:function(e,t){var n=o(t,1),i=n[0];return"The "+e+" must be before "+i+"."},date_between:function(e,t){var n=o(t,2),i=n[0],r=n[1];return"The "+e+" must be between "+i+" and "+r+"."},date_format:function(e,t){var n=o(t,1),i=n[0];return"The "+e+" must be in the format "+i+"."}},Z={make:function(e){return{date_format:z(e),after:R(e),before:q(e),date_between:P(e)}},messages:U,installed:!1},C=function(){function e(){r(this,e),this.fields=new Proxy({},{get:function(e,t){return t in e||"string"!=typeof t||(e[t]={}),e[t]}})}return a(e,[{key:"_add",value:function(e){this._setFlags(e,{dirty:!1,valid:!1},!0)}},{key:"_remove",value:function(e){delete this.fields[e]}},{key:"_setFlags",value:function(e,t){var n=this,i=!(arguments.length<=2||void 0===arguments[2])&&arguments[2];Object.keys(t).forEach(function(r){return n._setFlag(e,r,t[r],i)})}},{key:"_setFlag",value:function(e,t,n){var i=!(arguments.length<=3||void 0===arguments[3])&&arguments[3],r="set"+t.charAt(0).toUpperCase()+t.slice(1);"function"==typeof this[r]&&this[r](e,n,i)}},{key:"setDirty",value:function(e,t){var n=!(arguments.length<=2||void 0===arguments[2])&&arguments[2];this.fields[e].dirty=t,this.fields[e].clean=n||!t,this.fields[e].passed=this.fields[e].valid&&t,this.fields[e].failed=!this.fields[e].valid&&t}},{key:"setValid",value:function(e,t){this.fields[e].valid=t,this.fields[e].passed=this.fields[e].dirty&&t,this.fields[e].failed=this.fields[e].dirty&&!t}}]),e}(),I="veeValidate",Y="en",K=!0,G=new O({en:{messages:M,attributes:{}}}),H=function(){function e(t,n){r(this,e),this.locale=Y,this.strictMode=K,this.$fields={},this.fieldBag=new C,this._createFields(t),this.errorBag=new N,this.$vm=n,"function"==typeof moment&&this.installDateTimeValidators(moment)}return a(e,[{key:"installDateTimeValidators",value:function(t){e.installDateTimeValidators(t)}},{key:"setStrictMode",value:function(){var e=arguments.length<=0||void 0===arguments[0]||arguments[0];this.strictMode=e}},{key:"setLocale",value:function(e){G.hasLocale(e)||D("You are setting the validator locale to a locale that is not defined in the dicitionary. English messages may still be generated."),this.locale=e}},{key:"attach",value:function(e,t){var n=arguments.length<=2||void 0===arguments[2]?null:arguments[2];this.errorBag.remove(e),this._createField(e,t),n&&(this.$fields[e].name=n)}},{key:"updateDictionary",value:function(t){e.updateDictionary(t)}},{key:"detach",value:function(e){delete this.$fields[e],this.fieldBag._remove(e)}},{key:"extend",value:function(t,n){e.extend(t,n)}},{key:"validateAll",value:function(e){var t=this;if(this.$vm&&(!e||"string"==typeof e))return this.errorBag.clear(e),void this.$vm.$emit(I,e);var n=!0,i=[];return this.errorBag.clear(),Object.keys(e).forEach(function(r){var a=t.validate(r,e[r]);return"function"==typeof a.then?void i.push(a):void(n=n&&a)}),i.length?Promise.all(i).then(function(e){return e.every(function(e){return e})&&n}):n}},{key:"validate",value:function(e,t,n){var i=this;if(!this.$fields[e])return!this.strictMode||(D('Trying to validate a non-existant field: "'+e+'". Use "attach()" first.'),!1);if(this.errorBag.remove(e,n),!this.$fields[e].required&&~[null,void 0,""].indexOf(t))return!0;var r=!0,a=[];return this.$fields[e].validations.forEach(function(s){var o=i._test(e,t,s,n);return"function"==typeof o.then?void a.push(o):void(r=r&&o)}),a.length?Promise.all(a).then(function(t){var n=t.every(function(e){return e})&&r;return i.fieldBag._setFlags(e,{valid:n,dirty:!0}),n}):(this.fieldBag._setFlags(e,{valid:r,dirty:!0}),r)}},{key:"_createFields",value:function(e){var t=this;e&&Object.keys(e).forEach(function(n){t._createField(n,e[n])})}},{key:"_createField",value:function(e,t){var n=this;return this.$fields[e]||(this.$fields[e]={}),this.fieldBag._add(e),this.$fields[e].validations=[],Array.isArray(t)?void(this.$fields[e].validations=t):void t.split("|").forEach(function(t){var i=n._normalizeRule(t,n.$fields[e].validations);"required"===i.name&&(n.$fields[e].required=!0),n.$fields[e].validations.push(i)})}},{key:"_normalizeRule",value:function(e,t){var n=[],i=e.split(":")[0];if(~e.indexOf(":")&&(n=e.split(":")[1].split(",")),Z.installed&&~["after","before","date_between"].indexOf(i)){var r=t.filter(function(e){return"date_format"===e.name})[0];r&&n.push(r.params[0])}return{name:i,params:n}}},{key:"_formatErrorMessage",value:function(e,t){return G.hasLocale(this.locale)&&"function"==typeof G.getMessage(this.locale,t.name)?G.getMessage(this.locale,t.name)(e,t.params):G.getMessage("en",t.name)(e,t.params)}},{key:"_getFieldDisplayName",value:function(e){return this.$fields[e].name||G.getAttribute(this.locale,e,e)}},{key:"_test",value:function(e,t,n,i){var r=this,a=S[n.name],s=a(t,n.params),o=this._getFieldDisplayName(e);return"function"==typeof s.then?s.then(function(t){var a=Array.isArray(t)?t.every(function(e){return e.valid}):t.valid;return a||r.errorBag.add(e,r._formatErrorMessage(o,n),i),a}):(s||this.errorBag.add(e,this._formatErrorMessage(o,n),i),s)}},{key:"getErrors",value:function(){return this.errorBag}}],[{key:"setDefaultLocale",value:function(){var e=arguments.length<=0||void 0===arguments[0]?"en":arguments[0];G.hasLocale(e)||D("You are setting the validator locale to a locale that is not defined in the dicitionary. English messages may still be generated."),Y=e}},{key:"setStrictMode",value:function(){var e=arguments.length<=0||void 0===arguments[0]||arguments[0];K=e}},{key:"installDateTimeValidators",value:function(t){if("function"!=typeof t)return D("To use the date-time validators you must provide moment reference."),!1;if(Z.installed)return!0;var n=Z.make(t);return Object.keys(n).forEach(function(t){e.extend(t,n[t])}),e.updateDictionary({en:{messages:Z.messages}}),Z.installed=!0,!0}},{key:"updateDictionary",value:function(e){G.merge(e)}},{key:"create",value:function(t,n){return new e(t,n)}},{key:"extend",value:function(t,n){e._guardExtend(t,n),e._merge(t,n)}},{key:"_merge",value:function(e,t){return"function"==typeof t?(S[e]=t,void G.setMessage("en",e,function(e){return"The "+e+" value is not valid."})):(S[e]=t.validate,t.getMessage&&"function"==typeof t.getMessage&&G.setMessage("en",e,t.getMessage),void(t.messages&&G.merge(Object.keys(t.messages).reduce(function(n,i){var r=n;return r[i]={messages:s({},e,t.messages[i])},r},{}))))}},{key:"_guardExtend",value:function(e,t){if(S[e])throw new B("Extension Error: There is an existing validator with the same name '"+e+"'.");if("function"!=typeof t){if("function"!=typeof t.validate)throw new B("Extension Error: The validator '"+e+"' must be a function or have a 'validate' method.");if("function"!=typeof t.getMessage&&"object"!==i(t.messages))throw new B("Extension Error: The validator '"+e+"' must have a 'getMessage' method or have a 'messages' object.")}}}]),e}(),J=[],Q=function(e){for(var t=0;t<J.length;t++)if(J[t].$vm===e)return J[t].$validator},W=function(e){var t=Q(e);return t||(t=H.create(void 0,e),J.push({$vm:e,$validator:t})),t},X=function(e){for(var t=0;t<J.length;t++)if(J[t].$vm===e)return J.splice(t,1),!0;return!1},ee=function(e){return{data:function(){return s({},e.errorBagName,this.$validator.errorBag)},computed:s({},e.fieldsBagName,{get:function(){return this.$validator.fieldBag.fields}}),mounted:function(){this.$emit("validatorReady")},destroyed:function(){X(this)}}},te="veeValidate",ne=function(){function e(t,n,i,a){r(this,e),this.callbacks=[],this.el=t,this.binding=n,this.vm=i,this.options=a,this.fieldName=n.expression||t.name}return a(e,[{key:"_hasFieldDependency",value:function(e){var t=e.split("|").filter(function(e){return!!e.match(/confirmed|after|before/)});return!!t.length&&t[0].split(":")[1]}},{key:"_inputListener",value:function(){this.vm.$validator.validate(this.fieldName,this.el.value,V(this.el))}},{key:"_fileListener",value:function(){var e=this.vm.$validator.validate(this.fieldName,this.el.files,V(this.el));!e&&this.binding.modifiers.reject&&(el.value="")}},{key:"_radioListener",value:function(){var e=document.querySelector('input[name="'+this.el.name+'"]:checked');return e?void this.vm.$validator.validate(this.fieldName,e.value,V(this.el)):void this.vm.$validator.validate(this.fieldName,null,V(this.el))}},{key:"_checkboxListener",value:function(){var e=this,t=document.querySelectorAll('input[name="'+this.el.name+'"]:checked');return t&&t.length?void[].concat(l(t)).forEach(function(t){e.vm.$validator.validate(e.fieldName,t.value,V(e.el))}):void this.vm.$validator.validate(this.fieldName,null,V(this.el))}},{key:"_getScopedListener",value:function(e){var t=this;return function(n){(!n||n===V(t.el)||n instanceof Event)&&e()}}},{key:"_attachValidatorEvent",value:function(){var e=this,t=this._getScopedListener(this._getSuitableListener().listener.bind(this));this.vm.$on(te,t),this.callbacks.push({event:te,listener:t});var n=this._hasFieldDependency(this.el.dataset.rules);n&&this.vm.$once("validatorReady",function(){var i=document.querySelector("input[name='"+n+"']");return i?(i.addEventListener("input",t),void e.callbacks.push({event:"input",listener:t,el:i})):void D("Cannot find target field, no additional listeners were attached.")})}},{key:"_getSuitableListener",value:function(){return"file"===this.el.type?{name:"change",listener:this._fileListener}:"radio"===this.el.type?{name:"change",listener:this._radioListener}:"checkbox"===this.el.type?{name:"change",listener:this._checkboxListener}:{name:"input",listener:this._inputListener}}},{key:"_attachFieldListeners",value:function(){var e=this,t=this._getSuitableListener(),n=F(t.listener.bind(this),this.el.dataset.delay||this.options.delay);return~["radio","checkbox"].indexOf(this.el.type)?void this.vm.$once("validatorReady",function(){[].concat(l(document.querySelectorAll('input[name="'+e.el.name+'"]'))).forEach(function(i){i.addEventListener(t.name,n),e.callbacks.push({event:t.name,callback:n,el:i})})}):(this.el.addEventListener(t.name,n),void this.callbacks.push({event:t.name,callback:n,el:this.el}))}},{key:"attach",value:function(){return this.vm.$validator.attach(this.fieldName,this.el.dataset.rules,this.el.dataset.as),this._attachValidatorEvent(),this.binding.expression?void(this.binding.modifiers.initial||this.vm.$validator.validate(this.binding.expression,this.binding.value,V(this.el))):void this._attachFieldListeners()}},{key:"detach",value:function(){this.vm.$off(te,this.callbacks.filter(function(e){var t=e.event;return t===te})[0]),this.callbacks.filter(function(e){var t=e.event;return t!==te}).forEach(function(e){e.el.removeEventListener(e.event,e.listener)})}}]),e}(),ie=[],re=function(e){return{bind:function(t,n,i){var r=i.context,a=new ne(t,n,r,e);a.attach(),ie.push({vm:r,el:t,instance:a})},update:function(e,t,n){var i=t.expression,r=t.value,a=(t.modifiers,t.oldValue),s=n.context;i&&r!==a&&s.$validator.validate(i||e.name,r,V(e))},unbind:function(e,t,n){var i=n.context,r=ie.filter(function(t){return t.vm===i&&t.el===e})[0];r.instance.detach(),ie.splice(ie.indexOf(r),1)}}},ae=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=t.locale,i=void 0===n?"en":n,r=t.delay,a=void 0===r?0:r,s=t.errorBagName,o=void 0===s?"errors":s,u=t.dictionary,l=void 0===u?null:u,c=t.strict,f=void 0===c||c,d=t.fieldsBagName,h=void 0===d?"fields":d;l&&H.updateDictionary(l),H.setDefaultLocale(i),H.setStrictMode(f);var v={locale:i,delay:a,dictionary:l,errorBagName:o,fieldsBagName:h};Object.defineProperties(e.prototype,{$validator:{get:function(){return W(this)}}}),e.mixin(ee(v)),e.directive("validate",re(v))},se={install:ae,Validator:H,ErrorBag:N};return se});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.VeeValidate=t()}(this,function(){"use strict";var e=function(e){return!Array.isArray(e)&&/^[a-zA-Z]*$/.test(e)},t=function(e){return!Array.isArray(e)&&/^[a-zA-Z0-9_-]*$/.test(e)},n=function(e){return!Array.isArray(e)&&/^[a-zA-Z0-9]*$/.test(e)},i=function(e){return/^[a-zA-Z\s]*$/.test(String(e))},r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=(function(){function e(e){this.value=e}function t(t){function n(e,t){return new Promise(function(n,r){var o={key:e,arg:t,resolve:n,reject:r,next:null};s?s=s.next=o:(a=s=o,i(e,t))})}function i(n,a){try{var s=t[n](a),o=s.value;o instanceof e?Promise.resolve(o.value).then(function(e){i("next",e)},function(e){i("throw",e)}):r(s.done?"return":"normal",s.value)}catch(e){r("throw",e)}}function r(e,t){switch(e){case"return":a.resolve({value:t,done:!0});break;case"throw":a.reject(t);break;default:a.resolve({value:t,done:!1})}a=a.next,a?i(a.key,a.arg):s=null}var a,s;this._invoke=n,"function"!=typeof t.return&&(this.return=void 0)}return"function"==typeof Symbol&&Symbol.asyncIterator&&(t.prototype[Symbol.asyncIterator]=function(){return this}),t.prototype.next=function(e){return this._invoke("next",e)},t.prototype.throw=function(e){return this._invoke("throw",e)},t.prototype.return=function(e){return this._invoke("return",e)},{wrap:function(e){return function(){return new t(e.apply(this,arguments))}},await:function(t){return new e(t)}}}(),function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}),s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},l=function(){function e(e,t){var n=[],i=!0,r=!1,a=void 0;try{for(var s,o=e[Symbol.iterator]();!(i=(s=o.next()).done)&&(n.push(s.value),!t||n.length!==t);i=!0);}catch(e){r=!0,a=e}finally{try{!i&&o.return&&o.return()}finally{if(r)throw a}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=function(e){return Array.isArray(e)?e:Array.from(e)},f=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},d=function(e,t){var n=l(t,2),i=n[0],r=n[1];return Number(i)<=e&&Number(r)>=e},h=function(e,t){var n=l(t,1),i=n[0],r=document.querySelector("input[name='"+i+"']");return!(!r||String(e)!==r.value)},v=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["*"],n=l(t,1),i=n[0];if(Array.isArray(e))return!1;if(null===e||void 0===e||""===e)return!0;var r="*"===i?"+":"{1,"+i+"}",a=new RegExp("^-?\\d*(\\.\\d"+r+")?$");return!!a.test(e)&&!Number.isNaN(parseFloat(e))},m=function(e,t){var n=l(t,1),i=n[0],r=String(e);return/^[0-9]*$/.test(r)&&r.length===Number(i)},y=function(e,t,n){var i=window.URL||window.webkitURL;return new Promise(function(r){var a=new Image;a.onerror=function(){return r({valid:!1})},a.onload=function(){return r({valid:a.width===Number(t)&&a.height===Number(n)})},a.src=i.createObjectURL(e)})},g=function(e,t){for(var n=l(t,2),i=n[0],r=n[1],a=[],s=0;s<e.length;s++){if(!/\.(jpg|svg|jpeg|png|bmp|gif)$/i.test(e[s].name))return!1;a.push(e[s])}return Promise.all(a.map(function(e){return y(e,i,r)}))},p=function(e){return/^(([^<>()[\]\\.,;:#\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,6}))$/.test(e)},b=function(e,t){for(var n=new RegExp(".("+t.join("|")+")$","i"),i=0;i<e.length;i++)if(!n.test(e[i].name))return!1;return!0},k=function(e){for(var t=0;t<e.length;t++)if(!/\.(jpg|svg|jpeg|png|bmp|gif)$/i.test(e[t].name))return!1;return!0},_=function(e,t){return!!t.filter(function(t){return t==e}).length},$=function(e){return/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(e)},w=function(e,t){var n=l(t,1),i=n[0];return void 0===e||null===e?i>=0:String(e).length<=i},x=function(e,t){for(var n=new RegExp(t.join("|").replace("*",".+")+"$","i"),i=0;i<e.length;i++)if(!n.test(e[i].type))return!1;return!0},A=function(e,t){var n=l(t,1),i=n[0];return void 0!==e&&null!==e&&String(e).length>=i},E=function(e,t){return!t.filter(function(t){return t==e}).length},T=function(e){return!Array.isArray(e)&&/^[0-9]*$/.test(e)},L=function(e,t){var n=c(t),i=n[0],r=n.slice(1);return i instanceof RegExp?i.test(e):new RegExp(i,r).test(String(e))},F=function(e){return Array.isArray(e)?!!e.length:void 0!==e&&null!==e&&!!String(e).trim().length},S=function(e,t){var n=l(t,1),i=n[0];if(isNaN(i))return!1;for(var r=1024*Number(i),a=0;a<e.length;a++)if(e[a].size>r)return!1;return!0},j=function(e,t){var n=/^https?:\/\/([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w\.\(\)%-]*)*\/?$/.test(e),i=t&&t[0];return i&&n?new RegExp("^https?://(([da-z.-]+).)*("+t[0].replace(".","\\$&")+")").test(e):n},O={alpha_dash:t,alpha_num:n,alpha_spaces:i,alpha:e,between:d,confirmed:h,decimal:v,digits:m,dimensions:g,email:p,ext:b,image:k,in:_,ip:$,max:w,mimes:x,min:A,not_in:E,numeric:T,regex:L,required:F,size:S,url:j},N=function(){function e(){a(this,e),this.errors=[]}return s(e,[{key:"add",value:function(e,t,n){var i={field:e,msg:t};n&&(i.scope=n),this.errors.push(i)}},{key:"all",value:function(e){return e?this.errors.filter(function(t){return t.scope===e}).map(function(e){return e.msg}):this.errors.map(function(e){return e.msg})}},{key:"any",value:function(e){return e?!!this.errors.filter(function(t){return t.scope===e}).length:!!this.errors.length}},{key:"clear",value:function(e){return e?void(this.errors=this.errors.filter(function(t){return t.scope!==e})):void(this.errors=[])}},{key:"collect",value:function(e,t){var n=this;if(!e){var i=function(){var e={};return n.errors.forEach(function(t){e[t.field]||(e[t.field]=[]),e[t.field].push(t.msg)}),{v:e}}();if("object"===("undefined"==typeof i?"undefined":r(i)))return i.v}return t?this.errors.filter(function(n){return n.field===e&&n.scope===t}).map(function(e){return e.msg}):this.errors.filter(function(t){return t.field===e}).map(function(e){return e.msg})}},{key:"count",value:function(){return this.errors.length}},{key:"first",value:function(e,t){for(var n=0;n<this.errors.length;n++)if(this.errors[n].field===e){if(!t)return this.errors[n].msg;if(this.errors[n].scope===t)return this.errors[n].msg}return null}},{key:"has",value:function(e,t){for(var n=0;n<this.errors.length;n++)if(this.errors[n].field===e){if(!t)return!0;if(this.errors[n].scope===t)return!0}return!1}},{key:"remove",value:function(e,t){return t?void(this.errors=this.errors.filter(function(n){return n.field!==e||n.scope!==t})):void(this.errors=this.errors.filter(function(t){return t.field!==e}))}}]),e}(),B=function(){function e(t){a(this,e),this.msg=t}return s(e,[{key:"toString",value:function(){return this.msg}}]),e}(),M=function(e){return e.dataset.scope||e.form&&e.form.dataset.scope},V=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!t)return e;var i=void 0;return function(r){function a(){n||e.apply(u,o),i=null}var s=c(r),o=s,u=this;i?clearTimeout(i):n&&e.apply.apply(e,[u].concat(f(o))),i=setTimeout(a,t||100)}},D=function(e){console&&console.warn("vee-validate: "+e)},R=function(e){return e&&"object"===("undefined"==typeof e?"undefined":r(e))&&!Array.isArray(e)&&null!==e},z=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e),this.dictionary={},this.merge(t)}return s(e,[{key:"hasLocale",value:function(e){return!!this.dictionary[e]}},{key:"getMessage",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this.hasMessage(e,t)?this.dictionary[e].messages[t]:n}},{key:"getAttribute",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this.hasAttribute(e,t)?this.dictionary[e].attributes[t]:n}},{key:"hasMessage",value:function(e,t){return!!(this.hasLocale(e)&&this.dictionary[e].messages&&this.dictionary[e].messages[t])}},{key:"hasAttribute",value:function(e,t){return!!(this.hasLocale(e)&&this.dictionary[e].attributes&&this.dictionary[e].attributes[t])}},{key:"merge",value:function(e){this._merge(this.dictionary,e)}},{key:"setMessage",value:function(e,t,n){this.hasLocale(e)||(this.dictionary[e]={messages:{},attributes:{}}),this.dictionary[e].messages[t]=n}},{key:"setAttribute",value:function(e,t,n){this.hasLocale(e)||(this.dictionary[e]={messages:{},attributes:{}}),this.dictionary[e].attributes[t]=n}},{key:"_merge",value:function(e,t){var n=this;return R(e)&&R(t)?(Object.keys(t).forEach(function(i){return R(t[i])?(e[i]||u(e,o({},i,{})),void n._merge(e[i],t[i])):void u(e,o({},i,t[i]))}),e):e}}]),e}(),q={alpha_dash:function(e){return"The "+e+" may contain alpha-numeric characters as well as dashes and underscores."},alpha_num:function(e){return"The "+e+" may only contain alpha-numeric characters."},alpha_spaces:function(e){return"The "+e+" may only contain alphabetic characters as well as spaces."},alpha:function(e){return"The "+e+" may only contain alphabetic characters."},between:function(e,t){var n=l(t,2),i=n[0],r=n[1];return"The "+e+" must be between "+i+" and "+r+"."},confirmed:function(e,t){var n=l(t,1),i=n[0];return"The "+e+" does not match the "+i+"."},decimal:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["*"],n=l(t,1),i=n[0];return"The "+e+" must be numeric and may contain "+("*"===i?"":i)+" decimal points."},digits:function(e,t){var n=l(t,1),i=n[0];return"The "+e+" must be numeric and exactly contain "+i+" digits."},dimensions:function(e,t){var n=l(t,2),i=n[0],r=n[1];return"The "+e+" must be "+i+" pixels by "+r+" pixels."},email:function(e){return"The "+e+" must be a valid email."},ext:function(e){return"The "+e+" must be a valid file."},image:function(e){return"The "+e+" must be an image."},in:function(e){return"The "+e+" must be a valid value."},ip:function(e){return"The "+e+" must be a valid ip address."},max:function(e,t){var n=l(t,1),i=n[0];return"The "+e+" may not be greater than "+i+" characters."},mimes:function(e){return"The "+e+" must have a valid file type."},min:function(e,t){var n=l(t,1),i=n[0];return"The "+e+" must be at least "+i+" characters."},not_in:function(e){return"The "+e+" must be a valid value."},numeric:function(e){return"The "+e+" may only contain numeric characters."},regex:function(e){return"The "+e+" format is invalid."},required:function(e){return"The "+e+" is required."},size:function(e,t){var n=l(t,1),i=n[0];return"The "+e+" must be less than "+i+" KB."},url:function(e){return"The "+e+" is not a valid URL."}},P=function(e){return function(t,n){var i=l(n,2),r=i[0],a=i[1],s=e(t,a,!0),o=document.querySelector("input[name='"+r+"']");if(!s.isValid()||!o)return!1;var u=e(o.value,a,!0);return!!u.isValid()&&s.isAfter(u)}},I=function(e){return function(t,n){var i=l(n,2),r=i[0],a=i[1],s=e(t,a,!0),o=document.querySelector("input[name='"+r+"']");if(!s.isValid()||!o)return!1;var u=e(o.value,a,!0);return!!u.isValid()&&s.isBefore(u)}},U=function(e){return function(t,n){var i=l(n,1),r=i[0];return e(t,r,!0).isValid()}},Z=function(e){return function(t,n){var i=l(n,3),r=i[0],a=i[1],s=i[2],o=e(r,s,!0),u=e(a,s,!0),c=e(t,s,!0);return!!(o.isValid()&&u.isValid()&&c.isValid())&&c.isBetween(o,u)}},C={after:function(e,t){var n=l(t,1),i=n[0];return"The "+e+" must be after "+i+"."},before:function(e,t){var n=l(t,1),i=n[0];return"The "+e+" must be before "+i+"."},date_between:function(e,t){var n=l(t,2),i=n[0],r=n[1];return"The "+e+" must be between "+i+" and "+r+"."},date_format:function(e,t){var n=l(t,1),i=n[0];return"The "+e+" must be in the format "+i+"."}},Y={make:function(e){return{date_format:U(e),after:P(e),before:I(e),date_between:Z(e)}},messages:C,installed:!1},K=function(){function e(){a(this,e),this.fields={}}return s(e,[{key:"_add",value:function(e){this.fields[e]={},this._setFlags(e,{dirty:!1,valid:!1},!0)}},{key:"_remove",value:function(e){delete this.fields[e]}},{key:"reset",value:function(e){var t=this;return e?void this._setFlags(e,{dirty:!1,valid:!1},!0):void Object.keys(this.fields).forEach(function(e){t._setFlags(e,{dirty:!1,valid:!1},!0)})}},{key:"_setFlags",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Object.keys(t).every(function(r){return n._setFlag(e,r,t[r],i)})}},{key:"_setFlag",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r="set"+t.charAt(0).toUpperCase()+t.slice(1);return"function"==typeof this[r]&&(this[r](e,n,i),!0)}},{key:"setDirty",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.fields[e].dirty=t,this.fields[e].clean=n||!t,this.fields[e].passed=this.fields[e].valid&&t,this.fields[e].failed=!this.fields[e].valid&&t}},{key:"setValid",value:function(e,t){this.fields[e].valid=t,this.fields[e].passed=this.fields[e].dirty&&t,this.fields[e].failed=this.fields[e].dirty&&!t}},{key:"_getFieldFlag",value:function(e,t){return!!this.fields[e]&&this.fields[e][t]}},{key:"dirty",value:function(e){var t=this;return e?this._getFieldFlag(e,"dirty"):Object.keys(this.fields).some(function(e){return t.fields[e].dirty})}},{key:"valid",value:function(e){var t=this;return e?this._getFieldFlag(e,"valid"):Object.keys(this.fields).every(function(e){return t.fields[e].valid})}},{key:"passed",value:function(e){var t=this;return e?this._getFieldFlag(e,"passed"):Object.keys(this.fields).every(function(e){return t.fields[e].passed})}},{key:"failed",value:function(e){var t=this;return e?this._getFieldFlag(e,"failed"):Object.keys(this.fields).some(function(e){return t.fields[e].failed})}},{key:"clean",value:function(e){return e?this._getFieldFlag(e,"clean"):!this.dirty()}}]),e}(),G="veeValidate",H="en",J=!0,Q=new z({en:{messages:q,attributes:{}}}),W=function(){function e(t,n){a(this,e),this.locale=H,this.strictMode=J,this.$fields={},this.fieldBag=new K,this._createFields(t),this.errorBag=new N,this.$vm=n,"function"==typeof moment&&this.installDateTimeValidators(moment)}return s(e,[{key:"installDateTimeValidators",value:function(t){e.installDateTimeValidators(t)}},{key:"setStrictMode",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.strictMode=e}},{key:"setLocale",value:function(e){Q.hasLocale(e)||D("You are setting the validator locale to a locale that is not defined in the dicitionary. English messages may still be generated."),this.locale=e}},{key:"attach",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.errorBag.remove(e),this._createField(e,t),n&&(this.$fields[e].name=n)}},{key:"updateDictionary",value:function(t){e.updateDictionary(t)}},{key:"detach",value:function(e){this.$vm&&"function"==typeof this.$vm.$emit&&this.$vm.$emit("VALIDATOR_OFF",e),delete this.$fields[e],this.fieldBag._remove(e)}},{key:"extend",value:function(t,n){e.extend(t,n)}},{key:"validateAll",value:function(e){var t=this;if(this.$vm&&(!e||"string"==typeof e))return this.errorBag.clear(e),void this.$vm.$emit(G,e);var n=!0,i=[];return this.errorBag.clear(),Object.keys(e).forEach(function(r){var a=t.validate(r,e[r]);return"function"==typeof a.then?void i.push(a):void(n=n&&a)}),i.length?Promise.all(i).then(function(e){return e.every(function(e){return e})&&n}):n}},{key:"validate",value:function(e,t,n){var i=this;if(!this.$fields[e])return!this.strictMode||(D('Trying to validate a non-existant field: "'+e+'". Use "attach()" first.'),!1);if(this.errorBag.remove(e,n),!this.$fields[e].required&&~[null,void 0,""].indexOf(t))return!0;var r=!0,a=[];return this.$fields[e].validations.forEach(function(s){var o=i._test(e,t,s,n);return"function"==typeof o.then?void a.push(o):void(r=r&&o)}),a.length?Promise.all(a).then(function(t){var n=t.every(function(e){return e})&&r;return i.fieldBag._setFlags(e,{valid:n,dirty:!0}),n}):(this.fieldBag._setFlags(e,{valid:r,dirty:!0}),r)}},{key:"_createFields",value:function(e){var t=this;e&&Object.keys(e).forEach(function(n){t._createField(n,e[n])})}},{key:"_createField",value:function(e,t){var n=this;return this.$fields[e]||(this.$fields[e]={}),this.fieldBag._add(e),this.$fields[e].validations=[],Array.isArray(t)?void(this.$fields[e].validations=t):void t.split("|").forEach(function(t){var i=n._normalizeRule(t,n.$fields[e].validations);"required"===i.name&&(n.$fields[e].required=!0),n.$fields[e].validations.push(i)})}},{key:"_normalizeRule",value:function(e,t){var n=[],i=e.split(":")[0];if(~e.indexOf(":")&&(n=e.split(":")[1].split(",")),Y.installed&&~["after","before","date_between"].indexOf(i)){var r=t.filter(function(e){return"date_format"===e.name})[0];r&&n.push(r.params[0])}return{name:i,params:n}}},{key:"_formatErrorMessage",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=this._getFieldDisplayName(e),r=this._getLocalizedParams(t);return Q.hasLocale(this.locale)&&"function"==typeof Q.getMessage(this.locale,t.name)?Q.getMessage(this.locale,t.name)(i,r,n):Q.getMessage("en",t.name)(i,r,n)}},{key:"_getLocalizedParams",value:function(e){return~["after","before","confirmed"].indexOf(e.name)&&e.params&&e.params[0]?[Q.getAttribute(this.locale,e.params[0],e.params[0])]:e.params}},{key:"_getFieldDisplayName",value:function(e){return this.$fields[e].name||Q.getAttribute(this.locale,e,e)}},{key:"_test",value:function(e,t,n,i){var r=this,a=O[n.name],s=a(t,n.params);return"function"==typeof s.then?s.then(function(t){var a=!0;return Array.isArray(t)?(a=t.every(function(e){return e.valid}),a||r.errorBag.add(e,r._formatErrorMessage(e,n),i)):(a=t.valid,r.errorBag.add(e,r._formatErrorMessage(e,n,t.data),i)),a}):R(s)?(s.valid||this.errorBag.add(e,this._formatErrorMessage(e,n,s.data),i),s.valid):(s||this.errorBag.add(e,this._formatErrorMessage(e,n),i),s)}},{key:"getErrors",value:function(){return this.errorBag}}],[{key:"setDefaultLocale",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"en";Q.hasLocale(e)||D("You are setting the validator locale to a locale that is not defined in the dicitionary. English messages may still be generated."),H=e}},{key:"setStrictMode",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];J=e}},{key:"installDateTimeValidators",value:function(t){if("function"!=typeof t)return D("To use the date-time validators you must provide moment reference."),!1;if(Y.installed)return!0;var n=Y.make(t);return Object.keys(n).forEach(function(t){e.extend(t,n[t])}),e.updateDictionary({en:{messages:Y.messages}}),Y.installed=!0,!0}},{key:"updateDictionary",value:function(e){Q.merge(e)}},{key:"create",value:function(t,n){return new e(t,n)}},{key:"extend",value:function(t,n){e._guardExtend(t,n),e._merge(t,n)}},{key:"_merge",value:function(e,t){return"function"==typeof t?(O[e]=t,void Q.setMessage("en",e,function(e){return"The "+e+" value is not valid."})):(O[e]=t.validate,t.getMessage&&"function"==typeof t.getMessage&&Q.setMessage("en",e,t.getMessage),void(t.messages&&Q.merge(Object.keys(t.messages).reduce(function(n,i){var r=n;return r[i]={messages:o({},e,t.messages[i])},r},{}))))}},{key:"_guardExtend",value:function(e,t){if(O[e])throw new B("Extension Error: There is an existing validator with the same name '"+e+"'.");if("function"!=typeof t){if("function"!=typeof t.validate)throw new B("Extension Error: The validator '"+e+"' must be a function or have a 'validate' method.");if("function"!=typeof t.getMessage&&"object"!==r(t.messages))throw new B("Extension Error: The validator '"+e+"' must have a 'getMessage' method or have a 'messages' object.")}}}]),e}(),X=[],ee=function(e){for(var t=0;t<X.length;t++)if(X[t].$vm===e)return X[t].$validator},te=function(e){var t=ee(e);return t||(t=W.create(void 0,e),X.push({$vm:e,$validator:t})),t},ne=function(e){for(var t=0;t<X.length;t++)if(X[t].$vm===e)return X.splice(t,1),!0;return!1},ie=function(e){return{data:function(){return o({},e.errorBagName,this.$validator.errorBag)},computed:o({},e.fieldsBagName,{get:function(){return this.$validator.fieldBag}}),mounted:function(){this.$emit("validatorReady")},destroyed:function(){ne(this)}}},re="veeValidate",ae=function(){function e(t,n,i,r){a(this,e),this.callbacks=[],this.el=t,this.binding=n,this.vm=i,this.options=r,this.fieldName=n.expression||t.name}return s(e,[{key:"_hasFieldDependency",value:function(e){var t=e.split("|").filter(function(e){return!!e.match(/confirmed|after|before/)});return!!t.length&&t[0].split(":")[1]}},{key:"_inputListener",value:function(){this.vm.$validator.validate(this.fieldName,this.el.value,M(this.el))}},{key:"_fileListener",value:function(){var e=this.vm.$validator.validate(this.fieldName,this.el.files,M(this.el));!e&&this.binding.modifiers.reject&&(el.value="")}},{key:"_radioListener",value:function(){var e=document.querySelector('input[name="'+this.el.name+'"]:checked');return e?void this.vm.$validator.validate(this.fieldName,e.value,M(this.el)):void this.vm.$validator.validate(this.fieldName,null,M(this.el))}},{key:"_checkboxListener",value:function(){var e=this,t=document.querySelectorAll('input[name="'+this.el.name+'"]:checked');return t&&t.length?void[].concat(f(t)).forEach(function(t){e.vm.$validator.validate(e.fieldName,t.value,M(e.el))}):void this.vm.$validator.validate(this.fieldName,null,M(this.el))}},{key:"_getScopedListener",value:function(e){var t=this;return function(n){(!n||n===M(t.el)||n instanceof Event)&&e()}}},{key:"_attachValidatorEvent",value:function(){var e=this,t=this._getScopedListener(this._getSuitableListener().listener.bind(this));this.vm.$on(re,t),this.callbacks.push({name:re,listener:t}),this.vm.$on("VALIDATOR_OFF",function(t){e.fieldName===t&&e.detach()});var n=this._hasFieldDependency(this.el.dataset.rules);n&&this.vm.$once("validatorReady",function(){var i=document.querySelector("input[name='"+n+"']");return i?(i.addEventListener("input",t),void e.callbacks.push({name:"input",listener:t,el:i})):void D("Cannot find target field, no additional listeners were attached.")})}},{key:"_getSuitableListener",value:function(){return"file"===this.el.type?{name:"change",listener:this._fileListener}:"radio"===this.el.type?{name:"change",listener:this._radioListener}:"checkbox"===this.el.type?{name:"change",listener:this._checkboxListener}:{name:"input",listener:this._inputListener}}},{key:"_attachFieldListeners",value:function(){var e=this,t=this._getSuitableListener(),n=V(t.listener.bind(this),this.el.dataset.delay||this.options.delay);return~["radio","checkbox"].indexOf(this.el.type)?void this.vm.$once("validatorReady",function(){[].concat(f(document.querySelectorAll('input[name="'+e.el.name+'"]'))).forEach(function(i){i.addEventListener(t.name,n),e.callbacks.push({name:t.name,listener:n,el:i})})}):(this.el.addEventListener(t.name,n),void this.callbacks.push({name:t.name,listener:n,el:this.el}))}},{key:"attach",value:function(){return this.vm.$validator.attach(this.fieldName,this.el.dataset.rules,this.el.dataset.as),this._attachValidatorEvent(),this.binding.expression?void(this.binding.modifiers.initial||this.vm.$validator.validate(this.binding.expression,this.binding.value,M(this.el))):void this._attachFieldListeners()}},{key:"detach",value:function(){var e=this;this.callbacks.filter(function(e){var t=e.name;return t===re}).forEach(function(t){e.vm.$off(re,t.listener)}),this.callbacks.filter(function(e){var t=e.name;return t!==re}).forEach(function(e){e.el.removeEventListener(e.name,e.listener)})}}]),e}(),se=[],oe=function(e){return{bind:function(t,n,i){var r=i.context,a=new ae(t,n,r,e);a.attach(),se.push({vm:r,el:t,instance:a})},update:function(e,t,n){var i=t.expression,r=t.value,a=(t.modifiers,t.oldValue),s=n.context;i&&r!==a&&s.$validator.validate(i||e.name,r,M(e))},unbind:function(e,t,n){var i=n.context,r=se.filter(function(t){return t.vm===i&&t.el===e})[0];r.instance.detach(),se.splice(se.indexOf(r),1)}}},ue=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.locale,i=void 0===n?"en":n,r=t.delay,a=void 0===r?0:r,s=t.errorBagName,o=void 0===s?"errors":s,u=t.dictionary,l=void 0===u?null:u,c=t.strict,f=void 0===c||c,d=t.fieldsBagName,h=void 0===d?"fields":d;l&&W.updateDictionary(l),W.setDefaultLocale(i),W.setStrictMode(f);var v={locale:i,delay:a,dictionary:l,errorBagName:o,fieldsBagName:h};Object.defineProperties(e.prototype,{$validator:{get:function(){return te(this)}}}),e.mixin(ie(v)),e.directive("validate",oe(v))},le={install:ue,Validator:W,ErrorBag:N};return le});
{
"name": "vee-validate",
"version": "2.0.0-beta.13",
"version": "2.0.0-beta.14",
"description": "Simple Vue.js input validation plugin",

@@ -8,19 +8,19 @@ "main": "dist/vee-validate.js",

"repository": "https://github.com/logaretm/vee-validate",
"jest": {
"coveragePathIgnorePatterns": [
"/node_modules/",
"/src/(helpers|messages|utils)/",
"src/plugins/date/messages.js"
],
"testPathIgnorePatterns": [
"<rootDir>/__tests__/helpers/",
"<rootDir>/node_modules/"
]
},
"scripts": {
"test": "nyc ava --colors",
"test:watch": "ava --watch",
"test": "jest",
"lint": "eslint ./src ./test",
"build": "rollup -c rollup.config.dev.js && rollup -c rollup.config.prod.js",
"cover": "nyc report --reporter=lcov > coverage.lcov && codecov"
"build": "rollup -c rollup.config.dev.js && rollup -c rollup.config.prod.js && rollup -c rollup.config.es6.js",
"cover": "jest --coverage"
},
"ava": {
"require": [
"babel-register"
]
},
"nyc": {
"exclude": [
"src/utils/helpers.js"
]
},
"keywords": [

@@ -37,6 +37,8 @@ "VueJS",

"devDependencies": {
"ava": "^0.15.2",
"babel-core": "^6.13.2",
"babel-jest": "^16.0.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-external-helpers": "^6.8.0",
"babel-plugin-transform-async-to-generator": "^6.16.0",
"babel-plugin-transform-object-assign": "^6.8.0",
"babel-polyfill": "^6.16.0",
"babel-preset-es2015": "^6.13.2",

@@ -47,5 +49,5 @@ "cross-env": "^2.0.0",

"eslint-plugin-import": "^1.12.0",
"jest": "^16.0.2",
"moment": "^2.14.1",
"nyc": "^7.1.0",
"rollup": "^0.36.0",
"rollup": "^0.36.3",
"rollup-plugin-babel": "^2.6.1",

@@ -52,0 +54,0 @@ "rollup-plugin-node-resolve": "^2.0.0",

@@ -94,2 +94,11 @@ # Vee-Validate

### Compatibility
This plugin should be compatible with the major browsers, but it requires few polyfills to work on older ones. The polyfills are:
- Promise Polyfill.
- Object.assign Polyfill.
The reason they are not included is because most of the workflows already use polyfills within their code, so to cut down the package size the redundant polyfills were removed, you can use [Polyfill.io](https://polyfill.io/v2/docs/) to provide the needed polyfills for all browsers automatically.
### Contributing

@@ -96,0 +105,0 @@

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc