@stonecrop/stonecrop 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/stonecrop.js CHANGED
@@ -1,574 +1,564 @@
1
- import { hasInjectionContext as Ke, inject as he, getCurrentInstance as Ae, toRaw as Ve, computed as B, isRef as X, isReactive as ye, toRef as oe, ref as M, reactive as we, markRaw as te, effectScope as Ze, nextTick as ce, getCurrentScope as Fe, onScopeDispose as ke, watch as H, toRefs as Re, onMounted as Le, readonly as Me, customRef as Ge, toValue as J, shallowRef as xe, unref as qe, provide as _e } from "vue";
2
- /*!
3
- * pinia v3.0.3
4
- * (c) 2025 Eduardo San Martin Morote
5
- * @license MIT
6
- */
7
- let re;
8
- const ge = (r) => re = r, Ye = process.env.NODE_ENV !== "production" ? Symbol("pinia") : (
1
+ import { hasInjectionContext as we, inject as te, getCurrentInstance as ke, toRaw as Fe, computed as B, isRef as re, isReactive as ye, toRef as se, ref as L, reactive as Ee, markRaw as ne, effectScope as Ke, nextTick as ue, getCurrentScope as Ze, onScopeDispose as qe, watch as H, toRefs as Pe, onMounted as Me, readonly as Le, customRef as Ge, toValue as J, shallowRef as xe, unref as Ye, provide as Ne } from "vue";
2
+ const Q = typeof window < "u";
3
+ let K;
4
+ const ge = (o) => K = o;
5
+ process.env.NODE_ENV;
6
+ const Oe = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia") : (
9
7
  /* istanbul ignore next */
10
- Symbol()
8
+ /* @__PURE__ */ Symbol()
11
9
  );
12
- function Z(r) {
13
- return r && typeof r == "object" && Object.prototype.toString.call(r) === "[object Object]" && typeof r.toJSON != "function";
10
+ function q(o) {
11
+ return o && typeof o == "object" && Object.prototype.toString.call(o) === "[object Object]" && typeof o.toJSON != "function";
14
12
  }
15
- var se;
16
- (function(r) {
17
- r.direct = "direct", r.patchObject = "patch object", r.patchFunction = "patch function";
18
- })(se || (se = {}));
19
- const ne = typeof window < "u";
20
- function Be(r, e) {
13
+ var ie;
14
+ (function(o) {
15
+ o.direct = "direct", o.patchObject = "patch object", o.patchFunction = "patch function";
16
+ })(ie || (ie = {}));
17
+ function Be(o, e) {
21
18
  for (const t in e) {
22
- const n = e[t];
23
- if (!(t in r))
19
+ const r = e[t];
20
+ if (!(t in o))
24
21
  continue;
25
- const o = r[t];
26
- Z(o) && Z(n) && !X(n) && !ye(n) ? r[t] = Be(o, n) : r[t] = n;
22
+ const n = o[t];
23
+ q(n) && q(r) && !re(r) && !ye(r) ? o[t] = Be(n, r) : o[t] = r;
27
24
  }
28
- return r;
25
+ return o;
29
26
  }
30
27
  const je = () => {
31
28
  };
32
- function Pe(r, e, t, n = je) {
33
- r.push(e);
34
- const o = () => {
35
- const s = r.indexOf(e);
36
- s > -1 && (r.splice(s, 1), n());
29
+ function Ie(o, e, t, r = je) {
30
+ o.add(e);
31
+ const n = () => {
32
+ o.delete(e) && r();
37
33
  };
38
- return !t && Fe() && ke(o), o;
34
+ return !t && Ze() && qe(n), n;
39
35
  }
40
- function q(r, ...e) {
41
- r.slice().forEach((t) => {
36
+ function Y(o, ...e) {
37
+ o.forEach((t) => {
42
38
  t(...e);
43
39
  });
44
40
  }
45
- const Qe = (r) => r(), Ne = Symbol(), me = Symbol();
46
- function Ee(r, e) {
47
- r instanceof Map && e instanceof Map ? e.forEach((t, n) => r.set(n, t)) : r instanceof Set && e instanceof Set && e.forEach(r.add, r);
41
+ const Qe = (o) => o(), De = /* @__PURE__ */ Symbol(), me = /* @__PURE__ */ Symbol();
42
+ function Re(o, e) {
43
+ o instanceof Map && e instanceof Map ? e.forEach((t, r) => o.set(r, t)) : o instanceof Set && e instanceof Set && e.forEach(o.add, o);
48
44
  for (const t in e) {
49
45
  if (!e.hasOwnProperty(t))
50
46
  continue;
51
- const n = e[t], o = r[t];
52
- Z(o) && Z(n) && r.hasOwnProperty(t) && !X(n) && !ye(n) ? r[t] = Ee(o, n) : r[t] = n;
47
+ const r = e[t], n = o[t];
48
+ q(n) && q(r) && o.hasOwnProperty(t) && !re(r) && !ye(r) ? o[t] = Re(n, r) : o[t] = r;
53
49
  }
54
- return r;
50
+ return o;
55
51
  }
56
- const Xe = process.env.NODE_ENV !== "production" ? Symbol("pinia:skipHydration") : (
52
+ const Xe = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia:skipHydration") : (
57
53
  /* istanbul ignore next */
58
- Symbol()
54
+ /* @__PURE__ */ Symbol()
59
55
  );
60
- function et(r) {
61
- return !Z(r) || !Object.prototype.hasOwnProperty.call(r, Xe);
56
+ function et(o) {
57
+ return !q(o) || !Object.prototype.hasOwnProperty.call(o, Xe);
62
58
  }
63
59
  const { assign: U } = Object;
64
- function Ie(r) {
65
- return !!(X(r) && r.effect);
60
+ function $e(o) {
61
+ return !!(re(o) && o.effect);
66
62
  }
67
- function $e(r, e, t, n) {
68
- const { state: o, actions: s, getters: i } = e, a = t.state.value[r];
63
+ function Te(o, e, t, r) {
64
+ const { state: n, actions: s, getters: i } = e, a = t.state.value[o];
69
65
  let c;
70
- function l() {
71
- !a && (process.env.NODE_ENV === "production" || !n) && (t.state.value[r] = o ? o() : {});
72
- const S = process.env.NODE_ENV !== "production" && n ? (
66
+ function h() {
67
+ !a && (process.env.NODE_ENV === "production" || !r) && (t.state.value[o] = n ? n() : {});
68
+ const b = process.env.NODE_ENV !== "production" && r ? (
73
69
  // use ref() to unwrap refs inside state TODO: check if this is still necessary
74
- Re(M(o ? o() : {}).value)
75
- ) : Re(t.state.value[r]);
76
- return U(S, s, Object.keys(i || {}).reduce((w, P) => (process.env.NODE_ENV !== "production" && P in S && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${P}" in store "${r}".`), w[P] = te(B(() => {
70
+ Pe(L(n ? n() : {}).value)
71
+ ) : Pe(t.state.value[o]);
72
+ return U(b, s, Object.keys(i || {}).reduce((w, P) => (process.env.NODE_ENV !== "production" && P in b && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${P}" in store "${o}".`), w[P] = ne(B(() => {
77
73
  ge(t);
78
- const $ = t._s.get(r);
79
- return i[P].call($, $);
74
+ const D = t._s.get(o);
75
+ return i[P].call(D, D);
80
76
  })), w), {}));
81
77
  }
82
- return c = Oe(r, l, e, t, n, !0), c;
78
+ return c = _e(o, h, e, t, r, !0), c;
83
79
  }
84
- function Oe(r, e, t = {}, n, o, s) {
80
+ function _e(o, e, t = {}, r, n, s) {
85
81
  let i;
86
82
  const a = U({ actions: {} }, t);
87
- if (process.env.NODE_ENV !== "production" && !n._e.active)
83
+ if (process.env.NODE_ENV !== "production" && !r._e.active)
88
84
  throw new Error("Pinia destroyed");
89
85
  const c = { deep: !0 };
90
86
  process.env.NODE_ENV !== "production" && (c.onTrigger = (u) => {
91
- l ? $ = u : l == !1 && !g._hotUpdating && (Array.isArray($) ? $.push(u) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."));
87
+ h ? D = u : h == !1 && !g._hotUpdating && (Array.isArray(D) ? D.push(u) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."));
92
88
  });
93
- let l, S, w = [], P = [], $;
94
- const T = n.state.value[r];
95
- !s && !T && (process.env.NODE_ENV === "production" || !o) && (n.state.value[r] = {});
96
- const k = M({});
89
+ let h, b, w = /* @__PURE__ */ new Set(), P = /* @__PURE__ */ new Set(), D;
90
+ const C = r.state.value[o];
91
+ !s && !C && (process.env.NODE_ENV === "production" || !n) && (r.state.value[o] = {});
92
+ const F = L({});
97
93
  let _;
98
- function D(u) {
99
- let f;
100
- l = S = !1, process.env.NODE_ENV !== "production" && ($ = []), typeof u == "function" ? (u(n.state.value[r]), f = {
101
- type: se.patchFunction,
102
- storeId: r,
103
- events: $
104
- }) : (Ee(n.state.value[r], u), f = {
105
- type: se.patchObject,
94
+ function $(u) {
95
+ let l;
96
+ h = b = !1, process.env.NODE_ENV !== "production" && (D = []), typeof u == "function" ? (u(r.state.value[o]), l = {
97
+ type: ie.patchFunction,
98
+ storeId: o,
99
+ events: D
100
+ }) : (Re(r.state.value[o], u), l = {
101
+ type: ie.patchObject,
106
102
  payload: u,
107
- storeId: r,
108
- events: $
103
+ storeId: o,
104
+ events: D
109
105
  });
110
- const O = _ = Symbol();
111
- ce().then(() => {
112
- _ === O && (l = !0);
113
- }), S = !0, q(w, f, n.state.value[r]);
106
+ const O = _ = /* @__PURE__ */ Symbol();
107
+ ue().then(() => {
108
+ _ === O && (h = !0);
109
+ }), b = !0, Y(w, l, r.state.value[o]);
114
110
  }
115
111
  const R = s ? function() {
116
- const { state: f } = t, O = f ? f() : {};
112
+ const { state: l } = t, O = l ? l() : {};
117
113
  this.$patch((y) => {
118
114
  U(y, O);
119
115
  });
120
116
  } : (
121
117
  /* istanbul ignore next */
122
118
  process.env.NODE_ENV !== "production" ? () => {
123
- throw new Error(`🍍: Store "${r}" is built using the setup syntax and does not implement $reset().`);
119
+ throw new Error(`🍍: Store "${o}" is built using the setup syntax and does not implement $reset().`);
124
120
  } : je
125
121
  );
126
- function b() {
127
- i.stop(), w = [], P = [], n._s.delete(r);
122
+ function S() {
123
+ i.stop(), w.clear(), P.clear(), r._s.delete(o);
128
124
  }
129
- const C = (u, f = "") => {
130
- if (Ne in u)
131
- return u[me] = f, u;
125
+ const T = (u, l = "") => {
126
+ if (De in u)
127
+ return u[me] = l, u;
132
128
  const O = function() {
133
- ge(n);
134
- const y = Array.from(arguments), d = [], m = [];
135
- function N(V) {
136
- d.push(V);
129
+ ge(r);
130
+ const y = Array.from(arguments), f = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Set();
131
+ function I(V) {
132
+ f.add(V);
137
133
  }
138
134
  function A(V) {
139
- m.push(V);
135
+ m.add(V);
140
136
  }
141
- q(P, {
137
+ Y(P, {
142
138
  args: y,
143
139
  name: O[me],
144
140
  store: g,
145
- after: N,
141
+ after: I,
146
142
  onError: A
147
143
  });
148
144
  let j;
149
145
  try {
150
- j = u.apply(this && this.$id === r ? this : g, y);
146
+ j = u.apply(this && this.$id === o ? this : g, y);
151
147
  } catch (V) {
152
- throw q(m, V), V;
148
+ throw Y(m, V), V;
153
149
  }
154
- return j instanceof Promise ? j.then((V) => (q(d, V), V)).catch((V) => (q(m, V), Promise.reject(V))) : (q(d, j), j);
150
+ return j instanceof Promise ? j.then((V) => (Y(f, V), V)).catch((V) => (Y(m, V), Promise.reject(V))) : (Y(f, j), j);
155
151
  };
156
- return O[Ne] = !0, O[me] = f, O;
157
- }, E = /* @__PURE__ */ te({
152
+ return O[De] = !0, O[me] = l, O;
153
+ }, E = /* @__PURE__ */ ne({
158
154
  actions: {},
159
155
  getters: {},
160
156
  state: [],
161
- hotState: k
162
- }), I = {
163
- _p: n,
157
+ hotState: F
158
+ }), N = {
159
+ _p: r,
164
160
  // _s: scope,
165
- $id: r,
166
- $onAction: Pe.bind(null, P),
167
- $patch: D,
161
+ $id: o,
162
+ $onAction: Ie.bind(null, P),
163
+ $patch: $,
168
164
  $reset: R,
169
- $subscribe(u, f = {}) {
170
- const O = Pe(w, u, f.detached, () => y()), y = i.run(() => H(() => n.state.value[r], (d) => {
171
- (f.flush === "sync" ? S : l) && u({
172
- storeId: r,
173
- type: se.direct,
174
- events: $
175
- }, d);
176
- }, U({}, c, f)));
165
+ $subscribe(u, l = {}) {
166
+ const O = Ie(w, u, l.detached, () => y()), y = i.run(() => H(() => r.state.value[o], (f) => {
167
+ (l.flush === "sync" ? b : h) && u({
168
+ storeId: o,
169
+ type: ie.direct,
170
+ events: D
171
+ }, f);
172
+ }, U({}, c, l)));
177
173
  return O;
178
174
  },
179
- $dispose: b
180
- }, g = we(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && ne ? U(
175
+ $dispose: S
176
+ }, g = Ee(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && Q ? U(
181
177
  {
182
178
  _hmrPayload: E,
183
- _customProperties: te(/* @__PURE__ */ new Set())
179
+ _customProperties: ne(/* @__PURE__ */ new Set())
184
180
  // devtools custom properties
185
181
  },
186
- I
182
+ N
187
183
  // must be added later
188
184
  // setupStore
189
- ) : I);
190
- n._s.set(r, g);
191
- const L = (n._a && n._a.runWithContext || Qe)(() => n._e.run(() => (i = Ze()).run(() => e({ action: C }))));
192
- for (const u in L) {
193
- const f = L[u];
194
- if (X(f) && !Ie(f) || ye(f))
195
- process.env.NODE_ENV !== "production" && o ? k.value[u] = oe(L, u) : s || (T && et(f) && (X(f) ? f.value = T[u] : Ee(f, T[u])), n.state.value[r][u] = f), process.env.NODE_ENV !== "production" && E.state.push(u);
196
- else if (typeof f == "function") {
197
- const O = process.env.NODE_ENV !== "production" && o ? f : C(f, u);
198
- L[u] = O, process.env.NODE_ENV !== "production" && (E.actions[u] = f), a.actions[u] = f;
199
- } else process.env.NODE_ENV !== "production" && Ie(f) && (E.getters[u] = s ? (
185
+ ) : N);
186
+ r._s.set(o, g);
187
+ const M = (r._a && r._a.runWithContext || Qe)(() => r._e.run(() => (i = Ke()).run(() => e({ action: T }))));
188
+ for (const u in M) {
189
+ const l = M[u];
190
+ if (re(l) && !$e(l) || ye(l))
191
+ process.env.NODE_ENV !== "production" && n ? F.value[u] = se(M, u) : s || (C && et(l) && (re(l) ? l.value = C[u] : Re(l, C[u])), r.state.value[o][u] = l), process.env.NODE_ENV !== "production" && E.state.push(u);
192
+ else if (typeof l == "function") {
193
+ const O = process.env.NODE_ENV !== "production" && n ? l : T(l, u);
194
+ M[u] = O, process.env.NODE_ENV !== "production" && (E.actions[u] = l), a.actions[u] = l;
195
+ } else process.env.NODE_ENV !== "production" && $e(l) && (E.getters[u] = s ? (
200
196
  // @ts-expect-error
201
197
  t.getters[u]
202
- ) : f, ne && (L._getters || // @ts-expect-error: same
203
- (L._getters = te([]))).push(u));
198
+ ) : l, Q && (M._getters || // @ts-expect-error: same
199
+ (M._getters = ne([]))).push(u));
204
200
  }
205
- if (U(g, L), U(Ve(g), L), Object.defineProperty(g, "$state", {
206
- get: () => process.env.NODE_ENV !== "production" && o ? k.value : n.state.value[r],
201
+ if (U(g, M), U(Fe(g), M), Object.defineProperty(g, "$state", {
202
+ get: () => process.env.NODE_ENV !== "production" && n ? F.value : r.state.value[o],
207
203
  set: (u) => {
208
- if (process.env.NODE_ENV !== "production" && o)
204
+ if (process.env.NODE_ENV !== "production" && n)
209
205
  throw new Error("cannot set hotState");
210
- D((f) => {
211
- U(f, u);
206
+ $((l) => {
207
+ U(l, u);
212
208
  });
213
209
  }
214
- }), process.env.NODE_ENV !== "production" && (g._hotUpdate = te((u) => {
215
- g._hotUpdating = !0, u._hmrPayload.state.forEach((f) => {
216
- if (f in g.$state) {
217
- const O = u.$state[f], y = g.$state[f];
218
- typeof O == "object" && Z(O) && Z(y) ? Be(O, y) : u.$state[f] = y;
210
+ }), process.env.NODE_ENV !== "production" && (g._hotUpdate = ne((u) => {
211
+ g._hotUpdating = !0, u._hmrPayload.state.forEach((l) => {
212
+ if (l in g.$state) {
213
+ const O = u.$state[l], y = g.$state[l];
214
+ typeof O == "object" && q(O) && q(y) ? Be(O, y) : u.$state[l] = y;
219
215
  }
220
- g[f] = oe(u.$state, f);
221
- }), Object.keys(g.$state).forEach((f) => {
222
- f in u.$state || delete g[f];
223
- }), l = !1, S = !1, n.state.value[r] = oe(u._hmrPayload, "hotState"), S = !0, ce().then(() => {
224
- l = !0;
216
+ g[l] = se(u.$state, l);
217
+ }), Object.keys(g.$state).forEach((l) => {
218
+ l in u.$state || delete g[l];
219
+ }), h = !1, b = !1, r.state.value[o] = se(u._hmrPayload, "hotState"), b = !0, ue().then(() => {
220
+ h = !0;
225
221
  });
226
- for (const f in u._hmrPayload.actions) {
227
- const O = u[f];
228
- g[f] = //
229
- C(O, f);
222
+ for (const l in u._hmrPayload.actions) {
223
+ const O = u[l];
224
+ g[l] = //
225
+ T(O, l);
230
226
  }
231
- for (const f in u._hmrPayload.getters) {
232
- const O = u._hmrPayload.getters[f], y = s ? (
227
+ for (const l in u._hmrPayload.getters) {
228
+ const O = u._hmrPayload.getters[l], y = s ? (
233
229
  // special handling of options api
234
- B(() => (ge(n), O.call(g, g)))
230
+ B(() => (ge(r), O.call(g, g)))
235
231
  ) : O;
236
- g[f] = //
232
+ g[l] = //
237
233
  y;
238
234
  }
239
- Object.keys(g._hmrPayload.getters).forEach((f) => {
240
- f in u._hmrPayload.getters || delete g[f];
241
- }), Object.keys(g._hmrPayload.actions).forEach((f) => {
242
- f in u._hmrPayload.actions || delete g[f];
235
+ Object.keys(g._hmrPayload.getters).forEach((l) => {
236
+ l in u._hmrPayload.getters || delete g[l];
237
+ }), Object.keys(g._hmrPayload.actions).forEach((l) => {
238
+ l in u._hmrPayload.actions || delete g[l];
243
239
  }), g._hmrPayload = u._hmrPayload, g._getters = u._getters, g._hotUpdating = !1;
244
- })), process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && ne) {
240
+ })), process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && Q) {
245
241
  const u = {
246
242
  writable: !0,
247
243
  configurable: !0,
248
244
  // avoid warning on devtools trying to display this property
249
245
  enumerable: !1
250
246
  };
251
- ["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((f) => {
252
- Object.defineProperty(g, f, U({ value: g[f] }, u));
247
+ ["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((l) => {
248
+ Object.defineProperty(g, l, U({ value: g[l] }, u));
253
249
  });
254
250
  }
255
- return n._p.forEach((u) => {
256
- if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && ne) {
257
- const f = i.run(() => u({
251
+ return r._p.forEach((u) => {
252
+ if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && Q) {
253
+ const l = i.run(() => u({
258
254
  store: g,
259
- app: n._a,
260
- pinia: n,
255
+ app: r._a,
256
+ pinia: r,
261
257
  options: a
262
258
  }));
263
- Object.keys(f || {}).forEach((O) => g._customProperties.add(O)), U(g, f);
259
+ Object.keys(l || {}).forEach((O) => g._customProperties.add(O)), U(g, l);
264
260
  } else
265
261
  U(g, i.run(() => u({
266
262
  store: g,
267
- app: n._a,
268
- pinia: n,
263
+ app: r._a,
264
+ pinia: r,
269
265
  options: a
270
266
  })));
271
267
  }), process.env.NODE_ENV !== "production" && g.$state && typeof g.$state == "object" && typeof g.$state.constructor == "function" && !g.$state.constructor.toString().includes("[native code]") && console.warn(`[🍍]: The "state" must be a plain object. It cannot be
272
268
  state: () => new MyClass()
273
- Found in store "${g.$id}".`), T && s && t.hydrate && t.hydrate(g.$state, T), l = !0, S = !0, g;
269
+ Found in store "${g.$id}".`), C && s && t.hydrate && t.hydrate(g.$state, C), h = !0, b = !0, g;
274
270
  }
275
- /*! #__NO_SIDE_EFFECTS__ */
276
271
  // @__NO_SIDE_EFFECTS__
277
- function tt(r, e, t) {
278
- let n;
279
- const o = typeof e == "function";
280
- n = o ? t : e;
272
+ function tt(o, e, t) {
273
+ let r;
274
+ const n = typeof e == "function";
275
+ r = n ? t : e;
281
276
  function s(i, a) {
282
- const c = Ke();
277
+ const c = we();
283
278
  if (i = // in test mode, ignore the argument provided as we can always retrieve a
284
279
  // pinia instance with getActivePinia()
285
- (process.env.NODE_ENV === "test" && re && re._testing ? null : i) || (c ? he(Ye, null) : null), i && ge(i), process.env.NODE_ENV !== "production" && !re)
280
+ (process.env.NODE_ENV === "test" && K && K._testing ? null : i) || (c ? te(Oe, null) : null), i && ge(i), process.env.NODE_ENV !== "production" && !K)
286
281
  throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
287
282
  See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
288
283
  This will fail in production.`);
289
- i = re, i._s.has(r) || (o ? Oe(r, e, n, i) : $e(r, n, i), process.env.NODE_ENV !== "production" && (s._pinia = i));
290
- const l = i._s.get(r);
284
+ i = K, i._s.has(o) || (n ? _e(o, e, r, i) : Te(o, r, i), process.env.NODE_ENV !== "production" && (s._pinia = i));
285
+ const h = i._s.get(o);
291
286
  if (process.env.NODE_ENV !== "production" && a) {
292
- const S = "__hot:" + r, w = o ? Oe(S, e, n, i, !0) : $e(S, U({}, n), i, !0);
293
- a._hotUpdate(w), delete i.state.value[S], i._s.delete(S);
287
+ const b = "__hot:" + o, w = n ? _e(b, e, r, i, !0) : Te(b, U({}, r), i, !0);
288
+ a._hotUpdate(w), delete i.state.value[b], i._s.delete(b);
294
289
  }
295
- if (process.env.NODE_ENV !== "production" && ne) {
296
- const S = Ae();
297
- if (S && S.proxy && // avoid adding stores that are just built for hot module replacement
290
+ if (process.env.NODE_ENV !== "production" && Q) {
291
+ const b = ke();
292
+ if (b && b.proxy && // avoid adding stores that are just built for hot module replacement
298
293
  !a) {
299
- const w = S.proxy, P = "_pStores" in w ? w._pStores : w._pStores = {};
300
- P[r] = l;
294
+ const w = b.proxy, P = "_pStores" in w ? w._pStores : w._pStores = {};
295
+ P[o] = h;
301
296
  }
302
297
  }
303
- return l;
298
+ return h;
304
299
  }
305
- return s.$id = r, s;
300
+ return s.$id = o, s;
306
301
  }
307
- function Ue(r) {
308
- const e = Ve(r), t = {};
309
- for (const n in e) {
310
- const o = e[n];
311
- o.effect ? t[n] = // ...
302
+ function Ue(o) {
303
+ const e = Fe(o), t = {};
304
+ for (const r in e) {
305
+ const n = e[r];
306
+ n.effect ? t[r] = // ...
312
307
  B({
313
- get: () => r[n],
308
+ get: () => o[r],
314
309
  set(s) {
315
- r[n] = s;
310
+ o[r] = s;
316
311
  }
317
- }) : (X(o) || ye(o)) && (t[n] = // ---
318
- oe(r, n));
312
+ }) : (re(n) || ye(n)) && (t[r] = // ---
313
+ se(o, r));
319
314
  }
320
315
  return t;
321
316
  }
322
- function rt(r, e) {
323
- return Fe() ? (ke(r, e), !0) : !1;
324
- }
325
- const nt = typeof window < "u" && typeof document < "u";
317
+ const rt = typeof window < "u" && typeof document < "u";
326
318
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
327
- const ot = Object.prototype.toString, st = (r) => ot.call(r) === "[object Object]", We = () => {
319
+ const ot = Object.prototype.toString, nt = (o) => ot.call(o) === "[object Object]", We = () => {
328
320
  };
329
- function it(...r) {
330
- if (r.length !== 1) return oe(...r);
331
- const e = r[0];
332
- return typeof e == "function" ? Me(Ge(() => ({
321
+ function st(...o) {
322
+ if (o.length !== 1) return se(...o);
323
+ const e = o[0];
324
+ return typeof e == "function" ? Le(Ge(() => ({
333
325
  get: e,
334
326
  set: We
335
- }))) : M(e);
327
+ }))) : L(e);
336
328
  }
337
- function at(r, e) {
338
- function t(...n) {
339
- return new Promise((o, s) => {
340
- Promise.resolve(r(() => e.apply(this, n), {
329
+ function it(o, e) {
330
+ function t(...r) {
331
+ return new Promise((n, s) => {
332
+ Promise.resolve(o(() => e.apply(this, r), {
341
333
  fn: e,
342
334
  thisArg: this,
343
- args: n
344
- })).then(o).catch(s);
335
+ args: r
336
+ })).then(n).catch(s);
345
337
  });
346
338
  }
347
339
  return t;
348
340
  }
349
- const ze = (r) => r();
350
- function ct(r = ze, e = {}) {
351
- const { initialState: t = "active" } = e, n = it(t === "active");
352
- function o() {
353
- n.value = !1;
341
+ const ze = (o) => o();
342
+ function at(o = ze, e = {}) {
343
+ const { initialState: t = "active" } = e, r = st(t === "active");
344
+ function n() {
345
+ r.value = !1;
354
346
  }
355
347
  function s() {
356
- n.value = !0;
348
+ r.value = !0;
357
349
  }
358
350
  const i = (...a) => {
359
- n.value && r(...a);
351
+ r.value && o(...a);
360
352
  };
361
353
  return {
362
- isActive: Me(n),
363
- pause: o,
354
+ isActive: Le(r),
355
+ pause: n,
364
356
  resume: s,
365
357
  eventFilter: i
366
358
  };
367
359
  }
368
- function Se(r) {
369
- return Array.isArray(r) ? r : [r];
360
+ function Se(o) {
361
+ return Array.isArray(o) ? o : [o];
370
362
  }
371
- function ut(r) {
372
- return Ae();
363
+ function ct(o) {
364
+ return ke();
373
365
  }
374
- function lt(r, e, t = {}) {
375
- const { eventFilter: n = ze, ...o } = t;
376
- return H(r, at(n, e), o);
366
+ function ut(o, e, t = {}) {
367
+ const { eventFilter: r = ze, ...n } = t;
368
+ return H(o, it(r, e), n);
377
369
  }
378
- function ft(r, e, t = {}) {
379
- const { eventFilter: n, initialState: o = "active", ...s } = t, { eventFilter: i, pause: a, resume: c, isActive: l } = ct(n, { initialState: o });
370
+ function lt(o, e, t = {}) {
371
+ const { eventFilter: r, initialState: n = "active", ...s } = t, { eventFilter: i, pause: a, resume: c, isActive: h } = at(r, { initialState: n });
380
372
  return {
381
- stop: lt(r, e, {
373
+ stop: ut(o, e, {
382
374
  ...s,
383
375
  eventFilter: i
384
376
  }),
385
377
  pause: a,
386
378
  resume: c,
387
- isActive: l
379
+ isActive: h
388
380
  };
389
381
  }
390
- const dt = ft;
391
- function pt(r, e = !0, t) {
392
- ut() ? Le(r, t) : e ? r() : ce(r);
382
+ const ft = lt;
383
+ function dt(o, e = !0, t) {
384
+ ct() ? Me(o, t) : e ? o() : ue(o);
393
385
  }
394
- function ht(r, e, t) {
395
- return H(r, e, {
386
+ function pt(o, e, t) {
387
+ return H(o, e, {
396
388
  ...t,
397
389
  immediate: !0
398
390
  });
399
391
  }
400
- function ee(r, e, t) {
401
- return H(r, (o, s, i) => {
402
- o && e(o, s, i);
392
+ function oe(o, e, t) {
393
+ return H(o, (n, s, i) => {
394
+ n && e(n, s, i);
403
395
  }, {
404
396
  ...t,
405
397
  once: !1
406
398
  });
407
399
  }
408
- const K = nt ? window : void 0;
409
- function gt(r) {
400
+ const Z = rt ? window : void 0;
401
+ function ht(o) {
410
402
  var e;
411
- const t = J(r);
403
+ const t = J(o);
412
404
  return (e = t?.$el) !== null && e !== void 0 ? e : t;
413
405
  }
414
- function Y(...r) {
415
- const e = [], t = () => {
416
- e.forEach((a) => a()), e.length = 0;
417
- }, n = (a, c, l, S) => (a.addEventListener(c, l, S), () => a.removeEventListener(c, l, S)), o = B(() => {
418
- const a = Se(J(r[0])).filter((c) => c != null);
419
- return a.every((c) => typeof c != "string") ? a : void 0;
420
- }), s = ht(() => {
421
- var a, c;
406
+ function X(...o) {
407
+ const e = (r, n, s, i) => (r.addEventListener(n, s, i), () => r.removeEventListener(n, s, i)), t = B(() => {
408
+ const r = Se(J(o[0])).filter((n) => n != null);
409
+ return r.every((n) => typeof n != "string") ? r : void 0;
410
+ });
411
+ return pt(() => {
412
+ var r, n;
422
413
  return [
423
- (a = (c = o.value) === null || c === void 0 ? void 0 : c.map((l) => gt(l))) !== null && a !== void 0 ? a : [K].filter((l) => l != null),
424
- Se(J(o.value ? r[1] : r[0])),
425
- Se(qe(o.value ? r[2] : r[1])),
426
- J(o.value ? r[3] : r[2])
414
+ (r = (n = t.value) === null || n === void 0 ? void 0 : n.map((s) => ht(s))) !== null && r !== void 0 ? r : [Z].filter((s) => s != null),
415
+ Se(J(t.value ? o[1] : o[0])),
416
+ Se(Ye(t.value ? o[2] : o[1])),
417
+ J(t.value ? o[3] : o[2])
427
418
  ];
428
- }, ([a, c, l, S]) => {
429
- if (t(), !a?.length || !c?.length || !l?.length) return;
430
- const w = st(S) ? { ...S } : S;
431
- e.push(...a.flatMap((P) => c.flatMap(($) => l.map((T) => n(P, $, T, w)))));
432
- }, { flush: "post" }), i = () => {
433
- s(), t();
434
- };
435
- return rt(t), i;
419
+ }, ([r, n, s, i], a, c) => {
420
+ if (!r?.length || !n?.length || !s?.length) return;
421
+ const h = nt(i) ? { ...i } : i, b = r.flatMap((w) => n.flatMap((P) => s.map((D) => e(w, P, D, h))));
422
+ c(() => {
423
+ b.forEach((w) => w());
424
+ });
425
+ }, { flush: "post" });
436
426
  }
437
- const le = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, fe = "__vueuse_ssr_handlers__", vt = /* @__PURE__ */ yt();
438
- function yt() {
439
- return fe in le || (le[fe] = le[fe] || {}), le[fe];
427
+ const fe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, de = "__vueuse_ssr_handlers__", gt = /* @__PURE__ */ vt();
428
+ function vt() {
429
+ return de in fe || (fe[de] = fe[de] || {}), fe[de];
440
430
  }
441
- function mt(r, e) {
442
- return vt[r] || e;
431
+ function yt(o, e) {
432
+ return gt[o] || e;
443
433
  }
444
- function St(r) {
445
- return r == null ? "any" : r instanceof Set ? "set" : r instanceof Map ? "map" : r instanceof Date ? "date" : typeof r == "boolean" ? "boolean" : typeof r == "string" ? "string" : typeof r == "object" ? "object" : Number.isNaN(r) ? "any" : "number";
434
+ function mt(o) {
435
+ return o == null ? "any" : o instanceof Set ? "set" : o instanceof Map ? "map" : o instanceof Date ? "date" : typeof o == "boolean" ? "boolean" : typeof o == "string" ? "string" : typeof o == "object" ? "object" : Number.isNaN(o) ? "any" : "number";
446
436
  }
447
- const bt = {
437
+ const St = {
448
438
  boolean: {
449
- read: (r) => r === "true",
450
- write: (r) => String(r)
439
+ read: (o) => o === "true",
440
+ write: (o) => String(o)
451
441
  },
452
442
  object: {
453
- read: (r) => JSON.parse(r),
454
- write: (r) => JSON.stringify(r)
443
+ read: (o) => JSON.parse(o),
444
+ write: (o) => JSON.stringify(o)
455
445
  },
456
446
  number: {
457
- read: (r) => Number.parseFloat(r),
458
- write: (r) => String(r)
447
+ read: (o) => Number.parseFloat(o),
448
+ write: (o) => String(o)
459
449
  },
460
450
  any: {
461
- read: (r) => r,
462
- write: (r) => String(r)
451
+ read: (o) => o,
452
+ write: (o) => String(o)
463
453
  },
464
454
  string: {
465
- read: (r) => r,
466
- write: (r) => String(r)
455
+ read: (o) => o,
456
+ write: (o) => String(o)
467
457
  },
468
458
  map: {
469
- read: (r) => new Map(JSON.parse(r)),
470
- write: (r) => JSON.stringify(Array.from(r.entries()))
459
+ read: (o) => new Map(JSON.parse(o)),
460
+ write: (o) => JSON.stringify(Array.from(o.entries()))
471
461
  },
472
462
  set: {
473
- read: (r) => new Set(JSON.parse(r)),
474
- write: (r) => JSON.stringify(Array.from(r))
463
+ read: (o) => new Set(JSON.parse(o)),
464
+ write: (o) => JSON.stringify(Array.from(o))
475
465
  },
476
466
  date: {
477
- read: (r) => new Date(r),
478
- write: (r) => r.toISOString()
479
- }
480
- }, De = "vueuse-storage";
481
- function wt(r, e, t, n = {}) {
482
- var o;
483
- const { flush: s = "pre", deep: i = !0, listenToStorageChanges: a = !0, writeDefaults: c = !0, mergeDefaults: l = !1, shallow: S, window: w = K, eventFilter: P, onError: $ = (d) => {
484
- console.error(d);
485
- }, initOnMounted: T } = n, k = (S ? xe : M)(e), _ = B(() => J(r));
467
+ read: (o) => new Date(o),
468
+ write: (o) => o.toISOString()
469
+ }
470
+ }, Ce = "vueuse-storage";
471
+ function bt(o, e, t, r = {}) {
472
+ var n;
473
+ const { flush: s = "pre", deep: i = !0, listenToStorageChanges: a = !0, writeDefaults: c = !0, mergeDefaults: h = !1, shallow: b, window: w = Z, eventFilter: P, onError: D = (f) => {
474
+ console.error(f);
475
+ }, initOnMounted: C } = r, F = (b ? xe : L)(e), _ = B(() => J(o));
486
476
  if (!t) try {
487
- t = mt("getDefaultStorage", () => K?.localStorage)();
488
- } catch (d) {
489
- $(d);
477
+ t = yt("getDefaultStorage", () => Z?.localStorage)();
478
+ } catch (f) {
479
+ D(f);
490
480
  }
491
- if (!t) return k;
492
- const D = J(e), R = St(D), b = (o = n.serializer) !== null && o !== void 0 ? o : bt[R], { pause: C, resume: E } = dt(k, (d) => u(d), {
481
+ if (!t) return F;
482
+ const $ = J(e), R = mt($), S = (n = r.serializer) !== null && n !== void 0 ? n : St[R], { pause: T, resume: E } = ft(F, (f) => u(f), {
493
483
  flush: s,
494
484
  deep: i,
495
485
  eventFilter: P
496
486
  });
497
487
  H(_, () => O(), { flush: s });
498
- let I = !1;
499
- const g = (d) => {
500
- T && !I || O(d);
501
- }, x = (d) => {
502
- T && !I || y(d);
488
+ let N = !1;
489
+ const g = (f) => {
490
+ C && !N || O(f);
491
+ }, x = (f) => {
492
+ C && !N || y(f);
503
493
  };
504
- w && a && (t instanceof Storage ? Y(w, "storage", g, { passive: !0 }) : Y(w, De, x)), T ? pt(() => {
505
- I = !0, O();
494
+ w && a && (t instanceof Storage ? X(w, "storage", g, { passive: !0 }) : X(w, Ce, x)), C ? dt(() => {
495
+ N = !0, O();
506
496
  }) : O();
507
- function L(d, m) {
497
+ function M(f, m) {
508
498
  if (w) {
509
- const N = {
499
+ const I = {
510
500
  key: _.value,
511
- oldValue: d,
501
+ oldValue: f,
512
502
  newValue: m,
513
503
  storageArea: t
514
504
  };
515
- w.dispatchEvent(t instanceof Storage ? new StorageEvent("storage", N) : new CustomEvent(De, { detail: N }));
505
+ w.dispatchEvent(t instanceof Storage ? new StorageEvent("storage", I) : new CustomEvent(Ce, { detail: I }));
516
506
  }
517
507
  }
518
- function u(d) {
508
+ function u(f) {
519
509
  try {
520
510
  const m = t.getItem(_.value);
521
- if (d == null)
522
- L(m, null), t.removeItem(_.value);
511
+ if (f == null)
512
+ M(m, null), t.removeItem(_.value);
523
513
  else {
524
- const N = b.write(d);
525
- m !== N && (t.setItem(_.value, N), L(m, N));
514
+ const I = S.write(f);
515
+ m !== I && (t.setItem(_.value, I), M(m, I));
526
516
  }
527
517
  } catch (m) {
528
- $(m);
518
+ D(m);
529
519
  }
530
520
  }
531
- function f(d) {
532
- const m = d ? d.newValue : t.getItem(_.value);
521
+ function l(f) {
522
+ const m = f ? f.newValue : t.getItem(_.value);
533
523
  if (m == null)
534
- return c && D != null && t.setItem(_.value, b.write(D)), D;
535
- if (!d && l) {
536
- const N = b.read(m);
537
- return typeof l == "function" ? l(N, D) : R === "object" && !Array.isArray(N) ? {
538
- ...D,
539
- ...N
540
- } : N;
541
- } else return typeof m != "string" ? m : b.read(m);
542
- }
543
- function O(d) {
544
- if (!(d && d.storageArea !== t)) {
545
- if (d && d.key == null) {
546
- k.value = D;
524
+ return c && $ != null && t.setItem(_.value, S.write($)), $;
525
+ if (!f && h) {
526
+ const I = S.read(m);
527
+ return typeof h == "function" ? h(I, $) : R === "object" && !Array.isArray(I) ? {
528
+ ...$,
529
+ ...I
530
+ } : I;
531
+ } else return typeof m != "string" ? m : S.read(m);
532
+ }
533
+ function O(f) {
534
+ if (!(f && f.storageArea !== t)) {
535
+ if (f && f.key == null) {
536
+ F.value = $;
547
537
  return;
548
538
  }
549
- if (!(d && d.key !== _.value)) {
550
- C();
539
+ if (!(f && f.key !== _.value)) {
540
+ T();
551
541
  try {
552
- const m = b.write(k.value);
553
- (d === void 0 || d?.newValue !== m) && (k.value = f(d));
542
+ const m = S.write(F.value);
543
+ (f === void 0 || f?.newValue !== m) && (F.value = l(f));
554
544
  } catch (m) {
555
- $(m);
545
+ D(m);
556
546
  } finally {
557
- d ? ce(E) : E();
547
+ f ? ue(E) : E();
558
548
  }
559
549
  }
560
550
  }
561
551
  }
562
- function y(d) {
563
- O(d.detail);
552
+ function y(f) {
553
+ O(f.detail);
564
554
  }
565
- return k;
555
+ return F;
566
556
  }
567
- function Et(r, e, t = {}) {
568
- const { window: n = K } = t;
569
- return wt(r, e, n?.localStorage, t);
557
+ function wt(o, e, t = {}) {
558
+ const { window: r = Z } = t;
559
+ return bt(o, e, r?.localStorage, t);
570
560
  }
571
- const Ot = {
561
+ const Et = {
572
562
  ctrl: "control",
573
563
  command: "meta",
574
564
  cmd: "meta",
@@ -578,142 +568,144 @@ const Ot = {
578
568
  left: "arrowleft",
579
569
  right: "arrowright"
580
570
  };
581
- function Rt(r = {}) {
582
- const { reactive: e = !1, target: t = K, aliasMap: n = Ot, passive: o = !0, onEventFired: s = We } = r, i = we(/* @__PURE__ */ new Set()), a = {
571
+ function Ot(o = {}) {
572
+ const { reactive: e = !1, target: t = Z, aliasMap: r = Et, passive: n = !0, onEventFired: s = We } = o, i = Ee(/* @__PURE__ */ new Set()), a = {
583
573
  toJSON() {
584
574
  return {};
585
575
  },
586
576
  current: i
587
- }, c = e ? we(a) : a, l = /* @__PURE__ */ new Set(), S = /* @__PURE__ */ new Map([
588
- ["Meta", l],
577
+ }, c = e ? Ee(a) : a, h = /* @__PURE__ */ new Set(), b = /* @__PURE__ */ new Map([
578
+ ["Meta", h],
589
579
  ["Shift", /* @__PURE__ */ new Set()],
590
580
  ["Alt", /* @__PURE__ */ new Set()]
591
581
  ]), w = /* @__PURE__ */ new Set();
592
- function P(R, b) {
593
- R in c && (e ? c[R] = b : c[R].value = b);
582
+ function P(R, S) {
583
+ R in c && (e ? c[R] = S : c[R].value = S);
594
584
  }
595
- function $() {
585
+ function D() {
596
586
  i.clear();
597
587
  for (const R of w) P(R, !1);
598
588
  }
599
- function T(R, b, C) {
600
- if (!(!R || typeof b.getModifierState != "function")) {
601
- for (const [E, I] of S) if (b.getModifierState(E)) {
602
- C.forEach((g) => I.add(g));
589
+ function C(R, S, T) {
590
+ if (!(!R || typeof S.getModifierState != "function")) {
591
+ for (const [E, N] of b) if (S.getModifierState(E)) {
592
+ T.forEach((g) => N.add(g));
603
593
  break;
604
594
  }
605
595
  }
606
596
  }
607
- function k(R, b) {
597
+ function F(R, S) {
608
598
  if (R) return;
609
- const C = `${b[0].toUpperCase()}${b.slice(1)}`, E = S.get(C);
610
- if (!["shift", "alt"].includes(b) || !E) return;
611
- const I = Array.from(E), g = I.indexOf(b);
612
- I.forEach((x, L) => {
613
- L >= g && (i.delete(x), P(x, !1));
599
+ const T = `${S[0].toUpperCase()}${S.slice(1)}`, E = b.get(T);
600
+ if (!["shift", "alt"].includes(S) || !E) return;
601
+ const N = Array.from(E), g = N.indexOf(S);
602
+ N.forEach((x, M) => {
603
+ M >= g && (i.delete(x), P(x, !1));
614
604
  }), E.clear();
615
605
  }
616
- function _(R, b) {
617
- var C, E;
618
- const I = (C = R.key) === null || C === void 0 ? void 0 : C.toLowerCase(), g = [(E = R.code) === null || E === void 0 ? void 0 : E.toLowerCase(), I].filter(Boolean);
619
- I && (b ? i.add(I) : i.delete(I));
620
- for (const x of g)
621
- w.add(x), P(x, b);
622
- T(b, R, [...i, ...g]), k(b, I), I === "meta" && !b && (l.forEach((x) => {
623
- i.delete(x), P(x, !1);
624
- }), l.clear());
625
- }
626
- Y(t, "keydown", (R) => (_(R, !0), s(R)), { passive: o }), Y(t, "keyup", (R) => (_(R, !1), s(R)), { passive: o }), Y("blur", $, { passive: o }), Y("focus", $, { passive: o });
627
- const D = new Proxy(c, { get(R, b, C) {
628
- if (typeof b != "string") return Reflect.get(R, b, C);
629
- if (b = b.toLowerCase(), b in n && (b = n[b]), !(b in c)) if (/[+_-]/.test(b)) {
630
- const I = b.split(/[+_-]/g).map((g) => g.trim());
631
- c[b] = B(() => I.map((g) => J(D[g])).every(Boolean));
632
- } else c[b] = xe(!1);
633
- const E = Reflect.get(R, b, C);
606
+ function _(R, S) {
607
+ var T, E;
608
+ const N = (T = R.key) === null || T === void 0 ? void 0 : T.toLowerCase(), g = [(E = R.code) === null || E === void 0 ? void 0 : E.toLowerCase(), N].filter(Boolean);
609
+ if (N !== "") {
610
+ N && (S ? i.add(N) : i.delete(N));
611
+ for (const x of g)
612
+ w.add(x), P(x, S);
613
+ C(S, R, [...i, ...g]), F(S, N), N === "meta" && !S && (h.forEach((x) => {
614
+ i.delete(x), P(x, !1);
615
+ }), h.clear());
616
+ }
617
+ }
618
+ X(t, "keydown", (R) => (_(R, !0), s(R)), { passive: n }), X(t, "keyup", (R) => (_(R, !1), s(R)), { passive: n }), X("blur", D, { passive: n }), X("focus", D, { passive: n });
619
+ const $ = new Proxy(c, { get(R, S, T) {
620
+ if (typeof S != "string") return Reflect.get(R, S, T);
621
+ if (S = S.toLowerCase(), S in r && (S = r[S]), !(S in c)) if (/[+_-]/.test(S)) {
622
+ const N = S.split(/[+_-]/g).map((g) => g.trim());
623
+ c[S] = B(() => N.map((g) => J($[g])).every(Boolean));
624
+ } else c[S] = xe(!1);
625
+ const E = Reflect.get(R, S, T);
634
626
  return e ? J(E) : E;
635
627
  } });
636
- return D;
628
+ return $;
637
629
  }
638
630
  function be() {
639
631
  return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
640
632
  }
641
- function de(r) {
633
+ function pe(o) {
642
634
  const e = {
643
- type: r.type,
644
- clientId: r.clientId,
645
- timestamp: r.timestamp.toISOString()
635
+ type: o.type,
636
+ clientId: o.clientId,
637
+ timestamp: o.timestamp.toISOString()
646
638
  };
647
- return r.operation && (e.operation = {
648
- ...r.operation,
649
- timestamp: r.operation.timestamp.toISOString()
650
- }), r.operations && (e.operations = r.operations.map((t) => ({
639
+ return o.operation && (e.operation = {
640
+ ...o.operation,
641
+ timestamp: o.operation.timestamp.toISOString()
642
+ }), o.operations && (e.operations = o.operations.map((t) => ({
651
643
  ...t,
652
644
  timestamp: t.timestamp.toISOString()
653
645
  }))), e;
654
646
  }
655
- function _t(r) {
647
+ function Rt(o) {
656
648
  const e = {
657
- type: r.type,
658
- clientId: r.clientId,
659
- timestamp: new Date(r.timestamp)
649
+ type: o.type,
650
+ clientId: o.clientId,
651
+ timestamp: new Date(o.timestamp)
660
652
  };
661
- return r.operation && (e.operation = {
662
- ...r.operation,
663
- timestamp: new Date(r.operation.timestamp)
664
- }), r.operations && (e.operations = r.operations.map((t) => ({
653
+ return o.operation && (e.operation = {
654
+ ...o.operation,
655
+ timestamp: new Date(o.operation.timestamp)
656
+ }), o.operations && (e.operations = o.operations.map((t) => ({
665
657
  ...t,
666
658
  timestamp: new Date(t.timestamp)
667
659
  }))), e;
668
660
  }
669
- const ue = /* @__PURE__ */ tt("hst-operation-log", () => {
670
- const r = M({
661
+ const le = /* @__PURE__ */ tt("hst-operation-log", () => {
662
+ const o = L({
671
663
  maxOperations: 100,
672
664
  enableCrossTabSync: !0,
673
665
  autoSyncInterval: 3e4,
674
666
  enablePersistence: !1,
675
667
  persistenceKeyPrefix: "stonecrop-ops"
676
- }), e = M([]), t = M(-1), n = M(be()), o = M(!1), s = M([]), i = M(null), a = B(() => t.value < 0 ? !1 : e.value[t.value]?.reversible ?? !1), c = B(() => t.value < e.value.length - 1), l = B(() => {
677
- let p = 0;
678
- for (let h = t.value; h >= 0 && e.value[h]?.reversible; h--)
679
- p++;
680
- return p;
681
- }), S = B(() => e.value.length - 1 - t.value), w = B(() => ({
668
+ }), e = L([]), t = L(-1), r = L(be()), n = L(!1), s = L([]), i = L(null), a = B(() => t.value < 0 ? !1 : e.value[t.value]?.reversible ?? !1), c = B(() => t.value < e.value.length - 1), h = B(() => {
669
+ let d = 0;
670
+ for (let p = t.value; p >= 0 && e.value[p]?.reversible; p--)
671
+ d++;
672
+ return d;
673
+ }), b = B(() => e.value.length - 1 - t.value), w = B(() => ({
682
674
  canUndo: a.value,
683
675
  canRedo: c.value,
684
- undoCount: l.value,
685
- redoCount: S.value,
676
+ undoCount: h.value,
677
+ redoCount: b.value,
686
678
  currentIndex: t.value
687
679
  }));
688
- function P(p) {
689
- r.value = { ...r.value, ...p }, r.value.enablePersistence && (A(), V()), r.value.enableCrossTabSync && f();
680
+ function P(d) {
681
+ o.value = { ...o.value, ...d }, o.value.enablePersistence && (A(), V()), o.value.enableCrossTabSync && l();
690
682
  }
691
- function $(p, h = "user") {
683
+ function D(d, p = "user") {
692
684
  const v = {
693
- ...p,
685
+ ...d,
694
686
  id: be(),
695
687
  timestamp: /* @__PURE__ */ new Date(),
696
- source: h,
697
- userId: r.value.userId
688
+ source: p,
689
+ userId: o.value.userId
698
690
  };
699
- if (r.value.operationFilter && !r.value.operationFilter(v))
691
+ if (o.value.operationFilter && !o.value.operationFilter(v))
700
692
  return v.id;
701
- if (o.value)
693
+ if (n.value)
702
694
  return s.value.push(v), v.id;
703
- if (t.value < e.value.length - 1 && (e.value = e.value.slice(0, t.value + 1)), e.value.push(v), t.value++, r.value.maxOperations && e.value.length > r.value.maxOperations) {
704
- const F = e.value.length - r.value.maxOperations;
705
- e.value = e.value.slice(F), t.value -= F;
695
+ if (t.value < e.value.length - 1 && (e.value = e.value.slice(0, t.value + 1)), e.value.push(v), t.value++, o.value.maxOperations && e.value.length > o.value.maxOperations) {
696
+ const k = e.value.length - o.value.maxOperations;
697
+ e.value = e.value.slice(k), t.value -= k;
706
698
  }
707
- return r.value.enableCrossTabSync && O(v), v.id;
699
+ return o.value.enableCrossTabSync && O(v), v.id;
708
700
  }
709
- function T() {
710
- o.value = !0, s.value = [], i.value = be();
701
+ function C() {
702
+ n.value = !0, s.value = [], i.value = be();
711
703
  }
712
- function k(p) {
713
- if (!o.value || s.value.length === 0)
714
- return o.value = !1, s.value = [], i.value = null, null;
715
- const h = i.value, v = s.value.every((W) => W.reversible), F = {
716
- id: h,
704
+ function F(d) {
705
+ if (!n.value || s.value.length === 0)
706
+ return n.value = !1, s.value = [], i.value = null, null;
707
+ const p = i.value, v = s.value.every((W) => W.reversible), k = {
708
+ id: p,
717
709
  type: "batch",
718
710
  path: "",
719
711
  // Batch doesn't have a single path
@@ -726,189 +718,189 @@ const ue = /* @__PURE__ */ tt("hst-operation-log", () => {
726
718
  reversible: v,
727
719
  irreversibleReason: v ? void 0 : "Contains irreversible operations",
728
720
  childOperationIds: s.value.map((W) => W.id),
729
- metadata: { description: p }
721
+ metadata: { description: d }
730
722
  };
731
723
  s.value.forEach((W) => {
732
- W.parentOperationId = h;
733
- }), e.value.push(...s.value, F), t.value = e.value.length - 1, r.value.enableCrossTabSync && y(s.value, F);
734
- const z = h;
735
- return o.value = !1, s.value = [], i.value = null, z;
724
+ W.parentOperationId = p;
725
+ }), e.value.push(...s.value, k), t.value = e.value.length - 1, o.value.enableCrossTabSync && y(s.value, k);
726
+ const z = p;
727
+ return n.value = !1, s.value = [], i.value = null, z;
736
728
  }
737
729
  function _() {
738
- o.value = !1, s.value = [], i.value = null;
730
+ n.value = !1, s.value = [], i.value = null;
739
731
  }
740
- function D(p) {
732
+ function $(d) {
741
733
  if (!a.value) return !1;
742
- const h = e.value[t.value];
743
- if (!h.reversible)
744
- return typeof console < "u" && h.irreversibleReason && console.warn("Cannot undo irreversible operation:", h.irreversibleReason), !1;
734
+ const p = e.value[t.value];
735
+ if (!p.reversible)
736
+ return typeof console < "u" && p.irreversibleReason && console.warn("Cannot undo irreversible operation:", p.irreversibleReason), !1;
745
737
  try {
746
- if (h.type === "batch" && h.childOperationIds)
747
- for (let v = h.childOperationIds.length - 1; v >= 0; v--) {
748
- const F = h.childOperationIds[v], z = e.value.find((W) => W.id === F);
749
- z && b(z, p);
738
+ if (p.type === "batch" && p.childOperationIds)
739
+ for (let v = p.childOperationIds.length - 1; v >= 0; v--) {
740
+ const k = p.childOperationIds[v], z = e.value.find((W) => W.id === k);
741
+ z && S(z, d);
750
742
  }
751
743
  else
752
- b(h, p);
753
- return t.value--, r.value.enableCrossTabSync && d(h), !0;
744
+ S(p, d);
745
+ return t.value--, o.value.enableCrossTabSync && f(p), !0;
754
746
  } catch (v) {
755
747
  return typeof console < "u" && console.error("Undo failed:", v), !1;
756
748
  }
757
749
  }
758
- function R(p) {
750
+ function R(d) {
759
751
  if (!c.value) return !1;
760
- const h = e.value[t.value + 1];
752
+ const p = e.value[t.value + 1];
761
753
  try {
762
- if (h.type === "batch" && h.childOperationIds)
763
- for (const v of h.childOperationIds) {
764
- const F = e.value.find((z) => z.id === v);
765
- F && C(F, p);
754
+ if (p.type === "batch" && p.childOperationIds)
755
+ for (const v of p.childOperationIds) {
756
+ const k = e.value.find((z) => z.id === v);
757
+ k && T(k, d);
766
758
  }
767
759
  else
768
- C(h, p);
769
- return t.value++, r.value.enableCrossTabSync && m(h), !0;
760
+ T(p, d);
761
+ return t.value++, o.value.enableCrossTabSync && m(p), !0;
770
762
  } catch (v) {
771
763
  return typeof console < "u" && console.error("Redo failed:", v), !1;
772
764
  }
773
765
  }
774
- function b(p, h) {
775
- (p.type === "set" || p.type === "delete") && h && typeof h.set == "function" && h.set(p.path, p.beforeValue, "undo");
766
+ function S(d, p) {
767
+ (d.type === "set" || d.type === "delete") && p && typeof p.set == "function" && p.set(d.path, d.beforeValue, "undo");
776
768
  }
777
- function C(p, h) {
778
- (p.type === "set" || p.type === "delete") && h && typeof h.set == "function" && h.set(p.path, p.afterValue, "redo");
769
+ function T(d, p) {
770
+ (d.type === "set" || d.type === "delete") && p && typeof p.set == "function" && p.set(d.path, d.afterValue, "redo");
779
771
  }
780
772
  function E() {
781
- const p = e.value.filter((v) => v.reversible).length, h = e.value.map((v) => v.timestamp);
773
+ const d = e.value.filter((v) => v.reversible).length, p = e.value.map((v) => v.timestamp);
782
774
  return {
783
775
  operations: [...e.value],
784
776
  currentIndex: t.value,
785
777
  totalOperations: e.value.length,
786
- reversibleOperations: p,
787
- irreversibleOperations: e.value.length - p,
788
- oldestOperation: h.length > 0 ? new Date(Math.min(...h.map((v) => v.getTime()))) : void 0,
789
- newestOperation: h.length > 0 ? new Date(Math.max(...h.map((v) => v.getTime()))) : void 0
778
+ reversibleOperations: d,
779
+ irreversibleOperations: e.value.length - d,
780
+ oldestOperation: p.length > 0 ? new Date(Math.min(...p.map((v) => v.getTime()))) : void 0,
781
+ newestOperation: p.length > 0 ? new Date(Math.max(...p.map((v) => v.getTime()))) : void 0
790
782
  };
791
783
  }
792
- function I() {
784
+ function N() {
793
785
  e.value = [], t.value = -1;
794
786
  }
795
- function g(p, h) {
796
- return e.value.filter((v) => v.doctype === p && (h === void 0 || v.recordId === h));
787
+ function g(d, p) {
788
+ return e.value.filter((v) => v.doctype === d && (p === void 0 || v.recordId === p));
797
789
  }
798
- function x(p, h) {
799
- const v = e.value.find((F) => F.id === p);
800
- v && (v.reversible = !1, v.irreversibleReason = h);
790
+ function x(d, p) {
791
+ const v = e.value.find((k) => k.id === d);
792
+ v && (v.reversible = !1, v.irreversibleReason = p);
801
793
  }
802
- function L(p, h, v, F = "success", z) {
794
+ function M(d, p, v, k = "success", z) {
803
795
  const W = {
804
796
  type: "action",
805
- path: v && v.length > 0 ? `${p}.${v[0]}` : p,
797
+ path: v && v.length > 0 ? `${d}.${v[0]}` : d,
806
798
  fieldname: "",
807
799
  beforeValue: null,
808
800
  afterValue: null,
809
- doctype: p,
801
+ doctype: d,
810
802
  recordId: v && v.length > 0 ? v[0] : void 0,
811
803
  reversible: !1,
812
804
  // Actions are typically not reversible
813
- actionName: h,
805
+ actionName: p,
814
806
  actionRecordIds: v,
815
- actionResult: F,
807
+ actionResult: k,
816
808
  actionError: z
817
809
  };
818
- return $(W);
810
+ return D(W);
819
811
  }
820
812
  let u = null;
821
- function f() {
822
- typeof window > "u" || !window.BroadcastChannel || (u = new BroadcastChannel("stonecrop-operation-log"), u.addEventListener("message", (p) => {
823
- const h = p.data;
824
- if (!h || typeof h != "object") return;
825
- const v = _t(h);
826
- v.clientId !== n.value && (v.type === "operation" && v.operation ? (e.value.push({ ...v.operation, source: "sync" }), t.value = e.value.length - 1) : v.type === "operation" && v.operations && (e.value.push(...v.operations.map((F) => ({ ...F, source: "sync" }))), t.value = e.value.length - 1));
813
+ function l() {
814
+ typeof window > "u" || !window.BroadcastChannel || (u = new BroadcastChannel("stonecrop-operation-log"), u.addEventListener("message", (d) => {
815
+ const p = d.data;
816
+ if (!p || typeof p != "object") return;
817
+ const v = Rt(p);
818
+ v.clientId !== r.value && (v.type === "operation" && v.operation ? (e.value.push({ ...v.operation, source: "sync" }), t.value = e.value.length - 1) : v.type === "operation" && v.operations && (e.value.push(...v.operations.map((k) => ({ ...k, source: "sync" }))), t.value = e.value.length - 1));
827
819
  }));
828
820
  }
829
- function O(p) {
821
+ function O(d) {
830
822
  if (!u) return;
831
- const h = {
823
+ const p = {
832
824
  type: "operation",
833
- operation: p,
834
- clientId: n.value,
825
+ operation: d,
826
+ clientId: r.value,
835
827
  timestamp: /* @__PURE__ */ new Date()
836
828
  };
837
- u.postMessage(de(h));
829
+ u.postMessage(pe(p));
838
830
  }
839
- function y(p, h) {
831
+ function y(d, p) {
840
832
  if (!u) return;
841
833
  const v = {
842
834
  type: "operation",
843
- operations: [...p, h],
844
- clientId: n.value,
835
+ operations: [...d, p],
836
+ clientId: r.value,
845
837
  timestamp: /* @__PURE__ */ new Date()
846
838
  };
847
- u.postMessage(de(v));
839
+ u.postMessage(pe(v));
848
840
  }
849
- function d(p) {
841
+ function f(d) {
850
842
  if (!u) return;
851
- const h = {
843
+ const p = {
852
844
  type: "undo",
853
- operation: p,
854
- clientId: n.value,
845
+ operation: d,
846
+ clientId: r.value,
855
847
  timestamp: /* @__PURE__ */ new Date()
856
848
  };
857
- u.postMessage(de(h));
849
+ u.postMessage(pe(p));
858
850
  }
859
- function m(p) {
851
+ function m(d) {
860
852
  if (!u) return;
861
- const h = {
853
+ const p = {
862
854
  type: "redo",
863
- operation: p,
864
- clientId: n.value,
855
+ operation: d,
856
+ clientId: r.value,
865
857
  timestamp: /* @__PURE__ */ new Date()
866
858
  };
867
- u.postMessage(de(h));
859
+ u.postMessage(pe(p));
868
860
  }
869
- const N = Et("stonecrop-ops-operations", null, {
861
+ const I = wt("stonecrop-ops-operations", null, {
870
862
  serializer: {
871
- read: (p) => {
863
+ read: (d) => {
872
864
  try {
873
- return JSON.parse(p);
865
+ return JSON.parse(d);
874
866
  } catch {
875
867
  return null;
876
868
  }
877
869
  },
878
- write: (p) => p ? JSON.stringify(p) : ""
870
+ write: (d) => d ? JSON.stringify(d) : ""
879
871
  }
880
872
  });
881
873
  function A() {
882
874
  if (!(typeof window > "u"))
883
875
  try {
884
- const p = N.value;
885
- p && Array.isArray(p.operations) && (e.value = p.operations.map((h) => ({
886
- ...h,
887
- timestamp: new Date(h.timestamp)
888
- })), t.value = p.currentIndex ?? -1);
889
- } catch (p) {
890
- typeof console < "u" && console.error("Failed to load operations from persistence:", p);
876
+ const d = I.value;
877
+ d && Array.isArray(d.operations) && (e.value = d.operations.map((p) => ({
878
+ ...p,
879
+ timestamp: new Date(p.timestamp)
880
+ })), t.value = d.currentIndex ?? -1);
881
+ } catch (d) {
882
+ typeof console < "u" && console.error("Failed to load operations from persistence:", d);
891
883
  }
892
884
  }
893
885
  function j() {
894
886
  if (!(typeof window > "u"))
895
887
  try {
896
- N.value = {
897
- operations: e.value.map((p) => ({
898
- ...p,
899
- timestamp: p.timestamp.toISOString()
888
+ I.value = {
889
+ operations: e.value.map((d) => ({
890
+ ...d,
891
+ timestamp: d.timestamp.toISOString()
900
892
  })),
901
893
  currentIndex: t.value
902
894
  };
903
- } catch (p) {
904
- typeof console < "u" && console.error("Failed to save operations to persistence:", p);
895
+ } catch (d) {
896
+ typeof console < "u" && console.error("Failed to save operations to persistence:", d);
905
897
  }
906
898
  }
907
899
  function V() {
908
900
  H(
909
901
  [e, t],
910
902
  () => {
911
- r.value.enablePersistence && j();
903
+ o.value.enablePersistence && j();
912
904
  },
913
905
  { deep: !0 }
914
906
  );
@@ -917,30 +909,30 @@ const ue = /* @__PURE__ */ tt("hst-operation-log", () => {
917
909
  // State
918
910
  operations: e,
919
911
  currentIndex: t,
920
- config: r,
921
- clientId: n,
912
+ config: o,
913
+ clientId: r,
922
914
  undoRedoState: w,
923
915
  // Computed
924
916
  canUndo: a,
925
917
  canRedo: c,
926
- undoCount: l,
927
- redoCount: S,
918
+ undoCount: h,
919
+ redoCount: b,
928
920
  // Methods
929
921
  configure: P,
930
- addOperation: $,
931
- startBatch: T,
932
- commitBatch: k,
922
+ addOperation: D,
923
+ startBatch: C,
924
+ commitBatch: F,
933
925
  cancelBatch: _,
934
- undo: D,
926
+ undo: $,
935
927
  redo: R,
936
- clear: I,
928
+ clear: N,
937
929
  getOperationsFor: g,
938
930
  getSnapshot: E,
939
931
  markIrreversible: x,
940
- logAction: L
932
+ logAction: M
941
933
  };
942
934
  });
943
- class ie {
935
+ class ae {
944
936
  /**
945
937
  * The root FieldTriggerEngine instance
946
938
  */
@@ -961,9 +953,9 @@ class ie {
961
953
  * @param options - Configuration options for the field trigger engine
962
954
  */
963
955
  constructor(e = {}) {
964
- if (ie._root)
965
- return ie._root;
966
- ie._root = this, this.options = {
956
+ if (ae._root)
957
+ return ae._root;
958
+ ae._root = this, this.options = {
967
959
  defaultTimeout: e.defaultTimeout ?? 5e3,
968
960
  debug: e.debug ?? !1,
969
961
  enableRollback: e.enableRollback ?? !0,
@@ -992,8 +984,8 @@ class ie {
992
984
  * @param fieldname - The field name
993
985
  * @param enableRollback - Whether to enable rollback
994
986
  */
995
- setFieldRollback(e, t, n) {
996
- this.fieldRollbackConfig.has(e) || this.fieldRollbackConfig.set(e, /* @__PURE__ */ new Map()), this.fieldRollbackConfig.get(e).set(t, n);
987
+ setFieldRollback(e, t, r) {
988
+ this.fieldRollbackConfig.has(e) || this.fieldRollbackConfig.set(e, /* @__PURE__ */ new Map()), this.fieldRollbackConfig.get(e).set(t, r);
997
989
  }
998
990
  /**
999
991
  * Get rollback configuration for a specific field trigger
@@ -1009,25 +1001,25 @@ class ie {
1009
1001
  */
1010
1002
  registerDoctypeActions(e, t) {
1011
1003
  if (!t) return;
1012
- const n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
1004
+ const r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
1013
1005
  if (typeof t.entrySeq == "function")
1014
1006
  t.entrySeq().forEach(([s, i]) => {
1015
- this.categorizeAction(s, i, n, o);
1007
+ this.categorizeAction(s, i, r, n);
1016
1008
  });
1017
1009
  else if (t instanceof Map)
1018
1010
  for (const [s, i] of t)
1019
- this.categorizeAction(s, i, n, o);
1011
+ this.categorizeAction(s, i, r, n);
1020
1012
  else t && typeof t == "object" && Object.entries(t).forEach(([s, i]) => {
1021
- this.categorizeAction(s, i, n, o);
1013
+ this.categorizeAction(s, i, r, n);
1022
1014
  });
1023
- this.doctypeActions.set(e, n), this.doctypeTransitions.set(e, o);
1015
+ this.doctypeActions.set(e, r), this.doctypeTransitions.set(e, n);
1024
1016
  }
1025
1017
  /**
1026
1018
  * Categorize an action as either a field trigger or XState transition
1027
1019
  * Uses uppercase convention: UPPERCASE = transition, lowercase/mixed = field trigger
1028
1020
  */
1029
- categorizeAction(e, t, n, o) {
1030
- this.isTransitionKey(e) ? o.set(e, t) : n.set(e, t);
1021
+ categorizeAction(e, t, r, n) {
1022
+ this.isTransitionKey(e) ? n.set(e, t) : r.set(e, t);
1031
1023
  }
1032
1024
  /**
1033
1025
  * Determine if a key represents an XState transition
@@ -1042,7 +1034,7 @@ class ie {
1042
1034
  * @param options - Execution options (timeout and enableRollback)
1043
1035
  */
1044
1036
  async executeFieldTriggers(e, t = {}) {
1045
- const { doctype: n, fieldname: o } = e, s = this.findFieldTriggers(n, o);
1037
+ const { doctype: r, fieldname: n } = e, s = this.findFieldTriggers(r, n);
1046
1038
  if (s.length === 0)
1047
1039
  return {
1048
1040
  path: e.path,
@@ -1053,48 +1045,48 @@ class ie {
1053
1045
  rolledBack: !1
1054
1046
  };
1055
1047
  const i = performance.now(), a = [];
1056
- let c = !1, l = !1, S;
1057
- const w = this.getFieldRollback(n, o), P = t.enableRollback ?? w ?? this.options.enableRollback;
1058
- P && e.store && (S = this.captureSnapshot(e));
1048
+ let c = !1, h = !1, b;
1049
+ const w = this.getFieldRollback(r, n), P = t.enableRollback ?? w ?? this.options.enableRollback;
1050
+ P && e.store && (b = this.captureSnapshot(e));
1059
1051
  for (const _ of s)
1060
1052
  try {
1061
- const D = await this.executeAction(_, e, t.timeout);
1062
- if (a.push(D), !D.success) {
1053
+ const $ = await this.executeAction(_, e, t.timeout);
1054
+ if (a.push($), !$.success) {
1063
1055
  c = !0;
1064
1056
  break;
1065
1057
  }
1066
- } catch (D) {
1067
- const b = {
1058
+ } catch ($) {
1059
+ const S = {
1068
1060
  success: !1,
1069
- error: D instanceof Error ? D : new Error(String(D)),
1061
+ error: $ instanceof Error ? $ : new Error(String($)),
1070
1062
  executionTime: 0,
1071
1063
  action: _
1072
1064
  };
1073
- a.push(b), c = !0;
1065
+ a.push(S), c = !0;
1074
1066
  break;
1075
1067
  }
1076
- if (P && c && S && e.store)
1068
+ if (P && c && b && e.store)
1077
1069
  try {
1078
- this.restoreSnapshot(e, S), l = !0;
1070
+ this.restoreSnapshot(e, b), h = !0;
1079
1071
  } catch (_) {
1080
1072
  console.error("[FieldTriggers] Rollback failed:", _);
1081
1073
  }
1082
- const $ = performance.now() - i, T = a.filter((_) => !_.success);
1083
- if (T.length > 0 && this.options.errorHandler)
1084
- for (const _ of T)
1074
+ const D = performance.now() - i, C = a.filter((_) => !_.success);
1075
+ if (C.length > 0 && this.options.errorHandler)
1076
+ for (const _ of C)
1085
1077
  try {
1086
1078
  this.options.errorHandler(_.error, e, _.action);
1087
- } catch (D) {
1088
- console.error("[FieldTriggers] Error in global error handler:", D);
1079
+ } catch ($) {
1080
+ console.error("[FieldTriggers] Error in global error handler:", $);
1089
1081
  }
1090
1082
  return {
1091
1083
  path: e.path,
1092
1084
  actionResults: a,
1093
- totalExecutionTime: $,
1085
+ totalExecutionTime: D,
1094
1086
  allSucceeded: a.every((_) => _.success),
1095
1087
  stoppedOnError: c,
1096
- rolledBack: l,
1097
- snapshot: this.options.debug && P ? S : void 0
1088
+ rolledBack: h,
1089
+ snapshot: this.options.debug && P ? b : void 0
1098
1090
  // Only include snapshot in debug mode if rollback is enabled
1099
1091
  };
1100
1092
  }
@@ -1105,22 +1097,22 @@ class ie {
1105
1097
  * @param options - Execution options (timeout)
1106
1098
  */
1107
1099
  async executeTransitionActions(e, t = {}) {
1108
- const { doctype: n, transition: o } = e, s = this.findTransitionActions(n, o);
1100
+ const { doctype: r, transition: n } = e, s = this.findTransitionActions(r, n);
1109
1101
  if (s.length === 0)
1110
1102
  return [];
1111
1103
  const i = [];
1112
1104
  for (const c of s)
1113
1105
  try {
1114
- const l = await this.executeTransitionAction(c, e, t.timeout);
1115
- if (i.push(l), !l.success)
1106
+ const h = await this.executeTransitionAction(c, e, t.timeout);
1107
+ if (i.push(h), !h.success)
1116
1108
  break;
1117
- } catch (l) {
1109
+ } catch (h) {
1118
1110
  const w = {
1119
1111
  success: !1,
1120
- error: l instanceof Error ? l : new Error(String(l)),
1112
+ error: h instanceof Error ? h : new Error(String(h)),
1121
1113
  executionTime: 0,
1122
1114
  action: c,
1123
- transition: o
1115
+ transition: n
1124
1116
  };
1125
1117
  i.push(w);
1126
1118
  break;
@@ -1130,8 +1122,8 @@ class ie {
1130
1122
  for (const c of a)
1131
1123
  try {
1132
1124
  this.options.errorHandler(c.error, e, c.action);
1133
- } catch (l) {
1134
- console.error("[FieldTriggers] Error in global error handler:", l);
1125
+ } catch (h) {
1126
+ console.error("[FieldTriggers] Error in global error handler:", h);
1135
1127
  }
1136
1128
  return i;
1137
1129
  }
@@ -1139,14 +1131,14 @@ class ie {
1139
1131
  * Find transition actions for a specific doctype and transition
1140
1132
  */
1141
1133
  findTransitionActions(e, t) {
1142
- const n = this.doctypeTransitions.get(e);
1143
- return n ? n.get(t) || [] : [];
1134
+ const r = this.doctypeTransitions.get(e);
1135
+ return r ? r.get(t) || [] : [];
1144
1136
  }
1145
1137
  /**
1146
1138
  * Execute a single transition action by name
1147
1139
  */
1148
- async executeTransitionAction(e, t, n) {
1149
- const o = performance.now(), s = n ?? this.options.defaultTimeout;
1140
+ async executeTransitionAction(e, t, r) {
1141
+ const n = performance.now(), s = r ?? this.options.defaultTimeout;
1150
1142
  try {
1151
1143
  let i = this.globalTransitionActions.get(e);
1152
1144
  if (!i) {
@@ -1157,12 +1149,12 @@ class ie {
1157
1149
  throw new Error(`Transition action "${e}" not found in registry`);
1158
1150
  return await this.executeWithTimeout(i, t, s), {
1159
1151
  success: !0,
1160
- executionTime: performance.now() - o,
1152
+ executionTime: performance.now() - n,
1161
1153
  action: e,
1162
1154
  transition: t.transition
1163
1155
  };
1164
1156
  } catch (i) {
1165
- const a = performance.now() - o;
1157
+ const a = performance.now() - n;
1166
1158
  return {
1167
1159
  success: !1,
1168
1160
  error: i instanceof Error ? i : new Error(String(i)),
@@ -1177,12 +1169,12 @@ class ie {
1177
1169
  * Field triggers are identified by keys that look like field paths (contain dots or match field names)
1178
1170
  */
1179
1171
  findFieldTriggers(e, t) {
1180
- const n = this.doctypeActions.get(e);
1181
- if (!n) return [];
1182
- const o = [];
1183
- for (const [s, i] of n)
1184
- this.isFieldTriggerKey(s, t) && o.push(...i);
1185
- return o;
1172
+ const r = this.doctypeActions.get(e);
1173
+ if (!r) return [];
1174
+ const n = [];
1175
+ for (const [s, i] of r)
1176
+ this.isFieldTriggerKey(s, t) && n.push(...i);
1177
+ return n;
1186
1178
  }
1187
1179
  /**
1188
1180
  * Determine if an action key represents a field trigger
@@ -1199,11 +1191,11 @@ class ie {
1199
1191
  * Supports wildcards (*) for dynamic segments
1200
1192
  */
1201
1193
  matchFieldPattern(e, t) {
1202
- const n = e.split("."), o = t.split(".");
1203
- if (n.length !== o.length)
1194
+ const r = e.split("."), n = t.split(".");
1195
+ if (r.length !== n.length)
1204
1196
  return !1;
1205
- for (let s = 0; s < n.length; s++) {
1206
- const i = n[s], a = o[s];
1197
+ for (let s = 0; s < r.length; s++) {
1198
+ const i = r[s], a = n[s];
1207
1199
  if (i !== "*" && i !== a)
1208
1200
  return !1;
1209
1201
  }
@@ -1212,19 +1204,19 @@ class ie {
1212
1204
  /**
1213
1205
  * Execute a single action by name
1214
1206
  */
1215
- async executeAction(e, t, n) {
1216
- const o = performance.now(), s = n ?? this.options.defaultTimeout;
1207
+ async executeAction(e, t, r) {
1208
+ const n = performance.now(), s = r ?? this.options.defaultTimeout;
1217
1209
  try {
1218
1210
  const i = this.globalActions.get(e);
1219
1211
  if (!i)
1220
1212
  throw new Error(`Action "${e}" not found in registry`);
1221
1213
  return await this.executeWithTimeout(i, t, s), {
1222
1214
  success: !0,
1223
- executionTime: performance.now() - o,
1215
+ executionTime: performance.now() - n,
1224
1216
  action: e
1225
1217
  };
1226
1218
  } catch (i) {
1227
- const a = performance.now() - o;
1219
+ const a = performance.now() - n;
1228
1220
  return {
1229
1221
  success: !1,
1230
1222
  error: i instanceof Error ? i : new Error(String(i)),
@@ -1236,13 +1228,13 @@ class ie {
1236
1228
  /**
1237
1229
  * Execute a function with timeout
1238
1230
  */
1239
- async executeWithTimeout(e, t, n) {
1240
- return new Promise((o, s) => {
1231
+ async executeWithTimeout(e, t, r) {
1232
+ return new Promise((n, s) => {
1241
1233
  const i = setTimeout(() => {
1242
- s(new Error(`Action timeout after ${n}ms`));
1243
- }, n);
1234
+ s(new Error(`Action timeout after ${r}ms`));
1235
+ }, r);
1244
1236
  Promise.resolve(e(t)).then((a) => {
1245
- clearTimeout(i), o(a);
1237
+ clearTimeout(i), n(a);
1246
1238
  }).catch((a) => {
1247
1239
  clearTimeout(i), s(a);
1248
1240
  });
@@ -1255,8 +1247,8 @@ class ie {
1255
1247
  captureSnapshot(e) {
1256
1248
  if (!(!e.store || !e.doctype || !e.recordId))
1257
1249
  try {
1258
- const t = `${e.doctype}.${e.recordId}`, n = e.store.get(t);
1259
- return !n || typeof n != "object" ? void 0 : JSON.parse(JSON.stringify(n));
1250
+ const t = `${e.doctype}.${e.recordId}`, r = e.store.get(t);
1251
+ return !r || typeof r != "object" ? void 0 : JSON.parse(JSON.stringify(r));
1260
1252
  } catch (t) {
1261
1253
  this.options.debug && console.warn("[FieldTriggers] Failed to capture snapshot:", t);
1262
1254
  return;
@@ -1269,33 +1261,33 @@ class ie {
1269
1261
  restoreSnapshot(e, t) {
1270
1262
  if (!(!e.store || !e.doctype || !e.recordId || !t))
1271
1263
  try {
1272
- const n = `${e.doctype}.${e.recordId}`;
1273
- e.store.set(n, t), this.options.debug && console.log(`[FieldTriggers] Rolled back ${n} to previous state`);
1274
- } catch (n) {
1275
- throw console.error("[FieldTriggers] Failed to restore snapshot:", n), n;
1264
+ const r = `${e.doctype}.${e.recordId}`;
1265
+ e.store.set(r, t), this.options.debug && console.log(`[FieldTriggers] Rolled back ${r} to previous state`);
1266
+ } catch (r) {
1267
+ throw console.error("[FieldTriggers] Failed to restore snapshot:", r), r;
1276
1268
  }
1277
1269
  }
1278
1270
  }
1279
- function G(r) {
1280
- return new ie(r);
1271
+ function G(o) {
1272
+ return new ae(o);
1281
1273
  }
1282
- function Dt(r, e) {
1283
- G().registerAction(r, e);
1274
+ function Dt(o, e) {
1275
+ G().registerAction(o, e);
1284
1276
  }
1285
- function Tt(r, e) {
1286
- G().registerTransitionAction(r, e);
1277
+ function $t(o, e) {
1278
+ G().registerTransitionAction(o, e);
1287
1279
  }
1288
- function Ct(r, e, t) {
1289
- G().setFieldRollback(r, e, t);
1280
+ function Tt(o, e, t) {
1281
+ G().setFieldRollback(o, e, t);
1290
1282
  }
1291
- async function At(r, e, t) {
1292
- const n = G(), o = {
1293
- path: t?.path || (t?.recordId ? `${r}.${t.recordId}` : r),
1283
+ async function Ct(o, e, t) {
1284
+ const r = G(), n = {
1285
+ path: t?.path || (t?.recordId ? `${o}.${t.recordId}` : o),
1294
1286
  fieldname: "",
1295
1287
  beforeValue: void 0,
1296
1288
  afterValue: void 0,
1297
1289
  operation: "set",
1298
- doctype: r,
1290
+ doctype: o,
1299
1291
  recordId: t?.recordId,
1300
1292
  timestamp: /* @__PURE__ */ new Date(),
1301
1293
  transition: e,
@@ -1303,30 +1295,30 @@ async function At(r, e, t) {
1303
1295
  targetState: t?.targetState,
1304
1296
  fsmContext: t?.fsmContext
1305
1297
  };
1306
- return await n.executeTransitionActions(o);
1298
+ return await r.executeTransitionActions(n);
1307
1299
  }
1308
- function Vt(r, e) {
1309
- if (r)
1300
+ function At(o, e) {
1301
+ if (o)
1310
1302
  try {
1311
- ue().markIrreversible(r, e);
1303
+ le().markIrreversible(o, e);
1312
1304
  } catch {
1313
1305
  }
1314
1306
  }
1315
- function Te() {
1307
+ function Ae() {
1316
1308
  try {
1317
- return ue();
1309
+ return le();
1318
1310
  } catch {
1319
1311
  return null;
1320
1312
  }
1321
1313
  }
1322
- class Q {
1314
+ class ee {
1323
1315
  static instance;
1324
1316
  /**
1325
1317
  * Gets the singleton instance of HST
1326
1318
  * @returns The HST singleton instance
1327
1319
  */
1328
1320
  static getInstance() {
1329
- return Q.instance || (Q.instance = new Q()), Q.instance;
1321
+ return ee.instance || (ee.instance = new ee()), ee.instance;
1330
1322
  }
1331
1323
  /**
1332
1324
  * Gets the global registry instance
@@ -1367,16 +1359,16 @@ class ve {
1367
1359
  doctype;
1368
1360
  parentDoctype;
1369
1361
  hst;
1370
- constructor(e, t, n = "", o = null, s) {
1371
- return this.target = e, this.parentPath = n, this.rootNode = o || this, this.doctype = t, this.parentDoctype = s, this.hst = Q.getInstance(), new Proxy(this, {
1362
+ constructor(e, t, r = "", n = null, s) {
1363
+ return this.target = e, this.parentPath = r, this.rootNode = n || this, this.doctype = t, this.parentDoctype = s, this.hst = ee.getInstance(), new Proxy(this, {
1372
1364
  get(i, a) {
1373
1365
  if (a in i) return i[a];
1374
1366
  const c = String(a);
1375
1367
  return i.getNode(c);
1376
1368
  },
1377
1369
  set(i, a, c) {
1378
- const l = String(a);
1379
- return i.set(l, c), !0;
1370
+ const h = String(a);
1371
+ return i.set(h, c), !0;
1380
1372
  }
1381
1373
  });
1382
1374
  }
@@ -1385,47 +1377,47 @@ class ve {
1385
1377
  }
1386
1378
  // Method to get a tree-wrapped node for navigation
1387
1379
  getNode(e) {
1388
- const t = this.resolvePath(e), n = this.resolveValue(e), o = t.split(".");
1380
+ const t = this.resolvePath(e), r = this.resolveValue(e), n = t.split(".");
1389
1381
  let s = this.doctype;
1390
- return this.doctype === "StonecropStore" && o.length >= 1 && (s = o[0]), typeof n == "object" && n !== null && !this.isPrimitive(n) ? new ve(n, s, t, this.rootNode, this.parentDoctype) : new ve(n, s, t, this.rootNode, this.parentDoctype);
1382
+ return this.doctype === "StonecropStore" && n.length >= 1 && (s = n[0]), typeof r == "object" && r !== null && !this.isPrimitive(r) ? new ve(r, s, t, this.rootNode, this.parentDoctype) : new ve(r, s, t, this.rootNode, this.parentDoctype);
1391
1383
  }
1392
- set(e, t, n = "user") {
1393
- const o = this.resolvePath(e), s = this.has(e) ? this.get(e) : void 0;
1394
- if (n !== "undo" && n !== "redo") {
1395
- const i = Te();
1384
+ set(e, t, r = "user") {
1385
+ const n = this.resolvePath(e), s = this.has(e) ? this.get(e) : void 0;
1386
+ if (r !== "undo" && r !== "redo") {
1387
+ const i = Ae();
1396
1388
  if (i && typeof i.addOperation == "function") {
1397
- const a = o.split("."), c = this.doctype === "StonecropStore" && a.length >= 1 ? a[0] : this.doctype, l = a.length >= 2 ? a[1] : void 0, S = a.slice(2).join(".") || a[a.length - 1], P = t === void 0 && s !== void 0 ? "delete" : "set";
1389
+ const a = n.split("."), c = this.doctype === "StonecropStore" && a.length >= 1 ? a[0] : this.doctype, h = a.length >= 2 ? a[1] : void 0, b = a.slice(2).join(".") || a[a.length - 1], P = t === void 0 && s !== void 0 ? "delete" : "set";
1398
1390
  i.addOperation(
1399
1391
  {
1400
1392
  type: P,
1401
- path: o,
1402
- fieldname: S,
1393
+ path: n,
1394
+ fieldname: b,
1403
1395
  beforeValue: s,
1404
1396
  afterValue: t,
1405
1397
  doctype: c,
1406
- recordId: l,
1398
+ recordId: h,
1407
1399
  reversible: !0
1408
1400
  // Default to reversible, can be changed by field triggers
1409
1401
  },
1410
- n
1402
+ r
1411
1403
  );
1412
1404
  }
1413
1405
  }
1414
- this.updateValue(e, t), this.triggerFieldActions(o, s, t);
1406
+ this.updateValue(e, t), this.triggerFieldActions(n, s, t);
1415
1407
  }
1416
1408
  has(e) {
1417
1409
  try {
1418
1410
  if (e === "")
1419
1411
  return !0;
1420
1412
  const t = this.parsePath(e);
1421
- let n = this.target;
1422
- for (let o = 0; o < t.length; o++) {
1423
- const s = t[o];
1424
- if (n == null)
1413
+ let r = this.target;
1414
+ for (let n = 0; n < t.length; n++) {
1415
+ const s = t[n];
1416
+ if (r == null)
1425
1417
  return !1;
1426
- if (o === t.length - 1)
1427
- return this.isImmutable(n) ? n.has(s) : this.isPiniaStore(n) && n.$state && s in n.$state || s in n;
1428
- n = this.getProperty(n, s);
1418
+ if (n === t.length - 1)
1419
+ return this.isImmutable(r) ? r.has(s) : this.isPiniaStore(r) && r.$state && s in r.$state || s in r;
1420
+ r = this.getProperty(r, s);
1429
1421
  }
1430
1422
  return !1;
1431
1423
  } catch {
@@ -1454,9 +1446,9 @@ class ve {
1454
1446
  * Trigger an XState transition with optional context data
1455
1447
  */
1456
1448
  async triggerTransition(e, t) {
1457
- const n = G(), o = this.parentPath.split(".");
1449
+ const r = G(), n = this.parentPath.split(".");
1458
1450
  let s = this.doctype, i;
1459
- this.doctype === "StonecropStore" && o.length >= 1 && (s = o[0]), o.length >= 2 && (i = o[1]);
1451
+ this.doctype === "StonecropStore" && n.length >= 1 && (s = n[0]), n.length >= 2 && (i = n[1]);
1460
1452
  const a = {
1461
1453
  path: this.parentPath,
1462
1454
  fieldname: "",
@@ -1472,7 +1464,7 @@ class ve {
1472
1464
  currentState: t?.currentState,
1473
1465
  targetState: t?.targetState,
1474
1466
  fsmContext: t?.fsmContext
1475
- }, c = Te();
1467
+ }, c = Ae();
1476
1468
  return c && typeof c.addOperation == "function" && c.addOperation(
1477
1469
  {
1478
1470
  type: "transition",
@@ -1492,7 +1484,7 @@ class ve {
1492
1484
  }
1493
1485
  },
1494
1486
  "user"
1495
- ), await n.executeTransitionActions(a);
1487
+ ), await r.executeTransitionActions(a);
1496
1488
  }
1497
1489
  // Private helper methods
1498
1490
  resolvePath(e) {
@@ -1502,53 +1494,53 @@ class ve {
1502
1494
  if (e === "")
1503
1495
  return this.target;
1504
1496
  const t = this.parsePath(e);
1505
- let n = this.target;
1506
- for (const o of t) {
1507
- if (n == null)
1497
+ let r = this.target;
1498
+ for (const n of t) {
1499
+ if (r == null)
1508
1500
  return;
1509
- n = this.getProperty(n, o);
1501
+ r = this.getProperty(r, n);
1510
1502
  }
1511
- return n;
1503
+ return r;
1512
1504
  }
1513
1505
  updateValue(e, t) {
1514
1506
  if (e === "")
1515
1507
  throw new Error("Cannot set value on empty path");
1516
- const n = this.parsePath(e), o = n.pop();
1508
+ const r = this.parsePath(e), n = r.pop();
1517
1509
  let s = this.target;
1518
- for (const i of n)
1510
+ for (const i of r)
1519
1511
  if (s = this.getProperty(s, i), s == null)
1520
1512
  throw new Error(`Cannot set property on null/undefined path: ${e}`);
1521
- this.setProperty(s, o, t);
1513
+ this.setProperty(s, n, t);
1522
1514
  }
1523
1515
  getProperty(e, t) {
1524
1516
  return this.isImmutable(e) ? e.get(t) : this.isVueReactive(e) ? e[t] : this.isPiniaStore(e) ? e.$state?.[t] ?? e[t] : e[t];
1525
1517
  }
1526
- setProperty(e, t, n) {
1518
+ setProperty(e, t, r) {
1527
1519
  if (this.isImmutable(e))
1528
1520
  throw new Error("Cannot directly mutate immutable objects. Use immutable update methods instead.");
1529
1521
  if (this.isPiniaStore(e)) {
1530
- e.$patch ? e.$patch({ [t]: n }) : e[t] = n;
1522
+ e.$patch ? e.$patch({ [t]: r }) : e[t] = r;
1531
1523
  return;
1532
1524
  }
1533
- e[t] = n;
1525
+ e[t] = r;
1534
1526
  }
1535
- async triggerFieldActions(e, t, n) {
1527
+ async triggerFieldActions(e, t, r) {
1536
1528
  try {
1537
1529
  if (!e || typeof e != "string")
1538
1530
  return;
1539
- const o = e.split(".");
1540
- if (o.length < 3)
1531
+ const n = e.split(".");
1532
+ if (n.length < 3)
1541
1533
  return;
1542
- const s = G(), i = o.slice(2).join(".") || o[o.length - 1];
1534
+ const s = G(), i = n.slice(2).join(".") || n[n.length - 1];
1543
1535
  let a = this.doctype;
1544
- this.doctype === "StonecropStore" && o.length >= 1 && (a = o[0]);
1536
+ this.doctype === "StonecropStore" && n.length >= 1 && (a = n[0]);
1545
1537
  let c;
1546
- o.length >= 2 && (c = o[1]);
1547
- const l = {
1538
+ n.length >= 2 && (c = n[1]);
1539
+ const h = {
1548
1540
  path: e,
1549
1541
  fieldname: i,
1550
1542
  beforeValue: t,
1551
- afterValue: n,
1543
+ afterValue: r,
1552
1544
  operation: "set",
1553
1545
  doctype: a,
1554
1546
  recordId: c,
@@ -1556,9 +1548,9 @@ class ve {
1556
1548
  store: this.rootNode || void 0
1557
1549
  // Pass the root store for snapshot/rollback capabilities
1558
1550
  };
1559
- await s.executeFieldTriggers(l);
1560
- } catch (o) {
1561
- o instanceof Error && console.warn("Field trigger error:", o.message);
1551
+ await s.executeFieldTriggers(h);
1552
+ } catch (n) {
1553
+ n instanceof Error && console.warn("Field trigger error:", n.message);
1562
1554
  }
1563
1555
  }
1564
1556
  isVueReactive(e) {
@@ -1570,19 +1562,19 @@ class ve {
1570
1562
  isImmutable(e) {
1571
1563
  if (!e || typeof e != "object")
1572
1564
  return !1;
1573
- const t = "get" in e && typeof e.get == "function", n = "set" in e && typeof e.set == "function", o = "has" in e && typeof e.has == "function", s = "__ownerID" in e || "_map" in e || "_list" in e || "_origin" in e || "_capacity" in e || "_defaultValues" in e || "_tail" in e || "_root" in e || "size" in e && t && n;
1565
+ const t = "get" in e && typeof e.get == "function", r = "set" in e && typeof e.set == "function", n = "has" in e && typeof e.has == "function", s = "__ownerID" in e || "_map" in e || "_list" in e || "_origin" in e || "_capacity" in e || "_defaultValues" in e || "_tail" in e || "_root" in e || "size" in e && t && r;
1574
1566
  let i;
1575
1567
  try {
1576
1568
  const c = e;
1577
1569
  if ("constructor" in c && c.constructor && typeof c.constructor == "object" && "name" in c.constructor) {
1578
- const l = c.constructor.name;
1579
- i = typeof l == "string" ? l : void 0;
1570
+ const h = c.constructor.name;
1571
+ i = typeof h == "string" ? h : void 0;
1580
1572
  }
1581
1573
  } catch {
1582
1574
  i = void 0;
1583
1575
  }
1584
- const a = i && (i.includes("Map") || i.includes("List") || i.includes("Set") || i.includes("Stack") || i.includes("Seq")) && (t || n);
1585
- return !!(t && n && o && s || t && n && a);
1576
+ const a = i && (i.includes("Map") || i.includes("List") || i.includes("Set") || i.includes("Stack") || i.includes("Seq")) && (t || r);
1577
+ return !!(t && r && n && s || t && r && a);
1586
1578
  }
1587
1579
  isPrimitive(e) {
1588
1580
  return e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "function" || typeof e == "symbol" || typeof e == "bigint";
@@ -1591,8 +1583,8 @@ class ve {
1591
1583
  return e ? e.split(".").filter((t) => t.length > 0) : [];
1592
1584
  }
1593
1585
  }
1594
- function Pt(r, e, t) {
1595
- return new ve(r, e, "", null, t);
1586
+ function _t(o, e, t) {
1587
+ return new ve(o, e, "", null, t);
1596
1588
  }
1597
1589
  class He {
1598
1590
  hstStore;
@@ -1613,7 +1605,7 @@ class He {
1613
1605
  * @internal
1614
1606
  */
1615
1607
  getOperationLogStore() {
1616
- return this._operationLogStore || (this._operationLogStore = ue(), this._operationLogConfig && this._operationLogStore.configure(this._operationLogConfig)), this._operationLogStore;
1608
+ return this._operationLogStore || (this._operationLogStore = le(), this._operationLogConfig && this._operationLogStore.configure(this._operationLogConfig)), this._operationLogStore;
1617
1609
  }
1618
1610
  /**
1619
1611
  * Initialize the HST store structure
@@ -1622,7 +1614,7 @@ class He {
1622
1614
  const e = {};
1623
1615
  Object.keys(this.registry.registry).forEach((t) => {
1624
1616
  e[t] = {};
1625
- }), this.hstStore = Pt(e, "StonecropStore");
1617
+ }), this.hstStore = _t(e, "StonecropStore");
1626
1618
  }
1627
1619
  /**
1628
1620
  * Setup automatic sync with Registry when doctypes are added
@@ -1648,9 +1640,9 @@ class He {
1648
1640
  * @param recordId - The record ID
1649
1641
  * @param recordData - The record data
1650
1642
  */
1651
- addRecord(e, t, n) {
1652
- const o = typeof e == "string" ? e : e.slug;
1653
- this.ensureDoctypeExists(o), this.hstStore.set(`${o}.${t}`, n);
1643
+ addRecord(e, t, r) {
1644
+ const n = typeof e == "string" ? e : e.slug;
1645
+ this.ensureDoctypeExists(n), this.hstStore.set(`${n}.${t}`, r);
1654
1646
  }
1655
1647
  /**
1656
1648
  * Get a specific record
@@ -1659,9 +1651,9 @@ class He {
1659
1651
  * @returns HST node for the record or undefined
1660
1652
  */
1661
1653
  getRecordById(e, t) {
1662
- const n = typeof e == "string" ? e : e.slug;
1663
- if (this.ensureDoctypeExists(n), !(!this.hstStore.has(`${n}.${t}`) || this.hstStore.get(`${n}.${t}`) === void 0))
1664
- return this.hstStore.getNode(`${n}.${t}`);
1654
+ const r = typeof e == "string" ? e : e.slug;
1655
+ if (this.ensureDoctypeExists(r), !(!this.hstStore.has(`${r}.${t}`) || this.hstStore.get(`${r}.${t}`) === void 0))
1656
+ return this.hstStore.getNode(`${r}.${t}`);
1665
1657
  }
1666
1658
  /**
1667
1659
  * Remove a record from the store
@@ -1669,8 +1661,8 @@ class He {
1669
1661
  * @param recordId - The record ID
1670
1662
  */
1671
1663
  removeRecord(e, t) {
1672
- const n = typeof e == "string" ? e : e.slug;
1673
- this.ensureDoctypeExists(n), this.hstStore.has(`${n}.${t}`) && this.hstStore.set(`${n}.${t}`, void 0);
1664
+ const r = typeof e == "string" ? e : e.slug;
1665
+ this.ensureDoctypeExists(r), this.hstStore.has(`${r}.${t}`) && this.hstStore.set(`${r}.${t}`, void 0);
1674
1666
  }
1675
1667
  /**
1676
1668
  * Get all record IDs for a doctype
@@ -1680,8 +1672,8 @@ class He {
1680
1672
  getRecordIds(e) {
1681
1673
  const t = typeof e == "string" ? e : e.slug;
1682
1674
  this.ensureDoctypeExists(t);
1683
- const n = this.hstStore.get(t);
1684
- return !n || typeof n != "object" ? [] : Object.keys(n).filter((o) => n[o] !== void 0);
1675
+ const r = this.hstStore.get(t);
1676
+ return !r || typeof r != "object" ? [] : Object.keys(r).filter((n) => r[n] !== void 0);
1685
1677
  }
1686
1678
  /**
1687
1679
  * Clear all records for a doctype
@@ -1689,8 +1681,8 @@ class He {
1689
1681
  */
1690
1682
  clearRecords(e) {
1691
1683
  const t = typeof e == "string" ? e : e.slug;
1692
- this.ensureDoctypeExists(t), this.getRecordIds(t).forEach((o) => {
1693
- this.hstStore.set(`${t}.${o}`, void 0);
1684
+ this.ensureDoctypeExists(t), this.getRecordIds(t).forEach((n) => {
1685
+ this.hstStore.set(`${t}.${n}`, void 0);
1694
1686
  });
1695
1687
  }
1696
1688
  /**
@@ -1707,20 +1699,20 @@ class He {
1707
1699
  * @param action - The action to run
1708
1700
  * @param args - Action arguments (typically record IDs)
1709
1701
  */
1710
- runAction(e, t, n) {
1711
- const s = this.registry.registry[e.slug]?.actions?.get(t), i = Array.isArray(n) ? n.filter((S) => typeof S == "string") : void 0, a = this.getOperationLogStore();
1712
- let c = "success", l;
1702
+ runAction(e, t, r) {
1703
+ const s = this.registry.registry[e.slug]?.actions?.get(t), i = Array.isArray(r) ? r.filter((b) => typeof b == "string") : void 0, a = this.getOperationLogStore();
1704
+ let c = "success", h;
1713
1705
  try {
1714
- s && s.length > 0 && s.forEach((S) => {
1706
+ s && s.length > 0 && s.forEach((b) => {
1715
1707
  try {
1716
- new Function("args", S)(n);
1708
+ new Function("args", b)(r);
1717
1709
  } catch (w) {
1718
- throw c = "failure", l = w instanceof Error ? w.message : "Unknown error", w;
1710
+ throw c = "failure", h = w instanceof Error ? w.message : "Unknown error", w;
1719
1711
  }
1720
1712
  });
1721
1713
  } catch {
1722
1714
  } finally {
1723
- a.logAction(e.doctype, t, i, c, l);
1715
+ a.logAction(e.doctype, t, i, c, h);
1724
1716
  }
1725
1717
  }
1726
1718
  /**
@@ -1728,8 +1720,8 @@ class He {
1728
1720
  * @param doctype - The doctype
1729
1721
  */
1730
1722
  async getRecords(e) {
1731
- (await (await fetch(`/${e.slug}`)).json()).forEach((o) => {
1732
- o.id && this.addRecord(e, o.id, o);
1723
+ (await (await fetch(`/${e.slug}`)).json()).forEach((n) => {
1724
+ n.id && this.addRecord(e, n.id, n);
1733
1725
  });
1734
1726
  }
1735
1727
  /**
@@ -1738,8 +1730,8 @@ class He {
1738
1730
  * @param recordId - The record ID
1739
1731
  */
1740
1732
  async getRecord(e, t) {
1741
- const o = await (await fetch(`/${e.slug}/${t}`)).json();
1742
- this.addRecord(e, t, o);
1733
+ const n = await (await fetch(`/${e.slug}/${t}`)).json();
1734
+ this.addRecord(e, t, n);
1743
1735
  }
1744
1736
  /**
1745
1737
  * Ensure doctype section exists in HST store
@@ -1766,171 +1758,171 @@ class He {
1766
1758
  return this.hstStore;
1767
1759
  }
1768
1760
  }
1769
- function Ft(r) {
1770
- r || (r = {});
1771
- const e = r.registry || he("$registry"), t = he("$stonecrop"), n = M(), o = M(), s = M({}), i = M(), a = M(), c = M([]), l = M(-1), S = B(() => n.value?.getOperationLogStore().canUndo ?? !1), w = B(() => n.value?.getOperationLogStore().canRedo ?? !1), P = B(() => n.value?.getOperationLogStore().undoCount ?? 0), $ = B(() => n.value?.getOperationLogStore().redoCount ?? 0), T = B(
1772
- () => n.value?.getOperationLogStore().undoRedoState ?? {
1761
+ function Vt(o) {
1762
+ o || (o = {});
1763
+ const e = o.registry || te("$registry"), t = te("$stonecrop"), r = L(), n = L(), s = L({}), i = L(), a = L(), c = L([]), h = L(-1), b = B(() => r.value?.getOperationLogStore().canUndo ?? !1), w = B(() => r.value?.getOperationLogStore().canRedo ?? !1), P = B(() => r.value?.getOperationLogStore().undoCount ?? 0), D = B(() => r.value?.getOperationLogStore().redoCount ?? 0), C = B(
1764
+ () => r.value?.getOperationLogStore().undoRedoState ?? {
1773
1765
  canUndo: !1,
1774
1766
  canRedo: !1,
1775
1767
  undoCount: 0,
1776
1768
  redoCount: 0,
1777
1769
  currentIndex: -1
1778
1770
  }
1779
- ), k = (y) => n.value?.getOperationLogStore().undo(y) ?? !1, _ = (y) => n.value?.getOperationLogStore().redo(y) ?? !1, D = () => {
1780
- n.value?.getOperationLogStore().startBatch();
1781
- }, R = (y) => n.value?.getOperationLogStore().commitBatch(y) ?? null, b = () => {
1782
- n.value?.getOperationLogStore().cancelBatch();
1783
- }, C = () => {
1784
- n.value?.getOperationLogStore().clear();
1785
- }, E = (y, d) => n.value?.getOperationLogStore().getOperationsFor(y, d) ?? [], I = () => n.value?.getOperationLogStore().getSnapshot() ?? {
1771
+ ), F = (y) => r.value?.getOperationLogStore().undo(y) ?? !1, _ = (y) => r.value?.getOperationLogStore().redo(y) ?? !1, $ = () => {
1772
+ r.value?.getOperationLogStore().startBatch();
1773
+ }, R = (y) => r.value?.getOperationLogStore().commitBatch(y) ?? null, S = () => {
1774
+ r.value?.getOperationLogStore().cancelBatch();
1775
+ }, T = () => {
1776
+ r.value?.getOperationLogStore().clear();
1777
+ }, E = (y, f) => r.value?.getOperationLogStore().getOperationsFor(y, f) ?? [], N = () => r.value?.getOperationLogStore().getSnapshot() ?? {
1786
1778
  operations: [],
1787
1779
  currentIndex: -1,
1788
1780
  totalOperations: 0,
1789
1781
  reversibleOperations: 0,
1790
1782
  irreversibleOperations: 0
1791
- }, g = (y, d) => {
1792
- n.value?.getOperationLogStore().markIrreversible(y, d);
1793
- }, x = (y, d, m, N = "success", A) => n.value?.getOperationLogStore().logAction(y, d, m, N, A) ?? "", L = (y) => {
1794
- n.value?.getOperationLogStore().configure(y);
1783
+ }, g = (y, f) => {
1784
+ r.value?.getOperationLogStore().markIrreversible(y, f);
1785
+ }, x = (y, f, m, I = "success", A) => r.value?.getOperationLogStore().logAction(y, f, m, I, A) ?? "", M = (y) => {
1786
+ r.value?.getOperationLogStore().configure(y);
1795
1787
  };
1796
- Le(async () => {
1788
+ Me(async () => {
1797
1789
  if (e) {
1798
- n.value = t || new He(e);
1790
+ r.value = t || new He(e);
1799
1791
  try {
1800
- const y = n.value.getOperationLogStore(), d = Ue(y);
1801
- c.value = d.operations.value, l.value = d.currentIndex.value, H(
1802
- () => d.operations.value,
1792
+ const y = r.value.getOperationLogStore(), f = Ue(y);
1793
+ c.value = f.operations.value, h.value = f.currentIndex.value, H(
1794
+ () => f.operations.value,
1803
1795
  (m) => {
1804
1796
  c.value = m;
1805
1797
  }
1806
1798
  ), H(
1807
- () => d.currentIndex.value,
1799
+ () => f.currentIndex.value,
1808
1800
  (m) => {
1809
- l.value = m;
1801
+ h.value = m;
1810
1802
  }
1811
1803
  );
1812
1804
  } catch {
1813
1805
  }
1814
- if (!r.doctype && e.router) {
1806
+ if (!o.doctype && e.router) {
1815
1807
  const y = e.router.currentRoute.value;
1816
1808
  if (!y.path) return;
1817
- const d = y.path.split("/").filter((N) => N.length > 0), m = d[1]?.toLowerCase();
1818
- if (d.length > 0) {
1819
- const N = {
1809
+ const f = y.path.split("/").filter((I) => I.length > 0), m = f[1]?.toLowerCase();
1810
+ if (f.length > 0) {
1811
+ const I = {
1820
1812
  path: y.path,
1821
- segments: d
1822
- }, A = await e.getMeta?.(N);
1813
+ segments: f
1814
+ }, A = await e.getMeta?.(I);
1823
1815
  if (A) {
1824
- if (e.addDoctype(A), n.value.setup(A), i.value = A, a.value = m, o.value = n.value.getStore(), m && m !== "new") {
1825
- const j = n.value.getRecordById(A, m);
1816
+ if (e.addDoctype(A), r.value.setup(A), i.value = A, a.value = m, n.value = r.value.getStore(), m && m !== "new") {
1817
+ const j = r.value.getRecordById(A, m);
1826
1818
  if (j)
1827
1819
  s.value = j.get("") || {};
1828
1820
  else
1829
1821
  try {
1830
- await n.value.getRecord(A, m);
1831
- const V = n.value.getRecordById(A, m);
1822
+ await r.value.getRecord(A, m);
1823
+ const V = r.value.getRecordById(A, m);
1832
1824
  V && (s.value = V.get("") || {});
1833
1825
  } catch {
1834
- s.value = pe(A);
1826
+ s.value = he(A);
1835
1827
  }
1836
1828
  } else
1837
- s.value = pe(A);
1838
- o.value && Ce(A, m || "new", s, o.value), n.value.runAction(A, "load", m ? [m] : void 0);
1829
+ s.value = he(A);
1830
+ n.value && Ve(A, m || "new", s, n.value), r.value.runAction(A, "load", m ? [m] : void 0);
1839
1831
  }
1840
1832
  }
1841
1833
  }
1842
- if (r.doctype) {
1843
- o.value = n.value.getStore();
1844
- const y = r.doctype, d = r.recordId;
1845
- if (d && d !== "new") {
1846
- const m = n.value.getRecordById(y, d);
1834
+ if (o.doctype) {
1835
+ n.value = r.value.getStore();
1836
+ const y = o.doctype, f = o.recordId;
1837
+ if (f && f !== "new") {
1838
+ const m = r.value.getRecordById(y, f);
1847
1839
  if (m)
1848
1840
  s.value = m.get("") || {};
1849
1841
  else
1850
1842
  try {
1851
- await n.value.getRecord(y, d);
1852
- const N = n.value.getRecordById(y, d);
1853
- N && (s.value = N.get("") || {});
1843
+ await r.value.getRecord(y, f);
1844
+ const I = r.value.getRecordById(y, f);
1845
+ I && (s.value = I.get("") || {});
1854
1846
  } catch {
1855
- s.value = pe(y);
1847
+ s.value = he(y);
1856
1848
  }
1857
1849
  } else
1858
- s.value = pe(y);
1859
- o.value && Ce(y, d || "new", s, o.value);
1850
+ s.value = he(y);
1851
+ n.value && Ve(y, f || "new", s, n.value);
1860
1852
  }
1861
1853
  }
1862
1854
  });
1863
- const u = (y, d) => {
1864
- const m = r.doctype || i.value;
1855
+ const u = (y, f) => {
1856
+ const m = o.doctype || i.value;
1865
1857
  if (!m) return "";
1866
- const N = d || r.recordId || a.value || "new";
1867
- return `${m.slug}.${N}.${y}`;
1868
- }, f = (y) => {
1869
- const d = r.doctype || i.value;
1870
- if (!(!o.value || !n.value || !d))
1858
+ const I = f || o.recordId || a.value || "new";
1859
+ return `${m.slug}.${I}.${y}`;
1860
+ }, l = (y) => {
1861
+ const f = o.doctype || i.value;
1862
+ if (!(!n.value || !r.value || !f))
1871
1863
  try {
1872
1864
  const m = y.path.split(".");
1873
1865
  if (m.length >= 2) {
1874
1866
  const j = m[0], V = m[1];
1875
- if (o.value.has(`${j}.${V}`) || n.value.addRecord(d, V, { ...s.value }), m.length > 3) {
1876
- const p = `${j}.${V}`, h = m.slice(2);
1877
- let v = p;
1878
- for (let F = 0; F < h.length - 1; F++)
1879
- if (v += `.${h[F]}`, !o.value.has(v)) {
1880
- const z = h[F + 1], W = !isNaN(Number(z));
1881
- o.value.set(v, W ? [] : {});
1867
+ if (n.value.has(`${j}.${V}`) || r.value.addRecord(f, V, { ...s.value }), m.length > 3) {
1868
+ const d = `${j}.${V}`, p = m.slice(2);
1869
+ let v = d;
1870
+ for (let k = 0; k < p.length - 1; k++)
1871
+ if (v += `.${p[k]}`, !n.value.has(v)) {
1872
+ const z = p[k + 1], W = !isNaN(Number(z));
1873
+ n.value.set(v, W ? [] : {});
1882
1874
  }
1883
1875
  }
1884
1876
  }
1885
- o.value.set(y.path, y.value);
1886
- const N = y.fieldname.split("."), A = { ...s.value };
1887
- N.length === 1 ? A[N[0]] = y.value : Nt(A, N, y.value), s.value = A;
1877
+ n.value.set(y.path, y.value);
1878
+ const I = y.fieldname.split("."), A = { ...s.value };
1879
+ I.length === 1 ? A[I[0]] = y.value : Pt(A, I, y.value), s.value = A;
1888
1880
  } catch {
1889
1881
  }
1890
1882
  };
1891
- (r.doctype || e?.router) && (_e("hstPathProvider", u), _e("hstChangeHandler", f));
1883
+ (o.doctype || e?.router) && (Ne("hstPathProvider", u), Ne("hstChangeHandler", l));
1892
1884
  const O = {
1893
1885
  operations: c,
1894
- currentIndex: l,
1895
- undoRedoState: T,
1896
- canUndo: S,
1886
+ currentIndex: h,
1887
+ undoRedoState: C,
1888
+ canUndo: b,
1897
1889
  canRedo: w,
1898
1890
  undoCount: P,
1899
- redoCount: $,
1900
- undo: k,
1891
+ redoCount: D,
1892
+ undo: F,
1901
1893
  redo: _,
1902
- startBatch: D,
1894
+ startBatch: $,
1903
1895
  commitBatch: R,
1904
- cancelBatch: b,
1905
- clear: C,
1896
+ cancelBatch: S,
1897
+ clear: T,
1906
1898
  getOperationsFor: E,
1907
- getSnapshot: I,
1899
+ getSnapshot: N,
1908
1900
  markIrreversible: g,
1909
1901
  logAction: x,
1910
- configure: L
1902
+ configure: M
1911
1903
  };
1912
- return r.doctype ? {
1913
- stonecrop: n,
1904
+ return o.doctype ? {
1905
+ stonecrop: r,
1914
1906
  operationLog: O,
1915
1907
  provideHSTPath: u,
1916
- handleHSTChange: f,
1917
- hstStore: o,
1908
+ handleHSTChange: l,
1909
+ hstStore: n,
1918
1910
  formData: s
1919
- } : !r.doctype && e?.router ? {
1920
- stonecrop: n,
1911
+ } : !o.doctype && e?.router ? {
1912
+ stonecrop: r,
1921
1913
  operationLog: O,
1922
1914
  provideHSTPath: u,
1923
- handleHSTChange: f,
1924
- hstStore: o,
1915
+ handleHSTChange: l,
1916
+ hstStore: n,
1925
1917
  formData: s
1926
1918
  } : {
1927
- stonecrop: n,
1919
+ stonecrop: r,
1928
1920
  operationLog: O
1929
1921
  };
1930
1922
  }
1931
- function pe(r) {
1923
+ function he(o) {
1932
1924
  const e = {};
1933
- return r.schema && r.schema.forEach((t) => {
1925
+ return o.schema && o.schema.forEach((t) => {
1934
1926
  switch ("fieldtype" in t ? t.fieldtype : "Data") {
1935
1927
  case "Data":
1936
1928
  case "Text":
@@ -1954,15 +1946,15 @@ function pe(r) {
1954
1946
  }
1955
1947
  }), e;
1956
1948
  }
1957
- function Ce(r, e, t, n) {
1949
+ function Ve(o, e, t, r) {
1958
1950
  H(
1959
1951
  t,
1960
- (o) => {
1961
- const s = `${r.slug}.${e}`;
1962
- Object.keys(o).forEach((i) => {
1952
+ (n) => {
1953
+ const s = `${o.slug}.${e}`;
1954
+ Object.keys(n).forEach((i) => {
1963
1955
  const a = `${s}.${i}`;
1964
1956
  try {
1965
- n.set(a, o[i]);
1957
+ r.set(a, n[i]);
1966
1958
  } catch {
1967
1959
  }
1968
1960
  });
@@ -1970,20 +1962,20 @@ function Ce(r, e, t, n) {
1970
1962
  { deep: !0 }
1971
1963
  );
1972
1964
  }
1973
- function Nt(r, e, t) {
1974
- let n = r;
1965
+ function Pt(o, e, t) {
1966
+ let r = o;
1975
1967
  for (let s = 0; s < e.length - 1; s++) {
1976
1968
  const i = e[s];
1977
- (!(i in n) || typeof n[i] != "object") && (n[i] = isNaN(Number(e[s + 1])) ? {} : []), n = n[i];
1969
+ (!(i in r) || typeof r[i] != "object") && (r[i] = isNaN(Number(e[s + 1])) ? {} : []), r = r[i];
1978
1970
  }
1979
- const o = e[e.length - 1];
1980
- n[o] = t;
1971
+ const n = e[e.length - 1];
1972
+ r[n] = t;
1981
1973
  }
1982
- function Je(r) {
1983
- const t = he("$operationLogStore", void 0) || ue();
1984
- r && t.configure(r);
1985
- const { operations: n, currentIndex: o, undoRedoState: s, canUndo: i, canRedo: a, undoCount: c, redoCount: l } = Ue(t);
1986
- function S(E) {
1974
+ function Je(o) {
1975
+ const t = te("$operationLogStore", void 0) || le();
1976
+ o && t.configure(o);
1977
+ const { operations: r, currentIndex: n, undoRedoState: s, canUndo: i, canRedo: a, undoCount: c, redoCount: h } = Ue(t);
1978
+ function b(E) {
1987
1979
  return t.undo(E);
1988
1980
  }
1989
1981
  function w(E) {
@@ -1992,75 +1984,75 @@ function Je(r) {
1992
1984
  function P() {
1993
1985
  t.startBatch();
1994
1986
  }
1995
- function $(E) {
1987
+ function D(E) {
1996
1988
  return t.commitBatch(E);
1997
1989
  }
1998
- function T() {
1990
+ function C() {
1999
1991
  t.cancelBatch();
2000
1992
  }
2001
- function k() {
1993
+ function F() {
2002
1994
  t.clear();
2003
1995
  }
2004
- function _(E, I) {
2005
- return t.getOperationsFor(E, I);
1996
+ function _(E, N) {
1997
+ return t.getOperationsFor(E, N);
2006
1998
  }
2007
- function D() {
1999
+ function $() {
2008
2000
  return t.getSnapshot();
2009
2001
  }
2010
- function R(E, I) {
2011
- t.markIrreversible(E, I);
2002
+ function R(E, N) {
2003
+ t.markIrreversible(E, N);
2012
2004
  }
2013
- function b(E, I, g, x = "success", L) {
2014
- return t.logAction(E, I, g, x, L);
2005
+ function S(E, N, g, x = "success", M) {
2006
+ return t.logAction(E, N, g, x, M);
2015
2007
  }
2016
- function C(E) {
2008
+ function T(E) {
2017
2009
  t.configure(E);
2018
2010
  }
2019
2011
  return {
2020
2012
  // State
2021
- operations: n,
2022
- currentIndex: o,
2013
+ operations: r,
2014
+ currentIndex: n,
2023
2015
  undoRedoState: s,
2024
2016
  canUndo: i,
2025
2017
  canRedo: a,
2026
2018
  undoCount: c,
2027
- redoCount: l,
2019
+ redoCount: h,
2028
2020
  // Methods
2029
- undo: S,
2021
+ undo: b,
2030
2022
  redo: w,
2031
2023
  startBatch: P,
2032
- commitBatch: $,
2033
- cancelBatch: T,
2034
- clear: k,
2024
+ commitBatch: D,
2025
+ cancelBatch: C,
2026
+ clear: F,
2035
2027
  getOperationsFor: _,
2036
- getSnapshot: D,
2028
+ getSnapshot: $,
2037
2029
  markIrreversible: R,
2038
- logAction: b,
2039
- configure: C
2030
+ logAction: S,
2031
+ configure: T
2040
2032
  };
2041
2033
  }
2042
- function kt(r, e = !0) {
2034
+ function kt(o, e = !0) {
2043
2035
  if (!e) return;
2044
- const { undo: t, redo: n, canUndo: o, canRedo: s } = Je(), i = Rt();
2045
- ee(i["Ctrl+Z"], () => {
2046
- o.value && t(r);
2047
- }), ee(i["Meta+Z"], () => {
2048
- o.value && t(r);
2049
- }), ee(i["Ctrl+Shift+Z"], () => {
2050
- s.value && n(r);
2051
- }), ee(i["Meta+Shift+Z"], () => {
2052
- s.value && n(r);
2053
- }), ee(i["Ctrl+Y"], () => {
2054
- s.value && n(r);
2036
+ const { undo: t, redo: r, canUndo: n, canRedo: s } = Je(), i = Ot();
2037
+ oe(i["Ctrl+Z"], () => {
2038
+ n.value && t(o);
2039
+ }), oe(i["Meta+Z"], () => {
2040
+ n.value && t(o);
2041
+ }), oe(i["Ctrl+Shift+Z"], () => {
2042
+ s.value && r(o);
2043
+ }), oe(i["Meta+Shift+Z"], () => {
2044
+ s.value && r(o);
2045
+ }), oe(i["Ctrl+Y"], () => {
2046
+ s.value && r(o);
2055
2047
  });
2056
2048
  }
2057
- async function Lt(r, e) {
2058
- const { startBatch: t, commitBatch: n, cancelBatch: o } = Je();
2049
+ async function Ft(o, e) {
2050
+ const { startBatch: t, commitBatch: r, cancelBatch: n } = Je();
2059
2051
  t();
2060
2052
  try {
2061
- return await r(), n(e);
2053
+ return await o(), r(e);
2062
2054
  } catch (s) {
2063
- throw o(), s;
2055
+ throw n(), s;
2064
2056
  }
2065
2057
  }
2066
2058
  class Mt {
@@ -2102,8 +2094,8 @@ class Mt {
2102
2094
  * @param actions - The doctype actions and field triggers
2103
2095
  * @param component - Optional Vue component for rendering the doctype
2104
2096
  */
2105
- constructor(e, t, n, o, s) {
2106
- this.doctype = e, this.schema = t, this.workflow = n, this.actions = o, this.component = s;
2097
+ constructor(e, t, r, n, s) {
2098
+ this.doctype = e, this.schema = t, this.workflow = r, this.actions = n, this.component = s;
2107
2099
  }
2108
2100
  /**
2109
2101
  * Converts the registered doctype string to a slug (kebab-case). The following conversions are made:
@@ -2125,7 +2117,7 @@ class Mt {
2125
2117
  return this.doctype.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
2126
2118
  }
2127
2119
  }
2128
- class ae {
2120
+ class ce {
2129
2121
  /**
2130
2122
  * The root Registry instance
2131
2123
  */
@@ -2152,9 +2144,9 @@ class ae {
2152
2144
  * @param getMeta - Optional function to fetch doctype metadata from an API
2153
2145
  */
2154
2146
  constructor(e, t) {
2155
- if (ae._root)
2156
- return ae._root;
2157
- ae._root = this, this.name = "Registry", this.registry = {}, this.router = e, this.getMeta = t;
2147
+ if (ce._root)
2148
+ return ce._root;
2149
+ ce._root = this, this.name = "Registry", this.registry = {}, this.router = e, this.getMeta = t;
2158
2150
  }
2159
2151
  /**
2160
2152
  * The getMeta function fetches doctype metadata from an API based on route context
@@ -2189,53 +2181,53 @@ class ae {
2189
2181
  // }
2190
2182
  // }
2191
2183
  }
2192
- async function It(r, e, t) {
2193
- await ce();
2184
+ async function Nt(o, e, t) {
2185
+ await ue();
2194
2186
  try {
2195
- await t(r, e);
2187
+ await t(o, e);
2196
2188
  } catch {
2197
2189
  }
2198
2190
  }
2199
- const xt = {
2200
- install: (r, e) => {
2201
- const t = r.config.globalProperties.$router, n = e?.router, o = t || n;
2202
- !t && n && r.use(n);
2203
- const s = new ae(o, e?.getMeta);
2204
- r.provide("$registry", s), r.config.globalProperties.$registry = s;
2191
+ const Lt = {
2192
+ install: (o, e) => {
2193
+ const t = o.config.globalProperties.$router, r = e?.router, n = t || r;
2194
+ !t && r && o.use(r);
2195
+ const s = new ce(n, e?.getMeta);
2196
+ o.provide("$registry", s), o.config.globalProperties.$registry = s;
2205
2197
  const i = new He(s);
2206
- r.provide("$stonecrop", i), r.config.globalProperties.$stonecrop = i;
2198
+ o.provide("$stonecrop", i), o.config.globalProperties.$stonecrop = i;
2207
2199
  try {
2208
- const a = r.config.globalProperties.$pinia;
2200
+ const a = o.config.globalProperties.$pinia;
2209
2201
  if (a) {
2210
- const c = ue(a);
2211
- r.provide("$operationLogStore", c), r.config.globalProperties.$operationLogStore = c;
2202
+ const c = le(a);
2203
+ o.provide("$operationLogStore", c), o.config.globalProperties.$operationLogStore = c;
2212
2204
  }
2213
2205
  } catch (a) {
2214
2206
  console.warn("Pinia not available - operation log features will be disabled:", a);
2215
2207
  }
2216
2208
  if (e?.components)
2217
2209
  for (const [a, c] of Object.entries(e.components))
2218
- r.component(a, c);
2219
- e?.autoInitializeRouter && e.onRouterInitialized && It(s, i, e.onRouterInitialized);
2210
+ o.component(a, c);
2211
+ e?.autoInitializeRouter && e.onRouterInitialized && Nt(s, i, e.onRouterInitialized);
2220
2212
  }
2221
2213
  };
2222
2214
  export {
2223
2215
  Mt as DoctypeMeta,
2224
- Q as HST,
2225
- ae as Registry,
2216
+ ee as HST,
2217
+ ce as Registry,
2226
2218
  He as Stonecrop,
2227
- Pt as createHST,
2228
- xt as default,
2219
+ _t as createHST,
2220
+ Lt as default,
2229
2221
  G as getGlobalTriggerEngine,
2230
- Vt as markOperationIrreversible,
2222
+ At as markOperationIrreversible,
2231
2223
  Dt as registerGlobalAction,
2232
- Tt as registerTransitionAction,
2233
- Ct as setFieldRollback,
2234
- At as triggerTransition,
2224
+ $t as registerTransitionAction,
2225
+ Tt as setFieldRollback,
2226
+ Ct as triggerTransition,
2235
2227
  Je as useOperationLog,
2236
- ue as useOperationLogStore,
2237
- Ft as useStonecrop,
2228
+ le as useOperationLogStore,
2229
+ Vt as useStonecrop,
2238
2230
  kt as useUndoRedoShortcuts,
2239
- Lt as withBatch
2231
+ Ft as withBatch
2240
2232
  };
2241
2233
  //# sourceMappingURL=stonecrop.js.map