130 lines
4.4 KiB
JavaScript
130 lines
4.4 KiB
JavaScript
/**
|
|
* @license React
|
|
* react-is.production.js
|
|
*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
"use strict";
|
|
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
|
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
|
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
|
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
|
REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
|
Symbol.for("react.provider");
|
|
var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
|
|
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
|
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
|
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
|
REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
|
|
REACT_MEMO_TYPE = Symbol.for("react.memo"),
|
|
REACT_LAZY_TYPE = Symbol.for("react.lazy"),
|
|
REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"),
|
|
REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference");
|
|
function typeOf(object) {
|
|
if ("object" === typeof object && null !== object) {
|
|
var $$typeof = object.$$typeof;
|
|
switch ($$typeof) {
|
|
case REACT_ELEMENT_TYPE:
|
|
switch (((object = object.type), object)) {
|
|
case REACT_FRAGMENT_TYPE:
|
|
case REACT_PROFILER_TYPE:
|
|
case REACT_STRICT_MODE_TYPE:
|
|
case REACT_SUSPENSE_TYPE:
|
|
case REACT_SUSPENSE_LIST_TYPE:
|
|
case REACT_VIEW_TRANSITION_TYPE:
|
|
return object;
|
|
default:
|
|
switch (((object = object && object.$$typeof), object)) {
|
|
case REACT_CONTEXT_TYPE:
|
|
case REACT_FORWARD_REF_TYPE:
|
|
case REACT_LAZY_TYPE:
|
|
case REACT_MEMO_TYPE:
|
|
return object;
|
|
case REACT_CONSUMER_TYPE:
|
|
return object;
|
|
default:
|
|
return $$typeof;
|
|
}
|
|
}
|
|
case REACT_PORTAL_TYPE:
|
|
return $$typeof;
|
|
}
|
|
}
|
|
}
|
|
exports.ContextConsumer = REACT_CONSUMER_TYPE;
|
|
exports.ContextProvider = REACT_CONTEXT_TYPE;
|
|
exports.Element = REACT_ELEMENT_TYPE;
|
|
exports.ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
exports.Lazy = REACT_LAZY_TYPE;
|
|
exports.Memo = REACT_MEMO_TYPE;
|
|
exports.Portal = REACT_PORTAL_TYPE;
|
|
exports.Profiler = REACT_PROFILER_TYPE;
|
|
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
exports.Suspense = REACT_SUSPENSE_TYPE;
|
|
exports.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
|
|
exports.isContextConsumer = function (object) {
|
|
return typeOf(object) === REACT_CONSUMER_TYPE;
|
|
};
|
|
exports.isContextProvider = function (object) {
|
|
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
};
|
|
exports.isElement = function (object) {
|
|
return (
|
|
"object" === typeof object &&
|
|
null !== object &&
|
|
object.$$typeof === REACT_ELEMENT_TYPE
|
|
);
|
|
};
|
|
exports.isForwardRef = function (object) {
|
|
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
};
|
|
exports.isFragment = function (object) {
|
|
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
};
|
|
exports.isLazy = function (object) {
|
|
return typeOf(object) === REACT_LAZY_TYPE;
|
|
};
|
|
exports.isMemo = function (object) {
|
|
return typeOf(object) === REACT_MEMO_TYPE;
|
|
};
|
|
exports.isPortal = function (object) {
|
|
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
};
|
|
exports.isProfiler = function (object) {
|
|
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
};
|
|
exports.isStrictMode = function (object) {
|
|
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
};
|
|
exports.isSuspense = function (object) {
|
|
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
};
|
|
exports.isSuspenseList = function (object) {
|
|
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
|
|
};
|
|
exports.isValidElementType = function (type) {
|
|
return "string" === typeof type ||
|
|
"function" === typeof type ||
|
|
type === REACT_FRAGMENT_TYPE ||
|
|
type === REACT_PROFILER_TYPE ||
|
|
type === REACT_STRICT_MODE_TYPE ||
|
|
type === REACT_SUSPENSE_TYPE ||
|
|
type === REACT_SUSPENSE_LIST_TYPE ||
|
|
("object" === typeof type &&
|
|
null !== type &&
|
|
(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 ||
|
|
void 0 !== type.getModuleId))
|
|
? !0
|
|
: !1;
|
|
};
|
|
exports.typeOf = typeOf;
|