cogsbox-state 0.5.313 → 0.5.315

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.
@@ -1,63 +1,63 @@
1
1
  "use client";
2
- import { jsx as yt } from "react/jsx-runtime";
3
- import { useState as K, useRef as Y, useEffect as at, useLayoutEffect as dt, useMemo as It, createElement as st, useSyncExternalStore as Mt, startTransition as jt, useCallback as Et } from "react";
4
- import { transformStateFunc as Ot, isDeepEqual as H, isFunction as J, getNestedValue as z, getDifferences as pt, debounce as Ut } from "./utility.js";
5
- import { pushFunc as vt, updateFn as ot, cutFunc as lt, ValidationWrapper as Rt, FormControlComponent as Ft } from "./Functions.jsx";
6
- import Dt from "superjson";
7
- import { v4 as wt } from "uuid";
2
+ import { jsx as mt } from "react/jsx-runtime";
3
+ import { useState as X, useRef as Q, useEffect as ot, useLayoutEffect as ct, useMemo as ht, createElement as at, useSyncExternalStore as xt, startTransition as Pt, useCallback as wt } from "react";
4
+ import { transformStateFunc as _t, isDeepEqual as H, isFunction as J, getNestedValue as z, getDifferences as vt, debounce as Mt } from "./utility.js";
5
+ import { pushFunc as St, updateFn as rt, cutFunc as it, ValidationWrapper as jt, FormControlComponent as Ot } from "./Functions.jsx";
6
+ import Rt from "superjson";
7
+ import { v4 as yt } from "uuid";
8
8
  import "zod";
9
- import { getGlobalStore as o, formRefStore as At } from "./store.js";
10
- import { useCogsConfig as Ct } from "./CogsStateClient.jsx";
11
- import { applyPatch as Wt } from "fast-json-patch";
12
- import Gt from "react-use-measure";
13
- function $t(t, c) {
14
- const m = o.getState().getInitialOptions, f = o.getState().setInitialStateOptions, y = m(t) || {};
9
+ import { getGlobalStore as o, formRefStore as Tt } from "./store.js";
10
+ import { useCogsConfig as bt } from "./CogsStateClient.jsx";
11
+ import { applyPatch as Ut } from "fast-json-patch";
12
+ import Ft from "react-use-measure";
13
+ function Et(t, c) {
14
+ const h = o.getState().getInitialOptions, f = o.getState().setInitialStateOptions, I = h(t) || {};
15
15
  f(t, {
16
- ...y,
16
+ ...I,
17
17
  ...c
18
18
  });
19
19
  }
20
- function kt({
20
+ function At({
21
21
  stateKey: t,
22
22
  options: c,
23
- initialOptionsPart: m
23
+ initialOptionsPart: h
24
24
  }) {
25
- const f = nt(t) || {}, y = m[t] || {}, k = o.getState().setInitialStateOptions, p = { ...y, ...f };
26
- let I = !1;
25
+ const f = et(t) || {}, I = h[t] || {}, $ = o.getState().setInitialStateOptions, w = { ...I, ...f };
26
+ let p = !1;
27
27
  if (c)
28
28
  for (const a in c)
29
- p.hasOwnProperty(a) ? (a == "localStorage" && c[a] && p[a].key !== c[a]?.key && (I = !0, p[a] = c[a]), a == "initialState" && c[a] && p[a] !== c[a] && // Different references
30
- !H(p[a], c[a]) && (I = !0, p[a] = c[a])) : (I = !0, p[a] = c[a]);
31
- I && k(t, p);
29
+ w.hasOwnProperty(a) ? (a == "localStorage" && c[a] && w[a].key !== c[a]?.key && (p = !0, w[a] = c[a]), a == "initialState" && c[a] && w[a] !== c[a] && // Different references
30
+ !H(w[a], c[a]) && (p = !0, w[a] = c[a])) : (p = !0, w[a] = c[a]);
31
+ p && $(t, w);
32
32
  }
33
- function de(t, { formElements: c, validation: m }) {
34
- return { initialState: t, formElements: c, validation: m };
33
+ function ie(t, { formElements: c, validation: h }) {
34
+ return { initialState: t, formElements: c, validation: h };
35
35
  }
36
- const ue = (t, c) => {
37
- let m = t;
38
- const [f, y] = Ot(m);
39
- (Object.keys(y).length > 0 || c && Object.keys(c).length > 0) && Object.keys(y).forEach((I) => {
40
- y[I] = y[I] || {}, y[I].formElements = {
36
+ const ce = (t, c) => {
37
+ let h = t;
38
+ const [f, I] = _t(h);
39
+ (Object.keys(I).length > 0 || c && Object.keys(c).length > 0) && Object.keys(I).forEach((p) => {
40
+ I[p] = I[p] || {}, I[p].formElements = {
41
41
  ...c?.formElements,
42
42
  // Global defaults first
43
43
  ...c?.validation,
44
- ...y[I].formElements || {}
44
+ ...I[p].formElements || {}
45
45
  // State-specific overrides
46
- }, nt(I) || o.getState().setInitialStateOptions(I, y[I]);
46
+ }, et(p) || o.getState().setInitialStateOptions(p, I[p]);
47
47
  }), o.getState().setInitialStates(f), o.getState().setCreatedState(f);
48
- const k = (I, a) => {
49
- const [v] = K(a?.componentId ?? wt());
50
- kt({
51
- stateKey: I,
48
+ const $ = (p, a) => {
49
+ const [y] = X(a?.componentId ?? yt());
50
+ At({
51
+ stateKey: p,
52
52
  options: a,
53
- initialOptionsPart: y
53
+ initialOptionsPart: I
54
54
  });
55
- const n = o.getState().cogsStateStore[I] || f[I], S = a?.modifyState ? a.modifyState(n) : n, [W, R] = Yt(
56
- S,
55
+ const n = o.getState().cogsStateStore[p] || f[p], m = a?.modifyState ? a.modifyState(n) : n, [L, R] = Bt(
56
+ m,
57
57
  {
58
- stateKey: I,
58
+ stateKey: p,
59
59
  syncUpdate: a?.syncUpdate,
60
- componentId: v,
60
+ componentId: y,
61
61
  localStorage: a?.localStorage,
62
62
  middleware: a?.middleware,
63
63
  enabledSync: a?.enabledSync,
@@ -70,47 +70,47 @@ const ue = (t, c) => {
70
70
  );
71
71
  return R;
72
72
  };
73
- function p(I, a) {
74
- kt({ stateKey: I, options: a, initialOptionsPart: y }), a.localStorage && qt(I, a), St(I);
73
+ function w(p, a) {
74
+ At({ stateKey: p, options: a, initialOptionsPart: I }), a.localStorage && Ht(p, a), gt(p);
75
75
  }
76
- return { useCogsState: k, setCogsOptions: p };
76
+ return { useCogsState: $, setCogsOptions: w };
77
77
  }, {
78
- setUpdaterState: ut,
79
- setState: tt,
80
- getInitialOptions: nt,
81
- getKeyState: Vt,
82
- getValidationErrors: Lt,
83
- setStateLog: Ht,
84
- updateInitialStateGlobal: Tt,
85
- addValidationError: zt,
78
+ setUpdaterState: lt,
79
+ setState: K,
80
+ getInitialOptions: et,
81
+ getKeyState: Nt,
82
+ getValidationErrors: Dt,
83
+ setStateLog: Wt,
84
+ updateInitialStateGlobal: It,
85
+ addValidationError: Lt,
86
86
  removeValidationError: q,
87
- setServerSyncActions: Bt
88
- } = o.getState(), bt = (t, c, m, f, y) => {
89
- m?.log && console.log(
87
+ setServerSyncActions: Gt
88
+ } = o.getState(), $t = (t, c, h, f, I) => {
89
+ h?.log && console.log(
90
90
  "saving to localstorage",
91
91
  c,
92
- m.localStorage?.key,
92
+ h.localStorage?.key,
93
93
  f
94
94
  );
95
- const k = J(m?.localStorage?.key) ? m.localStorage?.key(t) : m?.localStorage?.key;
96
- if (k && f) {
97
- const p = `${f}-${c}-${k}`;
98
- let I;
95
+ const $ = J(h?.localStorage?.key) ? h.localStorage?.key(t) : h?.localStorage?.key;
96
+ if ($ && f) {
97
+ const w = `${f}-${c}-${$}`;
98
+ let p;
99
99
  try {
100
- I = ft(p)?.lastSyncedWithServer;
100
+ p = ut(w)?.lastSyncedWithServer;
101
101
  } catch {
102
102
  }
103
103
  const a = {
104
104
  state: t,
105
105
  lastUpdated: Date.now(),
106
- lastSyncedWithServer: y ?? I
107
- }, v = Dt.serialize(a);
106
+ lastSyncedWithServer: I ?? p
107
+ }, y = Rt.serialize(a);
108
108
  window.localStorage.setItem(
109
- p,
110
- JSON.stringify(v.json)
109
+ w,
110
+ JSON.stringify(y.json)
111
111
  );
112
112
  }
113
- }, ft = (t) => {
113
+ }, ut = (t) => {
114
114
  if (!t) return null;
115
115
  try {
116
116
  const c = window.localStorage.getItem(t);
@@ -118,57 +118,57 @@ const ue = (t, c) => {
118
118
  } catch (c) {
119
119
  return console.error("Error loading from localStorage:", c), null;
120
120
  }
121
- }, qt = (t, c) => {
122
- const m = o.getState().cogsStateStore[t], { sessionId: f } = Ct(), y = J(c?.localStorage?.key) ? c.localStorage.key(m) : c?.localStorage?.key;
123
- if (y && f) {
124
- const k = ft(
125
- `${f}-${t}-${y}`
121
+ }, Ht = (t, c) => {
122
+ const h = o.getState().cogsStateStore[t], { sessionId: f } = bt(), I = J(c?.localStorage?.key) ? c.localStorage.key(h) : c?.localStorage?.key;
123
+ if (I && f) {
124
+ const $ = ut(
125
+ `${f}-${t}-${I}`
126
126
  );
127
- if (k && k.lastUpdated > (k.lastSyncedWithServer || 0))
128
- return tt(t, k.state), St(t), !0;
127
+ if ($ && $.lastUpdated > ($.lastSyncedWithServer || 0))
128
+ return K(t, $.state), gt(t), !0;
129
129
  }
130
130
  return !1;
131
- }, xt = (t, c, m, f, y, k) => {
132
- const p = {
131
+ }, Vt = (t, c, h, f, I, $) => {
132
+ const w = {
133
133
  initialState: c,
134
- updaterState: gt(
134
+ updaterState: dt(
135
135
  t,
136
136
  f,
137
- y,
138
- k
137
+ I,
138
+ $
139
139
  ),
140
- state: m
140
+ state: h
141
141
  };
142
- Tt(t, p.initialState), ut(t, p.updaterState), tt(t, p.state);
143
- }, St = (t) => {
142
+ It(t, w.initialState), lt(t, w.updaterState), K(t, w.state);
143
+ }, gt = (t) => {
144
144
  const c = o.getState().stateComponents.get(t);
145
145
  if (!c) return;
146
- const m = /* @__PURE__ */ new Set();
146
+ const h = /* @__PURE__ */ new Set();
147
147
  c.components.forEach((f) => {
148
- (f ? Array.isArray(f.reactiveType) ? f.reactiveType : [f.reactiveType || "component"] : null)?.includes("none") || m.add(() => f.forceUpdate());
148
+ (f ? Array.isArray(f.reactiveType) ? f.reactiveType : [f.reactiveType || "component"] : null)?.includes("none") || h.add(() => f.forceUpdate());
149
149
  }), queueMicrotask(() => {
150
- m.forEach((f) => f());
150
+ h.forEach((f) => f());
151
151
  });
152
- }, ge = (t, c) => {
153
- const m = o.getState().stateComponents.get(t);
154
- if (m) {
155
- const f = `${t}////${c}`, y = m.components.get(f);
156
- if ((y ? Array.isArray(y.reactiveType) ? y.reactiveType : [y.reactiveType || "component"] : null)?.includes("none"))
152
+ }, le = (t, c) => {
153
+ const h = o.getState().stateComponents.get(t);
154
+ if (h) {
155
+ const f = `${t}////${c}`, I = h.components.get(f);
156
+ if ((I ? Array.isArray(I.reactiveType) ? I.reactiveType : [I.reactiveType || "component"] : null)?.includes("none"))
157
157
  return;
158
- y && y.forceUpdate();
158
+ I && I.forceUpdate();
159
159
  }
160
- }, Jt = (t, c, m, f) => {
160
+ }, zt = (t, c, h, f) => {
161
161
  switch (t) {
162
162
  case "update":
163
163
  return {
164
164
  oldValue: z(c, f),
165
- newValue: z(m, f)
165
+ newValue: z(h, f)
166
166
  };
167
167
  case "insert":
168
168
  return {
169
169
  oldValue: null,
170
170
  // or undefined
171
- newValue: z(m, f)
171
+ newValue: z(h, f)
172
172
  };
173
173
  case "cut":
174
174
  return {
@@ -180,296 +180,296 @@ const ue = (t, c) => {
180
180
  return { oldValue: null, newValue: null };
181
181
  }
182
182
  };
183
- function Yt(t, {
183
+ function Bt(t, {
184
184
  stateKey: c,
185
- serverSync: m,
185
+ serverSync: h,
186
186
  localStorage: f,
187
- formElements: y,
188
- reactiveDeps: k,
189
- reactiveType: p,
190
- componentId: I,
187
+ formElements: I,
188
+ reactiveDeps: $,
189
+ reactiveType: w,
190
+ componentId: p,
191
191
  initialState: a,
192
- syncUpdate: v,
192
+ syncUpdate: y,
193
193
  dependencies: n,
194
- serverState: S
194
+ serverState: m
195
195
  } = {}) {
196
- const [W, R] = K({}), { sessionId: F } = Ct();
196
+ const [L, R] = X({}), { sessionId: U } = bt();
197
197
  let G = !c;
198
- const [h] = K(c ?? wt()), l = o.getState().stateLog[h], it = Y(/* @__PURE__ */ new Set()), Z = Y(I ?? wt()), O = Y(
198
+ const [v] = X(c ?? yt()), l = o.getState().stateLog[v], st = Q(/* @__PURE__ */ new Set()), Y = Q(p ?? yt()), j = Q(
199
199
  null
200
200
  );
201
- O.current = nt(h) ?? null, at(() => {
202
- if (v && v.stateKey === h && v.path?.[0]) {
203
- tt(h, (r) => ({
201
+ j.current = et(v) ?? null, ot(() => {
202
+ if (y && y.stateKey === v && y.path?.[0]) {
203
+ K(v, (r) => ({
204
204
  ...r,
205
- [v.path[0]]: v.newValue
205
+ [y.path[0]]: y.newValue
206
206
  }));
207
- const e = `${v.stateKey}:${v.path.join(".")}`;
207
+ const e = `${y.stateKey}:${y.path.join(".")}`;
208
208
  o.getState().setSyncInfo(e, {
209
- timeStamp: v.timeStamp,
210
- userId: v.userId
209
+ timeStamp: y.timeStamp,
210
+ userId: y.userId
211
211
  });
212
212
  }
213
- }, [v]), at(() => {
213
+ }, [y]), ot(() => {
214
214
  if (a) {
215
- $t(h, {
215
+ Et(v, {
216
216
  initialState: a
217
217
  });
218
- const e = O.current, s = e?.serverState?.id !== void 0 && e?.serverState?.status === "success" && e?.serverState?.data, i = o.getState().initialStateGlobal[h];
218
+ const e = j.current, s = e?.serverState?.id !== void 0 && e?.serverState?.status === "success" && e?.serverState?.data, i = o.getState().initialStateGlobal[v];
219
219
  if (!(i && !H(i, a) || !i) && !s)
220
220
  return;
221
221
  let u = null;
222
- const T = J(e?.localStorage?.key) ? e?.localStorage?.key(a) : e?.localStorage?.key;
223
- T && F && (u = ft(`${F}-${h}-${T}`));
224
- let w = a, E = !1;
225
- const _ = s ? Date.now() : 0, x = u?.lastUpdated || 0, M = u?.lastSyncedWithServer || 0;
226
- s && _ > x ? (w = e.serverState.data, E = !0) : u && x > M && (w = u.state, e?.localStorage?.onChange && e?.localStorage?.onChange(w)), o.getState().initializeShadowState(h, a), xt(
227
- h,
222
+ const E = J(e?.localStorage?.key) ? e?.localStorage?.key(a) : e?.localStorage?.key;
223
+ E && U && (u = ut(`${U}-${v}-${E}`));
224
+ let T = a, A = !1;
225
+ const P = s ? Date.now() : 0, N = u?.lastUpdated || 0, V = u?.lastSyncedWithServer || 0;
226
+ s && P > N ? (T = e.serverState.data, A = !0) : u && N > V && (T = u.state, e?.localStorage?.onChange && e?.localStorage?.onChange(T)), o.getState().initializeShadowState(v, a), Vt(
227
+ v,
228
228
  a,
229
- w,
230
- rt,
231
- Z.current,
232
- F
233
- ), E && T && F && bt(w, h, e, F, Date.now()), St(h), (Array.isArray(p) ? p : [p || "component"]).includes("none") || R({});
229
+ T,
230
+ nt,
231
+ Y.current,
232
+ U
233
+ ), A && E && U && $t(T, v, e, U, Date.now()), gt(v), (Array.isArray(w) ? w : [w || "component"]).includes("none") || R({});
234
234
  }
235
235
  }, [
236
236
  a,
237
- S?.status,
238
- S?.data,
237
+ m?.status,
238
+ m?.data,
239
239
  ...n || []
240
- ]), dt(() => {
241
- G && $t(h, {
242
- serverSync: m,
243
- formElements: y,
240
+ ]), ct(() => {
241
+ G && Et(v, {
242
+ serverSync: h,
243
+ formElements: I,
244
244
  initialState: a,
245
245
  localStorage: f,
246
- middleware: O.current?.middleware
246
+ middleware: j.current?.middleware
247
247
  });
248
- const e = `${h}////${Z.current}`, r = o.getState().stateComponents.get(h) || {
248
+ const e = `${v}////${Y.current}`, r = o.getState().stateComponents.get(v) || {
249
249
  components: /* @__PURE__ */ new Map()
250
250
  };
251
251
  return r.components.set(e, {
252
252
  forceUpdate: () => R({}),
253
253
  paths: /* @__PURE__ */ new Set(),
254
254
  deps: [],
255
- depsFunction: k || void 0,
256
- reactiveType: p ?? ["component", "deps"]
257
- }), o.getState().stateComponents.set(h, r), R({}), () => {
258
- r && (r.components.delete(e), r.components.size === 0 && o.getState().stateComponents.delete(h));
255
+ depsFunction: $ || void 0,
256
+ reactiveType: w ?? ["component", "deps"]
257
+ }), o.getState().stateComponents.set(v, r), R({}), () => {
258
+ r && (r.components.delete(e), r.components.size === 0 && o.getState().stateComponents.delete(v));
259
259
  };
260
260
  }, []);
261
- const rt = (e, r, s, i) => {
261
+ const nt = (e, r, s, i) => {
262
262
  if (Array.isArray(r)) {
263
- const u = `${h}-${r.join(".")}`;
264
- it.current.add(u);
263
+ const u = `${v}-${r.join(".")}`;
264
+ st.current.add(u);
265
265
  }
266
266
  const g = o.getState();
267
- tt(h, (u) => {
268
- const T = J(e) ? e(u) : e, w = `${h}-${r.join(".")}`;
269
- if (w) {
270
- let V = !1, N = g.signalDomElements.get(w);
271
- if ((!N || N.size === 0) && (s.updateType === "insert" || s.updateType === "cut")) {
272
- const U = r.slice(0, -1), D = z(T, U);
267
+ K(v, (u) => {
268
+ const E = J(e) ? e(u) : e, T = `${v}-${r.join(".")}`;
269
+ if (T) {
270
+ let M = !1, b = g.signalDomElements.get(T);
271
+ if ((!b || b.size === 0) && (s.updateType === "insert" || s.updateType === "cut")) {
272
+ const O = r.slice(0, -1), D = z(E, O);
273
273
  if (Array.isArray(D)) {
274
- V = !0;
275
- const $ = `${h}-${U.join(".")}`;
276
- N = g.signalDomElements.get($);
274
+ M = !0;
275
+ const S = `${v}-${O.join(".")}`;
276
+ b = g.signalDomElements.get(S);
277
277
  }
278
278
  }
279
- if (N) {
280
- const U = V ? z(T, r.slice(0, -1)) : z(T, r);
281
- N.forEach(({ parentId: D, position: $, effect: A }) => {
282
- const b = document.querySelector(
279
+ if (b) {
280
+ const O = M ? z(E, r.slice(0, -1)) : z(E, r);
281
+ b.forEach(({ parentId: D, position: S, effect: k }) => {
282
+ const C = document.querySelector(
283
283
  `[data-parent-id="${D}"]`
284
284
  );
285
- if (b) {
286
- const j = Array.from(b.childNodes);
287
- if (j[$]) {
288
- const C = A ? new Function("state", `return (${A})(state)`)(U) : U;
289
- j[$].textContent = String(C);
285
+ if (C) {
286
+ const _ = Array.from(C.childNodes);
287
+ if (_[S]) {
288
+ const x = k ? new Function("state", `return (${k})(state)`)(O) : O;
289
+ _[S].textContent = String(x);
290
290
  }
291
291
  }
292
292
  });
293
293
  }
294
294
  }
295
- console.log("shadowState", g.shadowStateStore), s.updateType === "update" && (i || O.current?.validation?.key) && r && q(
296
- (i || O.current?.validation?.key) + "." + r.join(".")
295
+ console.log("shadowState", g.shadowStateStore), s.updateType === "update" && (i || j.current?.validation?.key) && r && q(
296
+ (i || j.current?.validation?.key) + "." + r.join(".")
297
297
  );
298
- const E = r.slice(0, r.length - 1);
299
- s.updateType === "cut" && O.current?.validation?.key && q(
300
- O.current?.validation?.key + "." + E.join(".")
301
- ), s.updateType === "insert" && O.current?.validation?.key && Lt(
302
- O.current?.validation?.key + "." + E.join(".")
303
- ).filter(([N, U]) => {
304
- let D = N?.split(".").length;
305
- if (N == E.join(".") && D == E.length - 1) {
306
- let $ = N + "." + E;
307
- q(N), zt($, U);
298
+ const A = r.slice(0, r.length - 1);
299
+ s.updateType === "cut" && j.current?.validation?.key && q(
300
+ j.current?.validation?.key + "." + A.join(".")
301
+ ), s.updateType === "insert" && j.current?.validation?.key && Dt(
302
+ j.current?.validation?.key + "." + A.join(".")
303
+ ).filter(([b, O]) => {
304
+ let D = b?.split(".").length;
305
+ if (b == A.join(".") && D == A.length - 1) {
306
+ let S = b + "." + A;
307
+ q(b), Lt(S, O);
308
308
  }
309
309
  });
310
- const _ = g.stateComponents.get(h);
311
- if (console.log("stateEntry >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", _), _) {
312
- const V = pt(u, T), N = new Set(V), U = s.updateType === "update" ? r.join(".") : r.slice(0, -1).join(".") || "";
310
+ const P = g.stateComponents.get(v);
311
+ if (console.log("stateEntry >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", P), P) {
312
+ const M = vt(u, E), b = new Set(M), O = s.updateType === "update" ? r.join(".") : r.slice(0, -1).join(".") || "";
313
313
  for (const [
314
314
  D,
315
- $
316
- ] of _.components.entries()) {
317
- let A = !1;
318
- const b = Array.isArray($.reactiveType) ? $.reactiveType : [$.reactiveType || "component"];
319
- if (console.log("component", $), !b.includes("none")) {
320
- if (b.includes("all")) {
321
- $.forceUpdate();
315
+ S
316
+ ] of P.components.entries()) {
317
+ let k = !1;
318
+ const C = Array.isArray(S.reactiveType) ? S.reactiveType : [S.reactiveType || "component"];
319
+ if (console.log("component", S), !C.includes("none")) {
320
+ if (C.includes("all")) {
321
+ S.forceUpdate();
322
322
  continue;
323
323
  }
324
- if (b.includes("component") && (($.paths.has(U) || $.paths.has("")) && (A = !0), !A))
325
- for (const j of N) {
326
- let C = j;
324
+ if (C.includes("component") && ((S.paths.has(O) || S.paths.has("")) && (k = !0), !k))
325
+ for (const _ of b) {
326
+ let x = _;
327
327
  for (; ; ) {
328
- if ($.paths.has(C)) {
329
- A = !0;
328
+ if (S.paths.has(x)) {
329
+ k = !0;
330
330
  break;
331
331
  }
332
- const L = C.lastIndexOf(".");
333
- if (L !== -1) {
334
- const et = C.substring(
332
+ const B = x.lastIndexOf(".");
333
+ if (B !== -1) {
334
+ const Z = x.substring(
335
335
  0,
336
- L
336
+ B
337
337
  );
338
338
  if (!isNaN(
339
- Number(C.substring(L + 1))
340
- ) && $.paths.has(et)) {
341
- A = !0;
339
+ Number(x.substring(B + 1))
340
+ ) && S.paths.has(Z)) {
341
+ k = !0;
342
342
  break;
343
343
  }
344
- C = et;
344
+ x = Z;
345
345
  } else
346
- C = "";
347
- if (C === "")
346
+ x = "";
347
+ if (x === "")
348
348
  break;
349
349
  }
350
- if (A) break;
350
+ if (k) break;
351
351
  }
352
- if (!A && b.includes("deps") && $.depsFunction) {
353
- const j = $.depsFunction(T);
354
- let C = !1;
355
- typeof j == "boolean" ? j && (C = !0) : H($.deps, j) || ($.deps = j, C = !0), C && (A = !0);
352
+ if (!k && C.includes("deps") && S.depsFunction) {
353
+ const _ = S.depsFunction(E);
354
+ let x = !1;
355
+ typeof _ == "boolean" ? _ && (x = !0) : H(S.deps, _) || (S.deps = _, x = !0), x && (k = !0);
356
356
  }
357
- A && $.forceUpdate();
357
+ k && S.forceUpdate();
358
358
  }
359
359
  }
360
360
  }
361
- const x = Date.now();
362
- r = r.map((V, N) => {
363
- const U = r.slice(0, -1), D = z(T, U);
364
- return N === r.length - 1 && ["insert", "cut"].includes(s.updateType) ? (D.length - 1).toString() : V;
361
+ const N = Date.now();
362
+ r = r.map((M, b) => {
363
+ const O = r.slice(0, -1), D = z(E, O);
364
+ return b === r.length - 1 && ["insert", "cut"].includes(s.updateType) ? (D.length - 1).toString() : M;
365
365
  });
366
- const { oldValue: M, newValue: P } = Jt(
366
+ const { oldValue: V, newValue: W } = zt(
367
367
  s.updateType,
368
368
  u,
369
- T,
369
+ E,
370
370
  r
371
- ), B = {
372
- timeStamp: x,
373
- stateKey: h,
371
+ ), F = {
372
+ timeStamp: N,
373
+ stateKey: v,
374
374
  path: r,
375
375
  updateType: s.updateType,
376
376
  status: "new",
377
- oldValue: M,
378
- newValue: P
377
+ oldValue: V,
378
+ newValue: W
379
379
  };
380
380
  switch (s.updateType) {
381
381
  case "update":
382
- g.updateShadowAtPath(h, r, T);
382
+ g.updateShadowAtPath(v, r, E);
383
383
  break;
384
384
  case "insert":
385
- const V = r.slice(0, -1);
386
- g.insertShadowArrayElement(h, V, P);
385
+ const M = r.slice(0, -1);
386
+ g.insertShadowArrayElement(v, M, W);
387
387
  break;
388
388
  case "cut":
389
- const N = r.slice(0, -1), U = parseInt(r[r.length - 1]);
390
- g.removeShadowArrayElement(h, N, U);
389
+ const b = r.slice(0, -1), O = parseInt(r[r.length - 1]);
390
+ g.removeShadowArrayElement(v, b, O);
391
391
  break;
392
392
  }
393
- if (Ht(h, (V) => {
394
- const U = [...V ?? [], B].reduce((D, $) => {
395
- const A = `${$.stateKey}:${JSON.stringify($.path)}`, b = D.get(A);
396
- return b ? (b.timeStamp = Math.max(b.timeStamp, $.timeStamp), b.newValue = $.newValue, b.oldValue = b.oldValue ?? $.oldValue, b.updateType = $.updateType) : D.set(A, { ...$ }), D;
393
+ if (Wt(v, (M) => {
394
+ const O = [...M ?? [], F].reduce((D, S) => {
395
+ const k = `${S.stateKey}:${JSON.stringify(S.path)}`, C = D.get(k);
396
+ return C ? (C.timeStamp = Math.max(C.timeStamp, S.timeStamp), C.newValue = S.newValue, C.oldValue = C.oldValue ?? S.oldValue, C.updateType = S.updateType) : D.set(k, { ...S }), D;
397
397
  }, /* @__PURE__ */ new Map());
398
- return Array.from(U.values());
399
- }), bt(
400
- T,
401
- h,
402
- O.current,
403
- F
404
- ), O.current?.middleware && O.current.middleware({
398
+ return Array.from(O.values());
399
+ }), $t(
400
+ E,
401
+ v,
402
+ j.current,
403
+ U
404
+ ), j.current?.middleware && j.current.middleware({
405
405
  updateLog: l,
406
- update: B
407
- }), O.current?.serverSync) {
408
- const V = g.serverState[h], N = O.current?.serverSync;
409
- Bt(h, {
410
- syncKey: typeof N.syncKey == "string" ? N.syncKey : N.syncKey({ state: T }),
411
- rollBackState: V,
412
- actionTimeStamp: Date.now() + (N.debounce ?? 3e3),
406
+ update: F
407
+ }), j.current?.serverSync) {
408
+ const M = g.serverState[v], b = j.current?.serverSync;
409
+ Gt(v, {
410
+ syncKey: typeof b.syncKey == "string" ? b.syncKey : b.syncKey({ state: E }),
411
+ rollBackState: M,
412
+ actionTimeStamp: Date.now() + (b.debounce ?? 3e3),
413
413
  status: "waiting"
414
414
  });
415
415
  }
416
- return T;
416
+ return E;
417
417
  });
418
418
  };
419
- o.getState().updaterState[h] || (ut(
420
- h,
421
- gt(
422
- h,
423
- rt,
424
- Z.current,
425
- F
419
+ o.getState().updaterState[v] || (lt(
420
+ v,
421
+ dt(
422
+ v,
423
+ nt,
424
+ Y.current,
425
+ U
426
426
  )
427
- ), o.getState().cogsStateStore[h] || tt(h, t), o.getState().initialStateGlobal[h] || Tt(h, t));
428
- const d = It(() => gt(
429
- h,
430
- rt,
431
- Z.current,
432
- F
433
- ), [h, F]);
434
- return [Vt(h), d];
427
+ ), o.getState().cogsStateStore[v] || K(v, t), o.getState().initialStateGlobal[v] || It(v, t));
428
+ const d = ht(() => dt(
429
+ v,
430
+ nt,
431
+ Y.current,
432
+ U
433
+ ), [v, U]);
434
+ return [Nt(v), d];
435
435
  }
436
- function gt(t, c, m, f) {
437
- const y = /* @__PURE__ */ new Map();
438
- let k = 0;
439
- const p = (v) => {
440
- const n = v.join(".");
441
- for (const [S] of y)
442
- (S === n || S.startsWith(n + ".")) && y.delete(S);
443
- k++;
444
- }, I = {
445
- removeValidation: (v) => {
446
- v?.validationKey && q(v.validationKey);
436
+ function dt(t, c, h, f) {
437
+ const I = /* @__PURE__ */ new Map();
438
+ let $ = 0;
439
+ const w = (y) => {
440
+ const n = y.join(".");
441
+ for (const [m] of I)
442
+ (m === n || m.startsWith(n + ".")) && I.delete(m);
443
+ $++;
444
+ }, p = {
445
+ removeValidation: (y) => {
446
+ y?.validationKey && q(y.validationKey);
447
447
  },
448
- revertToInitialState: (v) => {
448
+ revertToInitialState: (y) => {
449
449
  const n = o.getState().getInitialOptions(t)?.validation;
450
- n?.key && q(n?.key), v?.validationKey && q(v.validationKey);
451
- const S = o.getState().initialStateGlobal[t];
452
- o.getState().clearSelectedIndexesForState(t), y.clear(), k++;
453
- const W = a(S, []), R = nt(t), F = J(R?.localStorage?.key) ? R?.localStorage?.key(S) : R?.localStorage?.key, G = `${f}-${t}-${F}`;
454
- G && localStorage.removeItem(G), ut(t, W), tt(t, S);
455
- const h = o.getState().stateComponents.get(t);
456
- return h && h.components.forEach((l) => {
450
+ n?.key && q(n?.key), y?.validationKey && q(y.validationKey);
451
+ const m = o.getState().initialStateGlobal[t];
452
+ o.getState().clearSelectedIndexesForState(t), I.clear(), $++;
453
+ const L = a(m, []), R = et(t), U = J(R?.localStorage?.key) ? R?.localStorage?.key(m) : R?.localStorage?.key, G = `${f}-${t}-${U}`;
454
+ G && localStorage.removeItem(G), lt(t, L), K(t, m);
455
+ const v = o.getState().stateComponents.get(t);
456
+ return v && v.components.forEach((l) => {
457
457
  l.forceUpdate();
458
- }), S;
458
+ }), m;
459
459
  },
460
- updateInitialState: (v) => {
461
- y.clear(), k++;
462
- const n = gt(
460
+ updateInitialState: (y) => {
461
+ I.clear(), $++;
462
+ const n = dt(
463
463
  t,
464
464
  c,
465
- m,
465
+ h,
466
466
  f
467
- ), S = o.getState().initialStateGlobal[t], W = nt(t), R = J(W?.localStorage?.key) ? W?.localStorage?.key(S) : W?.localStorage?.key, F = `${f}-${t}-${R}`;
468
- return localStorage.getItem(F) && localStorage.removeItem(F), jt(() => {
469
- Tt(t, v), o.getState().initializeShadowState(t, v), ut(t, n), tt(t, v);
467
+ ), m = o.getState().initialStateGlobal[t], L = et(t), R = J(L?.localStorage?.key) ? L?.localStorage?.key(m) : L?.localStorage?.key, U = `${f}-${t}-${R}`;
468
+ return localStorage.getItem(U) && localStorage.removeItem(U), Pt(() => {
469
+ It(t, y), o.getState().initializeShadowState(t, y), lt(t, n), K(t, y);
470
470
  const G = o.getState().stateComponents.get(t);
471
- G && G.components.forEach((h) => {
472
- h.forceUpdate();
471
+ G && G.components.forEach((v) => {
472
+ v.forceUpdate();
473
473
  });
474
474
  }), {
475
475
  fetchId: (G) => n.get()[G]
@@ -479,28 +479,28 @@ function gt(t, c, m, f) {
479
479
  _serverState: o.getState().serverState[t],
480
480
  _isLoading: o.getState().isLoadingGlobal[t],
481
481
  _isServerSynced: () => {
482
- const v = o.getState().serverState[t];
483
- return !!(v && H(v, Vt(t)));
482
+ const y = o.getState().serverState[t];
483
+ return !!(y && H(y, Nt(t)));
484
484
  }
485
485
  };
486
- function a(v, n = [], S) {
487
- const W = n.map(String).join(".");
488
- y.get(W);
486
+ function a(y, n = [], m) {
487
+ const L = n.map(String).join(".");
488
+ I.get(L);
489
489
  const R = function() {
490
490
  return o().getNestedState(t, n);
491
491
  };
492
- Object.keys(I).forEach((h) => {
493
- R[h] = I[h];
492
+ Object.keys(p).forEach((v) => {
493
+ R[v] = p[v];
494
494
  });
495
- const F = {
496
- apply(h, l, it) {
495
+ const U = {
496
+ apply(v, l, st) {
497
497
  return console.log(
498
498
  `PROXY APPLY TRAP HIT: stateKey=${t}, path=${n.join(".")}`
499
499
  ), console.trace("Apply trap stack trace"), o().getNestedState(t, n);
500
500
  },
501
- get(h, l) {
502
- S?.validIndices && !Array.isArray(v) && (S = { ...S, validIndices: void 0 });
503
- const it = /* @__PURE__ */ new Set([
501
+ get(v, l) {
502
+ m?.validIndices && !Array.isArray(y) && (m = { ...m, validIndices: void 0 });
503
+ const st = /* @__PURE__ */ new Set([
504
504
  "insert",
505
505
  "cut",
506
506
  "cutByValue",
@@ -523,8 +523,8 @@ function gt(t, c, m, f) {
523
523
  "_stateKey",
524
524
  "getComponents"
525
525
  ]);
526
- if (l !== "then" && !l.startsWith("$") && l !== "stateMapNoRender" && !it.has(l)) {
527
- const d = `${t}////${m}`, e = o.getState().stateComponents.get(t);
526
+ if (l !== "then" && !l.startsWith("$") && l !== "stateMapNoRender" && !st.has(l)) {
527
+ const d = `${t}////${h}`, e = o.getState().stateComponents.get(t);
528
528
  if (e) {
529
529
  const r = e.components.get(d);
530
530
  if (r && !r.paths.has("")) {
@@ -540,7 +540,7 @@ function gt(t, c, m, f) {
540
540
  }
541
541
  }
542
542
  if (l === "getDifferences")
543
- return () => pt(
543
+ return () => vt(
544
544
  o.getState().cogsStateStore[t],
545
545
  o.getState().initialStateGlobal[t]
546
546
  );
@@ -554,8 +554,8 @@ function gt(t, c, m, f) {
554
554
  const i = await e.action(r);
555
555
  if (i && !i.success && i.errors && s) {
556
556
  o.getState().removeValidationError(s), i.errors.forEach((u) => {
557
- const T = [s, ...u.path].join(".");
558
- o.getState().addValidationError(T, u.message);
557
+ const E = [s, ...u.path].join(".");
558
+ o.getState().addValidationError(E, u.message);
559
559
  });
560
560
  const g = o.getState().stateComponents.get(t);
561
561
  g && g.components.forEach((u) => {
@@ -581,7 +581,7 @@ function gt(t, c, m, f) {
581
581
  };
582
582
  if (l === "removeStorage")
583
583
  return () => {
584
- const d = o.getState().initialStateGlobal[t], e = nt(t), r = J(e?.localStorage?.key) ? e?.localStorage?.key(d) : e?.localStorage?.key, s = `${f}-${t}-${r}`;
584
+ const d = o.getState().initialStateGlobal[t], e = et(t), r = J(e?.localStorage?.key) ? e?.localStorage?.key(d) : e?.localStorage?.key, s = `${f}-${t}-${r}`;
585
585
  s && localStorage.removeItem(s);
586
586
  };
587
587
  if (l === "showValidationErrors")
@@ -591,10 +591,10 @@ function gt(t, c, m, f) {
591
591
  throw new Error("Validation key not found");
592
592
  return o.getState().getValidationErrors(d.key + "." + n.join("."));
593
593
  };
594
- if (Array.isArray(v)) {
595
- const d = () => S?.validIndices ? v.map((r, s) => ({
594
+ if (Array.isArray(y)) {
595
+ const d = () => m?.validIndices ? y.map((r, s) => ({
596
596
  item: r,
597
- originalIndex: S.validIndices[s]
597
+ originalIndex: m.validIndices[s]
598
598
  })) : o.getState().getNestedState(t, n).map((r, s) => ({
599
599
  item: r,
600
600
  originalIndex: s
@@ -604,9 +604,9 @@ function gt(t, c, m, f) {
604
604
  const e = o.getState().getSelectedIndex(t, n.join("."));
605
605
  if (e !== void 0)
606
606
  return a(
607
- v[e],
607
+ y[e],
608
608
  [...n, e.toString()],
609
- S
609
+ m
610
610
  );
611
611
  };
612
612
  if (l === "clearSelected")
@@ -621,117 +621,121 @@ function gt(t, c, m, f) {
621
621
  itemHeight: r = 50,
622
622
  overscan: s = 5,
623
623
  stickToBottom: i = !1
624
- } = e, g = Y(null), [u, T] = K({
624
+ } = e, g = Q(null), [u, E] = X({
625
625
  startIndex: 0,
626
626
  endIndex: 10
627
- }), w = Y(i), E = Y(0), [_, x] = K(0);
628
- at(() => o.getState().subscribeToShadowState(t, () => {
629
- x((b) => b + 1);
627
+ }), T = Q(i), [A, P] = X(0);
628
+ ot(() => o.getState().subscribeToShadowState(t, () => {
629
+ P((k) => k + 1);
630
630
  }), [t]);
631
- const M = o().getNestedState(
631
+ const N = o().getNestedState(
632
632
  t,
633
633
  n
634
- ), P = M.length, { totalHeight: B, positions: V } = It(() => {
635
- const A = o.getState().getShadowMetadata(t, n) || [];
636
- let b = 0;
637
- const j = [];
638
- for (let C = 0; C < P; C++) {
639
- j[C] = b;
640
- const L = A[C]?.virtualizer?.itemHeight;
641
- b += L || r;
634
+ ), V = N.length, { totalHeight: W, positions: F } = ht(() => {
635
+ const S = o.getState().getShadowMetadata(t, n) || [];
636
+ let k = 0;
637
+ const C = [];
638
+ for (let _ = 0; _ < V; _++) {
639
+ C[_] = k;
640
+ const x = S[_]?.virtualizer?.itemHeight;
641
+ k += x || r;
642
642
  }
643
- return { totalHeight: b, positions: j };
643
+ return { totalHeight: k, positions: C };
644
644
  }, [
645
- P,
645
+ V,
646
646
  t,
647
647
  n.join("."),
648
648
  r,
649
- _
650
- ]), N = It(() => {
651
- const A = Math.max(0, u.startIndex), b = Math.min(P, u.endIndex), j = Array.from(
652
- { length: b - A },
653
- (L, et) => A + et
654
- ), C = j.map((L) => M[L]);
655
- return a(C, n, {
656
- ...S,
657
- validIndices: j
649
+ A
650
+ ]), M = ht(() => {
651
+ const S = Math.max(0, u.startIndex), k = Math.min(V, u.endIndex), C = Array.from(
652
+ { length: k - S },
653
+ (x, B) => S + B
654
+ ), _ = C.map((x) => N[x]);
655
+ return a(_, n, {
656
+ ...m,
657
+ validIndices: C
658
658
  });
659
- }, [u.startIndex, u.endIndex, M, P]);
660
- dt(() => {
661
- const A = g.current;
662
- if (!A) return;
663
- const b = P > E.current, j = () => {
664
- const { scrollTop: C, clientHeight: L, scrollHeight: et } = A, Pt = et - C - L < 1;
665
- w.current = Pt;
666
- let mt = 0, ct = P - 1;
667
- for (; mt <= ct; ) {
668
- const Q = Math.floor((mt + ct) / 2);
669
- V[Q] < C ? mt = Q + 1 : ct = Q - 1;
659
+ }, [u.startIndex, u.endIndex, N, V]);
660
+ ct(() => {
661
+ const S = g.current;
662
+ if (!S) return;
663
+ let k;
664
+ const C = () => {
665
+ if (!S) return;
666
+ const { scrollTop: x } = S;
667
+ let B = 0, Z = V - 1;
668
+ for (; B <= Z; ) {
669
+ const ft = Math.floor((B + Z) / 2);
670
+ F[ft] < x ? B = ft + 1 : Z = ft - 1;
670
671
  }
671
- const ht = Math.max(0, ct - s);
672
- let X = ht;
673
- const _t = C + L;
674
- for (; X < P && V[X] < _t; )
675
- X++;
676
- X = Math.min(P, X + s), T((Q) => Q.startIndex !== ht || Q.endIndex !== X ? { startIndex: ht, endIndex: X } : Q);
672
+ const pt = Math.max(0, Z - s);
673
+ let tt = pt;
674
+ const Ct = x + S.clientHeight;
675
+ for (; tt < V && F[tt] < Ct; )
676
+ tt++;
677
+ tt = Math.min(V, tt + s), E({ startIndex: pt, endIndex: tt });
678
+ }, _ = () => {
679
+ T.current = S.scrollHeight - S.scrollTop - S.clientHeight < 1, C();
677
680
  };
678
- if (A.addEventListener("scroll", j, {
681
+ return S.addEventListener("scroll", _, {
679
682
  passive: !0
680
- }), i && w.current) {
681
- const C = b && E.current > 0 ? "smooth" : "auto";
682
- A.scrollTo({
683
- top: A.scrollHeight,
684
- behavior: C
683
+ }), i && (k = setTimeout(() => {
684
+ T.current && S.scrollTo({
685
+ top: S.scrollHeight,
686
+ behavior: "auto"
687
+ // ALWAYS 'auto' for an instant, correct jump.
685
688
  });
686
- }
687
- return E.current = P, j(), () => A.removeEventListener("scroll", j);
688
- }, [P, V, s, i]);
689
- const U = Et(
690
- (A = "smooth") => {
691
- g.current && g.current.scrollTo({
689
+ }, 200)), C(), () => {
690
+ clearTimeout(k), S.removeEventListener("scroll", _);
691
+ };
692
+ }, [V, F, i]);
693
+ const b = wt(
694
+ (S = "smooth") => {
695
+ g.current && (T.current = !0, g.current.scrollTo({
692
696
  top: g.current.scrollHeight,
693
- behavior: A
694
- });
697
+ behavior: S
698
+ }));
695
699
  },
696
700
  []
697
- ), D = Et(
698
- (A, b = "smooth") => {
699
- g.current && V[A] !== void 0 && g.current.scrollTo({
700
- top: V[A],
701
- behavior: b
702
- });
701
+ ), O = wt(
702
+ (S, k = "smooth") => {
703
+ g.current && F[S] !== void 0 && (T.current = !1, g.current.scrollTo({
704
+ top: F[S],
705
+ behavior: k
706
+ }));
703
707
  },
704
- [V]
705
- ), $ = {
708
+ [F]
709
+ ), D = {
706
710
  outer: {
707
711
  ref: g,
708
712
  style: { overflowY: "auto", height: "100%" }
709
713
  },
710
714
  inner: {
711
715
  style: {
712
- height: `${B}px`,
716
+ height: `${W}px`,
713
717
  position: "relative"
714
718
  }
715
719
  },
716
720
  list: {
717
721
  style: {
718
- transform: `translateY(${V[u.startIndex] || 0}px)`
722
+ transform: `translateY(${F[u.startIndex] || 0}px)`
719
723
  }
720
724
  }
721
725
  };
722
726
  return {
723
- virtualState: N,
724
- virtualizerProps: $,
725
- scrollToBottom: U,
726
- scrollToIndex: D
727
+ virtualState: M,
728
+ virtualizerProps: D,
729
+ scrollToBottom: b,
730
+ scrollToIndex: O
727
731
  };
728
732
  };
729
733
  if (l === "stateSort")
730
734
  return (e) => {
731
735
  const s = [...d()].sort(
732
- (u, T) => e(u.item, T.item)
736
+ (u, E) => e(u.item, E.item)
733
737
  ), i = s.map(({ item: u }) => u), g = {
734
- ...S,
738
+ ...m,
735
739
  validIndices: s.map(
736
740
  ({ originalIndex: u }) => u
737
741
  )
@@ -741,9 +745,9 @@ function gt(t, c, m, f) {
741
745
  if (l === "stateFilter")
742
746
  return (e) => {
743
747
  const s = d().filter(
744
- ({ item: u }, T) => e(u, T)
748
+ ({ item: u }, E) => e(u, E)
745
749
  ), i = s.map(({ item: u }) => u), g = {
746
- ...S,
750
+ ...m,
747
751
  validIndices: s.map(
748
752
  ({ originalIndex: u }) => u
749
753
  )
@@ -753,23 +757,23 @@ function gt(t, c, m, f) {
753
757
  if (l === "stateMap")
754
758
  return (e) => {
755
759
  const r = o.getState().getNestedState(t, n);
756
- return Array.isArray(r) ? (S?.validIndices || Array.from({ length: r.length }, (i, g) => g)).map((i, g) => {
757
- const u = r[i], T = [...n, i.toString()], w = a(u, T, S);
758
- return e(u, w, {
760
+ return Array.isArray(r) ? (m?.validIndices || Array.from({ length: r.length }, (i, g) => g)).map((i, g) => {
761
+ const u = r[i], E = [...n, i.toString()], T = a(u, E, m);
762
+ return e(u, T, {
759
763
  register: () => {
760
- const [, _] = K({}), x = `${m}-${n.join(".")}-${i}`;
761
- dt(() => {
762
- const M = `${t}////${x}`, P = o.getState().stateComponents.get(t) || {
764
+ const [, P] = X({}), N = `${h}-${n.join(".")}-${i}`;
765
+ ct(() => {
766
+ const V = `${t}////${N}`, W = o.getState().stateComponents.get(t) || {
763
767
  components: /* @__PURE__ */ new Map()
764
768
  };
765
- return P.components.set(M, {
766
- forceUpdate: () => _({}),
767
- paths: /* @__PURE__ */ new Set([T.join(".")])
768
- }), o.getState().stateComponents.set(t, P), () => {
769
- const B = o.getState().stateComponents.get(t);
770
- B && B.components.delete(M);
769
+ return W.components.set(V, {
770
+ forceUpdate: () => P({}),
771
+ paths: /* @__PURE__ */ new Set([E.join(".")])
772
+ }), o.getState().stateComponents.set(t, W), () => {
773
+ const F = o.getState().stateComponents.get(t);
774
+ F && F.components.delete(V);
771
775
  };
772
- }, [t, x]);
776
+ }, [t, N]);
773
777
  },
774
778
  index: g,
775
779
  originalIndex: i
@@ -780,20 +784,20 @@ function gt(t, c, m, f) {
780
784
  ), null);
781
785
  };
782
786
  if (l === "stateMapNoRender")
783
- return (e) => v.map((s, i) => {
787
+ return (e) => y.map((s, i) => {
784
788
  let g;
785
- S?.validIndices && S.validIndices[i] !== void 0 ? g = S.validIndices[i] : g = i;
786
- const u = [...n, g.toString()], T = a(s, u, S);
789
+ m?.validIndices && m.validIndices[i] !== void 0 ? g = m.validIndices[i] : g = i;
790
+ const u = [...n, g.toString()], E = a(s, u, m);
787
791
  return e(
788
792
  s,
789
- T,
793
+ E,
790
794
  i,
791
- v,
792
- a(v, n, S)
795
+ y,
796
+ a(y, n, m)
793
797
  );
794
798
  });
795
799
  if (l === "$stateMap")
796
- return (e) => st(Zt, {
800
+ return (e) => at(qt, {
797
801
  proxy: {
798
802
  _stateKey: t,
799
803
  _path: n,
@@ -805,19 +809,19 @@ function gt(t, c, m, f) {
805
809
  if (l === "stateList")
806
810
  return (e) => {
807
811
  const r = o.getState().getNestedState(t, n);
808
- return Array.isArray(r) ? (S?.validIndices || Array.from({ length: r.length }, (i, g) => g)).map((i, g) => {
809
- const u = r[i], T = [...n, i.toString()], w = a(u, T, S), E = `${m}-${n.join(".")}-${i}`;
810
- return st(Qt, {
812
+ return Array.isArray(r) ? (m?.validIndices || Array.from({ length: r.length }, (i, g) => g)).map((i, g) => {
813
+ const u = r[i], E = [...n, i.toString()], T = a(u, E, m), A = `${h}-${n.join(".")}-${i}`;
814
+ return at(Yt, {
811
815
  key: i,
812
816
  stateKey: t,
813
- itemComponentId: E,
814
- itemPath: T,
817
+ itemComponentId: A,
818
+ itemPath: E,
815
819
  children: e(
816
820
  u,
817
- w,
821
+ T,
818
822
  g,
819
823
  r,
820
- a(r, n, S)
824
+ a(r, n, m)
821
825
  )
822
826
  });
823
827
  }) : (console.warn(
@@ -826,20 +830,20 @@ function gt(t, c, m, f) {
826
830
  };
827
831
  if (l === "stateFlattenOn")
828
832
  return (e) => {
829
- const r = v;
830
- y.clear(), k++;
833
+ const r = y;
834
+ I.clear(), $++;
831
835
  const s = r.flatMap(
832
836
  (i) => i[e] ?? []
833
837
  );
834
838
  return a(
835
839
  s,
836
840
  [...n, "[*]", e],
837
- S
841
+ m
838
842
  );
839
843
  };
840
844
  if (l === "index")
841
845
  return (e) => {
842
- const r = v[e];
846
+ const r = y[e];
843
847
  return a(r, [...n, e.toString()]);
844
848
  };
845
849
  if (l === "last")
@@ -850,7 +854,7 @@ function gt(t, c, m, f) {
850
854
  return a(s, i);
851
855
  };
852
856
  if (l === "insert")
853
- return (e) => (p(n), vt(c, e, n, t), a(
857
+ return (e) => (w(n), St(c, e, n, t), a(
854
858
  o.getState().getNestedState(t, n),
855
859
  n
856
860
  ));
@@ -858,41 +862,41 @@ function gt(t, c, m, f) {
858
862
  return (e, r, s) => {
859
863
  const i = o.getState().getNestedState(t, n), g = J(e) ? e(i) : e;
860
864
  let u = null;
861
- if (!i.some((w) => {
865
+ if (!i.some((T) => {
862
866
  if (r) {
863
- const _ = r.every(
864
- (x) => H(w[x], g[x])
867
+ const P = r.every(
868
+ (N) => H(T[N], g[N])
865
869
  );
866
- return _ && (u = w), _;
870
+ return P && (u = T), P;
867
871
  }
868
- const E = H(w, g);
869
- return E && (u = w), E;
872
+ const A = H(T, g);
873
+ return A && (u = T), A;
870
874
  }))
871
- p(n), vt(c, g, n, t);
875
+ w(n), St(c, g, n, t);
872
876
  else if (s && u) {
873
- const w = s(u), E = i.map(
874
- (_) => H(_, u) ? w : _
877
+ const T = s(u), A = i.map(
878
+ (P) => H(P, u) ? T : P
875
879
  );
876
- p(n), ot(c, E, n);
880
+ w(n), rt(c, A, n);
877
881
  }
878
882
  };
879
883
  if (l === "cut")
880
884
  return (e, r) => {
881
885
  if (!r?.waitForSync)
882
- return p(n), lt(c, n, t, e), a(
886
+ return w(n), it(c, n, t, e), a(
883
887
  o.getState().getNestedState(t, n),
884
888
  n
885
889
  );
886
890
  };
887
891
  if (l === "cutByValue")
888
892
  return (e) => {
889
- for (let r = 0; r < v.length; r++)
890
- v[r] === e && lt(c, n, t, r);
893
+ for (let r = 0; r < y.length; r++)
894
+ y[r] === e && it(c, n, t, r);
891
895
  };
892
896
  if (l === "toggleByValue")
893
897
  return (e) => {
894
- const r = v.findIndex((s) => s === e);
895
- r > -1 ? lt(c, n, t, r) : vt(c, e, n, t);
898
+ const r = y.findIndex((s) => s === e);
899
+ r > -1 ? it(c, n, t, r) : St(c, e, n, t);
896
900
  };
897
901
  if (l === "stateFind")
898
902
  return (e) => {
@@ -901,7 +905,7 @@ function gt(t, c, m, f) {
901
905
  );
902
906
  if (!s) return;
903
907
  const i = [...n, s.originalIndex.toString()];
904
- return a(s.item, i, S);
908
+ return a(s.item, i, m);
905
909
  };
906
910
  if (l === "findWith")
907
911
  return (e, r) => {
@@ -910,36 +914,36 @@ function gt(t, c, m, f) {
910
914
  );
911
915
  if (!i) return;
912
916
  const g = [...n, i.originalIndex.toString()];
913
- return a(i.item, g, S);
917
+ return a(i.item, g, m);
914
918
  };
915
919
  }
916
- const Z = n[n.length - 1];
917
- if (!isNaN(Number(Z))) {
920
+ const Y = n[n.length - 1];
921
+ if (!isNaN(Number(Y))) {
918
922
  const d = n.slice(0, -1), e = o.getState().getNestedState(t, d);
919
923
  if (Array.isArray(e) && l === "cut")
920
- return () => lt(
924
+ return () => it(
921
925
  c,
922
926
  d,
923
927
  t,
924
- Number(Z)
928
+ Number(Y)
925
929
  );
926
930
  }
927
931
  if (l === "get")
928
932
  return () => {
929
- if (S?.validIndices && Array.isArray(v)) {
933
+ if (m?.validIndices && Array.isArray(y)) {
930
934
  const d = o.getState().getNestedState(t, n);
931
- return S.validIndices.map((e) => d[e]);
935
+ return m.validIndices.map((e) => d[e]);
932
936
  }
933
937
  return o.getState().getNestedState(t, n);
934
938
  };
935
939
  if (l === "$derive")
936
- return (d) => Nt({
940
+ return (d) => kt({
937
941
  _stateKey: t,
938
942
  _path: n,
939
943
  _effect: d.toString()
940
944
  });
941
945
  if (l === "$get")
942
- return () => Nt({
946
+ return () => kt({
943
947
  _stateKey: t,
944
948
  _path: n
945
949
  });
@@ -948,7 +952,7 @@ function gt(t, c, m, f) {
948
952
  return o.getState().getSyncInfo(d);
949
953
  }
950
954
  if (l == "getLocalStorage")
951
- return (d) => ft(f + "-" + t + "-" + d);
955
+ return (d) => ut(f + "-" + t + "-" + d);
952
956
  if (l === "_selected") {
953
957
  const d = n.slice(0, -1), e = d.join("."), r = o.getState().getNestedState(t, d);
954
958
  return Array.isArray(r) ? Number(n[n.length - 1]) === o.getState().getSelectedIndex(t, e) : void 0;
@@ -958,7 +962,7 @@ function gt(t, c, m, f) {
958
962
  const e = n.slice(0, -1), r = Number(n[n.length - 1]), s = e.join(".");
959
963
  d ? o.getState().setSelectedIndex(t, s, r) : o.getState().setSelectedIndex(t, s, void 0);
960
964
  const i = o.getState().getNestedState(t, [...e]);
961
- ot(c, i, e), p(e);
965
+ rt(c, i, e), w(e);
962
966
  };
963
967
  if (l === "toggleSelected")
964
968
  return () => {
@@ -969,73 +973,73 @@ function gt(t, c, m, f) {
969
973
  s === e ? void 0 : e
970
974
  );
971
975
  const i = o.getState().getNestedState(t, [...d]);
972
- ot(c, i, d), p(d);
976
+ rt(c, i, d), w(d);
973
977
  };
974
978
  if (n.length == 0) {
975
979
  if (l === "applyJsonPatch")
976
980
  return (d) => {
977
- const e = o.getState().cogsStateStore[t], s = Wt(e, d).newDocument;
978
- xt(
981
+ const e = o.getState().cogsStateStore[t], s = Ut(e, d).newDocument;
982
+ Vt(
979
983
  t,
980
984
  o.getState().initialStateGlobal[t],
981
985
  s,
982
986
  c,
983
- m,
987
+ h,
984
988
  f
985
989
  );
986
990
  const i = o.getState().stateComponents.get(t);
987
991
  if (i) {
988
- const g = pt(e, s), u = new Set(g);
992
+ const g = vt(e, s), u = new Set(g);
989
993
  for (const [
990
- T,
991
- w
994
+ E,
995
+ T
992
996
  ] of i.components.entries()) {
993
- let E = !1;
994
- const _ = Array.isArray(w.reactiveType) ? w.reactiveType : [w.reactiveType || "component"];
995
- if (!_.includes("none")) {
996
- if (_.includes("all")) {
997
- w.forceUpdate();
997
+ let A = !1;
998
+ const P = Array.isArray(T.reactiveType) ? T.reactiveType : [T.reactiveType || "component"];
999
+ if (!P.includes("none")) {
1000
+ if (P.includes("all")) {
1001
+ T.forceUpdate();
998
1002
  continue;
999
1003
  }
1000
- if (_.includes("component") && (w.paths.has("") && (E = !0), !E))
1001
- for (const x of u) {
1002
- if (w.paths.has(x)) {
1003
- E = !0;
1004
+ if (P.includes("component") && (T.paths.has("") && (A = !0), !A))
1005
+ for (const N of u) {
1006
+ if (T.paths.has(N)) {
1007
+ A = !0;
1004
1008
  break;
1005
1009
  }
1006
- let M = x.lastIndexOf(".");
1007
- for (; M !== -1; ) {
1008
- const P = x.substring(0, M);
1009
- if (w.paths.has(P)) {
1010
- E = !0;
1010
+ let V = N.lastIndexOf(".");
1011
+ for (; V !== -1; ) {
1012
+ const W = N.substring(0, V);
1013
+ if (T.paths.has(W)) {
1014
+ A = !0;
1011
1015
  break;
1012
1016
  }
1013
- const B = x.substring(
1014
- M + 1
1017
+ const F = N.substring(
1018
+ V + 1
1015
1019
  );
1016
- if (!isNaN(Number(B))) {
1017
- const V = P.lastIndexOf(".");
1018
- if (V !== -1) {
1019
- const N = P.substring(
1020
+ if (!isNaN(Number(F))) {
1021
+ const M = W.lastIndexOf(".");
1022
+ if (M !== -1) {
1023
+ const b = W.substring(
1020
1024
  0,
1021
- V
1025
+ M
1022
1026
  );
1023
- if (w.paths.has(N)) {
1024
- E = !0;
1027
+ if (T.paths.has(b)) {
1028
+ A = !0;
1025
1029
  break;
1026
1030
  }
1027
1031
  }
1028
1032
  }
1029
- M = P.lastIndexOf(".");
1033
+ V = W.lastIndexOf(".");
1030
1034
  }
1031
- if (E) break;
1035
+ if (A) break;
1032
1036
  }
1033
- if (!E && _.includes("deps") && w.depsFunction) {
1034
- const x = w.depsFunction(s);
1035
- let M = !1;
1036
- typeof x == "boolean" ? x && (M = !0) : H(w.deps, x) || (w.deps = x, M = !0), M && (E = !0);
1037
+ if (!A && P.includes("deps") && T.depsFunction) {
1038
+ const N = T.depsFunction(s);
1039
+ let V = !1;
1040
+ typeof N == "boolean" ? N && (V = !0) : H(T.deps, N) || (T.deps = N, V = !0), V && (A = !0);
1037
1041
  }
1038
- E && w.forceUpdate();
1042
+ A && T.forceUpdate();
1039
1043
  }
1040
1044
  }
1041
1045
  }
@@ -1056,18 +1060,18 @@ function gt(t, c, m, f) {
1056
1060
  });
1057
1061
  const i = d.zodSchema.safeParse(r);
1058
1062
  return i.success ? !0 : (i.error.errors.forEach((u) => {
1059
- const T = u.path, w = u.message, E = [d.key, ...T].join(".");
1060
- e(E, w);
1061
- }), St(t), !1);
1063
+ const E = u.path, T = u.message, A = [d.key, ...E].join(".");
1064
+ e(A, T);
1065
+ }), gt(t), !1);
1062
1066
  } catch (s) {
1063
1067
  return console.error("Zod schema validation failed", s), !1;
1064
1068
  }
1065
1069
  };
1066
- if (l === "_componentId") return m;
1070
+ if (l === "_componentId") return h;
1067
1071
  if (l === "getComponents")
1068
1072
  return () => o().stateComponents.get(t);
1069
1073
  if (l === "getAllFormRefs")
1070
- return () => At.getState().getFormRefsByStateKey(t);
1074
+ return () => Tt.getState().getFormRefsByStateKey(t);
1071
1075
  if (l === "_initialState")
1072
1076
  return o.getState().initialStateGlobal[t];
1073
1077
  if (l === "_serverState")
@@ -1075,48 +1079,48 @@ function gt(t, c, m, f) {
1075
1079
  if (l === "_isLoading")
1076
1080
  return o.getState().isLoadingGlobal[t];
1077
1081
  if (l === "revertToInitialState")
1078
- return I.revertToInitialState;
1079
- if (l === "updateInitialState") return I.updateInitialState;
1080
- if (l === "removeValidation") return I.removeValidation;
1082
+ return p.revertToInitialState;
1083
+ if (l === "updateInitialState") return p.updateInitialState;
1084
+ if (l === "removeValidation") return p.removeValidation;
1081
1085
  }
1082
1086
  if (l === "getFormRef")
1083
- return () => At.getState().getFormRef(t + "." + n.join("."));
1087
+ return () => Tt.getState().getFormRef(t + "." + n.join("."));
1084
1088
  if (l === "validationWrapper")
1085
1089
  return ({
1086
1090
  children: d,
1087
1091
  hideMessage: e
1088
- }) => /* @__PURE__ */ yt(
1089
- Rt,
1092
+ }) => /* @__PURE__ */ mt(
1093
+ jt,
1090
1094
  {
1091
1095
  formOpts: e ? { validation: { message: "" } } : void 0,
1092
1096
  path: n,
1093
1097
  validationKey: o.getState().getInitialOptions(t)?.validation?.key || "",
1094
1098
  stateKey: t,
1095
- validIndices: S?.validIndices,
1099
+ validIndices: m?.validIndices,
1096
1100
  children: d
1097
1101
  }
1098
1102
  );
1099
1103
  if (l === "_stateKey") return t;
1100
1104
  if (l === "_path") return n;
1101
- if (l === "_isServerSynced") return I._isServerSynced;
1105
+ if (l === "_isServerSynced") return p._isServerSynced;
1102
1106
  if (l === "update")
1103
1107
  return (d, e) => {
1104
1108
  if (e?.debounce)
1105
- Ut(() => {
1106
- ot(c, d, n, "");
1109
+ Mt(() => {
1110
+ rt(c, d, n, "");
1107
1111
  const r = o.getState().getNestedState(t, n);
1108
1112
  e?.afterUpdate && e.afterUpdate(r);
1109
1113
  }, e.debounce);
1110
1114
  else {
1111
- ot(c, d, n, "");
1115
+ rt(c, d, n, "");
1112
1116
  const r = o.getState().getNestedState(t, n);
1113
1117
  e?.afterUpdate && e.afterUpdate(r);
1114
1118
  }
1115
- p(n);
1119
+ w(n);
1116
1120
  };
1117
1121
  if (l === "formElement")
1118
- return (d, e) => /* @__PURE__ */ yt(
1119
- Ft,
1122
+ return (d, e) => /* @__PURE__ */ mt(
1123
+ Ot,
1120
1124
  {
1121
1125
  setState: c,
1122
1126
  stateKey: t,
@@ -1125,120 +1129,120 @@ function gt(t, c, m, f) {
1125
1129
  formOpts: e
1126
1130
  }
1127
1131
  );
1128
- const O = [...n, l], rt = o.getState().getNestedState(t, O);
1129
- return a(rt, O, S);
1132
+ const j = [...n, l], nt = o.getState().getNestedState(t, j);
1133
+ return a(nt, j, m);
1130
1134
  }
1131
- }, G = new Proxy(R, F);
1132
- return y.set(W, {
1135
+ }, G = new Proxy(R, U);
1136
+ return I.set(L, {
1133
1137
  proxy: G,
1134
- stateVersion: k
1138
+ stateVersion: $
1135
1139
  }), G;
1136
1140
  }
1137
1141
  return a(
1138
1142
  o.getState().getNestedState(t, [])
1139
1143
  );
1140
1144
  }
1141
- function Nt(t) {
1142
- return st(Xt, { proxy: t });
1145
+ function kt(t) {
1146
+ return at(Jt, { proxy: t });
1143
1147
  }
1144
- function Zt({
1148
+ function qt({
1145
1149
  proxy: t,
1146
1150
  rebuildStateShape: c
1147
1151
  }) {
1148
- const m = o().getNestedState(t._stateKey, t._path);
1149
- return Array.isArray(m) ? c(
1150
- m,
1152
+ const h = o().getNestedState(t._stateKey, t._path);
1153
+ return Array.isArray(h) ? c(
1154
+ h,
1151
1155
  t._path
1152
1156
  ).stateMapNoRender(
1153
- (y, k, p, I, a) => t._mapFn(y, k, p, I, a)
1157
+ (I, $, w, p, a) => t._mapFn(I, $, w, p, a)
1154
1158
  ) : null;
1155
1159
  }
1156
- function Xt({
1160
+ function Jt({
1157
1161
  proxy: t
1158
1162
  }) {
1159
- const c = Y(null), m = `${t._stateKey}-${t._path.join(".")}`;
1160
- return at(() => {
1163
+ const c = Q(null), h = `${t._stateKey}-${t._path.join(".")}`;
1164
+ return ot(() => {
1161
1165
  const f = c.current;
1162
1166
  if (!f || !f.parentElement) return;
1163
- const y = f.parentElement, p = Array.from(y.childNodes).indexOf(f);
1164
- let I = y.getAttribute("data-parent-id");
1165
- I || (I = `parent-${crypto.randomUUID()}`, y.setAttribute("data-parent-id", I));
1166
- const v = {
1167
+ const I = f.parentElement, w = Array.from(I.childNodes).indexOf(f);
1168
+ let p = I.getAttribute("data-parent-id");
1169
+ p || (p = `parent-${crypto.randomUUID()}`, I.setAttribute("data-parent-id", p));
1170
+ const y = {
1167
1171
  instanceId: `instance-${crypto.randomUUID()}`,
1168
- parentId: I,
1169
- position: p,
1172
+ parentId: p,
1173
+ position: w,
1170
1174
  effect: t._effect
1171
1175
  };
1172
- o.getState().addSignalElement(m, v);
1176
+ o.getState().addSignalElement(h, y);
1173
1177
  const n = o.getState().getNestedState(t._stateKey, t._path);
1174
- let S;
1178
+ let m;
1175
1179
  if (t._effect)
1176
1180
  try {
1177
- S = new Function(
1181
+ m = new Function(
1178
1182
  "state",
1179
1183
  `return (${t._effect})(state)`
1180
1184
  )(n);
1181
1185
  } catch (R) {
1182
- console.error("Error evaluating effect function during mount:", R), S = n;
1186
+ console.error("Error evaluating effect function during mount:", R), m = n;
1183
1187
  }
1184
1188
  else
1185
- S = n;
1186
- S !== null && typeof S == "object" && (S = JSON.stringify(S));
1187
- const W = document.createTextNode(String(S));
1188
- f.replaceWith(W);
1189
- }, [t._stateKey, t._path.join("."), t._effect]), st("span", {
1189
+ m = n;
1190
+ m !== null && typeof m == "object" && (m = JSON.stringify(m));
1191
+ const L = document.createTextNode(String(m));
1192
+ f.replaceWith(L);
1193
+ }, [t._stateKey, t._path.join("."), t._effect]), at("span", {
1190
1194
  ref: c,
1191
1195
  style: { display: "none" },
1192
- "data-signal-id": m
1196
+ "data-signal-id": h
1193
1197
  });
1194
1198
  }
1195
- function fe(t) {
1196
- const c = Mt(
1197
- (m) => {
1199
+ function de(t) {
1200
+ const c = xt(
1201
+ (h) => {
1198
1202
  const f = o.getState().stateComponents.get(t._stateKey) || {
1199
1203
  components: /* @__PURE__ */ new Map()
1200
1204
  };
1201
1205
  return f.components.set(t._stateKey, {
1202
- forceUpdate: m,
1206
+ forceUpdate: h,
1203
1207
  paths: /* @__PURE__ */ new Set([t._path.join(".")])
1204
1208
  }), () => f.components.delete(t._stateKey);
1205
1209
  },
1206
1210
  () => o.getState().getNestedState(t._stateKey, t._path)
1207
1211
  );
1208
- return st("text", {}, String(c));
1212
+ return at("text", {}, String(c));
1209
1213
  }
1210
- function Qt({
1214
+ function Yt({
1211
1215
  stateKey: t,
1212
1216
  itemComponentId: c,
1213
- itemPath: m,
1217
+ itemPath: h,
1214
1218
  children: f
1215
1219
  }) {
1216
- const [, y] = K({}), [k, p] = Gt(), I = Y(null);
1217
- return at(() => {
1218
- p.height > 0 && p.height !== I.current && (I.current = p.height, o.getState().setShadowMetadata(t, m, {
1220
+ const [, I] = X({}), [$, w] = Ft(), p = Q(null);
1221
+ return ot(() => {
1222
+ w.height > 0 && w.height !== p.current && (p.current = w.height, o.getState().setShadowMetadata(t, h, {
1219
1223
  virtualizer: {
1220
- itemHeight: p.height
1224
+ itemHeight: w.height
1221
1225
  }
1222
1226
  }));
1223
- }, [p.height, t, m]), dt(() => {
1224
- const a = `${t}////${c}`, v = o.getState().stateComponents.get(t) || {
1227
+ }, [w.height, t, h]), ct(() => {
1228
+ const a = `${t}////${c}`, y = o.getState().stateComponents.get(t) || {
1225
1229
  components: /* @__PURE__ */ new Map()
1226
1230
  };
1227
- return v.components.set(a, {
1228
- forceUpdate: () => y({}),
1229
- paths: /* @__PURE__ */ new Set([m.join(".")])
1230
- }), o.getState().stateComponents.set(t, v), () => {
1231
+ return y.components.set(a, {
1232
+ forceUpdate: () => I({}),
1233
+ paths: /* @__PURE__ */ new Set([h.join(".")])
1234
+ }), o.getState().stateComponents.set(t, y), () => {
1231
1235
  const n = o.getState().stateComponents.get(t);
1232
1236
  n && n.components.delete(a);
1233
1237
  };
1234
- }, [t, c, m.join(".")]), /* @__PURE__ */ yt("div", { ref: k, children: f });
1238
+ }, [t, c, h.join(".")]), /* @__PURE__ */ mt("div", { ref: $, children: f });
1235
1239
  }
1236
1240
  export {
1237
- Nt as $cogsSignal,
1238
- fe as $cogsSignalStore,
1239
- de as addStateOptions,
1240
- ue as createCogsState,
1241
- ge as notifyComponent,
1242
- Yt as useCogsStateFn
1241
+ kt as $cogsSignal,
1242
+ de as $cogsSignalStore,
1243
+ ie as addStateOptions,
1244
+ ce as createCogsState,
1245
+ le as notifyComponent,
1246
+ Bt as useCogsStateFn
1243
1247
  };
1244
1248
  //# sourceMappingURL=CogsState.jsx.map