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

Object.defineProperty(path$1, "__esModule", {
  value: true
});
path$1.removeLeadingDotSegment = path$1.escape = path$1.makeAbsolute = path$1.unixify = void 0;
const path = 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$1.unixify = unixify;
function makeAbsolute(cwd, filepath) {
  return path.resolve(cwd, filepath);
}
path$1.makeAbsolute = makeAbsolute;
function escape(pattern) {
  return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
}
path$1.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$1.removeLeadingDotSegment = removeLeadingDotSegment;

export { path$1 as default };
