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

import { isWindows } from "./_os.ts";
import { toNamespacedPath as posixToNamespacedPath } from "./posix/to_namespaced_path.ts";
import { toNamespacedPath as windowsToNamespacedPath } from "./windows/to_namespaced_path.ts";

/**
 * Resolves path to a namespace path
 * @param path to resolve to namespace
 */
export function toNamespacedPath(path: string): string {
  return isWindows
    ? windowsToNamespacedPath(path)
    : posixToNamespacedPath(path);
}

// denoCacheMetadata={"headers":{"content-type":"text/typescript","age":"1636554","x-jsr-backend":"modules","access-control-expose-headers":"*","cf-ray":"a223e657ba417db6-LAX","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=2V1SmR6V%2BOfgoB80GRApw5PVqK7IQMGCmcNt5Ni0Mv%2FM1jAF9NCkpgs0SO8wySXJbWzE3ZhlZgb3bk6%2BaoP16aUwrdAE2k4LAnlCY6bZ7B5LjalK6Kl1mMw%3D\"}]}","etag":"\"6a20985f6b3bc35154bf49110be21f85\"","server":"cloudflare","cross-origin-resource-policy":"cross-origin","x-robots-tag":"noindex","content-length":"572","alt-svc":"h3=\":443\"; ma=86400","access-control-allow-origin":"*","x-content-type-options":"nosniff","cache-control":"public, max-age=31536000, immutable","date":"Tue, 28 Jul 2026 12:31:15 GMT","accept-ranges":"bytes","vary":"Origin","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';","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","set-cookie":"__cf_bm=.NFJxMB4prAhL3.Gl9x.ptEWJ46718pqpmJxPAiWcL0-1785241875.1516213-1.0.1.1-D8015TwWDy4IiocC4r9nb9e6mUEWv5pzazXZnyZF__EZlFNyIFL3gzR2t.1uyxih4JA2D1zueuYMBt0trBoN0Fdio6vb7GJDN3_6ne_j1.fCutybmMrNbPxC7DNKyBrW; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Tue, 28 Jul 2026 13:01:15 GMT","cf-cache-status":"HIT"},"url":"https://jsr.io/@std/path/0.224.0/to_namespaced_path.ts","time":1785241875}