/*
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 modal_exports = {};
__export(modal_exports, {
  ModalBase: () => ModalBase,
  addCssClass: () => addCssClass,
  showModal: () => showModal
});
module.exports = __toCommonJS(modal_exports);
var import_obsidian = require('obsidian');
var import_plugin_context = require('../plugin/plugin-context.cjs');
class ModalBase extends import_obsidian.Modal {
  /**
   * Creates a new modal.
   *
   * @param params - The options.
   * @param resolve - The resolve function.
   */
  constructor(params, resolve) {
    super(params.app);
    this.resolve = resolve;
    (0, import_plugin_context.addPluginCssClasses)(this.containerEl, params.cssClasses);
  }
  resolve;
}
function addCssClass(params, cssClass) {
  return {
    ...params,
    cssClasses: [...params.cssClasses ?? [], cssClass]
  };
}
async function showModal(modalCreator) {
  return await new Promise((resolve) => {
    const modal = modalCreator(resolve);
    modal.open();
  });
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  ModalBase,
  addCssClass,
  showModal
});
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vLi4vLi4vc3JjL29ic2lkaWFuL21vZGFscy9tb2RhbC50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiLyoqXG4gKiBAZmlsZVxuICpcbiAqIFRoaXMgbW9kdWxlIGV4cG9ydHMgYSBiYXNlIGNsYXNzIGZvciBkaXNwbGF5aW5nIG1vZGFscyBpbiBPYnNpZGlhbi5cbiAqL1xuXG5pbXBvcnQgdHlwZSB7IEFwcCB9IGZyb20gJ29ic2lkaWFuJztcblxuaW1wb3J0IHsgTW9kYWwgfSBmcm9tICdvYnNpZGlhbic7XG5cbmltcG9ydCB0eXBlIHsgUHJvbWlzZVJlc29sdmUgfSBmcm9tICcuLi8uLi9hc3luYy50cyc7XG5cbmltcG9ydCB7IGFkZFBsdWdpbkNzc0NsYXNzZXMgfSBmcm9tICcuLi9wbHVnaW4vcGx1Z2luLWNvbnRleHQudHMnO1xuXG4vKipcbiAqIEJhc2Ugb3B0aW9ucyBmb3IgYSBtb2RhbC5cbiAqL1xuZXhwb3J0IGludGVyZmFjZSBNb2RhbFBhcmFtc0Jhc2Uge1xuICAvKipcbiAgICogQW4gT2JzaWRpYW4gYXBwIGluc3RhbmNlLlxuICAgKi9cbiAgcmVhZG9ubHkgYXBwOiBBcHA7XG5cbiAgLyoqXG4gICAqIEEgQ1NTIGNsYXNzIHRvIGFwcGx5IHRvIHRoZSBtb2RhbC5cbiAgICovXG4gIHJlYWRvbmx5IGNzc0NsYXNzZXM/OiBzdHJpbmdbXTtcbn1cblxuLyoqXG4gKiBBIGJhc2UgY2xhc3MgZm9yIGRpc3BsYXlpbmcgbW9kYWxzIGluIE9ic2lkaWFuLlxuICpcbiAqIEB0eXBlUGFyYW0gVmFsdWUgLSBUaGUgdHlwZSBvZiB0aG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