/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/

(function initCjs() {
  // eslint-disable-next-line obsidianmd/no-global-this -- Actively use globalThis.
  const globalThisRecord = globalThis;
  globalThisRecord['__name'] ??= name;
  const originalRequire = require;
  if (originalRequire && !originalRequire.__isPatched) {
    // eslint-disable-next-line no-global-assign, no-implicit-globals -- We need to patch the `require()` function.
    require = Object.assign(
      (id) => requirePatched(id),
      originalRequire,
      {
        __isPatched: true
      }
    );
  }

  const newFuncs = {
    __extractDefault() {
      return extractDefault;
    },
    process() {
      const browserProcess = {
        browser: true,
        cwd() {
          return '/';
        },
        env: {},
        platform: 'android'
      };
      return browserProcess;
    }
  };

  for (const key of Object.keys(newFuncs)) {
    globalThisRecord[key] ??= newFuncs[key]?.();
  }

  function name(obj) {
    return obj;
  }

  function extractDefault(module) {
    return module && module.__esModule && 'default' in module ? module.default : module;
  }

  const OBSIDIAN_BUILT_IN_MODULE_NAMES = [
  'obsidian',
  '@codemirror/autocomplete',
  '@codemirror/collab',
  '@codemirror/commands',
  '@codemirror/language',
  '@codemirror/lint',
  '@codemirror/search',
  '@codemirror/state',
  '@codemirror/text',
  '@codemirror/view',
  '@lezer/common',
  '@lezer/lr',
  '@lezer/highlight'];


  const DEPRECATED_OBSIDIAN_BUILT_IN_MODULE_NAMES = [
  '@codemirror/closebrackets',
  '@codemirror/comment',
  '@codemirror/fold',
  '@codemirror/gutter',
  '@codemirror/highlight',
  '@codemirror/history',
  '@codemirror/matchbrackets',
  '@codemirror/panel',
  '@codemirror/rangeset',
  '@codemirror/rectangular-selection',
  '@codemirror/stream-parser',
  '@codemirror/tooltip'];


  function requirePatched(id) {
    if (OBSIDIAN_BUILT_IN_MODULE_NAMES.includes(id) || DEPRECATED_OBSIDIAN_BUILT_IN_MODULE_NAMES.includes(id)) {
      return originalRequire?.(id);
    }

    // eslint-disable-next-line @typescript-eslint/no-deprecated, obsidianmd/no-global-this  -- Need access to app. Actively use globalThis.
    if (globalThis.app.isMobile) {
      if (id === 'process' || id === 'node:process') {
        // eslint-disable-next-line no-console -- Valid usage.
        console.debug(`The most likely you can safely ignore this error. Module not found: ${id}. Fake process object is returned instead.`);
        // eslint-disable-next-line obsidianmd/no-global-this -- Actively use globalThis.
        return globalThis.process;
      }
    } else {
      const module = originalRequire?.(id);
      if (module) {
        return extractDefault(module);
      }
    }

    // eslint-disable-next-line no-console -- Valid usage.
    console.debug(`The most likely you can safely ignore this error. Module not found: ${id}. Empty object is returned instead.`);
    return {};
  }
})();

"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var menu_event_registrar_component_exports = {};
__export(menu_event_registrar_component_exports, {
  MenuEventRegistrarComponent: () => MenuEventRegistrarComponent
});
module.exports = __toCommonJS(menu_event_registrar_component_exports);
var import_component_ex = require('./component-ex.cjs');
class MenuEventRegistrarComponent extends import_component_ex.ComponentEx {
  /**
   * Creates a new app-backed menu event registrar.
   *
   * @param app - The Obsidian app instance.
   */
  constructor(app) {
    super();
    this.app = app;
  }
  app;
  /**
   * Registers a handler for the editor context menu event.
   *
   * @param handler - The handler to register.
   */
  registerEditorMenuEventHandler(handler) {
    this.ensureLoaded();
    this.registerEvent(this.app.workspace.on("editor-menu", handler));
  }
  /**
   * Registers a handler for the single-file context menu event.
   *
   * @param handler - The handler to register.
   */
  registerFileMenuEventHandler(handler) {
    this.ensureLoaded();
    this.registerEvent(this.app.workspace.on("file-menu", handler));
  }
  /**
   * Registers a handler for the multi-file context menu event.
   *
   * @param handler - The handler to register.
   */
  registerFilesMenuEventHandler(handler) {
    this.ensureLoaded();
    this.registerEvent(this.app.workspace.on("files-menu", handler));
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  MenuEventRegistrarComponent
});
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vLi4vLi4vc3JjL29ic2lkaWFuL2NvbXBvbmVudHMvbWVudS1ldmVudC1yZWdpc3RyYXItY29tcG9uZW50LnRzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyIvKipcbiAqIEBmaWxlXG4gKlxuICogUmVnaXN0ZXJzIG1lbnUgZXZlbnQgaGFuZGxlcnMgd2l0aCBPYnNpZGlhbidzIHdvcmtzcGFjZSwgc3VwcG9ydGluZyBlZGl0b3IsIGZpbGUsIGFuZCBtdWx0aS1maWxlIGNvbnRleHQgbWVudXMuXG4gKi9cblxuaW1wb3J0IHR5cGUgeyBBcHAgfSBmcm9tICdvYnNpZGlhbic7XG5cbmltcG9ydCB0eXBlIHtcbiAgRWRpdG9yTWVudUV2ZW50SGFuZGxlcixcbiAgRmlsZU1lbnVFdmVudEhhbmRsZXIsXG4gIEZpbGVzTWVudUV2ZW50SGFuZGxlcixcbiAgTWVudUV2ZW50UmVnaXN0cmFyXG59IGZyb20gJy4uL21lbnUtZXZlbnQtcmVnaXN0cmFyLnRzJztcblxuaW1wb3J0IHsgQ29tcG9uZW50RXggfSBmcm9tICcuL2NvbXBvbmVudC1leC50cyc7XG5cbi8qKlxuICoge0BsaW5rIE1lbnVFdmVudFJlZ2lzdHJhcn0gYmFja2VkIGJ5IE9ic2lkaWFuJ3Mge0BsaW5rIEFwcH0gd29ya3NwYWNlIGV2ZW50cy5cbiAqXG4gKiBFdmVudCBoYW5kbGVycyBhcmUgcmVnaXN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