// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.
/**
 * Converts the byte array to a UUID string
 * @param bytes Used to convert Byte to Hex
 */ export function bytesToUuid(bytes) {
  const bits = [
    ...bytes
  ].map((bit)=>{
    const s = bit.toString(16);
    return bit < 0x10 ? "0" + s : s;
  });
  return [
    ...bits.slice(0, 4),
    "-",
    ...bits.slice(4, 6),
    "-",
    ...bits.slice(6, 8),
    "-",
    ...bits.slice(8, 10),
    "-",
    ...bits.slice(10, 16)
  ].join("");
}
/**
 * Converts a string to a byte array by converting the hex value to a number.
 * @param uuid Value that gets converted.
 */ export function uuidToBytes(uuid) {
  const bytes = [];
  uuid.replace(/[a-fA-F0-9]{2}/g, (hex)=>{
    bytes.push(parseInt(hex, 16));
    return "";
  });
  return bytes;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImh0dHBzOi8vanNyLmlvL0BzdGQvdXVpZC8wLjIyNC4zL19jb21tb24udHMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gQ29weXJpZ2h0IDIwMTgtMjAyNCB0aGUgRGVubyBhdXRob3JzLiBBbGwgcmlnaHRzIHJlc2VydmVkLiBNSVQgbGljZW5zZS5cbi8vIFRoaXMgbW9kdWxlIGlzIGJyb3dzZXIgY29tcGF0aWJsZS5cblxuLyoqXG4gKiBDb252ZXJ0cyB0aGUgYnl0ZSBhcnJheSB0byBhIFVVSUQgc3RyaW5nXG4gKiBAcGFyYW0gYnl0ZXMgVXNlZCB0byBjb252ZXJ0IEJ5dGUgdG8gSGV4XG4gKi9cbmV4cG9ydCBmdW5jdGlvbiBieXRlc1RvVXVpZChieXRlczogbnVtYmVyW10gfCBVaW50OEFycmF5KTogc3RyaW5nIHtcbiAgY29uc3QgYml0cyA9IFsuLi5ieXRlc10ubWFwKChiaXQpID0+IHtcbiAgICBjb25zdCBzID0gYml0LnRvU3RyaW5nKDE2KTtcbiAgICByZXR1cm4gYml0IDwgMH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