{"version":3,"file":"autoNumeric.js","sources":["webpack://AutoNumeric/webpack/universalModuleDefinition","webpack://AutoNumeric/webpack/bootstrap","webpack://AutoNumeric/./src/AutoNumeric.js","webpack://AutoNumeric/./src/AutoNumericDefaultSettings.js","webpack://AutoNumeric/./src/AutoNumericEnum.js","webpack://AutoNumeric/./src/AutoNumericEvents.js","webpack://AutoNumeric/./src/AutoNumericHelper.js","webpack://AutoNumeric/./src/AutoNumericOptions.js","webpack://AutoNumeric/./src/AutoNumericPredefinedOptions.js","webpack://AutoNumeric/./src/main.js","webpack://AutoNumeric/./src/maths/ASTNode.js","webpack://AutoNumeric/./src/maths/Evaluator.js","webpack://AutoNumeric/./src/maths/Lexer.js","webpack://AutoNumeric/./src/maths/Parser.js","webpack://AutoNumeric/./src/maths/Token.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"AutoNumeric\"] = factory();\n\telse\n\t\troot[\"AutoNumeric\"] = factory();\n})(this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/main.js\");\n","function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(n); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * AutoNumeric.js\n *\n * @version 4.6.0\n * @date 2020-04-26 UTC 10:45\n *\n * @authors Bob Knothe, Alexandre Bonneau\n * @contributors Sokolov Yura and others, cf. AUTHORS\n * @copyright 2009 Robert J. Knothe\n * @since 2009-08-09\n *\n * @summary autoNumeric is a standalone Javascript library\n * that provides live *as-you-type* formatting for\n * international numbers and currencies.\n *\n * @link http://autonumeric.org\n *\n * Note : Some functions are borrowed from big.js\n * @see https://github.com/MikeMcl/big.js/\n *\n * Please report any bugs to https://github.com/autoNumeric/autoNumeric\n *\n * @license Released under the MIT License\n * @link http://www.opensource.org/licenses/mit-license.php\n *\n * Permission is hereby granted, free of charge, to any person\n * obtaining a copy of this software and associated documentation\n * files (the \"Software\"), to deal in the Software without\n * restriction, including without limitation the rights to use,\n * copy, modify, merge, publish, distribute, sub license, and/or sell\n * copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following\n * conditions:\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n * OTHER DEALINGS IN THE SOFTWARE.\n */\n//TODO Prevent having to enter relative path in the js files (ie. using `./AutoNumericHelper` instead of just `AutoNumericHelper`) (cf. http://moduscreate.com/es6-es2015-import-no-relative-path-webpack/)\nimport AutoNumericHelper from './AutoNumericHelper';\nimport AutoNumericEnum from './AutoNumericEnum';\nimport Evaluator from './maths/Evaluator';\nimport Parser from './maths/Parser';\n/**\n * Class declaration for the AutoNumeric object.\n *\n * An AutoNumeric element is an object wrapper that keeps a reference to the DOM element it manages (usually an one), and provides autoNumeric-specific variables and functions.\n */\n\nvar AutoNumeric = /*#__PURE__*/function () {\n /**\n * Initialize the AutoNumeric object onto the given DOM element, and attach the settings and related event listeners to it.\n * The options passed as a parameter is an object that contains the settings (ie. {digitGroupSeparator: \".\", decimalCharacter: \",\", currencySymbol: '€ '})\n *\n * @example\n * anElement = new AutoNumeric(domElement); // With the default options\n * anElement = new AutoNumeric(domElement, { options }); // With one option object\n * anElement = new AutoNumeric(domElement, 'euroPos'); // With a named pre-defined string\n * anElement = new AutoNumeric(domElement, [{ options1 }, 'euroPos', { options2 }]); // With multiple option objects (the latest option overwriting the previous ones)\n * anElement = new AutoNumeric(domElement, null, { options }); // With one option object, and a failed initial value\n * anElement = new AutoNumeric(domElement).french(); // With one pre-defined language object\n * anElement = new AutoNumeric(domElement).french({ options });// With one pre-defined language object and additional options that will override the defaults\n *\n * // ...or init and set the value in one call :\n * anElement = new AutoNumeric(domElement, 12345.789); // With the default options, and an initial value\n * anElement = new AutoNumeric(domElement, 12345.789, { options });\n * anElement = new AutoNumeric(domElement, '12345.789', { options });\n * anElement = new AutoNumeric(domElement, 12345.789, 'euroPos');\n * anElement = new AutoNumeric(domElement, 12345.789, [{ options1 }, 'euroPos', { options2 }]);\n * anElement = new AutoNumeric(domElement, 12345.789).french({ options });\n * anElement = new AutoNumeric(domElement, 12345.789, { options }).french({ options }); // Not really helpful, but possible\n *\n * // The AutoNumeric constructor class can also accept a string as a css selector. Under the hood this use `QuerySelector` and limit itself to only the first element it finds.\n * anElement = new AutoNumeric('.myCssClass > input');\n * anElement = new AutoNumeric('.myCssClass > input', { options });\n * anElement = new AutoNumeric('.myCssClass > input', 'euroPos');\n * anElement = new AutoNumeric('.myCssClass > input', [{ options1 }, 'euroPos', { options2 }]);\n * anElement = new AutoNumeric('.myCssClass > input', 12345.789);\n * anElement = new AutoNumeric('.myCssClass > input', 12345.789, { options });\n * anElement = new AutoNumeric('.myCssClass > input', 12345.789, 'euroPos');\n * anElement = new AutoNumeric('.myCssClass > input', 12345.789, [{ options1 }, 'euroPos', { options2 }]);\n * anElement = new AutoNumeric('.myCssClass > input', null, { options }); // With a failed initial value\n * anElement = new AutoNumeric('.myCssClass > input', 12345.789).french({ options });\n *\n * @param {object|Array|number|string} arg1\n * @param {object|Array|number|string|null} arg2\n * @param {object|Array|number|string|null} arg3\n * @throws\n */\n function AutoNumeric() {\n var _this = this;\n\n var arg1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var arg2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n var arg3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n\n _classCallCheck(this, AutoNumeric);\n\n // --------------------------------------------------------\n // -------------- Initialization\n // Initialize the arguments\n var _AutoNumeric$_setArgu = AutoNumeric._setArgumentsValues(arg1, arg2, arg3),\n domElement = _AutoNumeric$_setArgu.domElement,\n initialValue = _AutoNumeric$_setArgu.initialValue,\n userOptions = _AutoNumeric$_setArgu.userOptions; // Initialize the element\n\n\n this.domElement = domElement; // Generate the settings\n\n this.defaultRawValue = ''; // The default raw value to set when initializing an AutoNumeric object\n\n this._setSettings(userOptions, false); //TODO If `styleRules` is not null, add by default a class 'autoNumeric' that adds transition to color, background-color, border-color properties\n // Check if the DOM element is supported\n\n\n this._checkElement(); // Store the additional attributes inside the AutoNumeric object\n // Note: This variable is needed and not a duplicate of `initialValueOnFirstKeydown` nor `valueOnFocus` since it serves a different purpose and has a different lifecycle\n\n\n this.savedCancellableValue = null; // Initialize the undo/redo variables\n\n this.historyTable = []; // Keep track of *all* valid states of the element value\n\n this.historyTableIndex = -1; // Pointer to the current undo/redo state. This will be set to '0' during initialization since it first adds itself.\n\n this.onGoingRedo = false; // Variable that keeps track if a 'redo' is ongoing (in order to prevent an 'undo' to be launch when releasing the shift key before the ctrl key after a 'redo' shortcut)\n // Initialize the parent form element, if any\n\n this.parentForm = this._getParentForm(); // Set the initial value if it exists and if the `formatOnPageLoad` option will allow it\n\n if (!this.runOnce && this.settings.formatOnPageLoad) {\n // Format the element value if needed\n this._formatDefaultValueOnPageLoad(initialValue);\n } else {\n // Otherwise set the `rawValue` and the element value, but do not format the latter yet\n var valueToSet;\n\n if (AutoNumericHelper.isNull(initialValue)) {\n switch (this.settings.emptyInputBehavior) {\n case AutoNumeric.options.emptyInputBehavior.min:\n valueToSet = this.settings.minimumValue;\n break;\n\n case AutoNumeric.options.emptyInputBehavior.max:\n valueToSet = this.settings.maximumValue;\n break;\n\n case AutoNumeric.options.emptyInputBehavior.zero:\n valueToSet = '0';\n break;\n // In order to stay consistent when `formatOnPageLoad` is set to `true`, it's still impossible to set the `null` value as the initial value\n\n case AutoNumeric.options.emptyInputBehavior.focus:\n case AutoNumeric.options.emptyInputBehavior.press:\n case AutoNumeric.options.emptyInputBehavior.always:\n case AutoNumeric.options.emptyInputBehavior[\"null\"]:\n valueToSet = '';\n break;\n // When `emptyInputBehavior` is a number or a string representing a number\n\n default:\n valueToSet = this.settings.emptyInputBehavior;\n }\n } else {\n valueToSet = initialValue;\n }\n\n this._setElementAndRawValue(valueToSet);\n }\n\n this.runOnce = true; // Add the events listeners only on input or editable elements\n\n this.hasEventListeners = false;\n\n if (this.isInputElement || this.isContentEditable) {\n if (!this.settings.noEventListeners) {\n //XXX Here we make sure the global list is created after creating the event listeners, to only create the event listeners on `document` once\n this._createEventListeners();\n }\n\n this._setWritePermissions(true);\n } // Save the initial values (html attribute + element.value) for the pristine test\n\n\n this._saveInitialValues(initialValue); // Setup the data for the persistent storage solution (ie. sessionStorage or cookies)\n\n\n this.sessionStorageAvailable = this.constructor._storageTest();\n this.storageNamePrefix = 'AUTO_'; // The prefix for the raw value storage name variable can be modified here\n\n this._setPersistentStorageName(); // --------------------------------------------------------\n // -------------- Tracking\n\n\n this.validState = true; // Keep track if the element is in the valid state\n\n this.isFocused = false; // Keep track if the element is currently focused\n\n this.isWheelEvent = false; // Keep track if a mouse wheel event is currently ongoing\n\n this.isDropEvent = false; // Keep track if a drop event is currently ongoing\n\n this.isEditing = false; // Keep track if the user is currently editing the element\n\n this.rawValueOnFocus = void 0; // Keep track of the rawValue (needed to define if a change event must be sent on blur or enter key)\n // Watch any external changes to the element value/textContent/nodeValue and `set()` the new value so that it gets formatted/saved in the history\n\n this.internalModification = false; // This is temporarily set to `true` only when the AutoNumeric object does update the element value\n\n this.attributeToWatch = this._getAttributeToWatch();\n this.getterSetter = Object.getOwnPropertyDescriptor(this.domElement.__proto__, this.attributeToWatch);\n\n this._addWatcher();\n\n if (this.settings.createLocalList) {\n // Keep track of every AutoNumeric elements that this object initialized\n this._createLocalList();\n } // Keep track of all AutoNumeric elements in the current web page\n\n\n this.constructor._addToGlobalList(this); // --------------------------------------------------------\n // -------------- Methods\n // Create the global functions\n\n\n this.global = {\n /**\n * Set the same given element value for each elements in the local AutoNumeric element list, and format those elements immediately\n *\n * @param {number|string} newValue The value must be a number or a numeric string\n * @param {object} options A settings object that will override the current settings. Note: the update is done only if the `newValue` is defined.\n */\n set: function set(newValue) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n _this.autoNumericLocalList.forEach(function (aNObject) {\n aNObject.set(newValue, options);\n });\n },\n\n /**\n * Set the value given value directly as the DOM element value, without formatting it beforehand.\n * This sets the same unformatted value for each elements in the local AutoNumeric element list.\n *\n * @param {number|string} value\n * @param {object} options\n */\n setUnformatted: function setUnformatted(value) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n _this.autoNumericLocalList.forEach(function (aNObject) {\n aNObject.setUnformatted(value, options);\n });\n },\n\n /**\n * This is an alias of the `getNumericString()` function, and should not be used anymore.\n *\n * @param {function|null} callback If a callback is passed, then the result is passed to it as its first argument, and the AutoNumeric object has its second\n * @returns {Array}\n * @deprecated\n */\n get: function get() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var result = [];\n\n _this.autoNumericLocalList.forEach(function (aNObject) {\n result.push(aNObject.get());\n });\n\n _this._executeCallback(result, callback);\n\n return result;\n },\n\n /**\n * Return an array of the unformatted values (as a string) of each AutoNumeric element of the local AutoNumeric element list\n *\n * @param {function|null} callback If a callback is passed, then the result is passed to it as its first argument, and the AutoNumeric object has its second\n * @returns {Array}\n */\n getNumericString: function getNumericString() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var result = [];\n\n _this.autoNumericLocalList.forEach(function (aNObject) {\n result.push(aNObject.getNumericString());\n });\n\n _this._executeCallback(result, callback);\n\n return result;\n },\n\n /**\n * Return an array of the current formatted values (as a string) of each AutoNumeric element of the local AutoNumeric element list\n *\n * @param {function|null} callback If a callback is passed, then the result is passed to it as its first argument, and the AutoNumeric object has its second\n * @returns {Array}\n */\n getFormatted: function getFormatted() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var result = [];\n\n _this.autoNumericLocalList.forEach(function (aNObject) {\n result.push(aNObject.getFormatted());\n });\n\n _this._executeCallback(result, callback);\n\n return result;\n },\n\n /**\n * Return an array of the element unformatted values (as a real Javascript number), for each element of the local AutoNumeric element list\n *\n * @param {function|null} callback If a callback is passed, then the result is passed to it as its first argument, and the AutoNumeric object has its second\n * @returns {Array}\n */\n getNumber: function getNumber() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var result = [];\n\n _this.autoNumericLocalList.forEach(function (aNObject) {\n result.push(aNObject.getNumber());\n });\n\n _this._executeCallback(result, callback);\n\n return result;\n },\n\n /**\n * Returns the unformatted values (following the `outputFormat` setting) of each element of the local AutoNumeric element list into an array\n *\n * @param {function|null} callback If a callback is passed, then the result is passed to it as its first argument, and the AutoNumeric object has its second\n * @returns {Array}\n */\n getLocalized: function getLocalized() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var result = [];\n\n _this.autoNumericLocalList.forEach(function (aNObject) {\n result.push(aNObject.getLocalized());\n });\n\n _this._executeCallback(result, callback);\n\n return result;\n },\n\n /**\n * Force each element of the local AutoNumeric element list to reformat its value\n */\n reformat: function reformat() {\n _this.autoNumericLocalList.forEach(function (aNObject) {\n aNObject.reformat();\n });\n },\n\n /**\n * Remove the formatting and keep only the raw unformatted value (as a numericString) in each elements of the local AutoNumeric element list\n */\n unformat: function unformat() {\n _this.autoNumericLocalList.forEach(function (aNObject) {\n aNObject.unformat();\n });\n },\n\n /**\n * Remove the formatting and keep only the localized unformatted value in the element, with the option to override the default outputFormat if needed\n *\n * @param {null|string} forcedOutputFormat If set to something different than `null`, then this is used as an overriding outputFormat option\n */\n unformatLocalized: function unformatLocalized() {\n var forcedOutputFormat = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n _this.autoNumericLocalList.forEach(function (aNObject) {\n aNObject.unformatLocalized(forcedOutputFormat);\n });\n },\n\n /**\n * Updates the AutoNumeric settings, and immediately format the elements accordingly, for each elements of the local AutoNumeric element list\n *\n * @param {object} newOptions This can be either one or more option objects\n */\n update: function update() {\n for (var _len = arguments.length, newOptions = new Array(_len), _key = 0; _key < _len; _key++) {\n newOptions[_key] = arguments[_key];\n }\n\n _this.autoNumericLocalList.forEach(function (aNObject) {\n aNObject.update.apply(aNObject, newOptions);\n });\n },\n\n /**\n * Return `true` if *all* the autoNumeric-managed elements are pristine, if their raw value hasn't changed.\n * By default, this returns `true` if the raw unformatted value is still the same even if the formatted one has changed (due to a configuration update for instance).\n *\n * @param {boolean} checkOnlyRawValue If set to `true`, the pristine value is done on the raw unformatted value, not the formatted one. If set to `false`, this also checks that the formatted value hasn't changed.\n * @returns {boolean}\n */\n isPristine: function isPristine() {\n var checkOnlyRawValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n var isPristine = true;\n\n _this.autoNumericLocalList.forEach(function (aNObject) {\n if (isPristine && !aNObject.isPristine(checkOnlyRawValue)) {\n isPristine = false;\n }\n });\n\n return isPristine;\n },\n\n /**\n * Execute the `clear()` method on each AutoNumeric object in the local AutoNumeric element list\n *\n * @param {boolean} forceClearAll\n */\n clear: function clear() {\n var forceClearAll = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n _this.autoNumericLocalList.forEach(function (aNObject) {\n aNObject.clear(forceClearAll);\n });\n },\n\n /**\n * Execute the `remove()` method on each AutoNumeric object in the local AutoNumeric element list\n */\n remove: function remove() {\n _this.autoNumericLocalList.forEach(function (aNObject) {\n aNObject.remove();\n });\n },\n\n /**\n * Execute the `wipe()` method on each AutoNumeric object in the local AutoNumeric element list\n */\n wipe: function wipe() {\n _this.autoNumericLocalList.forEach(function (aNObject) {\n aNObject.wipe();\n });\n },\n\n /**\n * Execute the `nuke()` method on each AutoNumeric object in the local AutoNumeric element list\n */\n nuke: function nuke() {\n _this.autoNumericLocalList.forEach(function (aNObject) {\n aNObject.nuke();\n });\n },\n\n /**\n * Return `true` if the given AutoNumeric object (or DOM element) is in the local AutoNumeric element list\n *\n * @param {HTMLElement|HTMLInputElement|AutoNumeric} domElementOrAutoNumericObject\n * @returns {*}\n */\n has: function has(domElementOrAutoNumericObject) {\n var result;\n\n if (domElementOrAutoNumericObject instanceof AutoNumeric) {\n result = _this.autoNumericLocalList.has(domElementOrAutoNumericObject.node());\n } else {\n result = _this.autoNumericLocalList.has(domElementOrAutoNumericObject);\n }\n\n return result;\n },\n\n /**\n * Add an existing AutoNumeric object (or DOM element) to the local AutoNumeric element list, using the DOM element as the key.\n * This manages the case where `addObject` is used on an AutoNumeric object that already has multiple elements in its local list.\n *\n * @param {HTMLElement|HTMLInputElement|AutoNumeric} domElementOrAutoNumericObject\n */\n addObject: function addObject(domElementOrAutoNumericObject) {\n // Start with the same data, whatever the user passed as arguments\n var domElement;\n var otherAutoNumericObject;\n\n if (domElementOrAutoNumericObject instanceof AutoNumeric) {\n domElement = domElementOrAutoNumericObject.node();\n otherAutoNumericObject = domElementOrAutoNumericObject;\n } else {\n domElement = domElementOrAutoNumericObject;\n otherAutoNumericObject = AutoNumeric.getAutoNumericElement(domElement);\n } // Check if the current autoNumeric object has a local list\n\n\n if (!_this._hasLocalList()) {\n _this._createLocalList();\n } // Check if the other autoNumeric object has a local list...\n\n\n var otherANLocalList = otherAutoNumericObject._getLocalList();\n\n if (otherANLocalList.size === 0) {\n // Special case if the other AutoNumeric object has an empty local list, then populate itself to it\n otherAutoNumericObject._createLocalList();\n\n otherANLocalList = otherAutoNumericObject._getLocalList(); // Update the other local list\n }\n\n var mergedLocalLists;\n\n if (otherANLocalList instanceof Map) {\n // ...If it does, merge the local lists together\n mergedLocalLists = AutoNumericHelper.mergeMaps(_this._getLocalList(), otherANLocalList);\n } else {\n // ...If not, just set the current local list onto the other AutoNumeric object\n // We need to specify the AutoNumeric object, otherwise the `_addToLocalList` function would not correctly add the AutoNumeric object since we would not have a reference to it, but a reference to the current AutoNumeric object on which is called this method.\n _this._addToLocalList(domElement, otherAutoNumericObject);\n\n mergedLocalLists = _this._getLocalList();\n } // Update the resulting list, on all the objects of that local list (so that we can indifferently use `init()` on any object belonging to that list)\n\n\n mergedLocalLists.forEach(function (aNObject) {\n aNObject._setLocalList(mergedLocalLists);\n });\n },\n\n /**\n * Remove the given AutoNumeric object (or DOM element) from the local AutoNumeric element list, using the DOM element as the key.\n * If this function attempts to remove the current AutoNumeric object from the local list, a warning is shown, but the deletion is still done.\n *\n * Special cases :\n * - If the current object removes itself, then it's removed from the shared local list, then a new empty local list is used/created\n * - If another object remove this object, then a local list with only this object is used/created\n *\n * @param {HTMLElement|HTMLInputElement|AutoNumeric} domElementOrAutoNumericObject\n * @param {boolean} keepCurrentANObject If set to `false`, then the function will also remove the current AutoNumeric object if asked, otherwise it will ignore it and print a warning message\n */\n removeObject: function removeObject(domElementOrAutoNumericObject) {\n var keepCurrentANObject = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n // Start with the same data, whatever the user passed as arguments\n var domElement;\n var otherAutoNumericObject;\n\n if (domElementOrAutoNumericObject instanceof AutoNumeric) {\n domElement = domElementOrAutoNumericObject.node();\n otherAutoNumericObject = domElementOrAutoNumericObject;\n } else {\n domElement = domElementOrAutoNumericObject;\n otherAutoNumericObject = AutoNumeric.getAutoNumericElement(domElement);\n } // Remove the other object from the local list\n\n\n var initialCompleteLocalList = _this.autoNumericLocalList;\n\n _this.autoNumericLocalList[\"delete\"](domElement); // Update the local list for all objects in it\n\n\n initialCompleteLocalList.forEach(function (aNObject) {\n aNObject._setLocalList(_this.autoNumericLocalList);\n });\n\n if (!keepCurrentANObject && domElement === _this.node()) {\n // This object is removed by itself\n // Empty the object local list\n otherAutoNumericObject._setLocalList(new Map());\n } else {\n // This object is removed by another object\n // Set the local list for the removed object, with only this object in it\n otherAutoNumericObject._createLocalList();\n }\n },\n\n /**\n * Remove all elements from the shared list, effectively emptying it.\n * This is the equivalent of calling `detach()` on each of its elements.\n *\n * @param {boolean} keepEachANObjectInItsOwnList If set to `true`, then instead of completely emptying the local list of each AutoNumeric objects, each one of those keeps itself in its own local list\n */\n empty: function empty() {\n var keepEachANObjectInItsOwnList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n var initialCompleteLocalList = _this.autoNumericLocalList; // Update the local list for all objects in it\n\n initialCompleteLocalList.forEach(function (aNObject) {\n if (keepEachANObjectInItsOwnList) {\n aNObject._createLocalList();\n } else {\n aNObject._setLocalList(new Map());\n }\n });\n },\n\n /**\n * Return an array containing all the AutoNumeric DOM elements that have been initialized by each other\n *\n * @returns {Array}\n */\n elements: function elements() {\n var result = [];\n\n _this.autoNumericLocalList.forEach(function (aNObject) {\n result.push(aNObject.node());\n });\n\n return result;\n },\n\n /**\n * Return the `Map` object directly\n * @returns {Map}\n */\n getList: function getList() {\n return _this.autoNumericLocalList;\n },\n\n /**\n * Return the number of element in the local AutoNumeric element list\n * @returns {number}\n */\n size: function size() {\n return _this.autoNumericLocalList.size;\n }\n }; // Create the functions that will allow to change each setting one by one\n\n /**\n * For each options, we define if we need to reformat the element content (does changing the options should change the way its value is displayed?).\n * If yes, then we use the `update()` for force a reformat, otherwise, we just update the `settings` object.\n */\n\n this.options = {\n /**\n * Reset any options set previously, by overwriting them with the default settings\n *\n * @returns {AutoNumeric}\n */\n reset: function reset() {\n //TODO Add a `settings` parameter so that the user can reset to a specific set of settings. This is different than update since it drops any non-default settings before using those new settings.\n _this.settings = {\n rawValue: _this.defaultRawValue\n }; // Here we pass the default rawValue in order to prevent showing a warning that we try to set an `undefined` value\n\n _this.update(AutoNumeric.defaultSettings);\n\n return _this;\n },\n allowDecimalPadding: function allowDecimalPadding(_allowDecimalPadding) {\n _this.update({\n allowDecimalPadding: _allowDecimalPadding\n });\n\n return _this;\n },\n alwaysAllowDecimalCharacter: function alwaysAllowDecimalCharacter(_alwaysAllowDecimalCharacter) {\n //FIXME Test this\n _this.update({\n alwaysAllowDecimalCharacter: _alwaysAllowDecimalCharacter\n });\n\n return _this;\n },\n caretPositionOnFocus: function caretPositionOnFocus(_caretPositionOnFocus) {\n //FIXME test this\n _this.settings.caretPositionOnFocus = _caretPositionOnFocus;\n return _this;\n },\n createLocalList: function createLocalList(_createLocalList2) {\n _this.settings.createLocalList = _createLocalList2; // Delete the local list when this is set to `false`, create it if this is set to `true` and there is not pre-existing list\n\n if (_this.settings.createLocalList) {\n if (!_this._hasLocalList()) {\n _this._createLocalList();\n }\n } else {\n _this._deleteLocalList();\n }\n\n return _this;\n },\n currencySymbol: function currencySymbol(_currencySymbol) {\n _this.update({\n currencySymbol: _currencySymbol\n });\n\n return _this;\n },\n currencySymbolPlacement: function currencySymbolPlacement(_currencySymbolPlacement) {\n _this.update({\n currencySymbolPlacement: _currencySymbolPlacement\n });\n\n return _this;\n },\n decimalCharacter: function decimalCharacter(_decimalCharacter) {\n _this.update({\n decimalCharacter: _decimalCharacter\n });\n\n return _this;\n },\n decimalCharacterAlternative: function decimalCharacterAlternative(_decimalCharacterAlternative) {\n _this.settings.decimalCharacterAlternative = _decimalCharacterAlternative;\n return _this;\n },\n\n /**\n * Update the decimal places globally, which means this override any previously set number of decimal shown on focus, on blur, or in the raw value.\n *\n * @param {int} decimalPlaces\n * @returns {AutoNumeric}\n */\n decimalPlaces: function decimalPlaces(_decimalPlaces) {\n AutoNumericHelper.warning('Using `options.decimalPlaces()` instead of calling the specific `options.decimalPlacesRawValue()`, `options.decimalPlacesShownOnFocus()` and `options.decimalPlacesShownOnBlur()` methods will reset those options.\\nPlease call the specific methods if you do not want to reset those.', _this.settings.showWarnings);\n\n _this.update({\n decimalPlaces: _decimalPlaces\n });\n\n return _this;\n },\n decimalPlacesRawValue: function decimalPlacesRawValue(_decimalPlacesRawValue) {\n //FIXME test this\n _this.update({\n decimalPlacesRawValue: _decimalPlacesRawValue\n });\n\n return _this;\n },\n decimalPlacesShownOnBlur: function decimalPlacesShownOnBlur(_decimalPlacesShownOnBlur) {\n _this.update({\n decimalPlacesShownOnBlur: _decimalPlacesShownOnBlur\n });\n\n return _this;\n },\n decimalPlacesShownOnFocus: function decimalPlacesShownOnFocus(_decimalPlacesShownOnFocus) {\n _this.update({\n decimalPlacesShownOnFocus: _decimalPlacesShownOnFocus\n });\n\n return _this;\n },\n defaultValueOverride: function defaultValueOverride(_defaultValueOverride) {\n _this.update({\n defaultValueOverride: _defaultValueOverride\n });\n\n return _this;\n },\n digitalGroupSpacing: function digitalGroupSpacing(_digitalGroupSpacing) {\n _this.update({\n digitalGroupSpacing: _digitalGroupSpacing\n });\n\n return _this;\n },\n digitGroupSeparator: function digitGroupSeparator(_digitGroupSeparator) {\n _this.update({\n digitGroupSeparator: _digitGroupSeparator\n });\n\n return _this;\n },\n divisorWhenUnfocused: function divisorWhenUnfocused(_divisorWhenUnfocused) {\n _this.update({\n divisorWhenUnfocused: _divisorWhenUnfocused\n });\n\n return _this;\n },\n emptyInputBehavior: function emptyInputBehavior(_emptyInputBehavior) {\n if (_this.rawValue === null && _emptyInputBehavior !== AutoNumeric.options.emptyInputBehavior[\"null\"]) {\n // Special case : if the current `rawValue` is `null` and the `emptyInputBehavior` is changed to something else than `'null'`, then it makes that `rawValue` invalid.\n // Here we can either prevent the option update and throw an error, or still accept the option update and update the value from `null` to `''`.\n // We cannot keep `rawValue` to `null` since if `emptyInputBehavior` is not set to `null`, lots of function assume `rawValue` is a string.\n AutoNumericHelper.warning(\"You are trying to modify the `emptyInputBehavior` option to something different than `'null'` (\".concat(_emptyInputBehavior, \"), but the element raw value is currently set to `null`. This would result in an invalid `rawValue`. In order to fix that, the element value has been changed to the empty string `''`.\"), _this.settings.showWarnings);\n _this.rawValue = '';\n }\n\n _this.update({\n emptyInputBehavior: _emptyInputBehavior\n });\n\n return _this;\n },\n eventBubbles: function eventBubbles(_eventBubbles) {\n _this.settings.eventBubbles = _eventBubbles;\n return _this;\n },\n eventIsCancelable: function eventIsCancelable(_eventIsCancelable) {\n _this.settings.eventIsCancelable = _eventIsCancelable;\n return _this;\n },\n failOnUnknownOption: function failOnUnknownOption(_failOnUnknownOption) {\n _this.settings.failOnUnknownOption = _failOnUnknownOption; //TODO test this with unit tests\n\n return _this;\n },\n formatOnPageLoad: function formatOnPageLoad(_formatOnPageLoad) {\n _this.settings.formatOnPageLoad = _formatOnPageLoad; //TODO test this with unit tests\n\n return _this;\n },\n formulaMode: function formulaMode(_formulaMode) {\n _this.settings.formulaMode = _formulaMode; //TODO test this with unit tests\n\n return _this;\n },\n historySize: function historySize(_historySize) {\n _this.settings.historySize = _historySize;\n return _this;\n },\n invalidClass: function invalidClass(_invalidClass) {\n _this.settings.invalidClass = _invalidClass; //TODO test this with unit tests\n\n return _this;\n },\n isCancellable: function isCancellable(_isCancellable) {\n _this.settings.isCancellable = _isCancellable; //TODO test this with unit tests\n\n return _this;\n },\n leadingZero: function leadingZero(_leadingZero) {\n _this.update({\n leadingZero: _leadingZero\n });\n\n return _this;\n },\n maximumValue: function maximumValue(_maximumValue) {\n _this.update({\n maximumValue: _maximumValue\n });\n\n return _this;\n },\n minimumValue: function minimumValue(_minimumValue) {\n _this.update({\n minimumValue: _minimumValue\n });\n\n return _this;\n },\n modifyValueOnWheel: function modifyValueOnWheel(_modifyValueOnWheel) {\n _this.settings.modifyValueOnWheel = _modifyValueOnWheel; //TODO test this with unit tests\n\n return _this;\n },\n negativeBracketsTypeOnBlur: function negativeBracketsTypeOnBlur(_negativeBracketsTypeOnBlur) {\n _this.update({\n negativeBracketsTypeOnBlur: _negativeBracketsTypeOnBlur\n });\n\n return _this;\n },\n negativePositiveSignPlacement: function negativePositiveSignPlacement(_negativePositiveSignPlacement) {\n _this.update({\n negativePositiveSignPlacement: _negativePositiveSignPlacement\n });\n\n return _this;\n },\n negativeSignCharacter: function negativeSignCharacter(_negativeSignCharacter) {\n _this.update({\n negativeSignCharacter: _negativeSignCharacter\n });\n\n return _this;\n },\n noEventListeners: function noEventListeners(_noEventListeners) {\n //TODO test this with unit tests\n if (_noEventListeners === AutoNumeric.options.noEventListeners.noEvents && _this.settings.noEventListeners === AutoNumeric.options.noEventListeners.addEvents) {\n // Remove the events once\n _this._removeEventListeners();\n }\n\n _this.update({\n noEventListeners: _noEventListeners\n });\n\n return _this;\n },\n onInvalidPaste: function onInvalidPaste(_onInvalidPaste) {\n _this.settings.onInvalidPaste = _onInvalidPaste; //TODO test this with unit tests\n\n return _this;\n },\n outputFormat: function outputFormat(_outputFormat) {\n _this.settings.outputFormat = _outputFormat;\n return _this;\n },\n overrideMinMaxLimits: function overrideMinMaxLimits(_overrideMinMaxLimits) {\n _this.update({\n overrideMinMaxLimits: _overrideMinMaxLimits\n });\n\n return _this;\n },\n positiveSignCharacter: function positiveSignCharacter(_positiveSignCharacter) {\n _this.update({\n positiveSignCharacter: _positiveSignCharacter\n });\n\n return _this;\n },\n rawValueDivisor: function rawValueDivisor(_rawValueDivisor) {\n _this.update({\n rawValueDivisor: _rawValueDivisor\n });\n\n return _this;\n },\n readOnly: function readOnly(_readOnly) {\n // When changing the readOnly attribute, the raw and formatted values do not change, so no need to call the costly 'update()` method\n _this.settings.readOnly = _readOnly;\n\n _this._setWritePermissions();\n\n return _this;\n },\n roundingMethod: function roundingMethod(_roundingMethod) {\n _this.update({\n roundingMethod: _roundingMethod\n });\n\n return _this;\n },\n saveValueToSessionStorage: function saveValueToSessionStorage(_saveValueToSessionStorage) {\n _this.update({\n saveValueToSessionStorage: _saveValueToSessionStorage\n });\n\n return _this;\n },\n symbolWhenUnfocused: function symbolWhenUnfocused(_symbolWhenUnfocused) {\n _this.update({\n symbolWhenUnfocused: _symbolWhenUnfocused\n });\n\n return _this;\n },\n selectNumberOnly: function selectNumberOnly(_selectNumberOnly) {\n _this.settings.selectNumberOnly = _selectNumberOnly; //TODO test this with unit tests\n\n return _this;\n },\n selectOnFocus: function selectOnFocus(_selectOnFocus) {\n _this.settings.selectOnFocus = _selectOnFocus; //TODO test this with unit tests\n\n return _this;\n },\n serializeSpaces: function serializeSpaces(_serializeSpaces) {\n _this.settings.serializeSpaces = _serializeSpaces; //TODO test this with unit tests\n\n return _this;\n },\n showOnlyNumbersOnFocus: function showOnlyNumbersOnFocus(_showOnlyNumbersOnFocus) {\n _this.update({\n showOnlyNumbersOnFocus: _showOnlyNumbersOnFocus\n });\n\n return _this;\n },\n showPositiveSign: function showPositiveSign(_showPositiveSign) {\n _this.update({\n showPositiveSign: _showPositiveSign\n });\n\n return _this;\n },\n showWarnings: function showWarnings(_showWarnings) {\n _this.settings.showWarnings = _showWarnings; //TODO test this with unit tests\n\n return _this;\n },\n styleRules: function styleRules(_styleRules) {\n _this.update({\n styleRules: _styleRules\n });\n\n return _this;\n },\n suffixText: function suffixText(_suffixText) {\n _this.update({\n suffixText: _suffixText\n });\n\n return _this;\n },\n unformatOnHover: function unformatOnHover(_unformatOnHover) {\n _this.settings.unformatOnHover = _unformatOnHover; //TODO test this with unit tests\n\n return _this;\n },\n unformatOnSubmit: function unformatOnSubmit(_unformatOnSubmit2) {\n _this.settings.unformatOnSubmit = _unformatOnSubmit2; //TODO test this with unit tests\n\n return _this;\n },\n valuesToStrings: function valuesToStrings(_valuesToStrings) {\n _this.update({\n valuesToStrings: _valuesToStrings\n });\n\n return _this;\n },\n watchExternalChanges: function watchExternalChanges(_watchExternalChanges) {\n //TODO test this with unit tests\n _this.update({\n watchExternalChanges: _watchExternalChanges\n });\n\n return _this;\n },\n wheelOn: function wheelOn(_wheelOn) {\n _this.settings.wheelOn = _wheelOn; //TODO test this with unit tests\n\n return _this;\n },\n wheelStep: function wheelStep(_wheelStep) {\n _this.settings.wheelStep = _wheelStep; //TODO test this with unit tests\n\n return _this;\n }\n }; // Once the autoNumeric element has been initialized, broadcast that message with additional info.\n // Note: When using `AutoNumeric.multiple()`, one event is sent *per* element initialized\n\n this._triggerEvent(AutoNumeric.events.initialized, this.domElement, {\n newValue: AutoNumericHelper.getElementValue(this.domElement),\n newRawValue: this.rawValue,\n error: null,\n aNElement: this\n });\n }\n /**\n * Return the autoNumeric version number (for debugging purpose)\n *\n * @returns {string}\n */\n\n\n _createClass(AutoNumeric, [{\n key: \"_saveInitialValues\",\n\n /**\n * Save the initial element values for later use in the pristine test.\n * Those values are :\n * - the html attribute (ie. ), and\n * - the script `value` (ie. `let domElement.value`)\n *\n * @param {null|number|string} initialValue\n * @private\n */\n value: function _saveInitialValues(initialValue) {\n // Keep the very first initial values (in the html attribute and set by the script). This is needed to check if the element is pristine.\n // Save the html attribute 'value'\n this.initialValueHtmlAttribute = AutoNumericHelper.scientificToDecimal(this.domElement.getAttribute('value'));\n\n if (AutoNumericHelper.isNull(this.initialValueHtmlAttribute)) {\n // Set the default empty value attribute instead of `null`, since if the initial value is null, the empty string is used\n this.initialValueHtmlAttribute = '';\n } // Save the 'script' value\n\n\n this.initialValue = initialValue;\n\n if (AutoNumericHelper.isNull(this.initialValue)) {\n // Same as above\n this.initialValue = '';\n }\n }\n /**\n * Generate all the event listeners for the given DOM element\n * @private\n */\n\n }, {\n key: \"_createEventListeners\",\n value: function _createEventListeners() {\n var _this2 = this;\n\n this.formulaMode = false; // Create references to the event handler functions, so we can then cleanly removes those listeners if needed\n // That would not be possible if we used closures directly in the event handler declarations\n\n this._onFocusInFunc = function (e) {\n _this2._onFocusIn(e);\n };\n\n this._onFocusInAndMouseEnterFunc = function (e) {\n _this2._onFocusInAndMouseEnter(e);\n };\n\n this._onFocusFunc = function () {\n _this2._onFocus();\n };\n\n this._onKeydownFunc = function (e) {\n _this2._onKeydown(e);\n };\n\n this._onKeypressFunc = function (e) {\n _this2._onKeypress(e);\n };\n\n this._onKeyupFunc = function (e) {\n _this2._onKeyup(e);\n };\n\n this._onFocusOutAndMouseLeaveFunc = function (e) {\n _this2._onFocusOutAndMouseLeave(e);\n };\n\n this._onPasteFunc = function (e) {\n _this2._onPaste(e);\n };\n\n this._onWheelFunc = function (e) {\n _this2._onWheel(e);\n };\n\n this._onDropFunc = function (e) {\n _this2._onDrop(e);\n };\n\n this._onKeydownGlobalFunc = function (e) {\n _this2._onKeydownGlobal(e);\n };\n\n this._onKeyupGlobalFunc = function (e) {\n _this2._onKeyupGlobal(e);\n }; // Add the event listeners\n\n\n this.domElement.addEventListener('focusin', this._onFocusInFunc, false);\n this.domElement.addEventListener('focus', this._onFocusInAndMouseEnterFunc, false);\n this.domElement.addEventListener('focus', this._onFocusFunc, false);\n this.domElement.addEventListener('mouseenter', this._onFocusInAndMouseEnterFunc, false);\n this.domElement.addEventListener('keydown', this._onKeydownFunc, false);\n this.domElement.addEventListener('keypress', this._onKeypressFunc, false);\n this.domElement.addEventListener('keyup', this._onKeyupFunc, false);\n this.domElement.addEventListener('blur', this._onFocusOutAndMouseLeaveFunc, false);\n this.domElement.addEventListener('mouseleave', this._onFocusOutAndMouseLeaveFunc, false);\n this.domElement.addEventListener('paste', this._onPasteFunc, false);\n this.domElement.addEventListener('wheel', this._onWheelFunc, false);\n this.domElement.addEventListener('drop', this._onDropFunc, false);\n\n this._setupFormListener(); // Keep track if the event listeners have been initialized on this object\n\n\n this.hasEventListeners = true; // Create one global event listener for the keyup event on the document object, which will be shared by all the autoNumeric elements\n\n if (!AutoNumeric._doesGlobalListExists()) {\n document.addEventListener('keydown', this._onKeydownGlobalFunc, false);\n document.addEventListener('keyup', this._onKeyupGlobalFunc, false);\n }\n }\n /**\n * Remove all the autoNumeric-related event listeners for the given DOM element\n * @private\n */\n\n }, {\n key: \"_removeEventListeners\",\n value: function _removeEventListeners() {\n this.domElement.removeEventListener('focusin', this._onFocusInFunc, false);\n this.domElement.removeEventListener('focus', this._onFocusInAndMouseEnterFunc, false);\n this.domElement.removeEventListener('focus', this._onFocusFunc, false);\n this.domElement.removeEventListener('mouseenter', this._onFocusInAndMouseEnterFunc, false);\n this.domElement.removeEventListener('blur', this._onFocusOutAndMouseLeaveFunc, false);\n this.domElement.removeEventListener('mouseleave', this._onFocusOutAndMouseLeaveFunc, false);\n this.domElement.removeEventListener('keydown', this._onKeydownFunc, false);\n this.domElement.removeEventListener('keypress', this._onKeypressFunc, false);\n this.domElement.removeEventListener('keyup', this._onKeyupFunc, false);\n this.domElement.removeEventListener('paste', this._onPasteFunc, false);\n this.domElement.removeEventListener('wheel', this._onWheelFunc, false);\n this.domElement.removeEventListener('drop', this._onDropFunc, false);\n\n this._removeFormListener(); // Keep track if the event listeners have been initialized on this object\n\n\n this.hasEventListeners = false;\n document.removeEventListener('keydown', this._onKeydownGlobalFunc, false);\n document.removeEventListener('keyup', this._onKeyupGlobalFunc, false);\n }\n /**\n * Toggle the event listeners according to the `noEventListeners` option, if those were not activated/deactivated before\n * @private\n */\n\n }, {\n key: \"_updateEventListeners\",\n value: function _updateEventListeners() {\n if (!this.settings.noEventListeners && !this.hasEventListeners) {\n // Special case where an update is done on an element that did not activate its event listeners in the first place\n // ie. when an element is first created with `contenteditable=\"false\"`, then an update is done with `anElement.french()`\n this._createEventListeners();\n }\n\n if (this.settings.noEventListeners && this.hasEventListeners) {\n this._removeEventListeners();\n }\n }\n /**\n * Mark the parent