jquery.inputmask.bundle.js 188 KB

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