jquery.inputmask.bundle.js
8101 lines
| 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.3 |
| 7 | */ |
| 8 | !(function webpackUniversalModuleDefinition(root, factory) { |
| 9 | if ("object" == typeof exports && "object" == typeof module) |
| 10 | module.exports = factory(require("jquery")); |
| 11 | else if ("function" == typeof define && define.amd) |
| 12 | define(["jquery"], factory); |
| 13 | else { |
| 14 | var a = |
| 15 | "object" == typeof exports |
| 16 | ? factory(require("jquery")) |
| 17 | : factory(root.jQuery); |
| 18 | for (var i in a) |
| 19 | ("object" == typeof exports ? exports : root)[i] = a[i]; |
| 20 | } |
| 21 | })(window, function (__WEBPACK_EXTERNAL_MODULE__3__) { |
| 22 | return ( |
| 23 | (modules = [ |
| 24 | function (module) { |
| 25 | module.exports = JSON.parse( |
| 26 | '{"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}' |
| 27 | ); |
| 28 | }, |
| 29 | function (module, exports, __webpack_require__) { |
| 30 | "use strict"; |
| 31 | function _typeof(obj) { |
| 32 | return ( |
| 33 | (_typeof = |
| 34 | "function" == typeof Symbol && |
| 35 | "symbol" == typeof Symbol.iterator |
| 36 | ? function _typeof(obj) { |
| 37 | return typeof obj; |
| 38 | } |
| 39 | : function _typeof(obj) { |
| 40 | return obj && |
| 41 | "function" == typeof Symbol && |
| 42 | obj.constructor === Symbol && |
| 43 | obj !== Symbol.prototype |
| 44 | ? "symbol" |
| 45 | : typeof obj; |
| 46 | }), |
| 47 | _typeof(obj) |
| 48 | ); |
| 49 | } |
| 50 | var $ = __webpack_require__(2), |
| 51 | window = __webpack_require__(4), |
| 52 | document = window.document, |
| 53 | generateMaskSet = __webpack_require__(5).generateMaskSet, |
| 54 | analyseMask = __webpack_require__(5).analyseMask, |
| 55 | maskScope = __webpack_require__(8); |
| 56 | function Inputmask(alias, options, internal) { |
| 57 | if (!(this instanceof Inputmask)) |
| 58 | return new Inputmask(alias, options, internal); |
| 59 | (this.el = void 0), |
| 60 | (this.events = {}), |
| 61 | (this.maskset = void 0), |
| 62 | (this.refreshValue = !1), |
| 63 | !0 !== internal && |
| 64 | ($.isPlainObject(alias) |
| 65 | ? (options = alias) |
| 66 | : ((options = options || {}), |
| 67 | alias && (options.alias = alias)), |
| 68 | (this.opts = $.extend( |
| 69 | !0, |
| 70 | {}, |
| 71 | this.defaults, |
| 72 | options |
| 73 | )), |
| 74 | (this.noMasksCache = |
| 75 | options && void 0 !== options.definitions), |
| 76 | (this.userOptions = options || {}), |
| 77 | resolveAlias(this.opts.alias, options, this.opts), |
| 78 | (this.isRTL = this.opts.numericInput)); |
| 79 | } |
| 80 | function resolveAlias(aliasStr, options, opts) { |
| 81 | var aliasDefinition = Inputmask.prototype.aliases[aliasStr]; |
| 82 | return aliasDefinition |
| 83 | ? (aliasDefinition.alias && |
| 84 | resolveAlias( |
| 85 | aliasDefinition.alias, |
| 86 | void 0, |
| 87 | opts |
| 88 | ), |
| 89 | $.extend(!0, opts, aliasDefinition), |
| 90 | $.extend(!0, opts, options), |
| 91 | !0) |
| 92 | : (null === opts.mask && (opts.mask = aliasStr), !1); |
| 93 | } |
| 94 | function importAttributeOptions( |
| 95 | npt, |
| 96 | opts, |
| 97 | userOptions, |
| 98 | dataAttribute |
| 99 | ) { |
| 100 | function importOption(option, optionData) { |
| 101 | (optionData = |
| 102 | void 0 !== optionData |
| 103 | ? optionData |
| 104 | : npt.getAttribute( |
| 105 | dataAttribute + "-" + option |
| 106 | )), |
| 107 | null !== optionData && |
| 108 | ("string" == typeof optionData && |
| 109 | (0 === option.indexOf("on") |
| 110 | ? (optionData = window[optionData]) |
| 111 | : "false" === optionData |
| 112 | ? (optionData = !1) |
| 113 | : "true" === optionData && |
| 114 | (optionData = !0)), |
| 115 | (userOptions[option] = optionData)); |
| 116 | } |
| 117 | if (!0 === opts.importDataAttributes) { |
| 118 | var attrOptions = npt.getAttribute(dataAttribute), |
| 119 | option, |
| 120 | dataoptions, |
| 121 | optionData, |
| 122 | p; |
| 123 | if ( |
| 124 | (attrOptions && |
| 125 | "" !== attrOptions && |
| 126 | ((attrOptions = attrOptions.replace(/'/g, '"')), |
| 127 | (dataoptions = JSON.parse( |
| 128 | "{" + attrOptions + "}" |
| 129 | ))), |
| 130 | dataoptions) |
| 131 | ) |
| 132 | for (p in ((optionData = void 0), dataoptions)) |
| 133 | if ("alias" === p.toLowerCase()) { |
| 134 | optionData = dataoptions[p]; |
| 135 | break; |
| 136 | } |
| 137 | for (option in (importOption("alias", optionData), |
| 138 | userOptions.alias && |
| 139 | resolveAlias(userOptions.alias, userOptions, opts), |
| 140 | opts)) { |
| 141 | if (dataoptions) |
| 142 | for (p in ((optionData = void 0), dataoptions)) |
| 143 | if ( |
| 144 | p.toLowerCase() === option.toLowerCase() |
| 145 | ) { |
| 146 | optionData = dataoptions[p]; |
| 147 | break; |
| 148 | } |
| 149 | importOption(option, optionData); |
| 150 | } |
| 151 | } |
| 152 | return ( |
| 153 | $.extend(!0, opts, userOptions), |
| 154 | ("rtl" !== npt.dir && !opts.rightAlign) || |
| 155 | (npt.style.textAlign = "right"), |
| 156 | ("rtl" !== npt.dir && !opts.numericInput) || |
| 157 | ((npt.dir = "ltr"), |
| 158 | npt.removeAttribute("dir"), |
| 159 | (opts.isRTL = !0)), |
| 160 | Object.keys(userOptions).length |
| 161 | ); |
| 162 | } |
| 163 | (Inputmask.prototype = { |
| 164 | dataAttribute: "data-inputmask", |
| 165 | defaults: { |
| 166 | _maxTestPos: 500, |
| 167 | placeholder: "_", |
| 168 | optionalmarker: ["[", "]"], |
| 169 | quantifiermarker: ["{", "}"], |
| 170 | groupmarker: ["(", ")"], |
| 171 | alternatormarker: "|", |
| 172 | escapeChar: "\\", |
| 173 | mask: null, |
| 174 | regex: null, |
| 175 | oncomplete: $.noop, |
| 176 | onincomplete: $.noop, |
| 177 | oncleared: $.noop, |
| 178 | repeat: 0, |
| 179 | greedy: !1, |
| 180 | autoUnmask: !1, |
| 181 | removeMaskOnSubmit: !1, |
| 182 | clearMaskOnLostFocus: !0, |
| 183 | insertMode: !0, |
| 184 | insertModeVisual: !0, |
| 185 | clearIncomplete: !1, |
| 186 | alias: null, |
| 187 | onKeyDown: $.noop, |
| 188 | onBeforeMask: null, |
| 189 | onBeforePaste: function onBeforePaste( |
| 190 | pastedValue, |
| 191 | opts |
| 192 | ) { |
| 193 | return $.isFunction(opts.onBeforeMask) |
| 194 | ? opts.onBeforeMask.call( |
| 195 | this, |
| 196 | pastedValue, |
| 197 | opts |
| 198 | ) |
| 199 | : pastedValue; |
| 200 | }, |
| 201 | onBeforeWrite: null, |
| 202 | onUnMask: null, |
| 203 | showMaskOnFocus: !0, |
| 204 | showMaskOnHover: !0, |
| 205 | onKeyValidation: $.noop, |
| 206 | skipOptionalPartCharacter: " ", |
| 207 | numericInput: !1, |
| 208 | rightAlign: !1, |
| 209 | undoOnEscape: !0, |
| 210 | radixPoint: "", |
| 211 | _radixDance: !1, |
| 212 | groupSeparator: "", |
| 213 | keepStatic: null, |
| 214 | positionCaretOnTab: !0, |
| 215 | tabThrough: !1, |
| 216 | supportsInputType: [ |
| 217 | "text", |
| 218 | "tel", |
| 219 | "url", |
| 220 | "password", |
| 221 | "search", |
| 222 | ], |
| 223 | ignorables: [ |
| 224 | 8, 9, 19, 27, 33, 34, 35, 36, 37, 38, 39, 40, 45, |
| 225 | 46, 93, 112, 113, 114, 115, 116, 117, 118, 119, 120, |
| 226 | 121, 122, 123, 0, 229, |
| 227 | ], |
| 228 | isComplete: null, |
| 229 | preValidation: null, |
| 230 | postValidation: null, |
| 231 | staticDefinitionSymbol: void 0, |
| 232 | jitMasking: !1, |
| 233 | nullable: !0, |
| 234 | inputEventOnly: !1, |
| 235 | noValuePatching: !1, |
| 236 | positionCaretOnClick: "lvp", |
| 237 | casing: null, |
| 238 | inputmode: "text", |
| 239 | importDataAttributes: !0, |
| 240 | shiftPositions: !0, |
| 241 | }, |
| 242 | definitions: { |
| 243 | 9: { |
| 244 | validator: "[0-9\uff11-\uff19]", |
| 245 | definitionSymbol: "*", |
| 246 | }, |
| 247 | a: { |
| 248 | validator: |
| 249 | "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]", |
| 250 | definitionSymbol: "*", |
| 251 | }, |
| 252 | "*": { |
| 253 | validator: |
| 254 | "[0-9\uff11-\uff19A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]", |
| 255 | }, |
| 256 | }, |
| 257 | aliases: {}, |
| 258 | masksCache: {}, |
| 259 | mask: function mask(elems) { |
| 260 | var that = this; |
| 261 | return ( |
| 262 | "string" == typeof elems && |
| 263 | (elems = |
| 264 | document.getElementById(elems) || |
| 265 | document.querySelectorAll(elems)), |
| 266 | (elems = elems.nodeName ? [elems] : elems), |
| 267 | $.each(elems, function (ndx, el) { |
| 268 | var scopedOpts = $.extend(!0, {}, that.opts); |
| 269 | if ( |
| 270 | importAttributeOptions( |
| 271 | el, |
| 272 | scopedOpts, |
| 273 | $.extend(!0, {}, that.userOptions), |
| 274 | that.dataAttribute |
| 275 | ) |
| 276 | ) { |
| 277 | var maskset = generateMaskSet( |
| 278 | scopedOpts, |
| 279 | that.noMasksCache |
| 280 | ); |
| 281 | void 0 !== maskset && |
| 282 | (void 0 !== el.inputmask && |
| 283 | ((el.inputmask.opts.autoUnmask = |
| 284 | !0), |
| 285 | el.inputmask.remove()), |
| 286 | (el.inputmask = new Inputmask( |
| 287 | void 0, |
| 288 | void 0, |
| 289 | !0 |
| 290 | )), |
| 291 | (el.inputmask.opts = scopedOpts), |
| 292 | (el.inputmask.noMasksCache = |
| 293 | that.noMasksCache), |
| 294 | (el.inputmask.userOptions = $.extend( |
| 295 | !0, |
| 296 | {}, |
| 297 | that.userOptions |
| 298 | )), |
| 299 | (el.inputmask.isRTL = |
| 300 | scopedOpts.isRTL || |
| 301 | scopedOpts.numericInput), |
| 302 | (el.inputmask.el = el), |
| 303 | (el.inputmask.maskset = maskset), |
| 304 | $.data( |
| 305 | el, |
| 306 | "_inputmask_opts", |
| 307 | scopedOpts |
| 308 | ), |
| 309 | maskScope.call(el.inputmask, { |
| 310 | action: "mask", |
| 311 | })); |
| 312 | } |
| 313 | }), |
| 314 | (elems && elems[0] && elems[0].inputmask) || this |
| 315 | ); |
| 316 | }, |
| 317 | option: function option(options, noremask) { |
| 318 | return "string" == typeof options |
| 319 | ? this.opts[options] |
| 320 | : "object" === _typeof(options) |
| 321 | ? ($.extend(this.userOptions, options), |
| 322 | this.el && !0 !== noremask && this.mask(this.el), |
| 323 | this) |
| 324 | : void 0; |
| 325 | }, |
| 326 | unmaskedvalue: function unmaskedvalue(value) { |
| 327 | return ( |
| 328 | (this.maskset = |
| 329 | this.maskset || |
| 330 | generateMaskSet(this.opts, this.noMasksCache)), |
| 331 | maskScope.call(this, { |
| 332 | action: "unmaskedvalue", |
| 333 | value: value, |
| 334 | }) |
| 335 | ); |
| 336 | }, |
| 337 | remove: function remove() { |
| 338 | return maskScope.call(this, { |
| 339 | action: "remove", |
| 340 | }); |
| 341 | }, |
| 342 | getemptymask: function getemptymask() { |
| 343 | return ( |
| 344 | (this.maskset = |
| 345 | this.maskset || |
| 346 | generateMaskSet(this.opts, this.noMasksCache)), |
| 347 | maskScope.call(this, { |
| 348 | action: "getemptymask", |
| 349 | }) |
| 350 | ); |
| 351 | }, |
| 352 | hasMaskedValue: function hasMaskedValue() { |
| 353 | return !this.opts.autoUnmask; |
| 354 | }, |
| 355 | isComplete: function isComplete() { |
| 356 | return ( |
| 357 | (this.maskset = |
| 358 | this.maskset || |
| 359 | generateMaskSet(this.opts, this.noMasksCache)), |
| 360 | maskScope.call(this, { |
| 361 | action: "isComplete", |
| 362 | }) |
| 363 | ); |
| 364 | }, |
| 365 | getmetadata: function getmetadata() { |
| 366 | return ( |
| 367 | (this.maskset = |
| 368 | this.maskset || |
| 369 | generateMaskSet(this.opts, this.noMasksCache)), |
| 370 | maskScope.call(this, { |
| 371 | action: "getmetadata", |
| 372 | }) |
| 373 | ); |
| 374 | }, |
| 375 | isValid: function isValid(value) { |
| 376 | return ( |
| 377 | (this.maskset = |
| 378 | this.maskset || |
| 379 | generateMaskSet(this.opts, this.noMasksCache)), |
| 380 | maskScope.call(this, { |
| 381 | action: "isValid", |
| 382 | value: value, |
| 383 | }) |
| 384 | ); |
| 385 | }, |
| 386 | format: function format(value, metadata) { |
| 387 | return ( |
| 388 | (this.maskset = |
| 389 | this.maskset || |
| 390 | generateMaskSet(this.opts, this.noMasksCache)), |
| 391 | maskScope.call(this, { |
| 392 | action: "format", |
| 393 | value: value, |
| 394 | metadata: metadata, |
| 395 | }) |
| 396 | ); |
| 397 | }, |
| 398 | setValue: function setValue(value) { |
| 399 | this.el && $(this.el).trigger("setvalue", [value]); |
| 400 | }, |
| 401 | analyseMask: analyseMask, |
| 402 | }), |
| 403 | (Inputmask.extendDefaults = function (options) { |
| 404 | $.extend(!0, Inputmask.prototype.defaults, options); |
| 405 | }), |
| 406 | (Inputmask.extendDefinitions = function (definition) { |
| 407 | $.extend( |
| 408 | !0, |
| 409 | Inputmask.prototype.definitions, |
| 410 | definition |
| 411 | ); |
| 412 | }), |
| 413 | (Inputmask.extendAliases = function (alias) { |
| 414 | $.extend(!0, Inputmask.prototype.aliases, alias); |
| 415 | }), |
| 416 | (Inputmask.format = function (value, options, metadata) { |
| 417 | return Inputmask(options).format(value, metadata); |
| 418 | }), |
| 419 | (Inputmask.unmask = function (value, options) { |
| 420 | return Inputmask(options).unmaskedvalue(value); |
| 421 | }), |
| 422 | (Inputmask.isValid = function (value, options) { |
| 423 | return Inputmask(options).isValid(value); |
| 424 | }), |
| 425 | (Inputmask.remove = function (elems) { |
| 426 | "string" == typeof elems && |
| 427 | (elems = |
| 428 | document.getElementById(elems) || |
| 429 | document.querySelectorAll(elems)), |
| 430 | (elems = elems.nodeName ? [elems] : elems), |
| 431 | $.each(elems, function (ndx, el) { |
| 432 | el.inputmask && el.inputmask.remove(); |
| 433 | }); |
| 434 | }), |
| 435 | (Inputmask.setValue = function (elems, value) { |
| 436 | "string" == typeof elems && |
| 437 | (elems = |
| 438 | document.getElementById(elems) || |
| 439 | document.querySelectorAll(elems)), |
| 440 | (elems = elems.nodeName ? [elems] : elems), |
| 441 | $.each(elems, function (ndx, el) { |
| 442 | el.inputmask |
| 443 | ? el.inputmask.setValue(value) |
| 444 | : $(el).trigger("setvalue", [value]); |
| 445 | }); |
| 446 | }); |
| 447 | var escapeRegexRegex = new RegExp( |
| 448 | "(\\" + |
| 449 | [ |
| 450 | "/", |
| 451 | ".", |
| 452 | "*", |
| 453 | "+", |
| 454 | "?", |
| 455 | "|", |
| 456 | "(", |
| 457 | ")", |
| 458 | "[", |
| 459 | "]", |
| 460 | "{", |
| 461 | "}", |
| 462 | "\\", |
| 463 | "$", |
| 464 | "^", |
| 465 | ].join("|\\") + |
| 466 | ")", |
| 467 | "gim" |
| 468 | ); |
| 469 | (Inputmask.escapeRegex = function (str) { |
| 470 | return str.replace(escapeRegexRegex, "\\$1"); |
| 471 | }), |
| 472 | (Inputmask.dependencyLib = $), |
| 473 | (window.Inputmask = Inputmask), |
| 474 | (module.exports = Inputmask); |
| 475 | }, |
| 476 | function (module, exports, __webpack_require__) { |
| 477 | "use strict"; |
| 478 | var jquery = __webpack_require__(3); |
| 479 | if (void 0 === jquery) throw "jQuery not loaded!"; |
| 480 | module.exports = jquery; |
| 481 | }, |
| 482 | function (module, exports) { |
| 483 | module.exports = __WEBPACK_EXTERNAL_MODULE__3__; |
| 484 | }, |
| 485 | function (module, exports, __webpack_require__) { |
| 486 | "use strict"; |
| 487 | var __WEBPACK_AMD_DEFINE_RESULT__; |
| 488 | function _typeof(obj) { |
| 489 | return ( |
| 490 | (_typeof = |
| 491 | "function" == typeof Symbol && |
| 492 | "symbol" == typeof Symbol.iterator |
| 493 | ? function _typeof(obj) { |
| 494 | return typeof obj; |
| 495 | } |
| 496 | : function _typeof(obj) { |
| 497 | return obj && |
| 498 | "function" == typeof Symbol && |
| 499 | obj.constructor === Symbol && |
| 500 | obj !== Symbol.prototype |
| 501 | ? "symbol" |
| 502 | : typeof obj; |
| 503 | }), |
| 504 | _typeof(obj) |
| 505 | ); |
| 506 | } |
| 507 | (__WEBPACK_AMD_DEFINE_RESULT__ = function () { |
| 508 | return "undefined" != typeof window |
| 509 | ? window |
| 510 | : new (eval("require('jsdom').JSDOM"))("").window; |
| 511 | }.call(exports, __webpack_require__, exports, module)), |
| 512 | void 0 === __WEBPACK_AMD_DEFINE_RESULT__ || |
| 513 | (module.exports = __WEBPACK_AMD_DEFINE_RESULT__); |
| 514 | }, |
| 515 | function (module, exports, __webpack_require__) { |
| 516 | "use strict"; |
| 517 | var $ = __webpack_require__(2); |
| 518 | function generateMaskSet(opts, nocache) { |
| 519 | var ms; |
| 520 | function generateMask(mask, metadata, opts) { |
| 521 | var regexMask = !1, |
| 522 | masksetDefinition, |
| 523 | maskdefKey; |
| 524 | if ( |
| 525 | ((null !== mask && "" !== mask) || |
| 526 | ((regexMask = null !== opts.regex), |
| 527 | (mask = regexMask |
| 528 | ? ((mask = opts.regex), |
| 529 | mask.replace(/^(\^)(.*)(\$)$/, "$2")) |
| 530 | : ((regexMask = !0), ".*"))), |
| 531 | 1 === mask.length && |
| 532 | !1 === opts.greedy && |
| 533 | 0 !== opts.repeat && |
| 534 | (opts.placeholder = ""), |
| 535 | 0 < opts.repeat || |
| 536 | "*" === opts.repeat || |
| 537 | "+" === opts.repeat) |
| 538 | ) { |
| 539 | var repeatStart = |
| 540 | "*" === opts.repeat |
| 541 | ? 0 |
| 542 | : "+" === opts.repeat |
| 543 | ? 1 |
| 544 | : opts.repeat; |
| 545 | mask = |
| 546 | opts.groupmarker[0] + |
| 547 | mask + |
| 548 | opts.groupmarker[1] + |
| 549 | opts.quantifiermarker[0] + |
| 550 | repeatStart + |
| 551 | "," + |
| 552 | opts.repeat + |
| 553 | opts.quantifiermarker[1]; |
| 554 | } |
| 555 | return ( |
| 556 | (maskdefKey = regexMask |
| 557 | ? "regex_" + opts.regex |
| 558 | : opts.numericInput |
| 559 | ? mask.split("").reverse().join("") |
| 560 | : mask), |
| 561 | !1 !== opts.keepStatic && |
| 562 | (maskdefKey = "ks_" + maskdefKey), |
| 563 | void 0 === |
| 564 | Inputmask.prototype.masksCache[maskdefKey] || |
| 565 | !0 === nocache |
| 566 | ? ((masksetDefinition = { |
| 567 | mask: mask, |
| 568 | maskToken: |
| 569 | Inputmask.prototype.analyseMask( |
| 570 | mask, |
| 571 | regexMask, |
| 572 | opts |
| 573 | ), |
| 574 | validPositions: {}, |
| 575 | _buffer: void 0, |
| 576 | buffer: void 0, |
| 577 | tests: {}, |
| 578 | excludes: {}, |
| 579 | metadata: metadata, |
| 580 | maskLength: void 0, |
| 581 | jitOffset: {}, |
| 582 | }), |
| 583 | !0 !== nocache && |
| 584 | ((Inputmask.prototype.masksCache[ |
| 585 | maskdefKey |
| 586 | ] = masksetDefinition), |
| 587 | (masksetDefinition = $.extend( |
| 588 | !0, |
| 589 | {}, |
| 590 | Inputmask.prototype.masksCache[ |
| 591 | maskdefKey |
| 592 | ] |
| 593 | )))) |
| 594 | : (masksetDefinition = $.extend( |
| 595 | !0, |
| 596 | {}, |
| 597 | Inputmask.prototype.masksCache[ |
| 598 | maskdefKey |
| 599 | ] |
| 600 | )), |
| 601 | masksetDefinition |
| 602 | ); |
| 603 | } |
| 604 | if ( |
| 605 | ($.isFunction(opts.mask) && |
| 606 | (opts.mask = opts.mask(opts)), |
| 607 | $.isArray(opts.mask)) |
| 608 | ) { |
| 609 | if (1 < opts.mask.length) { |
| 610 | null === opts.keepStatic && (opts.keepStatic = !0); |
| 611 | var altMask = opts.groupmarker[0]; |
| 612 | return ( |
| 613 | $.each( |
| 614 | opts.isRTL |
| 615 | ? opts.mask.reverse() |
| 616 | : opts.mask, |
| 617 | function (ndx, msk) { |
| 618 | 1 < altMask.length && |
| 619 | (altMask += |
| 620 | opts.groupmarker[1] + |
| 621 | opts.alternatormarker + |
| 622 | opts.groupmarker[0]), |
| 623 | void 0 === msk.mask || |
| 624 | $.isFunction(msk.mask) |
| 625 | ? (altMask += msk) |
| 626 | : (altMask += msk.mask); |
| 627 | } |
| 628 | ), |
| 629 | (altMask += opts.groupmarker[1]), |
| 630 | generateMask(altMask, opts.mask, opts) |
| 631 | ); |
| 632 | } |
| 633 | opts.mask = opts.mask.pop(); |
| 634 | } |
| 635 | return ( |
| 636 | null === opts.keepStatic && (opts.keepStatic = !1), |
| 637 | (ms = |
| 638 | opts.mask && |
| 639 | void 0 !== opts.mask.mask && |
| 640 | !$.isFunction(opts.mask.mask) |
| 641 | ? generateMask(opts.mask.mask, opts.mask, opts) |
| 642 | : generateMask(opts.mask, opts.mask, opts)), |
| 643 | ms |
| 644 | ); |
| 645 | } |
| 646 | function analyseMask(mask, regexMask, opts) { |
| 647 | var tokenizer = |
| 648 | /(?:[?*+]|\{[0-9+*]+(?:,[0-9+*]*)?(?:\|[0-9+*]*)?\})|[^.?*+^${[]()|\\]+|./g, |
| 649 | regexTokenizer = |
| 650 | /\[\^?]?(?:[^\\\]]+|\\[\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, |
| 651 | escaped = !1, |
| 652 | currentToken = new MaskToken(), |
| 653 | match, |
| 654 | m, |
| 655 | openenings = [], |
| 656 | maskTokens = [], |
| 657 | openingToken, |
| 658 | currentOpeningToken, |
| 659 | alternator, |
| 660 | lastMatch, |
| 661 | closeRegexGroup = !1; |
| 662 | function MaskToken( |
| 663 | isGroup, |
| 664 | isOptional, |
| 665 | isQuantifier, |
| 666 | isAlternator |
| 667 | ) { |
| 668 | (this.matches = []), |
| 669 | (this.openGroup = isGroup || !1), |
| 670 | (this.alternatorGroup = !1), |
| 671 | (this.isGroup = isGroup || !1), |
| 672 | (this.isOptional = isOptional || !1), |
| 673 | (this.isQuantifier = isQuantifier || !1), |
| 674 | (this.isAlternator = isAlternator || !1), |
| 675 | (this.quantifier = { |
| 676 | min: 1, |
| 677 | max: 1, |
| 678 | }); |
| 679 | } |
| 680 | function insertTestDefinition(mtoken, element, position) { |
| 681 | position = |
| 682 | void 0 !== position |
| 683 | ? position |
| 684 | : mtoken.matches.length; |
| 685 | var prevMatch = mtoken.matches[position - 1]; |
| 686 | if (regexMask) |
| 687 | 0 === element.indexOf("[") || |
| 688 | (escaped && /\\d|\\s|\\w]/i.test(element)) || |
| 689 | "." === element |
| 690 | ? mtoken.matches.splice(position++, 0, { |
| 691 | fn: new RegExp( |
| 692 | element, |
| 693 | opts.casing ? "i" : "" |
| 694 | ), |
| 695 | static: !1, |
| 696 | optionality: !1, |
| 697 | newBlockMarker: |
| 698 | void 0 === prevMatch |
| 699 | ? "master" |
| 700 | : prevMatch.def !== element, |
| 701 | casing: null, |
| 702 | def: element, |
| 703 | placeholder: void 0, |
| 704 | nativeDef: element, |
| 705 | }) |
| 706 | : (escaped && |
| 707 | (element = element[element.length - 1]), |
| 708 | $.each( |
| 709 | element.split(""), |
| 710 | function (ndx, lmnt) { |
| 711 | (prevMatch = |
| 712 | mtoken.matches[position - 1]), |
| 713 | mtoken.matches.splice( |
| 714 | position++, |
| 715 | 0, |
| 716 | { |
| 717 | fn: /[a-z]/i.test( |
| 718 | opts.staticDefinitionSymbol || |
| 719 | lmnt |
| 720 | ) |
| 721 | ? new RegExp( |
| 722 | "[" + |
| 723 | (opts.staticDefinitionSymbol || |
| 724 | lmnt) + |
| 725 | "]", |
| 726 | opts.casing |
| 727 | ? "i" |
| 728 | : "" |
| 729 | ) |
| 730 | : null, |
| 731 | static: !0, |
| 732 | optionality: !1, |
| 733 | newBlockMarker: |
| 734 | void 0 === prevMatch |
| 735 | ? "master" |
| 736 | : prevMatch.def !== |
| 737 | lmnt && |
| 738 | !0 !== |
| 739 | prevMatch.static, |
| 740 | casing: null, |
| 741 | def: |
| 742 | opts.staticDefinitionSymbol || |
| 743 | lmnt, |
| 744 | placeholder: |
| 745 | void 0 !== |
| 746 | opts.staticDefinitionSymbol |
| 747 | ? lmnt |
| 748 | : void 0, |
| 749 | nativeDef: |
| 750 | (escaped |
| 751 | ? "'" |
| 752 | : "") + lmnt, |
| 753 | } |
| 754 | ); |
| 755 | } |
| 756 | )), |
| 757 | (escaped = !1); |
| 758 | else { |
| 759 | var maskdef = |
| 760 | (opts.definitions |
| 761 | ? opts.definitions[element] |
| 762 | : void 0) || |
| 763 | Inputmask.prototype.definitions[element]; |
| 764 | maskdef && !escaped |
| 765 | ? mtoken.matches.splice(position++, 0, { |
| 766 | fn: maskdef.validator |
| 767 | ? "string" == |
| 768 | typeof maskdef.validator |
| 769 | ? new RegExp( |
| 770 | maskdef.validator, |
| 771 | opts.casing ? "i" : "" |
| 772 | ) |
| 773 | : new (function () { |
| 774 | this.test = |
| 775 | maskdef.validator; |
| 776 | })() |
| 777 | : new RegExp("."), |
| 778 | static: maskdef.static || !1, |
| 779 | optionality: !1, |
| 780 | newBlockMarker: |
| 781 | void 0 === prevMatch |
| 782 | ? "master" |
| 783 | : prevMatch.def !== |
| 784 | (maskdef.definitionSymbol || |
| 785 | element), |
| 786 | casing: maskdef.casing, |
| 787 | def: |
| 788 | maskdef.definitionSymbol || element, |
| 789 | placeholder: maskdef.placeholder, |
| 790 | nativeDef: element, |
| 791 | generated: maskdef.generated, |
| 792 | }) |
| 793 | : (mtoken.matches.splice(position++, 0, { |
| 794 | fn: /[a-z]/i.test( |
| 795 | opts.staticDefinitionSymbol || |
| 796 | element |
| 797 | ) |
| 798 | ? new RegExp( |
| 799 | "[" + |
| 800 | (opts.staticDefinitionSymbol || |
| 801 | element) + |
| 802 | "]", |
| 803 | opts.casing ? "i" : "" |
| 804 | ) |
| 805 | : null, |
| 806 | static: !0, |
| 807 | optionality: !1, |
| 808 | newBlockMarker: |
| 809 | void 0 === prevMatch |
| 810 | ? "master" |
| 811 | : prevMatch.def !== element && |
| 812 | !0 !== prevMatch.static, |
| 813 | casing: null, |
| 814 | def: |
| 815 | opts.staticDefinitionSymbol || |
| 816 | element, |
| 817 | placeholder: |
| 818 | void 0 !== |
| 819 | opts.staticDefinitionSymbol |
| 820 | ? element |
| 821 | : void 0, |
| 822 | nativeDef: |
| 823 | (escaped ? "'" : "") + element, |
| 824 | }), |
| 825 | (escaped = !1)); |
| 826 | } |
| 827 | } |
| 828 | function verifyGroupMarker(maskToken) { |
| 829 | maskToken && |
| 830 | maskToken.matches && |
| 831 | $.each(maskToken.matches, function (ndx, token) { |
| 832 | var nextToken = maskToken.matches[ndx + 1]; |
| 833 | (void 0 === nextToken || |
| 834 | void 0 === nextToken.matches || |
| 835 | !1 === nextToken.isQuantifier) && |
| 836 | token && |
| 837 | token.isGroup && |
| 838 | ((token.isGroup = !1), |
| 839 | regexMask || |
| 840 | (insertTestDefinition( |
| 841 | token, |
| 842 | opts.groupmarker[0], |
| 843 | 0 |
| 844 | ), |
| 845 | !0 !== token.openGroup && |
| 846 | insertTestDefinition( |
| 847 | token, |
| 848 | opts.groupmarker[1] |
| 849 | ))), |
| 850 | verifyGroupMarker(token); |
| 851 | }); |
| 852 | } |
| 853 | function defaultCase() { |
| 854 | if (0 < openenings.length) { |
| 855 | if ( |
| 856 | ((currentOpeningToken = |
| 857 | openenings[openenings.length - 1]), |
| 858 | insertTestDefinition(currentOpeningToken, m), |
| 859 | currentOpeningToken.isAlternator) |
| 860 | ) { |
| 861 | alternator = openenings.pop(); |
| 862 | for ( |
| 863 | var mndx = 0; |
| 864 | mndx < alternator.matches.length; |
| 865 | mndx++ |
| 866 | ) |
| 867 | alternator.matches[mndx].isGroup && |
| 868 | (alternator.matches[mndx].isGroup = !1); |
| 869 | 0 < openenings.length |
| 870 | ? ((currentOpeningToken = |
| 871 | openenings[openenings.length - 1]), |
| 872 | currentOpeningToken.matches.push( |
| 873 | alternator |
| 874 | )) |
| 875 | : currentToken.matches.push(alternator); |
| 876 | } |
| 877 | } else insertTestDefinition(currentToken, m); |
| 878 | } |
| 879 | function reverseTokens(maskToken) { |
| 880 | function reverseStatic(st) { |
| 881 | return ( |
| 882 | st === opts.optionalmarker[0] |
| 883 | ? (st = opts.optionalmarker[1]) |
| 884 | : st === opts.optionalmarker[1] |
| 885 | ? (st = opts.optionalmarker[0]) |
| 886 | : st === opts.groupmarker[0] |
| 887 | ? (st = opts.groupmarker[1]) |
| 888 | : st === opts.groupmarker[1] && |
| 889 | (st = opts.groupmarker[0]), |
| 890 | st |
| 891 | ); |
| 892 | } |
| 893 | for (var match in ((maskToken.matches = |
| 894 | maskToken.matches.reverse()), |
| 895 | maskToken.matches)) |
| 896 | if ( |
| 897 | Object.prototype.hasOwnProperty.call( |
| 898 | maskToken.matches, |
| 899 | match |
| 900 | ) |
| 901 | ) { |
| 902 | var intMatch = parseInt(match); |
| 903 | if ( |
| 904 | maskToken.matches[match].isQuantifier && |
| 905 | maskToken.matches[intMatch + 1] && |
| 906 | maskToken.matches[intMatch + 1].isGroup |
| 907 | ) { |
| 908 | var qt = maskToken.matches[match]; |
| 909 | maskToken.matches.splice(match, 1), |
| 910 | maskToken.matches.splice( |
| 911 | intMatch + 1, |
| 912 | 0, |
| 913 | qt |
| 914 | ); |
| 915 | } |
| 916 | void 0 !== maskToken.matches[match].matches |
| 917 | ? (maskToken.matches[match] = reverseTokens( |
| 918 | maskToken.matches[match] |
| 919 | )) |
| 920 | : (maskToken.matches[match] = reverseStatic( |
| 921 | maskToken.matches[match] |
| 922 | )); |
| 923 | } |
| 924 | return maskToken; |
| 925 | } |
| 926 | function groupify(matches) { |
| 927 | var groupToken = new MaskToken(!0); |
| 928 | return ( |
| 929 | (groupToken.openGroup = !1), |
| 930 | (groupToken.matches = matches), |
| 931 | groupToken |
| 932 | ); |
| 933 | } |
| 934 | function closeGroup() { |
| 935 | if ( |
| 936 | ((openingToken = openenings.pop()), |
| 937 | (openingToken.openGroup = !1), |
| 938 | void 0 !== openingToken) |
| 939 | ) |
| 940 | if (0 < openenings.length) { |
| 941 | if ( |
| 942 | ((currentOpeningToken = |
| 943 | openenings[openenings.length - 1]), |
| 944 | currentOpeningToken.matches.push( |
| 945 | openingToken |
| 946 | ), |
| 947 | currentOpeningToken.isAlternator) |
| 948 | ) { |
| 949 | alternator = openenings.pop(); |
| 950 | for ( |
| 951 | var mndx = 0; |
| 952 | mndx < alternator.matches.length; |
| 953 | mndx++ |
| 954 | ) |
| 955 | (alternator.matches[mndx].isGroup = !1), |
| 956 | (alternator.matches[ |
| 957 | mndx |
| 958 | ].alternatorGroup = !1); |
| 959 | 0 < openenings.length |
| 960 | ? ((currentOpeningToken = |
| 961 | openenings[ |
| 962 | openenings.length - 1 |
| 963 | ]), |
| 964 | currentOpeningToken.matches.push( |
| 965 | alternator |
| 966 | )) |
| 967 | : currentToken.matches.push(alternator); |
| 968 | } |
| 969 | } else currentToken.matches.push(openingToken); |
| 970 | else defaultCase(); |
| 971 | } |
| 972 | function groupQuantifier(matches) { |
| 973 | var lastMatch = matches.pop(); |
| 974 | return ( |
| 975 | lastMatch.isQuantifier && |
| 976 | (lastMatch = groupify([ |
| 977 | matches.pop(), |
| 978 | lastMatch, |
| 979 | ])), |
| 980 | lastMatch |
| 981 | ); |
| 982 | } |
| 983 | for ( |
| 984 | regexMask && |
| 985 | ((opts.optionalmarker[0] = void 0), |
| 986 | (opts.optionalmarker[1] = void 0)); |
| 987 | (match = regexMask |
| 988 | ? regexTokenizer.exec(mask) |
| 989 | : tokenizer.exec(mask)); |
| 990 | |
| 991 | ) { |
| 992 | if (((m = match[0]), regexMask)) |
| 993 | switch (m.charAt(0)) { |
| 994 | case "?": |
| 995 | m = "{0,1}"; |
| 996 | break; |
| 997 | |
| 998 | case "+": |
| 999 | case "*": |
| 1000 | m = "{" + m + "}"; |
| 1001 | break; |
| 1002 | |
| 1003 | case "|": |
| 1004 | if (0 === openenings.length) { |
| 1005 | var altRegexGroup = groupify( |
| 1006 | currentToken.matches |
| 1007 | ); |
| 1008 | (altRegexGroup.openGroup = !0), |
| 1009 | openenings.push(altRegexGroup), |
| 1010 | (currentToken.matches = []), |
| 1011 | (closeRegexGroup = !0); |
| 1012 | } |
| 1013 | break; |
| 1014 | } |
| 1015 | if (escaped) defaultCase(); |
| 1016 | else |
| 1017 | switch (m.charAt(0)) { |
| 1018 | case "(?=": |
| 1019 | break; |
| 1020 | |
| 1021 | case "(?!": |
| 1022 | break; |
| 1023 | |
| 1024 | case "(?<=": |
| 1025 | break; |
| 1026 | |
| 1027 | case "(?<!": |
| 1028 | break; |
| 1029 | |
| 1030 | case opts.escapeChar: |
| 1031 | (escaped = !0), regexMask && defaultCase(); |
| 1032 | break; |
| 1033 | |
| 1034 | case opts.optionalmarker[1]: |
| 1035 | case opts.groupmarker[1]: |
| 1036 | closeGroup(); |
| 1037 | break; |
| 1038 | |
| 1039 | case opts.optionalmarker[0]: |
| 1040 | openenings.push(new MaskToken(!1, !0)); |
| 1041 | break; |
| 1042 | |
| 1043 | case opts.groupmarker[0]: |
| 1044 | openenings.push(new MaskToken(!0)); |
| 1045 | break; |
| 1046 | |
| 1047 | case opts.quantifiermarker[0]: |
| 1048 | var quantifier = new MaskToken(!1, !1, !0); |
| 1049 | m = m.replace(/[{}]/g, ""); |
| 1050 | var mqj = m.split("|"), |
| 1051 | mq = mqj[0].split(","), |
| 1052 | mq0 = isNaN(mq[0]) |
| 1053 | ? mq[0] |
| 1054 | : parseInt(mq[0]), |
| 1055 | mq1 = |
| 1056 | 1 === mq.length |
| 1057 | ? mq0 |
| 1058 | : isNaN(mq[1]) |
| 1059 | ? mq[1] |
| 1060 | : parseInt(mq[1]); |
| 1061 | ("*" !== mq0 && "+" !== mq0) || |
| 1062 | (mq0 = "*" === mq1 ? 0 : 1), |
| 1063 | (quantifier.quantifier = { |
| 1064 | min: mq0, |
| 1065 | max: mq1, |
| 1066 | jit: mqj[1], |
| 1067 | }); |
| 1068 | var matches = |
| 1069 | 0 < openenings.length |
| 1070 | ? openenings[openenings.length - 1] |
| 1071 | .matches |
| 1072 | : currentToken.matches; |
| 1073 | if ( |
| 1074 | ((match = matches.pop()), |
| 1075 | match.isAlternator) |
| 1076 | ) { |
| 1077 | matches.push(match), |
| 1078 | (matches = match.matches); |
| 1079 | var groupToken = new MaskToken(!0), |
| 1080 | tmpMatch = matches.pop(); |
| 1081 | matches.push(groupToken), |
| 1082 | (matches = groupToken.matches), |
| 1083 | (match = tmpMatch); |
| 1084 | } |
| 1085 | match.isGroup || |
| 1086 | (match = groupify([match])), |
| 1087 | matches.push(match), |
| 1088 | matches.push(quantifier); |
| 1089 | break; |
| 1090 | |
| 1091 | case opts.alternatormarker: |
| 1092 | if (0 < openenings.length) { |
| 1093 | currentOpeningToken = |
| 1094 | openenings[openenings.length - 1]; |
| 1095 | var subToken = |
| 1096 | currentOpeningToken.matches[ |
| 1097 | currentOpeningToken.matches |
| 1098 | .length - 1 |
| 1099 | ]; |
| 1100 | lastMatch = |
| 1101 | currentOpeningToken.openGroup && |
| 1102 | (void 0 === subToken.matches || |
| 1103 | (!1 === subToken.isGroup && |
| 1104 | !1 === |
| 1105 | subToken.isAlternator)) |
| 1106 | ? openenings.pop() |
| 1107 | : groupQuantifier( |
| 1108 | currentOpeningToken.matches |
| 1109 | ); |
| 1110 | } else |
| 1111 | lastMatch = groupQuantifier( |
| 1112 | currentToken.matches |
| 1113 | ); |
| 1114 | if (lastMatch.isAlternator) |
| 1115 | openenings.push(lastMatch); |
| 1116 | else if ( |
| 1117 | (lastMatch.alternatorGroup |
| 1118 | ? ((alternator = openenings.pop()), |
| 1119 | (lastMatch.alternatorGroup = !1)) |
| 1120 | : (alternator = new MaskToken( |
| 1121 | !1, |
| 1122 | !1, |
| 1123 | !1, |
| 1124 | !0 |
| 1125 | )), |
| 1126 | alternator.matches.push(lastMatch), |
| 1127 | openenings.push(alternator), |
| 1128 | lastMatch.openGroup) |
| 1129 | ) { |
| 1130 | lastMatch.openGroup = !1; |
| 1131 | var alternatorGroup = new MaskToken(!0); |
| 1132 | (alternatorGroup.alternatorGroup = !0), |
| 1133 | openenings.push(alternatorGroup); |
| 1134 | } |
| 1135 | break; |
| 1136 | |
| 1137 | default: |
| 1138 | defaultCase(); |
| 1139 | } |
| 1140 | } |
| 1141 | for ( |
| 1142 | closeRegexGroup && closeGroup(); |
| 1143 | 0 < openenings.length; |
| 1144 | |
| 1145 | ) |
| 1146 | (openingToken = openenings.pop()), |
| 1147 | currentToken.matches.push(openingToken); |
| 1148 | return ( |
| 1149 | 0 < currentToken.matches.length && |
| 1150 | (verifyGroupMarker(currentToken), |
| 1151 | maskTokens.push(currentToken)), |
| 1152 | (opts.numericInput || opts.isRTL) && |
| 1153 | reverseTokens(maskTokens[0]), |
| 1154 | maskTokens |
| 1155 | ); |
| 1156 | } |
| 1157 | module.exports = { |
| 1158 | generateMaskSet: generateMaskSet, |
| 1159 | analyseMask: analyseMask, |
| 1160 | }; |
| 1161 | }, |
| 1162 | function (module, exports, __webpack_require__) { |
| 1163 | "use strict"; |
| 1164 | __webpack_require__(7), |
| 1165 | __webpack_require__(9), |
| 1166 | __webpack_require__(10), |
| 1167 | __webpack_require__(11), |
| 1168 | (module.exports = __webpack_require__(1)); |
| 1169 | }, |
| 1170 | function (module, exports, __webpack_require__) { |
| 1171 | "use strict"; |
| 1172 | var Inputmask = __webpack_require__(1); |
| 1173 | Inputmask.extendDefinitions({ |
| 1174 | A: { |
| 1175 | validator: |
| 1176 | "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]", |
| 1177 | casing: "upper", |
| 1178 | }, |
| 1179 | "&": { |
| 1180 | validator: |
| 1181 | "[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]", |
| 1182 | casing: "upper", |
| 1183 | }, |
| 1184 | "#": { |
| 1185 | validator: "[0-9A-Fa-f]", |
| 1186 | casing: "upper", |
| 1187 | }, |
| 1188 | }); |
| 1189 | var ipValidatorRegex = new RegExp( |
| 1190 | "25[0-5]|2[0-4][0-9]|[01][0-9][0-9]" |
| 1191 | ); |
| 1192 | function ipValidator(chrs, maskset, pos, strict, opts) { |
| 1193 | return ( |
| 1194 | (chrs = |
| 1195 | -1 < pos - 1 && "." !== maskset.buffer[pos - 1] |
| 1196 | ? ((chrs = maskset.buffer[pos - 1] + chrs), |
| 1197 | -1 < pos - 2 && |
| 1198 | "." !== maskset.buffer[pos - 2] |
| 1199 | ? maskset.buffer[pos - 2] + chrs |
| 1200 | : "0" + chrs) |
| 1201 | : "00" + chrs), |
| 1202 | ipValidatorRegex.test(chrs) |
| 1203 | ); |
| 1204 | } |
| 1205 | Inputmask.extendAliases({ |
| 1206 | cssunit: { |
| 1207 | regex: "[+-]?[0-9]+\\.?([0-9]+)?(px|em|rem|ex|%|in|cm|mm|pt|pc)", |
| 1208 | }, |
| 1209 | url: { |
| 1210 | regex: "(https?|ftp)//.*", |
| 1211 | autoUnmask: !1, |
| 1212 | }, |
| 1213 | ip: { |
| 1214 | mask: "i[i[i]].j[j[j]].k[k[k]].l[l[l]]", |
| 1215 | definitions: { |
| 1216 | i: { |
| 1217 | validator: ipValidator, |
| 1218 | }, |
| 1219 | j: { |
| 1220 | validator: ipValidator, |
| 1221 | }, |
| 1222 | k: { |
| 1223 | validator: ipValidator, |
| 1224 | }, |
| 1225 | l: { |
| 1226 | validator: ipValidator, |
| 1227 | }, |
| 1228 | }, |
| 1229 | onUnMask: function onUnMask( |
| 1230 | maskedValue, |
| 1231 | unmaskedValue, |
| 1232 | opts |
| 1233 | ) { |
| 1234 | return maskedValue; |
| 1235 | }, |
| 1236 | inputmode: "numeric", |
| 1237 | }, |
| 1238 | email: { |
| 1239 | mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]", |
| 1240 | greedy: !1, |
| 1241 | casing: "lower", |
| 1242 | onBeforePaste: function onBeforePaste( |
| 1243 | pastedValue, |
| 1244 | opts |
| 1245 | ) { |
| 1246 | return ( |
| 1247 | (pastedValue = pastedValue.toLowerCase()), |
| 1248 | pastedValue.replace("mailto:", "") |
| 1249 | ); |
| 1250 | }, |
| 1251 | definitions: { |
| 1252 | "*": { |
| 1253 | validator: |
| 1254 | "[0-9\uff11-\uff19A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5!#$%&'*+/=?^_`{|}~-]", |
| 1255 | }, |
| 1256 | "-": { |
| 1257 | validator: "[0-9A-Za-z-]", |
| 1258 | }, |
| 1259 | }, |
| 1260 | onUnMask: function onUnMask( |
| 1261 | maskedValue, |
| 1262 | unmaskedValue, |
| 1263 | opts |
| 1264 | ) { |
| 1265 | return maskedValue; |
| 1266 | }, |
| 1267 | inputmode: "email", |
| 1268 | }, |
| 1269 | mac: { |
| 1270 | mask: "##:##:##:##:##:##", |
| 1271 | }, |
| 1272 | vin: { |
| 1273 | mask: "V{13}9{4}", |
| 1274 | definitions: { |
| 1275 | V: { |
| 1276 | validator: "[A-HJ-NPR-Za-hj-npr-z\\d]", |
| 1277 | casing: "upper", |
| 1278 | }, |
| 1279 | }, |
| 1280 | clearIncomplete: !0, |
| 1281 | autoUnmask: !0, |
| 1282 | }, |
| 1283 | ssn: { |
| 1284 | mask: "999-99-9999", |
| 1285 | postValidation: function postValidation( |
| 1286 | buffer, |
| 1287 | pos, |
| 1288 | c, |
| 1289 | currentResult, |
| 1290 | opts, |
| 1291 | maskset, |
| 1292 | strict |
| 1293 | ) { |
| 1294 | return /^(?!219-09-9999|078-05-1120)(?!666|000|9.{2}).{3}-(?!00).{2}-(?!0{4}).{4}$/.test( |
| 1295 | buffer.join("") |
| 1296 | ); |
| 1297 | }, |
| 1298 | }, |
| 1299 | }), |
| 1300 | (module.exports = Inputmask); |
| 1301 | }, |
| 1302 | function (module, exports, __webpack_require__) { |
| 1303 | "use strict"; |
| 1304 | function _typeof(obj) { |
| 1305 | return ( |
| 1306 | (_typeof = |
| 1307 | "function" == typeof Symbol && |
| 1308 | "symbol" == typeof Symbol.iterator |
| 1309 | ? function _typeof(obj) { |
| 1310 | return typeof obj; |
| 1311 | } |
| 1312 | : function _typeof(obj) { |
| 1313 | return obj && |
| 1314 | "function" == typeof Symbol && |
| 1315 | obj.constructor === Symbol && |
| 1316 | obj !== Symbol.prototype |
| 1317 | ? "symbol" |
| 1318 | : typeof obj; |
| 1319 | }), |
| 1320 | _typeof(obj) |
| 1321 | ); |
| 1322 | } |
| 1323 | var $ = __webpack_require__(2), |
| 1324 | window = __webpack_require__(4), |
| 1325 | document = window.document, |
| 1326 | ua = (window.navigator && window.navigator.userAgent) || "", |
| 1327 | ie = 0 < ua.indexOf("MSIE ") || 0 < ua.indexOf("Trident/"), |
| 1328 | mobile = "ontouchstart" in window, |
| 1329 | iemobile = /iemobile/i.test(ua), |
| 1330 | iphone = /iphone/i.test(ua) && !iemobile, |
| 1331 | keyCode = __webpack_require__(0); |
| 1332 | module.exports = function maskScope(actionObj, maskset, opts) { |
| 1333 | (maskset = maskset || this.maskset), |
| 1334 | (opts = opts || this.opts); |
| 1335 | var inputmask = this, |
| 1336 | el = this.el, |
| 1337 | isRTL = this.isRTL || (this.isRTL = opts.numericInput), |
| 1338 | undoValue, |
| 1339 | $el, |
| 1340 | skipKeyPressEvent = !1, |
| 1341 | skipInputEvent = !1, |
| 1342 | validationEvent = !1, |
| 1343 | ignorable = !1, |
| 1344 | maxLength, |
| 1345 | mouseEnter = !1, |
| 1346 | originalPlaceholder = void 0; |
| 1347 | function getMaskTemplate( |
| 1348 | baseOnInput, |
| 1349 | minimalPos, |
| 1350 | includeMode, |
| 1351 | noJit, |
| 1352 | clearOptionalTail |
| 1353 | ) { |
| 1354 | var greedy = opts.greedy; |
| 1355 | clearOptionalTail && (opts.greedy = !1), |
| 1356 | (minimalPos = minimalPos || 0); |
| 1357 | var maskTemplate = [], |
| 1358 | ndxIntlzr, |
| 1359 | pos = 0, |
| 1360 | test, |
| 1361 | testPos, |
| 1362 | jitRenderStatic; |
| 1363 | do { |
| 1364 | if ( |
| 1365 | !0 === baseOnInput && |
| 1366 | maskset.validPositions[pos] |
| 1367 | ) |
| 1368 | (testPos = |
| 1369 | clearOptionalTail && |
| 1370 | !0 === |
| 1371 | maskset.validPositions[pos].match |
| 1372 | .optionality && |
| 1373 | void 0 === |
| 1374 | maskset.validPositions[pos + 1] && |
| 1375 | (!0 === |
| 1376 | maskset.validPositions[pos] |
| 1377 | .generatedInput || |
| 1378 | (maskset.validPositions[pos].input == |
| 1379 | opts.skipOptionalPartCharacter && |
| 1380 | 0 < pos)) |
| 1381 | ? determineTestTemplate( |
| 1382 | pos, |
| 1383 | getTests( |
| 1384 | pos, |
| 1385 | ndxIntlzr, |
| 1386 | pos - 1 |
| 1387 | ) |
| 1388 | ) |
| 1389 | : maskset.validPositions[pos]), |
| 1390 | (test = testPos.match), |
| 1391 | (ndxIntlzr = testPos.locator.slice()), |
| 1392 | maskTemplate.push( |
| 1393 | !0 === includeMode |
| 1394 | ? testPos.input |
| 1395 | : !1 === includeMode |
| 1396 | ? test.nativeDef |
| 1397 | : getPlaceholder(pos, test) |
| 1398 | ); |
| 1399 | else { |
| 1400 | (testPos = getTestTemplate( |
| 1401 | pos, |
| 1402 | ndxIntlzr, |
| 1403 | pos - 1 |
| 1404 | )), |
| 1405 | (test = testPos.match), |
| 1406 | (ndxIntlzr = testPos.locator.slice()); |
| 1407 | var jitMasking = |
| 1408 | !0 !== noJit && |
| 1409 | (!1 !== opts.jitMasking |
| 1410 | ? opts.jitMasking |
| 1411 | : test.jit); |
| 1412 | (jitRenderStatic = |
| 1413 | (jitRenderStatic && |
| 1414 | test.static && |
| 1415 | test.def !== opts.groupSeparator && |
| 1416 | null === test.fn) || |
| 1417 | (maskset.validPositions[pos - 1] && |
| 1418 | test.static && |
| 1419 | test.def !== opts.groupSeparator && |
| 1420 | null === test.fn)), |
| 1421 | jitRenderStatic || |
| 1422 | !1 === jitMasking || |
| 1423 | void 0 === jitMasking || |
| 1424 | ("number" == typeof jitMasking && |
| 1425 | isFinite(jitMasking) && |
| 1426 | pos < jitMasking) |
| 1427 | ? maskTemplate.push( |
| 1428 | !1 === includeMode |
| 1429 | ? test.nativeDef |
| 1430 | : getPlaceholder(pos, test) |
| 1431 | ) |
| 1432 | : (jitRenderStatic = !1); |
| 1433 | } |
| 1434 | pos++; |
| 1435 | } while ( |
| 1436 | ((void 0 === maxLength || pos < maxLength) && |
| 1437 | (!0 !== test.static || "" !== test.def)) || |
| 1438 | pos < minimalPos |
| 1439 | ); |
| 1440 | return ( |
| 1441 | "" === maskTemplate[maskTemplate.length - 1] && |
| 1442 | maskTemplate.pop(), |
| 1443 | (!1 === includeMode && |
| 1444 | void 0 !== maskset.maskLength) || |
| 1445 | (maskset.maskLength = pos - 1), |
| 1446 | (opts.greedy = greedy), |
| 1447 | maskTemplate |
| 1448 | ); |
| 1449 | } |
| 1450 | function resetMaskSet(soft) { |
| 1451 | (maskset.buffer = void 0), |
| 1452 | !0 !== soft && |
| 1453 | ((maskset.validPositions = {}), |
| 1454 | (maskset.p = 0)); |
| 1455 | } |
| 1456 | function getLastValidPosition( |
| 1457 | closestTo, |
| 1458 | strict, |
| 1459 | validPositions |
| 1460 | ) { |
| 1461 | var before = -1, |
| 1462 | after = -1, |
| 1463 | valids = validPositions || maskset.validPositions; |
| 1464 | for (var posNdx in (void 0 === closestTo && |
| 1465 | (closestTo = -1), |
| 1466 | valids)) { |
| 1467 | var psNdx = parseInt(posNdx); |
| 1468 | valids[psNdx] && |
| 1469 | (strict || |
| 1470 | !0 !== valids[psNdx].generatedInput) && |
| 1471 | (psNdx <= closestTo && (before = psNdx), |
| 1472 | closestTo <= psNdx && (after = psNdx)); |
| 1473 | } |
| 1474 | return -1 === before || before == closestTo |
| 1475 | ? after |
| 1476 | : -1 == after |
| 1477 | ? before |
| 1478 | : closestTo - before < after - closestTo |
| 1479 | ? before |
| 1480 | : after; |
| 1481 | } |
| 1482 | function getDecisionTaker(tst) { |
| 1483 | var decisionTaker = tst.locator[tst.alternation]; |
| 1484 | return ( |
| 1485 | "string" == typeof decisionTaker && |
| 1486 | 0 < decisionTaker.length && |
| 1487 | (decisionTaker = decisionTaker.split(",")[0]), |
| 1488 | void 0 !== decisionTaker |
| 1489 | ? decisionTaker.toString() |
| 1490 | : "" |
| 1491 | ); |
| 1492 | } |
| 1493 | function getLocator(tst, align) { |
| 1494 | var locator = ( |
| 1495 | null != tst.alternation |
| 1496 | ? tst.mloc[getDecisionTaker(tst)] |
| 1497 | : tst.locator |
| 1498 | ).join(""); |
| 1499 | if ("" !== locator) |
| 1500 | for (; locator.length < align; ) locator += "0"; |
| 1501 | return locator; |
| 1502 | } |
| 1503 | function determineTestTemplate(pos, tests) { |
| 1504 | pos = 0 < pos ? pos - 1 : 0; |
| 1505 | for ( |
| 1506 | var altTest = getTest(pos), |
| 1507 | targetLocator = getLocator(altTest), |
| 1508 | tstLocator, |
| 1509 | closest, |
| 1510 | bestMatch, |
| 1511 | ndx = 0; |
| 1512 | ndx < tests.length; |
| 1513 | ndx++ |
| 1514 | ) { |
| 1515 | var tst = tests[ndx]; |
| 1516 | tstLocator = getLocator(tst, targetLocator.length); |
| 1517 | var distance = Math.abs(tstLocator - targetLocator); |
| 1518 | (void 0 === closest || |
| 1519 | ("" !== tstLocator && distance < closest) || |
| 1520 | (bestMatch && |
| 1521 | !opts.greedy && |
| 1522 | bestMatch.match.optionality && |
| 1523 | "master" === |
| 1524 | bestMatch.match.newBlockMarker && |
| 1525 | (!tst.match.optionality || |
| 1526 | !tst.match.newBlockMarker)) || |
| 1527 | (bestMatch && |
| 1528 | bestMatch.match.optionalQuantifier && |
| 1529 | !tst.match.optionalQuantifier)) && |
| 1530 | ((closest = distance), (bestMatch = tst)); |
| 1531 | } |
| 1532 | return bestMatch; |
| 1533 | } |
| 1534 | function getTestTemplate(pos, ndxIntlzr, tstPs) { |
| 1535 | return ( |
| 1536 | maskset.validPositions[pos] || |
| 1537 | determineTestTemplate( |
| 1538 | pos, |
| 1539 | getTests( |
| 1540 | pos, |
| 1541 | ndxIntlzr ? ndxIntlzr.slice() : ndxIntlzr, |
| 1542 | tstPs |
| 1543 | ) |
| 1544 | ) |
| 1545 | ); |
| 1546 | } |
| 1547 | function getTest(pos, tests) { |
| 1548 | return maskset.validPositions[pos] |
| 1549 | ? maskset.validPositions[pos] |
| 1550 | : (tests || getTests(pos))[0]; |
| 1551 | } |
| 1552 | function positionCanMatchDefinition( |
| 1553 | pos, |
| 1554 | testDefinition, |
| 1555 | opts |
| 1556 | ) { |
| 1557 | for ( |
| 1558 | var valid = !1, tests = getTests(pos), tndx = 0; |
| 1559 | tndx < tests.length; |
| 1560 | tndx++ |
| 1561 | ) { |
| 1562 | if ( |
| 1563 | tests[tndx].match && |
| 1564 | (!( |
| 1565 | tests[tndx].match.nativeDef !== |
| 1566 | testDefinition.match[ |
| 1567 | opts.shiftPositions |
| 1568 | ? "def" |
| 1569 | : "nativeDef" |
| 1570 | ] || |
| 1571 | (opts.shiftPositions && |
| 1572 | testDefinition.match.static) |
| 1573 | ) || |
| 1574 | tests[tndx].match.nativeDef === |
| 1575 | testDefinition.match.nativeDef) |
| 1576 | ) { |
| 1577 | valid = !0; |
| 1578 | break; |
| 1579 | } |
| 1580 | if ( |
| 1581 | tests[tndx].match && |
| 1582 | tests[tndx].match.def === |
| 1583 | testDefinition.match.nativeDef |
| 1584 | ) { |
| 1585 | valid = void 0; |
| 1586 | break; |
| 1587 | } |
| 1588 | } |
| 1589 | return ( |
| 1590 | !1 === valid && |
| 1591 | void 0 !== maskset.jitOffset[pos] && |
| 1592 | (valid = positionCanMatchDefinition( |
| 1593 | pos + maskset.jitOffset[pos], |
| 1594 | testDefinition, |
| 1595 | opts |
| 1596 | )), |
| 1597 | valid |
| 1598 | ); |
| 1599 | } |
| 1600 | function getTests(pos, ndxIntlzr, tstPs) { |
| 1601 | var maskTokens = maskset.maskToken, |
| 1602 | testPos = ndxIntlzr ? tstPs : 0, |
| 1603 | ndxInitializer = ndxIntlzr |
| 1604 | ? ndxIntlzr.slice() |
| 1605 | : [0], |
| 1606 | matches = [], |
| 1607 | insertStop = !1, |
| 1608 | latestMatch, |
| 1609 | cacheDependency = ndxIntlzr |
| 1610 | ? ndxIntlzr.join("") |
| 1611 | : ""; |
| 1612 | function resolveTestFromToken( |
| 1613 | maskToken, |
| 1614 | ndxInitializer, |
| 1615 | loopNdx, |
| 1616 | quantifierRecurse |
| 1617 | ) { |
| 1618 | function handleMatch( |
| 1619 | match, |
| 1620 | loopNdx, |
| 1621 | quantifierRecurse |
| 1622 | ) { |
| 1623 | function isFirstMatch(latestMatch, tokenGroup) { |
| 1624 | var firstMatch = |
| 1625 | 0 === |
| 1626 | $.inArray( |
| 1627 | latestMatch, |
| 1628 | tokenGroup.matches |
| 1629 | ); |
| 1630 | return ( |
| 1631 | firstMatch || |
| 1632 | $.each( |
| 1633 | tokenGroup.matches, |
| 1634 | function (ndx, match) { |
| 1635 | if ( |
| 1636 | (!0 === |
| 1637 | match.isQuantifier |
| 1638 | ? (firstMatch = |
| 1639 | isFirstMatch( |
| 1640 | latestMatch, |
| 1641 | tokenGroup |
| 1642 | .matches[ |
| 1643 | ndx - |
| 1644 | 1 |
| 1645 | ] |
| 1646 | )) |
| 1647 | : Object.prototype.hasOwnProperty.call( |
| 1648 | match, |
| 1649 | "matches" |
| 1650 | ) && |
| 1651 | (firstMatch = |
| 1652 | isFirstMatch( |
| 1653 | latestMatch, |
| 1654 | match |
| 1655 | )), |
| 1656 | firstMatch) |
| 1657 | ) |
| 1658 | return !1; |
| 1659 | } |
| 1660 | ), |
| 1661 | firstMatch |
| 1662 | ); |
| 1663 | } |
| 1664 | function resolveNdxInitializer( |
| 1665 | pos, |
| 1666 | alternateNdx, |
| 1667 | targetAlternation |
| 1668 | ) { |
| 1669 | var bestMatch, indexPos; |
| 1670 | if ( |
| 1671 | ((maskset.tests[pos] || |
| 1672 | maskset.validPositions[pos]) && |
| 1673 | $.each( |
| 1674 | maskset.tests[pos] || [ |
| 1675 | maskset.validPositions[pos], |
| 1676 | ], |
| 1677 | function (ndx, lmnt) { |
| 1678 | if (lmnt.mloc[alternateNdx]) |
| 1679 | return ( |
| 1680 | (bestMatch = lmnt), |
| 1681 | !1 |
| 1682 | ); |
| 1683 | var alternation = |
| 1684 | void 0 !== |
| 1685 | targetAlternation |
| 1686 | ? targetAlternation |
| 1687 | : lmnt.alternation, |
| 1688 | ndxPos = |
| 1689 | void 0 !== |
| 1690 | lmnt.locator[ |
| 1691 | alternation |
| 1692 | ] |
| 1693 | ? lmnt.locator[ |
| 1694 | alternation |
| 1695 | ] |
| 1696 | .toString() |
| 1697 | .indexOf( |
| 1698 | alternateNdx |
| 1699 | ) |
| 1700 | : -1; |
| 1701 | (void 0 === indexPos || |
| 1702 | ndxPos < indexPos) && |
| 1703 | -1 !== ndxPos && |
| 1704 | ((bestMatch = lmnt), |
| 1705 | (indexPos = ndxPos)); |
| 1706 | } |
| 1707 | ), |
| 1708 | bestMatch) |
| 1709 | ) { |
| 1710 | var bestMatchAltIndex = |
| 1711 | bestMatch.locator[ |
| 1712 | bestMatch.alternation |
| 1713 | ], |
| 1714 | locator = |
| 1715 | bestMatch.mloc[alternateNdx] || |
| 1716 | bestMatch.mloc[ |
| 1717 | bestMatchAltIndex |
| 1718 | ] || |
| 1719 | bestMatch.locator; |
| 1720 | return locator.slice( |
| 1721 | (void 0 !== targetAlternation |
| 1722 | ? targetAlternation |
| 1723 | : bestMatch.alternation) + 1 |
| 1724 | ); |
| 1725 | } |
| 1726 | return void 0 !== targetAlternation |
| 1727 | ? resolveNdxInitializer( |
| 1728 | pos, |
| 1729 | alternateNdx |
| 1730 | ) |
| 1731 | : void 0; |
| 1732 | } |
| 1733 | function isSubsetOf(source, target) { |
| 1734 | function expand(pattern) { |
| 1735 | for ( |
| 1736 | var expanded = [], |
| 1737 | start = -1, |
| 1738 | end, |
| 1739 | i = 0, |
| 1740 | l = pattern.length; |
| 1741 | i < l; |
| 1742 | i++ |
| 1743 | ) |
| 1744 | if ("-" === pattern.charAt(i)) |
| 1745 | for ( |
| 1746 | end = pattern.charCodeAt( |
| 1747 | i + 1 |
| 1748 | ); |
| 1749 | ++start < end; |
| 1750 | |
| 1751 | ) |
| 1752 | expanded.push( |
| 1753 | String.fromCharCode( |
| 1754 | start |
| 1755 | ) |
| 1756 | ); |
| 1757 | else |
| 1758 | (start = pattern.charCodeAt(i)), |
| 1759 | expanded.push( |
| 1760 | pattern.charAt(i) |
| 1761 | ); |
| 1762 | return expanded.join(""); |
| 1763 | } |
| 1764 | return ( |
| 1765 | source.match.def === |
| 1766 | target.match.nativeDef || |
| 1767 | (!( |
| 1768 | !( |
| 1769 | opts.regex || |
| 1770 | (source.match.fn instanceof |
| 1771 | RegExp && |
| 1772 | target.match.fn instanceof |
| 1773 | RegExp) |
| 1774 | ) || |
| 1775 | !0 === source.match.static || |
| 1776 | !0 === target.match.static |
| 1777 | ) && |
| 1778 | -1 !== |
| 1779 | expand( |
| 1780 | target.match.fn |
| 1781 | .toString() |
| 1782 | .replace(/[[\]/]/g, "") |
| 1783 | ).indexOf( |
| 1784 | expand( |
| 1785 | source.match.fn |
| 1786 | .toString() |
| 1787 | .replace( |
| 1788 | /[[\]/]/g, |
| 1789 | "" |
| 1790 | ) |
| 1791 | ) |
| 1792 | )) |
| 1793 | ); |
| 1794 | } |
| 1795 | function staticCanMatchDefinition( |
| 1796 | source, |
| 1797 | target |
| 1798 | ) { |
| 1799 | return ( |
| 1800 | !0 === source.match.static && |
| 1801 | !0 !== target.match.static && |
| 1802 | target.match.fn.test( |
| 1803 | source.match.def, |
| 1804 | maskset, |
| 1805 | pos, |
| 1806 | !1, |
| 1807 | opts, |
| 1808 | !1 |
| 1809 | ) |
| 1810 | ); |
| 1811 | } |
| 1812 | function setMergeLocators( |
| 1813 | targetMatch, |
| 1814 | altMatch |
| 1815 | ) { |
| 1816 | var alternationNdx = |
| 1817 | targetMatch.alternation, |
| 1818 | shouldMerge = |
| 1819 | void 0 === altMatch || |
| 1820 | (alternationNdx === |
| 1821 | altMatch.alternation && |
| 1822 | -1 === |
| 1823 | targetMatch.locator[ |
| 1824 | alternationNdx |
| 1825 | ] |
| 1826 | .toString() |
| 1827 | .indexOf( |
| 1828 | altMatch.locator[ |
| 1829 | alternationNdx |
| 1830 | ] |
| 1831 | )); |
| 1832 | if ( |
| 1833 | !shouldMerge && |
| 1834 | alternationNdx > altMatch.alternation |
| 1835 | ) |
| 1836 | for ( |
| 1837 | var i = altMatch.alternation; |
| 1838 | i < alternationNdx; |
| 1839 | i++ |
| 1840 | ) |
| 1841 | if ( |
| 1842 | targetMatch.locator[i] !== |
| 1843 | altMatch.locator[i] |
| 1844 | ) { |
| 1845 | (alternationNdx = i), |
| 1846 | (shouldMerge = !0); |
| 1847 | break; |
| 1848 | } |
| 1849 | if (shouldMerge) { |
| 1850 | targetMatch.mloc = |
| 1851 | targetMatch.mloc || {}; |
| 1852 | var locNdx = |
| 1853 | targetMatch.locator[alternationNdx]; |
| 1854 | if (void 0 !== locNdx) { |
| 1855 | if ( |
| 1856 | ("string" == typeof locNdx && |
| 1857 | (locNdx = |
| 1858 | locNdx.split(",")[0]), |
| 1859 | void 0 === |
| 1860 | targetMatch.mloc[locNdx] && |
| 1861 | (targetMatch.mloc[locNdx] = |
| 1862 | targetMatch.locator.slice()), |
| 1863 | void 0 !== altMatch) |
| 1864 | ) { |
| 1865 | for (var ndx in altMatch.mloc) |
| 1866 | "string" == typeof ndx && |
| 1867 | (ndx = |
| 1868 | ndx.split(",")[0]), |
| 1869 | void 0 === |
| 1870 | targetMatch.mloc[ |
| 1871 | ndx |
| 1872 | ] && |
| 1873 | (targetMatch.mloc[ |
| 1874 | ndx |
| 1875 | ] = |
| 1876 | altMatch.mloc[ |
| 1877 | ndx |
| 1878 | ]); |
| 1879 | targetMatch.locator[ |
| 1880 | alternationNdx |
| 1881 | ] = Object.keys( |
| 1882 | targetMatch.mloc |
| 1883 | ).join(","); |
| 1884 | } |
| 1885 | return !0; |
| 1886 | } |
| 1887 | targetMatch.alternation = void 0; |
| 1888 | } |
| 1889 | return !1; |
| 1890 | } |
| 1891 | function isSameLevel(targetMatch, altMatch) { |
| 1892 | if ( |
| 1893 | targetMatch.locator.length !== |
| 1894 | altMatch.locator.length |
| 1895 | ) |
| 1896 | return !1; |
| 1897 | for ( |
| 1898 | var locNdx = |
| 1899 | targetMatch.alternation + 1; |
| 1900 | locNdx < targetMatch.locator.length; |
| 1901 | locNdx++ |
| 1902 | ) |
| 1903 | if ( |
| 1904 | targetMatch.locator[locNdx] !== |
| 1905 | altMatch.locator[locNdx] |
| 1906 | ) |
| 1907 | return !1; |
| 1908 | return !0; |
| 1909 | } |
| 1910 | if ( |
| 1911 | testPos > opts._maxTestPos && |
| 1912 | void 0 !== quantifierRecurse |
| 1913 | ) |
| 1914 | throw ( |
| 1915 | "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. " + |
| 1916 | maskset.mask |
| 1917 | ); |
| 1918 | if (testPos === pos && void 0 === match.matches) |
| 1919 | return ( |
| 1920 | matches.push({ |
| 1921 | match: match, |
| 1922 | locator: loopNdx.reverse(), |
| 1923 | cd: cacheDependency, |
| 1924 | mloc: {}, |
| 1925 | }), |
| 1926 | !0 |
| 1927 | ); |
| 1928 | if (void 0 !== match.matches) { |
| 1929 | if ( |
| 1930 | match.isGroup && |
| 1931 | quantifierRecurse !== match |
| 1932 | ) { |
| 1933 | if ( |
| 1934 | ((match = handleMatch( |
| 1935 | maskToken.matches[ |
| 1936 | $.inArray( |
| 1937 | match, |
| 1938 | maskToken.matches |
| 1939 | ) + 1 |
| 1940 | ], |
| 1941 | loopNdx, |
| 1942 | quantifierRecurse |
| 1943 | )), |
| 1944 | match) |
| 1945 | ) |
| 1946 | return !0; |
| 1947 | } else if (match.isOptional) { |
| 1948 | var optionalToken = match, |
| 1949 | mtchsNdx = matches.length; |
| 1950 | if ( |
| 1951 | ((match = resolveTestFromToken( |
| 1952 | match, |
| 1953 | ndxInitializer, |
| 1954 | loopNdx, |
| 1955 | quantifierRecurse |
| 1956 | )), |
| 1957 | match) |
| 1958 | ) { |
| 1959 | if ( |
| 1960 | ($.each( |
| 1961 | matches, |
| 1962 | function (ndx, mtch) { |
| 1963 | mtchsNdx <= ndx && |
| 1964 | (mtch.match.optionality = |
| 1965 | !0); |
| 1966 | } |
| 1967 | ), |
| 1968 | (latestMatch = |
| 1969 | matches[matches.length - 1] |
| 1970 | .match), |
| 1971 | void 0 !== quantifierRecurse || |
| 1972 | !isFirstMatch( |
| 1973 | latestMatch, |
| 1974 | optionalToken |
| 1975 | )) |
| 1976 | ) |
| 1977 | return !0; |
| 1978 | (insertStop = !0), (testPos = pos); |
| 1979 | } |
| 1980 | } else if (match.isAlternator) { |
| 1981 | var alternateToken = match, |
| 1982 | malternateMatches = [], |
| 1983 | maltMatches, |
| 1984 | currentMatches = matches.slice(), |
| 1985 | loopNdxCnt = loopNdx.length, |
| 1986 | altIndex = |
| 1987 | 0 < ndxInitializer.length |
| 1988 | ? ndxInitializer.shift() |
| 1989 | : -1; |
| 1990 | if ( |
| 1991 | -1 === altIndex || |
| 1992 | "string" == typeof altIndex |
| 1993 | ) { |
| 1994 | var currentPos = testPos, |
| 1995 | ndxInitializerClone = |
| 1996 | ndxInitializer.slice(), |
| 1997 | altIndexArr = [], |
| 1998 | amndx; |
| 1999 | if ("string" == typeof altIndex) |
| 2000 | altIndexArr = |
| 2001 | altIndex.split(","); |
| 2002 | else |
| 2003 | for ( |
| 2004 | amndx = 0; |
| 2005 | amndx < |
| 2006 | alternateToken.matches |
| 2007 | .length; |
| 2008 | amndx++ |
| 2009 | ) |
| 2010 | altIndexArr.push( |
| 2011 | amndx.toString() |
| 2012 | ); |
| 2013 | if ( |
| 2014 | void 0 !== maskset.excludes[pos] |
| 2015 | ) { |
| 2016 | for ( |
| 2017 | var altIndexArrClone = |
| 2018 | altIndexArr.slice(), |
| 2019 | i = 0, |
| 2020 | exl = |
| 2021 | maskset.excludes[ |
| 2022 | pos |
| 2023 | ].length; |
| 2024 | i < exl; |
| 2025 | i++ |
| 2026 | ) { |
| 2027 | var excludeSet = |
| 2028 | maskset.excludes[pos][i] |
| 2029 | .toString() |
| 2030 | .split(":"); |
| 2031 | loopNdx.length == |
| 2032 | excludeSet[1] && |
| 2033 | altIndexArr.splice( |
| 2034 | altIndexArr.indexOf( |
| 2035 | excludeSet[0] |
| 2036 | ), |
| 2037 | 1 |
| 2038 | ); |
| 2039 | } |
| 2040 | 0 === altIndexArr.length && |
| 2041 | (delete maskset.excludes[ |
| 2042 | pos |
| 2043 | ], |
| 2044 | (altIndexArr = |
| 2045 | altIndexArrClone)); |
| 2046 | } |
| 2047 | (!0 === opts.keepStatic || |
| 2048 | (isFinite( |
| 2049 | parseInt(opts.keepStatic) |
| 2050 | ) && |
| 2051 | currentPos >= |
| 2052 | opts.keepStatic)) && |
| 2053 | (altIndexArr = |
| 2054 | altIndexArr.slice(0, 1)); |
| 2055 | for ( |
| 2056 | var unMatchedAlternation = !1, |
| 2057 | ndx = 0; |
| 2058 | ndx < altIndexArr.length; |
| 2059 | ndx++ |
| 2060 | ) { |
| 2061 | (amndx = parseInt( |
| 2062 | altIndexArr[ndx] |
| 2063 | )), |
| 2064 | (matches = []), |
| 2065 | (ndxInitializer = |
| 2066 | ("string" == |
| 2067 | typeof altIndex && |
| 2068 | resolveNdxInitializer( |
| 2069 | testPos, |
| 2070 | amndx, |
| 2071 | loopNdxCnt |
| 2072 | )) || |
| 2073 | ndxInitializerClone.slice()), |
| 2074 | alternateToken.matches[ |
| 2075 | amndx |
| 2076 | ] && |
| 2077 | handleMatch( |
| 2078 | alternateToken.matches[ |
| 2079 | amndx |
| 2080 | ], |
| 2081 | [amndx].concat(loopNdx), |
| 2082 | quantifierRecurse |
| 2083 | ) |
| 2084 | ? (match = !0) |
| 2085 | : 0 === ndx && |
| 2086 | (unMatchedAlternation = |
| 2087 | !0), |
| 2088 | (maltMatches = |
| 2089 | matches.slice()), |
| 2090 | (testPos = currentPos), |
| 2091 | (matches = []); |
| 2092 | for ( |
| 2093 | var ndx1 = 0; |
| 2094 | ndx1 < maltMatches.length; |
| 2095 | ndx1++ |
| 2096 | ) { |
| 2097 | var altMatch = |
| 2098 | maltMatches[ndx1], |
| 2099 | dropMatch = !1; |
| 2100 | (altMatch.match.jit = |
| 2101 | altMatch.match.jit || |
| 2102 | unMatchedAlternation), |
| 2103 | (altMatch.alternation = |
| 2104 | altMatch.alternation || |
| 2105 | loopNdxCnt), |
| 2106 | setMergeLocators( |
| 2107 | altMatch |
| 2108 | ); |
| 2109 | for ( |
| 2110 | var ndx2 = 0; |
| 2111 | ndx2 < |
| 2112 | malternateMatches.length; |
| 2113 | ndx2++ |
| 2114 | ) { |
| 2115 | var altMatch2 = |
| 2116 | malternateMatches[ |
| 2117 | ndx2 |
| 2118 | ]; |
| 2119 | if ( |
| 2120 | "string" != |
| 2121 | typeof altIndex || |
| 2122 | (void 0 !== |
| 2123 | altMatch.alternation && |
| 2124 | -1 !== |
| 2125 | $.inArray( |
| 2126 | altMatch.locator[ |
| 2127 | altMatch |
| 2128 | .alternation |
| 2129 | ].toString(), |
| 2130 | altIndexArr |
| 2131 | )) |
| 2132 | ) { |
| 2133 | if ( |
| 2134 | altMatch.match |
| 2135 | .nativeDef === |
| 2136 | altMatch2.match |
| 2137 | .nativeDef |
| 2138 | ) { |
| 2139 | (dropMatch = |
| 2140 | !0), |
| 2141 | setMergeLocators( |
| 2142 | altMatch2, |
| 2143 | altMatch |
| 2144 | ); |
| 2145 | break; |
| 2146 | } |
| 2147 | if ( |
| 2148 | isSubsetOf( |
| 2149 | altMatch, |
| 2150 | altMatch2 |
| 2151 | ) |
| 2152 | ) { |
| 2153 | setMergeLocators( |
| 2154 | altMatch, |
| 2155 | altMatch2 |
| 2156 | ) && |
| 2157 | ((dropMatch = |
| 2158 | !0), |
| 2159 | malternateMatches.splice( |
| 2160 | malternateMatches.indexOf( |
| 2161 | altMatch2 |
| 2162 | ), |
| 2163 | 0, |
| 2164 | altMatch |
| 2165 | )); |
| 2166 | break; |
| 2167 | } |
| 2168 | if ( |
| 2169 | isSubsetOf( |
| 2170 | altMatch2, |
| 2171 | altMatch |
| 2172 | ) |
| 2173 | ) { |
| 2174 | setMergeLocators( |
| 2175 | altMatch2, |
| 2176 | altMatch |
| 2177 | ); |
| 2178 | break; |
| 2179 | } |
| 2180 | if ( |
| 2181 | staticCanMatchDefinition( |
| 2182 | altMatch, |
| 2183 | altMatch2 |
| 2184 | ) |
| 2185 | ) { |
| 2186 | isSameLevel( |
| 2187 | altMatch, |
| 2188 | altMatch2 |
| 2189 | ) || |
| 2190 | void 0 !== |
| 2191 | el.inputmask |
| 2192 | .userOptions |
| 2193 | .keepStatic |
| 2194 | ? setMergeLocators( |
| 2195 | altMatch, |
| 2196 | altMatch2 |
| 2197 | ) && |
| 2198 | ((dropMatch = |
| 2199 | !0), |
| 2200 | malternateMatches.splice( |
| 2201 | malternateMatches.indexOf( |
| 2202 | altMatch2 |
| 2203 | ), |
| 2204 | 0, |
| 2205 | altMatch |
| 2206 | )) |
| 2207 | : (opts.keepStatic = |
| 2208 | !0); |
| 2209 | break; |
| 2210 | } |
| 2211 | } |
| 2212 | } |
| 2213 | dropMatch || |
| 2214 | malternateMatches.push( |
| 2215 | altMatch |
| 2216 | ); |
| 2217 | } |
| 2218 | } |
| 2219 | (matches = |
| 2220 | currentMatches.concat( |
| 2221 | malternateMatches |
| 2222 | )), |
| 2223 | (testPos = pos), |
| 2224 | (insertStop = |
| 2225 | 0 < matches.length), |
| 2226 | (match = |
| 2227 | 0 < |
| 2228 | malternateMatches.length), |
| 2229 | (ndxInitializer = |
| 2230 | ndxInitializerClone.slice()); |
| 2231 | } else |
| 2232 | match = handleMatch( |
| 2233 | alternateToken.matches[ |
| 2234 | altIndex |
| 2235 | ] || |
| 2236 | maskToken.matches[altIndex], |
| 2237 | [altIndex].concat(loopNdx), |
| 2238 | quantifierRecurse |
| 2239 | ); |
| 2240 | if (match) return !0; |
| 2241 | } else if ( |
| 2242 | match.isQuantifier && |
| 2243 | quantifierRecurse !== |
| 2244 | maskToken.matches[ |
| 2245 | $.inArray( |
| 2246 | match, |
| 2247 | maskToken.matches |
| 2248 | ) - 1 |
| 2249 | ] |
| 2250 | ) |
| 2251 | for ( |
| 2252 | var qt = match, |
| 2253 | qndx = |
| 2254 | 0 < ndxInitializer.length |
| 2255 | ? ndxInitializer.shift() |
| 2256 | : 0; |
| 2257 | qndx < |
| 2258 | (isNaN(qt.quantifier.max) |
| 2259 | ? qndx + 1 |
| 2260 | : qt.quantifier.max) && |
| 2261 | testPos <= pos; |
| 2262 | qndx++ |
| 2263 | ) { |
| 2264 | var tokenGroup = |
| 2265 | maskToken.matches[ |
| 2266 | $.inArray( |
| 2267 | qt, |
| 2268 | maskToken.matches |
| 2269 | ) - 1 |
| 2270 | ]; |
| 2271 | if ( |
| 2272 | ((match = handleMatch( |
| 2273 | tokenGroup, |
| 2274 | [qndx].concat(loopNdx), |
| 2275 | tokenGroup |
| 2276 | )), |
| 2277 | match) |
| 2278 | ) { |
| 2279 | if ( |
| 2280 | ((latestMatch = |
| 2281 | matches[ |
| 2282 | matches.length - 1 |
| 2283 | ].match), |
| 2284 | (latestMatch.optionalQuantifier = |
| 2285 | qndx >= |
| 2286 | qt.quantifier.min), |
| 2287 | (latestMatch.jit = |
| 2288 | (qndx || 1) * |
| 2289 | tokenGroup.matches.indexOf( |
| 2290 | latestMatch |
| 2291 | ) >= |
| 2292 | qt.quantifier.jit), |
| 2293 | latestMatch.optionalQuantifier && |
| 2294 | isFirstMatch( |
| 2295 | latestMatch, |
| 2296 | tokenGroup |
| 2297 | )) |
| 2298 | ) { |
| 2299 | (insertStop = !0), |
| 2300 | (testPos = pos); |
| 2301 | break; |
| 2302 | } |
| 2303 | return ( |
| 2304 | latestMatch.jit && |
| 2305 | (maskset.jitOffset[ |
| 2306 | pos |
| 2307 | ] = |
| 2308 | tokenGroup.matches |
| 2309 | .length - |
| 2310 | tokenGroup.matches.indexOf( |
| 2311 | latestMatch |
| 2312 | )), |
| 2313 | !0 |
| 2314 | ); |
| 2315 | } |
| 2316 | } |
| 2317 | else if ( |
| 2318 | ((match = resolveTestFromToken( |
| 2319 | match, |
| 2320 | ndxInitializer, |
| 2321 | loopNdx, |
| 2322 | quantifierRecurse |
| 2323 | )), |
| 2324 | match) |
| 2325 | ) |
| 2326 | return !0; |
| 2327 | } else testPos++; |
| 2328 | } |
| 2329 | for ( |
| 2330 | var tndx = |
| 2331 | 0 < ndxInitializer.length |
| 2332 | ? ndxInitializer.shift() |
| 2333 | : 0; |
| 2334 | tndx < maskToken.matches.length; |
| 2335 | tndx++ |
| 2336 | ) |
| 2337 | if ( |
| 2338 | !0 !== maskToken.matches[tndx].isQuantifier |
| 2339 | ) { |
| 2340 | var match = handleMatch( |
| 2341 | maskToken.matches[tndx], |
| 2342 | [tndx].concat(loopNdx), |
| 2343 | quantifierRecurse |
| 2344 | ); |
| 2345 | if (match && testPos === pos) return match; |
| 2346 | if (pos < testPos) break; |
| 2347 | } |
| 2348 | } |
| 2349 | function mergeLocators(pos, tests) { |
| 2350 | var locator = []; |
| 2351 | return ( |
| 2352 | $.isArray(tests) || (tests = [tests]), |
| 2353 | 0 < tests.length && |
| 2354 | (void 0 === tests[0].alternation || |
| 2355 | !0 === opts.keepStatic |
| 2356 | ? ((locator = determineTestTemplate( |
| 2357 | pos, |
| 2358 | tests.slice() |
| 2359 | ).locator.slice()), |
| 2360 | 0 === locator.length && |
| 2361 | (locator = |
| 2362 | tests[0].locator.slice())) |
| 2363 | : $.each(tests, function (ndx, tst) { |
| 2364 | if ("" !== tst.def) |
| 2365 | if (0 === locator.length) |
| 2366 | locator = |
| 2367 | tst.locator.slice(); |
| 2368 | else |
| 2369 | for ( |
| 2370 | var i = 0; |
| 2371 | i < locator.length; |
| 2372 | i++ |
| 2373 | ) |
| 2374 | tst.locator[i] && |
| 2375 | -1 === |
| 2376 | locator[i] |
| 2377 | .toString() |
| 2378 | .indexOf( |
| 2379 | tst |
| 2380 | .locator[ |
| 2381 | i |
| 2382 | ] |
| 2383 | ) && |
| 2384 | (locator[i] += |
| 2385 | "," + |
| 2386 | tst.locator[ |
| 2387 | i |
| 2388 | ]); |
| 2389 | })), |
| 2390 | locator |
| 2391 | ); |
| 2392 | } |
| 2393 | if ( |
| 2394 | -1 < pos && |
| 2395 | (void 0 === maxLength || pos < maxLength) |
| 2396 | ) { |
| 2397 | if (void 0 === ndxIntlzr) { |
| 2398 | for ( |
| 2399 | var previousPos = pos - 1, test; |
| 2400 | void 0 === |
| 2401 | (test = |
| 2402 | maskset.validPositions[ |
| 2403 | previousPos |
| 2404 | ] || maskset.tests[previousPos]) && |
| 2405 | -1 < previousPos; |
| 2406 | |
| 2407 | ) |
| 2408 | previousPos--; |
| 2409 | void 0 !== test && |
| 2410 | -1 < previousPos && |
| 2411 | ((ndxInitializer = mergeLocators( |
| 2412 | previousPos, |
| 2413 | test |
| 2414 | )), |
| 2415 | (cacheDependency = ndxInitializer.join("")), |
| 2416 | (testPos = previousPos)); |
| 2417 | } |
| 2418 | if ( |
| 2419 | maskset.tests[pos] && |
| 2420 | maskset.tests[pos][0].cd === cacheDependency |
| 2421 | ) |
| 2422 | return maskset.tests[pos]; |
| 2423 | for ( |
| 2424 | var mtndx = ndxInitializer.shift(); |
| 2425 | mtndx < maskTokens.length; |
| 2426 | mtndx++ |
| 2427 | ) { |
| 2428 | var match = resolveTestFromToken( |
| 2429 | maskTokens[mtndx], |
| 2430 | ndxInitializer, |
| 2431 | [mtndx] |
| 2432 | ); |
| 2433 | if ((match && testPos === pos) || pos < testPos) |
| 2434 | break; |
| 2435 | } |
| 2436 | } |
| 2437 | return ( |
| 2438 | (0 !== matches.length && !insertStop) || |
| 2439 | matches.push({ |
| 2440 | match: { |
| 2441 | fn: null, |
| 2442 | static: !0, |
| 2443 | optionality: !1, |
| 2444 | casing: null, |
| 2445 | def: "", |
| 2446 | placeholder: "", |
| 2447 | }, |
| 2448 | locator: [], |
| 2449 | mloc: {}, |
| 2450 | cd: cacheDependency, |
| 2451 | }), |
| 2452 | void 0 !== ndxIntlzr && maskset.tests[pos] |
| 2453 | ? $.extend(!0, [], matches) |
| 2454 | : ((maskset.tests[pos] = $.extend( |
| 2455 | !0, |
| 2456 | [], |
| 2457 | matches |
| 2458 | )), |
| 2459 | maskset.tests[pos]) |
| 2460 | ); |
| 2461 | } |
| 2462 | function getBufferTemplate() { |
| 2463 | return ( |
| 2464 | void 0 === maskset._buffer && |
| 2465 | ((maskset._buffer = getMaskTemplate(!1, 1)), |
| 2466 | void 0 === maskset.buffer && |
| 2467 | (maskset.buffer = maskset._buffer.slice())), |
| 2468 | maskset._buffer |
| 2469 | ); |
| 2470 | } |
| 2471 | function getBuffer(noCache) { |
| 2472 | return ( |
| 2473 | (void 0 !== maskset.buffer && !0 !== noCache) || |
| 2474 | ((maskset.buffer = getMaskTemplate( |
| 2475 | !0, |
| 2476 | getLastValidPosition(), |
| 2477 | !0 |
| 2478 | )), |
| 2479 | void 0 === maskset._buffer && |
| 2480 | (maskset._buffer = maskset.buffer.slice())), |
| 2481 | maskset.buffer |
| 2482 | ); |
| 2483 | } |
| 2484 | function refreshFromBuffer(start, end, buffer) { |
| 2485 | var i, |
| 2486 | p, |
| 2487 | skipOptionalPartCharacter = |
| 2488 | opts.skipOptionalPartCharacter, |
| 2489 | bffr = isRTL ? buffer.slice().reverse() : buffer; |
| 2490 | if ( |
| 2491 | ((opts.skipOptionalPartCharacter = ""), |
| 2492 | !0 === start) |
| 2493 | ) |
| 2494 | resetMaskSet(), |
| 2495 | (maskset.tests = {}), |
| 2496 | (start = 0), |
| 2497 | (end = buffer.length), |
| 2498 | (p = determineNewCaretPosition( |
| 2499 | { |
| 2500 | begin: 0, |
| 2501 | end: 0, |
| 2502 | }, |
| 2503 | !1 |
| 2504 | ).begin); |
| 2505 | else { |
| 2506 | for (i = start; i < end; i++) |
| 2507 | delete maskset.validPositions[i]; |
| 2508 | p = start; |
| 2509 | } |
| 2510 | var keypress = new $.Event("keypress"); |
| 2511 | for (i = start; i < end; i++) { |
| 2512 | (keypress.which = bffr[i].toString().charCodeAt(0)), |
| 2513 | (ignorable = !1); |
| 2514 | var valResult = EventHandlers.keypressEvent.call( |
| 2515 | el, |
| 2516 | keypress, |
| 2517 | !0, |
| 2518 | !1, |
| 2519 | !1, |
| 2520 | p |
| 2521 | ); |
| 2522 | !1 !== valResult && (p = valResult.forwardPosition); |
| 2523 | } |
| 2524 | opts.skipOptionalPartCharacter = |
| 2525 | skipOptionalPartCharacter; |
| 2526 | } |
| 2527 | function casing(elem, test, pos) { |
| 2528 | switch (opts.casing || test.casing) { |
| 2529 | case "upper": |
| 2530 | elem = elem.toUpperCase(); |
| 2531 | break; |
| 2532 | |
| 2533 | case "lower": |
| 2534 | elem = elem.toLowerCase(); |
| 2535 | break; |
| 2536 | |
| 2537 | case "title": |
| 2538 | var posBefore = maskset.validPositions[pos - 1]; |
| 2539 | elem = |
| 2540 | 0 === pos || |
| 2541 | (posBefore && |
| 2542 | posBefore.input === |
| 2543 | String.fromCharCode(keyCode.SPACE)) |
| 2544 | ? elem.toUpperCase() |
| 2545 | : elem.toLowerCase(); |
| 2546 | break; |
| 2547 | |
| 2548 | default: |
| 2549 | if ($.isFunction(opts.casing)) { |
| 2550 | var args = |
| 2551 | Array.prototype.slice.call(arguments); |
| 2552 | args.push(maskset.validPositions), |
| 2553 | (elem = opts.casing.apply(this, args)); |
| 2554 | } |
| 2555 | } |
| 2556 | return elem; |
| 2557 | } |
| 2558 | function checkAlternationMatch(altArr1, altArr2, na) { |
| 2559 | for ( |
| 2560 | var altArrC = opts.greedy |
| 2561 | ? altArr2 |
| 2562 | : altArr2.slice(0, 1), |
| 2563 | isMatch = !1, |
| 2564 | naArr = void 0 !== na ? na.split(",") : [], |
| 2565 | naNdx, |
| 2566 | i = 0; |
| 2567 | i < naArr.length; |
| 2568 | i++ |
| 2569 | ) |
| 2570 | -1 !== (naNdx = altArr1.indexOf(naArr[i])) && |
| 2571 | altArr1.splice(naNdx, 1); |
| 2572 | for (var alndx = 0; alndx < altArr1.length; alndx++) |
| 2573 | if (-1 !== $.inArray(altArr1[alndx], altArrC)) { |
| 2574 | isMatch = !0; |
| 2575 | break; |
| 2576 | } |
| 2577 | return isMatch; |
| 2578 | } |
| 2579 | function alternate( |
| 2580 | maskPos, |
| 2581 | c, |
| 2582 | strict, |
| 2583 | fromIsValid, |
| 2584 | rAltPos, |
| 2585 | selection |
| 2586 | ) { |
| 2587 | var validPsClone = $.extend( |
| 2588 | !0, |
| 2589 | {}, |
| 2590 | maskset.validPositions |
| 2591 | ), |
| 2592 | tstClone = $.extend(!0, {}, maskset.tests), |
| 2593 | lastAlt, |
| 2594 | alternation, |
| 2595 | isValidRslt = !1, |
| 2596 | returnRslt = !1, |
| 2597 | altPos, |
| 2598 | prevAltPos, |
| 2599 | i, |
| 2600 | validPos, |
| 2601 | decisionPos, |
| 2602 | lAltPos = |
| 2603 | void 0 !== rAltPos |
| 2604 | ? rAltPos |
| 2605 | : getLastValidPosition(), |
| 2606 | nextPos, |
| 2607 | input, |
| 2608 | begin, |
| 2609 | end; |
| 2610 | if ( |
| 2611 | (selection && |
| 2612 | ((begin = selection.begin), |
| 2613 | (end = selection.end), |
| 2614 | selection.begin > selection.end && |
| 2615 | ((begin = selection.end), |
| 2616 | (end = selection.begin))), |
| 2617 | -1 === lAltPos && void 0 === rAltPos) |
| 2618 | ) |
| 2619 | (lastAlt = 0), |
| 2620 | (prevAltPos = getTest(lastAlt)), |
| 2621 | (alternation = prevAltPos.alternation); |
| 2622 | else |
| 2623 | for (; 0 <= lAltPos; lAltPos--) |
| 2624 | if ( |
| 2625 | ((altPos = maskset.validPositions[lAltPos]), |
| 2626 | altPos && void 0 !== altPos.alternation) |
| 2627 | ) { |
| 2628 | if ( |
| 2629 | prevAltPos && |
| 2630 | prevAltPos.locator[ |
| 2631 | altPos.alternation |
| 2632 | ] !== altPos.locator[altPos.alternation] |
| 2633 | ) |
| 2634 | break; |
| 2635 | (lastAlt = lAltPos), |
| 2636 | (alternation = |
| 2637 | maskset.validPositions[lastAlt] |
| 2638 | .alternation), |
| 2639 | (prevAltPos = altPos); |
| 2640 | } |
| 2641 | if (void 0 !== alternation) { |
| 2642 | (decisionPos = parseInt(lastAlt)), |
| 2643 | (maskset.excludes[decisionPos] = |
| 2644 | maskset.excludes[decisionPos] || []), |
| 2645 | !0 !== maskPos && |
| 2646 | maskset.excludes[decisionPos].push( |
| 2647 | getDecisionTaker(prevAltPos) + |
| 2648 | ":" + |
| 2649 | prevAltPos.alternation |
| 2650 | ); |
| 2651 | var validInputs = [], |
| 2652 | resultPos = -1; |
| 2653 | for ( |
| 2654 | i = decisionPos; |
| 2655 | i < getLastValidPosition(void 0, !0) + 1; |
| 2656 | i++ |
| 2657 | ) |
| 2658 | -1 === resultPos && |
| 2659 | maskPos <= i && |
| 2660 | void 0 !== c && |
| 2661 | (validInputs.push(c), |
| 2662 | (resultPos = validInputs.length - 1)), |
| 2663 | (validPos = maskset.validPositions[i]), |
| 2664 | validPos && |
| 2665 | !0 !== validPos.generatedInput && |
| 2666 | (void 0 === selection || |
| 2667 | i < begin || |
| 2668 | end <= i) && |
| 2669 | validInputs.push(validPos.input), |
| 2670 | delete maskset.validPositions[i]; |
| 2671 | for ( |
| 2672 | -1 === resultPos && |
| 2673 | void 0 !== c && |
| 2674 | (validInputs.push(c), |
| 2675 | (resultPos = validInputs.length - 1)); |
| 2676 | void 0 !== maskset.excludes[decisionPos] && |
| 2677 | maskset.excludes[decisionPos].length < 10; |
| 2678 | |
| 2679 | ) { |
| 2680 | for ( |
| 2681 | maskset.tests = {}, |
| 2682 | resetMaskSet(!0), |
| 2683 | isValidRslt = !0, |
| 2684 | i = 0; |
| 2685 | i < validInputs.length && |
| 2686 | ((nextPos = |
| 2687 | isValidRslt.caret || |
| 2688 | getLastValidPosition(void 0, !0) + 1), |
| 2689 | (input = validInputs[i]), |
| 2690 | (isValidRslt = isValid( |
| 2691 | nextPos, |
| 2692 | input, |
| 2693 | !1, |
| 2694 | fromIsValid, |
| 2695 | !0 |
| 2696 | ))); |
| 2697 | i++ |
| 2698 | ) |
| 2699 | i === resultPos && |
| 2700 | (returnRslt = isValidRslt), |
| 2701 | 1 == maskPos && |
| 2702 | isValidRslt && |
| 2703 | (returnRslt = { |
| 2704 | caretPos: i, |
| 2705 | }); |
| 2706 | if (isValidRslt) break; |
| 2707 | if ( |
| 2708 | (resetMaskSet(), |
| 2709 | (prevAltPos = getTest(decisionPos)), |
| 2710 | (maskset.validPositions = $.extend( |
| 2711 | !0, |
| 2712 | {}, |
| 2713 | validPsClone |
| 2714 | )), |
| 2715 | (maskset.tests = $.extend( |
| 2716 | !0, |
| 2717 | {}, |
| 2718 | tstClone |
| 2719 | )), |
| 2720 | !maskset.excludes[decisionPos]) |
| 2721 | ) { |
| 2722 | returnRslt = alternate( |
| 2723 | maskPos, |
| 2724 | c, |
| 2725 | strict, |
| 2726 | fromIsValid, |
| 2727 | decisionPos - 1, |
| 2728 | selection |
| 2729 | ); |
| 2730 | break; |
| 2731 | } |
| 2732 | var decisionTaker = |
| 2733 | getDecisionTaker(prevAltPos); |
| 2734 | if ( |
| 2735 | -1 !== |
| 2736 | maskset.excludes[decisionPos].indexOf( |
| 2737 | decisionTaker + |
| 2738 | ":" + |
| 2739 | prevAltPos.alternation |
| 2740 | ) |
| 2741 | ) { |
| 2742 | returnRslt = alternate( |
| 2743 | maskPos, |
| 2744 | c, |
| 2745 | strict, |
| 2746 | fromIsValid, |
| 2747 | decisionPos - 1, |
| 2748 | selection |
| 2749 | ); |
| 2750 | break; |
| 2751 | } |
| 2752 | for ( |
| 2753 | maskset.excludes[decisionPos].push( |
| 2754 | decisionTaker + |
| 2755 | ":" + |
| 2756 | prevAltPos.alternation |
| 2757 | ), |
| 2758 | i = decisionPos; |
| 2759 | i < getLastValidPosition(void 0, !0) + 1; |
| 2760 | i++ |
| 2761 | ) |
| 2762 | delete maskset.validPositions[i]; |
| 2763 | } |
| 2764 | } |
| 2765 | return ( |
| 2766 | (returnRslt && !1 === opts.keepStatic) || |
| 2767 | delete maskset.excludes[decisionPos], |
| 2768 | returnRslt |
| 2769 | ); |
| 2770 | } |
| 2771 | function isValid( |
| 2772 | pos, |
| 2773 | c, |
| 2774 | strict, |
| 2775 | fromIsValid, |
| 2776 | fromAlternate, |
| 2777 | validateOnly |
| 2778 | ) { |
| 2779 | function isSelection(posObj) { |
| 2780 | return isRTL |
| 2781 | ? 1 < posObj.begin - posObj.end || |
| 2782 | posObj.begin - posObj.end == 1 |
| 2783 | : 1 < posObj.end - posObj.begin || |
| 2784 | posObj.end - posObj.begin == 1; |
| 2785 | } |
| 2786 | strict = !0 === strict; |
| 2787 | var maskPos = pos; |
| 2788 | function processCommandObject(commandObj) { |
| 2789 | if (void 0 !== commandObj) { |
| 2790 | if ( |
| 2791 | (void 0 !== commandObj.remove && |
| 2792 | ($.isArray(commandObj.remove) || |
| 2793 | (commandObj.remove = [ |
| 2794 | commandObj.remove, |
| 2795 | ]), |
| 2796 | $.each( |
| 2797 | commandObj.remove.sort(function ( |
| 2798 | a, |
| 2799 | b |
| 2800 | ) { |
| 2801 | return b.pos - a.pos; |
| 2802 | }), |
| 2803 | function (ndx, lmnt) { |
| 2804 | revalidateMask({ |
| 2805 | begin: lmnt, |
| 2806 | end: lmnt + 1, |
| 2807 | }); |
| 2808 | } |
| 2809 | ), |
| 2810 | (commandObj.remove = void 0)), |
| 2811 | void 0 !== commandObj.insert && |
| 2812 | ($.isArray(commandObj.insert) || |
| 2813 | (commandObj.insert = [ |
| 2814 | commandObj.insert, |
| 2815 | ]), |
| 2816 | $.each( |
| 2817 | commandObj.insert.sort(function ( |
| 2818 | a, |
| 2819 | b |
| 2820 | ) { |
| 2821 | return a.pos - b.pos; |
| 2822 | }), |
| 2823 | function (ndx, lmnt) { |
| 2824 | "" !== lmnt.c && |
| 2825 | isValid( |
| 2826 | lmnt.pos, |
| 2827 | lmnt.c, |
| 2828 | void 0 === |
| 2829 | lmnt.strict || |
| 2830 | lmnt.strict, |
| 2831 | void 0 !== |
| 2832 | lmnt.fromIsValid |
| 2833 | ? lmnt.fromIsValid |
| 2834 | : fromIsValid |
| 2835 | ); |
| 2836 | } |
| 2837 | ), |
| 2838 | (commandObj.insert = void 0)), |
| 2839 | commandObj.refreshFromBuffer && |
| 2840 | commandObj.buffer) |
| 2841 | ) { |
| 2842 | var refresh = commandObj.refreshFromBuffer; |
| 2843 | refreshFromBuffer( |
| 2844 | !0 === refresh |
| 2845 | ? refresh |
| 2846 | : refresh.start, |
| 2847 | refresh.end, |
| 2848 | commandObj.buffer |
| 2849 | ), |
| 2850 | (commandObj.refreshFromBuffer = void 0); |
| 2851 | } |
| 2852 | void 0 !== commandObj.rewritePosition && |
| 2853 | ((maskPos = commandObj.rewritePosition), |
| 2854 | (commandObj = !0)); |
| 2855 | } |
| 2856 | return commandObj; |
| 2857 | } |
| 2858 | function _isValid(position, c, strict) { |
| 2859 | var rslt = !1; |
| 2860 | return ( |
| 2861 | $.each(getTests(position), function (ndx, tst) { |
| 2862 | var test = tst.match; |
| 2863 | if ( |
| 2864 | (getBuffer(!0), |
| 2865 | (rslt = |
| 2866 | null != test.fn |
| 2867 | ? test.fn.test( |
| 2868 | c, |
| 2869 | maskset, |
| 2870 | position, |
| 2871 | strict, |
| 2872 | opts, |
| 2873 | isSelection(pos) |
| 2874 | ) |
| 2875 | : (c === test.def || |
| 2876 | c === |
| 2877 | opts.skipOptionalPartCharacter) && |
| 2878 | "" !== test.def && { |
| 2879 | c: |
| 2880 | getPlaceholder( |
| 2881 | position, |
| 2882 | test, |
| 2883 | !0 |
| 2884 | ) || test.def, |
| 2885 | pos: position, |
| 2886 | }), |
| 2887 | !1 !== rslt) |
| 2888 | ) { |
| 2889 | var elem = |
| 2890 | void 0 !== rslt.c ? rslt.c : c, |
| 2891 | validatedPos = position; |
| 2892 | return ( |
| 2893 | (elem = |
| 2894 | elem === |
| 2895 | opts.skipOptionalPartCharacter && |
| 2896 | !0 === test.static |
| 2897 | ? getPlaceholder( |
| 2898 | position, |
| 2899 | test, |
| 2900 | !0 |
| 2901 | ) || test.def |
| 2902 | : elem), |
| 2903 | (rslt = processCommandObject(rslt)), |
| 2904 | !0 !== rslt && |
| 2905 | void 0 !== rslt.pos && |
| 2906 | rslt.pos !== position && |
| 2907 | (validatedPos = rslt.pos), |
| 2908 | !0 !== rslt && |
| 2909 | void 0 === rslt.pos && |
| 2910 | void 0 === rslt.c |
| 2911 | ? !1 |
| 2912 | : (!1 === |
| 2913 | revalidateMask( |
| 2914 | pos, |
| 2915 | $.extend({}, tst, { |
| 2916 | input: casing( |
| 2917 | elem, |
| 2918 | test, |
| 2919 | validatedPos |
| 2920 | ), |
| 2921 | }), |
| 2922 | fromIsValid, |
| 2923 | validatedPos |
| 2924 | ) && (rslt = !1), |
| 2925 | !1) |
| 2926 | ); |
| 2927 | } |
| 2928 | }), |
| 2929 | rslt |
| 2930 | ); |
| 2931 | } |
| 2932 | void 0 !== pos.begin && |
| 2933 | (maskPos = isRTL ? pos.end : pos.begin); |
| 2934 | var result = !0, |
| 2935 | positionsClone = $.extend( |
| 2936 | !0, |
| 2937 | {}, |
| 2938 | maskset.validPositions |
| 2939 | ); |
| 2940 | if ( |
| 2941 | !1 === opts.keepStatic && |
| 2942 | void 0 !== maskset.excludes[maskPos] && |
| 2943 | !0 !== fromAlternate && |
| 2944 | !0 !== fromIsValid |
| 2945 | ) |
| 2946 | for ( |
| 2947 | var i = maskPos; |
| 2948 | i < (isRTL ? pos.begin : pos.end); |
| 2949 | i++ |
| 2950 | ) |
| 2951 | void 0 !== maskset.excludes[i] && |
| 2952 | ((maskset.excludes[i] = void 0), |
| 2953 | delete maskset.tests[i]); |
| 2954 | if ( |
| 2955 | ($.isFunction(opts.preValidation) && |
| 2956 | !0 !== fromIsValid && |
| 2957 | !0 !== validateOnly && |
| 2958 | ((result = opts.preValidation.call( |
| 2959 | el, |
| 2960 | getBuffer(), |
| 2961 | maskPos, |
| 2962 | c, |
| 2963 | isSelection(pos), |
| 2964 | opts, |
| 2965 | maskset, |
| 2966 | pos, |
| 2967 | strict || fromAlternate |
| 2968 | )), |
| 2969 | (result = processCommandObject(result))), |
| 2970 | !0 === result) |
| 2971 | ) { |
| 2972 | if (void 0 === maxLength || maskPos < maxLength) { |
| 2973 | if ( |
| 2974 | ((result = _isValid(maskPos, c, strict)), |
| 2975 | (!strict || !0 === fromIsValid) && |
| 2976 | !1 === result && |
| 2977 | !0 !== validateOnly) |
| 2978 | ) { |
| 2979 | var currentPosValid = |
| 2980 | maskset.validPositions[maskPos]; |
| 2981 | if ( |
| 2982 | !currentPosValid || |
| 2983 | !0 !== currentPosValid.match.static || |
| 2984 | (currentPosValid.match.def !== c && |
| 2985 | c !== |
| 2986 | opts.skipOptionalPartCharacter) |
| 2987 | ) { |
| 2988 | if ( |
| 2989 | opts.insertMode || |
| 2990 | void 0 === |
| 2991 | maskset.validPositions[ |
| 2992 | seekNext(maskPos) |
| 2993 | ] || |
| 2994 | pos.end > maskPos |
| 2995 | ) { |
| 2996 | var skip = !1; |
| 2997 | if ( |
| 2998 | (maskset.jitOffset[maskPos] && |
| 2999 | void 0 === |
| 3000 | maskset.validPositions[ |
| 3001 | seekNext(maskPos) |
| 3002 | ] && |
| 3003 | ((result = isValid( |
| 3004 | maskPos + |
| 3005 | maskset.jitOffset[ |
| 3006 | maskPos |
| 3007 | ], |
| 3008 | c, |
| 3009 | !0 |
| 3010 | )), |
| 3011 | !1 !== result && |
| 3012 | (!0 !== fromAlternate && |
| 3013 | (result.caret = |
| 3014 | maskPos), |
| 3015 | (skip = !0))), |
| 3016 | pos.end > maskPos && |
| 3017 | (maskset.validPositions[ |
| 3018 | maskPos |
| 3019 | ] = void 0), |
| 3020 | !skip && |
| 3021 | !isMask( |
| 3022 | maskPos, |
| 3023 | opts.keepStatic |
| 3024 | )) |
| 3025 | ) |
| 3026 | for ( |
| 3027 | var nPos = maskPos + 1, |
| 3028 | snPos = |
| 3029 | seekNext(maskPos); |
| 3030 | nPos <= snPos; |
| 3031 | nPos++ |
| 3032 | ) |
| 3033 | if ( |
| 3034 | ((result = _isValid( |
| 3035 | nPos, |
| 3036 | c, |
| 3037 | strict |
| 3038 | )), |
| 3039 | !1 !== result) |
| 3040 | ) { |
| 3041 | (result = |
| 3042 | trackbackPositions( |
| 3043 | maskPos, |
| 3044 | void 0 !== |
| 3045 | result.pos |
| 3046 | ? result.pos |
| 3047 | : nPos |
| 3048 | ) || result), |
| 3049 | (maskPos = nPos); |
| 3050 | break; |
| 3051 | } |
| 3052 | } |
| 3053 | } else |
| 3054 | result = { |
| 3055 | caret: seekNext(maskPos), |
| 3056 | }; |
| 3057 | } |
| 3058 | } else result = !1; |
| 3059 | !1 !== result || |
| 3060 | !opts.keepStatic || |
| 3061 | (!isComplete(getBuffer()) && 0 !== maskPos) || |
| 3062 | strict || |
| 3063 | !0 === fromAlternate |
| 3064 | ? isSelection(pos) && |
| 3065 | maskset.tests[maskPos] && |
| 3066 | 1 < maskset.tests[maskPos].length && |
| 3067 | opts.keepStatic && |
| 3068 | !strict && |
| 3069 | !0 !== fromAlternate && |
| 3070 | (result = alternate(!0)) |
| 3071 | : (result = alternate( |
| 3072 | maskPos, |
| 3073 | c, |
| 3074 | strict, |
| 3075 | fromIsValid, |
| 3076 | void 0, |
| 3077 | pos |
| 3078 | )), |
| 3079 | !0 === result && |
| 3080 | (result = { |
| 3081 | pos: maskPos, |
| 3082 | }); |
| 3083 | } |
| 3084 | if ( |
| 3085 | $.isFunction(opts.postValidation) && |
| 3086 | !0 !== fromIsValid && |
| 3087 | !0 !== validateOnly |
| 3088 | ) { |
| 3089 | var postResult = opts.postValidation.call( |
| 3090 | el, |
| 3091 | getBuffer(!0), |
| 3092 | void 0 !== pos.begin |
| 3093 | ? isRTL |
| 3094 | ? pos.end |
| 3095 | : pos.begin |
| 3096 | : pos, |
| 3097 | c, |
| 3098 | result, |
| 3099 | opts, |
| 3100 | maskset, |
| 3101 | strict |
| 3102 | ); |
| 3103 | void 0 !== postResult && |
| 3104 | (result = |
| 3105 | !0 === postResult ? result : postResult); |
| 3106 | } |
| 3107 | result && |
| 3108 | void 0 === result.pos && |
| 3109 | (result.pos = maskPos), |
| 3110 | !1 === result || !0 === validateOnly |
| 3111 | ? (resetMaskSet(!0), |
| 3112 | (maskset.validPositions = $.extend( |
| 3113 | !0, |
| 3114 | {}, |
| 3115 | positionsClone |
| 3116 | ))) |
| 3117 | : trackbackPositions(void 0, maskPos, !0); |
| 3118 | var endResult = processCommandObject(result); |
| 3119 | return endResult; |
| 3120 | } |
| 3121 | function trackbackPositions(originalPos, newPos, fillOnly) { |
| 3122 | if (void 0 === originalPos) |
| 3123 | for ( |
| 3124 | originalPos = newPos - 1; |
| 3125 | 0 < originalPos && |
| 3126 | !maskset.validPositions[originalPos]; |
| 3127 | originalPos-- |
| 3128 | ); |
| 3129 | for (var ps = originalPos; ps < newPos; ps++) |
| 3130 | if ( |
| 3131 | void 0 === maskset.validPositions[ps] && |
| 3132 | !isMask(ps, !0) |
| 3133 | ) { |
| 3134 | var vp = |
| 3135 | 0 == ps |
| 3136 | ? getTest(ps) |
| 3137 | : maskset.validPositions[ps - 1]; |
| 3138 | if (vp) { |
| 3139 | var tests = getTests(ps).slice(); |
| 3140 | "" === tests[tests.length - 1].match.def && |
| 3141 | tests.pop(); |
| 3142 | var bestMatch = determineTestTemplate( |
| 3143 | ps, |
| 3144 | tests |
| 3145 | ), |
| 3146 | np; |
| 3147 | if ( |
| 3148 | bestMatch && |
| 3149 | (!0 !== bestMatch.match.jit || |
| 3150 | ("master" === |
| 3151 | bestMatch.match |
| 3152 | .newBlockMarker && |
| 3153 | (np = |
| 3154 | maskset.validPositions[ |
| 3155 | ps + 1 |
| 3156 | ]) && |
| 3157 | !0 === |
| 3158 | np.match |
| 3159 | .optionalQuantifier)) && |
| 3160 | ((bestMatch = $.extend({}, bestMatch, { |
| 3161 | input: |
| 3162 | getPlaceholder( |
| 3163 | ps, |
| 3164 | bestMatch.match, |
| 3165 | !0 |
| 3166 | ) || bestMatch.match.def, |
| 3167 | })), |
| 3168 | (bestMatch.generatedInput = !0), |
| 3169 | revalidateMask(ps, bestMatch, !0), |
| 3170 | !0 !== fillOnly) |
| 3171 | ) { |
| 3172 | var cvpInput = |
| 3173 | maskset.validPositions[newPos] |
| 3174 | .input; |
| 3175 | return ( |
| 3176 | (maskset.validPositions[newPos] = |
| 3177 | void 0), |
| 3178 | isValid(newPos, cvpInput, !0, !0) |
| 3179 | ); |
| 3180 | } |
| 3181 | } |
| 3182 | } |
| 3183 | } |
| 3184 | function revalidateMask( |
| 3185 | pos, |
| 3186 | validTest, |
| 3187 | fromIsValid, |
| 3188 | validatedPos |
| 3189 | ) { |
| 3190 | function IsEnclosedStatic(pos, valids, selection) { |
| 3191 | var posMatch = valids[pos]; |
| 3192 | if ( |
| 3193 | void 0 === posMatch || |
| 3194 | !0 !== posMatch.match.static || |
| 3195 | !0 === posMatch.match.optionality || |
| 3196 | (void 0 !== valids[0] && |
| 3197 | void 0 !== valids[0].alternation) |
| 3198 | ) |
| 3199 | return !1; |
| 3200 | var prevMatch = |
| 3201 | selection.begin <= pos - 1 |
| 3202 | ? valids[pos - 1] && |
| 3203 | !0 === valids[pos - 1].match.static && |
| 3204 | valids[pos - 1] |
| 3205 | : valids[pos - 1], |
| 3206 | nextMatch = |
| 3207 | selection.end > pos + 1 |
| 3208 | ? valids[pos + 1] && |
| 3209 | !0 === valids[pos + 1].match.static && |
| 3210 | valids[pos + 1] |
| 3211 | : valids[pos + 1]; |
| 3212 | return prevMatch && nextMatch; |
| 3213 | } |
| 3214 | var offset = 0, |
| 3215 | begin = void 0 !== pos.begin ? pos.begin : pos, |
| 3216 | end = void 0 !== pos.end ? pos.end : pos; |
| 3217 | if ( |
| 3218 | (pos.begin > pos.end && |
| 3219 | ((begin = pos.end), (end = pos.begin)), |
| 3220 | (validatedPos = |
| 3221 | void 0 !== validatedPos ? validatedPos : begin), |
| 3222 | begin !== end || |
| 3223 | (opts.insertMode && |
| 3224 | void 0 !== |
| 3225 | maskset.validPositions[validatedPos] && |
| 3226 | void 0 === fromIsValid) || |
| 3227 | void 0 === validTest) |
| 3228 | ) { |
| 3229 | var positionsClone = $.extend( |
| 3230 | !0, |
| 3231 | {}, |
| 3232 | maskset.validPositions |
| 3233 | ), |
| 3234 | lvp = getLastValidPosition(void 0, !0), |
| 3235 | i; |
| 3236 | for (maskset.p = begin, i = lvp; begin <= i; i--) |
| 3237 | delete maskset.validPositions[i], |
| 3238 | void 0 === validTest && |
| 3239 | delete maskset.tests[i + 1]; |
| 3240 | var valid = !0, |
| 3241 | j = validatedPos, |
| 3242 | posMatch = j, |
| 3243 | t, |
| 3244 | canMatch; |
| 3245 | for ( |
| 3246 | validTest && |
| 3247 | ((maskset.validPositions[validatedPos] = |
| 3248 | $.extend(!0, {}, validTest)), |
| 3249 | posMatch++, |
| 3250 | j++), |
| 3251 | i = validTest ? end : end - 1; |
| 3252 | i <= lvp; |
| 3253 | i++ |
| 3254 | ) { |
| 3255 | if ( |
| 3256 | void 0 !== (t = positionsClone[i]) && |
| 3257 | !0 !== t.generatedInput && |
| 3258 | (end <= i || |
| 3259 | (begin <= i && |
| 3260 | IsEnclosedStatic( |
| 3261 | i, |
| 3262 | positionsClone, |
| 3263 | { |
| 3264 | begin: begin, |
| 3265 | end: end, |
| 3266 | } |
| 3267 | ))) |
| 3268 | ) { |
| 3269 | for ( |
| 3270 | ; |
| 3271 | "" !== getTest(posMatch).match.def; |
| 3272 | |
| 3273 | ) { |
| 3274 | if ( |
| 3275 | !1 !== |
| 3276 | (canMatch = |
| 3277 | positionCanMatchDefinition( |
| 3278 | posMatch, |
| 3279 | t, |
| 3280 | opts |
| 3281 | )) || |
| 3282 | "+" === t.match.def |
| 3283 | ) { |
| 3284 | "+" === t.match.def && |
| 3285 | getBuffer(!0); |
| 3286 | var result = isValid( |
| 3287 | posMatch, |
| 3288 | t.input, |
| 3289 | "+" !== t.match.def, |
| 3290 | "+" !== t.match.def |
| 3291 | ); |
| 3292 | if ( |
| 3293 | ((valid = !1 !== result), |
| 3294 | (j = |
| 3295 | (result.pos || posMatch) + |
| 3296 | 1), |
| 3297 | !valid && canMatch) |
| 3298 | ) |
| 3299 | break; |
| 3300 | } else valid = !1; |
| 3301 | if (valid) { |
| 3302 | void 0 === validTest && |
| 3303 | t.match.static && |
| 3304 | i === pos.begin && |
| 3305 | offset++; |
| 3306 | break; |
| 3307 | } |
| 3308 | if ( |
| 3309 | !valid && |
| 3310 | posMatch > maskset.maskLength |
| 3311 | ) |
| 3312 | break; |
| 3313 | posMatch++; |
| 3314 | } |
| 3315 | "" == getTest(posMatch).match.def && |
| 3316 | (valid = !1), |
| 3317 | (posMatch = j); |
| 3318 | } |
| 3319 | if (!valid) break; |
| 3320 | } |
| 3321 | if (!valid) |
| 3322 | return ( |
| 3323 | (maskset.validPositions = $.extend( |
| 3324 | !0, |
| 3325 | {}, |
| 3326 | positionsClone |
| 3327 | )), |
| 3328 | resetMaskSet(!0), |
| 3329 | !1 |
| 3330 | ); |
| 3331 | } else |
| 3332 | validTest && |
| 3333 | getTest(validatedPos).match.cd === |
| 3334 | validTest.match.cd && |
| 3335 | (maskset.validPositions[validatedPos] = |
| 3336 | $.extend(!0, {}, validTest)); |
| 3337 | return resetMaskSet(!0), offset; |
| 3338 | } |
| 3339 | function isMask(pos, strict, fuzzy) { |
| 3340 | var test = getTestTemplate(pos).match; |
| 3341 | if ( |
| 3342 | ("" === test.def && (test = getTest(pos).match), |
| 3343 | !0 !== test.static) |
| 3344 | ) |
| 3345 | return test.fn; |
| 3346 | if ( |
| 3347 | !0 === fuzzy && |
| 3348 | void 0 !== maskset.validPositions[pos] && |
| 3349 | !0 !== maskset.validPositions[pos].generatedInput |
| 3350 | ) |
| 3351 | return !0; |
| 3352 | if (!0 !== strict && -1 < pos) { |
| 3353 | if (fuzzy) { |
| 3354 | var tests = getTests(pos); |
| 3355 | return ( |
| 3356 | tests.length > |
| 3357 | 1 + |
| 3358 | ("" === |
| 3359 | tests[tests.length - 1].match.def |
| 3360 | ? 1 |
| 3361 | : 0) |
| 3362 | ); |
| 3363 | } |
| 3364 | var testTemplate = determineTestTemplate( |
| 3365 | pos, |
| 3366 | getTests(pos) |
| 3367 | ), |
| 3368 | testPlaceHolder = getPlaceholder( |
| 3369 | pos, |
| 3370 | testTemplate.match |
| 3371 | ); |
| 3372 | return testTemplate.match.def !== testPlaceHolder; |
| 3373 | } |
| 3374 | return !1; |
| 3375 | } |
| 3376 | function seekNext(pos, newBlock, fuzzy) { |
| 3377 | void 0 === fuzzy && (fuzzy = !0); |
| 3378 | for ( |
| 3379 | var position = pos + 1; |
| 3380 | "" !== getTest(position).match.def && |
| 3381 | ((!0 === newBlock && |
| 3382 | (!0 !== |
| 3383 | getTest(position).match.newBlockMarker || |
| 3384 | !isMask(position, void 0, !0))) || |
| 3385 | (!0 !== newBlock && |
| 3386 | !isMask(position, void 0, fuzzy))); |
| 3387 | |
| 3388 | ) |
| 3389 | position++; |
| 3390 | return position; |
| 3391 | } |
| 3392 | function seekPrevious(pos, newBlock) { |
| 3393 | var position = pos, |
| 3394 | tests; |
| 3395 | if (position <= 0) return 0; |
| 3396 | for ( |
| 3397 | ; |
| 3398 | 0 < --position && |
| 3399 | ((!0 === newBlock && |
| 3400 | !0 !== |
| 3401 | getTest(position).match.newBlockMarker) || |
| 3402 | (!0 !== newBlock && |
| 3403 | !isMask(position, void 0, !0) && |
| 3404 | ((tests = getTests(position)), |
| 3405 | tests.length < 2 || |
| 3406 | (2 === tests.length && |
| 3407 | "" === tests[1].match.def)))); |
| 3408 | |
| 3409 | ); |
| 3410 | return position; |
| 3411 | } |
| 3412 | function writeBuffer( |
| 3413 | input, |
| 3414 | buffer, |
| 3415 | caretPos, |
| 3416 | event, |
| 3417 | triggerEvents |
| 3418 | ) { |
| 3419 | if (event && $.isFunction(opts.onBeforeWrite)) { |
| 3420 | var result = opts.onBeforeWrite.call( |
| 3421 | inputmask, |
| 3422 | event, |
| 3423 | buffer, |
| 3424 | caretPos, |
| 3425 | opts |
| 3426 | ); |
| 3427 | if (result) { |
| 3428 | if (result.refreshFromBuffer) { |
| 3429 | var refresh = result.refreshFromBuffer; |
| 3430 | refreshFromBuffer( |
| 3431 | !0 === refresh |
| 3432 | ? refresh |
| 3433 | : refresh.start, |
| 3434 | refresh.end, |
| 3435 | result.buffer || buffer |
| 3436 | ), |
| 3437 | (buffer = getBuffer(!0)); |
| 3438 | } |
| 3439 | void 0 !== caretPos && |
| 3440 | (caretPos = |
| 3441 | void 0 !== result.caret |
| 3442 | ? result.caret |
| 3443 | : caretPos); |
| 3444 | } |
| 3445 | } |
| 3446 | if ( |
| 3447 | void 0 !== input && |
| 3448 | (input.inputmask._valueSet(buffer.join("")), |
| 3449 | void 0 === caretPos || |
| 3450 | (void 0 !== event && "blur" === event.type) || |
| 3451 | caret( |
| 3452 | input, |
| 3453 | caretPos, |
| 3454 | void 0, |
| 3455 | void 0, |
| 3456 | void 0 !== event && |
| 3457 | "keydown" === event.type && |
| 3458 | (event.keyCode === keyCode.DELETE || |
| 3459 | event.keyCode === keyCode.BACKSPACE) |
| 3460 | ), |
| 3461 | !0 === triggerEvents) |
| 3462 | ) { |
| 3463 | var $input = $(input), |
| 3464 | nptVal = input.inputmask._valueGet(); |
| 3465 | (skipInputEvent = !0), |
| 3466 | $input.trigger("input"), |
| 3467 | setTimeout(function () { |
| 3468 | nptVal === getBufferTemplate().join("") |
| 3469 | ? $input.trigger("cleared") |
| 3470 | : !0 === isComplete(buffer) && |
| 3471 | $input.trigger("complete"); |
| 3472 | }, 0); |
| 3473 | } |
| 3474 | } |
| 3475 | function getPlaceholder(pos, test, returnPL) { |
| 3476 | if ( |
| 3477 | ((test = test || getTest(pos).match), |
| 3478 | void 0 !== test.placeholder || !0 === returnPL) |
| 3479 | ) |
| 3480 | return $.isFunction(test.placeholder) |
| 3481 | ? test.placeholder(opts) |
| 3482 | : test.placeholder; |
| 3483 | if (!0 !== test.static) |
| 3484 | return opts.placeholder.charAt( |
| 3485 | pos % opts.placeholder.length |
| 3486 | ); |
| 3487 | if ( |
| 3488 | -1 < pos && |
| 3489 | void 0 === maskset.validPositions[pos] |
| 3490 | ) { |
| 3491 | var tests = getTests(pos), |
| 3492 | staticAlternations = [], |
| 3493 | prevTest; |
| 3494 | if ( |
| 3495 | tests.length > |
| 3496 | 1 + |
| 3497 | ("" === tests[tests.length - 1].match.def |
| 3498 | ? 1 |
| 3499 | : 0) |
| 3500 | ) |
| 3501 | for (var i = 0; i < tests.length; i++) |
| 3502 | if ( |
| 3503 | "" !== tests[i].match.def && |
| 3504 | !0 !== tests[i].match.optionality && |
| 3505 | !0 !== |
| 3506 | tests[i].match.optionalQuantifier && |
| 3507 | (!0 === tests[i].match.static || |
| 3508 | void 0 === prevTest || |
| 3509 | !1 !== |
| 3510 | tests[i].match.fn.test( |
| 3511 | prevTest.match.def, |
| 3512 | maskset, |
| 3513 | pos, |
| 3514 | !0, |
| 3515 | opts |
| 3516 | )) && |
| 3517 | (staticAlternations.push(tests[i]), |
| 3518 | !0 === tests[i].match.static && |
| 3519 | (prevTest = tests[i]), |
| 3520 | 1 < staticAlternations.length && |
| 3521 | /[0-9a-bA-Z]/.test( |
| 3522 | staticAlternations[0].match.def |
| 3523 | )) |
| 3524 | ) |
| 3525 | return opts.placeholder.charAt( |
| 3526 | pos % opts.placeholder.length |
| 3527 | ); |
| 3528 | } |
| 3529 | return test.def; |
| 3530 | } |
| 3531 | function HandleNativePlaceholder(npt, value) { |
| 3532 | if (ie) { |
| 3533 | if ( |
| 3534 | npt.inputmask._valueGet() !== value && |
| 3535 | (npt.placeholder !== value || |
| 3536 | "" === npt.placeholder) |
| 3537 | ) { |
| 3538 | var buffer = getBuffer().slice(), |
| 3539 | nptValue = npt.inputmask._valueGet(); |
| 3540 | if (nptValue !== value) { |
| 3541 | var lvp = getLastValidPosition(); |
| 3542 | -1 === lvp && |
| 3543 | nptValue === getBufferTemplate().join("") |
| 3544 | ? (buffer = []) |
| 3545 | : -1 !== lvp && |
| 3546 | clearOptionalTail(buffer), |
| 3547 | writeBuffer(npt, buffer); |
| 3548 | } |
| 3549 | } |
| 3550 | } else |
| 3551 | npt.placeholder !== value && |
| 3552 | ((npt.placeholder = value), |
| 3553 | "" === npt.placeholder && |
| 3554 | npt.removeAttribute("placeholder")); |
| 3555 | } |
| 3556 | function determineNewCaretPosition(selectedCaret, tabbed) { |
| 3557 | function doRadixFocus(clickPos) { |
| 3558 | if ("" !== opts.radixPoint && 0 !== opts.digits) { |
| 3559 | var vps = maskset.validPositions; |
| 3560 | if ( |
| 3561 | void 0 === vps[clickPos] || |
| 3562 | vps[clickPos].input === |
| 3563 | getPlaceholder(clickPos) |
| 3564 | ) { |
| 3565 | if (clickPos < seekNext(-1)) return !0; |
| 3566 | var radixPos = $.inArray( |
| 3567 | opts.radixPoint, |
| 3568 | getBuffer() |
| 3569 | ); |
| 3570 | if (-1 !== radixPos) { |
| 3571 | for (var vp in vps) |
| 3572 | if ( |
| 3573 | vps[vp] && |
| 3574 | radixPos < vp && |
| 3575 | vps[vp].input !== |
| 3576 | getPlaceholder(vp) |
| 3577 | ) |
| 3578 | return !1; |
| 3579 | return !0; |
| 3580 | } |
| 3581 | } |
| 3582 | } |
| 3583 | return !1; |
| 3584 | } |
| 3585 | if ( |
| 3586 | (tabbed && |
| 3587 | (isRTL |
| 3588 | ? (selectedCaret.end = selectedCaret.begin) |
| 3589 | : (selectedCaret.begin = |
| 3590 | selectedCaret.end)), |
| 3591 | selectedCaret.begin === selectedCaret.end) |
| 3592 | ) { |
| 3593 | switch (opts.positionCaretOnClick) { |
| 3594 | case "none": |
| 3595 | break; |
| 3596 | |
| 3597 | case "select": |
| 3598 | selectedCaret = { |
| 3599 | begin: 0, |
| 3600 | end: getBuffer().length, |
| 3601 | }; |
| 3602 | break; |
| 3603 | |
| 3604 | case "ignore": |
| 3605 | selectedCaret.end = selectedCaret.begin = |
| 3606 | seekNext(getLastValidPosition()); |
| 3607 | break; |
| 3608 | |
| 3609 | case "radixFocus": |
| 3610 | if (doRadixFocus(selectedCaret.begin)) { |
| 3611 | var radixPos = getBuffer() |
| 3612 | .join("") |
| 3613 | .indexOf(opts.radixPoint); |
| 3614 | selectedCaret.end = |
| 3615 | selectedCaret.begin = |
| 3616 | opts.numericInput |
| 3617 | ? seekNext(radixPos) |
| 3618 | : radixPos; |
| 3619 | break; |
| 3620 | } |
| 3621 | |
| 3622 | default: |
| 3623 | var clickPosition = selectedCaret.begin, |
| 3624 | lvclickPosition = getLastValidPosition( |
| 3625 | clickPosition, |
| 3626 | !0 |
| 3627 | ), |
| 3628 | lastPosition = seekNext( |
| 3629 | -1 !== lvclickPosition || isMask(0) |
| 3630 | ? lvclickPosition |
| 3631 | : 0 |
| 3632 | ); |
| 3633 | if (clickPosition < lastPosition) |
| 3634 | selectedCaret.end = |
| 3635 | selectedCaret.begin = |
| 3636 | isMask(clickPosition, !0) || |
| 3637 | isMask(clickPosition - 1, !0) |
| 3638 | ? clickPosition |
| 3639 | : seekNext(clickPosition); |
| 3640 | else { |
| 3641 | var lvp = |
| 3642 | maskset.validPositions[ |
| 3643 | lvclickPosition |
| 3644 | ], |
| 3645 | tt = getTestTemplate( |
| 3646 | lastPosition, |
| 3647 | lvp |
| 3648 | ? lvp.match.locator |
| 3649 | : void 0, |
| 3650 | lvp |
| 3651 | ), |
| 3652 | placeholder = getPlaceholder( |
| 3653 | lastPosition, |
| 3654 | tt.match |
| 3655 | ); |
| 3656 | if ( |
| 3657 | ("" !== placeholder && |
| 3658 | getBuffer()[lastPosition] !== |
| 3659 | placeholder && |
| 3660 | !0 !== |
| 3661 | tt.match |
| 3662 | .optionalQuantifier && |
| 3663 | !0 !== |
| 3664 | tt.match.newBlockMarker) || |
| 3665 | (!isMask( |
| 3666 | lastPosition, |
| 3667 | opts.keepStatic |
| 3668 | ) && |
| 3669 | tt.match.def === placeholder) |
| 3670 | ) { |
| 3671 | var newPos = seekNext(lastPosition); |
| 3672 | (newPos <= clickPosition || |
| 3673 | clickPosition === |
| 3674 | lastPosition) && |
| 3675 | (lastPosition = newPos); |
| 3676 | } |
| 3677 | selectedCaret.end = |
| 3678 | selectedCaret.begin = lastPosition; |
| 3679 | } |
| 3680 | } |
| 3681 | return selectedCaret; |
| 3682 | } |
| 3683 | } |
| 3684 | var EventRuler = { |
| 3685 | on: function on(input, eventName, eventHandler) { |
| 3686 | var ev = function ev(e) { |
| 3687 | e.originalEvent && |
| 3688 | ((e = e.originalEvent || e), |
| 3689 | (arguments[0] = e)); |
| 3690 | var that = this, |
| 3691 | args; |
| 3692 | if ( |
| 3693 | void 0 === that.inputmask && |
| 3694 | "FORM" !== this.nodeName |
| 3695 | ) { |
| 3696 | var imOpts = $.data( |
| 3697 | that, |
| 3698 | "_inputmask_opts" |
| 3699 | ); |
| 3700 | imOpts |
| 3701 | ? new Inputmask(imOpts).mask(that) |
| 3702 | : EventRuler.off(that); |
| 3703 | } else { |
| 3704 | if ( |
| 3705 | "setvalue" === e.type || |
| 3706 | "FORM" === this.nodeName || |
| 3707 | !( |
| 3708 | that.disabled || |
| 3709 | (that.readOnly && |
| 3710 | !( |
| 3711 | ("keydown" === e.type && |
| 3712 | e.ctrlKey && |
| 3713 | 67 === e.keyCode) || |
| 3714 | (!1 === |
| 3715 | opts.tabThrough && |
| 3716 | e.keyCode === |
| 3717 | keyCode.TAB) |
| 3718 | )) |
| 3719 | ) |
| 3720 | ) { |
| 3721 | switch (e.type) { |
| 3722 | case "input": |
| 3723 | if ( |
| 3724 | !0 === skipInputEvent || |
| 3725 | (e.inputType && |
| 3726 | "insertCompositionText" === |
| 3727 | e.inputType) |
| 3728 | ) |
| 3729 | return ( |
| 3730 | (skipInputEvent = |
| 3731 | !1), |
| 3732 | e.preventDefault() |
| 3733 | ); |
| 3734 | break; |
| 3735 | |
| 3736 | case "keydown": |
| 3737 | (skipKeyPressEvent = !1), |
| 3738 | (skipInputEvent = !1); |
| 3739 | break; |
| 3740 | |
| 3741 | case "keypress": |
| 3742 | if ( |
| 3743 | !0 === skipKeyPressEvent |
| 3744 | ) |
| 3745 | return e.preventDefault(); |
| 3746 | skipKeyPressEvent = !0; |
| 3747 | break; |
| 3748 | |
| 3749 | case "click": |
| 3750 | case "focus": |
| 3751 | return ( |
| 3752 | validationEvent |
| 3753 | ? ((validationEvent = |
| 3754 | !1), |
| 3755 | input.blur(), |
| 3756 | HandleNativePlaceholder( |
| 3757 | input, |
| 3758 | (isRTL |
| 3759 | ? getBufferTemplate() |
| 3760 | .slice() |
| 3761 | .reverse() |
| 3762 | : getBufferTemplate() |
| 3763 | ).join("") |
| 3764 | ), |
| 3765 | setTimeout( |
| 3766 | function () { |
| 3767 | input.focus(); |
| 3768 | }, |
| 3769 | 3e3 |
| 3770 | )) |
| 3771 | : ((args = |
| 3772 | arguments), |
| 3773 | setTimeout( |
| 3774 | function () { |
| 3775 | input.inputmask && |
| 3776 | eventHandler.apply( |
| 3777 | that, |
| 3778 | args |
| 3779 | ); |
| 3780 | }, |
| 3781 | 0 |
| 3782 | )), |
| 3783 | !1 |
| 3784 | ); |
| 3785 | } |
| 3786 | var returnVal = eventHandler.apply( |
| 3787 | that, |
| 3788 | arguments |
| 3789 | ); |
| 3790 | return ( |
| 3791 | !1 === returnVal && |
| 3792 | (e.preventDefault(), |
| 3793 | e.stopPropagation()), |
| 3794 | returnVal |
| 3795 | ); |
| 3796 | } |
| 3797 | e.preventDefault(); |
| 3798 | } |
| 3799 | }; |
| 3800 | (input.inputmask.events[eventName] = |
| 3801 | input.inputmask.events[eventName] || []), |
| 3802 | input.inputmask.events[eventName].push(ev), |
| 3803 | -1 !== |
| 3804 | $.inArray(eventName, ["submit", "reset"]) |
| 3805 | ? null !== input.form && |
| 3806 | $(input.form).on(eventName, ev) |
| 3807 | : $(input).on(eventName, ev); |
| 3808 | }, |
| 3809 | off: function off(input, event) { |
| 3810 | var events; |
| 3811 | input.inputmask && |
| 3812 | input.inputmask.events && |
| 3813 | (event |
| 3814 | ? ((events = []), |
| 3815 | (events[event] = |
| 3816 | input.inputmask.events[event])) |
| 3817 | : (events = input.inputmask.events), |
| 3818 | $.each(events, function (eventName, evArr) { |
| 3819 | for (; 0 < evArr.length; ) { |
| 3820 | var ev = evArr.pop(); |
| 3821 | -1 !== |
| 3822 | $.inArray(eventName, [ |
| 3823 | "submit", |
| 3824 | "reset", |
| 3825 | ]) |
| 3826 | ? null !== input.form && |
| 3827 | $(input.form).off( |
| 3828 | eventName, |
| 3829 | ev |
| 3830 | ) |
| 3831 | : $(input).off(eventName, ev); |
| 3832 | } |
| 3833 | delete input |
| 3834 | .inputmask.events[eventName]; |
| 3835 | })); |
| 3836 | }, |
| 3837 | }, |
| 3838 | EventHandlers = { |
| 3839 | keydownEvent: function keydownEvent(e) { |
| 3840 | var input = this, |
| 3841 | $input = $(input), |
| 3842 | k = e.keyCode, |
| 3843 | pos = caret(input), |
| 3844 | kdResult = opts.onKeyDown.call( |
| 3845 | this, |
| 3846 | e, |
| 3847 | getBuffer(), |
| 3848 | pos, |
| 3849 | opts |
| 3850 | ); |
| 3851 | if (void 0 !== kdResult) return kdResult; |
| 3852 | if ( |
| 3853 | k === keyCode.BACKSPACE || |
| 3854 | k === keyCode.DELETE || |
| 3855 | (iphone && |
| 3856 | k === keyCode.BACKSPACE_SAFARI) || |
| 3857 | (e.ctrlKey && |
| 3858 | k === keyCode.X && |
| 3859 | !("oncut" in input)) |
| 3860 | ) |
| 3861 | e.preventDefault(), |
| 3862 | handleRemove(input, k, pos), |
| 3863 | writeBuffer( |
| 3864 | input, |
| 3865 | getBuffer(!0), |
| 3866 | maskset.p, |
| 3867 | e, |
| 3868 | input.inputmask._valueGet() !== |
| 3869 | getBuffer().join("") |
| 3870 | ); |
| 3871 | else if ( |
| 3872 | k === keyCode.END || |
| 3873 | k === keyCode.PAGE_DOWN |
| 3874 | ) { |
| 3875 | e.preventDefault(); |
| 3876 | var caretPos = seekNext( |
| 3877 | getLastValidPosition() |
| 3878 | ); |
| 3879 | caret( |
| 3880 | input, |
| 3881 | e.shiftKey ? pos.begin : caretPos, |
| 3882 | caretPos, |
| 3883 | !0 |
| 3884 | ); |
| 3885 | } else |
| 3886 | (k === keyCode.HOME && !e.shiftKey) || |
| 3887 | k === keyCode.PAGE_UP |
| 3888 | ? (e.preventDefault(), |
| 3889 | caret( |
| 3890 | input, |
| 3891 | 0, |
| 3892 | e.shiftKey ? pos.begin : 0, |
| 3893 | !0 |
| 3894 | )) |
| 3895 | : ((opts.undoOnEscape && |
| 3896 | k === keyCode.ESCAPE) || |
| 3897 | (90 === k && e.ctrlKey)) && |
| 3898 | !0 !== e.altKey |
| 3899 | ? (checkVal( |
| 3900 | input, |
| 3901 | !0, |
| 3902 | !1, |
| 3903 | undoValue.split("") |
| 3904 | ), |
| 3905 | $input.trigger("click")) |
| 3906 | : !0 === opts.tabThrough && |
| 3907 | k === keyCode.TAB |
| 3908 | ? (!0 === e.shiftKey |
| 3909 | ? (!0 === |
| 3910 | getTest(pos.begin).match |
| 3911 | .static && |
| 3912 | (pos.begin = seekNext( |
| 3913 | pos.begin |
| 3914 | )), |
| 3915 | (pos.end = seekPrevious( |
| 3916 | pos.begin, |
| 3917 | !0 |
| 3918 | )), |
| 3919 | (pos.begin = seekPrevious( |
| 3920 | pos.end, |
| 3921 | !0 |
| 3922 | ))) |
| 3923 | : ((pos.begin = seekNext( |
| 3924 | pos.begin, |
| 3925 | !0 |
| 3926 | )), |
| 3927 | (pos.end = seekNext( |
| 3928 | pos.begin, |
| 3929 | !0 |
| 3930 | )), |
| 3931 | pos.end < |
| 3932 | maskset.maskLength && |
| 3933 | pos.end--), |
| 3934 | pos.begin < maskset.maskLength && |
| 3935 | (e.preventDefault(), |
| 3936 | caret( |
| 3937 | input, |
| 3938 | pos.begin, |
| 3939 | pos.end |
| 3940 | ))) |
| 3941 | : e.shiftKey || |
| 3942 | (opts.insertModeVisual && |
| 3943 | !1 === opts.insertMode && |
| 3944 | (k === keyCode.RIGHT |
| 3945 | ? setTimeout(function () { |
| 3946 | var caretPos = |
| 3947 | caret(input); |
| 3948 | caret( |
| 3949 | input, |
| 3950 | caretPos.begin |
| 3951 | ); |
| 3952 | }, 0) |
| 3953 | : k === keyCode.LEFT && |
| 3954 | setTimeout(function () { |
| 3955 | var caretPos_begin = |
| 3956 | translatePosition( |
| 3957 | input |
| 3958 | .inputmask |
| 3959 | .caretPos |
| 3960 | .begin |
| 3961 | ), |
| 3962 | caretPos_end = |
| 3963 | translatePosition( |
| 3964 | input |
| 3965 | .inputmask |
| 3966 | .caretPos |
| 3967 | .end |
| 3968 | ); |
| 3969 | caret( |
| 3970 | input, |
| 3971 | isRTL |
| 3972 | ? caretPos_begin + |
| 3973 | (caretPos_begin === |
| 3974 | maskset.maskLength |
| 3975 | ? 0 |
| 3976 | : 1) |
| 3977 | : caretPos_begin - |
| 3978 | (0 === |
| 3979 | caretPos_begin |
| 3980 | ? 0 |
| 3981 | : 1) |
| 3982 | ); |
| 3983 | }, 0))); |
| 3984 | ignorable = |
| 3985 | -1 !== $.inArray(k, opts.ignorables); |
| 3986 | }, |
| 3987 | keypressEvent: function keypressEvent( |
| 3988 | e, |
| 3989 | checkval, |
| 3990 | writeOut, |
| 3991 | strict, |
| 3992 | ndx |
| 3993 | ) { |
| 3994 | var input = this, |
| 3995 | $input = $(input), |
| 3996 | k = e.which || e.charCode || e.keyCode; |
| 3997 | if ( |
| 3998 | !( |
| 3999 | !0 === checkval || |
| 4000 | (e.ctrlKey && e.altKey) |
| 4001 | ) && |
| 4002 | (e.ctrlKey || e.metaKey || ignorable) |
| 4003 | ) |
| 4004 | return ( |
| 4005 | k === keyCode.ENTER && |
| 4006 | undoValue !== |
| 4007 | getBuffer().join("") && |
| 4008 | ((undoValue = getBuffer().join("")), |
| 4009 | setTimeout(function () { |
| 4010 | $input.trigger("change"); |
| 4011 | }, 0)), |
| 4012 | (skipInputEvent = !0), |
| 4013 | !0 |
| 4014 | ); |
| 4015 | if (k) { |
| 4016 | (44 !== k && 46 !== k) || |
| 4017 | 3 !== e.location || |
| 4018 | "" === opts.radixPoint || |
| 4019 | (k = opts.radixPoint.charCodeAt(0)); |
| 4020 | var pos = checkval |
| 4021 | ? { |
| 4022 | begin: ndx, |
| 4023 | end: ndx, |
| 4024 | } |
| 4025 | : caret(input), |
| 4026 | forwardPosition, |
| 4027 | c = String.fromCharCode(k); |
| 4028 | maskset.writeOutBuffer = !0; |
| 4029 | var valResult = isValid(pos, c, strict); |
| 4030 | if ( |
| 4031 | (!1 !== valResult && |
| 4032 | (resetMaskSet(!0), |
| 4033 | (forwardPosition = |
| 4034 | void 0 !== valResult.caret |
| 4035 | ? valResult.caret |
| 4036 | : seekNext( |
| 4037 | valResult.pos.begin |
| 4038 | ? valResult.pos |
| 4039 | .begin |
| 4040 | : valResult.pos |
| 4041 | )), |
| 4042 | (maskset.p = forwardPosition)), |
| 4043 | (forwardPosition = |
| 4044 | opts.numericInput && |
| 4045 | void 0 === valResult.caret |
| 4046 | ? seekPrevious(forwardPosition) |
| 4047 | : forwardPosition), |
| 4048 | !1 !== writeOut && |
| 4049 | (setTimeout(function () { |
| 4050 | opts.onKeyValidation.call( |
| 4051 | input, |
| 4052 | k, |
| 4053 | valResult |
| 4054 | ); |
| 4055 | }, 0), |
| 4056 | maskset.writeOutBuffer && |
| 4057 | !1 !== valResult)) |
| 4058 | ) { |
| 4059 | var buffer = getBuffer(); |
| 4060 | writeBuffer( |
| 4061 | input, |
| 4062 | buffer, |
| 4063 | forwardPosition, |
| 4064 | e, |
| 4065 | !0 !== checkval |
| 4066 | ); |
| 4067 | } |
| 4068 | if ((e.preventDefault(), checkval)) |
| 4069 | return ( |
| 4070 | !1 !== valResult && |
| 4071 | (valResult.forwardPosition = |
| 4072 | forwardPosition), |
| 4073 | valResult |
| 4074 | ); |
| 4075 | } |
| 4076 | }, |
| 4077 | pasteEvent: function pasteEvent(e) { |
| 4078 | var input = this, |
| 4079 | inputValue = this.inputmask._valueGet(!0), |
| 4080 | caretPos = caret(this), |
| 4081 | tempValue; |
| 4082 | isRTL && |
| 4083 | ((tempValue = caretPos.end), |
| 4084 | (caretPos.end = caretPos.begin), |
| 4085 | (caretPos.begin = tempValue)); |
| 4086 | var valueBeforeCaret = inputValue.substr( |
| 4087 | 0, |
| 4088 | caretPos.begin |
| 4089 | ), |
| 4090 | valueAfterCaret = inputValue.substr( |
| 4091 | caretPos.end, |
| 4092 | inputValue.length |
| 4093 | ); |
| 4094 | if ( |
| 4095 | (valueBeforeCaret == |
| 4096 | (isRTL |
| 4097 | ? getBufferTemplate() |
| 4098 | .slice() |
| 4099 | .reverse() |
| 4100 | : getBufferTemplate() |
| 4101 | ) |
| 4102 | .slice(0, caretPos.begin) |
| 4103 | .join("") && |
| 4104 | (valueBeforeCaret = ""), |
| 4105 | valueAfterCaret == |
| 4106 | (isRTL |
| 4107 | ? getBufferTemplate() |
| 4108 | .slice() |
| 4109 | .reverse() |
| 4110 | : getBufferTemplate() |
| 4111 | ) |
| 4112 | .slice(caretPos.end) |
| 4113 | .join("") && (valueAfterCaret = ""), |
| 4114 | window.clipboardData && |
| 4115 | window.clipboardData.getData) |
| 4116 | ) |
| 4117 | inputValue = |
| 4118 | valueBeforeCaret + |
| 4119 | window.clipboardData.getData("Text") + |
| 4120 | valueAfterCaret; |
| 4121 | else { |
| 4122 | if ( |
| 4123 | !e.clipboardData || |
| 4124 | !e.clipboardData.getData |
| 4125 | ) |
| 4126 | return !0; |
| 4127 | inputValue = |
| 4128 | valueBeforeCaret + |
| 4129 | e.clipboardData.getData("text/plain") + |
| 4130 | valueAfterCaret; |
| 4131 | } |
| 4132 | var pasteValue = inputValue; |
| 4133 | if ($.isFunction(opts.onBeforePaste)) { |
| 4134 | if ( |
| 4135 | ((pasteValue = opts.onBeforePaste.call( |
| 4136 | inputmask, |
| 4137 | inputValue, |
| 4138 | opts |
| 4139 | )), |
| 4140 | !1 === pasteValue) |
| 4141 | ) |
| 4142 | return e.preventDefault(); |
| 4143 | pasteValue = pasteValue || inputValue; |
| 4144 | } |
| 4145 | return ( |
| 4146 | checkVal( |
| 4147 | this, |
| 4148 | !1, |
| 4149 | !1, |
| 4150 | pasteValue.toString().split("") |
| 4151 | ), |
| 4152 | writeBuffer( |
| 4153 | this, |
| 4154 | getBuffer(), |
| 4155 | seekNext(getLastValidPosition()), |
| 4156 | e, |
| 4157 | undoValue !== getBuffer().join("") |
| 4158 | ), |
| 4159 | e.preventDefault() |
| 4160 | ); |
| 4161 | }, |
| 4162 | inputFallBackEvent: function inputFallBackEvent(e) { |
| 4163 | function ieMobileHandler( |
| 4164 | input, |
| 4165 | inputValue, |
| 4166 | caretPos |
| 4167 | ) { |
| 4168 | if (iemobile) { |
| 4169 | var inputChar = inputValue.replace( |
| 4170 | getBuffer().join(""), |
| 4171 | "" |
| 4172 | ); |
| 4173 | if (1 === inputChar.length) { |
| 4174 | var iv = inputValue.split(""); |
| 4175 | iv.splice( |
| 4176 | caretPos.begin, |
| 4177 | 0, |
| 4178 | inputChar |
| 4179 | ), |
| 4180 | (inputValue = iv.join("")); |
| 4181 | } |
| 4182 | } |
| 4183 | return inputValue; |
| 4184 | } |
| 4185 | function analyseChanges( |
| 4186 | inputValue, |
| 4187 | buffer, |
| 4188 | caretPos |
| 4189 | ) { |
| 4190 | for ( |
| 4191 | var frontPart = inputValue |
| 4192 | .substr(0, caretPos.begin) |
| 4193 | .split(""), |
| 4194 | backPart = inputValue |
| 4195 | .substr(caretPos.begin) |
| 4196 | .split(""), |
| 4197 | frontBufferPart = buffer |
| 4198 | .substr(0, caretPos.begin) |
| 4199 | .split(""), |
| 4200 | backBufferPart = buffer |
| 4201 | .substr(caretPos.begin) |
| 4202 | .split(""), |
| 4203 | fpl = |
| 4204 | frontPart.length >= |
| 4205 | frontBufferPart.length |
| 4206 | ? frontPart.length |
| 4207 | : frontBufferPart.length, |
| 4208 | bpl = |
| 4209 | backPart.length >= |
| 4210 | backBufferPart.length |
| 4211 | ? backPart.length |
| 4212 | : backBufferPart.length, |
| 4213 | bl, |
| 4214 | i, |
| 4215 | action = "", |
| 4216 | data = [], |
| 4217 | marker = "~", |
| 4218 | placeholder; |
| 4219 | frontPart.length < fpl; |
| 4220 | |
| 4221 | ) |
| 4222 | frontPart.push("~"); |
| 4223 | for (; frontBufferPart.length < fpl; ) |
| 4224 | frontBufferPart.push("~"); |
| 4225 | for (; backPart.length < bpl; ) |
| 4226 | backPart.unshift("~"); |
| 4227 | for (; backBufferPart.length < bpl; ) |
| 4228 | backBufferPart.unshift("~"); |
| 4229 | var newBuffer = frontPart.concat(backPart), |
| 4230 | oldBuffer = |
| 4231 | frontBufferPart.concat( |
| 4232 | backBufferPart |
| 4233 | ); |
| 4234 | for ( |
| 4235 | i = 0, bl = newBuffer.length; |
| 4236 | i < bl; |
| 4237 | i++ |
| 4238 | ) |
| 4239 | switch ( |
| 4240 | ((placeholder = getPlaceholder( |
| 4241 | translatePosition(i) |
| 4242 | )), |
| 4243 | action) |
| 4244 | ) { |
| 4245 | case "insertText": |
| 4246 | oldBuffer[i - 1] === |
| 4247 | newBuffer[i] && |
| 4248 | caretPos.begin == |
| 4249 | newBuffer.length - 1 && |
| 4250 | data.push(newBuffer[i]), |
| 4251 | (i = bl); |
| 4252 | break; |
| 4253 | |
| 4254 | case "insertReplacementText": |
| 4255 | "~" === newBuffer[i] |
| 4256 | ? caretPos.end++ |
| 4257 | : (i = bl); |
| 4258 | break; |
| 4259 | |
| 4260 | case "deleteContentBackward": |
| 4261 | "~" === newBuffer[i] |
| 4262 | ? caretPos.end++ |
| 4263 | : (i = bl); |
| 4264 | break; |
| 4265 | |
| 4266 | default: |
| 4267 | newBuffer[i] !== oldBuffer[i] && |
| 4268 | (("~" !== |
| 4269 | newBuffer[i + 1] && |
| 4270 | newBuffer[i + 1] !== |
| 4271 | placeholder && |
| 4272 | void 0 !== |
| 4273 | newBuffer[i + 1]) || |
| 4274 | ((oldBuffer[i] !== |
| 4275 | placeholder || |
| 4276 | "~" !== |
| 4277 | oldBuffer[i + 1]) && |
| 4278 | "~" !== oldBuffer[i]) |
| 4279 | ? "~" === |
| 4280 | oldBuffer[ |
| 4281 | i + 1 |
| 4282 | ] && |
| 4283 | oldBuffer[i] === |
| 4284 | newBuffer[i + 1] |
| 4285 | ? ((action = |
| 4286 | "insertText"), |
| 4287 | data.push( |
| 4288 | newBuffer[i] |
| 4289 | ), |
| 4290 | caretPos.begin--, |
| 4291 | caretPos.end--) |
| 4292 | : newBuffer[i] !== |
| 4293 | placeholder && |
| 4294 | "~" !== |
| 4295 | newBuffer[ |
| 4296 | i |
| 4297 | ] && |
| 4298 | ("~" === |
| 4299 | newBuffer[ |
| 4300 | i + 1 |
| 4301 | ] || |
| 4302 | (oldBuffer[ |
| 4303 | i |
| 4304 | ] !== |
| 4305 | newBuffer[ |
| 4306 | i |
| 4307 | ] && |
| 4308 | oldBuffer[ |
| 4309 | i + |
| 4310 | 1 |
| 4311 | ] === |
| 4312 | newBuffer[ |
| 4313 | i + |
| 4314 | 1 |
| 4315 | ])) |
| 4316 | ? ((action = |
| 4317 | "insertReplacementText"), |
| 4318 | data.push( |
| 4319 | newBuffer[i] |
| 4320 | ), |
| 4321 | caretPos.begin--) |
| 4322 | : "~" === |
| 4323 | newBuffer[i] |
| 4324 | ? ((action = |
| 4325 | "deleteContentBackward"), |
| 4326 | (!isMask( |
| 4327 | translatePosition( |
| 4328 | i |
| 4329 | ), |
| 4330 | !0 |
| 4331 | ) && |
| 4332 | oldBuffer[ |
| 4333 | i |
| 4334 | ] !== |
| 4335 | opts.radixPoint) || |
| 4336 | caretPos.end++) |
| 4337 | : (i = bl) |
| 4338 | : ((action = |
| 4339 | "insertText"), |
| 4340 | data.push( |
| 4341 | newBuffer[i] |
| 4342 | ), |
| 4343 | caretPos.begin--, |
| 4344 | caretPos.end--)); |
| 4345 | break; |
| 4346 | } |
| 4347 | return { |
| 4348 | action: action, |
| 4349 | data: data, |
| 4350 | caret: caretPos, |
| 4351 | }; |
| 4352 | } |
| 4353 | var input = this, |
| 4354 | inputValue = input.inputmask._valueGet(!0), |
| 4355 | buffer = ( |
| 4356 | isRTL |
| 4357 | ? getBuffer().slice().reverse() |
| 4358 | : getBuffer() |
| 4359 | ).join(""), |
| 4360 | caretPos = caret(input, void 0, void 0, !0); |
| 4361 | if (buffer !== inputValue) { |
| 4362 | inputValue = ieMobileHandler( |
| 4363 | input, |
| 4364 | inputValue, |
| 4365 | caretPos |
| 4366 | ); |
| 4367 | var changes = analyseChanges( |
| 4368 | inputValue, |
| 4369 | buffer, |
| 4370 | caretPos |
| 4371 | ); |
| 4372 | switch ( |
| 4373 | (( |
| 4374 | input.inputmask.shadowRoot || |
| 4375 | document |
| 4376 | ).activeElement !== input && |
| 4377 | input.focus(), |
| 4378 | writeBuffer(input, getBuffer()), |
| 4379 | caret( |
| 4380 | input, |
| 4381 | caretPos.begin, |
| 4382 | caretPos.end, |
| 4383 | !0 |
| 4384 | ), |
| 4385 | changes.action) |
| 4386 | ) { |
| 4387 | case "insertText": |
| 4388 | case "insertReplacementText": |
| 4389 | $.each( |
| 4390 | changes.data, |
| 4391 | function (ndx, entry) { |
| 4392 | var keypress = new $.Event( |
| 4393 | "keypress" |
| 4394 | ); |
| 4395 | (keypress.which = |
| 4396 | entry.charCodeAt(0)), |
| 4397 | (ignorable = !1), |
| 4398 | EventHandlers.keypressEvent.call( |
| 4399 | input, |
| 4400 | keypress |
| 4401 | ); |
| 4402 | } |
| 4403 | ), |
| 4404 | setTimeout(function () { |
| 4405 | $el.trigger("keyup"); |
| 4406 | }, 0); |
| 4407 | break; |
| 4408 | |
| 4409 | case "deleteContentBackward": |
| 4410 | var keydown = new $.Event( |
| 4411 | "keydown" |
| 4412 | ); |
| 4413 | (keydown.keyCode = |
| 4414 | keyCode.BACKSPACE), |
| 4415 | EventHandlers.keydownEvent.call( |
| 4416 | input, |
| 4417 | keydown |
| 4418 | ); |
| 4419 | break; |
| 4420 | |
| 4421 | default: |
| 4422 | applyInputValue(input, inputValue); |
| 4423 | break; |
| 4424 | } |
| 4425 | e.preventDefault(); |
| 4426 | } |
| 4427 | }, |
| 4428 | compositionendEvent: function compositionendEvent( |
| 4429 | e |
| 4430 | ) { |
| 4431 | $el.trigger("input"); |
| 4432 | }, |
| 4433 | setValueEvent: function setValueEvent( |
| 4434 | e, |
| 4435 | argument_1, |
| 4436 | argument_2 |
| 4437 | ) { |
| 4438 | var input = this, |
| 4439 | value = |
| 4440 | e && e.detail |
| 4441 | ? e.detail[0] |
| 4442 | : argument_1; |
| 4443 | void 0 === value && |
| 4444 | (value = this.inputmask._valueGet(!0)), |
| 4445 | applyInputValue(this, value), |
| 4446 | ((e.detail && void 0 !== e.detail[1]) || |
| 4447 | void 0 !== argument_2) && |
| 4448 | caret( |
| 4449 | this, |
| 4450 | e.detail ? e.detail[1] : argument_2 |
| 4451 | ); |
| 4452 | }, |
| 4453 | focusEvent: function focusEvent(e) { |
| 4454 | var input = this, |
| 4455 | nptValue = this.inputmask._valueGet(); |
| 4456 | opts.showMaskOnFocus && |
| 4457 | nptValue !== getBuffer().join("") && |
| 4458 | writeBuffer( |
| 4459 | this, |
| 4460 | getBuffer(), |
| 4461 | seekNext(getLastValidPosition()) |
| 4462 | ), |
| 4463 | !0 !== opts.positionCaretOnTab || |
| 4464 | !1 !== mouseEnter || |
| 4465 | (isComplete(getBuffer()) && |
| 4466 | -1 !== getLastValidPosition()) || |
| 4467 | EventHandlers.clickEvent.apply(this, [ |
| 4468 | e, |
| 4469 | !0, |
| 4470 | ]), |
| 4471 | (undoValue = getBuffer().join("")); |
| 4472 | }, |
| 4473 | invalidEvent: function invalidEvent(e) { |
| 4474 | validationEvent = !0; |
| 4475 | }, |
| 4476 | mouseleaveEvent: function mouseleaveEvent() { |
| 4477 | var input = this; |
| 4478 | (mouseEnter = !1), |
| 4479 | opts.clearMaskOnLostFocus && |
| 4480 | (this.inputmask.shadowRoot || document) |
| 4481 | .activeElement !== this && |
| 4482 | HandleNativePlaceholder( |
| 4483 | this, |
| 4484 | originalPlaceholder |
| 4485 | ); |
| 4486 | }, |
| 4487 | clickEvent: function clickEvent(e, tabbed) { |
| 4488 | var input = this; |
| 4489 | if ( |
| 4490 | (this.inputmask.shadowRoot || document) |
| 4491 | .activeElement === this |
| 4492 | ) { |
| 4493 | var newCaretPosition = |
| 4494 | determineNewCaretPosition( |
| 4495 | caret(this), |
| 4496 | tabbed |
| 4497 | ); |
| 4498 | void 0 !== newCaretPosition && |
| 4499 | caret(this, newCaretPosition); |
| 4500 | } |
| 4501 | }, |
| 4502 | cutEvent: function cutEvent(e) { |
| 4503 | var input = this, |
| 4504 | pos = caret(this), |
| 4505 | clipboardData = |
| 4506 | window.clipboardData || e.clipboardData, |
| 4507 | clipData = isRTL |
| 4508 | ? getBuffer().slice(pos.end, pos.begin) |
| 4509 | : getBuffer().slice(pos.begin, pos.end); |
| 4510 | clipboardData.setData( |
| 4511 | "text", |
| 4512 | isRTL |
| 4513 | ? clipData.reverse().join("") |
| 4514 | : clipData.join("") |
| 4515 | ), |
| 4516 | document.execCommand && |
| 4517 | document.execCommand("copy"), |
| 4518 | handleRemove(this, keyCode.DELETE, pos), |
| 4519 | writeBuffer( |
| 4520 | this, |
| 4521 | getBuffer(), |
| 4522 | maskset.p, |
| 4523 | e, |
| 4524 | undoValue !== getBuffer().join("") |
| 4525 | ); |
| 4526 | }, |
| 4527 | blurEvent: function blurEvent(e) { |
| 4528 | var $input = $(this), |
| 4529 | input = this; |
| 4530 | if (this.inputmask) { |
| 4531 | HandleNativePlaceholder( |
| 4532 | this, |
| 4533 | originalPlaceholder |
| 4534 | ); |
| 4535 | var nptValue = this.inputmask._valueGet(), |
| 4536 | buffer = getBuffer().slice(); |
| 4537 | "" !== nptValue && |
| 4538 | (opts.clearMaskOnLostFocus && |
| 4539 | (-1 === getLastValidPosition() && |
| 4540 | nptValue === |
| 4541 | getBufferTemplate().join("") |
| 4542 | ? (buffer = []) |
| 4543 | : clearOptionalTail(buffer)), |
| 4544 | !1 === isComplete(buffer) && |
| 4545 | (setTimeout(function () { |
| 4546 | $input.trigger("incomplete"); |
| 4547 | }, 0), |
| 4548 | opts.clearIncomplete && |
| 4549 | (resetMaskSet(), |
| 4550 | (buffer = |
| 4551 | opts.clearMaskOnLostFocus |
| 4552 | ? [] |
| 4553 | : getBufferTemplate().slice()))), |
| 4554 | writeBuffer(this, buffer, void 0, e)), |
| 4555 | undoValue !== getBuffer().join("") && |
| 4556 | ((undoValue = getBuffer().join("")), |
| 4557 | $input.trigger("change")); |
| 4558 | } |
| 4559 | }, |
| 4560 | mouseenterEvent: function mouseenterEvent() { |
| 4561 | var input = this; |
| 4562 | (mouseEnter = !0), |
| 4563 | (this.inputmask.shadowRoot || document) |
| 4564 | .activeElement !== this && |
| 4565 | (null == originalPlaceholder && |
| 4566 | this.placeholder !== |
| 4567 | originalPlaceholder && |
| 4568 | (originalPlaceholder = |
| 4569 | this.placeholder), |
| 4570 | opts.showMaskOnHover && |
| 4571 | HandleNativePlaceholder( |
| 4572 | this, |
| 4573 | (isRTL |
| 4574 | ? getBufferTemplate() |
| 4575 | .slice() |
| 4576 | .reverse() |
| 4577 | : getBufferTemplate() |
| 4578 | ).join("") |
| 4579 | )); |
| 4580 | }, |
| 4581 | submitEvent: function submitEvent() { |
| 4582 | undoValue !== getBuffer().join("") && |
| 4583 | $el.trigger("change"), |
| 4584 | opts.clearMaskOnLostFocus && |
| 4585 | -1 === getLastValidPosition() && |
| 4586 | el.inputmask._valueGet && |
| 4587 | el.inputmask._valueGet() === |
| 4588 | getBufferTemplate().join("") && |
| 4589 | el.inputmask._valueSet(""), |
| 4590 | opts.clearIncomplete && |
| 4591 | !1 === isComplete(getBuffer()) && |
| 4592 | el.inputmask._valueSet(""), |
| 4593 | opts.removeMaskOnSubmit && |
| 4594 | (el.inputmask._valueSet( |
| 4595 | el.inputmask.unmaskedvalue(), |
| 4596 | !0 |
| 4597 | ), |
| 4598 | setTimeout(function () { |
| 4599 | writeBuffer(el, getBuffer()); |
| 4600 | }, 0)); |
| 4601 | }, |
| 4602 | resetEvent: function resetEvent() { |
| 4603 | (el.inputmask.refreshValue = !0), |
| 4604 | setTimeout(function () { |
| 4605 | applyInputValue( |
| 4606 | el, |
| 4607 | el.inputmask._valueGet(!0) |
| 4608 | ); |
| 4609 | }, 0); |
| 4610 | }, |
| 4611 | }, |
| 4612 | valueBuffer; |
| 4613 | function checkVal( |
| 4614 | input, |
| 4615 | writeOut, |
| 4616 | strict, |
| 4617 | nptvl, |
| 4618 | initiatingEvent |
| 4619 | ) { |
| 4620 | var inputmask = this || input.inputmask, |
| 4621 | inputValue = nptvl.slice(), |
| 4622 | charCodes = "", |
| 4623 | initialNdx = -1, |
| 4624 | result = void 0; |
| 4625 | function isTemplateMatch(ndx, charCodes) { |
| 4626 | for ( |
| 4627 | var targetTemplate = getMaskTemplate(!0, 0) |
| 4628 | .slice(ndx, seekNext(ndx)) |
| 4629 | .join("") |
| 4630 | .replace(/'/g, ""), |
| 4631 | charCodeNdx = |
| 4632 | targetTemplate.indexOf(charCodes); |
| 4633 | 0 < charCodeNdx && |
| 4634 | " " === targetTemplate[charCodeNdx - 1]; |
| 4635 | |
| 4636 | ) |
| 4637 | charCodeNdx--; |
| 4638 | var match = |
| 4639 | 0 === charCodeNdx && |
| 4640 | !isMask(ndx) && |
| 4641 | (getTest(ndx).match.nativeDef === |
| 4642 | charCodes.charAt(0) || |
| 4643 | (!0 === getTest(ndx).match.static && |
| 4644 | getTest(ndx).match.nativeDef === |
| 4645 | "'" + charCodes.charAt(0)) || |
| 4646 | (" " === getTest(ndx).match.nativeDef && |
| 4647 | (getTest(ndx + 1).match.nativeDef === |
| 4648 | charCodes.charAt(0) || |
| 4649 | (!0 === |
| 4650 | getTest(ndx + 1).match.static && |
| 4651 | getTest(ndx + 1).match |
| 4652 | .nativeDef === |
| 4653 | "'" + |
| 4654 | charCodes.charAt(0))))); |
| 4655 | if ( |
| 4656 | !match && |
| 4657 | 0 < charCodeNdx && |
| 4658 | !isMask(ndx, !1, !0) |
| 4659 | ) { |
| 4660 | var nextPos = seekNext(ndx); |
| 4661 | inputmask.caretPos.begin < nextPos && |
| 4662 | (inputmask.caretPos = { |
| 4663 | begin: nextPos, |
| 4664 | }); |
| 4665 | } |
| 4666 | return match; |
| 4667 | } |
| 4668 | resetMaskSet(), |
| 4669 | (maskset.tests = {}), |
| 4670 | (initialNdx = opts.radixPoint |
| 4671 | ? determineNewCaretPosition({ |
| 4672 | begin: 0, |
| 4673 | end: 0, |
| 4674 | }).begin |
| 4675 | : 0), |
| 4676 | (maskset.p = initialNdx), |
| 4677 | (inputmask.caretPos = { |
| 4678 | begin: initialNdx, |
| 4679 | }); |
| 4680 | var staticMatches = [], |
| 4681 | prevCaretPos = inputmask.caretPos; |
| 4682 | if ( |
| 4683 | ($.each(inputValue, function (ndx, charCode) { |
| 4684 | if (void 0 !== charCode) |
| 4685 | if ( |
| 4686 | void 0 === |
| 4687 | maskset.validPositions[ndx] && |
| 4688 | inputValue[ndx] === |
| 4689 | getPlaceholder(ndx) && |
| 4690 | isMask(ndx, !0) && |
| 4691 | !1 === |
| 4692 | isValid( |
| 4693 | ndx, |
| 4694 | inputValue[ndx], |
| 4695 | !0, |
| 4696 | void 0, |
| 4697 | void 0, |
| 4698 | !0 |
| 4699 | ) |
| 4700 | ) |
| 4701 | maskset.p++; |
| 4702 | else { |
| 4703 | var keypress = new $.Event("_checkval"); |
| 4704 | (keypress.which = charCode |
| 4705 | .toString() |
| 4706 | .charCodeAt(0)), |
| 4707 | (charCodes += charCode); |
| 4708 | var lvp = getLastValidPosition( |
| 4709 | void 0, |
| 4710 | !0 |
| 4711 | ); |
| 4712 | isTemplateMatch(initialNdx, charCodes) |
| 4713 | ? (result = |
| 4714 | EventHandlers.keypressEvent.call( |
| 4715 | input, |
| 4716 | keypress, |
| 4717 | !0, |
| 4718 | !1, |
| 4719 | strict, |
| 4720 | lvp + 1 |
| 4721 | )) |
| 4722 | : ((result = |
| 4723 | EventHandlers.keypressEvent.call( |
| 4724 | input, |
| 4725 | keypress, |
| 4726 | !0, |
| 4727 | !1, |
| 4728 | strict, |
| 4729 | inputmask.caretPos.begin |
| 4730 | )), |
| 4731 | result && |
| 4732 | ((initialNdx = |
| 4733 | inputmask.caretPos |
| 4734 | .begin + 1), |
| 4735 | (charCodes = ""))), |
| 4736 | result |
| 4737 | ? (void 0 !== result.pos && |
| 4738 | maskset.validPositions[ |
| 4739 | result.pos |
| 4740 | ] && |
| 4741 | !0 === |
| 4742 | maskset |
| 4743 | .validPositions[ |
| 4744 | result.pos |
| 4745 | ].match.static && |
| 4746 | void 0 === |
| 4747 | maskset |
| 4748 | .validPositions[ |
| 4749 | result.pos |
| 4750 | ].alternation && |
| 4751 | (staticMatches.push( |
| 4752 | result.pos |
| 4753 | ), |
| 4754 | isRTL || |
| 4755 | (result.forwardPosition = |
| 4756 | result.pos + |
| 4757 | 1)), |
| 4758 | writeBuffer( |
| 4759 | void 0, |
| 4760 | getBuffer(), |
| 4761 | result.forwardPosition, |
| 4762 | keypress, |
| 4763 | !1 |
| 4764 | ), |
| 4765 | (inputmask.caretPos = { |
| 4766 | begin: result.forwardPosition, |
| 4767 | end: result.forwardPosition, |
| 4768 | }), |
| 4769 | (prevCaretPos = |
| 4770 | inputmask.caretPos)) |
| 4771 | : (inputmask.caretPos = |
| 4772 | prevCaretPos); |
| 4773 | } |
| 4774 | }), |
| 4775 | 0 < staticMatches.length) |
| 4776 | ) { |
| 4777 | var sndx, |
| 4778 | validPos, |
| 4779 | nextValid = seekNext(-1, void 0, !1); |
| 4780 | if ( |
| 4781 | (!isComplete(getBuffer()) && |
| 4782 | staticMatches.length <= nextValid) || |
| 4783 | (isComplete(getBuffer()) && |
| 4784 | 0 < staticMatches.length && |
| 4785 | staticMatches.length !== nextValid && |
| 4786 | 0 === staticMatches[0]) |
| 4787 | ) |
| 4788 | for ( |
| 4789 | var nextSndx = nextValid; |
| 4790 | void 0 !== (sndx = staticMatches.shift()); |
| 4791 | |
| 4792 | ) { |
| 4793 | var keypress = new $.Event("_checkval"); |
| 4794 | if ( |
| 4795 | ((validPos = |
| 4796 | maskset.validPositions[sndx]), |
| 4797 | (validPos.generatedInput = !0), |
| 4798 | (keypress.which = |
| 4799 | validPos.input.charCodeAt(0)), |
| 4800 | (result = |
| 4801 | EventHandlers.keypressEvent.call( |
| 4802 | input, |
| 4803 | keypress, |
| 4804 | !0, |
| 4805 | !1, |
| 4806 | strict, |
| 4807 | nextSndx |
| 4808 | )), |
| 4809 | result && |
| 4810 | void 0 !== result.pos && |
| 4811 | result.pos !== sndx && |
| 4812 | maskset.validPositions[ |
| 4813 | result.pos |
| 4814 | ] && |
| 4815 | !0 === |
| 4816 | maskset.validPositions[ |
| 4817 | result.pos |
| 4818 | ].match.static) |
| 4819 | ) |
| 4820 | staticMatches.push(result.pos); |
| 4821 | else if (!result) break; |
| 4822 | nextSndx++; |
| 4823 | } |
| 4824 | else |
| 4825 | for (; (sndx = staticMatches.pop()); ) |
| 4826 | (validPos = maskset.validPositions[sndx]), |
| 4827 | validPos && |
| 4828 | (validPos.generatedInput = !0); |
| 4829 | } |
| 4830 | if (writeOut) |
| 4831 | for (var vndx in (writeBuffer( |
| 4832 | input, |
| 4833 | getBuffer(), |
| 4834 | result ? result.forwardPosition : void 0, |
| 4835 | initiatingEvent || new $.Event("checkval"), |
| 4836 | initiatingEvent && |
| 4837 | "input" === initiatingEvent.type |
| 4838 | ), |
| 4839 | maskset.validPositions)) |
| 4840 | !0 !== |
| 4841 | maskset.validPositions[vndx].match |
| 4842 | .generated && |
| 4843 | delete maskset.validPositions[vndx] |
| 4844 | .generatedInput; |
| 4845 | } |
| 4846 | function unmaskedvalue(input) { |
| 4847 | if (input) { |
| 4848 | if (void 0 === input.inputmask) return input.value; |
| 4849 | input.inputmask && |
| 4850 | input.inputmask.refreshValue && |
| 4851 | applyInputValue( |
| 4852 | input, |
| 4853 | input.inputmask._valueGet(!0) |
| 4854 | ); |
| 4855 | } |
| 4856 | var umValue = [], |
| 4857 | vps = maskset.validPositions; |
| 4858 | for (var pndx in vps) |
| 4859 | vps[pndx] && |
| 4860 | vps[pndx].match && |
| 4861 | (1 != vps[pndx].match.static || |
| 4862 | !0 !== vps[pndx].generatedInput) && |
| 4863 | umValue.push(vps[pndx].input); |
| 4864 | var unmaskedValue = |
| 4865 | 0 === umValue.length |
| 4866 | ? "" |
| 4867 | : (isRTL ? umValue.reverse() : umValue).join( |
| 4868 | "" |
| 4869 | ); |
| 4870 | if ($.isFunction(opts.onUnMask)) { |
| 4871 | var bufferValue = ( |
| 4872 | isRTL |
| 4873 | ? getBuffer().slice().reverse() |
| 4874 | : getBuffer() |
| 4875 | ).join(""); |
| 4876 | unmaskedValue = opts.onUnMask.call( |
| 4877 | inputmask, |
| 4878 | bufferValue, |
| 4879 | unmaskedValue, |
| 4880 | opts |
| 4881 | ); |
| 4882 | } |
| 4883 | return unmaskedValue; |
| 4884 | } |
| 4885 | function translatePosition(pos) { |
| 4886 | return ( |
| 4887 | !isRTL || |
| 4888 | "number" != typeof pos || |
| 4889 | (opts.greedy && "" === opts.placeholder) || |
| 4890 | !el || |
| 4891 | (pos = el.inputmask._valueGet().length - pos), |
| 4892 | pos |
| 4893 | ); |
| 4894 | } |
| 4895 | function caret(input, begin, end, notranslate, isDelete) { |
| 4896 | var range; |
| 4897 | if (void 0 === begin) |
| 4898 | return ( |
| 4899 | "selectionStart" in input && |
| 4900 | "selectionEnd" in input |
| 4901 | ? ((begin = input.selectionStart), |
| 4902 | (end = input.selectionEnd)) |
| 4903 | : window.getSelection |
| 4904 | ? ((range = window |
| 4905 | .getSelection() |
| 4906 | .getRangeAt(0)), |
| 4907 | (range.commonAncestorContainer |
| 4908 | .parentNode !== input && |
| 4909 | range.commonAncestorContainer !== |
| 4910 | input) || |
| 4911 | ((begin = range.startOffset), |
| 4912 | (end = range.endOffset))) |
| 4913 | : document.selection && |
| 4914 | document.selection.createRange && |
| 4915 | ((range = |
| 4916 | document.selection.createRange()), |
| 4917 | (begin = |
| 4918 | 0 - |
| 4919 | range |
| 4920 | .duplicate() |
| 4921 | .moveStart( |
| 4922 | "character", |
| 4923 | -input.inputmask._valueGet() |
| 4924 | .length |
| 4925 | )), |
| 4926 | (end = begin + range.text.length)), |
| 4927 | { |
| 4928 | begin: notranslate |
| 4929 | ? begin |
| 4930 | : translatePosition(begin), |
| 4931 | end: notranslate |
| 4932 | ? end |
| 4933 | : translatePosition(end), |
| 4934 | } |
| 4935 | ); |
| 4936 | if ( |
| 4937 | ($.isArray(begin) && |
| 4938 | ((end = isRTL ? begin[0] : begin[1]), |
| 4939 | (begin = isRTL ? begin[1] : begin[0])), |
| 4940 | void 0 !== begin.begin && |
| 4941 | ((end = isRTL ? begin.begin : begin.end), |
| 4942 | (begin = isRTL ? begin.end : begin.begin)), |
| 4943 | "number" == typeof begin) |
| 4944 | ) { |
| 4945 | (begin = notranslate |
| 4946 | ? begin |
| 4947 | : translatePosition(begin)), |
| 4948 | (end = notranslate |
| 4949 | ? end |
| 4950 | : translatePosition(end)), |
| 4951 | (end = "number" == typeof end ? end : begin); |
| 4952 | var scrollCalc = |
| 4953 | parseInt( |
| 4954 | ((input.ownerDocument.defaultView || window) |
| 4955 | .getComputedStyle |
| 4956 | ? ( |
| 4957 | input.ownerDocument |
| 4958 | .defaultView || window |
| 4959 | ).getComputedStyle(input, null) |
| 4960 | : input.currentStyle |
| 4961 | ).fontSize |
| 4962 | ) * end; |
| 4963 | if ( |
| 4964 | ((input.scrollLeft = |
| 4965 | scrollCalc > input.scrollWidth |
| 4966 | ? scrollCalc |
| 4967 | : 0), |
| 4968 | (input.inputmask.caretPos = { |
| 4969 | begin: begin, |
| 4970 | end: end, |
| 4971 | }), |
| 4972 | opts.insertModeVisual && |
| 4973 | !1 === opts.insertMode && |
| 4974 | begin === end && |
| 4975 | (isDelete || end++), |
| 4976 | input === |
| 4977 | (input.inputmask.shadowRoot || document) |
| 4978 | .activeElement) |
| 4979 | ) |
| 4980 | if ("setSelectionRange" in input) |
| 4981 | input.setSelectionRange(begin, end); |
| 4982 | else if (window.getSelection) { |
| 4983 | if ( |
| 4984 | ((range = document.createRange()), |
| 4985 | void 0 === input.firstChild || |
| 4986 | null === input.firstChild) |
| 4987 | ) { |
| 4988 | var textNode = |
| 4989 | document.createTextNode(""); |
| 4990 | input.appendChild(textNode); |
| 4991 | } |
| 4992 | range.setStart( |
| 4993 | input.firstChild, |
| 4994 | begin < |
| 4995 | input.inputmask._valueGet().length |
| 4996 | ? begin |
| 4997 | : input.inputmask._valueGet().length |
| 4998 | ), |
| 4999 | range.setEnd( |
| 5000 | input.firstChild, |
| 5001 | end < |
| 5002 | input.inputmask._valueGet() |
| 5003 | .length |
| 5004 | ? end |
| 5005 | : input.inputmask._valueGet() |
| 5006 | .length |
| 5007 | ), |
| 5008 | range.collapse(!0); |
| 5009 | var sel = window.getSelection(); |
| 5010 | sel.removeAllRanges(), sel.addRange(range); |
| 5011 | } else |
| 5012 | input.createTextRange && |
| 5013 | ((range = input.createTextRange()), |
| 5014 | range.collapse(!0), |
| 5015 | range.moveEnd("character", end), |
| 5016 | range.moveStart("character", begin), |
| 5017 | range.select()); |
| 5018 | } |
| 5019 | } |
| 5020 | function determineLastRequiredPosition(returnDefinition) { |
| 5021 | var buffer = getMaskTemplate( |
| 5022 | !0, |
| 5023 | getLastValidPosition(), |
| 5024 | !0, |
| 5025 | !0 |
| 5026 | ), |
| 5027 | bl = buffer.length, |
| 5028 | pos, |
| 5029 | lvp = getLastValidPosition(), |
| 5030 | positions = {}, |
| 5031 | lvTest = maskset.validPositions[lvp], |
| 5032 | ndxIntlzr = |
| 5033 | void 0 !== lvTest |
| 5034 | ? lvTest.locator.slice() |
| 5035 | : void 0, |
| 5036 | testPos; |
| 5037 | for (pos = lvp + 1; pos < buffer.length; pos++) |
| 5038 | (testPos = getTestTemplate( |
| 5039 | pos, |
| 5040 | ndxIntlzr, |
| 5041 | pos - 1 |
| 5042 | )), |
| 5043 | (ndxIntlzr = testPos.locator.slice()), |
| 5044 | (positions[pos] = $.extend(!0, {}, testPos)); |
| 5045 | var lvTestAlt = |
| 5046 | lvTest && void 0 !== lvTest.alternation |
| 5047 | ? lvTest.locator[lvTest.alternation] |
| 5048 | : void 0; |
| 5049 | for ( |
| 5050 | pos = bl - 1; |
| 5051 | lvp < pos && |
| 5052 | ((testPos = positions[pos]), |
| 5053 | (testPos.match.optionality || |
| 5054 | (testPos.match.optionalQuantifier && |
| 5055 | testPos.match.newBlockMarker) || |
| 5056 | (lvTestAlt && |
| 5057 | ((lvTestAlt !== |
| 5058 | positions[pos].locator[ |
| 5059 | lvTest.alternation |
| 5060 | ] && |
| 5061 | 1 != testPos.match.static) || |
| 5062 | (!0 === testPos.match.static && |
| 5063 | testPos.locator[ |
| 5064 | lvTest.alternation |
| 5065 | ] && |
| 5066 | checkAlternationMatch( |
| 5067 | testPos.locator[ |
| 5068 | lvTest.alternation |
| 5069 | ] |
| 5070 | .toString() |
| 5071 | .split(","), |
| 5072 | lvTestAlt.toString().split(",") |
| 5073 | ) && |
| 5074 | "" !== getTests(pos)[0].def)))) && |
| 5075 | buffer[pos] === |
| 5076 | getPlaceholder(pos, testPos.match)); |
| 5077 | pos-- |
| 5078 | ) |
| 5079 | bl--; |
| 5080 | return returnDefinition |
| 5081 | ? { |
| 5082 | l: bl, |
| 5083 | def: positions[bl] |
| 5084 | ? positions[bl].match |
| 5085 | : void 0, |
| 5086 | } |
| 5087 | : bl; |
| 5088 | } |
| 5089 | function clearOptionalTail(buffer) { |
| 5090 | buffer.length = 0; |
| 5091 | for ( |
| 5092 | var template = getMaskTemplate( |
| 5093 | !0, |
| 5094 | 0, |
| 5095 | !0, |
| 5096 | void 0, |
| 5097 | !0 |
| 5098 | ), |
| 5099 | lmnt; |
| 5100 | void 0 !== (lmnt = template.shift()); |
| 5101 | |
| 5102 | ) |
| 5103 | buffer.push(lmnt); |
| 5104 | return buffer; |
| 5105 | } |
| 5106 | function isComplete(buffer) { |
| 5107 | if ($.isFunction(opts.isComplete)) |
| 5108 | return opts.isComplete(buffer, opts); |
| 5109 | if ("*" !== opts.repeat) { |
| 5110 | var complete = !1, |
| 5111 | lrp = determineLastRequiredPosition(!0), |
| 5112 | aml = seekPrevious(lrp.l); |
| 5113 | if ( |
| 5114 | void 0 === lrp.def || |
| 5115 | lrp.def.newBlockMarker || |
| 5116 | lrp.def.optionality || |
| 5117 | lrp.def.optionalQuantifier |
| 5118 | ) { |
| 5119 | complete = !0; |
| 5120 | for (var i = 0; i <= aml; i++) { |
| 5121 | var test = getTestTemplate(i).match; |
| 5122 | if ( |
| 5123 | (!0 !== test.static && |
| 5124 | void 0 === |
| 5125 | maskset.validPositions[i] && |
| 5126 | !0 !== test.optionality && |
| 5127 | !0 !== test.optionalQuantifier) || |
| 5128 | (!0 === test.static && |
| 5129 | buffer[i] !== |
| 5130 | getPlaceholder(i, test)) |
| 5131 | ) { |
| 5132 | complete = !1; |
| 5133 | break; |
| 5134 | } |
| 5135 | } |
| 5136 | } |
| 5137 | return complete; |
| 5138 | } |
| 5139 | } |
| 5140 | function handleRemove(input, k, pos, strict, fromIsValid) { |
| 5141 | if ( |
| 5142 | (opts.numericInput || isRTL) && |
| 5143 | (k === keyCode.BACKSPACE |
| 5144 | ? (k = keyCode.DELETE) |
| 5145 | : k === keyCode.DELETE && |
| 5146 | (k = keyCode.BACKSPACE), |
| 5147 | isRTL) |
| 5148 | ) { |
| 5149 | var pend = pos.end; |
| 5150 | (pos.end = pos.begin), (pos.begin = pend); |
| 5151 | } |
| 5152 | var lvp = getLastValidPosition(void 0, !0), |
| 5153 | offset; |
| 5154 | if ( |
| 5155 | (pos.end >= getBuffer().length && |
| 5156 | lvp >= pos.end && |
| 5157 | (pos.end = lvp + 1), |
| 5158 | k === keyCode.BACKSPACE |
| 5159 | ? pos.end - pos.begin < 1 && |
| 5160 | (pos.begin = seekPrevious(pos.begin)) |
| 5161 | : k === keyCode.DELETE && |
| 5162 | pos.begin === pos.end && |
| 5163 | (pos.end = isMask(pos.end, !0, !0) |
| 5164 | ? pos.end + 1 |
| 5165 | : seekNext(pos.end) + 1), |
| 5166 | !1 !== (offset = revalidateMask(pos))) |
| 5167 | ) { |
| 5168 | if ( |
| 5169 | (!0 !== strict && !1 !== opts.keepStatic) || |
| 5170 | (null !== opts.regex && |
| 5171 | -1 !== |
| 5172 | getTest(pos.begin).match.def.indexOf( |
| 5173 | "|" |
| 5174 | )) |
| 5175 | ) { |
| 5176 | var result = alternate(!0); |
| 5177 | if (result) { |
| 5178 | var newPos = |
| 5179 | void 0 !== result.caret |
| 5180 | ? result.caret |
| 5181 | : result.pos |
| 5182 | ? seekNext( |
| 5183 | result.pos.begin |
| 5184 | ? result.pos.begin |
| 5185 | : result.pos |
| 5186 | ) |
| 5187 | : getLastValidPosition(-1, !0); |
| 5188 | (k !== keyCode.DELETE || |
| 5189 | pos.begin > newPos) && |
| 5190 | pos.begin; |
| 5191 | } |
| 5192 | } |
| 5193 | !0 !== strict && |
| 5194 | (maskset.p = |
| 5195 | k === keyCode.DELETE |
| 5196 | ? pos.begin + offset |
| 5197 | : pos.begin); |
| 5198 | } |
| 5199 | } |
| 5200 | function applyInputValue(input, value) { |
| 5201 | (input.inputmask.refreshValue = !1), |
| 5202 | $.isFunction(opts.onBeforeMask) && |
| 5203 | (value = |
| 5204 | opts.onBeforeMask.call( |
| 5205 | inputmask, |
| 5206 | value, |
| 5207 | opts |
| 5208 | ) || value), |
| 5209 | (value = value.toString().split("")), |
| 5210 | checkVal(input, !0, !1, value), |
| 5211 | (undoValue = getBuffer().join("")), |
| 5212 | (opts.clearMaskOnLostFocus || |
| 5213 | opts.clearIncomplete) && |
| 5214 | input.inputmask._valueGet() === |
| 5215 | getBufferTemplate().join("") && |
| 5216 | -1 === getLastValidPosition() && |
| 5217 | input.inputmask._valueSet(""); |
| 5218 | } |
| 5219 | function mask(elem) { |
| 5220 | function isElementTypeSupported(input, opts) { |
| 5221 | function patchValueProperty(npt) { |
| 5222 | var valueGet, valueSet; |
| 5223 | function patchValhook(type) { |
| 5224 | if ( |
| 5225 | $.valHooks && |
| 5226 | (void 0 === $.valHooks[type] || |
| 5227 | !0 !== |
| 5228 | $.valHooks[type].inputmaskpatch) |
| 5229 | ) { |
| 5230 | var valhookGet = |
| 5231 | $.valHooks[type] && |
| 5232 | $.valHooks[type].get |
| 5233 | ? $.valHooks[type].get |
| 5234 | : function (elem) { |
| 5235 | return elem.value; |
| 5236 | }, |
| 5237 | valhookSet = |
| 5238 | $.valHooks[type] && |
| 5239 | $.valHooks[type].set |
| 5240 | ? $.valHooks[type].set |
| 5241 | : function (elem, value) { |
| 5242 | return ( |
| 5243 | (elem.value = |
| 5244 | value), |
| 5245 | elem |
| 5246 | ); |
| 5247 | }; |
| 5248 | $.valHooks[type] = { |
| 5249 | get: function get(elem) { |
| 5250 | if (elem.inputmask) { |
| 5251 | if ( |
| 5252 | elem.inputmask.opts |
| 5253 | .autoUnmask |
| 5254 | ) |
| 5255 | return elem.inputmask.unmaskedvalue(); |
| 5256 | var result = |
| 5257 | valhookGet(elem); |
| 5258 | return -1 !== |
| 5259 | getLastValidPosition( |
| 5260 | void 0, |
| 5261 | void 0, |
| 5262 | elem.inputmask |
| 5263 | .maskset |
| 5264 | .validPositions |
| 5265 | ) || |
| 5266 | !0 !== opts.nullable |
| 5267 | ? result |
| 5268 | : ""; |
| 5269 | } |
| 5270 | return valhookGet(elem); |
| 5271 | }, |
| 5272 | set: function set(elem, value) { |
| 5273 | var result = valhookSet( |
| 5274 | elem, |
| 5275 | value |
| 5276 | ); |
| 5277 | return ( |
| 5278 | elem.inputmask && |
| 5279 | applyInputValue( |
| 5280 | elem, |
| 5281 | value |
| 5282 | ), |
| 5283 | result |
| 5284 | ); |
| 5285 | }, |
| 5286 | inputmaskpatch: !0, |
| 5287 | }; |
| 5288 | } |
| 5289 | } |
| 5290 | function getter() { |
| 5291 | return this.inputmask |
| 5292 | ? this.inputmask.opts.autoUnmask |
| 5293 | ? this.inputmask.unmaskedvalue() |
| 5294 | : -1 !== getLastValidPosition() || |
| 5295 | !0 !== opts.nullable |
| 5296 | ? (this.inputmask.shadowRoot || |
| 5297 | document.activeElement) === |
| 5298 | this && |
| 5299 | opts.clearMaskOnLostFocus |
| 5300 | ? (isRTL |
| 5301 | ? clearOptionalTail( |
| 5302 | getBuffer().slice() |
| 5303 | ).reverse() |
| 5304 | : clearOptionalTail( |
| 5305 | getBuffer().slice() |
| 5306 | ) |
| 5307 | ).join("") |
| 5308 | : valueGet.call(this) |
| 5309 | : "" |
| 5310 | : valueGet.call(this); |
| 5311 | } |
| 5312 | function setter(value) { |
| 5313 | valueSet.call(this, value), |
| 5314 | this.inputmask && |
| 5315 | applyInputValue(this, value); |
| 5316 | } |
| 5317 | function installNativeValueSetFallback(npt) { |
| 5318 | EventRuler.on( |
| 5319 | npt, |
| 5320 | "mouseenter", |
| 5321 | function () { |
| 5322 | var input = this, |
| 5323 | value = |
| 5324 | this.inputmask._valueGet( |
| 5325 | !0 |
| 5326 | ); |
| 5327 | value !== |
| 5328 | (isRTL |
| 5329 | ? getBuffer().reverse() |
| 5330 | : getBuffer() |
| 5331 | ).join("") && |
| 5332 | applyInputValue(this, value); |
| 5333 | } |
| 5334 | ); |
| 5335 | } |
| 5336 | if (!npt.inputmask.__valueGet) { |
| 5337 | if (!0 !== opts.noValuePatching) { |
| 5338 | if (Object.getOwnPropertyDescriptor) { |
| 5339 | "function" != |
| 5340 | typeof Object.getPrototypeOf && |
| 5341 | (Object.getPrototypeOf = |
| 5342 | "object" === |
| 5343 | _typeof("test".__proto__) |
| 5344 | ? function (object) { |
| 5345 | return object.__proto__; |
| 5346 | } |
| 5347 | : function (object) { |
| 5348 | return object |
| 5349 | .constructor |
| 5350 | .prototype; |
| 5351 | }); |
| 5352 | var valueProperty = |
| 5353 | Object.getPrototypeOf |
| 5354 | ? Object.getOwnPropertyDescriptor( |
| 5355 | Object.getPrototypeOf( |
| 5356 | npt |
| 5357 | ), |
| 5358 | "value" |
| 5359 | ) |
| 5360 | : void 0; |
| 5361 | valueProperty && |
| 5362 | valueProperty.get && |
| 5363 | valueProperty.set |
| 5364 | ? ((valueGet = |
| 5365 | valueProperty.get), |
| 5366 | (valueSet = |
| 5367 | valueProperty.set), |
| 5368 | Object.defineProperty( |
| 5369 | npt, |
| 5370 | "value", |
| 5371 | { |
| 5372 | get: getter, |
| 5373 | set: setter, |
| 5374 | configurable: !0, |
| 5375 | } |
| 5376 | )) |
| 5377 | : "input" !== |
| 5378 | npt.tagName.toLowerCase() && |
| 5379 | ((valueGet = |
| 5380 | function valueGet() { |
| 5381 | return this |
| 5382 | .textContent; |
| 5383 | }), |
| 5384 | (valueSet = function valueSet( |
| 5385 | value |
| 5386 | ) { |
| 5387 | this.textContent = |
| 5388 | value; |
| 5389 | }), |
| 5390 | Object.defineProperty( |
| 5391 | npt, |
| 5392 | "value", |
| 5393 | { |
| 5394 | get: getter, |
| 5395 | set: setter, |
| 5396 | configurable: !0, |
| 5397 | } |
| 5398 | )); |
| 5399 | } else |
| 5400 | document.__lookupGetter__ && |
| 5401 | npt.__lookupGetter__("value") && |
| 5402 | ((valueGet = |
| 5403 | npt.__lookupGetter__( |
| 5404 | "value" |
| 5405 | )), |
| 5406 | (valueSet = |
| 5407 | npt.__lookupSetter__( |
| 5408 | "value" |
| 5409 | )), |
| 5410 | npt.__defineGetter__( |
| 5411 | "value", |
| 5412 | getter |
| 5413 | ), |
| 5414 | npt.__defineSetter__( |
| 5415 | "value", |
| 5416 | setter |
| 5417 | )); |
| 5418 | (npt.inputmask.__valueGet = valueGet), |
| 5419 | (npt.inputmask.__valueSet = |
| 5420 | valueSet); |
| 5421 | } |
| 5422 | (npt.inputmask._valueGet = function ( |
| 5423 | overruleRTL |
| 5424 | ) { |
| 5425 | return isRTL && !0 !== overruleRTL |
| 5426 | ? valueGet |
| 5427 | .call(this.el) |
| 5428 | .split("") |
| 5429 | .reverse() |
| 5430 | .join("") |
| 5431 | : valueGet.call(this.el); |
| 5432 | }), |
| 5433 | (npt.inputmask._valueSet = function ( |
| 5434 | value, |
| 5435 | overruleRTL |
| 5436 | ) { |
| 5437 | valueSet.call( |
| 5438 | this.el, |
| 5439 | null == value |
| 5440 | ? "" |
| 5441 | : !0 !== overruleRTL && |
| 5442 | isRTL |
| 5443 | ? value |
| 5444 | .split("") |
| 5445 | .reverse() |
| 5446 | .join("") |
| 5447 | : value |
| 5448 | ); |
| 5449 | }), |
| 5450 | void 0 === valueGet && |
| 5451 | ((valueGet = function valueGet() { |
| 5452 | return this.value; |
| 5453 | }), |
| 5454 | (valueSet = function valueSet( |
| 5455 | value |
| 5456 | ) { |
| 5457 | this.value = value; |
| 5458 | }), |
| 5459 | patchValhook(npt.type), |
| 5460 | installNativeValueSetFallback(npt)); |
| 5461 | } |
| 5462 | } |
| 5463 | "textarea" !== input.tagName.toLowerCase() && |
| 5464 | opts.ignorables.push(keyCode.ENTER); |
| 5465 | var elementType = input.getAttribute("type"), |
| 5466 | isSupported = |
| 5467 | ("input" === input.tagName.toLowerCase() && |
| 5468 | -1 !== |
| 5469 | $.inArray( |
| 5470 | elementType, |
| 5471 | opts.supportsInputType |
| 5472 | )) || |
| 5473 | input.isContentEditable || |
| 5474 | "textarea" === input.tagName.toLowerCase(); |
| 5475 | if (!isSupported) |
| 5476 | if ("input" === input.tagName.toLowerCase()) { |
| 5477 | var el = document.createElement("input"); |
| 5478 | el.setAttribute("type", elementType), |
| 5479 | (isSupported = "text" === el.type), |
| 5480 | (el = null); |
| 5481 | } else isSupported = "partial"; |
| 5482 | return ( |
| 5483 | !1 !== isSupported |
| 5484 | ? patchValueProperty(input) |
| 5485 | : (input.inputmask = void 0), |
| 5486 | isSupported |
| 5487 | ); |
| 5488 | } |
| 5489 | EventRuler.off(elem); |
| 5490 | var isSupported = isElementTypeSupported(elem, opts); |
| 5491 | if (!1 !== isSupported) { |
| 5492 | (el = elem), |
| 5493 | ($el = $(el)), |
| 5494 | (originalPlaceholder = el.placeholder), |
| 5495 | (maxLength = |
| 5496 | void 0 !== el ? el.maxLength : void 0), |
| 5497 | -1 === maxLength && (maxLength = void 0), |
| 5498 | "inputMode" in el && |
| 5499 | null === el.getAttribute("inputmode") && |
| 5500 | ((el.inputMode = opts.inputmode), |
| 5501 | el.setAttribute( |
| 5502 | "inputmode", |
| 5503 | opts.inputmode |
| 5504 | )), |
| 5505 | !0 === isSupported && |
| 5506 | ((opts.showMaskOnFocus = |
| 5507 | opts.showMaskOnFocus && |
| 5508 | -1 === |
| 5509 | ["cc-number", "cc-exp"].indexOf( |
| 5510 | el.autocomplete |
| 5511 | )), |
| 5512 | iphone && (opts.insertModeVisual = !1), |
| 5513 | EventRuler.on( |
| 5514 | el, |
| 5515 | "submit", |
| 5516 | EventHandlers.submitEvent |
| 5517 | ), |
| 5518 | EventRuler.on( |
| 5519 | el, |
| 5520 | "reset", |
| 5521 | EventHandlers.resetEvent |
| 5522 | ), |
| 5523 | EventRuler.on( |
| 5524 | el, |
| 5525 | "blur", |
| 5526 | EventHandlers.blurEvent |
| 5527 | ), |
| 5528 | EventRuler.on( |
| 5529 | el, |
| 5530 | "focus", |
| 5531 | EventHandlers.focusEvent |
| 5532 | ), |
| 5533 | EventRuler.on( |
| 5534 | el, |
| 5535 | "invalid", |
| 5536 | EventHandlers.invalidEvent |
| 5537 | ), |
| 5538 | EventRuler.on( |
| 5539 | el, |
| 5540 | "click", |
| 5541 | EventHandlers.clickEvent |
| 5542 | ), |
| 5543 | EventRuler.on( |
| 5544 | el, |
| 5545 | "mouseleave", |
| 5546 | EventHandlers.mouseleaveEvent |
| 5547 | ), |
| 5548 | EventRuler.on( |
| 5549 | el, |
| 5550 | "mouseenter", |
| 5551 | EventHandlers.mouseenterEvent |
| 5552 | ), |
| 5553 | EventRuler.on( |
| 5554 | el, |
| 5555 | "paste", |
| 5556 | EventHandlers.pasteEvent |
| 5557 | ), |
| 5558 | EventRuler.on( |
| 5559 | el, |
| 5560 | "cut", |
| 5561 | EventHandlers.cutEvent |
| 5562 | ), |
| 5563 | EventRuler.on( |
| 5564 | el, |
| 5565 | "complete", |
| 5566 | opts.oncomplete |
| 5567 | ), |
| 5568 | EventRuler.on( |
| 5569 | el, |
| 5570 | "incomplete", |
| 5571 | opts.onincomplete |
| 5572 | ), |
| 5573 | EventRuler.on( |
| 5574 | el, |
| 5575 | "cleared", |
| 5576 | opts.oncleared |
| 5577 | ), |
| 5578 | mobile || !0 === opts.inputEventOnly |
| 5579 | ? el.removeAttribute("maxLength") |
| 5580 | : (EventRuler.on( |
| 5581 | el, |
| 5582 | "keydown", |
| 5583 | EventHandlers.keydownEvent |
| 5584 | ), |
| 5585 | EventRuler.on( |
| 5586 | el, |
| 5587 | "keypress", |
| 5588 | EventHandlers.keypressEvent |
| 5589 | )), |
| 5590 | EventRuler.on( |
| 5591 | el, |
| 5592 | "input", |
| 5593 | EventHandlers.inputFallBackEvent |
| 5594 | ), |
| 5595 | EventRuler.on( |
| 5596 | el, |
| 5597 | "compositionend", |
| 5598 | EventHandlers.compositionendEvent |
| 5599 | )), |
| 5600 | EventRuler.on( |
| 5601 | el, |
| 5602 | "setvalue", |
| 5603 | EventHandlers.setValueEvent |
| 5604 | ), |
| 5605 | (undoValue = getBufferTemplate().join("")); |
| 5606 | var activeElement = ( |
| 5607 | el.inputmask.shadowRoot || document |
| 5608 | ).activeElement; |
| 5609 | if ( |
| 5610 | "" !== el.inputmask._valueGet(!0) || |
| 5611 | !1 === opts.clearMaskOnLostFocus || |
| 5612 | activeElement === el |
| 5613 | ) { |
| 5614 | applyInputValue( |
| 5615 | el, |
| 5616 | el.inputmask._valueGet(!0), |
| 5617 | opts |
| 5618 | ); |
| 5619 | var buffer = getBuffer().slice(); |
| 5620 | !1 === isComplete(buffer) && |
| 5621 | opts.clearIncomplete && |
| 5622 | resetMaskSet(), |
| 5623 | opts.clearMaskOnLostFocus && |
| 5624 | activeElement !== el && |
| 5625 | (-1 === getLastValidPosition() |
| 5626 | ? (buffer = []) |
| 5627 | : clearOptionalTail(buffer)), |
| 5628 | (!1 === opts.clearMaskOnLostFocus || |
| 5629 | (opts.showMaskOnFocus && |
| 5630 | activeElement === el) || |
| 5631 | "" !== el.inputmask._valueGet(!0)) && |
| 5632 | writeBuffer(el, buffer), |
| 5633 | activeElement === el && |
| 5634 | caret( |
| 5635 | el, |
| 5636 | seekNext(getLastValidPosition()) |
| 5637 | ); |
| 5638 | } |
| 5639 | } |
| 5640 | } |
| 5641 | if (void 0 !== actionObj) |
| 5642 | switch (actionObj.action) { |
| 5643 | case "isComplete": |
| 5644 | return ( |
| 5645 | (el = actionObj.el), isComplete(getBuffer()) |
| 5646 | ); |
| 5647 | |
| 5648 | case "unmaskedvalue": |
| 5649 | return ( |
| 5650 | (void 0 !== el && |
| 5651 | void 0 === actionObj.value) || |
| 5652 | ((valueBuffer = actionObj.value), |
| 5653 | (valueBuffer = ( |
| 5654 | ($.isFunction(opts.onBeforeMask) && |
| 5655 | opts.onBeforeMask.call( |
| 5656 | inputmask, |
| 5657 | valueBuffer, |
| 5658 | opts |
| 5659 | )) || |
| 5660 | valueBuffer |
| 5661 | ).split("")), |
| 5662 | checkVal.call( |
| 5663 | this, |
| 5664 | void 0, |
| 5665 | !1, |
| 5666 | !1, |
| 5667 | valueBuffer |
| 5668 | ), |
| 5669 | $.isFunction(opts.onBeforeWrite) && |
| 5670 | opts.onBeforeWrite.call( |
| 5671 | inputmask, |
| 5672 | void 0, |
| 5673 | getBuffer(), |
| 5674 | 0, |
| 5675 | opts |
| 5676 | )), |
| 5677 | unmaskedvalue(el) |
| 5678 | ); |
| 5679 | |
| 5680 | case "mask": |
| 5681 | mask(el); |
| 5682 | break; |
| 5683 | |
| 5684 | case "format": |
| 5685 | return ( |
| 5686 | (valueBuffer = ( |
| 5687 | ($.isFunction(opts.onBeforeMask) && |
| 5688 | opts.onBeforeMask.call( |
| 5689 | inputmask, |
| 5690 | actionObj.value, |
| 5691 | opts |
| 5692 | )) || |
| 5693 | actionObj.value |
| 5694 | ).split("")), |
| 5695 | checkVal.call( |
| 5696 | this, |
| 5697 | void 0, |
| 5698 | !0, |
| 5699 | !1, |
| 5700 | valueBuffer |
| 5701 | ), |
| 5702 | actionObj.metadata |
| 5703 | ? { |
| 5704 | value: isRTL |
| 5705 | ? getBuffer() |
| 5706 | .slice() |
| 5707 | .reverse() |
| 5708 | .join("") |
| 5709 | : getBuffer().join(""), |
| 5710 | metadata: maskScope.call( |
| 5711 | this, |
| 5712 | { |
| 5713 | action: "getmetadata", |
| 5714 | }, |
| 5715 | maskset, |
| 5716 | opts |
| 5717 | ), |
| 5718 | } |
| 5719 | : isRTL |
| 5720 | ? getBuffer().slice().reverse().join("") |
| 5721 | : getBuffer().join("") |
| 5722 | ); |
| 5723 | |
| 5724 | case "isValid": |
| 5725 | actionObj.value |
| 5726 | ? ((valueBuffer = ( |
| 5727 | ($.isFunction(opts.onBeforeMask) && |
| 5728 | opts.onBeforeMask.call( |
| 5729 | inputmask, |
| 5730 | actionObj.value, |
| 5731 | opts |
| 5732 | )) || |
| 5733 | actionObj.value |
| 5734 | ).split("")), |
| 5735 | checkVal.call( |
| 5736 | this, |
| 5737 | void 0, |
| 5738 | !0, |
| 5739 | !1, |
| 5740 | valueBuffer |
| 5741 | )) |
| 5742 | : (actionObj.value = isRTL |
| 5743 | ? getBuffer() |
| 5744 | .slice() |
| 5745 | .reverse() |
| 5746 | .join("") |
| 5747 | : getBuffer().join("")); |
| 5748 | for ( |
| 5749 | var buffer = getBuffer(), |
| 5750 | rl = determineLastRequiredPosition(), |
| 5751 | lmib = buffer.length - 1; |
| 5752 | rl < lmib && !isMask(lmib); |
| 5753 | lmib-- |
| 5754 | ); |
| 5755 | return ( |
| 5756 | buffer.splice(rl, lmib + 1 - rl), |
| 5757 | isComplete(buffer) && |
| 5758 | actionObj.value === |
| 5759 | (isRTL |
| 5760 | ? getBuffer() |
| 5761 | .slice() |
| 5762 | .reverse() |
| 5763 | .join("") |
| 5764 | : getBuffer().join("")) |
| 5765 | ); |
| 5766 | |
| 5767 | case "getemptymask": |
| 5768 | return getBufferTemplate().join(""); |
| 5769 | |
| 5770 | case "remove": |
| 5771 | if (el && el.inputmask) { |
| 5772 | $.data(el, "_inputmask_opts", null), |
| 5773 | ($el = $(el)); |
| 5774 | var cv = opts.autoUnmask |
| 5775 | ? unmaskedvalue(el) |
| 5776 | : el.inputmask._valueGet( |
| 5777 | opts.autoUnmask |
| 5778 | ), |
| 5779 | valueProperty; |
| 5780 | cv !== getBufferTemplate().join("") |
| 5781 | ? el.inputmask._valueSet( |
| 5782 | cv, |
| 5783 | opts.autoUnmask |
| 5784 | ) |
| 5785 | : el.inputmask._valueSet(""), |
| 5786 | EventRuler.off(el), |
| 5787 | Object.getOwnPropertyDescriptor && |
| 5788 | Object.getPrototypeOf |
| 5789 | ? ((valueProperty = |
| 5790 | Object.getOwnPropertyDescriptor( |
| 5791 | Object.getPrototypeOf( |
| 5792 | el |
| 5793 | ), |
| 5794 | "value" |
| 5795 | )), |
| 5796 | valueProperty && |
| 5797 | el.inputmask.__valueGet && |
| 5798 | Object.defineProperty( |
| 5799 | el, |
| 5800 | "value", |
| 5801 | { |
| 5802 | get: el.inputmask |
| 5803 | .__valueGet, |
| 5804 | set: el.inputmask |
| 5805 | .__valueSet, |
| 5806 | configurable: !0, |
| 5807 | } |
| 5808 | )) |
| 5809 | : document.__lookupGetter__ && |
| 5810 | el.__lookupGetter__("value") && |
| 5811 | el.inputmask.__valueGet && |
| 5812 | (el.__defineGetter__( |
| 5813 | "value", |
| 5814 | el.inputmask.__valueGet |
| 5815 | ), |
| 5816 | el.__defineSetter__( |
| 5817 | "value", |
| 5818 | el.inputmask.__valueSet |
| 5819 | )), |
| 5820 | (el.inputmask = void 0); |
| 5821 | } |
| 5822 | return el; |
| 5823 | |
| 5824 | case "getmetadata": |
| 5825 | if ($.isArray(maskset.metadata)) { |
| 5826 | var maskTarget = getMaskTemplate( |
| 5827 | !0, |
| 5828 | 0, |
| 5829 | !1 |
| 5830 | ).join(""); |
| 5831 | return ( |
| 5832 | $.each( |
| 5833 | maskset.metadata, |
| 5834 | function (ndx, mtdt) { |
| 5835 | if (mtdt.mask === maskTarget) |
| 5836 | return ( |
| 5837 | (maskTarget = mtdt), !1 |
| 5838 | ); |
| 5839 | } |
| 5840 | ), |
| 5841 | maskTarget |
| 5842 | ); |
| 5843 | } |
| 5844 | return maskset.metadata; |
| 5845 | } |
| 5846 | }; |
| 5847 | }, |
| 5848 | function (module, exports, __webpack_require__) { |
| 5849 | "use strict"; |
| 5850 | function _typeof(obj) { |
| 5851 | return ( |
| 5852 | (_typeof = |
| 5853 | "function" == typeof Symbol && |
| 5854 | "symbol" == typeof Symbol.iterator |
| 5855 | ? function _typeof(obj) { |
| 5856 | return typeof obj; |
| 5857 | } |
| 5858 | : function _typeof(obj) { |
| 5859 | return obj && |
| 5860 | "function" == typeof Symbol && |
| 5861 | obj.constructor === Symbol && |
| 5862 | obj !== Symbol.prototype |
| 5863 | ? "symbol" |
| 5864 | : typeof obj; |
| 5865 | }), |
| 5866 | _typeof(obj) |
| 5867 | ); |
| 5868 | } |
| 5869 | var Inputmask = __webpack_require__(1), |
| 5870 | $ = Inputmask.dependencyLib, |
| 5871 | keyCode = __webpack_require__(0), |
| 5872 | formatCode = { |
| 5873 | d: [ |
| 5874 | "[1-9]|[12][0-9]|3[01]", |
| 5875 | Date.prototype.setDate, |
| 5876 | "day", |
| 5877 | Date.prototype.getDate, |
| 5878 | ], |
| 5879 | dd: [ |
| 5880 | "0[1-9]|[12][0-9]|3[01]", |
| 5881 | Date.prototype.setDate, |
| 5882 | "day", |
| 5883 | function () { |
| 5884 | return pad( |
| 5885 | Date.prototype.getDate.call(this), |
| 5886 | 2 |
| 5887 | ); |
| 5888 | }, |
| 5889 | ], |
| 5890 | ddd: [""], |
| 5891 | dddd: [""], |
| 5892 | m: [ |
| 5893 | "[1-9]|1[012]", |
| 5894 | Date.prototype.setMonth, |
| 5895 | "month", |
| 5896 | function () { |
| 5897 | return Date.prototype.getMonth.call(this) + 1; |
| 5898 | }, |
| 5899 | ], |
| 5900 | mm: [ |
| 5901 | "0[1-9]|1[012]", |
| 5902 | Date.prototype.setMonth, |
| 5903 | "month", |
| 5904 | function () { |
| 5905 | return pad( |
| 5906 | Date.prototype.getMonth.call(this) + 1, |
| 5907 | 2 |
| 5908 | ); |
| 5909 | }, |
| 5910 | ], |
| 5911 | mmm: [""], |
| 5912 | mmmm: [""], |
| 5913 | yy: [ |
| 5914 | "[0-9]{2}", |
| 5915 | Date.prototype.setFullYear, |
| 5916 | "year", |
| 5917 | function () { |
| 5918 | return pad( |
| 5919 | Date.prototype.getFullYear.call(this), |
| 5920 | 2 |
| 5921 | ); |
| 5922 | }, |
| 5923 | ], |
| 5924 | yyyy: [ |
| 5925 | "[0-9]{4}", |
| 5926 | Date.prototype.setFullYear, |
| 5927 | "year", |
| 5928 | function () { |
| 5929 | return pad( |
| 5930 | Date.prototype.getFullYear.call(this), |
| 5931 | 4 |
| 5932 | ); |
| 5933 | }, |
| 5934 | ], |
| 5935 | h: [ |
| 5936 | "[1-9]|1[0-2]", |
| 5937 | Date.prototype.setHours, |
| 5938 | "hours", |
| 5939 | Date.prototype.getHours, |
| 5940 | ], |
| 5941 | hh: [ |
| 5942 | "0[1-9]|1[0-2]", |
| 5943 | Date.prototype.setHours, |
| 5944 | "hours", |
| 5945 | function () { |
| 5946 | return pad( |
| 5947 | Date.prototype.getHours.call(this), |
| 5948 | 2 |
| 5949 | ); |
| 5950 | }, |
| 5951 | ], |
| 5952 | hx: [ |
| 5953 | function (x) { |
| 5954 | return "[0-9]{".concat(x, "}"); |
| 5955 | }, |
| 5956 | Date.prototype.setHours, |
| 5957 | "hours", |
| 5958 | function (x) { |
| 5959 | return Date.prototype.getHours; |
| 5960 | }, |
| 5961 | ], |
| 5962 | H: [ |
| 5963 | "1?[0-9]|2[0-3]", |
| 5964 | Date.prototype.setHours, |
| 5965 | "hours", |
| 5966 | Date.prototype.getHours, |
| 5967 | ], |
| 5968 | HH: [ |
| 5969 | "0[0-9]|1[0-9]|2[0-3]", |
| 5970 | Date.prototype.setHours, |
| 5971 | "hours", |
| 5972 | function () { |
| 5973 | return pad( |
| 5974 | Date.prototype.getHours.call(this), |
| 5975 | 2 |
| 5976 | ); |
| 5977 | }, |
| 5978 | ], |
| 5979 | Hx: [ |
| 5980 | function (x) { |
| 5981 | return "[0-9]{".concat(x, "}"); |
| 5982 | }, |
| 5983 | Date.prototype.setHours, |
| 5984 | "hours", |
| 5985 | function (x) { |
| 5986 | return function () { |
| 5987 | return pad( |
| 5988 | Date.prototype.getHours.call(this), |
| 5989 | x |
| 5990 | ); |
| 5991 | }; |
| 5992 | }, |
| 5993 | ], |
| 5994 | M: [ |
| 5995 | "[1-5]?[0-9]", |
| 5996 | Date.prototype.setMinutes, |
| 5997 | "minutes", |
| 5998 | Date.prototype.getMinutes, |
| 5999 | ], |
| 6000 | MM: [ |
| 6001 | "0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]", |
| 6002 | Date.prototype.setMinutes, |
| 6003 | "minutes", |
| 6004 | function () { |
| 6005 | return pad( |
| 6006 | Date.prototype.getMinutes.call(this), |
| 6007 | 2 |
| 6008 | ); |
| 6009 | }, |
| 6010 | ], |
| 6011 | s: [ |
| 6012 | "[1-5]?[0-9]", |
| 6013 | Date.prototype.setSeconds, |
| 6014 | "seconds", |
| 6015 | Date.prototype.getSeconds, |
| 6016 | ], |
| 6017 | ss: [ |
| 6018 | "0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]", |
| 6019 | Date.prototype.setSeconds, |
| 6020 | "seconds", |
| 6021 | function () { |
| 6022 | return pad( |
| 6023 | Date.prototype.getSeconds.call(this), |
| 6024 | 2 |
| 6025 | ); |
| 6026 | }, |
| 6027 | ], |
| 6028 | l: [ |
| 6029 | "[0-9]{3}", |
| 6030 | Date.prototype.setMilliseconds, |
| 6031 | "milliseconds", |
| 6032 | function () { |
| 6033 | return pad( |
| 6034 | Date.prototype.getMilliseconds.call(this), |
| 6035 | 3 |
| 6036 | ); |
| 6037 | }, |
| 6038 | ], |
| 6039 | L: [ |
| 6040 | "[0-9]{2}", |
| 6041 | Date.prototype.setMilliseconds, |
| 6042 | "milliseconds", |
| 6043 | function () { |
| 6044 | return pad( |
| 6045 | Date.prototype.getMilliseconds.call(this), |
| 6046 | 2 |
| 6047 | ); |
| 6048 | }, |
| 6049 | ], |
| 6050 | t: ["[ap]"], |
| 6051 | tt: ["[ap]m"], |
| 6052 | T: ["[AP]"], |
| 6053 | TT: ["[AP]M"], |
| 6054 | Z: [""], |
| 6055 | o: [""], |
| 6056 | S: [""], |
| 6057 | }, |
| 6058 | formatAlias = { |
| 6059 | isoDate: "yyyy-mm-dd", |
| 6060 | isoTime: "HH:MM:ss", |
| 6061 | isoDateTime: "yyyy-mm-dd'T'HH:MM:ss", |
| 6062 | isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'", |
| 6063 | }; |
| 6064 | function formatcode(match) { |
| 6065 | var dynMatches = new RegExp("\\d+$").exec(match[0]); |
| 6066 | if (dynMatches && void 0 !== dynMatches[0]) { |
| 6067 | var fcode = formatCode[match[0][0] + "x"].slice(""); |
| 6068 | return ( |
| 6069 | (fcode[0] = fcode[0](dynMatches[0])), |
| 6070 | (fcode[3] = fcode[3](dynMatches[0])), |
| 6071 | fcode |
| 6072 | ); |
| 6073 | } |
| 6074 | if (formatCode[match[0]]) return formatCode[match[0]]; |
| 6075 | } |
| 6076 | function getTokenizer(opts) { |
| 6077 | if (!opts.tokenizer) { |
| 6078 | var tokens = [], |
| 6079 | dyntokens = []; |
| 6080 | for (var ndx in formatCode) |
| 6081 | if (/\.*x$/.test(ndx)) { |
| 6082 | var dynToken = ndx[0] + "\\d+"; |
| 6083 | -1 === dyntokens.indexOf(dynToken) && |
| 6084 | dyntokens.push(dynToken); |
| 6085 | } else |
| 6086 | -1 === tokens.indexOf(ndx[0]) && |
| 6087 | tokens.push(ndx[0]); |
| 6088 | (opts.tokenizer = |
| 6089 | "(" + |
| 6090 | (0 < dyntokens.length |
| 6091 | ? dyntokens.join("|") + "|" |
| 6092 | : "") + |
| 6093 | tokens.join("+|") + |
| 6094 | ")+?|."), |
| 6095 | (opts.tokenizer = new RegExp(opts.tokenizer, "g")); |
| 6096 | } |
| 6097 | return opts.tokenizer; |
| 6098 | } |
| 6099 | function isValidDate(dateParts, currentResult) { |
| 6100 | return ( |
| 6101 | (!isFinite(dateParts.rawday) || |
| 6102 | ("29" == dateParts.day && |
| 6103 | !isFinite(dateParts.rawyear)) || |
| 6104 | new Date( |
| 6105 | dateParts.date.getFullYear(), |
| 6106 | isFinite(dateParts.rawmonth) |
| 6107 | ? dateParts.month |
| 6108 | : dateParts.date.getMonth() + 1, |
| 6109 | 0 |
| 6110 | ).getDate() >= dateParts.day) && |
| 6111 | currentResult |
| 6112 | ); |
| 6113 | } |
| 6114 | function isDateInRange(dateParts, opts) { |
| 6115 | var result = !0; |
| 6116 | if (opts.min) { |
| 6117 | if (dateParts.rawyear) { |
| 6118 | var rawYear = dateParts.rawyear.replace( |
| 6119 | /[^0-9]/g, |
| 6120 | "" |
| 6121 | ), |
| 6122 | minYear = opts.min.year.substr( |
| 6123 | 0, |
| 6124 | rawYear.length |
| 6125 | ); |
| 6126 | result = minYear <= rawYear; |
| 6127 | } |
| 6128 | dateParts.year === dateParts.rawyear && |
| 6129 | opts.min.date.getTime() == |
| 6130 | opts.min.date.getTime() && |
| 6131 | (result = |
| 6132 | opts.min.date.getTime() <= |
| 6133 | dateParts.date.getTime()); |
| 6134 | } |
| 6135 | return ( |
| 6136 | result && |
| 6137 | opts.max && |
| 6138 | opts.max.date.getTime() == |
| 6139 | opts.max.date.getTime() && |
| 6140 | (result = |
| 6141 | opts.max.date.getTime() >= |
| 6142 | dateParts.date.getTime()), |
| 6143 | result |
| 6144 | ); |
| 6145 | } |
| 6146 | function parse(format, dateObjValue, opts, raw) { |
| 6147 | var mask = "", |
| 6148 | match, |
| 6149 | fcode; |
| 6150 | for ( |
| 6151 | getTokenizer(opts).lastIndex = 0; |
| 6152 | (match = getTokenizer(opts).exec(format)); |
| 6153 | |
| 6154 | ) |
| 6155 | if (void 0 === dateObjValue) |
| 6156 | if ((fcode = formatcode(match))) |
| 6157 | mask += "(" + fcode[0] + ")"; |
| 6158 | else |
| 6159 | switch (match[0]) { |
| 6160 | case "[": |
| 6161 | mask += "("; |
| 6162 | break; |
| 6163 | |
| 6164 | case "]": |
| 6165 | mask += ")?"; |
| 6166 | break; |
| 6167 | |
| 6168 | default: |
| 6169 | mask += Inputmask.escapeRegex(match[0]); |
| 6170 | } |
| 6171 | else if ((fcode = formatcode(match))) |
| 6172 | if (!0 !== raw && fcode[3]) { |
| 6173 | var getFn = fcode[3]; |
| 6174 | mask += getFn.call(dateObjValue.date); |
| 6175 | } else |
| 6176 | fcode[2] |
| 6177 | ? (mask += dateObjValue["raw" + fcode[2]]) |
| 6178 | : (mask += match[0]); |
| 6179 | else mask += match[0]; |
| 6180 | return mask; |
| 6181 | } |
| 6182 | function pad(val, len) { |
| 6183 | for (val = String(val), len = len || 2; val.length < len; ) |
| 6184 | val = "0" + val; |
| 6185 | return val; |
| 6186 | } |
| 6187 | function analyseMask(maskString, format, opts) { |
| 6188 | var dateObj = { |
| 6189 | date: new Date(1, 0, 1), |
| 6190 | }, |
| 6191 | targetProp, |
| 6192 | mask = maskString, |
| 6193 | match, |
| 6194 | dateOperation; |
| 6195 | function extendProperty(value) { |
| 6196 | var correctedValue = value.replace(/[^0-9]/g, "0"); |
| 6197 | return correctedValue; |
| 6198 | } |
| 6199 | function setValue(dateObj, value, opts) { |
| 6200 | (dateObj[targetProp] = extendProperty(value)), |
| 6201 | (dateObj["raw" + targetProp] = value), |
| 6202 | void 0 !== dateOperation && |
| 6203 | dateOperation.call( |
| 6204 | dateObj.date, |
| 6205 | "month" == targetProp |
| 6206 | ? parseInt(dateObj[targetProp]) - 1 |
| 6207 | : dateObj[targetProp] |
| 6208 | ); |
| 6209 | } |
| 6210 | if ("string" == typeof mask) { |
| 6211 | for ( |
| 6212 | getTokenizer(opts).lastIndex = 0; |
| 6213 | (match = getTokenizer(opts).exec(format)); |
| 6214 | |
| 6215 | ) { |
| 6216 | var value = mask.slice(0, match[0].length); |
| 6217 | formatCode.hasOwnProperty(match[0]) && |
| 6218 | ((targetProp = formatCode[match[0]][2]), |
| 6219 | (dateOperation = formatCode[match[0]][1]), |
| 6220 | setValue(dateObj, value, opts)), |
| 6221 | (mask = mask.slice(value.length)); |
| 6222 | } |
| 6223 | return dateObj; |
| 6224 | } |
| 6225 | if ( |
| 6226 | mask && |
| 6227 | "object" === _typeof(mask) && |
| 6228 | mask.hasOwnProperty("date") |
| 6229 | ) |
| 6230 | return mask; |
| 6231 | } |
| 6232 | function importDate(dateObj, opts) { |
| 6233 | var match, |
| 6234 | date = ""; |
| 6235 | for ( |
| 6236 | getTokenizer(opts).lastIndex = 0; |
| 6237 | (match = getTokenizer(opts).exec(opts.inputFormat)); |
| 6238 | |
| 6239 | ) |
| 6240 | "d" === match[0].charAt(0) |
| 6241 | ? (date += pad(dateObj.getDate(), match[0].length)) |
| 6242 | : "m" === match[0].charAt(0) |
| 6243 | ? (date += pad( |
| 6244 | dateObj.getMonth() + 1, |
| 6245 | match[0].length |
| 6246 | )) |
| 6247 | : "yyyy" === match[0] |
| 6248 | ? (date += dateObj.getFullYear().toString()) |
| 6249 | : "y" === match[0].charAt(0) && |
| 6250 | (date += pad(dateObj.getYear(), match[0].length)); |
| 6251 | return date; |
| 6252 | } |
| 6253 | function getTokenMatch(pos, opts) { |
| 6254 | var calcPos = 0, |
| 6255 | targetMatch, |
| 6256 | match, |
| 6257 | matchLength = 0; |
| 6258 | for ( |
| 6259 | getTokenizer(opts).lastIndex = 0; |
| 6260 | (match = getTokenizer(opts).exec(opts.inputFormat)); |
| 6261 | |
| 6262 | ) { |
| 6263 | var dynMatches = new RegExp("\\d+$").exec(match[0]); |
| 6264 | if ( |
| 6265 | ((matchLength = dynMatches |
| 6266 | ? parseInt(dynMatches[0]) |
| 6267 | : match[0].length), |
| 6268 | (calcPos += matchLength), |
| 6269 | pos <= calcPos) |
| 6270 | ) { |
| 6271 | (targetMatch = match), |
| 6272 | (match = getTokenizer(opts).exec( |
| 6273 | opts.inputFormat |
| 6274 | )); |
| 6275 | break; |
| 6276 | } |
| 6277 | } |
| 6278 | return { |
| 6279 | targetMatchIndex: calcPos - matchLength, |
| 6280 | nextMatch: match, |
| 6281 | targetMatch: targetMatch, |
| 6282 | }; |
| 6283 | } |
| 6284 | Inputmask.extendAliases({ |
| 6285 | datetime: { |
| 6286 | mask: function mask(opts) { |
| 6287 | return ( |
| 6288 | (opts.numericInput = !1), |
| 6289 | (formatCode.S = |
| 6290 | opts.i18n.ordinalSuffix.join("|")), |
| 6291 | (opts.inputFormat = |
| 6292 | formatAlias[opts.inputFormat] || |
| 6293 | opts.inputFormat), |
| 6294 | (opts.displayFormat = |
| 6295 | formatAlias[opts.displayFormat] || |
| 6296 | opts.displayFormat || |
| 6297 | opts.inputFormat), |
| 6298 | (opts.outputFormat = |
| 6299 | formatAlias[opts.outputFormat] || |
| 6300 | opts.outputFormat || |
| 6301 | opts.inputFormat), |
| 6302 | (opts.placeholder = |
| 6303 | "" !== opts.placeholder |
| 6304 | ? opts.placeholder |
| 6305 | : opts.inputFormat.replace( |
| 6306 | /[[\]]/, |
| 6307 | "" |
| 6308 | )), |
| 6309 | (opts.regex = parse( |
| 6310 | opts.inputFormat, |
| 6311 | void 0, |
| 6312 | opts |
| 6313 | )), |
| 6314 | (opts.min = analyseMask( |
| 6315 | opts.min, |
| 6316 | opts.inputFormat, |
| 6317 | opts |
| 6318 | )), |
| 6319 | (opts.max = analyseMask( |
| 6320 | opts.max, |
| 6321 | opts.inputFormat, |
| 6322 | opts |
| 6323 | )), |
| 6324 | null |
| 6325 | ); |
| 6326 | }, |
| 6327 | placeholder: "", |
| 6328 | inputFormat: "isoDateTime", |
| 6329 | displayFormat: void 0, |
| 6330 | outputFormat: void 0, |
| 6331 | min: null, |
| 6332 | max: null, |
| 6333 | skipOptionalPartCharacter: "", |
| 6334 | i18n: { |
| 6335 | dayNames: [ |
| 6336 | "Mon", |
| 6337 | "Tue", |
| 6338 | "Wed", |
| 6339 | "Thu", |
| 6340 | "Fri", |
| 6341 | "Sat", |
| 6342 | "Sun", |
| 6343 | "Monday", |
| 6344 | "Tuesday", |
| 6345 | "Wednesday", |
| 6346 | "Thursday", |
| 6347 | "Friday", |
| 6348 | "Saturday", |
| 6349 | "Sunday", |
| 6350 | ], |
| 6351 | monthNames: [ |
| 6352 | "Jan", |
| 6353 | "Feb", |
| 6354 | "Mar", |
| 6355 | "Apr", |
| 6356 | "May", |
| 6357 | "Jun", |
| 6358 | "Jul", |
| 6359 | "Aug", |
| 6360 | "Sep", |
| 6361 | "Oct", |
| 6362 | "Nov", |
| 6363 | "Dec", |
| 6364 | "January", |
| 6365 | "February", |
| 6366 | "March", |
| 6367 | "April", |
| 6368 | "May", |
| 6369 | "June", |
| 6370 | "July", |
| 6371 | "August", |
| 6372 | "September", |
| 6373 | "October", |
| 6374 | "November", |
| 6375 | "December", |
| 6376 | ], |
| 6377 | ordinalSuffix: ["st", "nd", "rd", "th"], |
| 6378 | }, |
| 6379 | preValidation: function preValidation( |
| 6380 | buffer, |
| 6381 | pos, |
| 6382 | c, |
| 6383 | isSelection, |
| 6384 | opts, |
| 6385 | maskset, |
| 6386 | caretPos, |
| 6387 | strict |
| 6388 | ) { |
| 6389 | if (strict) return !0; |
| 6390 | if (isNaN(c) && buffer[pos] !== c) { |
| 6391 | var tokenMatch = getTokenMatch(pos, opts); |
| 6392 | if ( |
| 6393 | tokenMatch.nextMatch && |
| 6394 | tokenMatch.nextMatch[0] === c && |
| 6395 | 1 < tokenMatch.targetMatch[0].length |
| 6396 | ) { |
| 6397 | var validator = |
| 6398 | formatCode[ |
| 6399 | tokenMatch.targetMatch[0] |
| 6400 | ][0]; |
| 6401 | if ( |
| 6402 | new RegExp(validator).test( |
| 6403 | "0" + buffer[pos - 1] |
| 6404 | ) |
| 6405 | ) |
| 6406 | return ( |
| 6407 | (buffer[pos] = buffer[pos - 1]), |
| 6408 | (buffer[pos - 1] = "0"), |
| 6409 | { |
| 6410 | fuzzy: !0, |
| 6411 | buffer: buffer, |
| 6412 | refreshFromBuffer: { |
| 6413 | start: pos - 1, |
| 6414 | end: pos + 1, |
| 6415 | }, |
| 6416 | pos: pos + 1, |
| 6417 | } |
| 6418 | ); |
| 6419 | } |
| 6420 | } |
| 6421 | return !0; |
| 6422 | }, |
| 6423 | postValidation: function postValidation( |
| 6424 | buffer, |
| 6425 | pos, |
| 6426 | c, |
| 6427 | currentResult, |
| 6428 | opts, |
| 6429 | maskset, |
| 6430 | strict |
| 6431 | ) { |
| 6432 | if (strict) return !0; |
| 6433 | var tokenMatch, validator; |
| 6434 | if (!1 === currentResult) |
| 6435 | return ( |
| 6436 | (tokenMatch = getTokenMatch(pos + 1, opts)), |
| 6437 | tokenMatch.targetMatch && |
| 6438 | tokenMatch.targetMatchIndex === pos && |
| 6439 | 1 < tokenMatch.targetMatch[0].length && |
| 6440 | void 0 !== |
| 6441 | formatCode[tokenMatch.targetMatch[0]] && |
| 6442 | ((validator = |
| 6443 | formatCode[ |
| 6444 | tokenMatch.targetMatch[0] |
| 6445 | ][0]), |
| 6446 | new RegExp(validator).test("0" + c)) |
| 6447 | ? { |
| 6448 | insert: [ |
| 6449 | { |
| 6450 | pos: pos, |
| 6451 | c: "0", |
| 6452 | }, |
| 6453 | { |
| 6454 | pos: pos + 1, |
| 6455 | c: c, |
| 6456 | }, |
| 6457 | ], |
| 6458 | pos: pos + 1, |
| 6459 | } |
| 6460 | : currentResult |
| 6461 | ); |
| 6462 | if ( |
| 6463 | (currentResult.fuzzy && |
| 6464 | ((buffer = currentResult.buffer), |
| 6465 | (pos = currentResult.pos)), |
| 6466 | (tokenMatch = getTokenMatch(pos, opts)), |
| 6467 | tokenMatch.targetMatch && |
| 6468 | tokenMatch.targetMatch[0] && |
| 6469 | void 0 !== |
| 6470 | formatCode[tokenMatch.targetMatch[0]]) |
| 6471 | ) { |
| 6472 | validator = |
| 6473 | formatCode[tokenMatch.targetMatch[0]][0]; |
| 6474 | var part = buffer.slice( |
| 6475 | tokenMatch.targetMatchIndex, |
| 6476 | tokenMatch.targetMatchIndex + |
| 6477 | tokenMatch.targetMatch[0].length |
| 6478 | ); |
| 6479 | !1 === |
| 6480 | new RegExp(validator).test(part.join("")) && |
| 6481 | 2 === tokenMatch.targetMatch[0].length && |
| 6482 | maskset.validPositions[ |
| 6483 | tokenMatch.targetMatchIndex |
| 6484 | ] && |
| 6485 | maskset.validPositions[ |
| 6486 | tokenMatch.targetMatchIndex + 1 |
| 6487 | ] && |
| 6488 | (maskset.validPositions[ |
| 6489 | tokenMatch.targetMatchIndex + 1 |
| 6490 | ].input = "0"); |
| 6491 | } |
| 6492 | var result = currentResult, |
| 6493 | dateParts = analyseMask( |
| 6494 | buffer.join(""), |
| 6495 | opts.inputFormat, |
| 6496 | opts |
| 6497 | ); |
| 6498 | return ( |
| 6499 | result && |
| 6500 | dateParts.date.getTime() == |
| 6501 | dateParts.date.getTime() && |
| 6502 | ((result = isValidDate(dateParts, result)), |
| 6503 | (result = |
| 6504 | result && |
| 6505 | isDateInRange(dateParts, opts))), |
| 6506 | pos && result && currentResult.pos !== pos |
| 6507 | ? { |
| 6508 | buffer: parse( |
| 6509 | opts.inputFormat, |
| 6510 | dateParts, |
| 6511 | opts |
| 6512 | ).split(""), |
| 6513 | refreshFromBuffer: { |
| 6514 | start: pos, |
| 6515 | end: currentResult.pos, |
| 6516 | }, |
| 6517 | } |
| 6518 | : result |
| 6519 | ); |
| 6520 | }, |
| 6521 | onKeyDown: function onKeyDown( |
| 6522 | e, |
| 6523 | buffer, |
| 6524 | caretPos, |
| 6525 | opts |
| 6526 | ) { |
| 6527 | var input = this; |
| 6528 | e.ctrlKey && |
| 6529 | e.keyCode === keyCode.RIGHT && |
| 6530 | (this.inputmask._valueSet( |
| 6531 | importDate(new Date(), opts) |
| 6532 | ), |
| 6533 | $(this).trigger("setvalue")); |
| 6534 | }, |
| 6535 | onUnMask: function onUnMask( |
| 6536 | maskedValue, |
| 6537 | unmaskedValue, |
| 6538 | opts |
| 6539 | ) { |
| 6540 | return unmaskedValue |
| 6541 | ? parse( |
| 6542 | opts.outputFormat, |
| 6543 | analyseMask( |
| 6544 | maskedValue, |
| 6545 | opts.inputFormat, |
| 6546 | opts |
| 6547 | ), |
| 6548 | opts, |
| 6549 | !0 |
| 6550 | ) |
| 6551 | : unmaskedValue; |
| 6552 | }, |
| 6553 | casing: function casing( |
| 6554 | elem, |
| 6555 | test, |
| 6556 | pos, |
| 6557 | validPositions |
| 6558 | ) { |
| 6559 | return 0 == test.nativeDef.indexOf("[ap]") |
| 6560 | ? elem.toLowerCase() |
| 6561 | : 0 == test.nativeDef.indexOf("[AP]") |
| 6562 | ? elem.toUpperCase() |
| 6563 | : elem; |
| 6564 | }, |
| 6565 | onBeforeMask: function onBeforeMask( |
| 6566 | initialValue, |
| 6567 | opts |
| 6568 | ) { |
| 6569 | return ( |
| 6570 | "[object Date]" === |
| 6571 | Object.prototype.toString.call( |
| 6572 | initialValue |
| 6573 | ) && |
| 6574 | (initialValue = importDate( |
| 6575 | initialValue, |
| 6576 | opts |
| 6577 | )), |
| 6578 | initialValue |
| 6579 | ); |
| 6580 | }, |
| 6581 | insertMode: !1, |
| 6582 | shiftPositions: !1, |
| 6583 | keepStatic: !1, |
| 6584 | inputmode: "numeric", |
| 6585 | }, |
| 6586 | }), |
| 6587 | (module.exports = Inputmask); |
| 6588 | }, |
| 6589 | function (module, exports, __webpack_require__) { |
| 6590 | "use strict"; |
| 6591 | var Inputmask = __webpack_require__(1), |
| 6592 | $ = Inputmask.dependencyLib, |
| 6593 | keyCode = __webpack_require__(0); |
| 6594 | function autoEscape(txt, opts) { |
| 6595 | for (var escapedTxt = "", i = 0; i < txt.length; i++) |
| 6596 | Inputmask.prototype.definitions[txt.charAt(i)] || |
| 6597 | opts.definitions[txt.charAt(i)] || |
| 6598 | opts.optionalmarker[0] === txt.charAt(i) || |
| 6599 | opts.optionalmarker[1] === txt.charAt(i) || |
| 6600 | opts.quantifiermarker[0] === txt.charAt(i) || |
| 6601 | opts.quantifiermarker[1] === txt.charAt(i) || |
| 6602 | opts.groupmarker[0] === txt.charAt(i) || |
| 6603 | opts.groupmarker[1] === txt.charAt(i) || |
| 6604 | opts.alternatormarker === txt.charAt(i) |
| 6605 | ? (escapedTxt += "\\" + txt.charAt(i)) |
| 6606 | : (escapedTxt += txt.charAt(i)); |
| 6607 | return escapedTxt; |
| 6608 | } |
| 6609 | function alignDigits(buffer, digits, opts, force) { |
| 6610 | if ( |
| 6611 | 0 < buffer.length && |
| 6612 | 0 < digits && |
| 6613 | (!opts.digitsOptional || force) |
| 6614 | ) { |
| 6615 | var radixPosition = $.inArray(opts.radixPoint, buffer); |
| 6616 | -1 === radixPosition && |
| 6617 | (buffer.push(opts.radixPoint), |
| 6618 | (radixPosition = buffer.length - 1)); |
| 6619 | for (var i = 1; i <= digits; i++) |
| 6620 | isFinite(buffer[radixPosition + i]) || |
| 6621 | (buffer[radixPosition + i] = "0"); |
| 6622 | } |
| 6623 | return buffer; |
| 6624 | } |
| 6625 | function findValidator(symbol, maskset) { |
| 6626 | var posNdx = 0; |
| 6627 | if ("+" === symbol) { |
| 6628 | for (posNdx in maskset.validPositions); |
| 6629 | posNdx = parseInt(posNdx); |
| 6630 | } |
| 6631 | for (var tstNdx in maskset.tests) |
| 6632 | if (((tstNdx = parseInt(tstNdx)), posNdx <= tstNdx)) |
| 6633 | for ( |
| 6634 | var ndx = 0, |
| 6635 | ndxl = maskset.tests[tstNdx].length; |
| 6636 | ndx < ndxl; |
| 6637 | ndx++ |
| 6638 | ) |
| 6639 | if ( |
| 6640 | (void 0 === |
| 6641 | maskset.validPositions[tstNdx] || |
| 6642 | "-" === symbol) && |
| 6643 | maskset.tests[tstNdx][ndx].match.def === |
| 6644 | symbol |
| 6645 | ) |
| 6646 | return ( |
| 6647 | tstNdx + |
| 6648 | (void 0 !== |
| 6649 | maskset.validPositions[tstNdx] && |
| 6650 | "-" !== symbol |
| 6651 | ? 1 |
| 6652 | : 0) |
| 6653 | ); |
| 6654 | return posNdx; |
| 6655 | } |
| 6656 | function findValid(symbol, maskset) { |
| 6657 | var ret = -1; |
| 6658 | return ( |
| 6659 | $.each(maskset.validPositions, function (ndx, tst) { |
| 6660 | if (tst && tst.match.def === symbol) |
| 6661 | return (ret = parseInt(ndx)), !1; |
| 6662 | }), |
| 6663 | ret |
| 6664 | ); |
| 6665 | } |
| 6666 | function parseMinMaxOptions(opts) { |
| 6667 | void 0 === opts.parseMinMaxOptions && |
| 6668 | (null !== opts.min && |
| 6669 | ((opts.min = opts.min |
| 6670 | .toString() |
| 6671 | .replace( |
| 6672 | new RegExp( |
| 6673 | Inputmask.escapeRegex( |
| 6674 | opts.groupSeparator |
| 6675 | ), |
| 6676 | "g" |
| 6677 | ), |
| 6678 | "" |
| 6679 | )), |
| 6680 | "," === opts.radixPoint && |
| 6681 | (opts.min = opts.min.replace( |
| 6682 | opts.radixPoint, |
| 6683 | "." |
| 6684 | )), |
| 6685 | (opts.min = isFinite(opts.min) |
| 6686 | ? parseFloat(opts.min) |
| 6687 | : NaN), |
| 6688 | isNaN(opts.min) && (opts.min = Number.MIN_VALUE)), |
| 6689 | null !== opts.max && |
| 6690 | ((opts.max = opts.max |
| 6691 | .toString() |
| 6692 | .replace( |
| 6693 | new RegExp( |
| 6694 | Inputmask.escapeRegex( |
| 6695 | opts.groupSeparator |
| 6696 | ), |
| 6697 | "g" |
| 6698 | ), |
| 6699 | "" |
| 6700 | )), |
| 6701 | "," === opts.radixPoint && |
| 6702 | (opts.max = opts.max.replace( |
| 6703 | opts.radixPoint, |
| 6704 | "." |
| 6705 | )), |
| 6706 | (opts.max = isFinite(opts.max) |
| 6707 | ? parseFloat(opts.max) |
| 6708 | : NaN), |
| 6709 | isNaN(opts.max) && (opts.max = Number.MAX_VALUE)), |
| 6710 | (opts.parseMinMaxOptions = "done")); |
| 6711 | } |
| 6712 | function genMask(opts) { |
| 6713 | (opts.repeat = 0), |
| 6714 | opts.groupSeparator === opts.radixPoint && |
| 6715 | opts.digits && |
| 6716 | "0" !== opts.digits && |
| 6717 | ("." === opts.radixPoint |
| 6718 | ? (opts.groupSeparator = ",") |
| 6719 | : "," === opts.radixPoint |
| 6720 | ? (opts.groupSeparator = ".") |
| 6721 | : (opts.groupSeparator = "")), |
| 6722 | " " === opts.groupSeparator && |
| 6723 | (opts.skipOptionalPartCharacter = void 0), |
| 6724 | 1 < opts.placeholder.length && |
| 6725 | (opts.placeholder = opts.placeholder.charAt(0)), |
| 6726 | "radixFocus" === opts.positionCaretOnClick && |
| 6727 | "" === opts.placeholder && |
| 6728 | (opts.positionCaretOnClick = "lvp"); |
| 6729 | var decimalDef = "0", |
| 6730 | radixPointDef = opts.radixPoint; |
| 6731 | !0 === opts.numericInput && void 0 === opts.__financeInput |
| 6732 | ? ((decimalDef = "1"), |
| 6733 | (opts.positionCaretOnClick = |
| 6734 | "radixFocus" === opts.positionCaretOnClick |
| 6735 | ? "lvp" |
| 6736 | : opts.positionCaretOnClick), |
| 6737 | (opts.digitsOptional = !1), |
| 6738 | isNaN(opts.digits) && (opts.digits = 2), |
| 6739 | (opts._radixDance = !1), |
| 6740 | (radixPointDef = "," === opts.radixPoint ? "?" : "!"), |
| 6741 | "" !== opts.radixPoint && |
| 6742 | void 0 === opts.definitions[radixPointDef] && |
| 6743 | ((opts.definitions[radixPointDef] = {}), |
| 6744 | (opts.definitions[radixPointDef].validator = |
| 6745 | "[" + opts.radixPoint + "]"), |
| 6746 | (opts.definitions[radixPointDef].placeholder = |
| 6747 | opts.radixPoint), |
| 6748 | (opts.definitions[radixPointDef].static = !0), |
| 6749 | (opts.definitions[radixPointDef].generated = |
| 6750 | !0))) |
| 6751 | : ((opts.__financeInput = !1), |
| 6752 | (opts.numericInput = !0)); |
| 6753 | var mask = "[+]", |
| 6754 | altMask; |
| 6755 | if ( |
| 6756 | ((mask += autoEscape(opts.prefix, opts)), |
| 6757 | "" !== opts.groupSeparator |
| 6758 | ? (void 0 === |
| 6759 | opts.definitions[opts.groupSeparator] && |
| 6760 | ((opts.definitions[opts.groupSeparator] = |
| 6761 | {}), |
| 6762 | (opts.definitions[ |
| 6763 | opts.groupSeparator |
| 6764 | ].validator = |
| 6765 | "[" + opts.groupSeparator + "]"), |
| 6766 | (opts.definitions[ |
| 6767 | opts.groupSeparator |
| 6768 | ].placeholder = opts.groupSeparator), |
| 6769 | (opts.definitions[ |
| 6770 | opts.groupSeparator |
| 6771 | ].static = !0), |
| 6772 | (opts.definitions[ |
| 6773 | opts.groupSeparator |
| 6774 | ].generated = !0)), |
| 6775 | (mask += opts._mask(opts))) |
| 6776 | : (mask += "9{+}"), |
| 6777 | void 0 !== opts.digits && 0 !== opts.digits) |
| 6778 | ) { |
| 6779 | var dq = opts.digits.toString().split(","); |
| 6780 | isFinite(dq[0]) && dq[1] && isFinite(dq[1]) |
| 6781 | ? (mask += |
| 6782 | radixPointDef + |
| 6783 | decimalDef + |
| 6784 | "{" + |
| 6785 | opts.digits + |
| 6786 | "}") |
| 6787 | : (isNaN(opts.digits) || |
| 6788 | 0 < parseInt(opts.digits)) && |
| 6789 | (opts.digitsOptional |
| 6790 | ? ((altMask = |
| 6791 | mask + |
| 6792 | radixPointDef + |
| 6793 | decimalDef + |
| 6794 | "{0," + |
| 6795 | opts.digits + |
| 6796 | "}"), |
| 6797 | (opts.keepStatic = !0)) |
| 6798 | : (mask += |
| 6799 | radixPointDef + |
| 6800 | decimalDef + |
| 6801 | "{" + |
| 6802 | opts.digits + |
| 6803 | "}")); |
| 6804 | } |
| 6805 | return ( |
| 6806 | (mask += autoEscape(opts.suffix, opts)), |
| 6807 | (mask += "[-]"), |
| 6808 | altMask && |
| 6809 | (mask = [ |
| 6810 | altMask + autoEscape(opts.suffix, opts) + "[-]", |
| 6811 | mask, |
| 6812 | ]), |
| 6813 | (opts.greedy = !1), |
| 6814 | parseMinMaxOptions(opts), |
| 6815 | mask |
| 6816 | ); |
| 6817 | } |
| 6818 | function hanndleRadixDance(pos, c, radixPos, maskset, opts) { |
| 6819 | return ( |
| 6820 | opts._radixDance && |
| 6821 | opts.numericInput && |
| 6822 | c !== opts.negationSymbol.back && |
| 6823 | pos <= radixPos && |
| 6824 | (0 < radixPos || c == opts.radixPoint) && |
| 6825 | (void 0 === maskset.validPositions[pos - 1] || |
| 6826 | maskset.validPositions[pos - 1].input !== |
| 6827 | opts.negationSymbol.back) && |
| 6828 | (pos -= 1), |
| 6829 | pos |
| 6830 | ); |
| 6831 | } |
| 6832 | function decimalValidator(chrs, maskset, pos, strict, opts) { |
| 6833 | var radixPos = maskset.buffer |
| 6834 | ? maskset.buffer.indexOf(opts.radixPoint) |
| 6835 | : -1, |
| 6836 | result = |
| 6837 | -1 !== radixPos && |
| 6838 | new RegExp("[0-9\uff11-\uff19]").test(chrs); |
| 6839 | return opts._radixDance && |
| 6840 | result && |
| 6841 | null == maskset.validPositions[radixPos] |
| 6842 | ? { |
| 6843 | insert: { |
| 6844 | pos: |
| 6845 | radixPos === pos |
| 6846 | ? radixPos + 1 |
| 6847 | : radixPos, |
| 6848 | c: opts.radixPoint, |
| 6849 | }, |
| 6850 | pos: pos, |
| 6851 | } |
| 6852 | : result; |
| 6853 | } |
| 6854 | function checkForLeadingZeroes(buffer, opts) { |
| 6855 | var numberMatches = new RegExp( |
| 6856 | "(^" + |
| 6857 | ("" !== opts.negationSymbol.front |
| 6858 | ? Inputmask.escapeRegex( |
| 6859 | opts.negationSymbol.front |
| 6860 | ) + "?" |
| 6861 | : "") + |
| 6862 | Inputmask.escapeRegex(opts.prefix) + |
| 6863 | ")(.*)(" + |
| 6864 | Inputmask.escapeRegex(opts.suffix) + |
| 6865 | ("" != opts.negationSymbol.back |
| 6866 | ? Inputmask.escapeRegex( |
| 6867 | opts.negationSymbol.back |
| 6868 | ) + "?" |
| 6869 | : "") + |
| 6870 | "$)" |
| 6871 | ).exec(buffer.slice().reverse().join("")), |
| 6872 | number = numberMatches ? numberMatches[2] : "", |
| 6873 | leadingzeroes = !1; |
| 6874 | return ( |
| 6875 | number && |
| 6876 | ((number = number.split( |
| 6877 | opts.radixPoint.charAt(0) |
| 6878 | )[0]), |
| 6879 | (leadingzeroes = new RegExp( |
| 6880 | "^[0" + opts.groupSeparator + "]*" |
| 6881 | ).exec(number))), |
| 6882 | !( |
| 6883 | !leadingzeroes || |
| 6884 | !( |
| 6885 | 1 < leadingzeroes[0].length || |
| 6886 | (0 < leadingzeroes[0].length && |
| 6887 | leadingzeroes[0].length < number.length) |
| 6888 | ) |
| 6889 | ) && leadingzeroes |
| 6890 | ); |
| 6891 | } |
| 6892 | Inputmask.extendAliases({ |
| 6893 | numeric: { |
| 6894 | mask: genMask, |
| 6895 | _mask: function _mask(opts) { |
| 6896 | return "(" + opts.groupSeparator + "999){+|1}"; |
| 6897 | }, |
| 6898 | digits: "*", |
| 6899 | digitsOptional: !0, |
| 6900 | enforceDigitsOnBlur: !1, |
| 6901 | radixPoint: ".", |
| 6902 | positionCaretOnClick: "radixFocus", |
| 6903 | _radixDance: !0, |
| 6904 | groupSeparator: "", |
| 6905 | allowMinus: !0, |
| 6906 | negationSymbol: { |
| 6907 | front: "-", |
| 6908 | back: "", |
| 6909 | }, |
| 6910 | prefix: "", |
| 6911 | suffix: "", |
| 6912 | min: null, |
| 6913 | max: null, |
| 6914 | step: 1, |
| 6915 | unmaskAsNumber: !1, |
| 6916 | roundingFN: Math.round, |
| 6917 | inputmode: "numeric", |
| 6918 | shortcuts: { |
| 6919 | k: "000", |
| 6920 | m: "000000", |
| 6921 | }, |
| 6922 | placeholder: "0", |
| 6923 | greedy: !1, |
| 6924 | rightAlign: !0, |
| 6925 | insertMode: !0, |
| 6926 | autoUnmask: !1, |
| 6927 | skipOptionalPartCharacter: "", |
| 6928 | definitions: { |
| 6929 | 0: { |
| 6930 | validator: decimalValidator, |
| 6931 | }, |
| 6932 | 1: { |
| 6933 | validator: decimalValidator, |
| 6934 | definitionSymbol: "9", |
| 6935 | }, |
| 6936 | "+": { |
| 6937 | validator: function validator( |
| 6938 | chrs, |
| 6939 | maskset, |
| 6940 | pos, |
| 6941 | strict, |
| 6942 | opts |
| 6943 | ) { |
| 6944 | return ( |
| 6945 | opts.allowMinus && |
| 6946 | ("-" === chrs || |
| 6947 | chrs === opts.negationSymbol.front) |
| 6948 | ); |
| 6949 | }, |
| 6950 | }, |
| 6951 | "-": { |
| 6952 | validator: function validator( |
| 6953 | chrs, |
| 6954 | maskset, |
| 6955 | pos, |
| 6956 | strict, |
| 6957 | opts |
| 6958 | ) { |
| 6959 | return ( |
| 6960 | opts.allowMinus && |
| 6961 | chrs === opts.negationSymbol.back |
| 6962 | ); |
| 6963 | }, |
| 6964 | }, |
| 6965 | }, |
| 6966 | preValidation: function preValidation( |
| 6967 | buffer, |
| 6968 | pos, |
| 6969 | c, |
| 6970 | isSelection, |
| 6971 | opts, |
| 6972 | maskset, |
| 6973 | caretPos, |
| 6974 | strict |
| 6975 | ) { |
| 6976 | if ( |
| 6977 | !1 !== opts.__financeInput && |
| 6978 | c === opts.radixPoint |
| 6979 | ) |
| 6980 | return !1; |
| 6981 | var pattern; |
| 6982 | if ( |
| 6983 | (pattern = opts.shortcuts && opts.shortcuts[c]) |
| 6984 | ) { |
| 6985 | if (1 < pattern.length) |
| 6986 | for ( |
| 6987 | var inserts = [], i = 0; |
| 6988 | i < pattern.length; |
| 6989 | i++ |
| 6990 | ) |
| 6991 | inserts.push({ |
| 6992 | pos: pos + i, |
| 6993 | c: pattern[i], |
| 6994 | strict: !1, |
| 6995 | }); |
| 6996 | return { |
| 6997 | insert: inserts, |
| 6998 | }; |
| 6999 | } |
| 7000 | var radixPos = $.inArray(opts.radixPoint, buffer), |
| 7001 | initPos = pos; |
| 7002 | if ( |
| 7003 | ((pos = hanndleRadixDance( |
| 7004 | pos, |
| 7005 | c, |
| 7006 | radixPos, |
| 7007 | maskset, |
| 7008 | opts |
| 7009 | )), |
| 7010 | "-" === c || c === opts.negationSymbol.front) |
| 7011 | ) { |
| 7012 | if (!0 !== opts.allowMinus) return !1; |
| 7013 | var isNegative = !1, |
| 7014 | front = findValid("+", maskset), |
| 7015 | back = findValid("-", maskset); |
| 7016 | return ( |
| 7017 | -1 !== front && |
| 7018 | (isNegative = [front, back]), |
| 7019 | !1 !== isNegative |
| 7020 | ? { |
| 7021 | remove: isNegative, |
| 7022 | caret: initPos, |
| 7023 | } |
| 7024 | : { |
| 7025 | insert: [ |
| 7026 | { |
| 7027 | pos: findValidator( |
| 7028 | "+", |
| 7029 | maskset |
| 7030 | ), |
| 7031 | c: opts.negationSymbol |
| 7032 | .front, |
| 7033 | fromIsValid: !0, |
| 7034 | }, |
| 7035 | { |
| 7036 | pos: findValidator( |
| 7037 | "-", |
| 7038 | maskset |
| 7039 | ), |
| 7040 | c: opts.negationSymbol |
| 7041 | .back, |
| 7042 | fromIsValid: void 0, |
| 7043 | }, |
| 7044 | ], |
| 7045 | caret: |
| 7046 | initPos + |
| 7047 | opts.negationSymbol.back |
| 7048 | .length, |
| 7049 | } |
| 7050 | ); |
| 7051 | } |
| 7052 | if (strict) return !0; |
| 7053 | if ( |
| 7054 | -1 !== radixPos && |
| 7055 | !0 === opts._radixDance && |
| 7056 | !1 === isSelection && |
| 7057 | c === opts.radixPoint && |
| 7058 | void 0 !== opts.digits && |
| 7059 | (isNaN(opts.digits) || |
| 7060 | 0 < parseInt(opts.digits)) && |
| 7061 | radixPos !== pos |
| 7062 | ) |
| 7063 | return { |
| 7064 | caret: |
| 7065 | opts._radixDance && pos === radixPos - 1 |
| 7066 | ? radixPos + 1 |
| 7067 | : radixPos, |
| 7068 | }; |
| 7069 | if (!1 === opts.__financeInput) |
| 7070 | if (isSelection) { |
| 7071 | if (opts.digitsOptional) |
| 7072 | return { |
| 7073 | rewritePosition: caretPos.end, |
| 7074 | }; |
| 7075 | if (!opts.digitsOptional) { |
| 7076 | if ( |
| 7077 | caretPos.begin > radixPos && |
| 7078 | caretPos.end <= radixPos |
| 7079 | ) |
| 7080 | return c === opts.radixPoint |
| 7081 | ? { |
| 7082 | insert: { |
| 7083 | pos: radixPos + 1, |
| 7084 | c: "0", |
| 7085 | fromIsValid: !0, |
| 7086 | }, |
| 7087 | rewritePosition: |
| 7088 | radixPos, |
| 7089 | } |
| 7090 | : { |
| 7091 | rewritePosition: |
| 7092 | radixPos + 1, |
| 7093 | }; |
| 7094 | if (caretPos.begin < radixPos) |
| 7095 | return { |
| 7096 | rewritePosition: |
| 7097 | caretPos.begin - 1, |
| 7098 | }; |
| 7099 | } |
| 7100 | } else if ( |
| 7101 | !opts.showMaskOnHover && |
| 7102 | !opts.showMaskOnFocus && |
| 7103 | !opts.digitsOptional && |
| 7104 | 0 < opts.digits && |
| 7105 | "" === this.inputmask.__valueGet.call(this) |
| 7106 | ) |
| 7107 | return { |
| 7108 | rewritePosition: radixPos, |
| 7109 | }; |
| 7110 | return { |
| 7111 | rewritePosition: pos, |
| 7112 | }; |
| 7113 | }, |
| 7114 | postValidation: function postValidation( |
| 7115 | buffer, |
| 7116 | pos, |
| 7117 | c, |
| 7118 | currentResult, |
| 7119 | opts, |
| 7120 | maskset, |
| 7121 | strict |
| 7122 | ) { |
| 7123 | if (!1 === currentResult) return currentResult; |
| 7124 | if (strict) return !0; |
| 7125 | if (null !== opts.min || null !== opts.max) { |
| 7126 | var unmasked = opts.onUnMask( |
| 7127 | buffer.slice().reverse().join(""), |
| 7128 | void 0, |
| 7129 | $.extend({}, opts, { |
| 7130 | unmaskAsNumber: !0, |
| 7131 | }) |
| 7132 | ); |
| 7133 | if ( |
| 7134 | null !== opts.min && |
| 7135 | unmasked < opts.min && |
| 7136 | (unmasked.toString().length >= |
| 7137 | opts.min.toString().length || |
| 7138 | unmasked < 0) |
| 7139 | ) |
| 7140 | return !1; |
| 7141 | if (null !== opts.max && unmasked > opts.max) |
| 7142 | return !1; |
| 7143 | } |
| 7144 | return currentResult; |
| 7145 | }, |
| 7146 | onUnMask: function onUnMask( |
| 7147 | maskedValue, |
| 7148 | unmaskedValue, |
| 7149 | opts |
| 7150 | ) { |
| 7151 | if ("" === unmaskedValue && !0 === opts.nullable) |
| 7152 | return unmaskedValue; |
| 7153 | var processValue = maskedValue.replace( |
| 7154 | opts.prefix, |
| 7155 | "" |
| 7156 | ); |
| 7157 | return ( |
| 7158 | (processValue = processValue.replace( |
| 7159 | opts.suffix, |
| 7160 | "" |
| 7161 | )), |
| 7162 | (processValue = processValue.replace( |
| 7163 | new RegExp( |
| 7164 | Inputmask.escapeRegex( |
| 7165 | opts.groupSeparator |
| 7166 | ), |
| 7167 | "g" |
| 7168 | ), |
| 7169 | "" |
| 7170 | )), |
| 7171 | "" !== opts.placeholder.charAt(0) && |
| 7172 | (processValue = processValue.replace( |
| 7173 | new RegExp( |
| 7174 | opts.placeholder.charAt(0), |
| 7175 | "g" |
| 7176 | ), |
| 7177 | "0" |
| 7178 | )), |
| 7179 | opts.unmaskAsNumber |
| 7180 | ? ("" !== opts.radixPoint && |
| 7181 | -1 !== |
| 7182 | processValue.indexOf( |
| 7183 | opts.radixPoint |
| 7184 | ) && |
| 7185 | (processValue = |
| 7186 | processValue.replace( |
| 7187 | Inputmask.escapeRegex.call( |
| 7188 | this, |
| 7189 | opts.radixPoint |
| 7190 | ), |
| 7191 | "." |
| 7192 | )), |
| 7193 | (processValue = processValue.replace( |
| 7194 | new RegExp( |
| 7195 | "^" + |
| 7196 | Inputmask.escapeRegex( |
| 7197 | opts.negationSymbol |
| 7198 | .front |
| 7199 | ) |
| 7200 | ), |
| 7201 | "-" |
| 7202 | )), |
| 7203 | (processValue = processValue.replace( |
| 7204 | new RegExp( |
| 7205 | Inputmask.escapeRegex( |
| 7206 | opts.negationSymbol.back |
| 7207 | ) + "$" |
| 7208 | ), |
| 7209 | "" |
| 7210 | )), |
| 7211 | Number(processValue)) |
| 7212 | : processValue |
| 7213 | ); |
| 7214 | }, |
| 7215 | isComplete: function isComplete(buffer, opts) { |
| 7216 | var maskedValue = ( |
| 7217 | opts.numericInput |
| 7218 | ? buffer.slice().reverse() |
| 7219 | : buffer |
| 7220 | ).join(""); |
| 7221 | return ( |
| 7222 | (maskedValue = maskedValue.replace( |
| 7223 | new RegExp( |
| 7224 | "^" + |
| 7225 | Inputmask.escapeRegex( |
| 7226 | opts.negationSymbol.front |
| 7227 | ) |
| 7228 | ), |
| 7229 | "-" |
| 7230 | )), |
| 7231 | (maskedValue = maskedValue.replace( |
| 7232 | new RegExp( |
| 7233 | Inputmask.escapeRegex( |
| 7234 | opts.negationSymbol.back |
| 7235 | ) + "$" |
| 7236 | ), |
| 7237 | "" |
| 7238 | )), |
| 7239 | (maskedValue = maskedValue.replace( |
| 7240 | opts.prefix, |
| 7241 | "" |
| 7242 | )), |
| 7243 | (maskedValue = maskedValue.replace( |
| 7244 | opts.suffix, |
| 7245 | "" |
| 7246 | )), |
| 7247 | (maskedValue = maskedValue.replace( |
| 7248 | new RegExp( |
| 7249 | Inputmask.escapeRegex( |
| 7250 | opts.groupSeparator |
| 7251 | ) + "([0-9]{3})", |
| 7252 | "g" |
| 7253 | ), |
| 7254 | "$1" |
| 7255 | )), |
| 7256 | "," === opts.radixPoint && |
| 7257 | (maskedValue = maskedValue.replace( |
| 7258 | Inputmask.escapeRegex(opts.radixPoint), |
| 7259 | "." |
| 7260 | )), |
| 7261 | isFinite(maskedValue) |
| 7262 | ); |
| 7263 | }, |
| 7264 | onBeforeMask: function onBeforeMask( |
| 7265 | initialValue, |
| 7266 | opts |
| 7267 | ) { |
| 7268 | var radixPoint = opts.radixPoint || ","; |
| 7269 | isFinite(opts.digits) && |
| 7270 | (opts.digits = parseInt(opts.digits)), |
| 7271 | ("number" != typeof initialValue && |
| 7272 | "number" !== opts.inputType) || |
| 7273 | "" === radixPoint || |
| 7274 | (initialValue = initialValue |
| 7275 | .toString() |
| 7276 | .replace(".", radixPoint)); |
| 7277 | var valueParts = initialValue.split(radixPoint), |
| 7278 | integerPart = valueParts[0].replace( |
| 7279 | /[^\-0-9]/g, |
| 7280 | "" |
| 7281 | ), |
| 7282 | decimalPart = |
| 7283 | 1 < valueParts.length |
| 7284 | ? valueParts[1].replace(/[^0-9]/g, "") |
| 7285 | : "", |
| 7286 | forceDigits = 1 < valueParts.length; |
| 7287 | initialValue = |
| 7288 | integerPart + |
| 7289 | ("" !== decimalPart |
| 7290 | ? radixPoint + decimalPart |
| 7291 | : decimalPart); |
| 7292 | var digits = 0; |
| 7293 | if ( |
| 7294 | "" !== radixPoint && |
| 7295 | ((digits = opts.digitsOptional |
| 7296 | ? opts.digits < decimalPart.length |
| 7297 | ? opts.digits |
| 7298 | : decimalPart.length |
| 7299 | : opts.digits), |
| 7300 | "" !== decimalPart || !opts.digitsOptional) |
| 7301 | ) { |
| 7302 | var digitsFactor = Math.pow(10, digits || 1); |
| 7303 | (initialValue = initialValue.replace( |
| 7304 | Inputmask.escapeRegex(radixPoint), |
| 7305 | "." |
| 7306 | )), |
| 7307 | isNaN(parseFloat(initialValue)) || |
| 7308 | (initialValue = ( |
| 7309 | opts.roundingFN( |
| 7310 | parseFloat(initialValue) * |
| 7311 | digitsFactor |
| 7312 | ) / digitsFactor |
| 7313 | ).toFixed(digits)), |
| 7314 | (initialValue = initialValue |
| 7315 | .toString() |
| 7316 | .replace(".", radixPoint)); |
| 7317 | } |
| 7318 | if ( |
| 7319 | (0 === opts.digits && |
| 7320 | -1 !== initialValue.indexOf(radixPoint) && |
| 7321 | (initialValue = initialValue.substring( |
| 7322 | 0, |
| 7323 | initialValue.indexOf(radixPoint) |
| 7324 | )), |
| 7325 | null !== opts.min || null !== opts.max) |
| 7326 | ) { |
| 7327 | var numberValue = initialValue |
| 7328 | .toString() |
| 7329 | .replace(radixPoint, "."); |
| 7330 | null !== opts.min && numberValue < opts.min |
| 7331 | ? (initialValue = opts.min |
| 7332 | .toString() |
| 7333 | .replace(".", radixPoint)) |
| 7334 | : null !== opts.max && |
| 7335 | numberValue > opts.max && |
| 7336 | (initialValue = opts.max |
| 7337 | .toString() |
| 7338 | .replace(".", radixPoint)); |
| 7339 | } |
| 7340 | return alignDigits( |
| 7341 | initialValue.toString().split(""), |
| 7342 | digits, |
| 7343 | opts, |
| 7344 | forceDigits |
| 7345 | ).join(""); |
| 7346 | }, |
| 7347 | onBeforeWrite: function onBeforeWrite( |
| 7348 | e, |
| 7349 | buffer, |
| 7350 | caretPos, |
| 7351 | opts |
| 7352 | ) { |
| 7353 | function stripBuffer(buffer, stripRadix) { |
| 7354 | if (!1 !== opts.__financeInput || stripRadix) { |
| 7355 | var position = $.inArray( |
| 7356 | opts.radixPoint, |
| 7357 | buffer |
| 7358 | ); |
| 7359 | -1 !== position && |
| 7360 | buffer.splice(position, 1); |
| 7361 | } |
| 7362 | if ("" !== opts.groupSeparator) |
| 7363 | for ( |
| 7364 | ; |
| 7365 | -1 !== |
| 7366 | (position = buffer.indexOf( |
| 7367 | opts.groupSeparator |
| 7368 | )); |
| 7369 | |
| 7370 | ) |
| 7371 | buffer.splice(position, 1); |
| 7372 | return buffer; |
| 7373 | } |
| 7374 | var result, |
| 7375 | leadingzeroes = checkForLeadingZeroes( |
| 7376 | buffer, |
| 7377 | opts |
| 7378 | ); |
| 7379 | if (leadingzeroes) { |
| 7380 | var buf = buffer.slice().reverse(), |
| 7381 | caretNdx = buf |
| 7382 | .join("") |
| 7383 | .indexOf(leadingzeroes[0]); |
| 7384 | buf.splice(caretNdx, leadingzeroes[0].length); |
| 7385 | var newCaretPos = buf.length - caretNdx; |
| 7386 | stripBuffer(buf), |
| 7387 | (result = { |
| 7388 | refreshFromBuffer: !0, |
| 7389 | buffer: buf.reverse(), |
| 7390 | caret: |
| 7391 | caretPos < newCaretPos |
| 7392 | ? caretPos |
| 7393 | : newCaretPos, |
| 7394 | }); |
| 7395 | } |
| 7396 | if (e) |
| 7397 | switch (e.type) { |
| 7398 | case "blur": |
| 7399 | case "checkval": |
| 7400 | if (null !== opts.min) { |
| 7401 | var unmasked = opts.onUnMask( |
| 7402 | buffer |
| 7403 | .slice() |
| 7404 | .reverse() |
| 7405 | .join(""), |
| 7406 | void 0, |
| 7407 | $.extend({}, opts, { |
| 7408 | unmaskAsNumber: !0, |
| 7409 | }) |
| 7410 | ); |
| 7411 | if ( |
| 7412 | null !== opts.min && |
| 7413 | unmasked < opts.min |
| 7414 | ) |
| 7415 | return { |
| 7416 | refreshFromBuffer: !0, |
| 7417 | buffer: alignDigits( |
| 7418 | opts.min |
| 7419 | .toString() |
| 7420 | .replace( |
| 7421 | ".", |
| 7422 | opts.radixPoint |
| 7423 | ) |
| 7424 | .split(""), |
| 7425 | opts.digits, |
| 7426 | opts |
| 7427 | ).reverse(), |
| 7428 | }; |
| 7429 | } |
| 7430 | if ( |
| 7431 | buffer[buffer.length - 1] === |
| 7432 | opts.negationSymbol.front |
| 7433 | ) { |
| 7434 | var nmbrMtchs = new RegExp( |
| 7435 | "(^" + |
| 7436 | ("" != |
| 7437 | opts.negationSymbol |
| 7438 | .front |
| 7439 | ? Inputmask.escapeRegex( |
| 7440 | opts |
| 7441 | .negationSymbol |
| 7442 | .front |
| 7443 | ) + "?" |
| 7444 | : "") + |
| 7445 | Inputmask.escapeRegex( |
| 7446 | opts.prefix |
| 7447 | ) + |
| 7448 | ")(.*)(" + |
| 7449 | Inputmask.escapeRegex( |
| 7450 | opts.suffix |
| 7451 | ) + |
| 7452 | ("" != |
| 7453 | opts.negationSymbol.back |
| 7454 | ? Inputmask.escapeRegex( |
| 7455 | opts |
| 7456 | .negationSymbol |
| 7457 | .back |
| 7458 | ) + "?" |
| 7459 | : "") + |
| 7460 | "$)" |
| 7461 | ).exec( |
| 7462 | stripBuffer( |
| 7463 | buffer.slice(), |
| 7464 | !0 |
| 7465 | ) |
| 7466 | .reverse() |
| 7467 | .join("") |
| 7468 | ), |
| 7469 | number = nmbrMtchs |
| 7470 | ? nmbrMtchs[2] |
| 7471 | : ""; |
| 7472 | 0 == number && |
| 7473 | (result = { |
| 7474 | refreshFromBuffer: !0, |
| 7475 | buffer: [0], |
| 7476 | }); |
| 7477 | } else |
| 7478 | "" !== opts.radixPoint && |
| 7479 | buffer[0] === opts.radixPoint && |
| 7480 | (result && result.buffer |
| 7481 | ? result.buffer.shift() |
| 7482 | : (buffer.shift(), |
| 7483 | (result = { |
| 7484 | refreshFromBuffer: |
| 7485 | !0, |
| 7486 | buffer: stripBuffer( |
| 7487 | buffer |
| 7488 | ), |
| 7489 | }))); |
| 7490 | if (opts.enforceDigitsOnBlur) { |
| 7491 | result = result || {}; |
| 7492 | var bffr = |
| 7493 | (result && result.buffer) || |
| 7494 | buffer.slice().reverse(); |
| 7495 | (result.refreshFromBuffer = !0), |
| 7496 | (result.buffer = alignDigits( |
| 7497 | bffr, |
| 7498 | opts.digits, |
| 7499 | opts, |
| 7500 | !0 |
| 7501 | ).reverse()); |
| 7502 | } |
| 7503 | } |
| 7504 | return result; |
| 7505 | }, |
| 7506 | onKeyDown: function onKeyDown( |
| 7507 | e, |
| 7508 | buffer, |
| 7509 | caretPos, |
| 7510 | opts |
| 7511 | ) { |
| 7512 | var $input = $(this), |
| 7513 | bffr; |
| 7514 | if (e.ctrlKey) |
| 7515 | switch (e.keyCode) { |
| 7516 | case keyCode.UP: |
| 7517 | return ( |
| 7518 | this.inputmask.__valueSet.call( |
| 7519 | this, |
| 7520 | parseFloat( |
| 7521 | this.inputmask.unmaskedvalue() |
| 7522 | ) + parseInt(opts.step) |
| 7523 | ), |
| 7524 | $input.trigger("setvalue"), |
| 7525 | !1 |
| 7526 | ); |
| 7527 | |
| 7528 | case keyCode.DOWN: |
| 7529 | return ( |
| 7530 | this.inputmask.__valueSet.call( |
| 7531 | this, |
| 7532 | parseFloat( |
| 7533 | this.inputmask.unmaskedvalue() |
| 7534 | ) - parseInt(opts.step) |
| 7535 | ), |
| 7536 | $input.trigger("setvalue"), |
| 7537 | !1 |
| 7538 | ); |
| 7539 | } |
| 7540 | if ( |
| 7541 | !e.shiftKey && |
| 7542 | (e.keyCode === keyCode.DELETE || |
| 7543 | e.keyCode === keyCode.BACKSPACE || |
| 7544 | e.keyCode === keyCode.BACKSPACE_SAFARI) && |
| 7545 | caretPos.begin !== buffer.length |
| 7546 | ) { |
| 7547 | if ( |
| 7548 | buffer[ |
| 7549 | e.keyCode === keyCode.DELETE |
| 7550 | ? caretPos.begin - 1 |
| 7551 | : caretPos.end |
| 7552 | ] === opts.negationSymbol.front |
| 7553 | ) |
| 7554 | return ( |
| 7555 | (bffr = buffer.slice().reverse()), |
| 7556 | "" !== opts.negationSymbol.front && |
| 7557 | bffr.shift(), |
| 7558 | "" !== opts.negationSymbol.back && |
| 7559 | bffr.pop(), |
| 7560 | $input.trigger("setvalue", [ |
| 7561 | bffr.join(""), |
| 7562 | caretPos.begin, |
| 7563 | ]), |
| 7564 | !1 |
| 7565 | ); |
| 7566 | if (!0 === opts._radixDance) { |
| 7567 | var radixPos = $.inArray( |
| 7568 | opts.radixPoint, |
| 7569 | buffer |
| 7570 | ); |
| 7571 | if (opts.digitsOptional) { |
| 7572 | if (0 === radixPos) |
| 7573 | return ( |
| 7574 | (bffr = buffer |
| 7575 | .slice() |
| 7576 | .reverse()), |
| 7577 | bffr.pop(), |
| 7578 | $input.trigger("setvalue", [ |
| 7579 | bffr.join(""), |
| 7580 | caretPos.begin >= |
| 7581 | bffr.length |
| 7582 | ? bffr.length |
| 7583 | : caretPos.begin, |
| 7584 | ]), |
| 7585 | !1 |
| 7586 | ); |
| 7587 | } else if ( |
| 7588 | -1 !== radixPos && |
| 7589 | (caretPos.begin < radixPos || |
| 7590 | caretPos.end < radixPos || |
| 7591 | (e.keyCode === keyCode.DELETE && |
| 7592 | caretPos.begin === radixPos)) |
| 7593 | ) |
| 7594 | return ( |
| 7595 | caretPos.begin !== caretPos.end || |
| 7596 | (e.keyCode !== |
| 7597 | keyCode.BACKSPACE && |
| 7598 | e.keyCode !== |
| 7599 | keyCode.BACKSPACE_SAFARI) || |
| 7600 | caretPos.begin++, |
| 7601 | (bffr = buffer.slice().reverse()), |
| 7602 | bffr.splice( |
| 7603 | bffr.length - caretPos.begin, |
| 7604 | caretPos.begin - |
| 7605 | caretPos.end + |
| 7606 | 1 |
| 7607 | ), |
| 7608 | (bffr = alignDigits( |
| 7609 | bffr, |
| 7610 | opts.digits, |
| 7611 | opts |
| 7612 | ).join("")), |
| 7613 | $input.trigger("setvalue", [ |
| 7614 | bffr, |
| 7615 | caretPos.begin >= bffr.length |
| 7616 | ? radixPos + 1 |
| 7617 | : caretPos.begin, |
| 7618 | ]), |
| 7619 | !1 |
| 7620 | ); |
| 7621 | } |
| 7622 | } |
| 7623 | }, |
| 7624 | }, |
| 7625 | currency: { |
| 7626 | prefix: "", |
| 7627 | groupSeparator: ",", |
| 7628 | alias: "numeric", |
| 7629 | digits: 2, |
| 7630 | digitsOptional: !1, |
| 7631 | }, |
| 7632 | decimal: { |
| 7633 | alias: "numeric", |
| 7634 | }, |
| 7635 | integer: { |
| 7636 | alias: "numeric", |
| 7637 | digits: 0, |
| 7638 | }, |
| 7639 | percentage: { |
| 7640 | alias: "numeric", |
| 7641 | min: 0, |
| 7642 | max: 100, |
| 7643 | suffix: " %", |
| 7644 | digits: 0, |
| 7645 | allowMinus: !1, |
| 7646 | }, |
| 7647 | indianns: { |
| 7648 | alias: "numeric", |
| 7649 | _mask: function _mask(opts) { |
| 7650 | return ( |
| 7651 | "(" + |
| 7652 | opts.groupSeparator + |
| 7653 | "99){*|1}(" + |
| 7654 | opts.groupSeparator + |
| 7655 | "999){1|1}" |
| 7656 | ); |
| 7657 | }, |
| 7658 | groupSeparator: ",", |
| 7659 | radixPoint: ".", |
| 7660 | placeholder: "0", |
| 7661 | digits: 2, |
| 7662 | digitsOptional: !1, |
| 7663 | }, |
| 7664 | }), |
| 7665 | (module.exports = Inputmask); |
| 7666 | }, |
| 7667 | function (module, exports, __webpack_require__) { |
| 7668 | "use strict"; |
| 7669 | var _inputmask = _interopRequireDefault(__webpack_require__(1)); |
| 7670 | function _typeof(obj) { |
| 7671 | return ( |
| 7672 | (_typeof = |
| 7673 | "function" == typeof Symbol && |
| 7674 | "symbol" == typeof Symbol.iterator |
| 7675 | ? function _typeof(obj) { |
| 7676 | return typeof obj; |
| 7677 | } |
| 7678 | : function _typeof(obj) { |
| 7679 | return obj && |
| 7680 | "function" == typeof Symbol && |
| 7681 | obj.constructor === Symbol && |
| 7682 | obj !== Symbol.prototype |
| 7683 | ? "symbol" |
| 7684 | : typeof obj; |
| 7685 | }), |
| 7686 | _typeof(obj) |
| 7687 | ); |
| 7688 | } |
| 7689 | function _classCallCheck(instance, Constructor) { |
| 7690 | if (!(instance instanceof Constructor)) |
| 7691 | throw new TypeError( |
| 7692 | "Cannot call a class as a function" |
| 7693 | ); |
| 7694 | } |
| 7695 | function _possibleConstructorReturn(self, call) { |
| 7696 | return !call || |
| 7697 | ("object" !== _typeof(call) && |
| 7698 | "function" != typeof call) |
| 7699 | ? _assertThisInitialized(self) |
| 7700 | : call; |
| 7701 | } |
| 7702 | function _assertThisInitialized(self) { |
| 7703 | if (void 0 === self) |
| 7704 | throw new ReferenceError( |
| 7705 | "this hasn't been initialised - super() hasn't been called" |
| 7706 | ); |
| 7707 | return self; |
| 7708 | } |
| 7709 | function _inherits(subClass, superClass) { |
| 7710 | if ("function" != typeof superClass && null !== superClass) |
| 7711 | throw new TypeError( |
| 7712 | "Super expression must either be null or a function" |
| 7713 | ); |
| 7714 | (subClass.prototype = Object.create( |
| 7715 | superClass && superClass.prototype, |
| 7716 | { |
| 7717 | constructor: { |
| 7718 | value: subClass, |
| 7719 | writable: !0, |
| 7720 | configurable: !0, |
| 7721 | }, |
| 7722 | } |
| 7723 | )), |
| 7724 | superClass && _setPrototypeOf(subClass, superClass); |
| 7725 | } |
| 7726 | function _wrapNativeSuper(Class) { |
| 7727 | var _cache = "function" == typeof Map ? new Map() : void 0; |
| 7728 | return ( |
| 7729 | (_wrapNativeSuper = function _wrapNativeSuper(Class) { |
| 7730 | if (null === Class || !_isNativeFunction(Class)) |
| 7731 | return Class; |
| 7732 | if ("function" != typeof Class) |
| 7733 | throw new TypeError( |
| 7734 | "Super expression must either be null or a function" |
| 7735 | ); |
| 7736 | if ("undefined" != typeof _cache) { |
| 7737 | if (_cache.has(Class)) return _cache.get(Class); |
| 7738 | _cache.set(Class, Wrapper); |
| 7739 | } |
| 7740 | function Wrapper() { |
| 7741 | return _construct( |
| 7742 | Class, |
| 7743 | arguments, |
| 7744 | _getPrototypeOf(this).constructor |
| 7745 | ); |
| 7746 | } |
| 7747 | return ( |
| 7748 | (Wrapper.prototype = Object.create( |
| 7749 | Class.prototype, |
| 7750 | { |
| 7751 | constructor: { |
| 7752 | value: Wrapper, |
| 7753 | enumerable: !1, |
| 7754 | writable: !0, |
| 7755 | configurable: !0, |
| 7756 | }, |
| 7757 | } |
| 7758 | )), |
| 7759 | _setPrototypeOf(Wrapper, Class) |
| 7760 | ); |
| 7761 | }), |
| 7762 | _wrapNativeSuper(Class) |
| 7763 | ); |
| 7764 | } |
| 7765 | function isNativeReflectConstruct() { |
| 7766 | if ("undefined" == typeof Reflect || !Reflect.construct) |
| 7767 | return !1; |
| 7768 | if (Reflect.construct.sham) return !1; |
| 7769 | if ("function" == typeof Proxy) return !0; |
| 7770 | try { |
| 7771 | return ( |
| 7772 | Date.prototype.toString.call( |
| 7773 | Reflect.construct(Date, [], function () {}) |
| 7774 | ), |
| 7775 | !0 |
| 7776 | ); |
| 7777 | } catch (e) { |
| 7778 | return !1; |
| 7779 | } |
| 7780 | } |
| 7781 | function _construct(Parent, args, Class) { |
| 7782 | return ( |
| 7783 | (_construct = isNativeReflectConstruct() |
| 7784 | ? Reflect.construct |
| 7785 | : function _construct(Parent, args, Class) { |
| 7786 | var a = [null]; |
| 7787 | a.push.apply(a, args); |
| 7788 | var Constructor = Function.bind.apply( |
| 7789 | Parent, |
| 7790 | a |
| 7791 | ), |
| 7792 | instance = new Constructor(); |
| 7793 | return ( |
| 7794 | Class && |
| 7795 | _setPrototypeOf( |
| 7796 | instance, |
| 7797 | Class.prototype |
| 7798 | ), |
| 7799 | instance |
| 7800 | ); |
| 7801 | }), |
| 7802 | _construct.apply(null, arguments) |
| 7803 | ); |
| 7804 | } |
| 7805 | function _isNativeFunction(fn) { |
| 7806 | return ( |
| 7807 | -1 !== |
| 7808 | Function.toString.call(fn).indexOf("[native code]") |
| 7809 | ); |
| 7810 | } |
| 7811 | function _setPrototypeOf(o, p) { |
| 7812 | return ( |
| 7813 | (_setPrototypeOf = |
| 7814 | Object.setPrototypeOf || |
| 7815 | function _setPrototypeOf(o, p) { |
| 7816 | return (o.__proto__ = p), o; |
| 7817 | }), |
| 7818 | _setPrototypeOf(o, p) |
| 7819 | ); |
| 7820 | } |
| 7821 | function _getPrototypeOf(o) { |
| 7822 | return ( |
| 7823 | (_getPrototypeOf = Object.setPrototypeOf |
| 7824 | ? Object.getPrototypeOf |
| 7825 | : function _getPrototypeOf(o) { |
| 7826 | return ( |
| 7827 | o.__proto__ || Object.getPrototypeOf(o) |
| 7828 | ); |
| 7829 | }), |
| 7830 | _getPrototypeOf(o) |
| 7831 | ); |
| 7832 | } |
| 7833 | function _interopRequireDefault(obj) { |
| 7834 | return obj && obj.__esModule |
| 7835 | ? obj |
| 7836 | : { |
| 7837 | default: obj, |
| 7838 | }; |
| 7839 | } |
| 7840 | if ( |
| 7841 | document.head.createShadowRoot || |
| 7842 | document.head.attachShadow |
| 7843 | ) { |
| 7844 | var InputmaskElement = (function (_HTMLElement) { |
| 7845 | function InputmaskElement() { |
| 7846 | var _this; |
| 7847 | _classCallCheck(this, InputmaskElement), |
| 7848 | (_this = _possibleConstructorReturn( |
| 7849 | this, |
| 7850 | _getPrototypeOf(InputmaskElement).call(this) |
| 7851 | )); |
| 7852 | var attributeNames = _this.getAttributeNames(), |
| 7853 | shadow = _this.attachShadow({ |
| 7854 | mode: "closed", |
| 7855 | }), |
| 7856 | input = document.createElement("input"); |
| 7857 | for (var attr in ((input.type = "text"), |
| 7858 | shadow.appendChild(input), |
| 7859 | attributeNames)) |
| 7860 | Object.prototype.hasOwnProperty.call( |
| 7861 | attributeNames, |
| 7862 | attr |
| 7863 | ) && |
| 7864 | input.setAttribute( |
| 7865 | "data-inputmask-" + |
| 7866 | attributeNames[attr], |
| 7867 | _this.getAttribute(attributeNames[attr]) |
| 7868 | ); |
| 7869 | return ( |
| 7870 | new _inputmask.default().mask(input), |
| 7871 | (input.inputmask.shadowRoot = shadow), |
| 7872 | _this |
| 7873 | ); |
| 7874 | } |
| 7875 | return ( |
| 7876 | _inherits(InputmaskElement, _HTMLElement), |
| 7877 | InputmaskElement |
| 7878 | ); |
| 7879 | })(_wrapNativeSuper(HTMLElement)); |
| 7880 | customElements.define("input-mask", InputmaskElement); |
| 7881 | } |
| 7882 | }, |
| 7883 | function (module, exports, __webpack_require__) { |
| 7884 | "use strict"; |
| 7885 | function _typeof(obj) { |
| 7886 | return ( |
| 7887 | (_typeof = |
| 7888 | "function" == typeof Symbol && |
| 7889 | "symbol" == typeof Symbol.iterator |
| 7890 | ? function _typeof(obj) { |
| 7891 | return typeof obj; |
| 7892 | } |
| 7893 | : function _typeof(obj) { |
| 7894 | return obj && |
| 7895 | "function" == typeof Symbol && |
| 7896 | obj.constructor === Symbol && |
| 7897 | obj !== Symbol.prototype |
| 7898 | ? "symbol" |
| 7899 | : typeof obj; |
| 7900 | }), |
| 7901 | _typeof(obj) |
| 7902 | ); |
| 7903 | } |
| 7904 | var $ = __webpack_require__(3), |
| 7905 | Inputmask = __webpack_require__(1); |
| 7906 | void 0 === $.fn.inputmask && |
| 7907 | ($.fn.inputmask = function (fn, options) { |
| 7908 | var nptmask, |
| 7909 | input = this[0]; |
| 7910 | if ( |
| 7911 | (void 0 === options && (options = {}), |
| 7912 | "string" == typeof fn) |
| 7913 | ) |
| 7914 | switch (fn) { |
| 7915 | case "unmaskedvalue": |
| 7916 | return input && input.inputmask |
| 7917 | ? input.inputmask.unmaskedvalue() |
| 7918 | : $(input).val(); |
| 7919 | |
| 7920 | case "remove": |
| 7921 | return this.each(function () { |
| 7922 | this.inputmask && |
| 7923 | this.inputmask.remove(); |
| 7924 | }); |
| 7925 | |
| 7926 | case "getemptymask": |
| 7927 | return input && input.inputmask |
| 7928 | ? input.inputmask.getemptymask() |
| 7929 | : ""; |
| 7930 | |
| 7931 | case "hasMaskedValue": |
| 7932 | return ( |
| 7933 | !(!input || !input.inputmask) && |
| 7934 | input.inputmask.hasMaskedValue() |
| 7935 | ); |
| 7936 | |
| 7937 | case "isComplete": |
| 7938 | return ( |
| 7939 | !input || |
| 7940 | !input.inputmask || |
| 7941 | input.inputmask.isComplete() |
| 7942 | ); |
| 7943 | |
| 7944 | case "getmetadata": |
| 7945 | return input && input.inputmask |
| 7946 | ? input.inputmask.getmetadata() |
| 7947 | : void 0; |
| 7948 | |
| 7949 | case "setvalue": |
| 7950 | Inputmask.setValue(input, options); |
| 7951 | break; |
| 7952 | |
| 7953 | case "option": |
| 7954 | if ("string" != typeof options) |
| 7955 | return this.each(function () { |
| 7956 | if (void 0 !== this.inputmask) |
| 7957 | return this.inputmask.option( |
| 7958 | options |
| 7959 | ); |
| 7960 | }); |
| 7961 | if (input && void 0 !== input.inputmask) |
| 7962 | return input.inputmask.option(options); |
| 7963 | break; |
| 7964 | |
| 7965 | default: |
| 7966 | return ( |
| 7967 | (options.alias = fn), |
| 7968 | (nptmask = new Inputmask(options)), |
| 7969 | this.each(function () { |
| 7970 | nptmask.mask(this); |
| 7971 | }) |
| 7972 | ); |
| 7973 | } |
| 7974 | else { |
| 7975 | if (Array.isArray(fn)) |
| 7976 | return ( |
| 7977 | (options.alias = fn), |
| 7978 | (nptmask = new Inputmask(options)), |
| 7979 | this.each(function () { |
| 7980 | nptmask.mask(this); |
| 7981 | }) |
| 7982 | ); |
| 7983 | if ("object" == _typeof(fn)) |
| 7984 | return ( |
| 7985 | (nptmask = new Inputmask(fn)), |
| 7986 | void 0 === fn.mask && void 0 === fn.alias |
| 7987 | ? this.each(function () { |
| 7988 | if (void 0 !== this.inputmask) |
| 7989 | return this.inputmask.option( |
| 7990 | fn |
| 7991 | ); |
| 7992 | nptmask.mask(this); |
| 7993 | }) |
| 7994 | : this.each(function () { |
| 7995 | nptmask.mask(this); |
| 7996 | }) |
| 7997 | ); |
| 7998 | if (void 0 === fn) |
| 7999 | return this.each(function () { |
| 8000 | (nptmask = new Inputmask(options)), |
| 8001 | nptmask.mask(this); |
| 8002 | }); |
| 8003 | } |
| 8004 | }); |
| 8005 | }, |
| 8006 | function (module, exports, __webpack_require__) { |
| 8007 | "use strict"; |
| 8008 | var im = __webpack_require__(6), |
| 8009 | jQuery = __webpack_require__(3); |
| 8010 | im.dependencyLib === jQuery && __webpack_require__(12), |
| 8011 | (module.exports = im); |
| 8012 | }, |
| 8013 | ]), |
| 8014 | (installedModules = {}), |
| 8015 | (__webpack_require__.m = modules), |
| 8016 | (__webpack_require__.c = installedModules), |
| 8017 | (__webpack_require__.d = function (exports, name, getter) { |
| 8018 | __webpack_require__.o(exports, name) || |
| 8019 | Object.defineProperty(exports, name, { |
| 8020 | enumerable: !0, |
| 8021 | get: getter, |
| 8022 | }); |
| 8023 | }), |
| 8024 | (__webpack_require__.r = function (exports) { |
| 8025 | "undefined" != typeof Symbol && |
| 8026 | Symbol.toStringTag && |
| 8027 | Object.defineProperty(exports, Symbol.toStringTag, { |
| 8028 | value: "Module", |
| 8029 | }), |
| 8030 | Object.defineProperty(exports, "__esModule", { |
| 8031 | value: !0, |
| 8032 | }); |
| 8033 | }), |
| 8034 | (__webpack_require__.t = function (value, mode) { |
| 8035 | if ((1 & mode && (value = __webpack_require__(value)), 8 & mode)) |
| 8036 | return value; |
| 8037 | if ( |
| 8038 | 4 & mode && |
| 8039 | "object" == typeof value && |
| 8040 | value && |
| 8041 | value.__esModule |
| 8042 | ) |
| 8043 | return value; |
| 8044 | var ns = Object.create(null); |
| 8045 | if ( |
| 8046 | (__webpack_require__.r(ns), |
| 8047 | Object.defineProperty(ns, "default", { |
| 8048 | enumerable: !0, |
| 8049 | value: value, |
| 8050 | }), |
| 8051 | 2 & mode && "string" != typeof value) |
| 8052 | ) |
| 8053 | for (var key in value) |
| 8054 | __webpack_require__.d( |
| 8055 | ns, |
| 8056 | key, |
| 8057 | function (key) { |
| 8058 | return value[key]; |
| 8059 | }.bind(null, key) |
| 8060 | ); |
| 8061 | return ns; |
| 8062 | }), |
| 8063 | (__webpack_require__.n = function (module) { |
| 8064 | var getter = |
| 8065 | module && module.__esModule |
| 8066 | ? function getDefault() { |
| 8067 | return module.default; |
| 8068 | } |
| 8069 | : function getModuleExports() { |
| 8070 | return module; |
| 8071 | }; |
| 8072 | return __webpack_require__.d(getter, "a", getter), getter; |
| 8073 | }), |
| 8074 | (__webpack_require__.o = function (object, property) { |
| 8075 | return Object.prototype.hasOwnProperty.call(object, property); |
| 8076 | }), |
| 8077 | (__webpack_require__.p = ""), |
| 8078 | __webpack_require__((__webpack_require__.s = 13)) |
| 8079 | ); |
| 8080 | function __webpack_require__(moduleId) { |
| 8081 | if (installedModules[moduleId]) |
| 8082 | return installedModules[moduleId].exports; |
| 8083 | var module = (installedModules[moduleId] = { |
| 8084 | i: moduleId, |
| 8085 | l: !1, |
| 8086 | exports: {}, |
| 8087 | }); |
| 8088 | return ( |
| 8089 | modules[moduleId].call( |
| 8090 | module.exports, |
| 8091 | module, |
| 8092 | module.exports, |
| 8093 | __webpack_require__ |
| 8094 | ), |
| 8095 | (module.l = !0), |
| 8096 | module.exports |
| 8097 | ); |
| 8098 | } |
| 8099 | var modules, installedModules; |
| 8100 | }); |
| 8101 |