/* expressive.annotations.validate.js - v2.7.0 * Client-side component of ExpressiveAnnotations - annotation-based conditional validation library. * https://github.com/jwaliszko/ExpressiveAnnotations * * Copyright (c) 2014 Jarosław Waliszko * Licensed MIT: http://opensource.org/licenses/MIT */ !function(e,t){"use strict";var n=t.ea,r={settings:{debug:!1,optimize:!0,enumsAsNumbers:!0,dependencyTriggers:"change keyup",apply:function(t){function n(){if(!s.isBool(r.settings.debug))throw"debug value must be a boolean (true or false)";if(!s.isBool(r.settings.optimize))throw"optimize value must be a boolean (true or false)";if(!s.isBool(r.settings.enumsAsNumbers))throw"enumsAsNumbers value must be a boolean (true or false)";if(!s.isString(r.settings.dependencyTriggers)&&null!==r.settings.dependencyTriggers&&void 0!==r.settings.dependencyTriggers)throw"dependencyTriggers value must be a string (multiple event types can be bound at once by including each one separated by a space), null or undefined"}function i(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}i(r.settings,t),n(),e("form").each(function(){e(this).find("input, select, textarea").off(".expressive.annotations"),u.bindFields(this,!0)})}},addMethod:function(e,t){a.addMethod(e,t)},addValueParser:function(e,t){s.addValueParser(e,t)},noConflict:function(){return t.ea===this&&(t.ea=n),this}},i={dump:function(e){r.settings.debug&&console&&"function"==typeof console.log&&console.log(e)},warn:function(e){console&&"function"==typeof console.warn&&console.warn(e)},fail:function(e){console&&"function"==typeof console.error&&console.error(e)}},a={methods:{},addMethod:function(e,t){var n=this.methods[e];this.methods[e]=function(){return t.length===arguments.length?t.apply(this,arguments):"function"==typeof n?n.apply(this,arguments):t.apply(this,arguments)}},registerMethods:function(e){var t,n;this.initialize();for(t in this.methods)this.methods.hasOwnProperty(t)&&(n=this.methods[t],e[t]=n)},initialize:function(){this.addMethod("Now",function(){return Date.now()}),this.addMethod("Today",function(){return new Date((new Date).setHours(0,0,0,0)).getTime()}),this.addMethod("ToDate",function(e){return Date.parse(e)}),this.addMethod("Date",function(e,t,n){return new Date(new Date(e,t-1,n).setFullYear(e)).getTime()}),this.addMethod("Date",function(e,t,n,r,i,a){return new Date(new Date(e,t-1,n,r,i,a).setFullYear(e)).getTime()}),this.addMethod("TimeSpan",function(e,t,n,r){return 1e3*r+6e4*n+36e5*t+864e5*e}),this.addMethod("Length",function(e){return null!==e&&void 0!==e?e.length:0}),this.addMethod("Trim",function(t){return null!==t&&void 0!==t?e.trim(t):null}),this.addMethod("Concat",function(e,t){return[e,t].join("")}),this.addMethod("Concat",function(e,t,n){return[e,t,n].join("")}),this.addMethod("CompareOrdinal",function(e,t){return e===t?0:null!==e&&null===t?1:null===e&&null!==t?-1:e>t?1:-1}),this.addMethod("CompareOrdinalIgnoreCase",function(e,t){return e=null!==e&&void 0!==e?e.toLowerCase():null,t=null!==t&&void 0!==t?t.toLowerCase():null,this.CompareOrdinal(e,t)}),this.addMethod("StartsWith",function(e,t){return null!==e&&void 0!==e&&null!==t&&void 0!==t&&e.slice(0,t.length)===t}),this.addMethod("StartsWithIgnoreCase",function(e,t){return e=null!==e&&void 0!==e?e.toLowerCase():null,t=null!==t&&void 0!==t?t.toLowerCase():null,this.StartsWith(e,t)}),this.addMethod("EndsWith",function(e,t){return null!==e&&void 0!==e&&null!==t&&void 0!==t&&e.slice(-t.length)===t}),this.addMethod("EndsWithIgnoreCase",function(e,t){return e=null!==e&&void 0!==e?e.toLowerCase():null,t=null!==t&&void 0!==t?t.toLowerCase():null,this.EndsWith(e,t)}),this.addMethod("Contains",function(e,t){return null!==e&&void 0!==e&&null!==t&&void 0!==t&&e.indexOf(t)>-1}),this.addMethod("ContainsIgnoreCase",function(e,t){return e=null!==e&&void 0!==e?e.toLowerCase():null,t=null!==t&&void 0!==t?t.toLowerCase():null,this.Contains(e,t)}),this.addMethod("IsNullOrWhiteSpace",function(e){return null===e||!/\S/.test(e)}),this.addMethod("IsDigitChain",function(e){return/^[0-9]+$/.test(e)}),this.addMethod("IsNumber",function(e){return/^[+-]?(?:(?:[0-9]+)|(?:[0-9]+[eE][+-]?[0-9]+)|(?:[0-9]*\.[0-9]+(?:[eE][+-]?[0-9]+)?))$/.test(e)}),this.addMethod("IsEmail",function(e){return/^[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(e)}),this.addMethod("IsPhone",function(e){return/^(\+\s?)?((?!\+.*)\(\+?\d+([\s\-\.]?\d+)?\)|\d+)([\s\-\.]?(\(\d+([\s\-\.]?\d+)?\)|\d+))*(\s?(x|ext\.?)\s?\d+)?$/.test(e)}),this.addMethod("IsUrl",function(e){return/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/i.test(e)}),this.addMethod("IsRegexMatch",function(e,t){return null!==e&&void 0!==e&&null!==t&&void 0!==t&&new RegExp(t).test(e)}),this.addMethod("Guid",function(e){var t=s.guid.tryParse(e);if(t.error)throw t.msg;return t}),this.addMethod("Min",function(e){if(0===arguments.length)throw"no arguments";if(1===arguments.length&&s.isArray(e)){if(0===e.length)throw"empty sequence";return Math.min.apply(null,e)}return Math.min.apply(null,arguments)}),this.addMethod("Max",function(e){if(0===arguments.length)throw"no arguments";if(1===arguments.length&&s.isArray(e)){if(0===e.length)throw"empty sequence";return Math.max.apply(null,e)}return Math.max.apply(null,arguments)}),this.addMethod("Sum",function(e){if(0===arguments.length)throw"no arguments";var t,n,r=0;if(1===arguments.length&&s.isArray(e)){if(0===e.length)throw"empty sequence";for(t=0,n=e.length;t2&&i.warn(s.string.format("DOM field {0} is ambiguous (unless custom value parser is provided).",e.attr("name"))),e.is(":checked");case"radio":return e.filter(":checked").val();default:return e.length>1&&i.warn(s.string.format("DOM field {0} is ambiguous (unless custom value parser is provided).",e.attr("name"))),e.val()}}var d,l,f,c;if(l=r+n,d=e(t).find(s.string.format(':input[name="{0}"]',l)),0===d.length)throw s.string.format("DOM field {0} not found.",l);if(f=u(d),null===f||void 0===f||""===f)return null;if(c=s.tryParse(f,a,l,o),null!==c&&void 0!==c&&c.error)throw s.string.format("DOM field {0} value conversion to {1} failed. {2}",l,a,c.msg);return c},deserializeObject:function(e,t,n,i,a,s){function o(e,t,n){var r,i,a,s,o;for(r=e.split("."),i=n,a=0;a