react-shared-states 1.0.0
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/.editorconfig +9 -0
- package/CODE_OF_CONDUCT.md +128 -0
- package/CONTRIBUTING.md +112 -0
- package/LICENSE +21 -0
- package/README.md +359 -0
- package/assets/banner.png +0 -0
- package/dist/SharedData.d.ts +25 -0
- package/dist/context/SharedStatesContext.d.ts +11 -0
- package/dist/context/index.d.ts +1 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/use-shared-function.d.ts +29 -0
- package/dist/hooks/use-shared-state.d.ts +17 -0
- package/dist/hooks/use-shared.d.ts +5 -0
- package/dist/index.d.ts +3 -0
- package/dist/main.js +820 -0
- package/dist/main.min.js +37 -0
- package/dist/types.d.ts +6 -0
- package/package.json +50 -0
- package/pnpm-workspace.yaml +2 -0
- package/vite.config.ts +45 -0
package/dist/main.js
ADDED
|
@@ -0,0 +1,820 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* react-shared-states v1.0.0
|
|
3
|
+
* (c) Hichem Taboukouyout
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
* Github: github.com/HichemTab-tech/react-shared-states
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import we, { createContext as hr, useMemo as br, useContext as Er, useSyncExternalStore as je } from "react";
|
|
9
|
+
var q = { exports: {} }, W = {};
|
|
10
|
+
/**
|
|
11
|
+
* @license React
|
|
12
|
+
* react-jsx-runtime.production.min.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/
|
|
19
|
+
var Oe;
|
|
20
|
+
function _r() {
|
|
21
|
+
if (Oe) return W;
|
|
22
|
+
Oe = 1;
|
|
23
|
+
var l = we, t = Symbol.for("react.element"), i = Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, b = l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, P = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
24
|
+
function v(T, d, m) {
|
|
25
|
+
var S, C = {}, j = null, M = null;
|
|
26
|
+
m !== void 0 && (j = "" + m), d.key !== void 0 && (j = "" + d.key), d.ref !== void 0 && (M = d.ref);
|
|
27
|
+
for (S in d) a.call(d, S) && !P.hasOwnProperty(S) && (C[S] = d[S]);
|
|
28
|
+
if (T && T.defaultProps) for (S in d = T.defaultProps, d) C[S] === void 0 && (C[S] = d[S]);
|
|
29
|
+
return { $$typeof: t, type: T, key: j, ref: M, props: C, _owner: b.current };
|
|
30
|
+
}
|
|
31
|
+
return W.Fragment = i, W.jsx = v, W.jsxs = v, W;
|
|
32
|
+
}
|
|
33
|
+
var Y = {};
|
|
34
|
+
/**
|
|
35
|
+
* @license React
|
|
36
|
+
* react-jsx-runtime.development.js
|
|
37
|
+
*
|
|
38
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
39
|
+
*
|
|
40
|
+
* This source code is licensed under the MIT license found in the
|
|
41
|
+
* LICENSE file in the root directory of this source tree.
|
|
42
|
+
*/
|
|
43
|
+
var Ce;
|
|
44
|
+
function Rr() {
|
|
45
|
+
return Ce || (Ce = 1, process.env.NODE_ENV !== "production" && function() {
|
|
46
|
+
var l = we, t = Symbol.for("react.element"), i = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), b = Symbol.for("react.strict_mode"), P = Symbol.for("react.profiler"), v = Symbol.for("react.provider"), T = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), S = Symbol.for("react.suspense_list"), C = Symbol.for("react.memo"), j = Symbol.for("react.lazy"), M = Symbol.for("react.offscreen"), ee = Symbol.iterator, Le = "@@iterator";
|
|
47
|
+
function Ve(e) {
|
|
48
|
+
if (e === null || typeof e != "object")
|
|
49
|
+
return null;
|
|
50
|
+
var r = ee && e[ee] || e[Le];
|
|
51
|
+
return typeof r == "function" ? r : null;
|
|
52
|
+
}
|
|
53
|
+
var L = l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
54
|
+
function E(e) {
|
|
55
|
+
{
|
|
56
|
+
for (var r = arguments.length, n = new Array(r > 1 ? r - 1 : 0), o = 1; o < r; o++)
|
|
57
|
+
n[o - 1] = arguments[o];
|
|
58
|
+
Ie("error", e, n);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function Ie(e, r, n) {
|
|
62
|
+
{
|
|
63
|
+
var o = L.ReactDebugCurrentFrame, f = o.getStackAddendum();
|
|
64
|
+
f !== "" && (r += "%s", n = n.concat([f]));
|
|
65
|
+
var c = n.map(function(u) {
|
|
66
|
+
return String(u);
|
|
67
|
+
});
|
|
68
|
+
c.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, c);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
var $e = !1, De = !1, We = !1, Ye = !1, Me = !1, re;
|
|
72
|
+
re = Symbol.for("react.module.reference");
|
|
73
|
+
function ke(e) {
|
|
74
|
+
return !!(typeof e == "string" || typeof e == "function" || e === a || e === P || Me || e === b || e === m || e === S || Ye || e === M || $e || De || We || typeof e == "object" && e !== null && (e.$$typeof === j || e.$$typeof === C || e.$$typeof === v || e.$$typeof === T || e.$$typeof === d || // This needs to include all possible module reference object
|
|
75
|
+
// types supported by any Flight configuration anywhere since
|
|
76
|
+
// we don't know which Flight build this will end up being used
|
|
77
|
+
// with.
|
|
78
|
+
e.$$typeof === re || e.getModuleId !== void 0));
|
|
79
|
+
}
|
|
80
|
+
function Ue(e, r, n) {
|
|
81
|
+
var o = e.displayName;
|
|
82
|
+
if (o)
|
|
83
|
+
return o;
|
|
84
|
+
var f = r.displayName || r.name || "";
|
|
85
|
+
return f !== "" ? n + "(" + f + ")" : n;
|
|
86
|
+
}
|
|
87
|
+
function te(e) {
|
|
88
|
+
return e.displayName || "Context";
|
|
89
|
+
}
|
|
90
|
+
function w(e) {
|
|
91
|
+
if (e == null)
|
|
92
|
+
return null;
|
|
93
|
+
if (typeof e.tag == "number" && E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
94
|
+
return e.displayName || e.name || null;
|
|
95
|
+
if (typeof e == "string")
|
|
96
|
+
return e;
|
|
97
|
+
switch (e) {
|
|
98
|
+
case a:
|
|
99
|
+
return "Fragment";
|
|
100
|
+
case i:
|
|
101
|
+
return "Portal";
|
|
102
|
+
case P:
|
|
103
|
+
return "Profiler";
|
|
104
|
+
case b:
|
|
105
|
+
return "StrictMode";
|
|
106
|
+
case m:
|
|
107
|
+
return "Suspense";
|
|
108
|
+
case S:
|
|
109
|
+
return "SuspenseList";
|
|
110
|
+
}
|
|
111
|
+
if (typeof e == "object")
|
|
112
|
+
switch (e.$$typeof) {
|
|
113
|
+
case T:
|
|
114
|
+
var r = e;
|
|
115
|
+
return te(r) + ".Consumer";
|
|
116
|
+
case v:
|
|
117
|
+
var n = e;
|
|
118
|
+
return te(n._context) + ".Provider";
|
|
119
|
+
case d:
|
|
120
|
+
return Ue(e, e.render, "ForwardRef");
|
|
121
|
+
case C:
|
|
122
|
+
var o = e.displayName || null;
|
|
123
|
+
return o !== null ? o : w(e.type) || "Memo";
|
|
124
|
+
case j: {
|
|
125
|
+
var f = e, c = f._payload, u = f._init;
|
|
126
|
+
try {
|
|
127
|
+
return w(u(c));
|
|
128
|
+
} catch {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
var A = Object.assign, $ = 0, ne, ae, ie, oe, se, ue, le;
|
|
136
|
+
function fe() {
|
|
137
|
+
}
|
|
138
|
+
fe.__reactDisabledLog = !0;
|
|
139
|
+
function Be() {
|
|
140
|
+
{
|
|
141
|
+
if ($ === 0) {
|
|
142
|
+
ne = console.log, ae = console.info, ie = console.warn, oe = console.error, se = console.group, ue = console.groupCollapsed, le = console.groupEnd;
|
|
143
|
+
var e = {
|
|
144
|
+
configurable: !0,
|
|
145
|
+
enumerable: !0,
|
|
146
|
+
value: fe,
|
|
147
|
+
writable: !0
|
|
148
|
+
};
|
|
149
|
+
Object.defineProperties(console, {
|
|
150
|
+
info: e,
|
|
151
|
+
log: e,
|
|
152
|
+
warn: e,
|
|
153
|
+
error: e,
|
|
154
|
+
group: e,
|
|
155
|
+
groupCollapsed: e,
|
|
156
|
+
groupEnd: e
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
$++;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function Je() {
|
|
163
|
+
{
|
|
164
|
+
if ($--, $ === 0) {
|
|
165
|
+
var e = {
|
|
166
|
+
configurable: !0,
|
|
167
|
+
enumerable: !0,
|
|
168
|
+
writable: !0
|
|
169
|
+
};
|
|
170
|
+
Object.defineProperties(console, {
|
|
171
|
+
log: A({}, e, {
|
|
172
|
+
value: ne
|
|
173
|
+
}),
|
|
174
|
+
info: A({}, e, {
|
|
175
|
+
value: ae
|
|
176
|
+
}),
|
|
177
|
+
warn: A({}, e, {
|
|
178
|
+
value: ie
|
|
179
|
+
}),
|
|
180
|
+
error: A({}, e, {
|
|
181
|
+
value: oe
|
|
182
|
+
}),
|
|
183
|
+
group: A({}, e, {
|
|
184
|
+
value: se
|
|
185
|
+
}),
|
|
186
|
+
groupCollapsed: A({}, e, {
|
|
187
|
+
value: ue
|
|
188
|
+
}),
|
|
189
|
+
groupEnd: A({}, e, {
|
|
190
|
+
value: le
|
|
191
|
+
})
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
$ < 0 && E("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
var N = L.ReactCurrentDispatcher, K;
|
|
198
|
+
function k(e, r, n) {
|
|
199
|
+
{
|
|
200
|
+
if (K === void 0)
|
|
201
|
+
try {
|
|
202
|
+
throw Error();
|
|
203
|
+
} catch (f) {
|
|
204
|
+
var o = f.stack.trim().match(/\n( *(at )?)/);
|
|
205
|
+
K = o && o[1] || "";
|
|
206
|
+
}
|
|
207
|
+
return `
|
|
208
|
+
` + K + e;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
var G = !1, U;
|
|
212
|
+
{
|
|
213
|
+
var qe = typeof WeakMap == "function" ? WeakMap : Map;
|
|
214
|
+
U = new qe();
|
|
215
|
+
}
|
|
216
|
+
function ce(e, r) {
|
|
217
|
+
if (!e || G)
|
|
218
|
+
return "";
|
|
219
|
+
{
|
|
220
|
+
var n = U.get(e);
|
|
221
|
+
if (n !== void 0)
|
|
222
|
+
return n;
|
|
223
|
+
}
|
|
224
|
+
var o;
|
|
225
|
+
G = !0;
|
|
226
|
+
var f = Error.prepareStackTrace;
|
|
227
|
+
Error.prepareStackTrace = void 0;
|
|
228
|
+
var c;
|
|
229
|
+
c = N.current, N.current = null, Be();
|
|
230
|
+
try {
|
|
231
|
+
if (r) {
|
|
232
|
+
var u = function() {
|
|
233
|
+
throw Error();
|
|
234
|
+
};
|
|
235
|
+
if (Object.defineProperty(u.prototype, "props", {
|
|
236
|
+
set: function() {
|
|
237
|
+
throw Error();
|
|
238
|
+
}
|
|
239
|
+
}), typeof Reflect == "object" && Reflect.construct) {
|
|
240
|
+
try {
|
|
241
|
+
Reflect.construct(u, []);
|
|
242
|
+
} catch (x) {
|
|
243
|
+
o = x;
|
|
244
|
+
}
|
|
245
|
+
Reflect.construct(e, [], u);
|
|
246
|
+
} else {
|
|
247
|
+
try {
|
|
248
|
+
u.call();
|
|
249
|
+
} catch (x) {
|
|
250
|
+
o = x;
|
|
251
|
+
}
|
|
252
|
+
e.call(u.prototype);
|
|
253
|
+
}
|
|
254
|
+
} else {
|
|
255
|
+
try {
|
|
256
|
+
throw Error();
|
|
257
|
+
} catch (x) {
|
|
258
|
+
o = x;
|
|
259
|
+
}
|
|
260
|
+
e();
|
|
261
|
+
}
|
|
262
|
+
} catch (x) {
|
|
263
|
+
if (x && o && typeof x.stack == "string") {
|
|
264
|
+
for (var s = x.stack.split(`
|
|
265
|
+
`), _ = o.stack.split(`
|
|
266
|
+
`), p = s.length - 1, h = _.length - 1; p >= 1 && h >= 0 && s[p] !== _[h]; )
|
|
267
|
+
h--;
|
|
268
|
+
for (; p >= 1 && h >= 0; p--, h--)
|
|
269
|
+
if (s[p] !== _[h]) {
|
|
270
|
+
if (p !== 1 || h !== 1)
|
|
271
|
+
do
|
|
272
|
+
if (p--, h--, h < 0 || s[p] !== _[h]) {
|
|
273
|
+
var O = `
|
|
274
|
+
` + s[p].replace(" at new ", " at ");
|
|
275
|
+
return e.displayName && O.includes("<anonymous>") && (O = O.replace("<anonymous>", e.displayName)), typeof e == "function" && U.set(e, O), O;
|
|
276
|
+
}
|
|
277
|
+
while (p >= 1 && h >= 0);
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
} finally {
|
|
282
|
+
G = !1, N.current = c, Je(), Error.prepareStackTrace = f;
|
|
283
|
+
}
|
|
284
|
+
var I = e ? e.displayName || e.name : "", F = I ? k(I) : "";
|
|
285
|
+
return typeof e == "function" && U.set(e, F), F;
|
|
286
|
+
}
|
|
287
|
+
function Ne(e, r, n) {
|
|
288
|
+
return ce(e, !1);
|
|
289
|
+
}
|
|
290
|
+
function Ke(e) {
|
|
291
|
+
var r = e.prototype;
|
|
292
|
+
return !!(r && r.isReactComponent);
|
|
293
|
+
}
|
|
294
|
+
function B(e, r, n) {
|
|
295
|
+
if (e == null)
|
|
296
|
+
return "";
|
|
297
|
+
if (typeof e == "function")
|
|
298
|
+
return ce(e, Ke(e));
|
|
299
|
+
if (typeof e == "string")
|
|
300
|
+
return k(e);
|
|
301
|
+
switch (e) {
|
|
302
|
+
case m:
|
|
303
|
+
return k("Suspense");
|
|
304
|
+
case S:
|
|
305
|
+
return k("SuspenseList");
|
|
306
|
+
}
|
|
307
|
+
if (typeof e == "object")
|
|
308
|
+
switch (e.$$typeof) {
|
|
309
|
+
case d:
|
|
310
|
+
return Ne(e.render);
|
|
311
|
+
case C:
|
|
312
|
+
return B(e.type, r, n);
|
|
313
|
+
case j: {
|
|
314
|
+
var o = e, f = o._payload, c = o._init;
|
|
315
|
+
try {
|
|
316
|
+
return B(c(f), r, n);
|
|
317
|
+
} catch {
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
return "";
|
|
322
|
+
}
|
|
323
|
+
var D = Object.prototype.hasOwnProperty, de = {}, ve = L.ReactDebugCurrentFrame;
|
|
324
|
+
function J(e) {
|
|
325
|
+
if (e) {
|
|
326
|
+
var r = e._owner, n = B(e.type, e._source, r ? r.type : null);
|
|
327
|
+
ve.setExtraStackFrame(n);
|
|
328
|
+
} else
|
|
329
|
+
ve.setExtraStackFrame(null);
|
|
330
|
+
}
|
|
331
|
+
function Ge(e, r, n, o, f) {
|
|
332
|
+
{
|
|
333
|
+
var c = Function.call.bind(D);
|
|
334
|
+
for (var u in e)
|
|
335
|
+
if (c(e, u)) {
|
|
336
|
+
var s = void 0;
|
|
337
|
+
try {
|
|
338
|
+
if (typeof e[u] != "function") {
|
|
339
|
+
var _ = Error((o || "React class") + ": " + n + " type `" + u + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[u] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
340
|
+
throw _.name = "Invariant Violation", _;
|
|
341
|
+
}
|
|
342
|
+
s = e[u](r, u, o, n, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
343
|
+
} catch (p) {
|
|
344
|
+
s = p;
|
|
345
|
+
}
|
|
346
|
+
s && !(s instanceof Error) && (J(f), E("%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).", o || "React class", n, u, typeof s), J(null)), s instanceof Error && !(s.message in de) && (de[s.message] = !0, J(f), E("Failed %s type: %s", n, s.message), J(null));
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
var ze = Array.isArray;
|
|
351
|
+
function z(e) {
|
|
352
|
+
return ze(e);
|
|
353
|
+
}
|
|
354
|
+
function Xe(e) {
|
|
355
|
+
{
|
|
356
|
+
var r = typeof Symbol == "function" && Symbol.toStringTag, n = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
357
|
+
return n;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
function He(e) {
|
|
361
|
+
try {
|
|
362
|
+
return pe(e), !1;
|
|
363
|
+
} catch {
|
|
364
|
+
return !0;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
function pe(e) {
|
|
368
|
+
return "" + e;
|
|
369
|
+
}
|
|
370
|
+
function ge(e) {
|
|
371
|
+
if (He(e))
|
|
372
|
+
return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Xe(e)), pe(e);
|
|
373
|
+
}
|
|
374
|
+
var he = L.ReactCurrentOwner, Ze = {
|
|
375
|
+
key: !0,
|
|
376
|
+
ref: !0,
|
|
377
|
+
__self: !0,
|
|
378
|
+
__source: !0
|
|
379
|
+
}, be, Ee;
|
|
380
|
+
function Qe(e) {
|
|
381
|
+
if (D.call(e, "ref")) {
|
|
382
|
+
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
383
|
+
if (r && r.isReactWarning)
|
|
384
|
+
return !1;
|
|
385
|
+
}
|
|
386
|
+
return e.ref !== void 0;
|
|
387
|
+
}
|
|
388
|
+
function er(e) {
|
|
389
|
+
if (D.call(e, "key")) {
|
|
390
|
+
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
391
|
+
if (r && r.isReactWarning)
|
|
392
|
+
return !1;
|
|
393
|
+
}
|
|
394
|
+
return e.key !== void 0;
|
|
395
|
+
}
|
|
396
|
+
function rr(e, r) {
|
|
397
|
+
typeof e.ref == "string" && he.current;
|
|
398
|
+
}
|
|
399
|
+
function tr(e, r) {
|
|
400
|
+
{
|
|
401
|
+
var n = function() {
|
|
402
|
+
be || (be = !0, E("%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)", r));
|
|
403
|
+
};
|
|
404
|
+
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
405
|
+
get: n,
|
|
406
|
+
configurable: !0
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
function nr(e, r) {
|
|
411
|
+
{
|
|
412
|
+
var n = function() {
|
|
413
|
+
Ee || (Ee = !0, E("%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)", r));
|
|
414
|
+
};
|
|
415
|
+
n.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
416
|
+
get: n,
|
|
417
|
+
configurable: !0
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
var ar = function(e, r, n, o, f, c, u) {
|
|
422
|
+
var s = {
|
|
423
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
424
|
+
$$typeof: t,
|
|
425
|
+
// Built-in properties that belong on the element
|
|
426
|
+
type: e,
|
|
427
|
+
key: r,
|
|
428
|
+
ref: n,
|
|
429
|
+
props: u,
|
|
430
|
+
// Record the component responsible for creating this element.
|
|
431
|
+
_owner: c
|
|
432
|
+
};
|
|
433
|
+
return s._store = {}, Object.defineProperty(s._store, "validated", {
|
|
434
|
+
configurable: !1,
|
|
435
|
+
enumerable: !1,
|
|
436
|
+
writable: !0,
|
|
437
|
+
value: !1
|
|
438
|
+
}), Object.defineProperty(s, "_self", {
|
|
439
|
+
configurable: !1,
|
|
440
|
+
enumerable: !1,
|
|
441
|
+
writable: !1,
|
|
442
|
+
value: o
|
|
443
|
+
}), Object.defineProperty(s, "_source", {
|
|
444
|
+
configurable: !1,
|
|
445
|
+
enumerable: !1,
|
|
446
|
+
writable: !1,
|
|
447
|
+
value: f
|
|
448
|
+
}), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
|
|
449
|
+
};
|
|
450
|
+
function ir(e, r, n, o, f) {
|
|
451
|
+
{
|
|
452
|
+
var c, u = {}, s = null, _ = null;
|
|
453
|
+
n !== void 0 && (ge(n), s = "" + n), er(r) && (ge(r.key), s = "" + r.key), Qe(r) && (_ = r.ref, rr(r, f));
|
|
454
|
+
for (c in r)
|
|
455
|
+
D.call(r, c) && !Ze.hasOwnProperty(c) && (u[c] = r[c]);
|
|
456
|
+
if (e && e.defaultProps) {
|
|
457
|
+
var p = e.defaultProps;
|
|
458
|
+
for (c in p)
|
|
459
|
+
u[c] === void 0 && (u[c] = p[c]);
|
|
460
|
+
}
|
|
461
|
+
if (s || _) {
|
|
462
|
+
var h = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
463
|
+
s && tr(u, h), _ && nr(u, h);
|
|
464
|
+
}
|
|
465
|
+
return ar(e, s, _, f, o, he.current, u);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
var X = L.ReactCurrentOwner, _e = L.ReactDebugCurrentFrame;
|
|
469
|
+
function V(e) {
|
|
470
|
+
if (e) {
|
|
471
|
+
var r = e._owner, n = B(e.type, e._source, r ? r.type : null);
|
|
472
|
+
_e.setExtraStackFrame(n);
|
|
473
|
+
} else
|
|
474
|
+
_e.setExtraStackFrame(null);
|
|
475
|
+
}
|
|
476
|
+
var H;
|
|
477
|
+
H = !1;
|
|
478
|
+
function Z(e) {
|
|
479
|
+
return typeof e == "object" && e !== null && e.$$typeof === t;
|
|
480
|
+
}
|
|
481
|
+
function Re() {
|
|
482
|
+
{
|
|
483
|
+
if (X.current) {
|
|
484
|
+
var e = w(X.current.type);
|
|
485
|
+
if (e)
|
|
486
|
+
return `
|
|
487
|
+
|
|
488
|
+
Check the render method of \`` + e + "`.";
|
|
489
|
+
}
|
|
490
|
+
return "";
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
function or(e) {
|
|
494
|
+
return "";
|
|
495
|
+
}
|
|
496
|
+
var me = {};
|
|
497
|
+
function sr(e) {
|
|
498
|
+
{
|
|
499
|
+
var r = Re();
|
|
500
|
+
if (!r) {
|
|
501
|
+
var n = typeof e == "string" ? e : e.displayName || e.name;
|
|
502
|
+
n && (r = `
|
|
503
|
+
|
|
504
|
+
Check the top-level render call using <` + n + ">.");
|
|
505
|
+
}
|
|
506
|
+
return r;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
function xe(e, r) {
|
|
510
|
+
{
|
|
511
|
+
if (!e._store || e._store.validated || e.key != null)
|
|
512
|
+
return;
|
|
513
|
+
e._store.validated = !0;
|
|
514
|
+
var n = sr(r);
|
|
515
|
+
if (me[n])
|
|
516
|
+
return;
|
|
517
|
+
me[n] = !0;
|
|
518
|
+
var o = "";
|
|
519
|
+
e && e._owner && e._owner !== X.current && (o = " It was passed a child from " + w(e._owner.type) + "."), V(e), E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, o), V(null);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
function ye(e, r) {
|
|
523
|
+
{
|
|
524
|
+
if (typeof e != "object")
|
|
525
|
+
return;
|
|
526
|
+
if (z(e))
|
|
527
|
+
for (var n = 0; n < e.length; n++) {
|
|
528
|
+
var o = e[n];
|
|
529
|
+
Z(o) && xe(o, r);
|
|
530
|
+
}
|
|
531
|
+
else if (Z(e))
|
|
532
|
+
e._store && (e._store.validated = !0);
|
|
533
|
+
else if (e) {
|
|
534
|
+
var f = Ve(e);
|
|
535
|
+
if (typeof f == "function" && f !== e.entries)
|
|
536
|
+
for (var c = f.call(e), u; !(u = c.next()).done; )
|
|
537
|
+
Z(u.value) && xe(u.value, r);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
function ur(e) {
|
|
542
|
+
{
|
|
543
|
+
var r = e.type;
|
|
544
|
+
if (r == null || typeof r == "string")
|
|
545
|
+
return;
|
|
546
|
+
var n;
|
|
547
|
+
if (typeof r == "function")
|
|
548
|
+
n = r.propTypes;
|
|
549
|
+
else if (typeof r == "object" && (r.$$typeof === d || // Note: Memo only checks outer props here.
|
|
550
|
+
// Inner props are checked in the reconciler.
|
|
551
|
+
r.$$typeof === C))
|
|
552
|
+
n = r.propTypes;
|
|
553
|
+
else
|
|
554
|
+
return;
|
|
555
|
+
if (n) {
|
|
556
|
+
var o = w(r);
|
|
557
|
+
Ge(n, e.props, "prop", o, e);
|
|
558
|
+
} else if (r.PropTypes !== void 0 && !H) {
|
|
559
|
+
H = !0;
|
|
560
|
+
var f = w(r);
|
|
561
|
+
E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", f || "Unknown");
|
|
562
|
+
}
|
|
563
|
+
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
function lr(e) {
|
|
567
|
+
{
|
|
568
|
+
for (var r = Object.keys(e.props), n = 0; n < r.length; n++) {
|
|
569
|
+
var o = r[n];
|
|
570
|
+
if (o !== "children" && o !== "key") {
|
|
571
|
+
V(e), E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", o), V(null);
|
|
572
|
+
break;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
e.ref !== null && (V(e), E("Invalid attribute `ref` supplied to `React.Fragment`."), V(null));
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
var Se = {};
|
|
579
|
+
function Te(e, r, n, o, f, c) {
|
|
580
|
+
{
|
|
581
|
+
var u = ke(e);
|
|
582
|
+
if (!u) {
|
|
583
|
+
var s = "";
|
|
584
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (s += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
585
|
+
var _ = or();
|
|
586
|
+
_ ? s += _ : s += Re();
|
|
587
|
+
var p;
|
|
588
|
+
e === null ? p = "null" : z(e) ? p = "array" : e !== void 0 && e.$$typeof === t ? (p = "<" + (w(e.type) || "Unknown") + " />", s = " Did you accidentally export a JSX literal instead of a component?") : p = typeof e, E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", p, s);
|
|
589
|
+
}
|
|
590
|
+
var h = ir(e, r, n, f, c);
|
|
591
|
+
if (h == null)
|
|
592
|
+
return h;
|
|
593
|
+
if (u) {
|
|
594
|
+
var O = r.children;
|
|
595
|
+
if (O !== void 0)
|
|
596
|
+
if (o)
|
|
597
|
+
if (z(O)) {
|
|
598
|
+
for (var I = 0; I < O.length; I++)
|
|
599
|
+
ye(O[I], e);
|
|
600
|
+
Object.freeze && Object.freeze(O);
|
|
601
|
+
} else
|
|
602
|
+
E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
603
|
+
else
|
|
604
|
+
ye(O, e);
|
|
605
|
+
}
|
|
606
|
+
if (D.call(r, "key")) {
|
|
607
|
+
var F = w(e), x = Object.keys(r).filter(function(gr) {
|
|
608
|
+
return gr !== "key";
|
|
609
|
+
}), Q = x.length > 0 ? "{key: someKey, " + x.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
610
|
+
if (!Se[F + Q]) {
|
|
611
|
+
var pr = x.length > 0 ? "{" + x.join(": ..., ") + ": ...}" : "{}";
|
|
612
|
+
E(`A props object containing a "key" prop is being spread into JSX:
|
|
613
|
+
let props = %s;
|
|
614
|
+
<%s {...props} />
|
|
615
|
+
React keys must be passed directly to JSX without using spread:
|
|
616
|
+
let props = %s;
|
|
617
|
+
<%s key={someKey} {...props} />`, Q, F, pr, F), Se[F + Q] = !0;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
return e === a ? lr(h) : ur(h), h;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
function fr(e, r, n) {
|
|
624
|
+
return Te(e, r, n, !0);
|
|
625
|
+
}
|
|
626
|
+
function cr(e, r, n) {
|
|
627
|
+
return Te(e, r, n, !1);
|
|
628
|
+
}
|
|
629
|
+
var dr = cr, vr = fr;
|
|
630
|
+
Y.Fragment = a, Y.jsx = dr, Y.jsxs = vr;
|
|
631
|
+
}()), Y;
|
|
632
|
+
}
|
|
633
|
+
var Pe;
|
|
634
|
+
function mr() {
|
|
635
|
+
return Pe || (Pe = 1, process.env.NODE_ENV === "production" ? q.exports = _r() : q.exports = Rr()), q.exports;
|
|
636
|
+
}
|
|
637
|
+
var xr = mr();
|
|
638
|
+
const Ae = hr(void 0), wr = ({ children: l, scopeName: t }) => (t || (t = br(() => Math.random().toString(36).substring(2, 15), [])), /* @__PURE__ */ xr.jsx(Ae.Provider, { value: { scopeName: t }, children: l })), yr = () => Er(Ae);
|
|
639
|
+
class g {
|
|
640
|
+
data = /* @__PURE__ */ new Map();
|
|
641
|
+
defaultValue() {
|
|
642
|
+
return {};
|
|
643
|
+
}
|
|
644
|
+
addListener(t, i, a) {
|
|
645
|
+
this.data.has(g.prefix(t, i)) || this.data.set(g.prefix(t, i), {
|
|
646
|
+
...this.defaultValue,
|
|
647
|
+
listeners: []
|
|
648
|
+
}), this.data.get(g.prefix(t, i)).listeners.push(a);
|
|
649
|
+
}
|
|
650
|
+
removeListener(t, i, a) {
|
|
651
|
+
this.data.has(g.prefix(t, i)) && (this.data.get(g.prefix(t, i)).listeners = this.data.get(g.prefix(t, i)).listeners.filter((b) => b !== a));
|
|
652
|
+
}
|
|
653
|
+
callListeners(t, i) {
|
|
654
|
+
this.data.has(g.prefix(t, i)) && this.data.get(g.prefix(t, i)).listeners.forEach((a) => a());
|
|
655
|
+
}
|
|
656
|
+
init(t, i, a) {
|
|
657
|
+
this.data.has(g.prefix(t, i)) || this.data.set(g.prefix(t, i), {
|
|
658
|
+
...a,
|
|
659
|
+
listeners: []
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
clearAll(t = !1) {
|
|
663
|
+
t || this.data.forEach((i) => {
|
|
664
|
+
i.listeners.forEach((a) => a());
|
|
665
|
+
}), this.data.clear();
|
|
666
|
+
}
|
|
667
|
+
clear(t, i, a = !1) {
|
|
668
|
+
a || this.callListeners(t, i), this.data.delete(g.prefix(t, i));
|
|
669
|
+
}
|
|
670
|
+
get(t, i) {
|
|
671
|
+
let a = this.has(t, i);
|
|
672
|
+
if (a)
|
|
673
|
+
return this.data.get(a);
|
|
674
|
+
}
|
|
675
|
+
setValue(t, i, a) {
|
|
676
|
+
this.data.has(g.prefix(t, i)) && this.data.set(g.prefix(t, i), {
|
|
677
|
+
...this.data.get(g.prefix(t, i)),
|
|
678
|
+
...a
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
has(t, i) {
|
|
682
|
+
return this.data.has(g.prefix(t, i)) ? g.prefix(t, i) : this.data.has(g.prefix(t, "_global")) ? g.prefix(t, "_global") : void 0;
|
|
683
|
+
}
|
|
684
|
+
static prefix(t, i) {
|
|
685
|
+
return `${i}_${t}`;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
const Fe = (l) => {
|
|
689
|
+
const t = yr();
|
|
690
|
+
return {
|
|
691
|
+
prefix: l ?? t?.scopeName ?? "_global"
|
|
692
|
+
};
|
|
693
|
+
};
|
|
694
|
+
class Sr extends g {
|
|
695
|
+
defaultValue() {
|
|
696
|
+
return { value: void 0 };
|
|
697
|
+
}
|
|
698
|
+
init(t, i, a) {
|
|
699
|
+
super.init(t, i, { value: a });
|
|
700
|
+
}
|
|
701
|
+
setValue(t, i, a) {
|
|
702
|
+
super.setValue(t, i, { value: a });
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
class Tr {
|
|
706
|
+
get(t, i = "_global") {
|
|
707
|
+
const a = i || "_global";
|
|
708
|
+
return y.get(t, a)?.value;
|
|
709
|
+
}
|
|
710
|
+
set(t, i, a = "_global") {
|
|
711
|
+
const b = a || "_global";
|
|
712
|
+
y.setValue(t, b, { value: i });
|
|
713
|
+
}
|
|
714
|
+
clearAll() {
|
|
715
|
+
y.clearAll();
|
|
716
|
+
}
|
|
717
|
+
clear(t, i = "_global") {
|
|
718
|
+
const a = i || "_global";
|
|
719
|
+
y.clear(t, a);
|
|
720
|
+
}
|
|
721
|
+
has(t, i = "_global") {
|
|
722
|
+
const a = i || "_global";
|
|
723
|
+
return !!y.has(t, a);
|
|
724
|
+
}
|
|
725
|
+
getAll() {
|
|
726
|
+
return y.data;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
const jr = new Tr(), y = new Sr(), Ar = (l, t, i) => {
|
|
730
|
+
const { prefix: a } = Fe(i);
|
|
731
|
+
y.init(l, a, t);
|
|
732
|
+
const b = je((v) => (y.init(l, a, t), y.addListener(l, a, v), () => {
|
|
733
|
+
y.removeListener(l, a, v);
|
|
734
|
+
}), () => y.get(l, a)?.value);
|
|
735
|
+
return [
|
|
736
|
+
b,
|
|
737
|
+
(v) => {
|
|
738
|
+
const T = typeof v == "function" ? v(y.get(l, a)?.value) : v;
|
|
739
|
+
T !== b && (y.setValue(l, a, T), y.callListeners(l, a));
|
|
740
|
+
}
|
|
741
|
+
];
|
|
742
|
+
};
|
|
743
|
+
class Or extends g {
|
|
744
|
+
defaultValue() {
|
|
745
|
+
return {
|
|
746
|
+
fnState: {
|
|
747
|
+
results: void 0,
|
|
748
|
+
isLoading: !1,
|
|
749
|
+
error: void 0
|
|
750
|
+
}
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
init(t, i) {
|
|
754
|
+
super.init(t, i, this.defaultValue());
|
|
755
|
+
}
|
|
756
|
+
setValue(t, i, a) {
|
|
757
|
+
super.setValue(t, i, a);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
class Cr {
|
|
761
|
+
get(t, i = "_global") {
|
|
762
|
+
const a = i || "_global";
|
|
763
|
+
return R.get(t, a)?.fnState;
|
|
764
|
+
}
|
|
765
|
+
set(t, i, a = "_global") {
|
|
766
|
+
const b = a || "_global";
|
|
767
|
+
R.setValue(t, b, i);
|
|
768
|
+
}
|
|
769
|
+
clearAll() {
|
|
770
|
+
R.clearAll();
|
|
771
|
+
}
|
|
772
|
+
clear(t, i = "_global") {
|
|
773
|
+
const a = i || "_global";
|
|
774
|
+
R.clear(t, a);
|
|
775
|
+
}
|
|
776
|
+
has(t, i = "_global") {
|
|
777
|
+
const a = i || "_global";
|
|
778
|
+
return !!R.has(t, a);
|
|
779
|
+
}
|
|
780
|
+
getAll() {
|
|
781
|
+
return R.data;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
const Fr = new Cr(), R = new Or(), Lr = (l, t, i) => {
|
|
785
|
+
const { prefix: a } = Fe(i);
|
|
786
|
+
R.init(l, a);
|
|
787
|
+
const b = je((v) => (R.init(l, a), R.addListener(l, a, v), () => {
|
|
788
|
+
R.removeListener(l, a, v);
|
|
789
|
+
}), () => R.get(l, a).fnState), P = async (v, ...T) => {
|
|
790
|
+
const d = R.get(l, a);
|
|
791
|
+
if (!v && (d.fnState.isLoading || d.fnState.results !== void 0)) return d.fnState;
|
|
792
|
+
d.fnState = { ...d.fnState, isLoading: !0, error: void 0 }, console.log(R.get(l, a)?.fnState.isLoading), d.listeners.forEach((m) => m());
|
|
793
|
+
try {
|
|
794
|
+
const m = await t(...T);
|
|
795
|
+
d.fnState = { results: m, isLoading: !1, error: void 0 };
|
|
796
|
+
} catch (m) {
|
|
797
|
+
d.fnState = { ...d.fnState, isLoading: !1, error: m };
|
|
798
|
+
}
|
|
799
|
+
d.listeners.forEach((m) => m());
|
|
800
|
+
};
|
|
801
|
+
return {
|
|
802
|
+
state: b,
|
|
803
|
+
trigger: (...v) => {
|
|
804
|
+
P(!1, ...v);
|
|
805
|
+
},
|
|
806
|
+
forceTrigger: (...v) => {
|
|
807
|
+
P(!0, ...v);
|
|
808
|
+
},
|
|
809
|
+
clear: () => {
|
|
810
|
+
R.clear(l, a), R.init(l, a);
|
|
811
|
+
}
|
|
812
|
+
};
|
|
813
|
+
};
|
|
814
|
+
export {
|
|
815
|
+
wr as SharedStatesProvider,
|
|
816
|
+
Fr as sharedFunctionsApi,
|
|
817
|
+
jr as sharedStatesApi,
|
|
818
|
+
Lr as useSharedFunction,
|
|
819
|
+
Ar as useSharedState
|
|
820
|
+
};
|