import { __exports as path } from '../../../../../../../_virtual/path.mjs';
import path__default from 'node:path';

var hasRequiredPath;
function requirePath() {
  if (hasRequiredPath) return path;
  hasRequiredPath = 1;
  Object.defineProperty(path, "__esModule", {
    value: true
  });
  path.removeLeadingDotSegment = path.escape = path.makeAbsolute = path.unixify = void 0;
  const path$1 = path__default;
  const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
  const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g;
  /**
   * Designed to work only with simple paths: `dir\\file`.
   */
  function unixify(filepath) {
    return filepath.replace(/\\/g, '/');
  }
  path.unixify = unixify;
  function makeAbsolute(cwd, filepath) {
    return path$1.resolve(cwd, filepath);
  }
  path.makeAbsolute = makeAbsolute;
  function escape(pattern) {
    return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
  }
  path.escape = escape;
  function removeLeadingDotSegment(entry) {
    // We do not use `startsWith` because this is 10x slower than current implementation for some cases.
    // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
    if (entry.charAt(0) === '.') {
      const secondCharactery = entry.charAt(1);
      if (secondCharactery === '/' || secondCharactery === '\\') {
        return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
      }
    }
    return entry;
  }
  path.removeLeadingDotSegment = removeLeadingDotSegment;
  return path;
}

export { requirePath as __require };
