!function(){"use strict";var e=document.querySelectorAll(".needs-validation");Array.prototype.slice.call(e).forEach(function(t){t.addEventListener("submit",function(e){t.checkValidity()||(e.preventDefault(),e.stopPropagation()),t.classList.add("was-validated")},!1)});const t=document.getElementById("form-validation-2"),s=document.getElementById("username"),a=document.getElementById("email"),n=document.getElementById("password"),r=document.getElementById("password2");function c(e,t){const s=e.parentElement,a=(console.log(s.children),s.children[1].classList.add("error"),s.querySelector("small"));a.innerText=t,a.classList.add("error"),a.classList.remove("success")}function l(e){const t=e.parentElement,s=(t.children[1].classList.remove("error"),t.children[1].classList.add("success"),t.querySelector("small"));s.classList.add("success"),s.classList.remove("error")}function i(e,t,s){e.value.length<t?c(e,o(e)+` must be at least ${t} characters`):e.value.length>s?c(e,o(e)+` must be les than ${s} characters`):l(e)}function o(e){return e.id.charAt(0).toUpperCase()+e.id.slice(1)}t.addEventListener("submit",function(e){var t;e.preventDefault(),[s,a,n,r].forEach(function(e){""===e.value.trim()?c(e,o(e)+" is required"):l(e)}),i(s,3,15),i(n,6,25),e=a,/^(([^<>()\[\]\\.,;:\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,}))$/.test(e.value.trim())?l(e):c(e,"Email is not invalid"),e=n,t=r,e.value!==t.value&&c(t,"Passwords do not match")})}();