monaco-editor
Version:
A browser based code editor
1,236 lines • 7.49 MB
JavaScript
define("vs/editor.api-CykLys8L", ["exports"], (function(exports) {
"use strict";
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$2, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa;
function getNLSMessages() {
return globalThis._VSCODE_NLS_MESSAGES;
}
function getNLSLanguage() {
return globalThis._VSCODE_NLS_LANGUAGE;
}
const isPseudo = getNLSLanguage() === "pseudo" || typeof document !== "undefined" && document.location && typeof document.location.hash === "string" && document.location.hash.indexOf("pseudo=true") >= 0;
function _format$1(message, args) {
let result;
if (args.length === 0) {
result = message;
} else {
result = message.replace(/\{(\d+)\}/g, (match2, rest) => {
const index = rest[0];
const arg = args[index];
let result2 = match2;
if (typeof arg === "string") {
result2 = arg;
} else if (typeof arg === "number" || typeof arg === "boolean" || arg === void 0 || arg === null) {
result2 = String(arg);
}
return result2;
});
}
if (isPseudo) {
result = "[" + result.replace(/[aouei]/g, "$&$&") + "]";
}
return result;
}
function localize(data, message, ...args) {
if (typeof data === "number") {
return _format$1(lookupMessage(data, message), args);
}
return _format$1(message, args);
}
function lookupMessage(index, fallback2) {
const message = getNLSMessages()?.[index];
if (typeof message !== "string") {
if (typeof fallback2 === "string") {
return fallback2;
}
throw new Error(`!!! NLS MISSING: ${index} !!!`);
}
return message;
}
function localize2(data, originalMessage, ...args) {
let message;
if (typeof data === "number") {
message = lookupMessage(data, originalMessage);
} else {
message = originalMessage;
}
const value = _format$1(message, args);
return {
value,
original: originalMessage === message ? value : _format$1(originalMessage, args)
};
}
function ensureCodeWindow(targetWindow, fallbackWindowId) {
const codeWindow = targetWindow;
if (typeof codeWindow.vscodeWindowId !== "number") {
Object.defineProperty(codeWindow, "vscodeWindowId", {
get: () => fallbackWindowId
});
}
}
const mainWindow = window;
const _WindowManager = class _WindowManager {
constructor() {
this.mapWindowIdToZoomFactor = /* @__PURE__ */ new Map();
}
getZoomFactor(targetWindow) {
return this.mapWindowIdToZoomFactor.get(this.getWindowId(targetWindow)) ?? 1;
}
getWindowId(targetWindow) {
return targetWindow.vscodeWindowId;
}
};
_WindowManager.INSTANCE = new _WindowManager();
let WindowManager = _WindowManager;
function addMatchMediaChangeListener(targetWindow, query, callback) {
if (typeof query === "string") {
query = targetWindow.matchMedia(query);
}
query.addEventListener("change", callback);
}
function getZoomFactor(targetWindow) {
return WindowManager.INSTANCE.getZoomFactor(targetWindow);
}
const userAgent$1 = navigator.userAgent;
const isFirefox$1 = userAgent$1.indexOf("Firefox") >= 0;
const isWebKit = userAgent$1.indexOf("AppleWebKit") >= 0;
const isChrome$1 = userAgent$1.indexOf("Chrome") >= 0;
const isSafari$1 = !isChrome$1 && userAgent$1.indexOf("Safari") >= 0;
const isWebkitWebView = !isChrome$1 && !isSafari$1 && isWebKit;
userAgent$1.indexOf("Electron/") >= 0;
const isAndroid$1 = userAgent$1.indexOf("Android") >= 0;
let standalone = false;
if (typeof mainWindow.matchMedia === "function") {
const standaloneMatchMedia = mainWindow.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)");
const fullScreenMatchMedia = mainWindow.matchMedia("(display-mode: fullscreen)");
standalone = standaloneMatchMedia.matches;
addMatchMediaChangeListener(mainWindow, standaloneMatchMedia, ({ matches }) => {
if (standalone && fullScreenMatchMedia.matches) {
return;
}
standalone = matches;
});
}
function getMonacoEnvironment() {
return globalThis.MonacoEnvironment;
}
class ErrorHandler {
constructor() {
this.listeners = [];
this.unexpectedErrorHandler = function(e) {
setTimeout(() => {
if (e.stack) {
if (ErrorNoTelemetry.isErrorNoTelemetry(e)) {
throw new ErrorNoTelemetry(e.message + "\n\n" + e.stack);
}
throw new Error(e.message + "\n\n" + e.stack);
}
throw e;
}, 0);
};
}
emit(e) {
this.listeners.forEach((listener) => {
listener(e);
});
}
onUnexpectedError(e) {
this.unexpectedErrorHandler(e);
this.emit(e);
}
// For external errors, we don't want the listeners to be called
onUnexpectedExternalError(e) {
this.unexpectedErrorHandler(e);
}
}
const errorHandler = new ErrorHandler();
function onBugIndicatingError(e) {
errorHandler.onUnexpectedError(e);
return void 0;
}
function onUnexpectedError(e) {
if (!isCancellationError(e)) {
errorHandler.onUnexpectedError(e);
}
return void 0;
}
function onUnexpectedExternalError(e) {
if (!isCancellationError(e)) {
errorHandler.onUnexpectedExternalError(e);
}
return void 0;
}
function transformErrorForSerialization(error) {
if (error instanceof Error) {
const { name, message, cause } = error;
const stack = error.stacktrace || error.stack;
return {
$isError: true,
name,
message,
stack,
noTelemetry: ErrorNoTelemetry.isErrorNoTelemetry(error),
cause: cause ? transformErrorForSerialization(cause) : void 0,
code: error.code
};
}
return error;
}
const canceledName = "Canceled";
function isCancellationError(error) {
if (error instanceof CancellationError) {
return true;
}
return error instanceof Error && error.name === canceledName && error.message === canceledName;
}
class CancellationError extends Error {
constructor() {
super(canceledName);
this.name = this.message;
}
}
function canceled() {
const error = new Error(canceledName);
error.name = error.message;
return error;
}
function illegalArgument(name) {
if (name) {
return new Error(`Illegal argument: ${name}`);
} else {
return new Error("Illegal argument");
}
}
function illegalState(name) {
if (name) {
return new Error(`Illegal state: ${name}`);
} else {
return new Error("Illegal state");
}
}
class NotSupportedError extends Error {
constructor(message) {
super("NotSupported");
if (message) {
this.message = message;
}
}
}
class ErrorNoTelemetry extends Error {
constructor(msg) {
super(msg);
this.name = "CodeExpectedError";
}
static fromError(err) {
if (err instanceof ErrorNoTelemetry) {
return err;
}
const result = new ErrorNoTelemetry();
result.message = err.message;
result.stack = err.stack;
return result;
}
static isErrorNoTelemetry(err) {
return err.name === "CodeExpectedError";
}
}
class BugIndicatingError extends Error {
constructor(message) {
super(message || "An unexpected bug occurred.");
Object.setPrototypeOf(this, BugIndicatingError.prototype);
}
}
function ok(value, message) {
if (!value) {
throw new Error(message ? `Assertion failed (${message})` : "Assertion Failed");
}
}
function assertNever(value, message = "Unreachable") {
throw new Error(message);
}
function assert(condition, messageOrError = "unexpected state") {
if (!condition) {
const errorToThrow = typeof messageOrError === "string" ? new BugIndicatingError(`Assertion Failed: ${messageOrError}`) : messageOrError;
throw errorToThrow;
}
}
function softAssert(condition, message = "Soft Assertion Failed") {
if (!condition) {
onUnexpectedError(new BugIndicatingError(message));
}
}
function assertFn(condition) {
if (!condition()) {
debugger;
condition();
onUnexpectedError(new BugIndicatingError("Assertion Failed"));
}
}
function checkAdjacentItems(items, predicate) {
let i2 = 0;
while (i2 < items.length - 1) {
const a = items[i2];
const b = items[i2 + 1];
if (!predicate(a, b)) {
return false;
}
i2++;
}
return true;
}
function isString$1(str) {
return typeof str === "string";
}
function isArrayOf$1(value, check) {
return Array.isArray(value) && value.every(check);
}
function isObject(obj) {
return typeof obj === "object" && obj !== null && !Array.isArray(obj) && !(obj instanceof RegExp) && !(obj instanceof Date);
}
function isTypedArray(obj) {
const TypedArray = Object.getPrototypeOf(Uint8Array);
return typeof obj === "object" && obj instanceof TypedArray;
}
function isNumber$1(obj) {
return typeof obj === "number" && !isNaN(obj);
}
function isIterable(obj) {
return !!obj && typeof obj[Symbol.iterator] === "function";
}
function isBoolean(obj) {
return obj === true || obj === false;
}
function isUndefined(obj) {
return typeof obj === "undefined";
}
function isDefined(arg) {
return !isUndefinedOrNull(arg);
}
function isUndefinedOrNull(obj) {
return isUndefined(obj) || obj === null;
}
function assertType(condition, type) {
if (!condition) {
throw new Error(type ? `Unexpected type, expected '${type}'` : "Unexpected type");
}
}
function assertReturnsDefined(arg) {
assert(arg !== null && arg !== void 0, "Argument is `undefined` or `null`.");
return arg;
}
function isFunction(obj) {
return typeof obj === "function";
}
function validateConstraints(args, constraints) {
const len = Math.min(args.length, constraints.length);
for (let i2 = 0; i2 < len; i2++) {
validateConstraint(args[i2], constraints[i2]);
}
}
function validateConstraint(arg, constraint) {
if (isString$1(constraint)) {
if (typeof arg !== constraint) {
throw new Error(`argument does not match constraint: typeof ${constraint}`);
}
} else if (isFunction(constraint)) {
try {
if (arg instanceof constraint) {
return;
}
} catch {
}
if (!isUndefinedOrNull(arg) && arg.constructor === constraint) {
return;
}
if (constraint.length === 1 && constraint.call(void 0, arg) === true) {
return;
}
throw new Error(`argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true`);
}
}
function upcast(x) {
return x;
}
const LANGUAGE_DEFAULT = "en";
let _isWindows = false;
let _isMacintosh = false;
let _isLinux = false;
let _isNative = false;
let _isWeb = false;
let _isIOS = false;
let _isMobile = false;
let _locale = void 0;
let _language = LANGUAGE_DEFAULT;
let _platformLocale = LANGUAGE_DEFAULT;
let _translationsConfigFile = void 0;
let _userAgent = void 0;
const $globalThis = globalThis;
let nodeProcess = void 0;
if (typeof $globalThis.vscode !== "undefined" && typeof $globalThis.vscode.process !== "undefined") {
nodeProcess = $globalThis.vscode.process;
} else if (typeof process !== "undefined" && typeof process?.versions?.node === "string") {
nodeProcess = process;
}
const isElectronProcess = typeof nodeProcess?.versions?.electron === "string";
const isElectronRenderer = isElectronProcess && nodeProcess?.type === "renderer";
if (typeof nodeProcess === "object") {
_isWindows = nodeProcess.platform === "win32";
_isMacintosh = nodeProcess.platform === "darwin";
_isLinux = nodeProcess.platform === "linux";
_isLinux && !!nodeProcess.env["SNAP"] && !!nodeProcess.env["SNAP_REVISION"];
!!nodeProcess.env["CI"] || !!nodeProcess.env["BUILD_ARTIFACTSTAGINGDIRECTORY"] || !!nodeProcess.env["GITHUB_WORKSPACE"];
_locale = LANGUAGE_DEFAULT;
_language = LANGUAGE_DEFAULT;
const rawNlsConfig = nodeProcess.env["VSCODE_NLS_CONFIG"];
if (rawNlsConfig) {
try {
const nlsConfig = JSON.parse(rawNlsConfig);
_locale = nlsConfig.userLocale;
_platformLocale = nlsConfig.osLocale;
_language = nlsConfig.resolvedLanguage || LANGUAGE_DEFAULT;
_translationsConfigFile = nlsConfig.languagePack?.translationsConfigFile;
} catch (e) {
}
}
_isNative = true;
} else if (typeof navigator === "object" && !isElectronRenderer) {
_userAgent = navigator.userAgent;
_isWindows = _userAgent.indexOf("Windows") >= 0;
_isMacintosh = _userAgent.indexOf("Macintosh") >= 0;
_isIOS = (_userAgent.indexOf("Macintosh") >= 0 || _userAgent.indexOf("iPad") >= 0 || _userAgent.indexOf("iPhone") >= 0) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0;
_isLinux = _userAgent.indexOf("Linux") >= 0;
_isMobile = _userAgent?.indexOf("Mobi") >= 0;
_isWeb = true;
_language = getNLSLanguage() || LANGUAGE_DEFAULT;
_locale = navigator.language.toLowerCase();
_platformLocale = _locale;
} else {
console.error("Unable to resolve platform.");
}
let _platform = 0;
if (_isMacintosh) {
_platform = 1;
} else if (_isWindows) {
_platform = 3;
} else if (_isLinux) {
_platform = 2;
}
const isWindows = _isWindows;
const isMacintosh = _isMacintosh;
const isLinux = _isLinux;
const isNative = _isNative;
const isWeb = _isWeb;
const isWebWorker = _isWeb && typeof $globalThis.importScripts === "function";
const webWorkerOrigin = isWebWorker ? $globalThis.origin : void 0;
const isIOS = _isIOS;
const isMobile = _isMobile;
const platform$1 = _platform;
const userAgent = _userAgent;
const language = _language;
const setTimeout0IsFaster = typeof $globalThis.postMessage === "function" && !$globalThis.importScripts;
const setTimeout0 = (() => {
if (setTimeout0IsFaster) {
const pending = [];
$globalThis.addEventListener("message", (e) => {
if (e.data && e.data.vscodeScheduleAsyncWork) {
for (let i2 = 0, len = pending.length; i2 < len; i2++) {
const candidate = pending[i2];
if (candidate.id === e.data.vscodeScheduleAsyncWork) {
pending.splice(i2, 1);
candidate.callback();
return;
}
}
}
});
let lastId = 0;
return (callback) => {
const myId = ++lastId;
pending.push({
id: myId,
callback
});
$globalThis.postMessage({ vscodeScheduleAsyncWork: myId }, "*");
};
}
return (callback) => setTimeout(callback);
})();
const OS = _isMacintosh || _isIOS ? 2 : _isWindows ? 1 : 3;
let _isLittleEndian = true;
let _isLittleEndianComputed = false;
function isLittleEndian() {
if (!_isLittleEndianComputed) {
_isLittleEndianComputed = true;
const test = new Uint8Array(2);
test[0] = 1;
test[1] = 2;
const view = new Uint16Array(test.buffer);
_isLittleEndian = view[0] === (2 << 8) + 1;
}
return _isLittleEndian;
}
const isChrome = !!(userAgent && userAgent.indexOf("Chrome") >= 0);
const isFirefox = !!(userAgent && userAgent.indexOf("Firefox") >= 0);
const isSafari = !!(!isChrome && (userAgent && userAgent.indexOf("Safari") >= 0));
const isEdge = !!(userAgent && userAgent.indexOf("Edg/") >= 0);
const isAndroid = !!(userAgent && userAgent.indexOf("Android") >= 0);
const BrowserFeatures = {
clipboard: {
writeText: isNative || document.queryCommandSupported && document.queryCommandSupported("copy") || !!(navigator && navigator.clipboard && navigator.clipboard.writeText),
readText: isNative || !!(navigator && navigator.clipboard && navigator.clipboard.readText)
},
pointerEvents: mainWindow.PointerEvent && ("ontouchstart" in mainWindow || navigator.maxTouchPoints > 0)
};
class KeyCodeStrMap {
constructor() {
this._keyCodeToStr = [];
this._strToKeyCode = /* @__PURE__ */ Object.create(null);
}
define(keyCode, str) {
this._keyCodeToStr[keyCode] = str;
this._strToKeyCode[str.toLowerCase()] = keyCode;
}
keyCodeToStr(keyCode) {
return this._keyCodeToStr[keyCode];
}
strToKeyCode(str) {
return this._strToKeyCode[str.toLowerCase()] || 0;
}
}
const uiMap = new KeyCodeStrMap();
const userSettingsUSMap = new KeyCodeStrMap();
const userSettingsGeneralMap = new KeyCodeStrMap();
const EVENT_KEY_CODE_MAP = new Array(230);
const scanCodeStrToInt = /* @__PURE__ */ Object.create(null);
const scanCodeLowerCaseStrToInt = /* @__PURE__ */ Object.create(null);
const IMMUTABLE_CODE_TO_KEY_CODE = [];
for (let i2 = 0; i2 <= 193; i2++) {
IMMUTABLE_CODE_TO_KEY_CODE[i2] = -1;
}
(function() {
const empty2 = "";
const mappings = [
// immutable, scanCode, scanCodeStr, keyCode, keyCodeStr, eventKeyCode, vkey, usUserSettingsLabel, generalUserSettingsLabel
[1, 0, "None", 0, "unknown", 0, "VK_UNKNOWN", empty2, empty2],
[1, 1, "Hyper", 0, empty2, 0, empty2, empty2, empty2],
[1, 2, "Super", 0, empty2, 0, empty2, empty2, empty2],
[1, 3, "Fn", 0, empty2, 0, empty2, empty2, empty2],
[1, 4, "FnLock", 0, empty2, 0, empty2, empty2, empty2],
[1, 5, "Suspend", 0, empty2, 0, empty2, empty2, empty2],
[1, 6, "Resume", 0, empty2, 0, empty2, empty2, empty2],
[1, 7, "Turbo", 0, empty2, 0, empty2, empty2, empty2],
[1, 8, "Sleep", 0, empty2, 0, "VK_SLEEP", empty2, empty2],
[1, 9, "WakeUp", 0, empty2, 0, empty2, empty2, empty2],
[0, 10, "KeyA", 31, "A", 65, "VK_A", empty2, empty2],
[0, 11, "KeyB", 32, "B", 66, "VK_B", empty2, empty2],
[0, 12, "KeyC", 33, "C", 67, "VK_C", empty2, empty2],
[0, 13, "KeyD", 34, "D", 68, "VK_D", empty2, empty2],
[0, 14, "KeyE", 35, "E", 69, "VK_E", empty2, empty2],
[0, 15, "KeyF", 36, "F", 70, "VK_F", empty2, empty2],
[0, 16, "KeyG", 37, "G", 71, "VK_G", empty2, empty2],
[0, 17, "KeyH", 38, "H", 72, "VK_H", empty2, empty2],
[0, 18, "KeyI", 39, "I", 73, "VK_I", empty2, empty2],
[0, 19, "KeyJ", 40, "J", 74, "VK_J", empty2, empty2],
[0, 20, "KeyK", 41, "K", 75, "VK_K", empty2, empty2],
[0, 21, "KeyL", 42, "L", 76, "VK_L", empty2, empty2],
[0, 22, "KeyM", 43, "M", 77, "VK_M", empty2, empty2],
[0, 23, "KeyN", 44, "N", 78, "VK_N", empty2, empty2],
[0, 24, "KeyO", 45, "O", 79, "VK_O", empty2, empty2],
[0, 25, "KeyP", 46, "P", 80, "VK_P", empty2, empty2],
[0, 26, "KeyQ", 47, "Q", 81, "VK_Q", empty2, empty2],
[0, 27, "KeyR", 48, "R", 82, "VK_R", empty2, empty2],
[0, 28, "KeyS", 49, "S", 83, "VK_S", empty2, empty2],
[0, 29, "KeyT", 50, "T", 84, "VK_T", empty2, empty2],
[0, 30, "KeyU", 51, "U", 85, "VK_U", empty2, empty2],
[0, 31, "KeyV", 52, "V", 86, "VK_V", empty2, empty2],
[0, 32, "KeyW", 53, "W", 87, "VK_W", empty2, empty2],
[0, 33, "KeyX", 54, "X", 88, "VK_X", empty2, empty2],
[0, 34, "KeyY", 55, "Y", 89, "VK_Y", empty2, empty2],
[0, 35, "KeyZ", 56, "Z", 90, "VK_Z", empty2, empty2],
[0, 36, "Digit1", 22, "1", 49, "VK_1", empty2, empty2],
[0, 37, "Digit2", 23, "2", 50, "VK_2", empty2, empty2],
[0, 38, "Digit3", 24, "3", 51, "VK_3", empty2, empty2],
[0, 39, "Digit4", 25, "4", 52, "VK_4", empty2, empty2],
[0, 40, "Digit5", 26, "5", 53, "VK_5", empty2, empty2],
[0, 41, "Digit6", 27, "6", 54, "VK_6", empty2, empty2],
[0, 42, "Digit7", 28, "7", 55, "VK_7", empty2, empty2],
[0, 43, "Digit8", 29, "8", 56, "VK_8", empty2, empty2],
[0, 44, "Digit9", 30, "9", 57, "VK_9", empty2, empty2],
[0, 45, "Digit0", 21, "0", 48, "VK_0", empty2, empty2],
[1, 46, "Enter", 3, "Enter", 13, "VK_RETURN", empty2, empty2],
[1, 47, "Escape", 9, "Escape", 27, "VK_ESCAPE", empty2, empty2],
[1, 48, "Backspace", 1, "Backspace", 8, "VK_BACK", empty2, empty2],
[1, 49, "Tab", 2, "Tab", 9, "VK_TAB", empty2, empty2],
[1, 50, "Space", 10, "Space", 32, "VK_SPACE", empty2, empty2],
[0, 51, "Minus", 88, "-", 189, "VK_OEM_MINUS", "-", "OEM_MINUS"],
[0, 52, "Equal", 86, "=", 187, "VK_OEM_PLUS", "=", "OEM_PLUS"],
[0, 53, "BracketLeft", 92, "[", 219, "VK_OEM_4", "[", "OEM_4"],
[0, 54, "BracketRight", 94, "]", 221, "VK_OEM_6", "]", "OEM_6"],
[0, 55, "Backslash", 93, "\\", 220, "VK_OEM_5", "\\", "OEM_5"],
[0, 56, "IntlHash", 0, empty2, 0, empty2, empty2, empty2],
// has been dropped from the w3c spec
[0, 57, "Semicolon", 85, ";", 186, "VK_OEM_1", ";", "OEM_1"],
[0, 58, "Quote", 95, "'", 222, "VK_OEM_7", "'", "OEM_7"],
[0, 59, "Backquote", 91, "`", 192, "VK_OEM_3", "`", "OEM_3"],
[0, 60, "Comma", 87, ",", 188, "VK_OEM_COMMA", ",", "OEM_COMMA"],
[0, 61, "Period", 89, ".", 190, "VK_OEM_PERIOD", ".", "OEM_PERIOD"],
[0, 62, "Slash", 90, "/", 191, "VK_OEM_2", "/", "OEM_2"],
[1, 63, "CapsLock", 8, "CapsLock", 20, "VK_CAPITAL", empty2, empty2],
[1, 64, "F1", 59, "F1", 112, "VK_F1", empty2, empty2],
[1, 65, "F2", 60, "F2", 113, "VK_F2", empty2, empty2],
[1, 66, "F3", 61, "F3", 114, "VK_F3", empty2, empty2],
[1, 67, "F4", 62, "F4", 115, "VK_F4", empty2, empty2],
[1, 68, "F5", 63, "F5", 116, "VK_F5", empty2, empty2],
[1, 69, "F6", 64, "F6", 117, "VK_F6", empty2, empty2],
[1, 70, "F7", 65, "F7", 118, "VK_F7", empty2, empty2],
[1, 71, "F8", 66, "F8", 119, "VK_F8", empty2, empty2],
[1, 72, "F9", 67, "F9", 120, "VK_F9", empty2, empty2],
[1, 73, "F10", 68, "F10", 121, "VK_F10", empty2, empty2],
[1, 74, "F11", 69, "F11", 122, "VK_F11", empty2, empty2],
[1, 75, "F12", 70, "F12", 123, "VK_F12", empty2, empty2],
[1, 76, "PrintScreen", 0, empty2, 0, empty2, empty2, empty2],
[1, 77, "ScrollLock", 84, "ScrollLock", 145, "VK_SCROLL", empty2, empty2],
[1, 78, "Pause", 7, "PauseBreak", 19, "VK_PAUSE", empty2, empty2],
[1, 79, "Insert", 19, "Insert", 45, "VK_INSERT", empty2, empty2],
[1, 80, "Home", 14, "Home", 36, "VK_HOME", empty2, empty2],
[1, 81, "PageUp", 11, "PageUp", 33, "VK_PRIOR", empty2, empty2],
[1, 82, "Delete", 20, "Delete", 46, "VK_DELETE", empty2, empty2],
[1, 83, "End", 13, "End", 35, "VK_END", empty2, empty2],
[1, 84, "PageDown", 12, "PageDown", 34, "VK_NEXT", empty2, empty2],
[1, 85, "ArrowRight", 17, "RightArrow", 39, "VK_RIGHT", "Right", empty2],
[1, 86, "ArrowLeft", 15, "LeftArrow", 37, "VK_LEFT", "Left", empty2],
[1, 87, "ArrowDown", 18, "DownArrow", 40, "VK_DOWN", "Down", empty2],
[1, 88, "ArrowUp", 16, "UpArrow", 38, "VK_UP", "Up", empty2],
[1, 89, "NumLock", 83, "NumLock", 144, "VK_NUMLOCK", empty2, empty2],
[1, 90, "NumpadDivide", 113, "NumPad_Divide", 111, "VK_DIVIDE", empty2, empty2],
[1, 91, "NumpadMultiply", 108, "NumPad_Multiply", 106, "VK_MULTIPLY", empty2, empty2],
[1, 92, "NumpadSubtract", 111, "NumPad_Subtract", 109, "VK_SUBTRACT", empty2, empty2],
[1, 93, "NumpadAdd", 109, "NumPad_Add", 107, "VK_ADD", empty2, empty2],
[1, 94, "NumpadEnter", 3, empty2, 0, empty2, empty2, empty2],
[1, 95, "Numpad1", 99, "NumPad1", 97, "VK_NUMPAD1", empty2, empty2],
[1, 96, "Numpad2", 100, "NumPad2", 98, "VK_NUMPAD2", empty2, empty2],
[1, 97, "Numpad3", 101, "NumPad3", 99, "VK_NUMPAD3", empty2, empty2],
[1, 98, "Numpad4", 102, "NumPad4", 100, "VK_NUMPAD4", empty2, empty2],
[1, 99, "Numpad5", 103, "NumPad5", 101, "VK_NUMPAD5", empty2, empty2],
[1, 100, "Numpad6", 104, "NumPad6", 102, "VK_NUMPAD6", empty2, empty2],
[1, 101, "Numpad7", 105, "NumPad7", 103, "VK_NUMPAD7", empty2, empty2],
[1, 102, "Numpad8", 106, "NumPad8", 104, "VK_NUMPAD8", empty2, empty2],
[1, 103, "Numpad9", 107, "NumPad9", 105, "VK_NUMPAD9", empty2, empty2],
[1, 104, "Numpad0", 98, "NumPad0", 96, "VK_NUMPAD0", empty2, empty2],
[1, 105, "NumpadDecimal", 112, "NumPad_Decimal", 110, "VK_DECIMAL", empty2, empty2],
[0, 106, "IntlBackslash", 97, "OEM_102", 226, "VK_OEM_102", empty2, empty2],
[1, 107, "ContextMenu", 58, "ContextMenu", 93, empty2, empty2, empty2],
[1, 108, "Power", 0, empty2, 0, empty2, empty2, empty2],
[1, 109, "NumpadEqual", 0, empty2, 0, empty2, empty2, empty2],
[1, 110, "F13", 71, "F13", 124, "VK_F13", empty2, empty2],
[1, 111, "F14", 72, "F14", 125, "VK_F14", empty2, empty2],
[1, 112, "F15", 73, "F15", 126, "VK_F15", empty2, empty2],
[1, 113, "F16", 74, "F16", 127, "VK_F16", empty2, empty2],
[1, 114, "F17", 75, "F17", 128, "VK_F17", empty2, empty2],
[1, 115, "F18", 76, "F18", 129, "VK_F18", empty2, empty2],
[1, 116, "F19", 77, "F19", 130, "VK_F19", empty2, empty2],
[1, 117, "F20", 78, "F20", 131, "VK_F20", empty2, empty2],
[1, 118, "F21", 79, "F21", 132, "VK_F21", empty2, empty2],
[1, 119, "F22", 80, "F22", 133, "VK_F22", empty2, empty2],
[1, 120, "F23", 81, "F23", 134, "VK_F23", empty2, empty2],
[1, 121, "F24", 82, "F24", 135, "VK_F24", empty2, empty2],
[1, 122, "Open", 0, empty2, 0, empty2, empty2, empty2],
[1, 123, "Help", 0, empty2, 0, empty2, empty2, empty2],
[1, 124, "Select", 0, empty2, 0, empty2, empty2, empty2],
[1, 125, "Again", 0, empty2, 0, empty2, empty2, empty2],
[1, 126, "Undo", 0, empty2, 0, empty2, empty2, empty2],
[1, 127, "Cut", 0, empty2, 0, empty2, empty2, empty2],
[1, 128, "Copy", 0, empty2, 0, empty2, empty2, empty2],
[1, 129, "Paste", 0, empty2, 0, empty2, empty2, empty2],
[1, 130, "Find", 0, empty2, 0, empty2, empty2, empty2],
[1, 131, "AudioVolumeMute", 117, "AudioVolumeMute", 173, "VK_VOLUME_MUTE", empty2, empty2],
[1, 132, "AudioVolumeUp", 118, "AudioVolumeUp", 175, "VK_VOLUME_UP", empty2, empty2],
[1, 133, "AudioVolumeDown", 119, "AudioVolumeDown", 174, "VK_VOLUME_DOWN", empty2, empty2],
[1, 134, "NumpadComma", 110, "NumPad_Separator", 108, "VK_SEPARATOR", empty2, empty2],
[0, 135, "IntlRo", 115, "ABNT_C1", 193, "VK_ABNT_C1", empty2, empty2],
[1, 136, "KanaMode", 0, empty2, 0, empty2, empty2, empty2],
[0, 137, "IntlYen", 0, empty2, 0, empty2, empty2, empty2],
[1, 138, "Convert", 0, empty2, 0, empty2, empty2, empty2],
[1, 139, "NonConvert", 0, empty2, 0, empty2, empty2, empty2],
[1, 140, "Lang1", 0, empty2, 0, empty2, empty2, empty2],
[1, 141, "Lang2", 0, empty2, 0, empty2, empty2, empty2],
[1, 142, "Lang3", 0, empty2, 0, empty2, empty2, empty2],
[1, 143, "Lang4", 0, empty2, 0, empty2, empty2, empty2],
[1, 144, "Lang5", 0, empty2, 0, empty2, empty2, empty2],
[1, 145, "Abort", 0, empty2, 0, empty2, empty2, empty2],
[1, 146, "Props", 0, empty2, 0, empty2, empty2, empty2],
[1, 147, "NumpadParenLeft", 0, empty2, 0, empty2, empty2, empty2],
[1, 148, "NumpadParenRight", 0, empty2, 0, empty2, empty2, empty2],
[1, 149, "NumpadBackspace", 0, empty2, 0, empty2, empty2, empty2],
[1, 150, "NumpadMemoryStore", 0, empty2, 0, empty2, empty2, empty2],
[1, 151, "NumpadMemoryRecall", 0, empty2, 0, empty2, empty2, empty2],
[1, 152, "NumpadMemoryClear", 0, empty2, 0, empty2, empty2, empty2],
[1, 153, "NumpadMemoryAdd", 0, empty2, 0, empty2, empty2, empty2],
[1, 154, "NumpadMemorySubtract", 0, empty2, 0, empty2, empty2, empty2],
[1, 155, "NumpadClear", 131, "Clear", 12, "VK_CLEAR", empty2, empty2],
[1, 156, "NumpadClearEntry", 0, empty2, 0, empty2, empty2, empty2],
[1, 0, empty2, 5, "Ctrl", 17, "VK_CONTROL", empty2, empty2],
[1, 0, empty2, 4, "Shift", 16, "VK_SHIFT", empty2, empty2],
[1, 0, empty2, 6, "Alt", 18, "VK_MENU", empty2, empty2],
[1, 0, empty2, 57, "Meta", 91, "VK_COMMAND", empty2, empty2],
[1, 157, "ControlLeft", 5, empty2, 0, "VK_LCONTROL", empty2, empty2],
[1, 158, "ShiftLeft", 4, empty2, 0, "VK_LSHIFT", empty2, empty2],
[1, 159, "AltLeft", 6, empty2, 0, "VK_LMENU", empty2, empty2],
[1, 160, "MetaLeft", 57, empty2, 0, "VK_LWIN", empty2, empty2],
[1, 161, "ControlRight", 5, empty2, 0, "VK_RCONTROL", empty2, empty2],
[1, 162, "ShiftRight", 4, empty2, 0, "VK_RSHIFT", empty2, empty2],
[1, 163, "AltRight", 6, empty2, 0, "VK_RMENU", empty2, empty2],
[1, 164, "MetaRight", 57, empty2, 0, "VK_RWIN", empty2, empty2],
[1, 165, "BrightnessUp", 0, empty2, 0, empty2, empty2, empty2],
[1, 166, "BrightnessDown", 0, empty2, 0, empty2, empty2, empty2],
[1, 167, "MediaPlay", 0, empty2, 0, empty2, empty2, empty2],
[1, 168, "MediaRecord", 0, empty2, 0, empty2, empty2, empty2],
[1, 169, "MediaFastForward", 0, empty2, 0, empty2, empty2, empty2],
[1, 170, "MediaRewind", 0, empty2, 0, empty2, empty2, empty2],
[1, 171, "MediaTrackNext", 124, "MediaTrackNext", 176, "VK_MEDIA_NEXT_TRACK", empty2, empty2],
[1, 172, "MediaTrackPrevious", 125, "MediaTrackPrevious", 177, "VK_MEDIA_PREV_TRACK", empty2, empty2],
[1, 173, "MediaStop", 126, "MediaStop", 178, "VK_MEDIA_STOP", empty2, empty2],
[1, 174, "Eject", 0, empty2, 0, empty2, empty2, empty2],
[1, 175, "MediaPlayPause", 127, "MediaPlayPause", 179, "VK_MEDIA_PLAY_PAUSE", empty2, empty2],
[1, 176, "MediaSelect", 128, "LaunchMediaPlayer", 181, "VK_MEDIA_LAUNCH_MEDIA_SELECT", empty2, empty2],
[1, 177, "LaunchMail", 129, "LaunchMail", 180, "VK_MEDIA_LAUNCH_MAIL", empty2, empty2],
[1, 178, "LaunchApp2", 130, "LaunchApp2", 183, "VK_MEDIA_LAUNCH_APP2", empty2, empty2],
[1, 179, "LaunchApp1", 0, empty2, 0, "VK_MEDIA_LAUNCH_APP1", empty2, empty2],
[1, 180, "SelectTask", 0, empty2, 0, empty2, empty2, empty2],
[1, 181, "LaunchScreenSaver", 0, empty2, 0, empty2, empty2, empty2],
[1, 182, "BrowserSearch", 120, "BrowserSearch", 170, "VK_BROWSER_SEARCH", empty2, empty2],
[1, 183, "BrowserHome", 121, "BrowserHome", 172, "VK_BROWSER_HOME", empty2, empty2],
[1, 184, "BrowserBack", 122, "BrowserBack", 166, "VK_BROWSER_BACK", empty2, empty2],
[1, 185, "BrowserForward", 123, "BrowserForward", 167, "VK_BROWSER_FORWARD", empty2, empty2],
[1, 186, "BrowserStop", 0, empty2, 0, "VK_BROWSER_STOP", empty2, empty2],
[1, 187, "BrowserRefresh", 0, empty2, 0, "VK_BROWSER_REFRESH", empty2, empty2],
[1, 188, "BrowserFavorites", 0, empty2, 0, "VK_BROWSER_FAVORITES", empty2, empty2],
[1, 189, "ZoomToggle", 0, empty2, 0, empty2, empty2, empty2],
[1, 190, "MailReply", 0, empty2, 0, empty2, empty2, empty2],
[1, 191, "MailForward", 0, empty2, 0, empty2, empty2, empty2],
[1, 192, "MailSend", 0, empty2, 0, empty2, empty2, empty2],
// See https://lists.w3.org/Archives/Public/www-dom/2010JulSep/att-0182/keyCode-spec.html
// If an Input Method Editor is processing key input and the event is keydown, return 229.
[1, 0, empty2, 114, "KeyInComposition", 229, empty2, empty2, empty2],
[1, 0, empty2, 116, "ABNT_C2", 194, "VK_ABNT_C2", empty2, empty2],
[1, 0, empty2, 96, "OEM_8", 223, "VK_OEM_8", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_KANA", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_HANGUL", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_JUNJA", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_FINAL", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_HANJA", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_KANJI", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_CONVERT", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_NONCONVERT", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_ACCEPT", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_MODECHANGE", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_SELECT", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_PRINT", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_EXECUTE", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_SNAPSHOT", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_HELP", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_APPS", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_PROCESSKEY", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_PACKET", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_DBE_SBCSCHAR", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_DBE_DBCSCHAR", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_ATTN", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_CRSEL", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_EXSEL", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_EREOF", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_PLAY", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_ZOOM", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_NONAME", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_PA1", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_OEM_CLEAR", empty2, empty2]
];
const seenKeyCode = [];
const seenScanCode = [];
for (const mapping of mappings) {
const [immutable, scanCode, scanCodeStr, keyCode, keyCodeStr, eventKeyCode, vkey, usUserSettingsLabel, generalUserSettingsLabel] = mapping;
if (!seenScanCode[scanCode]) {
seenScanCode[scanCode] = true;
scanCodeStrToInt[scanCodeStr] = scanCode;
scanCodeLowerCaseStrToInt[scanCodeStr.toLowerCase()] = scanCode;
if (immutable) {
IMMUTABLE_CODE_TO_KEY_CODE[scanCode] = keyCode;
}
}
if (!seenKeyCode[keyCode]) {
seenKeyCode[keyCode] = true;
if (!keyCodeStr) {
throw new Error(`String representation missing for key code ${keyCode} around scan code ${scanCodeStr}`);
}
uiMap.define(keyCode, keyCodeStr);
userSettingsUSMap.define(keyCode, usUserSettingsLabel || keyCodeStr);
userSettingsGeneralMap.define(keyCode, generalUserSettingsLabel || usUserSettingsLabel || keyCodeStr);
}
if (eventKeyCode) {
EVENT_KEY_CODE_MAP[eventKeyCode] = keyCode;
}
}
})();
var KeyCodeUtils;
(function(KeyCodeUtils2) {
function toString(keyCode) {
return uiMap.keyCodeToStr(keyCode);
}
KeyCodeUtils2.toString = toString;
function fromString(key) {
return uiMap.strToKeyCode(key);
}
KeyCodeUtils2.fromString = fromString;
function toUserSettingsUS(keyCode) {
return userSettingsUSMap.keyCodeToStr(keyCode);
}
KeyCodeUtils2.toUserSettingsUS = toUserSettingsUS;
function toUserSettingsGeneral(keyCode) {
return userSettingsGeneralMap.keyCodeToStr(keyCode);
}
KeyCodeUtils2.toUserSettingsGeneral = toUserSettingsGeneral;
function fromUserSettings(key) {
return userSettingsUSMap.strToKeyCode(key) || userSettingsGeneralMap.strToKeyCode(key);
}
KeyCodeUtils2.fromUserSettings = fromUserSettings;
function toElectronAccelerator(keyCode) {
if (keyCode >= 98 && keyCode <= 113) {
return null;
}
switch (keyCode) {
case 16:
return "Up";
case 18:
return "Down";
case 15:
return "Left";
case 17:
return "Right";
}
return uiMap.keyCodeToStr(keyCode);
}
KeyCodeUtils2.toElectronAccelerator = toElectronAccelerator;
})(KeyCodeUtils || (KeyCodeUtils = {}));
function KeyChord(firstPart, secondPart) {
const chordPart = (secondPart & 65535) << 16 >>> 0;
return (firstPart | chordPart) >>> 0;
}
function decodeKeybinding(keybinding, OS2) {
if (typeof keybinding === "number") {
if (keybinding === 0) {
return null;
}
const firstChord = (keybinding & 65535) >>> 0;
const secondChord = (keybinding & 4294901760) >>> 16;
if (secondChord !== 0) {
return new Keybinding([
createSimpleKeybinding(firstChord, OS2),
createSimpleKeybinding(secondChord, OS2)
]);
}
return new Keybinding([createSimpleKeybinding(firstChord, OS2)]);
} else {
const chords = [];
for (let i2 = 0; i2 < keybinding.length; i2++) {
chords.push(createSimpleKeybinding(keybinding[i2], OS2));
}
return new Keybinding(chords);
}
}
function createSimpleKeybinding(keybinding, OS2) {
const ctrlCmd = keybinding & 2048 ? true : false;
const winCtrl = keybinding & 256 ? true : false;
const ctrlKey = OS2 === 2 ? winCtrl : ctrlCmd;
const shiftKey = keybinding & 1024 ? true : false;
const altKey = keybinding & 512 ? true : false;
const metaKey = OS2 === 2 ? ctrlCmd : winCtrl;
const keyCode = keybinding & 255;
return new KeyCodeChord(ctrlKey, shiftKey, altKey, metaKey, keyCode);
}
class KeyCodeChord {
constructor(ctrlKey, shiftKey, altKey, metaKey, keyCode) {
this.ctrlKey = ctrlKey;
this.shiftKey = shiftKey;
this.altKey = altKey;
this.metaKey = metaKey;
this.keyCode = keyCode;
}
equals(other) {
return other instanceof KeyCodeChord && this.ctrlKey === other.ctrlKey && this.shiftKey === other.shiftKey && this.altKey === other.altKey && this.metaKey === other.metaKey && this.keyCode === other.keyCode;
}
isModifierKey() {
return this.keyCode === 0 || this.keyCode === 5 || this.keyCode === 57 || this.keyCode === 6 || this.keyCode === 4;
}
/**
* Does this keybinding refer to the key code of a modifier and it also has the modifier flag?
*/
isDuplicateModifierCase() {
return this.ctrlKey && this.keyCode === 5 || this.shiftKey && this.keyCode === 4 || this.altKey && this.keyCode === 6 || this.metaKey && this.keyCode === 57;
}
}
class Keybinding {
constructor(chords) {
if (chords.length === 0) {
throw illegalArgument(`chords`);
}
this.chords = chords;
}
}
class ResolvedChord {
constructor(ctrlKey, shiftKey, altKey, metaKey, keyLabel, keyAriaLabel) {
this.ctrlKey = ctrlKey;
this.shiftKey = shiftKey;
this.altKey = altKey;
this.metaKey = metaKey;
this.keyLabel = keyLabel;
this.keyAriaLabel = keyAriaLabel;
}
}
class ResolvedKeybinding {
}
function extractKeyCode(e) {
if (e.charCode) {
const char = String.fromCharCode(e.charCode).toUpperCase();
return KeyCodeUtils.fromString(char);
}
const keyCode = e.keyCode;
if (keyCode === 3) {
return 7;
} else if (isFirefox$1) {
switch (keyCode) {
case 59:
return 85;
case 60:
if (isLinux) {
return 97;
}
break;
case 61:
return 86;
// based on: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode#numpad_keys
case 107:
return 109;
case 109:
return 111;
case 173:
return 88;
case 224:
if (isMacintosh) {
return 57;
}
break;
}
} else if (isWebKit) {
if (isMacintosh && keyCode === 93) {
return 57;
} else if (!isMacintosh && keyCode === 92) {
return 57;
}
}
return EVENT_KEY_CODE_MAP[keyCode] || 0;
}
const ctrlKeyMod$2 = isMacintosh ? 256 : 2048;
const altKeyMod = 512;
const shiftKeyMod = 1024;
const metaKeyMod = isMacintosh ? 2048 : 256;
class StandardKeyboardEvent {
constructor(source) {
this._standardKeyboardEventBrand = true;
const e = source;
this.browserEvent = e;
this.target = e.target;
this.ctrlKey = e.ctrlKey;
this.shiftKey = e.shiftKey;
this.altKey = e.altKey;
this.metaKey = e.metaKey;
this.altGraphKey = e.getModifierState?.("AltGraph");
this.keyCode = extractKeyCode(e);
this.code = e.code;
this.ctrlKey = this.ctrlKey || this.keyCode === 5;
this.altKey = this.altKey || this.keyCode === 6;
this.shiftKey = this.shiftKey || this.keyCode === 4;
this.metaKey = this.metaKey || this.keyCode === 57;
this._asKeybinding = this._computeKeybinding();
this._asKeyCodeChord = this._computeKeyCodeChord();
}
preventDefault() {
if (this.browserEvent && this.browserEvent.preventDefault) {
this.browserEvent.preventDefault();
}
}
stopPropagation() {
if (this.browserEvent && this.browserEvent.stopPropagation) {
this.browserEvent.stopPropagation();
}
}
toKeyCodeChord() {
return this._asKeyCodeChord;
}
equals(other) {
return this._asKeybinding === other;
}
_computeKeybinding() {
let key = 0;
if (this.keyCode !== 5 && this.keyCode !== 4 && this.keyCode !== 6 && this.keyCode !== 57) {
key = this.keyCode;
}
let result = 0;
if (this.ctrlKey) {
result |= ctrlKeyMod$2;
}
if (this.altKey) {
result |= altKeyMod;
}
if (this.shiftKey) {
result |= shiftKeyMod;
}
if (this.metaKey) {
result |= metaKeyMod;
}
result |= key;
return result;
}
_computeKeyCodeChord() {
let key = 0;
if (this.keyCode !== 5 && this.keyCode !== 4 && this.keyCode !== 6 && this.keyCode !== 57) {
key = this.keyCode;
}
return new KeyCodeChord(this.ctrlKey, this.shiftKey, this.altKey, this.metaKey, key);
}
}
const sameOriginWindowChainCache = /* @__PURE__ */ new WeakMap();
function getParentWindowIfSameOrigin(w) {
if (!w.parent || w.parent === w) {
return null;
}
try {
const location = w.location;
const parentLocation = w.parent.location;
if (location.origin !== "null" && parentLocation.origin !== "null" && location.origin !== parentLocation.origin) {
return null;
}
} catch (e) {
return null;
}
return w.parent;
}
class IframeUtils {
/**
* Returns a chain of embedded windows with the same origin (which can be accessed programmatically).
* Having a chain of length 1 might mean that the current execution environment is running outside of an iframe or inside an iframe embedded in a window with a different origin.
*/
static getSameOriginWindowChain(targetWindow) {
let windowChainCache = sameOriginWindowChainCache.get(targetWindow);
if (!windowChainCache) {
windowChainCache = [];
sameOriginWindowChainCache.set(targetWindow, windowChainCache);
let w = targetWindow;
let parent;
do {
parent = getParentWindowIfSameOrigin(w);
if (parent) {
windowChainCache.push({
window: new WeakRef(w),
iframeElement: w.frameElement || null
});
} else {
windowChainCache.push({
window: new WeakRef(w),
iframeElement: null
});
}
w = parent;
} while (w);
}
return windowChainCache.slice(0);
}
/**
* Returns the position of `childWindow` relative to `ancestorWindow`
*/
static getPositionOfChildWindowRelativeToAncestorWindow(childWindow, ancestorWindow) {
if (!ancestorWindow || childWindow === ancestorWindow) {
return {
top: 0,
left: 0
};
}
let top = 0, left = 0;
const windowChain = this.getSameOriginWindowChain(childWindow);
for (const windowChainEl of windowChain) {
const windowInChain = windowChainEl.window.deref();
top += windowInChain?.scrollY ?? 0;
left += windowInChain?.scrollX ?? 0;
if (windowInChain === ancestorWindow) {
break;
}
if (!windowChainEl.iframeElement) {
break;
}
const boundingRect = windowChainEl.iframeElement.getBoundingClientRect();
top += boundingRect.top;
left += boundingRect.left;
}
return {
top,
left
};
}
}
class StandardMouseEvent {
constructor(targetWindow, e) {
this.timestamp = Date.now();
this.browserEvent = e;
this.leftButton = e.button === 0;
this.middleButton = e.button === 1;
this.rightButton = e.button === 2;
this.buttons = e.buttons;
this.defaultPrevented = e.defaultPrevented;
this.target = e.target;
this.detail = e.detail || 1;
if (e.type === "dblclick") {
this.detail = 2;
}
this.ctrlKey = e.ctrlKey;
this.shiftKey = e.shiftKey;
this.altKey = e.altKey;
this.metaKey = e.metaKey;
if (typeof e.pageX === "number") {
this.posx = e.pageX;
this.posy = e.pageY;
} else {
this.posx = e.clientX + this.target.ownerDocument.body.scrollLeft + this.target.ownerDocument.documentElement.scrollLeft;
this.posy = e.clientY + this.target.ownerDocument.body.scrollTop + this.target.ownerDocument.documentElement.scrollTop;
}
const iframeOffsets = IframeUtils.getPositionOfChildWindowRelativeToAncestorWindow(targetWindow, e.view);
this.posx -= iframeOffsets.left;
this.posy -= iframeOffsets.top;
}
preventDefault() {
this.browserEvent.preventDefault();
}
stopPropagation() {
this.browserEvent.stopPropagation();
}
}
class StandardWheelEvent {
constructor(e, deltaX = 0, deltaY = 0) {
this.browserEvent = e || null;
this.target = e ? e.target || e.targetNode || e.srcElement : null;
this.deltaY = deltaY;
this.deltaX = deltaX;
let shouldFactorDPR = false;
if (isChrome$1) {
const chromeVersionMatch = navigator.userAgent.match(/Chrome\/(\d+)/);
const chromeMajorVersion = chromeVersionMatch ? parseInt(chromeVersionMatch[1]) : 123;
shouldFactorDPR = chromeMajorVersion <= 122;
}
if (e) {
const e1 = e;
const e2 = e;
const devicePixelRatio = e.view?.devicePixelRatio || 1;
if (typeof e1.wheelDeltaY !== "undefined") {
if (shouldFactorDPR) {
this.deltaY = e1.wheelDeltaY / (120 * devicePixelRatio);
} else {
this.deltaY = e1.wheelDeltaY / 120;
}
} else if (typeof e2.VERTICAL_AXIS !== "undefined" && e2.axis === e2.VERTICAL_AXIS) {
this.deltaY = -e2.detail / 3;
} else if (e.type === "wheel") {
const ev = e;
if (ev.deltaMode === ev.DOM_DELTA_LINE) {
if (isFirefox$1 && !isMacintosh) {
this.deltaY = -e.deltaY / 3;
} else {
this.deltaY = -e.deltaY;
}
} else {
this.deltaY = -e.deltaY / 40;
}
}
if (typeof e1.wheelDeltaX !== "undefined") {
if (isSafari$1 && isWindows) {
this.deltaX = -(e1.wheelDeltaX / 120);
} else if (shouldFactorDPR) {
this.deltaX = e1.wheelDeltaX / (120 * devicePixelRatio);
} else {
this.deltaX = e1.wheelDeltaX / 120;
}
} else if (typeof e2.HORIZONTAL_AXIS !== "undefined" && e2.axis === e2.HORIZONTAL_AXIS) {
this.deltaX = -e.detail / 3;
} else if (e.type === "wheel") {
const ev = e;
if (ev.deltaMode === ev.DOM_DELTA_LINE) {
if (isFirefox$1 && !isMacintosh) {
this.deltaX = -e.deltaX / 3;
} else {
this.deltaX = -e.deltaX;
}
} else {
this.deltaX = -e.deltaX / 40;
}
}
if (this.deltaY === 0 && this.deltaX === 0 && e.wheelDelta) {
if (shouldFactorDPR) {
this.deltaY = e.wheelDelta / (120 * devicePixelRatio);
} else {
this.deltaY = e.wheelDelta / 120;
}
}
}
}
preventDefault() {
this.browserEvent?.preventDefault();
}
stopPropagation() {
this.browserEvent?.stopPropagation();
}
}
function createSingleCallFunction(fn, fnDidRunCallback) {
const _this = this;
let didCall = false;
let result;
return function() {
if (didCall) {
return result;
}
didCall = true;
{
result = fn.apply(_this, arguments);
}
return result;
};
}
var Iterable;
(function(Iterable2) {
function is(thing) {
return !!thing && typeof thing === "object" && typeof thing[Symbol.iterator] === "function";
}
Iterable2.is = is;
const _empty2 = Object.freeze([]);
function empty2() {
return _empty2;
}
Iterable2.empty = empty2;
function* single(element) {
yield element;
}
Iterable2.single = single;
function wrap(iterableOrElement) {
if (is(iterableOrElement)) {
return iterableOrElement;
} else {
return single(iterableOrElement);
}
}
Iterable2.wrap = wrap;
function from(iterable) {
return iterable || _empty2;
}
Iterable2.from = from;
function* reverse(array2) {
for (let i2 = array2.length - 1; i2 >= 0; i2--) {
yield array2[i2];
}
}
Iterable2.reverse = reverse;
function isEmpty(iterable) {
return !iterable |