jquery.inputmask.bundle.js 163 KB

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