// 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":{"cf-ray":"a52b9e55d80d13aa-LAX","date":"Fri, 30 Oct 2026 15:57:55 GMT","access-control-expose-headers":"*","set-cookie":"__cf_bm=3P9X68IOABWEVNrHePeUkX6ayFVXOS43R8MWFCZ2PPA-1793375875.53345-1.0.1.1-Nid9wc03DqfxbXvm_iVUQw3eeWVuKg_jEWGBChG5bDpXF.xmOriksJTN7xU0ucvUFT5LZxVaJeA.xrLwninLZhjhHzyf5Zh9cbWDP4lCgiYv3zbqmXTIJKOutWYUpUnu; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Fri, 30 Oct 2026 16:27:55 GMT","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';","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","accept-ranges":"bytes","age":"2621998","etag":"\"d15991935c2cb42513547fbca0acb2f2\"","x-robots-tag":"noindex","server":"cloudflare","cache-control":"public, max-age=31536000, immutable","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=XW3IwRVlC9a7dYLqK0R0pXqS0LQkev9TcFjogb6petRsMrn2vkdWUh63YhhdM%2B3UNj78%2BzH%2BfkLVghcnmZ4pfaJgDiy%2FEE4i6AeB9wFYuHDijGOvGmrtimk%3D\"}]}","content-type":"text/typescript","cf-cache-status":"HIT","cross-origin-resource-policy":"cross-origin","alt-svc":"h3=\":443\"; ma=86400","x-jsr-backend":"modules","access-control-allow-origin":"*","vary":"Origin","x-content-type-options":"nosniff","content-length":"1055"},"url":"https://jsr.io/@std/path/0.224.0/_interface.ts","time":1793375875}