"use strict";
/* Socket Lib - Built with esbuild */
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 clear_exports = {};
__export(clear_exports, {
  clearLine: () => clearLine,
  clearLines: () => clearLines,
  clearScreen: () => clearScreen,
  clearVisible: () => clearVisible,
  cursorToStart: () => cursorToStart,
  hideCursor: () => hideCursor,
  restoreCursor: () => restoreCursor,
  saveCursor: () => saveCursor,
  showCursor: () => showCursor
});
module.exports = __toCommonJS(clear_exports);
function clearLine(stream = process.stdout) {
  if (stream.isTTY) {
    stream.cursorTo(0);
    stream.clearLine(0);
  } else {
    stream.write("\r\x1B[K");
  }
}
function clearLines(count, stream = process.stdout) {
  for (let i = 0; i < count; i++) {
    stream.write("\x1B[1A\x1B[2K");
  }
}
function clearScreen(stream = process.stdout) {
  if (stream.isTTY) {
    stream.write("\x1Bc");
  }
}
function clearVisible(stream = process.stdout) {
  clearScreen(stream);
}
function cursorToStart(stream = process.stdout) {
  if (stream.isTTY) {
    stream.cursorTo(0);
  } else {
    stream.write("\r");
  }
}
function hideCursor(stream = process.stdout) {
  stream.write("\x1B[?25l");
}
function showCursor(stream = process.stdout) {
  stream.write("\x1B[?25h");
}
function saveCursor(stream = process.stdout) {
  stream.write("\x1B7");
}
function restoreCursor(stream = process.stdout) {
  stream.write("\x1B8");
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  clearLine,
  clearLines,
  clearScreen,
  clearVisible,
  cursorToStart,
  hideCursor,
  restoreCursor,
  saveCursor,
  showCursor
});
