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