UNPKG

12.5 kBJavaScriptView Raw
1/**
2 * @license React
3 * react-jsx-runtime.development.js
4 *
5 * Copyright (c) Meta Platforms, Inc. and affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */
10
11"use strict";
12"production" !== process.env.NODE_ENV &&
13 (function () {
14 function getComponentNameFromType(type) {
15 if (null == type) return null;
16 if ("function" === typeof type)
17 return type.$$typeof === REACT_CLIENT_REFERENCE
18 ? null
19 : type.displayName || type.name || null;
20 if ("string" === typeof type) return type;
21 switch (type) {
22 case REACT_FRAGMENT_TYPE:
23 return "Fragment";
24 case REACT_PROFILER_TYPE:
25 return "Profiler";
26 case REACT_STRICT_MODE_TYPE:
27 return "StrictMode";
28 case REACT_SUSPENSE_TYPE:
29 return "Suspense";
30 case REACT_SUSPENSE_LIST_TYPE:
31 return "SuspenseList";
32 case REACT_ACTIVITY_TYPE:
33 return "Activity";
34 }
35 if ("object" === typeof type)
36 switch (
37 ("number" === typeof type.tag &&
38 console.error(
39 "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
40 ),
41 type.$$typeof)
42 ) {
43 case REACT_PORTAL_TYPE:
44 return "Portal";
45 case REACT_CONTEXT_TYPE:
46 return type.displayName || "Context";
47 case REACT_CONSUMER_TYPE:
48 return (type._context.displayName || "Context") + ".Consumer";
49 case REACT_FORWARD_REF_TYPE:
50 var innerType = type.render;
51 type = type.displayName;
52 type ||
53 ((type = innerType.displayName || innerType.name || ""),
54 (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
55 return type;
56 case REACT_MEMO_TYPE:
57 return (
58 (innerType = type.displayName || null),
59 null !== innerType
60 ? innerType
61 : getComponentNameFromType(type.type) || "Memo"
62 );
63 case REACT_LAZY_TYPE:
64 innerType = type._payload;
65 type = type._init;
66 try {
67 return getComponentNameFromType(type(innerType));
68 } catch (x) {}
69 }
70 return null;
71 }
72 function testStringCoercion(value) {
73 return "" + value;
74 }
75 function checkKeyStringCoercion(value) {
76 try {
77 testStringCoercion(value);
78 var JSCompiler_inline_result = !1;
79 } catch (e) {
80 JSCompiler_inline_result = !0;
81 }
82 if (JSCompiler_inline_result) {
83 JSCompiler_inline_result = console;
84 var JSCompiler_temp_const = JSCompiler_inline_result.error;
85 var JSCompiler_inline_result$jscomp$0 =
86 ("function" === typeof Symbol &&
87 Symbol.toStringTag &&
88 value[Symbol.toStringTag]) ||
89 value.constructor.name ||
90 "Object";
91 JSCompiler_temp_const.call(
92 JSCompiler_inline_result,
93 "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
94 JSCompiler_inline_result$jscomp$0
95 );
96 return testStringCoercion(value);
97 }
98 }
99 function getTaskName(type) {
100 if (type === REACT_FRAGMENT_TYPE) return "<>";
101 if (
102 "object" === typeof type &&
103 null !== type &&
104 type.$$typeof === REACT_LAZY_TYPE
105 )
106 return "<...>";
107 try {
108 var name = getComponentNameFromType(type);
109 return name ? "<" + name + ">" : "<...>";
110 } catch (x) {
111 return "<...>";
112 }
113 }
114 function getOwner() {
115 var dispatcher = ReactSharedInternals.A;
116 return null === dispatcher ? null : dispatcher.getOwner();
117 }
118 function UnknownOwner() {
119 return Error("react-stack-top-frame");
120 }
121 function hasValidKey(config) {
122 if (hasOwnProperty.call(config, "key")) {
123 var getter = Object.getOwnPropertyDescriptor(config, "key").get;
124 if (getter && getter.isReactWarning) return !1;
125 }
126 return void 0 !== config.key;
127 }
128 function defineKeyPropWarningGetter(props, displayName) {
129 function warnAboutAccessingKey() {
130 specialPropKeyWarningShown ||
131 ((specialPropKeyWarningShown = !0),
132 console.error(
133 "%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://react.dev/link/special-props)",
134 displayName
135 ));
136 }
137 warnAboutAccessingKey.isReactWarning = !0;
138 Object.defineProperty(props, "key", {
139 get: warnAboutAccessingKey,
140 configurable: !0
141 });
142 }
143 function elementRefGetterWithDeprecationWarning() {
144 var componentName = getComponentNameFromType(this.type);
145 didWarnAboutElementRef[componentName] ||
146 ((didWarnAboutElementRef[componentName] = !0),
147 console.error(
148 "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
149 ));
150 componentName = this.props.ref;
151 return void 0 !== componentName ? componentName : null;
152 }
153 function ReactElement(type, key, props, owner, debugStack, debugTask) {
154 var refProp = props.ref;
155 type = {
156 $$typeof: REACT_ELEMENT_TYPE,
157 type: type,
158 key: key,
159 props: props,
160 _owner: owner
161 };
162 null !== (void 0 !== refProp ? refProp : null)
163 ? Object.defineProperty(type, "ref", {
164 enumerable: !1,
165 get: elementRefGetterWithDeprecationWarning
166 })
167 : Object.defineProperty(type, "ref", { enumerable: !1, value: null });
168 type._store = {};
169 Object.defineProperty(type._store, "validated", {
170 configurable: !1,
171 enumerable: !1,
172 writable: !0,
173 value: 0
174 });
175 Object.defineProperty(type, "_debugInfo", {
176 configurable: !1,
177 enumerable: !1,
178 writable: !0,
179 value: null
180 });
181 Object.defineProperty(type, "_debugStack", {
182 configurable: !1,
183 enumerable: !1,
184 writable: !0,
185 value: debugStack
186 });
187 Object.defineProperty(type, "_debugTask", {
188 configurable: !1,
189 enumerable: !1,
190 writable: !0,
191 value: debugTask
192 });
193 Object.freeze && (Object.freeze(type.props), Object.freeze(type));
194 return type;
195 }
196 function jsxDEVImpl(
197 type,
198 config,
199 maybeKey,
200 isStaticChildren,
201 debugStack,
202 debugTask
203 ) {
204 var children = config.children;
205 if (void 0 !== children)
206 if (isStaticChildren)
207 if (isArrayImpl(children)) {
208 for (
209 isStaticChildren = 0;
210 isStaticChildren < children.length;
211 isStaticChildren++
212 )
213 validateChildKeys(children[isStaticChildren]);
214 Object.freeze && Object.freeze(children);
215 } else
216 console.error(
217 "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
218 );
219 else validateChildKeys(children);
220 if (hasOwnProperty.call(config, "key")) {
221 children = getComponentNameFromType(type);
222 var keys = Object.keys(config).filter(function (k) {
223 return "key" !== k;
224 });
225 isStaticChildren =
226 0 < keys.length
227 ? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
228 : "{key: someKey}";
229 didWarnAboutKeySpread[children + isStaticChildren] ||
230 ((keys =
231 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
232 console.error(
233 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
234 isStaticChildren,
235 children,
236 keys,
237 children
238 ),
239 (didWarnAboutKeySpread[children + isStaticChildren] = !0));
240 }
241 children = null;
242 void 0 !== maybeKey &&
243 (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
244 hasValidKey(config) &&
245 (checkKeyStringCoercion(config.key), (children = "" + config.key));
246 if ("key" in config) {
247 maybeKey = {};
248 for (var propName in config)
249 "key" !== propName && (maybeKey[propName] = config[propName]);
250 } else maybeKey = config;
251 children &&
252 defineKeyPropWarningGetter(
253 maybeKey,
254 "function" === typeof type
255 ? type.displayName || type.name || "Unknown"
256 : type
257 );
258 return ReactElement(
259 type,
260 children,
261 maybeKey,
262 getOwner(),
263 debugStack,
264 debugTask
265 );
266 }
267 function validateChildKeys(node) {
268 isValidElement(node)
269 ? node._store && (node._store.validated = 1)
270 : "object" === typeof node &&
271 null !== node &&
272 node.$$typeof === REACT_LAZY_TYPE &&
273 ("fulfilled" === node._payload.status
274 ? isValidElement(node._payload.value) &&
275 node._payload.value._store &&
276 (node._payload.value._store.validated = 1)
277 : node._store && (node._store.validated = 1));
278 }
279 function isValidElement(object) {
280 return (
281 "object" === typeof object &&
282 null !== object &&
283 object.$$typeof === REACT_ELEMENT_TYPE
284 );
285 }
286 var React = require("react"),
287 REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
288 REACT_PORTAL_TYPE = Symbol.for("react.portal"),
289 REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
290 REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
291 REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
292 REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
293 REACT_CONTEXT_TYPE = Symbol.for("react.context"),
294 REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
295 REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
296 REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
297 REACT_MEMO_TYPE = Symbol.for("react.memo"),
298 REACT_LAZY_TYPE = Symbol.for("react.lazy"),
299 REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
300 REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
301 ReactSharedInternals =
302 React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
303 hasOwnProperty = Object.prototype.hasOwnProperty,
304 isArrayImpl = Array.isArray,
305 createTask = console.createTask
306 ? console.createTask
307 : function () {
308 return null;
309 };
310 React = {
311 react_stack_bottom_frame: function (callStackForError) {
312 return callStackForError();
313 }
314 };
315 var specialPropKeyWarningShown;
316 var didWarnAboutElementRef = {};
317 var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(
318 React,
319 UnknownOwner
320 )();
321 var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
322 var didWarnAboutKeySpread = {};
323 exports.Fragment = REACT_FRAGMENT_TYPE;
324 exports.jsx = function (type, config, maybeKey) {
325 var trackActualOwner =
326 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
327 return jsxDEVImpl(
328 type,
329 config,
330 maybeKey,
331 !1,
332 trackActualOwner
333 ? Error("react-stack-top-frame")
334 : unknownOwnerDebugStack,
335 trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
336 );
337 };
338 exports.jsxs = function (type, config, maybeKey) {
339 var trackActualOwner =
340 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
341 return jsxDEVImpl(
342 type,
343 config,
344 maybeKey,
345 !0,
346 trackActualOwner
347 ? Error("react-stack-top-frame")
348 : unknownOwnerDebugStack,
349 trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
350 );
351 };
352 })();