!function(n){n.extend(n.fn,{validate:function(t){if(!this.length)return void(t&&t.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var i=n.data(this[0],"validator");return i?i:(this.attr("novalidate","novalidate"),i=new n.validator(t,this[0]),n.data(this[0],"validator",i),i.settings.onsubmit&&(this.validateDelegate(":submit","click",function(t){i.settings.submitHandler&&(i.submitButton=t.target);n(t.target).hasClass("cancel")&&(i.cancelSubmit=!0);void 0!==n(t.target).attr("formnovalidate")&&(i.cancelSubmit=!0)}),this.submit(function(t){function r(){var r;return i.settings.submitHandler?(i.submitButton&&(r=n("<input type='hidden'/>").attr("name",i.submitButton.name).val(n(i.submitButton).val()).appendTo(i.currentForm)),i.settings.submitHandler.call(i,i.currentForm,t),i.submitButton&&r.remove(),!1):!0}return i.settings.debug&&t.preventDefault(),i.cancelSubmit?(i.cancelSubmit=!1,r()):i.form()?i.pendingRequest?(i.formSubmitted=!0,!1):r():(i.focusInvalid(),!1)})),i)},valid:function(){var t,i;return n(this[0]).is("form")?t=this.validate().form():(t=!0,i=n(this[0].form).validate(),this.each(function(){t=i.element(this)&&t})),t},removeAttrs:function(t){var i={},r=this;return n.each(t.split(/\s/),function(n,t){i[t]=r.attr(t);r.removeAttr(t)}),i},rules:function(t,i){var e,s,f,u,o,h,r=this[0];if(t)switch(e=n.data(r.form,"validator").settings,s=e.rules,f=n.validator.staticRules(r),t){case"add":n.extend(f,n.validator.normalizeRule(i));delete f.messages;s[r.name]=f;i.messages&&(e.messages[r.name]=n.extend(e.messages[r.name],i.messages));break;case"remove":return i?(h={},n.each(i.split(/\s/),function(t,i){h[i]=f[i];delete f[i];"required"===i&&n(r).removeAttr("aria-required")}),h):(delete s[r.name],f)}return u=n.validator.normalizeRules(n.extend({},n.validator.classRules(r),n.validator.attributeRules(r),n.validator.dataRules(r),n.validator.staticRules(r)),r),u.required&&(o=u.required,delete u.required,u=n.extend({required:o},u),n(r).attr("aria-required","true")),u.remote&&(o=u.remote,delete u.remote,u=n.extend(u,{remote:o})),u}});n.extend(n.expr[":"],{blank:function(t){return!n.trim(""+n(t).val())},filled:function(t){return!!n.trim(""+n(t).val())},unchecked:function(t){return!n(t).prop("checked")}});n.validator=function(t,i){this.settings=n.extend(!0,{},n.validator.defaults,t);this.currentForm=i;this.init()};n.validator.format=function(t,i){return 1===arguments.length?function(){var i=n.makeArray(arguments);return i.unshift(t),n.validator.format.apply(this,i)}:(arguments.length>2&&i.constructor!==Array&&(i=n.makeArray(arguments).slice(1)),i.constructor!==Array&&(i=[i]),n.each(i,function(n,i){t=t.replace(new RegExp("\\{"+n+"\\}","g"),function(){return i})}),t)};n.extend(n.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:n([]),errorLabelContainer:n([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(n){this.lastActive=n;this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,n,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(n)).hide())},onfocusout:function(n){!this.checkable(n)&&(n.name in this.submitted||!this.optional(n))&&this.element(n)},onkeyup:function(n,t){(9!==t.which||""!==this.elementValue(n))&&(n.name in this.submitted||n===this.lastElement)&&this.element(n)},onclick:function(n){n.name in this.submitted?this.element(n):n.parentNode.name in this.submitted&&this.element(n.parentNode)},highlight:function(t,i,r){"radio"===t.type?this.findByName(t.name).addClass(i).removeClass(r):n(t).addClass(i).removeClass(r)},unhighlight:function(t,i,r){"radio"===t.type?this.findByName(t.name).removeClass(i).addClass(r):n(t).removeClass(i).addClass(r)}},setDefaults:function(t){n.extend(n.validator.defaults,t)},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:n.validator.format("Please enter no more than {0} characters."),minlength:n.validator.format("Please enter at least {0} characters."),rangelength:n.validator.format("Please enter a value between {0} and {1} characters long."),range:n.validator.format("Please enter a value between {0} and {1}."),max:n.validator.format("Please enter a value less than or equal to {0}."),min:n.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function i(t){var r=n.data(this[0].form,"validator"),u="on"+t.type.replace(/^validate/,""),i=r.settings;i[u]&&!this.is(i.ignore)&&i[u].call(r,this[0],t)}this.labelContainer=n(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||n(this.currentForm);this.containers=n(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var t,r=this.groups={};n.each(this.settings.groups,function(t,i){"string"==typeof i&&(i=i.split(/\s/));n.each(i,function(n,i){r[i]=t})});t=this.settings.rules;n.each(t,function(i,r){t[i]=n.validator.normalizeRule(r)});n(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'] ","focusin focusout keyup",i).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",i);this.settings.invalidHandler&&n(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);n(this.currentForm).find("[required], [data-rule-required], .required").attr("aria-required","true")},form:function(){return this.checkForm(),n.extend(this.submitted,this.errorMap),this.invalid=n.extend({},this.errorMap),this.valid()||n(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var n=0,t=this.currentElements=this.elements();t[n];n++)this.check(t[n]);return this.valid()},element:function(t){var u=this.clean(t),i=this.validationTargetFor(u),r=!0;return this.lastElement=i,void 0===i?delete this.invalid[u.name]:(this.prepareElement(i),this.currentElements=n(i),r=this.check(i)!==!1,r?delete this.invalid[i.name]:this.invalid[i.name]=!0),n(t).attr("aria-invalid",!r),this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),r},showErrors:function(t){if(t){n.extend(this.errorMap,t);this.errorList=[];for(var i in t)this.errorList.push({message:t[i],element:this.findByName(i)[0]});this.successList=n.grep(this.successList,function(n){return!(n.name in t)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){n.fn.resetForm&&n(this.currentForm).resetForm();this.submitted={};this.lastElement=null;this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass).removeData("previousValue").removeAttr("aria-invalid")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(n){var i,t=0;for(i in n)t++;return t},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{n(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(t){}},findLastActive:function(){var t=this.lastActive;return t&&1===n.grep(this.errorList,function(n){return n.element.name===t.name}).length&&t},elements:function(){var t=this,i={};return n(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&t.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in i||!t.objectLength(n(this).rules())?!1:(i[this.name]=!0,!0)})},clean:function(t){return n(t)[0]},errors:function(){var t=this.settings.errorClass.split(" ").join(".");return n(this.settings.errorElement+"."+t,this.errorContext)},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=n([]);this.toHide=n([]);this.currentElements=n([])},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers)},prepareElement:function(n){this.reset();this.toHide=this.errorsFor(n)},elementValue:function(t){var i,r=n(t),u=r.attr("type");return"radio"===u||"checkbox"===u?n("input[name='"+r.attr("name")+"']:checked").val():(i=r.val(),"string"==typeof i?i.replace(/\r/g,""):i)},check:function(t){t=this.validationTargetFor(this.clean(t));var i,r,u,f=n(t).rules(),s=n.map(f,function(n,t){return t}).length,e=!1,h=this.elementValue(t);for(r in f){u={method:r,parameters:f[r]};try{if(i=n.validator.methods[r].call(this,h,t,u.parameters),"dependency-mismatch"===i&&1===s){e=!0;continue}if(e=!1,"pending"===i)return void(this.toHide=this.toHide.not(this.errorsFor(t)));if(!i)return this.formatAndAdd(t,u),!1}catch(o){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+t.id+", check the '"+u.method+"' method.",o),o;}}if(!e)return this.objectLength(f)&&this.successList.push(t),!0},customDataMessage:function(t,i){return n(t).data("msg"+i[0].toUpperCase()+i.substring(1).toLowerCase())||n(t).data("msg")},customMessage:function(n,t){var i=this.settings.messages[n];return i&&(i.constructor===String?i:i[t])},findDefined:function(){for(var n=0;n<arguments.length;n++)if(void 0!==arguments[n])return arguments[n];return void 0},defaultMessage:function(t,i){return this.findDefined(this.customMessage(t.name,i),this.customDataMessage(t,i),!this.settings.ignoreTitle&&t.title||void 0,n.validator.messages[i],"<strong>Warning: No message defined for "+t.name+"<\/strong>")},formatAndAdd:function(t,i){var r=this.defaultMessage(t,i.method),u=/\$?\{(\d+)\}/g;"function"==typeof r?r=r.call(this,i.parameters,t):u.test(r)&&(r=n.validator.format(r.replace(u,"{$1}"),i.parameters));this.errorList.push({message:r,element:t,method:i.method});this.errorMap[t.name]=r;this.submitted[t.name]=r},addWrapper:function(n){return this.settings.wrapper&&(n=n.add(n.parent(this.settings.wrapper))),n},defaultShowErrors:function(){for(var i,t,n=0;this.errorList[n];n++)t=this.errorList[n],this.settings.highlight&&this.settings.highlight.call(this,t.element,this.settings.errorClass,this.settings.validClass),this.showLabel(t.element,t.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(n=0;this.successList[n];n++)this.showLabel(this.successList[n]);if(this.settings.unhighlight)for(n=0,i=this.validElements();i[n];n++)this.settings.unhighlight.call(this,i[n],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return n(this.errorList).map(function(){return this.element})},showLabel:function(t,i){var r=this.errorsFor(t);r.length?(r.removeClass(this.settings.validClass).addClass(this.settings.errorClass),r.html(i)):(r=n("<"+this.settings.errorElement+">").attr("for",this.idOrName(t)).addClass(this.settings.errorClass).html(i||""),this.settings.wrapper&&(r=r.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(r).length||(this.settings.errorPlacement?this.settings.errorPlacement(r,n(t)):r.insertAfter(t)));!i&&this.settings.success&&(r.text(""),"string"==typeof this.settings.success?r.addClass(this.settings.success):this.settings.success(r,t));this.toShow=this.toShow.add(r)},errorsFor:function(t){var i=this.idOrName(t);return this.errors().filter(function(){return n(this).attr("for")===i})},idOrName:function(n){return this.groups[n.name]||(this.checkable(n)?n.name:n.id||n.name)},validationTargetFor:function(n){return this.checkable(n)&&(n=this.findByName(n.name).not(this.settings.ignore)[0]),n},checkable:function(n){return/radio|checkbox/i.test(n.type)},findByName:function(t){return n(this.currentForm).find("[name='"+t+"']")},getLength:function(t,i){switch(i.nodeName.toLowerCase()){case"select":return n("option:selected",i).length;case"input":if(this.checkable(i))return this.findByName(i.name).filter(":checked").length}return t.length},depend:function(n,t){return this.dependTypes[typeof n]?this.dependTypes[typeof n](n,t):!0},dependTypes:{boolean:function(n){return n},string:function(t,i){return!!n(t,i.form).length},"function":function(n,t){return n(t)}},optional:function(t){var i=this.elementValue(t);return!n.validator.methods.required.call(this,i,t)&&"dependency-mismatch"},startRequest:function(n){this.pending[n.name]||(this.pendingRequest++,this.pending[n.name]=!0)},stopRequest:function(t,i){this.pendingRequest--;this.pendingRequest<0&&(this.pendingRequest=0);delete this.pending[t.name];i&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(n(this.currentForm).submit(),this.formSubmitted=!1):!i&&0===this.pendingRequest&&this.formSubmitted&&(n(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(t){return n.data(t,"previousValue")||n.data(t,"previousValue",{old:null,valid:!0,message:this.defaultMessage(t,"remote")})}},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(t,i){t.constructor===String?this.classRuleSettings[t]=i:n.extend(this.classRuleSettings,t)},classRules:function(t){var i={},r=n(t).attr("class");return r&&n.each(r.split(" "),function(){this in n.validator.classRuleSettings&&n.extend(i,n.validator.classRuleSettings[this])}),i},attributeRules:function(t){var r,i,u={},e=n(t),f=t.getAttribute("type");for(r in n.validator.methods)"required"===r?(i=t.getAttribute(r),""===i&&(i=!0),i=!!i):i=e.attr(r),/min|max/.test(r)&&(null===f||/number|range|text/.test(f))&&(i=Number(i)),i||0===i?u[r]=i:f===r&&"range"!==f&&(u[r]=!0);return u.maxlength&&/-1|2147483647|524288/.test(u.maxlength)&&delete u.maxlength,u},dataRules:function(t){var i,r,u={},f=n(t);for(i in n.validator.methods)r=f.data("rule"+i[0].toUpperCase()+i.substring(1).toLowerCase()),void 0!==r&&(u[i]=r);return u},staticRules:function(t){var i={},r=n.data(t.form,"validator");return r.settings.rules&&(i=n.validator.normalizeRule(r.settings.rules[t.name])||{}),i},normalizeRules:function(t,i){return n.each(t,function(r,u){if(u===!1)return void delete t[r];if(u.param||u.depends){var f=!0;switch(typeof u.depends){case"string":f=!!n(u.depends,i.form).length;break;case"function":f=u.depends.call(i,i)}f?t[r]=void 0!==u.param?u.param:!0:delete t[r]}}),n.each(t,function(r,u){t[r]=n.isFunction(u)?u(i):u}),n.each(["minlength","maxlength"],function(){t[this]&&(t[this]=Number(t[this]))}),n.each(["rangelength","range"],function(){var i;t[this]&&(n.isArray(t[this])?t[this]=[Number(t[this][0]),Number(t[this][1])]:"string"==typeof t[this]&&(i=t[this].split(/[\s,]+/),t[this]=[Number(i[0]),Number(i[1])]))}),n.validator.autoCreateRanges&&(t.min&&t.max&&(t.range=[t.min,t.max],delete t.min,delete t.max),t.minlength&&t.maxlength&&(t.rangelength=[t.minlength,t.maxlength],delete t.minlength,delete t.maxlength)),t},normalizeRule:function(t){if("string"==typeof t){var i={};n.each(t.split(/\s/),function(){i[this]=!0});t=i}return t},addMethod:function(t,i,r){n.validator.methods[t]=i;n.validator.messages[t]=void 0!==r?r:n.validator.messages[t];i.length<3&&n.validator.addClassRules(t,n.validator.normalizeRule(t))},methods:{required:function(t,i,r){if(!this.depend(r,i))return"dependency-mismatch";if("select"===i.nodeName.toLowerCase()){var u=n(i).val();return u&&u.length>0}return this.checkable(i)?this.getLength(t,i)>0:n.trim(t).length>0},email:function(n,t){return this.optional(t)||/^[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(n)},url:function(n,t){return this.optional(t)||/^(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(n)},date:function(n,t){return this.optional(t)||!/Invalid|NaN/.test(new Date(n).toString())},dateISO:function(n,t){return this.optional(t)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(n)},number:function(n,t){return this.optional(t)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(n)},digits:function(n,t){return this.optional(t)||/^\d+$/.test(n)},creditcard:function(n,t){if(this.optional(t))return"dependency-mismatch";if(/[^0-9 \-]+/.test(n))return!1;var i,f,e=0,r=0,u=!1;if(n=n.replace(/\D/g,""),n.length<13||n.length>19)return!1;for(i=n.length-1;i>=0;i--)f=n.charAt(i),r=parseInt(f,10),u&&(r*=2)>9&&(r-=9),e+=r,u=!u;return e%10==0},minlength:function(t,i,r){var u=n.isArray(t)?t.length:this.getLength(n.trim(t),i);return this.optional(i)||u>=r},maxlength:function(t,i,r){var u=n.isArray(t)?t.length:this.getLength(n.trim(t),i);return this.optional(i)||r>=u},rangelength:function(t,i,r){var u=n.isArray(t)?t.length:this.getLength(n.trim(t),i);return this.optional(i)||u>=r[0]&&u<=r[1]},min:function(n,t,i){return this.optional(t)||n>=i},max:function(n,t,i){return this.optional(t)||i>=n},range:function(n,t,i){return this.optional(t)||n>=i[0]&&n<=i[1]},equalTo:function(t,i,r){var u=n(r);return this.settings.onfocusout&&u.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){n(i).valid()}),t===u.val()},remote:function(t,i,r){if(this.optional(i))return"dependency-mismatch";var u,e,f=this.previousValue(i);return this.settings.messages[i.name]||(this.settings.messages[i.name]={}),f.originalMessage=this.settings.messages[i.name].remote,this.settings.messages[i.name].remote=f.message,r="string"==typeof r&&{url:r}||r,f.old===t?f.valid:(f.old=t,u=this,this.startRequest(i),e={},e[i.name]=t,n.ajax(n.extend(!0,{url:r,mode:"abort",port:"validate"+i.name,dataType:"json",data:e,context:u.currentForm,success:function(r){var o,e,h,s=r===!0||"true"===r;u.settings.messages[i.name].remote=f.originalMessage;s?(h=u.formSubmitted,u.prepareElement(i),u.formSubmitted=h,u.successList.push(i),delete u.invalid[i.name],u.showErrors()):(o={},e=r||u.defaultMessage(i,"remote"),o[i.name]=f.message=n.isFunction(e)?e(t):e,u.invalid[i.name]=!0,u.showErrors(o));f.valid=s;u.stopRequest(i,s)}},r)),"pending")}}});n.format=function(){throw"$.format has been deprecated. Please use $.validator.format instead.";}}(jQuery),function(n){var i,t={};n.ajaxPrefilter?n.ajaxPrefilter(function(n,i,r){var u=n.port;"abort"===n.mode&&(t[u]&&t[u].abort(),t[u]=r)}):(i=n.ajax,n.ajax=function(r){var f=("mode"in r?r:n.ajaxSettings).mode,u=("port"in r?r:n.ajaxSettings).port;return"abort"===f?(t[u]&&t[u].abort(),t[u]=i.apply(this,arguments),t[u]):i.apply(this,arguments)})}(jQuery),function(n){n.extend(n.fn,{validateDelegate:function(t,i,r){return this.bind(i,function(i){var u=n(i.target);if(u.is(t))return r.apply(u,arguments)})}})}(jQuery),function(n){function i(n,t,i){n.rules[t]=i;n.message&&(n.messages[t]=n.message)}function h(n){return n.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function f(n){return n.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g,"\\$1")}function e(n){return n.substr(0,n.lastIndexOf(".")+1)}function o(n,t){return n.indexOf("*.")===0&&(n=n.replace("*.",t)),n}function c(t,i){var r=n(this).find("[data-valmsg-for='"+f(i[0].name)+"']"),u=r.attr("data-valmsg-replace"),e=u?n.parseJSON(u)!==!1:null;r.removeClass("field-validation-valid").addClass("field-validation-error");t.data("unobtrusiveContainer",r);e?(r.empty(),t.removeClass("input-validation-error").appendTo(r)):t.hide()}function l(t,i){var u=n(this).find("[data-valmsg-summary=true]"),r=u.find("ul");r&&r.length&&i.errorList.length&&(r.empty(),u.addClass("validation-summary-errors").removeClass("validation-summary-valid"),n.each(i.errorList,function(){n("<li />").html(this.message).appendTo(r)}))}function a(t){var i=t.data("unobtrusiveContainer"),r=i.attr("data-valmsg-replace"),u=r?n.parseJSON(r):null;i&&(i.addClass("field-validation-valid").removeClass("field-validation-error"),t.removeData("unobtrusiveContainer"),u&&i.empty())}function v(){var t=n(this);t.data("validator").resetForm();t.find(".validation-summary-errors").addClass("validation-summary-valid").removeClass("validation-summary-errors");t.find(".field-validation-error").addClass("field-validation-valid").removeClass("field-validation-error").removeData("unobtrusiveContainer").find(">*").removeData("unobtrusiveContainer")}function s(t){var i=n(t),r=i.data(u),f=n.proxy(v,t);return r||(r={options:{errorClass:"input-validation-error",errorElement:"span",errorPlacement:n.proxy(c,t),invalidHandler:n.proxy(l,t),messages:{},rules:{},success:n.proxy(a,t)},attachValidation:function(){i.unbind("reset."+u,f).bind("reset."+u,f).validate(this.options)},validate:function(){return i.validate(),i.valid()}},i.data(u,r)),r}var r=n.validator,t,u="unobtrusiveValidation";r.unobtrusive={adapters:[],parseElement:function(t,i){var u=n(t),f=u.parents("form")[0],r,e,o;f&&(r=s(f),r.options.rules[t.name]=e={},r.options.messages[t.name]=o={},n.each(this.adapters,function(){var i="data-val-"+this.name,r=u.attr(i),s={};r!==undefined&&(i+="-",n.each(this.params,function(){s[this]=u.attr(i+this)}),this.adapt({element:t,form:f,message:r,params:s,rules:e,messages:o}))}),n.extend(e,{__dummy__:!0}),i||r.attachValidation())},parse:function(t){var i=n(t).parents("form").andSelf().add(n(t).find("form")).filter("form");n(t).find(":input").filter("[data-val=true]").each(function(){r.unobtrusive.parseElement(this,!0)});i.each(function(){var n=s(this);n&&n.attachValidation()})}};t=r.unobtrusive.adapters;t.add=function(n,t,i){return i||(i=t,t=[]),this.push({name:n,params:t,adapt:i}),this};t.addBool=function(n,t){return this.add(n,function(r){i(r,t||n,!0)})};t.addMinMax=function(n,t,r,u,f,e){return this.add(n,[f||"min",e||"max"],function(n){var f=n.params.min,e=n.params.max;f&&e?i(n,u,[f,e]):f?i(n,t,f):e&&i(n,r,e)})};t.addSingleVal=function(n,t,r){return this.add(n,[t||"val"],function(u){i(u,r||n,u.params[t])})};r.addMethod("__dummy__",function(){return!0});r.addMethod("regex",function(n,t,i){var r;return this.optional(t)?!0:(r=new RegExp(i).exec(n),r&&r.index===0&&r[0].length===n.length)});r.addMethod("nonalphamin",function(n,t,i){var r;return i&&(r=n.match(/\W/g),r=r&&r.length>=i),r});r.methods.extension?(t.addSingleVal("accept","mimtype"),t.addSingleVal("extension","extension")):t.addSingleVal("extension","extension","accept");t.addSingleVal("regex","pattern");t.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");t.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range");t.addMinMax("minlength","minlength").addMinMax("maxlength","minlength","maxlength");t.add("equalto",["other"],function(t){var r=e(t.element.name),u=t.params.other,s=o(u,r),h=n(t.form).find(":input").filter("[name='"+f(s)+"']")[0];i(t,"equalTo",h)});t.add("required",function(n){(n.element.tagName.toUpperCase()!=="INPUT"||n.element.type.toUpperCase()!=="CHECKBOX")&&i(n,"required",!0)});t.add("remote",["url","type","additionalfields"],function(t){var r={url:t.params.url,type:t.params.type||"GET",data:{}},u=e(t.element.name);n.each(h(t.params.additionalfields||t.element.name),function(i,e){var s=o(e,u);r.data[s]=function(){return n(t.form).find(":input").filter("[name='"+f(s)+"']").val()}});i(t,"remote",r)});t.add("password",["min","nonalphamin","regex"],function(n){n.params.min&&i(n,"minlength",n.params.min);n.params.nonalphamin&&i(n,"nonalphamin",n.params.nonalphamin);n.params.regex&&i(n,"regex",n.params.regex)});n(function(){r.unobtrusive.parse(document)})}(jQuery);!function(n,t,i){"use strict";var l,u,o,s,a,st,ht,v,y,p,f,w,nt,h,r,ct,b,e,tt,k,it,rt,ut,ft,d,g,et,ot,c;it={paneClass:"nano-pane",sliderClass:"nano-slider",contentClass:"nano-content",iOSNativeScrolling:!1,preventPageScrolling:!1,disableResize:!1,alwaysVisible:!1,flashDelay:1500,sliderMinHeight:20,sliderMaxHeight:null,documentContext:null,windowContext:null};ct="scrollbar";r="scroll";v="mousedown";y="mousemove";f="mousewheel";p="mouseup";h="resize";a="drag";e="up";nt="panedown";o="DOMMouseScroll";s="down";tt="wheel";st="keydown";ht="keyup";b="touchmove";l="Microsoft Internet Explorer"===t.navigator.appName&&/msie 7./i.test(t.navigator.appVersion)&&t.ActiveXObject;u=null;d=t.requestAnimationFrame;k=t.cancelAnimationFrame;et=i.createElement("div").style;c=function(){var n,r,f,t,i,u;for(t=["t","webkitT","MozT","msT","OT"],n=i=0,u=t.length;u>i;n=++i)if(f=t[n],r=t[n]+"ransform",r in et)return t[n].substr(0,t[n].length-1);return!1}();ot=function(n){return c===!1?!1:""===c?n:c+n.charAt(0).toUpperCase()+n.substr(1)};g=ot("transform");ut=g!==!1;rt=function(){var n,t,u;return n=i.createElement("div"),t=n.style,t.position="absolute",t.width="100px",t.height="100px",t.overflow=r,t.top="-9999px",i.body.appendChild(n),u=n.offsetWidth-n.clientWidth,i.body.removeChild(n),u};ft=function(){var r,i,n;return i=t.navigator.userAgent,(r=/(?=.+Mac OS X)(?=.+Firefox)/.test(i))?(n=/Firefox\/\d{2}\./.exec(i),n&&(n=n[0].replace(/\D+/g,"")),r&&+n>23):!1};w=function(){function c(r,f){this.el=r;this.options=f;u||(u=rt());this.$el=n(this.el);this.doc=n(this.options.documentContext||i);this.win=n(this.options.windowContext||t);this.$content=this.$el.children("."+f.contentClass);this.$content.attr("tabindex",this.options.tabIndex||0);this.content=this.$content[0];this.options.iOSNativeScrolling&&null!=this.el.style.WebkitOverflowScrolling?this.nativeScrolling():this.generate();this.createEvents();this.addEvents();this.reset()}return c.prototype.preventScrolling=function(n,t){if(this.isActive)if(n.type===o)(t===s&&n.originalEvent.detail>0||t===e&&n.originalEvent.detail<0)&&n.preventDefault();else if(n.type===f){if(!n.originalEvent||!n.originalEvent.wheelDelta)return;(t===s&&n.originalEvent.wheelDelta<0||t===e&&n.originalEvent.wheelDelta>0)&&n.preventDefault()}},c.prototype.nativeScrolling=function(){this.$content.css({WebkitOverflowScrolling:"touch"});this.iOSNativeScrolling=!0;this.isActive=!0},c.prototype.updateScrollValues=function(){var n;n=this.content;this.maxScrollTop=n.scrollHeight-n.clientHeight;this.prevScrollTop=this.contentScrollTop||0;this.contentScrollTop=n.scrollTop;this.iOSNativeScrolling||(this.maxSliderTop=this.paneHeight-this.sliderHeight,this.sliderTop=0===this.maxScrollTop?0:this.contentScrollTop*this.maxSliderTop/this.maxScrollTop)},c.prototype.setOnScrollStyles=function(){var n;ut?(n={},n[g]="translate(0, "+this.sliderTop+"px)"):n={top:this.sliderTop};d?this.scrollRAF||(this.scrollRAF=d(function(t){return function(){t.scrollRAF=null;t.slider.css(n)}}(this))):this.slider.css(n)},c.prototype.createEvents=function(){this.events={down:function(n){return function(t){return n.isBeingDragged=!0,n.offsetY=t.pageY-n.slider.offset().top,n.pane.addClass("active"),n.doc.bind(y,n.events[a]).bind(p,n.events[e]),!1}}(this),drag:function(n){return function(t){return n.sliderY=t.pageY-n.$el.offset().top-n.offsetY,n.scroll(),n.contentScrollTop>=n.maxScrollTop&&n.prevScrollTop!==n.maxScrollTop?n.$el.trigger("scrollend"):0===n.contentScrollTop&&0!==n.prevScrollTop&&n.$el.trigger("scrolltop"),!1}}(this),up:function(n){return function(){return n.isBeingDragged=!1,n.pane.removeClass("active"),n.doc.unbind(y,n.events[a]).unbind(p,n.events[e]),!1}}(this),resize:function(n){return function(){n.reset()}}(this),panedown:function(n){return function(t){return n.sliderY=(t.offsetY||t.originalEvent.layerY)-.5*n.sliderHeight,n.scroll(),n.events.down(t),!1}}(this),scroll:function(n){return function(t){n.updateScrollValues();n.isBeingDragged||(n.iOSNativeScrolling||(n.sliderY=n.sliderTop,n.setOnScrollStyles()),null!=t&&(n.contentScrollTop>=n.maxScrollTop?(n.options.preventPageScrolling&&n.preventScrolling(t,s),n.prevScrollTop!==n.maxScrollTop&&n.$el.trigger("scrollend")):0===n.contentScrollTop&&(n.options.preventPageScrolling&&n.preventScrolling(t,e),0!==n.prevScrollTop&&n.$el.trigger("scrolltop"))))}}(this),wheel:function(n){return function(t){var i;if(null!=t)return i=t.delta||t.wheelDelta||t.originalEvent&&t.originalEvent.wheelDelta||-t.detail||t.originalEvent&&-t.originalEvent.detail,i&&(n.sliderY+=-i/3),n.scroll(),!1}}(this)}},c.prototype.addEvents=function(){var n;this.removeEvents();n=this.events;this.options.disableResize||this.win.bind(h,n[h]);this.iOSNativeScrolling||(this.slider.bind(v,n[s]),this.pane.bind(v,n[nt]).bind(""+f+" "+o,n[tt]));this.$content.bind(""+r+" "+f+" "+o+" "+b,n[r])},c.prototype.removeEvents=function(){var n;n=this.events;this.win.unbind(h,n[h]);this.iOSNativeScrolling||(this.slider.unbind(),this.pane.unbind());this.$content.unbind(""+r+" "+f+" "+o+" "+b,n[r])},c.prototype.generate=function(){var o,n,e,i,r,f;return i=this.options,r=i.paneClass,f=i.sliderClass,o=i.contentClass,this.$el.find("."+r).length||this.$el.find("."+f).length||this.$el.append('<div class="'+r+'"><div class="'+f+'" /><\/div>'),this.pane=this.$el.children("."+r),this.slider=this.pane.find("."+f),0===u&&ft()?(e=t.getComputedStyle(this.content,null).getPropertyValue("padding-right").replace(/\D+/g,""),n={right:-14,paddingRight:+e+14}):u&&(n={right:-u},this.$el.addClass("has-scrollbar")),null!=n&&this.$content.css(n),this},c.prototype.restore=function(){this.stopped=!1;this.iOSNativeScrolling||this.pane.show();this.addEvents()},c.prototype.reset=function(){var n,o,s,h,f,v,c,i,y,e,a,t;return this.iOSNativeScrolling?void(this.contentHeight=this.content.scrollHeight):(this.$el.find("."+this.options.paneClass).length||this.generate().stop(),this.stopped&&this.restore(),n=this.content,h=n.style,f=h.overflowY,l&&this.$content.css({height:this.$content.height()}),o=n.scrollHeight+u,e=parseInt(this.$el.css("max-height"),10),e>0&&(this.$el.height(""),this.$el.height(n.scrollHeight>e?e:n.scrollHeight)),c=this.pane.outerHeight(!1),y=parseInt(this.pane.css("top"),10),v=parseInt(this.pane.css("bottom"),10),i=c+y+v,t=Math.round(i/o*i),t<this.options.sliderMinHeight?t=this.options.sliderMinHeight:null!=this.options.sliderMaxHeight&&t>this.options.sliderMaxHeight&&(t=this.options.sliderMaxHeight),f===r&&h.overflowX!==r&&(t+=u),this.maxSliderTop=i-t,this.contentHeight=o,this.paneHeight=c,this.paneOuterHeight=i,this.sliderHeight=t,this.slider.height(t),this.events.scroll(),this.pane.show(),this.isActive=!0,n.scrollHeight===n.clientHeight||this.pane.outerHeight(!0)>=n.scrollHeight&&f!==r?(this.pane.hide(),this.isActive=!1):this.el.clientHeight===n.scrollHeight&&f===r?this.slider.hide():this.slider.show(),this.pane.css({opacity:this.options.alwaysVisible?1:"",visibility:this.options.alwaysVisible?"visible":""}),s=this.$content.css("position"),("static"===s||"relative"===s)&&(a=parseInt(this.$content.css("right"),10),a&&this.$content.css({right:"",marginRight:a})),this)},c.prototype.scroll=function(){if(this.isActive)return(this.sliderY=Math.max(0,this.sliderY),this.sliderY=Math.min(this.maxSliderTop,this.sliderY),this.$content.scrollTop((this.paneHeight-this.contentHeight+u)*this.sliderY/this.maxSliderTop*-1),this.iOSNativeScrolling||(this.updateScrollValues(),this.setOnScrollStyles()),this)},c.prototype.scrollBottom=function(n){if(this.isActive)return(this.$content.scrollTop(this.contentHeight-this.$content.height()-n).trigger(f),this.stop().restore(),this)},c.prototype.scrollTop=function(n){if(this.isActive)return(this.$content.scrollTop(+n).trigger(f),this.stop().restore(),this)},c.prototype.scrollTo=function(n){if(this.isActive)return(this.scrollTop(this.$el.find(n).get(0).offsetTop),this)},c.prototype.stop=function(){return k&&this.scrollRAF&&(k(this.scrollRAF),this.scrollRAF=null),this.stopped=!0,this.removeEvents(),this.iOSNativeScrolling||this.pane.hide(),this},c.prototype.destroy=function(){return this.stopped||this.stop(),!this.iOSNativeScrolling&&this.pane.length&&this.pane.remove(),l&&this.$content.height(""),this.$content.removeAttr("tabindex"),this.$el.hasClass("has-scrollbar")&&(this.$el.removeClass("has-scrollbar"),this.$content.css({right:""})),this},c.prototype.flash=function(){if(!this.iOSNativeScrolling&&this.isActive)return(this.reset(),this.pane.addClass("flashed"),setTimeout(function(n){return function(){n.pane.removeClass("flashed")}}(this),this.options.flashDelay),this)},c}();n.fn.nanoScroller=function(t){return this.each(function(){var r,i;if((i=this.nanoscroller)||(r=n.extend({},it,t),this.nanoscroller=i=new w(this,r)),t&&"object"==typeof t){if(n.extend(i.options,t),null!=t.scrollBottom)return i.scrollBottom(t.scrollBottom);if(null!=t.scrollTop)return i.scrollTop(t.scrollTop);if(t.scrollTo)return i.scrollTo(t.scrollTo);if("bottom"===t.scroll)return i.scrollBottom(0);if("top"===t.scroll)return i.scrollTop(0);if(t.scroll&&t.scroll instanceof n)return i.scrollTo(t.scroll);if(t.stop)return i.stop();if(t.destroy)return i.destroy();if(t.flash)return i.flash()}return i.reset()})};n.fn.nanoScroller.Constructor=w}(jQuery,window,document);!function(n,t,i,r){var u=n(t);n.fn.lazyload=function(f){function s(){var t=0;o.each(function(){var i=n(this);if((!e.skip_invisible||i.is(":visible"))&&!n.abovethetop(this,e)&&!n.leftofbegin(this,e))if(n.belowthefold(this,e)||n.rightoffold(this,e)){if(++t>e.failure_limit)return!1}else i.trigger("appear"),t=0})}var h,o=this,e={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:t,data_attribute:"original",skip_invisible:!0,appear:null,load:null};return f&&(r!==f.failurelimit&&(f.failure_limit=f.failurelimit,delete f.failurelimit),r!==f.effectspeed&&(f.effect_speed=f.effectspeed,delete f.effectspeed),n.extend(e,f)),h=e.container===r||e.container===t?u:n(e.container),0===e.event.indexOf("scroll")&&h.bind(e.event,function(){return s()}),this.each(function(){var i=this,t=n(i);i.loaded=!1;t.one("appear",function(){if(!this.loaded){if(e.appear){var r=o.length;e.appear.call(i,r,e)}n("<img />").bind("load",function(){var r,u;t.hide().attr("src",t.data(e.data_attribute))[e.effect](e.effect_speed);i.loaded=!0;r=n.grep(o,function(n){return!n.loaded});(o=n(r),e.load)&&(u=o.length,e.load.call(i,u,e))}).error(function(){t.attr("src","/content/images/catalog/nopicture.jpg")}).attr("src",t.data(e.data_attribute))}});0!==e.event.indexOf("scroll")&&t.bind(e.event,function(){i.loaded||t.trigger("appear")})}),u.bind("resize",function(){s()}),/iphone|ipod|ipad.*os 5/gi.test(navigator.appVersion)&&u.bind("pageshow",function(t){t.originalEvent&&t.originalEvent.persisted&&o.each(function(){n(this).trigger("appear")})}),n(i).ready(function(){s()}),this};n.belowthefold=function(i,f){var e;return e=f.container===r||f.container===t?u.height()+u.scrollTop():n(f.container).offset().top+n(f.container).height(),e<=n(i).offset().top-f.threshold};n.rightoffold=function(i,f){var e;return e=f.container===r||f.container===t?u.width()+u.scrollLeft():n(f.container).offset().left+n(f.container).width(),e<=n(i).offset().left-f.threshold};n.abovethetop=function(i,f){var e;return e=f.container===r||f.container===t?u.scrollTop():n(f.container).offset().top,e>=n(i).offset().top+f.threshold+n(i).height()};n.leftofbegin=function(i,f){var e;return e=f.container===r||f.container===t?u.scrollLeft():n(f.container).offset().left,e>=n(i).offset().left+f.threshold+n(i).width()};n.inviewport=function(t,i){return!(n.rightoffold(t,i)||n.leftofbegin(t,i)||n.belowthefold(t,i)||n.abovethetop(t,i))};n.extend(n.expr[":"],{"below-the-fold":function(t){return n.belowthefold(t,{threshold:0})},"above-the-top":function(t){return!n.belowthefold(t,{threshold:0})},"right-of-screen":function(t){return n.rightoffold(t,{threshold:0})},"left-of-screen":function(t){return!n.rightoffold(t,{threshold:0})},"in-viewport":function(t){return n.inviewport(t,{threshold:0})},"above-the-fold":function(t){return!n.belowthefold(t,{threshold:0})},"right-of-fold":function(t){return n.rightoffold(t,{threshold:0})},"left-of-fold":function(t){return!n.rightoffold(t,{threshold:0})}})}(jQuery,window,document),function(n){"use strict";var t={i18n:{ru:{months:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],dayOfWeek:["Вск","Пн","Вт","Ср","Чт","Пт","Сб"]},en:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],dayOfWeek:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},de:{months:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],dayOfWeek:["So","Mo","Di","Mi","Do","Fr","Sa"]},nl:{months:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],dayOfWeek:["zo","ma","di","wo","do","vr","za"]},tr:{months:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],dayOfWeek:["Paz","Pts","Sal","Çar","Per","Cum","Cts"]},fr:{months:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],dayOfWeek:["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"]},es:{months:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],dayOfWeek:["Dom","Lun","Mar","Mié","Jue","Vie","Sáb"]},th:{months:["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"],dayOfWeek:["อา.","จ.","อ.","พ.","พฤ.","ศ.","ส."]},pl:{months:["styczeń","luty","marzec","kwiecień","maj","czerwiec","lipiec","sierpień","wrzesień","październik","listopad","grudzień"],dayOfWeek:["nd","pn","wt","śr","cz","pt","sb"]},pt:{months:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],dayOfWeek:["Dom","Seg","Ter","Qua","Qui","Sex","Sab"]},ch:{months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],dayOfWeek:["日","一","二","三","四","五","六"]},se:{months:["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"],dayOfWeek:["Sön","Mån","Tis","Ons","Tor","Fre","Lör"]},kr:{months:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],dayOfWeek:["일","월","화","수","목","금","토"]},it:{months:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"],dayOfWeek:["Dom","Lun","Mar","Mer","Gio","Ven","Sab"]},da:{months:["January","Februar","Marts","April","Maj","Juni","July","August","September","Oktober","November","December"],dayOfWeek:["Søn","Man","Tir","ons","Tor","Fre","lør"]},ja:{months:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dayOfWeek:["日","月","火","水","木","金","土"]}},value:"",lang:"en",format:"Y/m/d H:i",formatTime:"H:i",formatDate:"Y/m/d",startDate:!1,step:60,closeOnDateSelect:!1,closeOnWithoutClick:!0,timepicker:!0,datepicker:!0,minDate:!1,maxDate:!1,minTime:!1,maxTime:!1,allowTimes:[],opened:!1,initTime:!0,inline:!1,onSelectDate:function(){},onSelectTime:function(){},onChangeMonth:function(){},onChangeDateTime:function(){},onShow:function(){},onClose:function(){},onGenerate:function(){},withoutCopyright:!0,inverseButton:!1,hours12:!1,next:"xdsoft_next",prev:"xdsoft_prev",dayOfWeekStart:0,timeHeightInTimePicker:25,timepickerScrollbar:!0,todayButton:!0,defaultSelect:!0,scrollMonth:!0,scrollTime:!0,scrollInput:!0,lazyInit:!1,mask:!1,validateOnBlur:!0,allowBlank:!0,yearStart:1950,yearEnd:2050,style:"",id:"",roundTime:"round",className:"",weekends:[],yearOffset:0};Array.prototype.indexOf||(Array.prototype.indexOf=function(n,t){for(var i=t||0,r=this.length;i<r;i++)if(this[i]===n)return i;return-1});n.fn.xdsoftScroller=function(t){return this.each(function(){var i=n(this);if(!n(this).hasClass("xdsoft_scroller_box")){var c=function(n){var t={x:0,y:0},i;return n.type=="touchstart"||n.type=="touchmove"||n.type=="touchend"||n.type=="touchcancel"?(i=n.originalEvent.touches[0]||n.originalEvent.changedTouches[0],t.x=i.pageX,t.y=i.pageY):(n.type=="mousedown"||n.type=="mouseup"||n.type=="mousemove"||n.type=="mouseover"||n.type=="mouseout"||n.type=="mouseenter"||n.type=="mouseleave")&&(t.x=n.pageX,t.y=n.pageY),t},l=0,f=i.children().eq(0),u=i[0].clientHeight,e=f[0].offsetHeight,o=n('<div class="xdsoft_scrollbar"><\/div>'),r=n('<div class="xdsoft_scroller"><\/div>'),s=100,h=!1;o.append(r);i.addClass("xdsoft_scroller_box").append(o);r.on("mousedown.xdsoft_scroller",function(f){u||i.trigger("resize_scroll.xdsoft_scroller",[t]);var h=f.pageY,c=parseInt(r.css("margin-top")),e=o[0].offsetHeight;n(document.body).addClass("xdsoft_noselect");n([document.body,window]).on("mouseup.xdsoft_scroller",function a(){n([document.body,window]).off("mouseup.xdsoft_scroller",a).off("mousemove.xdsoft_scroller",l).removeClass("xdsoft_noselect")});n(document.body).on("mousemove.xdsoft_scroller",l=function(n){var t=n.pageY-h+c;t<0&&(t=0);t+r[0].offsetHeight>e&&(t=e-r[0].offsetHeight);i.trigger("scroll_element.xdsoft_scroller",[s?t/s:0])})});i.on("scroll_element.xdsoft_scroller",function(n,t){u||i.trigger("resize_scroll.xdsoft_scroller",[t,!0]);t=t>1?1:t<0||isNaN(t)?0:t;r.css("margin-top",s*t);f.css("marginTop",-parseInt((e-u)*t))}).on("resize_scroll.xdsoft_scroller",function(n,t,h){u=i[0].clientHeight;e=f[0].offsetHeight;var c=u/e,l=c*o[0].offsetHeight;c>1?r.hide():(r.show(),r.css("height",parseInt(l>10?l:10)),s=o[0].offsetHeight-r[0].offsetHeight,h!==!0&&i.trigger("scroll_element.xdsoft_scroller",[t?t:Math.abs(parseInt(f.css("marginTop")))/(e-u)]))});i.mousewheel&&i.mousewheel(function(n,t){var r=Math.abs(parseInt(f.css("marginTop")));return i.trigger("scroll_element.xdsoft_scroller",[(r-t*20)/(e-u)]),n.stopPropagation(),!1});i.on("touchstart",function(n){h=c(n)});i.on("touchmove",function(n){if(h){var t=c(n),r=Math.abs(parseInt(f.css("marginTop")));i.trigger("scroll_element.xdsoft_scroller",[(r-(t.y-h.y))/(e-u)]);n.stopPropagation();n.preventDefault()}});i.on("touchend touchcancel",function(){h=!1})}i.trigger("resize_scroll.xdsoft_scroller",[t])})};n.fn.datetimepicker=function(i){var s=48,p=57,h=96,c=105,e=17,u=46,l=13,w=27,f=8,b=37,k=38,d=39,g=40,a=9,nt=116,tt=65,it=67,rt=86,ut=90,ft=89,o=!1,r=n.isPlainObject(i)||!i?n.extend(!0,{},t,i):n.extend({},t),v=0,et=function(n){n.on("open.xdsoft focusin.xdsoft mousedown.xdsoft",function t(){n.is(":disabled")||n.is(":hidden")||!n.is(":visible")||n.data("xdsoft_datetimepicker")||(clearTimeout(v),v=setTimeout(function(){n.data("xdsoft_datetimepicker")||y(n);n.off("open.xdsoft focusin.xdsoft mousedown.xdsoft",t).trigger("open.xdsoft")},100))})},y=function(t){function dt(){var n=r.value?r.value:t&&t.val&&t.val()?t.val():"";return n&&v.isValidDate(n=Date.parseDate(n,r.format))?i.data("changed",!0):n="",n||r.startDate===!1||(n=v.strToDateTime(r.startDate)),n?n:0}var i=n("<div "+(r.id?'id="'+r.id+'"':"")+" "+(r.style?'style="'+r.style+'"':"")+' class="xdsoft_datetimepicker xdsoft_noselect '+r.className+'"><\/div>'),gt=n('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net<\/a><\/div>'),ht=n('<div class="xdsoft_datepicker active"><\/div>'),et=n('<div class="xdsoft_mounthpicker"><button type="button" class="xdsoft_prev"><\/button><button type="button" class="xdsoft_today_button"><\/button><div class="xdsoft_label xdsoft_month"><span><\/span><\/div><div class="xdsoft_label xdsoft_year"><span><\/span><\/div><button type="button" class="xdsoft_next"><\/button><\/div>'),yt=n('<div class="xdsoft_calendar"><\/div>'),ct=n('<div class="xdsoft_timepicker active"><button type="button" class="xdsoft_prev"><\/button><div class="xdsoft_time_box"><\/div><button type="button" class="xdsoft_next"><\/button><\/div>'),ot=ct.find(".xdsoft_time_box").eq(0),y=n('<div class="xdsoft_time_variant"><\/div>'),ni=n('<div class="xdsoft_scrollbar"><\/div>'),ii=n('<div class="xdsoft_scroller"><\/div>'),pt=n('<div class="xdsoft_select xdsoft_monthselect"><div><\/div><\/div>'),wt=n('<div class="xdsoft_select xdsoft_yearselect"><div><\/div><\/div>'),lt,v,bt,at,st,vt,kt,ti;et.find(".xdsoft_month span").after(pt);et.find(".xdsoft_year span").after(wt);et.find(".xdsoft_month,.xdsoft_year").on("mousedown.xdsoft",function(t){var r,u;et.find(".xdsoft_select").hide();var i=n(this).find(".xdsoft_select").eq(0),f=0,e=0;for(v.currentTime&&(f=v.currentTime[n(this).hasClass("xdsoft_month")?"getMonth":"getFullYear"]()),i.show(),r=i.find("div.xdsoft_option"),u=0;u<r.length;u++)if(r.eq(u).data("value")==f)break;else e+=r[0].offsetHeight;return i.xdsoftScroller(e/(i.children()[0].offsetHeight-i[0].clientHeight)),t.stopPropagation(),!1});et.find(".xdsoft_select").xdsoftScroller().on("mousedown.xdsoft",function(n){n.stopPropagation();n.preventDefault()}).on("mousedown.xdsoft",".xdsoft_option",function(){v&&v.currentTime&&v.currentTime[n(this).parent().parent().hasClass("xdsoft_monthselect")?"setMonth":"setFullYear"](n(this).data("value"));n(this).parent().parent().hide();i.trigger("xchange.xdsoft");r.onChangeMonth&&r.onChangeMonth.call&&r.onChangeMonth.call(i,v.currentTime,i.data("input"))});i.setOptions=function(y){if(r=n.extend(!0,{},r,y),y.allowTimes&&n.isArray(y.allowTimes)&&y.allowTimes.length&&(r.allowTimes=n.extend(!0,[],y.allowTimes)),y.weekends&&n.isArray(y.weekends)&&y.weekends.length&&(r.weekends=n.extend(!0,[],y.weekends)),(r.open||r.opened)&&!r.inline&&t.trigger("open.xdsoft"),r.inline&&(i.addClass("xdsoft_inline"),t.after(i).hide(),i.trigger("afterOpen.xdsoft")),r.inverseButton&&(r.next="xdsoft_prev",r.prev="xdsoft_next"),r.datepicker?ht.addClass("active"):ht.removeClass("active"),r.timepicker?ct.addClass("active"):ct.removeClass("active"),r.value&&(t&&t.val&&t.val(r.value),v.setCurrentTime(r.value)),r.dayOfWeekStart=isNaN(r.dayOfWeekStart)||parseInt(r.dayOfWeekStart)<0||parseInt(r.dayOfWeekStart)>6?0:parseInt(r.dayOfWeekStart),r.timepickerScrollbar||ni.hide(),r.minDate&&/^-(.*)$/.test(r.minDate)&&(r.minDate=v.strToDateTime(r.minDate).dateFormat(r.formatDate)),r.maxDate&&/^\+(.*)$/.test(r.maxDate)&&(r.maxDate=v.strToDateTime(r.maxDate).dateFormat(r.formatDate)),et.find(".xdsoft_today_button").css("visibility",r.todayButton?"visible":"hidden"),r.mask){var st=function(n){try{if(document.selection&&document.selection.createRange){var t=document.selection.createRange();return t.getBookmark().charCodeAt(2)-2}if(n.setSelectionRange)return n.selectionStart}catch(i){return 0}},lt=function(n,t){var n=typeof n=="string"||n instanceof String?document.getElementById(n):n,i;if(n){if(n.createTextRange)return i=n.createTextRange(),i.collapse(!0),i.moveEnd(t),i.moveStart(t),i.select(),!0;if(n.setSelectionRange)return n.setSelectionRange(t,t),!0}else return!1;return!1},ot=function(n,t){var i=n.replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g,"\\$1").replace(/_/g,"{digit+}").replace(/([0-9]{1})/g,"{digit$1}").replace(/\{digit([0-9]{1})\}/g,"[0-$1_]{1}").replace(/\{digit[\+]\}/g,"[0-9_]{1}");return RegExp(i).test(t)};t.off("keydown.xdsoft");switch(!0){case r.mask===!0:r.mask=r.format.replace(/Y/g,"9999").replace(/F/g,"9999").replace(/m/g,"19").replace(/d/g,"39").replace(/H/g,"29").replace(/i/g,"59").replace(/s/g,"59");case n.type(r.mask)=="string":ot(r.mask,t.val())||t.val(r.mask.replace(/[0-9]/g,"_"));t.on("keydown.xdsoft",function(i){var et=this.value,v=i.which,y,ht;switch(!0){case v>=s&&v<=p||v>=h&&v<=c||v==f||v==u:for(y=st(this),ht=v!=f&&v!=u?String.fromCharCode(h<=v&&v<=c?v-s:v):"_",(v==f||v==u)&&y&&(y--,ht="_");/[^0-9_]/.test(r.mask.substr(y,1))&&y<r.mask.length&&y>0;)y+=v==f||v==u?-1:1;if(et=et.substr(0,y)+ht+et.substr(y+1),n.trim(et)=="")et=r.mask.replace(/[0-9]/g,"_");else if(y==r.mask.length)break;for(y+=v==f||v==u?0:1;/[^0-9_]/.test(r.mask.substr(y,1))&&y<r.mask.length&&y>0;)y+=v==f||v==u?-1:1;ot(r.mask,et)?(this.value=et,lt(this,y)):n.trim(et)==""?this.value=r.mask.replace(/[0-9]/g,"_"):t.trigger("error_input.xdsoft");break;case!!~[tt,it,rt,ut,ft].indexOf(v)&&o:case!!~[w,k,g,b,d,nt,e,a,l].indexOf(v):return!0}return i.preventDefault(),!1})}}if(r.validateOnBlur)t.off("blur.xdsoft").on("blur.xdsoft",function(){r.allowBlank&&!n.trim(n(this).val()).length?(n(this).val(null),i.data("xdsoft_datetime").empty()):Date.parseDate(n(this).val(),r.format)?i.data("xdsoft_datetime").setCurrentTime(n(this).val()):(n(this).val(v.now().dateFormat(r.format)),i.data("xdsoft_datetime").setCurrentTime(n(this).val()));i.trigger("changedatetime.xdsoft")});r.dayOfWeekStartPrev=r.dayOfWeekStart==0?6:r.dayOfWeekStart-1;i.trigger("xchange.xdsoft")};i.data("options",r).on("mousedown.xdsoft",function(n){return n.stopPropagation(),n.preventDefault(),wt.hide(),pt.hide(),!1});lt=ct.find(".xdsoft_time_box");lt.append(y);lt.xdsoftScroller();i.on("afterOpen.xdsoft",function(){lt.xdsoftScroller()});i.append(ht).append(ct);r.withoutCopyright!==!0&&i.append(gt);ht.append(et).append(yt);n("body").append(i);v=new function(){var n=this;n.now=function(){var n=new Date;return r.yearOffset&&n.setFullYear(n.getFullYear()+r.yearOffset),n};n.currentTime=this.now();n.isValidDate=function(n){return Object.prototype.toString.call(n)!=="[object Date]"?!1:!isNaN(n.getTime())};n.setCurrentTime=function(t){n.currentTime=typeof t=="string"?n.strToDateTime(t):n.isValidDate(t)?t:n.now();i.trigger("xchange.xdsoft")};n.empty=function(){n.currentTime=null};n.getCurrentTime=function(){return n.currentTime};n.nextMonth=function(){var t=n.currentTime.getMonth()+1;return t==12&&(n.currentTime.setFullYear(n.currentTime.getFullYear()+1),t=0),n.currentTime.setDate(Math.min(Date.daysInMonth[t],n.currentTime.getDate())),n.currentTime.setMonth(t),r.onChangeMonth&&r.onChangeMonth.call&&r.onChangeMonth.call(i,v.currentTime,i.data("input")),i.trigger("xchange.xdsoft"),t};n.prevMonth=function(){var t=n.currentTime.getMonth()-1;return t==-1&&(n.currentTime.setFullYear(n.currentTime.getFullYear()-1),t=11),n.currentTime.setDate(Math.min(Date.daysInMonth[t],n.currentTime.getDate())),n.currentTime.setMonth(t),r.onChangeMonth&&r.onChangeMonth.call&&r.onChangeMonth.call(i,v.currentTime,i.data("input")),i.trigger("xchange.xdsoft"),t};n.strToDateTime=function(t){var i=[],f,u;return(i=/^(\+|\-)(.*)$/.exec(t))&&(i[2]=Date.parseDate(i[2],r.formatDate))?(f=i[2].getTime()-6e4*i[2].getTimezoneOffset(),u=new Date(v.now().getTime()+parseInt(i[1]+"1")*f)):u=t?Date.parseDate(t,r.format):n.now(),n.isValidDate(u)||(u=n.now()),u};n.strtodate=function(t){var i=t?Date.parseDate(t,r.formatDate):n.now();return n.isValidDate(i)||(i=n.now()),i};n.strtotime=function(t){var i=t?Date.parseDate(t,r.formatTime):n.now();return n.isValidDate(i)||(i=n.now()),i};n.str=function(){return n.currentTime.dateFormat(r.format)}};et.find(".xdsoft_today_button").on("mousedown.xdsoft",function(){i.data("changed",!0);v.setCurrentTime(0);i.trigger("afterOpen.xdsoft")}).on("dblclick.xdsoft",function(){t.val(v.str());i.trigger("close.xdsoft")});et.find(".xdsoft_prev,.xdsoft_next").on("mousedown.xdsoft",function(){var t=n(this),i=0,u=!1;(function f(n){var e=v.currentTime.getMonth();t.hasClass(r.next)?v.nextMonth():t.hasClass(r.prev)&&v.prevMonth();u||(i=setTimeout(f,n?n:100))})(500);n([document.body,window]).on("mouseup.xdsoft",function e(){clearTimeout(i);u=!0;n([document.body,window]).off("mouseup.xdsoft",e)})});ct.find(".xdsoft_prev,.xdsoft_next").on("mousedown.xdsoft",function(){var i=n(this),u=0,f=!1,t=110;(function e(n){var s=ot[0].clientHeight,h=y[0].offsetHeight,o=Math.abs(parseInt(y.css("marginTop")));i.hasClass(r.next)&&h-s-r.timeHeightInTimePicker>=o?y.css("marginTop","-"+(o+r.timeHeightInTimePicker)+"px"):i.hasClass(r.prev)&&o-r.timeHeightInTimePicker>=0&&y.css("marginTop","-"+(o-r.timeHeightInTimePicker)+"px");ot.trigger("scroll_element.xdsoft_scroller",[Math.abs(parseInt(y.css("marginTop"))/(h-s))]);t=t>10?10:t-10;f||(u=setTimeout(e,n?n:t))})(500);n([document.body,window]).on("mouseup.xdsoft",function o(){clearTimeout(u);f=!0;n([document.body,window]).off("mouseup.xdsoft",o)})});bt=0;i.on("xchange.xdsoft",function(t){clearTimeout(bt);bt=setTimeout(function(){var o="",u=new Date(v.currentTime.getFullYear(),v.currentTime.getMonth(),1,12,0,0),t=0,w=v.now(),s,h,a,b,c,f,e,l;for(console.log("fire xchange.xdsoft",v.currentTime);u.getDay()!=r.dayOfWeekStart;)u.setDate(u.getDate()-1);for(o+="<table><thead><tr>",e=0;e<7;e++)o+="<th>"+r.i18n[r.lang].dayOfWeek[e+r.dayOfWeekStart>6?0:e+r.dayOfWeekStart]+"<\/th>";for(o+="<\/tr><\/thead>",o+="<tbody><tr>",s=!1,h=!1,r.maxDate!==!1&&(s=v.strtodate(r.maxDate),s=new Date(s.getFullYear(),s.getMonth(),s.getDate(),23,59,59,999)),r.minDate!==!1&&(h=v.strtodate(r.minDate),h=new Date(h.getFullYear(),h.getMonth(),h.getDate())),f=[];t<v.currentTime.getDaysInMonth()||u.getDay()!=r.dayOfWeekStart||v.currentTime.getMonth()==u.getMonth();)f=[],t++,a=u.getDate(),b=u.getFullYear(),c=u.getMonth(),f.push("xdsoft_date"),(s!==!1&&u>s||h!==!1&&u<h)&&f.push("xdsoft_disabled"),v.currentTime.getMonth()!=c&&f.push("xdsoft_other_month"),(r.defaultSelect||i.data("changed"))&&v.currentTime.dateFormat("d.m.Y")==u.dateFormat("d.m.Y")&&f.push("xdsoft_current"),w.dateFormat("d.m.Y")==u.dateFormat("d.m.Y")&&f.push("xdsoft_today"),(u.getDay()==0||u.getDay()==6||~r.weekends.indexOf(u.dateFormat("d.m.Y")))&&f.push("xdsoft_weekend"),o+='<td data-date="'+a+'" data-month="'+c+'" data-year="'+b+'" class="xdsoft_date xdsoft_day_of_week'+u.getDay()+" "+f.join(" ")+'"><div>'+a+"<\/div><\/td>",u.getDay()==r.dayOfWeekStartPrev&&(o+="<\/tr>"),u.setDate(a+1);o+="<\/tbody><\/table>";yt.html(o);et.find(".xdsoft_label span").eq(0).text(r.i18n[r.lang].months[v.currentTime.getMonth()]);et.find(".xdsoft_label span").eq(1).text(v.currentTime.getFullYear());var k="",p="",c="",d=function(n,t){var u=v.now();u.setHours(n);n=parseInt(u.getHours());u.setMinutes(t);t=parseInt(u.getMinutes());f=[];(r.maxTime!==!1&&v.strtotime(r.maxTime).getTime()<u.getTime()||r.minTime!==!1&&v.strtotime(r.minTime).getTime()>u.getTime())&&f.push("xdsoft_disabled");(r.initTime||r.defaultSelect||i.data("changed"))&&parseInt(v.currentTime.getHours())==parseInt(n)&&(r.step>59||Math[r.roundTime](v.currentTime.getMinutes()/r.step)*r.step==parseInt(t))&&(r.defaultSelect||i.data("changed")?f.push("xdsoft_current"):r.initTime&&f.push("xdsoft_init_time"));parseInt(w.getHours())==parseInt(n)&&parseInt(w.getMinutes())==parseInt(t)&&f.push("xdsoft_today");k+='<div class="xdsoft_time '+f.join(" ")+'" data-hour="'+n+'" data-minute="'+t+'">'+u.dateFormat(r.formatTime)+"<\/div>"};if(r.allowTimes&&n.isArray(r.allowTimes)&&r.allowTimes.length)for(t=0;t<r.allowTimes.length;t++)p=v.strtotime(r.allowTimes[t]).getHours(),c=v.strtotime(r.allowTimes[t]).getMinutes(),d(p,c);else for(t=0,e=0;t<(r.hours12?12:24);t++)for(e=0;e<60;e+=r.step)p=(t<10?"0":"")+t,c=(e<10?"0":"")+e,d(p,c);for(y.html(k),l="",t=0,t=parseInt(r.yearStart,10)+r.yearOffset;t<=parseInt(r.yearEnd,10)+r.yearOffset;t++)l+='<div class="xdsoft_option '+(v.currentTime.getFullYear()==t?"xdsoft_current":"")+'" data-value="'+t+'">'+t+"<\/div>";for(wt.children().eq(0).html(l),t=0,l="";t<=11;t++)l+='<div class="xdsoft_option '+(v.currentTime.getMonth()==t?"xdsoft_current":"")+'" data-value="'+t+'">'+r.i18n[r.lang].months[t]+"<\/div>";pt.children().eq(0).html(l);n(this).trigger("generate.xdsoft")},10);t.stopPropagation()}).on("afterOpen.xdsoft",function(){var n;if(r.timepicker&&(y.find(".xdsoft_current").length?n=".xdsoft_current":y.find(".xdsoft_init_time").length&&(n=".xdsoft_init_time"),n)){var i=ot[0].clientHeight,u=y[0].offsetHeight,t=y.find(n).index()*r.timeHeightInTimePicker+1;u-i<t&&(t=u-i);y.css("marginTop","-"+parseInt(t)+"px");ot.trigger("scroll_element.xdsoft_scroller",[parseInt(t)/(u-i)])}});at=0;yt.on("click.xdsoft","td",function(u){u.stopPropagation();at++;var f=n(this),e=v.currentTime;if(f.hasClass("xdsoft_disabled"))return!1;e.setDate(f.data("date"));e.setMonth(f.data("month"));e.setFullYear(f.data("year"));i.trigger("select.xdsoft",[e]);t.val(v.str());(at>1||r.closeOnDateSelect===!0||r.closeOnDateSelect===0&&!r.timepicker)&&!r.inline&&i.trigger("close.xdsoft");r.onSelectDate&&r.onSelectDate.call&&r.onSelectDate.call(i,v.currentTime,i.data("input"));i.data("changed",!0);i.trigger("xchange.xdsoft");i.trigger("changedatetime.xdsoft");setTimeout(function(){at=0},200)});y.on("click.xdsoft","div",function(t){t.stopPropagation();var u=n(this),f=v.currentTime;if(u.hasClass("xdsoft_disabled"))return!1;f.setHours(u.data("hour"));f.setMinutes(u.data("minute"));i.trigger("select.xdsoft",[f]);i.data("input").val(v.str());r.inline||i.trigger("close.xdsoft");r.onSelectTime&&r.onSelectTime.call&&r.onSelectTime.call(i,v.currentTime,i.data("input"));i.data("changed",!0);i.trigger("xchange.xdsoft");i.trigger("changedatetime.xdsoft")});i.mousewheel&&ht.mousewheel(function(n,t){return r.scrollMonth?(t<0?v.nextMonth():v.prevMonth(),!1):!0});i.mousewheel&&ot.unmousewheel().mousewheel(function(n,t){if(!r.scrollTime)return!0;var f=ot[0].clientHeight,e=y[0].offsetHeight,i=Math.abs(parseInt(y.css("marginTop"))),u=!0;return t<0&&e-f-r.timeHeightInTimePicker>=i?(y.css("marginTop","-"+(i+r.timeHeightInTimePicker)+"px"),u=!1):t>0&&i-r.timeHeightInTimePicker>=0&&(y.css("marginTop","-"+(i-r.timeHeightInTimePicker)+"px"),u=!1),ot.trigger("scroll_element.xdsoft_scroller",[Math.abs(parseInt(y.css("marginTop"))/(e-f))]),n.stopPropagation(),u});i.on("changedatetime.xdsoft",function(){if(r.onChangeDateTime&&r.onChangeDateTime.call){var n=i.data("input");r.onChangeDateTime.call(i,v.currentTime,n);n.trigger("change")}}).on("generate.xdsoft",function(){r.onGenerate&&r.onGenerate.call&&r.onGenerate.call(i,v.currentTime,i.data("input"))});st=0;t.mousewheel&&t.mousewheel(function(n,u,f,e){return r.scrollInput?!r.datepicker&&r.timepicker?(st=y.find(".xdsoft_current").length?y.find(".xdsoft_current").eq(0).index():0,st+u>=0&&st+u<y.children().length&&(st+=u),y.children().eq(st).length&&y.children().eq(st).trigger("mousedown"),!1):r.datepicker&&!r.timepicker?(ht.trigger(n,[u,f,e]),t.val&&t.val(v.str()),i.trigger("changedatetime.xdsoft"),!1):void 0:!0});vt=function(){var r=i.data("input").offset(),t=r.top+i.data("input")[0].offsetHeight-1,u=r.left;t+i[0].offsetHeight>n(window).height()+n(window).scrollTop()&&(t=r.top-i[0].offsetHeight+1);t<0&&(t=0);u+i[0].offsetWidth>n(window).width()&&(u=r.left-i[0].offsetWidth+i.data("input")[0].offsetWidth);i.css({left:u,top:t})};i.on("open.xdsoft",function(){var t=!0;if(r.onShow&&r.onShow.call&&(t=r.onShow.call(i,v.currentTime,i.data("input"))),t!==!1){i.show();i.trigger("afterOpen.xdsoft");vt();n(window).off("resize.xdsoft",vt).on("resize.xdsoft",vt);if(r.closeOnWithoutClick)n([document.body,window]).on("mousedown.xdsoft",function u(){i.trigger("close.xdsoft");n([document.body,window]).off("mousedown.xdsoft",u)})}}).on("close.xdsoft",function(n){var t=!0;r.onClose&&r.onClose.call&&(t=r.onClose.call(i,v.currentTime,i.data("input")));t===!1||r.opened||r.inline||i.hide();n.stopPropagation()}).data("input",t);kt=0;ti=0;i.data("xdsoft_datetime",v);i.setOptions(r);v.setCurrentTime(dt());i.trigger("afterOpen.xdsoft");t.data("xdsoft_datetimepicker",i).on("open.xdsoft focusin.xdsoft mousedown.xdsoft",function(){t.is(":disabled")||t.is(":hidden")||!t.is(":visible")||(clearTimeout(kt),kt=setTimeout(function(){t.is(":disabled")||t.is(":hidden")||!t.is(":visible")||(v.setCurrentTime(dt()),i.trigger("open.xdsoft"))},100))}).on("keydown.xdsoft",function(t){var f=this.value,u=t.which,r;switch(!0){case!!~[l].indexOf(u):return r=n("input:visible,textarea:visible"),i.trigger("close.xdsoft"),r.eq(r.index(this)+1).focus(),!1;case!!~[a].indexOf(u):return i.trigger("close.xdsoft"),!0}})},ot=function(t){var i=t.data("xdsoft_datetimepicker");i&&(i.data("xdsoft_datetime",null),i.remove(),t.data("xdsoft_datetimepicker",null).off("open.xdsoft focusin.xdsoft focusout.xdsoft mousedown.xdsoft blur.xdsoft keydown.xdsoft"),n(window).off("resize.xdsoft"),n([window,document.body]).off("mousedown.xdsoft"),t.unmousewheel&&t.unmousewheel())};n(document).off("keydown.xdsoftctrl keyup.xdsoftctrl").on("keydown.xdsoftctrl",function(n){n.keyCode==e&&(o=!0)}).on("keyup.xdsoftctrl",function(n){n.keyCode==e&&(o=!1)});return this.each(function(){var t;if(t=n(this).data("xdsoft_datetimepicker")){if(n.type(i)==="string")switch(i){case"show":n(this).select().focus();t.trigger("open.xdsoft");break;case"hide":t.trigger("close.xdsoft");break;case"destroy":ot(n(this));break;case"reset":this.value=this.defaultValue;this.value&&t.data("xdsoft_datetime").isValidDate(Date.parseDate(this.value,r.format))||t.data("changed",!1);t.data("xdsoft_datetime").setCurrentTime(this.value)}else t.setOptions(i);return 0}n.type(i)!=="string"&&(!r.lazyInit||r.open||r.inline?y(n(this)):et(n(this)))})}}(jQuery);Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(n){if(n=="unixtime")return parseInt(this.getTime()/1e3);Date.formatFunctions[n]==null&&Date.createNewFormat(n);var t=Date.formatFunctions[n];return this[t]()};Date.createNewFormat=function(a){var b="format"+Date.formatFunctions.count++,i;Date.formatFunctions[a]=b;var c="Date.prototype."+b+" = function() {return ",d=!1,e="";for(i=0;i<a.length;++i)e=a.charAt(i),d||e!="\\"?d?(d=!1,c+="'"+String.escape(e)+"' + "):c+=Date.getFormatCode(e):d=!0;eval(c.substring(0,c.length-3)+";}")};Date.getFormatCode=function(n){switch(n){case"d":return"String.leftPad(this.getDate(), 2, '0') + ";case"D":return"Date.dayNames[this.getDay()].substring(0, 3) + ";case"j":return"this.getDate() + ";case"l":return"Date.dayNames[this.getDay()] + ";case"S":return"this.getSuffix() + ";case"w":return"this.getDay() + ";case"z":return"this.getDayOfYear() + ";case"W":return"this.getWeekOfYear() + ";case"F":return"Date.monthNames[this.getMonth()] + ";case"m":return"String.leftPad(this.getMonth() + 1, 2, '0') + ";case"M":return"Date.monthNames[this.getMonth()].substring(0, 3) + ";case"n":return"(this.getMonth() + 1) + ";case"t":return"this.getDaysInMonth() + ";case"L":return"(this.isLeapYear() ? 1 : 0) + ";case"Y":return"this.getFullYear() + ";case"y":return"('' + this.getFullYear()).substring(2, 4) + ";case"a":return"(this.getHours() < 12 ? 'am' : 'pm') + ";case"A":return"(this.getHours() < 12 ? 'AM' : 'PM') + ";case"g":return"((this.getHours() %12) ? this.getHours() % 12 : 12) + ";case"G":return"this.getHours() + ";case"h":return"String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + ";case"H":return"String.leftPad(this.getHours(), 2, '0') + ";case"i":return"String.leftPad(this.getMinutes(), 2, '0') + ";case"s":return"String.leftPad(this.getSeconds(), 2, '0') + ";case"O":return"this.getGMTOffset() + ";case"T":return"this.getTimezone() + ";case"Z":return"(this.getTimezoneOffset() * -60) + ";default:return"'"+String.escape(n)+"' + "}};Date.parseDate=function(n,t){if(t=="unixtime")return new Date(isNaN(parseInt(n))?0:parseInt(n)*1e3);Date.parseFunctions[t]==null&&Date.createParser(t);var i=Date.parseFunctions[t];return Date[i](n)};Date.createParser=function(a){var b="parse"+Date.parseFunctions.count++,c=Date.parseRegexes.length,d=1,i;Date.parseFunctions[a]=b;var e="Date."+b+" = function(input) {\nvar y = -1, m = -1, d = -1, h = -1, i = -1, s = -1;\nvar d = new Date();\ny = d.getFullYear();\nm = d.getMonth();\nd = d.getDate();\nvar results = input.match(Date.parseRegexes["+c+"]);\nif (results && results.length > 0) {",f="",g=!1,h="";for(i=0;i<a.length;++i)h=a.charAt(i),g||h!="\\"?g?(g=!1,f+=String.escape(h)):(obj=Date.formatCodeToRegex(h,d),d+=obj.g,f+=obj.s,obj.g&&obj.c&&(e+=obj.c)):g=!0;e+="if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n{return new Date(y, m, d, h, i, s);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n{return new Date(y, m, d, h, i);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0)\n{return new Date(y, m, d, h);}\nelse if (y > 0 && m >= 0 && d > 0)\n{return new Date(y, m, d);}\nelse if (y > 0 && m >= 0)\n{return new Date(y, m);}\nelse if (y > 0)\n{return new Date(y);}\n}return null;}";Date.parseRegexes[c]=new RegExp("^"+f+"$");eval(e)};Date.formatCodeToRegex=function(n,t){switch(n){case"D":return{g:0,c:null,s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case"j":case"d":return{g:1,c:"d = parseInt(results["+t+"], 10);\n",s:"(\\d{1,2})"};case"l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case"S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};case"w":return{g:0,c:null,s:"\\d"};case"z":return{g:0,c:null,s:"(?:\\d{1,3})"};case"W":return{g:0,c:null,s:"(?:\\d{2})"};case"F":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+t+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+t+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case"n":case"m":return{g:1,c:"m = parseInt(results["+t+"], 10) - 1;\n",s:"(\\d{1,2})"};case"t":return{g:0,c:null,s:"\\d{1,2}"};case"L":return{g:0,c:null,s:"(?:1|0)"};case"Y":return{g:1,c:"y = parseInt(results["+t+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+t+"], 10);\ny = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+t+"] == 'am') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+t+"] == 'AM') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};case"g":case"G":case"h":case"H":return{g:1,c:"h = parseInt(results["+t+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+t+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+t+"], 10);\n",s:"(\\d{2})"};case"O":return{g:0,c:null,s:"[+-]\\d{4}"};case"T":return{g:0,c:null,s:"[A-Z]{3}"};case"Z":return{g:0,c:null,s:"[+-]\\d{1,5}"};default:return{g:0,c:null,s:String.escape(n)}}};Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3")};Date.prototype.getGMTOffset=function(){return(this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset())/60),2,"0")+String.leftPad(Math.abs(this.getTimezoneOffset())%60,2,"0")};Date.prototype.getDayOfYear=function(){var t=0,n;for(Date.daysInMonth[1]=this.isLeapYear()?29:28,n=0;n<this.getMonth();++n)t+=Date.daysInMonth[n];return t+this.getDate()};Date.prototype.getWeekOfYear=function(){var n=this.getDayOfYear()+(4-this.getDay()),t=new Date(this.getFullYear(),0,1),i=11-t.getDay();return String.leftPad(Math.ceil((n-i)/7)+1,2,"0")};Date.prototype.isLeapYear=function(){var n=this.getFullYear();return(n&3)==0&&(n%100||n%400==0&&n)};Date.prototype.getFirstDayOfMonth=function(){var n=(this.getDay()-(this.getDate()-1))%7;return n<0?n+7:n};Date.prototype.getLastDayOfMonth=function(){var n=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return n<0?n+7:n};Date.prototype.getDaysInMonth=function(){return Date.daysInMonth[1]=this.isLeapYear()?29:28,Date.daysInMonth[this.getMonth()]};Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}};String.escape=function(n){return n.replace(/('|\\)/g,"\\$1")};String.leftPad=function(n,t,i){var r=new String(n);for(i==null&&(i=" ");r.length<t;)r=i+r;return r};Date.daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.y2kYear=50;Date.monthNumbers={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11};Date.patterns={ISO8601LongPattern:"Y-m-d H:i:s",ISO8601ShortPattern:"Y-m-d",ShortDatePattern:"n/j/Y",LongDatePattern:"l, F d, Y",FullDateTimePattern:"l, F d, Y g:i:s A",MonthDayPattern:"F d",ShortTimePattern:"g:i A",LongTimePattern:"g:i:s A",SortableDateTimePattern:"Y-m-d\\TH:i:s",UniversalSortableDateTimePattern:"Y-m-d H:i:sO",YearMonthPattern:"F, Y"},function(n){typeof define=="function"&&define.amd?define(["jquery"],n):typeof exports=="object"?module.exports=n:n(jQuery)}(function(n){function f(i){var u=i||window.event,l=[].slice.call(arguments,1),f=0,e=0,o=0,h=0,c=0,s;return i=n.event.fix(u),i.type="mousewheel",u.wheelDelta&&(f=u.wheelDelta),u.detail&&(f=u.detail*-1),u.deltaY&&(o=u.deltaY*-1,f=o),u.deltaX&&(e=u.deltaX,f=e*-1),u.wheelDeltaY!==undefined&&(o=u.wheelDeltaY),u.wheelDeltaX!==undefined&&(e=u.wheelDeltaX*-1),h=Math.abs(f),(!r||h<r)&&(r=h),c=Math.max(Math.abs(o),Math.abs(e)),(!t||c<t)&&(t=c),s=f>0?"floor":"ceil",f=Math[s](f/r),e=Math[s](e/t),o=Math[s](o/t),l.unshift(i,f,e,o),(n.event.dispatch||n.event.handle).apply(this,l)}var e=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],i="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],r,t,u;if(n.event.fixHooks)for(u=e.length;u;)n.event.fixHooks[e[--u]]=n.event.mouseHooks;n.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var n=i.length;n;)this.addEventListener(i[--n],f,!1);else this.onmousewheel=f},teardown:function(){if(this.removeEventListener)for(var n=i.length;n;)this.removeEventListener(i[--n],f,!1);else this.onmousewheel=null}};n.fn.extend({mousewheel:function(n){return n?this.bind("mousewheel",n):this.trigger("mousewheel")},unmousewheel:function(n){return this.unbind("mousewheel",n)}})});!function(n,t){"function"==typeof define&&define.amd?define("typeahead.js",["jquery"],function(n){return t(n)}):"object"==typeof exports?module.exports=t(require("jquery")):t(jQuery)}(this,function(n){var t=function(){"use strict";return{isMsie:function(){return/(msie|trident)/i.test(navigator.userAgent)?navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]:!1},isBlankString:function(n){return!n||/^\s*$/.test(n)},escapeRegExChars:function(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(n){return"string"==typeof n},isNumber:function(n){return"number"==typeof n},isArray:n.isArray,isFunction:n.isFunction,isObject:n.isPlainObject,isUndefined:function(n){return"undefined"==typeof n},isElement:function(n){return!(!n||1!==n.nodeType)},isJQuery:function(t){return t instanceof n},toStr:function(n){return t.isUndefined(n)||null===n?"":n+""},bind:n.proxy,each:function(t,i){function r(n,t){return i(t,n)}n.each(t,r)},map:n.map,filter:n.grep,every:function(t,i){var r=!0;return t?(n.each(t,function(n,u){if(!(r=i.call(null,u,n,t)))return!1}),!!r):r},some:function(t,i){var r=!1;return t?(n.each(t,function(n,u){if((r=i.call(null,u,n,t)))return!1}),!!r):r},mixin:n.extend,identity:function(n){return n},clone:function(t){return n.extend(!0,{},t)},getIdGenerator:function(){var n=0;return function(){return n++}},templatify:function(t){function i(){return String(t)}return n.isFunction(t)?t:i},defer:function(n){setTimeout(n,0)},debounce:function(n,t,i){var r,u;return function(){var f,e,o=this,s=arguments;return f=function(){r=null;i||(u=n.apply(o,s))},e=i&&!r,clearTimeout(r),r=setTimeout(f,t),e&&(u=n.apply(o,s)),u}},throttle:function(n,t){var u,f,i,e,r,o;return r=0,o=function(){r=new Date;i=null;e=n.apply(u,f)},function(){var s=new Date,h=t-(s-r);return u=this,f=arguments,0>=h?(clearTimeout(i),i=null,r=s,e=n.apply(u,f)):i||(i=setTimeout(o,h)),e}},stringify:function(n){return t.isString(n)?n:JSON.stringify(n)},noop:function(){}}}(),e=function(){"use strict";function n(n){var e,o;return o=t.mixin({},f,n),e={css:u(),classes:o,html:i(o),selectors:r(o)},{css:e.css,html:e.html,classes:e.classes,selectors:e.selectors,mixin:function(n){t.mixin(n,e)}}}function i(n){return{wrapper:'<span class="'+n.wrapper+'"><\/span>',menu:'<div class="'+n.menu+'"><\/div>'}}function r(n){var i={};return t.each(n,function(n,t){i[t]="."+n}),i}function u(){var n={wrapper:{position:"relative",display:"inline-block"},hint:{position:"absolute",top:"0",left:"0",borderColor:"transparent",boxShadow:"none",opacity:"1"},input:{position:"relative",verticalAlign:"top",backgroundColor:"transparent"},inputWithNoHint:{position:"relative",verticalAlign:"top"},menu:{position:"absolute",top:"100%",left:"0",zIndex:"100",display:"none"},ltr:{left:"0",right:"auto"},rtl:{left:"auto",right:" 0"}};return t.isMsie()&&t.mixin(n.input,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"}),n}var f={wrapper:"twitter-typeahead",input:"tt-input",hint:"tt-hint",menu:"tt-menu",dataset:"tt-dataset",suggestion:"tt-suggestion",selectable:"tt-selectable",empty:"tt-empty",open:"tt-open",cursor:"tt-cursor",highlight:"tt-highlight"};return n}(),o=function(){"use strict";function i(t){t&&t.el||n.error("EventBus initialized without el");this.$el=n(t.el)}var r,u;return r="typeahead:",u={render:"rendered",cursorchange:"cursorchanged",select:"selected",autocomplete:"autocompleted"},t.mixin(i.prototype,{_trigger:function(t,i){var u;return u=n.Event(r+t),(i=i||[]).unshift(u),this.$el.trigger.apply(this.$el,i),u},before:function(n){var t,i;return t=[].slice.call(arguments,1),i=this._trigger("before"+n,t),i.isDefaultPrevented()},trigger:function(n){var t;this._trigger(n,[].slice.call(arguments,1));(t=u[n])&&this._trigger(t,[].slice.call(arguments,1))}}),i}(),r=function(){"use strict";function t(t,i,r,u){var f;if(!r)return this;for(i=i.split(n),r=u?s(r,u):r,this._callbacks=this._callbacks||{};f=i.shift();)this._callbacks[f]=this._callbacks[f]||{sync:[],async:[]},this._callbacks[f][t].push(r);return this}function r(n,i,r){return t.call(this,"async",n,i,r)}function u(n,i,r){return t.call(this,"sync",n,i,r)}function f(t){var i;if(!this._callbacks)return this;for(t=t.split(n);i=t.shift();)delete this._callbacks[i];return this}function e(t){var r,u,f,e,o;if(!this._callbacks)return this;for(t=t.split(n),f=[].slice.call(arguments,1);(r=t.shift())&&(u=this._callbacks[r]);)e=i(u.sync,this,[r].concat(f)),o=i(u.async,this,[r].concat(f)),e()&&h(o);return this}function i(n,t,i){function r(){for(var r,u=0,f=n.length;!r&&f>u;u+=1)r=n[u].apply(t,i)===!1;return!r}return r}function o(){return window.setImmediate?function(n){setImmediate(function(){n()})}:function(n){setTimeout(function(){n()},0)}}function s(n,t){return n.bind?n.bind(t):function(){n.apply(t,[].slice.call(arguments,0))}}var n=/\s+/,h=o();return{onSync:u,onAsync:r,off:f,trigger:e}}(),s=function(n){"use strict";function i(n,i,r){for(var u,f=[],e=0,o=n.length;o>e;e++)f.push(t.escapeRegExChars(n[e]));return u=r?"\\b("+f.join("|")+")\\b":"("+f.join("|")+")",i?new RegExp(u):new RegExp(u,"i")}var r={node:null,pattern:null,tagName:"strong",className:null,wordsOnly:!1,caseSensitive:!1};return function(u){function o(t){var i,r,f;return(i=e.exec(t.data))&&(f=n.createElement(u.tagName),u.className&&(f.className=u.className),r=t.splitText(i.index),r.splitText(i[0].length),f.appendChild(r.cloneNode(!0)),t.parentNode.replaceChild(f,r)),!!i}function f(n,t){for(var i,r=0;r<n.childNodes.length;r++)i=n.childNodes[r],i.nodeType===3?r+=t(i)?1:0:f(i,t)}var e;u=t.mixin({},r,u);u.node&&u.pattern&&(u.pattern=t.isArray(u.pattern)?u.pattern:[u.pattern],e=i(u.pattern,u.caseSensitive,u.wordsOnly),f(u.node,o))}}(window.document),u=function(){"use strict";function i(i,r){i=i||{};i.input||n.error("input is missing");r.mixin(this);this.$hint=n(i.hint);this.$input=n(i.input);this.query=this.$input.val();this.queryWhenFocused=this.hasFocus()?this.query:null;this.$overflowHelper=e(this.$input);this._checkLanguageDirection();0===this.$hint.length&&(this.setHint=this.getHint=this.clearHint=this.clearHintIfInvalid=t.noop)}function e(t){return n('<pre aria-hidden="true"><\/pre>').css({position:"absolute",visibility:"hidden",whiteSpace:"pre",fontFamily:t.css("font-family"),fontSize:t.css("font-size"),fontStyle:t.css("font-style"),fontVariant:t.css("font-variant"),fontWeight:t.css("font-weight"),wordSpacing:t.css("word-spacing"),letterSpacing:t.css("letter-spacing"),textIndent:t.css("text-indent"),textRendering:t.css("text-rendering"),textTransform:t.css("text-transform")}).insertAfter(t)}function o(n,t){return i.normalizeQuery(n)===i.normalizeQuery(t)}function f(n){return n.altKey||n.ctrlKey||n.metaKey||n.shiftKey}var u;return u={9:"tab",27:"esc",37:"left",39:"right",13:"enter",38:"up",40:"down"},i.normalizeQuery=function(n){return t.toStr(n).replace(/^\s*/g,"").replace(/\s{2,}/g," ")},t.mixin(i.prototype,r,{_onBlur:function(){this.resetInputValue();this.trigger("blurred")},_onFocus:function(){this.queryWhenFocused=this.query;this.trigger("focused")},_onKeydown:function(n){var t=u[n.which||n.keyCode];this._managePreventDefault(t,n);t&&this._shouldTrigger(t,n)&&this.trigger(t+"Keyed",n)},_onInput:function(){this._setQuery(this.getInputValue());this.clearHintIfInvalid();this._checkLanguageDirection()},_managePreventDefault:function(n,t){var i;switch(n){case"up":case"down":i=!f(t);break;default:i=!1}i&&t.preventDefault()},_shouldTrigger:function(n,t){var i;switch(n){case"tab":i=!f(t);break;default:i=!0}return i},_checkLanguageDirection:function(){var n=(this.$input.css("direction")||"ltr").toLowerCase();this.dir!==n&&(this.dir=n,this.$hint.attr("dir",n),this.trigger("langDirChanged",n))},_setQuery:function(n,t){var i,r;i=o(n,this.query);r=i?this.query.length!==n.length:!1;this.query=n;t||i?!t&&r&&this.trigger("whitespaceChanged",this.query):this.trigger("queryChanged",this.query)},bind:function(){var n,i,r,f,e=this;return n=t.bind(this._onBlur,this),i=t.bind(this._onFocus,this),r=t.bind(this._onKeydown,this),f=t.bind(this._onInput,this),this.$input.on("blur.tt",n).on("focus.tt",i).on("keydown.tt",r),!t.isMsie()||t.isMsie()>9?this.$input.on("input.tt",f):this.$input.on("keydown.tt keypress.tt cut.tt paste.tt",function(n){u[n.which||n.keyCode]||t.defer(t.bind(e._onInput,e,n))}),this},focus:function(){this.$input.focus()},blur:function(){this.$input.blur()},getLangDir:function(){return this.dir},getQuery:function(){return this.query||""},setQuery:function(n,t){this.setInputValue(n);this._setQuery(n,t)},hasQueryChangedSinceLastFocus:function(){return this.query!==this.queryWhenFocused},getInputValue:function(){return this.$input.val()},setInputValue:function(n){this.$input.val(n);this.clearHintIfInvalid();this._checkLanguageDirection()},resetInputValue:function(){this.setInputValue(this.query)},getHint:function(){return this.$hint.val()},setHint:function(n){this.$hint.val(n)},clearHint:function(){this.setHint("")},clearHintIfInvalid:function(){var n,t,i,r;n=this.getInputValue();t=this.getHint();i=n!==t&&0===t.indexOf(n);r=""!==n&&i&&!this.hasOverflow();!r&&this.clearHint()},hasFocus:function(){return this.$input.is(":focus")},hasOverflow:function(){var n=this.$input.width()-2;return this.$overflowHelper.text(this.getInputValue()),this.$overflowHelper.width()>=n},isCursorAtEnd:function(){var n,i,r;return n=this.$input.val().length,i=this.$input[0].selectionStart,t.isNumber(i)?i===n:document.selection?(r=document.selection.createRange(),r.moveStart("character",-n),n===r.text.length):!0},destroy:function(){this.$hint.off(".tt");this.$input.off(".tt");this.$overflowHelper.remove();this.$hint=this.$input=this.$overflowHelper=n("<div>")}}),i}(),f=function(){"use strict";function u(i,r){i=i||{};i.templates=i.templates||{};i.templates.notFound=i.templates.notFound||i.templates.empty;i.source||n.error("missing source");i.node||n.error("missing node");i.name&&!h(i.name)&&n.error("invalid dataset name: "+i.name);r.mixin(this);this.highlight=!!i.highlight;this.name=i.name||f();this.limit=i.limit||5;this.displayFn=e(i.display||i.displayKey);this.templates=o(i.templates,this.displayFn);this.source=i.source.__ttAdapter?i.source.__ttAdapter():i.source;this.async=t.isUndefined(i.async)?this.source.length>2:!!i.async;this._resetLastSuggestion();this.$el=n(i.node).addClass(this.classes.dataset).addClass(this.classes.dataset+"-"+this.name)}function e(n){function i(t){return t[n]}return n=n||t.stringify,t.isFunction(n)?n:i}function o(i,r){function u(t){return n("<div>").text(r(t))}return{notFound:i.notFound&&t.templatify(i.notFound),pending:i.pending&&t.templatify(i.pending),header:i.header&&t.templatify(i.header),footer:i.footer&&t.templatify(i.footer),suggestion:i.suggestion||u}}function h(n){return/^[_a-zA-Z0-9-]+$/.test(n)}var i,f;return i={val:"tt-selectable-display",obj:"tt-selectable-object"},f=t.getIdGenerator(),u.extractData=function(t){var r=n(t);return r.data(i.obj)?{val:r.data(i.val)||"",obj:r.data(i.obj)||null}:null},t.mixin(u.prototype,r,{_overwrite:function(n,t){t=t||[];t.length?this._renderSuggestions(n,t):this.async&&this.templates.pending?this._renderPending(n):!this.async&&this.templates.notFound?this._renderNotFound(n):this._empty();this.trigger("rendered",this.name,t,!1)},_append:function(n,t){t=t||[];t.length&&this.$lastSuggestion.length?this._appendSuggestions(n,t):t.length?this._renderSuggestions(n,t):!this.$lastSuggestion.length&&this.templates.notFound&&this._renderNotFound(n);this.trigger("rendered",this.name,t,!0)},_renderSuggestions:function(n,t){var i;i=this._getSuggestionsFragment(n,t);this.$lastSuggestion=i.children().last();this.$el.html(i).prepend(this._getHeader(n,t)).append(this._getFooter(n,t))},_appendSuggestions:function(n,t){var i,r;i=this._getSuggestionsFragment(n,t);r=i.children().last();this.$lastSuggestion.after(i);this.$lastSuggestion=r},_renderPending:function(n){var t=this.templates.pending;this._resetLastSuggestion();t&&this.$el.html(t({query:n,dataset:this.name}))},_renderNotFound:function(n){var t=this.templates.notFound;this._resetLastSuggestion();t&&this.$el.html(t({query:n,dataset:this.name}))},_empty:function(){this.$el.empty();this._resetLastSuggestion()},_getSuggestionsFragment:function(r,u){var e,f=this;return e=document.createDocumentFragment(),t.each(u,function(t){var u,o;o=f._injectQuery(r,t);u=n(f.templates.suggestion(o)).data(i.obj,t).data(i.val,f.displayFn(t)).addClass(f.classes.suggestion+" "+f.classes.selectable);e.appendChild(u[0])}),this.highlight&&s({className:this.classes.highlight,node:e,pattern:r}),n(e)},_getFooter:function(n,t){return this.templates.footer?this.templates.footer({query:n,suggestions:t,dataset:this.name}):null},_getHeader:function(n,t){return this.templates.header?this.templates.header({query:n,suggestions:t,dataset:this.name}):null},_resetLastSuggestion:function(){this.$lastSuggestion=n()},_injectQuery:function(n,i){return t.isObject(i)?t.mixin({_query:n},i):i},update:function(t){function f(n){u||(u=!0,n=(n||[]).slice(0,i.limit),r=n.length,i._overwrite(t,n),r<i.limit&&i.async&&i.trigger("asyncRequested",t))}function o(u){u=u||[];!e&&r<i.limit&&(i.cancel=n.noop,r+=u.length,i._append(t,u.slice(0,i.limit-r)),i.async&&i.trigger("asyncReceived",t))}var i=this,e=!1,u=!1,r=0;this.cancel();this.cancel=function(){e=!0;i.cancel=n.noop;i.async&&i.trigger("asyncCanceled",t)};this.source(t,f,o);!u&&f([])},cancel:n.noop,clear:function(){this._empty();this.cancel();this.trigger("cleared")},isEmpty:function(){return this.$el.is(":empty")},destroy:function(){this.$el=n("<div>")}}),u}(),i=function(){"use strict";function i(i,r){function e(t){var i=u.$node.find(t.node).first();return t.node=i.length?i:n("<div>").appendTo(u.$node),new f(t,r)}var u=this;i=i||{};i.node||n.error("node is required");r.mixin(this);this.$node=n(i.node);this.query=null;this.datasets=t.map(i.datasets,e)}return t.mixin(i.prototype,r,{_onSelectableClick:function(t){this.trigger("selectableClicked",n(t.currentTarget))},_onRendered:function(n,t,i,r){this.$node.toggleClass(this.classes.empty,this._allDatasetsEmpty());this.trigger("datasetRendered",t,i,r)},_onCleared:function(){this.$node.toggleClass(this.classes.empty,this._allDatasetsEmpty());this.trigger("datasetCleared")},_propagate:function(){this.trigger.apply(this,arguments)},_allDatasetsEmpty:function(){function n(n){return n.isEmpty()}return t.every(this.datasets,n)},_getSelectables:function(){return this.$node.find(this.selectors.selectable)},_removeCursor:function(){var n=this.getActiveSelectable();n&&n.removeClass(this.classes.cursor)},_ensureVisible:function(n){var t,i,r,u;t=n.position().top;i=t+n.outerHeight(!0);r=this.$node.scrollTop();u=this.$node.height()+parseInt(this.$node.css("paddingTop"),10)+parseInt(this.$node.css("paddingBottom"),10);0>t?this.$node.scrollTop(r+t):i>u&&this.$node.scrollTop(r+(i-u))},bind:function(){var i,n=this;return i=t.bind(this._onSelectableClick,this),this.$node.on("click.tt",this.selectors.selectable,i),t.each(this.datasets,function(t){t.onSync("asyncRequested",n._propagate,n).onSync("asyncCanceled",n._propagate,n).onSync("asyncReceived",n._propagate,n).onSync("rendered",n._onRendered,n).onSync("cleared",n._onCleared,n)}),this},isOpen:function(){return this.$node.hasClass(this.classes.open)},open:function(){this.$node.addClass(this.classes.open)},close:function(){this.$node.removeClass(this.classes.open);this._removeCursor()},setLanguageDirection:function(n){this.$node.attr("dir",n)},selectableRelativeToCursor:function(n){var i,r,u,t;return r=this.getActiveSelectable(),i=this._getSelectables(),u=r?i.index(r):-1,t=u+n,t=(t+1)%(i.length+1)-1,t=-1>t?i.length-1:t,-1===t?null:i.eq(t)},setCursor:function(n){this._removeCursor();(n=n&&n.first())&&(n.addClass(this.classes.cursor),this._ensureVisible(n))},getSelectableData:function(n){return n&&n.length?f.extractData(n):null},getActiveSelectable:function(){var n=this._getSelectables().filter(this.selectors.cursor).first();return n.length?n:null},getTopSelectable:function(){var n=this._getSelectables().first();return n.length?n:null},update:function(n){function r(t){t.update(n)}var i=n!==this.query;return i&&(this.query=n,t.each(this.datasets,r)),i},empty:function(){function n(n){n.clear()}t.each(this.datasets,n);this.query=null;this.$node.addClass(this.classes.empty)},destroy:function(){function i(n){n.destroy()}this.$node.off(".tt");this.$node=n("<div>");t.each(this.datasets,i)}}),i}(),h=function(){"use strict";function r(){i.apply(this,[].slice.call(arguments,0))}var n=i.prototype;return t.mixin(r.prototype,i.prototype,{open:function(){return!this._allDatasetsEmpty()&&this._show(),n.open.apply(this,[].slice.call(arguments,0))},close:function(){return this._hide(),n.close.apply(this,[].slice.call(arguments,0))},_onRendered:function(){return this._allDatasetsEmpty()?this._hide():this.isOpen()&&this._show(),n._onRendered.apply(this,[].slice.call(arguments,0))},_onCleared:function(){return this._allDatasetsEmpty()?this._hide():this.isOpen()&&this._show(),n._onCleared.apply(this,[].slice.call(arguments,0))},setLanguageDirection:function(t){return this.$node.css("ltr"===t?this.css.ltr:this.css.rtl),n.setLanguageDirection.apply(this,[].slice.call(arguments,0))},_hide:function(){this.$node.hide()},_show:function(){this.$node.css("display","block")}}),r}(),c=function(){"use strict";function r(r,u){var f,e,o,s,h,c,l,a,v,y,p;r=r||{};r.input||n.error("missing input");r.menu||n.error("missing menu");r.eventBus||n.error("missing event bus");u.mixin(this);this.eventBus=r.eventBus;this.minLength=t.isNumber(r.minLength)?r.minLength:1;this.input=r.input;this.menu=r.menu;this.enabled=!0;this.active=!1;this.input.hasFocus()&&this.activate();this.dir=this.input.getLangDir();this._hacks();this.menu.bind().onSync("selectableClicked",this._onSelectableClicked,this).onSync("asyncRequested",this._onAsyncRequested,this).onSync("asyncCanceled",this._onAsyncCanceled,this).onSync("asyncReceived",this._onAsyncReceived,this).onSync("datasetRendered",this._onDatasetRendered,this).onSync("datasetCleared",this._onDatasetCleared,this);f=i(this,"activate","open","_onFocused");e=i(this,"deactivate","_onBlurred");o=i(this,"isActive","isOpen","_onEnterKeyed");s=i(this,"isActive","isOpen","_onTabKeyed");h=i(this,"isActive","_onEscKeyed");c=i(this,"isActive","open","_onUpKeyed");l=i(this,"isActive","open","_onDownKeyed");a=i(this,"isActive","isOpen","_onLeftKeyed");v=i(this,"isActive","isOpen","_onRightKeyed");y=i(this,"_openIfActive","_onQueryChanged");p=i(this,"_openIfActive","_onWhitespaceChanged");this.input.bind().onSync("focused",f,this).onSync("blurred",e,this).onSync("enterKeyed",o,this).onSync("tabKeyed",s,this).onSync("escKeyed",h,this).onSync("upKeyed",c,this).onSync("downKeyed",l,this).onSync("leftKeyed",a,this).onSync("rightKeyed",v,this).onSync("queryChanged",y,this).onSync("whitespaceChanged",p,this).onSync("langDirChanged",this._onLangDirChanged,this)}function i(n){var i=[].slice.call(arguments,1);return function(){var r=[].slice.call(arguments);t.each(i,function(t){return n[t].apply(n,r)})}}return t.mixin(r.prototype,{_hacks:function(){var r,i;r=this.input.$input||n("<div>");i=this.menu.$node||n("<div>");r.on("blur.tt",function(n){var u,f,e;u=document.activeElement;f=i.is(u);e=i.has(u).length>0;t.isMsie()&&(f||e)&&(n.preventDefault(),n.stopImmediatePropagation(),t.defer(function(){r.focus()}))});i.on("mousedown.tt",function(n){n.preventDefault()})},_onSelectableClicked:function(n,t){this.select(t)},_onDatasetCleared:function(){this._updateHint()},_onDatasetRendered:function(n,t,i,r){this._updateHint();this.eventBus.trigger("render",i,r,t)},_onAsyncRequested:function(n,t,i){this.eventBus.trigger("asyncrequest",i,t)},_onAsyncCanceled:function(n,t,i){this.eventBus.trigger("asynccancel",i,t)},_onAsyncReceived:function(n,t,i){this.eventBus.trigger("asyncreceive",i,t)},_onFocused:function(){this._minLengthMet()&&this.menu.update(this.input.getQuery())},_onBlurred:function(){this.input.hasQueryChangedSinceLastFocus()&&this.eventBus.trigger("change",this.input.getQuery())},_onEnterKeyed:function(n,t){var i;(i=this.menu.getActiveSelectable())&&this.select(i)&&t.preventDefault()},_onTabKeyed:function(n,t){var i;(i=this.menu.getActiveSelectable())?this.select(i)&&t.preventDefault():(i=this.menu.getTopSelectable())&&this.autocomplete(i)&&t.preventDefault()},_onEscKeyed:function(){this.close()},_onUpKeyed:function(){this.moveCursor(-1)},_onDownKeyed:function(){this.moveCursor(1)},_onLeftKeyed:function(){"rtl"===this.dir&&this.input.isCursorAtEnd()&&this.autocomplete(this.menu.getTopSelectable())},_onRightKeyed:function(){"ltr"===this.dir&&this.input.isCursorAtEnd()&&this.autocomplete(this.menu.getTopSelectable())},_onQueryChanged:function(n,t){this._minLengthMet(t)?this.menu.update(t):this.menu.empty()},_onWhitespaceChanged:function(){this._updateHint()},_onLangDirChanged:function(n,t){this.dir!==t&&(this.dir=t,this.menu.setLanguageDirection(t))},_openIfActive:function(){this.isActive()&&this.open()},_minLengthMet:function(n){return n=t.isString(n)?n:this.input.getQuery()||"",n.length>=this.minLength},_updateHint:function(){var f,i,n,e,o,s,r;f=this.menu.getTopSelectable();i=this.menu.getSelectableData(f);n=this.input.getInputValue();!i||t.isBlankString(n)||this.input.hasOverflow()?this.input.clearHint():(e=u.normalizeQuery(n),o=t.escapeRegExChars(e),s=new RegExp("^(?:"+o+")(.+$)","i"),r=s.exec(i.val),r&&this.input.setHint(n+r[1]))},isEnabled:function(){return this.enabled},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},isActive:function(){return this.active},activate:function(){return this.isActive()?!0:!this.isEnabled()||this.eventBus.before("active")?!1:(this.active=!0,this.eventBus.trigger("active"),!0)},deactivate:function(){return this.isActive()?this.eventBus.before("idle")?!1:(this.active=!1,this.close(),this.eventBus.trigger("idle"),!0):!0},isOpen:function(){return this.menu.isOpen()},open:function(){return this.isOpen()||this.eventBus.before("open")||(this.menu.open(),this._updateHint(),this.eventBus.trigger("open")),this.isOpen()},close:function(){return this.isOpen()&&!this.eventBus.before("close")&&(this.menu.close(),this.input.clearHint(),this.input.resetInputValue(),this.eventBus.trigger("close")),!this.isOpen()},setVal:function(n){this.input.setQuery(t.toStr(n))},getVal:function(){return this.input.getQuery()},select:function(n){var t=this.menu.getSelectableData(n);return t&&!this.eventBus.before("select",t.obj)?(this.input.setQuery(t.val,!0),this.eventBus.trigger("select",t.obj),this.close(),!0):!1},autocomplete:function(n){var i,t,r;return i=this.input.getQuery(),t=this.menu.getSelectableData(n),r=t&&i!==t.val,r&&!this.eventBus.before("autocomplete",t.obj)?(this.input.setQuery(t.val),this.eventBus.trigger("autocomplete",t.obj),!0):!1},moveCursor:function(n){var u,i,t,r,f;return u=this.input.getQuery(),i=this.menu.selectableRelativeToCursor(n),t=this.menu.getSelectableData(i),r=t?t.obj:null,f=this._minLengthMet()&&this.menu.update(u),f||this.eventBus.before("cursorchange",r)?!1:(this.menu.setCursor(i),t?this.input.setInputValue(t.val):(this.input.resetInputValue(),this._updateHint()),this.eventBus.trigger("cursorchange",r),!0)},destroy:function(){this.input.destroy();this.menu.destroy()}}),r}();!function(){"use strict";function r(t,i){t.each(function(){var t,r=n(this);(t=r.data(f.typeahead))&&i(t,r)})}function v(n,t){return n.clone().addClass(t.classes.hint).removeData().css(t.css.hint).css(p(n)).prop("readonly",!0).removeAttr("id name placeholder required").attr({autocomplete:"off",spellcheck:"false",tabindex:-1})}function y(n,t){n.data(f.attrs,{dir:n.attr("dir"),autocomplete:n.attr("autocomplete"),spellcheck:n.attr("spellcheck"),style:n.attr("style")});n.addClass(t.classes.input).attr({autocomplete:"off",spellcheck:!1});try{n.attr("dir")||n.attr("dir","auto")}catch(i){}return n}function p(n){return{backgroundAttachment:n.css("background-attachment"),backgroundClip:n.css("background-clip"),backgroundColor:n.css("background-color"),backgroundImage:n.css("background-image"),backgroundOrigin:n.css("background-origin"),backgroundPosition:n.css("background-position"),backgroundRepeat:n.css("background-repeat"),backgroundSize:n.css("background-size")}}function w(n){var r,i;r=n.data(f.www);i=n.parent().filter(r.selectors.wrapper);t.each(n.data(f.attrs),function(i,r){t.isUndefined(i)?n.removeAttr(r):n.attr(r,i)});n.removeData(f.typeahead).removeData(f.www).removeData(f.attr).removeClass(r.classes.input);i.length&&(n.detach().insertAfter(i),i.remove())}function l(i){var u,r;return u=t.isJQuery(i)||t.isElement(i),r=u?n(i).first():[],r.length?r:null}var a,f,s;a=n.fn.typeahead;f={www:"tt-www",attrs:"tt-attrs",typeahead:"tt-typeahead"};s={initialize:function(r,s){function p(){var e,d,p,w,b,k,g,nt,tt,it,rt;t.each(s,function(n){n.highlight=!!r.highlight});e=n(this);d=n(a.html.wrapper);p=l(r.hint);w=l(r.menu);b=r.hint!==!1&&!p;k=r.menu!==!1&&!w;b&&(p=v(e,a));k&&(w=n(a.html.menu).css(a.css.menu));p&&p.val("");e=y(e,a);(b||k)&&(d.css(a.css.wrapper),e.css(b?a.css.input:a.css.inputWithNoHint),e.wrap(d).parent().prepend(b?p:null).append(k?w:null));rt=k?h:i;g=new o({el:e});nt=new u({hint:p,input:e},a);tt=new rt({node:w,datasets:s},a);it=new c({input:nt,menu:tt,eventBus:g,minLength:r.minLength},a);e.data(f.www,a);e.data(f.typeahead,it)}var a;return s=t.isArray(s)?s:[].slice.call(arguments,1),r=r||{},a=e(r.classNames),this.each(p)},isEnabled:function(){var n;return r(this.first(),function(t){n=t.isEnabled()}),n},enable:function(){return r(this,function(n){n.enable()}),this},disable:function(){return r(this,function(n){n.disable()}),this},isActive:function(){var n;return r(this.first(),function(t){n=t.isActive()}),n},activate:function(){return r(this,function(n){n.activate()}),this},deactivate:function(){return r(this,function(n){n.deactivate()}),this},isOpen:function(){var n;return r(this.first(),function(t){n=t.isOpen()}),n},open:function(){return r(this,function(n){n.open()}),this},close:function(){return r(this,function(n){n.close()}),this},select:function(t){var i=!1,u=n(t);return r(this.first(),function(n){i=n.select(u)}),i},autocomplete:function(t){var i=!1,u=n(t);return r(this.first(),function(n){i=n.autocomplete(u)}),i},moveCursor:function(n){var t=!1;return r(this.first(),function(i){t=i.moveCursor(n)}),t},val:function(n){var t;return arguments.length?(r(this,function(t){t.setVal(n)}),this):(r(this.first(),function(n){t=n.getVal()}),t)},destroy:function(){return r(this,function(n,t){w(t);n.destroy()}),this}};n.fn.typeahead=function(n){return s[n]?s[n].apply(this,[].slice.call(arguments,1)):s.initialize.apply(this,arguments)};n.fn.typeahead.noConflict=function(){return n.fn.typeahead=a,this}}()});!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):n("object"==typeof exports?require("jquery"):jQuery)}(function(n){var i,t=navigator.userAgent,u=/iphone/i.test(t),f=/chrome/i.test(t),r=/android/i.test(t);n.mask={definitions:{"9":"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"};n.fn.extend({caret:function(n,t){var i;if(0!==this.length&&!this.is(":hidden"))return"number"==typeof n?(t="number"==typeof t?t:n,this.each(function(){this.setSelectionRange?this.setSelectionRange(n,t):this.createTextRange&&(i=this.createTextRange(),i.collapse(!0),i.moveEnd("character",t),i.moveStart("character",n),i.select())})):(this[0].setSelectionRange?(n=this[0].selectionStart,t=this[0].selectionEnd):document.selection&&document.selection.createRange&&(i=document.selection.createRange(),n=0-i.duplicate().moveStart("character",-1e5),t=n+i.text.length),{begin:n,end:t})},unmask:function(){return this.trigger("unmask")},mask:function(t,e){var p,l,o,c,h,v,s,a,y;return!t&&this.length>0?(p=n(this[0]),y=p.data(n.mask.dataName),y?y():void 0):(e=n.extend({autoclear:n.mask.autoclear,placeholder:n.mask.placeholder,completed:null},e),l=n.mask.definitions,o=[],c=s=t.length,h=null,n.each(t.split(""),function(n,t){"?"==t?(s--,c=n):l[t]?(o.push(new RegExp(l[t])),null===h&&(h=o.length-1),c>n&&(v=o.length-1)):o.push(null)}),this.trigger("unmask").each(function(){function nt(){if(e.completed){for(var n=h;v>=n;n++)if(o[n]&&p[n]===w(n))return;e.completed.call(y)}}function w(n){return e.placeholder.charAt(n<e.placeholder.length?n:0)}function b(n){for(;++n<s&&!o[n];);return n}function ut(n){for(;--n>=0&&!o[n];);return n}function it(n,t){var r,i;if(!(0>n)){for(r=n,i=b(t);s>r;r++)if(o[r]){if(!(s>i&&o[r].test(p[i])))break;p[r]=p[i];p[i]=w(i);i=b(i)}d();y.caret(Math.max(h,n))}}function ft(n){for(var r,u,t=n,i=w(n);s>t;t++)if(o[t]){if(r=b(t),u=p[t],p[t]=i,!(s>r&&o[r].test(u)))break;i=u}}function et(){var t=y.val(),n=y.caret();if(a&&a.length&&a.length>t.length){for(k(!0);n.begin>0&&!o[n.begin-1];)n.begin--;if(0===n.begin)for(;n.begin<h&&!o[n.begin];)n.begin++;y.caret(n.begin,n.begin)}else{for(k(!0);n.begin<s&&!o[n.begin];)n.begin++;y.caret(n.begin,n.begin)}nt()}function rt(){k();y.val()!=tt&&y.change()}function ot(n){if(!y.prop("readonly")){var f,i,t,r=n.which||n.keyCode;a=y.val();8===r||46===r||u&&127===r?(f=y.caret(),i=f.begin,t=f.end,t-i==0&&(i=46!==r?ut(i):t=b(i-1),t=46===r?b(t):t),g(i,t),it(i,t-1),n.preventDefault()):13===r?rt.call(this,n):27===r&&(y.val(tt),y.caret(0,k()),n.preventDefault())}}function st(t){var u,e,h,f,i,c;y.prop("readonly")||(f=t.which||t.keyCode,i=y.caret(),t.ctrlKey||t.altKey||t.metaKey||32>f||!f||13===f||((i.end-i.begin!=0&&(g(i.begin,i.end),it(i.begin,i.end-1)),u=b(i.begin-1),s>u&&(e=String.fromCharCode(f),o[u].test(e)))&&((ft(u),p[u]=e,d(),h=b(u),r)?(c=function(){n.proxy(n.fn.caret,y,h)()},setTimeout(c,0)):y.caret(h),i.begin<=v&&nt()),t.preventDefault()))}function g(n,t){for(var i=n;t>i&&s>i;i++)o[i]&&(p[i]=w(i))}function d(){y.val(p.join(""))}function k(n){for(var f,r=y.val(),u=-1,t=0,i=0;s>t;t++)if(o[t]){for(p[t]=w(t);i++<r.length;)if(f=r.charAt(i-1),o[t].test(f)){p[t]=f;u=t;break}if(i>r.length){g(t+1,s);break}}else p[t]===r.charAt(i)&&i++,c>t&&(u=t);return n?d():c>u+1?e.autoclear||p.join("")===ht?(y.val()&&y.val(""),g(0,s)):d():(d(),y.val(y.val().substring(0,u+1))),c?t:h}var y=n(this),p=n.map(t.split(""),function(n,t){if("?"!=n)return l[n]?w(t):n}),ht=p.join(""),tt=y.val();y.data(n.mask.dataName,function(){return n.map(p,function(n,t){return o[t]&&n!=w(t)?n:null}).join("")});y.one("unmask",function(){y.off(".mask").removeData(n.mask.dataName)}).on("focus.mask",function(){if(!y.prop("readonly")){clearTimeout(i);var n;tt=y.val();n=k();i=setTimeout(function(){y.get(0)===document.activeElement&&(d(),n==t.replace("?","").length?y.caret(0,n):y.caret(n))},10)}}).on("blur.mask",rt).on("keydown.mask",ot).on("keypress.mask",st).on("input.mask paste.mask",function(){y.prop("readonly")||setTimeout(function(){var n=k(!0);y.caret(n);nt()},0)});f&&r&&y.off("input.mask").on("input.mask",et);k()}))}})})