{"version":3,"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"],"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","getOptions","getCaretPosition","getCaretPositionEnd","dispatch","button","length","bindMethods","includes","buttonTypeClass","getButtonType","buttonWithoutBraces","replace","buttonNormalized","display","mergeDisplay","assign","getDefaultDiplay","input","caretPos","caretPosEnd","moveCaret","options","commonParams","output","removeAt","removeForwardsAt","addStringAt","tabCharOnTab","newLineOnEnter","Number","isInteger","minus","newCaretPos","updateCaretPosAction","instance","setCaretPosition","caretPosition","debug","console","log","source","str","position","positionEnd","slice","join","isMaxLengthReached","updateCaretPos","emojiMatchedReg","substring","match","substr","nextTwoChars","emojiMatched","inputObj","updatedInput","maxLength","currentInput","inputName","condition","maxLengthReached","Boolean","window","navigator","maxTouchPoints","PointerEvent","toLowerCase","trim","split","reduce","word","toUpperCase","arr","size","Array","Math","ceil","map","_","i","myClass","getOwnPropertyNames","myMethod","bind","PhysicalKeyboard","event","buttonPressed","getSimpleKeyboardLayoutKey","buttonDOM","buttonName","standardButtonPressed","getButtonElement","functionButtonPressed","style","background","physicalKeyboardHighlightBgColor","color","physicalKeyboardHighlightTextColor","physicalKeyboardHighlightPress","physicalKeyboardHighlightPressUsePointerEvents","onpointerdown","physicalKeyboardHighlightPressUseClick","click","handleButtonClicked","removeAttribute","onpointerup","keyId","code","keyCodeToKey","keyCode","CandidateBox","utilities","pageSize","layoutCandidatesPageSize","candidateBoxElement","remove","pageIndex","candidateValue","targetElement","onSelect","candidateListPages","chunkArray","renderPage","nbPages","onItemSelected","selectedCandidate","e","destroy","document","createElement","className","candidateListULElement","forEach","candidateListItem","candidateListLIElement","getMouseEvent","mouseEvent","MouseEvent","textContent","onclick","appendChild","isPrevBtnElementActive","prevBtnElement","classList","add","isNextBtnElementActive","nextBtnElement","prepend","SimpleKeyboard","selectorOrOptions","keyboardOptions","keyboardDOMClass","keyboardDOM","querySelector","HTMLDivElement","warn","Error","caretPositionEnd","name","initCallback","modules","baseDOMClasses","keyboardClasses","filter","DOMClass","handleParams","layoutName","theme","preventMouseDownDefault","enableLayoutCandidates","excludeFromLayout","keyboardPluginClasses","defaultName","buttonElements","currentInstanceName","camelCase","allKeyboardInstances","keyboardInstanceNames","keys","isFirstKeyboardInstance","physicalKeyboard","candidateBox","render","loadModules","endPosition","layoutCandidatesObj","layoutCandidates","layoutCandidatesCaseSensitiveMatch","layoutCandidate","inputSubstr","regexp","RegExp","escapeRegex","matchAll","candidateKey","sort","a","b","show","candidateStr","disableCandidateNormalization","normalize","getInput","initialCaretPosition","newInputSubstr","newInput","caretPositionDiff","newCaretPosition","setInput","onChange","onChangeAll","getAllInputs","getUpdatedInput","isStandardButton","activeInputElement","setSelectionRange","onKeyPress","inputPattern","inputPatternIsValid","handleMaxLength","newInputValue","syncInstanceInputs","target","getInputCandidates","showCandidatesBox","isMouseHold","preventDefault","stopMouseDownPropagation","stopPropagation","activeButtonClass","holdInteractionTimeout","clearTimeout","holdTimeout","setMouseHold","disableButtonHold","setTimeout","getMouseHold","handleButtonHold","preventMouseUpDefault","stopMouseUpPropagation","contains","recurseButtons","buttonElement","onKeyReleased","replaceInput","skipSync","rtl","inputWithoutRTLControl","changedOptions","onSetOptions","newOptions","optionName","JSON","stringify","keyboardRowsDOM","setAttribute","callback","buttons","classNameItem","buttonTheme","classNameFound","buttonThemeArray","push","class","isArray","index","filteredButtonArray","item","splice","buttonArr","inputVal","inputPatternRaw","didInputMatch","test","addEventListener","handleKeyUp","handleKeyDown","handleMouseUp","handleTouchEnd","handleSelect","handleSelectionChange","caretEventHandler","physicalKeyboardHighlight","handleHighlightKeyUp","handleHighlightKeyDown","targetTagName","tagName","isKeyboard","path","some","hasAttribute","type","disableCaretPositioning","selectionStart","selectionEnd","fn","removeEventListener","ontouchend","ontouchcancel","onmouseup","onpointercancel","ontouchstart","onmousedown","resetRows","innerHTML","initialized","buttonClasses","themeObj","themeObjClasses","buttonAttributes","attrObj","attribute","processAutoTouchEvents","disableContextualWindow","oncontextmenu","autoUseTouchEvents","useTouchEvents","setEventListeners","onInit","isTouchDevice","onTouchDeviceDetected","beforeFirstRender","pointerEventsSupported","useMouseEvents","beforeRender","onRender","onModulesLoaded","KeyboardModule","keyboardModule","init","rowDOM","rowIndex","containerStartIndexes","containerEndIndexes","rowDOMArray","from","children","removedElements","startIndex","arrIndex","endIndex","updated_startIndex","updated_endIndex","containerDOM","containerUID","containedElements","element","layoutClass","layout","default","shift","useTouchEventsClass","disableRowButtonContainers","getKeyboardClassString","row","rIndex","rowArray","bIndex","buttonHasContainerStart","indexOf","buttonHasContainerEnd","fctBtnClass","getButtonClass","buttonDisplayName","getButtonDisplayName","buttonType","useButtonTag","getButtonThemeClasses","setDOMButtonAttributes","handleButtonMouseDown","handleButtonMouseUp","buttonUID","buttonSpanDOM","parseRowDOMContainers","undefined","handleKeyboardContainerMouseDown"],"mappings":";;;;;;;;;;;;;;;CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAwB,eAAID,IAE5BD,EAAqB,eAAIC,GAC1B,CATD,CASGK,MAAM,WACT,O,wBCTA,IAAIC,E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,EAAKoP,yBAAoBI,EAAWxP,EADjB,EAErBhJ,KAAK0K,YAAYsJ,YAAc,SAAChL,GAAD,OAC7B,EAAKyP,iCAAiCzP,EADT,IArB/BE,SAASvB,YAAc,SAACqB,GAAD,OACrB,EAAKoP,yBAAoBI,EAAWxP,EADf,EAEvBhJ,KAAK0K,YAAYpD,cAAgB,SAAC0B,GAAD,OAC/B,EAAKyP,iCAAiCzP,EADP,GA0BnChJ,KAAKgV,SAER,I,sFAGH,IEj9DA,I","file":"index.modern.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[\"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: boolean\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: number,\n    caretPosEnd = caretPos,\n    moveCaret = false\n  ) {\n    const options = this.getOptions();\n    const commonParams: [number, number, 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    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<T>(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   * 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(event: KeyboardEvent) {\n    const options = this.getOptions();\n    const buttonPressed = this.getSimpleKeyboardLayoutKey(event);\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;\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      if (buttonDOM) {\n        buttonDOM.style.background =\n          options.physicalKeyboardHighlightBgColor || \"#dadce4\";\n        buttonDOM.style.color =\n          options.physicalKeyboardHighlightTextColor || \"black\";\n\n        if (options.physicalKeyboardHighlightPress) {\n          if (options.physicalKeyboardHighlightPressUsePointerEvents) {\n            buttonDOM.onpointerdown();\n          } else if (options.physicalKeyboardHighlightPressUseClick) {\n            buttonDOM.click();\n          } else {\n            instance.handleButtonClicked(buttonName, event);\n          }\n        }\n      }\n    });\n  }\n\n  handleHighlightKeyUp(event: KeyboardEvent) {\n    const options = this.getOptions();\n    const buttonPressed = this.getSimpleKeyboardLayoutKey(event);\n\n    this.dispatch((instance: any) => {\n      const buttonDOM =\n        instance.getButtonElement(buttonPressed) ||\n        instance.getButtonElement(`{${buttonPressed}}`);\n\n      if (buttonDOM && buttonDOM.removeAttribute) {\n        buttonDOM.removeAttribute(\"style\");\n        if (options.physicalKeyboardHighlightPressUsePointerEvents) {\n          buttonDOM.onpointerup();\n        }\n      }\n    });\n  }\n\n  /**\n   * Transforms a KeyboardEvent's \"key.code\" string into a simple-keyboard layout format\n   * @param  {object} event The KeyboardEvent\n   */\n  getSimpleKeyboardLayoutKey(event: KeyboardEvent) {\n    let output = \"\";\n    const keyId = event.code || event.key || this.keyCodeToKey(event?.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 = event.code || \"\";\n    } else {\n      output = event.key || this.keyCodeToKey(event?.keyCode) || \"\";\n    }\n\n    return output.length > 1 ? output?.toLowerCase() : output;\n  }\n\n  /**\n   * Retrieve key from keyCode\n   */\n  keyCodeToKey(keyCode: number) {\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\nexport default PhysicalKeyboard;\n","import \"./css/CandidateBox.css\";\n\nimport Utilities from \"../services/Utilities\";\nimport {\n  CandidateBoxParams,\n  CandidateBoxRenderParams,\n  CandidateBoxShowParams,\n} from \"./../interfaces\";\n\nclass CandidateBox {\n  utilities: Utilities;\n  candidateBoxElement!: HTMLDivElement;\n  pageIndex = 0;\n  pageSize;\n\n  constructor({ utilities }: CandidateBoxParams) {\n    this.utilities = utilities;\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 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.textContent = candidateListItem;\n      candidateListLIElement.onclick = (e = getMouseEvent()) =>\n        onItemSelected(candidateListItem, e);\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    prevBtnElement.onclick = () => {\n      if (!isPrevBtnElementActive) return;\n      this.renderPage({\n        candidateListPages,\n        targetElement,\n        pageIndex: pageIndex - 1,\n        nbPages,\n        onItemSelected,\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    nextBtnElement.onclick = () => {\n      if (!isNextBtnElementActive) return;\n      this.renderPage({\n        candidateListPages,\n        targetElement,\n        pageIndex: pageIndex + 1,\n        nbPages,\n        onItemSelected,\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: any;\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} 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(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     */\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        })\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<KeyboardOptions | undefined>;\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<string, never> {\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 { layoutCandidatesCaseSensitiveMatch, disableCandidateNormalization } = 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          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          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     * 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        );\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    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);\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<KeyboardOptions>): 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        });\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      /**\n       * Event Listeners\n       */\n      document.addEventListener(\"keyup\", this.handleKeyUp);\n      document.addEventListener(\"keydown\", this.handleKeyDown);\n      document.addEventListener(\"mouseup\", this.handleMouseUp);\n      document.addEventListener(\"touchend\", this.handleTouchEnd);\n      document.addEventListener(\"select\", this.handleSelect);\n      document.addEventListener(\"selectionchange\", this.handleSelectionChange);\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    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        instance.setCaretPosition(\n          event.target.selectionStart,\n          event.target.selectionEnd\n        );\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          );\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    /**\n     * Remove document listeners\n     */\n    document.removeEventListener(\"keyup\", this.handleKeyUp);\n    document.removeEventListener(\"keydown\", this.handleKeyDown);\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, rIndex) => {\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"],"sourceRoot":""}