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