var __defProp = Object.defineProperty;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
var __commonJS = (cb, mod) => function() {
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var require_jquery_validator = __commonJS({
  "wdn/templates_6.1/js/lib/jquery-validator.js"(exports, module) {
    (function(factory) {
      typeof define == "function" && define.amd ? define(["jquery"], factory) : typeof module == "object" && module.exports ? factory(require("jquery")) : factory(jQuery);
    })(function($) {
      var version = "2.0", sValidation = "validation", sDataValidation = sValidation, sValidate = "validate", sInput = ":input", sVisible = ":visible", sChecked = ":checked", sClickInput = '[type="radio"], [type="checkbox"]', sReset = '[type="reset"]', sAdvice = "advice", sAdviceCnt = sAdvice + "-container", sCntCls = "input-box", sReqCls = "required-entry", sPass = "passed", sFail = "failed", sError = "error", sVPassCls = sValidation + "-" + sPass, sVFailCls = sValidation + "-" + sFail, sVErrorCls = sValidation + "-" + sError, sVAdviceCls = sValidation + "-" + sAdvice, sAdvicesSel = "." + sVAdviceCls + " li", sEvtForm = sValidate + "-form", sEvtElm = sValidate + "-element", sEvtUpdate = sValidate + "-update", K = /* @__PURE__ */ __name(function(x) {
        return x;
      }, "K"), parseNumber = /* @__PURE__ */ __name(function(v) {
        if (typeof v != "string")
          return parseFloat(v);
        var isDot = v.indexOf("."), isComa = v.indexOf(",");
        return isDot != -1 && isComa != -1 ? isComa > isDot ? v = v.replace(".", "").replace(",", ".") : v = v.replace(",", "") : isComa != -1 && (v = v.replace(",", ".")), parseFloat(v);
      }, "parseNumber");
      $.all = function(collection, callback) {
        var result = !0;
        return collection && (callback = callback || K, $.each(collection, function(idx, val) {
          return result = result && callback(val, idx), result;
        })), result;
      }, $.any = function(collection, callback) {
        var result = !1;
        return collection && (callback = callback || K, $.each(collection, function(idx, val) {
          return result = callback(val, idx), !result;
        })), result;
      };
      var Validator, Validation;
      Validator = /* @__PURE__ */ __name(function(className, error, test, options) {
        typeof test == "function" ? (this.options = options, this._test = test) : (this.options = test, this._test = function() {
          return !0;
        }), this.error = error || "Validation failed.";
      }, "Validator"), Validator.prototype = {
        test: /* @__PURE__ */ __name(function(v, elm, suite) {
          var result = this._test(v, elm, suite);
          return result && (result = $.all(this.options, function(value, key) {
            return Validator.methods[key] ? Validator.methods[key](v, elm, value, suite) : !0;
          })), result;
        }, "test")
      }, Validator.methods = {
        pattern: /* @__PURE__ */ __name(function(v, elm, opt) {
          return opt.test(v);
        }, "pattern"),
        minLength: /* @__PURE__ */ __name(function(v, elm, opt) {
          return v.length >= opt;
        }, "minLength"),
        maxLength: /* @__PURE__ */ __name(function(v, elm, opt) {
          return v.length <= opt;
        }, "maxLength"),
        min: /* @__PURE__ */ __name(function(v, elm, opt) {
          return v >= parseFloat(opt);
        }, "min"),
        max: /* @__PURE__ */ __name(function(v, elm, opt) {
          return v <= parseFloat(opt);
        }, "max"),
        notOneOf: /* @__PURE__ */ __name(function(v, elm, opt) {
          return $.all(opt, function(value) {
            return v != value;
          });
        }, "notOneOf"),
        oneOf: /* @__PURE__ */ __name(function(v, elm, opt) {
          return $.any(opt, function(value) {
            return v == value;
          });
        }, "oneOf"),
        is: /* @__PURE__ */ __name(function(v, elm, opt) {
          return v == opt;
        }, "is"),
        isNot: /* @__PURE__ */ __name(function(v, elm, opt) {
          return v != opt;
        }, "isNot"),
        equalToField: /* @__PURE__ */ __name(function(v, elm, opt) {
          return v == $(opt).val();
        }, "equalToField"),
        notEqualToField: /* @__PURE__ */ __name(function(v, elm, opt) {
          return v != $(opt).val();
        }, "notEqualToField"),
        include: /* @__PURE__ */ __name(function(v, elm, opt, suite) {
          return $.all(opt, function(value) {
            return Validation.methods[value] ? Validation.methods[value].test(v, elm, suite) : !0;
          });
        }, "include")
      }, Validation = /* @__PURE__ */ __name(function(form, options) {
        this.form = form, this.form && (this.options = options, this.options.onSubmit && this.form.submit($.proxy(this.onSubmit, this)), this.options.immediate && this.form.on("change blur", sInput, $.proxy(this.onChange, this)), this.options.onReset && this.form.on("click", sReset, $.proxy(this.reset, this)));
      }, "Validation"), Validation.prototype = {
        onChange: /* @__PURE__ */ __name(function(ev) {
          Validation.isOnChange = !0;
          var elm = ev.target;
          this.resetElement(elm), this.validateField(elm), Validation.isOnChange = !1;
        }, "onChange"),
        onSubmit: /* @__PURE__ */ __name(function() {
          if (!this.validate())
            return !1;
        }, "onSubmit"),
        validate: /* @__PURE__ */ __name(function() {
          var result = !1, results = [], self = this;
          $(sAdvicesSel, this.form).hide();
          try {
            $(sInput, this.form).each(function() {
              var result2 = self.validateField(this);
              if (results.push(result2), self.options.stopOnFirst && !result2)
                return result2;
            });
          } catch {
            results.push(!1);
          }
          var result = $.all(results);
          return !result && this.options.focusOnError && $("." + sVFailCls, this.form).filter(sInput + sVisible).first().focus(), this.form.triggerHandler(sEvtForm, [result]), result;
        }, "validate"),
        validateField: /* @__PURE__ */ __name(function(elm) {
          var self = this, classlist = elm.classList || elm.className.split(/\s+/);
          elm = $(elm);
          var result = $.all(classlist, function(item) {
            if (item && Validation.methods[item]) {
              var test = self.validateTest(item, elm);
              return elm.triggerHandler(sEvtElm, [test]), test;
            }
            return !0;
          });
          return result;
        }, "validateField"),
        validateTest: /* @__PURE__ */ __name(function(name, elm) {
          var v = Validation.methods[name];
          if (elm.is(sVisible) && !v.test(elm.val(), elm, this))
            return Validation.showAdvice(name, elm, this.options), elm.triggerHandler(sEvtUpdate, [sFail]), !1;
          if (elm.triggerHandler(sEvtUpdate, [sPass]), elm.removeClass(sVFailCls).addClass(sVPassCls), this.options.addClassNameToContainer) {
            var container = Validation.getContainer(elm, this.options);
            $("." + sVFailCls, container).length || ($.trim(elm.val()) || !elm.is(sVisible) ? container.addClass(sVPassCls) : container.removeClass(sVPassCls), container.removeClass(sVErrorCls));
          }
          return !0;
        }, "validateTest"),
        reset: /* @__PURE__ */ __name(function() {
          var self = this;
          $(sInput, this.form).each(function() {
            self.resetElement(this);
          });
        }, "reset"),
        resetElement: /* @__PURE__ */ __name(function(elm) {
          elm = $(elm);
          var advices = Validation.getAdviceContainer(elm, this.options);
          if ($(sAdvicesSel, advices).hide(), elm.removeClass(sVFailCls), elm.removeClass(sVPassCls), this.options.addClassNameToContainer) {
            var container = Validation.getContainer(elm, this.options);
            container.removeClass(sVPassCls).removeClass(sVFailCls);
          }
        }, "resetElement")
      };
      var tmpName = "IsEmpty", emptyTest = tmpName, m = {};
      m[tmpName] = new Validator(tmpName, "", function(v) {
        return $.trim(v) === "";
      }), tmpName = sReqCls, m[tmpName] = new Validator(tmpName, "This is a required field.", function(v) {
        return !m[emptyTest].test(v);
      }), tmpName = sValidate + "-number", m[tmpName] = new Validator(tmpName, "Please enter a valid number in this field.", function(v) {
        return m[emptyTest].test(v) || !isNaN(parseNumber(v));
      }), tmpName = sValidate + "-digits", m[tmpName] = new Validator(tmpName, "Please use numbers only in this field. please avoid spaces or other characters such as dots or commas.", function(v) {
        return m[emptyTest].test(v) || !/[^\d]/.test(v);
      }), tmpName = sValidate + "-alpha", m[tmpName] = new Validator(tmpName, "Please use letters only (a-z or A-Z) in this field.", function(v) {
        return m[emptyTest].test(v) || /^[a-zA-Z]+$/.test(v);
      }), tmpName = sValidate + "-code", m[tmpName] = new Validator(tmpName, "Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.", function(v) {
        return m[emptyTest].test(v) || /^[a-z]+[a-z0-9_]+$/.test(v);
      }), tmpName = sValidate + "-alphanum", m[tmpName] = new Validator(tmpName, "Please use only letters (a-z or A-Z) or numbers (0-9) only in this field. No spaces or other characters are allowed.", function(v) {
        return m[emptyTest].test(v) || /^[a-zA-Z0-9]+$/.test(v);
      }), tmpName = sValidate + "-phoneStrict", m[tmpName] = new Validator(tmpName, "Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.", function(v) {
        return m[emptyTest].test(v) || /^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(v);
      }), tmpName = sValidate + "-phoneLax", m[tmpName] = new Validator(tmpName, "Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.", function(v) {
        return m[emptyTest].test(v) || /^((\d[-. ]?)?((\(\d{3}\))|\d{3}))?[-. ]?\d{3}[-. ]?\d{4}$/.test(v);
      }), tmpName = sValidate + "-date", m[tmpName] = new Validator(tmpName, "Please enter a valid date.", function(v) {
        var test = new Date(v);
        return m[emptyTest].test(v) || !isNaN(test);
      }), tmpName = sValidate + "-email", m[tmpName] = new Validator(tmpName, "Please enter a valid email address. For example johndoe@domain.com", function(v) {
        return m[emptyTest].test(v) || /^[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+(\.[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,})/i.test(v);
      }), tmpName = sValidate + "-url", m[tmpName] = new Validator(tmpName, "Please enter a valid URL. http:// is required", function(v) {
        return m[emptyTest].test(v) || /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(v);
      }), tmpName = sValidate + "-zip", m[tmpName] = new Validator(tmpName, "Please enter a valid zip code. For example 90602 or 90602-1234.", function(v) {
        return m[emptyTest].test(v) || /^\d{5}(-\d{4})?$/.test(v);
      }), tmpName = sValidate + "-currency-dollar", m[tmpName] = new Validator(tmpName, "Please enter a valid $ amount. For example $100.00.", function(v) {
        return m[emptyTest].test(v) || /^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/.test(v);
      }), tmpName = sValidate + "-one-required", m[tmpName] = new Validator(tmpName, "Please select one of the above options.", function(v, elm, suite) {
        var options = $(sInput, Validation.getContainer(elm, suite.options));
        return $.any(options, function(elm2) {
          var r = $(elm2).val();
          return $(elm2).is(sClickInput) && (r = r && $(elm2).is(sChecked)), r;
        });
      }), tmpName = sValidate + "-one-required-by-name", m[tmpName] = new Validator(tmpName, "Please select one of the options.", function(v, elm) {
        var cleanName = elm.attr("name").replace(/([\\"])/g, "\\$1"), inputs = $('input[name="' + cleanName + '"]' + sChecked, elm[0].form);
        return inputs.length > 0;
      }), tmpName = sValidate + "-unsigned-number", m[tmpName] = new Validator(tmpName, "Please enter a valid number in this field.", function(v) {
        return v = parseNumber(v), !isNaN(v) && v >= 0;
      }), tmpName = sValidate + "-greater-than-zero", m[tmpName] = new Validator(tmpName, "Please enter a number greater than 0 in this field.", function(v) {
        return v.length ? parseFloat(v) > 0 : !0;
      }), tmpName = sValidate + "-zero-or-greater", m[tmpName] = new Validator(tmpName, "Please enter a number 0 or greater in this field.", function(v) {
        return v.length ? parseFloat(v) >= 0 : !0;
      }), tmpName = sValidate + "-percents", m[tmpName] = new Validator(tmpName, "Please enter a number lower than 100", { min: 0, max: 100 }), Validation.methods = m, Validation.getContainer = function(elm, options) {
        var container;
        if (options.containerClassName) {
          var parents = elm.parents("." + options.containerClassName);
          parents.length && (container = parents.first());
        }
        return container || (container = elm.parent()), container;
      }, Validation.getAdviceContainer = function(elm, options) {
        var adviceContainer = elm.closest("." + sAdviceCnt);
        return adviceContainer.length || (adviceContainer = Validation.getContainer(elm, options)), adviceContainer;
      }, Validation.showAdvice = function(name, elm, options) {
        var container = Validation.getContainer(elm, options);
        options.addClassNameToContainer && container.removeClass(sVPassCls).addClass(sVErrorCls);
        var adviceContainer = elm.closest("." + sAdviceCnt);
        adviceContainer.length ? (adviceContainer.removeClass(sVPassCls).addClass(sVFailCls), container = adviceContainer) : elm.removeClass(sVPassCls).addClass(sVFailCls);
        var advices = container.children("." + sVAdviceCls);
        advices.length || (advices = $("<ul/>", { class: sVAdviceCls }), container.append(advices));
        var cls = sAdvice + "-" + name, advice = $("li." + cls, advices);
        if (!advice.length) {
          advice = $("<li/>", { class: cls }).hide();
          var v = Validation.methods[name], errorMsg;
          options.useTitles && elm.attr("title") && (errorMsg = elm.attr("title")), errorMsg || (errorMsg = v.error), advice.text(errorMsg).appendTo(advices);
        }
        advice.show();
      }, $.fn.validation = function(options) {
        var opts = $.extend({}, $.fn.validation.defaults, options);
        return this.each(function() {
          $(this).data(sDataValidation) || $(this).data(sDataValidation, new Validation($(this), opts));
        }), this;
      }, $.fn.validation.defaults = {
        onSubmit: !0,
        onReset: !0,
        stopOnFirst: !1,
        immediate: !1,
        focusOnError: !0,
        useTitles: !1,
        addClassNameToContainer: !1,
        containerClassName: sCntCls
      }, $.validation = {
        addMethod: /* @__PURE__ */ __name(function(className, error, test, options) {
          Validation.methods[className] = new Validator(className, error, test, options);
        }, "addMethod"),
        version
      };
    });
  }
});
export default require_jquery_validator();
//# sourceMappingURL=jquery-validator.js.map
