// 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":{"set-cookie":"__cf_bm=hW__0fDnOh6_5AkJhQbvcCISfVpeUhoFmehxVbk77Ww-1791780809.6486866-1.0.1.1-5rDjC8AFI4NVtNwPXE13Pq.x_eEBMyiDnBzlI.vsEC52L7nWxMDQIBfDOGv6..hz76r.UedTOFmm9e89sKk4CXHniqQ5SXYKpDPUXnX93oMP.wTClByxvOVjQDLMesoB; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Mon, 12 Oct 2026 05:23:29 GMT","cache-control":"public, max-age=31536000, immutable","date":"Mon, 12 Oct 2026 04:53:29 GMT","cf-cache-status":"HIT","cross-origin-resource-policy":"cross-origin","server":"cloudflare","access-control-expose-headers":"*","alt-svc":"h3=\":443\"; ma=86400","x-content-type-options":"nosniff","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","content-type":"text/typescript","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';","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=5zIk3M9Oc0CfMaC7fsozXhDRRB%2FuPORii6UrPZlLOmSLf5CDHvlCUKhNuHGRg4BCmS%2BFJ%2FZyGn9AUae5%2FV3mrBewQOq4UXZrU4YsuCxy%2B%2BioGJMhrK6qIbg%3D\"}]}","x-robots-tag":"noindex","content-length":"1055","cf-ray":"a493804c3d6ff3c4-IAD","accept-ranges":"bytes","etag":"\"d15991935c2cb42513547fbca0acb2f2\"","age":"3939564","access-control-allow-origin":"*","vary":"Origin","x-jsr-backend":"modules"},"url":"https://jsr.io/@std/path/0.224.0/_interface.ts","time":1791780809}