PageSourceSearch

https://www.modulesgarden.com/products/assets/js/whmcs/newsletter.js?6abe5cbf68c4d=4

js modulesgarden.com collected 2026-10-01 13:15:03 UTC 73,753 bytes, 1,423 lines download raw bytes

1/*!
2 * jQuery Form Plugin
3 * version: 3.51.0-2014.06.20
4 * Requires jQuery v1.5 or later
5 * Copyright (c) 2014 M. Alsup
6 * Examples and documentation at: http://malsup.com/jquery/form/
7 * Project repository: https://github.com/malsup/form
8 * Dual licensed under the MIT and GPL licenses.
9 * https://github.com/malsup/form#copyright-and-license
10 */
11!function (e) {
12    "use strict";
13    "function" == typeof define && define.amd ? define(["jquery"], e) : e("undefined" != typeof jQuery ? jQuery : window.Zepto)
14}(function (e) {
15    "use strict";
16    
17    function t(t)
18    {
19        var r = t.data;
20        t.isDefaultPrevented() || (t.preventDefault(), e(t.target).ajaxSubmit(r))
21    }
22    
23    function r(t)
24    {
25        var r = t.target, a = e(r);
26        if (!a.is("[type=submit],[type=image]"))
27        {
28            var n = a.closest("[type=submit]");
29            if (0 === n.length)
30            {
31                return;
32            }
33            r = n[0]
34        }
35        var i = this;
36        if (i.clk = r, "image" == r.type)
37        {
38            if (void 0 !== t.offsetX)
39            {
40                i.clk_x = t.offsetX, i.clk_y = t.offsetY;
41            } else if ("function" == typeof e.fn.offset)
42            {
43                var o = a.offset();
44                i.clk_x = t.pageX - o.left, i.clk_y = t.pageY - o.top
45            } else
46            {
47                i.clk_x = t.pageX - r.offsetLeft, i.clk_y = t.pageY - r.offsetTop;
48            }
49        }
50        setTimeout(function () {
51            i.clk = i.clk_x = i.clk_y = null
52        }, 100)
53    }
54    
55    function a()
56    {
57        if (e.fn.ajaxSubmit.debug)
58        {
59            var t = "[jquery.form] " + Array.prototype.join.call(arguments, "");
60            window.console && window.console.log ? window.console.log(t) : window.opera && window.opera.postError && window.opera.postError(t)
61        }
62    }
63    
64    var n = {};
65    n.fileapi = void 0 !== e("<input type='file'/>").get(0).files, n.formdata = void 0 !== window.FormData;
66    var i = !!e.fn.prop;
67    e.fn.attr2 = function () {
68        if (!i)
69        {
70            return this.attr.apply(this, arguments);
71        }
72        var e = this.prop.apply(this, arguments);
73        return e && e.jquery || "string" == typeof e ? e : this.attr.apply(this, arguments)
74    }, e.fn.ajaxSubmit = function (t) {
75        function r(r)
76        {
77            var a, n, i = e.param(r, t.traditional).split("&"), o = i.length, s = [];
78            for (a = 0; o > a; a++)
79            {
80                i[a] = i[a].replace(/\+/g, " "), n = i[a].split("="), s.push([decodeURIComponent(n[0]), decodeURIComponent(n[1])]);
81            }
82            return s
83        }
84        
85        function o(a)
86        {
87            for (var n = new FormData, i = 0; i < a.length; i++)
88            {
89                n.append(a[i].name, a[i].value);
90            }
91            if (t.extraData)
92            {
93                var o = r(t.extraData);
94                for (i = 0; i < o.length; i++)
95                {
96                    o[i] && n.append(o[i][0], o[i][1])
97                }
98            }
99            t.data = null;
100            var s = e.extend(!0, {}, e.ajaxSettings, t, {contentType: !1, processData: !1, cache: !1, type: u || "POST"});
101            t.uploadProgress && (s.xhr = function () {
102                var r = e.ajaxSettings.xhr();
103                return r.upload && r.upload.addEventListener("progress", function (e) {
104                    var r = 0, a = e.loaded || e.position, n = e.total;
105                    e.lengthComputable && (r = Math.ceil(a / n * 100)), t.uploadProgress(e, a, n, r)
106                }, !1), r
107            }), s.data = null;
108            var c = s.beforeSend;
109            return s.beforeSend = function (e, r) {
110                r.data = t.formData ? t.formData : n, c && c.call(this, e, r)
111            }, e.ajax(s)
112        }
113        
114        function s(r)
115        {
116            function n(e)
117            {
118                var t = null;
119                try
120                {
121                    e.contentWindow && (t = e.contentWindow.document)
122                } catch (r)
123                {
124                    a("cannot get iframe.contentWindow document: " + r)
125                }
126                if (t)
127                {
128                    return t;
129                }
130                try
131                {
132                    t = e.contentDocument ? e.contentDocument : e.document
133                } catch (r)
134                {
135                    a("cannot get iframe.contentDocument: " + r), t = e.document
136                }
137                return t
138            }
139            
140            function o()
141            {
142                function t()
143                {
144                    try
145                    {
146                        var e = n(g).readyState;
147                        a("state = " + e), e && "uninitialized" == e.toLowerCase() && setTimeout(t, 50)
148                    } catch (r)
149                    {
150                        a("Server abort: ", r, " (", r.name, ")"), s(k), j && clearTimeout(j), j = void 0
151                    }
152                }
153                
154                var r = f.attr2("target"), i = f.attr2("action"), o = "multipart/form-data", c = f.attr("enctype") || f.attr("encoding") || o;
155                w.setAttribute("target", p), (!u || /post/i.test(u)) && w.setAttribute("method", "POST"), i != m.url && w.setAttribute("action", m.url), m.skipEncodingOverride || u && !/post/i.test(u) || f.attr({encoding: "multipart/form-data", enctype: "multipart/form-data"}), m.timeout && (j = setTimeout(function () {
156                    T = !0, s(D)
157                }, m.timeout));
158                var l = [];
159                try
160                {
161                    if (m.extraData)
162                    {
163                        for (var d in m.extraData)
164                        {
165                            m.extraData.hasOwnProperty(d) && l.push(e.isPlainObject(m.extraData[d]) && m.extraData[d].hasOwnProperty("name") && m.extraData[d].hasOwnProperty("value") ? e('<input type="hidden" name="' + m.extraData[d].name + '">').val(m.extraData[d].value).appendTo(w)[0] : e('<input type="hidden" name="' + d + '">').val(m.extraData[d]).appendTo(w)[0]);
166                        }
167                    }
168                    m.iframeTarget || v.appendTo("body"), g.attachEvent ? g.attachEvent("onload", s) : g.addEventListener("load", s, !1), setTimeout(t, 15);
169                    try
170                    {
171                        w.submit()
172                    } catch (h)
173                    {
174                        var x = document.createElement("form").submit;
175                        x.apply(w)
176                    }
177                } finally
178                {
179                    w.setAttribute("action", i), w.setAttribute("enctype", c), r ? w.setAttribute("target", r) : f.removeAttr("target"), e(l).remove()
180                }
181            }
182            
183            function s(t)
184            {
185                if (!x.aborted && !F)
186                {
187                    if (M = n(g), M || (a("cannot access response document"), t = k), t === D && x)
188                    {
189                        return x.abort("timeout"), void S.reject(x, "timeout");
190                    }
191                    if (t == k && x)
192                    {
193                        return x.abort("server abort"), void S.reject(x, "error", "server abort");
194                    }
195                    if (M && M.location.href != m.iframeSrc || T)
196                    {
197                        g.detachEvent ? g.detachEvent("onload", s) : g.removeEventListener("load", s, !1);
198                        var r, i = "success";
199                        try
200                        {
201                            if (T)
202                            {
203                                throw "timeout";
204                            }
205                            var o = "xml" == m.dataType || M.XMLDocument || e.isXMLDoc(M);
206                            if (a("isXml=" + o), !o && window.opera && (null === M.body || !M.body.innerHTML) && --O)
207                            {
208                                return a("requeing onLoad callback, DOM not available"), void setTimeout(s, 250);
209                            }
210                            var u = M.body ? M.body : M.documentElement;
211                            x.responseText = u ? u.innerHTML : null, x.responseXML = M.XMLDocument ? M.XMLDocument : M, o && (m.dataType = "xml"), x.getResponseHeader = function (e) {
212                                var t = {"content-type": m.dataType};
213                                return t[e.toLowerCase()]
214                            }, u && (x.status = Number(u.getAttribute("status")) || x.status, x.statusText = u.getAttribute("statusText") || x.statusText);
215                            var c = (m.dataType || "").toLowerCase(), l = /(json|script|text)/.test(c);
216                            if (l || m.textarea)
217                            {
218                                var f = M.getElementsByTagName("textarea")[0];
219                                if (f)
220                                {
221                                    x.responseText = f.value, x.status = Number(f.getAttribute("status")) || x.status, x.statusText = f.getAttribute("statusText") || x.statusText;
222                                } else if (l)
223                                {
224                                    var p = M.getElementsByTagName("pre")[0], h = M.getElementsByTagName("body")[0];
225                                    p ? x.responseText = p.textContent ? p.textContent : p.innerText : h && (x.responseText = h.textContent ? h.textContent : h.innerText)
226                                }
227                            } else
228                            {
229                                "xml" == c && !x.responseXML && x.responseText && (x.responseXML = X(x.responseText));
230                            }
231                            try
232                            {
233                                E = _(x, c, m)
234                            } catch (y)
235                            {
236                                i = "parsererror", x.error = r = y || i
237                            }
238                        } catch (y)
239                        {
240                            a("error caught: ", y), i = "error", x.error = r = y || i
241                        }
242                        x.aborted && (a("upload aborted"), i = null), x.status && (i = x.status >= 200 && x.status < 300 || 304 === x.status ? "success" : "error"), "success" === i ? (m.success && m.success.call(m.context, E, "success", x), S.resolve(x.responseText, "success", x), d && e.event.trigger("ajaxSuccess", [x, m])) : i && (void 0 === r && (r = x.statusText), m.error && m.error.call(m.context, x, i, r), S.reject(x, "error", r), d && e.event.trigger("ajaxError", [x, m, r])), d && e.event.trigger("ajaxComplete", [x, m]), d && !--e.active && e.event.trigger("ajaxStop"), m.complete && m.complete.call(m.context, x, i), F = !0, m.timeout && clearTimeout(j), setTimeout(function () {
243                            m.iframeTarget ? v.attr("src", m.iframeSrc) : v.remove(), x.responseXML = null
244                        }, 100)
245                    }
246                }
247            }
248            
249            var c, l, m, d, p, v, g, x, y, b, T, j, w = f[0], S = e.Deferred();
250            if (S.abort = function (e) {
251                x.abort(e)
252            }, r)
253            {
254                for (l = 0; l < h.length; l++)
255                {
256                    c = e(h[l]), i ? c.prop("disabled", !1) : c.removeAttr("disabled");
257                }
258            }
259            if (m = e.extend(!0, {}, e.ajaxSettings, t), m.context = m.context || m, p = "jqFormIO" + (new Date).getTime(), m.iframeTarget ? (v = e(m.iframeTarget), b = v.attr2("name"), b ? p = b : v.attr2("name", p)) : (v = e('<iframe name="' + p + '" src="' + m.iframeSrc + '" />'), v.css({position: "absolute", top: "-1000px", left: "-1000px"})), g = v[0], x = {
260                aborted: 0, responseText: null, responseXML: null, status: 0, statusText: "n/a", getAllResponseHeaders: function () {
261                }, getResponseHeader: function () {
262                }, setRequestHeader: function () {
263                }, abort: function (t) {
264                    var r = "timeout" === t ? "timeout" : "aborted";
265                    a("aborting upload... " + r), this.aborted = 1;
266                    try
267                    {
268                        g.contentWindow.document.execCommand && g.contentWindow.document.execCommand("Stop")
269                    } catch (n)
270                    {
271                    }
272                    v.attr("src", m.iframeSrc), x.error = r, m.error && m.error.call(m.context, x, r, t), d && e.event.trigger("ajaxError", [x, m, r]), m.complete && m.complete.call(m.context, x, r)
273                }
274            }, d = m.global, d && 0 === e.active++ && e.event.trigger("ajaxStart"), d && e.event.trigger("ajaxSend", [x, m]), m.beforeSend && m.beforeSend.c
274all(m.context, x, m) === !1)
275            {
276                return m.global && e.active--, S.reject(), S;
277            }
278            if (x.aborted)
279            {
280                return S.reject(), S;
281            }
282            y = w.clk, y && (b = y.name, b && !y.disabled && (m.extraData = m.extraData || {}, m.extraData[b] = y.value, "image" == y.type && (m.extraData[b + ".x"] = w.clk_x, m.extraData[b + ".y"] = w.clk_y)));
283            var D = 1, k = 2, A = e("meta[name=csrf-token]").attr("content"), L = e("meta[name=csrf-param]").attr("content");
284            L && A && (m.extraData = m.extraData || {}, m.extraData[L] = A), m.forceSync ? o() : setTimeout(o, 10);
285            var E, M, F, O = 50, X = e.parseXML || function (e, t) {
286                return window.ActiveXObject ? (t = new ActiveXObject("Microsoft.XMLDOM"), t.async = "false", t.loadXML(e)) : t = (new DOMParser).parseFromString(e, "text/xml"), t && t.documentElement && "parsererror" != t.documentElement.nodeName ? t : null
287            }, C = e.parseJSON || function (e) {
288                return window.eval("(" + e + ")")
289            }, _ = function (t, r, a) {
290                var n = t.getResponseHeader("content-type") || "", i = "xml" === r || !r && n.indexOf("xml") >= 0, o = i ? t.responseXML : t.responseText;
291                return i && "parsererror" === o.documentElement.nodeName && e.error && e.error("parsererror"), a && a.dataFilter && (o = a.dataFilter(o, r)), "string" == typeof o && ("json" === r || !r && n.indexOf("json") >= 0 ? o = C(o) : ("script" === r || !r && n.indexOf("javascript") >= 0) && e.globalEval(o)), o
292            };
293            return S
294        }
295        
296        if (!this.length)
297        {
298            return a("ajaxSubmit: skipping submit process - no element selected"), this;
299        }
300        var u, c, l, f = this;
301        "function" == typeof t ? t = {success: t} : void 0 === t && (t = {}), u = t.type || this.attr2("method"), c = t.url || this.attr2("action"), l = "string" == typeof c ? e.trim(c) : "", l = l || window.location.href || "", l && (l = (l.match(/^([^#]+)/) || [])[1]), t = e.extend(!0, {url: l, success: e.ajaxSettings.success, type: u || e.ajaxSettings.type, iframeSrc: /^https/i.test(window.location.href || "") ? "javascript:false" : "about:blank"}, t);
302        var m = {};
303        if (this.trigger("form-pre-serialize", [this, t, m]), m.veto)
304        {
305            return a("ajaxSubmit: submit vetoed via form-pre-serialize trigger"), this;
306        }
307        if (t.beforeSerialize && t.beforeSerialize(this, t) === !1)
308        {
309            return a("ajaxSubmit: submit aborted via beforeSerialize callback"), this;
310        }
311        var d = t.traditional;
312        void 0 === d && (d = e.ajaxSettings.traditional);
313        var p, h = [], v = this.formToArray(t.semantic, h);
314        if (t.data && (t.extraData = t.data, p = e.param(t.data, d)), t.beforeSubmit && t.beforeSubmit(v, this, t) === !1)
315        {
316            return a("ajaxSubmit: submit aborted via beforeSubmit callback"), this;
317        }
318        if (this.trigger("form-submit-validate", [v, this, t, m]), m.veto)
319        {
320            return a("ajaxSubmit: submit vetoed via form-submit-validate trigger"), this;
321        }
322        var g = e.param(v, d);
323        p && (g = g ? g + "&" + p : p), "GET" == t.type.toUpperCase() ? (t.url += (t.url.indexOf("?") >= 0 ? "&" : "?") + g, t.data = null) : t.data = g;
324        var x = [];
325        if (t.resetForm && x.push(function () {
326            f.resetForm()
327        }), t.clearForm && x.push(function () {
328            f.clearForm(t.includeHidden)
329        }), !t.dataType && t.target)
330        {
331            var y = t.success || function () {
332            };
333            x.push(function (r) {
334                var a = t.replaceTarget ? "replaceWith" : "html";
335                e(t.target)[a](r).each(y, arguments)
336            })
337        } else
338        {
339            t.success && x.push(t.success);
340        }
341        if (t.success = function (e, r, a) {
342            for (var n = t.context || this, i = 0, o = x.length; o > i; i++)
343            {
344                x[i].apply(n, [e, r, a || f, f])
345            }
346        }, t.error)
347        {
348            var b = t.error;
349            t.error = function (e, r, a) {
350                var n = t.context || this;
351                b.apply(n, [e, r, a, f])
352            }
353        }
354        if (t.complete)
355        {
356            var T = t.complete;
357            t.complete = function (e, r) {
358                var a = t.context || this;
359                T.apply(a, [e, r, f])
360            }
361        }
362        var j = e("input[type=file]:enabled", this).filter(function () {
363            return "" !== e(this).val()
364        }), w = j.length > 0, S = "multipart/form-data", D = f.attr("enctype") == S || f.attr("encoding") == S, k = n.fileapi && n.formdata;
365        a("fileAPI :" + k);
366        var A, L = (w || D) && !k;
367        t.iframe !== !1 && (t.iframe || L) ? t.closeKeepAlive ? e.get(t.closeKeepAlive, function () {
368            A = s(v)
369        }) : A = s(v) : A = (w || D) && k ? o(v) : e.ajax(t), f.removeData("jqxhr").data("jqxhr", A);
370        for (var E = 0; E < h.length; E++)
371        {
372            h[E] = null;
373        }
374        return this.trigger("form-submit-notify", [this, t]), this
375    }, e.fn.ajaxForm = function (n) {
376        if (n = n || {}, n.delegation = n.delegation && e.isFunction(e.fn.on), !n.delegation && 0 === this.length)
377        {
378            var i = {s: this.selector, c: this.context};
379            return !e.isReady && i.s ? (a("DOM not ready, queuing ajaxForm"), e(function () {
380                e(i.s, i.c).ajaxForm(n)
381            }), this) : (a("terminating; zero elements found by selector" + (e.isReady ? "" : " (DOM not ready)")), this)
382        }
383        return n.delegation ? (e(document).off("submit.form-plugin", this.selector, t).off("click.form-plugin", this.selector, r).on("submit.form-plugin", this.selector, n, t).on("click.form-plugin", this.selector, n, r), this) : this.ajaxFormUnbind().bind("submit.form-plugin", n, t).bind("click.form-plugin", n, r)
384    }, e.fn.ajaxFormUnbind = function () {
385        return this.unbind("submit.form-plugin click.form-plugin")
386    }, e.fn.formToArray = function (t, r) {
387        var a = [];
388        if (0 === this.length)
389        {
390            return a;
391        }
392        var i, o = this[0], s = this.attr("id"), u = t ? o.getElementsByTagName("*") : o.elements;
393        if (u && !/MSIE [678]/.test(navigator.userAgent) && (u = e(u).get()), s && (i = e(':input[form="' + s + '"]').get(), i.length && (u = (u || []).concat(i))), !u || !u.length)
394        {
395            return a;
396        }
397        var c, l, f, m, d, p, h;
398        for (c = 0, p = u.length; p > c; c++)
399        {
400            if (d = u[c], f = d.name, f && !d.disabled)
401            {
402                if (t && o.clk && "image" == d.type)
403                {
404                    o.clk == d && (a.push({name: f, value: e(d).val(), type: d.type}), a.push({name: f + ".x", value: o.clk_x}, {name: f + ".y", value: o.clk_y}));
405                } else if (m = e.fieldValue(d, !0), m && m.constructor == Array)
406                {
407                    for (r && r.push(d), l = 0, h = m.length; h > l; l++)
408                    {
409                        a.push({name: f, value: m[l]});
410                    }
411                } else if (n.fileapi && "file" == d.type)
412                {
413                    r && r.push(d);
414                    var v = d.files;
415                    if (v.length)
416                    {
417                        for (l = 0; l < v.length; l++)
418                        {
419                            a.push({name: f, value: v[l], type: d.type});
420                        }
421                    } else
422                    {
423                        a.push({name: f, value: "", type: d.type})
424                    }
425                } else
426                {
427                    null !== m && "undefined" != typeof m && (r && r.push(d), a.push({name: f, value: m, type: d.type, required: d.required}));
428                }
429            }
430        }
431        if (!t && o.clk)
432        {
433            var g = e(o.clk), x = g[0];
434            f = x.name, f && !x.disabled && "image" == x.type && (a.push({name: f, value: g.val()}), a.push({name: f + ".x", value: o.clk_x}, {name: f + ".y", value: o.clk_y}))
435        }
436        return a
437    }
437, e.fn.formSerialize = function (t) {
438        return e.param(this.formToArray(t))
439    }, e.fn.fieldSerialize = function (t) {
440        var r = [];
441        return this.each(function () {
442            var a = this.name;
443            if (a)
444            {
445                var n = e.fieldValue(this, t);
446                if (n && n.constructor == Array)
447                {
448                    for (var i = 0, o = n.length; o > i; i++)
449                    {
450                        r.push({name: a, value: n[i]});
451                    }
452                } else
453                {
454                    null !== n && "undefined" != typeof n && r.push({name: this.name, value: n})
455                }
456            }
457        }), e.param(r)
458    }, e.fn.fieldValue = function (t) {
459        for (var r = [], a = 0, n = this.length; n > a; a++)
460        {
461            var i = this[a], o = e.fieldValue(i, t);
462            null === o || "undefined" == typeof o || o.constructor == Array && !o.length || (o.constructor == Array ? e.merge(r, o) : r.push(o))
463        }
464        return r
465    }, e.fieldValue = function (t, r) {
466        var a = t.name, n = t.type, i = t.tagName.toLowerCase();
467        if (void 0 === r && (r = !0), r && (!a || t.disabled || "reset" == n || "button" == n || ("checkbox" == n || "radio" == n) && !t.checked || ("submit" == n || "image" == n) && t.form && t.form.clk != t || "select" == i && -1 == t.selectedIndex))
468        {
469            return null;
470        }
471        if ("select" == i)
472        {
473            var o = t.selectedIndex;
474            if (0 > o)
475            {
476                return null;
477            }
478            for (var s = [], u = t.options, c = "select-one" == n, l = c ? o + 1 : u.length, f = c ? o : 0; l > f; f++)
479            {
480                var m = u[f];
481                if (m.selected)
482                {
483                    var d = m.value;
484                    if (d || (d = m.attributes && m.attributes.value && !m.attributes.value.specified ? m.text : m.value), c)
485                    {
486                        return d;
487                    }
488                    s.push(d)
489                }
490            }
491            return s
492        }
493        return e(t).val()
494    }, e.fn.clearForm = function (t) {
495        return this.each(function () {
496            e("input,select,textarea", this).clearFields(t)
497        })
498    }, e.fn.clearFields = e.fn.clearInputs = function (t) {
499        var r = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;
500        return this.each(function () {
501            var a = this.type, n = this.tagName.toLowerCase();
502            r.test(a) || "textarea" == n ? this.value = "" : "checkbox" == a || "radio" == a ? this.checked = !1 : "select" == n ? this.selectedIndex = -1 : "file" == a ? /MSIE/.test(navigator.userAgent) ? e(this).replaceWith(e(this).clone(!0)) : e(this).val("") : t && (t === !0 && /hidden/.test(a) || "string" == typeof t && e(this).is(t)) && (this.value = "")
503        })
504    }, e.fn.resetForm = function () {
505        return this.each(function () {
506            ("function" == typeof this.reset || "object" == typeof this.reset && !this.reset.nodeType) && this.reset()
507        })
508    }, e.fn.enable = function (e) {
509        return void 0 === e && (e = !0), this.each(function () {
510            this.disabled = !e
511        })
512    }, e.fn.selected = function (t) {
513        return void 0 === t && (t = !0), this.each(function () {
514            var r = this.type;
515            if ("checkbox" == r || "radio" == r)
516            {
517                this.checked = t;
518            } else if ("option" == this.tagName.toLowerCase())
519            {
520                var a = e(this).parent("select");
521                t && a[0] && "select-one" == a[0].type && a.find("option").selected(!1), this.selected = t
522            }
523        })
524    }, e.fn.ajaxSubmit.debug = !1
525});
526
527/*! jQuery Validation Plugin - v1.12.0 - 4/1/2014
528 * http://jqueryvalidation.org/
529 * Copyright (c) 2014 Jörn Zaefferer; Licensed MIT */
530!function (a) {
531    a.extend(a.fn, {
532        validate: function (b) {
533            if (!this.length)
534            {
535                return void (b && b.debug && window.console && console.warn("Nothing selected, can't validate, returning nothing."));
536            }
537            var c = a.data(this[0], "validator");
538            return c ? c : (this.attr("novalidate", "novalidate"), c = new a.validator(b, this[0]), a.data(this[0], "validator", c), c.settings.onsubmit && (this.validateDelegate(":submit", "click", function (b) {
539                c.settings.submitHandler && (c.submitButton = b.target), a(b.target).hasClass("cancel") && (c.cancelSubmit = !0), void 0 !== a(b.target).attr("formnovalidate") && (c.cancelSubmit = !0)
540            }), this.submit(function (b) {
541                function d()
542                {
543                    var d;
544                    return c.settings.submitHandler ? (c.submitButton && (d = a("<input type='hidden'/>").attr("name", c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)), c.settings.submitHandler.call(c, c.currentForm, b), c.submitButton && d.remove(), !1) : !0
545                }
546                
547                return c.settings.debug && b.preventDefault(), c.cancelSubmit ? (c.cancelSubmit = !1, d()) : c.form() ? c.pendingRequest ? (c.formSubmitted = !0, !1) : d() : (c.focusInvalid(), !1)
548            })), c)
549        }, valid: function () {
550            var b, c;
551            return a(this[0]).is("form") ? b = this.validate().form() : (b = !0, c = a(this[0].form).validate(), this.each(function () {
552                b = c.element(this) && b
553            })), b
554        }, removeAttrs: function (b) {
555            var c = {}, d = this;
556            return a.each(b.split(/\s/), function (a, b) {
557                c[b] = d.attr(b), d.removeAttr(b)
558            }), c
559        }, rules: function (b, c) {
560            var d, e, f, g, h, i, j = this[0];
561            if (b)
562            {
563                switch (d = a.data(j.form, "validator").settings, e = d.rules, f = a.validator.staticRules(j), b)
564                {
565                    case"add":
566                        a.extend(f, a.validator.normalizeRule(c)), delete f.messages, e[j.name] = f, c.messages && (d.messages[j.name] = a.extend(d.messages[j.name], c.messages));
567                        break;
568                    case"remove":
569                        return c ? (i = {}, a.each(c.split(/\s/), function (b, c) {
570                            i[c] = f[c], delete f[c], "required" === c && a(j).removeAttr("aria-required")
571                        }), i) : (delete e[j.name], f)
572                }
573            }
574            return g = a.validator.normalizeRules(a.extend({}, a.validator.classRules(j), a.validator.attributeRules(j), a.validator.dataRules(j), a.validator.staticRules(j)), j), g.required && (h = g.required, delete g.required, g = a.extend({required: h}, g), a(j).attr("aria-required", "true")), g.remote && (h = g.remote, delete g.remote, g = a.extend(g, {remote: h})), g
575        }
576    }), a.extend(a.expr[":"], {
577        blank: function (b) {
578            return !a.trim("" + a(b).val())
579        }, filled: function (b) {
580            return !!a.trim("" + a(b).val())
581        }, unchecked: function (b) {
582            return !a(b).prop("checked")
583        }
584    }), a.validator = function (b, c) {
585        this.settings = a.extend(!0, {}, a.validator.defaults, b), this.currentForm = c, this.init()
586    }, a.validator.format = function (b, c) {
587        return 1 === arguments.length ? function () {
588            var c = a.makeArray(arguments);
589            return c.unshift(b), a.validator.format.apply(this, c)
590        } : (arguments.length > 2 && c.constructor !== Array && (c = a.makeArray(arguments).slice(1)), c.constructor !== Array && (c = [c]), a.each(c, function (a, c) {
591            b = b.replace(new RegExp("\\{" + a + "\\}", "g"), function () {
592                return c
593            })
594        }), b)
595    }, a.extend(a.validator, {
596        defaults: {
597            messages: {}, groups: {}, rules: {}, errorClass: "error", validClass: "valid", errorElement: "label", focusInvalid: !0, errorContainer: a([]), errorLabelContainer: a([]), onsubmit: !0, ignore: ":hidden", ignoreTitle: !1, onfocusin: function (a) {
598                this.lastActive = a, this.settings.focusCleanup && !this.blockFocusCleanup && (this.settings.unhighlight && this.settings.unhighlight.call(this, a, this.settings.errorClass, this.settings.validClass), this.addWrapper(this.errorsFor(a)).hide())
599            }, onfocusout: function (a) {
600                this.checkable(a) || !(a.name in this.submitted) && this.optional(a) || this.element(a)
601            }, onkeyup: function (a, b) {
602                (9 !== b.which || "" !== this.elementValue(a)) && (a.name in this.submitted || a === this.lastElement) && this.element(a)
603            }, onclick: function (a) {
604                a.name in this.submitted ? this.element(a) : a.parentNode.name in this.submitted && this.element(a.parentNode)
605            }, highlight: function (b, c, d) {
606                "radio" === b.type ? this.findByName(b.name).addClass(c).removeClass(d) : a(b).addClass(c).removeClass(d)
607            }, unhighlight: function (b, c, d) {
608                "radio" === b.type ? this.findByName(b.name).removeClass(c).addClass(d) : a(b).removeClass(c).addClass(d)
609            }
610        }, setDefaults: function (b) {
611            a.extend(a.validator.defaults, b)
612        }, messages: {required: "This field is required.", remote: "Please fix this field.", email: "Please enter a valid email address.", url: "Please enter a valid URL.", date: "Please enter a valid date.", dateISO: "Please enter a valid date (ISO).", number: "Please enter a valid number.", digits: "Please enter only digits.", creditcard: "Please enter a valid credit card number.", equalTo: "Please enter the same value again.", maxlength: a.validator.format("Please enter no more than {0} characters."), minlength: a.validator.format("Please enter at least {0} characters."), rangelength: a.validator.format("Please enter a value between {0} and {1} characters long."), range: a.validator.format("Please enter a value between {0} and {1}."), max: a.validator.format("Please enter a value less than or equal to {0}."), min: a.validator.format("Please enter a value greater than or equal to {0}.")}, autoCreateRanges: !1, prototype: {
613            init: function () {
614                function b(b)
615                {
616                    var c = a.data(this[0].form, "validator"), d = "on" + b.type.replace(/^validate/, ""), e = c.settings;
617                    e[d] && !this.is(e.ignore) && e[d].call(c, this[0], b)
618                }
619                
620                this.labelContainer = a(this.settings.errorLabelContainer), this.errorContext = this.labelContainer.length && this.labelContainer || a(this.currentForm), this.containers = a(this.settings.errorContainer).add(this.settings.errorLabelContainer), this.submitted = {}, this.valueCache = {}, this.pendingRequest = 0, this.pending = {}, this.invalid = {}, this.reset();
621                var c, d = this.groups = {};
622                a.each(this.settings.groups, function (b, c) {
623                    "string" == typeof c && (c = c.split(/\s/)), a.each(c, function (a, c) {
624                        d[c] = b
625                    })
626                }), c = this.settings.rules, a.each(c, function (b, d) {
627                    c[b] = a.validator.normalizeRule(d)
628                }), a(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ", "focu
628sin focusout keyup", b).validateDelegate("[type='radio'], [type='checkbox'], select, option", "click", b), this.settings.invalidHandler && a(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler), a(this.currentForm).find("[required], [data-rule-required], .required").attr("aria-required", "true")
629            }, form: function () {
630                return this.checkForm(), a.extend(this.submitted, this.errorMap), this.invalid = a.extend({}, this.errorMap), this.valid() || a(this.currentForm).triggerHandler("invalid-form", [this]), this.showErrors(), this.valid()
631            }, checkForm: function () {
632                this.prepareForm();
633                for (var a = 0, b = this.currentElements = this.elements(); b[a]; a++)
634                {
635                    this.check(b[a]);
636                }
637                return this.valid()
638            }, element: function (b) {
639                var c = this.clean(b), d = this.validationTargetFor(c), e = !0;
640                return this.lastElement = d, void 0 === d ? delete this.invalid[c.name] : (this.prepareElement(d), this.currentElements = a(d), e = this.check(d) !== !1, e ? delete this.invalid[d.name] : this.invalid[d.name] = !0), a(b).attr("aria-invalid", !e), this.numberOfInvalids() || (this.toHide = this.toHide.add(this.containers)), this.showErrors(), e
641            }, showErrors: function (b) {
642                if (b)
643                {
644                    a.extend(this.errorMap, b), this.errorList = [];
645                    for (var c in b)
646                    {
647                        this.errorList.push({message: b[c], element: this.findByName(c)[0]});
648                    }
649                    this.successList = a.grep(this.successList, function (a) {
650                        return !(a.name in b)
651                    })
652                }
653                this.settings.showErrors ? this.settings.showErrors.call(this, this.errorMap, this.errorList) : this.defaultShowErrors()
654            }, resetForm: function () {
655                a.fn.resetForm && a(this.currentForm).resetForm(), this.submitted = {}, this.lastElement = null, this.prepareForm(), this.hideErrors(), this.elements().removeClass(this.settings.errorClass).removeData("previousValue").removeAttr("aria-invalid")
656            }, numberOfInvalids: function () {
657                return this.objectLength(this.invalid)
658            }, objectLength: function (a) {
659                var b, c = 0;
660                for (b in a)
661                {
662                    c++;
663                }
664                return c
665            }, hideErrors: function () {
666                this.addWrapper(this.toHide).hide()
667            }, valid: function () {
668                return 0 === this.size()
669            }, size: function () {
670                return this.errorList.length
671            }, focusInvalid: function () {
672                if (this.settings.focusInvalid)
673                {
674                    try
675                    {
676                        a(this.findLastActive() || this.errorList.length && this.errorList[0].element || []).filter(":visible").focus().trigger("focusin")
677                    } catch (b)
678                    {
679                    }
680                }
681            }, findLastActive: function () {
682                var b = this.lastActive;
683                return b && 1 === a.grep(this.errorList, function (a) {
684                    return a.element.name === b.name
685                }).length && b
686            }, elements: function () {
687                var b = this, c = {};
688                return a(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function () {
689                    return !this.name && b.settings.debug && window.console && console.error("%o has no name assigned", this), this.name in c || !b.objectLength(a(this).rules()) ? !1 : (c[this.name] = !0, !0)
690                })
691            }, clean: function (b) {
692                return a(b)[0]
693            }, errors: function () {
694                var b = this.settings.errorClass.split(" ").join(".");
695                return a(this.settings.errorElement + "." + b, this.errorContext)
696            }, reset: function () {
697                this.successList = [], this.errorList = [], this.errorMap = {}, this.toShow = a([]), this.toHide = a([]), this.currentElements = a([])
698            }, prepareForm: function () {
699                this.reset(), this.toHide = this.errors().add(this.containers
699)
700            }, prepareElement: function (a) {
701                this.reset(), this.toHide = this.errorsFor(a)
702            }, elementValue: function (b) {
703                var c, d = a(b), e = d.attr("type");
704                return "radio" === e || "checkbox" === e ? a("input[name='" + d.attr("name") + "']:checked").val() : (c = d.val(), "string" == typeof c ? c.replace(/\r/g, "") : c)
705            }, check: function (b) {
706                b = this.validationTargetFor(this.clean(b));
707                var c, d, e, f = a(b).rules(), g = a.map(f, function (a, b) {
708                    return b
709                }).length, h = !1, i = this.elementValue(b);
710                for (d in f)
711                {
712                    e = {method: d, parameters: f[d]};
713                    try
714                    {
715                        if (c = a.validator.methods[d].call(this, i, b, e.parameters), "dependency-mismatch" === c && 1 === g)
716                        {
717                            h = !0;
718                            continue
719                        }
720                        if (h = !1, "pending" === c)
721                        {
722                            return void (this.toHide = this.toHide.not(this.errorsFor(b)));
723                        }
724                        if (!c)
725                        {
726                            return this.formatAndAdd(b, e), !1
727                        }
728                    } catch (j)
729                    {
730                        throw this.settings.debug && window.console && console.log("Exception occurred when checking element " + b.id + ", check the '" + e.method + "' method.", j), j
731                    }
732                }
733                if (!h)
734                {
735                    return this.objectLength(f) && this.successList.push(b), !0
736                }
737            }, customDataMessage: function (b, c) {
738                return a(b).data("msg" + c[0].toUpperCase() + c.substring(1).toLowerCase()) || a(b).data("msg")
739            }, customMessage: function (a, b) {
740                var c = this.settings.messages[a];
741                return c && (c.constructor === String ? c : c[b])
742            }, findDefined: function () {
743                for (var a = 0; a < arguments.length; a++)
744                {
745                    if (void 0 !== arguments[a])
746                    {
747                        return arguments[a];
748                    }
749                }
750                return void 0
751            }, defaultMessage: function (b, c) {
752                return this.findDefined(this.customMessage(b.name, c), this.customDataMessage(b, c), !this.settings.ignoreTitle && b.title || void 0, a.validator.messages[c], "<strong>Warning: No message defined for " + b.name + "</strong>")
753            }, formatAndAdd: function (b, c) {
754                var d = this.defaultMessage(b, c.method), e = /\$?\{(\d+)\}/g;
755                "function" == typeof d ? d = d.call(this, c.parameters, b) : e.test(d) && (d = a.validator.format(d.replace(e, "{$1}"), c.parameters)), this.errorList.push({message: d, element: b, method: c.method}), this.errorMap[b.name] = d, this.submitted[b.name] = d
756            }, addWrapper: function (a) {
757                return this.settings.wrapper && (a = a.add(a.parent(this.settings.wrapper))), a
758            }, defaultShowErrors: function () {
759                var a, b, c;
760                for (a = 0; this.errorList[a]; a++)
761                {
762                    c = this.errorList[a], this.settings.highlight && this.settings.highlight.call(this, c.element, this.settings.errorClass, this.settings.validClass), this.showLabel(c.element, c.message);
763                }
764                if (this.errorList.length && (this.toShow = this.toShow.add(this.containers)), this.settings.success)
765                {
766                    for (a = 0; this.successList[a]; a++)
767                    {
768                        this.showLabel(this.successList[a]);
769                    }
770                }
771                if (this.settings.unhighlight)
772                {
773                    for (a = 0, b = this.validElements(); b[a]; a++)
774                    {
775                        this.settings.unhighlight.call(this, b[a], this.settings.errorClass, this.settings.val
775idClass);
776                    }
777                }
778                this.toHide = this.toHide.not(this.toShow), this.hideErrors(), this.addWrapper(this.toShow).show()
779            }, validElements: function () {
780                return this.currentElements.not(this.invalidElements())
781            }, invalidElements: function () {
782                return a(this.errorList).map(function () {
783                    return this.element
784                })
785            }, showLabel: function (b, c) {
786                var d = this.errorsFor(b);
787                d.length ? (d.removeClass(this.settings.validClass).addClass(this.settings.errorClass), d.html(c)) : (d = a("<" + this.settings.errorElement + ">").attr("for", this.idOrName(b)).addClass(this.settings.errorClass).html(c || ""), this.settings.wrapper && (d = d.hide().show().wrap("<" + this.settings.wrapper + "/>").parent()), this.labelContainer.append(d).length || (this.settings.errorPlacement ? this.settings.errorPlacement(d, a(b)) : d.insertAfter(b))), !c && this.settings.success && (d.text(""), "string" == typeof this.settings.success ? d.addClass(this.settings.success) : this.settings.success(d, b)), this.toShow = this.toShow.add(d)
788            }, errorsFor: function (b) {
789                var c = this.idOrName(b);
790                return this.errors().filter(function () {
791                    return a(this).attr("for") === c
792                })
793            }, idOrName: function (a) {
794                return this.groups[a.name] || (this.checkable(a) ? a.name : a.id || a.name)
795            }, validationTargetFor: function (a) {
796                return this.checkable(a) && (a = this.findByName(a.name).not(this.settings.ignore)[0]), a
797            }, checkable: function (a) {
798                return /radio|checkbox/i.test(a.type)
799            }, findByName: function (b) {
800                return a(this.currentForm).find("[name='" + b + "']")
801            }, getLength: function (b, c) {
802                switch (c.nodeName.toLowerCase())
803                {
804                    case"select":
805                        return a("option:selected", c).length;
806                    case"input":
807                        if (this.checkable(c))
808                        {
809                            return this.findByName(c.name).filter(":checked").length
810                        }
811                }
812                return b.length
813            }, depend: function (a, b) {
814                return this.dependTypes[typeof a] ? this.dependTypes[typeof a](a, b) : !0
815            }, dependTypes: {
816                "boolean": function (a) {
817                    return a
818                }, string: function (b, c) {
819                    return !!a(b, c.form).length
820                }, "function": function (a, b) {
821                    return a(b)
822                }
823            }, optional: function (b) {
824                var c = this.elementValue(b);
825                return !a.validator.methods.required.call(this, c, b) && "dependency-mismatch"
826            }, startRequest: function (a) {
827                this.pending[a.name] || (this.pendingRequest++, this.pending[a.name] = !0)
828            }, stopRequest: function (b, c) {
829                this.pendingRequest--, this.pendingRequest < 0 && (this.pendingRequest = 0), delete this.pending[b.name], c && 0 === this.pendingRequest && this.formSubmitted && this.form() ? (a(this.currentForm).submit(), this.formSubmitted = !1) : !c && 0 === this.pendingRequest && this.formSubmitted && (a(this.currentForm).triggerHandler("invalid-form", [this]), this.formSubmitted = !1)
830            }, previousValue: function (b) {
831                return a.data(b, "previousValue") || a.data(b, "previousValue", {old: null, valid: !0, message: this.defaultMessage(b, "remote")})
832            }
833        }, classRuleSettings: {required: {required: !0}, email: {email: !0}, url: {url: !0}, date: {date: !0}, dateISO: {dateISO: !0}, number: {number: !0}, digits: {digits: !0}, creditcard: {creditcard: !0}}, addClassRules: function (b, c) {
834            b.constructor === String ? this.classRuleSettings[b] = c : a.extend(this.classRuleSettings, b)
835        }, classRules: function (b) {
836            var c = {}, d = a(b).attr("class");
837            return d && a.each(d.split(" "), function () {
838                this in a.validator.classRuleSettings && a.extend(c, a.validator.classRuleSettings[this])
839            }), c
840        }, attributeRules: function (b) {
841            var c, d, e = {}, f = a(b), g = b.getAttribute("type");
842            for (c in a.validator.methods)
843            {
844                "required" === c ? (d = b.getAttribute(c), "" === d && (d = !0), d = !!d) : d = f.attr(c), /min|max/.test(c) && (null === g || /number|range|text/.test(g)) && (d = Number(d)), d || 0 === d ? e[c] = d : g === c && "range" !== g && (e[c] = !0);
845            }
846            return e.maxlength && /-1|2147483647|524288/.test(e.maxlength) && delete e.maxlength, e
847        }, dataRules: function (b) {
848            var c, d, e = {}, f = a(b);
849            for (c in a.validator.methods)
850            {
851                d = f.data("rule" + c[0].toUpperCase() + c.substring(1).toLowerCase()), void 0 !== d && (e[c] = d);
852            }
853            return e
854        }, staticRules: function (b) {
855            var c = {}, d = a.data(b.form, "validator");
856            return d.settings.rules && (c = a.validator.normalizeRule(d.settings.rules[b.name]) || {}), c
857        }, normalizeRules: function (b, c) {
858            return a.each(b, function (d, e) {
859                if (e === !1)
860                {
861                    return void delete b[d];
862                }
863                if (e.param || e.depends)
864                {
865                    var f = !0;
866                    switch (typeof e.depends)
867                    {
868                        case"string":
869                            f = !!a(e.depends, c.form).length;
870                            break;
871                        case"function":
872                            f = e.depends.call(c, c)
873                    }
874                    f ? b[d] = void 0 !== e.param ? e.param : !0 : delete b[d]
875                }
876            }), a.each(b, function (d, e) {
877                b[d] = a.isFunction(e) ? e(c) : e
878            }), a.each(["minlength", "maxlength"], function () {
879                b[this] && (b[this] = Number(b[this]))
880            }), a.each(["rangelength", "range"], function () {
881                var c;
882                b[this] && (a.isArray(b[this]) ? b[this] = [Number(b[this][0]), Number(b[this][1])] : "string" == typeof b[this] && (c = b[this].split(/[\s,]+/), b[this] = [Number(c[0]), Number(c[1])]))
883            }), a.validator.autoCreateRanges && (b.min && b.max && (b.range = [b.min, b.max], delete b.min, delete b.max), b.minlength && b.maxlength && (b.rangelength = [b.minlength, b.maxlength], delete b.minlength, delete b.maxlength)), b
884        }, normalizeRule: function (b) {
885            if ("string" == typeof b)
886            {
887                var c = {};
888                a.each(b.split(/\s/), function () {
889                    c[this] = !0
890                }), b = c
891            }
892            return b
893        }, addMethod: function (b, c, d) {
894            a.validator.methods[b] = c, a.validator.messages[b] = void 0 !== d ? d : a.validator.messages[b], c.length < 3 && a.validator.addClassRules(b, a.validator.normalizeRule(b))
895        }, methods: {
896            required: function (b, c, d) {
897                if (!this.depend(d, c))
898                {
899                    return "dependency-mismatch";
900                }
901                if ("select" === c.nodeName.toLowerCase())
902                {
903                    var e = a(c).val();
904                    return e && e.length > 0
905                }
906                return this.checkable(c) ? this.getLength(b, c) > 0 : a.trim(b).length > 0
907            }, email: function (a, b) {
908                return this.optional(b) || /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)
909            }, url: function (a, b) {
910                return this.optional(b) || /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)
911            }, date: function (a, b) {
912                return this.optional(b) || !/Invalid|NaN/.test(new Date(a).toString())
913            }, dateISO: function (a, b) {
914                return this.optional(b) || /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(a)
915            }, number: function (a, b) {
916                return this.optional(b) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)
917            }, digits: function (a, b) {
918                return this.optional(b) || /^\d+$/.test(a)
919            }, creditcard: function (a, b) {
920                if (this.optional(b))
921                {
922                    return "dependency-mismatch";
923                }
924                if (/[^0-9 \-]+/.test(a))
925                {
926                    return !1;
927                }
928                var c, d, e = 0, f = 0, g = !1;
929                if (a = a.replace(/\D/g, ""), a.length < 13 || a.length > 19)
930                {
931                    return !1;
932                }
933                for (c = a.length - 1; c >= 0; c--)
934                {
935                    d = a.charAt(c), f = parseInt(d, 10), g && (f *= 2) > 9 && (f -= 9), e += f, g = !g;
936                }
937                return e % 10 === 0
938            }, minlength: function (b, c, d) {
939                var e = a.isArray(b) ? b.length : this.getLength(a.trim(b), c);
940                return this.optional(c) || e >= d
941            }, maxlength: function (b, c, d) {
942                var e = a.isArray(b) ? b.length : this.getLength(a.trim(b), c);
943                return this.optional(c) || d >= e
944            }, rangelength: function (b, c, d) {
945                var e = a.isArray(b) ? b.length : this.getLength(a.trim(b), c);
946                return this.optional(c) || e >= d[0] && e <= d[1]
947            }, min: function (a, b, c) {
948                return this.optional(b) || a >= c
949            }, max: function (a, b, c) {
950                return this.optional(b) || c >= a
951            }, range: function (a, b, c) {
952                return this.optional(b) || a >= c[0] && a <= c[1]
953            }, equalTo: function (b, c, d) {
954                var e = a(d);
955                return this.settings.onfocusout && e.unbind(".validate-equalTo").bind("blur.validate-equalTo", function () {
956                    a(c).valid()
957                }), b === e.val()
958            }, remote: function (b, c, d) {
959                if (this.optional(c))
960                {
961                    return "dependency-mismatch";
962                }
963                var e, f, g = this.previousValue(c);
964                return this.settings.messages[c.name] || (this.settings.messages[c.name] = {}), g.originalMessage = this.settings.messages[c.name].remote, this.settings.messages[c.name].remote = g.message, d = "string" == typeof d && {url: d} || d, g.old === b ? g.valid : (g.old = b, e = this, this.startRequest
964(c), f = {}, f[c.name] = b, a.ajax(a.extend(!0, {
965                    url: d, mode: "abort", port: "validate" + c.name, dataType: "json", data: f, context: e.currentForm, success: function (d) {
966                        var f, h, i, j = d === !0 || "true" === d;
967                        e.settings.messages[c.name].remote = g.originalMessage, j ? (i = e.formSubmitted, e.prepareElement(c), e.formSubmitted = i, e.successList.push(c), delete e.invalid[c.name], e.showErrors()) : (f = {}, h = d || e.defaultMessage(c, "remote"), f[c.name] = g.message = a.isFunction(h) ? h(b) : h, e.invalid[c.name] = !0, e.showErrors(f)), g.valid = j, e.stopRequest(c, j)
968                    }
969                }, d)), "pending")
970            }
971        }
972    }), a.format = function () {
973        throw "$.format has been deprecated. Please use $.validator.format instead."
974    }
975}(jQuery), function (a) {
976    var b, c = {};
977    a.ajaxPrefilter ? a.ajaxPrefilter(function (a, b, d) {
978        var e = a.port;
979        "abort" === a.mode && (c[e] && c[e].abort(), c[e] = d)
980    }) : (b = a.ajax, a.ajax = function (d) {
981        var e = ("mode" in d ? d : a.ajaxSettings).mode, f = ("port" in d ? d : a.ajaxSettings).port;
982        return "abort" === e ? (c[f] && c[f].abort(), c[f] = b.apply(this, arguments), c[f]) : b.apply(this, arguments)
983    })
984}(jQuery), function (a) {
985    a.extend(a.fn, {
986        validateDelegate: function (b, c, d) {
987            return this.bind(c, function (c) {
988                var e = a(c.target);
989                return e.is(b) ? d.apply(e, arguments) : void 0
990            })
991        }
992    })
993}(jQuery);
994
995const regexname = /[^\w\+\.\-\#\-\_\~\!\$\&\'\(\)\*\+\,\;\=\:]/;
996const regexname2 = /[^a-zA-Z0-9]/;
997const regexname3 = /[^a-zA-Z0-9\.\-]/;
998
999// ADDITIONAL JQUERY VALIDATE METHODS
1000(function ($) {
1001    // Validate a multifield birthday
1002    $.validator.addMethod("mc_birthday", function (date, element, grouping_class) {
1003        var isValid = false;
1004        var $fields = $('input:not(:hidden)', $(element).closest(grouping_class));
1005        if ($fields.filter(':filled').length == 0 && this.optional(element))
1006        {
1007            isValid = true; // None have been filled out, so no error
1008        } else
1009        {
1010            var dateArray = new Array();
1011            dateArray['month'] = $fields.filter("input[name*='[month]']").val();
1012            dateArray['day'] = $fields.filter("input[name*='[day]']").val();
1013            
1014            // correct month value
1015            dateArray['month'] = dateArray['month'] - 1;
1016            
1017            var testDate = new Date(1970, dateArray['month'], dateArray['day']);
1018            if (testDate.getDate() != dateArray['day'] || testDate.getMonth() != dateArray['month'])
1019            {
1020                isValid = false;
1021            } else
1022            {
1023                isValid = true;
1024            }
1025        }
1026        return isValid;
1027    }, "Please enter a valid month and day.");
1028    // Validate a multifield date
1029    $.validator.addMethod("mc_date", function (date, element, grouping_class) {
1030        var isValid = false;
1031        var $fields = $('input:not(:hidden)', $(element).closest(grouping_class));
1032        if ($fields.filter(':filled').length == 0 && this.optional(element))
1033        {
1034            isValid = true; // None have been filled out, so no error
1035        } else
1036        {
1037            var dateArray = new Array();
1038            dateArray['month'] = $fields.filter("input[name*='[month]']").val();
1039            dateArray['day'] = $fields.filter("input[name*='[day]']").val();
1040            dateArray['year'] = $fields.filter("input[name*='[year]']").val();
1041            
1042            // correct month value
1043            dateArray['month'] = dateArray['month'] - 1;
1044            
1045            // correct year value
1046            if (dateArray['year'].length < 4)
1047            {
1048                dateArray['year'] = (parseInt(dateArray['year']) < 50) ? 2000 + parseInt(dateArray['year']) : 1900 + parseInt(dateArray['year']);
1049            }
1050            
1051            var testDate = new Date(dateArray['year'], dateArray['month'], dateArray['day']);
1052            if (testDate.getDate() != dateArray['day'] || testDate.getMonth() != dateArray['month'] || testDate.getFullYear() != dateArray['year'])
1053            {
1054                isValid = false;
1055            } else
1056            {
1057                isValid = true;
1058            }
1059        }
1060        return isValid;
1061    }, "Please enter a valid date");
1062    
1063    // Validate a multifield phone number
1064    $.validator.addMethod("mc_phone", function (phone_number, element, grouping_class) {
1065        var isValid = false;
1066        var $fields = $('input:filled:not(:hidden)', $(element).closest(grouping_class));
1067        if ($fields.length == 0 && this.optional(element))
1068        {
1069            isValid = true; // None have been filled out, so no error
1070        } else
1071        {
1072            phone_number = $fields.eq(0).val() + $fields.eq(1).val() + $fields.eq(2).val();
1073            isValid = phone_number.length == 10 && phone_number.match(/[0-9]{9}/);
1074        }
1075        return isValid;
1076    }, "Please specify a valid phone number");
1077    
1078    $.validator.addMethod("skip_or_complete_group", function (value, element, grouping_class) {
1079        var $fields = $('input:not(:hidden)', $(element).closest(grouping_class)),
1080            $fieldsFirst = $fields.eq(0),
1081            validator = $fieldsFirst.data("valid_skip") ? $fieldsFirst.data("valid_skip") : $.extend({}, this),
1082            numberFilled = $fields.filter(function () {
1083                return validator.elementValue(this);
1084            }).length,
1085            isValid = numberFilled === 0 || numberFilled === $fields.length;
1086        
1087        // Store the cloned validator for future validation
1088        $fieldsFirst.data("valid_skip", validator);
1089        
1090        // If element isn't being validated, run each field's validation rules
1091        if (!$(element).data("being_validated"))
1092        {
1093            $fields.data("being_validated", true);
1094            $fields.each(function () {
1095                validator.element(this);
1096            });
1097            $fields.data("being_validated", false);
1098        }
1099        return isValid;
1100    }, $.validator.format("Please supply missing fields."));
1101    
1102    $.validator.addMethod("skip_or_fill_minimum", function (value, element, options) {
1103        var $fields = $(options[1], element.form),
1104            $fieldsFirst = $fields.eq(0),
1105            validator = $fieldsFirst.data("valid_skip") ? $fieldsFirst.data("valid_skip") : $.extend({}, this),
1106            numberFilled = $fields.filter(function () {
1107                return validator.elementValue(this);
1108            }).length,
1109            isValid = numberFilled === 0 || numberFilled >= options[0];
1110        // Store the cloned validator for future validation
1111        $fieldsFirst.data("valid_skip", validator);
1112        
1113        // If element isn't being validated, run each skip_or_fill_minimum field's validation rules
1114        if (!$(element).data("being_validated"))
1115        {
1116            $fields.data("being_validated", true);
1117            $fields.each(function () {
1118                validator.element(this);
1119            });
1120            $fields.data("being_validated", false);
1121        }
1122        return isValid;
1123    }, $.validator.format("Please either skip these fields or fill at least {0} of them."));
1124    
1125    $.validator.addMethod("zipcodeUS", function (value, element) {
1126        return this.optional(element) || /^\d{5}-\d{4}$|^\d{5}$/.test(value);
1127    }, "The specified US ZIP Code is invalid");
1128    
1129    $.validator.addMethod("mc_gdpr", function (value, element, grouping_class) {
1130        //if gdpr is required the user must pick at least one option.
1131        var $fields = $("input:not(:hidden)", $(element).closest(grouping_class));
1132        return $fields.filter(":checked").length !== 0;
1133    }, "Please choose an option.");
1134    
1135}(jQuery));
1136
1137// MC
1138(function ($) {
1139    var err_style = '';
1140    try
1141    {
1142        err_style = mc_custom_error_style;
1143    } catch (e)
1144    {
1145        err_style = '#mc_embed_signup input.mce_inline_error { border-color:#6B0505; } #mc_embed_signup div.mce_inline_error { margin: 0 0 1em 0; padding: 5px 10px; background-color:#6B0505; font-weight: bold; z-index: 1; color:#fff; }';
1146    }
1147    var head = document.getElementsByTagName('head')[0];
1148    var style = document.createElement('style');
1149    style.type = 'text/css';
1150    if (style.styleSheet)
1151    {
1152        style.styleSheet.cssText = err_style;
1153    } else
1154    {
1155        style.appendChild(document.createTextNode(err_style));
1156    }
1157    head.appendChild(style);
1158    
1159    // Expose extra mc form methods in global var
1160    window.mc = {
1161        openPopup: function () {
1162            $('#mc_embed_signup a.mc_embed_close').show();
1163            setTimeout(function () {
1164                $('#mc_embed_signup').fadeIn();
1165            }, mc.delayPopup);
1166        },
1167        closePopup: function () {
1168            $('#mc_embed_signup').hide();
1169            var now = new Date();
1170            var expires_date = new Date(now.getTime() + 31536000000);
1171            document.cookie = 'MCPopupClosed=yes;expires=' + expires_date.toGMTString() + ';path=/';
1172        },
1173        /**
1174         *    Figure out if we should show the popup (if they've closed it before, don't show it.)
1175         */
1176        evalPopup: function () {
1177            $('#mc_embed_signup').hide();
1178            cks = document.cookie.split(';');
1179            for (i = 0; i < cks.length; i++)
1180            {
1181                parts = cks[i].split('=');
1182                if (parts[0].indexOf('MCPopupClosed') != -1)
1183                {
1184                    mc.showPopup = false;
1185                }
1186            }
1187            if (mc.showPopup)
1188            {
1189                mc.openPopup();
1190            }
1191        },
1192        /**
1193         *    Grab the list subscribe url from the form action and make it work for an ajax post.
1194         */
1195        getAjaxSubmitUrl: function () {
1196            var url = $("form#mc-embedded-subscribe-form").attr("action");
1197            return url;
1198        },
1199        /**
1200         *    Classify text inputs in the same field group as group for validation purposes.
1201         *    All this does is tell jQueryValidation to create one error div for the group, rather
1202         *    than one for each input. Primary use case is birthday and date fields, where we want
1203         *    to display errors about the inputs collectively, not individually.
1204         *
1205         *    NOTE: Grouping inputs will give you one error div, but you still need to specify where
1206         *    that div should be displayed. By default, it's inserted after the first input with a
1207         *    validation error, which can break up a set of inputs. Use the errorPlacement setting in
1208         *    the validator to control error div placement.
1209         */
1210        getGroups: function () {
1211            var groups = {};
1212            $(".mc-field-group").each(function (index) {
1213                var inputs = $(this).find("input:text:not(:hidden), input:checkbox:not(:hidden)");
1214                if (inputs.length > 1)
1215                {
1216                    var mergeName = inputs.first().attr("name");
1217                    var fieldNames = $.map(inputs, function (f) {
1218                        return f.name;
1219                    });
1220                    groups[mergeName.substring(0, mergeName.indexOf("["))] = fieldNames.join(" ");
1221                }
1222            });
1223            return groups;
1224        },
1225        /**
1226         *    Check if a field is part of a multipart field
1227         *    (e.g., A date merge field is composed of individual inputs for month, day and year)
1228         *    Used in jQuery validation onkeyup method to ensure that we don't evaluate a field
1229         *  if a user hasn't reached the last input in a multipart field yet.
1230         */
1231        isMultiPartField: function (element) {
1232            return ($('input:not(:hidden)', $(element).closest(".mc-field-group")).length > 1);
1233        },
1234        /**
1235         *    Checks if the element is the last input in its fieldgroup.
1236         *    If the field is not the last in a set of inputs we don't want to validate it on certain events (onfocusout, onblur)
1237         *    because the user might not be finished yet.
1238         */
1239        isTooEarly: function (element) {
1240            var fields = $('input:not(:hidden)', $(element).closest(".mc-field-group"));
1241            return ($(fields).eq(-1).attr('id') != $(element).attr('id'));
1242        },
1243        /**
1244         *    Handle the error/success message after successful form submission.
1245         *    Success messages are appended to #mce-success-response
1246         *    Error messages are displayed with the invalid input when possible, or appended to #mce-error-response
1247         */
1248        mce_success_cb: function (resp) {
1249            
1250            $('#mce-success-response').hide();
1251            $('#mce-error-response').hide();
1252            
1253            // On successful form submission, display a success message and reset the form
1254            if (resp.result == "success")
1255            {
1256                $('#mce-' + resp.result + '-response').show();
1257                $('#mce-' + resp.result + '-response').html(resp.message);
1258                $('#mc-embedded-subscribe-form').each(function () {
1259                    this.reset();
1260                });
1261                
1262            }
1263            else
1264            {
1265                $('#mce-' + resp.result + '-response').show();
1266                $('#mce-' + resp.result + '-response').html(resp.message);
1267            }
1268        }
1269    }
1270    let validate
1271    
1272    window.mc.mce_validator = $("#mc-embedded-subscribe-form").validate({
1273        
1274        // Set error HTML: <div class="mce_inline_error"></div>
1275        errorClass: "mce_inline_error",
1276        errorElement: "div",
1277        
1278        // Validate fields on keyup, focusout and blur.
1279        onkeyup: false,
1280        // onfocusout: function(element) {
1281        // 	setTimeout(() => {
1282        // 		if (!mc.isTooEarly(element)) {
1283        // 			$(element).valid();
1284        // 		}
1285        // 	}, 1)
1286        // },
1287        onfocusout: false,
1288        onblur: function (element) {
1289            if (!mc.isTooEarly(element))
1290            {
1291                $(element).valid();
1292            }
1293        },
1294        onkeyup: function (element, key) {
1295            $('#mce-error-response').hide()
1296            // $(element).closest(".mc-field-group").find('div[for="mce-EMAIL"]').hide()
1297            // // if(validate) clearTimeout(validate);
1298            // // validate = setTimeout(function(){
1299            // 	if (!mc.isTooEarly(element)) {
1300            // 		$(element).valid();
1301            // 	}
1302            // // }, 500);
1303            
1304            if ($(element).attr('type') == 'email')
1305            {
1306                var emailParts = element.value.toLowerCase().split('@'),
1307                    localPart = emailParts[0],
1308                    domain = emailParts[1],
1309                    error = false;
1310                
1311                if (localPart && domain)
1312                {
1313                    if (localPart.indexOf('"') === 0)
1314                    {
1315                        var len = localPart.length;
1316                        localPart = localPart.replace(/\"/g, '');
1317                        if (localPart.length !== (len - 2))
1318                        {
1319                            error = true;
1320                        }
1321                    }
1322                    
1323                    if (localPart.match(regexname) || localPart.indexOf('.') == 0 || localPart.substring(localPart.length - 1, localPart.length) == '.' || localPart.indexOf('..') !== -1)
1324                    {
1325                        error = true;
1326                    }
1327                    if (domain.slice(-2).match(regexname2) || domain.substr(0, 1).match(regexname2) || domain.match(regexname3) || domain.split('..').length !== 1 || domain.split('.').length < 2)
1328                    {
1329                        error = true;
1330                    }
1331                } else
1332                {
1333                    error = true;
1334                }
1335                
1336                if (error)
1337                {
1338                    // $(element).closest(".mc-field-group").find('div[data-name="mce-EMAIL"]').show()
1339                    // if (element.value.length == 0) {
1340                    //     $(element).closest(".mc-field-group").find('div[data-name="mce-EMAIL"]').hide();
1341                    // }
1342                } else
1343                {
1344                    // $(element).valid();
1345                    $(element).closest(".mc-field-group").find('div[for="mce-EMAIL"]').hide()
1346                }
1347            } else
1348            {
1349                if (!mc.isTooEarly(element))
1350                {
1351                    $(element).valid();
1352                }
1353            }
1354        },
1355        // Grouping fields makes jQuery Validation display one error for all the fields in the group
1356        // It doesn't have anything to do with how the fields are validated (together or separately),
1357        // it's strictly for visual display of errors
1358        groups: mc.getGroups(),
1359        // Place a field's inline error HTML just before the div.mc-field-group closing tag
1360        errorPlacement: function (error, element) {
1361            element.closest('.mc-field-group').append(error);
1362        },
1363        // Submit the form via ajax (see: jQuery Form plugin)
1364        submitHandler: function (form) {
1365            if (form.checkValidity())
1366            {
1367                captcha.validate("#mc-embedded-subscribe-form", "customform", function (token) {
1368                    let data = $("#mc-embedded-subscribe-form").serialize();
1369                    $.ajaxSetup({
1370                        headers: {
1371                            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content'),
1372                            'Access-Control-Allow-Headers': 'x-requested-with',
1373                            'crossDomain': true
1374                        }
1375                    });
1376                    $.get('/products/api/newsletter', data).done(mc.mce_success_cb);
1377                });
1378            } else
1379            {
1380                let inputs = $(form).find('input')
1381                for (let i = 0; i < inputs.length; i++)
1382                {
1383                    if (inputs[i].validity.patternMismatch && inputs[i].name == 'FNAME')
1384                    {
1385                        //$(inputs[i]).closest('.mc-field-group').find('#realname').removeClass('d-none')
1386                    }
1387                    if (!inputs[i].validity.valid && inputs[i].type == 'email')
1388                    {
1389                        $(inputs[i]).closest('.mc-field-group').find('div[data-name="mce-EMAIL"]').show()
1390                    }
1391                }
1392            }
1393        }
1394    });
1395    
1396    window.mc.ajaxOptions = {
1397        url: mc.getAjaxSubmitUrl(),
1398        type: 'GET',
1399        dataType: 'json',
1400        contentType: "application/json; charset=utf-8",
1401        success: mc.mce_success_cb
1402    };
1403    
1404    // Custom validation methods for fields with certain css classes
1405    $.validator.addClassRules("birthday", {digits: true, mc_birthday: ".datefield"});
1406    $.validator.addClassRules("datepart", {digits: true, mc_date: ".datefield"});
1407    $.validator.addClassRules("phonepart", {digits: true, mc_phone: ".phonefield"});
1408    $.validator.addClassRules("gdpr", {mc_gdpr: ".gdprRequired"});
1409    
1410    // Evil Popup
1411    $('#mc_embed_signup a.mc_embed_close').click(function () {
1412        mc.closePopup();
1413    });
1414    $(document).keydown(function (e) {
1415        keycode = (e == null) ? event.keyCode : e.which;
1416        if (keycode == 27 && typeof mc.showPopup != 'undefined')
1417        {
1418            mc.closePopup();
1419        }
1420    });
1421    
1422}(jQuery));
1423

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.