"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 padding_exports = {};
__export(padding_exports, {
  displayWidth: () => displayWidth,
  padText: () => padText
});
module.exports = __toCommonJS(padding_exports);
var import_math = require("../primordials/math");
var import_width = require("../strings/width");
function displayWidth(text) {
  return (0, import_width.stringWidth)(text);
}
function padText(text, width, align = "left") {
  const textWidth = displayWidth(text);
  const padding = (0, import_math.MathMax)(0, width - textWidth);
  switch (align) {
    case "right":
      return " ".repeat(padding) + text;
    case "center": {
      const leftPad = Math.floor(padding / 2);
      const rightPad = padding - leftPad;
      return " ".repeat(leftPad) + text + " ".repeat(rightPad);
    }
    default:
      return text + " ".repeat(padding);
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  displayWidth,
  padText
});
