(()=>{"use strict";function e(e){if("undefined"!=typeof document){if("complete"!==document.readyState&&"interactive"!==document.readyState)return document.addEventListener("DOMContentLoaded",e);e()}}const n={generic:[(e,n)=>n.hasAttribute("required")?((n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement)&&0===n.value.length&&(e=[...e,r("generic","required")]),e):e]};function t(e,t){var r;n[e]=null!==(r=n[e])&&void 0!==r?r:[],n[e]=t?[...n[e],t]:n[e]}function r(e,n){var t,r,o,i;return window.NelioFormsErrorMessages&&((null===(r=null===(t=window.NelioFormsErrorMessages)||void 0===t?void 0:t[e])||void 0===r?void 0:r[n])||(null===(i=null===(o=window.NelioFormsErrorMessages)||void 0===o?void 0:o.generic)||void 0===i?void 0:i.unknown))||"Unknown error"}const o=function(){let e=0;return(...t)=>{const r=()=>{(e=>{var t,r;const o=(e=>{var n;return e.dataset.fieldType||(null!==(n=Array.from(e.classList).filter(e=>e.includes("__value--")&&!e.includes("required"))[0])&&void 0!==n?n:"").split("--")[1]||""})(e);if(void 0===n[o])return;const i=[...null!==(t=n.generic)&&void 0!==t?t:[],...null!==(r=n[o])&&void 0!==r?r:[]],l=(e=>{var n;const t=document.getElementById(null!==(n=e.id.split("__")[0])&&void 0!==n?n:"");return t instanceof HTMLFormElement?t:null})(e);if(!l)return;const d=(e=>e.id.split("__")[1]||"")(e);!function(e,n,t){const r=function(e,n){return document.getElementById(`${e.id}__${n}`)||void 0}(e,n);if(!r)return;const o=function(e,n){return document.getElementById(`${e.id}__${n}-error`)||function(e,n){var t,r,o;const i=document.createElement("label");i.setAttribute("id",`${e.id}__${n}-error`),i.setAttribute("for",`${e.id}__${n}`),i.classList.add("nelio-forms-field__error-label");const l=null===(t=document.getElementById(`${e.id}__${n}`))||void 0===t?void 0:t.parentElement;return(null===(r=null==l?void 0:l.classList)||void 0===r?void 0:r.contains("nelio-forms-field__value-container"))?null===(o=null==l?void 0:l.parentNode)||void 0===o||o.appendChild(i):null==l||l.appendChild(i),i}(e,n)}(e,n);r.classList.remove("nelio-forms-field__value--error"),o.innerHTML="",t.length&&(r.classList.add("nelio-forms-field__value--error"),t.forEach(e=>{const n=document.createElement("div");n.textContent=e,o.appendChild(n)}))}(l,d,i.reduce((n,t)=>t(n,e),[]))})(...t),e=0};if(e)return clearTimeout(e),void(e=setTimeout(r,0));e=setTimeout(r,0)}}();function i(e,n){const t=n;return 0===t.value.length||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(t.value)||(e=[...e,r(t.type,"invalid")]),e}e(()=>Array.from(document.querySelectorAll(".nelio-forms-field__value")).forEach(e=>(e=>{e.addEventListener("keyup",()=>o(e)),e.addEventListener("change",()=>o(e)),e.addEventListener("blur",()=>o(e))})(e))),t("number",i),t("number-slider",i),e(()=>{Array.from(document.querySelectorAll(".nelio-forms-field__value-output-numeric")).forEach(e=>{e.innerHTML=Number(e.innerHTML).toLocaleString()}),Array.from(document.querySelectorAll(".nelio-forms-form input[type=range]")).forEach(e=>e.addEventListener("input",()=>{var n;const t=e.value;if(!t)return;const r=null===(n=e.parentElement)||void 0===n?void 0:n.querySelector(".nelio-forms-field__value-output-numeric");r&&(r.innerHTML=Number(t).toLocaleString())}))})})();