const maxInt=2147483647,base=36,tMin=1,tMax=26,skew=38,damp=700,initialBias=72,initialN=128,delimiter="-",regexPunycode=/^xn--/,regexNonASCII=/[^\0-\x7F]/,regexSeparators=/[\x2E\u3002\uFF0E\uFF61]/g,errors={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},baseMinusTMin=36-1,floor=Math.floor,stringFromCharCode=String.fromCharCode;function error(a){throw new RangeError(errors[a])}function map(a,t){const e=[];let s=a.length;for(;s--;)e[s]=t(a[s]);return e}function mapDomain(a,t){const e=a.split("@");let s="";e.length>1&&(s=e[0]+"@",a=e[1]),a=a.replace(regexSeparators,".");const i=a.split("."),o=map(i,t).join(".");return s+o}function ucs2decode(a){const t=[];let e=0;const s=a.length;for(;e<s;){const i=a.charCodeAt(e++);if(i>=55296&&i<=56319&&e<s){const o=a.charCodeAt(e++);(o&64512)==56320?t.push(((i&1023)<<10)+(o&1023)+65536):(t.push(i),e--)}else t.push(i)}return t}const ucs2encode=a=>String.fromCodePoint(...a),basicToDigit=function(a){return a>=48&&a<58?26+(a-48):a>=65&&a<91?a-65:a>=97&&a<123?a-97:36},digitToBasic=function(a,t){return a+22+75*(a<26)-((t!=0)<<5)},adapt=function(a,t,e){let s=0;for(a=e?floor(a/700):a>>1,a+=floor(a/t);a>baseMinusTMin*26>>1;s+=36)a=floor(a/baseMinusTMin);return floor(s+(baseMinusTMin+1)*a/(a+38))},decode=function(a){const t=[],e=a.length;let s=0,i=128,o=72,r=a.lastIndexOf(delimiter);r<0&&(r=0);for(let n=0;n<r;++n)a.charCodeAt(n)>=128&&error("not-basic"),t.push(a.charCodeAt(n));for(let n=r>0?r+1:0;n<e;){const c=s;for(let l=1,u=36;;u+=36){n>=e&&error("invalid-input");const d=basicToDigit(a.charCodeAt(n++));d>=36&&error("invalid-input"),d>floor((2147483647-s)/l)&&error("overflow"),s+=d*l;const h=u<=o?1:u>=o+26?26:u-o;if(d<h)break;const b=36-h;l>floor(2147483647/b)&&error("overflow"),l*=b}const f=t.length+1;o=adapt(s-c,f,c==0),floor(s/f)>2147483647-i&&error("overflow"),i+=floor(s/f),s%=f,t.splice(s++,0,i)}return String.fromCodePoint(...t)},encode=function(a){const t=[];a=ucs2decode(a);const e=a.length;let s=128,i=0,o=72;for(const c of a)c<128&&t.push(stringFromCharCode(c));const r=t.length;let n=r;for(r&&t.push(delimiter);n<e;){let c=2147483647;for(const l of a)l>=s&&l<c&&(c=l);const f=n+1;c-s>floor((2147483647-i)/f)&&error("overflow"),i+=(c-s)*f,s=c;for(const l of a)if(l<s&&++i>2147483647&&error("overflow"),l===s){let u=i;for(let d=36;;d+=36){const h=d<=o?1:d>=o+26?26:d-o;if(u<h)break;const b=u-h,v=36-h;t.push(stringFromCharCode(digitToBasic(h+b%v,0))),u=floor(b/v)}t.push(stringFromCharCode(digitToBasic(u,0))),o=adapt(i,f,n===r),i=0,++n}++i,++s}return t.join("")},toUnicode=function(a){return mapDomain(a,function(t){return regexPunycode.test(t)?decode(t.slice(4).toLowerCase()):t})},toASCII=function(a){return mapDomain(a,function(t){return regexNonASCII.test(t)?"xn--"+encode(t):t})},punycode={version:"2.3.1",ucs2:{decode:ucs2decode,encode:ucs2encode},decode,encode,toASCII,toUnicode};/** * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */class JFormValidator{constructor(){this.customValidators={},this.handlers=[],this.handlers={},this.removeMarking=this.removeMarking.bind(this),this.inputEmail=()=>{const e=document.createElement("input");return e.setAttribute("type","email"),e.type!=="text"},this.setHandler("username",e=>!/[<|>|"|'|%|;|(|)|&]/i.test(e)),this.setHandler("password",e=>/^\S[\S ]{2,98}\S$/.test(e)),this.setHandler("numeric",e=>/^(\d|-)?(\d|,)*\.?\d*$/.test(e)),this.setHandler("email",e=>{const s=punycode.toASCII(e);return/^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(s)}),[].slice.call(document.querySelectorAll("form")).forEach(e=>{e.classList.contains("form-validate")&&this.attachToForm(e)})}get custom(){return this.customValidators}set custom(t){this.customValidators=t}setHandler(t,e,s){const i=s===""?!0:s;this.handlers[t]={enabled:i,exec:e}}markValid(t){const e=t.form.querySelector(`label[for="${t.id}"]`);let s;(t.classList.contains("required")||t.getAttribute("required"))&&e&&(s=e.querySelector("span.form-control-feedback")),t.classList.remove("form-control-danger"),t.classList.remove("invalid"),t.classList.add("form-control-success"),t.parentNode.classList.remove("has-danger"),t.parentNode.classList.add("has-success"),t.setAttribute("aria-invalid","false"),s&&s.parentNode.removeChild(s),e&&e.classList.remove("invalid")}markInvalid(t,e){const s=t.form.querySelector(`label[for="${t.id}"]`);t.classList.remove("form-control-success"),t.classList.remove("valid"),t.classList.add("form-control-danger"),t.classList.add("invalid"),t.parentNode.classList.remove("has-success"),t.parentNode.classList.add("has-danger"),t.setAttribute("aria-invalid","true");let i;const o=t.getAttribute("data-validation-text");if(s&&(i=s.querySelector("span.form-control-feedback")),!i){const r=document.createElement("span");r.classList.add("form-control-feedback"),e&&e==="checkbox"?r.innerHTML=o!==null?Joomla.sanitizeHtml(o):Joomla.sanitizeHtml(Joomla.Text._("JLIB_FORM_FIELD_REQUIRED_CHECK")):e&&e==="value"?r.innerHTML=o!==null?Joomla.sanitizeHtml(o):Joomla.sanitizeHtml(Joomla.Text._("JLIB_FORM_FIELD_REQUIRED_VALUE")):r.innerHTML=o!==null?Joomla.sanitizeHtml(o):Joomla.sanitizeHtml(Joomla.Text._("JLIB_FORM_FIELD_INVALID_VALUE")),s&&s.appendChild(r)}s&&s.classList.add("invalid")}removeMarking(t){let e;const s=t.form.querySelector(`label[for="${t.id}"]`);s&&(e=s.querySelector("span.form-control-feedback")),t.classList.remove("form-control-danger"),t.classList.remove("form-control-success"),t.classList.remove("invalid"),t.classList.add("valid"),t.parentNode.classList.remove("has-danger"),t.parentNode.classList.remove("has-success"),e&&s&&s.removeChild(e),s&&s.classList.remove("invalid")}handleResponse(t,e,s){const i=e.tagName.toLowerCase();(i!=="button"&&e.value!==void 0||i==="fieldset")&&(t===!1?this.markInvalid(e,s):this.markValid(e))}validate(t){let e;if(t.getAttribute("disabled")==="disabled"||t.getAttribute("display")==="none")return this.handleResponse(!0,t),!0;if(t.getAttribute("required")||t.classList.contains("required"))if(e=t.tagName.toLowerCase(),e==="fieldset"&&(t.classList.contains("radio")||t.classList.contains("checkboxes"))){if(t.querySelector("input:checked")===null)return this.handleResponse(!1,t,"checkbox"),!1}else{if(t.getAttribute("type")==="checkbox"&&t.checked!==!0||e==="select"&&!t.value.length)return this.handleResponse(!1,t,"checkbox"),!1;if(!t.value||t.classList.contains("placeholder"))return this.handleResponse(!1,t,"value"),!1}const s=t.getAttribute("class")&&t.getAttribute("class").match(/validate-([a-zA-Z0-9_-]+)/)?t.getAttribute("class").match(/validate-([a-zA-Z0-9_-]+)/)[1]:"";if(t.getAttribute("pattern")&&t.getAttribute("pattern")!==""){if(t.value.length){const i=new RegExp(`^${t.getAttribute("pattern")}$`).test(t.value);return this.handleResponse(i,t,"empty"),i}return t.hasAttribute("required")||t.classList.contains("required")?(this.handleResponse(!1,t,"empty"),!1):(this.handleResponse(!0,t),!0)}return s===""?(this.handleResponse(!0,t),!0):s&&s!=="none"&&this.handlers[s]&&t.value&&this.handlers[s].exec(t.value,t)!==!0?(this.handleResponse(!1,t,"invalid_value"),!1):(this.handleResponse(!0,t),!0)}isValid(t){let e=!0,s,i,o;const r=[];return t.nodeName==="FORM"?o=[].slice.call(t.elements):o=[].slice.call(t.querySelectorAll("input, textarea, select, button, fieldset")),o.forEach(n=>{this.validate(n)===!1&&(e=!1,r.push(n))}),Object.keys(this.customValidators).length&&Object.keys(this.customValidators).foreach(n=>{this.customValidators[n].exec()!==!0&&(e=!1)}),!e&&r.length>0&&(t.getAttribute("data-validation-text")?s=t.getAttribute("data-validation-text"):s=Joomla.Text._("JLIB_FORM_CONTAINS_INVALID_FIELDS"),i={error:[s]},Joomla.renderMessages(i)),e}attachToForm(t){let e;t.nodeName==="FORM"?e=[].slice.call(t.elements):e=[].slice.call(t.querySelectorAll("input, textarea, select, button, fieldset")),e.forEach(s=>{const i=s.tagName.toLowerCase();["input","textarea","select","fieldset"].indexOf(i)>-1&&s.classList.contains("required")&&s.setAttribute("required",""),(i==="input"||i==="button")&&(s.getAttribute("type")==="submit"||s.getAttribute("type")==="image")?s.classList.contains("validate")&&s.addEventListener("click",()=>this.isValid(t)):i!=="button"&&!(i==="input"&&s.getAttribute("type")==="button")&&i!=="fieldset"&&(s.addEventListener("blur",({target:o})=>this.validate(o)),s.addEventListener("focus",({target:o})=>this.removeMarking(o)),s.classList.contains("validate-email")&&this.inputEmail&&s.setAttribute("type","email"))})}}const initialize=()=>{document.formvalidator=new JFormValidator,document.removeEventListener("DOMContentLoaded",initialize)};document.addEventListener("DOMContentLoaded",initialize);