{
  "version": 3,
  "sources": ["../launch.ts", "../folder.ts", "../platform.ts", "../utils.ts", "../version.ts", "../diagnose.ts"],
  "sourcesContent": ["import { open, openEntryReadStream, walkEntriesGenerator } from '@xmcl/unzip'\nimport { ChildProcess, SpawnOptions, spawn } from 'child_process'\nimport { randomUUID } from 'crypto'\nimport { EventEmitter } from 'events'\nimport { createWriteStream, existsSync } from 'fs'\nimport { link, mkdir, readFile, writeFile } from 'fs/promises'\nimport { EOL } from 'os'\nimport { basename, delimiter, dirname, isAbsolute, join, resolve, sep } from 'path'\nimport { pipeline } from 'stream'\nimport { promisify } from 'util'\nimport { MinecraftFolder } from './folder'\nimport { Platform, getPlatform } from './platform'\nimport { checksum, isNotNull, validateSha1 } from './utils'\nimport { ResolvedLibrary, ResolvedVersion, Version } from './version'\n\nfunction format(template: string, args: any) {\n  return template.replace(/\\$\\{(.*?)}/g, (key) => {\n    const value = args[key.substring(2).substring(0, key.length - 3)]\n    return value || key\n  })\n}\n\nexport const DEFAULT_EXTRA_JVM_ARGS = Object.freeze([\n  '-Xmx2G',\n  '-XX:+UnlockExperimentalVMOptions',\n  '-XX:+UseG1GC',\n  '-XX:G1NewSizePercent=20',\n  '-XX:G1ReservePercent=20',\n  '-XX:MaxGCPauseMillis=50',\n  '-XX:G1HeapRegionSize=32M',\n])\nexport interface EnabledFeatures {\n  [featureName: string]: object | boolean | undefined\n  // eslint-disable-next-line camelcase\n  has_custom_resolution?: { resolution_width: string; resolution_height: string }\n  // eslint-disable-next-line camelcase\n  is_demo_user?: boolean\n}\n\n/**\n * General launch option, used to generate launch arguments.\n * @see {@link generateArguments}\n * @see {@link launch}\n */\nexport interface LaunchOption {\n  /**\n   * User selected game profile. For game display name &\n   */\n  gameProfile?: {\n    name: string\n    id: string\n  }\n  accessToken?: string\n  userType?: 'mojang' | 'legacy'\n  properties?: object\n\n  launcherName?: string\n  launcherBrand?: string\n  /**\n   * Overwrite the version name of the current version.\n   * If this is absent, it will use version name from resolved version.\n    */\n  versionName?: string\n  /**\n   * Overwrite the version type of the current version.\n   * If this is absent, it will use version type from resolved version.\n   *\n   * Some people use this to show fantastic message on the welcome screen.\n   */\n  versionType?: string\n  /**\n   * The full path of launched game icon\n   * Currently, this only supported on MacOS\n   */\n  gameIcon?: string\n  /**\n   * The launched game name\n   * Currently, this only supported on MacOS\n   */\n  gameName?: string\n  /**\n   * The path of parent directory of saves/logs/configs/mods/resourcepacks\n   */\n  gamePath: string\n  /**\n   * The path of parent directory of assets/libraries\n   */\n  resourcePath?: string\n  /**\n   * The java executable file path. (Not the java home directory!)\n   */\n  javaPath: string\n  /**\n   * Min memory, this will add a jvm flag -Xms to the command result\n   */\n  minMemory?: number\n  /**\n   * Min memory, this will add a jvm flag -Xmx to the command result\n   */\n  maxMemory?: number\n  /**\n   * The version of launched Minecraft. Can be either resolved version or version string\n   */\n  version: string | ResolvedVersion\n  /**\n   * Directly launch to a server\n   */\n  server?: { ip: string; port?: number }\n  /**\n   * Directly launch to a server using quickPlayMultiplayer option (for newer Minecraft versions)\n   * This will use --quickPlayMultiplayer instead of --server and --port\n   */\n  quickPlayMultiplayer?: string\n  /**\n   * Resolution. This will add --height & --width or --fullscreen to the java arguments\n   */\n  resolution?: { width?: number; height?: number; fullscreen?: boolean }\n  /**\n   * Extra jvm options. This will append after to generated options.\n   * If this is empty, the `DEFAULT_EXTRA_JVM_ARGS` will be used.\n   */\n  extraJVMArgs?: string[]\n  /**\n   * Extra program arguments. This will append after to generated options.\n   */\n  extraMCArgs?: string[]\n  /**\n   * Prepend command before java command.\n   */\n  prependCommand?: string | string[]\n  /**\n   * Assign the spawn options to the process.\n   *\n   * If you try to set `{ shell: true }`, you might want to make all argument rounded with \"\".\n   * The `launch` function will do it for you, but if you want to spawn process by yourself, remember to do that.\n   */\n  extraExecOption?: SpawnOptions\n\n  /**\n   * Native directory. It's .minecraft/versions/<version>/<version>-natives by default.\n   * You can replace this by your self.\n   */\n  nativeRoot?: string\n  /**\n   * Enable features. Not really in used...\n   */\n  features?: EnabledFeatures\n  /**\n   * Support yushi's yggdrasil agent https://github.com/to2mbn/authlib-injector/wiki\n   */\n  yggdrasilAgent?: {\n    /**\n     * The jar file path of the authlib-injector\n     */\n    jar: string\n    /**\n     * The auth server host\n     */\n    server: string\n    /**\n     * The prefetched base64\n     */\n    prefetched?: string\n  }\n  /**\n   * Add `-Dfml.ignoreInvalidMinecraftCertificates=true` to jvm argument\n   */\n  ignoreInvalidMinecraftCertificates?: boolean\n  /**\n   * Add `-Dfml.ignorePatchDiscrepancies=true` to jvm argument\n   */\n  ignorePatchDiscrepancies?: boolean\n  /**\n   * Add extra classpaths\n   */\n  extraClassPaths?: string[]\n  /**\n   * The platform of this launch will run. By default, it will fetch the current machine info if this is absent.\n   */\n  platform?: Platform\n  /**\n   * Use hash assets index. This will use the assets index hash as the assets index name.\n   */\n  useHashAssetsIndex?: boolean\n  /**\n   * The launcher precheck functions. These will run before it run.\n   *\n   * This property is only used for `launch` function. The `generateArguments` function won't use this!\n   * @see {@link launch}\n   * @see {@link generateArguments}\n   */\n  prechecks?: LaunchPrecheck[]\n  /**\n   * Demo mode.\n   */\n  demo?: boolean\n  /**\n   * The spawn process function. Used for spawn the java process at the end.\n   *\n   * By default, it will be the spawn function from \"child_process\" module. You can use this option to change the 3rd party spawn like [cross-spawn](https://www.npmjs.com/package/cross-spawn)\n   */\n  spawn?: (command: string, args?: ReadonlyArray<string>, options?: SpawnOptions) => ChildProcess\n}\n\n/**\n * The function to check the game status before the game launched. Will be used in `launch` function.\n * @see {@link launch}\n */\nexport interface LaunchPrecheck {\n  (resourcePath: MinecraftFolder, version: ResolvedVersion, option: LaunchOption): Promise<void>\n}\n\n/**\n * Thrown when the version jar is corrupted. This interface only used in `LaunchPrecheck.checkVersion`\n * @see {@link LaunchPrecheck.checkVersion}\n */\nexport interface CorruptedVersionJarError {\n  error: 'CorruptedVersionJar'\n  version: string\n}\n/**\n * Thrown when the libraries jar is corrupted. This interface only used in `LaunchPrecheck.checkLibraries`\n * @see {@link LaunchPrecheck.checkLibraries}\n */\nexport interface MissingLibrariesError {\n  error: 'MissingLibraries'\n  libraries: ResolvedLibrary[]\n  version: ResolvedVersion\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace LaunchPrecheck {\n  /**\n   * The default launch precheck. It will check version jar, libraries and natives.\n   */\n  export const DEFAULT_PRECHECKS: readonly LaunchPrecheck[] = Object.freeze([checkVersion, checkLibraries, checkNatives, linkAssets])\n\n  /**\n   * @deprecated\n   */\n  export const Default = LaunchPrecheck.DEFAULT_PRECHECKS\n\n  /**\n   * Link assets to the assets/virtual/legacy.\n   */\n  export async function linkAssets(resource: MinecraftFolder, version: ResolvedVersion, option: LaunchOption) {\n    if (version.assets !== 'legacy' && !version.assets.startsWith('pre-')) {\n      return\n    }\n    const assetsIndexPath = resource.getAssetsIndex(version.assets)\n    const buf = await readFile(assetsIndexPath)\n    const assetsIndex: { objects: Record<string, { hash: string; size: number }> } = JSON.parse(buf.toString())\n    const virtualPath = resource.getPath('assets/virtual/' + version.assets)\n    await mkdir(virtualPath, { recursive: true }).catch(() => { })\n\n    const dirs = Object.keys(assetsIndex.objects)\n      .map((path) => dirname(join(virtualPath, path)))\n      .reduce((a, b) => a.add(b), new Set<string>())\n    await Promise.all([...dirs].map((dir) => mkdir(dir, { recursive: true })))\n\n    for (const [path, { hash }] of Object.entries(assetsIndex.objects)) {\n      const assetPath = resource.getAsset(hash)\n      const targetPath = join(virtualPath, path)\n      await link(assetPath, targetPath).catch((e) => {\n        if (e.code !== 'EEXIST') { throw e }\n      })\n    }\n  }\n\n  /**\n   * Quick check if Minecraft version jar is corrupted\n   * @throws {@link CorruptedVersionJarError}\n   */\n  export async function checkVersion(resource: MinecraftFolder, version: ResolvedVersion, option: LaunchOption) {\n    const jarPath = resource.getVersionJar(version.minecraftVersion)\n    if (version.downloads.client?.sha1) {\n      if (!await validateSha1(jarPath, version.downloads.client.sha1)) {\n        throw Object.assign(new Error(`Corrupted Version jar ${jarPath}. Either the file not reachable or the file sha1 not matched!`), {\n          error: 'CorruptedVersionJar',\n          version: version.minecraftVersion,\n        } as CorruptedVersionJarError)\n      }\n    }\n  }\n  /**\n   * Quick check if there are missed libraries.\n   * @throws {@link MissingLibrariesError}\n   */\n  export async function checkLibraries(resource: MinecraftFolder, version: ResolvedVersion, option: LaunchOption) {\n    const validMask = await Promise.all(version.libraries\n      .map((lib) => validateSha1(resource.getLibraryByPath(lib.download.path), lib.download.sha1)))\n    const corruptedLibs = version.libraries.filter((_, index) => !validMask[index])\n\n    if (corruptedLibs.length > 0) {\n      throw Object.assign(new Error(`Missing ${corruptedLibs.length} libraries! Either the file not reachable or the file sha1 not matched!`), {\n        error: 'MissingLibraries',\n        libraries: corruptedLibs,\n        version,\n      } as MissingLibrariesError)\n    }\n  }\n  /**\n   * Ensure the native are correctly extracted in place.\n   *\n   * It will check native root located in {@link LaunchOption.nativeRoot} if it's presented.\n   * Or, it will use the `<version-id>-native` under version folder as native root to check.\n   *\n   * This will automatically extract native if there is not native extracted.\n   *\n   * @param resource The minecraft directory to extract native\n   * @param option If the native root presented here, it will use the root here.\n   */\n  export async function checkNatives(resource: MinecraftFolder, version: ResolvedVersion, option: LaunchOption) {\n    const native: string = option.nativeRoot || resource.getNativesRoot(version.id)\n    await mkdir(native, { recursive: true }).catch((e) => {\n      if (e.code !== 'EEXIST') { throw e }\n    })\n    const natives = version.libraries.filter((lib) => lib.isNative || lib.classifier.startsWith('natives'))\n    const checksumFile = join(native, '.json')\n    const includedLibs = natives.map((n) => n.name).sort()\n\n    interface ChecksumFile { entries: CheckEntry[]; libraries: string[] }\n    interface CheckEntry { file: string; sha1: string; name: string }\n\n    const checksumFileObject: ChecksumFile = await readFile(checksumFile, 'utf-8').then(JSON.parse).catch((e) => undefined)\n\n    let shaEntries: CheckEntry[] | undefined\n    if (checksumFileObject && checksumFileObject.libraries) {\n      // only if the lib not change\n      // consider the case of os changed or java changed\n      if (checksumFileObject.libraries.sort().every((v, i) => v === includedLibs[i])) {\n        shaEntries = checksumFileObject.entries\n      }\n    }\n\n    const extractedNatives: CheckEntry[] = []\n    async function extractJar(n: ResolvedLibrary | undefined) {\n      if (!n) { return }\n      const excluded: string[] = n.extractExclude || []\n\n      const platform = option.platform || getPlatform()\n      const containsExcludes = (p: string) => excluded.filter((s) => p.startsWith(s)).length === 0\n      const notInMetaInf = (p: string) => p.indexOf('META-INF/') === -1\n      const notSha1AndNotGit = (p: string) => !(p.endsWith('.sha1') || p.endsWith('.git'))\n      const isSatisfyPlaform = (p: string) => {\n        if (p.indexOf('/') === -1) { return true }\n        const [os, arch] = p.split('/')\n        const platformArch = arch === 'ia32' ? 'x86' : arch\n        return os === platform.name && platformArch === platform.arch\n      }\n\n      if (!n.download.path) {\n        throw Object.assign(new TypeError(`Library ${n.name}(${version.id}) has no download path!`), { library: n })\n      }\n\n      const from = resource.getLibraryByPath(n.download.path)\n      const promises: Promise<void>[] = []\n      const zip = await open(from, { lazyEntries: true, autoClose: false })\n      for await (const entry of walkEntriesGenerator(zip)) {\n        if (\n          containsExcludes(entry.fileName) &&\n          notInMetaInf(entry.fileName) &&\n          notSha1AndNotGit(entry.fileName) &&\n          !entry.fileName.endsWith('/') &&\n          isSatisfyPlaform(entry.fileName)\n        ) {\n          const fileName = basename(entry.fileName)\n          const dest = join(native, fileName)\n          if (fileName.indexOf('/') !== -1) {\n            await mkdir(dirname(dest), {\n              recursive: true,\n            }).catch((e) => { })\n          }\n          extractedNatives.push({ file: fileName, name: n.name, sha1: '' })\n          promises.push(promisify(pipeline)(await openEntryReadStream(zip, entry), createWriteStream(dest)))\n        }\n      }\n      await Promise.all(promises)\n    }\n    if (shaEntries) {\n      const validEntries: { [name: string]: boolean } = {}\n      for (const entry of shaEntries) {\n        if (typeof entry.file !== 'string') { continue }\n        const file = join(native, entry.file)\n        const valid = await validateSha1(file, entry.sha1, true)\n        if (valid) {\n          validEntries[entry.name] = true\n        }\n      }\n      const missingNatives = natives.filter((n) => !validEntries[n.name])\n      if (missingNatives.length !== 0) {\n        const result = await Promise.allSettled(missingNatives.map(extractJar))\n        const errors = result.map((r) => r.status === 'rejected' ? r.reason as Error : undefined).filter(isNotNull)\n        if (errors.length === 0) {\n          return\n        }\n        if (errors.length === 1) {\n          throw errors[0]\n        }\n        throw new AggregateError(errors, 'Some natives failed to extract')\n      }\n    } else {\n      const result = await Promise.allSettled(natives.map(extractJar))\n      const entries = await Promise.all(extractedNatives.map(async (n) => ({\n        ...n,\n        sha1: await checksum(join(native, n.file), 'sha1'),\n      })))\n      const fileContent = JSON.stringify({\n        entries,\n        libraries: includedLibs,\n      })\n      await writeFile(checksumFile, fileContent)\n\n      const errors = result.map((r) => r.status === 'rejected' ? r.reason as Error : undefined).filter(isNotNull)\n      if (errors.length === 0) {\n        return\n      }\n      if (errors.length === 1) {\n        throw errors[0]\n      }\n      throw new AggregateError(errors, 'Some natives failed to extract')\n    }\n  }\n}\n\nexport interface BaseServerOptions {\n  /**\n   * Java executable.\n   */\n  javaPath: string\n  /**\n   * No gui for the server launch\n   */\n  nogui?: boolean\n  minMemory?: number\n  maxMemory?: number\n  extraJVMArgs?: string[]\n  extraMCArgs?: string[]\n  extraExecOption?: SpawnOptions\n\n  prependCommand?: string | string[]\n\n  /**\n   * The spawn process function. Used for spawn the java process at the end. By default, it will be the spawn function from \"child_process\" module. You can use this option to change the 3rd party spawn like [cross-spawn](https://www.npmjs.com/package/cross-spawn)\n   */\n  spawn?: (command: string, args?: ReadonlyArray<string>, options?: SpawnOptions) => ChildProcess\n}\n\n/**\n * This is the case you provide the server jar execution path.\n */\nexport interface ServerOptions extends BaseServerOptions {\n  /**\n   * The minecraft server exectuable jar file.\n   *\n   * This is the case like you are launching forge server.\n   */\n  serverExectuableJarPath?: string\n\n  mainClass?: string\n\n  classPath?: string[]\n}\n\nexport async function launchServer(options: ServerOptions) {\n  const args = generateArgumentsServer(options)\n  const spawnOption = { env: process.env, ...options.extraExecOption }\n  return (options.spawn ?? spawn)(args[0], args.slice(1), spawnOption)\n}\n\n/**\n * The Minecraft process watcher. You can inspect Minecraft launch state by this.\n *\n * Generally, there are several cases after you call `launch` and get `ChildProcess` object\n *\n * 1. child process fire an error, no real process start.\n * 2. child process started, but game crash (code is not 0).\n * 3. cihld process started, game normally exit (code is 0).\n */\nexport interface MinecraftProcessWatcher extends EventEmitter {\n  /**\n   * Fire when the process DOESN'T start at all, like \"java not found\".\n   *\n   * The minecraft-kill or minecraft-exit will NOT fire after this fired.\n   */\n  on(event: 'error', listener: (error: any) => void): this\n  /**\n   * Fire after Minecraft process exit.\n   */\n  on(event: 'minecraft-exit', listener: (event: {\n    /**\n     * The code of the process exit. This is the nodejs child process \"exit\" event arg.\n     */\n    code: number\n    /**\n     * The signal of the process exit. This is the nodejs child process \"exit\" event arg.\n     */\n    signal: string\n    /**\n     * The crash report content\n     */\n    crashReport: string\n    /**\n     * The location of the crash report\n     */\n    crashReportLocation: string\n  }) => void): this\n  /**\n   * Fire around the time when Minecraft window appeared in screen.\n   *\n   * Since the Minecraft window will take time to init, this event fire when it capture some keywords from stdout.\n   */\n  on(event: 'minecraft-window-ready', listener: () => void): this\n}\n\n/**\n * Create a process watcher for a minecraft process.\n *\n * It will watch the stdout and the error event of the process to detect error and minecraft state.\n * @param process The Minecraft process\n * @param emitter The event emitter which will emit usefule event\n */\nexport function createMinecraftProcessWatcher(process: ChildProcess, emitter: EventEmitter = new EventEmitter()): MinecraftProcessWatcher {\n  let crashReport = ''\n  let crashReportLocation = ''\n  let waitForReady = true\n  process.on('error', (e) => {\n    emitter.emit('error', e)\n  })\n  process.on('exit', (code, signal) => {\n    emitter.emit('minecraft-exit', {\n      code,\n      signal,\n      crashReport,\n      crashReportLocation,\n    })\n  })\n  process.stdout?.on('data', (s) => {\n    const string = s.toString()\n    if (string.indexOf('---- Minecraft Crash Report ----') !== -1) {\n      crashReport = string\n    } else if (string.indexOf('Crash report saved to:') !== -1) {\n      crashReportLocation = string.substring(string.indexOf('Crash report saved to:') + 'Crash report saved to: #@!@# '.length)\n      crashReportLocation = crashReportLocation.replace(EOL, '').trim()\n    } else if (waitForReady && (string.indexOf('Missing metadata in pack') !== -1 || string.indexOf('Registering resource reload listener') !== -1 || string.indexOf('Reloading ResourceManager') !== -1 || string.indexOf('LWJGL Version: ') !== -1 || string.indexOf('OpenAL initialized.') !== -1)) {\n      waitForReady = false\n      emitter.emit('minecraft-window-ready')\n    } else if (waitForReady && (string.indexOf(' Preparing level ') !== -1)) {\n      waitForReady = false\n      emitter.emit('minecraft-window-ready')\n    } else if (string.indexOf('Failed to start the minecraft server') !== -1) {\n      crashReport = string\n    }\n  })\n  return emitter\n}\n\n/**\n * Launch the minecraft as a child process. This function use spawn to create child process. To use an alternative way, see function generateArguments.\n *\n * By default, it will use the `LauncherPrecheck.Default` to pre-check:\n * - It will also check if the runtime libs are completed, and will extract native libs if needed.\n * - It might throw exception when the version jar is missing/checksum not matched.\n * - It might throw if the libraries/natives are missing.\n *\n * If you DON'T want such precheck, and you want to change it. You can assign the `prechecks` property in launch\n *\n * ```ts\n * launch({ ...otherOptions, prechecks: yourPrechecks });\n * ```\n *\n * @param options The detail options for this launching.\n * @see [ChildProcess](https://nodejs.org/api/child_process.html)\n * @see [spawn](https://nodejs.org/api/spawn.html)\n * @see {@link generateArguments}\n * @see {@link createMinecraftProcessWatcher}\n * @throws {@link CorruptedVersionJarError}\n * @throws {@link MissingLibrariesError}\n */\nexport async function launch(options: LaunchOption): Promise<ChildProcess> {\n  const gamePath = !isAbsolute(options.gamePath) ? resolve(options.gamePath) : options.gamePath\n  const resourcePath = options.resourcePath || gamePath\n  const version = typeof options.version === 'string' ? await Version.parse(resourcePath, options.version) : options.version\n\n  let args = await generateArguments({ ...options, version, gamePath, resourcePath })\n\n  const minecraftFolder = MinecraftFolder.from(resourcePath)\n  const prechecks = options.prechecks || LaunchPrecheck.DEFAULT_PRECHECKS\n  await Promise.all(prechecks.map((f) => f(minecraftFolder, version, options)))\n  const spawnOption = { cwd: options.gamePath, ...options.extraExecOption }\n\n  if (options.extraExecOption?.shell) {\n    args = args.map((a) => `\"${a}\"`)\n  }\n  // fix the ENOTFOUND if cwd does not existed.\n  if (!existsSync(gamePath)) {\n    await mkdir(gamePath)\n  }\n\n  return (options.spawn ?? spawn)(args[0], args.slice(1), spawnOption)\n}\n\nfunction unshiftPrependCommand(cmd: string[], prependCommand?: string[] | string) {\n  if (prependCommand) {\n    if (typeof prependCommand === 'string') {\n      if (prependCommand.trim().length > 0) {\n        cmd.push(prependCommand.trim())\n      }\n    } else {\n      const prepended = prependCommand.filter((c) => c.trim().length > 0)\n      cmd.unshift(...prepended)\n    }\n  }\n}\n\n/**\n * Generate the argument for server\n */\nexport function generateArgumentsServer(options: ServerOptions, _delimiter: string = delimiter, _sep: string = sep) {\n  const { javaPath, minMemory, maxMemory, extraJVMArgs = [], extraMCArgs = [], extraExecOption = {} } = options\n  const cmd = [\n    javaPath,\n  ]\n  if (minMemory) {\n    cmd.push(`-Xms${(minMemory)}M`)\n  }\n  if (maxMemory) {\n    cmd.push(`-Xmx${(maxMemory)}M`)\n  }\n  cmd.push(\n    ...extraJVMArgs,\n  )\n\n  if (options.classPath && options.classPath.length > 0) {\n    cmd.push('-cp', options.classPath.map(v => v.replaceAll(sep, _sep)).join(_delimiter))\n  }\n\n  if (options.serverExectuableJarPath) {\n    cmd.push('-jar', options.serverExectuableJarPath.replaceAll(sep, _sep))\n  } else if (options.mainClass) {\n    cmd.push(options.mainClass)\n  }\n\n  cmd.push(...extraMCArgs)\n\n  if (options.nogui) {\n    cmd.push('nogui')\n  }\n\n  unshiftPrependCommand(cmd, options.prependCommand)\n\n  return cmd\n}\n\n/**\n * Generate the arguments array by options. This function is useful if you want to launch the process by yourself.\n *\n * This function will **NOT** check if the runtime libs are completed, and **WONT'T** check or extract native libs.\n *\n * If you want to ensure native. Please see {@link LaunchPrecheck.checkNatives}.\n *\n * @param options The launch options.\n * @throws TypeError if options does not fully fulfill the requirement\n */\nexport async function generateArguments(options: LaunchOption) {\n  if (!options.version) { throw new TypeError('Version cannot be null!') }\n  if (!options.demo) { options.demo = false }\n\n  const currentPlatform = options.platform ?? getPlatform()\n  const gamePath = !isAbsolute(options.gamePath) ? resolve(options.gamePath) : options.gamePath\n  const resourcePath = options.resourcePath || gamePath\n  const version = typeof options.version === 'string' ? await Version.parse(resourcePath, options.version) : options.version\n  const mc = MinecraftFolder.from(resourcePath)\n  const cmd: string[] = []\n\n  const { id = randomUUID().replace(/-/g, ''), name = 'Steve' } = options.gameProfile || {}\n  const accessToken = options.accessToken || randomUUID().replace(/-/g, '')\n  const properties = options.properties || {}\n  const userType = options.userType || 'msa'\n  const features = options.features || {}\n  const jvmArguments = normalizeArguments(version.arguments.jvm, currentPlatform, features)\n  const gameArguments = normalizeArguments(version.arguments.game, currentPlatform, features)\n  const featureValues = Object.values(features).filter((f) => typeof f === 'object').reduce((a: any, b: any) => ({ ...a, ...b }), {})\n  const launcherName = options.launcherName || 'Launcher'\n  const launcherBrand = options.launcherBrand || '0.0.1'\n  const nativeRoot = options.nativeRoot || mc.getNativesRoot(version.id)\n\n  let gameIcon = options.gameIcon\n  if (!gameIcon) {\n    const index = mc.getAssetsIndex(version.assets)\n    const indexContent = await readFile(index, { encoding: 'utf-8' }).then((b) => JSON.parse(b.toString()), () => ({}))\n    if ('icons/minecraft.icns' in indexContent) {\n      gameIcon = mc.getAsset(indexContent['icons/minecraft.icns'].hash)\n    } else if ('minecraft/icons/minecraft.icns' in indexContent) {\n      gameIcon = mc.getAsset(indexContent['minecraft/icons/minecraft.icns'].hash)\n    } else {\n      gameIcon = ''\n    }\n  }\n  const gameName = options.gameName || 'Minecraft'\n\n  cmd.push(options.javaPath)\n\n  if (currentPlatform.name === 'osx') {\n    cmd.push(`-Xdock:name=${gameName}`)\n    if (gameIcon) {\n      cmd.push(`-Xdock:icon=${gameIcon}`)\n    }\n  }\n\n  if (options.minMemory) {\n    cmd.push(`-Xms${(options.minMemory)}M`)\n  }\n  if (options.maxMemory) {\n    cmd.push(`-Xmx${(options.maxMemory)}M`)\n  }\n\n  if (options.ignoreInvalidMinecraftCertificates) {\n    cmd.push('-Dfml.ignoreInvalidMinecraftCertificates=true')\n  }\n  if (options.ignorePatchDiscrepancies) {\n    cmd.push('-Dfml.ignorePatchDiscrepancies=true')\n  }\n\n  if (options.yggdrasilAgent) {\n    cmd.push(`-javaagent:${options.yggdrasilAgent.jar}=${options.yggdrasilAgent.server}`)\n    cmd.push('-Dauthlibinjector.side=client')\n    if (options.yggdrasilAgent.prefetched) {\n      cmd.push(`-Dauthlibinjector.yggdrasil.prefetched=${options.yggdrasilAgent.prefetched}`)\n    }\n  }\n\n  const jvmOptions = {\n    natives_directory: nativeRoot,\n    launcher_name: launcherName,\n    launcher_version: launcherBrand,\n    game_directory: gamePath,\n    classpath: [\n      ...version.libraries.filter((lib) => !lib.isNative).map((lib) => mc.getLibraryByPath(lib.download.path)),\n      mc.getVersionJar(version.minecraftVersion),\n      ...(options.extraClassPaths || []),\n    ].join(delimiter),\n    library_directory: mc.getPath('libraries'),\n    classpath_separator: delimiter,\n    version_name: version.minecraftVersion,\n    ...featureValues,\n  }\n\n  if (version.logging && version.logging.client) {\n    const client = version.logging.client\n    const argument = client.argument\n    const filePath = mc.getLogConfig(client.file.id)\n    if (existsSync(filePath)) {\n      // eslint-disable-next-line no-template-curly-in-string\n      jvmArguments.push(argument.replace('${path}', filePath))\n    }\n  }\n\n  cmd.push(...jvmArguments.map((arg) => format(arg, jvmOptions)))\n\n  if (!cmd.some(v => v.startsWith('-DlibraryDirectory'))) {\n    cmd.push('-DlibraryDirectory=' + mc.getPath('libraries'))\n  }\n\n  // add extra jvm args\n  if (options.extraJVMArgs instanceof Array) {\n    if (options.extraJVMArgs.some((v) => typeof v !== 'string')) {\n      throw new TypeError('Require extraJVMArgs be all string!')\n    }\n    cmd.push(...options.extraJVMArgs)\n  } else {\n    // if options object already has `maxMemory` property, exclude the \"-Xmx2G\" option from the default extra jvm args\n    if (options.maxMemory) {\n      cmd.push(...DEFAULT_EXTRA_JVM_ARGS.filter((v) => v !== '-Xmx2G'))\n    } else {\n      cmd.push(...DEFAULT_EXTRA_JVM_ARGS)\n    }\n  }\n\n  cmd.push(version.mainClass)\n  const assetsDir = join(resourcePath, 'assets')\n  const resolution = options.resolution\n  const versionName = options.versionName || version.id\n  const versionType = options.versionType || version.type\n  const mcOptions = {\n    version_name: versionName,\n    version_type: versionType,\n    assets_root: assetsDir,\n    game_assets: join(assetsDir, 'virtual', version.assets),\n    assets_index_name: options.useHashAssetsIndex ? version.assetIndex?.sha1 ?? version.assets : version.assets,\n    auth_session: accessToken,\n    game_directory: gamePath,\n    auth_player_name: name,\n    auth_uuid: id,\n    auth_access_token: accessToken,\n    user_properties: JSON.stringify(properties),\n    user_type: userType,\n    resolution_width: -1,\n    resolution_height: -1,\n    ...featureValues,\n  }\n\n  if (resolution) {\n    mcOptions.resolution_width = resolution.width\n    mcOptions.resolution_height = resolution.height\n  }\n\n  cmd.push(...gameArguments.map((arg) => format(arg, mcOptions)))\n\n  if (options.extraMCArgs) {\n    cmd.push(...options.extraMCArgs)\n  }\n  if (options.quickPlayMultiplayer) {\n    cmd.push('--quickPlayMultiplayer', options.quickPlayMultiplayer)\n  }\n  if (options.server) {\n    cmd.push('--server', options.server.ip)\n    if (options.server.port) {\n      cmd.push('--port', options.server.port.toString())\n    }\n  }\n  if (options.resolution && !cmd.find((a) => a === '--width')) {\n    if (options.resolution.fullscreen) {\n      cmd.push('--fullscreen')\n    } else {\n      if (options.resolution.height) {\n        cmd.push('--height', options.resolution.height.toString())\n      }\n      if (options.resolution.width) {\n        cmd.push('--width', options.resolution.width.toString())\n      }\n    }\n  }\n\n  if (options.demo) {\n    cmd.push('--demo')\n  }\n\n  unshiftPrependCommand(cmd, options.prependCommand)\n\n  return cmd\n}\n\n/**\n * Truely normalize the launch argument.\n */\nfunction normalizeArguments(args: Version.LaunchArgument[], platform: Platform, features: EnabledFeatures): string[] {\n  return args.map((arg) => {\n    if (typeof arg === 'string') {\n      return arg\n    }\n    if (!Version.checkAllowed(arg.rules || [], platform, Object.keys(features))) {\n      return ''\n    }\n    return arg.value\n  }).reduce<string[]>((result, cur) => {\n    if (cur instanceof Array) {\n      result.push(...cur)\n    } else if (cur) {\n      result.push(cur)\n    }\n    return result\n  }, [])\n}\n\n/**\n * Create a quickPlayMultiplayer string from server IP and optional port\n * @param ip The server IP address\n * @param port The server port (optional, defaults to 25565 if not specified)\n * @returns A formatted string for quickPlayMultiplayer option\n */\nexport function createQuickPlayMultiplayer(ip: string, port?: number): string {\n  return port ? `${ip}:${port}` : ip\n}\n", "import { join } from 'path'\n\nexport interface MinecraftFolder {\n  readonly root: string\n}\n\n/**\n * The Minecraft folder structure. All method will return the path related to a minecraft root like `.minecraft`.\n */\nexport class MinecraftFolder {\n  /**\n     * Normal a Minecraft folder from a folder or string\n     */\n  static from(location: MinecraftLocation) {\n    return typeof location === 'string'\n      ? new MinecraftFolder(location)\n      : location instanceof MinecraftFolder\n        ? location\n        : new MinecraftFolder((location as any).root)\n  }\n\n  constructor(readonly root: string) { }\n\n  get mods(): string { return join(this.root, 'mods') }\n  get resourcepacks(): string { return join(this.root, 'resourcepacks') }\n  get assets(): string { return join(this.root, 'assets') }\n  get libraries(): string { return join(this.root, 'libraries') }\n  get versions(): string { return this.getPath('versions') }\n  get logs(): string { return this.getPath('logs') }\n  get options(): string { return this.getPath('options.txt') }\n  get launcherProfile(): string { return this.getPath('launcher_profiles.json') }\n  get lastestLog(): string { return this.getPath('logs', 'latest.log') }\n  get maps(): string { return this.getPath('saves') }\n  get saves(): string { return this.getPath('saves') }\n  get screenshots(): string { return this.getPath('screenshots') }\n\n  getNativesRoot(version: string) { return join(this.getVersionRoot(version), version + '-natives') }\n  getVersionRoot(version: string) { return join(this.versions, version) }\n  getVersionJson(version: string) { return join(this.getVersionRoot(version), version + '.json') }\n  getVersionServerJson(version: string) { return join(this.getVersionRoot(version), 'server.json') }\n  getVersionJar(version: string, type?: string) {\n    if (type === 'client' || !type) return join(this.getVersionRoot(version), version + '.jar')\n    if (type === 'server') return this.getPath('libraries', 'net', 'minecraft', 'server', version, `server-${version}-bundled.jar`)\n    return join(this.getVersionRoot(version), version + `-${type}.jar`)\n  }\n\n  getVersionAll(version: string) {\n    return [\n      join(this.versions, version), join(this.versions, version, version + '.json'),\n      join(this.versions, version, version + '.jar'),\n    ]\n  }\n\n  getResourcePack(fileName: string) { return join(this.resourcepacks, fileName) }\n  getMod(fileName: string) { return join(this.mods, fileName) }\n  getLog(fileName: string) { return join(this.logs, fileName) }\n  getMapInfo(map: string) { return this.getPath('saves', map, 'level.dat') }\n  getMapIcon(map: string) { return this.getPath('saves', map, 'icon.png') }\n  getLibraryByPath(libraryPath: string): string {\n    return join(this.libraries, libraryPath)\n  }\n\n  getAssetsIndex(versionAssets: string): string { return this.getPath('assets', 'indexes', versionAssets + '.json') }\n  getAsset(hash: string): string { return this.getPath('assets', 'objects', hash.substring(0, 2), hash) }\n  getLogConfig(file: string): string { return this.getPath('assets', 'log_configs', file) }\n  getPath(...path: string[]) {\n    return join(this.root, ...path)\n  }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace MinecraftPath {\n  export const mods = 'mods'\n  export const resourcepacks = 'resourcepacks'\n  export const assets = 'assets'\n  export const libraries = 'libraries'\n  export const versions = 'versions'\n  export const logs = 'logs'\n  export const options = 'options.txt'\n  export const launcherProfile = 'launcher_profiles.json'\n  export const lastestLog = 'logs/latest.log'\n  export const maps = MinecraftPath.saves\n  export const saves = 'saves'\n  export const screenshots = 'screenshots'\n\n  export function getVersionRoot(version: string) { return join('versions', version) }\n  export function getNativesRoot(version: string) { return join('versions', version, version + '-natives') }\n  export function getVersionJson(version: string) { return join('versions', version, version + '.json') }\n  export function getVersionJar(version: string, type?: string) {\n    return type === 'client' || type === undefined\n      ? join('versions', version, version + '.jar')\n      : join('versions', version, `${version}-${type}.jar`)\n  }\n  export function getResourcePack(fileName: string) { return join('resourcepacks', fileName) }\n  export function getMod(fileName: string) { return join('mods', fileName) }\n  export function getLog(fileName: string) { return join('logs', fileName) }\n  export function getMapInfo(map: string) { return join('saves', map, 'level.dat') }\n  export function getMapIcon(map: string) { return join('saves', map, 'icon.png') }\n  export function getLibraryByPath(libraryPath: string) { return join('libraries', libraryPath) }\n  export function getAssetsIndex(versionAssets: string) { return join('assets', 'indexes', versionAssets + '.json') }\n  export function getAsset(hash: string): string { return join('assets', 'objects', hash.substring(0, 2), hash) }\n}\n\nexport type MinecraftLocation = MinecraftFolder | string\n", "import * as os from 'os'\n\n/**\n * The platform information related to current operating system.\n */\nexport interface Platform {\n  /**\n     * The system name of the platform. This name is majorly used for download.\n     */\n  name: 'osx' | 'linux' | 'windows' | 'unknown'\n  /**\n     * The version of the os. It should be the value of `os.release()`.\n     */\n  version: string\n  /**\n     * The direct output of `os.arch()`. Should look like x86 or x64.\n     */\n  arch: 'x86' | 'x64' | string\n}\n\n/**\n * Get Minecraft style platform info. (Majorly used to enable/disable native dependencies)\n */\nexport function getPlatform(): Platform {\n  const arch = os.arch()\n  const version = os.release()\n  switch (os.platform()) {\n    case 'darwin':\n      return { name: 'osx', version, arch }\n    case 'linux':\n      return { name: 'linux', version, arch }\n    case 'win32':\n      return { name: 'windows', version, arch }\n    default:\n      return { name: 'unknown', version, arch }\n  }\n}\n", "/**\n * @ignore\n */\n\nimport { createHash } from 'crypto'\nimport { constants, createReadStream } from 'fs'\nimport { access } from 'fs/promises'\nimport { pipeline } from 'stream/promises'\n\n/** @internal */\nexport function exists(file: string) {\n  return access(file, constants.F_OK).then(() => true, () => false)\n}\n/**\n * Validate the sha1 value of the file\n * @internal\n */\nexport async function validateSha1(target: string, hash?: string, strict = false) {\n  if (await access(target).then(() => false, () => true)) { return false }\n  if (!hash) { return !strict }\n  const sha1 = await checksum(target, 'sha1')\n  return sha1 === hash\n}\n/**\n * Return the sha1 of a file\n * @internal\n */\nexport async function checksum(target: string, algorithm: string) {\n  const hash = createHash(algorithm).setEncoding('hex')\n  try {\n    await pipeline(createReadStream(target), hash)\n  } catch (e) {\n    if ((e as any).code === 'ENOENT') {\n      return undefined\n    }\n  }\n  return hash.read()\n}\n/**\n * @internal\n */\nexport function isNotNull<T>(v: T | undefined): v is T {\n  return v !== undefined\n}\n", "import { MinecraftFolder, MinecraftLocation } from './folder'\nimport { Platform, getPlatform } from './platform'\nimport { extname } from 'path'\nimport { readFile } from 'fs/promises'\n\ninterface PartialResolvedVersion extends Version {\n  libraries: ResolvedLibrary[]\n  arguments: {\n    game: Version.LaunchArgument[]\n    jvm: Version.LaunchArgument[]\n  }\n  minecraftDirectory: string\n}\n/**\n * The resolved version for launcher.\n * It could be a combination of multiple versions as there might be some inheritions.\n *\n * You can get resolved version of a Minecraft by calling {@link Version.parse}.\n *\n * @see {@link Version.parse}\n */\nexport interface ResolvedVersion {\n  /**\n   * The id of the version, should be identical to the version folder.\n   */\n  id: string\n  arguments: {\n    game: Version.LaunchArgument[]\n    jvm: Version.LaunchArgument[]\n  }\n  /**\n   * The main class full qualified name\n   */\n  mainClass: string\n  assetIndex?: Version.AssetIndex\n  /**\n   * The asset index id of this version. Should be something like `1.14`, `1.12`\n   */\n  assets: string\n  downloads: {\n    client?: Version.Download\n    server?: Version.Download\n    [key: string]: Version.Download | undefined\n  }\n  libraries: ResolvedLibrary[]\n\n  minimumLauncherVersion: number\n  releaseTime: string\n  time: string\n  type: string\n  logging?: {\n    [key: string]: {\n      file: Version.Download & { id: string }\n      argument: string\n      type: string\n    }\n  }\n  /**\n   * Recommended java version\n   */\n  javaVersion: JavaVersion\n  /**\n   * The minecraft version of this version\n   */\n  minecraftVersion: string\n  /**\n   * The minecraft directory of this version\n   */\n  minecraftDirectory: string\n  /**\n   * The version inheritances of this whole resolved version.\n   *\n   * The first element is this version, and the last element is the root Minecraft version.\n   * The dependencies of `[a, b, c]` should be `a -> b -> c`, where c is a Minecraft version.\n   */\n  inheritances: string[]\n\n  /**\n   * All array of json file paths.\n   *\n   * It's the chain of inherits json path. The root json will be the last element of the array.\n   * The first element is the user provided version.\n   */\n  pathChain: string[]\n}\n\n/**\n * The full library info. I can be resolved from path or maven library name.\n *\n * @see {@link LibraryInfo.resolveFromPath} {@link LibraryInfo.resolve}\n */\nexport interface LibraryInfo {\n  readonly groupId: string\n  readonly artifactId: string\n  readonly version: string\n  readonly isSnapshot: boolean\n  /**\n   * The file extension. Default is `jar`. Some files in forge are `zip`.\n   */\n  readonly type: string\n  /**\n   * The classifier. Normally, this is empty. For forge, it can be like `universal`, `installer`.\n   */\n  readonly classifier: string\n  /**\n   * The maven path.\n   */\n  readonly path: string\n  /**\n   * The original maven name of this library\n   */\n  readonly name: string\n}\n\nexport interface BadVersionJsonError {\n  error: 'BadVersionJson'\n  missing: 'MainClass' | 'AssetIndex' | 'Downloads'\n  version: string\n}\nexport interface CorruptedVersionJsonError {\n  error: 'CorruptedVersionJson'\n  version: string\n  json: string\n}\nexport interface MissingVersionJsonError {\n  error: 'MissingVersionJson'\n  version: string\n  path: string\n}\nexport interface CircularDependenciesError {\n  error: 'CircularDependencies'\n  /**\n   * The version has circular dependencies\n   */\n  version: string\n\n  chain: string[]\n}\n\nexport type VersionParseError = ((BadVersionJsonError | CorruptedVersionJsonError | MissingVersionJsonError | CircularDependenciesError) & Error) | Error\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace LibraryInfo {\n  /**\n   * Resolve the library info from the maven path.\n   * @param path The library path. It should look like `net/minecraftforge/forge/1.0/forge-1.0.jar`\n   */\n  export function resolveFromPath(path: string): LibraryInfo {\n    const parts = path.split('/')\n    const file = parts[parts.length - 1]\n    const version = parts[parts.length - 2]\n    const artifactId = parts[parts.length - 3]\n    const groupId = parts.slice(0, parts.length - 3).join('.')\n\n    const filePrefix = `${artifactId}-${version}`\n    const ext = extname(file)\n    const type = ext.substring(1)\n\n    const isSnapshot = file.startsWith(version)\n\n    let classifier = file.substring(isSnapshot ? version.length : filePrefix.length, file.length - ext.length)\n\n    if (classifier.startsWith('-')) {\n      classifier = classifier.slice(1)\n    }\n\n    let name = `${groupId}:${artifactId}:${version}`\n    if (classifier) {\n      name += `:${classifier}`\n    }\n    if (type !== 'jar') {\n      name += `@${type}`\n    }\n\n    return {\n      type,\n      groupId,\n      artifactId,\n      version,\n      classifier,\n      name,\n      path,\n      isSnapshot,\n    }\n  }\n  /**\n   * Get the base info of the library from its name\n   *\n   * @param lib The name of library or the library itself\n   */\n  export function resolve(lib: string | Version.Library | ResolvedLibrary): LibraryInfo {\n    const name: string = typeof lib === 'string' ? lib : lib.name\n    const [body, type = 'jar'] = name.split('@')\n    const [groupId, artifactId, version, classifier = ''] = body.split(':')\n    const isSnapshot = version.endsWith('-SNAPSHOT')\n\n    const groupPath = groupId.replace(/\\./g, '/')\n    let base = `${groupPath}/${artifactId}/${version}/${artifactId}-${version}`\n    if (classifier) { base += `-${classifier}` }\n    const path = `${base}.${type}`\n\n    return {\n      type,\n      groupId,\n      artifactId,\n      version,\n      name,\n      isSnapshot,\n      classifier,\n      path,\n    }\n  }\n}\n\n/**\n * A resolved library for launcher. It can by parsed from `LibraryInfo`.\n */\nexport class ResolvedLibrary implements LibraryInfo {\n  readonly groupId: string\n  readonly artifactId: string\n  readonly version: string\n  readonly isSnapshot: boolean\n  readonly type: string\n  readonly classifier: string\n  readonly path: string\n  constructor(\n    readonly name: string,\n    info: LibraryInfo,\n    readonly download: Version.Artifact,\n    readonly isNative: boolean = false,\n    readonly checksums?: string[],\n    readonly serverreq?: boolean,\n    readonly clientreq?: boolean,\n    readonly extractExclude?: string[]) {\n    const { groupId, artifactId, version, isSnapshot, type, classifier, path } = info\n    this.groupId = groupId\n    this.artifactId = artifactId\n    this.version = version\n    this.isSnapshot = isSnapshot\n    this.type = type\n    this.classifier = classifier\n    this.path = path\n  }\n}\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Version {\n  export interface Download {\n    sha1: string\n    size: number\n    url: string\n  }\n  export interface AssetIndex extends Download {\n    readonly id: string\n    readonly totalSize: number\n  }\n  export interface Artifact extends Download {\n    readonly path: string\n  }\n  export interface LoggingFile extends Download {\n    readonly id: string\n  }\n\n  export interface NormalLibrary {\n    name: string\n    downloads: {\n      artifact: Artifact\n    }\n  }\n  export interface Rule {\n    action: 'allow' | 'disallow'\n    os?: Partial<Platform>\n    features?: { [feat: string]: boolean }\n  }\n  export interface NativeLibrary {\n    name: string\n    downloads: {\n      artifact: Artifact\n      classifiers: {\n        [os: string]: Artifact\n      }\n    }\n    rules: Rule[]\n    extract: {\n      exclude: string[]\n    }\n    natives: {\n      [os: string]: string\n    }\n  }\n\n  export interface PlatformSpecificLibrary {\n    name: string\n    downloads: {\n      artifact: Artifact\n    }\n    rules: Rule[]\n  }\n  export interface LegacyLibrary {\n    name: string\n    url?: string\n    clientreq?: boolean\n    serverreq?: boolean\n    checksums?: string[]\n  }\n\n  export type Library = NormalLibrary | NativeLibrary | PlatformSpecificLibrary | LegacyLibrary\n\n  export type LaunchArgument = string | {\n    rules?: Rule[]\n    value: string | string[]\n  }\n\n  /**\n    * Check if all the rules in `Rule[]` are acceptable in certain OS `platform` and features.\n    * @param rules The rules usually comes from `Library` or `LaunchArgument`\n    * @param platform The platform, leave it absent will use the `currentPlatform`\n    * @param features The features, used by game launch argument `arguments.game`\n    */\n  export function checkAllowed(rules: Rule[], platform: Platform = getPlatform(), features: string[] = []): boolean {\n    // by default it's allowed\n    if (!rules || rules.length === 0) { return true }\n    // else it's disallow by default\n    let allow = false\n    for (const rule of rules) {\n      const action = rule.action === 'allow'\n      // apply by default\n      let apply = true\n      if ('os' in rule && rule.os) {\n        // don't apply by default if has os rule\n        apply = false\n        const osRule = rule.os\n        if (platform.name === osRule.name &&\n          (!osRule.version || platform.version.match(osRule.version))) {\n          apply = true\n          if (osRule.arch) {\n            const ruleArch = osRule.arch === 'x86' ? 'ia32' : osRule.arch\n            apply = ruleArch === platform.arch\n          }\n        }\n      }\n      if (apply) {\n        if ('features' in rule && rule.features) {\n          const featureRequire = rule.features\n          // only apply when the EVERY required features enabled & not required features disabled\n          apply = Object.entries(featureRequire)\n            .every(([k, v]) => v ? features.indexOf(k) !== -1 : features.indexOf(k) === -1)\n        }\n      }\n      if (apply) { allow = action }\n    }\n    return allow\n  }\n  /**\n   * Recursively parse the version JSON.\n   *\n   * This function requires that the id in version.json is identical to the directory name of that version.\n   *\n   * e.g. .minecraft/<version-a>/<version-a.json> and in <version-a.json>:\n   *```\n   * { \"id\": \"<version-a>\", ... }\n   * ```\n   * The function might throw multiple parsing errors. You can handle them with type by this:\n   * ```ts\n   * try {\n   *   await Version.parse(mcPath, version);\n   * } catch (e) {\n   *   let err = e as VersionParseError;\n   *   switch (err.error) {\n   *     case \"BadVersionJson\": // do things...\n   *     // handle other cases\n   *     default: // this means this is not a VersionParseError, handle error normally.\n   *   }\n   * }\n   * ```\n   *\n   * @param minecraftPath The .minecraft path\n   * @param version The vesion id.\n   * @return The final resolved version detail\n   * @throws {@link CorruptedVersionJsonError}\n   * @throws {@link MissingVersionJsonError}\n   * @throws {@link BadVersionJsonError}\n   * @see {@link VersionParseError}\n   */\n  export async function parse(minecraftPath: MinecraftLocation, version: string, platofrm: Platform = getPlatform()): Promise<ResolvedVersion> {\n    const folder = MinecraftFolder.from(minecraftPath)\n    // the hierarchy is outer version to dep version\n    // e.g. [liteloader version, forge version, minecraft version]\n    const hierarchy = await resolveDependency(folder, version, platofrm)\n    return resolve(minecraftPath, hierarchy)\n  }\n\n  /**\n   * Resolve the given version hierarchy into `ResolvedVersion`.\n   *\n   * Some launcher has non-standard version json format to handle hierarchy,\n   * and if you want to handle them, you can use this function to parse.\n   *\n   * @param minecraftPath The path of the Minecraft folder\n   * @param hierarchy The version hierarchy, which can be produced by `normalizeVersionJson`\n   * @throws {@link BadVersionJsonError}\n   * @see {@link VersionParseError}\n   * @see {@link normalizeVersionJson}\n   * @see {@link parse}\n   */\n  export function resolve(minecraftPath: MinecraftLocation, hierarchy: PartialResolvedVersion[]) {\n    const folder = MinecraftFolder.from(minecraftPath)\n\n    const rootVersion = hierarchy[hierarchy.length - 1]\n    const id: string = hierarchy[0].id\n    let assetIndex: AssetIndex = rootVersion.assetIndex!\n    let assets = ''\n\n    const downloadsMap: { [key: string]: Download } = {}\n    const librariesMap: { [key: string]: ResolvedLibrary } = {}\n    const nativesMap: { [key: string]: ResolvedLibrary } = {}\n\n    let mainClass = ''\n    const args = { jvm: [] as LaunchArgument[], game: [] as LaunchArgument[] }\n    let minimumLauncherVersion = 0\n    let releaseTime = ''\n    let time = ''\n    let type = ''\n    let logging: any\n    const minecraftVersion: string = rootVersion.clientVersion ?? rootVersion._minecraftVersion ?? rootVersion.id\n    let location: string\n    let javaVersion: JavaVersion = { majorVersion: 8, component: 'jre-legacy' }\n\n    const chains: string[] = hierarchy.map((j) => folder.getVersionRoot(j.id))\n    const inheritances = hierarchy.map((j) => j.id)\n\n    let json: PartialResolvedVersion\n    do {\n      json = hierarchy.pop()!\n      minimumLauncherVersion = Math.max(json.minimumLauncherVersion || 0, minimumLauncherVersion)\n      location = json.minecraftDirectory\n\n      if (!Reflect.get(json, 'replace')) {\n        args.game.push(...json.arguments.game)\n        args.jvm.push(...json.arguments.jvm)\n      } else {\n        args.game = json.arguments.game\n        args.jvm = json.arguments.jvm\n      }\n\n      releaseTime = json.releaseTime || releaseTime\n      time = json.time || time\n      logging = json.logging || logging\n      assets = json.assets || assets\n      type = json.type || type\n      mainClass = json.mainClass || mainClass\n      assetIndex = json.assetIndex || assetIndex\n      javaVersion = json.javaVersion || javaVersion\n      if (json.libraries) {\n        json.libraries.forEach((lib) => {\n          let libOrgName = `${lib.groupId}:${lib.artifactId}`\n          if (lib.classifier) {\n            libOrgName += `-${lib.classifier};`\n          }\n          if (lib.isNative) {\n            nativesMap[libOrgName] = lib\n          } else {\n            librariesMap[libOrgName] = lib\n          }\n        })\n      }\n      if (json.downloads) {\n        for (const key in json.downloads) {\n          downloadsMap[key] = json.downloads[key]\n        }\n      }\n    } while (hierarchy.length !== 0)\n\n    if (!mainClass) {\n      throw Object.assign(new Error(), {\n        name: 'BadVersionJson',\n        error: 'BadVersionJson',\n        version: id,\n        missing: 'MainClass',\n      } as BadVersionJsonError)\n    }\n\n    return {\n      id,\n      assetIndex,\n      assets,\n      minecraftVersion,\n      inheritances,\n      arguments: args,\n      downloads: downloadsMap,\n      libraries: Object.keys(librariesMap).map((k) => librariesMap[k]).concat(Object.keys(nativesMap).map((k) => nativesMap[k])),\n      mainClass,\n      minimumLauncherVersion,\n      releaseTime,\n      time,\n      type,\n      logging,\n      pathChain: chains,\n      minecraftDirectory: location,\n      javaVersion,\n    } as ResolvedVersion\n  }\n\n  /**\n   * Simply extends the version (actaully mixin)\n   *\n   * The result version will have the union of two version's libs. If one lib in two versions has different version, it will take the extra version one.\n   * It will also mixin the launchArgument if it could.\n   *\n   * This function can be used for mixin forge and liteloader version.\n   *\n   * This function will throw an Error if two version have different assets. It doesn't care about the detail version though.\n   *\n   * @beta\n   * @param id The new version id\n   * @param parent The parent version will be inherited\n   * @param version The version info which will overlap some parent information\n   * @return The raw version json could be save to the version json file\n   */\n  export function inherits(id: string, parent: Version, version: Version): Version {\n    const launcherVersion = Math.max(parent.minimumLauncherVersion, version.minimumLauncherVersion)\n\n    const libMap: { [name: string]: Library } = {}\n    parent.libraries.forEach((l) => { libMap[l.name] = l })\n    const libraries = version.libraries.filter((l) => libMap[l.name] === undefined)\n\n    const result: Version = {\n      id,\n      time: new Date().toISOString(),\n      releaseTime: new Date().toISOString(),\n      type: version.type,\n      libraries,\n      mainClass: version.mainClass,\n      inheritsFrom: parent.id,\n      minimumLauncherVersion: launcherVersion,\n    }\n\n    if (typeof parent.minecraftArguments === 'string') {\n      if (typeof version.arguments === 'object') {\n        throw new TypeError('Extends require two version in same format!')\n      }\n      result.minecraftArguments = mixinArgumentString(parent.minecraftArguments,\n        version.minecraftArguments || '')\n    } else if (typeof parent.arguments === 'object') {\n      if (typeof version.minecraftArguments === 'string') {\n        throw new TypeError('Extends require two version in same format!')\n      }\n      result.arguments = version.arguments\n    }\n\n    return result\n  }\n\n  /**\n   * Mixin the string arguments\n   * @beta\n   * @param hi Higher priority argument\n   * @param lo Lower priority argument\n   */\n  export function mixinArgumentString(hi: string, lo: string): string {\n    const arrA = hi.split(' ')\n    const arrB = lo.split(' ')\n    const args: { [key: string]: string[] } = {}\n    for (let i = 0; i < arrA.length; i++) { // collection higher priority argument\n      const element = arrA[i]\n      if (!args[element]) { args[element] = [] }\n      if (arrA[i + 1]) { args[element].push(arrA[i += 1]) }\n    }\n    for (let i = 0; i < arrB.length; i++) { // collect lower priority argument\n      const element = arrB[i]\n      if (!args[element]) { args[element] = [] }\n      if (arrB[i + 1]) { args[element].push(arrB[i += 1]) }\n    }\n    const out: string[] = []\n    for (const k of Object.keys(args)) {\n      switch (k) {\n        case '--tweakClass': {\n          const set: { [arg: string]: 0 } = {}\n          for (const v of args[k]) { set[v] = 0 }\n          Object.keys(set).forEach((v) => out.push(k, v))\n          break\n        }\n        default:\n          if (args[k][0]) { out.push(k, args[k][0]) } // use higher priority argument in common\n          break\n      }\n    }\n    return out.join(' ')\n  }\n\n  /**\n   * Resolve the dependencies of a minecraft version\n   * @param path The path of minecraft\n   * @param version The version id\n   * @returns All the version required to run this version, including this version\n   * @throws {@link CorruptedVersionJsonError}\n   * @throws {@link MissingVersionJsonError}\n   */\n  export async function resolveDependency(path: MinecraftLocation, version: string, platform: Platform = getPlatform()): Promise<PartialResolvedVersion[]> {\n    const folder = MinecraftFolder.from(path)\n    const stack: PartialResolvedVersion[] = []\n\n    async function walk(versionName: string) {\n      const jsonPath = folder.getVersionJson(versionName)\n      let contentString: string\n      try {\n        contentString = await readFile(jsonPath, 'utf-8')\n      } catch (err) {\n        const e: any = err\n        throw Object.assign(new Error(e.message), {\n          name: 'MissingVersionJson',\n          error: 'MissingVersionJson',\n          version: versionName,\n          path: jsonPath,\n        } as MissingVersionJsonError)\n      }\n      let nextVersion: string | undefined\n      try {\n        const versionJson = normalizeVersionJson(contentString, folder.root, platform)\n        stack.push(versionJson)\n        nextVersion = versionJson.inheritsFrom\n      } catch (e) {\n        if (e instanceof SyntaxError) {\n          throw Object.assign(new Error(e.message), {\n            name: 'CorruptedVersionJson',\n            error: 'CorruptedVersionJson',\n            version: versionName,\n            json: contentString,\n          } as CorruptedVersionJsonError)\n        }\n        throw e\n      }\n      if (nextVersion) {\n        if (stack.some((v) => v.id === nextVersion)) {\n          throw Object.assign(new Error('Cannot resolve circular dependencies'), {\n            name: 'CircularDependenciesError',\n            error: 'CircularDependenciesError',\n            version,\n            chain: stack.map((v) => v.id).concat(nextVersion),\n          })\n        }\n        await walk(nextVersion)\n      }\n    }\n    await walk(version)\n\n    return stack\n  }\n\n  export function resolveLibrary(lib: Library, platform: Platform = getPlatform()): ResolvedLibrary | undefined {\n    if ('rules' in lib && !checkAllowed(lib.rules, platform)) {\n      return undefined\n    }\n    // official natives foramt\n    if ('natives' in lib) {\n      if (!lib.natives[platform.name]) { return undefined }\n      // eslint-disable-next-line no-template-curly-in-string\n      const classifier = (lib.natives[platform.name]).replace('${arch}', platform.arch.substring(1))\n      let nativeArtifact = lib.downloads?.classifiers?.[classifier]\n      const info = LibraryInfo.resolve(lib.name + ':' + classifier)\n      if (!nativeArtifact) {\n        nativeArtifact = {\n          path: info.path,\n          sha1: '',\n          size: -1,\n          url: 'https://libraries.minecraft.net/' + info.path,\n        }\n      }\n      if (!nativeArtifact.path) {\n        nativeArtifact = {\n          ...nativeArtifact,\n          path: info.path,\n        }\n      }\n      return new ResolvedLibrary(lib.name + ':' + classifier, info, nativeArtifact, true, undefined, undefined, undefined, lib.extract ? lib.extract.exclude ? lib.extract.exclude : undefined : undefined)\n    }\n    const info = LibraryInfo.resolve(lib.name)\n    // normal library\n    if ('downloads' in lib) {\n      if (!lib.downloads.artifact) {\n        throw new Error('Corrupted library: ' + JSON.stringify(lib))\n      }\n      if (!lib.downloads.artifact.url) {\n        lib.downloads.artifact.url = info.groupId === 'net.minecraftforge'\n          ? 'https://files.minecraftforge.net/maven/' + lib.downloads.artifact.path\n          : 'https://libraries.minecraft.net/' + lib.downloads.artifact.path\n      }\n      if (!lib.downloads.artifact.path) {\n        lib.downloads.artifact = {\n          ...lib.downloads.artifact,\n          path: info.path,\n        }\n      }\n      // if (info.classifier.startsWith('natives')) {\n      //   // new native format introduced by 1.19\n      //   return new ResolvedLibrary(info.name, info, lib.downloads.artifact, true)\n      // }\n      return new ResolvedLibrary(lib.name, info, lib.downloads.artifact)\n    }\n    const maven = lib.url || 'https://libraries.minecraft.net/'\n    const artifact: Artifact = {\n      size: -1,\n      sha1: lib.checksums ? lib.checksums[0] : '',\n      path: info.path,\n      url: maven + info.path,\n    }\n    return new ResolvedLibrary(lib.name, info, artifact, false, lib.checksums, lib.serverreq, lib.clientreq)\n  }\n\n  /**\n   * Resolve all these library and filter out os specific libs\n   * @param libs All raw lib\n   * @param platform The platform\n   */\n  export function resolveLibraries(libs: Library[], platform: Platform = getPlatform()): ResolvedLibrary[] {\n    return libs.map((lib) => resolveLibrary(lib, platform)).filter((l) => l !== undefined) as ResolvedLibrary[]\n  }\n\n  /**\n   * Normalize a single version json.\n   *\n   * This function will force legacy version format into new format.\n   * It will convert `minecraftArguments` into `arguments.game` and generate a default `arguments.jvm`\n   *\n   * This will pre-process the libraries according to the rules fields and current platform.\n   * Non-matched libraries will be filtered out.\n   *\n   * This will also pre-process the jvm arguments according to the platform (os) info it provided.\n   *\n   * @param versionString The version json string\n   * @param root The root of the version\n   */\n  export function normalizeVersionJson(versionString: string, root: string, platform: Platform = getPlatform()): PartialResolvedVersion {\n    function processArguments(ar: Version.LaunchArgument[]) {\n      return ar.filter((a) => {\n        // only filter out the os only rule.\n        // if the features fields presented, we don't process it now\n        if (typeof a === 'object' && a.rules?.every((r) => typeof r === 'string' || !('features' in r))) {\n          return Version.checkAllowed(a.rules, platform)\n        }\n        return true\n      })\n    }\n    const parsed: Version = JSON.parse(versionString)\n    // if we legacy version json don't have argument, but have minecraftArugments\n    const legacyVersionJson = !parsed.arguments && !!parsed.minecraftArguments\n    const libraries = Version.resolveLibraries(parsed.libraries || [], platform)\n    const args = {\n      jvm: [] as Version.LaunchArgument[],\n      game: [] as Version.LaunchArgument[],\n    }\n    if (!parsed.arguments) { // old version\n      args.game = parsed.minecraftArguments\n        ? parsed.minecraftArguments.split(' ')\n        : []\n      args.jvm = [\n        {\n          rules: [\n            {\n              action: 'allow',\n              os: {\n                name: 'windows',\n              },\n            },\n          ],\n          value: '-XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump',\n        },\n        {\n          rules: [\n            {\n              action: 'allow',\n              os: {\n                name: 'windows',\n                version: '^10\\\\.',\n              },\n            },\n          ],\n          value: [\n            '-Dos.name=Windows 10',\n            '-Dos.version=10.0',\n          ],\n        },\n        // eslint-disable-next-line no-template-curly-in-string\n        '-Djava.library.path=${natives_directory}',\n        // eslint-disable-next-line no-template-curly-in-string\n        '-Dminecraft.launcher.brand=${launcher_name}',\n        // eslint-disable-next-line no-template-curly-in-string\n        '-Dminecraft.launcher.version=${launcher_version}',\n        '-cp',\n        // eslint-disable-next-line no-template-curly-in-string\n        '${classpath}',\n      ]\n    } else {\n      args.jvm = parsed.arguments.jvm || []\n      args.game = parsed.arguments.game || []\n    }\n\n    args.jvm = processArguments(args.jvm)\n    const partial = {\n      ...parsed,\n      libraries,\n      arguments: args,\n      minecraftDirectory: root,\n      // we want to replace the arguments for every version json in legacy version json\n      replace: legacyVersionJson,\n    }\n    return partial\n  }\n}\n\nexport interface JavaVersion {\n  /**\n   * Corresponding with java manifest json.\n   * @example \"jre-legacy\"\n   */\n  component: string\n  majorVersion: number\n}\n\n/**\n * The raw json format provided by Minecraft. Also the namespace of version operation.\n *\n * Use `parse` to parse a Minecraft version json on the disk, and see the detail info of the version.\n *\n * With `ResolvedVersion`, you can use the resolved version to launch the game.\n *\n * @see {@link Version.parse}\n * @see {@link launch}\n */\nexport interface Version {\n  id: string\n  time: string\n  type: string\n  releaseTime: string\n  inheritsFrom?: string\n  minimumLauncherVersion: number\n\n  minecraftArguments?: string\n  arguments?: {\n    game: Version.LaunchArgument[]\n    jvm: Version.LaunchArgument[]\n  }\n\n  mainClass: string\n  libraries: Version.Library[]\n\n  jar?: string\n\n  assetIndex?: Version.AssetIndex\n  assets?: string\n  downloads?: {\n    client: Version.Download\n    server: Version.Download\n    [key: string]: Version.Download\n  }\n\n  client?: string\n  server?: string\n  logging?: {\n    [key: string]: {\n      file: Version.Download\n      argument: string\n      type: string\n    }\n  }\n\n  javaVersion?: JavaVersion\n  /**\n   * NON CONVERSION! This only present in some third party launcher like PCL to mark the real minecraft version\n   */\n  clientVersion?: string\n  /**\n   * NON CONVERSION! This only present in some third party launcher like Labymod to mark the real minecraft version\n   */\n  _minecraftVersion?: string\n  /**\n   * NON CONVERSION! This only present in some third party launcher like Forge to mark the forge version\n   */\n  _forgeVersion?: string\n  /**\n   * NON CONVERSION! This only present in some third party launcher like Fabric to mark the fabric version\n   */\n  _fabricLoaderVersion?: string\n}\n", "import { ResolvedLibrary, ResolvedVersion, Version } from './version'\nimport { MinecraftFolder, MinecraftLocation } from './folder'\nimport { checksum, exists, isNotNull } from './utils'\nimport { readFile, stat } from 'fs/promises'\n\n/**\n * Represent a issue for your diagnosed minecraft client.\n */\nexport interface Issue {\n  /**\n     * The type of the issue.\n     */\n  type: 'missing' | 'corrupted'\n  /**\n     * The role of the file in Minecraft.\n     */\n  role: string\n  /**\n     * The path of the problematic file.\n     */\n  file: string\n  /**\n     * The useful hint to fix this issue. This should be a human readable string.\n     */\n  hint: string\n  /**\n     * The expected checksum of the file. Can be an empty string if this file is missing or not check checksum at all!\n     */\n  expectedChecksum: string\n  /**\n     * The actual checksum of the file. Can be an empty string if this file is missing or not check checksum at all!\n     */\n  receivedChecksum: string\n}\n\nexport type MinecraftIssues = LibraryIssue | MinecraftJarIssue | VersionJsonIssue | AssetIssue | AssetIndexIssue\n\n/**\n * The library issue represents a corrupted or missing lib.\n * You can use `Installer.installResolvedLibraries` to fix this.\n */\nexport interface LibraryIssue extends Issue {\n  role: 'library'\n\n  /**\n     * The problematic library\n     */\n  library: ResolvedLibrary\n}\n/**\n * The minecraft jar issue represents a corrupted or missing minecraft jar.\n * You can use `Installer.installVersion` to fix this.\n */\nexport interface MinecraftJarIssue extends Issue {\n  role: 'minecraftJar'\n\n  /**\n     * The minecraft version for that jar\n     */\n  version: string\n}\n/**\n * The minecraft jar issue represents a corrupted or missing version jar.\n *\n * This means your version is totally broken, and you should reinstall this version.\n *\n * - If this is just a Minecraft version, you will need to use `Installer.install` to re-install Minecraft.\n * - If this is a Forge version, you will need to use `ForgeInstaller.install` to re-install.\n * - Others are the same, just re-install\n */\nexport interface VersionJsonIssue extends Issue {\n  role: 'versionJson'\n\n  /**\n     * The version of version json that has problem.\n     */\n  version: string\n}\n/**\n * The asset issue represents a corrupted or missing minecraft asset file.\n * You can use `Installer.installResolvedAssets` to fix this.\n */\nexport interface AssetIssue extends Issue {\n  role: 'asset'\n\n  /**\n   * The problematic asset\n   */\n  asset: { name: string; hash: string; size: number }\n}\n/**\n * The asset index issue represents a corrupted or missing minecraft asset index file.\n * You can use `Installer.installAssets` to fix this.\n */\nexport interface AssetIndexIssue extends Issue {\n  role: 'assetIndex'\n\n  /**\n     * The minecraft version of the asset index\n     */\n  version: string\n}\n\nexport interface MinecraftIssueReport {\n  minecraftLocation: MinecraftFolder\n  version: string\n  issues: MinecraftIssues[]\n}\n\nexport interface DiagnoseOptions {\n  checksum?: (file: string, algorithm: string) => Promise<string>\n  strict?: boolean\n  signal?: AbortSignal\n}\n\n/**\n * Diagnose a single file by a certain checksum algorithm. By default, this use sha1\n */\nexport async function diagnoseFile<T extends string>({ file, expectedChecksum, role, hint, algorithm }: { file: string; expectedChecksum: string; role: T; hint: string; algorithm?: string }, options?: DiagnoseOptions) {\n  let issue = false\n  let receivedChecksum = ''\n  algorithm = algorithm ?? 'sha1'\n\n  const checksumFunc = options?.checksum ?? checksum\n  const signal = options?.signal\n  const fileExisted = await exists(file)\n  if (signal?.aborted) return\n  if (!fileExisted) {\n    issue = true\n  } else if (expectedChecksum !== '') {\n    receivedChecksum = await checksumFunc(file, algorithm).catch(e => {\n      if (e.code === 'ENOENT') {\n        return ''\n      }\n      throw e\n    })\n    if (signal?.aborted) return\n    issue = receivedChecksum !== expectedChecksum\n  } else {\n    const fstat = await stat(file).catch(() => ({ size: 0 }))\n    if (fstat.size === 0) {\n      issue = true\n    }\n  }\n  const type = fileExisted ? 'corrupted' : 'missing' as const\n  if (issue) {\n    return {\n      type,\n      role,\n      file,\n      expectedChecksum,\n      receivedChecksum,\n      hint,\n    } as const\n  }\n  return undefined\n}\n\n/**\n * Diagnose the version. It will check the version json/jar, libraries and assets.\n *\n * @param version The version id string\n * @param minecraft The minecraft location\n * @beta\n */\nexport async function diagnose(version: string, minecraftLocation: MinecraftLocation, options?: DiagnoseOptions): Promise<MinecraftIssueReport> {\n  const minecraft = MinecraftFolder.from(minecraftLocation)\n  const report: MinecraftIssueReport = {\n    minecraftLocation: minecraft,\n    version,\n    issues: [],\n  }\n  const issues: Issue[] = report.issues\n\n  let resolvedVersion: ResolvedVersion\n  try {\n    resolvedVersion = await Version.parse(minecraft, version)\n  } catch (err) {\n    const e: any = err\n    if (e.error === 'CorruptedVersionJson') {\n      issues.push({ type: 'corrupted', role: 'versionJson', file: minecraft.getVersionJson(e.version), expectedChecksum: '', receivedChecksum: '', hint: 'Re-install the minecraft!' })\n    } else {\n      issues.push({ type: 'missing', role: 'versionJson', file: minecraft.getVersionJson(e.version), expectedChecksum: '', receivedChecksum: '', hint: 'Re-install the minecraft!' })\n    }\n    return report\n  }\n\n  const jarIssue = await diagnoseJar(resolvedVersion, minecraft)\n\n  if (jarIssue) {\n    report.issues.push(jarIssue)\n  }\n\n  const assetIndexIssue = await diagnoseAssetIndex(resolvedVersion, minecraft)\n\n  if (assetIndexIssue) {\n    report.issues.push(assetIndexIssue)\n  }\n\n  const librariesIssues = await diagnoseLibraries(resolvedVersion, minecraft, options)\n\n  if (librariesIssues.length > 0) {\n    report.issues.push(...librariesIssues)\n  }\n\n  if (!assetIndexIssue) {\n    const objects = (await readFile(minecraft.getAssetsIndex(resolvedVersion.assets), 'utf-8').then((b) => JSON.parse(b.toString()))).objects\n    const assetsIssues = await diagnoseAssets(objects, minecraft, options)\n\n    if (assetsIssues.length > 0) {\n      report.issues.push(...assetsIssues)\n    }\n  }\n\n  return report\n}\n\n/**\n * Diagnose assets currently installed.\n * @param assetObjects The assets object metadata to check\n * @param minecraft The minecraft location\n * @returns The diagnose report\n */\nexport async function diagnoseAssets(assetObjects: Record<string, { hash: string; size: number }>, minecraft: MinecraftFolder, options?: DiagnoseOptions): Promise<Array<AssetIssue>> {\n  const signal = options?.signal\n  const filenames = Object.keys(assetObjects)\n  const issues = await Promise.all(filenames.map(async (filename) => {\n    const { hash, size } = assetObjects[filename]\n    const assetPath = minecraft.getAsset(hash)\n\n    if (options?.strict) {\n      const issue = await diagnoseFile({ file: assetPath, expectedChecksum: hash, role: 'asset', hint: 'Problem on asset! Please consider to use Installer.installAssets to fix.' }, options)\n      if (issue) {\n        return Object.assign(issue, { asset: { name: filename, hash, size } })\n      }\n    } else {\n      // non-strict mode might be faster\n      const { size: realSize } = await stat(assetPath).catch(() => ({ size: -1 }))\n      if (signal?.aborted) return\n      if (realSize !== size) {\n        const issue = await diagnoseFile({ file: assetPath, expectedChecksum: hash, role: 'asset', hint: 'Problem on asset! Please consider to use Installer.installAssets to fix.' }, options)\n        if (issue) {\n          return Object.assign(issue, { asset: { name: filename, hash, size } })\n        }\n      }\n    }\n\n    return undefined\n  }))\n  return issues.filter(isNotNull)\n}\n\n/**\n * Diagnose all libraries presented in this resolved version.\n *\n * @param resolvedVersion The resolved version to check\n * @param minecraft The minecraft location\n * @returns List of libraries issue\n * @see {@link ResolvedVersion}\n */\nexport async function diagnoseLibraries(resolvedVersion: ResolvedVersion, minecraft: MinecraftFolder, options?: DiagnoseOptions): Promise<Array<LibraryIssue>> {\n  const signal = options?.signal\n  const issues = await Promise.all(resolvedVersion.libraries.map(async (lib) => {\n    if (!lib.download.path) {\n      throw new TypeError(`Cannot diagnose library without path! ${JSON.stringify(lib)}`)\n    }\n    const libPath = minecraft.getLibraryByPath(lib.download.path)\n    if (!options?.strict) {\n      const issue = await diagnoseFile({ file: libPath, expectedChecksum: lib.download.sha1, role: 'library', hint: 'Problem on library! Please consider to use Installer.installLibraries to fix.' }, options)\n      if (issue) {\n        return Object.assign(issue, { library: lib })\n      }\n    } else {\n      // non-strict mode might be faster\n      const size = lib.download.size\n      const { size: realSize } = await stat(libPath).catch(() => ({ size: -1 }))\n      if (signal?.aborted) return\n      if (size !== -1 && realSize !== size) {\n        const issue = await diagnoseFile({ file: libPath, expectedChecksum: lib.download.sha1, role: 'library', hint: 'Problem on library! Please consider to use Installer.installLibraries to fix.' }, options)\n        if (issue) {\n          return Object.assign(issue, { library: lib })\n        }\n      }\n    }\n    return undefined\n  }))\n  return issues.filter(isNotNull)\n}\n\nexport async function diagnoseAssetIndex(resolvedVersion: ResolvedVersion, minecraft: MinecraftFolder, useHash = false): Promise<AssetIndexIssue | undefined> {\n  const assetsIndexPath = minecraft.getAssetsIndex(useHash ? resolvedVersion.assetIndex?.sha1 ?? resolvedVersion.assets : resolvedVersion.assets)\n  const issue = await diagnoseFile(\n    { file: assetsIndexPath, expectedChecksum: resolvedVersion.assetIndex?.sha1 ?? '', role: 'assetIndex', hint: 'Problem on assets index file! Please consider to use Installer.installAssets to fix.' })\n  if (issue) {\n    return Object.assign(issue, { version: resolvedVersion.minecraftVersion })\n  }\n  return undefined\n}\n\nexport async function diagnoseJar(resolvedVersion: ResolvedVersion, minecraft: MinecraftFolder, options?: DiagnoseOptions & { side?: 'client' | 'server' }): Promise<MinecraftJarIssue | undefined> {\n  const side = options?.side ?? 'client'\n  const jarPath = minecraft.getVersionJar(resolvedVersion.inheritances.length === 1 ? resolvedVersion.id : resolvedVersion.minecraftVersion, side)\n  const issue = await diagnoseFile(\n    { file: jarPath, expectedChecksum: resolvedVersion.downloads[side]?.sha1 ?? '', role: 'minecraftJar', hint: 'Problem on Minecraft jar! Please consider to use Installer.instalVersion to fix.' })\n  if (issue) {\n    return Object.assign(issue, { version: resolvedVersion.minecraftVersion })\n  }\n  return undefined\n}\n"],
  "mappings": ";AAAA,SAAS,MAAM,qBAAqB,4BAA4B;AAChE,SAAqC,aAAa;AAClD,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB,kBAAkB;AAC9C,SAAS,MAAM,OAAO,YAAAA,WAAU,iBAAiB;AACjD,SAAS,WAAW;AACpB,SAAS,UAAU,WAAW,SAAS,YAAY,QAAAC,OAAM,SAAS,WAAW;AAC7E,SAAS,YAAAC,iBAAgB;AACzB,SAAS,iBAAiB;;;ACT1B,SAAS,YAAY;AASd,IAAM,kBAAN,MAAsB;AAAA,EAY3B,YAAqB,MAAc;AAAd;AAAA,EAAgB;AAAA;AAAA;AAAA;AAAA,EARrC,OAAO,KAAK,UAA6B;AACvC,WAAO,OAAO,aAAa,WACvB,IAAI,gBAAgB,QAAQ,IAC5B,oBAAoB,kBAClB,WACA,IAAI,gBAAiB,SAAiB,IAAI;AAAA,EAClD;AAAA,EAIA,IAAI,OAAe;AAAE,WAAO,KAAK,KAAK,MAAM,MAAM;AAAA,EAAE;AAAA,EACpD,IAAI,gBAAwB;AAAE,WAAO,KAAK,KAAK,MAAM,eAAe;AAAA,EAAE;AAAA,EACtE,IAAI,SAAiB;AAAE,WAAO,KAAK,KAAK,MAAM,QAAQ;AAAA,EAAE;AAAA,EACxD,IAAI,YAAoB;AAAE,WAAO,KAAK,KAAK,MAAM,WAAW;AAAA,EAAE;AAAA,EAC9D,IAAI,WAAmB;AAAE,WAAO,KAAK,QAAQ,UAAU;AAAA,EAAE;AAAA,EACzD,IAAI,OAAe;AAAE,WAAO,KAAK,QAAQ,MAAM;AAAA,EAAE;AAAA,EACjD,IAAI,UAAkB;AAAE,WAAO,KAAK,QAAQ,aA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AkB,qBAAgB,UAAU,IAAI,MAA9B,mBAAiC,SAAQ,IAAI,MAAM,gBAAgB,MAAM,mFAAmF;AAAA,EAAC;AAClM,MAAI,OAAO;AACT,WAAO,OAAO,OAAO,OAAO,EAAE,SAAS,gBAAgB,iBAAiB,CAAC;AAAA,EAC3E;AACA,SAAO;AACT;",
  "names": ["readFile", "join", "pipeline", "MinecraftPath", "arch", "LibraryInfo", "resolve", "Version", "platform", "info", "LaunchPrecheck", "readFile", "join", "platform", "os", "arch", "pipeline", "process", "readFile"]
}
