// 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-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=xEK6keOJTAGmKjdV4eJSkCQkp9A315RYTQTLezTKZBESRx2z38uf7CVINfyNewwVD%2BJlPwLKigXS5Ezmet705E0Puh6PzRibkvCyr52A6Ow7ov%2Bn11vOmYk%3D\"}]}","etag":"\"d15991935c2cb42513547fbca0acb2f2\"","set-cookie":"__cf_bm=CFp_280SqJ_XqCkFZOqHwouBKN7qc7zB8ob5ivrcEcU-1793595416.2902355-1.0.1.1-wKK9pKDTPCNa6KCxqcTpPAR_pRWvBsHuwKanbuOuXBO98ziav9J8HSRUUXZSwELxOwWbUP_81vMnzXKXVqzLmMyID7M4L6.1GJd6.8Ej0S3E2XZ3tivx26sd_QEICvR3; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Mon, 02 Nov 2026 05:26:56 GMT","x-content-type-options":"nosniff","access-control-expose-headers":"*","access-control-allow-origin":"*","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","alt-svc":"h3=\":443\"; ma=86400","cf-ray":"a5408e37785431bb-IAD","content-type":"text/typescript","cf-cache-status":"HIT","cache-control":"public, max-age=31536000, immutable","server":"cloudflare","content-length":"1055","accept-ranges":"bytes","age":"5754170","vary":"Origin","date":"Mon, 02 Nov 2026 04:56:56 GMT","cross-origin-resource-policy":"cross-origin","x-robots-tag":"noindex","x-jsr-backend":"modules"},"url":"https://jsr.io/@std/path/0.224.0/_interface.ts","time":1793595416}