UNPKG

inputmask

Version:

Inputmask is a javascript library which creates an input mask. Inputmask can run against vanilla javascript, jQuery and jqlite.

861 lines (856 loc) 240 kB
/*! * dist/inputmask * https://github.com/RobinHerbots/Inputmask * Copyright (c) 2010 - 2024 Robin Herbots * Licensed under the MIT license * Version: 5.0.9 */ !function(e, t) { if ("object" == typeof exports && "object" == typeof module) module.exports = t(); else if ("function" == typeof define && define.amd) define([], t); else { var n = t(); for (var i in n) ("object" == typeof exports ? exports : e)[i] = n[i]; } }("undefined" != typeof self ? self : this, (function() { return function() { "use strict"; var e = { 3976: function(e, t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.default = void 0; t.default = { _maxTestPos: 500, placeholder: "_", optionalmarker: [ "[", "]" ], quantifiermarker: [ "{", "}" ], groupmarker: [ "(", ")" ], alternatormarker: "|", escapeChar: "\\", mask: null, regex: null, oncomplete: function() {}, onincomplete: function() {}, oncleared: function() {}, repeat: 0, greedy: !1, autoUnmask: !1, removeMaskOnSubmit: !1, clearMaskOnLostFocus: !0, insertMode: !0, insertModeVisual: !0, clearIncomplete: !1, alias: null, onKeyDown: function() {}, onBeforeMask: null, onBeforePaste: function(e, t) { return "function" == typeof t.onBeforeMask ? t.onBeforeMask.call(this, e, t) : e; }, onBeforeWrite: null, onUnMask: null, showMaskOnFocus: !0, showMaskOnHover: !0, onKeyValidation: function() {}, skipOptionalPartCharacter: " ", numericInput: !1, rightAlign: !1, undoOnEscape: !0, radixPoint: "", _radixDance: !1, groupSeparator: "", keepStatic: null, positionCaretOnTab: !0, tabThrough: !1, supportsInputType: [ "text", "tel", "url", "password", "search" ], isComplete: null, preValidation: null, postValidation: null, staticDefinitionSymbol: void 0, jitMasking: !1, nullable: !0, inputEventOnly: !1, noValuePatching: !1, positionCaretOnClick: "lvp", casing: null, inputmode: "text", importDataAttributes: !0, shiftPositions: !0, usePrototypeDefinitions: !0, validationEventTimeOut: 3e3, substitutes: {} }; }, 7392: function(e, t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.default = void 0; t.default = { 9: { validator: "[0-9\uff10-\uff19]", definitionSymbol: "*" }, a: { validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]", definitionSymbol: "*" }, "*": { validator: "[0-9\uff10-\uff19A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]" } }; }, 253: function(e, t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.default = function(e, t, n) { if (void 0 === n) return e.__data ? e.__data[t] : null; e.__data = e.__data || {}, e.__data[t] = n; }; }, 3776: function(e, t, n) { Object.defineProperty(t, "__esModule", { value: !0 }), t.Event = void 0, t.off = function(e, t) { var n, i; u(this[0]) && e && (n = this[0].eventRegistry, i = this[0], e.split(" ").forEach((function(e) { var a = o(e.split("."), 2); (function(e, i) { var a, r, o = []; if (e.length > 0) if (void 0 === t) for (a = 0, r = n[e][i].length; a < r; a++) o.push({ ev: e, namespace: i && i.length > 0 ? i : "global", handler: n[e][i][a] }); else o.push({ ev: e, namespace: i && i.length > 0 ? i : "global", handler: t }); else if (i.length > 0) for (var l in n) for (var s in n[l]) if (s === i) if (void 0 === t) for (a = 0, r = n[l][s].length; a < r; a++) o.push({ ev: l, namespace: s, handler: n[l][s][a] }); else o.push({ ev: l, namespace: s, handler: t }); return o; })(a[0], a[1]).forEach((function(e) { var t = e.ev, a = e.handler; !function(e, t, a) { if (e in n == 1) if (i.removeEventListener ? i.removeEventListener(e, a, !1) : i.detachEvent && i.detachEvent("on".concat(e), a), "global" === t) for (var r in n[e]) n[e][r].splice(n[e][r].indexOf(a), 1); else n[e][t].splice(n[e][t].indexOf(a), 1); }(t, e.namespace, a); })); }))); return this; }, t.on = function(e, t) { if (u(this[0])) { var n = this[0].eventRegistry, i = this[0]; e.split(" ").forEach((function(e) { var a = o(e.split("."), 2), r = a[0], l = a[1]; !function(e, a) { i.addEventListener ? i.addEventListener(e, t, !1) : i.attachEvent && i.attachEvent("on".concat(e), t), n[e] = n[e] || {}, n[e][a] = n[e][a] || [], n[e][a].push(t); }(r, void 0 === l ? "global" : l); })); } return this; }, t.trigger = function(e) { var t = arguments; if (u(this[0])) for (var n = this[0].eventRegistry, i = this[0], o = "string" == typeof e ? e.split(" ") : [ e.type ], l = 0; l < o.length; l++) { var s = o[l].split("."), f = s[0], p = s[1] || "global"; if (void 0 !== c && "global" === p) { var d, h = { bubbles: !0, cancelable: !0, composed: !0, detail: arguments[1] }; if (c.createEvent) { try { if ("input" === f) h.inputType = "insertText", d = new InputEvent(f, h); else d = new CustomEvent(f, h); } catch (e) { (d = c.createEvent("CustomEvent")).initCustomEvent(f, h.bubbles, h.cancelable, h.detail); } e.type && (0, a.default)(d, e), i.dispatchEvent(d); } else (d = c.createEventObject()).eventType = f, d.detail = arguments[1], e.type && (0, a.default)(d, e), i.fireEvent("on" + d.eventType, d); } else if (void 0 !== n[f]) { arguments[0] = arguments[0].type ? arguments[0] : r.default.Event(arguments[0]), arguments[0].detail = arguments.slice(1); var v = n[f]; ("global" === p ? Object.values(v).flat() : v[p]).forEach((function(e) { return e.apply(i, t); })); } } return this; }; var i = s(n(9380)), a = s(n(600)), r = s(n(4963)); function o(e, t) { return function(e) { if (Array.isArray(e)) return e; }(e) || function(e, t) { var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"]; if (null != n) { var i, a, r, o, l = [], s = !0, c = !1; try { if (r = (n = n.call(e)).next, 0 === t) { if (Object(n) !== n) return; s = !1; } else for (;!(s = (i = r.call(n)).done) && (l.push(i.value), l.length !== t); s = !0) ; } catch (e) { c = !0, a = e; } finally { try { if (!s && null != n.return && (o = n.return(), Object(o) !== o)) return; } finally { if (c) throw a; } } return l; } }(e, t) || function(e, t) { if (!e) return; if ("string" == typeof e) return l(e, t); var n = Object.prototype.toString.call(e).slice(8, -1); "Object" === n && e.constructor && (n = e.constructor.name); if ("Map" === n || "Set" === n) return Array.from(e); if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return l(e, t); }(e, t) || function() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }(); } function l(e, t) { (null == t || t > e.length) && (t = e.length); for (var n = 0, i = new Array(t); n < t; n++) i[n] = e[n]; return i; } function s(e) { return e && e.__esModule ? e : { default: e }; } var c = i.default.document; function u(e) { return e instanceof Element; } var f = t.Event = void 0; "function" == typeof i.default.CustomEvent ? t.Event = f = i.default.CustomEvent : i.default.Event && c && c.createEvent ? (t.Event = f = function(e, t) { t = t || { bubbles: !1, cancelable: !1, composed: !0, detail: void 0 }; var n = c.createEvent("CustomEvent"); return n.initCustomEvent(e, t.bubbles, t.cancelable, t.detail), n; }, f.prototype = i.default.Event.prototype) : "undefined" != typeof Event && (t.Event = f = Event); }, 600: function(e, t) { function n(e) { return n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e; } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; }, n(e); } Object.defineProperty(t, "__esModule", { value: !0 }), t.default = function e() { var t, i, a, r, o, l, s = arguments[0] || {}, c = 1, u = arguments.length, f = !1; "boolean" == typeof s && (f = s, s = arguments[c] || {}, c++); "object" !== n(s) && "function" != typeof s && (s = {}); for (;c < u; c++) if (null != (t = arguments[c])) for (i in t) a = s[i], s !== (r = t[i]) && (f && r && ("[object Object]" === Object.prototype.toString.call(r) || (o = Array.isArray(r))) ? (o ? (o = !1, l = a && Array.isArray(a) ? a : []) : l = a && "[object Object]" === Object.prototype.toString.call(a) ? a : {}, s[i] = e(f, l, r)) : void 0 !== r && (s[i] = r)); return s; }; }, 4963: function(e, t, n) { Object.defineProperty(t, "__esModule", { value: !0 }), t.default = void 0; var i = l(n(9380)), a = l(n(253)), r = n(3776), o = l(n(600)); function l(e) { return e && e.__esModule ? e : { default: e }; } var s = i.default.document; function c(e) { return e instanceof c ? e : this instanceof c ? void (null != e && e !== i.default && (this[0] = e.nodeName ? e : void 0 !== e[0] && e[0].nodeName ? e[0] : s.querySelector(e), void 0 !== this[0] && null !== this[0] && (this[0].eventRegistry = this[0].eventRegistry || {}))) : new c(e); } c.prototype = { on: r.on, off: r.off, trigger: r.trigger }, c.extend = o.default, c.data = a.default, c.Event = r.Event; t.default = c; }, 9845: function(e, t, n) { Object.defineProperty(t, "__esModule", { value: !0 }), t.mobile = t.iphone = t.ie = void 0; var i, a = (i = n(9380)) && i.__esModule ? i : { default: i }; var r = a.default.navigator && a.default.navigator.userAgent || ""; t.ie = r.indexOf("MSIE ") > 0 || r.indexOf("Trident/") > 0, t.mobile = a.default.navigator && a.default.navigator.userAgentData && a.default.navigator.userAgentData.mobile || a.default.navigator && a.default.navigator.maxTouchPoints || "ontouchstart" in a.default, t.iphone = /iphone/i.test(r); }, 7184: function(e, t) { Object.defineProperty(t, "__esModule", { value: !0 }), t.default = function(e) { return e.replace(n, "\\$1"); }; var n = new RegExp("(\\" + [ "/", ".", "*", "+", "?", "|", "(", ")", "[", "]", "{", "}", "\\", "$", "^" ].join("|\\") + ")", "gim"); }, 6030: function(e, t, n) { function i(e) { return i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e; } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; }, i(e); } Object.defineProperty(t, "__esModule", { value: !0 }), t.EventHandlers = void 0; var a, r = n(9845), o = (a = n(9380)) && a.__esModule ? a : { default: a }, l = n(7760), s = n(2839), c = n(8711), u = n(7215), f = n(4713); function p() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ p = function() { return t; }; var e, t = {}, n = Object.prototype, a = n.hasOwnProperty, r = Object.defineProperty || function(e, t, n) { e[t] = n.value; }, o = "function" == typeof Symbol ? Symbol : {}, l = o.iterator || "@@iterator", s = o.asyncIterator || "@@asyncIterator", c = o.toStringTag || "@@toStringTag"; function u(e, t, n) { return Object.defineProperty(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0 }), e[t]; } try { u({}, ""); } catch (e) { u = function(e, t, n) { return e[t] = n; }; } function f(e, t, n, i) { var a = t && t.prototype instanceof k ? t : k, o = Object.create(a.prototype), l = new D(i || []); return r(o, "_invoke", { value: E(e, n, l) }), o; } function d(e, t, n) { try { return { type: "normal", arg: e.call(t, n) }; } catch (e) { return { type: "throw", arg: e }; } } t.wrap = f; var h = "suspendedStart", v = "suspendedYield", m = "executing", g = "completed", y = {}; function k() {} function b() {} function x() {} var w = {}; u(w, l, (function() { return this; })); var P = Object.getPrototypeOf, S = P && P(P(L([]))); S && S !== n && a.call(S, l) && (w = S); var O = x.prototype = k.prototype = Object.create(w); function _(e) { [ "next", "throw", "return" ].forEach((function(t) { u(e, t, (function(e) { return this._invoke(t, e); })); })); } function M(e, t) { function n(r, o, l, s) { var c = d(e[r], e, o); if ("throw" !== c.type) { var u = c.arg, f = u.value; return f && "object" == i(f) && a.call(f, "__await") ? t.resolve(f.__await).then((function(e) { n("next", e, l, s); }), (function(e) { n("throw", e, l, s); })) : t.resolve(f).then((function(e) { u.value = e, l(u); }), (function(e) { return n("throw", e, l, s); })); } s(c.arg); } var o; r(this, "_invoke", { value: function(e, i) { function a() { return new t((function(t, a) { n(e, i, t, a); })); } return o = o ? o.then(a, a) : a(); } }); } function E(t, n, i) { var a = h; return function(r, o) { if (a === m) throw new Error("Generator is already running"); if (a === g) { if ("throw" === r) throw o; return { value: e, done: !0 }; } for (i.method = r, i.arg = o; ;) { var l = i.delegate; if (l) { var s = j(l, i); if (s) { if (s === y) continue; return s; } } if ("next" === i.method) i.sent = i._sent = i.arg; else if ("throw" === i.method) { if (a === h) throw a = g, i.arg; i.dispatchException(i.arg); } else "return" === i.method && i.abrupt("return", i.arg); a = m; var c = d(t, n, i); if ("normal" === c.type) { if (a = i.done ? g : v, c.arg === y) continue; return { value: c.arg, done: i.done }; } "throw" === c.type && (a = g, i.method = "throw", i.arg = c.arg); } }; } function j(t, n) { var i = n.method, a = t.iterator[i]; if (a === e) return n.delegate = null, "throw" === i && t.iterator.return && (n.method = "return", n.arg = e, j(t, n), "throw" === n.method) || "return" !== i && (n.method = "throw", n.arg = new TypeError("The iterator does not provide a '" + i + "' method")), y; var r = d(a, t.iterator, n.arg); if ("throw" === r.type) return n.method = "throw", n.arg = r.arg, n.delegate = null, y; var o = r.arg; return o ? o.done ? (n[t.resultName] = o.value, n.next = t.nextLoc, "return" !== n.method && (n.method = "next", n.arg = e), n.delegate = null, y) : o : (n.method = "throw", n.arg = new TypeError("iterator result is not an object"), n.delegate = null, y); } function T(e) { var t = { tryLoc: e[0] }; 1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t); } function A(e) { var t = e.completion || {}; t.type = "normal", delete t.arg, e.completion = t; } function D(e) { this.tryEntries = [ { tryLoc: "root" } ], e.forEach(T, this), this.reset(!0); } function L(t) { if (t || "" === t) { var n = t[l]; if (n) return n.call(t); if ("function" == typeof t.next) return t; if (!isNaN(t.length)) { var r = -1, o = function n() { for (;++r < t.length; ) if (a.call(t, r)) return n.value = t[r], n.done = !1, n; return n.value = e, n.done = !0, n; }; return o.next = o; } } throw new TypeError(i(t) + " is not iterable"); } return b.prototype = x, r(O, "constructor", { value: x, configurable: !0 }), r(x, "constructor", { value: b, configurable: !0 }), b.displayName = u(x, c, "GeneratorFunction"), t.isGeneratorFunction = function(e) { var t = "function" == typeof e && e.constructor; return !!t && (t === b || "GeneratorFunction" === (t.displayName || t.name)); }, t.mark = function(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, x) : (e.__proto__ = x, u(e, c, "GeneratorFunction")), e.prototype = Object.create(O), e; }, t.awrap = function(e) { return { __await: e }; }, _(M.prototype), u(M.prototype, s, (function() { return this; })), t.AsyncIterator = M, t.async = function(e, n, i, a, r) { void 0 === r && (r = Promise); var o = new M(f(e, n, i, a), r); return t.isGeneratorFunction(n) ? o : o.next().then((function(e) { return e.done ? e.value : o.next(); })); }, _(O), u(O, c, "Generator"), u(O, l, (function() { return this; })), u(O, "toString", (function() { return "[object Generator]"; })), t.keys = function(e) { var t = Object(e), n = []; for (var i in t) n.push(i); return n.reverse(), function e() { for (;n.length; ) { var i = n.pop(); if (i in t) return e.value = i, e.done = !1, e; } return e.done = !0, e; }; }, t.values = L, D.prototype = { constructor: D, reset: function(t) { if (this.prev = 0, this.next = 0, this.sent = this._sent = e, this.done = !1, this.delegate = null, this.method = "next", this.arg = e, this.tryEntries.forEach(A), !t) for (var n in this) "t" === n.charAt(0) && a.call(this, n) && !isNaN(+n.slice(1)) && (this[n] = e); }, stop: function() { this.done = !0; var e = this.tryEntries[0].completion; if ("throw" === e.type) throw e.arg; return this.rval; }, dispatchException: function(t) { if (this.done) throw t; var n = this; function i(i, a) { return l.type = "throw", l.arg = t, n.next = i, a && (n.method = "next", n.arg = e), !!a; } for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r], l = o.completion; if ("root" === o.tryLoc) return i("end"); if (o.tryLoc <= this.prev) { var s = a.call(o, "catchLoc"), c = a.call(o, "finallyLoc"); if (s && c) { if (this.prev < o.catchLoc) return i(o.catchLoc, !0); if (this.prev < o.finallyLoc) return i(o.finallyLoc); } else if (s) { if (this.prev < o.catchLoc) return i(o.catchLoc, !0); } else { if (!c) throw new Error("try statement without catch or finally"); if (this.prev < o.finallyLoc) return i(o.finallyLoc); } } } }, abrupt: function(e, t) { for (var n = this.tryEntries.length - 1; n >= 0; --n) { var i = this.tryEntries[n]; if (i.tryLoc <= this.prev && a.call(i, "finallyLoc") && this.prev < i.finallyLoc) { var r = i; break; } } r && ("break" === e || "continue" === e) && r.tryLoc <= t && t <= r.finallyLoc && (r = null); var o = r ? r.completion : {}; return o.type = e, o.arg = t, r ? (this.method = "next", this.next = r.finallyLoc, y) : this.complete(o); }, complete: function(e, t) { if ("throw" === e.type) throw e.arg; return "break" === e.type || "continue" === e.type ? this.next = e.arg : "return" === e.type ? (this.rval = this.arg = e.arg, this.method = "return", this.next = "end") : "normal" === e.type && t && (this.next = t), y; }, finish: function(e) { for (var t = this.tryEntries.length - 1; t >= 0; --t) { var n = this.tryEntries[t]; if (n.finallyLoc === e) return this.complete(n.completion, n.afterLoc), A(n), y; } }, catch: function(e) { for (var t = this.tryEntries.length - 1; t >= 0; --t) { var n = this.tryEntries[t]; if (n.tryLoc === e) { var i = n.completion; if ("throw" === i.type) { var a = i.arg; A(n); } return a; } } throw new Error("illegal catch attempt"); }, delegateYield: function(t, n, i) { return this.delegate = { iterator: L(t), resultName: n, nextLoc: i }, "next" === this.method && (this.arg = e), y; } }, t; } function d(e, t) { var n = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"]; if (!n) { if (Array.isArray(e) || (n = function(e, t) { if (!e) return; if ("string" == typeof e) return h(e, t); var n = Object.prototype.toString.call(e).slice(8, -1); "Object" === n && e.constructor && (n = e.constructor.name); if ("Map" === n || "Set" === n) return Array.from(e); if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return h(e, t); }(e)) || t && e && "number" == typeof e.length) { n && (e = n); var i = 0, a = function() {}; return { s: a, n: function() { return i >= e.length ? { done: !0 } : { done: !1, value: e[i++] }; }, e: function(e) { throw e; }, f: a }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var r, o = !0, l = !1; return { s: function() { n = n.call(e); }, n: function() { var e = n.next(); return o = e.done, e; }, e: function(e) { l = !0, r = e; }, f: function() { try { o || null == n.return || n.return(); } finally { if (l) throw r; } } }; } function h(e, t) { (null == t || t > e.length) && (t = e.length); for (var n = 0, i = new Array(t); n < t; n++) i[n] = e[n]; return i; } function v(e, t, n, i, a, r, o) { try { var l = e[r](o), s = l.value; } catch (e) { return void n(e); } l.done ? t(s) : Promise.resolve(s).then(i, a); } var m, g, y = t.EventHandlers = { keyEvent: function(e, t, n, i, a) { var o = this.inputmask, p = o.opts, d = o.dependencyLib, h = o.maskset, v = this, m = d(v), g = e.key, k = c.caret.call(o, v), b = p.onKeyDown.call(this, e, c.getBuffer.call(o), k, p); if (void 0 !== b) return b; if (g === s.keys.Backspace || g === s.keys.Delete || r.iphone && g === s.keys.BACKSPACE_SAFARI || e.ctrlKey && g === s.keys.x && !("oncut" in v)) e.preventDefault(), u.handleRemove.call(o, v, g, k), (0, l.writeBuffer)(v, c.getBuffer.call(o, !0), h.p, e, v.inputmask._valueGet() !== c.getBuffer.call(o).join("")); else if (g === s.keys.End || g === s.keys.PageDown) { e.preventDefault(); var x = c.seekNext.call(o, c.getLastValidPosition.call(o)); c.caret.call(o, v, e.shiftKey ? k.begin : x, x, !0); } else g === s.keys.Home && !e.shiftKey || g === s.keys.PageUp ? (e.preventDefault(), c.caret.call(o, v, 0, e.shiftKey ? k.begin : 0, !0)) : p.undoOnEscape && g === s.keys.Escape && !0 !== e.altKey ? ((0, l.checkVal)(v, !0, !1, o.undoValue.split("")), m.trigger("click")) : g !== s.keys.Insert || e.shiftKey || e.ctrlKey || void 0 !== o.userOptions.insertMode ? !0 === p.tabThrough && g === s.keys.Tab ? !0 === e.shiftKey ? (k.end = c.seekPrevious.call(o, k.end, !0), !0 === f.getTest.call(o, k.end - 1).match.static && k.end--, k.begin = c.seekPrevious.call(o, k.end, !0), k.begin >= 0 && k.end > 0 && (e.preventDefault(), c.caret.call(o, v, k.begin, k.end))) : (k.begin = c.seekNext.call(o, k.begin, !0), k.end = c.seekNext.call(o, k.begin, !0), k.end < h.maskLength && k.end--, k.begin <= h.maskLength && (e.preventDefault(), c.caret.call(o, v, k.begin, k.end))) : e.shiftKey || (p.insertModeVisual && !1 === p.insertMode ? g === s.keys.ArrowRight ? setTimeout((function() { var e = c.caret.call(o, v); c.caret.call(o, v, e.begin); }), 0) : g === s.keys.ArrowLeft && setTimeout((function() { var e = c.translatePosition.call(o, v.inputmask.caretPos.begin); c.translatePosition.call(o, v.inputmask.caretPos.end); o.isRTL ? c.caret.call(o, v, e + (e === h.maskLength ? 0 : 1)) : c.caret.call(o, v, e - (0 === e ? 0 : 1)); }), 0) : void 0 === o.keyEventHook || o.keyEventHook(e)) : u.isSelection.call(o, k) ? p.insertMode = !p.insertMode : (p.insertMode = !p.insertMode, c.caret.call(o, v, k.begin, k.begin)); return o.isComposing = g == s.keys.Process || g == s.keys.Unidentified, o.ignorable = g.length > 1 && !("textarea" === v.tagName.toLowerCase() && g == s.keys.Enter), y.keypressEvent.call(this, e, t, n, i, a); }, keypressEvent: function(e, t, n, i, a) { var r = this.inputmask || this, o = r.opts, f = r.dependencyLib, p = r.maskset, d = r.el, h = f(d), v = e.key; if (!0 === t || e.ctrlKey && e.altKey && !r.ignorable || !(e.ctrlKey || e.metaKey || r.ignorable)) { if (v) { var m, g = t ? { begin: a, end: a } : c.caret.call(r, d); t || (v = o.substitutes[v] || v), p.writeOutBuffer = !0; var y = u.isValid.call(r, g, v, i, void 0, void 0, void 0, t); if (!1 !== y && (c.resetMaskSet.call(r, !0), m = void 0 !== y.caret ? y.caret : c.seekNext.call(r, y.pos.begin ? y.pos.begin : y.pos), p.p = m), m = o.numericInput && void 0 === y.caret ? c.seekPrevious.call(r, m) : m, !1 !== n && (setTimeout((function() { o.onKeyValidation.call(d, v, y); }), 0), p.writeOutBuffer && !1 !== y)) { var k = c.getBuffer.call(r); (0, l.writeBuffer)(d, k, m, e, !0 !== t); } if (e.preventDefault(), t) return !1 !== y && (y.forwardPosition = m), y; } } else v === s.keys.Enter && r.undoValue !== r._valueGet(!0) && (r.undoValue = r._valueGet(!0), setTimeout((function() { h.trigger("change"); }), 0)); }, pasteEvent: (m = p().mark((function e(t) { var n, i, a, r, s, u; return p().wrap((function(e) { for (;;) switch (e.prev = e.next) { case 0: n = function(e, n, i, a, o) { var s = c.caret.call(e, n, void 0, void 0, !0), u = i.substr(0, s.begin), f = i.substr(s.end, i.length); if (u == (e.isRTL ? c.getBufferTemplate.call(e).slice().reverse() : c.getBufferTemplate.call(e)).slice(0, s.begin).join("") && (u = ""), f == (e.isRTL ? c.getBufferTemplate.call(e).slice().reverse() : c.getBufferTemplate.call(e)).slice(s.end).join("") && (f = ""), a = u + a + f, e.isRTL && !0 !== r.numericInput) { a = a.split(""); var p, h = d(c.getBufferTemplate.call(e)); try { for (h.s(); !(p = h.n()).done; ) { var v = p.value; a[0] === v && a.shift(); } } catch (e) { h.e(e); } finally { h.f(); } a = a.reverse().join(""); } var m = a; if ("function" == typeof o) { if (!1 === (m = o.call(e, m, r))) return !1; m || (m = i); } (0, l.checkVal)(n, !0, !1, m.toString().split(""), t); }, i = this, a = this.inputmask, r = a.opts, s = a._valueGet(!0), a.skipInputEvent = !0, t.clipboardData && t.clipboardData.getData ? u = t.clipboardData.getData("text/plain") : o.default.clipboardData && o.default.clipboardData.getData && (u = o.default.clipboardData.getData("Text")), n(a, i, s, u, r.onBeforePaste), t.preventDefault(); case 7: case "end": return e.stop(); } }), e, this); })), g = function() { var e = this, t = arguments; return new Promise((function(n, i) { var a = m.apply(e, t); function r(e) { v(a, n, i, r, o, "next", e); } function o(e) { v(a, n, i, r, o, "throw", e); } r(void 0); })); }, function(e) { return g.apply(this, arguments); }), inputFallBackEvent: function(e) { var t = this.inputmask, n = t.opts, i = t.dependencyLib; var a, o = this, u = o.inputmask._valueGet(!0), p = (t.isRTL ? c.getBuffer.call(t).slice().reverse() : c.getBuffer.call(t)).join(""), d = c.caret.call(t, o, void 0, void 0, !0); if (p !== u) { if (a = function(e, i, a) { for (var r, o, l, s = e.substr(0, a.begin).split(""), u = e.substr(a.begin).split(""), p = i.substr(0, a.begin).split(""), d = i.substr(a.begin).split(""), h = s.length >= p.length ? s.length : p.length, v = u.length >= d.length ? u.length : d.length, m = "", g = [], y = "~"; s.length < h; ) s.push(y); for (;p.length < h; ) p.push(y); for (;u.length < v; ) u.unshift(y); for (;d.length < v; ) d.unshift(y); var k = s.concat(u), b = p.concat(d); for (o = 0, r = k.length; o < r; o++) switch (l = f.getPlaceholder.call(t, c.translatePosition.call(t, o)), m) { case "insertText": b[o - 1] === k[o] && a.begin == k.length - 1 && g.push(k[o]), o = r; break; case "insertReplacementText": case "deleteContentBackward": k[o] === y ? a.end++ : o = r; break; default: k[o] !== b[o] && (k[o + 1] !== y && k[o + 1] !== l && void 0 !== k[o + 1] || (b[o] !== l || b[o + 1] !== y) && b[o] !== y ? b[o + 1] === y && b[o] === k[o + 1] ? (m = "insertText", g.push(k[o]), a.begin--, a.end--) : k[o] !== l && k[o] !== y && (k[o + 1] === y || b[o] !== k[o] && b[o + 1] === k[o + 1]) ? (m = "insertReplacementText", g.push(k[o]), a.begin--) : k[o] === y ? (m = "deleteContentBackward", (c.isMask.call(t, c.translatePosition.call(t, o), !0) || b[o] === n.radixPoint) && a.end++) : o = r : (m = "insertText", g.push(k[o]), a.begin--, a.end--)); } return { action: m, data: g, caret: a }; }(u, p, d), (o.inputmask.shadowRoot || o.ownerDocument).activeElement !== o && o.focus(), (0, l.writeBuffer)(o, c.getBuffer.call(t)), c.caret.call(t, o, d.begin, d.end, !0), !r.mobile && t.skipNextInsert && "insertText" === e.inputType && "insertText" === a.action && t.isComposing) return !1; switch ("insertCompositionText" === e.inputType && "insertText" === a.action && t.isComposing ? t.skipNextInsert = !0 : t.skipNextInsert = !1, a.action) { case "insertText": case "insertReplacementText": a.data.forEach((function(e, n) { var a = new i.Event("keypress"); a.key = e, t.ignorable = !1, y.keypressEvent.call(o, a); })), setTimeout((function() { t.$el.trigger("keyup"); }), 0); break; case "deleteContentBackward": var h = new i.Event("keydown"); h.key = s.keys.Backspace, y.keyEvent.call(o, h); break; default: (0, l.applyInputValue)(o, u), c.caret.call(t, o, d.begin, d.end, !0); } e.preventDefault(); } }, setValueEvent: function(e) { var t = this.inputmask, n = t.dependencyLib, i = this, a = e && e.detail ? e.detail[0] : arguments[1]; void 0 === a && (a = i.inputmask._valueGet(!0)), (0, l.applyInputValue)(i, a, new n.Event("input")), (e.detail && void 0 !== e.detail[1] || void 0 !== arguments[2]) && c.caret.call(t, i, e.detail ? e.detail[1] : arguments[2]); }, focusEvent: function(e) { var t = this.inputmask, n = t.opts, i = t && t._valueGet(); n.showMaskOnFocus && i !== c.getBuffer.call(t).join("") && (0, l.writeBuffer)(this, c.getBuffer.call(t), c.seekNext.call(t, c.getLastValidPosition.call(t))), !0 !== n.positionCaretOnTab || !1 !== t.mouseEnter || u.isComplete.call(t, c.getBuffer.call(t)) && -1 !== c.getLastValidPosition.call(t) || y.clickEvent.apply(this, [ e, !0 ]), t.undoValue = t && t._valueGet(!0); }, invalidEvent: function(e) { this.inputmask.validationEvent = !0; }, mouseleaveEvent: function() { var e = this.inputmask, t = e.opts, n = this; e.mouseEnter = !1, t.clearMaskOnLostFocus && (n.inputmask.shadowRoot || n.ownerDocument).activeElement