(function(k){k.extend(k.inputmask.defaults.aliases,{decimal:{mask:"~",placeholder:"",repeat:"*",greedy:!1,numericInput:!1,isNumeric:!0,digits:"*",groupSeparator:"",radixPoint:".",groupSize:3,autoGroup:!1,allowPlus:!0,allowMinus:!0,integerDigits:"*",defaultValue:"",prefix:"",suffix:"",postFormat:function(a,e,d,c){if(""==c.groupSeparator)return e;var b=a.slice();k.inArray(c.radixPoint,a);d||b.splice(e,0,"?");b=b.join("");if(c.autoGroup||d&&-1!=b.indexOf(c.groupSeparator)){for(var g=k.inputmask.escapeRegex.call(this,
c.groupSeparator),b=b.replace(RegExp(g,"g"),""),g=b.split(c.radixPoint),b=g[0],f=RegExp("([-+]?[\\d?]+)([\\d?]{"+c.groupSize+"})");f.test(b);)b=b.replace(f,"$1"+c.groupSeparator+"$2"),b=b.replace(c.groupSeparator+c.groupSeparator,c.groupSeparator);1<g.length&&(b+=c.radixPoint+g[1])}a.length=b.length;c=0;for(g=b.length;c<g;c++)a[c]=b.charAt(c);b=k.inArray("?",a);d||a.splice(b,1);return d?e:b},regex:{number:function(a){var e=k.inputmask.escapeRegex.call(this,a.radixPoint),d=isNaN(a.digits)?a.digits:
"{0,"+a.digits+"}",c=isNaN(a.integerDigits)?a.integerDigits:"{1,"+a.integerDigits+"}";return RegExp("^"+(a.allowPlus||a.allowMinus?"["+(a.allowPlus?"+":"")+(a.allowMinus?"-":"")+"]?":"")+"\\d"+c+"("+e+"\\d"+d+")?$")}},onKeyDown:function(a,e,d){var c=k(this);if(a.keyCode==d.keyCode.TAB){if(a=k.inArray(d.radixPoint,e),-1!=a){for(var b=c.data("_inputmask").masksets,c=c.data("_inputmask").activeMasksetIndex,g=1;g<=d.digits&&g<d.getMaskLength(b[c]._buffer,d.greedy,d.repeat,e,d);g++)if(void 0==e[a+g]||
""==e[a+g])e[a+g]="0";return{refreshFromBuffer:!0}}}else if(a.keyCode==d.keyCode.DELETE||a.keyCode==d.keyCode.BACKSPACE)return d.postFormat(e,0,!0,d),this._valueSet(e.join("")),{refreshFromBuffer:!0}},definitions:{"~":{validator:function(a,e,d,c,b){var g=k.extend({},b,{digits:c?"*":b.digits});if(""==a)return!1;if(!c&&1>=d&&"0"===e[0]&&/[\d-]/.test(a)&&1==e.join("").length)return e[0]="",{pos:0};var f=c?e.slice(0,d):e.slice();f.splice(d,0,a);var f=f.join(""),h=k.inputmask.escapeRegex.call(this,b.groupSeparator),
f=f.replace(RegExp(h,"g"),"");c&&f.lastIndexOf(b.radixPoint)==f.length-1&&(h=k.inputmask.escapeRegex.call(this,b.radixPoint),f=f.replace(RegExp(h,"g"),""));if(!c&&""==f)return!1;h=b.regex.number(g).test(f);if(!h&&(f+="0",h=b.regex.number(g).test(f),!h)){h=f.lastIndexOf(b.groupSeparator);for(h=f.length-h;3>=h;h++)f+="0";h=b.regex.number(g).test(f);if(!h&&!c&&a==b.radixPoint&&(h=b.regex.number(g).test("0"+f+"0")))return e[d]="0",d++,{pos:d}}return!1==h||c||a==b.radixPoint?h:{pos:b.postFormat(e,d,"-"==
a||"+"==a?!0:!1,b),refreshFromBuffer:!0}},cardinality:1,prevalidator:null}},insertMode:!0,autoUnmask:!1},integer:{regex:{number:function(a){var e=k.inputmask.escapeRegex.call(this,a.groupSeparator);return RegExp("^"+(a.allowPlus||a.allowMinus?"["+(a.allowPlus?"+":"")+(a.allowMinus?"-":"")+"]?":"")+"(\\d+|\\d{1,"+a.groupSize+"}(("+e+"\\d{"+a.groupSize+"})?)+)$")}},alias:"decimal"}})})(jQuery);
