!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.vuelidate=e():t.vuelidate=e()}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/",r(r.s=3)}({3:function(t,e,r){"use strict";function n(t){return null==t}function o(t){return null!=t}function i(t,e){return e.tag===t.tag&&e.key===t.key}function u(t){var e=t.tag;t.vm=new e({data:t.args})}function a(t,e,r){var n,i,u={};for(n=e;n<=r;++n)o(i=t[n].key)&&(u[i]=n);return u}function l(t,e,r){for(;e<=r;++e)u(t[e])}function c(t,e,r){for(;e<=r;++e){var n=t[e];o(n)&&(n.vm.$destroy(),n.vm=null)}}function s(t,e){t!==e&&(e.vm=t.vm,function(t){for(var e=Object.keys(t.args),r=0;rp?l(e,h,m):h>m&&c(t,y,p)}(t,e):o(e)?l(e,0,e.length-1):o(t)&&c(t,0,t.length-1)}function d(t,e,r){return{tag:t,key:e,args:r}}function y(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function h(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function p(t){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}r.r(e);var v=[],b=null;function m(){null!==b&&v.push(b),b={}}function g(){var t=b,e=b=v.pop()||null;return e&&(Array.isArray(e.$sub)||(e.$sub=[]),e.$sub.push(t)),t}function M(t){if("object"!==p(t)||Array.isArray(t))throw new Error("params must be an object");b=function(t){for(var e=1;e1?u:u.$sub[0]:null}}},computed:{run:function(){var t=this,e=this.lazyParentModel();if(Array.isArray(e)&&e.__ob__){var r=e.__ob__.dep;r.depend();var n=r.constructor.target;if(!this._indirectWatcher){var o=n.constructor;this._indirectWatcher=new o(this,(function(){return t.runRule(e)}),null,{lazy:!0})}var i=this.getModel();if(!this._indirectWatcher.dirty&&this._lastModel===i)return this._indirectWatcher.depend(),n.value;this._lastModel=i,this._indirectWatcher.evaluate(),this._indirectWatcher.depend()}else this._indirectWatcher&&(this._indirectWatcher.teardown(),this._indirectWatcher=null);return this._indirectWatcher?this._indirectWatcher.value:this.runRule(e)},$params:function(){return this.run.params},proxy:function(){var t=this.run.output;return t.__isVuelidateAsyncVm?!!t.v:!!t},$pending:function(){var t=this.run.output;return!!t.__isVuelidateAsyncVm&&t.p}},destroyed:function(){this._indirectWatcher&&(this._indirectWatcher.teardown(),this._indirectWatcher=null)}}),n=e.extend({data:function(){return{dirty:!1,validations:null,lazyModel:null,model:null,prop:null,lazyParentModel:null,rootModel:null}},methods:P({},E,{refProxy:function(t){return this.getRef(t).proxy},getRef:function(t){return this.refs[t]},isNested:function(t){return"function"!=typeof this.validations[t]}}),computed:P({},W,{nestedKeys:function(){return this.keys.filter(this.isNested)},ruleKeys:function(){var t=this;return this.keys.filter((function(e){return!t.isNested(e)}))},keys:function(){return Object.keys(this.validations).filter((function(t){return"$params"!==t}))},proxy:function(){var t=this,e=z(this.keys,(function(e){return{enumerable:!0,configurable:!0,get:function(){return t.refProxy(e)}}})),r=z(V,(function(e){return{enumerable:!0,configurable:!0,get:function(){return t[e]}}})),n=z(R,(function(e){return{enumerable:!1,configurable:!0,get:function(){return t[e]}}})),o=this.hasIter()?{$iter:{enumerable:!0,value:Object.defineProperties({},P({},e))}}:{};return Object.defineProperties({},P({},e,{},o,{$model:{enumerable:!0,get:function(){var e=t.lazyParentModel();return null!=e?e[t.prop]:null},set:function(e){var r=t.lazyParentModel();null!=r&&(r[t.prop]=e,t.$touch())}}},r,{},n))},children:function(){var t=this;return[].concat(j(this.nestedKeys.map((function(e){return u(t,e)}))),j(this.ruleKeys.map((function(e){return a(t,e)})))).filter(Boolean)}})}),o=n.extend({methods:{isNested:function(t){return void 0!==this.validations[t]()},getRef:function(t){var e=this;return{get proxy(){return e.validations[t]()||!1}}}}}),i=n.extend({computed:{keys:function(){var t=this.getModel();return S(t)?Object.keys(t):[]},tracker:function(){var t=this,e=this.validations.$trackBy;return e?function(r){return"".concat(K(t.rootModel,t.getModelKey(r),e))}:function(t){return"".concat(t)}},getModelLazy:function(){var t=this;return function(){return t.getModel()}},children:function(){var t=this,e=this.validations,r=this.getModel(),o=P({},e);delete o.$trackBy;var i={};return this.keys.map((function(e){var u=t.tracker(e);return i.hasOwnProperty(u)?null:(i[u]=!0,d(n,u,{validations:o,prop:e,lazyParentModel:t.getModelLazy,model:r[e],rootModel:t.rootModel}))})).filter(Boolean)}},methods:{isNested:function(){return!0},getRef:function(t){return this.refs[this.tracker(t)]},hasIter:function(){return!0}}}),u=function(t,e){if("$each"===e)return d(i,e,{validations:t.validations[e],lazyParentModel:t.lazyParentModel,prop:e,lazyModel:t.getModel,rootModel:t.rootModel});var r=t.validations[e];if(Array.isArray(r)){var u=t.rootModel,a=z(r,(function(t){return function(){return K(u,u.$v,t)}}),(function(t){return Array.isArray(t)?t.join("."):t}));return d(o,e,{validations:a,lazyParentModel:k,prop:e,lazyModel:k,rootModel:u})}return d(n,e,{validations:r,lazyParentModel:t.getModel,prop:e,lazyModel:t.getModelKey,rootModel:t.rootModel})},a=function(t,e){return d(r,e,{rule:t.validations[e],lazyParentModel:t.lazyParentModel,lazyModel:t.getModel,rootModel:t.rootModel})};return B={VBase:e,Validation:n}},I=null;var T=function(t,e){var r=function(t){if(I)return I;for(var e=t.constructor;e.super;)e=e.super;return I=e,e}(t),n=N(r),o=n.Validation;return new(0,n.VBase)({computed:{children:function(){var r="function"==typeof e?e.call(t):e;return[d(o,"$v",{validations:r,lazyParentModel:k,prop:"$v",model:t,rootModel:t})]}}})},C={data:function(){var t=this.$options.validations;return t&&(this._vuelidate=T(this,t)),{}},beforeCreate:function(){var t=this.$options;t.validations&&(t.computed||(t.computed={}),t.computed.$v||(t.computed.$v=function(){return this._vuelidate?this._vuelidate.refs.$v.proxy:null}))},beforeDestroy:function(){this._vuelidate&&(this._vuelidate.$destroy(),this._vuelidate=null)}};function L(t){t.mixin(C)}e.default=L}})}));