import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
/** Returns true if React SSR streaming is actually active at runtime. */
export function isSSRStreaming() {
  try {
    var _process$env;
    var isSSRRendered =
    // In most places there is no document when running on server-side
    // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
    typeof document === 'undefined' || typeof process !== 'undefined' && ((_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env.REACT_SSR) || typeof window !== 'undefined' && window.__SSR_RENDERED__ || globalThis.__SSR_RENDERED__;
    var isSSRReactStreaming = typeof window !== 'undefined' && window.__SSR_REACT_STREAMING__ || globalThis.__SSR_REACT_STREAMING__;
    return Boolean(isSSRRendered) && expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) && Boolean(isSSRReactStreaming);
  } catch (_unused) {
    // Catch possible error that might occur and just return false
    return false;
  }
}