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

import { isWindows } from "./_os.ts";
import { join as posixJoin } from "./posix/join.ts";
import { join as windowsJoin } from "./windows/join.ts";

/**
 * Join all given a sequence of `paths`,then normalizes the resulting path.
 * @param paths to be joined and normalized
 */
export function join(...paths: string[]): string {
  return isWindows ? windowsJoin(...paths) : posixJoin(...paths);
}

// denoCacheMetadata={"headers":{"x-robots-tag":"noindex","cf-ray":"a223e6579a197db6-LAX","set-cookie":"__cf_bm=3g.dj16LQcE.4fkLzvbz6.E_RM04G_uEjwkLTdTMkro-1785241875.140849-1.0.1.1-GeSk7DR1VsEzT1GvNInji4bo3nMlgwvOOJedOXf9SncoGSSsuif6kGvspH0T5R6Z_IESzyppFQlWobhERc14pf1yqGIRwpvd8n1xCv138vW0DeFXErWTovWzGinpqvQl; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Tue, 28 Jul 2026 13:01:15 GMT","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=4eo6Iv2Ywn9bBf6zqoN3%2FT9J9jDqbkP8RuFm4RDRb%2F%2Fe5OzPaDQniwDGNutfh%2F4tf4mKCgd3BoyTgHKGJGuKXHo0nFUiniCK1LV0fp1Fb1xvLpZuwSbHSFg%3D\"}]}","age":"4275755","accept-ranges":"bytes","content-type":"text/typescript","cross-origin-resource-policy":"cross-origin","x-content-type-options":"nosniff","access-control-expose-headers":"*","access-control-allow-origin":"*","cf-cache-status":"HIT","date":"Tue, 28 Jul 2026 12:31:15 GMT","cache-control":"public, max-age=31536000, immutable","etag":"\"7fc0d9ef3d30d31e41b6fc8abb3f45d5\"","vary":"Origin","x-jsr-backend":"modules","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}","alt-svc":"h3=\":443\"; ma=86400","server":"cloudflare","content-length":"510"},"url":"https://jsr.io/@std/path/0.224.0/join.ts","time":1785241875}