jquery.inputmask.bundle.js 175 KB

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