const normalizeLine = line => {
  if (line.startsWith('Error: ')) {
    return line.slice('Error: '.length);
  }
  if (line.startsWith('VError: ')) {
    return line.slice('VError: '.length);
  }
  return line;
};
const getCombinedMessage = (error, message) => {
  const stringifiedError = normalizeLine(`${error}`);
  if (message) {
    return `${message}: ${stringifiedError}`;
  }
  return stringifiedError;
};
const NewLine$3 = '\n';
const getNewLineIndex$1 = (string, startIndex = undefined) => {
  return string.indexOf(NewLine$3, startIndex);
};
const mergeStacks = (parent, child) => {
  if (!child) {
    return parent;
  }
  const parentNewLineIndex = getNewLineIndex$1(parent);
  const childNewLineIndex = getNewLineIndex$1(child);
  if (childNewLineIndex === -1) {
    return parent;
  }
  const parentFirstLine = parent.slice(0, parentNewLineIndex);
  const childRest = child.slice(childNewLineIndex);
  const childFirstLine = normalizeLine(child.slice(0, childNewLineIndex));
  if (parentFirstLine.includes(childFirstLine)) {
    return parentFirstLine + childRest;
  }
  return child;
};
class VError extends Error {
  constructor(error, message) {
    const combinedMessage = getCombinedMessage(error, message);
    super(combinedMessage);
    this.name = 'VError';
    if (error instanceof Error) {
      this.stack = mergeStacks(this.stack, error.stack);
    }
    if (error.codeFrame) {
      // @ts-ignore
      this.codeFrame = error.codeFrame;
    }
    if (error.code) {
      // @ts-ignore
      this.code = error.code;
    }
  }
}

const isMessagePort = value => {
  return value && value instanceof MessagePort;
};
const isMessagePortMain = value => {
  return value && value.constructor && value.constructor.name === 'MessagePortMain';
};
const isOffscreenCanvas = value => {
  return typeof OffscreenCanvas !== 'undefined' && value instanceof OffscreenCanvas;
};
const isInstanceOf = (value, constructorName) => {
  return value?.constructor?.name === constructorName;
};
const isSocket = value => {
  return isInstanceOf(value, 'Socket');
};
const transferrables = [isMessagePort, isMessagePortMain, isOffscreenCanvas, isSocket];
const isTransferrable = value => {
  for (const fn of transferrables) {
    if (fn(value)) {
      return true;
    }
  }
  return false;
};
const walkValue = (value, transferrables, isTransferrable) => {
  if (!value) {
    return;
  }
  if (isTransferrable(value)) {
    transferrables.push(value);
    return;
  }
  if (Array.isArray(value)) {
    for (const item of value) {
      walkValue(item, transferrables, isTransferrable);
    }
    return;
  }
  if (typeof value === 'object') {
    for (const property of Object.values(value)) {
      walkValue(property, transferrables, isTransferrable);
    }
    return;
  }
};
const getTransferrables = value => {
  const transferrables = [];
  walkValue(value, transferrables, isTransferrable);
  return transferrables;
};
const attachEvents = that => {
  const handleMessage = (...args) => {
    const data = that.getData(...args);
    that.dispatchEvent(new MessageEvent('message', {
      data
    }));
  };
  that.onMessage(handleMessage);
  const handleClose = event => {
    that.dispatchEvent(new Event('close'));
  };
  that.onClose(handleClose);
};
class Ipc extends EventTarget {
  constructor(rawIpc) {
    super();
    this._rawIpc = rawIpc;
    attachEvents(this);
  }
}
const E_INCOMPATIBLE_NATIVE_MODULE = 'E_INCOMPATIBLE_NATIVE_MODULE';
const E_MODULES_NOT_SUPPORTED_IN_ELECTRON = 'E_MODULES_NOT_SUPPORTED_IN_ELECTRON';
const ERR_MODULE_NOT_FOUND = 'ERR_MODULE_NOT_FOUND';
const NewLine$2 = '\n';
const joinLines$2 = lines => {
  return lines.join(NewLine$2);
};
const RE_AT = /^\s+at/;
const RE_AT_PROMISE_INDEX = /^\s*at async Promise.all \(index \d+\)$/;
const isNormalStackLine = line => {
  return RE_AT.test(line) && !RE_AT_PROMISE_INDEX.test(line);
};
const getDetails = lines => {
  const index = lines.findIndex(isNormalStackLine);
  if (index === -1) {
    return {
      actualMessage: joinLines$2(lines),
      rest: []
    };
  }
  let lastIndex = index - 1;
  while (++lastIndex < lines.length) {
    if (!isNormalStackLine(lines[lastIndex])) {
      break;
    }
  }
  return {
    actualMessage: lines[index - 1],
    rest: lines.slice(index, lastIndex)
  };
};
const splitLines$1 = lines => {
  return lines.split(NewLine$2);
};
const RE_MESSAGE_CODE_BLOCK_START = /^Error: The module '.*'$/;
const RE_MESSAGE_CODE_BLOCK_END = /^\s* at/;
const isMessageCodeBlockStartIndex = line => {
  return RE_MESSAGE_CODE_BLOCK_START.test(line);
};
const isMessageCodeBlockEndIndex = line => {
  return RE_MESSAGE_CODE_BLOCK_END.test(line);
};
const getMessageCodeBlock = stderr => {
  const lines = splitLines$1(stderr);
  const startIndex = lines.findIndex(isMessageCodeBlockStartIndex);
  const endIndex = startIndex + lines.slice(startIndex).findIndex(isMessageCodeBlockEndIndex, startIndex);
  const relevantLines = lines.slice(startIndex, endIndex);
  const relevantMessage = relevantLines.join(' ').slice('Error: '.length);
  return relevantMessage;
};
const isModuleNotFoundMessage = line => {
  return line.includes('[ERR_MODULE_NOT_FOUND]');
};
const getModuleNotFoundError = stderr => {
  const lines = splitLines$1(stderr);
  const messageIndex = lines.findIndex(isModuleNotFoundMessage);
  const message = lines[messageIndex];
  return {
    code: ERR_MODULE_NOT_FOUND,
    message
  };
};
const isModuleNotFoundError = stderr => {
  if (!stderr) {
    return false;
  }
  return stderr.includes('ERR_MODULE_NOT_FOUND');
};
const isModulesSyntaxError = stderr => {
  if (!stderr) {
    return false;
  }
  return stderr.includes('SyntaxError: Cannot use import statement outside a module');
};
const RE_NATIVE_MODULE_ERROR = /^innerError Error: Cannot find module '.*.node'/;
const RE_NATIVE_MODULE_ERROR_2 = /was compiled against a different Node.js version/;
const isUnhelpfulNativeModuleError = stderr => {
  return RE_NATIVE_MODULE_ERROR.test(stderr) && RE_NATIVE_MODULE_ERROR_2.test(stderr);
};
const getNativeModuleErrorMessage = stderr => {
  const message = getMessageCodeBlock(stderr);
  return {
    code: E_INCOMPATIBLE_NATIVE_MODULE,
    message: `Incompatible native node module: ${message}`
  };
};
const getModuleSyntaxError = () => {
  return {
    code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON,
    message: `ES Modules are not supported in electron`
  };
};
const getHelpfulChildProcessError = (stdout, stderr) => {
  if (isUnhelpfulNativeModuleError(stderr)) {
    return getNativeModuleErrorMessage(stderr);
  }
  if (isModulesSyntaxError(stderr)) {
    return getModuleSyntaxError();
  }
  if (isModuleNotFoundError(stderr)) {
    return getModuleNotFoundError(stderr);
  }
  const lines = splitLines$1(stderr);
  const {
    actualMessage,
    rest
  } = getDetails(lines);
  return {
    code: '',
    message: actualMessage,
    stack: rest
  };
};
class IpcError extends VError {
  // @ts-ignore
  constructor(betterMessage, stdout = '', stderr = '') {
    if (stdout || stderr) {
      // @ts-ignore
      const {
        code,
        message,
        stack
      } = getHelpfulChildProcessError(stdout, stderr);
      const cause = new Error(message);
      // @ts-ignore
      cause.code = code;
      cause.stack = stack;
      super(cause, betterMessage);
    } else {
      super(betterMessage);
    }
    // @ts-ignore
    this.name = 'IpcError';
    // @ts-ignore
    this.stdout = stdout;
    // @ts-ignore
    this.stderr = stderr;
  }
}
const readyMessage = 'ready';
const getData$2 = event => {
  return event.data;
};
const listen$7 = () => {
  // @ts-ignore
  if (typeof WorkerGlobalScope === 'undefined') {
    throw new TypeError('module is not in web worker scope');
  }
  return globalThis;
};
const signal$8 = global => {
  global.postMessage(readyMessage);
};
class IpcChildWithModuleWorker extends Ipc {
  getData(event) {
    return getData$2(event);
  }
  send(message) {
    // @ts-ignore
    this._rawIpc.postMessage(message);
  }
  sendAndTransfer(message) {
    const transfer = getTransferrables(message);
    // @ts-ignore
    this._rawIpc.postMessage(message, transfer);
  }
  dispose() {
    // ignore
  }
  onClose(callback) {
    // ignore
  }
  onMessage(callback) {
    this._rawIpc.addEventListener('message', callback);
  }
}
const wrap$f = global => {
  return new IpcChildWithModuleWorker(global);
};
const waitForFirstMessage = async port => {
  const {
    promise,
    resolve
  } = Promise.withResolvers();
  port.addEventListener('message', resolve, {
    once: true
  });
  const event = await promise;
  // @ts-ignore
  return event.data;
};
const listen$6 = async () => {
  const parentIpcRaw = listen$7();
  signal$8(parentIpcRaw);
  const parentIpc = wrap$f(parentIpcRaw);
  const firstMessage = await waitForFirstMessage(parentIpc);
  if (firstMessage.method !== 'initialize') {
    throw new IpcError('unexpected first message');
  }
  const type = firstMessage.params[0];
  if (type === 'message-port') {
    parentIpc.send({
      id: firstMessage.id,
      jsonrpc: '2.0',
      result: null
    });
    parentIpc.dispose();
    const port = firstMessage.params[1];
    return port;
  }
  return globalThis;
};
class IpcChildWithModuleWorkerAndMessagePort extends Ipc {
  getData(event) {
    return getData$2(event);
  }
  send(message) {
    this._rawIpc.postMessage(message);
  }
  sendAndTransfer(message) {
    const transfer = getTransferrables(message);
    this._rawIpc.postMessage(message, transfer);
  }
  dispose() {
    if (this._rawIpc.close) {
      this._rawIpc.close();
    }
  }
  onClose(callback) {
    // ignore
  }
  onMessage(callback) {
    this._rawIpc.addEventListener('message', callback);
    this._rawIpc.start();
  }
}
const wrap$e = port => {
  return new IpcChildWithModuleWorkerAndMessagePort(port);
};
const IpcChildWithModuleWorkerAndMessagePort$1 = {
  __proto__: null,
  listen: listen$6,
  wrap: wrap$e
};

class CommandNotFoundError extends Error {
  constructor(command) {
    super(`Command not found ${command}`);
    this.name = 'CommandNotFoundError';
  }
}
const commands = Object.create(null);
const register = commandMap => {
  Object.assign(commands, commandMap);
};
const getCommand = key => {
  return commands[key];
};
const execute = (command, ...args) => {
  const fn = getCommand(command);
  if (!fn) {
    throw new CommandNotFoundError(command);
  }
  return fn(...args);
};

const Two$1 = '2.0';
const callbacks = Object.create(null);
const get$2 = id => {
  return callbacks[id];
};
const remove$1 = id => {
  delete callbacks[id];
};
class JsonRpcError extends Error {
  constructor(message) {
    super(message);
    this.name = 'JsonRpcError';
  }
}
const NewLine$1 = '\n';
const DomException = 'DOMException';
const ReferenceError$1 = 'ReferenceError';
const SyntaxError$1 = 'SyntaxError';
const TypeError$1 = 'TypeError';
const getErrorConstructor = (message, type) => {
  if (type) {
    switch (type) {
      case DomException:
        return DOMException;
      case ReferenceError$1:
        return ReferenceError;
      case SyntaxError$1:
        return SyntaxError;
      case TypeError$1:
        return TypeError;
      default:
        return Error;
    }
  }
  if (message.startsWith('TypeError: ')) {
    return TypeError;
  }
  if (message.startsWith('SyntaxError: ')) {
    return SyntaxError;
  }
  if (message.startsWith('ReferenceError: ')) {
    return ReferenceError;
  }
  return Error;
};
const constructError = (message, type, name) => {
  const ErrorConstructor = getErrorConstructor(message, type);
  if (ErrorConstructor === DOMException && name) {
    return new ErrorConstructor(message, name);
  }
  if (ErrorConstructor === Error) {
    const error = new Error(message);
    if (name && name !== 'VError') {
      error.name = name;
    }
    return error;
  }
  return new ErrorConstructor(message);
};
const joinLines$1 = lines => {
  return lines.join(NewLine$1);
};
const splitLines = lines => {
  return lines.split(NewLine$1);
};
const getCurrentStack = () => {
  const stackLinesToSkip = 3;
  const currentStack = joinLines$1(splitLines(new Error().stack || '').slice(stackLinesToSkip));
  return currentStack;
};
const getNewLineIndex = (string, startIndex = undefined) => {
  return string.indexOf(NewLine$1, startIndex);
};
const getParentStack = error => {
  let parentStack = error.stack || error.data || error.message || '';
  if (parentStack.startsWith('    at')) {
    parentStack = error.message + NewLine$1 + parentStack;
  }
  return parentStack;
};
const MethodNotFound = -32601;
const Custom = -32001;
const restoreJsonRpcError = error => {
  const currentStack = getCurrentStack();
  if (error && error instanceof Error) {
    if (typeof error.stack === 'string') {
      error.stack = error.stack + NewLine$1 + currentStack;
    }
    return error;
  }
  if (error && error.code && error.code === MethodNotFound) {
    const restoredError = new JsonRpcError(error.message);
    const parentStack = getParentStack(error);
    restoredError.stack = parentStack + NewLine$1 + currentStack;
    return restoredError;
  }
  if (error && error.message) {
    const restoredError = constructError(error.message, error.type, error.name);
    if (error.data) {
      if (error.data.stack && error.data.type && error.message) {
        restoredError.stack = error.data.type + ': ' + error.message + NewLine$1 + error.data.stack + NewLine$1 + currentStack;
      } else if (error.data.stack) {
        restoredError.stack = error.data.stack;
      }
      if (error.data.codeFrame) {
        // @ts-ignore
        restoredError.codeFrame = error.data.codeFrame;
      }
      if (error.data.code) {
        // @ts-ignore
        restoredError.code = error.data.code;
      }
      if (error.data.type) {
        // @ts-ignore
        restoredError.name = error.data.type;
      }
    } else {
      if (error.stack) {
        const lowerStack = restoredError.stack || '';
        // @ts-ignore
        const indexNewLine = getNewLineIndex(lowerStack);
        const parentStack = getParentStack(error);
        // @ts-ignore
        restoredError.stack = parentStack + lowerStack.slice(indexNewLine);
      }
      if (error.codeFrame) {
        // @ts-ignore
        restoredError.codeFrame = error.codeFrame;
      }
    }
    return restoredError;
  }
  if (typeof error === 'string') {
    return new Error(`JsonRpc Error: ${error}`);
  }
  return new Error(`JsonRpc Error: ${error}`);
};
const unwrapJsonRpcResult = responseMessage => {
  if ('error' in responseMessage) {
    const restoredError = restoreJsonRpcError(responseMessage.error);
    throw restoredError;
  }
  if ('result' in responseMessage) {
    return responseMessage.result;
  }
  throw new JsonRpcError('unexpected response message');
};
const warn = (...args) => {
  console.warn(...args);
};
const resolve = (id, response) => {
  const fn = get$2(id);
  if (!fn) {
    console.log(response);
    warn(`callback ${id} may already be disposed`);
    return;
  }
  fn(response);
  remove$1(id);
};
const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
const getErrorType = prettyError => {
  if (prettyError && prettyError.type) {
    return prettyError.type;
  }
  if (prettyError && prettyError.constructor && prettyError.constructor.name) {
    return prettyError.constructor.name;
  }
  return undefined;
};
const isAlreadyStack = line => {
  return line.trim().startsWith('at ');
};
const getStack = prettyError => {
  const stackString = prettyError.stack || '';
  const newLineIndex = stackString.indexOf('\n');
  if (newLineIndex !== -1 && !isAlreadyStack(stackString.slice(0, newLineIndex))) {
    return stackString.slice(newLineIndex + 1);
  }
  return stackString;
};
const getErrorProperty = (error, prettyError) => {
  if (error && error.code === E_COMMAND_NOT_FOUND) {
    return {
      code: MethodNotFound,
      data: error.stack,
      message: error.message
    };
  }
  return {
    code: Custom,
    data: {
      code: prettyError.code,
      codeFrame: prettyError.codeFrame,
      name: prettyError.name,
      stack: getStack(prettyError),
      type: getErrorType(prettyError)
    },
    message: prettyError.message
  };
};
const create$1$1 = (id, error) => {
  return {
    error,
    id,
    jsonrpc: Two$1
  };
};
const getErrorResponse = (id, error, preparePrettyError, logError) => {
  const prettyError = preparePrettyError(error);
  logError(error, prettyError);
  const errorProperty = getErrorProperty(error, prettyError);
  return create$1$1(id, errorProperty);
};
const create$7 = (message, result) => {
  return {
    id: message.id,
    jsonrpc: Two$1,
    result: result ?? null
  };
};
const getSuccessResponse = (message, result) => {
  const resultProperty = result ?? null;
  return create$7(message, resultProperty);
};
const getErrorResponseSimple = (id, error) => {
  return {
    error: {
      code: Custom,
      data: error,
      // @ts-ignore
      message: error.message
    },
    id,
    jsonrpc: Two$1
  };
};
const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
  try {
    const result = requiresSocket(message.method) ? await execute(message.method, ipc, ...message.params) : await execute(message.method, ...message.params);
    return getSuccessResponse(message, result);
  } catch (error) {
    if (ipc.canUseSimpleErrorResponse) {
      return getErrorResponseSimple(message.id, error);
    }
    return getErrorResponse(message.id, error, preparePrettyError, logError);
  }
};
const defaultPreparePrettyError = error => {
  return error;
};
const defaultLogError = () => {
  // ignore
};
const defaultRequiresSocket = () => {
  return false;
};
const defaultResolve = resolve;

// TODO maybe remove this in v6 or v7, only accept options object to simplify the code
const normalizeParams = args => {
  if (args.length === 1) {
    const options = args[0];
    return {
      execute: options.execute,
      ipc: options.ipc,
      logError: options.logError || defaultLogError,
      message: options.message,
      preparePrettyError: options.preparePrettyError || defaultPreparePrettyError,
      requiresSocket: options.requiresSocket || defaultRequiresSocket,
      resolve: options.resolve || defaultResolve
    };
  }
  return {
    execute: args[2],
    ipc: args[0],
    logError: args[5],
    message: args[1],
    preparePrettyError: args[4],
    requiresSocket: args[6],
    resolve: args[3]
  };
};
const handleJsonRpcMessage = async (...args) => {
  const options = normalizeParams(args);
  const {
    execute,
    ipc,
    logError,
    message,
    preparePrettyError,
    requiresSocket,
    resolve
  } = options;
  if ('id' in message) {
    if ('method' in message) {
      const response = await getResponse(message, ipc, execute, preparePrettyError, logError, requiresSocket);
      try {
        ipc.send(response);
      } catch (error) {
        const errorResponse = getErrorResponse(message.id, error, preparePrettyError, logError);
        ipc.send(errorResponse);
      }
      return;
    }
    resolve(message.id, message);
    return;
  }
  if ('method' in message) {
    await getResponse(message, ipc, execute, preparePrettyError, logError, requiresSocket);
    return;
  }
  throw new JsonRpcError('unexpected message');
};

const Two = '2.0';

const create$6 = (method, params) => {
  return {
    jsonrpc: Two,
    method,
    params
  };
};

const create$5 = (id, method, params) => {
  const message = {
    id,
    jsonrpc: Two,
    method,
    params
  };
  return message;
};

let id = 0;
const create$4 = () => {
  return ++id;
};

const registerPromise = map => {
  const id = create$4();
  const {
    promise,
    resolve
  } = Promise.withResolvers();
  map[id] = resolve;
  return {
    id,
    promise
  };
};

const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer) => {
  const {
    id,
    promise
  } = registerPromise(callbacks);
  const message = create$5(id, method, params);
  if (useSendAndTransfer && ipc.sendAndTransfer) {
    ipc.sendAndTransfer(message);
  } else {
    ipc.send(message);
  }
  const responseMessage = await promise;
  return unwrapJsonRpcResult(responseMessage);
};
const createRpc = ipc => {
  const callbacks = Object.create(null);
  ipc._resolve = (id, response) => {
    const fn = callbacks[id];
    if (!fn) {
      console.warn(`callback ${id} may already be disposed`);
      return;
    }
    fn(response);
    delete callbacks[id];
  };
  const rpc = {
    async dispose() {
      await ipc?.dispose();
    },
    invoke(method, ...params) {
      return invokeHelper(callbacks, ipc, method, params, false);
    },
    invokeAndTransfer(method, ...params) {
      return invokeHelper(callbacks, ipc, method, params, true);
    },
    // @ts-ignore
    ipc,
    /**
     * @deprecated
     */
    send(method, ...params) {
      const message = create$6(method, params);
      ipc.send(message);
    }
  };
  return rpc;
};

const requiresSocket = () => {
  return false;
};
const preparePrettyError = error => {
  return error;
};
const logError = () => {
  // handled by renderer worker
};
const handleMessage = event => {
  const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
  const actualExecute = event?.target?.execute || execute;
  return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
};

const handleIpc = ipc => {
  if ('addEventListener' in ipc) {
    ipc.addEventListener('message', handleMessage);
  } else if ('on' in ipc) {
    // deprecated
    ipc.on('message', handleMessage);
  }
};

const listen$1 = async (module, options) => {
  const rawIpc = await module.listen(options);
  if (module.signal) {
    module.signal(rawIpc);
  }
  const ipc = module.wrap(rawIpc);
  return ipc;
};

const create$3 = async ({
  commandMap
}) => {
  // TODO create a commandMap per rpc instance
  register(commandMap);
  const ipc = await listen$1(IpcChildWithModuleWorkerAndMessagePort$1);
  handleIpc(ipc);
  const rpc = createRpc(ipc);
  return rpc;
};

const createMockRpc = ({
  commandMap
}) => {
  const invocations = [];
  const invoke = (method, ...params) => {
    invocations.push([method, ...params]);
    const command = commandMap[method];
    if (!command) {
      throw new Error(`command ${method} not found`);
    }
    return command(...params);
  };
  const mockRpc = {
    invocations,
    invoke,
    invokeAndTransfer: invoke
  };
  return mockRpc;
};

const rpcs = Object.create(null);
const set$2 = (id, rpc) => {
  rpcs[id] = rpc;
};
const get$1 = id => {
  return rpcs[id];
};
const remove = id => {
  delete rpcs[id];
};

/* eslint-disable  @typescript-eslint/explicit-function-return-type */
const create$2 = rpcId => {
  return {
    async dispose() {
      const rpc = get$1(rpcId);
      await rpc.dispose();
    },
    // @ts-ignore
    invoke(method, ...params) {
      const rpc = get$1(rpcId);
      // @ts-ignore
      return rpc.invoke(method, ...params);
    },
    // @ts-ignore
    invokeAndTransfer(method, ...params) {
      const rpc = get$1(rpcId);
      // @ts-ignore
      return rpc.invokeAndTransfer(method, ...params);
    },
    registerMockRpc(commandMap) {
      const mockRpc = createMockRpc({
        commandMap
      });
      set$2(rpcId, mockRpc);
      // @ts-ignore
      mockRpc[Symbol.dispose] = () => {
        remove(rpcId);
      };
      // @ts-ignore
      return mockRpc;
    },
    set(rpc) {
      set$2(rpcId, rpc);
    }
  };
};

const Button$2 = 1;
const Div = 4;
const Text = 12;
const Br = 55;

const TargetName = 'event.target.name';

const Tab = 2;
const Escape = 8;

const Shift = 1 << 10 >>> 0;

const RendererWorker = 1;

const {
  invoke,
  set: set$1
} = create$2(RendererWorker);
const getElectronVersion$1 = async () => {
  return invoke('Process.getElectronVersion');
};
const getNodeVersion$1 = async () => {
  return invoke('Process.getNodeVersion');
};
const getChromeVersion$1 = async () => {
  return invoke('Process.getChromeVersion');
};
const getV8Version$1 = async () => {
  return invoke('Process.getV8Version');
};
const setFocus = key => {
  return invoke('Focus.setFocus', key);
};
const closeWidget$1 = async widgetId => {
  return invoke('Viewlet.closeWidget', widgetId);
};
const writeClipBoardText = async text => {
  await invoke('ClipBoard.writeText', /* text */text);
};
const showMessageBox$1 = async options => {
  return invoke('ElectronDialog.showMessageBox', options);
};
const openWidget = async name => {
  await invoke('Viewlet.openWidget', name);
};
const getWindowId$1 = async () => {
  return invoke('GetWindowId.getWindowId');
};

const toCommandId = key => {
  const dotIndex = key.indexOf('.');
  return key.slice(dotIndex + 1);
};
const create$1 = () => {
  const states = Object.create(null);
  const commandMapRef = {};
  return {
    clear() {
      for (const key of Object.keys(states)) {
        delete states[key];
      }
    },
    diff(uid, modules, numbers) {
      const {
        newState,
        oldState
      } = states[uid];
      const diffResult = [];
      for (let i = 0; i < modules.length; i++) {
        const fn = modules[i];
        if (!fn(oldState, newState)) {
          diffResult.push(numbers[i]);
        }
      }
      return diffResult;
    },
    dispose(uid) {
      delete states[uid];
    },
    get(uid) {
      return states[uid];
    },
    getCommandIds() {
      const keys = Object.keys(commandMapRef);
      const ids = keys.map(toCommandId);
      return ids;
    },
    getKeys() {
      return Object.keys(states).map(key => {
        return Number.parseFloat(key);
      });
    },
    registerCommands(commandMap) {
      Object.assign(commandMapRef, commandMap);
    },
    set(uid, oldState, newState) {
      states[uid] = {
        newState,
        oldState
      };
    },
    wrapCommand(fn) {
      const wrapped = async (uid, ...args) => {
        const {
          newState,
          oldState
        } = states[uid];
        const newerState = await fn(newState, ...args);
        if (oldState === newerState || newState === newerState) {
          return;
        }
        const latestOld = states[uid];
        const latestNew = {
          ...latestOld.newState,
          ...newerState
        };
        states[uid] = {
          newState: latestNew,
          oldState: latestOld.oldState
        };
      };
      return wrapped;
    },
    wrapGetter(fn) {
      const wrapped = (uid, ...args) => {
        const {
          newState
        } = states[uid];
        return fn(newState, ...args);
      };
      return wrapped;
    },
    wrapLoadContent(fn) {
      const wrapped = async (uid, ...args) => {
        const {
          newState,
          oldState
        } = states[uid];
        const result = await fn(newState, ...args);
        const {
          error,
          state
        } = result;
        if (oldState === state || newState === state) {
          return {
            error
          };
        }
        const latestOld = states[uid];
        const latestNew = {
          ...latestOld.newState,
          ...state
        };
        states[uid] = {
          newState: latestNew,
          oldState: latestOld.oldState
        };
        return {
          error
        };
      };
      return wrapped;
    }
  };
};

const {
  dispose: dispose$1,
  get,
  getCommandIds,
  registerCommands,
  set,
  wrapCommand
} = create$1();

const create = uid => {
  const state = {
    focusId: 0,
    lines: [],
    productName: '',
    uid
  };
  set(uid, state, state);
};

const RenderFocus = 2;
const RenderFocusContext = 4;
const RenderAbout = 3;

const diffType$2 = RenderAbout;
const isEqual$2 = (oldState, newState) => {
  return oldState.productName === newState.productName && JSON.stringify(oldState.lines) === JSON.stringify(newState.lines);
};

const diffType$1 = RenderFocus;
const isEqual$1 = (oldState, newState) => {
  return oldState.focusId === newState.focusId;
};

const diffType = RenderFocusContext;
const isEqual = (oldState, newState) => {
  return oldState.focusId === newState.focusId;
};

const modules = [isEqual$2, isEqual$1, isEqual];
const numbers = [diffType$2, diffType$1, diffType];

const diff = (oldState, newState) => {
  const diffResult = [];
  for (let i = 0; i < modules.length; i++) {
    const fn = modules[i];
    if (!fn(oldState, newState)) {
      diffResult.push(numbers[i]);
    }
  }
  return diffResult;
};

const diff2 = uid => {
  const {
    newState,
    oldState
  } = get(uid);
  const diffResult = diff(oldState, newState);
  return diffResult;
};

const dispose = uid => {
  dispose$1(uid);
};

const None = 0;
const Ok$2 = 1;
const Copy$2 = 2;

const getNextFocus = focusId => {
  switch (focusId) {
    case Copy$2:
      return Ok$2;
    case Ok$2:
      return Copy$2;
    default:
      return None;
  }
};

const focusNext = state => {
  const {
    focusId
  } = state;
  return {
    ...state,
    focusId: getNextFocus(focusId)
  };
};

const getPreviousFocus = focusId => {
  switch (focusId) {
    case Copy$2:
      return Ok$2;
    case Ok$2:
      return Copy$2;
    default:
      return None;
  }
};

const focusPrevious = state => {
  const {
    focusId
  } = state;
  return {
    ...state,
    focusId: getPreviousFocus(focusId)
  };
};

const mergeClassNames = (...classNames) => {
  return classNames.filter(Boolean).join(' ');
};

const text = data => {
  return {
    childCount: 0,
    text: data,
    type: Text
  };
};

const FocusAbout = 4;

const getKeyBindings = () => {
  return [{
    command: 'About.handleClickClose',
    key: Escape,
    when: FocusAbout
  }, {
    command: 'About.focusNext',
    key: Tab,
    when: FocusAbout
  }, {
    command: 'About.focusPrevious',
    key: Tab | Shift,
    when: FocusAbout
  }];
};

const closeWidget = closeWidget$1;

const About$1 = 'About';

const close = async () => {
  await closeWidget(About$1);
};

const handleClickClose = async state => {
  await close();
  return state;
};

const writeText = async text => {
  await writeClipBoardText(text);
};

const NewLine = '\n';

const joinLines = lines => {
  return lines.join(NewLine);
};

const copy$1 = async lines => {
  const message = joinLines(lines);
  await writeText(message);
};

const handleClickCopy = async state => {
  const {
    lines
  } = state;
  await copy$1(lines);
  await close();
  return state;
};

const handleClickOk = async state => {
  await close();
  return state;
};

const Ok$1 = 'Ok';
const Copy$1 = 'Copy';
const Close = 'Close';

const handleClickButton = async (state, name) => {
  switch (name) {
    case Close:
      return handleClickClose(state);
    case Copy$1:
      return handleClickCopy(state);
    case Ok$1:
      return handleClickOk(state);
    default:
      throw new Error(`unexpected button`);
  }
};

const handleFocusIn = async state => {
  // TODO remove side effect
  await setFocus(FocusAbout);
  if (state.focusId) {
    return state;
  }
  return {
    ...state,
    focusId: Ok$2
  };
};

const commit = '35b66b5';

const commitDate = '2026-05-28T22:55:27.000Z';

const OneSecondAgo = '1 second ago';
const SomeSecondsAgo = '{PH1} seconds ago';
const OneMinuteAgo = '1 minute ago';
const SomeMinutesAgo = '{PH1} minutes ago';
const OneHourAgo = '1 hour ago';
const SomeHoursAgo = '{PH1} hours ago';
const OneDayAgo = '1 day ago';
const SomeDaysAgo = '{PH1} days ago';
const OneWeekAgo = '1 week ago';
const SomeWeeksAgo = '{PH1} weeks ago';
const OneMonthAgo = '1 month ago';
const SomeMonthsAgo = '{PH1} months ago';
const OneYearAgo = '1 year ago';
const SomeYearsAgo = '{PH1} years ago';
const InOneSecond = 'in 1 second';
const InSomeSeconds = 'in {PH1} seconds';
const InOneMinute = 'in 1 minute';
const InSomeMinutes = 'in {PH1} minutes';
const InOneHour = 'in 1 hour';
const InSomeHours = 'in {PH1} hours';
const InOneDay = 'in 1 day';
const InSomeDays = 'in {PH1} days';
const InOneWeek = 'in 1 week';
const InSomeWeeks = 'in {PH1} weeks';
const InOneMonth = 'in 1 month';
const InSomeMonths = 'in {PH1} months';
const InOneYear = 'in 1 year';
const InSomeYears = 'in {PH1} years';

const emptyObject = {};
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
const i18nString = (key, placeholders = emptyObject) => {
  if (placeholders === emptyObject) {
    return key;
  }
  const replacer = (match, rest) => {
    return placeholders[rest];
  };
  return key.replaceAll(RE_PLACEHOLDER, replacer);
};

// based on https://github.com/microsoft/vscode/blob/bd782eb059e133d3a20fdb446b8feb0010a278ad/src/vs/base/common/date.ts (License MIT)
const oneSecondAgo = () => {
  return i18nString(OneSecondAgo);
};
const someSecondsAgo = seconds => {
  return i18nString(SomeSecondsAgo, {
    PH1: seconds
  });
};
const oneMinuteAgo = () => {
  return i18nString(OneMinuteAgo);
};
const someMinutesAgo = minutes => {
  return i18nString(SomeMinutesAgo, {
    PH1: minutes
  });
};
const oneHourAgo = () => {
  return i18nString(OneHourAgo);
};
const someHoursAgo = hours => {
  return i18nString(SomeHoursAgo, {
    PH1: hours
  });
};
const oneDayAgo = () => {
  return i18nString(OneDayAgo);
};
const someDaysAgo = days => {
  return i18nString(SomeDaysAgo, {
    PH1: days
  });
};
const oneWeekAgo = () => {
  return i18nString(OneWeekAgo);
};
const someWeeksAgo = weeks => {
  return i18nString(SomeWeeksAgo, {
    PH1: weeks
  });
};
const oneMonthAgo = () => {
  return i18nString(OneMonthAgo);
};
const someMonthsAgo = months => {
  return i18nString(SomeMonthsAgo, {
    PH1: months
  });
};
const oneYearAgo = () => {
  return i18nString(OneYearAgo);
};
const someYearsAgo = years => {
  return i18nString(SomeYearsAgo, {
    PH1: years
  });
};
const inOneSecond = () => {
  return i18nString(InOneSecond);
};
const inSomeSeconds = seconds => {
  return i18nString(InSomeSeconds, {
    PH1: seconds
  });
};
const inOneMinute = () => {
  return i18nString(InOneMinute);
};
const inSomeMinutes = minutes => {
  return i18nString(InSomeMinutes, {
    PH1: minutes
  });
};
const inOneHour = () => {
  return i18nString(InOneHour);
};
const inSomeHours = hours => {
  return i18nString(InSomeHours, {
    PH1: hours
  });
};
const inOneDay = () => {
  return i18nString(InOneDay);
};
const inSomeDays = days => {
  return i18nString(InSomeDays, {
    PH1: days
  });
};
const inOneWeek = () => {
  return i18nString(InOneWeek);
};
const inSomeWeeks = weeks => {
  return i18nString(InSomeWeeks, {
    PH1: weeks
  });
};
const inOneMonth = () => {
  return i18nString(InOneMonth);
};
const inSomeMonths = months => {
  return i18nString(InSomeMonths, {
    PH1: months
  });
};
const inOneYear = () => {
  return i18nString(InOneYear);
};
const inSomeYears = years => {
  return i18nString(InSomeYears, {
    PH1: years
  });
};

const formatRelativeDateRange = (seconds, range) => {
  const value = Math.floor(seconds / range.divisor);
  if (value === 1) {
    return range.one();
  }
  return range.some(value);
};
const formatRelativeDate = (seconds, ranges) => {
  for (const range of ranges) {
    if (seconds < range.limit) {
      return formatRelativeDateRange(seconds, range);
    }
  }
  throw new Error('unreachable');
};

const minute = 60;
const hour = minute * 60;
const day = hour * 24;
const week = day * 7;
const month = day * 30;
const year = day * 365;

// based on https://github.com/microsoft/vscode/blob/bd782eb059e133d3a20fdb446b8feb0010a278ad/src/vs/base/common/date.ts (License MIT)
const ranges$1 = [{
  divisor: 1,
  limit: minute,
  one: inOneSecond,
  some: inSomeSeconds
}, {
  divisor: minute,
  limit: hour,
  one: inOneMinute,
  some: inSomeMinutes
}, {
  divisor: hour,
  limit: day,
  one: inOneHour,
  some: inSomeHours
}, {
  divisor: day,
  limit: week,
  one: inOneDay,
  some: inSomeDays
}, {
  divisor: week,
  limit: month,
  one: inOneWeek,
  some: inSomeWeeks
}, {
  divisor: month,
  limit: year,
  one: inOneMonth,
  some: inSomeMonths
}, {
  divisor: year,
  limit: Number.POSITIVE_INFINITY,
  one: inOneYear,
  some: inSomeYears
}];
const formatDateFuture = seconds => {
  return formatRelativeDate(seconds, ranges$1);
};

// based on https://github.com/microsoft/vscode/blob/bd782eb059e133d3a20fdb446b8feb0010a278ad/src/vs/base/common/date.ts (License MIT)
const ranges = [{
  divisor: 1,
  limit: minute,
  one: oneSecondAgo,
  some: someSecondsAgo
}, {
  divisor: minute,
  limit: hour,
  one: oneMinuteAgo,
  some: someMinutesAgo
}, {
  divisor: hour,
  limit: day,
  one: oneHourAgo,
  some: someHoursAgo
}, {
  divisor: day,
  limit: week,
  one: oneDayAgo,
  some: someDaysAgo
}, {
  divisor: week,
  limit: month,
  one: oneWeekAgo,
  some: someWeeksAgo
}, {
  divisor: month,
  limit: year,
  one: oneMonthAgo,
  some: someMonthsAgo
}, {
  divisor: year,
  limit: Number.POSITIVE_INFINITY,
  one: oneYearAgo,
  some: someYearsAgo
}];
const formatDatePast = seconds => {
  return formatRelativeDate(seconds, ranges);
};

// based on https://github.com/microsoft/vscode/blob/bd782eb059e133d3a20fdb446b8feb0010a278ad/src/vs/base/common/date.ts (License MIT)
const formatDate = (date, now) => {
  const difference = now - date;
  const seconds = Math.round(difference / 1000);
  if (seconds >= 0) {
    return formatDatePast(seconds);
  }
  return formatDateFuture(-seconds);
};

const formatAboutDate = (isoDate, now) => {
  if (!isoDate) {
    return 'unknown';
  }
  const date = new Date(isoDate).getTime();
  if (Number.isNaN(date)) {
    return `Invalid Date: ${isoDate}`;
  }
  const ago = formatDate(date, now);
  return `${isoDate} (${ago})`;
};

const getBrowser = () => {
  // @ts-ignore
  return `${navigator.userAgent}`;
};

const version = '0.82.3';

const getDetailStringWeb = () => {
  const now = Date.now();
  const formattedDate = formatAboutDate(commitDate, now);
  const browser = getBrowser();
  const lines = [`Version: ${version}`, `Commit: ${commit}`, `Date: ${formattedDate}`, `Browser: ${browser}`];
  return lines;
};

const getElectronVersion = getElectronVersion$1;
const getNodeVersion = getNodeVersion$1;
const getChromeVersion = getChromeVersion$1;
const getVersion = () => {
  return version;
};
const getCommit = () => {
  return commit;
};
const getV8Version = getV8Version$1;
const getDate = () => {
  return commitDate;
};
const productNameLong$1 = 'Lvce Editor - OSS';

const loadContent2 = state => {
  const lines = getDetailStringWeb();
  return {
    ...state,
    focusId: Ok$2,
    lines,
    productName: productNameLong$1
  };
};

const Ok = 'Ok';
const Copy = 'Copy';
const Info$1 = 'Info';
const CloseDialog = 'Close Dialog';

const ok = () => {
  return i18nString(Ok);
};
const copy = () => {
  return i18nString(Copy);
};
const info = () => {
  return i18nString(Info$1);
};
const closeDialog = () => {
  return i18nString(CloseDialog);
};

const createViewModel = state => {
  const okMessage = ok();
  const copyMessage = copy();
  const closeMessage = closeDialog();
  const infoMessage = info();
  const {
    lines,
    productName
  } = state;
  return {
    closeMessage,
    copyMessage,
    infoMessage,
    lines,
    okMessage,
    productName
  };
};

const Button$1 = 'Button';
const ButtonPrimary = 'ButtonPrimary';
const ButtonSecondary = 'ButtonSecondary';
const DialogButtonsRow = 'DialogButtonsRow';
const DialogClose = 'DialogClose';
const DialogContent = 'DialogContent';
const DialogContentRight = 'DialogContentRight';
const DialogHeading$1 = 'DialogHeading';
const DialogMessage = 'DialogMessage';
const DialogMessageRow = 'DialogMessageRow';
const About = 'About';
const Viewlet = 'Viewlet';
const DialogToolBarRow = 'DialogToolBarRow';
const MaskIcon = 'MaskIcon';
const MaskIconClose = 'MaskIconClose';
const DialogIcon$1 = 'DialogIcon';
const DialogInfoIcon = 'DialogInfoIcon';
const MaskIconInfo = 'MaskIconInfo';

const HandleClickClose = 1;
const HandleClickButton = 4;
const HandleContextMenu = 5;
const HandleFocusIn = 6;

const br = {
  childCount: 0,
  type: Br
};
const renderLine = (line, index) => {
  if (index === 0) {
    return [text(line)];
  }
  return [br, text(line)];
};

const getAboutContentVirtualDom = lines => {
  const dom = [{
    childCount: lines.length * 2 - 1,
    className: DialogMessage,
    type: Div
  }, ...lines.flatMap(renderLine)];
  return dom;
};

const True = 'true';

const Button = 'button';
const Dialog = 'dialog';

const getPrimaryButtonVirtualDom = (message, name) => {
  return [{
    childCount: 1,
    className: mergeClassNames(Button$1, ButtonPrimary),
    name,
    onClick: HandleClickButton,
    type: Button$2
  }, text(message)];
};

const getSecondaryButtonVirtualDom = (message, name) => {
  return [{
    childCount: 1,
    className: mergeClassNames(Button$1, ButtonSecondary),
    name,
    onClick: HandleClickButton,
    type: Button$2
  }, text(message)];
};

const DialogIcon = 'DialogIcon';
const DialogHeading = 'DialogHeading';

const joinBySpace = (...items) => {
  return items.join(' ');
};

const Focusable = -1;

const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copyMessage, productName) => {
  const dom = [{
    ariaLabelledBy: joinBySpace(DialogIcon, DialogHeading),
    ariaModal: True,
    childCount: 3,
    className: DialogContent,
    onFocusIn: HandleFocusIn,
    role: Dialog,
    tabIndex: Focusable,
    type: Div
  }, {
    childCount: 1,
    className: DialogToolBarRow,
    type: Div
  }, {
    ariaLabel: closeMessage,
    childCount: 1,
    className: DialogClose,
    onClick: HandleClickClose,
    role: Button,
    type: Div
  }, {
    childCount: 0,
    className: mergeClassNames(MaskIcon, MaskIconClose),
    type: Div
  }, {
    childCount: 2,
    className: DialogMessageRow,
    type: Div
  }, {
    ariaLabel: infoMessage,
    childCount: 0,
    className: mergeClassNames(DialogIcon$1, DialogInfoIcon, MaskIcon, MaskIconInfo),
    id: DialogIcon,
    type: Div
  }, {
    childCount: 2,
    className: DialogContentRight,
    type: Div
  }, {
    childCount: 1,
    className: DialogHeading$1,
    id: DialogHeading,
    type: Div
  }, text(productName), ...content, {
    childCount: 2,
    className: DialogButtonsRow,
    type: Div
  }, ...getSecondaryButtonVirtualDom(okMessage, Ok$1), ...getPrimaryButtonVirtualDom(copyMessage, Copy$1)];
  return dom;
};

const getAboutVirtualDom = (productName, lines, closeMessage, okMessage, copyMessage, infoMessage) => {
  const content = getAboutContentVirtualDom(lines);
  return [{
    childCount: 1,
    className: mergeClassNames(Viewlet, About),
    onContextMenu: HandleContextMenu,
    type: Div
  }, ...getDialogVirtualDom(content, closeMessage, infoMessage, okMessage, copyMessage, productName)];
};

const renderDialog = (oldState, newState) => {
  const viewModel = createViewModel(newState);
  const dom = getAboutVirtualDom(viewModel.productName, viewModel.lines, viewModel.closeMessage, viewModel.okMessage, viewModel.copyMessage, viewModel.infoMessage);
  return ['Viewlet.setDom2', dom];
};

const getFocusSelector = focusId => {
  switch (focusId) {
    case Copy$2:
      return Copy$1;
    case Ok$2:
      return Ok$1;
    default:
      return '';
  }
};

const renderFocus = (oldState, newState) => {
  const name = getFocusSelector(newState.focusId);
  return ['Viewlet.focusElementByName', name];
};

const renderFocusContext = (oldState, newState) => {
  return ['Viewlet.setFocusContext', FocusAbout];
};

const getRenderer = diffType => {
  switch (diffType) {
    case RenderAbout:
      return renderDialog;
    case RenderFocus:
      return renderFocus;
    case RenderFocusContext:
      return renderFocusContext;
    default:
      throw new Error('unknown renderer');
  }
};

const applyRender = (oldState, newState, diffResult) => {
  const commands = [];
  for (const item of diffResult) {
    const fn = getRenderer(item);
    commands.push(fn(oldState, newState));
  }
  return commands;
};

const doRender = (uid, diffResult) => {
  const {
    newState,
    oldState
  } = get(uid);
  set(uid, newState, newState);
  const commands = applyRender(oldState, newState, diffResult);
  return commands;
};

const renderEventListeners = () => {
  return [{
    name: HandleClickButton,
    params: ['handleClickButton', TargetName]
  }, {
    name: HandleClickClose,
    params: ['handleClickClose'] // TODO
  }, {
    name: HandleFocusIn,
    params: ['handleFocusIn']
  }, {
    name: HandleContextMenu,
    params: [],
    preventDefault: true
  }];
};

const Electron = 2;

const showAboutDefault = async () => {
  await openWidget(About$1);
};

const getWindowId = getWindowId$1;

const productNameLong = 'Lvce Editor - OSS';
const getProductNameLong = () => {
  return productNameLong;
};

const showMessageBox = async options => {
  const productName = getProductNameLong();
  const windowId = await getWindowId();
  const finalOptions = {
    ...options,
    productName,
    windowId
  };
  return showMessageBox$1(finalOptions);
};

const Info = 'info';

/* eslint-disable @typescript-eslint/await-thenable */
const getDetailString = async () => {
  const [electronVersion, nodeVersion, chromeVersion, version, commit, v8Version, date] = await Promise.all([getElectronVersion(), getNodeVersion(), getChromeVersion(), getVersion(), getCommit(), getV8Version(), getDate()]);
  const now = Date.now();
  const formattedDate = formatAboutDate(date, now);
  const lines = [`Version: ${version}`, `Commit: ${commit}`, `Date: ${formattedDate}`, `Electron: ${electronVersion}`, `Chromium: ${chromeVersion}`, `Node: ${nodeVersion}`, `V8: ${v8Version}`];
  return joinLines(lines);
};

const showAboutElectron = async () => {
  const windowId = await getWindowId();
  const detail = await getDetailString();
  const productNameLong = getProductNameLong();
  const options = {
    buttons: [copy(), ok()],
    detail,
    message: productNameLong,
    type: Info,
    windowId
  };
  const index = await showMessageBox(options);
  switch (index) {
    case 0:
      await writeText(detail);
      break;
  }
};

const getAboutHandler = platform => {
  switch (platform) {
    case Electron:
      return showAboutElectron;
    default:
      return showAboutDefault;
  }
};

const showAbout = async platform => {
  const fn = getAboutHandler(platform);
  await fn();
};

const commandMap = {
  'About.create': create,
  'About.diff2': diff2,
  'About.dispose': dispose,
  'About.focusNext': wrapCommand(focusNext),
  'About.focusPrevious': wrapCommand(focusPrevious),
  'About.getCommandIds': getCommandIds,
  'About.getKeyBindings': getKeyBindings,
  'About.handleClickButton': wrapCommand(handleClickButton),
  'About.handleClickClose': wrapCommand(handleClickClose),
  'About.handleClickCopy': wrapCommand(handleClickCopy),
  'About.handleClickOk': wrapCommand(handleClickOk),
  'About.handleFocusIn': wrapCommand(handleFocusIn),
  'About.loadContent2': wrapCommand(loadContent2),
  'About.render2': doRender,
  'About.renderEventListeners': renderEventListeners,
  'About.showAbout': showAbout,
  'About.showAboutElectron': showAboutElectron
};

const listen = async () => {
  registerCommands(commandMap);
  const rpc = await create$3({
    commandMap: commandMap
  });
  set$1(rpc);
};

const main = async () => {
  await listen();
};

main();
