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