cogsbox-state 0.5.347 → 0.5.349

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