export type UUID_V4 = `${string}-${string}-${string}-${string}-${string}`; export const uuidv4 = (): UUID_V4 => { if (crypto.randomUUID == null) { "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c) => // eslint-disable-next-line no-bitwise (+c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (+c / 4)))).toString(16), ); } else { return crypto.randomUUID(); } };