PageSourceSearch

https://greenmast.ru/local/templates/gvozdevsoft_profigs_s1/lib/inputmask/jquery.inputmask.js

js greenmast.ru collected 2026-10-05 00:28:16 UTC 220,934 bytes, 3,867 lines download raw bytes

1/*!
2* jquery.inputmask.bundle.js
3* https://github.com/RobinHerbots/Inputmask
4* Copyright (c) 2010 - 2019 Robin Herbots
5* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
6* Version: 4.0.6
7*/
8
9(function(modules) {
10    var installedModules = {};
11    function __webpack_require__(moduleId) {
12        if (installedModules[moduleId]) {
13            return installedModules[moduleId].exports;
14        }
15        var module = installedModules[moduleId] = {
16            i: moduleId,
17            l: false,
18            exports: {}
19        };
20        modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21        module.l = true;
22        return module.exports;
23    }
24    __webpack_require__.m = modules;
25    __webpack_require__.c = installedModules;
26    __webpack_require__.d = function(exports, name, getter) {
27        if (!__webpack_require__.o(exports, name)) {
28            Object.defineProperty(exports, name, {
29                enumerable: true,
30                get: getter
31            });
32        }
33    };
34    __webpack_require__.r = function(exports) {
35        if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
36            Object.defineProperty(exports, Symbol.toStringTag, {
37                value: "Module"
38            });
39        }
40        Object.defineProperty(exports, "__esModule", {
41            value: true
42        });
43    };
44    __webpack_require__.t = function(value, mode) {
45        if (mode & 1) value = __webpack_require__(value);
46        if (mode & 8) return value;
47        if (mode & 4 && typeof value === "object" && value && value.__esModule) return value;
48        var ns = Object.create(null);
49        __webpack_require__.r(ns);
50        Object.defineProperty(ns, "default", {
51            enumerable: true,
52            value: value
53        });
54        if (mode & 2 && typeof value != "string") for (var key in value) __webpack_require__.d(ns, key, function(key) {
55            return value[key];
56        }.bind(null, key));
57        return ns;
58    };
59    __webpack_require__.n = function(module) {
60        var getter = module && module.__esModule ? function getDefault() {
61            return module["default"];
62        } : function getModuleExports() {
63            return module;
64        };
65        __webpack_require__.d(getter, "a", getter);
66        return getter;
67    };
68    __webpack_require__.o = function(object, property) {
69        return Object.prototype.hasOwnProperty.call(object, property);
70    };
71    __webpack_require__.p = "";
72    return __webpack_require__(__webpack_require__.s = 0);
73})([ function(module, exports, __webpack_require__) {
74    "use strict";
75    __webpack_require__(1);
76    __webpack_require__(6);
77    __webpack_require__(7);
78    var _inputmask = __webpack_require__(2);
79    var _inputmask2 = _interopRequireDefault(_inputmask);
80    var _inputmask3 = __webpack_require__(3);
81    var _inputmask4 = _interopRequireDefault(_inputmask3);
82    var _jquery = __webpack_require__(4);
83    var _jquery2 = _interopRequireDefault(_jquery);
84    function _interopRequireDefault(obj) {
85        return obj && obj.__esModule ? obj : {
86            default: obj
87        };
88    }
89    if (_inputmask4.default === _jquery2.default) {
90        __webpack_require__(8);
91    }
92    window.Inputmask = _inputmask2.default;
93}, function(module, exports, __webpack_require__) {
94    "use strict";
95    var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
96    var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
97        return typeof obj;
98    } : function(obj) {
99        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
100    };
101    (function(factory) {
102        if (true) {
103            !(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(2) ], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, 
104            __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === "function" ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, 
105            __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
106        } else {}
107    })(function(Inputmask) {
108        Inputmask.extendDefinitions({
109            A: {
110                validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
111                casing: "upper"
112            },
113            "&": {
114                validator: "[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
115                casing: "upper"
116            },
117            "#": {
118                validator: "[0-9A-Fa-f]",
119                casing: "upper"
120            }
121        });
122        Inputmask.extendAliases({
123            cssunit: {
124                regex: "[+-]?[0-9]+\\.?([0-9]+)?(px|em|rem|ex|%|in|cm|mm|pt|pc)"
125            },
126            url: {
127                regex: "(https?|ftp)//.*",
128                autoUnmask: false
129            },
130            ip: {
131                mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
132                definitions: {
133                    i: {
134                        validator: function validator(chrs, maskset, pos, strict, opts) {
135                            if (pos - 1 > -1 && maskset.buffer[pos - 1] !== ".") {
136                                chrs = maskset.buffer[pos - 1] + chrs;
137                                if (pos - 2 > -1 && maskset.buffer[pos - 2] !== ".") {
138                                    chrs = maskset.buffer[pos - 2] + chrs;
139                                } else chrs = "0" + chrs;
140                            } else chrs = "00" + chrs;
141                            return new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
142                        }
143                    }
144                },
145                onUnMask: function onUnMask(maskedValue, unmaskedValue, opts) {
146                    return maskedValue;
147                },
148                inputmode: "numeric"
149            },
150            email: {
151                mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]",
152                greedy: false,
153                casing: "lower",
154                onBeforePaste: function onBeforePaste(pastedValue, opts) {
155                    pastedValue = pastedValue.toLowerCase();
156                    return pastedValue.replace("mailto:", "");
157                },
158                definitions: {
159                    "*": {
160                        validator: "[0-9\uff11-\uff19A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5!#$%&'*+/=?^_`{|}~-]"
161                    },
162                    "-": {
163                        validator: "[0-9A-Za-z-]"
164                    }
165                },
166                onUnMask: function onUnMask(maskedValue, unmaskedValue, opts) {
167                    return maskedValue;
168                },
169                inputmode: "email"
170            },
171            mac: {
172                mask: "##:##:##:##:##:##"
173            },
174            vin: {
175                mask: "V{13}9{4}",
176                definitions: {
177                    V: {
178                        validator: "[A-HJ-NPR-Za-hj-npr-z\\d]",
179                        casing: "upper"
180                    }
181                },
182                clearIncomplete: true,
183                autoUnmask: true
184            }
185        });
186        return Inputmask;
187    });
188}, function(module, exports, __webpack_require__) {
189    "use strict";
190    var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
191    var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
192        return typeof obj;
193    } : function(obj) {
194        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
195    };
196    (function(factory) {
197        if (true) {
198            !(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(3), __webpack_require__(5) ], 
199            __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__, 
200            __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
201        } else {}
202    })(function($, window, undefined) {
203        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;
204        function Inputmask(alias, options, internal) {
205            if (!(this instanceof Inputmask)) {
206                return new Inputmask(alias, options, internal);
207            }
208            this.el = undefined;
209            this.events = {};
210            this.maskset = undefined;
211            this.refreshValue = false;
212            if (internal !== true) {
213                if ($.isPlainObject(alias)) {
214                    options = alias;
215                } else {
216                    options = options || {};
217                    if (alias) options.alias = alias;
218                }
219                this.opts = $.extend(true, {}, this.defaults, options);
220                this.noMasksCache = options && options.definitions !== undefined;
221                this.userOptions = options || {};
222                this.isRTL = this.opts.numericInput;
223                resolveAlias(this.opts.alias, options, this.opts);
224            }
225        }
226        Inputmask.prototype = {
227            dataAttribute: "data-inputmask",
228            defaults: {
229                placeholder: "_",
230                optionalmarker: [ "[", "]" ],
231                quantifiermarker: [ "{", "}" ],
232                groupmarker: [ "(", ")" ],
233                alternatormarker: "|",
234                escapeChar: "\\",
235                mask: null,
236                regex: null,
237                oncomplete: $.noop,
238                onincomplete: $.noop,
239                oncleared: $.noop,
240                repeat: 0,
241                greedy: false,
242                autoUnmask: false,
243                removeMaskOnSubmit: false,
244                clearMaskOnLostFocus: true,
245                insertMode: true,
246                clearIncomplete: false,
247                alias: null,
248                onKeyDown: $.noop,
249                onBeforeMask: null,
250                onBeforePaste: function onBeforePaste(pastedValue, opts) {
251                    return $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(this, pastedValue, opts) : pastedValue;
252                },
253                onBeforeWrite: null,
254                onUnMask: null,
255                showMaskOnFocus: true,
256                showMaskOnHover: true,
257                onKeyValidation: $.noop,
258                skipOptionalPartCharacter: " ",
259                numericInput: false,
260                rightAlign: false,
261                undoOnEscape: true,
262                radixPoint: "",
263                _radixDance: false,
264                groupSeparator: "",
265                keepStatic: null,
266                positionCaretOnTab: true,
267                tabThrough: false,
268                supportsInputType: [ "text", "tel", "url", "password", "search" ],
269                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 ],
270                isComplete: null,
271                preValidation: null,
272                postValidation: null,
273                staticDefinitionSymbol: undefined,
274                jitMasking: false,
275                nullable: true,
276                inputEventOnly: false,
277                noValuePatching: false,
278                positionCaretOnClick: "lvp",
279                casing: null,
280                inputmode: "verbatim",
281                colorMask: false,
282                disablePredictiveText: false,
283                importDataAttributes: true,
284                shiftPositions: true
285            },
286            definitions: {
287                9: {
288                    validator: "[0-9\uff11-\uff19]",
289                    definitionSymbol: "*"
290                },
291                a: {
292                    validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
293                    definitionSymbol: "*"
294                },
295                "*": {
296                    validator: "[0-9\uff11-\uff19A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]"
297                }
298            },
299            aliases: {},
300            masksCache: {},
301            mask: function mask(elems) {
302                var that = this;
303                function importAttributeOptions(npt, opts, userOptions, dataAttribute) {
304                    if (opts.importDataAttributes === true) {
305                        var importOption = function importOption(option, optionData) {
306                            optionData = optionData !== undefined ? optionData : npt.getAttribute(dataAttribute + "-" + option);
307                            if (optionData !== null) {
308                                if (typeof optionData === "string") {
309                                    if (option.indexOf("on") === 0) optionData = window[optionData];
309 else if (optionData === "false") optionData = false; else if (optionData === "true") optionData = true;
310                                }
311                                userOptions[option] = optionData;
312                            }
313                        };
314                        var attrOptions = npt.getAttribute(dataAttribute), option, dataoptions, optionData, p;
315                        if (attrOptions && attrOptions !== "") {
316                            attrOptions = attrOptions.replace(/'/g, '"');
317                            dataoptions = JSON.parse("{" + attrOptions + "}");
318                        }
319                        if (dataoptions) {
320                            optionData = undefined;
321                            for (p in dataoptions) {
322                                if (p.toLowerCase() === "alias") {
323                                    optionData = dataoptions[p];
324                                    break;
325                                }
326                            }
327                        }
328                        importOption("alias", optionData);
329                        if (userOptions.alias) {
330                            resolveAlias(userOptions.alias, userOptions, opts);
331                        }
332                        for (option in opts) {
333                            if (dataoptions) {
334                                optionData = undefined;
335                                for (p in dataoptions) {
336                                    if (p.toLowerCase() === option.toLowerCase()) {
337                                        optionData = dataoptions[p];
338                                        break;
339                                    }
340                                }
341                            }
342                            importOption(option, optionData);
343                        }
344                    }
345                    $.extend(true, opts, userOptions);
346                    if (npt.dir === "rtl" || opts.rightAlign) {
347                        npt.style.textAlign = "right";
348                    }
349                    if (npt.dir === "rtl" || opts.numericInput) {
350                        npt.dir = "ltr";
351                        npt.removeAttribute("dir");
352                        opts.isRTL = true;
353                    }
354                    return Object.keys(userOptions).length;
355                }
356                if (typeof elems === "string") {
357                    elems = document.getElementById(elems) || document.querySelectorAll(elems);
358                }
359                elems = elems.nodeName ? [ elems ] : elems;
360                $.each(elems, function(ndx, el) {
361                    var scopedOpts = $.extend(true, {}, that.opts);
362                    if (importAttributeOptions(el, scopedOpts, $.extend(true, {}, that.userOptions), that.dataAttribute)) {
363                        var maskset = generateMaskSet(scopedOpts, that.noMasksCache);
364                        if (maskset !== undefined) {
365                            if (el.inputmask !== undefined) {
366                                el.inputmask.opts.autoUnmask = true;
367                                el.inputmask.remove();
368                            }
369                            el.inputmask = new Inputmask(undefined, undefined, true);
370                            el.inputmask.opts = scopedOpts;
371                            el.inputmask.noMasksCache = that.noMasksCache;
372                            el.inputmask.userOptions = $.extend(true, {}, that.userOptions);
373                            el.inputmask.isRTL = scopedOpts.isRTL || scopedOpts.numericInput;
374                            el.inputmask.el = el;
375                            el.inputmask.maskset = maskset;
376                            $.data(el, "_inputmask_opts", scopedOpts);
377                            maskScope.call(el.inputmask, {
378                                action: "mask"
379                            });
380                        }
381                    }
382                });
383                return elems && elems[0] ? elems[0].inputmask || this : this;
384            },
385            option: function option(options, noremask) {
386                if (typeof options === "string") {
387                    return this.opts[options];
388                } else if ((typeof options === "undefined" ? "undefined" : _typeof(options)) === "object") {
389                    $.extend(this.userOptions, options);
390                    if (this.el && noremask !== true) {
391                        this.mask(this.el);
392                    }
393                    return this;
394                }
395            },
396            unmaskedvalue: function unmaskedvalue(value) {
397                this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache);
398                return maskScope.call(this, {
399                    action: "unmaskedvalue",
400                    value: value
401                });
402            },
403            remove: function remove() {
404                return maskScope.call(this, {
405                    action: "remove"
406                });
407            },
408            getemptymask: function getemptymask() {
409                this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache);
410                return maskScope.call(this, {
411                    action: "getemptymask"
412                });
413            },
414            hasMaskedValue: function hasMaskedValue() {
415                return !this.opts.autoUnmask;
416            },
417            isComplete: function isComplete() {
418                this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache);
419                return maskScope.call(this, {
420                    action: "isComplete"
421                });
422            },
423            getmetadata: function getmetadata() {
424                this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache);
425                return maskScope.call(this, {
426                    action: "getmetadata"
427                });
428            },
429            isValid: function isValid(value) {
430                this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache);
431                return maskScope.call(this, {
432                    action: "isValid",
433                    value: value
434                });
435            },
436            format: function format(value, metadata) {
437                this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache);
438                return maskScope.call(this, {
439                    action: "format",
440                    value: value,
441                    metadata: metadata
442                });
443            },
444            setValue: function setValue(value) {
445                if (this.el) {
446                    $(this.el).trigger("setvalue", [ value ]);
447                }
448            },
449            analyseMask: function analyseMask(mask, regexMask, opts) {
450                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;
451                function MaskToken(isGroup, isOptional, isQuantifier, isAlternator) {
452                    this.matches = [];
453                    this.openGroup = isGroup || false;
454                    this.alternatorGroup = false;
455                    this.isGroup = isGroup || false;
456                    this.isOptional = isOptional || false;
457                    this.isQuantifier = isQuantifier || false;
458                    this.isAlternator = isAlternator || false;
459                    this.quantifier = {
460                        min: 1,
461                        max: 1
462                    };
463                }
464                function insertTestDefinition(mtoken, element, position) {
465                    position = position !== undefined ? position : mtoken.matches.length;
466                    var prevMatch = mtoken.matches[position - 1];
467                    if (regexMask) {
468                        if (element.indexOf("[") === 0 || escaped && /\\d|\\s|\\w]/i.test(element) || element === ".") {
469                            mtoken.matches.splice(position++, 0, {
470                                fn: new RegExp(element, opts.casing ? "i" : ""),
471                                optionality: false,
472                                newBlockMarker: prevMatch === undefined ? "master" : prevMatch.def !== element,
473                                casing: null,
474                                def: element,
475                                placeholder: undefined,
476                                nativeDef: element
477                            });
478                        } else {
479                            if (escaped) element = element[element.length - 1];
480                            $.each(element.split(""), function(ndx, lmnt) {
481                                prevMatch = mtoken.matches[position - 1];
482                                mtoken.matches.splice(position++, 0, {
483                                    fn: null,
484                                    optionality: false,
485                                    newBlockMarker: prevMatch === undefined ? "master" : prevMatch.def !== lmnt && prevMatch.fn !== null,
486                                    casing: null,
487                                    def: opts.staticDefinitionSymbol || lmnt,
488                                    placeholder: opts.staticDefinitionSymbol !== undefined ? lmnt : undefined,
489                                    nativeDef: (escaped ? "'" : "") + lmnt
490                                });
491                            });
492                        }
493                        escaped = false;
494                    } else {
495                        var maskdef = (opts.definitions ? opts.definitions[element] : undefined) || Inputmask.prototype.definitions[element];
496                        if (maskdef && !escaped) {
497                            mtoken.matches.splice(position++, 0, {
498                                fn: maskdef.validator ? typeof maskdef.validator == "string" ? new RegExp(maskdef.validator, opts.casing ? "i" : "") : new function() {
499                                    this.test = maskdef.validator;
500                                }() : new RegExp("."),
501                                optionality: false,
502                                newBlockMarker: prevMatch === undefined ? "master" : prevMatch.def !== (maskdef.definitionSymbol || element),
503                                casing: maskdef.casing,
504                                def: maskdef.definitionSymbol || element,
505                                placeholder: maskdef.placeholder,
506                                nativeDef: element
507                            });
508                        } else {
509                            mtoken.matches.splice(position++, 0, {
510                                fn: null,
511                                optionality: false,
512                                newBlockMarker: prevMatch === undefined ? "master" : prevMatch.def !== element && prevMatch.fn !== null,
513                                casing: null,
514                                def: opts.staticDefinitionSymbol || element,
515                                placeholder: opts.staticDefinitionSymbol !== undefined ? element : undefined,
516                                nativeDef: (escaped ? "'" : "") + element
517                            });
518                            escaped = false;
vendor: 5,552 bytes, lines 519-633
519                        }
520                    }
521                }
522                function verifyGroupMarker(maskToken) {
523                    if (maskToken && maskToken.matches) {
524                        $.each(maskToken.matches, function(ndx, token) {
525                            var nextToken = maskToken.matches[ndx + 1];
526                            if ((nextToken === undefined || nextToken.matches === undefined || nextToken.isQuantifier === false) && token && token.isGroup) {
527                                token.isGroup = false;
528                                if (!regexMask) {
529                                    insertTestDefinition(token, opts.groupmarker[0], 0);
530                                    if (token.openGroup !== true) {
531                                        insertTestDefinition(token, opts.groupmarker[1]);
532                                    }
533                                }
534                            }
535                            verifyGroupMarker(token);
536                        });
537                    }
538                }
539                function defaultCase() {
540                    if (openenings.length > 0) {
541                        currentOpeningToken = openenings[openenings.length - 1];
542                        insertTestDefinition(currentOpeningToken, m);
543                        if (currentOpeningToken.isAlternator) {
544                            alternator = openenings.pop();
545                            for (var mndx = 0; mndx < alternator.matches.length; mndx++) {
546                                if (alternator.matches[mndx].isGroup) alternator.matches[mndx].isGroup = false;
547                            }
548                            if (openenings.length > 0) {
549                                currentOpeningToken = openenings[openenings.length - 1];
550                                currentOpeningToken.matches.push(alternator);
551                            } else {
552                                currentToken.matches.push(alternator);
553                            }
554                        }
555                    } else {
556                        insertTestDefinition(currentToken, m);
557                    }
558                }
559                function reverseTokens(maskToken) {
560                    function reverseStatic(st) {
561                        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];
562                        return st;
563                    }
564                    maskToken.matches = maskToken.matches.reverse();
565                    for (var match in maskToken.matches) {
566                        if (maskToken.matches.hasOwnProperty(match)) {
567                            var intMatch = parseInt(match);
568                            if (maskToken.matches[match].isQuantifier && maskToken.matches[intMatch + 1] && maskToken.matches[intMatch + 1].isGroup) {
569                                var qt = maskToken.matches[match];
570                                maskToken.matches.splice(match, 1);
571                                maskToken.matches.splice(intMatch + 1, 0, qt);
572                            }
573                            if (maskToken.matches[match].matches !== undefined) {
574                                maskToken.matches[match] = reverseTokens(maskToken.matches[match]);
575                            } else {
576                                maskToken.matches[match] = reverseStatic(maskToken.matches[match]);
577                            }
578                        }
579                    }
580                    return maskToken;
581                }
582                function groupify(matches) {
583                    var groupToken = new MaskToken(true);
584                    groupToken.openGroup = false;
585                    groupToken.matches = matches;
586                    return groupToken;
587                }
588                if (regexMask) {
589                    opts.optionalmarker[0] = undefined;
590                    opts.optionalmarker[1] = undefined;
591                }
592                while (match = regexMask ? regexTokenizer.exec(mask) : tokenizer.exec(mask)) {
593                    m = match[0];
594                    if (regexMask) {
595                        switch (m.charAt(0)) {
596                          case "?":
597                            m = "{0,1}";
598                            break;
599
600                          case "+":
601                          case "*":
602                            m = "{" + m + "}";
603                            break;
604                        }
605                    }
606                    if (escaped) {
607                        defaultCase();
608                        continue;
609                    }
610                    switch (m.charAt(0)) {
611                      case "(?=":
612                        break;
613
614                      case "(?!":
615                        break;
616
617                      case "(?<=":
618                        break;
619
620                      case "(?<!":
621                        break;
622
623                      case opts.escapeChar:
624                        escaped = true;
625                        if (regexMask) {
626                            defaultCase();
627                        }
628                        break;
629
630                      case opts.optionalmarker[1]:
631                      case opts.groupmarker[1]:
632                        openingToken = openenings.pop();
633                        openingToken.openGroup = false;
634                        if (openingToken !== undefined) {
635                            if (openenings.length > 0) {
636                                currentOpeningToken = openenings[openenings.length - 1];
637                                currentOpeningToken.matches.push(openingToken);
638                                if (currentOpeningToken.isAlternator) {
639                                    alternator = openenings.pop();
640                                    for (var mndx = 0; mndx < alternator.matches.length; mndx++) {
641                                        alternator.matches[mndx].isGroup = false;
642                                        alternator.matches[mndx].alternatorGroup = false;
643                                    }
644                                    if (openenings.length > 0) {
645                                        currentOpeningToken = openenings[openenings.length - 1];
646                                        currentOpeningToken.matches.push(alternator);
647                                    } else {
648                                        currentToken.matches.push(alternator);
649                                    }
650                                }
651                            } else {
652                                currentToken.matches.push(openingToken);
653                            }
654                        } else defaultCase();
655                        break;
656
657                      case opts.optionalmarker[0]:
658                        openenings.push(new MaskToken(false, true));
659                        break;
660
661                      case opts.groupmarker[0]:
662                        openenings.push(new MaskToken(true));
663                        break;
664
665                      case opts.quantifiermarker[0]:
666                        var quantifier = new MaskToken(false, false, true);
667                        m = m.replace(/[{}]/g, "");
668                        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]);
669                        if (mq0 === "*" || mq0 === "+") {
670                            mq0 = mq1 === "*" ? 0 : 1;
671                        }
672                        quantifier.quantifier = {
673                            min: mq0,
674                            max: mq1,
675                            jit: mqj[1]
676                        };
677                        var matches = openenings.length > 0 ? openenings[openenings.length - 1].matches : currentToken.matches;
678                        match = matches.pop();
679                        if (match.isAlternator) {
680                            matches.push(match);
681                            matches = match.matches;
682                            var groupToken = new MaskToken(true);
683                            var tmpMatch = matches.pop();
684                            matches.push(groupToken);
685                            matches = groupToken.matches;
686                            match = tmpMatch;
687                        }
688                        if (!match.isGroup) {
689                            match = groupify([ match ]);
690                        }
691                        matches.push(match);
692                        matches.push(quantifier);
693                        break;
694
695                      case opts.alternatormarker:
696                        var groupQuantifier = function groupQuantifier(matches) {
697                            var lastMatch = matches.pop();
698                            if (lastMatch.isQuantifier) {
699                                lastMatch = groupify([ matches.pop(), lastMatch ]);
700                            }
701                            return lastMatch;
702                        };
703                        if (openenings.length > 0) {
704                            currentOpeningToken = openenings[openenings.length - 1];
705                            var subToken = currentOpeningToken.matches[currentOpeningToken.matches.length - 1];
706                            if (currentOpeningToken.openGroup && (subToken.matches === undefined || subToken.isGroup === false && subToken.isAlternator === false)) {
707                                lastMatch = openenings.pop();
708                            } else {
709                                lastMatch = groupQuantifier(currentOpeningToken.matches);
710                            }
711                        } else {
712                            lastMatch = groupQuantifier(currentToken.matches);
713                        }
714                        if (lastMatch.isAlternator) {
715                            openenings.push(lastMatch);
716                        } else {
717                            if (lastMatch.alternatorGroup) {
718                                alternator = openenings.pop();
719                                lastMatch.alternatorGroup = false;
720                            } else {
721                                alternator = new MaskToken(false, false, false, true);
722                            }
723                            alternator.matches.push(lastMatch);
724                            openenings.push(alternator);
725                            if (lastMatch.openGroup) {
726                                lastMatch.openGroup = false;
727                                var alternatorGroup = new MaskToken(true);
728                                alternatorGroup.alternatorGroup = true;
729                                openenings.push(alternatorGroup);
730                            }
731                        }
732                        break;
733
734                      default:
735                        defaultCase();
736                    }
737                }
738                while (openenings.length > 0) {
739                    openingToken = openenings.pop();
740                    currentToken.matches.push(openingToken);
741                }
742                if (currentToken.matches.length > 0) {
743                    verifyGroupMarker(currentToken);
744                    maskTokens.push(currentToken);
745                }
746                if (opts.numericInput || opts.isRTL) {
747                    reverseTokens(maskTokens[0]);
748                }
749                return maskTokens;
750            }
751        };
752        Inputmask.extendDefaults = function(options) {
753            $.extend(true, Inputmask.prototype.defaults, options);
754        };
755        Inputmask.extendDefinitions = function(definition) {
756            $.extend(true, Inputmask.prototype.definitions, definition);
757        };
758        Inputmask.extendAliases = function(alias) {
759            $.extend(true, Inputmask.prototype.aliases, alias);
760        };
761        Inputmask.format = function(value, options, metadata) {
762            return Inputmask(options).format(value, metadata);
763        };
764        Inputmask.unmask = function(value, options) {
765            return Inputmask(options).unmaskedvalue(value);
766        };
767        Inputmask.isValid = function(value, options) {
768            return Inputmask(options).isValid(value);
769        };
770        Inputmask.remove = function(elems) {
771            if (typeof elems === "string") {
772                elems = document.getElementById(elems) || document.querySelectorAll(elems);
773            }
774            elems = elems.nodeName ? [ elems ] : elems;
775            $.each(elems, function(ndx, el) {
776                if (el.inputmask) el.inputmask.remove();
777            });
778        };
779        Inputmask.setValue = function(elems, value) {
780            if (typeof elems === "string") {
781                elems = document.getElementById(elems) || document.querySelectorAll(elems);
782            }
783            elems = elems.nodeName ? [ elems ] : elems;
784            $.each(elems, function(ndx, el) {
785                if (el.inputmask) el.inputmask.setValue(value); else $(el).trigger("setvalue", [ value ]);
786            });
787        };
788        Inputmask.escapeRegex = function(str) {
789            var specials = [ "/", ".", "*", "+", "?", "|", "(", ")", "[", "]", "{", "}", "\\", "$", "^" ];
790            return str.replace(new RegExp("(\\" + specials.join("|\\") + ")", "gim"), "\\$1");
791        };
792        Inputmask.keyCode = {
793            BACKSPACE: 8,
794            BACKSPACE_SAFARI: 127,
795            DELETE: 46,
796            DOWN: 40,
797            END: 35,
798            ENTER: 13,
799            ESCAPE: 27,
800            HOME: 36,
801            INSERT: 45,
802            LEFT: 37,
803            PAGE_DOWN: 34,
804            PAGE_UP: 33,
805            RIGHT: 39,
806            SPACE: 32,
807            TAB: 9,
808            UP: 38,
809            X: 88,
810            CONTROL: 17
811        };
812        Inputmask.dependencyLib = $;
813        function resolveAlias(aliasStr, options, opts) {
814            var aliasDefinition = Inputmask.prototype.aliases[aliasStr];
815            if (aliasDefinition) {
816                if (aliasDefinition.alias) resolveAlias(aliasDefinition.alias, undefined, opts);
817                $.extend(true, opts, aliasDefinition);
818                $.extend(true, opts, options);
819                return true;
820            } else if (opts.mask === null) {
821                opts.mask = aliasStr;
822            }
823            return false;
824        }
825        function generateMaskSet(opts, nocache) {
826            function generateMask(mask, metadata, opts) {
827                var regexMask = false;
828                if (mask === null || mask === "") {
829                    regexMask = opts.regex !== null;
830                    if (regexMask) {
831                        mask = opts.regex;
832                        mask = mask.replace(/^(\^)(.*)(\$)$/, "$2");
833                    } else {
834                        regexMask = true;
835                        mask = ".*";
836                    }
837                }
838                if (mask.length === 1 && opts.greedy === false && opts.repeat !== 0) {
839                    opts.placeholder = "";
840                }
841                if (opts.repeat > 0 || opts.repeat === "*" || opts.repeat === "+") {
842                    var repeatStart = opts.repeat === "*" ? 0 : opts.repeat === "+" ? 1 : opts.repeat;
843                    mask = opts.groupmarker[0] + mask + opts.groupmarker[1] + opts.quantifiermarker[0] + repeatStart + "," + opts.repeat + opts.quantifiermarker[1];
844                }
845                var masksetDefinition, maskdefKey = regexMask ? "regex_" + opts.regex : opts.numericInput ? mask.split("").reverse().join("") : mask;
846                if (Inputmask.prototype.masksCache[maskdefKey] === undefined || nocache === true) {
847                    masksetDefinition = {
848                        mask: mask,
849                        maskToken: Inputmask.prototype.analyseMask(mask, regexMask, opts),
850                        validPositions: {},
851                        _buffer: undefined,
852                        buffer: undefined,
853                        tests: {},
854                        excludes: {},
855                        metadata: metadata,
856                        maskLength: undefined,
857                        jitOffset: {}
858                    };
859                    if (nocache !== true) {
860                        Inputmask.prototype.masksCache[maskdefKey] = masksetDefinition;
861                        masksetDefinition = $.extend(true, {}, Inputmask.prototype.masksCache[maskdefKey]);
862                    }
863                } else masksetDefinition = $.extend(true, {}, Inputmask.prototype.masksCache[maskdefKey]);
864                return masksetDefinition;
865            }
866            var ms;
867            if ($.isFunction(opts.mask)) {
868                opts.mask = opts.mask(opts);
869            }
870            if ($.isArray(opts.mask)) {
871                if (opts.mask.length > 1) {
872                    if (opts.keepStatic === null) {
873                        opts.keepStatic = "auto";
874                        for (var i = 0; i < opts.mask.length; i++) {
875                            if (opts.mask[i].charAt(0) !== opts.mask[0].charAt(0)) {
876                                opts.keepStatic = true;
877                                break;
878                            }
879                        }
880                    }
881                    var altMask = opts.groupmarker[0];
882                    $.each(opts.isRTL ? opts.mask.reverse() : opts.mask, function(ndx, msk) {
883                        if (altMask.length > 1) {
884                            altMask += opts.groupmarker[1] + opts.alternatormarker + opts.groupmarker[0];
885                        }
886                        if (msk.mask !== undefined && !$.isFunction(msk.mask)) {
887                            altMask += msk.mask;
888                        } else {
889                            altMask += msk;
890                        }
891                    });
892                    altMask += opts.groupmarker[1];
893                    return generateMask(altMask, opts.mask, opts);
894                } else opts.mask = opts.mask.pop();
895            }
896            if (opts.mask && opts.mask.mask !== undefined && !$.isFunction(opts.mask.mask)) {
897                ms = generateMask(opts.mask.mask, opts.mask, opts);
898            } else {
899                ms = generateMask(opts.mask, opts.mask, opts);
900            }
901            return ms;
902        }
903        function isInputEventSupported(eventName) {
904            var el = document.createElement("input"), evName = "on" + eventName, isSupported = evName in el;
905            if (!isSupported) {
906                el.setAttribute(evName, "return;");
907                isSupported = typeof el[evName] === "function";
908            }
909            el = null;
910            return isSupported;
911        }
912        function maskScope(actionObj, maskset, opts) {
913            maskset = maskset || this.maskset;
914            opts = opts || this.opts;
915            var inputmask = this, el = this.el, isRTL = this.isRTL, undoValue, $el, skipKeyPressEvent = false, skipInputEvent = false, ignorable = false, maxLength, mouseEnter = false, colorMask, originalPlaceholder;
916            function getMaskTemplate(baseOnInput, minimalPos, includeMode, noJit, clearOptionalTail) {
917                var greedy = opts.greedy;
918                if (clearOptionalTail) opts.greedy = false;
919                minimalPos = minimalPos || 0;
920                var maskTemplate = [], ndxIntlzr, pos = 0, test, testPos, lvp = getLastValidPosition();
921                do {
922                    if (baseOnInput === true && getMaskSet().validPositions[pos]) {
923                        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];
924                        test = testPos.match;
925                        ndxIntlzr = testPos.locator.slice();
926                        maskTemplate.push(includeMode === true ? testPos.input : includeMode === false ? test.nativeDef : getPlaceholder(pos, test));
927                    } else {
928                        testPos = getTestTemplate(pos, ndxIntlzr, pos - 1);
929                        test = testPos.match;
930                        ndxIntlzr = testPos.locator.slice();
931                        var jitMasking = noJit === true ? false : opts.jitMasking !== false ? opts.jitMasking : test.jit;
932                        if (jitMasking === false || jitMasking === undefined || typeof jitMasking === "number" && isFinite(jitMasking) && jitMasking > pos) {
933                            maskTemplate.push(includeMode === false ? test.nativeDef : getPlaceholder(pos, test));
934                        }
935                    }
936                    if (opts.keepStatic === "auto") {
937                        if (test.newBlockMarker && test.fn !== null) {
938                            opts.keepStatic = pos - 1;
939                        }
940                    }
941                    pos++;
942                } while ((maxLength === undefined || pos < maxLength) && (test.fn !== null || test.def !== "") || minimalPos > pos);
943                if (maskTemplate[maskTemplate.length - 1] === "") {
944                    maskTemplate.pop();
945                }
946                if (includeMode !== false || getMaskSet().maskLength === undefined) getMaskSet().maskLength = pos - 1;
947                opts.greedy = greedy;
948                return maskTemplate;
949            }
950            function getMaskSet() {
951                return maskset;
952            }
953            function resetMaskSet(soft) {
954                var maskset = getMaskSet();
955                maskset.buffer = undefined;
956                if (soft !== true) {
957                    maskset.validPositions = {};
958                    maskset.p = 0;
959                }
960            }
961            function getLastValidPosition(closestTo, strict, validPositions) {
962                var before = -1, after = -1, valids = validPositions || getMaskSet().validPositions;
963                if (closestTo === undefined) closestTo = -1;
964                for (var posNdx in valids) {
965                    var psNdx = parseInt(posNdx);
966                    if (valids[psNdx] && (strict || valids[psNdx].generatedInput !== true)) {
967                        if (psNdx <= closestTo) before = psNdx;
968                        if (psNdx >= closestTo) after = psNdx;
969                    }
970                }
971                return before === -1 || before == closestTo ? after : after == -1 ? before : closestTo - before < after - closestTo ? before : after;
972            }
973            function getDecisionTaker(tst) {
974                var decisionTaker = tst.locator[tst.alternation];
975                if (typeof decisionTaker == "string" && decisionTaker.length > 0) {
976                    decisionTaker = decisionTaker.split(",")[0];
977                }
978                return decisionTaker !== undefined ? decisionTaker.toString() : "";
979            }
980            function getLocator(tst, align) {
981                var locator = (tst.alternation != undefined ? tst.mloc[getDecisionTaker(tst)] : tst.locator).join("");
982                if (locator !== "") while (locator.length < align) {
983                    locator += "0";
984                }
985                return locator;
986            }
987            function determineTestTemplate(pos, tests) {
988                pos = pos > 0 ? pos - 1 : 0;
989                var altTest = getTest(pos), targetLocator = getLocator(altTest), tstLocator, closest, bestMatch;
990                for (var ndx = 0; ndx < tests.length; ndx++) {
991                    var tst = tests[ndx];
992                    tstLocator = getLocator(tst, targetLocator.length);
993                    var distance = Math.abs(tstLocator - targetLocator);
994                    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) {
995                        closest = distance;
996                        bestMatch = tst;
997                    }
998                }
999                return bestMatch;
1000            }
1001            function getTestTemplate(pos, ndxIntlzr, tstPs) {
1002                return getMaskSet().validPositions[pos] || determineTestTemplate(pos, getTests(pos, ndxIntlzr ? ndxIntlzr.slice() : ndxIntlzr, tstPs));
1003            }
1004            function getTest(pos, tests) {
1005                if (getMaskSet().validPositions[pos]) {
1006                    return getMaskSet().validPositions[pos];
1007                }
1008                return (tests || getTests(pos))[0];
1009            }
1010            function positionCanMatchDefinition(pos, def) {
1011                var valid = false, tests = getTests(pos);
1012                for (var tndx = 0; tndx < tests.length; tndx++) {
1013                    if (tests[tndx].match && tests[tndx].match.def === def) {
1014                        valid = true;
1015                        break;
1016                    }
1017                }
1018                return valid;
1019            }
1020            function getTests(pos, ndxIntlzr, tstPs) {
1021                var maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr ? ndxIntlzr.slice() : [ 0 ], matches = [], insertStop = false, latestMatch, cacheDependency = ndxIntlzr ? ndxIntlzr.join("") : "";
1022                function resolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) {
1023                    function handleMatch(match, loopNdx, quantifierRecurse) {
1024                        function isFirstMatch(latestMatch, tokenGroup) {
1025                            var firstMatch = $.inArray(latestMatch, tokenGroup.matches) === 0;
1026                            if (!firstMatch) {
1027                                $.each(tokenGroup.matches, function(ndx, match) {
1028                                    if (match.isQuantifier === true) firstMatch = isFirstMatch(latestMatch, tokenGroup.matches[ndx - 1]); else if (match.hasOwnProperty("matches")) firstMatch = isFirstMatch(latestMatch, match);
1029                                    if (firstMatch) return false;
1030                                });
1031                            }
1032                            return firstMatch;
1033                        }
1034                        function resolveNdxInitializer(pos, alternateNdx, targetAlternation) {
1035                            var bestMatch, indexPos;
1036                            if (getMaskSet().tests[pos] || getMaskSet().validPositions[pos]) {
1037                                $.each(getMaskSet().tests[pos] || [ getMaskSet().validPositions[pos] ], function(ndx, lmnt) {
1038                                    if (lmnt.mloc[alternateNdx]) {
1039                                        bestMatch = lmnt;
1040                                        return false;
1041                                    }
1042                                    var alternation = targetAlternation !== undefined ? targetAlternation : lmnt.alternation, ndxPos = lmnt.locator[alternation] !== undefined ? lmnt.locator[alternation].toString().indexOf(alternateNdx) : -1;
1043                                    if ((indexPos === undefined || ndxPos < indexPos) && ndxPos !== -1) {
1044                                        bestMatch = lmnt;
1045                                        indexPos = ndxPos;
1046                                    }
1047                                });
1048                            }
1049                            if (bestMatch) {
1050                                var bestMatchAltIndex = bestMatch.locator[bestMatch.alternation];
1051                                var locator = bestMatch.mloc[alternateNdx] || bestMatch.mloc[bestMatchAltIndex] || bestMatch.locator;
1052                                return locator.slice((targetAlternation !== undefined ? targetAlternation : bestMatch.alternation) + 1);
1053                            } else {
1054                                return targetAlternation !== undefined ? resolveNdxInitializer(pos, alternateNdx) : undefined;
1055                            }
1056                        }
1057                        function isSubsetOf(source, target) {
1058                            function expand(pattern) {
1059                                var expanded = [], start, end;
1060                                for (var i = 0, l = pattern.length; i < l; i++) {
1061                                    if (pattern.charAt(i) === "-") {
1062                                        end = pattern.charCodeAt(i + 1);
1063                                        while (++start < end) {
1064                                            expanded.push(String.fromCharCode(start));
1065                                        }
1066                                    } else {
1067                                        start = pattern.charCodeAt(i);
1068                                        expanded.push(pattern.charAt(i));
1069                                    }
1070                                }
1071                                return expanded.join("");
1072                            }
1073                            if (opts.regex && source.match.fn !== null && target.match.fn !== null) {
1074                                return expand(target.match.def.replace(/[\[\]]/g, "")).indexOf(expand(source.match.def.replace(/[\[\]]/g, ""))) !== -1;
1075                            }
1076                            return source.match.def === target.match.nativeDef;
1077                        }
1078                        function staticCanMatchDefinition(source, target) {
1079                            var sloc = source.locator.slice(source.alternation).join(""), tloc = target.locator.slice(target.alternation).join(""), canMatch = sloc == tloc;
1080                            canMatch = canMatch && source.match.fn === null && target.match.fn !== null ? target.match.fn.test(source.match.def, getMaskSet(), pos, false, opts, false) : false;
1081                            return canMatch;
1082                        }
1083                        function setMergeLocators(targetMatch, altMatch) {
1084                            if (altMatch === undefined || targetMatch.alternation === altMatch.alternation && targetMatch.locator[targetMatch.alternation].toString().indexOf(altMatch.locator[altMatch.alternation]) === -1) {
1085                                targetMatch.mloc = targetMatch.mloc || {};
1086                                var locNdx = targetMatch.locator[targetMatch.alternation];
1087                                if (locNdx === undefined) targetMatch.alternation = undefined; else {
1088                                    if (typeof locNdx === "string") locNdx = locNdx.split(",")[0];
1089                                    if (targetMatch.mloc[locNdx] === undefined) targetMatch.mloc[locNdx] = targetMatch.locator.slice();
1090                                    if (altMatch !== undefined) {
1091                                        for (var ndx in altMatch.mloc) {
1092                                            if (typeof ndx === "string") ndx = ndx.split(",")[0];
1093                                            if (targetMatch.mloc[ndx] === undefined) targetMatch.mloc[ndx] = altMatch.mloc[ndx];
1094                                        }
1095                                        targetMatch.locator[targetMatch.alternation] = Object.keys(targetMatch.mloc).join(",");
1096                                    }
1097                                    return true;
1098                                }
1099                            }
1100                            return false;
1101                        }
1102                        if (testPos > 500 && quantifierRecurse !== undefined) {
1103                            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;
1104                        }
1105                        if (testPos === pos && match.matches === undefined) {
1106                            matches.push({
1107                                match: match,
1108                                locator: loopNdx.reverse(),
1109                                cd: cacheDependency,
1110                                mloc: {}
1111                            });
1112                            return true;
1113                        } else if (match.matches !== undefined) {
1114                            if (match.isGroup && quantifierRecurse !== match) {
1115                                match = handleMatch(maskToken.matches[$.inArray(match, maskToken.matches) + 1], loopNdx, quantifierRecurse);
1116                                if (match) return true;
1117                            } else if (match.isOptional) {
1118                                var optionalToken = match;
1119                                match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse);
1120                                if (match) {
1121                                    $.each(matches, function(ndx, mtch) {
1122                                        mtch.match.optionality = true;
1123                                    });
1124                                    latestMatch = matches[matches.length - 1].match;
1125                                    if (quantifierRecurse === undefined && isFirstMatch(latestMatch, optionalToken)) {
1126                                        insertStop = true;
1127                                        testPos = pos;
1128                                    } else return true;
1129                                }
1130                            } else if (match.isAlternator) {
1131                                var alternateToken = match, malternateMatches = [], maltMatches, currentMatches = matches.slice(), loopNdxCnt = loopNdx.length;
1132                                var altIndex = ndxInitializer.length > 0 ? ndxInitializer.shift() : -1;
1133                                if (altIndex === -1 || typeof altIndex === "string") {
1134                                    var currentPos = testPos, ndxInitializerClone = ndxInitializer.slice(), altIndexArr = [], amndx;
1135                                    if (typeof altIndex == "string") {
1136                                        altIndexArr = altIndex.split(",");
1137                                    } else {
1138                                        for (amndx = 0;
1138 amndx < alternateToken.matches.length; amndx++) {
1139                                            altIndexArr.push(amndx.toString());
1140                                        }
1141                                    }
1142                                    if (getMaskSet().excludes[pos]) {
1143                                        var altIndexArrClone = altIndexArr.slice();
1144                                        for (var i = 0, el = getMaskSet().excludes[pos].length; i < el; i++) {
1145                                            altIndexArr.splice(altIndexArr.indexOf(getMaskSet().excludes[pos][i].toString()), 1);
1146                                        }
1147                                        if (altIndexArr.length === 0) {
1148                                            getMaskSet().excludes[pos] = undefined;
1149                                            altIndexArr = altIndexArrClone;
1150                                        }
1151                                    }
1152                                    if (opts.keepStatic === true || isFinite(parseInt(opts.keepStatic)) && currentPos >= opts.keepStatic) altIndexArr = altIndexArr.slice(0, 1);
1153                                    var unMatchedAlternation = false;
1154                                    for (var ndx = 0; ndx < altIndexArr.length; ndx++) {
1155                                        amndx = parseInt(altIndexArr[ndx]);
1156                                        matches = [];
1157                                        ndxInitializer = typeof altIndex === "string" ? resolveNdxInitializer(testPos, amndx, loopNdxCnt) || ndxInitializerClone.slice() : ndxInitializerClone.slice();
1158                                        if (alternateToken.matches[amndx] && handleMatch(alternateToken.matches[amndx], [ amndx ].concat(loopNdx), quantifierRecurse)) match = true; else if (ndx === 0) {
1159                                            unMatchedAlternation = true;
1160                                        }
1161                                        maltMatches = matches.slice();
1162                                        testPos = currentPos;
1163                                        matches = [];
1164                                        for (var ndx1 = 0; ndx1 < maltMatches.length; ndx1++) {
1165                                            var altMatch = maltMatches[ndx1], dropMatch = false;
1166                                            altMatch.match.jit = altMatch.match.jit || unMatchedAlternation;
1167                                            altMatch.alternation = altMatch.alternation || loopNdxCnt;
1168                                            setMergeLocators(altMatch);
1169                                            for (var ndx2 = 0; ndx2 < malternateMatches.length; ndx2++) {
1170                                                var altMatch2 = malternateMatches[ndx2];
1171                                                if (typeof altIndex !== "string" || altMatch.alternation !== undefined && $.inArray(altMatch.locator[altMatch.alternation].toString(), altIndexArr) !== -1) {
1172                                                    if (altMatch.match.nativeDef === altMatch2.match.nativeDef) {
1173                                                        dropMatch = true;
1174                                                        setMergeLocators(altMatch2, altMatch);
1175                                                        break;
1176                                                    } else if (isSubsetOf(altMatch, altMatch2)) {
1177                                                        if (setMergeLocators(altMatch, altMatch2)) {
1178                                                            dropMatch = true;
1179                                                            malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch);
1180                                                        }
1181                                                        break;
1182                                                    } else if (isSubsetOf(altMatch2, altMatch)) {
1183                                                        setMergeLocators(altMatch2, altMatch);
1184                                                        break;
1185                                                    } else if (staticCanMatchDefinition(altMatch, altMatch2)) {
1186                                                        if (setMergeLocators(altMatch, altMatch2)) {
1187                                                            dropMatch = true;
1188                                                            malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch);
1189                                                        }
1190                                                        break;
1191                                                    }
1192                                                }
1193                                            }
1194                                            if (!dropMatch) {
1195                                                malternateMatches.push(altMatch);
1196                                            }
1197                                        }
1198                                    }
1199                                    matches = currentMatches.concat(malternateMatches);
1200                                    testPos = pos;
1201                                    insertStop = matches.length > 0;
1202                                    match = malternateMatches.length > 0;
1203                                    ndxInitializer = ndxInitializerClone.slice();
1204                                } else match = handleMatch(alternateToken.matches[altIndex] || maskToken.matches[altIndex], [ altIndex ].concat(loopNdx), quantifierRecurse);
1205                                if (match) return true;
1206                            } else if (match.isQuantifier && quantifierRecurse !== maskToken.matches[$.inArray(match, maskToken.matches) - 1]) {
1207                                var qt = match;
1208                                for (var qndx = ndxInitializer.length > 0 ? ndxInitializer.shift() : 0; qndx < (isNaN(qt.quantifier.max) ? qndx + 1 : qt.quantifier.max) && testPos <= pos; qndx++) {
1209                                    var tokenGroup = maskToken.matches[$.inArray(qt, maskToken.matches) - 1];
1210                                    match = handleMatch(tokenGroup, [ qndx ].concat(loopNdx), tokenGroup);
1211                                    if (match) {
1212                                        latestMatch = matches[matches.length - 1].match;
1213                                        latestMatch.optionalQuantifier = qndx >= qt.quantifier.min;
1214                                        latestMatch.jit = (qndx || 1) * tokenGroup.matches.indexOf(latestMatch) >= qt.quantifier.jit;
1215                                        if (latestMatch.optionalQuantifier && isFirstMatch(latestMatch, tokenGroup)) {
1216                                            insertStop = true;
1217                                            testPos = pos;
1218                                            break;
1219                                        }
1220                                        if (latestMatch.jit) {
1221                                            getMaskSet().jitOffset[pos] = tokenGroup.matches.indexOf(latestMatch);
1222                                        }
1223                                        return true;
1224                                    }
1225                                }
1226                            } else {
1227                                match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse);
1228                                if (match) return true;
1229                            }
1230                        } else {
1231                            testPos++;
1232                        }
1233                    }
1234                    for (var tndx = ndxInitializer.length > 0 ? ndxInitializer.shift() : 0; tndx < maskToken.matches.length; tndx++) {
1235                        if (maskToken.matches[tndx].isQuantifier !== true) {
1236                            var match = handleMatch(maskToken.matches[tndx], [ tndx ].concat(loopNdx), quantifierRecurse);
1237                            if (match && testPos === pos) {
1238                                return match;
1239                            } else if (testPos > pos) {
1240                                break;
1241                            }
1242                        }
1243                    }
1244                }
1245                function mergeLocators(pos, tests) {
1246                    var locator = [];
1247                    if (!$.isArray(tests)) tests = [ tests ];
1248                    if (tests.length > 0) {
1249                        if (tests[0].alternation === undefined) {
1250                            locator = determineTestTemplate(pos, tests.slice()).locator.slice();
1251                            if (locator.length === 0) locator = tests[0].locator.slice();
1252                        } else {
1253                            $.each(tests, function(ndx, tst) {
1254                                if (tst.def !== "") {
1255                                    if (locator.length === 0) locator = t
1255st.locator.slice(); else {
1256                                        for (var i = 0; i < locator.length; i++) {
1257                                            if (tst.locator[i] && locator[i].toString().indexOf(tst.locator[i]) === -1) {
1258                                                locator[i] += "," + tst.locator[i];
1259                                            }
1260                                        }
1261                                    }
1262                                }
1263                            });
1264                        }
1265                    }
1266                    return locator;
1267                }
1268                if (pos > -1) {
1269                    if (ndxIntlzr === undefined) {
1270                        var previousPos = pos - 1, test;
1271                        while ((test = getMaskSet().validPositions[previousPos] || getMaskSet().tests[previousPos]) === undefined && previousPos > -1) {
1272                            previousPos--;
1273                        }
1274                        if (test !== undefined && previousPos > -1) {
1275                            ndxInitializer = mergeLocators(previousPos, test);
1276                            cacheDependency = ndxInitializer.join("");
1277                            testPos = previousPos;
1278                        }
1279                    }
1280                    if (getMaskSet().tests[pos] && getMaskSet().tests[pos][0].cd === cacheDependency) {
1281                        return getMaskSet().tests[pos];
1282                    }
1283                    for (var mtndx = ndxInitializer.shift(); mtndx < maskTokens.length; mtndx++) {
1284                        var match = resolveTestFromToken(maskTokens[mtndx], ndxInitializer, [ mtndx ]);
1285                        if (match && testPos === pos || testPos > pos) {
1286                            break;
1287                        }
1288                    }
1289                }
1290                if (matches.length === 0 || insertStop) {
1291                    matches.push({
1292                        match: {
1293                            fn: null,
1294                            optionality: false,
1295                            casing: null,
1296                            def: "",
1297                            placeholder: ""
1298                        },
1299                        locator: [],
1300                        mloc: {},
1301                        cd: cacheDependency
1302                    });
1303                }
1304                if (ndxIntlzr !== undefined && getMaskSet().tests[pos]) {
1305                    return $.extend(true, [], matches);
1306                }
1307                getMaskSet().tests[pos] = $.extend(true, [], matches);
1308                return getMaskSet().tests[pos];
1309            }
1310            function getBufferTemplate() {
1311                if (getMaskSet()._buffer === undefined) {
1312                    getMaskSet()._buffer = getMaskTemplate(false, 1);
1313                    if (getMaskSet().buffer === undefined) getMaskSet().buffer = getMaskSet()._buffer.slice();
1314                }
1315                return getMaskSet()._buffer;
1316            }
1317            function getBuffer(noCache) {
1318                if (getMaskSet().buffer === undefined || noCache === true) {
1319                    getMaskSet().buffer = getMaskTemplate(true, getLastValidPosition(), true);
1320                    if (getMaskSet()._buffer === undefined) getMaskSet()._buffer = getMaskSet().buffer.slice();
1321                }
1322                return getMaskSet().buffer;
1323            }
1324            function refreshFromBuffer(start, end, buffer) {
1325                var i, p;
1326                if (start === true) {
1327                    resetMaskSet();
1328                    start = 0;
1329                    end = buffer.length;
1330                } else {
1331                    for (i = start; i < end; i++) {
1332                        delete getMaskSet().validPositions[i];
1333                    }
1334                }
1335                p = start;
1336                for (i = start; i < end; i++) {
1337                    resetMaskSet(true);
1338                    if (buffer[i] !== opts.skipOptionalPartCharacter) {
1339                        var valResult = isValid(p, buffer[i], true, true);
1340                        if (valResult !== false) {
1341                            resetMaskSet(true);
1342                            p = valResult.caret !== undefined ? valResult.caret : valResult.pos + 1;
1343                        }
1344                    }
1345                }
1346            }
1347            function casing(elem, test, pos) {
1348                switch (opts.casing || test.casing) {
1349                  case "upper":
1350                    elem = elem.toUpperCase();
1351                    break;
1352
1353                  case "lower":
1354                    elem = elem.toLowerCase();
1355                    break;
1356
1357                  case "title":
1358                    var posBefore = getMaskSet().validPositions[pos - 1];
1359                    if (pos === 0 || posBefore && posBefore.input === String.fromCharCode(Inputmask.keyCode.SPACE)) {
1360                        elem = elem.toUpperCase();
1361                    } else {
1362                        elem = elem.toLowerCase();
1363                    }
1364                    break;
1365
1366                  default:
1367                    if ($.isFunction(opts.casing)) {
1368                        var args = Array.prototype.slice.call(arguments);
1369                        args.push(getMaskSet().validPositions);
1370                        elem = opts.casing.apply(this, args);
1371                    }
1372                }
1373                return elem;
1374            }
1375            function checkAlternationMatch(altArr1, altArr2, na) {
1376                var altArrC = opts.greedy ? altArr2 : altArr2.slice(0, 1), isMatch = false, naArr = na !== undefined ? na.split(",") : [], naNdx;
1377                for (var i = 0; i < naArr.length; i++) {
1378                    if ((naNdx = altArr1.indexOf(naArr[i])) !== -1) {
1379                        altArr1.splice(naNdx, 1);
1380                    }
1381                }
1382                for (var alndx = 0; alndx < altArr1.length; alndx++) {
1383                    if ($.inArray(altArr1[alndx], altArrC) !== -1) {
1384                        isMatch = true;
1385                        break;
1386                    }
1387                }
1388                return isMatch;
1389            }
1390            function alternate(pos, c, strict, fromSetValid, rAltPos) {
1391                var validPsClone = $.extend(true, {}, getMaskSet().validPositions), lastAlt, alternation, isValidRslt = false, altPos, prevAltPos, i, validPos, decisionPos, lAltPos = rAltPos !== undefined ? rAltPos : getLastValidPosition();
1392                if (lAltPos === -1 && rAltPos === undefined) {
1393                    lastAlt = 0;
1394                    prevAltPos = getTest(lastAlt);
1395                    alternation = prevAltPos.alternation;
1396                } else {
1397                    for (;lAltPos >= 0; lAltPos--) {
1398                        altPos = getMaskSet().validPositions[lAltPos];
1399                        if (altPos && altPos.alternation !== undefined) {
1400                            if (prevAltPos && prevAltPos.locator[altPos.alternation] !== altPos.locator[altPos.alternation]) {
1401                                break;
1402                            }
1403                            lastAlt = lAltPos;
1404                            alternation = getMaskSet().validPositions[lastAlt].alternation;
1405                            prevAltPos = altPos;
1406                        }
1407                    }
1408                }
1409                if (alternation !== undefined) {
1410                    decisionPos = parseInt(lastAlt);
1411                    getMaskSet().excludes[decisionPos] = getMaskSet().excludes[decisionPos] || [];
1412                    if (pos !== true) {
1413                        getMaskSet().excludes[decisionPos].push(getDecisionTaker(prevAltPos));
1414                    }
1415                    var validInputsClone = [], staticInputsBeforePos = 0;
1416                    for (i = decisionPos; i < getLastValidPosition(undefined, true) + 1; i++) {
1417                        validPos = getMaskSet().validPositions[i];
1418                        if (validPos && validPos.generatedInput !== true) {
1419                            validInputsClone.push(validPos.input);
1420                        } else if (i < pos) staticInputsBeforePos++;
1421                        delete getMaskSet().validPositions[i];
1422                    }
1423                    while (getMaskSet().excludes[decisionPos] && getMaskSet().excludes[decisionPos].length < 10) {
1424                        var posOffset = staticInputsBeforePos * -1, validInputs = validInputsClone.slice();
1425                        getMaskSet().tests[decisionPos] = undefined;
1426                        resetMaskSet(true);
1427                        isValidRslt = true;
1428                        while (validInputs.length > 0) {
1429                            var input = validInputs.shift();
1430                            if (!(isValidRslt = isValid(getLastValidPosition(undefined, true) + 1, input, false, fromSetValid, true))) {
1431                                break;
1432                            }
1433                        }
1434                        if (isValidRslt && c !== undefined) {
1435                            var targetLvp = getLastValidPosition(pos) + 1;
1436                            for (i = decisionPos; i < getLastValidPosition() + 1; i++) {
1437                                validPos = getMaskSet().validPositions[i];
1438                                if ((validPos === undefined || validPos.match.fn == null) && i < pos + posOffset) {
1439                                    posOffset++;
1440                                }
1441                            }
1442                            pos = pos + posOffset;
1443                            isValidRslt = isValid(pos > targetLvp ? targetLvp : pos, c, strict, fromSetValid, true);
1444                        }
1445                        if (!isValidRslt) {
1446                            resetMaskSet();
1447                            prevAltPos = getTest(decisionPos);
1448                            getMaskSet().validPositions = $.extend(true, {}, validPsClone);
1449                            if (getMaskSet().excludes[decisionPos]) {
1450                                var decisionTaker = getDecisionTaker(prevAltPos);
1451                                if (getMaskSet().excludes[decisionPos].indexOf(decisionTaker) !== -1) {
1452                                    isValidRslt = alternate(pos, c, strict, fromSetValid, decisionPos - 1);
1453                                    break;
1454                                }
1455                                getMaskSet().excludes[decisionPos].push(decisionTaker);
1456                                for (i = decisionPos; i < getLastValidPosition(undefined, true) + 1; i++) {
1457                                    delete getMaskSet().validPositions[i];
1458                                }
1459                            } else {
1460                                isValidRslt = alternate(pos, c, strict, fromSetValid, decisionPos - 1);
1461                                break;
1462                            }
1463                        } else break;
1464                    }
1465                }
1466                getMaskSet().excludes[decisionPos] = undefined;
1467                return isValidRslt;
1468            }
1469            function isValid(pos, c, strict, fromSetValid, fromAlternate, validateOnly) {
1470                function isSelection(posObj) {
1471                    return isRTL ? posObj.begin - posObj.end > 1 || posObj.begin - posObj.end === 1 : posObj.end - posObj.begin > 1 || posObj.end - posObj.begin === 1;
1472                }
1473                strict = strict === true;
1474                var maskPos = pos;
1475                if (pos.begin !== undefined) {
1476                    maskPos = isRTL ? pos.end : pos.begin;
1477                }
1478                function _isValid(position, c, strict) {
1479                    var rslt = false;
1480                    $.each(getTests(position), function(ndx, tst) {
1481                        var test = tst.match;
1482                        getBuffer(true);
1483                        rslt = test.fn != null ? test.fn.test(c, getMaskSet(), position, strict, opts, isSelection(pos)) : (c === test.def || c === opts.skipOptionalPartCharacter) && test.def !== "" ? {
1484                            c: getPlaceholder(position, test, true) || test.def,
1485                            pos: position
1486                        } : false;
1487                        if (rslt !== false) {
1488                            var elem = rslt.c !== undefined ? rslt.c : c, validatedPos = position;
1489                            elem = elem === opts.skipOptionalPartCharacter && test.fn === null ? getPlaceholder(position, test, true) || test.def : elem;
1490                            if (rslt.remove !== undefined) {
1491                                if (!$.isArray(rslt.remove)) rslt.remove = [ rslt.remove ];
1492                                $.each(rslt.remove.sort(function(a, b) {
1493                                    return b - a;
1494                                }), function(ndx, lmnt) {
1495                                    revalidateMask({
1496                                        begin: lmnt,
1497                                        end: lmnt + 1
1498                                    });
1499                                });
1500                            }
1501                            if (rslt.insert !== undefined) {
1502                                if (!$.isArray(rslt.insert)) rslt.insert = [ rslt.insert ];
1503                                $.each(rslt.insert.sort(function(a, b) {
1504                                    return a - b;
1505                                }), function(ndx, lmnt) {
1506                                    isValid(lmnt.pos, lmnt.c, true, fromSetValid);
1507                                });
1508                            }
1509                            if (rslt !== true && rslt.pos !== undefined && rslt.pos !== position) {
1510                                validatedPos = rslt.pos;
1511                            }
1512                            if (rslt !== true && rslt.pos === undefined && rslt.c === undefined) {
1513                                return false;
1514                            }
1515                            if (!revalidateMask(pos, $.extend({}, tst, {
1516                                input: casing(elem, test, validatedPos)
1517                            }), fromSetValid, validatedPos)) {
1518                                rslt = false;
1519                            }
1520                            return false;
1521                        }
1522                    });
1523                    return rslt;
1524                }
1525                var result = true, positionsClone = $.extend(true, {}, getMaskSet().validPositions);
1526                if ($.isFunction(opts.preValidation) && !strict && fromSetValid !== true && validateOnly !== true) {
1527                    result = opts.preValidation(getBuffer(), maskPos, c, isSelection(pos), opts, getMaskSet());
1528                }
1529                if (result === true) {
1530                    trackbackPositions(undefined, maskPos, true);
1531                    if (maxLength === undefined || maskPos < maxLength) {
1532                        result = _isValid(maskPos, c, strict);
1533                        if ((!strict || fromSetValid === true) && result === false && validateOnly !== true) {
1534                            var currentPosValid = getMaskSet().validPositions[maskPos];
1535                            if (currentPosValid && currentPosValid.match.fn === null && (currentPosValid.match.def === c || c === opts.skipOptionalPartCharacter)) {
1536                                result = {
1537                                    caret: seekNext(maskPos)
1538                                };
1539                            } else {
1540                                if ((opts.insertMode || getMaskSet().validPositions[seekNext(maskPos)] === undefined) && (!isMask(maskPos, true) || getMaskSet().jitOffset[maskPos])) {
1541                                    if (getMaskSet().jitOffset[maskPos] && getMaskSet().validPositions[seekNext(maskPos)] === undefined) {
1542                                        result = isValid(maskPos + getMaskSet().jitOffset[maskPos], c, strict);
1543                                        if (result !== false) result.caret = maskPos;
1544                                    } else for (var nPos = maskPos + 1, snPos = seekNext(maskPos); nPos <= snPos; nPos++) {
1545                                        result = _isValid(nPos, c, strict);
1546                                        if (result !== false) {
1547                                            result = trackbackPositions(maskPos, result.pos !== undefined ? result.pos : nPos) || result;
1548                                            maskPos = nPos;
1549                                            break;
1550                                        }
1551                                    }
1552                                }
1553                            }
1554                        }
1555                    }
1556                    if (result === false && opts.keepStatic !== false && (opts.regex == null || isComplete(getBuffer())) && !strict && fromAlternate !== true) {
1557                        result = alternate(maskPos, c, strict, fromSetValid);
1558                    }
1559                    if (result === true) {
1560                        result = {
1561                            pos: maskPos
1562                        };
1563                    }
1564                }
1565                if ($.isFunction(opts.postValidation) && result !== false && !strict && fromSetValid !== true && validateOnly !== true) {
1566                    var postResult = opts.postValidation(getBuffer(true), pos.begin !== undefined ? isRTL ? pos.end : pos.begin : pos, result, opts);
1567                    if (postResult !== undefined) {
1568                        if (postResult.refreshFromBuffer && postResult.buffer) {
1569                            var refresh = postResult.refreshFromBuffer;
1570                            refreshFromBuffer(refresh === true ? refresh : refresh.start, refresh.end, postResult.buffer);
1571                        }
1572                        result = postResult === true ? result : postResult;
1573                    }
1574                }
1575                if (result && result.pos === undefined) {
1576                    result.pos = maskPos;
1577                }
1578                if (result === false || validateOnly === true) {
1579                    resetMaskSet(true);
1580                    getMaskSet().validPositions = $.extend(true, {}, positionsClone);
1581                }
1582                return result;
1583            }
1584            function trackbackPositions(originalPos, newPos, fillOnly) {
1585                var result;
1586                if (originalPos === undefined) {
1587                    for (originalPos = newPos - 1; originalPos > 0; originalPos--) {
1588                        if (getMaskSet().validPositions[originalPos]) break;
1589                    }
1590                }
1591                for (var ps = originalPos; ps < newPos; ps++) {
1592                    if (getMaskSet().validPositions[ps] === undefined && !isMask(ps, true)) {
1593                        var vp = ps == 0 ? getTest(ps) : getMaskSet().validPositions[ps - 1];
1594                        if (vp) {
1595                            var tests = getTests(ps).slice();
1596                            if (tests[tests.length - 1].match.def === "") tests.pop();
1597                            var bestMatch = determineTestTemplate(ps, tests);
1598                            bestMatch = $.extend({}, bestMatch, {
1599                                input: getPlaceholder(ps, bestMatch.match, true) || bestMatch.match.def
1600                            });
1601                            bestMatch.generatedInput = true;
1602                            revalidateMask(ps, bestMatch, true);
1603                            if (fillOnly !== true) {
1604                                var cvpInput = getMaskSet().validPositions[newPos].input;
1605                                getMaskSet().validPositions[newPos] = undefined;
1606                                result = isValid(newPos, cvpInput, true, true);
1607                            }
1608                        }
1609                    }
1610                }
1611                return result;
1612            }
1613            function revalidateMask(pos, validTest, fromSetValid, validatedPos) {
1614                function IsEnclosedStatic(pos, valids, selection) {
1615                    var posMatch = valids[pos];
1616                    if (posMatch !== undefined && (posMatch.match.fn === null && posMatch.match.optionality !== true || posMatch.input === opts.radixPoint)) {
1617                        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];
1618                        return prevMatch && nextMatch;
1619                    }
1620                    return false;
1621                }
1622                var begin = pos.begin !== undefined ? pos.begin : pos, end = pos.end !== undefined ? pos.end : pos;
1623                if (pos.begin > pos.end) {
1624                    begin = pos.end;
1625                    end = pos.begin;
1626                }
1627                validatedPos = validatedPos !== undefined ? validatedPos : begin;
1628                if (begin !== end || opts.insertMode && getMaskSet().validPositions[validatedPos] !== undefined && fromSetValid === undefined) {
1629                    var positionsClone = $.extend(true, {}, getMaskSet().validPositions), lvp = getLastValidPosition(undefined, true), i;
1630                    getMaskSet().p = begin;
1631                    for (i = lvp; i >= begin; i--) {
1632                        if (getMaskSet().validPositions[i] && getMaskSet().validPositions[i].match.nativeDef === "+") {
1633                            opts.isNegative = false;
1634                        }
1635                        delete getMaskSet().validPositions[i];
1636                    }
1637                    var valid = true, j = validatedPos, vps = getMaskSet().validPositions, needsValidation = false, posMatch = j, i = j;
1638                    if (validTest) {
1639                        getMaskSet().validPositions[validatedPos] = $.extend(true, {}, validTest);
1640                        posMatch++;
1641                        j++;
1642                        if (begin < end) i++;
1643                    }
1644                    for (;i <= lvp; i++) {
1645                        var t = positionsClone[i];
1646                        if (t !== undefined && (i >= end || i >= begin && t.generatedInput !== true && IsEnclosedStatic(i, positionsClone, {
1647                            begin: begin,
1648                            end: end
1649                        }))) {
1650                            while (getTest(posMatch).match.def !== "") {
1651                                if (needsValidation === false && positionsClone[posMatch] && positionsClone[posMatch].match.nativeDef === t.match.nativeDef) {
1652                                    getMaskSet().validPositions[posMatch] = $.extend(true, {}, positionsClone[posMatch]);
1653                                    getMaskSet().validPositions[posMatch].input = t.input;
1654                                    trackbackPositions(undefined, posMatch, true);
1655                                    j = posMatch + 1;
1656                                    valid = true;
1657                                } else if (opts.shiftPositions && positionCanMatchDefinition(posMatch, t.match.def)) {
1658                                    var result = isValid(posMatch, t.input, true, true);
1659                                    valid = result !== false;
1660                                    j = result.caret || result.insert ? getLastValidPosition() : posMatch + 1;
1661                                    needsValidation = true;
1662                                } else {
1663                                    valid = t.generatedInput === true || t.input === opts.radixPoint && opts.numericInput === true;
1664                                }
1665                                if (valid) break;
1666                                if (!valid && posMatch > end && isMask(posMatch, true) && (t.match.fn !== null || posMatch > getMaskSet().maskLength)) {
1667                                    break;
1668                                }
1669                                posMatch++;
1670                            }
1671                            if (getTest(posMatch).match.def == "") valid = false;
1672                            posMatch = j;
1673                        }
1674                        if (!valid) break;
1675                    }
1676                    if (!valid) {
1677                        getMaskSet().validPositions = $.extend(true, {}, positionsClone);
1678                        resetMaskSet(true);
1679                        return false;
1680                    }
1681                } else if (validTest) {
1682                    getMaskSet().validPositions[validatedPos] = $.extend(true, {}, validTest);
1683                }
1684                resetMaskSet(true);
1685                return true;
1686            }
1687            function isMask(pos, strict) {
1688                var test = getTestTemplate(pos).match;
1689                if (test.def === "") test = getTest(pos).match;
1690                if (test.fn != null) {
1691                    return test.fn;
1692                }
1693                if (strict !== true && pos > -1) {
1694                    var tests = getTests(pos);
1695                    return tests.length > 1 + (tests[tests.length - 1].match.def === "" ? 1 : 0);
1696                }
1697                return false;
1698            }
1699            function seekNext(pos, newBlock) {
1700                var position = pos + 1;
1701                while (getTest(position).match.def !== "" && (newBlock === true && (getTest(position).match.newBlockMarker !== true || !isMask(position)) || newBlock !== true && !isMask(position))) {
1702                    position++;
1703                }
1704                return position;
1705            }
1706            function seekPrevious(pos, newBlock) {
1707                var position = pos, tests;
1708                if (position <= 0) return 0;
1709                while (--position > 0 && (newBlock === true && getTest(position).match.newBlockMarker !== true || newBlock !== true && !isMask(position) && (tests = getTests(position), 
1710                tests.length < 2 || tests.length === 2 && tests[1].match.def === ""))) {}
1711                return position;
1712            }
1713            function writeBuffer(input, buffer, caretPos, event, triggerEvents) {
1714                if (event && $.isFunction(opts.onBeforeWrite)) {
1715                    var result = opts.onBeforeWrite.call(inputmask, event, buffer, caretPos, opts);
1716                    if (result) {
1717                        if (result.refreshFromBuffer) {
1718                            var refresh = result.refreshFromBuffer;
1719                            refreshFromBuffer(refresh === true ? refresh : refresh.start, refresh.end, result.buffer || buffer);
1720                            buffer = getBuffer(true);
1721                        }
1722                        if (caretPos !== undefined) caretPos = result.caret !== undefined ? result.caret : caretPos;
1723                    }
1724                }
1725                if (input !== undefined) {
1726                    input.inputmask._valueSet(buffer.join(""));
1727                    if (caretPos !== undefined && (event === undefined || event.type !== "blur")) {
1728                        caret(input, caretPos);
1729                    } else renderColorMask(input, caretPos, buffer.length === 0);
1730                    if (triggerEvents === true) {
1731                        var $input = $(input), nptVal = input.inputmask._valueGet();
1732                        skipInputEvent = true;
1733                        $input.trigger("input");
1734                        setTimeout(function() {
1735                            if (nptVal === getBufferTemplate().join("")) {
1736                                $input.trigger("cleared");
1737                            } else if (isComplete(buffer) === true) {
1738                                $input.trigger("complete");
1739                            }
1740                        }, 0);
1741                    }
1742                }
1743            }
1744            function getPlaceholder(pos, test, returnPL) {
1745                test = test || getTest(pos).match;
1746                if (test.placeholder !== undefined || returnPL === true) {
1747                    return $.isFunction(test.placeholder) ? test.placeholder(opts) : test.placeholder;
1748                } else if (test.fn === null) {
1749                    if (pos > -1 && getMaskSet().validPositions[pos] === undefined) {
1750                        var tests = getTests(pos), staticAlternations = [], prevTest;
1751                        if (tests.length > 1 + (tests[tests.length - 1].match.def === "" ? 1 : 0)) {
1752                            for (var i = 0; i < tests.length; i++) {
1753                                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)) {
1754                                    staticAlternations.push(tests[i]);
1755                                    if (tests[i].match.fn === null) prevTest = tests[i];
1756                                    if (staticAlternations.length > 1) {
1757                                        if (/[0-9a-bA-Z]/.test(staticAlternations[0].match.def)) {
1758                                            return opts.placeholder.charAt(pos % opts.placeholder.length);
1759                                        }
1760                                    }
1761                                }
1762                            }
1763                        }
1764                    }
1765                    return test.def;
1766                }
1767                return opts.placeholder.charAt(pos % opts.placeholder.length);
1768            }
1769            function HandleNativePlaceholder(npt, value) {
1770                if (ie) {
1771                    if (npt.inputmask._valueGet() !== value && (npt.placeholder !== value || npt.placeholder === "")) {
1772                        var buffer = getBuffer().slice(), nptValue = npt.inputmask._valueGet();
1773                        if (nptValue !== value) {
1774                            var lvp = getLastValidPosition();
1775                            if (lvp === -1 && nptValue === getBufferTemplate().join("")) {
1776                                buffer = [];
1777                            } else if (lvp !== -1) {
1778                                clearOptionalTail(buffer);
1779                            }
1780                            writeBuffer(npt, buffer);
1781                        }
1782                    }
1783                } else if (npt.placeholder !== value) {
1784                    npt.placeholder = value;
1785                    if (npt.placeholder === "") npt.removeAttribute("placeholder");
1786                }
1787            }
1788            var EventRuler = {
1789                on: function on(input, eventName, eventHandler) {
1790                    var ev = function ev(e) {
1791                        var that = this;
1792                        if (that.inputmask === undefined && this.nodeName !== "FORM") {
1793                            var imOpts = $.data(that, "_inputmask_opts");
1794                            if (imOpts) new Inputmask(imOpts).mask(that); else EventRuler.off(that);
1795                        } 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))) {
1796                            e.preventDefault();
1797                        } else {
1798                            switch (e.type) {
1799                              case "input":
1800                                if (skipInputEvent === true) {
1801                                    skipInputEvent = false;
1802                                    return e.preventDefault();
1803                                }
1804                                if (mobile) {
1805                                    var args = arguments;
1806                                    setTimeout(function() {
1807                                        eventHandler.apply(that, args);
1808                                        caret(that, that.inputmask.caretPos, undefined, true);
1809                                    }, 0);
1810                                    return false;
1811                                }
1812                                break;
1813
1814                              case "keydown":
1815                                skipKeyPressEvent = false;
1816                                skipInputEvent = false;
1817                                break;
1818
1819                              case "keypress":
1820                                if (skipKeyPressEvent === true) {
1821                                    return e.preventDefault();
1822                                }
1823                                skipKeyPressEvent = true;
1824                                break;
1825
1826                              case "click":
1827                                if (iemobile || iphone) {
1828                                    var args = arguments;
1829                                    setTimeout(function() {
1830                                        eventHandler.apply(that, args);
1831                                    }, 0);
1832                                    return false;
1833                                }
1834                                break;
1835                            }
1836                            var returnVal = eventHandler.apply(that, arguments);
1837                            if (returnVal === false) {
1838                                e.preventDefault();
1839                                e.stopPropagation();
1840                            }
1841                            return returnVal;
1842                        }
1843                    };
1844                    input.inputmask.events[eventName] = input.inputmask.events[eventName] || [];
1845                    input.inputmask.events[eventName].push(ev);
1846                    if ($.inArray(eventName, [ "submit", "reset" ]) !== -1) {
1847                        if (input.form !== null) $(input.form).on(eventName, ev);
1848                    } else {
1849                        $(input).on(eventName, ev);
1850                    }
1851                },
1852                off: function off(input, event) {
1853                    if (input.inputmask && input.inputmask.events) {
1854                        var events;
1855                        if (event) {
1856                            events = [];
1857                            events[event] = input.inputmask.events[event];
1858                        } else {
1859                            events = input.inputmask.events;
1860                        }
1861                        $.each(events, function(eventName, evArr) {
1862                            while (evArr.length > 0) {
1863                                var ev = evArr.pop();
1864                                if ($.inArray(eventName, [ "submit", "reset" ]) !== -1) {
1865                                    if (input.form !== null) $(input.form).off(eventName, ev);
1866                                } else {
1867                                    $(input).off(eventName, ev);
1868                                }
1869                            }
1870                            delete input.inputmask.events[eventName];
1871                        });
1872                    }
1873                }
1874            };
1875            var EventHandlers = {
1876                keydownEvent: function keydownEvent(e) {
1877                    var input = this, $input = $(input), k = e.keyCode, pos = caret(input);
1878                    if (k === Inputmask.keyCode.BACKSPACE || k === Inputmask.keyCode.DELETE || iphone && k === Inputmask.keyCode.BACKSPACE_SAFARI || e.ctrlKey && k === Inputmask.keyCode.X && !isInputEventSupported("cut")) {
1879                        e.preventDefault();
1880                        handleRemove(input, k, pos);
1881                        writeBuffer(input, getBuffer(true), getMaskSet().p, e, input.inputmask._valueGet() !== getBuffer().join(""));
1882                    } else if (k === Inputmask.keyCode.END || k === Inputmask.keyCode.PAGE_DOWN) {
1883                        e.preventDefault();
1884                        var caretPos = seekNext(getLastValidPosition());
1885                        caret(input, e.shiftKey ? pos.begin : caretPos, caretPos, true);
1886                    } else if (k === Inputmask.keyCode.HOME && !e.shiftKey || k === Inputmask.keyCode.PAGE_UP) {
1887                        e.preventDefault();
1888                        caret(input, 0, e.shiftKey ? pos.begin : 0, true);
1889                    } else if ((opts.undoOnEscape && k === Inputmask.keyCode.ESCAPE || k === 90 && e.ctrlKey) && e.altKey !== true) {
1890                        checkVal(input, true, false, undoValue.split(""));
1891                        $input.trigger("click");
1892                    } else if (k === Inputmask.keyCode.INSERT && !(e.shiftKey || e.ctrlKey)) {
1893                        opts.insertMode = !opts.insertMode;
1894                        input.setAttribute("im-insert", opts.insertMode);
1895                    } else if (opts.tabThrough === true && k === Inputmask.keyCode.TAB) {
1896                        if (e.shiftKey === true) {
1897                            if (getTest(pos.begin).match.fn === null) {
1898                                pos.begin = seekNext(pos.begin);
1899                            }
1900                            pos.end = seekPrevious(pos.begin, true);
1901                            pos.begin = seekPrevious(pos.end, true);
1902                        } else {
1903                            pos.begin = seekNext(pos.begin, true);
1904                            pos.end = seekNext(pos.begin, true);
1905                            if (pos.end < getMaskSet().maskLength) pos.end--;
1906                        }
1907                        if (pos.begin < getMaskSet().maskLength) {
1908                            e.preventDefault();
1909                            caret(input, pos.begin, pos.end);
1910                        }
1911                    }
1912                    opts.onKeyDown.call(this, e, getBuffer(), caret(input).begin, opts);
1913                    ignorable = $.inArray(k, opts.ignorables) !== -1;
1914                },
1915                keypressEvent: function keypressEvent(e, checkval, writeOut, strict, ndx) {
1916                    var input = this, $input = $(input), k = e.which || e.charCode || e.keyCode;
1917                    if (checkval !== true && !(e.ctrlKey && e.altKey) && (e.ctrlKey || e.metaKey || ignorable)) {
1918                        if (k === Inputmask.keyCode.ENTER && undoValue !== getBuffer().join("")) {
1919                            undoValue = getBuffer().join("");
1920                            setTimeout(function() {
1921                                $input.trigger("change");
1922                            }, 0);
1923                        }
1924                        return true;
1925                    } else {
1926                        if (k) {
1927                            if (k === 46 && e.shiftKey === false && opts.radixPoint !== "") k = opts.radixPoint.charCodeAt(0);
1928                            var pos = checkval ? {
1929                                begin: ndx,
1930                                end: ndx
1931                            } : caret(input), forwardPosition, c = String.fromCharCode(k), offset = 0;
1932                            if (opts._radixDance && opts.numericInput) {
1933                                var caretPos = getBuffer().indexOf(opts.radixPoint.charAt(0)) + 1;
1934                                if (pos.begin <= caretPos) {
1935                                    if (k === opts.radixPoint.charCodeAt(0)) offset = 1;
1936                                    pos.begin -= 1;
1937                                    pos.end -= 1;
1938                                }
1939                            }
1940                            getMaskSet().writeOutBuffer = true;
1941                            var valResult = isValid(pos, c, strict);
1942                            if (valResult !== false) {
1943                                resetMaskSet(true);
1944                                forwardPosition = valResult.caret !== undefined ? valResult.caret : seekNext(valResult.pos.begin ? valResult.pos.begin : valResult.pos);
1945                                getMaskSet().p = forwardPosition;
1946                            }
1947                            forwardPosition = (opts.numericInput && valResult.caret === undefined ? seekPrevious(forwardPosition) : forwardPosition) + offset;
1948                            if (writeOut !== false) {
1949                                setTimeout(function() {
1950                                    opts.onKeyValidation.call(input, k, valResult, opts);
1951                                }, 0);
1952                                if (getMaskSet().writeOutBuffer && valResult !== false) {
1953                                    var buffer = getBuffer();
1954                                    writeBuffer(input, buffer, forwardPosition, e, checkval !== true);
1955                                }
1956                            }
1957                            e.preventDefault();
1958                            if (checkval) {
1959                                if (valResult !== false) valResult.forwardPosition = forwardPosition;
1960                                return valResult;
1961                            }
1962                        }
1963                    }
1964                },
1965                pasteEvent: function pasteEvent(e) {
1966                    var input = this, ev = e.originalEvent || e, $input = $(input), inputValue = input.inputmask._valueGet(true), caretPos = caret(input), tempValue;
1967                    if (isRTL) {
1968                        tempValue = caretPos.end;
1969                        caretPos.end = caretPos.begin;
1970                        caretPos.begin = tempValue;
1971                    }
1972                    var valueBeforeCaret = inputValue.substr(0, caretPos.begin), valueAfterCaret = inputValue.substr(caretPos.end, inputValue.length);
1973                    if (valueBeforeCaret === (isRTL ? getBufferTemplate().reverse() : getBufferTemplate()).slice(0, caretPos.begin).join("")) valueBeforeCaret = "";
1974                    if (valueAfterCaret === (isRTL ? getBufferTemplate().reverse() : getBufferTemplate()).slice(caretPos.end).join("")) valueAfterCaret = "";
1975                    if (window.clipboardData && window.clipboardData.getData) {
1976                        inputValue = valueBeforeCaret + window.clipboardData.getData("Text") + valueAfterCaret;
1977                    } else if (ev.clipboardData && ev.clipboardData.getData) {
1978                        inputValue = valueBeforeCaret + ev.clipboardData.getData("text/plain") + valueAfterCaret;
1979                    } else return true;
1980                    var pasteValue = inputValue;
1981                    if ($.isFunction(opts.onBeforePaste)) {
1982                        pasteValue = opts.onBeforePaste.call(inputmask, inputValue, opts);
1983                        if (pasteValue === false) {
1984                            return e.preventDefault();
1985                        }
1986                        if (!pasteValue) {
1987                            pasteValue = inputValue;
1988                        }
1989                    }
1990                    checkVal(input, false, false, pasteValue.toString().split(""));
1991                    writeBuffer(input, getBuffer(), seekNext(getLastValidPosition()), e, undoValue !== getBuffer().join(""));
1992                    return e.preventDefault();
1993                },
1994                inputFallBackEvent: function inputFallBackEvent(e) {
1995                    function radixPointHandler(input, inputValue, caretPos) {
1996                        if (inputValue.charAt(caretPos.begin - 1) === "." && opts.radixPoint !== "") {
1997                            inputValue = inputValue.split("");
1998                            inputValue[caretPos.begin - 1] = opts.radixPoint.charAt(0);
1999                            inputValue = inputValue.join("");
2000                        }
2001                        return inputValue;
2002                    }
2003                    function ieMobileHandler(input, inputValue, caretPos) {
2004                        if (iemobile) {
2005                            var inputChar = inputValue.replace(getBuffer().join(""), "");
2006                            if (inputChar.length === 1) {
2007                                var iv = inputValue.split("");
2008                                iv.splice(caretPos.begin, 0, inputChar);
2009                                inputValue = iv.join("");
2010                            }
2011                        }
2012                        return inputValue;
2013                    }
2014                    var input = this, inputValue = input.inputmask._valueGet();
2015                    if (getBuffer().join("") !== inputValue) {
2016                        var caretPos = caret(input);
2017                        inputValue = radixPointHandler(input, inputValue, caretPos);
2018                        inputValue = ieMobileHandler(input, inputValue, caretPos);
2019                        if (getBuffer().join("") !== inputValue) {
2020                            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);
2021                            var selection = caretPos, entries = "", isEntry = false;
2022                            if (frontPart !== frontBufferPart) {
2023                                var fpl = (isEntry = frontPart.length >= frontBufferPart.length) ? frontPart.length : frontBufferPart.length, i;
2024                                for (i = 0; frontPart.charAt(i) === frontBufferPart.charAt(i) && i < fpl; i++) {}
2025                                if (isEntry) {
2026                                    selection.begin = i - offset;
2027                                    entries += frontPart.slice(i, selection.end);
2028                                }
2029                            }
2030                            if (backPart !== backBufferPart) {
2031                                if (backPart.length > backBufferPart.length) {
2032                                    entries += backPart.slice(0, 1);
2033                                } else {
2034                                    if (backPart.length < backBufferPart.length) {
2035                                        selection.end += backBufferPart.length - backPart.length;
2036                                        if (!isEntry && opts.radixPoint !== "" && backPart === "" && frontPart.charAt(selection.begin + offset - 1) === opts.radixPoint) {
2037                                            selection.begin--;
2038                                            entries = opts.radixPoint;
2039                                        }
2040                                    }
2041                                }
2042                            }
2043                            writeBuffer(input, getBuffer(), {
2044                                begin: selection.begin + offset,
2045                                end: selection.end + offset
2046                            });
2047                            if (entries.length > 0) {
2048                                $.each(entries.split(""), function(ndx, entry) {
2049                                    var keypress = new $.Event("keypress");
2050                                    keypress.which = entry.charCodeAt(0);
2051                                    ignorable = false;
2052                                    EventHandlers.keypressEvent.call(input, keypress);
2053                                });
2054                            } else {
2055                                if (selection.begin === selection.end - 1) {
2056                                    selection.begin = seekPrevious(selection.begin + 1);
2057                                    if (selection.begin === selection.end - 1) {
2058                                        caret(input, selection.begin);
2059                                    } else {
2060                                        caret(input, selection.begin, selection.end);
2061                                    }
2062                                }
2063                                var keydown = new $.Event("keydown");
2064                                keydown.keyCode = opts.numericInput ? Inputmask.keyCode.BACKSPACE : Inputmask.keyCode.DELETE;
2065                                EventHandlers.keydownEvent.call(input, keydown);
2066                            }
2067                            e.preventDefault();
2068                        }
2069                    }
2070                },
2071                beforeInputEvent: function beforeInputEvent(e) {
2072                    if (e.cancelable) {
2073                        var input = this;
2074                        switch (e.inputType) {
2075                          case "insertText":
2076                            $.each(e.data.split(""), function(ndx, entry) {
2077                                var keypress = new $.Event("keypress");
2078                                keypress.which = entry.charCodeAt(0);
2079                                ignorable = false;
2080                                EventHandlers.keypressEvent.call(input, keypress);
2081                            });
2082                            return e.preventDefault();
2083
2084                          case "deleteContentBackward":
2085                            var keydown = new $.Event("keydown");
2086                            keydown.keyCode = Inputmask.keyCode.BACKSPACE;
2087                            EventHandlers.keydownEvent.call(input, keydown);
2088                            return e.preventDefault();
2089
2090                          case "deleteContentForward":
2091                            var keydown = new $.Event("keydown");
2092                            keydown.keyCode = Inputmask.keyCode.DELETE;
2093                            EventHandlers.keydownEvent.call(input, keydown);
2094                            return e.preventDefault();
2095                        }
2096                    }
2097                },
2098                setValueEvent: function setValueEvent(e) {
2099                    this.inputmask.refreshValue = false;
2100                    var input = this, value = e && e.detail ? e.detail[0] : arguments[1], value = value || input.inputmask._valueGet(true);
2101                    if ($.isFunction(opts.onBeforeMask)) value = opts.onBeforeMask.call(inputmask, value, opts) || value;
2102                    value = value.split("");
2103                    checkVal(input, true, false, value);
2104                    undoValue = getBuffer().join("");
2105                    if ((opts.clearMaskOnLostFocus || opts.clearIncomplete) && input.inputmask._valueGet() === getBufferTemplate().join("")) {
2106                        input.inputmask._valueSet("");
2107                    }
2108                },
2109                focusEvent: function focusEvent(e) {
2110                    var input = this, nptValue = input.inputmask._valueGet();
2111                    if (opts.showMaskOnFocus) {
2112                        if (nptValue !== getBuffer().join("")) {
2113                            writeBuffer(input, getBuffer(), seekNext(getLastValidPosition()));
2114                        } else if (mouseEnter === false) {
2115                            caret(input, seekNext(getLastValidPosition()));
2116                        }
2117                    }
2118                    if (opts.positionCaretOnTab === true && mouseEnter === false) {
2119                        EventHandlers.clickEvent.apply(input, [ e, true ]);
2120                    }
2121                    undoValue = getBuffer().join("");
2122                },
2123                mouseleaveEvent: function mouseleaveEvent(e) {
2124                    var input = this;
2125                    mouseEnter = false;
2126                    if (opts.clearMaskOnLostFocus && document.activeElement !== input) {
2127                        HandleNativePlaceholder(input, originalPlaceholder);
2128                    }
2129                },
2130                clickEvent: function clickEvent(e, tabbed) {
2131                    function doRadixFocus(clickPos) {
2132                        if (opts.radixPoint !== "") {
2133                            var vps = getMaskSet().validPositions;
2134                            if (vps[clickPos] === undefined || vps[clickPos].input === getPlaceholder(clickPos)) {
2135                                if (clickPos < seekNext(-1)) return true;
2136                                var radixPos = $.inArray(opts.radixPoint, getBuffer());
2137                                if (radixPos !== -1) {
2138                                    for (var vp in vps) {
2139                                        if (radixPos < vp && vps[vp].input !== getPlaceholder(vp)) {
2140                                            return false;
2141                                        }
2142                                    }
2143                                    return true;
2144                                }
2145                            }
2146                        }
2147                        return false;
2148                    }
2149                    var input = this;
2150                    setTimeout(function() {
2151                        if (document.activeElement === input) {
2152                            var selectedCaret = caret(input);
2153                            if (tabbed) {
2154                                if (isRTL) {
2155                                    selectedCaret.end = selectedCaret.begin;
2156                                } else {
2157                                    selectedCaret.begin = selectedCaret.end;
2158                                }
2159                            }
2160                            if (selectedCaret.begin === selectedCaret.end) {
2161                                switch (opts.positionCaretOnClick) {
2162                                  case "none":
2163                                    break;
2164
2165                                  case "select":
2166                                    caret(input, 0, getBuffer().length);
2167                                    break;
2168
2169                                  case "ignore":
2170                                    caret(input, seekNext(getLastValidPosition()));
2171                                    break;
2172
2173                                  case "radixFocus":
2174                                    if (doRadixFocus(selectedCaret.begin)) {
2175                                        var radixPos = getBuffer().join("").indexOf(opts.radixPoint);
2176                                        caret(input, opts.numericInput ? seekNext(radixPos) : radixPos);
2177                                        break;
2178                                    }
2179
2180                                  default:
2181                                    var clickPosition = selectedCaret.begin, lvclickPosition = getLastValidPosition(clickPosition, true), lastPosition = seekNext(lvclickPosition);
2182                                    if (clickPosition < lastPosition) {
2183                                        caret(input, !isMask(clickPosition, true) && !isMask(clickPosition - 1, true) ? seekNext(clickPosition) : clickPosition);
2184                                    } else {
2185                                        var lvp = getMaskSet().validPositions[lvclickPosition], tt = getTestTemplate(lastPosition, lvp ? lvp.match.locator : undefined, lvp), placeholder = getPlaceholder(lastPosition, tt.match);
2186                                        if (placeholder !== "" && getBuffer()[lastPosition] !== placeholder && tt.match.optionalQuantifier !== true && tt.match.newBlockMarker !== true || !isMask(lastPosition, opts.keepStatic) && tt.match.def === placeholder) {
2187                                            var newPos = seekNext(lastPosition);
2188                                            if (clickPosition >= newPos || clickPosition === lastPosition) {
2189                                                lastPosition = newPos;
2190                                            }
2191                                        }
2192                                        caret(input, lastPosition);
2193                                    }
2194                                    break;
2195                                }
2196                            }
2197                        }
2198                    }, 0);
2199                },
2200                cutEvent: function cutEvent(e) {
2201                    var input = this, $input = $(input), pos = caret(input), ev = e.originalEvent || e;
2202                    var clipboardData = window.clipboardData || ev.clipboardData, clipData = isRTL ? getBuffer().slice(pos.end, pos.begin) : getBuffer().slice(pos.begin, pos.end);
2203                    clipboardData.setData("text", isRTL ? clipData.reverse().join("") : clip
2203Data.join(""));
2204                    if (document.execCommand) document.execCommand("copy");
2205                    handleRemove(input, Inputmask.keyCode.DELETE, pos);
2206                    writeBuffer(input, getBuffer(), getMaskSet().p, e, undoValue !== getBuffer().join(""));
2207                },
2208                blurEvent: function blurEvent(e) {
2209                    var $input = $(this), input = this;
2210                    if (input.inputmask) {
2211                        HandleNativePlaceholder(input, originalPlaceholder);
2212                        var nptValue = input.inputmask._valueGet(), buffer = getBuffer().slice();
2213                        if (nptValue !== "" || colorMask !== undefined) {
2214                            if (opts.clearMaskOnLostFocus) {
2215                                if (getLastValidPosition() === -1 && nptValue === getBufferTemplate().join("")) {
2216                                    buffer = [];
2217                                } else {
2218                                    clearOptionalTail(buffer);
2219                                }
2220                            }
2221                            if (isComplete(buffer) === false) {
2222                                setTimeout(function() {
2223                                    $input.trigger("incomplete");
2224                                }, 0);
2225                                if (opts.clearIncomplete) {
2226                                    resetMaskSet();
2227                                    if (opts.clearMaskOnLostFocus) {
2228                                        buffer = [];
2229                                    } else {
2230                                        buffer = getBufferTemplate().slice();
2231                                    }
2232                                }
2233                            }
2234                            writeBuffer(input, buffer, undefined, e);
2235                        }
2236                        if (undoValue !== getBuffer().join("")) {
2237                            undoValue = buffer.join("");
2238                            $input.trigger("change");
2239                        }
2240                    }
2241                },
2242                mouseenterEvent: function mouseenterEvent(e) {
2243                    var input = this;
2244                    mouseEnter = true;
2245                    if (document.activeElement !== input && opts.showMaskOnHover) {
2246                        HandleNativePlaceholder(input, (isRTL ? getBuffer().slice().reverse() : getBuffer()).join(""));
2247                    }
2248                },
2249                submitEvent: function submitEvent(e) {
2250                    if (undoValue !== getBuffer().join("")) {
2251                        $el.trigger("change");
2252                    }
2253                    if (opts.clearMaskOnLostFocus && getLastValidPosition() === -1 && el.inputmask._valueGet && el.inputmask._valueGet() === getBufferTemplate().join("")) {
2254                        el.inputmask._valueSet("");
2255                    }
2256                    if (opts.clearIncomplete && isComplete(getBuffer()) === false) {
2257                        el.inputmask._valueSet("");
2258                    }
2259                    if (opts.removeMaskOnSubmit) {
2260                        el.inputmask._valueSet(el.inputmask.unmaskedvalue(), true);
2261                        setTimeout(function() {
2262                            writeBuffer(el, getBuffer());
2263                        }, 0);
2264                    }
2265                },
2266                resetEvent: function resetEvent(e) {
2267                    el.inputmask.refreshValue = true;
2268                    setTimeout(function() {
2269                        $el.trigger("setvalue");
2270                    }, 0);
2271                }
2272            };
2273            function checkVal(input, writeOut, strict, nptvl, initiatingEvent) {
2274                var inputmask = this || input.inputmask, inputValue = nptvl.slice(), charCodes = "", initialNdx = -1, result = undefined;
2275                function isTemplateMatch(ndx, charCodes) {
2276                    var charCodeNdx = getMaskTemplate(true, 0, false).slice(ndx, seekNext(ndx)).join("").replace(/'/g, "").indexOf(charCodes);
2277                    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)));
2278                }
2279                resetMaskSet();
2280                if (!strict && opts.autoUnmask !== true) {
2281                    var staticInput = getBufferTemplate().slice(0, seekNext(-1)).join(""), matches = inputValue.join("").match(new RegExp("^" + Inputmask.escapeRegex(staticInput), "g"));
2282                    if (matches && matches.length > 0) {
2283                        inputValue.splice(0, matches.length * staticInput.length);
2284                        initialNdx = seekNext(initialNdx);
2285                    }
2286                } else {
2287                    initialNdx = seekNext(initialNdx);
2288                }
2289                if (initialNdx === -1) {
2290                    getMaskSet().p = seekNext(initialNdx);
2291                    initialNdx = 0;
2292                } else getMaskSet().p = initialNdx;
2293                inputmask.caretPos = {
2294                    begin: initialNdx
2295                };
2296                $.each(inputValue, function(ndx, charCode) {
2297                    if (charCode !== undefined) {
2298                        if (getMaskSet().validPositions[ndx] === undefined && inputValue[ndx] === getPlaceholder(ndx) && isMask(ndx, true) && isValid(ndx, inputValue[ndx], true, undefined, undefined, true) === false) {
2299                            getMaskSet().p++;
2300                        } else {
2301                            var keypress = new $.Event("_checkval");
2302                            keypress.which = charCode.charCodeAt(0);
2303                            charCodes += charCode;
2304                            var lvp = getLastValidPosition(undefined, true);
2305                            if (!isTemplateMatch(initialNdx, charCodes)) {
2306                                result = EventHandlers.keypressEvent.call(input, keypress, true, false, strict, inputmask.caretPos.begin);
2307                                if (result) {
2308                                    initialNdx = inputmask.caretPos.begin + 1;
2309                                    charCodes = "";
2310                                }
2311                            } else {
2312                                result = EventHandlers.keypressEvent.call(input, keypress, true, false, strict, lvp + 1);
2313                            }
2314                            if (result) {
2315                                writeBuffer(undefined, getBuffer(), result.forwardPosition, keypress, false);
2316                                inputmask.caretPos = {
2317                                    begin: result.forwardPosition,
2318                                    end: result.forwardPosition
2319                                };
2320                            }
2321                        }
2322                    }
2323                });
2324                if (writeOut) writeBuffer(input, getBuffer(), result ? result.forwardPosition : undefined, initiatingEvent || new $.Event("checkval"), initiatingEvent && initiatingEvent.type === "input");
2325            }
2326            function unmaskedvalue(input) {
2327                if (input) {
2328                    if (input.inputmask === undefined) {
2329                        return input.value;
2330                    }
2331                    if (input.inputmask && input.inputmask.refreshValue) {
2332                        EventHandlers.setValueEvent.call(input);
2333                    }
2334                }
2335                var umValue = [], vps = getMaskSet().validPositions;
2336                for (var pndx in vps) {
2337                    if (vps[pndx].match && vps[pndx].match.fn != null) {
2338                        umValue.push(vps[pndx].input);
2339                    }
2340                }
2341                var unmaskedValue = umValue.length === 0 ? "" : (isRTL ? umValue.reverse() : umValue).join("");
2342                if ($.isFunction(opts.onUnMask)) {
2343                    var bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join("");
2344                    unmaskedValue = opts.onUnMask.call(inputmask, bufferValue, unmaskedValue, opts);
2345                }
2346                return unmaskedValue;
2347            }
2348            function caret(input, begin, end, notranslate) {
2349                function translatePosition(pos) {
2350                    if (isRTL && typeof pos === "number" && (!opts.greedy || opts.placeholder !== "") && el) {
2351                        pos = el.inputmask._valueGet().length - pos;
2352                    }
2353                    return pos;
2354                }
2355                var range;
2356                if (begin !== undefined) {
2357                    if ($.isArray(begin)) {
2358                        end = isRTL ? begin[0] : begin[1];
2359                        begin = isRTL ? begin[1] : begin[0];
2360                    }
2361                    if (begin.begin !== undefined) {
2362                        end = isRTL ? begin.begin : begin.end;
2363                        begin = isRTL ? begin.end : begin.begin;
2364                    }
2365                    if (typeof begin === "number") {
2366                        begin = notranslate ? begin : translatePosition(begin);
2367                        end = notranslate ? end : translatePosition(end);
2368                        end = typeof end == "number" ? end : begin;
2369                        var scrollCalc = parseInt(((input.ownerDocument.defaultView || window).getComputedStyle ? (input.ownerDocument.defaultView || window).getComputedStyle(input, null) : input.currentStyle).fontSize) * end;
2370                        input.scrollLeft = scrollCalc > input.scrollWidth ? scrollCalc : 0;
2371                        input.inputmask.caretPos = {
2372                            begin: begin,
2373                            end: end
2374                        };
2375                        if (input === document.activeElement) {
2376                            if ("selectionStart" in input) {
2377                                input.selectionStart = begin;
2378                                input.selectionEnd = end;
2379                            } else if (window.getSelection) {
2380                                range = document.createRange();
2381                                if (input.firstChild === undefined || input.firstChild === null) {
2382                                    var textNode = document.createTextNode("");
2383                                    input.appendChild(textNode);
2384                                }
2385                                range.setStart(input.firstChild, begin < input.inputmask._valueGet().length ? begin : input.inputmask._valueGet().length);
2386                                range.setEnd(input.firstChild, end < input.inputmask._valueGet().length ? end : input.inputmask._valueGet().length);
2387                                range.collapse(true);
2388                                var sel = window.getSelection();
2389                                sel.removeAllRanges();
2390                                sel.addRange(range);
2391                            } else if (input.createTextRange) {
2392                                range = input.createTextRange();
2393                                range.collapse(true);
2394                                range.moveEnd("character", end);
2395                                range.moveStart("character", begin);
2396                                range.select();
2397                            }
2398                            renderColorMask(input, {
2399                                begin: begin,
2400                                end: end
2401                            });
2402                        }
2403                    }
2404                } else {
2405                    if ("selectionStart" in input) {
2406                        begin = input.selectionStart;
2407                        end = input.selectionEnd;
2408                    } else if (window.getSelection) {
2409                        range = window.getSelection().getRangeAt(0);
2410                        if (range.commonAncestorContainer.parentNode === input || range.commonAncestorContainer === input) {
2411                            begin = range.startOffset;
2412                            end = range.endOffset;
2413                        }
2414                    } else if (document.selection && document.selection.createRange) {
2415                        range = document.selection.createRange();
2416                        begin = 0 - range.duplicate().moveStart("character", -input.inputmask._valueGet().length);
2417                        end = begin + range.text.length;
2418                    }
2419                    return {
2420                        begin: notranslate ? begin : translatePosition(begin),
2421                        end: notranslate ? end : translatePosition(en
2421d)
2422                    };
2423                }
2424            }
2425            function determineLastRequiredPosition(returnDefinition) {
2426                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;
2427                for (pos = lvp + 1; pos < buffer.length; pos++) {
2428                    testPos = getTestTemplate(pos, ndxIntlzr, pos - 1);
2429                    ndxIntlzr = testPos.locator.slice();
2430                    positions[pos] = $.extend(true, {}, testPos);
2431                }
2432                var lvTestAlt = lvTest && lvTest.alternation !== undefined ? lvTest.locator[lvTest.alternation] : undefined;
2433                for (pos = bl - 1; pos > lvp; pos--) {
2434                    testPos = positions[pos];
2435                    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)) {
2436                        bl--;
2437                    } else break;
2438                }
2439                return returnDefinition ? {
2440                    l: bl,
2441                    def: positions[bl] ? positions[bl].match : undefined
2442                } : bl;
2443            }
2444            function clearOptionalTail(buffer) {
2445                buffer.length = 0;
2446                var template = getMaskTemplate(true, 0, true, undefined, true), lmnt, validPos;
2447                while (lmnt = template.shift(), lmnt !== undefined) {
2448                    buffer.push(lmnt);
2449                }
2450                return buffer;
2451            }
2452            function isComplete(buffer) {
2453                if ($.isFunction(opts.isComplete)) return opts.isComplete(buffer, opts);
2454                if (opts.repeat === "*") return undefined;
2455                var complete = false, lrp = determineLastRequiredPosition(true), aml = seekPrevious(lrp.l);
2456                if (lrp.def === undefined || lrp.def.newBlockMarker || lrp.def.optionality || lrp.def.optionalQuantifier) {
2457                    complete = true;
2458                    for (var i = 0; i <= aml; i++) {
2459                        var test = getTestTemplate(i).match;
2460                        if (test.fn !== null && getMaskSet().validPositions[i] === undefined && test.optionality !== true && test.optionalQuantifier !== true || test.fn === null && buffer[i] !== getPlaceholder(i, test)) {
2461                            complete = false;
2462                            break;
2463                        }
2464                    }
2465                }
2466                return complete;
2467            }
2468            function handleRemove(input, k, pos, strict, fromIsValid) {
2469                if (opts.numericInput || isRTL) {
2470                    if (k === Inputmask.keyCode.BACKSPACE) {
2471                        k = Inputmask.keyCode.DELETE;
2472                    } else if (k === Inputmask.keyCode.DELETE) {
2473                        k = Inputmask.keyCode.BACKSPACE;
2474                    }
2475                    if (isRTL) {
2476                        var pend = pos.end;
2477                        pos.end = pos.begin;
2478                        pos.begin = pend;
2479                    }
2480                }
2481                if (k === Inputmask.keyCode.BACKSPACE && pos.end - pos.begin < 1) {
2482                    pos.begin = seekPrevious(pos.begin);
2483                    if (getMaskSet().validPositions[pos.begin] !== undefined && getMaskSet().validPositions[pos.begin].input === opts.groupSeparator) {
2484                        pos.begin--;
2485                    }
2486                } else if (k === Inputmask.keyCode.DELETE && pos.begin === pos.end) {
2487                    pos.end = isMask(pos.end, true) && getMaskSet().validPositions[pos.end] && getMaskSet().validPositions[pos.end].input !== opts.radixPoint ? pos.end + 1 : seekNext(pos.end) + 1;
2488                    if (getMaskSet().validPositions[pos.begin] !== undefined && getMaskSet().validPositions[pos.begin].input === opts.groupSeparator) {
2489                        pos.end++;
2490                    }
2491                }
2492                revalidateMask(pos);
2493                if (strict !== true && opts.keepStatic !== false || opts.regex !== null) {
2494                    var result = alternate(true);
2495                    if (result) {
2496                        var newPos = result.caret !== undefined ? result.caret : result.pos ? seekNext(result.pos.begin ? result.pos.begin : result.pos) : getLastValidPosition(-1, true);
2497                        if (k !== Inputmask.keyCode.DELETE || pos.begin > newPos) {
2498                            pos.begin == newPos;
2499                        }
2500                    }
2501                }
2502                var lvp = getLastValidPosition(pos.begin, true);
2503                if (lvp < pos.begin || pos.begin === -1) {
2504                    getMaskSet().p = seekNext(lvp);
2505                } else if (strict !== true) {
2506                    getMaskSet().p = pos.begin;
2507                    if (fromIsValid !== true) {
2508                        while (getMaskSet().p < lvp && getMaskSet().validPositions[getMaskSet().p] === undefined) {
2509                            getMaskSet().p++;
2510                        }
2511                    }
2512                }
2513            }
2514            function initializeColorMask(input) {
2515                var computedStyle = (input.ownerDocument.defaultView || window).getComputedStyle(input, null);
2516                function findCaretPos(clientx) {
2517                    var e = document.createElement("span"), caretPos;
2518                    for (var style in computedStyle) {
2519                        if (isNaN(style) && style.indexOf("font") !== -1) {
2520                            e.style[style] = computedStyle[style];
2521                        }
2522                    }
2523                    e.style.textTransform = computedStyle.textTransform;
2524                    e.style.letterSpacing = computedStyle.letterSpacing;
2525                    e.style.position = "absolute";
2526                    e.style.height = "auto";
2527                    e.style.width = "auto";
2528                    e.style.visibility = "hidden";
2529                    e.style.whiteSpace = "nowrap";
2530                    document.body.appendChild(e);
2531                    var inputText = input.inputmask._valueGet(), previousWidth = 0, itl;
2532                    for (caretPos = 0, itl = inputText.length; caretPos <= itl;
2532 caretPos++) {
2533                        e.innerHTML += inputText.charAt(caretPos) || "_";
2534                        if (e.offsetWidth >= clientx) {
2535                            var offset1 = clientx - previousWidth;
2536                            var offset2 = e.offsetWidth - clientx;
2537                            e.innerHTML = inputText.charAt(caretPos);
2538                            offset1 -= e.offsetWidth / 3;
2539                            caretPos = offset1 < offset2 ? caretPos - 1 : caretPos;
2540                            break;
2541                        }
2542                        previousWidth = e.offsetWidth;
2543                    }
2544                    document.body.removeChild(e);
2545                    return caretPos;
2546                }
2547                var template = document.createElement("div");
2548                template.style.width = computedStyle.width;
2549                template.style.textAlign = computedStyle.textAlign;
2550                colorMask = document.createElement("div");
2551                input.inputmask.colorMask = colorMask;
2552                colorMask.className = "im-colormask";
2553                input.parentNode.insertBefore(colorMask, input);
2554                input.parentNode.removeChild(input);
2555                colorMask.appendChild(input);
2556                colorMask.appendChild(template);
2557                input.style.left = template.offsetLeft + "px";
2558                $(colorMask).on("mouseleave", function(e) {
2559                    return EventHandlers.mouseleaveEvent.call(input, [ e ]);
2560                });
2561                $(colorMask).on("mouseenter", function(e) {
2562                    return EventHandlers.mouseenterEvent.call(input, [ e ]);
2563                });
2564                $(colorMask).on("click", function(e) {
2565                    caret(input, findCaretPos(e.clientX));
2566                    return EventHandlers.clickEvent.call(input, [ e ]);
2567                });
2568            }
2569            Inputmask.prototype.positionColorMask = function(input, template) {
2570                input.style.left = template.offsetLeft + "px";
2571            };
2572            function renderColorMask(input, caretPos, clear) {
2573                var maskTemplate = [], isStatic = false, test, testPos, ndxIntlzr, pos = 0;
2574                function setEntry(entry) {
2575                    if (entry === undefined) entry = "";
2576                    if (!isStatic && (test.fn === null || testPos.input === undefined)) {
2577                        isStatic = true;
2578                        maskTemplate.push("<span class='im-static'>" + entry);
2579                    } else if (isStatic && (test.fn !== null && testPos.input !== undefined || test.def === "")) {
2580                        isStatic = false;
2581                        var mtl = maskTemplate.length;
2582                        maskTemplate[mtl - 1] = maskTemplate[mtl - 1] + "</span>";
2583                        maskTemplate.push(entry);
2584                    } else maskTemplate.push(entry);
2585                }
2586                function setCaret() {
2587                    if (document.activeElement === input) {
2588                        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">');
2589                        maskTemplate.splice(caretPos.end + 1, 0, "</mark>");
2590                    }
2591                }
2592                if (colorMask !== undefined) {
2593                    var buffer = getBuffer();
2594                    if (caretPos === undefined) {
2595                        caretPos = caret(input);
2596                    } else if (caretPos.begin === undefined) {
2597                        caretPos = {
2598                            begin: caretPos,
2599                            end: caretPos
2600                        };
2601                    }
2602                    if (clear !== true) {
2603                        var lvp = getLastValidPosition();
2604                        do {
2605                            if (getMaskSet().validPositions[pos]) {
2606                                testPos = getMaskSet().validPositions[pos];
2607                                test = testPos.match;
2608                                ndxIntlzr = testPos.locator.slice();
2609                                setEntry(buffer[pos]);
2610                            } else {
2611                                testPos = getTestTemplate(pos, ndxIntlzr, pos - 1);
2612                                test = testPos.match;
2613                                ndxIntlzr = testPos.locator.slice();
2614                                if (opts.jitMasking === false || pos < lvp || typeof opts.jitMasking === "number" && isFinite(opts.jitMasking) && opts.jitMasking > pos) {
2615                                    setEntry(getPlaceholder(pos, test));
2616                                } else isStatic = false;
2617                            }
2618                            pos++;
2619                        } while ((maxLength === undefined || pos < maxLength) && (test.fn !== null || test.def !== "") || lvp > pos || isStatic);
2620                        if (isStatic) setEntry();
2621                        setCaret();
2622                    }
2623                    var template = colorMask.getElementsByTagName("div")[0];
2624                    template.innerHTML = maskTemplate.join("");
2625                    input.inputmask.positionColorMask(input, template);
2626                }
2627            }
2628            function mask(elem) {
2629                function isElementTypeSupported(input, opts) {
2630                    function patchValueProperty(npt) {
2631                        var valueGet;
2632                        var valueSet;
2633                        function patchValhook(type) {
2634                            if ($.valHooks && ($.valHooks[type] === undefined || $.valHooks[type].inputmaskpatch !== true)) {
2635                                var valhookGet = $.valHooks[type] && $.valHooks[type].get ? $.valHooks[type].get : function(elem) {
2636                                    return elem.value;
2637                                };
2638                                var valhookSet = $.valHooks[type] && $.valHooks[type].set ? $.valHooks[type].set : function(elem, value) {
2639                                    elem.value = value;
2640                                    return elem;
2641                                };
2642                                $.valHooks[type] = {
2643                                    get: function get(elem) {
2644                                        if (elem.inputmask) {
2645                                            if (elem.inputmask.opts.autoUnmask) {
2646                                                return elem.inputmask.unmaskedvalue();
2647                                            } else {
2648                                                var result = valhookGet(elem);
2649                                                return getLastValidPosition(undefined, undefined, elem.inputmask.maskset.validPositions) !== -1 || opts.nullable !== true ? result : "";
2650                                            }
2651                                        } else return valhookGet(elem);
2652                                    },
2653                                    set: function set(elem, value) {
2654                                        var $elem = $(elem), result;
2655                                        result = valhookSet(elem, value);
2656                                        if (elem.inputmask) {
2657                                            $elem.trigger("setvalue", [ value ]);
2658                                        }
2659                                        return result;
2660                                    },
2661                                    inputmaskpatch: true
2662                                };
2663                            }
2664                        }
2665                        function getter() {
2666                            if (this.inputmask) {
2667                                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) : "";
2668                            } else return valueGet.call(this);
2669                        }
2670                        function setter(value) {
2671                            valueSet.call(this, value);
2672                            if (this.inputmask) {
2673                                $(this).trigger("setvalue", [ value ]);
2674                            }
2675                        }
2676                        function installNativeValueSetFallback(npt) {
2677                            EventRuler.on(npt, "mouseenter", function(event) {
2678                                var $input = $(this), input = this, value = input.inputmask._valueGet();
2679                                if (value !== getBuffer().join("")) {
2680                                    $input.trigger("setvalue");
2681                                }
2682                            });
2683                        }
2684                        if (!npt.inputmask.__valueGet) {
2685                            if (opts.noValuePatching !== true) {
2686                                if (Object.getOwnPropertyDescriptor) {
2687                                    if (typeof Object.getPrototypeOf 
2687!== "function") {
2688                                        Object.getPrototypeOf = _typeof("test".__proto__) === "object" ? function(object) {
2689                                            return object.__proto__;
2690                                        } : function(object) {
2691                                            return object.constructor.prototype;
2692                                        };
2693                                    }
2694                                    var valueProperty = Object.getPrototypeOf ? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(npt), "value") : undefined;
2695                                    if (valueProperty && valueProperty.get && valueProperty.set) {
2696                                        valueGet = valueProperty.get;
2697                                        valueSet = valueProperty.set;
2698                                        Object.defineProperty(npt, "value", {
2699                                            get: getter,
2700                                            set: setter,
2701                                            configurable: true
2702                                        });
2703                                    } else if (npt.tagName !== "INPUT") {
2704                                        valueGet = function valueGet() {
2705                                            return this.textContent;
2706                                        };
2707                                        valueSet = function valueSet(value) {
2708                                            this.textContent = value;
2709                                        };
2710                                        Object.defineProperty(npt, "value", {
2711                                            get: getter,
2712                                            set: setter,
2713                                            configurable: true
2714                                        });
2715                                    }
2716                                } else if (document.__lookupGetter__ && npt.__lookupGetter__("value")) {
2717                                    valueGet = npt.__lookupGetter__("value");
2718                                    valueSet = npt.__lookupSetter__("value");
2719                                    npt.__defineGetter__("value", getter);
2720                                    npt.__defineSetter__("value", setter);
2721                                }
2722                                npt.inputmask.__valueGet = valueGet;
2723                                npt.inputmask.__valueSet = valueSet;
2724                            }
2725                            npt.inputmask._valueGet = function(overruleRTL) {
2726                                return isRTL && overruleRTL !== true ? valueGet.call(this.el).split("").reverse().join("") : valueGet.call(this.el);
2727                            };
2728                            npt.inputmask._valueSet = function(value, overruleRTL) {
2729                                valueSet.call(this.el, value === null || value === undefined ? "" : overruleRTL !== true && isRTL ? value.split("").reverse().join("") : value);
2730                            };
2731                            if (valueGet === undefined) {
2732                                valueGet = function valueGet() {
2733                                    return this.value;
2734                                };
2735                                valueSet = function valueSet(value) {
2736                                    this.value = value;
2737                                };
2738                                patchValhook(npt.type);
2739                                installNativeValueSetFallback(npt);
2740                            }
2741                        }
2742                    }
2743                    var elementType = input.getAttribute("type");
2744                    var isSupported = input.tagName === "INPUT" && $.inArray(elementType, opts.supportsInputType) !== -1 || input.isContentEditable || input.tagName === "TEXTAREA";
2745                    if (!isSupported) {
2746                        if (input.tagName === "INPUT") {
2747                            var el = document.createElement("input");
2748                            el.setAttribute("type", elementType);
2749                            isSupported = el.type === "text";
2750                            el = null;
2751                        } else isSupported = "partial";
2752                    }
2753                    if (isSupported !== false) {
2754                        patchValueProperty(input);
2755                    } else input.inputmask = undefined;
2756                    return isSupported;
2757                }
2758                EventRuler.off(elem);
2759                var isSupported = isElementTypeSupported(elem, opts);
2760                if (isSupported !== false) {
2761                    el = elem;
2762                    $el = $(el);
2763                    originalPlaceholder = el.placeholder;
2764                    maxLength = el !== undefined ? el.maxLength : undefined;
2765                    if (maxLength === -1) maxLength = undefined;
2766                    if (opts.colorMask === true) {
2767                        initializeColorMask(el);
2768                    }
2769                    if (mobile) {
2770                        if ("inputmode" in el) {
2771                            el.inputmode = opts.inputmode;
2772                            el.setAttribute("inputmode", opts.inputmode);
2773                        }
2774                        if (opts.disablePredictiveText === true) {
2775                            if ("autocorrect" in el) {
2776                                el.autocorrect = false;
2777                            } else {
2778                                if (opts.colorMask !== true) {
2779                                    initializeColorMask(el);
2780                                }
2781                                el.type = "password";
2782                            }
2783                        }
2784                    }
2785                    if (isSupported === true) {
2786                        el.setAttribute("im-insert", opts.insertMode);
2787                        EventRuler.on(el, "submit", EventHandlers.submitEvent);
2788                        EventRuler.on(el, "reset", EventHandlers.resetEvent);
2789                        EventRuler.on(el, "blur", EventHandlers.blurEvent);
2790                        EventRuler.on(el, "focus", EventHandlers.focusEvent);
2791                        if (opts.colorMask !== true) {
2792                            EventRuler.on(el, "click", EventHandlers.clickEvent);
2793                            EventRuler.on(el, "mouseleave", EventHandlers.mouseleaveEvent);
2794                            EventRuler.on(el, "mouseenter", EventHandlers.mouseenterEvent);
2795                        }
2796                        EventRuler.on(el, "paste", EventHandlers.pasteEvent);
2797                        EventRuler.on(el, "cut", EventHandlers.cutEvent);
2798                        EventRuler.on(el, "complete", opts.oncomplete);
2799                        EventRuler.on(el, "incomplete", opts.onincomplete);
2800                        EventRuler.on(el, "cleared", opts.oncleared);
2801                        if (!mobile && opts.inputEventOnly !== true) {
2802                            EventRuler.on(el, "keydown", EventHandlers.keydownEvent);
2803                            EventRuler.on(el, "keypress", EventHandlers.keypressEvent);
2804                        } else {
2805                            el.removeAttribute("maxLength");
2806                        }
2807                        EventRuler.on(el, "input", EventHandlers.inputFallBackEvent);
2808                        EventRuler.on(el, "beforeinput", EventHandlers.beforeInputEvent);
2809                    }
2810                    EventRuler.on(el, "setvalue", EventHandlers.setValueEvent);
2811                    undoValue = getBufferTemplate().join("");
2812                    if (el.inputmask._valueGet(true) !== "" || opts.clearMaskOnLostFocus === false || document.activeElement === el) {
2813                        var initialValue = $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(inputmask, el.inputmask._valueGet(true), opts) || el.inputmask._valueGet(true) : el.inputmask._valueGet(true);
2814                        if (initialValue !== "") checkVal(el, true, false, initialValue.split(""));
2815                        var buffer = getBuffer().slice();
2816                        undoValue = buffer.join("");
2817                        if (isComplete(buffer) === false) {
2818                            if (opts.clearIncomplete) {
2819                                resetMaskSet();
2820                            }
2821                        }
2822                        if (opts.clearMaskOnLostFocus && document.activeElement !== el) {
2823                            if (getLastValidPosition() === -1) {
2824                                buffer = [];
2825                            } else {
2826                                clearOptionalTail(buffer);
2827                            }
2828                        }
2829                        if (opts.clearMaskOnLostFocus === false || opts.showMaskOnFocus && document.activeElement === el || el.inputmask._valueGet(true) !== "") writeBuffer(el, buffer);
2830                        if (document.activeElement === el) {
2831                            caret(el, seekNext(getLastValidPosition()));
2832                        }
2833                    }
2834                }
2835            }
2836            var valueBuffer;
2837            if (actionObj !== undefined) {
2838                switch (actionObj.action) {
2839                  case "isComplete":
2840                    el = actionObj.el;
2841                    return isComplete(getBuffer());
2842
2843                  case "unmaskedvalue":
2844                    if (el === undefined || actionObj.value !== undefined) {
2845                        valueBuffer = actionObj.value;
2846                        valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(inputmask, valueBuffer, opts) || valueBuffer : valueBuffer).split("");
2847                        checkVal.call(this, undefined, false, false, valueBuffer);
2848                        if ($.isFunction(opts.onBeforeWrite)) opts.onBeforeWrite.call(inputmask, undefined, getBuffer(), 0, opts);
2849                    }
2850                    return unmaskedvalue(el);
2851
2852                  case "mask":
2853                    mask(el);
2854                    break;
2855
2856                  case "format":
2857                    valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(inputmask, actionObj.value, opts) || actionObj.value : actionObj.value).split("");
2858                    checkVal.call(this, undefined, true, false, valueBuffer);
2859                    if (actionObj.metadata) {
2860                        return {
2861                            value: isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""),
2862                            metadata: maskScope.call(this, {
2863                                action: "getmetadata"
2864                            }, maskset, opts)
2865                        };
2866                    }
2867                    return isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join("");
2868
2869                  case "isValid":
2870                    if (actionObj.value) {
2871                        valueBuffer = actionObj.value.split("");
2872                        checkVal.call(this, undefined, true, true, valueBuffer);
2873                    } else {
2874                        actionObj.value = getBuffer().join("");
2875                    }
2876                    var buffer = getBuffer();
2877                    var rl = determineLastRequiredPosition(), lmib = buffer.length - 1;
2878                    for (;lmib > rl; lmib--) {
2879                        if (isMask(lmib)) break;
2880                    }
2881                    buffer.splice(rl, lmib + 1 - rl);
2882                    return isComplete(buffer) && actionObj.value === getBuffer().join("");
2883
2884                  case "getemptymask":
2885                    return getBufferTemplate().join("");
2886
2887                  case "remove":
2888                    if (el && el.inputmask) {
2889                        $.data(el, "_inputmask_opts", null);
2890                        $el = $(el);
2891                        el.inputmask._valueSet(opts.autoUnmask ? unmaskedvalue(el) : el.inputmask._valueGet(true));
2892                        EventRuler.off(el);
2893                        if (el.inputmask.colorMask) {
2894                            colorMask = el.inputmask.colorMask;
2895                            colorMask.removeChild(el);
2896                            colorMask.parentNode.insertBefore(el, colorMask);
2897                            colorMask.parentNode.removeChild(colorMask);
2898                        }
2899                        var valueProperty;
2900                        if (Object.getOwnPropertyDescriptor && Ob
2900ject.getPrototypeOf) {
2901                            valueProperty = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(el), "value");
2902                            if (valueProperty) {
2903                                if (el.inputmask.__valueGet) {
2904                                    Object.defineProperty(el, "value", {
2905                                        get: el.inputmask.__valueGet,
2906                                        set: el.inputmask.__valueSet,
2907                                        configurable: true
2908                                    });
2909                                }
2910                            }
2911                        } else if (document.__lookupGetter__ && el.__lookupGetter__("value")) {
2912                            if (el.inputmask.__valueGet) {
2913                                el.__defineGetter__("value", el.inputmask.__valueGet);
2914                                el.__defineSetter__("value", el.inputmask.__valueSet);
2915                            }
2916                        }
2917                        el.inputmask = undefined;
2918                    }
2919                    return el;
2920                    break;
2921
2922                  case "getmetadata":
2923                    if ($.isArray(maskset.metadata)) {
2924                        var maskTarget = getMaskTemplate(true, 0, false).join("");
2925                        $.each(maskset.metadata, function(ndx, mtdt) {
2926                            if (mtdt.mask === maskTarget) {
2927                                maskTarget = mtdt;
2928                                return false;
2929                            }
2930                        });
2931                        return maskTarget;
2932                    }
2933                    return maskset.metadata;
2934                }
2935            }
2936        }
2937        return Inputmask;
2938    });
2939}, function(module, exports, __webpack_require__) {
2940    "use strict";
2941    var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
2942    var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
2943        return typeof obj;
2944    } : function(obj) {
2945        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
2946    };
2947    (function(factory) {
2948        if (true) {
2949            !(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(4) ], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, 
2950            __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === "function" ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, 
2951            __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
2952        } else {}
2953    })(function($) {
2954        return $;
2955    });
2956}, function(module, exports) {
2957    module.exports = jQuery;
2958}, function(module, exports, __webpack_require__) {
2959    "use strict";
2960    var __WEBPACK_AMD_DEFINE_RESULT__;
2961    var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
2962        return typeof obj;
2963    } : function(obj) {
2964        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
2965    };
2966    if (true) !(__WEBPACK_AMD_DEFINE_RESULT__ = function() {
2967        return typeof window !== "undefined" ? window : new (eval("require('jsdom').JSDOM"))("").window;
2968    }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); else {}
2969}, function(module, exports, __webpack_require__) {
2970    "use strict";
2971    var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
2972    var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
2973        return typeof obj;
2974    } : function(obj) {
2975        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
2976    };
2977    (function(factory) {
2978        if (true) {
2979            !(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(2) ], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, 
2980            __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === "function" ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, 
2981            __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
2982        } else {}
2983    })(function(Inputmask) {
2984        var $ = Inputmask.dependencyLib;
2985        var formatCode = {
2986            d: [ "[1-9]|[12][0-9]|3[01]", Date.prototype.setDate, "day", Date.prototype.getDate ],
2987            dd: [ "0[1-9]|[12][0-9]|3[01]", Date.prototype.setDate, "day", function() {
2988                return pad(Date.prototype.getDate.call(this), 2);
2989            } ],
2990            ddd: [ "" ],
2991            dddd: [ "" ],
2992            m: [ "[1-9]|1[012]", Date.prototype.setMonth, "month", function() {
2993                return Date.prototype.getMonth.call(this) + 1;
2994            } ],
2995            mm: [ "0[1-9]|1[012]", Date.prototype.setMonth, "month", function() {
2996                return pad(Date.prototype.getMonth.call(this) + 1, 2);
2997            } ],
2998            mmm: [ "" ],
2999            mmmm: [ "" ],
3000            yy: [ "[0-9]{2}", Date.prototype.setFullYear, "year", function() {
3001                return pad(Date.prototype.getFullYear.call(this), 2);
3002            } ],
3003            yyyy: [ "[0-9]{4}", Date.prototype.setFullYear, "year", function() {
3004                return pad(Date.prototype.getFullYear.call(this), 4);
3005            } ],
3006            h: [ "[1-9]|1[0-2]", Date.prototype.setHours, "hours", Date.prototype.getHours ],
3007            hh: [ "0[1-9]|1[0-2]", Date.prototype.setHours, "hours", function() {
3008                return pad(Date.prototype.getHours.call(this), 2);
3009            } ],
3010            hhh: [ "[0-9]+", Date.prototype.setHours, "hours", Date.prototype.getHours ],
3011            H: [ "1?[0-9]|2[0-3]", Date.prototype.setHours, "hours", Date.prototype.getHours ],
3012            HH: [ "0[0-9]|1[0-9]|2[0-3]", Date.prototype.setHours, "hours", function() {
3013                return pad(Date.prototype.getHours.call(this), 2);
3014            } ],
3015            HHH: [ "[0-9]+", Date.prototype.setHours, "hours", Date.prototype.getHours ],
3016            M: [ "[1-5]?[0-9]", Date.prototype.setMinutes, "minutes", Date.prototype.getMinutes ],
3017            MM: [ "0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]", Date.prototype.setMinutes, "minutes", function() {
3018                return pad(Date.prototype.getMinutes.call(this), 2);
3019            } ],
3020            ss: [ "[0-5][0-9]", Date.prototype.setSeconds, "seconds", function() {
3021                return pad(Date.prototype.getSeconds.call(this), 2);
3022            } ],
3023            l: [ "[0-9]{3}", Date.prototype.setMilliseconds, "milliseconds", function() {
3024                return pad(Date.prototype.getMilliseconds.call(this), 3);
3025            } ],
3026            L: [ "[0-9]{2}", Date.prototype.setMilliseconds, "milliseconds", function() {
3027                return pad(Date.prototype.getMilliseconds.call(this), 2);
3028            } ],
3029            t: [ "[ap]" ],
3030            tt: [ "[ap]m" ],
3031            T: [ "[AP]" ],
3032            TT: [ "[AP]M" ],
3033            Z: [ "" ],
3034            o: [ "" ],
3035            S: [ "" ]
3036        }, formatAlias = {
3037            isoDate: "yyyy-mm-dd",
3038            isoTime: "HH:MM:ss",
3039            isoDateTime: "yyyy-mm-dd'T'HH:MM:ss",
3040            isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
3041        };
3042        function getTokenizer(opts) {
3043            if (!opts.tokenizer) {
3044                var tokens = [];
3045                for (var ndx in formatCode) {
3046                    if (tokens.indexOf(ndx[0]) === -1) tokens.push(ndx[0]);
3047                }
3048                opts.tokenizer = "(" + tokens.join("+|") + ")+?|.";
3049                opts.tokenizer = new RegExp(opts.tokenizer, "g");
3050            }
3051            return opts.tokenizer;
3052        }
3053        function isValidDate(dateParts, currentResult) {
3054            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;
3055        }
3056        function isDateInRange(dateParts, opts) {
3057            var result = true;
3058            if (opts.min) {
3059                if (dateParts["rawyear"]) {
3060                    var rawYear = dateParts["rawyear"].replace(/[^0-9]/g, ""), minYear = opts.min.year.substr(0, rawYear.length);
3061                    result = minYear <= rawYear;
3062                }
3063                if (dateParts["year"] === dateParts["rawyear"]) {
3064                    if (opts.min.date.getTime() === opts.min.date.getTime()) {
3065                        result = opts.min.date.getTime() <= dateParts.date.getTime();
3066                    }
3067                }
3068            }
3069            if (result && opts.max && opts.max.date.getTime() === opts.max.date.getTime()) {
3070                result = opts.max.date.getTime() >= dateParts.date.getTime();
3071            }
3072            return result;
3073        }
3074        function parse(format, dateObjValue, opts, raw) {
3075            var mask = "", match;
3076            while (match = getTokenizer(opts).exec(format)) {
3077                if (dateObjValue === undefined) {
3078                    if (formatCode[match[0]]) {
3079                        mask += "(" + formatCode[match[0]][0] + ")";
3080                    } else {
3081                        switch (match[0]) {
3082                          case "[":
3083                            mask += "(";
3084                            break;
3085
3086                          case "]":
3087                            mask += ")?";
3088                            break;
3089
3090                          default:
3091                            mask += Inputmask.escapeRegex(match[0]);
3092                        }
3093                    }
3094                } else {
3095                    if (formatCode[match[0]]) {
3096                        if (raw !== true && formatCode[match[0]][3]) {
3097                            var getFn = formatCode[match[0]][3];
3098                            mask += getFn.call(dateObjValue.date);
3099                        } else if (formatCode[match[0]][2]) mask += dateObjValue["raw" + formatCode[match[0]][2]]; else mask += match[0];
3100                    } else mask += match[0];
3101                }
3102            }
3103            return mask;
3104        }
3105        function pad(val, len) {
3106            val = String(val);
3107            len = len || 2;
3108            while (val.length < len) {
3109                val = "0" + val;
3110            }
3111            return val;
3112        }
3113        function analyseMask(maskString, format, opts) {
3114            var dateObj = {
3115                date: new Date(1, 0, 1)
3116            }, targetProp, mask = maskString, match, dateOperation, targetValidator;
3117            function extendProperty(value) {
3118                var correctedValue = value.replace(/[^0-9]/g, "0");
3119                if (correctedValue != value) {
3120                    var enteredPart = value.replace(/[^0-9]/g, ""), min = (opts.min && opts.min[targetProp] || value).toString(), max = (opts.max && opts.max[targetProp] || value).toString();
3121                    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));
3122                }
3123                return correctedValue;
3124            }
3125            function setValue(dateObj, value, opts) {
3126                dateObj[targetProp] = extendProperty(value);
3127                dateObj["raw" + targetProp] = value;
3128                if (dateOperation !== undefined) dateOperation.call(dateObj.date, targetProp == "month" ? parseInt(dateObj[targetProp]) - 1 : dateObj[targetProp]);
3129            }
3130            if (typeof mask === "string") {
3131                while (match = getTokenizer(opts).exec(format)) {
3132                    var value = mask.slice(0, match[0].length);
3133                    if (formatCode.hasOwnProperty(match[0])) {
3134                        targetValidator = formatCode[match[0]][0];
3135                        targetProp = formatCode[match[0]][2];
3136                        dateOperation = formatCode[match[0]][1];
3137                        setValue(dateObj, value, opts);
3138                    }
3139                    mask = mask.slice(value.length);
3140                }
3141                return dateObj;
3142            } else if (mask && (typeof mask === "undefined" ? "undefined" : _typeof(mask)) === "object" && mask.hasOwnProperty("date")) {
3143                return mask;
3144            }
3145            return undefined;
3146        }
3147        Inputmask.extendAliases({
3148            datetime: {
3149                mask: function mask(opts) {
3150                    formatCode.S = opts.i18n.ordinalSuffix.join("|");
3151                    opts.inputFormat = formatAlias[opts.inputFormat] || opts.inputFormat;
3152                    opts.displayFormat = formatAlias[opts.displayFormat] || opts.displayFormat || opts.inputFormat;
3153                    opts.outputFormat = formatAlias[opts.outputFormat] || opts.outputFormat || opts.inputFormat;
3154                    opts.placeholder = opts.placeholder !== "" ? opts.placeholder : opts.inputFormat.replace(/[\[\]]/, "");
3155                    opts.regex = parse(opts.inputFormat, undefined, opts);
3156                    return null;
3157                },
3158                placeholder: "",
3159                inputFormat: "isoDateTime",
3160                displayFormat: undefined,
3161                outputFormat: undefined,
3162                min: null,
3163                max: null,
3164                i18n: {
3165                    dayNames: [ "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ],
3166                    monthNames: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
3166November", "December" ],
3167                    ordinalSuffix: [ "st", "nd", "rd", "th" ]
3168                },
3169                postValidation: function postValidation(buffer, pos, currentResult, opts) {
3170                    opts.min = analyseMask(opts.min, opts.inputFormat, opts);
3171                    opts.max = analyseMask(opts.max, opts.inputFormat, opts);
3172                    var result = currentResult, dateParts = analyseMask(buffer.join(""), opts.inputFormat, opts);
3173                    if (result && dateParts.date.getTime() === dateParts.date.getTime()) {
3174                        result = isValidDate(dateParts, result);
3175                        result = result && isDateInRange(dateParts, opts);
3176                    }
3177                    if (pos && result && currentResult.pos !== pos) {
3178                        return {
3179                            buffer: parse(opts.inputFormat, dateParts, opts),
3180                            refreshFromBuffer: {
3181                                start: pos,
3182                                end: currentResult.pos
3183                            }
3184                        };
3185                    }
3186                    return result;
3187                },
3188                onKeyDown: function onKeyDown(e, buffer, caretPos, opts) {
3189                    var input = this;
3190                    if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
3191                        var today = new Date(), match, date = "";
3192                        while (match = getTokenizer(opts).exec(opts.inputFormat)) {
3193                            if (match[0].charAt(0) === "d") {
3194                                date += pad(today.getDate(), match[0].length);
3195                            } else if (match[0].charAt(0) === "m") {
3196                                date += pad(today.getMonth() + 1, match[0].length);
3197                            } else if (match[0] === "yyyy") {
3198                                date += today.getFullYear().toString();
3199                            } else if (match[0].charAt(0) === "y") {
3200                                date += pad(today.getYear(), match[0].length);
3201                            }
3202                        }
3203                        input.inputmask._valueSet(date);
3204                        $(input).trigger("setvalue");
3205                    }
3206                },
3207                onUnMask: function onUnMask(maskedValue, unmaskedValue, opts) {
3208                    return parse(opts.outputFormat, analyseMask(maskedValue, opts.inputFormat, opts), opts, true);
3209                },
3210                casing: function casing(elem, test, pos, validPositions) {
3211                    if (test.nativeDef.indexOf("[ap]") == 0) return elem.toLowerCase();
3212                    if (test.nativeDef.indexOf("[AP]") == 0) return elem.toUpperCase();
3213                    return elem;
3214                },
3215                insertMode: false,
3216                shiftPositions: false
3217            }
3218        });
3219        return Inputmask;
3220    });
3221}, function(module, exports, __webpack_require__) {
3222    "use strict";
3223    var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
3224    var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
3225        return typeof obj;
3226    } : function(obj) {
3227        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
3228    };
3229    (function(factory) {
3230        if (true) {
3231            !(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(2) ], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, 
3232            __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === "function" ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, 
3233            __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
3234        } else {}
3235    })(function(Inputmask) {
3236        var $ = Inputmask.dependencyLib;
3237        function autoEscape(txt, opts) {
3238            var escapedTxt = "";
3239            for (var i = 0; i < txt.length; i++) {
3240                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)) {
3241                    escapedTxt += "\\" + txt.charAt(i);
3242                } else escapedTxt += txt.charAt(i);
3243            }
3244            return escapedTxt;
3245        }
3246        function alignDigits(buffer, digits, opts) {
3247            if (digits > 0) {
3248                var radixPosition = $.inArray(opts.radixPoint, buffer);
3249                if (radixPosition === -1) {
3250                    buffer.push(opts.radixPoint);
3251                    radixPosition = buffer.length - 1;
3252                }
3253                for (var i = 1; i <= digits; i++) {
3254                    buffer[radixPosition + i] = buffer[radixPosition + i] || "0";
3255                }
3256            }
3257            return buffer;
3258        }
3259        Inputmask.extendAliases({
3260            numeric: {
3261                mask: function mask(opts) {
3262                    if (opts.repeat !== 0 && isNaN(opts.integerDigits)) {
3263                        opts.integerDigits = opts.repeat;
3264                    }
3265                    opts.repeat = 0;
3266                    if (opts.groupSeparator === opts.radixPoint && opts.digits && opts.digits !== "0") {
3267                        if (opts.radixPoint === ".") {
3268                            opts.groupSeparator = ",";
3269                        } else if (opts.radixPoint === ",") {
3270                            opts.groupSeparator = ".";
3271                        } else opts.groupSeparator = "";
3272                    }
3273                    if (opts.groupSeparator === " ") {
3274                        opts.skipOptionalPartCharacter = undefined;
3275                    }
3276                    opts.autoGroup = opts.autoGroup && opts.groupSeparator !== "";
3277                    if (opts.autoGroup) {
3278                        if (typeof opts.groupSize == "string" && isFinite(opts.groupSize)) opts.groupSize = parseInt(opts.groupSize);
3279                        if (isFinite(opts.integerDigits)) {
3280                            var seps = Math.floor(opts.integerDigits / opts.groupSize);
3281                            var mod = opts.integerDigits % opts.groupSize;
3282                            opts.integerDigits = parseInt(opts.integerDigits) + (mod === 0 ? seps - 1 : seps);
3283                            if (opts.integerDigits < 1) {
3284                                opts.integerDigits = "*";
3285                            }
3286                        }
3287                    }
3288                    if (opts.placeholder.length > 1) {
3289                        opts.placeholder = opts.placeholder.charAt(0);
3290                    }
3291                    if (opts.positionCaretOnClick === "radixFocus" && opts.placeholder === "" && opts.integerOptional === false) {
3292                        opts.positionCaretOnClick = "lvp";
3293                    }
3294                    opts.definitions[";"] = opts.definitions["~"];
3295                    opts.definitions[";"].definitionSymbol = "~";
3296                    if (opts.numericInput === true) {
3297                        opts.positionCaretOnClick = opts.positionCaretOnClick === "radixFocus" ? "lvp" : opts.positionCaretOnClick;
3298                        opts.digitsOptional = false;
3299                        if (isNaN(opts.digits)) opts.digits = 2;
3300                        opts.decimalProtect = false;
3301                    }
3302                    var mask = "[+]";
3303                    mask += autoEscape(opts.prefix, opts);
3304                    if (opts.integerOptional === true) {
3305                        mask += "~{1," + opts.integerDigits + "}";
3306                    } else mask += "~{" + opts.integerDigits + "}";
3307                    if (opts.digits !== undefined) {
3308                        var radixDef = opts.decimalProtect ? ":" : opts.radixPoint;
3309                        var dq = opts.digits.toString().split(",");
3310                        if (isFinite(dq[0]) && dq[1] && isFinite(dq[1])) {
3311                            mask += radixDef + ";{" + opts.digits + "}";
3312                        } else if (isNaN(opts.digits) || parseInt(opts.digits) > 0) {
3313                            if (opts.digitsOptional) {
3314                                mask += "[" + radixDef + ";{1," + opts.digits + "}]";
3315                            } else mask += radixDef + ";{" + opts.digits + "}";
3316                        }
3317                    }
3318                    mask += autoEscape(opts.suffix, opts);
3319                    mask += "[-]";
3320                    opts.greedy = false;
3321                    return mask;
3322                },
3323                placeholder: "",
3324                greedy: false,
3325                digits: "*",
3326                digitsOptional: true,
3327                enforceDigitsOnBlur: false,
3328                radixPoint: ".",
3329                positionCaretOnClick: "radixFocus",
3330                groupSize: 3,
3331                groupSeparator: "",
3332                autoGroup: false,
3333                allowMinus: true,
3334                negationSymbol: {
3335                    front: "-",
3336                    back: ""
3337                },
3338                integerDigits: "+",
3339                integerOptional: true,
3340                prefix: "",
3341                suffix: "",
3342                rightAlign: true,
3343                decimalProtect: true,
3344                min: null,
3345                max: null,
3346                step: 1,
3347                insertMode: true,
3348                autoUnmask: false,
3349                unmaskAsNumber: false,
3350                inputType: "text",
3351                inputmode: "numeric",
3352                preValidation: function preValidation(buffer, pos, c, isSelection, opts, maskset) {
3353                    if (c === "-" || c === opts.negationSymbol.front) {
3354                        if (opts.allowMinus !== true) return false;
3355                        opts.isNegative = opts.isNegative === undefined ? true : !opts.isNegative;
3356                        if (buffer.join("") === "") return true;
3357                        return {
3358                            caret: maskset.validPositions[pos] ? pos : undefined,
3359                            dopost: true
3360                        };
3361                    }
3362                    if (isSelection === false && c === opts.radixPoint && opts.digits !== undefined && (isNaN(opts.digits) || parseInt(opts.digits) > 0)) {
3363                        var radixPos = $.inArray(opts.radixPoint, buffer);
3364                        if (radixPos !== -1 && maskset.validPositions[radixPos] !== undefined) {
3365                            if (opts.numericInput === true) {
3366                                return pos === radixPos;
3367                            }
3368                            return {
3369                                caret: radixPos + 1
3370                            };
3371                        }
3372                    }
3373                    return true;
3374                },
3375                postValidation: function postValidation(buffer, pos, currentResult, opts) {
3376                    function buildPostMask(buffer, opts) {
3377                        var postMask = "";
3378                        postMask += "(" + opts.groupSeparator + "*{" + opts.groupSize + "}){*}";
3379                        if (opts.radixPoint !== "") {
3380                            var radixSplit = buffer.join("").split(opts.radixPoint);
3381                            if (radixSplit[1]) {
3382                                postMask += opts.radixPoint + "*{" + radixSplit[1].match(/^\d*\??\d*/)[0].length + "}";
3383                            }
3384                        }
3385                        return postMask;
3386                    }
3387                    var suffix = opts.suffix.split(""), prefix = opts.prefix.split("");
3388                    if (currentResult.pos === undefined && currentResult.caret !== undefined && currentResult.dopost !== true) return currentResult;
3389                    var caretPos = currentResult.caret !== undefined ? currentResult.caret : currentResult.pos;
3390                    var maskedValue = buffer.slice();
3391                    if (opts.numericInput) {
3392                        caretPos = maskedValue.length - caretPos - 1;
3393                        maskedValue = maskedValue.reverse();
3394                    }
3395                    var charAtPos = maskedValue[caretPos];
3396                    if (charAtPos === opts.groupSeparator) {
3397                        caretPos += 1;
3398                        charAtPos = maskedValue[caretPos];
3399                    }
3400                    if (caretPos === maskedValue.length - opts.suffix.length - 1 && charAtPos === opts.radixPoint) return currentResult;
3401                    if (charAtPos !== undefined) {
3402                        if (charAtPos !== opts.radixPoint && charAtPos !== opts.negationSymbol.front && charAtPos !== opts.negationSymbol.back) {
3403                            maskedValue[caretPos] = "?";
3404                            if (opts.prefix.length > 0 && caretPos >= (opts.isNegative === false ? 1 : 0) && caretPos < opts.prefix.length - 1 + (opts.isNegative === false ? 1 : 0)) {
3405                                prefix[caretPos - (opts.isNegative === false ? 1 : 0)] = "?";
3406                            } else if (opts.suffix.length > 0 && caretPos >= maskedValue.length - opts.suffix.length - (opts.isNegative === false ? 1 : 0)) {
3407                                suffix[caretPos - (maskedValue.length - opts.suffix.length - (opts.isNegative === false ? 1 : 0))] = "?";
3408                            }
3409                        }
3410                    }
3411                    prefix = prefix.join("");
3412                    suffix = suffix.join("");
3413                    var processValue = maskedValue.join("").replace(prefix, "");
3414                    processValue = processValue.replace(suffix, "");
3415                    processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "");
3416                    processValue = processValue.replace(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g"), "");
3417                    processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), "");
3418                    if (isNaN(opts.placeholder)) {
3419                        processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.placeholder), "g"), "");
3420                    }
3421                    if (processValue.length > 1 && processValue.indexOf(opts.radixPoint) !== 1) {
3422                        if (charAtPos === "0") {
3423                            processValue = processValue.replace(/^\?/g, "");
3424                        }
3425                        processValue = processValue.replace(/^0/g, "");
3426                    }
3427                    if (processValue.charAt(0) === opts.radixPoint && opts.radixPoint !== "" && opts.numericInput !== true) {
3428                        processValue = "0" + processValue;
3429                    }
3430                    if (processValue !== "") {
3431                        processValue = processValue.split("");
3432                        if ((!opts.digitsOptional || opts.enforceDigitsOnBlur && currentResult.event === "blur") && isFinite(opts.digits)) {
3433                            var radixPosition = $.inArray(opts.radixPoint, processValue);
3434                            var rpb = $.inArray(opts.radixPoint, maskedValue);
3435                            if (radixPosition === -1) {
3436                                processValue.push(opts.radixPoint);
3437                                radixPosition = processValue.length - 1;
3438                            }
3439                            for (var i = 1; i <= opts.digits; i++) {
3440                                if ((!opts.digitsOptional || opts.enforceDigitsOnBlur && currentResult.event === "blur") && (processValue[radixPosition + i] === undefined || processValue[radixPosition + i] === opts.placeholder.charAt(0))) {
3441                                    processValue[radixPosition + i] = currentResult.placeholder || opts.placeholder.charAt(0);
3442                                } else if (rpb !== -1 && maskedValue[rpb + i] !== undefined) {
3443                                    processValue[radixPosition + i] = processValue[radixPosition + i] || maskedValue[rpb + i];
3444                                }
3445                            }
3446                        }
3447                        if (opts.autoGroup === true && opts.groupSeparator !== "" && (charAtPos !== opts.radixPoint || currentResult.pos !== undefined || currentResult.dopost)) {
3448                            var addRadix = processValue[processValue.length - 1] === opts.radixPoint && currentResult.c === opts.radixPoint;
3449                            processValue = Inputmask(buildPostMask(processValue, opts), {
3450                                numericInput: true,
3451                                jitMasking: true,
3452                                definitions: {
3453                                    "*": {
3454                                        validator: "[0-9?]",
3455                                        cardinality: 1
3456                                    }
3457                                }
3458                            }).format(processValue.join(""));
3459                            if (addRadix) processValue += opts.radixPoint;
3460                            if (processValue.charAt(0) === opts.groupSeparator) {
3461                                processValue.substr(1);
3462                            }
3463                        } else processValue = processValue.join("");
3464                    }
3465                    if (opts.isNegative && currentResult.event === "blur") {
3466                        opts.isNegative = processValue !== "0";
3467                    }
3468                    processValue = prefix + processValue;
3469                    processValue += suffix;
3470                    if (opts.isNegative) {
3471                        processValue = opts.negationSymbol.front + processValue;
3472                        processValue += opts.negationSymbol.back;
3473                    }
3474                    processValue = processValue.split("");
3475                    if (charAtPos !== undefined) {
3476                        if (charAtPos !== opts.radixPoint && charAtPos !== opts.negationSymbol.front && charAtPos !== opts.negationSymbol.back) {
3477                            caretPos = $.inArray("?", processValue);
3478                            if (caretPos > -1) {
3479                                processValue[caretPos] = charAtPos;
3480                            } else caretPos = currentResult.caret || 0;
3481                        } else if (charAtPos === opts.radixPoint || charAtPos === opts.negationSymbol.front || charAtPos === opts.negationSymbol.back) {
3482                            var newCaretPos = $.inArray(charAtPos, processValue);
3483                            if (newCaretPos !== -1) caretPos = newCaretPos;
3484                        }
3485                    }
3486                    if (opts.numericInput) {
3487                        caretPos = processValue.length - caretPos - 1;
3488                        processValue = processValue.reverse();
3489                    }
3490                    var rslt = {
3491                        caret: (charAtPos === undefined || currentResult.pos !== undefined) && caretPos !== undefined ? caretPos + (opts.numericInput ? -1 : 1) : caretPos,
3492                        buffer: processValue,
3493                        refreshFromBuffer: currentResult.dopost || buffer.join("") !== processValue.join("")
3494                    };
3495                    return rslt.refreshFromBuffer ? rslt : currentResult;
3496                },
3497                onBeforeWrite: function onBeforeWrite(e, buffer, caretPos, opts) {
3498                    function parseMinMaxOptions(opts) {
3499                        if (opts.parseMinMaxOptions === undefined) {
3500                            if (opts.min !== null) {
3501                                opts.min = opts.min.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "");
3502                                if (opts.radixPoint === ",") opts.min = opts.min.replace(opts.radixPoint, ".");
3503                                opts.min = isFinite(opts.min) ? parseFloat(opts.min) : NaN;
3504                                if (isNaN(opts.min)) opts.min = Number.MIN_VALUE;
3505                            }
3506                            if (opts.max !== null) {
3507                                opts.max = opts.max.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "");
3508                                if (opts.radixPoint === ",") opts.max = opts.max.replace(opts.radixPoint, ".");
3509                                opts.max = isFinite(opts.max) ? parseFloat(opts.max) : NaN;
3510                                if (isNaN(opts.max)) opts.max = Number.MAX_VALUE;
3511                            }
3512                            opts.parseMinMaxOptions = "done";
3513                        }
3514                    }
3515                    if (e) {
3516                        switch (e.type) {
3517                          case "keydown":
3518                            return opts.postValidation(buffer, caretPos, {
3519                                caret: caretPos,
3520                                dopost: true
3521                            }, opts);
3522
3523                          case "blur":
3524                          case "checkval":
3525                            var unmasked;
3526                            parseMinMaxOptions(opts);
3527                            if (opts.min !== null || opts.max !== null) {
3528                                unmasked = opts.onUnMask(buffer.join(""), undefined, $.extend({}, opts, {
3529                                    unmaskAsNumber: true
3530                                }));
3531                                if (opts.min !== null && unmasked < opts.min) {
3532                                    opts.isNegative = opts.min < 0;
3533                                    return opts.postValidation(opts.min.toString().replace(".", opts.radixPoint).split(""), caretPos, {
3534                                        caret: caretPos,
3535                                        dopost: true,
3536                                        placeholder: "0"
3537                                    }, opts);
3538                                } else if (opts.max !== null && unmasked > opts.max) {
3539                                    opts.isNegative = opts.max < 0;
3540                                    return opts.postValidation(opts.max.toString().replace(".", opts.radixPoint).split(""), caretPos, {
3541                                        caret: caretPos,
3542                                        dopost: true,
3543                                        placeholder: "0"
3544                                    }, opts);
3545                                }
3546                            }
3547                            return opts.postValidation(buffer, caretPos, {
3548                                caret: caretPos,
3549                                placeholder: "0",
3550                                event: "blur"
3551                            }, opts);
3552
3553                          case "_checkval":
3554                            return {
3555                                caret: caretPos
3556                            };
3557
3558                          default:
3559                            break;
3560                        }
3561                    }
3562                },
3563                regex: {
3564                    integerPart: function integerPart(opts, emptyCheck) {
3565                        return emptyCheck ? new RegExp("[" + Inputmask.escapeRegex(opts.negationSymbol.front) + "+]?") : new RegExp("[" + Inputmask.escapeRegex(opts.negationSymbol.front) + "+]?\\d+");
3566                    },
3567                    integerNPart: function integerNPart(opts) {
3568                        return new RegExp("[\\d" + Inputmask.escapeRegex(opts.
3568groupSeparator) + Inputmask.escapeRegex(opts.placeholder.charAt(0)) + "]+");
3569                    }
3570                },
3571                definitions: {
3572                    "~": {
3573                        validator: function validator(chrs, maskset, pos, strict, opts, isSelection) {
3574                            var isValid, l;
3575                            if (chrs === "k" || chrs === "m") {
3576                                isValid = {
3577                                    insert: [],
3578                                    c: 0
3579                                };
3580                                for (var i = 0, l = chrs === "k" ? 2 : 5; i < l; i++) {
3581                                    isValid.insert.push({
3582                                        pos: pos + i,
3583                                        c: 0
3584                                    });
3585                                }
3586                                isValid.pos = pos + l;
3587                                return isValid;
3588                            }
3589                            isValid = strict ? new RegExp("[0-9" + Inputmask.escapeRegex(opts.groupSeparator) + "]").test(chrs) : new RegExp("[0-9]").test(chrs);
3590                            if (isValid === true) {
3591                                if (opts.numericInput !== true && maskset.validPositions[pos] !== undefined && maskset.validPositions[pos].match.def === "~" && !isSelection) {
3592                                    var processValue = maskset.buffer.join("");
3593                                    processValue = processValue.replace(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g"), "");
3594                                    processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), "");
3595                                    var pvRadixSplit = processValue.split(opts.radixPoint);
3596                                    if (pvRadixSplit.length > 1) {
3597                                        pvRadixSplit[1] = pvRadixSplit[1].replace(/0/g, opts.placeholder.charAt(0));
3598                                    }
3599                                    if (pvRadixSplit[0] === "0") {
3600                                        pvRadixSplit[0] = pvRadixSplit[0].replace(/0/g, opts.placeholder.charAt(0));
3601                                    }
3602                                    processValue = pvRadixSplit[0] + opts.radixPoint + pvRadixSplit[1] || "";
3603                                    var bufferTemplate = maskset._buffer.join("");
3604                                    if (processValue === opts.radixPoint) {
3605                                        processValue = bufferTemplate;
3606                                    }
3607                                    while (processValue.match(Inputmask.escapeRegex(bufferTemplate) + "$") === null) {
3608                                        bufferTemplate = bufferTemplate.slice(1);
3609                                    }
3610                                    processValue = processValue.replace(bufferTemplate, "");
3611                                    processValue = processValue.split("");
3612                                    if (processValue[pos] === undefined) {
3613                                        isValid = {
3614                                            pos: pos,
3615                                            remove: pos
3616                                        };
3617                                    } else {
3618                                        isValid = {
3619                                            pos: pos
3620                                        };
3621                                    }
3622                                }
3623                            } else if (!strict && chrs === opts.radixPoint && maskset.validPositions[pos - 1] === undefined) {
3624                                isValid = {
3625                                    insert: {
3626                                        pos: pos,
3627                                        c: 0
3628                                    },
3629                                    pos: pos + 1
3630                                };
3631                            }
3632                            return isValid;
3633                        },
3634                        cardinality: 1
3635                    },
3636                    "+": {
3637                        validator: function validator(chrs, maskset, pos, strict, opts) {
3638                            return opts.allowMinus && (chrs === "-" || chrs === opts.negationSymbol.front);
3639                        },
3640                        cardinality: 1,
3641                        placeholder: ""
3642                    },
3643                    "-": {
3644                        validator: function validator(chrs, maskset, pos, strict, opts) {
3645                            return opts.allowMinus && chrs === opts.negationSymbol.back;
3646                        },
3647                        cardinality: 1,
3648                        placeholder: ""
3649                    },
3650                    ":": {
3651                        validator: function validator(chrs, maskset, pos, strict, opts) {
3652                            var radix = "[" + Inputmask.escapeRegex(opts.radixPoint) + "]";
3653                            var isValid = new RegExp(radix).test(chrs);
3654                            if (isValid && maskset.validPositions[pos] && maskset.validPositions[pos].match.placeholder === opts.radixPoint) {
3655                                isValid = {
3656                                    caret: pos + 1
3657                                };
3658                            }
3659                            return isValid;
3660                        },
3661                        cardinality: 1,
3662                        placeholder: function placeholder(opts) {
3663                            return opts.radixPoint;
3664                        }
3665                    }
3666                },
3667                onUnMask: function onUnMask(maskedValue, unmaskedValue, opts) {
3668                    if (unmaskedValue === "" && opts.nullable === true) {
3669                        return unmaskedValue;
3670                    }
3671                    var processValue = maskedValue.replace(opts.prefix, "");
3672                    processValue = processValue.replace(opts.suffix, "");
3673                    processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "");
3674                    if (opts.placeholder.charAt(0) !== "") {
3675                        processValue = processValue.replace(new RegExp(opts.placeholder.charAt(0), "g"), "0");
3676                    }
3677                    if (opts.unmaskAsNumber) {
3678                        if (opts.radixPoint !== "" && processValue.indexOf(opts.radixPoint) !== -1) processValue = processValue.replace(Inputmask.escapeRegex.call(this, opts.radixPoint), ".");
3679                        processValue = processValue.replace(new RegExp("^" + Inputmask.escapeRegex(opts.negationSymbol.front)), "-");
3680                        processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), "");
3681                        return Number(processValue);
3682                    }
3683                    return processValue;
3684                },
3685                isComplete: function isComplete(buffer, opts) {
3686                    var maskedValue = (opts.numericInput ? buffer.slice().reverse() : buffer).join("");
3687                    maskedValue = maskedValue.replace(new RegExp("^" + Inputmask.escapeRegex(opts.negationSymbol.front)), "-");
3688                    maskedValue = maskedValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), "");
3689                    maskedValue = maskedValue.replace(opts.prefix, "");
3690                    maskedValue = maskedValue.replace(opts.suffix, "");
3691                    maskedValue = maskedValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator) + "([0-9]{3})", "g"), "$1");
3692                    if (opts.radixPoint === ",") maskedValue = maskedValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".");
3693                    return isFinite(maskedValue);
3694                },
3695                onBeforeMask: function onBeforeMask(initialValue, opts) {
3696                    opts.isNegative = undefined;
3697                    var radixPoint = opts.radixPoint || ",";
3698                    if ((typeof initialValue == "number" || opts.inputType === "number") && radixPoint !== "") {
3699                        initialValue = initialValue.toString().replace(".", radixPoint);
3700                    }
3701                    var valueParts = initialValue.split(radixPoint), integerPart = valueParts[0].replace(/[^\-0-9]/g, ""), decimalPart = valueParts.length > 1 ? valueParts[1].replace(/[^0-9]/g, "") : "";
3702                    initialValue = integerPart + (decimalPart !== "" ? radixPoint + decimalPart : decimalPart);
3703                    var digits = 0;
3704                    if (radixPoint !== "") {
3705                        digits = decimalPart.length;
3706                        if (decimalPart !== "") {
3707                            var digitsFactor = Math.pow(10, digits || 1);
3708                            if (isFinite(opts.digits)) {
3709                                digits = parseInt(opts.digits);
3710                                digitsFactor = Math.pow(10, digits);
3711                            }
3712                            initialValue = initialValue.replace(Inputmask.escapeRegex(radixPoint), ".");
3713                            if (isFinite(initialValue)) initialValue = Math.round(parseFloat(initialValue) * digitsFactor) / digitsFactor;
3714                            initialValue = initialValue.toString().replace(".", radixPoint);
3715                        }
3716                    }
3717                    if (opts.digits === 0 && initialValue.indexOf(Inputmask.escapeRegex(radixPoint)) !== -1) {
3718                        initialValue = initialValue.substring(0, initialValue.indexOf(Inputmask.escapeRegex(radixPoint)));
3719                    }
3720                    return alignDigits(initialValue.toString().split(""), digits, opts).join("");
3721                },
3722                onKeyDown: function onKeyDown(e, buffer, caretPos, opts) {
3723                    var $input = $(this);
3724                    if (e.ctrlKey) {
3725                        switch (e.keyCode) {
3726                          case Inputmask.keyCode.UP:
3727                            $input.val(parseFloat(this.inputmask.unmaskedvalue()) + parseInt(opts.step));
3728                            $input.trigger("setvalue");
3729                            break;
3730
3731                          case Inputmask.keyCode.DOWN:
3732                            $input.val(parseFloat(this.inputmask.unmaskedvalue()) - parseInt(opts.step));
3733                            $input.trigger("setvalue");
3734                            break;
3735                        }
3736                    }
3737                }
3738            },
3739            currency: {
3740                prefix: "$ ",
3741                groupSeparator: ",",
3742                alias: "numeric",
3743                placeholder: "0",
3744                autoGroup: true,
3745                digits: 2,
3746                digitsOptional: false,
3747                clearMaskOnLostFocus: false
3748            },
3749            decimal: {
3750                alias: "numeric"
3751            },
3752            integer: {
3753                alias: "numeric",
3754                digits: 0,
3755                radixPoint: ""
3756            },
3757            percentage: {
3758                alias: "numeric",
3759                digits: 2,
3760                digitsOptional: true,
3761                radixPoint: ".",
3762                placeholder: "0",
3763                autoGroup: false,
3764                min: 0,
3765                max: 100,
3766                suffix: " %",
3767                allowMinus: false
3768            }
3769        });
3770        return Inputmask;
3771    });
3772}, function(module, exports, __webpack_require__) {
3773    "use strict";
3774    var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
3775    var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
3776        return typeof obj;
3777    } : function(obj) {
3778        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
3779    };
3780    (function(factory) {
3781        if (true) {
3782            !(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(4), __webpack_require__(2) ], 
3783            __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__, 
3784            __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
3785        } else {}
3786    })(function($, Inputmask) {
3787        if ($.fn.inputmask === undefined) {
3788            $.fn.inputmask = function(fn, options) {
3789                var nptmask, input = this[0];
3790                if (options === undefined) options = {};
3791                if (typeof fn === "string") {
3792                    switch (fn) {
3793                      case "unmaskedvalue":
3794                        return input && input.inputmask ? input.inputmask.unmaskedvalue() : $(input).val();
3795
3796                      case "remove":
3797                        return this.each(function() {
3798                            if (this.inputmask) this.inputmask.remove();
3799                        });
3800
3801                      case "getemptymask":
3802                        return input && input.inputmask ? input.inputmask.getemptymask() : "";
3803
3804                      case "hasMaskedValue":
3805                        return input && input.inputmask ? input.inputmask.hasMaskedValue() : false;
3806
3807                      case "isComplete":
3808                        return input && input.inputmask ? input.inputmask.isComplete() : true;
3809
3810                      case "getmetadata":
3811                        return input && input.inputmask ? input.inputmask.getmetadata() : undefined;
3812
3813                      case "setvalue":
3814                        Inputmask.setValue(input, options);
3815                        break;
3816
3817                      case "option":
3818                        if (typeof options === "string") {
3819                            if (input && input.inputmask !== undefined) {
3820                                return input.inputmask.option(options);
3821                            }
3822                        } else {
3823                            return this.each(function() {
3824                                if (this.inputmask !== undefined) {
3825                                    return this.inputmask.option(options);
3826                                }
3827                            });
3828                        }
3829                        break;
3830
3831                      default:
3832                        options.alias = fn;
3833                        nptmask = new Inputmask(options);
3834                        return this.each(function() {
3835                            nptmask.mask(this);
3836                        });
3837                    }
3838                } else if (Array.isArray(fn)) {
3839                    options.alias = fn;
3840                    nptmask = new Inputmask(options);
3841                    return this.each(function() {
3842                        nptmask.mask(this);
3843                    });
3844                } else if ((typeof fn === "undefined" ? "undefined" : _typeof(fn)) == "object") {
3845                    nptmask = new Inputmask(fn);
3846                    if (fn.mask === undefined && fn.alias === undefined) {
3847                        return this.each(function() {
3848                            if (this.inputmask !== undefined) {
3849                                return this.inputmask.option(fn);
3850                            } else nptmask.mask(this);
3851                        });
3852                    } else {
3853                        return this.each(function() {
3854                            nptmask.mask(this);
3855                        });
3856                    }
3857                } else if (fn === undefined) {
3858                    return this.each(function() {
3859                        nptmask = new Inputmask(options);
3860                        nptmask.mask(this);
3861                    });
3862                }
3863            };
3864        }
3865        return $.fn.inputmask;
3866    });
3867} ]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.