"use strict";
/* Socket Lib - Built with esbuild */
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var conversion_exports = {};
__export(conversion_exports, {
  fromUnixPath: () => fromUnixPath,
  splitPath: () => splitPath,
  toUnixPath: () => toUnixPath,
  trimLeadingDotSlash: () => trimLeadingDotSlash
});
module.exports = __toCommonJS(conversion_exports);
var import_platform = require("../constants/platform");
var import_string = require("../primordials/string");
var import_internal = require("./_internal");
var import_normalize = require("./normalize");
// @__NO_SIDE_EFFECTS__
function fromUnixPath(pathLike) {
  const normalized = (0, import_normalize.normalizePath)(pathLike);
  if (import_platform.WIN32) {
    return normalized.replace(/\//g, "\\");
  }
  return normalized;
}
// @__NO_SIDE_EFFECTS__
function splitPath(pathLike) {
  const filepath = (0, import_internal.pathLikeToString)(pathLike);
  if (filepath === "") {
    return [];
  }
  return filepath.split(import_internal.slashRegExp);
}
// @__NO_SIDE_EFFECTS__
function toUnixPath(pathLike) {
  const normalized = (0, import_normalize.normalizePath)(pathLike);
  if (import_platform.WIN32) {
    return normalized.replace(
      /^([A-Z]):/i,
      (_, letter) => `/${letter.toLowerCase()}`
    );
  }
  return normalized;
}
// @__NO_SIDE_EFFECTS__
function trimLeadingDotSlash(pathLike) {
  const filepath = (0, import_internal.pathLikeToString)(pathLike);
  if ((0, import_string.StringPrototypeStartsWith)(filepath, "./") || (0, import_string.StringPrototypeStartsWith)(filepath, ".\\")) {
    return filepath.slice(2);
  }
  return filepath;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  fromUnixPath,
  splitPath,
  toUnixPath,
  trimLeadingDotSlash
});
