github.com/nektos/act@v0.2.63/pkg/runner/testdata/actions/node12/node_modules/uuid/dist/rng-browser.js (about)

     1  "use strict";
     2  
     3  Object.defineProperty(exports, "__esModule", {
     4    value: true
     5  });
     6  exports.default = rng;
     7  // Unique ID creation requires a high quality random # generator. In the browser we therefore
     8  // require the crypto API and do not support built-in fallback to lower quality random number
     9  // generators (like Math.random()).
    10  let getRandomValues;
    11  const rnds8 = new Uint8Array(16);
    12  
    13  function rng() {
    14    // lazy load so that environments that need to polyfill have a chance to do so
    15    if (!getRandomValues) {
    16      // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
    17      // find the complete implementation of crypto (msCrypto) on IE11.
    18      getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
    19  
    20      if (!getRandomValues) {
    21        throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
    22      }
    23    }
    24  
    25    return getRandomValues(rnds8);
    26  }