decord/beta/source/utils/web/KeyboardLayoutMapUtils.tsx

1498 lines
45 KiB
TypeScript
Raw Normal View History

2026-10-07 22:43:51 +00:00
// Module ID: 13882
// Function ID: 13883
// Name: KeyboardLayoutMapUtils
2026-10-07 22:43:51 +00:00
// Dependencies: [32, 5, 1357, 7013, 3, 1369, 13881, 510, 2]
// Exports: __DEV_overrideLayoutMapKey, getKeyboardEventShapeFromAny, getKeyboardEventShapeFromKey, getKeyboardEventShapeFromKeycode, getLayoutMap, initializeKeyboardMapper, resetKeyboardMapper
2026-10-07 22:43:51 +00:00
// Module 13882 (KeyboardLayoutMapUtils)
import LoggerDefault from "Logger" /* 3 */;
import Storage2 from "Storage" /* 510 */;
2026-10-07 22:43:51 +00:00
import keyCodeDefault from "keyCode" /* 13881 */;
2026-10-01 14:13:23 +00:00
import _slicedToArray_mod from "_slicedToArray" /* 32 */;
import _asyncToGenerator from "_asyncToGenerator" /* 5 */;
2026-10-07 22:43:51 +00:00
import DeveloperOptionsStore from "DeveloperOptionsStore" /* 1357 */;
import KeyboardConstants from "KeyboardConstants" /* 7013 */;
import PlatformUtils from "PlatformUtils" /* 1369 */;
2026-10-01 14:13:23 +00:00
import size from "module_2" /* 2 */;
2026-10-01 14:13:23 +00:00
let c1, c2, c4, c5;
let LinuxKeyToCode;
let MacosKeyToCode;
let WindowsKeyToCode;
2026-10-09 10:34:53 +00:00
const f115614 = (item) => {
2026-10-01 14:13:23 +00:00
let tmp;
[tmp, obj] = item;
const items = [tmp, ];
let toLocaleLowerCaseResult = obj;
if (null != obj) {
toLocaleLowerCaseResult = obj.toLocaleLowerCase();
}
items[1] = toLocaleLowerCaseResult;
return items;
};
function normalizeKey(toLocaleLowerCase) {
let toLocaleLowerCaseResult = toLocaleLowerCase;
if (null != toLocaleLowerCase) {
toLocaleLowerCaseResult = toLocaleLowerCase.toLocaleLowerCase();
}
return toLocaleLowerCaseResult;
}
function syncKeyboardLayoutMap() {
2026-10-01 14:13:23 +00:00
return obj(...arguments);
}
2026-10-01 14:13:23 +00:00
let obj = function _syncKeyboardLayoutMap() {
obj = _asyncToGenerator(async function(arg0, value) {
if (c5 === 2) {
c5 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
const obj2 = { value, done: true };
return obj2;
} else {
2026-10-02 13:37:24 +00:00
return { value: "IconComponent", done: null };
2026-10-01 14:13:23 +00:00
}
} else {
2026-10-01 14:13:23 +00:00
let c3;
try {
let closure_0;
c5 = 2;
if (0 === c4) {
if (arg0 === 1) {
c5 = 3;
throw value;
} else if (arg0 === 2) {
c5 = 3;
const obj3 = { value, done: true };
return obj3;
} else {
let closure_1 = tmp;
closure_0 = undefined;
const _navigator2 = navigator;
const keyboard2 = navigator.keyboard;
let getLayoutMap;
if (keyboard2 != null) {
getLayoutMap = keyboard2.getLayoutMap;
}
if (null != getLayoutMap) {
c3 = 1;
const _navigator = navigator;
c4 = 2;
c5 = 1;
const obj4 = { value: keyboard.getLayoutMap(), done: false };
return obj4;
}
}
} else if (1 === c4) {
c3 = 0;
const self2 = this;
let closure_10 = new closure_129_9();
} else if (arg0 === 1) {
c5 = 3;
throw value;
} else if (arg0 === 2) {
2026-10-01 14:13:23 +00:00
c3 = 0;
c5 = 3;
2026-10-01 14:13:23 +00:00
obj = { value, done: true };
return obj;
} else {
2026-10-01 14:13:23 +00:00
closure_0 = value;
const _Object = Object;
const self = this;
closure_10 = new closure_129_9(Object.fromEntries(closure_0.entries()));
c3 = 0;
c5 = 3;
return { value: true, done: true };
}
c5 = 3;
2026-10-01 14:13:23 +00:00
return { value: false, done: true };
} catch (tmp13) {
let closure_2 = tmp13;
if (0 === c3) {
c5 = 3;
throw tmp13;
} else {
c4 = 1;
}
}
}
2026-10-01 14:13:23 +00:00
});
return obj(...arguments);
};
function normalizeKeyMap(arg0) {
2026-10-01 14:13:23 +00:00
set = new Set();
obj = {};
const entries = Object.entries(arg0);
2026-10-01 14:13:23 +00:00
const tmp2 = entries[Symbol.iterator]();
while (tmp2 !== undefined) {
let tmp5 = _slicedToArray(tmp3, 2);
let tmp6 = tmp5[1];
let tmp8 = normalizeKey(tmp5[0]);
let tmp9 = tmp8;
if (set.has(tmp8)) {
if (null != obj[tmp9]) {
if (obj[tmp9] !== tmp6) {
let _HermesInternal = HermesInternal;
let errorResult = logger.error("Seperate keyCode mappings found for: " + tmp9);
continue;
}
}
}
let addResult = set.add(tmp9);
obj[tmp9] = tmp6;
}
return obj;
}
function getNormalizedEvent(keyCode) {
let tmp;
2026-10-01 14:13:23 +00:00
obj = { keyCode: keyCode.keyCode, key: tmp, code: keyCode.code };
tmp = undefined;
if (null != keyCode.key) {
let toLocaleLowerCaseResult = key;
if (null != keyCode.key) {
toLocaleLowerCaseResult = key.toLocaleLowerCase();
}
tmp = toLocaleLowerCaseResult;
}
return obj;
}
function getKeyboardMapper() {
2026-10-01 14:13:23 +00:00
let promise;
let tmp;
if (null == c17) {
2026-10-01 14:13:23 +00:00
tmp = null;
if (null == promise) {
2026-10-01 14:13:23 +00:00
let closure_0 = _asyncToGenerator(async function(arg0, value) {
closure_0 = arg0;
if (c4 === 2) {
c4 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
2026-10-01 14:13:23 +00:00
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
let obj2 = { value, done: true };
return obj2;
} else {
2026-10-02 13:37:24 +00:00
return { value: "IconComponent", done: null };
}
} else {
try {
c4 = 2;
if (0 === c3) {
if (arg0 === 1) {
c4 = 3;
throw value;
} else if (arg0 === 2) {
c4 = 3;
const obj3 = { value, done: true };
return obj3;
} else {
2026-10-01 14:13:23 +00:00
let closure_2 = tmp4;
let closure_1 = tmp;
c3 = 1;
c4 = 1;
const obj4 = { value: syncKeyboardLayoutMap(), done: false };
return obj4;
}
} else if (arg0 === 1) {
c4 = 3;
throw value;
} else if (arg0 === 2) {
c4 = 3;
2026-10-01 14:13:23 +00:00
obj = { value, done: true };
return obj;
} else {
2026-10-01 14:13:23 +00:00
const self = this;
let closure_17 = new KeyboardMapper(LinuxKeyToCode);
const _document = document;
2026-10-01 14:13:23 +00:00
const str = "keydown";
const listener = document.addEventListener("keydown", (event) => {
try {
2026-10-01 14:13:23 +00:00
obj = closure_1_17;
if (closure_1_17 != null) {
2026-10-01 14:13:23 +00:00
obj.addEvent(event);
}
2026-10-01 14:13:23 +00:00
} catch (tmp3) {
const obj2 = { event, error: tmp3 };
logger.error("KeyboardMapper - Error adding event", obj2);
}
});
2026-10-01 14:13:23 +00:00
closure_0();
c4 = 3;
2026-10-02 13:37:24 +00:00
return { value: "IconComponent", done: null };
}
2026-10-01 14:13:23 +00:00
} catch (tmp15) {
c4 = 3;
throw tmp15;
}
}
});
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
tmp = null;
promise = new Promise(function() {
2026-10-01 14:13:23 +00:00
return closure_0(...arguments);
});
}
} else {
tmp = c17;
}
return tmp;
}
2026-10-01 14:13:23 +00:00
obj = function _resetKeyboardMapper() {
obj = _asyncToGenerator(async (arg0, value) => {
if (c2 === 2) {
c2 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
} else if (tmp2 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
const obj2 = { value, done: true };
return obj2;
} else {
2026-10-02 13:37:24 +00:00
return { value: "IconComponent", done: null };
2026-10-01 14:13:23 +00:00
}
} else {
2026-10-01 14:13:23 +00:00
try {
c2 = 2;
if (0 === c1) {
if (arg0 === 1) {
c2 = 3;
throw value;
} else if (arg0 === 2) {
c2 = 3;
const obj3 = { value, done: true };
return obj3;
} else {
let closure_0 = tmp3;
c1 = 1;
c2 = 1;
const obj4 = { value: syncKeyboardLayoutMap(), done: false };
return obj4;
}
} else if (arg0 === 1) {
c2 = 3;
throw value;
} else if (arg0 === 2) {
c2 = 3;
2026-10-01 14:13:23 +00:00
const obj5 = { value, done: true };
return obj5;
} else {
2026-10-01 14:13:23 +00:00
obj = closure_128_19();
if (obj != null) {
obj.reset();
}
c2 = 3;
2026-10-02 13:37:24 +00:00
return { value: "IconComponent", done: null };
}
2026-10-01 14:13:23 +00:00
} catch (tmp9) {
c2 = 3;
2026-10-01 14:13:23 +00:00
throw tmp9;
}
}
2026-10-01 14:13:23 +00:00
});
return obj(...arguments);
};
function reverseLookupCodeFromKey(toLocaleLowerCase) {
2026-10-01 14:13:23 +00:00
let promise;
let tmp;
if (null != toLocaleLowerCase) {
let toLocaleLowerCaseResult = toLocaleLowerCase;
if (null != toLocaleLowerCase) {
toLocaleLowerCaseResult = toLocaleLowerCase.toLocaleLowerCase();
}
tmp = toLocaleLowerCaseResult;
}
if (null != tmp) {
2026-10-01 14:13:23 +00:00
let tmp4;
if (null == c17) {
2026-10-01 14:13:23 +00:00
tmp4 = null;
if (null == promise) {
2026-10-01 14:13:23 +00:00
let closure_0 = _asyncToGenerator(async function(arg0, value) {
closure_0 = arg0;
if (c4 === 2) {
c4 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
2026-10-01 14:13:23 +00:00
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
let obj2 = { value, done: true };
return obj2;
} else {
2026-10-02 13:37:24 +00:00
return { value: "IconComponent", done: null };
}
} else {
try {
c4 = 2;
if (0 === c3) {
if (arg0 === 1) {
c4 = 3;
throw value;
} else if (arg0 === 2) {
c4 = 3;
const obj3 = { value, done: true };
return obj3;
} else {
2026-10-01 14:13:23 +00:00
let closure_2 = tmp4;
let closure_1 = tmp;
c3 = 1;
c4 = 1;
const obj4 = { value: syncKeyboardLayoutMap(), done: false };
return obj4;
}
} else if (arg0 === 1) {
c4 = 3;
throw value;
} else if (arg0 === 2) {
c4 = 3;
2026-10-01 14:13:23 +00:00
obj = { value, done: true };
return obj;
} else {
2026-10-01 14:13:23 +00:00
const self = this;
let closure_17 = new KeyboardMapper(LinuxKeyToCode);
const _document = document;
2026-10-01 14:13:23 +00:00
const str = "keydown";
const listener = document.addEventListener("keydown", (event) => {
try {
2026-10-01 14:13:23 +00:00
obj = closure_1_17;
if (closure_1_17 != null) {
2026-10-01 14:13:23 +00:00
obj.addEvent(event);
}
2026-10-01 14:13:23 +00:00
} catch (tmp3) {
const obj2 = { event, error: tmp3 };
logger.error("KeyboardMapper - Error adding event", obj2);
}
});
2026-10-01 14:13:23 +00:00
closure_0();
c4 = 3;
2026-10-02 13:37:24 +00:00
return { value: "IconComponent", done: null };
}
2026-10-01 14:13:23 +00:00
} catch (tmp15) {
c4 = 3;
throw tmp15;
}
}
});
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
tmp4 = null;
promise = new Promise(function() {
2026-10-01 14:13:23 +00:00
return closure_0(...arguments);
});
}
} else {
tmp4 = c17;
}
let result;
if (tmp4 != null) {
result = tmp4.findCodeFromKeyboardLayoutMap(tmp);
}
return result;
}
}
2026-10-01 14:13:23 +00:00
function getExactKeyboardEventMatchFromAny(keyCode) {
let promise;
let tmp;
2026-10-01 14:13:23 +00:00
keyCode = keyCode.keyCode;
if (null != keyCode.key) {
let toLocaleLowerCaseResult = key;
2026-10-01 14:13:23 +00:00
if (null != keyCode.key) {
toLocaleLowerCaseResult = key.toLocaleLowerCase();
}
tmp = toLocaleLowerCaseResult;
}
let tmp4 = null;
if (null != tmp) {
2026-10-01 14:13:23 +00:00
let tmp6;
if (null == c17) {
2026-10-01 14:13:23 +00:00
tmp6 = null;
if (null == promise) {
2026-10-01 14:13:23 +00:00
let closure_0 = _asyncToGenerator(async function(arg0, value) {
closure_0 = arg0;
if (c4 === 2) {
c4 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
2026-10-01 14:13:23 +00:00
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
let obj2 = { value, done: true };
return obj2;
} else {
2026-10-02 13:37:24 +00:00
return { value: "IconComponent", done: null };
}
} else {
try {
c4 = 2;
if (0 === c3) {
if (arg0 === 1) {
c4 = 3;
throw value;
} else if (arg0 === 2) {
c4 = 3;
const obj3 = { value, done: true };
return obj3;
} else {
2026-10-01 14:13:23 +00:00
let closure_2 = tmp4;
let closure_1 = tmp;
c3 = 1;
c4 = 1;
const obj4 = { value: syncKeyboardLayoutMap(), done: false };
return obj4;
}
} else if (arg0 === 1) {
c4 = 3;
throw value;
} else if (arg0 === 2) {
c4 = 3;
2026-10-01 14:13:23 +00:00
obj = { value, done: true };
return obj;
} else {
2026-10-01 14:13:23 +00:00
const self = this;
let closure_17 = new KeyboardMapper(LinuxKeyToCode);
const _document = document;
2026-10-01 14:13:23 +00:00
const str = "keydown";
const listener = document.addEventListener("keydown", (event) => {
try {
2026-10-01 14:13:23 +00:00
obj = closure_1_17;
if (closure_1_17 != null) {
2026-10-01 14:13:23 +00:00
obj.addEvent(event);
}
2026-10-01 14:13:23 +00:00
} catch (tmp3) {
const obj2 = { event, error: tmp3 };
logger.error("KeyboardMapper - Error adding event", obj2);
}
});
2026-10-01 14:13:23 +00:00
closure_0();
c4 = 3;
2026-10-02 13:37:24 +00:00
return { value: "IconComponent", done: null };
}
2026-10-01 14:13:23 +00:00
} catch (tmp15) {
c4 = 3;
throw tmp15;
}
}
});
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
tmp6 = null;
promise = new Promise(function() {
2026-10-01 14:13:23 +00:00
return closure_0(...arguments);
});
}
} else {
tmp6 = c17;
}
let result;
if (tmp6 != null) {
2026-10-01 14:13:23 +00:00
result = tmp6.findExactKeyboardEventMatch(tmp, tmp3, keyCode);
}
if (result == null) {
result = null;
}
tmp4 = result;
}
return tmp4;
}
2026-10-01 14:13:23 +00:00
let _slicedToArray = _slicedToArray_mod;
({ LinuxKeyToCode, MacosKeyToCode, WindowsKeyToCode } = KeyboardConstants);
2026-10-01 14:13:23 +00:00
let tmp3 = new LoggerDefault("KeyboardLayoutMapUtils");
const hasOwnProperty = tmp3;
if (!PlatformUtils.isLinux()) {
2026-10-01 14:13:23 +00:00
const _module2 = PlatformUtils;
if (!_module2.isMac()) {
const _module3 = PlatformUtils;
if (!_module3.isWindows()) {
WindowsKeyToCode = keyCodeDefault.codes;
}
MacosKeyToCode = WindowsKeyToCode;
}
LinuxKeyToCode = MacosKeyToCode;
}
function initializeKeyboardMapper() {
2026-10-01 14:13:23 +00:00
let promise;
if (null == promise) {
2026-10-01 14:13:23 +00:00
let closure_0 = _asyncToGenerator(async function(arg0, value) {
closure_0 = arg0;
if (c4 === 2) {
c4 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
2026-10-01 14:13:23 +00:00
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
let obj2 = { value, done: true };
return obj2;
} else {
2026-10-02 13:37:24 +00:00
return { value: "IconComponent", done: null };
}
} else {
try {
c4 = 2;
if (0 === c3) {
if (arg0 === 1) {
c4 = 3;
throw value;
} else if (arg0 === 2) {
c4 = 3;
const obj3 = { value, done: true };
return obj3;
} else {
2026-10-01 14:13:23 +00:00
let closure_2 = tmp4;
let closure_1 = tmp;
c3 = 1;
c4 = 1;
const obj4 = { value: syncKeyboardLayoutMap(), done: false };
return obj4;
}
} else if (arg0 === 1) {
c4 = 3;
throw value;
} else if (arg0 === 2) {
c4 = 3;
2026-10-01 14:13:23 +00:00
obj = { value, done: true };
return obj;
} else {
2026-10-01 14:13:23 +00:00
const self = this;
let closure_17 = new KeyboardMapper(LinuxKeyToCode);
const _document = document;
2026-10-01 14:13:23 +00:00
const str = "keydown";
const listener = document.addEventListener("keydown", (event) => {
try {
2026-10-01 14:13:23 +00:00
obj = closure_1_17;
if (closure_1_17 != null) {
2026-10-01 14:13:23 +00:00
obj.addEvent(event);
}
2026-10-01 14:13:23 +00:00
} catch (tmp3) {
const obj2 = { event, error: tmp3 };
logger.error("KeyboardMapper - Error adding event", obj2);
}
});
2026-10-01 14:13:23 +00:00
closure_0();
c4 = 3;
2026-10-02 13:37:24 +00:00
return { value: "IconComponent", done: null };
}
2026-10-01 14:13:23 +00:00
} catch (tmp15) {
c4 = 3;
throw tmp15;
}
}
});
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
promise = new Promise(function() {
2026-10-01 14:13:23 +00:00
return closure_0(...arguments);
});
}
return promise;
}
2026-10-01 14:13:23 +00:00
let set = new Set([192, 220, 222, 223, 229]);
const frozen = Object.freeze({ KeyA: "a", KeyB: "b", KeyC: "c", KeyD: "d", KeyE: "e", KeyF: "f", KeyG: "g", KeyH: "h", KeyI: "i", KeyJ: "j", KeyK: "k", KeyL: "l", KeyM: "m", KeyN: "n", KeyO: "o", KeyP: "p", KeyQ: "q", KeyR: "r", KeyS: "s", KeyT: "t", KeyU: "u", KeyV: "v", KeyW: "w", KeyX: "x", KeyY: "y", KeyZ: "z", Digit0: "0", Digit1: "1", Digit2: "2", Digit3: "3", Digit4: "4", Digit5: "5", Digit6: "6", Digit7: "7", Digit8: "8", Digit9: "9", Backquote: "`", Backslash: "\\", Quote: "'", Slash: "/", Comma: ",", Period: ".", Semicolon: ";", Equal: "=", Minus: "-", BracketLeft: "[", BracketRight: "]", IntlBackslash: "\u00A7" });
class DiscordKeyboardLayoutMap {
constructor() {
2026-10-01 14:13:23 +00:00
let tmp = arg0;
if (arg0 === undefined) {
tmp = frozen;
}
obj = Object.create(new.target.prototype);
2026-10-01 14:13:23 +00:00
const entries = Object.entries(tmp);
2026-10-09 10:34:53 +00:00
obj.map = new Map(entries.map(f115614));
new Map(entries.map(f115614));
return obj;
}
2026-10-01 14:13:23 +00:00
get(arg0) {
map = this.map;
return map.get(arg0);
}
has(arg0) {
map = this.map;
return map.has(arg0);
}
keys() {
map = this.map;
return map.keys();
}
values() {
map = this.map;
return map.values();
}
entries() {
map = this.map;
return map.entries();
}
forEach(arg0, arg1) {
map = this.map;
return map.forEach(arg0, arg1);
}
_set(arg0, arg1) {
map = this.map;
const result = map.set(arg0, arg1);
}
}
2026-10-01 14:13:23 +00:00
Object.defineProperty(DiscordKeyboardLayoutMap.prototype, "size", {
get: function size() {
return this.map.size;
},
set: undefined
});
2026-10-01 14:13:23 +00:00
obj = Object.create(DiscordKeyboardLayoutMap.prototype);
let entries = Object.entries(frozen);
2026-10-09 10:34:53 +00:00
let map = new Map(entries.map(f115614));
2026-10-01 14:13:23 +00:00
obj.map = map;
let c15 = "keyboard-layout-map";
class BaseKeyboardMapper {
constructor() {
2026-10-01 14:13:23 +00:00
obj = arg0;
if (arg0 === undefined) {
obj = {};
}
2026-10-01 14:13:23 +00:00
const merged = Object.assign({ _internalKeyLayoutMap: null, _cachedKeyCodeMapEntries: null, _cachedKeyMapEntries: null, _cachedKeyLayoutMapEntries: null, _cachedAllEvents: null });
merged[1] = [];
merged[2] = [];
merged[3] = [];
merged[4] = [];
merged._defaultKeyMap = obj;
2026-10-01 14:13:23 +00:00
const Storage = Storage2.Storage;
let value = Storage.get(c15);
if (value == null) {
value = null;
}
if (null == value) {
2026-10-01 14:13:23 +00:00
const obj2 = {};
const merged1 = Object.assign(obj);
value = normalizeKeyMap(obj2);
}
merged.keyMap = value;
2026-10-01 14:13:23 +00:00
const result = merged._initializeInternalLayoutMap();
merged.keyCodeMap = merged._buildKeyCodeMapFromKeyMap();
2026-10-01 14:13:23 +00:00
merged.updateCaches();
merged.save();
return merged;
}
2026-10-01 14:13:23 +00:00
_setCachedKeyCodeMapEntries() {
const entries = Object.entries(this.keyCodeMap);
this._cachedKeyCodeMapEntries = entries.map((item) => {
let tmp;
let tmp2;
[tmp, tmp2] = item;
const items = [Number(tmp), tmp2];
return items;
});
const _cachedKeyCodeMapEntries = this._cachedKeyCodeMapEntries;
this._cachedAllEvents = _cachedKeyCodeMapEntries.flatMap((item) => {
let tmp;
[, tmp] = item;
return tmp;
});
}
_setCachedKeyMapEntries() {
this._cachedKeyMapEntries = Object.entries(this.keyMap);
}
_setCachedKeyLayoutMapEntries() {
const layoutMap = this.getLayoutMap();
this._cachedKeyLayoutMapEntries = from(layoutMap.entries());
}
getKeyCodeMapItem(keyCode) {
const self = this;
if (null == this.keyCodeMap[keyCode]) {
self.keyCodeMap[keyCode] = [];
}
return self.keyCodeMap[keyCode];
}
_buildKeyCodeMapFromKeyMap() {
let tmp6;
let tmp7;
const self = this;
obj = {};
const entries = Object.entries(this.keyMap);
const tmp2 = entries[Symbol.iterator]();
while (tmp2 !== undefined) {
let tmp5 = _slicedToArray(tmp3, 2);
[tmp6, tmp7] = tmp5;
let tmp8 = tmp7;
let items = obj[tmp7];
if (items == null) {
items = [];
}
obj[tmp7] = items;
let arr2 = obj[tmp8];
let obj2 = { keyCode: tmp8, key: tmp6, code: self.findCodeFromKeyboardLayoutMap(tmp6, true) };
let push = arr2.push;
let arr = push(obj2);
continue;
}
return obj;
}
_initializeInternalLayoutMap() {
this._internalKeyLayoutMap = new Map(Array.from(obj.entries()));
new Map(Array.from(obj.entries()));
const result = this._setCachedKeyLayoutMapEntries();
}
_hasExactMatch(keyCode) {
if (null == keyCode.keyCode) {
return false;
} else {
const self = this;
const tmp = null != obj && obj.some((key) => key.key === keyCode.key && key.code === keyCode.code && key.keyCode === keyCode.keyCode);
return tmp;
}
}
addEvent(keyCode) {
let tmp;
obj = { keyCode: keyCode.keyCode, key: tmp, code: keyCode.code };
tmp = undefined;
if (null != keyCode.key) {
let toLocaleLowerCaseResult = key;
if (null != keyCode.key) {
toLocaleLowerCaseResult = key.toLocaleLowerCase();
}
tmp = toLocaleLowerCaseResult;
}
const self = this;
if (null == this._internalKeyLayoutMap) {
const result = self._initializeInternalLayoutMap();
}
if (!self._hasExactMatch(obj)) {
const tmp4 = null != obj.key && "dead" !== obj.key;
if (tmp4) {
if (null == self.keyMap[obj.key]) {
self.keyMap[obj.key] = obj.keyCode;
} else {
const logKeyboardMismatches = self.keyMap[obj.key] !== obj.keyCode && DeveloperOptionsStore.logKeyboardMismatches;
if (logKeyboardMismatches) {
const _HermesInternal = HermesInternal;
logger.error("KeyboardMapper - Key code mismatch for key " + obj.key + ": " + self.keyMap[obj.key] + " !== " + obj.keyCode);
}
}
let items = self.keyCodeMap[obj.keyCode];
const keyCodeMap = self.keyCodeMap;
keyCode = obj.keyCode;
if (items == null) {
items = [];
}
keyCodeMap[keyCode] = items;
const arr2 = self.keyCodeMap[obj.keyCode];
arr2.push(obj);
const _internalKeyLayoutMap = self._internalKeyLayoutMap;
if (_internalKeyLayoutMap != null) {
const result1 = _internalKeyLayoutMap.set(obj.code, obj.key);
}
self.updateCaches();
}
}
}
updateCaches() {
const result = this._setCachedKeyCodeMapEntries();
const result1 = this._setCachedKeyMapEntries();
const result2 = this._setCachedKeyLayoutMapEntries();
}
reset() {
this._internalKeyLayoutMap = null;
obj = {};
const merged = Object.assign(this._defaultKeyMap);
this.keyMap = normalizeKeyMap(obj);
const result = this._initializeInternalLayoutMap();
this.keyCodeMap = this._buildKeyCodeMapFromKeyMap();
this.updateCaches();
this.save();
}
save() {
const keyMap = this.keyMap;
const Storage = Storage2.Storage;
const result = Storage.set(c15, keyMap);
}
getLayoutMap() {
return null == this._internalKeyLayoutMap ? obj : this._internalKeyLayoutMap;
}
getKeyCode(arg0) {
return this.keyMap[arg0];
}
findCodeFromKeyboardLayoutMap(toLocaleLowerCaseResult, arg1) {
let flag = arg1;
if (arg1 === undefined) {
flag = false;
}
let c0;
let prop = this.cachedKeyLayoutMapEntries;
if (flag) {
const tmp = globalThis;
const _Array = Array;
prop = Array.from(obj.entries());
}
if (null != toLocaleLowerCaseResult) {
toLocaleLowerCaseResult = toLocaleLowerCaseResult.toLocaleLowerCase();
}
c0 = toLocaleLowerCaseResult;
const found = prop.find((item) => {
let tmp;
[, tmp] = item;
return tmp === c0;
});
let first;
if (found != null) {
first = found[0];
}
if (first == null) {
first = toLocaleLowerCaseResult;
}
return first;
}
}
2026-10-01 14:13:23 +00:00
const prototype = BaseKeyboardMapper.prototype;
Object.defineProperty(prototype, "cachedKeyCodeMapEntries", {
get: function cachedKeyCodeMapEntries() {
const self = this;
if (0 === this._cachedKeyCodeMapEntries.length) {
const result = self._setCachedKeyCodeMapEntries();
}
return self._cachedKeyCodeMapEntries;
},
set: undefined
});
2026-10-01 14:13:23 +00:00
Object.defineProperty(prototype, "cachedKeyMapEntries", {
get: function cachedKeyMapEntries() {
const self = this;
if (0 === this._cachedKeyMapEntries.length) {
const result = self._setCachedKeyMapEntries();
}
return self._cachedKeyMapEntries;
},
set: undefined
});
2026-10-01 14:13:23 +00:00
Object.defineProperty(prototype, "cachedKeyLayoutMapEntries", {
get: function cachedKeyLayoutMapEntries() {
const self = this;
if (0 === this._cachedKeyLayoutMapEntries.length) {
const result = self._setCachedKeyLayoutMapEntries();
}
return self._cachedKeyLayoutMapEntries;
},
set: undefined
});
2026-10-01 14:13:23 +00:00
Object.defineProperty(prototype, "cachedAllEvents", {
get: function cachedAllEvents() {
const self = this;
if (0 === this._cachedAllEvents.length) {
const result = self._setCachedKeyCodeMapEntries();
}
return self._cachedAllEvents;
},
set: undefined
});
2026-10-01 14:13:23 +00:00
class KeyboardMapper extends BaseKeyboardMapper {
getKeyString(keyCode, code) {
const self = this;
2026-10-01 14:13:23 +00:00
let closure_1 = keyCode;
let closure_0 = code;
let keyCodeMapItem = this.getKeyCodeMapItem(keyCode);
if (0 === keyCodeMapItem.length) {
const cachedKeyMapEntries = this.cachedKeyMapEntries;
const found = cachedKeyMapEntries.filter((item) => {
let tmp;
[, tmp] = item;
return tmp == tmp;
});
keyCodeMapItem = found.map((item) => {
let result;
let tmp;
let tmp2;
[tmp, tmp2] = item;
obj = { key: tmp, keyCode: tmp2, code: result };
result = code;
if (code == null) {
result = self.findCodeFromKeyboardLayoutMap(tmp);
}
return obj;
});
}
2026-10-01 14:13:23 +00:00
const found1 = keyCodeMapItem.find((keyCode) => {
let tmp3 = tmp;
if (null != code) {
tmp3 = keyCode.keyCode === keyCode && keyCode.code === tmp2;
}
return tmp3;
});
let key;
if (found1 != null) {
key = found1.key;
}
return key;
}
2026-10-01 14:13:23 +00:00
findExactKeyboardEventMatch(toLocaleLowerCaseResult, arg1, keyCode) {
let tmp = arg1;
let closure_0 = arg1;
let closure_1 = keyCode;
if (null != toLocaleLowerCaseResult) {
toLocaleLowerCaseResult = toLocaleLowerCaseResult.toLocaleLowerCase();
}
2026-10-01 14:13:23 +00:00
const self = this;
_slicedToArray = toLocaleLowerCaseResult;
if (null == tmp) {
const result = self.findCodeFromKeyboardLayoutMap(toLocaleLowerCaseResult);
closure_0 = result;
tmp = result;
}
if (null != keyCode) {
if (null != self.keyCodeMap[keyCode]) {
const found = arr.find((key) => {
_slicedToArray = key;
if (null != key.key) {
_slicedToArray = key.toLocaleLowerCase();
}
return _slicedToArray === _slicedToArray && key.code === closure_0;
});
if (null != found) {
return found;
}
}
2026-10-01 14:13:23 +00:00
}
if (null != keyCode) {
if (null != tmp) {
const cachedAllEvents = self.cachedAllEvents;
return cachedAllEvents.find((key) => {
_slicedToArray = key;
if (null != key.key) {
_slicedToArray = key.toLocaleLowerCase();
}
let tmp2 = key.keyCode === keyCode;
const code = key.code;
const tmp3 = closure_0;
if (tmp2) {
tmp2 = _slicedToArray === _slicedToArray;
}
if (tmp2) {
tmp2 = code === tmp3;
}
return tmp2;
});
}
}
}
2026-10-01 14:13:23 +00:00
getWeightedPossibleKeyStringMatches(keyString, result, keyCode) {
let closure_0 = keyString;
let closure_1 = result;
let closure_2 = keyCode;
const cachedAllEvents = this.cachedAllEvents;
const found = cachedAllEvents.filter((key) => {
let toLocaleLowerCaseResult = key;
if (null != key.key) {
toLocaleLowerCaseResult = key.toLocaleLowerCase();
}
let toLocaleLowerCaseResult1 = keyString;
obj = keyString;
if (null != keyString) {
toLocaleLowerCaseResult1 = obj.toLocaleLowerCase();
}
2026-10-01 14:13:23 +00:00
let tmp4 = null == keyCode || key.keyCode === tmp3;
const tmp6 = null == dependencyMap || key.code === tmp5;
if (tmp4) {
tmp4 = toLocaleLowerCaseResult === toLocaleLowerCaseResult1;
}
if (tmp4) {
tmp4 = tmp6;
}
return tmp4;
});
2026-10-01 14:13:23 +00:00
return found.sort((key, key2) => {
let toLocaleLowerCaseResult = key;
if (null != key.key) {
toLocaleLowerCaseResult = key.toLocaleLowerCase();
}
2026-10-01 14:13:23 +00:00
let toLocaleLowerCaseResult1 = keyString;
if (null != keyString) {
toLocaleLowerCaseResult1 = obj.toLocaleLowerCase();
}
2026-10-01 14:13:23 +00:00
let num = 0;
if (toLocaleLowerCaseResult === toLocaleLowerCaseResult1) {
num = 0.5;
}
let sum = num;
const tmp4 = null != dependencyMap && key.code === dependencyMap;
if (tmp4) {
sum = num + 0.3;
}
let sum1 = sum;
const tmp7 = null != keyCode && key.keyCode === keyCode;
if (tmp7) {
sum1 = sum + 0.2;
}
let toLocaleLowerCaseResult2 = key2;
if (null != key2.key) {
toLocaleLowerCaseResult2 = key2.toLocaleLowerCase();
}
let toLocaleLowerCaseResult3 = obj;
if (null != keyString) {
toLocaleLowerCaseResult3 = obj.toLocaleLowerCase();
}
let num4 = 0;
if (toLocaleLowerCaseResult2 === toLocaleLowerCaseResult3) {
num4 = 0.5;
}
let sum2 = num4;
const tmp11 = null != dependencyMap && key2.code === dependencyMap;
if (tmp11) {
sum2 = num4 + 0.3;
}
let sum3 = sum2;
const tmp13 = null != keyCode && key2.keyCode === keyCode;
if (tmp13) {
sum3 = sum2 + 0.2;
}
return sum3 - sum1;
});
}
2026-10-01 14:13:23 +00:00
findKeyboardEventByKey(keyString, code, keyCode) {
let tmp = code;
let closure_0 = code;
let toLocaleLowerCaseResult = keyString;
if (null != keyString) {
2026-10-01 14:13:23 +00:00
toLocaleLowerCaseResult = keyString.toLocaleLowerCase();
}
2026-10-01 14:13:23 +00:00
const self = this;
if (null == tmp) {
const result = self.findCodeFromKeyboardLayoutMap(toLocaleLowerCaseResult);
closure_0 = result;
tmp = result;
}
2026-10-01 14:13:23 +00:00
if (null != keyCode) {
if (null != self.keyCodeMap[keyCode]) {
const found = arr.find((key) => {
toLocaleLowerCaseResult = key;
if (null != key.key) {
toLocaleLowerCaseResult = key.toLocaleLowerCase();
}
return toLocaleLowerCaseResult === toLocaleLowerCaseResult && key.code === closure_0;
});
if (null != found) {
return found;
}
}
}
2026-10-01 14:13:23 +00:00
return _slicedToArray(self.getWeightedPossibleKeyStringMatches(keyString, tmp, keyCode), 1)[0];
}
2026-10-01 14:13:23 +00:00
findKeyboardEventByKeyCode(keyCode, code) {
let defaultKeyboardEventShape;
const self = this;
let closure_0 = keyCode;
let closure_1 = code;
let keyString = this.getKeyString(keyCode, code);
const tmp2 = null == keyString && null != code;
if (tmp2) {
const layoutMap = self.getLayoutMap();
keyString = layoutMap.get(code);
}
if (null == keyString) {
const keyCodeMapItem = self.getKeyCodeMapItem(keyCode);
const found = keyCodeMapItem.find((keyCode) => {
let tmp3 = tmp;
if (null != code) {
tmp3 = keyCode.keyCode === keyCode && keyCode.code === tmp2;
}
2026-10-01 14:13:23 +00:00
return tmp3;
});
let key;
if (found != null) {
key = found.key;
}
2026-10-01 14:13:23 +00:00
keyString = key;
}
2026-10-01 14:13:23 +00:00
if (null == keyString) {
defaultKeyboardEventShape = self.getDefaultKeyboardEventShape(undefined, keyCode, code);
} else {
defaultKeyboardEventShape = self.findKeyboardEventByKey(keyString, code, keyCode);
}
2026-10-01 14:13:23 +00:00
return defaultKeyboardEventShape;
}
2026-10-01 14:13:23 +00:00
getDefaultKeyboardEventShape(toLocaleLowerCase, keyCode, code) {
let tmp10;
let tmp7;
let closure_0 = keyCode;
let tmp;
if (null != toLocaleLowerCase) {
let toLocaleLowerCaseResult = toLocaleLowerCase;
if (null != toLocaleLowerCase) {
toLocaleLowerCaseResult = toLocaleLowerCase.toLocaleLowerCase();
}
2026-10-01 14:13:23 +00:00
tmp = toLocaleLowerCaseResult;
}
const self = this;
let result = code;
if (null != tmp) {
if (null != self.keyMap[tmp]) {
if (result == null) {
result = self.findCodeFromKeyboardLayoutMap(tmp);
}
const obj2 = { keyCode: self.keyMap[tmp], key: tmp10, code: result };
tmp10 = undefined;
if (null != tmp) {
2026-10-01 14:13:23 +00:00
let toLocaleLowerCaseResult1 = tmp;
if (null != tmp) {
toLocaleLowerCaseResult1 = tmp.toLocaleLowerCase();
}
tmp10 = toLocaleLowerCaseResult1;
}
2026-10-01 14:13:23 +00:00
return obj2;
}
2026-10-01 14:13:23 +00:00
} else if (null != keyCode) {
const cachedKeyMapEntries = self.cachedKeyMapEntries;
const found = cachedKeyMapEntries.find((item) => {
let tmp;
[, tmp] = item;
return tmp === keyCode;
});
let first;
if (found != null) {
first = found[0];
}
if (null != first) {
2026-10-01 14:13:23 +00:00
let result1 = result;
if (result == null) {
result1 = self.findCodeFromKeyboardLayoutMap(first);
}
obj = { keyCode, key: tmp7, code: result1 };
tmp7 = undefined;
if (null != first) {
2026-10-01 14:13:23 +00:00
let toLocaleLowerCaseResult2 = first;
if (null != first) {
toLocaleLowerCaseResult2 = first.toLocaleLowerCase();
}
tmp7 = toLocaleLowerCaseResult2;
}
2026-10-01 14:13:23 +00:00
return obj;
}
}
}
2026-10-01 14:13:23 +00:00
}
const prototype2 = KeyboardMapper.prototype;
let c17 = null;
let c18 = null;
let result = size.fileFinishedImporting("utils/web/KeyboardLayoutMapUtils.tsx");
2026-10-01 14:13:23 +00:00
const getLayoutMap_export = function getLayoutMap() {
let layoutMap;
let promise;
let flag = arg0;
if (arg0 === undefined) {
flag = false;
}
if (flag) {
2026-10-01 14:13:23 +00:00
layoutMap = obj;
} else {
2026-10-01 14:13:23 +00:00
let tmp3;
if (null == c17) {
2026-10-01 14:13:23 +00:00
tmp3 = null;
if (null == promise) {
2026-10-01 14:13:23 +00:00
let closure_0 = _asyncToGenerator(async function(arg0, value) {
closure_0 = arg0;
if (c4 === 2) {
c4 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
2026-10-01 14:13:23 +00:00
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
let obj2 = { value, done: true };
return obj2;
} else {
2026-10-02 13:37:24 +00:00
return { value: "IconComponent", done: null };
}
} else {
try {
c4 = 2;
if (0 === c3) {
if (arg0 === 1) {
c4 = 3;
throw value;
} else if (arg0 === 2) {
c4 = 3;
const obj3 = { value, done: true };
return obj3;
} else {
2026-10-01 14:13:23 +00:00
let closure_2 = tmp4;
let closure_1 = tmp;
c3 = 1;
c4 = 1;
const obj4 = { value: syncKeyboardLayoutMap(), done: false };
return obj4;
}
} else if (arg0 === 1) {
c4 = 3;
throw value;
} else if (arg0 === 2) {
c4 = 3;
2026-10-01 14:13:23 +00:00
obj = { value, done: true };
return obj;
} else {
2026-10-01 14:13:23 +00:00
const self = this;
let closure_17 = new KeyboardMapper(LinuxKeyToCode);
const _document = document;
2026-10-01 14:13:23 +00:00
const str = "keydown";
const listener = document.addEventListener("keydown", (event) => {
try {
2026-10-01 14:13:23 +00:00
obj = closure_1_17;
if (closure_1_17 != null) {
2026-10-01 14:13:23 +00:00
obj.addEvent(event);
}
2026-10-01 14:13:23 +00:00
} catch (tmp3) {
const obj2 = { event, error: tmp3 };
logger.error("KeyboardMapper - Error adding event", obj2);
}
});
2026-10-01 14:13:23 +00:00
closure_0();
c4 = 3;
2026-10-02 13:37:24 +00:00
return { value: "IconComponent", done: null };
}
2026-10-01 14:13:23 +00:00
} catch (tmp15) {
c4 = 3;
throw tmp15;
}
}
});
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
tmp3 = null;
promise = new Promise(function() {
2026-10-01 14:13:23 +00:00
return closure_0(...arguments);
});
}
} else {
tmp3 = c17;
}
layoutMap = undefined;
if (tmp3 != null) {
layoutMap = tmp3.getLayoutMap();
}
if (layoutMap == null) {
2026-10-01 14:13:23 +00:00
layoutMap = obj;
}
}
return layoutMap;
};
2026-10-01 14:13:23 +00:00
export const BACKTICK_CODES = set;
export const DefaultKeyboardLayout = frozen;
export { normalizeKeyMap };
export { initializeKeyboardMapper };
export const __DEV_overrideLayoutMapKey = function __DEV_overrideLayoutMapKey(arg0, arg1) {
obj._set(arg0, arg1);
if (c17 != null) {
const result = obj._initializeInternalLayoutMap();
}
const obj2 = c17;
if (c17 != null) {
obj2.updateCaches();
}
};
export { getKeyboardMapper };
export const resetKeyboardMapper = function resetKeyboardMapper() {
return obj(...arguments);
};
export { getLayoutMap_export as getLayoutMap };
export { reverseLookupCodeFromKey };
export { getExactKeyboardEventMatchFromAny };
export const getKeyboardEventShapeFromAny = function getKeyboardEventShapeFromAny(keyCode) {
2026-10-01 14:13:23 +00:00
let promise;
const tmp = getExactKeyboardEventMatchFromAny(keyCode);
if (null != tmp) {
return tmp;
} else {
2026-10-01 14:13:23 +00:00
let tmp2;
if (null == c17) {
2026-10-01 14:13:23 +00:00
const tmp3 = promise;
tmp2 = null;
if (null == promise) {
2026-10-01 14:13:23 +00:00
const tmp4 = globalThis;
let closure_0 = _asyncToGenerator(async function(arg0, value) {
closure_0 = arg0;
if (c4 === 2) {
c4 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
2026-10-01 14:13:23 +00:00
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
let obj2 = { value, done: true };
return obj2;
} else {
2026-10-02 13:37:24 +00:00
return { value: "IconComponent", done: null };
}
} else {
try {
c4 = 2;
if (0 === c3) {
if (arg0 === 1) {
c4 = 3;
throw value;
} else if (arg0 === 2) {
c4 = 3;
const obj3 = { value, done: true };
return obj3;
} else {
2026-10-01 14:13:23 +00:00
let closure_2 = tmp4;
let closure_1 = tmp;
c3 = 1;
c4 = 1;
const obj4 = { value: syncKeyboardLayoutMap(), done: false };
return obj4;
}
} else if (arg0 === 1) {
c4 = 3;
throw value;
} else if (arg0 === 2) {
c4 = 3;
2026-10-01 14:13:23 +00:00
obj = { value, done: true };
return obj;
} else {
2026-10-01 14:13:23 +00:00
const self = this;
let closure_17 = new KeyboardMapper(LinuxKeyToCode);
const _document = document;
2026-10-01 14:13:23 +00:00
const str = "keydown";
const listener = document.addEventListener("keydown", (event) => {
try {
2026-10-01 14:13:23 +00:00
obj = closure_1_17;
if (closure_1_17 != null) {
2026-10-01 14:13:23 +00:00
obj.addEvent(event);
}
2026-10-01 14:13:23 +00:00
} catch (tmp3) {
const obj2 = { event, error: tmp3 };
logger.error("KeyboardMapper - Error adding event", obj2);
}
});
2026-10-01 14:13:23 +00:00
closure_0();
c4 = 3;
2026-10-02 13:37:24 +00:00
return { value: "IconComponent", done: null };
}
2026-10-01 14:13:23 +00:00
} catch (tmp15) {
c4 = 3;
throw tmp15;
}
}
});
2026-10-01 14:13:23 +00:00
let self = this;
const self2 = this;
promise = new Promise(function() {
2026-10-01 14:13:23 +00:00
return closure_0(...arguments);
});
tmp2 = null;
}
} else {
tmp2 = c17;
}
if (null == tmp2) {
return null;
} else {
keyCode = keyCode.keyCode;
2026-10-01 14:13:23 +00:00
let tmp8;
if (null != keyCode.key) {
let toLocaleLowerCaseResult = key;
if (null != keyCode.key) {
toLocaleLowerCaseResult = key.toLocaleLowerCase();
}
2026-10-01 14:13:23 +00:00
tmp8 = toLocaleLowerCaseResult;
}
const code = keyCode.code;
2026-10-01 14:13:23 +00:00
if (null != tmp8) {
const result = tmp2.findKeyboardEventByKey(tmp8, code, keyCode);
if (null != result) {
return result;
}
}
if (null != keyCode) {
const result1 = tmp2.findKeyboardEventByKeyCode(keyCode, code);
if (null != result1) {
return result1;
}
}
return null;
}
}
};
export const getKeyboardEventShapeFromKey = function getKeyboardEventShapeFromKey(codeToKeyLanguageCorrection) {
2026-10-01 14:13:23 +00:00
let tmp;
if (null != codeToKeyLanguageCorrection) {
2026-10-01 14:13:23 +00:00
tmp = normalizeKey(codeToKeyLanguageCorrection);
}
2026-10-01 14:13:23 +00:00
if (null == tmp) {
return null;
} else {
2026-10-01 14:13:23 +00:00
const tmp12 = reverseLookupCodeFromKey(tmp);
const obj3 = getKeyboardMapper();
let result;
2026-10-01 14:13:23 +00:00
const tmp13 = getKeyboardMapper;
if (obj3 != null) {
2026-10-01 14:13:23 +00:00
result = obj3.findKeyboardEventByKey(tmp, tmp12);
}
if (result == null) {
result = null;
}
if (null != result) {
return result;
} else {
try {
2026-10-01 14:13:23 +00:00
const tmp13Result = tmp13();
let defaultKeyboardEventShape;
2026-10-01 14:13:23 +00:00
if (tmp13Result != null) {
defaultKeyboardEventShape = tmp13Result.getDefaultKeyboardEventShape(tmp, undefined, tmp12);
}
if (defaultKeyboardEventShape == null) {
defaultKeyboardEventShape = null;
}
if (null == defaultKeyboardEventShape) {
return null;
} else {
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
const keyboardEvent = new globalThis.KeyboardEvent("keydown", tmp5);
obj = { keyCode: null, key: null, code: null };
({ keyCode: obj2.keyCode, key: obj2.key, code: obj2.code } = keyboardEvent);
2026-10-01 14:13:23 +00:00
return getNormalizedEvent(obj);
}
} catch (err) {
2026-10-01 14:13:23 +00:00
return null;
}
}
}
};
export const getKeyboardEventShapeFromKeycode = function getKeyboardEventShapeFromKeycode(keyCode) {
2026-10-01 14:13:23 +00:00
obj = getKeyboardMapper();
let result;
2026-10-01 14:13:23 +00:00
const tmp = getKeyboardMapper;
if (obj != null) {
result = obj.findKeyboardEventByKeyCode(keyCode);
}
if (result == null) {
result = null;
}
if (null != result) {
return result;
} else {
try {
2026-10-01 14:13:23 +00:00
const tmpResult = tmp();
let defaultKeyboardEventShape;
2026-10-01 14:13:23 +00:00
if (tmpResult != null) {
defaultKeyboardEventShape = tmpResult.getDefaultKeyboardEventShape(undefined, keyCode);
}
if (defaultKeyboardEventShape == null) {
defaultKeyboardEventShape = null;
}
if (null == defaultKeyboardEventShape) {
return null;
} else {
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
const keyboardEvent = new globalThis.KeyboardEvent("keydown", tmp4);
const obj2 = { keyCode: null, key: null, code: null };
({ keyCode: obj3.keyCode, key: obj3.key, code: obj3.code } = keyboardEvent);
2026-10-01 14:13:23 +00:00
return getNormalizedEvent(obj2);
}
} catch (err) {
2026-10-01 14:13:23 +00:00
return null;
}
}
};