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B,yBAAoB3a,EAAWkF,EAAE,EACxCvH,KAAKyN,YAAYiL,YAAc,SAACnR,GAAuB,OACrDgU,EAAK6B,iCAAiC7V,EAAE,IAtB1CqE,SAASxB,YAAc,SAAC7C,GAAuB,OAC7CgU,EAAKyB,yBAAoB3a,EAAWkF,EAAE,EACxCvH,KAAKyN,YAAY9D,cAAgB,SAACpC,GAAuB,OACvDgU,EAAK6B,iCAAiC7V,EAAE,GAyB5CvH,KAAKwZ,SAET,I,4FAAC,CA3/DiB,GA8/DpB,IElhEA,I,SVQA,E","sources":["webpack://SimpleKeyboard/webpack/universalModuleDefinition","webpack://SimpleKeyboard/webpack/bootstrap","webpack://SimpleKeyboard/webpack/runtime/define property getters","webpack://SimpleKeyboard/webpack/runtime/hasOwnProperty shorthand","webpack://SimpleKeyboard/webpack/runtime/make namespace object","webpack://SimpleKeyboard/./src/lib/services/Utilities.ts","webpack://SimpleKeyboard/./src/lib/services/PhysicalKeyboard.ts","webpack://SimpleKeyboard/./src/lib/components/CandidateBox.ts","webpack://SimpleKeyboard/./src/lib/components/Keyboard.ts","webpack://SimpleKeyboard/./src/lib/services/KeyboardLayout.ts","webpack://SimpleKeyboard/./src/lib/index.modern.ts"],"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[\"SimpleKeyboard\"] = factory();\n\telse\n\t\troot[\"SimpleKeyboard\"] = factory();\n})(this, function() {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { KeyboardInput } from \"./../interfaces\";\nimport { KeyboardOptions, UtilitiesParams } from \"../interfaces\";\n\n/**\n * Utility Service\n */\nclass Utilities {\n getOptions: () => KeyboardOptions;\n getCaretPosition: () => number | null;\n getCaretPositionEnd: () => number | null;\n dispatch: any;\n maxLengthReached!: boolean;\n\n /**\n * Creates an instance of the Utility service\n */\n constructor({\n getOptions,\n getCaretPosition,\n getCaretPositionEnd,\n dispatch,\n }: UtilitiesParams) {\n this.getOptions = getOptions;\n this.getCaretPosition = getCaretPosition;\n this.getCaretPositionEnd = getCaretPositionEnd;\n this.dispatch = dispatch;\n\n /**\n * Bindings\n */\n Utilities.bindMethods(Utilities, this);\n }\n\n /**\n * Retrieve button type\n *\n * @param {string} button The button's layout name\n * @return {string} The button type\n */\n getButtonType(button: string): string {\n return button.includes(\"{\") && button.includes(\"}\") && button !== \"{//}\"\n ? \"functionBtn\"\n : \"standardBtn\";\n }\n\n /**\n * Adds default classes to a given button\n *\n * @param {string} button The button's layout name\n * @return {string} The classes to be added to the button\n */\n getButtonClass(button: string): string {\n const buttonTypeClass = this.getButtonType(button);\n const buttonWithoutBraces = button.replace(\"{\", \"\").replace(\"}\", \"\");\n let buttonNormalized = \"\";\n\n if (buttonTypeClass !== \"standardBtn\")\n buttonNormalized = ` hg-button-${buttonWithoutBraces}`;\n\n return `hg-${buttonTypeClass}${buttonNormalized}`;\n }\n\n /**\n * Default button display labels\n */\n getDefaultDiplay() {\n return {\n \"{bksp}\": \"backspace\",\n \"{backspace}\": \"backspace\",\n \"{enter}\": \"< enter\",\n \"{shift}\": \"shift\",\n \"{shiftleft}\": \"shift\",\n \"{shiftright}\": \"shift\",\n \"{alt}\": \"alt\",\n \"{s}\": \"shift\",\n \"{tab}\": \"tab\",\n \"{lock}\": \"caps\",\n \"{capslock}\": \"caps\",\n \"{accept}\": \"Submit\",\n \"{space}\": \" \",\n \"{//}\": \" \",\n \"{esc}\": \"esc\",\n \"{escape}\": \"esc\",\n \"{f1}\": \"f1\",\n \"{f2}\": \"f2\",\n \"{f3}\": \"f3\",\n \"{f4}\": \"f4\",\n \"{f5}\": \"f5\",\n \"{f6}\": \"f6\",\n \"{f7}\": \"f7\",\n \"{f8}\": \"f8\",\n \"{f9}\": \"f9\",\n \"{f10}\": \"f10\",\n \"{f11}\": \"f11\",\n \"{f12}\": \"f12\",\n \"{numpaddivide}\": \"/\",\n \"{numlock}\": \"lock\",\n \"{arrowup}\": \"↑\",\n \"{arrowleft}\": \"←\",\n \"{arrowdown}\": \"↓\",\n \"{arrowright}\": \"→\",\n \"{prtscr}\": \"print\",\n \"{scrolllock}\": \"scroll\",\n \"{pause}\": \"pause\",\n \"{insert}\": \"ins\",\n \"{home}\": \"home\",\n \"{pageup}\": \"up\",\n \"{delete}\": \"del\",\n \"{forwarddelete}\": \"del\",\n \"{end}\": \"end\",\n \"{pagedown}\": \"down\",\n \"{numpadmultiply}\": \"*\",\n \"{numpadsubtract}\": \"-\",\n \"{numpadadd}\": \"+\",\n \"{numpadenter}\": \"enter\",\n \"{period}\": \".\",\n \"{numpaddecimal}\": \".\",\n \"{numpad0}\": \"0\",\n \"{numpad1}\": \"1\",\n \"{numpad2}\": \"2\",\n \"{numpad3}\": \"3\",\n \"{numpad4}\": \"4\",\n \"{numpad5}\": \"5\",\n \"{numpad6}\": \"6\",\n \"{numpad7}\": \"7\",\n \"{numpad8}\": \"8\",\n \"{numpad9}\": \"9\",\n };\n }\n /**\n * Returns the display (label) name for a given button\n *\n * @param {string} button The button's layout name\n * @param {object} display The provided display option\n * @param {boolean} mergeDisplay Whether the provided param value should be merged with the default one.\n */\n getButtonDisplayName(\n button: string,\n display: KeyboardOptions[\"display\"],\n mergeDisplay = false\n ) {\n if (mergeDisplay) {\n display = Object.assign({}, this.getDefaultDiplay(), display);\n } else {\n display = display || this.getDefaultDiplay();\n }\n\n return display[button] || button;\n }\n\n /**\n * Returns the updated input resulting from clicking a given button\n *\n * @param {string} button The button's layout name\n * @param {string} input The input string\n * @param {number} caretPos The cursor's current position\n * @param {number} caretPosEnd The cursor's current end position\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\n */\n getUpdatedInput(\n button: string,\n input: string,\n caretPos: any,\n caretPosEnd = caretPos,\n moveCaret = false\n ) {\n const options = this.getOptions();\n const commonParams: [number | undefined, number | undefined, boolean] = [\n caretPos,\n caretPosEnd,\n moveCaret,\n ];\n\n let output = input;\n\n if (\n (button === \"{bksp}\" || button === \"{backspace}\") &&\n output.length > 0\n ) {\n output = this.removeAt(output, ...commonParams);\n } else if (\n (button === \"{delete}\" || button === \"{forwarddelete}\") &&\n output.length > 0\n ) {\n output = this.removeForwardsAt(output, ...commonParams);\n } else if (button === \"{space}\")\n output = this.addStringAt(output, \" \", ...commonParams);\n else if (\n button === \"{tab}\" &&\n !(\n typeof options.tabCharOnTab === \"boolean\" &&\n options.tabCharOnTab === false\n )\n ) {\n output = this.addStringAt(output, \"\\t\", ...commonParams);\n } else if (\n (button === \"{enter}\" || button === \"{numpadenter}\") &&\n options.newLineOnEnter\n )\n output = this.addStringAt(output, \"\\n\", ...commonParams);\n else if (\n button.includes(\"numpad\") &&\n Number.isInteger(Number(button[button.length - 2]))\n ) {\n output = this.addStringAt(\n output,\n button[button.length - 2],\n ...commonParams\n );\n } else if (button === \"{numpaddivide}\")\n output = this.addStringAt(output, \"/\", ...commonParams);\n else if (button === \"{numpadmultiply}\")\n output = this.addStringAt(output, \"*\", ...commonParams);\n else if (button === \"{numpadsubtract}\")\n output = this.addStringAt(output, \"-\", ...commonParams);\n else if (button === \"{numpadadd}\")\n output = this.addStringAt(output, \"+\", ...commonParams);\n else if (button === \"{numpaddecimal}\")\n output = this.addStringAt(output, \".\", ...commonParams);\n else if (button === \"{\" || button === \"}\")\n output = this.addStringAt(output, button, ...commonParams);\n else if (!button.includes(\"{\") && !button.includes(\"}\"))\n output = this.addStringAt(output, button, ...commonParams);\n\n if(options.debug){\n console.log(\"Input will be: \"+ output);\n }\n\n return output;\n }\n\n /**\n * Moves the cursor position by a given amount\n *\n * @param {number} length Represents by how many characters the input should be moved\n * @param {boolean} minus Whether the cursor should be moved to the left or not.\n */\n updateCaretPos(length: number, minus = false) {\n const newCaretPos = this.updateCaretPosAction(length, minus);\n\n this.dispatch((instance: any) => {\n instance.setCaretPosition(newCaretPos);\n });\n }\n\n /**\n * Action method of updateCaretPos\n *\n * @param {number} length Represents by how many characters the input should be moved\n * @param {boolean} minus Whether the cursor should be moved to the left or not.\n */\n updateCaretPosAction(length: number, minus = false) {\n const options = this.getOptions();\n let caretPosition = this.getCaretPosition();\n\n if (caretPosition != null) {\n if (minus) {\n if (caretPosition > 0) caretPosition = caretPosition - length;\n } else {\n caretPosition = caretPosition + length;\n }\n }\n\n if (options.debug) {\n console.log(\"Caret at:\", caretPosition);\n }\n\n return caretPosition;\n }\n\n /**\n * Adds a string to the input at a given position\n *\n * @param {string} source The source input\n * @param {string} str The string to add\n * @param {number} position The (cursor) position where the string should be added\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\n */\n addStringAt(\n source: string,\n str: string,\n position = source.length,\n positionEnd = source.length,\n moveCaret = false\n ) {\n let output;\n\n if (!position && position !== 0) {\n output = source + str;\n } else {\n output = [source.slice(0, position), str, source.slice(positionEnd)].join(\n \"\"\n );\n\n /**\n * Avoid caret position change when maxLength is set\n */\n if (!this.isMaxLengthReached()) {\n if (moveCaret) this.updateCaretPos(str.length);\n }\n }\n\n return output;\n }\n\n /**\n * Check whether the button is a standard button\n */\n isStandardButton = (button: string) =>\n button && !(button[0] === \"{\" && button[button.length - 1] === \"}\");\n\n /**\n * Removes an amount of characters before a given position\n *\n * @param {string} source The source input\n * @param {number} position The (cursor) position from where the characters should be removed\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\n */\n removeAt(\n source: string,\n position = source.length,\n positionEnd = source.length,\n moveCaret = false\n ) {\n if (position === 0 && positionEnd === 0) {\n return source;\n }\n\n let output;\n\n if (position === positionEnd) {\n let prevTwoChars;\n let emojiMatched;\n const emojiMatchedReg = /([\\uD800-\\uDBFF][\\uDC00-\\uDFFF])/g;\n\n /**\n * Emojis are made out of two characters, so we must take a custom approach to trim them.\n * For more info: https://mathiasbynens.be/notes/javascript-unicode\n */\n if (position && position >= 0) {\n prevTwoChars = source.substring(position - 2, position);\n emojiMatched = prevTwoChars.match(emojiMatchedReg);\n\n if (emojiMatched) {\n output = source.substr(0, position - 2) + source.substr(position);\n if (moveCaret) this.updateCaretPos(2, true);\n } else {\n output = source.substr(0, position - 1) + source.substr(position);\n if (moveCaret) this.updateCaretPos(1, true);\n }\n } else {\n prevTwoChars = source.slice(-2);\n emojiMatched = prevTwoChars.match(emojiMatchedReg);\n\n if (emojiMatched) {\n output = source.slice(0, -2);\n if (moveCaret) this.updateCaretPos(2, true);\n } else {\n output = source.slice(0, -1);\n if (moveCaret) this.updateCaretPos(1, true);\n }\n }\n } else {\n output = source.slice(0, position) + source.slice(positionEnd);\n if (moveCaret) {\n this.dispatch((instance: any) => {\n instance.setCaretPosition(position);\n });\n }\n }\n\n return output;\n }\n\n /**\n * Removes an amount of characters after a given position\n *\n * @param {string} source The source input\n * @param {number} position The (cursor) position from where the characters should be removed\n */\n removeForwardsAt(\n source: string,\n position: number = source.length,\n positionEnd: number = source.length,\n moveCaret = false\n ) {\n if (!source?.length || position === null) {\n return source;\n }\n\n let output;\n\n if (position === positionEnd) {\n const emojiMatchedReg = /([\\uD800-\\uDBFF][\\uDC00-\\uDFFF])/g;\n\n /**\n * Emojis are made out of two characters, so we must take a custom approach to trim them.\n * For more info: https://mathiasbynens.be/notes/javascript-unicode\n */\n const nextTwoChars = source.substring(position, position + 2);\n const emojiMatched = nextTwoChars.match(emojiMatchedReg);\n\n if (emojiMatched) {\n output = source.substr(0, position) + source.substr(position + 2);\n } else {\n output = source.substr(0, position) + source.substr(position + 1);\n }\n } else {\n output = source.slice(0, position) + source.slice(positionEnd);\n if (moveCaret) {\n this.dispatch((instance: any) => {\n instance.setCaretPosition(position);\n });\n }\n }\n\n return output;\n }\n\n /**\n * Determines whether the maxLength has been reached. This function is called when the maxLength option it set.\n *\n * @param {object} inputObj\n * @param {string} updatedInput\n */\n handleMaxLength(inputObj: KeyboardInput, updatedInput: string) {\n const options = this.getOptions();\n const maxLength = options.maxLength;\n const currentInput = inputObj[options.inputName || \"default\"];\n const condition = updatedInput.length - 1 >= maxLength;\n\n if (\n /**\n * If pressing this button won't add more characters\n * We exit out of this limiter function\n */\n updatedInput.length <= currentInput.length\n ) {\n return false;\n }\n\n if (Number.isInteger(maxLength)) {\n if (options.debug) {\n console.log(\"maxLength (num) reached:\", condition);\n }\n\n if (condition) {\n /**\n * @type {boolean} Boolean value that shows whether maxLength has been reached\n */\n this.maxLengthReached = true;\n return true;\n } else {\n this.maxLengthReached = false;\n return false;\n }\n }\n\n if (typeof maxLength === \"object\") {\n const condition =\n updatedInput.length - 1 >= maxLength[options.inputName || \"default\"];\n\n if (options.debug) {\n console.log(\"maxLength (obj) reached:\", condition);\n }\n\n if (condition) {\n this.maxLengthReached = true;\n return true;\n } else {\n this.maxLengthReached = false;\n return false;\n }\n }\n }\n\n /**\n * Gets the current value of maxLengthReached\n */\n isMaxLengthReached() {\n return Boolean(this.maxLengthReached);\n }\n\n /**\n * Determines whether a touch device is being used\n */\n isTouchDevice() {\n return \"ontouchstart\" in window || navigator.maxTouchPoints;\n }\n\n /**\n * Determines whether pointer events are supported\n */\n pointerEventsSupported() {\n return !!window.PointerEvent;\n }\n\n /**\n * Bind all methods in a given class\n */\n\n static bindMethods(myClass: any, instance: any) {\n // eslint-disable-next-line no-unused-vars\n for (const myMethod of Object.getOwnPropertyNames(myClass.prototype)) {\n const excludeMethod =\n myMethod === \"constructor\" || myMethod === \"bindMethods\";\n if (!excludeMethod) {\n instance[myMethod] = instance[myMethod].bind(instance);\n }\n }\n }\n\n /**\n * Transforms an arbitrary string to camelCase\n *\n * @param {string} str The string to transform.\n */\n camelCase(str: string): string {\n if (!str) return \"\";\n\n return str\n .toLowerCase()\n .trim()\n .split(/[.\\-_\\s]/g)\n .reduce((str, word) =>\n word.length ? str + word[0].toUpperCase() + word.slice(1) : str\n );\n }\n\n /**\n * Split array into chunks\n */\n chunkArray(arr: T[], size: number): T[][] {\n return [...Array(Math.ceil(arr.length / size))].map((_, i) =>\n arr.slice(size * i, size + size * i)\n );\n }\n\n /**\n * Escape regex input\n */\n escapeRegex(str: string) {\n return str.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n }\n\n /**\n * Calculate caret position offset when using rtl option\n */\n getRtlOffset(index: number, input: string) {\n let newIndex = index;\n const startMarkerIndex = input.indexOf(\"\\u202B\");\n const endMarkerIndex = input.indexOf(\"\\u202C\");\n\n if(startMarkerIndex < index && startMarkerIndex != -1){ newIndex--; }\n if(endMarkerIndex < index && startMarkerIndex != -1){ newIndex--; }\n\n return newIndex < 0 ? 0 : newIndex;\n }\n\n /**\n * Reusable empty function\n */\n static noop = () => {};\n}\n\nexport default Utilities;\n","import { KeyboardOptions, PhysicalKeyboardParams } from \"../interfaces\";\nimport Utilities from \"../services/Utilities\";\n\n/**\n * Physical Keyboard Service\n */\nclass PhysicalKeyboard {\n getOptions: () => KeyboardOptions;\n dispatch: any;\n\n /**\n * Creates an instance of the PhysicalKeyboard service\n */\n constructor({ dispatch, getOptions }: PhysicalKeyboardParams) {\n /**\n * @type {object} A simple-keyboard instance\n */\n this.dispatch = dispatch;\n this.getOptions = getOptions;\n\n /**\n * Bindings\n */\n Utilities.bindMethods(PhysicalKeyboard, this);\n }\n\n handleHighlightKeyDown(e: KeyboardEvent) {\n const options = this.getOptions();\n\n if(options.physicalKeyboardHighlightPreventDefault && this.isModifierKey(e)){\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n\n const buttonPressed = this.getSimpleKeyboardLayoutKey(e);\n\n this.dispatch((instance: any) => {\n const standardButtonPressed = instance.getButtonElement(buttonPressed);\n const functionButtonPressed = instance.getButtonElement(\n `{${buttonPressed}}`\n );\n let buttonDOM;\n let buttonName: string;\n\n if (standardButtonPressed) {\n buttonDOM = standardButtonPressed;\n buttonName = buttonPressed;\n } else if (functionButtonPressed) {\n buttonDOM = functionButtonPressed;\n buttonName = `{${buttonPressed}}`;\n } else {\n return;\n }\n\n const applyButtonStyle = (buttonElement: HTMLElement) => {\n buttonElement.style.background =\n options.physicalKeyboardHighlightBgColor || \"#dadce4\";\n buttonElement.style.color =\n options.physicalKeyboardHighlightTextColor || \"black\";\n }\n\n if (buttonDOM) {\n if(Array.isArray(buttonDOM)){\n buttonDOM.forEach(buttonElement => applyButtonStyle(buttonElement));\n\n // Even though we have an array of buttons, we just want to press one of them\n if (options.physicalKeyboardHighlightPress) {\n if (options.physicalKeyboardHighlightPressUsePointerEvents) {\n buttonDOM[0]?.onpointerdown?.(e);\n } else if (options.physicalKeyboardHighlightPressUseClick) {\n buttonDOM[0]?.click();\n } else {\n instance.handleButtonClicked(buttonName, e);\n }\n }\n } else {\n applyButtonStyle(buttonDOM);\n\n if (options.physicalKeyboardHighlightPress) {\n if (options.physicalKeyboardHighlightPressUsePointerEvents) {\n buttonDOM?.onpointerdown?.(e);\n } else if (options.physicalKeyboardHighlightPressUseClick) {\n buttonDOM.click();\n } else {\n instance.handleButtonClicked(buttonName, e);\n }\n }\n }\n }\n });\n }\n\n handleHighlightKeyUp(e: KeyboardEvent) {\n const options = this.getOptions();\n\n if(options.physicalKeyboardHighlightPreventDefault && this.isModifierKey(e)){\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n \n const buttonPressed = this.getSimpleKeyboardLayoutKey(e);\n\n this.dispatch((instance: any) => {\n const buttonDOM =\n instance.getButtonElement(buttonPressed) ||\n instance.getButtonElement(`{${buttonPressed}}`);\n\n const applyButtonStyle = (buttonElement: HTMLElement) => {\n if(buttonElement.removeAttribute){\n buttonElement.removeAttribute(\"style\");\n }\n };\n\n if (buttonDOM) {\n if(Array.isArray(buttonDOM)){\n buttonDOM.forEach(buttonElement => applyButtonStyle(buttonElement));\n\n // Even though we have an array of buttons, we just want to press one of them\n if (options.physicalKeyboardHighlightPressUsePointerEvents) {\n buttonDOM[0]?.onpointerup?.(e);\n }\n } else {\n applyButtonStyle(buttonDOM);\n\n if (options.physicalKeyboardHighlightPressUsePointerEvents) {\n buttonDOM?.onpointerup?.(e);\n }\n }\n }\n });\n }\n\n /**\n * Transforms a KeyboardEvent's \"key.code\" string into a simple-keyboard layout format\n * @param {object} e The KeyboardEvent\n */\n getSimpleKeyboardLayoutKey(e: KeyboardEvent) {\n let output = \"\";\n const keyId = e.code || e.key || this.keyCodeToKey(e?.keyCode);\n\n if (\n keyId?.includes(\"Numpad\") ||\n keyId?.includes(\"Shift\") ||\n keyId?.includes(\"Space\") ||\n keyId?.includes(\"Backspace\") ||\n keyId?.includes(\"Control\") ||\n keyId?.includes(\"Alt\") ||\n keyId?.includes(\"Meta\")\n ) {\n output = e.code || \"\";\n } else {\n output = e.key || this.keyCodeToKey(e?.keyCode) || \"\";\n }\n\n return output.length > 1 ? output?.toLowerCase() : output;\n }\n\n /**\n * Retrieve key from keyCode\n */\n keyCodeToKey(keyCode: number): string {\n return {\n 8: \"Backspace\",\n 9: \"Tab\",\n 13: \"Enter\",\n 16: \"Shift\",\n 17: \"Ctrl\",\n 18: \"Alt\",\n 19: \"Pause\",\n 20: \"CapsLock\",\n 27: \"Esc\",\n 32: \"Space\",\n 33: \"PageUp\",\n 34: \"PageDown\",\n 35: \"End\",\n 36: \"Home\",\n 37: \"ArrowLeft\",\n 38: \"ArrowUp\",\n 39: \"ArrowRight\",\n 40: \"ArrowDown\",\n 45: \"Insert\",\n 46: \"Delete\",\n 48: \"0\",\n 49: \"1\",\n 50: \"2\",\n 51: \"3\",\n 52: \"4\",\n 53: \"5\",\n 54: \"6\",\n 55: \"7\",\n 56: \"8\",\n 57: \"9\",\n 65: \"A\",\n 66: \"B\",\n 67: \"C\",\n 68: \"D\",\n 69: \"E\",\n 70: \"F\",\n 71: \"G\",\n 72: \"H\",\n 73: \"I\",\n 74: \"J\",\n 75: \"K\",\n 76: \"L\",\n 77: \"M\",\n 78: \"N\",\n 79: \"O\",\n 80: \"P\",\n 81: \"Q\",\n 82: \"R\",\n 83: \"S\",\n 84: \"T\",\n 85: \"U\",\n 86: \"V\",\n 87: \"W\",\n 88: \"X\",\n 89: \"Y\",\n 90: \"Z\",\n 91: \"Meta\",\n 96: \"Numpad0\",\n 97: \"Numpad1\",\n 98: \"Numpad2\",\n 99: \"Numpad3\",\n 100: \"Numpad4\",\n 101: \"Numpad5\",\n 102: \"Numpad6\",\n 103: \"Numpad7\",\n 104: \"Numpad8\",\n 105: \"Numpad9\",\n 106: \"NumpadMultiply\",\n 107: \"NumpadAdd\",\n 109: \"NumpadSubtract\",\n 110: \"NumpadDecimal\",\n 111: \"NumpadDivide\",\n 112: \"F1\",\n 113: \"F2\",\n 114: \"F3\",\n 115: \"F4\",\n 116: \"F5\",\n 117: \"F6\",\n 118: \"F7\",\n 119: \"F8\",\n 120: \"F9\",\n 121: \"F10\",\n 122: \"F11\",\n 123: \"F12\",\n 144: \"NumLock\",\n 145: \"ScrollLock\",\n 186: \";\",\n 187: \"=\",\n 188: \",\",\n 189: \"-\",\n 190: \".\",\n 191: \"/\",\n 192: \"`\",\n 219: \"[\",\n 220: \"\\\\\",\n 221: \"]\",\n 222: \"'\",\n }[keyCode] || \"\";\n }\n\n isModifierKey = (e: KeyboardEvent): boolean => {\n return (\n e.altKey\n || e.ctrlKey\n || e.shiftKey\n || [\"Tab\", \"CapsLock\", \"Esc\", \"ArrowUp\", \"ArrowDown\", \"ArrowLeft\", \"ArrowRight\"].includes(\n e.code || e.key || this.keyCodeToKey(e?.keyCode)\n )\n )\n }\n}\n\nexport default PhysicalKeyboard;\n","import \"./css/CandidateBox.css\";\n\nimport Utilities from \"../services/Utilities\";\nimport {\n CandidateBoxParams,\n CandidateBoxRenderParams,\n CandidateBoxShowParams,\n KeyboardOptions,\n} from \"./../interfaces\";\n\nclass CandidateBox {\n utilities: Utilities;\n options: KeyboardOptions;\n candidateBoxElement!: HTMLDivElement;\n pageIndex = 0;\n pageSize: number;\n\n constructor({ utilities, options }: CandidateBoxParams) {\n this.utilities = utilities;\n this.options = options;\n Utilities.bindMethods(CandidateBox, this);\n this.pageSize = this.utilities.getOptions().layoutCandidatesPageSize || 5;\n }\n\n destroy() {\n if (this.candidateBoxElement) {\n this.candidateBoxElement.remove();\n this.pageIndex = 0;\n }\n }\n\n show({\n candidateValue,\n targetElement,\n onSelect,\n }: CandidateBoxShowParams): void {\n if (!candidateValue || !candidateValue.length) {\n return;\n }\n\n const candidateListPages = this.utilities.chunkArray(\n candidateValue.split(\" \"),\n this.pageSize\n );\n\n this.renderPage({\n candidateListPages,\n targetElement,\n pageIndex: this.pageIndex,\n nbPages: candidateListPages.length,\n onItemSelected: (selectedCandidate: string, e: MouseEvent) => {\n onSelect(selectedCandidate, e);\n this.destroy();\n },\n });\n }\n\n renderPage({\n candidateListPages,\n targetElement,\n pageIndex,\n nbPages,\n onItemSelected,\n }: CandidateBoxRenderParams) {\n // Remove current candidate box, if any\n this.candidateBoxElement?.remove();\n\n // Create candidate box element\n this.candidateBoxElement = document.createElement(\"div\");\n this.candidateBoxElement.className = \"hg-candidate-box\";\n\n // Candidate box list\n const candidateListULElement = document.createElement(\"ul\");\n candidateListULElement.className = \"hg-candidate-box-list\";\n\n // Create Candidate box list items\n candidateListPages[pageIndex].forEach((candidateListItem) => {\n const candidateListLIElement = document.createElement(\"li\");\n const getMouseEvent = () => {\n const mouseEvent = new (this.options.useTouchEvents ? TouchEvent : MouseEvent)(\"click\");\n Object.defineProperty(mouseEvent, \"target\", {\n value: candidateListLIElement,\n });\n return mouseEvent;\n };\n\n candidateListLIElement.className = \"hg-candidate-box-list-item\";\n candidateListLIElement.innerHTML = this.options.display?.[candidateListItem] || candidateListItem;\n\n if(this.options.useTouchEvents) {\n candidateListLIElement.ontouchstart = (e: any) =>\n onItemSelected(candidateListItem, e || getMouseEvent());\n } else {\n candidateListLIElement.onclick = (e = getMouseEvent() as MouseEvent) =>\n onItemSelected(candidateListItem, e);\n }\n\n // Append list item to ul\n candidateListULElement.appendChild(candidateListLIElement);\n });\n\n // Add previous button\n const isPrevBtnElementActive = pageIndex > 0;\n const prevBtnElement = document.createElement(\"div\");\n prevBtnElement.classList.add(\"hg-candidate-box-prev\");\n isPrevBtnElementActive &&\n prevBtnElement.classList.add(\"hg-candidate-box-btn-active\");\n\n const prevBtnElementClickAction = () => {\n if (!isPrevBtnElementActive) return;\n this.renderPage({\n candidateListPages,\n targetElement,\n pageIndex: pageIndex - 1,\n nbPages,\n onItemSelected,\n });\n };\n\n if(this.options.useTouchEvents) {\n prevBtnElement.ontouchstart = prevBtnElementClickAction;\n } else {\n prevBtnElement.onclick = prevBtnElementClickAction;\n }\n \n this.candidateBoxElement.appendChild(prevBtnElement);\n\n // Add elements to container\n this.candidateBoxElement.appendChild(candidateListULElement);\n\n // Add next button\n const isNextBtnElementActive = pageIndex < nbPages - 1;\n const nextBtnElement = document.createElement(\"div\");\n nextBtnElement.classList.add(\"hg-candidate-box-next\");\n isNextBtnElementActive &&\n nextBtnElement.classList.add(\"hg-candidate-box-btn-active\");\n\n const nextBtnElementClickAction = () => {\n if (!isNextBtnElementActive) return;\n this.renderPage({\n candidateListPages,\n targetElement,\n pageIndex: pageIndex + 1,\n nbPages,\n onItemSelected,\n });\n };\n\n if(this.options.useTouchEvents) {\n nextBtnElement.ontouchstart = nextBtnElementClickAction;\n } else {\n nextBtnElement.onclick = nextBtnElementClickAction;\n }\n\n this.candidateBoxElement.appendChild(nextBtnElement);\n\n // Append candidate box to target element\n targetElement.prepend(this.candidateBoxElement);\n }\n}\n\nexport default CandidateBox;\n","import \"./css/Keyboard.css\";\n\n// Services\nimport { getDefaultLayout } from \"../services/KeyboardLayout\";\nimport PhysicalKeyboard from \"../services/PhysicalKeyboard\";\nimport Utilities from \"../services/Utilities\";\nimport {\n KeyboardOptions,\n KeyboardInput,\n KeyboardButtonElements,\n KeyboardHandlerEvent,\n KeyboardElement,\n} from \"../interfaces\";\nimport CandidateBox from \"./CandidateBox\";\n\n/**\n * Root class for simple-keyboard.\n * This class:\n * - Parses the options\n * - Renders the rows and buttons\n * - Handles button functionality\n */\nclass SimpleKeyboard {\n input!: KeyboardInput;\n options!: KeyboardOptions;\n utilities!: Utilities;\n caretPosition!: number | null;\n caretPositionEnd!: number | null;\n keyboardDOM!: KeyboardElement;\n keyboardPluginClasses!: string;\n keyboardDOMClass!: string;\n buttonElements!: KeyboardButtonElements;\n currentInstanceName!: string;\n allKeyboardInstances!: { [key: string]: SimpleKeyboard };\n keyboardInstanceNames!: string[];\n isFirstKeyboardInstance!: boolean;\n physicalKeyboard!: PhysicalKeyboard;\n modules!: { [key: string]: any };\n activeButtonClass!: string;\n holdInteractionTimeout!: number;\n holdTimeout!: number;\n isMouseHold!: boolean;\n initialized!: boolean;\n candidateBox!: CandidateBox | null;\n keyboardRowsDOM!: KeyboardElement;\n defaultName = \"default\";\n activeInputElement: HTMLInputElement | HTMLTextAreaElement | null = null;\n\n /**\n * Creates an instance of SimpleKeyboard\n * @param {Array} params If first parameter is a string, it is considered the container class. The second parameter is then considered the options object. If first parameter is an object, it is considered the options object.\n */\n constructor(\n selectorOrOptions?: string | HTMLDivElement | KeyboardOptions,\n keyboardOptions?: KeyboardOptions\n ) {\n if (typeof window === \"undefined\") return;\n\n const {\n keyboardDOMClass,\n keyboardDOM,\n options = {},\n } = this.handleParams(selectorOrOptions, keyboardOptions);\n\n /**\n * Initializing Utilities\n */\n this.utilities = new Utilities({\n getOptions: this.getOptions,\n getCaretPosition: this.getCaretPosition,\n getCaretPositionEnd: this.getCaretPositionEnd,\n dispatch: this.dispatch,\n });\n\n /**\n * Caret position\n */\n this.caretPosition = null;\n\n /**\n * Caret position end\n */\n this.caretPositionEnd = null;\n\n /**\n * Processing options\n */\n this.keyboardDOM = keyboardDOM;\n\n /**\n * @type {object}\n * @property {object} layout Modify the keyboard layout.\n * @property {string} layoutName Specifies which layout should be used.\n * @property {object} display Replaces variable buttons (such as {bksp}) with a human-friendly name (e.g.: “backspace”).\n * @property {boolean} mergeDisplay By default, when you set the display property, you replace the default one. This setting merges them instead.\n * @property {string} theme A prop to add your own css classes to the keyboard wrapper. You can add multiple classes separated by a space.\n * @property {array} buttonTheme A prop to add your own css classes to one or several buttons.\n * @property {array} buttonAttributes A prop to add your own attributes to one or several buttons.\n * @property {boolean} debug Runs a console.log every time a key is pressed. Displays the buttons pressed and the current input.\n * @property {boolean} newLineOnEnter Specifies whether clicking the “ENTER” button will input a newline (\\n) or not.\n * @property {boolean} tabCharOnTab Specifies whether clicking the “TAB” button will input a tab character (\\t) or not.\n * @property {string} inputName Allows you to use a single simple-keyboard instance for several inputs.\n * @property {number} maxLength Restrains all of simple-keyboard inputs to a certain length. This should be used in addition to the input element’s maxlengthattribute.\n * @property {object} maxLength Restrains simple-keyboard’s individual inputs to a certain length. This should be used in addition to the input element’s maxlengthattribute.\n * @property {boolean} syncInstanceInputs When set to true, this option synchronizes the internal input of every simple-keyboard instance.\n * @property {boolean} physicalKeyboardHighlight Enable highlighting of keys pressed on physical keyboard.\n * @property {boolean} physicalKeyboardHighlightPress Presses keys highlighted by physicalKeyboardHighlight\n * @property {string} physicalKeyboardHighlightTextColor Define the text color that the physical keyboard highlighted key should have.\n * @property {string} physicalKeyboardHighlightBgColor Define the background color that the physical keyboard highlighted key should have.\n * @property {boolean} physicalKeyboardHighlightPressUseClick Whether physicalKeyboardHighlightPress should use clicks to trigger buttons.\n * @property {boolean} physicalKeyboardHighlightPressUsePointerEvents Whether physicalKeyboardHighlightPress should use pointer events to trigger buttons.\n * @property {boolean} physicalKeyboardHighlightPreventDefault Whether physicalKeyboardHighlight should use preventDefault to disable default browser actions.\n * @property {boolean} preventMouseDownDefault Calling preventDefault for the mousedown events keeps the focus on the input.\n * @property {boolean} preventMouseUpDefault Calling preventDefault for the mouseup events.\n * @property {boolean} stopMouseDownPropagation Stops pointer down events on simple-keyboard buttons from bubbling to parent elements.\n * @property {boolean} stopMouseUpPropagation Stops pointer up events on simple-keyboard buttons from bubbling to parent elements.\n * @property {function(button: string):string} onKeyPress Executes the callback function on key press. Returns button layout name (i.e.: “{shift}”).\n * @property {function(input: string):string} onChange Executes the callback function on input change. Returns the current input’s string.\n * @property {function} onRender Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).\n * @property {function} onInit Executes the callback function once simple-keyboard is rendered for the first time (on initialization).\n * @property {function(keyboard: Keyboard):void} beforeInputUpdate Perform an action before any input change\n * @property {function(inputs: object):object} onChangeAll Executes the callback function on input change. Returns the input object with all defined inputs.\n * @property {boolean} useButtonTag Render buttons as a button element instead of a div element.\n * @property {boolean} disableCaretPositioning A prop to ensure characters are always be added/removed at the end of the string.\n * @property {object} inputPattern Restrains input(s) change to the defined regular expression pattern.\n * @property {boolean} useTouchEvents Instructs simple-keyboard to use touch events instead of click events.\n * @property {boolean} autoUseTouchEvents Enable useTouchEvents automatically when touch device is detected.\n * @property {boolean} useMouseEvents Opt out of PointerEvents handling, falling back to the prior mouse event logic.\n * @property {function} destroy Clears keyboard listeners and DOM elements.\n * @property {boolean} disableButtonHold Disable button hold action.\n * @property {boolean} rtl Adds unicode right-to-left control characters to input return values.\n * @property {function} onKeyReleased Executes the callback function on key release.\n * @property {array} modules Module classes to be loaded by simple-keyboard.\n * @property {boolean} enableLayoutCandidates Enable input method editor candidate list support.\n * @property {object} excludeFromLayout Buttons to exclude from layout\n * @property {number} layoutCandidatesPageSize Determines size of layout candidate list\n * @property {boolean} layoutCandidatesCaseSensitiveMatch Determines whether layout candidate match should be case sensitive.\n * @property {boolean} disableCandidateNormalization Disables the automatic normalization for selected layout candidates\n * @property {boolean} enableLayoutCandidatesKeyPress Enables onKeyPress triggering for layoutCandidate items\n */\n this.options = {\n layoutName: \"default\",\n theme: \"hg-theme-default\",\n inputName: \"default\",\n preventMouseDownDefault: false,\n enableLayoutCandidates: true,\n excludeFromLayout: {},\n ...options,\n };\n\n /**\n * @type {object} Classes identifying loaded plugins\n */\n this.keyboardPluginClasses = \"\";\n\n /**\n * Bindings\n */\n Utilities.bindMethods(SimpleKeyboard, this);\n\n /**\n * simple-keyboard uses a non-persistent internal input to keep track of the entered string (the variable `keyboard.input`).\n * This removes any dependency to input DOM elements. You can type and directly display the value in a div element, for example.\n * @example\n * // To get entered input\n * const input = keyboard.getInput();\n *\n * // To clear entered input.\n * keyboard.clearInput();\n *\n * @type {object}\n * @property {object} default Default SimpleKeyboard internal input.\n * @property {object} myInputName Example input that can be set through `options.inputName:\"myInputName\"`.\n */\n const { inputName = this.defaultName } = this.options;\n this.input = {};\n this.input[inputName] = \"\";\n\n /**\n * @type {string} DOM class of the keyboard wrapper, normally \"simple-keyboard\" by default.\n */\n this.keyboardDOMClass = keyboardDOMClass;\n\n /**\n * @type {object} Contains the DOM elements of every rendered button, the key being the button's layout name (e.g.: \"{enter}\").\n */\n this.buttonElements = {};\n\n /**\n * Simple-keyboard Instances\n * This enables multiple simple-keyboard support with easier management\n */\n if (!window[\"SimpleKeyboardInstances\"])\n window[\"SimpleKeyboardInstances\"] = {};\n\n this.currentInstanceName = this.utilities.camelCase(this.keyboardDOMClass);\n window[\"SimpleKeyboardInstances\"][this.currentInstanceName] = this;\n\n /**\n * Instance vars\n */\n this.allKeyboardInstances = window[\"SimpleKeyboardInstances\"];\n this.keyboardInstanceNames = Object.keys(window[\"SimpleKeyboardInstances\"]);\n this.isFirstKeyboardInstance =\n this.keyboardInstanceNames[0] === this.currentInstanceName;\n\n /**\n * Physical Keyboard support\n */\n this.physicalKeyboard = new PhysicalKeyboard({\n dispatch: this.dispatch,\n getOptions: this.getOptions,\n });\n\n /**\n * Initializing CandidateBox\n */\n this.candidateBox = this.options.enableLayoutCandidates\n ? new CandidateBox({\n utilities: this.utilities,\n options: this.options,\n })\n : null;\n\n /**\n * Rendering keyboard\n */\n if (this.keyboardDOM) this.render();\n else {\n console.warn(`\".${keyboardDOMClass}\" was not found in the DOM.`);\n throw new Error(\"KEYBOARD_DOM_ERROR\");\n }\n\n /**\n * Modules\n */\n this.modules = {};\n this.loadModules();\n }\n\n /**\n * parseParams\n */\n handleParams = (\n selectorOrOptions?: string | HTMLDivElement | KeyboardOptions,\n keyboardOptions?: KeyboardOptions\n ): {\n keyboardDOMClass: string;\n keyboardDOM: KeyboardElement;\n options: Partial;\n } => {\n let keyboardDOMClass;\n let keyboardDOM;\n let options;\n\n /**\n * If first parameter is a string:\n * Consider it as an element's class\n */\n if (typeof selectorOrOptions === \"string\") {\n keyboardDOMClass = selectorOrOptions.split(\".\").join(\"\");\n keyboardDOM = document.querySelector(\n `.${keyboardDOMClass}`\n ) as KeyboardElement;\n options = keyboardOptions;\n\n /**\n * If first parameter is an KeyboardElement\n * Consider it as the keyboard DOM element\n */\n } else if (selectorOrOptions instanceof HTMLDivElement) {\n /**\n * This element must have a class, otherwise throw\n */\n if (!selectorOrOptions.className) {\n console.warn(\"Any DOM element passed as parameter must have a class.\");\n throw new Error(\"KEYBOARD_DOM_CLASS_ERROR\");\n }\n\n keyboardDOMClass = selectorOrOptions.className.split(\" \")[0];\n keyboardDOM = selectorOrOptions;\n options = keyboardOptions;\n\n /**\n * Otherwise, search for .simple-keyboard DOM element\n */\n } else {\n keyboardDOMClass = \"simple-keyboard\";\n keyboardDOM = document.querySelector(\n `.${keyboardDOMClass}`\n ) as KeyboardElement;\n options = selectorOrOptions;\n }\n\n return {\n keyboardDOMClass,\n keyboardDOM,\n options,\n };\n };\n\n /**\n * Getters\n */\n getOptions = (): KeyboardOptions => this.options;\n getCaretPosition = (): number | null => this.caretPosition;\n getCaretPositionEnd = (): number | null => this.caretPositionEnd;\n\n /**\n * Changes the internal caret position\n * @param {number} position The caret's start position\n * @param {number} positionEnd The caret's end position\n */\n setCaretPosition(position: number | null, endPosition = position): void {\n this.caretPosition = position;\n this.caretPositionEnd = endPosition;\n }\n\n /**\n * Retrieve the candidates for a given input\n * @param input The input string to check\n */\n getInputCandidates(\n input: string\n ): { candidateKey: string; candidateValue: string } | Record {\n const {\n layoutCandidates: layoutCandidatesObj,\n layoutCandidatesCaseSensitiveMatch,\n } = this.options;\n\n if (!layoutCandidatesObj || typeof layoutCandidatesObj !== \"object\") {\n return {};\n }\n\n const layoutCandidates = Object.keys(layoutCandidatesObj).filter(\n (layoutCandidate: string) => {\n const inputSubstr =\n input.substring(0, this.getCaretPositionEnd() || 0) || input;\n const regexp = new RegExp(\n `${this.utilities.escapeRegex(layoutCandidate)}$`,\n layoutCandidatesCaseSensitiveMatch ? \"g\" : \"gi\"\n );\n const matches = [...inputSubstr.matchAll(regexp)];\n return !!matches.length;\n }\n );\n\n if (layoutCandidates.length > 1) {\n const candidateKey = layoutCandidates.sort(\n (a, b) => b.length - a.length\n )[0];\n return {\n candidateKey,\n candidateValue: layoutCandidatesObj[candidateKey],\n };\n } else if (layoutCandidates.length) {\n const candidateKey = layoutCandidates[0];\n return {\n candidateKey,\n candidateValue: layoutCandidatesObj[candidateKey],\n };\n } else {\n return {};\n }\n }\n\n /**\n * Shows a suggestion box with a list of candidate words\n * @param candidates The chosen candidates string as defined in the layoutCandidates option\n * @param targetElement The element next to which the candidates box will be shown\n */\n showCandidatesBox(\n candidateKey: string,\n candidateValue: string,\n targetElement: KeyboardElement\n ): void {\n if (this.candidateBox) {\n this.candidateBox.show({\n candidateValue,\n targetElement,\n onSelect: (selectedCandidate: string, e: MouseEvent) => {\n const {\n layoutCandidatesCaseSensitiveMatch,\n disableCandidateNormalization,\n enableLayoutCandidatesKeyPress\n } = this.options;\n\n let candidateStr = selectedCandidate;\n\n if(!disableCandidateNormalization) {\n /**\n * Making sure that our suggestions are not composed characters\n */\n candidateStr = selectedCandidate.normalize(\"NFD\");\n }\n\n /**\n * Perform an action before any input change\n */\n if (typeof this.options.beforeInputUpdate === \"function\") {\n this.options.beforeInputUpdate(this);\n }\n\n const currentInput = this.getInput(this.options.inputName, true);\n const initialCaretPosition = this.getCaretPositionEnd() || 0;\n const inputSubstr =\n currentInput.substring(0, initialCaretPosition || 0) ||\n currentInput;\n\n const regexp = new RegExp(\n `${this.utilities.escapeRegex(candidateKey)}$`,\n layoutCandidatesCaseSensitiveMatch ? \"g\" : \"gi\"\n );\n const newInputSubstr = inputSubstr.replace(\n regexp,\n candidateStr\n );\n const newInput = currentInput.replace(inputSubstr, newInputSubstr);\n\n const caretPositionDiff = newInputSubstr.length - inputSubstr.length;\n let newCaretPosition =\n (initialCaretPosition || currentInput.length) + caretPositionDiff;\n\n if (newCaretPosition < 0) newCaretPosition = 0;\n\n this.setInput(newInput, this.options.inputName, true);\n this.setCaretPosition(newCaretPosition);\n\n /**\n * Calling onKeyPress\n * We pass in the composed candidate instead of the decomposed one\n * To prevent confusion for users\n */\n if (enableLayoutCandidatesKeyPress && typeof this.options.onKeyPress === \"function\")\n this.options.onKeyPress(selectedCandidate, e);\n\n if (typeof this.options.onChange === \"function\")\n this.options.onChange(\n this.getInput(this.options.inputName, true),\n e\n );\n\n /**\n * Calling onChangeAll\n */\n if (typeof this.options.onChangeAll === \"function\")\n this.options.onChangeAll(this.getAllInputs(), e);\n },\n });\n }\n }\n\n /**\n * Handles clicks made to keyboard buttons\n * @param {string} button The button's layout name.\n */\n handleButtonClicked(button: string, e?: KeyboardHandlerEvent): void {\n const { inputName = this.defaultName, debug } = this.options;\n /**\n * Ignoring placeholder buttons\n */\n if (button === \"{//}\") return;\n\n /**\n * Creating inputName if it doesn't exist\n */\n if (!this.input[inputName]) this.input[inputName] = \"\";\n\n /**\n * Perform an action before any input change\n */\n if (typeof this.options.beforeInputUpdate === \"function\") {\n this.options.beforeInputUpdate(this);\n }\n\n /**\n * Calculating new input\n */\n const updatedInput = this.utilities.getUpdatedInput(\n button,\n this.input[inputName],\n this.caretPosition,\n this.caretPositionEnd\n );\n\n /**\n * EDGE CASE: Check for whole input selection changes that will yield same updatedInput\n */\n if (this.utilities.isStandardButton(button) && this.activeInputElement) {\n const isEntireInputSelection =\n this.input[inputName] &&\n this.input[inputName] === updatedInput &&\n this.caretPosition === 0 &&\n this.caretPositionEnd === updatedInput.length;\n\n if (isEntireInputSelection) {\n this.setInput(\"\", this.options.inputName, true);\n this.setCaretPosition(0);\n this.activeInputElement.value = \"\";\n this.activeInputElement.setSelectionRange(0, 0);\n this.handleButtonClicked(button, e);\n return;\n }\n }\n\n /**\n * Calling onKeyPress\n */\n if (typeof this.options.onKeyPress === \"function\")\n this.options.onKeyPress(button, e);\n\n if (\n // If input will change as a result of this button press\n this.input[inputName] !== updatedInput &&\n // This pertains to the \"inputPattern\" option:\n // If inputPattern isn't set\n (!this.options.inputPattern ||\n // Or, if it is set and if the pattern is valid - we proceed.\n (this.options.inputPattern && this.inputPatternIsValid(updatedInput)))\n ) {\n /**\n * If maxLength and handleMaxLength yield true, halting\n */\n if (\n this.options.maxLength &&\n this.utilities.handleMaxLength(this.input, updatedInput)\n ) {\n return;\n }\n\n /**\n * Updating input\n */\n const newInputValue = this.utilities.getUpdatedInput(\n button,\n this.input[inputName],\n this.caretPosition,\n this.caretPositionEnd,\n true\n );\n\n this.setInput(newInputValue, this.options.inputName, true);\n\n if (debug) console.log(\"Input changed:\", this.getAllInputs());\n\n if (this.options.debug) {\n console.log(\n \"Caret at: \",\n this.getCaretPosition(),\n this.getCaretPositionEnd(),\n `(${this.keyboardDOMClass})`,\n e?.type\n );\n }\n\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (this.options.syncInstanceInputs) this.syncInstanceInputs();\n\n /**\n * Calling onChange\n */\n if (typeof this.options.onChange === \"function\")\n this.options.onChange(this.getInput(this.options.inputName, true), e);\n\n /**\n * Calling onChangeAll\n */\n if (typeof this.options.onChangeAll === \"function\")\n this.options.onChangeAll(this.getAllInputs(), e);\n\n /**\n * Check if this new input has candidates (suggested words)\n */\n if (e?.target && this.options.enableLayoutCandidates) {\n const { candidateKey, candidateValue } =\n this.getInputCandidates(updatedInput);\n\n if (candidateKey && candidateValue) {\n this.showCandidatesBox(\n candidateKey,\n candidateValue,\n this.keyboardDOM\n );\n } else {\n this.candidateBox?.destroy();\n }\n }\n }\n\n /**\n * After a button is clicked the selection (if any) will disappear\n * we should reflect this in our state, as applicable\n */\n if(this.caretPositionEnd && this.caretPosition !== this.caretPositionEnd){\n this.setCaretPosition(this.caretPositionEnd, this.caretPositionEnd);\n\n if(this.activeInputElement){\n this.activeInputElement.setSelectionRange(this.caretPositionEnd, this.caretPositionEnd);\n }\n \n if(this.options.debug){\n console.log(\"Caret position aligned\", this.caretPosition);\n }\n }\n\n if (debug) {\n console.log(\"Key pressed:\", button);\n }\n }\n\n /**\n * Get mouse hold state\n */\n getMouseHold() {\n return this.isMouseHold;\n }\n\n /**\n * Mark mouse hold state as set\n */\n setMouseHold(value: boolean) {\n if (this.options.syncInstanceInputs) {\n this.dispatch((instance: SimpleKeyboard) => {\n instance.isMouseHold = value;\n });\n } else {\n this.isMouseHold = value;\n }\n }\n\n /**\n * Handles button mousedown\n */\n /* istanbul ignore next */\n handleButtonMouseDown(button: string, e: KeyboardHandlerEvent): void {\n if (e) {\n /**\n * Handle event options\n */\n if (this.options.preventMouseDownDefault) e.preventDefault();\n if (this.options.stopMouseDownPropagation) e.stopPropagation();\n\n /**\n * Add active class\n */\n e.target.classList.add(this.activeButtonClass);\n }\n\n if (this.holdInteractionTimeout) clearTimeout(this.holdInteractionTimeout);\n if (this.holdTimeout) clearTimeout(this.holdTimeout);\n\n /**\n * @type {boolean} Whether the mouse is being held onKeyPress\n */\n this.setMouseHold(true);\n\n /**\n * @type {object} Time to wait until a key hold is detected\n */\n if (!this.options.disableButtonHold) {\n this.holdTimeout = window.setTimeout(() => {\n if (\n (this.getMouseHold() &&\n // TODO: This needs to be configurable through options\n ((!button.includes(\"{\") && !button.includes(\"}\")) ||\n button === \"{delete}\" ||\n button === \"{backspace}\" ||\n button === \"{bksp}\" ||\n button === \"{space}\" ||\n button === \"{tab}\")) ||\n button === \"{arrowright}\" ||\n button === \"{arrowleft}\" ||\n button === \"{arrowup}\" ||\n button === \"{arrowdown}\"\n ) {\n if (this.options.debug) console.log(\"Button held:\", button);\n\n this.handleButtonHold(button);\n }\n clearTimeout(this.holdTimeout);\n }, 500);\n }\n }\n\n /**\n * Handles button mouseup\n */\n handleButtonMouseUp(button?: string, e?: KeyboardHandlerEvent): void {\n if (e) {\n /**\n * Handle event options\n */\n if (this.options.preventMouseUpDefault && e.preventDefault)\n e.preventDefault();\n if (this.options.stopMouseUpPropagation && e.stopPropagation)\n e.stopPropagation();\n\n /* istanbul ignore next */\n const isKeyboard =\n e.target === this.keyboardDOM ||\n (e.target && this.keyboardDOM.contains(e.target)) ||\n (this.candidateBox &&\n this.candidateBox.candidateBoxElement &&\n (e.target === this.candidateBox.candidateBoxElement ||\n (e.target &&\n this.candidateBox.candidateBoxElement.contains(e.target))));\n\n /**\n * On click outside, remove candidateBox\n */\n if (!isKeyboard && this.candidateBox) {\n this.candidateBox.destroy();\n }\n }\n\n /**\n * Remove active class\n */\n this.recurseButtons((buttonElement: Element) => {\n buttonElement.classList.remove(this.activeButtonClass);\n });\n\n this.setMouseHold(false);\n if (this.holdInteractionTimeout) clearTimeout(this.holdInteractionTimeout);\n\n /**\n * Calling onKeyReleased\n */\n if (button && typeof this.options.onKeyReleased === \"function\")\n this.options.onKeyReleased(button, e);\n }\n\n /**\n * Handles container mousedown\n */\n handleKeyboardContainerMouseDown(e: KeyboardHandlerEvent): void {\n /**\n * Handle event options\n */\n if (this.options.preventMouseDownDefault) e.preventDefault();\n }\n\n /**\n * Handles button hold\n */\n /* istanbul ignore next */\n handleButtonHold(button: string): void {\n if (this.holdInteractionTimeout) clearTimeout(this.holdInteractionTimeout);\n\n /**\n * @type {object} Timeout dictating the speed of key hold iterations\n */\n this.holdInteractionTimeout = window.setTimeout(() => {\n if (this.getMouseHold()) {\n this.handleButtonClicked(button);\n this.handleButtonHold(button);\n } else {\n clearTimeout(this.holdInteractionTimeout);\n }\n }, 100);\n }\n\n /**\n * Send a command to all simple-keyboard instances (if you have several instances).\n */\n syncInstanceInputs(): void {\n this.dispatch((instance: SimpleKeyboard) => {\n instance.replaceInput(this.input);\n instance.setCaretPosition(this.caretPosition, this.caretPositionEnd);\n });\n }\n\n /**\n * Clear the keyboard’s input.\n * @param {string} [inputName] optional - the internal input to select\n */\n clearInput(\n inputName: string = this.options.inputName || this.defaultName\n ): void {\n this.input[inputName] = \"\";\n\n /**\n * Reset caretPosition\n */\n this.setCaretPosition(0);\n\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (this.options.syncInstanceInputs) this.syncInstanceInputs();\n }\n\n /**\n * Get the keyboard’s input (You can also get it from the onChange prop).\n * @param {string} [inputName] optional - the internal input to select\n */\n getInput(\n inputName: string = this.options.inputName || this.defaultName,\n skipSync = false\n ): string {\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (this.options.syncInstanceInputs && !skipSync) this.syncInstanceInputs();\n\n if (this.options.rtl) {\n // Remove existing control chars\n const inputWithoutRTLControl = this.input[inputName]\n .replace(\"\\u202B\", \"\")\n .replace(\"\\u202C\", \"\");\n\n return \"\\u202B\" + inputWithoutRTLControl + \"\\u202C\";\n } else {\n return this.input[inputName];\n }\n }\n\n /**\n * Get all simple-keyboard inputs\n */\n getAllInputs(): KeyboardInput {\n const output = {};\n const inputNames = Object.keys(this.input);\n\n inputNames.forEach((inputName) => {\n output[inputName] = this.getInput(inputName, true);\n });\n\n return output;\n }\n\n /**\n * Set the keyboard’s input.\n * @param {string} input the input value\n * @param {string} inputName optional - the internal input to select\n */\n setInput(\n input: string,\n inputName: string = this.options.inputName || this.defaultName,\n skipSync?: boolean\n ): void {\n this.input[inputName] = input;\n\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (!skipSync && this.options.syncInstanceInputs) this.syncInstanceInputs();\n }\n\n /**\n * Replace the input object (`keyboard.input`)\n * @param {object} inputObj The input object\n */\n replaceInput(inputObj: KeyboardInput): void {\n this.input = inputObj;\n }\n\n /**\n * Set new option or modify existing ones after initialization.\n * @param {object} options The options to set\n */\n setOptions(options = {}): void {\n const changedOptions = this.changedOptions(options);\n this.options = Object.assign(this.options, options);\n\n if (changedOptions.length) {\n if (this.options.debug) {\n console.log(\"changedOptions\", changedOptions);\n }\n\n /**\n * Some option changes require adjustments before re-render\n */\n this.onSetOptions(changedOptions);\n\n /**\n * Rendering\n */\n this.render();\n }\n }\n\n /**\n * Detecting changes to non-function options\n * This allows us to ascertain whether a button re-render is needed\n */\n changedOptions(newOptions: Partial): string[] {\n return Object.keys(newOptions).filter(\n (optionName) =>\n JSON.stringify(newOptions[optionName]) !==\n JSON.stringify(this.options[optionName])\n );\n }\n\n /**\n * Executing actions depending on changed options\n * @param {object} options The options to set\n */\n onSetOptions(changedOptions: string[] = []): void {\n /**\n * Changed: layoutName\n */\n if (changedOptions.includes(\"layoutName\")) {\n /**\n * Reset candidateBox\n */\n if (this.candidateBox) {\n this.candidateBox.destroy();\n }\n }\n\n /**\n * Changed: layoutCandidatesPageSize, layoutCandidates\n */\n if (\n changedOptions.includes(\"layoutCandidatesPageSize\") ||\n changedOptions.includes(\"layoutCandidates\")\n ) {\n /**\n * Reset and recreate candidateBox\n */\n if (this.candidateBox) {\n this.candidateBox.destroy();\n this.candidateBox = new CandidateBox({\n utilities: this.utilities,\n options: this.options,\n });\n }\n }\n }\n\n /**\n * Remove all keyboard rows and reset keyboard values.\n * Used internally between re-renders.\n */\n resetRows(): void {\n if (this.keyboardRowsDOM) {\n this.keyboardRowsDOM.remove();\n }\n\n this.keyboardDOM.className = this.keyboardDOMClass;\n this.keyboardDOM.setAttribute(\"data-skInstance\", this.currentInstanceName);\n this.buttonElements = {};\n }\n\n /**\n * Send a command to all simple-keyboard instances at once (if you have multiple instances).\n * @param {function(instance: object, key: string)} callback Function to run on every instance\n */\n // eslint-disable-next-line no-unused-vars\n dispatch(callback: (instance: SimpleKeyboard, key?: string) => void): void {\n if (!window[\"SimpleKeyboardInstances\"]) {\n console.warn(\n `SimpleKeyboardInstances is not defined. Dispatch cannot be called.`\n );\n throw new Error(\"INSTANCES_VAR_ERROR\");\n }\n\n return Object.keys(window[\"SimpleKeyboardInstances\"]).forEach((key) => {\n callback(window[\"SimpleKeyboardInstances\"][key], key);\n });\n }\n\n /**\n * Adds/Modifies an entry to the `buttonTheme`. Basically a way to add a class to a button.\n * @param {string} buttons List of buttons to select (separated by a space).\n * @param {string} className Classes to give to the selected buttons (separated by space).\n */\n addButtonTheme(buttons: string, className: string): void {\n if (!className || !buttons) return;\n\n buttons.split(\" \").forEach((button) => {\n className.split(\" \").forEach((classNameItem) => {\n if (!this.options.buttonTheme) this.options.buttonTheme = [];\n\n let classNameFound = false;\n\n /**\n * If class is already defined, we add button to class definition\n */\n this.options.buttonTheme.map((buttonTheme) => {\n if (buttonTheme?.class.split(\" \").includes(classNameItem)) {\n classNameFound = true;\n\n const buttonThemeArray = buttonTheme.buttons.split(\" \");\n if (!buttonThemeArray.includes(button)) {\n classNameFound = true;\n buttonThemeArray.push(button);\n buttonTheme.buttons = buttonThemeArray.join(\" \");\n }\n }\n return buttonTheme;\n });\n\n /**\n * If class is not defined, we create a new entry\n */\n if (!classNameFound) {\n this.options.buttonTheme.push({\n class: classNameItem,\n buttons: buttons,\n });\n }\n });\n });\n\n this.render();\n }\n\n /**\n * Removes/Amends an entry to the `buttonTheme`. Basically a way to remove a class previously added to a button through buttonTheme or addButtonTheme.\n * @param {string} buttons List of buttons to select (separated by a space).\n * @param {string} className Classes to give to the selected buttons (separated by space).\n */\n removeButtonTheme(buttons: string, className: string): void {\n /**\n * When called with empty parameters, remove all button themes\n */\n if (!buttons && !className) {\n this.options.buttonTheme = [];\n this.render();\n return;\n }\n\n /**\n * If buttons are passed and buttonTheme has items\n */\n if (\n buttons &&\n Array.isArray(this.options.buttonTheme) &&\n this.options.buttonTheme.length\n ) {\n const buttonArray = buttons.split(\" \");\n buttonArray.forEach((button) => {\n this.options?.buttonTheme?.map((buttonTheme, index) => {\n /**\n * If className is set, we affect the buttons only for that class\n * Otherwise, we afect all classes\n */\n if (\n (buttonTheme &&\n className &&\n className.includes(buttonTheme.class)) ||\n !className\n ) {\n const filteredButtonArray = buttonTheme?.buttons\n .split(\" \")\n .filter((item) => item !== button);\n\n /**\n * If buttons left, return them, otherwise, remove button Theme\n */\n if (buttonTheme && filteredButtonArray?.length) {\n buttonTheme.buttons = filteredButtonArray.join(\" \");\n } else {\n this.options.buttonTheme?.splice(index, 1);\n buttonTheme = null;\n }\n }\n\n return buttonTheme;\n });\n });\n\n this.render();\n }\n }\n\n /**\n * Get the DOM Element of a button. If there are several buttons with the same name, an array of the DOM Elements is returned.\n * @param {string} button The button layout name to select\n */\n getButtonElement(\n button: string\n ): KeyboardElement | KeyboardElement[] | undefined {\n let output;\n\n const buttonArr = this.buttonElements[button];\n if (buttonArr) {\n if (buttonArr.length > 1) {\n output = buttonArr;\n } else {\n output = buttonArr[0];\n }\n }\n\n return output;\n }\n\n /**\n * This handles the \"inputPattern\" option\n * by checking if the provided inputPattern passes\n */\n inputPatternIsValid(inputVal: string): boolean {\n const inputPatternRaw = this.options.inputPattern;\n let inputPattern;\n\n /**\n * Check if input pattern is global or targeted to individual inputs\n */\n if (inputPatternRaw instanceof RegExp) {\n inputPattern = inputPatternRaw;\n } else {\n inputPattern =\n inputPatternRaw[this.options.inputName || this.defaultName];\n }\n\n if (inputPattern && inputVal) {\n const didInputMatch = inputPattern.test(inputVal);\n\n if (this.options.debug) {\n console.log(\n `inputPattern (\"${inputPattern}\"): ${\n didInputMatch ? \"passed\" : \"did not pass!\"\n }`\n );\n }\n\n return didInputMatch;\n } else {\n /**\n * inputPattern doesn't seem to be set for the current input, or input is empty. Pass.\n */\n return true;\n }\n }\n\n /**\n * Handles simple-keyboard event listeners\n */\n setEventListeners(): void {\n /**\n * Only first instance should set the event listeners\n */\n if (this.isFirstKeyboardInstance || !this.allKeyboardInstances) {\n if (this.options.debug) {\n console.log(`Caret handling started (${this.keyboardDOMClass})`);\n }\n\n const { physicalKeyboardHighlightPreventDefault = false } = this.options;\n\n /**\n * Event Listeners\n */\n document.addEventListener(\"keyup\", this.handleKeyUp, physicalKeyboardHighlightPreventDefault);\n document.addEventListener(\"keydown\", this.handleKeyDown, physicalKeyboardHighlightPreventDefault);\n document.addEventListener(\"mouseup\", this.handleMouseUp);\n document.addEventListener(\"touchend\", this.handleTouchEnd);\n document.addEventListener(\"selectionchange\", this.handleSelectionChange);\n document.addEventListener(\"select\", this.handleSelect);\n }\n }\n\n /**\n * Event Handler: KeyUp\n */\n handleKeyUp(event: KeyboardHandlerEvent): void {\n this.caretEventHandler(event);\n\n if (this.options.physicalKeyboardHighlight) {\n this.physicalKeyboard.handleHighlightKeyUp(event);\n }\n }\n\n /**\n * Event Handler: KeyDown\n */\n handleKeyDown(event: KeyboardHandlerEvent): void {\n if (this.options.physicalKeyboardHighlight) {\n this.physicalKeyboard.handleHighlightKeyDown(event);\n }\n }\n\n /**\n * Event Handler: MouseUp\n */\n handleMouseUp(event: KeyboardHandlerEvent): void {\n this.caretEventHandler(event);\n }\n\n /**\n * Event Handler: TouchEnd\n */\n /* istanbul ignore next */\n handleTouchEnd(event: KeyboardHandlerEvent): void {\n this.caretEventHandler(event);\n }\n\n /**\n * Event Handler: Select\n */\n /* istanbul ignore next */\n handleSelect(event: KeyboardHandlerEvent): void {\n this.caretEventHandler(event);\n }\n\n /**\n * Event Handler: SelectionChange\n */\n /* istanbul ignore next */\n handleSelectionChange(event: KeyboardHandlerEvent): void {\n /**\n * Firefox is not reporting the correct caret position through this event\n * https://github.com/hodgef/simple-keyboard/issues/1839\n */\n if(navigator.userAgent.includes('Firefox')){\n return;\n }\n this.caretEventHandler(event);\n }\n\n /**\n * Called by {@link setEventListeners} when an event that warrants a cursor position update is triggered\n */\n caretEventHandler(event: KeyboardHandlerEvent): void {\n let targetTagName: string;\n if (event.target.tagName) {\n targetTagName = event.target.tagName.toLowerCase();\n }\n\n this.dispatch((instance) => {\n let isKeyboard =\n event.target === instance.keyboardDOM ||\n (event.target && instance.keyboardDOM.contains(event.target));\n\n /**\n * If syncInstanceInputs option is enabled, make isKeyboard match any instance\n * not just the current one\n */\n if (this.options.syncInstanceInputs && Array.isArray(event.path)) {\n isKeyboard = event.path.some((item: HTMLElement) =>\n item?.hasAttribute?.(\"data-skInstance\")\n );\n }\n\n if (\n (targetTagName === \"textarea\" ||\n (targetTagName === \"input\" &&\n [\"text\", \"search\", \"url\", \"tel\", \"password\"].includes(\n event.target.type\n ))) &&\n !instance.options.disableCaretPositioning\n ) {\n /**\n * Tracks current cursor position\n * As keys are pressed, text will be added/removed at that position within the input.\n */\n let selectionStart = event.target.selectionStart;\n let selectionEnd = event.target.selectionEnd;\n\n if(instance.options.rtl){\n selectionStart = instance.utilities.getRtlOffset(selectionStart, instance.getInput());\n selectionEnd = instance.utilities.getRtlOffset(selectionEnd, instance.getInput());\n }\n\n instance.setCaretPosition(selectionStart, selectionEnd);\n\n /**\n * Tracking current input in order to handle caret positioning edge cases\n */\n this.activeInputElement = event.target;\n\n if (instance.options.debug) {\n console.log(\n \"Caret at: \",\n instance.getCaretPosition(),\n instance.getCaretPositionEnd(),\n event && event.target.tagName.toLowerCase(),\n `(${instance.keyboardDOMClass})`,\n event?.type\n );\n }\n } else if (\n (instance.options.disableCaretPositioning || !isKeyboard) &&\n event?.type !== \"selectionchange\"\n ) {\n /**\n * If we toggled off disableCaretPositioning, we must ensure caretPosition doesn't persist once reactivated.\n */\n instance.setCaretPosition(null);\n\n /**\n * Resetting activeInputElement\n */\n this.activeInputElement = null;\n\n if (instance.options.debug) {\n console.log(\n `Caret position reset due to \"${event?.type}\" event`,\n event\n );\n }\n }\n });\n }\n\n /**\n * Execute an operation on each button\n */\n recurseButtons(fn: any): void {\n if (!fn) return;\n\n Object.keys(this.buttonElements).forEach((buttonName) =>\n this.buttonElements[buttonName].forEach(fn)\n );\n }\n\n /**\n * Destroy keyboard listeners and DOM elements\n */\n destroy(): void {\n if (this.options.debug)\n console.log(\n `Destroying simple-keyboard instance: ${this.currentInstanceName}`\n );\n\n const { physicalKeyboardHighlightPreventDefault = false } = this.options;\n\n /**\n * Remove document listeners\n */\n document.removeEventListener(\"keyup\", this.handleKeyUp, physicalKeyboardHighlightPreventDefault);\n document.removeEventListener(\"keydown\", this.handleKeyDown, physicalKeyboardHighlightPreventDefault);\n document.removeEventListener(\"mouseup\", this.handleMouseUp);\n document.removeEventListener(\"touchend\", this.handleTouchEnd);\n document.removeEventListener(\"select\", this.handleSelect);\n document.removeEventListener(\"selectionchange\", this.handleSelectionChange);\n document.onpointerup = null;\n document.ontouchend = null;\n document.ontouchcancel = null;\n document.onmouseup = null;\n\n /**\n * Remove buttons\n */\n const deleteButton = (buttonElement: KeyboardElement | null) => {\n if (buttonElement) {\n buttonElement.onpointerdown = null;\n buttonElement.onpointerup = null;\n buttonElement.onpointercancel = null;\n buttonElement.ontouchstart = null;\n buttonElement.ontouchend = null;\n buttonElement.ontouchcancel = null;\n buttonElement.onclick = null;\n buttonElement.onmousedown = null;\n buttonElement.onmouseup = null;\n\n buttonElement.remove();\n buttonElement = null;\n }\n };\n\n this.recurseButtons(deleteButton);\n\n /**\n * Remove wrapper events\n */\n this.keyboardDOM.onpointerdown = null;\n this.keyboardDOM.ontouchstart = null;\n this.keyboardDOM.onmousedown = null;\n\n /**\n * Clearing keyboard rows\n */\n this.resetRows();\n\n /**\n * Candidate box\n */\n if (this.candidateBox) {\n this.candidateBox.destroy();\n this.candidateBox = null;\n }\n\n /**\n * Clearing activeInputElement\n */\n this.activeInputElement = null;\n\n /**\n * Removing instance attribute\n */\n this.keyboardDOM.removeAttribute(\"data-skInstance\");\n\n /**\n * Clearing keyboardDOM\n */\n this.keyboardDOM.innerHTML = \"\";\n\n /**\n * Remove instance\n */\n window[\"SimpleKeyboardInstances\"][this.currentInstanceName] = null;\n delete window[\"SimpleKeyboardInstances\"][this.currentInstanceName];\n\n /**\n * Reset initialized flag\n */\n this.initialized = false;\n }\n\n /**\n * Process buttonTheme option\n */\n getButtonThemeClasses(button: string): string[] {\n const buttonTheme = this.options.buttonTheme;\n let buttonClasses: string[] = [];\n\n if (Array.isArray(buttonTheme)) {\n buttonTheme.forEach((themeObj) => {\n if (\n themeObj &&\n themeObj.class &&\n typeof themeObj.class === \"string\" &&\n themeObj.buttons &&\n typeof themeObj.buttons === \"string\"\n ) {\n const themeObjClasses = themeObj.class.split(\" \");\n const themeObjButtons = themeObj.buttons.split(\" \");\n\n if (themeObjButtons.includes(button)) {\n buttonClasses = [...buttonClasses, ...themeObjClasses];\n }\n } else {\n console.warn(\n `Incorrect \"buttonTheme\". Please check the documentation.`,\n themeObj\n );\n }\n });\n }\n\n return buttonClasses;\n }\n\n /**\n * Process buttonAttributes option\n */\n setDOMButtonAttributes(button: string, callback: any): void {\n const buttonAttributes = this.options.buttonAttributes;\n\n if (Array.isArray(buttonAttributes)) {\n buttonAttributes.forEach((attrObj) => {\n if (\n attrObj.attribute &&\n typeof attrObj.attribute === \"string\" &&\n attrObj.value &&\n typeof attrObj.value === \"string\" &&\n attrObj.buttons &&\n typeof attrObj.buttons === \"string\"\n ) {\n const attrObjButtons = attrObj.buttons.split(\" \");\n\n if (attrObjButtons.includes(button)) {\n callback(attrObj.attribute, attrObj.value);\n }\n } else {\n console.warn(\n `Incorrect \"buttonAttributes\". Please check the documentation.`,\n attrObj\n );\n }\n });\n }\n }\n\n onTouchDeviceDetected() {\n /**\n * Processing autoTouchEvents\n */\n this.processAutoTouchEvents();\n\n /**\n * Disabling contextual window on touch devices\n */\n this.disableContextualWindow();\n }\n\n /**\n * Disabling contextual window for hg-button\n */\n /* istanbul ignore next */\n disableContextualWindow() {\n window.oncontextmenu = (event: KeyboardHandlerEvent) => {\n if (event.target.classList.contains(\"hg-button\")) {\n event.preventDefault();\n event.stopPropagation();\n return false;\n }\n };\n }\n\n /**\n * Process autoTouchEvents option\n */\n processAutoTouchEvents() {\n if (this.options.autoUseTouchEvents) {\n this.options.useTouchEvents = true;\n\n if (this.options.debug) {\n console.log(\n `autoUseTouchEvents: Touch device detected, useTouchEvents enabled.`\n );\n }\n }\n }\n\n /**\n * Executes the callback function once simple-keyboard is rendered for the first time (on initialization).\n */\n onInit() {\n if (this.options.debug) {\n console.log(`${this.keyboardDOMClass} Initialized`);\n }\n\n /**\n * setEventListeners\n */\n this.setEventListeners();\n\n if (typeof this.options.onInit === \"function\") this.options.onInit(this);\n }\n\n /**\n * Executes the callback function before a simple-keyboard render.\n */\n beforeFirstRender() {\n /**\n * Performing actions when touch device detected\n */\n if (this.utilities.isTouchDevice()) {\n this.onTouchDeviceDetected();\n }\n\n if (typeof this.options.beforeFirstRender === \"function\")\n this.options.beforeFirstRender(this);\n\n /**\n * Notify about PointerEvents usage\n */\n if (\n this.isFirstKeyboardInstance &&\n this.utilities.pointerEventsSupported() &&\n !this.options.useTouchEvents &&\n !this.options.useMouseEvents\n ) {\n if (this.options.debug) {\n console.log(\"Using PointerEvents as it is supported by this browser\");\n }\n }\n\n /**\n * Notify about touch events usage\n */\n if (this.options.useTouchEvents) {\n if (this.options.debug) {\n console.log(\n \"useTouchEvents has been enabled. Only touch events will be used.\"\n );\n }\n }\n }\n\n /**\n * Executes the callback function before a simple-keyboard render.\n */\n beforeRender() {\n if (typeof this.options.beforeRender === \"function\")\n this.options.beforeRender(this);\n }\n\n /**\n * Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).\n */\n onRender() {\n if (typeof this.options.onRender === \"function\")\n this.options.onRender(this);\n }\n\n /**\n * Executes the callback function once all modules have been loaded\n */\n onModulesLoaded() {\n if (typeof this.options.onModulesLoaded === \"function\")\n this.options.onModulesLoaded(this);\n }\n\n /**\n * Register module\n */\n registerModule = (name: string, initCallback: any) => {\n if (!this.modules[name]) this.modules[name] = {};\n\n initCallback(this.modules[name]);\n };\n\n /**\n * Load modules\n */\n loadModules() {\n if (Array.isArray(this.options.modules)) {\n this.options.modules.forEach((KeyboardModule) => {\n const keyboardModule = new KeyboardModule(this);\n keyboardModule.init && keyboardModule.init(this);\n });\n\n this.keyboardPluginClasses = \"modules-loaded\";\n\n this.render();\n this.onModulesLoaded();\n }\n }\n\n /**\n * Get module prop\n */\n getModuleProp(name: string, prop: string) {\n if (!this.modules[name]) return false;\n\n return this.modules[name][prop];\n }\n\n /**\n * getModulesList\n */\n getModulesList() {\n return Object.keys(this.modules);\n }\n\n /**\n * Parse Row DOM containers\n */\n parseRowDOMContainers(\n rowDOM: HTMLDivElement,\n rowIndex: number,\n containerStartIndexes: number[],\n containerEndIndexes: number[]\n ) {\n const rowDOMArray = Array.from(rowDOM.children);\n let removedElements = 0;\n\n if (rowDOMArray.length) {\n containerStartIndexes.forEach((startIndex, arrIndex) => {\n const endIndex = containerEndIndexes[arrIndex];\n\n /**\n * If there exists a respective end index\n * if end index comes after start index\n */\n if (!endIndex || !(endIndex > startIndex)) {\n return false;\n }\n\n /**\n * Updated startIndex, endIndex\n * This is since the removal of buttons to place a single button container\n * results in a modified array size\n */\n const updated_startIndex = startIndex - removedElements;\n const updated_endIndex = endIndex - removedElements;\n\n /**\n * Create button container\n */\n const containerDOM = document.createElement(\"div\");\n containerDOM.className += \"hg-button-container\";\n const containerUID = `${this.options.layoutName}-r${rowIndex}c${arrIndex}`;\n containerDOM.setAttribute(\"data-skUID\", containerUID);\n\n /**\n * Taking elements due to be inserted into container\n */\n const containedElements = rowDOMArray.splice(\n updated_startIndex,\n updated_endIndex - updated_startIndex + 1\n );\n removedElements = updated_endIndex - updated_startIndex;\n\n /**\n * Inserting elements to container\n */\n containedElements.forEach((element) =>\n containerDOM.appendChild(element)\n );\n\n /**\n * Adding container at correct position within rowDOMArray\n */\n rowDOMArray.splice(updated_startIndex, 0, containerDOM);\n\n /**\n * Clearing old rowDOM children structure\n */\n rowDOM.innerHTML = \"\";\n\n /**\n * Appending rowDOM new children list\n */\n rowDOMArray.forEach((element) => rowDOM.appendChild(element));\n\n if (this.options.debug) {\n console.log(\n \"rowDOMContainer\",\n containedElements,\n updated_startIndex,\n updated_endIndex,\n removedElements + 1\n );\n }\n });\n }\n\n return rowDOM;\n }\n\n /**\n * getKeyboardClassString\n */\n getKeyboardClassString = (...baseDOMClasses: any[]) => {\n const keyboardClasses = [this.keyboardDOMClass, ...baseDOMClasses].filter(\n (DOMClass) => !!DOMClass\n );\n\n return keyboardClasses.join(\" \");\n };\n\n /**\n * Renders rows and buttons as per options\n */\n render() {\n /**\n * Clear keyboard\n */\n this.resetRows();\n\n /**\n * Calling beforeFirstRender\n */\n if (!this.initialized) {\n this.beforeFirstRender();\n }\n\n /**\n * Calling beforeRender\n */\n this.beforeRender();\n\n const layoutClass = `hg-layout-${this.options.layoutName}`;\n const layout = this.options.layout || getDefaultLayout();\n const useTouchEvents = this.options.useTouchEvents || false;\n const useTouchEventsClass = useTouchEvents ? \"hg-touch-events\" : \"\";\n const useMouseEvents = this.options.useMouseEvents || false;\n const disableRowButtonContainers = this.options.disableRowButtonContainers;\n\n /**\n * Adding themeClass, layoutClass to keyboardDOM\n */\n this.keyboardDOM.className = this.getKeyboardClassString(\n this.options.theme,\n layoutClass,\n this.keyboardPluginClasses,\n useTouchEventsClass\n );\n\n /**\n * Adding keyboard identifier\n */\n this.keyboardDOM.setAttribute(\"data-skInstance\", this.currentInstanceName);\n\n /**\n * Create row wrapper\n */\n this.keyboardRowsDOM = document.createElement(\"div\");\n this.keyboardRowsDOM.className = \"hg-rows\";\n\n /**\n * Iterating through each row\n */\n layout[this.options.layoutName || this.defaultName].forEach(\n (row: string, rIndex: number) => {\n let rowArray = row.split(\" \");\n\n /**\n * Enforce excludeFromLayout\n */\n if (\n this.options.excludeFromLayout &&\n this.options.excludeFromLayout[\n this.options.layoutName || this.defaultName\n ]\n ) {\n rowArray = rowArray.filter(\n (buttonName) =>\n this.options.excludeFromLayout &&\n !this.options.excludeFromLayout[\n this.options.layoutName || this.defaultName\n ].includes(buttonName)\n );\n }\n\n /**\n * Creating empty row\n */\n let rowDOM = document.createElement(\"div\");\n rowDOM.className += \"hg-row\";\n\n /**\n * Tracking container indicators in rows\n */\n const containerStartIndexes: number[] = [];\n const containerEndIndexes: number[] = [];\n\n /**\n * Iterating through each button in row\n */\n rowArray.forEach((button, bIndex) => {\n /**\n * Check if button has a container indicator\n */\n const buttonHasContainerStart =\n !disableRowButtonContainers &&\n typeof button === \"string\" &&\n button.length > 1 &&\n button.indexOf(\"[\") === 0;\n\n const buttonHasContainerEnd =\n !disableRowButtonContainers &&\n typeof button === \"string\" &&\n button.length > 1 &&\n button.indexOf(\"]\") === button.length - 1;\n\n /**\n * Save container start index, if applicable\n */\n if (buttonHasContainerStart) {\n containerStartIndexes.push(bIndex);\n\n /**\n * Removing indicator\n */\n button = button.replace(/\\[/g, \"\");\n }\n\n if (buttonHasContainerEnd) {\n containerEndIndexes.push(bIndex);\n\n /**\n * Removing indicator\n */\n button = button.replace(/\\]/g, \"\");\n }\n\n /**\n * Processing button options\n */\n const fctBtnClass = this.utilities.getButtonClass(button);\n const buttonDisplayName = this.utilities.getButtonDisplayName(\n button,\n this.options.display,\n this.options.mergeDisplay\n );\n\n /**\n * Creating button\n */\n const buttonType = this.options.useButtonTag ? \"button\" : \"div\";\n const buttonDOM = document.createElement(buttonType);\n buttonDOM.className += `hg-button ${fctBtnClass}`;\n\n /**\n * Adding buttonTheme\n */\n buttonDOM.classList.add(...this.getButtonThemeClasses(button));\n\n /**\n * Adding buttonAttributes\n */\n this.setDOMButtonAttributes(\n button,\n (attribute: string, value: string) => {\n buttonDOM.setAttribute(attribute, value);\n }\n );\n\n this.activeButtonClass = \"hg-activeButton\";\n\n /**\n * Handle button click event\n */\n /* istanbul ignore next */\n if (\n this.utilities.pointerEventsSupported() &&\n !useTouchEvents &&\n !useMouseEvents\n ) {\n /**\n * Handle PointerEvents\n */\n buttonDOM.onpointerdown = (e: KeyboardHandlerEvent) => {\n this.handleButtonClicked(button, e);\n this.handleButtonMouseDown(button, e);\n };\n buttonDOM.onpointerup = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n buttonDOM.onpointercancel = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n } else {\n /**\n * Fallback for browsers not supporting PointerEvents\n */\n if (useTouchEvents) {\n /**\n * Handle touch events\n */\n buttonDOM.ontouchstart = (e: KeyboardHandlerEvent) => {\n this.handleButtonClicked(button, e);\n this.handleButtonMouseDown(button, e);\n };\n buttonDOM.ontouchend = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n buttonDOM.ontouchcancel = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n } else {\n /**\n * Handle mouse events\n */\n buttonDOM.onclick = (e: KeyboardHandlerEvent) => {\n this.setMouseHold(false);\n /**\n * Fire button handler in onclick for compatibility reasons\n * This fires handler before onKeyReleased, therefore when that option is set we will fire the handler\n * in onmousedown instead\n */\n if (typeof this.options.onKeyReleased !== \"function\") {\n this.handleButtonClicked(button, e);\n }\n };\n buttonDOM.onmousedown = (e: KeyboardHandlerEvent) => {\n /**\n * Fire button handler for onKeyReleased use-case\n */\n if (\n typeof this.options.onKeyReleased === \"function\" &&\n !this.isMouseHold\n ) {\n this.handleButtonClicked(button, e);\n }\n this.handleButtonMouseDown(button, e);\n };\n buttonDOM.onmouseup = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n }\n }\n\n /**\n * Adding identifier\n */\n buttonDOM.setAttribute(\"data-skBtn\", button);\n\n /**\n * Adding unique id\n * Since there's no limit on spawning same buttons, the unique id ensures you can style every button\n */\n const buttonUID = `${this.options.layoutName}-r${rIndex}b${bIndex}`;\n buttonDOM.setAttribute(\"data-skBtnUID\", buttonUID);\n\n /**\n * Adding button label to button\n */\n const buttonSpanDOM = document.createElement(\"span\");\n buttonSpanDOM.innerHTML = buttonDisplayName;\n buttonDOM.appendChild(buttonSpanDOM);\n\n /**\n * Adding to buttonElements\n */\n if (!this.buttonElements[button]) this.buttonElements[button] = [];\n\n this.buttonElements[button].push(buttonDOM);\n\n /**\n * Appending button to row\n */\n rowDOM.appendChild(buttonDOM);\n });\n\n /**\n * Parse containers in row\n */\n rowDOM = this.parseRowDOMContainers(\n rowDOM,\n rIndex,\n containerStartIndexes,\n containerEndIndexes\n );\n\n /**\n * Appending row to hg-rows\n */\n this.keyboardRowsDOM.appendChild(rowDOM);\n }\n );\n\n /**\n * Appending row to keyboard\n */\n this.keyboardDOM.appendChild(this.keyboardRowsDOM);\n\n /**\n * Calling onRender\n */\n this.onRender();\n\n if (!this.initialized) {\n /**\n * Ensures that onInit and beforeFirstRender are only called once per instantiation\n */\n this.initialized = true;\n\n /**\n * Handling parent events\n */\n /* istanbul ignore next */\n if (\n this.utilities.pointerEventsSupported() &&\n !useTouchEvents &&\n !useMouseEvents\n ) {\n document.onpointerup = (e: KeyboardHandlerEvent) =>\n this.handleButtonMouseUp(undefined, e);\n this.keyboardDOM.onpointerdown = (e: KeyboardHandlerEvent) =>\n this.handleKeyboardContainerMouseDown(e);\n } else if (useTouchEvents) {\n /**\n * Handling ontouchend, ontouchcancel\n */\n document.ontouchend = (e: KeyboardHandlerEvent) =>\n this.handleButtonMouseUp(undefined, e);\n document.ontouchcancel = (e: KeyboardHandlerEvent) =>\n this.handleButtonMouseUp(undefined, e);\n\n this.keyboardDOM.ontouchstart = (e: KeyboardHandlerEvent) =>\n this.handleKeyboardContainerMouseDown(e);\n } else if (!useTouchEvents) {\n /**\n * Handling mouseup\n */\n document.onmouseup = (e: KeyboardHandlerEvent) =>\n this.handleButtonMouseUp(undefined, e);\n this.keyboardDOM.onmousedown = (e: KeyboardHandlerEvent) =>\n this.handleKeyboardContainerMouseDown(e);\n }\n\n /**\n * Calling onInit\n */\n this.onInit();\n }\n }\n}\n\nexport default SimpleKeyboard;\n","export const getDefaultLayout = () => {\n return {\n default: [\n \"` 1 2 3 4 5 6 7 8 9 0 - = {bksp}\",\n \"{tab} q w e r t y u i o p [ ] \\\\\",\n \"{lock} a s d f g h j k l ; ' {enter}\",\n \"{shift} z x c v b n m , . / {shift}\",\n \".com @ {space}\",\n ],\n shift: [\n \"~ ! @ # $ % ^ & * ( ) _ + {bksp}\",\n \"{tab} Q W E R T Y U I O P { } |\",\n '{lock} A S D F G H J K L : \" {enter}',\n \"{shift} Z X C V B N M < > ? {shift}\",\n \".com @ {space}\",\n ],\n };\n};\n","import SimpleKeyboard from \"./components/Keyboard\";\nexport { SimpleKeyboard };\nexport default SimpleKeyboard;\n"],"names":["root","factory","exports","module","define","amd","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","Utilities","_ref","getOptions","getCaretPosition","getCaretPositionEnd","dispatch","_classCallCheck","_defineProperty","button","length","bindMethods","includes","buttonTypeClass","getButtonType","buttonWithoutBraces","replace","buttonNormalized","concat","display","arguments","undefined","assign","getDefaultDiplay","input","caretPos","caretPosEnd","moveCaret","options","commonParams","output","removeAt","apply","removeForwardsAt","addStringAt","tabCharOnTab","newLineOnEnter","Number","isInteger","debug","console","log","minus","newCaretPos","updateCaretPosAction","instance","setCaretPosition","caretPosition","source","str","position","positionEnd","slice","join","isMaxLengthReached","updateCaretPos","emojiMatchedReg","substring","match","substr","inputObj","updatedInput","maxLength","currentInput","inputName","condition","maxLengthReached","_typeof","Boolean","window","navigator","maxTouchPoints","PointerEvent","toLowerCase","trim","split","reduce","word","toUpperCase","arr","size","_toConsumableArray","Array","Math","ceil","map","_","i","index","newIndex","startMarkerIndex","indexOf","myClass","_step","_iterator","_createForOfIteratorHelper","getOwnPropertyNames","s","n","done","myMethod","bind","err","e","f","PhysicalKeyboard","_this","altKey","ctrlKey","shiftKey","code","keyCodeToKey","keyCode","physicalKeyboardHighlightPreventDefault","isModifierKey","preventDefault","stopImmediatePropagation","buttonPressed","getSimpleKeyboardLayoutKey","buttonDOM","buttonName","standardButtonPressed","getButtonElement","functionButtonPressed","_buttonDOM$","_buttonDOM$$onpointer","_buttonDOM","_buttonDOM$onpointerd","applyButtonStyle","buttonElement","style","background","physicalKeyboardHighlightBgColor","color","physicalKeyboardHighlightTextColor","isArray","forEach","physicalKeyboardHighlightPress","physicalKeyboardHighlightPressUsePointerEvents","onpointerdown","physicalKeyboardHighlightPressUseClick","_buttonDOM$2","click","handleButtonClicked","_buttonDOM$3","_buttonDOM$3$onpointe","_buttonDOM$onpointeru","removeAttribute","onpointerup","_output","keyId","CandidateBox","utilities","pageSize","layoutCandidatesPageSize","candidateBoxElement","remove","pageIndex","_ref2","candidateValue","targetElement","onSelect","candidateListPages","chunkArray","renderPage","nbPages","onItemSelected","selectedCandidate","destroy","_ref3","_this$candidateBoxEle","_this2","document","createElement","className","candidateListULElement","candidateListItem","_this2$options$displa","candidateListLIElement","getMouseEvent","mouseEvent","useTouchEvents","TouchEvent","MouseEvent","innerHTML","ontouchstart","onclick","appendChild","isPrevBtnElementActive","prevBtnElement","classList","add","prevBtnElementClickAction","isNextBtnElementActive","nextBtnElement","nextBtnElementClickAction","prepend","SimpleKeyboard","selectorOrOptions","keyboardOptions","keyboardDOMClass","keyboardDOM","querySelector","HTMLDivElement","warn","Error","caretPositionEnd","name","initCallback","modules","_len","baseDOMClasses","_key","filter","DOMClass","_this$handleParams","handleParams","_this$handleParams$op","_objectSpread","layoutName","theme","preventMouseDownDefault","enableLayoutCandidates","excludeFromLayout","keyboardPluginClasses","_this$options$inputNa","defaultName","buttonElements","currentInstanceName","camelCase","allKeyboardInstances","keyboardInstanceNames","keys","isFirstKeyboardInstance","physicalKeyboard","candidateBox","render","loadModules","endPosition","_this$options","layoutCandidatesObj","layoutCandidates","layoutCandidatesCaseSensitiveMatch","layoutCandidate","inputSubstr","regexp","RegExp","escapeRegex","matchAll","candidateKey","sort","a","b","_this3","show","_this3$options","disableCandidateNormalization","enableLayoutCandidatesKeyPress","candidateStr","normalize","beforeInputUpdate","getInput","initialCaretPosition","newInputSubstr","newInput","caretPositionDiff","newCaretPosition","setInput","onKeyPress","onChange","onChangeAll","getAllInputs","_this$options2","_this$options2$inputN","getUpdatedInput","isStandardButton","activeInputElement","setSelectionRange","inputPattern","inputPatternIsValid","handleMaxLength","newInputValue","type","syncInstanceInputs","target","_this$candidateBox","_this$getInputCandida","getInputCandidates","showCandidatesBox","isMouseHold","_this4","stopMouseDownPropagation","stopPropagation","activeButtonClass","holdInteractionTimeout","clearTimeout","holdTimeout","setMouseHold","disableButtonHold","setTimeout","getMouseHold","handleButtonHold","_this5","preventMouseUpDefault","stopMouseUpPropagation","contains","recurseButtons","onKeyReleased","_this6","_this7","replaceInput","skipSync","rtl","_this8","changedOptions","onSetOptions","newOptions","_this9","optionName","JSON","stringify","keyboardRowsDOM","setAttribute","callback","buttons","_this10","classNameItem","buttonTheme","classNameFound","buttonThemeArray","push","class","_this11","_this11$options","_buttonTheme","_this11$options$butto","filteredButtonArray","item","splice","buttonArr","inputVal","inputPatternRaw","didInputMatch","test","_this$options$physica","addEventListener","handleKeyUp","handleKeyDown","handleMouseUp","handleTouchEnd","handleSelectionChange","handleSelect","event","caretEventHandler","physicalKeyboardHighlight","handleHighlightKeyUp","handleHighlightKeyDown","userAgent","targetTagName","_this12","tagName","isKeyboard","path","some","_item$hasAttribute","hasAttribute","disableCaretPositioning","selectionStart","selectionEnd","getRtlOffset","fn","_this13","_this$options$physica2","removeEventListener","ontouchend","ontouchcancel","onmouseup","onpointercancel","onmousedown","resetRows","initialized","buttonClasses","themeObj","themeObjClasses","buttonAttributes","attrObj","attribute","processAutoTouchEvents","disableContextualWindow","oncontextmenu","autoUseTouchEvents","setEventListeners","onInit","isTouchDevice","onTouchDeviceDetected","beforeFirstRender","pointerEventsSupported","useMouseEvents","beforeRender","onRender","onModulesLoaded","_this14","KeyboardModule","keyboardModule","init","rowDOM","rowIndex","containerStartIndexes","containerEndIndexes","_this15","rowDOMArray","from","children","removedElements","startIndex","arrIndex","endIndex","updated_startIndex","updated_endIndex","containerDOM","containerUID","containedElements","element","_this16","layoutClass","layout","default","shift","useTouchEventsClass","disableRowButtonContainers","getKeyboardClassString","row","rIndex","rowArray","bIndex","_buttonDOM$classList","buttonHasContainerStart","buttonHasContainerEnd","fctBtnClass","getButtonClass","buttonDisplayName","getButtonDisplayName","mergeDisplay","buttonType","useButtonTag","getButtonThemeClasses","setDOMButtonAttributes","handleButtonMouseDown","handleButtonMouseUp","buttonUID","buttonSpanDOM","parseRowDOMContainers","handleKeyboardContainerMouseDown"],"sourceRoot":""}