@stonecrop/stonecrop 0.8.13 → 0.9.1

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,563 +1,249 @@
1
- import { hasInjectionContext as Ae, inject as oe, toRaw as Me, computed as W, isRef as se, isReactive as be, toRef as ce, getCurrentInstance as Fe, ref as B, reactive as ye, markRaw as ae, effectScope as Ye, nextTick as de, getCurrentScope as Xe, onScopeDispose as et, watch as U, toRefs as $e, onMounted as Be, readonly as je, customRef as tt, toValue as q, shallowRef as We, unref as rt, provide as De } from "vue";
2
- const te = typeof window < "u";
3
- let G;
4
- const me = (n) => G = n;
5
- process.env.NODE_ENV;
6
- const Pe = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia") : (
7
- /* istanbul ignore next */
8
- /* @__PURE__ */ Symbol()
9
- );
10
- function Y(n) {
11
- return n && typeof n == "object" && Object.prototype.toString.call(n) === "[object Object]" && typeof n.toJSON != "function";
12
- }
13
- var le;
14
- (function(n) {
15
- n.direct = "direct", n.patchObject = "patch object", n.patchFunction = "patch function";
16
- })(le || (le = {}));
17
- function He(n, e) {
18
- for (const t in e) {
19
- const r = e[t];
20
- if (!(t in n))
21
- continue;
22
- const o = n[t];
23
- Y(o) && Y(r) && !se(r) && !be(r) ? n[t] = He(o, r) : n[t] = r;
24
- }
25
- return n;
26
- }
27
- const ze = () => {
28
- };
29
- function Te(n, e, t, r = ze) {
30
- n.add(e);
31
- const o = () => {
32
- n.delete(e) && r();
33
- };
34
- return !t && Xe() && et(o), o;
35
- }
36
- function ee(n, ...e) {
37
- n.forEach((t) => {
38
- t(...e);
39
- });
40
- }
41
- const nt = (n) => n(), Ie = /* @__PURE__ */ Symbol(), Ee = /* @__PURE__ */ Symbol();
42
- function Ne(n, e) {
43
- n instanceof Map && e instanceof Map ? e.forEach((t, r) => n.set(r, t)) : n instanceof Set && e instanceof Set && e.forEach(n.add, n);
44
- for (const t in e) {
45
- if (!e.hasOwnProperty(t))
46
- continue;
47
- const r = e[t], o = n[t];
48
- Y(o) && Y(r) && n.hasOwnProperty(t) && !se(r) && !be(r) ? n[t] = Ne(o, r) : n[t] = r;
49
- }
50
- return n;
51
- }
52
- const ot = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia:skipHydration") : (
53
- /* istanbul ignore next */
54
- /* @__PURE__ */ Symbol()
55
- );
56
- function st(n) {
57
- return !Y(n) || !Object.prototype.hasOwnProperty.call(n, ot);
58
- }
59
- const { assign: z } = Object;
60
- function Ce(n) {
61
- return !!(se(n) && n.effect);
62
- }
63
- function ke(n, e, t, r) {
64
- const { state: o, actions: s, getters: i } = e, a = t.state.value[n];
65
- let c;
66
- function f() {
67
- !a && (process.env.NODE_ENV === "production" || !r) && (t.state.value[n] = o ? o() : {});
68
- const g = process.env.NODE_ENV !== "production" && r ? (
69
- // use ref() to unwrap refs inside state TODO: check if this is still necessary
70
- $e(B(o ? o() : {}).value)
71
- ) : $e(t.state.value[n]);
72
- return z(g, s, Object.keys(i || {}).reduce((b, A) => (process.env.NODE_ENV !== "production" && A in g && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${A}" in store "${n}".`), b[A] = ae(W(() => {
73
- me(t);
74
- const $ = t._s.get(n);
75
- return i[A].call($, $);
76
- })), b), {}));
77
- }
78
- return c = _e(n, f, e, t, r, !0), c;
79
- }
80
- function _e(n, e, t = {}, r, o, s) {
81
- let i;
82
- const a = z({ actions: {} }, t);
83
- if (process.env.NODE_ENV !== "production" && !r._e.active)
84
- throw new Error("Pinia destroyed");
85
- const c = { deep: !0 };
86
- process.env.NODE_ENV !== "production" && (c.onTrigger = (d) => {
87
- f ? $ = d : f == !1 && !v._hotUpdating && (Array.isArray($) ? $.push(d) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."));
88
- });
89
- let f, g, b = /* @__PURE__ */ new Set(), A = /* @__PURE__ */ new Set(), $;
90
- const k = r.state.value[n];
91
- !s && !k && (process.env.NODE_ENV === "production" || !o) && (r.state.value[n] = {});
92
- const x = B({});
93
- let N;
94
- function D(d) {
95
- let p;
96
- f = g = !1, process.env.NODE_ENV !== "production" && ($ = []), typeof d == "function" ? (d(r.state.value[n]), p = {
97
- type: le.patchFunction,
98
- storeId: n,
99
- events: $
100
- }) : (Ne(r.state.value[n], d), p = {
101
- type: le.patchObject,
102
- payload: d,
103
- storeId: n,
104
- events: $
105
- });
106
- const R = N = /* @__PURE__ */ Symbol();
107
- de().then(() => {
108
- N === R && (f = !0);
109
- }), g = !0, ee(b, p, r.state.value[n]);
110
- }
111
- const P = s ? function() {
112
- const { state: p } = t, R = p ? p() : {};
113
- this.$patch((F) => {
114
- z(F, R);
115
- });
116
- } : (
117
- /* istanbul ignore next */
118
- process.env.NODE_ENV !== "production" ? () => {
119
- throw new Error(`🍍: Store "${n}" is built using the setup syntax and does not implement $reset().`);
120
- } : ze
121
- );
122
- function S() {
123
- i.stop(), b.clear(), A.clear(), r._s.delete(n);
124
- }
125
- const C = (d, p = "") => {
126
- if (Ie in d)
127
- return d[Ee] = p, d;
128
- const R = function() {
129
- me(r);
130
- const F = Array.from(arguments), w = /* @__PURE__ */ new Set(), T = /* @__PURE__ */ new Set();
131
- function L(m) {
132
- w.add(m);
133
- }
134
- function y(m) {
135
- T.add(m);
136
- }
137
- ee(A, {
138
- args: F,
139
- name: R[Ee],
140
- store: v,
141
- after: L,
142
- onError: y
143
- });
144
- let E;
145
- try {
146
- E = d.apply(this && this.$id === n ? this : v, F);
147
- } catch (m) {
148
- throw ee(T, m), m;
149
- }
150
- return E instanceof Promise ? E.then((m) => (ee(w, m), m)).catch((m) => (ee(T, m), Promise.reject(m))) : (ee(w, E), E);
151
- };
152
- return R[Ie] = !0, R[Ee] = p, R;
153
- }, O = /* @__PURE__ */ ae({
154
- actions: {},
155
- getters: {},
156
- state: [],
157
- hotState: x
158
- }), _ = {
159
- _p: r,
160
- // _s: scope,
161
- $id: n,
162
- $onAction: Te.bind(null, A),
163
- $patch: D,
164
- $reset: P,
165
- $subscribe(d, p = {}) {
166
- const R = Te(b, d, p.detached, () => F()), F = i.run(() => U(() => r.state.value[n], (w) => {
167
- (p.flush === "sync" ? g : f) && d({
168
- storeId: n,
169
- type: le.direct,
170
- events: $
171
- }, w);
172
- }, z({}, c, p)));
173
- return R;
174
- },
175
- $dispose: S
176
- }, v = ye(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && te ? z(
177
- {
178
- _hmrPayload: O,
179
- _customProperties: ae(/* @__PURE__ */ new Set())
180
- // devtools custom properties
181
- },
182
- _
183
- // must be added later
184
- // setupStore
185
- ) : _);
186
- r._s.set(n, v);
187
- const M = (r._a && r._a.runWithContext || nt)(() => r._e.run(() => (i = Ye()).run(() => e({ action: C }))));
188
- for (const d in M) {
189
- const p = M[d];
190
- if (se(p) && !Ce(p) || be(p))
191
- process.env.NODE_ENV !== "production" && o ? x.value[d] = ce(M, d) : s || (k && st(p) && (se(p) ? p.value = k[d] : Ne(p, k[d])), r.state.value[n][d] = p), process.env.NODE_ENV !== "production" && O.state.push(d);
192
- else if (typeof p == "function") {
193
- const R = process.env.NODE_ENV !== "production" && o ? p : C(p, d);
194
- M[d] = R, process.env.NODE_ENV !== "production" && (O.actions[d] = p), a.actions[d] = p;
195
- } else process.env.NODE_ENV !== "production" && Ce(p) && (O.getters[d] = s ? (
196
- // @ts-expect-error
197
- t.getters[d]
198
- ) : p, te && (M._getters || // @ts-expect-error: same
199
- (M._getters = ae([]))).push(d));
200
- }
201
- if (z(v, M), z(Me(v), M), Object.defineProperty(v, "$state", {
202
- get: () => process.env.NODE_ENV !== "production" && o ? x.value : r.state.value[n],
203
- set: (d) => {
204
- if (process.env.NODE_ENV !== "production" && o)
205
- throw new Error("cannot set hotState");
206
- D((p) => {
207
- z(p, d);
208
- });
209
- }
210
- }), process.env.NODE_ENV !== "production" && (v._hotUpdate = ae((d) => {
211
- v._hotUpdating = !0, d._hmrPayload.state.forEach((p) => {
212
- if (p in v.$state) {
213
- const R = d.$state[p], F = v.$state[p];
214
- typeof R == "object" && Y(R) && Y(F) ? He(R, F) : d.$state[p] = F;
215
- }
216
- v[p] = ce(d.$state, p);
217
- }), Object.keys(v.$state).forEach((p) => {
218
- p in d.$state || delete v[p];
219
- }), f = !1, g = !1, r.state.value[n] = ce(d._hmrPayload, "hotState"), g = !0, de().then(() => {
220
- f = !0;
221
- });
222
- for (const p in d._hmrPayload.actions) {
223
- const R = d[p];
224
- v[p] = //
225
- C(R, p);
226
- }
227
- for (const p in d._hmrPayload.getters) {
228
- const R = d._hmrPayload.getters[p], F = s ? (
229
- // special handling of options api
230
- W(() => (me(r), R.call(v, v)))
231
- ) : R;
232
- v[p] = //
233
- F;
234
- }
235
- Object.keys(v._hmrPayload.getters).forEach((p) => {
236
- p in d._hmrPayload.getters || delete v[p];
237
- }), Object.keys(v._hmrPayload.actions).forEach((p) => {
238
- p in d._hmrPayload.actions || delete v[p];
239
- }), v._hmrPayload = d._hmrPayload, v._getters = d._getters, v._hotUpdating = !1;
240
- })), process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && te) {
241
- const d = {
242
- writable: !0,
243
- configurable: !0,
244
- // avoid warning on devtools trying to display this property
245
- enumerable: !1
246
- };
247
- ["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((p) => {
248
- Object.defineProperty(v, p, z({ value: v[p] }, d));
249
- });
250
- }
251
- return r._p.forEach((d) => {
252
- if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && te) {
253
- const p = i.run(() => d({
254
- store: v,
255
- app: r._a,
256
- pinia: r,
257
- options: a
258
- }));
259
- Object.keys(p || {}).forEach((R) => v._customProperties.add(R)), z(v, p);
260
- } else
261
- z(v, i.run(() => d({
262
- store: v,
263
- app: r._a,
264
- pinia: r,
265
- options: a
266
- })));
267
- }), process.env.NODE_ENV !== "production" && v.$state && typeof v.$state == "object" && typeof v.$state.constructor == "function" && !v.$state.constructor.toString().includes("[native code]") && console.warn(`[🍍]: The "state" must be a plain object. It cannot be
268
- state: () => new MyClass()
269
- Found in store "${v.$id}".`), k && s && t.hydrate && t.hydrate(v.$state, k), f = !0, g = !0, v;
270
- }
271
- // @__NO_SIDE_EFFECTS__
272
- function it(n, e, t) {
273
- let r;
274
- const o = typeof e == "function";
275
- r = o ? t : e;
276
- function s(i, a) {
277
- const c = Ae();
278
- if (i = // in test mode, ignore the argument provided as we can always retrieve a
279
- // pinia instance with getActivePinia()
280
- (process.env.NODE_ENV === "test" && G && G._testing ? null : i) || (c ? oe(Pe, null) : null), i && me(i), process.env.NODE_ENV !== "production" && !G)
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)"?
282
- See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
283
- This will fail in production.`);
284
- i = G, i._s.has(n) || (o ? _e(n, e, r, i) : ke(n, r, i), process.env.NODE_ENV !== "production" && (s._pinia = i));
285
- const f = i._s.get(n);
286
- if (process.env.NODE_ENV !== "production" && a) {
287
- const g = "__hot:" + n, b = o ? _e(g, e, r, i, !0) : ke(g, z({}, r), i, !0);
288
- a._hotUpdate(b), delete i.state.value[g], i._s.delete(g);
289
- }
290
- if (process.env.NODE_ENV !== "production" && te) {
291
- const g = Fe();
292
- if (g && g.proxy && // avoid adding stores that are just built for hot module replacement
293
- !a) {
294
- const b = g.proxy, A = "_pStores" in b ? b._pStores : b._pStores = {};
295
- A[n] = f;
296
- }
297
- }
298
- return f;
299
- }
300
- return s.$id = n, s;
301
- }
302
- function Ue(n) {
303
- const e = Me(n), t = {};
304
- for (const r in e) {
305
- const o = e[r];
306
- o.effect ? t[r] = // ...
307
- W({
308
- get: () => n[r],
309
- set(s) {
310
- n[r] = s;
311
- }
312
- }) : (se(o) || be(o)) && (t[r] = // ---
313
- ce(n, r));
314
- }
315
- return t;
316
- }
317
- const at = typeof window < "u" && typeof document < "u";
1
+ import { watch as U, onMounted as me, nextTick as de, readonly as ye, getCurrentInstance as Pe, toRef as Ie, customRef as Ee, ref as L, reactive as ue, computed as B, toValue as H, shallowRef as Se, unref as Ce, inject as fe, provide as pe } from "vue";
2
+ import { defineStore as De, storeToRefs as be } from "pinia";
3
+ const ke = typeof window < "u" && typeof document < "u";
318
4
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
319
- const ct = Object.prototype.toString, lt = (n) => ct.call(n) === "[object Object]", Je = () => {
5
+ const Le = Object.prototype.toString, Me = (o) => Le.call(o) === "[object Object]", we = () => {
320
6
  };
321
- function ut(...n) {
322
- if (n.length !== 1) return ce(...n);
323
- const e = n[0];
324
- return typeof e == "function" ? je(tt(() => ({
7
+ function Fe(...o) {
8
+ if (o.length !== 1) return Ie(...o);
9
+ const e = o[0];
10
+ return typeof e == "function" ? ye(Ee(() => ({
325
11
  get: e,
326
- set: Je
327
- }))) : B(e);
12
+ set: we
13
+ }))) : L(e);
328
14
  }
329
- function ft(n, e) {
15
+ function xe(o, e) {
330
16
  function t(...r) {
331
- return new Promise((o, s) => {
332
- Promise.resolve(n(() => e.apply(this, r), {
17
+ return new Promise((n, i) => {
18
+ Promise.resolve(o(() => e.apply(this, r), {
333
19
  fn: e,
334
20
  thisArg: this,
335
21
  args: r
336
- })).then(o).catch(s);
22
+ })).then(n).catch(i);
337
23
  });
338
24
  }
339
25
  return t;
340
26
  }
341
- const qe = (n) => n();
342
- function dt(n = qe, e = {}) {
343
- const { initialState: t = "active" } = e, r = ut(t === "active");
344
- function o() {
27
+ const Re = (o) => o();
28
+ function Ne(o = Re, e = {}) {
29
+ const { initialState: t = "active" } = e, r = Fe(t === "active");
30
+ function n() {
345
31
  r.value = !1;
346
32
  }
347
- function s() {
33
+ function i() {
348
34
  r.value = !0;
349
35
  }
350
- const i = (...a) => {
351
- r.value && n(...a);
36
+ const s = (...a) => {
37
+ r.value && o(...a);
352
38
  };
353
39
  return {
354
- isActive: je(r),
355
- pause: o,
356
- resume: s,
357
- eventFilter: i
40
+ isActive: ye(r),
41
+ pause: n,
42
+ resume: i,
43
+ eventFilter: s
358
44
  };
359
45
  }
360
- function Oe(n) {
361
- return Array.isArray(n) ? n : [n];
46
+ function ce(o) {
47
+ return Array.isArray(o) ? o : [o];
362
48
  }
363
- function pt(n) {
364
- return Fe();
49
+ function Be(o) {
50
+ return Pe();
365
51
  }
366
- function ht(n, e, t = {}) {
367
- const { eventFilter: r = qe, ...o } = t;
368
- return U(n, ft(r, e), o);
52
+ function _e(o, e, t = {}) {
53
+ const { eventFilter: r = Re, ...n } = t;
54
+ return U(o, xe(r, e), n);
369
55
  }
370
- function gt(n, e, t = {}) {
371
- const { eventFilter: r, initialState: o = "active", ...s } = t, { eventFilter: i, pause: a, resume: c, isActive: f } = dt(r, { initialState: o });
56
+ function Ve(o, e, t = {}) {
57
+ const { eventFilter: r, initialState: n = "active", ...i } = t, { eventFilter: s, pause: a, resume: c, isActive: d } = Ne(r, { initialState: n });
372
58
  return {
373
- stop: ht(n, e, {
374
- ...s,
375
- eventFilter: i
59
+ stop: _e(o, e, {
60
+ ...i,
61
+ eventFilter: s
376
62
  }),
377
63
  pause: a,
378
64
  resume: c,
379
- isActive: f
65
+ isActive: d
380
66
  };
381
67
  }
382
- function vt(n, e = !0, t) {
383
- pt() ? Be(n, t) : e ? n() : de(n);
68
+ function We(o, e = !0, t) {
69
+ Be() ? me(o, t) : e ? o() : de(o);
384
70
  }
385
- function yt(n, e, t) {
386
- return U(n, e, {
71
+ function ze(o, e, t) {
72
+ return U(o, e, {
387
73
  ...t,
388
74
  immediate: !0
389
75
  });
390
76
  }
391
- function ie(n, e, t) {
392
- return U(n, (o, s, i) => {
393
- o && e(o, s, i);
77
+ function X(o, e, t) {
78
+ return U(o, (n, i, s) => {
79
+ n && e(n, i, s);
394
80
  }, {
395
81
  ...t,
396
82
  once: !1
397
83
  });
398
84
  }
399
- const Q = at ? window : void 0;
400
- function mt(n) {
85
+ const j = ke ? window : void 0;
86
+ function He(o) {
401
87
  var e;
402
- const t = q(n);
88
+ const t = H(o);
403
89
  return (e = t?.$el) !== null && e !== void 0 ? e : t;
404
90
  }
405
- function re(...n) {
406
- const e = (r, o, s, i) => (r.addEventListener(o, s, i), () => r.removeEventListener(o, s, i)), t = W(() => {
407
- const r = Oe(q(n[0])).filter((o) => o != null);
408
- return r.every((o) => typeof o != "string") ? r : void 0;
91
+ function Q(...o) {
92
+ const e = (r, n, i, s) => (r.addEventListener(n, i, s), () => r.removeEventListener(n, i, s)), t = B(() => {
93
+ const r = ce(H(o[0])).filter((n) => n != null);
94
+ return r.every((n) => typeof n != "string") ? r : void 0;
409
95
  });
410
- return yt(() => {
411
- var r, o;
96
+ return ze(() => {
97
+ var r, n;
412
98
  return [
413
- (r = (o = t.value) === null || o === void 0 ? void 0 : o.map((s) => mt(s))) !== null && r !== void 0 ? r : [Q].filter((s) => s != null),
414
- Oe(q(t.value ? n[1] : n[0])),
415
- Oe(rt(t.value ? n[2] : n[1])),
416
- q(t.value ? n[3] : n[2])
99
+ (r = (n = t.value) === null || n === void 0 ? void 0 : n.map((i) => He(i))) !== null && r !== void 0 ? r : [j].filter((i) => i != null),
100
+ ce(H(t.value ? o[1] : o[0])),
101
+ ce(Ce(t.value ? o[2] : o[1])),
102
+ H(t.value ? o[3] : o[2])
417
103
  ];
418
- }, ([r, o, s, i], a, c) => {
419
- if (!r?.length || !o?.length || !s?.length) return;
420
- const f = lt(i) ? { ...i } : i, g = r.flatMap((b) => o.flatMap((A) => s.map(($) => e(b, A, $, f))));
104
+ }, ([r, n, i, s], a, c) => {
105
+ if (!r?.length || !n?.length || !i?.length) return;
106
+ const d = Me(s) ? { ...s } : s, g = r.flatMap((S) => n.flatMap(($) => i.map((k) => e(S, $, k, d))));
421
107
  c(() => {
422
- g.forEach((b) => b());
108
+ g.forEach((S) => S());
423
109
  });
424
110
  }, { flush: "post" });
425
111
  }
426
- const he = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, ge = "__vueuse_ssr_handlers__", St = /* @__PURE__ */ bt();
427
- function bt() {
428
- return ge in he || (he[ge] = he[ge] || {}), he[ge];
112
+ const ne = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, oe = "__vueuse_ssr_handlers__", Ue = /* @__PURE__ */ Je();
113
+ function Je() {
114
+ return oe in ne || (ne[oe] = ne[oe] || {}), ne[oe];
429
115
  }
430
- function wt(n, e) {
431
- return St[n] || e;
116
+ function qe(o, e) {
117
+ return Ue[o] || e;
432
118
  }
433
- function Et(n) {
434
- return n == null ? "any" : n instanceof Set ? "set" : n instanceof Map ? "map" : n instanceof Date ? "date" : typeof n == "boolean" ? "boolean" : typeof n == "string" ? "string" : typeof n == "object" ? "object" : Number.isNaN(n) ? "any" : "number";
119
+ function Ke(o) {
120
+ 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";
435
121
  }
436
- const Ot = {
122
+ const je = {
437
123
  boolean: {
438
- read: (n) => n === "true",
439
- write: (n) => String(n)
124
+ read: (o) => o === "true",
125
+ write: (o) => String(o)
440
126
  },
441
127
  object: {
442
- read: (n) => JSON.parse(n),
443
- write: (n) => JSON.stringify(n)
128
+ read: (o) => JSON.parse(o),
129
+ write: (o) => JSON.stringify(o)
444
130
  },
445
131
  number: {
446
- read: (n) => Number.parseFloat(n),
447
- write: (n) => String(n)
132
+ read: (o) => Number.parseFloat(o),
133
+ write: (o) => String(o)
448
134
  },
449
135
  any: {
450
- read: (n) => n,
451
- write: (n) => String(n)
136
+ read: (o) => o,
137
+ write: (o) => String(o)
452
138
  },
453
139
  string: {
454
- read: (n) => n,
455
- write: (n) => String(n)
140
+ read: (o) => o,
141
+ write: (o) => String(o)
456
142
  },
457
143
  map: {
458
- read: (n) => new Map(JSON.parse(n)),
459
- write: (n) => JSON.stringify(Array.from(n.entries()))
144
+ read: (o) => new Map(JSON.parse(o)),
145
+ write: (o) => JSON.stringify(Array.from(o.entries()))
460
146
  },
461
147
  set: {
462
- read: (n) => new Set(JSON.parse(n)),
463
- write: (n) => JSON.stringify(Array.from(n))
148
+ read: (o) => new Set(JSON.parse(o)),
149
+ write: (o) => JSON.stringify(Array.from(o))
464
150
  },
465
151
  date: {
466
- read: (n) => new Date(n),
467
- write: (n) => n.toISOString()
468
- }
469
- }, Le = "vueuse-storage";
470
- function Rt(n, e, t, r = {}) {
471
- var o;
472
- const { flush: s = "pre", deep: i = !0, listenToStorageChanges: a = !0, writeDefaults: c = !0, mergeDefaults: f = !1, shallow: g, window: b = Q, eventFilter: A, onError: $ = (w) => {
473
- console.error(w);
474
- }, initOnMounted: k } = r, x = (g ? We : B)(e), N = W(() => q(n));
152
+ read: (o) => new Date(o),
153
+ write: (o) => o.toISOString()
154
+ }
155
+ }, he = "vueuse-storage";
156
+ function Ge(o, e, t, r = {}) {
157
+ var n;
158
+ const { flush: i = "pre", deep: s = !0, listenToStorageChanges: a = !0, writeDefaults: c = !0, mergeDefaults: d = !1, shallow: g, window: S = j, eventFilter: $, onError: k = (v) => {
159
+ console.error(v);
160
+ }, initOnMounted: x } = r, F = (g ? Se : L)(e), R = B(() => H(o));
475
161
  if (!t) try {
476
- t = wt("getDefaultStorage", () => Q?.localStorage)();
477
- } catch (w) {
478
- $(w);
479
- }
480
- if (!t) return x;
481
- const D = q(e), P = Et(D), S = (o = r.serializer) !== null && o !== void 0 ? o : Ot[P], { pause: C, resume: O } = gt(x, (w) => d(w), {
482
- flush: s,
483
- deep: i,
484
- eventFilter: A
162
+ t = qe("getDefaultStorage", () => j?.localStorage)();
163
+ } catch (v) {
164
+ k(v);
165
+ }
166
+ if (!t) return F;
167
+ const O = H(e), w = Ke(O), h = (n = r.serializer) !== null && n !== void 0 ? n : je[w], { pause: E, resume: b } = Ve(F, (v) => N(v), {
168
+ flush: i,
169
+ deep: s,
170
+ eventFilter: $
485
171
  });
486
- U(N, () => R(), { flush: s });
487
- let _ = !1;
488
- const v = (w) => {
489
- k && !_ || R(w);
490
- }, j = (w) => {
491
- k && !_ || F(w);
172
+ U(R, () => _(), { flush: i });
173
+ let A = !1;
174
+ const C = (v) => {
175
+ x && !A || _(v);
176
+ }, M = (v) => {
177
+ x && !A || G(v);
492
178
  };
493
- b && a && (t instanceof Storage ? re(b, "storage", v, { passive: !0 }) : re(b, Le, j)), k ? vt(() => {
494
- _ = !0, R();
495
- }) : R();
496
- function M(w, T) {
497
- if (b) {
498
- const L = {
499
- key: N.value,
500
- oldValue: w,
501
- newValue: T,
179
+ S && a && (t instanceof Storage ? Q(S, "storage", C, { passive: !0 }) : Q(S, he, M)), x ? We(() => {
180
+ A = !0, _();
181
+ }) : _();
182
+ function W(v, P) {
183
+ if (S) {
184
+ const D = {
185
+ key: R.value,
186
+ oldValue: v,
187
+ newValue: P,
502
188
  storageArea: t
503
189
  };
504
- b.dispatchEvent(t instanceof Storage ? new StorageEvent("storage", L) : new CustomEvent(Le, { detail: L }));
190
+ S.dispatchEvent(t instanceof Storage ? new StorageEvent("storage", D) : new CustomEvent(he, { detail: D }));
505
191
  }
506
192
  }
507
- function d(w) {
193
+ function N(v) {
508
194
  try {
509
- const T = t.getItem(N.value);
510
- if (w == null)
511
- M(T, null), t.removeItem(N.value);
195
+ const P = t.getItem(R.value);
196
+ if (v == null)
197
+ W(P, null), t.removeItem(R.value);
512
198
  else {
513
- const L = S.write(w);
514
- T !== L && (t.setItem(N.value, L), M(T, L));
199
+ const D = h.write(v);
200
+ P !== D && (t.setItem(R.value, D), W(P, D));
515
201
  }
516
- } catch (T) {
517
- $(T);
202
+ } catch (P) {
203
+ k(P);
518
204
  }
519
205
  }
520
- function p(w) {
521
- const T = w ? w.newValue : t.getItem(N.value);
522
- if (T == null)
523
- return c && D != null && t.setItem(N.value, S.write(D)), D;
524
- if (!w && f) {
525
- const L = S.read(T);
526
- return typeof f == "function" ? f(L, D) : P === "object" && !Array.isArray(L) ? {
527
- ...D,
528
- ...L
529
- } : L;
530
- } else return typeof T != "string" ? T : S.read(T);
531
- }
532
- function R(w) {
533
- if (!(w && w.storageArea !== t)) {
534
- if (w && w.key == null) {
535
- x.value = D;
206
+ function q(v) {
207
+ const P = v ? v.newValue : t.getItem(R.value);
208
+ if (P == null)
209
+ return c && O != null && t.setItem(R.value, h.write(O)), O;
210
+ if (!v && d) {
211
+ const D = h.read(P);
212
+ return typeof d == "function" ? d(D, O) : w === "object" && !Array.isArray(D) ? {
213
+ ...O,
214
+ ...D
215
+ } : D;
216
+ } else return typeof P != "string" ? P : h.read(P);
217
+ }
218
+ function _(v) {
219
+ if (!(v && v.storageArea !== t)) {
220
+ if (v && v.key == null) {
221
+ F.value = O;
536
222
  return;
537
223
  }
538
- if (!(w && w.key !== N.value)) {
539
- C();
224
+ if (!(v && v.key !== R.value)) {
225
+ E();
540
226
  try {
541
- const T = S.write(x.value);
542
- (w === void 0 || w?.newValue !== T) && (x.value = p(w));
543
- } catch (T) {
544
- $(T);
227
+ const P = h.write(F.value);
228
+ (v === void 0 || v?.newValue !== P) && (F.value = q(v));
229
+ } catch (P) {
230
+ k(P);
545
231
  } finally {
546
- w ? de(O) : O();
232
+ v ? de(b) : b();
547
233
  }
548
234
  }
549
235
  }
550
236
  }
551
- function F(w) {
552
- R(w.detail);
237
+ function G(v) {
238
+ _(v.detail);
553
239
  }
554
- return x;
240
+ return F;
555
241
  }
556
- function At(n, e, t = {}) {
557
- const { window: r = Q } = t;
558
- return Rt(n, e, r?.localStorage, t);
242
+ function Ze(o, e, t = {}) {
243
+ const { window: r = j } = t;
244
+ return Ge(o, e, r?.localStorage, t);
559
245
  }
560
- const Pt = {
246
+ const Qe = {
561
247
  ctrl: "control",
562
248
  command: "meta",
563
249
  cmd: "meta",
@@ -567,143 +253,143 @@ const Pt = {
567
253
  left: "arrowleft",
568
254
  right: "arrowright"
569
255
  };
570
- function Nt(n = {}) {
571
- const { reactive: e = !1, target: t = Q, aliasMap: r = Pt, passive: o = !0, onEventFired: s = Je } = n, i = ye(/* @__PURE__ */ new Set()), a = {
256
+ function Ye(o = {}) {
257
+ const { reactive: e = !1, target: t = j, aliasMap: r = Qe, passive: n = !0, onEventFired: i = we } = o, s = ue(/* @__PURE__ */ new Set()), a = {
572
258
  toJSON() {
573
259
  return {};
574
260
  },
575
- current: i
576
- }, c = e ? ye(a) : a, f = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Map([
577
- ["Meta", f],
261
+ current: s
262
+ }, c = e ? ue(a) : a, d = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Map([
263
+ ["Meta", d],
578
264
  ["Shift", /* @__PURE__ */ new Set()],
579
265
  ["Alt", /* @__PURE__ */ new Set()]
580
- ]), b = /* @__PURE__ */ new Set();
581
- function A(P, S) {
582
- P in c && (e ? c[P] = S : c[P].value = S);
266
+ ]), S = /* @__PURE__ */ new Set();
267
+ function $(w, h) {
268
+ w in c && (e ? c[w] = h : c[w].value = h);
583
269
  }
584
- function $() {
585
- i.clear();
586
- for (const P of b) A(P, !1);
270
+ function k() {
271
+ s.clear();
272
+ for (const w of S) $(w, !1);
587
273
  }
588
- function k(P, S, C) {
589
- if (!(!P || typeof S.getModifierState != "function")) {
590
- for (const [O, _] of g) if (S.getModifierState(O)) {
591
- C.forEach((v) => _.add(v));
274
+ function x(w, h, E) {
275
+ if (!(!w || typeof h.getModifierState != "function")) {
276
+ for (const [b, A] of g) if (h.getModifierState(b)) {
277
+ E.forEach((C) => A.add(C));
592
278
  break;
593
279
  }
594
280
  }
595
281
  }
596
- function x(P, S) {
597
- if (P) return;
598
- const C = `${S[0].toUpperCase()}${S.slice(1)}`, O = g.get(C);
599
- if (!["shift", "alt"].includes(S) || !O) return;
600
- const _ = Array.from(O), v = _.indexOf(S);
601
- _.forEach((j, M) => {
602
- M >= v && (i.delete(j), A(j, !1));
603
- }), O.clear();
604
- }
605
- function N(P, S) {
606
- var C, O;
607
- const _ = (C = P.key) === null || C === void 0 ? void 0 : C.toLowerCase(), v = [(O = P.code) === null || O === void 0 ? void 0 : O.toLowerCase(), _].filter(Boolean);
608
- if (_) {
609
- _ && (S ? i.add(_) : i.delete(_));
610
- for (const j of v)
611
- b.add(j), A(j, S);
612
- k(S, P, [...i, ...v]), x(S, _), _ === "meta" && !S && (f.forEach((j) => {
613
- i.delete(j), A(j, !1);
614
- }), f.clear());
282
+ function F(w, h) {
283
+ if (w) return;
284
+ const E = `${h[0].toUpperCase()}${h.slice(1)}`, b = g.get(E);
285
+ if (!["shift", "alt"].includes(h) || !b) return;
286
+ const A = Array.from(b), C = A.indexOf(h);
287
+ A.forEach((M, W) => {
288
+ W >= C && (s.delete(M), $(M, !1));
289
+ }), b.clear();
290
+ }
291
+ function R(w, h) {
292
+ var E, b;
293
+ const A = (E = w.key) === null || E === void 0 ? void 0 : E.toLowerCase(), C = [(b = w.code) === null || b === void 0 ? void 0 : b.toLowerCase(), A].filter(Boolean);
294
+ if (A) {
295
+ A && (h ? s.add(A) : s.delete(A));
296
+ for (const M of C)
297
+ S.add(M), $(M, h);
298
+ x(h, w, [...s, ...C]), F(h, A), A === "meta" && !h && (d.forEach((M) => {
299
+ s.delete(M), $(M, !1);
300
+ }), d.clear());
615
301
  }
616
302
  }
617
- re(t, "keydown", (P) => (N(P, !0), s(P)), { passive: o }), re(t, "keyup", (P) => (N(P, !1), s(P)), { passive: o }), re("blur", $, { passive: o }), re("focus", $, { passive: o });
618
- const D = new Proxy(c, { get(P, S, C) {
619
- if (typeof S != "string") return Reflect.get(P, S, C);
620
- if (S = S.toLowerCase(), S in r && (S = r[S]), !(S in c)) if (/[+_-]/.test(S)) {
621
- const _ = S.split(/[+_-]/g).map((v) => v.trim());
622
- c[S] = W(() => _.map((v) => q(D[v])).every(Boolean));
623
- } else c[S] = We(!1);
624
- const O = Reflect.get(P, S, C);
625
- return e ? q(O) : O;
303
+ Q(t, "keydown", (w) => (R(w, !0), i(w)), { passive: n }), Q(t, "keyup", (w) => (R(w, !1), i(w)), { passive: n }), Q("blur", k, { passive: n }), Q("focus", k, { passive: n });
304
+ const O = new Proxy(c, { get(w, h, E) {
305
+ if (typeof h != "string") return Reflect.get(w, h, E);
306
+ if (h = h.toLowerCase(), h in r && (h = r[h]), !(h in c)) if (/[+_-]/.test(h)) {
307
+ const A = h.split(/[+_-]/g).map((C) => C.trim());
308
+ c[h] = B(() => A.map((C) => H(O[C])).every(Boolean));
309
+ } else c[h] = Se(!1);
310
+ const b = Reflect.get(w, h, E);
311
+ return e ? H(b) : b;
626
312
  } });
627
- return D;
313
+ return O;
628
314
  }
629
- function Re() {
315
+ function le() {
630
316
  return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
631
317
  }
632
- function ve(n) {
318
+ function ie(o) {
633
319
  const e = {
634
- type: n.type,
635
- clientId: n.clientId,
636
- timestamp: n.timestamp.toISOString()
320
+ type: o.type,
321
+ clientId: o.clientId,
322
+ timestamp: o.timestamp.toISOString()
637
323
  };
638
- return n.operation && (e.operation = {
639
- ...n.operation,
640
- timestamp: n.operation.timestamp.toISOString()
641
- }), n.operations && (e.operations = n.operations.map((t) => ({
324
+ return o.operation && (e.operation = {
325
+ ...o.operation,
326
+ timestamp: o.operation.timestamp.toISOString()
327
+ }), o.operations && (e.operations = o.operations.map((t) => ({
642
328
  ...t,
643
329
  timestamp: t.timestamp.toISOString()
644
330
  }))), e;
645
331
  }
646
- function _t(n) {
332
+ function Xe(o) {
647
333
  const e = {
648
- type: n.type,
649
- clientId: n.clientId,
650
- timestamp: new Date(n.timestamp)
334
+ type: o.type,
335
+ clientId: o.clientId,
336
+ timestamp: new Date(o.timestamp)
651
337
  };
652
- return n.operation && (e.operation = {
653
- ...n.operation,
654
- timestamp: new Date(n.operation.timestamp)
655
- }), n.operations && (e.operations = n.operations.map((t) => ({
338
+ return o.operation && (e.operation = {
339
+ ...o.operation,
340
+ timestamp: new Date(o.operation.timestamp)
341
+ }), o.operations && (e.operations = o.operations.map((t) => ({
656
342
  ...t,
657
343
  timestamp: new Date(t.timestamp)
658
344
  }))), e;
659
345
  }
660
- const pe = /* @__PURE__ */ it("hst-operation-log", () => {
661
- const n = B({
346
+ const re = De("hst-operation-log", () => {
347
+ const o = L({
662
348
  maxOperations: 100,
663
349
  enableCrossTabSync: !0,
664
350
  autoSyncInterval: 3e4,
665
351
  enablePersistence: !1,
666
352
  persistenceKeyPrefix: "stonecrop-ops"
667
- }), e = B([]), t = B(-1), r = B(Re()), o = B(!1), s = B([]), i = B(null), a = W(() => t.value < 0 ? !1 : e.value[t.value]?.reversible ?? !1), c = W(() => t.value < e.value.length - 1), f = W(() => {
353
+ }), e = L([]), t = L(-1), r = L(le()), n = L(!1), i = L([]), s = L(null), a = B(() => t.value < 0 ? !1 : e.value[t.value]?.reversible ?? !1), c = B(() => t.value < e.value.length - 1), d = B(() => {
668
354
  let u = 0;
669
355
  for (let l = t.value; l >= 0 && e.value[l]?.reversible; l--)
670
356
  u++;
671
357
  return u;
672
- }), g = W(() => e.value.length - 1 - t.value), b = W(() => ({
358
+ }), g = B(() => e.value.length - 1 - t.value), S = B(() => ({
673
359
  canUndo: a.value,
674
360
  canRedo: c.value,
675
- undoCount: f.value,
361
+ undoCount: d.value,
676
362
  redoCount: g.value,
677
363
  currentIndex: t.value
678
364
  }));
679
- function A(u) {
680
- n.value = { ...n.value, ...u }, n.value.enablePersistence && (y(), m()), n.value.enableCrossTabSync && p();
365
+ function $(u) {
366
+ o.value = { ...o.value, ...u }, o.value.enablePersistence && (p(), y()), o.value.enableCrossTabSync && q();
681
367
  }
682
- function $(u, l = "user") {
683
- const h = {
368
+ function k(u, l = "user") {
369
+ const f = {
684
370
  ...u,
685
- id: Re(),
371
+ id: le(),
686
372
  timestamp: /* @__PURE__ */ new Date(),
687
373
  source: l,
688
- userId: n.value.userId
374
+ userId: o.value.userId
689
375
  };
690
- if (n.value.operationFilter && !n.value.operationFilter(h))
691
- return h.id;
692
- if (o.value)
693
- return s.value.push(h), h.id;
694
- if (t.value < e.value.length - 1 && (e.value = e.value.slice(0, t.value + 1)), e.value.push(h), t.value++, n.value.maxOperations && e.value.length > n.value.maxOperations) {
695
- const I = e.value.length - n.value.maxOperations;
696
- e.value = e.value.slice(I), t.value -= I;
376
+ if (o.value.operationFilter && !o.value.operationFilter(f))
377
+ return f.id;
378
+ if (n.value)
379
+ return i.value.push(f), f.id;
380
+ if (t.value < e.value.length - 1 && (e.value = e.value.slice(0, t.value + 1)), e.value.push(f), t.value++, o.value.maxOperations && e.value.length > o.value.maxOperations) {
381
+ const T = e.value.length - o.value.maxOperations;
382
+ e.value = e.value.slice(T), t.value -= T;
697
383
  }
698
- return n.value.enableCrossTabSync && R(h), h.id;
384
+ return o.value.enableCrossTabSync && _(f), f.id;
699
385
  }
700
- function k() {
701
- o.value = !0, s.value = [], i.value = Re();
386
+ function x() {
387
+ n.value = !0, i.value = [], s.value = le();
702
388
  }
703
- function x(u) {
704
- if (!o.value || s.value.length === 0)
705
- return o.value = !1, s.value = [], i.value = null, null;
706
- const l = i.value, h = s.value.every((V) => V.reversible), I = {
389
+ function F(u) {
390
+ if (!n.value || i.value.length === 0)
391
+ return n.value = !1, i.value = [], s.value = null, null;
392
+ const l = s.value, f = i.value.every((I) => I.reversible), T = {
707
393
  id: l,
708
394
  type: "batch",
709
395
  path: "",
@@ -711,153 +397,153 @@ const pe = /* @__PURE__ */ it("hst-operation-log", () => {
711
397
  fieldname: "",
712
398
  beforeValue: null,
713
399
  afterValue: null,
714
- doctype: s.value[0]?.doctype || "",
400
+ doctype: i.value[0]?.doctype || "",
715
401
  timestamp: /* @__PURE__ */ new Date(),
716
402
  source: "user",
717
- reversible: h,
718
- irreversibleReason: h ? void 0 : "Contains irreversible operations",
719
- childOperationIds: s.value.map((V) => V.id),
403
+ reversible: f,
404
+ irreversibleReason: f ? void 0 : "Contains irreversible operations",
405
+ childOperationIds: i.value.map((I) => I.id),
720
406
  metadata: { description: u }
721
407
  };
722
- s.value.forEach((V) => {
723
- V.parentOperationId = l;
724
- }), e.value.push(...s.value, I), t.value = e.value.length - 1, n.value.enableCrossTabSync && F(s.value, I);
725
- const H = l;
726
- return o.value = !1, s.value = [], i.value = null, H;
408
+ i.value.forEach((I) => {
409
+ I.parentOperationId = l;
410
+ }), e.value.push(...i.value, T), t.value = e.value.length - 1, o.value.enableCrossTabSync && G(i.value, T);
411
+ const V = l;
412
+ return n.value = !1, i.value = [], s.value = null, V;
727
413
  }
728
- function N() {
729
- o.value = !1, s.value = [], i.value = null;
414
+ function R() {
415
+ n.value = !1, i.value = [], s.value = null;
730
416
  }
731
- function D(u) {
417
+ function O(u) {
732
418
  if (!a.value) return !1;
733
419
  const l = e.value[t.value];
734
420
  if (!l.reversible)
735
421
  return typeof console < "u" && l.irreversibleReason && console.warn("Cannot undo irreversible operation:", l.irreversibleReason), !1;
736
422
  try {
737
423
  if (l.type === "batch" && l.childOperationIds)
738
- for (let h = l.childOperationIds.length - 1; h >= 0; h--) {
739
- const I = l.childOperationIds[h], H = e.value.find((V) => V.id === I);
740
- H && S(H, u);
424
+ for (let f = l.childOperationIds.length - 1; f >= 0; f--) {
425
+ const T = l.childOperationIds[f], V = e.value.find((I) => I.id === T);
426
+ V && h(V, u);
741
427
  }
742
428
  else
743
- S(l, u);
744
- return t.value--, n.value.enableCrossTabSync && w(l), !0;
745
- } catch (h) {
746
- return typeof console < "u" && console.error("Undo failed:", h), !1;
429
+ h(l, u);
430
+ return t.value--, o.value.enableCrossTabSync && v(l), !0;
431
+ } catch (f) {
432
+ return typeof console < "u" && console.error("Undo failed:", f), !1;
747
433
  }
748
434
  }
749
- function P(u) {
435
+ function w(u) {
750
436
  if (!c.value) return !1;
751
437
  const l = e.value[t.value + 1];
752
438
  try {
753
439
  if (l.type === "batch" && l.childOperationIds)
754
- for (const h of l.childOperationIds) {
755
- const I = e.value.find((H) => H.id === h);
756
- I && C(I, u);
440
+ for (const f of l.childOperationIds) {
441
+ const T = e.value.find((V) => V.id === f);
442
+ T && E(T, u);
757
443
  }
758
444
  else
759
- C(l, u);
760
- return t.value++, n.value.enableCrossTabSync && T(l), !0;
761
- } catch (h) {
762
- return typeof console < "u" && console.error("Redo failed:", h), !1;
445
+ E(l, u);
446
+ return t.value++, o.value.enableCrossTabSync && P(l), !0;
447
+ } catch (f) {
448
+ return typeof console < "u" && console.error("Redo failed:", f), !1;
763
449
  }
764
450
  }
765
- function S(u, l) {
451
+ function h(u, l) {
766
452
  (u.type === "set" || u.type === "delete") && l && typeof l.set == "function" && l.set(u.path, u.beforeValue, "undo");
767
453
  }
768
- function C(u, l) {
454
+ function E(u, l) {
769
455
  (u.type === "set" || u.type === "delete") && l && typeof l.set == "function" && l.set(u.path, u.afterValue, "redo");
770
456
  }
771
- function O() {
772
- const u = e.value.filter((h) => h.reversible).length, l = e.value.map((h) => h.timestamp);
457
+ function b() {
458
+ const u = e.value.filter((f) => f.reversible).length, l = e.value.map((f) => f.timestamp);
773
459
  return {
774
460
  operations: [...e.value],
775
461
  currentIndex: t.value,
776
462
  totalOperations: e.value.length,
777
463
  reversibleOperations: u,
778
464
  irreversibleOperations: e.value.length - u,
779
- oldestOperation: l.length > 0 ? new Date(Math.min(...l.map((h) => h.getTime()))) : void 0,
780
- newestOperation: l.length > 0 ? new Date(Math.max(...l.map((h) => h.getTime()))) : void 0
465
+ oldestOperation: l.length > 0 ? new Date(Math.min(...l.map((f) => f.getTime()))) : void 0,
466
+ newestOperation: l.length > 0 ? new Date(Math.max(...l.map((f) => f.getTime()))) : void 0
781
467
  };
782
468
  }
783
- function _() {
469
+ function A() {
784
470
  e.value = [], t.value = -1;
785
471
  }
786
- function v(u, l) {
787
- return e.value.filter((h) => h.doctype === u && (l === void 0 || h.recordId === l));
472
+ function C(u, l) {
473
+ return e.value.filter((f) => f.doctype === u && (l === void 0 || f.recordId === l));
788
474
  }
789
- function j(u, l) {
790
- const h = e.value.find((I) => I.id === u);
791
- h && (h.reversible = !1, h.irreversibleReason = l);
475
+ function M(u, l) {
476
+ const f = e.value.find((T) => T.id === u);
477
+ f && (f.reversible = !1, f.irreversibleReason = l);
792
478
  }
793
- function M(u, l, h, I = "success", H) {
794
- const V = {
479
+ function W(u, l, f, T = "success", V) {
480
+ const I = {
795
481
  type: "action",
796
- path: h && h.length > 0 ? `${u}.${h[0]}` : u,
482
+ path: f && f.length > 0 ? `${u}.${f[0]}` : u,
797
483
  fieldname: "",
798
484
  beforeValue: null,
799
485
  afterValue: null,
800
486
  doctype: u,
801
- recordId: h && h.length > 0 ? h[0] : void 0,
487
+ recordId: f && f.length > 0 ? f[0] : void 0,
802
488
  reversible: !1,
803
489
  // Actions are typically not reversible
804
490
  actionName: l,
805
- actionRecordIds: h,
806
- actionResult: I,
807
- actionError: H
491
+ actionRecordIds: f,
492
+ actionResult: T,
493
+ actionError: V
808
494
  };
809
- return $(V);
495
+ return k(I);
810
496
  }
811
- let d = null;
812
- function p() {
813
- typeof window > "u" || !window.BroadcastChannel || (d = new BroadcastChannel("stonecrop-operation-log"), d.addEventListener("message", (u) => {
497
+ let N = null;
498
+ function q() {
499
+ typeof window > "u" || !window.BroadcastChannel || (N = new BroadcastChannel("stonecrop-operation-log"), N.addEventListener("message", (u) => {
814
500
  const l = u.data;
815
501
  if (!l || typeof l != "object") return;
816
- const h = _t(l);
817
- h.clientId !== r.value && (h.type === "operation" && h.operation ? (e.value.push({ ...h.operation, source: "sync" }), t.value = e.value.length - 1) : h.type === "operation" && h.operations && (e.value.push(...h.operations.map((I) => ({ ...I, source: "sync" }))), t.value = e.value.length - 1));
502
+ const f = Xe(l);
503
+ f.clientId !== r.value && (f.type === "operation" && f.operation ? (e.value.push({ ...f.operation, source: "sync" }), t.value = e.value.length - 1) : f.type === "operation" && f.operations && (e.value.push(...f.operations.map((T) => ({ ...T, source: "sync" }))), t.value = e.value.length - 1));
818
504
  }));
819
505
  }
820
- function R(u) {
821
- if (!d) return;
506
+ function _(u) {
507
+ if (!N) return;
822
508
  const l = {
823
509
  type: "operation",
824
510
  operation: u,
825
511
  clientId: r.value,
826
512
  timestamp: /* @__PURE__ */ new Date()
827
513
  };
828
- d.postMessage(ve(l));
514
+ N.postMessage(ie(l));
829
515
  }
830
- function F(u, l) {
831
- if (!d) return;
832
- const h = {
516
+ function G(u, l) {
517
+ if (!N) return;
518
+ const f = {
833
519
  type: "operation",
834
520
  operations: [...u, l],
835
521
  clientId: r.value,
836
522
  timestamp: /* @__PURE__ */ new Date()
837
523
  };
838
- d.postMessage(ve(h));
524
+ N.postMessage(ie(f));
839
525
  }
840
- function w(u) {
841
- if (!d) return;
526
+ function v(u) {
527
+ if (!N) return;
842
528
  const l = {
843
529
  type: "undo",
844
530
  operation: u,
845
531
  clientId: r.value,
846
532
  timestamp: /* @__PURE__ */ new Date()
847
533
  };
848
- d.postMessage(ve(l));
534
+ N.postMessage(ie(l));
849
535
  }
850
- function T(u) {
851
- if (!d) return;
536
+ function P(u) {
537
+ if (!N) return;
852
538
  const l = {
853
539
  type: "redo",
854
540
  operation: u,
855
541
  clientId: r.value,
856
542
  timestamp: /* @__PURE__ */ new Date()
857
543
  };
858
- d.postMessage(ve(l));
544
+ N.postMessage(ie(l));
859
545
  }
860
- const L = At("stonecrop-ops-operations", null, {
546
+ const D = Ze("stonecrop-ops-operations", null, {
861
547
  serializer: {
862
548
  read: (u) => {
863
549
  try {
@@ -869,10 +555,10 @@ const pe = /* @__PURE__ */ it("hst-operation-log", () => {
869
555
  write: (u) => u ? JSON.stringify(u) : ""
870
556
  }
871
557
  });
872
- function y() {
558
+ function p() {
873
559
  if (!(typeof window > "u"))
874
560
  try {
875
- const u = L.value;
561
+ const u = D.value;
876
562
  u && Array.isArray(u.operations) && (e.value = u.operations.map((l) => ({
877
563
  ...l,
878
564
  timestamp: new Date(l.timestamp)
@@ -881,10 +567,10 @@ const pe = /* @__PURE__ */ it("hst-operation-log", () => {
881
567
  typeof console < "u" && console.error("Failed to load operations from persistence:", u);
882
568
  }
883
569
  }
884
- function E() {
570
+ function m() {
885
571
  if (!(typeof window > "u"))
886
572
  try {
887
- L.value = {
573
+ D.value = {
888
574
  operations: e.value.map((u) => ({
889
575
  ...u,
890
576
  timestamp: u.timestamp.toISOString()
@@ -895,11 +581,11 @@ const pe = /* @__PURE__ */ it("hst-operation-log", () => {
895
581
  typeof console < "u" && console.error("Failed to save operations to persistence:", u);
896
582
  }
897
583
  }
898
- function m() {
584
+ function y() {
899
585
  U(
900
586
  [e, t],
901
587
  () => {
902
- n.value.enablePersistence && E();
588
+ o.value.enablePersistence && m();
903
589
  },
904
590
  { deep: !0 }
905
591
  );
@@ -908,30 +594,30 @@ const pe = /* @__PURE__ */ it("hst-operation-log", () => {
908
594
  // State
909
595
  operations: e,
910
596
  currentIndex: t,
911
- config: n,
597
+ config: o,
912
598
  clientId: r,
913
- undoRedoState: b,
599
+ undoRedoState: S,
914
600
  // Computed
915
601
  canUndo: a,
916
602
  canRedo: c,
917
- undoCount: f,
603
+ undoCount: d,
918
604
  redoCount: g,
919
605
  // Methods
920
- configure: A,
921
- addOperation: $,
922
- startBatch: k,
923
- commitBatch: x,
924
- cancelBatch: N,
925
- undo: D,
926
- redo: P,
927
- clear: _,
928
- getOperationsFor: v,
929
- getSnapshot: O,
930
- markIrreversible: j,
931
- logAction: M
606
+ configure: $,
607
+ addOperation: k,
608
+ startBatch: x,
609
+ commitBatch: F,
610
+ cancelBatch: R,
611
+ undo: O,
612
+ redo: w,
613
+ clear: A,
614
+ getOperationsFor: C,
615
+ getSnapshot: b,
616
+ markIrreversible: M,
617
+ logAction: W
932
618
  };
933
619
  });
934
- class ue {
620
+ class ee {
935
621
  /**
936
622
  * The root FieldTriggerEngine instance
937
623
  */
@@ -952,9 +638,9 @@ class ue {
952
638
  * @param options - Configuration options for the field trigger engine
953
639
  */
954
640
  constructor(e = {}) {
955
- if (ue._root)
956
- return ue._root;
957
- ue._root = this, this.options = {
641
+ if (ee._root)
642
+ return ee._root;
643
+ ee._root = this, this.options = {
958
644
  defaultTimeout: e.defaultTimeout ?? 5e3,
959
645
  debug: e.debug ?? !1,
960
646
  enableRollback: e.enableRollback ?? !0,
@@ -1000,25 +686,25 @@ class ue {
1000
686
  */
1001
687
  registerDoctypeActions(e, t) {
1002
688
  if (!t) return;
1003
- const r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
689
+ const r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
1004
690
  if (typeof t.entrySeq == "function")
1005
- t.entrySeq().forEach(([s, i]) => {
1006
- this.categorizeAction(s, i, r, o);
691
+ t.entrySeq().forEach(([i, s]) => {
692
+ this.categorizeAction(i, s, r, n);
1007
693
  });
1008
694
  else if (t instanceof Map)
1009
- for (const [s, i] of t)
1010
- this.categorizeAction(s, i, r, o);
1011
- else t && typeof t == "object" && Object.entries(t).forEach(([s, i]) => {
1012
- this.categorizeAction(s, i, r, o);
695
+ for (const [i, s] of t)
696
+ this.categorizeAction(i, s, r, n);
697
+ else t && typeof t == "object" && Object.entries(t).forEach(([i, s]) => {
698
+ this.categorizeAction(i, s, r, n);
1013
699
  });
1014
- this.doctypeActions.set(e, r), this.doctypeTransitions.set(e, o);
700
+ this.doctypeActions.set(e, r), this.doctypeTransitions.set(e, n);
1015
701
  }
1016
702
  /**
1017
703
  * Categorize an action as either a field trigger or XState transition
1018
704
  * Uses uppercase convention: UPPERCASE = transition, lowercase/mixed = field trigger
1019
705
  */
1020
- categorizeAction(e, t, r, o) {
1021
- this.isTransitionKey(e) ? o.set(e, t) : r.set(e, t);
706
+ categorizeAction(e, t, r, n) {
707
+ this.isTransitionKey(e) ? n.set(e, t) : r.set(e, t);
1022
708
  }
1023
709
  /**
1024
710
  * Determine if a key represents an XState transition
@@ -1033,8 +719,8 @@ class ue {
1033
719
  * @param options - Execution options (timeout and enableRollback)
1034
720
  */
1035
721
  async executeFieldTriggers(e, t = {}) {
1036
- const { doctype: r, fieldname: o } = e, s = this.findFieldTriggers(r, o);
1037
- if (s.length === 0)
722
+ const { doctype: r, fieldname: n } = e, i = this.findFieldTriggers(r, n);
723
+ if (i.length === 0)
1038
724
  return {
1039
725
  path: e.path,
1040
726
  actionResults: [],
@@ -1043,49 +729,49 @@ class ue {
1043
729
  stoppedOnError: !1,
1044
730
  rolledBack: !1
1045
731
  };
1046
- const i = performance.now(), a = [];
1047
- let c = !1, f = !1, g;
1048
- const b = this.getFieldRollback(r, o), A = t.enableRollback ?? b ?? this.options.enableRollback;
1049
- A && e.store && (g = this.captureSnapshot(e));
1050
- for (const N of s)
732
+ const s = performance.now(), a = [];
733
+ let c = !1, d = !1, g;
734
+ const S = this.getFieldRollback(r, n), $ = t.enableRollback ?? S ?? this.options.enableRollback;
735
+ $ && e.store && (g = this.captureSnapshot(e));
736
+ for (const R of i)
1051
737
  try {
1052
- const D = await this.executeAction(N, e, t.timeout);
1053
- if (a.push(D), !D.success) {
738
+ const O = await this.executeAction(R, e, t.timeout);
739
+ if (a.push(O), !O.success) {
1054
740
  c = !0;
1055
741
  break;
1056
742
  }
1057
- } catch (D) {
1058
- const S = {
743
+ } catch (O) {
744
+ const h = {
1059
745
  success: !1,
1060
- error: D instanceof Error ? D : new Error(String(D)),
746
+ error: O instanceof Error ? O : new Error(String(O)),
1061
747
  executionTime: 0,
1062
- action: N
748
+ action: R
1063
749
  };
1064
- a.push(S), c = !0;
750
+ a.push(h), c = !0;
1065
751
  break;
1066
752
  }
1067
- if (A && c && g && e.store)
753
+ if ($ && c && g && e.store)
1068
754
  try {
1069
- this.restoreSnapshot(e, g), f = !0;
1070
- } catch (N) {
1071
- console.error("[FieldTriggers] Rollback failed:", N);
755
+ this.restoreSnapshot(e, g), d = !0;
756
+ } catch (R) {
757
+ console.error("[FieldTriggers] Rollback failed:", R);
1072
758
  }
1073
- const $ = performance.now() - i, k = a.filter((N) => !N.success);
1074
- if (k.length > 0 && this.options.errorHandler)
1075
- for (const N of k)
759
+ const k = performance.now() - s, x = a.filter((R) => !R.success);
760
+ if (x.length > 0 && this.options.errorHandler)
761
+ for (const R of x)
1076
762
  try {
1077
- this.options.errorHandler(N.error, e, N.action);
1078
- } catch (D) {
1079
- console.error("[FieldTriggers] Error in global error handler:", D);
763
+ this.options.errorHandler(R.error, e, R.action);
764
+ } catch (O) {
765
+ console.error("[FieldTriggers] Error in global error handler:", O);
1080
766
  }
1081
767
  return {
1082
768
  path: e.path,
1083
769
  actionResults: a,
1084
- totalExecutionTime: $,
1085
- allSucceeded: a.every((N) => N.success),
770
+ totalExecutionTime: k,
771
+ allSucceeded: a.every((R) => R.success),
1086
772
  stoppedOnError: c,
1087
- rolledBack: f,
1088
- snapshot: this.options.debug && A ? g : void 0
773
+ rolledBack: d,
774
+ snapshot: this.options.debug && $ ? g : void 0
1089
775
  // Only include snapshot in debug mode if rollback is enabled
1090
776
  };
1091
777
  }
@@ -1096,35 +782,35 @@ class ue {
1096
782
  * @param options - Execution options (timeout)
1097
783
  */
1098
784
  async executeTransitionActions(e, t = {}) {
1099
- const { doctype: r, transition: o } = e, s = this.findTransitionActions(r, o);
1100
- if (s.length === 0)
785
+ const { doctype: r, transition: n } = e, i = this.findTransitionActions(r, n);
786
+ if (i.length === 0)
1101
787
  return [];
1102
- const i = [];
1103
- for (const c of s)
788
+ const s = [];
789
+ for (const c of i)
1104
790
  try {
1105
- const f = await this.executeTransitionAction(c, e, t.timeout);
1106
- if (i.push(f), !f.success)
791
+ const d = await this.executeTransitionAction(c, e, t.timeout);
792
+ if (s.push(d), !d.success)
1107
793
  break;
1108
- } catch (f) {
1109
- const b = {
794
+ } catch (d) {
795
+ const S = {
1110
796
  success: !1,
1111
- error: f instanceof Error ? f : new Error(String(f)),
797
+ error: d instanceof Error ? d : new Error(String(d)),
1112
798
  executionTime: 0,
1113
799
  action: c,
1114
- transition: o
800
+ transition: n
1115
801
  };
1116
- i.push(b);
802
+ s.push(S);
1117
803
  break;
1118
804
  }
1119
- const a = i.filter((c) => !c.success);
805
+ const a = s.filter((c) => !c.success);
1120
806
  if (a.length > 0 && this.options.errorHandler)
1121
807
  for (const c of a)
1122
808
  try {
1123
809
  this.options.errorHandler(c.error, e, c.action);
1124
- } catch (f) {
1125
- console.error("[FieldTriggers] Error in global error handler:", f);
810
+ } catch (d) {
811
+ console.error("[FieldTriggers] Error in global error handler:", d);
1126
812
  }
1127
- return i;
813
+ return s;
1128
814
  }
1129
815
  /**
1130
816
  * Find transition actions for a specific doctype and transition
@@ -1137,26 +823,26 @@ class ue {
1137
823
  * Execute a single transition action by name
1138
824
  */
1139
825
  async executeTransitionAction(e, t, r) {
1140
- const o = performance.now(), s = r ?? this.options.defaultTimeout;
826
+ const n = performance.now(), i = r ?? this.options.defaultTimeout;
1141
827
  try {
1142
- let i = this.globalTransitionActions.get(e);
1143
- if (!i) {
828
+ let s = this.globalTransitionActions.get(e);
829
+ if (!s) {
1144
830
  const c = this.globalActions.get(e);
1145
- c && (i = c);
831
+ c && (s = c);
1146
832
  }
1147
- if (!i)
833
+ if (!s)
1148
834
  throw new Error(`Transition action "${e}" not found in registry`);
1149
- return await this.executeWithTimeout(i, t, s), {
835
+ return await this.executeWithTimeout(s, t, i), {
1150
836
  success: !0,
1151
- executionTime: performance.now() - o,
837
+ executionTime: performance.now() - n,
1152
838
  action: e,
1153
839
  transition: t.transition
1154
840
  };
1155
- } catch (i) {
1156
- const a = performance.now() - o;
841
+ } catch (s) {
842
+ const a = performance.now() - n;
1157
843
  return {
1158
844
  success: !1,
1159
- error: i instanceof Error ? i : new Error(String(i)),
845
+ error: s instanceof Error ? s : new Error(String(s)),
1160
846
  executionTime: a,
1161
847
  action: e,
1162
848
  transition: t.transition
@@ -1170,10 +856,10 @@ class ue {
1170
856
  findFieldTriggers(e, t) {
1171
857
  const r = this.doctypeActions.get(e);
1172
858
  if (!r) return [];
1173
- const o = [];
1174
- for (const [s, i] of r)
1175
- this.isFieldTriggerKey(s, t) && o.push(...i);
1176
- return o;
859
+ const n = [];
860
+ for (const [i, s] of r)
861
+ this.isFieldTriggerKey(i, t) && n.push(...s);
862
+ return n;
1177
863
  }
1178
864
  /**
1179
865
  * Determine if an action key represents a field trigger
@@ -1190,12 +876,12 @@ class ue {
1190
876
  * Supports wildcards (*) for dynamic segments
1191
877
  */
1192
878
  matchFieldPattern(e, t) {
1193
- const r = e.split("."), o = t.split(".");
1194
- if (r.length !== o.length)
879
+ const r = e.split("."), n = t.split(".");
880
+ if (r.length !== n.length)
1195
881
  return !1;
1196
- for (let s = 0; s < r.length; s++) {
1197
- const i = r[s], a = o[s];
1198
- if (i !== "*" && i !== a)
882
+ for (let i = 0; i < r.length; i++) {
883
+ const s = r[i], a = n[i];
884
+ if (s !== "*" && s !== a)
1199
885
  return !1;
1200
886
  }
1201
887
  return !0;
@@ -1204,21 +890,21 @@ class ue {
1204
890
  * Execute a single action by name
1205
891
  */
1206
892
  async executeAction(e, t, r) {
1207
- const o = performance.now(), s = r ?? this.options.defaultTimeout;
893
+ const n = performance.now(), i = r ?? this.options.defaultTimeout;
1208
894
  try {
1209
- const i = this.globalActions.get(e);
1210
- if (!i)
895
+ const s = this.globalActions.get(e);
896
+ if (!s)
1211
897
  throw new Error(`Action "${e}" not found in registry`);
1212
- return await this.executeWithTimeout(i, t, s), {
898
+ return await this.executeWithTimeout(s, t, i), {
1213
899
  success: !0,
1214
- executionTime: performance.now() - o,
900
+ executionTime: performance.now() - n,
1215
901
  action: e
1216
902
  };
1217
- } catch (i) {
1218
- const a = performance.now() - o;
903
+ } catch (s) {
904
+ const a = performance.now() - n;
1219
905
  return {
1220
906
  success: !1,
1221
- error: i instanceof Error ? i : new Error(String(i)),
907
+ error: s instanceof Error ? s : new Error(String(s)),
1222
908
  executionTime: a,
1223
909
  action: e
1224
910
  };
@@ -1228,14 +914,14 @@ class ue {
1228
914
  * Execute a function with timeout
1229
915
  */
1230
916
  async executeWithTimeout(e, t, r) {
1231
- return new Promise((o, s) => {
1232
- const i = setTimeout(() => {
1233
- s(new Error(`Action timeout after ${r}ms`));
917
+ return new Promise((n, i) => {
918
+ const s = setTimeout(() => {
919
+ i(new Error(`Action timeout after ${r}ms`));
1234
920
  }, r);
1235
921
  Promise.resolve(e(t)).then((a) => {
1236
- clearTimeout(i), o(a);
922
+ clearTimeout(s), n(a);
1237
923
  }).catch((a) => {
1238
- clearTimeout(i), s(a);
924
+ clearTimeout(s), i(a);
1239
925
  });
1240
926
  });
1241
927
  }
@@ -1267,26 +953,26 @@ class ue {
1267
953
  }
1268
954
  }
1269
955
  }
1270
- function K(n) {
1271
- return new ue(n);
956
+ function J(o) {
957
+ return new ee(o);
1272
958
  }
1273
- function Vt(n, e) {
1274
- K().registerAction(n, e);
959
+ function ct(o, e) {
960
+ J().registerAction(o, e);
1275
961
  }
1276
- function xt(n, e) {
1277
- K().registerTransitionAction(n, e);
962
+ function lt(o, e) {
963
+ J().registerTransitionAction(o, e);
1278
964
  }
1279
- function Mt(n, e, t) {
1280
- K().setFieldRollback(n, e, t);
965
+ function ut(o, e, t) {
966
+ J().setFieldRollback(o, e, t);
1281
967
  }
1282
- async function Ft(n, e, t) {
1283
- const r = K(), o = {
1284
- path: t?.path || (t?.recordId ? `${n}.${t.recordId}` : n),
968
+ async function ft(o, e, t) {
969
+ const r = J(), n = {
970
+ path: t?.path || (t?.recordId ? `${o}.${t.recordId}` : o),
1285
971
  fieldname: "",
1286
972
  beforeValue: void 0,
1287
973
  afterValue: void 0,
1288
974
  operation: "set",
1289
- doctype: n,
975
+ doctype: o,
1290
976
  recordId: t?.recordId,
1291
977
  timestamp: /* @__PURE__ */ new Date(),
1292
978
  transition: e,
@@ -1294,30 +980,30 @@ async function Ft(n, e, t) {
1294
980
  targetState: t?.targetState,
1295
981
  fsmContext: t?.fsmContext
1296
982
  };
1297
- return await r.executeTransitionActions(o);
983
+ return await r.executeTransitionActions(n);
1298
984
  }
1299
- function Bt(n, e) {
1300
- if (n)
985
+ function dt(o, e) {
986
+ if (o)
1301
987
  try {
1302
- pe().markIrreversible(n, e);
988
+ re().markIrreversible(o, e);
1303
989
  } catch {
1304
990
  }
1305
991
  }
1306
- function Ve() {
992
+ function ge() {
1307
993
  try {
1308
- return pe();
994
+ return re();
1309
995
  } catch {
1310
996
  return null;
1311
997
  }
1312
998
  }
1313
- class ne {
999
+ class Y {
1314
1000
  static instance;
1315
1001
  /**
1316
1002
  * Gets the singleton instance of HST
1317
1003
  * @returns The HST singleton instance
1318
1004
  */
1319
1005
  static getInstance() {
1320
- return ne.instance || (ne.instance = new ne()), ne.instance;
1006
+ return Y.instance || (Y.instance = new Y()), Y.instance;
1321
1007
  }
1322
1008
  /**
1323
1009
  * Gets the global registry instance
@@ -1351,23 +1037,23 @@ class ne {
1351
1037
  return t.registry[e];
1352
1038
  }
1353
1039
  }
1354
- class Se {
1040
+ class se {
1355
1041
  target;
1356
1042
  parentPath;
1357
1043
  rootNode;
1358
1044
  doctype;
1359
1045
  parentDoctype;
1360
1046
  hst;
1361
- constructor(e, t, r = "", o = null, s) {
1362
- return this.target = e, this.parentPath = r, this.rootNode = o || this, this.doctype = t, this.parentDoctype = s, this.hst = ne.getInstance(), new Proxy(this, {
1363
- get(i, a) {
1364
- if (a in i) return i[a];
1047
+ constructor(e, t, r = "", n = null, i) {
1048
+ return this.target = e, this.parentPath = r, this.rootNode = n || this, this.doctype = t, this.parentDoctype = i, this.hst = Y.getInstance(), new Proxy(this, {
1049
+ get(s, a) {
1050
+ if (a in s) return s[a];
1365
1051
  const c = String(a);
1366
- return i.getNode(c);
1052
+ return s.getNode(c);
1367
1053
  },
1368
- set(i, a, c) {
1369
- const f = String(a);
1370
- return i.set(f, c), !0;
1054
+ set(s, a, c) {
1055
+ const d = String(a);
1056
+ return s.set(d, c), !0;
1371
1057
  }
1372
1058
  });
1373
1059
  }
@@ -1376,25 +1062,25 @@ class Se {
1376
1062
  }
1377
1063
  // Method to get a tree-wrapped node for navigation
1378
1064
  getNode(e) {
1379
- const t = this.resolvePath(e), r = this.resolveValue(e), o = t.split(".");
1380
- let s = this.doctype;
1381
- return this.doctype === "StonecropStore" && o.length >= 1 && (s = o[0]), typeof r == "object" && r !== null && !this.isPrimitive(r) ? new Se(r, s, t, this.rootNode, this.parentDoctype) : new Se(r, s, t, this.rootNode, this.parentDoctype);
1065
+ const t = this.resolvePath(e), r = this.resolveValue(e), n = t.split(".");
1066
+ let i = this.doctype;
1067
+ return this.doctype === "StonecropStore" && n.length >= 1 && (i = n[0]), typeof r == "object" && r !== null && !this.isPrimitive(r) ? new se(r, i, t, this.rootNode, this.parentDoctype) : new se(r, i, t, this.rootNode, this.parentDoctype);
1382
1068
  }
1383
1069
  set(e, t, r = "user") {
1384
- const o = this.resolvePath(e), s = this.has(e) ? this.get(e) : void 0;
1070
+ const n = this.resolvePath(e), i = this.has(e) ? this.get(e) : void 0;
1385
1071
  if (r !== "undo" && r !== "redo") {
1386
- const i = Ve();
1387
- if (i && typeof i.addOperation == "function") {
1388
- const a = o.split("."), c = this.doctype === "StonecropStore" && a.length >= 1 ? a[0] : this.doctype, f = a.length >= 2 ? a[1] : void 0, g = a.slice(2).join(".") || a[a.length - 1], A = t === void 0 && s !== void 0 ? "delete" : "set";
1389
- i.addOperation(
1072
+ const s = ge();
1073
+ if (s && typeof s.addOperation == "function") {
1074
+ const a = n.split("."), c = this.doctype === "StonecropStore" && a.length >= 1 ? a[0] : this.doctype, d = a.length >= 2 ? a[1] : void 0, g = a.slice(2).join(".") || a[a.length - 1], $ = t === void 0 && i !== void 0 ? "delete" : "set";
1075
+ s.addOperation(
1390
1076
  {
1391
- type: A,
1392
- path: o,
1077
+ type: $,
1078
+ path: n,
1393
1079
  fieldname: g,
1394
- beforeValue: s,
1080
+ beforeValue: i,
1395
1081
  afterValue: t,
1396
1082
  doctype: c,
1397
- recordId: f,
1083
+ recordId: d,
1398
1084
  reversible: !0
1399
1085
  // Default to reversible, can be changed by field triggers
1400
1086
  },
@@ -1402,7 +1088,7 @@ class Se {
1402
1088
  );
1403
1089
  }
1404
1090
  }
1405
- this.updateValue(e, t), this.triggerFieldActions(o, s, t);
1091
+ this.updateValue(e, t), this.triggerFieldActions(n, i, t);
1406
1092
  }
1407
1093
  has(e) {
1408
1094
  try {
@@ -1410,13 +1096,13 @@ class Se {
1410
1096
  return !0;
1411
1097
  const t = this.parsePath(e);
1412
1098
  let r = this.target;
1413
- for (let o = 0; o < t.length; o++) {
1414
- const s = t[o];
1099
+ for (let n = 0; n < t.length; n++) {
1100
+ const i = t[n];
1415
1101
  if (r == null)
1416
1102
  return !1;
1417
- if (o === t.length - 1)
1418
- return this.isImmutable(r) ? r.has(s) : this.isPiniaStore(r) && r.$state && s in r.$state || s in r;
1419
- r = this.getProperty(r, s);
1103
+ if (n === t.length - 1)
1104
+ return this.isImmutable(r) ? r.has(i) : this.isPiniaStore(r) && r.$state && i in r.$state || i in r;
1105
+ r = this.getProperty(r, i);
1420
1106
  }
1421
1107
  return !1;
1422
1108
  } catch {
@@ -1445,9 +1131,9 @@ class Se {
1445
1131
  * Trigger an XState transition with optional context data
1446
1132
  */
1447
1133
  async triggerTransition(e, t) {
1448
- const r = K(), o = this.parentPath.split(".");
1449
- let s = this.doctype, i;
1450
- this.doctype === "StonecropStore" && o.length >= 1 && (s = o[0]), o.length >= 2 && (i = o[1]);
1134
+ const r = J(), n = this.parentPath.split(".");
1135
+ let i = this.doctype, s;
1136
+ this.doctype === "StonecropStore" && n.length >= 1 && (i = n[0]), n.length >= 2 && (s = n[1]);
1451
1137
  const a = {
1452
1138
  path: this.parentPath,
1453
1139
  fieldname: "",
@@ -1455,15 +1141,15 @@ class Se {
1455
1141
  beforeValue: void 0,
1456
1142
  afterValue: void 0,
1457
1143
  operation: "set",
1458
- doctype: s,
1459
- recordId: i,
1144
+ doctype: i,
1145
+ recordId: s,
1460
1146
  timestamp: /* @__PURE__ */ new Date(),
1461
1147
  store: this.rootNode || void 0,
1462
1148
  transition: e,
1463
1149
  currentState: t?.currentState,
1464
1150
  targetState: t?.targetState,
1465
1151
  fsmContext: t?.fsmContext
1466
- }, c = Ve();
1152
+ }, c = ge();
1467
1153
  return c && typeof c.addOperation == "function" && c.addOperation(
1468
1154
  {
1469
1155
  type: "transition",
@@ -1471,8 +1157,8 @@ class Se {
1471
1157
  fieldname: e,
1472
1158
  beforeValue: t?.currentState,
1473
1159
  afterValue: t?.targetState,
1474
- doctype: s,
1475
- recordId: i,
1160
+ doctype: i,
1161
+ recordId: s,
1476
1162
  reversible: !1,
1477
1163
  // FSM transitions are generally not reversible
1478
1164
  metadata: {
@@ -1494,22 +1180,22 @@ class Se {
1494
1180
  return this.target;
1495
1181
  const t = this.parsePath(e);
1496
1182
  let r = this.target;
1497
- for (const o of t) {
1183
+ for (const n of t) {
1498
1184
  if (r == null)
1499
1185
  return;
1500
- r = this.getProperty(r, o);
1186
+ r = this.getProperty(r, n);
1501
1187
  }
1502
1188
  return r;
1503
1189
  }
1504
1190
  updateValue(e, t) {
1505
1191
  if (e === "")
1506
1192
  throw new Error("Cannot set value on empty path");
1507
- const r = this.parsePath(e), o = r.pop();
1508
- let s = this.target;
1509
- for (const i of r)
1510
- if (s = this.getProperty(s, i), s == null)
1193
+ const r = this.parsePath(e), n = r.pop();
1194
+ let i = this.target;
1195
+ for (const s of r)
1196
+ if (i = this.getProperty(i, s), i == null)
1511
1197
  throw new Error(`Cannot set property on null/undefined path: ${e}`);
1512
- this.setProperty(s, o, t);
1198
+ this.setProperty(i, n, t);
1513
1199
  }
1514
1200
  getProperty(e, t) {
1515
1201
  return this.isImmutable(e) ? e.get(t) : this.isVueReactive(e) ? e[t] : this.isPiniaStore(e) ? e.$state?.[t] ?? e[t] : e[t];
@@ -1527,17 +1213,17 @@ class Se {
1527
1213
  try {
1528
1214
  if (!e || typeof e != "string")
1529
1215
  return;
1530
- const o = e.split(".");
1531
- if (o.length < 3)
1216
+ const n = e.split(".");
1217
+ if (n.length < 3)
1532
1218
  return;
1533
- const s = K(), i = o.slice(2).join(".") || o[o.length - 1];
1219
+ const i = J(), s = n.slice(2).join(".") || n[n.length - 1];
1534
1220
  let a = this.doctype;
1535
- this.doctype === "StonecropStore" && o.length >= 1 && (a = o[0]);
1221
+ this.doctype === "StonecropStore" && n.length >= 1 && (a = n[0]);
1536
1222
  let c;
1537
- o.length >= 2 && (c = o[1]);
1538
- const f = {
1223
+ n.length >= 2 && (c = n[1]);
1224
+ const d = {
1539
1225
  path: e,
1540
- fieldname: i,
1226
+ fieldname: s,
1541
1227
  beforeValue: t,
1542
1228
  afterValue: r,
1543
1229
  operation: "set",
@@ -1547,9 +1233,9 @@ class Se {
1547
1233
  store: this.rootNode || void 0
1548
1234
  // Pass the root store for snapshot/rollback capabilities
1549
1235
  };
1550
- await s.executeFieldTriggers(f);
1551
- } catch (o) {
1552
- o instanceof Error && console.warn("Field trigger error:", o.message);
1236
+ await i.executeFieldTriggers(d);
1237
+ } catch (n) {
1238
+ n instanceof Error && console.warn("Field trigger error:", n.message);
1553
1239
  }
1554
1240
  }
1555
1241
  isVueReactive(e) {
@@ -1561,19 +1247,19 @@ class Se {
1561
1247
  isImmutable(e) {
1562
1248
  if (!e || typeof e != "object")
1563
1249
  return !1;
1564
- const t = "get" in e && typeof e.get == "function", r = "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 && r;
1565
- let i;
1250
+ 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", i = "__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;
1251
+ let s;
1566
1252
  try {
1567
1253
  const c = e;
1568
1254
  if ("constructor" in c && c.constructor && typeof c.constructor == "object" && "name" in c.constructor) {
1569
- const f = c.constructor.name;
1570
- i = typeof f == "string" ? f : void 0;
1255
+ const d = c.constructor.name;
1256
+ s = typeof d == "string" ? d : void 0;
1571
1257
  }
1572
1258
  } catch {
1573
- i = void 0;
1259
+ s = void 0;
1574
1260
  }
1575
- const a = i && (i.includes("Map") || i.includes("List") || i.includes("Set") || i.includes("Stack") || i.includes("Seq")) && (t || r);
1576
- return !!(t && r && o && s || t && r && a);
1261
+ const a = s && (s.includes("Map") || s.includes("List") || s.includes("Set") || s.includes("Stack") || s.includes("Seq")) && (t || r);
1262
+ return !!(t && r && n && i || t && r && a);
1577
1263
  }
1578
1264
  isPrimitive(e) {
1579
1265
  return e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "function" || typeof e == "symbol" || typeof e == "bigint";
@@ -1587,10 +1273,10 @@ class Se {
1587
1273
  return e ? e.replace(/\[(\d+)\]/g, ".$1").split(".").filter((r) => r.length > 0) : [];
1588
1274
  }
1589
1275
  }
1590
- function $t(n, e, t) {
1591
- return new Se(n, e, "", null, t);
1276
+ function et(o, e, t) {
1277
+ return new se(o, e, "", null, t);
1592
1278
  }
1593
- class Ke {
1279
+ class Ae {
1594
1280
  hstStore;
1595
1281
  _operationLogStore;
1596
1282
  _operationLogConfig;
@@ -1609,7 +1295,7 @@ class Ke {
1609
1295
  * @internal
1610
1296
  */
1611
1297
  getOperationLogStore() {
1612
- return this._operationLogStore || (this._operationLogStore = pe(), this._operationLogConfig && this._operationLogStore.configure(this._operationLogConfig)), this._operationLogStore;
1298
+ return this._operationLogStore || (this._operationLogStore = re(), this._operationLogConfig && this._operationLogStore.configure(this._operationLogConfig)), this._operationLogStore;
1613
1299
  }
1614
1300
  /**
1615
1301
  * Initialize the HST store structure
@@ -1618,7 +1304,7 @@ class Ke {
1618
1304
  const e = {};
1619
1305
  Object.keys(this.registry.registry).forEach((t) => {
1620
1306
  e[t] = {};
1621
- }), this.hstStore = $t(ye(e), "StonecropStore");
1307
+ }), this.hstStore = et(ue(e), "StonecropStore");
1622
1308
  }
1623
1309
  /**
1624
1310
  * Setup automatic sync with Registry when doctypes are added
@@ -1645,8 +1331,8 @@ class Ke {
1645
1331
  * @param recordData - The record data
1646
1332
  */
1647
1333
  addRecord(e, t, r) {
1648
- const o = typeof e == "string" ? e : e.slug;
1649
- this.ensureDoctypeExists(o), this.hstStore.set(`${o}.${t}`, r);
1334
+ const n = typeof e == "string" ? e : e.slug;
1335
+ this.ensureDoctypeExists(n), this.hstStore.set(`${n}.${t}`, r);
1650
1336
  }
1651
1337
  /**
1652
1338
  * Get a specific record
@@ -1677,7 +1363,7 @@ class Ke {
1677
1363
  const t = typeof e == "string" ? e : e.slug;
1678
1364
  this.ensureDoctypeExists(t);
1679
1365
  const r = this.hstStore.get(t);
1680
- return !r || typeof r != "object" ? [] : Object.keys(r).filter((o) => r[o] !== void 0);
1366
+ return !r || typeof r != "object" ? [] : Object.keys(r).filter((n) => r[n] !== void 0);
1681
1367
  }
1682
1368
  /**
1683
1369
  * Clear all records for a doctype
@@ -1685,8 +1371,8 @@ class Ke {
1685
1371
  */
1686
1372
  clearRecords(e) {
1687
1373
  const t = typeof e == "string" ? e : e.slug;
1688
- this.ensureDoctypeExists(t), this.getRecordIds(t).forEach((o) => {
1689
- this.hstStore.set(`${t}.${o}`, void 0);
1374
+ this.ensureDoctypeExists(t), this.getRecordIds(t).forEach((n) => {
1375
+ this.hstStore.set(`${t}.${n}`, void 0);
1690
1376
  });
1691
1377
  }
1692
1378
  /**
@@ -1704,19 +1390,19 @@ class Ke {
1704
1390
  * @param args - Action arguments (typically record IDs)
1705
1391
  */
1706
1392
  runAction(e, t, r) {
1707
- const s = this.registry.registry[e.slug]?.actions?.get(t), i = Array.isArray(r) ? r.filter((g) => typeof g == "string") : void 0, a = this.getOperationLogStore();
1708
- let c = "success", f;
1393
+ const i = this.registry.registry[e.slug]?.actions?.get(t), s = Array.isArray(r) ? r.filter((g) => typeof g == "string") : void 0, a = this.getOperationLogStore();
1394
+ let c = "success", d;
1709
1395
  try {
1710
- s && s.length > 0 && s.forEach((g) => {
1396
+ i && i.length > 0 && i.forEach((g) => {
1711
1397
  try {
1712
1398
  new Function("args", g)(r);
1713
- } catch (b) {
1714
- throw c = "failure", f = b instanceof Error ? b.message : "Unknown error", b;
1399
+ } catch (S) {
1400
+ throw c = "failure", d = S instanceof Error ? S.message : "Unknown error", S;
1715
1401
  }
1716
1402
  });
1717
1403
  } catch {
1718
1404
  } finally {
1719
- a.logAction(e.doctype, t, i, c, f);
1405
+ a.logAction(e.doctype, t, s, c, d);
1720
1406
  }
1721
1407
  }
1722
1408
  /**
@@ -1724,8 +1410,8 @@ class Ke {
1724
1410
  * @param doctype - The doctype
1725
1411
  */
1726
1412
  async getRecords(e) {
1727
- (await (await fetch(`/${e.slug}`)).json()).forEach((o) => {
1728
- o.id && this.addRecord(e, o.id, o);
1413
+ (await (await fetch(`/${e.slug}`)).json()).forEach((n) => {
1414
+ n.id && this.addRecord(e, n.id, n);
1729
1415
  });
1730
1416
  }
1731
1417
  /**
@@ -1734,8 +1420,8 @@ class Ke {
1734
1420
  * @param recordId - The record ID
1735
1421
  */
1736
1422
  async getRecord(e, t) {
1737
- const o = await (await fetch(`/${e.slug}/${t}`)).json();
1738
- this.addRecord(e, t, o);
1423
+ const n = await (await fetch(`/${e.slug}/${t}`)).json();
1424
+ this.addRecord(e, t, n);
1739
1425
  }
1740
1426
  /**
1741
1427
  * Ensure doctype section exists in HST store
@@ -1762,14 +1448,14 @@ class Ke {
1762
1448
  return this.hstStore;
1763
1449
  }
1764
1450
  }
1765
- function jt(n) {
1766
- n || (n = {});
1767
- const e = n.registry || oe("$registry"), t = oe("$stonecrop"), r = B(), o = B(), s = B({}), i = B(), a = B(), c = B([]);
1768
- if (n.doctype && e) {
1769
- const y = n.doctype.schema ? Array.isArray(n.doctype.schema) ? n.doctype.schema : Array.from(n.doctype.schema) : [];
1770
- c.value = e.resolveSchema(y);
1771
- }
1772
- const f = B([]), g = B(-1), b = W(() => r.value?.getOperationLogStore().canUndo ?? !1), A = W(() => r.value?.getOperationLogStore().canRedo ?? !1), $ = W(() => r.value?.getOperationLogStore().undoCount ?? 0), k = W(() => r.value?.getOperationLogStore().redoCount ?? 0), x = W(
1451
+ function pt(o) {
1452
+ o || (o = {});
1453
+ const e = o.registry || fe("$registry"), t = fe("$stonecrop"), r = L(), n = L(), i = L({}), s = L(), a = L(), c = L([]);
1454
+ if (o.doctype && e) {
1455
+ const p = o.doctype.schema ? Array.isArray(o.doctype.schema) ? o.doctype.schema : Array.from(o.doctype.schema) : [];
1456
+ c.value = e.resolveSchema(p);
1457
+ }
1458
+ const d = L([]), g = L(-1), S = B(() => r.value?.getOperationLogStore().canUndo ?? !1), $ = B(() => r.value?.getOperationLogStore().canRedo ?? !1), k = B(() => r.value?.getOperationLogStore().undoCount ?? 0), x = B(() => r.value?.getOperationLogStore().redoCount ?? 0), F = B(
1773
1459
  () => r.value?.getOperationLogStore().undoRedoState ?? {
1774
1460
  canUndo: !1,
1775
1461
  canRedo: !1,
@@ -1777,204 +1463,204 @@ function jt(n) {
1777
1463
  redoCount: 0,
1778
1464
  currentIndex: -1
1779
1465
  }
1780
- ), N = (y) => r.value?.getOperationLogStore().undo(y) ?? !1, D = (y) => r.value?.getOperationLogStore().redo(y) ?? !1, P = () => {
1466
+ ), R = (p) => r.value?.getOperationLogStore().undo(p) ?? !1, O = (p) => r.value?.getOperationLogStore().redo(p) ?? !1, w = () => {
1781
1467
  r.value?.getOperationLogStore().startBatch();
1782
- }, S = (y) => r.value?.getOperationLogStore().commitBatch(y) ?? null, C = () => {
1468
+ }, h = (p) => r.value?.getOperationLogStore().commitBatch(p) ?? null, E = () => {
1783
1469
  r.value?.getOperationLogStore().cancelBatch();
1784
- }, O = () => {
1470
+ }, b = () => {
1785
1471
  r.value?.getOperationLogStore().clear();
1786
- }, _ = (y, E) => r.value?.getOperationLogStore().getOperationsFor(y, E) ?? [], v = () => r.value?.getOperationLogStore().getSnapshot() ?? {
1472
+ }, A = (p, m) => r.value?.getOperationLogStore().getOperationsFor(p, m) ?? [], C = () => r.value?.getOperationLogStore().getSnapshot() ?? {
1787
1473
  operations: [],
1788
1474
  currentIndex: -1,
1789
1475
  totalOperations: 0,
1790
1476
  reversibleOperations: 0,
1791
1477
  irreversibleOperations: 0
1792
- }, j = (y, E) => {
1793
- r.value?.getOperationLogStore().markIrreversible(y, E);
1794
- }, M = (y, E, m, u = "success", l) => r.value?.getOperationLogStore().logAction(y, E, m, u, l) ?? "", d = (y) => {
1795
- r.value?.getOperationLogStore().configure(y);
1478
+ }, M = (p, m) => {
1479
+ r.value?.getOperationLogStore().markIrreversible(p, m);
1480
+ }, W = (p, m, y, u = "success", l) => r.value?.getOperationLogStore().logAction(p, m, y, u, l) ?? "", N = (p) => {
1481
+ r.value?.getOperationLogStore().configure(p);
1796
1482
  };
1797
- Be(async () => {
1483
+ me(async () => {
1798
1484
  if (e) {
1799
- r.value = t || new Ke(e);
1485
+ r.value = t || new Ae(e);
1800
1486
  try {
1801
- const y = r.value.getOperationLogStore(), E = Ue(y);
1802
- f.value = E.operations.value, g.value = E.currentIndex.value, U(
1803
- () => E.operations.value,
1804
- (m) => {
1805
- f.value = m;
1487
+ const p = r.value.getOperationLogStore(), m = be(p);
1488
+ d.value = m.operations.value, g.value = m.currentIndex.value, U(
1489
+ () => m.operations.value,
1490
+ (y) => {
1491
+ d.value = y;
1806
1492
  }
1807
1493
  ), U(
1808
- () => E.currentIndex.value,
1809
- (m) => {
1810
- g.value = m;
1494
+ () => m.currentIndex.value,
1495
+ (y) => {
1496
+ g.value = y;
1811
1497
  }
1812
1498
  );
1813
1499
  } catch {
1814
1500
  }
1815
- if (!n.doctype && e.router) {
1816
- const y = e.router.currentRoute.value;
1817
- if (!y.path) return;
1818
- const E = y.path.split("/").filter((u) => u.length > 0), m = E[1]?.toLowerCase();
1819
- if (E.length > 0) {
1501
+ if (!o.doctype && e.router) {
1502
+ const p = e.router.currentRoute.value;
1503
+ if (!p.path) return;
1504
+ const m = p.path.split("/").filter((u) => u.length > 0), y = m[1]?.toLowerCase();
1505
+ if (m.length > 0) {
1820
1506
  const u = {
1821
- path: y.path,
1822
- segments: E
1507
+ path: p.path,
1508
+ segments: m
1823
1509
  }, l = await e.getMeta?.(u);
1824
1510
  if (l) {
1825
- if (e.addDoctype(l), r.value.setup(l), i.value = l, a.value = m, o.value = r.value.getStore(), e) {
1826
- const h = l.schema ? Array.isArray(l.schema) ? l.schema : Array.from(l.schema) : [];
1827
- c.value = e.resolveSchema(h);
1511
+ if (e.addDoctype(l), r.value.setup(l), s.value = l, a.value = y, n.value = r.value.getStore(), e) {
1512
+ const f = l.schema ? Array.isArray(l.schema) ? l.schema : Array.from(l.schema) : [];
1513
+ c.value = e.resolveSchema(f);
1828
1514
  }
1829
- if (m && m !== "new") {
1830
- const h = r.value.getRecordById(l, m);
1831
- if (h)
1832
- s.value = h.get("") || {};
1515
+ if (y && y !== "new") {
1516
+ const f = r.value.getRecordById(l, y);
1517
+ if (f)
1518
+ i.value = f.get("") || {};
1833
1519
  else
1834
1520
  try {
1835
- await r.value.getRecord(l, m);
1836
- const I = r.value.getRecordById(l, m);
1837
- I && (s.value = I.get("") || {});
1521
+ await r.value.getRecord(l, y);
1522
+ const T = r.value.getRecordById(l, y);
1523
+ T && (i.value = T.get("") || {});
1838
1524
  } catch {
1839
- s.value = J(l);
1525
+ i.value = z(l);
1840
1526
  }
1841
1527
  } else
1842
- s.value = J(l);
1843
- o.value && xe(l, m || "new", s, o.value), r.value.runAction(l, "load", m ? [m] : void 0);
1528
+ i.value = z(l);
1529
+ n.value && ve(l, y || "new", i, n.value), r.value.runAction(l, "load", y ? [y] : void 0);
1844
1530
  }
1845
1531
  }
1846
1532
  }
1847
- if (n.doctype) {
1848
- o.value = r.value.getStore();
1849
- const y = n.doctype, E = n.recordId;
1850
- if (E && E !== "new") {
1851
- const m = r.value.getRecordById(y, E);
1852
- if (m)
1853
- s.value = m.get("") || {};
1533
+ if (o.doctype) {
1534
+ n.value = r.value.getStore();
1535
+ const p = o.doctype, m = o.recordId;
1536
+ if (m && m !== "new") {
1537
+ const y = r.value.getRecordById(p, m);
1538
+ if (y)
1539
+ i.value = y.get("") || {};
1854
1540
  else
1855
1541
  try {
1856
- await r.value.getRecord(y, E);
1857
- const u = r.value.getRecordById(y, E);
1858
- u && (s.value = u.get("") || {});
1542
+ await r.value.getRecord(p, m);
1543
+ const u = r.value.getRecordById(p, m);
1544
+ u && (i.value = u.get("") || {});
1859
1545
  } catch {
1860
- s.value = J(y);
1546
+ i.value = z(p);
1861
1547
  }
1862
1548
  } else
1863
- s.value = J(y);
1864
- o.value && xe(y, E || "new", s, o.value);
1549
+ i.value = z(p);
1550
+ n.value && ve(p, m || "new", i, n.value);
1865
1551
  }
1866
1552
  }
1867
1553
  });
1868
- const p = (y, E) => {
1869
- const m = n.doctype || i.value;
1870
- if (!m) return "";
1871
- const u = E || n.recordId || a.value || "new";
1872
- return `${m.slug}.${u}.${y}`;
1873
- }, R = (y) => {
1874
- const E = n.doctype || i.value;
1875
- if (!(!o.value || !r.value || !E))
1554
+ const q = (p, m) => {
1555
+ const y = o.doctype || s.value;
1556
+ if (!y) return "";
1557
+ const u = m || o.recordId || a.value || "new";
1558
+ return `${y.slug}.${u}.${p}`;
1559
+ }, _ = (p) => {
1560
+ const m = o.doctype || s.value;
1561
+ if (!(!n.value || !r.value || !m))
1876
1562
  try {
1877
- const m = y.path.split(".");
1878
- if (m.length >= 2) {
1879
- const h = m[0], I = m[1];
1880
- if (o.value.has(`${h}.${I}`) || r.value.addRecord(E, I, { ...s.value }), m.length > 3) {
1881
- const H = `${h}.${I}`, V = m.slice(2);
1882
- let Z = H;
1883
- for (let X = 0; X < V.length - 1; X++)
1884
- if (Z += `.${V[X]}`, !o.value.has(Z)) {
1885
- const we = V[X + 1], Qe = !isNaN(Number(we));
1886
- o.value.set(Z, Qe ? [] : {});
1563
+ const y = p.path.split(".");
1564
+ if (y.length >= 2) {
1565
+ const f = y[0], T = y[1];
1566
+ if (n.value.has(`${f}.${T}`) || r.value.addRecord(m, T, { ...i.value }), y.length > 3) {
1567
+ const V = `${f}.${T}`, I = y.slice(2);
1568
+ let K = V;
1569
+ for (let Z = 0; Z < I.length - 1; Z++)
1570
+ if (K += `.${I[Z]}`, !n.value.has(K)) {
1571
+ const ae = I[Z + 1], $e = !isNaN(Number(ae));
1572
+ n.value.set(K, $e ? [] : {});
1887
1573
  }
1888
1574
  }
1889
1575
  }
1890
- o.value.set(y.path, y.value);
1891
- const u = y.fieldname.split("."), l = { ...s.value };
1892
- u.length === 1 ? l[u[0]] = y.value : Dt(l, u, y.value), s.value = l;
1576
+ n.value.set(p.path, p.value);
1577
+ const u = p.fieldname.split("."), l = { ...i.value };
1578
+ u.length === 1 ? l[u[0]] = p.value : tt(l, u, p.value), i.value = l;
1893
1579
  } catch {
1894
1580
  }
1895
1581
  };
1896
- (n.doctype || e?.router) && (De("hstPathProvider", p), De("hstChangeHandler", R));
1897
- const F = (y, E, m) => {
1582
+ (o.doctype || e?.router) && (pe("hstPathProvider", q), pe("hstChangeHandler", _));
1583
+ const G = (p, m, y) => {
1898
1584
  if (!r.value)
1899
- return J(E);
1900
- if (m)
1585
+ return z(m);
1586
+ if (y)
1901
1587
  try {
1902
- const u = o.value?.get(y);
1903
- return u && typeof u == "object" ? u : J(E);
1588
+ const u = n.value?.get(p);
1589
+ return u && typeof u == "object" ? u : z(m);
1904
1590
  } catch {
1905
- return J(E);
1591
+ return z(m);
1906
1592
  }
1907
- return J(E);
1908
- }, w = async (y, E) => {
1909
- if (!o.value || !r.value)
1593
+ return z(m);
1594
+ }, v = async (p, m) => {
1595
+ if (!n.value || !r.value)
1910
1596
  throw new Error("HST store not initialized");
1911
- const m = `${y.slug}.${E}`, l = { ...o.value.get(m) || {} }, h = y.schema ? Array.isArray(y.schema) ? y.schema : Array.from(y.schema) : [], H = (e ? e.resolveSchema(h) : h).filter(
1912
- (V) => "fieldtype" in V && V.fieldtype === "Doctype" && "schema" in V && Array.isArray(V.schema)
1597
+ const y = `${p.slug}.${m}`, l = { ...n.value.get(y) || {} }, f = p.schema ? Array.isArray(p.schema) ? p.schema : Array.from(p.schema) : [], V = (e ? e.resolveSchema(f) : f).filter(
1598
+ (I) => "fieldtype" in I && I.fieldtype === "Doctype" && "schema" in I && Array.isArray(I.schema)
1913
1599
  );
1914
- for (const V of H) {
1915
- const Z = V, X = `${m}.${Z.fieldname}`, we = Ze(Z.schema, X, o.value);
1916
- l[Z.fieldname] = we;
1600
+ for (const I of V) {
1601
+ const K = I, Z = `${y}.${K.fieldname}`, ae = Oe(K.schema, Z, n.value);
1602
+ l[K.fieldname] = ae;
1917
1603
  }
1918
1604
  return l;
1919
- }, T = (y, E) => ({
1920
- provideHSTPath: (l) => `${y}.${l}`,
1605
+ }, P = (p, m) => ({
1606
+ provideHSTPath: (l) => `${p}.${l}`,
1921
1607
  handleHSTChange: (l) => {
1922
- const h = l.path.startsWith(y) ? l.path : `${y}.${l.fieldname}`;
1923
- R({
1608
+ const f = l.path.startsWith(p) ? l.path : `${p}.${l.fieldname}`;
1609
+ _({
1924
1610
  ...l,
1925
- path: h
1611
+ path: f
1926
1612
  });
1927
1613
  }
1928
- }), L = {
1929
- operations: f,
1614
+ }), D = {
1615
+ operations: d,
1930
1616
  currentIndex: g,
1931
- undoRedoState: x,
1932
- canUndo: b,
1933
- canRedo: A,
1934
- undoCount: $,
1935
- redoCount: k,
1936
- undo: N,
1937
- redo: D,
1938
- startBatch: P,
1939
- commitBatch: S,
1940
- cancelBatch: C,
1941
- clear: O,
1942
- getOperationsFor: _,
1943
- getSnapshot: v,
1944
- markIrreversible: j,
1945
- logAction: M,
1946
- configure: d
1617
+ undoRedoState: F,
1618
+ canUndo: S,
1619
+ canRedo: $,
1620
+ undoCount: k,
1621
+ redoCount: x,
1622
+ undo: R,
1623
+ redo: O,
1624
+ startBatch: w,
1625
+ commitBatch: h,
1626
+ cancelBatch: E,
1627
+ clear: b,
1628
+ getOperationsFor: A,
1629
+ getSnapshot: C,
1630
+ markIrreversible: M,
1631
+ logAction: W,
1632
+ configure: N
1947
1633
  };
1948
- return n.doctype ? {
1634
+ return o.doctype ? {
1949
1635
  stonecrop: r,
1950
- operationLog: L,
1951
- provideHSTPath: p,
1952
- handleHSTChange: R,
1953
- hstStore: o,
1954
- formData: s,
1636
+ operationLog: D,
1637
+ provideHSTPath: q,
1638
+ handleHSTChange: _,
1639
+ hstStore: n,
1640
+ formData: i,
1955
1641
  resolvedSchema: c,
1956
- loadNestedData: F,
1957
- saveRecursive: w,
1958
- createNestedContext: T
1959
- } : !n.doctype && e?.router ? {
1642
+ loadNestedData: G,
1643
+ saveRecursive: v,
1644
+ createNestedContext: P
1645
+ } : !o.doctype && e?.router ? {
1960
1646
  stonecrop: r,
1961
- operationLog: L,
1962
- provideHSTPath: p,
1963
- handleHSTChange: R,
1964
- hstStore: o,
1965
- formData: s,
1647
+ operationLog: D,
1648
+ provideHSTPath: q,
1649
+ handleHSTChange: _,
1650
+ hstStore: n,
1651
+ formData: i,
1966
1652
  resolvedSchema: c,
1967
- loadNestedData: F,
1968
- saveRecursive: w,
1969
- createNestedContext: T
1653
+ loadNestedData: G,
1654
+ saveRecursive: v,
1655
+ createNestedContext: P
1970
1656
  } : {
1971
1657
  stonecrop: r,
1972
- operationLog: L
1658
+ operationLog: D
1973
1659
  };
1974
1660
  }
1975
- function J(n) {
1661
+ function z(o) {
1976
1662
  const e = {};
1977
- return n.schema && n.schema.forEach((t) => {
1663
+ return o.schema && o.schema.forEach((t) => {
1978
1664
  switch ("fieldtype" in t ? t.fieldtype : "Data") {
1979
1665
  case "Data":
1980
1666
  case "Text":
@@ -1998,15 +1684,15 @@ function J(n) {
1998
1684
  }
1999
1685
  }), e;
2000
1686
  }
2001
- function xe(n, e, t, r) {
1687
+ function ve(o, e, t, r) {
2002
1688
  U(
2003
1689
  t,
2004
- (o) => {
2005
- const s = `${n.slug}.${e}`;
2006
- Object.keys(o).forEach((i) => {
2007
- const a = `${s}.${i}`;
1690
+ (n) => {
1691
+ const i = `${o.slug}.${e}`;
1692
+ Object.keys(n).forEach((s) => {
1693
+ const a = `${i}.${s}`;
2008
1694
  try {
2009
- r.set(a, o[i]);
1695
+ r.set(a, n[s]);
2010
1696
  } catch {
2011
1697
  }
2012
1698
  });
@@ -2014,110 +1700,110 @@ function xe(n, e, t, r) {
2014
1700
  { deep: !0 }
2015
1701
  );
2016
1702
  }
2017
- function Dt(n, e, t) {
2018
- let r = n;
2019
- for (let s = 0; s < e.length - 1; s++) {
2020
- const i = e[s];
2021
- (!(i in r) || typeof r[i] != "object") && (r[i] = isNaN(Number(e[s + 1])) ? {} : []), r = r[i];
2022
- }
2023
- const o = e[e.length - 1];
2024
- r[o] = t;
1703
+ function tt(o, e, t) {
1704
+ let r = o;
1705
+ for (let i = 0; i < e.length - 1; i++) {
1706
+ const s = e[i];
1707
+ (!(s in r) || typeof r[s] != "object") && (r[s] = isNaN(Number(e[i + 1])) ? {} : []), r = r[s];
1708
+ }
1709
+ const n = e[e.length - 1];
1710
+ r[n] = t;
2025
1711
  }
2026
- function Ze(n, e, t) {
2027
- const o = { ...t.get(e) || {} }, s = n.filter(
2028
- (i) => "fieldtype" in i && i.fieldtype === "Doctype" && "schema" in i && Array.isArray(i.schema)
1712
+ function Oe(o, e, t) {
1713
+ const n = { ...t.get(e) || {} }, i = o.filter(
1714
+ (s) => "fieldtype" in s && s.fieldtype === "Doctype" && "schema" in s && Array.isArray(s.schema)
2029
1715
  );
2030
- for (const i of s) {
2031
- const a = i, c = `${e}.${a.fieldname}`, f = Ze(a.schema, c, t);
2032
- o[a.fieldname] = f;
1716
+ for (const s of i) {
1717
+ const a = s, c = `${e}.${a.fieldname}`, d = Oe(a.schema, c, t);
1718
+ n[a.fieldname] = d;
2033
1719
  }
2034
- return o;
1720
+ return n;
2035
1721
  }
2036
- function Ge(n) {
2037
- const t = oe("$operationLogStore", void 0) || pe();
2038
- n && t.configure(n);
2039
- const { operations: r, currentIndex: o, undoRedoState: s, canUndo: i, canRedo: a, undoCount: c, redoCount: f } = Ue(t);
2040
- function g(O) {
2041
- return t.undo(O);
1722
+ function Te(o) {
1723
+ const t = fe("$operationLogStore", void 0) || re();
1724
+ o && t.configure(o);
1725
+ const { operations: r, currentIndex: n, undoRedoState: i, canUndo: s, canRedo: a, undoCount: c, redoCount: d } = be(t);
1726
+ function g(b) {
1727
+ return t.undo(b);
2042
1728
  }
2043
- function b(O) {
2044
- return t.redo(O);
1729
+ function S(b) {
1730
+ return t.redo(b);
2045
1731
  }
2046
- function A() {
1732
+ function $() {
2047
1733
  t.startBatch();
2048
1734
  }
2049
- function $(O) {
2050
- return t.commitBatch(O);
1735
+ function k(b) {
1736
+ return t.commitBatch(b);
2051
1737
  }
2052
- function k() {
1738
+ function x() {
2053
1739
  t.cancelBatch();
2054
1740
  }
2055
- function x() {
1741
+ function F() {
2056
1742
  t.clear();
2057
1743
  }
2058
- function N(O, _) {
2059
- return t.getOperationsFor(O, _);
1744
+ function R(b, A) {
1745
+ return t.getOperationsFor(b, A);
2060
1746
  }
2061
- function D() {
1747
+ function O() {
2062
1748
  return t.getSnapshot();
2063
1749
  }
2064
- function P(O, _) {
2065
- t.markIrreversible(O, _);
1750
+ function w(b, A) {
1751
+ t.markIrreversible(b, A);
2066
1752
  }
2067
- function S(O, _, v, j = "success", M) {
2068
- return t.logAction(O, _, v, j, M);
1753
+ function h(b, A, C, M = "success", W) {
1754
+ return t.logAction(b, A, C, M, W);
2069
1755
  }
2070
- function C(O) {
2071
- t.configure(O);
1756
+ function E(b) {
1757
+ t.configure(b);
2072
1758
  }
2073
1759
  return {
2074
1760
  // State
2075
1761
  operations: r,
2076
- currentIndex: o,
2077
- undoRedoState: s,
2078
- canUndo: i,
1762
+ currentIndex: n,
1763
+ undoRedoState: i,
1764
+ canUndo: s,
2079
1765
  canRedo: a,
2080
1766
  undoCount: c,
2081
- redoCount: f,
1767
+ redoCount: d,
2082
1768
  // Methods
2083
1769
  undo: g,
2084
- redo: b,
2085
- startBatch: A,
2086
- commitBatch: $,
2087
- cancelBatch: k,
2088
- clear: x,
2089
- getOperationsFor: N,
2090
- getSnapshot: D,
2091
- markIrreversible: P,
2092
- logAction: S,
2093
- configure: C
1770
+ redo: S,
1771
+ startBatch: $,
1772
+ commitBatch: k,
1773
+ cancelBatch: x,
1774
+ clear: F,
1775
+ getOperationsFor: R,
1776
+ getSnapshot: O,
1777
+ markIrreversible: w,
1778
+ logAction: h,
1779
+ configure: E
2094
1780
  };
2095
1781
  }
2096
- function Wt(n, e = !0) {
1782
+ function ht(o, e = !0) {
2097
1783
  if (!e) return;
2098
- const { undo: t, redo: r, canUndo: o, canRedo: s } = Ge(), i = Nt();
2099
- ie(i["Ctrl+Z"], () => {
2100
- o.value && t(n);
2101
- }), ie(i["Meta+Z"], () => {
2102
- o.value && t(n);
2103
- }), ie(i["Ctrl+Shift+Z"], () => {
2104
- s.value && r(n);
2105
- }), ie(i["Meta+Shift+Z"], () => {
2106
- s.value && r(n);
2107
- }), ie(i["Ctrl+Y"], () => {
2108
- s.value && r(n);
1784
+ const { undo: t, redo: r, canUndo: n, canRedo: i } = Te(), s = Ye();
1785
+ X(s["Ctrl+Z"], () => {
1786
+ n.value && t(o);
1787
+ }), X(s["Meta+Z"], () => {
1788
+ n.value && t(o);
1789
+ }), X(s["Ctrl+Shift+Z"], () => {
1790
+ i.value && r(o);
1791
+ }), X(s["Meta+Shift+Z"], () => {
1792
+ i.value && r(o);
1793
+ }), X(s["Ctrl+Y"], () => {
1794
+ i.value && r(o);
2109
1795
  });
2110
1796
  }
2111
- async function Ht(n, e) {
2112
- const { startBatch: t, commitBatch: r, cancelBatch: o } = Ge();
1797
+ async function gt(o, e) {
1798
+ const { startBatch: t, commitBatch: r, cancelBatch: n } = Te();
2113
1799
  t();
2114
1800
  try {
2115
- return await n(), r(e);
2116
- } catch (s) {
2117
- throw o(), s;
1801
+ return await o(), r(e);
1802
+ } catch (i) {
1803
+ throw n(), i;
2118
1804
  }
2119
1805
  }
2120
- class zt {
1806
+ class vt {
2121
1807
  /**
2122
1808
  * The doctype name
2123
1809
  * @public
@@ -2156,8 +1842,8 @@ class zt {
2156
1842
  * @param actions - The doctype actions and field triggers
2157
1843
  * @param component - Optional Vue component for rendering the doctype
2158
1844
  */
2159
- constructor(e, t, r, o, s) {
2160
- this.doctype = e, this.schema = t, this.workflow = r, this.actions = o, this.component = s;
1845
+ constructor(e, t, r, n, i) {
1846
+ this.doctype = e, this.schema = t, this.workflow = r, this.actions = n, this.component = i;
2161
1847
  }
2162
1848
  /**
2163
1849
  * Converts the registered doctype string to a slug (kebab-case). The following conversions are made:
@@ -2179,7 +1865,7 @@ class zt {
2179
1865
  return this.doctype.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
2180
1866
  }
2181
1867
  }
2182
- class fe {
1868
+ class te {
2183
1869
  /**
2184
1870
  * The root Registry instance
2185
1871
  */
@@ -2206,9 +1892,9 @@ class fe {
2206
1892
  * @param getMeta - Optional function to fetch doctype metadata from an API
2207
1893
  */
2208
1894
  constructor(e, t) {
2209
- if (fe._root)
2210
- return fe._root;
2211
- fe._root = this, this.name = "Registry", this.registry = {}, this.router = e, this.getMeta = t;
1895
+ if (te._root)
1896
+ return te._root;
1897
+ te._root = this, this.name = "Registry", this.registry = {}, this.router = e, this.getMeta = t;
2212
1898
  }
2213
1899
  /**
2214
1900
  * The getMeta function fetches doctype metadata from an API based on route context
@@ -2223,7 +1909,7 @@ class fe {
2223
1909
  */
2224
1910
  addDoctype(e) {
2225
1911
  e.doctype in Object.keys(this.registry) || (this.registry[e.slug] = e);
2226
- const t = K();
1912
+ const t = J();
2227
1913
  t.registerDoctypeActions(e.doctype, e.actions), e.slug !== e.doctype && t.registerDoctypeActions(e.slug, e.actions), e.component && this.router && !this.router.hasRoute(e.doctype) && this.router.addRoute({
2228
1914
  path: `/${e.slug}`,
2229
1915
  name: e.slug,
@@ -2262,38 +1948,38 @@ class fe {
2262
1948
  */
2263
1949
  resolveSchema(e, t) {
2264
1950
  const r = t || /* @__PURE__ */ new Set();
2265
- return e.map((o) => {
2266
- if ("fieldtype" in o && o.fieldtype === "Doctype" && "options" in o && typeof o.options == "string") {
2267
- const s = o.options;
2268
- if (r.has(s))
2269
- return { ...o };
2270
- const i = this.registry[s];
2271
- if (i && i.schema) {
2272
- const a = Array.isArray(i.schema) ? i.schema : Array.from(i.schema);
2273
- r.add(s);
1951
+ return e.map((n) => {
1952
+ if ("fieldtype" in n && n.fieldtype === "Doctype" && "options" in n && typeof n.options == "string") {
1953
+ const i = n.options;
1954
+ if (r.has(i))
1955
+ return { ...n };
1956
+ const s = this.registry[i];
1957
+ if (s && s.schema) {
1958
+ const a = Array.isArray(s.schema) ? s.schema : Array.from(s.schema);
1959
+ r.add(i);
2274
1960
  const c = this.resolveSchema(a, r);
2275
- return r.delete(s), { ...o, schema: c };
1961
+ return r.delete(i), { ...n, schema: c };
2276
1962
  }
2277
1963
  }
2278
- if ("fieldtype" in o && o.fieldtype === "Table" && "options" in o && typeof o.options == "string") {
2279
- const s = o.options;
2280
- if (r.has(s))
2281
- return { ...o };
2282
- const i = this.registry[s];
2283
- if (i && i.schema) {
2284
- const a = Array.isArray(i.schema) ? i.schema : Array.from(i.schema), c = { ...o };
2285
- return (!("columns" in o) || !o.columns) && (c.columns = a.map((f) => ({
2286
- name: f.fieldname,
2287
- fieldname: f.fieldname,
2288
- label: "label" in f && f.label || f.fieldname,
2289
- fieldtype: "fieldtype" in f ? f.fieldtype : "Data",
2290
- align: "align" in f && f.align || "left",
2291
- edit: "edit" in f ? f.edit : !0,
2292
- width: "width" in f && f.width || "20ch"
2293
- }))), c.component || (c.component = "ATable"), (!("config" in o) || !o.config) && (c.config = { view: "list" }), (!("rows" in o) || !o.rows) && (c.rows = []), c;
1964
+ if ("fieldtype" in n && n.fieldtype === "Table" && "options" in n && typeof n.options == "string") {
1965
+ const i = n.options;
1966
+ if (r.has(i))
1967
+ return { ...n };
1968
+ const s = this.registry[i];
1969
+ if (s && s.schema) {
1970
+ const a = Array.isArray(s.schema) ? s.schema : Array.from(s.schema), c = { ...n };
1971
+ return (!("columns" in n) || !n.columns) && (c.columns = a.map((d) => ({
1972
+ name: d.fieldname,
1973
+ fieldname: d.fieldname,
1974
+ label: "label" in d && d.label || d.fieldname,
1975
+ fieldtype: "fieldtype" in d ? d.fieldtype : "Data",
1976
+ align: "align" in d && d.align || "left",
1977
+ edit: "edit" in d ? d.edit : !0,
1978
+ width: "width" in d && d.width || "20ch"
1979
+ }))), c.component || (c.component = "ATable"), (!("config" in n) || !n.config) && (c.config = { view: "list" }), (!("rows" in n) || !n.rows) && (c.rows = []), c;
2294
1980
  }
2295
1981
  }
2296
- return { ...o };
1982
+ return { ...n };
2297
1983
  });
2298
1984
  }
2299
1985
  /**
@@ -2368,38 +2054,38 @@ class fe {
2368
2054
  // }
2369
2055
  // }
2370
2056
  }
2371
- async function Tt(n, e, t) {
2057
+ async function rt(o, e, t) {
2372
2058
  await de();
2373
2059
  try {
2374
- await t(n, e);
2060
+ await t(o, e);
2375
2061
  } catch {
2376
2062
  }
2377
2063
  }
2378
- const Ut = {
2379
- install: (n, e) => {
2380
- const t = n.config.globalProperties.$router, r = e?.router, o = t || r;
2381
- !t && r && n.use(r);
2382
- const s = new fe(o, e?.getMeta);
2383
- n.provide("$registry", s), n.config.globalProperties.$registry = s;
2384
- const i = new Ke(s);
2385
- n.provide("$stonecrop", i), n.config.globalProperties.$stonecrop = i;
2064
+ const mt = {
2065
+ install: (o, e) => {
2066
+ const t = o.config.globalProperties.$router, r = e?.router, n = t || r;
2067
+ !t && r && o.use(r);
2068
+ const i = new te(n, e?.getMeta);
2069
+ o.provide("$registry", i), o.config.globalProperties.$registry = i;
2070
+ const s = new Ae(i);
2071
+ o.provide("$stonecrop", s), o.config.globalProperties.$stonecrop = s;
2386
2072
  try {
2387
- const a = n.config.globalProperties.$pinia;
2073
+ const a = o.config.globalProperties.$pinia;
2388
2074
  if (a) {
2389
- const c = pe(a);
2390
- n.provide("$operationLogStore", c), n.config.globalProperties.$operationLogStore = c;
2075
+ const c = re(a);
2076
+ o.provide("$operationLogStore", c), o.config.globalProperties.$operationLogStore = c;
2391
2077
  }
2392
2078
  } catch (a) {
2393
2079
  console.warn("Pinia not available - operation log features will be disabled:", a);
2394
2080
  }
2395
2081
  if (e?.components)
2396
2082
  for (const [a, c] of Object.entries(e.components))
2397
- n.component(a, c);
2398
- e?.autoInitializeRouter && e.onRouterInitialized && Tt(s, i, e.onRouterInitialized);
2083
+ o.component(a, c);
2084
+ e?.autoInitializeRouter && e.onRouterInitialized && rt(i, s, e.onRouterInitialized);
2399
2085
  }
2400
2086
  };
2401
- var It = /* @__PURE__ */ ((n) => (n.ERROR = "error", n.WARNING = "warning", n.INFO = "info", n))(It || {});
2402
- class Ct {
2087
+ var nt = /* @__PURE__ */ ((o) => (o.ERROR = "error", o.WARNING = "warning", o.INFO = "info", o))(nt || {});
2088
+ class ot {
2403
2089
  options;
2404
2090
  /**
2405
2091
  * Creates a new SchemaValidator instance
@@ -2422,28 +2108,28 @@ class Ct {
2422
2108
  * @param actions - Optional actions map
2423
2109
  * @returns Validation result
2424
2110
  */
2425
- validate(e, t, r, o) {
2426
- const s = [], i = t ? Array.isArray(t) ? t : t.toArray() : [];
2427
- if (this.options.validateRequiredProperties && s.push(...this.validateRequiredProperties(e, i)), this.options.validateLinkTargets && this.options.registry && s.push(...this.validateLinkFields(e, i, this.options.registry)), this.options.validateWorkflows && r && s.push(...this.validateWorkflow(e, r)), this.options.validateActions && o) {
2428
- const g = o instanceof Map ? o : o.toObject();
2429
- s.push(...this.validateActionRegistration(e, g));
2111
+ validate(e, t, r, n) {
2112
+ const i = [], s = t ? Array.isArray(t) ? t : t.toArray() : [];
2113
+ if (this.options.validateRequiredProperties && i.push(...this.validateRequiredProperties(e, s)), this.options.validateLinkTargets && this.options.registry && i.push(...this.validateLinkFields(e, s, this.options.registry)), this.options.validateWorkflows && r && i.push(...this.validateWorkflow(e, r)), this.options.validateActions && n) {
2114
+ const g = n instanceof Map ? n : n.toObject();
2115
+ i.push(...this.validateActionRegistration(e, g));
2430
2116
  }
2431
- const a = s.filter(
2117
+ const a = i.filter(
2432
2118
  (g) => g.severity === "error"
2433
2119
  /* ERROR */
2434
- ).length, c = s.filter(
2120
+ ).length, c = i.filter(
2435
2121
  (g) => g.severity === "warning"
2436
2122
  /* WARNING */
2437
- ).length, f = s.filter(
2123
+ ).length, d = i.filter(
2438
2124
  (g) => g.severity === "info"
2439
2125
  /* INFO */
2440
2126
  ).length;
2441
2127
  return {
2442
2128
  valid: a === 0,
2443
- issues: s,
2129
+ issues: i,
2444
2130
  errorCount: a,
2445
2131
  warningCount: c,
2446
- infoCount: f
2132
+ infoCount: d
2447
2133
  };
2448
2134
  }
2449
2135
  /**
@@ -2452,26 +2138,26 @@ class Ct {
2452
2138
  */
2453
2139
  validateRequiredProperties(e, t) {
2454
2140
  const r = [];
2455
- for (const o of t) {
2456
- if (!o.fieldname) {
2141
+ for (const n of t) {
2142
+ if (!n.fieldname) {
2457
2143
  r.push({
2458
2144
  severity: "error",
2459
2145
  rule: "required-fieldname",
2460
2146
  message: "Field is missing required property: fieldname",
2461
2147
  doctype: e,
2462
- context: { field: o }
2148
+ context: { field: n }
2463
2149
  });
2464
2150
  continue;
2465
2151
  }
2466
- if (!o.component && !("fieldtype" in o) && r.push({
2152
+ if (!n.component && !("fieldtype" in n) && r.push({
2467
2153
  severity: "error",
2468
2154
  rule: "required-component-or-fieldtype",
2469
- message: `Field "${o.fieldname}" must have either component or fieldtype property`,
2155
+ message: `Field "${n.fieldname}" must have either component or fieldtype property`,
2470
2156
  doctype: e,
2471
- fieldname: o.fieldname
2472
- }), "schema" in o) {
2473
- const s = o.schema, i = Array.isArray(s) ? s : s.toArray?.() || [];
2474
- r.push(...this.validateRequiredProperties(e, i));
2157
+ fieldname: n.fieldname
2158
+ }), "schema" in n) {
2159
+ const i = n.schema, s = Array.isArray(i) ? i : i.toArray?.() || [];
2160
+ r.push(...this.validateRequiredProperties(e, s));
2475
2161
  }
2476
2162
  }
2477
2163
  return r;
@@ -2481,46 +2167,46 @@ class Ct {
2481
2167
  * @internal
2482
2168
  */
2483
2169
  validateLinkFields(e, t, r) {
2484
- const o = [];
2485
- for (const s of t) {
2486
- if (("fieldtype" in s ? s.fieldtype : void 0) === "Link") {
2487
- const a = "options" in s ? s.options : void 0;
2170
+ const n = [];
2171
+ for (const i of t) {
2172
+ if (("fieldtype" in i ? i.fieldtype : void 0) === "Link") {
2173
+ const a = "options" in i ? i.options : void 0;
2488
2174
  if (!a) {
2489
- o.push({
2175
+ n.push({
2490
2176
  severity: "error",
2491
2177
  rule: "link-missing-options",
2492
- message: `Link field "${s.fieldname}" is missing options property (target doctype)`,
2178
+ message: `Link field "${i.fieldname}" is missing options property (target doctype)`,
2493
2179
  doctype: e,
2494
- fieldname: s.fieldname
2180
+ fieldname: i.fieldname
2495
2181
  });
2496
2182
  continue;
2497
2183
  }
2498
2184
  const c = typeof a == "string" ? a : "";
2499
2185
  if (!c) {
2500
- o.push({
2186
+ n.push({
2501
2187
  severity: "error",
2502
2188
  rule: "link-invalid-options",
2503
- message: `Link field "${s.fieldname}" has invalid options format (expected string doctype name)`,
2189
+ message: `Link field "${i.fieldname}" has invalid options format (expected string doctype name)`,
2504
2190
  doctype: e,
2505
- fieldname: s.fieldname
2191
+ fieldname: i.fieldname
2506
2192
  });
2507
2193
  continue;
2508
2194
  }
2509
- r.registry[c] || r.registry[c.toLowerCase()] || o.push({
2195
+ r.registry[c] || r.registry[c.toLowerCase()] || n.push({
2510
2196
  severity: "error",
2511
2197
  rule: "link-invalid-target",
2512
- message: `Link field "${s.fieldname}" references non-existent doctype: "${c}"`,
2198
+ message: `Link field "${i.fieldname}" references non-existent doctype: "${c}"`,
2513
2199
  doctype: e,
2514
- fieldname: s.fieldname,
2200
+ fieldname: i.fieldname,
2515
2201
  context: { targetDoctype: c }
2516
2202
  });
2517
2203
  }
2518
- if ("schema" in s) {
2519
- const a = s.schema, c = Array.isArray(a) ? a : a.toArray?.() || [];
2520
- o.push(...this.validateLinkFields(e, c, r));
2204
+ if ("schema" in i) {
2205
+ const a = i.schema, c = Array.isArray(a) ? a : a.toArray?.() || [];
2206
+ n.push(...this.validateLinkFields(e, c, r));
2521
2207
  }
2522
2208
  }
2523
- return o;
2209
+ return n;
2524
2210
  }
2525
2211
  /**
2526
2212
  * Validates workflow state machine configuration
@@ -2547,29 +2233,29 @@ class Ct {
2547
2233
  doctype: e,
2548
2234
  context: { initialState: t.initial }
2549
2235
  });
2550
- const o = Object.keys(t.states), s = /* @__PURE__ */ new Set();
2551
- t.initial && typeof t.initial == "string" && s.add(t.initial);
2552
- for (const [i, a] of Object.entries(t.states)) {
2236
+ const n = Object.keys(t.states), i = /* @__PURE__ */ new Set();
2237
+ t.initial && typeof t.initial == "string" && i.add(t.initial);
2238
+ for (const [s, a] of Object.entries(t.states)) {
2553
2239
  const c = a;
2554
2240
  if (c.on) {
2555
- for (const [f, g] of Object.entries(c.on))
2241
+ for (const [d, g] of Object.entries(c.on))
2556
2242
  if (typeof g == "string")
2557
- s.add(g);
2243
+ i.add(g);
2558
2244
  else if (g && typeof g == "object") {
2559
- const b = "target" in g ? g.target : void 0;
2560
- typeof b == "string" ? s.add(b) : Array.isArray(b) && b.forEach((A) => {
2561
- typeof A == "string" && s.add(A);
2245
+ const S = "target" in g ? g.target : void 0;
2246
+ typeof S == "string" ? i.add(S) : Array.isArray(S) && S.forEach(($) => {
2247
+ typeof $ == "string" && i.add($);
2562
2248
  });
2563
2249
  }
2564
2250
  }
2565
2251
  }
2566
- for (const i of o)
2567
- s.has(i) || r.push({
2252
+ for (const s of n)
2253
+ i.has(s) || r.push({
2568
2254
  severity: "warning",
2569
2255
  rule: "workflow-unreachable-state",
2570
- message: `Workflow state "${i}" may not be reachable`,
2256
+ message: `Workflow state "${s}" may not be reachable`,
2571
2257
  doctype: e,
2572
- context: { stateName: i }
2258
+ context: { stateName: s }
2573
2259
  });
2574
2260
  return r;
2575
2261
  }
@@ -2578,62 +2264,62 @@ class Ct {
2578
2264
  * @internal
2579
2265
  */
2580
2266
  validateActionRegistration(e, t) {
2581
- const r = [], o = K();
2582
- for (const [s, i] of Object.entries(t)) {
2583
- if (!Array.isArray(i)) {
2267
+ const r = [], n = J();
2268
+ for (const [i, s] of Object.entries(t)) {
2269
+ if (!Array.isArray(s)) {
2584
2270
  r.push({
2585
2271
  severity: "error",
2586
2272
  rule: "action-invalid-format",
2587
- message: `Action configuration for "${s}" must be an array`,
2273
+ message: `Action configuration for "${i}" must be an array`,
2588
2274
  doctype: e,
2589
- context: { triggerName: s, actionNames: i }
2275
+ context: { triggerName: i, actionNames: s }
2590
2276
  });
2591
2277
  continue;
2592
2278
  }
2593
- for (const a of i) {
2594
- const c = o;
2279
+ for (const a of s) {
2280
+ const c = n;
2595
2281
  c.globalActions?.has(a) || c.globalTransitionActions?.has(a) || r.push({
2596
2282
  severity: "warning",
2597
2283
  rule: "action-not-registered",
2598
- message: `Action "${a}" referenced in "${s}" is not registered in FieldTriggerEngine`,
2284
+ message: `Action "${a}" referenced in "${i}" is not registered in FieldTriggerEngine`,
2599
2285
  doctype: e,
2600
- context: { triggerName: s, actionName: a }
2286
+ context: { triggerName: i, actionName: a }
2601
2287
  });
2602
2288
  }
2603
2289
  }
2604
2290
  return r;
2605
2291
  }
2606
2292
  }
2607
- function kt(n, e) {
2608
- return new Ct({
2609
- registry: n,
2293
+ function it(o, e) {
2294
+ return new ot({
2295
+ registry: o,
2610
2296
  ...e
2611
2297
  });
2612
2298
  }
2613
- function Jt(n, e, t, r, o) {
2614
- return kt(t).validate(n, e, r, o);
2299
+ function yt(o, e, t, r, n) {
2300
+ return it(t).validate(o, e, r, n);
2615
2301
  }
2616
2302
  export {
2617
- zt as DoctypeMeta,
2618
- ne as HST,
2619
- fe as Registry,
2620
- Ct as SchemaValidator,
2621
- Ke as Stonecrop,
2622
- It as ValidationSeverity,
2623
- $t as createHST,
2624
- kt as createValidator,
2625
- Ut as default,
2626
- K as getGlobalTriggerEngine,
2627
- Bt as markOperationIrreversible,
2628
- Vt as registerGlobalAction,
2629
- xt as registerTransitionAction,
2630
- Mt as setFieldRollback,
2631
- Ft as triggerTransition,
2632
- Ge as useOperationLog,
2633
- pe as useOperationLogStore,
2634
- jt as useStonecrop,
2635
- Wt as useUndoRedoShortcuts,
2636
- Jt as validateSchema,
2637
- Ht as withBatch
2303
+ vt as DoctypeMeta,
2304
+ Y as HST,
2305
+ te as Registry,
2306
+ ot as SchemaValidator,
2307
+ Ae as Stonecrop,
2308
+ nt as ValidationSeverity,
2309
+ et as createHST,
2310
+ it as createValidator,
2311
+ mt as default,
2312
+ J as getGlobalTriggerEngine,
2313
+ dt as markOperationIrreversible,
2314
+ ct as registerGlobalAction,
2315
+ lt as registerTransitionAction,
2316
+ ut as setFieldRollback,
2317
+ ft as triggerTransition,
2318
+ Te as useOperationLog,
2319
+ re as useOperationLogStore,
2320
+ pt as useStonecrop,
2321
+ ht as useUndoRedoShortcuts,
2322
+ yt as validateSchema,
2323
+ gt as withBatch
2638
2324
  };
2639
2325
  //# sourceMappingURL=stonecrop.js.map