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