@stonecrop/desktop 0.7.9 → 0.8.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/desktop.js CHANGED
@@ -1,39 +1,39 @@
1
- import { defineComponent as we, ref as R, onMounted as Te, createElementBlock as M, openBlock as L, normalizeClass as ke, createElementVNode as T, Fragment as me, renderList as ye, createCommentVNode as fe, toDisplayString as Y, withDirectives as Ne, vShow as Be, useTemplateRef as st, computed as A, watch as H, nextTick as oe, createBlock as Ke, Teleport as Et, createVNode as se, Transition as Ot, withCtx as be, withModifiers as it, vModelText as lt, renderSlot as xe, createTextVNode as De, inject as He, provide as Ue, toRaw as ct, isRef as le, isReactive as Ae, toRef as ie, hasInjectionContext as kt, getCurrentInstance as ut, reactive as Nt, markRaw as de, effectScope as Dt, getCurrentScope as dt, onScopeDispose as pt, toRefs as Ze, shallowRef as Je, toValue as ee, readonly as Ge, customRef as vt, unref as Oe, watchEffect as Rt, resolveDynamicComponent as Ct, mergeProps as It, resolveComponent as Tt, withKeys as ue, normalizeStyle as Ve } from "vue";
2
- const At = { class: "action-menu-icon" }, xt = ["disabled", "onClick"], Vt = { key: 1 }, Pt = ["onClick"], jt = { class: "dropdown-container" }, Lt = { class: "dropdown" }, Ft = ["onClick"], Mt = ["href"], Bt = { class: "dropdown-item" }, Ht = /* @__PURE__ */ we({
1
+ import { defineComponent as Se, ref as C, onMounted as xe, createElementBlock as L, openBlock as j, normalizeClass as Oe, createElementVNode as T, Fragment as ue, renderList as be, createCommentVNode as ce, toDisplayString as ee, withDirectives as Re, vShow as ze, useTemplateRef as vt, computed as I, watch as H, nextTick as re, createBlock as Qe, Teleport as At, createVNode as ae, Transition as It, withCtx as we, withModifiers as ft, vModelText as ht, renderSlot as Me, createTextVNode as Ce, inject as Je, provide as Ge, reactive as gt, toRaw as mt, isRef as de, isReactive as Pe, toRef as ne, hasInjectionContext as Tt, getCurrentInstance as yt, markRaw as fe, effectScope as xt, getCurrentScope as Xe, onScopeDispose as Ye, toRefs as ot, shallowRef as $e, toValue as X, readonly as Ve, customRef as et, unref as Ne, mergeModels as at, useModel as Pt, watchEffect as Ee, resolveComponent as bt, resolveDynamicComponent as Vt, mergeProps as Mt, withKeys as ve, normalizeStyle as je } from "vue";
2
+ const jt = { class: "action-menu-icon" }, Lt = ["disabled", "onClick"], Ft = { key: 1 }, Bt = ["onClick"], Ht = { class: "dropdown-container" }, Ut = { class: "dropdown" }, Wt = ["onClick"], Kt = ["href"], zt = { class: "dropdown-item" }, Jt = /* @__PURE__ */ Se({
3
3
  __name: "ActionSet",
4
4
  props: {
5
5
  elements: { default: () => [] }
6
6
  },
7
7
  emits: ["actionClick"],
8
- setup(o, { emit: e }) {
9
- const t = e, a = R({}), n = R(!1), s = R(-1), r = R(!1), c = R(!1);
10
- Te(() => {
11
- i();
8
+ setup(t, { emit: e }) {
9
+ const o = e, a = C({}), n = C(!1), i = C(-1), r = C(!1), c = C(!1);
10
+ xe(() => {
11
+ s();
12
12
  });
13
- const i = () => {
13
+ const s = () => {
14
14
  a.value = {};
15
15
  }, u = () => {
16
- r.value = !0, s.value = setTimeout(() => {
16
+ r.value = !0, i.value = setTimeout(() => {
17
17
  r.value && (n.value = !0);
18
18
  }, 500);
19
19
  }, p = () => {
20
- r.value = !1, c.value = !1, clearTimeout(s.value), n.value = !1;
21
- }, b = (N) => {
22
- const O = !a.value[N];
23
- i(), O && (a.value[N] = !0);
24
- }, w = (N, O) => {
25
- t("actionClick", O, N);
20
+ r.value = !1, c.value = !1, clearTimeout(i.value), n.value = !1;
21
+ }, h = (D) => {
22
+ const k = !a.value[D];
23
+ s(), k && (a.value[D] = !0);
24
+ }, b = (D, k) => {
25
+ o("actionClick", k, D);
26
26
  };
27
- return (N, O) => (L(), M("div", {
28
- class: ke([{ "open-set": n.value, "hovered-and-closed": c.value }, "action-set collapse"]),
27
+ return (D, k) => (j(), L("div", {
28
+ class: Oe([{ "open-set": n.value, "hovered-and-closed": c.value }, "action-set collapse"]),
29
29
  onMouseover: u,
30
30
  onMouseleave: p
31
31
  }, [
32
- T("div", At, [
32
+ T("div", jt, [
33
33
  T("div", {
34
34
  id: "chevron",
35
- onClick: O[0] || (O[0] = (k) => c.value = !c.value)
36
- }, [...O[1] || (O[1] = [
35
+ onClick: k[0] || (k[0] = (O) => c.value = !c.value)
36
+ }, [...k[1] || (k[1] = [
37
37
  T("svg", {
38
38
  id: "Layer_1",
39
39
  class: "leftBar",
@@ -66,58 +66,58 @@ const At = { class: "action-menu-icon" }, xt = ["disabled", "onClick"], Vt = { k
66
66
  ], -1)
67
67
  ])])
68
68
  ]),
69
- O[2] || (O[2] = T("div", { style: { "margin-right": "30px" } }, null, -1)),
70
- (L(!0), M(me, null, ye(o.elements, (k, V) => (L(), M("div", {
71
- key: k.label,
69
+ k[2] || (k[2] = T("div", { style: { "margin-right": "30px" } }, null, -1)),
70
+ (j(!0), L(ue, null, be(t.elements, (O, V) => (j(), L("div", {
71
+ key: O.label,
72
72
  class: "action-element"
73
73
  }, [
74
- k.type == "button" ? (L(), M("button", {
74
+ O.type == "button" ? (j(), L("button", {
75
75
  key: 0,
76
- disabled: k.disabled,
76
+ disabled: O.disabled,
77
77
  class: "button-default",
78
- onClick: (P) => w(k.action, k.label)
79
- }, Y(k.label), 9, xt)) : fe("", !0),
80
- k.type == "dropdown" ? (L(), M("div", Vt, [
78
+ onClick: (M) => b(O.action, O.label)
79
+ }, ee(O.label), 9, Lt)) : ce("", !0),
80
+ O.type == "dropdown" ? (j(), L("div", Ft, [
81
81
  T("button", {
82
82
  class: "button-default",
83
- onClick: (P) => b(V)
84
- }, Y(k.label), 9, Pt),
85
- Ne(T("div", jt, [
86
- T("div", Lt, [
87
- (L(!0), M(me, null, ye(k.actions, (P, x) => (L(), M("div", {
88
- key: P.label
83
+ onClick: (M) => h(V)
84
+ }, ee(O.label), 9, Bt),
85
+ Re(T("div", Ht, [
86
+ T("div", Ut, [
87
+ (j(!0), L(ue, null, be(O.actions, (M, x) => (j(), L("div", {
88
+ key: M.label
89
89
  }, [
90
- P.action != null ? (L(), M("button", {
90
+ M.action != null ? (j(), L("button", {
91
91
  key: 0,
92
92
  class: "dropdown-item",
93
- onClick: (W) => w(P.action, P.label)
94
- }, Y(P.label), 9, Ft)) : P.link != null ? (L(), M("a", {
93
+ onClick: (W) => b(M.action, M.label)
94
+ }, ee(M.label), 9, Wt)) : M.link != null ? (j(), L("a", {
95
95
  key: 1,
96
- href: P.link
96
+ href: M.link
97
97
  }, [
98
- T("button", Bt, Y(P.label), 1)
99
- ], 8, Mt)) : fe("", !0)
98
+ T("button", zt, ee(M.label), 1)
99
+ ], 8, Kt)) : ce("", !0)
100
100
  ]))), 128))
101
101
  ])
102
102
  ], 512), [
103
- [Be, a.value[V]]
103
+ [ze, a.value[V]]
104
104
  ])
105
- ])) : fe("", !0)
105
+ ])) : ce("", !0)
106
106
  ]))), 128))
107
107
  ], 34));
108
108
  }
109
- }), ft = (o, e) => {
110
- const t = o.__vccOpts || o;
109
+ }), wt = (t, e) => {
110
+ const o = t.__vccOpts || t;
111
111
  for (const [a, n] of e)
112
- t[a] = n;
113
- return t;
114
- }, ht = /* @__PURE__ */ ft(Ht, [["__scopeId", "data-v-eb01c863"]]), Ut = { class: "command-palette-header" }, Wt = ["placeholder"], zt = {
112
+ o[a] = n;
113
+ return o;
114
+ }, St = /* @__PURE__ */ wt(Jt, [["__scopeId", "data-v-eb01c863"]]), Gt = { class: "command-palette-header" }, qt = ["placeholder"], Zt = {
115
115
  key: 0,
116
116
  class: "command-palette-results"
117
- }, Kt = ["onClick", "onMouseover"], Jt = { class: "result-title" }, Gt = { class: "result-content" }, qt = {
117
+ }, Qt = ["onClick", "onMouseover"], Xt = { class: "result-title" }, Yt = { class: "result-content" }, eo = {
118
118
  key: 1,
119
119
  class: "command-palette-no-results"
120
- }, gt = /* @__PURE__ */ we({
120
+ }, $t = /* @__PURE__ */ Se({
121
121
  __name: "CommandPalette",
122
122
  props: {
123
123
  search: { type: Function },
@@ -126,19 +126,19 @@ const At = { class: "action-menu-icon" }, xt = ["disabled", "onClick"], Vt = { k
126
126
  maxResults: { default: 10 }
127
127
  },
128
128
  emits: ["select", "close"],
129
- setup(o, { emit: e }) {
130
- const t = e, a = R(""), n = R(0), s = st("input"), r = A(() => a.value ? o.search(a.value).slice(0, o.maxResults) : []);
129
+ setup(t, { emit: e }) {
130
+ const o = e, a = C(""), n = C(0), i = vt("input"), r = I(() => a.value ? t.search(a.value).slice(0, t.maxResults) : []);
131
131
  H(
132
- () => o.isOpen,
132
+ () => t.isOpen,
133
133
  async (p) => {
134
- p && (a.value = "", n.value = 0, await oe(), s.value?.focus());
134
+ p && (a.value = "", n.value = 0, await re(), i.value?.focus());
135
135
  }
136
136
  ), H(r, () => {
137
137
  n.value = 0;
138
138
  });
139
139
  const c = () => {
140
- t("close");
141
- }, i = (p) => {
140
+ o("close");
141
+ }, s = (p) => {
142
142
  switch (p.key) {
143
143
  case "Escape":
144
144
  c();
@@ -154,689 +154,689 @@ const At = { class: "action-menu-icon" }, xt = ["disabled", "onClick"], Vt = { k
154
154
  break;
155
155
  }
156
156
  }, u = (p) => {
157
- t("select", p), c();
157
+ o("select", p), c();
158
158
  };
159
- return (p, b) => (L(), Ke(Et, { to: "body" }, [
160
- se(Ot, { name: "fade" }, {
161
- default: be(() => [
162
- o.isOpen ? (L(), M("div", {
159
+ return (p, h) => (j(), Qe(At, { to: "body" }, [
160
+ ae(It, { name: "fade" }, {
161
+ default: we(() => [
162
+ t.isOpen ? (j(), L("div", {
163
163
  key: 0,
164
164
  class: "command-palette-overlay",
165
165
  onClick: c
166
166
  }, [
167
167
  T("div", {
168
168
  class: "command-palette",
169
- onClick: b[1] || (b[1] = it(() => {
169
+ onClick: h[1] || (h[1] = ft(() => {
170
170
  }, ["stop"]))
171
171
  }, [
172
- T("div", Ut, [
173
- Ne(T("input", {
172
+ T("div", Gt, [
173
+ Re(T("input", {
174
174
  ref: "input",
175
- "onUpdate:modelValue": b[0] || (b[0] = (w) => a.value = w),
175
+ "onUpdate:modelValue": h[0] || (h[0] = (b) => a.value = b),
176
176
  type: "text",
177
177
  class: "command-palette-input",
178
- placeholder: o.placeholder,
178
+ placeholder: t.placeholder,
179
179
  autofocus: "",
180
- onKeydown: i
181
- }, null, 40, Wt), [
182
- [lt, a.value]
180
+ onKeydown: s
181
+ }, null, 40, qt), [
182
+ [ht, a.value]
183
183
  ])
184
184
  ]),
185
- r.value.length ? (L(), M("div", zt, [
186
- (L(!0), M(me, null, ye(r.value, (w, N) => (L(), M("div", {
187
- key: N,
188
- class: ke(["command-palette-result", { selected: N === n.value }]),
189
- onClick: (O) => u(w),
190
- onMouseover: (O) => n.value = N
185
+ r.value.length ? (j(), L("div", Zt, [
186
+ (j(!0), L(ue, null, be(r.value, (b, D) => (j(), L("div", {
187
+ key: D,
188
+ class: Oe(["command-palette-result", { selected: D === n.value }]),
189
+ onClick: (k) => u(b),
190
+ onMouseover: (k) => n.value = D
191
191
  }, [
192
- T("div", Jt, [
193
- xe(p.$slots, "title", { result: w })
192
+ T("div", Xt, [
193
+ Me(p.$slots, "title", { result: b })
194
194
  ]),
195
- T("div", Gt, [
196
- xe(p.$slots, "content", { result: w })
195
+ T("div", Yt, [
196
+ Me(p.$slots, "content", { result: b })
197
197
  ])
198
- ], 42, Kt))), 128))
199
- ])) : a.value && !r.value.length ? (L(), M("div", qt, [
200
- xe(p.$slots, "empty", {}, () => [
201
- De(' No results found for "' + Y(a.value) + '" ', 1)
198
+ ], 42, Qt))), 128))
199
+ ])) : a.value && !r.value.length ? (j(), L("div", eo, [
200
+ Me(p.$slots, "empty", {}, () => [
201
+ Ce(' No results found for "' + ee(a.value) + '" ', 1)
202
202
  ])
203
- ])) : fe("", !0)
203
+ ])) : ce("", !0)
204
204
  ])
205
- ])) : fe("", !0)
205
+ ])) : ce("", !0)
206
206
  ]),
207
207
  _: 3
208
208
  })
209
209
  ]));
210
210
  }
211
- }), pe = typeof window < "u";
212
- let ve;
213
- const Re = (o) => ve = o;
211
+ }), he = typeof window < "u";
212
+ let ge;
213
+ const Ae = (t) => ge = t;
214
214
  process.env.NODE_ENV;
215
- const Zt = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia") : (
215
+ const to = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia") : (
216
216
  /* istanbul ignore next */
217
217
  /* @__PURE__ */ Symbol()
218
218
  );
219
- function ae(o) {
220
- return o && typeof o == "object" && Object.prototype.toString.call(o) === "[object Object]" && typeof o.toJSON != "function";
219
+ function se(t) {
220
+ return t && typeof t == "object" && Object.prototype.toString.call(t) === "[object Object]" && typeof t.toJSON != "function";
221
221
  }
222
- var he;
223
- (function(o) {
224
- o.direct = "direct", o.patchObject = "patch object", o.patchFunction = "patch function";
225
- })(he || (he = {}));
226
- function mt(o, e) {
227
- for (const t in e) {
228
- const a = e[t];
229
- if (!(t in o))
222
+ var me;
223
+ (function(t) {
224
+ t.direct = "direct", t.patchObject = "patch object", t.patchFunction = "patch function";
225
+ })(me || (me = {}));
226
+ function Et(t, e) {
227
+ for (const o in e) {
228
+ const a = e[o];
229
+ if (!(o in t))
230
230
  continue;
231
- const n = o[t];
232
- ae(n) && ae(a) && !le(a) && !Ae(a) ? o[t] = mt(n, a) : o[t] = a;
231
+ const n = t[o];
232
+ se(n) && se(a) && !de(a) && !Pe(a) ? t[o] = Et(n, a) : t[o] = a;
233
233
  }
234
- return o;
234
+ return t;
235
235
  }
236
- const yt = () => {
236
+ const _t = () => {
237
237
  };
238
- function Qe(o, e, t, a = yt) {
239
- o.add(e);
238
+ function nt(t, e, o, a = _t) {
239
+ t.add(e);
240
240
  const n = () => {
241
- o.delete(e) && a();
241
+ t.delete(e) && a();
242
242
  };
243
- return !t && dt() && pt(n), n;
243
+ return !o && Xe() && Ye(n), n;
244
244
  }
245
- function ne(o, ...e) {
246
- o.forEach((t) => {
247
- t(...e);
245
+ function ie(t, ...e) {
246
+ t.forEach((o) => {
247
+ o(...e);
248
248
  });
249
249
  }
250
- const Qt = (o) => o(), Xe = /* @__PURE__ */ Symbol(), Pe = /* @__PURE__ */ Symbol();
251
- function We(o, e) {
252
- o instanceof Map && e instanceof Map ? e.forEach((t, a) => o.set(a, t)) : o instanceof Set && e instanceof Set && e.forEach(o.add, o);
253
- for (const t in e) {
254
- if (!e.hasOwnProperty(t))
250
+ const oo = (t) => t(), rt = /* @__PURE__ */ Symbol(), Le = /* @__PURE__ */ Symbol();
251
+ function qe(t, e) {
252
+ t instanceof Map && e instanceof Map ? e.forEach((o, a) => t.set(a, o)) : t instanceof Set && e instanceof Set && e.forEach(t.add, t);
253
+ for (const o in e) {
254
+ if (!e.hasOwnProperty(o))
255
255
  continue;
256
- const a = e[t], n = o[t];
257
- ae(n) && ae(a) && o.hasOwnProperty(t) && !le(a) && !Ae(a) ? o[t] = We(n, a) : o[t] = a;
256
+ const a = e[o], n = t[o];
257
+ se(n) && se(a) && t.hasOwnProperty(o) && !de(a) && !Pe(a) ? t[o] = qe(n, a) : t[o] = a;
258
258
  }
259
- return o;
259
+ return t;
260
260
  }
261
- const Xt = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia:skipHydration") : (
261
+ const ao = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia:skipHydration") : (
262
262
  /* istanbul ignore next */
263
263
  /* @__PURE__ */ Symbol()
264
264
  );
265
- function Yt(o) {
266
- return !ae(o) || !Object.prototype.hasOwnProperty.call(o, Xt);
265
+ function no(t) {
266
+ return !se(t) || !Object.prototype.hasOwnProperty.call(t, ao);
267
267
  }
268
- const { assign: Z } = Object;
269
- function Ye(o) {
270
- return !!(le(o) && o.effect);
268
+ const { assign: Q } = Object;
269
+ function st(t) {
270
+ return !!(de(t) && t.effect);
271
271
  }
272
- function et(o, e, t, a) {
273
- const { state: n, actions: s, getters: r } = e, c = t.state.value[o];
274
- let i;
272
+ function it(t, e, o, a) {
273
+ const { state: n, actions: i, getters: r } = e, c = o.state.value[t];
274
+ let s;
275
275
  function u() {
276
- !c && (process.env.NODE_ENV === "production" || !a) && (t.state.value[o] = n ? n() : {});
276
+ !c && (process.env.NODE_ENV === "production" || !a) && (o.state.value[t] = n ? n() : {});
277
277
  const p = process.env.NODE_ENV !== "production" && a ? (
278
278
  // use ref() to unwrap refs inside state TODO: check if this is still necessary
279
- Ze(R(n ? n() : {}).value)
280
- ) : Ze(t.state.value[o]);
281
- return Z(p, s, Object.keys(r || {}).reduce((b, w) => (process.env.NODE_ENV !== "production" && w in p && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${w}" in store "${o}".`), b[w] = de(A(() => {
282
- Re(t);
283
- const N = t._s.get(o);
284
- return r[w].call(N, N);
285
- })), b), {}));
286
- }
287
- return i = ze(o, u, e, t, a, !0), i;
279
+ ot(C(n ? n() : {}).value)
280
+ ) : ot(o.state.value[t]);
281
+ return Q(p, i, Object.keys(r || {}).reduce((h, b) => (process.env.NODE_ENV !== "production" && b in p && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${b}" in store "${t}".`), h[b] = fe(I(() => {
282
+ Ae(o);
283
+ const D = o._s.get(t);
284
+ return r[b].call(D, D);
285
+ })), h), {}));
286
+ }
287
+ return s = Ze(t, u, e, o, a, !0), s;
288
288
  }
289
- function ze(o, e, t = {}, a, n, s) {
289
+ function Ze(t, e, o = {}, a, n, i) {
290
290
  let r;
291
- const c = Z({ actions: {} }, t);
291
+ const c = Q({ actions: {} }, o);
292
292
  if (process.env.NODE_ENV !== "production" && !a._e.active)
293
293
  throw new Error("Pinia destroyed");
294
- const i = { deep: !0 };
295
- process.env.NODE_ENV !== "production" && (i.onTrigger = (m) => {
296
- u ? N = m : u == !1 && !_._hotUpdating && (Array.isArray(N) ? N.push(m) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."));
294
+ const s = { deep: !0 };
295
+ process.env.NODE_ENV !== "production" && (s.onTrigger = (m) => {
296
+ u ? D = m : u == !1 && !E._hotUpdating && (Array.isArray(D) ? D.push(m) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."));
297
297
  });
298
- let u, p, b = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), N;
299
- const O = a.state.value[o];
300
- !s && !O && (process.env.NODE_ENV === "production" || !n) && (a.state.value[o] = {});
301
- const k = R({});
298
+ let u, p, h = /* @__PURE__ */ new Set(), b = /* @__PURE__ */ new Set(), D;
299
+ const k = a.state.value[t];
300
+ !i && !k && (process.env.NODE_ENV === "production" || !n) && (a.state.value[t] = {});
301
+ const O = C({});
302
302
  let V;
303
- function P(m) {
304
- let v;
305
- u = p = !1, process.env.NODE_ENV !== "production" && (N = []), typeof m == "function" ? (m(a.state.value[o]), v = {
306
- type: he.patchFunction,
307
- storeId: o,
308
- events: N
309
- }) : (We(a.state.value[o], m), v = {
310
- type: he.patchObject,
303
+ function M(m) {
304
+ let g;
305
+ u = p = !1, process.env.NODE_ENV !== "production" && (D = []), typeof m == "function" ? (m(a.state.value[t]), g = {
306
+ type: me.patchFunction,
307
+ storeId: t,
308
+ events: D
309
+ }) : (qe(a.state.value[t], m), g = {
310
+ type: me.patchObject,
311
311
  payload: m,
312
- storeId: o,
313
- events: N
312
+ storeId: t,
313
+ events: D
314
314
  });
315
- const C = V = /* @__PURE__ */ Symbol();
316
- oe().then(() => {
317
- V === C && (u = !0);
318
- }), p = !0, ne(b, v, a.state.value[o]);
319
- }
320
- const x = s ? function() {
321
- const { state: m } = t, v = m ? m() : {};
322
- this.$patch((C) => {
323
- Z(C, v);
315
+ const A = V = /* @__PURE__ */ Symbol();
316
+ re().then(() => {
317
+ V === A && (u = !0);
318
+ }), p = !0, ie(h, g, a.state.value[t]);
319
+ }
320
+ const x = i ? function() {
321
+ const { state: m } = o, g = m ? m() : {};
322
+ this.$patch((A) => {
323
+ Q(A, g);
324
324
  });
325
325
  } : (
326
326
  /* istanbul ignore next */
327
327
  process.env.NODE_ENV !== "production" ? () => {
328
- throw new Error(`🍍: Store "${o}" is built using the setup syntax and does not implement $reset().`);
329
- } : yt
328
+ throw new Error(`🍍: Store "${t}" is built using the setup syntax and does not implement $reset().`);
329
+ } : _t
330
330
  );
331
331
  function W() {
332
- r.stop(), b.clear(), w.clear(), a._s.delete(o);
333
- }
334
- const J = (m, v = "") => {
335
- if (Xe in m)
336
- return m[Pe] = v, m;
337
- const C = function() {
338
- Re(a);
339
- const F = Array.from(arguments), E = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set();
340
- function $(B) {
341
- E.add(B);
332
+ r.stop(), h.clear(), b.clear(), a._s.delete(t);
333
+ }
334
+ const Z = (m, g = "") => {
335
+ if (rt in m)
336
+ return m[Le] = g, m;
337
+ const A = function() {
338
+ Ae(a);
339
+ const F = Array.from(arguments), G = /* @__PURE__ */ new Set(), N = /* @__PURE__ */ new Set();
340
+ function P($) {
341
+ G.add($);
342
342
  }
343
- function D(B) {
344
- h.add(B);
343
+ function B($) {
344
+ N.add($);
345
345
  }
346
- ne(w, {
346
+ ie(b, {
347
347
  args: F,
348
- name: C[Pe],
349
- store: _,
350
- after: $,
351
- onError: D
348
+ name: A[Le],
349
+ store: E,
350
+ after: P,
351
+ onError: B
352
352
  });
353
- let j;
353
+ let w;
354
354
  try {
355
- j = m.apply(this && this.$id === o ? this : _, F);
356
- } catch (B) {
357
- throw ne(h, B), B;
355
+ w = m.apply(this && this.$id === t ? this : E, F);
356
+ } catch ($) {
357
+ throw ie(N, $), $;
358
358
  }
359
- return j instanceof Promise ? j.then((B) => (ne(E, B), B)).catch((B) => (ne(h, B), Promise.reject(B))) : (ne(E, j), j);
359
+ return w instanceof Promise ? w.then(($) => (ie(G, $), $)).catch(($) => (ie(N, $), Promise.reject($))) : (ie(G, w), w);
360
360
  };
361
- return C[Xe] = !0, C[Pe] = v, C;
362
- }, K = /* @__PURE__ */ de({
361
+ return A[rt] = !0, A[Le] = g, A;
362
+ }, J = /* @__PURE__ */ fe({
363
363
  actions: {},
364
364
  getters: {},
365
365
  state: [],
366
- hotState: k
367
- }), z = {
366
+ hotState: O
367
+ }), K = {
368
368
  _p: a,
369
369
  // _s: scope,
370
- $id: o,
371
- $onAction: Qe.bind(null, w),
372
- $patch: P,
370
+ $id: t,
371
+ $onAction: nt.bind(null, b),
372
+ $patch: M,
373
373
  $reset: x,
374
- $subscribe(m, v = {}) {
375
- const C = Qe(b, m, v.detached, () => F()), F = r.run(() => H(() => a.state.value[o], (E) => {
376
- (v.flush === "sync" ? p : u) && m({
377
- storeId: o,
378
- type: he.direct,
379
- events: N
380
- }, E);
381
- }, Z({}, i, v)));
382
- return C;
374
+ $subscribe(m, g = {}) {
375
+ const A = nt(h, m, g.detached, () => F()), F = r.run(() => H(() => a.state.value[t], (G) => {
376
+ (g.flush === "sync" ? p : u) && m({
377
+ storeId: t,
378
+ type: me.direct,
379
+ events: D
380
+ }, G);
381
+ }, Q({}, s, g)));
382
+ return A;
383
383
  },
384
384
  $dispose: W
385
- }, _ = Nt(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && pe ? Z(
385
+ }, E = gt(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && he ? Q(
386
386
  {
387
- _hmrPayload: K,
388
- _customProperties: de(/* @__PURE__ */ new Set())
387
+ _hmrPayload: J,
388
+ _customProperties: fe(/* @__PURE__ */ new Set())
389
389
  // devtools custom properties
390
390
  },
391
- z
391
+ K
392
392
  // must be added later
393
393
  // setupStore
394
- ) : z);
395
- a._s.set(o, _);
396
- const U = (a._a && a._a.runWithContext || Qt)(() => a._e.run(() => (r = Dt()).run(() => e({ action: J }))));
394
+ ) : K);
395
+ a._s.set(t, E);
396
+ const U = (a._a && a._a.runWithContext || oo)(() => a._e.run(() => (r = xt()).run(() => e({ action: Z }))));
397
397
  for (const m in U) {
398
- const v = U[m];
399
- if (le(v) && !Ye(v) || Ae(v))
400
- process.env.NODE_ENV !== "production" && n ? k.value[m] = ie(U, m) : s || (O && Yt(v) && (le(v) ? v.value = O[m] : We(v, O[m])), a.state.value[o][m] = v), process.env.NODE_ENV !== "production" && K.state.push(m);
401
- else if (typeof v == "function") {
402
- const C = process.env.NODE_ENV !== "production" && n ? v : J(v, m);
403
- U[m] = C, process.env.NODE_ENV !== "production" && (K.actions[m] = v), c.actions[m] = v;
404
- } else process.env.NODE_ENV !== "production" && Ye(v) && (K.getters[m] = s ? (
398
+ const g = U[m];
399
+ if (de(g) && !st(g) || Pe(g))
400
+ process.env.NODE_ENV !== "production" && n ? O.value[m] = ne(U, m) : i || (k && no(g) && (de(g) ? g.value = k[m] : qe(g, k[m])), a.state.value[t][m] = g), process.env.NODE_ENV !== "production" && J.state.push(m);
401
+ else if (typeof g == "function") {
402
+ const A = process.env.NODE_ENV !== "production" && n ? g : Z(g, m);
403
+ U[m] = A, process.env.NODE_ENV !== "production" && (J.actions[m] = g), c.actions[m] = g;
404
+ } else process.env.NODE_ENV !== "production" && st(g) && (J.getters[m] = i ? (
405
405
  // @ts-expect-error
406
- t.getters[m]
407
- ) : v, pe && (U._getters || // @ts-expect-error: same
408
- (U._getters = de([]))).push(m));
406
+ o.getters[m]
407
+ ) : g, he && (U._getters || // @ts-expect-error: same
408
+ (U._getters = fe([]))).push(m));
409
409
  }
410
- if (Z(_, U), Z(ct(_), U), Object.defineProperty(_, "$state", {
411
- get: () => process.env.NODE_ENV !== "production" && n ? k.value : a.state.value[o],
410
+ if (Q(E, U), Q(mt(E), U), Object.defineProperty(E, "$state", {
411
+ get: () => process.env.NODE_ENV !== "production" && n ? O.value : a.state.value[t],
412
412
  set: (m) => {
413
413
  if (process.env.NODE_ENV !== "production" && n)
414
414
  throw new Error("cannot set hotState");
415
- P((v) => {
416
- Z(v, m);
415
+ M((g) => {
416
+ Q(g, m);
417
417
  });
418
418
  }
419
- }), process.env.NODE_ENV !== "production" && (_._hotUpdate = de((m) => {
420
- _._hotUpdating = !0, m._hmrPayload.state.forEach((v) => {
421
- if (v in _.$state) {
422
- const C = m.$state[v], F = _.$state[v];
423
- typeof C == "object" && ae(C) && ae(F) ? mt(C, F) : m.$state[v] = F;
419
+ }), process.env.NODE_ENV !== "production" && (E._hotUpdate = fe((m) => {
420
+ E._hotUpdating = !0, m._hmrPayload.state.forEach((g) => {
421
+ if (g in E.$state) {
422
+ const A = m.$state[g], F = E.$state[g];
423
+ typeof A == "object" && se(A) && se(F) ? Et(A, F) : m.$state[g] = F;
424
424
  }
425
- _[v] = ie(m.$state, v);
426
- }), Object.keys(_.$state).forEach((v) => {
427
- v in m.$state || delete _[v];
428
- }), u = !1, p = !1, a.state.value[o] = ie(m._hmrPayload, "hotState"), p = !0, oe().then(() => {
425
+ E[g] = ne(m.$state, g);
426
+ }), Object.keys(E.$state).forEach((g) => {
427
+ g in m.$state || delete E[g];
428
+ }), u = !1, p = !1, a.state.value[t] = ne(m._hmrPayload, "hotState"), p = !0, re().then(() => {
429
429
  u = !0;
430
430
  });
431
- for (const v in m._hmrPayload.actions) {
432
- const C = m[v];
433
- _[v] = //
434
- J(C, v);
431
+ for (const g in m._hmrPayload.actions) {
432
+ const A = m[g];
433
+ E[g] = //
434
+ Z(A, g);
435
435
  }
436
- for (const v in m._hmrPayload.getters) {
437
- const C = m._hmrPayload.getters[v], F = s ? (
436
+ for (const g in m._hmrPayload.getters) {
437
+ const A = m._hmrPayload.getters[g], F = i ? (
438
438
  // special handling of options api
439
- A(() => (Re(a), C.call(_, _)))
440
- ) : C;
441
- _[v] = //
439
+ I(() => (Ae(a), A.call(E, E)))
440
+ ) : A;
441
+ E[g] = //
442
442
  F;
443
443
  }
444
- Object.keys(_._hmrPayload.getters).forEach((v) => {
445
- v in m._hmrPayload.getters || delete _[v];
446
- }), Object.keys(_._hmrPayload.actions).forEach((v) => {
447
- v in m._hmrPayload.actions || delete _[v];
448
- }), _._hmrPayload = m._hmrPayload, _._getters = m._getters, _._hotUpdating = !1;
449
- })), process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && pe) {
444
+ Object.keys(E._hmrPayload.getters).forEach((g) => {
445
+ g in m._hmrPayload.getters || delete E[g];
446
+ }), Object.keys(E._hmrPayload.actions).forEach((g) => {
447
+ g in m._hmrPayload.actions || delete E[g];
448
+ }), E._hmrPayload = m._hmrPayload, E._getters = m._getters, E._hotUpdating = !1;
449
+ })), process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && he) {
450
450
  const m = {
451
451
  writable: !0,
452
452
  configurable: !0,
453
453
  // avoid warning on devtools trying to display this property
454
454
  enumerable: !1
455
455
  };
456
- ["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((v) => {
457
- Object.defineProperty(_, v, Z({ value: _[v] }, m));
456
+ ["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((g) => {
457
+ Object.defineProperty(E, g, Q({ value: E[g] }, m));
458
458
  });
459
459
  }
460
460
  return a._p.forEach((m) => {
461
- if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && pe) {
462
- const v = r.run(() => m({
463
- store: _,
461
+ if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && he) {
462
+ const g = r.run(() => m({
463
+ store: E,
464
464
  app: a._a,
465
465
  pinia: a,
466
466
  options: c
467
467
  }));
468
- Object.keys(v || {}).forEach((C) => _._customProperties.add(C)), Z(_, v);
468
+ Object.keys(g || {}).forEach((A) => E._customProperties.add(A)), Q(E, g);
469
469
  } else
470
- Z(_, r.run(() => m({
471
- store: _,
470
+ Q(E, r.run(() => m({
471
+ store: E,
472
472
  app: a._a,
473
473
  pinia: a,
474
474
  options: c
475
475
  })));
476
- }), process.env.NODE_ENV !== "production" && _.$state && typeof _.$state == "object" && typeof _.$state.constructor == "function" && !_.$state.constructor.toString().includes("[native code]") && console.warn(`[🍍]: The "state" must be a plain object. It cannot be
476
+ }), process.env.NODE_ENV !== "production" && E.$state && typeof E.$state == "object" && typeof E.$state.constructor == "function" && !E.$state.constructor.toString().includes("[native code]") && console.warn(`[🍍]: The "state" must be a plain object. It cannot be
477
477
  state: () => new MyClass()
478
- Found in store "${_.$id}".`), O && s && t.hydrate && t.hydrate(_.$state, O), u = !0, p = !0, _;
478
+ Found in store "${E.$id}".`), k && i && o.hydrate && o.hydrate(E.$state, k), u = !0, p = !0, E;
479
479
  }
480
480
  // @__NO_SIDE_EFFECTS__
481
- function eo(o, e, t) {
481
+ function ro(t, e, o) {
482
482
  let a;
483
483
  const n = typeof e == "function";
484
- a = n ? t : e;
485
- function s(r, c) {
486
- const i = kt();
484
+ a = n ? o : e;
485
+ function i(r, c) {
486
+ const s = Tt();
487
487
  if (r = // in test mode, ignore the argument provided as we can always retrieve a
488
488
  // pinia instance with getActivePinia()
489
- (process.env.NODE_ENV === "test" && ve && ve._testing ? null : r) || (i ? He(Zt, null) : null), r && Re(r), process.env.NODE_ENV !== "production" && !ve)
489
+ (process.env.NODE_ENV === "test" && ge && ge._testing ? null : r) || (s ? Je(to, null) : null), r && Ae(r), process.env.NODE_ENV !== "production" && !ge)
490
490
  throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
491
491
  See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
492
492
  This will fail in production.`);
493
- r = ve, r._s.has(o) || (n ? ze(o, e, a, r) : et(o, a, r), process.env.NODE_ENV !== "production" && (s._pinia = r));
494
- const u = r._s.get(o);
493
+ r = ge, r._s.has(t) || (n ? Ze(t, e, a, r) : it(t, a, r), process.env.NODE_ENV !== "production" && (i._pinia = r));
494
+ const u = r._s.get(t);
495
495
  if (process.env.NODE_ENV !== "production" && c) {
496
- const p = "__hot:" + o, b = n ? ze(p, e, a, r, !0) : et(p, Z({}, a), r, !0);
497
- c._hotUpdate(b), delete r.state.value[p], r._s.delete(p);
496
+ const p = "__hot:" + t, h = n ? Ze(p, e, a, r, !0) : it(p, Q({}, a), r, !0);
497
+ c._hotUpdate(h), delete r.state.value[p], r._s.delete(p);
498
498
  }
499
- if (process.env.NODE_ENV !== "production" && pe) {
500
- const p = ut();
499
+ if (process.env.NODE_ENV !== "production" && he) {
500
+ const p = yt();
501
501
  if (p && p.proxy && // avoid adding stores that are just built for hot module replacement
502
502
  !c) {
503
- const b = p.proxy, w = "_pStores" in b ? b._pStores : b._pStores = {};
504
- w[o] = u;
503
+ const h = p.proxy, b = "_pStores" in h ? h._pStores : h._pStores = {};
504
+ b[t] = u;
505
505
  }
506
506
  }
507
507
  return u;
508
508
  }
509
- return s.$id = o, s;
509
+ return i.$id = t, i;
510
510
  }
511
- function to(o) {
512
- const e = ct(o), t = {};
511
+ function so(t) {
512
+ const e = mt(t), o = {};
513
513
  for (const a in e) {
514
514
  const n = e[a];
515
- n.effect ? t[a] = // ...
516
- A({
517
- get: () => o[a],
518
- set(s) {
519
- o[a] = s;
515
+ n.effect ? o[a] = // ...
516
+ I({
517
+ get: () => t[a],
518
+ set(i) {
519
+ t[a] = i;
520
520
  }
521
- }) : (le(n) || Ae(n)) && (t[a] = // ---
522
- ie(o, a));
521
+ }) : (de(n) || Pe(n)) && (o[a] = // ---
522
+ ne(t, a));
523
523
  }
524
- return t;
524
+ return o;
525
525
  }
526
- const oo = typeof window < "u" && typeof document < "u";
526
+ const io = typeof window < "u" && typeof document < "u";
527
527
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
528
- const ao = Object.prototype.toString, no = (o) => ao.call(o) === "[object Object]", ro = () => {
528
+ const lo = Object.prototype.toString, co = (t) => lo.call(t) === "[object Object]", uo = () => {
529
529
  };
530
- function so(...o) {
531
- if (o.length !== 1) return ie(...o);
532
- const e = o[0];
533
- return typeof e == "function" ? Ge(vt(() => ({
530
+ function po(...t) {
531
+ if (t.length !== 1) return ne(...t);
532
+ const e = t[0];
533
+ return typeof e == "function" ? Ve(et(() => ({
534
534
  get: e,
535
- set: ro
536
- }))) : R(e);
535
+ set: uo
536
+ }))) : C(e);
537
537
  }
538
- function io(o, e) {
539
- function t(...a) {
540
- return new Promise((n, s) => {
541
- Promise.resolve(o(() => e.apply(this, a), {
538
+ function vo(t, e) {
539
+ function o(...a) {
540
+ return new Promise((n, i) => {
541
+ Promise.resolve(t(() => e.apply(this, a), {
542
542
  fn: e,
543
543
  thisArg: this,
544
544
  args: a
545
- })).then(n).catch(s);
545
+ })).then(n).catch(i);
546
546
  });
547
547
  }
548
- return t;
548
+ return o;
549
549
  }
550
- const bt = (o) => o();
551
- function lo(o = bt, e = {}) {
552
- const { initialState: t = "active" } = e, a = so(t === "active");
550
+ const kt = (t) => t();
551
+ function fo(t = kt, e = {}) {
552
+ const { initialState: o = "active" } = e, a = po(o === "active");
553
553
  function n() {
554
554
  a.value = !1;
555
555
  }
556
- function s() {
556
+ function i() {
557
557
  a.value = !0;
558
558
  }
559
559
  const r = (...c) => {
560
- a.value && o(...c);
560
+ a.value && t(...c);
561
561
  };
562
562
  return {
563
- isActive: Ge(a),
563
+ isActive: Ve(a),
564
564
  pause: n,
565
- resume: s,
565
+ resume: i,
566
566
  eventFilter: r
567
567
  };
568
568
  }
569
- function je(o) {
570
- return Array.isArray(o) ? o : [o];
569
+ function Fe(t) {
570
+ return Array.isArray(t) ? t : [t];
571
571
  }
572
- function co(o) {
573
- return ut();
572
+ function ho(t) {
573
+ return yt();
574
574
  }
575
- function uo(o, e, t = {}) {
576
- const { eventFilter: a = bt, ...n } = t;
577
- return H(o, io(a, e), n);
575
+ function go(t, e, o = {}) {
576
+ const { eventFilter: a = kt, ...n } = o;
577
+ return H(t, vo(a, e), n);
578
578
  }
579
- function po(o, e, t = {}) {
580
- const { eventFilter: a, initialState: n = "active", ...s } = t, { eventFilter: r, pause: c, resume: i, isActive: u } = lo(a, { initialState: n });
579
+ function mo(t, e, o = {}) {
580
+ const { eventFilter: a, initialState: n = "active", ...i } = o, { eventFilter: r, pause: c, resume: s, isActive: u } = fo(a, { initialState: n });
581
581
  return {
582
- stop: uo(o, e, {
583
- ...s,
582
+ stop: go(t, e, {
583
+ ...i,
584
584
  eventFilter: r
585
585
  }),
586
586
  pause: c,
587
- resume: i,
587
+ resume: s,
588
588
  isActive: u
589
589
  };
590
590
  }
591
- const vo = po;
592
- function fo(o, e = !0, t) {
593
- co() ? Te(o, t) : e ? o() : oe(o);
591
+ const yo = mo;
592
+ function bo(t, e = !0, o) {
593
+ ho() ? xe(t, o) : e ? t() : re(t);
594
594
  }
595
- function ho(o, e, t) {
596
- return H(o, e, {
597
- ...t,
595
+ function wo(t, e, o) {
596
+ return H(t, e, {
597
+ ...o,
598
598
  immediate: !0
599
599
  });
600
600
  }
601
- const Ce = oo ? window : void 0;
602
- function go(o) {
601
+ const Ie = io ? window : void 0;
602
+ function So(t) {
603
603
  var e;
604
- const t = ee(o);
605
- return (e = t?.$el) !== null && e !== void 0 ? e : t;
604
+ const o = X(t);
605
+ return (e = o?.$el) !== null && e !== void 0 ? e : o;
606
606
  }
607
- function tt(...o) {
608
- const e = (a, n, s, r) => (a.addEventListener(n, s, r), () => a.removeEventListener(n, s, r)), t = A(() => {
609
- const a = je(ee(o[0])).filter((n) => n != null);
607
+ function lt(...t) {
608
+ const e = (a, n, i, r) => (a.addEventListener(n, i, r), () => a.removeEventListener(n, i, r)), o = I(() => {
609
+ const a = Fe(X(t[0])).filter((n) => n != null);
610
610
  return a.every((n) => typeof n != "string") ? a : void 0;
611
611
  });
612
- return ho(() => {
612
+ return wo(() => {
613
613
  var a, n;
614
614
  return [
615
- (a = (n = t.value) === null || n === void 0 ? void 0 : n.map((s) => go(s))) !== null && a !== void 0 ? a : [Ce].filter((s) => s != null),
616
- je(ee(t.value ? o[1] : o[0])),
617
- je(Oe(t.value ? o[2] : o[1])),
618
- ee(t.value ? o[3] : o[2])
615
+ (a = (n = o.value) === null || n === void 0 ? void 0 : n.map((i) => So(i))) !== null && a !== void 0 ? a : [Ie].filter((i) => i != null),
616
+ Fe(X(o.value ? t[1] : t[0])),
617
+ Fe(Ne(o.value ? t[2] : t[1])),
618
+ X(o.value ? t[3] : t[2])
619
619
  ];
620
- }, ([a, n, s, r], c, i) => {
621
- if (!a?.length || !n?.length || !s?.length) return;
622
- const u = no(r) ? { ...r } : r, p = a.flatMap((b) => n.flatMap((w) => s.map((N) => e(b, w, N, u))));
623
- i(() => {
624
- p.forEach((b) => b());
620
+ }, ([a, n, i, r], c, s) => {
621
+ if (!a?.length || !n?.length || !i?.length) return;
622
+ const u = co(r) ? { ...r } : r, p = a.flatMap((h) => n.flatMap((b) => i.map((D) => e(h, b, D, u))));
623
+ s(() => {
624
+ p.forEach((h) => h());
625
625
  });
626
626
  }, { flush: "post" });
627
627
  }
628
- const Se = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, $e = "__vueuse_ssr_handlers__", mo = /* @__PURE__ */ yo();
629
- function yo() {
630
- return $e in Se || (Se[$e] = Se[$e] || {}), Se[$e];
628
+ const _e = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, ke = "__vueuse_ssr_handlers__", $o = /* @__PURE__ */ Eo();
629
+ function Eo() {
630
+ return ke in _e || (_e[ke] = _e[ke] || {}), _e[ke];
631
631
  }
632
- function bo(o, e) {
633
- return mo[o] || e;
632
+ function _o(t, e) {
633
+ return $o[t] || e;
634
634
  }
635
- function wo(o) {
636
- 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";
635
+ function ko(t) {
636
+ return t == null ? "any" : t instanceof Set ? "set" : t instanceof Map ? "map" : t instanceof Date ? "date" : typeof t == "boolean" ? "boolean" : typeof t == "string" ? "string" : typeof t == "object" ? "object" : Number.isNaN(t) ? "any" : "number";
637
637
  }
638
- const So = {
638
+ const Do = {
639
639
  boolean: {
640
- read: (o) => o === "true",
641
- write: (o) => String(o)
640
+ read: (t) => t === "true",
641
+ write: (t) => String(t)
642
642
  },
643
643
  object: {
644
- read: (o) => JSON.parse(o),
645
- write: (o) => JSON.stringify(o)
644
+ read: (t) => JSON.parse(t),
645
+ write: (t) => JSON.stringify(t)
646
646
  },
647
647
  number: {
648
- read: (o) => Number.parseFloat(o),
649
- write: (o) => String(o)
648
+ read: (t) => Number.parseFloat(t),
649
+ write: (t) => String(t)
650
650
  },
651
651
  any: {
652
- read: (o) => o,
653
- write: (o) => String(o)
652
+ read: (t) => t,
653
+ write: (t) => String(t)
654
654
  },
655
655
  string: {
656
- read: (o) => o,
657
- write: (o) => String(o)
656
+ read: (t) => t,
657
+ write: (t) => String(t)
658
658
  },
659
659
  map: {
660
- read: (o) => new Map(JSON.parse(o)),
661
- write: (o) => JSON.stringify(Array.from(o.entries()))
660
+ read: (t) => new Map(JSON.parse(t)),
661
+ write: (t) => JSON.stringify(Array.from(t.entries()))
662
662
  },
663
663
  set: {
664
- read: (o) => new Set(JSON.parse(o)),
665
- write: (o) => JSON.stringify(Array.from(o))
664
+ read: (t) => new Set(JSON.parse(t)),
665
+ write: (t) => JSON.stringify(Array.from(t))
666
666
  },
667
667
  date: {
668
- read: (o) => new Date(o),
669
- write: (o) => o.toISOString()
668
+ read: (t) => new Date(t),
669
+ write: (t) => t.toISOString()
670
670
  }
671
- }, ot = "vueuse-storage";
672
- function $o(o, e, t, a = {}) {
671
+ }, ct = "vueuse-storage";
672
+ function No(t, e, o, a = {}) {
673
673
  var n;
674
- const { flush: s = "pre", deep: r = !0, listenToStorageChanges: c = !0, writeDefaults: i = !0, mergeDefaults: u = !1, shallow: p, window: b = Ce, eventFilter: w, onError: N = (h) => {
675
- console.error(h);
676
- }, initOnMounted: O } = a, k = (p ? Je : R)(e), V = A(() => ee(o));
677
- if (!t) try {
678
- t = bo("getDefaultStorage", () => Ce?.localStorage)();
679
- } catch (h) {
680
- N(h);
681
- }
682
- if (!t) return k;
683
- const P = ee(e), x = wo(P), W = (n = a.serializer) !== null && n !== void 0 ? n : So[x], { pause: J, resume: K } = vo(k, (h) => v(h), {
684
- flush: s,
674
+ const { flush: i = "pre", deep: r = !0, listenToStorageChanges: c = !0, writeDefaults: s = !0, mergeDefaults: u = !1, shallow: p, window: h = Ie, eventFilter: b, onError: D = (N) => {
675
+ console.error(N);
676
+ }, initOnMounted: k } = a, O = (p ? $e : C)(e), V = I(() => X(t));
677
+ if (!o) try {
678
+ o = _o("getDefaultStorage", () => Ie?.localStorage)();
679
+ } catch (N) {
680
+ D(N);
681
+ }
682
+ if (!o) return O;
683
+ const M = X(e), x = ko(M), W = (n = a.serializer) !== null && n !== void 0 ? n : Do[x], { pause: Z, resume: J } = yo(O, (N) => g(N), {
684
+ flush: i,
685
685
  deep: r,
686
- eventFilter: w
686
+ eventFilter: b
687
687
  });
688
- H(V, () => F(), { flush: s });
689
- let z = !1;
690
- const _ = (h) => {
691
- O && !z || F(h);
692
- }, U = (h) => {
693
- O && !z || E(h);
688
+ H(V, () => F(), { flush: i });
689
+ let K = !1;
690
+ const E = (N) => {
691
+ k && !K || F(N);
692
+ }, U = (N) => {
693
+ k && !K || G(N);
694
694
  };
695
- b && c && (t instanceof Storage ? tt(b, "storage", _, { passive: !0 }) : tt(b, ot, U)), O ? fo(() => {
696
- z = !0, F();
695
+ h && c && (o instanceof Storage ? lt(h, "storage", E, { passive: !0 }) : lt(h, ct, U)), k ? bo(() => {
696
+ K = !0, F();
697
697
  }) : F();
698
- function m(h, $) {
699
- if (b) {
700
- const D = {
698
+ function m(N, P) {
699
+ if (h) {
700
+ const B = {
701
701
  key: V.value,
702
- oldValue: h,
703
- newValue: $,
704
- storageArea: t
702
+ oldValue: N,
703
+ newValue: P,
704
+ storageArea: o
705
705
  };
706
- b.dispatchEvent(t instanceof Storage ? new StorageEvent("storage", D) : new CustomEvent(ot, { detail: D }));
706
+ h.dispatchEvent(o instanceof Storage ? new StorageEvent("storage", B) : new CustomEvent(ct, { detail: B }));
707
707
  }
708
708
  }
709
- function v(h) {
709
+ function g(N) {
710
710
  try {
711
- const $ = t.getItem(V.value);
712
- if (h == null)
713
- m($, null), t.removeItem(V.value);
711
+ const P = o.getItem(V.value);
712
+ if (N == null)
713
+ m(P, null), o.removeItem(V.value);
714
714
  else {
715
- const D = W.write(h);
716
- $ !== D && (t.setItem(V.value, D), m($, D));
715
+ const B = W.write(N);
716
+ P !== B && (o.setItem(V.value, B), m(P, B));
717
717
  }
718
- } catch ($) {
719
- N($);
718
+ } catch (P) {
719
+ D(P);
720
720
  }
721
721
  }
722
- function C(h) {
723
- const $ = h ? h.newValue : t.getItem(V.value);
724
- if ($ == null)
725
- return i && P != null && t.setItem(V.value, W.write(P)), P;
726
- if (!h && u) {
727
- const D = W.read($);
728
- return typeof u == "function" ? u(D, P) : x === "object" && !Array.isArray(D) ? {
729
- ...P,
730
- ...D
731
- } : D;
732
- } else return typeof $ != "string" ? $ : W.read($);
733
- }
734
- function F(h) {
735
- if (!(h && h.storageArea !== t)) {
736
- if (h && h.key == null) {
737
- k.value = P;
722
+ function A(N) {
723
+ const P = N ? N.newValue : o.getItem(V.value);
724
+ if (P == null)
725
+ return s && M != null && o.setItem(V.value, W.write(M)), M;
726
+ if (!N && u) {
727
+ const B = W.read(P);
728
+ return typeof u == "function" ? u(B, M) : x === "object" && !Array.isArray(B) ? {
729
+ ...M,
730
+ ...B
731
+ } : B;
732
+ } else return typeof P != "string" ? P : W.read(P);
733
+ }
734
+ function F(N) {
735
+ if (!(N && N.storageArea !== o)) {
736
+ if (N && N.key == null) {
737
+ O.value = M;
738
738
  return;
739
739
  }
740
- if (!(h && h.key !== V.value)) {
741
- J();
740
+ if (!(N && N.key !== V.value)) {
741
+ Z();
742
742
  try {
743
- const $ = W.write(k.value);
744
- (h === void 0 || h?.newValue !== $) && (k.value = C(h));
745
- } catch ($) {
746
- N($);
743
+ const P = W.write(O.value);
744
+ (N === void 0 || N?.newValue !== P) && (O.value = A(N));
745
+ } catch (P) {
746
+ D(P);
747
747
  } finally {
748
- h ? oe(K) : K();
748
+ N ? re(J) : J();
749
749
  }
750
750
  }
751
751
  }
752
752
  }
753
- function E(h) {
754
- F(h.detail);
753
+ function G(N) {
754
+ F(N.detail);
755
755
  }
756
- return k;
756
+ return O;
757
757
  }
758
- function _o(o, e, t = {}) {
759
- const { window: a = Ce } = t;
760
- return $o(o, e, a?.localStorage, t);
758
+ function Oo(t, e, o = {}) {
759
+ const { window: a = Ie } = o;
760
+ return No(t, e, a?.localStorage, o);
761
761
  }
762
- function Le() {
762
+ function Be() {
763
763
  return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
764
764
  }
765
- function _e(o) {
765
+ function De(t) {
766
766
  const e = {
767
- type: o.type,
768
- clientId: o.clientId,
769
- timestamp: o.timestamp.toISOString()
770
- };
771
- return o.operation && (e.operation = {
772
- ...o.operation,
773
- timestamp: o.operation.timestamp.toISOString()
774
- }), o.operations && (e.operations = o.operations.map((t) => ({
775
- ...t,
767
+ type: t.type,
768
+ clientId: t.clientId,
776
769
  timestamp: t.timestamp.toISOString()
770
+ };
771
+ return t.operation && (e.operation = {
772
+ ...t.operation,
773
+ timestamp: t.operation.timestamp.toISOString()
774
+ }), t.operations && (e.operations = t.operations.map((o) => ({
775
+ ...o,
776
+ timestamp: o.timestamp.toISOString()
777
777
  }))), e;
778
778
  }
779
- function Eo(o) {
779
+ function Ro(t) {
780
780
  const e = {
781
- type: o.type,
782
- clientId: o.clientId,
783
- timestamp: new Date(o.timestamp)
784
- };
785
- return o.operation && (e.operation = {
786
- ...o.operation,
787
- timestamp: new Date(o.operation.timestamp)
788
- }), o.operations && (e.operations = o.operations.map((t) => ({
789
- ...t,
781
+ type: t.type,
782
+ clientId: t.clientId,
790
783
  timestamp: new Date(t.timestamp)
784
+ };
785
+ return t.operation && (e.operation = {
786
+ ...t.operation,
787
+ timestamp: new Date(t.operation.timestamp)
788
+ }), t.operations && (e.operations = t.operations.map((o) => ({
789
+ ...o,
790
+ timestamp: new Date(o.timestamp)
791
791
  }))), e;
792
792
  }
793
- const wt = /* @__PURE__ */ eo("hst-operation-log", () => {
794
- const o = R({
793
+ const Dt = /* @__PURE__ */ ro("hst-operation-log", () => {
794
+ const t = C({
795
795
  maxOperations: 100,
796
796
  enableCrossTabSync: !0,
797
797
  autoSyncInterval: 3e4,
798
798
  enablePersistence: !1,
799
799
  persistenceKeyPrefix: "stonecrop-ops"
800
- }), e = R([]), t = R(-1), a = R(Le()), n = R(!1), s = R([]), r = R(null), c = A(() => t.value < 0 ? !1 : e.value[t.value]?.reversible ?? !1), i = A(() => t.value < e.value.length - 1), u = A(() => {
801
- let g = 0;
802
- for (let f = t.value; f >= 0 && e.value[f]?.reversible; f--)
803
- g++;
804
- return g;
805
- }), p = A(() => e.value.length - 1 - t.value), b = A(() => ({
800
+ }), e = C([]), o = C(-1), a = C(Be()), n = C(!1), i = C([]), r = C(null), c = I(() => o.value < 0 ? !1 : e.value[o.value]?.reversible ?? !1), s = I(() => o.value < e.value.length - 1), u = I(() => {
801
+ let v = 0;
802
+ for (let f = o.value; f >= 0 && e.value[f]?.reversible; f--)
803
+ v++;
804
+ return v;
805
+ }), p = I(() => e.value.length - 1 - o.value), h = I(() => ({
806
806
  canUndo: c.value,
807
- canRedo: i.value,
807
+ canRedo: s.value,
808
808
  undoCount: u.value,
809
809
  redoCount: p.value,
810
- currentIndex: t.value
810
+ currentIndex: o.value
811
811
  }));
812
- function w(g) {
813
- o.value = { ...o.value, ...g }, o.value.enablePersistence && (j(), G()), o.value.enableCrossTabSync && C();
812
+ function b(v) {
813
+ t.value = { ...t.value, ...v }, t.value.enablePersistence && (w(), _()), t.value.enableCrossTabSync && A();
814
814
  }
815
- function N(g, f = "user") {
815
+ function D(v, f = "user") {
816
816
  const y = {
817
- ...g,
818
- id: Le(),
817
+ ...v,
818
+ id: Be(),
819
819
  timestamp: /* @__PURE__ */ new Date(),
820
820
  source: f,
821
- userId: o.value.userId
821
+ userId: t.value.userId
822
822
  };
823
- if (o.value.operationFilter && !o.value.operationFilter(y))
823
+ if (t.value.operationFilter && !t.value.operationFilter(y))
824
824
  return y.id;
825
825
  if (n.value)
826
- return s.value.push(y), y.id;
827
- if (t.value < e.value.length - 1 && (e.value = e.value.slice(0, t.value + 1)), e.value.push(y), t.value++, o.value.maxOperations && e.value.length > o.value.maxOperations) {
828
- const l = e.value.length - o.value.maxOperations;
829
- e.value = e.value.slice(l), t.value -= l;
826
+ return i.value.push(y), y.id;
827
+ if (o.value < e.value.length - 1 && (e.value = e.value.slice(0, o.value + 1)), e.value.push(y), o.value++, t.value.maxOperations && e.value.length > t.value.maxOperations) {
828
+ const l = e.value.length - t.value.maxOperations;
829
+ e.value = e.value.slice(l), o.value -= l;
830
830
  }
831
- return o.value.enableCrossTabSync && F(y), y.id;
831
+ return t.value.enableCrossTabSync && F(y), y.id;
832
832
  }
833
- function O() {
834
- n.value = !0, s.value = [], r.value = Le();
833
+ function k() {
834
+ n.value = !0, i.value = [], r.value = Be();
835
835
  }
836
- function k(g) {
837
- if (!n.value || s.value.length === 0)
838
- return n.value = !1, s.value = [], r.value = null, null;
839
- const f = r.value, y = s.value.every((S) => S.reversible), l = {
836
+ function O(v) {
837
+ if (!n.value || i.value.length === 0)
838
+ return n.value = !1, i.value = [], r.value = null, null;
839
+ const f = r.value, y = i.value.every((S) => S.reversible), l = {
840
840
  id: f,
841
841
  type: "batch",
842
842
  path: "",
@@ -844,93 +844,93 @@ const wt = /* @__PURE__ */ eo("hst-operation-log", () => {
844
844
  fieldname: "",
845
845
  beforeValue: null,
846
846
  afterValue: null,
847
- doctype: s.value[0]?.doctype || "",
847
+ doctype: i.value[0]?.doctype || "",
848
848
  timestamp: /* @__PURE__ */ new Date(),
849
849
  source: "user",
850
850
  reversible: y,
851
851
  irreversibleReason: y ? void 0 : "Contains irreversible operations",
852
- childOperationIds: s.value.map((S) => S.id),
853
- metadata: { description: g }
852
+ childOperationIds: i.value.map((S) => S.id),
853
+ metadata: { description: v }
854
854
  };
855
- s.value.forEach((S) => {
855
+ i.value.forEach((S) => {
856
856
  S.parentOperationId = f;
857
- }), e.value.push(...s.value, l), t.value = e.value.length - 1, o.value.enableCrossTabSync && E(s.value, l);
857
+ }), e.value.push(...i.value, l), o.value = e.value.length - 1, t.value.enableCrossTabSync && G(i.value, l);
858
858
  const d = f;
859
- return n.value = !1, s.value = [], r.value = null, d;
859
+ return n.value = !1, i.value = [], r.value = null, d;
860
860
  }
861
861
  function V() {
862
- n.value = !1, s.value = [], r.value = null;
862
+ n.value = !1, i.value = [], r.value = null;
863
863
  }
864
- function P(g) {
864
+ function M(v) {
865
865
  if (!c.value) return !1;
866
- const f = e.value[t.value];
866
+ const f = e.value[o.value];
867
867
  if (!f.reversible)
868
868
  return typeof console < "u" && f.irreversibleReason && console.warn("Cannot undo irreversible operation:", f.irreversibleReason), !1;
869
869
  try {
870
870
  if (f.type === "batch" && f.childOperationIds)
871
871
  for (let y = f.childOperationIds.length - 1; y >= 0; y--) {
872
872
  const l = f.childOperationIds[y], d = e.value.find((S) => S.id === l);
873
- d && W(d, g);
873
+ d && W(d, v);
874
874
  }
875
875
  else
876
- W(f, g);
877
- return t.value--, o.value.enableCrossTabSync && h(f), !0;
876
+ W(f, v);
877
+ return o.value--, t.value.enableCrossTabSync && N(f), !0;
878
878
  } catch (y) {
879
879
  return typeof console < "u" && console.error("Undo failed:", y), !1;
880
880
  }
881
881
  }
882
- function x(g) {
883
- if (!i.value) return !1;
884
- const f = e.value[t.value + 1];
882
+ function x(v) {
883
+ if (!s.value) return !1;
884
+ const f = e.value[o.value + 1];
885
885
  try {
886
886
  if (f.type === "batch" && f.childOperationIds)
887
887
  for (const y of f.childOperationIds) {
888
888
  const l = e.value.find((d) => d.id === y);
889
- l && J(l, g);
889
+ l && Z(l, v);
890
890
  }
891
891
  else
892
- J(f, g);
893
- return t.value++, o.value.enableCrossTabSync && $(f), !0;
892
+ Z(f, v);
893
+ return o.value++, t.value.enableCrossTabSync && P(f), !0;
894
894
  } catch (y) {
895
895
  return typeof console < "u" && console.error("Redo failed:", y), !1;
896
896
  }
897
897
  }
898
- function W(g, f) {
899
- (g.type === "set" || g.type === "delete") && f && typeof f.set == "function" && f.set(g.path, g.beforeValue, "undo");
898
+ function W(v, f) {
899
+ (v.type === "set" || v.type === "delete") && f && typeof f.set == "function" && f.set(v.path, v.beforeValue, "undo");
900
900
  }
901
- function J(g, f) {
902
- (g.type === "set" || g.type === "delete") && f && typeof f.set == "function" && f.set(g.path, g.afterValue, "redo");
901
+ function Z(v, f) {
902
+ (v.type === "set" || v.type === "delete") && f && typeof f.set == "function" && f.set(v.path, v.afterValue, "redo");
903
903
  }
904
- function K() {
905
- const g = e.value.filter((y) => y.reversible).length, f = e.value.map((y) => y.timestamp);
904
+ function J() {
905
+ const v = e.value.filter((y) => y.reversible).length, f = e.value.map((y) => y.timestamp);
906
906
  return {
907
907
  operations: [...e.value],
908
- currentIndex: t.value,
908
+ currentIndex: o.value,
909
909
  totalOperations: e.value.length,
910
- reversibleOperations: g,
911
- irreversibleOperations: e.value.length - g,
910
+ reversibleOperations: v,
911
+ irreversibleOperations: e.value.length - v,
912
912
  oldestOperation: f.length > 0 ? new Date(Math.min(...f.map((y) => y.getTime()))) : void 0,
913
913
  newestOperation: f.length > 0 ? new Date(Math.max(...f.map((y) => y.getTime()))) : void 0
914
914
  };
915
915
  }
916
- function z() {
917
- e.value = [], t.value = -1;
916
+ function K() {
917
+ e.value = [], o.value = -1;
918
918
  }
919
- function _(g, f) {
920
- return e.value.filter((y) => y.doctype === g && (f === void 0 || y.recordId === f));
919
+ function E(v, f) {
920
+ return e.value.filter((y) => y.doctype === v && (f === void 0 || y.recordId === f));
921
921
  }
922
- function U(g, f) {
923
- const y = e.value.find((l) => l.id === g);
922
+ function U(v, f) {
923
+ const y = e.value.find((l) => l.id === v);
924
924
  y && (y.reversible = !1, y.irreversibleReason = f);
925
925
  }
926
- function m(g, f, y, l = "success", d) {
926
+ function m(v, f, y, l = "success", d) {
927
927
  const S = {
928
928
  type: "action",
929
- path: y && y.length > 0 ? `${g}.${y[0]}` : g,
929
+ path: y && y.length > 0 ? `${v}.${y[0]}` : v,
930
930
  fieldname: "",
931
931
  beforeValue: null,
932
932
  afterValue: null,
933
- doctype: g,
933
+ doctype: v,
934
934
  recordId: y && y.length > 0 ? y[0] : void 0,
935
935
  reversible: !1,
936
936
  // Actions are typically not reversible
@@ -939,100 +939,100 @@ const wt = /* @__PURE__ */ eo("hst-operation-log", () => {
939
939
  actionResult: l,
940
940
  actionError: d
941
941
  };
942
- return N(S);
942
+ return D(S);
943
943
  }
944
- let v = null;
945
- function C() {
946
- typeof window > "u" || !window.BroadcastChannel || (v = new BroadcastChannel("stonecrop-operation-log"), v.addEventListener("message", (g) => {
947
- const f = g.data;
944
+ let g = null;
945
+ function A() {
946
+ typeof window > "u" || !window.BroadcastChannel || (g = new BroadcastChannel("stonecrop-operation-log"), g.addEventListener("message", (v) => {
947
+ const f = v.data;
948
948
  if (!f || typeof f != "object") return;
949
- const y = Eo(f);
950
- y.clientId !== a.value && (y.type === "operation" && y.operation ? (e.value.push({ ...y.operation, source: "sync" }), t.value = e.value.length - 1) : y.type === "operation" && y.operations && (e.value.push(...y.operations.map((l) => ({ ...l, source: "sync" }))), t.value = e.value.length - 1));
949
+ const y = Ro(f);
950
+ y.clientId !== a.value && (y.type === "operation" && y.operation ? (e.value.push({ ...y.operation, source: "sync" }), o.value = e.value.length - 1) : y.type === "operation" && y.operations && (e.value.push(...y.operations.map((l) => ({ ...l, source: "sync" }))), o.value = e.value.length - 1));
951
951
  }));
952
952
  }
953
- function F(g) {
954
- if (!v) return;
953
+ function F(v) {
954
+ if (!g) return;
955
955
  const f = {
956
956
  type: "operation",
957
- operation: g,
957
+ operation: v,
958
958
  clientId: a.value,
959
959
  timestamp: /* @__PURE__ */ new Date()
960
960
  };
961
- v.postMessage(_e(f));
961
+ g.postMessage(De(f));
962
962
  }
963
- function E(g, f) {
964
- if (!v) return;
963
+ function G(v, f) {
964
+ if (!g) return;
965
965
  const y = {
966
966
  type: "operation",
967
- operations: [...g, f],
967
+ operations: [...v, f],
968
968
  clientId: a.value,
969
969
  timestamp: /* @__PURE__ */ new Date()
970
970
  };
971
- v.postMessage(_e(y));
971
+ g.postMessage(De(y));
972
972
  }
973
- function h(g) {
974
- if (!v) return;
973
+ function N(v) {
974
+ if (!g) return;
975
975
  const f = {
976
976
  type: "undo",
977
- operation: g,
977
+ operation: v,
978
978
  clientId: a.value,
979
979
  timestamp: /* @__PURE__ */ new Date()
980
980
  };
981
- v.postMessage(_e(f));
981
+ g.postMessage(De(f));
982
982
  }
983
- function $(g) {
984
- if (!v) return;
983
+ function P(v) {
984
+ if (!g) return;
985
985
  const f = {
986
986
  type: "redo",
987
- operation: g,
987
+ operation: v,
988
988
  clientId: a.value,
989
989
  timestamp: /* @__PURE__ */ new Date()
990
990
  };
991
- v.postMessage(_e(f));
991
+ g.postMessage(De(f));
992
992
  }
993
- const D = _o("stonecrop-ops-operations", null, {
993
+ const B = Oo("stonecrop-ops-operations", null, {
994
994
  serializer: {
995
- read: (g) => {
995
+ read: (v) => {
996
996
  try {
997
- return JSON.parse(g);
997
+ return JSON.parse(v);
998
998
  } catch {
999
999
  return null;
1000
1000
  }
1001
1001
  },
1002
- write: (g) => g ? JSON.stringify(g) : ""
1002
+ write: (v) => v ? JSON.stringify(v) : ""
1003
1003
  }
1004
1004
  });
1005
- function j() {
1005
+ function w() {
1006
1006
  if (!(typeof window > "u"))
1007
1007
  try {
1008
- const g = D.value;
1009
- g && Array.isArray(g.operations) && (e.value = g.operations.map((f) => ({
1008
+ const v = B.value;
1009
+ v && Array.isArray(v.operations) && (e.value = v.operations.map((f) => ({
1010
1010
  ...f,
1011
1011
  timestamp: new Date(f.timestamp)
1012
- })), t.value = g.currentIndex ?? -1);
1013
- } catch (g) {
1014
- typeof console < "u" && console.error("Failed to load operations from persistence:", g);
1012
+ })), o.value = v.currentIndex ?? -1);
1013
+ } catch (v) {
1014
+ typeof console < "u" && console.error("Failed to load operations from persistence:", v);
1015
1015
  }
1016
1016
  }
1017
- function B() {
1017
+ function $() {
1018
1018
  if (!(typeof window > "u"))
1019
1019
  try {
1020
- D.value = {
1021
- operations: e.value.map((g) => ({
1022
- ...g,
1023
- timestamp: g.timestamp.toISOString()
1020
+ B.value = {
1021
+ operations: e.value.map((v) => ({
1022
+ ...v,
1023
+ timestamp: v.timestamp.toISOString()
1024
1024
  })),
1025
- currentIndex: t.value
1025
+ currentIndex: o.value
1026
1026
  };
1027
- } catch (g) {
1028
- typeof console < "u" && console.error("Failed to save operations to persistence:", g);
1027
+ } catch (v) {
1028
+ typeof console < "u" && console.error("Failed to save operations to persistence:", v);
1029
1029
  }
1030
1030
  }
1031
- function G() {
1031
+ function _() {
1032
1032
  H(
1033
- [e, t],
1033
+ [e, o],
1034
1034
  () => {
1035
- o.value.enablePersistence && B();
1035
+ t.value.enablePersistence && $();
1036
1036
  },
1037
1037
  { deep: !0 }
1038
1038
  );
@@ -1040,31 +1040,31 @@ const wt = /* @__PURE__ */ eo("hst-operation-log", () => {
1040
1040
  return {
1041
1041
  // State
1042
1042
  operations: e,
1043
- currentIndex: t,
1044
- config: o,
1043
+ currentIndex: o,
1044
+ config: t,
1045
1045
  clientId: a,
1046
- undoRedoState: b,
1046
+ undoRedoState: h,
1047
1047
  // Computed
1048
1048
  canUndo: c,
1049
- canRedo: i,
1049
+ canRedo: s,
1050
1050
  undoCount: u,
1051
1051
  redoCount: p,
1052
1052
  // Methods
1053
- configure: w,
1054
- addOperation: N,
1055
- startBatch: O,
1056
- commitBatch: k,
1053
+ configure: b,
1054
+ addOperation: D,
1055
+ startBatch: k,
1056
+ commitBatch: O,
1057
1057
  cancelBatch: V,
1058
- undo: P,
1058
+ undo: M,
1059
1059
  redo: x,
1060
- clear: z,
1061
- getOperationsFor: _,
1062
- getSnapshot: K,
1060
+ clear: K,
1061
+ getOperationsFor: E,
1062
+ getSnapshot: J,
1063
1063
  markIrreversible: U,
1064
1064
  logAction: m
1065
1065
  };
1066
1066
  });
1067
- class ge {
1067
+ class ye {
1068
1068
  /**
1069
1069
  * The root FieldTriggerEngine instance
1070
1070
  */
@@ -1085,9 +1085,9 @@ class ge {
1085
1085
  * @param options - Configuration options for the field trigger engine
1086
1086
  */
1087
1087
  constructor(e = {}) {
1088
- if (ge._root)
1089
- return ge._root;
1090
- ge._root = this, this.options = {
1088
+ if (ye._root)
1089
+ return ye._root;
1090
+ ye._root = this, this.options = {
1091
1091
  defaultTimeout: e.defaultTimeout ?? 5e3,
1092
1092
  debug: e.debug ?? !1,
1093
1093
  enableRollback: e.enableRollback ?? !0,
@@ -1099,16 +1099,16 @@ class ge {
1099
1099
  * @param name - The name of the action
1100
1100
  * @param fn - The action function
1101
1101
  */
1102
- registerAction(e, t) {
1103
- this.globalActions.set(e, t);
1102
+ registerAction(e, o) {
1103
+ this.globalActions.set(e, o);
1104
1104
  }
1105
1105
  /**
1106
1106
  * Register a global XState transition action function
1107
1107
  * @param name - The name of the transition action
1108
1108
  * @param fn - The transition action function
1109
1109
  */
1110
- registerTransitionAction(e, t) {
1111
- this.globalTransitionActions.set(e, t);
1110
+ registerTransitionAction(e, o) {
1111
+ this.globalTransitionActions.set(e, o);
1112
1112
  }
1113
1113
  /**
1114
1114
  * Configure rollback behavior for a specific field trigger
@@ -1116,14 +1116,14 @@ class ge {
1116
1116
  * @param fieldname - The field name
1117
1117
  * @param enableRollback - Whether to enable rollback
1118
1118
  */
1119
- setFieldRollback(e, t, a) {
1120
- this.fieldRollbackConfig.has(e) || this.fieldRollbackConfig.set(e, /* @__PURE__ */ new Map()), this.fieldRollbackConfig.get(e).set(t, a);
1119
+ setFieldRollback(e, o, a) {
1120
+ this.fieldRollbackConfig.has(e) || this.fieldRollbackConfig.set(e, /* @__PURE__ */ new Map()), this.fieldRollbackConfig.get(e).set(o, a);
1121
1121
  }
1122
1122
  /**
1123
1123
  * Get rollback configuration for a specific field trigger
1124
1124
  */
1125
- getFieldRollback(e, t) {
1126
- return this.fieldRollbackConfig.get(e)?.get(t);
1125
+ getFieldRollback(e, o) {
1126
+ return this.fieldRollbackConfig.get(e)?.get(o);
1127
1127
  }
1128
1128
  /**
1129
1129
  * Register actions from a doctype - both regular actions and field triggers
@@ -1131,18 +1131,18 @@ class ge {
1131
1131
  * @param doctype - The doctype name
1132
1132
  * @param actions - The actions to register (supports Immutable Map, Map, or plain object)
1133
1133
  */
1134
- registerDoctypeActions(e, t) {
1135
- if (!t) return;
1134
+ registerDoctypeActions(e, o) {
1135
+ if (!o) return;
1136
1136
  const a = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
1137
- if (typeof t.entrySeq == "function")
1138
- t.entrySeq().forEach(([s, r]) => {
1139
- this.categorizeAction(s, r, a, n);
1137
+ if (typeof o.entrySeq == "function")
1138
+ o.entrySeq().forEach(([i, r]) => {
1139
+ this.categorizeAction(i, r, a, n);
1140
1140
  });
1141
- else if (t instanceof Map)
1142
- for (const [s, r] of t)
1143
- this.categorizeAction(s, r, a, n);
1144
- else t && typeof t == "object" && Object.entries(t).forEach(([s, r]) => {
1145
- this.categorizeAction(s, r, a, n);
1141
+ else if (o instanceof Map)
1142
+ for (const [i, r] of o)
1143
+ this.categorizeAction(i, r, a, n);
1144
+ else o && typeof o == "object" && Object.entries(o).forEach(([i, r]) => {
1145
+ this.categorizeAction(i, r, a, n);
1146
1146
  });
1147
1147
  this.doctypeActions.set(e, a), this.doctypeTransitions.set(e, n);
1148
1148
  }
@@ -1150,8 +1150,8 @@ class ge {
1150
1150
  * Categorize an action as either a field trigger or XState transition
1151
1151
  * Uses uppercase convention: UPPERCASE = transition, lowercase/mixed = field trigger
1152
1152
  */
1153
- categorizeAction(e, t, a, n) {
1154
- this.isTransitionKey(e) ? n.set(e, t) : a.set(e, t);
1153
+ categorizeAction(e, o, a, n) {
1154
+ this.isTransitionKey(e) ? n.set(e, o) : a.set(e, o);
1155
1155
  }
1156
1156
  /**
1157
1157
  * Determine if a key represents an XState transition
@@ -1165,9 +1165,9 @@ class ge {
1165
1165
  * @param context - The field change context
1166
1166
  * @param options - Execution options (timeout and enableRollback)
1167
1167
  */
1168
- async executeFieldTriggers(e, t = {}) {
1169
- const { doctype: a, fieldname: n } = e, s = this.findFieldTriggers(a, n);
1170
- if (s.length === 0)
1168
+ async executeFieldTriggers(e, o = {}) {
1169
+ const { doctype: a, fieldname: n } = e, i = this.findFieldTriggers(a, n);
1170
+ if (i.length === 0)
1171
1171
  return {
1172
1172
  path: e.path,
1173
1173
  actionResults: [],
@@ -1177,48 +1177,48 @@ class ge {
1177
1177
  rolledBack: !1
1178
1178
  };
1179
1179
  const r = performance.now(), c = [];
1180
- let i = !1, u = !1, p;
1181
- const b = this.getFieldRollback(a, n), w = t.enableRollback ?? b ?? this.options.enableRollback;
1182
- w && e.store && (p = this.captureSnapshot(e));
1183
- for (const k of s)
1180
+ let s = !1, u = !1, p;
1181
+ const h = this.getFieldRollback(a, n), b = o.enableRollback ?? h ?? this.options.enableRollback;
1182
+ b && e.store && (p = this.captureSnapshot(e));
1183
+ for (const O of i)
1184
1184
  try {
1185
- const V = await this.executeAction(k, e, t.timeout);
1185
+ const V = await this.executeAction(O, e, o.timeout);
1186
1186
  if (c.push(V), !V.success) {
1187
- i = !0;
1187
+ s = !0;
1188
1188
  break;
1189
1189
  }
1190
1190
  } catch (V) {
1191
- const P = {
1191
+ const M = {
1192
1192
  success: !1,
1193
1193
  error: V instanceof Error ? V : new Error(String(V)),
1194
1194
  executionTime: 0,
1195
- action: k
1195
+ action: O
1196
1196
  };
1197
- c.push(P), i = !0;
1197
+ c.push(M), s = !0;
1198
1198
  break;
1199
1199
  }
1200
- if (w && i && p && e.store)
1200
+ if (b && s && p && e.store)
1201
1201
  try {
1202
1202
  this.restoreSnapshot(e, p), u = !0;
1203
- } catch (k) {
1204
- console.error("[FieldTriggers] Rollback failed:", k);
1203
+ } catch (O) {
1204
+ console.error("[FieldTriggers] Rollback failed:", O);
1205
1205
  }
1206
- const N = performance.now() - r, O = c.filter((k) => !k.success);
1207
- if (O.length > 0 && this.options.errorHandler)
1208
- for (const k of O)
1206
+ const D = performance.now() - r, k = c.filter((O) => !O.success);
1207
+ if (k.length > 0 && this.options.errorHandler)
1208
+ for (const O of k)
1209
1209
  try {
1210
- this.options.errorHandler(k.error, e, k.action);
1210
+ this.options.errorHandler(O.error, e, O.action);
1211
1211
  } catch (V) {
1212
1212
  console.error("[FieldTriggers] Error in global error handler:", V);
1213
1213
  }
1214
1214
  return {
1215
1215
  path: e.path,
1216
1216
  actionResults: c,
1217
- totalExecutionTime: N,
1218
- allSucceeded: c.every((k) => k.success),
1219
- stoppedOnError: i,
1217
+ totalExecutionTime: D,
1218
+ allSucceeded: c.every((O) => O.success),
1219
+ stoppedOnError: s,
1220
1220
  rolledBack: u,
1221
- snapshot: this.options.debug && w ? p : void 0
1221
+ snapshot: this.options.debug && b ? p : void 0
1222
1222
  // Only include snapshot in debug mode if rollback is enabled
1223
1223
  };
1224
1224
  }
@@ -1228,14 +1228,14 @@ class ge {
1228
1228
  * @param context - The transition change context
1229
1229
  * @param options - Execution options (timeout)
1230
1230
  */
1231
- async executeTransitionActions(e, t = {}) {
1232
- const { doctype: a, transition: n } = e, s = this.findTransitionActions(a, n);
1233
- if (s.length === 0)
1231
+ async executeTransitionActions(e, o = {}) {
1232
+ const { doctype: a, transition: n } = e, i = this.findTransitionActions(a, n);
1233
+ if (i.length === 0)
1234
1234
  return [];
1235
1235
  const r = [];
1236
- for (const i of s)
1236
+ for (const s of i)
1237
1237
  try {
1238
- const u = await this.executeTransitionAction(i, e, t.timeout);
1238
+ const u = await this.executeTransitionAction(s, e, o.timeout);
1239
1239
  if (r.push(u), !u.success)
1240
1240
  break;
1241
1241
  } catch (u) {
@@ -1243,17 +1243,17 @@ class ge {
1243
1243
  success: !1,
1244
1244
  error: u instanceof Error ? u : new Error(String(u)),
1245
1245
  executionTime: 0,
1246
- action: i,
1246
+ action: s,
1247
1247
  transition: n
1248
1248
  };
1249
1249
  r.push(p);
1250
1250
  break;
1251
1251
  }
1252
- const c = r.filter((i) => !i.success);
1252
+ const c = r.filter((s) => !s.success);
1253
1253
  if (c.length > 0 && this.options.errorHandler)
1254
- for (const i of c)
1254
+ for (const s of c)
1255
1255
  try {
1256
- this.options.errorHandler(i.error, e, i.action);
1256
+ this.options.errorHandler(s.error, e, s.action);
1257
1257
  } catch (u) {
1258
1258
  console.error("[FieldTriggers] Error in global error handler:", u);
1259
1259
  }
@@ -1262,15 +1262,15 @@ class ge {
1262
1262
  /**
1263
1263
  * Find transition actions for a specific doctype and transition
1264
1264
  */
1265
- findTransitionActions(e, t) {
1265
+ findTransitionActions(e, o) {
1266
1266
  const a = this.doctypeTransitions.get(e);
1267
- return a ? a.get(t) || [] : [];
1267
+ return a ? a.get(o) || [] : [];
1268
1268
  }
1269
1269
  /**
1270
1270
  * Execute a single transition action by name
1271
1271
  */
1272
- async executeTransitionAction(e, t, a) {
1273
- const n = performance.now(), s = a ?? this.options.defaultTimeout;
1272
+ async executeTransitionAction(e, o, a) {
1273
+ const n = performance.now(), i = a ?? this.options.defaultTimeout;
1274
1274
  try {
1275
1275
  let r = this.globalTransitionActions.get(e);
1276
1276
  if (!r) {
@@ -1279,11 +1279,11 @@ class ge {
1279
1279
  }
1280
1280
  if (!r)
1281
1281
  throw new Error(`Transition action "${e}" not found in registry`);
1282
- return await this.executeWithTimeout(r, t, s), {
1282
+ return await this.executeWithTimeout(r, o, i), {
1283
1283
  success: !0,
1284
1284
  executionTime: performance.now() - n,
1285
1285
  action: e,
1286
- transition: t.transition
1286
+ transition: o.transition
1287
1287
  };
1288
1288
  } catch (r) {
1289
1289
  const c = performance.now() - n;
@@ -1292,7 +1292,7 @@ class ge {
1292
1292
  error: r instanceof Error ? r : new Error(String(r)),
1293
1293
  executionTime: c,
1294
1294
  action: e,
1295
- transition: t.transition
1295
+ transition: o.transition
1296
1296
  };
1297
1297
  }
1298
1298
  }
@@ -1300,12 +1300,12 @@ class ge {
1300
1300
  * Find field triggers for a specific doctype and field
1301
1301
  * Field triggers are identified by keys that look like field paths (contain dots or match field names)
1302
1302
  */
1303
- findFieldTriggers(e, t) {
1303
+ findFieldTriggers(e, o) {
1304
1304
  const a = this.doctypeActions.get(e);
1305
1305
  if (!a) return [];
1306
1306
  const n = [];
1307
- for (const [s, r] of a)
1308
- this.isFieldTriggerKey(s, t) && n.push(...r);
1307
+ for (const [i, r] of a)
1308
+ this.isFieldTriggerKey(i, o) && n.push(...r);
1309
1309
  return n;
1310
1310
  }
1311
1311
  /**
@@ -1315,19 +1315,19 @@ class ge {
1315
1315
  * - Wildcard patterns: "emailAddress.*", "*.is_primary"
1316
1316
  * - Nested field paths: "address.street", "contact.email"
1317
1317
  */
1318
- isFieldTriggerKey(e, t) {
1319
- return e === t ? !0 : e.includes(".") ? this.matchFieldPattern(e, t) : e.includes("*") ? this.matchFieldPattern(e, t) : !1;
1318
+ isFieldTriggerKey(e, o) {
1319
+ return e === o ? !0 : e.includes(".") ? this.matchFieldPattern(e, o) : e.includes("*") ? this.matchFieldPattern(e, o) : !1;
1320
1320
  }
1321
1321
  /**
1322
1322
  * Match a field pattern against a field name
1323
1323
  * Supports wildcards (*) for dynamic segments
1324
1324
  */
1325
- matchFieldPattern(e, t) {
1326
- const a = e.split("."), n = t.split(".");
1325
+ matchFieldPattern(e, o) {
1326
+ const a = e.split("."), n = o.split(".");
1327
1327
  if (a.length !== n.length)
1328
1328
  return !1;
1329
- for (let s = 0; s < a.length; s++) {
1330
- const r = a[s], c = n[s];
1329
+ for (let i = 0; i < a.length; i++) {
1330
+ const r = a[i], c = n[i];
1331
1331
  if (r !== "*" && r !== c)
1332
1332
  return !1;
1333
1333
  }
@@ -1336,13 +1336,13 @@ class ge {
1336
1336
  /**
1337
1337
  * Execute a single action by name
1338
1338
  */
1339
- async executeAction(e, t, a) {
1340
- const n = performance.now(), s = a ?? this.options.defaultTimeout;
1339
+ async executeAction(e, o, a) {
1340
+ const n = performance.now(), i = a ?? this.options.defaultTimeout;
1341
1341
  try {
1342
1342
  const r = this.globalActions.get(e);
1343
1343
  if (!r)
1344
1344
  throw new Error(`Action "${e}" not found in registry`);
1345
- return await this.executeWithTimeout(r, t, s), {
1345
+ return await this.executeWithTimeout(r, o, i), {
1346
1346
  success: !0,
1347
1347
  executionTime: performance.now() - n,
1348
1348
  action: e
@@ -1360,15 +1360,15 @@ class ge {
1360
1360
  /**
1361
1361
  * Execute a function with timeout
1362
1362
  */
1363
- async executeWithTimeout(e, t, a) {
1364
- return new Promise((n, s) => {
1363
+ async executeWithTimeout(e, o, a) {
1364
+ return new Promise((n, i) => {
1365
1365
  const r = setTimeout(() => {
1366
- s(new Error(`Action timeout after ${a}ms`));
1366
+ i(new Error(`Action timeout after ${a}ms`));
1367
1367
  }, a);
1368
- Promise.resolve(e(t)).then((c) => {
1368
+ Promise.resolve(e(o)).then((c) => {
1369
1369
  clearTimeout(r), n(c);
1370
1370
  }).catch((c) => {
1371
- clearTimeout(r), s(c);
1371
+ clearTimeout(r), i(c);
1372
1372
  });
1373
1373
  });
1374
1374
  }
@@ -1379,10 +1379,10 @@ class ge {
1379
1379
  captureSnapshot(e) {
1380
1380
  if (!(!e.store || !e.doctype || !e.recordId))
1381
1381
  try {
1382
- const t = `${e.doctype}.${e.recordId}`, a = e.store.get(t);
1382
+ const o = `${e.doctype}.${e.recordId}`, a = e.store.get(o);
1383
1383
  return !a || typeof a != "object" ? void 0 : JSON.parse(JSON.stringify(a));
1384
- } catch (t) {
1385
- this.options.debug && console.warn("[FieldTriggers] Failed to capture snapshot:", t);
1384
+ } catch (o) {
1385
+ this.options.debug && console.warn("[FieldTriggers] Failed to capture snapshot:", o);
1386
1386
  return;
1387
1387
  }
1388
1388
  }
@@ -1390,34 +1390,34 @@ class ge {
1390
1390
  * Restore a previously captured snapshot
1391
1391
  * This reverts the record to its state before actions were executed
1392
1392
  */
1393
- restoreSnapshot(e, t) {
1394
- if (!(!e.store || !e.doctype || !e.recordId || !t))
1393
+ restoreSnapshot(e, o) {
1394
+ if (!(!e.store || !e.doctype || !e.recordId || !o))
1395
1395
  try {
1396
1396
  const a = `${e.doctype}.${e.recordId}`;
1397
- e.store.set(a, t), this.options.debug && console.log(`[FieldTriggers] Rolled back ${a} to previous state`);
1397
+ e.store.set(a, o), this.options.debug && console.log(`[FieldTriggers] Rolled back ${a} to previous state`);
1398
1398
  } catch (a) {
1399
1399
  throw console.error("[FieldTriggers] Failed to restore snapshot:", a), a;
1400
1400
  }
1401
1401
  }
1402
1402
  }
1403
- function at(o) {
1404
- return new ge(o);
1403
+ function ut(t) {
1404
+ return new ye(t);
1405
1405
  }
1406
- function nt() {
1406
+ function dt() {
1407
1407
  try {
1408
- return wt();
1408
+ return Dt();
1409
1409
  } catch {
1410
1410
  return null;
1411
1411
  }
1412
1412
  }
1413
- class re {
1413
+ class le {
1414
1414
  static instance;
1415
1415
  /**
1416
1416
  * Gets the singleton instance of HST
1417
1417
  * @returns The HST singleton instance
1418
1418
  */
1419
1419
  static getInstance() {
1420
- return re.instance || (re.instance = new re()), re.instance;
1420
+ return le.instance || (le.instance = new le()), le.instance;
1421
1421
  }
1422
1422
  /**
1423
1423
  * Gets the global registry instance
@@ -1446,28 +1446,28 @@ class re {
1446
1446
  * @returns The doctype metadata object or undefined if not found
1447
1447
  */
1448
1448
  getDoctypeMeta(e) {
1449
- const t = this.getRegistry();
1450
- if (t && typeof t == "object" && "registry" in t)
1451
- return t.registry[e];
1449
+ const o = this.getRegistry();
1450
+ if (o && typeof o == "object" && "registry" in o)
1451
+ return o.registry[e];
1452
1452
  }
1453
1453
  }
1454
- class Ie {
1454
+ class Te {
1455
1455
  target;
1456
1456
  parentPath;
1457
1457
  rootNode;
1458
1458
  doctype;
1459
1459
  parentDoctype;
1460
1460
  hst;
1461
- constructor(e, t, a = "", n = null, s) {
1462
- return this.target = e, this.parentPath = a, this.rootNode = n || this, this.doctype = t, this.parentDoctype = s, this.hst = re.getInstance(), new Proxy(this, {
1461
+ constructor(e, o, a = "", n = null, i) {
1462
+ return this.target = e, this.parentPath = a, this.rootNode = n || this, this.doctype = o, this.parentDoctype = i, this.hst = le.getInstance(), new Proxy(this, {
1463
1463
  get(r, c) {
1464
1464
  if (c in r) return r[c];
1465
- const i = String(c);
1466
- return r.getNode(i);
1465
+ const s = String(c);
1466
+ return r.getNode(s);
1467
1467
  },
1468
- set(r, c, i) {
1468
+ set(r, c, s) {
1469
1469
  const u = String(c);
1470
- return r.set(u, i), !0;
1470
+ return r.set(u, s), !0;
1471
1471
  }
1472
1472
  });
1473
1473
  }
@@ -1476,24 +1476,24 @@ class Ie {
1476
1476
  }
1477
1477
  // Method to get a tree-wrapped node for navigation
1478
1478
  getNode(e) {
1479
- const t = this.resolvePath(e), a = this.resolveValue(e), n = t.split(".");
1480
- let s = this.doctype;
1481
- return this.doctype === "StonecropStore" && n.length >= 1 && (s = n[0]), typeof a == "object" && a !== null && !this.isPrimitive(a) ? new Ie(a, s, t, this.rootNode, this.parentDoctype) : new Ie(a, s, t, this.rootNode, this.parentDoctype);
1479
+ const o = this.resolvePath(e), a = this.resolveValue(e), n = o.split(".");
1480
+ let i = this.doctype;
1481
+ return this.doctype === "StonecropStore" && n.length >= 1 && (i = n[0]), typeof a == "object" && a !== null && !this.isPrimitive(a) ? new Te(a, i, o, this.rootNode, this.parentDoctype) : new Te(a, i, o, this.rootNode, this.parentDoctype);
1482
1482
  }
1483
- set(e, t, a = "user") {
1484
- const n = this.resolvePath(e), s = this.has(e) ? this.get(e) : void 0;
1483
+ set(e, o, a = "user") {
1484
+ const n = this.resolvePath(e), i = this.has(e) ? this.get(e) : void 0;
1485
1485
  if (a !== "undo" && a !== "redo") {
1486
- const r = nt();
1486
+ const r = dt();
1487
1487
  if (r && typeof r.addOperation == "function") {
1488
- const c = n.split("."), i = this.doctype === "StonecropStore" && c.length >= 1 ? c[0] : this.doctype, u = c.length >= 2 ? c[1] : void 0, p = c.slice(2).join(".") || c[c.length - 1], b = t === void 0 && s !== void 0 ? "delete" : "set";
1488
+ const c = n.split("."), s = this.doctype === "StonecropStore" && c.length >= 1 ? c[0] : this.doctype, u = c.length >= 2 ? c[1] : void 0, p = c.slice(2).join(".") || c[c.length - 1], h = o === void 0 && i !== void 0 ? "delete" : "set";
1489
1489
  r.addOperation(
1490
1490
  {
1491
- type: b,
1491
+ type: h,
1492
1492
  path: n,
1493
1493
  fieldname: p,
1494
- beforeValue: s,
1495
- afterValue: t,
1496
- doctype: i,
1494
+ beforeValue: i,
1495
+ afterValue: o,
1496
+ doctype: s,
1497
1497
  recordId: u,
1498
1498
  reversible: !0
1499
1499
  // Default to reversible, can be changed by field triggers
@@ -1502,21 +1502,21 @@ class Ie {
1502
1502
  );
1503
1503
  }
1504
1504
  }
1505
- this.updateValue(e, t), this.triggerFieldActions(n, s, t);
1505
+ this.updateValue(e, o), this.triggerFieldActions(n, i, o);
1506
1506
  }
1507
1507
  has(e) {
1508
1508
  try {
1509
1509
  if (e === "")
1510
1510
  return !0;
1511
- const t = this.parsePath(e);
1511
+ const o = this.parsePath(e);
1512
1512
  let a = this.target;
1513
- for (let n = 0; n < t.length; n++) {
1514
- const s = t[n];
1513
+ for (let n = 0; n < o.length; n++) {
1514
+ const i = o[n];
1515
1515
  if (a == null)
1516
1516
  return !1;
1517
- if (n === t.length - 1)
1518
- return this.isImmutable(a) ? a.has(s) : this.isPiniaStore(a) && a.$state && s in a.$state || s in a;
1519
- a = this.getProperty(a, s);
1517
+ if (n === o.length - 1)
1518
+ return this.isImmutable(a) ? a.has(i) : this.isPiniaStore(a) && a.$state && i in a.$state || i in a;
1519
+ a = this.getProperty(a, i);
1520
1520
  }
1521
1521
  return !1;
1522
1522
  } catch {
@@ -1544,10 +1544,10 @@ class Ie {
1544
1544
  /**
1545
1545
  * Trigger an XState transition with optional context data
1546
1546
  */
1547
- async triggerTransition(e, t) {
1548
- const a = at(), n = this.parentPath.split(".");
1549
- let s = this.doctype, r;
1550
- this.doctype === "StonecropStore" && n.length >= 1 && (s = n[0]), n.length >= 2 && (r = n[1]);
1547
+ async triggerTransition(e, o) {
1548
+ const a = ut(), n = this.parentPath.split(".");
1549
+ let i = this.doctype, r;
1550
+ this.doctype === "StonecropStore" && n.length >= 1 && (i = n[0]), n.length >= 2 && (r = n[1]);
1551
1551
  const c = {
1552
1552
  path: this.parentPath,
1553
1553
  fieldname: "",
@@ -1555,31 +1555,31 @@ class Ie {
1555
1555
  beforeValue: void 0,
1556
1556
  afterValue: void 0,
1557
1557
  operation: "set",
1558
- doctype: s,
1558
+ doctype: i,
1559
1559
  recordId: r,
1560
1560
  timestamp: /* @__PURE__ */ new Date(),
1561
1561
  store: this.rootNode || void 0,
1562
1562
  transition: e,
1563
- currentState: t?.currentState,
1564
- targetState: t?.targetState,
1565
- fsmContext: t?.fsmContext
1566
- }, i = nt();
1567
- return i && typeof i.addOperation == "function" && i.addOperation(
1563
+ currentState: o?.currentState,
1564
+ targetState: o?.targetState,
1565
+ fsmContext: o?.fsmContext
1566
+ }, s = dt();
1567
+ return s && typeof s.addOperation == "function" && s.addOperation(
1568
1568
  {
1569
1569
  type: "transition",
1570
1570
  path: this.parentPath,
1571
1571
  fieldname: e,
1572
- beforeValue: t?.currentState,
1573
- afterValue: t?.targetState,
1574
- doctype: s,
1572
+ beforeValue: o?.currentState,
1573
+ afterValue: o?.targetState,
1574
+ doctype: i,
1575
1575
  recordId: r,
1576
1576
  reversible: !1,
1577
1577
  // FSM transitions are generally not reversible
1578
1578
  metadata: {
1579
1579
  transition: e,
1580
- currentState: t?.currentState,
1581
- targetState: t?.targetState,
1582
- fsmContext: t?.fsmContext
1580
+ currentState: o?.currentState,
1581
+ targetState: o?.targetState,
1582
+ fsmContext: o?.fsmContext
1583
1583
  }
1584
1584
  },
1585
1585
  "user"
@@ -1592,62 +1592,62 @@ class Ie {
1592
1592
  resolveValue(e) {
1593
1593
  if (e === "")
1594
1594
  return this.target;
1595
- const t = this.parsePath(e);
1595
+ const o = this.parsePath(e);
1596
1596
  let a = this.target;
1597
- for (const n of t) {
1597
+ for (const n of o) {
1598
1598
  if (a == null)
1599
1599
  return;
1600
1600
  a = this.getProperty(a, n);
1601
1601
  }
1602
1602
  return a;
1603
1603
  }
1604
- updateValue(e, t) {
1604
+ updateValue(e, o) {
1605
1605
  if (e === "")
1606
1606
  throw new Error("Cannot set value on empty path");
1607
1607
  const a = this.parsePath(e), n = a.pop();
1608
- let s = this.target;
1608
+ let i = this.target;
1609
1609
  for (const r of a)
1610
- if (s = this.getProperty(s, r), s == null)
1610
+ if (i = this.getProperty(i, r), i == null)
1611
1611
  throw new Error(`Cannot set property on null/undefined path: ${e}`);
1612
- this.setProperty(s, n, t);
1612
+ this.setProperty(i, n, o);
1613
1613
  }
1614
- getProperty(e, t) {
1615
- return this.isImmutable(e) ? e.get(t) : this.isVueReactive(e) ? e[t] : this.isPiniaStore(e) ? e.$state?.[t] ?? e[t] : e[t];
1614
+ getProperty(e, o) {
1615
+ return this.isImmutable(e) ? e.get(o) : this.isVueReactive(e) ? e[o] : this.isPiniaStore(e) ? e.$state?.[o] ?? e[o] : e[o];
1616
1616
  }
1617
- setProperty(e, t, a) {
1617
+ setProperty(e, o, a) {
1618
1618
  if (this.isImmutable(e))
1619
1619
  throw new Error("Cannot directly mutate immutable objects. Use immutable update methods instead.");
1620
1620
  if (this.isPiniaStore(e)) {
1621
- e.$patch ? e.$patch({ [t]: a }) : e[t] = a;
1621
+ e.$patch ? e.$patch({ [o]: a }) : e[o] = a;
1622
1622
  return;
1623
1623
  }
1624
- e[t] = a;
1624
+ e[o] = a;
1625
1625
  }
1626
- async triggerFieldActions(e, t, a) {
1626
+ async triggerFieldActions(e, o, a) {
1627
1627
  try {
1628
1628
  if (!e || typeof e != "string")
1629
1629
  return;
1630
1630
  const n = e.split(".");
1631
1631
  if (n.length < 3)
1632
1632
  return;
1633
- const s = at(), r = n.slice(2).join(".") || n[n.length - 1];
1633
+ const i = ut(), r = n.slice(2).join(".") || n[n.length - 1];
1634
1634
  let c = this.doctype;
1635
1635
  this.doctype === "StonecropStore" && n.length >= 1 && (c = n[0]);
1636
- let i;
1637
- n.length >= 2 && (i = n[1]);
1636
+ let s;
1637
+ n.length >= 2 && (s = n[1]);
1638
1638
  const u = {
1639
1639
  path: e,
1640
1640
  fieldname: r,
1641
- beforeValue: t,
1641
+ beforeValue: o,
1642
1642
  afterValue: a,
1643
1643
  operation: "set",
1644
1644
  doctype: c,
1645
- recordId: i,
1645
+ recordId: s,
1646
1646
  timestamp: /* @__PURE__ */ new Date(),
1647
1647
  store: this.rootNode || void 0
1648
1648
  // Pass the root store for snapshot/rollback capabilities
1649
1649
  };
1650
- await s.executeFieldTriggers(u);
1650
+ await i.executeFieldTriggers(u);
1651
1651
  } catch (n) {
1652
1652
  n instanceof Error && console.warn("Field trigger error:", n.message);
1653
1653
  }
@@ -1661,31 +1661,36 @@ class Ie {
1661
1661
  isImmutable(e) {
1662
1662
  if (!e || typeof e != "object")
1663
1663
  return !1;
1664
- const t = "get" in e && typeof e.get == "function", a = "set" in e && typeof e.set == "function", n = "has" in e && typeof e.has == "function", s = "__ownerID" in e || "_map" in e || "_list" in e || "_origin" in e || "_capacity" in e || "_defaultValues" in e || "_tail" in e || "_root" in e || "size" in e && t && a;
1664
+ const o = "get" in e && typeof e.get == "function", a = "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 && o && a;
1665
1665
  let r;
1666
1666
  try {
1667
- const i = e;
1668
- if ("constructor" in i && i.constructor && typeof i.constructor == "object" && "name" in i.constructor) {
1669
- const u = i.constructor.name;
1667
+ const s = e;
1668
+ if ("constructor" in s && s.constructor && typeof s.constructor == "object" && "name" in s.constructor) {
1669
+ const u = s.constructor.name;
1670
1670
  r = typeof u == "string" ? u : void 0;
1671
1671
  }
1672
1672
  } catch {
1673
1673
  r = void 0;
1674
1674
  }
1675
- const c = r && (r.includes("Map") || r.includes("List") || r.includes("Set") || r.includes("Stack") || r.includes("Seq")) && (t || a);
1676
- return !!(t && a && n && s || t && a && c);
1675
+ const c = r && (r.includes("Map") || r.includes("List") || r.includes("Set") || r.includes("Stack") || r.includes("Seq")) && (o || a);
1676
+ return !!(o && a && n && i || o && a && c);
1677
1677
  }
1678
1678
  isPrimitive(e) {
1679
1679
  return e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "function" || typeof e == "symbol" || typeof e == "bigint";
1680
1680
  }
1681
+ /**
1682
+ * Parse a path string into segments, handling both dot notation and array bracket notation
1683
+ * @param path - The path string to parse (e.g., "order.456.line_items[0].product")
1684
+ * @returns Array of path segments (e.g., ['order', '456', 'line_items', '0', 'product'])
1685
+ */
1681
1686
  parsePath(e) {
1682
- return e ? e.split(".").filter((t) => t.length > 0) : [];
1687
+ return e ? e.replace(/\[(\d+)\]/g, ".$1").split(".").filter((o) => o.length > 0) : [];
1683
1688
  }
1684
1689
  }
1685
- function Oo(o, e, t) {
1686
- return new Ie(o, e, "", null, t);
1690
+ function Co(t, e, o) {
1691
+ return new Te(t, e, "", null, o);
1687
1692
  }
1688
- class ko {
1693
+ class Ao {
1689
1694
  hstStore;
1690
1695
  _operationLogStore;
1691
1696
  _operationLogConfig;
@@ -1696,32 +1701,32 @@ class ko {
1696
1701
  * @param registry - The Registry instance containing doctype definitions
1697
1702
  * @param operationLogConfig - Optional configuration for the operation log
1698
1703
  */
1699
- constructor(e, t) {
1700
- this.registry = e, this._operationLogConfig = t, this.initializeHSTStore(), this.setupRegistrySync();
1704
+ constructor(e, o) {
1705
+ this.registry = e, this._operationLogConfig = o, this.initializeHSTStore(), this.setupRegistrySync();
1701
1706
  }
1702
1707
  /**
1703
1708
  * Get the operation log store (lazy initialization)
1704
1709
  * @internal
1705
1710
  */
1706
1711
  getOperationLogStore() {
1707
- return this._operationLogStore || (this._operationLogStore = wt(), this._operationLogConfig && this._operationLogStore.configure(this._operationLogConfig)), this._operationLogStore;
1712
+ return this._operationLogStore || (this._operationLogStore = Dt(), this._operationLogConfig && this._operationLogStore.configure(this._operationLogConfig)), this._operationLogStore;
1708
1713
  }
1709
1714
  /**
1710
1715
  * Initialize the HST store structure
1711
1716
  */
1712
1717
  initializeHSTStore() {
1713
1718
  const e = {};
1714
- Object.keys(this.registry.registry).forEach((t) => {
1715
- e[t] = {};
1716
- }), this.hstStore = Oo(e, "StonecropStore");
1719
+ Object.keys(this.registry.registry).forEach((o) => {
1720
+ e[o] = {};
1721
+ }), this.hstStore = Co(gt(e), "StonecropStore");
1717
1722
  }
1718
1723
  /**
1719
1724
  * Setup automatic sync with Registry when doctypes are added
1720
1725
  */
1721
1726
  setupRegistrySync() {
1722
1727
  const e = this.registry.addDoctype.bind(this.registry);
1723
- this.registry.addDoctype = (t) => {
1724
- e(t), this.hstStore.has(t.slug) || this.hstStore.set(t.slug, {});
1728
+ this.registry.addDoctype = (o) => {
1729
+ e(o), this.hstStore.has(o.slug) || this.hstStore.set(o.slug, {});
1725
1730
  };
1726
1731
  }
1727
1732
  /**
@@ -1730,8 +1735,8 @@ class ko {
1730
1735
  * @returns HST node containing records hash
1731
1736
  */
1732
1737
  records(e) {
1733
- const t = typeof e == "string" ? e : e.slug;
1734
- return this.ensureDoctypeExists(t), this.hstStore.getNode(t);
1738
+ const o = typeof e == "string" ? e : e.slug;
1739
+ return this.ensureDoctypeExists(o), this.hstStore.getNode(o);
1735
1740
  }
1736
1741
  /**
1737
1742
  * Add a record to the store
@@ -1739,9 +1744,9 @@ class ko {
1739
1744
  * @param recordId - The record ID
1740
1745
  * @param recordData - The record data
1741
1746
  */
1742
- addRecord(e, t, a) {
1747
+ addRecord(e, o, a) {
1743
1748
  const n = typeof e == "string" ? e : e.slug;
1744
- this.ensureDoctypeExists(n), this.hstStore.set(`${n}.${t}`, a);
1749
+ this.ensureDoctypeExists(n), this.hstStore.set(`${n}.${o}`, a);
1745
1750
  }
1746
1751
  /**
1747
1752
  * Get a specific record
@@ -1749,19 +1754,19 @@ class ko {
1749
1754
  * @param recordId - The record ID
1750
1755
  * @returns HST node for the record or undefined
1751
1756
  */
1752
- getRecordById(e, t) {
1757
+ getRecordById(e, o) {
1753
1758
  const a = typeof e == "string" ? e : e.slug;
1754
- if (this.ensureDoctypeExists(a), !(!this.hstStore.has(`${a}.${t}`) || this.hstStore.get(`${a}.${t}`) === void 0))
1755
- return this.hstStore.getNode(`${a}.${t}`);
1759
+ if (this.ensureDoctypeExists(a), !(!this.hstStore.has(`${a}.${o}`) || this.hstStore.get(`${a}.${o}`) === void 0))
1760
+ return this.hstStore.getNode(`${a}.${o}`);
1756
1761
  }
1757
1762
  /**
1758
1763
  * Remove a record from the store
1759
1764
  * @param doctype - The doctype
1760
1765
  * @param recordId - The record ID
1761
1766
  */
1762
- removeRecord(e, t) {
1767
+ removeRecord(e, o) {
1763
1768
  const a = typeof e == "string" ? e : e.slug;
1764
- this.ensureDoctypeExists(a), this.hstStore.has(`${a}.${t}`) && this.hstStore.set(`${a}.${t}`, void 0);
1769
+ this.ensureDoctypeExists(a), this.hstStore.has(`${a}.${o}`) && this.hstStore.set(`${a}.${o}`, void 0);
1765
1770
  }
1766
1771
  /**
1767
1772
  * Get all record IDs for a doctype
@@ -1769,9 +1774,9 @@ class ko {
1769
1774
  * @returns Array of record IDs
1770
1775
  */
1771
1776
  getRecordIds(e) {
1772
- const t = typeof e == "string" ? e : e.slug;
1773
- this.ensureDoctypeExists(t);
1774
- const a = this.hstStore.get(t);
1777
+ const o = typeof e == "string" ? e : e.slug;
1778
+ this.ensureDoctypeExists(o);
1779
+ const a = this.hstStore.get(o);
1775
1780
  return !a || typeof a != "object" ? [] : Object.keys(a).filter((n) => a[n] !== void 0);
1776
1781
  }
1777
1782
  /**
@@ -1779,9 +1784,9 @@ class ko {
1779
1784
  * @param doctype - The doctype
1780
1785
  */
1781
1786
  clearRecords(e) {
1782
- const t = typeof e == "string" ? e : e.slug;
1783
- this.ensureDoctypeExists(t), this.getRecordIds(t).forEach((a) => {
1784
- this.hstStore.set(`${t}.${a}`, void 0);
1787
+ const o = typeof e == "string" ? e : e.slug;
1788
+ this.ensureDoctypeExists(o), this.getRecordIds(o).forEach((a) => {
1789
+ this.hstStore.set(`${o}.${a}`, void 0);
1785
1790
  });
1786
1791
  }
1787
1792
  /**
@@ -1798,20 +1803,20 @@ class ko {
1798
1803
  * @param action - The action to run
1799
1804
  * @param args - Action arguments (typically record IDs)
1800
1805
  */
1801
- runAction(e, t, a) {
1802
- const n = this.registry.registry[e.slug]?.actions?.get(t), s = Array.isArray(a) ? a.filter((u) => typeof u == "string") : void 0, r = this.getOperationLogStore();
1803
- let c = "success", i;
1806
+ runAction(e, o, a) {
1807
+ const n = this.registry.registry[e.slug]?.actions?.get(o), i = Array.isArray(a) ? a.filter((u) => typeof u == "string") : void 0, r = this.getOperationLogStore();
1808
+ let c = "success", s;
1804
1809
  try {
1805
1810
  n && n.length > 0 && n.forEach((u) => {
1806
1811
  try {
1807
1812
  new Function("args", u)(a);
1808
1813
  } catch (p) {
1809
- throw c = "failure", i = p instanceof Error ? p.message : "Unknown error", p;
1814
+ throw c = "failure", s = p instanceof Error ? p.message : "Unknown error", p;
1810
1815
  }
1811
1816
  });
1812
1817
  } catch {
1813
1818
  } finally {
1814
- r.logAction(e.doctype, t, s, c, i);
1819
+ r.logAction(e.doctype, o, i, c, s);
1815
1820
  }
1816
1821
  }
1817
1822
  /**
@@ -1819,8 +1824,8 @@ class ko {
1819
1824
  * @param doctype - The doctype
1820
1825
  */
1821
1826
  async getRecords(e) {
1822
- (await (await fetch(`/${e.slug}`)).json()).forEach((t) => {
1823
- t.id && this.addRecord(e, t.id, t);
1827
+ (await (await fetch(`/${e.slug}`)).json()).forEach((o) => {
1828
+ o.id && this.addRecord(e, o.id, o);
1824
1829
  });
1825
1830
  }
1826
1831
  /**
@@ -1828,9 +1833,9 @@ class ko {
1828
1833
  * @param doctype - The doctype
1829
1834
  * @param recordId - The record ID
1830
1835
  */
1831
- async getRecord(e, t) {
1832
- const a = await (await fetch(`/${e.slug}/${t}`)).json();
1833
- this.addRecord(e, t, a);
1836
+ async getRecord(e, o) {
1837
+ const a = await (await fetch(`/${e.slug}/${o}`)).json();
1838
+ this.addRecord(e, o, a);
1834
1839
  }
1835
1840
  /**
1836
1841
  * Ensure doctype section exists in HST store
@@ -1857,9 +1862,14 @@ class ko {
1857
1862
  return this.hstStore;
1858
1863
  }
1859
1864
  }
1860
- function No(o) {
1861
- o || (o = {});
1862
- const e = o.registry || He("$registry"), t = He("$stonecrop"), a = R(), n = R(), s = R({}), r = R(), c = R(), i = R([]), u = R(-1), p = A(() => a.value?.getOperationLogStore().canUndo ?? !1), b = A(() => a.value?.getOperationLogStore().canRedo ?? !1), w = A(() => a.value?.getOperationLogStore().undoCount ?? 0), N = A(() => a.value?.getOperationLogStore().redoCount ?? 0), O = A(
1865
+ function Io(t) {
1866
+ t || (t = {});
1867
+ const e = t.registry || Je("$registry"), o = Je("$stonecrop"), a = C(), n = C(), i = C({}), r = C(), c = C(), s = C([]);
1868
+ if (t.doctype && e) {
1869
+ const w = t.doctype.schema ? Array.isArray(t.doctype.schema) ? t.doctype.schema : Array.from(t.doctype.schema) : [];
1870
+ s.value = e.resolveSchema(w);
1871
+ }
1872
+ const u = C([]), p = C(-1), h = I(() => a.value?.getOperationLogStore().canUndo ?? !1), b = I(() => a.value?.getOperationLogStore().canRedo ?? !1), D = I(() => a.value?.getOperationLogStore().undoCount ?? 0), k = I(() => a.value?.getOperationLogStore().redoCount ?? 0), O = I(
1863
1873
  () => a.value?.getOperationLogStore().undoRedoState ?? {
1864
1874
  canUndo: !1,
1865
1875
  canRedo: !1,
@@ -1867,191 +1877,234 @@ function No(o) {
1867
1877
  redoCount: 0,
1868
1878
  currentIndex: -1
1869
1879
  }
1870
- ), k = (E) => a.value?.getOperationLogStore().undo(E) ?? !1, V = (E) => a.value?.getOperationLogStore().redo(E) ?? !1, P = () => {
1880
+ ), V = (w) => a.value?.getOperationLogStore().undo(w) ?? !1, M = (w) => a.value?.getOperationLogStore().redo(w) ?? !1, x = () => {
1871
1881
  a.value?.getOperationLogStore().startBatch();
1872
- }, x = (E) => a.value?.getOperationLogStore().commitBatch(E) ?? null, W = () => {
1882
+ }, W = (w) => a.value?.getOperationLogStore().commitBatch(w) ?? null, Z = () => {
1873
1883
  a.value?.getOperationLogStore().cancelBatch();
1874
1884
  }, J = () => {
1875
1885
  a.value?.getOperationLogStore().clear();
1876
- }, K = (E, h) => a.value?.getOperationLogStore().getOperationsFor(E, h) ?? [], z = () => a.value?.getOperationLogStore().getSnapshot() ?? {
1886
+ }, K = (w, $) => a.value?.getOperationLogStore().getOperationsFor(w, $) ?? [], E = () => a.value?.getOperationLogStore().getSnapshot() ?? {
1877
1887
  operations: [],
1878
1888
  currentIndex: -1,
1879
1889
  totalOperations: 0,
1880
1890
  reversibleOperations: 0,
1881
1891
  irreversibleOperations: 0
1882
- }, _ = (E, h) => {
1883
- a.value?.getOperationLogStore().markIrreversible(E, h);
1884
- }, U = (E, h, $, D = "success", j) => a.value?.getOperationLogStore().logAction(E, h, $, D, j) ?? "", m = (E) => {
1885
- a.value?.getOperationLogStore().configure(E);
1892
+ }, U = (w, $) => {
1893
+ a.value?.getOperationLogStore().markIrreversible(w, $);
1894
+ }, m = (w, $, _, v = "success", f) => a.value?.getOperationLogStore().logAction(w, $, _, v, f) ?? "", g = (w) => {
1895
+ a.value?.getOperationLogStore().configure(w);
1886
1896
  };
1887
- Te(async () => {
1897
+ xe(async () => {
1888
1898
  if (e) {
1889
- a.value = t || new ko(e);
1899
+ a.value = o || new Ao(e);
1890
1900
  try {
1891
- const E = a.value.getOperationLogStore(), h = to(E);
1892
- i.value = h.operations.value, u.value = h.currentIndex.value, H(
1893
- () => h.operations.value,
1894
- ($) => {
1895
- i.value = $;
1901
+ const w = a.value.getOperationLogStore(), $ = so(w);
1902
+ u.value = $.operations.value, p.value = $.currentIndex.value, H(
1903
+ () => $.operations.value,
1904
+ (_) => {
1905
+ u.value = _;
1896
1906
  }
1897
1907
  ), H(
1898
- () => h.currentIndex.value,
1899
- ($) => {
1900
- u.value = $;
1908
+ () => $.currentIndex.value,
1909
+ (_) => {
1910
+ p.value = _;
1901
1911
  }
1902
1912
  );
1903
1913
  } catch {
1904
1914
  }
1905
- if (!o.doctype && e.router) {
1906
- const E = e.router.currentRoute.value;
1907
- if (!E.path) return;
1908
- const h = E.path.split("/").filter((D) => D.length > 0), $ = h[1]?.toLowerCase();
1909
- if (h.length > 0) {
1910
- const D = {
1911
- path: E.path,
1912
- segments: h
1913
- }, j = await e.getMeta?.(D);
1914
- if (j) {
1915
- if (e.addDoctype(j), a.value.setup(j), r.value = j, c.value = $, n.value = a.value.getStore(), $ && $ !== "new") {
1916
- const B = a.value.getRecordById(j, $);
1917
- if (B)
1918
- s.value = B.get("") || {};
1915
+ if (!t.doctype && e.router) {
1916
+ const w = e.router.currentRoute.value;
1917
+ if (!w.path) return;
1918
+ const $ = w.path.split("/").filter((v) => v.length > 0), _ = $[1]?.toLowerCase();
1919
+ if ($.length > 0) {
1920
+ const v = {
1921
+ path: w.path,
1922
+ segments: $
1923
+ }, f = await e.getMeta?.(v);
1924
+ if (f) {
1925
+ if (e.addDoctype(f), a.value.setup(f), r.value = f, c.value = _, n.value = a.value.getStore(), e) {
1926
+ const y = f.schema ? Array.isArray(f.schema) ? f.schema : Array.from(f.schema) : [];
1927
+ s.value = e.resolveSchema(y);
1928
+ }
1929
+ if (_ && _ !== "new") {
1930
+ const y = a.value.getRecordById(f, _);
1931
+ if (y)
1932
+ i.value = y.get("") || {};
1919
1933
  else
1920
1934
  try {
1921
- await a.value.getRecord(j, $);
1922
- const G = a.value.getRecordById(j, $);
1923
- G && (s.value = G.get("") || {});
1935
+ await a.value.getRecord(f, _);
1936
+ const l = a.value.getRecordById(f, _);
1937
+ l && (i.value = l.get("") || {});
1924
1938
  } catch {
1925
- s.value = Ee(j);
1939
+ i.value = oe(f);
1926
1940
  }
1927
1941
  } else
1928
- s.value = Ee(j);
1929
- n.value && rt(j, $ || "new", s, n.value), a.value.runAction(j, "load", $ ? [$] : void 0);
1942
+ i.value = oe(f);
1943
+ n.value && pt(f, _ || "new", i, n.value), a.value.runAction(f, "load", _ ? [_] : void 0);
1930
1944
  }
1931
1945
  }
1932
1946
  }
1933
- if (o.doctype) {
1947
+ if (t.doctype) {
1934
1948
  n.value = a.value.getStore();
1935
- const E = o.doctype, h = o.recordId;
1936
- if (h && h !== "new") {
1937
- const $ = a.value.getRecordById(E, h);
1938
- if ($)
1939
- s.value = $.get("") || {};
1949
+ const w = t.doctype, $ = t.recordId;
1950
+ if ($ && $ !== "new") {
1951
+ const _ = a.value.getRecordById(w, $);
1952
+ if (_)
1953
+ i.value = _.get("") || {};
1940
1954
  else
1941
1955
  try {
1942
- await a.value.getRecord(E, h);
1943
- const D = a.value.getRecordById(E, h);
1944
- D && (s.value = D.get("") || {});
1956
+ await a.value.getRecord(w, $);
1957
+ const v = a.value.getRecordById(w, $);
1958
+ v && (i.value = v.get("") || {});
1945
1959
  } catch {
1946
- s.value = Ee(E);
1960
+ i.value = oe(w);
1947
1961
  }
1948
1962
  } else
1949
- s.value = Ee(E);
1950
- n.value && rt(E, h || "new", s, n.value);
1963
+ i.value = oe(w);
1964
+ n.value && pt(w, $ || "new", i, n.value);
1951
1965
  }
1952
1966
  }
1953
1967
  });
1954
- const v = (E, h) => {
1955
- const $ = o.doctype || r.value;
1956
- if (!$) return "";
1957
- const D = h || o.recordId || c.value || "new";
1958
- return `${$.slug}.${D}.${E}`;
1959
- }, C = (E) => {
1960
- const h = o.doctype || r.value;
1961
- if (!(!n.value || !a.value || !h))
1968
+ const A = (w, $) => {
1969
+ const _ = t.doctype || r.value;
1970
+ if (!_) return "";
1971
+ const v = $ || t.recordId || c.value || "new";
1972
+ return `${_.slug}.${v}.${w}`;
1973
+ }, F = (w) => {
1974
+ const $ = t.doctype || r.value;
1975
+ if (!(!n.value || !a.value || !$))
1962
1976
  try {
1963
- const $ = E.path.split(".");
1964
- if ($.length >= 2) {
1965
- const B = $[0], G = $[1];
1966
- if (n.value.has(`${B}.${G}`) || a.value.addRecord(h, G, { ...s.value }), $.length > 3) {
1967
- const g = `${B}.${G}`, f = $.slice(2);
1968
- let y = g;
1969
- for (let l = 0; l < f.length - 1; l++)
1970
- if (y += `.${f[l]}`, !n.value.has(y)) {
1971
- const d = f[l + 1], S = !isNaN(Number(d));
1972
- n.value.set(y, S ? [] : {});
1977
+ const _ = w.path.split(".");
1978
+ if (_.length >= 2) {
1979
+ const y = _[0], l = _[1];
1980
+ if (n.value.has(`${y}.${l}`) || a.value.addRecord($, l, { ...i.value }), _.length > 3) {
1981
+ const d = `${y}.${l}`, S = _.slice(2);
1982
+ let R = d;
1983
+ for (let z = 0; z < S.length - 1; z++)
1984
+ if (R += `.${S[z]}`, !n.value.has(R)) {
1985
+ const te = S[z + 1], q = !isNaN(Number(te));
1986
+ n.value.set(R, q ? [] : {});
1973
1987
  }
1974
1988
  }
1975
1989
  }
1976
- n.value.set(E.path, E.value);
1977
- const D = E.fieldname.split("."), j = { ...s.value };
1978
- D.length === 1 ? j[D[0]] = E.value : Do(j, D, E.value), s.value = j;
1990
+ n.value.set(w.path, w.value);
1991
+ const v = w.fieldname.split("."), f = { ...i.value };
1992
+ v.length === 1 ? f[v[0]] = w.value : To(f, v, w.value), i.value = f;
1979
1993
  } catch {
1980
1994
  }
1981
1995
  };
1982
- (o.doctype || e?.router) && (Ue("hstPathProvider", v), Ue("hstChangeHandler", C));
1983
- const F = {
1984
- operations: i,
1985
- currentIndex: u,
1996
+ (t.doctype || e?.router) && (Ge("hstPathProvider", A), Ge("hstChangeHandler", F));
1997
+ const G = (w, $, _) => {
1998
+ if (!a.value)
1999
+ return oe($);
2000
+ if (_)
2001
+ try {
2002
+ const v = n.value?.get(w);
2003
+ return v && typeof v == "object" ? v : oe($);
2004
+ } catch {
2005
+ return oe($);
2006
+ }
2007
+ return oe($);
2008
+ }, N = async (w, $) => {
2009
+ if (!n.value || !a.value)
2010
+ throw new Error("HST store not initialized");
2011
+ const _ = `${w.slug}.${$}`, v = { ...n.value.get(_) || {} }, f = w.schema ? Array.isArray(w.schema) ? w.schema : Array.from(w.schema) : [], y = (e ? e.resolveSchema(f) : f).filter(
2012
+ (l) => "fieldtype" in l && l.fieldtype === "Doctype" && "schema" in l && Array.isArray(l.schema)
2013
+ );
2014
+ for (const l of y) {
2015
+ const d = l, S = `${_}.${d.fieldname}`, R = Nt(d.schema, S, n.value);
2016
+ v[d.fieldname] = R;
2017
+ }
2018
+ return v;
2019
+ }, P = (w, $) => ({
2020
+ provideHSTPath: (_) => `${w}.${_}`,
2021
+ handleHSTChange: (_) => {
2022
+ const v = _.path.startsWith(w) ? _.path : `${w}.${_.fieldname}`;
2023
+ F({
2024
+ ..._,
2025
+ path: v
2026
+ });
2027
+ }
2028
+ }), B = {
2029
+ operations: u,
2030
+ currentIndex: p,
1986
2031
  undoRedoState: O,
1987
- canUndo: p,
2032
+ canUndo: h,
1988
2033
  canRedo: b,
1989
- undoCount: w,
1990
- redoCount: N,
1991
- undo: k,
1992
- redo: V,
1993
- startBatch: P,
1994
- commitBatch: x,
1995
- cancelBatch: W,
2034
+ undoCount: D,
2035
+ redoCount: k,
2036
+ undo: V,
2037
+ redo: M,
2038
+ startBatch: x,
2039
+ commitBatch: W,
2040
+ cancelBatch: Z,
1996
2041
  clear: J,
1997
2042
  getOperationsFor: K,
1998
- getSnapshot: z,
1999
- markIrreversible: _,
2000
- logAction: U,
2001
- configure: m
2043
+ getSnapshot: E,
2044
+ markIrreversible: U,
2045
+ logAction: m,
2046
+ configure: g
2002
2047
  };
2003
- return o.doctype ? {
2048
+ return t.doctype ? {
2004
2049
  stonecrop: a,
2005
- operationLog: F,
2006
- provideHSTPath: v,
2007
- handleHSTChange: C,
2050
+ operationLog: B,
2051
+ provideHSTPath: A,
2052
+ handleHSTChange: F,
2008
2053
  hstStore: n,
2009
- formData: s
2010
- } : !o.doctype && e?.router ? {
2054
+ formData: i,
2055
+ resolvedSchema: s,
2056
+ loadNestedData: G,
2057
+ saveRecursive: N,
2058
+ createNestedContext: P
2059
+ } : !t.doctype && e?.router ? {
2011
2060
  stonecrop: a,
2012
- operationLog: F,
2013
- provideHSTPath: v,
2014
- handleHSTChange: C,
2061
+ operationLog: B,
2062
+ provideHSTPath: A,
2063
+ handleHSTChange: F,
2015
2064
  hstStore: n,
2016
- formData: s
2065
+ formData: i,
2066
+ resolvedSchema: s,
2067
+ loadNestedData: G,
2068
+ saveRecursive: N,
2069
+ createNestedContext: P
2017
2070
  } : {
2018
2071
  stonecrop: a,
2019
- operationLog: F
2072
+ operationLog: B
2020
2073
  };
2021
2074
  }
2022
- function Ee(o) {
2075
+ function oe(t) {
2023
2076
  const e = {};
2024
- return o.schema && o.schema.forEach((t) => {
2025
- switch ("fieldtype" in t ? t.fieldtype : "Data") {
2077
+ return t.schema && t.schema.forEach((o) => {
2078
+ switch ("fieldtype" in o ? o.fieldtype : "Data") {
2026
2079
  case "Data":
2027
2080
  case "Text":
2028
- e[t.fieldname] = "";
2081
+ e[o.fieldname] = "";
2029
2082
  break;
2030
2083
  case "Check":
2031
- e[t.fieldname] = !1;
2084
+ e[o.fieldname] = !1;
2032
2085
  break;
2033
2086
  case "Int":
2034
2087
  case "Float":
2035
- e[t.fieldname] = 0;
2088
+ e[o.fieldname] = 0;
2036
2089
  break;
2037
2090
  case "Table":
2038
- e[t.fieldname] = [];
2091
+ e[o.fieldname] = [];
2039
2092
  break;
2040
2093
  case "JSON":
2041
- e[t.fieldname] = {};
2094
+ e[o.fieldname] = {};
2042
2095
  break;
2043
2096
  default:
2044
- e[t.fieldname] = null;
2097
+ e[o.fieldname] = null;
2045
2098
  }
2046
2099
  }), e;
2047
2100
  }
2048
- function rt(o, e, t, a) {
2101
+ function pt(t, e, o, a) {
2049
2102
  H(
2050
- t,
2103
+ o,
2051
2104
  (n) => {
2052
- const s = `${o.slug}.${e}`;
2105
+ const i = `${t.slug}.${e}`;
2053
2106
  Object.keys(n).forEach((r) => {
2054
- const c = `${s}.${r}`;
2107
+ const c = `${i}.${r}`;
2055
2108
  try {
2056
2109
  a.set(c, n[r]);
2057
2110
  } catch {
@@ -2061,165 +2114,262 @@ function rt(o, e, t, a) {
2061
2114
  { deep: !0 }
2062
2115
  );
2063
2116
  }
2064
- function Do(o, e, t) {
2065
- let a = o;
2066
- for (let s = 0; s < e.length - 1; s++) {
2067
- const r = e[s];
2068
- (!(r in a) || typeof a[r] != "object") && (a[r] = isNaN(Number(e[s + 1])) ? {} : []), a = a[r];
2117
+ function To(t, e, o) {
2118
+ let a = t;
2119
+ for (let i = 0; i < e.length - 1; i++) {
2120
+ const r = e[i];
2121
+ (!(r in a) || typeof a[r] != "object") && (a[r] = isNaN(Number(e[i + 1])) ? {} : []), a = a[r];
2069
2122
  }
2070
2123
  const n = e[e.length - 1];
2071
- a[n] = t;
2124
+ a[n] = o;
2125
+ }
2126
+ function Nt(t, e, o) {
2127
+ const a = { ...o.get(e) || {} }, n = t.filter(
2128
+ (i) => "fieldtype" in i && i.fieldtype === "Doctype" && "schema" in i && Array.isArray(i.schema)
2129
+ );
2130
+ for (const i of n) {
2131
+ const r = i, c = `${e}.${r.fieldname}`, s = Nt(r.schema, c, o);
2132
+ a[r.fieldname] = s;
2133
+ }
2134
+ return a;
2135
+ }
2136
+ typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
2137
+ function xo(t, e) {
2138
+ return Xe() ? (Ye(t, e), !0) : !1;
2139
+ }
2140
+ typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
2141
+ const Po = () => {
2142
+ };
2143
+ function Vo(...t) {
2144
+ if (t.length !== 1) return ne(...t);
2145
+ const e = t[0];
2146
+ return typeof e == "function" ? Ve(et(() => ({
2147
+ get: e,
2148
+ set: Po
2149
+ }))) : C(e);
2150
+ }
2151
+ function He(t) {
2152
+ return typeof Window < "u" && t instanceof Window ? t.document.documentElement : typeof Document < "u" && t instanceof Document ? t.documentElement : t;
2072
2153
  }
2073
- const Ro = (o, e) => {
2074
- const t = o.__vccOpts || o;
2154
+ const Ue = /* @__PURE__ */ new WeakMap();
2155
+ function Mo(t, e = !1) {
2156
+ const o = $e(e);
2157
+ let a = "";
2158
+ H(Vo(t), (r) => {
2159
+ const c = He(X(r));
2160
+ if (c) {
2161
+ const s = c;
2162
+ if (Ue.get(s) || Ue.set(s, s.style.overflow), s.style.overflow !== "hidden" && (a = s.style.overflow), s.style.overflow === "hidden") return o.value = !0;
2163
+ if (o.value) return s.style.overflow = "hidden";
2164
+ }
2165
+ }, { immediate: !0 });
2166
+ const n = () => {
2167
+ const r = He(X(t));
2168
+ !r || o.value || (r.style.overflow = "hidden", o.value = !0);
2169
+ }, i = () => {
2170
+ const r = He(X(t));
2171
+ !r || !o.value || (r.style.overflow = a, Ue.delete(r), o.value = !1);
2172
+ };
2173
+ return xo(i), I({
2174
+ get() {
2175
+ return o.value;
2176
+ },
2177
+ set(r) {
2178
+ r ? n() : i();
2179
+ }
2180
+ });
2181
+ }
2182
+ function jo() {
2183
+ let t = !1;
2184
+ const e = $e(!1);
2185
+ return (o, a) => {
2186
+ if (e.value = a.value, t) return;
2187
+ t = !0;
2188
+ const n = Mo(o, a.value);
2189
+ H(e, (i) => n.value = i);
2190
+ };
2191
+ }
2192
+ jo();
2193
+ const Lo = (t, e) => {
2194
+ const o = t.__vccOpts || t;
2075
2195
  for (const [a, n] of e)
2076
- t[a] = n;
2077
- return t;
2196
+ o[a] = n;
2197
+ return o;
2078
2198
  };
2079
- function Co(o, e) {
2080
- return dt() ? (pt(o, e), !0) : !1;
2199
+ function Fo(t, e) {
2200
+ return Xe() ? (Ye(t, e), !0) : !1;
2081
2201
  }
2082
2202
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
2083
- const Io = () => {
2203
+ const Bo = () => {
2084
2204
  };
2085
- function To(...o) {
2086
- if (o.length !== 1) return ie(...o);
2087
- const e = o[0];
2088
- return typeof e == "function" ? Ge(vt(() => ({
2205
+ function Ho(...t) {
2206
+ if (t.length !== 1) return ne(...t);
2207
+ const e = t[0];
2208
+ return typeof e == "function" ? Ve(et(() => ({
2089
2209
  get: e,
2090
- set: Io
2091
- }))) : R(e);
2210
+ set: Bo
2211
+ }))) : C(e);
2092
2212
  }
2093
- function Fe(o) {
2094
- return typeof Window < "u" && o instanceof Window ? o.document.documentElement : typeof Document < "u" && o instanceof Document ? o.documentElement : o;
2213
+ function We(t) {
2214
+ return typeof Window < "u" && t instanceof Window ? t.document.documentElement : typeof Document < "u" && t instanceof Document ? t.documentElement : t;
2095
2215
  }
2096
- const Me = /* @__PURE__ */ new WeakMap();
2097
- function Ao(o, e = !1) {
2098
- const t = Je(e);
2216
+ const Ke = /* @__PURE__ */ new WeakMap();
2217
+ function Uo(t, e = !1) {
2218
+ const o = $e(e);
2099
2219
  let a = "";
2100
- H(To(o), (r) => {
2101
- const c = Fe(ee(r));
2220
+ H(Ho(t), (r) => {
2221
+ const c = We(X(r));
2102
2222
  if (c) {
2103
- const i = c;
2104
- if (Me.get(i) || Me.set(i, i.style.overflow), i.style.overflow !== "hidden" && (a = i.style.overflow), i.style.overflow === "hidden") return t.value = !0;
2105
- if (t.value) return i.style.overflow = "hidden";
2223
+ const s = c;
2224
+ if (Ke.get(s) || Ke.set(s, s.style.overflow), s.style.overflow !== "hidden" && (a = s.style.overflow), s.style.overflow === "hidden") return o.value = !0;
2225
+ if (o.value) return s.style.overflow = "hidden";
2106
2226
  }
2107
2227
  }, { immediate: !0 });
2108
2228
  const n = () => {
2109
- const r = Fe(ee(o));
2110
- !r || t.value || (r.style.overflow = "hidden", t.value = !0);
2111
- }, s = () => {
2112
- const r = Fe(ee(o));
2113
- !r || !t.value || (r.style.overflow = a, Me.delete(r), t.value = !1);
2229
+ const r = We(X(t));
2230
+ !r || o.value || (r.style.overflow = "hidden", o.value = !0);
2231
+ }, i = () => {
2232
+ const r = We(X(t));
2233
+ !r || !o.value || (r.style.overflow = a, Ke.delete(r), o.value = !1);
2114
2234
  };
2115
- return Co(s), A({
2235
+ return Fo(i), I({
2116
2236
  get() {
2117
- return t.value;
2237
+ return o.value;
2118
2238
  },
2119
2239
  set(r) {
2120
- r ? n() : s();
2240
+ r ? n() : i();
2121
2241
  }
2122
2242
  });
2123
2243
  }
2124
- function xo() {
2125
- let o = !1;
2126
- const e = Je(!1);
2127
- return (t, a) => {
2128
- if (e.value = a.value, o) return;
2129
- o = !0;
2130
- const n = Ao(t, a.value);
2131
- H(e, (s) => n.value = s);
2244
+ function Wo() {
2245
+ let t = !1;
2246
+ const e = $e(!1);
2247
+ return (o, a) => {
2248
+ if (e.value = a.value, t) return;
2249
+ t = !0;
2250
+ const n = Uo(o, a.value);
2251
+ H(e, (i) => n.value = i);
2132
2252
  };
2133
2253
  }
2134
- xo();
2254
+ Wo();
2135
2255
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
2136
- const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2256
+ const Ko = { class: "aform" }, zo = {
2257
+ key: 0,
2258
+ class: "aform-nested-section"
2259
+ }, Jo = {
2260
+ key: 0,
2261
+ class: "aform-nested-label"
2262
+ }, Go = /* @__PURE__ */ Se({
2137
2263
  __name: "AForm",
2138
- props: {
2139
- modelValue: {},
2140
- data: {},
2264
+ props: /* @__PURE__ */ at({
2265
+ schema: {},
2141
2266
  readOnly: { type: Boolean }
2142
- },
2143
- emits: ["update:modelValue"],
2144
- setup(o, { emit: e }) {
2145
- const t = e, a = R(o.data || {});
2146
- Rt(() => {
2147
- o.data && (a.value = o.data, o.modelValue.forEach((r) => {
2148
- r.fieldname && o.data[r.fieldname] !== void 0 && (r.value = o.data[r.fieldname]);
2149
- }));
2267
+ }, {
2268
+ data: { required: !0 },
2269
+ dataModifiers: {}
2270
+ }),
2271
+ emits: /* @__PURE__ */ at(["update:schema", "update:data"], ["update:data"]),
2272
+ setup(t, { emit: e }) {
2273
+ const o = e, a = Pt(t, "data"), n = C({});
2274
+ Ee(() => {
2275
+ !t.schema || !a.value || t.schema.forEach((s) => {
2276
+ "schema" in s && Array.isArray(s.schema) && s.schema.length > 0 && (!n.value[s.fieldname] && a.value[s.fieldname] ? n.value[s.fieldname] = a.value[s.fieldname] : n.value[s.fieldname] || (n.value[s.fieldname] = {}));
2277
+ });
2278
+ }), Ee(() => {
2279
+ Object.keys(n.value).forEach((s) => {
2280
+ a.value && n.value[s] !== a.value[s] && (a.value[s] = n.value[s], o("update:data", a.value));
2281
+ });
2282
+ }), Ee(() => {
2283
+ a.value && t.schema && t.schema.forEach((s) => {
2284
+ s.fieldname && a.value[s.fieldname] !== void 0 && (s.value = a.value[s.fieldname]);
2285
+ });
2150
2286
  });
2151
- const n = (r) => {
2152
- let c = {};
2153
- for (const [i, u] of Object.entries(r))
2154
- ["component", "fieldtype"].includes(i) || (c[i] = u), i === "rows" && u && u.length === 0 && (c.rows = a.value[r.fieldname]);
2155
- return c;
2156
- }, s = A({
2157
- get: () => o.modelValue.map((r, c) => A({
2287
+ const i = (s) => {
2288
+ const u = {};
2289
+ for (const [p, h] of Object.entries(s))
2290
+ ["component", "fieldtype"].includes(p) || (u[p] = h), p === "rows" && (!h || Array.isArray(h) && h.length === 0) && (u.rows = a.value[s.fieldname] || []);
2291
+ return u;
2292
+ }, r = C([]);
2293
+ Ee(() => {
2294
+ t.schema && r.value.length !== t.schema.length && (r.value = t.schema.map((s, u) => I({
2158
2295
  get() {
2159
- return r.value;
2296
+ return s.value;
2160
2297
  },
2161
- set: (i) => {
2162
- o.modelValue[c].value = i, t("update:modelValue", o.modelValue);
2298
+ set: (p) => {
2299
+ const h = t.schema[u].fieldname;
2300
+ t.schema[u].value = p, h && a.value && (a.value[h] = p, o("update:data", a.value)), o("update:schema", t.schema);
2163
2301
  }
2164
- })),
2165
- set: () => {
2166
- }
2302
+ })));
2167
2303
  });
2168
- return (r, c) => (L(), M("form", Vo, [
2169
- (L(!0), M(me, null, ye(o.modelValue, (i, u) => (L(), Ke(Ct(i.component), It({
2170
- key: u,
2171
- modelValue: s.value[u].value,
2172
- "onUpdate:modelValue": (p) => s.value[u].value = p,
2173
- schema: i,
2174
- data: a.value[i.fieldname],
2175
- readOnly: o.readOnly
2176
- }, { ref_for: !0 }, n(i)), null, 16, ["modelValue", "onUpdate:modelValue", "schema", "data", "readOnly"]))), 128))
2177
- ]));
2304
+ const c = I(() => r.value);
2305
+ return (s, u) => {
2306
+ const p = bt("AForm", !0);
2307
+ return j(), L("form", Ko, [
2308
+ (j(!0), L(ue, null, be(t.schema, (h, b) => (j(), L(ue, { key: b }, [
2309
+ "schema" in h && Array.isArray(h.schema) && h.schema.length > 0 ? (j(), L("div", zo, [
2310
+ h.label ? (j(), L("h4", Jo, ee(h.label), 1)) : ce("", !0),
2311
+ ae(p, {
2312
+ data: n.value[h.fieldname],
2313
+ "onUpdate:data": (D) => n.value[h.fieldname] = D,
2314
+ schema: h.schema,
2315
+ "read-only": t.readOnly || h.readOnly
2316
+ }, null, 8, ["data", "onUpdate:data", "schema", "read-only"])
2317
+ ])) : (j(), Qe(Vt(h.component), Mt({
2318
+ key: 1,
2319
+ modelValue: c.value[b].value,
2320
+ "onUpdate:modelValue": (D) => c.value[b].value = D,
2321
+ schema: h,
2322
+ data: a.value[h.fieldname],
2323
+ "read-only": t.readOnly
2324
+ }, { ref_for: !0 }, i(h)), null, 16, ["modelValue", "onUpdate:modelValue", "schema", "data", "read-only"]))
2325
+ ], 64))), 128))
2326
+ ]);
2327
+ };
2178
2328
  }
2179
- }), jo = /* @__PURE__ */ Ro(Po, [["__scopeId", "data-v-5336a410"]]), Lo = { class: "tabs" }, Fo = { tabindex: "0" }, Mo = { tabindex: "0" }, Bo = /* @__PURE__ */ we({
2329
+ }), qo = /* @__PURE__ */ Lo(Go, [["__scopeId", "data-v-06e17c5b"]]), Zo = { class: "tabs" }, Qo = { tabindex: "0" }, Xo = { tabindex: "0" }, Yo = /* @__PURE__ */ Se({
2180
2330
  __name: "SheetNav",
2181
2331
  props: {
2182
2332
  breadcrumbs: { default: () => [] }
2183
2333
  },
2184
- setup(o) {
2185
- const e = R(!0), t = R(!1), a = R(""), n = st("searchinput"), s = A(() => e.value ? "unrotated" : "rotated"), r = () => {
2334
+ setup(t) {
2335
+ const e = C(!0), o = C(!1), a = C(""), n = vt("searchinput"), i = I(() => e.value ? "unrotated" : "rotated"), r = () => {
2186
2336
  e.value = !e.value;
2187
2337
  }, c = async () => {
2188
- t.value = !t.value, await oe(() => {
2338
+ o.value = !o.value, await re(() => {
2189
2339
  n.value?.focus();
2190
2340
  });
2191
- }, i = (b) => {
2192
- b.preventDefault(), b.stopPropagation();
2193
- }, u = async (b) => {
2194
- b.preventDefault(), b.stopPropagation(), await c();
2341
+ }, s = (h) => {
2342
+ h.preventDefault(), h.stopPropagation();
2343
+ }, u = async (h) => {
2344
+ h.preventDefault(), h.stopPropagation(), await c();
2195
2345
  }, p = () => {
2196
2346
  };
2197
- return (b, w) => {
2198
- const N = Tt("router-link");
2199
- return L(), M("footer", null, [
2200
- T("ul", Lo, [
2347
+ return (h, b) => {
2348
+ const D = bt("router-link");
2349
+ return j(), L("footer", null, [
2350
+ T("ul", Zo, [
2201
2351
  T("li", {
2202
2352
  class: "hidebreadcrumbs",
2203
2353
  onClick: r,
2204
- onKeydown: ue(r, ["enter"])
2354
+ onKeydown: ve(r, ["enter"])
2205
2355
  }, [
2206
- T("a", Fo, [
2356
+ T("a", Qo, [
2207
2357
  T("div", {
2208
- class: ke(s.value)
2358
+ class: Oe(i.value)
2209
2359
  }, "×", 2)
2210
2360
  ])
2211
2361
  ], 32),
2212
2362
  T("li", {
2213
2363
  class: "hometab",
2214
- style: Ve({ display: e.value ? "block" : "none" }),
2364
+ style: je({ display: e.value ? "block" : "none" }),
2215
2365
  onClick: p,
2216
- onKeydown: ue(p, ["enter"])
2366
+ onKeydown: ve(p, ["enter"])
2217
2367
  }, [
2218
- se(N, {
2368
+ ae(D, {
2219
2369
  to: "/",
2220
2370
  tabindex: "0"
2221
2371
  }, {
2222
- default: be(() => [...w[5] || (w[5] = [
2372
+ default: we(() => [...b[5] || (b[5] = [
2223
2373
  T("svg", {
2224
2374
  class: "icon",
2225
2375
  "aria-label": "Home",
@@ -2236,11 +2386,11 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2236
2386
  })
2237
2387
  ], 36),
2238
2388
  T("li", {
2239
- class: ke(["searchtab", { "search-active": t.value }]),
2240
- style: Ve({ display: e.value ? "block" : "none" })
2389
+ class: Oe(["searchtab", { "search-active": o.value }]),
2390
+ style: je({ display: e.value ? "block" : "none" })
2241
2391
  }, [
2242
- T("a", Mo, [
2243
- Ne((L(), M("svg", {
2392
+ T("a", Xo, [
2393
+ Re((j(), L("svg", {
2244
2394
  class: "icon search-icon",
2245
2395
  role: "button",
2246
2396
  "aria-label": "Search",
@@ -2249,8 +2399,8 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2249
2399
  stroke: "currentColor",
2250
2400
  "stroke-width": "2",
2251
2401
  onClick: c,
2252
- onKeydown: ue(c, ["enter"])
2253
- }, [...w[6] || (w[6] = [
2402
+ onKeydown: ve(c, ["enter"])
2403
+ }, [...b[6] || (b[6] = [
2254
2404
  T("circle", {
2255
2405
  cx: "11",
2256
2406
  cy: "11",
@@ -2258,37 +2408,37 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2258
2408
  }, null, -1),
2259
2409
  T("path", { d: "M21 21l-4.35-4.35" }, null, -1)
2260
2410
  ])], 544)), [
2261
- [Be, !t.value]
2411
+ [ze, !o.value]
2262
2412
  ]),
2263
- Ne(T("input", {
2413
+ Re(T("input", {
2264
2414
  ref: "searchinput",
2265
- "onUpdate:modelValue": w[0] || (w[0] = (O) => a.value = O),
2415
+ "onUpdate:modelValue": b[0] || (b[0] = (k) => a.value = k),
2266
2416
  type: "text",
2267
2417
  placeholder: "Search...",
2268
- onClick: w[1] || (w[1] = it(() => {
2418
+ onClick: b[1] || (b[1] = ft(() => {
2269
2419
  }, ["stop"])),
2270
- onInput: w[2] || (w[2] = (O) => i(O)),
2271
- onBlur: w[3] || (w[3] = (O) => u(O)),
2420
+ onInput: b[2] || (b[2] = (k) => s(k)),
2421
+ onBlur: b[3] || (b[3] = (k) => u(k)),
2272
2422
  onKeydown: [
2273
- w[4] || (w[4] = ue((O) => u(O), ["enter"])),
2274
- ue(c, ["escape"])
2423
+ b[4] || (b[4] = ve((k) => u(k), ["enter"])),
2424
+ ve(c, ["escape"])
2275
2425
  ]
2276
2426
  }, null, 544), [
2277
- [Be, t.value],
2278
- [lt, a.value]
2427
+ [ze, o.value],
2428
+ [ht, a.value]
2279
2429
  ])
2280
2430
  ])
2281
2431
  ], 6),
2282
- (L(!0), M(me, null, ye(o.breadcrumbs, (O) => (L(), M("li", {
2283
- key: O.title,
2284
- style: Ve({ display: e.value ? "block" : "none" })
2432
+ (j(!0), L(ue, null, be(t.breadcrumbs, (k) => (j(), L("li", {
2433
+ key: k.title,
2434
+ style: je({ display: e.value ? "block" : "none" })
2285
2435
  }, [
2286
- se(N, {
2436
+ ae(D, {
2287
2437
  tabindex: "0",
2288
- to: O.to
2438
+ to: k.to
2289
2439
  }, {
2290
- default: be(() => [
2291
- De(Y(O.title), 1)
2440
+ default: we(() => [
2441
+ Ce(ee(k.title), 1)
2292
2442
  ]),
2293
2443
  _: 2
2294
2444
  }, 1032, ["to"])
@@ -2297,41 +2447,41 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2297
2447
  ]);
2298
2448
  };
2299
2449
  }
2300
- }), St = /* @__PURE__ */ ft(Bo, [["__scopeId", "data-v-eb5bcbb6"]]), Ho = {
2450
+ }), Ot = /* @__PURE__ */ wt(Yo, [["__scopeId", "data-v-eb5bcbb6"]]), ea = {
2301
2451
  key: 1,
2302
2452
  class: "loading"
2303
- }, Uo = {
2453
+ }, ta = {
2304
2454
  key: 2,
2305
2455
  class: "loading"
2306
- }, Wo = /* @__PURE__ */ we({
2456
+ }, oa = /* @__PURE__ */ Se({
2307
2457
  __name: "Desktop",
2308
2458
  props: {
2309
2459
  availableDoctypes: { default: () => [] }
2310
2460
  },
2311
- setup(o) {
2312
- const { stonecrop: e } = No(), t = R(!1), a = R(!1), n = R(!1), s = A({
2461
+ setup(t) {
2462
+ const { stonecrop: e } = Io(), o = C(!1), a = C(!1), n = C(!1), i = I({
2313
2463
  get() {
2314
- if (!e.value || !i.value || !p.value)
2464
+ if (!e.value || !s.value || !p.value)
2315
2465
  return {};
2316
2466
  try {
2317
- return e.value.getRecordById(i.value, p.value)?.get("") || {};
2467
+ return e.value.getRecordById(s.value, p.value)?.get("") || {};
2318
2468
  } catch {
2319
2469
  return {};
2320
2470
  }
2321
2471
  },
2322
2472
  set(l) {
2323
- if (!(!e.value || !i.value || !p.value))
2473
+ if (!(!e.value || !s.value || !p.value))
2324
2474
  try {
2325
2475
  const d = e.value.getStore();
2326
- for (const [S, I] of Object.entries(l)) {
2327
- const X = `${i.value}.${p.value}.${S}`;
2328
- d.set(X, I);
2476
+ for (const [S, R] of Object.entries(l)) {
2477
+ const z = `${s.value}.${p.value}.${S}`;
2478
+ d.set(z, R);
2329
2479
  }
2330
2480
  } catch (d) {
2331
2481
  console.warn("HST update failed:", d);
2332
2482
  }
2333
2483
  }
2334
- }), r = A(() => Oe(e.value?.registry.router?.currentRoute)), c = A(() => e.value?.registry.router), i = A(() => {
2484
+ }), r = I(() => Ne(e.value?.registry.router?.currentRoute)), c = I(() => e.value?.registry.router), s = I(() => {
2335
2485
  if (!r.value) return "";
2336
2486
  if (r.value.meta?.actualDoctype)
2337
2487
  return r.value.meta.actualDoctype;
@@ -2339,7 +2489,7 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2339
2489
  return r.value.params.doctype;
2340
2490
  const l = r.value.params.pathMatch;
2341
2491
  return l && l.length > 0 ? l[0] : "";
2342
- }), u = A(() => {
2492
+ }), u = I(() => {
2343
2493
  if (!r.value) return "";
2344
2494
  if (r.value.meta?.doctype)
2345
2495
  return r.value.meta.doctype;
@@ -2347,13 +2497,13 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2347
2497
  return r.value.params.doctype;
2348
2498
  const l = r.value.params.pathMatch;
2349
2499
  return l && l.length > 0 ? l[0] : "";
2350
- }), p = A(() => {
2500
+ }), p = I(() => {
2351
2501
  if (!r.value) return "";
2352
2502
  if (r.value.params.recordId)
2353
2503
  return r.value.params.recordId;
2354
2504
  const l = r.value.params.pathMatch;
2355
2505
  return l && l.length > 1 ? l[1] : "";
2356
- }), b = A(() => p.value?.startsWith("new-")), w = A(() => {
2506
+ }), h = I(() => p.value?.startsWith("new-")), b = I(() => {
2357
2507
  if (!r.value || r.value.name === "home" || r.value.path === "/")
2358
2508
  return "doctypes";
2359
2509
  if (r.value.name && r.value.name !== "catch-all") {
@@ -2365,37 +2515,37 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2365
2515
  }
2366
2516
  const l = r.value.params.pathMatch;
2367
2517
  return l && l.length > 0 ? l.length === 1 ? "records" : "record" : "doctypes";
2368
- }), N = () => {
2369
- if (!e.value || !i.value || !p.value)
2518
+ }), D = () => {
2519
+ if (!e.value || !s.value || !p.value)
2370
2520
  return [];
2371
2521
  try {
2372
- const d = e.value.registry.registry[i.value];
2522
+ const d = e.value.registry.registry[s.value];
2373
2523
  if (!d?.workflow?.states)
2374
2524
  return [];
2375
- const S = b.value ? "creating" : "editing", I = d.workflow.states[S];
2376
- return I?.on ? Object.keys(I.on).map((q) => {
2377
- const ce = I.on?.[q], Q = typeof ce == "string" ? ce : "unknown", $t = async () => {
2378
- const qe = e.value?.getRecordById(i.value, p.value);
2379
- if (qe) {
2380
- const _t = s.value || {};
2381
- await qe.triggerTransition(q, {
2525
+ const S = h.value ? "creating" : "editing", R = d.workflow.states[S];
2526
+ return R?.on ? Object.keys(R.on).map((q) => {
2527
+ const pe = R.on?.[q], Y = typeof pe == "string" ? pe : "unknown", Rt = async () => {
2528
+ const tt = e.value?.getRecordById(s.value, p.value);
2529
+ if (tt) {
2530
+ const Ct = i.value || {};
2531
+ await tt.triggerTransition(q, {
2382
2532
  currentState: S,
2383
- targetState: Q,
2384
- fsmContext: _t
2533
+ targetState: Y,
2534
+ fsmContext: Ct
2385
2535
  });
2386
2536
  }
2387
2537
  };
2388
2538
  return {
2389
- label: `${q} (→ ${Q})`,
2390
- action: $t
2539
+ label: `${q} (→ ${Y})`,
2540
+ action: Rt
2391
2541
  };
2392
2542
  }) : [];
2393
2543
  } catch (l) {
2394
2544
  return console.warn("Error getting available transitions:", l), [];
2395
2545
  }
2396
- }, O = A(() => {
2546
+ }, k = I(() => {
2397
2547
  const l = [];
2398
- switch (w.value) {
2548
+ switch (b.value) {
2399
2549
  case "doctypes":
2400
2550
  l.push({
2401
2551
  type: "button",
@@ -2411,7 +2561,7 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2411
2561
  type: "button",
2412
2562
  label: "New Record",
2413
2563
  action: () => {
2414
- z();
2564
+ K();
2415
2565
  }
2416
2566
  },
2417
2567
  {
@@ -2424,7 +2574,7 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2424
2574
  );
2425
2575
  break;
2426
2576
  case "record": {
2427
- const d = N();
2577
+ const d = D();
2428
2578
  d.length > 0 && l.push({
2429
2579
  type: "dropdown",
2430
2580
  label: "Actions",
@@ -2434,15 +2584,15 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2434
2584
  }
2435
2585
  }
2436
2586
  return l;
2437
- }), k = A(() => {
2587
+ }), O = I(() => {
2438
2588
  const l = [];
2439
- return w.value === "records" && u.value ? l.push(
2589
+ return b.value === "records" && u.value ? l.push(
2440
2590
  { title: "Home", to: "/" },
2441
2591
  { title: x(u.value), to: `/${u.value}` }
2442
- ) : w.value === "record" && u.value && l.push(
2592
+ ) : b.value === "record" && u.value && l.push(
2443
2593
  { title: "Home", to: "/" },
2444
2594
  { title: x(u.value), to: `/${u.value}` },
2445
- { title: b.value ? "New Record" : "Edit Record", to: r.value?.fullPath || "" }
2595
+ { title: h.value ? "New Record" : "Edit Record", to: r.value?.fullPath || "" }
2446
2596
  ), l;
2447
2597
  }), V = (l) => {
2448
2598
  const d = [
@@ -2469,9 +2619,9 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2469
2619
  title: `Create New ${x(u.value)}`,
2470
2620
  description: `Create a new ${u.value} record`,
2471
2621
  action: () => {
2472
- z();
2622
+ K();
2473
2623
  }
2474
- })), o.availableDoctypes.forEach((S) => {
2624
+ })), t.availableDoctypes.forEach((S) => {
2475
2625
  d.push({
2476
2626
  title: `View ${x(S)}`,
2477
2627
  description: `Navigate to ${S} list`,
@@ -2482,24 +2632,24 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2482
2632
  }), l ? d.filter(
2483
2633
  (S) => S.title.toLowerCase().includes(l.toLowerCase()) || S.description.toLowerCase().includes(l.toLowerCase())
2484
2634
  ) : d;
2485
- }, P = (l) => {
2635
+ }, M = (l) => {
2486
2636
  l.action(), n.value = !1;
2487
- }, x = (l) => l.split("-").map((d) => d.charAt(0).toUpperCase() + d.slice(1)).join(" "), W = (l) => e.value ? e.value.getRecordIds(l).length : 0, J = async (l) => {
2637
+ }, x = (l) => l.split("-").map((d) => d.charAt(0).toUpperCase() + d.slice(1)).join(" "), W = (l) => e.value ? e.value.getRecordIds(l).length : 0, Z = async (l) => {
2488
2638
  await c.value?.push(`/${l}`);
2489
- }, K = async (l) => {
2639
+ }, J = async (l) => {
2490
2640
  await c.value?.push(`/${u.value}/${l}`);
2491
- }, z = async () => {
2641
+ }, K = async () => {
2492
2642
  const l = `new-${Date.now()}`;
2493
2643
  await c.value?.push(`/${u.value}/${l}`);
2494
- }, _ = (l) => {
2644
+ }, E = (l) => {
2495
2645
  if (e.value)
2496
2646
  try {
2497
2647
  e.value.records(l);
2498
2648
  } catch {
2499
2649
  }
2500
2650
  }, U = () => {
2501
- if (!o.availableDoctypes.length) return [];
2502
- const l = o.availableDoctypes.map((d) => ({
2651
+ if (!t.availableDoctypes.length) return [];
2652
+ const l = t.availableDoctypes.map((d) => ({
2503
2653
  id: d,
2504
2654
  doctype: d,
2505
2655
  display_name: x(d),
@@ -2561,9 +2711,9 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2561
2711
  }
2562
2712
  ];
2563
2713
  }, m = () => {
2564
- if (!i.value) return [];
2714
+ if (!s.value) return [];
2565
2715
  if (!e.value) return [];
2566
- const l = C(), d = F();
2716
+ const l = A(), d = F();
2567
2717
  if (d.length === 0)
2568
2718
  return [
2569
2719
  {
@@ -2574,9 +2724,9 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2574
2724
  <nav class="breadcrumbs">
2575
2725
  <a href="/">Home</a>
2576
2726
  <span class="separator">/</span>
2577
- <span class="current">${x(u.value || i.value)}</span>
2727
+ <span class="current">${x(u.value || s.value)}</span>
2578
2728
  </nav>
2579
- <h1>${x(u.value || i.value)} Records</h1>
2729
+ <h1>${x(u.value || s.value)} Records</h1>
2580
2730
  </div>
2581
2731
  `
2582
2732
  },
@@ -2585,15 +2735,15 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2585
2735
  component: "div",
2586
2736
  value: `
2587
2737
  <div class="loading-state">
2588
- <p>Loading ${x(u.value || i.value)} schema...</p>
2738
+ <p>Loading ${x(u.value || s.value)} schema...</p>
2589
2739
  </div>
2590
2740
  `
2591
2741
  }
2592
2742
  ];
2593
- const S = l.map((I) => ({
2594
- ...I,
2743
+ const S = l.map((R) => ({
2744
+ ...R,
2595
2745
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
2596
- id: I.id || "",
2746
+ id: R.id || "",
2597
2747
  actions: "Edit | Delete"
2598
2748
  }));
2599
2749
  return [
@@ -2605,9 +2755,9 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2605
2755
  <nav class="breadcrumbs">
2606
2756
  <a href="/">Home</a>
2607
2757
  <span class="separator">/</span>
2608
- <span class="current">${x(u.value || i.value)}</span>
2758
+ <span class="current">${x(u.value || s.value)}</span>
2609
2759
  </nav>
2610
- <h1>${x(u.value || i.value)} Records</h1>
2760
+ <h1>${x(u.value || s.value)} Records</h1>
2611
2761
  </div>
2612
2762
  `
2613
2763
  },
@@ -2617,7 +2767,7 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2617
2767
  value: `
2618
2768
  <div class="view-actions">
2619
2769
  <button class="btn-primary" data-action="create">
2620
- New ${x(u.value || i.value)}
2770
+ New ${x(u.value || s.value)}
2621
2771
  </button>
2622
2772
  </div>
2623
2773
  `
@@ -2628,7 +2778,7 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2628
2778
  component: "div",
2629
2779
  value: `
2630
2780
  <div class="empty-state">
2631
- <p>No ${u.value || i.value} records found.</p>
2781
+ <p>No ${u.value || s.value} records found.</p>
2632
2782
  <button class="btn-primary" data-action="create">
2633
2783
  Create First Record
2634
2784
  </button>
@@ -2640,10 +2790,10 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2640
2790
  fieldname: "records_table",
2641
2791
  component: "ATable",
2642
2792
  columns: [
2643
- ...d.map((I) => ({
2644
- label: I.label,
2645
- name: I.fieldname,
2646
- fieldtype: I.fieldtype,
2793
+ ...d.map((R) => ({
2794
+ label: R.label,
2795
+ name: R.fieldname,
2796
+ fieldtype: R.fieldtype,
2647
2797
  align: "left",
2648
2798
  edit: !1,
2649
2799
  width: "20ch"
@@ -2665,11 +2815,11 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2665
2815
  }
2666
2816
  ]
2667
2817
  ];
2668
- }, v = () => {
2669
- if (!i.value) return [];
2818
+ }, g = () => {
2819
+ if (!s.value) return [];
2670
2820
  if (!e.value) return [];
2671
2821
  try {
2672
- const d = e.value?.registry?.registry[i.value];
2822
+ const d = e.value?.registry?.registry[s.value];
2673
2823
  if (!d?.schema)
2674
2824
  return [
2675
2825
  {
@@ -2680,13 +2830,13 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2680
2830
  <nav class="breadcrumbs">
2681
2831
  <a href="/">Home</a>
2682
2832
  <span class="separator">/</span>
2683
- <a href="/${u.value || i.value}">${x(
2684
- u.value || i.value
2833
+ <a href="/${u.value || s.value}">${x(
2834
+ u.value || s.value
2685
2835
  )}</a>
2686
2836
  <span class="separator">/</span>
2687
- <span class="current">${b.value ? "New Record" : p.value}</span>
2837
+ <span class="current">${h.value ? "New Record" : p.value}</span>
2688
2838
  </nav>
2689
- <h1>${b.value ? `New ${x(u.value || i.value)}` : `Edit ${x(u.value || i.value)}`}</h1>
2839
+ <h1>${h.value ? `New ${x(u.value || s.value)}` : `Edit ${x(u.value || s.value)}`}</h1>
2690
2840
  </div>
2691
2841
  `
2692
2842
  },
@@ -2695,12 +2845,12 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2695
2845
  component: "div",
2696
2846
  value: `
2697
2847
  <div class="loading-state">
2698
- <p>Loading ${x(u.value || i.value)} form...</p>
2848
+ <p>Loading ${x(u.value || s.value)} form...</p>
2699
2849
  </div>
2700
2850
  `
2701
2851
  }
2702
2852
  ];
2703
- const S = "toArray" in d.schema ? d.schema.toArray() : d.schema, I = E();
2853
+ const S = "toArray" in d.schema ? d.schema.toArray() : d.schema, R = G();
2704
2854
  return [
2705
2855
  {
2706
2856
  fieldname: "header",
@@ -2710,14 +2860,14 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2710
2860
  <nav class="breadcrumbs">
2711
2861
  <a href="/">Home</a>
2712
2862
  <span class="separator">/</span>
2713
- <a href="/${u.value || i.value}">${x(
2714
- u.value || i.value
2863
+ <a href="/${u.value || s.value}">${x(
2864
+ u.value || s.value
2715
2865
  )}</a>
2716
2866
  <span class="separator">/</span>
2717
- <span class="current">${b.value ? "New Record" : p.value}</span>
2867
+ <span class="current">${h.value ? "New Record" : p.value}</span>
2718
2868
  </nav>
2719
2869
  <h1>
2720
- ${b.value ? `New ${x(u.value || i.value)}` : `Edit ${x(u.value || i.value)}`}
2870
+ ${h.value ? `New ${x(u.value || s.value)}` : `Edit ${x(u.value || s.value)}`}
2721
2871
  </h1>
2722
2872
  </div>
2723
2873
  `
@@ -2731,14 +2881,14 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2731
2881
  ${a.value ? "Saving..." : "Save"}
2732
2882
  </button>
2733
2883
  <button class="btn-secondary" data-action="cancel">Cancel</button>
2734
- ${b.value ? "" : '<button class="btn-danger" data-action="delete">Delete</button>'}
2884
+ ${h.value ? "" : '<button class="btn-danger" data-action="delete">Delete</button>'}
2735
2885
  </div>
2736
2886
  `
2737
2887
  },
2738
- ...S.map((X) => ({
2739
- ...X,
2888
+ ...S.map((z) => ({
2889
+ ...z,
2740
2890
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
2741
- value: I[X.fieldname] || ""
2891
+ value: R[z.fieldname] || ""
2742
2892
  }))
2743
2893
  ];
2744
2894
  } catch {
@@ -2748,58 +2898,58 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2748
2898
  component: "div",
2749
2899
  value: `
2750
2900
  <div class="error-state">
2751
- <p>Unable to load form schema for ${x(u.value || i.value)}</p>
2901
+ <p>Unable to load form schema for ${x(u.value || s.value)}</p>
2752
2902
  </div>
2753
2903
  `
2754
2904
  }
2755
2905
  ];
2756
2906
  }
2757
- }, C = () => {
2758
- if (!e.value || !i.value)
2907
+ }, A = () => {
2908
+ if (!e.value || !s.value)
2759
2909
  return [];
2760
- const d = e.value.records(i.value)?.get("");
2910
+ const d = e.value.records(s.value)?.get("");
2761
2911
  return d && typeof d == "object" && !Array.isArray(d) ? Object.values(d) : [];
2762
2912
  }, F = () => {
2763
- if (!e.value || !i.value) return [];
2913
+ if (!e.value || !s.value) return [];
2764
2914
  try {
2765
- const d = e.value.registry.registry[i.value];
2915
+ const d = e.value.registry.registry[s.value];
2766
2916
  if (d?.schema)
2767
- return ("toArray" in d.schema ? d.schema.toArray() : d.schema).map((I) => ({
2768
- fieldname: I.fieldname,
2769
- label: "label" in I && I.label || I.fieldname,
2770
- fieldtype: "fieldtype" in I && I.fieldtype || "Data"
2917
+ return ("toArray" in d.schema ? d.schema.toArray() : d.schema).map((R) => ({
2918
+ fieldname: R.fieldname,
2919
+ label: "label" in R && R.label || R.fieldname,
2920
+ fieldtype: "fieldtype" in R && R.fieldtype || "Data"
2771
2921
  }));
2772
2922
  } catch {
2773
2923
  }
2774
2924
  return [];
2775
- }, E = () => !e.value || !i.value || b.value ? {} : e.value.getRecordById(i.value, p.value)?.get("") || {}, h = A(() => {
2776
- switch (w.value) {
2925
+ }, G = () => !e.value || !s.value || h.value ? {} : e.value.getRecordById(s.value, p.value)?.get("") || {}, N = I(() => {
2926
+ switch (b.value) {
2777
2927
  case "doctypes":
2778
2928
  return U();
2779
2929
  case "records":
2780
2930
  return m();
2781
2931
  case "record":
2782
- return v();
2932
+ return g();
2783
2933
  default:
2784
2934
  return [];
2785
2935
  }
2786
- }), $ = R([]);
2936
+ }), P = C([]);
2787
2937
  H(
2788
- h,
2938
+ N,
2789
2939
  (l) => {
2790
- $.value = [...l];
2940
+ P.value = [...l];
2791
2941
  },
2792
2942
  { immediate: !0, deep: !0 }
2793
2943
  ), H(
2794
- $,
2944
+ P,
2795
2945
  (l) => {
2796
- if (!(!e.value || !i.value || !p.value || b.value))
2946
+ if (!(!e.value || !s.value || !p.value || h.value))
2797
2947
  try {
2798
2948
  const d = e.value.getStore();
2799
2949
  l.forEach((S) => {
2800
2950
  if (S.fieldname && "value" in S && !["header", "actions", "loading", "error"].includes(S.fieldname)) {
2801
- const I = `${i.value}.${p.value}.${S.fieldname}`;
2802
- (d.has(I) ? d.get(I) : void 0) !== S.value && d.set(I, S.value);
2951
+ const R = `${s.value}.${p.value}.${S.fieldname}`;
2952
+ (d.has(R) ? d.get(R) : void 0) !== S.value && d.set(R, S.value);
2803
2953
  }
2804
2954
  });
2805
2955
  } catch (d) {
@@ -2808,24 +2958,24 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2808
2958
  },
2809
2959
  { deep: !0 }
2810
2960
  );
2811
- const D = async () => {
2961
+ const B = async () => {
2812
2962
  if (e.value) {
2813
2963
  a.value = !0;
2814
2964
  try {
2815
- const l = s.value || {};
2816
- if (b.value) {
2965
+ const l = i.value || {};
2966
+ if (h.value) {
2817
2967
  const d = `record-${Date.now()}`, S = { id: d, ...l };
2818
- e.value.addRecord(i.value, d, S);
2819
- const I = e.value.getRecordById(i.value, d);
2820
- I && await I.triggerTransition("SAVE", {
2968
+ e.value.addRecord(s.value, d, S);
2969
+ const R = e.value.getRecordById(s.value, d);
2970
+ R && await R.triggerTransition("SAVE", {
2821
2971
  currentState: "creating",
2822
2972
  targetState: "saved",
2823
2973
  fsmContext: S
2824
2974
  }), await c.value?.replace(`/${u.value}/${d}`);
2825
2975
  } else {
2826
2976
  const d = { id: p.value, ...l };
2827
- e.value.addRecord(i.value, p.value, d);
2828
- const S = e.value.getRecordById(i.value, p.value);
2977
+ e.value.addRecord(s.value, p.value, d);
2978
+ const S = e.value.getRecordById(s.value, p.value);
2829
2979
  S && await S.triggerTransition("SAVE", {
2830
2980
  currentState: "editing",
2831
2981
  targetState: "saved",
@@ -2837,12 +2987,12 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2837
2987
  a.value = !1;
2838
2988
  }
2839
2989
  }
2840
- }, j = async () => {
2841
- if (b.value)
2990
+ }, w = async () => {
2991
+ if (h.value)
2842
2992
  await c.value?.push(`/${u.value}`);
2843
2993
  else {
2844
2994
  if (e.value) {
2845
- const l = e.value.getRecordById(i.value, p.value);
2995
+ const l = e.value.getRecordById(s.value, p.value);
2846
2996
  l && await l.triggerTransition("CANCEL", {
2847
2997
  currentState: "editing",
2848
2998
  targetState: "cancelled"
@@ -2850,63 +3000,63 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2850
3000
  }
2851
3001
  f();
2852
3002
  }
2853
- }, B = (l, d) => {
3003
+ }, $ = (l, d) => {
2854
3004
  d && d();
2855
- }, G = async (l) => {
3005
+ }, _ = async (l) => {
2856
3006
  if (!e.value) return;
2857
3007
  const d = l || p.value;
2858
3008
  if (d && confirm("Are you sure you want to delete this record?")) {
2859
- const S = e.value.getRecordById(i.value, d);
3009
+ const S = e.value.getRecordById(s.value, d);
2860
3010
  S && await S.triggerTransition("DELETE", {
2861
3011
  currentState: "editing",
2862
3012
  targetState: "deleted"
2863
- }), e.value.removeRecord(i.value, d), w.value === "record" && await c.value?.push(`/${u.value}`);
3013
+ }), e.value.removeRecord(s.value, d), b.value === "record" && await c.value?.push(`/${u.value}`);
2864
3014
  }
2865
- }, g = async (l) => {
3015
+ }, v = async (l) => {
2866
3016
  const d = l.target, S = d.getAttribute("data-action");
2867
3017
  if (S)
2868
3018
  switch (S) {
2869
3019
  case "create":
2870
- await z();
3020
+ await K();
2871
3021
  break;
2872
3022
  case "save":
2873
- await D();
3023
+ await B();
2874
3024
  break;
2875
3025
  case "cancel":
2876
- await j();
3026
+ await w();
2877
3027
  break;
2878
3028
  case "delete":
2879
- await G();
3029
+ await _();
2880
3030
  break;
2881
3031
  }
2882
- const I = d.closest("td, th");
2883
- if (I) {
2884
- const X = I.textContent?.trim(), te = I.closest("tr");
2885
- if (X === "View Records" && te) {
3032
+ const R = d.closest("td, th");
3033
+ if (R) {
3034
+ const z = R.textContent?.trim(), te = R.closest("tr");
3035
+ if (z === "View Records" && te) {
2886
3036
  const q = te.querySelectorAll("td");
2887
3037
  if (q.length > 0) {
2888
- const Q = q[1].textContent?.trim();
2889
- Q && await J(Q);
3038
+ const Y = q[1].textContent?.trim();
3039
+ Y && await Z(Y);
2890
3040
  }
2891
- } else if (X?.includes("Edit") && te) {
3041
+ } else if (z?.includes("Edit") && te) {
2892
3042
  const q = te.querySelectorAll("td");
2893
3043
  if (q.length > 0) {
2894
- const Q = q[0].textContent?.trim();
2895
- Q && await K(Q);
3044
+ const Y = q[0].textContent?.trim();
3045
+ Y && await J(Y);
2896
3046
  }
2897
- } else if (X?.includes("Delete") && te) {
3047
+ } else if (z?.includes("Delete") && te) {
2898
3048
  const q = te.querySelectorAll("td");
2899
3049
  if (q.length > 0) {
2900
- const Q = q[0].textContent?.trim();
2901
- Q && await G(Q);
3050
+ const Y = q[0].textContent?.trim();
3051
+ Y && await _(Y);
2902
3052
  }
2903
3053
  }
2904
3054
  }
2905
3055
  };
2906
3056
  H(
2907
- [w, i, p],
3057
+ [b, s, p],
2908
3058
  () => {
2909
- w.value === "record" && f();
3059
+ b.value === "record" && f();
2910
3060
  },
2911
3061
  { immediate: !0 }
2912
3062
  ), H(
@@ -2915,34 +3065,34 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2915
3065
  },
2916
3066
  { immediate: !0 }
2917
3067
  ), H(
2918
- [w, i, e],
3068
+ [b, s, e],
2919
3069
  ([l, d, S]) => {
2920
- l === "records" && d && S && _(d);
3070
+ l === "records" && d && S && E(d);
2921
3071
  },
2922
3072
  { immediate: !0 }
2923
3073
  );
2924
3074
  const f = () => {
2925
- if (!(!e.value || !i.value)) {
2926
- t.value = !0;
3075
+ if (!(!e.value || !s.value)) {
3076
+ o.value = !0;
2927
3077
  try {
2928
- b.value || e.value.getRecordById(i.value, p.value);
3078
+ h.value || e.value.getRecordById(s.value, p.value);
2929
3079
  } catch (l) {
2930
3080
  console.warn("Error loading record data:", l);
2931
3081
  } finally {
2932
- t.value = !1;
3082
+ o.value = !1;
2933
3083
  }
2934
3084
  }
2935
3085
  };
2936
- return Ue("desktopMethods", {
2937
- navigateToDoctype: J,
2938
- openRecord: K,
2939
- createNewRecord: z,
2940
- handleSave: D,
2941
- handleCancel: j,
2942
- handleDelete: G
2943
- }), Te(() => {
2944
- oe(() => {
2945
- w.value === "records" && i.value && e.value && _(i.value);
3086
+ return Ge("desktopMethods", {
3087
+ navigateToDoctype: Z,
3088
+ openRecord: J,
3089
+ createNewRecord: K,
3090
+ handleSave: B,
3091
+ handleCancel: w,
3092
+ handleDelete: _
3093
+ }), xe(() => {
3094
+ re(() => {
3095
+ b.value === "records" && s.value && e.value && E(s.value);
2946
3096
  });
2947
3097
  const l = (d) => {
2948
3098
  (d.ctrlKey || d.metaKey) && d.key === "k" && (d.preventDefault(), n.value = !0), d.key === "Escape" && n.value && (n.value = !1);
@@ -2950,52 +3100,52 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
2950
3100
  return document.addEventListener("keydown", l), () => {
2951
3101
  document.removeEventListener("keydown", l);
2952
3102
  };
2953
- }), (l, d) => (L(), M("div", {
3103
+ }), (l, d) => (j(), L("div", {
2954
3104
  class: "desktop",
2955
- onClick: g
3105
+ onClick: v
2956
3106
  }, [
2957
- se(ht, {
2958
- elements: O.value,
2959
- onActionClick: B
3107
+ ae(St, {
3108
+ elements: k.value,
3109
+ onActionClick: $
2960
3110
  }, null, 8, ["elements"]),
2961
- $.value.length > 0 ? (L(), Ke(Oe(jo), {
3111
+ P.value.length > 0 ? (j(), Qe(Ne(qo), {
2962
3112
  key: 0,
2963
- modelValue: $.value,
2964
- "onUpdate:modelValue": d[0] || (d[0] = (S) => $.value = S),
2965
- data: s.value
2966
- }, null, 8, ["modelValue", "data"])) : Oe(e) ? (L(), M("div", Uo, [
2967
- T("p", null, "Loading " + Y(w.value) + " data...", 1)
2968
- ])) : (L(), M("div", Ho, [...d[2] || (d[2] = [
3113
+ modelValue: P.value,
3114
+ "onUpdate:modelValue": d[0] || (d[0] = (S) => P.value = S),
3115
+ data: i.value
3116
+ }, null, 8, ["modelValue", "data"])) : Ne(e) ? (j(), L("div", ta, [
3117
+ T("p", null, "Loading " + ee(b.value) + " data...", 1)
3118
+ ])) : (j(), L("div", ea, [...d[2] || (d[2] = [
2969
3119
  T("p", null, "Initializing Stonecrop...", -1)
2970
3120
  ])])),
2971
- se(St, { breadcrumbs: k.value }, null, 8, ["breadcrumbs"]),
2972
- se(gt, {
3121
+ ae(Ot, { breadcrumbs: O.value }, null, 8, ["breadcrumbs"]),
3122
+ ae($t, {
2973
3123
  "is-open": n.value,
2974
3124
  search: V,
2975
3125
  placeholder: "Type a command or search...",
2976
- onSelect: P,
3126
+ onSelect: M,
2977
3127
  onClose: d[1] || (d[1] = (S) => n.value = !1)
2978
3128
  }, {
2979
- title: be(({ result: S }) => [
2980
- De(Y(S.title), 1)
3129
+ title: we(({ result: S }) => [
3130
+ Ce(ee(S.title), 1)
2981
3131
  ]),
2982
- content: be(({ result: S }) => [
2983
- De(Y(S.description), 1)
3132
+ content: we(({ result: S }) => [
3133
+ Ce(ee(S.description), 1)
2984
3134
  ]),
2985
3135
  _: 1
2986
3136
  }, 8, ["is-open"])
2987
3137
  ]));
2988
3138
  }
2989
- }), Jo = {
2990
- install: (o) => {
2991
- o.component("ActionSet", ht), o.component("CommandPalette", gt), o.component("Desktop", Wo), o.component("SheetNav", St);
3139
+ }), ra = {
3140
+ install: (t) => {
3141
+ t.component("ActionSet", St), t.component("CommandPalette", $t), t.component("Desktop", oa), t.component("SheetNav", Ot);
2992
3142
  }
2993
3143
  };
2994
3144
  export {
2995
- ht as ActionSet,
2996
- gt as CommandPalette,
2997
- Wo as Desktop,
2998
- St as SheetNav,
2999
- Jo as StonecropDesktop
3145
+ St as ActionSet,
3146
+ $t as CommandPalette,
3147
+ oa as Desktop,
3148
+ Ot as SheetNav,
3149
+ ra as StonecropDesktop
3000
3150
  };
3001
3151
  //# sourceMappingURL=desktop.js.map