"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.canUseLayoutEffect = exports.canUseDOM = void 0;
const globals_1 = require("@apollo/client/utilities/globals");
const isReactNative = (0, globals_1.maybe)(() => navigator.product) == "ReactNative";
exports.canUseDOM = typeof (0, globals_1.maybe)(() => window.document.createElement) === "function";
const usingJSDOM = 
// Following advice found in this comment from @domenic (maintainer of jsdom):
// https://github.com/jsdom/jsdom/issues/1537#issuecomment-229405327
//
// Since we control the version of Jest and jsdom used when running Apollo
// Client tests, and that version is recent enought to include " jsdom/x.y.z"
// at the end of the user agent string, I believe this case is all we need to
// check. Testing for "Node.js" was recommended for backwards compatibility
// with older version of jsdom, but we don't have that problem.
(0, globals_1.maybe)(() => navigator.userAgent.indexOf("jsdom") >= 0) || false;
// Our tests should all continue to pass if we remove this !usingJSDOM
// condition, thereby allowing useLayoutEffect when using jsdom. Unfortunately,
// if we allow useLayoutEffect, then useSyncExternalStore generates many
// warnings about useLayoutEffect doing nothing on the server. While these
// warnings are harmless, this !usingJSDOM condition seems to be the best way to
// prevent them (i.e. skipping useLayoutEffect when using jsdom).
exports.canUseLayoutEffect = (exports.canUseDOM || isReactNative) && !usingJSDOM;
//# sourceMappingURL=canUse.cjs.map
