jquery.inputmask.bundle.js 174 KB

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