/**
 * @module utils/uuid
 * Unique operation ID generation for PendingOp tracking.
 */

/**
 * Generates a unique operation ID.
 * Uses crypto.randomUUID() when available; falls back to a time-random composite.
 * @returns {string}
 */
export function generateOpId() {
  return typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function'
    ? crypto.randomUUID()
    : `op-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 9)}`;
}
