(function(h){h.extend(h.inputmask.defaults.definitions,{h:{validator:"[01][0-9]|2[0-3]",cardinality:2,prevalidator:[{validator:"[0-2]",cardinality:1}]},s:{validator:"[0-5][0-9]",cardinality:2,prevalidator:[{validator:"[0-5]",cardinality:1}]},d:{validator:"0[1-9]|[12][0-9]|3[01]",cardinality:2,prevalidator:[{validator:"[0-3]",cardinality:1}]},m:{validator:"0[1-9]|1[012]",cardinality:2,prevalidator:[{validator:"[01]",cardinality:1}]},y:{validator:"(19|20)\\d{2}",cardinality:4,prevalidator:[{validator:"[12]",
cardinality:1},{validator:"(19|20)",cardinality:2},{validator:"(19|20)\\d",cardinality:3}]}});h.extend(h.inputmask.defaults.aliases,{"dd/mm/yyyy":{mask:"1/2/y",placeholder:"dd/mm/yyyy",regex:{val1pre:/[0-3]/,val1:/0[1-9]|[12][0-9]|3[01]/,val2pre:function(a){a=h.inputmask.escapeRegex.call(this,a);return RegExp("((0[1-9]|[12][0-9]|3[01])"+a+"[01])")},val2:function(a){a=h.inputmask.escapeRegex.call(this,a);return RegExp("((0[1-9]|[12][0-9])"+a+"(0[1-9]|1[012]))|(30"+a+"(0[13-9]|1[012]))|(31"+a+"(0[13578]|1[02]))")}},
leapday:"29/02/",separator:"/",yearrange:{minyear:1900,maxyear:2099},isInYearRange:function(a,d,c){var f=parseInt(a.concat(d.toString().slice(a.length)));a=parseInt(a.concat(c.toString().slice(a.length)));return(NaN!=f?d<=f&&f<=c:!1)||(NaN!=a?d<=a&&a<=c:!1)},determinebaseyear:function(a,d,c){var f=(new Date).getFullYear();if(a>f)return a;if(d<f){for(var f=d.toString().slice(0,2),b=d.toString().slice(2,4);d<f+c;)f--;d=f+b;return a>d?a:d}return f},onKeyUp:function(a,d,c){d=h(this);a.ctrlKey&&a.keyCode==
c.keyCode.RIGHT&&(a=new Date,d.val(a.getDate().toString()+(a.getMonth()+1).toString()+a.getFullYear().toString()))},definitions:{1:{validator:function(a,d,c,f,b){var e=b.regex.val1.test(a);return f||e||a.charAt(1)!=b.separator&&-1=="-./".indexOf(a.charAt(1))||!(e=b.regex.val1.test("0"+a.charAt(0)))?e:(d[c-1]="0",{pos:c,c:a.charAt(0)})},cardinality:2,prevalidator:[{validator:function(a,d,c,f,b){var e=b.regex.val1pre.test(a);return f||e||!(e=b.regex.val1.test("0"+a))?e:(d[c]="0",c++,{pos:c})},cardinality:1}]},
2:{validator:function(a,d,c,f,b){var e=d.join("").substr(0,3);-1!=e.indexOf(b.placeholder[0])&&(e="01"+b.separator);var g=b.regex.val2(b.separator).test(e+a);return f||g||a.charAt(1)!=b.separator&&-1=="-./".indexOf(a.charAt(1))||!(g=b.regex.val2(b.separator).test(e+"0"+a.charAt(0)))?g:(d[c-1]="0",{pos:c,c:a.charAt(0)})},cardinality:2,prevalidator:[{validator:function(a,d,c,f,b){var e=d.join("").substr(0,3);-1!=e.indexOf(b.placeholder[0])&&(e="01"+b.separator);var g=b.regex.val2pre(b.separator).test(e+
a);return f||g||!(g=b.regex.val2(b.separator).test(e+"0"+a))?g:(d[c]="0",c++,{pos:c})},cardinality:1}]},y:{validator:function(a,d,c,f,b){if(b.isInYearRange(a,b.yearrange.minyear,b.yearrange.maxyear)){if(d.join("").substr(0,6)!=b.leapday)return!0;a=parseInt(a,10);return 0===a%4?0===a%100?0===a%400?!0:!1:!0:!1}return!1},cardinality:4,prevalidator:[{validator:function(a,d,c,f,b){var e=b.isInYearRange(a,b.yearrange.minyear,b.yearrange.maxyear);if(!f&&!e){f=b.determinebaseyear(b.yearrange.minyear,b.yearrange.maxyear,
a+"0").toString().slice(0,1);if(e=b.isInYearRange(f+a,b.yearrange.minyear,b.yearrange.maxyear))return d[c++]=f[0],{pos:c};f=b.determinebaseyear(b.yearrange.minyear,b.yearrange.maxyear,a+"0").toString().slice(0,2);if(e=b.isInYearRange(f+a,b.yearrange.minyear,b.yearrange.maxyear))return d[c++]=f[0],d[c++]=f[1],{pos:c}}return e},cardinality:1},{validator:function(a,d,c,f,b){var e=b.isInYearRange(a,b.yearrange.minyear,b.yearrange.maxyear);if(!f&&!e){f=b.determinebaseyear(b.yearrange.minyear,b.yearrange.maxyear,
a).toString().slice(0,2);if(e=b.isInYearRange(a[0]+f[1]+a[1],b.yearrange.minyear,b.yearrange.maxyear))return d[c++]=f[1],{pos:c};f=b.determinebaseyear(b.yearrange.minyear,b.yearrange.maxyear,a).toString().slice(0,2);b.isInYearRange(f+a,b.yearrange.minyear,b.yearrange.maxyear)?d.join("").substr(0,6)!=b.leapday?e=!0:(b=parseInt(a,10),e=0===b%4?0===b%100?0===b%400?!0:!1:!0:!1):e=!1;if(e)return d[c-1]=f[0],d[c++]=f[1],d[c++]=a[0],{pos:c}}return e},cardinality:2},{validator:function(a,d,c,f,b){return b.isInYearRange(a,
b.yearrange.minyear,b.yearrange.maxyear)},cardinality:3}]}},insertMode:!1,autoUnmask:!1},"mm/dd/yyyy":{placeholder:"mm/dd/yyyy",alias:"dd/mm/yyyy",regex:{val2pre:function(a){a=h.inputmask.escapeRegex.call(this,a);return RegExp("((0[13-9]|1[012])"+a+"[0-3])|(02"+a+"[0-2])")},val2:function(a){a=h.inputmask.escapeRegex.call(this,a);return RegExp("((0[1-9]|1[012])"+a+"(0[1-9]|[12][0-9]))|((0[13-9]|1[012])"+a+"30)|((0[13578]|1[02])"+a+"31)")},val1pre:/[01]/,val1:/0[1-9]|1[012]/},leapday:"02/29/",onKeyUp:function(a,
d,c){d=h(this);a.ctrlKey&&a.keyCode==c.keyCode.RIGHT&&(a=new Date,d.val((a.getMonth()+1).toString()+a.getDate().toString()+a.getFullYear().toString()))}},"yyyy/mm/dd":{mask:"y/1/2",placeholder:"yyyy/mm/dd",alias:"mm/dd/yyyy",leapday:"/02/29",onKeyUp:function(a,d,c){d=h(this);a.ctrlKey&&a.keyCode==c.keyCode.RIGHT&&(a=new Date,d.val(a.getFullYear().toString()+(a.getMonth()+1).toString()+a.getDate().toString()))},definitions:{2:{validator:function(a,d,c,f,b){var e=d.join("").substr(5,3);-1!=e.indexOf(b.placeholder[5])&&
(e="01"+b.separator);var g=b.regex.val2(b.separator).test(e+a);if(!(f||g||a.charAt(1)!=b.separator&&-1=="-./".indexOf(a.charAt(1)))&&(g=b.regex.val2(b.separator).test(e+"0"+a.charAt(0))))return d[c-1]="0",{pos:c,c:a.charAt(0)};if(g){if(d.join("").substr(4,4)+a!=b.leapday)return!0;a=parseInt(d.join("").substr(0,4),10);return 0===a%4?0===a%100?0===a%400?!0:!1:!0:!1}return g},cardinality:2,prevalidator:[{validator:function(a,d,c,f,b){var e=d.join("").substr(5,3);-1!=e.indexOf(b.placeholder[5])&&(e="01"+
b.separator);var g=b.regex.val2pre(b.separator).test(e+a);return f||g||!(g=b.regex.val2(b.separator).test(e+"0"+a))?g:(d[c]="0",c++,{pos:c})},cardinality:1}]}}},"dd.mm.yyyy":{mask:"1.2.y",placeholder:"dd.mm.yyyy",leapday:"29.02.",separator:".",alias:"dd/mm/yyyy"},"dd-mm-yyyy":{mask:"1-2-y",placeholder:"dd-mm-yyyy",leapday:"29-02-",separator:"-",alias:"dd/mm/yyyy"},"mm.dd.yyyy":{mask:"1.2.y",placeholder:"mm.dd.yyyy",leapday:"02.29.",separator:".",alias:"mm/dd/yyyy"},"mm-dd-yyyy":{mask:"1-2-y",placeholder:"mm-dd-yyyy",
leapday:"02-29-",separator:"-",alias:"mm/dd/yyyy"},"yyyy.mm.dd":{mask:"y.1.2",placeholder:"yyyy.mm.dd",leapday:".02.29",separator:".",alias:"yyyy/mm/dd"},"yyyy-mm-dd":{mask:"y-1-2",placeholder:"yyyy-mm-dd",leapday:"-02-29",separator:"-",alias:"yyyy/mm/dd"},datetime:{mask:"1/2/y h:s",placeholder:"dd/mm/yyyy hh:mm",alias:"dd/mm/yyyy",regex:{hrspre:/[012]/,hrs24:/2[0-9]|1[3-9]/,hrs:/[01][0-9]|2[0-3]/,ampm:/^[a|p|A|P][m|M]/},timeseparator:":",hourFormat:"24",definitions:{h:{validator:function(a,d,c,f,
b){var e=b.regex.hrs.test(a);return f||e||a.charAt(1)!=b.timeseparator&&-1=="-.:".indexOf(a.charAt(1))||!(e=b.regex.hrs.test("0"+a.charAt(0)))?e&&"24"!==b.hourFormat&&b.regex.hrs24.test(a)?(a=parseInt(a,10),d[c+5]=24==a?"a":"p",d[c+6]="m",a-=12,10>a?(d[c]=a.toString(),d[c-1]="0"):(d[c]=a.toString().charAt(1),d[c-1]=a.toString().charAt(0)),{pos:c,c:d[c]}):e:(d[c-1]="0",d[c]=a.charAt(0),c++,{pos:c})},cardinality:2,prevalidator:[{validator:function(a,d,c,f,b){var e=b.regex.hrspre.test(a);return f||e||
!(e=b.regex.hrs.test("0"+a))?e:(d[c]="0",c++,{pos:c})},cardinality:1}]},t:{validator:function(a,d,c,f,b){return b.regex.ampm.test(a+"m")},casing:"lower",cardinality:1}},insertMode:!1,autoUnmask:!1},datetime12:{mask:"1/2/y h:s t\\m",placeholder:"dd/mm/yyyy hh:mm xm",alias:"datetime",hourFormat:"12"},"hh:mm t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"h:s t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"hh:mm:ss":{mask:"h:s:s",autoUnmask:!1},
"hh:mm":{mask:"h:s",autoUnmask:!1},date:{alias:"dd/mm/yyyy"},"mm/yyyy":{mask:"1/y",placeholder:"mm/yyyy",leapday:"donotuse",separator:"/",alias:"mm/dd/yyyy"}})})(jQuery);
