/* * Kendo UI Beta v2013.2.716 (http://kendoui.com) * Copyright 2013 Telerik AD. All rights reserved. * * Kendo UI Beta license terms available at * http://www.kendoui.com/purchase/license-agreement/kendo-ui-beta.aspx */ ("function"==typeof define&&define.amd?define:function(e,t){return t()})(["./kendo.core.min"],function(){!function(e){function t(t){var a,u=n.ui.validator.ruleResolvers||{},F={};for(a in u)e.extend(!0,F,u[a].resolve(t));return F}function a(e){return e.replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function u(e){return e=(e+"").split("."),e.length>1?e[1].length:0}function F(t){return e.parseHTML?e(e.parseHTML(t)):e(t)}var r,n=window.kendo,i=n.ui.Widget,l=".kendoValidator",o="k-invalid-msg",s="k-invalid",d=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([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]|[\u00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&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([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,p=":input:not(:button,[type=submit],[type=reset],[disabled],[readonly])",D=":checkbox:not([disabled],[readonly])",c="[type=number],[type=range]",m="blur",v="name",g="form",h="novalidate",x=e.proxy,y=function(e,t){return"string"==typeof t&&(t=RegExp("^(?:"+t+")$")),t.test(e)},C=function(e,t,a){var u=e.val();return e.filter(t).length&&""!==u?y(u,a):!0},E=function(e,t){return e.length?null!=e[0].attributes[t]:!1};n.ui.validator||(n.ui.validator={rules:{},messages:{}}),r=i.extend({init:function(a,u){var F=this,r=t(a);u=u||{},u.rules=e.extend({},n.ui.validator.rules,r.rules,u.rules),u.messages=e.extend({},n.ui.validator.messages,r.messages,u.messages),i.fn.init.call(F,a,u),F._errorTemplate=n.template(F.options.errorTemplate),F.element.is(g)&&F.element.attr(h,h),F._errors={},F._attachEvents()},options:{name:"Validator",errorTemplate:' #=message#',messages:{required:"{0} is required",pattern:"{0} is not valid",min:"{0} should be greater than or equal to {1}",max:"{0} should be smaller than or equal to {1}",step:"{0} is not valid",email:"{0} is not valid email",url:"{0} is not valid URL",date:"{0} is not valid date"},rules:{required:function(e){var t=e.filter("[type=checkbox]").length&&!e.is(":checked"),a=e.val();return!(E(e,"required")&&(""===a||!a||t))},pattern:function(e){return e.filter("[type=text],[type=email],[type=url],[type=tel],[type=search],[type=password]").filter("[pattern]").length&&""!==e.val()?y(e.val(),e.attr("pattern")):!0},min:function(e){if(e.filter(c+",["+n.attr("type")+"=number]").filter("[min]").length&&""!==e.val()){var t=parseFloat(e.attr("min"))||0,a=n.parseFloat(e.val());return a>=t}return!0},max:function(e){if(e.filter(c+",["+n.attr("type")+"=number]").filter("[max]").length&&""!==e.val()){var t=parseFloat(e.attr("max"))||0,a=n.parseFloat(e.val());return t>=a}return!0},step:function(e){if(e.filter(c+",["+n.attr("type")+"=number]").filter("[step]").length&&""!==e.val()){var t,a=parseFloat(e.attr("min"))||0,F=parseFloat(e.attr("step"))||1,r=parseFloat(e.val()),i=u(F);return i?(t=Math.pow(10,i),0===(r-a)*t%(F*t)/Math.pow(100,i)):0===(r-a)%F}return!0},email:function(e){return C(e,"[type=email],["+n.attr("type")+"=email]",d)},url:function(e){return C(e,"[type=url],["+n.attr("type")+"=url]",f)},date:function(e){return e.filter("[type^=date],["+n.attr("type")+"=date]").length&&""!==e.val()?null!==n.parseDate(e.val(),e.attr(n.attr("format"))):!0}},validateOnBlur:!0},destroy:function(){i.fn.destroy.call(this),this.element.off(l)},_submit:function(e){return this.validate()?!0:(e.stopPropagation(),e.stopImmediatePropagation(),e.preventDefault(),!1)},_attachEvents:function(){var t=this;t.element.is(g)&&t.element.on("submit"+l,x(t._submit,t)),t.options.validateOnBlur&&(t.element.is(p)?(t.element.on(m+l,function(){t.validateInput(t.element)}),t.element.is(D)&&t.element.on("click"+l,function(){t.validateInput(t.element)})):(t.element.on(m+l,p,function(){t.validateInput(e(this))}),t.element.on("click"+l,D,function(){t.validateInput(e(this))})))},validate:function(){var e,t,a,u=this,F=!1;if(u._errors={},!u.element.is(p)){for(e=u.element.find(p),t=0,a=e.length;a>t;t++)u.validateInput(e.eq(t))||(F=!0);return!F}return u.validateInput(u.element)},validateInput:function(t){var u,r,n,i,l,d,f,p,D;return t=e(t),r=this,n=r._errorTemplate,i=r._checkValidity(t),l=i.valid,d="."+o,f=t.attr(v)||"",p=r._findMessageContainer(f).add(t.next(d)).hide(),t.removeAttr("aria-invalid"),l||(u=r._extractMessage(t,i.key),r._errors[f]=u,D=F(n({message:a(u)})),r._decorateMessageContainer(D,f),p.replaceWith(D).length||D.insertAfter(t),D.show(),t.attr("aria-invalid",!0)),t.toggleClass(s,!l),l},hideMessages:function(){var e=this,t="."+o,a=e.element;a.is(p)?a.next(t).hide():a.find(t).hide()},_findMessageContainer:function(t){var a,u,F,r,i,l=n.ui.validator.messageLocators,s=e(),d=this.element[0].getElementsByTagName("*");for(u=0,F=d.length;F>u;u++)r=d[u],r.className.indexOf(o)>-1&&(i=r.getAttribute(n.attr("for")),i===t&&(s=s.add(r)));for(a in l)s=s.add(l[a].locate(this.element,t));return s},_decorateMessageContainer:function(e,t){var a,u=n.ui.validator.messageLocators;e.addClass(o).attr(n.attr("for"),t||"");for(a in u)u[a].decorate(e,t);e.attr("role","alert")},_extractMessage:function(t,a){var u=this,F=u.options.messages[a],r=t.attr(v);return F=e.isFunction(F)?F(t):F,n.format(t.attr(n.attr(a+"-msg"))||t.attr("validationMessage")||t.attr("title")||F||"",r,t.attr(a))},_checkValidity:function(e){var t,a=this.options.rules;for(t in a)if(!a[t](e))return{valid:!1,key:t};return{valid:!0}},errors:function(){var e,t=[],a=this._errors;for(e in a)t.push(a[e]);return t}}),n.ui.plugin(r)}(window.kendo.jQuery)});