// 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":{"content-length":"1055","age":"5754188","set-cookie":"__cf_bm=rJ6gNQXv_QzQxcKZJTpf31XUnwmZAEgb9QI5HdBrF0Y-1793595433.9310164-1.0.1.1-cJj2EwZD4xrAVVin4OLPt7b_qY93dS7uskYjJON_DTI9zh.wJcVsEPj27zXltJHN_oaNSKiDlNnWTakorpKSDxcOgbQ9cwGnIqV2GjJcA9aM6GIZXSLCc_oDNzLFJXLD; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Mon, 02 Nov 2026 05:27:13 GMT","server":"cloudflare","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=V%2F45OQD2kb3RVaRrb%2BYzZAHssnX68D5XzbQUMKVcDe%2FEG%2Bl0MpIPUxp7uujm%2FTd0q8VFM%2BkczvnvzBhvNeOi7t4mUtbwSsuZQLlt5tYYLmH%2BsQ8pcp8tcQo%3D\"}]}","access-control-allow-origin":"*","cross-origin-resource-policy":"cross-origin","x-jsr-backend":"modules","x-robots-tag":"noindex","cf-cache-status":"HIT","etag":"\"d15991935c2cb42513547fbca0acb2f2\"","alt-svc":"h3=\":443\"; ma=86400","date":"Mon, 02 Nov 2026 04:57:13 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';","cf-ray":"a5408ea5cbadd6dc-IAD","access-control-expose-headers":"*","x-content-type-options":"nosniff","content-type":"text/typescript","cache-control":"public, max-age=31536000, immutable","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","accept-ranges":"bytes","vary":"Origin"},"url":"https://jsr.io/@std/path/0.224.0/_interface.ts","time":1793595433}