@kubb/swagger-ts 2.0.0-beta.3 → 2.0.0-beta.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.
- package/dist/components.cjs +3945 -0
- package/dist/components.cjs.map +1 -0
- package/dist/components.d.cts +111 -0
- package/dist/components.d.ts +111 -0
- package/dist/components.js +3918 -0
- package/dist/components.js.map +1 -0
- package/dist/index.cjs +3470 -248
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +3471 -250
- package/dist/index.js.map +1 -1
- package/package.json +14 -6
- package/src/OperationGenerator.tsx +50 -0
- package/src/TypeBuilder.ts +58 -0
- package/src/{generators/TypeGenerator.ts → TypeGenerator.ts} +53 -63
- package/src/components/Mutation.tsx +137 -0
- package/src/components/Query.tsx +137 -0
- package/src/components/index.ts +2 -0
- package/src/plugin.ts +31 -68
- package/src/types.ts +12 -2
- package/src/builders/TypeBuilder.ts +0 -94
- package/src/builders/index.ts +0 -1
- package/src/generators/OperationGenerator.ts +0 -213
- package/src/generators/index.ts +0 -2
package/dist/index.js
CHANGED
@@ -1,15 +1,45 @@
|
|
1
1
|
import { createRequire } from 'module';
|
2
2
|
import path from 'path';
|
3
|
-
import { createPlugin, FileManager, PluginManager,
|
4
|
-
import
|
5
|
-
import {
|
6
|
-
import {
|
3
|
+
import { createPlugin, FileManager, PluginManager, Generator } from '@kubb/core';
|
4
|
+
import transformers, { camelCase, pascalCase } from '@kubb/core/transformers';
|
5
|
+
import { renderTemplate, getUniqueName } from '@kubb/core/utils';
|
6
|
+
import { pluginName as pluginName$1, OasBuilder, OperationGenerator as OperationGenerator$1 } from '@kubb/swagger';
|
7
|
+
import { createRoot, usePlugin, usePluginManager, File } from '@kubb/react';
|
7
8
|
import { print } from '@kubb/parser';
|
8
9
|
import * as factory from '@kubb/parser/factory';
|
10
|
+
import { useSchemas, useOas, useOperationFile, useOperationName, useOperation } from '@kubb/swagger/hooks';
|
9
11
|
import { refsSorter, isReference, getSchemaFactory } from '@kubb/swagger/utils';
|
10
12
|
|
11
13
|
createRequire(import.meta.url);
|
12
14
|
|
15
|
+
var __create = Object.create;
|
16
|
+
var __defProp = Object.defineProperty;
|
17
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
18
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
19
|
+
var __getProtoOf = Object.getPrototypeOf;
|
20
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
21
|
+
var __esm = (fn, res) => function __init() {
|
22
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
23
|
+
};
|
24
|
+
var __commonJS = (cb, mod) => function __require() {
|
25
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
26
|
+
};
|
27
|
+
var __copyProps = (to, from, except, desc) => {
|
28
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
29
|
+
for (let key of __getOwnPropNames(from))
|
30
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
31
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
32
|
+
}
|
33
|
+
return to;
|
34
|
+
};
|
35
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
36
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
37
|
+
// file that has been converted to a CommonJS file using a Babel-
|
38
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
39
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
40
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
41
|
+
mod
|
42
|
+
));
|
13
43
|
var __accessCheck = (obj, member, msg) => {
|
14
44
|
if (!member.has(obj))
|
15
45
|
throw TypeError("Cannot " + msg);
|
@@ -27,16 +57,3132 @@ var __privateMethod = (obj, member, method) => {
|
|
27
57
|
__accessCheck(obj, member, "access private method");
|
28
58
|
return method;
|
29
59
|
};
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
60
|
+
|
61
|
+
// ../../node_modules/.pnpm/tsup@8.0.1_ts-node@10.9.1_typescript@5.3.2/node_modules/tsup/assets/esm_shims.js
|
62
|
+
var init_esm_shims = __esm({
|
63
|
+
"../../node_modules/.pnpm/tsup@8.0.1_ts-node@10.9.1_typescript@5.3.2/node_modules/tsup/assets/esm_shims.js"() {
|
64
|
+
}
|
65
|
+
});
|
66
|
+
|
67
|
+
// ../../node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react.production.min.js
|
68
|
+
var require_react_production_min = __commonJS({
|
69
|
+
"../../node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react.production.min.js"(exports) {
|
70
|
+
init_esm_shims();
|
71
|
+
var l = Symbol.for("react.element");
|
72
|
+
var n = Symbol.for("react.portal");
|
73
|
+
var p = Symbol.for("react.fragment");
|
74
|
+
var q = Symbol.for("react.strict_mode");
|
75
|
+
var r = Symbol.for("react.profiler");
|
76
|
+
var t = Symbol.for("react.provider");
|
77
|
+
var u = Symbol.for("react.context");
|
78
|
+
var v = Symbol.for("react.forward_ref");
|
79
|
+
var w = Symbol.for("react.suspense");
|
80
|
+
var x = Symbol.for("react.memo");
|
81
|
+
var y = Symbol.for("react.lazy");
|
82
|
+
var z = Symbol.iterator;
|
83
|
+
function A(a) {
|
84
|
+
if (null === a || "object" !== typeof a)
|
85
|
+
return null;
|
86
|
+
a = z && a[z] || a["@@iterator"];
|
87
|
+
return "function" === typeof a ? a : null;
|
88
|
+
}
|
89
|
+
var B = { isMounted: function() {
|
90
|
+
return false;
|
91
|
+
}, enqueueForceUpdate: function() {
|
92
|
+
}, enqueueReplaceState: function() {
|
93
|
+
}, enqueueSetState: function() {
|
94
|
+
} };
|
95
|
+
var C = Object.assign;
|
96
|
+
var D = {};
|
97
|
+
function E(a, b, e) {
|
98
|
+
this.props = a;
|
99
|
+
this.context = b;
|
100
|
+
this.refs = D;
|
101
|
+
this.updater = e || B;
|
102
|
+
}
|
103
|
+
E.prototype.isReactComponent = {};
|
104
|
+
E.prototype.setState = function(a, b) {
|
105
|
+
if ("object" !== typeof a && "function" !== typeof a && null != a)
|
106
|
+
throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
|
107
|
+
this.updater.enqueueSetState(this, a, b, "setState");
|
108
|
+
};
|
109
|
+
E.prototype.forceUpdate = function(a) {
|
110
|
+
this.updater.enqueueForceUpdate(this, a, "forceUpdate");
|
111
|
+
};
|
112
|
+
function F() {
|
113
|
+
}
|
114
|
+
F.prototype = E.prototype;
|
115
|
+
function G(a, b, e) {
|
116
|
+
this.props = a;
|
117
|
+
this.context = b;
|
118
|
+
this.refs = D;
|
119
|
+
this.updater = e || B;
|
120
|
+
}
|
121
|
+
var H = G.prototype = new F();
|
122
|
+
H.constructor = G;
|
123
|
+
C(H, E.prototype);
|
124
|
+
H.isPureReactComponent = true;
|
125
|
+
var I = Array.isArray;
|
126
|
+
var J = Object.prototype.hasOwnProperty;
|
127
|
+
var K = { current: null };
|
128
|
+
var L = { key: true, ref: true, __self: true, __source: true };
|
129
|
+
function M(a, b, e) {
|
130
|
+
var d, c = {}, k = null, h = null;
|
131
|
+
if (null != b)
|
132
|
+
for (d in void 0 !== b.ref && (h = b.ref), void 0 !== b.key && (k = "" + b.key), b)
|
133
|
+
J.call(b, d) && !L.hasOwnProperty(d) && (c[d] = b[d]);
|
134
|
+
var g = arguments.length - 2;
|
135
|
+
if (1 === g)
|
136
|
+
c.children = e;
|
137
|
+
else if (1 < g) {
|
138
|
+
for (var f = Array(g), m = 0; m < g; m++)
|
139
|
+
f[m] = arguments[m + 2];
|
140
|
+
c.children = f;
|
141
|
+
}
|
142
|
+
if (a && a.defaultProps)
|
143
|
+
for (d in g = a.defaultProps, g)
|
144
|
+
void 0 === c[d] && (c[d] = g[d]);
|
145
|
+
return { $$typeof: l, type: a, key: k, ref: h, props: c, _owner: K.current };
|
146
|
+
}
|
147
|
+
function N(a, b) {
|
148
|
+
return { $$typeof: l, type: a.type, key: b, ref: a.ref, props: a.props, _owner: a._owner };
|
149
|
+
}
|
150
|
+
function O(a) {
|
151
|
+
return "object" === typeof a && null !== a && a.$$typeof === l;
|
152
|
+
}
|
153
|
+
function escape(a) {
|
154
|
+
var b = { "=": "=0", ":": "=2" };
|
155
|
+
return "$" + a.replace(/[=:]/g, function(a2) {
|
156
|
+
return b[a2];
|
157
|
+
});
|
158
|
+
}
|
159
|
+
var P = /\/+/g;
|
160
|
+
function Q(a, b) {
|
161
|
+
return "object" === typeof a && null !== a && null != a.key ? escape("" + a.key) : b.toString(36);
|
162
|
+
}
|
163
|
+
function R(a, b, e, d, c) {
|
164
|
+
var k = typeof a;
|
165
|
+
if ("undefined" === k || "boolean" === k)
|
166
|
+
a = null;
|
167
|
+
var h = false;
|
168
|
+
if (null === a)
|
169
|
+
h = true;
|
170
|
+
else
|
171
|
+
switch (k) {
|
172
|
+
case "string":
|
173
|
+
case "number":
|
174
|
+
h = true;
|
175
|
+
break;
|
176
|
+
case "object":
|
177
|
+
switch (a.$$typeof) {
|
178
|
+
case l:
|
179
|
+
case n:
|
180
|
+
h = true;
|
181
|
+
}
|
182
|
+
}
|
183
|
+
if (h)
|
184
|
+
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(a2) {
|
185
|
+
return a2;
|
186
|
+
})) : null != c && (O(c) && (c = N(c, e + (!c.key || h && h.key === c.key ? "" : ("" + c.key).replace(P, "$&/") + "/") + a)), b.push(c)), 1;
|
187
|
+
h = 0;
|
188
|
+
d = "" === d ? "." : d + ":";
|
189
|
+
if (I(a))
|
190
|
+
for (var g = 0; g < a.length; g++) {
|
191
|
+
k = a[g];
|
192
|
+
var f = d + Q(k, g);
|
193
|
+
h += R(k, b, e, f, c);
|
194
|
+
}
|
195
|
+
else if (f = A(a), "function" === typeof f)
|
196
|
+
for (a = f.call(a), g = 0; !(k = a.next()).done; )
|
197
|
+
k = k.value, f = d + Q(k, g++), h += R(k, b, e, f, c);
|
198
|
+
else if ("object" === k)
|
199
|
+
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.");
|
200
|
+
return h;
|
201
|
+
}
|
202
|
+
function S(a, b, e) {
|
203
|
+
if (null == a)
|
204
|
+
return a;
|
205
|
+
var d = [], c = 0;
|
206
|
+
R(a, d, "", "", function(a2) {
|
207
|
+
return b.call(e, a2, c++);
|
208
|
+
});
|
209
|
+
return d;
|
210
|
+
}
|
211
|
+
function T(a) {
|
212
|
+
if (-1 === a._status) {
|
213
|
+
var b = a._result;
|
214
|
+
b = b();
|
215
|
+
b.then(function(b2) {
|
216
|
+
if (0 === a._status || -1 === a._status)
|
217
|
+
a._status = 1, a._result = b2;
|
218
|
+
}, function(b2) {
|
219
|
+
if (0 === a._status || -1 === a._status)
|
220
|
+
a._status = 2, a._result = b2;
|
221
|
+
});
|
222
|
+
-1 === a._status && (a._status = 0, a._result = b);
|
223
|
+
}
|
224
|
+
if (1 === a._status)
|
225
|
+
return a._result.default;
|
226
|
+
throw a._result;
|
227
|
+
}
|
228
|
+
var U = { current: null };
|
229
|
+
var V = { transition: null };
|
230
|
+
var W = { ReactCurrentDispatcher: U, ReactCurrentBatchConfig: V, ReactCurrentOwner: K };
|
231
|
+
exports.Children = { map: S, forEach: function(a, b, e) {
|
232
|
+
S(a, function() {
|
233
|
+
b.apply(this, arguments);
|
234
|
+
}, e);
|
235
|
+
}, count: function(a) {
|
236
|
+
var b = 0;
|
237
|
+
S(a, function() {
|
238
|
+
b++;
|
239
|
+
});
|
240
|
+
return b;
|
241
|
+
}, toArray: function(a) {
|
242
|
+
return S(a, function(a2) {
|
243
|
+
return a2;
|
244
|
+
}) || [];
|
245
|
+
}, only: function(a) {
|
246
|
+
if (!O(a))
|
247
|
+
throw Error("React.Children.only expected to receive a single React element child.");
|
248
|
+
return a;
|
249
|
+
} };
|
250
|
+
exports.Component = E;
|
251
|
+
exports.Fragment = p;
|
252
|
+
exports.Profiler = r;
|
253
|
+
exports.PureComponent = G;
|
254
|
+
exports.StrictMode = q;
|
255
|
+
exports.Suspense = w;
|
256
|
+
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = W;
|
257
|
+
exports.cloneElement = function(a, b, e) {
|
258
|
+
if (null === a || void 0 === a)
|
259
|
+
throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + a + ".");
|
260
|
+
var d = C({}, a.props), c = a.key, k = a.ref, h = a._owner;
|
261
|
+
if (null != b) {
|
262
|
+
void 0 !== b.ref && (k = b.ref, h = K.current);
|
263
|
+
void 0 !== b.key && (c = "" + b.key);
|
264
|
+
if (a.type && a.type.defaultProps)
|
265
|
+
var g = a.type.defaultProps;
|
266
|
+
for (f in b)
|
267
|
+
J.call(b, f) && !L.hasOwnProperty(f) && (d[f] = void 0 === b[f] && void 0 !== g ? g[f] : b[f]);
|
268
|
+
}
|
269
|
+
var f = arguments.length - 2;
|
270
|
+
if (1 === f)
|
271
|
+
d.children = e;
|
272
|
+
else if (1 < f) {
|
273
|
+
g = Array(f);
|
274
|
+
for (var m = 0; m < f; m++)
|
275
|
+
g[m] = arguments[m + 2];
|
276
|
+
d.children = g;
|
277
|
+
}
|
278
|
+
return { $$typeof: l, type: a.type, key: c, ref: k, props: d, _owner: h };
|
279
|
+
};
|
280
|
+
exports.createContext = function(a) {
|
281
|
+
a = { $$typeof: u, _currentValue: a, _currentValue2: a, _threadCount: 0, Provider: null, Consumer: null, _defaultValue: null, _globalName: null };
|
282
|
+
a.Provider = { $$typeof: t, _context: a };
|
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 { $$typeof: v, render: a };
|
296
|
+
};
|
297
|
+
exports.isValidElement = O;
|
298
|
+
exports.lazy = function(a) {
|
299
|
+
return { $$typeof: y, _payload: { _status: -1, _result: a }, _init: T };
|
300
|
+
};
|
301
|
+
exports.memo = function(a, b) {
|
302
|
+
return { $$typeof: x, type: a, compare: void 0 === b ? null : b };
|
303
|
+
};
|
304
|
+
exports.startTransition = function(a) {
|
305
|
+
var b = V.transition;
|
306
|
+
V.transition = {};
|
307
|
+
try {
|
308
|
+
a();
|
309
|
+
} finally {
|
310
|
+
V.transition = b;
|
311
|
+
}
|
312
|
+
};
|
313
|
+
exports.unstable_act = function() {
|
314
|
+
throw Error("act(...) is not supported in production builds of React.");
|
315
|
+
};
|
316
|
+
exports.useCallback = function(a, b) {
|
317
|
+
return U.current.useCallback(a, b);
|
318
|
+
};
|
319
|
+
exports.useContext = function(a) {
|
320
|
+
return U.current.useContext(a);
|
321
|
+
};
|
322
|
+
exports.useDebugValue = function() {
|
323
|
+
};
|
324
|
+
exports.useDeferredValue = function(a) {
|
325
|
+
return U.current.useDeferredValue(a);
|
326
|
+
};
|
327
|
+
exports.useEffect = function(a, b) {
|
328
|
+
return U.current.useEffect(a, b);
|
329
|
+
};
|
330
|
+
exports.useId = function() {
|
331
|
+
return U.current.useId();
|
332
|
+
};
|
333
|
+
exports.useImperativeHandle = function(a, b, e) {
|
334
|
+
return U.current.useImperativeHandle(a, b, e);
|
335
|
+
};
|
336
|
+
exports.useInsertionEffect = function(a, b) {
|
337
|
+
return U.current.useInsertionEffect(a, b);
|
338
|
+
};
|
339
|
+
exports.useLayoutEffect = function(a, b) {
|
340
|
+
return U.current.useLayoutEffect(a, b);
|
341
|
+
};
|
342
|
+
exports.useMemo = function(a, b) {
|
343
|
+
return U.current.useMemo(a, b);
|
344
|
+
};
|
345
|
+
exports.useReducer = function(a, b, e) {
|
346
|
+
return U.current.useReducer(a, b, e);
|
347
|
+
};
|
348
|
+
exports.useRef = function(a) {
|
349
|
+
return U.current.useRef(a);
|
350
|
+
};
|
351
|
+
exports.useState = function(a) {
|
352
|
+
return U.current.useState(a);
|
353
|
+
};
|
354
|
+
exports.useSyncExternalStore = function(a, b, e) {
|
355
|
+
return U.current.useSyncExternalStore(a, b, e);
|
356
|
+
};
|
357
|
+
exports.useTransition = function() {
|
358
|
+
return U.current.useTransition();
|
359
|
+
};
|
360
|
+
exports.version = "18.2.0";
|
361
|
+
}
|
362
|
+
});
|
363
|
+
|
364
|
+
// ../../node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react.development.js
|
365
|
+
var require_react_development = __commonJS({
|
366
|
+
"../../node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react.development.js"(exports, module) {
|
367
|
+
init_esm_shims();
|
368
|
+
if (process.env.NODE_ENV !== "production") {
|
369
|
+
(function() {
|
370
|
+
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
|
371
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
372
|
+
}
|
373
|
+
var ReactVersion = "18.2.0";
|
374
|
+
var REACT_ELEMENT_TYPE = Symbol.for("react.element");
|
375
|
+
var REACT_PORTAL_TYPE = Symbol.for("react.portal");
|
376
|
+
var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
377
|
+
var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
|
378
|
+
var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
379
|
+
var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
|
380
|
+
var REACT_CONTEXT_TYPE = Symbol.for("react.context");
|
381
|
+
var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
|
382
|
+
var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
|
383
|
+
var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
|
384
|
+
var REACT_MEMO_TYPE = Symbol.for("react.memo");
|
385
|
+
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
386
|
+
var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
|
387
|
+
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
388
|
+
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
389
|
+
function getIteratorFn(maybeIterable) {
|
390
|
+
if (maybeIterable === null || typeof maybeIterable !== "object") {
|
391
|
+
return null;
|
392
|
+
}
|
393
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
394
|
+
if (typeof maybeIterator === "function") {
|
395
|
+
return maybeIterator;
|
396
|
+
}
|
397
|
+
return null;
|
398
|
+
}
|
399
|
+
var ReactCurrentDispatcher = {
|
400
|
+
/**
|
401
|
+
* @internal
|
402
|
+
* @type {ReactComponent}
|
403
|
+
*/
|
404
|
+
current: null
|
405
|
+
};
|
406
|
+
var ReactCurrentBatchConfig = {
|
407
|
+
transition: null
|
408
|
+
};
|
409
|
+
var ReactCurrentActQueue = {
|
410
|
+
current: null,
|
411
|
+
// Used to reproduce behavior of `batchedUpdates` in legacy mode.
|
412
|
+
isBatchingLegacy: false,
|
413
|
+
didScheduleLegacyUpdate: false
|
414
|
+
};
|
415
|
+
var ReactCurrentOwner = {
|
416
|
+
/**
|
417
|
+
* @internal
|
418
|
+
* @type {ReactComponent}
|
419
|
+
*/
|
420
|
+
current: null
|
421
|
+
};
|
422
|
+
var ReactDebugCurrentFrame = {};
|
423
|
+
var currentExtraStackFrame = null;
|
424
|
+
function setExtraStackFrame(stack) {
|
425
|
+
{
|
426
|
+
currentExtraStackFrame = stack;
|
427
|
+
}
|
428
|
+
}
|
429
|
+
{
|
430
|
+
ReactDebugCurrentFrame.setExtraStackFrame = function(stack) {
|
431
|
+
{
|
432
|
+
currentExtraStackFrame = stack;
|
433
|
+
}
|
434
|
+
};
|
435
|
+
ReactDebugCurrentFrame.getCurrentStack = null;
|
436
|
+
ReactDebugCurrentFrame.getStackAddendum = function() {
|
437
|
+
var stack = "";
|
438
|
+
if (currentExtraStackFrame) {
|
439
|
+
stack += currentExtraStackFrame;
|
440
|
+
}
|
441
|
+
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
442
|
+
if (impl) {
|
443
|
+
stack += impl() || "";
|
444
|
+
}
|
445
|
+
return stack;
|
446
|
+
};
|
447
|
+
}
|
448
|
+
var enableScopeAPI = false;
|
449
|
+
var enableCacheElement = false;
|
450
|
+
var enableTransitionTracing = false;
|
451
|
+
var enableLegacyHidden = false;
|
452
|
+
var enableDebugTracing = false;
|
453
|
+
var ReactSharedInternals = {
|
454
|
+
ReactCurrentDispatcher,
|
455
|
+
ReactCurrentBatchConfig,
|
456
|
+
ReactCurrentOwner
|
457
|
+
};
|
458
|
+
{
|
459
|
+
ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
|
460
|
+
ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
|
461
|
+
}
|
462
|
+
function warn(format) {
|
463
|
+
{
|
464
|
+
{
|
465
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
466
|
+
args[_key - 1] = arguments[_key];
|
467
|
+
}
|
468
|
+
printWarning("warn", format, args);
|
469
|
+
}
|
470
|
+
}
|
471
|
+
}
|
472
|
+
function error(format) {
|
473
|
+
{
|
474
|
+
{
|
475
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
476
|
+
args[_key2 - 1] = arguments[_key2];
|
477
|
+
}
|
478
|
+
printWarning("error", format, args);
|
479
|
+
}
|
480
|
+
}
|
481
|
+
}
|
482
|
+
function printWarning(level, format, args) {
|
483
|
+
{
|
484
|
+
var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
|
485
|
+
var stack = ReactDebugCurrentFrame2.getStackAddendum();
|
486
|
+
if (stack !== "") {
|
487
|
+
format += "%s";
|
488
|
+
args = args.concat([stack]);
|
489
|
+
}
|
490
|
+
var argsWithFormat = args.map(function(item) {
|
491
|
+
return String(item);
|
492
|
+
});
|
493
|
+
argsWithFormat.unshift("Warning: " + format);
|
494
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
495
|
+
}
|
496
|
+
}
|
497
|
+
var didWarnStateUpdateForUnmountedComponent = {};
|
498
|
+
function warnNoop(publicInstance, callerName) {
|
499
|
+
{
|
500
|
+
var _constructor = publicInstance.constructor;
|
501
|
+
var componentName = _constructor && (_constructor.displayName || _constructor.name) || "ReactClass";
|
502
|
+
var warningKey = componentName + "." + callerName;
|
503
|
+
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
504
|
+
return;
|
505
|
+
}
|
506
|
+
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);
|
507
|
+
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
508
|
+
}
|
509
|
+
}
|
510
|
+
var ReactNoopUpdateQueue = {
|
511
|
+
/**
|
512
|
+
* Checks whether or not this composite component is mounted.
|
513
|
+
* @param {ReactClass} publicInstance The instance we want to test.
|
514
|
+
* @return {boolean} True if mounted, false otherwise.
|
515
|
+
* @protected
|
516
|
+
* @final
|
517
|
+
*/
|
518
|
+
isMounted: function(publicInstance) {
|
519
|
+
return false;
|
520
|
+
},
|
521
|
+
/**
|
522
|
+
* Forces an update. This should only be invoked when it is known with
|
523
|
+
* certainty that we are **not** in a DOM transaction.
|
524
|
+
*
|
525
|
+
* You may want to call this when you know that some deeper aspect of the
|
526
|
+
* component's state has changed but `setState` was not called.
|
527
|
+
*
|
528
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
529
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
530
|
+
*
|
531
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
532
|
+
* @param {?function} callback Called after component is updated.
|
533
|
+
* @param {?string} callerName name of the calling function in the public API.
|
534
|
+
* @internal
|
535
|
+
*/
|
536
|
+
enqueueForceUpdate: function(publicInstance, callback, callerName) {
|
537
|
+
warnNoop(publicInstance, "forceUpdate");
|
538
|
+
},
|
539
|
+
/**
|
540
|
+
* Replaces all of the state. Always use this or `setState` to mutate state.
|
541
|
+
* You should treat `this.state` as immutable.
|
542
|
+
*
|
543
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
544
|
+
* accessing `this.state` after calling this method may return the old value.
|
545
|
+
*
|
546
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
547
|
+
* @param {object} completeState Next state.
|
548
|
+
* @param {?function} callback Called after component is updated.
|
549
|
+
* @param {?string} callerName name of the calling function in the public API.
|
550
|
+
* @internal
|
551
|
+
*/
|
552
|
+
enqueueReplaceState: function(publicInstance, completeState, callback, callerName) {
|
553
|
+
warnNoop(publicInstance, "replaceState");
|
554
|
+
},
|
555
|
+
/**
|
556
|
+
* Sets a subset of the state. This only exists because _pendingState is
|
557
|
+
* internal. This provides a merging strategy that is not available to deep
|
558
|
+
* properties which is confusing. TODO: Expose pendingState or don't use it
|
559
|
+
* during the merge.
|
560
|
+
*
|
561
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
562
|
+
* @param {object} partialState Next partial state to be merged with state.
|
563
|
+
* @param {?function} callback Called after component is updated.
|
564
|
+
* @param {?string} Name of the calling function in the public API.
|
565
|
+
* @internal
|
566
|
+
*/
|
567
|
+
enqueueSetState: function(publicInstance, partialState, callback, callerName) {
|
568
|
+
warnNoop(publicInstance, "setState");
|
569
|
+
}
|
570
|
+
};
|
571
|
+
var assign = Object.assign;
|
572
|
+
var emptyObject = {};
|
573
|
+
{
|
574
|
+
Object.freeze(emptyObject);
|
575
|
+
}
|
576
|
+
function Component(props, context, updater) {
|
577
|
+
this.props = props;
|
578
|
+
this.context = context;
|
579
|
+
this.refs = emptyObject;
|
580
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
581
|
+
}
|
582
|
+
Component.prototype.isReactComponent = {};
|
583
|
+
Component.prototype.setState = function(partialState, callback) {
|
584
|
+
if (typeof partialState !== "object" && typeof partialState !== "function" && partialState != null) {
|
585
|
+
throw new Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
|
586
|
+
}
|
587
|
+
this.updater.enqueueSetState(this, partialState, callback, "setState");
|
588
|
+
};
|
589
|
+
Component.prototype.forceUpdate = function(callback) {
|
590
|
+
this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
|
591
|
+
};
|
592
|
+
{
|
593
|
+
var deprecatedAPIs = {
|
594
|
+
isMounted: ["isMounted", "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],
|
595
|
+
replaceState: ["replaceState", "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]
|
596
|
+
};
|
597
|
+
var defineDeprecationWarning = function(methodName, info) {
|
598
|
+
Object.defineProperty(Component.prototype, methodName, {
|
599
|
+
get: function() {
|
600
|
+
warn("%s(...) is deprecated in plain JavaScript React classes. %s", info[0], info[1]);
|
601
|
+
return void 0;
|
602
|
+
}
|
603
|
+
});
|
604
|
+
};
|
605
|
+
for (var fnName in deprecatedAPIs) {
|
606
|
+
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
607
|
+
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
608
|
+
}
|
609
|
+
}
|
610
|
+
}
|
611
|
+
function ComponentDummy() {
|
612
|
+
}
|
613
|
+
ComponentDummy.prototype = Component.prototype;
|
614
|
+
function PureComponent(props, context, updater) {
|
615
|
+
this.props = props;
|
616
|
+
this.context = context;
|
617
|
+
this.refs = emptyObject;
|
618
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
619
|
+
}
|
620
|
+
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
621
|
+
pureComponentPrototype.constructor = PureComponent;
|
622
|
+
assign(pureComponentPrototype, Component.prototype);
|
623
|
+
pureComponentPrototype.isPureReactComponent = true;
|
624
|
+
function createRef() {
|
625
|
+
var refObject = {
|
626
|
+
current: null
|
627
|
+
};
|
628
|
+
{
|
629
|
+
Object.seal(refObject);
|
630
|
+
}
|
631
|
+
return refObject;
|
632
|
+
}
|
633
|
+
var isArrayImpl = Array.isArray;
|
634
|
+
function isArray(a) {
|
635
|
+
return isArrayImpl(a);
|
636
|
+
}
|
637
|
+
function typeName(value) {
|
638
|
+
{
|
639
|
+
var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
|
640
|
+
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
641
|
+
return type;
|
642
|
+
}
|
643
|
+
}
|
644
|
+
function willCoercionThrow(value) {
|
645
|
+
{
|
646
|
+
try {
|
647
|
+
testStringCoercion(value);
|
648
|
+
return false;
|
649
|
+
} catch (e) {
|
650
|
+
return true;
|
651
|
+
}
|
652
|
+
}
|
653
|
+
}
|
654
|
+
function testStringCoercion(value) {
|
655
|
+
return "" + value;
|
656
|
+
}
|
657
|
+
function checkKeyStringCoercion(value) {
|
658
|
+
{
|
659
|
+
if (willCoercionThrow(value)) {
|
660
|
+
error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
|
661
|
+
return testStringCoercion(value);
|
662
|
+
}
|
663
|
+
}
|
664
|
+
}
|
665
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
666
|
+
var displayName = outerType.displayName;
|
667
|
+
if (displayName) {
|
668
|
+
return displayName;
|
669
|
+
}
|
670
|
+
var functionName = innerType.displayName || innerType.name || "";
|
671
|
+
return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
|
672
|
+
}
|
673
|
+
function getContextName(type) {
|
674
|
+
return type.displayName || "Context";
|
675
|
+
}
|
676
|
+
function getComponentNameFromType(type) {
|
677
|
+
if (type == null) {
|
678
|
+
return null;
|
679
|
+
}
|
680
|
+
{
|
681
|
+
if (typeof type.tag === "number") {
|
682
|
+
error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
|
683
|
+
}
|
684
|
+
}
|
685
|
+
if (typeof type === "function") {
|
686
|
+
return type.displayName || type.name || null;
|
687
|
+
}
|
688
|
+
if (typeof type === "string") {
|
689
|
+
return type;
|
690
|
+
}
|
691
|
+
switch (type) {
|
692
|
+
case REACT_FRAGMENT_TYPE:
|
693
|
+
return "Fragment";
|
694
|
+
case REACT_PORTAL_TYPE:
|
695
|
+
return "Portal";
|
696
|
+
case REACT_PROFILER_TYPE:
|
697
|
+
return "Profiler";
|
698
|
+
case REACT_STRICT_MODE_TYPE:
|
699
|
+
return "StrictMode";
|
700
|
+
case REACT_SUSPENSE_TYPE:
|
701
|
+
return "Suspense";
|
702
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
703
|
+
return "SuspenseList";
|
704
|
+
}
|
705
|
+
if (typeof type === "object") {
|
706
|
+
switch (type.$$typeof) {
|
707
|
+
case REACT_CONTEXT_TYPE:
|
708
|
+
var context = type;
|
709
|
+
return getContextName(context) + ".Consumer";
|
710
|
+
case REACT_PROVIDER_TYPE:
|
711
|
+
var provider = type;
|
712
|
+
return getContextName(provider._context) + ".Provider";
|
713
|
+
case REACT_FORWARD_REF_TYPE:
|
714
|
+
return getWrappedName(type, type.render, "ForwardRef");
|
715
|
+
case REACT_MEMO_TYPE:
|
716
|
+
var outerName = type.displayName || null;
|
717
|
+
if (outerName !== null) {
|
718
|
+
return outerName;
|
719
|
+
}
|
720
|
+
return getComponentNameFromType(type.type) || "Memo";
|
721
|
+
case REACT_LAZY_TYPE: {
|
722
|
+
var lazyComponent = type;
|
723
|
+
var payload = lazyComponent._payload;
|
724
|
+
var init = lazyComponent._init;
|
725
|
+
try {
|
726
|
+
return getComponentNameFromType(init(payload));
|
727
|
+
} catch (x) {
|
728
|
+
return null;
|
729
|
+
}
|
730
|
+
}
|
731
|
+
}
|
732
|
+
}
|
733
|
+
return null;
|
734
|
+
}
|
735
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
736
|
+
var RESERVED_PROPS = {
|
737
|
+
key: true,
|
738
|
+
ref: true,
|
739
|
+
__self: true,
|
740
|
+
__source: true
|
741
|
+
};
|
742
|
+
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
|
743
|
+
{
|
744
|
+
didWarnAboutStringRefs = {};
|
745
|
+
}
|
746
|
+
function hasValidRef(config) {
|
747
|
+
{
|
748
|
+
if (hasOwnProperty.call(config, "ref")) {
|
749
|
+
var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
|
750
|
+
if (getter && getter.isReactWarning) {
|
751
|
+
return false;
|
752
|
+
}
|
753
|
+
}
|
754
|
+
}
|
755
|
+
return config.ref !== void 0;
|
756
|
+
}
|
757
|
+
function hasValidKey(config) {
|
758
|
+
{
|
759
|
+
if (hasOwnProperty.call(config, "key")) {
|
760
|
+
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
761
|
+
if (getter && getter.isReactWarning) {
|
762
|
+
return false;
|
763
|
+
}
|
764
|
+
}
|
765
|
+
}
|
766
|
+
return config.key !== void 0;
|
767
|
+
}
|
768
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
769
|
+
var warnAboutAccessingKey = function() {
|
770
|
+
{
|
771
|
+
if (!specialPropKeyWarningShown) {
|
772
|
+
specialPropKeyWarningShown = true;
|
773
|
+
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);
|
774
|
+
}
|
775
|
+
}
|
776
|
+
};
|
777
|
+
warnAboutAccessingKey.isReactWarning = true;
|
778
|
+
Object.defineProperty(props, "key", {
|
779
|
+
get: warnAboutAccessingKey,
|
780
|
+
configurable: true
|
781
|
+
});
|
782
|
+
}
|
783
|
+
function defineRefPropWarningGetter(props, displayName) {
|
784
|
+
var warnAboutAccessingRef = function() {
|
785
|
+
{
|
786
|
+
if (!specialPropRefWarningShown) {
|
787
|
+
specialPropRefWarningShown = true;
|
788
|
+
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);
|
789
|
+
}
|
790
|
+
}
|
791
|
+
};
|
792
|
+
warnAboutAccessingRef.isReactWarning = true;
|
793
|
+
Object.defineProperty(props, "ref", {
|
794
|
+
get: warnAboutAccessingRef,
|
795
|
+
configurable: true
|
796
|
+
});
|
797
|
+
}
|
798
|
+
function warnIfStringRefCannotBeAutoConverted(config) {
|
799
|
+
{
|
800
|
+
if (typeof config.ref === "string" && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
|
801
|
+
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
802
|
+
if (!didWarnAboutStringRefs[componentName]) {
|
803
|
+
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);
|
804
|
+
didWarnAboutStringRefs[componentName] = true;
|
805
|
+
}
|
806
|
+
}
|
807
|
+
}
|
808
|
+
}
|
809
|
+
var ReactElement = function(type, key, ref, self, source, owner, props) {
|
810
|
+
var element = {
|
811
|
+
// This tag allows us to uniquely identify this as a React Element
|
812
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
813
|
+
// Built-in properties that belong on the element
|
814
|
+
type,
|
815
|
+
key,
|
816
|
+
ref,
|
817
|
+
props,
|
818
|
+
// Record the component responsible for creating this element.
|
819
|
+
_owner: owner
|
820
|
+
};
|
821
|
+
{
|
822
|
+
element._store = {};
|
823
|
+
Object.defineProperty(element._store, "validated", {
|
824
|
+
configurable: false,
|
825
|
+
enumerable: false,
|
826
|
+
writable: true,
|
827
|
+
value: false
|
828
|
+
});
|
829
|
+
Object.defineProperty(element, "_self", {
|
830
|
+
configurable: false,
|
831
|
+
enumerable: false,
|
832
|
+
writable: false,
|
833
|
+
value: self
|
834
|
+
});
|
835
|
+
Object.defineProperty(element, "_source", {
|
836
|
+
configurable: false,
|
837
|
+
enumerable: false,
|
838
|
+
writable: false,
|
839
|
+
value: source
|
840
|
+
});
|
841
|
+
if (Object.freeze) {
|
842
|
+
Object.freeze(element.props);
|
843
|
+
Object.freeze(element);
|
844
|
+
}
|
845
|
+
}
|
846
|
+
return element;
|
847
|
+
};
|
848
|
+
function createElement(type, config, children) {
|
849
|
+
var propName;
|
850
|
+
var props = {};
|
851
|
+
var key = null;
|
852
|
+
var ref = null;
|
853
|
+
var self = null;
|
854
|
+
var source = null;
|
855
|
+
if (config != null) {
|
856
|
+
if (hasValidRef(config)) {
|
857
|
+
ref = config.ref;
|
858
|
+
{
|
859
|
+
warnIfStringRefCannotBeAutoConverted(config);
|
860
|
+
}
|
861
|
+
}
|
862
|
+
if (hasValidKey(config)) {
|
863
|
+
{
|
864
|
+
checkKeyStringCoercion(config.key);
|
865
|
+
}
|
866
|
+
key = "" + config.key;
|
867
|
+
}
|
868
|
+
self = config.__self === void 0 ? null : config.__self;
|
869
|
+
source = config.__source === void 0 ? null : config.__source;
|
870
|
+
for (propName in config) {
|
871
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
872
|
+
props[propName] = config[propName];
|
873
|
+
}
|
874
|
+
}
|
875
|
+
}
|
876
|
+
var childrenLength = arguments.length - 2;
|
877
|
+
if (childrenLength === 1) {
|
878
|
+
props.children = children;
|
879
|
+
} else if (childrenLength > 1) {
|
880
|
+
var childArray = Array(childrenLength);
|
881
|
+
for (var i = 0; i < childrenLength; i++) {
|
882
|
+
childArray[i] = arguments[i + 2];
|
883
|
+
}
|
884
|
+
{
|
885
|
+
if (Object.freeze) {
|
886
|
+
Object.freeze(childArray);
|
887
|
+
}
|
888
|
+
}
|
889
|
+
props.children = childArray;
|
890
|
+
}
|
891
|
+
if (type && type.defaultProps) {
|
892
|
+
var defaultProps = type.defaultProps;
|
893
|
+
for (propName in defaultProps) {
|
894
|
+
if (props[propName] === void 0) {
|
895
|
+
props[propName] = defaultProps[propName];
|
896
|
+
}
|
897
|
+
}
|
898
|
+
}
|
899
|
+
{
|
900
|
+
if (key || ref) {
|
901
|
+
var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
|
902
|
+
if (key) {
|
903
|
+
defineKeyPropWarningGetter(props, displayName);
|
904
|
+
}
|
905
|
+
if (ref) {
|
906
|
+
defineRefPropWarningGetter(props, displayName);
|
907
|
+
}
|
908
|
+
}
|
909
|
+
}
|
910
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
911
|
+
}
|
912
|
+
function cloneAndReplaceKey(oldElement, newKey) {
|
913
|
+
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
914
|
+
return newElement;
|
915
|
+
}
|
916
|
+
function cloneElement(element, config, children) {
|
917
|
+
if (element === null || element === void 0) {
|
918
|
+
throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
|
919
|
+
}
|
920
|
+
var propName;
|
921
|
+
var props = assign({}, element.props);
|
922
|
+
var key = element.key;
|
923
|
+
var ref = element.ref;
|
924
|
+
var self = element._self;
|
925
|
+
var source = element._source;
|
926
|
+
var owner = element._owner;
|
927
|
+
if (config != null) {
|
928
|
+
if (hasValidRef(config)) {
|
929
|
+
ref = config.ref;
|
930
|
+
owner = ReactCurrentOwner.current;
|
931
|
+
}
|
932
|
+
if (hasValidKey(config)) {
|
933
|
+
{
|
934
|
+
checkKeyStringCoercion(config.key);
|
935
|
+
}
|
936
|
+
key = "" + config.key;
|
937
|
+
}
|
938
|
+
var defaultProps;
|
939
|
+
if (element.type && element.type.defaultProps) {
|
940
|
+
defaultProps = element.type.defaultProps;
|
941
|
+
}
|
942
|
+
for (propName in config) {
|
943
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
944
|
+
if (config[propName] === void 0 && defaultProps !== void 0) {
|
945
|
+
props[propName] = defaultProps[propName];
|
946
|
+
} else {
|
947
|
+
props[propName] = config[propName];
|
948
|
+
}
|
949
|
+
}
|
950
|
+
}
|
951
|
+
}
|
952
|
+
var childrenLength = arguments.length - 2;
|
953
|
+
if (childrenLength === 1) {
|
954
|
+
props.children = children;
|
955
|
+
} else if (childrenLength > 1) {
|
956
|
+
var childArray = Array(childrenLength);
|
957
|
+
for (var i = 0; i < childrenLength; i++) {
|
958
|
+
childArray[i] = arguments[i + 2];
|
959
|
+
}
|
960
|
+
props.children = childArray;
|
961
|
+
}
|
962
|
+
return ReactElement(element.type, key, ref, self, source, owner, props);
|
963
|
+
}
|
964
|
+
function isValidElement(object) {
|
965
|
+
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
966
|
+
}
|
967
|
+
var SEPARATOR = ".";
|
968
|
+
var SUBSEPARATOR = ":";
|
969
|
+
function escape(key) {
|
970
|
+
var escapeRegex = /[=:]/g;
|
971
|
+
var escaperLookup = {
|
972
|
+
"=": "=0",
|
973
|
+
":": "=2"
|
974
|
+
};
|
975
|
+
var escapedString = key.replace(escapeRegex, function(match) {
|
976
|
+
return escaperLookup[match];
|
977
|
+
});
|
978
|
+
return "$" + escapedString;
|
979
|
+
}
|
980
|
+
var didWarnAboutMaps = false;
|
981
|
+
var userProvidedKeyEscapeRegex = /\/+/g;
|
982
|
+
function escapeUserProvidedKey(text) {
|
983
|
+
return text.replace(userProvidedKeyEscapeRegex, "$&/");
|
984
|
+
}
|
985
|
+
function getElementKey(element, index) {
|
986
|
+
if (typeof element === "object" && element !== null && element.key != null) {
|
987
|
+
{
|
988
|
+
checkKeyStringCoercion(element.key);
|
989
|
+
}
|
990
|
+
return escape("" + element.key);
|
991
|
+
}
|
992
|
+
return index.toString(36);
|
993
|
+
}
|
994
|
+
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
995
|
+
var type = typeof children;
|
996
|
+
if (type === "undefined" || type === "boolean") {
|
997
|
+
children = null;
|
998
|
+
}
|
999
|
+
var invokeCallback = false;
|
1000
|
+
if (children === null) {
|
1001
|
+
invokeCallback = true;
|
1002
|
+
} else {
|
1003
|
+
switch (type) {
|
1004
|
+
case "string":
|
1005
|
+
case "number":
|
1006
|
+
invokeCallback = true;
|
1007
|
+
break;
|
1008
|
+
case "object":
|
1009
|
+
switch (children.$$typeof) {
|
1010
|
+
case REACT_ELEMENT_TYPE:
|
1011
|
+
case REACT_PORTAL_TYPE:
|
1012
|
+
invokeCallback = true;
|
1013
|
+
}
|
1014
|
+
}
|
1015
|
+
}
|
1016
|
+
if (invokeCallback) {
|
1017
|
+
var _child = children;
|
1018
|
+
var mappedChild = callback(_child);
|
1019
|
+
var childKey = nameSoFar === "" ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
|
1020
|
+
if (isArray(mappedChild)) {
|
1021
|
+
var escapedChildKey = "";
|
1022
|
+
if (childKey != null) {
|
1023
|
+
escapedChildKey = escapeUserProvidedKey(childKey) + "/";
|
1024
|
+
}
|
1025
|
+
mapIntoArray(mappedChild, array, escapedChildKey, "", function(c) {
|
1026
|
+
return c;
|
1027
|
+
});
|
1028
|
+
} else if (mappedChild != null) {
|
1029
|
+
if (isValidElement(mappedChild)) {
|
1030
|
+
{
|
1031
|
+
if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {
|
1032
|
+
checkKeyStringCoercion(mappedChild.key);
|
1033
|
+
}
|
1034
|
+
}
|
1035
|
+
mappedChild = cloneAndReplaceKey(
|
1036
|
+
mappedChild,
|
1037
|
+
// Keep both the (mapped) and old keys if they differ, just as
|
1038
|
+
// traverseAllChildren used to do for objects as children
|
1039
|
+
escapedPrefix + // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
1040
|
+
(mappedChild.key && (!_child || _child.key !== mappedChild.key) ? (
|
1041
|
+
// $FlowFixMe Flow incorrectly thinks existing element's key can be a number
|
1042
|
+
// eslint-disable-next-line react-internal/safe-string-coercion
|
1043
|
+
escapeUserProvidedKey("" + mappedChild.key) + "/"
|
1044
|
+
) : "") + childKey
|
1045
|
+
);
|
1046
|
+
}
|
1047
|
+
array.push(mappedChild);
|
1048
|
+
}
|
1049
|
+
return 1;
|
1050
|
+
}
|
1051
|
+
var child;
|
1052
|
+
var nextName;
|
1053
|
+
var subtreeCount = 0;
|
1054
|
+
var nextNamePrefix = nameSoFar === "" ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
1055
|
+
if (isArray(children)) {
|
1056
|
+
for (var i = 0; i < children.length; i++) {
|
1057
|
+
child = children[i];
|
1058
|
+
nextName = nextNamePrefix + getElementKey(child, i);
|
1059
|
+
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
1060
|
+
}
|
1061
|
+
} else {
|
1062
|
+
var iteratorFn = getIteratorFn(children);
|
1063
|
+
if (typeof iteratorFn === "function") {
|
1064
|
+
var iterableChildren = children;
|
1065
|
+
{
|
1066
|
+
if (iteratorFn === iterableChildren.entries) {
|
1067
|
+
if (!didWarnAboutMaps) {
|
1068
|
+
warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead.");
|
1069
|
+
}
|
1070
|
+
didWarnAboutMaps = true;
|
1071
|
+
}
|
1072
|
+
}
|
1073
|
+
var iterator = iteratorFn.call(iterableChildren);
|
1074
|
+
var step;
|
1075
|
+
var ii = 0;
|
1076
|
+
while (!(step = iterator.next()).done) {
|
1077
|
+
child = step.value;
|
1078
|
+
nextName = nextNamePrefix + getElementKey(child, ii++);
|
1079
|
+
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
1080
|
+
}
|
1081
|
+
} else if (type === "object") {
|
1082
|
+
var childrenString = String(children);
|
1083
|
+
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.");
|
1084
|
+
}
|
1085
|
+
}
|
1086
|
+
return subtreeCount;
|
1087
|
+
}
|
1088
|
+
function mapChildren(children, func, context) {
|
1089
|
+
if (children == null) {
|
1090
|
+
return children;
|
1091
|
+
}
|
1092
|
+
var result = [];
|
1093
|
+
var count = 0;
|
1094
|
+
mapIntoArray(children, result, "", "", function(child) {
|
1095
|
+
return func.call(context, child, count++);
|
1096
|
+
});
|
1097
|
+
return result;
|
1098
|
+
}
|
1099
|
+
function countChildren(children) {
|
1100
|
+
var n = 0;
|
1101
|
+
mapChildren(children, function() {
|
1102
|
+
n++;
|
1103
|
+
});
|
1104
|
+
return n;
|
1105
|
+
}
|
1106
|
+
function forEachChildren(children, forEachFunc, forEachContext) {
|
1107
|
+
mapChildren(children, function() {
|
1108
|
+
forEachFunc.apply(this, arguments);
|
1109
|
+
}, forEachContext);
|
1110
|
+
}
|
1111
|
+
function toArray(children) {
|
1112
|
+
return mapChildren(children, function(child) {
|
1113
|
+
return child;
|
1114
|
+
}) || [];
|
1115
|
+
}
|
1116
|
+
function onlyChild(children) {
|
1117
|
+
if (!isValidElement(children)) {
|
1118
|
+
throw new Error("React.Children.only expected to receive a single React element child.");
|
1119
|
+
}
|
1120
|
+
return children;
|
1121
|
+
}
|
1122
|
+
function createContext(defaultValue) {
|
1123
|
+
var context = {
|
1124
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
1125
|
+
// As a workaround to support multiple concurrent renderers, we categorize
|
1126
|
+
// some renderers as primary and others as secondary. We only expect
|
1127
|
+
// there to be two concurrent renderers at most: React Native (primary) and
|
1128
|
+
// Fabric (secondary); React DOM (primary) and React ART (secondary).
|
1129
|
+
// Secondary renderers store their context values on separate fields.
|
1130
|
+
_currentValue: defaultValue,
|
1131
|
+
_currentValue2: defaultValue,
|
1132
|
+
// Used to track how many concurrent renderers this context currently
|
1133
|
+
// supports within in a single renderer. Such as parallel server rendering.
|
1134
|
+
_threadCount: 0,
|
1135
|
+
// These are circular
|
1136
|
+
Provider: null,
|
1137
|
+
Consumer: null,
|
1138
|
+
// Add these to use same hidden class in VM as ServerContext
|
1139
|
+
_defaultValue: null,
|
1140
|
+
_globalName: null
|
1141
|
+
};
|
1142
|
+
context.Provider = {
|
1143
|
+
$$typeof: REACT_PROVIDER_TYPE,
|
1144
|
+
_context: context
|
1145
|
+
};
|
1146
|
+
var hasWarnedAboutUsingNestedContextConsumers = false;
|
1147
|
+
var hasWarnedAboutUsingConsumerProvider = false;
|
1148
|
+
var hasWarnedAboutDisplayNameOnConsumer = false;
|
1149
|
+
{
|
1150
|
+
var Consumer = {
|
1151
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
1152
|
+
_context: context
|
1153
|
+
};
|
1154
|
+
Object.defineProperties(Consumer, {
|
1155
|
+
Provider: {
|
1156
|
+
get: function() {
|
1157
|
+
if (!hasWarnedAboutUsingConsumerProvider) {
|
1158
|
+
hasWarnedAboutUsingConsumerProvider = true;
|
1159
|
+
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?");
|
1160
|
+
}
|
1161
|
+
return context.Provider;
|
1162
|
+
},
|
1163
|
+
set: function(_Provider) {
|
1164
|
+
context.Provider = _Provider;
|
1165
|
+
}
|
1166
|
+
},
|
1167
|
+
_currentValue: {
|
1168
|
+
get: function() {
|
1169
|
+
return context._currentValue;
|
1170
|
+
},
|
1171
|
+
set: function(_currentValue) {
|
1172
|
+
context._currentValue = _currentValue;
|
1173
|
+
}
|
1174
|
+
},
|
1175
|
+
_currentValue2: {
|
1176
|
+
get: function() {
|
1177
|
+
return context._currentValue2;
|
1178
|
+
},
|
1179
|
+
set: function(_currentValue2) {
|
1180
|
+
context._currentValue2 = _currentValue2;
|
1181
|
+
}
|
1182
|
+
},
|
1183
|
+
_threadCount: {
|
1184
|
+
get: function() {
|
1185
|
+
return context._threadCount;
|
1186
|
+
},
|
1187
|
+
set: function(_threadCount) {
|
1188
|
+
context._threadCount = _threadCount;
|
1189
|
+
}
|
1190
|
+
},
|
1191
|
+
Consumer: {
|
1192
|
+
get: function() {
|
1193
|
+
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
1194
|
+
hasWarnedAboutUsingNestedContextConsumers = true;
|
1195
|
+
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?");
|
1196
|
+
}
|
1197
|
+
return context.Consumer;
|
1198
|
+
}
|
1199
|
+
},
|
1200
|
+
displayName: {
|
1201
|
+
get: function() {
|
1202
|
+
return context.displayName;
|
1203
|
+
},
|
1204
|
+
set: function(displayName) {
|
1205
|
+
if (!hasWarnedAboutDisplayNameOnConsumer) {
|
1206
|
+
warn("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.", displayName);
|
1207
|
+
hasWarnedAboutDisplayNameOnConsumer = true;
|
1208
|
+
}
|
1209
|
+
}
|
1210
|
+
}
|
1211
|
+
});
|
1212
|
+
context.Consumer = Consumer;
|
1213
|
+
}
|
1214
|
+
{
|
1215
|
+
context._currentRenderer = null;
|
1216
|
+
context._currentRenderer2 = null;
|
1217
|
+
}
|
1218
|
+
return context;
|
1219
|
+
}
|
1220
|
+
var Uninitialized = -1;
|
1221
|
+
var Pending = 0;
|
1222
|
+
var Resolved = 1;
|
1223
|
+
var Rejected = 2;
|
1224
|
+
function lazyInitializer(payload) {
|
1225
|
+
if (payload._status === Uninitialized) {
|
1226
|
+
var ctor = payload._result;
|
1227
|
+
var thenable = ctor();
|
1228
|
+
thenable.then(function(moduleObject2) {
|
1229
|
+
if (payload._status === Pending || payload._status === Uninitialized) {
|
1230
|
+
var resolved = payload;
|
1231
|
+
resolved._status = Resolved;
|
1232
|
+
resolved._result = moduleObject2;
|
1233
|
+
}
|
1234
|
+
}, function(error2) {
|
1235
|
+
if (payload._status === Pending || payload._status === Uninitialized) {
|
1236
|
+
var rejected = payload;
|
1237
|
+
rejected._status = Rejected;
|
1238
|
+
rejected._result = error2;
|
1239
|
+
}
|
1240
|
+
});
|
1241
|
+
if (payload._status === Uninitialized) {
|
1242
|
+
var pending = payload;
|
1243
|
+
pending._status = Pending;
|
1244
|
+
pending._result = thenable;
|
1245
|
+
}
|
1246
|
+
}
|
1247
|
+
if (payload._status === Resolved) {
|
1248
|
+
var moduleObject = payload._result;
|
1249
|
+
{
|
1250
|
+
if (moduleObject === void 0) {
|
1251
|
+
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);
|
1252
|
+
}
|
1253
|
+
}
|
1254
|
+
{
|
1255
|
+
if (!("default" in moduleObject)) {
|
1256
|
+
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);
|
1257
|
+
}
|
1258
|
+
}
|
1259
|
+
return moduleObject.default;
|
1260
|
+
} else {
|
1261
|
+
throw payload._result;
|
1262
|
+
}
|
1263
|
+
}
|
1264
|
+
function lazy(ctor) {
|
1265
|
+
var payload = {
|
1266
|
+
// We use these fields to store the result.
|
1267
|
+
_status: Uninitialized,
|
1268
|
+
_result: ctor
|
1269
|
+
};
|
1270
|
+
var lazyType = {
|
1271
|
+
$$typeof: REACT_LAZY_TYPE,
|
1272
|
+
_payload: payload,
|
1273
|
+
_init: lazyInitializer
|
1274
|
+
};
|
1275
|
+
{
|
1276
|
+
var defaultProps;
|
1277
|
+
var propTypes;
|
1278
|
+
Object.defineProperties(lazyType, {
|
1279
|
+
defaultProps: {
|
1280
|
+
configurable: true,
|
1281
|
+
get: function() {
|
1282
|
+
return defaultProps;
|
1283
|
+
},
|
1284
|
+
set: function(newDefaultProps) {
|
1285
|
+
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.");
|
1286
|
+
defaultProps = newDefaultProps;
|
1287
|
+
Object.defineProperty(lazyType, "defaultProps", {
|
1288
|
+
enumerable: true
|
1289
|
+
});
|
1290
|
+
}
|
1291
|
+
},
|
1292
|
+
propTypes: {
|
1293
|
+
configurable: true,
|
1294
|
+
get: function() {
|
1295
|
+
return propTypes;
|
1296
|
+
},
|
1297
|
+
set: function(newPropTypes) {
|
1298
|
+
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.");
|
1299
|
+
propTypes = newPropTypes;
|
1300
|
+
Object.defineProperty(lazyType, "propTypes", {
|
1301
|
+
enumerable: true
|
1302
|
+
});
|
1303
|
+
}
|
1304
|
+
}
|
1305
|
+
});
|
1306
|
+
}
|
1307
|
+
return lazyType;
|
1308
|
+
}
|
1309
|
+
function forwardRef(render) {
|
1310
|
+
{
|
1311
|
+
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
1312
|
+
error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).");
|
1313
|
+
} else if (typeof render !== "function") {
|
1314
|
+
error("forwardRef requires a render function but was given %s.", render === null ? "null" : typeof render);
|
1315
|
+
} else {
|
1316
|
+
if (render.length !== 0 && render.length !== 2) {
|
1317
|
+
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.");
|
1318
|
+
}
|
1319
|
+
}
|
1320
|
+
if (render != null) {
|
1321
|
+
if (render.defaultProps != null || render.propTypes != null) {
|
1322
|
+
error("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?");
|
1323
|
+
}
|
1324
|
+
}
|
1325
|
+
}
|
1326
|
+
var elementType = {
|
1327
|
+
$$typeof: REACT_FORWARD_REF_TYPE,
|
1328
|
+
render
|
1329
|
+
};
|
1330
|
+
{
|
1331
|
+
var ownName;
|
1332
|
+
Object.defineProperty(elementType, "displayName", {
|
1333
|
+
enumerable: false,
|
1334
|
+
configurable: true,
|
1335
|
+
get: function() {
|
1336
|
+
return ownName;
|
1337
|
+
},
|
1338
|
+
set: function(name) {
|
1339
|
+
ownName = name;
|
1340
|
+
if (!render.name && !render.displayName) {
|
1341
|
+
render.displayName = name;
|
1342
|
+
}
|
1343
|
+
}
|
1344
|
+
});
|
1345
|
+
}
|
1346
|
+
return elementType;
|
1347
|
+
}
|
1348
|
+
var REACT_MODULE_REFERENCE;
|
1349
|
+
{
|
1350
|
+
REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
|
1351
|
+
}
|
1352
|
+
function isValidElementType(type) {
|
1353
|
+
if (typeof type === "string" || typeof type === "function") {
|
1354
|
+
return true;
|
1355
|
+
}
|
1356
|
+
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) {
|
1357
|
+
return true;
|
1358
|
+
}
|
1359
|
+
if (typeof type === "object" && type !== null) {
|
1360
|
+
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 || // This needs to include all possible module reference object
|
1361
|
+
// types supported by any Flight configuration anywhere since
|
1362
|
+
// we don't know which Flight build this will end up being used
|
1363
|
+
// with.
|
1364
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
|
1365
|
+
return true;
|
1366
|
+
}
|
1367
|
+
}
|
1368
|
+
return false;
|
1369
|
+
}
|
1370
|
+
function memo(type, compare) {
|
1371
|
+
{
|
1372
|
+
if (!isValidElementType(type)) {
|
1373
|
+
error("memo: The first argument must be a component. Instead received: %s", type === null ? "null" : typeof type);
|
1374
|
+
}
|
1375
|
+
}
|
1376
|
+
var elementType = {
|
1377
|
+
$$typeof: REACT_MEMO_TYPE,
|
1378
|
+
type,
|
1379
|
+
compare: compare === void 0 ? null : compare
|
1380
|
+
};
|
1381
|
+
{
|
1382
|
+
var ownName;
|
1383
|
+
Object.defineProperty(elementType, "displayName", {
|
1384
|
+
enumerable: false,
|
1385
|
+
configurable: true,
|
1386
|
+
get: function() {
|
1387
|
+
return ownName;
|
1388
|
+
},
|
1389
|
+
set: function(name) {
|
1390
|
+
ownName = name;
|
1391
|
+
if (!type.name && !type.displayName) {
|
1392
|
+
type.displayName = name;
|
1393
|
+
}
|
1394
|
+
}
|
1395
|
+
});
|
1396
|
+
}
|
1397
|
+
return elementType;
|
1398
|
+
}
|
1399
|
+
function resolveDispatcher() {
|
1400
|
+
var dispatcher = ReactCurrentDispatcher.current;
|
1401
|
+
{
|
1402
|
+
if (dispatcher === null) {
|
1403
|
+
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.");
|
1404
|
+
}
|
1405
|
+
}
|
1406
|
+
return dispatcher;
|
1407
|
+
}
|
1408
|
+
function useContext(Context) {
|
1409
|
+
var dispatcher = resolveDispatcher();
|
1410
|
+
{
|
1411
|
+
if (Context._context !== void 0) {
|
1412
|
+
var realContext = Context._context;
|
1413
|
+
if (realContext.Consumer === Context) {
|
1414
|
+
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?");
|
1415
|
+
} else if (realContext.Provider === Context) {
|
1416
|
+
error("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?");
|
1417
|
+
}
|
1418
|
+
}
|
1419
|
+
}
|
1420
|
+
return dispatcher.useContext(Context);
|
1421
|
+
}
|
1422
|
+
function useState(initialState) {
|
1423
|
+
var dispatcher = resolveDispatcher();
|
1424
|
+
return dispatcher.useState(initialState);
|
1425
|
+
}
|
1426
|
+
function useReducer(reducer, initialArg, init) {
|
1427
|
+
var dispatcher = resolveDispatcher();
|
1428
|
+
return dispatcher.useReducer(reducer, initialArg, init);
|
1429
|
+
}
|
1430
|
+
function useRef(initialValue) {
|
1431
|
+
var dispatcher = resolveDispatcher();
|
1432
|
+
return dispatcher.useRef(initialValue);
|
1433
|
+
}
|
1434
|
+
function useEffect(create, deps) {
|
1435
|
+
var dispatcher = resolveDispatcher();
|
1436
|
+
return dispatcher.useEffect(create, deps);
|
1437
|
+
}
|
1438
|
+
function useInsertionEffect(create, deps) {
|
1439
|
+
var dispatcher = resolveDispatcher();
|
1440
|
+
return dispatcher.useInsertionEffect(create, deps);
|
1441
|
+
}
|
1442
|
+
function useLayoutEffect(create, deps) {
|
1443
|
+
var dispatcher = resolveDispatcher();
|
1444
|
+
return dispatcher.useLayoutEffect(create, deps);
|
1445
|
+
}
|
1446
|
+
function useCallback(callback, deps) {
|
1447
|
+
var dispatcher = resolveDispatcher();
|
1448
|
+
return dispatcher.useCallback(callback, deps);
|
1449
|
+
}
|
1450
|
+
function useMemo(create, deps) {
|
1451
|
+
var dispatcher = resolveDispatcher();
|
1452
|
+
return dispatcher.useMemo(create, deps);
|
1453
|
+
}
|
1454
|
+
function useImperativeHandle(ref, create, deps) {
|
1455
|
+
var dispatcher = resolveDispatcher();
|
1456
|
+
return dispatcher.useImperativeHandle(ref, create, deps);
|
1457
|
+
}
|
1458
|
+
function useDebugValue(value, formatterFn) {
|
1459
|
+
{
|
1460
|
+
var dispatcher = resolveDispatcher();
|
1461
|
+
return dispatcher.useDebugValue(value, formatterFn);
|
1462
|
+
}
|
1463
|
+
}
|
1464
|
+
function useTransition() {
|
1465
|
+
var dispatcher = resolveDispatcher();
|
1466
|
+
return dispatcher.useTransition();
|
1467
|
+
}
|
1468
|
+
function useDeferredValue(value) {
|
1469
|
+
var dispatcher = resolveDispatcher();
|
1470
|
+
return dispatcher.useDeferredValue(value);
|
1471
|
+
}
|
1472
|
+
function useId() {
|
1473
|
+
var dispatcher = resolveDispatcher();
|
1474
|
+
return dispatcher.useId();
|
1475
|
+
}
|
1476
|
+
function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
1477
|
+
var dispatcher = resolveDispatcher();
|
1478
|
+
return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
1479
|
+
}
|
1480
|
+
var disabledDepth = 0;
|
1481
|
+
var prevLog;
|
1482
|
+
var prevInfo;
|
1483
|
+
var prevWarn;
|
1484
|
+
var prevError;
|
1485
|
+
var prevGroup;
|
1486
|
+
var prevGroupCollapsed;
|
1487
|
+
var prevGroupEnd;
|
1488
|
+
function disabledLog() {
|
1489
|
+
}
|
1490
|
+
disabledLog.__reactDisabledLog = true;
|
1491
|
+
function disableLogs() {
|
1492
|
+
{
|
1493
|
+
if (disabledDepth === 0) {
|
1494
|
+
prevLog = console.log;
|
1495
|
+
prevInfo = console.info;
|
1496
|
+
prevWarn = console.warn;
|
1497
|
+
prevError = console.error;
|
1498
|
+
prevGroup = console.group;
|
1499
|
+
prevGroupCollapsed = console.groupCollapsed;
|
1500
|
+
prevGroupEnd = console.groupEnd;
|
1501
|
+
var props = {
|
1502
|
+
configurable: true,
|
1503
|
+
enumerable: true,
|
1504
|
+
value: disabledLog,
|
1505
|
+
writable: true
|
1506
|
+
};
|
1507
|
+
Object.defineProperties(console, {
|
1508
|
+
info: props,
|
1509
|
+
log: props,
|
1510
|
+
warn: props,
|
1511
|
+
error: props,
|
1512
|
+
group: props,
|
1513
|
+
groupCollapsed: props,
|
1514
|
+
groupEnd: props
|
1515
|
+
});
|
1516
|
+
}
|
1517
|
+
disabledDepth++;
|
1518
|
+
}
|
1519
|
+
}
|
1520
|
+
function reenableLogs() {
|
1521
|
+
{
|
1522
|
+
disabledDepth--;
|
1523
|
+
if (disabledDepth === 0) {
|
1524
|
+
var props = {
|
1525
|
+
configurable: true,
|
1526
|
+
enumerable: true,
|
1527
|
+
writable: true
|
1528
|
+
};
|
1529
|
+
Object.defineProperties(console, {
|
1530
|
+
log: assign({}, props, {
|
1531
|
+
value: prevLog
|
1532
|
+
}),
|
1533
|
+
info: assign({}, props, {
|
1534
|
+
value: prevInfo
|
1535
|
+
}),
|
1536
|
+
warn: assign({}, props, {
|
1537
|
+
value: prevWarn
|
1538
|
+
}),
|
1539
|
+
error: assign({}, props, {
|
1540
|
+
value: prevError
|
1541
|
+
}),
|
1542
|
+
group: assign({}, props, {
|
1543
|
+
value: prevGroup
|
1544
|
+
}),
|
1545
|
+
groupCollapsed: assign({}, props, {
|
1546
|
+
value: prevGroupCollapsed
|
1547
|
+
}),
|
1548
|
+
groupEnd: assign({}, props, {
|
1549
|
+
value: prevGroupEnd
|
1550
|
+
})
|
1551
|
+
});
|
1552
|
+
}
|
1553
|
+
if (disabledDepth < 0) {
|
1554
|
+
error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
1555
|
+
}
|
1556
|
+
}
|
1557
|
+
}
|
1558
|
+
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
1559
|
+
var prefix;
|
1560
|
+
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
1561
|
+
{
|
1562
|
+
if (prefix === void 0) {
|
1563
|
+
try {
|
1564
|
+
throw Error();
|
1565
|
+
} catch (x) {
|
1566
|
+
var match = x.stack.trim().match(/\n( *(at )?)/);
|
1567
|
+
prefix = match && match[1] || "";
|
1568
|
+
}
|
1569
|
+
}
|
1570
|
+
return "\n" + prefix + name;
|
1571
|
+
}
|
1572
|
+
}
|
1573
|
+
var reentry = false;
|
1574
|
+
var componentFrameCache;
|
1575
|
+
{
|
1576
|
+
var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
|
1577
|
+
componentFrameCache = new PossiblyWeakMap();
|
1578
|
+
}
|
1579
|
+
function describeNativeComponentFrame(fn, construct) {
|
1580
|
+
if (!fn || reentry) {
|
1581
|
+
return "";
|
1582
|
+
}
|
1583
|
+
{
|
1584
|
+
var frame = componentFrameCache.get(fn);
|
1585
|
+
if (frame !== void 0) {
|
1586
|
+
return frame;
|
1587
|
+
}
|
1588
|
+
}
|
1589
|
+
var control;
|
1590
|
+
reentry = true;
|
1591
|
+
var previousPrepareStackTrace = Error.prepareStackTrace;
|
1592
|
+
Error.prepareStackTrace = void 0;
|
1593
|
+
var previousDispatcher;
|
1594
|
+
{
|
1595
|
+
previousDispatcher = ReactCurrentDispatcher$1.current;
|
1596
|
+
ReactCurrentDispatcher$1.current = null;
|
1597
|
+
disableLogs();
|
1598
|
+
}
|
1599
|
+
try {
|
1600
|
+
if (construct) {
|
1601
|
+
var Fake = function() {
|
1602
|
+
throw Error();
|
1603
|
+
};
|
1604
|
+
Object.defineProperty(Fake.prototype, "props", {
|
1605
|
+
set: function() {
|
1606
|
+
throw Error();
|
1607
|
+
}
|
1608
|
+
});
|
1609
|
+
if (typeof Reflect === "object" && Reflect.construct) {
|
1610
|
+
try {
|
1611
|
+
Reflect.construct(Fake, []);
|
1612
|
+
} catch (x) {
|
1613
|
+
control = x;
|
1614
|
+
}
|
1615
|
+
Reflect.construct(fn, [], Fake);
|
1616
|
+
} else {
|
1617
|
+
try {
|
1618
|
+
Fake.call();
|
1619
|
+
} catch (x) {
|
1620
|
+
control = x;
|
1621
|
+
}
|
1622
|
+
fn.call(Fake.prototype);
|
1623
|
+
}
|
1624
|
+
} else {
|
1625
|
+
try {
|
1626
|
+
throw Error();
|
1627
|
+
} catch (x) {
|
1628
|
+
control = x;
|
1629
|
+
}
|
1630
|
+
fn();
|
1631
|
+
}
|
1632
|
+
} catch (sample) {
|
1633
|
+
if (sample && control && typeof sample.stack === "string") {
|
1634
|
+
var sampleLines = sample.stack.split("\n");
|
1635
|
+
var controlLines = control.stack.split("\n");
|
1636
|
+
var s = sampleLines.length - 1;
|
1637
|
+
var c = controlLines.length - 1;
|
1638
|
+
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
1639
|
+
c--;
|
1640
|
+
}
|
1641
|
+
for (; s >= 1 && c >= 0; s--, c--) {
|
1642
|
+
if (sampleLines[s] !== controlLines[c]) {
|
1643
|
+
if (s !== 1 || c !== 1) {
|
1644
|
+
do {
|
1645
|
+
s--;
|
1646
|
+
c--;
|
1647
|
+
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
1648
|
+
var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
|
1649
|
+
if (fn.displayName && _frame.includes("<anonymous>")) {
|
1650
|
+
_frame = _frame.replace("<anonymous>", fn.displayName);
|
1651
|
+
}
|
1652
|
+
{
|
1653
|
+
if (typeof fn === "function") {
|
1654
|
+
componentFrameCache.set(fn, _frame);
|
1655
|
+
}
|
1656
|
+
}
|
1657
|
+
return _frame;
|
1658
|
+
}
|
1659
|
+
} while (s >= 1 && c >= 0);
|
1660
|
+
}
|
1661
|
+
break;
|
1662
|
+
}
|
1663
|
+
}
|
1664
|
+
}
|
1665
|
+
} finally {
|
1666
|
+
reentry = false;
|
1667
|
+
{
|
1668
|
+
ReactCurrentDispatcher$1.current = previousDispatcher;
|
1669
|
+
reenableLogs();
|
1670
|
+
}
|
1671
|
+
Error.prepareStackTrace = previousPrepareStackTrace;
|
1672
|
+
}
|
1673
|
+
var name = fn ? fn.displayName || fn.name : "";
|
1674
|
+
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
|
1675
|
+
{
|
1676
|
+
if (typeof fn === "function") {
|
1677
|
+
componentFrameCache.set(fn, syntheticFrame);
|
1678
|
+
}
|
1679
|
+
}
|
1680
|
+
return syntheticFrame;
|
1681
|
+
}
|
1682
|
+
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
1683
|
+
{
|
1684
|
+
return describeNativeComponentFrame(fn, false);
|
1685
|
+
}
|
1686
|
+
}
|
1687
|
+
function shouldConstruct(Component2) {
|
1688
|
+
var prototype = Component2.prototype;
|
1689
|
+
return !!(prototype && prototype.isReactComponent);
|
1690
|
+
}
|
1691
|
+
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
1692
|
+
if (type == null) {
|
1693
|
+
return "";
|
1694
|
+
}
|
1695
|
+
if (typeof type === "function") {
|
1696
|
+
{
|
1697
|
+
return describeNativeComponentFrame(type, shouldConstruct(type));
|
1698
|
+
}
|
1699
|
+
}
|
1700
|
+
if (typeof type === "string") {
|
1701
|
+
return describeBuiltInComponentFrame(type);
|
1702
|
+
}
|
1703
|
+
switch (type) {
|
1704
|
+
case REACT_SUSPENSE_TYPE:
|
1705
|
+
return describeBuiltInComponentFrame("Suspense");
|
1706
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
1707
|
+
return describeBuiltInComponentFrame("SuspenseList");
|
1708
|
+
}
|
1709
|
+
if (typeof type === "object") {
|
1710
|
+
switch (type.$$typeof) {
|
1711
|
+
case REACT_FORWARD_REF_TYPE:
|
1712
|
+
return describeFunctionComponentFrame(type.render);
|
1713
|
+
case REACT_MEMO_TYPE:
|
1714
|
+
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
1715
|
+
case REACT_LAZY_TYPE: {
|
1716
|
+
var lazyComponent = type;
|
1717
|
+
var payload = lazyComponent._payload;
|
1718
|
+
var init = lazyComponent._init;
|
1719
|
+
try {
|
1720
|
+
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
1721
|
+
} catch (x) {
|
1722
|
+
}
|
1723
|
+
}
|
1724
|
+
}
|
1725
|
+
}
|
1726
|
+
return "";
|
1727
|
+
}
|
1728
|
+
var loggedTypeFailures = {};
|
1729
|
+
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
1730
|
+
function setCurrentlyValidatingElement(element) {
|
1731
|
+
{
|
1732
|
+
if (element) {
|
1733
|
+
var owner = element._owner;
|
1734
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
1735
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
1736
|
+
} else {
|
1737
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
1738
|
+
}
|
1739
|
+
}
|
1740
|
+
}
|
1741
|
+
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
1742
|
+
{
|
1743
|
+
var has = Function.call.bind(hasOwnProperty);
|
1744
|
+
for (var typeSpecName in typeSpecs) {
|
1745
|
+
if (has(typeSpecs, typeSpecName)) {
|
1746
|
+
var error$1 = void 0;
|
1747
|
+
try {
|
1748
|
+
if (typeof typeSpecs[typeSpecName] !== "function") {
|
1749
|
+
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`.");
|
1750
|
+
err.name = "Invariant Violation";
|
1751
|
+
throw err;
|
1752
|
+
}
|
1753
|
+
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
1754
|
+
} catch (ex) {
|
1755
|
+
error$1 = ex;
|
1756
|
+
}
|
1757
|
+
if (error$1 && !(error$1 instanceof Error)) {
|
1758
|
+
setCurrentlyValidatingElement(element);
|
1759
|
+
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);
|
1760
|
+
setCurrentlyValidatingElement(null);
|
1761
|
+
}
|
1762
|
+
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
1763
|
+
loggedTypeFailures[error$1.message] = true;
|
1764
|
+
setCurrentlyValidatingElement(element);
|
1765
|
+
error("Failed %s type: %s", location, error$1.message);
|
1766
|
+
setCurrentlyValidatingElement(null);
|
1767
|
+
}
|
1768
|
+
}
|
1769
|
+
}
|
1770
|
+
}
|
1771
|
+
}
|
1772
|
+
function setCurrentlyValidatingElement$1(element) {
|
1773
|
+
{
|
1774
|
+
if (element) {
|
1775
|
+
var owner = element._owner;
|
1776
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
1777
|
+
setExtraStackFrame(stack);
|
1778
|
+
} else {
|
1779
|
+
setExtraStackFrame(null);
|
1780
|
+
}
|
1781
|
+
}
|
1782
|
+
}
|
1783
|
+
var propTypesMisspellWarningShown;
|
1784
|
+
{
|
1785
|
+
propTypesMisspellWarningShown = false;
|
1786
|
+
}
|
1787
|
+
function getDeclarationErrorAddendum() {
|
1788
|
+
if (ReactCurrentOwner.current) {
|
1789
|
+
var name = getComponentNameFromType(ReactCurrentOwner.current.type);
|
1790
|
+
if (name) {
|
1791
|
+
return "\n\nCheck the render method of `" + name + "`.";
|
1792
|
+
}
|
1793
|
+
}
|
1794
|
+
return "";
|
1795
|
+
}
|
1796
|
+
function getSourceInfoErrorAddendum(source) {
|
1797
|
+
if (source !== void 0) {
|
1798
|
+
var fileName = source.fileName.replace(/^.*[\\\/]/, "");
|
1799
|
+
var lineNumber = source.lineNumber;
|
1800
|
+
return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
|
1801
|
+
}
|
1802
|
+
return "";
|
1803
|
+
}
|
1804
|
+
function getSourceInfoErrorAddendumForProps(elementProps) {
|
1805
|
+
if (elementProps !== null && elementProps !== void 0) {
|
1806
|
+
return getSourceInfoErrorAddendum(elementProps.__source);
|
1807
|
+
}
|
1808
|
+
return "";
|
1809
|
+
}
|
1810
|
+
var ownerHasKeyUseWarning = {};
|
1811
|
+
function getCurrentComponentErrorInfo(parentType) {
|
1812
|
+
var info = getDeclarationErrorAddendum();
|
1813
|
+
if (!info) {
|
1814
|
+
var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
|
1815
|
+
if (parentName) {
|
1816
|
+
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
1817
|
+
}
|
1818
|
+
}
|
1819
|
+
return info;
|
1820
|
+
}
|
1821
|
+
function validateExplicitKey(element, parentType) {
|
1822
|
+
if (!element._store || element._store.validated || element.key != null) {
|
1823
|
+
return;
|
1824
|
+
}
|
1825
|
+
element._store.validated = true;
|
1826
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
1827
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
1828
|
+
return;
|
1829
|
+
}
|
1830
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
1831
|
+
var childOwner = "";
|
1832
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
1833
|
+
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
1834
|
+
}
|
1835
|
+
{
|
1836
|
+
setCurrentlyValidatingElement$1(element);
|
1837
|
+
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);
|
1838
|
+
setCurrentlyValidatingElement$1(null);
|
1839
|
+
}
|
1840
|
+
}
|
1841
|
+
function validateChildKeys(node, parentType) {
|
1842
|
+
if (typeof node !== "object") {
|
1843
|
+
return;
|
1844
|
+
}
|
1845
|
+
if (isArray(node)) {
|
1846
|
+
for (var i = 0; i < node.length; i++) {
|
1847
|
+
var child = node[i];
|
1848
|
+
if (isValidElement(child)) {
|
1849
|
+
validateExplicitKey(child, parentType);
|
1850
|
+
}
|
1851
|
+
}
|
1852
|
+
} else if (isValidElement(node)) {
|
1853
|
+
if (node._store) {
|
1854
|
+
node._store.validated = true;
|
1855
|
+
}
|
1856
|
+
} else if (node) {
|
1857
|
+
var iteratorFn = getIteratorFn(node);
|
1858
|
+
if (typeof iteratorFn === "function") {
|
1859
|
+
if (iteratorFn !== node.entries) {
|
1860
|
+
var iterator = iteratorFn.call(node);
|
1861
|
+
var step;
|
1862
|
+
while (!(step = iterator.next()).done) {
|
1863
|
+
if (isValidElement(step.value)) {
|
1864
|
+
validateExplicitKey(step.value, parentType);
|
1865
|
+
}
|
1866
|
+
}
|
1867
|
+
}
|
1868
|
+
}
|
1869
|
+
}
|
1870
|
+
}
|
1871
|
+
function validatePropTypes(element) {
|
1872
|
+
{
|
1873
|
+
var type = element.type;
|
1874
|
+
if (type === null || type === void 0 || typeof type === "string") {
|
1875
|
+
return;
|
1876
|
+
}
|
1877
|
+
var propTypes;
|
1878
|
+
if (typeof type === "function") {
|
1879
|
+
propTypes = type.propTypes;
|
1880
|
+
} else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
1881
|
+
// Inner props are checked in the reconciler.
|
1882
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
1883
|
+
propTypes = type.propTypes;
|
1884
|
+
} else {
|
1885
|
+
return;
|
1886
|
+
}
|
1887
|
+
if (propTypes) {
|
1888
|
+
var name = getComponentNameFromType(type);
|
1889
|
+
checkPropTypes(propTypes, element.props, "prop", name, element);
|
1890
|
+
} else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
|
1891
|
+
propTypesMisspellWarningShown = true;
|
1892
|
+
var _name = getComponentNameFromType(type);
|
1893
|
+
error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
|
1894
|
+
}
|
1895
|
+
if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
|
1896
|
+
error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
1897
|
+
}
|
1898
|
+
}
|
1899
|
+
}
|
1900
|
+
function validateFragmentProps(fragment) {
|
1901
|
+
{
|
1902
|
+
var keys = Object.keys(fragment.props);
|
1903
|
+
for (var i = 0; i < keys.length; i++) {
|
1904
|
+
var key = keys[i];
|
1905
|
+
if (key !== "children" && key !== "key") {
|
1906
|
+
setCurrentlyValidatingElement$1(fragment);
|
1907
|
+
error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
|
1908
|
+
setCurrentlyValidatingElement$1(null);
|
1909
|
+
break;
|
1910
|
+
}
|
1911
|
+
}
|
1912
|
+
if (fragment.ref !== null) {
|
1913
|
+
setCurrentlyValidatingElement$1(fragment);
|
1914
|
+
error("Invalid attribute `ref` supplied to `React.Fragment`.");
|
1915
|
+
setCurrentlyValidatingElement$1(null);
|
1916
|
+
}
|
1917
|
+
}
|
1918
|
+
}
|
1919
|
+
function createElementWithValidation(type, props, children) {
|
1920
|
+
var validType = isValidElementType(type);
|
1921
|
+
if (!validType) {
|
1922
|
+
var info = "";
|
1923
|
+
if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
|
1924
|
+
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.";
|
1925
|
+
}
|
1926
|
+
var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
1927
|
+
if (sourceInfo) {
|
1928
|
+
info += sourceInfo;
|
1929
|
+
} else {
|
1930
|
+
info += getDeclarationErrorAddendum();
|
1931
|
+
}
|
1932
|
+
var typeString;
|
1933
|
+
if (type === null) {
|
1934
|
+
typeString = "null";
|
1935
|
+
} else if (isArray(type)) {
|
1936
|
+
typeString = "array";
|
1937
|
+
} else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
|
1938
|
+
typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
|
1939
|
+
info = " Did you accidentally export a JSX literal instead of a component?";
|
1940
|
+
} else {
|
1941
|
+
typeString = typeof type;
|
1942
|
+
}
|
1943
|
+
{
|
1944
|
+
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);
|
1945
|
+
}
|
1946
|
+
}
|
1947
|
+
var element = createElement.apply(this, arguments);
|
1948
|
+
if (element == null) {
|
1949
|
+
return element;
|
1950
|
+
}
|
1951
|
+
if (validType) {
|
1952
|
+
for (var i = 2; i < arguments.length; i++) {
|
1953
|
+
validateChildKeys(arguments[i], type);
|
1954
|
+
}
|
1955
|
+
}
|
1956
|
+
if (type === REACT_FRAGMENT_TYPE) {
|
1957
|
+
validateFragmentProps(element);
|
1958
|
+
} else {
|
1959
|
+
validatePropTypes(element);
|
1960
|
+
}
|
1961
|
+
return element;
|
1962
|
+
}
|
1963
|
+
var didWarnAboutDeprecatedCreateFactory = false;
|
1964
|
+
function createFactoryWithValidation(type) {
|
1965
|
+
var validatedFactory = createElementWithValidation.bind(null, type);
|
1966
|
+
validatedFactory.type = type;
|
1967
|
+
{
|
1968
|
+
if (!didWarnAboutDeprecatedCreateFactory) {
|
1969
|
+
didWarnAboutDeprecatedCreateFactory = true;
|
1970
|
+
warn("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.");
|
1971
|
+
}
|
1972
|
+
Object.defineProperty(validatedFactory, "type", {
|
1973
|
+
enumerable: false,
|
1974
|
+
get: function() {
|
1975
|
+
warn("Factory.type is deprecated. Access the class directly before passing it to createFactory.");
|
1976
|
+
Object.defineProperty(this, "type", {
|
1977
|
+
value: type
|
1978
|
+
});
|
1979
|
+
return type;
|
1980
|
+
}
|
1981
|
+
});
|
1982
|
+
}
|
1983
|
+
return validatedFactory;
|
1984
|
+
}
|
1985
|
+
function cloneElementWithValidation(element, props, children) {
|
1986
|
+
var newElement = cloneElement.apply(this, arguments);
|
1987
|
+
for (var i = 2; i < arguments.length; i++) {
|
1988
|
+
validateChildKeys(arguments[i], newElement.type);
|
1989
|
+
}
|
1990
|
+
validatePropTypes(newElement);
|
1991
|
+
return newElement;
|
1992
|
+
}
|
1993
|
+
function startTransition(scope, options) {
|
1994
|
+
var prevTransition = ReactCurrentBatchConfig.transition;
|
1995
|
+
ReactCurrentBatchConfig.transition = {};
|
1996
|
+
var currentTransition = ReactCurrentBatchConfig.transition;
|
1997
|
+
{
|
1998
|
+
ReactCurrentBatchConfig.transition._updatedFibers = /* @__PURE__ */ new Set();
|
1999
|
+
}
|
2000
|
+
try {
|
2001
|
+
scope();
|
2002
|
+
} finally {
|
2003
|
+
ReactCurrentBatchConfig.transition = prevTransition;
|
2004
|
+
{
|
2005
|
+
if (prevTransition === null && currentTransition._updatedFibers) {
|
2006
|
+
var updatedFibersCount = currentTransition._updatedFibers.size;
|
2007
|
+
if (updatedFibersCount > 10) {
|
2008
|
+
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.");
|
2009
|
+
}
|
2010
|
+
currentTransition._updatedFibers.clear();
|
2011
|
+
}
|
2012
|
+
}
|
2013
|
+
}
|
2014
|
+
}
|
2015
|
+
var didWarnAboutMessageChannel = false;
|
2016
|
+
var enqueueTaskImpl = null;
|
2017
|
+
function enqueueTask(task) {
|
2018
|
+
if (enqueueTaskImpl === null) {
|
2019
|
+
try {
|
2020
|
+
var requireString = ("require" + Math.random()).slice(0, 7);
|
2021
|
+
var nodeRequire = module && module[requireString];
|
2022
|
+
enqueueTaskImpl = nodeRequire.call(module, "timers").setImmediate;
|
2023
|
+
} catch (_err) {
|
2024
|
+
enqueueTaskImpl = function(callback) {
|
2025
|
+
{
|
2026
|
+
if (didWarnAboutMessageChannel === false) {
|
2027
|
+
didWarnAboutMessageChannel = true;
|
2028
|
+
if (typeof MessageChannel === "undefined") {
|
2029
|
+
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.");
|
2030
|
+
}
|
2031
|
+
}
|
2032
|
+
}
|
2033
|
+
var channel = new MessageChannel();
|
2034
|
+
channel.port1.onmessage = callback;
|
2035
|
+
channel.port2.postMessage(void 0);
|
2036
|
+
};
|
2037
|
+
}
|
2038
|
+
}
|
2039
|
+
return enqueueTaskImpl(task);
|
2040
|
+
}
|
2041
|
+
var actScopeDepth = 0;
|
2042
|
+
var didWarnNoAwaitAct = false;
|
2043
|
+
function act(callback) {
|
2044
|
+
{
|
2045
|
+
var prevActScopeDepth = actScopeDepth;
|
2046
|
+
actScopeDepth++;
|
2047
|
+
if (ReactCurrentActQueue.current === null) {
|
2048
|
+
ReactCurrentActQueue.current = [];
|
2049
|
+
}
|
2050
|
+
var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;
|
2051
|
+
var result;
|
2052
|
+
try {
|
2053
|
+
ReactCurrentActQueue.isBatchingLegacy = true;
|
2054
|
+
result = callback();
|
2055
|
+
if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
|
2056
|
+
var queue = ReactCurrentActQueue.current;
|
2057
|
+
if (queue !== null) {
|
2058
|
+
ReactCurrentActQueue.didScheduleLegacyUpdate = false;
|
2059
|
+
flushActQueue(queue);
|
2060
|
+
}
|
2061
|
+
}
|
2062
|
+
} catch (error2) {
|
2063
|
+
popActScope(prevActScopeDepth);
|
2064
|
+
throw error2;
|
2065
|
+
} finally {
|
2066
|
+
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
|
2067
|
+
}
|
2068
|
+
if (result !== null && typeof result === "object" && typeof result.then === "function") {
|
2069
|
+
var thenableResult = result;
|
2070
|
+
var wasAwaited = false;
|
2071
|
+
var thenable = {
|
2072
|
+
then: function(resolve, reject) {
|
2073
|
+
wasAwaited = true;
|
2074
|
+
thenableResult.then(function(returnValue2) {
|
2075
|
+
popActScope(prevActScopeDepth);
|
2076
|
+
if (actScopeDepth === 0) {
|
2077
|
+
recursivelyFlushAsyncActWork(returnValue2, resolve, reject);
|
2078
|
+
} else {
|
2079
|
+
resolve(returnValue2);
|
2080
|
+
}
|
2081
|
+
}, function(error2) {
|
2082
|
+
popActScope(prevActScopeDepth);
|
2083
|
+
reject(error2);
|
2084
|
+
});
|
2085
|
+
}
|
2086
|
+
};
|
2087
|
+
{
|
2088
|
+
if (!didWarnNoAwaitAct && typeof Promise !== "undefined") {
|
2089
|
+
Promise.resolve().then(function() {
|
2090
|
+
}).then(function() {
|
2091
|
+
if (!wasAwaited) {
|
2092
|
+
didWarnNoAwaitAct = true;
|
2093
|
+
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 () => ...);");
|
2094
|
+
}
|
2095
|
+
});
|
2096
|
+
}
|
2097
|
+
}
|
2098
|
+
return thenable;
|
2099
|
+
} else {
|
2100
|
+
var returnValue = result;
|
2101
|
+
popActScope(prevActScopeDepth);
|
2102
|
+
if (actScopeDepth === 0) {
|
2103
|
+
var _queue = ReactCurrentActQueue.current;
|
2104
|
+
if (_queue !== null) {
|
2105
|
+
flushActQueue(_queue);
|
2106
|
+
ReactCurrentActQueue.current = null;
|
2107
|
+
}
|
2108
|
+
var _thenable = {
|
2109
|
+
then: function(resolve, reject) {
|
2110
|
+
if (ReactCurrentActQueue.current === null) {
|
2111
|
+
ReactCurrentActQueue.current = [];
|
2112
|
+
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
2113
|
+
} else {
|
2114
|
+
resolve(returnValue);
|
2115
|
+
}
|
2116
|
+
}
|
2117
|
+
};
|
2118
|
+
return _thenable;
|
2119
|
+
} else {
|
2120
|
+
var _thenable2 = {
|
2121
|
+
then: function(resolve, reject) {
|
2122
|
+
resolve(returnValue);
|
2123
|
+
}
|
2124
|
+
};
|
2125
|
+
return _thenable2;
|
2126
|
+
}
|
2127
|
+
}
|
2128
|
+
}
|
2129
|
+
}
|
2130
|
+
function popActScope(prevActScopeDepth) {
|
2131
|
+
{
|
2132
|
+
if (prevActScopeDepth !== actScopeDepth - 1) {
|
2133
|
+
error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
|
2134
|
+
}
|
2135
|
+
actScopeDepth = prevActScopeDepth;
|
2136
|
+
}
|
2137
|
+
}
|
2138
|
+
function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
2139
|
+
{
|
2140
|
+
var queue = ReactCurrentActQueue.current;
|
2141
|
+
if (queue !== null) {
|
2142
|
+
try {
|
2143
|
+
flushActQueue(queue);
|
2144
|
+
enqueueTask(function() {
|
2145
|
+
if (queue.length === 0) {
|
2146
|
+
ReactCurrentActQueue.current = null;
|
2147
|
+
resolve(returnValue);
|
2148
|
+
} else {
|
2149
|
+
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
2150
|
+
}
|
2151
|
+
});
|
2152
|
+
} catch (error2) {
|
2153
|
+
reject(error2);
|
2154
|
+
}
|
2155
|
+
} else {
|
2156
|
+
resolve(returnValue);
|
2157
|
+
}
|
2158
|
+
}
|
2159
|
+
}
|
2160
|
+
var isFlushing = false;
|
2161
|
+
function flushActQueue(queue) {
|
2162
|
+
{
|
2163
|
+
if (!isFlushing) {
|
2164
|
+
isFlushing = true;
|
2165
|
+
var i = 0;
|
2166
|
+
try {
|
2167
|
+
for (; i < queue.length; i++) {
|
2168
|
+
var callback = queue[i];
|
2169
|
+
do {
|
2170
|
+
callback = callback(true);
|
2171
|
+
} while (callback !== null);
|
2172
|
+
}
|
2173
|
+
queue.length = 0;
|
2174
|
+
} catch (error2) {
|
2175
|
+
queue = queue.slice(i + 1);
|
2176
|
+
throw error2;
|
2177
|
+
} finally {
|
2178
|
+
isFlushing = false;
|
2179
|
+
}
|
2180
|
+
}
|
2181
|
+
}
|
2182
|
+
}
|
2183
|
+
var createElement$1 = createElementWithValidation;
|
2184
|
+
var cloneElement$1 = cloneElementWithValidation;
|
2185
|
+
var createFactory = createFactoryWithValidation;
|
2186
|
+
var Children = {
|
2187
|
+
map: mapChildren,
|
2188
|
+
forEach: forEachChildren,
|
2189
|
+
count: countChildren,
|
2190
|
+
toArray,
|
2191
|
+
only: onlyChild
|
2192
|
+
};
|
2193
|
+
exports.Children = Children;
|
2194
|
+
exports.Component = Component;
|
2195
|
+
exports.Fragment = REACT_FRAGMENT_TYPE;
|
2196
|
+
exports.Profiler = REACT_PROFILER_TYPE;
|
2197
|
+
exports.PureComponent = PureComponent;
|
2198
|
+
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
2199
|
+
exports.Suspense = REACT_SUSPENSE_TYPE;
|
2200
|
+
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
|
2201
|
+
exports.cloneElement = cloneElement$1;
|
2202
|
+
exports.createContext = createContext;
|
2203
|
+
exports.createElement = createElement$1;
|
2204
|
+
exports.createFactory = createFactory;
|
2205
|
+
exports.createRef = createRef;
|
2206
|
+
exports.forwardRef = forwardRef;
|
2207
|
+
exports.isValidElement = isValidElement;
|
2208
|
+
exports.lazy = lazy;
|
2209
|
+
exports.memo = memo;
|
2210
|
+
exports.startTransition = startTransition;
|
2211
|
+
exports.unstable_act = act;
|
2212
|
+
exports.useCallback = useCallback;
|
2213
|
+
exports.useContext = useContext;
|
2214
|
+
exports.useDebugValue = useDebugValue;
|
2215
|
+
exports.useDeferredValue = useDeferredValue;
|
2216
|
+
exports.useEffect = useEffect;
|
2217
|
+
exports.useId = useId;
|
2218
|
+
exports.useImperativeHandle = useImperativeHandle;
|
2219
|
+
exports.useInsertionEffect = useInsertionEffect;
|
2220
|
+
exports.useLayoutEffect = useLayoutEffect;
|
2221
|
+
exports.useMemo = useMemo;
|
2222
|
+
exports.useReducer = useReducer;
|
2223
|
+
exports.useRef = useRef;
|
2224
|
+
exports.useState = useState;
|
2225
|
+
exports.useSyncExternalStore = useSyncExternalStore;
|
2226
|
+
exports.useTransition = useTransition;
|
2227
|
+
exports.version = ReactVersion;
|
2228
|
+
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
|
2229
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
2230
|
+
}
|
2231
|
+
})();
|
2232
|
+
}
|
2233
|
+
}
|
2234
|
+
});
|
2235
|
+
|
2236
|
+
// ../../node_modules/.pnpm/react@18.2.0/node_modules/react/index.js
|
2237
|
+
var require_react = __commonJS({
|
2238
|
+
"../../node_modules/.pnpm/react@18.2.0/node_modules/react/index.js"(exports, module) {
|
2239
|
+
init_esm_shims();
|
2240
|
+
if (process.env.NODE_ENV === "production") {
|
2241
|
+
module.exports = require_react_production_min();
|
2242
|
+
} else {
|
2243
|
+
module.exports = require_react_development();
|
2244
|
+
}
|
2245
|
+
}
|
2246
|
+
});
|
2247
|
+
|
2248
|
+
// ../../node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react-jsx-runtime.production.min.js
|
2249
|
+
var require_react_jsx_runtime_production_min = __commonJS({
|
2250
|
+
"../../node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react-jsx-runtime.production.min.js"(exports) {
|
2251
|
+
init_esm_shims();
|
2252
|
+
var f = require_react();
|
2253
|
+
var k = Symbol.for("react.element");
|
2254
|
+
var l = Symbol.for("react.fragment");
|
2255
|
+
var m = Object.prototype.hasOwnProperty;
|
2256
|
+
var n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner;
|
2257
|
+
var p = { key: true, ref: true, __self: true, __source: true };
|
2258
|
+
function q(c, a, g) {
|
2259
|
+
var b, d = {}, e = null, h = null;
|
2260
|
+
void 0 !== g && (e = "" + g);
|
2261
|
+
void 0 !== a.key && (e = "" + a.key);
|
2262
|
+
void 0 !== a.ref && (h = a.ref);
|
2263
|
+
for (b in a)
|
2264
|
+
m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
|
2265
|
+
if (c && c.defaultProps)
|
2266
|
+
for (b in a = c.defaultProps, a)
|
2267
|
+
void 0 === d[b] && (d[b] = a[b]);
|
2268
|
+
return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
|
2269
|
+
}
|
2270
|
+
exports.Fragment = l;
|
2271
|
+
exports.jsx = q;
|
2272
|
+
exports.jsxs = q;
|
2273
|
+
}
|
2274
|
+
});
|
2275
|
+
|
2276
|
+
// ../../node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react-jsx-runtime.development.js
|
2277
|
+
var require_react_jsx_runtime_development = __commonJS({
|
2278
|
+
"../../node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react-jsx-runtime.development.js"(exports) {
|
2279
|
+
init_esm_shims();
|
2280
|
+
if (process.env.NODE_ENV !== "production") {
|
2281
|
+
(function() {
|
2282
|
+
var React = require_react();
|
2283
|
+
var REACT_ELEMENT_TYPE = Symbol.for("react.element");
|
2284
|
+
var REACT_PORTAL_TYPE = Symbol.for("react.portal");
|
2285
|
+
var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
2286
|
+
var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
|
2287
|
+
var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
2288
|
+
var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
|
2289
|
+
var REACT_CONTEXT_TYPE = Symbol.for("react.context");
|
2290
|
+
var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
|
2291
|
+
var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
|
2292
|
+
var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
|
2293
|
+
var REACT_MEMO_TYPE = Symbol.for("react.memo");
|
2294
|
+
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
2295
|
+
var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
|
2296
|
+
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
2297
|
+
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
2298
|
+
function getIteratorFn(maybeIterable) {
|
2299
|
+
if (maybeIterable === null || typeof maybeIterable !== "object") {
|
2300
|
+
return null;
|
2301
|
+
}
|
2302
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
2303
|
+
if (typeof maybeIterator === "function") {
|
2304
|
+
return maybeIterator;
|
2305
|
+
}
|
2306
|
+
return null;
|
2307
|
+
}
|
2308
|
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
2309
|
+
function error(format) {
|
2310
|
+
{
|
2311
|
+
{
|
2312
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
2313
|
+
args[_key2 - 1] = arguments[_key2];
|
2314
|
+
}
|
2315
|
+
printWarning("error", format, args);
|
2316
|
+
}
|
2317
|
+
}
|
2318
|
+
}
|
2319
|
+
function printWarning(level, format, args) {
|
2320
|
+
{
|
2321
|
+
var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
|
2322
|
+
var stack = ReactDebugCurrentFrame2.getStackAddendum();
|
2323
|
+
if (stack !== "") {
|
2324
|
+
format += "%s";
|
2325
|
+
args = args.concat([stack]);
|
2326
|
+
}
|
2327
|
+
var argsWithFormat = args.map(function(item) {
|
2328
|
+
return String(item);
|
2329
|
+
});
|
2330
|
+
argsWithFormat.unshift("Warning: " + format);
|
2331
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
2332
|
+
}
|
2333
|
+
}
|
2334
|
+
var enableScopeAPI = false;
|
2335
|
+
var enableCacheElement = false;
|
2336
|
+
var enableTransitionTracing = false;
|
2337
|
+
var enableLegacyHidden = false;
|
2338
|
+
var enableDebugTracing = false;
|
2339
|
+
var REACT_MODULE_REFERENCE;
|
2340
|
+
{
|
2341
|
+
REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
|
2342
|
+
}
|
2343
|
+
function isValidElementType(type) {
|
2344
|
+
if (typeof type === "string" || typeof type === "function") {
|
2345
|
+
return true;
|
2346
|
+
}
|
2347
|
+
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) {
|
2348
|
+
return true;
|
2349
|
+
}
|
2350
|
+
if (typeof type === "object" && type !== null) {
|
2351
|
+
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 || // This needs to include all possible module reference object
|
2352
|
+
// types supported by any Flight configuration anywhere since
|
2353
|
+
// we don't know which Flight build this will end up being used
|
2354
|
+
// with.
|
2355
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
|
2356
|
+
return true;
|
2357
|
+
}
|
2358
|
+
}
|
2359
|
+
return false;
|
2360
|
+
}
|
2361
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
2362
|
+
var displayName = outerType.displayName;
|
2363
|
+
if (displayName) {
|
2364
|
+
return displayName;
|
2365
|
+
}
|
2366
|
+
var functionName = innerType.displayName || innerType.name || "";
|
2367
|
+
return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
|
2368
|
+
}
|
2369
|
+
function getContextName(type) {
|
2370
|
+
return type.displayName || "Context";
|
2371
|
+
}
|
2372
|
+
function getComponentNameFromType(type) {
|
2373
|
+
if (type == null) {
|
2374
|
+
return null;
|
2375
|
+
}
|
2376
|
+
{
|
2377
|
+
if (typeof type.tag === "number") {
|
2378
|
+
error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
|
2379
|
+
}
|
2380
|
+
}
|
2381
|
+
if (typeof type === "function") {
|
2382
|
+
return type.displayName || type.name || null;
|
2383
|
+
}
|
2384
|
+
if (typeof type === "string") {
|
2385
|
+
return type;
|
2386
|
+
}
|
2387
|
+
switch (type) {
|
2388
|
+
case REACT_FRAGMENT_TYPE:
|
2389
|
+
return "Fragment";
|
2390
|
+
case REACT_PORTAL_TYPE:
|
2391
|
+
return "Portal";
|
2392
|
+
case REACT_PROFILER_TYPE:
|
2393
|
+
return "Profiler";
|
2394
|
+
case REACT_STRICT_MODE_TYPE:
|
2395
|
+
return "StrictMode";
|
2396
|
+
case REACT_SUSPENSE_TYPE:
|
2397
|
+
return "Suspense";
|
2398
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
2399
|
+
return "SuspenseList";
|
2400
|
+
}
|
2401
|
+
if (typeof type === "object") {
|
2402
|
+
switch (type.$$typeof) {
|
2403
|
+
case REACT_CONTEXT_TYPE:
|
2404
|
+
var context = type;
|
2405
|
+
return getContextName(context) + ".Consumer";
|
2406
|
+
case REACT_PROVIDER_TYPE:
|
2407
|
+
var provider = type;
|
2408
|
+
return getContextName(provider._context) + ".Provider";
|
2409
|
+
case REACT_FORWARD_REF_TYPE:
|
2410
|
+
return getWrappedName(type, type.render, "ForwardRef");
|
2411
|
+
case REACT_MEMO_TYPE:
|
2412
|
+
var outerName = type.displayName || null;
|
2413
|
+
if (outerName !== null) {
|
2414
|
+
return outerName;
|
2415
|
+
}
|
2416
|
+
return getComponentNameFromType(type.type) || "Memo";
|
2417
|
+
case REACT_LAZY_TYPE: {
|
2418
|
+
var lazyComponent = type;
|
2419
|
+
var payload = lazyComponent._payload;
|
2420
|
+
var init = lazyComponent._init;
|
2421
|
+
try {
|
2422
|
+
return getComponentNameFromType(init(payload));
|
2423
|
+
} catch (x) {
|
2424
|
+
return null;
|
2425
|
+
}
|
2426
|
+
}
|
2427
|
+
}
|
2428
|
+
}
|
2429
|
+
return null;
|
2430
|
+
}
|
2431
|
+
var assign = Object.assign;
|
2432
|
+
var disabledDepth = 0;
|
2433
|
+
var prevLog;
|
2434
|
+
var prevInfo;
|
2435
|
+
var prevWarn;
|
2436
|
+
var prevError;
|
2437
|
+
var prevGroup;
|
2438
|
+
var prevGroupCollapsed;
|
2439
|
+
var prevGroupEnd;
|
2440
|
+
function disabledLog() {
|
2441
|
+
}
|
2442
|
+
disabledLog.__reactDisabledLog = true;
|
2443
|
+
function disableLogs() {
|
2444
|
+
{
|
2445
|
+
if (disabledDepth === 0) {
|
2446
|
+
prevLog = console.log;
|
2447
|
+
prevInfo = console.info;
|
2448
|
+
prevWarn = console.warn;
|
2449
|
+
prevError = console.error;
|
2450
|
+
prevGroup = console.group;
|
2451
|
+
prevGroupCollapsed = console.groupCollapsed;
|
2452
|
+
prevGroupEnd = console.groupEnd;
|
2453
|
+
var props = {
|
2454
|
+
configurable: true,
|
2455
|
+
enumerable: true,
|
2456
|
+
value: disabledLog,
|
2457
|
+
writable: true
|
2458
|
+
};
|
2459
|
+
Object.defineProperties(console, {
|
2460
|
+
info: props,
|
2461
|
+
log: props,
|
2462
|
+
warn: props,
|
2463
|
+
error: props,
|
2464
|
+
group: props,
|
2465
|
+
groupCollapsed: props,
|
2466
|
+
groupEnd: props
|
2467
|
+
});
|
2468
|
+
}
|
2469
|
+
disabledDepth++;
|
2470
|
+
}
|
2471
|
+
}
|
2472
|
+
function reenableLogs() {
|
2473
|
+
{
|
2474
|
+
disabledDepth--;
|
2475
|
+
if (disabledDepth === 0) {
|
2476
|
+
var props = {
|
2477
|
+
configurable: true,
|
2478
|
+
enumerable: true,
|
2479
|
+
writable: true
|
2480
|
+
};
|
2481
|
+
Object.defineProperties(console, {
|
2482
|
+
log: assign({}, props, {
|
2483
|
+
value: prevLog
|
2484
|
+
}),
|
2485
|
+
info: assign({}, props, {
|
2486
|
+
value: prevInfo
|
2487
|
+
}),
|
2488
|
+
warn: assign({}, props, {
|
2489
|
+
value: prevWarn
|
2490
|
+
}),
|
2491
|
+
error: assign({}, props, {
|
2492
|
+
value: prevError
|
2493
|
+
}),
|
2494
|
+
group: assign({}, props, {
|
2495
|
+
value: prevGroup
|
2496
|
+
}),
|
2497
|
+
groupCollapsed: assign({}, props, {
|
2498
|
+
value: prevGroupCollapsed
|
2499
|
+
}),
|
2500
|
+
groupEnd: assign({}, props, {
|
2501
|
+
value: prevGroupEnd
|
2502
|
+
})
|
2503
|
+
});
|
2504
|
+
}
|
2505
|
+
if (disabledDepth < 0) {
|
2506
|
+
error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
2507
|
+
}
|
2508
|
+
}
|
2509
|
+
}
|
2510
|
+
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
2511
|
+
var prefix;
|
2512
|
+
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
2513
|
+
{
|
2514
|
+
if (prefix === void 0) {
|
2515
|
+
try {
|
2516
|
+
throw Error();
|
2517
|
+
} catch (x) {
|
2518
|
+
var match = x.stack.trim().match(/\n( *(at )?)/);
|
2519
|
+
prefix = match && match[1] || "";
|
2520
|
+
}
|
2521
|
+
}
|
2522
|
+
return "\n" + prefix + name;
|
2523
|
+
}
|
2524
|
+
}
|
2525
|
+
var reentry = false;
|
2526
|
+
var componentFrameCache;
|
2527
|
+
{
|
2528
|
+
var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
|
2529
|
+
componentFrameCache = new PossiblyWeakMap();
|
2530
|
+
}
|
2531
|
+
function describeNativeComponentFrame(fn, construct) {
|
2532
|
+
if (!fn || reentry) {
|
2533
|
+
return "";
|
2534
|
+
}
|
2535
|
+
{
|
2536
|
+
var frame = componentFrameCache.get(fn);
|
2537
|
+
if (frame !== void 0) {
|
2538
|
+
return frame;
|
2539
|
+
}
|
2540
|
+
}
|
2541
|
+
var control;
|
2542
|
+
reentry = true;
|
2543
|
+
var previousPrepareStackTrace = Error.prepareStackTrace;
|
2544
|
+
Error.prepareStackTrace = void 0;
|
2545
|
+
var previousDispatcher;
|
2546
|
+
{
|
2547
|
+
previousDispatcher = ReactCurrentDispatcher.current;
|
2548
|
+
ReactCurrentDispatcher.current = null;
|
2549
|
+
disableLogs();
|
2550
|
+
}
|
2551
|
+
try {
|
2552
|
+
if (construct) {
|
2553
|
+
var Fake = function() {
|
2554
|
+
throw Error();
|
2555
|
+
};
|
2556
|
+
Object.defineProperty(Fake.prototype, "props", {
|
2557
|
+
set: function() {
|
2558
|
+
throw Error();
|
2559
|
+
}
|
2560
|
+
});
|
2561
|
+
if (typeof Reflect === "object" && Reflect.construct) {
|
2562
|
+
try {
|
2563
|
+
Reflect.construct(Fake, []);
|
2564
|
+
} catch (x) {
|
2565
|
+
control = x;
|
2566
|
+
}
|
2567
|
+
Reflect.construct(fn, [], Fake);
|
2568
|
+
} else {
|
2569
|
+
try {
|
2570
|
+
Fake.call();
|
2571
|
+
} catch (x) {
|
2572
|
+
control = x;
|
2573
|
+
}
|
2574
|
+
fn.call(Fake.prototype);
|
2575
|
+
}
|
2576
|
+
} else {
|
2577
|
+
try {
|
2578
|
+
throw Error();
|
2579
|
+
} catch (x) {
|
2580
|
+
control = x;
|
2581
|
+
}
|
2582
|
+
fn();
|
2583
|
+
}
|
2584
|
+
} catch (sample) {
|
2585
|
+
if (sample && control && typeof sample.stack === "string") {
|
2586
|
+
var sampleLines = sample.stack.split("\n");
|
2587
|
+
var controlLines = control.stack.split("\n");
|
2588
|
+
var s = sampleLines.length - 1;
|
2589
|
+
var c = controlLines.length - 1;
|
2590
|
+
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
2591
|
+
c--;
|
2592
|
+
}
|
2593
|
+
for (; s >= 1 && c >= 0; s--, c--) {
|
2594
|
+
if (sampleLines[s] !== controlLines[c]) {
|
2595
|
+
if (s !== 1 || c !== 1) {
|
2596
|
+
do {
|
2597
|
+
s--;
|
2598
|
+
c--;
|
2599
|
+
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
2600
|
+
var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
|
2601
|
+
if (fn.displayName && _frame.includes("<anonymous>")) {
|
2602
|
+
_frame = _frame.replace("<anonymous>", fn.displayName);
|
2603
|
+
}
|
2604
|
+
{
|
2605
|
+
if (typeof fn === "function") {
|
2606
|
+
componentFrameCache.set(fn, _frame);
|
2607
|
+
}
|
2608
|
+
}
|
2609
|
+
return _frame;
|
2610
|
+
}
|
2611
|
+
} while (s >= 1 && c >= 0);
|
2612
|
+
}
|
2613
|
+
break;
|
2614
|
+
}
|
2615
|
+
}
|
2616
|
+
}
|
2617
|
+
} finally {
|
2618
|
+
reentry = false;
|
2619
|
+
{
|
2620
|
+
ReactCurrentDispatcher.current = previousDispatcher;
|
2621
|
+
reenableLogs();
|
2622
|
+
}
|
2623
|
+
Error.prepareStackTrace = previousPrepareStackTrace;
|
2624
|
+
}
|
2625
|
+
var name = fn ? fn.displayName || fn.name : "";
|
2626
|
+
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
|
2627
|
+
{
|
2628
|
+
if (typeof fn === "function") {
|
2629
|
+
componentFrameCache.set(fn, syntheticFrame);
|
2630
|
+
}
|
2631
|
+
}
|
2632
|
+
return syntheticFrame;
|
2633
|
+
}
|
2634
|
+
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
2635
|
+
{
|
2636
|
+
return describeNativeComponentFrame(fn, false);
|
2637
|
+
}
|
2638
|
+
}
|
2639
|
+
function shouldConstruct(Component) {
|
2640
|
+
var prototype = Component.prototype;
|
2641
|
+
return !!(prototype && prototype.isReactComponent);
|
2642
|
+
}
|
2643
|
+
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
2644
|
+
if (type == null) {
|
2645
|
+
return "";
|
2646
|
+
}
|
2647
|
+
if (typeof type === "function") {
|
2648
|
+
{
|
2649
|
+
return describeNativeComponentFrame(type, shouldConstruct(type));
|
2650
|
+
}
|
2651
|
+
}
|
2652
|
+
if (typeof type === "string") {
|
2653
|
+
return describeBuiltInComponentFrame(type);
|
2654
|
+
}
|
2655
|
+
switch (type) {
|
2656
|
+
case REACT_SUSPENSE_TYPE:
|
2657
|
+
return describeBuiltInComponentFrame("Suspense");
|
2658
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
2659
|
+
return describeBuiltInComponentFrame("SuspenseList");
|
2660
|
+
}
|
2661
|
+
if (typeof type === "object") {
|
2662
|
+
switch (type.$$typeof) {
|
2663
|
+
case REACT_FORWARD_REF_TYPE:
|
2664
|
+
return describeFunctionComponentFrame(type.render);
|
2665
|
+
case REACT_MEMO_TYPE:
|
2666
|
+
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
2667
|
+
case REACT_LAZY_TYPE: {
|
2668
|
+
var lazyComponent = type;
|
2669
|
+
var payload = lazyComponent._payload;
|
2670
|
+
var init = lazyComponent._init;
|
2671
|
+
try {
|
2672
|
+
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
2673
|
+
} catch (x) {
|
2674
|
+
}
|
2675
|
+
}
|
2676
|
+
}
|
2677
|
+
}
|
2678
|
+
return "";
|
2679
|
+
}
|
2680
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
2681
|
+
var loggedTypeFailures = {};
|
2682
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
2683
|
+
function setCurrentlyValidatingElement(element) {
|
2684
|
+
{
|
2685
|
+
if (element) {
|
2686
|
+
var owner = element._owner;
|
2687
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
2688
|
+
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
2689
|
+
} else {
|
2690
|
+
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
2691
|
+
}
|
2692
|
+
}
|
2693
|
+
}
|
2694
|
+
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
2695
|
+
{
|
2696
|
+
var has = Function.call.bind(hasOwnProperty);
|
2697
|
+
for (var typeSpecName in typeSpecs) {
|
2698
|
+
if (has(typeSpecs, typeSpecName)) {
|
2699
|
+
var error$1 = void 0;
|
2700
|
+
try {
|
2701
|
+
if (typeof typeSpecs[typeSpecName] !== "function") {
|
2702
|
+
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`.");
|
2703
|
+
err.name = "Invariant Violation";
|
2704
|
+
throw err;
|
2705
|
+
}
|
2706
|
+
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
2707
|
+
} catch (ex) {
|
2708
|
+
error$1 = ex;
|
2709
|
+
}
|
2710
|
+
if (error$1 && !(error$1 instanceof Error)) {
|
2711
|
+
setCurrentlyValidatingElement(element);
|
2712
|
+
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);
|
2713
|
+
setCurrentlyValidatingElement(null);
|
2714
|
+
}
|
2715
|
+
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
2716
|
+
loggedTypeFailures[error$1.message] = true;
|
2717
|
+
setCurrentlyValidatingElement(element);
|
2718
|
+
error("Failed %s type: %s", location, error$1.message);
|
2719
|
+
setCurrentlyValidatingElement(null);
|
2720
|
+
}
|
2721
|
+
}
|
2722
|
+
}
|
2723
|
+
}
|
2724
|
+
}
|
2725
|
+
var isArrayImpl = Array.isArray;
|
2726
|
+
function isArray(a) {
|
2727
|
+
return isArrayImpl(a);
|
2728
|
+
}
|
2729
|
+
function typeName(value) {
|
2730
|
+
{
|
2731
|
+
var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
|
2732
|
+
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
2733
|
+
return type;
|
2734
|
+
}
|
2735
|
+
}
|
2736
|
+
function willCoercionThrow(value) {
|
2737
|
+
{
|
2738
|
+
try {
|
2739
|
+
testStringCoercion(value);
|
2740
|
+
return false;
|
2741
|
+
} catch (e) {
|
2742
|
+
return true;
|
2743
|
+
}
|
2744
|
+
}
|
2745
|
+
}
|
2746
|
+
function testStringCoercion(value) {
|
2747
|
+
return "" + value;
|
2748
|
+
}
|
2749
|
+
function checkKeyStringCoercion(value) {
|
2750
|
+
{
|
2751
|
+
if (willCoercionThrow(value)) {
|
2752
|
+
error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
|
2753
|
+
return testStringCoercion(value);
|
2754
|
+
}
|
2755
|
+
}
|
2756
|
+
}
|
2757
|
+
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
2758
|
+
var RESERVED_PROPS = {
|
2759
|
+
key: true,
|
2760
|
+
ref: true,
|
2761
|
+
__self: true,
|
2762
|
+
__source: true
|
2763
|
+
};
|
2764
|
+
var specialPropKeyWarningShown;
|
2765
|
+
var specialPropRefWarningShown;
|
2766
|
+
var didWarnAboutStringRefs;
|
2767
|
+
{
|
2768
|
+
didWarnAboutStringRefs = {};
|
2769
|
+
}
|
2770
|
+
function hasValidRef(config) {
|
2771
|
+
{
|
2772
|
+
if (hasOwnProperty.call(config, "ref")) {
|
2773
|
+
var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
|
2774
|
+
if (getter && getter.isReactWarning) {
|
2775
|
+
return false;
|
2776
|
+
}
|
2777
|
+
}
|
2778
|
+
}
|
2779
|
+
return config.ref !== void 0;
|
2780
|
+
}
|
2781
|
+
function hasValidKey(config) {
|
2782
|
+
{
|
2783
|
+
if (hasOwnProperty.call(config, "key")) {
|
2784
|
+
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
2785
|
+
if (getter && getter.isReactWarning) {
|
2786
|
+
return false;
|
2787
|
+
}
|
2788
|
+
}
|
2789
|
+
}
|
2790
|
+
return config.key !== void 0;
|
2791
|
+
}
|
2792
|
+
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
2793
|
+
{
|
2794
|
+
if (typeof config.ref === "string" && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
|
2795
|
+
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
2796
|
+
if (!didWarnAboutStringRefs[componentName]) {
|
2797
|
+
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', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
|
2798
|
+
didWarnAboutStringRefs[componentName] = true;
|
2799
|
+
}
|
2800
|
+
}
|
2801
|
+
}
|
2802
|
+
}
|
2803
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
2804
|
+
{
|
2805
|
+
var warnAboutAccessingKey = function() {
|
2806
|
+
if (!specialPropKeyWarningShown) {
|
2807
|
+
specialPropKeyWarningShown = true;
|
2808
|
+
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);
|
2809
|
+
}
|
2810
|
+
};
|
2811
|
+
warnAboutAccessingKey.isReactWarning = true;
|
2812
|
+
Object.defineProperty(props, "key", {
|
2813
|
+
get: warnAboutAccessingKey,
|
2814
|
+
configurable: true
|
2815
|
+
});
|
2816
|
+
}
|
2817
|
+
}
|
2818
|
+
function defineRefPropWarningGetter(props, displayName) {
|
2819
|
+
{
|
2820
|
+
var warnAboutAccessingRef = function() {
|
2821
|
+
if (!specialPropRefWarningShown) {
|
2822
|
+
specialPropRefWarningShown = true;
|
2823
|
+
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);
|
2824
|
+
}
|
2825
|
+
};
|
2826
|
+
warnAboutAccessingRef.isReactWarning = true;
|
2827
|
+
Object.defineProperty(props, "ref", {
|
2828
|
+
get: warnAboutAccessingRef,
|
2829
|
+
configurable: true
|
2830
|
+
});
|
2831
|
+
}
|
2832
|
+
}
|
2833
|
+
var ReactElement = function(type, key, ref, self, source, owner, props) {
|
2834
|
+
var element = {
|
2835
|
+
// This tag allows us to uniquely identify this as a React Element
|
2836
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
2837
|
+
// Built-in properties that belong on the element
|
2838
|
+
type,
|
2839
|
+
key,
|
2840
|
+
ref,
|
2841
|
+
props,
|
2842
|
+
// Record the component responsible for creating this element.
|
2843
|
+
_owner: owner
|
2844
|
+
};
|
2845
|
+
{
|
2846
|
+
element._store = {};
|
2847
|
+
Object.defineProperty(element._store, "validated", {
|
2848
|
+
configurable: false,
|
2849
|
+
enumerable: false,
|
2850
|
+
writable: true,
|
2851
|
+
value: false
|
2852
|
+
});
|
2853
|
+
Object.defineProperty(element, "_self", {
|
2854
|
+
configurable: false,
|
2855
|
+
enumerable: false,
|
2856
|
+
writable: false,
|
2857
|
+
value: self
|
2858
|
+
});
|
2859
|
+
Object.defineProperty(element, "_source", {
|
2860
|
+
configurable: false,
|
2861
|
+
enumerable: false,
|
2862
|
+
writable: false,
|
2863
|
+
value: source
|
2864
|
+
});
|
2865
|
+
if (Object.freeze) {
|
2866
|
+
Object.freeze(element.props);
|
2867
|
+
Object.freeze(element);
|
2868
|
+
}
|
2869
|
+
}
|
2870
|
+
return element;
|
2871
|
+
};
|
2872
|
+
function jsxDEV(type, config, maybeKey, source, self) {
|
2873
|
+
{
|
2874
|
+
var propName;
|
2875
|
+
var props = {};
|
2876
|
+
var key = null;
|
2877
|
+
var ref = null;
|
2878
|
+
if (maybeKey !== void 0) {
|
2879
|
+
{
|
2880
|
+
checkKeyStringCoercion(maybeKey);
|
2881
|
+
}
|
2882
|
+
key = "" + maybeKey;
|
2883
|
+
}
|
2884
|
+
if (hasValidKey(config)) {
|
2885
|
+
{
|
2886
|
+
checkKeyStringCoercion(config.key);
|
2887
|
+
}
|
2888
|
+
key = "" + config.key;
|
2889
|
+
}
|
2890
|
+
if (hasValidRef(config)) {
|
2891
|
+
ref = config.ref;
|
2892
|
+
warnIfStringRefCannotBeAutoConverted(config, self);
|
2893
|
+
}
|
2894
|
+
for (propName in config) {
|
2895
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
2896
|
+
props[propName] = config[propName];
|
2897
|
+
}
|
2898
|
+
}
|
2899
|
+
if (type && type.defaultProps) {
|
2900
|
+
var defaultProps = type.defaultProps;
|
2901
|
+
for (propName in defaultProps) {
|
2902
|
+
if (props[propName] === void 0) {
|
2903
|
+
props[propName] = defaultProps[propName];
|
2904
|
+
}
|
2905
|
+
}
|
2906
|
+
}
|
2907
|
+
if (key || ref) {
|
2908
|
+
var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
|
2909
|
+
if (key) {
|
2910
|
+
defineKeyPropWarningGetter(props, displayName);
|
2911
|
+
}
|
2912
|
+
if (ref) {
|
2913
|
+
defineRefPropWarningGetter(props, displayName);
|
2914
|
+
}
|
2915
|
+
}
|
2916
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
2917
|
+
}
|
2918
|
+
}
|
2919
|
+
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
2920
|
+
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
2921
|
+
function setCurrentlyValidatingElement$1(element) {
|
2922
|
+
{
|
2923
|
+
if (element) {
|
2924
|
+
var owner = element._owner;
|
2925
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
2926
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
2927
|
+
} else {
|
2928
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
2929
|
+
}
|
2930
|
+
}
|
2931
|
+
}
|
2932
|
+
var propTypesMisspellWarningShown;
|
2933
|
+
{
|
2934
|
+
propTypesMisspellWarningShown = false;
|
2935
|
+
}
|
2936
|
+
function isValidElement(object) {
|
2937
|
+
{
|
2938
|
+
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
2939
|
+
}
|
2940
|
+
}
|
2941
|
+
function getDeclarationErrorAddendum() {
|
2942
|
+
{
|
2943
|
+
if (ReactCurrentOwner$1.current) {
|
2944
|
+
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
2945
|
+
if (name) {
|
2946
|
+
return "\n\nCheck the render method of `" + name + "`.";
|
2947
|
+
}
|
2948
|
+
}
|
2949
|
+
return "";
|
2950
|
+
}
|
2951
|
+
}
|
2952
|
+
function getSourceInfoErrorAddendum(source) {
|
2953
|
+
{
|
2954
|
+
if (source !== void 0) {
|
2955
|
+
var fileName = source.fileName.replace(/^.*[\\\/]/, "");
|
2956
|
+
var lineNumber = source.lineNumber;
|
2957
|
+
return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
|
2958
|
+
}
|
2959
|
+
return "";
|
2960
|
+
}
|
2961
|
+
}
|
2962
|
+
var ownerHasKeyUseWarning = {};
|
2963
|
+
function getCurrentComponentErrorInfo(parentType) {
|
2964
|
+
{
|
2965
|
+
var info = getDeclarationErrorAddendum();
|
2966
|
+
if (!info) {
|
2967
|
+
var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
|
2968
|
+
if (parentName) {
|
2969
|
+
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
2970
|
+
}
|
2971
|
+
}
|
2972
|
+
return info;
|
2973
|
+
}
|
2974
|
+
}
|
2975
|
+
function validateExplicitKey(element, parentType) {
|
2976
|
+
{
|
2977
|
+
if (!element._store || element._store.validated || element.key != null) {
|
2978
|
+
return;
|
2979
|
+
}
|
2980
|
+
element._store.validated = true;
|
2981
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
2982
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
2983
|
+
return;
|
2984
|
+
}
|
2985
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
2986
|
+
var childOwner = "";
|
2987
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
2988
|
+
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
2989
|
+
}
|
2990
|
+
setCurrentlyValidatingElement$1(element);
|
2991
|
+
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);
|
2992
|
+
setCurrentlyValidatingElement$1(null);
|
2993
|
+
}
|
2994
|
+
}
|
2995
|
+
function validateChildKeys(node, parentType) {
|
2996
|
+
{
|
2997
|
+
if (typeof node !== "object") {
|
2998
|
+
return;
|
2999
|
+
}
|
3000
|
+
if (isArray(node)) {
|
3001
|
+
for (var i = 0; i < node.length; i++) {
|
3002
|
+
var child = node[i];
|
3003
|
+
if (isValidElement(child)) {
|
3004
|
+
validateExplicitKey(child, parentType);
|
3005
|
+
}
|
3006
|
+
}
|
3007
|
+
} else if (isValidElement(node)) {
|
3008
|
+
if (node._store) {
|
3009
|
+
node._store.validated = true;
|
3010
|
+
}
|
3011
|
+
} else if (node) {
|
3012
|
+
var iteratorFn = getIteratorFn(node);
|
3013
|
+
if (typeof iteratorFn === "function") {
|
3014
|
+
if (iteratorFn !== node.entries) {
|
3015
|
+
var iterator = iteratorFn.call(node);
|
3016
|
+
var step;
|
3017
|
+
while (!(step = iterator.next()).done) {
|
3018
|
+
if (isValidElement(step.value)) {
|
3019
|
+
validateExplicitKey(step.value, parentType);
|
3020
|
+
}
|
3021
|
+
}
|
3022
|
+
}
|
3023
|
+
}
|
3024
|
+
}
|
3025
|
+
}
|
3026
|
+
}
|
3027
|
+
function validatePropTypes(element) {
|
3028
|
+
{
|
3029
|
+
var type = element.type;
|
3030
|
+
if (type === null || type === void 0 || typeof type === "string") {
|
3031
|
+
return;
|
3032
|
+
}
|
3033
|
+
var propTypes;
|
3034
|
+
if (typeof type === "function") {
|
3035
|
+
propTypes = type.propTypes;
|
3036
|
+
} else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
3037
|
+
// Inner props are checked in the reconciler.
|
3038
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
3039
|
+
propTypes = type.propTypes;
|
3040
|
+
} else {
|
3041
|
+
return;
|
3042
|
+
}
|
3043
|
+
if (propTypes) {
|
3044
|
+
var name = getComponentNameFromType(type);
|
3045
|
+
checkPropTypes(propTypes, element.props, "prop", name, element);
|
3046
|
+
} else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
|
3047
|
+
propTypesMisspellWarningShown = true;
|
3048
|
+
var _name = getComponentNameFromType(type);
|
3049
|
+
error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
|
3050
|
+
}
|
3051
|
+
if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
|
3052
|
+
error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
3053
|
+
}
|
3054
|
+
}
|
3055
|
+
}
|
3056
|
+
function validateFragmentProps(fragment) {
|
3057
|
+
{
|
3058
|
+
var keys = Object.keys(fragment.props);
|
3059
|
+
for (var i = 0; i < keys.length; i++) {
|
3060
|
+
var key = keys[i];
|
3061
|
+
if (key !== "children" && key !== "key") {
|
3062
|
+
setCurrentlyValidatingElement$1(fragment);
|
3063
|
+
error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
|
3064
|
+
setCurrentlyValidatingElement$1(null);
|
3065
|
+
break;
|
3066
|
+
}
|
3067
|
+
}
|
3068
|
+
if (fragment.ref !== null) {
|
3069
|
+
setCurrentlyValidatingElement$1(fragment);
|
3070
|
+
error("Invalid attribute `ref` supplied to `React.Fragment`.");
|
3071
|
+
setCurrentlyValidatingElement$1(null);
|
3072
|
+
}
|
3073
|
+
}
|
3074
|
+
}
|
3075
|
+
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
3076
|
+
{
|
3077
|
+
var validType = isValidElementType(type);
|
3078
|
+
if (!validType) {
|
3079
|
+
var info = "";
|
3080
|
+
if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
|
3081
|
+
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.";
|
3082
|
+
}
|
3083
|
+
var sourceInfo = getSourceInfoErrorAddendum(source);
|
3084
|
+
if (sourceInfo) {
|
3085
|
+
info += sourceInfo;
|
3086
|
+
} else {
|
3087
|
+
info += getDeclarationErrorAddendum();
|
3088
|
+
}
|
3089
|
+
var typeString;
|
3090
|
+
if (type === null) {
|
3091
|
+
typeString = "null";
|
3092
|
+
} else if (isArray(type)) {
|
3093
|
+
typeString = "array";
|
3094
|
+
} else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
|
3095
|
+
typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
|
3096
|
+
info = " Did you accidentally export a JSX literal instead of a component?";
|
3097
|
+
} else {
|
3098
|
+
typeString = typeof type;
|
3099
|
+
}
|
3100
|
+
error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
|
3101
|
+
}
|
3102
|
+
var element = jsxDEV(type, props, key, source, self);
|
3103
|
+
if (element == null) {
|
3104
|
+
return element;
|
3105
|
+
}
|
3106
|
+
if (validType) {
|
3107
|
+
var children = props.children;
|
3108
|
+
if (children !== void 0) {
|
3109
|
+
if (isStaticChildren) {
|
3110
|
+
if (isArray(children)) {
|
3111
|
+
for (var i = 0; i < children.length; i++) {
|
3112
|
+
validateChildKeys(children[i], type);
|
3113
|
+
}
|
3114
|
+
if (Object.freeze) {
|
3115
|
+
Object.freeze(children);
|
3116
|
+
}
|
3117
|
+
} else {
|
3118
|
+
error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
3119
|
+
}
|
3120
|
+
} else {
|
3121
|
+
validateChildKeys(children, type);
|
3122
|
+
}
|
3123
|
+
}
|
3124
|
+
}
|
3125
|
+
if (type === REACT_FRAGMENT_TYPE) {
|
3126
|
+
validateFragmentProps(element);
|
3127
|
+
} else {
|
3128
|
+
validatePropTypes(element);
|
3129
|
+
}
|
3130
|
+
return element;
|
3131
|
+
}
|
3132
|
+
}
|
3133
|
+
function jsxWithValidationStatic(type, props, key) {
|
3134
|
+
{
|
3135
|
+
return jsxWithValidation(type, props, key, true);
|
3136
|
+
}
|
3137
|
+
}
|
3138
|
+
function jsxWithValidationDynamic(type, props, key) {
|
3139
|
+
{
|
3140
|
+
return jsxWithValidation(type, props, key, false);
|
3141
|
+
}
|
3142
|
+
}
|
3143
|
+
var jsx4 = jsxWithValidationDynamic;
|
3144
|
+
var jsxs3 = jsxWithValidationStatic;
|
3145
|
+
exports.Fragment = REACT_FRAGMENT_TYPE;
|
3146
|
+
exports.jsx = jsx4;
|
3147
|
+
exports.jsxs = jsxs3;
|
3148
|
+
})();
|
3149
|
+
}
|
3150
|
+
}
|
3151
|
+
});
|
3152
|
+
|
3153
|
+
// ../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js
|
3154
|
+
var require_jsx_runtime = __commonJS({
|
3155
|
+
"../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js"(exports, module) {
|
3156
|
+
init_esm_shims();
|
3157
|
+
if (process.env.NODE_ENV === "production") {
|
3158
|
+
module.exports = require_react_jsx_runtime_production_min();
|
3159
|
+
} else {
|
3160
|
+
module.exports = require_react_jsx_runtime_development();
|
3161
|
+
}
|
3162
|
+
}
|
3163
|
+
});
|
3164
|
+
|
3165
|
+
// src/index.ts
|
3166
|
+
init_esm_shims();
|
3167
|
+
|
3168
|
+
// src/plugin.ts
|
3169
|
+
init_esm_shims();
|
3170
|
+
|
3171
|
+
// src/OperationGenerator.tsx
|
3172
|
+
init_esm_shims();
|
3173
|
+
|
3174
|
+
// src/components/Mutation.tsx
|
3175
|
+
init_esm_shims();
|
3176
|
+
|
3177
|
+
// src/TypeBuilder.ts
|
3178
|
+
init_esm_shims();
|
3179
|
+
|
3180
|
+
// src/TypeGenerator.ts
|
3181
|
+
init_esm_shims();
|
3182
|
+
var _usedAliasNames, _getTypeFromProperties, getTypeFromProperties_fn, _getRefAlias, getRefAlias_fn, _getParsedSchema, getParsedSchema_fn, _getBaseTypeFromSchema, getBaseTypeFromSchema_fn;
|
3183
|
+
var TypeGenerator = class extends Generator {
|
3184
|
+
constructor() {
|
3185
|
+
super(...arguments);
|
40
3186
|
/**
|
41
3187
|
* Recursively creates a type literal with the given props.
|
42
3188
|
*/
|
@@ -52,15 +3198,11 @@ var TypeGenerator = class extends SchemaGenerator {
|
|
52
3198
|
*/
|
53
3199
|
__privateAdd(this, _getBaseTypeFromSchema);
|
54
3200
|
this.refs = {};
|
3201
|
+
this.imports = [];
|
55
3202
|
this.extraNodes = [];
|
56
3203
|
this.aliases = [];
|
57
3204
|
// Keep track of already used type aliases
|
58
3205
|
__privateAdd(this, _usedAliasNames, {});
|
59
|
-
__privateAdd(this, _caseOptions, {
|
60
|
-
delimiter: "",
|
61
|
-
stripRegexp: /[^A-Z0-9$]/gi
|
62
|
-
});
|
63
|
-
return this;
|
64
3206
|
}
|
65
3207
|
build({
|
66
3208
|
schema,
|
@@ -69,20 +3211,20 @@ var TypeGenerator = class extends SchemaGenerator {
|
|
69
3211
|
keysToOmit
|
70
3212
|
}) {
|
71
3213
|
const nodes = [];
|
72
|
-
const type =
|
3214
|
+
const type = this.getTypeFromSchema(schema, baseName);
|
73
3215
|
if (!type) {
|
74
3216
|
return this.extraNodes;
|
75
3217
|
}
|
76
3218
|
const node = factory.createTypeAliasDeclaration({
|
77
3219
|
modifiers: [factory.modifiers.export],
|
78
|
-
name: this.
|
3220
|
+
name: this.context.pluginManager.resolveName({ name: baseName, pluginKey, type: "type" }),
|
79
3221
|
type: keysToOmit?.length ? factory.createOmitDeclaration({ keys: keysToOmit, type, nonNullable: true }) : type
|
80
3222
|
});
|
81
3223
|
if (description) {
|
82
3224
|
nodes.push(
|
83
3225
|
factory.appendJSDocToNode({
|
84
3226
|
node,
|
85
|
-
comments: [`@description ${description}`]
|
3227
|
+
comments: [`@description ${transformers.trim(description)}`]
|
86
3228
|
})
|
87
3229
|
);
|
88
3230
|
} else {
|
@@ -95,20 +3237,23 @@ var TypeGenerator = class extends SchemaGenerator {
|
|
95
3237
|
);
|
96
3238
|
return [...this.extraNodes, ...filterdNodes];
|
97
3239
|
}
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
3240
|
+
/**
|
3241
|
+
* Creates a type node from a given schema.
|
3242
|
+
* Delegates to getBaseTypeFromSchema internally and
|
3243
|
+
* optionally adds a union with null.
|
3244
|
+
*/
|
3245
|
+
getTypeFromSchema(schema, name) {
|
3246
|
+
const type = __privateMethod(this, _getBaseTypeFromSchema, getBaseTypeFromSchema_fn).call(this, schema, name);
|
3247
|
+
if (!type) {
|
3248
|
+
return null;
|
3249
|
+
}
|
3250
|
+
if (schema && !schema.nullable) {
|
3251
|
+
return type;
|
3252
|
+
}
|
3253
|
+
return factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.null] });
|
109
3254
|
}
|
110
|
-
return factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.null] });
|
111
3255
|
};
|
3256
|
+
_usedAliasNames = new WeakMap();
|
112
3257
|
_getTypeFromProperties = new WeakSet();
|
113
3258
|
getTypeFromProperties_fn = function(baseSchema, baseName) {
|
114
3259
|
const { optionalType } = this.options;
|
@@ -118,7 +3263,7 @@ getTypeFromProperties_fn = function(baseSchema, baseName) {
|
|
118
3263
|
const members = Object.keys(properties).map((name) => {
|
119
3264
|
const schema = properties[name];
|
120
3265
|
const isRequired = Array.isArray(required) ? required.includes(name) : !!required;
|
121
|
-
let type =
|
3266
|
+
let type = this.getTypeFromSchema(schema, this.context.pluginManager.resolveName({ name: `${baseName || ""} ${name}`, pluginKey, type: "type" }));
|
122
3267
|
if (!type) {
|
123
3268
|
return null;
|
124
3269
|
}
|
@@ -131,23 +3276,20 @@ getTypeFromProperties_fn = function(baseSchema, baseName) {
|
|
131
3276
|
type,
|
132
3277
|
readOnly: schema.readOnly
|
133
3278
|
});
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
});
|
146
|
-
}
|
147
|
-
return propertySignature;
|
3279
|
+
return factory.appendJSDocToNode({
|
3280
|
+
node: propertySignature,
|
3281
|
+
comments: [
|
3282
|
+
schema.description ? `@description ${schema.description}` : void 0,
|
3283
|
+
schema.type ? `@type ${schema.type?.toString()}${isRequired ? "" : " | undefined"} ${schema.format || ""}` : void 0,
|
3284
|
+
schema.example ? `@example ${schema.example}` : void 0,
|
3285
|
+
schema.deprecated ? `@deprecated` : void 0,
|
3286
|
+
schema.default !== void 0 && typeof schema.default === "string" ? `@default '${schema.default}'` : void 0,
|
3287
|
+
schema.default !== void 0 && typeof schema.default !== "string" ? `@default ${schema.default}` : void 0
|
3288
|
+
].filter(Boolean)
|
3289
|
+
});
|
148
3290
|
});
|
149
3291
|
if (additionalProperties) {
|
150
|
-
const type = additionalProperties === true ? factory.keywordTypeNodes.any :
|
3292
|
+
const type = additionalProperties === true ? factory.keywordTypeNodes.any : this.getTypeFromSchema(additionalProperties);
|
151
3293
|
if (type) {
|
152
3294
|
members.push(factory.createIndexSignature(type));
|
153
3295
|
}
|
@@ -162,16 +3304,22 @@ getRefAlias_fn = function(obj, _baseName) {
|
|
162
3304
|
return factory.createTypeReferenceNode(ref.propertyName, void 0);
|
163
3305
|
}
|
164
3306
|
const originalName = getUniqueName($ref.replace(/.+\//, ""), __privateGet(this, _usedAliasNames));
|
165
|
-
const propertyName = this.
|
3307
|
+
const propertyName = this.context.pluginManager.resolveName({ name: originalName, pluginKey, type: "type" });
|
166
3308
|
ref = this.refs[$ref] = {
|
167
3309
|
propertyName,
|
168
3310
|
originalName
|
169
3311
|
};
|
3312
|
+
const path2 = this.context.pluginManager.resolvePath({ baseName: propertyName, pluginKey });
|
3313
|
+
this.imports.push({
|
3314
|
+
ref,
|
3315
|
+
path: path2 || "",
|
3316
|
+
isTypeOnly: true
|
3317
|
+
});
|
170
3318
|
return factory.createTypeReferenceNode(ref.propertyName, void 0);
|
171
3319
|
};
|
172
3320
|
_getParsedSchema = new WeakSet();
|
173
3321
|
getParsedSchema_fn = function(schema) {
|
174
|
-
const parsedSchema = getSchemaFactory(this.
|
3322
|
+
const parsedSchema = getSchemaFactory(this.context.oas)(schema);
|
175
3323
|
return parsedSchema;
|
176
3324
|
};
|
177
3325
|
_getBaseTypeFromSchema = new WeakSet();
|
@@ -188,14 +3336,14 @@ getBaseTypeFromSchema_fn = function(_schema, baseName) {
|
|
188
3336
|
const union = factory.createUnionDeclaration({
|
189
3337
|
withParentheses: true,
|
190
3338
|
nodes: schema.oneOf.map((item) => {
|
191
|
-
return item &&
|
3339
|
+
return item && this.getTypeFromSchema(item);
|
192
3340
|
}).filter((item) => {
|
193
3341
|
return item && item !== factory.keywordTypeNodes.any;
|
194
3342
|
})
|
195
3343
|
});
|
196
3344
|
if (schemaWithoutOneOf.properties) {
|
197
3345
|
return factory.createIntersectionDeclaration({
|
198
|
-
nodes: [
|
3346
|
+
nodes: [this.getTypeFromSchema(schemaWithoutOneOf, baseName), union].filter(Boolean)
|
199
3347
|
});
|
200
3348
|
}
|
201
3349
|
return union;
|
@@ -205,14 +3353,14 @@ getBaseTypeFromSchema_fn = function(_schema, baseName) {
|
|
205
3353
|
const union = factory.createUnionDeclaration({
|
206
3354
|
withParentheses: true,
|
207
3355
|
nodes: schema.anyOf.map((item) => {
|
208
|
-
return item &&
|
3356
|
+
return item && this.getTypeFromSchema(item);
|
209
3357
|
}).filter((item) => {
|
210
3358
|
return item && item !== factory.keywordTypeNodes.any;
|
211
3359
|
})
|
212
3360
|
});
|
213
3361
|
if (schemaWithoutAnyOf.properties) {
|
214
3362
|
return factory.createIntersectionDeclaration({
|
215
|
-
nodes: [
|
3363
|
+
nodes: [this.getTypeFromSchema(schemaWithoutAnyOf, baseName), union].filter(Boolean)
|
216
3364
|
});
|
217
3365
|
}
|
218
3366
|
return union;
|
@@ -222,14 +3370,14 @@ getBaseTypeFromSchema_fn = function(_schema, baseName) {
|
|
222
3370
|
const and = factory.createIntersectionDeclaration({
|
223
3371
|
withParentheses: true,
|
224
3372
|
nodes: schema.allOf.map((item) => {
|
225
|
-
return item &&
|
3373
|
+
return item && this.getTypeFromSchema(item);
|
226
3374
|
}).filter((item) => {
|
227
3375
|
return item && item !== factory.keywordTypeNodes.any;
|
228
3376
|
})
|
229
3377
|
});
|
230
3378
|
if (schemaWithoutAllOf.properties) {
|
231
3379
|
return factory.createIntersectionDeclaration({
|
232
|
-
nodes: [
|
3380
|
+
nodes: [this.getTypeFromSchema(schemaWithoutAllOf, baseName), and].filter(Boolean)
|
233
3381
|
});
|
234
3382
|
}
|
235
3383
|
return and;
|
@@ -244,13 +3392,13 @@ getBaseTypeFromSchema_fn = function(_schema, baseName) {
|
|
244
3392
|
}
|
245
3393
|
this.extraNodes.push(
|
246
3394
|
...factory.createEnumDeclaration({
|
247
|
-
name: camelCase(enumName
|
248
|
-
typeName: this.
|
3395
|
+
name: transformers.camelCase(enumName),
|
3396
|
+
typeName: this.context.pluginManager.resolveName({ name: enumName, pluginKey, type: "type" }),
|
249
3397
|
enums,
|
250
3398
|
type: this.options.enumType
|
251
3399
|
})
|
252
3400
|
);
|
253
|
-
return factory.createTypeReferenceNode(this.
|
3401
|
+
return factory.createTypeReferenceNode(this.context.pluginManager.resolveName({ name: enumName, pluginKey, type: "type" }), void 0);
|
254
3402
|
}
|
255
3403
|
if (schema.enum) {
|
256
3404
|
return factory.createUnionDeclaration({
|
@@ -260,7 +3408,7 @@ getBaseTypeFromSchema_fn = function(_schema, baseName) {
|
|
260
3408
|
});
|
261
3409
|
}
|
262
3410
|
if ("items" in schema) {
|
263
|
-
const node =
|
3411
|
+
const node = this.getTypeFromSchema(schema.items, baseName);
|
264
3412
|
if (node) {
|
265
3413
|
return factory.createArrayTypeNode(node);
|
266
3414
|
}
|
@@ -269,7 +3417,7 @@ getBaseTypeFromSchema_fn = function(_schema, baseName) {
|
|
269
3417
|
const prefixItems = schema.prefixItems;
|
270
3418
|
return factory.createTupleDeclaration({
|
271
3419
|
nodes: prefixItems.map((item) => {
|
272
|
-
return
|
3420
|
+
return this.getTypeFromSchema(item, void 0);
|
273
3421
|
})
|
274
3422
|
});
|
275
3423
|
}
|
@@ -281,10 +3429,13 @@ getBaseTypeFromSchema_fn = function(_schema, baseName) {
|
|
281
3429
|
const [type, nullable] = schema.type;
|
282
3430
|
return factory.createUnionDeclaration({
|
283
3431
|
nodes: [
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
3432
|
+
this.getTypeFromSchema(
|
3433
|
+
{
|
3434
|
+
...schema,
|
3435
|
+
type
|
3436
|
+
},
|
3437
|
+
baseName
|
3438
|
+
),
|
288
3439
|
nullable ? factory.createLiteralTypeNode(factory.createNull()) : void 0
|
289
3440
|
].filter(Boolean)
|
290
3441
|
});
|
@@ -305,35 +3456,20 @@ getBaseTypeFromSchema_fn = function(_schema, baseName) {
|
|
305
3456
|
return factory.keywordTypeNodes.any;
|
306
3457
|
};
|
307
3458
|
|
308
|
-
// src/
|
3459
|
+
// src/TypeBuilder.ts
|
309
3460
|
var TypeBuilder = class extends OasBuilder {
|
310
|
-
|
311
|
-
|
312
|
-
this.options = options;
|
313
|
-
}
|
314
|
-
if (this.options.fileResolver) {
|
315
|
-
this.options.withImports = true;
|
316
|
-
}
|
317
|
-
return this;
|
318
|
-
}
|
319
|
-
print(name) {
|
3461
|
+
build(name) {
|
3462
|
+
const importMeta = [];
|
320
3463
|
const codes = [];
|
321
3464
|
const generated = this.items.filter((operationSchema) => name ? operationSchema.name === name : true).sort(transformers.nameSorter).map((operationSchema) => {
|
322
|
-
const generator = new TypeGenerator(
|
323
|
-
usedEnumNames: this.options.usedEnumNames,
|
324
|
-
withJSDocs: this.options.withJSDocs,
|
325
|
-
resolveName: this.options.resolveName,
|
326
|
-
enumType: this.options.enumType,
|
327
|
-
dateType: this.options.dateType,
|
328
|
-
optionalType: this.options.optionalType,
|
329
|
-
oas: this.options.oas
|
330
|
-
});
|
3465
|
+
const generator = new TypeGenerator(this.options, this.context);
|
331
3466
|
const sources = generator.build({
|
332
3467
|
schema: operationSchema.schema,
|
333
3468
|
baseName: operationSchema.name,
|
334
3469
|
description: operationSchema.description,
|
335
3470
|
keysToOmit: operationSchema.keysToOmit
|
336
3471
|
});
|
3472
|
+
importMeta.push(...generator.imports);
|
337
3473
|
return {
|
338
3474
|
import: {
|
339
3475
|
refs: generator.refs,
|
@@ -345,119 +3481,118 @@ var TypeBuilder = class extends OasBuilder {
|
|
345
3481
|
generated.forEach((item) => {
|
346
3482
|
codes.push(print(item.sources));
|
347
3483
|
});
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
name: [{ propertyName: item.ref.propertyName }],
|
355
|
-
path: item.path,
|
356
|
-
isTypeOnly: true
|
357
|
-
});
|
358
|
-
});
|
359
|
-
codes.unshift(print(nodes));
|
360
|
-
}
|
361
|
-
}
|
362
|
-
return transformers.combineCodes(codes);
|
363
|
-
}
|
364
|
-
};
|
365
|
-
var _printCombinedSchema, printCombinedSchema_fn;
|
366
|
-
var OperationGenerator = class extends OperationGenerator$1 {
|
367
|
-
constructor() {
|
368
|
-
super(...arguments);
|
369
|
-
__privateAdd(this, _printCombinedSchema);
|
370
|
-
}
|
371
|
-
resolve(operation) {
|
372
|
-
const { pluginManager, plugin } = this.context;
|
373
|
-
return resolve({
|
374
|
-
operation,
|
375
|
-
resolveName: pluginManager.resolveName,
|
376
|
-
resolvePath: pluginManager.resolvePath,
|
377
|
-
pluginKey: plugin?.key
|
3484
|
+
const imports = importMeta.map((item) => {
|
3485
|
+
return {
|
3486
|
+
name: [item.ref.propertyName],
|
3487
|
+
path: item.path,
|
3488
|
+
isTypeOnly: item.isTypeOnly
|
3489
|
+
};
|
378
3490
|
});
|
379
|
-
}
|
380
|
-
async all() {
|
381
|
-
return null;
|
382
|
-
}
|
383
|
-
async get(operation, schemas, options) {
|
384
|
-
const { mode, enumType, dateType, optionalType, usedEnumNames } = options;
|
385
|
-
const { pluginManager, plugin, oas } = this.context;
|
386
|
-
const type = this.resolve(operation);
|
387
|
-
const fileResolver = (name) => {
|
388
|
-
const root = pluginManager.resolvePath({ baseName: type.baseName, pluginKey: plugin?.key, options: { tag: operation.getTags()[0]?.name } });
|
389
|
-
const resolvedTypeId = pluginManager.resolvePath({
|
390
|
-
baseName: `${name}.ts`,
|
391
|
-
pluginKey: plugin?.key
|
392
|
-
});
|
393
|
-
return getRelativePath(root, resolvedTypeId);
|
394
|
-
};
|
395
|
-
const source = new TypeBuilder({
|
396
|
-
usedEnumNames,
|
397
|
-
fileResolver: mode === "file" ? void 0 : fileResolver,
|
398
|
-
withJSDocs: true,
|
399
|
-
resolveName: (params) => pluginManager.resolveName({ ...params, pluginKey: plugin?.key }),
|
400
|
-
enumType,
|
401
|
-
optionalType,
|
402
|
-
dateType,
|
403
|
-
oas
|
404
|
-
}).add(schemas.pathParams).add(schemas.queryParams).add(schemas.headerParams).add(schemas.response).add(schemas.errors).configure().print();
|
405
|
-
const combinedSchemaSource = __privateMethod(this, _printCombinedSchema, printCombinedSchema_fn).call(this, type.name, operation, schemas);
|
406
3491
|
return {
|
407
|
-
|
408
|
-
|
409
|
-
source: [source, combinedSchemaSource].join("\n"),
|
410
|
-
meta: {
|
411
|
-
pluginKey: plugin.key,
|
412
|
-
tag: operation.getTags()[0]?.name
|
413
|
-
}
|
3492
|
+
imports,
|
3493
|
+
source: transformers.combineCodes(codes)
|
414
3494
|
};
|
415
3495
|
}
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
resolveName: (params) => pluginManager.resolveName({ ...params, pluginKey: plugin?.key }),
|
433
|
-
enumType,
|
434
|
-
optionalType,
|
435
|
-
dateType,
|
436
|
-
oas
|
437
|
-
}).add(schemas.pathParams).add(schemas.queryParams).add(schemas.headerParams).add(schemas.request).add(schemas.response).add(schemas.errors).configure().print();
|
438
|
-
const combinedSchemaSource = __privateMethod(this, _printCombinedSchema, printCombinedSchema_fn).call(this, type.name, operation, schemas);
|
439
|
-
return {
|
440
|
-
path: type.path,
|
441
|
-
baseName: type.baseName,
|
442
|
-
source: [source, combinedSchemaSource].join("\n"),
|
443
|
-
meta: {
|
444
|
-
pluginKey: plugin.key,
|
445
|
-
tag: operation.getTags()[0]?.name
|
446
|
-
}
|
447
|
-
};
|
3496
|
+
};
|
3497
|
+
|
3498
|
+
// src/components/Mutation.tsx
|
3499
|
+
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
|
3500
|
+
function printCombinedSchema(name, operation, schemas) {
|
3501
|
+
const properties = {
|
3502
|
+
"response": factory.createTypeReferenceNode(
|
3503
|
+
factory.createIdentifier(schemas.response.name),
|
3504
|
+
void 0
|
3505
|
+
)
|
3506
|
+
};
|
3507
|
+
if (schemas.request) {
|
3508
|
+
properties["request"] = factory.createTypeReferenceNode(
|
3509
|
+
factory.createIdentifier(schemas.request.name),
|
3510
|
+
void 0
|
3511
|
+
);
|
448
3512
|
}
|
449
|
-
|
450
|
-
|
3513
|
+
if (schemas.pathParams) {
|
3514
|
+
properties["pathParams"] = factory.createTypeReferenceNode(
|
3515
|
+
factory.createIdentifier(schemas.pathParams.name),
|
3516
|
+
void 0
|
3517
|
+
);
|
451
3518
|
}
|
452
|
-
|
453
|
-
|
3519
|
+
if (schemas.queryParams) {
|
3520
|
+
properties["queryParams"] = factory.createTypeReferenceNode(
|
3521
|
+
factory.createIdentifier(schemas.queryParams.name),
|
3522
|
+
void 0
|
3523
|
+
);
|
454
3524
|
}
|
455
|
-
|
456
|
-
|
3525
|
+
if (schemas.headerParams) {
|
3526
|
+
properties["headerParams"] = factory.createTypeReferenceNode(
|
3527
|
+
factory.createIdentifier(schemas.headerParams.name),
|
3528
|
+
void 0
|
3529
|
+
);
|
3530
|
+
}
|
3531
|
+
if (schemas.errors) {
|
3532
|
+
properties["errors"] = factory.createUnionDeclaration({
|
3533
|
+
nodes: schemas.errors.map((error) => {
|
3534
|
+
return factory.createTypeReferenceNode(
|
3535
|
+
factory.createIdentifier(error.name),
|
3536
|
+
void 0
|
3537
|
+
);
|
3538
|
+
})
|
3539
|
+
});
|
457
3540
|
}
|
3541
|
+
const namespaceNode = factory.createNamespaceDeclaration({
|
3542
|
+
name: operation.method === "get" ? `${name}Query` : `${name}Mutation`,
|
3543
|
+
statements: Object.keys(properties).map((key) => {
|
3544
|
+
const type = properties[key];
|
3545
|
+
if (!type) {
|
3546
|
+
return void 0;
|
3547
|
+
}
|
3548
|
+
return factory.createTypeAliasDeclaration({
|
3549
|
+
modifiers: [factory.modifiers.export],
|
3550
|
+
name: transformers.pascalCase(key),
|
3551
|
+
type
|
3552
|
+
});
|
3553
|
+
}).filter(Boolean)
|
3554
|
+
});
|
3555
|
+
return print(namespaceNode);
|
3556
|
+
}
|
3557
|
+
function Mutation({
|
3558
|
+
builder
|
3559
|
+
}) {
|
3560
|
+
const { source } = builder.build();
|
3561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: source });
|
3562
|
+
}
|
3563
|
+
Mutation.File = function({ mode }) {
|
3564
|
+
const { options } = usePlugin();
|
3565
|
+
const schemas = useSchemas();
|
3566
|
+
const pluginManager = usePluginManager();
|
3567
|
+
const oas = useOas();
|
3568
|
+
const file = useOperationFile();
|
3569
|
+
const factoryName = useOperationName({ type: "type" });
|
3570
|
+
const operation = useOperation();
|
3571
|
+
const builder = new TypeBuilder(options, { oas, pluginManager }).add(schemas.pathParams).add(schemas.queryParams).add(schemas.headerParams).add(schemas.response).add(schemas.request).add(schemas.errors);
|
3572
|
+
const { source, imports } = builder.build();
|
3573
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
3574
|
+
File,
|
3575
|
+
{
|
3576
|
+
baseName: file.baseName,
|
3577
|
+
path: file.path,
|
3578
|
+
meta: file.meta,
|
3579
|
+
children: [
|
3580
|
+
mode === "directory" && imports.map((item, index) => {
|
3581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(File.Import, { root: file.path, ...item }, index);
|
3582
|
+
}),
|
3583
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(File.Source, { children: [
|
3584
|
+
source,
|
3585
|
+
printCombinedSchema(factoryName, operation, schemas)
|
3586
|
+
] })
|
3587
|
+
]
|
3588
|
+
}
|
3589
|
+
) });
|
458
3590
|
};
|
459
|
-
|
460
|
-
|
3591
|
+
|
3592
|
+
// src/components/Query.tsx
|
3593
|
+
init_esm_shims();
|
3594
|
+
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
|
3595
|
+
function printCombinedSchema2(name, operation, schemas) {
|
461
3596
|
const properties = {
|
462
3597
|
"response": factory.createTypeReferenceNode(
|
463
3598
|
factory.createIdentifier(schemas.response.name),
|
@@ -507,12 +3642,81 @@ printCombinedSchema_fn = function(name, operation, schemas) {
|
|
507
3642
|
}
|
508
3643
|
return factory.createTypeAliasDeclaration({
|
509
3644
|
modifiers: [factory.modifiers.export],
|
510
|
-
name: pascalCase(key),
|
3645
|
+
name: transformers.pascalCase(key),
|
511
3646
|
type
|
512
3647
|
});
|
513
3648
|
}).filter(Boolean)
|
514
3649
|
});
|
515
3650
|
return print(namespaceNode);
|
3651
|
+
}
|
3652
|
+
function Query({
|
3653
|
+
builder
|
3654
|
+
}) {
|
3655
|
+
const { source } = builder.build();
|
3656
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: source });
|
3657
|
+
}
|
3658
|
+
Query.File = function({ mode }) {
|
3659
|
+
const { options } = usePlugin();
|
3660
|
+
const schemas = useSchemas();
|
3661
|
+
const pluginManager = usePluginManager();
|
3662
|
+
const oas = useOas();
|
3663
|
+
const file = useOperationFile();
|
3664
|
+
const factoryName = useOperationName({ type: "type" });
|
3665
|
+
const operation = useOperation();
|
3666
|
+
const builder = new TypeBuilder(options, { oas, pluginManager }).add(schemas.pathParams).add(schemas.queryParams).add(schemas.headerParams).add(schemas.response).add(schemas.errors);
|
3667
|
+
const { source, imports } = builder.build();
|
3668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
3669
|
+
File,
|
3670
|
+
{
|
3671
|
+
baseName: file.baseName,
|
3672
|
+
path: file.path,
|
3673
|
+
meta: file.meta,
|
3674
|
+
children: [
|
3675
|
+
mode === "directory" && imports.map((item, index) => {
|
3676
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(File.Import, { root: file.path, ...item }, index);
|
3677
|
+
}),
|
3678
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(File.Source, { children: [
|
3679
|
+
source,
|
3680
|
+
printCombinedSchema2(factoryName, operation, schemas)
|
3681
|
+
] })
|
3682
|
+
]
|
3683
|
+
}
|
3684
|
+
) });
|
3685
|
+
};
|
3686
|
+
|
3687
|
+
// src/OperationGenerator.tsx
|
3688
|
+
var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
|
3689
|
+
var OperationGenerator = class extends OperationGenerator$1 {
|
3690
|
+
async all() {
|
3691
|
+
return null;
|
3692
|
+
}
|
3693
|
+
async get(operation, schemas, options) {
|
3694
|
+
const { oas, pluginManager, plugin, mode = "directory" } = this.context;
|
3695
|
+
const root = createRoot({ logger: pluginManager.logger });
|
3696
|
+
root.render(
|
3697
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Query.File, { mode }),
|
3698
|
+
{ meta: { oas, pluginManager, plugin: { ...plugin, options }, schemas, operation } }
|
3699
|
+
);
|
3700
|
+
return root.files;
|
3701
|
+
}
|
3702
|
+
async post(operation, schemas, options) {
|
3703
|
+
const { oas, pluginManager, plugin, mode = "directory" } = this.context;
|
3704
|
+
const root = createRoot({ logger: pluginManager.logger });
|
3705
|
+
root.render(
|
3706
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Mutation.File, { mode }),
|
3707
|
+
{ meta: { oas, pluginManager, plugin: { ...plugin, options }, schemas, operation } }
|
3708
|
+
);
|
3709
|
+
return root.files;
|
3710
|
+
}
|
3711
|
+
async put(operation, schemas, options) {
|
3712
|
+
return this.post(operation, schemas, options);
|
3713
|
+
}
|
3714
|
+
async patch(operation, schemas, options) {
|
3715
|
+
return this.post(operation, schemas, options);
|
3716
|
+
}
|
3717
|
+
async delete(operation, schemas, options) {
|
3718
|
+
return this.post(operation, schemas, options);
|
3719
|
+
}
|
516
3720
|
};
|
517
3721
|
|
518
3722
|
// src/plugin.ts
|
@@ -528,13 +3732,20 @@ var definePlugin = createPlugin((options) => {
|
|
528
3732
|
enumType = "asConst",
|
529
3733
|
dateType = "string",
|
530
3734
|
optionalType = "questionToken",
|
531
|
-
transformers:
|
3735
|
+
transformers: transformers5 = {},
|
532
3736
|
exportAs
|
533
3737
|
} = options;
|
534
3738
|
const template = group?.output ? group.output : `${output}/{{tag}}Controller`;
|
535
3739
|
return {
|
536
3740
|
name: pluginName,
|
537
|
-
options
|
3741
|
+
options: {
|
3742
|
+
transformers: transformers5,
|
3743
|
+
dateType,
|
3744
|
+
enumType,
|
3745
|
+
optionalType,
|
3746
|
+
// keep the used enumnames between TypeBuilder and OperationGenerator per plugin(pluginKey)
|
3747
|
+
usedEnumNames: {}
|
3748
|
+
},
|
538
3749
|
pre: [pluginName$1],
|
539
3750
|
resolvePath(baseName, directory, options2) {
|
540
3751
|
const root = path.resolve(this.config.root, this.config.output.path);
|
@@ -543,15 +3754,15 @@ var definePlugin = createPlugin((options) => {
|
|
543
3754
|
return path.resolve(root, output);
|
544
3755
|
}
|
545
3756
|
if (options2?.tag && group?.type === "tag") {
|
546
|
-
const tag = camelCase(options2.tag
|
3757
|
+
const tag = camelCase(options2.tag);
|
547
3758
|
return path.resolve(root, renderTemplate(template, { tag }), baseName);
|
548
3759
|
}
|
549
3760
|
return path.resolve(root, output, baseName);
|
550
3761
|
},
|
551
3762
|
resolveName(name, type) {
|
552
|
-
const resolvedName = pascalCase(name
|
3763
|
+
const resolvedName = pascalCase(name);
|
553
3764
|
if (type) {
|
554
|
-
return
|
3765
|
+
return transformers5?.name?.(resolvedName, type) || resolvedName;
|
555
3766
|
}
|
556
3767
|
return resolvedName;
|
557
3768
|
},
|
@@ -567,40 +3778,23 @@ var definePlugin = createPlugin((options) => {
|
|
567
3778
|
const schemas = await swaggerPlugin.api.getSchemas();
|
568
3779
|
const root = path.resolve(this.config.root, this.config.output.path);
|
569
3780
|
const mode = FileManager.getMode(path.resolve(root, output));
|
570
|
-
const
|
3781
|
+
const builder = new TypeBuilder(this.plugin.options, { oas, pluginManager: this.pluginManager });
|
3782
|
+
builder.add(
|
3783
|
+
Object.entries(schemas).map(([name, schema]) => ({ name, schema }))
|
3784
|
+
);
|
571
3785
|
if (mode === "directory") {
|
572
|
-
const builder = await new TypeBuilder({
|
573
|
-
usedEnumNames,
|
574
|
-
resolveName: (params) => this.resolveName({ pluginKey: this.plugin.key, ...params }),
|
575
|
-
fileResolver: (name) => {
|
576
|
-
const resolvedTypeId = this.resolvePath({
|
577
|
-
baseName: `${name}.ts`,
|
578
|
-
pluginKey: this.plugin.key
|
579
|
-
});
|
580
|
-
const root2 = this.resolvePath({ baseName: ``, pluginKey: this.plugin.key });
|
581
|
-
return getRelativePath(root2, resolvedTypeId);
|
582
|
-
},
|
583
|
-
withJSDocs: true,
|
584
|
-
enumType,
|
585
|
-
dateType,
|
586
|
-
optionalType,
|
587
|
-
oas
|
588
|
-
}).configure();
|
589
|
-
Object.entries(schemas).forEach(([name, schema]) => {
|
590
|
-
return builder.add({
|
591
|
-
schema,
|
592
|
-
name
|
593
|
-
});
|
594
|
-
});
|
595
3786
|
const mapFolderSchema = async ([name]) => {
|
596
|
-
const
|
3787
|
+
const baseName = `${this.resolveName({ name, pluginKey: this.plugin.key, type: "file" })}.ts`;
|
3788
|
+
const resolvedPath = this.resolvePath({ baseName, pluginKey: this.plugin.key });
|
3789
|
+
const { source, imports } = builder.build(name);
|
597
3790
|
if (!resolvedPath) {
|
598
3791
|
return null;
|
599
3792
|
}
|
600
3793
|
return this.addFile({
|
601
3794
|
path: resolvedPath,
|
602
|
-
baseName
|
603
|
-
source
|
3795
|
+
baseName,
|
3796
|
+
source,
|
3797
|
+
imports: imports.map((item) => ({ ...item, root: resolvedPath })),
|
604
3798
|
meta: {
|
605
3799
|
pluginKey: this.plugin.key
|
606
3800
|
}
|
@@ -610,43 +3804,23 @@ var definePlugin = createPlugin((options) => {
|
|
610
3804
|
await Promise.all(promises);
|
611
3805
|
}
|
612
3806
|
if (mode === "file") {
|
613
|
-
const builder = new TypeBuilder({
|
614
|
-
usedEnumNames,
|
615
|
-
resolveName: (params) => this.resolveName({ pluginKey: this.plugin.key, ...params }),
|
616
|
-
withJSDocs: true,
|
617
|
-
enumType,
|
618
|
-
dateType,
|
619
|
-
optionalType,
|
620
|
-
oas
|
621
|
-
}).configure();
|
622
|
-
Object.entries(schemas).forEach(([name, schema]) => {
|
623
|
-
return builder.add({
|
624
|
-
schema,
|
625
|
-
name
|
626
|
-
});
|
627
|
-
});
|
628
3807
|
const resolvedPath = this.resolvePath({ baseName: "", pluginKey: this.plugin.key });
|
3808
|
+
const { source } = builder.build();
|
629
3809
|
if (!resolvedPath) {
|
630
3810
|
return;
|
631
3811
|
}
|
632
3812
|
await this.addFile({
|
633
3813
|
path: resolvedPath,
|
634
3814
|
baseName: output,
|
635
|
-
source
|
3815
|
+
source,
|
3816
|
+
imports: [],
|
636
3817
|
meta: {
|
637
3818
|
pluginKey: this.plugin.key
|
638
|
-
}
|
639
|
-
validate: false
|
3819
|
+
}
|
640
3820
|
});
|
641
3821
|
}
|
642
3822
|
const operationGenerator = new OperationGenerator(
|
643
|
-
|
644
|
-
mode,
|
645
|
-
enumType,
|
646
|
-
dateType,
|
647
|
-
optionalType,
|
648
|
-
usedEnumNames
|
649
|
-
},
|
3823
|
+
this.plugin.options,
|
650
3824
|
{
|
651
3825
|
oas,
|
652
3826
|
pluginManager: this.pluginManager,
|
@@ -654,7 +3828,8 @@ var definePlugin = createPlugin((options) => {
|
|
654
3828
|
contentType: swaggerPlugin.api.contentType,
|
655
3829
|
exclude,
|
656
3830
|
include,
|
657
|
-
override
|
3831
|
+
override,
|
3832
|
+
mode
|
658
3833
|
}
|
659
3834
|
);
|
660
3835
|
const files = await operationGenerator.build();
|
@@ -695,6 +3870,52 @@ var definePlugin = createPlugin((options) => {
|
|
695
3870
|
|
696
3871
|
// src/index.ts
|
697
3872
|
var src_default = definePlugin;
|
3873
|
+
/*! Bundled license information:
|
3874
|
+
|
3875
|
+
react/cjs/react.production.min.js:
|
3876
|
+
(**
|
3877
|
+
* @license React
|
3878
|
+
* react.production.min.js
|
3879
|
+
*
|
3880
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
3881
|
+
*
|
3882
|
+
* This source code is licensed under the MIT license found in the
|
3883
|
+
* LICENSE file in the root directory of this source tree.
|
3884
|
+
*)
|
3885
|
+
|
3886
|
+
react/cjs/react.development.js:
|
3887
|
+
(**
|
3888
|
+
* @license React
|
3889
|
+
* react.development.js
|
3890
|
+
*
|
3891
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
3892
|
+
*
|
3893
|
+
* This source code is licensed under the MIT license found in the
|
3894
|
+
* LICENSE file in the root directory of this source tree.
|
3895
|
+
*)
|
3896
|
+
|
3897
|
+
react/cjs/react-jsx-runtime.production.min.js:
|
3898
|
+
(**
|
3899
|
+
* @license React
|
3900
|
+
* react-jsx-runtime.production.min.js
|
3901
|
+
*
|
3902
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
3903
|
+
*
|
3904
|
+
* This source code is licensed under the MIT license found in the
|
3905
|
+
* LICENSE file in the root directory of this source tree.
|
3906
|
+
*)
|
3907
|
+
|
3908
|
+
react/cjs/react-jsx-runtime.development.js:
|
3909
|
+
(**
|
3910
|
+
* @license React
|
3911
|
+
* react-jsx-runtime.development.js
|
3912
|
+
*
|
3913
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
3914
|
+
*
|
3915
|
+
* This source code is licensed under the MIT license found in the
|
3916
|
+
* LICENSE file in the root directory of this source tree.
|
3917
|
+
*)
|
3918
|
+
*/
|
698
3919
|
|
699
3920
|
export { src_default as default, definePlugin, pluginKey, pluginName };
|
700
3921
|
//# sourceMappingURL=out.js.map
|