"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 hash_exports = {};
__export(hash_exports, {
  hash: () => hash,
  nativeHash: () => nativeHash
});
module.exports = __toCommonJS(hash_exports);
var import_crypto = require("../node/crypto");
let _hash;
let _hashProbed = false;
// @__NO_SIDE_EFFECTS__
function hash(algorithm, data, outputEncoding) {
  const native = /* @__PURE__ */ nativeHash();
  if (native !== void 0) {
    return native(algorithm, data, outputEncoding);
  }
  return (0, import_crypto.getNodeCrypto)().createHash(algorithm).update(data).digest(outputEncoding);
}
// @__NO_SIDE_EFFECTS__
function nativeHash() {
  if (!_hashProbed) {
    const fn = (0, import_crypto.getNodeCrypto)().hash;
    if (typeof fn === "function") {
      _hash = fn;
    }
    _hashProbed = true;
  }
  return _hash;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  hash,
  nativeHash
});
