@kubb/plugin-ts 3.16.2 → 3.16.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/components-6F5RoYuJ.js +2240 -0
  2. package/dist/components-6F5RoYuJ.js.map +1 -0
  3. package/dist/components-B-Jx1kI5.cjs +2256 -0
  4. package/dist/components-B-Jx1kI5.cjs.map +1 -0
  5. package/dist/components.cjs +3 -15
  6. package/dist/components.d.cts +40 -26
  7. package/dist/components.d.ts +40 -26
  8. package/dist/components.js +3 -3
  9. package/dist/generators.cjs +4 -16
  10. package/dist/generators.d.cts +8 -9
  11. package/dist/generators.d.ts +8 -9
  12. package/dist/generators.js +4 -4
  13. package/dist/index.cjs +4 -17
  14. package/dist/index.d.cts +6 -8
  15. package/dist/index.d.ts +6 -8
  16. package/dist/index.js +3 -6
  17. package/dist/plugin-BXxI6FcR.cjs +378 -0
  18. package/dist/plugin-BXxI6FcR.cjs.map +1 -0
  19. package/dist/plugin-DXUISuTd.js +355 -0
  20. package/dist/plugin-DXUISuTd.js.map +1 -0
  21. package/dist/types-BL0qEGbB.d.cts +1223 -0
  22. package/dist/types-DFDnGwpy.d.ts +1223 -0
  23. package/package.json +22 -27
  24. package/dist/chunk-AUYOLJ62.js +0 -358
  25. package/dist/chunk-AUYOLJ62.js.map +0 -1
  26. package/dist/chunk-NAZDWNS6.cjs +0 -387
  27. package/dist/chunk-NAZDWNS6.cjs.map +0 -1
  28. package/dist/chunk-NDI35YW5.cjs +0 -2611
  29. package/dist/chunk-NDI35YW5.cjs.map +0 -1
  30. package/dist/chunk-V4C2DOV5.js +0 -2585
  31. package/dist/chunk-V4C2DOV5.js.map +0 -1
  32. package/dist/components.cjs.map +0 -1
  33. package/dist/components.js.map +0 -1
  34. package/dist/generators.cjs.map +0 -1
  35. package/dist/generators.js.map +0 -1
  36. package/dist/index.cjs.map +0 -1
  37. package/dist/index.js.map +0 -1
  38. package/dist/types-DkvPgLAK.d.cts +0 -116
  39. package/dist/types-DkvPgLAK.d.ts +0 -116
@@ -0,0 +1,2256 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n$1 = keys.length, key; i < n$1; i++) {
13
+ key = keys[i];
14
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
+ get: ((k) => from[k]).bind(null, key),
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
22
+ value: mod,
23
+ enumerable: true
24
+ }) : target, mod));
25
+
26
+ //#endregion
27
+ const __kubb_core_transformers = __toESM(require("@kubb/core/transformers"));
28
+ const __kubb_plugin_oas = __toESM(require("@kubb/plugin-oas"));
29
+ const __kubb_parser_ts = __toESM(require("@kubb/parser-ts"));
30
+ const __kubb_parser_ts_factory = __toESM(require("@kubb/parser-ts/factory"));
31
+ const __kubb_react = __toESM(require("@kubb/react"));
32
+ const __kubb_react_jsx_runtime = __toESM(require("@kubb/react/jsx-runtime"));
33
+
34
+ //#region src/components/OasType.tsx
35
+ function OasType({ name, typeName, api }) {
36
+ return /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsxs)(__kubb_react_jsx_runtime.Fragment, { children: [
37
+ /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.File.Source, {
38
+ name,
39
+ isExportable: true,
40
+ isIndexable: true,
41
+ children: `export const ${name} = ${JSON.stringify(api, void 0, 2)} as const`
42
+ }),
43
+ /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)("br", {}),
44
+ /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.File.Source, {
45
+ name: typeName,
46
+ isExportable: true,
47
+ isIndexable: true,
48
+ isTypeOnly: true,
49
+ children: /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.Type, {
50
+ name: typeName,
51
+ export: true,
52
+ children: `Infer<typeof ${name}>`
53
+ })
54
+ })
55
+ ] });
56
+ }
57
+
58
+ //#endregion
59
+ //#region ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js
60
+ var require_react_production_min = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js": ((exports) => {
61
+ var l = Symbol.for("react.element"), n = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), q = Symbol.for("react.strict_mode"), r = Symbol.for("react.profiler"), t = Symbol.for("react.provider"), u = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), x = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), z = Symbol.iterator;
62
+ function A(a) {
63
+ if (null === a || "object" !== typeof a) return null;
64
+ a = z && a[z] || a["@@iterator"];
65
+ return "function" === typeof a ? a : null;
66
+ }
67
+ var B = {
68
+ isMounted: function() {
69
+ return !1;
70
+ },
71
+ enqueueForceUpdate: function() {},
72
+ enqueueReplaceState: function() {},
73
+ enqueueSetState: function() {}
74
+ }, C = Object.assign, D = {};
75
+ function E(a, b, e) {
76
+ this.props = a;
77
+ this.context = b;
78
+ this.refs = D;
79
+ this.updater = e || B;
80
+ }
81
+ E.prototype.isReactComponent = {};
82
+ E.prototype.setState = function(a, b) {
83
+ if ("object" !== typeof a && "function" !== typeof a && null != a) throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
84
+ this.updater.enqueueSetState(this, a, b, "setState");
85
+ };
86
+ E.prototype.forceUpdate = function(a) {
87
+ this.updater.enqueueForceUpdate(this, a, "forceUpdate");
88
+ };
89
+ function F() {}
90
+ F.prototype = E.prototype;
91
+ function G(a, b, e) {
92
+ this.props = a;
93
+ this.context = b;
94
+ this.refs = D;
95
+ this.updater = e || B;
96
+ }
97
+ var H = G.prototype = new F();
98
+ H.constructor = G;
99
+ C(H, E.prototype);
100
+ H.isPureReactComponent = !0;
101
+ var I = Array.isArray, J = Object.prototype.hasOwnProperty, K = { current: null }, L = {
102
+ key: !0,
103
+ ref: !0,
104
+ __self: !0,
105
+ __source: !0
106
+ };
107
+ function M(a, b, e) {
108
+ var d, c = {}, k = null, h = null;
109
+ if (null != b) for (d in void 0 !== b.ref && (h = b.ref), void 0 !== b.key && (k = "" + b.key), b) J.call(b, d) && !L.hasOwnProperty(d) && (c[d] = b[d]);
110
+ var g = arguments.length - 2;
111
+ if (1 === g) c.children = e;
112
+ else if (1 < g) {
113
+ for (var f = Array(g), m = 0; m < g; m++) f[m] = arguments[m + 2];
114
+ c.children = f;
115
+ }
116
+ if (a && a.defaultProps) for (d in g = a.defaultProps, g) void 0 === c[d] && (c[d] = g[d]);
117
+ return {
118
+ $$typeof: l,
119
+ type: a,
120
+ key: k,
121
+ ref: h,
122
+ props: c,
123
+ _owner: K.current
124
+ };
125
+ }
126
+ function N(a, b) {
127
+ return {
128
+ $$typeof: l,
129
+ type: a.type,
130
+ key: b,
131
+ ref: a.ref,
132
+ props: a.props,
133
+ _owner: a._owner
134
+ };
135
+ }
136
+ function O(a) {
137
+ return "object" === typeof a && null !== a && a.$$typeof === l;
138
+ }
139
+ function escape(a) {
140
+ var b = {
141
+ "=": "=0",
142
+ ":": "=2"
143
+ };
144
+ return "$" + a.replace(/[=:]/g, function(a$1) {
145
+ return b[a$1];
146
+ });
147
+ }
148
+ var P = /\/+/g;
149
+ function Q(a, b) {
150
+ return "object" === typeof a && null !== a && null != a.key ? escape("" + a.key) : b.toString(36);
151
+ }
152
+ function R(a, b, e, d, c) {
153
+ var k = typeof a;
154
+ if ("undefined" === k || "boolean" === k) a = null;
155
+ var h = !1;
156
+ if (null === a) h = !0;
157
+ else switch (k) {
158
+ case "string":
159
+ case "number":
160
+ h = !0;
161
+ break;
162
+ case "object": switch (a.$$typeof) {
163
+ case l:
164
+ case n: h = !0;
165
+ }
166
+ }
167
+ if (h) return h = a, c = c(h), a = "" === d ? "." + Q(h, 0) : d, I(c) ? (e = "", null != a && (e = a.replace(P, "$&/") + "/"), R(c, b, e, "", function(a$1) {
168
+ return a$1;
169
+ })) : null != c && (O(c) && (c = N(c, e + (!c.key || h && h.key === c.key ? "" : ("" + c.key).replace(P, "$&/") + "/") + a)), b.push(c)), 1;
170
+ h = 0;
171
+ d = "" === d ? "." : d + ":";
172
+ if (I(a)) for (var g = 0; g < a.length; g++) {
173
+ k = a[g];
174
+ var f = d + Q(k, g);
175
+ h += R(k, b, e, f, c);
176
+ }
177
+ else if (f = A(a), "function" === typeof f) for (a = f.call(a), g = 0; !(k = a.next()).done;) k = k.value, f = d + Q(k, g++), h += R(k, b, e, f, c);
178
+ else if ("object" === k) throw b = String(a), Error("Objects are not valid as a React child (found: " + ("[object Object]" === b ? "object with keys {" + Object.keys(a).join(", ") + "}" : b) + "). If you meant to render a collection of children, use an array instead.");
179
+ return h;
180
+ }
181
+ function S(a, b, e) {
182
+ if (null == a) return a;
183
+ var d = [], c = 0;
184
+ R(a, d, "", "", function(a$1) {
185
+ return b.call(e, a$1, c++);
186
+ });
187
+ return d;
188
+ }
189
+ function T(a) {
190
+ if (-1 === a._status) {
191
+ var b = a._result;
192
+ b = b();
193
+ b.then(function(b$1) {
194
+ if (0 === a._status || -1 === a._status) a._status = 1, a._result = b$1;
195
+ }, function(b$1) {
196
+ if (0 === a._status || -1 === a._status) a._status = 2, a._result = b$1;
197
+ });
198
+ -1 === a._status && (a._status = 0, a._result = b);
199
+ }
200
+ if (1 === a._status) return a._result.default;
201
+ throw a._result;
202
+ }
203
+ var U = { current: null }, V = { transition: null }, W = {
204
+ ReactCurrentDispatcher: U,
205
+ ReactCurrentBatchConfig: V,
206
+ ReactCurrentOwner: K
207
+ };
208
+ function X() {
209
+ throw Error("act(...) is not supported in production builds of React.");
210
+ }
211
+ exports.Children = {
212
+ map: S,
213
+ forEach: function(a, b, e) {
214
+ S(a, function() {
215
+ b.apply(this, arguments);
216
+ }, e);
217
+ },
218
+ count: function(a) {
219
+ var b = 0;
220
+ S(a, function() {
221
+ b++;
222
+ });
223
+ return b;
224
+ },
225
+ toArray: function(a) {
226
+ return S(a, function(a$1) {
227
+ return a$1;
228
+ }) || [];
229
+ },
230
+ only: function(a) {
231
+ if (!O(a)) throw Error("React.Children.only expected to receive a single React element child.");
232
+ return a;
233
+ }
234
+ };
235
+ exports.Component = E;
236
+ exports.Fragment = p;
237
+ exports.Profiler = r;
238
+ exports.PureComponent = G;
239
+ exports.StrictMode = q;
240
+ exports.Suspense = w;
241
+ exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = W;
242
+ exports.act = X;
243
+ exports.cloneElement = function(a, b, e) {
244
+ if (null === a || void 0 === a) throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + a + ".");
245
+ var d = C({}, a.props), c = a.key, k = a.ref, h = a._owner;
246
+ if (null != b) {
247
+ void 0 !== b.ref && (k = b.ref, h = K.current);
248
+ void 0 !== b.key && (c = "" + b.key);
249
+ if (a.type && a.type.defaultProps) var g = a.type.defaultProps;
250
+ for (f in b) J.call(b, f) && !L.hasOwnProperty(f) && (d[f] = void 0 === b[f] && void 0 !== g ? g[f] : b[f]);
251
+ }
252
+ var f = arguments.length - 2;
253
+ if (1 === f) d.children = e;
254
+ else if (1 < f) {
255
+ g = Array(f);
256
+ for (var m = 0; m < f; m++) g[m] = arguments[m + 2];
257
+ d.children = g;
258
+ }
259
+ return {
260
+ $$typeof: l,
261
+ type: a.type,
262
+ key: c,
263
+ ref: k,
264
+ props: d,
265
+ _owner: h
266
+ };
267
+ };
268
+ exports.createContext = function(a) {
269
+ a = {
270
+ $$typeof: u,
271
+ _currentValue: a,
272
+ _currentValue2: a,
273
+ _threadCount: 0,
274
+ Provider: null,
275
+ Consumer: null,
276
+ _defaultValue: null,
277
+ _globalName: null
278
+ };
279
+ a.Provider = {
280
+ $$typeof: t,
281
+ _context: a
282
+ };
283
+ return a.Consumer = a;
284
+ };
285
+ exports.createElement = M;
286
+ exports.createFactory = function(a) {
287
+ var b = M.bind(null, a);
288
+ b.type = a;
289
+ return b;
290
+ };
291
+ exports.createRef = function() {
292
+ return { current: null };
293
+ };
294
+ exports.forwardRef = function(a) {
295
+ return {
296
+ $$typeof: v,
297
+ render: a
298
+ };
299
+ };
300
+ exports.isValidElement = O;
301
+ exports.lazy = function(a) {
302
+ return {
303
+ $$typeof: y,
304
+ _payload: {
305
+ _status: -1,
306
+ _result: a
307
+ },
308
+ _init: T
309
+ };
310
+ };
311
+ exports.memo = function(a, b) {
312
+ return {
313
+ $$typeof: x,
314
+ type: a,
315
+ compare: void 0 === b ? null : b
316
+ };
317
+ };
318
+ exports.startTransition = function(a) {
319
+ var b = V.transition;
320
+ V.transition = {};
321
+ try {
322
+ a();
323
+ } finally {
324
+ V.transition = b;
325
+ }
326
+ };
327
+ exports.unstable_act = X;
328
+ exports.useCallback = function(a, b) {
329
+ return U.current.useCallback(a, b);
330
+ };
331
+ exports.useContext = function(a) {
332
+ return U.current.useContext(a);
333
+ };
334
+ exports.useDebugValue = function() {};
335
+ exports.useDeferredValue = function(a) {
336
+ return U.current.useDeferredValue(a);
337
+ };
338
+ exports.useEffect = function(a, b) {
339
+ return U.current.useEffect(a, b);
340
+ };
341
+ exports.useId = function() {
342
+ return U.current.useId();
343
+ };
344
+ exports.useImperativeHandle = function(a, b, e) {
345
+ return U.current.useImperativeHandle(a, b, e);
346
+ };
347
+ exports.useInsertionEffect = function(a, b) {
348
+ return U.current.useInsertionEffect(a, b);
349
+ };
350
+ exports.useLayoutEffect = function(a, b) {
351
+ return U.current.useLayoutEffect(a, b);
352
+ };
353
+ exports.useMemo = function(a, b) {
354
+ return U.current.useMemo(a, b);
355
+ };
356
+ exports.useReducer = function(a, b, e) {
357
+ return U.current.useReducer(a, b, e);
358
+ };
359
+ exports.useRef = function(a) {
360
+ return U.current.useRef(a);
361
+ };
362
+ exports.useState = function(a) {
363
+ return U.current.useState(a);
364
+ };
365
+ exports.useSyncExternalStore = function(a, b, e) {
366
+ return U.current.useSyncExternalStore(a, b, e);
367
+ };
368
+ exports.useTransition = function() {
369
+ return U.current.useTransition();
370
+ };
371
+ exports.version = "18.3.1";
372
+ }) });
373
+
374
+ //#endregion
375
+ //#region ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.development.js
376
+ var require_react_development = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.development.js": ((exports, module) => {
377
+ if (process.env.NODE_ENV !== "production") (function() {
378
+ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(/* @__PURE__ */ new Error());
379
+ var ReactVersion = "18.3.1";
380
+ var REACT_ELEMENT_TYPE = Symbol.for("react.element");
381
+ var REACT_PORTAL_TYPE = Symbol.for("react.portal");
382
+ var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
383
+ var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
384
+ var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
385
+ var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
386
+ var REACT_CONTEXT_TYPE = Symbol.for("react.context");
387
+ var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
388
+ var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
389
+ var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
390
+ var REACT_MEMO_TYPE = Symbol.for("react.memo");
391
+ var REACT_LAZY_TYPE = Symbol.for("react.lazy");
392
+ var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
393
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
394
+ var FAUX_ITERATOR_SYMBOL = "@@iterator";
395
+ function getIteratorFn(maybeIterable) {
396
+ if (maybeIterable === null || typeof maybeIterable !== "object") return null;
397
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
398
+ if (typeof maybeIterator === "function") return maybeIterator;
399
+ return null;
400
+ }
401
+ /**
402
+ * Keeps track of the current dispatcher.
403
+ */
404
+ var ReactCurrentDispatcher = { current: null };
405
+ /**
406
+ * Keeps track of the current batch's configuration such as how long an update
407
+ * should suspend for if it needs to.
408
+ */
409
+ var ReactCurrentBatchConfig = { transition: null };
410
+ var ReactCurrentActQueue = {
411
+ current: null,
412
+ isBatchingLegacy: false,
413
+ didScheduleLegacyUpdate: false
414
+ };
415
+ /**
416
+ * Keeps track of the current owner.
417
+ *
418
+ * The current owner is the component who should own any components that are
419
+ * currently being constructed.
420
+ */
421
+ var ReactCurrentOwner = { current: null };
422
+ var ReactDebugCurrentFrame = {};
423
+ var currentExtraStackFrame = null;
424
+ function setExtraStackFrame(stack) {
425
+ currentExtraStackFrame = stack;
426
+ }
427
+ ReactDebugCurrentFrame.setExtraStackFrame = function(stack) {
428
+ currentExtraStackFrame = stack;
429
+ };
430
+ ReactDebugCurrentFrame.getCurrentStack = null;
431
+ ReactDebugCurrentFrame.getStackAddendum = function() {
432
+ var stack = "";
433
+ if (currentExtraStackFrame) stack += currentExtraStackFrame;
434
+ var impl = ReactDebugCurrentFrame.getCurrentStack;
435
+ if (impl) stack += impl() || "";
436
+ return stack;
437
+ };
438
+ var enableScopeAPI = false;
439
+ var enableCacheElement = false;
440
+ var enableTransitionTracing = false;
441
+ var enableLegacyHidden = false;
442
+ var enableDebugTracing = false;
443
+ var ReactSharedInternals = {
444
+ ReactCurrentDispatcher,
445
+ ReactCurrentBatchConfig,
446
+ ReactCurrentOwner
447
+ };
448
+ ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
449
+ ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
450
+ function warn(format) {
451
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) args[_key - 1] = arguments[_key];
452
+ printWarning("warn", format, args);
453
+ }
454
+ function error(format) {
455
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) args[_key2 - 1] = arguments[_key2];
456
+ printWarning("error", format, args);
457
+ }
458
+ function printWarning(level, format, args) {
459
+ var ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
460
+ var stack = ReactDebugCurrentFrame$2.getStackAddendum();
461
+ if (stack !== "") {
462
+ format += "%s";
463
+ args = args.concat([stack]);
464
+ }
465
+ var argsWithFormat = args.map(function(item) {
466
+ return String(item);
467
+ });
468
+ argsWithFormat.unshift("Warning: " + format);
469
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
470
+ }
471
+ var didWarnStateUpdateForUnmountedComponent = {};
472
+ function warnNoop(publicInstance, callerName) {
473
+ var _constructor = publicInstance.constructor;
474
+ var componentName = _constructor && (_constructor.displayName || _constructor.name) || "ReactClass";
475
+ var warningKey = componentName + "." + callerName;
476
+ if (didWarnStateUpdateForUnmountedComponent[warningKey]) return;
477
+ error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.", callerName, componentName);
478
+ didWarnStateUpdateForUnmountedComponent[warningKey] = true;
479
+ }
480
+ /**
481
+ * This is the abstract API for an update queue.
482
+ */
483
+ var ReactNoopUpdateQueue = {
484
+ isMounted: function(publicInstance) {
485
+ return false;
486
+ },
487
+ enqueueForceUpdate: function(publicInstance, callback, callerName) {
488
+ warnNoop(publicInstance, "forceUpdate");
489
+ },
490
+ enqueueReplaceState: function(publicInstance, completeState, callback, callerName) {
491
+ warnNoop(publicInstance, "replaceState");
492
+ },
493
+ enqueueSetState: function(publicInstance, partialState, callback, callerName) {
494
+ warnNoop(publicInstance, "setState");
495
+ }
496
+ };
497
+ var assign = Object.assign;
498
+ var emptyObject = {};
499
+ Object.freeze(emptyObject);
500
+ /**
501
+ * Base class helpers for the updating state of a component.
502
+ */
503
+ function Component(props, context, updater) {
504
+ this.props = props;
505
+ this.context = context;
506
+ this.refs = emptyObject;
507
+ this.updater = updater || ReactNoopUpdateQueue;
508
+ }
509
+ Component.prototype.isReactComponent = {};
510
+ /**
511
+ * Sets a subset of the state. Always use this to mutate
512
+ * state. You should treat `this.state` as immutable.
513
+ *
514
+ * There is no guarantee that `this.state` will be immediately updated, so
515
+ * accessing `this.state` after calling this method may return the old value.
516
+ *
517
+ * There is no guarantee that calls to `setState` will run synchronously,
518
+ * as they may eventually be batched together. You can provide an optional
519
+ * callback that will be executed when the call to setState is actually
520
+ * completed.
521
+ *
522
+ * When a function is provided to setState, it will be called at some point in
523
+ * the future (not synchronously). It will be called with the up to date
524
+ * component arguments (state, props, context). These values can be different
525
+ * from this.* because your function may be called after receiveProps but before
526
+ * shouldComponentUpdate, and this new state, props, and context will not yet be
527
+ * assigned to this.
528
+ *
529
+ * @param {object|function} partialState Next partial state or function to
530
+ * produce next partial state to be merged with current state.
531
+ * @param {?function} callback Called after state is updated.
532
+ * @final
533
+ * @protected
534
+ */
535
+ Component.prototype.setState = function(partialState, callback) {
536
+ if (typeof partialState !== "object" && typeof partialState !== "function" && partialState != null) throw new Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
537
+ this.updater.enqueueSetState(this, partialState, callback, "setState");
538
+ };
539
+ /**
540
+ * Forces an update. This should only be invoked when it is known with
541
+ * certainty that we are **not** in a DOM transaction.
542
+ *
543
+ * You may want to call this when you know that some deeper aspect of the
544
+ * component's state has changed but `setState` was not called.
545
+ *
546
+ * This will not invoke `shouldComponentUpdate`, but it will invoke
547
+ * `componentWillUpdate` and `componentDidUpdate`.
548
+ *
549
+ * @param {?function} callback Called after update is complete.
550
+ * @final
551
+ * @protected
552
+ */
553
+ Component.prototype.forceUpdate = function(callback) {
554
+ this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
555
+ };
556
+ var deprecatedAPIs = {
557
+ isMounted: ["isMounted", "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],
558
+ replaceState: ["replaceState", "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]
559
+ };
560
+ var defineDeprecationWarning = function(methodName, info) {
561
+ Object.defineProperty(Component.prototype, methodName, { get: function() {
562
+ warn("%s(...) is deprecated in plain JavaScript React classes. %s", info[0], info[1]);
563
+ return void 0;
564
+ } });
565
+ };
566
+ for (var fnName in deprecatedAPIs) if (deprecatedAPIs.hasOwnProperty(fnName)) defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
567
+ function ComponentDummy() {}
568
+ ComponentDummy.prototype = Component.prototype;
569
+ /**
570
+ * Convenience component with default shallow equality check for sCU.
571
+ */
572
+ function PureComponent(props, context, updater) {
573
+ this.props = props;
574
+ this.context = context;
575
+ this.refs = emptyObject;
576
+ this.updater = updater || ReactNoopUpdateQueue;
577
+ }
578
+ var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
579
+ pureComponentPrototype.constructor = PureComponent;
580
+ assign(pureComponentPrototype, Component.prototype);
581
+ pureComponentPrototype.isPureReactComponent = true;
582
+ function createRef() {
583
+ var refObject = { current: null };
584
+ Object.seal(refObject);
585
+ return refObject;
586
+ }
587
+ var isArrayImpl = Array.isArray;
588
+ function isArray(a) {
589
+ return isArrayImpl(a);
590
+ }
591
+ function typeName(value) {
592
+ var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
593
+ var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
594
+ return type;
595
+ }
596
+ function willCoercionThrow(value) {
597
+ try {
598
+ testStringCoercion(value);
599
+ return false;
600
+ } catch (e) {
601
+ return true;
602
+ }
603
+ }
604
+ function testStringCoercion(value) {
605
+ return "" + value;
606
+ }
607
+ function checkKeyStringCoercion(value) {
608
+ if (willCoercionThrow(value)) {
609
+ error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
610
+ return testStringCoercion(value);
611
+ }
612
+ }
613
+ function getWrappedName(outerType, innerType, wrapperName) {
614
+ var displayName = outerType.displayName;
615
+ if (displayName) return displayName;
616
+ var functionName = innerType.displayName || innerType.name || "";
617
+ return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
618
+ }
619
+ function getContextName(type) {
620
+ return type.displayName || "Context";
621
+ }
622
+ function getComponentNameFromType(type) {
623
+ if (type == null) return null;
624
+ if (typeof type.tag === "number") error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
625
+ if (typeof type === "function") return type.displayName || type.name || null;
626
+ if (typeof type === "string") return type;
627
+ switch (type) {
628
+ case REACT_FRAGMENT_TYPE: return "Fragment";
629
+ case REACT_PORTAL_TYPE: return "Portal";
630
+ case REACT_PROFILER_TYPE: return "Profiler";
631
+ case REACT_STRICT_MODE_TYPE: return "StrictMode";
632
+ case REACT_SUSPENSE_TYPE: return "Suspense";
633
+ case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList";
634
+ }
635
+ if (typeof type === "object") switch (type.$$typeof) {
636
+ case REACT_CONTEXT_TYPE:
637
+ var context = type;
638
+ return getContextName(context) + ".Consumer";
639
+ case REACT_PROVIDER_TYPE:
640
+ var provider = type;
641
+ return getContextName(provider._context) + ".Provider";
642
+ case REACT_FORWARD_REF_TYPE: return getWrappedName(type, type.render, "ForwardRef");
643
+ case REACT_MEMO_TYPE:
644
+ var outerName = type.displayName || null;
645
+ if (outerName !== null) return outerName;
646
+ return getComponentNameFromType(type.type) || "Memo";
647
+ case REACT_LAZY_TYPE:
648
+ var lazyComponent = type;
649
+ var payload = lazyComponent._payload;
650
+ var init = lazyComponent._init;
651
+ try {
652
+ return getComponentNameFromType(init(payload));
653
+ } catch (x$1) {
654
+ return null;
655
+ }
656
+ }
657
+ return null;
658
+ }
659
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
660
+ var RESERVED_PROPS = {
661
+ key: true,
662
+ ref: true,
663
+ __self: true,
664
+ __source: true
665
+ };
666
+ var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
667
+ didWarnAboutStringRefs = {};
668
+ function hasValidRef(config) {
669
+ if (hasOwnProperty.call(config, "ref")) {
670
+ var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
671
+ if (getter && getter.isReactWarning) return false;
672
+ }
673
+ return config.ref !== void 0;
674
+ }
675
+ function hasValidKey(config) {
676
+ if (hasOwnProperty.call(config, "key")) {
677
+ var getter = Object.getOwnPropertyDescriptor(config, "key").get;
678
+ if (getter && getter.isReactWarning) return false;
679
+ }
680
+ return config.key !== void 0;
681
+ }
682
+ function defineKeyPropWarningGetter(props, displayName) {
683
+ var warnAboutAccessingKey = function() {
684
+ if (!specialPropKeyWarningShown) {
685
+ specialPropKeyWarningShown = true;
686
+ 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);
687
+ }
688
+ };
689
+ warnAboutAccessingKey.isReactWarning = true;
690
+ Object.defineProperty(props, "key", {
691
+ get: warnAboutAccessingKey,
692
+ configurable: true
693
+ });
694
+ }
695
+ function defineRefPropWarningGetter(props, displayName) {
696
+ var warnAboutAccessingRef = function() {
697
+ if (!specialPropRefWarningShown) {
698
+ specialPropRefWarningShown = true;
699
+ 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);
700
+ }
701
+ };
702
+ warnAboutAccessingRef.isReactWarning = true;
703
+ Object.defineProperty(props, "ref", {
704
+ get: warnAboutAccessingRef,
705
+ configurable: true
706
+ });
707
+ }
708
+ function warnIfStringRefCannotBeAutoConverted(config) {
709
+ if (typeof config.ref === "string" && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
710
+ var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
711
+ if (!didWarnAboutStringRefs[componentName]) {
712
+ 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", componentName, config.ref);
713
+ didWarnAboutStringRefs[componentName] = true;
714
+ }
715
+ }
716
+ }
717
+ /**
718
+ * Factory method to create a new React element. This no longer adheres to
719
+ * the class pattern, so do not use new to call it. Also, instanceof check
720
+ * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
721
+ * if something is a React Element.
722
+ *
723
+ * @param {*} type
724
+ * @param {*} props
725
+ * @param {*} key
726
+ * @param {string|object} ref
727
+ * @param {*} owner
728
+ * @param {*} self A *temporary* helper to detect places where `this` is
729
+ * different from the `owner` when React.createElement is called, so that we
730
+ * can warn. We want to get rid of owner and replace string `ref`s with arrow
731
+ * functions, and as long as `this` and owner are the same, there will be no
732
+ * change in behavior.
733
+ * @param {*} source An annotation object (added by a transpiler or otherwise)
734
+ * indicating filename, line number, and/or other information.
735
+ * @internal
736
+ */
737
+ var ReactElement = function(type, key, ref, self, source, owner, props) {
738
+ var element = {
739
+ $$typeof: REACT_ELEMENT_TYPE,
740
+ type,
741
+ key,
742
+ ref,
743
+ props,
744
+ _owner: owner
745
+ };
746
+ element._store = {};
747
+ Object.defineProperty(element._store, "validated", {
748
+ configurable: false,
749
+ enumerable: false,
750
+ writable: true,
751
+ value: false
752
+ });
753
+ Object.defineProperty(element, "_self", {
754
+ configurable: false,
755
+ enumerable: false,
756
+ writable: false,
757
+ value: self
758
+ });
759
+ Object.defineProperty(element, "_source", {
760
+ configurable: false,
761
+ enumerable: false,
762
+ writable: false,
763
+ value: source
764
+ });
765
+ if (Object.freeze) {
766
+ Object.freeze(element.props);
767
+ Object.freeze(element);
768
+ }
769
+ return element;
770
+ };
771
+ /**
772
+ * Create and return a new ReactElement of the given type.
773
+ * See https://reactjs.org/docs/react-api.html#createelement
774
+ */
775
+ function createElement(type, config, children) {
776
+ var propName;
777
+ var props = {};
778
+ var key = null;
779
+ var ref = null;
780
+ var self = null;
781
+ var source = null;
782
+ if (config != null) {
783
+ if (hasValidRef(config)) {
784
+ ref = config.ref;
785
+ warnIfStringRefCannotBeAutoConverted(config);
786
+ }
787
+ if (hasValidKey(config)) {
788
+ checkKeyStringCoercion(config.key);
789
+ key = "" + config.key;
790
+ }
791
+ self = config.__self === void 0 ? null : config.__self;
792
+ source = config.__source === void 0 ? null : config.__source;
793
+ for (propName in config) if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) props[propName] = config[propName];
794
+ }
795
+ var childrenLength = arguments.length - 2;
796
+ if (childrenLength === 1) props.children = children;
797
+ else if (childrenLength > 1) {
798
+ var childArray = Array(childrenLength);
799
+ for (var i = 0; i < childrenLength; i++) childArray[i] = arguments[i + 2];
800
+ if (Object.freeze) Object.freeze(childArray);
801
+ props.children = childArray;
802
+ }
803
+ if (type && type.defaultProps) {
804
+ var defaultProps = type.defaultProps;
805
+ for (propName in defaultProps) if (props[propName] === void 0) props[propName] = defaultProps[propName];
806
+ }
807
+ if (key || ref) {
808
+ var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
809
+ if (key) defineKeyPropWarningGetter(props, displayName);
810
+ if (ref) defineRefPropWarningGetter(props, displayName);
811
+ }
812
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
813
+ }
814
+ function cloneAndReplaceKey(oldElement, newKey) {
815
+ var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
816
+ return newElement;
817
+ }
818
+ /**
819
+ * Clone and return a new ReactElement using element as the starting point.
820
+ * See https://reactjs.org/docs/react-api.html#cloneelement
821
+ */
822
+ function cloneElement(element, config, children) {
823
+ if (element === null || element === void 0) throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
824
+ var propName;
825
+ var props = assign({}, element.props);
826
+ var key = element.key;
827
+ var ref = element.ref;
828
+ var self = element._self;
829
+ var source = element._source;
830
+ var owner = element._owner;
831
+ if (config != null) {
832
+ if (hasValidRef(config)) {
833
+ ref = config.ref;
834
+ owner = ReactCurrentOwner.current;
835
+ }
836
+ if (hasValidKey(config)) {
837
+ checkKeyStringCoercion(config.key);
838
+ key = "" + config.key;
839
+ }
840
+ var defaultProps;
841
+ if (element.type && element.type.defaultProps) defaultProps = element.type.defaultProps;
842
+ for (propName in config) if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) if (config[propName] === void 0 && defaultProps !== void 0) props[propName] = defaultProps[propName];
843
+ else props[propName] = config[propName];
844
+ }
845
+ var childrenLength = arguments.length - 2;
846
+ if (childrenLength === 1) props.children = children;
847
+ else if (childrenLength > 1) {
848
+ var childArray = Array(childrenLength);
849
+ for (var i = 0; i < childrenLength; i++) childArray[i] = arguments[i + 2];
850
+ props.children = childArray;
851
+ }
852
+ return ReactElement(element.type, key, ref, self, source, owner, props);
853
+ }
854
+ /**
855
+ * Verifies the object is a ReactElement.
856
+ * See https://reactjs.org/docs/react-api.html#isvalidelement
857
+ * @param {?object} object
858
+ * @return {boolean} True if `object` is a ReactElement.
859
+ * @final
860
+ */
861
+ function isValidElement(object) {
862
+ return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
863
+ }
864
+ var SEPARATOR = ".";
865
+ var SUBSEPARATOR = ":";
866
+ /**
867
+ * Escape and wrap key so it is safe to use as a reactid
868
+ *
869
+ * @param {string} key to be escaped.
870
+ * @return {string} the escaped key.
871
+ */
872
+ function escape$1(key) {
873
+ var escapeRegex = /[=:]/g;
874
+ var escaperLookup = {
875
+ "=": "=0",
876
+ ":": "=2"
877
+ };
878
+ var escapedString = key.replace(escapeRegex, function(match) {
879
+ return escaperLookup[match];
880
+ });
881
+ return "$" + escapedString;
882
+ }
883
+ /**
884
+ * TODO: Test that a single child and an array with one item have the same key
885
+ * pattern.
886
+ */
887
+ var didWarnAboutMaps = false;
888
+ var userProvidedKeyEscapeRegex = /\/+/g;
889
+ function escapeUserProvidedKey(text) {
890
+ return text.replace(userProvidedKeyEscapeRegex, "$&/");
891
+ }
892
+ /**
893
+ * Generate a key string that identifies a element within a set.
894
+ *
895
+ * @param {*} element A element that could contain a manual key.
896
+ * @param {number} index Index that is used if a manual key is not provided.
897
+ * @return {string}
898
+ */
899
+ function getElementKey(element, index) {
900
+ if (typeof element === "object" && element !== null && element.key != null) {
901
+ checkKeyStringCoercion(element.key);
902
+ return escape$1("" + element.key);
903
+ }
904
+ return index.toString(36);
905
+ }
906
+ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
907
+ var type = typeof children;
908
+ if (type === "undefined" || type === "boolean") children = null;
909
+ var invokeCallback = false;
910
+ if (children === null) invokeCallback = true;
911
+ else switch (type) {
912
+ case "string":
913
+ case "number":
914
+ invokeCallback = true;
915
+ break;
916
+ case "object": switch (children.$$typeof) {
917
+ case REACT_ELEMENT_TYPE:
918
+ case REACT_PORTAL_TYPE: invokeCallback = true;
919
+ }
920
+ }
921
+ if (invokeCallback) {
922
+ var _child = children;
923
+ var mappedChild = callback(_child);
924
+ var childKey = nameSoFar === "" ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
925
+ if (isArray(mappedChild)) {
926
+ var escapedChildKey = "";
927
+ if (childKey != null) escapedChildKey = escapeUserProvidedKey(childKey) + "/";
928
+ mapIntoArray(mappedChild, array, escapedChildKey, "", function(c) {
929
+ return c;
930
+ });
931
+ } else if (mappedChild != null) {
932
+ if (isValidElement(mappedChild)) {
933
+ if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) checkKeyStringCoercion(mappedChild.key);
934
+ mappedChild = cloneAndReplaceKey(mappedChild, escapedPrefix + (mappedChild.key && (!_child || _child.key !== mappedChild.key) ? escapeUserProvidedKey("" + mappedChild.key) + "/" : "") + childKey);
935
+ }
936
+ array.push(mappedChild);
937
+ }
938
+ return 1;
939
+ }
940
+ var child;
941
+ var nextName;
942
+ var subtreeCount = 0;
943
+ var nextNamePrefix = nameSoFar === "" ? SEPARATOR : nameSoFar + SUBSEPARATOR;
944
+ if (isArray(children)) for (var i = 0; i < children.length; i++) {
945
+ child = children[i];
946
+ nextName = nextNamePrefix + getElementKey(child, i);
947
+ subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
948
+ }
949
+ else {
950
+ var iteratorFn = getIteratorFn(children);
951
+ if (typeof iteratorFn === "function") {
952
+ var iterableChildren = children;
953
+ if (iteratorFn === iterableChildren.entries) {
954
+ if (!didWarnAboutMaps) warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead.");
955
+ didWarnAboutMaps = true;
956
+ }
957
+ var iterator = iteratorFn.call(iterableChildren);
958
+ var step;
959
+ var ii = 0;
960
+ while (!(step = iterator.next()).done) {
961
+ child = step.value;
962
+ nextName = nextNamePrefix + getElementKey(child, ii++);
963
+ subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
964
+ }
965
+ } else if (type === "object") {
966
+ var childrenString = String(children);
967
+ throw new Error("Objects are not valid as a React child (found: " + (childrenString === "[object Object]" ? "object with keys {" + Object.keys(children).join(", ") + "}" : childrenString) + "). If you meant to render a collection of children, use an array instead.");
968
+ }
969
+ }
970
+ return subtreeCount;
971
+ }
972
+ /**
973
+ * Maps children that are typically specified as `props.children`.
974
+ *
975
+ * See https://reactjs.org/docs/react-api.html#reactchildrenmap
976
+ *
977
+ * The provided mapFunction(child, index) will be called for each
978
+ * leaf child.
979
+ *
980
+ * @param {?*} children Children tree container.
981
+ * @param {function(*, int)} func The map function.
982
+ * @param {*} context Context for mapFunction.
983
+ * @return {object} Object containing the ordered map of results.
984
+ */
985
+ function mapChildren(children, func, context) {
986
+ if (children == null) return children;
987
+ var result = [];
988
+ var count = 0;
989
+ mapIntoArray(children, result, "", "", function(child) {
990
+ return func.call(context, child, count++);
991
+ });
992
+ return result;
993
+ }
994
+ /**
995
+ * Count the number of children that are typically specified as
996
+ * `props.children`.
997
+ *
998
+ * See https://reactjs.org/docs/react-api.html#reactchildrencount
999
+ *
1000
+ * @param {?*} children Children tree container.
1001
+ * @return {number} The number of children.
1002
+ */
1003
+ function countChildren(children) {
1004
+ var n$1 = 0;
1005
+ mapChildren(children, function() {
1006
+ n$1++;
1007
+ });
1008
+ return n$1;
1009
+ }
1010
+ /**
1011
+ * Iterates through children that are typically specified as `props.children`.
1012
+ *
1013
+ * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
1014
+ *
1015
+ * The provided forEachFunc(child, index) will be called for each
1016
+ * leaf child.
1017
+ *
1018
+ * @param {?*} children Children tree container.
1019
+ * @param {function(*, int)} forEachFunc
1020
+ * @param {*} forEachContext Context for forEachContext.
1021
+ */
1022
+ function forEachChildren(children, forEachFunc, forEachContext) {
1023
+ mapChildren(children, function() {
1024
+ forEachFunc.apply(this, arguments);
1025
+ }, forEachContext);
1026
+ }
1027
+ /**
1028
+ * Flatten a children object (typically specified as `props.children`) and
1029
+ * return an array with appropriately re-keyed children.
1030
+ *
1031
+ * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
1032
+ */
1033
+ function toArray(children) {
1034
+ return mapChildren(children, function(child) {
1035
+ return child;
1036
+ }) || [];
1037
+ }
1038
+ /**
1039
+ * Returns the first child in a collection of children and verifies that there
1040
+ * is only one child in the collection.
1041
+ *
1042
+ * See https://reactjs.org/docs/react-api.html#reactchildrenonly
1043
+ *
1044
+ * The current implementation of this function assumes that a single child gets
1045
+ * passed without a wrapper, but the purpose of this helper function is to
1046
+ * abstract away the particular structure of children.
1047
+ *
1048
+ * @param {?object} children Child collection structure.
1049
+ * @return {ReactElement} The first and only `ReactElement` contained in the
1050
+ * structure.
1051
+ */
1052
+ function onlyChild(children) {
1053
+ if (!isValidElement(children)) throw new Error("React.Children.only expected to receive a single React element child.");
1054
+ return children;
1055
+ }
1056
+ function createContext(defaultValue) {
1057
+ var context = {
1058
+ $$typeof: REACT_CONTEXT_TYPE,
1059
+ _currentValue: defaultValue,
1060
+ _currentValue2: defaultValue,
1061
+ _threadCount: 0,
1062
+ Provider: null,
1063
+ Consumer: null,
1064
+ _defaultValue: null,
1065
+ _globalName: null
1066
+ };
1067
+ context.Provider = {
1068
+ $$typeof: REACT_PROVIDER_TYPE,
1069
+ _context: context
1070
+ };
1071
+ var hasWarnedAboutUsingNestedContextConsumers = false;
1072
+ var hasWarnedAboutUsingConsumerProvider = false;
1073
+ var hasWarnedAboutDisplayNameOnConsumer = false;
1074
+ var Consumer = {
1075
+ $$typeof: REACT_CONTEXT_TYPE,
1076
+ _context: context
1077
+ };
1078
+ Object.defineProperties(Consumer, {
1079
+ Provider: {
1080
+ get: function() {
1081
+ if (!hasWarnedAboutUsingConsumerProvider) {
1082
+ hasWarnedAboutUsingConsumerProvider = true;
1083
+ error("Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?");
1084
+ }
1085
+ return context.Provider;
1086
+ },
1087
+ set: function(_Provider) {
1088
+ context.Provider = _Provider;
1089
+ }
1090
+ },
1091
+ _currentValue: {
1092
+ get: function() {
1093
+ return context._currentValue;
1094
+ },
1095
+ set: function(_currentValue) {
1096
+ context._currentValue = _currentValue;
1097
+ }
1098
+ },
1099
+ _currentValue2: {
1100
+ get: function() {
1101
+ return context._currentValue2;
1102
+ },
1103
+ set: function(_currentValue2) {
1104
+ context._currentValue2 = _currentValue2;
1105
+ }
1106
+ },
1107
+ _threadCount: {
1108
+ get: function() {
1109
+ return context._threadCount;
1110
+ },
1111
+ set: function(_threadCount) {
1112
+ context._threadCount = _threadCount;
1113
+ }
1114
+ },
1115
+ Consumer: { get: function() {
1116
+ if (!hasWarnedAboutUsingNestedContextConsumers) {
1117
+ hasWarnedAboutUsingNestedContextConsumers = true;
1118
+ error("Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?");
1119
+ }
1120
+ return context.Consumer;
1121
+ } },
1122
+ displayName: {
1123
+ get: function() {
1124
+ return context.displayName;
1125
+ },
1126
+ set: function(displayName) {
1127
+ if (!hasWarnedAboutDisplayNameOnConsumer) {
1128
+ warn("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.", displayName);
1129
+ hasWarnedAboutDisplayNameOnConsumer = true;
1130
+ }
1131
+ }
1132
+ }
1133
+ });
1134
+ context.Consumer = Consumer;
1135
+ context._currentRenderer = null;
1136
+ context._currentRenderer2 = null;
1137
+ return context;
1138
+ }
1139
+ var Uninitialized = -1;
1140
+ var Pending = 0;
1141
+ var Resolved = 1;
1142
+ var Rejected = 2;
1143
+ function lazyInitializer(payload) {
1144
+ if (payload._status === Uninitialized) {
1145
+ var ctor = payload._result;
1146
+ var thenable = ctor();
1147
+ thenable.then(function(moduleObject$1) {
1148
+ if (payload._status === Pending || payload._status === Uninitialized) {
1149
+ var resolved = payload;
1150
+ resolved._status = Resolved;
1151
+ resolved._result = moduleObject$1;
1152
+ }
1153
+ }, function(error$1) {
1154
+ if (payload._status === Pending || payload._status === Uninitialized) {
1155
+ var rejected = payload;
1156
+ rejected._status = Rejected;
1157
+ rejected._result = error$1;
1158
+ }
1159
+ });
1160
+ if (payload._status === Uninitialized) {
1161
+ var pending = payload;
1162
+ pending._status = Pending;
1163
+ pending._result = thenable;
1164
+ }
1165
+ }
1166
+ if (payload._status === Resolved) {
1167
+ var moduleObject = payload._result;
1168
+ if (moduleObject === void 0) error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?", moduleObject);
1169
+ if (!("default" in moduleObject)) error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))", moduleObject);
1170
+ return moduleObject.default;
1171
+ } else throw payload._result;
1172
+ }
1173
+ function lazy(ctor) {
1174
+ var payload = {
1175
+ _status: Uninitialized,
1176
+ _result: ctor
1177
+ };
1178
+ var lazyType = {
1179
+ $$typeof: REACT_LAZY_TYPE,
1180
+ _payload: payload,
1181
+ _init: lazyInitializer
1182
+ };
1183
+ var defaultProps;
1184
+ var propTypes;
1185
+ Object.defineProperties(lazyType, {
1186
+ defaultProps: {
1187
+ configurable: true,
1188
+ get: function() {
1189
+ return defaultProps;
1190
+ },
1191
+ set: function(newDefaultProps) {
1192
+ error("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it.");
1193
+ defaultProps = newDefaultProps;
1194
+ Object.defineProperty(lazyType, "defaultProps", { enumerable: true });
1195
+ }
1196
+ },
1197
+ propTypes: {
1198
+ configurable: true,
1199
+ get: function() {
1200
+ return propTypes;
1201
+ },
1202
+ set: function(newPropTypes) {
1203
+ error("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it.");
1204
+ propTypes = newPropTypes;
1205
+ Object.defineProperty(lazyType, "propTypes", { enumerable: true });
1206
+ }
1207
+ }
1208
+ });
1209
+ return lazyType;
1210
+ }
1211
+ function forwardRef(render) {
1212
+ if (render != null && render.$$typeof === REACT_MEMO_TYPE) error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).");
1213
+ else if (typeof render !== "function") error("forwardRef requires a render function but was given %s.", render === null ? "null" : typeof render);
1214
+ else if (render.length !== 0 && render.length !== 2) error("forwardRef render functions accept exactly two parameters: props and ref. %s", render.length === 1 ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined.");
1215
+ if (render != null) {
1216
+ if (render.defaultProps != null || render.propTypes != null) error("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?");
1217
+ }
1218
+ var elementType = {
1219
+ $$typeof: REACT_FORWARD_REF_TYPE,
1220
+ render
1221
+ };
1222
+ var ownName;
1223
+ Object.defineProperty(elementType, "displayName", {
1224
+ enumerable: false,
1225
+ configurable: true,
1226
+ get: function() {
1227
+ return ownName;
1228
+ },
1229
+ set: function(name) {
1230
+ ownName = name;
1231
+ if (!render.name && !render.displayName) render.displayName = name;
1232
+ }
1233
+ });
1234
+ return elementType;
1235
+ }
1236
+ var REACT_MODULE_REFERENCE;
1237
+ REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
1238
+ function isValidElementType(type) {
1239
+ if (typeof type === "string" || typeof type === "function") return true;
1240
+ if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) return true;
1241
+ if (typeof type === "object" && type !== null) {
1242
+ 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_MODULE_REFERENCE || type.getModuleId !== void 0) return true;
1243
+ }
1244
+ return false;
1245
+ }
1246
+ function memo(type, compare) {
1247
+ if (!isValidElementType(type)) error("memo: The first argument must be a component. Instead received: %s", type === null ? "null" : typeof type);
1248
+ var elementType = {
1249
+ $$typeof: REACT_MEMO_TYPE,
1250
+ type,
1251
+ compare: compare === void 0 ? null : compare
1252
+ };
1253
+ var ownName;
1254
+ Object.defineProperty(elementType, "displayName", {
1255
+ enumerable: false,
1256
+ configurable: true,
1257
+ get: function() {
1258
+ return ownName;
1259
+ },
1260
+ set: function(name) {
1261
+ ownName = name;
1262
+ if (!type.name && !type.displayName) type.displayName = name;
1263
+ }
1264
+ });
1265
+ return elementType;
1266
+ }
1267
+ function resolveDispatcher() {
1268
+ var dispatcher = ReactCurrentDispatcher.current;
1269
+ if (dispatcher === null) error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.");
1270
+ return dispatcher;
1271
+ }
1272
+ function useContext(Context) {
1273
+ var dispatcher = resolveDispatcher();
1274
+ if (Context._context !== void 0) {
1275
+ var realContext = Context._context;
1276
+ if (realContext.Consumer === Context) error("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?");
1277
+ else if (realContext.Provider === Context) error("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?");
1278
+ }
1279
+ return dispatcher.useContext(Context);
1280
+ }
1281
+ function useState(initialState) {
1282
+ var dispatcher = resolveDispatcher();
1283
+ return dispatcher.useState(initialState);
1284
+ }
1285
+ function useReducer(reducer, initialArg, init) {
1286
+ var dispatcher = resolveDispatcher();
1287
+ return dispatcher.useReducer(reducer, initialArg, init);
1288
+ }
1289
+ function useRef(initialValue) {
1290
+ var dispatcher = resolveDispatcher();
1291
+ return dispatcher.useRef(initialValue);
1292
+ }
1293
+ function useEffect(create, deps) {
1294
+ var dispatcher = resolveDispatcher();
1295
+ return dispatcher.useEffect(create, deps);
1296
+ }
1297
+ function useInsertionEffect(create, deps) {
1298
+ var dispatcher = resolveDispatcher();
1299
+ return dispatcher.useInsertionEffect(create, deps);
1300
+ }
1301
+ function useLayoutEffect(create, deps) {
1302
+ var dispatcher = resolveDispatcher();
1303
+ return dispatcher.useLayoutEffect(create, deps);
1304
+ }
1305
+ function useCallback(callback, deps) {
1306
+ var dispatcher = resolveDispatcher();
1307
+ return dispatcher.useCallback(callback, deps);
1308
+ }
1309
+ function useMemo(create, deps) {
1310
+ var dispatcher = resolveDispatcher();
1311
+ return dispatcher.useMemo(create, deps);
1312
+ }
1313
+ function useImperativeHandle(ref, create, deps) {
1314
+ var dispatcher = resolveDispatcher();
1315
+ return dispatcher.useImperativeHandle(ref, create, deps);
1316
+ }
1317
+ function useDebugValue(value, formatterFn) {
1318
+ var dispatcher = resolveDispatcher();
1319
+ return dispatcher.useDebugValue(value, formatterFn);
1320
+ }
1321
+ function useTransition() {
1322
+ var dispatcher = resolveDispatcher();
1323
+ return dispatcher.useTransition();
1324
+ }
1325
+ function useDeferredValue(value) {
1326
+ var dispatcher = resolveDispatcher();
1327
+ return dispatcher.useDeferredValue(value);
1328
+ }
1329
+ function useId() {
1330
+ var dispatcher = resolveDispatcher();
1331
+ return dispatcher.useId();
1332
+ }
1333
+ function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
1334
+ var dispatcher = resolveDispatcher();
1335
+ return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
1336
+ }
1337
+ var disabledDepth = 0;
1338
+ var prevLog;
1339
+ var prevInfo;
1340
+ var prevWarn;
1341
+ var prevError;
1342
+ var prevGroup;
1343
+ var prevGroupCollapsed;
1344
+ var prevGroupEnd;
1345
+ function disabledLog() {}
1346
+ disabledLog.__reactDisabledLog = true;
1347
+ function disableLogs() {
1348
+ if (disabledDepth === 0) {
1349
+ prevLog = console.log;
1350
+ prevInfo = console.info;
1351
+ prevWarn = console.warn;
1352
+ prevError = console.error;
1353
+ prevGroup = console.group;
1354
+ prevGroupCollapsed = console.groupCollapsed;
1355
+ prevGroupEnd = console.groupEnd;
1356
+ var props = {
1357
+ configurable: true,
1358
+ enumerable: true,
1359
+ value: disabledLog,
1360
+ writable: true
1361
+ };
1362
+ Object.defineProperties(console, {
1363
+ info: props,
1364
+ log: props,
1365
+ warn: props,
1366
+ error: props,
1367
+ group: props,
1368
+ groupCollapsed: props,
1369
+ groupEnd: props
1370
+ });
1371
+ }
1372
+ disabledDepth++;
1373
+ }
1374
+ function reenableLogs() {
1375
+ disabledDepth--;
1376
+ if (disabledDepth === 0) {
1377
+ var props = {
1378
+ configurable: true,
1379
+ enumerable: true,
1380
+ writable: true
1381
+ };
1382
+ Object.defineProperties(console, {
1383
+ log: assign({}, props, { value: prevLog }),
1384
+ info: assign({}, props, { value: prevInfo }),
1385
+ warn: assign({}, props, { value: prevWarn }),
1386
+ error: assign({}, props, { value: prevError }),
1387
+ group: assign({}, props, { value: prevGroup }),
1388
+ groupCollapsed: assign({}, props, { value: prevGroupCollapsed }),
1389
+ groupEnd: assign({}, props, { value: prevGroupEnd })
1390
+ });
1391
+ }
1392
+ if (disabledDepth < 0) error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
1393
+ }
1394
+ var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
1395
+ var prefix;
1396
+ function describeBuiltInComponentFrame(name, source, ownerFn) {
1397
+ if (prefix === void 0) try {
1398
+ throw Error();
1399
+ } catch (x$1) {
1400
+ var match = x$1.stack.trim().match(/\n( *(at )?)/);
1401
+ prefix = match && match[1] || "";
1402
+ }
1403
+ return "\n" + prefix + name;
1404
+ }
1405
+ var reentry = false;
1406
+ var componentFrameCache;
1407
+ var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
1408
+ componentFrameCache = new PossiblyWeakMap();
1409
+ function describeNativeComponentFrame(fn, construct) {
1410
+ if (!fn || reentry) return "";
1411
+ var frame = componentFrameCache.get(fn);
1412
+ if (frame !== void 0) return frame;
1413
+ var control;
1414
+ reentry = true;
1415
+ var previousPrepareStackTrace = Error.prepareStackTrace;
1416
+ Error.prepareStackTrace = void 0;
1417
+ var previousDispatcher;
1418
+ previousDispatcher = ReactCurrentDispatcher$1.current;
1419
+ ReactCurrentDispatcher$1.current = null;
1420
+ disableLogs();
1421
+ try {
1422
+ if (construct) {
1423
+ var Fake = function() {
1424
+ throw Error();
1425
+ };
1426
+ Object.defineProperty(Fake.prototype, "props", { set: function() {
1427
+ throw Error();
1428
+ } });
1429
+ if (typeof Reflect === "object" && Reflect.construct) {
1430
+ try {
1431
+ Reflect.construct(Fake, []);
1432
+ } catch (x$1) {
1433
+ control = x$1;
1434
+ }
1435
+ Reflect.construct(fn, [], Fake);
1436
+ } else {
1437
+ try {
1438
+ Fake.call();
1439
+ } catch (x$1) {
1440
+ control = x$1;
1441
+ }
1442
+ fn.call(Fake.prototype);
1443
+ }
1444
+ } else {
1445
+ try {
1446
+ throw Error();
1447
+ } catch (x$1) {
1448
+ control = x$1;
1449
+ }
1450
+ fn();
1451
+ }
1452
+ } catch (sample) {
1453
+ if (sample && control && typeof sample.stack === "string") {
1454
+ var sampleLines = sample.stack.split("\n");
1455
+ var controlLines = control.stack.split("\n");
1456
+ var s = sampleLines.length - 1;
1457
+ var c = controlLines.length - 1;
1458
+ while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) c--;
1459
+ for (; s >= 1 && c >= 0; s--, c--) if (sampleLines[s] !== controlLines[c]) {
1460
+ if (s !== 1 || c !== 1) do {
1461
+ s--;
1462
+ c--;
1463
+ if (c < 0 || sampleLines[s] !== controlLines[c]) {
1464
+ var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
1465
+ if (fn.displayName && _frame.includes("<anonymous>")) _frame = _frame.replace("<anonymous>", fn.displayName);
1466
+ if (typeof fn === "function") componentFrameCache.set(fn, _frame);
1467
+ return _frame;
1468
+ }
1469
+ } while (s >= 1 && c >= 0);
1470
+ break;
1471
+ }
1472
+ }
1473
+ } finally {
1474
+ reentry = false;
1475
+ ReactCurrentDispatcher$1.current = previousDispatcher;
1476
+ reenableLogs();
1477
+ Error.prepareStackTrace = previousPrepareStackTrace;
1478
+ }
1479
+ var name = fn ? fn.displayName || fn.name : "";
1480
+ var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
1481
+ if (typeof fn === "function") componentFrameCache.set(fn, syntheticFrame);
1482
+ return syntheticFrame;
1483
+ }
1484
+ function describeFunctionComponentFrame(fn, source, ownerFn) {
1485
+ return describeNativeComponentFrame(fn, false);
1486
+ }
1487
+ function shouldConstruct(Component$1) {
1488
+ var prototype = Component$1.prototype;
1489
+ return !!(prototype && prototype.isReactComponent);
1490
+ }
1491
+ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
1492
+ if (type == null) return "";
1493
+ if (typeof type === "function") return describeNativeComponentFrame(type, shouldConstruct(type));
1494
+ if (typeof type === "string") return describeBuiltInComponentFrame(type);
1495
+ switch (type) {
1496
+ case REACT_SUSPENSE_TYPE: return describeBuiltInComponentFrame("Suspense");
1497
+ case REACT_SUSPENSE_LIST_TYPE: return describeBuiltInComponentFrame("SuspenseList");
1498
+ }
1499
+ if (typeof type === "object") switch (type.$$typeof) {
1500
+ case REACT_FORWARD_REF_TYPE: return describeFunctionComponentFrame(type.render);
1501
+ case REACT_MEMO_TYPE: return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
1502
+ case REACT_LAZY_TYPE:
1503
+ var lazyComponent = type;
1504
+ var payload = lazyComponent._payload;
1505
+ var init = lazyComponent._init;
1506
+ try {
1507
+ return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
1508
+ } catch (x$1) {}
1509
+ }
1510
+ return "";
1511
+ }
1512
+ var loggedTypeFailures = {};
1513
+ var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
1514
+ function setCurrentlyValidatingElement(element) {
1515
+ if (element) {
1516
+ var owner = element._owner;
1517
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
1518
+ ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
1519
+ } else ReactDebugCurrentFrame$1.setExtraStackFrame(null);
1520
+ }
1521
+ function checkPropTypes(typeSpecs, values, location, componentName, element) {
1522
+ var has = Function.call.bind(hasOwnProperty);
1523
+ for (var typeSpecName in typeSpecs) if (has(typeSpecs, typeSpecName)) {
1524
+ var error$1 = void 0;
1525
+ try {
1526
+ if (typeof typeSpecs[typeSpecName] !== "function") {
1527
+ 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`.");
1528
+ err.name = "Invariant Violation";
1529
+ throw err;
1530
+ }
1531
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
1532
+ } catch (ex) {
1533
+ error$1 = ex;
1534
+ }
1535
+ if (error$1 && !(error$1 instanceof Error)) {
1536
+ setCurrentlyValidatingElement(element);
1537
+ 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);
1538
+ setCurrentlyValidatingElement(null);
1539
+ }
1540
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
1541
+ loggedTypeFailures[error$1.message] = true;
1542
+ setCurrentlyValidatingElement(element);
1543
+ error("Failed %s type: %s", location, error$1.message);
1544
+ setCurrentlyValidatingElement(null);
1545
+ }
1546
+ }
1547
+ }
1548
+ function setCurrentlyValidatingElement$1(element) {
1549
+ if (element) {
1550
+ var owner = element._owner;
1551
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
1552
+ setExtraStackFrame(stack);
1553
+ } else setExtraStackFrame(null);
1554
+ }
1555
+ var propTypesMisspellWarningShown;
1556
+ propTypesMisspellWarningShown = false;
1557
+ function getDeclarationErrorAddendum() {
1558
+ if (ReactCurrentOwner.current) {
1559
+ var name = getComponentNameFromType(ReactCurrentOwner.current.type);
1560
+ if (name) return "\n\nCheck the render method of `" + name + "`.";
1561
+ }
1562
+ return "";
1563
+ }
1564
+ function getSourceInfoErrorAddendum(source) {
1565
+ if (source !== void 0) {
1566
+ var fileName = source.fileName.replace(/^.*[\\\/]/, "");
1567
+ var lineNumber = source.lineNumber;
1568
+ return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
1569
+ }
1570
+ return "";
1571
+ }
1572
+ function getSourceInfoErrorAddendumForProps(elementProps) {
1573
+ if (elementProps !== null && elementProps !== void 0) return getSourceInfoErrorAddendum(elementProps.__source);
1574
+ return "";
1575
+ }
1576
+ /**
1577
+ * Warn if there's no key explicitly set on dynamic arrays of children or
1578
+ * object keys are not valid. This allows us to keep track of children between
1579
+ * updates.
1580
+ */
1581
+ var ownerHasKeyUseWarning = {};
1582
+ function getCurrentComponentErrorInfo(parentType) {
1583
+ var info = getDeclarationErrorAddendum();
1584
+ if (!info) {
1585
+ var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
1586
+ if (parentName) info = "\n\nCheck the top-level render call using <" + parentName + ">.";
1587
+ }
1588
+ return info;
1589
+ }
1590
+ /**
1591
+ * Warn if the element doesn't have an explicit key assigned to it.
1592
+ * This element is in an array. The array could grow and shrink or be
1593
+ * reordered. All children that haven't already been validated are required to
1594
+ * have a "key" property assigned to it. Error statuses are cached so a warning
1595
+ * will only be shown once.
1596
+ *
1597
+ * @internal
1598
+ * @param {ReactElement} element Element that requires a key.
1599
+ * @param {*} parentType element's parent's type.
1600
+ */
1601
+ function validateExplicitKey(element, parentType) {
1602
+ if (!element._store || element._store.validated || element.key != null) return;
1603
+ element._store.validated = true;
1604
+ var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1605
+ if (ownerHasKeyUseWarning[currentComponentErrorInfo]) return;
1606
+ ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
1607
+ var childOwner = "";
1608
+ if (element && element._owner && element._owner !== ReactCurrentOwner.current) childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
1609
+ setCurrentlyValidatingElement$1(element);
1610
+ 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);
1611
+ setCurrentlyValidatingElement$1(null);
1612
+ }
1613
+ /**
1614
+ * Ensure that every element either is passed in a static location, in an
1615
+ * array with an explicit keys property defined, or in an object literal
1616
+ * with valid key property.
1617
+ *
1618
+ * @internal
1619
+ * @param {ReactNode} node Statically passed child of any type.
1620
+ * @param {*} parentType node's parent's type.
1621
+ */
1622
+ function validateChildKeys(node, parentType) {
1623
+ if (typeof node !== "object") return;
1624
+ if (isArray(node)) for (var i = 0; i < node.length; i++) {
1625
+ var child = node[i];
1626
+ if (isValidElement(child)) validateExplicitKey(child, parentType);
1627
+ }
1628
+ else if (isValidElement(node)) {
1629
+ if (node._store) node._store.validated = true;
1630
+ } else if (node) {
1631
+ var iteratorFn = getIteratorFn(node);
1632
+ if (typeof iteratorFn === "function") {
1633
+ if (iteratorFn !== node.entries) {
1634
+ var iterator = iteratorFn.call(node);
1635
+ var step;
1636
+ while (!(step = iterator.next()).done) if (isValidElement(step.value)) validateExplicitKey(step.value, parentType);
1637
+ }
1638
+ }
1639
+ }
1640
+ }
1641
+ /**
1642
+ * Given an element, validate that its props follow the propTypes definition,
1643
+ * provided by the type.
1644
+ *
1645
+ * @param {ReactElement} element
1646
+ */
1647
+ function validatePropTypes(element) {
1648
+ var type = element.type;
1649
+ if (type === null || type === void 0 || typeof type === "string") return;
1650
+ var propTypes;
1651
+ if (typeof type === "function") propTypes = type.propTypes;
1652
+ else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_MEMO_TYPE)) propTypes = type.propTypes;
1653
+ else return;
1654
+ if (propTypes) {
1655
+ var name = getComponentNameFromType(type);
1656
+ checkPropTypes(propTypes, element.props, "prop", name, element);
1657
+ } else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
1658
+ propTypesMisspellWarningShown = true;
1659
+ var _name = getComponentNameFromType(type);
1660
+ error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
1661
+ }
1662
+ if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
1663
+ }
1664
+ /**
1665
+ * Given a fragment, validate that it can only be provided with fragment props
1666
+ * @param {ReactElement} fragment
1667
+ */
1668
+ function validateFragmentProps(fragment) {
1669
+ var keys = Object.keys(fragment.props);
1670
+ for (var i = 0; i < keys.length; i++) {
1671
+ var key = keys[i];
1672
+ if (key !== "children" && key !== "key") {
1673
+ setCurrentlyValidatingElement$1(fragment);
1674
+ error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
1675
+ setCurrentlyValidatingElement$1(null);
1676
+ break;
1677
+ }
1678
+ }
1679
+ if (fragment.ref !== null) {
1680
+ setCurrentlyValidatingElement$1(fragment);
1681
+ error("Invalid attribute `ref` supplied to `React.Fragment`.");
1682
+ setCurrentlyValidatingElement$1(null);
1683
+ }
1684
+ }
1685
+ function createElementWithValidation(type, props, children) {
1686
+ var validType = isValidElementType(type);
1687
+ if (!validType) {
1688
+ var info = "";
1689
+ if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) 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.";
1690
+ var sourceInfo = getSourceInfoErrorAddendumForProps(props);
1691
+ if (sourceInfo) info += sourceInfo;
1692
+ else info += getDeclarationErrorAddendum();
1693
+ var typeString;
1694
+ if (type === null) typeString = "null";
1695
+ else if (isArray(type)) typeString = "array";
1696
+ else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
1697
+ typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
1698
+ info = " Did you accidentally export a JSX literal instead of a component?";
1699
+ } else typeString = typeof type;
1700
+ error("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
1701
+ }
1702
+ var element = createElement.apply(this, arguments);
1703
+ if (element == null) return element;
1704
+ if (validType) for (var i = 2; i < arguments.length; i++) validateChildKeys(arguments[i], type);
1705
+ if (type === REACT_FRAGMENT_TYPE) validateFragmentProps(element);
1706
+ else validatePropTypes(element);
1707
+ return element;
1708
+ }
1709
+ var didWarnAboutDeprecatedCreateFactory = false;
1710
+ function createFactoryWithValidation(type) {
1711
+ var validatedFactory = createElementWithValidation.bind(null, type);
1712
+ validatedFactory.type = type;
1713
+ if (!didWarnAboutDeprecatedCreateFactory) {
1714
+ didWarnAboutDeprecatedCreateFactory = true;
1715
+ warn("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.");
1716
+ }
1717
+ Object.defineProperty(validatedFactory, "type", {
1718
+ enumerable: false,
1719
+ get: function() {
1720
+ warn("Factory.type is deprecated. Access the class directly before passing it to createFactory.");
1721
+ Object.defineProperty(this, "type", { value: type });
1722
+ return type;
1723
+ }
1724
+ });
1725
+ return validatedFactory;
1726
+ }
1727
+ function cloneElementWithValidation(element, props, children) {
1728
+ var newElement = cloneElement.apply(this, arguments);
1729
+ for (var i = 2; i < arguments.length; i++) validateChildKeys(arguments[i], newElement.type);
1730
+ validatePropTypes(newElement);
1731
+ return newElement;
1732
+ }
1733
+ function startTransition(scope, options) {
1734
+ var prevTransition = ReactCurrentBatchConfig.transition;
1735
+ ReactCurrentBatchConfig.transition = {};
1736
+ var currentTransition = ReactCurrentBatchConfig.transition;
1737
+ ReactCurrentBatchConfig.transition._updatedFibers = /* @__PURE__ */ new Set();
1738
+ try {
1739
+ scope();
1740
+ } finally {
1741
+ ReactCurrentBatchConfig.transition = prevTransition;
1742
+ if (prevTransition === null && currentTransition._updatedFibers) {
1743
+ var updatedFibersCount = currentTransition._updatedFibers.size;
1744
+ if (updatedFibersCount > 10) warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.");
1745
+ currentTransition._updatedFibers.clear();
1746
+ }
1747
+ }
1748
+ }
1749
+ var didWarnAboutMessageChannel = false;
1750
+ var enqueueTaskImpl = null;
1751
+ function enqueueTask(task) {
1752
+ if (enqueueTaskImpl === null) try {
1753
+ var requireString = ("require" + Math.random()).slice(0, 7);
1754
+ var nodeRequire = module && module[requireString];
1755
+ enqueueTaskImpl = nodeRequire.call(module, "timers").setImmediate;
1756
+ } catch (_err) {
1757
+ enqueueTaskImpl = function(callback) {
1758
+ if (didWarnAboutMessageChannel === false) {
1759
+ didWarnAboutMessageChannel = true;
1760
+ if (typeof MessageChannel === "undefined") error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning.");
1761
+ }
1762
+ var channel = new MessageChannel();
1763
+ channel.port1.onmessage = callback;
1764
+ channel.port2.postMessage(void 0);
1765
+ };
1766
+ }
1767
+ return enqueueTaskImpl(task);
1768
+ }
1769
+ var actScopeDepth = 0;
1770
+ var didWarnNoAwaitAct = false;
1771
+ function act(callback) {
1772
+ var prevActScopeDepth = actScopeDepth;
1773
+ actScopeDepth++;
1774
+ if (ReactCurrentActQueue.current === null) ReactCurrentActQueue.current = [];
1775
+ var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;
1776
+ var result;
1777
+ try {
1778
+ ReactCurrentActQueue.isBatchingLegacy = true;
1779
+ result = callback();
1780
+ if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
1781
+ var queue = ReactCurrentActQueue.current;
1782
+ if (queue !== null) {
1783
+ ReactCurrentActQueue.didScheduleLegacyUpdate = false;
1784
+ flushActQueue(queue);
1785
+ }
1786
+ }
1787
+ } catch (error$1) {
1788
+ popActScope(prevActScopeDepth);
1789
+ throw error$1;
1790
+ } finally {
1791
+ ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
1792
+ }
1793
+ if (result !== null && typeof result === "object" && typeof result.then === "function") {
1794
+ var thenableResult = result;
1795
+ var wasAwaited = false;
1796
+ var thenable = { then: function(resolve, reject) {
1797
+ wasAwaited = true;
1798
+ thenableResult.then(function(returnValue$1) {
1799
+ popActScope(prevActScopeDepth);
1800
+ if (actScopeDepth === 0) recursivelyFlushAsyncActWork(returnValue$1, resolve, reject);
1801
+ else resolve(returnValue$1);
1802
+ }, function(error$1) {
1803
+ popActScope(prevActScopeDepth);
1804
+ reject(error$1);
1805
+ });
1806
+ } };
1807
+ if (!didWarnNoAwaitAct && typeof Promise !== "undefined") Promise.resolve().then(function() {}).then(function() {
1808
+ if (!wasAwaited) {
1809
+ didWarnNoAwaitAct = true;
1810
+ error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);");
1811
+ }
1812
+ });
1813
+ return thenable;
1814
+ } else {
1815
+ var returnValue = result;
1816
+ popActScope(prevActScopeDepth);
1817
+ if (actScopeDepth === 0) {
1818
+ var _queue = ReactCurrentActQueue.current;
1819
+ if (_queue !== null) {
1820
+ flushActQueue(_queue);
1821
+ ReactCurrentActQueue.current = null;
1822
+ }
1823
+ var _thenable = { then: function(resolve, reject) {
1824
+ if (ReactCurrentActQueue.current === null) {
1825
+ ReactCurrentActQueue.current = [];
1826
+ recursivelyFlushAsyncActWork(returnValue, resolve, reject);
1827
+ } else resolve(returnValue);
1828
+ } };
1829
+ return _thenable;
1830
+ } else {
1831
+ var _thenable2 = { then: function(resolve, reject) {
1832
+ resolve(returnValue);
1833
+ } };
1834
+ return _thenable2;
1835
+ }
1836
+ }
1837
+ }
1838
+ function popActScope(prevActScopeDepth) {
1839
+ if (prevActScopeDepth !== actScopeDepth - 1) error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
1840
+ actScopeDepth = prevActScopeDepth;
1841
+ }
1842
+ function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
1843
+ var queue = ReactCurrentActQueue.current;
1844
+ if (queue !== null) try {
1845
+ flushActQueue(queue);
1846
+ enqueueTask(function() {
1847
+ if (queue.length === 0) {
1848
+ ReactCurrentActQueue.current = null;
1849
+ resolve(returnValue);
1850
+ } else recursivelyFlushAsyncActWork(returnValue, resolve, reject);
1851
+ });
1852
+ } catch (error$1) {
1853
+ reject(error$1);
1854
+ }
1855
+ else resolve(returnValue);
1856
+ }
1857
+ var isFlushing = false;
1858
+ function flushActQueue(queue) {
1859
+ if (!isFlushing) {
1860
+ isFlushing = true;
1861
+ var i = 0;
1862
+ try {
1863
+ for (; i < queue.length; i++) {
1864
+ var callback = queue[i];
1865
+ do
1866
+ callback = callback(true);
1867
+ while (callback !== null);
1868
+ }
1869
+ queue.length = 0;
1870
+ } catch (error$1) {
1871
+ queue = queue.slice(i + 1);
1872
+ throw error$1;
1873
+ } finally {
1874
+ isFlushing = false;
1875
+ }
1876
+ }
1877
+ }
1878
+ var createElement$1 = createElementWithValidation;
1879
+ var cloneElement$1 = cloneElementWithValidation;
1880
+ var createFactory = createFactoryWithValidation;
1881
+ var Children = {
1882
+ map: mapChildren,
1883
+ forEach: forEachChildren,
1884
+ count: countChildren,
1885
+ toArray,
1886
+ only: onlyChild
1887
+ };
1888
+ exports.Children = Children;
1889
+ exports.Component = Component;
1890
+ exports.Fragment = REACT_FRAGMENT_TYPE;
1891
+ exports.Profiler = REACT_PROFILER_TYPE;
1892
+ exports.PureComponent = PureComponent;
1893
+ exports.StrictMode = REACT_STRICT_MODE_TYPE;
1894
+ exports.Suspense = REACT_SUSPENSE_TYPE;
1895
+ exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
1896
+ exports.act = act;
1897
+ exports.cloneElement = cloneElement$1;
1898
+ exports.createContext = createContext;
1899
+ exports.createElement = createElement$1;
1900
+ exports.createFactory = createFactory;
1901
+ exports.createRef = createRef;
1902
+ exports.forwardRef = forwardRef;
1903
+ exports.isValidElement = isValidElement;
1904
+ exports.lazy = lazy;
1905
+ exports.memo = memo;
1906
+ exports.startTransition = startTransition;
1907
+ exports.unstable_act = act;
1908
+ exports.useCallback = useCallback;
1909
+ exports.useContext = useContext;
1910
+ exports.useDebugValue = useDebugValue;
1911
+ exports.useDeferredValue = useDeferredValue;
1912
+ exports.useEffect = useEffect;
1913
+ exports.useId = useId;
1914
+ exports.useImperativeHandle = useImperativeHandle;
1915
+ exports.useInsertionEffect = useInsertionEffect;
1916
+ exports.useLayoutEffect = useLayoutEffect;
1917
+ exports.useMemo = useMemo;
1918
+ exports.useReducer = useReducer;
1919
+ exports.useRef = useRef;
1920
+ exports.useState = useState;
1921
+ exports.useSyncExternalStore = useSyncExternalStore;
1922
+ exports.useTransition = useTransition;
1923
+ exports.version = ReactVersion;
1924
+ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(/* @__PURE__ */ new Error());
1925
+ })();
1926
+ }) });
1927
+
1928
+ //#endregion
1929
+ //#region ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
1930
+ var require_react = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js": ((exports, module) => {
1931
+ if (process.env.NODE_ENV === "production") module.exports = require_react_production_min();
1932
+ else module.exports = require_react_development();
1933
+ }) });
1934
+
1935
+ //#endregion
1936
+ //#region src/parser.ts
1937
+ const typeKeywordMapper = {
1938
+ any: () => __kubb_parser_ts_factory.keywordTypeNodes.any,
1939
+ unknown: () => __kubb_parser_ts_factory.keywordTypeNodes.unknown,
1940
+ void: () => __kubb_parser_ts_factory.keywordTypeNodes.void,
1941
+ number: () => __kubb_parser_ts_factory.keywordTypeNodes.number,
1942
+ integer: () => __kubb_parser_ts_factory.keywordTypeNodes.number,
1943
+ object: (nodes) => {
1944
+ if (!nodes || !nodes.length) return __kubb_parser_ts_factory.keywordTypeNodes.object;
1945
+ return __kubb_parser_ts_factory.createTypeLiteralNode(nodes);
1946
+ },
1947
+ string: () => __kubb_parser_ts_factory.keywordTypeNodes.string,
1948
+ boolean: () => __kubb_parser_ts_factory.keywordTypeNodes.boolean,
1949
+ undefined: () => __kubb_parser_ts_factory.keywordTypeNodes.undefined,
1950
+ nullable: void 0,
1951
+ null: () => __kubb_parser_ts_factory.keywordTypeNodes.null,
1952
+ nullish: void 0,
1953
+ array: (nodes) => {
1954
+ if (!nodes) return void 0;
1955
+ return __kubb_parser_ts_factory.createArrayDeclaration({ nodes });
1956
+ },
1957
+ tuple: (nodes, rest, min, max) => {
1958
+ if (!nodes) return void 0;
1959
+ if (max) {
1960
+ nodes = nodes.slice(0, max);
1961
+ if (nodes.length < max && rest) nodes = [...nodes, ...Array(max - nodes.length).fill(rest)];
1962
+ }
1963
+ if (min) nodes = nodes.map((node, index) => index >= min ? __kubb_parser_ts_factory.createOptionalTypeNode(node) : node);
1964
+ if (typeof max === "undefined" && rest) nodes.push(__kubb_parser_ts_factory.createRestTypeNode(__kubb_parser_ts_factory.createArrayTypeNode(rest)));
1965
+ return __kubb_parser_ts_factory.createTupleTypeNode(nodes);
1966
+ },
1967
+ enum: (name) => {
1968
+ if (!name) return void 0;
1969
+ return __kubb_parser_ts_factory.createTypeReferenceNode(name, void 0);
1970
+ },
1971
+ union: (nodes) => {
1972
+ if (!nodes) return void 0;
1973
+ return __kubb_parser_ts_factory.createUnionDeclaration({
1974
+ withParentheses: true,
1975
+ nodes
1976
+ });
1977
+ },
1978
+ const: (name, format) => {
1979
+ if (name === null || name === void 0 || name === "") return void 0;
1980
+ if (format === "boolean") {
1981
+ if (name === true) return __kubb_parser_ts_factory.createLiteralTypeNode(__kubb_parser_ts_factory.createTrue());
1982
+ return __kubb_parser_ts_factory.createLiteralTypeNode(__kubb_parser_ts_factory.createFalse());
1983
+ }
1984
+ if (format === "number" && typeof name === "number") return __kubb_parser_ts_factory.createLiteralTypeNode(__kubb_parser_ts_factory.createNumericLiteral(name));
1985
+ return __kubb_parser_ts_factory.createLiteralTypeNode(__kubb_parser_ts_factory.createStringLiteral(name.toString()));
1986
+ },
1987
+ datetime: () => __kubb_parser_ts_factory.keywordTypeNodes.string,
1988
+ date: (type = "string") => type === "string" ? __kubb_parser_ts_factory.keywordTypeNodes.string : __kubb_parser_ts_factory.createTypeReferenceNode(__kubb_parser_ts_factory.createIdentifier("Date")),
1989
+ time: (type = "string") => type === "string" ? __kubb_parser_ts_factory.keywordTypeNodes.string : __kubb_parser_ts_factory.createTypeReferenceNode(__kubb_parser_ts_factory.createIdentifier("Date")),
1990
+ uuid: () => __kubb_parser_ts_factory.keywordTypeNodes.string,
1991
+ url: () => __kubb_parser_ts_factory.keywordTypeNodes.string,
1992
+ default: void 0,
1993
+ and: (nodes) => {
1994
+ if (!nodes) return void 0;
1995
+ return __kubb_parser_ts_factory.createIntersectionDeclaration({
1996
+ withParentheses: true,
1997
+ nodes
1998
+ });
1999
+ },
2000
+ describe: void 0,
2001
+ min: void 0,
2002
+ max: void 0,
2003
+ optional: void 0,
2004
+ matches: () => __kubb_parser_ts_factory.keywordTypeNodes.string,
2005
+ email: () => __kubb_parser_ts_factory.keywordTypeNodes.string,
2006
+ firstName: void 0,
2007
+ lastName: void 0,
2008
+ password: void 0,
2009
+ phone: void 0,
2010
+ readOnly: void 0,
2011
+ writeOnly: void 0,
2012
+ ref: (propertyName) => {
2013
+ if (!propertyName) return void 0;
2014
+ return __kubb_parser_ts_factory.createTypeReferenceNode(propertyName, void 0);
2015
+ },
2016
+ blob: () => __kubb_parser_ts_factory.createTypeReferenceNode("Blob", []),
2017
+ deprecated: void 0,
2018
+ example: void 0,
2019
+ schema: void 0,
2020
+ catchall: void 0,
2021
+ name: void 0,
2022
+ interface: void 0
2023
+ };
2024
+ /**
2025
+ * Recursively parses a schema tree node into a corresponding TypeScript AST node.
2026
+ *
2027
+ * Maps OpenAPI schema keywords to TypeScript AST nodes using the `typeKeywordMapper`, handling complex types such as unions, intersections, arrays, tuples (with optional/rest elements and length constraints), enums, constants, references, and objects with property modifiers and documentation annotations.
2028
+ *
2029
+ * @param current - The schema node to parse.
2030
+ * @param siblings - Sibling schema nodes, used for context in certain mappings.
2031
+ * @param name - The name of the schema or property being parsed.
2032
+ * @param options - Parsing options controlling output style, property handling, and custom mappers.
2033
+ * @returns The generated TypeScript AST node, or `undefined` if the schema keyword is not mapped.
2034
+ */
2035
+ function parse({ current, siblings, name }, options) {
2036
+ const value = typeKeywordMapper[current.keyword];
2037
+ if (!value) return void 0;
2038
+ if ((0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.union)) return typeKeywordMapper.union(current.args.map((schema) => parse({
2039
+ parent: current,
2040
+ name,
2041
+ current: schema,
2042
+ siblings
2043
+ }, options)).filter(Boolean));
2044
+ if ((0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.and)) return typeKeywordMapper.and(current.args.map((schema) => parse({
2045
+ parent: current,
2046
+ name,
2047
+ current: schema,
2048
+ siblings
2049
+ }, options)).filter(Boolean));
2050
+ if ((0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.array)) return typeKeywordMapper.array(current.args.items.map((schema) => parse({
2051
+ parent: current,
2052
+ name,
2053
+ current: schema,
2054
+ siblings
2055
+ }, options)).filter(Boolean));
2056
+ if ((0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.enum)) return typeKeywordMapper.enum(current.args.typeName);
2057
+ if ((0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.ref)) return typeKeywordMapper.ref(current.args.name);
2058
+ if ((0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.blob)) return value();
2059
+ if ((0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.tuple)) return typeKeywordMapper.tuple(current.args.items.map((schema) => parse({
2060
+ parent: current,
2061
+ name,
2062
+ current: schema,
2063
+ siblings
2064
+ }, options)).filter(Boolean), current.args.rest && (parse({
2065
+ parent: current,
2066
+ name,
2067
+ current: current.args.rest,
2068
+ siblings
2069
+ }, options) ?? void 0), current.args.min, current.args.max);
2070
+ if ((0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.const)) return typeKeywordMapper.const(current.args.name, current.args.format);
2071
+ if ((0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.object)) {
2072
+ const properties = Object.entries(current.args?.properties || {}).filter((item) => {
2073
+ const schemas = item[1];
2074
+ return schemas && typeof schemas.map === "function";
2075
+ }).map(([name$1, schemas]) => {
2076
+ const nameSchema = schemas.find((schema) => schema.keyword === __kubb_plugin_oas.schemaKeywords.name);
2077
+ const mappedName = nameSchema?.args || name$1;
2078
+ if (options.mapper?.[mappedName]) return options.mapper?.[mappedName];
2079
+ const isNullish = schemas.some((schema) => schema.keyword === __kubb_plugin_oas.schemaKeywords.nullish);
2080
+ const isNullable = schemas.some((schema) => schema.keyword === __kubb_plugin_oas.schemaKeywords.nullable);
2081
+ const isOptional = schemas.some((schema) => schema.keyword === __kubb_plugin_oas.schemaKeywords.optional);
2082
+ const isReadonly = schemas.some((schema) => schema.keyword === __kubb_plugin_oas.schemaKeywords.readOnly);
2083
+ const describeSchema = schemas.find((schema) => schema.keyword === __kubb_plugin_oas.schemaKeywords.describe);
2084
+ const deprecatedSchema = schemas.find((schema) => schema.keyword === __kubb_plugin_oas.schemaKeywords.deprecated);
2085
+ const defaultSchema = schemas.find((schema) => schema.keyword === __kubb_plugin_oas.schemaKeywords.default);
2086
+ const exampleSchema = schemas.find((schema) => schema.keyword === __kubb_plugin_oas.schemaKeywords.example);
2087
+ const schemaSchema = schemas.find((schema) => schema.keyword === __kubb_plugin_oas.schemaKeywords.schema);
2088
+ const minSchema = schemas.find((schema) => schema.keyword === __kubb_plugin_oas.schemaKeywords.min);
2089
+ const maxSchema = schemas.find((schema) => schema.keyword === __kubb_plugin_oas.schemaKeywords.max);
2090
+ const matchesSchema = schemas.find((schema) => schema.keyword === __kubb_plugin_oas.schemaKeywords.matches);
2091
+ let type = schemas.map((schema) => parse({
2092
+ parent: current,
2093
+ name: name$1,
2094
+ current: schema,
2095
+ siblings: schemas
2096
+ }, options)).filter(Boolean)[0];
2097
+ if (isNullable) type = __kubb_parser_ts_factory.createUnionDeclaration({ nodes: [type, __kubb_parser_ts_factory.keywordTypeNodes.null] });
2098
+ if (isNullish && ["undefined", "questionTokenAndUndefined"].includes(options.optionalType)) type = __kubb_parser_ts_factory.createUnionDeclaration({ nodes: [type, __kubb_parser_ts_factory.keywordTypeNodes.undefined] });
2099
+ if (isOptional && ["undefined", "questionTokenAndUndefined"].includes(options.optionalType)) type = __kubb_parser_ts_factory.createUnionDeclaration({ nodes: [type, __kubb_parser_ts_factory.keywordTypeNodes.undefined] });
2100
+ const propertySignature = __kubb_parser_ts_factory.createPropertySignature({
2101
+ questionToken: isOptional || isNullish ? ["questionToken", "questionTokenAndUndefined"].includes(options.optionalType) : false,
2102
+ name: mappedName,
2103
+ type,
2104
+ readOnly: isReadonly
2105
+ });
2106
+ return __kubb_parser_ts_factory.appendJSDocToNode({
2107
+ node: propertySignature,
2108
+ comments: [
2109
+ describeSchema ? `@description ${__kubb_core_transformers.default.jsStringEscape(describeSchema.args)}` : void 0,
2110
+ deprecatedSchema ? "@deprecated" : void 0,
2111
+ minSchema ? `@minLength ${minSchema.args}` : void 0,
2112
+ maxSchema ? `@maxLength ${maxSchema.args}` : void 0,
2113
+ matchesSchema ? `@pattern ${matchesSchema.args}` : void 0,
2114
+ defaultSchema ? `@default ${defaultSchema.args}` : void 0,
2115
+ exampleSchema ? `@example ${exampleSchema.args}` : void 0,
2116
+ schemaSchema?.args?.type || schemaSchema?.args?.format ? [`@type ${schemaSchema?.args?.type || "unknown"}${!isOptional ? "" : " | undefined"}`, schemaSchema?.args?.format].filter(Boolean).join(", ") : void 0
2117
+ ].filter(Boolean)
2118
+ });
2119
+ });
2120
+ let additionalProperties;
2121
+ if (current.args?.additionalProperties?.length) {
2122
+ additionalProperties = current.args.additionalProperties.map((schema) => parse({
2123
+ parent: current,
2124
+ name,
2125
+ current: schema,
2126
+ siblings
2127
+ }, options)).filter(Boolean).at(0);
2128
+ const isNullable = current.args?.additionalProperties.some((schema) => (0, __kubb_plugin_oas.isKeyword)(schema, __kubb_plugin_oas.schemaKeywords.nullable));
2129
+ if (isNullable) additionalProperties = __kubb_parser_ts_factory.createUnionDeclaration({ nodes: [additionalProperties, __kubb_parser_ts_factory.keywordTypeNodes.null] });
2130
+ additionalProperties = __kubb_parser_ts_factory.createIndexSignature(additionalProperties);
2131
+ }
2132
+ return typeKeywordMapper.object([...properties, additionalProperties].filter(Boolean));
2133
+ }
2134
+ if ((0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.datetime)) return typeKeywordMapper.datetime();
2135
+ if ((0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.date)) return typeKeywordMapper.date(current.args.type);
2136
+ if ((0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.time)) return typeKeywordMapper.time(current.args.type);
2137
+ if (current.keyword in typeKeywordMapper) return value();
2138
+ return void 0;
2139
+ }
2140
+
2141
+ //#endregion
2142
+ //#region src/components/Type.tsx
2143
+ var import_react = /* @__PURE__ */ __toESM(require_react());
2144
+ function Type({ name, typedName, tree, keysToOmit, schema, optionalType, syntaxType, enumType, mapper, description }) {
2145
+ const typeNodes = [];
2146
+ if (!tree.length) return "";
2147
+ const schemaFromTree = tree.find((item) => item.keyword === __kubb_plugin_oas.schemaKeywords.schema);
2148
+ let type = tree.map((current, _index, siblings) => parse({
2149
+ parent: void 0,
2150
+ current,
2151
+ siblings
2152
+ }, {
2153
+ name,
2154
+ typedName,
2155
+ description,
2156
+ keysToOmit,
2157
+ optionalType,
2158
+ enumType,
2159
+ mapper,
2160
+ syntaxType
2161
+ })).filter(Boolean).at(0) || typeKeywordMapper.undefined();
2162
+ if (schemaFromTree && (0, __kubb_plugin_oas.isKeyword)(schemaFromTree, __kubb_plugin_oas.schemaKeywords.schema)) {
2163
+ const isNullish = tree.some((item) => item.keyword === __kubb_plugin_oas.schemaKeywords.nullish);
2164
+ const isNullable = tree.some((item) => item.keyword === __kubb_plugin_oas.schemaKeywords.nullable);
2165
+ const isOptional = tree.some((item) => item.keyword === __kubb_plugin_oas.schemaKeywords.optional);
2166
+ if (isNullable) type = __kubb_parser_ts_factory.createUnionDeclaration({ nodes: [type, __kubb_parser_ts_factory.keywordTypeNodes.null] });
2167
+ if (isNullish && ["undefined", "questionTokenAndUndefined"].includes(optionalType)) type = __kubb_parser_ts_factory.createUnionDeclaration({ nodes: [type, __kubb_parser_ts_factory.keywordTypeNodes.undefined] });
2168
+ if (isOptional && ["undefined", "questionTokenAndUndefined"].includes(optionalType)) type = __kubb_parser_ts_factory.createUnionDeclaration({ nodes: [type, __kubb_parser_ts_factory.keywordTypeNodes.undefined] });
2169
+ }
2170
+ const useTypeGeneration = syntaxType === "type" || [__kubb_parser_ts_factory.syntaxKind.union].includes(type.kind) || !!keysToOmit?.length;
2171
+ typeNodes.push((0, __kubb_parser_ts_factory.createTypeDeclaration)({
2172
+ name,
2173
+ isExportable: true,
2174
+ type: keysToOmit?.length ? __kubb_parser_ts_factory.createOmitDeclaration({
2175
+ keys: keysToOmit,
2176
+ type,
2177
+ nonNullable: true
2178
+ }) : type,
2179
+ syntax: useTypeGeneration ? "type" : "interface",
2180
+ comments: [
2181
+ description ? `@description ${__kubb_core_transformers.default.jsStringEscape(description)}` : void 0,
2182
+ schema.deprecated ? "@deprecated" : void 0,
2183
+ schema.minLength ? `@minLength ${schema.minLength}` : void 0,
2184
+ schema.maxLength ? `@maxLength ${schema.maxLength}` : void 0,
2185
+ schema.pattern ? `@pattern ${schema.pattern}` : void 0,
2186
+ schema.default ? `@default ${schema.default}` : void 0,
2187
+ schema.example ? `@example ${schema.example}` : void 0
2188
+ ]
2189
+ }));
2190
+ const enumSchemas = __kubb_plugin_oas.SchemaGenerator.deepSearch(tree, __kubb_plugin_oas.schemaKeywords.enum);
2191
+ const enums = [...new Set(enumSchemas)].map((enumSchema) => {
2192
+ const name$1 = enumType === "asPascalConst" ? __kubb_core_transformers.default.pascalCase(enumSchema.args.name) : __kubb_core_transformers.default.camelCase(enumSchema.args.name);
2193
+ const typeName = enumSchema.args.typeName;
2194
+ const [nameNode, typeNode] = __kubb_parser_ts_factory.createEnumDeclaration({
2195
+ name: name$1,
2196
+ typeName,
2197
+ enums: enumSchema.args.items.map((item) => item.value === void 0 ? void 0 : [__kubb_core_transformers.default.trimQuotes(item.name?.toString()), item.value]).filter(Boolean),
2198
+ type: enumType
2199
+ });
2200
+ return {
2201
+ nameNode,
2202
+ typeNode,
2203
+ name: name$1,
2204
+ typeName
2205
+ };
2206
+ });
2207
+ return /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsxs)(import_react.Fragment, { children: [enums.map(({ name: name$1, nameNode, typeName, typeNode }) => /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsxs)(import_react.Fragment, { children: [nameNode && /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.File.Source, {
2208
+ name: name$1,
2209
+ isExportable: true,
2210
+ isIndexable: true,
2211
+ children: (0, __kubb_parser_ts.print)([nameNode])
2212
+ }), /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.File.Source, {
2213
+ name: typeName,
2214
+ isIndexable: true,
2215
+ isExportable: [
2216
+ "enum",
2217
+ "asConst",
2218
+ "constEnum",
2219
+ "literal",
2220
+ void 0
2221
+ ].includes(enumType),
2222
+ isTypeOnly: [
2223
+ "asConst",
2224
+ "literal",
2225
+ void 0
2226
+ ].includes(enumType),
2227
+ children: (0, __kubb_parser_ts.print)([typeNode])
2228
+ })] })), enums.every((item) => item.typeName !== name) && /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.File.Source, {
2229
+ name: typedName,
2230
+ isTypeOnly: true,
2231
+ isExportable: true,
2232
+ isIndexable: true,
2233
+ children: (0, __kubb_parser_ts.print)(typeNodes)
2234
+ })] });
2235
+ }
2236
+
2237
+ //#endregion
2238
+ Object.defineProperty(exports, 'OasType', {
2239
+ enumerable: true,
2240
+ get: function () {
2241
+ return OasType;
2242
+ }
2243
+ });
2244
+ Object.defineProperty(exports, 'Type', {
2245
+ enumerable: true,
2246
+ get: function () {
2247
+ return Type;
2248
+ }
2249
+ });
2250
+ Object.defineProperty(exports, '__toESM', {
2251
+ enumerable: true,
2252
+ get: function () {
2253
+ return __toESM;
2254
+ }
2255
+ });
2256
+ //# sourceMappingURL=components-B-Jx1kI5.cjs.map