// 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":{"access-control-allow-origin":"*","date":"Mon, 27 Jul 2026 03:21:08 GMT","content-type":"text/typescript","cf-ray":"a21883231a17a177-IAD","cf-cache-status":"HIT","vary":"Origin","x-jsr-backend":"modules","content-length":"1055","set-cookie":"__cf_bm=1ORojNnidtqRz7DPCNbe5tz8u6Sb68K9uCE0zn8haa8-1785122468.3401406-1.0.1.1-geOawOgOFnE7s3QgEsFtvhuzAwzO_uPa.DShsZw9hr03vIL.BIgigPxNKUmnNOcD.ieTxlgc1HMRssqiY3hMpj2ARR2uvsiPlX_YCOltbdNW0BGKCt1ou5qoTg5154N9; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Mon, 27 Jul 2026 03:51:08 GMT","accept-ranges":"bytes","server":"cloudflare","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';","cross-origin-resource-policy":"cross-origin","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","x-robots-tag":"noindex","cache-control":"public, max-age=31536000, immutable","alt-svc":"h3=\":443\"; ma=86400","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=3lJiKHIMFee1BzcuErgBB9t97GdNWFlje%2BG%2BJrxTBmoCf8xyIWR6F100qJVUzL0wpIY53JC35egKwEe%2BO3bx%2BVMCitVXhsGuT%2FsRb1i%2BGCL9QX9fV%2Fy0JeQ%3D\"}]}","x-content-type-options":"nosniff","age":"1535261","access-control-expose-headers":"*","etag":"\"d15991935c2cb42513547fbca0acb2f2\""},"url":"https://jsr.io/@std/path/0.224.0/_interface.ts","time":1785122468}