import React from 'react';
import warning from 'warning';
// This code supports React <= 18 and React 19. Ported from production builds:
// - https://app.unpkg.com/react-is@19.0.0/files/cjs/react-is.production.js
// - https://app.unpkg.com/react-is@18.3.1/files/cjs/react-is.production.min.js
export var IS_REACT_19 = /* @__PURE__ */ React.version.startsWith('19');
export var IS_REACT_20 = /* @__PURE__ */ React.version.startsWith('20');
if (IS_REACT_20) {
    warning(false, 'React 20 detected. You must check and update this code for React 20 support. ' +
        'Check changes and add new warning for future React 21 here: ' +
        'https://github.com/facebook/react/commits/main/packages/react-is');
}
var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for(IS_REACT_19 ? 'react.transitional.element' : 'react.element');
var REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for('react.portal');
var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for('react.fragment');
var REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for('react.strict_mode');
var REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for('react.profiler');
var REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for('react.consumer');
var REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for('react.context');
var REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for('react.forward_ref');
var REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for('react.suspense');
var REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for('react.suspense_list');
var REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for('react.memo');
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for('react.lazy');
var REACT_OFFSCREEN_TYPE = /* @__PURE__ */ Symbol.for('react.offscreen');
var REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for('react.client.reference');
export var ForwardRef = REACT_FORWARD_REF_TYPE;
export var Memo = REACT_MEMO_TYPE;
export function isValidElementType(type) {
    return typeof type === 'string' ||
        typeof type === 'function' ||
        type === REACT_FRAGMENT_TYPE ||
        type === REACT_PROFILER_TYPE ||
        type === REACT_STRICT_MODE_TYPE ||
        type === REACT_SUSPENSE_TYPE ||
        type === REACT_SUSPENSE_LIST_TYPE ||
        type === REACT_OFFSCREEN_TYPE ||
        (typeof type === 'object' &&
            type !== null &&
            '$$typeof' in type &&
            type !== null &&
            (type.$$typeof === REACT_LAZY_TYPE ||
                type.$$typeof === REACT_MEMO_TYPE ||
                type.$$typeof === REACT_CONTEXT_TYPE ||
                type.$$typeof === REACT_CONSUMER_TYPE ||
                type.$$typeof === REACT_FORWARD_REF_TYPE ||
                type.$$typeof === REACT_CLIENT_REFERENCE ||
                (typeof type === 'object' && type !== null && 'getModuleId' in type && type.getModuleId !== undefined)))
        ? !0
        : !1;
}
function typeOf(object) {
    if (typeof object === 'object' && object !== null && '$$typeof' in object) {
        var $$typeof = object.$$typeof;
        if ($$typeof === REACT_ELEMENT_TYPE) {
            if ('type' in object) {
                var type = object.type;
                if (type === REACT_FRAGMENT_TYPE ||
                    type === REACT_PROFILER_TYPE ||
                    type === REACT_STRICT_MODE_TYPE ||
                    type === REACT_SUSPENSE_TYPE ||
                    type === REACT_SUSPENSE_LIST_TYPE) {
                    return type;
                }
                if (type !== null && typeof type === 'object' && '$$typeof' in type) {
                    var inner$$typeof = type.$$typeof;
                    if (inner$$typeof === REACT_CONTEXT_TYPE ||
                        inner$$typeof === REACT_FORWARD_REF_TYPE ||
                        inner$$typeof === REACT_LAZY_TYPE ||
                        inner$$typeof === REACT_MEMO_TYPE ||
                        inner$$typeof === REACT_CONSUMER_TYPE) {
                        return inner$$typeof;
                    }
                }
            }
            return $$typeof;
        }
        if ($$typeof === REACT_PORTAL_TYPE) {
            return $$typeof;
        }
    }
    return undefined;
}
export function isMemo(object) {
    return typeOf(object) === REACT_MEMO_TYPE;
}
export function isForwardRef(object) {
    return typeOf(object) === REACT_FORWARD_REF_TYPE;
}
export function isElement(object) {
    return (typeof object === 'object' && object !== null && '$$typeof' in object && object.$$typeof === REACT_ELEMENT_TYPE);
}
//# sourceMappingURL=react-is.js.map