import { __name } from './chunk-IBAHCH6O.js';

// src/runtime/lib/redaction.ts
function redactString(valStr, modeOrOpts, hideLength = true) {
  if (!valStr) return valStr;
  let mode;
  let preserveLength = false;
  if (typeof modeOrOpts === "object") {
    mode = modeOrOpts.mode;
    hideLength = modeOrOpts.hideLength ?? true;
    preserveLength = modeOrOpts.preserveLength ?? false;
  } else {
    mode = modeOrOpts;
  }
  if (preserveLength) {
    return "*".repeat(valStr.length);
  }
  const hiddenLength = hideLength ? 5 : valStr.length - 2;
  const hiddenStr = "\u2592".repeat(hiddenLength);
  if (mode === "show_last_2") {
    return `${hiddenStr}${valStr.substring(valStr.length - 2, valStr.length)}`;
  } else if (mode === "show_first_last") {
    return `${valStr.substring(0, 1)}${hiddenStr}${valStr.substring(valStr.length - 1, valStr.length)}`;
  } else {
    return `${valStr.substring(0, 2)}${hiddenStr}`;
  }
}
__name(redactString, "redactString");

export { redactString };
//# sourceMappingURL=chunk-UWUBFNLX.js.map
//# sourceMappingURL=chunk-UWUBFNLX.js.map