text: !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.validation=t()}(this,function(){"use strict";var e={email:/^(([^<>()[\]\\.,;:\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,}))$/},t={required:{message:"Required",method:function(e){if("checkbox"===e.type)return e.checked;if("radio"===e.type){var t=e.name;return e.parentNode.querySelectorAll("input[name="+t+"]:checked").length>0}return""!==e.value}},email:{message:"E-mail is wrong",method:function(t){return""===t.value||e.email.test(t.value.trim())}},emails:{message:"E-mail is wrong",method:function(t){return""===t.value||t.value.split(/;|,/).every(function(t){return e.email.test(t.trim())})}}},n=arguments,i={events:["change","paste","blur","keyup"]},r=window.document,a="",o=function(e){return e.getAttribute("data-validate").split(",").map(function(e){return e.trim()}).filter(function(n){return!t[n].method(e)}).map(function(e){return t[e].message}).join(", ")},l=function(e){var t=r.createElement("div");t.classList.add("validate-popup");var n=r.createElement("div");return n.appendChild(t.cloneNode(!0)),e.insertAdjacentHTML("beforebegin",n.innerHTML),t=e.previousElementSibling},u=function(e,t,n){n&&!e.classList.contains(t)?e.classList.add(t):!n&&e.classList.contains(t)&&e.classList.remove(t)},c=function(e,t){if(0!==e.offsetWidth||0!==e.offsetHeight){u(e,"validate-error",!0);var n=e.previousElementSibling;n&&n.matches(".validate-popup")||(n=l(e)),n.innerHTML=t,window.setTimeout(function(){var t=e.clientWidth<n.clientWidth?1+~~(e.offsetLeft+e.offsetWidth/2-14):e.offsetLeft+e.clientWidth-n.clientWidth+1,i=e.offsetTop;n.style.left=t+"px",n.style.top=i+"px",n.style.marginTop=-(n.clientHeight+8)+"px",u(n,"active",!0),u(n,"short-version",e.clientWidth<n.clientWidth)},0)}},f=function(e){u(e,"validate-error",!1);var t=e.previousElementSibling;t&&t.matches(".validate-popup")&&u(t,"active",!1)},s=function(e,t){t?c(e,t):f(e)},d=function(e){var t=e.target;if(t.matches(".validate")){var n=o(t);if("radio"===t.type){var i=t.name,a=r.querySelectorAll('input[name="'+i+'"]');[].forEach.call(a,function(e){return s(e,n)})}else s(t,n)}},v=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"body";return"string"==typeof e?r.querySelector(e)||r.body:e},p=function(e){return e.querySelectorAll(".validate")},m=function(e){var t=e.target;if(t.matches(".validate-popup")){var n=t.nextElementSibling;n.matches(".validate")&&f(n)}},h=function(e){return!!E.validate(e.target)||(e.preventDefault(),!1)},g=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250,i=arguments[2],r=void 0,a=void 0;return function(){var o=+new Date,l=n;r&&o<r+t?(clearTimeout(a),a=setTimeout(function(){r=o,e.apply(i,l)},t)):(r=o,e.apply(i,l))}}(function(){[].forEach.call(r.querySelectorAll(".validate-popup"),function(e){return u(e,"active",!1)})},1e3),y=function(e,t){e=v(e);var n=t?"addEventListener":"removeEventListener",a=p(e);[].forEach.call(a,function(e){return i.events.forEach(function(t){return e[n](t,d)})}),r[n]("click",m),"FORM"===e.nodeName&&e[n]("submit",h),window[n]("resize",g)},E={init:function(e,t){return Object.assign(i,t),y(e,!0),E},rules:t,destroy:function(e){return E.hide(e),y(e,!1),E},hide:function(e){e=v(e);var t=p(e);return[].forEach.call(t,function(e){return f(e)}),E},highlight:function(e){e=v(e);var t=p(e);return[].forEach.call(t,function(e){return d({target:e})}),E},isValid:function(e){e=v(e);var t=p(e),n=[].every.call(t,function(e){return!o(e)});return a&&e.querySelectorAll(a).length>0&&(n=!1),n},validate:function(e){return E.highlight(e),E.isValid(e)},addClassValidation:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Invalid",n=e.split(",").map(function(e){return"\n  {0} {\n    border-color: #D10000 !important;\n  }\n  {0}:before {\n    opacity: 1 !important;\n    {1}\n  }\n  {0}:after {\n    opacity: 1 !important;\n  }".replace(/\{0\}/gi,e).replace(/\{1\}/gi,t?"content: '"+t+"' !important;":"")}).join(""),i=r.createElement("style");return i.innerHTML=n,r.head.appendChild(i),a=a+(""===a?"":",")+e,E},showOne:c,hideOne:f};return E});
  