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.158 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 this.isRTL = this.opts.numericInput, resolveAlias(this.opts.alias, options, this.opts)); 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.
227inputmask.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 }
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 = is
407Quantifier || !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, 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 && getMaskSet().validPositions[pos]) testPos = clearOptionalTail && !0 === getMaskSet().validPositions[pos].match.optionality && void 0 === getMaskSet().validPositions[pos + 1] && (!0 === getMaskSet().validPositions[pos].generatedInput || getMaskSet().validPositions[pos].input == opts.skipOptionalPartCharacter && 0 < pos) ? determineTestTemplate(pos, getTests(pos, ndxIntlzr, pos - 1)) : getMaskSet().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 !== getMaskSet().maskLength || (getMaskSet().maskLength = pos - 1), 643 opts.greedy = greedy, maskTemplate; 644 } 645 function getMaskSet() { 646 return maskset; 647 } 648 f
648unction resetMaskSet(soft) { 649 var maskset = getMaskSet(); 650 maskset.buffer = void 0, !0 !== soft && (maskset.validPositions = {}, maskset.p = 0); 651 } 652 function getLastValidPosition(closestTo, strict, validPositions) { 653 var before = -1, after = -1, valids = validPositions || getMaskSet().validPositions; 654 for (var posNdx in void 0 === closestTo && (closestTo = -1), valids) { 655 var psNdx = parseInt(posNdx); 656 valids[psNdx] && (strict || !0 !== valids[psNdx].generatedInput) && (psNdx <= closestTo && (before = psNdx), 657 closestTo <= psNdx && (after = psNdx)); 658 } 659 return -1 === before || before == closestTo ? after : -1 == after ? before : closestTo - before < after - closestTo ? before : after; 660 } 661 function getDecisionTaker(tst) { 662 var decisionTaker = tst.locator[tst.alternation]; 663 return "string" == typeof decisionTaker && 0 < decisionTaker.length && (decisionTaker = decisionTaker.split(",")[0]), 664 void 0 !== decisionTaker ? decisionTaker.toString() : ""; 665 } 666 function getLocator(tst, align) { 667 var locator = (null != tst.alternation ? tst.mloc[getDecisionTaker(tst)] : tst.locator).join(""); 668 if ("" !== locator) for (;locator.length < align; ) locator += "0"; 669 return locator; 670 } 671 function determineTestTemplate(pos, tests) { 672 pos = 0 < pos ? pos - 1 : 0; 673 for (var altTest = getTest(pos), targetLocator = getLocator(altTest), tstLocator, closest, bestMatch, ndx = 0; ndx < tests.length; ndx++) { 674 var tst = tests[ndx]; 675 tstLocator = getLocator(tst, targetLocator.length); 676 var distance = Math.abs(tstLocator - targetLocator); 677 (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, 678 bestMatch = tst); 679 } 680 return bestMatch; 681 } 682 function getTestTemplate(pos, ndxIntlzr, tstPs) { 683 return getMaskSet().validPositions[pos] || determineTestTemplate(pos, getTests(pos, ndxIntlzr ? ndxIntlzr.slice() : ndxIntlzr, tstPs)); 684 } 685 function getTest(pos, tests) { 686 return getMaskSet().validPositions[pos] ? getMaskSet().validPositions[pos] : (tests || getTests(pos))[0]; 687 } 688 function positionCanMatchDefinition(pos, def) { 689 for (var valid = !1, tests = getTests(pos), tndx = 0; tndx < tests.length; tndx++) if (tests[tndx].match && tests[tndx].match.def === def) { 690 valid = !0; 691 break; 692 } 693 return !1 === valid && void 0 !== getMaskSet().jitOffset[pos] && (valid = positionCanMatchDefinition(pos + getMaskSet().jitOffset[pos], def)), 694 valid; 695 } 696 function getTests(pos, ndxIntlzr, tstPs) { 697 var maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr ? ndxIntlzr.slice() : [ 0 ], matches = [], insertStop = !1, latestMatch, cacheDependency = ndxIntlzr ? ndxIntlzr.join("") : ""; 698 function resolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) { 699 function handleMatch(match, loopNdx, quantifierRecurse) { 700 function isFirstMatch(latestMatch, tokenGroup) { 701 var firstMatch = 0 === $.inArray(latestMatch, tokenGroup.matches); 702 return firstMatch || $.each(tokenGroup.matches, function(ndx, match) { 703 if (!0 === match.isQuantifier ? firstMatch = isFirstMatch(latestMatch, tokenGroup.matches[ndx - 1]) : match.hasOwnProperty("matches") && (firstMatch = isFirstMatch(latestMatch, match)), 704 firstMatch) return !1; 705 }), firstMatch; 706 } 707 function resolveNdxInitializer(pos, alternateNdx, targetAlternation) { 708 var bestMatch, indexPos; 709 if ((getMaskSet().tests[pos] || getMaskSet().validPositions[pos]) && $.each(getMaskSet().tests[pos] || [ getMaskSet().validPositions[pos] ], function(ndx, lmnt) { 710 if (lmnt.mloc[alternateNdx]) return bestMatch = lmnt, !1; 711 var alternation = void 0 !== targetAlternation ? targetAlternation : lmnt.alternation, ndxPos = void 0 !== lmnt.locator[alternation] ? lmnt.locator[alternation].toString().indexOf(alternateNdx) : -1; 712 (void 0 === indexPos || ndxPos < indexPos) && -1 !== ndxPos && (bestMatch = lmnt, 713 indexPos = ndxPos); 714 }), bestMatch) { 715 var bestMatchAltIndex = bestMatch.locator[bestMatch.alternation], locator = bestMatch.mloc[alternateNdx] || bestMatch.mloc[bestMatchAltIndex] || bestMatch.locator; 716 return locator.slice((void 0 !== targetAlternation ? targetAlternation : bestMatch.alternation) + 1); 717 } 718 return void 0 !== targetAlternation ? resolveNdxInitializer(pos, alternateNdx) : void 0; 719 } 720 function isSubsetOf(source, target) { 721 function expand(pattern) { 722 for (var expanded = [], start = -1, end, i = 0, l = pattern.length; i < l;
722 i++) if ("-" === pattern.charAt(i)) for (end = pattern.charCodeAt(i + 1); ++start < end; ) expanded.push(String.fromCharCode(start)); else start = pattern.charCodeAt(i), 723 expanded.push(pattern.charAt(i)); 724 return expanded.join(""); 725 } 726 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; 727 } 728 function staticCanMatchDefinition(source, target) { 729 var sloc = source.locator.slice(source.alternation).join(""), tloc = target.locator.slice(target.alternation).join(""), canMatch = sloc == tloc; 730 return canMatch = !(!canMatch || !0 !== source.match.static || !0 === target.match.static) && target.match.fn.test(source.match.def, getMaskSet(), pos, !1, opts, !1), 731 canMatch; 732 } 733 function setMergeLocators(targetMatch, altMatch) { 734 if (void 0 === altMatch || targetMatch.alternation === altMatch.alternation && -1 === targetMatch.locator[targetMatch.alternation].toString().indexOf(altMatch.locator[altMatch.alternation])) { 735 targetMatch.mloc = targetMatch.mloc || {}; 736 var locNdx = targetMatch.locator[targetMatch.alternation]; 737 if (void 0 !== locNdx) { 738 if ("string" == typeof locNdx && (locNdx = locNdx.split(",")[0]), void 0 === targetMatch.mloc[locNdx] && (targetMatch.mloc[locNdx] = targetMatch.locator.slice()), 739 void 0 !== altMatch) { 740 for (var ndx in altMatch.mloc) "string" == typeof ndx && (ndx = ndx.split(",")[0]), 741 void 0 === targetMatch.mloc[ndx] && (targetMatch.mloc[ndx] = altMatch.mloc[ndx]); 742 targetMatch.locator[targetMatch.alternation] = Object.keys(targetMatch.mloc).join(","); 743 } 744 return !0; 745 } 746 targetMatch.alternation = void 0; 747 } 748 return !1; 749 } 750 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. " + getMaskSet().mask; 751 if (testPos === pos && void 0 === match.matches) return matches.push({ 752 match: match, 753 locator: loopNdx.reverse(), 754 cd: cacheDependency, 755 mloc: {} 756 }), !0; 757 if (void 0 !== match.matches) { 758 if (match.isGroup && quantifierRecurse !== match) { 759 if (match = handleMatch(maskToken.matches[$.inArray(match, maskToken.matches) + 1], loopNdx, quantifierRecurse), 760 match) return !0; 761 } else if (match.isOptional) { 762 var optionalToken = match, mtchsNdx = matches.length; 763 if (match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse), 764 match) { 765 if ($.each(matches, function(ndx, mtch) { 766 mtchsNdx <= ndx && (mtch.match.optionality = !0); 767 }), latestMatch = matches[matches.length - 1].match, void 0 !== quantifierRecurse || !isFirstMatch(latestMatch, optionalToken)) return !0; 768 insertStop = !0, testPos = pos; 769 } 770 } else if (match.isAlternator) { 771 var alternateToken = match, malternateMatches = [], maltMatches, currentMatches = matches.slice(), loopNdxCnt = loopNdx.length, altIndex = 0 < ndxInitializer.length ? ndxInitializer.shift() : -1; 772 if (-1 === altIndex || "string" == typeof altIndex) { 773 var currentPos = testPos, ndxInitializerClone = ndxInitializer.slice(), altIndexArr = [], amndx; 774 if ("string" == typeof altIndex) altIndexArr = altIndex.split(","); else for (amndx = 0;
774 amndx < alternateToken.matches.length; amndx++) altIndexArr.push(amndx.toString()); 775 if (getMaskSet().excludes[pos]) { 776 for (var altIndexArrClone = altIndexArr.slice(), i = 0, el = getMaskSet().excludes[pos].length; i < el; i++) altIndexArr.splice(altIndexArr.indexOf(getMaskSet().excludes[pos][i].toString()), 1); 777 0 === altIndexArr.length && (getMaskSet().excludes[pos] = void 0, altIndexArr = altIndexArrClone); 778 } 779 (!0 === opts.keepStatic || isFinite(parseInt(opts.keepStatic)) && currentPos >= opts.keepStatic) && (altIndexArr = altIndexArr.slice(0, 1)); 780 for (var unMatchedAlternation = !1, ndx = 0; ndx < altIndexArr.length; ndx++) { 781 amndx = parseInt(altIndexArr[ndx]), matches = [], ndxInitializer = "string" == typeof altIndex && resolveNdxInitializer(testPos, amndx, loopNdxCnt) || ndxInitializerClone.slice(), 782 alternateToken.matches[amndx] && handleMatch(alternateToken.matches[amndx], [ amndx ].concat(loopNdx), quantifierRecurse) ? match = !0 : 0 === ndx && (unMatchedAlternation = !0), 783 maltMatches = matches.slice(), testPos = currentPos, matches = []; 784 for (var ndx1 = 0; ndx1 < maltMatches.length; ndx1++) { 785 var altMatch = maltMatches[ndx1], dropMatch = !1; 786 altMatch.match.jit = altMatch.match.jit || unMatchedAlternation, altMatch.alternation = altMatch.alternation || loopNdxCnt, 787 setMergeLocators(altMatch); 788 for (var ndx2 = 0; ndx2 < malternateMatches.length; ndx2++) { 789 var altMatch2 = malternateMatches[ndx2]; 790 if ("string" != typeof altIndex || void 0 !== altMatch.alternation && -1 !== $.inArray(altMatch.locator[altMatch.alternation].toString(), altIndexArr)) { 791 if (altMatch.match.nativeDef === altMatch2.match.nativeDef) { 792 dropMatch = !0, setMergeLocators(altMatch2, altMatch); 793 break; 794 } 795 if (isSubsetOf(altMatch, altMatch2)) { 796 setMergeLocators(altMatch, altMatch2) && (dropMatch = !0, malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch)); 797 break; 798 } 799 if (isSubsetOf(altMatch2, altMatch)) { 800 setMergeLocators(altMatch2, altMatch); 801 break; 802 } 803 if (staticCanMatchDefinition(altMatch, altMatch2)) { 804 setMergeLocators(altMatch, altMatch2) && (dropMatch = !0, malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch)); 805 break; 806 } 807 } 808 } 809 dropMatch || malternateMatches.push(altMatch); 810 } 811 } 812 matches = currentMatches.concat(malternateMatches), testPos = pos, insertStop = 0 < matches.length, 813 match = 0 < malternateMatches.length, ndxInitializer = ndxInitializerClone.slice(); 814 } else match = handleMatch(alternateToken.matches[altIndex] || maskToken.matches[altIndex], [ altIndex ].concat(loopNdx), quantifierRecurse); 815 if (match) return !0; 816 } 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++) { 817 var tokenGroup = maskToken.matches[$.inArray(qt, maskToken.matches) - 1]; 818 if (match = handleMatch(tokenGroup, [ qndx ].concat(loopNdx), tokenGroup), match) { 819 if (latestMatch = matches[matches.length - 1].match, latestMatch.optionalQuantifier = qndx >= qt.quantifier.min, 820 latestMatch.jit = (qndx || 1) * tokenGroup.matches.indexOf(latestMatch) >= qt.quantifier.jit, 821 latestMatch.optionalQuantifier && isFirstMatch(latestMatch, tokenGroup)) { 822 insertStop = !0, testPos = pos; 823 break; 824 } 825 return latestMatch.jit && (getMaskSet().jitOffset[pos] = tokenGroup.matches.length - tokenGroup.matches.indexOf(latestMatch)), 826 !0; 827 } 828 } else if (match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse), 829 match) return !0; 830 } else testPos++; 831 } 832 for (var tndx = 0 < ndxInitializer.length ? ndxInitializer.shift() : 0; tndx < maskToken.matches.length; tndx++) if (!0 !== maskToken.matches[tndx].isQuantifier) { 833 var match = handleMatch(maskToken.matches[tndx], [ tndx ].concat(loopNdx), quantifierRecurse); 834 if (match && testPos === pos) return match; 835 if (pos < testPos) break; 836 } 837 } 838 function mergeLocators(pos, tests) { 839 var locator = []; 840 return $.isArray(tests) || (tests = [ tests ]), 0 < tests.length && (void 0 === tests[0].alternation || !0 === opts.keepStatic ? (locator = determineTestTemplate(pos, tests.slice()).locator.slice(), 841 0 === locator.length && (locator = tests[0].locator.slice())) : $.each(tests, function(ndx, tst) { 842 if ("" !== tst.def) if (0 === locator.length) locator = t
842st.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]); 843 })), locator; 844 } 845 if (-1 < pos) { 846 if (void 0 === ndxIntlzr) { 847 for (var previousPos = pos - 1, test; void 0 === (test = getMaskSet().validPositions[previousPos] || getMaskSet().tests[previousPos]) && -1 < previousPos; ) previousPos--; 848 void 0 !== test && -1 < previousPos && (ndxInitializer = mergeLocators(previousPos, test), 849 cacheDependency = ndxInitializer.join(""), testPos = previousPos); 850 } 851 if (getMaskSet().tests[pos] && getMaskSet().tests[pos][0].cd === cacheDependency) return getMaskSet().tests[pos]; 852 for (var mtndx = ndxInitializer.shift(); mtndx < maskTokens.length; mtndx++) { 853 var match = resolveTestFromToken(maskTokens[mtndx], ndxInitializer, [ mtndx ]); 854 if (match && testPos === pos || pos < testPos) break; 855 } 856 } 857 return (0 === matches.length || insertStop) && matches.push({ 858 match: { 859 fn: null, 860 static: !0, 861 optionality: !1, 862 casing: null, 863 def: "", 864 placeholder: "" 865 }, 866 locator: [], 867 mloc: {}, 868 cd: cacheDependency 869 }), void 0 !== ndxIntlzr && getMaskSet().tests[pos] ? $.extend(!0, [], matches) : (getMaskSet().tests[pos] = $.extend(!0, [], matches), 870 getMaskSet().tests[pos]); 871 } 872 function getBufferTemplate() { 873 return void 0 === getMaskSet()._buffer && (getMaskSet()._buffer = getMaskTemplate(!1, 1), 874 void 0 === getMaskSet().buffer && (getMaskSet().buffer = getMaskSet()._buffer.slice())), 875 getMaskSet()._buffer; 876 } 877 function getBuffer(noCache) { 878 return void 0 !== getMaskSet().buffer && !0 !== noCache || (getMaskSet().buffer = getMaskTemplate(!0, getLastValidPosition(), !0), 879 void 0 === getMaskSet()._buffer && (getMaskSet()._buffer = getMaskSet().buffer.slice())), 880 getMaskSet().buffer; 881 } 882 function refreshFromBuffer(start, end, buffer) { 883 var i, p; 884 if (!0 === start) resetMaskSet(), start = 0, end = buffer.length; else for (i = start; i < end; i++) delete getMaskSet().validPositions[i]; 885 for (p = start, i = start; i < end; i++) if (resetMaskSet(!0), buffer[i] !== opts.skipOptionalPartCharacter) { 886 var valResult = isValid(p, buffer[i], !0, !0); 887 !1 !== valResult && (resetMaskSet(!0), p = void 0 !== valResult.caret ? valResult.caret : valResult.pos + 1); 888 } 889 } 890 function casing(elem, test, pos) { 891 switch (opts.casing || test.casing) { 892 case "upper": 893 elem = elem.toUpperCase(); 894 break; 895 896 case "lower": 897 elem = elem.toLowerCase(); 898 break; 899 900 case "title": 901 var posBefore = getMaskSet().validPositions[pos - 1]; 902 elem = 0 === pos || posBefore && posBefore.input === String.fromCharCode(Inputmask.keyCode.SPACE) ? elem.toUpperCase() : elem.toLowerCase(); 903 break; 904 905 default: 906 if ($.isFunction(opts.casing)) { 907 var args = Array.prototype.slice.call(arguments); 908 args.push(getMaskSet().validPositions), elem = opts.casing.apply(this, args); 909 } 910 } 911 return elem; 912 } 913 function checkAlternationMatch(altArr1, altArr2, na) { 914 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); 915 for (var alndx = 0; alndx < altArr1.length;
915 alndx++) if (-1 !== $.inArray(altArr1[alndx], altArrC)) { 916 isMatch = !0; 917 break; 918 } 919 return isMatch; 920 } 921 function alternate(pos, c, strict, fromIsValid, rAltPos) { 922 var validPsClone = $.extend(!0, {}, getMaskSet().validPositions), lastAlt, alternation, isValidRslt = !1, altPos, prevAltPos, i, validPos, decisionPos, lAltPos = void 0 !== rAltPos ? rAltPos : getLastValidPosition(); 923 function insertPosition(insert) { 924 if (insert && isValidRslt && void 0 !== c) { 925 var targetLvp = getLastValidPosition(pos) + 1; 926 for (i = decisionPos; i < getLastValidPosition() + 1; i++) validPos = getMaskSet().validPositions[i], 927 (void 0 === validPos || 1 == validPos.match.static) && i < pos + posOffset && posOffset++; 928 pos += posOffset, isValidRslt = isValid(targetLvp < pos ? targetLvp : pos, c, strict, fromIsValid, !0); 929 } 930 } 931 if (-1 === lAltPos && void 0 === rAltPos) lastAlt = 0, prevAltPos = getTest(lastAlt), 932 alternation = prevAltPos.alternation; else for (;0 <= lAltPos; lAltPos--) if (altPos = getMaskSet().validPositions[lAltPos], 933 altPos && void 0 !== altPos.alternation) { 934 if (prevAltPos && prevAltPos.locator[altPos.alternation] !== altPos.locator[altPos.alternation]) break; 935 lastAlt = lAltPos, alternation = getMaskSet().validPositions[lastAlt].alternation, 936 prevAltPos = altPos; 937 } 938 if (void 0 !== alternation) { 939 decisionPos = parseInt(lastAlt), getMaskSet().excludes[decisionPos] = getMaskSet().excludes[decisionPos] || [], 940 !0 !== pos && getMaskSet().excludes[decisionPos].push(getDecisionTaker(prevAltPos)); 941 var validInputsClone = [], staticInputsBeforePos = 0; 942 for (i = decisionPos; i < getLastValidPosition(void 0, !0) + 1; i++) validPos = getMaskSet().validPositions[i], 943 validPos && !0 !== validPos.generatedInput ? validInputsClone.push(validPos.input) : i < pos && staticInputsBeforePos++, 944 delete getMaskSet().validPositions[i]; 945 for (;getMaskSet().excludes[decisionPos] && getMaskSet().excludes[decisionPos].length < 10; ) { 946 var posOffset = -1 * staticInputsBeforePos, validInputs = validInputsClone.slice(); 947 for (getMaskSet().tests[decisionPos] = void 0, resetMaskSet(!0), isValidRslt = !0, 948 insertPosition(0 === pos); 0 < validInputs.length; ) { 949 var input = validInputs.shift(); 950 if (!(isValidRslt = isValid(isValidRslt.caret || getLastValidPosition(void 0, !0) + 1, input, !1, fromIsValid, !0))) break; 951 } 952 if (insertPosition(0 < pos), isValidRslt) break; 953 if (resetMaskSet(), prevAltPos = getTest(decisionPos), getMaskSet().validPositions = $.extend(!0, {}, validPsClone), 954 !getMaskSet().excludes[decisionPos]) { 955 isValidRslt = alternate(pos, c, strict, fromIsValid, decisionPos - 1); 956 break; 957 } 958 var decisionTaker = getDecisionTaker(prevAltPos); 959 if (-1 !== getMaskSet().excludes[decisionPos].indexOf(decisionTaker)) { 960 isValidRslt = alternate(pos, c, strict, fromIsValid, decisionPos - 1); 961 break; 962 } 963 for (getMaskSet().excludes[decisionPos].push(decisionTaker), i = decisionPos; i < getLastValidPosition(void 0, !0) + 1; i++) delete getMaskSet().validPositions[i]; 964 } 965 } 966 return getMaskSet().excludes[decisionPos] = void 0, isValidRslt; 967 } 968 function isValid(pos, c, strict, fromIsValid, fromAlternate, validateOnly) { 969 function isSelection(posObj) { 970 return isRTL ? 1 < posObj.begin - posObj.end || posObj.begin - posObj.end == 1 : 1 < posObj.end - posObj.begin || posObj.end - posObj.begin == 1; 971 }
972 strict = !0 === strict; 973 var maskPos = pos; 974 function processCommandObject(commandObj) { 975 if (void 0 !== commandObj) { 976 if (void 0 !== commandObj.remove && ($.isArray(commandObj.remove) || (commandObj.remove = [ commandObj.remove ]), 977 $.each(commandObj.remove.sort(function(a, b) { 978 return b.pos - a.pos; 979 }), function(ndx, lmnt) { 980 revalidateMask({ 981 begin: lmnt, 982 end: lmnt + 1 983 }); 984 }), commandObj.remove = void 0), void 0 !== commandObj.insert && ($.isArray(commandObj.insert) || (commandObj.insert = [ commandObj.insert ]), 985 $.each(commandObj.insert.sort(function(a, b) { 986 return a.pos - b.pos; 987 }), function(ndx, lmnt) { 988 isValid(lmnt.pos, lmnt.c, void 0 === lmnt.strict || lmnt.strict, void 0 !== lmnt.fromIsValid ? lmnt.fromIsValid : fromIsValid); 989 }), commandObj.insert = void 0), commandObj.refreshFromBuffer && commandObj.buffer) { 990 var refresh = commandObj.refreshFromBuffer; 991 refreshFromBuffer(!0 === refresh ? refresh : refresh.start, refresh.end, commandObj.buffer), 992 commandObj.refreshFromBuffer = void 0; 993 } 994 void 0 !== commandObj.rewritePosition && (maskPos = commandObj.rewritePosition, 995 commandObj = !0, commandObj.rewritePosition = void 0); 996 } 997 return commandObj; 998 } 999 function _isValid(position, c, strict) { 1000 var rslt = !1; 1001 return $.each(getTests(position), function(ndx, tst) { 1002 var test = tst.match; 1003 if (getBuffer(!0), rslt = null != test.fn ? test.fn.test(c, getMaskSet(), position, strict, opts, isSelection(pos)) : (c === test.def || c === opts.skipOptionalPartCharacter) && "" !== test.def && { 1004 c: getPlaceholder(position, test, !0) || test.def, 1005 pos: position 1006 }, !1 !== rslt) { 1007 var elem = void 0 !== rslt.c ? rslt.c : c, validatedPos = position; 1008 return elem = elem === opts.skipOptionalPartCharacter && !0 === test.static ? getPlaceholder(position, test, !0) || test.def : elem, 1009 rslt = processCommandObject(rslt), !0 !== rslt && void 0 !== rslt.pos && rslt.pos !== position && (validatedPos = rslt.pos), 1010 !0 !== rslt && void 0 === rslt.pos && void 0 === rslt.c ? !1 : (revalidateMask(pos, $.extend({}, tst, { 1011 input: casing(elem, test, validatedPos) 1012 }), fromIsValid, validatedPos) || (rslt = !1), !1); 1013 } 1014 }), rslt; 1015 } 1016 void 0 !== pos.begin && (maskPos = isRTL ? pos.end : pos.begin); 1017 var result = !0, positionsClone = $.extend(!0, {}, getMaskSet().validPositions); 1018 if ($.isFunction(opts.preValidation) && !strict && !0 !== fromIsValid && !0 !== validateOnly && (result = opts.preValidation(getBuffer(), maskPos, c, isSelection(pos), opts, getMaskSet()), 1019 result = processCommandObject(result)), !0 === result) { 1020 if ((void 0 === maxLength || maskPos < maxLength) && (result = _isValid(maskPos, c, strict), 1021 (!strict || !0 === fromIsValid) && !1 === result && !0 !== validateOnly)) { 1022 var currentPosValid = getMaskSet().validPositions[maskPos]; 1023 if (!currentPosValid || !0 !== currentPosValid.match.static || currentPosValid.match.def !== c && c !== opts.skipOptionalPartCharacter) { 1024 if ((opts.insertMode || void 0 === getMaskSet().validPositions[seekNext(maskPos)]) && (getMaskSet().jitOffset[maskPos] && void 0 === getMaskSet().validPositions[seekNext(maskPos)] && (result = isValid(maskPos + getMaskSet().jitOffset[maskPos], c, !0), 1025 !1 !== result && (result.caret = maskPos)), !isMask(maskPos, !0))) for (var nPos = maskPos + 1, snPos = seekNext(maskPos); nPos <= snPos; nPos++) if (result = _isValid(nPos, c, strict), 1026 !1 !== result) { 1027 result = trackbackPositions(maskPos, void 0 !== result.pos ? result.pos : nPos) || result, 1028 maskPos = nPos; 1029 break; 1030 } 1031 } else result = { 1032 caret: seekNext(maskPos) 1033 }; 1034 } 1035 !1 !== result || !1 === opts.keepStatic || null != opts.regex && !isComplete(getBuffer()) || strict || !0 === fromAlternate || (result = alternate(maskPos, c, strict, fromIsValid)), 1036 !0 === result && (result = { 1037 pos: maskPos 1038 }); 1039 } 1040 if ($.isFunction(opts.postValidation) && !1 !== result && !strict && !0 !== fromIsValid && !0 !== validateOnly) { 1041 var postResult = opts.postValidation(getBuffer(!0), void 0 !== pos.begin ? isRTL ? pos.end : pos.begin : pos, result, opts); 1042 void 0 !== postResult && (result = !0 === postResult ? result : postResult); 1043 } 1044 result && void 0 === result.pos && (result.pos = maskPos), !1 === result || !0 === validateOnly ? (resetMaskSet(!0), 1045 getMaskSet().validPositions = $.extend(!0, {}, positionsClone)) : trackbackPositions(void 0, maskPos, !0); 1046 var endResult = processCommandObject(result); 1047 return endResult; 1048 } 1049 function trackbackPositions(originalPos, newPos, fillOnly) { 1050 if (void 0 === originalPos) for (originalPos = newPos - 1; 0 < originalPos && !getMaskSet().validPositions[originalPos]; originalPos--) ; 1051 for (var ps = originalPos; ps < newPos; ps++) if (void 0 === getMaskSet().validPositions[ps] && !isMask(ps, !0)) { 1052 var vp = 0 == ps ? getTest(ps) : getMaskSet().validPositions[ps - 1]; 1053 if (vp) { 1054 var tests = getTests(ps).slice(); 1055 "" === tests[tests.length - 1].match.def && tests.pop(); 1056 var bestMatch = determineTestTemplate(ps, tests), np; 1057 if (bestMatch && (!0 !== bestMatch.match.jit || "master" === bestMatch.match.newBlockMarker && (np = getMaskSet().validPositions[ps + 1]) && !0 === np.match.optionalQuantifier) && (bestMatch = $.extend({}, bestMatch, { 1058 input: getPlaceholder(ps, bestMatch.match, !0) || bestMatch.match.def 1059 }), bestMatch.generatedInput = !0, revalidateMask(ps, bestMatch, !0), !0 !== fillOnly)) { 1060 var cvpInput = getMaskSet().validPositions[newPos].input; 1061 return getMaskSet().validPositions[newPos] = void 0, isValid(newPos, cvpInput, !0, !0); 1062 } 1063 } 1064 } 1065 } 1066 function revalidateMask(pos, validTest, fromIsValid, validatedPos) { 1067 function IsEnclosedStatic(pos, valids, selection) { 1068 var posMatch = valids[pos]; 1069 if (void 0 === posMatch || (!0 !== posMatch.match.static || !0 === posMatch.match.optionality) && posMatch.input !== opts.radixPoint) return !1; 1070 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]; 1071 return prevMatch && nextMatch; 1072 } 1073 var begin = void 0 !== pos.begin ? pos.begin : pos, end = void 0 !== pos.end ? pos.end : pos; 1074 if (pos.begin > pos.end && (begin = pos.end, end = pos.begin), validatedPos = void 0 !== validatedPos ? validatedPos : begin, 1075 begin !== end || opts.insertMode && void 0 !== getMaskSet().validPositions[validatedPos] && void 0 === fromIsValid) { 1076 var positionsClone = $.extend(!0, {}, getMaskSet().validPositions), lvp = getLastValidPosition(void 0, !0), i; 1077 for (getMaskSet().p = begin, i = lvp; begin <= i; i--) delete getMaskSet().validPositions[i];
1078 var valid = !0, j = validatedPos, needsValidation = !1, posMatch = j; 1079 for (i = j, validTest && (getMaskSet().validPositions[validatedPos] = $.extend(!0, {}, validTest), 1080 posMatch++, j++, begin < end && i++); i <= lvp; i++) { 1081 var t = positionsClone[i]; 1082 if (void 0 !== t && (end <= i || begin <= i && !0 !== t.generatedInput && IsEnclosedStatic(i, positionsClone, { 1083 begin: begin, 1084 end: end 1085 }))) { 1086 for (;"" !== getTest(posMatch).match.def; ) { 1087 if (!1 === needsValidation && positionsClone[posMatch] && positionsClone[posMatch].match.nativeDef === t.match.nativeDef) getMaskSet().validPositions[posMatch] = $.extend(!0, {}, positionsClone[posMatch]), 1088 getMaskSet().validPositions[posMatch].input = t.input, trackbackPositions(void 0, posMatch, !0), 1089 j = posMatch + 1, valid = !0; else if (opts.shiftPositions && positionCanMatchDefinition(posMatch, t.match.def)) { 1090 var result = isValid(posMatch, t.input, !0, !0); 1091 valid = !1 !== result, j = (result.pos || posMatch) + 1, needsValidation = !0; 1092 } else valid = !0 === t.generatedInput; 1093 if (valid) break; 1094 if (!valid && end < posMatch && isMask(posMatch, !0) && (!0 !== t.match.static || posMatch > getMaskSet().maskLength)) break; 1095 posMatch++; 1096 } 1097 "" == getTest(posMatch).match.def && (valid = !1), posMatch = j; 1098 } 1099 if (!valid) break; 1100 } 1101 if (!valid) return getMaskSet().validPositions = $.extend(!0, {}, positionsClone), 1102 resetMaskSet(!0), !1; 1103 } else validTest && (getMaskSet().validPositions[validatedPos] = $.extend(!0, {}, validTest)); 1104 return resetMaskSet(!0), !0; 1105 } 1106 function isMask(pos, strict) { 1107 var test = getTestTemplate(pos).match; 1108 if ("" === test.def && (test = getTest(pos).match), 1 != test.static) return test.fn; 1109 if (!0 !== strict && -1 < pos) { 1110 var tests = getTests(pos); 1111 return tests.length > 1 + ("" === tests[tests.length - 1].match.def ? 1 : 0); 1112 } 1113 return !1; 1114 } 1115 function seekNext(pos, newBlock) { 1116 for (var position = pos + 1; "" !== getTest(position).match.def && (!0 === newBlock && (!0 !== getTest(position).match.newBlockMarker || !isMask(position)) || !0 !== newBlock && !isMask(position)); ) position++; 1117 return position; 1118 } 1119 function seekPrevious(pos, newBlock) { 1120 var position = pos, tests; 1121 if (position <= 0) return 0; 1122 for (;0 < --position && (!0 === newBlock && !0 !== getTest(position).match.newBlockMarker || !0 !== newBlock && !isMask(position) && (tests = getTests(position), 1123 tests.length < 2 || 2 === tests.length && "" === tests[1].match.def)); ) ; 1124 return position; 1125 } 1126 function writeBuffer(input, buffer, caretPos, event, triggerEvents) { 1127 if (event && $.isFunction(opts.onBeforeWrite)) { 1128 var result = opts.onBeforeWrite.call(inputmask, event, buffer, caretPos, opts); 1129 if (result) { 1130 if (result.refreshFromBuffer) { 1131 var refresh = result.refreshFromBuffer; 1132 refreshFromBuffer(!0 === refresh ? refresh : refresh.start, refresh.end, result.buffer || buffer), 1133 buffer = getBuffer(!0); 1134 } 1135 void 0 !== caretPos && (caretPos = void 0 !== result.caret ? result.caret : caretPos); 1136 } 1137 } 1138 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), 1139 !0 === triggerEvents)) { 1140 var $input = $(input), nptVal = input.inputmask._valueGet(); 1141 skipInputEvent = !0, $input.trigger("input"), setTimeout(function() { 1142 nptVal === getBufferTemplate().join("") ? $input.trigger("cleared") : !0 === isComplete(buffer) && $input.trigger("complete"); 1143 }, 0); 1144 } 1145 } 1146 function getPlaceholder(pos, test, returnPL) { 1147 if (test = test || getTest(pos).match, void 0 !== test.placeholder || !0 === returnPL) return $.isFunction(test.placeholder) ? test.placeholder(opts) : test.placeholder; 1148 if (!0 !== test.static) return opts.placeholder.charAt(pos % opts.placeholder.length); 1149 if (-1 < pos && void 0 === getMaskSet().validPositions[pos]) { 1150 var tests = getTests(pos), staticAlternations = [], prevTest; 1151 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, getMaskSet(), pos, !0, opts)) && (staticAlternations.push(tests[i]), 1152 !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); 1153 } 1154 return test.def; 1155 } 1156 function HandleNativePlaceholder(npt, value) { 1157 if (ie) { 1158 if (npt.inputmask._valueGet() !== value && (npt.placeholder !== value || "" === npt.placeholder)) { 1159 var buffer = getBuffer().slice(), nptValue = npt.inputmask._valueGet(); 1160 if (nptValue !== value) { 1161 var lvp = getLastValidPosition(); 1162 -1 === lvp && nptValue === getBufferTemplate().join("") ? buffer = [] : -1 !== lvp && clearOptionalTail(buffer), 1163 writeBuffer(npt, buffer); 1164 } 1165 } 1166 } else npt.placeholder !== value && (npt.placeholder = value, "" === npt.placeholder && npt.removeAttribute("placeholder")); 1167 } 1168 function determineNewCaretPosition(selectedCaret, tabbed) { 1169 function doRadixFocus(clickPos) { 1170 if ("" !== opts.radixPoint) { 1171 var vps = getMaskSet().validPositions; 1172 if (void 0 === vps[clickPos] || vps[clickPos].input === getPlaceholder(clickPos)) { 1173 if (clickPos < seekNext(-1)) return !0; 1174 var radixPos = $.inArray(opts.radixPoint, getBuffer()); 1175 if (-1 !== radixPos) { 1176 for (var vp in vps) if (vps[vp] && radixPos < vp && vps[vp].input !== getPlaceholder(vp)) return !1; 1177 return !0; 1178 } 1179 } 1180 } 1181 return !1; 1182 } 1183 if (tabbed && (isRTL ? selectedCaret.end = selectedCaret.begin : selectedCaret.begin = selectedCaret.end), 1184 selectedCaret.begin === selectedCaret.end) switch (opts.positionCaretOnClick) { 1185 case "none": 1186 break; 1187 1188 case "select": 1189 return { 1190 begin: 0, 1191 end: getBuffer().length 1192 }; 1193 1194 case "ignore": 1195 return seekNext(getLastValidPosition()); 1196 1197 case "radixFocus": 1198 if (doRadixFocus(selectedCaret.begin)) { 1199 var radixPos = getBuffer().join("").indexOf(opts.radixPoint); 1200 return opts.numericInput ? seekNext(radixPos) : radixPos; 1201 } 1202 1203 default: 1204 var clickPosition = selectedCaret.begin, lvclickPosition = getLastValidPosition(clickPosition, !0), lastPosition = seekNext(-1 !== lvclickPosition || isMask(0) ? lvclickPosition : 0); 1205 if (clickPosition < lastPosition) return isMask(clickPosition, !0) || isMask(clickPosition - 1, !0) ? clickPosition : seekNext(clickPosition); 1206 var lvp = getMaskSet().validPositions[lvclickPosition], tt = getTestTemplate(lastPosition, lvp ? lvp.match.locator : void 0, lvp), placeholder = getPlaceholder(lastPosition, tt.match); 1207 if ("" !== placeholder && getBuffer()[lastPosition] !== placeholder && !0 !== tt.match.optionalQuantifier && !0 !== tt.match.newBlockMarker || !isMask(lastPosition, opts.keepStatic) && tt.match.def === placeholder) { 1208 var newPos = seekNext(lastPosition); 1209 (newPos <= clickPosition || clickPosition === lastPosition) && (lastPosition = newPos); 1210 } 1211 return lastPosition; 1212 } 1213 } 1214 var EventRuler = { 1215 on: function on(input, eventName, eventHandler) { 1216 var ev = function ev(e) { 1217 var that = this, args; 1218 if (void 0 === that.inputmask && "FORM" !== this.nodeName) { 1219 var imOpts = $.data(that, "_inputmask_opts"); 1220 imOpts ? new Inputmask(imOpts).mask(that) : EventRuler.off(that); 1221 } else { 1222 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))) { 1223 switch (e.type) { 1224 case "input": 1225 if (!0 === skipInputEvent) return skipInputEvent = !1, e.preventDefault(); 1226 if (mobile) return args = arguments, setTimeout(function() { 1227 eventHandler.apply(that, args), caret(that, that.inputmask.caretPos, void 0, !0); 1228 }, 0), !1; 1229 break; 1230 1231 case "keydown": 1232 skipKeyPressEvent = !1, skipInputEvent = !1; 1233 break; 1234 1235 case "keypress": 1236 if (!0 === skipKeyPressEvent) return e.preventDefault(); 1237 skipKeyPressEvent = !0; 1238 break; 1239 1240 case "click": 1241 case "focus": 1242 return args = arguments, setTimeout(function() { 1243 eventHandler.apply(that, args); 1244 }, 0), !1; 1245 } 1246 var returnVal = eventHandler.apply(that, arguments); 1247 return !1 === returnVal && (e.preventDefault(), e.stopPropagation()), returnVal; 1248 } 1249 e.preventDefault(); 1250 } 1251 }; 1252 input.inputmask.events[eventName] = input.inputmask.events[eventName] || [], input.inputmask.events[eventName].push(ev), 1253 -1 !== $.inArray(eventName, [ "submit", "reset" ]) ? null !== input.form && $(input.form).on(eventName, ev) : $(input).on(eventName, ev); 1254 }, 1255 off: function off(input, event) { 1256 var events; 1257 input.inputmask && input.inputmask.events && (event ? (events = [], events[event] = input.inputmask.events[event]) : events = input.inputmask.events, 1258 $.each(events, function(eventName, evArr) { 1259 for (;0 < evArr.length; ) { 1260 var ev = evArr.pop();
1261 -1 !== $.inArray(eventName, [ "submit", "reset" ]) ? null !== input.form && $(input.form).off(eventName, ev) : $(input).off(eventName, ev); 1262 } 1263 delete input.inputmask.events[eventName]; 1264 })); 1265 } 1266 }, EventHandlers = { 1267 keydownEvent: function keydownEvent(e) { 1268 var input = this, $input = $(this), k = e.keyCode, pos = caret(this); 1269 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(), 1270 handleRemove(this, k, pos), writeBuffer(this, getBuffer(!0), getMaskSet().p, e, this.inputmask._valueGet() !== getBuffer().join("")); else if (k === Inputmask.keyCode.END || k === Inputmask.keyCode.PAGE_DOWN) { 1271 e.preventDefault(); 1272 var caretPos = seekNext(getLastValidPosition()); 1273 caret(this, e.shiftKey ? pos.begin : caretPos, caretPos, !0); 1274 } else k === Inputmask.keyCode.HOME && !e.shiftKey || k === Inputmask.keyCode.PAGE_UP ? (e.preventDefault(), 1275 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("")), 1276 $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)), 1277 pos.end = seekPrevious(pos.begin, !0), pos.begin = seekPrevious(pos.end, !0)) : (pos.begin = seekNext(pos.begin, !0), 1278 pos.end = seekNext(pos.begin, !0), pos.end < getMaskSet().maskLength && pos.end--), 1279 pos.begin < getMaskSet().maskLength && (e.preventDefault(), caret(this, pos.begin, pos.end))) : (opts.insertMode = !opts.insertMode, 1280 this.setAttribute("im-insert", opts.insertMode)); 1281 opts.onKeyDown.call(this, e, getBuffer(), caret(this).begin, opts), ignorable = -1 !== $.inArray(k, opts.ignorables); 1282 }, 1283 keypressEvent: function keypressEvent(e, checkval, writeOut, strict, ndx) { 1284 var input = this, $input = $(input), k = e.which || e.charCode || e.keyCode; 1285 if (!(!0 === checkval || e.ctrlKey && e.altKey) && (e.ctrlKey || e.metaKey || ignorable)) return k === Inputmask.keyCode.ENTER && undoValue !== getBuffer().join("") && (undoValue = getBuffer().join(""), 1286 setTimeout(function() { 1287 $input.trigger("change"); 1288 }, 0)), !0; 1289 if (k) { 1290 46 === k && !1 === e.shiftKey && "" !== opts.radixPoint && (k = opts.radixPoint.charCodeAt(0)); 1291 var pos = checkval ? { 1292 begin: ndx, 1293 end: ndx 1294 } : caret(input), forwardPosition, c = String.fromCharCode(k); 1295 getMaskSet().writeOutBuffer = !0; 1296 var valResult = isValid(pos, c, strict); 1297 if (!1 !== valResult && (resetMaskSet(!0), forwardPosition = void 0 !== valResult.caret ? valResult.caret : seekNext(valResult.pos.begin ? valResult.pos.begin : valResult.pos), 1298 getMaskSet().p = forwardPosition), forwardPosition = opts.numericInput && void 0 === valResult.caret ? seekPrevious(forwardPosition) : forwardPosition, 1299 !1 !== writeOut && (setTimeout(function() { 1300 opts.onKeyValidation.call(input, k, valResult, opts); 1301 }, 0), getMaskSet().writeOutBuffer && !1 !== valResult)) { 1302 var buffer = getBuffer(); 1303 writeBuffer(input, buffer, forwardPosition, e, !0 !== checkval); 1304 } 1305 if (e.preventDefault(), checkval) return !1 !== valResult && (valResult.forwardPosition = forwardPosition), 1306 valResult; 1307 } 1308 }, 1309 pasteEvent: function pasteEvent(e) { 1310 var input = this, ev = e.originalEvent || e, inputValue = this.inputmask._valueGet(!0), caretPos = caret(this), tempValue; 1311 isRTL && (tempValue = caretPos.end, caretPos.end = caretPos.begin, caretPos.begin = tempValue); 1312 var valueBeforeCaret = inputValue.substr(0, caretPos.begin), valueAfterCaret = inputValue.substr(caretPos.end, inputValue.length); 1313 if (valueBeforeCaret === (isRTL ? getBufferTemplate().reverse() : getBufferTemplate()).slice(0, caretPos.begin).join("") && (valueBeforeCaret = ""), 1314 valueAfterCaret === (isRTL ? getBufferTemplate().reverse() : getBufferTemplate()).slice(caretPos.end).join("") && (valueAfterCaret = ""), 1315 window.clipboardData && window.clipboardData.getData) inputValue = valueBeforeCaret + window.clipboardData.getData("Text") + valueAfterCaret; else { 1316 if (!ev.clipboardData || !ev.clipboardData.getData) return !0; 1317 inputValue = valueBeforeCaret + ev.clipboardData.getData("text/plain") + valueAfterCaret; 1318 } 1319 var pasteValue = inputValue; 1320 if ($.isFunction(opts.onBeforePaste)) { 1321 if (pasteValue = opts.onBeforePaste.call(inputmask, inputValue, opts), !1 === pasteValue) return e.preventDefault(); 1322 pasteValue || (pasteValue = inputValue); 1323 } 1324 return checkVal(this, !1, !1, pasteValue.toString().split("")), writeBuffer(this, getBuffer(), seekNext(getLastValidPosition()), e, undoValue !== getBuffer().join("")), 1325 e.preventDefault(); 1326 }, 1327 inputFallBackEvent: function inputFallBackEvent(e) { 1328 function radixPointHandler(input, inputValue, caretPos) { 1329 return "." === inputValue.charAt(caretPos.begin - 1) && "" !== opts.radixPoint && (inputValue = inputValue.split(""), 1330 inputValue[caretPos.begin - 1] = opts.radixPoint.charAt(0), inputValue = inputValue.join("")), 1331 inputValue; 1332 } 1333 function ieMobileHandler(input, inputValue, caretPos) { 1334 if (iemobile) { 1335 var inputChar = inputValue.replace(getBuffer().join(""), ""); 1336 if (1 === inputChar.length) { 1337 var iv = inputValue.split(""); 1338 iv.splice(caretPos.begin, 0, inputChar), inputValue = iv.join(""); 1339 } 1340 } 1341 return inputValue; 1342 } 1343 var input = this, inputValue = input.inputmask._valueGet(); 1344 if (getBuffer().join("") !== inputValue) { 1345 var caretPos = caret(input); 1346 if (inputValue = radixPointHandler(input, inputValue, caretPos), inputValue = ieMobileHandler(input, inputValue, caretPos), 1347 getBuffer().join("") !== inputValue) { 1348 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; 1349 if (frontPart !== frontBufferPart) { 1350 var fpl = (isEntry = frontPart.length >= frontBufferPart.length) ? frontPart.length : frontBufferPart.length, i; 1351 for (i = 0; frontPart.charAt(i) === frontBufferPart.charAt(i) && i < fpl; i++) ; 1352 isEntry && (selection.begin = i - offset, entries += frontPart.slice(i, selection.end)); 1353 } 1354 if (backPart !== backBufferPart && (backPart.length > backBufferPart.length ? entries += backPart.slice(0, 1) : backPart.length < backBufferPart.length && (selection.end += backBufferPart.length - backPart.length, 1355 isEntry || "" === opts.radixPoint || "" !== backPart || frontPart.charAt(selection.begin + offset - 1) !== opts.radixPoint || (selection.begin--,
1356 entries = opts.radixPoint))), writeBuffer(input, getBuffer(), { 1357 begin: selection.begin + offset, 1358 end: selection.end + offset 1359 }), 0 < entries.length) $.each(entries.split(""), function(ndx, entry) { 1360 var keypress = new $.Event("keypress"); 1361 keypress.which = entry.charCodeAt(0), ignorable = !1, EventHandlers.keypressEvent.call(input, keypress); 1362 }); else { 1363 selection.begin === selection.end - 1 && (selection.begin = seekPrevious(selection.begin + 1), 1364 selection.begin === selection.end - 1 ? caret(input, selection.begin) : caret(input, selection.begin, selection.end)); 1365 var keydown = new $.Event("keydown"); 1366 keydown.keyCode = opts.numericInput ? Inputmask.keyCode.BACKSPACE : Inputmask.keyCode.DELETE, 1367 EventHandlers.keydownEvent.call(input, keydown); 1368 } 1369 e.preventDefault(); 1370 } 1371 } 1372 }, 1373 beforeInputEvent: function beforeInputEvent(e) { 1374 if (e.cancelable) { 1375 var input = this, keydown, keypress; 1376 switch (e.inputType) { 1377 case "insertText": 1378 return $.each(e.data.split(""), function(ndx, entry) { 1379 keypress = new $.Event("keypress"), keypress.which = entry.charCodeAt(0), ignorable = !1, 1380 EventHandlers.keypressEvent.call(input, keypress); 1381 }), e.preventDefault(); 1382 1383 case "deleteContentBackward": 1384 return keydown = new $.Event("keydown"), keydown.keyCode = Inputmask.keyCode.BACKSPACE, 1385 EventHandlers.keydownEvent.call(input, keydown), e.preventDefault(); 1386 1387 case "deleteContentForward": 1388 return keydown = new $.Event("keydown"), keydown.keyCode = Inputmask.keyCode.DELETE, 1389 EventHandlers.keydownEvent.call(input, keydown), e.preventDefault(); 1390 } 1391 } 1392 }, 1393 setValueEvent: function setValueEvent(e) { 1394 var input = this, value = e && e.detail ? e.detail[0] : arguments[1]; 1395 value = value || this.inputmask._valueGet(!0), applyInputValue(this, value); 1396 }, 1397 focusEvent: function focusEvent(e) { 1398 var input = this, nptValue = this.inputmask._valueGet(); 1399 opts.showMaskOnFocus && (nptValue !== getBuffer().join("") ? writeBuffer(this, getBuffer(), seekNext(getLastValidPosition())) : !1 === mouseEnter && caret(this, seekNext(getLastValidPosition()))), 1400 !0 === opts.positionCaretOnTab && !1 === mouseEnter && EventHandlers.clickEvent.apply(this, [ e, !0 ]), 1401 undoValue = getBuffer().join(""); 1402 }, 1403 mouseleaveEvent: function mouseleaveEvent() { 1404 var input = this; 1405 mouseEnter = !1, opts.clearMaskOnLostFocus && document.activeElement !== this && HandleNativePlaceholder(this, originalPlaceholder); 1406 }, 1407 clickEvent: function clickEvent(e, tabbed) { 1408 var input = this; 1409 if (document.activeElement === this) { 1410 var newCaretPosition = determineNewCaretPosition(caret(this), tabbed); 1411 void 0 !== newCaretPosition && caret(this, newCaretPosition); 1412 } 1413 }, 1414 cutEvent: function cutEvent(e) { 1415 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); 1416 clipboardData.setData("text", isRTL ? clipData.reverse().join("") : clip
1416Data.join("")), 1417 document.execCommand && document.execCommand("copy"), handleRemove(this, Inputmask.keyCode.DELETE, pos), 1418 writeBuffer(this, getBuffer(), getMaskSet().p, e, undoValue !== getBuffer().join("")); 1419 }, 1420 blurEvent: function blurEvent(e) { 1421 var $input = $(this), input = this; 1422 if (this.inputmask) { 1423 HandleNativePlaceholder(this, originalPlaceholder); 1424 var nptValue = this.inputmask._valueGet(), buffer = getBuffer().slice(); 1425 "" === nptValue && void 0 === colorMask || (opts.clearMaskOnLostFocus && (-1 === getLastValidPosition() && nptValue === getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer)), 1426 !1 === isComplete(buffer) && (setTimeout(function() { 1427 $input.trigger("incomplete"); 1428 }, 0), opts.clearIncomplete && (resetMaskSet(), buffer = opts.clearMaskOnLostFocus ? [] : getBufferTemplate().slice())), 1429 writeBuffer(this, buffer, void 0, e)), undoValue !== getBuffer().join("") && (undoValue = getBuffer().join(""), 1430 $input.trigger("change")); 1431 } 1432 }, 1433 mouseenterEvent: function mouseenterEvent() { 1434 var input = this; 1435 mouseEnter = !0, document.activeElement !== this && (this.placeholder !== originalPlaceholder && (originalPlaceholder = this.placeholder), 1436 opts.showMaskOnHover && HandleNativePlaceholder(this, (isRTL ? getBuffer().slice().reverse() : getBuffer()).join(""))); 1437 }, 1438 submitEvent: function submitEvent() { 1439 undoValue !== getBuffer().join("") && $el.trigger("change"), opts.clearMaskOnLostFocus && -1 === getLastValidPosition() && el.inputmask._valueGet && el.inputmask._valueGet() === getBufferTemplate().join("") && el.inputmask._valueSet(""), 1440 opts.clearIncomplete && !1 === isComplete(getBuffer()) && el.inputmask._valueSet(""), 1441 opts.removeMaskOnSubmit && (el.inputmask._valueSet(el.inputmask.unmaskedvalue(), !0), 1442 setTimeout(function() { 1443 writeBuffer(el, getBuffer()); 1444 }, 0)); 1445 }, 1446 resetEvent: function resetEvent() { 1447 el.inputmask.refreshValue = !0, setTimeout(function() { 1448 applyInputValue(el, el.inputmask._valueGet(!0)); 1449 }, 0); 1450 } 1451 }, valueBuffer; 1452 function checkVal(input, writeOut, strict, nptvl, initiatingEvent) { 1453 var inputmask = this || input.inputmask, inputValue = nptvl.slice(), charCodes = "", initialNdx = -1, result = void 0; 1454 function isTemplateMatch(ndx, charCodes) { 1455 if (opts.regex) return !1; 1456 for (var targetTemplate = getMaskTemplate(!0, 0, !1).slice(ndx, seekNext(ndx)).join("").replace(/'/g, ""), charCodeNdx = targetTemplate.indexOf(charCodes); 0 < charCodeNdx && " " === targetTemplate[charCodeNdx - 1]; ) charCodeNdx--; 1457 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))); 1458 return !match && 0 < charCodeNdx && (inputmask.caretPos = { 1459 begin: seekNext(charCodeNdx) 1460 }), match; 1461 } 1462 resetMaskSet(), initialNdx = opts.radixPoint ? determineNewCaretPosition(0) : 0, 1463 getMaskSet().p = initialNdx, inputmask.caretPos = { 1464 begin: initialNdx 1465 }; 1466 var staticMatches = [], prevCaretPos = inputmask.caretPos, sndx, validPos, nextValid;
1467 if ($.each(inputValue, function(ndx, charCode) { 1468 if (void 0 !== charCode) if (void 0 === getMaskSet().validPositions[ndx] && inputValue[ndx] === getPlaceholder(ndx) && isMask(ndx, !0) && !1 === isValid(ndx, inputValue[ndx], !0, void 0, void 0, !0)) getMaskSet().p++; else { 1469 var keypress = new $.Event("_checkval"); 1470 keypress.which = charCode.charCodeAt(0), charCodes += charCode; 1471 var lvp = getLastValidPosition(void 0, !0); 1472 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), 1473 result && (initialNdx = inputmask.caretPos.begin + 1, charCodes = "")), result ? (result.pos && getMaskSet().validPositions[result.pos] && !0 === getMaskSet().validPositions[result.pos].match.static && (staticMatches.push(result.pos), 1474 result.forwardPosition = result.pos + 1), writeBuffer(void 0, getBuffer(), result.forwardPosition, keypress, !1), 1475 inputmask.caretPos = { 1476 begin: result.forwardPosition, 1477 end: result.forwardPosition 1478 }, prevCaretPos = inputmask.caretPos) : inputmask.caretPos = prevCaretPos; 1479 } 1480 }), 0 < staticMatches.length) if (isComplete(getBuffer())) for (;sndx = staticMatches.pop(); ) validPos = getMaskSet().validPositions[sndx], 1481 validPos.generatedInput = !0; else for (;sndx = staticMatches.pop(); ) { 1482 var keypress = new $.Event("_checkval"), nextSndx = sndx + 1; 1483 for (validPos = getMaskSet().validPositions[sndx], validPos.generatedInput = !0, 1484 keypress.which = validPos.input.charCodeAt(0); (nextValid = getMaskSet().validPositions[nextSndx]) && nextValid.input === validPos.input; ) nextSndx++; 1485 if (EventHandlers.keypressEvent.call(input, keypress, !0, !1, strict, nextSndx), 1486 isComplete(getBuffer())) break; 1487 } 1488 writeOut && writeBuffer(input, getBuffer(), result ? result.forwardPosition : void 0, initiatingEvent || new $.Event("checkval"), initiatingEvent && "input" === initiatingEvent.type); 1489 } 1490 function unmaskedvalue(input) { 1491 if (input) { 1492 if (void 0 === input.inputmask) return input.value; 1493 input.inputmask && input.inputmask.refreshValue && applyInputValue(input, input.inputmask._valueGet(!0)); 1494 } 1495 var umValue = [], vps = getMaskSet().validPositions; 1496 for (var pndx in vps) vps[pndx] && vps[pndx].match && 1 != vps[pndx].match.static && umValue.push(vps[pndx].input); 1497 var unmaskedValue = 0 === umValue.length ? "" : (isRTL ? umValue.reverse() : umValue).join(""); 1498 if ($.isFunction(opts.onUnMask)) { 1499 var bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join(""); 1500 unmaskedValue = opts.onUnMask.call(inputmask, bufferValue, unmaskedValue, opts); 1501 } 1502 return unmaskedValue; 1503 } 1504 function caret(input, begin, end, notranslate) { 1505 function translatePosition(pos) { 1506 return !isRTL || "number" != typeof pos || opts.greedy && "" === opts.placeholder || !el || (pos = el.inputmask._valueGet().length - pos), 1507 pos; 1508 } 1509 var range; 1510 if (void 0 === begin) return "selectionStart" in input && "selectionEnd" in input ? (begin = input.selectionStart, 1511 end = input.selectionEnd) : window.getSelection ? (range = window.getSelection().getRangeAt(0), 1512 range.commonAncestorContainer.parentNode !== input && range.commonAncestorContainer !== input || (begin = range.startOffset, 1513 end = range.endOffset)) : document.selection && document.selection.createRange && (range = document.selection.createRange(), 1514 begin = 0 - range.duplicate().moveStart("character", -input.inputmask._valueGet().length), 1515 end = begin + range.text.length), { 1516 begin: notranslate ? begin : translatePosition(begin), 1517 end: notranslate ? end : translatePosition(en
1517d) 1518 }; 1519 if ($.isArray(begin) && (end = isRTL ? begin[0] : begin[1], begin = isRTL ? begin[1] : begin[0]), 1520 void 0 !== begin.begin && (end = isRTL ? begin.begin : begin.end, begin = isRTL ? begin.end : begin.begin), 1521 "number" == typeof begin) { 1522 begin = notranslate ? begin : translatePosition(begin), end = notranslate ? end : translatePosition(end), 1523 end = "number" == typeof end ? end : begin; 1524 var scrollCalc = parseInt(((input.ownerDocument.defaultView || window).getComputedStyle ? (input.ownerDocument.defaultView || window).getComputedStyle(input, null) : input.currentStyle).fontSize) * end; 1525 if (input.scrollLeft = scrollCalc > input.scrollWidth ? scrollCalc : 0, input.inputmask.caretPos = { 1526 begin: begin, 1527 end: end 1528 }, input === document.activeElement) { 1529 if ("setSelectionRange" in input) input.setSelectionRange(begin, end); else if (window.getSelection) { 1530 if (range = document.createRange(), void 0 === input.firstChild || null === input.firstChild) { 1531 var textNode = document.createTextNode(""); 1532 input.appendChild(textNode); 1533 } 1534 range.setStart(input.firstChild, begin < input.inputmask._valueGet().length ? begin : input.inputmask._valueGet().length), 1535 range.setEnd(input.firstChild, end < input.inputmask._valueGet().length ? end : input.inputmask._valueGet().length), 1536 range.collapse(!0); 1537 var sel = window.getSelection(); 1538 sel.removeAllRanges(), sel.addRange(range); 1539 } else input.createTextRange && (range = input.createTextRange(), range.collapse(!0), 1540 range.moveEnd("character", end), range.moveStart("character", begin), range.select()); 1541 renderColorMask(input, { 1542 begin: begin, 1543 end: end 1544 }); 1545 } 1546 } 1547 } 1548 function determineLastRequiredPosition(returnDefinition) { 1549 var buffer = getMaskTemplate(!0, getLastValidPosition(), !0, !0), bl = buffer.length, pos, lvp = getLastValidPosition(), positions = {}, lvTest = getMaskSet().validPositions[lvp], ndxIntlzr = void 0 !== lvTest ? lvTest.locator.slice() : void 0, testPos; 1550 for (pos = lvp + 1; pos < buffer.length; pos++) testPos = getTestTemplate(pos, ndxIntlzr, pos - 1), 1551 ndxIntlzr = testPos.locator.slice(), positions[pos] = $.extend(!0, {}, testPos); 1552 var lvTestAlt = lvTest && void 0 !== lvTest.alternation ? lvTest.locator[lvTest.alternation] : void 0; 1553 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--; 1554 return returnDefinition ? { 1555 l: bl, 1556 def: positions[bl] ? positions[bl].match : void 0 1557 } : bl; 1558 } 1559 function clearOptionalTail(buffer) { 1560 buffer.length = 0; 1561 for (var template = getMaskTemplate(!0, 0, !0, void 0, !0), lmnt; void 0 !== (lmnt = template.shift()); ) buffer.push(lmnt); 1562 return buffer; 1563 } 1564 function isComplete(buffer) { 1565 if ($.isFunction(opts.isComplete)) return opts.isComplete(buffer, opts); 1566 if ("*" !== opts.repeat) { 1567 var complete = !1, lrp = determineLastRequiredPosition(!0), aml = seekPrevious(lrp.l); 1568 if (void 0 === lrp.def || lrp.def.newBlockMarker || lrp.def.optionality || lrp.def.optionalQuantifier) { 1569 complete = !0; 1570 for (var i = 0; i <= aml; i++) { 1571 var test = getTestTemplate(i).match; 1572 if (!0 !== test.static && void 0 === getMaskSet().validPositions[i] && !0 !== test.optionality && !0 !== test.optionalQuantifier || !0 === test.static && buffer[i] !== getPlaceholder(i, test)) { 1573 complete = !1; 1574 break; 1575 } 1576 } 1577 } 1578 return complete; 1579 } 1580 } 1581 function handleRemove(input, k, pos, strict, fromIsValid) { 1582 if ((opts.numericInput || isRTL) && (k === Inputmask.keyCode.BACKSPACE ? k = Inputmask.keyCode.DELETE : k === Inputmask.keyCode.DELETE && (k = Inputmask.keyCode.BACKSPACE), 1583 isRTL)) { 1584 var pend = pos.end; 1585 pos.end = pos.begin, pos.begin = pend; 1586 } 1587 if (k === Inputmask.keyCode.BACKSPACE && pos.end - pos.begin < 1 ? (pos.begin = seekPrevious(pos.begin), 1588 void 0 !== getMaskSet().validPositions[pos.begin] && getMaskSet().validPositions[pos.begin].input === opts.groupSeparator && pos.begin--) : k === Inputmask.keyCode.DELETE && pos.begin === pos.end && (pos.end = isMask(pos.end, !0) && getMaskSet().validPositions[pos.end] && getMaskSet().validPositions[pos.end].input !== opts.radixPoint ? pos.end + 1 : seekNext(pos.end) + 1, 1589 void 0 !== getMaskSet().validPositions[pos.begin] && getMaskSet().validPositions[pos.begin].input === opts.groupSeparator && pos.end++), 1590 revalidateMask(pos), !0 !== strict && !1 !== opts.keepStatic || null !== opts.regex) { 1591 var result = alternate(!0); 1592 if (result) { 1593 var newPos = void 0 !== result.caret ? result.caret : result.pos ? seekNext(result.pos.begin ? result.pos.begin : result.pos) : getLastValidPosition(-1, !0); 1594 (k !== Inputmask.keyCode.DELETE || pos.begin > newPos) && pos.begin; 1595 } 1596 } 1597 var lvp = getLastValidPosition(pos.begin, !0); 1598 if (lvp < pos.begin || -1 === pos.begin) getMaskSet().p = seekNext(lvp); else if (!0 !== strict && (getMaskSet().p = pos.begin, 1599 !0 !== fromIsValid)) for (;getMaskSet().p < lvp && void 0 === getMaskSet().validPositions[getMaskSet().p]; ) getMaskSet().p++; 1600 } 1601 function initializeColorMask(input) { 1602 var computedStyle = (input.ownerDocument.defaultView || window).getComputedStyle(input, null); 1603 function findCaretPos(clientx) { 1604 var e = document.createElement("span"), caretPos; 1605 for (var style in computedStyle) isNaN(style) && -1 !== style.indexOf("font") && (e.style[style] = computedStyle[style]); 1606 e.style.textTransform = computedStyle.textTransform, e.style.letterSpacing = computedStyle.letterSpacing, 1607 e.style.position = "absolute", e.style.height = "auto", e.style.width = "auto", 1608 e.style.visibility = "hidden", e.style.whiteSpace = "nowrap", document.body.appendChild(e); 1609 var inputText = input.inputmask._valueGet(), previousWidth = 0, itl; 1610 for (caretPos = 0, itl = inputText.length; caretPos <= itl;
1610 caretPos++) { 1611 if (e.innerHTML += inputText.charAt(caretPos) || "_", e.offsetWidth >= clientx) { 1612 var offset1 = clientx - previousWidth, offset2 = e.offsetWidth - clientx; 1613 e.innerHTML = inputText.charAt(caretPos), offset1 -= e.offsetWidth / 3, caretPos = offset1 < offset2 ? caretPos - 1 : caretPos; 1614 break; 1615 } 1616 previousWidth = e.offsetWidth; 1617 } 1618 return document.body.removeChild(e), caretPos; 1619 } 1620 var template = document.createElement("div"); 1621 template.style.width = computedStyle.width, template.style.textAlign = computedStyle.textAlign, 1622 colorMask = document.createElement("div"), input.inputmask.colorMask = colorMask, 1623 colorMask.className = "im-colormask", input.parentNode.insertBefore(colorMask, input), 1624 input.parentNode.removeChild(input), colorMask.appendChild(input), colorMask.appendChild(template), 1625 input.style.left = template.offsetLeft + "px", $(colorMask).on("mouseleave", function(e) { 1626 return EventHandlers.mouseleaveEvent.call(input, [ e ]); 1627 }), $(colorMask).on("mouseenter", function(e) { 1628 return EventHandlers.mouseenterEvent.call(input, [ e ]); 1629 }), $(colorMask).on("click", function(e) { 1630 return caret(input, findCaretPos(e.clientX)), EventHandlers.clickEvent.call(input, [ e ]); 1631 }); 1632 } 1633 function renderColorMask(input, caretPos, clear) { 1634 var maskTemplate = [], isStatic = !1, test, testPos, ndxIntlzr, pos = 0; 1635 function setEntry(entry) { 1636 if (void 0 === entry && (entry = ""), isStatic || !0 !== test.static && void 0 !== testPos.input) if (isStatic && (!0 !== test.static && void 0 !== testPos.input || "" === test.def)) { 1637 isStatic = !1; 1638 var mtl = maskTemplate.length; 1639 maskTemplate[mtl - 1] = maskTemplate[mtl - 1] + "</span>", maskTemplate.push(entry); 1640 } else maskTemplate.push(entry); else isStatic = !0, maskTemplate.push("<span class='im-static'>" + entry); 1641 } 1642 function setCaret() { 1643 document.activeElement === input && (maskTemplate.splice(caretPos.begin, 0, caretPos.begin === caretPos.end || caretPos.end > getMaskSet().maskLength ? '<mark class="im-caret" style="border-right-width: 1px;border-right-style: solid;">' : '<mark class="im-caret-select">'), 1644 maskTemplate.splice(caretPos.end + 1, 0, "</mark>")); 1645 } 1646 if (void 0 !== colorMask) { 1647 var buffer = getBuffer(); 1648 if (void 0 === caretPos ? caretPos = caret(input) : void 0 === caretPos.begin && (caretPos = { 1649 begin: caretPos, 1650 end: caretPos 1651 }), !0 !== clear) { 1652 for (var lvp = getLastValidPosition(); getMaskSet().validPositions[pos] ? (testPos = getMaskSet().validPositions[pos], 1653 test = testPos.match, ndxIntlzr = testPos.locator.slice(), setEntry(buffer[pos])) : (testPos = getTestTemplate(pos, ndxIntlzr, pos - 1), 1654 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), 1655 pos++, (void 0 === maxLength || pos < maxLength) && (!0 !== test.static || "" !== test.def) || pos < lvp || isStatic; ) ; 1656 isStatic && setEntry(), setCaret(); 1657 } 1658 var template = colorMask.getElementsByTagName("div")[0]; 1659 template.innerHTML = maskTemplate.join(""), input.inputmask.positionColorMask(input, template); 1660 } 1661 } 1662 function applyInputValue(input, value) { 1663 input.inputmask.refreshValue = !1, $.isFunction(opts.onBeforeMask) && (value = opts.onBeforeMask.call(inputmask, value, opts) || value), 1664 value = value.toString().split(""), checkVal(input, !0, !1, value), und
1664oValue = getBuffer().join(""), 1665 (opts.clearMaskOnLostFocus || opts.clearIncomplete) && input.inputmask._valueGet() === getBufferTemplate().join("") && input.inputmask._valueSet(""); 1666 } 1667 function mask(elem) { 1668 function isElementTypeSupported(input, opts) { 1669 function patchValueProperty(npt) { 1670 var valueGet, valueSet; 1671 function patchValhook(type) { 1672 if ($.valHooks && (void 0 === $.valHooks[type] || !0 !== $.valHooks[type].inputmaskpatch)) { 1673 var valhookGet = $.valHooks[type] && $.valHooks[type].get ? $.valHooks[type].get : function(elem) { 1674 return elem.value; 1675 }, valhookSet = $.valHooks[type] && $.valHooks[type].set ? $.valHooks[type].set : function(elem, value) { 1676 return elem.value = value, elem; 1677 }; 1678 $.valHooks[type] = { 1679 get: function get(elem) { 1680 if (elem.inputmask) { 1681 if (elem.inputmask.opts.autoUnmask) return elem.inputmask.unmaskedvalue(); 1682 var result = valhookGet(elem); 1683 return -1 !== getLastValidPosition(void 0, void 0, elem.inputmask.maskset.validPositions) || !0 !== opts.nullable ? result : ""; 1684 } 1685 return valhookGet(elem); 1686 }, 1687 set: function set(elem, value) { 1688 var result = valhookSet(elem, value); 1689 return elem.inputmask && applyInputValue(elem, value), result; 1690 }, 1691 inputmaskpatch: !0 1692 }; 1693 } 1694 } 1695 function getter() { 1696 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); 1697 } 1698 function setter(value) { 1699 valueSet.call(this, value), this.inputmask && applyInputValue(this, value); 1700 } 1701 function installNativeValueSetFallback(npt) { 1702 EventRuler.on(npt, "mouseenter", function() { 1703 var input = this, value = this.inputmask._valueGet(!0); 1704 value !== (isRTL ? getBuffer().reverse() : getBuffer()).join("") && applyInputValue(this, value); 1705 }); 1706 } 1707 if (!npt.inputmask.__valueGet) { 1708 if (!0 !== opts.noValuePatching) { 1709 if (Object.getOwnPropertyDescriptor) { 1710 "function" != typeof Object.getPrototypeOf && (Object.getPrototypeOf = "object" === _typeof("test".__proto__) ? function(object) { 1711 return object.__proto__; 1712 } : function(object) { 1713 return object.constructor.prototype; 1714 }); 1715 var valueProperty = Object.getPrototypeOf ? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(npt), "value") : void 0; 1716 valueProperty && valueProperty.get && valueProperty.set ? (valueGet = valueProperty.get, 1717 valueSet = valueProperty.set, Object.defineProperty(npt, "value", { 1718 get: getter, 1719 set: setter, 1720 configurable: !0 1721 })) : "INPUT" !== npt.tagName && (valueGet = function valueGet() { 1722 return this.textContent; 1723 }, valueSet = function valueSet(value) { 1724 this.textContent = value; 1725 }, Object.defineProperty(npt, "value", { 1726 get: getter, 1727 set: setter, 1728 configurable: !0 1729 })); 1730 } else document.__lookupGetter__ && npt.__lookupGetter__("value") && (valueGet = npt.__lookupGetter__("value"), 1731 valueSet = npt.__lookupSetter__("value"), npt.__defineGetter__("value", getter), 1732 npt.__defineSetter__("value", setter)); 1733 npt.inputmask.__valueGet = valueGet, npt.inputmask.__valueSet = valueSet; 1734 } 1735 npt.inputmask._valueGet = function(overruleRTL) { 1736 return isRTL && !0 !== overruleRTL ? valueGet.call(this.el).split("").reverse().join("") : valueGet.call(this.el); 1737 }, npt.inputmask._valueSet = function(value, overruleRTL) { 1738 valueSet.call(this.el, null == value ? "" : !0 !== overruleRTL && isRTL ? value.split("").reverse().join("") : value); 1739 }, void 0 === valueGet && (valueGet = function valueGet() { 1740 return this.value; 1741 }, valueSet = function valueSet(value) { 1742 this.value = value; 1743 }, patchValhook(npt.type), installNativeValueSetFallback(npt)); 1744 } 1745 } 1746 var elementType = input.getAttribute("type"), isSupported = "INPUT" === input.tagName && -1 !== $.inArray(elementType, opts.supportsInputType) || input.isContentEditable || "TEXTAREA" === input.tagName; 1747 if (!isSupported) if ("INPUT" === input.tagName) { 1748 var el = document.createElement("input"); 1749 el.setAttribute("type", elementType), isSupported = "text" === el.type, el = null; 1750 } else isSupported = "partial"; 1751 return !1 !== isSupported ? patchValueProperty(input) : input.inputmask = void 0, 1752 isSupported; 1753 } 1754 EventRuler.off(elem); 1755 var isSupported = isElementTypeSupported(elem, opts); 1756 if (!1 !== isSupported && (el = elem, $el = $(el), originalPlaceholder = el.placeholder, 1757 maxLength = void 0 !== el ? el.maxLength : void 0, -1 === maxLength && (maxLength = void 0), 1758 !0 === opts.colorMask && initializeColorMask(el), mobile && ("inputmode" in el && (el.inputmode = opts.inputmode, 1759 el.setAttribute("inputmode", opts.inputmode)), !0 === opts.disablePredictiveText && ("autocorrect" in el ? el.autocorrect = !1 : (!0 !== opts.colorMask && initializeColorMask(el), 1760 el.type = "password"))), !0 === isSupported && (el.setAttribute("im-insert", opts.insertMode), 1761 EventRuler.on(el, "submit", EventHandlers.submitEvent), EventRuler.on(el, "reset", EventHandlers.resetEvent), 1762 EventRuler.on(el, "blur", EventHandlers.blurEvent), EventRuler.on(el, "focus", EventHandlers.focusEvent), 1763 !0 !== opts.colorMask && (EventRuler.on(el, "click", EventHandlers.clickEvent), 1764 EventRuler.on(el, "mouseleave", EventHandlers.mouseleaveEvent), EventRuler.on(el, "mouseenter", EventHandlers.mouseenterEvent)), 1765 EventRuler.on(el, "paste", EventHandlers.pasteEvent), EventRuler.on(el, "cut", EventHandlers.cutEvent), 1766 EventRuler.on(el, "complete", opts.oncomplete), EventRuler.on(el, "incomplete", opts.onincomplete), 1767 EventRuler.on(el, "cleared", opts.oncleared), mobile || !0 === opts.inputEventOnly ? el.removeAttribute("maxLength") : (EventRuler.on(el, "keydown", EventHandlers.keydownEvent), 1768 EventRuler.on(el, "keypress", EventHandlers.keypressEvent)), EventRuler.on(el, "input", EventHandlers.inputFallBackEvent), 1769 EventRuler.on(el, "beforeinput", EventHandlers.beforeInputEvent)), EventRuler.on(el, "setvalue", EventHandlers.setValueEvent), 1770 undoValue = getBufferTemplate().join(""), "" !== el.inputmask._valueGet(!0) || !1 === opts.clearMaskOnLostFocus || document.activeElement === el)) { 1771 var initialValue = $.isFunction(opts.onBeforeMask) && opts.onBeforeMask.call(inputmask, el.inputmask._valueGet(!0), opts) || el.inputmask._valueGet(!0); 1772 "" !== initialValue && checkVal(el, !0, !1, initialValue.split("")); 1773 var buffer = getBuffer().slice(); 1774 undoValue = buffer.join(""), !1 === isComplete(buffer) && opts.clearIncomplete && resetMaskSet(), 1775 opts.clearMaskOnLostFocus && document.activeElement !== el && (-1 === getLastValidPosition() ? buffer = [] : clearOptionalTail(buffer)), 1776 (!1 === opts.clearMaskOnLostFocus || opts.showMaskOnFocus && document.activeElement === el || "" !== el.inputmask._valueGet(!0)) && writeBuffer(el, buffer), 1777 document.activeElement === el && caret(el, seekNext(getLastValidPosition())); 1778 } 1779 } 1780 if (void 0 !== actionObj) switch (actionObj.action) { 1781 case "isComplete": 1782 return el = actionObj.el, isComplete(getBuffer()); 1783 1784 case "unmaskedvalue": 1785 return void 0 !== el && void 0 === actionObj.value || (valueBuffer = actionObj.value, 1786 valueBuffer = ($.isFunction(opts.onBeforeMask) && opts.onBeforeMask.call(inputmask, valueBuffer, opts) || valueBuffer).split(""), 1787 checkVal.call(this, void 0, !1, !1, valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite.call(inputmask, void 0, getBuffer(), 0, opts)), 1788 unmaskedvalue(el); 1789 1790 case "mask": 1791 mask(el); 1792 break; 1793 1794 case "format": 1795 return valueBuffer = ($.isFunction(opts.onBeforeMask) && opts.onBeforeMask.call(inputmask, actionObj.value, opts) || actionObj.value).split(""), 1796 checkVal.call(this, void 0, !0, !1, valueBuffer), actionObj.metadata ? { 1797 value: isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""), 1798 metadata: maskScope.call(this, { 1799 action: "getmetadata" 1800 }, maskset, opts) 1801 } : isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""); 1802 1803 case "isValid": 1804 actionObj.value ? (valueBuffer = actionObj.value.split(""), checkVal.call(this, void 0, !0, !0, valueBuffer)) : actionObj.value = isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""); 1805 for (var buffer = getBuffer(), rl = determineLastRequiredPosition(), lmib = buffer.length - 1; rl < lmib && !isMask(lmib); lmib--) ; 1806 return buffer.splice(rl, lmib + 1 - rl), isComplete(buffer) && actionObj.value === (isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join("")); 1807 1808 case "getemptymask": 1809 return getBufferTemplate().join(""); 1810 1811 case "remove": 1812 if (el && el.inputmask) { 1813 $.data(el, "_inputmask_opts", null), $el = $(el); 1814 var cv = opts.autoUnmask ? unmaskedvalue(el) : el.inputmask._valueGet(opts.autoUnmask), valueProperty; 1815 cv !== getBufferTemplate().join("") ? el.inputmask._valueSet(cv, opts.autoUnmask) : el.inputmask._valueSet(""), 1816 EventRuler.off(el), el.inputmask.colorMask && (colorMask = el.inputmask.colorMask, 1817 colorMask.removeChild(el), colorMask.parentNode.insertBefore(el, colorMask), colorMask.parentNode.removeChild(colorMask)), 1818 Object.getOwnPropertyDescriptor && Ob
1818ject.getPrototypeOf ? (valueProperty = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(el), "value"), 1819 valueProperty && el.inputmask.__valueGet && Object.defineProperty(el, "value", { 1820 get: el.inputmask.__valueGet, 1821 set: el.inputmask.__valueSet, 1822 configurable: !0 1823 })) : document.__lookupGetter__ && el.__lookupGetter__("value") && el.inputmask.__valueGet && (el.__defineGetter__("value", el.inputmask.__valueGet), 1824 el.__defineSetter__("value", el.inputmask.__valueSet)), el.inputmask = void 0; 1825 } 1826 return el; 1827 1828 case "getmetadata": 1829 if ($.isArray(maskset.metadata)) { 1830 var maskTarget = getMaskTemplate(!0, 0, !1).join(""); 1831 return $.each(maskset.metadata, function(ndx, mtdt) { 1832 if (mtdt.mask === maskTarget) return maskTarget = mtdt, !1; 1833 }), maskTarget; 1834 } 1835 return maskset.metadata; 1836 } 1837 }; 1838 }, function(module, exports, __webpack_require__) { 1839 function _typeof(obj) { 1840 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function _typeof(obj) { 1841 return typeof obj; 1842 } : function _typeof(obj) { 1843 return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 1844 }, _typeof(obj); 1845 } 1846 var Inputmask = __webpack_require__(3), $ = Inputmask.dependencyLib, formatCode = { 1847 d: [ "[1-9]|[12][0-9]|3[01]", Date.prototype.setDate, "day", Date.prototype.getDate ], 1848 dd: [ "0[1-9]|[12][0-9]|3[01]", Date.prototype.setDate, "day", function() { 1849 return pad(Date.prototype.getDate.call(this), 2); 1850 } ], 1851 ddd: [ "" ], 1852 dddd: [ "" ], 1853 m: [ "[1-9]|1[012]", Date.prototype.setMonth, "month", function() { 1854 return Date.prototype.getMonth.call(this) + 1; 1855 } ], 1856 mm: [ "0[1-9]|1[012]", Date.prototype.setMonth, "month", function() { 1857 return pad(Date.prototype.getMonth.call(this) + 1, 2); 1858 } ], 1859 mmm: [ "" ], 1860 mmmm: [ "" ], 1861 yy: [ "[0-9]{2}", Date.prototype.setFullYear, "year", function() { 1862 return pad(Date.prototype.getFullYear.call(this), 2); 1863 } ], 1864 yyyy: [ "[0-9]{4}", Date.prototype.setFullYear, "year", function() { 1865 return pad(Date.prototype.getFullYear.call(this), 4); 1866 } ], 1867 h: [ "[1-9]|1[0-2]", Date.prototype.setHours, "hours", Date.prototype.getHours ], 1868 hh: [ "0[1-9]|1[0-2]", Date.prototype.setHours, "hours", function() { 1869 return pad(Date.prototype.getHours.call(this), 2); 1870 } ], 1871 hhh: [ "[0-9]+", Date.prototype.setHours, "hours", Date.prototype.getHours ], 1872 H: [ "1?[0-9]|2[0-3]", Date.prototype.setHours, "hours", Date.prototype.getHours ], 1873 HH: [ "0[0-9]|1[0-9]|2[0-3]", Date.prototype.setHours, "hours", function() { 1874 return pad(Date.prototype.getHours.call(this), 2); 1875 } ], 1876 HHH: [ "[0-9]+", Date.prototype.setHours, "hours", Date.prototype.getHours ], 1877 M: [ "[1-5]?[0-9]", Date.prototype.setMinutes, "minutes", Date.prototype.getMinutes ], 1878 MM: [ "0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]", Date.prototype.setMinutes, "minutes", function() { 1879 return pad(Date.prototype.getMinutes.call(this), 2); 1880 } ], 1881 s: [ "[1-5]?[0-9]", Date.prototype.setSeconds, "seconds", Date.prototype.getSeconds ], 1882 ss: [ "0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]", Date.prototype.setSeconds, "seconds", function() { 1883 return pad(Date.prototype.getSeconds.call(this), 2); 1884 } ], 1885 l: [ "[0-9]{3}", Date.prototype.setMilliseconds, "milliseconds", function() { 1886 return pad(Date.prototype.getMilliseconds.call(this), 3); 1887 } ], 1888 L: [ "[0-9]{2}", Date.prototype.setMilliseconds, "milliseconds", function() { 1889 return pad(Date.prototype.getMilliseconds.call(this), 2); 1890 } ], 1891 t: [ "[ap]" ], 1892 tt: [ "[ap]m" ], 1893 T: [ "[AP]" ], 1894 TT: [ "[AP]M" ], 1895 Z: [ "" ], 1896 o: [ "" ], 1897 S: [ "" ] 1898 }, formatAlias = { 1899 isoDate: "yyyy-mm-dd", 1900 isoTime: "HH:MM:ss", 1901 isoDateTime: "yyyy-mm-dd'T'HH:MM:ss", 1902 isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'" 1903 }; 1904 function getTokenizer(opts) { 1905 if (!opts.tokenizer) { 1906 var tokens = []; 1907 for (var ndx in formatCode) -1 === tokens.indexOf(ndx[0]) && tokens.push(ndx[0]); 1908 opts.tokenizer = "(" + tokens.join("+|") + ")+?|.", opts.tokenizer = new RegExp(opts.tokenizer, "g"); 1909 } 1910 return opts.tokenizer; 1911 } 1912 function isValidDate(dateParts, currentResult) { 1913 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; 1914 } 1915 function isDateInRange(dateParts, opts) { 1916 var result = !0; 1917 if (opts.min) { 1918 if (dateParts.rawyear) { 1919 var rawYear = dateParts.rawyear.replace(/[^0-9]/g, ""), minYear = opts.min.year.substr(0, rawYear.length); 1920 result = minYear <= rawYear; 1921 } 1922 dateParts.year === dateParts.rawyear && opts.min.date.getTime() == opts.min.date.getTime() && (result = opts.min.date.getTime() <= dateParts.date.getTime()); 1923 } 1924 return result && opts.max && opts.max.date.getTime() == opts.max.date.getTime() && (result = opts.max.date.getTime() >= dateParts.date.getTime()), 1925 result; 1926 } 1927 function parse(format, dateObjValue, opts, raw) { 1928 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]) { 1929 case "[": 1930 mask += "("; 1931 break; 1932 1933 case "]": 1934 mask += ")?"; 1935 break; 1936 1937 default: 1938 mask += Inputmask.escapeRegex(match[0]); 1939 } else if (formatCode[match[0]]) if (!0 !== raw && formatCode[match[0]][3]) { 1940 var getFn = formatCode[match[0]][3]; 1941 mask += getFn.call(dateObjValue.date); 1942 } else formatCode[match[0]][2] ? mask += dateObjValue["raw" + formatCode[match[0]][2]] : mask += match[0]; else mask += match[0]; 1943 return mask; 1944 } 1945 function pad(val, len) { 1946 for (val = String(val), len = len || 2; val.length < len; ) val = "0" + val; 1947 return val; 1948 } 1949 function analyseMask(maskString, format, opts) { 1950 var dateObj = { 1951 date: new Date(1, 0, 1) 1952 }, targetProp, mask = maskString, match, dateOperation; 1953 function extendProperty(value) { 1954 var correctedValue = value.replace(/[^0-9]/g, "0"); 1955 return correctedValue; 1956 } 1957 function setValue(dateObj, value, opts) { 1958 dateObj[targetProp] = extendProperty(value), dateObj["raw" + targetProp] = value,
1959 void 0 !== dateOperation && dateOperation.call(dateObj.date, "month" == targetProp ? parseInt(dateObj[targetProp]) - 1 : dateObj[targetProp]); 1960 } 1961 if ("string" == typeof mask) { 1962 for (;match = getTokenizer(opts).exec(format); ) { 1963 var value = mask.slice(0, match[0].length); 1964 formatCode.hasOwnProperty(match[0]) && (targetProp = formatCode[match[0]][2], dateOperation = formatCode[match[0]][1], 1965 setValue(dateObj, value, opts)), mask = mask.slice(value.length); 1966 } 1967 return dateObj; 1968 } 1969 if (mask && "object" === _typeof(mask) && mask.hasOwnProperty("date")) return mask; 1970 } 1971 Inputmask.extendAliases({ 1972 datetime: { 1973 mask: function mask(opts) { 1974 return formatCode.S = opts.i18n.ordinalSuffix.join("|"), opts.inputFormat = formatAlias[opts.inputFormat] || opts.inputFormat, 1975 opts.displayFormat = formatAlias[opts.displayFormat] || opts.displayFormat || opts.inputFormat, 1976 opts.outputFormat = formatAlias[opts.outputFormat] || opts.outputFormat || opts.inputFormat, 1977 opts.placeholder = "" !== opts.placeholder ? opts.placeholder : opts.inputFormat.replace(/[[\]]/, ""), 1978 opts.regex = parse(opts.inputFormat, void 0, opts), null; 1979 }, 1980 placeholder: "", 1981 inputFormat: "isoDateTime", 1982 displayFormat: void 0, 1983 outputFormat: void 0, 1984 min: null, 1985 max: null, 1986 i18n: { 1987 dayNames: [ "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ], 1988 monthNames: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
1988November", "December" ], 1989 ordinalSuffix: [ "st", "nd", "rd", "th" ] 1990 }, 1991 preValidation: function preValidation(buffer, pos, c, isSelection, opts, maskset) { 1992 var calcPos = 0, targetMatch, match; 1993 if (isNaN(c) && buffer[pos] !== c) { 1994 for (;match = getTokenizer(opts).exec(opts.inputFormat); ) if (calcPos += match[0].length, 1995 pos <= calcPos) { 1996 targetMatch = match, match = getTokenizer(opts).exec(opts.inputFormat); 1997 break; 1998 } 1999 if (match && match[0] === c && 1 < targetMatch[0].length) return buffer[pos] = buffer[pos - 1], 2000 buffer[pos - 1] = "0", { 2001 fuzzy: !0, 2002 buffer: buffer, 2003 refreshFromBuffer: { 2004 start: pos - 1, 2005 end: pos + 1 2006 }, 2007 pos: pos + 1 2008 }; 2009 } 2010 return !0; 2011 }, 2012 postValidation: function postValidation(buffer, pos, currentResult, opts) { 2013 opts.min = analyseMask(opts.min, opts.inputFormat, opts), opts.max = analyseMask(opts.max, opts.inputFormat, opts), 2014 currentResult.fuzzy && (buffer = currentResult.buffer, pos = currentResult.pos); 2015 var result = currentResult, dateParts = analyseMask(buffer.join(""), opts.inputFormat, opts); 2016 return result && dateParts.date.getTime() == dateParts.date.getTime() && (result = isValidDate(dateParts, result), 2017 result = result && isDateInRange(dateParts, opts)), pos && result && currentResult.pos !== pos ? { 2018 buffer: parse(opts.inputFormat, dateParts, opts), 2019 refreshFromBuffer: { 2020 start: pos, 2021 end: currentResult.pos 2022 } 2023 } : result; 2024 }, 2025 onKeyDown: function onKeyDown(e, buffer, caretPos, opts) { 2026 var input = this; 2027 if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) { 2028 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)); 2029 this.inputmask._valueSet(date), $(this).trigger("setvalue"); 2030 } 2031 }, 2032 onUnMask: function onUnMask(maskedValue, unmaskedValue, opts) { 2033 return unmaskedValue ? parse(opts.outputFormat, analyseMask(maskedValue, opts.inputFormat, opts), opts, !0) : unmaskedValue; 2034 }, 2035 casing: function casing(elem, test, pos, validPositions) { 2036 return 0 == test.nativeDef.indexOf("[ap]") ? elem.toLowerCase() : 0 == test.nativeDef.indexOf("[AP]") ? elem.toUpperCase() : elem; 2037 }, 2038 insertMode: !1, 2039 shiftPositions: !1 2040 } 2041 }), module.exports = Inputmask; 2042 }, function(module, exports, __webpack_require__) { 2043 var Inputmask = __webpack_require__(3), $ = Inputmask.dependencyLib; 2044 function autoEscape(txt, opts) { 2045 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); 2046 return escapedTxt; 2047 } 2048 function alignDigits(buffer, digits, opts) { 2049 if (0 < digits && !opts.digitsOptional && 0 < buffer.length) { 2050 var radixPosition = $.inArray(opts.radixPoint, buffer); 2051 -1 === radixPosition && (buffer.push(opts.radixPoint), radixPosition = buffer.length - 1); 2052 for (var i = 1; i <= digits; i++) buffer[radixPosition + i] = buffer[radixPosition + i] || "0"; 2053 } 2054 return buffer; 2055 } 2056 function FindPlusValidator(maskset) { 2057 var posNdx = 0; 2058 for (posNdx in maskset.validPositions) ; 2059 for (var tstNdx in maskset.tests) if (posNdx <= tstNdx) for (var ndx = 0, ndxl = maskset.tests[tstNdx].length; ndx < ndxl; ndx++) if ("+" === maskset.tests[tstNdx][ndx].match.def) return parseInt(tstNdx) + (void 0 !== maskset.validPositions[tstNdx] ? 1 : 0); 2060 return parseInt(posNdx); 2061 } 2062 function parseMinMaxOptions(opts) { 2063 void 0 === opts.parseMinMaxOptions && (null !== opts.min && (opts.min = opts.min.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""), 2064 "," === opts.radixPoint && (opts.min = opts.min.replace(opts.radixPoint, ".")), 2065 opts.min = isFinite(opts.min) ? parseFloat(opts.min) : NaN, isNaN(opts.min) && (opts.min = Number.MIN_VALUE)), 2066 null !== opts.max && (opts.max = opts.max.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""), 2067 "," === opts.radixPoint && (opts.max = opts.max.replace(opts.radixPoint, ".")), 2068 opts.max = isFinite(opts.max) ? parseFloat(opts.max) : NaN, isNaN(opts.max) && (opts.max = Number.MAX_VALUE)), 2069 opts.parseMinMaxOptions = "done"); 2070 } 2071 function genMask(opts) { 2072 opts.repeat = 0, opts.groupSeparator === opts.radixPoint && opts.digits && "0" !== opts.digits && ("." === opts.radixPoint ? opts.groupSeparator = "," : "," === opts.radixPoint ? opts.groupSeparator = "." : opts.groupSeparator = ""), 2073 " " === opts.groupSeparator && (opts.skipOptionalPartCharacter = void 0), 1 < opts.placeholder.length && (opts.placeholder = opts.placeholder.charAt(0)), 2074 "radixFocus" === opts.positionCaretOnClick && "" === opts.placeholder && (opts.positionCaretOnClick = "lvp"); 2075 var decimalDef = "0"; 2076 !0 === opts.numericInput && void 0 === opts.__financeInput ? (decimalDef = "1", 2077 opts.positionCaretOnClick = "radixFocus" === opts.positionCaretOnClick ? "lvp" : opts.positionCaretOnClick, 2078 opts.digitsOptional = !1, isNaN(opts.digits) && (opts.digits = 2), opts._radixDance = !1) : (opts.__financeInput = !1, 2079 opts.numericInput = !0); 2080 var mask = "[+]", altMask; 2081 if (mask += autoEscape(opts.prefix, opts), "" !== opts.groupSeparator ? mask += opts._mask(opts) : mask += "9{+}", 2082 void 0 !== opts.digits) { 2083 var dq = opts.digits.toString().split(","); 2084 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 + "}", 2085 opts.keepStatic = !0) : mask += opts.radixPoint + decimalDef + "{" + opts.digits + "}"); 2086 } 2087 return mask += autoEscape(opts.suffix, opts), mask += "[-]", altMask && (mask = [ altMask + autoEscape(opts.suffix, opts) + "[-]", mask ]), 2088 opts.greedy = !1, parseMinMaxOptions(opts), console.log(mask), mask; 2089 } 2090 function hanndleRadixDance(pos, c, radixPos, opts) { 2091 return opts._radixDance && opts.numericInput && pos <= radixPos && (0 < radixPos || c == opts.radixPoint) && (pos -= 1), 2092 pos; 2093 } 2094 function decimalValidator(chrs, maskset, pos, strict, opts) { 2095 var radixPos = maskset.buffer.indexOf(opts.radixPoint), result = -1 !== radixPos && new RegExp("[0-9\uff11-\uff19]").test(chrs); 2096 return opts._radixDance && result && null == maskset.validPositions[radixPos] ? { 2097 insert: { 2098 pos: radixPos === pos ? radixPos + 1 : radixPos, 2099 c: opts.radixPoint 2100 }, 2101 pos: pos 2102 } : result; 2103 } 2104 Inputmask.extendAliases({ 2105 numeric: { 2106 mask: genMask, 2107 _mask: function _mask(opts) { 2108 return "(" + opts.groupSeparator + "999){+|1}"; 2109 }, 2110 placeholder: "0", 2111 greedy: !1, 2112 digits: "*", 2113 digitsOptional: !0, 2114 enforceDigitsOnBlur: !1, 2115 radixPoint: ".", 2116 positionCaretOnClick: "radixFocus", 2117 _radixDance: !0, 2118 groupSeparator: "", 2119 allowMinus: !0, 2120 negationSymbol: { 2121 front: "-", 2122 back: "" 2123 }, 2124 prefix: "", 2125 suffix: "", 2126 rightAlign: !0, 2127 min: null, 2128 max: null, 2129 step: 1, 2130 insertMode: !0, 2131 autoUnmask: !1, 2132 unmaskAsNumber: !1, 2133 inputmode: "numeric", 2134 definitions: { 2135 0: { 2136 validator: decimalValidator 2137 }, 2138 1: { 2139 validator: decimalValidator, 2140 definitionSymbol: "*" 2141 }, 2142 "+": { 2143 validator: function validator(chrs, maskset, pos, strict, opts) { 2144 return opts.allowMinus && ("-" === chrs || chrs === opts.negationSymbol.front); 2145 } 2146 }, 2147 "-": { 2148 validator: function validator(chrs, maskset, pos, strict, opts) { 2149 return opts.allowMinus && chrs === opts.negationSymbol.back; 2150 } 2151 } 2152 },
2153 preValidation: function preValidation(buffer, pos, c, isSelection, opts, maskset) { 2154 var radixPos = $.inArray(opts.radixPoint, buffer); 2155 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 ? { 2156 caret: opts._radixDance && pos === radixPos - 1 ? radixPos + 1 : radixPos 2157 } : { 2158 rewritePosition: pos 2159 }; 2160 if (!0 !== opts.allowMinus) return !1; 2161 var isNegative = !1; 2162 return $.each(maskset.validPositions, function(ndx, tst) { 2163 if ("+" === tst.match.def) return isNegative = ndx, !1; 2164 }), !1 !== isNegative ? { 2165 remove: parseInt(isNegative), 2166 caret: pos < radixPos ? pos + 1 : pos 2167 } : { 2168 insert: { 2169 pos: FindPlusValidator(maskset), 2170 c: c, 2171 fromIsValid: !0 2172 }, 2173 caret: pos < radixPos ? pos + 1 : pos 2174 }; 2175 }, 2176 postValidation: function postValidation(buffer, pos, currentResult, opts) { 2177 if (null !== opts.min || null !== opts.max) { 2178 var unmasked = opts.onUnMask(buffer.slice().reverse().join(""), void 0, $.extend({}, opts, { 2179 unmaskAsNumber: !0 2180 })); 2181 if (null !== opts.min && unmasked < opts.min && unmasked.toString().length >= opts.min.toString().length) return !1; 2182 if (null !== opts.max && unmasked > opts.max) return !1; 2183 } 2184 return currentResult; 2185 }, 2186 onUnMask: function onUnMask(maskedValue, unmaskedValue, opts) { 2187 if ("" === unmaskedValue && !0 === opts.nullable) return unmaskedValue; 2188 var processValue = maskedValue.replace(opts.prefix, ""); 2189 return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""), 2190 "" !== opts.placeholder.charAt(0) && (processValue = processValue.replace(new RegExp(opts.placeholder.charAt(0), "g"), "0")), 2191 opts.unmaskAsNumber ? ("" !== opts.radixPoint && -1 !== processValue.indexOf(opts.radixPoint) && (processValue = processValue.replace(Inputmask.escapeRegex.call(this, opts.radixPoint), ".")), 2192 processValue = processValue.replace(new RegExp("^" + Inputmask.escapeRegex(opts.negationSymbol.front)), "-"), 2193 processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""), 2194 Number(processValue)) : processValue; 2195 }, 2196 isComplete: function isComplete(buffer, opts) { 2197 var maskedValue = (opts.numericInput ? buffer.slice().reverse() : buffer).join(""); 2198 return maskedValue = maskedValue.replace(new RegExp("^" + Inputmask.escapeRegex(opts.negationSymbol.front)), "-"), 2199 maskedValue = maskedValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""), 2200 maskedValue = maskedValue.replace(opts.prefix, ""), maskedValue = maskedValue.replace(opts.suffix, ""), 2201 maskedValue = maskedValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator) + "([0-9]{3})", "g"), "$1"), 2202 "," === opts.radixPoint && (maskedValue = maskedValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".")), 2203 isFinite(maskedValue); 2204 }, 2205 onBeforeMask: function onBeforeMask(initialValue, opts) { 2206 var radixPoint = opts.radixPoint || ","; 2207 "number" != typeof initialValue && "number" !== opts.inputType || "" === radixPoint || (initialValue = initialValue.toString().replace(".", radixPoint)); 2208 var valueParts = initialValue.split(radixPoint), integerPart = valueParts[0].replace(/[^\-0-9]/g, ""), decimalPart = 1 < valueParts.length ? valueParts[1].replace(/[^0-9]/g, "") : ""; 2209 initialValue = integerPart + ("" !== decimalPart ? radixPoint + decimalPart : decimalPart); 2210 var digits = 0; 2211 if ("" !== radixPoint && (digits = decimalPart.length, ""
2211!== decimalPart)) { 2212 var digitsFactor = Math.pow(10, digits || 1); 2213 isFinite(opts.digits) && (digits = parseInt(opts.digits), digitsFactor = Math.pow(10, digits)), 2214 initialValue = initialValue.replace(Inputmask.escapeRegex(radixPoint), "."), isFinite(initialValue) && (initialValue = Math.round(parseFloat(initialValue) * digitsFactor) / digitsFactor), 2215 initialValue = initialValue.toString().replace(".", radixPoint); 2216 } 2217 return 0 === opts.digits && -1 !== initialValue.indexOf(Inputmask.escapeRegex(radixPoint)) && (initialValue = initialValue.substring(0, initialValue.indexOf(Inputmask.escapeRegex(radixPoint)))), 2218 alignDigits(initialValue.toString().split(""), digits, opts).join(""); 2219 }, 2220 onKeyDown: function onKeyDown(e, buffer, caretPos, opts) { 2221 var $input = $(this); 2222 if (e.ctrlKey) switch (e.keyCode) { 2223 case Inputmask.keyCode.UP: 2224 return $input.val(parseFloat(this.inputmask.unmaskedvalue()) + parseInt(opts.step)), 2225 $input.trigger("setvalue"), !1; 2226 2227 case Inputmask.keyCode.DOWN: 2228 return $input.val(parseFloat(this.inputmask.unmaskedvalue()) - parseInt(opts.step)), 2229 $input.trigger("setvalue"), !1; 2230 } 2231 } 2232 }, 2233 currency: { 2234 prefix: "$ ", 2235 groupSeparator: ",", 2236 alias: "numeric", 2237 placeholder: "0", 2238 digits: 2, 2239 digitsOptional: !1 2240 }, 2241 decimal: { 2242 alias: "numeric" 2243 }, 2244 integer: { 2245 alias: "numeric", 2246 digits: 0 2247 }, 2248 percentage: { 2249 alias: "integer", 2250 min: 0, 2251 max: 100, 2252 suffix: " %", 2253 allowMinus: !1 2254 }, 2255 indianns: { 2256 alias: "numeric", 2257 _mask: function _mask(opts) { 2258 return "(" + opts.groupSeparator + "99){*|1}(" + opts.groupSeparator + "999){1|1}"; 2259 }, 2260 groupSeparator: ",", 2261 radixPoint: ".", 2262 placeholder: "0", 2263 digits: 2, 2264 digitsOptional: !1 2265 } 2266 }), module.exports = Inputmask; 2267 }, function(module, exports, __webpack_require__) { 2268 function _typeof(obj) { 2269 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function _typeof(obj) { 2270 return typeof obj; 2271 } : function _typeof(obj) { 2272 return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 2273 }, _typeof(obj); 2274 } 2275 var $ = __webpack_require__(5), Inputmask = __webpack_require__(3); 2276 void 0 === $.fn.inputmask && ($.fn.inputmask = function(fn, options) { 2277 var nptmask, input = this[0]; 2278 if (void 0 === options && (options = {}), "string" == typeof fn) switch (fn) { 2279 case "unmaskedvalue": 2280 return input && input.inputmask ? input.inputmask.unmaskedvalue() : $(input).val(); 2281 2282 case "remove": 2283 return this.each(function() { 2284 this.inputmask && this.inputmask.remove(); 2285 }); 2286 2287 case "getemptymask": 2288 return input && input.inputmask ? input.inputmask.getemptymask() : ""; 2289 2290 case "hasMaskedValue": 2291 return !(!input || !input.inputmask) && input.inputmask.hasMaskedValue(); 2292 2293 case "isComplete": 2294 return !input || !input.inputmask || input.inputmask.isComplete(); 2295 2296 case "getmetadata": 2297 return input && input.inputmask ? input.inputmask.getmetadata() : void 0; 2298 2299 case "setvalue": 2300 Inputmask.setValue(input, options); 2301 break; 2302 2303 case "option": 2304 if ("string" != typeof options) return this.each(function() { 2305 if (void 0 !== this.inputmask) return this.inputmask.option(options); 2306 }); 2307 if (input && void 0 !== input.inputmask) return input.inputmask.option(options); 2308 break; 2309 2310 default: 2311 return options.alias = fn, nptmask = new Inputmask(options), this.each(function() { 2312 nptmask.mask(this); 2313 }); 2314 } else { 2315 if (Array.isArray(fn)) return options.alias = fn, nptmask = new Inputmask(options), 2316 this.each(function() { 2317 nptmask.mask(this); 2318 }); 2319 if ("object" == _typeof(fn)) return nptmask = new Inputmask(fn), void 0 === fn.mask && void 0 === fn.alias ? this.each(function() { 2320 if (void 0 !== this.inputmask) return this.inputmask.option(fn); 2321 nptmask.mask(this); 2322 }) : this.each(function() { 2323 nptmask.mask(this); 2324 }); 2325 if (void 0 === fn) return this.each(function() { 2326 nptmask = new Inputmask(options), nptmask.mask(this); 2327 }); 2328 } 2329 }); 2330 } ], installedModules = {}, __webpack_require__.m = modules, __webpack_require__.c = installedModules, 2331 __webpack_require__.d = function(exports, name, getter) { 2332 __webpack_require__.o(exports, name) || Object.defineProperty(exports, name, { 2333 enumerable: !0, 2334 get: getter 2335 }); 2336 }, __webpack_require__.r = function(exports) { 2337 "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports, Symbol.toStringTag, { 2338 value: "Module" 2339 }), Object.defineProperty(exports, "__esModule", { 2340 value: !0 2341 }); 2342 }, __webpack_require__.t = function(value, mode) { 2343 if (1 & mode && (value = __webpack_require__(value)), 8 & mode) return value; 2344 if (4 & mode && "object" == typeof value && value && value.__esMo
2344dule) return value; 2345 var ns = Object.create(null); 2346 if (__webpack_require__.r(ns), Object.defineProperty(ns, "default", { 2347 enumerable: !0, 2348 value: value 2349 }), 2 & mode && "string" != typeof value) for (var key in value) __webpack_require__.d(ns, key, function(key) { 2350 return value[key]; 2351 }.bind(null, key)); 2352 return ns; 2353 }, __webpack_require__.n = function(module) { 2354 var getter = module && module.__esModule ? function getDefault() { 2355 return module.default; 2356 } : function getModuleExports() { 2357 return module; 2358 }; 2359 return __webpack_require__.d(getter, "a", getter), getter; 2360 }, __webpack_require__.o = function(object, property) { 2361 return Object.prototype.hasOwnProperty.call(object, property); 2362 }, __webpack_require__.p = "", __webpack_require__(__webpack_require__.s = 0); 2363 function __webpack_require__(moduleId) { 2364 if (installedModules[moduleId]) return installedModules[moduleId].exports; 2365 var module = installedModules[moduleId] = { 2366 i: moduleId, 2367 l: !1, 2368 exports: {} 2369 }; 2370 return modules[moduleId].call(module.exports, module, module.exports, __webpack_require__), 2371 module.l = !0, module.exports; 2372 } 2373 var modules, installedModules; 2374}); 2375//# sourceMappingURL=jquery.inputmask.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.