inputmask
Version:
Inputmask is a javascript library which creates an input mask. Inputmask can run against vanilla javascript, jQuery and jqlite.
838 lines (831 loc) • 233 kB
JavaScript
/*!
* dist/jquery.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(require("jquery")); else if ("function" == typeof define && define.amd) define([ "jquery" ], t); else {
var n = "object" == typeof exports ? t(require("jquery")) : t(e.jQuery);
for (var i in n) ("object" == typeof exports ? exports : e)[i] = n[i];
}
}("undefined" != typeof self ? self : this, (function(e) {
return function() {
"use strict";
var t = {
3046: function(e, t, n) {
Object.defineProperty(t, "__esModule", {
value: !0
}), t.default = void 0, n(7149), n(3194), n(9302), n(4013), n(3851), n(219), n(207),
n(5296);
var i, a = (i = n(2394)) && i.__esModule ? i : {
default: i
};
t.default = a.default;
},
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]"
}
};
},
3287: function(e, t, n) {
Object.defineProperty(t, "__esModule", {
value: !0
}), t.default = void 0;
var i, a = (i = n(7957)) && i.__esModule ? i : {
default: i
};
if (void 0 === a.default) throw new Error("jQuery not loaded!");
t.default = a.default;
},
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
}, s = n(7760), l = 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 : {}, s = o.iterator || "@@iterator", l = 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), s = new D(i || []);
return r(o, "_invoke", {
value: E(e, n, s)
}), 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", m = "suspendedYield", v = "executing", g = "completed", y = {};
function k() {}
function b() {}
function x() {}
var w = {};
u(w, s, (function() {
return this;
}));
var P = Object.getPrototypeOf, S = P && P(P(L([])));
S && S !== n && a.call(S, s) && (w = S);
var O = x.prototype = k.prototype = Object.create(w);
function M(e) {
[ "next", "throw", "return" ].forEach((function(t) {
u(e, t, (function(e) {
return this._invoke(t, e);
}));
}));
}
function _(e, t) {
function n(r, o, s, l) {
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, s, l);
}), (function(e) {
n("throw", e, s, l);
})) : t.resolve(f).then((function(e) {
u.value = e, s(u);
}), (function(e) {
return n("throw", e, s, l);
}));
}
l(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 === v) 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 s = i.delegate;
if (s) {
var l = j(s, i);
if (l) {
if (l === y) continue;
return l;
}
}
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 = v;
var c = d(t, n, i);
if ("normal" === c.type) {
if (a = i.done ? g : m, 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[s];
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(_.prototype, l, (function() {
return this;
})), t.AsyncIterator = _, t.async = function(e, n, i, a, r) {
void 0 === r && (r = Promise);
var o = new _(f(e, n, i, a), r);
return t.isGeneratorFunction(n) ? o : o.next().then((function(e) {
return e.done ? e.value : o.next();
}));
}, M(O), u(O, c, "Generator"), u(O, s, (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 s.type = "throw", s.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], s = o.completion;
if ("root" === o.tryLoc) return i("end");
if (o.tryLoc <= this.prev) {
var l = a.call(o, "catchLoc"), c = a.call(o, "finallyLoc");
if (l && c) {
if (this.prev < o.catchLoc) return i(o.catchLoc, !0);
if (this.prev < o.finallyLoc) return i(o.finallyLoc);
} else if (l) {
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, s = !1;
return {
s: function() {
n = n.call(e);
},
n: function() {
var e = n.next();
return o = e.done, e;
},
e: function(e) {
s = !0, r = e;
},
f: function() {
try {
o || null == n.return || n.return();
} finally {
if (s) 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 m(e, t, n, i, a, r, o) {
try {
var s = e[r](o), l = s.value;
} catch (e) {
return void n(e);
}
s.done ? t(l) : Promise.resolve(l).then(i, a);
}
var v, g, y = t.EventHandlers = {
keyEvent: function(e, t, n, i, a) {
var o = this.inputmask, p = o.opts, d = o.dependencyLib, h = o.maskset, m = this, v = d(m), g = e.key, k = c.caret.call(o, m), b = p.onKeyDown.call(this, e, c.getBuffer.call(o), k, p);
if (void 0 !== b) return b;
if (g === l.keys.Backspace || g === l.keys.Delete || r.iphone && g === l.keys.BACKSPACE_SAFARI || e.ctrlKey && g === l.keys.x && !("oncut" in m)) e.preventDefault(),
u.handleRemove.call(o, m, g, k), (0, s.writeBuffer)(m, c.getBuffer.call(o, !0), h.p, e, m.inputmask._valueGet() !== c.getBuffer.call(o).join("")); else if (g === l.keys.End || g === l.keys.PageDown) {
e.preventDefault();
var x = c.seekNext.call(o, c.getLastValidPosition.call(o));
c.caret.call(o, m, e.shiftKey ? k.begin : x, x, !0);
} else g === l.keys.Home && !e.shiftKey || g === l.keys.PageUp ? (e.preventDefault(),
c.caret.call(o, m, 0, e.shiftKey ? k.begin : 0, !0)) : p.undoOnEscape && g === l.keys.Escape && !0 !== e.altKey ? ((0,
s.checkVal)(m, !0, !1, o.undoValue.split("")), v.trigger("click")) : g !== l.keys.Insert || e.shiftKey || e.ctrlKey || void 0 !== o.userOptions.insertMode ? !0 === p.tabThrough && g === l.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, m, 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, m, k.begin, k.end))) : e.shiftKey || (p.insertModeVisual && !1 === p.insertMode ? g === l.keys.ArrowRight ? setTimeout((function() {
var e = c.caret.call(o, m);
c.caret.call(o, m, e.begin);
}), 0) : g === l.keys.ArrowLeft && setTimeout((function() {
var e = c.translatePosition.call(o, m.inputmask.caretPos.begin);
c.translatePosition.call(o, m.inputmask.caretPos.end);
o.isRTL ? c.caret.call(o, m, e + (e === h.maskLength ? 0 : 1)) : c.caret.call(o, m, 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, m, k.begin, k.begin));
return o.isComposing = g == l.keys.Process || g == l.keys.Unidentified, o.ignorable = g.length > 1 && !("textarea" === m.tagName.toLowerCase() && g == l.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), m = e.key;
if (!0 === t || e.ctrlKey && e.altKey && !r.ignorable || !(e.ctrlKey || e.metaKey || r.ignorable)) {
if (m) {
var v, g = t ? {
begin: a,
end: a
} : c.caret.call(r, d);
t || (m = o.substitutes[m] || m), p.writeOutBuffer = !0;
var y = u.isValid.call(r, g, m, i, void 0, void 0, void 0, t);
if (!1 !== y && (c.resetMaskSet.call(r, !0), v = void 0 !== y.caret ? y.caret : c.seekNext.call(r, y.pos.begin ? y.pos.begin : y.pos),
p.p = v), v = o.numericInput && void 0 === y.caret ? c.seekPrevious.call(r, v) : v,
!1 !== n && (setTimeout((function() {
o.onKeyValidation.call(d, m, y);
}), 0), p.writeOutBuffer && !1 !== y)) {
var k = c.getBuffer.call(r);
(0, s.writeBuffer)(d, k, v, e, !0 !== t);
}
if (e.preventDefault(), t) return !1 !== y && (y.forwardPosition = v), y;
}
} else m === l.keys.Enter && r.undoValue !== r._valueGet(!0) && (r.undoValue = r._valueGet(!0),
setTimeout((function() {
h.trigger("change");
}), 0));
},
pasteEvent: (v = p().mark((function e(t) {
var n, i, a, r, l, u;
return p().wrap((function(e) {
for (;;) switch (e.prev = e.next) {
case 0:
n = function(e, n, i, a, o) {
var l = c.caret.call(e, n, void 0, void 0, !0), u = i.substr(0, l.begin), f = i.substr(l.end, i.length);
if (u == (e.isRTL ? c.getBufferTemplate.call(e).slice().reverse() : c.getBufferTemplate.call(e)).slice(0, l.begin).join("") && (u = ""),
f == (e.isRTL ? c.getBufferTemplate.call(e).slice().reverse() : c.getBufferTemplate.call(e)).slice(l.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 m = p.value;
a[0] === m && a.shift();
}
} catch (e) {
h.e(e);
} finally {
h.f();
}
a = a.reverse().join("");
}
var v = a;
if ("function" == typeof o) {
if (!1 === (v = o.call(e, v, r))) return !1;
v || (v = i);
}
(0, s.checkVal)(n, !0, !1, v.toString().split(""), t);
}, i = this, a = this.inputmask, r = a.opts, l = 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, l, 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 = v.apply(e, t);
function r(e) {
m(a, n, i, r, o, "next", e);
}
function o(e) {
m(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, s, l = 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 = l.length >= p.length ? l.length : p.length, m = u.length >= d.length ? u.length : d.length, v = "", g = [], y = "~"; l.length < h; ) l.push(y);
for (;p.length < h; ) p.push(y);
for (;u.length < m; ) u.unshift(y);
for (;d.length < m; ) d.unshift(y);
var k = l.concat(u), b = p.concat(d);
for (o = 0, r = k.length; o < r; o++) switch (s = f.getPlaceholder.call(t, c.translatePosition.call(t, o)),
v) {
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] !== s && void 0 !== k[o + 1] || (b[o] !== s || b[o + 1] !== y) && b[o] !== y ? b[o + 1] === y && b[o] === k[o + 1] ? (v = "insertText",
g.push(k[o]), a.begin--, a.end--) : k[o] !== s && k[o] !== y && (k[o + 1] === y || b[o] !== k[o] && b[o + 1] === k[o + 1]) ? (v = "insertReplacementText",
g.push(k[o]), a.begin--) : k[o] === y ? (v = "deleteContentBackward", (c.isMask.call(t, c.translatePosition.call(t, o), !0) || b[o] === n.radixPoint) && a.end++) : o = r : (v = "insertText",
g.push(k[o]), a.begin--, a.end--));
}
return {
action: v,
data: g,
caret: a
};
}(u, p, d), (o.inputmask.shadowRoot || o.ownerDocument).activeElement !== o && o.focus(),
(0, s.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 = l.keys.Backspace, y.keyEvent.call(o, h);
break;
default:
(0, s.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, s.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, s.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 !== n && (0,
s.HandleNativePlaceholder)(n, e.originalPlaceholder);
},
clickEvent: function(e, t) {
var n = this.inputmask;
n.clicked++;
var i = this;
if ((i.inputmask.shadowRoot || i.ownerDocument).activeElement === i) {
var a = c.determineNewCaretPosition.call(n, c.caret.call(n, i), t);
void 0 !== a && c.caret.call(n, i, a);
}
},
cutEvent: function(e) {
var t = this.inputmask, n = t.maskset, i = this, a = c.caret.call(t, i), r = t.isRTL ? c.getBuffer.call(t).slice(a.end, a.begin) : c.getBuffer.call(t).slice(a.begin, a.end), f = t.isRTL ? r.reverse().join("") : r.join("");
o.default.navigator && o.default.navigator.clipboard ? o.default.navigator.clipboard.writeText(f) : o.default.clipboardData && o.default.clipboardData.getData && o.default.clipboardData.setData("Text", f),
u.handleRemove.call(t, i, l.keys.Delete, a), (0, s.writeBuffer)(i, c.getBuffer.call(t), n.p, e, t.undoValue !== t._valueGet(!0));
},
blurEvent: function(e) {
var t = this.inputmask, n = t.opts, i = t.dependencyLib;
t.clicked = 0;
var a = i(this), r = this;
if (r.inputmask) {
(0, s.HandleNativePlaceholder)(r, t.originalPlaceholder);
var o = r.inputmask._valueGet(), l = c.getBuffer.call(t).slice();
"" !== o && (n.clearMaskOnLostFocus && (-1 === c.getLastValidPosition.call(t) && o === c.getBufferTemplate.call(t).join("") ? l = [] : s.clearOptionalTail.call(t, l)),
!1 === u.isComplete.call(t, l) && (setTimeout((function() {
a.trigger("incomplete");
}), 0), n.clearIncomplete && (c.resetMaskSet.call(t, !1), l = n.clearMaskOnLostFocus ? [] : c.getBufferTemplate.call(t).slice())),
(0, s.writeBuffer)(r, l, void 0, e)), o = t._valueGet(!0), t.undoValue !== o && ("" != o || t.undoValue != c.getBufferTemplate.call(t).join("") || t.undoValue == c.getBufferTemplate.call(t).join("") && t.maskset.validPositions.length > 0) && (t.undoValue = o,
a.trigger("change"));
}
},
mouseenterEvent: function() {
var e = this.inputmask, t = e.opts.showMaskOnHover, n = this;
if (e.mouseEnter = !0, (n.inputmask.shadowRoot || n.ownerDocument).activeElement !== n) {
var i = (e.isRTL ? c.getBufferTemplate.call(e).slice().reverse() : c.getBufferTemplate.call(e)).join("");
t && (0, s.HandleNativePlaceholder)(n, i);
}
},
submitEvent: function() {
var e = this.inputmask, t = e.opts;
e.undoValue !== e._valueGet(!0) && e.$el.trigger("change"), -1 === c.getLastValidPosition.call(e) && e._valueGet && e._valueGet() === c.getBufferTemplate.call(e).join("") && e._valueSet(""),
t.clearIncomplete && !1 === u.isComplete.call(e, c.getBuffer.call(e)) && e._valueSet(""),
t.removeMaskOnSubmit && (e._valueSet(e.unmaskedvalue(), !0), setTimeout((function() {
(0, s.writeBuffer)(e.el, c.getBuffer.call(e));
}), 0));
},
resetEvent: function() {
var e = this.inputmask;
e.refreshValue = !0, setTimeout((function() {
(0, s.applyInputValue)(e.el, e._valueGet(!0));
}), 0);
}
};
},
9716: function(e, t, n) {
Object.defineProperty(t, "__esModule", {
value: !0
}), t.EventRuler = void 0;
var i, a = n(7760), r = (i = n(2394)) && i.__esModule ? i : {
default: i
}, o = n(2839), s = n(8711);
t.EventRuler = {
on: function(e, t, n) {
var i = e.inputmask.dependencyLib, l = function(t) {
t.originalEvent && (t = t.originalEvent || t, arguments[0] = t);
var l, c = this, u = c.inputmask, f = u ? u.opts : void 0;
if (void 0 === u && "FORM" !== this.nodeName) {
var p = i.data(c, "_inputmask_opts");
i(c).off(), p && new r.default(p).mask(c);
} else {
if ([ "submit", "reset", "setvalue" ].includes(t.type) || "FORM" === this.nodeName || !(c.disabled || c.readOnly && !("keydown" === t.type && t.ctrlKey && t.key === o.keys.c || !1 === f.tabThrough && t.key === o.keys.Tab))) {
switch (t.type) {
case "input":
if (!0 === u.skipInputEvent) return u.skipInputEvent = !1, t.preventDefault();
break;
case "click":
case "focus":
return u.validationEvent ? (u.validationEvent = !1, e.blur(), (0, a.HandleNativePlaceholder)(e, (u.isRTL ? s.getBufferTemplate.call(u).slice().reverse() : s.getBufferTemplate.call(u)).join("")),
setTimeout((function() {
e.focus();
}), f.validationEventTimeOut), !1) : (l = arguments, void setTimeout((function() {
e.inputmask && n.apply(c, l);
}), 0));
}
var d = n.apply(c, arguments);
return !1 === d && (t.preventDefault(), t.stopPropagation()), d;
}
t.preventDefault();
}
};
[ "submit", "reset" ].includes(t) ? (l = l.bind(e), null !== e.form && i(e.form).on(t, l)) : i(e).on(t, l),
e.inputmask.events[t] = e.inputmask.events[t] || [], e.inputmask.events[t].push(l);
},
off: function(e, t) {
if (e.inputmask && e.inputmask.events) {
var n = e.inputmask.dependencyLib, i = e.inputmask.events;
for (var a in t && ((i = [])[t] = e.inputmask.events[t]), i) {
for (var r = i[a]; r.length > 0; ) {
var o = r.pop();
[ "submit", "reset" ].includes(a) ? null !== e.form && n(e.form).off(a, o) : n(e).off(a, o);
}
delete e.inputmask.events[a];
}
}
}
};
},
219: function(e, t, n) {
var i = p(n(7184)), a = p(n(2394)), r = n(2839), o = n(8711), s = n(4713);
function l(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, s = [], l = !0, c = !1;
try {
if (r = (n = n.call(e)).next, 0 === t) {
if (Object(n) !== n) return;
l = !1;
} else for (;!(l = (i = r.call(n)).done) && (s.push(i.value), s.length !== t); l = !0) ;
} catch (e) {
c = !0, a = e;
} finally {
try {
if (!l && null != n.return && (o = n.return(), Object(o) !== o)) return;
} finally {
if (c) throw a;
}
}
return s;
}
}(e, t) || function(e, t) {
if (!e) return;
if ("string" == typeof e) return c(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 c(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 c(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];