function removeIgnoredPackageId(r) {
  if (r) {
    Debug.assert(r.packageId === void 0);
    return { path: r.path, ext: r.extension, resolvedUsingTsExtension: r.resolvedUsingTsExtension };
  }
}
/");
  if (wildcardIndex === -1) {
    return false;
  }
  const lastDotIndex = endsWith(s, "/..") ? s.length : s.lastIndexOf("/../");
  return lastDotIndex > wildcardIndex;
}
function matchesExclude(pathToCheck, excludeSpecs, useCaseSensitiveFileNames, currentDirectory) {
  return matchesExcludeWorker(
    pathToCheck,
    filter(excludeSpecs, (spec) => !invalidDotDotAfterRecursiveWildcard(spec)),
    useCaseSensitiveFileNames,
    currentDirectory
  );
}
function matchesExcludeWorker(pathToCheck, excludeSpecs, useCaseSensitiveFileNames, currentDirectory, basePath) {
  const excludePattern = getRegularExpressionForWildcard(excludeSpecs, combinePaths(normalizePath(currentDirectory), basePath), "exclude");
  const excludeRegex = excludePattern && getRegexFromPattern(excludePattern, useCaseSensitiveFileNames);
  if (!excludeRegex)
    return false;
  if (excludeRegex.test(pathToCheck))
    return true;
  return !hasExtension(pathToCheck) && excludeRegex.test(ensureTrailingDirectorySeparator(pathToCheck));
}
function specToDiagnostic(spec, disallowTrailingRecursion) {
  Debug.assert(typeof spec === "string");
  if (disallowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) {
    return [Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec];
  } else if (invalidDotDotAfterRecursiveWildcard(spec)) {
    return [Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec];
  }
}

// src/compiler/moduleNameResolver.ts
function trace(host) {
  host.trace(formatMessage.apply(void 0, arguments));
}
function isTraceEnabled(compilerOptions, host) {
  return !!compilerOptions.traceResolution && host.trace !== void 0;
}
function withPackageId(packageInfo, r) {
  let packageId;
  if (r && packageInfo) {
    const packageJsonContent = packageInfo.contents.packageJsonContent;
    if (typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string") {
      packageId = {
        name: packageJsonContent.name,
        subModuleName: r.path.slice(packageInfo.packageDirectory.length + directorySeparator.length),
        version: packageJsonContent.version
      };
    }
  }
  return r && { path: r.path, extension: r.ext, packageId, resolvedUsingTsExtension: r.resolvedUsingTsExtension };
}
function noPackageId(r) {
  return withPackageId(
    /*packageInfo