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