<commit_before>/**
 * This plugin is initially inspired by the standard Validation jQuery
 * plugin (http://plugins.jquery.com/validation/).
 */
(function($) {
    /*jshint devel:true, jquery:true */
    "use strict";

    $.guard = function(selector) {
        return $.guards.add(selector);
    };

    $.guard.version = "{{VERSION}}";

    $.Guards = function() {
        var self = this;
        this._guards = [];
        this.named = {};

        this.options = {
            stackErrors: false
        };

        this.constants = {
            notChecked: ""
        };

        this.defaults = {
            grouped: false,
            guard: "required",
            invalidClass: "invalid-field",

            liveCallback: function(e) {
                var $element = $(e.target);

                if (!$element.is(":guardable")) {
                    return;
                }

                $element.clearErrors();

                self.applyGuards(function(guard) {
                    if (guard.isGrouped()) {
                        if (guard.appliesTo($element)) {
                            return self.parentContext($element).find(":guardable");
                        } else {
                            return false;
                        }
                    } else {
                        return $element;
                    }
                });
            },

            messageClass: "error-message",

            messages: {
                "undefined": "Please fix this field."
            },

            style: {
                field: {
                    "background-color": "#ffff66"
                },

                message: {
                    color: "#ff0000",
                    "margin-left": "10px"
                }
            },

            submitCallback: function() { return self.guard($(this)); },
            tag: "span",

            target: function(errorElement) {
                var last = $(this).filter(":last");

                if (last.is(":radio,:checkbox") && last[0].nextSibling) {
                    last = $(last[0].nextSibling);
                }

                var next = last.next();

                while (next.size() > 0 && next[0].isGuardError) {
                    last = next;
                    next = last.next();
                }

                errorElement.insertAfter(last);
                return false;
            }
        };

        /**
         * @page Named Guards
         * @section allow
         * @since 1.0.0
         *
         * <p>
         *   Only values found in the given list are considered valid.  Anything else triggers a failure.
         *   This guard <strong>requires</strong> an array parameter of the valid values.
         * </p>
         *
         * <div class="example">
         *   <div class="display">
         *     <script>
         *       $.guard(".primary-color").using("allow", ["red", "yellow", "blue"]);
         *     </script>
         *
         *     <p>
         *       <input class="primary-color" type="text" /><br />
         *       <small>Allowed values: red, yellow, blue</small>
         *     </p>
         *   </div>
         * </div>
         */
        this.name("allow").using(this.aggregate(this.isAllValid, this.isAllowed)).message(this.arrayMessage("Please enter one of: #{0}."));

        /**
         * @page Named Guards
         * @section always
         * @since 1.0.0
         *
         * <p>
         *   Always fail, no matter what.  For this guard to pass, either the guard must be removed, or
         *   the element(s) guarded must be removed.  No parameters are accepted.
         * </p>
         *
         * <div class="example">
         *   <div class="display">
         *     <script>
         *       $.guard(".always").using("always");
         *     </script>
         *
         *     <p>
         *       <input class="always" type="text" /><br />
         *       <small>Always fails, no matter what</small>
         *     </p>
         *   </div>
         * </div>
         */
        this.name("always").using(this.aggregate(this.isAllValid, this.always)).message("There was an error.");

        /**
         * @page Named Guards
         * @section different
         * @since 1.0.0
         *
         * <p>
         *   This is a grouped guard where every field must have a different value.
         * </p>
         *
         * <div class="example">
         *   <div class="display">
         *     <script>
         *       $.guard(".unique").using("different");
         *     </script>
         *
         *     <p>
         *       <input class="unique" type="text" value="Unique Required" /><br />
         *       <input class="unique" type="text" value="Unique Required" /><br />
         *       <small>Each value must be unique</small>
         *     </p>
         *   </div>
         * </div>
         */
        this.name("different").grouped().using(this.aggregate(this.passThrough, this.isDifferent)).message("These values must all be different.");

        /**
         * @page Named Guards
         * @section disallow
         * @since 1.0.0
         *
         * <p>
         *   Guard against specific values.  This guard <strong>requires</strong> an array parameter
         *   of the invalid values.
         * </p>
         *
         * <div class="example">
         *   <div class="display">
         *     <script>
         *       $.guard(".not-primary-color").using("disallow", ["red", "yellow", "blue"]);
         *     </script>
         *
         *     <p>
         *       <input class="not-primary-color" type="text" value="red" /><br />
         *       <small>Disallowed values: red, yellow, blue</small>
         *     </p>
         *   </div>
         * </div>
         */
        this.name("disallow").using(this.aggregate(this.isAllValid, this.isDisallowed)).message(this.arrayMessage("Please don't enter: #{0}."));

        /**
         * @page Named Guards
         * @section email
         * @since 1.0.0
         *
         * <p>
         *   Guard for a valid email address.  An empty value is ignored, so only once a value exists will
         *   this guard start checking for an email address.  An optional argument of
         *   <code>{ allowDisplay: true }</code> is allowed that may specify whether display emails of the
         *   form <code><NAME> &lt;<EMAIL>&gt;</code> are allowed.
         * </p>
         *
         * <div class="example">
         *   <div class="display">
         *     <script>
         *       $.guard(".email1").using("email");
         *       $.guard(".email2").using("email", { allowDisplay: true });
         *     </script>
         *
         *     <p>
         *       <input class="email1" type="text" value="invalid" /><br />
         *       <small>Email address of the form "<EMAIL>"</small>
         *     </p>
         *
         *     <p>
         *       <input class="email2" type="text" value="Still &lt;invalid&gt;" /><br />
         *       <small>Email address of the form "<NAME> &lt;<EMAIL>&gt;"</small>
         *     </p>
         *   </div>
         * </div>
         */
        this.name("email").using(this.aggregate(this.isAllValid, this.isValidEmail)).message("Please enter a valid E-mail address.");

        /**
         * @page Named Guards
         * @section float
         * @since 1.0.0
         *
         * <p>
         *   Guard for a floating point number.  Optionally, an object parameter may be passed with
         *   <code>min</code> and/or <code>max</code>.  Min will restrict the minimum value, while
         *   max restricts the maximum.  An empty value is considered valid.
         * </p>
         *
         * <div class="example">
         *   <div class="display">
         *     <script>
         *       $.guard(".float1").using("float");
         *       $.guard(".float2").using("float", { min: -5.5 });
         *       $.guard(".float3").using("float", { max: 42.0 });
         *       $.guard(".float4").using("float", { min: 0.0, max: 10.0 });
         *     </script>
         *
         *     <p>
         *       <input class="float1" type="text" value="not valid" /><br />
         *       <small>A number of any value</small>
         *     </p>
         *
         *     <p>
         *       <input class="float2" type="text" value="-10.5" /><br />
         *       <small>A number no smaller than -5.5</small>
         *     </p>
         *
         *     <p>
         *       <input class="float3" type="text" value="64.32" /><br />
         *       <small>A number no bigger than 42</small>
         *     </p>
         *
         *     <p>
         *       <input class="float4" type="text" value="11" /><br />
         *       <small>A number from 0 to 10</small>
         *     </p>
         *   </div>
         * </div>
         */
        this.name("float").using(this.aggregate(this.isAllValid, this.isValidFloat)).message(this.minMaxMessage({
            minAndMax: "Please enter a number from #{0} to #{1}.",
            min: "Please enter a number no less than #{0}.",
            max: "Please enter a number no greater than #{0}.",
            invalid: "Please enter a number."
        }));

        /**
         * @page Named Guards
         * @section int
         * @since 1.0.0
         *
         * <p>
         *   Guard for an integer number.  Optionally, an object parameter may be passed with
         *   <code>min</code> and/or <code>max</code>.  Min will restrict the minimum value, while
         *   max restricts the maximum.  An empty value is considered valid.
         * </p>
         *
         * <div class="example">
         *   <div class="display">
         *     <script>
         *       $.guard(".int1").using("int");
         *       $.guard(".int2").using("int", { min: -5 });
         *       $.guard(".int3").using("int", { max: 42 });
         *       $.guard(".int4").using("int", { min: 0, max: 10 });
         *     </script>
         *
         *     <p>
         *       <input class="int1" type="text" value="not valid" /><br />
         *       <small>An integer of any value</small>
         *     </p>
         *
         *     <p>
         *       <input class="int2" type="text" value="-10.5" /><br />
         *       <small>An integer no smaller than -5</small>
         *     </p>
         *
         *     <p>
         *       <input class="int3" type="text" value="64.32" /><br />
         *       <small>An integer no bigger than 42</small>
         *     </p>
         *
         *     <p>
         *       <input class="int4" type="text" value="11" /><br />
         *       <small>An integer from 0 to 10</small>
         *     </p>
         *   </div>
         * </div>
         */
        this.name("int").using(this.aggregate(this.isAllValid, this.isValidInt)).message(this.minMaxMessage({
            minAndMax: "Please enter a number from #{0} to #{1}.",
            min: "Please enter a number no less than #{0}.",
            max: "Please enter a number no greater than #{0}.",
            invalid: "Please enter a number."
        }));

        /**
         * @page Named Guards
         * @section moneyUS
         * @since 1.0.0
         *
         * <p>
         *   Guard for a US dollar amount.  Optionally, an object parameter may be passed with
         *   <code>min</code> and/or <code>max</code>.  Min will restrict the minimum value, while
         *   max restricts the maximum.  An empty value is considered valid.
         * </p>
         *
         * <div class="example">
         *   <div class="display">
         *     <script>
         *       $.guard(".money1").using("moneyUS");
         *       $.guard(".money2").using("moneyUS", { min: -5.50 });
         *       $.guard(".money3").using("moneyUS", { max: 42.02 });
         *       $.guard(".money4").using("moneyUS", { min: 0, max: 10 });
         *     </script>
         *
         *     <p>
         *       <input class="money1" type="text" value="not valid" /><br />
         *       <small>US money of any value</small>
         *     </p>
         *
         *     <p>
         *       <input class="money2" type="text" value="-$10.55" /><br />
         *       <small>US money no smaller than -$5.50</small>
         *     </p>
         *
         *     <p>
         *       <input class="money3" type="text" value="$64.32" /><br />
         *       <small>US money no bigger than $42.02</small>
         *     </p>
         *
         *     <p>
         *       <input class="money4" type="text" value="$11" /><br />
         *       <small>US money from $0 to $10</small>
         *     </p>
         *   </div>
         * </div>
         */
        this.name("moneyUS").using(this.aggregate(this.isAllValid, this.isValidMoneyUS)).message(this.minMaxMessage({
            minAndMax: "Please enter a dollar amount from #{0} to #{1}.",
            min: "Please enter a dollar amount no less than #{0}.",
            max: "Please enter a dollar amount no greater than #{0}.",
            invalid: "Please enter a dollar amount."
        }, function(x) { return x.toFixed(2); }));

        /**
         * @page Named Guards
         * @section never
         * @since 1.0.0
         *
         * <p>
         *   Never fail, no matter what.  For this guard to fail, it must be manually triggered via
         *   <a href="guard_type.html#triggerError"><code>guard.triggerError(selector)</code></a>.
         *   This guard can be useful for marking a field as having an error immediately when the page
         *   loads (such as for a server detected error).
         * </p>
         *
         * <div class="example">
         *   <div class="display">
         *     <script>
         *       var guard = $.guard(".never").using("never");
         *       $(function() { guard.triggerError(".never"); });
         *     </script>
         *
         *     <p>
         *       <input class="never" type="text" /><br />
         *       <small>Never fails, except manually</small>
         *     </p>
         *   </div>
         * </div>
         */
        this.name("never").using(this.aggregate(this.isAllValid, this.never)).message("There was an error.");

        /**
         * @page Named Guards
         * @section oneRequired
         * @since 1.0.0
         *
         * <p>
         *   This is a grouped guard where a single field of all the selected fields must have a value.
         * </p>
         *
         * <div class="example">
         *   <div class="display">
         *     <script>
         *       $.guard(".oneRequired").using("oneRequired");
         *     </script>
         *
         *     <p>
         *       <input class="oneRequired" type="text" value="" /><br />
         *       <input class="oneRequired" type="text" value="" /><br />
         *       <small>One value is required</small>
         *     </p>
         *   </div>
         * </div>
         */
        this.name("oneRequired").grouped().using(this.aggregate(this.isAnyValid, this.isPresent)).message("Specify at least one.");
        this.name("phoneUS").using(this.aggregate(this.isAllValid, this.isValidPhoneUS)).message("Please enter a valid phone number.");
        this.name("required").using(this.aggregate(this.isAllValid, this.isPresent)).message("This field is required.");
        this.name("same").grouped().using(this.aggregate(this.passThrough, this.isSame)).message("These values must all match.");
        this.name("string").using(this.aggregate(this.isAllValid, this.isValidString)).message(this.minMaxMessage({
            minAndMax: "Please enter a string with length #{0} to #{1}.",
            min: "Please enter a string with length at least #{0}.",
            max: "Please enter a string with length no greater than #{0}."
        }));
    };

    $.Guards.prototype.version = "{{VERSION}}";

    $.Guards.prototype.parentContext = function(element) {
        var $element = $(element);
        var context = $element.parents("form:first");

        if (context.size() == 0) {
            context = $element.parents("*:last");
        }

        return context;
    };

    $.Guards.prototype.name = function(name) {<commit_msg>Documentation for phoneUS guard.<commit_after>/**
 * This plugin is initially inspired by the standard Validation jQuery
 * plugin (http://plugins.jquery.com/validation/).
 */
(function($) {
    /*jshint devel:true, jquery:true */
    "use strict";

    $.guard = function(selector) {
        return $.guards.add(selector);
    };

    $.guard.version = "{{VERSION}}";

    $.Guards = function() {
        var self = this;
        this._guards = [];
        this.named = {};

        this.options = {
            stackErrors: false
        };

        this.constants = {
            notChecked: ""
        };

        this.defaults = {
            grouped: false,
            guard: "required",
            invalidClass: "invalid-field",

            liveCallback: function(e) {
                var $element = $(e.target);

                if (!$element.is(":guardable")) {
                    return;
                }

                $element.clearErrors();

                self.applyGuards(function(guard) {
                    if (guard.isGrouped()) {
                        if (guard.appliesTo($element)) {
                            return self.parentContext($element).find(":guardable");
                        } else {
                            return false;
                        }
                    } else {
                        return $element;
                    }
                });
            },

            messageClass: "error-message",

            messages: {
                "undefined": "Please fix this field."
            },

            style: {
                field: {
                    "background-color": "#ffff66"
                },

                message: {
                    color: "#ff0000",
                    "margin-left": "10px"
                }
            },

            submitCallback: function() { return self.guard($(this)); },
            tag: "span",

            target: function(errorElement) {
                var last = $(this).filter(":last");

                if (last.is(":radio,:checkbox") && last[0].nextSibling) {
                    last = $(last[0].nextSibling);
                }

                var next = last.next();

                while (next.size() > 0 && next[0].isGuardError) {
                    last = next;
                    next = last.next();
                }

                errorElement.insertAfter(last);
                return false;
            }
        };

        /**
         * @page Named Guards
         * @section allow
         * @since 1.0.0
         *
         * <p>
         *   Only values found in the given list are considered valid.  Anything else triggers a failure.
         *   This guard <strong>requires</strong> an array parameter of the valid values.
         * </p>
         *
         * <div class="example">
         *   <div class="display">
         *     <script>
         *       $.guard(".primary-color").using("allow", ["red", "yellow", "blue"]);
         *     </script>
         *
         *     <p>
         *       <input class="primary-color" type="text" /><br />
         *       <small>Allowed values: red, yellow, blue</small>
         *     </p>
         *   </div>
         * </div>
         */
        this.name("allow").using(this.aggregate(this.isAllValid, this.isAllowed)).message(this.arrayMessage("Please enter one of: #{0}."));

        /**
         * @page Named Guards
         * @section always
         * @since 1.0.0
         *
         * <p>
         *   Always fail, no matter what.  For this guard to pass, either the guard must be removed, or
         *   the element(s) guarded must be removed.  No parameters are accepted.
         * </p>
         *
         * <div class="example">
         *   <div class="display">
         *     <script>
         *       $.guard(".always").using("always");
         *     </script>
         *
         *     <p>
         *       <input class="always" type="text" /><br />
         *       <small>Always fails, no matter what</small>
         *     </p>
         *   </div>
         * </div>
         */
        this.name("always").using(this.aggregate(this.isAllValid, this.always)).message("There was an error.");

        /**
         * @page Named Guards
         * @section different
         * @since 1.0.0
         *
         * <p>
         *   This is a grouped guard where every field must have a different value.
         * </p>
         *
         * <div class="example">
         *   <div class="display">
         *     <script>
         *       $.guard(".unique").using("different");
         *     </script>
         *
         *     <p>
         *       <input class="unique" type="text" value="Unique Required" /><br />
         *       <input class="unique" type="text" value="Unique Required" /><br />
         *       <small>Each value must be unique</small>
         *     </p>
         *   </div>
         * </div>
         */
        this.name("different").grouped().using(this.aggregate(this.passThrough, this.isDifferent)).message("These values must all be different.");

        /**
         * @page Named Guards
         * @section disallow
         * @since 1.0.0
         *
         * <p>
         *   Guard against specific values.  This guard <strong>requires</strong> an array parameter
         *   of the invalid values.
         * </p>
         *
         * <div class="example">
         *   <div class="display">
         *     <script>
         *       $.guard(".not-primary-color").using("disallow", ["red", "yellow", "blue"]);
         *     </script>
         *
         *     <p>
         *       <input class="not-primary-color" type="text" value="red" /><br />
         *       <small>Disallowed values: red, yellow, blue</small>
         *     </p>
         *   </div>
         * </div>
         */
        this.name("disallow").using(this.aggregate(this.isAllValid, this.isDisallowed)).message(this.arrayMessage("Please don't enter: #{0}."));

        /**
         * @page Named Guards
         * @section email
         * @since 1.0.0
         *
         * <p>
         *   Guard for a valid email address.  An empty value is ignored, so only once a value exists will
         *   this guard start checking for an email address.  An optional argument of
         *   <code>{ allowDisplay: true }</code> is allowed that may specify whether display emails of the
         *   form <code><NAME> &lt;<EMAIL>&gt;</code> are allowed.
         * </p>
         *
         * <div class="example">
         *   <div class="display">
         *     <script>
         *       $.guard(".email1").using("email");
         *       $.guard(".email2").using("email", { allowDisplay: true });
         *     </script>
         *
         *     <p>
         *       <input class="email1" type="text" value="invalid" /><br />
         *       <small>Email address of the form "<EMAIL>"</small>
         *     </p>
         *
         *     <p>
         *       <input class="email2" type="text" value="Still &lt;invalid&gt;" /><br />
         *       <small>Email address of the form "<NAME> &lt;<EMAIL>&gt;"</small>
         *     </p>
         *   </div>
         * </div>
         */
        this.name("email").using(this.aggregate(this.isAllValid, this.isValidEmail)).message("Please enter a valid E-mail address.");

        /**
         * @page Named Guards
         * @section float
         * @since 1.0.0
         *
         * <p>
         *   Guard for a floating point number.  Optionally, an object parameter may be passed with
         *   <code>min</code> and/or <code>max</code>.  Min will restrict the minimum value, while
         *   max restricts the maximum.  An empty value is considered valid.
         * </p>
         *
         * <div class="example">
         *   <div class="display">
         *     <script>
         *       $.guard(".float1").using("float");
         *       $.guard(".float2").using("float", { min: -5.5 });
         *       $.guard(".float3").using("float", { max: 42.0 });
         *       $.guard(".float4").using("float", { min: 0.0, max: 10.0 });
         *     </script>
         *
         *     <p>
         *       <input class="float1" type="text" value="not valid" /><br />
         *       <small>A number of any value</small>
         *     </p>
         *
         *     <p>
         *       <input class="float2" type="text" value="-10.5" /><br />
         *       <small>A number no smaller than -5.5</small>
         *     </p>
         *
         *     <p>
         *       <input class="float3" type="text" value="64.32" /><br />
         *       <small>A number no bigger than 42</small>
         *     </p>
         *
         *     <p>
         *       <input class="float4" type="text" value="11" /><br />
         *       <small>A number from 0 to 10</small>
         *     </p>
         *   </div>
         * </div>
         */
        this.name("float").using(this.aggregate(this.isAllValid, this.isValidFloat)).message(this.minMaxMessage({
            minAndMax: "Please enter a number from #{0} to #{1}.",
            min: "Please enter a number no less than #{0}.",
            max: "Please enter a number no greater than #{0}.",
            invalid: "Please enter a number."
        }));

        /**
         * @page Named Guards
         * @section int
         * @since 1.0.0
         *
         * <p>
         *   Guard for an integer number.  Optionally, an object parameter may be passed with
         *   <code>min</code> and/or <code>max</code>.  Min will restrict the minimum value, while
         *   max restricts the maximum.  An empty value is considered valid.
         * </p>
         *
         * <div class="example">
         *   <div class="display">
         *     <script>
         *       $.guard(".int1").using("int");
         *       $.guard(".int2").using("int", { min: -5 });
         *       $.guard(".int3").using("int", { max: 42 });
         *       $.guard(".int4").using("int", { min: 0, max: 10 });
         *     </script>
         *
         *     <p>
         *       <input class="int1" type="text" value="not valid" /><br />
         *       <small>An integer of any value</small>
         *     </p>
         *
         *     <p>
         *       <input class="int2" type="text" value="-10.5" /><br />
         *       <small>An integer no smaller than -5</small>
         *     </p>
         *
         *     <p>
         *       <input class="int3" type="text" value="64.32" /><br />
         *       <small>An integer no bigger than 42</small>
         *     </p>
         *
         *     <p>
         *       <input class="int4" type="text" value="11" /><br />
         *       <small>An integer from 0 to 10</small>
         *     </p>
         *   </div>
         * </div>
         */
        this.name("int").using(this.aggregate(this.isAllValid, this.isValidInt)).message(this.minMaxMessage({
            minAndMax: "Please enter a number from #{0} to #{1}.",
            min: "Please enter a number no less than #{0}.",
            max: "Please enter a number no greater than #{0}.",
            invalid: "Please enter a number."
        }));

        /**
         * @page Named Guards
         * @section moneyUS
         * @since 1.0.0
         *
         * <p>
         *   Guard for a US dollar amount.  Optionally, an object parameter may be passed with
         *   <code>min</code> and/or <code>max</code>.  Min will restrict the minimum value, while
         *   max restricts the maximum.  An empty value is considered valid.
         * </p>
         *
         * <div class="example">
         *   <div class="display">
         *     <script>
         *       $.guard(".money1").using("moneyUS");
         *       $.guard(".money2").using("moneyUS", { min: -5.50 });
         *       $.guard(".money3").using("moneyUS", { max: 42.02 });
         *       $.guard(".money4").using("moneyUS", { min: 0, max: 10 });
         *     </script>
         *
         *     <p>
         *       <input class="money1" type="text" value="not valid" /><br />
         *       <small>US money of any value</small>
         *     </p>
         *
         *     <p>
         *       <input class="money2" type="text" value="-$10.55" /><br />
         *       <small>US money no smaller than -$5.50</small>
         *     </p>
         *
         *     <p>
         *       <input class="money3" type="text" value="$64.32" /><br />
         *       <small>US money no bigger than $42.02</small>
         *     </p>
         *
         *     <p>
         *       <input class="money4" type="text" value="$11" /><br />
         *       <small>US money from $0 to $10</small>
         *     </p>
         *   </div>
         * </div>
         */
        this.name("moneyUS").using(this.aggregate(this.isAllValid, this.isValidMoneyUS)).message(this.minMaxMessage({
            minAndMax: "Please enter a dollar amount from #{0} to #{1}.",
            min: "Please enter a dollar amount no less than #{0}.",
            max: "Please enter a dollar amount no greater than #{0}.",
            invalid: "Please enter a dollar amount."
        }, function(x) { return x.toFixed(2); }));

        /**
         * @page Named Guards
         * @section never
         * @since 1.0.0
         *
         * <p>
         *   Never fail, no matter what.  For this guard to fail, it must be manually triggered via
         *   <a href="guard_type.html#triggerError"><code>guard.triggerError(selector)</code></a>.
         *   This guard can be useful for marking a field as having an error immediately when the page
         *   loads (such as for a server detected error).
         * </p>
         *
         * <div class="example">
         *   <div class="display">
         *     <script>
         *       var guard = $.guard(".never").using("never");
         *       $(function() { guard.triggerError(".never"); });
         *     </script>
         *
         *     <p>
         *       <input class="never" type="text" /><br />
         *       <small>Never fails, except manually</small>
         *     </p>
         *   </div>
         * </div>
         */
        this.name("never").using(this.aggregate(this.isAllValid, this.never)).message("There was an error.");

        /**
         * @page Named Guards
         * @section oneRequired
         * @since 1.0.0
         *
         * <p>
         *   This is a grouped guard where a single field of all the selected fields must have a value.
         * </p>
         *
         * <div class="example">
         *   <div class="display">
         *     <script>
         *       $.guard(".oneRequired").using("oneRequired");
         *     </script>
         *
         *     <p>
         *       <input class="oneRequired" type="text" value="" /><br />
         *       <input class="oneRequired" type="text" value="" /><br />
         *       <small>One value is required</small>
         *     </p>
         *   </div>
         * </div>
         */
        this.name("oneRequired").grouped().using(this.aggregate(this.isAnyValid, this.isPresent)).message("Specify at least one.");

        /**
         * @page Named Guards
         * @section phoneUS
         * @since 1.0.0
         *
         * <p>
         *   The guarded field is considered valid if no value is given, or if the value given appears
         *   to be a valid US phone number.  The number must include an area code.  Whitespace is ignored.
         * </p>
         *
         * <div class="example">
         *   <div class="display">
         *     <script>
         *       $.guard(".phone").using("phoneUS");
         *     </script>
         *
         *     <p>
         *       <input class="phone" type="text" value="555-1234" /><br />
         *       <small>A valid US phone number like (555) 555-1234</small>
         *     </p>
         *   </div>
         * </div>
         */
        this.name("phoneUS").using(this.aggregate(this.isAllValid, this.isValidPhoneUS)).message("Please enter a valid phone number.");
        this.name("required").using(this.aggregate(this.isAllValid, this.isPresent)).message("This field is required.");
        this.name("same").grouped().using(this.aggregate(this.passThrough, this.isSame)).message("These values must all match.");
        this.name("string").using(this.aggregate(this.isAllValid, this.isValidString)).message(this.minMaxMessage({
            minAndMax: "Please enter a string with length #{0} to #{1}.",
            min: "Please enter a string with length at least #{0}.",
            max: "Please enter a string with length no greater than #{0}."
        }));
    };

    $.Guards.prototype.version = "{{VERSION}}";

    $.Guards.prototype.parentContext = function(element) {
        var $element = $(element);
        var context = $element.parents("form:first");

        if (context.size() == 0) {
            context = $element.parents("*:last");
        }

        return context;
    };

    $.Guards.prototype.name = function(name) {
{'fraction_non_alphanumeric': 0.15461660719105166, 'fraction_numerical': 0.01061564758449036, 'mean_word_length': 1.388654107871929, 'pattern_counts': {'":': 14, '<': 483, '<?xml version=': 0, '>': 485, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4841562', 'n_tokens_mistral': 9723, 'n_tokens_neox': 9308, 'n_words': 2292}