@declarion/react 0.32.0 → 0.34.0

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.
Files changed (33) hide show
  1. package/dist-lib/{ActionRunner-CaSrGpBi.js → ActionRunner-UGGvGypS.js} +676 -543
  2. package/dist-lib/{DraggableChildrenTable-CAHg7paQ.js → DraggableChildrenTable-CljdYXd_.js} +30 -30
  3. package/dist-lib/DynamicIcon-BWO6QtNF.js +261 -0
  4. package/dist-lib/{Grid-DDbBhqcl.js → Grid-5Y_iPqNW.js} +2 -2
  5. package/dist-lib/{LayoutRenderer-CelsqsZ6.js → LayoutRenderer-CoTMmvNW.js} +712 -712
  6. package/dist-lib/{MarkdownRenderer-DThy2ixe.js → MarkdownRenderer-unbncYEV.js} +1 -1
  7. package/dist-lib/RefreshControl-oeKhCjEC.js +837 -0
  8. package/dist-lib/SmartDetailPage.impl-Caxd97q6.js +1771 -0
  9. package/dist-lib/{SmartRecordListPage.impl-BKIpTNK7.js → SmartRecordListPage.impl-BF_ieDc2.js} +258 -258
  10. package/dist-lib/components/pages/DocumentsMenu.d.ts +22 -0
  11. package/dist-lib/components/pages/RecordDocumentsPanel.d.ts +42 -0
  12. package/dist-lib/components/pages/list/ListHeader.d.ts +1 -11
  13. package/dist-lib/components/primitives/Icons.d.ts +1 -0
  14. package/dist-lib/components/primitives/Tooltip.d.ts +30 -0
  15. package/dist-lib/components/primitives/index.d.ts +2 -0
  16. package/dist-lib/components/shared/ActionResultDialog.d.ts +4 -0
  17. package/dist-lib/components/shared/RecordHeader.d.ts +2 -1
  18. package/dist-lib/components/shared/ResponsiveActionBar.d.ts +9 -1
  19. package/dist-lib/icons.js +1 -1
  20. package/dist-lib/index.js +2288 -2334
  21. package/dist-lib/lib/document-templates.d.ts +12 -0
  22. package/dist-lib/lib/download.d.ts +20 -0
  23. package/dist-lib/lib/record-documents-key.d.ts +1 -0
  24. package/dist-lib/{registry-KQyyL5Gt.js → registry-DnPK3Msj.js} +826 -826
  25. package/dist-lib/testing.js +25 -25
  26. package/dist-lib/types/api.d.ts +1 -9
  27. package/dist-lib/types/schema.d.ts +17 -1
  28. package/dist-lib/{useProperties-D74hyWIa.js → useProperties-CgRhBh0k.js} +52 -52
  29. package/dist-lib/{value-BfXXl5EE.js → value-GmL5BVFm.js} +29 -29
  30. package/package.json +1 -1
  31. package/dist-lib/DynamicIcon-DCRdxxZ7.js +0 -260
  32. package/dist-lib/RefreshControl-CorluL6r.js +0 -582
  33. package/dist-lib/SmartDetailPage.impl-USIxbl-8.js +0 -1532
@@ -1,17 +1,17 @@
1
- import { s as e, t } from "./DynamicIcon-DCRdxxZ7.js";
2
- import { Bn as n, F as r, Fn as i, Hn as a, I as o, Ot as s, R as c, Vn as l, Xt as u, an as d, cn as f, dn as p, et as m, f as h, fn as g, ft as _, gn as v, h as y, kn as b, m as x, nn as S, nt as C, on as w, p as T, rn as E, sn as D, tn as O, tt as k, wn as A } from "./ActionRunner-CaSrGpBi.js";
3
- import { E as j, J as M, K as ee, T as te, Y as N, bt as P, d as F, et as I, k as L, o as R, pt as z, q as B, r as ne, t as re, tt as ie, u as ae, yt as oe } from "./registry-KQyyL5Gt.js";
4
- import { n as se, r as ce, t as le } from "./dataTableStyles-vwD1mVOP.js";
5
- import { Suspense as ue, createContext as de, lazy as V, useCallback as H, useContext as fe, useEffect as U, useId as pe, useLayoutEffect as me, useMemo as W, useRef as G, useState as K } from "react";
6
- import { useInfiniteQuery as he, useMutation as ge, useQueryClient as _e } from "@tanstack/react-query";
7
- import { Fragment as q, jsx as J, jsxs as Y } from "react/jsx-runtime";
1
+ import { s as e, t } from "./DynamicIcon-BWO6QtNF.js";
2
+ import { $t as n, Dn as r, F as i, Gn as a, I as o, Mn as s, Rn as c, Un as l, V as u, Wn as d, an as f, at as p, cn as m, dn as h, f as g, h as _, hn as v, ht as y, in as b, it as x, jt as S, ln as C, m as w, mn as T, on as E, p as D, rt as O, un as k, yn as A } from "./ActionRunner-UGGvGypS.js";
3
+ import { E as j, J as M, K as ee, T as N, Y as P, bt as F, d as I, et as L, k as R, o as z, pt as B, q as V, r as te, t as ne, tt as re, u as ie, yt as ae } from "./registry-DnPK3Msj.js";
4
+ import { n as oe, r as se, t as ce } from "./dataTableStyles-vwD1mVOP.js";
5
+ import { Suspense as le, createContext as ue, lazy as H, useCallback as U, useContext as de, useEffect as W, useId as fe, useLayoutEffect as pe, useMemo as G, useRef as K, useState as q } from "react";
6
+ import { useInfiniteQuery as me, useMutation as he, useQueryClient as ge } from "@tanstack/react-query";
7
+ import { Fragment as J, jsx as Y, jsxs as X } from "react/jsx-runtime";
8
8
  //#region src/lib/size-value.ts
9
- var ve = /^(\d+)px$/;
10
- function ye(e) {
9
+ var _e = /^(\d+)px$/;
10
+ function ve(e) {
11
11
  if (e == null || e === "") return null;
12
12
  if (e === "auto") return { kind: "auto" };
13
13
  if (e === "fill") return { kind: "fill" };
14
- let t = ve.exec(e);
14
+ let t = _e.exec(e);
15
15
  if (t) {
16
16
  let e = parseInt(t[1], 10);
17
17
  return e > 0 ? {
@@ -27,9 +27,9 @@ function ye(e) {
27
27
  }
28
28
  //#endregion
29
29
  //#region src/components/detail-layout/LayoutRow.tsx
30
- function be({ config: e, ctx: t }) {
31
- let { items: n, gap: r = 0, resizable: i = !1, stack_below: a } = e, o = a === "never" ? 0 : a ?? 768, [s, c] = K(!1), l = G(null);
32
- U(() => {
30
+ function ye({ config: e, ctx: t }) {
31
+ let { items: n, gap: r = 0, resizable: i = !1, stack_below: a } = e, o = a === "never" ? 0 : a ?? 768, [s, c] = q(!1), l = K(null);
32
+ W(() => {
33
33
  if (o === 0) return;
34
34
  let e = l.current;
35
35
  if (!e) return;
@@ -38,10 +38,10 @@ function be({ config: e, ctx: t }) {
38
38
  });
39
39
  return t.observe(e), () => t.disconnect();
40
40
  }, [o]);
41
- let [u, d] = K(null), f = G(null), p = H(() => n.map((t) => {
42
- let n = ye(t.width ?? t.column?.width ?? t.row?.width ?? e.width);
41
+ let [u, d] = q(null), f = K(null), p = U(() => n.map((t) => {
42
+ let n = ve(t.width ?? t.column?.width ?? t.row?.width ?? e.width);
43
43
  return n && n.kind === "weight" ? n.value : 1;
44
- }), [n, e.width]), m = H((e, t) => {
44
+ }), [n, e.width]), m = U((e, t) => {
45
45
  t.preventDefault();
46
46
  let n = u ?? p();
47
47
  f.current = {
@@ -58,41 +58,41 @@ function be({ config: e, ctx: t }) {
58
58
  f.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
59
59
  };
60
60
  document.addEventListener("mousemove", r), document.addEventListener("mouseup", i);
61
- }, [u, p]), h = u ?? p(), g = e.height ? Se(e.height) : void 0;
62
- return /* @__PURE__ */ J("div", {
61
+ }, [u, p]), h = u ?? p(), g = e.height ? xe(e.height) : void 0;
62
+ return /* @__PURE__ */ Y("div", {
63
63
  ref: l,
64
- className: z("flex", s && "flex-col"),
64
+ className: B("flex", s && "flex-col"),
65
65
  style: {
66
66
  gap: r ? `${r}px` : void 0,
67
67
  ...g
68
68
  },
69
- children: n.map((r, a) => /* @__PURE__ */ Y("div", {
70
- className: z("min-w-0 flex items-stretch", s && "w-full"),
71
- style: s ? void 0 : xe(r.width ?? r.column?.width ?? r.row?.width ?? e.width, h[a], r.min_width, r.max_width),
72
- children: [/* @__PURE__ */ J("div", {
73
- className: z("flex-1 min-w-0 flex flex-col", g && "overflow-y-auto overflow-x-hidden"),
74
- children: /* @__PURE__ */ J($, {
69
+ children: n.map((r, a) => /* @__PURE__ */ X("div", {
70
+ className: B("min-w-0 flex items-stretch", s && "w-full"),
71
+ style: s ? void 0 : be(r.width ?? r.column?.width ?? r.row?.width ?? e.width, h[a], r.min_width, r.max_width),
72
+ children: [/* @__PURE__ */ Y("div", {
73
+ className: B("flex-1 min-w-0 flex flex-col", g && "overflow-y-auto overflow-x-hidden"),
74
+ children: /* @__PURE__ */ Y($, {
75
75
  node: r,
76
76
  ctx: t
77
77
  })
78
- }), i && !s && a < n.length - 1 && /* @__PURE__ */ J("div", {
78
+ }), i && !s && a < n.length - 1 && /* @__PURE__ */ Y("div", {
79
79
  className: "detail-resize-handle",
80
80
  onMouseDown: (e) => m(a, e)
81
81
  })]
82
82
  }, a))
83
83
  });
84
84
  }
85
- function xe(e, t, n, r) {
86
- let i = ye(e), a;
85
+ function be(e, t, n, r) {
86
+ let i = ve(e), a;
87
87
  return a = !i || i.kind === "weight" ? `${t} 1 0%` : i.kind === "px" ? `0 0 ${i.value}px` : i.kind === "fill" ? "1 1 0%" : "0 0 auto", {
88
88
  flex: a,
89
89
  minWidth: n,
90
90
  maxWidth: r
91
91
  };
92
92
  }
93
- function Se(e) {
93
+ function xe(e) {
94
94
  if (!e) return;
95
- let t = ye(e);
95
+ let t = ve(e);
96
96
  if (t?.kind === "px") return {
97
97
  height: `${t.value}px`,
98
98
  overflow: "hidden"
@@ -104,12 +104,12 @@ function Se(e) {
104
104
  }
105
105
  //#endregion
106
106
  //#region src/components/detail-layout/LayoutColumn.tsx
107
- function Ce({ config: e, ctx: t }) {
107
+ function Se({ config: e, ctx: t }) {
108
108
  let { items: n, gap: r = 12 } = e;
109
- return /* @__PURE__ */ J("div", {
109
+ return /* @__PURE__ */ Y("div", {
110
110
  className: "flex flex-col h-full",
111
111
  style: { gap: r ? `${r}px` : void 0 },
112
- children: n.map((e, n) => /* @__PURE__ */ J($, {
112
+ children: n.map((e, n) => /* @__PURE__ */ Y($, {
113
113
  node: e,
114
114
  ctx: t
115
115
  }, n))
@@ -117,23 +117,23 @@ function Ce({ config: e, ctx: t }) {
117
117
  }
118
118
  //#endregion
119
119
  //#region src/components/detail-layout/blockMeta.ts
120
- function we(e) {
120
+ function Ce(e) {
121
121
  return e.children ?? e.associated;
122
122
  }
123
- function X(e, t) {
124
- let n = we(e);
123
+ function Z(e, t) {
124
+ let n = Ce(e);
125
125
  if (n) {
126
- if (e.label) return w(e.label);
126
+ if (e.label) return C(e.label);
127
127
  let r = t.entity.children?.find((e) => e.entity === n);
128
- if (r?.display?.name) return w(r.display.name);
128
+ if (r?.display?.name) return C(r.display.name);
129
129
  let i = t.schema.entities[n];
130
- return i && (w(i.display.name_plural) || w(i.display.name)) || n;
130
+ return i && (C(i.display.name_plural) || C(i.display.name)) || n;
131
131
  }
132
- return e.section ? w(e.section.name) : "Tab";
132
+ return e.section ? C(e.section.name) : "Tab";
133
133
  }
134
- function Z(e, t) {
134
+ function we(e, t) {
135
135
  if (e.icon) return e.icon;
136
- let n = we(e);
136
+ let n = Ce(e);
137
137
  if (n) {
138
138
  let e = t.entity.children?.find((e) => e.entity === n);
139
139
  if (e?.display?.icon) return e.display.icon;
@@ -144,18 +144,18 @@ function Z(e, t) {
144
144
  //#endregion
145
145
  //#region src/components/detail-layout/LayoutTabs.tsx
146
146
  function Te({ config: e, ctx: n }) {
147
- let { items: r } = e, [a, o] = K(0), s = i(), c = n.detailTabsPresentation ?? (s.isPhone ? "sections" : "scroll");
147
+ let { items: r } = e, [i, a] = q(0), o = c(), s = n.detailTabsPresentation ?? (o.isPhone ? "sections" : "scroll");
148
148
  if (r.length === 0) return null;
149
- if (c === "sections") {
149
+ if (s === "sections") {
150
150
  let e = r.map((e, t) => `detail-tab-section-${t}`);
151
- return /* @__PURE__ */ Y("div", {
151
+ return /* @__PURE__ */ X("div", {
152
152
  style: {
153
153
  display: "flex",
154
154
  flexDirection: "column",
155
155
  gap: 10,
156
156
  minWidth: 0
157
157
  },
158
- children: [r.length > 1 && /* @__PURE__ */ J("nav", {
158
+ children: [r.length > 1 && /* @__PURE__ */ Y("nav", {
159
159
  "aria-label": "Detail sections",
160
160
  style: {
161
161
  display: "flex",
@@ -165,8 +165,8 @@ function Te({ config: e, ctx: n }) {
165
165
  WebkitOverflowScrolling: "touch"
166
166
  },
167
167
  children: r.map((r, i) => {
168
- let a = X(r, n), o = Z(r, n);
169
- return /* @__PURE__ */ Y("button", {
168
+ let a = Z(r, n), o = we(r, n);
169
+ return /* @__PURE__ */ X("button", {
170
170
  type: "button",
171
171
  onClick: () => document.getElementById(e[i])?.scrollIntoView({
172
172
  block: "start",
@@ -188,10 +188,10 @@ function Te({ config: e, ctx: n }) {
188
188
  whiteSpace: "nowrap",
189
189
  cursor: "pointer"
190
190
  },
191
- children: [o && /* @__PURE__ */ J(t, {
191
+ children: [o && /* @__PURE__ */ Y(t, {
192
192
  name: o,
193
193
  size: 13
194
- }), /* @__PURE__ */ J("span", {
194
+ }), /* @__PURE__ */ Y("span", {
195
195
  style: {
196
196
  overflow: "hidden",
197
197
  textOverflow: "ellipsis"
@@ -201,8 +201,8 @@ function Te({ config: e, ctx: n }) {
201
201
  }, i);
202
202
  })
203
203
  }), r.map((r, i) => {
204
- let a = X(r, n), o = Z(r, n);
205
- return /* @__PURE__ */ Y("section", {
204
+ let a = Z(r, n), o = we(r, n);
205
+ return /* @__PURE__ */ X("section", {
206
206
  id: e[i],
207
207
  style: {
208
208
  background: "var(--surface)",
@@ -213,7 +213,7 @@ function Te({ config: e, ctx: n }) {
213
213
  minWidth: 0,
214
214
  scrollMarginTop: 12
215
215
  },
216
- children: [/* @__PURE__ */ Y("div", {
216
+ children: [/* @__PURE__ */ X("div", {
217
217
  style: {
218
218
  display: "flex",
219
219
  alignItems: "center",
@@ -224,19 +224,19 @@ function Te({ config: e, ctx: n }) {
224
224
  fontSize: 13,
225
225
  fontWeight: 700
226
226
  },
227
- children: [o && /* @__PURE__ */ J(t, {
227
+ children: [o && /* @__PURE__ */ Y(t, {
228
228
  name: o,
229
229
  size: 14
230
- }), /* @__PURE__ */ J("span", {
230
+ }), /* @__PURE__ */ Y("span", {
231
231
  style: { overflowWrap: "anywhere" },
232
232
  children: a
233
233
  })]
234
- }), /* @__PURE__ */ J("div", {
234
+ }), /* @__PURE__ */ Y("div", {
235
235
  style: {
236
236
  padding: 14,
237
237
  minWidth: 0
238
238
  },
239
- children: /* @__PURE__ */ J($, {
239
+ children: /* @__PURE__ */ Y($, {
240
240
  node: r,
241
241
  ctx: {
242
242
  ...n,
@@ -248,7 +248,7 @@ function Te({ config: e, ctx: n }) {
248
248
  })]
249
249
  });
250
250
  }
251
- return /* @__PURE__ */ Y("div", {
251
+ return /* @__PURE__ */ X("div", {
252
252
  style: {
253
253
  background: "var(--surface)",
254
254
  border: "1px solid var(--border)",
@@ -257,7 +257,7 @@ function Te({ config: e, ctx: n }) {
257
257
  boxShadow: "var(--shadow-xs)",
258
258
  flexShrink: 0
259
259
  },
260
- children: [/* @__PURE__ */ J("div", {
260
+ children: [/* @__PURE__ */ Y("div", {
261
261
  role: "tablist",
262
262
  style: {
263
263
  display: "flex",
@@ -268,12 +268,12 @@ function Te({ config: e, ctx: n }) {
268
268
  overflowX: "auto"
269
269
  },
270
270
  children: r.map((e, r) => {
271
- let i = X(e, n), s = Z(e, n), c = r === a;
272
- return /* @__PURE__ */ Y("button", {
271
+ let o = Z(e, n), s = we(e, n), c = r === i;
272
+ return /* @__PURE__ */ X("button", {
273
273
  role: "tab",
274
274
  "aria-selected": c,
275
275
  onClick: (e) => {
276
- e.stopPropagation(), o(r);
276
+ e.stopPropagation(), a(r);
277
277
  },
278
278
  style: {
279
279
  position: "relative",
@@ -298,12 +298,12 @@ function Te({ config: e, ctx: n }) {
298
298
  c || (e.currentTarget.style.color = "var(--text-3)");
299
299
  },
300
300
  children: [
301
- s && /* @__PURE__ */ J(t, {
301
+ s && /* @__PURE__ */ Y(t, {
302
302
  name: s,
303
303
  size: 13
304
304
  }),
305
- i,
306
- c && /* @__PURE__ */ J("span", { style: {
305
+ o,
306
+ c && /* @__PURE__ */ Y("span", { style: {
307
307
  position: "absolute",
308
308
  left: 4,
309
309
  right: 4,
@@ -315,16 +315,16 @@ function Te({ config: e, ctx: n }) {
315
315
  ]
316
316
  }, r);
317
317
  })
318
- }), /* @__PURE__ */ J("div", {
318
+ }), /* @__PURE__ */ Y("div", {
319
319
  role: "tabpanel",
320
320
  style: { padding: 14 },
321
- children: /* @__PURE__ */ J($, {
322
- node: r[a],
321
+ children: /* @__PURE__ */ Y($, {
322
+ node: r[i],
323
323
  ctx: {
324
324
  ...n,
325
325
  withinCard: !0
326
326
  }
327
- }, a)
327
+ }, i)
328
328
  })]
329
329
  });
330
330
  }
@@ -335,22 +335,22 @@ function Ee({ config: e, ctx: n }) {
335
335
  ...n,
336
336
  withinCard: !0,
337
337
  ...o ? { columns: o } : null
338
- }, d = s ? /* @__PURE__ */ J(t, {
338
+ }, d = s ? /* @__PURE__ */ Y(t, {
339
339
  name: s,
340
340
  size: 14
341
341
  }) : void 0, f = c ? {
342
- text: w(c.text),
342
+ text: C(c.text),
343
343
  tone: c.tone,
344
344
  dot: c.dot
345
345
  } : void 0;
346
- return /* @__PURE__ */ J(P, {
347
- title: w(r),
346
+ return /* @__PURE__ */ Y(F, {
347
+ title: C(r),
348
348
  defaultOpen: !a,
349
349
  icon: d,
350
350
  badge: f,
351
351
  emphasis: l,
352
352
  headingLevel: n.withinCard ? 3 : 2,
353
- children: /* @__PURE__ */ J(Kt, {
353
+ children: /* @__PURE__ */ Y(Kt, {
354
354
  nodes: i,
355
355
  ctx: u
356
356
  })
@@ -383,7 +383,7 @@ function Q(e, t, n) {
383
383
  return e ?? t ?? n;
384
384
  }
385
385
  function Oe(e) {
386
- return O(e, "update") ? "inline_edit" : "readonly";
386
+ return b(e, "update") ? "inline_edit" : "readonly";
387
387
  }
388
388
  function ke(e) {
389
389
  return e.display.name_plural && Object.keys(e.display.name_plural).length > 0 ? e.display.name_plural : e.display.name;
@@ -459,7 +459,7 @@ function Le(e, ...t) {
459
459
  }
460
460
  }
461
461
  function Re(e) {
462
- let t = d(e);
462
+ let t = m(e);
463
463
  return t.length > 0 ? t[0] : void 0;
464
464
  }
465
465
  function ze(e, t) {
@@ -473,7 +473,7 @@ function Be(e, t, n, r) {
473
473
  ...e
474
474
  };
475
475
  if (Array.isArray(n)) {
476
- let e = Array.isArray(r) ? r.map(String) : f(String(r), n.length);
476
+ let e = Array.isArray(r) ? r.map(String) : h(String(r), n.length);
477
477
  if (!e || e.length !== n.length) throw Error("invalid composite parent id");
478
478
  for (let t = 0; t < n.length; t++) i[n[t]] = e[t];
479
479
  } else i[n] = Array.isArray(r) ? r[0] : r;
@@ -488,18 +488,18 @@ function Ve(e, t) {
488
488
  }
489
489
  //#endregion
490
490
  //#region src/components/detail-layout/useQuickAdd.ts
491
- function He(e, t, n, i) {
492
- let [a, o] = K(() => {
493
- let t = e.quick_add, n = i.entities[e.entity], a = {};
494
- if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (a[e] = r()) : a[e] = t.defaults[e];
491
+ function He(e, t, n, r) {
492
+ let [a, o] = q(() => {
493
+ let t = e.quick_add, n = r.entities[e.entity], a = {};
494
+ if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (a[e] = i()) : a[e] = t.defaults[e];
495
495
  return a;
496
- }), s = _e(), { mutate: c, isPending: l, error: u, reset: d } = ge({
497
- mutationFn: (t) => m(e.entity, t),
496
+ }), s = ge(), { mutate: c, isPending: l, error: u, reset: d } = he({
497
+ mutationFn: (t) => O(e.entity, t),
498
498
  onMutate: async (r) => {
499
499
  let i = [
500
500
  M,
501
501
  t,
502
- Array.isArray(n) ? D(n.map(String)) : n,
502
+ Array.isArray(n) ? k(n.map(String)) : n,
503
503
  e.entity
504
504
  ];
505
505
  await s.cancelQueries({ queryKey: i });
@@ -527,12 +527,12 @@ function He(e, t, n, i) {
527
527
  if (n?.snapshots) for (let [e, t] of n.snapshots) s.setQueryData(e, t);
528
528
  },
529
529
  onSuccess: () => {
530
- let t = e.quick_add, n = i.entities[e.entity], a = {};
531
- if (t?.fields) for (let e of t.fields) t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? a[e] = r() : a[e] = "" : a[e] = t.defaults[e];
530
+ let t = e.quick_add, n = r.entities[e.entity], a = {};
531
+ if (t?.fields) for (let e of t.fields) t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? a[e] = i() : a[e] = "" : a[e] = t.defaults[e];
532
532
  o(a);
533
533
  },
534
534
  onSettled: () => {
535
- let r = Array.isArray(n) ? D(n.map(String)) : n;
535
+ let r = Array.isArray(n) ? k(n.map(String)) : n;
536
536
  s.invalidateQueries({ queryKey: [
537
537
  M,
538
538
  t,
@@ -540,11 +540,11 @@ function He(e, t, n, i) {
540
540
  e.entity
541
541
  ] });
542
542
  }
543
- }), f = e.quick_add, p = i.entities[e.entity], h = Ve(a, f?.fields.filter((e) => p?.fields.get(e)?.required) ?? []);
544
- function g(t) {
543
+ }), f = e.quick_add, p = r.entities[e.entity], m = Ve(a, f?.fields.filter((e) => p?.fields.get(e)?.required) ?? []);
544
+ function h(t) {
545
545
  t.preventDefault(), f && c(Be(a, f.defaults, e.foreign_key, n));
546
546
  }
547
- function _(e, t) {
547
+ function g(e, t) {
548
548
  u && d(), o((n) => ({
549
549
  ...n,
550
550
  [e]: t
@@ -556,16 +556,16 @@ function He(e, t, n, i) {
556
556
  childEntity: p,
557
557
  isPending: l,
558
558
  error: u,
559
- isReady: h,
560
- handleSubmit: g,
561
- handleFieldChange: _
559
+ isReady: m,
560
+ handleSubmit: h,
561
+ handleFieldChange: g
562
562
  };
563
563
  }
564
564
  //#endregion
565
565
  //#region src/components/detail-layout/QuickAddForm.tsx
566
- function Ue({ config: t, parentEntity: n, parentId: r, schema: o }) {
567
- let { values: s, quickAdd: c, childEntity: l, isPending: u, error: d, isReady: f, handleSubmit: p, handleFieldChange: m } = He(t, n, r, o), h = T(), g = i(), _ = pe();
568
- return !c || c.fields.length === 0 || !l ? null : /* @__PURE__ */ Y("form", {
566
+ function Ue({ config: t, parentEntity: n, parentId: r, schema: i }) {
567
+ let { values: o, quickAdd: s, childEntity: l, isPending: u, error: d, isReady: f, handleSubmit: p, handleFieldChange: m } = He(t, n, r, i), h = D(), g = c(), _ = fe();
568
+ return !s || s.fields.length === 0 || !l ? null : /* @__PURE__ */ X("form", {
569
569
  onSubmit: p,
570
570
  style: {
571
571
  display: "flex",
@@ -576,18 +576,18 @@ function Ue({ config: t, parentEntity: n, parentId: r, schema: o }) {
576
576
  borderBottom: "1px solid var(--divider)"
577
577
  },
578
578
  children: [
579
- c.fields.map((e) => {
579
+ s.fields.map((e) => {
580
580
  let n = l.fields.get(e);
581
581
  if (!n) return null;
582
- let r = `${_}-quick-add-${t.entity}-${e}`, i = `${r}-label`;
583
- return /* @__PURE__ */ Y("div", {
582
+ let r = `${_}-quick-add-${t.entity}-${e}`, a = `${r}-label`;
583
+ return /* @__PURE__ */ X("div", {
584
584
  style: {
585
585
  flex: 1,
586
586
  minWidth: 0,
587
587
  width: g.isPhone ? "100%" : void 0
588
588
  },
589
- children: [/* @__PURE__ */ J("label", {
590
- id: i,
589
+ children: [/* @__PURE__ */ Y("label", {
590
+ id: a,
591
591
  htmlFor: r,
592
592
  style: {
593
593
  fontSize: 11,
@@ -596,30 +596,30 @@ function Ue({ config: t, parentEntity: n, parentId: r, schema: o }) {
596
596
  display: "block",
597
597
  fontWeight: 500
598
598
  },
599
- children: E(n, e, o.entities)
600
- }), x({
599
+ children: E(n, e, i.entities)
600
+ }), w({
601
601
  field: n,
602
602
  fieldName: e,
603
- value: s[e] ?? "",
603
+ value: o[e] ?? "",
604
604
  mode: "edit",
605
605
  onChange: (t) => m(e, t),
606
- record: s,
606
+ record: o,
607
607
  fieldId: r,
608
- labelId: i,
608
+ labelId: a,
609
609
  locale: h
610
610
  })]
611
611
  }, e);
612
612
  }),
613
- /* @__PURE__ */ J(a, {
613
+ /* @__PURE__ */ Y(a, {
614
614
  type: "submit",
615
615
  kind: "primary",
616
616
  size: g.isPhone ? "md" : "sm",
617
- icon: /* @__PURE__ */ J(e.plus, { size: 12 }),
617
+ icon: /* @__PURE__ */ Y(e.plus, { size: 12 }),
618
618
  disabled: u || !f,
619
619
  style: g.isPhone ? { alignSelf: "flex-end" } : void 0,
620
620
  children: "Add"
621
621
  }),
622
- d != null && /* @__PURE__ */ J("span", {
622
+ d != null && /* @__PURE__ */ Y("span", {
623
623
  style: {
624
624
  fontSize: 11,
625
625
  color: "var(--danger)",
@@ -633,34 +633,34 @@ function Ue({ config: t, parentEntity: n, parentId: r, schema: o }) {
633
633
  }
634
634
  //#endregion
635
635
  //#region src/components/detail-layout/ChildrenTable.tsx
636
- function We({ config: t, parentEntity: r, parentId: i, schema: a }) {
637
- let o = a.entities[t.entity], s = T(), c = B((e) => e.degradedEntities), { data: u, isLoading: d, isError: f, isFetching: p, refetch: m } = N(r, i, t.entity, t.foreign_key, t.sort, t.limit), h = u?.data ?? [], _ = u?.$refs, x = G(_);
638
- x.current = _;
639
- let S = t.columns, C = t.interaction === "navigate", w = S[0], D = C && o ? g(void 0, o, a.screens) : null, O = o ? Re(o) : void 0, k = W(() => {
636
+ function We({ config: t, parentEntity: n, parentId: r, schema: i }) {
637
+ let a = i.entities[t.entity], o = D(), c = V((e) => e.degradedEntities), { data: u, isLoading: f, isError: p, isFetching: m, refetch: h } = P(n, r, t.entity, t.foreign_key, t.sort, t.limit), g = u?.data ?? [], y = u?.$refs, b = K(y);
638
+ b.current = y;
639
+ let x = t.columns, S = t.interaction === "navigate", C = x[0], w = S && a ? v(void 0, a, i.screens) : null, T = a ? Re(a) : void 0, O = G(() => {
640
640
  let e = /* @__PURE__ */ new Map();
641
- if (!o) return e;
642
- for (let t of S) {
643
- let n = o.fields.get(t);
644
- n && e.set(t, y({
641
+ if (!a) return e;
642
+ for (let t of x) {
643
+ let n = a.fields.get(t);
644
+ n && e.set(t, _({
645
645
  field: n,
646
646
  fieldName: t,
647
647
  surface: "list",
648
- entity: o,
649
- entities: a.entities,
650
- screens: a.screens,
651
- refs: () => x.current,
652
- locale: s
648
+ entity: a,
649
+ entities: i.entities,
650
+ screens: i.screens,
651
+ refs: () => b.current,
652
+ locale: o
653
653
  }));
654
654
  }
655
655
  return e;
656
656
  }, [
657
- o,
658
- S,
659
- a.entities,
660
- a.screens,
661
- s
657
+ a,
658
+ x,
659
+ i.entities,
660
+ i.screens,
661
+ o
662
662
  ]);
663
- if (!o) return /* @__PURE__ */ J("div", {
663
+ if (!a) return /* @__PURE__ */ Y("div", {
664
664
  style: {
665
665
  fontSize: 12.5,
666
666
  color: "var(--text-3)",
@@ -668,12 +668,12 @@ function We({ config: t, parentEntity: r, parentId: i, schema: a }) {
668
668
  },
669
669
  children: "Entity not found."
670
670
  });
671
- let A = /* @__PURE__ */ J(Ue, {
671
+ let k = /* @__PURE__ */ Y(Ue, {
672
672
  config: t,
673
- parentEntity: r,
674
- parentId: i,
675
- schema: a
676
- }), j = /* @__PURE__ */ Y("div", {
673
+ parentEntity: n,
674
+ parentId: r,
675
+ schema: i
676
+ }), j = /* @__PURE__ */ X("div", {
677
677
  style: {
678
678
  display: "flex",
679
679
  alignItems: "center",
@@ -681,33 +681,33 @@ function We({ config: t, parentEntity: r, parentId: i, schema: a }) {
681
681
  padding: "4px 0",
682
682
  justifyContent: "flex-end"
683
683
  },
684
- children: [ee(o.realtime, c, t.entity) && /* @__PURE__ */ J("span", {
684
+ children: [ee(a.realtime, c, t.entity) && /* @__PURE__ */ Y("span", {
685
685
  "data-testid": "children-live-indicator",
686
686
  title: "This table updates automatically in realtime.",
687
- children: /* @__PURE__ */ J(n, {
687
+ children: /* @__PURE__ */ Y(l, {
688
688
  tone: "emerald",
689
689
  size: "xs",
690
690
  dot: !0,
691
691
  children: "Live"
692
692
  })
693
- }), /* @__PURE__ */ J(l, {
694
- icon: p ? /* @__PURE__ */ J("span", {
693
+ }), /* @__PURE__ */ Y(d, {
694
+ icon: m ? /* @__PURE__ */ Y("span", {
695
695
  "data-testid": "children-refresh-spinner",
696
696
  style: { display: "inline-flex" },
697
- children: /* @__PURE__ */ J(b, { size: 13 })
698
- }) : /* @__PURE__ */ J(e.refresh, { size: 13 }),
697
+ children: /* @__PURE__ */ Y(s, { size: 13 })
698
+ }) : /* @__PURE__ */ Y(e.refresh, { size: 13 }),
699
699
  title: "Refresh",
700
700
  size: 24,
701
- disabled: p,
701
+ disabled: m,
702
702
  onClick: () => {
703
- m();
703
+ h();
704
704
  }
705
705
  })]
706
706
  });
707
- return f ? /* @__PURE__ */ Y("div", { children: [
708
- A,
707
+ return p ? /* @__PURE__ */ X("div", { children: [
708
+ k,
709
709
  j,
710
- /* @__PURE__ */ J("div", {
710
+ /* @__PURE__ */ Y("div", {
711
711
  style: {
712
712
  fontSize: 12.5,
713
713
  color: "var(--danger)",
@@ -715,10 +715,10 @@ function We({ config: t, parentEntity: r, parentId: i, schema: a }) {
715
715
  },
716
716
  children: "Failed to load. Try again."
717
717
  })
718
- ] }) : d ? /* @__PURE__ */ Y("div", { children: [
719
- A,
718
+ ] }) : f ? /* @__PURE__ */ X("div", { children: [
719
+ k,
720
720
  j,
721
- /* @__PURE__ */ J("div", {
721
+ /* @__PURE__ */ Y("div", {
722
722
  style: {
723
723
  display: "flex",
724
724
  flexDirection: "column",
@@ -729,16 +729,16 @@ function We({ config: t, parentEntity: r, parentId: i, schema: a }) {
729
729
  0,
730
730
  1,
731
731
  2
732
- ].map((e) => /* @__PURE__ */ J("div", { style: {
732
+ ].map((e) => /* @__PURE__ */ Y("div", { style: {
733
733
  height: 32,
734
734
  background: "var(--surface-3)",
735
735
  borderRadius: 4
736
736
  } }, e))
737
737
  })
738
- ] }) : h.length === 0 ? /* @__PURE__ */ Y("div", { children: [
739
- A,
738
+ ] }) : g.length === 0 ? /* @__PURE__ */ X("div", { children: [
739
+ k,
740
740
  j,
741
- /* @__PURE__ */ J("div", {
741
+ /* @__PURE__ */ Y("div", {
742
742
  style: {
743
743
  fontSize: 12.5,
744
744
  color: "var(--text-3)",
@@ -746,27 +746,27 @@ function We({ config: t, parentEntity: r, parentId: i, schema: a }) {
746
746
  },
747
747
  children: "No records yet."
748
748
  })
749
- ] }) : /* @__PURE__ */ Y("div", { children: [
750
- A,
749
+ ] }) : /* @__PURE__ */ X("div", { children: [
750
+ k,
751
751
  j,
752
- /* @__PURE__ */ J("div", {
752
+ /* @__PURE__ */ Y("div", {
753
753
  style: { overflowX: "auto" },
754
- children: /* @__PURE__ */ Y("table", {
755
- style: ce,
756
- children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ J("tr", { children: S.map((e) => {
757
- let t = o.fields.get(e);
758
- return /* @__PURE__ */ J("th", {
759
- style: se,
760
- children: t ? E(t, e, a.entities) : e
754
+ children: /* @__PURE__ */ X("table", {
755
+ style: se,
756
+ children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ Y("tr", { children: x.map((e) => {
757
+ let t = a.fields.get(e);
758
+ return /* @__PURE__ */ Y("th", {
759
+ style: oe,
760
+ children: t ? E(t, e, i.entities) : e
761
761
  }, e);
762
- }) }) }), /* @__PURE__ */ J("tbody", { children: h.map((e, t) => {
763
- let n = O ? v(e[O]) : "", r = C && D && n ? D.replace(/:\w+/, n) : void 0;
764
- return /* @__PURE__ */ J("tr", { children: S.map((t) => {
765
- let n = t === w, i = k.get(t), a = i ? i(e[t], e) : v(e[t]);
766
- return /* @__PURE__ */ J("td", {
762
+ }) }) }), /* @__PURE__ */ Y("tbody", { children: g.map((e, t) => {
763
+ let n = T ? A(e[T]) : "", r = S && w && n ? w.replace(/:\w+/, n) : void 0;
764
+ return /* @__PURE__ */ Y("tr", { children: x.map((t) => {
765
+ let n = t === C, i = O.get(t), a = i ? i(e[t], e) : A(e[t]);
766
+ return /* @__PURE__ */ Y("td", {
767
767
  title: typeof a == "string" ? a : void 0,
768
- style: le,
769
- children: n && r ? /* @__PURE__ */ J("a", {
768
+ style: ce,
769
+ children: n && r ? /* @__PURE__ */ Y("a", {
770
770
  href: r,
771
771
  style: {
772
772
  color: "var(--accent)",
@@ -778,7 +778,7 @@ function We({ config: t, parentEntity: r, parentId: i, schema: a }) {
778
778
  children: a
779
779
  }) : a
780
780
  }, t);
781
- }) }, v(e.id ?? t));
781
+ }) }, A(e.id ?? t));
782
782
  }) })]
783
783
  })
784
784
  })
@@ -786,9 +786,9 @@ function We({ config: t, parentEntity: r, parentId: i, schema: a }) {
786
786
  }
787
787
  //#endregion
788
788
  //#region src/components/detail-layout/ChildrenList.tsx
789
- function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
790
- let i = r.entities[e.entity], a = T(), { data: o, isLoading: s, isError: c } = N(t, n, e.entity, e.foreign_key, e.sort, e.limit), l = o?.data ?? [], d = o?.$refs, f = e.columns;
791
- if (!i) return /* @__PURE__ */ J("div", {
789
+ function Ge({ config: e, parentEntity: t, parentId: r, schema: i }) {
790
+ let a = i.entities[e.entity], o = D(), { data: s, isLoading: c, isError: l } = P(t, r, e.entity, e.foreign_key, e.sort, e.limit), u = s?.data ?? [], d = s?.$refs, f = e.columns;
791
+ if (!a) return /* @__PURE__ */ Y("div", {
792
792
  style: {
793
793
  fontSize: 12.5,
794
794
  color: "var(--text-3)",
@@ -796,13 +796,13 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
796
796
  },
797
797
  children: "Entity not found."
798
798
  });
799
- let p = /* @__PURE__ */ J(Ue, {
799
+ let p = /* @__PURE__ */ Y(Ue, {
800
800
  config: e,
801
801
  parentEntity: t,
802
- parentId: n,
803
- schema: r
802
+ parentId: r,
803
+ schema: i
804
804
  });
805
- if (c) return /* @__PURE__ */ Y("div", { children: [p, /* @__PURE__ */ J("div", {
805
+ if (l) return /* @__PURE__ */ X("div", { children: [p, /* @__PURE__ */ Y("div", {
806
806
  style: {
807
807
  fontSize: 12.5,
808
808
  color: "var(--danger)",
@@ -810,7 +810,7 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
810
810
  },
811
811
  children: "Failed to load. Try again."
812
812
  })] });
813
- if (s) return /* @__PURE__ */ Y("div", { children: [p, /* @__PURE__ */ Y("div", {
813
+ if (c) return /* @__PURE__ */ X("div", { children: [p, /* @__PURE__ */ X("div", {
814
814
  style: {
815
815
  display: "flex",
816
816
  flexDirection: "column",
@@ -818,17 +818,17 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
818
818
  padding: "8px 0"
819
819
  },
820
820
  children: [
821
- /* @__PURE__ */ J("div", { style: {
821
+ /* @__PURE__ */ Y("div", { style: {
822
822
  height: 22,
823
823
  background: "var(--surface-3)",
824
824
  borderRadius: 4
825
825
  } }),
826
- /* @__PURE__ */ J("div", { style: {
826
+ /* @__PURE__ */ Y("div", { style: {
827
827
  height: 22,
828
828
  background: "var(--surface-3)",
829
829
  borderRadius: 4
830
830
  } }),
831
- /* @__PURE__ */ J("div", { style: {
831
+ /* @__PURE__ */ Y("div", { style: {
832
832
  height: 22,
833
833
  background: "var(--surface-3)",
834
834
  borderRadius: 4,
@@ -836,7 +836,7 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
836
836
  } })
837
837
  ]
838
838
  })] });
839
- if (l.length === 0) return /* @__PURE__ */ Y("div", { children: [p, /* @__PURE__ */ J("div", {
839
+ if (u.length === 0) return /* @__PURE__ */ X("div", { children: [p, /* @__PURE__ */ Y("div", {
840
840
  style: {
841
841
  fontSize: 12.5,
842
842
  color: "var(--text-3)",
@@ -844,13 +844,13 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
844
844
  },
845
845
  children: "No records yet."
846
846
  })] });
847
- let m = f.length > 0 ? i.display.display_field ?? f[0] : i.display.display_field;
848
- return /* @__PURE__ */ Y("div", { children: [p, /* @__PURE__ */ J("div", {
847
+ let m = f.length > 0 ? a.display.display_field ?? f[0] : a.display.display_field;
848
+ return /* @__PURE__ */ X("div", { children: [p, /* @__PURE__ */ Y("div", {
849
849
  style: {
850
850
  display: "flex",
851
851
  flexDirection: "column"
852
852
  },
853
- children: l.map((e, t) => /* @__PURE__ */ J("div", {
853
+ children: u.map((e, t) => /* @__PURE__ */ Y("div", {
854
854
  style: {
855
855
  display: "flex",
856
856
  alignItems: "center",
@@ -858,30 +858,30 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
858
858
  padding: "8px 4px",
859
859
  borderBottom: "1px solid var(--divider)"
860
860
  },
861
- children: /* @__PURE__ */ Y("div", {
861
+ children: /* @__PURE__ */ X("div", {
862
862
  style: {
863
863
  flex: 1,
864
864
  minWidth: 0
865
865
  },
866
- children: [/* @__PURE__ */ J("div", {
866
+ children: [/* @__PURE__ */ Y("div", {
867
867
  style: {
868
868
  fontSize: 12.5,
869
869
  overflow: "hidden",
870
870
  textOverflow: "ellipsis",
871
871
  whiteSpace: "nowrap"
872
872
  },
873
- children: (typeof e.$display == "string" ? e[u] : "") || (m && i.fields.get(m) ? x({
874
- field: i.fields.get(m),
873
+ children: (typeof e.$display == "string" ? e[n] : "") || (m && a.fields.get(m) ? w({
874
+ field: a.fields.get(m),
875
875
  fieldName: m,
876
876
  value: e[m],
877
877
  mode: "display",
878
878
  record: e,
879
879
  refs: d,
880
- locale: a
881
- }) : m && e[m] != null ? v(e[m]) : null)
880
+ locale: o
881
+ }) : m && e[m] != null ? A(e[m]) : null)
882
882
  }), f.length > 1 && (() => {
883
883
  let t = f.slice(1, 3).filter((t) => e[t] != null);
884
- return t.length === 0 ? null : /* @__PURE__ */ J("div", {
884
+ return t.length === 0 ? null : /* @__PURE__ */ Y("div", {
885
885
  style: {
886
886
  fontSize: 11.5,
887
887
  color: "var(--text-3)",
@@ -889,26 +889,26 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
889
889
  textOverflow: "ellipsis",
890
890
  whiteSpace: "nowrap"
891
891
  },
892
- children: t.map((t, n) => /* @__PURE__ */ Y("span", { children: [n > 0 && " · ", i.fields.get(t) ? x({
893
- field: i.fields.get(t),
892
+ children: t.map((t, n) => /* @__PURE__ */ X("span", { children: [n > 0 && " · ", a.fields.get(t) ? w({
893
+ field: a.fields.get(t),
894
894
  fieldName: t,
895
895
  value: e[t],
896
896
  mode: "display",
897
897
  record: e,
898
898
  refs: d,
899
- locale: a
899
+ locale: o
900
900
  }) : String(e[t])] }, t))
901
901
  });
902
902
  })()]
903
903
  })
904
- }, v(e.id ?? t)))
904
+ }, A(e.id ?? t)))
905
905
  })] });
906
906
  }
907
907
  //#endregion
908
908
  //#region src/components/detail-layout/ChildrenCards.tsx
909
- function Ke({ config: e, parentEntity: t, parentId: r, schema: i }) {
910
- let a = i.entities[e.entity], o = T(), { data: s, isLoading: c, isError: l } = N(t, r, e.entity, e.foreign_key, e.sort, e.limit), u = s?.data ?? [], d = s?.$refs, f = e.columns, p = e.cards, m = p?.header_field ?? f[0], h = p?.badge_field, g = p?.columns_count ?? 3;
911
- if (!a) return /* @__PURE__ */ J("div", {
909
+ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
910
+ let i = r.entities[e.entity], a = D(), { data: o, isLoading: s, isError: c } = P(t, n, e.entity, e.foreign_key, e.sort, e.limit), u = o?.data ?? [], d = o?.$refs, f = e.columns, p = e.cards, m = p?.header_field ?? f[0], h = p?.badge_field, g = p?.columns_count ?? 3;
911
+ if (!i) return /* @__PURE__ */ Y("div", {
912
912
  style: {
913
913
  fontSize: 12.5,
914
914
  color: "var(--text-3)",
@@ -920,13 +920,13 @@ function Ke({ config: e, parentEntity: t, parentId: r, schema: i }) {
920
920
  display: "grid",
921
921
  gridTemplateColumns: `repeat(auto-fill, minmax(${g >= 4 ? 180 : 240}px, 1fr))`,
922
922
  gap: 12
923
- }, y = /* @__PURE__ */ J(Ue, {
923
+ }, v = /* @__PURE__ */ Y(Ue, {
924
924
  config: e,
925
925
  parentEntity: t,
926
- parentId: r,
927
- schema: i
926
+ parentId: n,
927
+ schema: r
928
928
  });
929
- if (l) return /* @__PURE__ */ Y("div", { children: [y, /* @__PURE__ */ J("div", {
929
+ if (c) return /* @__PURE__ */ X("div", { children: [v, /* @__PURE__ */ Y("div", {
930
930
  style: {
931
931
  fontSize: 12.5,
932
932
  color: "var(--danger)",
@@ -934,19 +934,19 @@ function Ke({ config: e, parentEntity: t, parentId: r, schema: i }) {
934
934
  },
935
935
  children: "Failed to load. Try again."
936
936
  })] });
937
- if (c) return /* @__PURE__ */ Y("div", { children: [y, /* @__PURE__ */ J("div", {
937
+ if (s) return /* @__PURE__ */ X("div", { children: [v, /* @__PURE__ */ Y("div", {
938
938
  style: _,
939
939
  children: [
940
940
  0,
941
941
  1,
942
942
  2
943
- ].map((e) => /* @__PURE__ */ J("div", { style: {
943
+ ].map((e) => /* @__PURE__ */ Y("div", { style: {
944
944
  height: 96,
945
945
  background: "var(--surface-3)",
946
946
  borderRadius: 10
947
947
  } }, e))
948
948
  })] });
949
- if (u.length === 0) return /* @__PURE__ */ Y("div", { children: [y, /* @__PURE__ */ J("div", {
949
+ if (u.length === 0) return /* @__PURE__ */ X("div", { children: [v, /* @__PURE__ */ Y("div", {
950
950
  style: {
951
951
  fontSize: 12.5,
952
952
  color: "var(--text-3)",
@@ -954,26 +954,26 @@ function Ke({ config: e, parentEntity: t, parentId: r, schema: i }) {
954
954
  },
955
955
  children: "No records yet."
956
956
  })] });
957
- let b = f.filter((e) => e !== m && e !== h);
958
- return /* @__PURE__ */ Y("div", { children: [y, /* @__PURE__ */ J("div", {
957
+ let y = f.filter((e) => e !== m && e !== h);
958
+ return /* @__PURE__ */ X("div", { children: [v, /* @__PURE__ */ Y("div", {
959
959
  style: _,
960
- children: u.map((t, r) => /* @__PURE__ */ Y("div", {
960
+ children: u.map((t, n) => /* @__PURE__ */ X("div", {
961
961
  style: {
962
962
  background: "var(--surface)",
963
963
  border: "1px solid var(--border)",
964
964
  borderRadius: 10,
965
965
  overflow: "hidden"
966
966
  },
967
- children: [/* @__PURE__ */ Y("div", {
967
+ children: [/* @__PURE__ */ X("div", {
968
968
  style: {
969
969
  padding: "10px 14px",
970
970
  display: "flex",
971
971
  alignItems: "center",
972
972
  justifyContent: "space-between",
973
973
  gap: 8,
974
- borderBottom: b.length > 0 ? "1px solid var(--divider)" : "none"
974
+ borderBottom: y.length > 0 ? "1px solid var(--divider)" : "none"
975
975
  },
976
- children: [/* @__PURE__ */ J("div", {
976
+ children: [/* @__PURE__ */ Y("div", {
977
977
  style: {
978
978
  fontSize: 12.5,
979
979
  fontWeight: 600,
@@ -981,77 +981,77 @@ function Ke({ config: e, parentEntity: t, parentId: r, schema: i }) {
981
981
  textOverflow: "ellipsis",
982
982
  whiteSpace: "nowrap"
983
983
  },
984
- children: m && a.fields.get(m) ? x({
985
- field: a.fields.get(m),
984
+ children: m && i.fields.get(m) ? w({
985
+ field: i.fields.get(m),
986
986
  fieldName: m,
987
987
  value: t[m],
988
988
  mode: "display",
989
989
  record: t,
990
990
  refs: d,
991
- locale: o
992
- }) : `Record ${r + 1}`
993
- }), h && t[h] != null && /* @__PURE__ */ J(n, {
991
+ locale: a
992
+ }) : `Record ${n + 1}`
993
+ }), h && t[h] != null && /* @__PURE__ */ Y(l, {
994
994
  tone: "slate",
995
995
  size: "xs",
996
- children: a.fields.get(h) ? x({
997
- field: a.fields.get(h),
996
+ children: i.fields.get(h) ? w({
997
+ field: i.fields.get(h),
998
998
  fieldName: h,
999
999
  value: t[h],
1000
1000
  mode: "display",
1001
1001
  record: t,
1002
1002
  refs: d,
1003
- locale: o
1004
- }) : v(t[h])
1003
+ locale: a
1004
+ }) : A(t[h])
1005
1005
  })]
1006
- }), b.length > 0 && /* @__PURE__ */ J("div", {
1006
+ }), y.length > 0 && /* @__PURE__ */ Y("div", {
1007
1007
  style: {
1008
1008
  padding: "10px 14px",
1009
1009
  display: "flex",
1010
1010
  flexDirection: "column",
1011
1011
  gap: 4
1012
1012
  },
1013
- children: b.slice(0, 4).map((n) => {
1014
- let r = a.fields.get(n);
1015
- return r ? /* @__PURE__ */ Y("div", {
1013
+ children: y.slice(0, 4).map((n) => {
1014
+ let o = i.fields.get(n);
1015
+ return o ? /* @__PURE__ */ X("div", {
1016
1016
  style: {
1017
1017
  display: "flex",
1018
1018
  alignItems: "baseline",
1019
1019
  gap: 8,
1020
1020
  fontSize: 11.5
1021
1021
  },
1022
- children: [/* @__PURE__ */ Y("span", {
1022
+ children: [/* @__PURE__ */ X("span", {
1023
1023
  style: {
1024
1024
  color: "var(--text-3)",
1025
1025
  flexShrink: 0
1026
1026
  },
1027
- children: [i.entities[e.entity]?.fields.get(n)?.display?.name ? Object.values(i.entities[e.entity].fields.get(n).display.name)[0] : n, ":"]
1028
- }), /* @__PURE__ */ J("span", {
1027
+ children: [r.entities[e.entity]?.fields.get(n)?.display?.name ? Object.values(r.entities[e.entity].fields.get(n).display.name)[0] : n, ":"]
1028
+ }), /* @__PURE__ */ Y("span", {
1029
1029
  style: {
1030
1030
  overflow: "hidden",
1031
1031
  textOverflow: "ellipsis",
1032
1032
  whiteSpace: "nowrap"
1033
1033
  },
1034
- children: x({
1035
- field: r,
1034
+ children: w({
1035
+ field: o,
1036
1036
  fieldName: n,
1037
1037
  value: t[n],
1038
1038
  mode: "display",
1039
1039
  record: t,
1040
1040
  refs: d,
1041
- locale: o
1041
+ locale: a
1042
1042
  })
1043
1043
  })]
1044
1044
  }, n) : null;
1045
1045
  })
1046
1046
  })]
1047
- }, v(t.id ?? r)))
1047
+ }, A(t.id ?? n)))
1048
1048
  })] });
1049
1049
  }
1050
1050
  //#endregion
1051
1051
  //#region src/hooks/useTimelineData.ts
1052
1052
  var qe = 50;
1053
1053
  function Je(e, t, n, r, i, a) {
1054
- let o = Array.isArray(r) ? r : [r], c = Array.isArray(r) ? f(t, o.length) : [t], l = a ?? qe, u = he({
1054
+ let o = Array.isArray(r) ? r : [r], s = Array.isArray(r) ? h(t, o.length) : [t], c = a ?? qe, l = me({
1055
1055
  queryKey: [
1056
1056
  M,
1057
1057
  e,
@@ -1059,69 +1059,69 @@ function Je(e, t, n, r, i, a) {
1059
1059
  n,
1060
1060
  "timeline",
1061
1061
  i,
1062
- l
1062
+ c
1063
1063
  ],
1064
1064
  queryFn: ({ pageParam: e }) => {
1065
1065
  let t = new URLSearchParams();
1066
- if (!c) throw Error("invalid composite parent id");
1066
+ if (!s) throw Error("invalid composite parent id");
1067
1067
  let r = o.map((e, t) => ({
1068
1068
  field: e,
1069
1069
  op: "eq",
1070
- value: c[t]
1070
+ value: s[t]
1071
1071
  }));
1072
- return t.set("filters", JSON.stringify(r)), t.set("preview", "true"), i ? t.set("sort", `${i}:desc`) : typeof console < "u" && console.warn(`[useTimelineData] no time_field for ${n}; fetch order falls back to API default`), t.set("limit", String(l)), e && t.set("after", e), s(`/api/data/${n}?${t.toString()}`);
1072
+ return t.set("filters", JSON.stringify(r)), t.set("preview", "true"), i ? t.set("sort", `${i}:desc`) : typeof console < "u" && console.warn(`[useTimelineData] no time_field for ${n}; fetch order falls back to API default`), t.set("limit", String(c)), e && t.set("after", e), S(`/api/data/${n}?${t.toString()}`);
1073
1073
  },
1074
1074
  getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
1075
1075
  initialPageParam: void 0,
1076
- enabled: !!e && !!t && !!n && !!r && c !== null
1076
+ enabled: !!e && !!t && !!n && !!r && s !== null
1077
1077
  });
1078
1078
  return {
1079
- rows: W(() => u.data?.pages.flatMap((e) => e.data) ?? [], [u.data?.pages]),
1080
- refs: u.data?.pages[0]?.$refs,
1081
- fetchNextPage: u.fetchNextPage,
1082
- hasOlder: !!u.hasNextPage,
1083
- isFetchingOlder: u.isFetchingNextPage,
1084
- isLoading: u.isLoading,
1085
- isError: u.isError
1079
+ rows: G(() => l.data?.pages.flatMap((e) => e.data) ?? [], [l.data?.pages]),
1080
+ refs: l.data?.pages[0]?.$refs,
1081
+ fetchNextPage: l.fetchNextPage,
1082
+ hasOlder: !!l.hasNextPage,
1083
+ isFetchingOlder: l.isFetchingNextPage,
1084
+ isLoading: l.isLoading,
1085
+ isError: l.isError
1086
1086
  };
1087
1087
  }
1088
1088
  //#endregion
1089
1089
  //#region src/components/detail-layout/TimelineComposer.tsx
1090
1090
  var Ye = "quick_entry", Xe = 100, Ze = 240, Qe = 800, $e = 80;
1091
1091
  function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
1092
- let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = He(t, n, r, i), m = T(), [g, _] = K(Ze), v = G(null), y = G(null), [b, S] = K(Qe);
1093
- U(() => {
1092
+ let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = He(t, n, r, i), m = D(), [h, _] = q(Ze), v = K(null), y = K(null), [b, x] = q(Qe);
1093
+ W(() => {
1094
1094
  let e = y.current?.parentElement;
1095
1095
  if (!e) return;
1096
1096
  let t = () => {
1097
1097
  let t = Math.max(Xe, e.clientHeight - $e);
1098
- S(Math.min(Qe, t));
1098
+ x(Math.min(Qe, t));
1099
1099
  };
1100
1100
  t();
1101
1101
  let n = new ResizeObserver(t);
1102
1102
  return n.observe(e), () => n.disconnect();
1103
- }, []), U(() => {
1103
+ }, []), W(() => {
1104
1104
  _((e) => Math.min(e, b));
1105
1105
  }, [b]);
1106
- let C = G(o);
1107
- C.current = o;
1108
- let w = G(p);
1109
- w.current = p;
1110
- let E = G({}), D = W(() => ({
1111
- getField: (e) => C.current[e],
1106
+ let S = K(o);
1107
+ S.current = o;
1108
+ let C = K(p);
1109
+ C.current = p;
1110
+ let T = K({}), E = G(() => ({
1111
+ getField: (e) => S.current[e],
1112
1112
  setField: (e, t) => {
1113
- w.current(e, t);
1113
+ C.current(e, t);
1114
1114
  },
1115
1115
  focusField: (e) => {
1116
- let t = E.current[e];
1116
+ let t = T.current[e];
1117
1117
  t && (t.querySelector("textarea, input, select, [contenteditable]") ?? t).focus();
1118
1118
  }
1119
1119
  }), []);
1120
- U(() => h(Ye, D), [D]);
1121
- let O = H((e) => {
1120
+ W(() => g(Ye, E), [E]);
1121
+ let O = U((e) => {
1122
1122
  e.preventDefault(), v.current = {
1123
1123
  startY: e.clientY,
1124
- startHeight: g
1124
+ startHeight: h
1125
1125
  };
1126
1126
  let t = (e) => {
1127
1127
  if (!v.current) return;
@@ -1131,7 +1131,7 @@ function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
1131
1131
  v.current = null, document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
1132
1132
  };
1133
1133
  document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
1134
- }, [g, b]);
1134
+ }, [h, b]);
1135
1135
  if (!s || s.fields.length === 0 || !c) return null;
1136
1136
  let k = s.fields.find((e) => {
1137
1137
  let t = c.fields.get(e);
@@ -1144,11 +1144,11 @@ function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
1144
1144
  }
1145
1145
  let M = (e) => {
1146
1146
  let t = c.fields.get(e);
1147
- return t ? /* @__PURE__ */ J("div", {
1147
+ return t ? /* @__PURE__ */ Y("div", {
1148
1148
  ref: (t) => {
1149
- E.current[e] = t;
1149
+ T.current[e] = t;
1150
1150
  },
1151
- children: x({
1151
+ children: w({
1152
1152
  field: t,
1153
1153
  fieldName: e,
1154
1154
  value: o[e] ?? "",
@@ -1159,7 +1159,7 @@ function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
1159
1159
  })
1160
1160
  }, e) : null;
1161
1161
  };
1162
- return /* @__PURE__ */ Y("div", {
1162
+ return /* @__PURE__ */ X("div", {
1163
1163
  ref: y,
1164
1164
  style: {
1165
1165
  flexShrink: 0,
@@ -1167,9 +1167,9 @@ function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
1167
1167
  background: "var(--surface)",
1168
1168
  display: "flex",
1169
1169
  flexDirection: "column",
1170
- height: `${g}px`
1170
+ height: `${h}px`
1171
1171
  },
1172
- children: [/* @__PURE__ */ J("div", {
1172
+ children: [/* @__PURE__ */ Y("div", {
1173
1173
  onMouseDown: O,
1174
1174
  title: "Drag to resize",
1175
1175
  style: {
@@ -1180,13 +1180,13 @@ function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
1180
1180
  justifyContent: "center",
1181
1181
  flexShrink: 0
1182
1182
  },
1183
- children: /* @__PURE__ */ J("div", { style: {
1183
+ children: /* @__PURE__ */ Y("div", { style: {
1184
1184
  width: 56,
1185
1185
  height: 3,
1186
1186
  borderRadius: 999,
1187
1187
  background: "var(--border)"
1188
1188
  } })
1189
- }), /* @__PURE__ */ Y("form", {
1189
+ }), /* @__PURE__ */ X("form", {
1190
1190
  onSubmit: f,
1191
1191
  onKeyDown: (e) => {
1192
1192
  (e.metaKey || e.ctrlKey) && e.key === "Enter" && (e.preventDefault(), e.currentTarget.requestSubmit());
@@ -1200,7 +1200,7 @@ function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
1200
1200
  padding: "0 12px 8px"
1201
1201
  },
1202
1202
  children: [
1203
- A.length > 0 && /* @__PURE__ */ J("div", {
1203
+ A.length > 0 && /* @__PURE__ */ Y("div", {
1204
1204
  style: {
1205
1205
  display: "flex",
1206
1206
  flexWrap: "wrap",
@@ -1210,16 +1210,16 @@ function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
1210
1210
  },
1211
1211
  children: A.map(M)
1212
1212
  }),
1213
- k && c.fields.get(k) && /* @__PURE__ */ J("div", {
1213
+ k && c.fields.get(k) && /* @__PURE__ */ Y("div", {
1214
1214
  style: {
1215
1215
  flex: 1,
1216
1216
  minHeight: 0,
1217
1217
  display: "flex"
1218
1218
  },
1219
1219
  ref: (e) => {
1220
- E.current[k] = e;
1220
+ T.current[k] = e;
1221
1221
  },
1222
- children: x({
1222
+ children: w({
1223
1223
  field: c.fields.get(k),
1224
1224
  fieldName: k,
1225
1225
  value: o[k] ?? "",
@@ -1230,7 +1230,7 @@ function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
1230
1230
  locale: m
1231
1231
  })
1232
1232
  }),
1233
- /* @__PURE__ */ Y("div", {
1233
+ /* @__PURE__ */ X("div", {
1234
1234
  style: {
1235
1235
  display: "flex",
1236
1236
  flexWrap: "wrap",
@@ -1238,39 +1238,39 @@ function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
1238
1238
  gap: 6,
1239
1239
  flexShrink: 0
1240
1240
  },
1241
- children: [j.map(M), /* @__PURE__ */ Y("div", {
1241
+ children: [j.map(M), /* @__PURE__ */ X("div", {
1242
1242
  style: {
1243
1243
  marginLeft: "auto",
1244
1244
  display: "flex",
1245
1245
  alignItems: "center",
1246
1246
  gap: 8
1247
1247
  },
1248
- children: [/* @__PURE__ */ Y("span", {
1248
+ children: [/* @__PURE__ */ X("span", {
1249
1249
  style: {
1250
1250
  fontSize: 10.5,
1251
1251
  color: "var(--text-4)"
1252
1252
  },
1253
1253
  children: [
1254
- /* @__PURE__ */ J("span", {
1254
+ /* @__PURE__ */ Y("span", {
1255
1255
  className: "mono",
1256
1256
  children: "⌘"
1257
1257
  }),
1258
- /* @__PURE__ */ J("span", {
1258
+ /* @__PURE__ */ Y("span", {
1259
1259
  className: "mono",
1260
1260
  children: "↵"
1261
1261
  }),
1262
1262
  " to add"
1263
1263
  ]
1264
- }), /* @__PURE__ */ J(a, {
1264
+ }), /* @__PURE__ */ Y(a, {
1265
1265
  type: "submit",
1266
1266
  kind: "primary",
1267
- icon: /* @__PURE__ */ J(e.plus, { size: 13 }),
1267
+ icon: /* @__PURE__ */ Y(e.plus, { size: 13 }),
1268
1268
  disabled: l || !d,
1269
1269
  children: "Add"
1270
1270
  })]
1271
1271
  })]
1272
1272
  }),
1273
- u != null && /* @__PURE__ */ J("p", {
1273
+ u != null && /* @__PURE__ */ Y("p", {
1274
1274
  style: {
1275
1275
  fontSize: 11,
1276
1276
  color: "var(--danger)",
@@ -1289,63 +1289,63 @@ var tt = 80, nt = 200;
1289
1289
  function rt(e, t) {
1290
1290
  if (it(t)) {
1291
1291
  let e = t.id;
1292
- return e == null ? "" : v(e);
1292
+ return e == null ? "" : A(e);
1293
1293
  }
1294
- return C(S(e, t));
1294
+ return p(f(e, t));
1295
1295
  }
1296
1296
  function it(e) {
1297
1297
  return e.__optimistic === !0;
1298
1298
  }
1299
1299
  function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
1300
- let i = r.entities[e.entity], { rows: o, refs: s, fetchNextPage: c, hasOlder: l, isFetchingOlder: u, isLoading: d, isError: f } = Je(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), p = e.timeline, m = p?.scroll ?? !1, h = (e.sort ?? "").endsWith(":asc"), g = W(() => h ? [...o].reverse() : o, [o, h]), _ = p?.auto_scroll ?? "none", v = G(null), y = G(null), x = G(!1), S = G(0), C = G(null), T = G(null), E = G(!0), D = G(null);
1301
- U(() => {
1302
- x.current = !1, S.current = 0, C.current = null, T.current = null, E.current = !0, D.current = null;
1303
- }, [n]), me(() => {
1304
- !u || !v.current || (D.current = {
1305
- scrollHeight: v.current.scrollHeight,
1306
- scrollTop: v.current.scrollTop
1300
+ let i = r.entities[e.entity], { rows: o, refs: c, fetchNextPage: l, hasOlder: u, isFetchingOlder: d, isLoading: f, isError: p } = Je(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), m = e.timeline, h = m?.scroll ?? !1, g = (e.sort ?? "").endsWith(":asc"), _ = G(() => g ? [...o].reverse() : o, [o, g]), v = m?.auto_scroll ?? "none", y = K(null), b = K(null), x = K(!1), S = K(0), w = K(null), T = K(null), E = K(!0), D = K(null);
1301
+ W(() => {
1302
+ x.current = !1, S.current = 0, w.current = null, T.current = null, E.current = !0, D.current = null;
1303
+ }, [n]), pe(() => {
1304
+ !d || !y.current || (D.current = {
1305
+ scrollHeight: y.current.scrollHeight,
1306
+ scrollTop: y.current.scrollTop
1307
1307
  });
1308
- }, [u]), me(() => {
1309
- let e = v.current;
1310
- if (!e || g.length === 0 || !i) {
1311
- S.current = g.length;
1308
+ }, [d]), pe(() => {
1309
+ let e = y.current;
1310
+ if (!e || _.length === 0 || !i) {
1311
+ S.current = _.length;
1312
1312
  return;
1313
1313
  }
1314
- let t = rt(i, g[0]), n = rt(i, g[g.length - 1]), r = !x.current, a = g.length > S.current && S.current > 0, o = a && (h && t !== C.current && n === T.current || !h && n !== T.current && t === C.current), s = a && !o;
1315
- if (r) h && _ === "bottom" && (e.scrollTop = e.scrollHeight), x.current = !0;
1314
+ let t = rt(i, _[0]), n = rt(i, _[_.length - 1]), r = !x.current, a = _.length > S.current && S.current > 0, o = a && (g && t !== w.current && n === T.current || !g && n !== T.current && t === w.current), s = a && !o;
1315
+ if (r) g && v === "bottom" && (e.scrollTop = e.scrollHeight), x.current = !0;
1316
1316
  else if (o && D.current) {
1317
1317
  let t = D.current;
1318
- h && (e.scrollTop = t.scrollTop + (e.scrollHeight - t.scrollHeight)), D.current = null;
1319
- } else s && h && E.current && (e.scrollTop = e.scrollHeight);
1320
- S.current = g.length, C.current = t, T.current = n;
1318
+ g && (e.scrollTop = t.scrollTop + (e.scrollHeight - t.scrollHeight)), D.current = null;
1319
+ } else s && g && E.current && (e.scrollTop = e.scrollHeight);
1320
+ S.current = _.length, w.current = t, T.current = n;
1321
1321
  }, [
1322
- g,
1323
1322
  _,
1324
- h,
1323
+ v,
1324
+ g,
1325
1325
  i
1326
1326
  ]);
1327
- let O = H(() => {
1328
- let e = v.current;
1327
+ let O = U(() => {
1328
+ let e = y.current;
1329
1329
  e && (E.current = e.scrollHeight - e.scrollTop - e.clientHeight < tt);
1330
1330
  }, []);
1331
- U(() => {
1332
- let e = y.current;
1331
+ W(() => {
1332
+ let e = b.current;
1333
1333
  if (!e || typeof IntersectionObserver > "u") return;
1334
1334
  let t = new IntersectionObserver((e) => {
1335
- for (let t of e) t.isIntersecting && l && !u && c();
1335
+ for (let t of e) t.isIntersecting && u && !d && l();
1336
1336
  }, {
1337
- root: v.current ?? null,
1337
+ root: y.current ?? null,
1338
1338
  rootMargin: `${nt}px 0px 0px 0px`,
1339
1339
  threshold: 0
1340
1340
  });
1341
1341
  return t.observe(e), () => t.disconnect();
1342
1342
  }, [
1343
- l,
1344
1343
  u,
1345
- c
1344
+ d,
1345
+ l
1346
1346
  ]);
1347
- let [k, A] = K(null);
1348
- if (!i) return /* @__PURE__ */ J("div", {
1347
+ let [k, A] = q(null);
1348
+ if (!i) return /* @__PURE__ */ Y("div", {
1349
1349
  style: {
1350
1350
  fontSize: 12.5,
1351
1351
  color: "var(--text-3)",
@@ -1353,25 +1353,25 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
1353
1353
  },
1354
1354
  children: "Entity not found."
1355
1355
  });
1356
- let j = e.quick_add?.fields ?? [p?.content_field].filter(Boolean), M = w(i.display?.name_plural) || w(i.display?.name) || e.entity, ee = l ? /* @__PURE__ */ J("div", {
1356
+ let j = e.quick_add?.fields ?? [m?.content_field].filter(Boolean), M = C(i.display?.name_plural) || C(i.display?.name) || e.entity, ee = u ? /* @__PURE__ */ Y("div", {
1357
1357
  style: {
1358
1358
  display: "flex",
1359
1359
  justifyContent: "center",
1360
1360
  padding: "6px 0"
1361
1361
  },
1362
- children: /* @__PURE__ */ J(a, {
1362
+ children: /* @__PURE__ */ Y(a, {
1363
1363
  size: "xs",
1364
- onClick: () => c(),
1365
- disabled: u,
1366
- icon: u ? /* @__PURE__ */ J(b, { size: 11 }) : void 0,
1367
- children: u ? "Loading…" : "Load older"
1364
+ onClick: () => l(),
1365
+ disabled: d,
1366
+ icon: d ? /* @__PURE__ */ Y(s, { size: 11 }) : void 0,
1367
+ children: d ? "Loading…" : "Load older"
1368
1368
  })
1369
- }) : null, te = /* @__PURE__ */ J("div", {
1370
- ref: y,
1369
+ }) : null, N = /* @__PURE__ */ Y("div", {
1370
+ ref: b,
1371
1371
  "aria-hidden": "true",
1372
1372
  style: { height: 1 }
1373
- }), N;
1374
- if (f) N = /* @__PURE__ */ J("div", {
1373
+ }), P;
1374
+ if (p) P = /* @__PURE__ */ Y("div", {
1375
1375
  style: {
1376
1376
  fontSize: 12.5,
1377
1377
  color: "var(--danger)",
@@ -1379,24 +1379,24 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
1379
1379
  },
1380
1380
  children: "Failed to load."
1381
1381
  });
1382
- else if (d) N = /* @__PURE__ */ Y("div", {
1382
+ else if (f) P = /* @__PURE__ */ X("div", {
1383
1383
  style: {
1384
1384
  display: "flex",
1385
1385
  flexDirection: "column",
1386
1386
  gap: 8,
1387
1387
  padding: 12
1388
1388
  },
1389
- children: [/* @__PURE__ */ J("div", { style: {
1389
+ children: [/* @__PURE__ */ Y("div", { style: {
1390
1390
  height: 64,
1391
1391
  background: "var(--surface-3)",
1392
1392
  borderRadius: 8
1393
- } }), /* @__PURE__ */ J("div", { style: {
1393
+ } }), /* @__PURE__ */ Y("div", { style: {
1394
1394
  height: 64,
1395
1395
  background: "var(--surface-3)",
1396
1396
  borderRadius: 8
1397
1397
  } })]
1398
1398
  });
1399
- else if (g.length === 0) N = /* @__PURE__ */ Y(q, { children: [te, /* @__PURE__ */ J("div", {
1399
+ else if (_.length === 0) P = /* @__PURE__ */ X(J, { children: [N, /* @__PURE__ */ Y("div", {
1400
1400
  style: {
1401
1401
  fontSize: 12.5,
1402
1402
  color: "var(--text-3)",
@@ -1406,28 +1406,28 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
1406
1406
  })] });
1407
1407
  else {
1408
1408
  let a = (a, o) => {
1409
- let c = rt(i, a) || String(o);
1410
- return /* @__PURE__ */ J(ot, {
1409
+ let s = rt(i, a) || String(o);
1410
+ return /* @__PURE__ */ Y(ot, {
1411
1411
  row: a,
1412
- rowId: c,
1412
+ rowId: s,
1413
1413
  childEntity: i,
1414
1414
  entityCode: e.entity,
1415
1415
  parentEntity: t,
1416
1416
  parentId: n,
1417
- timeline: p,
1417
+ timeline: m,
1418
1418
  editableFields: j,
1419
- refs: s,
1420
- isEditing: k === c,
1421
- onStartEdit: () => A(c),
1419
+ refs: c,
1420
+ isEditing: k === s,
1421
+ onStartEdit: () => A(s),
1422
1422
  onCancelEdit: () => A(null),
1423
1423
  onSaved: () => A(null),
1424
1424
  schema: r,
1425
1425
  optimistic: it(a)
1426
- }, c);
1427
- }, o = p?.time_field, c;
1426
+ }, s);
1427
+ }, o = m?.time_field, s;
1428
1428
  if (o) {
1429
1429
  let e = [];
1430
- g.forEach((t, n) => {
1430
+ _.forEach((t, n) => {
1431
1431
  let r = t[o], i = st(r), a = e[e.length - 1];
1432
1432
  !a || a.key !== i ? e.push({
1433
1433
  key: i,
@@ -1440,25 +1440,25 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
1440
1440
  row: t,
1441
1441
  idx: n
1442
1442
  });
1443
- }), c = e.map((e) => /* @__PURE__ */ Y("div", {
1443
+ }), s = e.map((e) => /* @__PURE__ */ X("div", {
1444
1444
  style: {
1445
1445
  display: "flex",
1446
1446
  flexDirection: "column",
1447
1447
  gap: 8
1448
1448
  },
1449
- children: [/* @__PURE__ */ J(lt, {
1449
+ children: [/* @__PURE__ */ Y(lt, {
1450
1450
  label: e.label,
1451
1451
  count: e.rows.length
1452
1452
  }), e.rows.map(({ row: e, idx: t }) => a(e, t))]
1453
1453
  }, `day-${e.key}`));
1454
- } else c = g.map((e, t) => a(e, t));
1455
- N = /* @__PURE__ */ Y(q, { children: [
1456
- te,
1454
+ } else s = _.map((e, t) => a(e, t));
1455
+ P = /* @__PURE__ */ X(J, { children: [
1456
+ N,
1457
1457
  ee,
1458
- c
1458
+ s
1459
1459
  ] });
1460
1460
  }
1461
- return m ? /* @__PURE__ */ Y("div", {
1461
+ return h ? /* @__PURE__ */ X("div", {
1462
1462
  style: {
1463
1463
  display: "flex",
1464
1464
  flexDirection: "column",
@@ -1468,13 +1468,13 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
1468
1468
  color: "var(--text)"
1469
1469
  },
1470
1470
  children: [
1471
- /* @__PURE__ */ J("div", {
1471
+ /* @__PURE__ */ Y("div", {
1472
1472
  style: {
1473
1473
  padding: "10px 16px",
1474
1474
  borderBottom: "1px solid var(--divider)",
1475
1475
  background: "var(--surface)"
1476
1476
  },
1477
- children: /* @__PURE__ */ J("h3", {
1477
+ children: /* @__PURE__ */ Y("h3", {
1478
1478
  style: {
1479
1479
  margin: 0,
1480
1480
  fontSize: 12.5,
@@ -1483,8 +1483,8 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
1483
1483
  children: M
1484
1484
  })
1485
1485
  }),
1486
- /* @__PURE__ */ J("div", {
1487
- ref: v,
1486
+ /* @__PURE__ */ Y("div", {
1487
+ ref: y,
1488
1488
  onScroll: O,
1489
1489
  style: {
1490
1490
  flex: 1,
@@ -1494,75 +1494,75 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
1494
1494
  flexDirection: "column",
1495
1495
  gap: 8
1496
1496
  },
1497
- children: N
1497
+ children: P
1498
1498
  }),
1499
- /* @__PURE__ */ J(et, {
1499
+ /* @__PURE__ */ Y(et, {
1500
1500
  config: e,
1501
1501
  parentEntity: t,
1502
1502
  parentId: n,
1503
1503
  schema: r
1504
1504
  })
1505
1505
  ]
1506
- }) : /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
1506
+ }) : /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("div", {
1507
1507
  style: {
1508
1508
  display: "flex",
1509
1509
  flexDirection: "column",
1510
1510
  gap: 8
1511
1511
  },
1512
- children: N
1513
- }), /* @__PURE__ */ J(et, {
1512
+ children: P
1513
+ }), /* @__PURE__ */ Y(et, {
1514
1514
  config: e,
1515
1515
  parentEntity: t,
1516
1516
  parentId: n,
1517
1517
  schema: r
1518
1518
  })] });
1519
1519
  }
1520
- function ot({ row: t, rowId: r, childEntity: i, entityCode: o, parentEntity: s, parentId: u, timeline: d, editableFields: f, refs: p, isEditing: m, onStartEdit: h, onCancelEdit: g, onSaved: v, schema: y, optimistic: S = !1 }) {
1521
- let C = _e(), w = T(), [D, O] = K({}), A = H(() => {
1520
+ function ot({ row: t, rowId: n, childEntity: r, entityCode: i, parentEntity: o, parentId: c, timeline: f, editableFields: p, refs: m, isEditing: h, onStartEdit: g, onCancelEdit: _, onSaved: v, schema: b, optimistic: S = !1 }) {
1521
+ let C = ge(), T = D(), [O, k] = q({}), A = U(() => {
1522
1522
  C.invalidateQueries({ queryKey: [
1523
1523
  M,
1524
- s,
1525
- u,
1526
- o
1524
+ o,
1525
+ c,
1526
+ i
1527
1527
  ] });
1528
1528
  }, [
1529
1529
  C,
1530
- s,
1531
- u,
1532
- o
1533
- ]), j = ge({
1530
+ o,
1531
+ c,
1532
+ i
1533
+ ]), j = he({
1534
1534
  mutationFn: (e) => {
1535
- let n = t.$row_version;
1536
- return _(o, r, typeof n == "string" && n !== "" ? {
1535
+ let r = t.$row_version;
1536
+ return y(i, n, typeof r == "string" && r !== "" ? {
1537
1537
  ...e,
1538
- $row_version: n
1538
+ $row_version: r
1539
1539
  } : e);
1540
1540
  },
1541
1541
  onSuccess: () => {
1542
- A(), c.success("Updated"), v();
1542
+ A(), u.success("Updated"), v();
1543
1543
  },
1544
- onError: (e) => c.error(e.message)
1545
- }), ee = ge({
1546
- mutationFn: () => k(o, r),
1544
+ onError: (e) => u.error(e.message)
1545
+ }), ee = he({
1546
+ mutationFn: () => x(i, n),
1547
1547
  onSuccess: () => {
1548
- A(), c.success("Deleted");
1548
+ A(), u.success("Deleted");
1549
1549
  },
1550
- onError: (e) => c.error(e.message)
1551
- }), te = H(() => {
1550
+ onError: (e) => u.error(e.message)
1551
+ }), N = U(() => {
1552
1552
  let e = {};
1553
- for (let n of f) e[n] = t[n] ?? "";
1554
- O(e), h();
1553
+ for (let n of p) e[n] = t[n] ?? "";
1554
+ k(e), g();
1555
1555
  }, [
1556
1556
  t,
1557
- f,
1558
- h
1559
- ]), N = H((e, t) => {
1560
- O((n) => ({
1557
+ p,
1558
+ g
1559
+ ]), P = U((e, t) => {
1560
+ k((n) => ({
1561
1561
  ...n,
1562
1562
  [e]: t
1563
1563
  }));
1564
- }, []), P = d?.time_field, F = d?.type_field, I = d?.summary_field, L = d?.content_field, R = d?.author_field, z = d?.direction_field, B = d?.intent_field;
1565
- return m ? /* @__PURE__ */ Y("div", {
1564
+ }, []), F = f?.time_field, I = f?.type_field, L = f?.summary_field, R = f?.content_field, z = f?.author_field, B = f?.direction_field, V = f?.intent_field;
1565
+ return h ? /* @__PURE__ */ X("div", {
1566
1566
  style: {
1567
1567
  borderRadius: 10,
1568
1568
  border: "1px solid var(--accent)",
@@ -1572,50 +1572,50 @@ function ot({ row: t, rowId: r, childEntity: i, entityCode: o, parentEntity: s,
1572
1572
  flexDirection: "column",
1573
1573
  gap: 8
1574
1574
  },
1575
- children: [f.map((e) => {
1576
- let t = i.fields.get(e);
1577
- return t ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("label", {
1575
+ children: [p.map((e) => {
1576
+ let t = r.fields.get(e);
1577
+ return t ? /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("label", {
1578
1578
  style: {
1579
1579
  fontSize: 11,
1580
1580
  color: "var(--text-3)",
1581
1581
  marginBottom: 4,
1582
1582
  display: "block"
1583
1583
  },
1584
- children: E(t, e, y.entities)
1585
- }), x({
1584
+ children: E(t, e, b.entities)
1585
+ }), w({
1586
1586
  field: t,
1587
1587
  fieldName: e,
1588
- value: D[e] ?? "",
1588
+ value: O[e] ?? "",
1589
1589
  mode: "edit",
1590
- onChange: (t) => N(e, t),
1591
- record: D,
1592
- locale: w
1590
+ onChange: (t) => P(e, t),
1591
+ record: O,
1592
+ locale: T
1593
1593
  })] }, e) : null;
1594
- }), /* @__PURE__ */ Y("div", {
1594
+ }), /* @__PURE__ */ X("div", {
1595
1595
  style: {
1596
1596
  display: "flex",
1597
1597
  alignItems: "center",
1598
1598
  gap: 6,
1599
1599
  paddingTop: 4
1600
1600
  },
1601
- children: [/* @__PURE__ */ J(a, {
1601
+ children: [/* @__PURE__ */ Y(a, {
1602
1602
  kind: "primary",
1603
1603
  size: "xs",
1604
- icon: j.isPending ? /* @__PURE__ */ J(b, { size: 12 }) : /* @__PURE__ */ J(e.check, { size: 12 }),
1605
- onClick: () => j.mutate(D),
1604
+ icon: j.isPending ? /* @__PURE__ */ Y(s, { size: 12 }) : /* @__PURE__ */ Y(e.check, { size: 12 }),
1605
+ onClick: () => j.mutate(O),
1606
1606
  disabled: j.isPending,
1607
1607
  children: j.isPending ? "Saving…" : "Save"
1608
- }), /* @__PURE__ */ J(a, {
1608
+ }), /* @__PURE__ */ Y(a, {
1609
1609
  size: "xs",
1610
- icon: /* @__PURE__ */ J(e.x, { size: 12 }),
1610
+ icon: /* @__PURE__ */ Y(e.x, { size: 12 }),
1611
1611
  onClick: () => {
1612
- O({}), g();
1612
+ k({}), _();
1613
1613
  },
1614
1614
  disabled: j.isPending,
1615
1615
  children: "Cancel"
1616
1616
  })]
1617
1617
  })]
1618
- }) : /* @__PURE__ */ Y("div", {
1618
+ }) : /* @__PURE__ */ X("div", {
1619
1619
  className: "group",
1620
1620
  "data-optimistic": S || void 0,
1621
1621
  style: {
@@ -1629,7 +1629,7 @@ function ot({ row: t, rowId: r, childEntity: i, entityCode: o, parentEntity: s,
1629
1629
  onMouseEnter: (e) => e.currentTarget.style.borderColor = "var(--border-strong)",
1630
1630
  onMouseLeave: (e) => e.currentTarget.style.borderColor = "var(--border)",
1631
1631
  children: [
1632
- /* @__PURE__ */ Y("div", {
1632
+ /* @__PURE__ */ X("div", {
1633
1633
  style: {
1634
1634
  display: "flex",
1635
1635
  alignItems: "center",
@@ -1639,112 +1639,112 @@ function ot({ row: t, rowId: r, childEntity: i, entityCode: o, parentEntity: s,
1639
1639
  color: "var(--text-3)"
1640
1640
  },
1641
1641
  children: [
1642
- P && t[P] != null && i.fields.get(P) && /* @__PURE__ */ J("span", {
1642
+ F && t[F] != null && r.fields.get(F) && /* @__PURE__ */ Y("span", {
1643
1643
  style: { fontWeight: 500 },
1644
- children: x({
1645
- field: i.fields.get(P),
1646
- fieldName: P,
1647
- value: t[P],
1644
+ children: w({
1645
+ field: r.fields.get(F),
1646
+ fieldName: F,
1647
+ value: t[F],
1648
1648
  mode: "display",
1649
1649
  record: t,
1650
- refs: p,
1651
- locale: w
1650
+ refs: m,
1651
+ locale: T
1652
1652
  })
1653
1653
  }),
1654
- F && t[F] != null && i.fields.get(F) && /* @__PURE__ */ J(n, {
1654
+ I && t[I] != null && r.fields.get(I) && /* @__PURE__ */ Y(l, {
1655
1655
  tone: "slate",
1656
1656
  size: "xs",
1657
- children: x({
1658
- field: i.fields.get(F),
1659
- fieldName: F,
1660
- value: t[F],
1657
+ children: w({
1658
+ field: r.fields.get(I),
1659
+ fieldName: I,
1660
+ value: t[I],
1661
1661
  mode: "display",
1662
1662
  record: t,
1663
- refs: p,
1664
- locale: w
1663
+ refs: m,
1664
+ locale: T
1665
1665
  })
1666
1666
  }),
1667
- z && t[z] != null && i.fields.get(z) && /* @__PURE__ */ J(ut, {
1668
- value: t[z],
1669
- field: i.fields.get(z)
1667
+ B && t[B] != null && r.fields.get(B) && /* @__PURE__ */ Y(ut, {
1668
+ value: t[B],
1669
+ field: r.fields.get(B)
1670
1670
  }),
1671
- B && t[B] != null && i.fields.get(B) && /* @__PURE__ */ J(n, {
1671
+ V && t[V] != null && r.fields.get(V) && /* @__PURE__ */ Y(l, {
1672
1672
  tone: "slate",
1673
1673
  size: "xs",
1674
- children: x({
1675
- field: i.fields.get(B),
1676
- fieldName: B,
1677
- value: t[B],
1674
+ children: w({
1675
+ field: r.fields.get(V),
1676
+ fieldName: V,
1677
+ value: t[V],
1678
1678
  mode: "display",
1679
1679
  record: t,
1680
- refs: p,
1681
- locale: w
1680
+ refs: m,
1681
+ locale: T
1682
1682
  })
1683
1683
  }),
1684
- R && t[R] != null && i.fields.get(R) && /* @__PURE__ */ Y("span", { children: [
1684
+ z && t[z] != null && r.fields.get(z) && /* @__PURE__ */ X("span", { children: [
1685
1685
  "by",
1686
1686
  " ",
1687
- x({
1688
- field: i.fields.get(R),
1689
- fieldName: R,
1690
- value: t[R],
1687
+ w({
1688
+ field: r.fields.get(z),
1689
+ fieldName: z,
1690
+ value: t[z],
1691
1691
  mode: "display",
1692
1692
  record: t,
1693
- refs: p,
1694
- locale: w
1693
+ refs: m,
1694
+ locale: T
1695
1695
  })
1696
1696
  ] }),
1697
- !S && /* @__PURE__ */ Y("div", {
1697
+ !S && /* @__PURE__ */ X("div", {
1698
1698
  style: {
1699
1699
  marginLeft: "auto",
1700
1700
  display: "flex",
1701
1701
  alignItems: "center",
1702
1702
  gap: 2
1703
1703
  },
1704
- children: [/* @__PURE__ */ J(l, {
1704
+ children: [/* @__PURE__ */ Y(d, {
1705
1705
  size: 22,
1706
- icon: /* @__PURE__ */ J(e.edit, { size: 11 }),
1707
- onClick: te,
1706
+ icon: /* @__PURE__ */ Y(e.edit, { size: 11 }),
1707
+ onClick: N,
1708
1708
  title: "Edit"
1709
- }), /* @__PURE__ */ J(l, {
1709
+ }), /* @__PURE__ */ Y(d, {
1710
1710
  size: 22,
1711
- icon: /* @__PURE__ */ J(e.trash, { size: 11 }),
1711
+ icon: /* @__PURE__ */ Y(e.trash, { size: 11 }),
1712
1712
  onClick: () => ee.mutate(),
1713
1713
  title: "Delete"
1714
1714
  })]
1715
1715
  })
1716
1716
  ]
1717
1717
  }),
1718
- I && t[I] != null && i.fields.get(I) && /* @__PURE__ */ J("div", {
1718
+ L && t[L] != null && r.fields.get(L) && /* @__PURE__ */ Y("div", {
1719
1719
  style: {
1720
1720
  fontSize: 12.5,
1721
1721
  fontWeight: 500,
1722
1722
  marginTop: 6
1723
1723
  },
1724
- children: x({
1725
- field: i.fields.get(I),
1726
- fieldName: I,
1727
- value: t[I],
1724
+ children: w({
1725
+ field: r.fields.get(L),
1726
+ fieldName: L,
1727
+ value: t[L],
1728
1728
  mode: "display",
1729
1729
  record: t,
1730
- refs: p,
1731
- locale: w
1730
+ refs: m,
1731
+ locale: T
1732
1732
  })
1733
1733
  }),
1734
- L && t[L] != null && L !== I && i.fields.get(L) && /* @__PURE__ */ J("div", {
1734
+ R && t[R] != null && R !== L && r.fields.get(R) && /* @__PURE__ */ Y("div", {
1735
1735
  style: {
1736
1736
  fontSize: 12.5,
1737
1737
  fontWeight: 400,
1738
1738
  marginTop: 6
1739
1739
  },
1740
- children: x({
1741
- field: i.fields.get(L),
1742
- fieldName: L,
1743
- value: t[L],
1740
+ children: w({
1741
+ field: r.fields.get(R),
1742
+ fieldName: R,
1743
+ value: t[R],
1744
1744
  mode: "display",
1745
1745
  record: t,
1746
- refs: p,
1747
- locale: w
1746
+ refs: m,
1747
+ locale: T
1748
1748
  })
1749
1749
  })
1750
1750
  ]
@@ -1752,12 +1752,12 @@ function ot({ row: t, rowId: r, childEntity: i, entityCode: o, parentEntity: s,
1752
1752
  }
1753
1753
  function st(e) {
1754
1754
  if (e == null) return "";
1755
- let t = new Date(v(e));
1755
+ let t = new Date(A(e));
1756
1756
  return Number.isNaN(t.getTime()) ? "" : `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`;
1757
1757
  }
1758
1758
  function ct(e) {
1759
1759
  if (e == null) return "—";
1760
- let t = new Date(v(e));
1760
+ let t = new Date(A(e));
1761
1761
  if (Number.isNaN(t.getTime())) return "—";
1762
1762
  let n = /* @__PURE__ */ new Date(), r = /* @__PURE__ */ new Date();
1763
1763
  r.setDate(n.getDate() - 1);
@@ -1769,7 +1769,7 @@ function ct(e) {
1769
1769
  });
1770
1770
  }
1771
1771
  function lt({ label: e, count: t }) {
1772
- return /* @__PURE__ */ Y("div", {
1772
+ return /* @__PURE__ */ X("div", {
1773
1773
  style: {
1774
1774
  position: "sticky",
1775
1775
  top: -4,
@@ -1781,7 +1781,7 @@ function lt({ label: e, count: t }) {
1781
1781
  background: "linear-gradient(180deg, var(--surface-2) 0%, var(--surface-2) 65%, transparent 100%)"
1782
1782
  },
1783
1783
  children: [
1784
- /* @__PURE__ */ J("span", {
1784
+ /* @__PURE__ */ Y("span", {
1785
1785
  style: {
1786
1786
  fontSize: 11,
1787
1787
  fontWeight: 600,
@@ -1789,12 +1789,12 @@ function lt({ label: e, count: t }) {
1789
1789
  },
1790
1790
  children: e
1791
1791
  }),
1792
- /* @__PURE__ */ J("span", { style: {
1792
+ /* @__PURE__ */ Y("span", { style: {
1793
1793
  flex: 1,
1794
1794
  height: 1,
1795
1795
  background: "var(--divider)"
1796
1796
  } }),
1797
- /* @__PURE__ */ J("span", {
1797
+ /* @__PURE__ */ Y("span", {
1798
1798
  className: "num",
1799
1799
  style: {
1800
1800
  fontSize: 10.5,
@@ -1807,7 +1807,7 @@ function lt({ label: e, count: t }) {
1807
1807
  }
1808
1808
  function ut({ value: t, field: n }) {
1809
1809
  let r = dt(t, n);
1810
- return r === null ? null : /* @__PURE__ */ Y("span", {
1810
+ return r === null ? null : /* @__PURE__ */ X("span", {
1811
1811
  style: {
1812
1812
  display: "inline-flex",
1813
1813
  alignItems: "center",
@@ -1819,7 +1819,7 @@ function ut({ value: t, field: n }) {
1819
1819
  background: r ? "var(--accent-soft)" : "var(--info-soft)",
1820
1820
  color: r ? "var(--accent)" : "var(--info)"
1821
1821
  },
1822
- children: [J(r ? e.arrowUp : e.arrowDown, { size: 10 }), r ? "Out" : "In"]
1822
+ children: [Y(r ? e.arrowUp : e.arrowDown, { size: 10 }), r ? "Out" : "In"]
1823
1823
  });
1824
1824
  }
1825
1825
  function dt(e, t) {
@@ -1833,68 +1833,68 @@ function dt(e, t) {
1833
1833
  }
1834
1834
  //#endregion
1835
1835
  //#region src/components/detail-layout/EditableChildrenTable.tsx
1836
- function ft({ config: t, childEntity: n, schema: r, rows: o, onChange: s, validationErrors: c, refs: u, forceTablePresentation: d = !1 }) {
1837
- let f = T(), p = i(), m = G(null), h = t.columns, g = t.position_field, _ = new Set(Array.isArray(t.foreign_key) ? t.foreign_key : [t.foreign_key]), y = h.filter((e) => {
1836
+ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: o, validationErrors: s, refs: l, forceTablePresentation: u = !1 }) {
1837
+ let f = D(), p = c(), m = K(null), h = t.columns, g = t.position_field, _ = new Set(Array.isArray(t.foreign_key) ? t.foreign_key : [t.foreign_key]), v = h.filter((e) => {
1838
1838
  if (_.has(e) || t.position_field && e === t.position_field) return !1;
1839
1839
  let r = n.fields.get(e);
1840
1840
  return !(!r || r.auto || r.primary || r.source);
1841
- }), b = new Set(h.filter((e) => {
1841
+ }), y = new Set(h.filter((e) => {
1842
1842
  if (t.position_field && e === t.position_field) return !0;
1843
1843
  let r = n.fields.get(e);
1844
1844
  return r && (r.auto || r.primary || r.source);
1845
- })), S = H((e, t, n) => {
1846
- s(o.map((r) => r._key === e ? {
1845
+ })), b = U((e, t, n) => {
1846
+ o(i.map((r) => r._key === e ? {
1847
1847
  ...r,
1848
1848
  [t]: n,
1849
1849
  _dirty: !0
1850
1850
  } : r));
1851
- }, [o, s]), C = H(() => {
1851
+ }, [i, o]), x = U(() => {
1852
1852
  let e = {
1853
1853
  _key: crypto.randomUUID(),
1854
1854
  _dirty: !0
1855
1855
  };
1856
- g && (e[g] = o.filter((e) => !e._deleted).reduce((e, t) => {
1856
+ g && (e[g] = i.filter((e) => !e._deleted).reduce((e, t) => {
1857
1857
  let n = typeof t[g] == "number" ? t[g] : -1;
1858
1858
  return Math.max(e, n);
1859
1859
  }, -1) + 1);
1860
1860
  let r = t.quick_add?.defaults ?? {};
1861
- for (let t of y) {
1861
+ for (let t of v) {
1862
1862
  let i = n.fields.get(t);
1863
1863
  i && (r[t] === void 0 ? i.default === void 0 ? i.type === "bool" && (e[t] = !1) : e[t] = i.default : e[t] = r[t]);
1864
1864
  }
1865
- s([...o, e]);
1865
+ o([...i, e]);
1866
1866
  }, [
1867
+ i,
1867
1868
  o,
1868
- s,
1869
- y,
1869
+ v,
1870
1870
  n,
1871
1871
  t.quick_add?.defaults,
1872
1872
  g
1873
- ]), w = H((e) => {
1874
- s(o.map((t) => t._key === e ? {
1873
+ ]), S = U((e) => {
1874
+ o(i.map((t) => t._key === e ? {
1875
1875
  ...t,
1876
1876
  _deleted: !0
1877
1877
  } : t));
1878
- }, [o, s]), D = H((e) => {
1879
- s(o.map((t) => t._key === e ? {
1878
+ }, [i, o]), C = U((e) => {
1879
+ o(i.map((t) => t._key === e ? {
1880
1880
  ...t,
1881
1881
  _deleted: !1
1882
1882
  } : t));
1883
- }, [o, s]), O = H((e, t) => {
1883
+ }, [i, o]), T = U((e, t) => {
1884
1884
  if (!g) return;
1885
- let n = o.filter((e) => !e._deleted), r = o.filter((e) => e._deleted), i = n.findIndex((t) => t._key === e), a = i + t;
1886
- if (i < 0 || a < 0 || a >= n.length) return;
1887
- let c = [...n], [l] = c.splice(i, 1);
1888
- c.splice(a, 0, l), s([...c.map((e, t) => ({
1885
+ let n = i.filter((e) => !e._deleted), r = i.filter((e) => e._deleted), a = n.findIndex((t) => t._key === e), s = a + t;
1886
+ if (a < 0 || s < 0 || s >= n.length) return;
1887
+ let c = [...n], [l] = c.splice(a, 1);
1888
+ c.splice(s, 0, l), o([...c.map((e, t) => ({
1889
1889
  ...e,
1890
1890
  [g]: t,
1891
1891
  _dirty: e[g] === t ? e._dirty : !0
1892
1892
  })), ...r]);
1893
1893
  }, [
1894
+ i,
1894
1895
  o,
1895
- s,
1896
1896
  g
1897
- ]), k = H((e) => {
1897
+ ]), O = U((e) => {
1898
1898
  let t = e.target, n = t.closest("td");
1899
1899
  if (!n) return;
1900
1900
  let r = n.closest("tr");
@@ -1918,7 +1918,7 @@ function ft({ config: t, childEntity: n, schema: r, rows: o, onChange: s, valida
1918
1918
  if (o < t.length - 1) {
1919
1919
  let e = t[o + 1].cells[a]?.querySelector("input, select, textarea, [tabindex]");
1920
1920
  e && e.focus();
1921
- } else C(), requestAnimationFrame(() => {
1921
+ } else x(), requestAnimationFrame(() => {
1922
1922
  let e = i.querySelectorAll("tr"), t = e[e.length - 1];
1923
1923
  if (t) {
1924
1924
  let e = t.querySelector("input, select, textarea, [tabindex]");
@@ -1926,24 +1926,24 @@ function ft({ config: t, childEntity: n, schema: r, rows: o, onChange: s, valida
1926
1926
  }
1927
1927
  });
1928
1928
  } else e.key === "Escape" && t.blur?.();
1929
- }, [C]), A = se;
1930
- return p.isPhone && !d ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
1929
+ }, [x]), k = oe;
1930
+ return p.isPhone && !u ? /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("div", {
1931
1931
  style: {
1932
1932
  display: "flex",
1933
1933
  flexDirection: "column",
1934
1934
  gap: 10
1935
1935
  },
1936
- children: o.map((t, i) => {
1937
- let a = !!t._deleted, s = c?.[t._key], d = g ? o.filter((e) => !e._deleted) : [], p = g ? d.findIndex((e) => e._key === t._key) : -1;
1938
- return /* @__PURE__ */ Y("div", {
1936
+ children: i.map((t, a) => {
1937
+ let o = !!t._deleted, c = s?.[t._key], u = g ? i.filter((e) => !e._deleted) : [], p = g ? u.findIndex((e) => e._key === t._key) : -1;
1938
+ return /* @__PURE__ */ X("div", {
1939
1939
  style: {
1940
1940
  border: "1px solid var(--border)",
1941
1941
  borderRadius: 8,
1942
1942
  background: "var(--surface)",
1943
- opacity: a ? .58 : 1,
1943
+ opacity: o ? .58 : 1,
1944
1944
  overflow: "hidden"
1945
1945
  },
1946
- children: [/* @__PURE__ */ Y("div", {
1946
+ children: [/* @__PURE__ */ X("div", {
1947
1947
  style: {
1948
1948
  minHeight: 38,
1949
1949
  padding: "8px 10px",
@@ -1953,44 +1953,44 @@ function ft({ config: t, childEntity: n, schema: r, rows: o, onChange: s, valida
1953
1953
  justifyContent: "space-between",
1954
1954
  gap: 8
1955
1955
  },
1956
- children: [/* @__PURE__ */ Y("div", {
1956
+ children: [/* @__PURE__ */ X("div", {
1957
1957
  style: {
1958
1958
  fontSize: 12,
1959
1959
  fontWeight: 600,
1960
1960
  color: "var(--text-2)"
1961
1961
  },
1962
- children: ["Row ", i + 1]
1963
- }), /* @__PURE__ */ Y("div", {
1962
+ children: ["Row ", a + 1]
1963
+ }), /* @__PURE__ */ X("div", {
1964
1964
  style: {
1965
1965
  display: "flex",
1966
1966
  alignItems: "center",
1967
1967
  gap: 4
1968
1968
  },
1969
- children: [g && !a && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(l, {
1969
+ children: [g && !o && /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(d, {
1970
1970
  size: 32,
1971
- icon: /* @__PURE__ */ J(e.up, { size: 14 }),
1972
- onClick: () => O(t._key, -1),
1971
+ icon: /* @__PURE__ */ Y(e.up, { size: 14 }),
1972
+ onClick: () => T(t._key, -1),
1973
1973
  disabled: p <= 0,
1974
1974
  title: "Move row up"
1975
- }), /* @__PURE__ */ J(l, {
1975
+ }), /* @__PURE__ */ Y(d, {
1976
1976
  size: 32,
1977
- icon: /* @__PURE__ */ J(e.down, { size: 14 }),
1978
- onClick: () => O(t._key, 1),
1979
- disabled: p === -1 || p >= d.length - 1,
1977
+ icon: /* @__PURE__ */ Y(e.down, { size: 14 }),
1978
+ onClick: () => T(t._key, 1),
1979
+ disabled: p === -1 || p >= u.length - 1,
1980
1980
  title: "Move row down"
1981
- })] }), a ? /* @__PURE__ */ J(l, {
1981
+ })] }), o ? /* @__PURE__ */ Y(d, {
1982
1982
  size: 32,
1983
- icon: /* @__PURE__ */ J(e.refresh, { size: 14 }),
1984
- onClick: () => D(t._key),
1983
+ icon: /* @__PURE__ */ Y(e.refresh, { size: 14 }),
1984
+ onClick: () => C(t._key),
1985
1985
  title: "Undo delete"
1986
- }) : /* @__PURE__ */ J(l, {
1986
+ }) : /* @__PURE__ */ Y(d, {
1987
1987
  size: 32,
1988
- icon: /* @__PURE__ */ J(e.trash, { size: 14 }),
1989
- onClick: () => w(t._key),
1988
+ icon: /* @__PURE__ */ Y(e.trash, { size: 14 }),
1989
+ onClick: () => S(t._key),
1990
1990
  title: "Delete row"
1991
1991
  })]
1992
1992
  })]
1993
- }), /* @__PURE__ */ J("div", {
1993
+ }), /* @__PURE__ */ Y("div", {
1994
1994
  style: {
1995
1995
  padding: 10,
1996
1996
  display: "flex",
@@ -1998,95 +1998,95 @@ function ft({ config: t, childEntity: n, schema: r, rows: o, onChange: s, valida
1998
1998
  gap: 12
1999
1999
  },
2000
2000
  children: h.map((e) => {
2001
- let i = n.fields.get(e), o = s?.includes(e), c = b.has(e), l = i ? E(i, e, r.entities) : e, d = `child-${t._key}-${e}`, p = `${d}-label`, m = {
2002
- outline: o ? "1px solid var(--danger)" : "none",
2001
+ let i = n.fields.get(e), a = c?.includes(e), s = y.has(e), u = i ? E(i, e, r.entities) : e, d = `child-${t._key}-${e}`, p = `${d}-label`, m = {
2002
+ outline: a ? "1px solid var(--danger)" : "none",
2003
2003
  outlineOffset: 3,
2004
- borderRadius: o ? 5 : 0
2004
+ borderRadius: a ? 5 : 0
2005
2005
  }, h = {
2006
2006
  fontSize: 11.5,
2007
2007
  fontWeight: 600,
2008
2008
  color: "var(--text-3)"
2009
- }, g = !a && !c && !!i;
2010
- return /* @__PURE__ */ Y("div", {
2009
+ }, g = !o && !s && !!i;
2010
+ return /* @__PURE__ */ X("div", {
2011
2011
  style: {
2012
2012
  display: "flex",
2013
2013
  flexDirection: "column",
2014
2014
  gap: 5,
2015
2015
  minWidth: 0,
2016
- textDecoration: a ? "line-through" : "none"
2016
+ textDecoration: o ? "line-through" : "none"
2017
2017
  },
2018
- title: o ? `${e} is required` : void 0,
2019
- children: [g ? /* @__PURE__ */ J("label", {
2018
+ title: a ? `${e} is required` : void 0,
2019
+ children: [g ? /* @__PURE__ */ Y("label", {
2020
2020
  id: p,
2021
2021
  htmlFor: d,
2022
2022
  style: h,
2023
- children: l
2024
- }) : /* @__PURE__ */ J("div", {
2023
+ children: u
2024
+ }) : /* @__PURE__ */ Y("div", {
2025
2025
  id: p,
2026
2026
  style: h,
2027
- children: l
2028
- }), /* @__PURE__ */ J("div", {
2027
+ children: u
2028
+ }), /* @__PURE__ */ Y("div", {
2029
2029
  style: m,
2030
- children: a || c ? i ? x({
2030
+ children: o || s ? i ? w({
2031
2031
  field: i,
2032
2032
  fieldName: e,
2033
2033
  value: t[e],
2034
2034
  mode: "display",
2035
2035
  record: t,
2036
- refs: u,
2036
+ refs: l,
2037
2037
  fieldId: d,
2038
2038
  labelId: p,
2039
2039
  locale: f
2040
- }) : v(t[e]) : i ? x({
2040
+ }) : A(t[e]) : i ? w({
2041
2041
  field: i,
2042
2042
  fieldName: e,
2043
2043
  value: t[e],
2044
2044
  mode: "edit",
2045
- onChange: (n) => S(t._key, e, n),
2045
+ onChange: (n) => b(t._key, e, n),
2046
2046
  record: t,
2047
- refs: u,
2047
+ refs: l,
2048
2048
  compact: !0,
2049
2049
  fieldId: d,
2050
2050
  labelId: p,
2051
2051
  locale: f
2052
- }) : v(t[e])
2052
+ }) : A(t[e])
2053
2053
  })]
2054
2054
  }, e);
2055
2055
  })
2056
2056
  })]
2057
2057
  }, t._key);
2058
2058
  })
2059
- }), /* @__PURE__ */ J("div", {
2059
+ }), /* @__PURE__ */ Y("div", {
2060
2060
  style: { marginTop: 10 },
2061
- children: /* @__PURE__ */ J(a, {
2061
+ children: /* @__PURE__ */ Y(a, {
2062
2062
  kind: "ghost",
2063
2063
  size: "sm",
2064
- icon: /* @__PURE__ */ J(e.plus, { size: 14 }),
2065
- onClick: C,
2064
+ icon: /* @__PURE__ */ Y(e.plus, { size: 14 }),
2065
+ onClick: x,
2066
2066
  children: "Add row"
2067
2067
  })
2068
- })] }) : /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
2068
+ })] }) : /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("div", {
2069
2069
  style: { overflowX: "auto" },
2070
- children: /* @__PURE__ */ Y("table", {
2070
+ children: /* @__PURE__ */ X("table", {
2071
2071
  ref: m,
2072
- style: ce,
2073
- onKeyDown: k,
2074
- children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ Y("tr", { children: [h.map((e) => {
2072
+ style: se,
2073
+ onKeyDown: O,
2074
+ children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ X("tr", { children: [h.map((e) => {
2075
2075
  let t = n.fields.get(e);
2076
- return /* @__PURE__ */ J("th", {
2077
- style: A,
2076
+ return /* @__PURE__ */ Y("th", {
2077
+ style: k,
2078
2078
  children: t ? E(t, e, r.entities) : e
2079
2079
  }, e);
2080
- }), /* @__PURE__ */ J("th", { style: {
2081
- ...A,
2080
+ }), /* @__PURE__ */ Y("th", { style: {
2081
+ ...k,
2082
2082
  width: 40
2083
- } })] }) }), /* @__PURE__ */ J("tbody", { children: o.map((t) => {
2084
- let r = !!t._deleted, i = c?.[t._key];
2085
- return /* @__PURE__ */ Y("tr", {
2083
+ } })] }) }), /* @__PURE__ */ Y("tbody", { children: i.map((t) => {
2084
+ let r = !!t._deleted, i = s?.[t._key];
2085
+ return /* @__PURE__ */ X("tr", {
2086
2086
  style: { opacity: r ? .5 : 1 },
2087
2087
  children: [h.map((e) => {
2088
- let a = n.fields.get(e), o = i?.includes(e), s = b.has(e);
2089
- return r || s ? /* @__PURE__ */ J("td", {
2088
+ let a = n.fields.get(e), o = i?.includes(e), s = y.has(e);
2089
+ return r || s ? /* @__PURE__ */ Y("td", {
2090
2090
  style: {
2091
2091
  padding: "6px 12px",
2092
2092
  borderBottom: "1px solid var(--divider)",
@@ -2094,16 +2094,16 @@ function ft({ config: t, childEntity: n, schema: r, rows: o, onChange: s, valida
2094
2094
  textDecoration: r ? "line-through" : "none",
2095
2095
  color: "var(--text-2)"
2096
2096
  },
2097
- children: a ? x({
2097
+ children: a ? w({
2098
2098
  field: a,
2099
2099
  fieldName: e,
2100
2100
  value: t[e],
2101
2101
  mode: "display",
2102
2102
  record: t,
2103
- refs: u,
2103
+ refs: l,
2104
2104
  locale: f
2105
- }) : v(t[e])
2106
- }, e) : /* @__PURE__ */ J("td", {
2105
+ }) : A(t[e])
2106
+ }, e) : /* @__PURE__ */ Y("td", {
2107
2107
  style: {
2108
2108
  padding: "4px 4px",
2109
2109
  borderBottom: "1px solid var(--divider)",
@@ -2113,89 +2113,89 @@ function ft({ config: t, childEntity: n, schema: r, rows: o, onChange: s, valida
2113
2113
  borderRadius: o ? 4 : 0
2114
2114
  },
2115
2115
  title: o ? `${e} is required` : void 0,
2116
- children: a ? x({
2116
+ children: a ? w({
2117
2117
  field: a,
2118
2118
  fieldName: e,
2119
2119
  value: t[e],
2120
2120
  mode: "edit",
2121
- onChange: (n) => S(t._key, e, n),
2121
+ onChange: (n) => b(t._key, e, n),
2122
2122
  record: t,
2123
- refs: u,
2123
+ refs: l,
2124
2124
  compact: !0,
2125
2125
  locale: f
2126
- }) : v(t[e])
2126
+ }) : A(t[e])
2127
2127
  }, e);
2128
- }), /* @__PURE__ */ J("td", {
2128
+ }), /* @__PURE__ */ Y("td", {
2129
2129
  style: {
2130
2130
  padding: "4px 8px",
2131
2131
  borderBottom: "1px solid var(--divider)",
2132
2132
  verticalAlign: "middle"
2133
2133
  },
2134
- children: r ? /* @__PURE__ */ J(l, {
2134
+ children: r ? /* @__PURE__ */ Y(d, {
2135
2135
  size: 24,
2136
- icon: /* @__PURE__ */ J(e.refresh, { size: 12 }),
2137
- onClick: () => D(t._key),
2136
+ icon: /* @__PURE__ */ Y(e.refresh, { size: 12 }),
2137
+ onClick: () => C(t._key),
2138
2138
  title: "Undo delete"
2139
- }) : /* @__PURE__ */ J(l, {
2139
+ }) : /* @__PURE__ */ Y(d, {
2140
2140
  size: 24,
2141
- icon: /* @__PURE__ */ J(e.trash, { size: 12 }),
2142
- onClick: () => w(t._key),
2141
+ icon: /* @__PURE__ */ Y(e.trash, { size: 12 }),
2142
+ onClick: () => S(t._key),
2143
2143
  title: "Delete row"
2144
2144
  })
2145
2145
  })]
2146
2146
  }, t._key);
2147
2147
  }) })]
2148
2148
  })
2149
- }), /* @__PURE__ */ J("div", {
2149
+ }), /* @__PURE__ */ Y("div", {
2150
2150
  style: { marginTop: 8 },
2151
- children: /* @__PURE__ */ J(a, {
2151
+ children: /* @__PURE__ */ Y(a, {
2152
2152
  kind: "ghost",
2153
2153
  size: "xs",
2154
- icon: /* @__PURE__ */ J(e.plus, { size: 12 }),
2155
- onClick: C,
2154
+ icon: /* @__PURE__ */ Y(e.plus, { size: 12 }),
2155
+ onClick: x,
2156
2156
  children: "Add row"
2157
2157
  })
2158
2158
  })] });
2159
2159
  }
2160
2160
  //#endregion
2161
2161
  //#region src/components/detail-layout/ChildrenBlock.tsx
2162
- var pt = V(() => import("./DraggableChildrenTable-CAHg7paQ.js").then((e) => ({ default: e.DraggableChildrenTable })));
2162
+ var pt = H(() => import("./DraggableChildrenTable-CljdYXd_.js").then((e) => ({ default: e.DraggableChildrenTable })));
2163
2163
  function mt({ node: e, ctx: n }) {
2164
- let r = i(), a = e.children;
2165
- if (!a) return null;
2166
- let o = r.isPhone && n.relatedRecordsPresentation === "table";
2164
+ let r = c(), i = e.children;
2165
+ if (!i) return null;
2166
+ let a = r.isPhone && n.relatedRecordsPresentation === "table";
2167
2167
  if (n.isNew && n.mode !== "edit") return null;
2168
- let s = ze(n.entity, a);
2169
- if (!s) return /* @__PURE__ */ Y("div", {
2168
+ let o = ze(n.entity, i);
2169
+ if (!o) return /* @__PURE__ */ X("div", {
2170
2170
  className: "text-sm text-muted-foreground py-2",
2171
- children: ["Unknown child relation: ", a]
2171
+ children: ["Unknown child relation: ", i]
2172
2172
  });
2173
- let c = n.schema.entities[s.entity];
2174
- if (!c) return /* @__PURE__ */ Y("div", {
2173
+ let s = n.schema.entities[o.entity];
2174
+ if (!s) return /* @__PURE__ */ X("div", {
2175
2175
  className: "text-sm text-muted-foreground py-2",
2176
- children: ["Entity not found: ", s.entity]
2176
+ children: ["Entity not found: ", o.entity]
2177
2177
  });
2178
- let l = De(s, c, e), u = X(e, n), d = Z(e, n), f = (e) => l.mode === "timeline" || n.withinCard ? e : /* @__PURE__ */ J(P, {
2178
+ let l = De(o, s, e), u = Z(e, n), d = we(e, n), f = (e) => l.mode === "timeline" || n.withinCard ? e : /* @__PURE__ */ Y(F, {
2179
2179
  title: u,
2180
- icon: d ? /* @__PURE__ */ J(t, {
2180
+ icon: d ? /* @__PURE__ */ Y(t, {
2181
2181
  name: d,
2182
2182
  size: 14
2183
2183
  }) : void 0,
2184
2184
  children: e
2185
2185
  });
2186
- if (n.mode === "edit" && l.editable && l.interaction !== "navigate" && l.interaction !== "readonly" && O(c, "update") && l.mode === "table" && n.pendingChildren !== void 0 && n.onChildrenChange) {
2187
- let e = n.pendingChildren[a] ?? [], t = n.childValidationErrors?.[a], i = l.position_field ? r.isPhone && !o ? ft : pt : ft;
2188
- return f(/* @__PURE__ */ J(ue, {
2189
- fallback: /* @__PURE__ */ J(te, {}),
2190
- children: /* @__PURE__ */ J(i, {
2186
+ if (n.mode === "edit" && l.editable && l.interaction !== "navigate" && l.interaction !== "readonly" && b(s, "update") && l.mode === "table" && n.pendingChildren !== void 0 && n.onChildrenChange) {
2187
+ let e = n.pendingChildren[i] ?? [], t = n.childValidationErrors?.[i], o = l.position_field ? r.isPhone && !a ? ft : pt : ft;
2188
+ return f(/* @__PURE__ */ Y(le, {
2189
+ fallback: /* @__PURE__ */ Y(N, {}),
2190
+ children: /* @__PURE__ */ Y(o, {
2191
2191
  config: l,
2192
- childEntity: c,
2192
+ childEntity: s,
2193
2193
  schema: n.schema,
2194
2194
  rows: e,
2195
- onChange: (e) => n.onChildrenChange(a, e),
2195
+ onChange: (e) => n.onChildrenChange(i, e),
2196
2196
  validationErrors: t,
2197
2197
  refs: n.refs,
2198
- forceTablePresentation: o
2198
+ forceTablePresentation: a
2199
2199
  })
2200
2200
  }));
2201
2201
  }
@@ -2207,10 +2207,10 @@ function mt({ node: e, ctx: n }) {
2207
2207
  schema: n.schema
2208
2208
  };
2209
2209
  switch (l.mode) {
2210
- case "list": return f(/* @__PURE__ */ J(Ge, { ...p }));
2211
- case "cards": return f(/* @__PURE__ */ J(Ke, { ...p }));
2212
- case "timeline": return f(/* @__PURE__ */ J(at, { ...p }));
2213
- default: return r.isPhone && !o ? f(/* @__PURE__ */ J(Ke, { ...p })) : f(/* @__PURE__ */ J(We, { ...p }));
2210
+ case "list": return f(/* @__PURE__ */ Y(Ge, { ...p }));
2211
+ case "cards": return f(/* @__PURE__ */ Y(Ke, { ...p }));
2212
+ case "timeline": return f(/* @__PURE__ */ Y(at, { ...p }));
2213
+ default: return r.isPhone && !a ? f(/* @__PURE__ */ Y(Ke, { ...p })) : f(/* @__PURE__ */ Y(We, { ...p }));
2214
2214
  }
2215
2215
  }
2216
2216
  //#endregion
@@ -2221,10 +2221,10 @@ var ht = 150, gt = 560, _t = "20px", vt = 4, yt = /* @__PURE__ */ new Set([
2221
2221
  "json",
2222
2222
  "structure",
2223
2223
  "multilang_text"
2224
- ]), bt = de({ columns: 2 });
2224
+ ]), bt = ue({ columns: 2 });
2225
2225
  function xt({ columns: e = 2, children: t }) {
2226
- let n = G(null), [r, i] = K(!1);
2227
- U(() => {
2226
+ let n = K(null), [r, i] = q(!1);
2227
+ W(() => {
2228
2228
  let t = n.current;
2229
2229
  if (!t || e === 1 || typeof ResizeObserver > "u") return;
2230
2230
  let r = new ResizeObserver(([e]) => {
@@ -2233,9 +2233,9 @@ function xt({ columns: e = 2, children: t }) {
2233
2233
  return r.observe(t), () => r.disconnect();
2234
2234
  }, [e]);
2235
2235
  let a = e === 1 || r ? 1 : e;
2236
- return /* @__PURE__ */ J(bt.Provider, {
2236
+ return /* @__PURE__ */ Y(bt.Provider, {
2237
2237
  value: { columns: a },
2238
- children: /* @__PURE__ */ J("div", {
2238
+ children: /* @__PURE__ */ Y("div", {
2239
2239
  ref: n,
2240
2240
  style: {
2241
2241
  display: "grid",
@@ -2248,8 +2248,8 @@ function xt({ columns: e = 2, children: t }) {
2248
2248
  });
2249
2249
  }
2250
2250
  function St({ label: t, children: n, span: r = !1, required: i, error: a, hint: s, actions: c, copyValue: l, mode: u = "display", htmlFor: d, labelId: f, labelTitle: p, "data-testid": m }) {
2251
- let h = fe(bt), g = r || h.columns === 1, _ = !!a;
2252
- return /* @__PURE__ */ Y("div", {
2251
+ let h = de(bt), g = r || h.columns === 1, _ = !!a;
2252
+ return /* @__PURE__ */ X("div", {
2253
2253
  className: "detail-row",
2254
2254
  "data-error": _ || void 0,
2255
2255
  "data-testid": m,
@@ -2261,7 +2261,7 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2261
2261
  padding: "6px 0",
2262
2262
  ...r ? { gridColumn: "1 / -1" } : null
2263
2263
  },
2264
- children: [/* @__PURE__ */ Y("div", {
2264
+ children: [/* @__PURE__ */ X("div", {
2265
2265
  style: {
2266
2266
  width: g ? "auto" : ht,
2267
2267
  flexShrink: 0,
@@ -2274,16 +2274,16 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2274
2274
  alignItems: "flex-start",
2275
2275
  gap: 2
2276
2276
  },
2277
- children: [d ? /* @__PURE__ */ J("label", {
2277
+ children: [d ? /* @__PURE__ */ Y("label", {
2278
2278
  id: f,
2279
2279
  htmlFor: d,
2280
2280
  title: p || void 0,
2281
2281
  children: t
2282
- }) : /* @__PURE__ */ J("span", {
2282
+ }) : /* @__PURE__ */ Y("span", {
2283
2283
  id: f,
2284
2284
  title: p || void 0,
2285
2285
  children: t
2286
- }), i && u === "edit" && /* @__PURE__ */ J("span", {
2286
+ }), i && u === "edit" && /* @__PURE__ */ Y("span", {
2287
2287
  "aria-hidden": "true",
2288
2288
  style: {
2289
2289
  color: "var(--danger)",
@@ -2291,7 +2291,7 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2291
2291
  },
2292
2292
  children: "*"
2293
2293
  })]
2294
- }), /* @__PURE__ */ Y("div", {
2294
+ }), /* @__PURE__ */ X("div", {
2295
2295
  style: {
2296
2296
  flex: 1,
2297
2297
  minWidth: 0,
@@ -2299,14 +2299,14 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2299
2299
  flexDirection: "column",
2300
2300
  gap: 3
2301
2301
  },
2302
- children: [/* @__PURE__ */ Y("div", {
2302
+ children: [/* @__PURE__ */ X("div", {
2303
2303
  style: {
2304
2304
  display: "flex",
2305
2305
  alignItems: "flex-start",
2306
2306
  gap: 6,
2307
2307
  minHeight: 24
2308
2308
  },
2309
- children: [/* @__PURE__ */ J("div", {
2309
+ children: [/* @__PURE__ */ Y("div", {
2310
2310
  style: {
2311
2311
  flex: 1,
2312
2312
  minWidth: 0,
@@ -2316,14 +2316,14 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2316
2316
  overflowWrap: "anywhere",
2317
2317
  paddingTop: u === "display" && !g ? vt : 0
2318
2318
  },
2319
- children: _ && u === "edit" ? /* @__PURE__ */ J("div", {
2319
+ children: _ && u === "edit" ? /* @__PURE__ */ Y("div", {
2320
2320
  style: {
2321
2321
  borderRadius: 6,
2322
2322
  boxShadow: "0 0 0 1.5px var(--danger)"
2323
2323
  },
2324
2324
  children: n
2325
2325
  }) : n
2326
- }), (l || c) && /* @__PURE__ */ Y("div", {
2326
+ }), (l || c) && /* @__PURE__ */ X("div", {
2327
2327
  className: "detail-row-action",
2328
2328
  style: {
2329
2329
  display: "flex",
@@ -2331,13 +2331,13 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2331
2331
  flexShrink: 0,
2332
2332
  marginTop: -2
2333
2333
  },
2334
- children: [l && /* @__PURE__ */ J(o, {
2334
+ children: [l && /* @__PURE__ */ Y(o, {
2335
2335
  value: l,
2336
2336
  size: "sm",
2337
2337
  title: "Copy value"
2338
2338
  }), c]
2339
2339
  })]
2340
- }), (_ || s != null) && /* @__PURE__ */ Y("div", {
2340
+ }), (_ || s != null) && /* @__PURE__ */ X("div", {
2341
2341
  style: {
2342
2342
  fontSize: 11.5,
2343
2343
  lineHeight: 1.4,
@@ -2346,7 +2346,7 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2346
2346
  alignItems: "center",
2347
2347
  gap: 4
2348
2348
  },
2349
- children: [_ && /* @__PURE__ */ J(e.warning, { size: 11 }), /* @__PURE__ */ J("span", { children: _ ? a : s })]
2349
+ children: [_ && /* @__PURE__ */ Y(e.warning, { size: 11 }), /* @__PURE__ */ Y("span", { children: _ ? a : s })]
2350
2350
  })]
2351
2351
  })]
2352
2352
  });
@@ -2354,22 +2354,22 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2354
2354
  //#endregion
2355
2355
  //#region src/components/detail-layout/FieldsBlock.tsx
2356
2356
  function Ct({ fields: e, ctx: t }) {
2357
- let { entity: n, entityCode: r, record: i, mode: a, onFieldChange: o, schema: s } = t, c = T(), l = t.columns ?? 2, u = l === 1 && e.length === 1;
2358
- return /* @__PURE__ */ J(xt, {
2357
+ let { entity: n, entityCode: r, record: i, mode: a, onFieldChange: o, schema: s } = t, c = D(), l = t.columns ?? 2, u = l === 1 && e.length === 1;
2358
+ return /* @__PURE__ */ Y(xt, {
2359
2359
  columns: l,
2360
2360
  children: e.map((e) => {
2361
- let l = e.name, d = `${r ?? "field"}-${l}`, f = `${d}-label`, p = n.fields.get(l), m = !!(p?.auto || p?.readonly || p?.source), h = F(n, l), g = h?.read === "denied", _ = h?.write === "denied", y = a === "display" ? g : _ || g, b = m || a === "edit" && _ ? "display" : a, x = y ? /* @__PURE__ */ J(oe, {
2361
+ let l = e.name, d = `${r ?? "field"}-${l}`, f = `${d}-label`, p = n.fields.get(l), m = !!(p?.auto || p?.readonly || p?.source), h = I(n, l), g = h?.read === "denied", _ = h?.write === "denied", v = a === "display" ? g : _ || g, y = m || a === "edit" && _ ? "display" : a, b = v ? /* @__PURE__ */ Y(ae, {
2362
2362
  tier: h.classification,
2363
- tierDef: ae(s, n, l),
2363
+ tierDef: ie(s, n, l),
2364
2364
  requiredPermission: h?.required_permission,
2365
2365
  locale: c,
2366
- variant: b === "edit" ? "input" : "value"
2367
- }) : I({
2366
+ variant: y === "edit" ? "input" : "value"
2367
+ }) : L({
2368
2368
  entity: n,
2369
2369
  entityCode: r,
2370
2370
  fieldName: l,
2371
2371
  record: i,
2372
- mode: b,
2372
+ mode: y,
2373
2373
  onChange: o && !m ? (e) => o(l, e) : void 0,
2374
2374
  refs: t.refs,
2375
2375
  entities: s?.entities,
@@ -2378,39 +2378,39 @@ function Ct({ fields: e, ctx: t }) {
2378
2378
  fieldId: d,
2379
2379
  labelId: f
2380
2380
  });
2381
- if (!x) return null;
2382
- let S = a === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ J(q, { children: e.actions.map((e, t) => /* @__PURE__ */ J(L, {
2381
+ if (!b) return null;
2382
+ let x = a === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ Y(J, { children: e.actions.map((e, t) => /* @__PURE__ */ Y(R, {
2383
2383
  actionCode: `${l}.action[${t}]`,
2384
2384
  action: e,
2385
2385
  entityCode: r,
2386
2386
  row: i,
2387
2387
  variant: "ghost",
2388
2388
  size: "icon"
2389
- }, t)) }) : void 0, C = !!p && yt.has(p.type), T = i?.[l], E = b === "display" && (p?.copyable || p?.type === "uuid") && T != null && T !== "" ? v(T) : void 0, D = w(p?.display?.description);
2390
- return u ? /* @__PURE__ */ Y("div", {
2389
+ }, t)) }) : void 0, S = !!p && yt.has(p.type), w = i?.[l], T = y === "display" && (p?.copyable || p?.type === "uuid") && w != null && w !== "" ? A(w) : void 0, E = C(p?.display?.description);
2390
+ return u ? /* @__PURE__ */ X("div", {
2391
2391
  style: { gridColumn: "1 / -1" },
2392
- children: [x, b === "edit" && D && /* @__PURE__ */ J("div", {
2392
+ children: [b, y === "edit" && E && /* @__PURE__ */ Y("div", {
2393
2393
  style: {
2394
2394
  fontSize: 11.5,
2395
2395
  lineHeight: 1.4,
2396
2396
  color: "var(--text-3)",
2397
2397
  marginTop: 3
2398
2398
  },
2399
- children: D
2399
+ children: E
2400
2400
  })]
2401
- }, l) : /* @__PURE__ */ J(St, {
2402
- label: ie(n, l, s.entities),
2403
- htmlFor: b === "edit" ? d : void 0,
2401
+ }, l) : /* @__PURE__ */ Y(St, {
2402
+ label: re(n, l, s.entities),
2403
+ htmlFor: y === "edit" ? d : void 0,
2404
2404
  labelId: f,
2405
- labelTitle: D || void 0,
2405
+ labelTitle: E || void 0,
2406
2406
  required: p?.required ?? !1,
2407
- mode: b,
2408
- span: C,
2407
+ mode: y,
2408
+ span: S,
2409
2409
  error: t.fieldErrors?.[l],
2410
- hint: b === "edit" && D ? D : void 0,
2411
- actions: S,
2412
- copyValue: E,
2413
- children: x
2410
+ hint: y === "edit" && E ? E : void 0,
2411
+ actions: x,
2412
+ copyValue: T,
2413
+ children: b
2414
2414
  }, l);
2415
2415
  })
2416
2416
  });
@@ -2430,11 +2430,11 @@ function Et({ node: e, ctx: t }) {
2430
2430
  let { entity: n, objectProperties: r, onSetProperty: i, isNew: a, mode: o, refs: s } = t, c = n.properties ?? {};
2431
2431
  if (a) return null;
2432
2432
  let l = e.properties === !0 ? !0 : e.properties, u = l === !0 ? Object.entries(c).sort(([e], [t]) => e.localeCompare(t)) : l.filter((e) => c[e] != null).map((e) => [e, c[e]]);
2433
- return u.length === 0 ? null : /* @__PURE__ */ J(xt, {
2433
+ return u.length === 0 ? null : /* @__PURE__ */ Y(xt, {
2434
2434
  columns: 2,
2435
2435
  children: u.map(([e, a]) => {
2436
- let c = r?.find((t) => t.property_code === e), l = p(a), u = a.readonly || !i ? "display" : o;
2437
- return /* @__PURE__ */ J(Dt, {
2436
+ let c = r?.find((t) => t.property_code === e), l = T(a), u = a.readonly || !i ? "display" : o;
2437
+ return /* @__PURE__ */ Y(Dt, {
2438
2438
  propCode: e,
2439
2439
  prop: a,
2440
2440
  field: l,
@@ -2449,28 +2449,28 @@ function Et({ node: e, ctx: t }) {
2449
2449
  });
2450
2450
  }
2451
2451
  function Dt({ propCode: e, prop: t, field: n, value: r, mode: i, onSetProperty: a, refs: o, entity: s, schema: c }) {
2452
- let l = T(), u = G(null);
2453
- U(() => () => {
2452
+ let l = D(), u = K(null);
2453
+ W(() => () => {
2454
2454
  u.current && clearTimeout(u.current);
2455
2455
  }, []);
2456
- let d = H((n) => {
2456
+ let d = U((n) => {
2457
2457
  a && (wt.has(t.type) ? (u.current && clearTimeout(u.current), u.current = setTimeout(() => a(e, n), Tt)) : a(e, n));
2458
2458
  }, [
2459
2459
  e,
2460
2460
  t.type,
2461
2461
  a
2462
- ]), f = F(s, e), p = f?.read === "denied", m = f?.write === "denied", h = i === "display" ? p : m || p, g = i === "edit" && m ? "display" : i;
2463
- return /* @__PURE__ */ J(St, {
2464
- label: w(t.display?.name ?? t.name),
2462
+ ]), f = I(s, e), p = f?.read === "denied", m = f?.write === "denied", h = i === "display" ? p : m || p, g = i === "edit" && m ? "display" : i;
2463
+ return /* @__PURE__ */ Y(St, {
2464
+ label: C(t.display?.name ?? t.name),
2465
2465
  mode: g,
2466
2466
  span: yt.has(t.type),
2467
- children: h ? /* @__PURE__ */ J(oe, {
2467
+ children: h ? /* @__PURE__ */ Y(ae, {
2468
2468
  tier: f.classification,
2469
- tierDef: ae(c, s, e),
2469
+ tierDef: ie(c, s, e),
2470
2470
  requiredPermission: f?.required_permission,
2471
2471
  locale: l,
2472
2472
  variant: g === "edit" ? "input" : "value"
2473
- }) : x({
2473
+ }) : w({
2474
2474
  field: n,
2475
2475
  fieldName: e,
2476
2476
  value: r,
@@ -2485,7 +2485,7 @@ function Dt({ propCode: e, prop: t, field: n, value: r, mode: i, onSetProperty:
2485
2485
  //#region src/components/shared/StatusStepper.tsx
2486
2486
  function Ot({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1 }) {
2487
2487
  let o = t.findIndex((e) => e.code === n);
2488
- return /* @__PURE__ */ J("div", {
2488
+ return /* @__PURE__ */ Y("div", {
2489
2489
  role: "list",
2490
2490
  style: {
2491
2491
  display: "flex",
@@ -2497,7 +2497,7 @@ function Ot({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
2497
2497
  },
2498
2498
  children: t.map((n, s) => {
2499
2499
  let c = o >= 0 && s < o, l = s === o, u = o < 0 || s > o, d = !!i && (r?.has(n.code) ?? !1), f = s === 0, p = s === t.length - 1, m = l ? "var(--accent-soft)" : c ? "var(--success-soft)" : "transparent", h = l ? "var(--accent)" : c ? "var(--success)" : "var(--text-3)", g = f && p ? void 0 : f ? "polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%)" : p ? "polygon(0 0, 100% 0, 100% 100%, 0 100%, 10px 50%)" : "polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%)";
2500
- return /* @__PURE__ */ Y("button", {
2500
+ return /* @__PURE__ */ X("button", {
2501
2501
  role: "listitem",
2502
2502
  type: "button",
2503
2503
  disabled: !d,
@@ -2521,7 +2521,7 @@ function Ot({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
2521
2521
  clipPath: g,
2522
2522
  whiteSpace: "nowrap"
2523
2523
  },
2524
- children: [/* @__PURE__ */ J("span", {
2524
+ children: [/* @__PURE__ */ Y("span", {
2525
2525
  style: {
2526
2526
  width: 16,
2527
2527
  height: 16,
@@ -2536,8 +2536,8 @@ function Ot({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
2536
2536
  fontSize: 9.5,
2537
2537
  fontWeight: 700
2538
2538
  },
2539
- children: c ? /* @__PURE__ */ J(e.check, { size: 10 }) : s + 1
2540
- }), /* @__PURE__ */ J("span", {
2539
+ children: c ? /* @__PURE__ */ Y(e.check, { size: 10 }) : s + 1
2540
+ }), /* @__PURE__ */ Y("span", {
2541
2541
  style: {
2542
2542
  overflow: "hidden",
2543
2543
  textOverflow: "ellipsis"
@@ -2550,8 +2550,8 @@ function Ot({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
2550
2550
  }
2551
2551
  //#endregion
2552
2552
  //#region src/components/shared/StatusGroupsDisplay.tsx
2553
- function kt({ statusGroups: e, objectStatuses: t, onSetStatus: r, isPending: i, mode: a = "edit" }) {
2554
- return /* @__PURE__ */ J("div", {
2553
+ function kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: i, mode: a = "edit" }) {
2554
+ return /* @__PURE__ */ Y("div", {
2555
2555
  style: {
2556
2556
  display: "flex",
2557
2557
  flexWrap: "wrap",
@@ -2561,57 +2561,57 @@ function kt({ statusGroups: e, objectStatuses: t, onSetStatus: r, isPending: i,
2561
2561
  children: Object.entries(e).map(([e, o]) => {
2562
2562
  let s = t?.find((t) => t.group_code === e)?.status_code, c = s ? o.statuses.find((e) => e.code === s) : void 0;
2563
2563
  if (o.display_mode === "stepper") {
2564
- let t = a === "edit", n = t ? o.transitions && s ? /* @__PURE__ */ new Set([s, ...o.transitions[s] ?? []]) : new Set(o.statuses.map((e) => e.code)) : void 0;
2565
- return /* @__PURE__ */ Y("div", {
2564
+ let t = a === "edit", r = t ? o.transitions && s ? /* @__PURE__ */ new Set([s, ...o.transitions[s] ?? []]) : new Set(o.statuses.map((e) => e.code)) : void 0;
2565
+ return /* @__PURE__ */ X("div", {
2566
2566
  style: {
2567
2567
  display: "flex",
2568
2568
  alignItems: "center",
2569
2569
  gap: 8,
2570
2570
  minWidth: 0
2571
2571
  },
2572
- children: [/* @__PURE__ */ Y("span", {
2572
+ children: [/* @__PURE__ */ X("span", {
2573
2573
  style: {
2574
2574
  fontSize: 12,
2575
2575
  color: "var(--text-3)",
2576
2576
  flexShrink: 0
2577
2577
  },
2578
- children: [w(o.name), ":"]
2579
- }), /* @__PURE__ */ J("div", {
2578
+ children: [C(o.name), ":"]
2579
+ }), /* @__PURE__ */ Y("div", {
2580
2580
  style: {
2581
2581
  minWidth: 240,
2582
2582
  opacity: i ? .6 : 1,
2583
2583
  pointerEvents: i ? "none" : "auto"
2584
2584
  },
2585
- children: /* @__PURE__ */ J(Ot, {
2585
+ children: /* @__PURE__ */ Y(Ot, {
2586
2586
  stages: o.statuses.map((e) => ({
2587
2587
  code: e.code,
2588
- label: w(e.name)
2588
+ label: C(e.name)
2589
2589
  })),
2590
2590
  current: s,
2591
- selectable: n,
2592
- onSelect: t ? (t) => r(e, t) : void 0,
2591
+ selectable: r,
2592
+ onSelect: t ? (t) => n(e, t) : void 0,
2593
2593
  compact: !0
2594
2594
  })
2595
2595
  })]
2596
2596
  }, e);
2597
2597
  }
2598
- if (a === "display") return /* @__PURE__ */ Y("div", {
2598
+ if (a === "display") return /* @__PURE__ */ X("div", {
2599
2599
  style: {
2600
2600
  display: "flex",
2601
2601
  alignItems: "center",
2602
2602
  gap: 8
2603
2603
  },
2604
- children: [/* @__PURE__ */ Y("span", {
2604
+ children: [/* @__PURE__ */ X("span", {
2605
2605
  style: {
2606
2606
  fontSize: 12,
2607
2607
  color: "var(--text-3)"
2608
2608
  },
2609
- children: [w(o.name), ":"]
2610
- }), c ? /* @__PURE__ */ J(n, {
2609
+ children: [C(o.name), ":"]
2610
+ }), c ? /* @__PURE__ */ Y(l, {
2611
2611
  tone: c.color ?? "slate",
2612
2612
  size: "xs",
2613
- children: w(c.name)
2614
- }) : /* @__PURE__ */ J("span", {
2613
+ children: C(c.name)
2614
+ }) : /* @__PURE__ */ Y("span", {
2615
2615
  style: {
2616
2616
  fontSize: 12.5,
2617
2617
  color: "var(--text-4)"
@@ -2619,45 +2619,45 @@ function kt({ statusGroups: e, objectStatuses: t, onSetStatus: r, isPending: i,
2619
2619
  children: "—"
2620
2620
  })]
2621
2621
  }, e);
2622
- let l = (o.transitions && s ? o.statuses.filter((e) => e.code === s || (o.transitions[s]?.includes(e.code) ?? !1)) : o.statuses).map((e) => ({
2622
+ let u = (o.transitions && s ? o.statuses.filter((e) => e.code === s || (o.transitions[s]?.includes(e.code) ?? !1)) : o.statuses).map((e) => ({
2623
2623
  value: e.code,
2624
- label: /* @__PURE__ */ Y("span", {
2624
+ label: /* @__PURE__ */ X("span", {
2625
2625
  style: {
2626
2626
  display: "inline-flex",
2627
2627
  alignItems: "center",
2628
2628
  gap: 6
2629
2629
  },
2630
- children: [e.color && /* @__PURE__ */ J("span", { style: {
2630
+ children: [e.color && /* @__PURE__ */ Y("span", { style: {
2631
2631
  width: 8,
2632
2632
  height: 8,
2633
2633
  borderRadius: 999,
2634
2634
  background: `var(--pill-${e.color}, ${e.color})`,
2635
2635
  display: "inline-block"
2636
- } }), w(e.name)]
2636
+ } }), C(e.name)]
2637
2637
  })
2638
2638
  }));
2639
- return /* @__PURE__ */ Y("div", {
2639
+ return /* @__PURE__ */ X("div", {
2640
2640
  style: {
2641
2641
  display: "flex",
2642
2642
  alignItems: "center",
2643
2643
  gap: 8
2644
2644
  },
2645
- children: [/* @__PURE__ */ Y("span", {
2645
+ children: [/* @__PURE__ */ X("span", {
2646
2646
  style: {
2647
2647
  fontSize: 12,
2648
2648
  color: "var(--text-3)"
2649
2649
  },
2650
- children: [w(o.name), ":"]
2651
- }), /* @__PURE__ */ J("div", {
2650
+ children: [C(o.name), ":"]
2651
+ }), /* @__PURE__ */ Y("div", {
2652
2652
  style: {
2653
2653
  minWidth: 180,
2654
2654
  opacity: i ? .6 : 1,
2655
2655
  pointerEvents: i ? "none" : "auto"
2656
2656
  },
2657
- children: /* @__PURE__ */ J(A, {
2657
+ children: /* @__PURE__ */ Y(r, {
2658
2658
  value: s ?? "",
2659
- options: l,
2660
- onChange: (t) => r(e, t),
2659
+ options: u,
2660
+ onChange: (t) => n(e, t),
2661
2661
  placeholder: "Select…"
2662
2662
  })
2663
2663
  })]
@@ -2672,7 +2672,7 @@ function jt({ node: e, ctx: t }) {
2672
2672
  let { entity: n, objectStatuses: r, onSetStatus: i, isStatusPending: a, isNew: o } = t, s = n.status_groups ?? {};
2673
2673
  if (o) return null;
2674
2674
  let c = e.statuses === !0 ? !0 : e.statuses, l = Object.fromEntries(Object.entries(s).filter(([e]) => c === !0 || c.includes(e)));
2675
- return Object.keys(l).length === 0 ? null : /* @__PURE__ */ J(kt, {
2675
+ return Object.keys(l).length === 0 ? null : /* @__PURE__ */ Y(kt, {
2676
2676
  statusGroups: l,
2677
2677
  objectStatuses: r,
2678
2678
  onSetStatus: i ?? At,
@@ -2713,29 +2713,29 @@ function Pt(e) {
2713
2713
  }
2714
2714
  //#endregion
2715
2715
  //#region src/components/detail-layout/widgets/JsonDiffWidget.tsx
2716
- var Ft = "Audit change diff", It = V(() => import("./MonacoJson-DVjwsaBK.js").then((e) => ({ default: e.MonacoJsonDiff }))), Lt = V(() => import("./MonacoJson-DVjwsaBK.js").then((e) => ({ default: e.MonacoJsonSource }))), Rt = V(() => import("./JsonEditor-KelPV-OQ.js").then((e) => ({ default: e.JsonEditor })));
2716
+ var Ft = "Audit change diff", It = H(() => import("./MonacoJson-DVjwsaBK.js").then((e) => ({ default: e.MonacoJsonDiff }))), Lt = H(() => import("./MonacoJson-DVjwsaBK.js").then((e) => ({ default: e.MonacoJsonSource }))), Rt = H(() => import("./JsonEditor-KelPV-OQ.js").then((e) => ({ default: e.JsonEditor })));
2717
2717
  function zt() {
2718
- return /* @__PURE__ */ J("div", {
2718
+ return /* @__PURE__ */ Y("div", {
2719
2719
  className: "flex h-full w-full items-center justify-center text-sm text-muted-foreground",
2720
2720
  children: "Loading editor…"
2721
2721
  });
2722
2722
  }
2723
2723
  function Bt({ before: e, after: t }) {
2724
- return /* @__PURE__ */ J(ue, {
2725
- fallback: /* @__PURE__ */ J(zt, {}),
2726
- children: /* @__PURE__ */ Y("div", {
2724
+ return /* @__PURE__ */ Y(le, {
2725
+ fallback: /* @__PURE__ */ Y(zt, {}),
2726
+ children: /* @__PURE__ */ X("div", {
2727
2727
  className: "flex h-full w-full gap-2",
2728
2728
  role: "group",
2729
2729
  "aria-label": Ft,
2730
- children: [/* @__PURE__ */ J("div", {
2730
+ children: [/* @__PURE__ */ Y("div", {
2731
2731
  className: "min-w-0 flex-1",
2732
- children: /* @__PURE__ */ J(Rt, {
2732
+ children: /* @__PURE__ */ Y(Rt, {
2733
2733
  value: e,
2734
2734
  readOnly: !0
2735
2735
  })
2736
- }), /* @__PURE__ */ J("div", {
2736
+ }), /* @__PURE__ */ Y("div", {
2737
2737
  className: "min-w-0 flex-1",
2738
- children: /* @__PURE__ */ J(Rt, {
2738
+ children: /* @__PURE__ */ Y(Rt, {
2739
2739
  value: t,
2740
2740
  readOnly: !0
2741
2741
  })
@@ -2744,17 +2744,17 @@ function Bt({ before: e, after: t }) {
2744
2744
  });
2745
2745
  }
2746
2746
  function Vt({ mode: e, onChange: t }) {
2747
- return /* @__PURE__ */ Y("div", {
2747
+ return /* @__PURE__ */ X("div", {
2748
2748
  className: "inline-flex gap-1",
2749
2749
  role: "group",
2750
2750
  "aria-label": "Diff view mode",
2751
- children: [/* @__PURE__ */ J("button", {
2751
+ children: [/* @__PURE__ */ Y("button", {
2752
2752
  type: "button",
2753
2753
  "aria-pressed": e === "diff",
2754
2754
  onClick: () => t("diff"),
2755
2755
  className: `rounded px-2 py-0.5 text-xs ${e === "diff" ? "bg-accent text-accent-foreground" : "text-muted-foreground"}`,
2756
2756
  children: "Diff"
2757
- }), /* @__PURE__ */ J("button", {
2757
+ }), /* @__PURE__ */ Y("button", {
2758
2758
  type: "button",
2759
2759
  "aria-pressed": e === "source",
2760
2760
  onClick: () => t("source"),
@@ -2764,41 +2764,41 @@ function Vt({ mode: e, onChange: t }) {
2764
2764
  });
2765
2765
  }
2766
2766
  function Ht({ values: e, options: t }) {
2767
- let n = e.before, r = e.after, [i, a] = K(t?.default_mode === "source" ? "source" : "diff"), o = Pt(n), s = Pt(r);
2768
- return /* @__PURE__ */ Y("div", {
2767
+ let n = e.before, r = e.after, [i, a] = q(t?.default_mode === "source" ? "source" : "diff"), o = Pt(n), s = Pt(r);
2768
+ return /* @__PURE__ */ X("div", {
2769
2769
  className: "flex flex-col gap-2",
2770
- children: [/* @__PURE__ */ Y("div", {
2770
+ children: [/* @__PURE__ */ X("div", {
2771
2771
  className: "flex items-center justify-between",
2772
- children: [/* @__PURE__ */ J(Vt, {
2772
+ children: [/* @__PURE__ */ Y(Vt, {
2773
2773
  mode: i,
2774
2774
  onChange: a
2775
- }), o === s && /* @__PURE__ */ J("span", {
2775
+ }), o === s && /* @__PURE__ */ Y("span", {
2776
2776
  className: "text-xs text-muted-foreground",
2777
2777
  role: "status",
2778
2778
  children: "No field changes"
2779
2779
  })]
2780
- }), /* @__PURE__ */ J("div", {
2780
+ }), /* @__PURE__ */ Y("div", {
2781
2781
  className: "h-[480px] w-full overflow-hidden rounded border",
2782
2782
  role: "group",
2783
2783
  "aria-label": Ft,
2784
- children: /* @__PURE__ */ J(R, {
2785
- fallback: /* @__PURE__ */ J(Bt, {
2784
+ children: /* @__PURE__ */ Y(z, {
2785
+ fallback: /* @__PURE__ */ Y(Bt, {
2786
2786
  before: n,
2787
2787
  after: r
2788
2788
  }),
2789
- children: /* @__PURE__ */ J(ue, {
2790
- fallback: /* @__PURE__ */ J(zt, {}),
2791
- children: i === "diff" ? /* @__PURE__ */ J(It, {
2789
+ children: /* @__PURE__ */ Y(le, {
2790
+ fallback: /* @__PURE__ */ Y(zt, {}),
2791
+ children: i === "diff" ? /* @__PURE__ */ Y(It, {
2792
2792
  before: o,
2793
2793
  after: s
2794
- }) : /* @__PURE__ */ Y("div", {
2794
+ }) : /* @__PURE__ */ X("div", {
2795
2795
  className: "flex h-full w-full gap-2",
2796
- children: [/* @__PURE__ */ J("div", {
2796
+ children: [/* @__PURE__ */ Y("div", {
2797
2797
  className: "min-w-0 flex-1",
2798
- children: /* @__PURE__ */ J(Lt, { value: o })
2799
- }), /* @__PURE__ */ J("div", {
2798
+ children: /* @__PURE__ */ Y(Lt, { value: o })
2799
+ }), /* @__PURE__ */ Y("div", {
2800
2800
  className: "min-w-0 flex-1",
2801
- children: /* @__PURE__ */ J(Lt, { value: s })
2801
+ children: /* @__PURE__ */ Y(Lt, { value: s })
2802
2802
  })]
2803
2803
  })
2804
2804
  })
@@ -2810,27 +2810,27 @@ function Ht({ values: e, options: t }) {
2810
2810
  //#region src/components/detail-layout/widgets/builtins.ts
2811
2811
  var Ut = !1;
2812
2812
  function Wt() {
2813
- Ut ||= (ne("json_diff", Ht), !0);
2813
+ Ut ||= (te("json_diff", Ht), !0);
2814
2814
  }
2815
2815
  //#endregion
2816
2816
  //#region src/components/detail-layout/widgets/WidgetHost.tsx
2817
2817
  Wt();
2818
2818
  function Gt({ config: e, ctx: t }) {
2819
- let n = re(e.type);
2820
- if (!n) return /* @__PURE__ */ J("span", {
2819
+ let n = ne(e.type);
2820
+ if (!n) return /* @__PURE__ */ Y("span", {
2821
2821
  className: "text-sm text-muted-foreground",
2822
2822
  children: `unknown widget: ${e.type}`
2823
2823
  });
2824
2824
  let r = e.inputs ?? {}, i = t.record, a = {};
2825
2825
  for (let [e, t] of Object.entries(r)) a[e] = i[t];
2826
- return /* @__PURE__ */ J("div", {
2826
+ return /* @__PURE__ */ Y("div", {
2827
2827
  style: {
2828
2828
  minWidth: 0,
2829
2829
  maxWidth: "100%",
2830
2830
  overflowX: "auto",
2831
2831
  WebkitOverflowScrolling: "touch"
2832
2832
  },
2833
- children: /* @__PURE__ */ J(n, {
2833
+ children: /* @__PURE__ */ Y(n, {
2834
2834
  inputs: r,
2835
2835
  values: a,
2836
2836
  record: i,
@@ -2842,41 +2842,41 @@ function Gt({ config: e, ctx: t }) {
2842
2842
  //#endregion
2843
2843
  //#region src/components/detail-layout/LayoutRenderer.tsx
2844
2844
  function Kt({ nodes: e, ctx: t }) {
2845
- return /* @__PURE__ */ J(q, { children: e.map((e, n) => /* @__PURE__ */ J($, {
2845
+ return /* @__PURE__ */ Y(J, { children: e.map((e, n) => /* @__PURE__ */ Y($, {
2846
2846
  node: e,
2847
2847
  ctx: t
2848
2848
  }, n)) });
2849
2849
  }
2850
2850
  function $({ node: e, ctx: t }) {
2851
- return e.row ? /* @__PURE__ */ J(be, {
2851
+ return e.row ? /* @__PURE__ */ Y(ye, {
2852
2852
  config: e.row,
2853
2853
  ctx: t
2854
- }) : e.column ? /* @__PURE__ */ J(Ce, {
2854
+ }) : e.column ? /* @__PURE__ */ Y(Se, {
2855
2855
  config: e.column,
2856
2856
  node: e,
2857
2857
  ctx: t
2858
- }) : e.tabs ? /* @__PURE__ */ J(Te, {
2858
+ }) : e.tabs ? /* @__PURE__ */ Y(Te, {
2859
2859
  config: e.tabs,
2860
2860
  ctx: t
2861
- }) : e.section ? /* @__PURE__ */ J(Ee, {
2861
+ }) : e.section ? /* @__PURE__ */ Y(Ee, {
2862
2862
  config: e.section,
2863
2863
  ctx: t
2864
- }) : e.children ? /* @__PURE__ */ J(mt, {
2864
+ }) : e.children ? /* @__PURE__ */ Y(mt, {
2865
2865
  node: e,
2866
2866
  ctx: t
2867
- }) : e.associated ? /* @__PURE__ */ J(j, {
2867
+ }) : e.associated ? /* @__PURE__ */ Y(j, {
2868
2868
  node: e,
2869
2869
  ctx: t
2870
- }) : e.fields ? /* @__PURE__ */ J(Ct, {
2870
+ }) : e.fields ? /* @__PURE__ */ Y(Ct, {
2871
2871
  fields: e.fields,
2872
2872
  ctx: t
2873
- }) : e.properties == null ? e.statuses == null ? e.widget ? /* @__PURE__ */ J(Gt, {
2873
+ }) : e.properties == null ? e.statuses == null ? e.widget ? /* @__PURE__ */ Y(Gt, {
2874
2874
  config: e.widget,
2875
2875
  ctx: t
2876
- }) : null : /* @__PURE__ */ J(jt, {
2876
+ }) : null : /* @__PURE__ */ Y(jt, {
2877
2877
  node: e,
2878
2878
  ctx: t
2879
- }) : /* @__PURE__ */ J(Et, {
2879
+ }) : /* @__PURE__ */ Y(Et, {
2880
2880
  node: e,
2881
2881
  ctx: t
2882
2882
  });