/* Minification failed. Returning unminified contents.
(372,342-343): run-time error JS1010: Expected identifier: .
(372,342-343): run-time error JS1195: Expected expression: .
(372,99985-99986): run-time error JS1010: Expected identifier: .
(372,99985-99986): run-time error JS1195: Expected expression: .
 */
/*! jQuery Validation Plugin - v1.17.0 - 7/29/2017
 * https://jqueryvalidation.org/
 * Copyright (c) 2017 Jörn Zaefferer; Licensed MIT */
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.on("click.validate",":submit",function(b){c.submitButton=b.currentTarget,a(this).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(this).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.on("submit.validate",function(b){function d(){var d,e;return c.submitButton&&(c.settings.submitHandler||c.formSubmitted)&&(d=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),!c.settings.submitHandler||(e=c.settings.submitHandler.call(c,c.currentForm,b),d&&d.remove(),void 0!==e&&e)}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c,d;return a(this[0]).is("form")?b=this.validate().form():(d=[],b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b,b||(d=d.concat(c.errorList))}),c.errorList=d),b},rules:function(b,c){var d,e,f,g,h,i,j=this[0];if(null!=j&&(!j.form&&j.hasAttribute("contenteditable")&&(j.form=this.closest("form")[0],j.name=this.attr("name")),null!=j.form)){if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(a,b){i[b]=f[b],delete f[b]}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g)),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}}),a.extend(a.expr.pseudos||a.expr[":"],{blank:function(b){return!a.trim(""+a(b).val())},filled:function(b){var c=a(b).val();return null!==c&&!!a.trim(""+c)},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:void 0===c?b:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",pendingClass:"pending",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(b,c){var d=[16,17,18,20,35,36,37,38,39,40,45,144,225];9===c.which&&""===this.elementValue(b)||a.inArray(c.keyCode,d)!==-1||(b.name in this.submitted||b.name in this.invalid)&&this.element(b)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},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.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}."),step:a.validator.format("Please enter a multiple of {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){!this.form&&this.hasAttribute("contenteditable")&&(this.form=a(this).closest("form")[0],this.name=a(this).attr("name"));var c=a.data(this.form,"validator"),d="on"+b.type.replace(/^validate/,""),e=c.settings;e[d]&&!a(this).is(e.ignore)&&e[d].call(c,this,b)}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){d[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).on("focusin.validate focusout.validate keyup.validate",":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'], [type='radio'], [type='checkbox'], [contenteditable], [type='button']",b).on("click.validate","select, option, [type='radio'], [type='checkbox']",b),this.settings.invalidHandler&&a(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c,d,e=this.clean(b),f=this.validationTargetFor(e),g=this,h=!0;return void 0===f?delete this.invalid[e.name]:(this.prepareElement(f),this.currentElements=a(f),d=this.groups[f.name],d&&a.each(this.groups,function(a,b){b===d&&a!==f.name&&(e=g.validationTargetFor(g.clean(g.findByName(a))),e&&e.name in g.invalid&&(g.currentElements.push(e),h=g.check(e)&&h))}),c=this.check(f)!==!1,h=h&&c,c?this.invalid[f.name]=!1:this.invalid[f.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),a(b).attr("aria-invalid",!c)),h},showErrors:function(b){if(b){var c=this;a.extend(this.errorMap,b),this.errorList=a.map(this.errorMap,function(a,b){return{message:a,element:c.findByName(b)[0]}}),this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.invalid={},this.submitted={},this.prepareForm(),this.hideErrors();var b=this.elements().removeData("previousValue").removeAttr("aria-invalid");this.resetElements(b)},resetElements:function(a){var b;if(this.settings.unhighlight)for(b=0;a[b];b++)this.settings.unhighlight.call(this,a[b],this.settings.errorClass,""),this.findByName(a[b].name).removeClass(this.settings.validClass);else a.removeClass(this.settings.errorClass).removeClass(this.settings.validClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)void 0!==a[b]&&null!==a[b]&&a[b]!==!1&&c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea, [contenteditable]").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function(){var d=this.name||a(this).attr("name");return!d&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.hasAttribute("contenteditable")&&(this.form=a(this).closest("form")[0],this.name=d),!(d in c||!b.objectLength(a(this).rules()))&&(c[d]=!0,!0)})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},resetInternals:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([])},reset:function(){this.resetInternals(),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d,e=a(b),f=b.type;return"radio"===f||"checkbox"===f?this.findByName(b.name).filter(":checked").val():"number"===f&&"undefined"!=typeof b.validity?b.validity.badInput?"NaN":e.val():(c=b.hasAttribute("contenteditable")?e.text():e.val(),"file"===f?"C:\\fakepath\\"===c.substr(0,12)?c.substr(12):(d=c.lastIndexOf("/"),d>=0?c.substr(d+1):(d=c.lastIndexOf("\\"),d>=0?c.substr(d+1):c)):"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f,g=a(b).rules(),h=a.map(g,function(a,b){return b}).length,i=!1,j=this.elementValue(b);if("function"==typeof g.normalizer?f=g.normalizer:"function"==typeof this.settings.normalizer&&(f=this.settings.normalizer),f){if(j=f.call(b,j),"string"!=typeof j)throw new TypeError("The normalizer should return a string value.");delete g.normalizer}for(d in g){e={method:d,parameters:g[d]};try{if(c=a.validator.methods[d].call(this,j,b,e.parameters),"dependency-mismatch"===c&&1===h){i=!0;continue}if(i=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(k){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",k),k instanceof TypeError&&(k.message+=".  Exception occurred when checking element "+b.id+", check the '"+e.method+"' method."),k}}if(!i)return this.objectLength(g)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(void 0!==arguments[a])return arguments[a]},defaultMessage:function(b,c){"string"==typeof c&&(c={method:c});var d=this.findDefined(this.customMessage(b.name,c.method),this.customDataMessage(b,c.method),!this.settings.ignoreTitle&&b.title||void 0,a.validator.messages[c.method],"<strong>Warning: No message defined for "+b.name+"</strong>"),e=/\$?\{(\d+)\}/g;return"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),d},formatAndAdd:function(a,b){var c=this.defaultMessage(a,b);this.errorList.push({message:c,element:a,method:b.method}),this.errorMap[a.name]=c,this.submitted[a.name]=c},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],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 a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g,h=this.errorsFor(b),i=this.idOrName(b),j=a(b).attr("aria-describedby");h.length?(h.removeClass(this.settings.validClass).addClass(this.settings.errorClass),h.html(c)):(h=a("<"+this.settings.errorElement+">").attr("id",i+"-error").addClass(this.settings.errorClass).html(c||""),d=h,this.settings.wrapper&&(d=h.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement.call(this,d,a(b)):d.insertAfter(b),h.is("label")?h.attr("for",i):0===h.parents("label[for='"+this.escapeCssMeta(i)+"']").length&&(f=h.attr("id"),j?j.match(new RegExp("\\b"+this.escapeCssMeta(f)+"\\b"))||(j+=" "+f):j=f,a(b).attr("aria-describedby",j),e=this.groups[b.name],e&&(g=this,a.each(g.groups,function(b,c){c===e&&a("[name='"+g.escapeCssMeta(b)+"']",g.currentForm).attr("aria-describedby",h.attr("id"))})))),!c&&this.settings.success&&(h.text(""),"string"==typeof this.settings.success?h.addClass(this.settings.success):this.settings.success(h,b)),this.toShow=this.toShow.add(h)},errorsFor:function(b){var c=this.escapeCssMeta(this.idOrName(b)),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+this.escapeCssMeta(d).replace(/\s+/g,", #")),this.errors().filter(e)},escapeCssMeta:function(a){return a.replace(/([\\!"#$%&'()*+,.\/:;<=>?@\[\]^`{|}~])/g,"\\$1")},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+this.escapeCssMeta(b)+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return!this.dependTypes[typeof a]||this.dependTypes[typeof a](a,b)},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(b){this.pending[b.name]||(this.pendingRequest++,a(b).addClass(this.settings.pendingClass),this.pending[b.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],a(b).removeClass(this.settings.pendingClass),c&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.submitButton&&a("input:hidden[name='"+this.submitButton.name+"']",this.currentForm).remove(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b,c){return c="string"==typeof c&&c||"remote",a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,{method:c})})},destroy:function(){this.resetForm(),a(this.currentForm).off(".validate").removeData("validator").find(".validate-equalTo-blur").off(".validate-equalTo").removeClass("validate-equalTo-blur")}},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(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},normalizeAttributeRule:function(a,b,c,d){/min|max|step/.test(c)&&(null===b||/number|range|text/.test(b))&&(d=Number(d),isNaN(d)&&(d=void 0)),d||0===d?a[c]=d:b===c&&"range"!==b&&(a[c]=!0)},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),this.normalizeAttributeRule(e,g,c,d);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),this.normalizeAttributeRule(e,g,c,d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0===e.param||e.param:(a.data(c.form,"validator").resetElements(a(c)),delete b[d])}}),a.each(b,function(d,e){b[d]=a.isFunction(e)&&"normalizer"!==d?e(c):e}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&&(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(c=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:b.length>0},email:function(a,b){return this.optional(b)||/^[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(a)},url:function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[\/?#]\S*)?$/i.test(a)},date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a).toString())},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e<=d},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||a<=c},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},step:function(b,c,d){var e,f=a(c).attr("type"),g="Step attribute on input type "+f+" is not supported.",h=["text","number","range"],i=new RegExp("\\b"+f+"\\b"),j=f&&!i.test(h.join()),k=function(a){var b=(""+a).match(/(?:\.(\d+))?$/);return b&&b[1]?b[1].length:0},l=function(a){return Math.round(a*Math.pow(10,e))},m=!0;if(j)throw new Error(g);return e=k(d),(k(b)>e||l(b)%l(d)!==0)&&(m=!1),this.optional(c)||m},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-equalTo-blur").length&&e.addClass("validate-equalTo-blur").on("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d,e){if(this.optional(c))return"dependency-mismatch";e="string"==typeof e&&e||"remote";var f,g,h,i=this.previousValue(c,e);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),i.originalMessage=i.originalMessage||this.settings.messages[c.name][e],this.settings.messages[c.name][e]=i.message,d="string"==typeof d&&{url:d}||d,h=a.param(a.extend({data:b},d.data)),i.old===h?i.valid:(i.old=h,f=this,this.startRequest(c),g={},g[c.name]=b,a.ajax(a.extend(!0,{mode:"abort",port:"validate"+c.name,dataType:"json",data:g,context:f.currentForm,success:function(a){var d,g,h,j=a===!0||"true"===a;f.settings.messages[c.name][e]=i.originalMessage,j?(h=f.formSubmitted,f.resetInternals(),f.toHide=f.errorsFor(c),f.formSubmitted=h,f.successList.push(c),f.invalid[c.name]=!1,f.showErrors()):(d={},g=a||f.defaultMessage(c,{method:e,parameters:b}),d[c.name]=i.message=g,f.invalid[c.name]=!0,f.showErrors(d)),i.valid=j,f.stopRequest(c,j)}},d)),"pending")}}});var b,c={};return a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,d){var e=a.port;"abort"===a.mode&&(c[e]&&c[e].abort(),c[e]=d)}):(b=a.ajax,a.ajax=function(d){var e=("mode"in d?d:a.ajaxSettings).mode,f=("port"in d?d:a.ajaxSettings).port;return"abort"===e?(c[f]&&c[f].abort(),c[f]=b.apply(this,arguments),c[f]):b.apply(this,arguments)}),a});;
// Unobtrusive validation support library for jQuery and jQuery Validate
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// @version v3.2.11
!function(a){"function"==typeof define&&define.amd?define("jquery.validate.unobtrusive",["jquery-validation"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery-validation")):jQuery.validator.unobtrusive=a(jQuery)}(function(a){function e(a,e,n){a.rules[e]=n,a.message&&(a.messages[e]=a.message)}function n(a){return a.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function t(a){return a.replace(/([!"#$%&'()*+,.\/:;<=>?@\[\\\]^`{|}~])/g,"\\$1")}function r(a){return a.substr(0,a.lastIndexOf(".")+1)}function i(a,e){return 0===a.indexOf("*.")&&(a=a.replace("*.",e)),a}function o(e,n){var r=a(this).find("[data-valmsg-for='"+t(n[0].name)+"']"),i=r.attr("data-valmsg-replace"),o=i?a.parseJSON(i)!==!1:null;r.removeClass("field-validation-valid").addClass("field-validation-error"),e.data("unobtrusiveContainer",r),o?(r.empty(),e.removeClass("input-validation-error").appendTo(r)):e.hide()}function d(e,n){var t=a(this).find("[data-valmsg-summary=true]"),r=t.find("ul");r&&r.length&&n.errorList.length&&(r.empty(),t.addClass("validation-summary-errors").removeClass("validation-summary-valid"),a.each(n.errorList,function(){a("<li />").html(this.message).appendTo(r)}))}function s(e){var n=e.data("unobtrusiveContainer");if(n){var t=n.attr("data-valmsg-replace"),r=t?a.parseJSON(t):null;n.addClass("field-validation-valid").removeClass("field-validation-error"),e.removeData("unobtrusiveContainer"),r&&n.empty()}}function l(e){var n=a(this),t="__jquery_unobtrusive_validation_form_reset";if(!n.data(t)){n.data(t,!0);try{n.data("validator").resetForm()}finally{n.removeData(t)}n.find(".validation-summary-errors").addClass("validation-summary-valid").removeClass("validation-summary-errors"),n.find(".field-validation-error").addClass("field-validation-valid").removeClass("field-validation-error").removeData("unobtrusiveContainer").find(">*").removeData("unobtrusiveContainer")}}function u(e){var n=a(e),t=n.data(v),r=a.proxy(l,e),i=f.unobtrusive.options||{},u=function(n,t){var r=i[n];r&&a.isFunction(r)&&r.apply(e,t)};return t||(t={options:{errorClass:i.errorClass||"input-validation-error",errorElement:i.errorElement||"span",errorPlacement:function(){o.apply(e,arguments),u("errorPlacement",arguments)},invalidHandler:function(){d.apply(e,arguments),u("invalidHandler",arguments)},messages:{},rules:{},success:function(){s.apply(e,arguments),u("success",arguments)}},attachValidation:function(){n.off("reset."+v,r).on("reset."+v,r).validate(this.options)},validate:function(){return n.validate(),n.valid()}},n.data(v,t)),t}var m,f=a.validator,v="unobtrusiveValidation";return f.unobtrusive={adapters:[],parseElement:function(e,n){var t,r,i,o=a(e),d=o.parents("form")[0];d&&(t=u(d),t.options.rules[e.name]=r={},t.options.messages[e.name]=i={},a.each(this.adapters,function(){var n="data-val-"+this.name,t=o.attr(n),s={};void 0!==t&&(n+="-",a.each(this.params,function(){s[this]=o.attr(n+this)}),this.adapt({element:e,form:d,message:t,params:s,rules:r,messages:i}))}),a.extend(r,{__dummy__:!0}),n||t.attachValidation())},parse:function(e){var n=a(e),t=n.parents().addBack().filter("form").add(n.find("form")).has("[data-val=true]");n.find("[data-val=true]").each(function(){f.unobtrusive.parseElement(this,!0)}),t.each(function(){var a=u(this);a&&a.attachValidation()})}},m=f.unobtrusive.adapters,m.add=function(a,e,n){return n||(n=e,e=[]),this.push({name:a,params:e,adapt:n}),this},m.addBool=function(a,n){return this.add(a,function(t){e(t,n||a,!0)})},m.addMinMax=function(a,n,t,r,i,o){return this.add(a,[i||"min",o||"max"],function(a){var i=a.params.min,o=a.params.max;i&&o?e(a,r,[i,o]):i?e(a,n,i):o&&e(a,t,o)})},m.addSingleVal=function(a,n,t){return this.add(a,[n||"val"],function(r){e(r,t||a,r.params[n])})},f.addMethod("__dummy__",function(a,e,n){return!0}),f.addMethod("regex",function(a,e,n){var t;return!!this.optional(e)||(t=new RegExp(n).exec(a),t&&0===t.index&&t[0].length===a.length)}),f.addMethod("nonalphamin",function(a,e,n){var t;return n&&(t=a.match(/\W/g),t=t&&t.length>=n),t}),f.methods.extension?(m.addSingleVal("accept","mimtype"),m.addSingleVal("extension","extension")):m.addSingleVal("extension","extension","accept"),m.addSingleVal("regex","pattern"),m.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url"),m.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range"),m.addMinMax("minlength","minlength").addMinMax("maxlength","minlength","maxlength"),m.add("equalto",["other"],function(n){var o=r(n.element.name),d=n.params.other,s=i(d,o),l=a(n.form).find(":input").filter("[name='"+t(s)+"']")[0];e(n,"equalTo",l)}),m.add("required",function(a){"INPUT"===a.element.tagName.toUpperCase()&&"CHECKBOX"===a.element.type.toUpperCase()||e(a,"required",!0)}),m.add("remote",["url","type","additionalfields"],function(o){var d={url:o.params.url,type:o.params.type||"GET",data:{}},s=r(o.element.name);a.each(n(o.params.additionalfields||o.element.name),function(e,n){var r=i(n,s);d.data[r]=function(){var e=a(o.form).find(":input").filter("[name='"+t(r)+"']");return e.is(":checkbox")?e.filter(":checked").val()||e.filter(":hidden").val()||"":e.is(":radio")?e.filter(":checked").val()||"":e.val()}}),e(o,"remote",d)}),m.add("password",["min","nonalphamin","regex"],function(a){a.params.min&&e(a,"minlength",a.params.min),a.params.nonalphamin&&e(a,"nonalphamin",a.params.nonalphamin),a.params.regex&&e(a,"regex",a.params.regex)}),m.add("fileextensions",["extensions"],function(a){e(a,"extension",a.params.extensions)}),a(function(){f.unobtrusive.parse(document)}),f.unobtrusive});;
(function ($) {

  function isMdbForm($element) {
    return $element.closest("form").find(".md-form").length > 0;
  }

  function isMdbMultiCheckbox($element) {
    return $element.hasClass("mdbMultiCheckBox");
  }

  function getClosestMdbMultiCheckboxContainer($element) {
    return $element.closest(".mdbMultiCheckBoxContainer");
  }

  function applyCheckboxGroupClasses($element, isValid) {
    var validCssClass = "Is-Valid";
    var inValidCssClass = "Is-In-Valid";
    var cssClassToApply;
    var cssClassToRemove;
    if (isValid === true) {
      cssClassToApply = validCssClass;
      cssClassToRemove = inValidCssClass;
    } else {
      cssClassToApply = inValidCssClass;
      cssClassToRemove = validCssClass;
    }

    if (isMdbMultiCheckbox($element)) {
      // we need to apply specific classes to the checkbox group control

      // add a class to the top level label which is the overall parent of all of the checkboxes
      var parentLabel = getClosestMdbMultiCheckboxContainer($element).find("label").first();
      if (parentLabel.length > 0) {
        parentLabel.addClass("CheckboxGroup-ParentLabel-" + cssClassToApply).removeClass("CheckboxGroup-ParentLabel-" + cssClassToRemove);
      }

      // add a class to the label which is next to the checkbox
      var checkboxLabel = $element.next("label");
      if (checkboxLabel.length > 0) {
        checkboxLabel.addClass("CheckboxGroup-CheckboxLabel-" + cssClassToApply).removeClass("CheckboxGroup-CheckboxLabel-" + cssClassToRemove);
      }
    }
  }


  ///////////////////////////////////////////////////////////////
  // method to add dynamic fields to the validator to avoid manually building up rules
  // in your code call it like this: $.validator.unobtrusive.parseDynamicContent(your selector)
  ///////////////////////////////////////////////////////////////
  jQuery.validator.unobtrusive.parseDynamicContent = function (selector) {
    jQuery.validator.unobtrusive.parse(selector);
    let $form = $(selector).first().closest('form');
    let unobtrusiveValidation = $form.data('unobtrusiveValidation');
    let validator = $form.validate();

    // get the unobstrusive validators and jquery validators and compare the two
    // only add if rule(s) not already in place
    jQuery.each(unobtrusiveValidation.options.rules, function (elementName, elementRules) {
      let args = {};
      if (validator.settings.rules[elementName] == undefined) {
        jQuery.extend(args, elementRules);
        args.messages = unobtrusiveValidation.options.messages[elementName];
        $("[name='" + elementName + "']").rules("add", args);
      } else {
        jQuery.each(elementRules, function (rulename, data) {
          if (validator.settings.rules[elementName][rulename] == undefined) {
            args[rulename] = data;
            args.messages = unobtrusiveValidation.options.messages[elementName][rulename];
            $("[name='" + elementName + "']").rules("add", args);
          }
        });
      }
    });
  }

  ///////////////////////////////////////////////////////////////
  // customise the default error highlighting and placement
  ///////////////////////////////////////////////////////////////
  var defaultOptions = {
    highlight: function (element, errorClass, validClass) {
      var $element = $(element);
      if (isMdbForm($element)) {
        $element.addClass("is-invalid").removeClass("is-valid");
        applyCheckboxGroupClasses($element, false);
      }
      else {
        $element.closest(".field-container").addClass(errorClass).removeClass(validClass);
      }
    },
    unhighlight: function (element, errorClass, validClass) {
      var $element = $(element);
      if (isMdbForm($element)) {
        $element.removeClass("is-invalid").addClass("is-valid");
        applyCheckboxGroupClasses($element, true);
      }
      else {
        $element.closest(".field-container").removeClass(errorClass).addClass(validClass);
      }
    }
  };

  jQuery.validator.setDefaults(defaultOptions);

  jQuery.validator.unobtrusive.options =
    {
      errorClass: defaultOptions.errorClass,
      errorPlacement: function (error, element) {
        if (isMdbMultiCheckbox(element)) {
          error.appendTo(getClosestMdbMultiCheckboxContainer(element).find("#checkboxGroupError"));
        }
      }
    };

  ///////////////////////////////////////////////////////////////
  // custom validation adapters
  ///////////////////////////////////////////////////////////////

  // add custom adapters
  jQuery.validator.unobtrusive.adapters.add("requiredif", ["dependentproperty", "desiredvalue"], function (options) {
    options.rules["requiredif"] = options.params;
    options.messages["requiredif"] = options.message;
  });

  jQuery.validator.unobtrusive.adapters.add("minlengthrequiredif", ["dependentproperty", "desiredvalue", "minlength"], function (options) {
    options.rules["minlengthrequiredif"] = options.params;
    options.messages["minlengthrequiredif"] = options.message;
  });

  jQuery.validator.unobtrusive.adapters.add("mustbetrue", [], function (options) {
    options.rules["mustbetrue"] = options.params;
    options.messages["mustbetrue"] = options.message;
  });

  jQuery.validator.unobtrusive.adapters.add("atleastonerequired", [], function (options) {
    options.rules["atleastonerequired"] = options.params;
    options.messages["atleastonerequired"] = options.message;
  });

  jQuery.validator.unobtrusive.adapters.add("datebetween", ["mindateproperty", "maxdateproperty"], function (options) {
    options.rules["datebetween"] = options.params;
    if (options.message) {
      jQuery.validator.messages.datebetween = options.message;
    }
  });

  jQuery.validator.unobtrusive.adapters.add("dateregex", ["datepattern"], function (options) {
    options.rules["dateregex"] = options.params;
    if (options.message) {
      jQuery.validator.messages.dateregex = options.message;
    }
  });

  jQuery.validator.unobtrusive.adapters.add("daterange", ["mindateproperty", "maxdateproperty", "dateformat"], function (options) {
    options.rules["daterange"] = options.params;
    if (options.message) {
      jQuery.validator.messages.daterange = options.message;
    }
  });

  jQuery.validator.unobtrusive.adapters.add("dateonorbeforetoday", ["excludetoday", "dateformat"], function (options) {
    options.rules["dateonorbeforetoday"] = options.params;
    options.messages["dateonorbeforetoday"] = options.message;
  });

  function propertyValueMatchesDependentPropertyValue(element, parameters) {
    var desiredvalue = parameters.desiredvalue;
    desiredvalue = (desiredvalue == null ? '' : desiredvalue).toString();

    // find dependent property - usually will be an id but it can exist inside foreach
    // if the 'forEachIndex' attribute exists, append it to the id name so we can target the correct element in a list
    let forEachIndex = jQuery(element).attr('forEachIndex');
    let dependentPropertyId = forEachIndex ? parameters.dependentproperty + forEachIndex : parameters.dependentproperty;

    // check the input type and get it's value
    let controlType = $("input[id$='" + dependentPropertyId + "']").attr("type");
    var actualvalue = controlType === "radio" ? $("input[id$='" + dependentPropertyId + "']:checked").val() : $("#" + dependentPropertyId).val();

    return ($.trim(desiredvalue).toLowerCase() === $.trim(actualvalue).toLocaleLowerCase());
  }

  // required if validator
  jQuery.validator.addMethod("requiredif", function (value, element, parameters) {
    
    if (propertyValueMatchesDependentPropertyValue(element, parameters)) {
      var isValid = $.validator.methods.required.call(this, value, element, parameters);
      return isValid;
    }

    return true;
  });

  // min length required if validator
  jQuery.validator.addMethod('minlengthrequiredif', function (value, element, parameters) {
    let minlength = parameters.minlength;

    if (propertyValueMatchesDependentPropertyValue(element, parameters)) {
      return (value.length >= minlength);
    }

    return true;
  });

  // must be true validator
  jQuery.validator.addMethod("mustbetrue", function (value, element) {

    // if it's a checkbox return true if it is checked
    return element.type === 'checkbox' ? element.checked : value === "true";
  });

  // date
  jQuery.validator.addMethod("date", function (value, element) {
    // if no value dont validate
    if (!value || value === "") {
      return true;
    }

    this.settings.messages[element.name]['date'] = function () { return jQuery.validator.messages.date; };      
    var date_regex = /^\d{2}\/\d{2}\/\d{4}$/;
    return date_regex.test(value);
  });

  // required if validator
  jQuery.validator.addMethod("atleastonerequired", function (value, element) {

    // Check if any are checked
    var type = element.type;
    var elements = jQuery("input[name='" + element.name + "']");

    if (type === "checkbox" || type === "radio") {
      return elements.is(":checked");
    }

    return elements.is(":selected");
  });

  jQuery.validator.addMethod("datebetween", function (value, element, parameters) {
    var minValue = jQuery("#" + parameters.mindateproperty).val();
    var maxValue = jQuery("#" + parameters.maxdateproperty).val();

    var sourceDate = new Date(value);
    var minDate = new Date(minValue);
    var maxDate = new Date(maxValue);
    var message = jQuery(element).attr('data-val-datebetween');

    var isValid = (!value || !minValue || !maxValue) || sourceDate.toSortableString() >= minDate.toSortableString() && sourceDate.toSortableString() <= maxDate.toSortableString();
    if (!isValid) {
      jQuery.validator.messages.datebetween = message.replace("{0}", minDate.toMMDDYYYY()).replace("{1}", maxDate.toMMDDYYYY());
    }

    return isValid;
  });

  // date regex
  jQuery.validator.addMethod("dateregex", function (value, element, parameters) {
    var dateRegex = new RegExp(parameters.datepattern);

    var isValid = dateRegex.test(value);
    if (!isValid) {
      var errorMessage = jQuery(element).attr('data-val-dateregex');
      jQuery.validator.messages.dateregex = errorMessage
    }

    return isValid;
  });

  // date range
  jQuery.validator.addMethod("daterange", function (value, element, parameters) {
    var isValid = false;

    if (typeof moment !== 'undefined') {
      var minValue = jQuery("#" + parameters.mindateproperty).val();
      var maxValue = jQuery("#" + parameters.maxdateproperty).val();

      // adjust date format to moment year, month and day tokens
      var dateFormat = parameters.dateformat.toUpperCase();

      var sourceDate = moment(value, dateFormat).toDate();
      var minDate = moment(minValue, dateFormat).toDate();
      var maxDate = moment(maxValue, dateFormat).toDate();

      var isValid = (!value || !minValue || !maxValue) || (sourceDate.toSortableString() >= minDate.toSortableString() && sourceDate.toSortableString() <= maxDate.toSortableString());
      if (!isValid) {
        var errorMessage = jQuery(element).attr('data-val-daterange');
        jQuery.validator.messages.daterange = errorMessage.replace("{0}", moment(minDate).format(dateFormat)).replace("{1}", moment(maxDate).format(dateFormat));
      }
    } else {
      console.error("moment.js is not available");
    }

    return isValid;
  });

  jQuery.validator.addMethod("dateonorbeforetoday", function (value, element, parameters) {
    if (typeof moment === 'undefined') {
      console.error("moment.js is not available");
      return false;
    }

    var dateFormat = parameters.dateformat.toUpperCase();
    var sourceDate = moment(value, dateFormat).toDate();
    var today = moment(Date.now());
    if (parameters.excludetoday === 'false') {
      today.add(1, 'd');
    }
    compareDate = today.toDate();

    var isValid = !sourceDate || !compareDate || sourceDate.toSortableString() < compareDate.toSortableString();

    return isValid;
  });

  $.validator.unobtrusive.adapters.add("validatedob", ["dateformat"], function (options) {
    options.rules["validatedob"] = options.params;

    if (options.message) {
      options.messages["validatedob"] = options.message;
    }
    else {
      options.messages["validatedob"] = "Invalid Date of Birth";
    }
  });

  $.validator.addMethod("validatedob", function (value, element, params) {
    if (!value) {
      return true;
    }

    if (typeof moment === 'undefined') {
      console.error("moment.js is not available");
      return false;
    }

    let inputDateFormat = "MM/DD/YYYY";

    if (params.dateformat) {
      inputDateFormat = params.dateformat.toUpperCase();
    }  

    let input = moment(value, inputDateFormat);

    let minDate = moment("01/01/1900", "MM/DD/YYYY");
    let today = moment(Date.now());

    return input.isSameOrAfter(minDate) && input.isSameOrBefore(today);
  });

  ///////////////////////////////////////////////////////////////
  // END: custom validation adapters
  ///////////////////////////////////////////////////////////////

})(jQuery);
;
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var H;function _(){return H.apply(null,arguments)}function y(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function F(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function c(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function L(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;for(var t in e)if(c(e,t))return;return 1}function g(e){return void 0===e}function w(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function V(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function G(e,t){for(var n=[],s=e.length,i=0;i<s;++i)n.push(t(e[i],i));return n}function E(e,t){for(var n in t)c(t,n)&&(e[n]=t[n]);return c(t,"toString")&&(e.toString=t.toString),c(t,"valueOf")&&(e.valueOf=t.valueOf),e}function l(e,t,n,s){return Wt(e,t,n,s,!0).utc()}function p(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function A(e){var t,n,s=e._d&&!isNaN(e._d.getTime());return s&&(t=p(e),n=j.call(t.parsedDateParts,function(e){return null!=e}),s=t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n),e._strict)&&(s=s&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e)?s:(e._isValid=s,e._isValid)}function I(e){var t=l(NaN);return null!=e?E(p(t),e):p(t).userInvalidated=!0,t}var j=Array.prototype.some||function(e){for(var t=Object(this),n=t.length>>>0,s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1},Z=_.momentProperties=[],z=!1;function q(e,t){var n,s,i,r=Z.length;if(g(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),g(t._i)||(e._i=t._i),g(t._f)||(e._f=t._f),g(t._l)||(e._l=t._l),g(t._strict)||(e._strict=t._strict),g(t._tzm)||(e._tzm=t._tzm),g(t._isUTC)||(e._isUTC=t._isUTC),g(t._offset)||(e._offset=t._offset),g(t._pf)||(e._pf=p(t)),g(t._locale)||(e._locale=t._locale),0<r)for(n=0;n<r;n++)g(i=t[s=Z[n]])||(e[s]=i);return e}function $(e){q(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===z&&(z=!0,_.updateOffset(this),z=!1)}function k(e){return e instanceof $||null!=e&&null!=e._isAMomentObject}function B(e){!1===_.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function e(r,a){var o=!0;return E(function(){if(null!=_.deprecationHandler&&_.deprecationHandler(null,r),o){for(var e,t,n=[],s=arguments.length,i=0;i<s;i++){if(e="","object"==typeof arguments[i]){for(t in e+="\n["+i+"] ",arguments[0])c(arguments[0],t)&&(e+=t+": "+arguments[0][t]+", ");e=e.slice(0,-2)}else e=arguments[i];n.push(e)}B(r+"\nArguments: "+Array.prototype.slice.call(n).join("")+"\n"+(new Error).stack),o=!1}return a.apply(this,arguments)},a)}var J={};function Q(e,t){null!=_.deprecationHandler&&_.deprecationHandler(e,t),J[e]||(B(t),J[e]=!0)}function a(e){return"undefined"!=typeof Function&&e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function X(e,t){var n,s=E({},e);for(n in t)c(t,n)&&(F(e[n])&&F(t[n])?(s[n]={},E(s[n],e[n]),E(s[n],t[n])):null!=t[n]?s[n]=t[n]:delete s[n]);for(n in e)c(e,n)&&!c(t,n)&&F(e[n])&&(s[n]=E({},s[n]));return s}function K(e){null!=e&&this.set(e)}_.suppressDeprecationWarnings=!1,_.deprecationHandler=null;var ee=Object.keys||function(e){var t,n=[];for(t in e)c(e,t)&&n.push(t);return n};function r(e,t,n){var s=""+Math.abs(e);return(0<=e?n?"+":"":"-")+Math.pow(10,Math.max(0,t-s.length)).toString().substr(1)+s}var te=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,ne=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,se={},ie={};function s(e,t,n,s){var i="string"==typeof s?function(){return this[s]()}:s;e&&(ie[e]=i),t&&(ie[t[0]]=function(){return r(i.apply(this,arguments),t[1],t[2])}),n&&(ie[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function re(e,t){return e.isValid()?(t=ae(t,e.localeData()),se[t]=se[t]||function(s){for(var e,i=s.match(te),t=0,r=i.length;t<r;t++)ie[i[t]]?i[t]=ie[i[t]]:i[t]=(e=i[t]).match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"");return function(e){for(var t="",n=0;n<r;n++)t+=a(i[n])?i[n].call(e,s):i[n];return t}}(t),se[t](e)):e.localeData().invalidDate()}function ae(e,t){var n=5;function s(e){return t.longDateFormat(e)||e}for(ne.lastIndex=0;0<=n&&ne.test(e);)e=e.replace(ne,s),ne.lastIndex=0,--n;return e}var oe={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function o(e){return"string"==typeof e?oe[e]||oe[e.toLowerCase()]:void 0}function ue(e){var t,n,s={};for(n in e)c(e,n)&&(t=o(n))&&(s[t]=e[n]);return s}var le={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};var de=/\d/,t=/\d\d/,he=/\d{3}/,ce=/\d{4}/,fe=/[+-]?\d{6}/,n=/\d\d?/,me=/\d\d\d\d?/,_e=/\d\d\d\d\d\d?/,ye=/\d{1,3}/,ge=/\d{1,4}/,we=/[+-]?\d{1,6}/,pe=/\d+/,ke=/[+-]?\d+/,Me=/Z|[+-]\d\d:?\d\d/gi,ve=/Z|[+-]\d\d(?::?\d\d)?/gi,i=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,u=/^[1-9]\d?/,d=/^([1-9]\d|\d)/;function h(e,n,s){Ye[e]=a(n)?n:function(e,t){return e&&s?s:n}}function De(e,t){return c(Ye,e)?Ye[e](t._strict,t._locale):new RegExp(f(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,s,i){return t||n||s||i})))}function f(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function m(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function M(e){var e=+e,t=0;return t=0!=e&&isFinite(e)?m(e):t}var Ye={},Se={};function v(e,n){var t,s,i=n;for("string"==typeof e&&(e=[e]),w(n)&&(i=function(e,t){t[n]=M(e)}),s=e.length,t=0;t<s;t++)Se[e[t]]=i}function Oe(e,i){v(e,function(e,t,n,s){n._w=n._w||{},i(e,n._w,n,s)})}function be(e){return e%4==0&&e%100!=0||e%400==0}var D=0,Y=1,S=2,O=3,b=4,T=5,Te=6,xe=7,Ne=8;function We(e){return be(e)?366:365}s("Y",0,0,function(){var e=this.year();return e<=9999?r(e,4):"+"+e}),s(0,["YY",2],0,function(){return this.year()%100}),s(0,["YYYY",4],0,"year"),s(0,["YYYYY",5],0,"year"),s(0,["YYYYYY",6,!0],0,"year"),h("Y",ke),h("YY",n,t),h("YYYY",ge,ce),h("YYYYY",we,fe),h("YYYYYY",we,fe),v(["YYYYY","YYYYYY"],D),v("YYYY",function(e,t){t[D]=2===e.length?_.parseTwoDigitYear(e):M(e)}),v("YY",function(e,t){t[D]=_.parseTwoDigitYear(e)}),v("Y",function(e,t){t[D]=parseInt(e,10)}),_.parseTwoDigitYear=function(e){return M(e)+(68<M(e)?1900:2e3)};var x,Pe=Re("FullYear",!0);function Re(t,n){return function(e){return null!=e?(Ue(this,t,e),_.updateOffset(this,n),this):Ce(this,t)}}function Ce(e,t){if(!e.isValid())return NaN;var n=e._d,s=e._isUTC;switch(t){case"Milliseconds":return s?n.getUTCMilliseconds():n.getMilliseconds();case"Seconds":return s?n.getUTCSeconds():n.getSeconds();case"Minutes":return s?n.getUTCMinutes():n.getMinutes();case"Hours":return s?n.getUTCHours():n.getHours();case"Date":return s?n.getUTCDate():n.getDate();case"Day":return s?n.getUTCDay():n.getDay();case"Month":return s?n.getUTCMonth():n.getMonth();case"FullYear":return s?n.getUTCFullYear():n.getFullYear();default:return NaN}}function Ue(e,t,n){var s,i,r;if(e.isValid()&&!isNaN(n)){switch(s=e._d,i=e._isUTC,t){case"Milliseconds":return i?s.setUTCMilliseconds(n):s.setMilliseconds(n);case"Seconds":return i?s.setUTCSeconds(n):s.setSeconds(n);case"Minutes":return i?s.setUTCMinutes(n):s.setMinutes(n);case"Hours":return i?s.setUTCHours(n):s.setHours(n);case"Date":return i?s.setUTCDate(n):s.setDate(n);case"FullYear":break;default:return}t=n,r=e.month(),e=29!==(e=e.date())||1!==r||be(t)?e:28,i?s.setUTCFullYear(t,r,e):s.setFullYear(t,r,e)}}function He(e,t){var n;return isNaN(e)||isNaN(t)?NaN:(n=(t%(n=12)+n)%n,e+=(t-n)/12,1==n?be(e)?29:28:31-n%7%2)}x=Array.prototype.indexOf||function(e){for(var t=0;t<this.length;++t)if(this[t]===e)return t;return-1},s("M",["MM",2],"Mo",function(){return this.month()+1}),s("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),s("MMMM",0,0,function(e){return this.localeData().months(this,e)}),h("M",n,u),h("MM",n,t),h("MMM",function(e,t){return t.monthsShortRegex(e)}),h("MMMM",function(e,t){return t.monthsRegex(e)}),v(["M","MM"],function(e,t){t[Y]=M(e)-1}),v(["MMM","MMMM"],function(e,t,n,s){s=n._locale.monthsParse(e,s,n._strict);null!=s?t[Y]=s:p(n).invalidMonth=e});var Fe="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Le="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Ve=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ge=i,Ee=i;function Ae(e,t){if(e.isValid()){if("string"==typeof t)if(/^\d+$/.test(t))t=M(t);else if(!w(t=e.localeData().monthsParse(t)))return;var n=(n=e.date())<29?n:Math.min(n,He(e.year(),t));e._isUTC?e._d.setUTCMonth(t,n):e._d.setMonth(t,n)}}function Ie(e){return null!=e?(Ae(this,e),_.updateOffset(this,!0),this):Ce(this,"Month")}function je(){function e(e,t){return t.length-e.length}for(var t,n,s=[],i=[],r=[],a=0;a<12;a++)n=l([2e3,a]),t=f(this.monthsShort(n,"")),n=f(this.months(n,"")),s.push(t),i.push(n),r.push(n),r.push(t);s.sort(e),i.sort(e),r.sort(e),this._monthsRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+s.join("|")+")","i")}function Ze(e,t,n,s,i,r,a){var o;return e<100&&0<=e?(o=new Date(e+400,t,n,s,i,r,a),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,s,i,r,a),o}function ze(e){var t;return e<100&&0<=e?((t=Array.prototype.slice.call(arguments))[0]=e+400,t=new Date(Date.UTC.apply(null,t)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function qe(e,t,n){n=7+t-n;return n-(7+ze(e,0,n).getUTCDay()-t)%7-1}function $e(e,t,n,s,i){var r,t=1+7*(t-1)+(7+n-s)%7+qe(e,s,i),n=t<=0?We(r=e-1)+t:t>We(e)?(r=e+1,t-We(e)):(r=e,t);return{year:r,dayOfYear:n}}function Be(e,t,n){var s,i,r=qe(e.year(),t,n),r=Math.floor((e.dayOfYear()-r-1)/7)+1;return r<1?s=r+N(i=e.year()-1,t,n):r>N(e.year(),t,n)?(s=r-N(e.year(),t,n),i=e.year()+1):(i=e.year(),s=r),{week:s,year:i}}function N(e,t,n){var s=qe(e,t,n),t=qe(e+1,t,n);return(We(e)-s+t)/7}s("w",["ww",2],"wo","week"),s("W",["WW",2],"Wo","isoWeek"),h("w",n,u),h("ww",n,t),h("W",n,u),h("WW",n,t),Oe(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=M(e)});function Je(e,t){return e.slice(t,7).concat(e.slice(0,t))}s("d",0,"do","day"),s("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),s("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),s("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),s("e",0,0,"weekday"),s("E",0,0,"isoWeekday"),h("d",n),h("e",n),h("E",n),h("dd",function(e,t){return t.weekdaysMinRegex(e)}),h("ddd",function(e,t){return t.weekdaysShortRegex(e)}),h("dddd",function(e,t){return t.weekdaysRegex(e)}),Oe(["dd","ddd","dddd"],function(e,t,n,s){s=n._locale.weekdaysParse(e,s,n._strict);null!=s?t.d=s:p(n).invalidWeekday=e}),Oe(["d","e","E"],function(e,t,n,s){t[s]=M(e)});var Qe="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Xe="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Ke="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),et=i,tt=i,nt=i;function st(){function e(e,t){return t.length-e.length}for(var t,n,s,i=[],r=[],a=[],o=[],u=0;u<7;u++)s=l([2e3,1]).day(u),t=f(this.weekdaysMin(s,"")),n=f(this.weekdaysShort(s,"")),s=f(this.weekdays(s,"")),i.push(t),r.push(n),a.push(s),o.push(t),o.push(n),o.push(s);i.sort(e),r.sort(e),a.sort(e),o.sort(e),this._weekdaysRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+i.join("|")+")","i")}function it(){return this.hours()%12||12}function rt(e,t){s(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function at(e,t){return t._meridiemParse}s("H",["HH",2],0,"hour"),s("h",["hh",2],0,it),s("k",["kk",2],0,function(){return this.hours()||24}),s("hmm",0,0,function(){return""+it.apply(this)+r(this.minutes(),2)}),s("hmmss",0,0,function(){return""+it.apply(this)+r(this.minutes(),2)+r(this.seconds(),2)}),s("Hmm",0,0,function(){return""+this.hours()+r(this.minutes(),2)}),s("Hmmss",0,0,function(){return""+this.hours()+r(this.minutes(),2)+r(this.seconds(),2)}),rt("a",!0),rt("A",!1),h("a",at),h("A",at),h("H",n,d),h("h",n,u),h("k",n,u),h("HH",n,t),h("hh",n,t),h("kk",n,t),h("hmm",me),h("hmmss",_e),h("Hmm",me),h("Hmmss",_e),v(["H","HH"],O),v(["k","kk"],function(e,t,n){e=M(e);t[O]=24===e?0:e}),v(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),v(["h","hh"],function(e,t,n){t[O]=M(e),p(n).bigHour=!0}),v("hmm",function(e,t,n){var s=e.length-2;t[O]=M(e.substr(0,s)),t[b]=M(e.substr(s)),p(n).bigHour=!0}),v("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[O]=M(e.substr(0,s)),t[b]=M(e.substr(s,2)),t[T]=M(e.substr(i)),p(n).bigHour=!0}),v("Hmm",function(e,t,n){var s=e.length-2;t[O]=M(e.substr(0,s)),t[b]=M(e.substr(s))}),v("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[O]=M(e.substr(0,s)),t[b]=M(e.substr(s,2)),t[T]=M(e.substr(i))});i=Re("Hours",!0);var ot,ut={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Fe,monthsShort:Le,week:{dow:0,doy:6},weekdays:Qe,weekdaysMin:Ke,weekdaysShort:Xe,meridiemParse:/[ap]\.?m?\.?/i},W={},lt={};function dt(e){return e&&e.toLowerCase().replace("_","-")}function ht(e){for(var t,n,s,i,r=0;r<e.length;){for(t=(i=dt(e[r]).split("-")).length,n=(n=dt(e[r+1]))?n.split("-"):null;0<t;){if(s=ct(i.slice(0,t).join("-")))return s;if(n&&n.length>=t&&function(e,t){for(var n=Math.min(e.length,t.length),s=0;s<n;s+=1)if(e[s]!==t[s])return s;return n}(i,n)>=t-1)break;t--}r++}return ot}function ct(t){var e,n;if(void 0===W[t]&&"undefined"!=typeof module&&module&&module.exports&&(n=t)&&n.match("^[^/\\\\]*$"))try{e=ot._abbr,require("./locale/"+t),ft(e)}catch(e){W[t]=null}return W[t]}function ft(e,t){return e&&((t=g(t)?P(e):mt(e,t))?ot=t:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),ot._abbr}function mt(e,t){if(null===t)return delete W[e],null;var n,s=ut;if(t.abbr=e,null!=W[e])Q("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=W[e]._config;else if(null!=t.parentLocale)if(null!=W[t.parentLocale])s=W[t.parentLocale]._config;else{if(null==(n=ct(t.parentLocale)))return lt[t.parentLocale]||(lt[t.parentLocale]=[]),lt[t.parentLocale].push({name:e,config:t}),null;s=n._config}return W[e]=new K(X(s,t)),lt[e]&&lt[e].forEach(function(e){mt(e.name,e.config)}),ft(e),W[e]}function P(e){var t;if(!(e=e&&e._locale&&e._locale._abbr?e._locale._abbr:e))return ot;if(!y(e)){if(t=ct(e))return t;e=[e]}return ht(e)}function _t(e){var t=e._a;return t&&-2===p(e).overflow&&(t=t[Y]<0||11<t[Y]?Y:t[S]<1||t[S]>He(t[D],t[Y])?S:t[O]<0||24<t[O]||24===t[O]&&(0!==t[b]||0!==t[T]||0!==t[Te])?O:t[b]<0||59<t[b]?b:t[T]<0||59<t[T]?T:t[Te]<0||999<t[Te]?Te:-1,p(e)._overflowDayOfYear&&(t<D||S<t)&&(t=S),p(e)._overflowWeeks&&-1===t&&(t=xe),p(e)._overflowWeekday&&-1===t&&(t=Ne),p(e).overflow=t),e}var yt=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,gt=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,wt=/Z|[+-]\d\d(?::?\d\d)?/,pt=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],kt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Mt=/^\/?Date\((-?\d+)/i,vt=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Dt={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Yt(e){var t,n,s,i,r,a,o=e._i,u=yt.exec(o)||gt.exec(o),o=pt.length,l=kt.length;if(u){for(p(e).iso=!0,t=0,n=o;t<n;t++)if(pt[t][1].exec(u[1])){i=pt[t][0],s=!1!==pt[t][2];break}if(null==i)e._isValid=!1;else{if(u[3]){for(t=0,n=l;t<n;t++)if(kt[t][1].exec(u[3])){r=(u[2]||" ")+kt[t][0];break}if(null==r)return void(e._isValid=!1)}if(s||null==r){if(u[4]){if(!wt.exec(u[4]))return void(e._isValid=!1);a="Z"}e._f=i+(r||"")+(a||""),xt(e)}else e._isValid=!1}}else e._isValid=!1}function St(e,t,n,s,i,r){e=[function(e){e=parseInt(e,10);{if(e<=49)return 2e3+e;if(e<=999)return 1900+e}return e}(e),Le.indexOf(t),parseInt(n,10),parseInt(s,10),parseInt(i,10)];return r&&e.push(parseInt(r,10)),e}function Ot(e){var t,n,s=vt.exec(e._i.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));s?(t=St(s[4],s[3],s[2],s[5],s[6],s[7]),function(e,t,n){if(!e||Xe.indexOf(e)===new Date(t[0],t[1],t[2]).getDay())return 1;p(n).weekdayMismatch=!0,n._isValid=!1}(s[1],t,e)&&(e._a=t,e._tzm=(t=s[8],n=s[9],s=s[10],t?Dt[t]:n?0:60*(((t=parseInt(s,10))-(n=t%100))/100)+n),e._d=ze.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),p(e).rfc2822=!0)):e._isValid=!1}function bt(e,t,n){return null!=e?e:null!=t?t:n}function Tt(e){var t,n,s,i,r,a,o,u,l,d,h,c=[];if(!e._d){for(s=e,i=new Date(_.now()),n=s._useUTC?[i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate()]:[i.getFullYear(),i.getMonth(),i.getDate()],e._w&&null==e._a[S]&&null==e._a[Y]&&(null!=(i=(s=e)._w).GG||null!=i.W||null!=i.E?(u=1,l=4,r=bt(i.GG,s._a[D],Be(R(),1,4).year),a=bt(i.W,1),((o=bt(i.E,1))<1||7<o)&&(d=!0)):(u=s._locale._week.dow,l=s._locale._week.doy,h=Be(R(),u,l),r=bt(i.gg,s._a[D],h.year),a=bt(i.w,h.week),null!=i.d?((o=i.d)<0||6<o)&&(d=!0):null!=i.e?(o=i.e+u,(i.e<0||6<i.e)&&(d=!0)):o=u),a<1||a>N(r,u,l)?p(s)._overflowWeeks=!0:null!=d?p(s)._overflowWeekday=!0:(h=$e(r,a,o,u,l),s._a[D]=h.year,s._dayOfYear=h.dayOfYear)),null!=e._dayOfYear&&(i=bt(e._a[D],n[D]),(e._dayOfYear>We(i)||0===e._dayOfYear)&&(p(e)._overflowDayOfYear=!0),d=ze(i,0,e._dayOfYear),e._a[Y]=d.getUTCMonth(),e._a[S]=d.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=c[t]=n[t];for(;t<7;t++)e._a[t]=c[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[O]&&0===e._a[b]&&0===e._a[T]&&0===e._a[Te]&&(e._nextDay=!0,e._a[O]=0),e._d=(e._useUTC?ze:Ze).apply(null,c),r=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[O]=24),e._w&&void 0!==e._w.d&&e._w.d!==r&&(p(e).weekdayMismatch=!0)}}function xt(e){if(e._f===_.ISO_8601)Yt(e);else if(e._f===_.RFC_2822)Ot(e);else{e._a=[],p(e).empty=!0;for(var t,n,s,i,r,a=""+e._i,o=a.length,u=0,l=ae(e._f,e._locale).match(te)||[],d=l.length,h=0;h<d;h++)n=l[h],(t=(a.match(De(n,e))||[])[0])&&(0<(s=a.substr(0,a.indexOf(t))).length&&p(e).unusedInput.push(s),a=a.slice(a.indexOf(t)+t.length),u+=t.length),ie[n]?(t?p(e).empty=!1:p(e).unusedTokens.push(n),s=n,r=e,null!=(i=t)&&c(Se,s)&&Se[s](i,r._a,r,s)):e._strict&&!t&&p(e).unusedTokens.push(n);p(e).charsLeftOver=o-u,0<a.length&&p(e).unusedInput.push(a),e._a[O]<=12&&!0===p(e).bigHour&&0<e._a[O]&&(p(e).bigHour=void 0),p(e).parsedDateParts=e._a.slice(0),p(e).meridiem=e._meridiem,e._a[O]=function(e,t,n){if(null==n)return t;return null!=e.meridiemHour?e.meridiemHour(t,n):null!=e.isPM?((e=e.isPM(n))&&t<12&&(t+=12),t=e||12!==t?t:0):t}(e._locale,e._a[O],e._meridiem),null!==(o=p(e).era)&&(e._a[D]=e._locale.erasConvertYear(o,e._a[D])),Tt(e),_t(e)}}function Nt(e){var t,n,s,i=e._i,r=e._f;if(e._locale=e._locale||P(e._l),null===i||void 0===r&&""===i)return I({nullInput:!0});if("string"==typeof i&&(e._i=i=e._locale.preparse(i)),k(i))return new $(_t(i));if(V(i))e._d=i;else if(y(r)){var a,o,u,l,d,h,c=e,f=!1,m=c._f.length;if(0===m)p(c).invalidFormat=!0,c._d=new Date(NaN);else{for(l=0;l<m;l++)d=0,h=!1,a=q({},c),null!=c._useUTC&&(a._useUTC=c._useUTC),a._f=c._f[l],xt(a),A(a)&&(h=!0),d=(d+=p(a).charsLeftOver)+10*p(a).unusedTokens.length,p(a).score=d,f?d<u&&(u=d,o=a):(null==u||d<u||h)&&(u=d,o=a,h)&&(f=!0);E(c,o||a)}}else if(r)xt(e);else if(g(r=(i=e)._i))i._d=new Date(_.now());else V(r)?i._d=new Date(r.valueOf()):"string"==typeof r?(n=i,null!==(t=Mt.exec(n._i))?n._d=new Date(+t[1]):(Yt(n),!1===n._isValid&&(delete n._isValid,Ot(n),!1===n._isValid)&&(delete n._isValid,n._strict?n._isValid=!1:_.createFromInputFallback(n)))):y(r)?(i._a=G(r.slice(0),function(e){return parseInt(e,10)}),Tt(i)):F(r)?(t=i)._d||(s=void 0===(n=ue(t._i)).day?n.date:n.day,t._a=G([n.year,n.month,s,n.hour,n.minute,n.second,n.millisecond],function(e){return e&&parseInt(e,10)}),Tt(t)):w(r)?i._d=new Date(r):_.createFromInputFallback(i);return A(e)||(e._d=null),e}function Wt(e,t,n,s,i){var r={};return!0!==t&&!1!==t||(s=t,t=void 0),!0!==n&&!1!==n||(s=n,n=void 0),(F(e)&&L(e)||y(e)&&0===e.length)&&(e=void 0),r._isAMomentObject=!0,r._useUTC=r._isUTC=i,r._l=n,r._i=e,r._f=t,r._strict=s,(i=new $(_t(Nt(i=r))))._nextDay&&(i.add(1,"d"),i._nextDay=void 0),i}function R(e,t,n,s){return Wt(e,t,n,s,!1)}_.createFromInputFallback=e("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),_.ISO_8601=function(){},_.RFC_2822=function(){};me=e("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=R.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:I()}),_e=e("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=R.apply(null,arguments);return this.isValid()&&e.isValid()?this<e?this:e:I()});function Pt(e,t){var n,s;if(!(t=1===t.length&&y(t[0])?t[0]:t).length)return R();for(n=t[0],s=1;s<t.length;++s)t[s].isValid()&&!t[s][e](n)||(n=t[s]);return n}var Rt=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Ct(e){var e=ue(e),t=e.year||0,n=e.quarter||0,s=e.month||0,i=e.week||e.isoWeek||0,r=e.day||0,a=e.hour||0,o=e.minute||0,u=e.second||0,l=e.millisecond||0;this._isValid=function(e){var t,n,s=!1,i=Rt.length;for(t in e)if(c(e,t)&&(-1===x.call(Rt,t)||null!=e[t]&&isNaN(e[t])))return!1;for(n=0;n<i;++n)if(e[Rt[n]]){if(s)return!1;parseFloat(e[Rt[n]])!==M(e[Rt[n]])&&(s=!0)}return!0}(e),this._milliseconds=+l+1e3*u+6e4*o+1e3*a*60*60,this._days=+r+7*i,this._months=+s+3*n+12*t,this._data={},this._locale=P(),this._bubble()}function Ut(e){return e instanceof Ct}function Ht(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function Ft(e,n){s(e,0,0,function(){var e=this.utcOffset(),t="+";return e<0&&(e=-e,t="-"),t+r(~~(e/60),2)+n+r(~~e%60,2)})}Ft("Z",":"),Ft("ZZ",""),h("Z",ve),h("ZZ",ve),v(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Vt(ve,e)});var Lt=/([\+\-]|\d\d)/gi;function Vt(e,t){var t=(t||"").match(e);return null===t?null:0===(t=60*(e=((t[t.length-1]||[])+"").match(Lt)||["-",0,0])[1]+M(e[2]))?0:"+"===e[0]?t:-t}function Gt(e,t){var n;return t._isUTC?(t=t.clone(),n=(k(e)||V(e)?e:R(e)).valueOf()-t.valueOf(),t._d.setTime(t._d.valueOf()+n),_.updateOffset(t,!1),t):R(e).local()}function Et(e){return-Math.round(e._d.getTimezoneOffset())}function At(){return!!this.isValid()&&this._isUTC&&0===this._offset}_.updateOffset=function(){};var It=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,jt=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function C(e,t){var n,s=e;return Ut(e)?s={ms:e._milliseconds,d:e._days,M:e._months}:w(e)||!isNaN(+e)?(s={},t?s[t]=+e:s.milliseconds=+e):(t=It.exec(e))?(n="-"===t[1]?-1:1,s={y:0,d:M(t[S])*n,h:M(t[O])*n,m:M(t[b])*n,s:M(t[T])*n,ms:M(Ht(1e3*t[Te]))*n}):(t=jt.exec(e))?(n="-"===t[1]?-1:1,s={y:Zt(t[2],n),M:Zt(t[3],n),w:Zt(t[4],n),d:Zt(t[5],n),h:Zt(t[6],n),m:Zt(t[7],n),s:Zt(t[8],n)}):null==s?s={}:"object"==typeof s&&("from"in s||"to"in s)&&(t=function(e,t){var n;if(!e.isValid()||!t.isValid())return{milliseconds:0,months:0};t=Gt(t,e),e.isBefore(t)?n=zt(e,t):((n=zt(t,e)).milliseconds=-n.milliseconds,n.months=-n.months);return n}(R(s.from),R(s.to)),(s={}).ms=t.milliseconds,s.M=t.months),n=new Ct(s),Ut(e)&&c(e,"_locale")&&(n._locale=e._locale),Ut(e)&&c(e,"_isValid")&&(n._isValid=e._isValid),n}function Zt(e,t){e=e&&parseFloat(e.replace(",","."));return(isNaN(e)?0:e)*t}function zt(e,t){var n={};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function qt(s,i){return function(e,t){var n;return null===t||isNaN(+t)||(Q(i,"moment()."+i+"(period, number) is deprecated. Please use moment()."+i+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=e,e=t,t=n),$t(this,C(e,t),s),this}}function $t(e,t,n,s){var i=t._milliseconds,r=Ht(t._days),t=Ht(t._months);e.isValid()&&(s=null==s||s,t&&Ae(e,Ce(e,"Month")+t*n),r&&Ue(e,"Date",Ce(e,"Date")+r*n),i&&e._d.setTime(e._d.valueOf()+i*n),s)&&_.updateOffset(e,r||t)}C.fn=Ct.prototype,C.invalid=function(){return C(NaN)};Fe=qt(1,"add"),Qe=qt(-1,"subtract");function Bt(e){return"string"==typeof e||e instanceof String}function Jt(e){return k(e)||V(e)||Bt(e)||w(e)||function(t){var e=y(t),n=!1;e&&(n=0===t.filter(function(e){return!w(e)&&Bt(t)}).length);return e&&n}(e)||function(e){var t,n,s=F(e)&&!L(e),i=!1,r=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],a=r.length;for(t=0;t<a;t+=1)n=r[t],i=i||c(e,n);return s&&i}(e)||null==e}function Qt(e,t){var n,s;return e.date()<t.date()?-Qt(t,e):-((n=12*(t.year()-e.year())+(t.month()-e.month()))+(t-(s=e.clone().add(n,"months"))<0?(t-s)/(s-e.clone().add(n-1,"months")):(t-s)/(e.clone().add(1+n,"months")-s)))||0}function Xt(e){return void 0===e?this._locale._abbr:(null!=(e=P(e))&&(this._locale=e),this)}_.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",_.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";Ke=e("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function Kt(){return this._locale}var en=126227808e5;function tn(e,t){return(e%t+t)%t}function nn(e,t,n){return e<100&&0<=e?new Date(e+400,t,n)-en:new Date(e,t,n).valueOf()}function sn(e,t,n){return e<100&&0<=e?Date.UTC(e+400,t,n)-en:Date.UTC(e,t,n)}function rn(e,t){return t.erasAbbrRegex(e)}function an(){for(var e,t,n,s=[],i=[],r=[],a=[],o=this.eras(),u=0,l=o.length;u<l;++u)e=f(o[u].name),t=f(o[u].abbr),n=f(o[u].narrow),i.push(e),s.push(t),r.push(n),a.push(e),a.push(t),a.push(n);this._erasRegex=new RegExp("^("+a.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+i.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+s.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+r.join("|")+")","i")}function on(e,t){s(0,[e,e.length],0,t)}function un(e,t,n,s,i){var r;return null==e?Be(this,s,i).year:(r=N(e,s,i),function(e,t,n,s,i){e=$e(e,t,n,s,i),t=ze(e.year,0,e.dayOfYear);return this.year(t.getUTCFullYear()),this.month(t.getUTCMonth()),this.date(t.getUTCDate()),this}.call(this,e,t=r<t?r:t,n,s,i))}s("N",0,0,"eraAbbr"),s("NN",0,0,"eraAbbr"),s("NNN",0,0,"eraAbbr"),s("NNNN",0,0,"eraName"),s("NNNNN",0,0,"eraNarrow"),s("y",["y",1],"yo","eraYear"),s("y",["yy",2],0,"eraYear"),s("y",["yyy",3],0,"eraYear"),s("y",["yyyy",4],0,"eraYear"),h("N",rn),h("NN",rn),h("NNN",rn),h("NNNN",function(e,t){return t.erasNameRegex(e)}),h("NNNNN",function(e,t){return t.erasNarrowRegex(e)}),v(["N","NN","NNN","NNNN","NNNNN"],function(e,t,n,s){s=n._locale.erasParse(e,s,n._strict);s?p(n).era=s:p(n).invalidEra=e}),h("y",pe),h("yy",pe),h("yyy",pe),h("yyyy",pe),h("yo",function(e,t){return t._eraYearOrdinalRegex||pe}),v(["y","yy","yyy","yyyy"],D),v(["yo"],function(e,t,n,s){var i;n._locale._eraYearOrdinalRegex&&(i=e.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?t[D]=n._locale.eraYearOrdinalParse(e,i):t[D]=parseInt(e,10)}),s(0,["gg",2],0,function(){return this.weekYear()%100}),s(0,["GG",2],0,function(){return this.isoWeekYear()%100}),on("gggg","weekYear"),on("ggggg","weekYear"),on("GGGG","isoWeekYear"),on("GGGGG","isoWeekYear"),h("G",ke),h("g",ke),h("GG",n,t),h("gg",n,t),h("GGGG",ge,ce),h("gggg",ge,ce),h("GGGGG",we,fe),h("ggggg",we,fe),Oe(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=M(e)}),Oe(["gg","GG"],function(e,t,n,s){t[s]=_.parseTwoDigitYear(e)}),s("Q",0,"Qo","quarter"),h("Q",de),v("Q",function(e,t){t[Y]=3*(M(e)-1)}),s("D",["DD",2],"Do","date"),h("D",n,u),h("DD",n,t),h("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),v(["D","DD"],S),v("Do",function(e,t){t[S]=M(e.match(n)[0])});ge=Re("Date",!0);s("DDD",["DDDD",3],"DDDo","dayOfYear"),h("DDD",ye),h("DDDD",he),v(["DDD","DDDD"],function(e,t,n){n._dayOfYear=M(e)}),s("m",["mm",2],0,"minute"),h("m",n,d),h("mm",n,t),v(["m","mm"],b);var ln,ce=Re("Minutes",!1),we=(s("s",["ss",2],0,"second"),h("s",n,d),h("ss",n,t),v(["s","ss"],T),Re("Seconds",!1));for(s("S",0,0,function(){return~~(this.millisecond()/100)}),s(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),s(0,["SSS",3],0,"millisecond"),s(0,["SSSS",4],0,function(){return 10*this.millisecond()}),s(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),s(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),s(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),s(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),s(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),h("S",ye,de),h("SS",ye,t),h("SSS",ye,he),ln="SSSS";ln.length<=9;ln+="S")h(ln,pe);function dn(e,t){t[Te]=M(1e3*("0."+e))}for(ln="S";ln.length<=9;ln+="S")v(ln,dn);fe=Re("Milliseconds",!1),s("z",0,0,"zoneAbbr"),s("zz",0,0,"zoneName");u=$.prototype;function hn(e){return e}u.add=Fe,u.calendar=function(e,t){1===arguments.length&&(arguments[0]?Jt(arguments[0])?(e=arguments[0],t=void 0):function(e){for(var t=F(e)&&!L(e),n=!1,s=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],i=0;i<s.length;i+=1)n=n||c(e,s[i]);return t&&n}(arguments[0])&&(t=arguments[0],e=void 0):t=e=void 0);var e=e||R(),n=Gt(e,this).startOf("day"),n=_.calendarFormat(this,n)||"sameElse",t=t&&(a(t[n])?t[n].call(this,e):t[n]);return this.format(t||this.localeData().calendar(n,this,R(e)))},u.clone=function(){return new $(this)},u.diff=function(e,t,n){var s,i,r;if(!this.isValid())return NaN;if(!(s=Gt(e,this)).isValid())return NaN;switch(i=6e4*(s.utcOffset()-this.utcOffset()),t=o(t)){case"year":r=Qt(this,s)/12;break;case"month":r=Qt(this,s);break;case"quarter":r=Qt(this,s)/3;break;case"second":r=(this-s)/1e3;break;case"minute":r=(this-s)/6e4;break;case"hour":r=(this-s)/36e5;break;case"day":r=(this-s-i)/864e5;break;case"week":r=(this-s-i)/6048e5;break;default:r=this-s}return n?r:m(r)},u.endOf=function(e){var t,n;if(void 0!==(e=o(e))&&"millisecond"!==e&&this.isValid()){switch(n=this._isUTC?sn:nn,e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=36e5-tn(t+(this._isUTC?0:6e4*this.utcOffset()),36e5)-1;break;case"minute":t=this._d.valueOf(),t+=6e4-tn(t,6e4)-1;break;case"second":t=this._d.valueOf(),t+=1e3-tn(t,1e3)-1;break}this._d.setTime(t),_.updateOffset(this,!0)}return this},u.format=function(e){return e=e||(this.isUtc()?_.defaultFormatUtc:_.defaultFormat),e=re(this,e),this.localeData().postformat(e)},u.from=function(e,t){return this.isValid()&&(k(e)&&e.isValid()||R(e).isValid())?C({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},u.fromNow=function(e){return this.from(R(),e)},u.to=function(e,t){return this.isValid()&&(k(e)&&e.isValid()||R(e).isValid())?C({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},u.toNow=function(e){return this.to(R(),e)},u.get=function(e){return a(this[e=o(e)])?this[e]():this},u.invalidAt=function(){return p(this).overflow},u.isAfter=function(e,t){return e=k(e)?e:R(e),!(!this.isValid()||!e.isValid())&&("millisecond"===(t=o(t)||"millisecond")?this.valueOf()>e.valueOf():e.valueOf()<this.clone().startOf(t).valueOf())},u.isBefore=function(e,t){return e=k(e)?e:R(e),!(!this.isValid()||!e.isValid())&&("millisecond"===(t=o(t)||"millisecond")?this.valueOf()<e.valueOf():this.clone().endOf(t).valueOf()<e.valueOf())},u.isBetween=function(e,t,n,s){return e=k(e)?e:R(e),t=k(t)?t:R(t),!!(this.isValid()&&e.isValid()&&t.isValid())&&("("===(s=s||"()")[0]?this.isAfter(e,n):!this.isBefore(e,n))&&(")"===s[1]?this.isBefore(t,n):!this.isAfter(t,n))},u.isSame=function(e,t){var e=k(e)?e:R(e);return!(!this.isValid()||!e.isValid())&&("millisecond"===(t=o(t)||"millisecond")?this.valueOf()===e.valueOf():(e=e.valueOf(),this.clone().startOf(t).valueOf()<=e&&e<=this.clone().endOf(t).valueOf()))},u.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},u.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},u.isValid=function(){return A(this)},u.lang=Ke,u.locale=Xt,u.localeData=Kt,u.max=_e,u.min=me,u.parsingFlags=function(){return E({},p(this))},u.set=function(e,t){if("object"==typeof e)for(var n=function(e){var t,n=[];for(t in e)c(e,t)&&n.push({unit:t,priority:le[t]});return n.sort(function(e,t){return e.priority-t.priority}),n}(e=ue(e)),s=n.length,i=0;i<s;i++)this[n[i].unit](e[n[i].unit]);else if(a(this[e=o(e)]))return this[e](t);return this},u.startOf=function(e){var t,n;if(void 0!==(e=o(e))&&"millisecond"!==e&&this.isValid()){switch(n=this._isUTC?sn:nn,e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=tn(t+(this._isUTC?0:6e4*this.utcOffset()),36e5);break;case"minute":t=this._d.valueOf(),t-=tn(t,6e4);break;case"second":t=this._d.valueOf(),t-=tn(t,1e3);break}this._d.setTime(t),_.updateOffset(this,!0)}return this},u.subtract=Qe,u.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},u.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},u.toDate=function(){return new Date(this.valueOf())},u.toISOString=function(e){var t;return this.isValid()?(t=(e=!0!==e)?this.clone().utc():this).year()<0||9999<t.year()?re(t,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):a(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",re(t,"Z")):re(t,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ"):null},u.inspect=function(){var e,t,n;return this.isValid()?(t="moment",e="",this.isLocal()||(t=0===this.utcOffset()?"moment.utc":"moment.parseZone",e="Z"),t="["+t+'("]',n=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",this.format(t+n+"-MM-DD[T]HH:mm:ss.SSS"+(e+'[")]'))):"moment.invalid(/* "+this._i+" */)"},"undefined"!=typeof Symbol&&null!=Symbol.for&&(u[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),u.toJSON=function(){return this.isValid()?this.toISOString():null},u.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},u.unix=function(){return Math.floor(this.valueOf()/1e3)},u.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},u.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},u.eraName=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;n<s;++n){if(e=this.clone().startOf("day").valueOf(),t[n].since<=e&&e<=t[n].until)return t[n].name;if(t[n].until<=e&&e<=t[n].since)return t[n].name}return""},u.eraNarrow=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;n<s;++n){if(e=this.clone().startOf("day").valueOf(),t[n].since<=e&&e<=t[n].until)return t[n].narrow;if(t[n].until<=e&&e<=t[n].since)return t[n].narrow}return""},u.eraAbbr=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;n<s;++n){if(e=this.clone().startOf("day").valueOf(),t[n].since<=e&&e<=t[n].until)return t[n].abbr;if(t[n].until<=e&&e<=t[n].since)return t[n].abbr}return""},u.eraYear=function(){for(var e,t,n=this.localeData().eras(),s=0,i=n.length;s<i;++s)if(e=n[s].since<=n[s].until?1:-1,t=this.clone().startOf("day").valueOf(),n[s].since<=t&&t<=n[s].until||n[s].until<=t&&t<=n[s].since)return(this.year()-_(n[s].since).year())*e+n[s].offset;return this.year()},u.year=Pe,u.isLeapYear=function(){return be(this.year())},u.weekYear=function(e){return un.call(this,e,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)},u.isoWeekYear=function(e){return un.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},u.quarter=u.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},u.month=Ie,u.daysInMonth=function(){return He(this.year(),this.month())},u.week=u.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},u.isoWeek=u.isoWeeks=function(e){var t=Be(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},u.weeksInYear=function(){var e=this.localeData()._week;return N(this.year(),e.dow,e.doy)},u.weeksInWeekYear=function(){var e=this.localeData()._week;return N(this.weekYear(),e.dow,e.doy)},u.isoWeeksInYear=function(){return N(this.year(),1,4)},u.isoWeeksInISOWeekYear=function(){return N(this.isoWeekYear(),1,4)},u.date=ge,u.day=u.days=function(e){var t,n,s;return this.isValid()?(t=Ce(this,"Day"),null!=e?(n=e,s=this.localeData(),e="string"!=typeof n?n:isNaN(n)?"number"==typeof(n=s.weekdaysParse(n))?n:null:parseInt(n,10),this.add(e-t,"d")):t):null!=e?this:NaN},u.weekday=function(e){var t;return this.isValid()?(t=(this.day()+7-this.localeData()._week.dow)%7,null==e?t:this.add(e-t,"d")):null!=e?this:NaN},u.isoWeekday=function(e){var t,n;return this.isValid()?null!=e?(t=e,n=this.localeData(),n="string"==typeof t?n.weekdaysParse(t)%7||7:isNaN(t)?null:t,this.day(this.day()%7?n:n-7)):this.day()||7:null!=e?this:NaN},u.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},u.hour=u.hours=i,u.minute=u.minutes=ce,u.second=u.seconds=we,u.millisecond=u.milliseconds=fe,u.utcOffset=function(e,t,n){var s,i=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null==e)return this._isUTC?i:Et(this);if("string"==typeof e){if(null===(e=Vt(ve,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(s=Et(this)),this._offset=e,this._isUTC=!0,null!=s&&this.add(s,"m"),i!==e&&(!t||this._changeInProgress?$t(this,C(e-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,_.updateOffset(this,!0),this._changeInProgress=null)),this},u.utc=function(e){return this.utcOffset(0,e)},u.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e)&&this.subtract(Et(this),"m"),this},u.parseZone=function(){var e;return null!=this._tzm?this.utcOffset(this._tzm,!1,!0):"string"==typeof this._i&&(null!=(e=Vt(Me,this._i))?this.utcOffset(e):this.utcOffset(0,!0)),this},u.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?R(e).utcOffset():0,(this.utcOffset()-e)%60==0)},u.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},u.isLocal=function(){return!!this.isValid()&&!this._isUTC},u.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},u.isUtc=At,u.isUTC=At,u.zoneAbbr=function(){return this._isUTC?"UTC":""},u.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},u.dates=e("dates accessor is deprecated. Use date instead.",ge),u.months=e("months accessor is deprecated. Use month instead",Ie),u.years=e("years accessor is deprecated. Use year instead",Pe),u.zone=e("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?(this.utcOffset(e="string"!=typeof e?-e:e,t),this):-this.utcOffset()}),u.isDSTShifted=e("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){var e,t;return g(this._isDSTShifted)&&(q(e={},this),(e=Nt(e))._a?(t=(e._isUTC?l:R)(e._a),this._isDSTShifted=this.isValid()&&0<function(e,t,n){for(var s=Math.min(e.length,t.length),i=Math.abs(e.length-t.length),r=0,a=0;a<s;a++)(n&&e[a]!==t[a]||!n&&M(e[a])!==M(t[a]))&&r++;return r+i}(e._a,t.toArray())):this._isDSTShifted=!1),this._isDSTShifted});d=K.prototype;function cn(e,t,n,s){var i=P(),s=l().set(s,t);return i[n](s,e)}function fn(e,t,n){if(w(e)&&(t=e,e=void 0),e=e||"",null!=t)return cn(e,t,n,"month");for(var s=[],i=0;i<12;i++)s[i]=cn(e,i,n,"month");return s}function mn(e,t,n,s){t=("boolean"==typeof e?w(t)&&(n=t,t=void 0):(t=e,e=!1,w(n=t)&&(n=t,t=void 0)),t||"");var i,r=P(),a=e?r._week.dow:0,o=[];if(null!=n)return cn(t,(n+a)%7,s,"day");for(i=0;i<7;i++)o[i]=cn(t,(i+a)%7,s,"day");return o}d.calendar=function(e,t,n){return a(e=this._calendar[e]||this._calendar.sameElse)?e.call(t,n):e},d.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.match(te).map(function(e){return"MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e}).join(""),this._longDateFormat[e])},d.invalidDate=function(){return this._invalidDate},d.ordinal=function(e){return this._ordinal.replace("%d",e)},d.preparse=hn,d.postformat=hn,d.relativeTime=function(e,t,n,s){var i=this._relativeTime[n];return a(i)?i(e,t,n,s):i.replace(/%d/i,e)},d.pastFuture=function(e,t){return a(e=this._relativeTime[0<e?"future":"past"])?e(t):e.replace(/%s/i,t)},d.set=function(e){var t,n;for(n in e)c(e,n)&&(a(t=e[n])?this[n]=t:this["_"+n]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},d.eras=function(e,t){for(var n,s=this._eras||P("en")._eras,i=0,r=s.length;i<r;++i){switch(typeof s[i].since){case"string":n=_(s[i].since).startOf("day"),s[i].since=n.valueOf();break}switch(typeof s[i].until){case"undefined":s[i].until=1/0;break;case"string":n=_(s[i].until).startOf("day").valueOf(),s[i].until=n.valueOf();break}}return s},d.erasParse=function(e,t,n){var s,i,r,a,o,u=this.eras();for(e=e.toUpperCase(),s=0,i=u.length;s<i;++s)if(r=u[s].name.toUpperCase(),a=u[s].abbr.toUpperCase(),o=u[s].narrow.toUpperCase(),n)switch(t){case"N":case"NN":case"NNN":if(a===e)return u[s];break;case"NNNN":if(r===e)return u[s];break;case"NNNNN":if(o===e)return u[s];break}else if(0<=[r,a,o].indexOf(e))return u[s]},d.erasConvertYear=function(e,t){var n=e.since<=e.until?1:-1;return void 0===t?_(e.since).year():_(e.since).year()+(t-e.offset)*n},d.erasAbbrRegex=function(e){return c(this,"_erasAbbrRegex")||an.call(this),e?this._erasAbbrRegex:this._erasRegex},d.erasNameRegex=function(e){return c(this,"_erasNameRegex")||an.call(this),e?this._erasNameRegex:this._erasRegex},d.erasNarrowRegex=function(e){return c(this,"_erasNarrowRegex")||an.call(this),e?this._erasNarrowRegex:this._erasRegex},d.months=function(e,t){return e?(y(this._months)?this._months:this._months[(this._months.isFormat||Ve).test(t)?"format":"standalone"])[e.month()]:y(this._months)?this._months:this._months.standalone},d.monthsShort=function(e,t){return e?(y(this._monthsShort)?this._monthsShort:this._monthsShort[Ve.test(t)?"format":"standalone"])[e.month()]:y(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},d.monthsParse=function(e,t,n){var s,i;if(this._monthsParseExact)return function(e,t,n){var s,i,r,e=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)r=l([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=x.call(this._shortMonthsParse,e))?i:null:-1!==(i=x.call(this._longMonthsParse,e))?i:null:"MMM"===t?-1!==(i=x.call(this._shortMonthsParse,e))||-1!==(i=x.call(this._longMonthsParse,e))?i:null:-1!==(i=x.call(this._longMonthsParse,e))||-1!==(i=x.call(this._shortMonthsParse,e))?i:null}.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(i=l([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[s]||(i="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=new RegExp(i.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[s].test(e))return s;if(n&&"MMM"===t&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}},d.monthsRegex=function(e){return this._monthsParseExact?(c(this,"_monthsRegex")||je.call(this),e?this._monthsStrictRegex:this._monthsRegex):(c(this,"_monthsRegex")||(this._monthsRegex=Ee),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},d.monthsShortRegex=function(e){return this._monthsParseExact?(c(this,"_monthsRegex")||je.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(c(this,"_monthsShortRegex")||(this._monthsShortRegex=Ge),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},d.week=function(e){return Be(e,this._week.dow,this._week.doy).week},d.firstDayOfYear=function(){return this._week.doy},d.firstDayOfWeek=function(){return this._week.dow},d.weekdays=function(e,t){return t=y(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"],!0===e?Je(t,this._week.dow):e?t[e.day()]:t},d.weekdaysMin=function(e){return!0===e?Je(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},d.weekdaysShort=function(e){return!0===e?Je(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},d.weekdaysParse=function(e,t,n){var s,i;if(this._weekdaysParseExact)return function(e,t,n){var s,i,r,e=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)r=l([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=x.call(this._weekdaysParse,e))?i:null:"ddd"===t?-1!==(i=x.call(this._shortWeekdaysParse,e))?i:null:-1!==(i=x.call(this._minWeekdaysParse,e))?i:null:"dddd"===t?-1!==(i=x.call(this._weekdaysParse,e))||-1!==(i=x.call(this._shortWeekdaysParse,e))||-1!==(i=x.call(this._minWeekdaysParse,e))?i:null:"ddd"===t?-1!==(i=x.call(this._shortWeekdaysParse,e))||-1!==(i=x.call(this._weekdaysParse,e))||-1!==(i=x.call(this._minWeekdaysParse,e))?i:null:-1!==(i=x.call(this._minWeekdaysParse,e))||-1!==(i=x.call(this._weekdaysParse,e))||-1!==(i=x.call(this._shortWeekdaysParse,e))?i:null}.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=l([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(i="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=new RegExp(i.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[s].test(e))return s;if(n&&"ddd"===t&&this._shortWeekdaysParse[s].test(e))return s;if(n&&"dd"===t&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}},d.weekdaysRegex=function(e){return this._weekdaysParseExact?(c(this,"_weekdaysRegex")||st.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(c(this,"_weekdaysRegex")||(this._weekdaysRegex=et),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},d.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(c(this,"_weekdaysRegex")||st.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(c(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=tt),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},d.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(c(this,"_weekdaysRegex")||st.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(c(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=nt),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},d.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},d.meridiem=function(e,t,n){return 11<e?n?"pm":"PM":n?"am":"AM"},ft("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===M(e%100/10)?"th":1==t?"st":2==t?"nd":3==t?"rd":"th")}}),_.lang=e("moment.lang is deprecated. Use moment.locale instead.",ft),_.langData=e("moment.langData is deprecated. Use moment.localeData instead.",P);var _n=Math.abs;function yn(e,t,n,s){t=C(t,n);return e._milliseconds+=s*t._milliseconds,e._days+=s*t._days,e._months+=s*t._months,e._bubble()}function gn(e){return e<0?Math.floor(e):Math.ceil(e)}function wn(e){return 4800*e/146097}function pn(e){return 146097*e/4800}function kn(e){return function(){return this.as(e)}}de=kn("ms"),t=kn("s"),ye=kn("m"),he=kn("h"),Fe=kn("d"),_e=kn("w"),me=kn("M"),Qe=kn("Q"),i=kn("y"),ce=de;function Mn(e){return function(){return this.isValid()?this._data[e]:NaN}}var we=Mn("milliseconds"),fe=Mn("seconds"),ge=Mn("minutes"),Pe=Mn("hours"),d=Mn("days"),vn=Mn("months"),Dn=Mn("years");var Yn=Math.round,Sn={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function On(e,t,n,s){var i=C(e).abs(),r=Yn(i.as("s")),a=Yn(i.as("m")),o=Yn(i.as("h")),u=Yn(i.as("d")),l=Yn(i.as("M")),d=Yn(i.as("w")),i=Yn(i.as("y")),r=(r<=n.ss?["s",r]:r<n.s&&["ss",r])||(a<=1?["m"]:a<n.m&&["mm",a])||(o<=1?["h"]:o<n.h&&["hh",o])||(u<=1?["d"]:u<n.d&&["dd",u]);return(r=(r=null!=n.w?r||(d<=1?["w"]:d<n.w&&["ww",d]):r)||(l<=1?["M"]:l<n.M&&["MM",l])||(i<=1?["y"]:["yy",i]))[2]=t,r[3]=0<+e,r[4]=s,function(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}.apply(null,r)}var bn=Math.abs;function Tn(e){return(0<e)-(e<0)||+e}function xn(){var e,t,n,s,i,r,a,o,u,l,d;return this.isValid()?(e=bn(this._milliseconds)/1e3,t=bn(this._days),n=bn(this._months),(o=this.asSeconds())?(s=m(e/60),i=m(s/60),e%=60,s%=60,r=m(n/12),n%=12,a=e?e.toFixed(3).replace(/\.?0+$/,""):"",u=Tn(this._months)!==Tn(o)?"-":"",l=Tn(this._days)!==Tn(o)?"-":"",d=Tn(this._milliseconds)!==Tn(o)?"-":"",(o<0?"-":"")+"P"+(r?u+r+"Y":"")+(n?u+n+"M":"")+(t?l+t+"D":"")+(i||s||e?"T":"")+(i?d+i+"H":"")+(s?d+s+"M":"")+(e?d+a+"S":"")):"P0D"):this.localeData().invalidDate()}var U=Ct.prototype;return U.isValid=function(){return this._isValid},U.abs=function(){var e=this._data;return this._milliseconds=_n(this._milliseconds),this._days=_n(this._days),this._months=_n(this._months),e.milliseconds=_n(e.milliseconds),e.seconds=_n(e.seconds),e.minutes=_n(e.minutes),e.hours=_n(e.hours),e.months=_n(e.months),e.years=_n(e.years),this},U.add=function(e,t){return yn(this,e,t,1)},U.subtract=function(e,t){return yn(this,e,t,-1)},U.as=function(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if("month"===(e=o(e))||"quarter"===e||"year"===e)switch(t=this._days+s/864e5,n=this._months+wn(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(pn(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return 24*t+s/36e5;case"minute":return 1440*t+s/6e4;case"second":return 86400*t+s/1e3;case"millisecond":return Math.floor(864e5*t)+s;default:throw new Error("Unknown unit "+e)}},U.asMilliseconds=de,U.asSeconds=t,U.asMinutes=ye,U.asHours=he,U.asDays=Fe,U.asWeeks=_e,U.asMonths=me,U.asQuarters=Qe,U.asYears=i,U.valueOf=ce,U._bubble=function(){var e=this._milliseconds,t=this._days,n=this._months,s=this._data;return 0<=e&&0<=t&&0<=n||e<=0&&t<=0&&n<=0||(e+=864e5*gn(pn(n)+t),n=t=0),s.milliseconds=e%1e3,e=m(e/1e3),s.seconds=e%60,e=m(e/60),s.minutes=e%60,e=m(e/60),s.hours=e%24,t+=m(e/24),n+=e=m(wn(t)),t-=gn(pn(e)),e=m(n/12),n%=12,s.days=t,s.months=n,s.years=e,this},U.clone=function(){return C(this)},U.get=function(e){return e=o(e),this.isValid()?this[e+"s"]():NaN},U.milliseconds=we,U.seconds=fe,U.minutes=ge,U.hours=Pe,U.days=d,U.weeks=function(){return m(this.days()/7)},U.months=vn,U.years=Dn,U.humanize=function(e,t){var n,s;return this.isValid()?(n=!1,s=Sn,"object"==typeof e&&(t=e,e=!1),"boolean"==typeof e&&(n=e),"object"==typeof t&&(s=Object.assign({},Sn,t),null!=t.s)&&null==t.ss&&(s.ss=t.s-1),e=this.localeData(),t=On(this,!n,s,e),n&&(t=e.pastFuture(+this,t)),e.postformat(t)):this.localeData().invalidDate()},U.toISOString=xn,U.toString=xn,U.toJSON=xn,U.locale=Xt,U.localeData=Kt,U.toIsoString=e("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",xn),U.lang=Ke,s("X",0,0,"unix"),s("x",0,0,"valueOf"),h("x",ke),h("X",/[+-]?\d+(\.\d{1,3})?/),v("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e))}),v("x",function(e,t,n){n._d=new Date(M(e))}),_.version="2.30.1",H=R,_.fn=u,_.min=function(){return Pt("isBefore",[].slice.call(arguments,0))},_.max=function(){return Pt("isAfter",[].slice.call(arguments,0))},_.now=function(){return Date.now?Date.now():+new Date},_.utc=l,_.unix=function(e){return R(1e3*e)},_.months=function(e,t){return fn(e,t,"months")},_.isDate=V,_.locale=ft,_.invalid=I,_.duration=C,_.isMoment=k,_.weekdays=function(e,t,n){return mn(e,t,n,"weekdays")},_.parseZone=function(){return R.apply(null,arguments).parseZone()},_.localeData=P,_.isDuration=Ut,_.monthsShort=function(e,t){return fn(e,t,"monthsShort")},_.weekdaysMin=function(e,t,n){return mn(e,t,n,"weekdaysMin")},_.defineLocale=mt,_.updateLocale=function(e,t){var n,s;return null!=t?(s=ut,null!=W[e]&&null!=W[e].parentLocale?W[e].set(X(W[e]._config,t)):(t=X(s=null!=(n=ct(e))?n._config:s,t),null==n&&(t.abbr=e),(s=new K(t)).parentLocale=W[e],W[e]=s),ft(e)):null!=W[e]&&(null!=W[e].parentLocale?(W[e]=W[e].parentLocale,e===ft()&&ft(e)):null!=W[e]&&delete W[e]),W[e]},_.locales=function(){return ee(W)},_.weekdaysShort=function(e,t,n){return mn(e,t,n,"weekdaysShort")},_.normalizeUnits=o,_.relativeTimeRounding=function(e){return void 0===e?Yn:"function"==typeof e&&(Yn=e,!0)},_.relativeTimeThreshold=function(e,t){return void 0!==Sn[e]&&(void 0===t?Sn[e]:(Sn[e]=t,"s"===e&&(Sn.ss=t-1),!0))},_.calendarFormat=function(e,t){return(e=e.diff(t,"days",!0))<-6?"sameElse":e<-1?"lastWeek":e<0?"lastDay":e<1?"sameDay":e<2?"nextDay":e<7?"nextWeek":"sameElse"},_.prototype=u,_.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},_});
//# sourceMappingURL=moment.min.js.map;
/*!
* jquery.inputmask.bundle.js
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2019 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.6
*/

(function (modules) { var installedModules = {}; function __webpack_require__(moduleId) { if (installedModules[moduleId]) { return installedModules[moduleId].exports } var module = installedModules[moduleId] = { i: moduleId, l: false, exports: {} }; modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); module.l = true; return module.exports } __webpack_require__.m = modules; __webpack_require__.c = installedModules; __webpack_require__.d = function (exports, name, getter) { if (!__webpack_require__.o(exports, name)) { Object.defineProperty(exports, name, { enumerable: true, get: getter }) } }; __webpack_require__.r = function (exports) { if (typeof Symbol !== "undefined" && Symbol.toStringTag) { Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }) } Object.defineProperty(exports, "__esModule", { value: true }) }; __webpack_require__.t = function (value, mode) { if (mode & 1) value = __webpack_require__(value); if (mode & 8) return value; if (mode & 4 && typeof value === "object" && value && value.__esModule) return value; var ns = Object.create(null); __webpack_require__.r(ns); Object.defineProperty(ns, "default", { enumerable: true, value: value }); if (mode & 2 && typeof value != "string") for (var key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)); return ns }; __webpack_require__.n = function (module) { var getter = module && module.__esModule ? function getDefault() { return module["default"] } : function getModuleExports() { return module }; __webpack_require__.d(getter, "a", getter); return getter }; __webpack_require__.o = function (object, property) { return Object.prototype.hasOwnProperty.call(object, property) }; __webpack_require__.p = ""; return __webpack_require__(__webpack_require__.s = 0) })([function (module, exports, __webpack_require__) { "use strict"; __webpack_require__(1); __webpack_require__(6); __webpack_require__(7); var _inputmask = __webpack_require__(2); var _inputmask2 = _interopRequireDefault(_inputmask); var _inputmask3 = __webpack_require__(3); var _inputmask4 = _interopRequireDefault(_inputmask3); var _jquery = __webpack_require__(4); var _jquery2 = _interopRequireDefault(_jquery); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } if (_inputmask4.default === _jquery2.default) { __webpack_require__(8) } window.Inputmask = _inputmask2.default }, function (module, exports, __webpack_require__) { "use strict"; var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj }; (function (factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2)], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === "function" ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) } else { } })(function (Inputmask) { Inputmask.extendDefinitions({ A: { validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]", casing: "upper" }, "&": { validator: "[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]", casing: "upper" }, "#": { validator: "[0-9A-Fa-f]", casing: "upper" } }); Inputmask.extendAliases({ cssunit: { regex: "[+-]?[0-9]+\\.?([0-9]+)?(px|em|rem|ex|%|in|cm|mm|pt|pc)" }, url: { regex: "(https?|ftp)//.*", autoUnmask: false }, ip: { mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]", definitions: { i: { validator: function validator(chrs, maskset, pos, strict, opts) { if (pos - 1 > -1 && maskset.buffer[pos - 1] !== ".") { chrs = maskset.buffer[pos - 1] + chrs; if (pos - 2 > -1 && maskset.buffer[pos - 2] !== ".") { chrs = maskset.buffer[pos - 2] + chrs } else chrs = "0" + chrs } else chrs = "00" + chrs; return new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs) } } }, onUnMask: function onUnMask(maskedValue, unmaskedValue, opts) { return maskedValue }, inputmode: "numeric" }, email: { mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]", greedy: false, casing: "lower", onBeforePaste: function onBeforePaste(pastedValue, opts) { pastedValue = pastedValue.toLowerCase(); return pastedValue.replace("mailto:", "") }, definitions: { "*": { validator: "[0-9\uff11-\uff19A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5!#$%&'*+/=?^_`{|}~-]" }, "-": { validator: "[0-9A-Za-z-]" } }, onUnMask: function onUnMask(maskedValue, unmaskedValue, opts) { return maskedValue }, inputmode: "email" }, mac: { mask: "##:##:##:##:##:##" }, vin: { mask: "V{13}9{4}", definitions: { V: { validator: "[A-HJ-NPR-Za-hj-npr-z\\d]", casing: "upper" } }, clearIncomplete: true, autoUnmask: true } }); return Inputmask }) }, function (module, exports, __webpack_require__) { "use strict"; var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj }; (function (factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(3), __webpack_require__(5)], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === "function" ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) } else { } })(function ($, window, undefined) { var document = window.document, ua = navigator.userAgent, ie = ua.indexOf("MSIE ") > 0 || ua.indexOf("Trident/") > 0, mobile = isInputEventSupported("touchstart"), iemobile = /iemobile/i.test(ua), iphone = /iphone/i.test(ua) && !iemobile; function Inputmask(alias, options, internal) { if (!(this instanceof Inputmask)) { return new Inputmask(alias, options, internal) } this.el = undefined; this.events = {}; this.maskset = undefined; this.refreshValue = false; if (internal !== true) { if ($.isPlainObject(alias)) { options = alias } else { options = options || {}; if (alias) options.alias = alias } this.opts = $.extend(true, {}, this.defaults, options); this.noMasksCache = options && options.definitions !== undefined; this.userOptions = options || {}; this.isRTL = this.opts.numericInput; resolveAlias(this.opts.alias, options, this.opts) } } Inputmask.prototype = { dataAttribute: "data-inputmask", defaults: { placeholder: "_", optionalmarker: ["[", "]"], quantifiermarker: ["{", "}"], groupmarker: ["(", ")"], alternatormarker: "|", escapeChar: "\\", mask: null, regex: null, oncomplete: $.noop, onincomplete: $.noop, oncleared: $.noop, repeat: 0, greedy: false, autoUnmask: false, removeMaskOnSubmit: false, clearMaskOnLostFocus: true, insertMode: true, clearIncomplete: false, alias: null, onKeyDown: $.noop, onBeforeMask: null, onBeforePaste: function onBeforePaste(pastedValue, opts) { return $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(this, pastedValue, opts) : pastedValue }, onBeforeWrite: null, onUnMask: null, showMaskOnFocus: true, showMaskOnHover: true, onKeyValidation: $.noop, skipOptionalPartCharacter: " ", numericInput: false, rightAlign: false, undoOnEscape: true, radixPoint: "", _radixDance: false, groupSeparator: "", keepStatic: null, positionCaretOnTab: true, tabThrough: false, supportsInputType: ["text", "tel", "url", "password", "search"], ignorables: [8, 9, 13, 19, 27, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 93, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 0, 229], isComplete: null, preValidation: null, postValidation: null, staticDefinitionSymbol: undefined, jitMasking: false, nullable: true, inputEventOnly: false, noValuePatching: false, positionCaretOnClick: "lvp", casing: null, inputmode: "verbatim", colorMask: false, disablePredictiveText: false, importDataAttributes: true, shiftPositions: true }, definitions: { 9: { validator: "[0-9\uff11-\uff19]", definitionSymbol: "*" }, a: { validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]", definitionSymbol: "*" }, "*": { validator: "[0-9\uff11-\uff19A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]" } }, aliases: {}, masksCache: {}, mask: function mask(elems) { var that = this; function importAttributeOptions(npt, opts, userOptions, dataAttribute) { if (opts.importDataAttributes === true) { var importOption = function importOption(option, optionData) { optionData = optionData !== undefined ? optionData : npt.getAttribute(dataAttribute + "-" + option); if (optionData !== null) { if (typeof optionData === "string") { if (option.indexOf("on") === 0) optionData = window[optionData]; else if (optionData === "false") optionData = false; else if (optionData === "true") optionData = true } userOptions[option] = optionData } }; var attrOptions = npt.getAttribute(dataAttribute), option, dataoptions, optionData, p; if (attrOptions && attrOptions !== "") { attrOptions = attrOptions.replace(/'/g, '"'); dataoptions = JSON.parse("{" + attrOptions + "}") } if (dataoptions) { optionData = undefined; for (p in dataoptions) { if (p.toLowerCase() === "alias") { optionData = dataoptions[p]; break } } } importOption("alias", optionData); if (userOptions.alias) { resolveAlias(userOptions.alias, userOptions, opts) } for (option in opts) { if (dataoptions) { optionData = undefined; for (p in dataoptions) { if (p.toLowerCase() === option.toLowerCase()) { optionData = dataoptions[p]; break } } } importOption(option, optionData) } } $.extend(true, opts, userOptions); if (npt.dir === "rtl" || opts.rightAlign) { npt.style.textAlign = "right" } if (npt.dir === "rtl" || opts.numericInput) { npt.dir = "ltr"; npt.removeAttribute("dir"); opts.isRTL = true } return Object.keys(userOptions).length } if (typeof elems === "string") { elems = document.getElementById(elems) || document.querySelectorAll(elems) } elems = elems.nodeName ? [elems] : elems; $.each(elems, function (ndx, el) { var scopedOpts = $.extend(true, {}, that.opts); if (importAttributeOptions(el, scopedOpts, $.extend(true, {}, that.userOptions), that.dataAttribute)) { var maskset = generateMaskSet(scopedOpts, that.noMasksCache); if (maskset !== undefined) { if (el.inputmask !== undefined) { el.inputmask.opts.autoUnmask = true; el.inputmask.remove() } el.inputmask = new Inputmask(undefined, undefined, true); el.inputmask.opts = scopedOpts; el.inputmask.noMasksCache = that.noMasksCache; el.inputmask.userOptions = $.extend(true, {}, that.userOptions); el.inputmask.isRTL = scopedOpts.isRTL || scopedOpts.numericInput; el.inputmask.el = el; el.inputmask.maskset = maskset; $.data(el, "_inputmask_opts", scopedOpts); maskScope.call(el.inputmask, { action: "mask" }) } } }); return elems && elems[0] ? elems[0].inputmask || this : this }, option: function option(options, noremask) { if (typeof options === "string") { return this.opts[options] } else if ((typeof options === "undefined" ? "undefined" : _typeof(options)) === "object") { $.extend(this.userOptions, options); if (this.el && noremask !== true) { this.mask(this.el) } return this } }, unmaskedvalue: function unmaskedvalue(value) { this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache); return maskScope.call(this, { action: "unmaskedvalue", value: value }) }, remove: function remove() { return maskScope.call(this, { action: "remove" }) }, getemptymask: function getemptymask() { this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache); return maskScope.call(this, { action: "getemptymask" }) }, hasMaskedValue: function hasMaskedValue() { return !this.opts.autoUnmask }, isComplete: function isComplete() { this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache); return maskScope.call(this, { action: "isComplete" }) }, getmetadata: function getmetadata() { this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache); return maskScope.call(this, { action: "getmetadata" }) }, isValid: function isValid(value) { this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache); return maskScope.call(this, { action: "isValid", value: value }) }, format: function format(value, metadata) { this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache); return maskScope.call(this, { action: "format", value: value, metadata: metadata }) }, setValue: function setValue(value) { if (this.el) { $(this.el).trigger("setvalue", [value]) } }, analyseMask: function analyseMask(mask, regexMask, opts) { var tokenizer = /(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?(?:\|[0-9\+\*]*)?\})|[^.?*+^${[]()|\\]+|./g, regexTokenizer = /\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g, escaped = false, currentToken = new MaskToken, match, m, openenings = [], maskTokens = [], openingToken, currentOpeningToken, alternator, lastMatch, groupToken; function MaskToken(isGroup, isOptional, isQuantifier, isAlternator) { this.matches = []; this.openGroup = isGroup || false; this.alternatorGroup = false; this.isGroup = isGroup || false; this.isOptional = isOptional || false; this.isQuantifier = isQuantifier || false; this.isAlternator = isAlternator || false; this.quantifier = { min: 1, max: 1 } } function insertTestDefinition(mtoken, element, position) { position = position !== undefined ? position : mtoken.matches.length; var prevMatch = mtoken.matches[position - 1]; if (regexMask) { if (element.indexOf("[") === 0 || escaped && /\\d|\\s|\\w]/i.test(element) || element === ".") { mtoken.matches.splice(position++, 0, { fn: new RegExp(element, opts.casing ? "i" : ""), optionality: false, newBlockMarker: prevMatch === undefined ? "master" : prevMatch.def !== element, casing: null, def: element, placeholder: undefined, nativeDef: element }) } else { if (escaped) element = element[element.length - 1]; $.each(element.split(""), function (ndx, lmnt) { prevMatch = mtoken.matches[position - 1]; mtoken.matches.splice(position++, 0, { fn: null, optionality: false, newBlockMarker: prevMatch === undefined ? "master" : prevMatch.def !== lmnt && prevMatch.fn !== null, casing: null, def: opts.staticDefinitionSymbol || lmnt, placeholder: opts.staticDefinitionSymbol !== undefined ? lmnt : undefined, nativeDef: (escaped ? "'" : "") + lmnt }) }) } escaped = false } else { var maskdef = (opts.definitions ? opts.definitions[element] : undefined) || Inputmask.prototype.definitions[element]; if (maskdef && !escaped) { mtoken.matches.splice(position++, 0, { fn: maskdef.validator ? typeof maskdef.validator == "string" ? new RegExp(maskdef.validator, opts.casing ? "i" : "") : new function () { this.test = maskdef.validator } : new RegExp("."), optionality: false, newBlockMarker: prevMatch === undefined ? "master" : prevMatch.def !== (maskdef.definitionSymbol || element), casing: maskdef.casing, def: maskdef.definitionSymbol || element, placeholder: maskdef.placeholder, nativeDef: element }) } else { mtoken.matches.splice(position++, 0, { fn: null, optionality: false, newBlockMarker: prevMatch === undefined ? "master" : prevMatch.def !== element && prevMatch.fn !== null, casing: null, def: opts.staticDefinitionSymbol || element, placeholder: opts.staticDefinitionSymbol !== undefined ? element : undefined, nativeDef: (escaped ? "'" : "") + element }); escaped = false } } } function verifyGroupMarker(maskToken) { if (maskToken && maskToken.matches) { $.each(maskToken.matches, function (ndx, token) { var nextToken = maskToken.matches[ndx + 1]; if ((nextToken === undefined || nextToken.matches === undefined || nextToken.isQuantifier === false) && token && token.isGroup) { token.isGroup = false; if (!regexMask) { insertTestDefinition(token, opts.groupmarker[0], 0); if (token.openGroup !== true) { insertTestDefinition(token, opts.groupmarker[1]) } } } verifyGroupMarker(token) }) } } function defaultCase() { if (openenings.length > 0) { currentOpeningToken = openenings[openenings.length - 1]; insertTestDefinition(currentOpeningToken, m); if (currentOpeningToken.isAlternator) { alternator = openenings.pop(); for (var mndx = 0; mndx < alternator.matches.length; mndx++) { if (alternator.matches[mndx].isGroup) alternator.matches[mndx].isGroup = false } if (openenings.length > 0) { currentOpeningToken = openenings[openenings.length - 1]; currentOpeningToken.matches.push(alternator) } else { currentToken.matches.push(alternator) } } } else { insertTestDefinition(currentToken, m) } } function reverseTokens(maskToken) { function reverseStatic(st) { if (st === opts.optionalmarker[0]) st = opts.optionalmarker[1]; else if (st === opts.optionalmarker[1]) st = opts.optionalmarker[0]; else if (st === opts.groupmarker[0]) st = opts.groupmarker[1]; else if (st === opts.groupmarker[1]) st = opts.groupmarker[0]; return st } maskToken.matches = maskToken.matches.reverse(); for (var match in maskToken.matches) { if (maskToken.matches.hasOwnProperty(match)) { var intMatch = parseInt(match); if (maskToken.matches[match].isQuantifier && maskToken.matches[intMatch + 1] && maskToken.matches[intMatch + 1].isGroup) { var qt = maskToken.matches[match]; maskToken.matches.splice(match, 1); maskToken.matches.splice(intMatch + 1, 0, qt) } if (maskToken.matches[match].matches !== undefined) { maskToken.matches[match] = reverseTokens(maskToken.matches[match]) } else { maskToken.matches[match] = reverseStatic(maskToken.matches[match]) } } } return maskToken } function groupify(matches) { var groupToken = new MaskToken(true); groupToken.openGroup = false; groupToken.matches = matches; return groupToken } if (regexMask) { opts.optionalmarker[0] = undefined; opts.optionalmarker[1] = undefined } while (match = regexMask ? regexTokenizer.exec(mask) : tokenizer.exec(mask)) { m = match[0]; if (regexMask) { switch (m.charAt(0)) { case "?": m = "{0,1}"; break; case "+": case "*": m = "{" + m + "}"; break } } if (escaped) { defaultCase(); continue } switch (m.charAt(0)) { case "(?=": break; case "(?!": break; case "(?<=": break; case "(?<!": break; case opts.escapeChar: escaped = true; if (regexMask) { defaultCase() } break; case opts.optionalmarker[1]: case opts.groupmarker[1]: openingToken = openenings.pop(); openingToken.openGroup = false; if (openingToken !== undefined) { if (openenings.length > 0) { currentOpeningToken = openenings[openenings.length - 1]; currentOpeningToken.matches.push(openingToken); if (currentOpeningToken.isAlternator) { alternator = openenings.pop(); for (var mndx = 0; mndx < alternator.matches.length; mndx++) { alternator.matches[mndx].isGroup = false; alternator.matches[mndx].alternatorGroup = false } if (openenings.length > 0) { currentOpeningToken = openenings[openenings.length - 1]; currentOpeningToken.matches.push(alternator) } else { currentToken.matches.push(alternator) } } } else { currentToken.matches.push(openingToken) } } else defaultCase(); break; case opts.optionalmarker[0]: openenings.push(new MaskToken(false, true)); break; case opts.groupmarker[0]: openenings.push(new MaskToken(true)); break; case opts.quantifiermarker[0]: var quantifier = new MaskToken(false, false, true); m = m.replace(/[{}]/g, ""); var mqj = m.split("|"), mq = mqj[0].split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = mq.length === 1 ? mq0 : isNaN(mq[1]) ? mq[1] : parseInt(mq[1]); if (mq0 === "*" || mq0 === "+") { mq0 = mq1 === "*" ? 0 : 1 } quantifier.quantifier = { min: mq0, max: mq1, jit: mqj[1] }; var matches = openenings.length > 0 ? openenings[openenings.length - 1].matches : currentToken.matches; match = matches.pop(); if (match.isAlternator) { matches.push(match); matches = match.matches; var groupToken = new MaskToken(true); var tmpMatch = matches.pop(); matches.push(groupToken); matches = groupToken.matches; match = tmpMatch } if (!match.isGroup) { match = groupify([match]) } matches.push(match); matches.push(quantifier); break; case opts.alternatormarker: var groupQuantifier = function groupQuantifier(matches) { var lastMatch = matches.pop(); if (lastMatch.isQuantifier) { lastMatch = groupify([matches.pop(), lastMatch]) } return lastMatch }; if (openenings.length > 0) { currentOpeningToken = openenings[openenings.length - 1]; var subToken = currentOpeningToken.matches[currentOpeningToken.matches.length - 1]; if (currentOpeningToken.openGroup && (subToken.matches === undefined || subToken.isGroup === false && subToken.isAlternator === false)) { lastMatch = openenings.pop() } else { lastMatch = groupQuantifier(currentOpeningToken.matches) } } else { lastMatch = groupQuantifier(currentToken.matches) } if (lastMatch.isAlternator) { openenings.push(lastMatch) } else { if (lastMatch.alternatorGroup) { alternator = openenings.pop(); lastMatch.alternatorGroup = false } else { alternator = new MaskToken(false, false, false, true) } alternator.matches.push(lastMatch); openenings.push(alternator); if (lastMatch.openGroup) { lastMatch.openGroup = false; var alternatorGroup = new MaskToken(true); alternatorGroup.alternatorGroup = true; openenings.push(alternatorGroup) } } break; default: defaultCase() } } while (openenings.length > 0) { openingToken = openenings.pop(); currentToken.matches.push(openingToken) } if (currentToken.matches.length > 0) { verifyGroupMarker(currentToken); maskTokens.push(currentToken) } if (opts.numericInput || opts.isRTL) { reverseTokens(maskTokens[0]) } return maskTokens } }; Inputmask.extendDefaults = function (options) { $.extend(true, Inputmask.prototype.defaults, options) }; Inputmask.extendDefinitions = function (definition) { $.extend(true, Inputmask.prototype.definitions, definition) }; Inputmask.extendAliases = function (alias) { $.extend(true, Inputmask.prototype.aliases, alias) }; Inputmask.format = function (value, options, metadata) { return Inputmask(options).format(value, metadata) }; Inputmask.unmask = function (value, options) { return Inputmask(options).unmaskedvalue(value) }; Inputmask.isValid = function (value, options) { return Inputmask(options).isValid(value) }; Inputmask.remove = function (elems) { if (typeof elems === "string") { elems = document.getElementById(elems) || document.querySelectorAll(elems) } elems = elems.nodeName ? [elems] : elems; $.each(elems, function (ndx, el) { if (el.inputmask) el.inputmask.remove() }) }; Inputmask.setValue = function (elems, value) { if (typeof elems === "string") { elems = document.getElementById(elems) || document.querySelectorAll(elems) } elems = elems.nodeName ? [elems] : elems; $.each(elems, function (ndx, el) { if (el.inputmask) el.inputmask.setValue(value); else $(el).trigger("setvalue", [value]) }) }; Inputmask.escapeRegex = function (str) { var specials = ["/", ".", "*", "+", "?", "|", "(", ")", "[", "]", "{", "}", "\\", "$", "^"]; return str.replace(new RegExp("(\\" + specials.join("|\\") + ")", "gim"), "\\$1") }; Inputmask.keyCode = { BACKSPACE: 8, BACKSPACE_SAFARI: 127, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, INSERT: 45, LEFT: 37, PAGE_DOWN: 34, PAGE_UP: 33, RIGHT: 39, SPACE: 32, TAB: 9, UP: 38, X: 88, CONTROL: 17 }; Inputmask.dependencyLib = $; function resolveAlias(aliasStr, options, opts) { var aliasDefinition = Inputmask.prototype.aliases[aliasStr]; if (aliasDefinition) { if (aliasDefinition.alias) resolveAlias(aliasDefinition.alias, undefined, opts); $.extend(true, opts, aliasDefinition); $.extend(true, opts, options); return true } else if (opts.mask === null) { opts.mask = aliasStr } return false } function generateMaskSet(opts, nocache) { function generateMask(mask, metadata, opts) { var regexMask = false; if (mask === null || mask === "") { regexMask = opts.regex !== null; if (regexMask) { mask = opts.regex; mask = mask.replace(/^(\^)(.*)(\$)$/, "$2") } else { regexMask = true; mask = ".*" } } if (mask.length === 1 && opts.greedy === false && opts.repeat !== 0) { opts.placeholder = "" } if (opts.repeat > 0 || opts.repeat === "*" || opts.repeat === "+") { var repeatStart = opts.repeat === "*" ? 0 : opts.repeat === "+" ? 1 : opts.repeat; mask = opts.groupmarker[0] + mask + opts.groupmarker[1] + opts.quantifiermarker[0] + repeatStart + "," + opts.repeat + opts.quantifiermarker[1] } var masksetDefinition, maskdefKey = regexMask ? "regex_" + opts.regex : opts.numericInput ? mask.split("").reverse().join("") : mask; if (Inputmask.prototype.masksCache[maskdefKey] === undefined || nocache === true) { masksetDefinition = { mask: mask, maskToken: Inputmask.prototype.analyseMask(mask, regexMask, opts), validPositions: {}, _buffer: undefined, buffer: undefined, tests: {}, excludes: {}, metadata: metadata, maskLength: undefined, jitOffset: {} }; if (nocache !== true) { Inputmask.prototype.masksCache[maskdefKey] = masksetDefinition; masksetDefinition = $.extend(true, {}, Inputmask.prototype.masksCache[maskdefKey]) } } else masksetDefinition = $.extend(true, {}, Inputmask.prototype.masksCache[maskdefKey]); return masksetDefinition } var ms; if ($.isFunction(opts.mask)) { opts.mask = opts.mask(opts) } if ($.isArray(opts.mask)) { if (opts.mask.length > 1) { if (opts.keepStatic === null) { opts.keepStatic = "auto"; for (var i = 0; i < opts.mask.length; i++) { if (opts.mask[i].charAt(0) !== opts.mask[0].charAt(0)) { opts.keepStatic = true; break } } } var altMask = opts.groupmarker[0]; $.each(opts.isRTL ? opts.mask.reverse() : opts.mask, function (ndx, msk) { if (altMask.length > 1) { altMask += opts.groupmarker[1] + opts.alternatormarker + opts.groupmarker[0] } if (msk.mask !== undefined && !$.isFunction(msk.mask)) { altMask += msk.mask } else { altMask += msk } }); altMask += opts.groupmarker[1]; return generateMask(altMask, opts.mask, opts) } else opts.mask = opts.mask.pop() } if (opts.mask && opts.mask.mask !== undefined && !$.isFunction(opts.mask.mask)) { ms = generateMask(opts.mask.mask, opts.mask, opts) } else { ms = generateMask(opts.mask, opts.mask, opts) } return ms } function isInputEventSupported(eventName) { var el = document.createElement("input"), evName = "on" + eventName, isSupported = evName in el; if (!isSupported) { el.setAttribute(evName, "return;"); isSupported = typeof el[evName] === "function" } el = null; return isSupported } function maskScope(actionObj, maskset, opts) { maskset = maskset || this.maskset; opts = opts || this.opts; var inputmask = this, el = this.el, isRTL = this.isRTL, undoValue, $el, skipKeyPressEvent = false, skipInputEvent = false, ignorable = false, maxLength, mouseEnter = false, colorMask, originalPlaceholder; function getMaskTemplate(baseOnInput, minimalPos, includeMode, noJit, clearOptionalTail) { var greedy = opts.greedy; if (clearOptionalTail) opts.greedy = false; minimalPos = minimalPos || 0; var maskTemplate = [], ndxIntlzr, pos = 0, test, testPos, lvp = getLastValidPosition(); do { if (baseOnInput === true && getMaskSet().validPositions[pos]) { testPos = clearOptionalTail && getMaskSet().validPositions[pos].match.optionality === true && getMaskSet().validPositions[pos + 1] === undefined && (getMaskSet().validPositions[pos].generatedInput === true || getMaskSet().validPositions[pos].input == opts.skipOptionalPartCharacter && pos > 0) ? determineTestTemplate(pos, getTests(pos, ndxIntlzr, pos - 1)) : getMaskSet().validPositions[pos]; test = testPos.match; ndxIntlzr = testPos.locator.slice(); maskTemplate.push(includeMode === true ? testPos.input : includeMode === false ? test.nativeDef : getPlaceholder(pos, test)) } else { testPos = getTestTemplate(pos, ndxIntlzr, pos - 1); test = testPos.match; ndxIntlzr = testPos.locator.slice(); var jitMasking = noJit === true ? false : opts.jitMasking !== false ? opts.jitMasking : test.jit; if (jitMasking === false || jitMasking === undefined || typeof jitMasking === "number" && isFinite(jitMasking) && jitMasking > pos) { maskTemplate.push(includeMode === false ? test.nativeDef : getPlaceholder(pos, test)) } } if (opts.keepStatic === "auto") { if (test.newBlockMarker && test.fn !== null) { opts.keepStatic = pos - 1 } } pos++ } while ((maxLength === undefined || pos < maxLength) && (test.fn !== null || test.def !== "") || minimalPos > pos); if (maskTemplate[maskTemplate.length - 1] === "") { maskTemplate.pop() } if (includeMode !== false || getMaskSet().maskLength === undefined) getMaskSet().maskLength = pos - 1; opts.greedy = greedy; return maskTemplate } function getMaskSet() { return maskset } function resetMaskSet(soft) { var maskset = getMaskSet(); maskset.buffer = undefined; if (soft !== true) { maskset.validPositions = {}; maskset.p = 0 } } function getLastValidPosition(closestTo, strict, validPositions) { var before = -1, after = -1, valids = validPositions || getMaskSet().validPositions; if (closestTo === undefined) closestTo = -1; for (var posNdx in valids) { var psNdx = parseInt(posNdx); if (valids[psNdx] && (strict || valids[psNdx].generatedInput !== true)) { if (psNdx <= closestTo) before = psNdx; if (psNdx >= closestTo) after = psNdx } } return before === -1 || before == closestTo ? after : after == -1 ? before : closestTo - before < after - closestTo ? before : after } function getDecisionTaker(tst) { var decisionTaker = tst.locator[tst.alternation]; if (typeof decisionTaker == "string" && decisionTaker.length > 0) { decisionTaker = decisionTaker.split(",")[0] } return decisionTaker !== undefined ? decisionTaker.toString() : "" } function getLocator(tst, align) { var locator = (tst.alternation != undefined ? tst.mloc[getDecisionTaker(tst)] : tst.locator).join(""); if (locator !== "") while (locator.length < align) { locator += "0" } return locator } function determineTestTemplate(pos, tests) { pos = pos > 0 ? pos - 1 : 0; var altTest = getTest(pos), targetLocator = getLocator(altTest), tstLocator, closest, bestMatch; for (var ndx = 0; ndx < tests.length; ndx++) { var tst = tests[ndx]; tstLocator = getLocator(tst, targetLocator.length); var distance = Math.abs(tstLocator - targetLocator); if (closest === undefined || tstLocator !== "" && distance < closest || bestMatch && !opts.greedy && bestMatch.match.optionality && bestMatch.match.newBlockMarker === "master" && (!tst.match.optionality || !tst.match.newBlockMarker) || bestMatch && bestMatch.match.optionalQuantifier && !tst.match.optionalQuantifier) { closest = distance; bestMatch = tst } } return bestMatch } function getTestTemplate(pos, ndxIntlzr, tstPs) { return getMaskSet().validPositions[pos] || determineTestTemplate(pos, getTests(pos, ndxIntlzr ? ndxIntlzr.slice() : ndxIntlzr, tstPs)) } function getTest(pos, tests) { if (getMaskSet().validPositions[pos]) { return getMaskSet().validPositions[pos] } return (tests || getTests(pos))[0] } function positionCanMatchDefinition(pos, def) { var valid = false, tests = getTests(pos); for (var tndx = 0; tndx < tests.length; tndx++) { if (tests[tndx].match && tests[tndx].match.def === def) { valid = true; break } } return valid } function getTests(pos, ndxIntlzr, tstPs) { var maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr ? ndxIntlzr.slice() : [0], matches = [], insertStop = false, latestMatch, cacheDependency = ndxIntlzr ? ndxIntlzr.join("") : ""; function resolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) { function handleMatch(match, loopNdx, quantifierRecurse) { function isFirstMatch(latestMatch, tokenGroup) { var firstMatch = $.inArray(latestMatch, tokenGroup.matches) === 0; if (!firstMatch) { $.each(tokenGroup.matches, function (ndx, match) { if (match.isQuantifier === true) firstMatch = isFirstMatch(latestMatch, tokenGroup.matches[ndx - 1]); else if (match.hasOwnProperty("matches")) firstMatch = isFirstMatch(latestMatch, match); if (firstMatch) return false }) } return firstMatch } function resolveNdxInitializer(pos, alternateNdx, targetAlternation) { var bestMatch, indexPos; if (getMaskSet().tests[pos] || getMaskSet().validPositions[pos]) { $.each(getMaskSet().tests[pos] || [getMaskSet().validPositions[pos]], function (ndx, lmnt) { if (lmnt.mloc[alternateNdx]) { bestMatch = lmnt; return false } var alternation = targetAlternation !== undefined ? targetAlternation : lmnt.alternation, ndxPos = lmnt.locator[alternation] !== undefined ? lmnt.locator[alternation].toString().indexOf(alternateNdx) : -1; if ((indexPos === undefined || ndxPos < indexPos) && ndxPos !== -1) { bestMatch = lmnt; indexPos = ndxPos } }) } if (bestMatch) { var bestMatchAltIndex = bestMatch.locator[bestMatch.alternation]; var locator = bestMatch.mloc[alternateNdx] || bestMatch.mloc[bestMatchAltIndex] || bestMatch.locator; return locator.slice((targetAlternation !== undefined ? targetAlternation : bestMatch.alternation) + 1) } else { return targetAlternation !== undefined ? resolveNdxInitializer(pos, alternateNdx) : undefined } } function isSubsetOf(source, target) { function expand(pattern) { var expanded = [], start, end; for (var i = 0, l = pattern.length; i < l; i++) { if (pattern.charAt(i) === "-") { end = pattern.charCodeAt(i + 1); while (++start < end) { expanded.push(String.fromCharCode(start)) } } else { start = pattern.charCodeAt(i); expanded.push(pattern.charAt(i)) } } return expanded.join("") } if (opts.regex && source.match.fn !== null && target.match.fn !== null) { return expand(target.match.def.replace(/[\[\]]/g, "")).indexOf(expand(source.match.def.replace(/[\[\]]/g, ""))) !== -1 } return source.match.def === target.match.nativeDef } function staticCanMatchDefinition(source, target) { var sloc = source.locator.slice(source.alternation).join(""), tloc = target.locator.slice(target.alternation).join(""), canMatch = sloc == tloc; canMatch = canMatch && source.match.fn === null && target.match.fn !== null ? target.match.fn.test(source.match.def, getMaskSet(), pos, false, opts, false) : false; return canMatch } function setMergeLocators(targetMatch, altMatch) { if (altMatch === undefined || targetMatch.alternation === altMatch.alternation && targetMatch.locator[targetMatch.alternation].toString().indexOf(altMatch.locator[altMatch.alternation]) === -1) { targetMatch.mloc = targetMatch.mloc || {}; var locNdx = targetMatch.locator[targetMatch.alternation]; if (locNdx === undefined) targetMatch.alternation = undefined; else { if (typeof locNdx === "string") locNdx = locNdx.split(",")[0]; if (targetMatch.mloc[locNdx] === undefined) targetMatch.mloc[locNdx] = targetMatch.locator.slice(); if (altMatch !== undefined) { for (var ndx in altMatch.mloc) { if (typeof ndx === "string") ndx = ndx.split(",")[0]; if (targetMatch.mloc[ndx] === undefined) targetMatch.mloc[ndx] = altMatch.mloc[ndx] } targetMatch.locator[targetMatch.alternation] = Object.keys(targetMatch.mloc).join(",") } return true } } return false } if (testPos > 500 && quantifierRecurse !== undefined) { throw "Inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. " + getMaskSet().mask } if (testPos === pos && match.matches === undefined) { matches.push({ match: match, locator: loopNdx.reverse(), cd: cacheDependency, mloc: {} }); return true } else if (match.matches !== undefined) { if (match.isGroup && quantifierRecurse !== match) { match = handleMatch(maskToken.matches[$.inArray(match, maskToken.matches) + 1], loopNdx, quantifierRecurse); if (match) return true } else if (match.isOptional) { var optionalToken = match; match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse); if (match) { $.each(matches, function (ndx, mtch) { mtch.match.optionality = true }); latestMatch = matches[matches.length - 1].match; if (quantifierRecurse === undefined && isFirstMatch(latestMatch, optionalToken)) { insertStop = true; testPos = pos } else return true } } else if (match.isAlternator) { var alternateToken = match, malternateMatches = [], maltMatches, currentMatches = matches.slice(), loopNdxCnt = loopNdx.length; var altIndex = ndxInitializer.length > 0 ? ndxInitializer.shift() : -1; if (altIndex === -1 || typeof altIndex === "string") { var currentPos = testPos, ndxInitializerClone = ndxInitializer.slice(), altIndexArr = [], amndx; if (typeof altIndex == "string") { altIndexArr = altIndex.split(",") } else { for (amndx = 0; amndx < alternateToken.matches.length; amndx++) { altIndexArr.push(amndx.toString()) } } if (getMaskSet().excludes[pos]) { var altIndexArrClone = altIndexArr.slice(); for (var i = 0, el = getMaskSet().excludes[pos].length; i < el; i++) { altIndexArr.splice(altIndexArr.indexOf(getMaskSet().excludes[pos][i].toString()), 1) } if (altIndexArr.length === 0) { getMaskSet().excludes[pos] = undefined; altIndexArr = altIndexArrClone } } if (opts.keepStatic === true || isFinite(parseInt(opts.keepStatic)) && currentPos >= opts.keepStatic) altIndexArr = altIndexArr.slice(0, 1); var unMatchedAlternation = false; for (var ndx = 0; ndx < altIndexArr.length; ndx++) { amndx = parseInt(altIndexArr[ndx]); matches = []; ndxInitializer = typeof altIndex === "string" ? resolveNdxInitializer(testPos, amndx, loopNdxCnt) || ndxInitializerClone.slice() : ndxInitializerClone.slice(); if (alternateToken.matches[amndx] && handleMatch(alternateToken.matches[amndx], [amndx].concat(loopNdx), quantifierRecurse)) match = true; else if (ndx === 0) { unMatchedAlternation = true } maltMatches = matches.slice(); testPos = currentPos; matches = []; for (var ndx1 = 0; ndx1 < maltMatches.length; ndx1++) { var altMatch = maltMatches[ndx1], dropMatch = false; altMatch.match.jit = altMatch.match.jit || unMatchedAlternation; altMatch.alternation = altMatch.alternation || loopNdxCnt; setMergeLocators(altMatch); for (var ndx2 = 0; ndx2 < malternateMatches.length; ndx2++) { var altMatch2 = malternateMatches[ndx2]; if (typeof altIndex !== "string" || altMatch.alternation !== undefined && $.inArray(altMatch.locator[altMatch.alternation].toString(), altIndexArr) !== -1) { if (altMatch.match.nativeDef === altMatch2.match.nativeDef) { dropMatch = true; setMergeLocators(altMatch2, altMatch); break } else if (isSubsetOf(altMatch, altMatch2)) { if (setMergeLocators(altMatch, altMatch2)) { dropMatch = true; malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch) } break } else if (isSubsetOf(altMatch2, altMatch)) { setMergeLocators(altMatch2, altMatch); break } else if (staticCanMatchDefinition(altMatch, altMatch2)) { if (setMergeLocators(altMatch, altMatch2)) { dropMatch = true; malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch) } break } } } if (!dropMatch) { malternateMatches.push(altMatch) } } } matches = currentMatches.concat(malternateMatches); testPos = pos; insertStop = matches.length > 0; match = malternateMatches.length > 0; ndxInitializer = ndxInitializerClone.slice() } else match = handleMatch(alternateToken.matches[altIndex] || maskToken.matches[altIndex], [altIndex].concat(loopNdx), quantifierRecurse); if (match) return true } else if (match.isQuantifier && quantifierRecurse !== maskToken.matches[$.inArray(match, maskToken.matches) - 1]) { var qt = match; for (var qndx = ndxInitializer.length > 0 ? ndxInitializer.shift() : 0; qndx < (isNaN(qt.quantifier.max) ? qndx + 1 : qt.quantifier.max) && testPos <= pos; qndx++) { var tokenGroup = maskToken.matches[$.inArray(qt, maskToken.matches) - 1]; match = handleMatch(tokenGroup, [qndx].concat(loopNdx), tokenGroup); if (match) { latestMatch = matches[matches.length - 1].match; latestMatch.optionalQuantifier = qndx >= qt.quantifier.min; latestMatch.jit = (qndx || 1) * tokenGroup.matches.indexOf(latestMatch) >= qt.quantifier.jit; if (latestMatch.optionalQuantifier && isFirstMatch(latestMatch, tokenGroup)) { insertStop = true; testPos = pos; break } if (latestMatch.jit) { getMaskSet().jitOffset[pos] = tokenGroup.matches.indexOf(latestMatch) } return true } } } else { match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse); if (match) return true } } else { testPos++ } } for (var tndx = ndxInitializer.length > 0 ? ndxInitializer.shift() : 0; tndx < maskToken.matches.length; tndx++) { if (maskToken.matches[tndx].isQuantifier !== true) { var match = handleMatch(maskToken.matches[tndx], [tndx].concat(loopNdx), quantifierRecurse); if (match && testPos === pos) { return match } else if (testPos > pos) { break } } } } function mergeLocators(pos, tests) { var locator = []; if (!$.isArray(tests)) tests = [tests]; if (tests.length > 0) { if (tests[0].alternation === undefined) { locator = determineTestTemplate(pos, tests.slice()).locator.slice(); if (locator.length === 0) locator = tests[0].locator.slice() } else { $.each(tests, function (ndx, tst) { if (tst.def !== "") { if (locator.length === 0) locator = tst.locator.slice(); else { for (var i = 0; i < locator.length; i++) { if (tst.locator[i] && locator[i].toString().indexOf(tst.locator[i]) === -1) { locator[i] += "," + tst.locator[i] } } } } }) } } return locator } if (pos > -1) { if (ndxIntlzr === undefined) { var previousPos = pos - 1, test; while ((test = getMaskSet().validPositions[previousPos] || getMaskSet().tests[previousPos]) === undefined && previousPos > -1) { previousPos-- } if (test !== undefined && previousPos > -1) { ndxInitializer = mergeLocators(previousPos, test); cacheDependency = ndxInitializer.join(""); testPos = previousPos } } if (getMaskSet().tests[pos] && getMaskSet().tests[pos][0].cd === cacheDependency) { return getMaskSet().tests[pos] } for (var mtndx = ndxInitializer.shift(); mtndx < maskTokens.length; mtndx++) { var match = resolveTestFromToken(maskTokens[mtndx], ndxInitializer, [mtndx]); if (match && testPos === pos || testPos > pos) { break } } } if (matches.length === 0 || insertStop) { matches.push({ match: { fn: null, optionality: false, casing: null, def: "", placeholder: "" }, locator: [], mloc: {}, cd: cacheDependency }) } if (ndxIntlzr !== undefined && getMaskSet().tests[pos]) { return $.extend(true, [], matches) } getMaskSet().tests[pos] = $.extend(true, [], matches); return getMaskSet().tests[pos] } function getBufferTemplate() { if (getMaskSet()._buffer === undefined) { getMaskSet()._buffer = getMaskTemplate(false, 1); if (getMaskSet().buffer === undefined) getMaskSet().buffer = getMaskSet()._buffer.slice() } return getMaskSet()._buffer } function getBuffer(noCache) { if (getMaskSet().buffer === undefined || noCache === true) { getMaskSet().buffer = getMaskTemplate(true, getLastValidPosition(), true); if (getMaskSet()._buffer === undefined) getMaskSet()._buffer = getMaskSet().buffer.slice() } return getMaskSet().buffer } function refreshFromBuffer(start, end, buffer) { var i, p; if (start === true) { resetMaskSet(); start = 0; end = buffer.length } else { for (i = start; i < end; i++) { delete getMaskSet().validPositions[i] } } p = start; for (i = start; i < end; i++) { resetMaskSet(true); if (buffer[i] !== opts.skipOptionalPartCharacter) { var valResult = isValid(p, buffer[i], true, true); if (valResult !== false) { resetMaskSet(true); p = valResult.caret !== undefined ? valResult.caret : valResult.pos + 1 } } } } function casing(elem, test, pos) { switch (opts.casing || test.casing) { case "upper": elem = elem.toUpperCase(); break; case "lower": elem = elem.toLowerCase(); break; case "title": var posBefore = getMaskSet().validPositions[pos - 1]; if (pos === 0 || posBefore && posBefore.input === String.fromCharCode(Inputmask.keyCode.SPACE)) { elem = elem.toUpperCase() } else { elem = elem.toLowerCase() } break; default: if ($.isFunction(opts.casing)) { var args = Array.prototype.slice.call(arguments); args.push(getMaskSet().validPositions); elem = opts.casing.apply(this, args) } }return elem } function checkAlternationMatch(altArr1, altArr2, na) { var altArrC = opts.greedy ? altArr2 : altArr2.slice(0, 1), isMatch = false, naArr = na !== undefined ? na.split(",") : [], naNdx; for (var i = 0; i < naArr.length; i++) { if ((naNdx = altArr1.indexOf(naArr[i])) !== -1) { altArr1.splice(naNdx, 1) } } for (var alndx = 0; alndx < altArr1.length; alndx++) { if ($.inArray(altArr1[alndx], altArrC) !== -1) { isMatch = true; break } } return isMatch } function alternate(pos, c, strict, fromSetValid, rAltPos) { var validPsClone = $.extend(true, {}, getMaskSet().validPositions), lastAlt, alternation, isValidRslt = false, altPos, prevAltPos, i, validPos, decisionPos, lAltPos = rAltPos !== undefined ? rAltPos : getLastValidPosition(); if (lAltPos === -1 && rAltPos === undefined) { lastAlt = 0; prevAltPos = getTest(lastAlt); alternation = prevAltPos.alternation } else { for (; lAltPos >= 0; lAltPos--) { altPos = getMaskSet().validPositions[lAltPos]; if (altPos && altPos.alternation !== undefined) { if (prevAltPos && prevAltPos.locator[altPos.alternation] !== altPos.locator[altPos.alternation]) { break } lastAlt = lAltPos; alternation = getMaskSet().validPositions[lastAlt].alternation; prevAltPos = altPos } } } if (alternation !== undefined) { decisionPos = parseInt(lastAlt); getMaskSet().excludes[decisionPos] = getMaskSet().excludes[decisionPos] || []; if (pos !== true) { getMaskSet().excludes[decisionPos].push(getDecisionTaker(prevAltPos)) } var validInputsClone = [], staticInputsBeforePos = 0; for (i = decisionPos; i < getLastValidPosition(undefined, true) + 1; i++) { validPos = getMaskSet().validPositions[i]; if (validPos && validPos.generatedInput !== true) { validInputsClone.push(validPos.input) } else if (i < pos) staticInputsBeforePos++; delete getMaskSet().validPositions[i] } while (getMaskSet().excludes[decisionPos] && getMaskSet().excludes[decisionPos].length < 10) { var posOffset = staticInputsBeforePos * -1, validInputs = validInputsClone.slice(); getMaskSet().tests[decisionPos] = undefined; resetMaskSet(true); isValidRslt = true; while (validInputs.length > 0) { var input = validInputs.shift(); if (!(isValidRslt = isValid(getLastValidPosition(undefined, true) + 1, input, false, fromSetValid, true))) { break } } if (isValidRslt && c !== undefined) { var targetLvp = getLastValidPosition(pos) + 1; for (i = decisionPos; i < getLastValidPosition() + 1; i++) { validPos = getMaskSet().validPositions[i]; if ((validPos === undefined || validPos.match.fn == null) && i < pos + posOffset) { posOffset++ } } pos = pos + posOffset; isValidRslt = isValid(pos > targetLvp ? targetLvp : pos, c, strict, fromSetValid, true) } if (!isValidRslt) { resetMaskSet(); prevAltPos = getTest(decisionPos); getMaskSet().validPositions = $.extend(true, {}, validPsClone); if (getMaskSet().excludes[decisionPos]) { var decisionTaker = getDecisionTaker(prevAltPos); if (getMaskSet().excludes[decisionPos].indexOf(decisionTaker) !== -1) { isValidRslt = alternate(pos, c, strict, fromSetValid, decisionPos - 1); break } getMaskSet().excludes[decisionPos].push(decisionTaker); for (i = decisionPos; i < getLastValidPosition(undefined, true) + 1; i++) { delete getMaskSet().validPositions[i] } } else { isValidRslt = alternate(pos, c, strict, fromSetValid, decisionPos - 1); break } } else break } } getMaskSet().excludes[decisionPos] = undefined; return isValidRslt } function isValid(pos, c, strict, fromSetValid, fromAlternate, validateOnly) { function isSelection(posObj) { return isRTL ? posObj.begin - posObj.end > 1 || posObj.begin - posObj.end === 1 : posObj.end - posObj.begin > 1 || posObj.end - posObj.begin === 1 } strict = strict === true; var maskPos = pos; if (pos.begin !== undefined) { maskPos = isRTL ? pos.end : pos.begin } function _isValid(position, c, strict) { var rslt = false; $.each(getTests(position), function (ndx, tst) { var test = tst.match; getBuffer(true); rslt = test.fn != null ? test.fn.test(c, getMaskSet(), position, strict, opts, isSelection(pos)) : (c === test.def || c === opts.skipOptionalPartCharacter) && test.def !== "" ? { c: getPlaceholder(position, test, true) || test.def, pos: position } : false; if (rslt !== false) { var elem = rslt.c !== undefined ? rslt.c : c, validatedPos = position; elem = elem === opts.skipOptionalPartCharacter && test.fn === null ? getPlaceholder(position, test, true) || test.def : elem; if (rslt.remove !== undefined) { if (!$.isArray(rslt.remove)) rslt.remove = [rslt.remove]; $.each(rslt.remove.sort(function (a, b) { return b - a }), function (ndx, lmnt) { revalidateMask({ begin: lmnt, end: lmnt + 1 }) }) } if (rslt.insert !== undefined) { if (!$.isArray(rslt.insert)) rslt.insert = [rslt.insert]; $.each(rslt.insert.sort(function (a, b) { return a - b }), function (ndx, lmnt) { isValid(lmnt.pos, lmnt.c, true, fromSetValid) }) } if (rslt !== true && rslt.pos !== undefined && rslt.pos !== position) { validatedPos = rslt.pos } if (rslt !== true && rslt.pos === undefined && rslt.c === undefined) { return false } if (!revalidateMask(pos, $.extend({}, tst, { input: casing(elem, test, validatedPos) }), fromSetValid, validatedPos)) { rslt = false } return false } }); return rslt } var result = true, positionsClone = $.extend(true, {}, getMaskSet().validPositions); if ($.isFunction(opts.preValidation) && !strict && fromSetValid !== true && validateOnly !== true) { result = opts.preValidation(getBuffer(), maskPos, c, isSelection(pos), opts, getMaskSet()) } if (result === true) { trackbackPositions(undefined, maskPos, true); if (maxLength === undefined || maskPos < maxLength) { result = _isValid(maskPos, c, strict); if ((!strict || fromSetValid === true) && result === false && validateOnly !== true) { var currentPosValid = getMaskSet().validPositions[maskPos]; if (currentPosValid && currentPosValid.match.fn === null && (currentPosValid.match.def === c || c === opts.skipOptionalPartCharacter)) { result = { caret: seekNext(maskPos) } } else { if ((opts.insertMode || getMaskSet().validPositions[seekNext(maskPos)] === undefined) && (!isMask(maskPos, true) || getMaskSet().jitOffset[maskPos])) { if (getMaskSet().jitOffset[maskPos] && getMaskSet().validPositions[seekNext(maskPos)] === undefined) { result = isValid(maskPos + getMaskSet().jitOffset[maskPos], c, strict); if (result !== false) result.caret = maskPos } else for (var nPos = maskPos + 1, snPos = seekNext(maskPos); nPos <= snPos; nPos++) { result = _isValid(nPos, c, strict); if (result !== false) { result = trackbackPositions(maskPos, result.pos !== undefined ? result.pos : nPos) || result; maskPos = nPos; break } } } } } } if (result === false && opts.keepStatic !== false && (opts.regex == null || isComplete(getBuffer())) && !strict && fromAlternate !== true) { result = alternate(maskPos, c, strict, fromSetValid) } if (result === true) { result = { pos: maskPos } } } if ($.isFunction(opts.postValidation) && result !== false && !strict && fromSetValid !== true && validateOnly !== true) { var postResult = opts.postValidation(getBuffer(true), pos.begin !== undefined ? isRTL ? pos.end : pos.begin : pos, result, opts); if (postResult !== undefined) { if (postResult.refreshFromBuffer && postResult.buffer) { var refresh = postResult.refreshFromBuffer; refreshFromBuffer(refresh === true ? refresh : refresh.start, refresh.end, postResult.buffer) } result = postResult === true ? result : postResult } } if (result && result.pos === undefined) { result.pos = maskPos } if (result === false || validateOnly === true) { resetMaskSet(true); getMaskSet().validPositions = $.extend(true, {}, positionsClone) } return result } function trackbackPositions(originalPos, newPos, fillOnly) { var result; if (originalPos === undefined) { for (originalPos = newPos - 1; originalPos > 0; originalPos--) { if (getMaskSet().validPositions[originalPos]) break } } for (var ps = originalPos; ps < newPos; ps++) { if (getMaskSet().validPositions[ps] === undefined && !isMask(ps, true)) { var vp = ps == 0 ? getTest(ps) : getMaskSet().validPositions[ps - 1]; if (vp) { var tests = getTests(ps).slice(); if (tests[tests.length - 1].match.def === "") tests.pop(); var bestMatch = determineTestTemplate(ps, tests); bestMatch = $.extend({}, bestMatch, { input: getPlaceholder(ps, bestMatch.match, true) || bestMatch.match.def }); bestMatch.generatedInput = true; revalidateMask(ps, bestMatch, true); if (fillOnly !== true) { var cvpInput = getMaskSet().validPositions[newPos].input; getMaskSet().validPositions[newPos] = undefined; result = isValid(newPos, cvpInput, true, true) } } } } return result } function revalidateMask(pos, validTest, fromSetValid, validatedPos) { function IsEnclosedStatic(pos, valids, selection) { var posMatch = valids[pos]; if (posMatch !== undefined && (posMatch.match.fn === null && posMatch.match.optionality !== true || posMatch.input === opts.radixPoint)) { var prevMatch = selection.begin <= pos - 1 ? valids[pos - 1] && valids[pos - 1].match.fn === null && valids[pos - 1] : valids[pos - 1], nextMatch = selection.end > pos + 1 ? valids[pos + 1] && valids[pos + 1].match.fn === null && valids[pos + 1] : valids[pos + 1]; return prevMatch && nextMatch } return false } var begin = pos.begin !== undefined ? pos.begin : pos, end = pos.end !== undefined ? pos.end : pos; if (pos.begin > pos.end) { begin = pos.end; end = pos.begin } validatedPos = validatedPos !== undefined ? validatedPos : begin; if (begin !== end || opts.insertMode && getMaskSet().validPositions[validatedPos] !== undefined && fromSetValid === undefined) { var positionsClone = $.extend(true, {}, getMaskSet().validPositions), lvp = getLastValidPosition(undefined, true), i; getMaskSet().p = begin; for (i = lvp; i >= begin; i--) { if (getMaskSet().validPositions[i] && getMaskSet().validPositions[i].match.nativeDef === "+") { opts.isNegative = false } delete getMaskSet().validPositions[i] } var valid = true, j = validatedPos, vps = getMaskSet().validPositions, needsValidation = false, posMatch = j, i = j; if (validTest) { getMaskSet().validPositions[validatedPos] = $.extend(true, {}, validTest); posMatch++; j++; if (begin < end) i++ } for (; i <= lvp; i++) { var t = positionsClone[i]; if (t !== undefined && (i >= end || i >= begin && t.generatedInput !== true && IsEnclosedStatic(i, positionsClone, { begin: begin, end: end }))) { while (getTest(posMatch).match.def !== "") { if (needsValidation === false && positionsClone[posMatch] && positionsClone[posMatch].match.nativeDef === t.match.nativeDef) { getMaskSet().validPositions[posMatch] = $.extend(true, {}, positionsClone[posMatch]); getMaskSet().validPositions[posMatch].input = t.input; trackbackPositions(undefined, posMatch, true); j = posMatch + 1; valid = true } else if (opts.shiftPositions && positionCanMatchDefinition(posMatch, t.match.def)) { var result = isValid(posMatch, t.input, true, true); valid = result !== false; j = result.caret || result.insert ? getLastValidPosition() : posMatch + 1; needsValidation = true } else { valid = t.generatedInput === true || t.input === opts.radixPoint && opts.numericInput === true } if (valid) break; if (!valid && posMatch > end && isMask(posMatch, true) && (t.match.fn !== null || posMatch > getMaskSet().maskLength)) { break } posMatch++ } if (getTest(posMatch).match.def == "") valid = false; posMatch = j } if (!valid) break } if (!valid) { getMaskSet().validPositions = $.extend(true, {}, positionsClone); resetMaskSet(true); return false } } else if (validTest) { getMaskSet().validPositions[validatedPos] = $.extend(true, {}, validTest) } resetMaskSet(true); return true } function isMask(pos, strict) { var test = getTestTemplate(pos).match; if (test.def === "") test = getTest(pos).match; if (test.fn != null) { return test.fn } if (strict !== true && pos > -1) { var tests = getTests(pos); return tests.length > 1 + (tests[tests.length - 1].match.def === "" ? 1 : 0) } return false } function seekNext(pos, newBlock) { var position = pos + 1; while (getTest(position).match.def !== "" && (newBlock === true && (getTest(position).match.newBlockMarker !== true || !isMask(position)) || newBlock !== true && !isMask(position))) { position++ } return position } function seekPrevious(pos, newBlock) { var position = pos, tests; if (position <= 0) return 0; while (--position > 0 && (newBlock === true && getTest(position).match.newBlockMarker !== true || newBlock !== true && !isMask(position) && (tests = getTests(position), tests.length < 2 || tests.length === 2 && tests[1].match.def === ""))) { } return position } function writeBuffer(input, buffer, caretPos, event, triggerEvents) { if (event && $.isFunction(opts.onBeforeWrite)) { var result = opts.onBeforeWrite.call(inputmask, event, buffer, caretPos, opts); if (result) { if (result.refreshFromBuffer) { var refresh = result.refreshFromBuffer; refreshFromBuffer(refresh === true ? refresh : refresh.start, refresh.end, result.buffer || buffer); buffer = getBuffer(true) } if (caretPos !== undefined) caretPos = result.caret !== undefined ? result.caret : caretPos } } if (input !== undefined) { input.inputmask._valueSet(buffer.join("")); if (caretPos !== undefined && (event === undefined || event.type !== "blur")) { caret(input, caretPos) } else renderColorMask(input, caretPos, buffer.length === 0); if (triggerEvents === true) { var $input = $(input), nptVal = input.inputmask._valueGet(); skipInputEvent = true; $input.trigger("input"); setTimeout(function () { if (nptVal === getBufferTemplate().join("")) { $input.trigger("cleared") } else if (isComplete(buffer) === true) { $input.trigger("complete") } }, 0) } } } function getPlaceholder(pos, test, returnPL) { test = test || getTest(pos).match; if (test.placeholder !== undefined || returnPL === true) { return $.isFunction(test.placeholder) ? test.placeholder(opts) : test.placeholder } else if (test.fn === null) { if (pos > -1 && getMaskSet().validPositions[pos] === undefined) { var tests = getTests(pos), staticAlternations = [], prevTest; if (tests.length > 1 + (tests[tests.length - 1].match.def === "" ? 1 : 0)) { for (var i = 0; i < tests.length; i++) { if (tests[i].match.optionality !== true && tests[i].match.optionalQuantifier !== true && (tests[i].match.fn === null || prevTest === undefined || tests[i].match.fn.test(prevTest.match.def, getMaskSet(), pos, true, opts) !== false)) { staticAlternations.push(tests[i]); if (tests[i].match.fn === null) prevTest = tests[i]; if (staticAlternations.length > 1) { if (/[0-9a-bA-Z]/.test(staticAlternations[0].match.def)) { return opts.placeholder.charAt(pos % opts.placeholder.length) } } } } } } return test.def } return opts.placeholder.charAt(pos % opts.placeholder.length) } function HandleNativePlaceholder(npt, value) { if (ie) { if (npt.inputmask._valueGet() !== value && (npt.placeholder !== value || npt.placeholder === "")) { var buffer = getBuffer().slice(), nptValue = npt.inputmask._valueGet(); if (nptValue !== value) { var lvp = getLastValidPosition(); if (lvp === -1 && nptValue === getBufferTemplate().join("")) { buffer = [] } else if (lvp !== -1) { clearOptionalTail(buffer) } writeBuffer(npt, buffer) } } } else if (npt.placeholder !== value) { npt.placeholder = value; if (npt.placeholder === "") npt.removeAttribute("placeholder") } } var EventRuler = { on: function on(input, eventName, eventHandler) { var ev = function ev(e) { var that = this; if (that.inputmask === undefined && this.nodeName !== "FORM") { var imOpts = $.data(that, "_inputmask_opts"); if (imOpts) new Inputmask(imOpts).mask(that); else EventRuler.off(that) } else if (e.type !== "setvalue" && this.nodeName !== "FORM" && (that.disabled || that.readOnly && !(e.type === "keydown" && e.ctrlKey && e.keyCode === 67 || opts.tabThrough === false && e.keyCode === Inputmask.keyCode.TAB))) { e.preventDefault() } else { switch (e.type) { case "input": if (skipInputEvent === true) { skipInputEvent = false; return e.preventDefault() } if (mobile) { var args = arguments; setTimeout(function () { eventHandler.apply(that, args); caret(that, that.inputmask.caretPos, undefined, true) }, 0); return false } break; case "keydown": skipKeyPressEvent = false; skipInputEvent = false; break; case "keypress": if (skipKeyPressEvent === true) { return e.preventDefault() } skipKeyPressEvent = true; break; case "click": if (iemobile || iphone) { var args = arguments; setTimeout(function () { eventHandler.apply(that, args) }, 0); return false } break }var returnVal = eventHandler.apply(that, arguments); if (returnVal === false) { e.preventDefault(); e.stopPropagation() } return returnVal } }; input.inputmask.events[eventName] = input.inputmask.events[eventName] || []; input.inputmask.events[eventName].push(ev); if ($.inArray(eventName, ["submit", "reset"]) !== -1) { if (input.form !== null) $(input.form).on(eventName, ev) } else { $(input).on(eventName, ev) } }, off: function off(input, event) { if (input.inputmask && input.inputmask.events) { var events; if (event) { events = []; events[event] = input.inputmask.events[event] } else { events = input.inputmask.events } $.each(events, function (eventName, evArr) { while (evArr.length > 0) { var ev = evArr.pop(); if ($.inArray(eventName, ["submit", "reset"]) !== -1) { if (input.form !== null) $(input.form).off(eventName, ev) } else { $(input).off(eventName, ev) } } delete input.inputmask.events[eventName] }) } } }; var EventHandlers = { keydownEvent: function keydownEvent(e) { var input = this, $input = $(input), k = e.keyCode, pos = caret(input); if (k === Inputmask.keyCode.BACKSPACE || k === Inputmask.keyCode.DELETE || iphone && k === Inputmask.keyCode.BACKSPACE_SAFARI || e.ctrlKey && k === Inputmask.keyCode.X && !isInputEventSupported("cut")) { e.preventDefault(); handleRemove(input, k, pos); writeBuffer(input, getBuffer(true), getMaskSet().p, e, input.inputmask._valueGet() !== getBuffer().join("")) } else if (k === Inputmask.keyCode.END || k === Inputmask.keyCode.PAGE_DOWN) { e.preventDefault(); var caretPos = seekNext(getLastValidPosition()); caret(input, e.shiftKey ? pos.begin : caretPos, caretPos, true) } else if (k === Inputmask.keyCode.HOME && !e.shiftKey || k === Inputmask.keyCode.PAGE_UP) { e.preventDefault(); caret(input, 0, e.shiftKey ? pos.begin : 0, true) } else if ((opts.undoOnEscape && k === Inputmask.keyCode.ESCAPE || k === 90 && e.ctrlKey) && e.altKey !== true) { checkVal(input, true, false, undoValue.split("")); $input.trigger("click") } else if (k === Inputmask.keyCode.INSERT && !(e.shiftKey || e.ctrlKey)) { opts.insertMode = !opts.insertMode; input.setAttribute("im-insert", opts.insertMode) } else if (opts.tabThrough === true && k === Inputmask.keyCode.TAB) { if (e.shiftKey === true) { if (getTest(pos.begin).match.fn === null) { pos.begin = seekNext(pos.begin) } pos.end = seekPrevious(pos.begin, true); pos.begin = seekPrevious(pos.end, true) } else { pos.begin = seekNext(pos.begin, true); pos.end = seekNext(pos.begin, true); if (pos.end < getMaskSet().maskLength) pos.end-- } if (pos.begin < getMaskSet().maskLength) { e.preventDefault(); caret(input, pos.begin, pos.end) } } opts.onKeyDown.call(this, e, getBuffer(), caret(input).begin, opts); ignorable = $.inArray(k, opts.ignorables) !== -1 }, keypressEvent: function keypressEvent(e, checkval, writeOut, strict, ndx) { var input = this, $input = $(input), k = e.which || e.charCode || e.keyCode; if (checkval !== true && !(e.ctrlKey && e.altKey) && (e.ctrlKey || e.metaKey || ignorable)) { if (k === Inputmask.keyCode.ENTER && undoValue !== getBuffer().join("")) { undoValue = getBuffer().join(""); setTimeout(function () { $input.trigger("change") }, 0) } return true } else { if (k) { if (k === 46 && e.shiftKey === false && opts.radixPoint !== "") k = opts.radixPoint.charCodeAt(0); var pos = checkval ? { begin: ndx, end: ndx } : caret(input), forwardPosition, c = String.fromCharCode(k), offset = 0; if (opts._radixDance && opts.numericInput) { var caretPos = getBuffer().indexOf(opts.radixPoint.charAt(0)) + 1; if (pos.begin <= caretPos) { if (k === opts.radixPoint.charCodeAt(0)) offset = 1; pos.begin -= 1; pos.end -= 1 } } getMaskSet().writeOutBuffer = true; var valResult = isValid(pos, c, strict); if (valResult !== false) { resetMaskSet(true); forwardPosition = valResult.caret !== undefined ? valResult.caret : seekNext(valResult.pos.begin ? valResult.pos.begin : valResult.pos); getMaskSet().p = forwardPosition } forwardPosition = (opts.numericInput && valResult.caret === undefined ? seekPrevious(forwardPosition) : forwardPosition) + offset; if (writeOut !== false) { setTimeout(function () { opts.onKeyValidation.call(input, k, valResult, opts) }, 0); if (getMaskSet().writeOutBuffer && valResult !== false) { var buffer = getBuffer(); writeBuffer(input, buffer, forwardPosition, e, checkval !== true) } } e.preventDefault(); if (checkval) { if (valResult !== false) valResult.forwardPosition = forwardPosition; return valResult } } } }, pasteEvent: function pasteEvent(e) { var input = this, ev = e.originalEvent || e, $input = $(input), inputValue = input.inputmask._valueGet(true), caretPos = caret(input), tempValue; if (isRTL) { tempValue = caretPos.end; caretPos.end = caretPos.begin; caretPos.begin = tempValue } var valueBeforeCaret = inputValue.substr(0, caretPos.begin), valueAfterCaret = inputValue.substr(caretPos.end, inputValue.length); if (valueBeforeCaret === (isRTL ? getBufferTemplate().reverse() : getBufferTemplate()).slice(0, caretPos.begin).join("")) valueBeforeCaret = ""; if (valueAfterCaret === (isRTL ? getBufferTemplate().reverse() : getBufferTemplate()).slice(caretPos.end).join("")) valueAfterCaret = ""; if (window.clipboardData && window.clipboardData.getData) { inputValue = valueBeforeCaret + window.clipboardData.getData("Text") + valueAfterCaret } else if (ev.clipboardData && ev.clipboardData.getData) { inputValue = valueBeforeCaret + ev.clipboardData.getData("text/plain") + valueAfterCaret } else return true; var pasteValue = inputValue; if ($.isFunction(opts.onBeforePaste)) { pasteValue = opts.onBeforePaste.call(inputmask, inputValue, opts); if (pasteValue === false) { return e.preventDefault() } if (!pasteValue) { pasteValue = inputValue } } checkVal(input, false, false, pasteValue.toString().split("")); writeBuffer(input, getBuffer(), seekNext(getLastValidPosition()), e, undoValue !== getBuffer().join("")); return e.preventDefault() }, inputFallBackEvent: function inputFallBackEvent(e) { function radixPointHandler(input, inputValue, caretPos) { if (inputValue.charAt(caretPos.begin - 1) === "." && opts.radixPoint !== "") { inputValue = inputValue.split(""); inputValue[caretPos.begin - 1] = opts.radixPoint.charAt(0); inputValue = inputValue.join("") } return inputValue } function ieMobileHandler(input, inputValue, caretPos) { if (iemobile) { var inputChar = inputValue.replace(getBuffer().join(""), ""); if (inputChar.length === 1) { var iv = inputValue.split(""); iv.splice(caretPos.begin, 0, inputChar); inputValue = iv.join("") } } return inputValue } var input = this, inputValue = input.inputmask._valueGet(); if (getBuffer().join("") !== inputValue) { var caretPos = caret(input); inputValue = radixPointHandler(input, inputValue, caretPos); inputValue = ieMobileHandler(input, inputValue, caretPos); if (getBuffer().join("") !== inputValue) { var buffer = getBuffer().join(""), offset = !opts.numericInput && inputValue.length > buffer.length ? -1 : 0, frontPart = inputValue.substr(0, caretPos.begin), backPart = inputValue.substr(caretPos.begin), frontBufferPart = buffer.substr(0, caretPos.begin + offset), backBufferPart = buffer.substr(caretPos.begin + offset); var selection = caretPos, entries = "", isEntry = false; if (frontPart !== frontBufferPart) { var fpl = (isEntry = frontPart.length >= frontBufferPart.length) ? frontPart.length : frontBufferPart.length, i; for (i = 0; frontPart.charAt(i) === frontBufferPart.charAt(i) && i < fpl; i++) { } if (isEntry) { selection.begin = i - offset; entries += frontPart.slice(i, selection.end) } } if (backPart !== backBufferPart) { if (backPart.length > backBufferPart.length) { entries += backPart.slice(0, 1) } else { if (backPart.length < backBufferPart.length) { selection.end += backBufferPart.length - backPart.length; if (!isEntry && opts.radixPoint !== "" && backPart === "" && frontPart.charAt(selection.begin + offset - 1) === opts.radixPoint) { selection.begin--; entries = opts.radixPoint } } } } writeBuffer(input, getBuffer(), { begin: selection.begin + offset, end: selection.end + offset }); if (entries.length > 0) { $.each(entries.split(""), function (ndx, entry) { var keypress = new $.Event("keypress"); keypress.which = entry.charCodeAt(0); ignorable = false; EventHandlers.keypressEvent.call(input, keypress) }) } else { if (selection.begin === selection.end - 1) { selection.begin = seekPrevious(selection.begin + 1); if (selection.begin === selection.end - 1) { caret(input, selection.begin) } else { caret(input, selection.begin, selection.end) } } var keydown = new $.Event("keydown"); keydown.keyCode = opts.numericInput ? Inputmask.keyCode.BACKSPACE : Inputmask.keyCode.DELETE; EventHandlers.keydownEvent.call(input, keydown) } e.preventDefault() } } }, beforeInputEvent: function beforeInputEvent(e) { if (e.cancelable) { var input = this; switch (e.inputType) { case "insertText": $.each(e.data.split(""), function (ndx, entry) { var keypress = new $.Event("keypress"); keypress.which = entry.charCodeAt(0); ignorable = false; EventHandlers.keypressEvent.call(input, keypress) }); return e.preventDefault(); case "deleteContentBackward": var keydown = new $.Event("keydown"); keydown.keyCode = Inputmask.keyCode.BACKSPACE; EventHandlers.keydownEvent.call(input, keydown); return e.preventDefault(); case "deleteContentForward": var keydown = new $.Event("keydown"); keydown.keyCode = Inputmask.keyCode.DELETE; EventHandlers.keydownEvent.call(input, keydown); return e.preventDefault() } } }, setValueEvent: function setValueEvent(e) { this.inputmask.refreshValue = false; var input = this, value = e && e.detail ? e.detail[0] : arguments[1], value = value || input.inputmask._valueGet(true); if ($.isFunction(opts.onBeforeMask)) value = opts.onBeforeMask.call(inputmask, value, opts) || value; value = value.split(""); checkVal(input, true, false, value); undoValue = getBuffer().join(""); if ((opts.clearMaskOnLostFocus || opts.clearIncomplete) && input.inputmask._valueGet() === getBufferTemplate().join("")) { input.inputmask._valueSet("") } }, focusEvent: function focusEvent(e) { var input = this, nptValue = input.inputmask._valueGet(); if (opts.showMaskOnFocus) { if (nptValue !== getBuffer().join("")) { writeBuffer(input, getBuffer(), seekNext(getLastValidPosition())) } else if (mouseEnter === false) { caret(input, seekNext(getLastValidPosition())) } } if (opts.positionCaretOnTab === true && mouseEnter === false) { EventHandlers.clickEvent.apply(input, [e, true]) } undoValue = getBuffer().join("") }, mouseleaveEvent: function mouseleaveEvent(e) { var input = this; mouseEnter = false; if (opts.clearMaskOnLostFocus && document.activeElement !== input) { HandleNativePlaceholder(input, originalPlaceholder) } }, clickEvent: function clickEvent(e, tabbed) { function doRadixFocus(clickPos) { if (opts.radixPoint !== "") { var vps = getMaskSet().validPositions; if (vps[clickPos] === undefined || vps[clickPos].input === getPlaceholder(clickPos)) { if (clickPos < seekNext(-1)) return true; var radixPos = $.inArray(opts.radixPoint, getBuffer()); if (radixPos !== -1) { for (var vp in vps) { if (radixPos < vp && vps[vp].input !== getPlaceholder(vp)) { return false } } return true } } } return false } var input = this; setTimeout(function () { if (document.activeElement === input) { var selectedCaret = caret(input); if (tabbed) { if (isRTL) { selectedCaret.end = selectedCaret.begin } else { selectedCaret.begin = selectedCaret.end } } if (selectedCaret.begin === selectedCaret.end) { switch (opts.positionCaretOnClick) { case "none": break; case "select": caret(input, 0, getBuffer().length); break; case "ignore": caret(input, seekNext(getLastValidPosition())); break; case "radixFocus": if (doRadixFocus(selectedCaret.begin)) { var radixPos = getBuffer().join("").indexOf(opts.radixPoint); caret(input, opts.numericInput ? seekNext(radixPos) : radixPos); break } default: var clickPosition = selectedCaret.begin, lvclickPosition = getLastValidPosition(clickPosition, true), lastPosition = seekNext(lvclickPosition); if (clickPosition < lastPosition) { caret(input, !isMask(clickPosition, true) && !isMask(clickPosition - 1, true) ? seekNext(clickPosition) : clickPosition) } else { var lvp = getMaskSet().validPositions[lvclickPosition], tt = getTestTemplate(lastPosition, lvp ? lvp.match.locator : undefined, lvp), placeholder = getPlaceholder(lastPosition, tt.match); if (placeholder !== "" && getBuffer()[lastPosition] !== placeholder && tt.match.optionalQuantifier !== true && tt.match.newBlockMarker !== true || !isMask(lastPosition, opts.keepStatic) && tt.match.def === placeholder) { var newPos = seekNext(lastPosition); if (clickPosition >= newPos || clickPosition === lastPosition) { lastPosition = newPos } } caret(input, lastPosition) } break } } } }, 0) }, cutEvent: function cutEvent(e) { var input = this, $input = $(input), pos = caret(input), ev = e.originalEvent || e; var clipboardData = window.clipboardData || ev.clipboardData, clipData = isRTL ? getBuffer().slice(pos.end, pos.begin) : getBuffer().slice(pos.begin, pos.end); clipboardData.setData("text", isRTL ? clipData.reverse().join("") : clipData.join("")); if (document.execCommand) document.execCommand("copy"); handleRemove(input, Inputmask.keyCode.DELETE, pos); writeBuffer(input, getBuffer(), getMaskSet().p, e, undoValue !== getBuffer().join("")) }, blurEvent: function blurEvent(e) { var $input = $(this), input = this; if (input.inputmask) { HandleNativePlaceholder(input, originalPlaceholder); var nptValue = input.inputmask._valueGet(), buffer = getBuffer().slice(); if (nptValue !== "" || colorMask !== undefined) { if (opts.clearMaskOnLostFocus) { if (getLastValidPosition() === -1 && nptValue === getBufferTemplate().join("")) { buffer = [] } else { clearOptionalTail(buffer) } } if (isComplete(buffer) === false) { setTimeout(function () { $input.trigger("incomplete") }, 0); if (opts.clearIncomplete) { resetMaskSet(); if (opts.clearMaskOnLostFocus) { buffer = [] } else { buffer = getBufferTemplate().slice() } } } writeBuffer(input, buffer, undefined, e) } if (undoValue !== getBuffer().join("")) { undoValue = buffer.join(""); $input.trigger("change") } } }, mouseenterEvent: function mouseenterEvent(e) { var input = this; mouseEnter = true; if (document.activeElement !== input && opts.showMaskOnHover) { HandleNativePlaceholder(input, (isRTL ? getBuffer().slice().reverse() : getBuffer()).join("")) } }, submitEvent: function submitEvent(e) { if (undoValue !== getBuffer().join("")) { $el.trigger("change") } if (opts.clearMaskOnLostFocus && getLastValidPosition() === -1 && el.inputmask._valueGet && el.inputmask._valueGet() === getBufferTemplate().join("")) { el.inputmask._valueSet("") } if (opts.clearIncomplete && isComplete(getBuffer()) === false) { el.inputmask._valueSet("") } if (opts.removeMaskOnSubmit) { el.inputmask._valueSet(el.inputmask.unmaskedvalue(), true); setTimeout(function () { writeBuffer(el, getBuffer()) }, 0) } }, resetEvent: function resetEvent(e) { el.inputmask.refreshValue = true; setTimeout(function () { $el.trigger("setvalue") }, 0) } }; function checkVal(input, writeOut, strict, nptvl, initiatingEvent) { var inputmask = this || input.inputmask, inputValue = nptvl.slice(), charCodes = "", initialNdx = -1, result = undefined; function isTemplateMatch(ndx, charCodes) { var charCodeNdx = getMaskTemplate(true, 0, false).slice(ndx, seekNext(ndx)).join("").replace(/'/g, "").indexOf(charCodes); return charCodeNdx !== -1 && !isMask(ndx) && (getTest(ndx).match.nativeDef === charCodes.charAt(0) || getTest(ndx).match.fn === null && getTest(ndx).match.nativeDef === "'" + charCodes.charAt(0) || getTest(ndx).match.nativeDef === " " && (getTest(ndx + 1).match.nativeDef === charCodes.charAt(0) || getTest(ndx + 1).match.fn === null && getTest(ndx + 1).match.nativeDef === "'" + charCodes.charAt(0))) } resetMaskSet(); if (!strict && opts.autoUnmask !== true) { var staticInput = getBufferTemplate().slice(0, seekNext(-1)).join(""), matches = inputValue.join("").match(new RegExp("^" + Inputmask.escapeRegex(staticInput), "g")); if (matches && matches.length > 0) { inputValue.splice(0, matches.length * staticInput.length); initialNdx = seekNext(initialNdx) } } else { initialNdx = seekNext(initialNdx) } if (initialNdx === -1) { getMaskSet().p = seekNext(initialNdx); initialNdx = 0 } else getMaskSet().p = initialNdx; inputmask.caretPos = { begin: initialNdx }; $.each(inputValue, function (ndx, charCode) { if (charCode !== undefined) { if (getMaskSet().validPositions[ndx] === undefined && inputValue[ndx] === getPlaceholder(ndx) && isMask(ndx, true) && isValid(ndx, inputValue[ndx], true, undefined, undefined, true) === false) { getMaskSet().p++ } else { var keypress = new $.Event("_checkval"); keypress.which = charCode.charCodeAt(0); charCodes += charCode; var lvp = getLastValidPosition(undefined, true); if (!isTemplateMatch(initialNdx, charCodes)) { result = EventHandlers.keypressEvent.call(input, keypress, true, false, strict, inputmask.caretPos.begin); if (result) { initialNdx = inputmask.caretPos.begin + 1; charCodes = "" } } else { result = EventHandlers.keypressEvent.call(input, keypress, true, false, strict, lvp + 1) } if (result) { writeBuffer(undefined, getBuffer(), result.forwardPosition, keypress, false); inputmask.caretPos = { begin: result.forwardPosition, end: result.forwardPosition } } } } }); if (writeOut) writeBuffer(input, getBuffer(), result ? result.forwardPosition : undefined, initiatingEvent || new $.Event("checkval"), initiatingEvent && initiatingEvent.type === "input") } function unmaskedvalue(input) { if (input) { if (input.inputmask === undefined) { return input.value } if (input.inputmask && input.inputmask.refreshValue) { EventHandlers.setValueEvent.call(input) } } var umValue = [], vps = getMaskSet().validPositions; for (var pndx in vps) { if (vps[pndx].match && vps[pndx].match.fn != null) { umValue.push(vps[pndx].input) } } var unmaskedValue = umValue.length === 0 ? "" : (isRTL ? umValue.reverse() : umValue).join(""); if ($.isFunction(opts.onUnMask)) { var bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join(""); unmaskedValue = opts.onUnMask.call(inputmask, bufferValue, unmaskedValue, opts) } return unmaskedValue } function caret(input, begin, end, notranslate) { function translatePosition(pos) { if (isRTL && typeof pos === "number" && (!opts.greedy || opts.placeholder !== "") && el) { pos = el.inputmask._valueGet().length - pos } return pos } var range; if (begin !== undefined) { if ($.isArray(begin)) { end = isRTL ? begin[0] : begin[1]; begin = isRTL ? begin[1] : begin[0] } if (begin.begin !== undefined) { end = isRTL ? begin.begin : begin.end; begin = isRTL ? begin.end : begin.begin } if (typeof begin === "number") { begin = notranslate ? begin : translatePosition(begin); end = notranslate ? end : translatePosition(end); end = typeof end == "number" ? end : begin; var scrollCalc = parseInt(((input.ownerDocument.defaultView || window).getComputedStyle ? (input.ownerDocument.defaultView || window).getComputedStyle(input, null) : input.currentStyle).fontSize) * end; input.scrollLeft = scrollCalc > input.scrollWidth ? scrollCalc : 0; input.inputmask.caretPos = { begin: begin, end: end }; if (input === document.activeElement) { if ("selectionStart" in input) { input.selectionStart = begin; input.selectionEnd = end } else if (window.getSelection) { range = document.createRange(); if (input.firstChild === undefined || input.firstChild === null) { var textNode = document.createTextNode(""); input.appendChild(textNode) } range.setStart(input.firstChild, begin < input.inputmask._valueGet().length ? begin : input.inputmask._valueGet().length); range.setEnd(input.firstChild, end < input.inputmask._valueGet().length ? end : input.inputmask._valueGet().length); range.collapse(true); var sel = window.getSelection(); sel.removeAllRanges(); sel.addRange(range) } else if (input.createTextRange) { range = input.createTextRange(); range.collapse(true); range.moveEnd("character", end); range.moveStart("character", begin); range.select() } renderColorMask(input, { begin: begin, end: end }) } } } else { if ("selectionStart" in input) { begin = input.selectionStart; end = input.selectionEnd } else if (window.getSelection) { range = window.getSelection().getRangeAt(0); if (range.commonAncestorContainer.parentNode === input || range.commonAncestorContainer === input) { begin = range.startOffset; end = range.endOffset } } else if (document.selection && document.selection.createRange) { range = document.selection.createRange(); begin = 0 - range.duplicate().moveStart("character", -input.inputmask._valueGet().length); end = begin + range.text.length } return { begin: notranslate ? begin : translatePosition(begin), end: notranslate ? end : translatePosition(end) } } } function determineLastRequiredPosition(returnDefinition) { var buffer = getMaskTemplate(true, getLastValidPosition(), true, true), bl = buffer.length, pos, lvp = getLastValidPosition(), positions = {}, lvTest = getMaskSet().validPositions[lvp], ndxIntlzr = lvTest !== undefined ? lvTest.locator.slice() : undefined, testPos; for (pos = lvp + 1; pos < buffer.length; pos++) { testPos = getTestTemplate(pos, ndxIntlzr, pos - 1); ndxIntlzr = testPos.locator.slice(); positions[pos] = $.extend(true, {}, testPos) } var lvTestAlt = lvTest && lvTest.alternation !== undefined ? lvTest.locator[lvTest.alternation] : undefined; for (pos = bl - 1; pos > lvp; pos--) { testPos = positions[pos]; if ((testPos.match.optionality || testPos.match.optionalQuantifier && testPos.match.newBlockMarker || lvTestAlt && (lvTestAlt !== positions[pos].locator[lvTest.alternation] && testPos.match.fn != null || testPos.match.fn === null && testPos.locator[lvTest.alternation] && checkAlternationMatch(testPos.locator[lvTest.alternation].toString().split(","), lvTestAlt.toString().split(",")) && getTests(pos)[0].def !== "")) && buffer[pos] === getPlaceholder(pos, testPos.match)) { bl-- } else break } return returnDefinition ? { l: bl, def: positions[bl] ? positions[bl].match : undefined } : bl } function clearOptionalTail(buffer) { buffer.length = 0; var template = getMaskTemplate(true, 0, true, undefined, true), lmnt, validPos; while (lmnt = template.shift(), lmnt !== undefined) { buffer.push(lmnt) } return buffer } function isComplete(buffer) { if ($.isFunction(opts.isComplete)) return opts.isComplete(buffer, opts); if (opts.repeat === "*") return undefined; var complete = false, lrp = determineLastRequiredPosition(true), aml = seekPrevious(lrp.l); if (lrp.def === undefined || lrp.def.newBlockMarker || lrp.def.optionality || lrp.def.optionalQuantifier) { complete = true; for (var i = 0; i <= aml; i++) { var test = getTestTemplate(i).match; if (test.fn !== null && getMaskSet().validPositions[i] === undefined && test.optionality !== true && test.optionalQuantifier !== true || test.fn === null && buffer[i] !== getPlaceholder(i, test)) { complete = false; break } } } return complete } function handleRemove(input, k, pos, strict, fromIsValid) { if (opts.numericInput || isRTL) { if (k === Inputmask.keyCode.BACKSPACE) { k = Inputmask.keyCode.DELETE } else if (k === Inputmask.keyCode.DELETE) { k = Inputmask.keyCode.BACKSPACE } if (isRTL) { var pend = pos.end; pos.end = pos.begin; pos.begin = pend } } if (k === Inputmask.keyCode.BACKSPACE && pos.end - pos.begin < 1) { pos.begin = seekPrevious(pos.begin); if (getMaskSet().validPositions[pos.begin] !== undefined && getMaskSet().validPositions[pos.begin].input === opts.groupSeparator) { pos.begin-- } } else if (k === Inputmask.keyCode.DELETE && pos.begin === pos.end) { pos.end = isMask(pos.end, true) && getMaskSet().validPositions[pos.end] && getMaskSet().validPositions[pos.end].input !== opts.radixPoint ? pos.end + 1 : seekNext(pos.end) + 1; if (getMaskSet().validPositions[pos.begin] !== undefined && getMaskSet().validPositions[pos.begin].input === opts.groupSeparator) { pos.end++ } } revalidateMask(pos); if (strict !== true && opts.keepStatic !== false || opts.regex !== null) { var result = alternate(true); if (result) { var newPos = result.caret !== undefined ? result.caret : result.pos ? seekNext(result.pos.begin ? result.pos.begin : result.pos) : getLastValidPosition(-1, true); if (k !== Inputmask.keyCode.DELETE || pos.begin > newPos) { pos.begin == newPos } } } var lvp = getLastValidPosition(pos.begin, true); if (lvp < pos.begin || pos.begin === -1) { getMaskSet().p = seekNext(lvp) } else if (strict !== true) { getMaskSet().p = pos.begin; if (fromIsValid !== true) { while (getMaskSet().p < lvp && getMaskSet().validPositions[getMaskSet().p] === undefined) { getMaskSet().p++ } } } } function initializeColorMask(input) { var computedStyle = (input.ownerDocument.defaultView || window).getComputedStyle(input, null); function findCaretPos(clientx) { var e = document.createElement("span"), caretPos; for (var style in computedStyle) { if (isNaN(style) && style.indexOf("font") !== -1) { e.style[style] = computedStyle[style] } } e.style.textTransform = computedStyle.textTransform; e.style.letterSpacing = computedStyle.letterSpacing; e.style.position = "absolute"; e.style.height = "auto"; e.style.width = "auto"; e.style.visibility = "hidden"; e.style.whiteSpace = "nowrap"; document.body.appendChild(e); var inputText = input.inputmask._valueGet(), previousWidth = 0, itl; for (caretPos = 0, itl = inputText.length; caretPos <= itl; caretPos++) { e.innerHTML += inputText.charAt(caretPos) || "_"; if (e.offsetWidth >= clientx) { var offset1 = clientx - previousWidth; var offset2 = e.offsetWidth - clientx; e.innerHTML = inputText.charAt(caretPos); offset1 -= e.offsetWidth / 3; caretPos = offset1 < offset2 ? caretPos - 1 : caretPos; break } previousWidth = e.offsetWidth } document.body.removeChild(e); return caretPos } var template = document.createElement("div"); template.style.width = computedStyle.width; template.style.textAlign = computedStyle.textAlign; colorMask = document.createElement("div"); input.inputmask.colorMask = colorMask; colorMask.className = "im-colormask"; input.parentNode.insertBefore(colorMask, input); input.parentNode.removeChild(input); colorMask.appendChild(input); colorMask.appendChild(template); input.style.left = template.offsetLeft + "px"; $(colorMask).on("mouseleave", function (e) { return EventHandlers.mouseleaveEvent.call(input, [e]) }); $(colorMask).on("mouseenter", function (e) { return EventHandlers.mouseenterEvent.call(input, [e]) }); $(colorMask).on("click", function (e) { caret(input, findCaretPos(e.clientX)); return EventHandlers.clickEvent.call(input, [e]) }) } Inputmask.prototype.positionColorMask = function (input, template) { input.style.left = template.offsetLeft + "px" }; function renderColorMask(input, caretPos, clear) { var maskTemplate = [], isStatic = false, test, testPos, ndxIntlzr, pos = 0; function setEntry(entry) { if (entry === undefined) entry = ""; if (!isStatic && (test.fn === null || testPos.input === undefined)) { isStatic = true; maskTemplate.push("<span class='im-static'>" + entry) } else if (isStatic && (test.fn !== null && testPos.input !== undefined || test.def === "")) { isStatic = false; var mtl = maskTemplate.length; maskTemplate[mtl - 1] = maskTemplate[mtl - 1] + "</span>"; maskTemplate.push(entry) } else maskTemplate.push(entry) } function setCaret() { if (document.activeElement === input) { maskTemplate.splice(caretPos.begin, 0, caretPos.begin === caretPos.end || caretPos.end > getMaskSet().maskLength ? '<mark class="im-caret" style="border-right-width: 1px;border-right-style: solid;">' : '<mark class="im-caret-select">'); maskTemplate.splice(caretPos.end + 1, 0, "</mark>") } } if (colorMask !== undefined) { var buffer = getBuffer(); if (caretPos === undefined) { caretPos = caret(input) } else if (caretPos.begin === undefined) { caretPos = { begin: caretPos, end: caretPos } } if (clear !== true) { var lvp = getLastValidPosition(); do { if (getMaskSet().validPositions[pos]) { testPos = getMaskSet().validPositions[pos]; test = testPos.match; ndxIntlzr = testPos.locator.slice(); setEntry(buffer[pos]) } else { testPos = getTestTemplate(pos, ndxIntlzr, pos - 1); test = testPos.match; ndxIntlzr = testPos.locator.slice(); if (opts.jitMasking === false || pos < lvp || typeof opts.jitMasking === "number" && isFinite(opts.jitMasking) && opts.jitMasking > pos) { setEntry(getPlaceholder(pos, test)) } else isStatic = false } pos++ } while ((maxLength === undefined || pos < maxLength) && (test.fn !== null || test.def !== "") || lvp > pos || isStatic); if (isStatic) setEntry(); setCaret() } var template = colorMask.getElementsByTagName("div")[0]; template.innerHTML = maskTemplate.join(""); input.inputmask.positionColorMask(input, template) } } function mask(elem) { function isElementTypeSupported(input, opts) { function patchValueProperty(npt) { var valueGet; var valueSet; function patchValhook(type) { if ($.valHooks && ($.valHooks[type] === undefined || $.valHooks[type].inputmaskpatch !== true)) { var valhookGet = $.valHooks[type] && $.valHooks[type].get ? $.valHooks[type].get : function (elem) { return elem.value }; var valhookSet = $.valHooks[type] && $.valHooks[type].set ? $.valHooks[type].set : function (elem, value) { elem.value = value; return elem }; $.valHooks[type] = { get: function get(elem) { if (elem.inputmask) { if (elem.inputmask.opts.autoUnmask) { return elem.inputmask.unmaskedvalue() } else { var result = valhookGet(elem); return getLastValidPosition(undefined, undefined, elem.inputmask.maskset.validPositions) !== -1 || opts.nullable !== true ? result : "" } } else return valhookGet(elem) }, set: function set(elem, value) { var $elem = $(elem), result; result = valhookSet(elem, value); if (elem.inputmask) { $elem.trigger("setvalue", [value]) } return result }, inputmaskpatch: true } } } function getter() { if (this.inputmask) { return this.inputmask.opts.autoUnmask ? this.inputmask.unmaskedvalue() : getLastValidPosition() !== -1 || opts.nullable !== true ? document.activeElement === this && opts.clearMaskOnLostFocus ? (isRTL ? clearOptionalTail(getBuffer().slice()).reverse() : clearOptionalTail(getBuffer().slice())).join("") : valueGet.call(this) : "" } else return valueGet.call(this) } function setter(value) { valueSet.call(this, value); if (this.inputmask) { $(this).trigger("setvalue", [value]) } } function installNativeValueSetFallback(npt) { EventRuler.on(npt, "mouseenter", function (event) { var $input = $(this), input = this, value = input.inputmask._valueGet(); if (value !== getBuffer().join("")) { $input.trigger("setvalue") } }) } if (!npt.inputmask.__valueGet) { if (opts.noValuePatching !== true) { if (Object.getOwnPropertyDescriptor) { if (typeof Object.getPrototypeOf !== "function") { Object.getPrototypeOf = _typeof("test".__proto__) === "object" ? function (object) { return object.__proto__ } : function (object) { return object.constructor.prototype } } var valueProperty = Object.getPrototypeOf ? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(npt), "value") : undefined; if (valueProperty && valueProperty.get && valueProperty.set) { valueGet = valueProperty.get; valueSet = valueProperty.set; Object.defineProperty(npt, "value", { get: getter, set: setter, configurable: true }) } else if (npt.tagName !== "INPUT") { valueGet = function valueGet() { return this.textContent }; valueSet = function valueSet(value) { this.textContent = value }; Object.defineProperty(npt, "value", { get: getter, set: setter, configurable: true }) } } else if (document.__lookupGetter__ && npt.__lookupGetter__("value")) { valueGet = npt.__lookupGetter__("value"); valueSet = npt.__lookupSetter__("value"); npt.__defineGetter__("value", getter); npt.__defineSetter__("value", setter) } npt.inputmask.__valueGet = valueGet; npt.inputmask.__valueSet = valueSet } npt.inputmask._valueGet = function (overruleRTL) { return isRTL && overruleRTL !== true ? valueGet.call(this.el).split("").reverse().join("") : valueGet.call(this.el) }; npt.inputmask._valueSet = function (value, overruleRTL) { valueSet.call(this.el, value === null || value === undefined ? "" : overruleRTL !== true && isRTL ? value.split("").reverse().join("") : value) }; if (valueGet === undefined) { valueGet = function valueGet() { return this.value }; valueSet = function valueSet(value) { this.value = value }; patchValhook(npt.type); installNativeValueSetFallback(npt) } } } var elementType = input.getAttribute("type"); var isSupported = input.tagName === "INPUT" && $.inArray(elementType, opts.supportsInputType) !== -1 || input.isContentEditable || input.tagName === "TEXTAREA"; if (!isSupported) { if (input.tagName === "INPUT") { var el = document.createElement("input"); el.setAttribute("type", elementType); isSupported = el.type === "text"; el = null } else isSupported = "partial" } if (isSupported !== false) { patchValueProperty(input) } else input.inputmask = undefined; return isSupported } EventRuler.off(elem); var isSupported = isElementTypeSupported(elem, opts); if (isSupported !== false) { el = elem; $el = $(el); originalPlaceholder = el.placeholder; maxLength = el !== undefined ? el.maxLength : undefined; if (maxLength === -1) maxLength = undefined; if (opts.colorMask === true) { initializeColorMask(el) } if (mobile) { if ("inputmode" in el) { el.inputmode = opts.inputmode; el.setAttribute("inputmode", opts.inputmode) } if (opts.disablePredictiveText === true) { if ("autocorrect" in el) { el.autocorrect = false } else { if (opts.colorMask !== true) { initializeColorMask(el) } el.type = "password" } } } if (isSupported === true) { el.setAttribute("im-insert", opts.insertMode); EventRuler.on(el, "submit", EventHandlers.submitEvent); EventRuler.on(el, "reset", EventHandlers.resetEvent); EventRuler.on(el, "blur", EventHandlers.blurEvent); EventRuler.on(el, "focus", EventHandlers.focusEvent); if (opts.colorMask !== true) { EventRuler.on(el, "click", EventHandlers.clickEvent); EventRuler.on(el, "mouseleave", EventHandlers.mouseleaveEvent); EventRuler.on(el, "mouseenter", EventHandlers.mouseenterEvent) } EventRuler.on(el, "paste", EventHandlers.pasteEvent); EventRuler.on(el, "cut", EventHandlers.cutEvent); EventRuler.on(el, "complete", opts.oncomplete); EventRuler.on(el, "incomplete", opts.onincomplete); EventRuler.on(el, "cleared", opts.oncleared); if (!mobile && opts.inputEventOnly !== true) { EventRuler.on(el, "keydown", EventHandlers.keydownEvent); EventRuler.on(el, "keypress", EventHandlers.keypressEvent) } else { el.removeAttribute("maxLength") } EventRuler.on(el, "input", EventHandlers.inputFallBackEvent); EventRuler.on(el, "beforeinput", EventHandlers.beforeInputEvent) } EventRuler.on(el, "setvalue", EventHandlers.setValueEvent); undoValue = getBufferTemplate().join(""); if (el.inputmask._valueGet(true) !== "" || opts.clearMaskOnLostFocus === false || document.activeElement === el) { var initialValue = $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(inputmask, el.inputmask._valueGet(true), opts) || el.inputmask._valueGet(true) : el.inputmask._valueGet(true); if (initialValue !== "") checkVal(el, true, false, initialValue.split("")); var buffer = getBuffer().slice(); undoValue = buffer.join(""); if (isComplete(buffer) === false) { if (opts.clearIncomplete) { resetMaskSet() } } if (opts.clearMaskOnLostFocus && document.activeElement !== el) { if (getLastValidPosition() === -1) { buffer = [] } else { clearOptionalTail(buffer) } } if (opts.clearMaskOnLostFocus === false || opts.showMaskOnFocus && document.activeElement === el || el.inputmask._valueGet(true) !== "") writeBuffer(el, buffer); if (document.activeElement === el) { caret(el, seekNext(getLastValidPosition())) } } } } var valueBuffer; if (actionObj !== undefined) { switch (actionObj.action) { case "isComplete": el = actionObj.el; return isComplete(getBuffer()); case "unmaskedvalue": if (el === undefined || actionObj.value !== undefined) { valueBuffer = actionObj.value; valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(inputmask, valueBuffer, opts) || valueBuffer : valueBuffer).split(""); checkVal.call(this, undefined, false, false, valueBuffer); if ($.isFunction(opts.onBeforeWrite)) opts.onBeforeWrite.call(inputmask, undefined, getBuffer(), 0, opts) } return unmaskedvalue(el); case "mask": mask(el); break; case "format": valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(inputmask, actionObj.value, opts) || actionObj.value : actionObj.value).split(""); checkVal.call(this, undefined, true, false, valueBuffer); if (actionObj.metadata) { return { value: isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""), metadata: maskScope.call(this, { action: "getmetadata" }, maskset, opts) } } return isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""); case "isValid": if (actionObj.value) { valueBuffer = actionObj.value.split(""); checkVal.call(this, undefined, true, true, valueBuffer) } else { actionObj.value = getBuffer().join("") } var buffer = getBuffer(); var rl = determineLastRequiredPosition(), lmib = buffer.length - 1; for (; lmib > rl; lmib--) { if (isMask(lmib)) break } buffer.splice(rl, lmib + 1 - rl); return isComplete(buffer) && actionObj.value === getBuffer().join(""); case "getemptymask": return getBufferTemplate().join(""); case "remove": if (el && el.inputmask) { $.data(el, "_inputmask_opts", null); $el = $(el); el.inputmask._valueSet(opts.autoUnmask ? unmaskedvalue(el) : el.inputmask._valueGet(true)); EventRuler.off(el); if (el.inputmask.colorMask) { colorMask = el.inputmask.colorMask; colorMask.removeChild(el); colorMask.parentNode.insertBefore(el, colorMask); colorMask.parentNode.removeChild(colorMask) } var valueProperty; if (Object.getOwnPropertyDescriptor && Object.getPrototypeOf) { valueProperty = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(el), "value"); if (valueProperty) { if (el.inputmask.__valueGet) { Object.defineProperty(el, "value", { get: el.inputmask.__valueGet, set: el.inputmask.__valueSet, configurable: true }) } } } else if (document.__lookupGetter__ && el.__lookupGetter__("value")) { if (el.inputmask.__valueGet) { el.__defineGetter__("value", el.inputmask.__valueGet); el.__defineSetter__("value", el.inputmask.__valueSet) } } el.inputmask = undefined } return el; break; case "getmetadata": if ($.isArray(maskset.metadata)) { var maskTarget = getMaskTemplate(true, 0, false).join(""); $.each(maskset.metadata, function (ndx, mtdt) { if (mtdt.mask === maskTarget) { maskTarget = mtdt; return false } }); return maskTarget } return maskset.metadata } } } return Inputmask }) }, function (module, exports, __webpack_require__) { "use strict"; var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj }; (function (factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4)], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === "function" ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) } else { } })(function ($) { return $ }) }, function (module, exports) { module.exports = jQuery }, function (module, exports, __webpack_require__) { "use strict"; var __WEBPACK_AMD_DEFINE_RESULT__; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj }; if (true) !(__WEBPACK_AMD_DEFINE_RESULT__ = function () { return typeof window !== "undefined" ? window : new (eval("require('jsdom').JSDOM"))("").window }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); else { } }, function (module, exports, __webpack_require__) { "use strict"; var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj }; (function (factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2)], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === "function" ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) } else { } })(function (Inputmask) { var $ = Inputmask.dependencyLib; var formatCode = { d: ["[1-9]|[12][0-9]|3[01]", Date.prototype.setDate, "day", Date.prototype.getDate], dd: ["0[1-9]|[12][0-9]|3[01]", Date.prototype.setDate, "day", function () { return pad(Date.prototype.getDate.call(this), 2) }], ddd: [""], dddd: [""], m: ["[1-9]|1[012]", Date.prototype.setMonth, "month", function () { return Date.prototype.getMonth.call(this) + 1 }], mm: ["0[1-9]|1[012]", Date.prototype.setMonth, "month", function () { return pad(Date.prototype.getMonth.call(this) + 1, 2) }], mmm: [""], mmmm: [""], yy: ["[0-9]{2}", Date.prototype.setFullYear, "year", function () { return pad(Date.prototype.getFullYear.call(this), 2) }], yyyy: ["[0-9]{4}", Date.prototype.setFullYear, "year", function () { return pad(Date.prototype.getFullYear.call(this), 4) }], h: ["[1-9]|1[0-2]", Date.prototype.setHours, "hours", Date.prototype.getHours], hh: ["0[1-9]|1[0-2]", Date.prototype.setHours, "hours", function () { return pad(Date.prototype.getHours.call(this), 2) }], hhh: ["[0-9]+", Date.prototype.setHours, "hours", Date.prototype.getHours], H: ["1?[0-9]|2[0-3]", Date.prototype.setHours, "hours", Date.prototype.getHours], HH: ["0[0-9]|1[0-9]|2[0-3]", Date.prototype.setHours, "hours", function () { return pad(Date.prototype.getHours.call(this), 2) }], HHH: ["[0-9]+", Date.prototype.setHours, "hours", Date.prototype.getHours], M: ["[1-5]?[0-9]", Date.prototype.setMinutes, "minutes", Date.prototype.getMinutes], MM: ["0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]", Date.prototype.setMinutes, "minutes", function () { return pad(Date.prototype.getMinutes.call(this), 2) }], ss: ["[0-5][0-9]", Date.prototype.setSeconds, "seconds", function () { return pad(Date.prototype.getSeconds.call(this), 2) }], l: ["[0-9]{3}", Date.prototype.setMilliseconds, "milliseconds", function () { return pad(Date.prototype.getMilliseconds.call(this), 3) }], L: ["[0-9]{2}", Date.prototype.setMilliseconds, "milliseconds", function () { return pad(Date.prototype.getMilliseconds.call(this), 2) }], t: ["[ap]"], tt: ["[ap]m"], T: ["[AP]"], TT: ["[AP]M"], Z: [""], o: [""], S: [""] }, formatAlias = { isoDate: "yyyy-mm-dd", isoTime: "HH:MM:ss", isoDateTime: "yyyy-mm-dd'T'HH:MM:ss", isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'" }; function getTokenizer(opts) { if (!opts.tokenizer) { var tokens = []; for (var ndx in formatCode) { if (tokens.indexOf(ndx[0]) === -1) tokens.push(ndx[0]) } opts.tokenizer = "(" + tokens.join("+|") + ")+?|."; opts.tokenizer = new RegExp(opts.tokenizer, "g") } return opts.tokenizer } function isValidDate(dateParts, currentResult) { return !isFinite(dateParts.rawday) || dateParts.day == "29" && !isFinite(dateParts.rawyear) || new Date(dateParts.date.getFullYear(), isFinite(dateParts.rawmonth) ? dateParts.month : dateParts.date.getMonth() + 1, 0).getDate() >= dateParts.day ? currentResult : false } function isDateInRange(dateParts, opts) { var result = true; if (opts.min) { if (dateParts["rawyear"]) { var rawYear = dateParts["rawyear"].replace(/[^0-9]/g, ""), minYear = opts.min.year.substr(0, rawYear.length); result = minYear <= rawYear } if (dateParts["year"] === dateParts["rawyear"]) { if (opts.min.date.getTime() === opts.min.date.getTime()) { result = opts.min.date.getTime() <= dateParts.date.getTime() } } } if (result && opts.max && opts.max.date.getTime() === opts.max.date.getTime()) { result = opts.max.date.getTime() >= dateParts.date.getTime() } return result } function parse(format, dateObjValue, opts, raw) { var mask = "", match; while (match = getTokenizer(opts).exec(format)) { if (dateObjValue === undefined) { if (formatCode[match[0]]) { mask += "(" + formatCode[match[0]][0] + ")" } else { switch (match[0]) { case "[": mask += "("; break; case "]": mask += ")?"; break; default: mask += Inputmask.escapeRegex(match[0]) } } } else { if (formatCode[match[0]]) { if (raw !== true && formatCode[match[0]][3]) { var getFn = formatCode[match[0]][3]; mask += getFn.call(dateObjValue.date) } else if (formatCode[match[0]][2]) mask += dateObjValue["raw" + formatCode[match[0]][2]]; else mask += match[0] } else mask += match[0] } } return mask } function pad(val, len) { val = String(val); len = len || 2; while (val.length < len) { val = "0" + val } return val } function analyseMask(maskString, format, opts) { var dateObj = { date: new Date(1, 0, 1) }, targetProp, mask = maskString, match, dateOperation, targetValidator; function extendProperty(value) { var correctedValue = value.replace(/[^0-9]/g, "0"); if (correctedValue != value) { var enteredPart = value.replace(/[^0-9]/g, ""), min = (opts.min && opts.min[targetProp] || value).toString(), max = (opts.max && opts.max[targetProp] || value).toString(); correctedValue = enteredPart + (enteredPart < min.slice(0, enteredPart.length) ? min.slice(enteredPart.length) : enteredPart > max.slice(0, enteredPart.length) ? max.slice(enteredPart.length) : correctedValue.toString().slice(enteredPart.length)) } return correctedValue } function setValue(dateObj, value, opts) { dateObj[targetProp] = extendProperty(value); dateObj["raw" + targetProp] = value; if (dateOperation !== undefined) dateOperation.call(dateObj.date, targetProp == "month" ? parseInt(dateObj[targetProp]) - 1 : dateObj[targetProp]) } if (typeof mask === "string") { while (match = getTokenizer(opts).exec(format)) { var value = mask.slice(0, match[0].length); if (formatCode.hasOwnProperty(match[0])) { targetValidator = formatCode[match[0]][0]; targetProp = formatCode[match[0]][2]; dateOperation = formatCode[match[0]][1]; setValue(dateObj, value, opts) } mask = mask.slice(value.length) } return dateObj } else if (mask && (typeof mask === "undefined" ? "undefined" : _typeof(mask)) === "object" && mask.hasOwnProperty("date")) { return mask } return undefined } Inputmask.extendAliases({ datetime: { mask: function mask(opts) { formatCode.S = opts.i18n.ordinalSuffix.join("|"); opts.inputFormat = formatAlias[opts.inputFormat] || opts.inputFormat; opts.displayFormat = formatAlias[opts.displayFormat] || opts.displayFormat || opts.inputFormat; opts.outputFormat = formatAlias[opts.outputFormat] || opts.outputFormat || opts.inputFormat; opts.placeholder = opts.placeholder !== "" ? opts.placeholder : opts.inputFormat.replace(/[\[\]]/, ""); opts.regex = parse(opts.inputFormat, undefined, opts); return null }, placeholder: "", inputFormat: "isoDateTime", displayFormat: undefined, outputFormat: undefined, min: null, max: null, i18n: { dayNames: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], monthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], ordinalSuffix: ["st", "nd", "rd", "th"] }, postValidation: function postValidation(buffer, pos, currentResult, opts) { opts.min = analyseMask(opts.min, opts.inputFormat, opts); opts.max = analyseMask(opts.max, opts.inputFormat, opts); var result = currentResult, dateParts = analyseMask(buffer.join(""), opts.inputFormat, opts); if (result && dateParts.date.getTime() === dateParts.date.getTime()) { result = isValidDate(dateParts, result); result = result && isDateInRange(dateParts, opts) } if (pos && result && currentResult.pos !== pos) { return { buffer: parse(opts.inputFormat, dateParts, opts), refreshFromBuffer: { start: pos, end: currentResult.pos } } } return result }, onKeyDown: function onKeyDown(e, buffer, caretPos, opts) { var input = this; if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) { var today = new Date, match, date = ""; while (match = getTokenizer(opts).exec(opts.inputFormat)) { if (match[0].charAt(0) === "d") { date += pad(today.getDate(), match[0].length) } else if (match[0].charAt(0) === "m") { date += pad(today.getMonth() + 1, match[0].length) } else if (match[0] === "yyyy") { date += today.getFullYear().toString() } else if (match[0].charAt(0) === "y") { date += pad(today.getYear(), match[0].length) } } input.inputmask._valueSet(date); $(input).trigger("setvalue") } }, onUnMask: function onUnMask(maskedValue, unmaskedValue, opts) { return parse(opts.outputFormat, analyseMask(maskedValue, opts.inputFormat, opts), opts, true) }, casing: function casing(elem, test, pos, validPositions) { if (test.nativeDef.indexOf("[ap]") == 0) return elem.toLowerCase(); if (test.nativeDef.indexOf("[AP]") == 0) return elem.toUpperCase(); return elem }, insertMode: false, shiftPositions: false } }); return Inputmask }) }, function (module, exports, __webpack_require__) { "use strict"; var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj }; (function (factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2)], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === "function" ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) } else { } })(function (Inputmask) { var $ = Inputmask.dependencyLib; function autoEscape(txt, opts) { var escapedTxt = ""; for (var i = 0; i < txt.length; i++) { if (Inputmask.prototype.definitions[txt.charAt(i)] || opts.definitions[txt.charAt(i)] || opts.optionalmarker.start === txt.charAt(i) || opts.optionalmarker.end === txt.charAt(i) || opts.quantifiermarker.start === txt.charAt(i) || opts.quantifiermarker.end === txt.charAt(i) || opts.groupmarker.start === txt.charAt(i) || opts.groupmarker.end === txt.charAt(i) || opts.alternatormarker === txt.charAt(i)) { escapedTxt += "\\" + txt.charAt(i) } else escapedTxt += txt.charAt(i) } return escapedTxt } function alignDigits(buffer, digits, opts) { if (digits > 0) { var radixPosition = $.inArray(opts.radixPoint, buffer); if (radixPosition === -1) { buffer.push(opts.radixPoint); radixPosition = buffer.length - 1 } for (var i = 1; i <= digits; i++) { buffer[radixPosition + i] = buffer[radixPosition + i] || "0" } } return buffer } Inputmask.extendAliases({ numeric: { mask: function mask(opts) { if (opts.repeat !== 0 && isNaN(opts.integerDigits)) { opts.integerDigits = opts.repeat } opts.repeat = 0; if (opts.groupSeparator === opts.radixPoint && opts.digits && opts.digits !== "0") { if (opts.radixPoint === ".") { opts.groupSeparator = "," } else if (opts.radixPoint === ",") { opts.groupSeparator = "." } else opts.groupSeparator = "" } if (opts.groupSeparator === " ") { opts.skipOptionalPartCharacter = undefined } opts.autoGroup = opts.autoGroup && opts.groupSeparator !== ""; if (opts.autoGroup) { if (typeof opts.groupSize == "string" && isFinite(opts.groupSize)) opts.groupSize = parseInt(opts.groupSize); if (isFinite(opts.integerDigits)) { var seps = Math.floor(opts.integerDigits / opts.groupSize); var mod = opts.integerDigits % opts.groupSize; opts.integerDigits = parseInt(opts.integerDigits) + (mod === 0 ? seps - 1 : seps); if (opts.integerDigits < 1) { opts.integerDigits = "*" } } } if (opts.placeholder.length > 1) { opts.placeholder = opts.placeholder.charAt(0) } if (opts.positionCaretOnClick === "radixFocus" && opts.placeholder === "" && opts.integerOptional === false) { opts.positionCaretOnClick = "lvp" } opts.definitions[";"] = opts.definitions["~"]; opts.definitions[";"].definitionSymbol = "~"; if (opts.numericInput === true) { opts.positionCaretOnClick = opts.positionCaretOnClick === "radixFocus" ? "lvp" : opts.positionCaretOnClick; opts.digitsOptional = false; if (isNaN(opts.digits)) opts.digits = 2; opts.decimalProtect = false } var mask = "[+]"; mask += autoEscape(opts.prefix, opts); if (opts.integerOptional === true) { mask += "~{1," + opts.integerDigits + "}" } else mask += "~{" + opts.integerDigits + "}"; if (opts.digits !== undefined) { var radixDef = opts.decimalProtect ? ":" : opts.radixPoint; var dq = opts.digits.toString().split(","); if (isFinite(dq[0]) && dq[1] && isFinite(dq[1])) { mask += radixDef + ";{" + opts.digits + "}" } else if (isNaN(opts.digits) || parseInt(opts.digits) > 0) { if (opts.digitsOptional) { mask += "[" + radixDef + ";{1," + opts.digits + "}]" } else mask += radixDef + ";{" + opts.digits + "}" } } mask += autoEscape(opts.suffix, opts); mask += "[-]"; opts.greedy = false; return mask }, placeholder: "", greedy: false, digits: "*", digitsOptional: true, enforceDigitsOnBlur: false, radixPoint: ".", positionCaretOnClick: "radixFocus", groupSize: 3, groupSeparator: "", autoGroup: false, allowMinus: true, negationSymbol: { front: "-", back: "" }, integerDigits: "+", integerOptional: true, prefix: "", suffix: "", rightAlign: true, decimalProtect: true, min: null, max: null, step: 1, insertMode: true, autoUnmask: false, unmaskAsNumber: false, inputType: "text", inputmode: "numeric", preValidation: function preValidation(buffer, pos, c, isSelection, opts, maskset) { if (c === "-" || c === opts.negationSymbol.front) { if (opts.allowMinus !== true) return false; opts.isNegative = opts.isNegative === undefined ? true : !opts.isNegative; if (buffer.join("") === "") return true; return { caret: maskset.validPositions[pos] ? pos : undefined, dopost: true } } if (isSelection === false && c === opts.radixPoint && opts.digits !== undefined && (isNaN(opts.digits) || parseInt(opts.digits) > 0)) { var radixPos = $.inArray(opts.radixPoint, buffer); if (radixPos !== -1 && maskset.validPositions[radixPos] !== undefined) { if (opts.numericInput === true) { return pos === radixPos } return { caret: radixPos + 1 } } } return true }, postValidation: function postValidation(buffer, pos, currentResult, opts) { function buildPostMask(buffer, opts) { var postMask = ""; postMask += "(" + opts.groupSeparator + "*{" + opts.groupSize + "}){*}"; if (opts.radixPoint !== "") { var radixSplit = buffer.join("").split(opts.radixPoint); if (radixSplit[1]) { postMask += opts.radixPoint + "*{" + radixSplit[1].match(/^\d*\??\d*/)[0].length + "}" } } return postMask } var suffix = opts.suffix.split(""), prefix = opts.prefix.split(""); if (currentResult.pos === undefined && currentResult.caret !== undefined && currentResult.dopost !== true) return currentResult; var caretPos = currentResult.caret !== undefined ? currentResult.caret : currentResult.pos; var maskedValue = buffer.slice(); if (opts.numericInput) { caretPos = maskedValue.length - caretPos - 1; maskedValue = maskedValue.reverse() } var charAtPos = maskedValue[caretPos]; if (charAtPos === opts.groupSeparator) { caretPos += 1; charAtPos = maskedValue[caretPos] } if (caretPos === maskedValue.length - opts.suffix.length - 1 && charAtPos === opts.radixPoint) return currentResult; if (charAtPos !== undefined) { if (charAtPos !== opts.radixPoint && charAtPos !== opts.negationSymbol.front && charAtPos !== opts.negationSymbol.back) { maskedValue[caretPos] = "?"; if (opts.prefix.length > 0 && caretPos >= (opts.isNegative === false ? 1 : 0) && caretPos < opts.prefix.length - 1 + (opts.isNegative === false ? 1 : 0)) { prefix[caretPos - (opts.isNegative === false ? 1 : 0)] = "?" } else if (opts.suffix.length > 0 && caretPos >= maskedValue.length - opts.suffix.length - (opts.isNegative === false ? 1 : 0)) { suffix[caretPos - (maskedValue.length - opts.suffix.length - (opts.isNegative === false ? 1 : 0))] = "?" } } } prefix = prefix.join(""); suffix = suffix.join(""); var processValue = maskedValue.join("").replace(prefix, ""); processValue = processValue.replace(suffix, ""); processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""); processValue = processValue.replace(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g"), ""); processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""); if (isNaN(opts.placeholder)) { processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.placeholder), "g"), "") } if (processValue.length > 1 && processValue.indexOf(opts.radixPoint) !== 1) { if (charAtPos === "0") { processValue = processValue.replace(/^\?/g, "") } processValue = processValue.replace(/^0/g, "") } if (processValue.charAt(0) === opts.radixPoint && opts.radixPoint !== "" && opts.numericInput !== true) { processValue = "0" + processValue } if (processValue !== "") { processValue = processValue.split(""); if ((!opts.digitsOptional || opts.enforceDigitsOnBlur && currentResult.event === "blur") && isFinite(opts.digits)) { var radixPosition = $.inArray(opts.radixPoint, processValue); var rpb = $.inArray(opts.radixPoint, maskedValue); if (radixPosition === -1) { processValue.push(opts.radixPoint); radixPosition = processValue.length - 1 } for (var i = 1; i <= opts.digits; i++) { if ((!opts.digitsOptional || opts.enforceDigitsOnBlur && currentResult.event === "blur") && (processValue[radixPosition + i] === undefined || processValue[radixPosition + i] === opts.placeholder.charAt(0))) { processValue[radixPosition + i] = currentResult.placeholder || opts.placeholder.charAt(0) } else if (rpb !== -1 && maskedValue[rpb + i] !== undefined) { processValue[radixPosition + i] = processValue[radixPosition + i] || maskedValue[rpb + i] } } } if (opts.autoGroup === true && opts.groupSeparator !== "" && (charAtPos !== opts.radixPoint || currentResult.pos !== undefined || currentResult.dopost)) { var addRadix = processValue[processValue.length - 1] === opts.radixPoint && currentResult.c === opts.radixPoint; processValue = Inputmask(buildPostMask(processValue, opts), { numericInput: true, jitMasking: true, definitions: { "*": { validator: "[0-9?]", cardinality: 1 } } }).format(processValue.join("")); if (addRadix) processValue += opts.radixPoint; if (processValue.charAt(0) === opts.groupSeparator) { processValue.substr(1) } } else processValue = processValue.join("") } if (opts.isNegative && currentResult.event === "blur") { opts.isNegative = processValue !== "0" } processValue = prefix + processValue; processValue += suffix; if (opts.isNegative) { processValue = opts.negationSymbol.front + processValue; processValue += opts.negationSymbol.back } processValue = processValue.split(""); if (charAtPos !== undefined) { if (charAtPos !== opts.radixPoint && charAtPos !== opts.negationSymbol.front && charAtPos !== opts.negationSymbol.back) { caretPos = $.inArray("?", processValue); if (caretPos > -1) { processValue[caretPos] = charAtPos } else caretPos = currentResult.caret || 0 } else if (charAtPos === opts.radixPoint || charAtPos === opts.negationSymbol.front || charAtPos === opts.negationSymbol.back) { var newCaretPos = $.inArray(charAtPos, processValue); if (newCaretPos !== -1) caretPos = newCaretPos } } if (opts.numericInput) { caretPos = processValue.length - caretPos - 1; processValue = processValue.reverse() } var rslt = { caret: (charAtPos === undefined || currentResult.pos !== undefined) && caretPos !== undefined ? caretPos + (opts.numericInput ? -1 : 1) : caretPos, buffer: processValue, refreshFromBuffer: currentResult.dopost || buffer.join("") !== processValue.join("") }; return rslt.refreshFromBuffer ? rslt : currentResult }, onBeforeWrite: function onBeforeWrite(e, buffer, caretPos, opts) { function parseMinMaxOptions(opts) { if (opts.parseMinMaxOptions === undefined) { if (opts.min !== null) { opts.min = opts.min.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""); if (opts.radixPoint === ",") opts.min = opts.min.replace(opts.radixPoint, "."); opts.min = isFinite(opts.min) ? parseFloat(opts.min) : NaN; if (isNaN(opts.min)) opts.min = Number.MIN_VALUE } if (opts.max !== null) { opts.max = opts.max.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""); if (opts.radixPoint === ",") opts.max = opts.max.replace(opts.radixPoint, "."); opts.max = isFinite(opts.max) ? parseFloat(opts.max) : NaN; if (isNaN(opts.max)) opts.max = Number.MAX_VALUE } opts.parseMinMaxOptions = "done" } } if (e) { switch (e.type) { case "keydown": return opts.postValidation(buffer, caretPos, { caret: caretPos, dopost: true }, opts); case "blur": case "checkval": var unmasked; parseMinMaxOptions(opts); if (opts.min !== null || opts.max !== null) { unmasked = opts.onUnMask(buffer.join(""), undefined, $.extend({}, opts, { unmaskAsNumber: true })); if (opts.min !== null && unmasked < opts.min) { opts.isNegative = opts.min < 0; return opts.postValidation(opts.min.toString().replace(".", opts.radixPoint).split(""), caretPos, { caret: caretPos, dopost: true, placeholder: "0" }, opts) } else if (opts.max !== null && unmasked > opts.max) { opts.isNegative = opts.max < 0; return opts.postValidation(opts.max.toString().replace(".", opts.radixPoint).split(""), caretPos, { caret: caretPos, dopost: true, placeholder: "0" }, opts) } } return opts.postValidation(buffer, caretPos, { caret: caretPos, placeholder: "0", event: "blur" }, opts); case "_checkval": return { caret: caretPos }; default: break } } }, regex: { integerPart: function integerPart(opts, emptyCheck) { return emptyCheck ? new RegExp("[" + Inputmask.escapeRegex(opts.negationSymbol.front) + "+]?") : new RegExp("[" + Inputmask.escapeRegex(opts.negationSymbol.front) + "+]?\\d+") }, integerNPart: function integerNPart(opts) { return new RegExp("[\\d" + Inputmask.escapeRegex(opts.groupSeparator) + Inputmask.escapeRegex(opts.placeholder.charAt(0)) + "]+") } }, definitions: { "~": { validator: function validator(chrs, maskset, pos, strict, opts, isSelection) { var isValid, l; if (chrs === "k" || chrs === "m") { isValid = { insert: [], c: 0 }; for (var i = 0, l = chrs === "k" ? 2 : 5; i < l; i++) { isValid.insert.push({ pos: pos + i, c: 0 }) } isValid.pos = pos + l; return isValid } isValid = strict ? new RegExp("[0-9" + Inputmask.escapeRegex(opts.groupSeparator) + "]").test(chrs) : new RegExp("[0-9]").test(chrs); if (isValid === true) { if (opts.numericInput !== true && maskset.validPositions[pos] !== undefined && maskset.validPositions[pos].match.def === "~" && !isSelection) { var processValue = maskset.buffer.join(""); processValue = processValue.replace(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g"), ""); processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""); var pvRadixSplit = processValue.split(opts.radixPoint); if (pvRadixSplit.length > 1) { pvRadixSplit[1] = pvRadixSplit[1].replace(/0/g, opts.placeholder.charAt(0)) } if (pvRadixSplit[0] === "0") { pvRadixSplit[0] = pvRadixSplit[0].replace(/0/g, opts.placeholder.charAt(0)) } processValue = pvRadixSplit[0] + opts.radixPoint + pvRadixSplit[1] || ""; var bufferTemplate = maskset._buffer.join(""); if (processValue === opts.radixPoint) { processValue = bufferTemplate } while (processValue.match(Inputmask.escapeRegex(bufferTemplate) + "$") === null) { bufferTemplate = bufferTemplate.slice(1) } processValue = processValue.replace(bufferTemplate, ""); processValue = processValue.split(""); if (processValue[pos] === undefined) { isValid = { pos: pos, remove: pos } } else { isValid = { pos: pos } } } } else if (!strict && chrs === opts.radixPoint && maskset.validPositions[pos - 1] === undefined) { isValid = { insert: { pos: pos, c: 0 }, pos: pos + 1 } } return isValid }, cardinality: 1 }, "+": { validator: function validator(chrs, maskset, pos, strict, opts) { return opts.allowMinus && (chrs === "-" || chrs === opts.negationSymbol.front) }, cardinality: 1, placeholder: "" }, "-": { validator: function validator(chrs, maskset, pos, strict, opts) { return opts.allowMinus && chrs === opts.negationSymbol.back }, cardinality: 1, placeholder: "" }, ":": { validator: function validator(chrs, maskset, pos, strict, opts) { var radix = "[" + Inputmask.escapeRegex(opts.radixPoint) + "]"; var isValid = new RegExp(radix).test(chrs); if (isValid && maskset.validPositions[pos] && maskset.validPositions[pos].match.placeholder === opts.radixPoint) { isValid = { caret: pos + 1 } } return isValid }, cardinality: 1, placeholder: function placeholder(opts) { return opts.radixPoint } } }, onUnMask: function onUnMask(maskedValue, unmaskedValue, opts) { if (unmaskedValue === "" && opts.nullable === true) { return unmaskedValue } var processValue = maskedValue.replace(opts.prefix, ""); processValue = processValue.replace(opts.suffix, ""); processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""); if (opts.placeholder.charAt(0) !== "") { processValue = processValue.replace(new RegExp(opts.placeholder.charAt(0), "g"), "0") } if (opts.unmaskAsNumber) { if (opts.radixPoint !== "" && processValue.indexOf(opts.radixPoint) !== -1) processValue = processValue.replace(Inputmask.escapeRegex.call(this, opts.radixPoint), "."); processValue = processValue.replace(new RegExp("^" + Inputmask.escapeRegex(opts.negationSymbol.front)), "-"); processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""); return Number(processValue) } return processValue }, isComplete: function isComplete(buffer, opts) { var maskedValue = (opts.numericInput ? buffer.slice().reverse() : buffer).join(""); maskedValue = maskedValue.replace(new RegExp("^" + Inputmask.escapeRegex(opts.negationSymbol.front)), "-"); maskedValue = maskedValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""); maskedValue = maskedValue.replace(opts.prefix, ""); maskedValue = maskedValue.replace(opts.suffix, ""); maskedValue = maskedValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator) + "([0-9]{3})", "g"), "$1"); if (opts.radixPoint === ",") maskedValue = maskedValue.replace(Inputmask.escapeRegex(opts.radixPoint), "."); return isFinite(maskedValue) }, onBeforeMask: function onBeforeMask(initialValue, opts) { opts.isNegative = undefined; var radixPoint = opts.radixPoint || ","; if ((typeof initialValue == "number" || opts.inputType === "number") && radixPoint !== "") { initialValue = initialValue.toString().replace(".", radixPoint) } var valueParts = initialValue.split(radixPoint), integerPart = valueParts[0].replace(/[^\-0-9]/g, ""), decimalPart = valueParts.length > 1 ? valueParts[1].replace(/[^0-9]/g, "") : ""; initialValue = integerPart + (decimalPart !== "" ? radixPoint + decimalPart : decimalPart); var digits = 0; if (radixPoint !== "") { digits = decimalPart.length; if (decimalPart !== "") { var digitsFactor = Math.pow(10, digits || 1); if (isFinite(opts.digits)) { digits = parseInt(opts.digits); digitsFactor = Math.pow(10, digits) } initialValue = initialValue.replace(Inputmask.escapeRegex(radixPoint), "."); if (isFinite(initialValue)) initialValue = Math.round(parseFloat(initialValue) * digitsFactor) / digitsFactor; initialValue = initialValue.toString().replace(".", radixPoint) } } if (opts.digits === 0 && initialValue.indexOf(Inputmask.escapeRegex(radixPoint)) !== -1) { initialValue = initialValue.substring(0, initialValue.indexOf(Inputmask.escapeRegex(radixPoint))) } return alignDigits(initialValue.toString().split(""), digits, opts).join("") }, onKeyDown: function onKeyDown(e, buffer, caretPos, opts) { var $input = $(this); if (e.ctrlKey) { switch (e.keyCode) { case Inputmask.keyCode.UP: $input.val(parseFloat(this.inputmask.unmaskedvalue()) + parseInt(opts.step)); $input.trigger("setvalue"); break; case Inputmask.keyCode.DOWN: $input.val(parseFloat(this.inputmask.unmaskedvalue()) - parseInt(opts.step)); $input.trigger("setvalue"); break } } } }, currency: { prefix: "$ ", groupSeparator: ",", alias: "numeric", placeholder: "0", autoGroup: true, digits: 2, digitsOptional: false, clearMaskOnLostFocus: false }, decimal: { alias: "numeric" }, integer: { alias: "numeric", digits: 0, radixPoint: "" }, percentage: { alias: "numeric", digits: 2, digitsOptional: true, radixPoint: ".", placeholder: "0", autoGroup: false, min: 0, max: 100, suffix: " %", allowMinus: false } }); return Inputmask }) }, function (module, exports, __webpack_require__) { "use strict"; var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj }; (function (factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === "function" ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) } else { } })(function ($, Inputmask) { if ($.fn.inputmask === undefined) { $.fn.inputmask = function (fn, options) { var nptmask, input = this[0]; if (options === undefined) options = {}; if (typeof fn === "string") { switch (fn) { case "unmaskedvalue": return input && input.inputmask ? input.inputmask.unmaskedvalue() : $(input).val(); case "remove": return this.each(function () { if (this.inputmask) this.inputmask.remove() }); case "getemptymask": return input && input.inputmask ? input.inputmask.getemptymask() : ""; case "hasMaskedValue": return input && input.inputmask ? input.inputmask.hasMaskedValue() : false; case "isComplete": return input && input.inputmask ? input.inputmask.isComplete() : true; case "getmetadata": return input && input.inputmask ? input.inputmask.getmetadata() : undefined; case "setvalue": Inputmask.setValue(input, options); break; case "option": if (typeof options === "string") { if (input && input.inputmask !== undefined) { return input.inputmask.option(options) } } else { return this.each(function () { if (this.inputmask !== undefined) { return this.inputmask.option(options) } }) } break; default: options.alias = fn; nptmask = new Inputmask(options); return this.each(function () { nptmask.mask(this) }) } } else if (Array.isArray(fn)) { options.alias = fn; nptmask = new Inputmask(options); return this.each(function () { nptmask.mask(this) }) } else if ((typeof fn === "undefined" ? "undefined" : _typeof(fn)) == "object") { nptmask = new Inputmask(fn); if (fn.mask === undefined && fn.alias === undefined) { return this.each(function () { if (this.inputmask !== undefined) { return this.inputmask.option(fn) } else nptmask.mask(this) }) } else { return this.each(function () { nptmask.mask(this) }) } } else if (fn === undefined) { return this.each(function () { nptmask = new Inputmask(options); nptmask.mask(this) }) } } } return $.fn.inputmask }) }]);;
var Forms;
(function (Forms) {
    var PasswordValidator = (function () {
        function PasswordValidator() {
            this.checkCriteria = function (password, regex, $container) {
                if (regex.test(password)) {
                    $container.addClass('checked');
                    return 1;
                }
                $container.removeClass('checked');
                return 0;
            };
            this.bindView($.dataJs("passwordCriteria"));
        }
        PasswordValidator.prototype.validate = function (password) {
            password = jQuery.trim(password);
            password.length >= PasswordValidator.maxLength
                ? this.$lengthContainer.addClass('checked')
                : this.$lengthContainer.removeClass('checked');
            var criteria3Of4 = 0;
            criteria3Of4 += this.checkCriteria(password, PasswordValidator.regexUpper, this.$upperContainer);
            criteria3Of4 += this.checkCriteria(password, PasswordValidator.regexLower, this.$lowerContainer);
            criteria3Of4 += this.checkCriteria(password, PasswordValidator.regexNumbers, this.$numbersContainer);
            criteria3Of4 += this.checkCriteria(password, PasswordValidator.regexSpecial, this.$specialContainer);
            criteria3Of4 >= 3 ? this.$3Of4Container.addClass('checked') : this.$3Of4Container.removeClass('checked');
            return password.length >= PasswordValidator.maxLength && criteria3Of4 >= 3;
        };
        PasswordValidator.prototype.validateName = function (password, name) {
            if (password && name) {
                name = jQuery.trim(name).toLowerCase();
                password = jQuery.trim(password).toLowerCase();
                if (new RegExp(name).test(password)) {
                    this.$usenameContainer.removeClass('checked');
                    return true;
                }
            }
            !password.length ? this.$usenameContainer.removeClass('checked') :
                this.$usenameContainer.addClass('checked');
            return false;
        };
        PasswordValidator.prototype.bindView = function ($container) {
            this.$lengthContainer = $container.dataJs("criteriaLength");
            this.$upperContainer = $container.dataJs("criteriaUpper");
            this.$lowerContainer = $container.dataJs("criteriaLower");
            this.$numbersContainer = $container.dataJs("criteriaNumbers");
            this.$specialContainer = $container.dataJs("criteriaSpecial");
            this.$3Of4Container = $container.dataJs("criteria3Of4");
            this.$usenameContainer = $container.dataJs("criteriaUsername");
        };
        PasswordValidator.regexUpper = /.*[A-Z].*/;
        PasswordValidator.regexLower = /.*[a-z].*/;
        PasswordValidator.regexNumbers = /.*[0-9].*/;
        PasswordValidator.regexSpecial = /(?:(?![A-Za-z0-9])[ -~])/;
        PasswordValidator.maxLength = 8;
        return PasswordValidator;
    }());
    Forms.PasswordValidator = PasswordValidator;
})(Forms || (Forms = {}));
//# sourceMappingURL=PasswordValidator.js.map;
var Forms;
(function (Forms) {
    var Form = (function () {
        function Form(formOptions) {
            var _this = this;
            this.submit = function (additionalData, getErrorFieldIdsToReplaceCallBack, beforeErrorPlacementCallack, serializeForm) {
                if (serializeForm === void 0) { serializeForm = true; }
                var deferred = jQuery.Deferred();
                var formIsValid = _this.options.validateForm ? _this.$form.valid() : true;
                if (!formIsValid) {
                    return deferred.promise();
                }
                var data = _this.getFormData(additionalData, serializeForm);
                _this.options.httpService.postJson(_this.options.endpoint, data).then(function (result) {
                    deferred.resolve(result.Data);
                    if (result.UIRules) {
                        Smile.UIRules.stageWebApiUIRules(result.UIRules);
                    }
                }, function (error) {
                    if (error.status === 400) {
                        _this.displayModelStateErrors(error.responseJSON.ModelState, getErrorFieldIdsToReplaceCallBack, beforeErrorPlacementCallack);
                        deferred.reject(error);
                    }
                });
                return deferred.promise();
            };
            this.showError = function (field, message) {
                _this.showErrors([{ field: field, message: message }]);
            };
            this.showErrors = function (errors) {
                if (!errors || errors.length === 0) {
                    return;
                }
                var fieldErrors = {};
                jQuery.each(errors, function (index, error) {
                    fieldErrors[error.field] = error.message;
                });
                var validator = _this.$form.validate();
                validator.showErrors(fieldErrors);
            };
            this.isValid = function () {
                return _this.$form.valid();
            };
            this.focusFirstField = function () {
                var fields = _this.$form.find("input:not([type=hidden]), select, textarea");
                if (fields.length > 0) {
                    jQuery(fields[0]).focus().select();
                }
            };
            this.getFormData = function (additionalData, serializeForm) {
                if (serializeForm === void 0) { serializeForm = true; }
                var multiCheckboxes = _this.$form.find(":checkbox[multiple]");
                var multiSelectName = multiCheckboxes.length ? jQuery(multiCheckboxes[0]).attr("name") : undefined;
                var unindexedArray = _this.$form.serializeArray();
                var indexedArray = {};
                if (serializeForm) {
                    $.map(unindexedArray, function (n, i) {
                        var name = n["name"];
                        var value = n["value"];
                        if (multiSelectName !== undefined && multiSelectName === name) {
                            if (!Array.isArray(indexedArray[name])) {
                                indexedArray[name] = [];
                            }
                            indexedArray[name].push(value);
                        }
                        else {
                            indexedArray[name] = value;
                        }
                    });
                    var selectedCheckboxes = _this.$form.find("input[type='checkbox']:checked");
                    if (selectedCheckboxes.length) {
                        $.each(selectedCheckboxes, function (i, checkbox) {
                            var name = $(checkbox).attr('name');
                            if (indexedArray[name] === "false") {
                                indexedArray[name] = "true";
                            }
                        });
                    }
                }
                if (additionalData) {
                    jQuery.extend(true, indexedArray, additionalData);
                }
                return indexedArray;
            };
            this.resetRecaptcha = function () {
                grecaptcha.reset();
                _this.$reCaptchaInput.val('');
            };
            this.setReCaptchaTabIndex = function () {
                Array.prototype.forEach.call(document.getElementsByClassName("g-recaptcha"), function (element) {
                    element.addEventListener("load", function (e) {
                        var tabindex = e.currentTarget.getAttribute("data-tabindex");
                        if (tabindex) {
                            e.target.tabIndex = tabindex;
                        }
                    }, true);
                });
            };
            this.displayModelStateErrors = function (modelState, getFieldIdsToReplaceCallBack, beforeErrorPlacementCallack) {
                var fieldErrors = {};
                var summaryErrors = [];
                var isMdbForm = _this.$form.find(".md-form").length;
                var additionalKeysToReplace;
                if (typeof getFieldIdsToReplaceCallBack === "function") {
                    additionalKeysToReplace = getFieldIdsToReplaceCallBack();
                }
                var fieldNames = Object.keys(modelState);
                $.each(fieldNames, function (i, fieldName) {
                    var shouldBreak = false;
                    var fieldMessages = modelState[fieldName];
                    $.each(fieldMessages, function (j, fieldMessage) {
                        if (fieldName.length === 0) {
                            summaryErrors.push(fieldMessage);
                        }
                        else {
                            if (additionalKeysToReplace && additionalKeysToReplace.length > 0) {
                                var keyValue = ko.utils.arrayFirst(additionalKeysToReplace, function (item) {
                                    return fieldName.indexOf(item.key) >= 0;
                                });
                                if (keyValue) {
                                    if (typeof beforeErrorPlacementCallack === "function") {
                                        beforeErrorPlacementCallack(keyValue.value);
                                        shouldBreak = true;
                                    }
                                    fieldName = fieldName.replace(keyValue.key, keyValue.value);
                                }
                            }
                            fieldErrors[fieldName.replace("model.", "")] = fieldMessage;
                        }
                        if (shouldBreak === true) {
                            return false;
                        }
                    });
                });
                if (isMdbForm) {
                    _this.mdbBootstrapValidationSummary(summaryErrors);
                }
                var validator = _this.$form.validate();
                validator.showErrors(fieldErrors);
            };
            this.reCaptchaSubmit = function (token) {
                _this.$reCaptchaInput.val(token);
            };
            this.reCaptchaExpired = function () {
                _this.$reCaptchaInput.val('');
            };
            this.togglePassword = function (event) {
                var $togglePasswordButton = $(event.currentTarget);
                var $passwordInput = _this.$form.find("#" + $togglePasswordButton.data("for"));
                if ($passwordInput) {
                    var $icon = $togglePasswordButton.find('i').toggleClass('fa-eye-slash').toggleClass('fa-eye');
                    if ($icon.hasClass('fa-eye-slash')) {
                        $togglePasswordButton.find('span.sr-only').text('Hide Password');
                    }
                    else {
                        $togglePasswordButton.find('span.sr-only').text('Show Password');
                    }
                    $passwordInput[0].type === "password"
                        ? $passwordInput[0].type = "text" :
                        $passwordInput[0].type = "password";
                }
            };
            this.setupMdbFormPasswordFields = function () {
                var $toggleButton = $('<button data-js="mdb-password-button" type="button" class="btn-toggle-pass" aria-pressed="false"><i class="fa fa-eye"></i><span class="sr-only">Show password</span></button>');
                var passwordFieldSelector = "[data-js-field=mdb-password]";
                _this.$form.find(passwordFieldSelector).after($toggleButton);
                _this.$form.off("click touchstart", "[data-js=mdb-password-button]");
                _this.$form.on("click touchstart", "[data-js=mdb-password-button]", function (event) {
                    event.preventDefault();
                    var $button = jQuery(event.currentTarget);
                    var $passwordField = $button.siblings(passwordFieldSelector);
                    var type = $passwordField.attr("type") === "password" ? "text" : "password";
                    $passwordField.attr("type", type);
                    $button.toggleClass("active");
                    var isPressed = $button.attr("aria-pressed") === "true";
                    $button.attr("aria-pressed", !isPressed ? "true" : "false");
                });
            };
            this.mdbBootstrapValidationSummary = function (summaryErrors) {
                if (summaryErrors.length > 0) {
                    var $validationSummaryElement_1 = _this.$form.find(".validationSummary").empty();
                    $.each(summaryErrors, function (j, fieldMessage) {
                        $("<dd />").html(fieldMessage).appendTo($validationSummaryElement_1);
                    });
                    $validationSummaryElement_1.parent().show();
                }
            };
            this.options = formOptions;
            this.options.focusFirstField = formOptions.hasOwnProperty("focusFirstField") ? formOptions.focusFirstField : true;
            this.options.validateForm = formOptions.hasOwnProperty("validateForm") ? formOptions.validateForm : true;
            this.namesToValidate = [];
            this.$form = jQuery("#".concat(this.options.id));
            if (this.options.validatePassword) {
                this.passwordValidator = new Forms.PasswordValidator();
                this.$form.on("keyup", "[data-js=validatePassword]", function (e) { return _this.validatePassword(e); });
                this.$form.on("submit", "[data-js=validatePassword]", function (e) { return _this.validatePassword(e); });
            }
            if (this.options.validateReCaptcha) {
                this.$reCaptchaInput = this.$form.dataJs("reCaptchaVerification");
                Smile.Events.subscribe(Events.Action.ReCaptchaSubmit, function (token) { return _this.reCaptchaSubmit(token); });
                Smile.Events.subscribe(Events.Action.ReCaptchaExpired, function () { return _this.reCaptchaExpired(); });
                this.setReCaptchaTabIndex();
            }
            this.setupMdbFormPasswordFields();
            this.$form.on("click", "[data-js=togglePassword]", this.togglePassword);
            $(function () {
                if (_this.options.focusFirstField) {
                    _this.focusFirstField();
                }
                _this.$form.find("input[data-mask=phone]").inputmask("(999)999-9999").blur(function (e) { jQuery(e.currentTarget).valid(); });
                _this.$form.find("input[data-mask=date]").inputmask({ alias: "datetime", inputFormat: "mm/dd/yyyy" }).blur(function (e) { jQuery(e.currentTarget).valid(); });
            });
        }
        Form.prototype.isValidPassword = function (password) {
            var isValidPassword = this.passwordValidator.validate(password);
            var passwordNoName = false;
            if (this.namesToValidate && this.namesToValidate.length) {
                passwordNoName = this.passwordValidator.validateName(password, this.namesToValidate.join("|"));
            }
            return isValidPassword && !passwordNoName;
        };
        Form.prototype.setNamesToValidate = function (namesToValidate) {
            this.namesToValidate = namesToValidate;
        };
        Form.prototype.validatePassword = function (e) {
            var password = $(e.currentTarget).val();
            this.passwordValidator.validate(password);
            if (this.namesToValidate && this.namesToValidate.length) {
                this.passwordValidator.validateName(password, this.namesToValidate.join("|"));
            }
        };
        return Form;
    }());
    Forms.Form = Form;
})(Forms || (Forms = {}));
//# sourceMappingURL=Form.js.map;
