@ptolemy2002/react-proxy-context 2.3.5 → 2.4.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/README.md CHANGED
@@ -24,22 +24,18 @@ type Dependency<_T, T=Exclude<_T, null | undefined>> = keyof T | (
24
24
  <K extends keyof T>(prop: K, current: T[K], prev: T[K], obj: T) => boolean
25
25
  ) | null | undefined | false | [keyof T, ...PropertyKey[]];
26
26
 
27
- type ProxyContext<T> = ContextWithName<ProxyContextValue<T> | undefined>;
27
+ type ProxyContext<T> = ContextWithName<ProxyContextValueWrapper<T> | undefined>;
28
28
 
29
- type ProxyContextValue<T> = {
30
- obj: T;
31
- set: (newObj: T) => T;
32
- subscribe: (
33
- propCallback: OnChangePropCallback<T>,
34
- reinitCallback: OnChangeReinitCallback<T>,
35
- deps: Dependency<T>[]
36
- ) => string;
37
- unsubscribe: (id: string) => void;
29
+ type ProxyContextChangeSubscriber<T> = {
30
+ id: string;
31
+ deps: Dependency<T>[] | null;
32
+ propCallback: OnChangePropCallback<T>;
33
+ reinitCallback: OnChangeReinitCallback<T>;
38
34
  };
39
35
 
40
36
  type ProxyContextProviderProps<T> = {
41
37
  children: ReactNode;
42
- value: T;
38
+ value: T | ProxyContextValueWrapper<T>;
43
39
  onChangeProp?: OnChangePropCallback<T>;
44
40
  onChangeReinit?: OnChangeReinitCallback<T>;
45
41
  proxyRef?: React.MutableRefObject<T>;
@@ -51,6 +47,36 @@ type UseProxyContextResult<T> = HookResultData<{
51
47
  }, readonly [T, (newObj: T) => T]>;
52
48
  ```
53
49
 
50
+ ## Classes
51
+ The following classes are available in the library:
52
+
53
+ ### ProxyContextValueWrapper<T>
54
+ #### Description
55
+ A class that wraps a value and provides proxy-based reactivity through subscription management. This class manages the proxy object internally and allows subscribers to listen to both property mutations and full object reassignments. The main benefit of this class is that it allows you to initialize a proxied value outside of a React context and pass it into the provider later, giving you more control over the proxy lifecycle.
56
+
57
+ #### Constructor
58
+ - `value` (`T`): The initial value to wrap in a proxy.
59
+
60
+ #### Methods
61
+ - `get()`: Returns the current proxied value.
62
+ - Returns: `T`
63
+ - `set(newObj: T)`: Sets a new value and wraps it in a proxy. Emits reinit events to all subscribers.
64
+ - Parameters:
65
+ - `newObj` (`T`): The new value to set
66
+ - Returns: `T` - The new proxied value
67
+ - `subscribe(propCallback, reinitCallback, deps)`: Subscribes to changes in the proxied object.
68
+ - Parameters:
69
+ - `propCallback` (`OnChangePropCallback<T>`): Called when a property changes
70
+ - `reinitCallback` (`OnChangeReinitCallback<T>`): Called when the entire object is reassigned
71
+ - `deps` (`Dependency<T>[] | null`): Array of dependencies to listen to, or null to listen to all changes
72
+ - Returns: `string` - A unique subscription ID
73
+ - `unsubscribe(id: string)`: Unsubscribes from changes using the subscription ID.
74
+ - `emitChange(prop, current, prev?)`: Emits a property change event to all relevant subscribers (internal use).
75
+ - `emitReinit(current, prev?)`: Emits a reinitialization event to all subscribers (internal use).
76
+
77
+ #### Properties
78
+ - `changeSubscribers`: A record of all current subscribers (internal use).
79
+
54
80
  ## Functions
55
81
  The following functions are available in the library:
56
82
 
@@ -74,7 +100,7 @@ Creates a new instance of the ProxyContext, essentially to be used as the contex
74
100
  #### Returns
75
101
  `ProxyContext<T>` - The context object that can be used in a provider.
76
102
 
77
- ### createProxyContextProvider<T extends object>
103
+ ### createProxyContextProvider<T extends object | null>
78
104
  #### Description
79
105
  Creates a new proxy context provider component with the specified type. `ProxyContextProvider` is no longer used due to a TypeScript limitation that prevents the context type from being inferred.
80
106
 
@@ -84,8 +110,8 @@ Creates a new proxy context provider component with the specified type. `ProxyCo
84
110
  #### Returns
85
111
  `React.MemoExoticComponent<FunctionComponent<ProxyContextProviderProps<T> & { renderDeps?: any[] }>>` - The provider component that can be used in the React tree. The resulting component is memoized to prevent unnecessary re-renders, but the `renderDeps` prop can be used to force a re-render when the specified dependencies change (necessary when working with the children prop).
86
112
 
87
- The component has the following other props:
88
- - `value` (T): The value of the context. This is what is reported when the context is not provided.
113
+ The component has the following props:
114
+ - `value` (`T | ProxyContextValueWrapper<T>`): The value of the context. This can be either a raw value of type `T`, which will be automatically wrapped in a `ProxyContextValueWrapper`, or a pre-existing `ProxyContextValueWrapper<T>` instance. This allows you to initialize the wrapper outside of the context and pass it in, giving you more control over the proxy lifecycle.
89
115
  - `onChangeProp` (`OnChangePropCallback<T>`): A function that is called whenever a property of the context is changed. The first parameter is the property that was changed, the second parameter is the current value of the property, and the third parameter is the previous value of the property. This is useful for listening to changes in the provider's parent component.
90
116
  - `onChangeReinit` (`OnChangeReinitCallback<T>`): A function that is called whenever the context is reinitialized. The first parameter is the current value of the context, and the second parameter is the previous value of the context. This is useful for listening to changes in the provider's parent component.
91
117
  - `proxyRef` (`React.MutableRefObject<T>`): A ref object that is assigned the proxy object of the context. This is useful for accessing the proxy object directly by the provider's parent component.
@@ -94,17 +120,17 @@ The component has the following other props:
94
120
  The following hooks are available in the library:
95
121
 
96
122
  ### useProxyContext<T>
97
- A hook that uses the context provided by the `ProxyContextProvider` component. This hook also provides options to choose which properties to listen to and whether to listen to full reassignments. `T` represents the type of the object that is stored in the context.
123
+ A hook that uses the context provided by the `ProxyContextProvider` component. This hook uses React 18's `useSyncExternalStore` for optimal concurrent rendering support and provides options to choose which properties to listen to and whether to listen to full reassignments. `T` represents the type of the object that is stored in the context.
98
124
 
99
125
  #### Parameters
100
126
  - `contextClass` (`ProxyContext<T>`): The context class that was created using `createProxyContext`.
101
127
  - `deps` (`Dependency<T>[] | null`): An array of dependencies to listen to. If any of these properties on the context change, the hook will re-render. If this is falsy, any mutation will trigger a re-render. If a dependency is an array, it represents a nested property dependency. You can also specify a function that returns a boolean to determine whether to re-render. By default, this is an empty array.
102
- - `onChangeProp` (`OnChangePropCallback<T> | undefined`): A function that is called whenever a property of the context is changed. The first parameter is the property that was changed, the second parameter is the current value of the property, and the third parameter is the previous value of the property. This is useful for listening to changes in the provider's parent component.
103
- - `onChangeReinit` (`OnChangeReinitCallback<T> | undefined`): A function that is called whenever the context is reinitialized. The first parameter is the current value of the context, and the second parameter is the previous value of the context. This is useful for listening to changes in the provider's parent component.
128
+ - `onChangeProp` (`OnChangePropCallback<T> | undefined`): A function that is called whenever a property of the context is changed. The first parameter is the property that was changed, the second parameter is the current value of the property, and the third parameter is the previous value of the property. This is useful for listening to changes in the consumer component.
129
+ - `onChangeReinit` (`OnChangeReinitCallback<T> | undefined`): A function that is called whenever the context is reinitialized. The first parameter is the current value of the context, and the second parameter is the previous value of the context. Also called on initial initialization with the second parameter being `undefined`. This is useful for listening to changes in the consumer component.
104
130
  - `listenReinit` (`boolean`): Whether to listen to full reassignments of the context. If this is true, the hook will re-render whenever the context is reinitialized. By default, this is true.
105
131
 
106
132
  #### Returns
107
- `UseProxyContextResult<T>` - An object containing the current value of the context and a function to set the context. The function returns the new value of the context wrapped in a `Proxy`.
133
+ `UseProxyContextResult<T>` - An object containing the current value of the context and a function to set the context. The `value` property returns the unwrapped proxied object, and the `set` function returns the new value of the context wrapped in a `Proxy`. The hook subscribes to the `ProxyContextValueWrapper` and automatically manages subscription cleanup.
108
134
 
109
135
  ## Peer Dependencies
110
136
  These should be installed in order to use the library, as npm does not automatically add peer dependencies to your project.
package/dist/main.d.ts CHANGED
@@ -5,25 +5,36 @@ export type ContextWithName<T> = Context<T> & {
5
5
  };
6
6
  export type OnChangePropCallback<T> = <K extends keyof T>(prop: K, current: T[K], prev?: T[K]) => void;
7
7
  export type OnChangeReinitCallback<T> = (current: T, prev?: T) => void;
8
- export type ProxyContextValue<T> = {
9
- obj: T;
10
- set: (newObj: T) => T;
11
- subscribe: (propCallback: OnChangePropCallback<T>, reinitCallback: OnChangeReinitCallback<T>, deps: Dependency<T>[] | null) => string;
12
- unsubscribe: (id: string) => void;
13
- };
14
8
  export declare function createProxyContext<T>(name: string): ProxyContext<T>;
15
9
  export type Dependency<_T, T = Exclude<_T, null | undefined>> = keyof T | (<K extends keyof T>(prop: K, current: T[K], prev: T[K], obj: T) => boolean) | null | undefined | false | [keyof T, ...PropertyKey[]];
16
10
  export declare function evaluateDependency<T>(dep: Dependency<T>): Exclude<Dependency<T>, any[]>;
17
- export type ProxyContext<T> = ContextWithName<ProxyContextValue<T> | undefined>;
11
+ export type ProxyContext<T> = ContextWithName<ProxyContextValueWrapper<T> | undefined>;
18
12
  export type ProxyContextProviderProps<T> = {
19
13
  children: ReactNode;
20
- value: T;
14
+ value: T | ProxyContextValueWrapper<T>;
21
15
  onChangeProp?: OnChangePropCallback<T>;
22
16
  onChangeReinit?: OnChangeReinitCallback<T>;
23
17
  proxyRef?: React.MutableRefObject<T>;
24
18
  };
19
+ export type ProxyContextChangeSubscriber<T> = {
20
+ id: string;
21
+ deps: Dependency<T>[] | null;
22
+ propCallback: OnChangePropCallback<T>;
23
+ reinitCallback: OnChangeReinitCallback<T>;
24
+ };
25
+ export declare class ProxyContextValueWrapper<T> {
26
+ private value;
27
+ changeSubscribers: Record<string, ProxyContextChangeSubscriber<T>>;
28
+ constructor(value: T);
29
+ subscribe(propCallback: OnChangePropCallback<T>, reinitCallback: OnChangeReinitCallback<T>, deps: Dependency<T>[] | null): string;
30
+ unsubscribe(id: string): void;
31
+ emitChange(prop: keyof T, current: T[keyof T], prev?: T[keyof T]): void;
32
+ emitReinit(current: T, prev?: T): void;
33
+ get(): T;
34
+ set(newObj: T): T;
35
+ }
25
36
  export declare function createProxyContextProvider<T extends object | null>(contextClass: ProxyContext<T>): import('react').MemoExoticComponent<import('react').FunctionComponent<ProxyContextProviderProps<T> & {
26
- renderDeps?: any[];
37
+ renderDeps?: unknown[] | null | false;
27
38
  }>>;
28
39
  export type UseProxyContextResult<T> = HookResultData<{
29
40
  value: T;
package/dist/main.js CHANGED
@@ -1,10 +1,13 @@
1
- import Fe, { createContext as vr, useRef as X, useImperativeHandle as pr, useCallback as L, useContext as br, useSyncExternalStore as yr } from "react";
2
- import { nanoid as mr } from "nanoid";
3
- import V from "is-callable";
1
+ var dr = Object.defineProperty;
2
+ var pr = (h, a, l) => a in h ? dr(h, a, { enumerable: !0, configurable: !0, writable: !0, value: l }) : h[a] = l;
3
+ var X = (h, a, l) => pr(h, typeof a != "symbol" ? a + "" : a, l);
4
+ import Oe, { createContext as br, useRef as Ce, useImperativeHandle as hr, useEffect as yr, useContext as mr, useCallback as Er, useSyncExternalStore as gr } from "react";
5
+ import { nanoid as _r } from "nanoid";
6
+ import Y from "is-callable";
4
7
  import Rr from "@ptolemy2002/react-force-rerender";
5
- import Er from "@ptolemy2002/react-hook-result";
6
- import { partialMemo as gr } from "@ptolemy2002/react-utils";
7
- var ue = { exports: {} }, J = {};
8
+ import Tr from "@ptolemy2002/react-hook-result";
9
+ import { partialMemo as Sr } from "@ptolemy2002/react-utils";
10
+ var Z = { exports: {} }, $ = {};
8
11
  /**
9
12
  * @license React
10
13
  * react-jsx-runtime.production.min.js
@@ -14,21 +17,21 @@ var ue = { exports: {} }, J = {};
14
17
  * This source code is licensed under the MIT license found in the
15
18
  * LICENSE file in the root directory of this source tree.
16
19
  */
17
- var De;
18
- function hr() {
19
- if (De) return J;
20
- De = 1;
21
- var E = Fe, g = Symbol.for("react.element"), C = Symbol.for("react.fragment"), y = Object.prototype.hasOwnProperty, T = E.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, R = { key: !0, ref: !0, __self: !0, __source: !0 };
22
- function l(i, s, j) {
23
- var m, h = {}, x = null, A = null;
24
- j !== void 0 && (x = "" + j), s.key !== void 0 && (x = "" + s.key), s.ref !== void 0 && (A = s.ref);
25
- for (m in s) y.call(s, m) && !R.hasOwnProperty(m) && (h[m] = s[m]);
26
- if (i && i.defaultProps) for (m in s = i.defaultProps, s) h[m] === void 0 && (h[m] = s[m]);
27
- return { $$typeof: g, type: i, key: x, ref: A, props: h, _owner: T.current };
20
+ var xe;
21
+ function xr() {
22
+ if (xe) return $;
23
+ xe = 1;
24
+ var h = Oe, a = Symbol.for("react.element"), l = Symbol.for("react.fragment"), p = Object.prototype.hasOwnProperty, c = h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, b = { key: !0, ref: !0, __self: !0, __source: !0 };
25
+ function i(v, d, x) {
26
+ var E, T = {}, P = null, k = null;
27
+ x !== void 0 && (P = "" + x), d.key !== void 0 && (P = "" + d.key), d.ref !== void 0 && (k = d.ref);
28
+ for (E in d) p.call(d, E) && !b.hasOwnProperty(E) && (T[E] = d[E]);
29
+ if (v && v.defaultProps) for (E in d = v.defaultProps, d) T[E] === void 0 && (T[E] = d[E]);
30
+ return { $$typeof: a, type: v, key: P, ref: k, props: T, _owner: c.current };
28
31
  }
29
- return J.Fragment = C, J.jsx = l, J.jsxs = l, J;
32
+ return $.Fragment = l, $.jsx = i, $.jsxs = i, $;
30
33
  }
31
- var q = {};
34
+ var W = {};
32
35
  /**
33
36
  * @license React
34
37
  * react-jsx-runtime.development.js
@@ -38,91 +41,91 @@ var q = {};
38
41
  * This source code is licensed under the MIT license found in the
39
42
  * LICENSE file in the root directory of this source tree.
40
43
  */
41
- var Ae;
42
- function _r() {
43
- return Ae || (Ae = 1, process.env.NODE_ENV !== "production" && function() {
44
- var E = Fe, g = Symbol.for("react.element"), C = Symbol.for("react.portal"), y = Symbol.for("react.fragment"), T = Symbol.for("react.strict_mode"), R = Symbol.for("react.profiler"), l = Symbol.for("react.provider"), i = Symbol.for("react.context"), s = Symbol.for("react.forward_ref"), j = Symbol.for("react.suspense"), m = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), x = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), M = Symbol.iterator, p = "@@iterator";
45
- function P(e) {
44
+ var Pe;
45
+ function Pr() {
46
+ return Pe || (Pe = 1, process.env.NODE_ENV !== "production" && function() {
47
+ var h = Oe, a = Symbol.for("react.element"), l = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), c = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), i = Symbol.for("react.provider"), v = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), x = Symbol.for("react.suspense"), E = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), P = Symbol.for("react.lazy"), k = Symbol.for("react.offscreen"), Q = Symbol.iterator, ke = "@@iterator";
48
+ function je(e) {
46
49
  if (e === null || typeof e != "object")
47
50
  return null;
48
- var r = M && e[M] || e[p];
51
+ var r = Q && e[Q] || e[ke];
49
52
  return typeof r == "function" ? r : null;
50
53
  }
51
- var d = E.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
52
- function c(e) {
54
+ var j = h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
55
+ function g(e) {
53
56
  {
54
57
  for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
55
58
  t[n - 1] = arguments[n];
56
- w("error", e, t);
59
+ De("error", e, t);
57
60
  }
58
61
  }
59
- function w(e, r, t) {
62
+ function De(e, r, t) {
60
63
  {
61
- var n = d.ReactDebugCurrentFrame, u = n.getStackAddendum();
62
- u !== "" && (r += "%s", t = t.concat([u]));
63
- var f = t.map(function(o) {
64
- return String(o);
64
+ var n = j.ReactDebugCurrentFrame, s = n.getStackAddendum();
65
+ s !== "" && (r += "%s", t = t.concat([s]));
66
+ var f = t.map(function(u) {
67
+ return String(u);
65
68
  });
66
69
  f.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, f);
67
70
  }
68
71
  }
69
- var D = !1, $ = !1, Ie = !1, $e = !1, We = !1, se;
70
- se = Symbol.for("react.module.reference");
72
+ var Fe = !1, Ae = !1, Ie = !1, $e = !1, We = !1, ee;
73
+ ee = Symbol.for("react.module.reference");
71
74
  function Ye(e) {
72
- return !!(typeof e == "string" || typeof e == "function" || e === y || e === R || We || e === T || e === j || e === m || $e || e === A || D || $ || Ie || typeof e == "object" && e !== null && (e.$$typeof === x || e.$$typeof === h || e.$$typeof === l || e.$$typeof === i || e.$$typeof === s || // This needs to include all possible module reference object
75
+ return !!(typeof e == "string" || typeof e == "function" || e === p || e === b || We || e === c || e === x || e === E || $e || e === k || Fe || Ae || Ie || typeof e == "object" && e !== null && (e.$$typeof === P || e.$$typeof === T || e.$$typeof === i || e.$$typeof === v || e.$$typeof === d || // This needs to include all possible module reference object
73
76
  // types supported by any Flight configuration anywhere since
74
77
  // we don't know which Flight build this will end up being used
75
78
  // with.
76
- e.$$typeof === se || e.getModuleId !== void 0));
79
+ e.$$typeof === ee || e.getModuleId !== void 0));
77
80
  }
78
- function Le(e, r, t) {
81
+ function Ve(e, r, t) {
79
82
  var n = e.displayName;
80
83
  if (n)
81
84
  return n;
82
- var u = r.displayName || r.name || "";
83
- return u !== "" ? t + "(" + u + ")" : t;
85
+ var s = r.displayName || r.name || "";
86
+ return s !== "" ? t + "(" + s + ")" : t;
84
87
  }
85
- function ce(e) {
88
+ function re(e) {
86
89
  return e.displayName || "Context";
87
90
  }
88
- function k(e) {
91
+ function w(e) {
89
92
  if (e == null)
90
93
  return null;
91
- if (typeof e.tag == "number" && c("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
94
+ if (typeof e.tag == "number" && g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
92
95
  return e.displayName || e.name || null;
93
96
  if (typeof e == "string")
94
97
  return e;
95
98
  switch (e) {
96
- case y:
99
+ case p:
97
100
  return "Fragment";
98
- case C:
101
+ case l:
99
102
  return "Portal";
100
- case R:
103
+ case b:
101
104
  return "Profiler";
102
- case T:
105
+ case c:
103
106
  return "StrictMode";
104
- case j:
107
+ case x:
105
108
  return "Suspense";
106
- case m:
109
+ case E:
107
110
  return "SuspenseList";
108
111
  }
109
112
  if (typeof e == "object")
110
113
  switch (e.$$typeof) {
111
- case i:
114
+ case v:
112
115
  var r = e;
113
- return ce(r) + ".Consumer";
114
- case l:
116
+ return re(r) + ".Consumer";
117
+ case i:
115
118
  var t = e;
116
- return ce(t._context) + ".Provider";
117
- case s:
118
- return Le(e, e.render, "ForwardRef");
119
- case h:
119
+ return re(t._context) + ".Provider";
120
+ case d:
121
+ return Ve(e, e.render, "ForwardRef");
122
+ case T:
120
123
  var n = e.displayName || null;
121
- return n !== null ? n : k(e.type) || "Memo";
122
- case x: {
123
- var u = e, f = u._payload, o = u._init;
124
+ return n !== null ? n : w(e.type) || "Memo";
125
+ case P: {
126
+ var s = e, f = s._payload, u = s._init;
124
127
  try {
125
- return k(o(f));
128
+ return w(u(f));
126
129
  } catch {
127
130
  return null;
128
131
  }
@@ -130,18 +133,18 @@ function _r() {
130
133
  }
131
134
  return null;
132
135
  }
133
- var F = Object.assign, U = 0, fe, le, de, ve, pe, be, ye;
134
- function me() {
136
+ var O = Object.assign, A = 0, te, ne, ae, ie, oe, ue, se;
137
+ function ce() {
135
138
  }
136
- me.__reactDisabledLog = !0;
137
- function Ve() {
139
+ ce.__reactDisabledLog = !0;
140
+ function Le() {
138
141
  {
139
- if (U === 0) {
140
- fe = console.log, le = console.info, de = console.warn, ve = console.error, pe = console.group, be = console.groupCollapsed, ye = console.groupEnd;
142
+ if (A === 0) {
143
+ te = console.log, ne = console.info, ae = console.warn, ie = console.error, oe = console.group, ue = console.groupCollapsed, se = console.groupEnd;
141
144
  var e = {
142
145
  configurable: !0,
143
146
  enumerable: !0,
144
- value: me,
147
+ value: ce,
145
148
  writable: !0
146
149
  };
147
150
  Object.defineProperties(console, {
@@ -154,199 +157,199 @@ function _r() {
154
157
  groupEnd: e
155
158
  });
156
159
  }
157
- U++;
160
+ A++;
158
161
  }
159
162
  }
160
163
  function Me() {
161
164
  {
162
- if (U--, U === 0) {
165
+ if (A--, A === 0) {
163
166
  var e = {
164
167
  configurable: !0,
165
168
  enumerable: !0,
166
169
  writable: !0
167
170
  };
168
171
  Object.defineProperties(console, {
169
- log: F({}, e, {
170
- value: fe
172
+ log: O({}, e, {
173
+ value: te
171
174
  }),
172
- info: F({}, e, {
173
- value: le
175
+ info: O({}, e, {
176
+ value: ne
174
177
  }),
175
- warn: F({}, e, {
176
- value: de
178
+ warn: O({}, e, {
179
+ value: ae
177
180
  }),
178
- error: F({}, e, {
179
- value: ve
181
+ error: O({}, e, {
182
+ value: ie
180
183
  }),
181
- group: F({}, e, {
182
- value: pe
184
+ group: O({}, e, {
185
+ value: oe
183
186
  }),
184
- groupCollapsed: F({}, e, {
185
- value: be
187
+ groupCollapsed: O({}, e, {
188
+ value: ue
186
189
  }),
187
- groupEnd: F({}, e, {
188
- value: ye
190
+ groupEnd: O({}, e, {
191
+ value: se
189
192
  })
190
193
  });
191
194
  }
192
- U < 0 && c("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
195
+ A < 0 && g("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
193
196
  }
194
197
  }
195
- var Z = d.ReactCurrentDispatcher, Q;
196
- function K(e, r, t) {
198
+ var N = j.ReactCurrentDispatcher, B;
199
+ function V(e, r, t) {
197
200
  {
198
- if (Q === void 0)
201
+ if (B === void 0)
199
202
  try {
200
203
  throw Error();
201
- } catch (u) {
202
- var n = u.stack.trim().match(/\n( *(at )?)/);
203
- Q = n && n[1] || "";
204
+ } catch (s) {
205
+ var n = s.stack.trim().match(/\n( *(at )?)/);
206
+ B = n && n[1] || "";
204
207
  }
205
208
  return `
206
- ` + Q + e;
209
+ ` + B + e;
207
210
  }
208
211
  }
209
- var ee = !1, G;
212
+ var J = !1, L;
210
213
  {
211
214
  var Ue = typeof WeakMap == "function" ? WeakMap : Map;
212
- G = new Ue();
215
+ L = new Ue();
213
216
  }
214
- function Re(e, r) {
215
- if (!e || ee)
217
+ function le(e, r) {
218
+ if (!e || J)
216
219
  return "";
217
220
  {
218
- var t = G.get(e);
221
+ var t = L.get(e);
219
222
  if (t !== void 0)
220
223
  return t;
221
224
  }
222
225
  var n;
223
- ee = !0;
224
- var u = Error.prepareStackTrace;
226
+ J = !0;
227
+ var s = Error.prepareStackTrace;
225
228
  Error.prepareStackTrace = void 0;
226
229
  var f;
227
- f = Z.current, Z.current = null, Ve();
230
+ f = N.current, N.current = null, Le();
228
231
  try {
229
232
  if (r) {
230
- var o = function() {
233
+ var u = function() {
231
234
  throw Error();
232
235
  };
233
- if (Object.defineProperty(o.prototype, "props", {
236
+ if (Object.defineProperty(u.prototype, "props", {
234
237
  set: function() {
235
238
  throw Error();
236
239
  }
237
240
  }), typeof Reflect == "object" && Reflect.construct) {
238
241
  try {
239
- Reflect.construct(o, []);
240
- } catch (S) {
241
- n = S;
242
+ Reflect.construct(u, []);
243
+ } catch (R) {
244
+ n = R;
242
245
  }
243
- Reflect.construct(e, [], o);
246
+ Reflect.construct(e, [], u);
244
247
  } else {
245
248
  try {
246
- o.call();
247
- } catch (S) {
248
- n = S;
249
+ u.call();
250
+ } catch (R) {
251
+ n = R;
249
252
  }
250
- e.call(o.prototype);
253
+ e.call(u.prototype);
251
254
  }
252
255
  } else {
253
256
  try {
254
257
  throw Error();
255
- } catch (S) {
256
- n = S;
258
+ } catch (R) {
259
+ n = R;
257
260
  }
258
261
  e();
259
262
  }
260
- } catch (S) {
261
- if (S && n && typeof S.stack == "string") {
262
- for (var a = S.stack.split(`
263
+ } catch (R) {
264
+ if (R && n && typeof R.stack == "string") {
265
+ for (var o = R.stack.split(`
263
266
  `), _ = n.stack.split(`
264
- `), v = a.length - 1, b = _.length - 1; v >= 1 && b >= 0 && a[v] !== _[b]; )
265
- b--;
266
- for (; v >= 1 && b >= 0; v--, b--)
267
- if (a[v] !== _[b]) {
268
- if (v !== 1 || b !== 1)
267
+ `), y = o.length - 1, m = _.length - 1; y >= 1 && m >= 0 && o[y] !== _[m]; )
268
+ m--;
269
+ for (; y >= 1 && m >= 0; y--, m--)
270
+ if (o[y] !== _[m]) {
271
+ if (y !== 1 || m !== 1)
269
272
  do
270
- if (v--, b--, b < 0 || a[v] !== _[b]) {
271
- var O = `
272
- ` + a[v].replace(" at new ", " at ");
273
- return e.displayName && O.includes("<anonymous>") && (O = O.replace("<anonymous>", e.displayName)), typeof e == "function" && G.set(e, O), O;
273
+ if (y--, m--, m < 0 || o[y] !== _[m]) {
274
+ var S = `
275
+ ` + o[y].replace(" at new ", " at ");
276
+ return e.displayName && S.includes("<anonymous>") && (S = S.replace("<anonymous>", e.displayName)), typeof e == "function" && L.set(e, S), S;
274
277
  }
275
- while (v >= 1 && b >= 0);
278
+ while (y >= 1 && m >= 0);
276
279
  break;
277
280
  }
278
281
  }
279
282
  } finally {
280
- ee = !1, Z.current = f, Me(), Error.prepareStackTrace = u;
283
+ J = !1, N.current = f, Me(), Error.prepareStackTrace = s;
281
284
  }
282
- var Y = e ? e.displayName || e.name : "", I = Y ? K(Y) : "";
283
- return typeof e == "function" && G.set(e, I), I;
285
+ var F = e ? e.displayName || e.name : "", C = F ? V(F) : "";
286
+ return typeof e == "function" && L.set(e, C), C;
284
287
  }
285
288
  function Ne(e, r, t) {
286
- return Re(e, !1);
289
+ return le(e, !1);
287
290
  }
288
291
  function Be(e) {
289
292
  var r = e.prototype;
290
293
  return !!(r && r.isReactComponent);
291
294
  }
292
- function z(e, r, t) {
295
+ function M(e, r, t) {
293
296
  if (e == null)
294
297
  return "";
295
298
  if (typeof e == "function")
296
- return Re(e, Be(e));
299
+ return le(e, Be(e));
297
300
  if (typeof e == "string")
298
- return K(e);
301
+ return V(e);
299
302
  switch (e) {
300
- case j:
301
- return K("Suspense");
302
- case m:
303
- return K("SuspenseList");
303
+ case x:
304
+ return V("Suspense");
305
+ case E:
306
+ return V("SuspenseList");
304
307
  }
305
308
  if (typeof e == "object")
306
309
  switch (e.$$typeof) {
307
- case s:
310
+ case d:
308
311
  return Ne(e.render);
309
- case h:
310
- return z(e.type, r, t);
311
- case x: {
312
- var n = e, u = n._payload, f = n._init;
312
+ case T:
313
+ return M(e.type, r, t);
314
+ case P: {
315
+ var n = e, s = n._payload, f = n._init;
313
316
  try {
314
- return z(f(u), r, t);
317
+ return M(f(s), r, t);
315
318
  } catch {
316
319
  }
317
320
  }
318
321
  }
319
322
  return "";
320
323
  }
321
- var N = Object.prototype.hasOwnProperty, Ee = {}, ge = d.ReactDebugCurrentFrame;
322
- function H(e) {
324
+ var I = Object.prototype.hasOwnProperty, fe = {}, ve = j.ReactDebugCurrentFrame;
325
+ function U(e) {
323
326
  if (e) {
324
- var r = e._owner, t = z(e.type, e._source, r ? r.type : null);
325
- ge.setExtraStackFrame(t);
327
+ var r = e._owner, t = M(e.type, e._source, r ? r.type : null);
328
+ ve.setExtraStackFrame(t);
326
329
  } else
327
- ge.setExtraStackFrame(null);
330
+ ve.setExtraStackFrame(null);
328
331
  }
329
- function Je(e, r, t, n, u) {
332
+ function Je(e, r, t, n, s) {
330
333
  {
331
- var f = Function.call.bind(N);
332
- for (var o in e)
333
- if (f(e, o)) {
334
- var a = void 0;
334
+ var f = Function.call.bind(I);
335
+ for (var u in e)
336
+ if (f(e, u)) {
337
+ var o = void 0;
335
338
  try {
336
- if (typeof e[o] != "function") {
337
- var _ = Error((n || "React class") + ": " + t + " type `" + o + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[o] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
339
+ if (typeof e[u] != "function") {
340
+ var _ = Error((n || "React class") + ": " + t + " 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`.");
338
341
  throw _.name = "Invariant Violation", _;
339
342
  }
340
- a = e[o](r, o, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
341
- } catch (v) {
342
- a = v;
343
+ o = e[u](r, u, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
344
+ } catch (y) {
345
+ o = y;
343
346
  }
344
- a && !(a instanceof Error) && (H(u), c("%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).", n || "React class", t, o, typeof a), H(null)), a instanceof Error && !(a.message in Ee) && (Ee[a.message] = !0, H(u), c("Failed %s type: %s", t, a.message), H(null));
347
+ o && !(o instanceof Error) && (U(s), g("%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).", n || "React class", t, u, typeof o), U(null)), o instanceof Error && !(o.message in fe) && (fe[o.message] = !0, U(s), g("Failed %s type: %s", t, o.message), U(null));
345
348
  }
346
349
  }
347
350
  }
348
351
  var qe = Array.isArray;
349
- function re(e) {
352
+ function q(e) {
350
353
  return qe(e);
351
354
  }
352
355
  function Ke(e) {
@@ -357,27 +360,26 @@ function _r() {
357
360
  }
358
361
  function Ge(e) {
359
362
  try {
360
- return he(e), !1;
363
+ return de(e), !1;
361
364
  } catch {
362
365
  return !0;
363
366
  }
364
367
  }
365
- function he(e) {
368
+ function de(e) {
366
369
  return "" + e;
367
370
  }
368
- function _e(e) {
371
+ function pe(e) {
369
372
  if (Ge(e))
370
- return c("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(e)), he(e);
373
+ return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(e)), de(e);
371
374
  }
372
- var B = d.ReactCurrentOwner, ze = {
375
+ var be = j.ReactCurrentOwner, ze = {
373
376
  key: !0,
374
377
  ref: !0,
375
378
  __self: !0,
376
379
  __source: !0
377
- }, Te, xe, te;
378
- te = {};
380
+ }, he, ye;
379
381
  function He(e) {
380
- if (N.call(e, "ref")) {
382
+ if (I.call(e, "ref")) {
381
383
  var r = Object.getOwnPropertyDescriptor(e, "ref").get;
382
384
  if (r && r.isReactWarning)
383
385
  return !1;
@@ -385,7 +387,7 @@ function _r() {
385
387
  return e.ref !== void 0;
386
388
  }
387
389
  function Xe(e) {
388
- if (N.call(e, "key")) {
390
+ if (I.call(e, "key")) {
389
391
  var r = Object.getOwnPropertyDescriptor(e, "key").get;
390
392
  if (r && r.isReactWarning)
391
393
  return !1;
@@ -393,15 +395,12 @@ function _r() {
393
395
  return e.key !== void 0;
394
396
  }
395
397
  function Ze(e, r) {
396
- if (typeof e.ref == "string" && B.current && r && B.current.stateNode !== r) {
397
- var t = k(B.current.type);
398
- te[t] || (c('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', k(B.current.type), e.ref), te[t] = !0);
399
- }
398
+ typeof e.ref == "string" && be.current;
400
399
  }
401
400
  function Qe(e, r) {
402
401
  {
403
402
  var t = function() {
404
- Te || (Te = !0, c("%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
+ he || (he = !0, g("%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));
405
404
  };
406
405
  t.isReactWarning = !0, Object.defineProperty(e, "key", {
407
406
  get: t,
@@ -412,7 +411,7 @@ function _r() {
412
411
  function er(e, r) {
413
412
  {
414
413
  var t = function() {
415
- xe || (xe = !0, c("%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
+ ye || (ye = !0, g("%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));
416
415
  };
417
416
  t.isReactWarning = !0, Object.defineProperty(e, "ref", {
418
417
  get: t,
@@ -420,70 +419,70 @@ function _r() {
420
419
  });
421
420
  }
422
421
  }
423
- var rr = function(e, r, t, n, u, f, o) {
424
- var a = {
422
+ var rr = function(e, r, t, n, s, f, u) {
423
+ var o = {
425
424
  // This tag allows us to uniquely identify this as a React Element
426
- $$typeof: g,
425
+ $$typeof: a,
427
426
  // Built-in properties that belong on the element
428
427
  type: e,
429
428
  key: r,
430
429
  ref: t,
431
- props: o,
430
+ props: u,
432
431
  // Record the component responsible for creating this element.
433
432
  _owner: f
434
433
  };
435
- return a._store = {}, Object.defineProperty(a._store, "validated", {
434
+ return o._store = {}, Object.defineProperty(o._store, "validated", {
436
435
  configurable: !1,
437
436
  enumerable: !1,
438
437
  writable: !0,
439
438
  value: !1
440
- }), Object.defineProperty(a, "_self", {
439
+ }), Object.defineProperty(o, "_self", {
441
440
  configurable: !1,
442
441
  enumerable: !1,
443
442
  writable: !1,
444
443
  value: n
445
- }), Object.defineProperty(a, "_source", {
444
+ }), Object.defineProperty(o, "_source", {
446
445
  configurable: !1,
447
446
  enumerable: !1,
448
447
  writable: !1,
449
- value: u
450
- }), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
448
+ value: s
449
+ }), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
451
450
  };
452
- function tr(e, r, t, n, u) {
451
+ function tr(e, r, t, n, s) {
453
452
  {
454
- var f, o = {}, a = null, _ = null;
455
- t !== void 0 && (_e(t), a = "" + t), Xe(r) && (_e(r.key), a = "" + r.key), He(r) && (_ = r.ref, Ze(r, u));
453
+ var f, u = {}, o = null, _ = null;
454
+ t !== void 0 && (pe(t), o = "" + t), Xe(r) && (pe(r.key), o = "" + r.key), He(r) && (_ = r.ref, Ze(r, s));
456
455
  for (f in r)
457
- N.call(r, f) && !ze.hasOwnProperty(f) && (o[f] = r[f]);
456
+ I.call(r, f) && !ze.hasOwnProperty(f) && (u[f] = r[f]);
458
457
  if (e && e.defaultProps) {
459
- var v = e.defaultProps;
460
- for (f in v)
461
- o[f] === void 0 && (o[f] = v[f]);
458
+ var y = e.defaultProps;
459
+ for (f in y)
460
+ u[f] === void 0 && (u[f] = y[f]);
462
461
  }
463
- if (a || _) {
464
- var b = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
465
- a && Qe(o, b), _ && er(o, b);
462
+ if (o || _) {
463
+ var m = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
464
+ o && Qe(u, m), _ && er(u, m);
466
465
  }
467
- return rr(e, a, _, u, n, B.current, o);
466
+ return rr(e, o, _, s, n, be.current, u);
468
467
  }
469
468
  }
470
- var ne = d.ReactCurrentOwner, Se = d.ReactDebugCurrentFrame;
471
- function W(e) {
469
+ var K = j.ReactCurrentOwner, me = j.ReactDebugCurrentFrame;
470
+ function D(e) {
472
471
  if (e) {
473
- var r = e._owner, t = z(e.type, e._source, r ? r.type : null);
474
- Se.setExtraStackFrame(t);
472
+ var r = e._owner, t = M(e.type, e._source, r ? r.type : null);
473
+ me.setExtraStackFrame(t);
475
474
  } else
476
- Se.setExtraStackFrame(null);
475
+ me.setExtraStackFrame(null);
477
476
  }
478
- var ae;
479
- ae = !1;
480
- function oe(e) {
481
- return typeof e == "object" && e !== null && e.$$typeof === g;
477
+ var G;
478
+ G = !1;
479
+ function z(e) {
480
+ return typeof e == "object" && e !== null && e.$$typeof === a;
482
481
  }
483
- function Pe() {
482
+ function Ee() {
484
483
  {
485
- if (ne.current) {
486
- var e = k(ne.current.type);
484
+ if (K.current) {
485
+ var e = w(K.current.type);
487
486
  if (e)
488
487
  return `
489
488
 
@@ -495,10 +494,10 @@ Check the render method of \`` + e + "`.";
495
494
  function nr(e) {
496
495
  return "";
497
496
  }
498
- var we = {};
497
+ var ge = {};
499
498
  function ar(e) {
500
499
  {
501
- var r = Pe();
500
+ var r = Ee();
502
501
  if (!r) {
503
502
  var t = typeof e == "string" ? e : e.displayName || e.name;
504
503
  t && (r = `
@@ -508,39 +507,39 @@ Check the top-level render call using <` + t + ">.");
508
507
  return r;
509
508
  }
510
509
  }
511
- function Oe(e, r) {
510
+ function _e(e, r) {
512
511
  {
513
512
  if (!e._store || e._store.validated || e.key != null)
514
513
  return;
515
514
  e._store.validated = !0;
516
515
  var t = ar(r);
517
- if (we[t])
516
+ if (ge[t])
518
517
  return;
519
- we[t] = !0;
518
+ ge[t] = !0;
520
519
  var n = "";
521
- e && e._owner && e._owner !== ne.current && (n = " It was passed a child from " + k(e._owner.type) + "."), W(e), c('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), W(null);
520
+ e && e._owner && e._owner !== K.current && (n = " It was passed a child from " + w(e._owner.type) + "."), D(e), g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), D(null);
522
521
  }
523
522
  }
524
- function Ce(e, r) {
523
+ function Re(e, r) {
525
524
  {
526
525
  if (typeof e != "object")
527
526
  return;
528
- if (re(e))
527
+ if (q(e))
529
528
  for (var t = 0; t < e.length; t++) {
530
529
  var n = e[t];
531
- oe(n) && Oe(n, r);
530
+ z(n) && _e(n, r);
532
531
  }
533
- else if (oe(e))
532
+ else if (z(e))
534
533
  e._store && (e._store.validated = !0);
535
534
  else if (e) {
536
- var u = P(e);
537
- if (typeof u == "function" && u !== e.entries)
538
- for (var f = u.call(e), o; !(o = f.next()).done; )
539
- oe(o.value) && Oe(o.value, r);
535
+ var s = je(e);
536
+ if (typeof s == "function" && s !== e.entries)
537
+ for (var f = s.call(e), u; !(u = f.next()).done; )
538
+ z(u.value) && _e(u.value, r);
540
539
  }
541
540
  }
542
541
  }
543
- function or(e) {
542
+ function ir(e) {
544
543
  {
545
544
  var r = e.type;
546
545
  if (r == null || typeof r == "string")
@@ -548,195 +547,225 @@ Check the top-level render call using <` + t + ">.");
548
547
  var t;
549
548
  if (typeof r == "function")
550
549
  t = r.propTypes;
551
- else if (typeof r == "object" && (r.$$typeof === s || // Note: Memo only checks outer props here.
550
+ else if (typeof r == "object" && (r.$$typeof === d || // Note: Memo only checks outer props here.
552
551
  // Inner props are checked in the reconciler.
553
- r.$$typeof === h))
552
+ r.$$typeof === T))
554
553
  t = r.propTypes;
555
554
  else
556
555
  return;
557
556
  if (t) {
558
- var n = k(r);
557
+ var n = w(r);
559
558
  Je(t, e.props, "prop", n, e);
560
- } else if (r.PropTypes !== void 0 && !ae) {
561
- ae = !0;
562
- var u = k(r);
563
- c("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", u || "Unknown");
559
+ } else if (r.PropTypes !== void 0 && !G) {
560
+ G = !0;
561
+ var s = w(r);
562
+ g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", s || "Unknown");
564
563
  }
565
- typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && c("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
564
+ typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
566
565
  }
567
566
  }
568
- function ir(e) {
567
+ function or(e) {
569
568
  {
570
569
  for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
571
570
  var n = r[t];
572
571
  if (n !== "children" && n !== "key") {
573
- W(e), c("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), W(null);
572
+ D(e), g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), D(null);
574
573
  break;
575
574
  }
576
575
  }
577
- e.ref !== null && (W(e), c("Invalid attribute `ref` supplied to `React.Fragment`."), W(null));
576
+ e.ref !== null && (D(e), g("Invalid attribute `ref` supplied to `React.Fragment`."), D(null));
578
577
  }
579
578
  }
580
- var je = {};
581
- function ke(e, r, t, n, u, f) {
579
+ var Te = {};
580
+ function Se(e, r, t, n, s, f) {
582
581
  {
583
- var o = Ye(e);
584
- if (!o) {
585
- var a = "";
586
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (a += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
582
+ var u = Ye(e);
583
+ if (!u) {
584
+ var o = "";
585
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (o += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
587
586
  var _ = nr();
588
- _ ? a += _ : a += Pe();
589
- var v;
590
- e === null ? v = "null" : re(e) ? v = "array" : e !== void 0 && e.$$typeof === g ? (v = "<" + (k(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : v = typeof e, c("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", v, a);
587
+ _ ? o += _ : o += Ee();
588
+ var y;
589
+ e === null ? y = "null" : q(e) ? y = "array" : e !== void 0 && e.$$typeof === a ? (y = "<" + (w(e.type) || "Unknown") + " />", o = " Did you accidentally export a JSX literal instead of a component?") : y = typeof e, g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", y, o);
591
590
  }
592
- var b = tr(e, r, t, u, f);
593
- if (b == null)
594
- return b;
595
- if (o) {
596
- var O = r.children;
597
- if (O !== void 0)
591
+ var m = tr(e, r, t, s, f);
592
+ if (m == null)
593
+ return m;
594
+ if (u) {
595
+ var S = r.children;
596
+ if (S !== void 0)
598
597
  if (n)
599
- if (re(O)) {
600
- for (var Y = 0; Y < O.length; Y++)
601
- Ce(O[Y], e);
602
- Object.freeze && Object.freeze(O);
598
+ if (q(S)) {
599
+ for (var F = 0; F < S.length; F++)
600
+ Re(S[F], e);
601
+ Object.freeze && Object.freeze(S);
603
602
  } else
604
- c("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
+ g("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
605
604
  else
606
- Ce(O, e);
605
+ Re(S, e);
607
606
  }
608
- if (N.call(r, "key")) {
609
- var I = k(e), S = Object.keys(r).filter(function(dr) {
610
- return dr !== "key";
611
- }), ie = S.length > 0 ? "{key: someKey, " + S.join(": ..., ") + ": ...}" : "{key: someKey}";
612
- if (!je[I + ie]) {
613
- var lr = S.length > 0 ? "{" + S.join(": ..., ") + ": ...}" : "{}";
614
- c(`A props object containing a "key" prop is being spread into JSX:
607
+ if (I.call(r, "key")) {
608
+ var C = w(e), R = Object.keys(r).filter(function(vr) {
609
+ return vr !== "key";
610
+ }), H = R.length > 0 ? "{key: someKey, " + R.join(": ..., ") + ": ...}" : "{key: someKey}";
611
+ if (!Te[C + H]) {
612
+ var fr = R.length > 0 ? "{" + R.join(": ..., ") + ": ...}" : "{}";
613
+ g(`A props object containing a "key" prop is being spread into JSX:
615
614
  let props = %s;
616
615
  <%s {...props} />
617
616
  React keys must be passed directly to JSX without using spread:
618
617
  let props = %s;
619
- <%s key={someKey} {...props} />`, ie, I, lr, I), je[I + ie] = !0;
618
+ <%s key={someKey} {...props} />`, H, C, fr, C), Te[C + H] = !0;
620
619
  }
621
620
  }
622
- return e === y ? ir(b) : or(b), b;
621
+ return e === p ? or(m) : ir(m), m;
623
622
  }
624
623
  }
625
624
  function ur(e, r, t) {
626
- return ke(e, r, t, !0);
625
+ return Se(e, r, t, !0);
627
626
  }
628
627
  function sr(e, r, t) {
629
- return ke(e, r, t, !1);
628
+ return Se(e, r, t, !1);
630
629
  }
631
- var cr = sr, fr = ur;
632
- q.Fragment = y, q.jsx = cr, q.jsxs = fr;
633
- }()), q;
630
+ var cr = sr, lr = ur;
631
+ W.Fragment = p, W.jsx = cr, W.jsxs = lr;
632
+ }()), W;
634
633
  }
635
- process.env.NODE_ENV === "production" ? ue.exports = hr() : ue.exports = _r();
636
- var Tr = ue.exports;
637
- function kr(E) {
634
+ process.env.NODE_ENV === "production" ? Z.exports = xr() : Z.exports = Pr();
635
+ var wr = Z.exports;
636
+ function $r(h) {
638
637
  if (typeof Proxy > "u") throw new Error("Proxy is not supported in this environment.");
639
- const g = vr(
638
+ const a = br(
640
639
  void 0
641
640
  );
642
- return g.name = E, g;
641
+ return a.name = h, a;
643
642
  }
644
- function xr(E) {
645
- if (Array.isArray(E)) {
646
- const [g, ...C] = E;
647
- return (y, T, R) => {
648
- if (y !== g) return !1;
649
- let l = T, i = R;
650
- for (const s of C)
651
- l = l == null ? void 0 : l[s], i = i == null ? void 0 : i[s];
652
- return l !== i;
643
+ function Or(h) {
644
+ if (Array.isArray(h)) {
645
+ const [a, ...l] = h;
646
+ return (p, c, b) => {
647
+ if (p !== a) return !1;
648
+ let i = c, v = b;
649
+ for (const d of l)
650
+ i = i == null ? void 0 : i[d], v = v == null ? void 0 : v[d];
651
+ return i !== v;
653
652
  };
654
653
  }
655
- return E;
654
+ return h;
655
+ }
656
+ class we {
657
+ constructor(a) {
658
+ X(this, "value");
659
+ X(this, "changeSubscribers", {});
660
+ this.set(a);
661
+ }
662
+ subscribe(a, l, p) {
663
+ const c = _r();
664
+ return this.changeSubscribers[c] = {
665
+ id: c,
666
+ deps: p,
667
+ propCallback: a,
668
+ reinitCallback: l
669
+ }, c;
670
+ }
671
+ unsubscribe(a) {
672
+ delete this.changeSubscribers[a];
673
+ }
674
+ emitChange(a, l, p) {
675
+ Object.values(this.changeSubscribers).forEach((c) => {
676
+ var i;
677
+ const b = (i = c.deps) == null ? void 0 : i.map(Or);
678
+ (!b || b.includes(a) && p !== l || b.some(
679
+ (v) => Y(v) && v(a, l, p, this.value)
680
+ )) && c.propCallback(a, l, p);
681
+ });
682
+ }
683
+ emitReinit(a, l) {
684
+ Object.values(this.changeSubscribers).forEach((p) => {
685
+ p.reinitCallback(a, l);
686
+ });
687
+ }
688
+ get() {
689
+ return this.value;
690
+ }
691
+ set(a) {
692
+ const l = this;
693
+ if (a !== this.value) {
694
+ const p = this.value;
695
+ a != null ? this.value = new Proxy(a, {
696
+ get: function(c, b) {
697
+ const i = Reflect.get(c, b, a);
698
+ return Y(i) ? i.bind(l.value) : i;
699
+ },
700
+ set: (c, b, i) => {
701
+ const v = b, d = c[v];
702
+ return Reflect.set(c, v, i, a), i = c[v], this.emitChange(v, i, d), !0;
703
+ }
704
+ }) : this.value = a, this.emitReinit(this.value, p);
705
+ }
706
+ return this.value;
707
+ }
656
708
  }
657
- function Dr(E) {
658
- return gr(
709
+ function Wr(h) {
710
+ return Sr(
659
711
  ({
660
- children: g,
661
- value: C,
662
- onChangeProp: y,
663
- onChangeReinit: T,
664
- proxyRef: R
712
+ children: a,
713
+ value: l,
714
+ onChangeProp: p,
715
+ onChangeReinit: c,
716
+ proxyRef: b
665
717
  }) => {
666
- const l = X({}), i = X(), s = X({}), j = Rr();
667
- pr(R, () => i.current, [i.current]);
668
- const m = L((p, P, d) => {
669
- const c = mr();
670
- return l.current[c] = {
671
- id: c,
672
- deps: d,
673
- propCallback: p,
674
- reinitCallback: P
675
- }, c;
676
- }, []), h = L((p) => {
677
- delete l.current[p];
678
- }, []), x = L((p, P, d) => {
679
- Object.values(l.current).forEach((c) => {
680
- var D;
681
- const w = (D = c.deps) == null ? void 0 : D.map(xr);
682
- (!w || w.includes(p) && d !== P || w.some(
683
- ($) => V($) && $(p, P, d, i.current)
684
- )) && c.propCallback(p, P, d);
685
- }), V(y) && y(p, P, d);
686
- }, [y]), A = L((p, P) => {
687
- Object.values(l.current).forEach((d) => {
688
- d.reinitCallback(p, P);
689
- }), V(T) && T(p, P);
690
- }, [T]), M = L((p) => {
691
- if (p !== i.current) {
692
- const P = i.current;
693
- p !== null ? i.current = new Proxy(p, {
694
- get: function(d, c) {
695
- const w = Reflect.get(d, c, p);
696
- return V(w) ? w.bind(i.current) : w;
697
- },
698
- set: function(d, c, w) {
699
- const D = c, $ = d[D];
700
- return Reflect.set(d, D, w, p), w = d[D], x(D, w, $), !0;
701
- }
702
- }) : i.current = p, A(i.current, P), j();
703
- }
704
- return s.current.obj = i.current, i.current;
705
- }, [y, T, x]);
706
- return i.current === void 0 && (i.current = M(C)), s.current.obj = i.current, s.current.set = M, s.current.subscribe = m, s.current.unsubscribe = h, /* @__PURE__ */ Tr.jsx(E.Provider, { value: s.current, children: g });
718
+ const i = Ce(void 0);
719
+ i.current === void 0 && (i.current = l instanceof we ? l : new we(l), c == null || c(i.current.get(), void 0));
720
+ const v = Rr();
721
+ return hr(b, () => i.current.get(), [i.current.get()]), yr(() => {
722
+ const d = i.current.subscribe(
723
+ p ?? (() => {
724
+ }),
725
+ (...x) => {
726
+ Y(c) && c(...x), v();
727
+ },
728
+ null
729
+ );
730
+ return () => {
731
+ i.current.unsubscribe(d);
732
+ };
733
+ }, [p, c, v]), /* @__PURE__ */ wr.jsx(h.Provider, { value: i.current, children: a });
707
734
  },
708
735
  ["children", "onChangeProp", "onChangeReinit", "proxyRef"],
709
- E.name + ".Provider"
736
+ h.name + ".Provider"
710
737
  );
711
738
  }
712
- function Ar(E, g = [], C, y, T = !0) {
713
- const R = br(E);
714
- if (R === void 0)
715
- throw new Error(`No ${E.name} provider found.`);
716
- const l = X({ value: R }), i = L((j) => {
717
- const m = R.subscribe(
718
- (h, x, A) => {
719
- l.current = { value: R }, j(), V(C) && C(h, x, A);
739
+ function Yr(h, a = [], l, p, c = !0) {
740
+ const b = mr(h);
741
+ if (b === void 0)
742
+ throw new Error(`No ${h.name} provider found.`);
743
+ const i = Ce({ value: b }), v = Er((x) => {
744
+ const E = b.subscribe(
745
+ (T, P, k) => {
746
+ i.current = { value: b }, x(), Y(l) && l(T, P, k);
720
747
  },
721
- (h, x) => {
722
- T && (l.current = { value: R }, j()), V(y) && y(h, x);
748
+ (T, P) => {
749
+ c && (i.current = { value: b }, x()), Y(p) && p(T, P);
723
750
  },
724
- g
751
+ a
725
752
  );
726
- return () => R.unsubscribe(m);
727
- }, [g, T, C, y, R]), s = yr(
728
- i,
729
- () => l.current,
730
- () => l.current
753
+ return () => b.unsubscribe(E);
754
+ }, [a, c, l, p, b]), d = gr(
755
+ v,
756
+ () => i.current,
757
+ () => i.current
731
758
  );
732
- return new Er(
733
- { value: s.value.obj, set: s.value.set },
759
+ return new Tr(
760
+ // The binding is necessary to fix a strange issue I'm having.
761
+ { value: d.value.get(), set: d.value.set.bind(d.value) },
734
762
  ["value", "set"]
735
763
  );
736
764
  }
737
765
  export {
738
- kr as createProxyContext,
739
- Dr as createProxyContextProvider,
740
- xr as evaluateDependency,
741
- Ar as useProxyContext
766
+ we as ProxyContextValueWrapper,
767
+ $r as createProxyContext,
768
+ Wr as createProxyContextProvider,
769
+ Or as evaluateDependency,
770
+ Yr as useProxyContext
742
771
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ptolemy2002/react-proxy-context",
3
3
  "private": false,
4
- "version": "2.3.5",
4
+ "version": "2.4.0",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",
@@ -46,6 +46,7 @@
46
46
  "@types/babel__traverse": "^7.20.6",
47
47
  "@types/eslint__js": "~8.42.3",
48
48
  "@types/is-callable": "~1.1.2",
49
+ "@types/jsdom": "~21.1.7",
49
50
  "@types/less": "~3.0.6",
50
51
  "@types/node": "^22.7.4",
51
52
  "@types/prop-types": "^15.7.13",