@m4l/core 1.0.0 → 1.1.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.
Files changed (82) hide show
  1. package/contexts/AuthContext/AuthContext.d.ts +5 -0
  2. package/contexts/AuthContext/index.717a8c86.js +135 -0
  3. package/contexts/AuthContext/index.d.ts +2 -0
  4. package/contexts/AuthContext/types.d.ts +52 -0
  5. package/contexts/DomainContext/{index.fc9c9f7e.js → index.2ed56159.js} +2 -2
  6. package/contexts/DomainCountryContext/index.3cdf9462.js +46 -0
  7. package/contexts/FlagsContext/index.5b096265.js +41 -0
  8. package/contexts/ModuleDictionaryContext/index.44448b0d.js +71 -0
  9. package/contexts/ModulePrivilegesContext/index.1274092a.js +52 -0
  10. package/contexts/ModuleSkeletonContext/index.9267d86a.js +20 -0
  11. package/{packages/m4l_core/contexts → contexts}/index.d.ts +1 -0
  12. package/{packages/m4l_core/hooks → hooks}/index.d.ts +1 -0
  13. package/hooks/useAuth/index.5356a5e9.js +11 -0
  14. package/hooks/useAuth/index.d.ts +1 -0
  15. package/hooks/useAuth/useAuth.d.ts +2 -0
  16. package/hooks/useDomain/{index.73578fd1.js → index.dd6909f6.js} +2 -2
  17. package/hooks/useFlagsStore/{index.fa8dcf62.js → index.f7c613ac.js} +5 -4
  18. package/hooks/useLocalStorage/{index.48b47dca.js → index.7dbb3411.js} +2 -2
  19. package/hooks/useModuleDictionary/{index.0b2e51cf.js → index.eec95f41.js} +1 -1
  20. package/hooks/useModulePrivileges/{index.3c1155fb.js → index.e93abed8.js} +1 -1
  21. package/hooks/useModuleSkeleton/{index.2b62072e.js → index.a8238d1d.js} +1 -1
  22. package/index.js +77 -71
  23. package/node_modules.04fac7e9.js +401 -0
  24. package/package.json +4 -2
  25. package/utils/{index.6d56ba04.js → index.f9db04a8.js} +10 -14
  26. package/vite-env.d.ts +4 -4
  27. package/contexts/DomainCountryContext/index.2da8b247.js +0 -54
  28. package/contexts/FlagsContext/index.3f08bff3.js +0 -39
  29. package/contexts/ModuleDictionaryContext/index.cc2a5fa3.js +0 -76
  30. package/contexts/ModulePrivilegesContext/index.039085db.js +0 -58
  31. package/contexts/ModuleSkeletonContext/index.334164fc.js +0 -28
  32. package/node_modules.7069706f.js +0 -835
  33. package/packages/m4l_core/vite-env.d.ts +0 -4
  34. package/vendor.3b4bd7d3.js +0 -32
  35. /package/{packages/m4l_core/contexts → contexts}/BaseContext/index.d.ts +0 -0
  36. /package/{packages/m4l_core/contexts → contexts}/BaseContext/types.d.ts +0 -0
  37. /package/{packages/m4l_core/contexts → contexts}/DomainContext/index.d.ts +0 -0
  38. /package/{packages/m4l_core/contexts → contexts}/DomainContext/types.d.ts +0 -0
  39. /package/{packages/m4l_core/contexts → contexts}/DomainCountryContext/index.d.ts +0 -0
  40. /package/{packages/m4l_core/contexts → contexts}/DomainCountryContext/types.d.ts +0 -0
  41. /package/{packages/m4l_core/contexts → contexts}/EnvironmentContext/index.d.ts +0 -0
  42. /package/{packages/m4l_core/contexts → contexts}/EnvironmentContext/types.d.ts +0 -0
  43. /package/{packages/m4l_core/contexts → contexts}/FlagsContext/index.d.ts +0 -0
  44. /package/{packages/m4l_core/contexts → contexts}/FlagsContext/store.d.ts +0 -0
  45. /package/{packages/m4l_core/contexts → contexts}/FlagsContext/types.d.ts +0 -0
  46. /package/{packages/m4l_core/contexts → contexts}/HostToolsContext/index.d.ts +0 -0
  47. /package/{packages/m4l_core/contexts → contexts}/HostToolsContext/types.d.ts +0 -0
  48. /package/{packages/m4l_core/contexts → contexts}/ModuleDictionaryContext/index.d.ts +0 -0
  49. /package/{packages/m4l_core/contexts → contexts}/ModuleDictionaryContext/types.d.ts +0 -0
  50. /package/{packages/m4l_core/contexts → contexts}/ModulePrivilegesContext/index.d.ts +0 -0
  51. /package/{packages/m4l_core/contexts → contexts}/ModulePrivilegesContext/types.d.ts +0 -0
  52. /package/{packages/m4l_core/contexts → contexts}/ModuleSkeletonContext/index.d.ts +0 -0
  53. /package/{packages/m4l_core/contexts → contexts}/ModuleSkeletonContext/types.d.ts +0 -0
  54. /package/{packages/m4l_core/contexts → contexts}/NetworkContext/index.d.ts +0 -0
  55. /package/{packages/m4l_core/contexts → contexts}/NetworkContext/types.d.ts +0 -0
  56. /package/{packages/m4l_core/hooks → hooks}/useBase/index.d.ts +0 -0
  57. /package/{packages/m4l_core/hooks → hooks}/useDomain/index.d.ts +0 -0
  58. /package/{packages/m4l_core/hooks → hooks}/useDomainCountry/index.d.ts +0 -0
  59. /package/{packages/m4l_core/hooks → hooks}/useEnvironment/index.d.ts +0 -0
  60. /package/{packages/m4l_core/hooks → hooks}/useFlagsStore/index.d.ts +0 -0
  61. /package/{packages/m4l_core/hooks → hooks}/useHostTools/index.d.ts +0 -0
  62. /package/{packages/m4l_core/hooks → hooks}/useLocalStorage/index.d.ts +0 -0
  63. /package/{packages/m4l_core/hooks → hooks}/useLocalStorageWithListener/index.d.ts +0 -0
  64. /package/{packages/m4l_core/hooks → hooks}/useModuleDictionary/index.d.ts +0 -0
  65. /package/{packages/m4l_core/hooks → hooks}/useModulePrivileges/index.d.ts +0 -0
  66. /package/{packages/m4l_core/hooks → hooks}/useModuleSkeleton/index.d.ts +0 -0
  67. /package/{packages/m4l_core/hooks → hooks}/useNetwork/index.d.ts +0 -0
  68. /package/{packages/m4l_core/hooks → hooks}/usePaginate/index.d.ts +0 -0
  69. /package/{packages/m4l_core/hooks → hooks}/usePaginate/types.d.ts +0 -0
  70. /package/{packages/m4l_core/hooks → hooks}/usePropageteMF/index.d.ts +0 -0
  71. /package/{packages/m4l_core/hooks → hooks}/usePropageteMF/types.d.ts +0 -0
  72. /package/{packages/m4l_core/index.d.ts → index.d.ts} +0 -0
  73. /package/{packages/m4l_core/types → types}/dictionary.d.ts +0 -0
  74. /package/{packages/m4l_core/types → types}/index.d.ts +0 -0
  75. /package/{packages/m4l_core/utils → utils}/axiosOperation/index.d.ts +0 -0
  76. /package/{packages/m4l_core/utils → utils}/axiosOperation/types.d.ts +0 -0
  77. /package/{packages/m4l_core/utils → utils}/evaluateWithContext/index.d.ts +0 -0
  78. /package/{packages/m4l_core/utils → utils}/getLocalStorage/index.d.ts +0 -0
  79. /package/{packages/m4l_core/utils → utils}/getPropertyByString/index.d.ts +0 -0
  80. /package/{packages/m4l_core/utils → utils}/index.d.ts +0 -0
  81. /package/{packages/m4l_core/utils → utils}/setLocalStorage/index.d.ts +0 -0
  82. /package/{packages/m4l_core/utils → utils}/voidFunction.d.ts +0 -0
@@ -1,835 +0,0 @@
1
- import F, { useDebugValue as Me } from "react";
2
- import { g as ke } from "./vendor.3b4bd7d3.js";
3
- const me = (e) => {
4
- let t;
5
- const r = /* @__PURE__ */ new Set(), n = (p, d) => {
6
- const i = typeof p == "function" ? p(t) : p;
7
- if (!Object.is(i, t)) {
8
- const s = t;
9
- t = d ?? typeof i != "object" ? i : Object.assign({}, t, i), r.forEach((f) => f(t, s));
10
- }
11
- }, o = () => t, a = { setState: n, getState: o, subscribe: (p) => (r.add(p), () => r.delete(p)), destroy: () => {
12
- ({ BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0 } && "production") !== "production" && console.warn(
13
- "[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."
14
- ), r.clear();
15
- } };
16
- return t = e(n, o, a), a;
17
- }, st = (e) => e ? me(e) : me;
18
- var Ie = { exports: {} }, B = {}, X = { exports: {} }, Y = {};
19
- /**
20
- * @license React
21
- * use-sync-external-store-shim.production.min.js
22
- *
23
- * Copyright (c) Facebook, Inc. and its affiliates.
24
- *
25
- * This source code is licensed under the MIT license found in the
26
- * LICENSE file in the root directory of this source tree.
27
- */
28
- var Oe;
29
- function Ue() {
30
- if (Oe)
31
- return Y;
32
- Oe = 1;
33
- var e = F;
34
- function t(s, f) {
35
- return s === f && (s !== 0 || 1 / s === 1 / f) || s !== s && f !== f;
36
- }
37
- var r = typeof Object.is == "function" ? Object.is : t, n = e.useState, o = e.useEffect, u = e.useLayoutEffect, l = e.useDebugValue;
38
- function a(s, f) {
39
- var v = f(), _ = n({ inst: { value: v, getSnapshot: f } }), c = _[0].inst, m = _[1];
40
- return u(function() {
41
- c.value = v, c.getSnapshot = f, p(c) && m({ inst: c });
42
- }, [s, v, f]), o(function() {
43
- return p(c) && m({ inst: c }), s(function() {
44
- p(c) && m({ inst: c });
45
- });
46
- }, [s]), l(v), v;
47
- }
48
- function p(s) {
49
- var f = s.getSnapshot;
50
- s = s.value;
51
- try {
52
- var v = f();
53
- return !r(s, v);
54
- } catch {
55
- return !0;
56
- }
57
- }
58
- function d(s, f) {
59
- return f();
60
- }
61
- var i = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? d : a;
62
- return Y.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : i, Y;
63
- }
64
- var Q = {};
65
- /**
66
- * @license React
67
- * use-sync-external-store-shim.development.js
68
- *
69
- * Copyright (c) Facebook, Inc. and its affiliates.
70
- *
71
- * This source code is licensed under the MIT license found in the
72
- * LICENSE file in the root directory of this source tree.
73
- */
74
- var _e;
75
- function ze() {
76
- return _e || (_e = 1, process.env.NODE_ENV !== "production" && function() {
77
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
78
- var e = F, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
79
- function r(S) {
80
- {
81
- for (var h = arguments.length, g = new Array(h > 1 ? h - 1 : 0), O = 1; O < h; O++)
82
- g[O - 1] = arguments[O];
83
- n("error", S, g);
84
- }
85
- }
86
- function n(S, h, g) {
87
- {
88
- var O = t.ReactDebugCurrentFrame, b = O.getStackAddendum();
89
- b !== "" && (h += "%s", g = g.concat([b]));
90
- var A = g.map(function(D) {
91
- return String(D);
92
- });
93
- A.unshift("Warning: " + h), Function.prototype.apply.call(console[S], console, A);
94
- }
95
- }
96
- function o(S, h) {
97
- return S === h && (S !== 0 || 1 / S === 1 / h) || S !== S && h !== h;
98
- }
99
- var u = typeof Object.is == "function" ? Object.is : o, l = e.useState, a = e.useEffect, p = e.useLayoutEffect, d = e.useDebugValue, i = !1, s = !1;
100
- function f(S, h, g) {
101
- i || e.startTransition !== void 0 && (i = !0, r("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
102
- var O = h();
103
- if (!s) {
104
- var b = h();
105
- u(O, b) || (r("The result of getSnapshot should be cached to avoid an infinite loop"), s = !0);
106
- }
107
- var A = l({
108
- inst: {
109
- value: O,
110
- getSnapshot: h
111
- }
112
- }), D = A[0].inst, V = A[1];
113
- return p(function() {
114
- D.value = O, D.getSnapshot = h, v(D) && V({
115
- inst: D
116
- });
117
- }, [S, O, h]), a(function() {
118
- v(D) && V({
119
- inst: D
120
- });
121
- var G = function() {
122
- v(D) && V({
123
- inst: D
124
- });
125
- };
126
- return S(G);
127
- }, [S]), d(O), O;
128
- }
129
- function v(S) {
130
- var h = S.getSnapshot, g = S.value;
131
- try {
132
- var O = h();
133
- return !u(g, O);
134
- } catch {
135
- return !0;
136
- }
137
- }
138
- function _(S, h, g) {
139
- return h();
140
- }
141
- var c = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", m = !c, y = m ? _ : f, E = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : y;
142
- Q.useSyncExternalStore = E, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
143
- }()), Q;
144
- }
145
- var Ee;
146
- function Ne() {
147
- return Ee || (Ee = 1, function(e) {
148
- process.env.NODE_ENV === "production" ? e.exports = Ue() : e.exports = ze();
149
- }(X)), X.exports;
150
- }
151
- /**
152
- * @license React
153
- * use-sync-external-store-shim/with-selector.production.min.js
154
- *
155
- * Copyright (c) Facebook, Inc. and its affiliates.
156
- *
157
- * This source code is licensed under the MIT license found in the
158
- * LICENSE file in the root directory of this source tree.
159
- */
160
- var ge;
161
- function We() {
162
- if (ge)
163
- return B;
164
- ge = 1;
165
- var e = F, t = Ne();
166
- function r(d, i) {
167
- return d === i && (d !== 0 || 1 / d === 1 / i) || d !== d && i !== i;
168
- }
169
- var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, u = e.useRef, l = e.useEffect, a = e.useMemo, p = e.useDebugValue;
170
- return B.useSyncExternalStoreWithSelector = function(d, i, s, f, v) {
171
- var _ = u(null);
172
- if (_.current === null) {
173
- var c = { hasValue: !1, value: null };
174
- _.current = c;
175
- } else
176
- c = _.current;
177
- _ = a(function() {
178
- function y(O) {
179
- if (!E) {
180
- if (E = !0, S = O, O = f(O), v !== void 0 && c.hasValue) {
181
- var b = c.value;
182
- if (v(b, O))
183
- return h = b;
184
- }
185
- return h = O;
186
- }
187
- if (b = h, n(S, O))
188
- return b;
189
- var A = f(O);
190
- return v !== void 0 && v(b, A) ? b : (S = O, h = A);
191
- }
192
- var E = !1, S, h, g = s === void 0 ? null : s;
193
- return [function() {
194
- return y(i());
195
- }, g === null ? void 0 : function() {
196
- return y(g());
197
- }];
198
- }, [i, s, f, v]);
199
- var m = o(d, _[0], _[1]);
200
- return l(function() {
201
- c.hasValue = !0, c.value = m;
202
- }, [m]), p(m), m;
203
- }, B;
204
- }
205
- var Z = {};
206
- /**
207
- * @license React
208
- * use-sync-external-store-shim/with-selector.development.js
209
- *
210
- * Copyright (c) Facebook, Inc. and its affiliates.
211
- *
212
- * This source code is licensed under the MIT license found in the
213
- * LICENSE file in the root directory of this source tree.
214
- */
215
- var be;
216
- function Ke() {
217
- return be || (be = 1, process.env.NODE_ENV !== "production" && function() {
218
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
219
- var e = F, t = Ne();
220
- function r(i, s) {
221
- return i === s && (i !== 0 || 1 / i === 1 / s) || i !== i && s !== s;
222
- }
223
- var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, u = e.useRef, l = e.useEffect, a = e.useMemo, p = e.useDebugValue;
224
- function d(i, s, f, v, _) {
225
- var c = u(null), m;
226
- c.current === null ? (m = {
227
- hasValue: !1,
228
- value: null
229
- }, c.current = m) : m = c.current;
230
- var y = a(function() {
231
- var g = !1, O, b, A = function(C) {
232
- if (!g) {
233
- g = !0, O = C;
234
- var H = v(C);
235
- if (_ !== void 0 && m.hasValue) {
236
- var q = m.value;
237
- if (_(q, H))
238
- return b = q, q;
239
- }
240
- return b = H, H;
241
- }
242
- var Ce = O, J = b;
243
- if (n(Ce, C))
244
- return J;
245
- var $ = v(C);
246
- return _ !== void 0 && _(J, $) ? J : (O = C, b = $, $);
247
- }, D = f === void 0 ? null : f, V = function() {
248
- return A(s());
249
- }, G = D === null ? void 0 : function() {
250
- return A(D());
251
- };
252
- return [V, G];
253
- }, [s, f, v, _]), E = y[0], S = y[1], h = o(i, E, S);
254
- return l(function() {
255
- m.hasValue = !0, m.value = h;
256
- }, [h]), p(h), h;
257
- }
258
- Z.useSyncExternalStoreWithSelector = d, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
259
- }()), Z;
260
- }
261
- (function(e) {
262
- process.env.NODE_ENV === "production" ? e.exports = We() : e.exports = Ke();
263
- })(Ie);
264
- const Fe = /* @__PURE__ */ ke(Ie.exports), { useSyncExternalStoreWithSelector: Ge } = Fe;
265
- function ft(e, t = e.getState, r) {
266
- const n = Ge(
267
- e.subscribe,
268
- e.getState,
269
- e.getServerState || e.getState,
270
- t,
271
- r
272
- );
273
- return Me(n), n;
274
- }
275
- const ie = /* @__PURE__ */ new Map(), U = (e) => {
276
- const t = ie.get(e);
277
- return t ? Object.fromEntries(
278
- Object.entries(t.stores).map(([r, n]) => [r, n.getState()])
279
- ) : {};
280
- }, He = (e, t, r) => {
281
- if (e === void 0)
282
- return {
283
- type: "untracked",
284
- connection: t.connect(r)
285
- };
286
- const n = ie.get(r.name);
287
- if (n)
288
- return { type: "tracked", store: e, ...n };
289
- const o = {
290
- connection: t.connect(r),
291
- stores: {}
292
- };
293
- return ie.set(r.name, o), { type: "tracked", store: e, ...o };
294
- }, qe = (e, t = {}) => (r, n, o) => {
295
- const { enabled: u, anonymousActionType: l, store: a, ...p } = t;
296
- let d;
297
- try {
298
- d = (u ?? ({ BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0 } && "production") !== "production") && window.__REDUX_DEVTOOLS_EXTENSION__;
299
- } catch {
300
- }
301
- if (!d)
302
- return ({ BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0 } && "production") !== "production" && u && console.warn(
303
- "[zustand devtools middleware] Please install/enable Redux devtools extension"
304
- ), e(r, n, o);
305
- const { connection: i, ...s } = He(a, d, p);
306
- let f = !0;
307
- o.setState = (c, m, y) => {
308
- const E = r(c, m);
309
- if (!f)
310
- return E;
311
- const S = y === void 0 ? { type: l || "anonymous" } : typeof y == "string" ? { type: y } : y;
312
- return a === void 0 ? (i?.send(S, n()), E) : (i?.send(
313
- {
314
- ...S,
315
- type: `${a}/${S.type}`
316
- },
317
- {
318
- ...U(p.name),
319
- [a]: o.getState()
320
- }
321
- ), E);
322
- };
323
- const v = (...c) => {
324
- const m = f;
325
- f = !1, r(...c), f = m;
326
- }, _ = e(o.setState, n, o);
327
- if (s.type === "untracked" ? i?.init(_) : (s.stores[s.store] = o, i?.init(
328
- Object.fromEntries(
329
- Object.entries(s.stores).map(([c, m]) => [
330
- c,
331
- c === s.store ? _ : m.getState()
332
- ])
333
- )
334
- )), o.dispatchFromDevtools && typeof o.dispatch == "function") {
335
- let c = !1;
336
- const m = o.dispatch;
337
- o.dispatch = (...y) => {
338
- ({ BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0 } && "production") !== "production" && y[0].type === "__setState" && !c && (console.warn(
339
- '[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'
340
- ), c = !0), m(...y);
341
- };
342
- }
343
- return i.subscribe((c) => {
344
- var m;
345
- switch (c.type) {
346
- case "ACTION":
347
- if (typeof c.payload != "string") {
348
- console.error(
349
- "[zustand devtools middleware] Unsupported action format"
350
- );
351
- return;
352
- }
353
- return ee(
354
- c.payload,
355
- (y) => {
356
- if (y.type === "__setState") {
357
- if (a === void 0) {
358
- v(y.state);
359
- return;
360
- }
361
- Object.keys(y.state).length !== 1 && console.error(
362
- `
363
- [zustand devtools middleware] Unsupported __setState action format.
364
- When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
365
- and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
366
- `
367
- );
368
- const E = y.state[a];
369
- if (E == null)
370
- return;
371
- JSON.stringify(o.getState()) !== JSON.stringify(E) && v(E);
372
- return;
373
- }
374
- !o.dispatchFromDevtools || typeof o.dispatch == "function" && o.dispatch(y);
375
- }
376
- );
377
- case "DISPATCH":
378
- switch (c.payload.type) {
379
- case "RESET":
380
- return v(_), a === void 0 ? i?.init(o.getState()) : i?.init(U(p.name));
381
- case "COMMIT":
382
- if (a === void 0) {
383
- i?.init(o.getState());
384
- return;
385
- }
386
- return i?.init(U(p.name));
387
- case "ROLLBACK":
388
- return ee(c.state, (y) => {
389
- if (a === void 0) {
390
- v(y), i?.init(o.getState());
391
- return;
392
- }
393
- v(y[a]), i?.init(U(p.name));
394
- });
395
- case "JUMP_TO_STATE":
396
- case "JUMP_TO_ACTION":
397
- return ee(c.state, (y) => {
398
- if (a === void 0) {
399
- v(y);
400
- return;
401
- }
402
- JSON.stringify(o.getState()) !== JSON.stringify(y[a]) && v(y[a]);
403
- });
404
- case "IMPORT_STATE": {
405
- const { nextLiftedState: y } = c.payload, E = (m = y.computedStates.slice(-1)[0]) == null ? void 0 : m.state;
406
- if (!E)
407
- return;
408
- v(a === void 0 ? E : E[a]), i?.send(
409
- null,
410
- y
411
- );
412
- return;
413
- }
414
- case "PAUSE_RECORDING":
415
- return f = !f;
416
- }
417
- return;
418
- }
419
- }), _;
420
- }, lt = qe, ee = (e, t) => {
421
- let r;
422
- try {
423
- r = JSON.parse(e);
424
- } catch (n) {
425
- console.error(
426
- "[zustand devtools middleware] Could not parse the received json",
427
- n
428
- );
429
- }
430
- r !== void 0 && t(r);
431
- };
432
- function w(e) {
433
- for (var t = arguments.length, r = Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
434
- r[n - 1] = arguments[n];
435
- if (process.env.NODE_ENV !== "production") {
436
- var o = et[e], u = o ? typeof o == "function" ? o.apply(null, r) : o : "unknown error nr: " + e;
437
- throw Error("[Immer] " + u);
438
- }
439
- throw Error("[Immer] minified error nr: " + e + (r.length ? " " + r.map(function(l) {
440
- return "'" + l + "'";
441
- }).join(",") : "") + ". Find the full error at: https://bit.ly/3cXEKWf");
442
- }
443
- function I(e) {
444
- return !!e && !!e[P];
445
- }
446
- function x(e) {
447
- var t;
448
- return !!e && (function(r) {
449
- if (!r || typeof r != "object")
450
- return !1;
451
- var n = Object.getPrototypeOf(r);
452
- if (n === null)
453
- return !0;
454
- var o = Object.hasOwnProperty.call(n, "constructor") && n.constructor;
455
- return o === Object || typeof o == "function" && Function.toString.call(o) === tt;
456
- }(e) || Array.isArray(e) || !!e[xe] || !!(!((t = e.constructor) === null || t === void 0) && t[xe]) || le(e) || de(e));
457
- }
458
- function k(e, t, r) {
459
- r === void 0 && (r = !1), j(e) === 0 ? (r ? Object.keys : Se)(e).forEach(function(n) {
460
- r && typeof n == "symbol" || t(n, e[n], e);
461
- }) : e.forEach(function(n, o) {
462
- return t(o, n, e);
463
- });
464
- }
465
- function j(e) {
466
- var t = e[P];
467
- return t ? t.i > 3 ? t.i - 4 : t.i : Array.isArray(e) ? 1 : le(e) ? 2 : de(e) ? 3 : 0;
468
- }
469
- function ue(e, t) {
470
- return j(e) === 2 ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
471
- }
472
- function Je(e, t) {
473
- return j(e) === 2 ? e.get(t) : e[t];
474
- }
475
- function je(e, t, r) {
476
- var n = j(e);
477
- n === 2 ? e.set(t, r) : n === 3 ? e.add(r) : e[t] = r;
478
- }
479
- function $e(e, t) {
480
- return e === t ? e !== 0 || 1 / e == 1 / t : e != e && t != t;
481
- }
482
- function le(e) {
483
- return Qe && e instanceof Map;
484
- }
485
- function de(e) {
486
- return Ze && e instanceof Set;
487
- }
488
- function L(e) {
489
- return e.o || e.t;
490
- }
491
- function pe(e) {
492
- if (Array.isArray(e))
493
- return Array.prototype.slice.call(e);
494
- var t = rt(e);
495
- delete t[P];
496
- for (var r = Se(t), n = 0; n < r.length; n++) {
497
- var o = r[n], u = t[o];
498
- u.writable === !1 && (u.writable = !0, u.configurable = !0), (u.get || u.set) && (t[o] = { configurable: !0, writable: !0, enumerable: u.enumerable, value: e[o] });
499
- }
500
- return Object.create(Object.getPrototypeOf(e), t);
501
- }
502
- function ve(e, t) {
503
- return t === void 0 && (t = !1), ye(e) || I(e) || !x(e) || (j(e) > 1 && (e.set = e.add = e.clear = e.delete = Be), Object.freeze(e), t && k(e, function(r, n) {
504
- return ve(n, !0);
505
- }, !0)), e;
506
- }
507
- function Be() {
508
- w(2);
509
- }
510
- function ye(e) {
511
- return e == null || typeof e != "object" || Object.isFrozen(e);
512
- }
513
- function T(e) {
514
- var t = nt[e];
515
- return t || w(18, e), t;
516
- }
517
- function we() {
518
- return process.env.NODE_ENV === "production" || N || w(0), N;
519
- }
520
- function te(e, t) {
521
- t && (T("Patches"), e.u = [], e.s = [], e.v = t);
522
- }
523
- function z(e) {
524
- ae(e), e.p.forEach(Xe), e.p = null;
525
- }
526
- function ae(e) {
527
- e === N && (N = e.l);
528
- }
529
- function De(e) {
530
- return N = { p: [], l: N, h: e, m: !0, _: 0 };
531
- }
532
- function Xe(e) {
533
- var t = e[P];
534
- t.i === 0 || t.i === 1 ? t.j() : t.g = !0;
535
- }
536
- function re(e, t) {
537
- t._ = t.p.length;
538
- var r = t.p[0], n = e !== void 0 && e !== r;
539
- return t.h.O || T("ES5").S(t, e, n), n ? (r[P].P && (z(t), w(4)), x(e) && (e = W(t, e), t.l || K(t, e)), t.u && T("Patches").M(r[P].t, e, t.u, t.s)) : e = W(t, r, []), z(t), t.u && t.v(t.u, t.s), e !== Ve ? e : void 0;
540
- }
541
- function W(e, t, r) {
542
- if (ye(t))
543
- return t;
544
- var n = t[P];
545
- if (!n)
546
- return k(t, function(a, p) {
547
- return Pe(e, n, t, a, p, r);
548
- }, !0), t;
549
- if (n.A !== e)
550
- return t;
551
- if (!n.P)
552
- return K(e, n.t, !0), n.t;
553
- if (!n.I) {
554
- n.I = !0, n.A._--;
555
- var o = n.i === 4 || n.i === 5 ? n.o = pe(n.k) : n.o, u = o, l = !1;
556
- n.i === 3 && (u = new Set(o), o.clear(), l = !0), k(u, function(a, p) {
557
- return Pe(e, n, o, a, p, r, l);
558
- }), K(e, o, !1), r && e.u && T("Patches").N(n, r, e.u, e.s);
559
- }
560
- return n.o;
561
- }
562
- function Pe(e, t, r, n, o, u, l) {
563
- if (process.env.NODE_ENV !== "production" && o === r && w(5), I(o)) {
564
- var a = W(e, o, u && t && t.i !== 3 && !ue(t.R, n) ? u.concat(n) : void 0);
565
- if (je(r, n, a), !I(a))
566
- return;
567
- e.m = !1;
568
- } else
569
- l && r.add(o);
570
- if (x(o) && !ye(o)) {
571
- if (!e.h.D && e._ < 1)
572
- return;
573
- W(e, o), t && t.A.l || K(e, o);
574
- }
575
- }
576
- function K(e, t, r) {
577
- r === void 0 && (r = !1), !e.l && e.h.D && e.m && ve(t, r);
578
- }
579
- function ne(e, t) {
580
- var r = e[P];
581
- return (r ? L(r) : e)[t];
582
- }
583
- function Re(e, t) {
584
- if (t in e)
585
- for (var r = Object.getPrototypeOf(e); r; ) {
586
- var n = Object.getOwnPropertyDescriptor(r, t);
587
- if (n)
588
- return n;
589
- r = Object.getPrototypeOf(r);
590
- }
591
- }
592
- function ce(e) {
593
- e.P || (e.P = !0, e.l && ce(e.l));
594
- }
595
- function oe(e) {
596
- e.o || (e.o = pe(e.t));
597
- }
598
- function se(e, t, r) {
599
- var n = le(t) ? T("MapSet").F(t, r) : de(t) ? T("MapSet").T(t, r) : e.O ? function(o, u) {
600
- var l = Array.isArray(o), a = { i: l ? 1 : 0, A: u ? u.A : we(), P: !1, I: !1, R: {}, l: u, t: o, k: null, o: null, j: null, C: !1 }, p = a, d = fe;
601
- l && (p = [a], d = M);
602
- var i = Proxy.revocable(p, d), s = i.revoke, f = i.proxy;
603
- return a.k = f, a.j = s, f;
604
- }(t, r) : T("ES5").J(t, r);
605
- return (r ? r.A : we()).p.push(n), n;
606
- }
607
- function Ye(e) {
608
- return I(e) || w(22, e), function t(r) {
609
- if (!x(r))
610
- return r;
611
- var n, o = r[P], u = j(r);
612
- if (o) {
613
- if (!o.P && (o.i < 4 || !T("ES5").K(o)))
614
- return o.t;
615
- o.I = !0, n = Ae(r, u), o.I = !1;
616
- } else
617
- n = Ae(r, u);
618
- return k(n, function(l, a) {
619
- o && Je(o.t, l) === a || je(n, l, t(a));
620
- }), u === 3 ? new Set(n) : n;
621
- }(e);
622
- }
623
- function Ae(e, t) {
624
- switch (t) {
625
- case 2:
626
- return new Map(e);
627
- case 3:
628
- return Array.from(e);
629
- }
630
- return pe(e);
631
- }
632
- var Te, N, he = typeof Symbol < "u" && typeof Symbol("x") == "symbol", Qe = typeof Map < "u", Ze = typeof Set < "u", Le = typeof Proxy < "u" && Proxy.revocable !== void 0 && typeof Reflect < "u", Ve = he ? Symbol.for("immer-nothing") : ((Te = {})["immer-nothing"] = !0, Te), xe = he ? Symbol.for("immer-draftable") : "__$immer_draftable", P = he ? Symbol.for("immer-state") : "__$immer_state", et = { 0: "Illegal state", 1: "Immer drafts cannot have computed properties", 2: "This object has been frozen and should not be mutated", 3: function(e) {
633
- return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + e;
634
- }, 4: "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.", 5: "Immer forbids circular references", 6: "The first or second argument to `produce` must be a function", 7: "The third argument to `produce` must be a function or undefined", 8: "First argument to `createDraft` must be a plain object, an array, or an immerable object", 9: "First argument to `finishDraft` must be a draft returned by `createDraft`", 10: "The given draft is already finalized", 11: "Object.defineProperty() cannot be used on an Immer draft", 12: "Object.setPrototypeOf() cannot be used on an Immer draft", 13: "Immer only supports deleting array indices", 14: "Immer only supports setting array indices and the 'length' property", 15: function(e) {
635
- return "Cannot apply patch, path doesn't resolve: " + e;
636
- }, 16: 'Sets cannot have "replace" patches.', 17: function(e) {
637
- return "Unsupported patch operation: " + e;
638
- }, 18: function(e) {
639
- return "The plugin for '" + e + "' has not been loaded into Immer. To enable the plugin, import and call `enable" + e + "()` when initializing your application.";
640
- }, 20: "Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available", 21: function(e) {
641
- return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '" + e + "'";
642
- }, 22: function(e) {
643
- return "'current' expects a draft, got: " + e;
644
- }, 23: function(e) {
645
- return "'original' expects a draft, got: " + e;
646
- }, 24: "Patching reserved attributes like __proto__, prototype and constructor is not allowed" }, tt = "" + Object.prototype.constructor, Se = typeof Reflect < "u" && Reflect.ownKeys ? Reflect.ownKeys : Object.getOwnPropertySymbols !== void 0 ? function(e) {
647
- return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
648
- } : Object.getOwnPropertyNames, rt = Object.getOwnPropertyDescriptors || function(e) {
649
- var t = {};
650
- return Se(e).forEach(function(r) {
651
- t[r] = Object.getOwnPropertyDescriptor(e, r);
652
- }), t;
653
- }, nt = {}, fe = { get: function(e, t) {
654
- if (t === P)
655
- return e;
656
- var r = L(e);
657
- if (!ue(r, t))
658
- return function(o, u, l) {
659
- var a, p = Re(u, l);
660
- return p ? "value" in p ? p.value : (a = p.get) === null || a === void 0 ? void 0 : a.call(o.k) : void 0;
661
- }(e, r, t);
662
- var n = r[t];
663
- return e.I || !x(n) ? n : n === ne(e.t, t) ? (oe(e), e.o[t] = se(e.A.h, n, e)) : n;
664
- }, has: function(e, t) {
665
- return t in L(e);
666
- }, ownKeys: function(e) {
667
- return Reflect.ownKeys(L(e));
668
- }, set: function(e, t, r) {
669
- var n = Re(L(e), t);
670
- if (n?.set)
671
- return n.set.call(e.k, r), !0;
672
- if (!e.P) {
673
- var o = ne(L(e), t), u = o?.[P];
674
- if (u && u.t === r)
675
- return e.o[t] = r, e.R[t] = !1, !0;
676
- if ($e(r, o) && (r !== void 0 || ue(e.t, t)))
677
- return !0;
678
- oe(e), ce(e);
679
- }
680
- return e.o[t] === r && (r !== void 0 || t in e.o) || Number.isNaN(r) && Number.isNaN(e.o[t]) || (e.o[t] = r, e.R[t] = !0), !0;
681
- }, deleteProperty: function(e, t) {
682
- return ne(e.t, t) !== void 0 || t in e.t ? (e.R[t] = !1, oe(e), ce(e)) : delete e.R[t], e.o && delete e.o[t], !0;
683
- }, getOwnPropertyDescriptor: function(e, t) {
684
- var r = L(e), n = Reflect.getOwnPropertyDescriptor(r, t);
685
- return n && { writable: !0, configurable: e.i !== 1 || t !== "length", enumerable: n.enumerable, value: r[t] };
686
- }, defineProperty: function() {
687
- w(11);
688
- }, getPrototypeOf: function(e) {
689
- return Object.getPrototypeOf(e.t);
690
- }, setPrototypeOf: function() {
691
- w(12);
692
- } }, M = {};
693
- k(fe, function(e, t) {
694
- M[e] = function() {
695
- return arguments[0] = arguments[0][0], t.apply(this, arguments);
696
- };
697
- }), M.deleteProperty = function(e, t) {
698
- return process.env.NODE_ENV !== "production" && isNaN(parseInt(t)) && w(13), M.set.call(this, e, t, void 0);
699
- }, M.set = function(e, t, r) {
700
- return process.env.NODE_ENV !== "production" && t !== "length" && isNaN(parseInt(t)) && w(14), fe.set.call(this, e[0], t, r, e[0]);
701
- };
702
- var ot = function() {
703
- function e(r) {
704
- var n = this;
705
- this.O = Le, this.D = !0, this.produce = function(o, u, l) {
706
- if (typeof o == "function" && typeof u != "function") {
707
- var a = u;
708
- u = o;
709
- var p = n;
710
- return function(c) {
711
- var m = this;
712
- c === void 0 && (c = a);
713
- for (var y = arguments.length, E = Array(y > 1 ? y - 1 : 0), S = 1; S < y; S++)
714
- E[S - 1] = arguments[S];
715
- return p.produce(c, function(h) {
716
- var g;
717
- return (g = u).call.apply(g, [m, h].concat(E));
718
- });
719
- };
720
- }
721
- var d;
722
- if (typeof u != "function" && w(6), l !== void 0 && typeof l != "function" && w(7), x(o)) {
723
- var i = De(n), s = se(n, o, void 0), f = !0;
724
- try {
725
- d = u(s), f = !1;
726
- } finally {
727
- f ? z(i) : ae(i);
728
- }
729
- return typeof Promise < "u" && d instanceof Promise ? d.then(function(c) {
730
- return te(i, l), re(c, i);
731
- }, function(c) {
732
- throw z(i), c;
733
- }) : (te(i, l), re(d, i));
734
- }
735
- if (!o || typeof o != "object") {
736
- if ((d = u(o)) === void 0 && (d = o), d === Ve && (d = void 0), n.D && ve(d, !0), l) {
737
- var v = [], _ = [];
738
- T("Patches").M(o, d, v, _), l(v, _);
739
- }
740
- return d;
741
- }
742
- w(21, o);
743
- }, this.produceWithPatches = function(o, u) {
744
- if (typeof o == "function")
745
- return function(d) {
746
- for (var i = arguments.length, s = Array(i > 1 ? i - 1 : 0), f = 1; f < i; f++)
747
- s[f - 1] = arguments[f];
748
- return n.produceWithPatches(d, function(v) {
749
- return o.apply(void 0, [v].concat(s));
750
- });
751
- };
752
- var l, a, p = n.produce(o, u, function(d, i) {
753
- l = d, a = i;
754
- });
755
- return typeof Promise < "u" && p instanceof Promise ? p.then(function(d) {
756
- return [d, l, a];
757
- }) : [p, l, a];
758
- }, typeof r?.useProxies == "boolean" && this.setUseProxies(r.useProxies), typeof r?.autoFreeze == "boolean" && this.setAutoFreeze(r.autoFreeze);
759
- }
760
- var t = e.prototype;
761
- return t.createDraft = function(r) {
762
- x(r) || w(8), I(r) && (r = Ye(r));
763
- var n = De(this), o = se(this, r, void 0);
764
- return o[P].C = !0, ae(n), o;
765
- }, t.finishDraft = function(r, n) {
766
- var o = r && r[P];
767
- process.env.NODE_ENV !== "production" && (o && o.C || w(9), o.I && w(10));
768
- var u = o.A;
769
- return te(u, n), re(void 0, u);
770
- }, t.setAutoFreeze = function(r) {
771
- this.D = r;
772
- }, t.setUseProxies = function(r) {
773
- r && !Le && w(20), this.O = r;
774
- }, t.applyPatches = function(r, n) {
775
- var o;
776
- for (o = n.length - 1; o >= 0; o--) {
777
- var u = n[o];
778
- if (u.path.length === 0 && u.op === "replace") {
779
- r = u.value;
780
- break;
781
- }
782
- }
783
- o > -1 && (n = n.slice(o + 1));
784
- var l = T("Patches").$;
785
- return I(r) ? l(r, n) : this.produce(r, function(a) {
786
- return l(a, n);
787
- });
788
- }, e;
789
- }(), R = new ot(), it = R.produce;
790
- R.produceWithPatches.bind(R);
791
- R.setAutoFreeze.bind(R);
792
- R.setUseProxies.bind(R);
793
- R.applyPatches.bind(R);
794
- R.createDraft.bind(R);
795
- R.finishDraft.bind(R);
796
- const ut = (e) => (t, r, n) => (n.setState = (o, u, ...l) => {
797
- const a = typeof o == "function" ? it(o) : o;
798
- return t(a, u, ...l);
799
- }, e(n.setState, r, n)), dt = ut;
800
- function pt(e, t) {
801
- if (Object.is(e, t))
802
- return !0;
803
- if (typeof e != "object" || e === null || typeof t != "object" || t === null)
804
- return !1;
805
- if (e instanceof Map && t instanceof Map) {
806
- if (e.size !== t.size)
807
- return !1;
808
- for (const [n, o] of e)
809
- if (!Object.is(o, t.get(n)))
810
- return !1;
811
- return !0;
812
- }
813
- if (e instanceof Set && t instanceof Set) {
814
- if (e.size !== t.size)
815
- return !1;
816
- for (const n of e)
817
- if (!t.has(n))
818
- return !1;
819
- return !0;
820
- }
821
- const r = Object.keys(e);
822
- if (r.length !== Object.keys(t).length)
823
- return !1;
824
- for (let n = 0; n < r.length; n++)
825
- if (!Object.prototype.hasOwnProperty.call(t, r[n]) || !Object.is(e[r[n]], t[r[n]]))
826
- return !1;
827
- return !0;
828
- }
829
- export {
830
- st as c,
831
- lt as d,
832
- dt as i,
833
- pt as s,
834
- ft as u
835
- };