jquery.inputmask.bundle.js 186 KB

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