/*
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 logger_exports = {};
__export(logger_exports, {
  invokeAsyncAndLog: () => invokeAsyncAndLog
});
module.exports = __toCommonJS(logger_exports);
var import_debug = require('../debug.cjs');
var import_error = require('../error.cjs');
async function invokeAsyncAndLog(title, fn, abortSignal, stackTrace) {
  abortSignal.throwIfAborted();
  const invokeAsyncAndLogDebugger = (0, import_debug.getLibDebugger)("Logger:invokeAsyncAndLog");
  const timestampStart = performance.now();
  stackTrace ??= (0, import_error.getStackTrace)(1);
  (0, import_debug.printWithStackTrace)(invokeAsyncAndLogDebugger, stackTrace, `${title}:start`, {
    fn,
    timestampStart
  });
  try {
    await fn(abortSignal);
    const timestampEnd = performance.now();
    const duration = Math.trunc(timestampEnd - timestampStart);
    if (abortSignal.aborted) {
      (0, import_debug.printWithStackTrace)(invokeAsyncAndLogDebugger, stackTrace, `${title}:aborted`, {
        abortReason: abortSignal.reason,
        duration,
        fn,
        timestampEnd,
        timestampStart
      });
      abortSignal.throwIfAborted();
    }
    (0, import_debug.printWithStackTrace)(invokeAsyncAndLogDebugger, stackTrace, `${title}:end`, {
      duration,
      fn,
      timestampEnd,
      timestampStart
    });
  } catch (error) {
    const timestampEnd = performance.now();
    (0, import_debug.printWithStackTrace)(invokeAsyncAndLogDebugger, stackTrace, `${title}:error`, {
      duration: Math.trunc(timestampEnd - timestampStart),
      error,
      fn,
      timestampEnd,
      timestampStart
    });
    throw error;
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  invokeAsyncAndLog
});
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vLi4vc3JjL29ic2lkaWFuL2xvZ2dlci50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiLyoqXG4gKiBAZmlsZVxuICpcbiAqIENvbnRhaW5zIHV0aWxpdHkgZnVuY3Rpb25zIGZvciBsb2dnaW5nIGluIE9ic2lkaWFuLlxuICovXG5cbmltcG9ydCB0eXBlIHsgUHJvbWlzYWJsZSB9IGZyb20gJ3R5cGUtZmVzdCc7XG5cbmltcG9ydCB7XG4gIGdldExpYkRlYnVnZ2VyLFxuICBwcmludFdpdGhTdGFja1RyYWNlXG59IGZyb20gJy4uL2RlYnVnLnRzJztcbmltcG9ydCB7IGdldFN0YWNrVHJhY2UgfSBmcm9tICcuLi9lcnJvci50cyc7XG5cbi8qKlxuICogSW52b2tlcyBhIGZ1bmN0aW9uIGFuZCBsb2dzIHRoZSBzdGFydCwgZW5kLCBhbmQgZHVyYXRpb24gb2YgdGhlIGludm9jYXRpb24uXG4gKlxuICogQHBhcmFtIHRpdGxlIC0gVGhlIHRpdGxlIG9mIHRoZSBsb2cuXG4gKiBAcGFyYW0gZm4gLSBUaGUgZnVuY3Rpb24g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