// awkward use of require()? you betcha. but import() with Metro causes it to try and
// resolve the package at compile-time even if not installed, so here we are.
let rnqc = null;
let expoCrypto = null;
try {
    rnqc = require("react-native-quick-crypto");
}
catch (err) { }
try {
    expoCrypto = require("expo-crypto");
}
catch (err) { }
if (!rnqc && !expoCrypto) {
    throw new Error("Livestreaming requires one of react-native-quick-crypto or expo-crypto");
}
if (rnqc) {
    console.log("Using react-native-quick-crypto for crypto polyfill");
    // we import this in the main app, but in case this file is used standalone:
    globalThis.crypto = rnqc;
}
if (expoCrypto) {
    console.log("Using expo-crypto for crypto polyfill");
    // @atproto/crypto dependencies expect crypto.getRandomValues to be a function
    if (typeof globalThis.crypto === "undefined") {
        globalThis.crypto = {};
    }
    if (typeof globalThis.crypto.getRandomValues === "undefined") {
        globalThis.crypto.getRandomValues = expoCrypto.getRandomValues;
    }
}
//# sourceMappingURL=crypto-polyfill.native.js.map