export function newOperationID():string{ const cryptoApi=globalThis.crypto if(typeof cryptoApi?.randomUUID==='function')return cryptoApi.randomUUID() if(typeof cryptoApi?.getRandomValues==='function'){ const bytes=new Uint8Array(16) cryptoApi.getRandomValues(bytes) bytes[6]=(bytes[6]&0x0f)|0x40 bytes[8]=(bytes[8]&0x3f)|0x80 const hex=Array.from(bytes,value=>value.toString(16).padStart(2,'0')).join('') return `${hex.slice(0,8)}-${hex.slice(8,12)}-${hex.slice(12,16)}-${hex.slice(16,20)}-${hex.slice(20)}` } throw new Error('当前环境无法安全生成操作标识') }