fixtures/legacy-jsx-runtimes/react-16/cjs/react-jsx-runtime.development.js JAVASCRIPT 912 lines View on github.com → Search inside
1/** @license React v16.14.02 * react-jsx-runtime.development.js3 *4 * Copyright (c) Meta Platforms, Inc. and affiliates.5 *6 * This source code is licensed under the MIT license found in the7 * LICENSE file in the root directory of this source tree.8 */910'use strict';1112if (process.env.NODE_ENV !== "production") {13  (function() {14'use strict';1516var React = require('react');1718// ATTENTION19// When adding new symbols to this file,20// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'21// The Symbol used to tag the ReactElement-like types. If there is no native Symbol22// nor polyfill, then a plain number is used for performance.23var REACT_ELEMENT_TYPE = 0xeac7;24var REACT_PORTAL_TYPE = 0xeaca;25exports.Fragment = 0xeacb;26var REACT_STRICT_MODE_TYPE = 0xeacc;27var REACT_PROFILER_TYPE = 0xead2;28var REACT_PROVIDER_TYPE = 0xeacd;29var REACT_CONTEXT_TYPE = 0xeace;30var REACT_FORWARD_REF_TYPE = 0xead0;31var REACT_SUSPENSE_TYPE = 0xead1;32var REACT_SUSPENSE_LIST_TYPE = 0xead8;33var REACT_MEMO_TYPE = 0xead3;34var REACT_LAZY_TYPE = 0xead4;35var REACT_BLOCK_TYPE = 0xead9;36var REACT_SERVER_BLOCK_TYPE = 0xeada;37var REACT_FUNDAMENTAL_TYPE = 0xead5;38var REACT_SCOPE_TYPE = 0xead7;39var REACT_OPAQUE_ID_TYPE = 0xeae0;40var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;41var REACT_OFFSCREEN_TYPE = 0xeae2;42var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;4344if (typeof Symbol === 'function' && Symbol.for) {45  var symbolFor = Symbol.for;46  REACT_ELEMENT_TYPE = symbolFor('react.element');47  REACT_PORTAL_TYPE = symbolFor('react.portal');48  exports.Fragment = symbolFor('react.fragment');49  REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');50  REACT_PROFILER_TYPE = symbolFor('react.profiler');51  REACT_PROVIDER_TYPE = symbolFor('react.provider');52  REACT_CONTEXT_TYPE = symbolFor('react.context');53  REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');54  REACT_SUSPENSE_TYPE = symbolFor('react.suspense');55  REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');56  REACT_MEMO_TYPE = symbolFor('react.memo');57  REACT_LAZY_TYPE = symbolFor('react.lazy');58  REACT_BLOCK_TYPE = symbolFor('react.block');59  REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');60  REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');61  REACT_SCOPE_TYPE = symbolFor('react.scope');62  REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');63  REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');64  REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');65  REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');66}6768var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;69var FAUX_ITERATOR_SYMBOL = '@@iterator';70function getIteratorFn(maybeIterable) {71  if (maybeIterable === null || typeof maybeIterable !== 'object') {72    return null;73  }7475  var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];7677  if (typeof maybeIterator === 'function') {78    return maybeIterator;79  }8081  return null;82}8384var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;8586function error(format) {87  {88    for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {89      args[_key2 - 1] = arguments[_key2];90    }9192    printWarning('error', format, args);93  }94}9596function printWarning(level, format, args) {97  // When changing this logic, you might want to also98  // update consoleWithStackDev.www.js as well.99  {100    var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;101    var stack = '';102103    if (currentlyValidatingElement) {104      var name = getComponentName(currentlyValidatingElement.type);105      var owner = currentlyValidatingElement._owner;106      stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));107    }108109    stack += ReactDebugCurrentFrame.getStackAddendum();110111    if (stack !== '') {112      format += '%s';113      args = args.concat([stack]);114    }115116    var argsWithFormat = args.map(function (item) {117      return '' + item;118    }); // Careful: RN currently depends on this prefix119120    argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it121    // breaks IE9: https://github.com/facebook/react/issues/13610122    // eslint-disable-next-line react-internal/no-production-logging123124    Function.prototype.apply.call(console[level], console, argsWithFormat);125  }126}127128// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.129130var enableScopeAPI = false; // Experimental Create Event Handle API.131132function isValidElementType(type) {133  if (typeof type === 'string' || typeof type === 'function') {134    return true;135  } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).136137138  if (type === exports.Fragment || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {139    return true;140  }141142  if (typeof type === 'object' && type !== null) {143    if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {144      return true;145    }146  }147148  return false;149}150151152var BEFORE_SLASH_RE = /^(.*)[\\\/]/;153function describeComponentFrame (name, source, ownerName) {154  var sourceInfo = '';155156  if (source) {157    var path = source.fileName;158    var fileName = path.replace(BEFORE_SLASH_RE, '');159160    {161      // In DEV, include code for a common special case:162      // prefer "folder/index.js" instead of just "index.js".163      if (/^index\./.test(fileName)) {164        var match = path.match(BEFORE_SLASH_RE);165166        if (match) {167          var pathBeforeSlash = match[1];168169          if (pathBeforeSlash) {170            var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');171            fileName = folderName + '/' + fileName;172          }173        }174      }175    }176177    sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';178  } else if (ownerName) {179    sourceInfo = ' (created by ' + ownerName + ')';180  }181182  return '\n    in ' + (name || 'Unknown') + sourceInfo;183}184185var Resolved = 1;186function refineResolvedLazyComponent(lazyComponent) {187  return lazyComponent._status === Resolved ? lazyComponent._result : null;188}189190function getWrappedName(outerType, innerType, wrapperName) {191  var functionName = innerType.displayName || innerType.name || '';192  return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);193}194195function getComponentName(type) {196  if (type == null) {197    // Host root, text node or just invalid type.198    return null;199  }200201  {202    if (typeof type.tag === 'number') {203      error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');204    }205  }206207  if (typeof type === 'function') {208    return type.displayName || type.name || null;209  }210211  if (typeof type === 'string') {212    return type;213  }214215  switch (type) {216    case exports.Fragment:217      return 'Fragment';218219    case REACT_PORTAL_TYPE:220      return 'Portal';221222    case REACT_PROFILER_TYPE:223      return "Profiler";224225    case REACT_STRICT_MODE_TYPE:226      return 'StrictMode';227228    case REACT_SUSPENSE_TYPE:229      return 'Suspense';230231    case REACT_SUSPENSE_LIST_TYPE:232      return 'SuspenseList';233  }234235  if (typeof type === 'object') {236    switch (type.$$typeof) {237      case REACT_CONTEXT_TYPE:238        return 'Context.Consumer';239240      case REACT_PROVIDER_TYPE:241        return 'Context.Provider';242243      case REACT_FORWARD_REF_TYPE:244        return getWrappedName(type, type.render, 'ForwardRef');245246      case REACT_MEMO_TYPE:247        return getComponentName(type.type);248249      case REACT_BLOCK_TYPE:250        return getComponentName(type.render);251252      case REACT_LAZY_TYPE:253        {254          var thenable = type;255          var resolvedThenable = refineResolvedLazyComponent(thenable);256257          if (resolvedThenable) {258            return getComponentName(resolvedThenable);259          }260261          break;262        }263    }264  }265266  return null;267}268269var loggedTypeFailures = {};270var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;271var currentlyValidatingElement = null;272273function setCurrentlyValidatingElement(element) {274  {275    currentlyValidatingElement = element;276  }277}278279function checkPropTypes(typeSpecs, values, location, componentName, element) {280  {281    // $FlowFixMe This is okay but Flow doesn't know it.282    var has = Function.call.bind(Object.prototype.hasOwnProperty);283284    for (var typeSpecName in typeSpecs) {285      if (has(typeSpecs, typeSpecName)) {286        var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to287        // fail the render phase where it didn't fail before. So we log it.288        // After these have been cleaned up, we'll let them throw.289290        try {291          // This is intentionally an invariant that gets caught. It's the same292          // behavior as without this statement except with a better message.293          if (typeof typeSpecs[typeSpecName] !== 'function') {294            var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');295            err.name = 'Invariant Violation';296            throw err;297          }298299          error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');300        } catch (ex) {301          error$1 = ex;302        }303304        if (error$1 && !(error$1 instanceof Error)) {305          setCurrentlyValidatingElement(element);306307          error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);308309          setCurrentlyValidatingElement(null);310        }311312        if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {313          // Only monitor this failure once because there tends to be a lot of the314          // same error.315          loggedTypeFailures[error$1.message] = true;316          setCurrentlyValidatingElement(element);317318          error('Failed %s type: %s', location, error$1.message);319320          setCurrentlyValidatingElement(null);321        }322      }323    }324  }325}326327var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;328var hasOwnProperty = Object.prototype.hasOwnProperty;329var RESERVED_PROPS = {330  key: true,331  ref: true,332  __self: true,333  __source: true334};335var specialPropKeyWarningShown;336var specialPropRefWarningShown;337var didWarnAboutStringRefs;338339{340  didWarnAboutStringRefs = {};341}342343function hasValidRef(config) {344  {345    if (hasOwnProperty.call(config, 'ref')) {346      var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;347348      if (getter && getter.isReactWarning) {349        return false;350      }351    }352  }353354  return config.ref !== undefined;355}356357function hasValidKey(config) {358  {359    if (hasOwnProperty.call(config, 'key')) {360      var getter = Object.getOwnPropertyDescriptor(config, 'key').get;361362      if (getter && getter.isReactWarning) {363        return false;364      }365    }366  }367368  return config.key !== undefined;369}370371function warnIfStringRefCannotBeAutoConverted(config, self) {372  {373    if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {374      var componentName = getComponentName(ReactCurrentOwner.current.type);375376      if (!didWarnAboutStringRefs[componentName]) {377        error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref);378379        didWarnAboutStringRefs[componentName] = true;380      }381    }382  }383}384385function defineKeyPropWarningGetter(props, displayName) {386  {387    var warnAboutAccessingKey = function () {388      if (!specialPropKeyWarningShown) {389        specialPropKeyWarningShown = true;390391        error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);392      }393    };394395    warnAboutAccessingKey.isReactWarning = true;396    Object.defineProperty(props, 'key', {397      get: warnAboutAccessingKey,398      configurable: true399    });400  }401}402403function defineRefPropWarningGetter(props, displayName) {404  {405    var warnAboutAccessingRef = function () {406      if (!specialPropRefWarningShown) {407        specialPropRefWarningShown = true;408409        error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);410      }411    };412413    warnAboutAccessingRef.isReactWarning = true;414    Object.defineProperty(props, 'ref', {415      get: warnAboutAccessingRef,416      configurable: true417    });418  }419}420/**421 * Factory method to create a new React element. This no longer adheres to422 * the class pattern, so do not use new to call it. Also, instanceof check423 * will not work. Instead test $$typeof field against Symbol.for('react.element') to check424 * if something is a React Element.425 *426 * @param {*} type427 * @param {*} props428 * @param {*} key429 * @param {string|object} ref430 * @param {*} owner431 * @param {*} self A *temporary* helper to detect places where `this` is432 * different from the `owner` when React.createElement is called, so that we433 * can warn. We want to get rid of owner and replace string `ref`s with arrow434 * functions, and as long as `this` and owner are the same, there will be no435 * change in behavior.436 * @param {*} source An annotation object (added by a transpiler or otherwise)437 * indicating filename, line number, and/or other information.438 * @internal439 */440441442var ReactElement = function (type, key, ref, self, source, owner, props) {443  var element = {444    // This tag allows us to uniquely identify this as a React Element445    $$typeof: REACT_ELEMENT_TYPE,446    // Built-in properties that belong on the element447    type: type,448    key: key,449    ref: ref,450    props: props,451    // Record the component responsible for creating this element.452    _owner: owner453  };454455  {456    // The validation flag is currently mutative. We put it on457    // an external backing store so that we can freeze the whole object.458    // This can be replaced with a WeakMap once they are implemented in459    // commonly used development environments.460    element._store = {}; // To make comparing ReactElements easier for testing purposes, we make461    // the validation flag non-enumerable (where possible, which should462    // include every environment we run tests in), so the test framework463    // ignores it.464465    Object.defineProperty(element._store, 'validated', {466      configurable: false,467      enumerable: false,468      writable: true,469      value: false470    }); // self and source are DEV only properties.471472    Object.defineProperty(element, '_self', {473      configurable: false,474      enumerable: false,475      writable: false,476      value: self477    }); // Two elements created in two different places should be considered478    // equal for testing purposes and therefore we hide it from enumeration.479480    Object.defineProperty(element, '_source', {481      configurable: false,482      enumerable: false,483      writable: false,484      value: source485    });486487    if (Object.freeze) {488      Object.freeze(element.props);489      Object.freeze(element);490    }491  }492493  return element;494};495/**496 * https://github.com/reactjs/rfcs/pull/107497 * @param {*} type498 * @param {object} props499 * @param {string} key500 */501502function jsxDEV(type, config, maybeKey, source, self) {503  {504    var propName; // Reserved names are extracted505506    var props = {};507    var key = null;508    var ref = null; // Currently, key can be spread in as a prop. This causes a potential509    // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />510    // or <div key="Hi" {...props} /> ). We want to deprecate key spread,511    // but as an intermediary step, we will use jsxDEV for everything except512    // <div {...props} key="Hi" />, because we aren't currently able to tell if513    // key is explicitly declared to be undefined or not.514515    if (maybeKey !== undefined) {516      key = '' + maybeKey;517    }518519    if (hasValidKey(config)) {520      key = '' + config.key;521    }522523    if (hasValidRef(config)) {524      ref = config.ref;525      warnIfStringRefCannotBeAutoConverted(config, self);526    } // Remaining properties are added to a new props object527528529    for (propName in config) {530      if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {531        props[propName] = config[propName];532      }533    } // Resolve default props534535536    if (type && type.defaultProps) {537      var defaultProps = type.defaultProps;538539      for (propName in defaultProps) {540        if (props[propName] === undefined) {541          props[propName] = defaultProps[propName];542        }543      }544    }545546    if (key || ref) {547      var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;548549      if (key) {550        defineKeyPropWarningGetter(props, displayName);551      }552553      if (ref) {554        defineRefPropWarningGetter(props, displayName);555      }556    }557558    return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);559  }560}561562var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;563var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;564565function setCurrentlyValidatingElement$1(element) {566  currentlyValidatingElement = element;567}568569var propTypesMisspellWarningShown;570571{572  propTypesMisspellWarningShown = false;573}574/**575 * Verifies the object is a ReactElement.576 * See https://reactjs.org/docs/react-api.html#isvalidelement577 * @param {?object} object578 * @return {boolean} True if `object` is a ReactElement.579 * @final580 */581582function isValidElement(object) {583  {584    return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;585  }586}587588function getDeclarationErrorAddendum() {589  {590    if (ReactCurrentOwner$1.current) {591      var name = getComponentName(ReactCurrentOwner$1.current.type);592593      if (name) {594        return '\n\nCheck the render method of `' + name + '`.';595      }596    }597598    return '';599  }600}601602function getSourceInfoErrorAddendum(source) {603  {604    if (source !== undefined) {605      var fileName = source.fileName.replace(/^.*[\\\/]/, '');606      var lineNumber = source.lineNumber;607      return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';608    }609610    return '';611  }612}613/**614 * Warn if there's no key explicitly set on dynamic arrays of children or615 * object keys are not valid. This allows us to keep track of children between616 * updates.617 */618619620var ownerHasKeyUseWarning = {};621622function getCurrentComponentErrorInfo(parentType) {623  {624    var info = getDeclarationErrorAddendum();625626    if (!info) {627      var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;628629      if (parentName) {630        info = "\n\nCheck the top-level render call using <" + parentName + ">.";631      }632    }633634    return info;635  }636}637/**638 * Warn if the element doesn't have an explicit key assigned to it.639 * This element is in an array. The array could grow and shrink or be640 * reordered. All children that haven't already been validated are required to641 * have a "key" property assigned to it. Error statuses are cached so a warning642 * will only be shown once.643 *644 * @internal645 * @param {ReactElement} element Element that requires a key.646 * @param {*} parentType element's parent's type.647 */648649650function validateExplicitKey(element, parentType) {651  {652    if (!element._store || element._store.validated || element.key != null) {653      return;654    }655656    element._store.validated = true;657    var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);658659    if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {660      return;661    }662663    ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a664    // property, it may be the creator of the child that's responsible for665    // assigning it a key.666667    var childOwner = '';668669    if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {670      // Give the component that originally created this child.671      childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";672    }673674    setCurrentlyValidatingElement$1(element);675676    error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);677678    setCurrentlyValidatingElement$1(null);679  }680}681/**682 * Ensure that every element either is passed in a static location, in an683 * array with an explicit keys property defined, or in an object literal684 * with valid key property.685 *686 * @internal687 * @param {ReactNode} node Statically passed child of any type.688 * @param {*} parentType node's parent's type.689 */690691692function validateChildKeys(node, parentType) {693  {694    if (typeof node !== 'object') {695      return;696    }697698    if (Array.isArray(node)) {699      for (var i = 0; i < node.length; i++) {700        var child = node[i];701702        if (isValidElement(child)) {703          validateExplicitKey(child, parentType);704        }705      }706    } else if (isValidElement(node)) {707      // This element was passed in a valid location.708      if (node._store) {709        node._store.validated = true;710      }711    } else if (node) {712      var iteratorFn = getIteratorFn(node);713714      if (typeof iteratorFn === 'function') {715        // Entry iterators used to provide implicit keys,716        // but now we print a separate warning for them later.717        if (iteratorFn !== node.entries) {718          var iterator = iteratorFn.call(node);719          var step;720721          while (!(step = iterator.next()).done) {722            if (isValidElement(step.value)) {723              validateExplicitKey(step.value, parentType);724            }725          }726        }727      }728    }729  }730}731/**732 * Given an element, validate that its props follow the propTypes definition,733 * provided by the type.734 *735 * @param {ReactElement} element736 */737738739function validatePropTypes(element) {740  {741    var type = element.type;742743    if (type === null || type === undefined || typeof type === 'string') {744      return;745    }746747    var propTypes;748749    if (typeof type === 'function') {750      propTypes = type.propTypes;751    } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.752    // Inner props are checked in the reconciler.753    type.$$typeof === REACT_MEMO_TYPE)) {754      propTypes = type.propTypes;755    } else {756      return;757    }758759    if (propTypes) {760      // Intentionally inside to avoid triggering lazy initializers:761      var name = getComponentName(type);762      checkPropTypes(propTypes, element.props, 'prop', name, element);763    } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {764      propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:765766      var _name = getComponentName(type);767768      error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');769    }770771    if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {772      error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');773    }774  }775}776/**777 * Given a fragment, validate that it can only be provided with fragment props778 * @param {ReactElement} fragment779 */780781782function validateFragmentProps(fragment) {783  {784    var keys = Object.keys(fragment.props);785786    for (var i = 0; i < keys.length; i++) {787      var key = keys[i];788789      if (key !== 'children' && key !== 'key') {790        setCurrentlyValidatingElement$1(fragment);791792        error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);793794        setCurrentlyValidatingElement$1(null);795        break;796      }797    }798799    if (fragment.ref !== null) {800      setCurrentlyValidatingElement$1(fragment);801802      error('Invalid attribute `ref` supplied to `React.Fragment`.');803804      setCurrentlyValidatingElement$1(null);805    }806  }807}808809function jsxWithValidation(type, props, key, isStaticChildren, source, self) {810  {811    var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to812    // succeed and there will likely be errors in render.813814    if (!validType) {815      var info = '';816817      if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {818        info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";819      }820821      var sourceInfo = getSourceInfoErrorAddendum(source);822823      if (sourceInfo) {824        info += sourceInfo;825      } else {826        info += getDeclarationErrorAddendum();827      }828829      var typeString;830831      if (type === null) {832        typeString = 'null';833      } else if (Array.isArray(type)) {834        typeString = 'array';835      } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {836        typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";837        info = ' Did you accidentally export a JSX literal instead of a component?';838      } else {839        typeString = typeof type;840      }841842      error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);843    }844845    var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.846    // TODO: Drop this when these are no longer allowed as the type argument.847848    if (element == null) {849      return element;850    } // Skip key warning if the type isn't valid since our key validation logic851    // doesn't expect a non-string/function type and can throw confusing errors.852    // We don't want exception behavior to differ between dev and prod.853    // (Rendering will throw with a helpful message and as soon as the type is854    // fixed, the key warnings will appear.)855856857    if (validType) {858      var children = props.children;859860      if (children !== undefined) {861        if (isStaticChildren) {862          if (Array.isArray(children)) {863            for (var i = 0; i < children.length; i++) {864              validateChildKeys(children[i], type);865            }866867            if (Object.freeze) {868              Object.freeze(children);869            }870          } else {871            error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');872          }873        } else {874          validateChildKeys(children, type);875        }876      }877    }878879    if (type === exports.Fragment) {880      validateFragmentProps(element);881    } else {882      validatePropTypes(element);883    }884885    return element;886  }887} // These two functions exist to still get child warnings in dev888// even with the prod transform. This means that jsxDEV is purely889// opt-in behavior for better messages but that we won't stop890// giving you warnings if you use production apis.891892function jsxWithValidationStatic(type, props, key) {893  {894    return jsxWithValidation(type, props, key, true);895  }896}897function jsxWithValidationDynamic(type, props, key) {898  {899    return jsxWithValidation(type, props, key, false);900  }901}902903var jsx =  jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.904// for now we can ship identical prod functions905906var jsxs =  jsxWithValidationStatic ;907908exports.jsx = jsx;909exports.jsxs = jsxs;910  })();911}

Code quality findings 100

Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (process.env.NODE_ENV !== "production") {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var React = require('react');
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_ELEMENT_TYPE = 0xeac7;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_PORTAL_TYPE = 0xeaca;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_STRICT_MODE_TYPE = 0xeacc;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_PROFILER_TYPE = 0xead2;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_PROVIDER_TYPE = 0xeacd;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_CONTEXT_TYPE = 0xeace;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_FORWARD_REF_TYPE = 0xead0;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_SUSPENSE_TYPE = 0xead1;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_SUSPENSE_LIST_TYPE = 0xead8;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_MEMO_TYPE = 0xead3;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_LAZY_TYPE = 0xead4;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_BLOCK_TYPE = 0xead9;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_SERVER_BLOCK_TYPE = 0xeada;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_FUNDAMENTAL_TYPE = 0xead5;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_SCOPE_TYPE = 0xead7;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_OPAQUE_ID_TYPE = 0xeae0;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_OFFSCREEN_TYPE = 0xeae2;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof Symbol === 'function' && Symbol.for) {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof Symbol === 'function' && Symbol.for) {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var symbolFor = Symbol.for;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var FAUX_ITERATOR_SYMBOL = '@@iterator';
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (maybeIterable === null || typeof maybeIterable !== 'object') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (maybeIterable === null || typeof maybeIterable !== 'object') {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof maybeIterator === 'function') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof maybeIterator === 'function') {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
Use let instead of var in loops to avoid scope issues
info correctness var-in-loop
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var stack = '';
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var name = getComponentName(currentlyValidatingElement.type);
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var owner = currentlyValidatingElement._owner;
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (stack !== '') {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var argsWithFormat = args.map(function (item) {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var enableScopeAPI = false; // Experimental Create Event Handle API.
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof type === 'string' || typeof type === 'function') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof type === 'string' || typeof type === 'function') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (type === exports.Fragment || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof type === 'object' && type !== null) {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof type === 'object' && type !== null) {
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var sourceInfo = '';
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var path = source.fileName;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var fileName = path.replace(BEFORE_SLASH_RE, '');
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var match = path.match(BEFORE_SLASH_RE);
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var pathBeforeSlash = match[1];
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var Resolved = 1;
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
return lazyComponent._status === Resolved ? lazyComponent._result : null;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var functionName = innerType.displayName || innerType.name || '';
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (type == null) {
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof type.tag === 'number') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof type.tag === 'number') {
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof type === 'function') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof type === 'function') {
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof type === 'string') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof type === 'string') {
Ensure all cases are handled or a default case is present
info correctness switch-without-default
switch (type) {
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof type === 'object') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof type === 'object') {
Ensure all cases are handled or a default case is present
info correctness switch-without-default
switch (type.$$typeof) {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var thenable = type;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var resolvedThenable = refineResolvedLazyComponent(thenable);
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var loggedTypeFailures = {};
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var currentlyValidatingElement = null;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var has = Function.call.bind(Object.prototype.hasOwnProperty);
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
for (var typeSpecName in typeSpecs) {
Use let instead of var in loops to avoid scope issues
info correctness var-in-loop
for (var typeSpecName in typeSpecs) {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof typeSpecs[typeSpecName] !== 'function') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof typeSpecs[typeSpecName] !== 'function') {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var hasOwnProperty = Object.prototype.hasOwnProperty;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var RESERVED_PROPS = {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var specialPropKeyWarningShown;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var specialPropRefWarningShown;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var didWarnAboutStringRefs;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
return config.ref !== undefined;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
return config.key !== undefined;
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var componentName = getComponentName(ReactCurrentOwner.current.type);

Get this view in your editor

Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.