// 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":{"alt-svc":"h3=\":443\"; ma=86400","cross-origin-resource-policy":"cross-origin","set-cookie":"__cf_bm=a2d_iyBPXWO4pkCCjbxxMdmeoQoFyB3TWrd9Q_h6s9A-1785122507.9447682-1.0.1.1-eG_aZzetwzQhtLE0kg_pvku74I7_9G5.T.hzu4LdfM3jEArYW.FEYGtECrYTo2_yE4fglu0AUNsUxyxiidd9CNPEnZDa4qXr2PXyUx4juFvq5amhVTbQnXamV6cZpmpm; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Mon, 27 Jul 2026 03:51:47 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';","etag":"\"d15991935c2cb42513547fbca0acb2f2\"","x-content-type-options":"nosniff","age":"1535301","date":"Mon, 27 Jul 2026 03:21:47 GMT","accept-ranges":"bytes","access-control-allow-origin":"*","cache-control":"public, max-age=31536000, immutable","content-length":"1055","access-control-expose-headers":"*","vary":"Origin","cf-ray":"a218841a9f32c637-IAD","server":"cloudflare","x-robots-tag":"noindex","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=%2BXOvN8tMhCucAR8cpbR8xyM3DFmjW33CDJUmVo7OSKiLnQcq35M3sMclnngmP9LMh0jpbp0xYXwT4Sw35jOo5IgZHkdHrQ3zEETwlqtG%2F6Req%2FRPEuiren4%3D\"}]}","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","x-jsr-backend":"modules","content-type":"text/typescript","cf-cache-status":"HIT"},"url":"https://jsr.io/@std/path/0.224.0/_interface.ts","time":1785122507}