// 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=sb4GMh35Qkev6lZNDz6KkQUEt3w6SV9s.JGTqvRTjcI-1793358906.6592484-1.0.1.1-DarEQ_1jUffNQ.tBdjsiFKpyQWQgfjzmhQe6ZqB9B43fLi4KExdl.BwlUEH7rbdt4tbcR_sOhvT85YZ6iPgnzjeGHRAOw.MUIfVy6zl246Xc2CXqK9nRIEx0m9U8oPZL; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Fri, 30 Oct 2026 11:45:06 GMT","cross-origin-resource-policy":"cross-origin","content-type":"text/typescript","content-length":"1055","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","cf-cache-status":"HIT","x-content-type-options":"nosniff","server":"cloudflare","x-jsr-backend":"modules","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=qz0QgsBP%2FTR7fgWhbY%2FMLimcqu1duhjbVpWlGiMQe3f1FlpgOTfWi%2FGK8ZbmIv2kkQjjr14VgV4XktbifDbXcGUwhyrWfAn7Q1D1I%2FZ%2BZHNU3RCxbG96NhE%3D\"}]}","alt-svc":"h3=\":443\"; ma=86400","cf-ray":"a52a000e5af5c501-SJC","age":"5517442","vary":"Origin","access-control-expose-headers":"*","cache-control":"public, max-age=31536000, immutable","x-robots-tag":"noindex","date":"Fri, 30 Oct 2026 11:15:06 GMT","accept-ranges":"bytes","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';","access-control-allow-origin":"*","etag":"\"d15991935c2cb42513547fbca0acb2f2\""},"url":"https://jsr.io/@std/path/0.224.0/_interface.ts","time":1793358906}