// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.

/**
 * A parsed path object generated by path.parse() or consumed by path.format().
 *
 * @example
 * ```ts
 * import { parse } from "@std/path";
 *
 * const parsedPathObj = parse("c:\\path\\dir\\index.html");
 * parsedPathObj.root; // "c:\\"
 * parsedPathObj.dir; // "c:\\path\\dir"
 * parsedPathObj.base; // "index.html"
 * parsedPathObj.ext; // ".html"
 * parsedPathObj.name; // "index"
 * ```
 */
export interface ParsedPath {
  /**
   * The root of the path such as '/' or 'c:\'
   */
  root: string;
  /**
   * The full directory path of the parent such as '/home/user/dir' or 'c:\path\dir'
   */
  dir: string;
  /**
   * The file name including extension (if any) such as 'index.html'
   */
  base: string;
  /**
   * The file extension (if any) such as '.html'
   */
  ext: string;
  /**
   * The file name without extension (if any) such as 'index'
   */
  name: string;
}

export type FormatInputPathObject = Partial<ParsedPath>;

// denoCacheMetadata={"headers":{"content-type":"text/typescript","cache-control":"public, max-age=31536000, immutable","x-guploader-uploadid":"AAwnv3LG95dhaZO8pbNRurSeerYi4OOboDJiuN2AJc8HBaL6Fo3LLJGDeKxwfFRGyHWy73hln9q3moPP4QxVTg","x-goog-stored-content-length":"1055","x-jsr-cache-id":"IAD","age":"0","x-jsr-cache-status":"revalidated","access-control-expose-headers":"*","etag":"\"d15991935c2cb42513547fbca0acb2f2\"","accept-ranges":"bytes","content-length":"1055","date":"Mon, 29 Sep 2025 23:14:28 GMT","x-goog-generation":"1714030766793035","cross-origin-resource-policy":"cross-origin","x-goog-hash":"crc32c=dXsPmA==,md5=0VmRk1wstCUTVH+8oKyy8g==","server":"UploadServer","x-goog-stored-content-encoding":"identity","x-content-type-options":"nosniff","x-goog-storage-class":"STANDARD","x-goog-metageneration":"1","expires":"Tue, 29 Sep 2026 23:14:28 GMT","last-modified":"Thu, 25 Apr 2024 07:39:26 GMT","access-control-allow-origin":"*","content-security-policy":"default-src 'none'; script-src 'none'; style-src 'none'; img-src 'none'; font-src 'none'; connect-src 'none'; frame-src 'none'; object-src 'none'; frame-ancestors 'none'; sandbox; form-action 'none';","alt-svc":"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000","via":"1.1 google","x-robots-tag":"noindex"},"url":"https://jsr.io/@std/path/0.224.0/_interface.ts","time":1759187668}