/*
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 plugin_context_component_exports = {};
__export(plugin_context_component_exports, {
  PluginContextComponent: () => PluginContextComponent
});
module.exports = __toCommonJS(plugin_context_component_exports);
var import_plugin_context = require('../plugin/plugin-context.cjs');
var import_all_windows_event_component = require('./all-windows-event-component.cjs');
var import_component_ex = require('./component-ex.cjs');
class PluginContextComponent extends import_component_ex.ComponentEx {
  app;
  pluginId;
  /**
   * Creates a new plugin context component.
   *
   * @param params - The constructor parameters.
   */
  constructor(params) {
    super();
    this.app = params.app;
    this.pluginId = params.pluginId;
  }
  /**
   * Initializes the plugin context and debug controller.
   */
  onload() {
    (0, import_plugin_context.initPluginContext)(this.app, this.pluginId);
    this.addChild(new import_all_windows_event_component.AllWindowsEventComponent(this.app)).registerAllWindowsHandler((win) => {
      (0, import_plugin_context.initDebugController)(win, this);
    });
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  PluginContextComponent
});
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vLi4vLi4vc3JjL29ic2lkaWFuL2NvbXBvbmVudHMvcGx1Z2luLWNvbnRleHQtY29tcG9uZW50LnRzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyIvKipcbiAqIEBmaWxlXG4gKlxuICogQ29tcG9uZW50IHRoYXQgaW5pdGlhbGl6ZXMgdGhlIHBsdWdpbiBjb250ZXh0LCBkZWJ1ZyBjb250cm9sbGVyLCBhbmQgbGlicmFyeSBzdHlsZXMuXG4gKi9cblxuaW1wb3J0IHR5cGUgeyBBcHAgfSBmcm9tICdvYnNpZGlhbic7XG5cbmltcG9ydCB7XG4gIGluaXREZWJ1Z0NvbnRyb2xsZXIsXG4gIGluaXRQbHVnaW5Db250ZXh0XG59IGZyb20gJy4uL3BsdWdpbi9wbHVnaW4tY29udGV4dC50cyc7XG5pbXBvcnQgeyBBbGxXaW5kb3dzRXZlbnRDb21wb25lbnQgfSBmcm9tICcuL2FsbC13aW5kb3dzLWV2ZW50LWNvbXBvbmVudC50cyc7XG5pbXBvcnQgeyBDb21wb25lbnRFeCB9IGZyb20gJy4vY29tcG9uZW50LWV4LnRzJztcblxuaW50ZXJmYWNlIFBsdWdpbkNvbnRleHRDb21wb25lbnRDb25zdHJ1Y3RvclBhcmFtcyB7XG4gIHJlYWRvbmx5IGFwcDogQXBwO1xuICByZWFkb25seSBwbHVnaW5JZDogc3RyaW5nO1xufVxuXG4vKipcbiAqIEluaXRpYWxpemVzIHBsdWdpbiBjb250ZXh0IChwbHVnaW4gSUQsIGRlYnVnIGNvbnRyb2xsZXIsIGxpYnJhcnkgc3R5bGVzKSBvbiBsb2FkLlxuICovXG5leHBvcnQgY2xhc3MgUGx1Z2luQ29udGV4dENvbXBvbmVudC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