jquery_inputmask_rails 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2405 @@
1
+ /*!
2
+ * dist/jquery.inputmask
3
+ * https://github.com/RobinHerbots/Inputmask
4
+ * Copyright (c) 2010 - 2019 Robin Herbots
5
+ * Licensed under the MIT license
6
+ * Version: 5.0.0-beta.184
7
+ */
8
+ !function webpackUniversalModuleDefinition(root, factory) {
9
+ if ("object" == typeof exports && "object" == typeof module) module.exports = factory(require("jquery")); else if ("function" == typeof define && define.amd) define([ "jquery" ], factory); else {
10
+ var a = "object" == typeof exports ? factory(require("jquery")) : factory(root.jQuery);
11
+ for (var i in a) ("object" == typeof exports ? exports : root)[i] = a[i];
12
+ }
13
+ }(window, function(__WEBPACK_EXTERNAL_MODULE__5__) {
14
+ return modules = [ function(module, exports, __webpack_require__) {
15
+ var im = __webpack_require__(1), jQuery = __webpack_require__(5);
16
+ im.dependencyLib === jQuery && __webpack_require__(11), module.exports = im;
17
+ }, function(module, exports, __webpack_require__) {
18
+ __webpack_require__(2), __webpack_require__(9), __webpack_require__(10), module.exports = __webpack_require__(3);
19
+ }, function(module, exports, __webpack_require__) {
20
+ var Inputmask = __webpack_require__(3);
21
+ Inputmask.extendDefinitions({
22
+ A: {
23
+ validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
24
+ casing: "upper"
25
+ },
26
+ "&": {
27
+ validator: "[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
28
+ casing: "upper"
29
+ },
30
+ "#": {
31
+ validator: "[0-9A-Fa-f]",
32
+ casing: "upper"
33
+ }
34
+ }), Inputmask.extendAliases({
35
+ cssunit: {
36
+ regex: "[+-]?[0-9]+\\.?([0-9]+)?(px|em|rem|ex|%|in|cm|mm|pt|pc)"
37
+ },
38
+ url: {
39
+ regex: "(https?|ftp)//.*",
40
+ autoUnmask: !1
41
+ },
42
+ ip: {
43
+ mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
44
+ definitions: {
45
+ i: {
46
+ validator: function validator(chrs, maskset, pos, strict, opts) {
47
+ return chrs = -1 < pos - 1 && "." !== maskset.buffer[pos - 1] ? (chrs = maskset.buffer[pos - 1] + chrs,
48
+ -1 < pos - 2 && "." !== maskset.buffer[pos - 2] ? maskset.buffer[pos - 2] + chrs : "0" + chrs) : "00" + chrs,
49
+ new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
50
+ }
51
+ }
52
+ },
53
+ onUnMask: function onUnMask(maskedValue, unmaskedValue, opts) {
54
+ return maskedValue;
55
+ },
56
+ inputmode: "numeric"
57
+ },
58
+ email: {
59
+ mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]",
60
+ greedy: !1,
61
+ casing: "lower",
62
+ onBeforePaste: function onBeforePaste(pastedValue, opts) {
63
+ return pastedValue = pastedValue.toLowerCase(), pastedValue.replace("mailto:", "");
64
+ },
65
+ definitions: {
66
+ "*": {
67
+ validator: "[0-9\uff11-\uff19A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5!#$%&'*+/=?^_`{|}~-]"
68
+ },
69
+ "-": {
70
+ validator: "[0-9A-Za-z-]"
71
+ }
72
+ },
73
+ onUnMask: function onUnMask(maskedValue, unmaskedValue, opts) {
74
+ return maskedValue;
75
+ },
76
+ inputmode: "email"
77
+ },
78
+ mac: {
79
+ mask: "##:##:##:##:##:##"
80
+ },
81
+ vin: {
82
+ mask: "V{13}9{4}",
83
+ definitions: {
84
+ V: {
85
+ validator: "[A-HJ-NPR-Za-hj-npr-z\\d]",
86
+ casing: "upper"
87
+ }
88
+ },
89
+ clearIncomplete: !0,
90
+ autoUnmask: !0
91
+ }
92
+ }), module.exports = Inputmask;
93
+ }, function(module, exports, __webpack_require__) {
94
+ function _typeof(obj) {
95
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function _typeof(obj) {
96
+ return typeof obj;
97
+ } : function _typeof(obj) {
98
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
99
+ }, _typeof(obj);
100
+ }
101
+ var $ = __webpack_require__(4), window = __webpack_require__(6), document = window.document, generateMaskSet = __webpack_require__(7).generateMaskSet, analyseMask = __webpack_require__(7).analyseMask, maskScope = __webpack_require__(8);
102
+ function Inputmask(alias, options, internal) {
103
+ if (!(this instanceof Inputmask)) return new Inputmask(alias, options, internal);
104
+ this.el = void 0, this.events = {}, this.maskset = void 0, this.refreshValue = !1,
105
+ !0 !== internal && ($.isPlainObject(alias) ? options = alias : (options = options || {},
106
+ alias && (options.alias = alias)), this.opts = $.extend(!0, {}, this.defaults, options),
107
+ this.noMasksCache = options && void 0 !== options.definitions, this.userOptions = options || {},
108
+ resolveAlias(this.opts.alias, options, this.opts), this.isRTL = this.opts.numericInput);
109
+ }
110
+ function resolveAlias(aliasStr, options, opts) {
111
+ var aliasDefinition = Inputmask.prototype.aliases[aliasStr];
112
+ return aliasDefinition ? (aliasDefinition.alias && resolveAlias(aliasDefinition.alias, void 0, opts),
113
+ $.extend(!0, opts, aliasDefinition), $.extend(!0, opts, options), !0) : (null === opts.mask && (opts.mask = aliasStr),
114
+ !1);
115
+ }
116
+ function importAttributeOptions(npt, opts, userOptions, dataAttribute) {
117
+ function importOption(option, optionData) {
118
+ optionData = void 0 !== optionData ? optionData : npt.getAttribute(dataAttribute + "-" + option),
119
+ null !== optionData && ("string" == typeof optionData && (0 === option.indexOf("on") ? optionData = window[optionData] : "false" === optionData ? optionData = !1 : "true" === optionData && (optionData = !0)),
120
+ userOptions[option] = optionData);
121
+ }
122
+ if (!0 === opts.importDataAttributes) {
123
+ var attrOptions = npt.getAttribute(dataAttribute), option, dataoptions, optionData, p;
124
+ if (attrOptions && "" !== attrOptions && (attrOptions = attrOptions.replace(/'/g, '"'),
125
+ dataoptions = JSON.parse("{" + attrOptions + "}")), dataoptions) for (p in optionData = void 0,
126
+ dataoptions) if ("alias" === p.toLowerCase()) {
127
+ optionData = dataoptions[p];
128
+ break;
129
+ }
130
+ for (option in importOption("alias", optionData), userOptions.alias && resolveAlias(userOptions.alias, userOptions, opts),
131
+ opts) {
132
+ if (dataoptions) for (p in optionData = void 0, dataoptions) if (p.toLowerCase() === option.toLowerCase()) {
133
+ optionData = dataoptions[p];
134
+ break;
135
+ }
136
+ importOption(option, optionData);
137
+ }
138
+ }
139
+ return $.extend(!0, opts, userOptions), ("rtl" === npt.dir || opts.rightAlign) && (npt.style.textAlign = "right"),
140
+ ("rtl" === npt.dir || opts.numericInput) && (npt.dir = "ltr", npt.removeAttribute("dir"),
141
+ opts.isRTL = !0), Object.keys(userOptions).length;
142
+ }
143
+ Inputmask.prototype = {
144
+ dataAttribute: "data-inputmask",
145
+ defaults: {
146
+ placeholder: "_",
147
+ optionalmarker: [ "[", "]" ],
148
+ quantifiermarker: [ "{", "}" ],
149
+ groupmarker: [ "(", ")" ],
150
+ alternatormarker: "|",
151
+ escapeChar: "\\",
152
+ mask: null,
153
+ regex: null,
154
+ oncomplete: $.noop,
155
+ onincomplete: $.noop,
156
+ oncleared: $.noop,
157
+ repeat: 0,
158
+ greedy: !1,
159
+ autoUnmask: !1,
160
+ removeMaskOnSubmit: !1,
161
+ clearMaskOnLostFocus: !0,
162
+ insertMode: !0,
163
+ clearIncomplete: !1,
164
+ alias: null,
165
+ onKeyDown: $.noop,
166
+ onBeforeMask: null,
167
+ onBeforePaste: function onBeforePaste(pastedValue, opts) {
168
+ return $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(this, pastedValue, opts) : pastedValue;
169
+ },
170
+ onBeforeWrite: null,
171
+ onUnMask: null,
172
+ showMaskOnFocus: !0,
173
+ showMaskOnHover: !0,
174
+ onKeyValidation: $.noop,
175
+ skipOptionalPartCharacter: " ",
176
+ numericInput: !1,
177
+ rightAlign: !1,
178
+ undoOnEscape: !0,
179
+ radixPoint: "",
180
+ _radixDance: !1,
181
+ groupSeparator: "",
182
+ keepStatic: null,
183
+ positionCaretOnTab: !0,
184
+ tabThrough: !1,
185
+ supportsInputType: [ "text", "tel", "url", "password", "search" ],
186
+ 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 ],
187
+ isComplete: null,
188
+ preValidation: null,
189
+ postValidation: null,
190
+ staticDefinitionSymbol: void 0,
191
+ jitMasking: !1,
192
+ nullable: !0,
193
+ inputEventOnly: !1,
194
+ noValuePatching: !1,
195
+ positionCaretOnClick: "lvp",
196
+ casing: null,
197
+ inputmode: "verbatim",
198
+ colorMask: !1,
199
+ disablePredictiveText: !1,
200
+ importDataAttributes: !0,
201
+ shiftPositions: !0
202
+ },
203
+ definitions: {
204
+ 9: {
205
+ validator: "[0-9\uff11-\uff19]",
206
+ definitionSymbol: "*"
207
+ },
208
+ a: {
209
+ validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
210
+ definitionSymbol: "*"
211
+ },
212
+ "*": {
213
+ validator: "[0-9\uff11-\uff19A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]"
214
+ }
215
+ },
216
+ aliases: {},
217
+ masksCache: {},
218
+ mask: function mask(elems) {
219
+ var that = this;
220
+ return "string" == typeof elems && (elems = document.getElementById(elems) || document.querySelectorAll(elems)),
221
+ elems = elems.nodeName ? [ elems ] : elems, $.each(elems, function(ndx, el) {
222
+ var scopedOpts = $.extend(!0, {}, that.opts);
223
+ if (importAttributeOptions(el, scopedOpts, $.extend(!0, {}, that.userOptions), that.dataAttribute)) {
224
+ var maskset = generateMaskSet(scopedOpts, that.noMasksCache);
225
+ void 0 !== maskset && (void 0 !== el.inputmask && (el.inputmask.opts.autoUnmask = !0,
226
+ el.inputmask.remove()), el.inputmask = new Inputmask(void 0, void 0, !0), el.inputmask.opts = scopedOpts,
227
+ el.inputmask.noMasksCache = that.noMasksCache, el.inputmask.userOptions = $.extend(!0, {}, that.userOptions),
228
+ el.inputmask.isRTL = scopedOpts.isRTL || scopedOpts.numericInput, el.inputmask.el = el,
229
+ el.inputmask.maskset = maskset, $.data(el, "_inputmask_opts", scopedOpts), maskScope.call(el.inputmask, {
230
+ action: "mask"
231
+ }));
232
+ }
233
+ }), elems && elems[0] && elems[0].inputmask || this;
234
+ },
235
+ option: function option(options, noremask) {
236
+ return "string" == typeof options ? this.opts[options] : "object" === _typeof(options) ? ($.extend(this.userOptions, options),
237
+ this.el && !0 !== noremask && this.mask(this.el), this) : void 0;
238
+ },
239
+ unmaskedvalue: function unmaskedvalue(value) {
240
+ return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
241
+ maskScope.call(this, {
242
+ action: "unmaskedvalue",
243
+ value: value
244
+ });
245
+ },
246
+ remove: function remove() {
247
+ return maskScope.call(this, {
248
+ action: "remove"
249
+ });
250
+ },
251
+ getemptymask: function getemptymask() {
252
+ return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
253
+ maskScope.call(this, {
254
+ action: "getemptymask"
255
+ });
256
+ },
257
+ hasMaskedValue: function hasMaskedValue() {
258
+ return !this.opts.autoUnmask;
259
+ },
260
+ isComplete: function isComplete() {
261
+ return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
262
+ maskScope.call(this, {
263
+ action: "isComplete"
264
+ });
265
+ },
266
+ getmetadata: function getmetadata() {
267
+ return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
268
+ maskScope.call(this, {
269
+ action: "getmetadata"
270
+ });
271
+ },
272
+ isValid: function isValid(value) {
273
+ return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
274
+ maskScope.call(this, {
275
+ action: "isValid",
276
+ value: value
277
+ });
278
+ },
279
+ format: function format(value, metadata) {
280
+ return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache),
281
+ maskScope.call(this, {
282
+ action: "format",
283
+ value: value,
284
+ metadata: metadata
285
+ });
286
+ },
287
+ setValue: function setValue(value) {
288
+ this.el && $(this.el).trigger("setvalue", [ value ]);
289
+ },
290
+ analyseMask: analyseMask,
291
+ positionColorMask: function positionColorMask(input, template) {
292
+ input.style.left = template.offsetLeft + "px";
293
+ }
294
+ }, Inputmask.extendDefaults = function(options) {
295
+ $.extend(!0, Inputmask.prototype.defaults, options);
296
+ }, Inputmask.extendDefinitions = function(definition) {
297
+ $.extend(!0, Inputmask.prototype.definitions, definition);
298
+ }, Inputmask.extendAliases = function(alias) {
299
+ $.extend(!0, Inputmask.prototype.aliases, alias);
300
+ }, Inputmask.format = function(value, options, metadata) {
301
+ return Inputmask(options).format(value, metadata);
302
+ }, Inputmask.unmask = function(value, options) {
303
+ return Inputmask(options).unmaskedvalue(value);
304
+ }, Inputmask.isValid = function(value, options) {
305
+ return Inputmask(options).isValid(value);
306
+ }, Inputmask.remove = function(elems) {
307
+ "string" == typeof elems && (elems = document.getElementById(elems) || document.querySelectorAll(elems)),
308
+ elems = elems.nodeName ? [ elems ] : elems, $.each(elems, function(ndx, el) {
309
+ el.inputmask && el.inputmask.remove();
310
+ });
311
+ }, Inputmask.setValue = function(elems, value) {
312
+ "string" == typeof elems && (elems = document.getElementById(elems) || document.querySelectorAll(elems)),
313
+ elems = elems.nodeName ? [ elems ] : elems, $.each(elems, function(ndx, el) {
314
+ el.inputmask ? el.inputmask.setValue(value) : $(el).trigger("setvalue", [ value ]);
315
+ });
316
+ }, Inputmask.escapeRegex = function(str) {
317
+ var specials = [ "/", ".", "*", "+", "?", "|", "(", ")", "[", "]", "{", "}", "\\", "$", "^" ];
318
+ return str.replace(new RegExp("(\\" + specials.join("|\\") + ")", "gim"), "\\$1");
319
+ }, Inputmask.keyCode = {
320
+ BACKSPACE: 8,
321
+ BACKSPACE_SAFARI: 127,
322
+ DELETE: 46,
323
+ DOWN: 40,
324
+ END: 35,
325
+ ENTER: 13,
326
+ ESCAPE: 27,
327
+ HOME: 36,
328
+ INSERT: 45,
329
+ LEFT: 37,
330
+ PAGE_DOWN: 34,
331
+ PAGE_UP: 33,
332
+ RIGHT: 39,
333
+ SPACE: 32,
334
+ TAB: 9,
335
+ UP: 38,
336
+ X: 88,
337
+ CONTROL: 17
338
+ }, Inputmask.dependencyLib = $, window.Inputmask = Inputmask, module.exports = Inputmask;
339
+ }, function(module, exports, __webpack_require__) {
340
+ module.exports = __webpack_require__(5);
341
+ }, function(module, exports) {
342
+ module.exports = __WEBPACK_EXTERNAL_MODULE__5__;
343
+ }, function(module, exports, __webpack_require__) {
344
+ var __WEBPACK_AMD_DEFINE_RESULT__;
345
+ function _typeof(obj) {
346
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function _typeof(obj) {
347
+ return typeof obj;
348
+ } : function _typeof(obj) {
349
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
350
+ }, _typeof(obj);
351
+ }
352
+ __WEBPACK_AMD_DEFINE_RESULT__ = function() {
353
+ return "undefined" != typeof window ? window : new (eval("require('jsdom').JSDOM"))("").window;
354
+ }.call(exports, __webpack_require__, exports, module), void 0 === __WEBPACK_AMD_DEFINE_RESULT__ || (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
355
+ }, function(module, exports, __webpack_require__) {
356
+ var $ = __webpack_require__(4);
357
+ function generateMaskSet(opts, nocache) {
358
+ var ms;
359
+ function generateMask(mask, metadata, opts) {
360
+ var regexMask = !1, masksetDefinition, maskdefKey;
361
+ if (null !== mask && "" !== mask || (regexMask = null !== opts.regex, mask = regexMask ? (mask = opts.regex,
362
+ mask.replace(/^(\^)(.*)(\$)$/, "$2")) : (regexMask = !0, ".*")), 1 === mask.length && !1 === opts.greedy && 0 !== opts.repeat && (opts.placeholder = ""),
363
+ 0 < opts.repeat || "*" === opts.repeat || "+" === opts.repeat) {
364
+ var repeatStart = "*" === opts.repeat ? 0 : "+" === opts.repeat ? 1 : opts.repeat;
365
+ mask = opts.groupmarker[0] + mask + opts.groupmarker[1] + opts.quantifiermarker[0] + repeatStart + "," + opts.repeat + opts.quantifiermarker[1];
366
+ }
367
+ return maskdefKey = regexMask ? "regex_" + opts.regex : opts.numericInput ? mask.split("").reverse().join("") : mask,
368
+ !1 !== opts.keepStatic && (maskdefKey = "ks_" + maskdefKey), void 0 === Inputmask.prototype.masksCache[maskdefKey] || !0 === nocache ? (masksetDefinition = {
369
+ mask: mask,
370
+ maskToken: Inputmask.prototype.analyseMask(mask, regexMask, opts),
371
+ validPositions: {},
372
+ _buffer: void 0,
373
+ buffer: void 0,
374
+ tests: {},
375
+ excludes: {},
376
+ metadata: metadata,
377
+ maskLength: void 0,
378
+ jitOffset: {}
379
+ }, !0 !== nocache && (Inputmask.prototype.masksCache[maskdefKey] = masksetDefinition,
380
+ masksetDefinition = $.extend(!0, {}, Inputmask.prototype.masksCache[maskdefKey]))) : masksetDefinition = $.extend(!0, {}, Inputmask.prototype.masksCache[maskdefKey]),
381
+ masksetDefinition;
382
+ }
383
+ if ($.isFunction(opts.mask) && (opts.mask = opts.mask(opts)), $.isArray(opts.mask)) {
384
+ if (1 < opts.mask.length) {
385
+ if (null === opts.keepStatic) {
386
+ opts.keepStatic = "auto";
387
+ for (var i = 0; i < opts.mask.length; i++) if (opts.mask[i].charAt(0) !== opts.mask[0].charAt(0)) {
388
+ opts.keepStatic = !0;
389
+ break;
390
+ }
391
+ }
392
+ var altMask = opts.groupmarker[0];
393
+ return $.each(opts.isRTL ? opts.mask.reverse() : opts.mask, function(ndx, msk) {
394
+ 1 < altMask.length && (altMask += opts.groupmarker[1] + opts.alternatormarker + opts.groupmarker[0]),
395
+ void 0 === msk.mask || $.isFunction(msk.mask) ? altMask += msk : altMask += msk.mask;
396
+ }), altMask += opts.groupmarker[1], generateMask(altMask, opts.mask, opts);
397
+ }
398
+ opts.mask = opts.mask.pop();
399
+ }
400
+ return ms = opts.mask && void 0 !== opts.mask.mask && !$.isFunction(opts.mask.mask) ? generateMask(opts.mask.mask, opts.mask, opts) : generateMask(opts.mask, opts.mask, opts),
401
+ ms;
402
+ }
403
+ function analyseMask(mask, regexMask, opts) {
404
+ 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 = !1, currentToken = new MaskToken(), match, m, openenings = [], maskTokens = [], openingToken, currentOpeningToken, alternator, lastMatch, closeRegexGroup = !1;
405
+ function MaskToken(isGroup, isOptional, isQuantifier, isAlternator) {
406
+ this.matches = [], this.openGroup = isGroup || !1, this.alternatorGroup = !1, this.isGroup = isGroup || !1,
407
+ this.isOptional = isOptional || !1, this.isQuantifier = isQuantifier || !1, this.isAlternator = isAlternator || !1,
408
+ this.quantifier = {
409
+ min: 1,
410
+ max: 1
411
+ };
412
+ }
413
+ function insertTestDefinition(mtoken, element, position) {
414
+ position = void 0 !== position ? position : mtoken.matches.length;
415
+ var prevMatch = mtoken.matches[position - 1];
416
+ if (regexMask) 0 === element.indexOf("[") || escaped && /\\d|\\s|\\w]/i.test(element) || "." === element ? mtoken.matches.splice(position++, 0, {
417
+ fn: new RegExp(element, opts.casing ? "i" : ""),
418
+ static: !1,
419
+ optionality: !1,
420
+ newBlockMarker: void 0 === prevMatch ? "master" : prevMatch.def !== element,
421
+ casing: null,
422
+ def: element,
423
+ placeholder: void 0,
424
+ nativeDef: element
425
+ }) : (escaped && (element = element[element.length - 1]), $.each(element.split(""), function(ndx, lmnt) {
426
+ prevMatch = mtoken.matches[position - 1], mtoken.matches.splice(position++, 0, {
427
+ fn: /[a-z]/i.test(opts.staticDefinitionSymbol || lmnt) ? new RegExp("[" + (opts.staticDefinitionSymbol || lmnt) + "]", opts.casing ? "i" : "") : null,
428
+ static: !0,
429
+ optionality: !1,
430
+ newBlockMarker: void 0 === prevMatch ? "master" : prevMatch.def !== lmnt && !0 !== prevMatch.static,
431
+ casing: null,
432
+ def: opts.staticDefinitionSymbol || lmnt,
433
+ placeholder: void 0 !== opts.staticDefinitionSymbol ? lmnt : void 0,
434
+ nativeDef: (escaped ? "'" : "") + lmnt
435
+ });
436
+ })), escaped = !1; else {
437
+ var maskdef = (opts.definitions ? opts.definitions[element] : void 0) || Inputmask.prototype.definitions[element];
438
+ maskdef && !escaped ? mtoken.matches.splice(position++, 0, {
439
+ fn: maskdef.validator ? "string" == typeof maskdef.validator ? new RegExp(maskdef.validator, opts.casing ? "i" : "") : new function() {
440
+ this.test = maskdef.validator;
441
+ }() : new RegExp("."),
442
+ static: !1,
443
+ optionality: !1,
444
+ newBlockMarker: void 0 === prevMatch ? "master" : prevMatch.def !== (maskdef.definitionSymbol || element),
445
+ casing: maskdef.casing,
446
+ def: maskdef.definitionSymbol || element,
447
+ placeholder: maskdef.placeholder,
448
+ nativeDef: element
449
+ }) : (mtoken.matches.splice(position++, 0, {
450
+ fn: /[a-z]/i.test(opts.staticDefinitionSymbol || element) ? new RegExp("[" + (opts.staticDefinitionSymbol || element) + "]", opts.casing ? "i" : "") : null,
451
+ static: !0,
452
+ optionality: !1,
453
+ newBlockMarker: void 0 === prevMatch ? "master" : prevMatch.def !== element && !0 !== prevMatch.static,
454
+ casing: null,
455
+ def: opts.staticDefinitionSymbol || element,
456
+ placeholder: void 0 !== opts.staticDefinitionSymbol ? element : void 0,
457
+ nativeDef: (escaped ? "'" : "") + element
458
+ }), escaped = !1);
459
+ }
460
+ }
461
+ function verifyGroupMarker(maskToken) {
462
+ maskToken && maskToken.matches && $.each(maskToken.matches, function(ndx, token) {
463
+ var nextToken = maskToken.matches[ndx + 1];
464
+ (void 0 === nextToken || void 0 === nextToken.matches || !1 === nextToken.isQuantifier) && token && token.isGroup && (token.isGroup = !1,
465
+ regexMask || (insertTestDefinition(token, opts.groupmarker[0], 0), !0 !== token.openGroup && insertTestDefinition(token, opts.groupmarker[1]))),
466
+ verifyGroupMarker(token);
467
+ });
468
+ }
469
+ function defaultCase() {
470
+ if (0 < openenings.length) {
471
+ if (currentOpeningToken = openenings[openenings.length - 1], insertTestDefinition(currentOpeningToken, m),
472
+ currentOpeningToken.isAlternator) {
473
+ alternator = openenings.pop();
474
+ for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup && (alternator.matches[mndx].isGroup = !1);
475
+ 0 < openenings.length ? (currentOpeningToken = openenings[openenings.length - 1],
476
+ currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator);
477
+ }
478
+ } else insertTestDefinition(currentToken, m);
479
+ }
480
+ function reverseTokens(maskToken) {
481
+ function reverseStatic(st) {
482
+ return st === opts.optionalmarker[0] ? st = opts.optionalmarker[1] : st === opts.optionalmarker[1] ? st = opts.optionalmarker[0] : st === opts.groupmarker[0] ? st = opts.groupmarker[1] : st === opts.groupmarker[1] && (st = opts.groupmarker[0]),
483
+ st;
484
+ }
485
+ for (var match in maskToken.matches = maskToken.matches.reverse(), maskToken.matches) if (maskToken.matches.hasOwnProperty(match)) {
486
+ var intMatch = parseInt(match);
487
+ if (maskToken.matches[match].isQuantifier && maskToken.matches[intMatch + 1] && maskToken.matches[intMatch + 1].isGroup) {
488
+ var qt = maskToken.matches[match];
489
+ maskToken.matches.splice(match, 1), maskToken.matches.splice(intMatch + 1, 0, qt);
490
+ }
491
+ void 0 !== maskToken.matches[match].matches ? maskToken.matches[match] = reverseTokens(maskToken.matches[match]) : maskToken.matches[match] = reverseStatic(maskToken.matches[match]);
492
+ }
493
+ return maskToken;
494
+ }
495
+ function groupify(matches) {
496
+ var groupToken = new MaskToken(!0);
497
+ return groupToken.openGroup = !1, groupToken.matches = matches, groupToken;
498
+ }
499
+ function closeGroup() {
500
+ if (openingToken = openenings.pop(), openingToken.openGroup = !1, void 0 !== openingToken) if (0 < openenings.length) {
501
+ if (currentOpeningToken = openenings[openenings.length - 1], currentOpeningToken.matches.push(openingToken),
502
+ currentOpeningToken.isAlternator) {
503
+ alternator = openenings.pop();
504
+ for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup = !1,
505
+ alternator.matches[mndx].alternatorGroup = !1;
506
+ 0 < openenings.length ? (currentOpeningToken = openenings[openenings.length - 1],
507
+ currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator);
508
+ }
509
+ } else currentToken.matches.push(openingToken); else defaultCase();
510
+ }
511
+ function groupQuantifier(matches) {
512
+ var lastMatch = matches.pop();
513
+ return lastMatch.isQuantifier && (lastMatch = groupify([ matches.pop(), lastMatch ])),
514
+ lastMatch;
515
+ }
516
+ for (regexMask && (opts.optionalmarker[0] = void 0, opts.optionalmarker[1] = void 0); match = regexMask ? regexTokenizer.exec(mask) : tokenizer.exec(mask); ) {
517
+ if (m = match[0], regexMask) switch (m.charAt(0)) {
518
+ case "?":
519
+ m = "{0,1}";
520
+ break;
521
+
522
+ case "+":
523
+ case "*":
524
+ m = "{" + m + "}";
525
+ break;
526
+
527
+ case "|":
528
+ if (0 === openenings.length) {
529
+ var altRegexGroup = groupify(currentToken.matches);
530
+ altRegexGroup.openGroup = !0, openenings.push(altRegexGroup), currentToken.matches = [],
531
+ closeRegexGroup = !0;
532
+ }
533
+ break;
534
+ }
535
+ if (escaped) defaultCase(); else switch (m.charAt(0)) {
536
+ case "(?=":
537
+ break;
538
+
539
+ case "(?!":
540
+ break;
541
+
542
+ case "(?<=":
543
+ break;
544
+
545
+ case "(?<!":
546
+ break;
547
+
548
+ case opts.escapeChar:
549
+ escaped = !0, regexMask && defaultCase();
550
+ break;
551
+
552
+ case opts.optionalmarker[1]:
553
+ case opts.groupmarker[1]:
554
+ closeGroup();
555
+ break;
556
+
557
+ case opts.optionalmarker[0]:
558
+ openenings.push(new MaskToken(!1, !0));
559
+ break;
560
+
561
+ case opts.groupmarker[0]:
562
+ openenings.push(new MaskToken(!0));
563
+ break;
564
+
565
+ case opts.quantifiermarker[0]:
566
+ var quantifier = new MaskToken(!1, !1, !0);
567
+ m = m.replace(/[{}]/g, "");
568
+ var mqj = m.split("|"), mq = mqj[0].split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = 1 === mq.length ? mq0 : isNaN(mq[1]) ? mq[1] : parseInt(mq[1]);
569
+ "*" !== mq0 && "+" !== mq0 || (mq0 = "*" === mq1 ? 0 : 1), quantifier.quantifier = {
570
+ min: mq0,
571
+ max: mq1,
572
+ jit: mqj[1]
573
+ };
574
+ var matches = 0 < openenings.length ? openenings[openenings.length - 1].matches : currentToken.matches;
575
+ if (match = matches.pop(), match.isAlternator) {
576
+ matches.push(match), matches = match.matches;
577
+ var groupToken = new MaskToken(!0), tmpMatch = matches.pop();
578
+ matches.push(groupToken), matches = groupToken.matches, match = tmpMatch;
579
+ }
580
+ match.isGroup || (match = groupify([ match ])), matches.push(match), matches.push(quantifier);
581
+ break;
582
+
583
+ case opts.alternatormarker:
584
+ if (0 < openenings.length) {
585
+ currentOpeningToken = openenings[openenings.length - 1];
586
+ var subToken = currentOpeningToken.matches[currentOpeningToken.matches.length - 1];
587
+ lastMatch = currentOpeningToken.openGroup && (void 0 === subToken.matches || !1 === subToken.isGroup && !1 === subToken.isAlternator) ? openenings.pop() : groupQuantifier(currentOpeningToken.matches);
588
+ } else lastMatch = groupQuantifier(currentToken.matches);
589
+ if (lastMatch.isAlternator) openenings.push(lastMatch); else if (lastMatch.alternatorGroup ? (alternator = openenings.pop(),
590
+ lastMatch.alternatorGroup = !1) : alternator = new MaskToken(!1, !1, !1, !0), alternator.matches.push(lastMatch),
591
+ openenings.push(alternator), lastMatch.openGroup) {
592
+ lastMatch.openGroup = !1;
593
+ var alternatorGroup = new MaskToken(!0);
594
+ alternatorGroup.alternatorGroup = !0, openenings.push(alternatorGroup);
595
+ }
596
+ break;
597
+
598
+ default:
599
+ defaultCase();
600
+ }
601
+ }
602
+ for (closeRegexGroup && closeGroup(); 0 < openenings.length; ) openingToken = openenings.pop(),
603
+ currentToken.matches.push(openingToken);
604
+ return 0 < currentToken.matches.length && (verifyGroupMarker(currentToken), maskTokens.push(currentToken)),
605
+ (opts.numericInput || opts.isRTL) && reverseTokens(maskTokens[0]), maskTokens;
606
+ }
607
+ module.exports = {
608
+ generateMaskSet: generateMaskSet,
609
+ analyseMask: analyseMask
610
+ };
611
+ }, function(module, exports, __webpack_require__) {
612
+ function _typeof(obj) {
613
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function _typeof(obj) {
614
+ return typeof obj;
615
+ } : function _typeof(obj) {
616
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
617
+ }, _typeof(obj);
618
+ }
619
+ var $ = __webpack_require__(4), window = __webpack_require__(6), document = window.document, ua = window.navigator.userAgent, ie = 0 < ua.indexOf("MSIE ") || 0 < ua.indexOf("Trident/"), mobile = isInputEventSupported("touchstart"), iemobile = /iemobile/i.test(ua), iphone = /iphone/i.test(ua) && !iemobile;
620
+ function isInputEventSupported(eventName) {
621
+ var el = document.createElement("input"), evName = "on" + eventName, isSupported = evName in el;
622
+ return isSupported || (el.setAttribute(evName, "return;"), isSupported = "function" == typeof el[evName]),
623
+ el = null, isSupported;
624
+ }
625
+ module.exports = function maskScope(actionObj, maskset, opts) {
626
+ maskset = maskset || this.maskset, opts = opts || this.opts;
627
+ var inputmask = this, el = this.el, isRTL = this.isRTL || (this.isRTL = opts.numericInput), undoValue, $el, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, maxLength, mouseEnter = !1, colorMask, originalPlaceholder;
628
+ function getMaskTemplate(baseOnInput, minimalPos, includeMode, noJit, clearOptionalTail) {
629
+ var greedy = opts.greedy;
630
+ clearOptionalTail && (opts.greedy = !1), minimalPos = minimalPos || 0;
631
+ var maskTemplate = [], ndxIntlzr, pos = 0, test, testPos;
632
+ do {
633
+ if (!0 === baseOnInput && maskset.validPositions[pos]) testPos = clearOptionalTail && !0 === maskset.validPositions[pos].match.optionality && void 0 === maskset.validPositions[pos + 1] && (!0 === maskset.validPositions[pos].generatedInput || maskset.validPositions[pos].input == opts.skipOptionalPartCharacter && 0 < pos) ? determineTestTemplate(pos, getTests(pos, ndxIntlzr, pos - 1)) : maskset.validPositions[pos],
634
+ test = testPos.match, ndxIntlzr = testPos.locator.slice(), maskTemplate.push(!0 === includeMode ? testPos.input : !1 === includeMode ? test.nativeDef : getPlaceholder(pos, test)); else {
635
+ testPos = getTestTemplate(pos, ndxIntlzr, pos - 1), test = testPos.match, ndxIntlzr = testPos.locator.slice();
636
+ var jitMasking = !0 !== noJit && (!1 !== opts.jitMasking ? opts.jitMasking : test.jit);
637
+ (!1 === jitMasking || void 0 === jitMasking || "number" == typeof jitMasking && isFinite(jitMasking) && pos < jitMasking) && maskTemplate.push(!1 === includeMode ? test.nativeDef : getPlaceholder(pos, test));
638
+ }
639
+ "auto" === opts.keepStatic && test.newBlockMarker && !0 !== test.static && (opts.keepStatic = pos - 1),
640
+ pos++;
641
+ } while ((void 0 === maxLength || pos < maxLength) && (!0 !== test.static || "" !== test.def) || pos < minimalPos);
642
+ return "" === maskTemplate[maskTemplate.length - 1] && maskTemplate.pop(), !1 === includeMode && void 0 !== maskset.maskLength || (maskset.maskLength = pos - 1),
643
+ opts.greedy = greedy, maskTemplate;
644
+ }
645
+ function resetMaskSet(soft) {
646
+ maskset.buffer = void 0, !0 !== soft && (maskset.validPositions = {}, maskset.p = 0);
647
+ }
648
+ function getLastValidPosition(closestTo, strict, validPositions) {
649
+ var before = -1, after = -1, valids = validPositions || maskset.validPositions;
650
+ for (var posNdx in void 0 === closestTo && (closestTo = -1), valids) {
651
+ var psNdx = parseInt(posNdx);
652
+ valids[psNdx] && (strict || !0 !== valids[psNdx].generatedInput) && (psNdx <= closestTo && (before = psNdx),
653
+ closestTo <= psNdx && (after = psNdx));
654
+ }
655
+ return -1 === before || before == closestTo ? after : -1 == after ? before : closestTo - before < after - closestTo ? before : after;
656
+ }
657
+ function getDecisionTaker(tst) {
658
+ var decisionTaker = tst.locator[tst.alternation];
659
+ return "string" == typeof decisionTaker && 0 < decisionTaker.length && (decisionTaker = decisionTaker.split(",")[0]),
660
+ void 0 !== decisionTaker ? decisionTaker.toString() : "";
661
+ }
662
+ function getLocator(tst, align) {
663
+ var locator = (null != tst.alternation ? tst.mloc[getDecisionTaker(tst)] : tst.locator).join("");
664
+ if ("" !== locator) for (;locator.length < align; ) locator += "0";
665
+ return locator;
666
+ }
667
+ function determineTestTemplate(pos, tests) {
668
+ pos = 0 < pos ? pos - 1 : 0;
669
+ for (var altTest = getTest(pos), targetLocator = getLocator(altTest), tstLocator, closest, bestMatch, ndx = 0; ndx < tests.length; ndx++) {
670
+ var tst = tests[ndx];
671
+ tstLocator = getLocator(tst, targetLocator.length);
672
+ var distance = Math.abs(tstLocator - targetLocator);
673
+ (void 0 === closest || "" !== tstLocator && distance < closest || bestMatch && !opts.greedy && bestMatch.match.optionality && "master" === bestMatch.match.newBlockMarker && (!tst.match.optionality || !tst.match.newBlockMarker) || bestMatch && bestMatch.match.optionalQuantifier && !tst.match.optionalQuantifier) && (closest = distance,
674
+ bestMatch = tst);
675
+ }
676
+ return bestMatch;
677
+ }
678
+ function getTestTemplate(pos, ndxIntlzr, tstPs) {
679
+ return maskset.validPositions[pos] || determineTestTemplate(pos, getTests(pos, ndxIntlzr ? ndxIntlzr.slice() : ndxIntlzr, tstPs));
680
+ }
681
+ function getTest(pos, tests) {
682
+ return maskset.validPositions[pos] ? maskset.validPositions[pos] : (tests || getTests(pos))[0];
683
+ }
684
+ function positionCanMatchDefinition(pos, def) {
685
+ for (var valid = !1, tests = getTests(pos), tndx = 0; tndx < tests.length; tndx++) if (tests[tndx].match && tests[tndx].match.def === def) {
686
+ valid = !0;
687
+ break;
688
+ }
689
+ return !1 === valid && void 0 !== maskset.jitOffset[pos] && (valid = positionCanMatchDefinition(pos + maskset.jitOffset[pos], def)),
690
+ valid;
691
+ }
692
+ function getTests(pos, ndxIntlzr, tstPs) {
693
+ var maskTokens = maskset.maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr ? ndxIntlzr.slice() : [ 0 ], matches = [], insertStop = !1, latestMatch, cacheDependency = ndxIntlzr ? ndxIntlzr.join("") : "";
694
+ function resolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) {
695
+ function handleMatch(match, loopNdx, quantifierRecurse) {
696
+ function isFirstMatch(latestMatch, tokenGroup) {
697
+ var firstMatch = 0 === $.inArray(latestMatch, tokenGroup.matches);
698
+ return firstMatch || $.each(tokenGroup.matches, function(ndx, match) {
699
+ if (!0 === match.isQuantifier ? firstMatch = isFirstMatch(latestMatch, tokenGroup.matches[ndx - 1]) : match.hasOwnProperty("matches") && (firstMatch = isFirstMatch(latestMatch, match)),
700
+ firstMatch) return !1;
701
+ }), firstMatch;
702
+ }
703
+ function resolveNdxInitializer(pos, alternateNdx, targetAlternation) {
704
+ var bestMatch, indexPos;
705
+ if ((maskset.tests[pos] || maskset.validPositions[pos]) && $.each(maskset.tests[pos] || [ maskset.validPositions[pos] ], function(ndx, lmnt) {
706
+ if (lmnt.mloc[alternateNdx]) return bestMatch = lmnt, !1;
707
+ var alternation = void 0 !== targetAlternation ? targetAlternation : lmnt.alternation, ndxPos = void 0 !== lmnt.locator[alternation] ? lmnt.locator[alternation].toString().indexOf(alternateNdx) : -1;
708
+ (void 0 === indexPos || ndxPos < indexPos) && -1 !== ndxPos && (bestMatch = lmnt,
709
+ indexPos = ndxPos);
710
+ }), bestMatch) {
711
+ var bestMatchAltIndex = bestMatch.locator[bestMatch.alternation], locator = bestMatch.mloc[alternateNdx] || bestMatch.mloc[bestMatchAltIndex] || bestMatch.locator;
712
+ return locator.slice((void 0 !== targetAlternation ? targetAlternation : bestMatch.alternation) + 1);
713
+ }
714
+ return void 0 !== targetAlternation ? resolveNdxInitializer(pos, alternateNdx) : void 0;
715
+ }
716
+ function isSubsetOf(source, target) {
717
+ function expand(pattern) {
718
+ for (var expanded = [], start = -1, end, i = 0, l = pattern.length; i < l; i++) if ("-" === pattern.charAt(i)) for (end = pattern.charCodeAt(i + 1); ++start < end; ) expanded.push(String.fromCharCode(start)); else start = pattern.charCodeAt(i),
719
+ expanded.push(pattern.charAt(i));
720
+ return expanded.join("");
721
+ }
722
+ return opts.regex && !0 !== source.match.static && !0 !== target.match.static ? -1 !== expand(target.match.def.replace(/[[\]]/g, "")).indexOf(expand(source.match.def.replace(/[[\]]/g, ""))) : source.match.def === target.match.nativeDef;
723
+ }
724
+ function staticCanMatchDefinition(source, target) {
725
+ var sloc = source.locator.slice(source.alternation).join(""), tloc = target.locator.slice(target.alternation).join(""), canMatch = sloc == tloc;
726
+ return canMatch = !(!canMatch || !0 !== source.match.static || !0 === target.match.static) && target.match.fn.test(source.match.def, maskset, pos, !1, opts, !1),
727
+ canMatch;
728
+ }
729
+ function setMergeLocators(targetMatch, altMatch) {
730
+ if (void 0 === altMatch || targetMatch.alternation === altMatch.alternation && -1 === targetMatch.locator[targetMatch.alternation].toString().indexOf(altMatch.locator[altMatch.alternation])) {
731
+ targetMatch.mloc = targetMatch.mloc || {};
732
+ var locNdx = targetMatch.locator[targetMatch.alternation];
733
+ if (void 0 !== locNdx) {
734
+ if ("string" == typeof locNdx && (locNdx = locNdx.split(",")[0]), void 0 === targetMatch.mloc[locNdx] && (targetMatch.mloc[locNdx] = targetMatch.locator.slice()),
735
+ void 0 !== altMatch) {
736
+ for (var ndx in altMatch.mloc) "string" == typeof ndx && (ndx = ndx.split(",")[0]),
737
+ void 0 === targetMatch.mloc[ndx] && (targetMatch.mloc[ndx] = altMatch.mloc[ndx]);
738
+ targetMatch.locator[targetMatch.alternation] = Object.keys(targetMatch.mloc).join(",");
739
+ }
740
+ return !0;
741
+ }
742
+ targetMatch.alternation = void 0;
743
+ }
744
+ return !1;
745
+ }
746
+ if (500 < testPos && void 0 !== quantifierRecurse) 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. " + maskset.mask;
747
+ if (testPos === pos && void 0 === match.matches) return matches.push({
748
+ match: match,
749
+ locator: loopNdx.reverse(),
750
+ cd: cacheDependency,
751
+ mloc: {}
752
+ }), !0;
753
+ if (void 0 !== match.matches) {
754
+ if (match.isGroup && quantifierRecurse !== match) {
755
+ if (match = handleMatch(maskToken.matches[$.inArray(match, maskToken.matches) + 1], loopNdx, quantifierRecurse),
756
+ match) return !0;
757
+ } else if (match.isOptional) {
758
+ var optionalToken = match, mtchsNdx = matches.length;
759
+ if (match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse),
760
+ match) {
761
+ if ($.each(matches, function(ndx, mtch) {
762
+ mtchsNdx <= ndx && (mtch.match.optionality = !0);
763
+ }), latestMatch = matches[matches.length - 1].match, void 0 !== quantifierRecurse || !isFirstMatch(latestMatch, optionalToken)) return !0;
764
+ insertStop = !0, testPos = pos;
765
+ }
766
+ } else if (match.isAlternator) {
767
+ var alternateToken = match, malternateMatches = [], maltMatches, currentMatches = matches.slice(), loopNdxCnt = loopNdx.length, altIndex = 0 < ndxInitializer.length ? ndxInitializer.shift() : -1;
768
+ if (-1 === altIndex || "string" == typeof altIndex) {
769
+ var currentPos = testPos, ndxInitializerClone = ndxInitializer.slice(), altIndexArr = [], amndx;
770
+ if ("string" == typeof altIndex) altIndexArr = altIndex.split(","); else for (amndx = 0; amndx < alternateToken.matches.length; amndx++) altIndexArr.push(amndx.toString());
771
+ if (maskset.excludes[pos]) {
772
+ for (var altIndexArrClone = altIndexArr.slice(), i = 0, el = maskset.excludes[pos].length; i < el; i++) altIndexArr.splice(altIndexArr.indexOf(maskset.excludes[pos][i].toString()), 1);
773
+ 0 === altIndexArr.length && (maskset.excludes[pos] = void 0, altIndexArr = altIndexArrClone);
774
+ }
775
+ (!0 === opts.keepStatic || isFinite(parseInt(opts.keepStatic)) && currentPos >= opts.keepStatic) && (altIndexArr = altIndexArr.slice(0, 1));
776
+ for (var unMatchedAlternation = !1, ndx = 0; ndx < altIndexArr.length; ndx++) {
777
+ amndx = parseInt(altIndexArr[ndx]), matches = [], ndxInitializer = "string" == typeof altIndex && resolveNdxInitializer(testPos, amndx, loopNdxCnt) || ndxInitializerClone.slice(),
778
+ alternateToken.matches[amndx] && handleMatch(alternateToken.matches[amndx], [ amndx ].concat(loopNdx), quantifierRecurse) ? match = !0 : 0 === ndx && (unMatchedAlternation = !0),
779
+ maltMatches = matches.slice(), testPos = currentPos, matches = [];
780
+ for (var ndx1 = 0; ndx1 < maltMatches.length; ndx1++) {
781
+ var altMatch = maltMatches[ndx1], dropMatch = !1;
782
+ altMatch.match.jit = altMatch.match.jit || unMatchedAlternation, altMatch.alternation = altMatch.alternation || loopNdxCnt,
783
+ setMergeLocators(altMatch);
784
+ for (var ndx2 = 0; ndx2 < malternateMatches.length; ndx2++) {
785
+ var altMatch2 = malternateMatches[ndx2];
786
+ if ("string" != typeof altIndex || void 0 !== altMatch.alternation && -1 !== $.inArray(altMatch.locator[altMatch.alternation].toString(), altIndexArr)) {
787
+ if (altMatch.match.nativeDef === altMatch2.match.nativeDef) {
788
+ dropMatch = !0, setMergeLocators(altMatch2, altMatch);
789
+ break;
790
+ }
791
+ if (isSubsetOf(altMatch, altMatch2)) {
792
+ setMergeLocators(altMatch, altMatch2) && (dropMatch = !0, malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch));
793
+ break;
794
+ }
795
+ if (isSubsetOf(altMatch2, altMatch)) {
796
+ setMergeLocators(altMatch2, altMatch);
797
+ break;
798
+ }
799
+ if (staticCanMatchDefinition(altMatch, altMatch2)) {
800
+ setMergeLocators(altMatch, altMatch2) && (dropMatch = !0, malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch));
801
+ break;
802
+ }
803
+ }
804
+ }
805
+ dropMatch || malternateMatches.push(altMatch);
806
+ }
807
+ }
808
+ matches = currentMatches.concat(malternateMatches), testPos = pos, insertStop = 0 < matches.length,
809
+ match = 0 < malternateMatches.length, ndxInitializer = ndxInitializerClone.slice();
810
+ } else match = handleMatch(alternateToken.matches[altIndex] || maskToken.matches[altIndex], [ altIndex ].concat(loopNdx), quantifierRecurse);
811
+ if (match) return !0;
812
+ } else if (match.isQuantifier && quantifierRecurse !== maskToken.matches[$.inArray(match, maskToken.matches) - 1]) for (var qt = match, qndx = 0 < ndxInitializer.length ? ndxInitializer.shift() : 0; qndx < (isNaN(qt.quantifier.max) ? qndx + 1 : qt.quantifier.max) && testPos <= pos; qndx++) {
813
+ var tokenGroup = maskToken.matches[$.inArray(qt, maskToken.matches) - 1];
814
+ if (match = handleMatch(tokenGroup, [ qndx ].concat(loopNdx), tokenGroup), match) {
815
+ if (latestMatch = matches[matches.length - 1].match, latestMatch.optionalQuantifier = qndx >= qt.quantifier.min,
816
+ latestMatch.jit = (qndx || 1) * tokenGroup.matches.indexOf(latestMatch) >= qt.quantifier.jit,
817
+ latestMatch.optionalQuantifier && isFirstMatch(latestMatch, tokenGroup)) {
818
+ insertStop = !0, testPos = pos;
819
+ break;
820
+ }
821
+ return latestMatch.jit && (maskset.jitOffset[pos] = tokenGroup.matches.length - tokenGroup.matches.indexOf(latestMatch)),
822
+ !0;
823
+ }
824
+ } else if (match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse),
825
+ match) return !0;
826
+ } else testPos++;
827
+ }
828
+ for (var tndx = 0 < ndxInitializer.length ? ndxInitializer.shift() : 0; tndx < maskToken.matches.length; tndx++) if (!0 !== maskToken.matches[tndx].isQuantifier) {
829
+ var match = handleMatch(maskToken.matches[tndx], [ tndx ].concat(loopNdx), quantifierRecurse);
830
+ if (match && testPos === pos) return match;
831
+ if (pos < testPos) break;
832
+ }
833
+ }
834
+ function mergeLocators(pos, tests) {
835
+ var locator = [];
836
+ return $.isArray(tests) || (tests = [ tests ]), 0 < tests.length && (void 0 === tests[0].alternation || !0 === opts.keepStatic ? (locator = determineTestTemplate(pos, tests.slice()).locator.slice(),
837
+ 0 === locator.length && (locator = tests[0].locator.slice())) : $.each(tests, function(ndx, tst) {
838
+ if ("" !== tst.def) if (0 === locator.length) locator = tst.locator.slice(); else for (var i = 0; i < locator.length; i++) tst.locator[i] && -1 === locator[i].toString().indexOf(tst.locator[i]) && (locator[i] += "," + tst.locator[i]);
839
+ })), locator;
840
+ }
841
+ if (-1 < pos && (void 0 === maxLength || pos < maxLength)) {
842
+ if (void 0 === ndxIntlzr) {
843
+ for (var previousPos = pos - 1, test; void 0 === (test = maskset.validPositions[previousPos] || maskset.tests[previousPos]) && -1 < previousPos; ) previousPos--;
844
+ void 0 !== test && -1 < previousPos && (ndxInitializer = mergeLocators(previousPos, test),
845
+ cacheDependency = ndxInitializer.join(""), testPos = previousPos);
846
+ }
847
+ if (maskset.tests[pos] && maskset.tests[pos][0].cd === cacheDependency) return maskset.tests[pos];
848
+ for (var mtndx = ndxInitializer.shift(); mtndx < maskTokens.length; mtndx++) {
849
+ var match = resolveTestFromToken(maskTokens[mtndx], ndxInitializer, [ mtndx ]);
850
+ if (match && testPos === pos || pos < testPos) break;
851
+ }
852
+ }
853
+ return (0 === matches.length || insertStop) && matches.push({
854
+ match: {
855
+ fn: null,
856
+ static: !0,
857
+ optionality: !1,
858
+ casing: null,
859
+ def: "",
860
+ placeholder: ""
861
+ },
862
+ locator: [],
863
+ mloc: {},
864
+ cd: cacheDependency
865
+ }), void 0 !== ndxIntlzr && maskset.tests[pos] ? $.extend(!0, [], matches) : (maskset.tests[pos] = $.extend(!0, [], matches),
866
+ maskset.tests[pos]);
867
+ }
868
+ function getBufferTemplate() {
869
+ return void 0 === maskset._buffer && (maskset._buffer = getMaskTemplate(!1, 1),
870
+ void 0 === maskset.buffer && (maskset.buffer = maskset._buffer.slice())), maskset._buffer;
871
+ }
872
+ function getBuffer(noCache) {
873
+ return void 0 !== maskset.buffer && !0 !== noCache || (maskset.buffer = getMaskTemplate(!0, getLastValidPosition(), !0),
874
+ void 0 === maskset._buffer && (maskset._buffer = maskset.buffer.slice())), maskset.buffer;
875
+ }
876
+ function refreshFromBuffer(start, end, buffer) {
877
+ var i, p;
878
+ if (!0 === start) resetMaskSet(), maskset.tests = {}, start = 0, end = buffer.length; else for (i = start; i < end; i++) delete maskset.validPositions[i];
879
+ for (p = start, i = start; i < end; i++) if (buffer[i] !== opts.skipOptionalPartCharacter) {
880
+ var valResult = isValid(p, buffer[i], !opts.negationSymbol || [ i ] !== opts.negationSymbol.front, !opts.negationSymbol || [ i ] !== opts.negationSymbol.front);
881
+ !1 !== valResult && (p = void 0 !== valResult.caret ? valResult.caret : valResult.pos + 1);
882
+ }
883
+ }
884
+ function casing(elem, test, pos) {
885
+ switch (opts.casing || test.casing) {
886
+ case "upper":
887
+ elem = elem.toUpperCase();
888
+ break;
889
+
890
+ case "lower":
891
+ elem = elem.toLowerCase();
892
+ break;
893
+
894
+ case "title":
895
+ var posBefore = maskset.validPositions[pos - 1];
896
+ elem = 0 === pos || posBefore && posBefore.input === String.fromCharCode(Inputmask.keyCode.SPACE) ? elem.toUpperCase() : elem.toLowerCase();
897
+ break;
898
+
899
+ default:
900
+ if ($.isFunction(opts.casing)) {
901
+ var args = Array.prototype.slice.call(arguments);
902
+ args.push(maskset.validPositions), elem = opts.casing.apply(this, args);
903
+ }
904
+ }
905
+ return elem;
906
+ }
907
+ function checkAlternationMatch(altArr1, altArr2, na) {
908
+ for (var altArrC = opts.greedy ? altArr2 : altArr2.slice(0, 1), isMatch = !1, naArr = void 0 !== na ? na.split(",") : [], naNdx, i = 0; i < naArr.length; i++) -1 !== (naNdx = altArr1.indexOf(naArr[i])) && altArr1.splice(naNdx, 1);
909
+ for (var alndx = 0; alndx < altArr1.length; alndx++) if (-1 !== $.inArray(altArr1[alndx], altArrC)) {
910
+ isMatch = !0;
911
+ break;
912
+ }
913
+ return isMatch;
914
+ }
915
+ function alternate(pos, c, strict, fromIsValid, rAltPos) {
916
+ var validPsClone = $.extend(!0, {}, maskset.validPositions), lastAlt, alternation, isValidRslt = !1, returnRslt = !1, altPos, prevAltPos, i, validPos, decisionPos, lAltPos = void 0 !== rAltPos ? rAltPos : getLastValidPosition();
917
+ function insertPosition(insert) {
918
+ if (insert && isValidRslt && void 0 !== c) {
919
+ var targetLvp = getLastValidPosition(pos) + 1;
920
+ for (i = decisionPos; i < getLastValidPosition() + 1; i++) validPos = maskset.validPositions[i],
921
+ (void 0 === validPos || 1 == validPos.match.static) && i < pos + posOffset && posOffset++;
922
+ pos += posOffset, isValidRslt = returnRslt = isValid(targetLvp < pos ? targetLvp : pos, c, strict, fromIsValid, !0);
923
+ }
924
+ }
925
+ if (-1 === lAltPos && void 0 === rAltPos) lastAlt = 0, prevAltPos = getTest(lastAlt),
926
+ alternation = prevAltPos.alternation; else for (;0 <= lAltPos; lAltPos--) if (altPos = maskset.validPositions[lAltPos],
927
+ altPos && void 0 !== altPos.alternation) {
928
+ if (prevAltPos && prevAltPos.locator[altPos.alternation] !== altPos.locator[altPos.alternation]) break;
929
+ lastAlt = lAltPos, alternation = maskset.validPositions[lastAlt].alternation, prevAltPos = altPos;
930
+ }
931
+ if (void 0 !== alternation) {
932
+ decisionPos = parseInt(lastAlt), maskset.excludes[decisionPos] = maskset.excludes[decisionPos] || [],
933
+ !0 !== pos && maskset.excludes[decisionPos].push(getDecisionTaker(prevAltPos));
934
+ var validInputsClone = [], staticInputsBeforePos = 0;
935
+ for (i = decisionPos; i < getLastValidPosition(void 0, !0) + 1; i++) validPos = maskset.validPositions[i],
936
+ validPos && !0 !== validPos.generatedInput ? validInputsClone.push(validPos.input) : i < pos && staticInputsBeforePos++,
937
+ delete maskset.validPositions[i];
938
+ for (;maskset.excludes[decisionPos] && maskset.excludes[decisionPos].length < 10; ) {
939
+ var posOffset = -1 * staticInputsBeforePos, validInputs = validInputsClone.slice();
940
+ for (maskset.tests[decisionPos] = void 0, resetMaskSet(!0), isValidRslt = !0, insertPosition(0 === pos); 0 < validInputs.length; ) {
941
+ var input = validInputs.shift();
942
+ if (!(isValidRslt = isValid(isValidRslt.caret || getLastValidPosition(void 0, !0) + 1, input, !1, fromIsValid, !0))) break;
943
+ }
944
+ if (insertPosition(0 < pos), isValidRslt) break;
945
+ if (resetMaskSet(), prevAltPos = getTest(decisionPos), maskset.validPositions = $.extend(!0, {}, validPsClone),
946
+ !maskset.excludes[decisionPos]) {
947
+ isValidRslt = alternate(pos, c, strict, fromIsValid, decisionPos - 1);
948
+ break;
949
+ }
950
+ var decisionTaker = getDecisionTaker(prevAltPos);
951
+ if (-1 !== maskset.excludes[decisionPos].indexOf(decisionTaker)) {
952
+ isValidRslt = alternate(pos, c, strict, fromIsValid, decisionPos - 1);
953
+ break;
954
+ }
955
+ for (maskset.excludes[decisionPos].push(decisionTaker), i = decisionPos; i < getLastValidPosition(void 0, !0) + 1; i++) delete maskset.validPositions[i];
956
+ }
957
+ }
958
+ return maskset.excludes[decisionPos] = void 0, returnRslt;
959
+ }
960
+ function isValid(pos, c, strict, fromIsValid, fromAlternate, validateOnly) {
961
+ function isSelection(posObj) {
962
+ return isRTL ? 1 < posObj.begin - posObj.end || posObj.begin - posObj.end == 1 : 1 < posObj.end - posObj.begin || posObj.end - posObj.begin == 1;
963
+ }
964
+ strict = !0 === strict;
965
+ var maskPos = pos;
966
+ function processCommandObject(commandObj) {
967
+ if (void 0 !== commandObj) {
968
+ if (void 0 !== commandObj.remove && ($.isArray(commandObj.remove) || (commandObj.remove = [ commandObj.remove ]),
969
+ $.each(commandObj.remove.sort(function(a, b) {
970
+ return b.pos - a.pos;
971
+ }), function(ndx, lmnt) {
972
+ revalidateMask({
973
+ begin: lmnt,
974
+ end: lmnt + 1
975
+ });
976
+ }), commandObj.remove = void 0), void 0 !== commandObj.insert && ($.isArray(commandObj.insert) || (commandObj.insert = [ commandObj.insert ]),
977
+ $.each(commandObj.insert.sort(function(a, b) {
978
+ return a.pos - b.pos;
979
+ }), function(ndx, lmnt) {
980
+ "" !== lmnt.c && isValid(lmnt.pos, lmnt.c, void 0 === lmnt.strict || lmnt.strict, void 0 !== lmnt.fromIsValid ? lmnt.fromIsValid : fromIsValid);
981
+ }), commandObj.insert = void 0), commandObj.refreshFromBuffer && commandObj.buffer) {
982
+ var refresh = commandObj.refreshFromBuffer;
983
+ refreshFromBuffer(!0 === refresh ? refresh : refresh.start, refresh.end, commandObj.buffer),
984
+ commandObj.refreshFromBuffer = void 0;
985
+ }
986
+ void 0 !== commandObj.rewritePosition && (maskPos = commandObj.rewritePosition,
987
+ commandObj = !0, commandObj.rewritePosition = void 0);
988
+ }
989
+ return commandObj;
990
+ }
991
+ function _isValid(position, c, strict) {
992
+ var rslt = !1;
993
+ return $.each(getTests(position), function(ndx, tst) {
994
+ var test = tst.match;
995
+ if (getBuffer(!0), rslt = null != test.fn ? test.fn.test(c, maskset, position, strict, opts, isSelection(pos)) : (c === test.def || c === opts.skipOptionalPartCharacter) && "" !== test.def && {
996
+ c: getPlaceholder(position, test, !0) || test.def,
997
+ pos: position
998
+ }, !1 !== rslt) {
999
+ var elem = void 0 !== rslt.c ? rslt.c : c, validatedPos = position;
1000
+ return elem = elem === opts.skipOptionalPartCharacter && !0 === test.static ? getPlaceholder(position, test, !0) || test.def : elem,
1001
+ rslt = processCommandObject(rslt), !0 !== rslt && void 0 !== rslt.pos && rslt.pos !== position && (validatedPos = rslt.pos),
1002
+ !0 !== rslt && void 0 === rslt.pos && void 0 === rslt.c ? !1 : (revalidateMask(pos, $.extend({}, tst, {
1003
+ input: casing(elem, test, validatedPos)
1004
+ }), fromIsValid, validatedPos) || (rslt = !1), !1);
1005
+ }
1006
+ }), rslt;
1007
+ }
1008
+ void 0 !== pos.begin && (maskPos = isRTL ? pos.end : pos.begin);
1009
+ var result = !0, positionsClone = $.extend(!0, {}, maskset.validPositions);
1010
+ if ($.isFunction(opts.preValidation) && !strict && !0 !== fromIsValid && !0 !== validateOnly && !0 !== fromAlternate && (result = opts.preValidation(getBuffer(), maskPos, c, isSelection(pos), opts, maskset),
1011
+ result = processCommandObject(result)), !0 === result) {
1012
+ if ((void 0 === maxLength || maskPos < maxLength) && (result = _isValid(maskPos, c, strict),
1013
+ (!strict || !0 === fromIsValid) && !1 === result && !0 !== validateOnly)) {
1014
+ var currentPosValid = maskset.validPositions[maskPos];
1015
+ if (!currentPosValid || !0 !== currentPosValid.match.static || currentPosValid.match.def !== c && c !== opts.skipOptionalPartCharacter) {
1016
+ if (opts.insertMode || void 0 === maskset.validPositions[seekNext(maskPos)]) {
1017
+ var skip = !1;
1018
+ if (maskset.jitOffset[maskPos] && void 0 === maskset.validPositions[seekNext(maskPos)] && (result = isValid(maskPos + maskset.jitOffset[maskPos], c, !0),
1019
+ !1 !== result && (!0 !== fromAlternate && (result.caret = maskPos), skip = !0)),
1020
+ !skip && !isMask(maskPos, !0)) for (var nPos = maskPos + 1, snPos = seekNext(maskPos); nPos <= snPos; nPos++) if (result = _isValid(nPos, c, strict),
1021
+ !1 !== result) {
1022
+ result = trackbackPositions(maskPos, void 0 !== result.pos ? result.pos : nPos) || result,
1023
+ maskPos = nPos;
1024
+ break;
1025
+ }
1026
+ }
1027
+ } else result = {
1028
+ caret: seekNext(maskPos)
1029
+ };
1030
+ }
1031
+ !1 !== result || !1 === opts.keepStatic || null != opts.regex && !isComplete(getBuffer()) || strict || !0 === fromAlternate || (result = alternate(maskPos, c, strict, fromIsValid)),
1032
+ !0 === result && (result = {
1033
+ pos: maskPos
1034
+ });
1035
+ }
1036
+ if ($.isFunction(opts.postValidation) && !1 !== result && !strict && !0 !== fromIsValid && !0 !== validateOnly) {
1037
+ var postResult = opts.postValidation(getBuffer(!0), void 0 !== pos.begin ? isRTL ? pos.end : pos.begin : pos, result, opts);
1038
+ void 0 !== postResult && (result = !0 === postResult ? result : postResult);
1039
+ }
1040
+ result && void 0 === result.pos && (result.pos = maskPos), !1 === result || !0 === validateOnly ? (resetMaskSet(!0),
1041
+ maskset.validPositions = $.extend(!0, {}, positionsClone)) : trackbackPositions(void 0, maskPos, !0);
1042
+ var endResult = processCommandObject(result);
1043
+ return endResult;
1044
+ }
1045
+ function trackbackPositions(originalPos, newPos, fillOnly) {
1046
+ if (void 0 === originalPos) for (originalPos = newPos - 1; 0 < originalPos && !maskset.validPositions[originalPos]; originalPos--) ;
1047
+ for (var ps = originalPos; ps < newPos; ps++) if (void 0 === maskset.validPositions[ps] && !isMask(ps, !0)) {
1048
+ var vp = 0 == ps ? getTest(ps) : maskset.validPositions[ps - 1];
1049
+ if (vp) {
1050
+ var tests = getTests(ps).slice();
1051
+ "" === tests[tests.length - 1].match.def && tests.pop();
1052
+ var bestMatch = determineTestTemplate(ps, tests), np;
1053
+ if (bestMatch && (!0 !== bestMatch.match.jit || "master" === bestMatch.match.newBlockMarker && (np = maskset.validPositions[ps + 1]) && !0 === np.match.optionalQuantifier) && (bestMatch = $.extend({}, bestMatch, {
1054
+ input: getPlaceholder(ps, bestMatch.match, !0) || bestMatch.match.def
1055
+ }), bestMatch.generatedInput = !0, revalidateMask(ps, bestMatch, !0), !0 !== fillOnly)) {
1056
+ var cvpInput = maskset.validPositions[newPos].input;
1057
+ return maskset.validPositions[newPos] = void 0, isValid(newPos, cvpInput, !0, !0);
1058
+ }
1059
+ }
1060
+ }
1061
+ }
1062
+ function revalidateMask(pos, validTest, fromIsValid, validatedPos) {
1063
+ function IsEnclosedStatic(pos, valids, selection) {
1064
+ var posMatch = valids[pos];
1065
+ if (void 0 === posMatch || (!0 !== posMatch.match.static || !0 === posMatch.match.optionality) && posMatch.input !== opts.radixPoint) return !1;
1066
+ var prevMatch = selection.begin <= pos - 1 ? valids[pos - 1] && !0 === valids[pos - 1].match.static && valids[pos - 1] : valids[pos - 1], nextMatch = selection.end > pos + 1 ? valids[pos + 1] && !0 === valids[pos + 1].match.static && valids[pos + 1] : valids[pos + 1];
1067
+ return prevMatch && nextMatch;
1068
+ }
1069
+ var begin = void 0 !== pos.begin ? pos.begin : pos, end = void 0 !== pos.end ? pos.end : pos;
1070
+ if (pos.begin > pos.end && (begin = pos.end, end = pos.begin), validatedPos = void 0 !== validatedPos ? validatedPos : begin,
1071
+ begin !== end || opts.insertMode && void 0 !== maskset.validPositions[validatedPos] && void 0 === fromIsValid) {
1072
+ var positionsClone = $.extend(!0, {}, maskset.validPositions), lvp = getLastValidPosition(void 0, !0), i;
1073
+ for (maskset.p = begin, i = lvp; begin <= i; i--) delete maskset.validPositions[i],
1074
+ void 0 === validTest && delete maskset.tests[i + 1];
1075
+ var valid = !0, j = validatedPos, needsValidation = 0 === validatedPos, posMatch = j;
1076
+ for (i = j, validTest && (maskset.validPositions[validatedPos] = $.extend(!0, {}, validTest),
1077
+ posMatch++, j++, begin < end && i++); i <= lvp; i++) {
1078
+ var t = positionsClone[i];
1079
+ if (void 0 !== t && (end <= i || begin <= i && !0 !== t.generatedInput && IsEnclosedStatic(i, positionsClone, {
1080
+ begin: begin,
1081
+ end: end
1082
+ }))) {
1083
+ for (;"" !== getTest(posMatch).match.def; ) {
1084
+ if (!1 === needsValidation && positionsClone[posMatch] && positionsClone[posMatch].match.nativeDef === t.match.nativeDef) maskset.validPositions[posMatch] = $.extend(!0, {}, positionsClone[posMatch]),
1085
+ maskset.validPositions[posMatch].input = t.input, trackbackPositions(void 0, posMatch, !0),
1086
+ j = posMatch + 1, valid = !0; else if (opts.shiftPositions && (positionCanMatchDefinition(posMatch, t.match.def) || "+" === t.match.def)) {
1087
+ "+" === t.match.def && getBuffer(!0);
1088
+ var result = isValid(posMatch, t.input, "+" !== t.match.def, "+" !== t.match.def);
1089
+ valid = !1 !== result, j = (result.pos || posMatch) + 1, needsValidation = !0;
1090
+ } else valid = !0 === t.generatedInput;
1091
+ if (valid) break;
1092
+ if (!valid && end < posMatch && isMask(posMatch, !0) && (!0 !== t.match.static || posMatch > maskset.maskLength)) break;
1093
+ posMatch++;
1094
+ }
1095
+ "" == getTest(posMatch).match.def && (valid = !1), posMatch = j;
1096
+ }
1097
+ if (!valid) break;
1098
+ }
1099
+ if (!valid) return maskset.validPositions = $.extend(!0, {}, positionsClone), resetMaskSet(!0),
1100
+ !1;
1101
+ } else validTest && (maskset.validPositions[validatedPos] = $.extend(!0, {}, validTest));
1102
+ return resetMaskSet(!0), !0;
1103
+ }
1104
+ function isMask(pos, strict) {
1105
+ var test = getTestTemplate(pos).match;
1106
+ if ("" === test.def && (test = getTest(pos).match), 1 != test.static) return test.fn;
1107
+ if (!0 !== strict && -1 < pos) {
1108
+ var tests = getTests(pos);
1109
+ return tests.length > 1 + ("" === tests[tests.length - 1].match.def ? 1 : 0);
1110
+ }
1111
+ return !1;
1112
+ }
1113
+ function seekNext(pos, newBlock) {
1114
+ for (var position = pos + 1; "" !== getTest(position).match.def && (!0 === newBlock && (!0 !== getTest(position).match.newBlockMarker || !isMask(position)) || !0 !== newBlock && !isMask(position)); ) position++;
1115
+ return position;
1116
+ }
1117
+ function seekPrevious(pos, newBlock) {
1118
+ var position = pos, tests;
1119
+ if (position <= 0) return 0;
1120
+ for (;0 < --position && (!0 === newBlock && !0 !== getTest(position).match.newBlockMarker || !0 !== newBlock && !isMask(position) && (tests = getTests(position),
1121
+ tests.length < 2 || 2 === tests.length && "" === tests[1].match.def)); ) ;
1122
+ return position;
1123
+ }
1124
+ function writeBuffer(input, buffer, caretPos, event, triggerEvents) {
1125
+ if (event && $.isFunction(opts.onBeforeWrite)) {
1126
+ var result = opts.onBeforeWrite.call(inputmask, event, buffer, caretPos, opts);
1127
+ if (result) {
1128
+ if (result.refreshFromBuffer) {
1129
+ var refresh = result.refreshFromBuffer;
1130
+ refreshFromBuffer(!0 === refresh ? refresh : refresh.start, refresh.end, result.buffer || buffer),
1131
+ buffer = getBuffer(!0);
1132
+ }
1133
+ void 0 !== caretPos && (caretPos = void 0 !== result.caret ? result.caret : caretPos);
1134
+ }
1135
+ }
1136
+ if (void 0 !== input && (input.inputmask._valueSet(buffer.join("")), void 0 === caretPos || void 0 !== event && "blur" === event.type ? renderColorMask(input, caretPos, 0 === buffer.length) : caret(input, caretPos),
1137
+ !0 === triggerEvents)) {
1138
+ var $input = $(input), nptVal = input.inputmask._valueGet();
1139
+ skipInputEvent = !0, $input.trigger("input"), setTimeout(function() {
1140
+ nptVal === getBufferTemplate().join("") ? $input.trigger("cleared") : !0 === isComplete(buffer) && $input.trigger("complete");
1141
+ }, 0);
1142
+ }
1143
+ }
1144
+ function getPlaceholder(pos, test, returnPL) {
1145
+ if (test = test || getTest(pos).match, void 0 !== test.placeholder || !0 === returnPL) return $.isFunction(test.placeholder) ? test.placeholder(opts) : test.placeholder;
1146
+ if (!0 !== test.static) return opts.placeholder.charAt(pos % opts.placeholder.length);
1147
+ if (-1 < pos && void 0 === maskset.validPositions[pos]) {
1148
+ var tests = getTests(pos), staticAlternations = [], prevTest;
1149
+ if (tests.length > 1 + ("" === tests[tests.length - 1].match.def ? 1 : 0)) for (var i = 0; i < tests.length; i++) if (!0 !== tests[i].match.optionality && !0 !== tests[i].match.optionalQuantifier && (!0 === tests[i].match.static || void 0 === prevTest || !1 !== tests[i].match.fn.test(prevTest.match.def, maskset, pos, !0, opts)) && (staticAlternations.push(tests[i]),
1150
+ !0 === tests[i].match.static && (prevTest = tests[i]), 1 < staticAlternations.length && /[0-9a-bA-Z]/.test(staticAlternations[0].match.def))) return opts.placeholder.charAt(pos % opts.placeholder.length);
1151
+ }
1152
+ return test.def;
1153
+ }
1154
+ function HandleNativePlaceholder(npt, value) {
1155
+ if (ie) {
1156
+ if (npt.inputmask._valueGet() !== value && (npt.placeholder !== value || "" === npt.placeholder)) {
1157
+ var buffer = getBuffer().slice(), nptValue = npt.inputmask._valueGet();
1158
+ if (nptValue !== value) {
1159
+ var lvp = getLastValidPosition();
1160
+ -1 === lvp && nptValue === getBufferTemplate().join("") ? buffer = [] : -1 !== lvp && clearOptionalTail(buffer),
1161
+ writeBuffer(npt, buffer);
1162
+ }
1163
+ }
1164
+ } else npt.placeholder !== value && (npt.placeholder = value, "" === npt.placeholder && npt.removeAttribute("placeholder"));
1165
+ }
1166
+ function determineNewCaretPosition(selectedCaret, tabbed) {
1167
+ function doRadixFocus(clickPos) {
1168
+ if ("" !== opts.radixPoint) {
1169
+ var vps = maskset.validPositions;
1170
+ if (void 0 === vps[clickPos] || vps[clickPos].input === getPlaceholder(clickPos)) {
1171
+ if (clickPos < seekNext(-1)) return !0;
1172
+ var radixPos = $.inArray(opts.radixPoint, getBuffer());
1173
+ if (-1 !== radixPos) {
1174
+ for (var vp in vps) if (vps[vp] && radixPos < vp && vps[vp].input !== getPlaceholder(vp)) return !1;
1175
+ return !0;
1176
+ }
1177
+ }
1178
+ }
1179
+ return !1;
1180
+ }
1181
+ if (tabbed && (isRTL ? selectedCaret.end = selectedCaret.begin : selectedCaret.begin = selectedCaret.end),
1182
+ selectedCaret.begin === selectedCaret.end) switch (opts.positionCaretOnClick) {
1183
+ case "none":
1184
+ break;
1185
+
1186
+ case "select":
1187
+ return {
1188
+ begin: 0,
1189
+ end: getBuffer().length
1190
+ };
1191
+
1192
+ case "ignore":
1193
+ return seekNext(getLastValidPosition());
1194
+
1195
+ case "radixFocus":
1196
+ if (doRadixFocus(selectedCaret.begin)) {
1197
+ var radixPos = getBuffer().join("").indexOf(opts.radixPoint);
1198
+ return opts.numericInput ? seekNext(radixPos) : radixPos;
1199
+ }
1200
+
1201
+ default:
1202
+ var clickPosition = selectedCaret.begin, lvclickPosition = getLastValidPosition(clickPosition, !0), lastPosition = seekNext(-1 !== lvclickPosition || isMask(0) ? lvclickPosition : 0);
1203
+ if (clickPosition < lastPosition) return isMask(clickPosition, !0) || isMask(clickPosition - 1, !0) ? clickPosition : seekNext(clickPosition);
1204
+ var lvp = maskset.validPositions[lvclickPosition], tt = getTestTemplate(lastPosition, lvp ? lvp.match.locator : void 0, lvp), placeholder = getPlaceholder(lastPosition, tt.match);
1205
+ if ("" !== placeholder && getBuffer()[lastPosition] !== placeholder && !0 !== tt.match.optionalQuantifier && !0 !== tt.match.newBlockMarker || !isMask(lastPosition, opts.keepStatic) && tt.match.def === placeholder) {
1206
+ var newPos = seekNext(lastPosition);
1207
+ (newPos <= clickPosition || clickPosition === lastPosition) && (lastPosition = newPos);
1208
+ }
1209
+ return lastPosition;
1210
+ }
1211
+ }
1212
+ var EventRuler = {
1213
+ on: function on(input, eventName, eventHandler) {
1214
+ var ev = function ev(e) {
1215
+ var that = this, args;
1216
+ if (void 0 === that.inputmask && "FORM" !== this.nodeName) {
1217
+ var imOpts = $.data(that, "_inputmask_opts");
1218
+ imOpts ? new Inputmask(imOpts).mask(that) : EventRuler.off(that);
1219
+ } else {
1220
+ if ("setvalue" === e.type || "FORM" === this.nodeName || !(that.disabled || that.readOnly && !("keydown" === e.type && e.ctrlKey && 67 === e.keyCode || !1 === opts.tabThrough && e.keyCode === Inputmask.keyCode.TAB))) {
1221
+ switch (e.type) {
1222
+ case "input":
1223
+ if (!0 === skipInputEvent) return skipInputEvent = !1, e.preventDefault();
1224
+ if (mobile) return args = arguments, setTimeout(function() {
1225
+ eventHandler.apply(that, args), caret(that, that.inputmask.caretPos, void 0, !0);
1226
+ }, 0), !1;
1227
+ break;
1228
+
1229
+ case "keydown":
1230
+ skipKeyPressEvent = !1, skipInputEvent = !1;
1231
+ break;
1232
+
1233
+ case "keypress":
1234
+ if (!0 === skipKeyPressEvent) return e.preventDefault();
1235
+ skipKeyPressEvent = !0;
1236
+ break;
1237
+
1238
+ case "click":
1239
+ case "focus":
1240
+ return args = arguments, setTimeout(function() {
1241
+ eventHandler.apply(that, args);
1242
+ }, 0), !1;
1243
+ }
1244
+ var returnVal = eventHandler.apply(that, arguments);
1245
+ return !1 === returnVal && (e.preventDefault(), e.stopPropagation()), returnVal;
1246
+ }
1247
+ e.preventDefault();
1248
+ }
1249
+ };
1250
+ input.inputmask.events[eventName] = input.inputmask.events[eventName] || [], input.inputmask.events[eventName].push(ev),
1251
+ -1 !== $.inArray(eventName, [ "submit", "reset" ]) ? null !== input.form && $(input.form).on(eventName, ev) : $(input).on(eventName, ev);
1252
+ },
1253
+ off: function off(input, event) {
1254
+ var events;
1255
+ input.inputmask && input.inputmask.events && (event ? (events = [], events[event] = input.inputmask.events[event]) : events = input.inputmask.events,
1256
+ $.each(events, function(eventName, evArr) {
1257
+ for (;0 < evArr.length; ) {
1258
+ var ev = evArr.pop();
1259
+ -1 !== $.inArray(eventName, [ "submit", "reset" ]) ? null !== input.form && $(input.form).off(eventName, ev) : $(input).off(eventName, ev);
1260
+ }
1261
+ delete input.inputmask.events[eventName];
1262
+ }));
1263
+ }
1264
+ }, EventHandlers = {
1265
+ keydownEvent: function keydownEvent(e) {
1266
+ var input = this, $input = $(this), k = e.keyCode, pos = caret(this), kdResult = opts.onKeyDown.call(this, e, getBuffer(), pos.begin, opts);
1267
+ if (void 0 !== kdResult) return kdResult;
1268
+ if (k === Inputmask.keyCode.BACKSPACE || k === Inputmask.keyCode.DELETE || iphone && k === Inputmask.keyCode.BACKSPACE_SAFARI || e.ctrlKey && k === Inputmask.keyCode.X && !isInputEventSupported("cut")) e.preventDefault(),
1269
+ handleRemove(this, k, pos), writeBuffer(this, getBuffer(!0), maskset.p, e, this.inputmask._valueGet() !== getBuffer().join("")); else if (k === Inputmask.keyCode.END || k === Inputmask.keyCode.PAGE_DOWN) {
1270
+ e.preventDefault();
1271
+ var caretPos = seekNext(getLastValidPosition());
1272
+ caret(this, e.shiftKey ? pos.begin : caretPos, caretPos, !0);
1273
+ } else k === Inputmask.keyCode.HOME && !e.shiftKey || k === Inputmask.keyCode.PAGE_UP ? (e.preventDefault(),
1274
+ caret(this, 0, e.shiftKey ? pos.begin : 0, !0)) : (opts.undoOnEscape && k === Inputmask.keyCode.ESCAPE || 90 === k && e.ctrlKey) && !0 !== e.altKey ? (checkVal(this, !0, !1, undoValue.split("")),
1275
+ $input.trigger("click")) : k !== Inputmask.keyCode.INSERT || e.shiftKey || e.ctrlKey ? !0 === opts.tabThrough && k === Inputmask.keyCode.TAB && (!0 === e.shiftKey ? (!0 === getTest(pos.begin).match.static && (pos.begin = seekNext(pos.begin)),
1276
+ pos.end = seekPrevious(pos.begin, !0), pos.begin = seekPrevious(pos.end, !0)) : (pos.begin = seekNext(pos.begin, !0),
1277
+ pos.end = seekNext(pos.begin, !0), pos.end < maskset.maskLength && pos.end--), pos.begin < maskset.maskLength && (e.preventDefault(),
1278
+ caret(this, pos.begin, pos.end))) : (opts.insertMode = !opts.insertMode, this.setAttribute("data-im-insert", opts.insertMode));
1279
+ ignorable = -1 !== $.inArray(k, opts.ignorables);
1280
+ },
1281
+ keypressEvent: function keypressEvent(e, checkval, writeOut, strict, ndx) {
1282
+ var input = this, $input = $(input), k = e.which || e.charCode || e.keyCode;
1283
+ if (!(!0 === checkval || e.ctrlKey && e.altKey) && (e.ctrlKey || e.metaKey || ignorable)) return k === Inputmask.keyCode.ENTER && undoValue !== getBuffer().join("") && (undoValue = getBuffer().join(""),
1284
+ setTimeout(function() {
1285
+ $input.trigger("change");
1286
+ }, 0)), !0;
1287
+ if (k) {
1288
+ 46 === k && !1 === e.shiftKey && "" !== opts.radixPoint && (k = opts.radixPoint.charCodeAt(0));
1289
+ var pos = checkval ? {
1290
+ begin: ndx,
1291
+ end: ndx
1292
+ } : caret(input), forwardPosition, c = String.fromCharCode(k);
1293
+ maskset.writeOutBuffer = !0;
1294
+ var valResult = isValid(pos, c, strict);
1295
+ if (!1 !== valResult && (resetMaskSet(!0), forwardPosition = void 0 !== valResult.caret ? valResult.caret : seekNext(valResult.pos.begin ? valResult.pos.begin : valResult.pos),
1296
+ maskset.p = forwardPosition), forwardPosition = opts.numericInput && void 0 === valResult.caret ? seekPrevious(forwardPosition) : forwardPosition,
1297
+ !1 !== writeOut && (setTimeout(function() {
1298
+ opts.onKeyValidation.call(input, k, valResult, opts);
1299
+ }, 0), maskset.writeOutBuffer && !1 !== valResult)) {
1300
+ var buffer = getBuffer();
1301
+ writeBuffer(input, buffer, forwardPosition, e, !0 !== checkval);
1302
+ }
1303
+ if (e.preventDefault(), checkval) return !1 !== valResult && (valResult.forwardPosition = forwardPosition),
1304
+ valResult;
1305
+ }
1306
+ },
1307
+ pasteEvent: function pasteEvent(e) {
1308
+ var input = this, ev = e.originalEvent || e, inputValue = this.inputmask._valueGet(!0), caretPos = caret(this), tempValue;
1309
+ isRTL && (tempValue = caretPos.end, caretPos.end = caretPos.begin, caretPos.begin = tempValue);
1310
+ var valueBeforeCaret = inputValue.substr(0, caretPos.begin), valueAfterCaret = inputValue.substr(caretPos.end, inputValue.length);
1311
+ if (valueBeforeCaret === (isRTL ? getBufferTemplate().reverse() : getBufferTemplate()).slice(0, caretPos.begin).join("") && (valueBeforeCaret = ""),
1312
+ valueAfterCaret === (isRTL ? getBufferTemplate().reverse() : getBufferTemplate()).slice(caretPos.end).join("") && (valueAfterCaret = ""),
1313
+ window.clipboardData && window.clipboardData.getData) inputValue = valueBeforeCaret + window.clipboardData.getData("Text") + valueAfterCaret; else {
1314
+ if (!ev.clipboardData || !ev.clipboardData.getData) return !0;
1315
+ inputValue = valueBeforeCaret + ev.clipboardData.getData("text/plain") + valueAfterCaret;
1316
+ }
1317
+ var pasteValue = inputValue;
1318
+ if ($.isFunction(opts.onBeforePaste)) {
1319
+ if (pasteValue = opts.onBeforePaste.call(inputmask, inputValue, opts), !1 === pasteValue) return e.preventDefault();
1320
+ pasteValue || (pasteValue = inputValue);
1321
+ }
1322
+ return checkVal(this, !1, !1, pasteValue.toString().split("")), writeBuffer(this, getBuffer(), seekNext(getLastValidPosition()), e, undoValue !== getBuffer().join("")),
1323
+ e.preventDefault();
1324
+ },
1325
+ inputFallBackEvent: function inputFallBackEvent(e) {
1326
+ function radixPointHandler(input, inputValue, caretPos) {
1327
+ return "." === inputValue.charAt(caretPos.begin - 1) && "" !== opts.radixPoint && (inputValue = inputValue.split(""),
1328
+ inputValue[caretPos.begin - 1] = opts.radixPoint.charAt(0), inputValue = inputValue.join("")),
1329
+ inputValue;
1330
+ }
1331
+ function ieMobileHandler(input, inputValue, caretPos) {
1332
+ if (iemobile) {
1333
+ var inputChar = inputValue.replace(getBuffer().join(""), "");
1334
+ if (1 === inputChar.length) {
1335
+ var iv = inputValue.split("");
1336
+ iv.splice(caretPos.begin, 0, inputChar), inputValue = iv.join("");
1337
+ }
1338
+ }
1339
+ return inputValue;
1340
+ }
1341
+ var input = this, inputValue = input.inputmask._valueGet();
1342
+ if (getBuffer().join("") !== inputValue) {
1343
+ var caretPos = caret(input);
1344
+ if (inputValue = radixPointHandler(input, inputValue, caretPos), inputValue = ieMobileHandler(input, inputValue, caretPos),
1345
+ getBuffer().join("") !== inputValue) {
1346
+ 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), selection = caretPos, entries = "", isEntry = !1;
1347
+ if (frontPart !== frontBufferPart) {
1348
+ var fpl = (isEntry = frontPart.length >= frontBufferPart.length) ? frontPart.length : frontBufferPart.length, i;
1349
+ for (i = 0; frontPart.charAt(i) === frontBufferPart.charAt(i) && i < fpl; i++) ;
1350
+ isEntry && (selection.begin = i - offset, entries += frontPart.slice(i, selection.end));
1351
+ }
1352
+ if (backPart !== backBufferPart && (backPart.length > backBufferPart.length ? entries += backPart.slice(0, 1) : backPart.length < backBufferPart.length && (selection.end += backBufferPart.length - backPart.length,
1353
+ isEntry || "" === opts.radixPoint || "" !== backPart || frontPart.charAt(selection.begin + offset - 1) !== opts.radixPoint || (selection.begin--,
1354
+ entries = opts.radixPoint))), writeBuffer(input, getBuffer(), {
1355
+ begin: selection.begin + offset,
1356
+ end: selection.end + offset
1357
+ }), 0 < entries.length) $.each(entries.split(""), function(ndx, entry) {
1358
+ var keypress = new $.Event("keypress");
1359
+ keypress.which = entry.charCodeAt(0), ignorable = !1, EventHandlers.keypressEvent.call(input, keypress);
1360
+ }); else {
1361
+ selection.begin === selection.end - 1 && (selection.begin = seekPrevious(selection.begin + 1),
1362
+ selection.begin === selection.end - 1 ? caret(input, selection.begin) : caret(input, selection.begin, selection.end));
1363
+ var keydown = new $.Event("keydown");
1364
+ keydown.keyCode = opts.numericInput ? Inputmask.keyCode.BACKSPACE : Inputmask.keyCode.DELETE,
1365
+ EventHandlers.keydownEvent.call(input, keydown);
1366
+ }
1367
+ e.preventDefault();
1368
+ }
1369
+ }
1370
+ },
1371
+ beforeInputEvent: function beforeInputEvent(e) {
1372
+ if (e.cancelable) {
1373
+ var input = this, keydown, keypress;
1374
+ switch (e.inputType) {
1375
+ case "insertText":
1376
+ return $.each(e.data.split(""), function(ndx, entry) {
1377
+ keypress = new $.Event("keypress"), keypress.which = entry.charCodeAt(0), ignorable = !1,
1378
+ EventHandlers.keypressEvent.call(input, keypress);
1379
+ }), e.preventDefault();
1380
+
1381
+ case "deleteContentBackward":
1382
+ return keydown = new $.Event("keydown"), keydown.keyCode = Inputmask.keyCode.BACKSPACE,
1383
+ EventHandlers.keydownEvent.call(input, keydown), e.preventDefault();
1384
+
1385
+ case "deleteContentForward":
1386
+ return keydown = new $.Event("keydown"), keydown.keyCode = Inputmask.keyCode.DELETE,
1387
+ EventHandlers.keydownEvent.call(input, keydown), e.preventDefault();
1388
+ }
1389
+ }
1390
+ },
1391
+ setValueEvent: function setValueEvent(e) {
1392
+ var input = this, value = e && e.detail ? e.detail[0] : arguments[1];
1393
+ value = value || this.inputmask._valueGet(!0), applyInputValue(this, value), (e.detail && void 0 !== e.detail[1] || void 0 !== arguments[2]) && caret(this, e.detail ? e.detail[1] : arguments[2]);
1394
+ },
1395
+ focusEvent: function focusEvent(e) {
1396
+ var input = this, nptValue = this.inputmask._valueGet();
1397
+ console.log(nptValue), opts.showMaskOnFocus && (nptValue !== getBuffer().join("") ? writeBuffer(this, getBuffer(), seekNext(getLastValidPosition())) : !1 === mouseEnter && caret(this, seekNext(getLastValidPosition()))),
1398
+ !0 === opts.positionCaretOnTab && !1 === mouseEnter && EventHandlers.clickEvent.apply(this, [ e, !0 ]),
1399
+ undoValue = getBuffer().join("");
1400
+ },
1401
+ mouseleaveEvent: function mouseleaveEvent() {
1402
+ var input = this;
1403
+ mouseEnter = !1, opts.clearMaskOnLostFocus && document.activeElement !== this && HandleNativePlaceholder(this, originalPlaceholder);
1404
+ },
1405
+ clickEvent: function clickEvent(e, tabbed) {
1406
+ var input = this;
1407
+ if (document.activeElement === this) {
1408
+ var newCaretPosition = determineNewCaretPosition(caret(this), tabbed);
1409
+ void 0 !== newCaretPosition && caret(this, newCaretPosition);
1410
+ }
1411
+ },
1412
+ cutEvent: function cutEvent(e) {
1413
+ var input = this, pos = caret(this), ev = e.originalEvent || e, clipboardData = window.clipboardData || ev.clipboardData, clipData = isRTL ? getBuffer().slice(pos.end, pos.begin) : getBuffer().slice(pos.begin, pos.end);
1414
+ clipboardData.setData("text", isRTL ? clipData.reverse().join("") : clipData.join("")),
1415
+ document.execCommand && document.execCommand("copy"), handleRemove(this, Inputmask.keyCode.DELETE, pos),
1416
+ writeBuffer(this, getBuffer(), maskset.p, e, undoValue !== getBuffer().join(""));
1417
+ },
1418
+ blurEvent: function blurEvent(e) {
1419
+ var $input = $(this), input = this;
1420
+ if (this.inputmask) {
1421
+ HandleNativePlaceholder(this, originalPlaceholder);
1422
+ var nptValue = this.inputmask._valueGet(), buffer = getBuffer().slice();
1423
+ "" === nptValue && void 0 === colorMask || (opts.clearMaskOnLostFocus && (-1 === getLastValidPosition() && nptValue === getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer)),
1424
+ !1 === isComplete(buffer) && (setTimeout(function() {
1425
+ $input.trigger("incomplete");
1426
+ }, 0), opts.clearIncomplete && (resetMaskSet(), buffer = opts.clearMaskOnLostFocus ? [] : getBufferTemplate().slice())),
1427
+ writeBuffer(this, buffer, void 0, e)), undoValue !== getBuffer().join("") && (undoValue = getBuffer().join(""),
1428
+ $input.trigger("change"));
1429
+ }
1430
+ },
1431
+ mouseenterEvent: function mouseenterEvent() {
1432
+ var input = this;
1433
+ mouseEnter = !0, document.activeElement !== this && (this.placeholder !== originalPlaceholder && (originalPlaceholder = this.placeholder),
1434
+ opts.showMaskOnHover && HandleNativePlaceholder(this, (isRTL ? getBuffer().slice().reverse() : getBuffer()).join("")));
1435
+ },
1436
+ submitEvent: function submitEvent() {
1437
+ undoValue !== getBuffer().join("") && $el.trigger("change"), opts.clearMaskOnLostFocus && -1 === getLastValidPosition() && el.inputmask._valueGet && el.inputmask._valueGet() === getBufferTemplate().join("") && el.inputmask._valueSet(""),
1438
+ opts.clearIncomplete && !1 === isComplete(getBuffer()) && el.inputmask._valueSet(""),
1439
+ opts.removeMaskOnSubmit && (el.inputmask._valueSet(el.inputmask.unmaskedvalue(), !0),
1440
+ setTimeout(function() {
1441
+ writeBuffer(el, getBuffer());
1442
+ }, 0));
1443
+ },
1444
+ resetEvent: function resetEvent() {
1445
+ el.inputmask.refreshValue = !0, setTimeout(function() {
1446
+ applyInputValue(el, el.inputmask._valueGet(!0));
1447
+ }, 0);
1448
+ }
1449
+ }, valueBuffer;
1450
+ function checkVal(input, writeOut, strict, nptvl, initiatingEvent) {
1451
+ var inputmask = this || input.inputmask, inputValue = nptvl.slice(), charCodes = "", initialNdx = -1, result = void 0;
1452
+ function isTemplateMatch(ndx, charCodes) {
1453
+ if (opts.regex) return !1;
1454
+ for (var targetTemplate = getMaskTemplate(!0, 0, !1).slice(ndx, seekNext(ndx)).join("").replace(/'/g, ""), charCodeNdx = targetTemplate.indexOf(charCodes); 0 < charCodeNdx && " " === targetTemplate[charCodeNdx - 1]; ) charCodeNdx--;
1455
+ var match = 0 === charCodeNdx && !isMask(ndx) && (getTest(ndx).match.nativeDef === charCodes.charAt(0) || !0 === getTest(ndx).match.static && getTest(ndx).match.nativeDef === "'" + charCodes.charAt(0) || " " === getTest(ndx).match.nativeDef && (getTest(ndx + 1).match.nativeDef === charCodes.charAt(0) || !0 === getTest(ndx + 1).match.static && getTest(ndx + 1).match.nativeDef === "'" + charCodes.charAt(0)));
1456
+ return !match && 0 < charCodeNdx && (inputmask.caretPos = {
1457
+ begin: seekNext(charCodeNdx)
1458
+ }), match;
1459
+ }
1460
+ resetMaskSet(), initialNdx = opts.radixPoint ? determineNewCaretPosition(0) : 0,
1461
+ maskset.p = initialNdx, inputmask.caretPos = {
1462
+ begin: initialNdx
1463
+ };
1464
+ var staticMatches = [], prevCaretPos = inputmask.caretPos, sndx, validPos, nextValid;
1465
+ if ($.each(inputValue, function(ndx, charCode) {
1466
+ if (void 0 !== charCode) if (void 0 === maskset.validPositions[ndx] && inputValue[ndx] === getPlaceholder(ndx) && isMask(ndx, !0) && !1 === isValid(ndx, inputValue[ndx], !0, void 0, void 0, !0)) maskset.p++; else {
1467
+ var keypress = new $.Event("_checkval");
1468
+ keypress.which = charCode.charCodeAt(0), charCodes += charCode;
1469
+ var lvp = getLastValidPosition(void 0, !0);
1470
+ isTemplateMatch(initialNdx, charCodes) ? result = EventHandlers.keypressEvent.call(input, keypress, !0, !1, strict, lvp + 1) : (result = EventHandlers.keypressEvent.call(input, keypress, !0, !1, strict, inputmask.caretPos.begin),
1471
+ result && (initialNdx = inputmask.caretPos.begin + 1, charCodes = "")), result ? (void 0 !== result.pos && maskset.validPositions[result.pos] && !0 === maskset.validPositions[result.pos].match.static && (staticMatches.push(result.pos),
1472
+ isRTL || (result.forwardPosition = result.pos + 1)), writeBuffer(void 0, getBuffer(), result.forwardPosition, keypress, !1),
1473
+ inputmask.caretPos = {
1474
+ begin: result.forwardPosition,
1475
+ end: result.forwardPosition
1476
+ }, prevCaretPos = inputmask.caretPos) : inputmask.caretPos = prevCaretPos;
1477
+ }
1478
+ }), 0 < staticMatches.length) if (!isComplete(getBuffer()) || staticMatches.length < seekNext(0)) for (;void 0 !== (sndx = staticMatches.pop()); ) {
1479
+ var keypress = new $.Event("_checkval"), nextSndx = sndx + 1;
1480
+ for (validPos = maskset.validPositions[sndx], validPos.generatedInput = !0, keypress.which = validPos.input.charCodeAt(0); (nextValid = maskset.validPositions[nextSndx]) && nextValid.input === validPos.input; ) nextSndx++;
1481
+ result = EventHandlers.keypressEvent.call(input, keypress, !0, !1, strict, nextSndx),
1482
+ result && void 0 !== result.pos && result.pos !== sndx && maskset.validPositions[result.pos] && !0 === maskset.validPositions[result.pos].match.static && staticMatches.push(result.pos);
1483
+ } else for (;sndx = staticMatches.pop(); ) validPos = maskset.validPositions[sndx],
1484
+ validPos && (validPos.generatedInput = !0);
1485
+ writeOut && writeBuffer(input, getBuffer(), result ? result.forwardPosition : void 0, initiatingEvent || new $.Event("checkval"), initiatingEvent && "input" === initiatingEvent.type);
1486
+ }
1487
+ function unmaskedvalue(input) {
1488
+ if (input) {
1489
+ if (void 0 === input.inputmask) return input.value;
1490
+ input.inputmask && input.inputmask.refreshValue && applyInputValue(input, input.inputmask._valueGet(!0));
1491
+ }
1492
+ var umValue = [], vps = maskset.validPositions;
1493
+ for (var pndx in vps) vps[pndx] && vps[pndx].match && 1 != vps[pndx].match.static && umValue.push(vps[pndx].input);
1494
+ var unmaskedValue = 0 === umValue.length ? "" : (isRTL ? umValue.reverse() : umValue).join("");
1495
+ if ($.isFunction(opts.onUnMask)) {
1496
+ var bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join("");
1497
+ unmaskedValue = opts.onUnMask.call(inputmask, bufferValue, unmaskedValue, opts);
1498
+ }
1499
+ return unmaskedValue;
1500
+ }
1501
+ function caret(input, begin, end, notranslate) {
1502
+ function translatePosition(pos) {
1503
+ return !isRTL || "number" != typeof pos || opts.greedy && "" === opts.placeholder || !el || (pos = el.inputmask._valueGet().length - pos),
1504
+ pos;
1505
+ }
1506
+ var range;
1507
+ if (void 0 === begin) return "selectionStart" in input && "selectionEnd" in input ? (begin = input.selectionStart,
1508
+ end = input.selectionEnd) : window.getSelection ? (range = window.getSelection().getRangeAt(0),
1509
+ range.commonAncestorContainer.parentNode !== input && range.commonAncestorContainer !== input || (begin = range.startOffset,
1510
+ end = range.endOffset)) : document.selection && document.selection.createRange && (range = document.selection.createRange(),
1511
+ begin = 0 - range.duplicate().moveStart("character", -input.inputmask._valueGet().length),
1512
+ end = begin + range.text.length), {
1513
+ begin: notranslate ? begin : translatePosition(begin),
1514
+ end: notranslate ? end : translatePosition(end)
1515
+ };
1516
+ if ($.isArray(begin) && (end = isRTL ? begin[0] : begin[1], begin = isRTL ? begin[1] : begin[0]),
1517
+ void 0 !== begin.begin && (end = isRTL ? begin.begin : begin.end, begin = isRTL ? begin.end : begin.begin),
1518
+ "number" == typeof begin) {
1519
+ begin = notranslate ? begin : translatePosition(begin), end = notranslate ? end : translatePosition(end),
1520
+ end = "number" == typeof end ? end : begin;
1521
+ var scrollCalc = parseInt(((input.ownerDocument.defaultView || window).getComputedStyle ? (input.ownerDocument.defaultView || window).getComputedStyle(input, null) : input.currentStyle).fontSize) * end;
1522
+ if (input.scrollLeft = scrollCalc > input.scrollWidth ? scrollCalc : 0, input.inputmask.caretPos = {
1523
+ begin: begin,
1524
+ end: end
1525
+ }, input === document.activeElement) {
1526
+ if ("setSelectionRange" in input) input.setSelectionRange(begin, end); else if (window.getSelection) {
1527
+ if (range = document.createRange(), void 0 === input.firstChild || null === input.firstChild) {
1528
+ var textNode = document.createTextNode("");
1529
+ input.appendChild(textNode);
1530
+ }
1531
+ range.setStart(input.firstChild, begin < input.inputmask._valueGet().length ? begin : input.inputmask._valueGet().length),
1532
+ range.setEnd(input.firstChild, end < input.inputmask._valueGet().length ? end : input.inputmask._valueGet().length),
1533
+ range.collapse(!0);
1534
+ var sel = window.getSelection();
1535
+ sel.removeAllRanges(), sel.addRange(range);
1536
+ } else input.createTextRange && (range = input.createTextRange(), range.collapse(!0),
1537
+ range.moveEnd("character", end), range.moveStart("character", begin), range.select());
1538
+ renderColorMask(input, {
1539
+ begin: begin,
1540
+ end: end
1541
+ });
1542
+ }
1543
+ }
1544
+ }
1545
+ function determineLastRequiredPosition(returnDefinition) {
1546
+ var buffer = getMaskTemplate(!0, getLastValidPosition(), !0, !0), bl = buffer.length, pos, lvp = getLastValidPosition(), positions = {}, lvTest = maskset.validPositions[lvp], ndxIntlzr = void 0 !== lvTest ? lvTest.locator.slice() : void 0, testPos;
1547
+ for (pos = lvp + 1; pos < buffer.length; pos++) testPos = getTestTemplate(pos, ndxIntlzr, pos - 1),
1548
+ ndxIntlzr = testPos.locator.slice(), positions[pos] = $.extend(!0, {}, testPos);
1549
+ var lvTestAlt = lvTest && void 0 !== lvTest.alternation ? lvTest.locator[lvTest.alternation] : void 0;
1550
+ for (pos = bl - 1; lvp < pos && (testPos = positions[pos], (testPos.match.optionality || testPos.match.optionalQuantifier && testPos.match.newBlockMarker || lvTestAlt && (lvTestAlt !== positions[pos].locator[lvTest.alternation] && 1 != testPos.match.static || !0 === testPos.match.static && testPos.locator[lvTest.alternation] && checkAlternationMatch(testPos.locator[lvTest.alternation].toString().split(","), lvTestAlt.toString().split(",")) && "" !== getTests(pos)[0].def)) && buffer[pos] === getPlaceholder(pos, testPos.match)); pos--) bl--;
1551
+ return returnDefinition ? {
1552
+ l: bl,
1553
+ def: positions[bl] ? positions[bl].match : void 0
1554
+ } : bl;
1555
+ }
1556
+ function clearOptionalTail(buffer) {
1557
+ buffer.length = 0;
1558
+ for (var template = getMaskTemplate(!0, 0, !0, void 0, !0), lmnt; void 0 !== (lmnt = template.shift()); ) buffer.push(lmnt);
1559
+ return buffer;
1560
+ }
1561
+ function isComplete(buffer) {
1562
+ if ($.isFunction(opts.isComplete)) return opts.isComplete(buffer, opts);
1563
+ if ("*" !== opts.repeat) {
1564
+ var complete = !1, lrp = determineLastRequiredPosition(!0), aml = seekPrevious(lrp.l);
1565
+ if (void 0 === lrp.def || lrp.def.newBlockMarker || lrp.def.optionality || lrp.def.optionalQuantifier) {
1566
+ complete = !0;
1567
+ for (var i = 0; i <= aml; i++) {
1568
+ var test = getTestTemplate(i).match;
1569
+ if (!0 !== test.static && void 0 === maskset.validPositions[i] && !0 !== test.optionality && !0 !== test.optionalQuantifier || !0 === test.static && buffer[i] !== getPlaceholder(i, test)) {
1570
+ complete = !1;
1571
+ break;
1572
+ }
1573
+ }
1574
+ }
1575
+ return complete;
1576
+ }
1577
+ }
1578
+ function handleRemove(input, k, pos, strict, fromIsValid) {
1579
+ if ((opts.numericInput || isRTL) && (k === Inputmask.keyCode.BACKSPACE ? k = Inputmask.keyCode.DELETE : k === Inputmask.keyCode.DELETE && (k = Inputmask.keyCode.BACKSPACE),
1580
+ isRTL)) {
1581
+ var pend = pos.end;
1582
+ pos.end = pos.begin, pos.begin = pend;
1583
+ }
1584
+ if (k === Inputmask.keyCode.BACKSPACE && pos.end - pos.begin < 1 ? (pos.begin = seekPrevious(pos.begin),
1585
+ void 0 !== maskset.validPositions[pos.begin] && maskset.validPositions[pos.begin].input === opts.groupSeparator && pos.begin--) : k === Inputmask.keyCode.DELETE && pos.begin === pos.end && (pos.end = isMask(pos.end, !0) && maskset.validPositions[pos.end] && maskset.validPositions[pos.end].input !== opts.radixPoint ? pos.end + 1 : seekNext(pos.end) + 1,
1586
+ void 0 !== maskset.validPositions[pos.begin] && maskset.validPositions[pos.begin].input === opts.groupSeparator && pos.end++),
1587
+ revalidateMask(pos), !0 !== strict && !1 !== opts.keepStatic || null !== opts.regex) {
1588
+ var result = alternate(!0);
1589
+ if (result) {
1590
+ var newPos = void 0 !== result.caret ? result.caret : result.pos ? seekNext(result.pos.begin ? result.pos.begin : result.pos) : getLastValidPosition(-1, !0);
1591
+ (k !== Inputmask.keyCode.DELETE || pos.begin > newPos) && pos.begin;
1592
+ }
1593
+ }
1594
+ var lvp = getLastValidPosition(pos.begin, !0);
1595
+ if (lvp < pos.begin || -1 === pos.begin) maskset.p = seekNext(lvp); else if (!0 !== strict && (maskset.p = pos.begin,
1596
+ !0 !== fromIsValid)) for (;maskset.p < lvp && void 0 === maskset.validPositions[maskset.p]; ) maskset.p++;
1597
+ }
1598
+ function initializeColorMask(input) {
1599
+ var computedStyle = (input.ownerDocument.defaultView || window).getComputedStyle(input, null);
1600
+ function findCaretPos(clientx) {
1601
+ var e = document.createElement("span"), caretPos;
1602
+ for (var style in computedStyle) isNaN(style) && -1 !== style.indexOf("font") && (e.style[style] = computedStyle[style]);
1603
+ e.style.textTransform = computedStyle.textTransform, e.style.letterSpacing = computedStyle.letterSpacing,
1604
+ e.style.position = "absolute", e.style.height = "auto", e.style.width = "auto",
1605
+ e.style.visibility = "hidden", e.style.whiteSpace = "nowrap", document.body.appendChild(e);
1606
+ var inputText = input.inputmask._valueGet(), previousWidth = 0, itl;
1607
+ for (caretPos = 0, itl = inputText.length; caretPos <= itl; caretPos++) {
1608
+ if (e.innerHTML += inputText.charAt(caretPos) || "_", e.offsetWidth >= clientx) {
1609
+ var offset1 = clientx - previousWidth, offset2 = e.offsetWidth - clientx;
1610
+ e.innerHTML = inputText.charAt(caretPos), offset1 -= e.offsetWidth / 3, caretPos = offset1 < offset2 ? caretPos - 1 : caretPos;
1611
+ break;
1612
+ }
1613
+ previousWidth = e.offsetWidth;
1614
+ }
1615
+ return document.body.removeChild(e), caretPos;
1616
+ }
1617
+ var template = document.createElement("div");
1618
+ template.style.width = computedStyle.width, template.style.textAlign = computedStyle.textAlign,
1619
+ colorMask = document.createElement("div"), input.inputmask.colorMask = colorMask,
1620
+ colorMask.className = "im-colormask", input.parentNode.insertBefore(colorMask, input),
1621
+ input.parentNode.removeChild(input), colorMask.appendChild(input), colorMask.appendChild(template),
1622
+ input.style.left = template.offsetLeft + "px", $(colorMask).on("mouseleave", function(e) {
1623
+ return EventHandlers.mouseleaveEvent.call(input, [ e ]);
1624
+ }), $(colorMask).on("mouseenter", function(e) {
1625
+ return EventHandlers.mouseenterEvent.call(input, [ e ]);
1626
+ }), $(colorMask).on("click", function(e) {
1627
+ return caret(input, findCaretPos(e.clientX)), EventHandlers.clickEvent.call(input, [ e ]);
1628
+ });
1629
+ }
1630
+ function renderColorMask(input, caretPos, clear) {
1631
+ var maskTemplate = [], isStatic = !1, test, testPos, ndxIntlzr, pos = 0;
1632
+ function setEntry(entry) {
1633
+ if (void 0 === entry && (entry = ""), isStatic || !0 !== test.static && void 0 !== testPos.input) if (isStatic && (!0 !== test.static && void 0 !== testPos.input || "" === test.def)) {
1634
+ isStatic = !1;
1635
+ var mtl = maskTemplate.length;
1636
+ maskTemplate[mtl - 1] = maskTemplate[mtl - 1] + "</span>", maskTemplate.push(entry);
1637
+ } else maskTemplate.push(entry); else isStatic = !0, maskTemplate.push("<span class='im-static'>" + entry);
1638
+ }
1639
+ function setCaret() {
1640
+ document.activeElement === input && (maskTemplate.splice(caretPos.begin, 0, caretPos.begin === caretPos.end || caretPos.end > maskset.maskLength ? '<mark class="im-caret" style="border-right-width: 1px;border-right-style: solid;">' : '<mark class="im-caret-select">'),
1641
+ maskTemplate.splice(caretPos.end + 1, 0, "</mark>"));
1642
+ }
1643
+ if (void 0 !== colorMask) {
1644
+ var buffer = getBuffer();
1645
+ if (void 0 === caretPos ? caretPos = caret(input) : void 0 === caretPos.begin && (caretPos = {
1646
+ begin: caretPos,
1647
+ end: caretPos
1648
+ }), !0 !== clear) {
1649
+ for (var lvp = getLastValidPosition(); maskset.validPositions[pos] ? (testPos = maskset.validPositions[pos],
1650
+ test = testPos.match, ndxIntlzr = testPos.locator.slice(), setEntry(buffer[pos])) : (testPos = getTestTemplate(pos, ndxIntlzr, pos - 1),
1651
+ test = testPos.match, ndxIntlzr = testPos.locator.slice(), !1 === opts.jitMasking || pos < lvp || "number" == typeof opts.jitMasking && isFinite(opts.jitMasking) && opts.jitMasking > pos ? setEntry(getPlaceholder(pos, test)) : isStatic = !1),
1652
+ pos++, (void 0 === maxLength || pos < maxLength) && (!0 !== test.static || "" !== test.def) || pos < lvp || isStatic; ) ;
1653
+ isStatic && setEntry(), setCaret();
1654
+ }
1655
+ var template = colorMask.getElementsByTagName("div")[0];
1656
+ template.innerHTML = maskTemplate.join(""), input.inputmask.positionColorMask(input, template);
1657
+ }
1658
+ }
1659
+ function applyInputValue(input, value) {
1660
+ input.inputmask.refreshValue = !1, $.isFunction(opts.onBeforeMask) && (value = opts.onBeforeMask.call(inputmask, value, opts) || value),
1661
+ value = value.toString().split(""), checkVal(input, !0, !1, value), undoValue = getBuffer().join(""),
1662
+ (opts.clearMaskOnLostFocus || opts.clearIncomplete) && input.inputmask._valueGet() === getBufferTemplate().join("") && -1 === getLastValidPosition() && input.inputmask._valueSet("");
1663
+ }
1664
+ function mask(elem) {
1665
+ function isElementTypeSupported(input, opts) {
1666
+ function patchValueProperty(npt) {
1667
+ var valueGet, valueSet;
1668
+ function patchValhook(type) {
1669
+ if ($.valHooks && (void 0 === $.valHooks[type] || !0 !== $.valHooks[type].inputmaskpatch)) {
1670
+ var valhookGet = $.valHooks[type] && $.valHooks[type].get ? $.valHooks[type].get : function(elem) {
1671
+ return elem.value;
1672
+ }, valhookSet = $.valHooks[type] && $.valHooks[type].set ? $.valHooks[type].set : function(elem, value) {
1673
+ return elem.value = value, elem;
1674
+ };
1675
+ $.valHooks[type] = {
1676
+ get: function get(elem) {
1677
+ if (elem.inputmask) {
1678
+ if (elem.inputmask.opts.autoUnmask) return elem.inputmask.unmaskedvalue();
1679
+ var result = valhookGet(elem);
1680
+ return -1 !== getLastValidPosition(void 0, void 0, elem.inputmask.maskset.validPositions) || !0 !== opts.nullable ? result : "";
1681
+ }
1682
+ return valhookGet(elem);
1683
+ },
1684
+ set: function set(elem, value) {
1685
+ var result = valhookSet(elem, value);
1686
+ return elem.inputmask && applyInputValue(elem, value), result;
1687
+ },
1688
+ inputmaskpatch: !0
1689
+ };
1690
+ }
1691
+ }
1692
+ function getter() {
1693
+ return this.inputmask ? this.inputmask.opts.autoUnmask ? this.inputmask.unmaskedvalue() : -1 !== getLastValidPosition() || !0 !== opts.nullable ? document.activeElement === this && opts.clearMaskOnLostFocus ? (isRTL ? clearOptionalTail(getBuffer().slice()).reverse() : clearOptionalTail(getBuffer().slice())).join("") : valueGet.call(this) : "" : valueGet.call(this);
1694
+ }
1695
+ function setter(value) {
1696
+ valueSet.call(this, value), this.inputmask && applyInputValue(this, value);
1697
+ }
1698
+ function installNativeValueSetFallback(npt) {
1699
+ EventRuler.on(npt, "mouseenter", function() {
1700
+ var input = this, value = this.inputmask._valueGet(!0);
1701
+ value !== (isRTL ? getBuffer().reverse() : getBuffer()).join("") && applyInputValue(this, value);
1702
+ });
1703
+ }
1704
+ if (!npt.inputmask.__valueGet) {
1705
+ if (!0 !== opts.noValuePatching) {
1706
+ if (Object.getOwnPropertyDescriptor) {
1707
+ "function" != typeof Object.getPrototypeOf && (Object.getPrototypeOf = "object" === _typeof("test".__proto__) ? function(object) {
1708
+ return object.__proto__;
1709
+ } : function(object) {
1710
+ return object.constructor.prototype;
1711
+ });
1712
+ var valueProperty = Object.getPrototypeOf ? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(npt), "value") : void 0;
1713
+ valueProperty && valueProperty.get && valueProperty.set ? (valueGet = valueProperty.get,
1714
+ valueSet = valueProperty.set, Object.defineProperty(npt, "value", {
1715
+ get: getter,
1716
+ set: setter,
1717
+ configurable: !0
1718
+ })) : "INPUT" !== npt.tagName && (valueGet = function valueGet() {
1719
+ return this.textContent;
1720
+ }, valueSet = function valueSet(value) {
1721
+ this.textContent = value;
1722
+ }, Object.defineProperty(npt, "value", {
1723
+ get: getter,
1724
+ set: setter,
1725
+ configurable: !0
1726
+ }));
1727
+ } else document.__lookupGetter__ && npt.__lookupGetter__("value") && (valueGet = npt.__lookupGetter__("value"),
1728
+ valueSet = npt.__lookupSetter__("value"), npt.__defineGetter__("value", getter),
1729
+ npt.__defineSetter__("value", setter));
1730
+ npt.inputmask.__valueGet = valueGet, npt.inputmask.__valueSet = valueSet;
1731
+ }
1732
+ npt.inputmask._valueGet = function(overruleRTL) {
1733
+ return isRTL && !0 !== overruleRTL ? valueGet.call(this.el).split("").reverse().join("") : valueGet.call(this.el);
1734
+ }, npt.inputmask._valueSet = function(value, overruleRTL) {
1735
+ valueSet.call(this.el, null == value ? "" : !0 !== overruleRTL && isRTL ? value.split("").reverse().join("") : value);
1736
+ }, void 0 === valueGet && (valueGet = function valueGet() {
1737
+ return this.value;
1738
+ }, valueSet = function valueSet(value) {
1739
+ this.value = value;
1740
+ }, patchValhook(npt.type), installNativeValueSetFallback(npt));
1741
+ }
1742
+ }
1743
+ var elementType = input.getAttribute("type"), isSupported = "INPUT" === input.tagName && -1 !== $.inArray(elementType, opts.supportsInputType) || input.isContentEditable || "TEXTAREA" === input.tagName;
1744
+ if (!isSupported) if ("INPUT" === input.tagName) {
1745
+ var el = document.createElement("input");
1746
+ el.setAttribute("type", elementType), isSupported = "text" === el.type, el = null;
1747
+ } else isSupported = "partial";
1748
+ return !1 !== isSupported ? patchValueProperty(input) : input.inputmask = void 0,
1749
+ isSupported;
1750
+ }
1751
+ EventRuler.off(elem);
1752
+ var isSupported = isElementTypeSupported(elem, opts);
1753
+ if (!1 !== isSupported && (el = elem, $el = $(el), originalPlaceholder = el.placeholder,
1754
+ maxLength = void 0 !== el ? el.maxLength : void 0, -1 === maxLength && (maxLength = void 0),
1755
+ !0 === opts.colorMask && initializeColorMask(el), mobile && ("inputmode" in el && (el.inputmode = opts.inputmode,
1756
+ el.setAttribute("inputmode", opts.inputmode)), !0 === opts.disablePredictiveText && ("autocorrect" in el ? el.autocorrect = !1 : (!0 !== opts.colorMask && initializeColorMask(el),
1757
+ el.type = "password"))), !0 === isSupported && (el.setAttribute("data-im-insert", opts.insertMode),
1758
+ EventRuler.on(el, "submit", EventHandlers.submitEvent), EventRuler.on(el, "reset", EventHandlers.resetEvent),
1759
+ EventRuler.on(el, "blur", EventHandlers.blurEvent), EventRuler.on(el, "focus", EventHandlers.focusEvent),
1760
+ !0 !== opts.colorMask && (EventRuler.on(el, "click", EventHandlers.clickEvent),
1761
+ EventRuler.on(el, "mouseleave", EventHandlers.mouseleaveEvent), EventRuler.on(el, "mouseenter", EventHandlers.mouseenterEvent)),
1762
+ EventRuler.on(el, "paste", EventHandlers.pasteEvent), EventRuler.on(el, "cut", EventHandlers.cutEvent),
1763
+ EventRuler.on(el, "complete", opts.oncomplete), EventRuler.on(el, "incomplete", opts.onincomplete),
1764
+ EventRuler.on(el, "cleared", opts.oncleared), mobile || !0 === opts.inputEventOnly ? el.removeAttribute("maxLength") : (EventRuler.on(el, "keydown", EventHandlers.keydownEvent),
1765
+ EventRuler.on(el, "keypress", EventHandlers.keypressEvent)), EventRuler.on(el, "input", EventHandlers.inputFallBackEvent),
1766
+ EventRuler.on(el, "beforeinput", EventHandlers.beforeInputEvent)), EventRuler.on(el, "setvalue", EventHandlers.setValueEvent),
1767
+ undoValue = getBufferTemplate().join(""), "" !== el.inputmask._valueGet(!0) || !1 === opts.clearMaskOnLostFocus || document.activeElement === el)) {
1768
+ applyInputValue(el, el.inputmask._valueGet(!0), opts);
1769
+ var buffer = getBuffer().slice();
1770
+ !1 === isComplete(buffer) && opts.clearIncomplete && resetMaskSet(), opts.clearMaskOnLostFocus && document.activeElement !== el && (-1 === getLastValidPosition() ? buffer = [] : clearOptionalTail(buffer)),
1771
+ (!1 === opts.clearMaskOnLostFocus || opts.showMaskOnFocus && document.activeElement === el || "" !== el.inputmask._valueGet(!0)) && writeBuffer(el, buffer),
1772
+ document.activeElement === el && caret(el, seekNext(getLastValidPosition()));
1773
+ }
1774
+ }
1775
+ if (void 0 !== actionObj) switch (actionObj.action) {
1776
+ case "isComplete":
1777
+ return el = actionObj.el, isComplete(getBuffer());
1778
+
1779
+ case "unmaskedvalue":
1780
+ return void 0 !== el && void 0 === actionObj.value || (valueBuffer = actionObj.value,
1781
+ valueBuffer = ($.isFunction(opts.onBeforeMask) && opts.onBeforeMask.call(inputmask, valueBuffer, opts) || valueBuffer).split(""),
1782
+ checkVal.call(this, void 0, !1, !1, valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite.call(inputmask, void 0, getBuffer(), 0, opts)),
1783
+ unmaskedvalue(el);
1784
+
1785
+ case "mask":
1786
+ mask(el);
1787
+ break;
1788
+
1789
+ case "format":
1790
+ return valueBuffer = ($.isFunction(opts.onBeforeMask) && opts.onBeforeMask.call(inputmask, actionObj.value, opts) || actionObj.value).split(""),
1791
+ checkVal.call(this, void 0, !0, !1, valueBuffer), actionObj.metadata ? {
1792
+ value: isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""),
1793
+ metadata: maskScope.call(this, {
1794
+ action: "getmetadata"
1795
+ }, maskset, opts)
1796
+ } : isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join("");
1797
+
1798
+ case "isValid":
1799
+ actionObj.value ? (valueBuffer = ($.isFunction(opts.onBeforeMask) && opts.onBeforeMask.call(inputmask, actionObj.value, opts) || actionObj.value).split(""),
1800
+ checkVal.call(this, void 0, !0, !1, valueBuffer)) : actionObj.value = isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join("");
1801
+ for (var buffer = getBuffer(), rl = determineLastRequiredPosition(), lmib = buffer.length - 1; rl < lmib && !isMask(lmib); lmib--) ;
1802
+ return buffer.splice(rl, lmib + 1 - rl), isComplete(buffer) && actionObj.value === (isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""));
1803
+
1804
+ case "getemptymask":
1805
+ return getBufferTemplate().join("");
1806
+
1807
+ case "remove":
1808
+ if (el && el.inputmask) {
1809
+ $.data(el, "_inputmask_opts", null), $el = $(el);
1810
+ var cv = opts.autoUnmask ? unmaskedvalue(el) : el.inputmask._valueGet(opts.autoUnmask), valueProperty;
1811
+ cv !== getBufferTemplate().join("") ? el.inputmask._valueSet(cv, opts.autoUnmask) : el.inputmask._valueSet(""),
1812
+ EventRuler.off(el), el.inputmask.colorMask && (colorMask = el.inputmask.colorMask,
1813
+ colorMask.removeChild(el), colorMask.parentNode.insertBefore(el, colorMask), colorMask.parentNode.removeChild(colorMask)),
1814
+ Object.getOwnPropertyDescriptor && Object.getPrototypeOf ? (valueProperty = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(el), "value"),
1815
+ valueProperty && el.inputmask.__valueGet && Object.defineProperty(el, "value", {
1816
+ get: el.inputmask.__valueGet,
1817
+ set: el.inputmask.__valueSet,
1818
+ configurable: !0
1819
+ })) : document.__lookupGetter__ && el.__lookupGetter__("value") && el.inputmask.__valueGet && (el.__defineGetter__("value", el.inputmask.__valueGet),
1820
+ el.__defineSetter__("value", el.inputmask.__valueSet)), el.inputmask = void 0;
1821
+ }
1822
+ return el;
1823
+
1824
+ case "getmetadata":
1825
+ if ($.isArray(maskset.metadata)) {
1826
+ var maskTarget = getMaskTemplate(!0, 0, !1).join("");
1827
+ return $.each(maskset.metadata, function(ndx, mtdt) {
1828
+ if (mtdt.mask === maskTarget) return maskTarget = mtdt, !1;
1829
+ }), maskTarget;
1830
+ }
1831
+ return maskset.metadata;
1832
+ }
1833
+ };
1834
+ }, function(module, exports, __webpack_require__) {
1835
+ function _typeof(obj) {
1836
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function _typeof(obj) {
1837
+ return typeof obj;
1838
+ } : function _typeof(obj) {
1839
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1840
+ }, _typeof(obj);
1841
+ }
1842
+ var Inputmask = __webpack_require__(3), $ = Inputmask.dependencyLib, formatCode = {
1843
+ d: [ "[1-9]|[12][0-9]|3[01]", Date.prototype.setDate, "day", Date.prototype.getDate ],
1844
+ dd: [ "0[1-9]|[12][0-9]|3[01]", Date.prototype.setDate, "day", function() {
1845
+ return pad(Date.prototype.getDate.call(this), 2);
1846
+ } ],
1847
+ ddd: [ "" ],
1848
+ dddd: [ "" ],
1849
+ m: [ "[1-9]|1[012]", Date.prototype.setMonth, "month", function() {
1850
+ return Date.prototype.getMonth.call(this) + 1;
1851
+ } ],
1852
+ mm: [ "0[1-9]|1[012]", Date.prototype.setMonth, "month", function() {
1853
+ return pad(Date.prototype.getMonth.call(this) + 1, 2);
1854
+ } ],
1855
+ mmm: [ "" ],
1856
+ mmmm: [ "" ],
1857
+ yy: [ "[0-9]{2}", Date.prototype.setFullYear, "year", function() {
1858
+ return pad(Date.prototype.getFullYear.call(this), 2);
1859
+ } ],
1860
+ yyyy: [ "[0-9]{4}", Date.prototype.setFullYear, "year", function() {
1861
+ return pad(Date.prototype.getFullYear.call(this), 4);
1862
+ } ],
1863
+ h: [ "[1-9]|1[0-2]", Date.prototype.setHours, "hours", Date.prototype.getHours ],
1864
+ hh: [ "0[1-9]|1[0-2]", Date.prototype.setHours, "hours", function() {
1865
+ return pad(Date.prototype.getHours.call(this), 2);
1866
+ } ],
1867
+ hhh: [ "[0-9]+", Date.prototype.setHours, "hours", Date.prototype.getHours ],
1868
+ H: [ "1?[0-9]|2[0-3]", Date.prototype.setHours, "hours", Date.prototype.getHours ],
1869
+ HH: [ "0[0-9]|1[0-9]|2[0-3]", Date.prototype.setHours, "hours", function() {
1870
+ return pad(Date.prototype.getHours.call(this), 2);
1871
+ } ],
1872
+ HHH: [ "[0-9]+", Date.prototype.setHours, "hours", Date.prototype.getHours ],
1873
+ M: [ "[1-5]?[0-9]", Date.prototype.setMinutes, "minutes", Date.prototype.getMinutes ],
1874
+ MM: [ "0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]", Date.prototype.setMinutes, "minutes", function() {
1875
+ return pad(Date.prototype.getMinutes.call(this), 2);
1876
+ } ],
1877
+ s: [ "[1-5]?[0-9]", Date.prototype.setSeconds, "seconds", Date.prototype.getSeconds ],
1878
+ ss: [ "0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]", Date.prototype.setSeconds, "seconds", function() {
1879
+ return pad(Date.prototype.getSeconds.call(this), 2);
1880
+ } ],
1881
+ l: [ "[0-9]{3}", Date.prototype.setMilliseconds, "milliseconds", function() {
1882
+ return pad(Date.prototype.getMilliseconds.call(this), 3);
1883
+ } ],
1884
+ L: [ "[0-9]{2}", Date.prototype.setMilliseconds, "milliseconds", function() {
1885
+ return pad(Date.prototype.getMilliseconds.call(this), 2);
1886
+ } ],
1887
+ t: [ "[ap]" ],
1888
+ tt: [ "[ap]m" ],
1889
+ T: [ "[AP]" ],
1890
+ TT: [ "[AP]M" ],
1891
+ Z: [ "" ],
1892
+ o: [ "" ],
1893
+ S: [ "" ]
1894
+ }, formatAlias = {
1895
+ isoDate: "yyyy-mm-dd",
1896
+ isoTime: "HH:MM:ss",
1897
+ isoDateTime: "yyyy-mm-dd'T'HH:MM:ss",
1898
+ isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
1899
+ };
1900
+ function getTokenizer(opts) {
1901
+ if (!opts.tokenizer) {
1902
+ var tokens = [];
1903
+ for (var ndx in formatCode) -1 === tokens.indexOf(ndx[0]) && tokens.push(ndx[0]);
1904
+ opts.tokenizer = "(" + tokens.join("+|") + ")+?|.", opts.tokenizer = new RegExp(opts.tokenizer, "g");
1905
+ }
1906
+ return opts.tokenizer;
1907
+ }
1908
+ function isValidDate(dateParts, currentResult) {
1909
+ return (!isFinite(dateParts.rawday) || "29" == dateParts.day && !isFinite(dateParts.rawyear) || new Date(dateParts.date.getFullYear(), isFinite(dateParts.rawmonth) ? dateParts.month : dateParts.date.getMonth() + 1, 0).getDate() >= dateParts.day) && currentResult;
1910
+ }
1911
+ function isDateInRange(dateParts, opts) {
1912
+ var result = !0;
1913
+ if (opts.min) {
1914
+ if (dateParts.rawyear) {
1915
+ var rawYear = dateParts.rawyear.replace(/[^0-9]/g, ""), minYear = opts.min.year.substr(0, rawYear.length);
1916
+ result = minYear <= rawYear;
1917
+ }
1918
+ dateParts.year === dateParts.rawyear && opts.min.date.getTime() == opts.min.date.getTime() && (result = opts.min.date.getTime() <= dateParts.date.getTime());
1919
+ }
1920
+ return result && opts.max && opts.max.date.getTime() == opts.max.date.getTime() && (result = opts.max.date.getTime() >= dateParts.date.getTime()),
1921
+ result;
1922
+ }
1923
+ function parse(format, dateObjValue, opts, raw) {
1924
+ for (var mask = "", match; match = getTokenizer(opts).exec(format); ) if (void 0 === dateObjValue) if (formatCode[match[0]]) mask += "(" + formatCode[match[0]][0] + ")"; else switch (match[0]) {
1925
+ case "[":
1926
+ mask += "(";
1927
+ break;
1928
+
1929
+ case "]":
1930
+ mask += ")?";
1931
+ break;
1932
+
1933
+ default:
1934
+ mask += Inputmask.escapeRegex(match[0]);
1935
+ } else if (formatCode[match[0]]) if (!0 !== raw && formatCode[match[0]][3]) {
1936
+ var getFn = formatCode[match[0]][3];
1937
+ mask += getFn.call(dateObjValue.date);
1938
+ } else formatCode[match[0]][2] ? mask += dateObjValue["raw" + formatCode[match[0]][2]] : mask += match[0]; else mask += match[0];
1939
+ return mask;
1940
+ }
1941
+ function pad(val, len) {
1942
+ for (val = String(val), len = len || 2; val.length < len; ) val = "0" + val;
1943
+ return val;
1944
+ }
1945
+ function analyseMask(maskString, format, opts) {
1946
+ var dateObj = {
1947
+ date: new Date(1, 0, 1)
1948
+ }, targetProp, mask = maskString, match, dateOperation;
1949
+ function extendProperty(value) {
1950
+ var correctedValue = value.replace(/[^0-9]/g, "0");
1951
+ return correctedValue;
1952
+ }
1953
+ function setValue(dateObj, value, opts) {
1954
+ dateObj[targetProp] = extendProperty(value), dateObj["raw" + targetProp] = value,
1955
+ void 0 !== dateOperation && dateOperation.call(dateObj.date, "month" == targetProp ? parseInt(dateObj[targetProp]) - 1 : dateObj[targetProp]);
1956
+ }
1957
+ if ("string" == typeof mask) {
1958
+ for (;match = getTokenizer(opts).exec(format); ) {
1959
+ var value = mask.slice(0, match[0].length);
1960
+ formatCode.hasOwnProperty(match[0]) && (targetProp = formatCode[match[0]][2], dateOperation = formatCode[match[0]][1],
1961
+ setValue(dateObj, value, opts)), mask = mask.slice(value.length);
1962
+ }
1963
+ return dateObj;
1964
+ }
1965
+ if (mask && "object" === _typeof(mask) && mask.hasOwnProperty("date")) return mask;
1966
+ }
1967
+ Inputmask.extendAliases({
1968
+ datetime: {
1969
+ mask: function mask(opts) {
1970
+ return formatCode.S = opts.i18n.ordinalSuffix.join("|"), opts.inputFormat = formatAlias[opts.inputFormat] || opts.inputFormat,
1971
+ opts.displayFormat = formatAlias[opts.displayFormat] || opts.displayFormat || opts.inputFormat,
1972
+ opts.outputFormat = formatAlias[opts.outputFormat] || opts.outputFormat || opts.inputFormat,
1973
+ opts.placeholder = "" !== opts.placeholder ? opts.placeholder : opts.inputFormat.replace(/[[\]]/, ""),
1974
+ opts.regex = parse(opts.inputFormat, void 0, opts), null;
1975
+ },
1976
+ placeholder: "",
1977
+ inputFormat: "isoDateTime",
1978
+ displayFormat: void 0,
1979
+ outputFormat: void 0,
1980
+ min: null,
1981
+ max: null,
1982
+ i18n: {
1983
+ dayNames: [ "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ],
1984
+ monthNames: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ],
1985
+ ordinalSuffix: [ "st", "nd", "rd", "th" ]
1986
+ },
1987
+ preValidation: function preValidation(buffer, pos, c, isSelection, opts, maskset) {
1988
+ var calcPos = 0, targetMatch, match;
1989
+ if (isNaN(c) && buffer[pos] !== c) {
1990
+ for (;match = getTokenizer(opts).exec(opts.inputFormat); ) if (calcPos += match[0].length,
1991
+ pos <= calcPos) {
1992
+ targetMatch = match, match = getTokenizer(opts).exec(opts.inputFormat);
1993
+ break;
1994
+ }
1995
+ if (match && match[0] === c && 1 < targetMatch[0].length) return buffer[pos] = buffer[pos - 1],
1996
+ buffer[pos - 1] = "0", {
1997
+ fuzzy: !0,
1998
+ buffer: buffer,
1999
+ refreshFromBuffer: {
2000
+ start: pos - 1,
2001
+ end: pos + 1
2002
+ },
2003
+ pos: pos + 1
2004
+ };
2005
+ }
2006
+ return !0;
2007
+ },
2008
+ postValidation: function postValidation(buffer, pos, currentResult, opts) {
2009
+ opts.min = analyseMask(opts.min, opts.inputFormat, opts), opts.max = analyseMask(opts.max, opts.inputFormat, opts),
2010
+ currentResult.fuzzy && (buffer = currentResult.buffer, pos = currentResult.pos);
2011
+ var result = currentResult, dateParts = analyseMask(buffer.join(""), opts.inputFormat, opts);
2012
+ return result && dateParts.date.getTime() == dateParts.date.getTime() && (result = isValidDate(dateParts, result),
2013
+ result = result && isDateInRange(dateParts, opts)), pos && result && currentResult.pos !== pos ? {
2014
+ buffer: parse(opts.inputFormat, dateParts, opts),
2015
+ refreshFromBuffer: {
2016
+ start: pos,
2017
+ end: currentResult.pos
2018
+ }
2019
+ } : result;
2020
+ },
2021
+ onKeyDown: function onKeyDown(e, buffer, caretPos, opts) {
2022
+ var input = this;
2023
+ if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
2024
+ for (var today = new Date(), match, date = ""; match = getTokenizer(opts).exec(opts.inputFormat); ) "d" === match[0].charAt(0) ? date += pad(today.getDate(), match[0].length) : "m" === match[0].charAt(0) ? date += pad(today.getMonth() + 1, match[0].length) : "yyyy" === match[0] ? date += today.getFullYear().toString() : "y" === match[0].charAt(0) && (date += pad(today.getYear(), match[0].length));
2025
+ this.inputmask._valueSet(date), $(this).trigger("setvalue");
2026
+ }
2027
+ },
2028
+ onUnMask: function onUnMask(maskedValue, unmaskedValue, opts) {
2029
+ return unmaskedValue ? parse(opts.outputFormat, analyseMask(maskedValue, opts.inputFormat, opts), opts, !0) : unmaskedValue;
2030
+ },
2031
+ casing: function casing(elem, test, pos, validPositions) {
2032
+ return 0 == test.nativeDef.indexOf("[ap]") ? elem.toLowerCase() : 0 == test.nativeDef.indexOf("[AP]") ? elem.toUpperCase() : elem;
2033
+ },
2034
+ insertMode: !1,
2035
+ shiftPositions: !1
2036
+ }
2037
+ }), module.exports = Inputmask;
2038
+ }, function(module, exports, __webpack_require__) {
2039
+ var Inputmask = __webpack_require__(3), $ = Inputmask.dependencyLib;
2040
+ function autoEscape(txt, opts) {
2041
+ for (var escapedTxt = "", i = 0; i < txt.length; i++) Inputmask.prototype.definitions[txt.charAt(i)] || opts.definitions[txt.charAt(i)] || opts.optionalmarker.start === txt.charAt(i) || opts.optionalmarker.end === txt.charAt(i) || opts.quantifiermarker.start === txt.charAt(i) || opts.quantifiermarker.end === txt.charAt(i) || opts.groupmarker.start === txt.charAt(i) || opts.groupmarker.end === txt.charAt(i) || opts.alternatormarker === txt.charAt(i) ? escapedTxt += "\\" + txt.charAt(i) : escapedTxt += txt.charAt(i);
2042
+ return escapedTxt;
2043
+ }
2044
+ function alignDigits(buffer, digits, opts) {
2045
+ if (0 < digits && !opts.digitsOptional && 0 < buffer.length) {
2046
+ var radixPosition = $.inArray(opts.radixPoint, buffer);
2047
+ -1 === radixPosition && (buffer.push(opts.radixPoint), radixPosition = buffer.length - 1);
2048
+ for (var i = 1; i <= digits; i++) buffer[radixPosition + i] = buffer[radixPosition + i] || "0";
2049
+ }
2050
+ return buffer;
2051
+ }
2052
+ function findValidator(symbol, maskset) {
2053
+ var posNdx = 0;
2054
+ if ("+" === symbol) {
2055
+ for (posNdx in maskset.validPositions) ;
2056
+ posNdx = parseInt(posNdx);
2057
+ }
2058
+ for (var tstNdx in maskset.tests) if (tstNdx = parseInt(tstNdx), posNdx <= tstNdx) for (var ndx = 0, ndxl = maskset.tests[tstNdx].length; ndx < ndxl; ndx++) if ((void 0 === maskset.validPositions[tstNdx] || "-" === symbol) && maskset.tests[tstNdx][ndx].match.def === symbol) return tstNdx + (void 0 !== maskset.validPositions[tstNdx] && "-" !== symbol ? 1 : 0);
2059
+ return posNdx;
2060
+ }
2061
+ function findValid(symbol, maskset) {
2062
+ var ret = -1;
2063
+ return $.each(maskset.validPositions, function(ndx, tst) {
2064
+ if (tst.match.def === symbol) return ret = parseInt(ndx), !1;
2065
+ }), ret;
2066
+ }
2067
+ function parseMinMaxOptions(opts) {
2068
+ void 0 === opts.parseMinMaxOptions && (null !== opts.min && (opts.min = opts.min.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
2069
+ "," === opts.radixPoint && (opts.min = opts.min.replace(opts.radixPoint, ".")),
2070
+ opts.min = isFinite(opts.min) ? parseFloat(opts.min) : NaN, isNaN(opts.min) && (opts.min = Number.MIN_VALUE)),
2071
+ null !== opts.max && (opts.max = opts.max.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
2072
+ "," === opts.radixPoint && (opts.max = opts.max.replace(opts.radixPoint, ".")),
2073
+ opts.max = isFinite(opts.max) ? parseFloat(opts.max) : NaN, isNaN(opts.max) && (opts.max = Number.MAX_VALUE)),
2074
+ opts.parseMinMaxOptions = "done");
2075
+ }
2076
+ function genMask(opts) {
2077
+ opts.repeat = 0, opts.groupSeparator === opts.radixPoint && opts.digits && "0" !== opts.digits && ("." === opts.radixPoint ? opts.groupSeparator = "," : "," === opts.radixPoint ? opts.groupSeparator = "." : opts.groupSeparator = ""),
2078
+ " " === opts.groupSeparator && (opts.skipOptionalPartCharacter = void 0), 1 < opts.placeholder.length && (opts.placeholder = opts.placeholder.charAt(0)),
2079
+ "radixFocus" === opts.positionCaretOnClick && "" === opts.placeholder && (opts.positionCaretOnClick = "lvp");
2080
+ var decimalDef = "0";
2081
+ !0 === opts.numericInput && void 0 === opts.__financeInput ? (decimalDef = "1",
2082
+ opts.positionCaretOnClick = "radixFocus" === opts.positionCaretOnClick ? "lvp" : opts.positionCaretOnClick,
2083
+ isNaN(opts.digits) && (opts.digits = 2), opts._radixDance = !1) : (opts.__financeInput = !1,
2084
+ opts.numericInput = !0);
2085
+ var mask = "[+]", altMask;
2086
+ if (mask += autoEscape(opts.prefix, opts), "" !== opts.groupSeparator ? mask += opts._mask(opts) : mask += "9{+}",
2087
+ void 0 !== opts.digits) {
2088
+ var dq = opts.digits.toString().split(",");
2089
+ isFinite(dq[0]) && dq[1] && isFinite(dq[1]) ? mask += opts.radixPoint + decimalDef + "{" + opts.digits + "}" : (isNaN(opts.digits) || 0 < parseInt(opts.digits)) && (opts.digitsOptional ? (altMask = mask + opts.radixPoint + decimalDef + "{0," + opts.digits + "}",
2090
+ opts.keepStatic = !0) : mask += opts.radixPoint + decimalDef + "{" + opts.digits + "}");
2091
+ }
2092
+ return mask += autoEscape(opts.suffix, opts), mask += "[-]", altMask && (mask = [ altMask + autoEscape(opts.suffix, opts) + "[-]", mask ]),
2093
+ opts.greedy = !1, parseMinMaxOptions(opts), mask;
2094
+ }
2095
+ function hanndleRadixDance(pos, c, radixPos, opts) {
2096
+ return opts._radixDance && opts.numericInput && c !== opts.negationSymbol.back && pos <= radixPos && (0 < radixPos || c == opts.radixPoint) && (pos -= 1),
2097
+ pos;
2098
+ }
2099
+ function decimalValidator(chrs, maskset, pos, strict, opts) {
2100
+ var radixPos = maskset.buffer.indexOf(opts.radixPoint), result = -1 !== radixPos && new RegExp("[0-9\uff11-\uff19]").test(chrs);
2101
+ return opts._radixDance && result && null == maskset.validPositions[radixPos] ? {
2102
+ insert: {
2103
+ pos: radixPos === pos ? radixPos + 1 : radixPos,
2104
+ c: opts.radixPoint
2105
+ },
2106
+ pos: pos
2107
+ } : result;
2108
+ }
2109
+ Inputmask.extendAliases({
2110
+ numeric: {
2111
+ mask: genMask,
2112
+ _mask: function _mask(opts) {
2113
+ return "(" + opts.groupSeparator + "999){+|1}";
2114
+ },
2115
+ placeholder: "0",
2116
+ greedy: !1,
2117
+ digits: "*",
2118
+ digitsOptional: !0,
2119
+ enforceDigitsOnBlur: !1,
2120
+ radixPoint: ".",
2121
+ positionCaretOnClick: "radixFocus",
2122
+ _radixDance: !0,
2123
+ groupSeparator: "",
2124
+ allowMinus: !0,
2125
+ negationSymbol: {
2126
+ front: "-",
2127
+ back: ""
2128
+ },
2129
+ prefix: "",
2130
+ suffix: "",
2131
+ rightAlign: !0,
2132
+ min: null,
2133
+ max: null,
2134
+ step: 1,
2135
+ insertMode: !0,
2136
+ autoUnmask: !1,
2137
+ unmaskAsNumber: !1,
2138
+ inputmode: "numeric",
2139
+ definitions: {
2140
+ 0: {
2141
+ validator: decimalValidator
2142
+ },
2143
+ 1: {
2144
+ validator: decimalValidator,
2145
+ definitionSymbol: "*"
2146
+ },
2147
+ "+": {
2148
+ validator: function validator(chrs, maskset, pos, strict, opts) {
2149
+ return opts.allowMinus && ("-" === chrs || chrs === opts.negationSymbol.front);
2150
+ }
2151
+ },
2152
+ "-": {
2153
+ validator: function validator(chrs, maskset, pos, strict, opts) {
2154
+ return opts.allowMinus && chrs === opts.negationSymbol.back;
2155
+ }
2156
+ }
2157
+ },
2158
+ preValidation: function preValidation(buffer, pos, c, isSelection, opts, maskset) {
2159
+ var radixPos = $.inArray(opts.radixPoint, buffer);
2160
+ if (pos = hanndleRadixDance(pos, c, radixPos, opts), "-" !== c && c !== opts.negationSymbol.front) return -1 !== radixPos && !0 === opts._radixDance && !1 === isSelection && c === opts.radixPoint && void 0 !== opts.digits && (isNaN(opts.digits) || 0 < parseInt(opts.digits)) && radixPos !== pos ? {
2161
+ caret: opts._radixDance && pos === radixPos - 1 ? radixPos + 1 : radixPos
2162
+ } : {
2163
+ rewritePosition: pos
2164
+ };
2165
+ if (!0 !== opts.allowMinus) return !1;
2166
+ var isNegative = !1, front = findValid("+", maskset), back = findValid("-", maskset);
2167
+ return -1 !== front && (isNegative = [ front, back ]), !1 !== isNegative ? {
2168
+ remove: isNegative,
2169
+ caret: pos < radixPos ? pos + 1 : pos
2170
+ } : {
2171
+ insert: [ {
2172
+ pos: findValidator("+", maskset),
2173
+ c: opts.negationSymbol.front,
2174
+ fromIsValid: !0
2175
+ }, {
2176
+ pos: findValidator("-", maskset),
2177
+ c: opts.negationSymbol.back,
2178
+ fromIsValid: void 0
2179
+ } ],
2180
+ caret: pos < radixPos ? pos + 1 : pos
2181
+ };
2182
+ },
2183
+ postValidation: function postValidation(buffer, pos, currentResult, opts) {
2184
+ if (null !== opts.min || null !== opts.max) {
2185
+ var unmasked = opts.onUnMask(buffer.slice().reverse().join(""), void 0, $.extend({}, opts, {
2186
+ unmaskAsNumber: !0
2187
+ }));
2188
+ if (null !== opts.min && unmasked < opts.min && unmasked.toString().length >= opts.min.toString().length) return !1;
2189
+ if (null !== opts.max && unmasked > opts.max) return !1;
2190
+ }
2191
+ return currentResult;
2192
+ },
2193
+ onUnMask: function onUnMask(maskedValue, unmaskedValue, opts) {
2194
+ if ("" === unmaskedValue && !0 === opts.nullable) return unmaskedValue;
2195
+ var processValue = maskedValue.replace(opts.prefix, "");
2196
+ return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
2197
+ "" !== opts.placeholder.charAt(0) && (processValue = processValue.replace(new RegExp(opts.placeholder.charAt(0), "g"), "0")),
2198
+ opts.unmaskAsNumber ? ("" !== opts.radixPoint && -1 !== processValue.indexOf(opts.radixPoint) && (processValue = processValue.replace(Inputmask.escapeRegex.call(this, opts.radixPoint), ".")),
2199
+ processValue = processValue.replace(new RegExp("^" + Inputmask.escapeRegex(opts.negationSymbol.front)), "-"),
2200
+ processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""),
2201
+ Number(processValue)) : processValue;
2202
+ },
2203
+ isComplete: function isComplete(buffer, opts) {
2204
+ var maskedValue = (opts.numericInput ? buffer.slice().reverse() : buffer).join("");
2205
+ return maskedValue = maskedValue.replace(new RegExp("^" + Inputmask.escapeRegex(opts.negationSymbol.front)), "-"),
2206
+ maskedValue = maskedValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""),
2207
+ maskedValue = maskedValue.replace(opts.prefix, ""), maskedValue = maskedValue.replace(opts.suffix, ""),
2208
+ maskedValue = maskedValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator) + "([0-9]{3})", "g"), "$1"),
2209
+ "," === opts.radixPoint && (maskedValue = maskedValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".")),
2210
+ isFinite(maskedValue);
2211
+ },
2212
+ onBeforeMask: function onBeforeMask(initialValue, opts) {
2213
+ var radixPoint = opts.radixPoint || ",";
2214
+ "number" != typeof initialValue && "number" !== opts.inputType || "" === radixPoint || (initialValue = initialValue.toString().replace(".", radixPoint));
2215
+ var valueParts = initialValue.split(radixPoint), integerPart = valueParts[0].replace(/[^\-0-9]/g, ""), decimalPart = 1 < valueParts.length ? valueParts[1].replace(/[^0-9]/g, "") : "";
2216
+ initialValue = integerPart + ("" !== decimalPart ? radixPoint + decimalPart : decimalPart);
2217
+ var digits = 0;
2218
+ if ("" !== radixPoint && (digits = decimalPart.length, "" !== decimalPart)) {
2219
+ var digitsFactor = Math.pow(10, digits || 1);
2220
+ isFinite(opts.digits) && (digits = parseInt(opts.digits), digitsFactor = Math.pow(10, digits)),
2221
+ initialValue = initialValue.replace(Inputmask.escapeRegex(radixPoint), "."), isFinite(initialValue) && (initialValue = Math.round(parseFloat(initialValue) * digitsFactor) / digitsFactor),
2222
+ initialValue = initialValue.toString().replace(".", radixPoint);
2223
+ }
2224
+ return 0 === opts.digits && -1 !== initialValue.indexOf(Inputmask.escapeRegex(radixPoint)) && (initialValue = initialValue.substring(0, initialValue.indexOf(Inputmask.escapeRegex(radixPoint)))),
2225
+ alignDigits(initialValue.toString().split(""), digits, opts).join("");
2226
+ },
2227
+ onBeforeWrite: function onBeforeWrite(e, buffer, caretPos, opts) {
2228
+ var result, numberMatches = new RegExp("^" + ("" != opts.negationSymbol.front ? Inputmask.escapeRegex(opts.negationSymbol.front) + "?" : "") + Inputmask.escapeRegex(opts.prefix) + "(?<number>.*)" + Inputmask.escapeRegex(opts.suffix) + ("" != opts.negationSymbol.back ? Inputmask.escapeRegex(opts.negationSymbol.back) + "?" : "") + "$").exec(buffer.slice().reverse().join("")), number = numberMatches ? numberMatches.groups.number : "";
2229
+ if (0) var newCaretPos, buf, caretNdx, leadingzeroes;
2230
+ if (e) switch (e.type) {
2231
+ case "blur":
2232
+ case "checkval":
2233
+ "" !== opts.radixPoint && buffer[0] === opts.radixPoint && (result && result.buffer ? result.buffer.shift() : (buffer.shift(),
2234
+ result = {
2235
+ refreshFromBuffer: !0,
2236
+ buffer: buffer
2237
+ }));
2238
+ }
2239
+ return result;
2240
+ },
2241
+ onKeyDown: function onKeyDown(e, buffer, caretPos, opts) {
2242
+ var $input = $(this);
2243
+ if (e.ctrlKey) switch (e.keyCode) {
2244
+ case Inputmask.keyCode.UP:
2245
+ return this.inputmask.__valueSet.call(this, parseFloat(this.inputmask.unmaskedvalue()) + parseInt(opts.step)),
2246
+ $input.trigger("setvalue"), !1;
2247
+
2248
+ case Inputmask.keyCode.DOWN:
2249
+ return this.inputmask.__valueSet.call(this, parseFloat(this.inputmask.unmaskedvalue()) - parseInt(opts.step)),
2250
+ $input.trigger("setvalue"), !1;
2251
+ }
2252
+ if ((e.keyCode === Inputmask.keyCode.DELETE || e.keyCode === Inputmask.keyCode.BACKSPACE || e.keyCode === Inputmask.keyCode.BACKSPACE_SAFARI) && !0 === opts._radixDance && !opts.digitsOptional) {
2253
+ var radixPos = $.inArray(opts.radixPoint, buffer);
2254
+ if (-1 !== radixPos && (caretPos < radixPos || e.keyCode === Inputmask.keyCode.DELETE && caretPos === radixPos)) {
2255
+ e.keyCode !== Inputmask.keyCode.BACKSPACE && e.keyCode !== Inputmask.keyCode.BACKSPACE_SAFARI || caretPos++;
2256
+ var bffr = buffer.slice().reverse();
2257
+ return bffr.splice(bffr.length - caretPos, 1), $input.trigger("setvalue", [ alignDigits(bffr, opts.digits, opts).join(""), caretPos ]),
2258
+ !1;
2259
+ }
2260
+ }
2261
+ }
2262
+ },
2263
+ currency: {
2264
+ prefix: "$ ",
2265
+ groupSeparator: ",",
2266
+ alias: "numeric",
2267
+ placeholder: "0",
2268
+ digits: 2,
2269
+ digitsOptional: !1
2270
+ },
2271
+ decimal: {
2272
+ alias: "numeric"
2273
+ },
2274
+ integer: {
2275
+ alias: "numeric",
2276
+ digits: 0
2277
+ },
2278
+ percentage: {
2279
+ alias: "integer",
2280
+ min: 0,
2281
+ max: 100,
2282
+ suffix: " %",
2283
+ allowMinus: !1
2284
+ },
2285
+ indianns: {
2286
+ alias: "numeric",
2287
+ _mask: function _mask(opts) {
2288
+ return "(" + opts.groupSeparator + "99){*|1}(" + opts.groupSeparator + "999){1|1}";
2289
+ },
2290
+ groupSeparator: ",",
2291
+ radixPoint: ".",
2292
+ placeholder: "0",
2293
+ digits: 2,
2294
+ digitsOptional: !1
2295
+ }
2296
+ }), module.exports = Inputmask;
2297
+ }, function(module, exports, __webpack_require__) {
2298
+ function _typeof(obj) {
2299
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function _typeof(obj) {
2300
+ return typeof obj;
2301
+ } : function _typeof(obj) {
2302
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
2303
+ }, _typeof(obj);
2304
+ }
2305
+ var $ = __webpack_require__(5), Inputmask = __webpack_require__(3);
2306
+ void 0 === $.fn.inputmask && ($.fn.inputmask = function(fn, options) {
2307
+ var nptmask, input = this[0];
2308
+ if (void 0 === options && (options = {}), "string" == typeof fn) switch (fn) {
2309
+ case "unmaskedvalue":
2310
+ return input && input.inputmask ? input.inputmask.unmaskedvalue() : $(input).val();
2311
+
2312
+ case "remove":
2313
+ return this.each(function() {
2314
+ this.inputmask && this.inputmask.remove();
2315
+ });
2316
+
2317
+ case "getemptymask":
2318
+ return input && input.inputmask ? input.inputmask.getemptymask() : "";
2319
+
2320
+ case "hasMaskedValue":
2321
+ return !(!input || !input.inputmask) && input.inputmask.hasMaskedValue();
2322
+
2323
+ case "isComplete":
2324
+ return !input || !input.inputmask || input.inputmask.isComplete();
2325
+
2326
+ case "getmetadata":
2327
+ return input && input.inputmask ? input.inputmask.getmetadata() : void 0;
2328
+
2329
+ case "setvalue":
2330
+ Inputmask.setValue(input, options);
2331
+ break;
2332
+
2333
+ case "option":
2334
+ if ("string" != typeof options) return this.each(function() {
2335
+ if (void 0 !== this.inputmask) return this.inputmask.option(options);
2336
+ });
2337
+ if (input && void 0 !== input.inputmask) return input.inputmask.option(options);
2338
+ break;
2339
+
2340
+ default:
2341
+ return options.alias = fn, nptmask = new Inputmask(options), this.each(function() {
2342
+ nptmask.mask(this);
2343
+ });
2344
+ } else {
2345
+ if (Array.isArray(fn)) return options.alias = fn, nptmask = new Inputmask(options),
2346
+ this.each(function() {
2347
+ nptmask.mask(this);
2348
+ });
2349
+ if ("object" == _typeof(fn)) return nptmask = new Inputmask(fn), void 0 === fn.mask && void 0 === fn.alias ? this.each(function() {
2350
+ if (void 0 !== this.inputmask) return this.inputmask.option(fn);
2351
+ nptmask.mask(this);
2352
+ }) : this.each(function() {
2353
+ nptmask.mask(this);
2354
+ });
2355
+ if (void 0 === fn) return this.each(function() {
2356
+ nptmask = new Inputmask(options), nptmask.mask(this);
2357
+ });
2358
+ }
2359
+ });
2360
+ } ], installedModules = {}, __webpack_require__.m = modules, __webpack_require__.c = installedModules,
2361
+ __webpack_require__.d = function(exports, name, getter) {
2362
+ __webpack_require__.o(exports, name) || Object.defineProperty(exports, name, {
2363
+ enumerable: !0,
2364
+ get: getter
2365
+ });
2366
+ }, __webpack_require__.r = function(exports) {
2367
+ "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports, Symbol.toStringTag, {
2368
+ value: "Module"
2369
+ }), Object.defineProperty(exports, "__esModule", {
2370
+ value: !0
2371
+ });
2372
+ }, __webpack_require__.t = function(value, mode) {
2373
+ if (1 & mode && (value = __webpack_require__(value)), 8 & mode) return value;
2374
+ if (4 & mode && "object" == typeof value && value && value.__esModule) return value;
2375
+ var ns = Object.create(null);
2376
+ if (__webpack_require__.r(ns), Object.defineProperty(ns, "default", {
2377
+ enumerable: !0,
2378
+ value: value
2379
+ }), 2 & mode && "string" != typeof value) for (var key in value) __webpack_require__.d(ns, key, function(key) {
2380
+ return value[key];
2381
+ }.bind(null, key));
2382
+ return ns;
2383
+ }, __webpack_require__.n = function(module) {
2384
+ var getter = module && module.__esModule ? function getDefault() {
2385
+ return module.default;
2386
+ } : function getModuleExports() {
2387
+ return module;
2388
+ };
2389
+ return __webpack_require__.d(getter, "a", getter), getter;
2390
+ }, __webpack_require__.o = function(object, property) {
2391
+ return Object.prototype.hasOwnProperty.call(object, property);
2392
+ }, __webpack_require__.p = "", __webpack_require__(__webpack_require__.s = 0);
2393
+ function __webpack_require__(moduleId) {
2394
+ if (installedModules[moduleId]) return installedModules[moduleId].exports;
2395
+ var module = installedModules[moduleId] = {
2396
+ i: moduleId,
2397
+ l: !1,
2398
+ exports: {}
2399
+ };
2400
+ return modules[moduleId].call(module.exports, module, module.exports, __webpack_require__),
2401
+ module.l = !0, module.exports;
2402
+ }
2403
+ var modules, installedModules;
2404
+ });
2405
+ //# sourceMappingURL=jquery.inputmask.js.map