// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.

import { isWindows } from "./_os.ts";
import { normalize as posixNormalize } from "./posix/normalize.ts";
import { normalize as windowsNormalize } from "./windows/normalize.ts";
/**
 * Normalize the `path`, resolving `'..'` and `'.'` segments.
 * Note that resolving these segments does not necessarily mean that all will be eliminated.
 * A `'..'` at the top-level will be preserved, and an empty path is canonically `'.'`.
 * @param path to be normalized
 */
export function normalize(path: string): string {
  return isWindows ? windowsNormalize(path) : posixNormalize(path);
}

// denoCacheMetadata={"headers":{"cf-cache-status":"HIT","age":"4275755","set-cookie":"__cf_bm=8vYhRcGsZa2eDRMkm7g.n0BPZwueBBwID65C6_e_7X8-1785241875.1411896-1.0.1.1-.70r.1eFpDRd7tv2xuoEy2rWJot0rV7mH3B81pPePNU6gWC6uoYD8wNlyV8P3ac_jbvm3jaCGHoK.G9zBtVqjJC0fGLaX2iUDdQkq7kf5IG8jn_HhScCz85muVqoZJkQ; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Tue, 28 Jul 2026 13:01:15 GMT","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=2Q8WDFmzx2ZYsOl07%2FKjhSYMdqxiZuSOhzFWWheavnfSkSHPXJzMqwXIu6%2FYCBW9UlneV4qsmjPGfkjTDQaLnKP%2FefuLNrgWEGL8F5ykt7egXW35HNJW4CM%3D\"}]}","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';","etag":"\"4e46f7ab3bb4bf09249a59200563334d\"","content-type":"text/typescript","cross-origin-resource-policy":"cross-origin","access-control-allow-origin":"*","x-jsr-backend":"modules","date":"Tue, 28 Jul 2026 12:31:15 GMT","x-robots-tag":"noindex","alt-svc":"h3=\":443\"; ma=86400","content-length":"695","cache-control":"public, max-age=31536000, immutable","vary":"Origin","server":"cloudflare","access-control-expose-headers":"*","x-content-type-options":"nosniff","cf-ray":"a223e6579a1c7db6-LAX"},"url":"https://jsr.io/@std/path/0.224.0/normalize.ts","time":1785241875}