{"version":3,"sources":["../node_modules/tsup/assets/esm_shims.js","../src/index.ts","../src/available_space_watcher.ts","../src/async.ts","../src/number.ts","../src/string.ts","../src/units.ts","../src/options.ts","../src/object.ts","../src/platform.ts","../src/polling_watcher.ts","../src/error.ts","../src/debuglog.ts","../src/defer.ts","../src/stack_path.ts","../src/dirname.ts","../src/fs.ts","../src/hidden.ts","../src/path.ts","../src/string_enum.ts","../src/mount_point_for_path.ts","../src/volume_metadata.ts","../src/linux/dev_disk.ts","../src/linux/mount_points.ts","../src/remote_info.ts","../src/glob.ts","../src/system_volume.ts","../src/linux/mtab.ts","../src/linux/zfs_guids.ts","../src/unc.ts","../src/uuid.ts","../src/volume_health_status.ts","../src/array.ts","../src/volume_mount_points.ts","../src/volume_mount_watcher.ts"],"sourcesContent":["// Shim globals in esm bundle\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","// src/index.ts\n\nimport NodeGypBuild from \"node-gyp-build\";\nimport type {\n  AvailableSpaceChange,\n  AvailableSpaceChangeListener,\n  AvailableSpaceState,\n  AvailableSpaceStatus,\n  AvailableSpaceWatcher,\n  WatchAvailableSpaceOptions,\n} from \"./available_space_watcher\";\nimport { watchAvailableSpaceImpl } from \"./available_space_watcher\";\nimport { debug, debugLogContext, isDebugEnabled } from \"./debuglog\";\nimport { defer } from \"./defer\";\nimport { _dirname } from \"./dirname\";\nimport { findAncestorDir } from \"./fs\";\nimport type { HideMethod, SetHiddenResult } from \"./hidden\";\nimport {\n  getHiddenMetadataImpl,\n  isHiddenImpl,\n  isHiddenRecursiveImpl,\n  setHiddenImpl,\n} from \"./hidden\";\nimport { getMountPointForPathImpl } from \"./mount_point_for_path\";\nimport {\n  getTimeoutMsDefault,\n  IncludeSystemVolumesDefault,\n  LinuxMountTablePathsDefault,\n  NetworkFsTypesDefault,\n  OptionsDefault,\n  optionsWithDefaults,\n  SkipNetworkVolumesDefault,\n  SystemFsTypesDefault,\n  SystemPathPatternsDefault,\n} from \"./options\";\nimport {\n  type PollingSubscription,\n  type PollingWatcherOptions,\n  PollIntervalMsDefault,\n} from \"./polling_watcher\";\nimport type { StringEnum, StringEnumKeys, StringEnumType } from \"./string_enum\";\nimport type { SystemVolumeConfig } from \"./system_volume\";\nimport type { HiddenMetadata } from \"./types/hidden_metadata\";\nimport type { MountPoint } from \"./types/mount_point\";\nimport { NativeBindings } from \"./types/native_bindings\";\nimport type { Options, ResolvedOptions } from \"./types/options\";\nimport type { VolumeMetadata } from \"./types/volume_metadata\";\nimport type { VolumeHealthStatus } from \"./volume_health_status\";\nimport { VolumeHealthStatuses } from \"./volume_health_status\";\nimport {\n  getAllVolumeMetadataImpl,\n  getVolumeMetadataForPathImpl,\n  getVolumeMetadataImpl,\n} from \"./volume_metadata\";\nimport type { GetVolumeMountPointOptions } from \"./volume_mount_points\";\nimport { getVolumeMountPointsImpl } from \"./volume_mount_points\";\nimport type {\n  VolumeMountChange,\n  VolumeMountChangeListener,\n  VolumeMountWatcher,\n  WatchVolumeMountPointsOptions,\n} from \"./volume_mount_watcher\";\nimport { watchVolumeMountPointsImpl } from \"./volume_mount_watcher\";\n\nexport type {\n  AvailableSpaceChange,\n  AvailableSpaceChangeListener,\n  AvailableSpaceState,\n  AvailableSpaceStatus,\n  AvailableSpaceWatcher,\n  GetVolumeMountPointOptions,\n  HiddenMetadata,\n  HideMethod,\n  MountPoint,\n  Options,\n  PollingSubscription,\n  PollingWatcherOptions,\n  ResolvedOptions,\n  SetHiddenResult,\n  StringEnum,\n  StringEnumKeys,\n  StringEnumType,\n  SystemVolumeConfig,\n  VolumeHealthStatus,\n  VolumeMetadata,\n  VolumeMountChange,\n  VolumeMountChangeListener,\n  VolumeMountWatcher,\n  WatchAvailableSpaceOptions,\n  WatchVolumeMountPointsOptions,\n};\n\nconst nativeFn = defer<Promise<NativeBindings>>(async () => {\n  const start = Date.now();\n  try {\n    const dirname = _dirname();\n    const dir = await findAncestorDir(dirname, \"binding.gyp\");\n    if (dir == null) {\n      throw new Error(\n        \"Could not find bindings.gyp in any ancestor directory of \" + dirname,\n      );\n    }\n    const bindings = NodeGypBuild(dir) as NativeBindings;\n    bindings.setDebugLogging(isDebugEnabled());\n    bindings.setDebugPrefix(debugLogContext() + \":native\");\n    return bindings;\n  } catch (error) {\n    debug(\"Loading native bindings failed: %s\", error);\n    throw error;\n  } finally {\n    debug(`Native bindings took %d ms to load`, Date.now() - start);\n  }\n});\n\n/**\n * List all active local and remote mount points on the system.\n *\n * Linux file bind mounts are omitted after target probing; explicit path\n * queries still resolve and inspect them. When `skipNetworkVolumes` is true,\n * remote targets are not touched, so entries whose target type cannot be\n * determined are retained.\n *\n * Note that on Windows, `timeoutMs` will be used **per system call** and not\n * for the entire operation.\n *\n * @param opts Optional filesystem operation settings to override default values\n */\nexport function getVolumeMountPoints(\n  opts?: Partial<GetVolumeMountPointOptions>,\n): Promise<MountPoint[]> {\n  return getVolumeMountPointsImpl(optionsWithDefaults(opts), nativeFn);\n}\n\n/**\n * Watch the process-visible mount-point set for additions and removals.\n *\n * This is a polling, eventually consistent state observer rather than a\n * lossless mount-operation log. The caller controls the delay between polls\n * with `pollIntervalMs`; it defaults to {@link PollIntervalMsDefault} (one\n * minute). A new poll starts only after the prior poll has fully settled.\n * `timeoutMs` bounds each caller-visible snapshot, but cannot cancel its\n * underlying native or filesystem work; after a timeout, another poll is not\n * scheduled until that raw work settles. On Linux, newly observed local paths\n * receive a directory probe with one quarter of that snapshot budget.\n *\n * Snapshots do not fetch capacity or accessibility status. On Linux, each\n * newly observed local path (including the initial set) gets one directory\n * probe to preserve the public directory-only mount-point behavior; remote\n * paths are never probed, and raw timed-out probes must settle before another\n * poll starts. On Windows, observation follows the current logical-drive-root\n * enumeration and does not include directory-mounted volume paths. Because\n * that shallow Windows enumeration does not query filesystem types, passing a\n * custom `systemFsTypes` filter throws. Windows snapshots contain only\n * `mountPoint` and the TypeScript-derived `isSystemVolume`; fields that require\n * touching the drive, including `fstype` and `isReadOnly`, are omitted.\n *\n * Existing mount points are returned by `watcher.ready`; they are not emitted\n * as additions. A transient later polling error is available as `lastError`\n * and through an `error` listener when one is registered, while the last good\n * snapshot is retained.\n */\nexport function watchVolumeMountPoints(\n  opts: WatchVolumeMountPointsOptions = {},\n  listener?: VolumeMountChangeListener,\n): VolumeMountWatcher {\n  return watchVolumeMountPointsImpl(opts, nativeFn, listener);\n}\n\n/**\n * Watch whether the filesystem containing `pathname` has at least a requested\n * number of bytes available to the current caller.\n *\n * The initial predicate state is returned by `watcher.ready`. The listener is\n * called only when the state crosses below the minimum or recovers above the\n * minimum plus `hysteresisBytes`. Polling errors and timeouts never manufacture\n * a low-space transition, and a timed-out filesystem request must settle before\n * another poll is scheduled.\n */\nexport function watchAvailableSpace(\n  pathname: string,\n  opts: WatchAvailableSpaceOptions,\n  listener?: AvailableSpaceChangeListener,\n): AvailableSpaceWatcher {\n  return watchAvailableSpaceImpl(pathname, opts, listener);\n}\n\n/**\n * Get metadata for the volume at the given mount point.\n *\n * `timeoutMs` bounds the complete caller-visible operation on every platform.\n * It does not guarantee cancellation of a filesystem request already blocked\n * inside the operating system.\n *\n * @param mountPoint Must be a non-blank string. On Linux, this may be a file\n * that is itself a mount target.\n * @param opts Optional filesystem operation settings, including\n * {@link Options.skipNetworkVolumes} to avoid blocking on unreachable\n * network volumes\n */\nexport function getVolumeMetadata(\n  mountPoint: string,\n  opts?: Partial<\n    Pick<\n      Options,\n      | \"timeoutMs\"\n      | \"skipNetworkVolumes\"\n      | \"networkFsTypes\"\n      | \"linuxMountTablePaths\"\n      | \"includeZfsGuids\"\n    >\n  >,\n): Promise<VolumeMetadata> {\n  return getVolumeMetadataImpl(\n    { ...optionsWithDefaults(opts), mountPoint },\n    nativeFn,\n  );\n}\n\n/**\n * Get metadata for the volume that contains the given file or directory path.\n *\n * Unlike {@link getVolumeMetadata}, this accepts any path — not just mount\n * points. Symlinks are resolved, and macOS APFS firmlinks (e.g. `/Users` →\n * `/System/Volumes/Data`) are handled correctly, mirroring what `df` does.\n *\n * @param pathname Path to any file or directory\n * @param opts Optional filesystem operation settings\n */\nexport function getVolumeMetadataForPath(\n  pathname: string,\n  opts?: Partial<\n    Pick<\n      Options,\n      | \"timeoutMs\"\n      | \"linuxMountTablePaths\"\n      | \"mountPoints\"\n      | \"skipNetworkVolumes\"\n      | \"networkFsTypes\"\n      | \"includeZfsGuids\"\n    >\n  >,\n): Promise<VolumeMetadata> {\n  return getVolumeMetadataForPathImpl(\n    pathname,\n    optionsWithDefaults(opts),\n    nativeFn,\n  );\n}\n\n/**\n * Get the mount point path for an arbitrary file or directory path.\n *\n * This is a lightweight alternative to {@link getVolumeMetadataForPath} when\n * you only need the mount point string. On macOS it uses a single fstatfs()\n * call (no DiskArbitration, IOKit, or space calculations). On Linux/Windows\n * it uses device ID matching against the mount table: mount points that are\n * path ancestors of the target are preferred (deepest wins), and if none is\n * an ancestor, the longest same-device mount point is returned so that\n * bind-mounted paths still resolve to their canonical mount point. See\n * {@link Options.mountPoints} for the implications when supplying a custom\n * mount point array.\n *\n * Symlinks are resolved, and macOS APFS firmlinks (e.g. `/Users` →\n * `/System/Volumes/Data`) are handled correctly.\n *\n * @param pathname Path to any file or directory\n * @param opts Optional settings (timeoutMs, linuxMountTablePaths, mountPoints)\n * @returns The mount point path (e.g., \"/\", \"/System/Volumes/Data\", \"C:\\\\\").\n * On Linux this may be a file when the input is itself a file bind mount.\n */\nexport function getMountPointForPath(\n  pathname: string,\n  opts?: Partial<\n    Pick<\n      Options,\n      | \"timeoutMs\"\n      | \"linuxMountTablePaths\"\n      | \"mountPoints\"\n      | \"skipNetworkVolumes\"\n      | \"networkFsTypes\"\n    >\n  >,\n): Promise<string> {\n  return getMountPointForPathImpl(\n    pathname,\n    optionsWithDefaults(opts),\n    nativeFn,\n  );\n}\n\n/**\n * Retrieves metadata for all mounted volumes with optional filtering and\n * concurrency control.\n *\n * @param opts - Optional configuration object\n * @param opts.includeSystemVolumes - If true, includes system volumes in the\n * results. Defaults to true on Windows and false elsewhere.\n * @param opts.maxConcurrency - Maximum number of concurrent operations.\n * Defaults to `UV_THREADPOOL_SIZE` plus a little headroom, capped by\n * {@link https://nodejs.org/api/os.html#osavailableparallelism | os.availableParallelism()}\n * @param opts.timeoutMs - Maximum time to wait for\n * {@link getVolumeMountPointsImpl}, as well as **each** {@link getVolumeMetadataImpl}\n * to complete. Defaults to {@link getTimeoutMsDefault}\n * @returns Promise that resolves to an array of either VolumeMetadata objects\n * or error objects containing the mount point and error\n * @throws Never - errors are caught and returned as part of the result array\n */\nexport function getAllVolumeMetadata(\n  opts?: Partial<Options> & { includeSystemVolumes?: boolean },\n): Promise<VolumeMetadata[]> {\n  return getAllVolumeMetadataImpl(optionsWithDefaults(opts), nativeFn);\n}\n\n/**\n * Check if a file or directory is hidden.\n *\n * Note that `path` may be _effectively_ hidden if any of the ancestor\n * directories are hidden: use {@link isHiddenRecursive} to check for this.\n *\n * @param pathname Path to file or directory\n * @returns Promise resolving to boolean indicating hidden state\n */\nexport function isHidden(pathname: string): Promise<boolean> {\n  return isHiddenImpl(pathname, nativeFn);\n}\n\n/**\n * Check if a file or directory is hidden, or if any of its ancestor\n * directories are hidden.\n *\n * @param pathname Path to file or directory\n * @returns Promise resolving to boolean indicating hidden state\n */\nexport function isHiddenRecursive(pathname: string): Promise<boolean> {\n  return isHiddenRecursiveImpl(pathname, nativeFn);\n}\n\n/**\n * Get detailed metadata about the hidden state of a file or directory.\n *\n * @param pathname Path to file or directory\n * @returns Promise resolving to metadata about the hidden state\n */\nexport function getHiddenMetadata(pathname: string): Promise<HiddenMetadata> {\n  return getHiddenMetadataImpl(pathname, nativeFn);\n}\n\n/**\n * Set the hidden state of a file or directory\n *\n * @param pathname Path to file or directory\n * @param hidden - Whether the item should be hidden (true) or visible (false)\n * @param method Method to use for hiding the file or directory. The default\n * is \"auto\", which is \"dotPrefix\" on Linux and macOS, and \"systemFlag\" on\n * Windows. \"all\" will attempt to use all relevant methods for the current\n * operating system.\n * @returns Promise resolving the final name of the file or directory (as it\n * will change on POSIX systems), and the action(s) taken.\n * @throws {Error} If the file doesn't exist, permissions are insufficient, or\n * the requested method is unsupported\n */\nexport function setHidden(\n  pathname: string,\n  hidden: boolean,\n  method: HideMethod = \"auto\",\n): Promise<SetHiddenResult> {\n  return setHiddenImpl(pathname, hidden, method, nativeFn);\n}\n\nexport {\n  getTimeoutMsDefault,\n  IncludeSystemVolumesDefault,\n  LinuxMountTablePathsDefault,\n  NetworkFsTypesDefault,\n  OptionsDefault,\n  optionsWithDefaults,\n  PollIntervalMsDefault,\n  SkipNetworkVolumesDefault,\n  SystemFsTypesDefault,\n  SystemPathPatternsDefault,\n  VolumeHealthStatuses,\n};\n","import { statfs } from \"node:fs/promises\";\nimport { validateTimeoutMs, withTimeout } from \"./async\";\nimport { getTimeoutMsDefault } from \"./options\";\nimport {\n  type PollingSubscription,\n  type PollingWatcherOptions,\n  PollingWatcher,\n} from \"./polling_watcher\";\nimport { isNotBlank } from \"./string\";\n\nexport type AvailableSpaceState = \"aboveMinimum\" | \"belowMinimum\";\n\nexport interface AvailableSpaceStatus {\n  path: string;\n  availableBytes: number;\n  state: AvailableSpaceState;\n}\n\nexport interface AvailableSpaceChange {\n  previous: AvailableSpaceStatus;\n  current: AvailableSpaceStatus;\n}\n\nexport interface WatchAvailableSpaceOptions extends PollingWatcherOptions {\n  /** Threshold whose crossings should be reported. */\n  minimumAvailableBytes: number;\n  /** Extra available bytes required before recovering from below-minimum. */\n  hysteresisBytes?: number;\n  /**\n   * Caller-visible budget for each capacity probe; 0 disables it. Defaults to\n   * {@link getTimeoutMsDefault}.\n   */\n  timeoutMs?: number;\n}\n\nexport type AvailableSpaceChangeListener = (\n  change: AvailableSpaceChange,\n) => void;\n\nexport type AvailableSpaceWatcher = PollingSubscription<\n  AvailableSpaceStatus,\n  AvailableSpaceChange\n>;\n\ntype AvailableBytesProbe = () => Promise<number>;\ntype StatFsResult = { bavail: bigint; bsize: bigint };\ntype StatFsFn = (path: string) => Promise<StatFsResult>;\n\nconst statfsBigInt: StatFsFn = (path) => statfs(path, { bigint: true });\n\nfunction validateBytes(value: number, name: string): number {\n  if (!Number.isSafeInteger(value) || value < 0) {\n    throw new TypeError(`${name} must be a non-negative safe integer`);\n  }\n  return value;\n}\n\nexport async function getAvailableBytes(\n  path: string,\n  statfsImpl: StatFsFn = statfsBigInt,\n): Promise<number> {\n  const stats = await statfsImpl(path);\n  if (stats.bavail < 0n || stats.bsize <= 0n) {\n    throw new Error(`statfs returned invalid block counts for ${path}`);\n  }\n  const availableBytes = Number(stats.bavail * stats.bsize);\n  if (!Number.isFinite(availableBytes) || availableBytes < 0) {\n    throw new Error(`statfs returned invalid available bytes for ${path}`);\n  }\n  return availableBytes;\n}\n\nexport function createAvailableSpaceWatcher(\n  path: string,\n  options: WatchAvailableSpaceOptions,\n  probe: AvailableBytesProbe,\n  listener?: AvailableSpaceChangeListener,\n): AvailableSpaceWatcher {\n  if (!isNotBlank(path) || path.includes(\"\\0\")) {\n    throw new TypeError(\"path must be a non-blank string without null bytes\");\n  }\n  const minimumAvailableBytes = validateBytes(\n    options.minimumAvailableBytes,\n    \"minimumAvailableBytes\",\n  );\n  const hysteresisBytes = validateBytes(\n    options.hysteresisBytes ?? 0,\n    \"hysteresisBytes\",\n  );\n  if (minimumAvailableBytes + hysteresisBytes > Number.MAX_SAFE_INTEGER) {\n    throw new TypeError(\n      \"minimumAvailableBytes + hysteresisBytes must be a safe integer\",\n    );\n  }\n  const timeoutMs = validateTimeoutMs(\n    options.timeoutMs ?? getTimeoutMsDefault(),\n    \"watchAvailableSpace\",\n  );\n\n  let lastStatus: AvailableSpaceStatus | undefined;\n  const watcher = new PollingWatcher<\n    AvailableSpaceStatus,\n    AvailableSpaceChange\n  >(\n    options,\n    () => {\n      const underlying = probe();\n      const value = withTimeout({\n        desc: `watchAvailableSpace(${JSON.stringify(path)})`,\n        promise: underlying,\n        timeoutMs,\n      }).then((availableBytes) => {\n        if (\n          !Number.isFinite(availableBytes) ||\n          !Number.isInteger(availableBytes) ||\n          availableBytes < 0\n        ) {\n          throw new Error(`available-byte probe returned an invalid value`);\n        }\n        const state: AvailableSpaceState =\n          lastStatus?.state === \"belowMinimum\"\n            ? availableBytes >= minimumAvailableBytes + hysteresisBytes\n              ? \"aboveMinimum\"\n              : \"belowMinimum\"\n            : availableBytes < minimumAvailableBytes\n              ? \"belowMinimum\"\n              : \"aboveMinimum\";\n        return (lastStatus = { path, availableBytes, state });\n      });\n      return {\n        value,\n        settled: underlying.then(\n          () => undefined,\n          () => undefined,\n        ),\n      };\n    },\n    (previous, current) =>\n      previous.state === current.state\n        ? undefined\n        : { previous: { ...previous }, current: { ...current } },\n    (snapshot) => ({ ...snapshot }),\n  );\n  if (listener != null) watcher.on(\"change\", listener);\n  return watcher as AvailableSpaceWatcher;\n}\n\nexport function watchAvailableSpaceImpl(\n  path: string,\n  options: WatchAvailableSpaceOptions,\n  listener?: AvailableSpaceChangeListener,\n): AvailableSpaceWatcher {\n  return createAvailableSpaceWatcher(\n    path,\n    options,\n    () => getAvailableBytes(path),\n    listener,\n  );\n}\n","import { availableParallelism } from \"node:os\";\nimport { env } from \"node:process\";\nimport { gt0, isNumber } from \"./number\";\nimport { isBlank } from \"./string\";\nimport { DayMs } from \"./units\";\n\n/**\n * An error that is thrown when a promise does not resolve within the specified\n * time.\n */\nexport class TimeoutError extends Error {\n  constructor(message: string, captureStackTrace = true) {\n    super(message);\n    this.name = \"TimeoutError\";\n    // Capture the stack trace up to the calling site\n    if (captureStackTrace && Error.captureStackTrace) {\n      Error.captureStackTrace(this, this.constructor);\n    }\n  }\n}\n/**\n * Validate a timeoutMs value: it must be a number in [0, one day]. 0 means\n * \"no timeout\". Used by {@link withTimeout}, and directly on the Windows\n * paths that bypass withTimeout and rely on native timeouts — otherwise\n * out-of-range values would only be range-checked (not day-capped) natively.\n *\n * @returns the floored value\n * @throws {TypeError} if timeoutMs is not a number in [0, one day]\n */\nexport function validateTimeoutMs(\n  timeoutMs: number,\n  desc = \"validateTimeoutMs()\",\n): number {\n  if (!isNumber(timeoutMs)) {\n    throw new TypeError(\n      desc +\n        \": Expected timeoutMs to be numeric, but got \" +\n        JSON.stringify(timeoutMs),\n    );\n  }\n\n  // Range-check the raw value (not the floored one) so the [0, one day]\n  // bound matches the native option parsers, which compare the raw double.\n  if (timeoutMs < 0) {\n    throw new TypeError(\n      desc + \": Expected timeoutMs to be > 0, but got \" + timeoutMs,\n    );\n  }\n\n  if (timeoutMs > DayMs) {\n    throw new TypeError(\n      desc +\n        \": Invalid timeoutMs is too large: must be less than one day, but got \" +\n        timeoutMs,\n    );\n  }\n\n  return Math.floor(timeoutMs);\n}\n\n/**\n * Rejects the promise with a TimeoutError if it does not resolve within the\n * specified time.\n *\n * @param promise The promise to wrap.\n * @param timeoutMs The timeout in milliseconds. Timeouts are disabled if this is 0.\n * @returns A promise that resolves when the input promise resolves, or rejects\n * with a TimeoutError if the input promise does not resolve within the\n * specified time.\n * @throws {TimeoutError} if the input promise does not resolve within the\n * specified time.\n * @throws {TypeError} if timeoutMs is not a number that is greater than 0.\n */\nexport async function withTimeout<T>(opts: {\n  desc?: string;\n  promise: Promise<T>;\n  timeoutMs: number;\n}): Promise<T> {\n  const desc = isBlank(opts.desc) ? \"thenOrTimeout()\" : opts.desc;\n\n  const timeoutMs = validateTimeoutMs(opts.timeoutMs, desc);\n\n  if (timeoutMs === 0) {\n    return opts.promise;\n  }\n\n  // Create error here to captured the caller's stack trace. If we create it in\n  // the timeout callback, the stack trace will be truncated to this function.\n  const timeoutError = new TimeoutError(\n    `${desc}: timeout after ${timeoutMs}ms`,\n  );\n\n  if (env[\"NODE_ENV\"] === \"test\" && timeoutMs === 1) {\n    timeoutError.message += \"(timeout test)\";\n    opts.promise.catch(() => {}); // < avoid unhandled rejection warnings\n    throw timeoutError;\n  }\n\n  let timeoutId: NodeJS.Timeout | undefined;\n\n  opts.promise\n    .catch(() => {}) // < avoid unhandled rejection warnings\n    .finally(() => {\n      if (timeoutId != null) {\n        clearTimeout(timeoutId);\n        timeoutId = undefined;\n      }\n    });\n\n  const timeoutPromise = new Promise<never>((_, reject) => {\n    timeoutId = setTimeout(() => {\n      if (timeoutId != null) {\n        timeoutError.message += \"(timeout callback)\";\n        reject(timeoutError);\n      }\n      timeoutId = undefined;\n    }, timeoutMs);\n  });\n\n  return Promise.race([opts.promise, timeoutPromise]);\n}\n\n/**\n * Delay for the specified number of milliseconds.\n *\n * @param ms The number of milliseconds to delay\n * @param t Optional value to resolve with after delay\n * @returns Promise that resolves with the provided value (or void if none provided)\n */\nexport async function delay<T = void>(ms: number, t?: T): Promise<T> {\n  return new Promise<T>((resolve) => setTimeout(() => resolve(t as T), ms));\n}\n\n/**\n * Apply `fn` to every item in `items` with a maximum concurrency of\n * `maxConcurrency`.\n */\nexport async function mapConcurrent<I, O>({\n  items,\n  fn,\n  maxConcurrency = availableParallelism(),\n}: {\n  items: I[];\n  fn: (t: I) => Promise<O>;\n  maxConcurrency?: number;\n}): Promise<(O | Error)[]> {\n  // Validate maxConcurrency\n  if (!gt0(maxConcurrency)) {\n    throw new Error(\n      `maxConcurrency must be a positive integer, got: ${maxConcurrency}`,\n    );\n  }\n\n  if (typeof fn !== \"function\") {\n    throw new TypeError(`fn must be a function, got: ${typeof fn}`);\n  }\n\n  const results: Promise<O | Error>[] = [];\n  const executing: Set<Promise<void>> = new Set();\n\n  for (const [index, item] of items.entries()) {\n    // Create a wrapped promise that handles cleanup\n    while (executing.size >= maxConcurrency) {\n      await Promise.race(executing);\n    }\n    const p = (results[index] = fn(item).catch((error) => error));\n    executing.add(p);\n    p.finally(() => executing.delete(p));\n  }\n\n  return Promise.all(results);\n}\n","// src/number.ts\n\nexport function isNumber(value: unknown): value is number {\n  return typeof value === \"number\" && isFinite(value);\n}\n\nconst INTEGER_REGEX = /^-?\\d+$/;\n\nexport function toInt(value: unknown): number | undefined {\n  try {\n    if (value == null) return;\n    const s = String(value).trim();\n    return INTEGER_REGEX.test(s) ? parseInt(s) : undefined;\n  } catch {\n    return;\n  }\n}\n\nexport function gt0(value: unknown): value is number {\n  return isNumber(value) && value > 0;\n}\n","// src/string.ts\n\nexport function isString(input: unknown): input is string {\n  return typeof input === \"string\";\n}\n\nexport function toS(input: unknown): string {\n  return isString(input) ? input : input == null ? \"\" : String(input);\n}\n\n/**\n * @return true iff the input is a string and has at least one non-whitespace character\n */\nexport function isNotBlank(input: unknown): input is string {\n  return typeof input === \"string\" && input.trim().length > 0;\n}\n\n/**\n * @return true iff the input is not a string or only has non-whitespace characters\n */\nexport function isBlank(input: unknown): input is undefined {\n  return !isNotBlank(input);\n}\n\nexport function toNotBlank(input: unknown): string | undefined {\n  return isNotBlank(input) ? input : undefined;\n}\n\n/** Decode the exactly three-digit octal escapes used by fstab/mtab. */\nexport function decodeMountTableEscapes(input: string): string {\n  return input.replace(/\\\\([0-3][0-7]{2})/g, (_match, octal: string) =>\n    String.fromCharCode(parseInt(octal, 8)),\n  );\n}\n\n/** Decode the exactly two-digit hexadecimal escapes used by udev symlinks. */\nexport function decodeUdevEscapes(input: string): string {\n  return input.replace(/\\\\x([0-9a-fA-F]{2})/g, (_match, hex: string) =>\n    String.fromCharCode(parseInt(hex, 16)),\n  );\n}\n\nconst AlphaNumericRE = /[/\\w.-]/;\n\n/**\n * Encode Latin-1 code units other than `/`, word characters, `.`, and `-` as\n * three-digit octal escapes; preserve higher Unicode code units unchanged.\n */\nexport function encodeEscapeSequences(input: string): string {\n  return input\n    .split(\"\")\n    .map((char) => {\n      const code = char.charCodeAt(0);\n      return AlphaNumericRE.test(char) || code > 0xff\n        ? char\n        : \"\\\\\" + code.toString(8).padStart(3, \"0\");\n    })\n    .join(\"\");\n}\n\n/**\n * Sort an array of strings using the locale-aware collation algorithm.\n *\n * @param arr The array of strings to sort. The original array **is sorted in\n * place**.\n */\nexport function sortByLocale(\n  arr: string[],\n  locales?: Intl.LocalesArgument,\n  options?: Intl.CollatorOptions,\n): string[] {\n  return arr.sort((a, b) => a.localeCompare(b, locales, options));\n}\n\n/**\n * Sort an array of objects using the locale-aware collation algorithm.\n *\n * @param arr The array of objects to sort.\n * @param fn The function to extract the key to sort by from each object.\n * @param locales The locales to use for sorting.\n * @param options The collation options to use for sorting.\n */\nexport function sortObjectsByLocale<T>(\n  arr: T[],\n  fn: (key: T) => string,\n  locales?: Intl.LocalesArgument,\n  options?: Intl.CollatorOptions,\n): T[] {\n  return arr.sort((a, b) => fn(a).localeCompare(fn(b), locales, options));\n}\n","// src/units.ts\n\n/**\n * Milliseconds in a second\n */\nexport const SecondMs = 1000;\n\n/**\n * Milliseconds in a minute\n */\nexport const MinuteMs = 60 * SecondMs;\n\n/**\n * Milliseconds in an hour\n */\nexport const HourMs = 60 * MinuteMs;\n\n/**\n * Milliseconds in a day\n */\nexport const DayMs = 24 * HourMs;\n\n/**\n * Kibibyte (KiB) = 1024 bytes\n * @see https://en.wikipedia.org/wiki/Kibibyte\n */\nexport const KiB = 1024;\n\n/**\n * Mebibyte (MiB) = 1024 KiB\n * @see https://en.wikipedia.org/wiki/Mebibyte\n */\nexport const MiB = 1024 * KiB;\n\n/**\n * Gibibyte (GiB)= 1024 MiB\n * @see https://en.wikipedia.org/wiki/Gibibyte\n */\nexport const GiB = 1024 * MiB;\n\n/**\n * Tebibyte (TiB) = 1024 GiB\n *\n * @see https://en.wikipedia.org/wiki/Byte#Multiple-byte_units\n */\nexport const TiB = 1024 * GiB;\n\nconst f = 1023.995 / 1024;\n\nexport function fmtBytes(bytes: number): string {\n  if (bytes < 1023.5) {\n    bytes = Math.round(bytes);\n    return `${bytes} B`;\n  } else if (bytes < MiB * f) {\n    return `${(bytes / KiB).toFixed(2)} KiB`;\n  } else if (bytes < GiB * f) {\n    return `${(bytes / MiB).toFixed(2)} MiB`;\n  } else if (bytes < TiB * f) {\n    return `${(bytes / GiB).toFixed(2)} GiB`;\n  } else {\n    return `${(bytes / TiB).toFixed(2)} TiB`;\n  }\n}\n","// src/options.ts\n\nimport { availableParallelism } from \"node:os\";\nimport { env } from \"node:process\";\nimport { compactValues, isObject } from \"./object\";\nimport { isWindows } from \"./platform\";\nimport type { Options, ResolvedOptions } from \"./types/options\";\n\nconst DefaultTimeoutMs = 5_000;\n\n/**\n * Get the default timeout in milliseconds for {@link Options.timeoutMs}.\n *\n * This can be overridden by setting the `FS_METADATA_TIMEOUT_MS` environment\n * variable to a positive integer.\n *\n * Note that this timeout may be insufficient for some devices, like spun-down\n * optical drives or network shares that need to spin up or reconnect.\n *\n * @returns The timeout from env var if valid, otherwise 5000ms\n */\nexport function getTimeoutMsDefault(): number {\n  const value = env[\"FS_METADATA_TIMEOUT_MS\"];\n  if (value == null) return DefaultTimeoutMs;\n  const parsed = parseInt(value, 10);\n  return Number.isFinite(parsed) && parsed > 0 ? parsed : DefaultTimeoutMs;\n}\n\n/**\n * libuv's thread pool size when `UV_THREADPOOL_SIZE` is unset.\n *\n * @see https://docs.libuv.org/en/v1.x/threadpool.html\n */\nconst DefaultUvThreadpoolSize = 4;\n\n/**\n * Extra in-flight requests allowed beyond the libuv thread pool size. See\n * {@link getMaxConcurrencyDefault}.\n *\n * Holding exactly one request per thread lets threads idle during this\n * library's event-loop turnaround between completions. A couple of already-\n * queued requests covers that gap, and the gap is a fixed cost — it does not\n * grow with the pool — so this is additive rather than a multiplier.\n *\n * Measured on a 32-core box (4-thread pool) enumerating 57 volumes: concurrency\n * 1 took ~57ms, 2 ~37ms, 4 ~29ms, 6 ~31ms, 8 ~25ms, 16 ~22ms, 32 ~21ms. Past\n * the pool size the curve is nearly flat — single-digit milliseconds separate 6\n * from 32, and 6/7/8 are indistinguishable from noise — so the remaining\n * headroom is not worth the queue depth it costs the host application.\n */\nconst UvThreadpoolHeadroom = 3;\n\n/**\n * Get the default value for {@link Options.maxConcurrency}.\n *\n * Every filesystem call this library makes — `stat()`, `readdir()`, and the\n * native metadata workers — runs on libuv's thread pool, **not** on one thread\n * per core. That pool holds `UV_THREADPOOL_SIZE` threads (4 unless the embedder\n * raised it, regardless of core count), it is shared with the rest of the\n * process, and its queue is FIFO.\n *\n * So core count is the wrong unit for this limit: on a 128-core machine\n * `availableParallelism()` would enqueue 128 requests against those same 4\n * threads, and any unrelated read the host application issues waits behind the\n * whole backlog. Scaling with the pool instead keeps queue depth bounded no\n * matter how large the machine is.\n *\n * Set `UV_THREADPOOL_SIZE` in the environment **before Node starts** to raise\n * both the pool and this default. Assigning `process.env` at runtime happens to\n * work while the pool is still uncreated, but Node does not guarantee it\n * affects an already-created pool.\n *\n * @returns the pool-aware concurrency limit, at least 1\n * @see https://nodejs.org/api/cli.html#uv_threadpool_sizesize\n */\nexport function getMaxConcurrencyDefault(): number {\n  return Math.max(\n    1,\n    Math.min(availableParallelism(), uvThreadpoolSize() + UvThreadpoolHeadroom),\n  );\n}\n\n/**\n * libuv's hard ceiling on the thread pool.\n *\n * @see https://docs.libuv.org/en/v1.x/threadpool.html\n */\nconst MaxUvThreadpoolSize = 1024;\n\n/**\n * Longest `UV_THREADPOOL_SIZE` value libuv can actually read.\n *\n * libuv fetches the variable into a fixed 16-byte buffer, so a value needing 16\n * or more bytes (including the terminator) makes the read fail and the pool\n * stays at {@link DefaultUvThreadpoolSize} — the value is ignored entirely\n * rather than parsed.\n */\nconst MaxUvThreadpoolSizeValueBytes = 15;\n\n/**\n * The pool size libuv will actually use for the current environment.\n *\n * This deliberately mirrors libuv's own handling rather than validating the\n * value, because guessing wrong makes the concurrency limit describe a pool\n * that does not exist. libuv reads the variable into a fixed 16-byte buffer,\n * runs the result through `atoi()` — which yields `0` for empty and\n * non-numeric input — assigns it to an *unsigned* field, then clamps: `0`\n * becomes 1, and anything above the ceiling (including a negative that wrapped\n * around) becomes {@link MaxUvThreadpoolSize}.\n *\n * Verified against Node 24 by timing concurrent `pbkdf2` calls: unset yields 4\n * threads, `\"0\"` and `\"banana\"` yield 1, `\"-3\"` yields the 1024 ceiling, a\n * 15-byte `\"000000000000001\"` yields 1, and a 16-byte `\"0000000000000001\"`\n * falls back to 4 because the read itself fails.\n */\nexport function uvThreadpoolSize(): number {\n  const value = env[\"UV_THREADPOOL_SIZE\"];\n  if (value == null) return DefaultUvThreadpoolSize;\n  // Too long for libuv's buffer: it never sees the value, so neither do we.\n  if (Buffer.byteLength(value, \"utf8\") > MaxUvThreadpoolSizeValueBytes) {\n    return DefaultUvThreadpoolSize;\n  }\n  // parseInt() stops at the first non-digit like atoi(); NaN stands in for\n  // atoi()'s 0 on wholly non-numeric input.\n  const parsed = parseInt(value, 10);\n  if (!Number.isFinite(parsed) || parsed === 0) return 1;\n  // Negative values wrap through libuv's unsigned field into the ceiling.\n  return parsed < 0 || parsed > MaxUvThreadpoolSize\n    ? MaxUvThreadpoolSize\n    : parsed;\n}\n\n/**\n * System paths and globs that indicate system volumes\n */\nexport const SystemPathPatternsDefault = [\n  \"/boot\",\n  \"/boot/efi\",\n  \"/dev\",\n  \"/dev/**\",\n  \"/proc/**\",\n  \"/run\",\n  \"/run/credentials/**\",\n  \"/run/flatpak/**\",\n  \"/run/lock\",\n  \"/run/snapd/**\",\n  \"/run/user/*/doc\",\n  \"/run/user/*/gvfs\",\n  \"/snap/**\",\n  // snapd's AltSnapMountDir, used wherever /snap is absent or is a symlink to\n  // it (Fedora, openSUSE). Mount entries report the resolved path, so /snap/**\n  // does not cover these.\n  // https://github.com/canonical/snapd/blob/master/dirs/dirs.go\n  \"/var/lib/snapd/snap/**\",\n  \"/sys/**\",\n  \"/tmp\",\n  \"/var/tmp\",\n  // we aren't including /tmp/**, as some people temporarily mount volumes there, like /tmp/project.\n  \"**/#snapshot\", // Synology and Kubernetes volume snapshots\n\n  // Container runtime paths - these are internal infrastructure paths that are\n  // inaccessible to non-root processes and should never be scanned.\n  //\n  // Docker: https://docs.docker.com/engine/storage/drivers/overlayfs-driver/\n  // - /var/lib/docker contains overlay2 filesystems, container layers, images\n  // - /run/docker contains runtime data like network namespaces\n  \"/run/docker/**\",\n  \"/var/lib/docker/**\",\n  //\n  // containerd: https://github.com/containerd/containerd/blob/main/docs/ops.md\n  // - Used by Kubernetes, Docker (as backend), and standalone\n  \"/run/containerd/**\",\n  \"/var/lib/containerd/**\",\n  //\n  // Podman/CRI-O: https://podman.io/docs/installation#storage\n  // - Rootless and rootful container storage\n  \"/run/containers/**\",\n  \"/var/lib/containers/**\",\n  //\n  // Kubernetes: https://kubernetes.io/docs/reference/node/kubelet-files/\n  // - kubelet stores pod data, device plugins, and seccomp profiles\n  \"/var/lib/kubelet/**\",\n  //\n  // LXC/LXD: https://linuxcontainers.org/\n  // - Linux container storage and configuration\n  \"/var/lib/lxc/**\",\n  \"/var/lib/lxd/**\",\n\n  // WSL (Windows Subsystem for Linux):\n  \"/mnt/wslg/distro\",\n  \"/mnt/wslg/doc\",\n  \"/mnt/wslg/versions.txt\",\n  \"/usr/lib/wsl/drivers\",\n\n  // macOS system volumes are detected natively via APFS volume roles\n  // (IOKit IOMedia \"Role\" property) with MNT_SNAPSHOT as a fallback.\n  // No path patterns needed. See src/darwin/system_volume.h.\n  //\n  // /private/var/vm is the macOS swap directory (not a mount point on most\n  // systems, but included for completeness if it appears as one).\n  \"/private/var/vm\",\n] as const;\n\n/**\n * Filesystem types that indicate system/virtual volumes.\n *\n * These are pseudo-filesystems that don't represent real storage devices.\n * See /proc/filesystems for the full list supported by the running kernel.\n *\n * Entries are matched **exactly** by `isSystemVolume()` — this list is not\n * glob-compiled the way {@link SystemPathPatternsDefault} is, so every fstype\n * (including each `fuse.` subtype) must be spelled out in full.\n *\n * @see https://www.kernel.org/doc/html/latest/filesystems/ - Linux kernel filesystem docs\n * @see https://man7.org/linux/man-pages/man5/proc_filesystems.5.html - /proc/filesystems\n */\nexport const SystemFsTypesDefault = [\n  \"autofs\",\n  \"binfmt_misc\",\n  // BPF filesystem for persistent BPF objects\n  // https://docs.kernel.org/bpf/\n  \"bpf\",\n  \"cgroup\",\n  \"cgroup2\",\n  \"configfs\",\n  \"debugfs\",\n  \"devpts\",\n  \"devtmpfs\",\n  \"efivarfs\",\n  \"fusectl\",\n  // GNOME Virtual File System's FUSE bridge. All GIO backends live beneath one\n  // aggregate mount rather than appearing as separate mount-table entries, so\n  // the bridge does not represent one storage volume with one identity. Match\n  // by fstype because gvfsd-fuse mounts at $XDG_RUNTIME_DIR/gvfs and falls back\n  // to $HOME/.gvfs when $XDG_RUNTIME_DIR is unavailable (commonly for root).\n  // GVfs does not request FUSE's allow_other option, so only the owner can\n  // access the bridge. Callers can restore the aggregate entry with\n  // includeSystemVolumes: true; this does not enumerate its backends.\n  // https://wiki.gnome.org/Projects/gvfs\n  \"fuse.gvfsd-fuse\",\n  // LXC container filesystem virtualization\n  // https://linuxcontainers.org/lxcfs/\n  \"fuse.lxcfs\",\n  // XDG Desktop Portal for Flatpak sandboxed app file access\n  // https://flatpak.github.io/xdg-desktop-portal/\n  \"fuse.portal\",\n  // snapd mounts each snap with the kernel's squashfs driver, except inside a\n  // container (per `systemd-detect-virt`) that has /dev/fuse and a helper\n  // binary, where it uses FUSE instead — preferring `squashfuse` over\n  // `snapfuse`. It never probes for kernel squashfs support, so a container on\n  // a squashfs-capable kernel still gets FUSE. The fstype is `fuse.` plus\n  // whichever helper it picked, so both subtypes occur in the wild.\n  // https://github.com/canonical/snapd/blob/master/osutil/squashfs/fstype.go\n  \"fuse.snapfuse\",\n  \"fuse.squashfuse\",\n  \"hugetlbfs\",\n  \"mqueue\",\n  \"none\",\n  // Linux namespace filesystem (internal kernel use)\n  // https://man7.org/linux/man-pages/man7/namespaces.7.html\n  \"nsfs\",\n  \"proc\",\n  \"pstore\",\n  // RAM-based filesystem (predecessor to tmpfs)\n  // https://www.kernel.org/doc/html/latest/filesystems/ramfs-rootfs-initramfs.html\n  \"ramfs\",\n  \"rootfs\",\n  // NFS RPC communication pipe filesystem\n  // https://man7.org/linux/man-pages/man8/rpc.gssd.8.html\n  \"rpc_pipefs\",\n  \"securityfs\",\n  // The kernel-driver case for snap mounts; see `fuse.snapfuse` /\n  // `fuse.squashfuse` above for the FUSE fallbacks. A `\"snap*\"` entry used to\n  // sit here and never matched anything: this list is compared exactly, and no\n  // filesystem is named `snap`-anything.\n  \"squashfs\",\n  \"sysfs\",\n  \"tmpfs\",\n  // Kernel function tracing filesystem\n  // https://www.kernel.org/doc/html/latest/trace/ftrace.html\n  \"tracefs\",\n] as const;\n\nexport const LinuxMountTablePathsDefault = [\n  \"/proc/self/mounts\",\n  \"/proc/mounts\",\n  \"/etc/mtab\",\n] as const;\n\n/**\n * Network/remote filesystem types.\n *\n * These filesystems require network connectivity and may have higher latency\n * or availability concerns. Used by {@link Options.networkFsTypes}.\n *\n * Based on systemd's fstype_is_network() and common FUSE remote filesystems.\n * @see https://github.com/systemd/systemd/blob/main/src/basic/mountpoint-util.c - fstype_is_network()\n */\nexport const NetworkFsTypesDefault = [\n  // Plan 9 filesystem (VM host-guest, also network)\n  // https://www.kernel.org/doc/html/latest/filesystems/9p.html\n  \"9p\",\n  // Apple Filing Protocol (legacy macOS/netatalk)\n  \"afp\",\n  // Andrew File System (distributed) - not to be confused with Apple's APFS\n  // https://www.openafs.org/\n  \"afs\",\n  // BeeGFS parallel filesystem (HPC)\n  // https://www.beegfs.io/\n  \"beegfs\",\n  // Ceph distributed filesystem\n  // https://docs.ceph.com/\n  \"ceph\",\n  // Windows/Samba shares (SMB/CIFS)\n  // https://www.samba.org/\n  \"cifs\",\n  // FTP filesystem mount\n  \"ftp\",\n  // Generic FUSE (often remote, treated conservatively)\n  \"fuse\",\n  // rclone cloud storage mount (Google Drive, S3, etc.)\n  // https://rclone.org/commands/rclone_mount/\n  \"fuse.rclone\",\n  // Amazon S3 FUSE mount\n  // https://github.com/s3fs-fuse/s3fs-fuse\n  \"fuse.s3fs\",\n  // SSH filesystem\n  // https://github.com/libfuse/sshfs\n  \"fuse.sshfs\",\n  // Red Hat Global File System (cluster)\n  \"gfs\",\n  \"gfs2\",\n  // GlusterFS distributed filesystem\n  // https://www.gluster.org/\n  \"glusterfs\",\n  // Lustre parallel filesystem (HPC)\n  // https://www.lustre.org/\n  \"lustre\",\n  // Novell NetWare (legacy)\n  \"ncpfs\",\n  \"ncp\",\n  // Network File System\n  // https://man7.org/linux/man-pages/man5/nfs.5.html\n  \"nfs\",\n  \"nfs4\",\n  // SMB filesystem\n  \"smb\",\n  \"smbfs\",\n  // SSH filesystem (non-FUSE variant)\n  \"sshfs\",\n  // WebDAV filesystem\n  // https://savannah.nongnu.org/projects/davfs2\n  \"webdav\",\n] as const;\n\n/**\n * Should {@link getAllVolumeMetadata} include system volumes by\n * default?\n */\nexport const IncludeSystemVolumesDefault = isWindows;\n\n/**\n * Default value for {@link Options.skipNetworkVolumes}.\n */\nexport const SkipNetworkVolumesDefault = false;\n\n/**\n * Default value for {@link Options.includeZfsGuids}. The authoritative ZFS\n * GUID path uses external commands, so it is deliberately opt-in.\n */\nexport const IncludeZfsGuidsDefault = false;\n\n/**\n * Default {@link Options} object.\n *\n * @see {@link optionsWithDefaults} for creating an options object with default values\n */\nexport const OptionsDefault: ResolvedOptions = {\n  timeoutMs: getTimeoutMsDefault(),\n  maxConcurrency: getMaxConcurrencyDefault(),\n  systemPathPatterns: [...SystemPathPatternsDefault],\n  systemFsTypes: [...SystemFsTypesDefault],\n  linuxMountTablePaths: [...LinuxMountTablePathsDefault],\n  networkFsTypes: [...NetworkFsTypesDefault],\n  includeSystemVolumes: IncludeSystemVolumesDefault,\n  skipNetworkVolumes: SkipNetworkVolumesDefault,\n  includeZfsGuids: IncludeZfsGuidsDefault,\n} as const;\n\n/**\n * Create an {@link Options} object using default values from\n * {@link OptionsDefault} for missing fields.\n */\nexport function optionsWithDefaults<T extends Options>(\n  overrides: Partial<T> = {},\n): T & ResolvedOptions {\n  if (!isObject(overrides)) {\n    throw new TypeError(\n      \"options(): expected an object, got \" +\n        typeof overrides +\n        \": \" +\n        JSON.stringify(overrides),\n    );\n  }\n\n  return {\n    ...OptionsDefault,\n    ...(compactValues(overrides) as T),\n  } as T & ResolvedOptions;\n}\n","// src/object.js\n\nimport { isNotBlank, isString } from \"./string\";\n\n/**\n * @return true iff value is an object and not an array\n */\nexport function isObject(value: unknown): value is object {\n  // typeof null is 'object', so we need to check for that case YAY JAVASCRIPT\n  return value != null && typeof value === \"object\" && !Array.isArray(value);\n}\n\n/**\n * @return undefined if `obj` is nullish, or the return value of `fn` applied\n * against `obj` if `obj` is defined\n */\nexport function map<T, U>(\n  obj: T | undefined,\n  fn: (value: T) => U,\n): U | undefined {\n  return obj == null ? undefined : fn(obj);\n}\n\n/**\n * @return a shallow copy of `obj` that omits the specified `keys`\n */\nexport function omit<T extends object, K extends keyof T>(\n  obj: T,\n  ...keys: K[]\n): Omit<T, K> {\n  const result = {} as Omit<T, K>;\n  const keysSet = new Set(keys);\n\n  // OH THE TYPING HUGEMANATEE\n  for (const key of Object.keys(obj) as Array<keyof Omit<T, K>>) {\n    if (!keysSet.has(key as unknown as K)) {\n      result[key] = obj[key];\n    }\n  }\n\n  return result;\n}\n\n/**\n * @return a shallow copy of `obj` that only includes fields that are defined\n * and not nullish or blank.\n */\nexport function compactValues<T extends object>(\n  obj: T | undefined,\n): Partial<T> {\n  const result = {} as Partial<T>;\n  if (obj == null || !isObject(obj)) return {};\n  for (const [key, value] of Object.entries(obj)) {\n    // skip blank strings and nullish values:\n    if (value != null && (!isString(value) || isNotBlank(value))) {\n      result[key as keyof T] = value as T[keyof T];\n    }\n  }\n  return result;\n}\n","// src/platform.ts\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { arch, platform } from \"node:process\";\n\nexport const isLinux = platform === \"linux\";\nexport const isWindows = platform === \"win32\";\nexport const isMacOS = platform === \"darwin\";\n\nexport const isArm = isLinux && arch.startsWith(\"arm\");\nexport const isARM64 = arch === \"arm64\";\n\n/**\n * Detects if we're running on Alpine Linux by checking /etc/os-release\n */\nexport function isAlpine(): boolean {\n  if (!isLinux) return false;\n\n  try {\n    const osRelease = readFileSync(\"/etc/os-release\", \"utf8\");\n    return (\n      osRelease.includes(\"Alpine Linux\") || osRelease.includes(\"ID=alpine\")\n    );\n  } catch {\n    return existsSync(\"/etc/alpine-release\");\n  }\n}\n\n/**\n * Detects if we're likely running under emulation (as of 202506 there aren't free GHA ARM64 runners)\n */\nexport function isEmulated(): boolean {\n  return isLinux && isARM64;\n}\n","import { EventEmitter } from \"node:events\";\nimport { toError } from \"./error\";\nimport { isNumber } from \"./number\";\nimport { MinuteMs } from \"./units\";\n\n/** Default delay between subscription polls: one minute. */\nexport const PollIntervalMsDefault = MinuteMs;\n\n/** Largest delay Node can represent without replacing it with a 1ms timer. */\nconst MaxTimerDelayMs = 2_147_483_647;\n\nexport interface PollingWatcherOptions {\n  /** Milliseconds between one completed poll and the start of the next. */\n  pollIntervalMs?: number;\n  /** Whether the pending poll timer keeps the Node.js event loop alive. */\n  persistent?: boolean;\n  /** Closes the watcher when aborted. */\n  signal?: AbortSignal;\n}\n\n/** Public lifecycle and events shared by polling subscriptions. */\nexport interface PollingSubscription<TSnapshot, TChange> {\n  readonly ready: Promise<TSnapshot>;\n  readonly lastError: Error | undefined;\n  readonly closed: boolean;\n  close(): void;\n  ref(): this;\n  unref(): this;\n  hasRef(): boolean;\n  on(event: \"change\", listener: (change: TChange) => void): this;\n  on(event: \"error\", listener: (error: Error) => void): this;\n  once(event: \"change\", listener: (change: TChange) => void): this;\n  once(event: \"error\", listener: (error: Error) => void): this;\n  off(event: \"change\", listener: (change: TChange) => void): this;\n  off(event: \"error\", listener: (error: Error) => void): this;\n}\n\nexport interface PollObservation<T> {\n  /** Caller-visible observation, which may have a timeout wrapper. */\n  value: Promise<T>;\n  /** Underlying work. No new poll is scheduled until this settles. */\n  settled: Promise<unknown>;\n}\n\nexport type PollSource<T> = () => PollObservation<T>;\n\nexport function validatePollIntervalMs(value: number | undefined): number {\n  const pollIntervalMs = value ?? PollIntervalMsDefault;\n  if (\n    !isNumber(pollIntervalMs) ||\n    !Number.isInteger(pollIntervalMs) ||\n    pollIntervalMs <= 0 ||\n    pollIntervalMs > MaxTimerDelayMs\n  ) {\n    throw new TypeError(\n      `pollIntervalMs must be a positive integer no greater than ${MaxTimerDelayMs}, got: ${String(pollIntervalMs)}`,\n    );\n  }\n  return pollIntervalMs;\n}\n\n/**\n * Shared lifecycle for self-scheduling, non-overlapping polling subscriptions.\n * Subclasses are unnecessary: callers provide the observation and diff logic.\n */\nexport class PollingWatcher<TSnapshot, TChange> extends EventEmitter {\n  readonly ready: Promise<TSnapshot>;\n  lastError: Error | undefined;\n\n  private readonly pollIntervalMs: number;\n  private readonly observe: PollSource<TSnapshot>;\n  private readonly reconcile: (\n    previous: TSnapshot,\n    current: TSnapshot,\n  ) => TChange | undefined;\n  private readonly cloneSnapshot: (snapshot: TSnapshot) => TSnapshot;\n  private readonly signal: AbortSignal | undefined;\n  private readonly abortListener: () => void;\n  private readonly closedPromise: Promise<void>;\n  private readonly resolveClosed: () => void;\n  private timer: NodeJS.Timeout | undefined;\n  private current: TSnapshot | undefined;\n  private persistent: boolean;\n  private isClosed = false;\n\n  constructor(\n    options: PollingWatcherOptions,\n    observe: PollSource<TSnapshot>,\n    reconcile: (previous: TSnapshot, current: TSnapshot) => TChange | undefined,\n    cloneSnapshot: (snapshot: TSnapshot) => TSnapshot = (snapshot) => snapshot,\n  ) {\n    super();\n    this.pollIntervalMs = validatePollIntervalMs(options.pollIntervalMs);\n    this.persistent = options.persistent ?? true;\n    this.observe = observe;\n    this.reconcile = reconcile;\n    this.cloneSnapshot = cloneSnapshot;\n    this.signal = options.signal;\n    this.abortListener = () => this.close();\n    let resolveClosed!: () => void;\n    this.closedPromise = new Promise((resolve) => {\n      resolveClosed = resolve;\n    });\n    this.resolveClosed = resolveClosed;\n    this.signal?.throwIfAborted();\n    this.signal?.addEventListener(\"abort\", this.abortListener, { once: true });\n\n    this.ready = this.initialize();\n    // The caller can still await the original rejecting promise. This attached\n    // handler only prevents an ignored `ready` from becoming an unhandled\n    // rejection in callback-only usage.\n    void this.ready.catch(() => {});\n  }\n\n  get closed(): boolean {\n    return this.isClosed;\n  }\n\n  close(): void {\n    if (this.isClosed) return;\n    this.isClosed = true;\n    if (this.timer != null) {\n      clearTimeout(this.timer);\n      this.timer = undefined;\n    }\n    this.signal?.removeEventListener(\"abort\", this.abortListener);\n    this.resolveClosed();\n  }\n\n  ref(): this {\n    this.persistent = true;\n    this.timer?.ref();\n    return this;\n  }\n\n  unref(): this {\n    this.persistent = false;\n    this.timer?.unref();\n    return this;\n  }\n\n  hasRef(): boolean {\n    return this.persistent;\n  }\n\n  private async initialize(): Promise<TSnapshot> {\n    let observation: PollObservation<TSnapshot>;\n    try {\n      observation = this.observe();\n      // `close()` settles ready immediately, but cannot cancel filesystem\n      // work already submitted to libuv/native code. Always observe that raw\n      // promise so a later rejection cannot become unhandled.\n      const settled = observation.settled.catch(() => {});\n      const result = await Promise.race([\n        observation.value.then((value) => ({ closed: false as const, value })),\n        this.closedPromise.then(() => ({ closed: true as const })),\n      ]);\n      if (result.closed || this.isClosed) {\n        throw this.closedBeforeReadyError();\n      }\n      const observed = result.value;\n      this.current = this.cloneSnapshot(observed);\n      // `ready` describes the caller-visible baseline and can resolve before a\n      // timed-out raw request finishes. The recurring loop still waits for the\n      // raw work so it never overlaps even the initial observation.\n      void settled.then(() => this.schedule());\n      return this.cloneSnapshot(observed);\n    } catch (error) {\n      this.lastError = toError(error);\n      this.close();\n      throw this.lastError;\n    }\n  }\n\n  private schedule(): void {\n    if (this.isClosed) return;\n    this.timer = setTimeout(() => {\n      this.timer = undefined;\n      void this.poll();\n    }, this.pollIntervalMs);\n    if (!this.persistent) this.timer.unref();\n  }\n\n  private async poll(): Promise<void> {\n    if (this.isClosed || this.current == null) return;\n\n    let change: TChange | undefined;\n    let error: Error | undefined;\n    let settled: Promise<unknown> = Promise.resolve();\n    try {\n      const observation = this.observe();\n      settled = observation.settled;\n      const observed = await observation.value;\n      if (!this.isClosed) {\n        const previous = this.current;\n        const next = this.cloneSnapshot(observed);\n        change = this.reconcile(previous, next);\n        this.current = next;\n        this.lastError = undefined;\n      }\n    } catch (cause) {\n      error = this.lastError = toError(cause);\n    }\n\n    try {\n      if (!this.isClosed && change != null) {\n        this.emit(\"change\", change);\n      } else if (\n        !this.isClosed &&\n        error != null &&\n        this.listenerCount(\"error\") > 0\n      ) {\n        // A transient polling failure is non-fatal and the prior snapshot is\n        // retained. Avoid EventEmitter's process-throwing unhandled `error`\n        // behavior when the caller does not need these diagnostics.\n        this.emit(\"error\", error);\n      }\n    } finally {\n      // A caller-visible timeout does not cancel the underlying filesystem\n      // request. Waiting here prevents one wedged resource from accumulating a\n      // new libuv/native request on every interval.\n      await settled.catch(() => {});\n      this.schedule();\n    }\n  }\n\n  private closedBeforeReadyError(): Error {\n    if (this.signal?.aborted && this.signal.reason instanceof Error) {\n      return this.signal.reason;\n    }\n    const error = new Error(\"Polling watcher closed before it was ready\");\n    error.name = \"AbortError\";\n    return error;\n  }\n}\n\nexport function resolvedObservation<T>(value: Promise<T>): PollObservation<T> {\n  return { value, settled: value };\n}\n","// src/error.ts\n\nimport { isNumber } from \"./number\";\nimport { compactValues, map, omit } from \"./object\";\nimport { isBlank, isNotBlank } from \"./string\";\n\nfunction toMessage(context: string, cause: unknown): string {\n  const causeStr =\n    cause instanceof Error\n      ? cause.message\n      : typeof cause === \"string\"\n        ? cause\n        : cause\n          ? JSON.stringify(cause)\n          : \"\";\n  return context + (isBlank(causeStr) ? \"\" : \": \" + causeStr);\n}\n\nexport class WrappedError extends Error {\n  errno?: number;\n  code?: string;\n  syscall?: string;\n  path?: string;\n  constructor(\n    context: string,\n    options?: {\n      name?: string;\n      cause?: unknown;\n      errno?: number;\n      code?: string;\n      syscall?: string;\n      path?: string;\n    },\n  ) {\n    super(toMessage(context, options?.cause));\n\n    const cause = map(options?.cause, toError);\n    const opts = { ...compactValues(cause), ...compactValues(options) };\n\n    if (isNotBlank(options?.name)) {\n      this.name = options.name;\n    }\n\n    if (cause != null) {\n      this.cause = cause;\n      if (cause instanceof Error) {\n        this.stack = `${this.stack}\\nCaused by: ${cause.stack}`;\n      }\n    }\n\n    if (isNumber(opts.errno)) {\n      this.errno = opts.errno;\n    }\n    if (isNotBlank(opts.code)) {\n      this.code = opts.code;\n    }\n    if (isNotBlank(opts.syscall)) {\n      this.syscall = opts.syscall;\n    }\n    if (isNotBlank(options?.path)) {\n      this.path = options.path;\n    }\n  }\n\n  get details(): Record<string, unknown> {\n    return compactValues(omit(this, \"name\", \"message\", \"cause\"));\n  }\n\n  override toString(): string {\n    const details = this.details;\n    const detailsStr =\n      Object.keys(details).length === 0 ? \"\" : \" \" + JSON.stringify(details);\n    return `${super.toString()}${detailsStr}`;\n  }\n}\n\nexport function toError(cause: unknown): Error {\n  return cause instanceof Error ? cause : new Error(String(cause));\n}\n","import { debuglog, format } from \"node:util\";\n\n// inlined as a hack to get around relative imports broken in ts-node (used by\n// the debuglog tests):\nfunction defer<T>(thunk: () => T) {\n  let t: T;\n  return () => (t ??= thunk());\n}\n\nexport const debugLogContext = defer(() => {\n  for (const ea of [\"fs-metadata\", \"fs-meta\"]) {\n    if (debuglog(ea).enabled) {\n      return ea;\n    }\n    if (debuglog(ea.toUpperCase()).enabled) {\n      return ea;\n    }\n  }\n  return \"photostructure:fs-metadata\";\n});\n\nexport const isDebugEnabled = defer(() => {\n  return debuglog(debugLogContext()).enabled ?? false;\n});\n\nexport function debug(msg: string, ...args: unknown[]) {\n  if (!isDebugEnabled()) return;\n  const now = new Date();\n\n  // Format: [HH:MM:SS.mmm] prefix: message\n  const timestamp = `[${now.getHours().toString().padStart(2, \"0\")}:${now.getMinutes().toString().padStart(2, \"0\")}:${now.getSeconds().toString().padStart(2, \"0\")}.${now.getMilliseconds().toString().padStart(3, \"0\")}] ${debugLogContext()} `;\n\n  process.stderr.write(timestamp + format(msg, ...args) + \"\\n\");\n}\n","// src/defer.ts\n\nexport type Defer<T> = (() => T) & {\n  reset: () => void;\n};\n\n/**\n * Creates a deferred value that is computed once on first access and cached for\n * subsequent accesses.\n * @param thunk A function that takes no arguments and returns a value\n * @returns A function that returns the computed value\n */\nexport function defer<T>(thunk: () => T): Defer<T> {\n  let computed = false;\n  let value: T;\n\n  const fn = () => {\n    if (!computed) {\n      computed = true;\n      value = thunk();\n    }\n    return value;\n  };\n\n  fn.reset = () => {\n    computed = false;\n  };\n\n  return fn;\n}\n","import { dirname } from \"node:path\";\nimport { isWindows } from \"./platform\";\nimport { isNotBlank, toS } from \"./string\";\n\nexport function getCallerDirname(): string {\n  const e = new Error();\n  if (e.stack == null) {\n    Error.captureStackTrace(e);\n  }\n  return dirname(extractCallerPath(e.stack as string));\n}\n\n// CURSE THE ESM MODULE SYSTEM 💩 THIS IS ALL HORRIBLE\n\n// THANK GOODNESS for tsup shims: this should only be used when running tests.\n\n// Comprehensive regex patterns for different stack frame formats. Note that we\n// only expect tests to have the first standard form, but if something's worth\n// doing, **it's worth overdoing**.\nconst patterns = isWindows\n  ? [\n      // Standard: \"at functionName (C:\\path\\file.js:1:1)\"\n      /\\bat\\s[^(]*\\((?<path>[A-Z]:\\\\.+?):\\d+:\\d+\\)$/,\n      // direct: \"at C:\\path\\file.js:1:1\"\n      /\\bat\\s(?<path>[A-Z]:\\\\.+?):\\d+:\\d+$/,\n      // UNC: \"at functionName (\\\\server\\share\\path\\file.js:1:1)\"\n      /\\bat\\s[^(]*\\((?<path>\\\\\\\\.+?):\\d+:\\d+\\)$/,\n      // direct: \"at \\\\server\\share\\path\\file.js:1:1\"\n      /\\bat\\s(?<path>\\\\\\\\.+?):\\d+:\\d+$/,\n    ]\n  : [\n      // Standard: \"at functionName (/path/file.js:1:1)\"\n      /\\bat\\s[^(]*\\((?<path>\\/.*?):\\d+:\\d+\\)$/,\n      // Anonymous or direct: \"at /path/file.js:1:1\"\n      // eslint-disable-next-line security/detect-unsafe-regex -- parsing trusted Node.js stack traces, bounded by line anchors\n      /\\bat\\s(?:[^/\\s]+\\s+)?(?<path>\\/.*?):\\d+:\\d+$/,\n    ];\n\nconst MaybeUrlRE = /^[a-z]{2,5}:\\/\\//i;\n\n// only exposed for tests:\nexport function extractCallerPath(stack: string): string {\n  const frames = stack.split(\"\\n\").filter(Boolean);\n\n  // First find getCallerDirname() in the stack:\n  const callerFrame = frames.findIndex((frame) =>\n    frame.includes(\"getCallerDirname\"),\n  );\n  if (callerFrame === -1) {\n    throw new Error(\"Invalid stack trace format: missing caller frame\");\n  }\n  for (let i = callerFrame + 1; i < frames.length; i++) {\n    const frame = frames[i];\n    for (const pattern of patterns) {\n      const g = toS(frame).trim().match(pattern)?.groups;\n      if (g != null && isNotBlank(g[\"path\"])) {\n        const path = g[\"path\"];\n        // Windows requires us to check if it's a reasonable URL, as URL accepts\n        // \"C:\\\\path\\\\file.txt\" as valid (!!)\n        if (MaybeUrlRE.test(path)) {\n          try {\n            return new URL(path).pathname;\n          } catch {\n            // ignore\n          }\n        }\n        return path;\n      }\n    }\n  }\n  throw new Error(\"Invalid stack trace format: no parsable frames\");\n}\n","import { getCallerDirname } from \"./stack_path\";\n\n// Thanks to tsup shims, __dirname should always be defined except when run by\n// jest (which will use the stack_path shim)\nexport function _dirname() {\n  try {\n    if (typeof __dirname !== \"undefined\") return __dirname;\n  } catch {\n    // ignore\n  }\n  // we must be in jest. Use the stack_path ~~hack~~ shim:\n  return getCallerDirname();\n}\n","// src/fs.ts\n\nimport { type PathLike, type StatOptions, Stats, statSync } from \"node:fs\";\nimport { opendir, stat } from \"node:fs/promises\";\nimport { join, resolve } from \"node:path\";\nimport { withTimeout } from \"./async\";\n\n/**\n * Wrapping node:fs/promises.stat() so we can mock it in tests.\n */\nexport async function statAsync(\n  path: PathLike,\n  // `throwIfNoEntry?: true` selects the overload that resolves to\n  // Promise<Stats> rather than Promise<Stats | undefined>; this wrapper always\n  // throws (rather than returning undefined) when the path doesn't exist.\n  options?: StatOptions & { bigint?: false; throwIfNoEntry?: true },\n): Promise<Stats> {\n  return stat(path, options);\n}\n\nexport async function canStatAsync(path: string): Promise<boolean> {\n  try {\n    return null != (await statAsync(path));\n  } catch {\n    return false;\n  }\n}\n\n/**\n * @return true if `path` exists and is a directory\n */\nexport async function isDirectory(path: string): Promise<boolean> {\n  try {\n    return (await statAsync(path))?.isDirectory() === true;\n  } catch {\n    return false;\n  }\n}\n\n/**\n * @return the first directory containing `file` or an empty string\n */\nexport async function findAncestorDir(\n  dir: string,\n  file: string,\n): Promise<string | undefined> {\n  dir = resolve(dir);\n  try {\n    const s = await statAsync(join(dir, file));\n    if (s.isFile()) return dir;\n  } catch {\n    // fall through\n  }\n  const parent = resolve(dir, \"..\");\n  return parent === dir ? undefined : findAncestorDir(parent, file);\n}\n\nexport function existsSync(path: string): boolean {\n  return statSync(path, { throwIfNoEntry: false }) != null;\n}\n\n/**\n * @return `true` if `dir` exists and is a directory and at least one entry can be read.\n * @throws {Error} if `dir` does not exist or is not a directory or cannot be read.\n */\nexport async function canReaddir(\n  dir: string,\n  timeoutMs: number,\n): Promise<true> {\n  return canReaddirObservation(dir, timeoutMs).value;\n}\n\n/** A directory probe and the underlying filesystem work it time-bounds. */\nexport function canReaddirObservation(\n  dir: string,\n  timeoutMs: number,\n): { value: Promise<true>; settled: Promise<true> } {\n  const settled = _canReaddir(dir);\n  const value = withTimeout({\n    desc: \"canReaddir()\",\n    promise: settled,\n    timeoutMs,\n  });\n  return { value, settled };\n}\n\nasync function _canReaddir(dir: string): Promise<true> {\n  await (await opendir(dir)).close();\n  return true;\n}\n","// src/hidden.ts\n\nimport { rename } from \"node:fs/promises\";\nimport { basename, dirname, join } from \"node:path\";\nimport { debug } from \"./debuglog\";\nimport { WrappedError } from \"./error\";\nimport { statAsync } from \"./fs\";\nimport { isRootDirectory, normalizePath } from \"./path\";\nimport { isWindows } from \"./platform\";\nimport { stringEnum, type StringEnumKeys } from \"./string_enum\";\nimport type { HiddenMetadata } from \"./types/hidden_metadata\";\nimport type { NativeBindingsFn } from \"./types/native_bindings\";\n\nconst HiddenSupportByPlatform: Partial<\n  Record<NodeJS.Platform, Pick<HiddenMetadata, \"supported\">>\n> = {\n  win32: {\n    supported: {\n      dotPrefix: false,\n      systemFlag: true,\n    },\n  },\n  darwin: {\n    supported: {\n      dotPrefix: true,\n      systemFlag: true,\n    },\n  },\n  linux: {\n    supported: {\n      dotPrefix: true,\n      systemFlag: false,\n    },\n  },\n};\n\nexport const LocalSupport = HiddenSupportByPlatform[process.platform]\n  ?.supported ?? {\n  dotPrefix: false,\n  systemFlag: false,\n};\n\n/**\n * Checks if the file or directory is hidden through any available method\n * @returns A boolean indicating if the item is hidden. A non-existent path\n * resolves to `false` rather than throwing.\n * @throws {Error} If the pathname is invalid or permissions are insufficient\n */\nexport async function isHiddenImpl(\n  pathname: string,\n  nativeFn: NativeBindingsFn,\n): Promise<boolean> {\n  debug(\"isHiddenImpl called with pathname: %s\", pathname);\n  const norm = normalizePath(pathname);\n  if (norm == null) {\n    throw new Error(\"Invalid pathname: \" + JSON.stringify(pathname));\n  }\n  debug(\"Normalized path: %s\", norm);\n\n  // Root directories are never meaningfully \"hidden\" on any platform.\n  // Windows sets FILE_ATTRIBUTE_HIDDEN + FILE_ATTRIBUTE_SYSTEM on root drives\n  // (e.g. C:\\) as a protective measure, not user intent to hide the directory.\n  // Recovery partitions are hidden at the volume level via diskpart attributes\n  // (NODEFAULTDRIVELETTER / GPT type GUIDs), not file attributes, so any root\n  // directory reachable by path is safe to treat as non-hidden.\n  // See https://learn.microsoft.com/en-us/answers/questions/427448/how-to-properly-hide-a-recovery-partition\n  // and https://en.wikipedia.org/wiki/File_attribute\n  if (isRootDirectory(norm)) {\n    debug(\"Root directory, returning false\");\n    return false;\n  }\n\n  if (LocalSupport.dotPrefix && !(await pathExists(norm))) {\n    debug(\"Path does not exist, returning false\");\n    return false;\n  }\n\n  debug(\n    \"LocalSupport: dotPrefix=%s, systemFlag=%s\",\n    LocalSupport.dotPrefix,\n    LocalSupport.systemFlag,\n  );\n\n  const result =\n    (LocalSupport.dotPrefix && isPosixHidden(norm)) ||\n    (LocalSupport.systemFlag && (await isSystemHidden(norm, nativeFn)));\n\n  debug(\"isHiddenImpl returning: %s\", result);\n  return result;\n}\n\nexport async function isHiddenRecursiveImpl(\n  path: string,\n  nativeFn: NativeBindingsFn,\n): Promise<boolean> {\n  let norm = normalizePath(path);\n  if (norm == null) {\n    throw new Error(\"Invalid path: \" + JSON.stringify(path));\n  }\n  while (!isRootDirectory(norm)) {\n    if (await isHiddenImpl(norm, nativeFn)) {\n      return true;\n    }\n    norm = dirname(norm);\n  }\n  return false;\n}\n\nexport function createHiddenPosixPath(pathname: string, hidden: boolean) {\n  const norm = normalizePath(pathname);\n  if (norm == null) {\n    throw new Error(\"Invalid pathname: \" + JSON.stringify(pathname));\n  }\n  const dir = dirname(norm);\n  const srcBase = basename(norm).replace(/^\\./, \"\");\n  const dest = join(dir, (hidden ? \".\" : \"\") + srcBase);\n  return dest;\n}\n\nasync function setHiddenPosix(\n  pathname: string,\n  hidden: boolean,\n): Promise<string> {\n  if (LocalSupport.dotPrefix) {\n    const dest = createHiddenPosixPath(pathname, hidden);\n    if (pathname !== dest) await rename(pathname, dest);\n    return dest;\n  }\n\n  throw new Error(\"Unsupported platform\");\n}\n\nfunction isPosixHidden(pathname: string): boolean {\n  if (!LocalSupport.dotPrefix) return false;\n  const b = basename(pathname);\n  return b.startsWith(\".\") && b !== \".\" && b !== \"..\";\n}\n\nasync function pathExists(pathname: string): Promise<boolean> {\n  try {\n    await statAsync(pathname);\n    return true;\n  } catch (error) {\n    const code = (error as NodeJS.ErrnoException).code;\n    if (code === \"ENOENT\" || code === \"ENOTDIR\") return false;\n    throw error;\n  }\n}\n\nasync function isSystemHidden(\n  pathname: string,\n  nativeFn: NativeBindingsFn,\n): Promise<boolean> {\n  debug(\"isSystemHidden called with pathname: %s\", pathname);\n  if (!LocalSupport.systemFlag) {\n    debug(\"systemFlag not supported on this platform\");\n    // not supported on this platform\n    return false;\n  }\n\n  // Let the native function handle all validation, including root directories\n  // This ensures security checks are performed before any other checks\n  const native = await nativeFn();\n  debug(\"Calling native isHidden for: %s\", pathname);\n\n  try {\n    const isHidden = await native.isHidden(pathname);\n    debug(\"Native isHidden returned: %s\", isHidden);\n    return isHidden;\n  } catch (error) {\n    debug(\"Native isHidden threw error: %s\", error);\n    // Handle non-existent paths by returning false (consistent with Windows behavior)\n    const errorStr = String(error);\n    if (errorStr.includes(\"Path not found\")) {\n      debug(\"Path not found, returning false\");\n      return false;\n    }\n    throw error;\n  }\n}\n\n/**\n * Gets detailed information about the hidden state of the file or directory\n * @returns An object containing detailed hidden state information. A\n * non-existent path resolves to a non-hidden result rather than throwing.\n * @throws {Error} If the pathname is invalid or permissions are insufficient\n */\nexport async function getHiddenMetadataImpl(\n  pathname: string,\n  nativeFn: NativeBindingsFn,\n): Promise<HiddenMetadata> {\n  const norm = normalizePath(pathname);\n  if (norm == null) {\n    throw new Error(\"Invalid pathname: \" + JSON.stringify(pathname));\n  }\n  // Root directories are never meaningfully \"hidden\" on any platform\n  // (see comment in isHiddenImpl for details).\n  if (isRootDirectory(norm)) {\n    return {\n      hidden: false,\n      dotPrefix: false,\n      systemFlag: false,\n      supported: LocalSupport,\n    };\n  }\n\n  // Windows must reach the native implementation before deciding a missing\n  // path is not hidden: native validation rejects device namespaces, reserved\n  // names, and alternate data streams before checking existence.\n  const exists = !LocalSupport.dotPrefix || (await pathExists(norm));\n  const dotPrefix = exists && isPosixHidden(norm);\n  const systemFlag = exists && (await isSystemHidden(norm, nativeFn));\n  return {\n    hidden: dotPrefix || systemFlag,\n    dotPrefix,\n    systemFlag,\n    supported: LocalSupport,\n  };\n}\n\nconst HideMethods = stringEnum(\"dotPrefix\", \"systemFlag\", \"all\", \"auto\");\n\nexport type HideMethod = StringEnumKeys<typeof HideMethods>;\n\nexport type SetHiddenResult = {\n  pathname: string;\n  actions: {\n    dotPrefix: boolean;\n    systemFlag: boolean;\n  };\n};\n\nexport async function setHiddenImpl(\n  pathname: string,\n  hide: boolean,\n  method: HideMethod,\n  nativeFn: NativeBindingsFn,\n): Promise<SetHiddenResult> {\n  if (HideMethods.get(method) == null) {\n    throw new TypeError(\"Invalid hide method: \" + JSON.stringify(method));\n  }\n\n  let norm = normalizePath(pathname);\n  if (norm == null) {\n    throw new Error(\"Invalid pathname: \" + JSON.stringify(pathname));\n  }\n\n  if (method === \"dotPrefix\" && !LocalSupport.dotPrefix) {\n    throw new Error(\"Dot prefix hiding is not supported on this platform\");\n  }\n\n  if (method === \"systemFlag\" && !LocalSupport.systemFlag) {\n    throw new Error(\"System flag hiding is not supported on this platform\");\n  }\n\n  try {\n    await statAsync(norm);\n  } catch (cause) {\n    throw new WrappedError(\"setHidden()\", { cause });\n  }\n\n  if (isWindows && isRootDirectory(norm)) {\n    throw new Error(\"Cannot hide root directory on Windows\");\n  }\n\n  const actions = {\n    dotPrefix: false,\n    systemFlag: false,\n  };\n\n  let acted = false;\n\n  if (LocalSupport.dotPrefix && [\"auto\", \"all\", \"dotPrefix\"].includes(method)) {\n    if (isPosixHidden(norm) !== hide) {\n      norm = await setHiddenPosix(norm, hide);\n      actions.dotPrefix = true;\n    }\n    acted = true;\n  }\n\n  if (\n    LocalSupport.systemFlag &&\n    ([\"all\", \"systemFlag\"].includes(method) || (!acted && method === \"auto\"))\n  ) {\n    await (await nativeFn()).setHidden(norm, hide);\n    actions.systemFlag = true;\n  }\n\n  return { pathname: norm, actions };\n}\n","// src/path.ts\n\nimport { dirname, resolve, sep } from \"node:path\";\nimport { isWindows } from \"./platform\";\nimport { isBlank } from \"./string\";\n\nexport function normalizePath(\n  mountPoint: string | undefined,\n): string | undefined {\n  if (isBlank(mountPoint)) return undefined;\n\n  // Security check: reject paths with directory traversal patterns BEFORE resolving\n  if (mountPoint.includes(\"..\")) {\n    throw new Error(\"Invalid path: contains directory traversal pattern\");\n  }\n\n  // Security check: reject Windows device-namespace paths (\\\\.\\… and \\\\?\\…,\n  // including forward-slash variants). These name devices (\\\\.\\CON,\n  // \\\\.\\PhysicalDrive0) or bypass path canonicalization (\\\\?\\…), and Node's\n  // dirname() leaves them unchanged — which makes isRootDirectory() treat them\n  // as filesystem roots and short-circuit before native validation runs. Reject\n  // them here, at the shared choke point, so no caller can smuggle one through.\n  if (/^[\\\\/]{2}[.?][\\\\/]/.test(mountPoint)) {\n    throw new Error(\"Invalid path: Windows device-namespace path\");\n  }\n\n  // Check for invalid UTF-8 sequences by looking for common invalid patterns\n  // This is a basic check - the native code will do more thorough validation\n  if (mountPoint.includes(\"\\uFFFD\") || mountPoint.includes(\"\\0\")) {\n    throw new Error(\"Invalid path: contains invalid characters\");\n  }\n\n  const result = isWindows\n    ? normalizeWindowsPath(mountPoint)\n    : normalizePosixPath(mountPoint);\n\n  // Make sure the native code doesn't see anything weird:\n  return result != null ? resolve(result) : undefined;\n}\n\n/**\n * Normalizes a Linux or macOS mount point by removing any trailing slashes.\n * This is a no-op for root mount points.\n */\nexport function normalizePosixPath(\n  mountPoint: string | undefined,\n): string | undefined {\n  if (isBlank(mountPoint)) return undefined;\n  if (mountPoint === \"/\") return mountPoint;\n\n  // Fast path: check last char only if no trailing slash\n  if (mountPoint[mountPoint.length - 1] !== \"/\") return mountPoint;\n\n  // Slower path: trim trailing slashes\n  let end = mountPoint.length - 1;\n  while (end > 0 && mountPoint[end] === \"/\") {\n    end--;\n  }\n  return mountPoint.slice(0, end + 1);\n}\n\n/**\n * Normalizes a Windows mount point by ensuring drive letters end with a\n * backslash.\n */\nexport function normalizeWindowsPath(mountPoint: string): string {\n  // Terrible things happen if we give syscalls \"C:\" instead of \"C:\\\"\n\n  return /^[a-z]:$/i.test(mountPoint)\n    ? mountPoint.toUpperCase() + \"\\\\\"\n    : mountPoint;\n}\n\n/**\n * @return true if `path` is the root directory--this is platform-specific. Only\n * \"/\" on linux/macOS is considered a root directory. On Windows, the root\n * directory is a drive letter followed by a colon, e.g. \"C:\\\".\n */\nexport function isRootDirectory(path: string): boolean {\n  const n = normalizePath(path);\n  return n == null ? false : isWindows ? dirname(n) === n : n === \"/\";\n}\n\n/**\n * @return true if `ancestor` is the same path as `descendant`, or is a parent\n * directory of `descendant`. Both paths should be normalized/resolved.\n */\nexport function isAncestorOrSelf(\n  ancestor: string,\n  descendant: string,\n): boolean {\n  if (ancestor === descendant) return true;\n  // Root dirs already end with sep (e.g. \"/\" or \"C:\\\"); others need sep\n  // appended to avoid \"/home\" matching \"/homeother\".\n  const prefix = isRootDirectory(ancestor) ? ancestor : ancestor + sep;\n  return descendant.startsWith(prefix);\n}\n","// src/string_enum.ts\n\n// See https://basarat.gitbooks.io/typescript/content/docs/types/literal-types.html\n\nexport type StringEnumType<T extends string> = {\n  [K in T]: K;\n};\n\nexport type StringEnum<T extends string> = StringEnumType<T> & {\n  values: T[];\n  size: number;\n  get(s: string | undefined): T | undefined;\n};\n\nexport type StringEnumKeys<Type> = Type extends StringEnum<infer X> ? X : never;\n\n/**\n * Create a string enum with the given values. \n\nExample usage:\n\nexport const Directions = stringEnum(\"North\", \"South\", \"East\", \"West\")\nexport type Direction = StringEnumKeys<typeof Directions>\n\n*/\nexport function stringEnum<T extends string>(...o: T[]): StringEnum<T> {\n  const set = new Set(o);\n\n  const dict: StringEnumType<T> = {} as StringEnumType<T>;\n  for (const key of o) {\n    dict[key] = key;\n  }\n\n  return {\n    ...dict,\n    values: Object.freeze([...set]) as T[],\n    size: set.size,\n    get: (s: string | undefined) =>\n      s != null && set.has(s as T) ? (s as T) : undefined,\n  };\n}\n","// src/mount_point_for_path.ts\n\nimport { realpath } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\nimport { validateTimeoutMs, withTimeout } from \"./async\";\nimport { debug } from \"./debuglog\";\nimport { statAsync } from \"./fs\";\nimport { isMacOS } from \"./platform\";\nimport { isBlank, isNotBlank } from \"./string\";\nimport type { NativeBindingsFn } from \"./types/native_bindings\";\nimport type { Options } from \"./types/options\";\nimport { findMountPointByDeviceId } from \"./volume_metadata\";\n\nexport async function getMountPointForPathImpl(\n  pathname: string,\n  opts: Options,\n  nativeFn: NativeBindingsFn,\n  resolvePath: typeof realpath = realpath,\n): Promise<string> {\n  if (isBlank(pathname)) {\n    throw new TypeError(\"Invalid pathname: got \" + JSON.stringify(pathname));\n  }\n\n  // Validate up front: the Linux/Windows device-matching route (especially\n  // with a caller-supplied opts.mountPoints) never reaches withTimeout(),\n  // which would otherwise be the first place an invalid timeoutMs throws.\n  validateTimeoutMs(opts.timeoutMs, \"getMountPointForPath()\");\n\n  return withTimeout({\n    desc: \"getMountPointForPath()\",\n    timeoutMs: opts.timeoutMs,\n    promise: _getMountPointForPath(pathname, opts, nativeFn, resolvePath),\n  });\n}\n\nasync function _getMountPointForPath(\n  pathname: string,\n  opts: Options,\n  nativeFn: NativeBindingsFn,\n  resolvePath: typeof realpath,\n): Promise<string> {\n  // realpath() resolves POSIX symlinks. APFS firmlinks are NOT resolved by\n  // realpath(), but fstatfs() follows them — handled below on macOS.\n  const resolved = await resolvePath(pathname);\n\n  const resolvedStat = await statAsync(resolved);\n  const dir = resolvedStat.isDirectory() ? resolved : dirname(resolved);\n\n  if (isMacOS) {\n    // Use the lightweight native getMountPoint which only does fstatfs —\n    // no DiskArbitration, IOKit, or space calculations.\n    const native = await nativeFn();\n    if (native.getMountPoint) {\n      debug(\"[getMountPointForPath] using native getMountPoint for %s\", dir);\n      // No withTimeout() here: getMountPointForPathImpl() already wraps this\n      // whole function in one deadline that also covers realpath()/stat().\n      const mountPoint = await native.getMountPoint(dir);\n      if (isNotBlank(mountPoint)) {\n        debug(\"[getMountPointForPath] resolved to %s\", mountPoint);\n        return mountPoint;\n      }\n    }\n    // Fallback: should not happen on macOS, but defensive\n    throw new Error(\"getMountPoint native function unavailable\");\n  }\n\n  // Linux/Windows: device ID filtering + longest ancestor path matching\n  debug(\"[getMountPointForPath] using device matching for %s\", resolved);\n  return findMountPointByDeviceId(resolved, resolvedStat, opts, nativeFn);\n}\n","// src/volume_metadata.ts\n\nimport type { Stats } from \"node:fs\";\nimport { realpath } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\nimport { mapConcurrent, validateTimeoutMs, withTimeout } from \"./async\";\nimport { debug } from \"./debuglog\";\nimport { WrappedError } from \"./error\";\nimport { canReaddir, statAsync } from \"./fs\";\nimport { getLabelFromDevDisk, getUuidFromDevDisk } from \"./linux/dev_disk\";\nimport { getLinuxMtabMetadata } from \"./linux/mount_points\";\nimport {\n  type MtabVolumeMetadata,\n  mountEntryToPartialVolumeMetadata,\n} from \"./linux/mtab\";\nimport { getZfsGuids, zfsEnrichmentTimeoutMs } from \"./linux/zfs_guids\";\nimport { compactValues } from \"./object\";\nimport { IncludeSystemVolumesDefault, optionsWithDefaults } from \"./options\";\nimport { isAncestorOrSelf, normalizePath } from \"./path\";\nimport { isLinux, isMacOS, isWindows } from \"./platform\";\nimport { extractRemoteInfo, isRemoteFsType } from \"./remote_info\";\nimport { isBlank, isNotBlank } from \"./string\";\nimport { assignSystemVolume } from \"./system_volume\";\nimport type { MountPoint } from \"./types/mount_point\";\nimport type {\n  GetVolumeMetadataOptions,\n  NativeBindingsFn,\n} from \"./types/native_bindings\";\nimport type { Options } from \"./types/options\";\nimport type { VolumeMetadata } from \"./types/volume_metadata\";\nimport { parseUNCPath } from \"./unc\";\nimport { extractUUID } from \"./uuid\";\nimport { VolumeHealthStatuses, directoryStatus } from \"./volume_health_status\";\nimport { getVolumeMountPointsImpl } from \"./volume_mount_points\";\n\nexport async function getVolumeMetadataImpl(\n  o: GetVolumeMetadataOptions & Options,\n  nativeFn: NativeBindingsFn,\n  operationDeadlineMs?: number,\n): Promise<VolumeMetadata> {\n  if (isBlank(o.mountPoint)) {\n    throw new TypeError(\n      \"Invalid mountPoint: got \" + JSON.stringify(o.mountPoint),\n    );\n  }\n\n  // Validate before starting any work (including native calls) — also on\n  // Windows, where the native health probe also receives this timeout.\n  const timeoutMs = validateTimeoutMs(o.timeoutMs, \"getVolumeMetadata()\");\n  const deadlineMs =\n    operationDeadlineMs ??\n    (timeoutMs === 0 ? undefined : Date.now() + timeoutMs);\n  const p = _getVolumeMetadata(o, nativeFn, deadlineMs);\n  return withTimeout({\n    desc: \"getVolumeMetadata()\",\n    timeoutMs,\n    promise: p,\n  });\n}\n\nasync function _getVolumeMetadata(\n  o: GetVolumeMetadataOptions & Options,\n  nativeFn: NativeBindingsFn,\n  deadlineMs: number | undefined,\n): Promise<VolumeMetadata> {\n  o = optionsWithDefaults(o);\n  const norm = normalizePath(o.mountPoint);\n  if (norm == null) {\n    throw new Error(\"Invalid mountPoint: \" + JSON.stringify(o.mountPoint));\n  }\n  o.mountPoint = norm;\n\n  debug(\n    \"[getVolumeMetadata] starting metadata collection for %s\",\n    o.mountPoint,\n  );\n  debug(\"[getVolumeMetadata] options: %o\", o);\n\n  let remote: boolean = false;\n  let mtabInfo: undefined | MtabVolumeMetadata;\n  let device: undefined | string;\n  // On Linux, read the mount table before touching the mount point: it comes\n  // from /proc (or /etc/mtab) and never blocks on the volume itself, so\n  // remote-ness is known before any IO that could hang on a dead mount.\n  if (isLinux) {\n    debug(\"[getVolumeMetadata] collecting Linux mtab info\");\n    try {\n      const m = await getLinuxMtabMetadata(o.mountPoint, o);\n      mtabInfo = mountEntryToPartialVolumeMetadata(m, o);\n      debug(\"[getVolumeMetadata] mtab info: %o\", mtabInfo);\n      if (mtabInfo.remote) {\n        remote = true;\n      }\n      if (isNotBlank(m.fs_spec)) {\n        device = m.fs_spec;\n      }\n    } catch (err) {\n      debug(\"[getVolumeMetadata] failed to get mtab info: \" + err);\n      // Mtab lookup can fail for transient mounts or race conditions.\n      // Ignore and continue with whatever the native call returns.\n    }\n  }\n\n  if (o.skipNetworkVolumes && remote) {\n    // Honor skipNetworkVolumes without probing the mount point: both\n    // directoryStatus() and the native worker (open()/fstatvfs()) would\n    // block on an unreachable network volume. status is \"unknown\" because\n    // we deliberately didn't check.\n    debug(\n      \"[getVolumeMetadata] skipping detailed queries for network volume %s\",\n      o.mountPoint,\n    );\n    return compactValues({\n      ...compactValues(mtabInfo),\n      mountPoint: o.mountPoint,\n      status: VolumeHealthStatuses.unknown,\n      remote: true,\n    }) as VolumeMetadata;\n  }\n\n  const pathStatus = await directoryStatus(o.mountPoint, o.timeoutMs);\n  const isNonDirectoryLinuxMount =\n    isLinux && pathStatus.isDirectory === false && mtabInfo != null;\n  if (\n    pathStatus.status !== VolumeHealthStatuses.healthy &&\n    !isNonDirectoryLinuxMount\n  ) {\n    const { error, status } = pathStatus;\n    debug(\"[getVolumeMetadata] directoryStatus error: %s\", error);\n    throw error ?? new Error(\"Volume not healthy: \" + status);\n  }\n\n  const status = isNonDirectoryLinuxMount\n    ? VolumeHealthStatuses.healthy\n    : pathStatus.status;\n\n  debug(\"[getVolumeMetadata] path status: %s\", status);\n\n  if (isNotBlank(device)) {\n    o.device = device;\n    debug(\"[getVolumeMetadata] using device: %s\", device);\n  }\n\n  // Pass the mtab fstype to native so the Linux worker can gate btrfs-only\n  // probes (the subvolume-UUID ioctl) without attempting them on other\n  // filesystems.\n  if (isNotBlank(mtabInfo?.fstype)) {\n    o.fstype = mtabInfo.fstype;\n  }\n\n  debug(\"[getVolumeMetadata] requesting native metadata\");\n  const metadata = (await (\n    await nativeFn()\n  ).getVolumeMetadata(o)) as VolumeMetadata;\n  debug(\"[getVolumeMetadata] native metadata: %o\", metadata);\n\n  // Some OS implementations leave it up to us to extract remote info:\n  const remoteInfo =\n    mtabInfo ??\n    extractRemoteInfo(metadata.uri, o.networkFsTypes) ??\n    extractRemoteInfo(metadata.mountFrom, o.networkFsTypes) ??\n    (isWindows ? parseUNCPath(o.mountPoint) : undefined);\n\n  debug(\"[getVolumeMetadata] extracted remote info: %o\", remoteInfo);\n\n  remote ||=\n    isRemoteFsType(metadata.fstype, o.networkFsTypes) ||\n    (remoteInfo?.remote ?? metadata.remote ?? false);\n\n  debug(\"[getVolumeMetadata] assembling: %o\", {\n    status,\n    mtabInfo,\n    remoteInfo,\n    metadata,\n    mountPoint: o.mountPoint,\n    remote,\n  });\n  const result = compactValues({\n    status, // < let the implementation's status win by having this first\n    ...compactValues(remoteInfo),\n    ...compactValues(metadata),\n    ...compactValues(mtabInfo),\n    mountPoint: o.mountPoint,\n    remote,\n  }) as VolumeMetadata;\n\n  // Backfill if blkid failed us:\n  if (isLinux && isNotBlank(device)) {\n    // Sometimes blkid doesn't have the UUID in cache. Try to get it from\n    // /dev/disk/by-uuid:\n    result.uuid ??= (await getUuidFromDevDisk(device)) ?? \"\";\n    result.label ??= (await getLabelFromDevDisk(device)) ?? \"\";\n  }\n\n  if (\n    isLinux &&\n    o.includeZfsGuids &&\n    result.fstype === \"zfs\" &&\n    isNotBlank(result.mountFrom)\n  ) {\n    // Reserve part of the whole-operation deadline for command-timeout cleanup\n    // and final result assembly. If earlier filesystem work consumed\n    // the budget, optional enrichment is skipped instead of racing the public\n    // timeout. A timeout of zero deliberately disables both deadlines.\n    const commandTimeoutMs = zfsEnrichmentTimeoutMs(deadlineMs, Date.now());\n    if (commandTimeoutMs != null) {\n      Object.assign(\n        result,\n        await getZfsGuids({\n          dataset: result.mountFrom,\n          timeoutMs: commandTimeoutMs,\n        }),\n      );\n    } else {\n      debug(\"[getVolumeMetadata] skipping ZFS GUIDs: deadline exhausted\");\n    }\n  }\n\n  assignSystemVolume(result, o);\n\n  // Fix microsoft's UUID format:\n  result.uuid = extractUUID(result.uuid) ?? result.uuid ?? \"\";\n\n  debug(\"[getVolumeMetadata] final result for %s: %o\", o.mountPoint, result);\n  return compactValues(result) as VolumeMetadata;\n}\n\n/**\n * Get volume metadata for an arbitrary file or directory path.\n *\n * Unlike {@link getVolumeMetadataImpl}, this accepts any path — not just mount\n * points. It resolves symlinks and correctly handles macOS APFS firmlinks\n * (e.g. `/Users` → `/System/Volumes/Data`), mirroring what `df` does.\n *\n * On macOS, the native `fstatfs()` call returns `f_mntonname` (the canonical\n * mount point), exposed here as `mountName`. This is used to resolve firmlinks\n * without `stat().dev`, which does NOT follow firmlinks.\n *\n * On Linux and Windows, `stat().dev` device IDs are reliable (no firmlinks),\n * so mount point discovery uses device ID + path prefix matching.\n */\nexport async function getVolumeMetadataForPathImpl(\n  pathname: string,\n  opts: Options,\n  nativeFn: NativeBindingsFn,\n  resolvePath: typeof realpath = realpath,\n): Promise<VolumeMetadata> {\n  if (isBlank(pathname)) {\n    throw new TypeError(\"Invalid pathname: got \" + JSON.stringify(pathname));\n  }\n\n  // Validate before any path work: with a caller-supplied opts.mountPoints\n  // this route can otherwise finish (or fail for unrelated reasons) without\n  // ever reaching a timeoutMs check.\n  const timeoutMs = validateTimeoutMs(\n    opts.timeoutMs,\n    \"getVolumeMetadataForPath()\",\n  );\n\n  // This deadline wraps the WHOLE operation, including realpath()/stat() and the\n  // nested getVolumeMetadataImpl() call inside _getVolumeMetadataForPath().\n  // getVolumeMetadataImpl() has its own withTimeout(), but that inner one only\n  // starts after path resolution, so this outer wrapper is what bounds a hung\n  // realpath(). The two are intentional — don't drop this as \"redundant\".\n  const operationDeadlineMs =\n    timeoutMs === 0 ? undefined : Date.now() + timeoutMs;\n  return withTimeout({\n    desc: \"getVolumeMetadataForPath()\",\n    timeoutMs,\n    promise: _getVolumeMetadataForPath(\n      pathname,\n      opts,\n      nativeFn,\n      resolvePath,\n      operationDeadlineMs,\n    ),\n  });\n}\n\nasync function _getVolumeMetadataForPath(\n  pathname: string,\n  opts: Options,\n  nativeFn: NativeBindingsFn,\n  resolvePath: typeof realpath,\n  operationDeadlineMs: number | undefined,\n): Promise<VolumeMetadata> {\n  // realpath() resolves POSIX symlinks. APFS firmlinks are NOT resolved by\n  // realpath(), but fstatfs() follows them — handled below.\n  const resolved = await resolvePath(pathname);\n\n  // macOS probes the containing directory. Linux/Windows use the original\n  // path below so an exact Linux file bind mount remains distinguishable.\n  const resolvedStat = await statAsync(resolved);\n  const dir = resolvedStat.isDirectory() ? resolved : dirname(resolved);\n\n  if (isMacOS) {\n    // On macOS, native fstatfs() sets mountName = f_mntonname, which is the\n    // canonical mount point even through APFS firmlinks. Probe the dir to get\n    // it, then re-query with the canonical mount point so the result has\n    // mountPoint set correctly.\n    const probe = await getVolumeMetadataImpl(\n      { ...opts, mountPoint: dir },\n      nativeFn,\n      operationDeadlineMs,\n    );\n    const canonicalMountPoint = isNotBlank(probe.mountName)\n      ? probe.mountName\n      : dir;\n    if (canonicalMountPoint === dir) return probe;\n    return getVolumeMetadataImpl(\n      { ...opts, mountPoint: canonicalMountPoint },\n      nativeFn,\n      operationDeadlineMs,\n    );\n  }\n\n  // Linux/Windows: stat().dev is reliable (no firmlinks). Find the mount point\n  // by comparing device IDs, using path prefix as a tiebreaker for bind mounts\n  // or GVfs/FUSE mounts that share the same device id.\n  const mountPoint = await findMountPointByDeviceId(\n    resolved,\n    resolvedStat,\n    opts,\n    nativeFn,\n  );\n\n  return getVolumeMetadataImpl(\n    { ...opts, mountPoint },\n    nativeFn,\n    operationDeadlineMs,\n  );\n}\n\n/**\n * Find the mount point for a resolved path using device ID + path ancestry.\n * Used on Linux and Windows where stat().dev is reliable (no firmlinks).\n *\n * Device ID filters out unrelated filesystems. Among same-device mount points,\n * ancestor-path matches (mount point is a parent of `resolved`) are strongly\n * preferred over device-only matches — GVfs/FUSE mounts on Linux can share\n * the same device ID across unrelated volumes (e.g. multiple SMB shares\n * under /run/user/.../gvfs/), so device ID alone is ambiguous. The longest\n * ancestor wins.\n *\n * The device-only fallback exists for bind mounts where the canonical mount\n * point may not be a path ancestor of the target.\n *\n * Resolution runs in two phases because ancestor matches win outright whenever\n * there are any: the non-ancestor stats cannot change the answer unless no\n * ancestor is on the target's device. `isAncestorOrSelf()` is pure string work,\n * so partitioning first costs nothing and normally reduces a full-system list\n * (57 mount points on a typical Linux desktop) to the 2-3 that are actually\n * ancestors.\n *\n * That matters beyond latency. One unreachable mount point — a dead `autofs`\n * trigger, an unplugged `x-systemd.automount`, a wedged FUSE mount — blocks\n * `stat()` for seconds, and `fsp.stat()` has no cancellation: a timeout would\n * abandon the promise while the libuv thread stays parked. Embedders that have\n * not raised `UV_THREADPOOL_SIZE` (default 4) would have unrelated filesystem\n * work starve behind it on every lookup. Not issuing the stat is the only\n * remedy.\n */\nexport async function findMountPointByDeviceId(\n  resolved: string,\n  resolvedStat: Stats,\n  opts: Options,\n  nativeFn: NativeBindingsFn,\n  statImpl: typeof statAsync = statAsync,\n  canReaddirImpl: typeof canReaddir = canReaddir,\n): Promise<string> {\n  const targetDev = resolvedStat.dev;\n  const mountPoints =\n    opts.mountPoints ??\n    (await getVolumeMountPointsImpl(\n      {\n        ...opts,\n        includeSystemVolumes: true,\n        includeNonDirectoryMountPoints: true,\n        // Ancestor-only stat() below is pointless if simply *obtaining* the\n        // candidate list readdir()s every mount first: one dead mount would\n        // still delay every lookup by the probe budget. Nothing here reads\n        // `status`, and includeNonDirectoryMountPoints already disables the\n        // only filter the probe feeds, so the probe is pure cost.\n        skipHealthProbes: true,\n      },\n      nativeFn,\n      canReaddirImpl,\n    ));\n\n  const sameDeviceMountPoints = async (candidates: MountPoint[]) => {\n    const matches: string[] = [];\n    await Promise.all(\n      candidates.map(async ({ mountPoint }) => {\n        try {\n          if ((await statImpl(mountPoint)).dev === targetDev) {\n            matches.push(mountPoint);\n          }\n        } catch {\n          // skip inaccessible mount points\n        }\n      }),\n    );\n    return matches;\n  };\n\n  const ancestors: MountPoint[] = [];\n  const nonAncestors: MountPoint[] = [];\n  for (const mp of mountPoints) {\n    (isAncestorOrSelf(mp.mountPoint, resolved) ? ancestors : nonAncestors).push(\n      mp,\n    );\n  }\n\n  // Phase 1: ancestors only. These are all on the path realpath() already\n  // traversed, so they are reachable by construction.\n  const prefixMatches = await sameDeviceMountPoints(ancestors);\n  if (prefixMatches.length > 0) return longestPath(prefixMatches);\n\n  // Phase 2: the bind-mount fallback, reached only when nothing on the target's\n  // own path matched. skipNetworkVolumes: don't stat() non-ancestor remote\n  // mount points — a dead network mount would hang the lookup for an unrelated\n  // local path. Ancestors are exempt above: if the target lives under a remote\n  // mount, resolving it already touched that mount, and skipping ancestors\n  // would break lookups on healthy network volumes.\n  const deviceMatches = await sameDeviceMountPoints(\n    nonAncestors.filter(\n      ({ fstype }) =>\n        !(\n          opts.skipNetworkVolumes && isRemoteFsType(fstype, opts.networkFsTypes)\n        ),\n    ),\n  );\n  if (deviceMatches.length === 0) {\n    throw new Error(\n      \"No mount point found for path: \" + JSON.stringify(resolved),\n    );\n  }\n  return longestPath(deviceMatches);\n}\n\n/** The most specific of several matching mount points. */\nfunction longestPath(paths: string[]): string {\n  return paths.reduce((a, b) => (a.length >= b.length ? a : b));\n}\n\nexport async function getAllVolumeMetadataImpl(\n  opts: Required<Options> & {\n    includeSystemVolumes?: boolean;\n    maxConcurrency?: number;\n  },\n  nativeFn: NativeBindingsFn,\n): Promise<VolumeMetadata[]> {\n  const o = optionsWithDefaults(opts);\n  debug(\"[getAllVolumeMetadata] starting with options: %o\", o);\n\n  const arr = await getVolumeMountPointsImpl(o, nativeFn);\n  debug(\"[getAllVolumeMetadata] found %d mount points\", arr.length);\n\n  const unhealthyMountPoints = arr\n    .filter(\n      (ea) => ea.status != null && ea.status !== VolumeHealthStatuses.healthy,\n    )\n    .map((ea) => ({\n      mountPoint: ea.mountPoint,\n      error: new WrappedError(\"volume not healthy: \" + ea.status, {\n        name: \"Skipped\",\n      }),\n    }));\n\n  const includeSystemVolumes =\n    opts?.includeSystemVolumes ?? IncludeSystemVolumesDefault;\n\n  const systemMountPoints = includeSystemVolumes\n    ? []\n    : arr\n        .filter((ea) => ea.isSystemVolume)\n        .map((ea) => ({\n          mountPoint: ea.mountPoint,\n          error: new WrappedError(\"system volume\", { name: \"Skipped\" }),\n        }));\n\n  const healthy = arr.filter(\n    (ea) => ea.status == null || ea.status === VolumeHealthStatuses.healthy,\n  );\n\n  // On macOS and Windows, getVolumeMetadataImpl cannot cheaply detect remote\n  // volumes before the native call, but the enumerated mount points carry\n  // fstype — honor skipNetworkVolumes here with mount-point-derived shallow\n  // results. (On Linux, getVolumeMetadataImpl itself short-circuits from the\n  // mount table with richer remote info, so nothing is skipped here.)\n  const skippedNetwork =\n    o.skipNetworkVolumes && !isLinux\n      ? healthy.filter((ea) => isRemoteFsType(ea.fstype, o.networkFsTypes))\n      : [];\n  const skippedNetworkResults = skippedNetwork.map(\n    (ea) =>\n      compactValues({ ...compactValues(ea), remote: true }) as VolumeMetadata,\n  );\n\n  debug(\"[getAllVolumeMetadata] \", {\n    allMountPoints: arr.map((ea) => ea.mountPoint),\n    healthyMountPoints: healthy.map((ea) => ea.mountPoint),\n  });\n\n  debug(\n    \"[getAllVolumeMetadata] processing %d healthy volumes with max concurrency %d\",\n    healthy.length,\n    o.maxConcurrency,\n  );\n\n  const results = await (mapConcurrent({\n    maxConcurrency: o.maxConcurrency,\n    items: (includeSystemVolumes\n      ? healthy\n      : healthy.filter((ea) => !ea.isSystemVolume)\n    ).filter((ea) => !skippedNetwork.includes(ea)),\n    fn: async (mp) =>\n      getVolumeMetadataImpl({ ...mp, ...o }, nativeFn).catch((error) => ({\n        mountPoint: mp.mountPoint,\n        error,\n      })),\n  }) as Promise<(VolumeMetadata | { mountPoint: string; error: Error })[]>);\n\n  debug(\"[getAllVolumeMetadata] completed processing all volumes\");\n  return arr.map(\n    (result) =>\n      (results.find((ea) => ea.mountPoint === result.mountPoint) ??\n        unhealthyMountPoints.find(\n          (ea) => ea.mountPoint === result.mountPoint,\n        ) ??\n        systemMountPoints.find((ea) => ea.mountPoint === result.mountPoint) ??\n        skippedNetworkResults.find(\n          (ea) => ea.mountPoint === result.mountPoint,\n        ) ?? {\n          ...result,\n          error: new WrappedError(\"Mount point metadata not retrieved\", {\n            name: \"NotApplicableError\",\n          }),\n        }) as VolumeMetadata,\n  );\n}\n","// src/linux/dev_disk.ts\n\nimport { Dirent } from \"node:fs\";\nimport { readdir, readlink } from \"node:fs/promises\";\nimport { join, resolve } from \"node:path\";\nimport { debug } from \"../debuglog\";\nimport { decodeUdevEscapes } from \"../string\";\n\n/**\n * Gets the UUID from symlinks for a given device path asynchronously\n * @param devicePath The device path to look up\n * @returns Promise that resolves to the UUID if found, empty string otherwise\n */\nexport async function getUuidFromDevDisk(devicePath: string) {\n  try {\n    const result = await getBasenameLinkedTo(\n      \"/dev/disk/by-uuid\",\n      resolve(devicePath),\n    );\n    debug(\"[getUuidFromDevDisk] result: %o\", result);\n    return result;\n  } catch (error) {\n    debug(\"[getUuidFromDevDisk] failed: \" + error);\n    return;\n  }\n}\n\n/**\n * Gets the label from symlinks for a given device path asynchronously\n * @param devicePath The device path to look up\n * @returns Promise that resolves to the label if found, empty string otherwise\n */\nexport async function getLabelFromDevDisk(devicePath: string) {\n  try {\n    const result = await getBasenameLinkedTo(\n      \"/dev/disk/by-label\",\n      resolve(devicePath),\n    );\n    debug(\"[getLabelFromDevDisk] result: %o\", result);\n    return result;\n  } catch (error) {\n    debug(\"[getLabelFromDevDisk] failed: \" + error);\n    return;\n  }\n}\n\n// only exposed for tests\nexport async function getBasenameLinkedTo(\n  linkDir: string,\n  linkPath: string,\n): Promise<string | undefined> {\n  for await (const ea of readLinks(linkDir)) {\n    if (ea.linkTarget === linkPath) {\n      // Expect the symlink to be named like '1tb\\x20\\x28test\\x29'\n      return decodeUdevEscapes(ea.dirent.name);\n    }\n  }\n  return;\n}\n\nasync function* readLinks(\n  directory: string,\n): AsyncGenerator<{ dirent: Dirent; linkTarget: string }, void, unknown> {\n  for (const dirent of await readdir(directory, { withFileTypes: true })) {\n    if (dirent.isSymbolicLink()) {\n      try {\n        const linkTarget = resolve(\n          directory,\n          await readlink(join(directory, dirent.name)),\n        );\n        yield { dirent, linkTarget };\n      } catch {\n        // Ignore errors\n      }\n    }\n  }\n}\n","// src/linux/mount_points.ts\nimport { readFile } from \"node:fs/promises\";\nimport { debug } from \"../debuglog\";\nimport { toError, WrappedError } from \"../error\";\nimport { optionsWithDefaults } from \"../options\";\nimport { type MountPoint } from \"../types/mount_point\";\nimport type { Options } from \"../types/options\";\nimport {\n  lastMountEntriesByPath,\n  MountEntry,\n  mountEntryToMountPoint,\n  parseMtab,\n} from \"./mtab\";\n\nexport async function getLinuxMountPoints(\n  opts?: Pick<Options, \"linuxMountTablePaths\">,\n): Promise<MountPoint[]> {\n  const o = optionsWithDefaults(opts);\n  let cause: Error | undefined;\n  for (const input of o.linuxMountTablePaths) {\n    try {\n      const mtabContent = await readFile(input, \"utf8\");\n      const results = lastMountEntriesByPath(parseMtab(mtabContent))\n        .map((ea) => mountEntryToMountPoint(ea))\n        .filter((ea) => ea != null);\n      debug(\"[getLinuxMountPoints] %s mount points: %o\", input, results);\n      if (results.length > 0) {\n        return results;\n      }\n    } catch (error) {\n      cause ??= toError(error);\n    }\n  }\n\n  throw new WrappedError(\n    `Failed to find any mount points (tried: ${JSON.stringify(o.linuxMountTablePaths)})`,\n    { cause },\n  );\n}\n\nexport async function getLinuxMtabMetadata(\n  mountPoint: string,\n  opts?: Pick<Options, \"linuxMountTablePaths\">,\n): Promise<MountEntry> {\n  let caughtError: Error | undefined;\n  const inputs = optionsWithDefaults(opts).linuxMountTablePaths;\n  for (const input of inputs) {\n    try {\n      const mtabContent = await readFile(input, \"utf8\");\n      // lastMountEntriesByPath(): when several mounts stack on `mountPoint`,\n      // the last entry is the one that describes what the caller reaches — for\n      // every stacking mechanism this library targets. See its caveat.\n      for (const ea of lastMountEntriesByPath(parseMtab(mtabContent))) {\n        if (ea.fs_file === mountPoint) {\n          return ea;\n        }\n      }\n    } catch (error) {\n      caughtError ??= toError(error);\n    }\n  }\n\n  throw new WrappedError(\n    `Failed to find mount point ${mountPoint} in an linuxMountTablePaths (tried: ${JSON.stringify(inputs)})`,\n    caughtError,\n  );\n}\n","// src/remote_info.ts\n\nimport { debug } from \"./debuglog\";\nimport { compactValues, isObject } from \"./object\";\nimport { NetworkFsTypesDefault } from \"./options\";\nimport { isWindows } from \"./platform\";\nimport { isBlank, isNotBlank, toS } from \"./string\";\nimport { RemoteInfo } from \"./types/remote_info\";\n\nexport function isRemoteInfo(obj: unknown): obj is RemoteInfo {\n  if (!isObject(obj)) return false;\n  const { remoteHost, remoteShare } = obj as Partial<RemoteInfo>;\n  return isNotBlank(remoteHost) && isNotBlank(remoteShare);\n}\n\n/**\n * Aliases that map variant filesystem type names to canonical names.\n */\nconst FS_TYPE_ALIASES = new Map<string, string>([\n  [\"nfs1\", \"nfs\"],\n  [\"nfs2\", \"nfs\"],\n  [\"nfs3\", \"nfs\"],\n  [\"fuse.sshfs\", \"sshfs\"],\n  [\"sshfs.fuse\", \"sshfs\"],\n  [\"davfs2\", \"webdav\"],\n  [\"davfs\", \"webdav\"],\n  [\"cifs.smb\", \"cifs\"],\n  [\"cephfs\", \"ceph\"],\n  [\"fuse.ceph\", \"ceph\"],\n  [\"fuse.cephfs\", \"ceph\"],\n  [\"rbd\", \"ceph\"],\n  [\"fuse.glusterfs\", \"glusterfs\"],\n]);\n\nexport function normalizeFsType(fstype: string): string {\n  const norm = toS(fstype).toLowerCase().replace(/:$/, \"\");\n  return FS_TYPE_ALIASES.get(norm) ?? norm;\n}\n\n/**\n * Check if a filesystem type indicates a remote/network volume.\n *\n * @param fstype - The filesystem type to check\n * @param networkFsTypes - List of network filesystem types (defaults to {@link NetworkFsTypesDefault})\n */\nexport function isRemoteFsType(\n  fstype: string | undefined,\n  networkFsTypes: readonly string[] = NetworkFsTypesDefault,\n): boolean {\n  if (!isNotBlank(fstype)) return false;\n  const normalized = normalizeFsType(fstype);\n  return networkFsTypes.some(\n    (nft) => nft === normalized || normalized.startsWith(nft + \".\"),\n  );\n}\n\nexport function parseURL(s: string): URL | undefined {\n  try {\n    return isBlank(s) ? undefined : new URL(s);\n  } catch {\n    return;\n  }\n}\n\n/**\n * Extract remote connection info from a filesystem spec string.\n *\n * @param fsSpec - The filesystem spec (e.g., \"//host/share\", \"host:/path\", URI)\n * @param networkFsTypes - List of network filesystem types (defaults to {@link NetworkFsTypesDefault})\n */\nexport function extractRemoteInfo(\n  fsSpec: string | undefined,\n  networkFsTypes: readonly string[] = NetworkFsTypesDefault,\n): RemoteInfo | undefined {\n  if (fsSpec == null || isBlank(fsSpec)) return;\n\n  if (isWindows) {\n    fsSpec = fsSpec.replace(/\\\\/g, \"/\");\n  }\n\n  const url = parseURL(fsSpec);\n\n  if (url?.protocol === \"file:\") {\n    return {\n      remote: false,\n      uri: fsSpec,\n    };\n  }\n\n  const patterns = [\n    {\n      // CIFS/SMB pattern: //hostname/share or //user@host/share\n      regex:\n        // eslint-disable-next-line security/detect-unsafe-regex -- parsing trusted mount paths from OS, bounded by line anchors\n        /^\\/\\/(?:(?<remoteUser>[^/@]+)@)?(?<remoteHost>[^/@]+)\\/(?<remoteShare>.*)$/,\n    },\n    {\n      // sshfs pattern: sshfs#USER@HOST:REMOTE_PATH\n      regex:\n        // eslint-disable-next-line security/detect-unsafe-regex -- parsing trusted mount paths from OS, bounded by line anchors\n        /^(?:(?<protocol>\\w+)#)?(?<remoteUser>[^@]+)@(?<remoteHost>[^:]+):(?<remoteShare>.*)$/,\n    },\n    {\n      // NFS pattern: hostname:/share\n      protocol: \"nfs\",\n      regex: /^(?<remoteHost>[^:]+):\\/(?!\\/)(?<remoteShare>.*)$/,\n    },\n  ];\n\n  for (const { protocol, regex } of patterns) {\n    const o = compactValues({\n      protocol,\n      remote: true,\n      ...(fsSpec.match(regex)?.groups ?? {}),\n    });\n    if (isRemoteInfo(o)) {\n      debug(\"[extractRemoteInfo] matched pattern: %o\", o);\n      return o;\n    }\n  }\n\n  // Let's try URL last, as nfs and webdav mounts are URI-ish\n  try {\n    // try to parse fsSpec as a uri:\n    const parsed = new URL(fsSpec);\n    if (parsed != null) {\n      debug(\"[extractRemoteInfo] parsed URL: %o\", parsed);\n      const fstype = normalizeFsType(parsed.protocol);\n      if (!isRemoteFsType(fstype, networkFsTypes)) {\n        // don't set remoteUser, remoteHost, or remoteShare, it's not remote!\n        return {\n          uri: fsSpec,\n          remote: false,\n        };\n      } else {\n        return compactValues({\n          uri: fsSpec,\n          protocol: fstype,\n          remote: true,\n          remoteUser: parsed.username,\n          remoteHost: parsed.hostname,\n          // URL pathname includes leading slash:\n          remoteShare: parsed.pathname.replace(/^\\//, \"\"),\n        }) as unknown as RemoteInfo;\n      }\n    }\n  } catch {\n    // ignore\n  }\n\n  return;\n}\n","// src/glob.ts\n\nimport { isWindows } from \"./platform\";\nimport { isNotBlank } from \"./string\";\n\nconst cache = new Map<string, RegExp>();\n\n/**\n * Compiles an array of glob patterns into a single regular expression.\n *\n * The function supports the following patterns:\n * - `**` matches any number of directories.\n * - `*` matches any number of characters except for `/`.\n * - `?` matches exactly one character except for `/`.\n * - `.` is escaped to match a literal period.\n * - `/` at the end of the pattern matches either a slash or the end of the string.\n * - Other regex special characters are escaped.\n *\n * @param patterns - An array of glob patterns to compile.\n * @returns A `RegExp` object that matches any of the provided patterns.\n */\nexport function compileGlob(\n  patterns: string[] | readonly string[] | undefined,\n): RegExp {\n  if (patterns == null || patterns.length === 0) {\n    return NeverMatchRE;\n  }\n  const patternsKey = JSON.stringify(patterns);\n  {\n    const prior = cache.get(patternsKey);\n    if (prior != null) {\n      return prior;\n    }\n  }\n\n  const sorted = patterns.slice().filter(isNotBlank).sort();\n  const sortedKey = JSON.stringify(sorted);\n  {\n    const prior = cache.get(sortedKey);\n    if (prior != null) {\n      cache.set(patternsKey, prior);\n      return prior;\n    }\n  }\n\n  const result = _compileGlob(sorted);\n  if (cache.size > 256) {\n    // avoid unbounded memory usage\n    cache.clear();\n  }\n\n  cache.set(patternsKey, result);\n  cache.set(sortedKey, result);\n  return result;\n}\n\nfunction _compileGlob(patterns: string[] | readonly string[]): RegExp {\n  const regexPatterns = patterns.map((pattern) => {\n    let regex = \"\";\n    let i = 0;\n    while (i < pattern.length) {\n      // Handle '**' pattern\n      if (pattern[i] === \"*\" && pattern[i + 1] === \"*\") {\n        regex += \".*\";\n        i += 2;\n        if (pattern[i] === \"/\") {\n          i++; // Skip the slash after **\n        }\n        continue;\n      }\n\n      // Handle single '*' pattern\n      if (pattern[i] === \"*\") {\n        regex += \"[^/]*\";\n        i++;\n        continue;\n      }\n\n      // Handle '?' pattern\n      if (pattern[i] === \"?\") {\n        regex += \"[^/]\";\n        i++;\n        continue;\n      }\n\n      // Handle period\n      if (pattern[i] === \".\") {\n        regex += \"\\\\.\";\n        i++;\n        continue;\n      }\n\n      // Handle end of directory pattern\n      if (pattern[i] === \"/\") {\n        if (i === pattern.length - 1) {\n          regex += \"(?:/|$)\";\n          i++;\n          continue;\n        } else if (isWindows) {\n          regex += \"[\\\\/\\\\\\\\]\";\n          i++;\n          continue;\n        }\n      }\n\n      // Escape other regex special characters\n      if (/[+^${}()|[\\]\\\\]/.test(pattern[i] as string)) {\n        regex += \"\\\\\" + pattern[i];\n        i++;\n        continue;\n      }\n\n      // Add other characters as-is\n      regex += pattern[i];\n      i++;\n    }\n    return regex;\n  });\n  const final = regexPatterns.filter((ea) => ea.length > 0);\n  return final.length === 0\n    ? // Empty pattern matches nothing\n      NeverMatchRE\n    : // eslint-disable-next-line security/detect-non-literal-regexp -- compiling globs to a RegExp is this function's purpose; special characters are escaped above\n      new RegExp(`^(?:${final.join(\"|\")})$`, isWindows ? \"i\" : \"\");\n}\n\n// eslint-disable-next-line regexp/no-empty-group\nexport const AlwaysMatchRE = /(?:)/;\n// eslint-disable-next-line regexp/no-empty-lookarounds-assertion\nexport const NeverMatchRE = /(?!)/;\n","// src/system_volume.ts\n\nimport { debug } from \"./debuglog\";\nimport { compileGlob } from \"./glob\";\nimport { SystemFsTypesDefault, SystemPathPatternsDefault } from \"./options\";\nimport { normalizePath } from \"./path\";\nimport { isWindows } from \"./platform\";\nimport { isNotBlank } from \"./string\";\nimport type { MountPoint } from \"./types/mount_point\";\nimport type { Options } from \"./types/options\";\n\n/**\n * Configuration for system volume detection\n *\n * @see {@link MountPoint.isSystemVolume}\n */\nexport type SystemVolumeConfig = Pick<\n  Options,\n  \"systemPathPatterns\" | \"systemFsTypes\"\n>;\n\n/**\n * Determines if a mount point represents a system volume based on its path and\n * filesystem type\n */\nexport function isSystemVolume(\n  mountPoint: string,\n  fstype: string | undefined,\n  config: Partial<SystemVolumeConfig> = {},\n): boolean {\n  if (isWindows) {\n    const systemDrive = normalizePath(process.env[\"SystemDrive\"]);\n    if (systemDrive != null && mountPoint === systemDrive) {\n      debug(\"[isSystemVolume] %s is the Windows system drive\", mountPoint);\n      return true;\n    }\n  }\n  const isSystemFsType =\n    isNotBlank(fstype) &&\n    ((config.systemFsTypes ?? SystemFsTypesDefault) as string[]).includes(\n      fstype,\n    );\n  const hasSystemPath = compileGlob(\n    config.systemPathPatterns ?? SystemPathPatternsDefault,\n  ).test(mountPoint);\n  const result = isSystemFsType || hasSystemPath;\n  debug(\"[isSystemVolume]\", {\n    mountPoint,\n    fstype,\n    result,\n    isSystemFsType,\n    hasSystemPath,\n  });\n  return result;\n}\n\nexport function assignSystemVolume(\n  mp: MountPoint,\n  config: Partial<SystemVolumeConfig>,\n) {\n  const result = isSystemVolume(mp.mountPoint, mp.fstype, config);\n\n  // Native code may have already marked this as a system volume (e.g.,\n  // Windows system drive detection, macOS MNT_SNAPSHOT for the sealed\n  // APFS system snapshot at /). Never downgrade a native true — only\n  // upgrade via path/fstype heuristics.\n  mp.isSystemVolume = mp.isSystemVolume || result;\n}\n","// src/linux/mtab.ts\n\nimport { toInt } from \"../number\";\nimport { NetworkFsTypesDefault } from \"../options\";\nimport { normalizePosixPath } from \"../path\";\nimport { extractRemoteInfo, isRemoteFsType } from \"../remote_info\";\nimport {\n  decodeMountTableEscapes,\n  encodeEscapeSequences,\n  isBlank,\n  toNotBlank,\n} from \"../string\";\nimport { isSystemVolume } from \"../system_volume\";\nimport type { MountPoint } from \"../types/mount_point\";\nimport type { Options } from \"../types/options\";\nimport type { VolumeMetadata } from \"../types/volume_metadata\";\n\n/**\n * Represents an entry in the mount table.\n */\nexport interface MountEntry {\n  /**\n   * Device or remote filesystem\n   */\n  fs_spec: string;\n  /**\n   * Mount point\n   */\n  fs_file: string;\n  /**\n   * Filesystem type\n   */\n  fs_vfstype: string;\n  /**\n   * Mount options\n   */\n  fs_mntops: string | undefined;\n  /**\n   * Dump frequency\n   */\n  fs_freq: number | undefined;\n  /**\n   * fsck pass number\n   */\n  fs_passno: number | undefined;\n}\n\nfunction isReadOnlyMount(fs_mntops: string | undefined): boolean {\n  return fs_mntops?.split(\",\").includes(\"ro\") ?? false;\n}\n\n/**\n * Extracts the btrfs subvolume discriminators from a mount options string.\n *\n * btrfs mounts carry `subvol=<path>` and `subvolid=<n>` in the options field\n * (never in the device/fs_spec field). These distinguish sibling subvolumes of\n * one filesystem that otherwise share a single libblkid fs UUID. Keys are only\n * included in the result when present, so the spread is a no-op for non-btrfs\n * mounts.\n *\n * Gated on `fstype === \"btrfs\"` so the fields stay `undefined` on every other\n * filesystem, honoring the btrfs-only contract in the public types even if some\n * unrelated mount happens to carry a `subvol=`-like option.\n */\nfunction parseSubvolInfo(\n  fs_mntops: string | undefined,\n  fstype: string | undefined,\n): {\n  subvol?: string;\n  subvolid?: number;\n} {\n  if (fstype !== \"btrfs\" || fs_mntops == null) return {};\n  const result: { subvol?: string; subvolid?: number } = {};\n  for (const opt of fs_mntops.split(\",\")) {\n    const eq = opt.indexOf(\"=\");\n    if (eq < 0) continue;\n    const key = opt.slice(0, eq);\n    if (key === \"subvol\") {\n      result.subvol = opt.slice(eq + 1);\n    } else if (key === \"subvolid\") {\n      const id = toInt(opt.slice(eq + 1));\n      if (id != null) result.subvolid = id;\n    }\n  }\n  return result;\n}\n\nexport function mountEntryToMountPoint(\n  entry: MountEntry,\n): MountPoint | undefined {\n  const mountPoint = normalizePosixPath(entry.fs_file);\n  const fstype = toNotBlank(entry.fs_vfstype) ?? toNotBlank(entry.fs_spec);\n  return mountPoint == null || fstype == null\n    ? undefined\n    : {\n        mountPoint,\n        fstype,\n        isReadOnly: isReadOnlyMount(entry.fs_mntops),\n        ...parseSubvolInfo(entry.fs_mntops, entry.fs_vfstype),\n      };\n}\n\nexport type MtabVolumeMetadata = Omit<\n  VolumeMetadata,\n  \"size\" | \"used\" | \"available\" | \"label\" | \"uuid\" | \"status\"\n>;\n\nexport type MtabOptions = Partial<\n  Pick<Options, \"systemPathPatterns\" | \"systemFsTypes\" | \"networkFsTypes\">\n>;\n\nexport function mountEntryToPartialVolumeMetadata(\n  entry: MountEntry,\n  options: MtabOptions = {},\n): MtabVolumeMetadata {\n  const networkFsTypes = options.networkFsTypes ?? NetworkFsTypesDefault;\n  const remoteInfo = extractRemoteInfo(entry.fs_spec, networkFsTypes);\n  return {\n    mountPoint: entry.fs_file,\n    fstype: entry.fs_vfstype,\n    mountFrom: entry.fs_spec,\n    isSystemVolume: isSystemVolume(entry.fs_file, entry.fs_vfstype, options),\n    isReadOnly: isReadOnlyMount(entry.fs_mntops),\n    ...parseSubvolInfo(entry.fs_mntops, entry.fs_vfstype),\n    ...remoteInfo,\n    // The spec alone can miss remote mounts — a network fstype with an\n    // unparseable source (e.g. 9p's \"svc\", or davfs's https:// URI) must\n    // still be marked remote, or skipNetworkVolumes would probe it.\n    remote:\n      (remoteInfo?.remote ?? false) ||\n      isRemoteFsType(entry.fs_vfstype, networkFsTypes),\n  };\n}\n\n/**\n * Parses an mtab/fstab file content into structured mount entries\n * @param content - Raw content of the mtab/fstab file\n * @returns Array of parsed mount entries\n */\nexport function parseMtab(content: string): MountEntry[] {\n  const entries: MountEntry[] = [];\n  const lines = content.split(\"\\n\");\n\n  for (const line of lines) {\n    // Skip comments and empty lines\n    if (isBlank(line) || line.trim().startsWith(\"#\")) {\n      continue;\n    }\n\n    const fields = line\n      .trim()\n      .match(/(?:[^\\s\\\\]|\\\\.)+/g)\n      ?.map(decodeMountTableEscapes);\n\n    if (!fields || fields.length < 3) {\n      continue; // Skip malformed lines\n    }\n    const fs_file = normalizePosixPath(fields[1]);\n    if (fs_file != null) {\n      entries.push({\n        fs_spec: fields[0] as string,\n        // normalizeLinuxPath DOES NOT resolve()!\n        fs_file,\n        fs_vfstype: fields[2] as string,\n        fs_mntops: fields[3],\n        fs_freq: toInt(fields[4]),\n        fs_passno: toInt(fields[5]),\n      });\n    }\n  }\n  return entries;\n}\n\n/**\n * Reduces a mount table to one entry per mount point, keeping the **last**\n * entry listed for each path.\n *\n * One path can appear several times in `/proc/self/mounts`. A systemd direct\n * automount keeps its `autofs` trigger entry and mounts the real filesystem\n * *over* it; `mount --bind` and overlay stacking do the same. Each of those\n * appends, so the stacked mount is listed after the entry it hides, and the\n * last entry is the one whose device, fstype, and options describe the volume\n * a caller reaches through `open()`/`statvfs()`.\n *\n * Keeping the first entry instead yields `fstype: \"autofs\"` with\n * `fs_spec: \"systemd-1\"`, which names no block device: blkid and\n * `/dev/disk/by-uuid` then have nothing to resolve, so `uuid` and `label` come\n * back empty while `size`/`used` (read by `statvfs` from the path, which does\n * follow the overmount) describe the real filesystem. `autofs` is also in\n * `SystemFsTypesDefault`, so the volume is misreported as a system volume and\n * dropped from default enumeration.\n *\n * **This is last-wins, not a mount-tree evaluation.** `/proc/self/mounts` states\n * no parent/child relationship between entries, so \"later in the file\" is a\n * proxy for \"stacked on top\" rather than a guarantee of it. `mount --move`\n * re-attaches an already-attached mount without reallocating the internal\n * unique mount ID that orders the listing, so a moved mount keeps its earlier\n * position and can appear *before* the entry it now covers — this function\n * would then return the hidden one. Resolving that needs the mount and parent\n * IDs in `/proc/self/mountinfo`, which this parser does not read.\n *\n * That limitation is accepted: every stacking mechanism this library targets\n * appends, so last-wins is correct for all of them and strictly better than the\n * first-wins it replaced.\n *\n * @param entries Parsed mount table entries, in mount table order\n * @return One entry per mount point, each the last one listed for that path,\n * in order of each mount point's first appearance\n */\nexport function lastMountEntriesByPath(entries: MountEntry[]): MountEntry[] {\n  const byMountPoint = new Map<string, MountEntry>();\n  for (const entry of entries) {\n    // Map.set() on an existing key overwrites the value but keeps the original\n    // insertion position, preserving the mount table's overall ordering.\n    byMountPoint.set(entry.fs_file, entry);\n  }\n  return [...byMountPoint.values()];\n}\n\n/**\n * Formats mount entries back into mtab file format\n * @param entries - Array of mount entries\n * @returns Formatted mtab file content\n */\nexport function formatMtab(entries: MountEntry[]): string {\n  return entries\n    .map((entry) => {\n      const fields = [\n        entry.fs_spec,\n        encodeEscapeSequences(entry.fs_file),\n        entry.fs_vfstype,\n        entry.fs_mntops,\n        entry.fs_freq?.toString(),\n        entry.fs_passno?.toString(),\n      ];\n      return fields.join(\"\\t\");\n    })\n    .join(\"\\n\");\n}\n","import { execFile } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport { TimeoutError, withTimeout } from \"../async\";\nimport { debug } from \"../debuglog\";\n\nconst MaxUint64 = (1n << 64n) - 1n;\nconst MaxOutputBytes = 4096;\n\n/**\n * Milliseconds of the whole-operation deadline reserved for command-timeout\n * cleanup and final result assembly, so the optional ZFS enrichment never\n * races the public {@link withTimeout} deadline.\n */\nexport const ZfsEnrichmentReserveMs = 250;\n\nexport type ZfsCommandRunner = (\n  command: \"zfs\" | \"zpool\",\n  args: string[],\n  timeoutMs: number,\n) => Promise<string>;\n\nexport interface ZfsGuids {\n  zfsDatasetGuid?: string;\n  zfsPoolGuid?: string;\n}\n\n/**\n * Compute the `execFile` timeout for the opt-in ZFS GUID queries from the\n * whole-operation deadline, reserving {@link ZfsEnrichmentReserveMs} for\n * teardown and assembly.\n *\n * @param deadlineMs absolute deadline (`Date.now()`-based), or `undefined` when\n * the caller disabled the timeout (`timeoutMs === 0`).\n * @param nowMs current `Date.now()` value.\n * @returns `0` (no timeout) when there is no deadline, a positive remaining\n * budget when enrichment should run, or `undefined` when the budget is\n * exhausted and enrichment must be skipped.\n */\nexport function zfsEnrichmentTimeoutMs(\n  deadlineMs: number | undefined,\n  nowMs: number,\n  reserveMs: number = ZfsEnrichmentReserveMs,\n): number | undefined {\n  if (deadlineMs == null) return 0;\n  const remaining = Math.floor(deadlineMs - nowMs) - reserveMs;\n  return remaining > 0 ? remaining : undefined;\n}\n\n/** Parse a ZFS GUID without losing precision through a JavaScript number. */\nexport function parseZfsGuid(value: string): string | undefined {\n  const trimmed = value.trim();\n  if (!/^\\d+$/.test(trimmed)) return;\n  const guid = BigInt(trimmed);\n  return guid > 0n && guid <= MaxUint64 ? guid.toString(10) : undefined;\n}\n\nfunction poolName(dataset: string): string | undefined {\n  const trimmed = dataset.trim();\n  if (\n    trimmed !== dataset ||\n    trimmed.length === 0 ||\n    trimmed.startsWith(\"/\") ||\n    trimmed.startsWith(\"-\") ||\n    trimmed.includes(\"//\") ||\n    [...trimmed].some((char) => {\n      const code = char.charCodeAt(0);\n      return code < 32 || code === 127;\n    })\n  ) {\n    return;\n  }\n  const separator = trimmed.search(/[/@#]/);\n  const pool = separator < 0 ? trimmed : trimmed.slice(0, separator);\n  return pool.length === 0 ? undefined : pool;\n}\n\nexport const runZfsCommand = (\n  command: \"zfs\" | \"zpool\",\n  args: string[],\n  timeoutMs: number,\n  exec: typeof execFile = execFile,\n): Promise<string> =>\n  new Promise((resolve, reject) => {\n    let settled = false;\n    let timeoutId: NodeJS.Timeout | undefined;\n    const child = exec(\n      command,\n      args,\n      {\n        encoding: \"utf8\",\n        maxBuffer: MaxOutputBytes,\n        shell: false,\n        windowsHide: true,\n      },\n      (error, stdout) => {\n        if (settled) return;\n        settled = true;\n        if (timeoutId != null) clearTimeout(timeoutId);\n        if (error != null) reject(error);\n        else resolve(stdout);\n      },\n    );\n\n    if (timeoutMs > 0) {\n      timeoutId = setTimeout(() => {\n        if (settled) return;\n        settled = true;\n\n        // This is deliberately SIGTERM, not SIGKILL. These are read-only\n        // commands, but a hard kill still cannot interrupt uninterruptible\n        // kernel IO. Settle independently, close our pipe handles, and unref\n        // the child so optional enrichment cannot fail the metadata call or\n        // keep Node alive while the OS finishes handling the process.\n        child.kill(\"SIGTERM\");\n        child.stdin?.destroy();\n        child.stdout?.destroy();\n        child.stderr?.destroy();\n        child.unref();\n\n        reject(\n          new TimeoutError(\n            `${command} GUID query: timeout after ${timeoutMs}ms`,\n          ),\n        );\n      }, timeoutMs);\n    }\n  });\n\nasync function readGuid(\n  command: \"zfs\" | \"zpool\",\n  args: string[],\n  timeoutMs: number,\n  run: ZfsCommandRunner,\n): Promise<string | undefined> {\n  try {\n    // Bound injected runners as well as the production child process. The\n    // production runner also owns its timer so it can close and unref child\n    // resources; this independent boundary guarantees the fail-open result.\n    const stdout = await withTimeout({\n      desc: `${command} GUID query`,\n      promise: run(command, args, timeoutMs),\n      timeoutMs,\n    });\n    const guid = parseZfsGuid(stdout);\n    if (guid == null) {\n      debug(\"[zfsGuids] %s returned an invalid GUID: %o\", command, stdout);\n    }\n    return guid;\n  } catch (error) {\n    // This is optional enrichment. A missing CLI, insufficient permissions, or\n    // a command timeout must not make otherwise-valid volume metadata fail.\n    debug(\"[zfsGuids] %s GUID query failed: %o\", command, error);\n    return;\n  }\n}\n\ninterface PoolGuidRequest {\n  promise: Promise<string | undefined>;\n  deadlineMs: number | undefined;\n}\n\nconst poolRequestsByRunner = new WeakMap<\n  ZfsCommandRunner,\n  Map<string, PoolGuidRequest>\n>();\n\nfunction timeoutCovers(\n  existingDeadlineMs: number | undefined,\n  callerTimeoutMs: number,\n  nowMs: number,\n) {\n  return (\n    existingDeadlineMs == null ||\n    (callerTimeoutMs !== 0 && existingDeadlineMs >= nowMs + callerTimeoutMs)\n  );\n}\n\nasync function readPoolGuid(\n  pool: string,\n  timeoutMs: number,\n  run: ZfsCommandRunner,\n): Promise<string | undefined> {\n  let requests = poolRequestsByRunner.get(run);\n  if (requests == null) {\n    requests = new Map();\n    poolRequestsByRunner.set(run, requests);\n  }\n  let request = requests.get(pool);\n  const nowMs = Date.now();\n  if (request == null || !timeoutCovers(request.deadlineMs, timeoutMs, nowMs)) {\n    const promise = readGuid(\n      \"zpool\",\n      [\"get\", \"-Hp\", \"-o\", \"value\", \"guid\", pool],\n      timeoutMs,\n      run,\n    );\n    request = {\n      promise,\n      deadlineMs: timeoutMs === 0 ? undefined : nowMs + timeoutMs,\n    };\n    requests.set(pool, request);\n    void promise.finally(() => {\n      if (requests?.get(pool) === request) requests.delete(pool);\n    });\n  }\n\n  // A shorter-budget caller may share a longer (or unbounded) lookup, but it\n  // must retain its own deadline. A longer-budget caller starts a new lookup\n  // instead of inheriting a request that may give up too early.\n  try {\n    return await withTimeout({\n      desc: \"shared zpool GUID query\",\n      promise: request.promise,\n      timeoutMs,\n    });\n  } catch (error) {\n    debug(\"[zfsGuids] shared zpool GUID query failed: %o\", error);\n    return;\n  }\n}\n\n/**\n * Fetch the opt-in, authoritative ZFS GUID properties for a mounted dataset.\n *\n * Queries are shell-free. Failures degrade field-by-field to `undefined`, and\n * pool lookups are shared only while concurrent requests are in flight so an\n * explicit `zpool reguid` is visible to the next metadata call.\n */\nexport async function getZfsGuids({\n  dataset,\n  timeoutMs,\n  run = runZfsCommand,\n}: {\n  dataset: string;\n  timeoutMs: number;\n  run?: ZfsCommandRunner;\n}): Promise<ZfsGuids> {\n  const pool = poolName(dataset);\n  if (pool == null) return {};\n  // The OpenZFS CLI requires the kernel control device. Containers can expose\n  // host ZFS mounts without exposing /dev/zfs; avoid spawning commands that\n  // cannot succeed in that common configuration.\n  if (run === runZfsCommand && !existsSync(\"/dev/zfs\")) {\n    debug(\"[zfsGuids] skipping GUID queries because /dev/zfs is unavailable\");\n    return {};\n  }\n\n  const [zfsDatasetGuid, zfsPoolGuid] = await Promise.all([\n    readGuid(\n      \"zfs\",\n      [\"get\", \"-Hp\", \"-o\", \"value\", \"guid\", dataset],\n      timeoutMs,\n      run,\n    ),\n    readPoolGuid(pool, timeoutMs, run),\n  ]);\n\n  return {\n    ...(zfsDatasetGuid == null ? {} : { zfsDatasetGuid }),\n    ...(zfsPoolGuid == null ? {} : { zfsPoolGuid }),\n  };\n}\n","// src/unc.ts\n\nimport { isBlank, isString } from \"./string\";\nimport { RemoteInfo } from \"./types/remote_info\";\n\n/**\n * Checks if a string is formatted as a valid UNC path.\n * A valid UNC path starts with double backslashes or slashes,\n * followed by a server/host name, and then a share name.\n * The path must use consistent slashes (all forward or all backward).\n *\n * @param path - The string to check\n * @returns boolean - True if the string is a valid UNC path, false otherwise\n */\nexport function parseUNCPath(\n  path: string | null | undefined,\n): RemoteInfo | undefined {\n  if (path == null || isBlank(path) || !isString(path)) {\n    return;\n  }\n\n  // Check for two forward slashes or two backslashes at start\n  if (!path.startsWith(\"\\\\\\\\\") && !path.startsWith(\"//\")) {\n    return;\n  }\n\n  // Determine slash type from the start of the path\n  const isForwardSlash = path.startsWith(\"//\");\n  const slashChar = isForwardSlash ? \"/\" : \"\\\\\";\n\n  // Split path using the correct slash type\n  const parts = path.slice(2).split(slashChar);\n\n  // Check minimum required parts (server and share)\n  if (parts.length < 2) {\n    return;\n  }\n\n  // Validate server and share names exist and aren't empty\n  const [remoteHost, remoteShare] = parts;\n  if (\n    remoteHost == null ||\n    isBlank(remoteHost) ||\n    remoteShare == null ||\n    isBlank(remoteShare)\n  ) {\n    return;\n  }\n\n  // Check for invalid characters in server and share names\n  const invalidChars = /[<>:\"|?*]/;\n  if (invalidChars.test(remoteHost) || invalidChars.test(remoteShare)) {\n    return;\n  }\n\n  // Check for mixed slash usage\n  const wrongSlash = isForwardSlash ? \"\\\\\" : \"/\";\n  if (path.includes(wrongSlash)) {\n    return;\n  }\n\n  return { remoteHost, remoteShare, remote: true };\n}\n","// src/uuid.ts\n\nimport { toS } from \"./string\";\n\nconst uuidRegex = /[a-z0-9][a-z0-9-]{7,}/i;\n\n/**\n * Some volume UUIDs are short, like, `ABCD1234`.\n *\n * Some volume UUIDs are in hexadecimal, but others and use G-Z. We will allow\n * that.\n *\n * Some Windows syscalls wrap the UUID in a \"\\\\\\\\?\\\\Volume{...}\\\\\" prefix and\n * suffix. This function will strip out that prefix and suffix.\n *\n * We will ignore any UUID-ish string that is not at least 8 characters long\n * (and return `undefined` if no other, longer uuid-ish string is found).\n *\n * UUIDs cannot start with a hyphen, and can only contain a-z, 0-9, and hyphens\n * (case-insensitive).\n */\nexport function extractUUID(uuid: string | undefined): string | undefined {\n  return toS(uuid).match(uuidRegex)?.[0];\n}\n","// src/volume_health_status.ts\n\nimport { TimeoutError } from \"./async\";\nimport { debug } from \"./debuglog\";\nimport { toError } from \"./error\";\nimport { canReaddir, canReaddirObservation } from \"./fs\";\nimport { isObject } from \"./object\";\nimport { stringEnum, StringEnumKeys } from \"./string_enum\";\n\n/**\n * Accessibility statuses returned while enumerating volumes.\n *\n * - `healthy`: Volume is \"OK\": accessible and functioning normally\n * - `timeout`: Volume could not be accessed before the specified timeout. It\n *   may be inaccessible or disconnected.\n * - `inaccessible`: Volume exists but can't be accessed (permissions/locks)\n * - `disconnected`: Network volume that's offline\n * - `unknown`: Status can't be determined\n */\nexport const VolumeHealthStatuses = stringEnum(\n  \"healthy\",\n  \"timeout\",\n  \"inaccessible\",\n  \"disconnected\",\n  \"unknown\",\n);\n\nexport type VolumeHealthStatus = StringEnumKeys<typeof VolumeHealthStatuses>;\n\n/**\n * Divisor applied to the caller's whole-call `timeoutMs` to derive a single\n * mount point's health probe budget. See {@link healthProbeTimeoutMs}.\n */\nexport const HealthProbeTimeoutDivisor = 4;\n\n/**\n * Per-mount-point budget for the {@link directoryStatus} probe issued while\n * enumerating volumes, carved out of the caller's whole-call `timeoutMs`.\n *\n * This must stay **strictly below** `timeoutMs`. Enumeration as a whole is also\n * bounded by `timeoutMs`, so a probe granted the full budget can never win that\n * race: the whole call rejects before any probe reports\n * {@link VolumeHealthStatuses.timeout}, and a single wedged mount point takes\n * every other volume down with it instead of being marked and skipped.\n *\n * A probe is one `readdir()`. A healthy volume answers in well under a\n * millisecond, so a quarter of the budget is generous even for a slow network\n * mount, and callers who need longer already have the right lever in\n * `timeoutMs`.\n *\n * @param timeoutMs the caller's whole-call budget; `0` disables timeouts\n * @returns `0` when timeouts are disabled, otherwise a positive budget. Values\n * of `timeoutMs` below 4 are degenerate (everything times out regardless) and\n * collapse to 1.\n */\nexport function healthProbeTimeoutMs(timeoutMs: number): number {\n  // Normalize the way validateTimeoutMs() does before deciding anything: it\n  // floors, so a sub-millisecond budget like 0.5 means \"timeouts disabled\".\n  // Reading the raw value here would turn that into a 1ms probe that times out\n  // every volume.\n  const normalized = Math.floor(timeoutMs);\n  if (normalized <= 0) return 0;\n  // Never round down to zero: withTimeout() reads 0 as \"no timeout\", which\n  // would silently restore the unbounded probe this function exists to prevent.\n  return Math.max(1, Math.floor(normalized / HealthProbeTimeoutDivisor));\n}\n\n/**\n * Attempt to read a directory to determine if it's accessible, and if an error\n * is thrown, convert to a health status.\n * @returns the \"health status\" of the directory, based on the success of `readdir(dir)`.\n * @throws never\n */\nexport async function directoryStatus(\n  dir: string,\n  timeoutMs: number,\n  canReaddirImpl: typeof canReaddir = canReaddir,\n): Promise<{\n  status: VolumeHealthStatus;\n  error?: Error;\n  isDirectory?: boolean;\n}> {\n  try {\n    if (await canReaddirImpl(dir, timeoutMs)) {\n      return { status: VolumeHealthStatuses.healthy, isDirectory: true };\n    }\n  } catch (error) {\n    debug(\"[directoryStatus] %s: %s\", dir, error);\n    let status: VolumeHealthStatus = VolumeHealthStatuses.unknown;\n    if (error instanceof TimeoutError) {\n      status = VolumeHealthStatuses.timeout;\n    } else if (isObject(error) && \"code\" in error) {\n      if (error.code === \"EPERM\" || error.code === \"EACCES\") {\n        status = VolumeHealthStatuses.inaccessible;\n      }\n    }\n    const result = { status, error: toError(error) };\n    return isObject(error) && \"code\" in error && error.code === \"ENOTDIR\"\n      ? { ...result, isDirectory: false }\n      : result;\n  }\n  return { status: VolumeHealthStatuses.unknown };\n}\n\n/**\n * A directory status whose `settled` promise tracks the raw filesystem probe.\n * The visible status can report a timeout before that uncancellable work ends.\n */\nexport function directoryStatusObservation(\n  dir: string,\n  timeoutMs: number,\n): {\n  value: ReturnType<typeof directoryStatus>;\n  settled: Promise<unknown>;\n} {\n  const probe = canReaddirObservation(dir, timeoutMs);\n  return {\n    value: directoryStatus(dir, timeoutMs, () => probe.value),\n    settled: probe.settled,\n  };\n}\n","// src/array.ts\n\n/**\n * Remove duplicate elements from an array.\n *\n * - Primitive values are compared using strict equality.\n * - Objects and arrays are compared by reference.\n *\n * @return A new array with duplicate elements removed\n */\nexport function uniq<T>(arr: T[]): T[] {\n  return Array.from(new Set(arr));\n}\n\n/**\n * Remove duplicate elements from an array based on a key function.\n * @param keyFn A function that returns a key for each element. Elements that\n * the key function returns nullish will be removed from the returned array.\n * @return a new array omitting duplicate elements based on a key function.\n */\nexport function uniqBy<T, K>(arr: T[], keyFn: (item: T) => K | undefined): T[] {\n  const seen = new Set<K>();\n  return arr.filter((item) => {\n    const key = keyFn(item);\n    if (key == null || seen.has(key)) return false;\n    seen.add(key);\n    return true;\n  });\n}\n\n/**\n * @return an array of specified length, with each element created by calling\n * the provided function.\n */\nexport function times<T>(length: number, fn: (index: number) => T): T[] {\n  return Array.from({ length }, (_, i) => fn(i));\n}\n\n/**\n * @return a new array with elements that are not `null` or `undefined`.\n */\nexport function compact<T>(arr: (T | null | undefined)[] | undefined): T[] {\n  return arr == null ? [] : arr.filter((ea): ea is T => ea != null);\n}\n","// src/mount_point.ts\n\nimport { uniqBy } from \"./array\";\nimport { mapConcurrent, validateTimeoutMs, withTimeout } from \"./async\";\nimport { debug } from \"./debuglog\";\nimport { canReaddir } from \"./fs\";\nimport { getLinuxMountPoints } from \"./linux/mount_points\";\nimport { compactValues } from \"./object\";\nimport { isMacOS, isWindows } from \"./platform\";\nimport { isRemoteFsType } from \"./remote_info\";\nimport { isBlank, isNotBlank, sortObjectsByLocale, toNotBlank } from \"./string\";\nimport { assignSystemVolume, SystemVolumeConfig } from \"./system_volume\";\nimport type { MountPoint } from \"./types/mount_point\";\nimport type { NativeBindingsFn } from \"./types/native_bindings\";\nimport type { Options } from \"./types/options\";\nimport { directoryStatus, healthProbeTimeoutMs } from \"./volume_health_status\";\n\nexport type GetVolumeMountPointOptions = Partial<\n  Pick<\n    Options,\n    | \"timeoutMs\"\n    | \"linuxMountTablePaths\"\n    | \"maxConcurrency\"\n    | \"includeSystemVolumes\"\n    | \"skipNetworkVolumes\"\n    | \"networkFsTypes\"\n  > &\n    SystemVolumeConfig\n>;\n\ntype GetVolumeMountPointImplOptions = Required<GetVolumeMountPointOptions> & {\n  /**\n   * Internal path resolution needs every Linux VFS mount, including file bind\n   * mounts. Public volume enumeration omits detected non-directory targets.\n   */\n  includeNonDirectoryMountPoints?: boolean;\n  /**\n   * Skip the per-mount-point `readdir()` health probe.\n   *\n   * The probe exists to report {@link MountPoint.status} and to detect\n   * non-directory targets. Internal path resolution\n   * ({@link findMountPointByDeviceId}) uses neither: it reads only\n   * `mountPoint` and `fstype`, and it already passes\n   * `includeNonDirectoryMountPoints`, which disables the only filter the probe\n   * feeds. Probing there is pure cost — one unreachable mount would delay\n   * *every* path lookup by the probe budget and occupy a libuv worker for it,\n   * which is exactly the hazard the ancestor-only `stat()` partitioning exists\n   * to avoid.\n   *\n   * Forwarded to the native enumerator too. Windows honors it by skipping both\n   * the drive status check and `GetVolumeInformationW`, the two calls that\n   * touch the volume, so a disconnected network drive no longer stalls a lookup\n   * on another drive; those entries then carry only `mountPoint`. macOS never\n   * reaches this code path — both macOS path APIs resolve through targeted\n   * native calls rather than enumeration.\n   */\n  skipHealthProbes?: boolean;\n};\n\nexport async function getVolumeMountPointsImpl(\n  opts: GetVolumeMountPointImplOptions,\n  nativeFn: NativeBindingsFn,\n  canReaddirImpl: typeof canReaddir = canReaddir,\n): Promise<MountPoint[]> {\n  // Validate before starting any work (including native calls) — also on\n  // Windows, which relies on native timeouts and bypasses withTimeout().\n  validateTimeoutMs(opts.timeoutMs, \"getVolumeMountPoints\");\n  const p = _getVolumeMountPoints(opts, nativeFn, canReaddirImpl);\n  return isWindows\n    ? p\n    : withTimeout({ desc: \"getVolumeMountPoints\", ...opts, promise: p });\n}\n\nasync function _getVolumeMountPoints(\n  o: GetVolumeMountPointImplOptions,\n  nativeFn: NativeBindingsFn,\n  canReaddirImpl: typeof canReaddir,\n): Promise<MountPoint[]> {\n  debug(\"[getVolumeMountPoints] gathering mount points with options: %o\", o);\n\n  const raw = await (isWindows || isMacOS\n    ? (async () => {\n        debug(\"[getVolumeMountPoints] using native implementation\");\n        // macOS runs its own accessibility probe per mount inside this call,\n        // deadlined from the timeoutMs it receives. Handing it the whole budget\n        // loses the same race the TypeScript probe below was losing: the outer\n        // withTimeout() started first, so one wedged mount rejected the entire\n        // enumeration instead of being reported as `timeout`. Give the native\n        // phase the same fraction. Windows enforces its own per-call timeouts\n        // and has no outer deadline, so it keeps the full value.\n        const points = await (\n          await nativeFn()\n        ).getVolumeMountPoints(\n          isMacOS ? { ...o, timeoutMs: healthProbeTimeoutMs(o.timeoutMs) } : o,\n        );\n        debug(\n          \"[getVolumeMountPoints] native returned %d mount points\",\n          points.length,\n        );\n        return points;\n      })()\n    : getLinuxMountPoints(o));\n\n  debug(\"[getVolumeMountPoints] raw mount points: %o\", raw);\n\n  const compacted = raw\n    .map((ea) => compactValues(ea) as MountPoint)\n    .filter((ea) => isNotBlank(ea.mountPoint));\n\n  // The candidate-only route includes system volumes unconditionally and reads\n  // only mountPoint. Avoid manufacturing isSystemVolume on its deliberately\n  // minimal Windows records.\n  if (!o.skipHealthProbes) {\n    for (const ea of compacted) {\n      assignSystemVolume(ea, o);\n    }\n  }\n\n  const filtered = o.includeSystemVolumes\n    ? compacted\n    : compacted.filter((ea) => !ea.isSystemVolume);\n\n  const uniq = uniqBy(filtered, (ea) => toNotBlank(ea.mountPoint));\n  debug(\"[getVolumeMountPoints] found %d unique mount points\", uniq.length);\n\n  const results = sortObjectsByLocale(uniq, (ea) => ea.mountPoint);\n  debug(\n    \"[getVolumeMountPoints] getting status for %d mount points\",\n    results.length,\n  );\n\n  // Each probe gets a fraction of the whole-call budget, never all of it: this\n  // call is itself wrapped in withTimeout(o.timeoutMs), so an equal per-probe\n  // budget means the enumeration rejects before any single wedged mount point\n  // can be marked `timeout` and stepped over.\n  //\n  // Windows is exempt: getVolumeMountPointsImpl() returns the raw promise there\n  // (native code enforces its own timeouts), so there is no outer deadline to\n  // lose the race to. Shortening the probe would only make a slow-but-healthy\n  // drive that answers within the caller's budget report `timeout` and be\n  // skipped by getAllVolumeMetadata().\n  const probeTimeoutMs = isWindows\n    ? o.timeoutMs\n    : healthProbeTimeoutMs(o.timeoutMs);\n\n  const nonDirectoryMountPoints = new Set<string>();\n  await mapConcurrent({\n    maxConcurrency: o.maxConcurrency,\n    items: results.filter(\n      (ea) =>\n        // skipHealthProbes: callers that read neither status nor the\n        // non-directory filter must not pay for — or block on — the probe.\n        !o.skipHealthProbes &&\n        // trust but verify\n        (isBlank(ea.status) || ea.status === \"healthy\") &&\n        // skipNetworkVolumes: don't health-probe remote volumes — a dead\n        // network mount can hang the readdir() probe. Their status is left\n        // as reported (undefined on Linux). See Options.skipNetworkVolumes.\n        !(o.skipNetworkVolumes && isRemoteFsType(ea.fstype, o.networkFsTypes)),\n    ),\n    fn: async (mp) => {\n      debug(\"[getVolumeMountPoints] checking status of %s\", mp.mountPoint);\n      const result = await directoryStatus(\n        mp.mountPoint,\n        probeTimeoutMs,\n        canReaddirImpl,\n      );\n      mp.status = result.status;\n      if (result.isDirectory === false) {\n        nonDirectoryMountPoints.add(mp.mountPoint);\n      }\n      debug(\n        \"[getVolumeMountPoints] status for %s: %s\",\n        mp.mountPoint,\n        mp.status,\n      );\n    },\n  });\n\n  const visibleResults = o.includeNonDirectoryMountPoints\n    ? results\n    : results.filter((ea) => !nonDirectoryMountPoints.has(ea.mountPoint));\n  debug(\n    \"[getVolumeMountPoints] completed with %d mount points\",\n    visibleResults.length,\n  );\n  return visibleResults;\n}\n","import { mapConcurrent, validateTimeoutMs, withTimeout } from \"./async\";\nimport { getTimeoutMsDefault, optionsWithDefaults } from \"./options\";\nimport { isLinux, isWindows } from \"./platform\";\nimport {\n  type PollingSubscription,\n  type PollingWatcherOptions,\n  type PollObservation,\n  PollingWatcher,\n  resolvedObservation,\n} from \"./polling_watcher\";\nimport { isRemoteFsType } from \"./remote_info\";\nimport { assignSystemVolume } from \"./system_volume\";\nimport type { MountPoint } from \"./types/mount_point\";\nimport type { NativeBindingsFn } from \"./types/native_bindings\";\nimport {\n  directoryStatusObservation,\n  healthProbeTimeoutMs,\n} from \"./volume_health_status\";\nimport type { GetVolumeMountPointOptions } from \"./volume_mount_points\";\nimport { getVolumeMountPointsImpl } from \"./volume_mount_points\";\n\nexport type WatchVolumeMountPointsOptions = GetVolumeMountPointOptions &\n  PollingWatcherOptions;\n\nexport function validateVolumeMountWatcherOptions(\n  options: WatchVolumeMountPointsOptions,\n  windows = isWindows,\n): void {\n  if (windows && options.systemFsTypes != null) {\n    throw new TypeError(\n      \"watchVolumeMountPoints does not support systemFsTypes on Windows because shallow drive enumeration does not query filesystem types\",\n    );\n  }\n}\n\nexport interface VolumeMountChange {\n  /** Monotonically increasing generation of emitted changes. */\n  generation: number;\n  /** Mount points present in the current snapshot but not the prior one. */\n  added: readonly MountPoint[];\n  /** Last-observed records absent from the current snapshot. */\n  removed: readonly MountPoint[];\n}\n\nexport type VolumeMountChangeListener = (change: VolumeMountChange) => void;\n\nexport type VolumeMountWatcher = PollingSubscription<\n  readonly MountPoint[],\n  VolumeMountChange\n>;\n\ntype MountPointSnapshot = () =>\n  Promise<MountPoint[]> | PollObservation<MountPoint[]>;\n\nfunction mountPointObservation(\n  snapshot: ReturnType<MountPointSnapshot>,\n): PollObservation<MountPoint[]> {\n  return \"value\" in snapshot ? snapshot : resolvedObservation(snapshot);\n}\n\nexport function volumeMountPathKey(\n  mountPoint: string,\n  caseInsensitive = isWindows,\n): string {\n  return caseInsensitive ? mountPoint.toLowerCase() : mountPoint;\n}\n\nexport function createVolumeMountWatcher(\n  options: PollingWatcherOptions &\n    Pick<GetVolumeMountPointOptions, \"timeoutMs\">,\n  scan: MountPointSnapshot,\n  listener?: VolumeMountChangeListener,\n): VolumeMountWatcher {\n  let generation = 0;\n  const timeoutMs = validateTimeoutMs(\n    options.timeoutMs ?? getTimeoutMsDefault(),\n    \"watchVolumeMountPoints\",\n  );\n  const watcher = new PollingWatcher<readonly MountPoint[], VolumeMountChange>(\n    options,\n    () => {\n      const observation = mountPointObservation(scan());\n      return {\n        value: withTimeout({\n          desc: \"watchVolumeMountPoints\",\n          promise: observation.value,\n          timeoutMs,\n        }),\n        // A caller-visible timeout cannot cancel native or filesystem work.\n        // Preserve the raw settled promise so PollingWatcher never overlaps it.\n        settled: observation.settled,\n      };\n    },\n    (previous, current) => {\n      const previousPaths = new Set(\n        previous.map((ea) => volumeMountPathKey(ea.mountPoint)),\n      );\n      const currentPaths = new Set(\n        current.map((ea) => volumeMountPathKey(ea.mountPoint)),\n      );\n      const added = current\n        .filter((ea) => !previousPaths.has(volumeMountPathKey(ea.mountPoint)))\n        .map((ea) => ({ ...ea }));\n      const removed = previous\n        .filter((ea) => !currentPaths.has(volumeMountPathKey(ea.mountPoint)))\n        .map((ea) => ({ ...ea }));\n      return added.length === 0 && removed.length === 0\n        ? undefined\n        : { generation: ++generation, added, removed };\n    },\n    (snapshot) => snapshot.map((point) => ({ ...point })),\n  );\n  if (listener != null) watcher.on(\"change\", listener);\n  return watcher as VolumeMountWatcher;\n}\n\nexport function watchVolumeMountPointsImpl(\n  options: WatchVolumeMountPointsOptions,\n  nativeFn: NativeBindingsFn,\n  listener?: VolumeMountChangeListener,\n): VolumeMountWatcher {\n  validateVolumeMountWatcherOptions(options);\n  const resolved = optionsWithDefaults(options);\n  const includeSystemVolumes = resolved.includeSystemVolumes;\n  const targetVisibility = new Map<string, boolean>();\n  const scan = (): PollObservation<MountPoint[]> => {\n    const pendingProbes: Promise<unknown>[] = [];\n    const value = (async (): Promise<MountPoint[]> => {\n      // Internal shallow enumeration deliberately skips TypeScript\n      // system-volume classification for path-resolution callers. Request\n      // every entry, clone it, classify without touching the mounted path, and\n      // only then apply this watcher's requested filter.\n      const points = await getVolumeMountPointsImpl(\n        {\n          ...resolved,\n          // Keep the inner operation raw. createVolumeMountWatcher() applies\n          // the caller-visible timeout separately while retaining this scan's\n          // settled promise, so a timeout can be reported without overlapping\n          // the uncancellable native/filesystem work.\n          includeSystemVolumes: true,\n          skipHealthProbes: true,\n          timeoutMs: 0,\n        },\n        nativeFn,\n      );\n\n      const classified = points.map((point) => {\n        const copy = { ...point };\n        delete copy.status;\n        delete copy.error;\n        assignSystemVolume(copy, resolved);\n        return copy;\n      });\n      const systemFiltered = includeSystemVolumes\n        ? classified\n        : classified.filter((point) => !point.isSystemVolume);\n\n      if (!isLinux) return systemFiltered;\n      const currentPaths = new Set(\n        systemFiltered.map((point) => point.mountPoint),\n      );\n      for (const knownPath of targetVisibility.keys()) {\n        if (!currentPaths.has(knownPath)) targetVisibility.delete(knownPath);\n      }\n\n      // Public Linux enumeration omits local file bind-mount targets. Shallow\n      // snapshots cannot know the target type, so probe only newly seen local\n      // paths once rather than readdir()ing every mount on every interval.\n      // Remote paths are always retained without probing because topology\n      // observation has no use for their accessibility status.\n      const unknown = systemFiltered.filter(\n        (point) => !targetVisibility.has(point.mountPoint),\n      );\n      await mapConcurrent({\n        items: unknown,\n        maxConcurrency: resolved.maxConcurrency,\n        fn: async (point) => {\n          if (isRemoteFsType(point.fstype, resolved.networkFsTypes)) {\n            targetVisibility.set(point.mountPoint, true);\n            return;\n          }\n          const observation = directoryStatusObservation(\n            point.mountPoint,\n            healthProbeTimeoutMs(resolved.timeoutMs),\n          );\n          pendingProbes.push(observation.settled);\n          const status = await observation.value;\n          targetVisibility.set(point.mountPoint, status.isDirectory !== false);\n        },\n      });\n      return systemFiltered.filter(\n        (point) => targetVisibility.get(point.mountPoint) !== false,\n      );\n    })();\n    const settled = value.then(\n      () => Promise.allSettled(pendingProbes),\n      () => Promise.allSettled(pendingProbes),\n    );\n    return { value, settled };\n  };\n  return createVolumeMountWatcher(options, scan, listener);\n}\n"],"mappings":";AACA,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAE9B,IAAM,cAAc,MAAM,cAAc,YAAY,GAAG;AACvD,IAAM,aAAa,MAAM,KAAK,QAAQ,YAAY,CAAC;AAE5C,IAAM,YAA4B,2BAAW;;;ACLpD,OAAO,kBAAkB;;;ACFzB,SAAS,cAAc;;;ACAvB,SAAS,4BAA4B;AACrC,SAAS,WAAW;;;ACCb,SAAS,SAAS,OAAiC;AACxD,SAAO,OAAO,UAAU,YAAY,SAAS,KAA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O,sBAAsB,UAAU,QAAQ;AACjD;AAgBO,SAAS,UACd,UACA,QACA,SAAqB,QACK;AAC1B,SAAO,cAAc,UAAU,QAAQ,QAAQ,QAAQ;AACzD;","names":["availableParallelism","env","env","availableParallelism","resolve","path","defer","path","path","dirname","join","dirname","resolve","resolve","path","dirname","nativeFn","path","dirname","join","isHidden","realpath","dirname","dirname","join","resolve","resolve","join","patterns","patterns","existsSync","resolve","existsSync","path","nativeFn","nativeFn","status","dirname","nativeFn","realpath","dirname","nativeFn","defer","dirname"]}