text: !function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();n(1);var o=n(2),l=function(e){return e&&e.__esModule?e:{default:e}}(o),u={required:"This field is required",minLen:"The minimum number of characters allowed is %s%",maxLen:"The maximum allowed number of characters is %s%",email:"The e-mail field has the wrong format",phone:"The phone number is not in the correct format",number:"The entered data must be a number",equalTo:"The entered data does not match",url:"It is not a valid url"},s={liveChange:!0,onSuccess:function(){},onError:function(){},onChange:function(){},onReset:function(){}},c=new RegExp(/^(minLen|maxLen|required|equalTo|email|regex|url)\((\w{1,20})\)/i),f=function(){function e(t,n){r(this,e),this.options=i({},s,n),this.i18n=i({},u,e.i18n),this.form=t,this.formSubmit=this.validateForm.bind(this),this.formReset=this.reset.bind(this),this.inputChange=this.validateInput.bind(this),this.events()}return a(e,[{key:"check",value:function(e){for(var t=e.value.trim(),n=e.getAttribute("data-valid"),r=[],i={el:e,i18n:this.i18n},a=n.split("|"),o=a.length,u=0;u<o;u++){var s=a[u].match(c),f=void 0;if(s?(f=s[1],void 0!==s[2]&&(i.param=s[2])):f=a[u],(""!==t||"required"===f||"equalTo"===f)&&l.default.hasOwnProperty(f)){var h=l.default[f](i,this);if(void 0!==h&&!0!==h){var m=e.getAttribute("data-valid-msg-"+f);h=m||h,r.push(h)}}}return r}},{key:"validateInput",value:function(e){var t=e.target.closest("[data-valid]");if(t){var n={el:t},r=this.check(t);return r.length>0&&(n.errors=r),this.options.onChange(n)}}},{key:"validateForm",value:function(e){for(var t=[],n=Array.prototype.slice.call(this.form.querySelectorAll('[data-valid]:not(:disabled):not([type="hidden"])')),r=0,i=n.length;r<i;r++){var a=this.check(n[r]);0!==a.length&&t.push({el:n[r],errors:a})}return 0===t.length?this.options.onSuccess(e):(e.preventDefault(),this.options.onError(t))}},{key:"reset",value:function(e){this.options.onReset(e)}},{key:"events",value:function(){this.form.addEventListener("submit",this.formSubmit),this.form.addEventListener("reset",this.formReset),this.options.liveChange&&this.form.addEventListener("change",this.inputChange)}}],[{key:"destroy",value:function(e){e instanceof Node&&(e=[e]),e instanceof NodeList&&(e=[].slice.call(e)),"string"==typeof e&&(e=[].slice.call(document.querySelectorAll(e))),e instanceof Array&&e.forEach(function(e){if("Validate"in e){var t=e.Validate;t.form.removeEventListener("submit",t.formSubmit),t.options.change&&t.form.removeEventListener("change",t.inputChange),t.form.Validate=null,delete t.form.Validate,t.form=null}})}},{key:"run",value:function(t,n){t instanceof Node&&(t=[t]),t instanceof NodeList&&(t=[].slice.call(t)),"string"==typeof t&&(t=[].slice.call(document.querySelectorAll(t))),t instanceof Array&&t.forEach(function(t){"Validate"in t||(t.Validate=new e(t,n))})}},{key:"version",get:function(){return.1}}]),e}();t.default=f,"undefined"!=typeof document&&(window.Validate=f)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){var t=e.matches||e.matchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector;e.matches=e.matchesSelector=t||function(e){var t=document.querySelectorAll(e),n=this;return Array.prototype.some.call(t,function(e){return e===n})}}(Element.prototype),function(e){e.closest=e.closest||function(e){for(var t=this;t;){if(t.matches(e))return t;t=t.parentElement}return null}}(Element.prototype)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={required:function(e,t){var n=!0;switch(e.el.type){case"checkbox":n=e.el.checked;break;case"radio":n=1===t.form.querySelectorAll('[type="radio"][name="'+e.el.name+'"]:checked').length;break;case"select":case"select-one":case"select-multiple":n=""!==e.el.value;break;default:n=""!==e.el.value.trim()}return n||e.i18n.required},minLen:function(e){return e.el.value.length>=e.param||e.i18n.minLen.replace("%s%",e.param)},maxLen:function(e){return e.el.value.length<=e.param||e.i18n.maxLen.replace("%s%",e.param)},email:function(e){return/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i.test(e.el.value)||e.i18n.email},equalTo:function(e,t){var n=t.form.querySelector("[name="+e.param+"]");if(n){return n.value.trim()===e.el.value||e.i18n.equalTo}},url:function(e){return/^(https?|ftp):\/\/[^\s\/$.?#].[^\s]*$/i.test(e.el.value)||e.i18n.url},number:function(e){return/^(\d+|\.?\d+)$/.test(e.el.value)||e.i18n.number},regex:function(e,t){var n=t.options.validators.regex[e.param];return new RegExp(n.pattern).test(e.el.value)||n.error}}}]);