@declarion/react 0.45.0 → 0.48.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 (47) hide show
  1. package/dist-lib/{DraggableChildrenTable-BDnJK0AU.js → DraggableChildrenTable-p2ZSdwzj.js} +2 -2
  2. package/dist-lib/{DynamicIcon-DeRpAaXm.js → DynamicIcon-Dc2j-rg_.js} +19 -17
  3. package/dist-lib/{Grid-CcCveEE7.js → Grid-CjLFAKMZ.js} +2 -2
  4. package/dist-lib/{LayoutRenderer-BReuhVdX.js → LayoutRenderer-X3p4yfo_.js} +598 -585
  5. package/dist-lib/{MarkdownRenderer-DPKDFR60.js → MarkdownRenderer-Sb7zcvj0.js} +10 -10
  6. package/dist-lib/{RefreshControl-KddgOhUG.js → RefreshControl-Cnl9nE0x.js} +268 -238
  7. package/dist-lib/{SmartDetailPage.impl-D_hMxiHy.js → SmartDetailPage.impl-bb0UNOII.js} +545 -532
  8. package/dist-lib/{SmartRecordListPage.impl-GIo_mPIJ.js → SmartRecordListPage.impl-BFh8auUZ.js} +171 -158
  9. package/dist-lib/api/agents.d.ts +47 -18
  10. package/dist-lib/components/agents/AgentChatPanel.d.ts +7 -1
  11. package/dist-lib/components/agents/AgentPicker.d.ts +9 -0
  12. package/dist-lib/components/agents/transcript-runs.d.ts +29 -0
  13. package/dist-lib/components/file-widgets/host.d.ts +1 -0
  14. package/dist-lib/components/list/QuickPeek.d.ts +1 -1
  15. package/dist-lib/components/pages/list/ListFloatbar.d.ts +4 -2
  16. package/dist-lib/components/pages/list/cardProjection.d.ts +2 -1
  17. package/dist-lib/components/primitives/Tooltip.d.ts +4 -0
  18. package/dist-lib/components/shared/ResponsiveActionBar.d.ts +10 -5
  19. package/dist-lib/components/shared/RowActionsKebab.d.ts +3 -2
  20. package/dist-lib/components/views/ViewSwitcher.d.ts +2 -1
  21. package/dist-lib/declarion-react.css +1 -1
  22. package/dist-lib/hooks/useAgentConversation.d.ts +10 -24
  23. package/dist-lib/hooks/useBrandingChrome.d.ts +11 -0
  24. package/dist-lib/hooks/useFilters.d.ts +1 -0
  25. package/dist-lib/hooks/useLongPress.d.ts +29 -0
  26. package/dist-lib/hooks/useResponsiveMode.d.ts +2 -21
  27. package/dist-lib/icons.js +1 -1
  28. package/dist-lib/index.d.ts +10 -3
  29. package/dist-lib/index.js +3305 -2741
  30. package/dist-lib/lib/actions.d.ts +13 -5
  31. package/dist-lib/lib/filter-evaluator.d.ts +16 -0
  32. package/dist-lib/lib/filters.d.ts +10 -4
  33. package/dist-lib/lib/longPressGesture.d.ts +55 -0
  34. package/dist-lib/lib/messages.d.ts +1 -0
  35. package/dist-lib/lib/page-inset.d.ts +3 -0
  36. package/dist-lib/lib/variants.d.ts +7 -0
  37. package/dist-lib/lib/viewport-category.d.ts +44 -0
  38. package/dist-lib/{registry-DJKp0yaV.js → registry-CWDnxiLJ.js} +1291 -1008
  39. package/dist-lib/testing.js +10 -10
  40. package/dist-lib/types/api.d.ts +15 -2
  41. package/dist-lib/types/schema.d.ts +26 -0
  42. package/dist-lib/{useCurrentScreen-A3xZDs7U.js → useCurrentScreen-BshVTPVq.js} +1124 -1088
  43. package/dist-lib/{useProperties-TlltWwLv.js → useProperties-B5p9mIH8.js} +92 -61
  44. package/dist-lib/{value-CHY7LgZ-.js → value-B1O6QikE.js} +1 -1
  45. package/dist-lib/vite/index.js +23 -22
  46. package/package.json +12 -12
  47. package/dist-lib/components/agents/AgentVisualHints.d.ts +0 -6
@@ -1,17 +1,17 @@
1
- import { s as e, t } from "./DynamicIcon-DeRpAaXm.js";
2
- import { A as n, An as r, Dn as i, En as a, Gt as o, In as s, Kn as c, Ln as l, M as u, Sn as d, Tn as f, X as p, Z as m, Zn as h, _t as g, ar as _, bn as v, cr as y, f as b, j as x, jn as S, kt as C, lr as w, mn as T, rr as E, rt as D, ur as O, vt as k, wn as A, xn as j, yt as M } from "./useCurrentScreen-A3xZDs7U.js";
3
- import { A as ee, F as te, I as N, J as P, L as ne, P as F, R as I, T as L, V as R, at as z, d as B, it as re, mt as ie, o as ae, pt as oe, q as se, r as ce, t as le, u as ue, z as de } from "./registry-DJKp0yaV.js";
4
- import { n as fe, r as pe, t as me } from "./dataTableStyles-vwD1mVOP.js";
5
- import { Suspense as he, createContext as ge, lazy as _e, useCallback as V, useContext as ve, useEffect as H, useId as ye, useLayoutEffect as be, useMemo as U, useRef as W, useState as G } from "react";
6
- import { useInfiniteQuery as xe, useMutation as Se, useQueryClient as Ce } from "@tanstack/react-query";
7
- import { Fragment as K, jsx as q, jsxs as J } from "react/jsx-runtime";
1
+ import { s as e, t } from "./DynamicIcon-Dc2j-rg_.js";
2
+ import { A as n, An as r, Dn as i, En as a, Gt as o, In as s, Kn as c, Ln as l, M as u, Sn as d, Tn as f, X as p, Z as m, Zn as h, _t as g, ar as _, bn as v, cr as y, f as b, j as x, jn as S, kt as C, lr as w, mn as T, rt as E, tr as D, ur as O, vt as k, wn as A, xn as j, yt as M } from "./useCurrentScreen-BshVTPVq.js";
3
+ import { E as ee, G as N, H as P, J as F, K as I, St as L, U as R, V as z, W as te, d as B, et as V, f as ne, ft as re, j as ie, o as ae, pt as oe, r as se, t as ce, tt as le, xt as ue } from "./registry-CWDnxiLJ.js";
4
+ import { n as de, r as fe, t as pe } from "./dataTableStyles-vwD1mVOP.js";
5
+ import { Suspense as me, createContext as he, lazy as ge, useCallback as H, useContext as _e, useEffect as U, useId as ve, useLayoutEffect as ye, useMemo as W, useRef as G, useState as K } from "react";
6
+ import { useInfiniteQuery as be, useMutation as xe, useQueryClient as Se } from "@tanstack/react-query";
7
+ import { Fragment as q, jsx as J, jsxs as Y } from "react/jsx-runtime";
8
8
  //#region src/lib/size-value.ts
9
- var we = /^(\d+)px$/;
10
- function Te(e) {
9
+ var Ce = /^(\d+)px$/;
10
+ function we(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 = we.exec(e);
14
+ let t = Ce.exec(e);
15
15
  if (t) {
16
16
  let e = parseInt(t[1], 10);
17
17
  return e > 0 ? {
@@ -27,9 +27,9 @@ function Te(e) {
27
27
  }
28
28
  //#endregion
29
29
  //#region src/components/detail-layout/LayoutRow.tsx
30
- function Ee({ 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] = G(!1), l = W(null);
32
- H(() => {
30
+ function Te({ 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(() => {
33
33
  if (o === 0) return;
34
34
  let e = l.current;
35
35
  if (!e) return;
@@ -38,10 +38,10 @@ function Ee({ config: e, ctx: t }) {
38
38
  });
39
39
  return t.observe(e), () => t.disconnect();
40
40
  }, [o]);
41
- let [u, d] = G(null), f = W(null), p = V(() => n.map((t) => {
42
- let n = Te(t.width ?? t.column?.width ?? t.row?.width ?? e.width);
41
+ let [u, d] = K(null), f = G(null), p = H(() => n.map((t) => {
42
+ let n = we(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 = V((e, t) => {
44
+ }), [n, e.width]), m = H((e, t) => {
45
45
  t.preventDefault();
46
46
  let n = u ?? p();
47
47
  f.current = {
@@ -58,41 +58,41 @@ function Ee({ 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 ? Oe(e.height) : void 0;
62
- return /* @__PURE__ */ q("div", {
61
+ }, [u, p]), h = u ?? p(), g = e.height ? De(e.height) : void 0;
62
+ return /* @__PURE__ */ J("div", {
63
63
  ref: l,
64
- className: z("flex", s && "flex-col"),
64
+ className: oe("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__ */ J("div", {
70
- className: z("min-w-0 flex items-stretch", s && "w-full"),
71
- style: s ? void 0 : De(r.width ?? r.column?.width ?? r.row?.width ?? e.width, h[a], r.min_width, r.max_width),
72
- children: [/* @__PURE__ */ q("div", {
73
- className: z("flex-1 min-w-0 flex flex-col", g && "overflow-y-auto overflow-x-hidden"),
74
- children: /* @__PURE__ */ q($, {
69
+ children: n.map((r, a) => /* @__PURE__ */ Y("div", {
70
+ className: oe("min-w-0 flex items-stretch", s && "w-full"),
71
+ style: s ? void 0 : Ee(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: oe("flex-1 min-w-0 flex flex-col", g && "overflow-y-auto overflow-x-hidden"),
74
+ children: /* @__PURE__ */ J($, {
75
75
  node: r,
76
76
  ctx: t
77
77
  })
78
- }), i && !s && a < n.length - 1 && /* @__PURE__ */ q("div", {
78
+ }), i && !s && a < n.length - 1 && /* @__PURE__ */ J("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 De(e, t, n, r) {
86
- let i = Te(e), a;
85
+ function Ee(e, t, n, r) {
86
+ let i = we(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 Oe(e) {
93
+ function De(e) {
94
94
  if (!e) return;
95
- let t = Te(e);
95
+ let t = we(e);
96
96
  if (t?.kind === "px") return {
97
97
  height: `${t.value}px`,
98
98
  overflow: "hidden"
@@ -104,12 +104,12 @@ function Oe(e) {
104
104
  }
105
105
  //#endregion
106
106
  //#region src/components/detail-layout/LayoutColumn.tsx
107
- function ke({ config: e, ctx: t }) {
107
+ function Oe({ config: e, ctx: t }) {
108
108
  let { items: n, gap: r = 12 } = e;
109
- return /* @__PURE__ */ q("div", {
109
+ return /* @__PURE__ */ J("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__ */ q($, {
112
+ children: n.map((e, n) => /* @__PURE__ */ J($, {
113
113
  node: e,
114
114
  ctx: t
115
115
  }, n))
@@ -117,11 +117,11 @@ function ke({ config: e, ctx: t }) {
117
117
  }
118
118
  //#endregion
119
119
  //#region src/components/detail-layout/blockMeta.ts
120
- function Ae(e) {
120
+ function ke(e) {
121
121
  return e.children ?? e.associated;
122
122
  }
123
- function je(e, t) {
124
- let n = Ae(e);
123
+ function Ae(e, t) {
124
+ let n = ke(e);
125
125
  if (n) {
126
126
  if (e.label) return f(e.label);
127
127
  let r = t.entity.children?.find((e) => e.entity === n);
@@ -131,9 +131,9 @@ function je(e, t) {
131
131
  }
132
132
  return e.section ? f(e.section.name) : "Tab";
133
133
  }
134
- function Y(e, t) {
134
+ function je(e, t) {
135
135
  if (e.icon) return e.icon;
136
- let n = Ae(e);
136
+ let n = ke(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 Y(e, t) {
144
144
  //#endregion
145
145
  //#region src/components/detail-layout/LayoutTabs.tsx
146
146
  function Me({ config: e, ctx: n }) {
147
- let { items: r } = e, [i, a] = G(0), o = E(), s = n.detailTabsPresentation ?? (o.isPhone ? "sections" : "scroll");
147
+ let { items: r } = e, [i, a] = K(0), o = D(), s = n.detailTabsPresentation ?? (o.isPhone ? "sections" : "scroll");
148
148
  if (r.length === 0) return null;
149
149
  if (s === "sections") {
150
150
  let e = r.map((e, t) => `detail-tab-section-${t}`);
151
- return /* @__PURE__ */ J("div", {
151
+ return /* @__PURE__ */ Y("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__ */ q("nav", {
158
+ children: [r.length > 1 && /* @__PURE__ */ J("nav", {
159
159
  "aria-label": "Detail sections",
160
160
  style: {
161
161
  display: "flex",
@@ -165,8 +165,8 @@ function Me({ config: e, ctx: n }) {
165
165
  WebkitOverflowScrolling: "touch"
166
166
  },
167
167
  children: r.map((r, i) => {
168
- let a = je(r, n), o = Y(r, n);
169
- return /* @__PURE__ */ J("button", {
168
+ let a = Ae(r, n), o = je(r, n);
169
+ return /* @__PURE__ */ Y("button", {
170
170
  type: "button",
171
171
  onClick: () => document.getElementById(e[i])?.scrollIntoView({
172
172
  block: "start",
@@ -188,10 +188,10 @@ function Me({ config: e, ctx: n }) {
188
188
  whiteSpace: "nowrap",
189
189
  cursor: "pointer"
190
190
  },
191
- children: [o && /* @__PURE__ */ q(t, {
191
+ children: [o && /* @__PURE__ */ J(t, {
192
192
  name: o,
193
193
  size: 13
194
- }), /* @__PURE__ */ q("span", {
194
+ }), /* @__PURE__ */ J("span", {
195
195
  style: {
196
196
  overflow: "hidden",
197
197
  textOverflow: "ellipsis"
@@ -201,8 +201,8 @@ function Me({ config: e, ctx: n }) {
201
201
  }, i);
202
202
  })
203
203
  }), r.map((r, i) => {
204
- let a = je(r, n), o = Y(r, n);
205
- return /* @__PURE__ */ J("section", {
204
+ let a = Ae(r, n), o = je(r, n);
205
+ return /* @__PURE__ */ Y("section", {
206
206
  id: e[i],
207
207
  style: {
208
208
  background: "var(--surface)",
@@ -213,7 +213,7 @@ function Me({ config: e, ctx: n }) {
213
213
  minWidth: 0,
214
214
  scrollMarginTop: 12
215
215
  },
216
- children: [/* @__PURE__ */ J("div", {
216
+ children: [/* @__PURE__ */ Y("div", {
217
217
  style: {
218
218
  display: "flex",
219
219
  alignItems: "center",
@@ -224,19 +224,19 @@ function Me({ config: e, ctx: n }) {
224
224
  fontSize: 13,
225
225
  fontWeight: 700
226
226
  },
227
- children: [o && /* @__PURE__ */ q(t, {
227
+ children: [o && /* @__PURE__ */ J(t, {
228
228
  name: o,
229
229
  size: 14
230
- }), /* @__PURE__ */ q("span", {
230
+ }), /* @__PURE__ */ J("span", {
231
231
  style: { overflowWrap: "anywhere" },
232
232
  children: a
233
233
  })]
234
- }), /* @__PURE__ */ q("div", {
234
+ }), /* @__PURE__ */ J("div", {
235
235
  style: {
236
236
  padding: 14,
237
237
  minWidth: 0
238
238
  },
239
- children: /* @__PURE__ */ q($, {
239
+ children: /* @__PURE__ */ J($, {
240
240
  node: r,
241
241
  ctx: {
242
242
  ...n,
@@ -248,7 +248,7 @@ function Me({ config: e, ctx: n }) {
248
248
  })]
249
249
  });
250
250
  }
251
- return /* @__PURE__ */ J("div", {
251
+ return /* @__PURE__ */ Y("div", {
252
252
  style: {
253
253
  background: "var(--surface)",
254
254
  border: "1px solid var(--border)",
@@ -257,7 +257,7 @@ function Me({ config: e, ctx: n }) {
257
257
  boxShadow: "var(--shadow-xs)",
258
258
  flexShrink: 0
259
259
  },
260
- children: [/* @__PURE__ */ q("div", {
260
+ children: [/* @__PURE__ */ J("div", {
261
261
  role: "tablist",
262
262
  style: {
263
263
  display: "flex",
@@ -268,8 +268,8 @@ function Me({ config: e, ctx: n }) {
268
268
  overflowX: "auto"
269
269
  },
270
270
  children: r.map((e, r) => {
271
- let o = je(e, n), s = Y(e, n), c = r === i;
272
- return /* @__PURE__ */ J("button", {
271
+ let o = Ae(e, n), s = je(e, n), c = r === i;
272
+ return /* @__PURE__ */ Y("button", {
273
273
  role: "tab",
274
274
  "aria-selected": c,
275
275
  onClick: (e) => {
@@ -298,12 +298,12 @@ function Me({ config: e, ctx: n }) {
298
298
  c || (e.currentTarget.style.color = "var(--text-3)");
299
299
  },
300
300
  children: [
301
- s && /* @__PURE__ */ q(t, {
301
+ s && /* @__PURE__ */ J(t, {
302
302
  name: s,
303
303
  size: 13
304
304
  }),
305
305
  o,
306
- c && /* @__PURE__ */ q("span", { style: {
306
+ c && /* @__PURE__ */ J("span", { style: {
307
307
  position: "absolute",
308
308
  left: 4,
309
309
  right: 4,
@@ -315,10 +315,10 @@ function Me({ config: e, ctx: n }) {
315
315
  ]
316
316
  }, r);
317
317
  })
318
- }), /* @__PURE__ */ q("div", {
318
+ }), /* @__PURE__ */ J("div", {
319
319
  role: "tabpanel",
320
320
  style: { padding: 14 },
321
- children: /* @__PURE__ */ q($, {
321
+ children: /* @__PURE__ */ J($, {
322
322
  node: r[i],
323
323
  ctx: {
324
324
  ...n,
@@ -335,7 +335,7 @@ function Ne({ config: e, ctx: n }) {
335
335
  ...n,
336
336
  withinCard: !0,
337
337
  ...o ? { columns: o } : null
338
- }, d = s ? /* @__PURE__ */ q(t, {
338
+ }, d = s ? /* @__PURE__ */ J(t, {
339
339
  name: s,
340
340
  size: 14
341
341
  }) : void 0, p = c ? {
@@ -343,14 +343,14 @@ function Ne({ config: e, ctx: n }) {
343
343
  tone: c.tone,
344
344
  dot: c.dot
345
345
  } : void 0;
346
- return /* @__PURE__ */ q(ie, {
346
+ return /* @__PURE__ */ J(L, {
347
347
  title: f(r),
348
348
  defaultOpen: !a,
349
349
  icon: d,
350
350
  badge: p,
351
351
  emphasis: l,
352
352
  headingLevel: n.withinCard ? 3 : 2,
353
- children: /* @__PURE__ */ q(hn, {
353
+ children: /* @__PURE__ */ J(gn, {
354
354
  nodes: i,
355
355
  ctx: u
356
356
  })
@@ -489,26 +489,26 @@ function Je(e, t) {
489
489
  //#endregion
490
490
  //#region src/components/detail-layout/useQuickAdd.ts
491
491
  function Ye(e, t, n, r) {
492
- let [i, o] = G(() => {
492
+ let [i, o] = K(() => {
493
493
  let t = e.quick_add, n = r.entities[e.entity], i = {};
494
494
  if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (i[e] = s()) : i[e] = t.defaults[e];
495
495
  return i;
496
- }), c = Ce(), { mutate: l, isPending: u, error: d, reset: f } = Se({
496
+ }), c = Se(), { mutate: l, isPending: u, error: d, reset: f } = xe({
497
497
  mutationFn: (t) => g(e.entity, t),
498
498
  onMutate: async (r) => {
499
- let i = [
500
- ne,
499
+ let i = Array.isArray(n) ? a(n.map(String)) : n, o = [
500
+ te,
501
501
  t,
502
- Array.isArray(n) ? a(n.map(String)) : n,
502
+ i,
503
503
  e.entity
504
504
  ];
505
- await c.cancelQueries({ queryKey: i });
506
- let o = c.getQueriesData({ queryKey: i }), s = {
505
+ await c.cancelQueries({ queryKey: o });
506
+ let s = c.getQueriesData({ queryKey: o }), l = {
507
507
  ...r,
508
508
  id: `__optimistic_${crypto.randomUUID()}`,
509
509
  __optimistic: !0
510
510
  };
511
- return c.setQueriesData({ queryKey: i }, (e) => {
511
+ return c.setQueriesData({ queryKey: o }, (e) => {
512
512
  if (!e || typeof e != "object") return e;
513
513
  if ("pages" in e && Array.isArray(e.pages) && e.pages.length > 0) {
514
514
  let t = e, [n, ...r] = t.pages;
@@ -516,25 +516,25 @@ function Ye(e, t, n, r) {
516
516
  ...t,
517
517
  pages: [{
518
518
  ...n,
519
- data: [s, ...n.data]
519
+ data: [l, ...n.data]
520
520
  }, ...r]
521
521
  };
522
522
  }
523
523
  return e;
524
- }), { snapshots: o };
524
+ }), { snapshots: s };
525
525
  },
526
526
  onError: (e, t, n) => {
527
527
  if (n?.snapshots) for (let [e, t] of n.snapshots) c.setQueryData(e, t);
528
528
  },
529
529
  onSuccess: () => {
530
530
  let t = e.quick_add, n = r.entities[e.entity], i = {};
531
- if (t?.fields) for (let e of t.fields) t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? i[e] = s() : i[e] = "" : i[e] = t.defaults[e];
531
+ if (t?.fields) for (let e of t.fields) i[e] = t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? s() : "" : t.defaults[e];
532
532
  o(i);
533
533
  },
534
534
  onSettled: () => {
535
535
  let r = Array.isArray(n) ? a(n.map(String)) : n;
536
536
  c.invalidateQueries({ queryKey: [
537
- ne,
537
+ te,
538
538
  t,
539
539
  r,
540
540
  e.entity
@@ -566,8 +566,8 @@ function Ye(e, t, n, r) {
566
566
  //#endregion
567
567
  //#region src/components/detail-layout/QuickAddForm.tsx
568
568
  function Xe({ config: t, parentEntity: r, parentId: i, schema: a }) {
569
- let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: f, handleSubmit: p, handleFieldChange: m } = Ye(t, r, i, a), h = n(), g = E(), _ = ye();
570
- return !s || s.fields.length === 0 || !c ? null : /* @__PURE__ */ J("form", {
569
+ let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: f, handleSubmit: p, handleFieldChange: m } = Ye(t, r, i, a), h = n(), g = D(), _ = ve();
570
+ return !s || s.fields.length === 0 || !c ? null : /* @__PURE__ */ Y("form", {
571
571
  onSubmit: p,
572
572
  style: {
573
573
  display: "flex",
@@ -582,13 +582,13 @@ function Xe({ config: t, parentEntity: r, parentId: i, schema: a }) {
582
582
  let n = c.fields.get(e);
583
583
  if (!n) return null;
584
584
  let r = `${_}-quick-add-${t.entity}-${e}`, i = `${r}-label`;
585
- return /* @__PURE__ */ J("div", {
585
+ return /* @__PURE__ */ Y("div", {
586
586
  style: {
587
587
  flex: 1,
588
588
  minWidth: 0,
589
589
  width: g.isPhone ? "100%" : void 0
590
590
  },
591
- children: [/* @__PURE__ */ q("label", {
591
+ children: [/* @__PURE__ */ J("label", {
592
592
  id: i,
593
593
  htmlFor: r,
594
594
  style: {
@@ -612,16 +612,16 @@ function Xe({ config: t, parentEntity: r, parentId: i, schema: a }) {
612
612
  })]
613
613
  }, e);
614
614
  }),
615
- /* @__PURE__ */ q(O, {
615
+ /* @__PURE__ */ J(O, {
616
616
  type: "submit",
617
617
  kind: "primary",
618
618
  size: g.isPhone ? "md" : "sm",
619
- icon: /* @__PURE__ */ q(e.plus, { size: 12 }),
619
+ icon: /* @__PURE__ */ J(e.plus, { size: 12 }),
620
620
  disabled: l || !f,
621
621
  style: g.isPhone ? { alignSelf: "flex-end" } : void 0,
622
622
  children: "Add"
623
623
  }),
624
- u != null && /* @__PURE__ */ q("span", {
624
+ u != null && /* @__PURE__ */ J("span", {
625
625
  style: {
626
626
  fontSize: 11,
627
627
  color: "var(--danger)",
@@ -639,11 +639,11 @@ function Ze(e, t, n) {
639
639
  return `${e}::child::${t}.${n}`;
640
640
  }
641
641
  function Qe(e) {
642
- return Math.min(de, Math.max(60, Math.round(e)));
642
+ return Math.min(I, Math.max(60, Math.round(e)));
643
643
  }
644
644
  function $e(e) {
645
- let { widths: t, setWidths: n, resetWidths: r } = R(e), [i, a] = G({}), o = W(null);
646
- H(() => {
645
+ let { widths: t, setWidths: n, resetWidths: r } = F(e), [i, a] = K({}), o = G(null);
646
+ U(() => {
647
647
  let e = (e) => {
648
648
  let t = o.current;
649
649
  if (!t) return;
@@ -657,7 +657,7 @@ function $e(e) {
657
657
  window.removeEventListener("mousemove", e), window.removeEventListener("mouseup", t);
658
658
  };
659
659
  }, [n]);
660
- let s = V((e, n) => {
660
+ let s = H((e, n) => {
661
661
  n.preventDefault(), n.stopPropagation();
662
662
  let r = n.currentTarget.closest("th")?.getBoundingClientRect().width, i = t[e] ?? (r && r > 0 ? r : 150);
663
663
  o.current = {
@@ -668,7 +668,7 @@ function $e(e) {
668
668
  };
669
669
  }, [t]);
670
670
  return {
671
- headerStyle: V((e, n) => {
671
+ headerStyle: H((e, n) => {
672
672
  let r = i[e] ?? t[e];
673
673
  return r == null ? {
674
674
  ...n,
@@ -681,7 +681,7 @@ function $e(e) {
681
681
  maxWidth: r
682
682
  };
683
683
  }, [i, t]),
684
- cellStyle: V((e, n) => {
684
+ cellStyle: H((e, n) => {
685
685
  let r = i[e] ?? t[e];
686
686
  return r == null ? n : {
687
687
  ...n,
@@ -698,7 +698,7 @@ function $e(e) {
698
698
  };
699
699
  }
700
700
  function et({ colId: e, onMouseDown: t }) {
701
- return /* @__PURE__ */ q("span", {
701
+ return /* @__PURE__ */ J("span", {
702
702
  "data-testid": "col-resize-handle",
703
703
  "aria-hidden": "true",
704
704
  onMouseDown: (n) => t(e, n),
@@ -714,7 +714,7 @@ function et({ colId: e, onMouseDown: t }) {
714
714
  cursor: "col-resize",
715
715
  userSelect: "none"
716
716
  },
717
- children: /* @__PURE__ */ q("span", { style: {
717
+ children: /* @__PURE__ */ J("span", { style: {
718
718
  width: 2,
719
719
  height: "55%",
720
720
  alignSelf: "center",
@@ -726,9 +726,9 @@ function et({ colId: e, onMouseDown: t }) {
726
726
  //#endregion
727
727
  //#region src/components/detail-layout/ChildrenTable.tsx
728
728
  function tt({ config: t, parentEntity: r, parentId: i, schema: a }) {
729
- let o = a.entities[t.entity], s = Array.isArray(t.foreign_key) ? t.foreign_key.join(",") : t.foreign_key, c = $e(Ze(r, t.entity, s)), f = n(), p = N((e) => e.degradedEntities), { data: m, isLoading: g, isError: _, isFetching: v, refetch: b } = I(r, i, t.entity, t.foreign_key, t.sort, t.limit), x = m?.data ?? [], C = m?.$refs, T = W(C);
729
+ let o = a.entities[t.entity], s = Array.isArray(t.foreign_key) ? t.foreign_key.join(",") : t.foreign_key, c = $e(Ze(r, t.entity, s)), f = n(), p = R((e) => e.degradedEntities), { data: m, isLoading: g, isError: _, isFetching: v, refetch: b } = N(r, i, t.entity, t.foreign_key, t.sort, t.limit), x = m?.data ?? [], C = m?.$refs, T = G(C);
730
730
  T.current = C;
731
- let E = t.columns, D = t.interaction === "navigate", O = E[0], k = D && o ? S(void 0, o, a.screens) : null, A = o ? Ge(o) : void 0, j = U(() => {
731
+ let E = t.columns, D = t.interaction === "navigate", O = E[0], k = D && o ? S(void 0, o, a.screens) : null, A = o ? Ge(o) : void 0, j = W(() => {
732
732
  let e = /* @__PURE__ */ new Map();
733
733
  if (!o) return e;
734
734
  for (let t of E) {
@@ -752,7 +752,7 @@ function tt({ config: t, parentEntity: r, parentId: i, schema: a }) {
752
752
  a.screens,
753
753
  f
754
754
  ]);
755
- if (!o) return /* @__PURE__ */ q("div", {
755
+ if (!o) return /* @__PURE__ */ J("div", {
756
756
  style: {
757
757
  fontSize: 12.5,
758
758
  color: "var(--text-3)",
@@ -760,12 +760,12 @@ function tt({ config: t, parentEntity: r, parentId: i, schema: a }) {
760
760
  },
761
761
  children: "Entity not found."
762
762
  });
763
- let M = /* @__PURE__ */ q(Xe, {
763
+ let M = /* @__PURE__ */ J(Xe, {
764
764
  config: t,
765
765
  parentEntity: r,
766
766
  parentId: i,
767
767
  schema: a
768
- }), ee = te(o.realtime, p, t.entity), P = /* @__PURE__ */ J("div", {
768
+ }), ee = P(o.realtime, p, t.entity), F = /* @__PURE__ */ Y("div", {
769
769
  style: {
770
770
  display: "flex",
771
771
  alignItems: "center",
@@ -774,28 +774,28 @@ function tt({ config: t, parentEntity: r, parentId: i, schema: a }) {
774
774
  justifyContent: "flex-end"
775
775
  },
776
776
  children: [
777
- c.hasWidths && /* @__PURE__ */ q(w, {
778
- icon: /* @__PURE__ */ q(e.columns, { size: 13 }),
777
+ c.hasWidths && /* @__PURE__ */ J(w, {
778
+ icon: /* @__PURE__ */ J(e.columns, { size: 13 }),
779
779
  title: "Reset column widths (this device)",
780
780
  size: 24,
781
781
  onClick: c.resetWidths
782
782
  }),
783
- ee && /* @__PURE__ */ q("span", {
783
+ ee && /* @__PURE__ */ J("span", {
784
784
  "data-testid": "children-live-indicator",
785
785
  title: "This table updates automatically in realtime.",
786
- children: /* @__PURE__ */ q(y, {
786
+ children: /* @__PURE__ */ J(y, {
787
787
  tone: "emerald",
788
788
  size: "xs",
789
789
  dot: !0,
790
790
  children: "Live"
791
791
  })
792
792
  }),
793
- /* @__PURE__ */ q(w, {
794
- icon: v ? /* @__PURE__ */ q("span", {
793
+ /* @__PURE__ */ J(w, {
794
+ icon: v ? /* @__PURE__ */ J("span", {
795
795
  "data-testid": "children-refresh-spinner",
796
796
  style: { display: "inline-flex" },
797
- children: /* @__PURE__ */ q(h, { size: 13 })
798
- }) : /* @__PURE__ */ q(e.refresh, { size: 13 }),
797
+ children: /* @__PURE__ */ J(h, { size: 13 })
798
+ }) : /* @__PURE__ */ J(e.refresh, { size: 13 }),
799
799
  title: "Refresh",
800
800
  size: 24,
801
801
  disabled: v,
@@ -805,10 +805,10 @@ function tt({ config: t, parentEntity: r, parentId: i, schema: a }) {
805
805
  })
806
806
  ]
807
807
  });
808
- return _ ? /* @__PURE__ */ J("div", { children: [
808
+ return _ ? /* @__PURE__ */ Y("div", { children: [
809
809
  M,
810
- P,
811
- /* @__PURE__ */ q("div", {
810
+ F,
811
+ /* @__PURE__ */ J("div", {
812
812
  style: {
813
813
  fontSize: 12.5,
814
814
  color: "var(--danger)",
@@ -816,10 +816,10 @@ function tt({ config: t, parentEntity: r, parentId: i, schema: a }) {
816
816
  },
817
817
  children: "Failed to load. Try again."
818
818
  })
819
- ] }) : g ? /* @__PURE__ */ J("div", { children: [
819
+ ] }) : g ? /* @__PURE__ */ Y("div", { children: [
820
820
  M,
821
- P,
822
- /* @__PURE__ */ q("div", {
821
+ F,
822
+ /* @__PURE__ */ J("div", {
823
823
  style: {
824
824
  display: "flex",
825
825
  flexDirection: "column",
@@ -830,16 +830,16 @@ function tt({ config: t, parentEntity: r, parentId: i, schema: a }) {
830
830
  0,
831
831
  1,
832
832
  2
833
- ].map((e) => /* @__PURE__ */ q("div", { style: {
833
+ ].map((e) => /* @__PURE__ */ J("div", { style: {
834
834
  height: 32,
835
835
  background: "var(--surface-3)",
836
836
  borderRadius: 4
837
837
  } }, e))
838
838
  })
839
- ] }) : x.length === 0 ? /* @__PURE__ */ J("div", { children: [
839
+ ] }) : x.length === 0 ? /* @__PURE__ */ Y("div", { children: [
840
840
  M,
841
- P,
842
- /* @__PURE__ */ q("div", {
841
+ F,
842
+ /* @__PURE__ */ J("div", {
843
843
  style: {
844
844
  fontSize: 12.5,
845
845
  color: "var(--text-3)",
@@ -847,30 +847,30 @@ function tt({ config: t, parentEntity: r, parentId: i, schema: a }) {
847
847
  },
848
848
  children: "No records yet."
849
849
  })
850
- ] }) : /* @__PURE__ */ J("div", { children: [
850
+ ] }) : /* @__PURE__ */ Y("div", { children: [
851
851
  M,
852
- P,
853
- /* @__PURE__ */ q("div", {
852
+ F,
853
+ /* @__PURE__ */ J("div", {
854
854
  style: { overflowX: "auto" },
855
- children: /* @__PURE__ */ J("table", {
856
- style: pe,
857
- children: [/* @__PURE__ */ q("thead", { children: /* @__PURE__ */ q("tr", { children: E.map((e) => {
855
+ children: /* @__PURE__ */ Y("table", {
856
+ style: fe,
857
+ children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ J("tr", { children: E.map((e) => {
858
858
  let t = o.fields.get(e);
859
- return /* @__PURE__ */ J("th", {
860
- style: c.headerStyle(e, fe),
861
- children: [t ? d(t, e, a.entities) : e, /* @__PURE__ */ q(et, {
859
+ return /* @__PURE__ */ Y("th", {
860
+ style: c.headerStyle(e, de),
861
+ children: [t ? d(t, e, a.entities) : e, /* @__PURE__ */ J(et, {
862
862
  colId: e,
863
863
  onMouseDown: c.onHandleMouseDown
864
864
  })]
865
865
  }, e);
866
- }) }) }), /* @__PURE__ */ q("tbody", { children: x.map((e, t) => {
866
+ }) }) }), /* @__PURE__ */ J("tbody", { children: x.map((e, t) => {
867
867
  let n = A ? l(e[A]) : "", r = D && k && n ? k.replace(/:\w+/, n) : void 0;
868
- return /* @__PURE__ */ q("tr", { children: E.map((t) => {
868
+ return /* @__PURE__ */ J("tr", { children: E.map((t) => {
869
869
  let n = t === O, i = j.get(t), a = i ? i(e[t], e) : l(e[t]);
870
- return /* @__PURE__ */ q("td", {
870
+ return /* @__PURE__ */ J("td", {
871
871
  title: typeof a == "string" ? a : void 0,
872
- style: c.cellStyle(t, me),
873
- children: n && r ? /* @__PURE__ */ q("a", {
872
+ style: c.cellStyle(t, pe),
873
+ children: n && r ? /* @__PURE__ */ J("a", {
874
874
  href: r,
875
875
  style: {
876
876
  color: "var(--accent)",
@@ -891,8 +891,8 @@ function tt({ config: t, parentEntity: r, parentId: i, schema: a }) {
891
891
  //#endregion
892
892
  //#region src/components/detail-layout/ChildrenList.tsx
893
893
  function nt({ config: e, parentEntity: t, parentId: r, schema: i }) {
894
- let a = i.entities[e.entity], o = n(), { data: s, isLoading: c, isError: u } = I(t, r, e.entity, e.foreign_key, e.sort, e.limit), d = s?.data ?? [], f = s?.$refs, p = e.columns;
895
- if (!a) return /* @__PURE__ */ q("div", {
894
+ let a = i.entities[e.entity], o = n(), { data: s, isLoading: c, isError: u } = N(t, r, e.entity, e.foreign_key, e.sort, e.limit), d = s?.data ?? [], f = s?.$refs, p = e.columns;
895
+ if (!a) return /* @__PURE__ */ J("div", {
896
896
  style: {
897
897
  fontSize: 12.5,
898
898
  color: "var(--text-3)",
@@ -900,13 +900,13 @@ function nt({ config: e, parentEntity: t, parentId: r, schema: i }) {
900
900
  },
901
901
  children: "Entity not found."
902
902
  });
903
- let m = /* @__PURE__ */ q(Xe, {
903
+ let m = /* @__PURE__ */ J(Xe, {
904
904
  config: e,
905
905
  parentEntity: t,
906
906
  parentId: r,
907
907
  schema: i
908
908
  });
909
- if (u) return /* @__PURE__ */ J("div", { children: [m, /* @__PURE__ */ q("div", {
909
+ if (u) return /* @__PURE__ */ Y("div", { children: [m, /* @__PURE__ */ J("div", {
910
910
  style: {
911
911
  fontSize: 12.5,
912
912
  color: "var(--danger)",
@@ -914,7 +914,7 @@ function nt({ config: e, parentEntity: t, parentId: r, schema: i }) {
914
914
  },
915
915
  children: "Failed to load. Try again."
916
916
  })] });
917
- if (c) return /* @__PURE__ */ J("div", { children: [m, /* @__PURE__ */ J("div", {
917
+ if (c) return /* @__PURE__ */ Y("div", { children: [m, /* @__PURE__ */ Y("div", {
918
918
  style: {
919
919
  display: "flex",
920
920
  flexDirection: "column",
@@ -922,17 +922,17 @@ function nt({ config: e, parentEntity: t, parentId: r, schema: i }) {
922
922
  padding: "8px 0"
923
923
  },
924
924
  children: [
925
- /* @__PURE__ */ q("div", { style: {
925
+ /* @__PURE__ */ J("div", { style: {
926
926
  height: 22,
927
927
  background: "var(--surface-3)",
928
928
  borderRadius: 4
929
929
  } }),
930
- /* @__PURE__ */ q("div", { style: {
930
+ /* @__PURE__ */ J("div", { style: {
931
931
  height: 22,
932
932
  background: "var(--surface-3)",
933
933
  borderRadius: 4
934
934
  } }),
935
- /* @__PURE__ */ q("div", { style: {
935
+ /* @__PURE__ */ J("div", { style: {
936
936
  height: 22,
937
937
  background: "var(--surface-3)",
938
938
  borderRadius: 4,
@@ -940,7 +940,7 @@ function nt({ config: e, parentEntity: t, parentId: r, schema: i }) {
940
940
  } })
941
941
  ]
942
942
  })] });
943
- if (d.length === 0) return /* @__PURE__ */ J("div", { children: [m, /* @__PURE__ */ q("div", {
943
+ if (d.length === 0) return /* @__PURE__ */ Y("div", { children: [m, /* @__PURE__ */ J("div", {
944
944
  style: {
945
945
  fontSize: 12.5,
946
946
  color: "var(--text-3)",
@@ -949,70 +949,73 @@ function nt({ config: e, parentEntity: t, parentId: r, schema: i }) {
949
949
  children: "No records yet."
950
950
  })] });
951
951
  let h = p.length > 0 ? a.display.display_field ?? p[0] : a.display.display_field;
952
- return /* @__PURE__ */ J("div", { children: [m, /* @__PURE__ */ q("div", {
952
+ return /* @__PURE__ */ Y("div", { children: [m, /* @__PURE__ */ J("div", {
953
953
  style: {
954
954
  display: "flex",
955
955
  flexDirection: "column"
956
956
  },
957
- children: d.map((e, t) => /* @__PURE__ */ q("div", {
958
- style: {
959
- display: "flex",
960
- alignItems: "center",
961
- gap: 12,
962
- padding: "8px 4px",
963
- borderBottom: "1px solid var(--divider)"
964
- },
965
- children: /* @__PURE__ */ J("div", {
957
+ children: d.map((e, t) => {
958
+ let n = typeof e.$display == "string" ? e[T] : "";
959
+ return /* @__PURE__ */ J("div", {
966
960
  style: {
967
- flex: 1,
968
- minWidth: 0
961
+ display: "flex",
962
+ alignItems: "center",
963
+ gap: 12,
964
+ padding: "8px 4px",
965
+ borderBottom: "1px solid var(--divider)"
969
966
  },
970
- children: [/* @__PURE__ */ q("div", {
967
+ children: /* @__PURE__ */ Y("div", {
971
968
  style: {
972
- fontSize: 12.5,
973
- overflow: "hidden",
974
- textOverflow: "ellipsis",
975
- whiteSpace: "nowrap"
969
+ flex: 1,
970
+ minWidth: 0
976
971
  },
977
- children: (typeof e.$display == "string" ? e[T] : "") || (h && a.fields.get(h) ? x({
978
- field: a.fields.get(h),
979
- fieldName: h,
980
- value: e[h],
981
- mode: "display",
982
- record: e,
983
- refs: f,
984
- locale: o
985
- }) : h && e[h] != null ? l(e[h]) : null)
986
- }), p.length > 1 && (() => {
987
- let t = p.slice(1, 3).filter((t) => e[t] != null);
988
- return t.length === 0 ? null : /* @__PURE__ */ q("div", {
972
+ children: [/* @__PURE__ */ J("div", {
989
973
  style: {
990
- fontSize: 11.5,
991
- color: "var(--text-3)",
974
+ fontSize: 12.5,
992
975
  overflow: "hidden",
993
976
  textOverflow: "ellipsis",
994
977
  whiteSpace: "nowrap"
995
978
  },
996
- children: t.map((t, n) => /* @__PURE__ */ J("span", { children: [n > 0 && " · ", a.fields.get(t) ? x({
997
- field: a.fields.get(t),
998
- fieldName: t,
999
- value: e[t],
979
+ children: n || (h && a.fields.get(h) ? x({
980
+ field: a.fields.get(h),
981
+ fieldName: h,
982
+ value: e[h],
1000
983
  mode: "display",
1001
984
  record: e,
1002
985
  refs: f,
1003
986
  locale: o
1004
- }) : String(e[t])] }, t))
1005
- });
1006
- })()]
1007
- })
1008
- }, l(e.id ?? t)))
987
+ }) : h && e[h] != null ? l(e[h]) : null)
988
+ }), p.length > 1 && (() => {
989
+ let t = p.slice(1, 3).filter((t) => e[t] != null);
990
+ return t.length === 0 ? null : /* @__PURE__ */ J("div", {
991
+ style: {
992
+ fontSize: 11.5,
993
+ color: "var(--text-3)",
994
+ overflow: "hidden",
995
+ textOverflow: "ellipsis",
996
+ whiteSpace: "nowrap"
997
+ },
998
+ children: t.map((t, n) => /* @__PURE__ */ Y("span", { children: [n > 0 && " · ", a.fields.get(t) ? x({
999
+ field: a.fields.get(t),
1000
+ fieldName: t,
1001
+ value: e[t],
1002
+ mode: "display",
1003
+ record: e,
1004
+ refs: f,
1005
+ locale: o
1006
+ }) : String(e[t])] }, t))
1007
+ });
1008
+ })()]
1009
+ })
1010
+ }, l(e.id ?? t));
1011
+ })
1009
1012
  })] });
1010
1013
  }
1011
1014
  //#endregion
1012
1015
  //#region src/components/detail-layout/ChildrenCards.tsx
1013
1016
  function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1014
- let a = i.entities[e.entity], o = n(), { data: s, isLoading: c, isError: u } = I(t, r, e.entity, e.foreign_key, e.sort, e.limit), d = s?.data ?? [], f = s?.$refs, p = e.columns, m = e.cards, h = m?.header_field ?? p[0], g = m?.badge_field, _ = m?.columns_count ?? 3;
1015
- if (!a) return /* @__PURE__ */ q("div", {
1017
+ let a = i.entities[e.entity], o = n(), { data: s, isLoading: c, isError: u } = N(t, r, e.entity, e.foreign_key, e.sort, e.limit), d = s?.data ?? [], f = s?.$refs, p = e.columns, m = e.cards, h = m?.header_field ?? p[0], g = m?.badge_field, _ = m?.columns_count ?? 3;
1018
+ if (!a) return /* @__PURE__ */ J("div", {
1016
1019
  style: {
1017
1020
  fontSize: 12.5,
1018
1021
  color: "var(--text-3)",
@@ -1024,13 +1027,13 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1024
1027
  display: "grid",
1025
1028
  gridTemplateColumns: `repeat(auto-fill, minmax(${_ >= 4 ? 180 : 240}px, 1fr))`,
1026
1029
  gap: 12
1027
- }, b = /* @__PURE__ */ q(Xe, {
1030
+ }, b = /* @__PURE__ */ J(Xe, {
1028
1031
  config: e,
1029
1032
  parentEntity: t,
1030
1033
  parentId: r,
1031
1034
  schema: i
1032
1035
  });
1033
- if (u) return /* @__PURE__ */ J("div", { children: [b, /* @__PURE__ */ q("div", {
1036
+ if (u) return /* @__PURE__ */ Y("div", { children: [b, /* @__PURE__ */ J("div", {
1034
1037
  style: {
1035
1038
  fontSize: 12.5,
1036
1039
  color: "var(--danger)",
@@ -1038,19 +1041,19 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1038
1041
  },
1039
1042
  children: "Failed to load. Try again."
1040
1043
  })] });
1041
- if (c) return /* @__PURE__ */ J("div", { children: [b, /* @__PURE__ */ q("div", {
1044
+ if (c) return /* @__PURE__ */ Y("div", { children: [b, /* @__PURE__ */ J("div", {
1042
1045
  style: v,
1043
1046
  children: [
1044
1047
  0,
1045
1048
  1,
1046
1049
  2
1047
- ].map((e) => /* @__PURE__ */ q("div", { style: {
1050
+ ].map((e) => /* @__PURE__ */ J("div", { style: {
1048
1051
  height: 96,
1049
1052
  background: "var(--surface-3)",
1050
1053
  borderRadius: 10
1051
1054
  } }, e))
1052
1055
  })] });
1053
- if (d.length === 0) return /* @__PURE__ */ J("div", { children: [b, /* @__PURE__ */ q("div", {
1056
+ if (d.length === 0) return /* @__PURE__ */ Y("div", { children: [b, /* @__PURE__ */ J("div", {
1054
1057
  style: {
1055
1058
  fontSize: 12.5,
1056
1059
  color: "var(--text-3)",
@@ -1059,16 +1062,16 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1059
1062
  children: "No records yet."
1060
1063
  })] });
1061
1064
  let S = p.filter((e) => e !== h && e !== g);
1062
- return /* @__PURE__ */ J("div", { children: [b, /* @__PURE__ */ q("div", {
1065
+ return /* @__PURE__ */ Y("div", { children: [b, /* @__PURE__ */ J("div", {
1063
1066
  style: v,
1064
- children: d.map((t, n) => /* @__PURE__ */ J("div", {
1067
+ children: d.map((t, n) => /* @__PURE__ */ Y("div", {
1065
1068
  style: {
1066
1069
  background: "var(--surface)",
1067
1070
  border: "1px solid var(--border)",
1068
1071
  borderRadius: 10,
1069
1072
  overflow: "hidden"
1070
1073
  },
1071
- children: [/* @__PURE__ */ J("div", {
1074
+ children: [/* @__PURE__ */ Y("div", {
1072
1075
  style: {
1073
1076
  padding: "10px 14px",
1074
1077
  display: "flex",
@@ -1077,7 +1080,7 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1077
1080
  gap: 8,
1078
1081
  borderBottom: S.length > 0 ? "1px solid var(--divider)" : "none"
1079
1082
  },
1080
- children: [/* @__PURE__ */ q("div", {
1083
+ children: [/* @__PURE__ */ J("div", {
1081
1084
  style: {
1082
1085
  fontSize: 12.5,
1083
1086
  fontWeight: 600,
@@ -1094,7 +1097,7 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1094
1097
  refs: f,
1095
1098
  locale: o
1096
1099
  }) : `Record ${n + 1}`
1097
- }), g && t[g] != null && /* @__PURE__ */ q(y, {
1100
+ }), g && t[g] != null && /* @__PURE__ */ J(y, {
1098
1101
  tone: "slate",
1099
1102
  size: "xs",
1100
1103
  children: a.fields.get(g) ? x({
@@ -1107,7 +1110,7 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1107
1110
  locale: o
1108
1111
  }) : l(t[g])
1109
1112
  })]
1110
- }), S.length > 0 && /* @__PURE__ */ q("div", {
1113
+ }), S.length > 0 && /* @__PURE__ */ J("div", {
1111
1114
  style: {
1112
1115
  padding: "10px 14px",
1113
1116
  display: "flex",
@@ -1116,20 +1119,20 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1116
1119
  },
1117
1120
  children: S.slice(0, 4).map((n) => {
1118
1121
  let r = a.fields.get(n);
1119
- return r ? /* @__PURE__ */ J("div", {
1122
+ return r ? /* @__PURE__ */ Y("div", {
1120
1123
  style: {
1121
1124
  display: "flex",
1122
1125
  alignItems: "baseline",
1123
1126
  gap: 8,
1124
1127
  fontSize: 11.5
1125
1128
  },
1126
- children: [/* @__PURE__ */ J("span", {
1129
+ children: [/* @__PURE__ */ Y("span", {
1127
1130
  style: {
1128
1131
  color: "var(--text-3)",
1129
1132
  flexShrink: 0
1130
1133
  },
1131
1134
  children: [i.entities[e.entity]?.fields.get(n)?.display?.name ? Object.values(i.entities[e.entity].fields.get(n).display.name)[0] : n, ":"]
1132
- }), /* @__PURE__ */ q("span", {
1135
+ }), /* @__PURE__ */ J("span", {
1133
1136
  style: {
1134
1137
  overflow: "hidden",
1135
1138
  textOverflow: "ellipsis",
@@ -1155,9 +1158,9 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1155
1158
  //#region src/hooks/useTimelineData.ts
1156
1159
  var it = 50;
1157
1160
  function at(e, t, n, r, a, s) {
1158
- let c = Array.isArray(r) ? r : [r], l = Array.isArray(r) ? i(t, c.length) : [t], u = s ?? it, d = xe({
1161
+ let c = Array.isArray(r) ? r : [r], l = Array.isArray(r) ? i(t, c.length) : [t], u = s ?? it, d = be({
1159
1162
  queryKey: [
1160
- ne,
1163
+ te,
1161
1164
  e,
1162
1165
  t,
1163
1166
  n,
@@ -1180,7 +1183,7 @@ function at(e, t, n, r, a, s) {
1180
1183
  enabled: !!e && !!t && !!n && !!r && l !== null
1181
1184
  });
1182
1185
  return {
1183
- rows: U(() => d.data?.pages.flatMap((e) => e.data) ?? [], [d.data?.pages]),
1186
+ rows: W(() => d.data?.pages.flatMap((e) => e.data) ?? [], [d.data?.pages]),
1184
1187
  refs: d.data?.pages[0]?.$refs,
1185
1188
  fetchNextPage: d.fetchNextPage,
1186
1189
  hasOlder: !!d.hasNextPage,
@@ -1193,8 +1196,8 @@ function at(e, t, n, r, a, s) {
1193
1196
  //#region src/components/detail-layout/TimelineComposer.tsx
1194
1197
  var ot = "quick_entry", st = 100, ct = 240, lt = 800, ut = 80;
1195
1198
  function dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1196
- let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Ye(t, r, i, a), m = n(), [h, g] = G(ct), _ = W(null), v = W(null), [y, S] = G(lt);
1197
- H(() => {
1199
+ let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Ye(t, r, i, a), m = n(), [h, g] = K(ct), _ = G(null), v = G(null), [y, S] = K(lt);
1200
+ U(() => {
1198
1201
  let e = v.current?.parentElement;
1199
1202
  if (!e) return;
1200
1203
  let t = () => {
@@ -1204,14 +1207,14 @@ function dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1204
1207
  t();
1205
1208
  let n = new ResizeObserver(t);
1206
1209
  return n.observe(e), () => n.disconnect();
1207
- }, []), H(() => {
1210
+ }, []), U(() => {
1208
1211
  g((e) => Math.min(e, y));
1209
1212
  }, [y]);
1210
- let C = W(o);
1213
+ let C = G(o);
1211
1214
  C.current = o;
1212
- let w = W(p);
1215
+ let w = G(p);
1213
1216
  w.current = p;
1214
- let T = W({}), E = U(() => ({
1217
+ let T = G({}), E = W(() => ({
1215
1218
  getField: (e) => C.current[e],
1216
1219
  setField: (e, t) => {
1217
1220
  w.current(e, t);
@@ -1221,8 +1224,8 @@ function dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1221
1224
  t && (t.querySelector("textarea, input, select, [contenteditable]") ?? t).focus();
1222
1225
  }
1223
1226
  }), []);
1224
- H(() => b(ot, E), [E]);
1225
- let D = V((e) => {
1227
+ U(() => b(ot, E), [E]);
1228
+ let D = H((e) => {
1226
1229
  e.preventDefault(), _.current = {
1227
1230
  startY: e.clientY,
1228
1231
  startHeight: h
@@ -1248,7 +1251,7 @@ function dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1248
1251
  }
1249
1252
  let M = (e) => {
1250
1253
  let t = c.fields.get(e);
1251
- return t ? /* @__PURE__ */ q("div", {
1254
+ return t ? /* @__PURE__ */ J("div", {
1252
1255
  ref: (t) => {
1253
1256
  T.current[e] = t;
1254
1257
  },
@@ -1263,7 +1266,7 @@ function dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1263
1266
  })
1264
1267
  }, e) : null;
1265
1268
  };
1266
- return /* @__PURE__ */ J("div", {
1269
+ return /* @__PURE__ */ Y("div", {
1267
1270
  ref: v,
1268
1271
  style: {
1269
1272
  flexShrink: 0,
@@ -1273,7 +1276,7 @@ function dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1273
1276
  flexDirection: "column",
1274
1277
  height: `${h}px`
1275
1278
  },
1276
- children: [/* @__PURE__ */ q("div", {
1279
+ children: [/* @__PURE__ */ J("div", {
1277
1280
  onMouseDown: D,
1278
1281
  title: "Drag to resize",
1279
1282
  style: {
@@ -1284,13 +1287,13 @@ function dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1284
1287
  justifyContent: "center",
1285
1288
  flexShrink: 0
1286
1289
  },
1287
- children: /* @__PURE__ */ q("div", { style: {
1290
+ children: /* @__PURE__ */ J("div", { style: {
1288
1291
  width: 56,
1289
1292
  height: 3,
1290
1293
  borderRadius: 999,
1291
1294
  background: "var(--border)"
1292
1295
  } })
1293
- }), /* @__PURE__ */ J("form", {
1296
+ }), /* @__PURE__ */ Y("form", {
1294
1297
  onSubmit: f,
1295
1298
  onKeyDown: (e) => {
1296
1299
  (e.metaKey || e.ctrlKey) && e.key === "Enter" && (e.preventDefault(), e.currentTarget.requestSubmit());
@@ -1304,7 +1307,7 @@ function dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1304
1307
  padding: "0 12px 8px"
1305
1308
  },
1306
1309
  children: [
1307
- A.length > 0 && /* @__PURE__ */ q("div", {
1310
+ A.length > 0 && /* @__PURE__ */ J("div", {
1308
1311
  style: {
1309
1312
  display: "flex",
1310
1313
  flexWrap: "wrap",
@@ -1314,7 +1317,7 @@ function dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1314
1317
  },
1315
1318
  children: A.map(M)
1316
1319
  }),
1317
- k && c.fields.get(k) && /* @__PURE__ */ q("div", {
1320
+ k && c.fields.get(k) && /* @__PURE__ */ J("div", {
1318
1321
  style: {
1319
1322
  flex: 1,
1320
1323
  minHeight: 0,
@@ -1334,7 +1337,7 @@ function dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1334
1337
  locale: m
1335
1338
  })
1336
1339
  }),
1337
- /* @__PURE__ */ J("div", {
1340
+ /* @__PURE__ */ Y("div", {
1338
1341
  style: {
1339
1342
  display: "flex",
1340
1343
  flexWrap: "wrap",
@@ -1342,39 +1345,39 @@ function dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1342
1345
  gap: 6,
1343
1346
  flexShrink: 0
1344
1347
  },
1345
- children: [j.map(M), /* @__PURE__ */ J("div", {
1348
+ children: [j.map(M), /* @__PURE__ */ Y("div", {
1346
1349
  style: {
1347
1350
  marginLeft: "auto",
1348
1351
  display: "flex",
1349
1352
  alignItems: "center",
1350
1353
  gap: 8
1351
1354
  },
1352
- children: [/* @__PURE__ */ J("span", {
1355
+ children: [/* @__PURE__ */ Y("span", {
1353
1356
  style: {
1354
1357
  fontSize: 10.5,
1355
1358
  color: "var(--text-4)"
1356
1359
  },
1357
1360
  children: [
1358
- /* @__PURE__ */ q("span", {
1361
+ /* @__PURE__ */ J("span", {
1359
1362
  className: "mono",
1360
1363
  children: "⌘"
1361
1364
  }),
1362
- /* @__PURE__ */ q("span", {
1365
+ /* @__PURE__ */ J("span", {
1363
1366
  className: "mono",
1364
1367
  children: "↵"
1365
1368
  }),
1366
1369
  " to add"
1367
1370
  ]
1368
- }), /* @__PURE__ */ q(O, {
1371
+ }), /* @__PURE__ */ J(O, {
1369
1372
  type: "submit",
1370
1373
  kind: "primary",
1371
- icon: /* @__PURE__ */ q(e.plus, { size: 13 }),
1374
+ icon: /* @__PURE__ */ J(e.plus, { size: 13 }),
1372
1375
  disabled: l || !d,
1373
1376
  children: "Add"
1374
1377
  })]
1375
1378
  })]
1376
1379
  }),
1377
- u != null && /* @__PURE__ */ q("p", {
1380
+ u != null && /* @__PURE__ */ J("p", {
1378
1381
  style: {
1379
1382
  fontSize: 11,
1380
1383
  color: "var(--danger)",
@@ -1407,15 +1410,15 @@ function yt(e) {
1407
1410
  return e.__optimistic === !0;
1408
1411
  }
1409
1412
  function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1410
- let i = r.entities[e.entity], { rows: a, refs: o, fetchNextPage: s, hasOlder: c, isFetchingOlder: l, isLoading: u, isError: d } = at(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), p = e.timeline, m = p?.scroll ?? !1, g = (e.sort ?? "").endsWith(":asc"), _ = U(() => g ? [...a].reverse() : a, [a, g]), v = p?.auto_scroll ?? "none", y = W(null), b = W(null), x = W(!1), S = W(0), C = W(null), w = W(null), T = W(!0), E = W(null);
1411
- H(() => {
1413
+ let i = r.entities[e.entity], { rows: a, refs: o, fetchNextPage: s, hasOlder: c, isFetchingOlder: l, isLoading: u, isError: d } = at(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), p = e.timeline, m = p?.scroll ?? !1, g = (e.sort ?? "").endsWith(":asc"), _ = W(() => g ? [...a].reverse() : a, [a, g]), v = p?.auto_scroll ?? "none", y = G(null), b = G(null), x = G(!1), S = G(0), C = G(null), w = G(null), T = G(!0), E = G(null);
1414
+ U(() => {
1412
1415
  x.current = !1, S.current = 0, C.current = null, w.current = null, T.current = !0, E.current = null;
1413
- }, [n]), be(() => {
1416
+ }, [n]), ye(() => {
1414
1417
  !l || !y.current || (E.current = {
1415
1418
  scrollHeight: y.current.scrollHeight,
1416
1419
  scrollTop: y.current.scrollTop
1417
1420
  });
1418
- }, [l]), be(() => {
1421
+ }, [l]), ye(() => {
1419
1422
  let e = y.current;
1420
1423
  if (!e || _.length === 0 || !i) {
1421
1424
  S.current = _.length;
@@ -1434,11 +1437,11 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1434
1437
  g,
1435
1438
  i
1436
1439
  ]);
1437
- let D = V(() => {
1440
+ let D = H(() => {
1438
1441
  let e = y.current;
1439
1442
  e && (T.current = e.scrollHeight - e.scrollTop - e.clientHeight < ft);
1440
1443
  }, []);
1441
- H(() => {
1444
+ U(() => {
1442
1445
  let e = b.current;
1443
1446
  if (!e || typeof IntersectionObserver > "u") return;
1444
1447
  let t = new IntersectionObserver((e) => {
@@ -1454,8 +1457,8 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1454
1457
  l,
1455
1458
  s
1456
1459
  ]);
1457
- let [k, A] = G(null);
1458
- if (!i) return /* @__PURE__ */ q("div", {
1460
+ let [k, A] = K(null);
1461
+ if (!i) return /* @__PURE__ */ J("div", {
1459
1462
  style: {
1460
1463
  fontSize: 12.5,
1461
1464
  color: "var(--text-3)",
@@ -1463,25 +1466,25 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1463
1466
  },
1464
1467
  children: "Entity not found."
1465
1468
  });
1466
- let j = e.quick_add?.fields ?? [p?.content_field].filter(Boolean), M = f(i.display?.name_plural) || f(i.display?.name) || e.entity, ee = c ? /* @__PURE__ */ q("div", {
1469
+ let j = e.quick_add?.fields ?? [p?.content_field].filter(Boolean), M = f(i.display?.name_plural) || f(i.display?.name) || e.entity, ee = c ? /* @__PURE__ */ J("div", {
1467
1470
  style: {
1468
1471
  display: "flex",
1469
1472
  justifyContent: "center",
1470
1473
  padding: "6px 0"
1471
1474
  },
1472
- children: /* @__PURE__ */ q(O, {
1475
+ children: /* @__PURE__ */ J(O, {
1473
1476
  size: "xs",
1474
1477
  onClick: () => s(),
1475
1478
  disabled: l,
1476
- icon: l ? /* @__PURE__ */ q(h, { size: 11 }) : void 0,
1479
+ icon: l ? /* @__PURE__ */ J(h, { size: 11 }) : void 0,
1477
1480
  children: l ? "Loading…" : "Load older"
1478
1481
  })
1479
- }) : null, te = /* @__PURE__ */ q("div", {
1482
+ }) : null, N = /* @__PURE__ */ J("div", {
1480
1483
  ref: b,
1481
1484
  "aria-hidden": "true",
1482
1485
  style: { height: 1 }
1483
- }), N;
1484
- if (d) N = /* @__PURE__ */ q("div", {
1486
+ }), P;
1487
+ if (d) P = /* @__PURE__ */ J("div", {
1485
1488
  style: {
1486
1489
  fontSize: 12.5,
1487
1490
  color: "var(--danger)",
@@ -1489,24 +1492,24 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1489
1492
  },
1490
1493
  children: "Failed to load."
1491
1494
  });
1492
- else if (u) N = /* @__PURE__ */ J("div", {
1495
+ else if (u) P = /* @__PURE__ */ Y("div", {
1493
1496
  style: {
1494
1497
  display: "flex",
1495
1498
  flexDirection: "column",
1496
1499
  gap: 8,
1497
1500
  padding: 12
1498
1501
  },
1499
- children: [/* @__PURE__ */ q("div", { style: {
1502
+ children: [/* @__PURE__ */ J("div", { style: {
1500
1503
  height: 64,
1501
1504
  background: "var(--surface-3)",
1502
1505
  borderRadius: 8
1503
- } }), /* @__PURE__ */ q("div", { style: {
1506
+ } }), /* @__PURE__ */ J("div", { style: {
1504
1507
  height: 64,
1505
1508
  background: "var(--surface-3)",
1506
1509
  borderRadius: 8
1507
1510
  } })]
1508
1511
  });
1509
- else if (_.length === 0) N = /* @__PURE__ */ J(K, { children: [te, /* @__PURE__ */ q("div", {
1512
+ else if (_.length === 0) P = /* @__PURE__ */ Y(q, { children: [N, /* @__PURE__ */ J("div", {
1510
1513
  style: {
1511
1514
  fontSize: 12.5,
1512
1515
  color: "var(--text-3)",
@@ -1517,7 +1520,7 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1517
1520
  else {
1518
1521
  let a = (a, s) => {
1519
1522
  let c = vt(i, a) || String(s);
1520
- return /* @__PURE__ */ q(xt, {
1523
+ return /* @__PURE__ */ J(xt, {
1521
1524
  row: a,
1522
1525
  rowId: c,
1523
1526
  childEntity: i,
@@ -1550,25 +1553,25 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1550
1553
  row: t,
1551
1554
  idx: n
1552
1555
  });
1553
- }), c = e.map((e) => /* @__PURE__ */ J("div", {
1556
+ }), c = e.map((e) => /* @__PURE__ */ Y("div", {
1554
1557
  style: {
1555
1558
  display: "flex",
1556
1559
  flexDirection: "column",
1557
1560
  gap: 8
1558
1561
  },
1559
- children: [/* @__PURE__ */ q(Tt, {
1562
+ children: [/* @__PURE__ */ J(Tt, {
1560
1563
  label: e.label,
1561
1564
  count: e.rows.length
1562
1565
  }), e.rows.map(({ row: e, idx: t }) => a(e, t))]
1563
1566
  }, `day-${e.key}`));
1564
1567
  } else c = _.map((e, t) => a(e, t));
1565
- N = /* @__PURE__ */ J(K, { children: [
1566
- te,
1568
+ P = /* @__PURE__ */ Y(q, { children: [
1569
+ N,
1567
1570
  ee,
1568
1571
  c
1569
1572
  ] });
1570
1573
  }
1571
- return m ? /* @__PURE__ */ J("div", {
1574
+ return m ? /* @__PURE__ */ Y("div", {
1572
1575
  style: {
1573
1576
  display: "flex",
1574
1577
  flexDirection: "column",
@@ -1578,13 +1581,13 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1578
1581
  color: "var(--text)"
1579
1582
  },
1580
1583
  children: [
1581
- /* @__PURE__ */ q("div", {
1584
+ /* @__PURE__ */ J("div", {
1582
1585
  style: {
1583
1586
  padding: "10px 16px",
1584
1587
  borderBottom: "1px solid var(--divider)",
1585
1588
  background: "var(--surface)"
1586
1589
  },
1587
- children: /* @__PURE__ */ q("h3", {
1590
+ children: /* @__PURE__ */ J("h3", {
1588
1591
  style: {
1589
1592
  margin: 0,
1590
1593
  fontSize: 12.5,
@@ -1593,7 +1596,7 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1593
1596
  children: M
1594
1597
  })
1595
1598
  }),
1596
- /* @__PURE__ */ q("div", {
1599
+ /* @__PURE__ */ J("div", {
1597
1600
  ref: y,
1598
1601
  onScroll: D,
1599
1602
  style: {
@@ -1604,23 +1607,23 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1604
1607
  flexDirection: "column",
1605
1608
  gap: 8
1606
1609
  },
1607
- children: N
1610
+ children: P
1608
1611
  }),
1609
- /* @__PURE__ */ q(dt, {
1612
+ /* @__PURE__ */ J(dt, {
1610
1613
  config: e,
1611
1614
  parentEntity: t,
1612
1615
  parentId: n,
1613
1616
  schema: r
1614
1617
  })
1615
1618
  ]
1616
- }) : /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("div", {
1619
+ }) : /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
1617
1620
  style: {
1618
1621
  display: "flex",
1619
1622
  flexDirection: "column",
1620
1623
  gap: 8
1621
1624
  },
1622
- children: N
1623
- }), /* @__PURE__ */ q(dt, {
1625
+ children: P
1626
+ }), /* @__PURE__ */ J(dt, {
1624
1627
  config: e,
1625
1628
  parentEntity: t,
1626
1629
  parentId: n,
@@ -1628,9 +1631,9 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1628
1631
  })] });
1629
1632
  }
1630
1633
  function xt({ row: t, rowId: r, childEntity: i, entityCode: a, parentEntity: o, parentId: s, timeline: c, editableFields: u, refs: f, isEditing: p, onStartEdit: m, onCancelEdit: g, onSaved: _, schema: v, optimistic: b = !1 }) {
1631
- let S = Ce(), T = n(), [E, A] = G({}), j = V(() => {
1634
+ let S = Se(), T = n(), [D, A] = K({}), j = H(() => {
1632
1635
  S.invalidateQueries({ queryKey: [
1633
- ne,
1636
+ te,
1634
1637
  o,
1635
1638
  s,
1636
1639
  a
@@ -1640,25 +1643,25 @@ function xt({ row: t, rowId: r, childEntity: i, entityCode: a, parentEntity: o,
1640
1643
  o,
1641
1644
  s,
1642
1645
  a
1643
- ]), M = Se({
1646
+ ]), M = xe({
1644
1647
  mutationFn: (e) => {
1645
- let n = t.$row_version;
1646
- return C(a, r, typeof n == "string" && n !== "" ? {
1648
+ let n = t.$row_version, i = typeof n == "string" && n !== "" ? {
1647
1649
  ...e,
1648
1650
  $row_version: n
1649
- } : e);
1651
+ } : e;
1652
+ return C(a, r, i);
1650
1653
  },
1651
1654
  onSuccess: () => {
1652
- j(), D.success("Updated"), _();
1655
+ j(), E.success("Updated"), _();
1653
1656
  },
1654
- onError: (e) => D.error(e.message)
1655
- }), ee = Se({
1657
+ onError: (e) => E.error(e.message)
1658
+ }), ee = xe({
1656
1659
  mutationFn: () => k(a, r),
1657
1660
  onSuccess: () => {
1658
- j(), D.success("Deleted");
1661
+ j(), E.success("Deleted");
1659
1662
  },
1660
- onError: (e) => D.error(e.message)
1661
- }), te = V(() => {
1663
+ onError: (e) => E.error(e.message)
1664
+ }), N = H(() => {
1662
1665
  let e = {};
1663
1666
  for (let n of u) e[n] = t[n] ?? "";
1664
1667
  A(e), m();
@@ -1666,13 +1669,13 @@ function xt({ row: t, rowId: r, childEntity: i, entityCode: a, parentEntity: o,
1666
1669
  t,
1667
1670
  u,
1668
1671
  m
1669
- ]), N = V((e, t) => {
1672
+ ]), P = H((e, t) => {
1670
1673
  A((n) => ({
1671
1674
  ...n,
1672
1675
  [e]: t
1673
1676
  }));
1674
- }, []), P = c?.time_field, F = c?.type_field, I = c?.summary_field, L = c?.content_field, R = c?.author_field, z = c?.direction_field, B = c?.intent_field;
1675
- return p ? /* @__PURE__ */ J("div", {
1677
+ }, []), F = c?.time_field, I = c?.type_field, L = c?.summary_field, R = c?.content_field, z = c?.author_field, B = c?.direction_field, V = c?.intent_field;
1678
+ return p ? /* @__PURE__ */ Y("div", {
1676
1679
  style: {
1677
1680
  borderRadius: 10,
1678
1681
  border: "1px solid var(--accent)",
@@ -1684,7 +1687,7 @@ function xt({ row: t, rowId: r, childEntity: i, entityCode: a, parentEntity: o,
1684
1687
  },
1685
1688
  children: [u.map((e) => {
1686
1689
  let t = i.fields.get(e);
1687
- return t ? /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("label", {
1690
+ return t ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("label", {
1688
1691
  style: {
1689
1692
  fontSize: 11,
1690
1693
  color: "var(--text-3)",
@@ -1695,29 +1698,29 @@ function xt({ row: t, rowId: r, childEntity: i, entityCode: a, parentEntity: o,
1695
1698
  }), x({
1696
1699
  field: t,
1697
1700
  fieldName: e,
1698
- value: E[e] ?? "",
1701
+ value: D[e] ?? "",
1699
1702
  mode: "edit",
1700
- onChange: (t) => N(e, t),
1701
- record: E,
1703
+ onChange: (t) => P(e, t),
1704
+ record: D,
1702
1705
  locale: T
1703
1706
  })] }, e) : null;
1704
- }), /* @__PURE__ */ J("div", {
1707
+ }), /* @__PURE__ */ Y("div", {
1705
1708
  style: {
1706
1709
  display: "flex",
1707
1710
  alignItems: "center",
1708
1711
  gap: 6,
1709
1712
  paddingTop: 4
1710
1713
  },
1711
- children: [/* @__PURE__ */ q(O, {
1714
+ children: [/* @__PURE__ */ J(O, {
1712
1715
  kind: "primary",
1713
1716
  size: "xs",
1714
- icon: M.isPending ? /* @__PURE__ */ q(h, { size: 12 }) : /* @__PURE__ */ q(e.check, { size: 12 }),
1715
- onClick: () => M.mutate(E),
1717
+ icon: M.isPending ? /* @__PURE__ */ J(h, { size: 12 }) : /* @__PURE__ */ J(e.check, { size: 12 }),
1718
+ onClick: () => M.mutate(D),
1716
1719
  disabled: M.isPending,
1717
1720
  children: M.isPending ? "Saving…" : "Save"
1718
- }), /* @__PURE__ */ q(O, {
1721
+ }), /* @__PURE__ */ J(O, {
1719
1722
  size: "xs",
1720
- icon: /* @__PURE__ */ q(e.x, { size: 12 }),
1723
+ icon: /* @__PURE__ */ J(e.x, { size: 12 }),
1721
1724
  onClick: () => {
1722
1725
  A({}), g();
1723
1726
  },
@@ -1725,7 +1728,7 @@ function xt({ row: t, rowId: r, childEntity: i, entityCode: a, parentEntity: o,
1725
1728
  children: "Cancel"
1726
1729
  })]
1727
1730
  })]
1728
- }) : /* @__PURE__ */ J("div", {
1731
+ }) : /* @__PURE__ */ Y("div", {
1729
1732
  className: "group",
1730
1733
  "data-optimistic": b || void 0,
1731
1734
  style: {
@@ -1739,7 +1742,7 @@ function xt({ row: t, rowId: r, childEntity: i, entityCode: a, parentEntity: o,
1739
1742
  onMouseEnter: (e) => e.currentTarget.style.borderColor = "var(--border-strong)",
1740
1743
  onMouseLeave: (e) => e.currentTarget.style.borderColor = "var(--border)",
1741
1744
  children: [
1742
- /* @__PURE__ */ J("div", {
1745
+ /* @__PURE__ */ Y("div", {
1743
1746
  style: {
1744
1747
  display: "flex",
1745
1748
  alignItems: "center",
@@ -1749,109 +1752,109 @@ function xt({ row: t, rowId: r, childEntity: i, entityCode: a, parentEntity: o,
1749
1752
  color: "var(--text-3)"
1750
1753
  },
1751
1754
  children: [
1752
- P && t[P] != null && i.fields.get(P) && /* @__PURE__ */ q("span", {
1755
+ F && t[F] != null && i.fields.get(F) && /* @__PURE__ */ J("span", {
1753
1756
  style: { fontWeight: 500 },
1754
1757
  children: x({
1755
- field: i.fields.get(P),
1756
- fieldName: P,
1757
- value: t[P],
1758
+ field: i.fields.get(F),
1759
+ fieldName: F,
1760
+ value: t[F],
1758
1761
  mode: "display",
1759
1762
  record: t,
1760
1763
  refs: f,
1761
1764
  locale: T
1762
1765
  })
1763
1766
  }),
1764
- F && t[F] != null && i.fields.get(F) && /* @__PURE__ */ q(y, {
1767
+ I && t[I] != null && i.fields.get(I) && /* @__PURE__ */ J(y, {
1765
1768
  tone: "slate",
1766
1769
  size: "xs",
1767
1770
  children: x({
1768
- field: i.fields.get(F),
1769
- fieldName: F,
1770
- value: t[F],
1771
+ field: i.fields.get(I),
1772
+ fieldName: I,
1773
+ value: t[I],
1771
1774
  mode: "display",
1772
1775
  record: t,
1773
1776
  refs: f,
1774
1777
  locale: T
1775
1778
  })
1776
1779
  }),
1777
- z && t[z] != null && i.fields.get(z) && /* @__PURE__ */ q(Et, {
1778
- value: t[z],
1779
- field: i.fields.get(z)
1780
+ B && t[B] != null && i.fields.get(B) && /* @__PURE__ */ J(Et, {
1781
+ value: t[B],
1782
+ field: i.fields.get(B)
1780
1783
  }),
1781
- B && t[B] != null && i.fields.get(B) && /* @__PURE__ */ q(y, {
1784
+ V && t[V] != null && i.fields.get(V) && /* @__PURE__ */ J(y, {
1782
1785
  tone: "slate",
1783
1786
  size: "xs",
1784
1787
  children: x({
1785
- field: i.fields.get(B),
1786
- fieldName: B,
1787
- value: t[B],
1788
+ field: i.fields.get(V),
1789
+ fieldName: V,
1790
+ value: t[V],
1788
1791
  mode: "display",
1789
1792
  record: t,
1790
1793
  refs: f,
1791
1794
  locale: T
1792
1795
  })
1793
1796
  }),
1794
- R && t[R] != null && i.fields.get(R) && /* @__PURE__ */ J("span", { children: [
1797
+ z && t[z] != null && i.fields.get(z) && /* @__PURE__ */ Y("span", { children: [
1795
1798
  "by",
1796
1799
  " ",
1797
1800
  x({
1798
- field: i.fields.get(R),
1799
- fieldName: R,
1800
- value: t[R],
1801
+ field: i.fields.get(z),
1802
+ fieldName: z,
1803
+ value: t[z],
1801
1804
  mode: "display",
1802
1805
  record: t,
1803
1806
  refs: f,
1804
1807
  locale: T
1805
1808
  })
1806
1809
  ] }),
1807
- !b && /* @__PURE__ */ J("div", {
1810
+ !b && /* @__PURE__ */ Y("div", {
1808
1811
  style: {
1809
1812
  marginLeft: "auto",
1810
1813
  display: "flex",
1811
1814
  alignItems: "center",
1812
1815
  gap: 2
1813
1816
  },
1814
- children: [/* @__PURE__ */ q(w, {
1817
+ children: [/* @__PURE__ */ J(w, {
1815
1818
  size: 22,
1816
- icon: /* @__PURE__ */ q(e.edit, { size: 11 }),
1817
- onClick: te,
1819
+ icon: /* @__PURE__ */ J(e.edit, { size: 11 }),
1820
+ onClick: N,
1818
1821
  title: "Edit"
1819
- }), /* @__PURE__ */ q(w, {
1822
+ }), /* @__PURE__ */ J(w, {
1820
1823
  size: 22,
1821
- icon: /* @__PURE__ */ q(e.trash, { size: 11 }),
1824
+ icon: /* @__PURE__ */ J(e.trash, { size: 11 }),
1822
1825
  onClick: () => ee.mutate(),
1823
1826
  title: "Delete"
1824
1827
  })]
1825
1828
  })
1826
1829
  ]
1827
1830
  }),
1828
- I && t[I] != null && i.fields.get(I) && /* @__PURE__ */ q("div", {
1831
+ L && t[L] != null && i.fields.get(L) && /* @__PURE__ */ J("div", {
1829
1832
  style: {
1830
1833
  fontSize: 12.5,
1831
1834
  fontWeight: 500,
1832
1835
  marginTop: 6
1833
1836
  },
1834
1837
  children: x({
1835
- field: i.fields.get(I),
1836
- fieldName: I,
1837
- value: t[I],
1838
+ field: i.fields.get(L),
1839
+ fieldName: L,
1840
+ value: t[L],
1838
1841
  mode: "display",
1839
1842
  record: t,
1840
1843
  refs: f,
1841
1844
  locale: T
1842
1845
  })
1843
1846
  }),
1844
- L && t[L] != null && L !== I && i.fields.get(L) && /* @__PURE__ */ q(St, {
1847
+ R && t[R] != null && R !== L && i.fields.get(R) && /* @__PURE__ */ J(St, {
1845
1848
  rendered: x({
1846
- field: i.fields.get(L),
1847
- fieldName: L,
1848
- value: t[L],
1849
+ field: i.fields.get(R),
1850
+ fieldName: R,
1851
+ value: t[R],
1849
1852
  mode: "display",
1850
1853
  record: t,
1851
1854
  refs: f,
1852
1855
  locale: T
1853
1856
  }),
1854
- text: l(t[L])
1857
+ text: l(t[R])
1855
1858
  })
1856
1859
  ]
1857
1860
  });
@@ -1862,12 +1865,12 @@ function St({ rendered: e, text: t }) {
1862
1865
  fontWeight: 400,
1863
1866
  marginTop: 6
1864
1867
  };
1865
- if (!_t(t)) return /* @__PURE__ */ q("div", {
1868
+ if (!_t(t)) return /* @__PURE__ */ J("div", {
1866
1869
  style: n,
1867
1870
  children: e
1868
1871
  });
1869
1872
  let r = t.length > ht, i = r ? t.slice(0, ht) : t;
1870
- return /* @__PURE__ */ q("div", {
1873
+ return /* @__PURE__ */ J("div", {
1871
1874
  style: {
1872
1875
  ...n,
1873
1876
  display: "-webkit-box",
@@ -1877,15 +1880,15 @@ function St({ rendered: e, text: t }) {
1877
1880
  whiteSpace: "pre-wrap",
1878
1881
  overflowWrap: "anywhere"
1879
1882
  },
1880
- children: /* @__PURE__ */ q(_, {
1883
+ children: /* @__PURE__ */ J(_, {
1881
1884
  width: 380,
1882
- content: /* @__PURE__ */ J("div", {
1885
+ content: /* @__PURE__ */ Y("div", {
1883
1886
  style: {
1884
1887
  fontSize: 12.5,
1885
1888
  whiteSpace: "pre-wrap",
1886
1889
  overflowWrap: "anywhere"
1887
1890
  },
1888
- children: [i, r && /* @__PURE__ */ q("div", {
1891
+ children: [i, r && /* @__PURE__ */ J("div", {
1889
1892
  style: {
1890
1893
  marginTop: 8,
1891
1894
  fontSize: 11,
@@ -1917,7 +1920,7 @@ function wt(e) {
1917
1920
  });
1918
1921
  }
1919
1922
  function Tt({ label: e, count: t }) {
1920
- return /* @__PURE__ */ J("div", {
1923
+ return /* @__PURE__ */ Y("div", {
1921
1924
  style: {
1922
1925
  position: "sticky",
1923
1926
  top: -4,
@@ -1929,7 +1932,7 @@ function Tt({ label: e, count: t }) {
1929
1932
  background: "linear-gradient(180deg, var(--surface-2) 0%, var(--surface-2) 65%, transparent 100%)"
1930
1933
  },
1931
1934
  children: [
1932
- /* @__PURE__ */ q("span", {
1935
+ /* @__PURE__ */ J("span", {
1933
1936
  style: {
1934
1937
  fontSize: 11,
1935
1938
  fontWeight: 600,
@@ -1937,12 +1940,12 @@ function Tt({ label: e, count: t }) {
1937
1940
  },
1938
1941
  children: e
1939
1942
  }),
1940
- /* @__PURE__ */ q("span", { style: {
1943
+ /* @__PURE__ */ J("span", { style: {
1941
1944
  flex: 1,
1942
1945
  height: 1,
1943
1946
  background: "var(--divider)"
1944
1947
  } }),
1945
- /* @__PURE__ */ q("span", {
1948
+ /* @__PURE__ */ J("span", {
1946
1949
  className: "num",
1947
1950
  style: {
1948
1951
  fontSize: 10.5,
@@ -1955,7 +1958,7 @@ function Tt({ label: e, count: t }) {
1955
1958
  }
1956
1959
  function Et({ value: t, field: n }) {
1957
1960
  let r = Dt(t, n);
1958
- return r === null ? null : /* @__PURE__ */ J("span", {
1961
+ return r === null ? null : /* @__PURE__ */ Y("span", {
1959
1962
  style: {
1960
1963
  display: "inline-flex",
1961
1964
  alignItems: "center",
@@ -1967,7 +1970,7 @@ function Et({ value: t, field: n }) {
1967
1970
  background: r ? "var(--accent-soft)" : "var(--info-soft)",
1968
1971
  color: r ? "var(--accent)" : "var(--info)"
1969
1972
  },
1970
- children: [q(r ? e.arrowUp : e.arrowDown, { size: 10 }), r ? "Out" : "In"]
1973
+ children: [J(r ? e.arrowUp : e.arrowDown, { size: 10 }), r ? "Out" : "In"]
1971
1974
  });
1972
1975
  }
1973
1976
  function Dt(e, t) {
@@ -1982,7 +1985,7 @@ function Dt(e, t) {
1982
1985
  //#endregion
1983
1986
  //#region src/components/detail-layout/EditableChildrenTable.tsx
1984
1987
  function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, validationErrors: s, refs: c, forceTablePresentation: u = !1 }) {
1985
- let f = n(), p = E(), m = W(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) => {
1988
+ let f = n(), p = D(), m = G(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) => {
1986
1989
  if (_.has(e) || t.position_field && e === t.position_field) return !1;
1987
1990
  let n = r.fields.get(e);
1988
1991
  return !(!n || n.auto || n.primary || n.source);
@@ -1990,21 +1993,24 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
1990
1993
  if (t.position_field && e === t.position_field) return !0;
1991
1994
  let n = r.fields.get(e);
1992
1995
  return n && (n.auto || n.primary || n.source);
1993
- })), b = V((e, t, n) => {
1996
+ })), b = H((e, t, n) => {
1994
1997
  o(a.map((r) => r._key === e ? {
1995
1998
  ...r,
1996
1999
  [t]: n,
1997
2000
  _dirty: !0
1998
2001
  } : r));
1999
- }, [a, o]), S = V(() => {
2002
+ }, [a, o]), S = H(() => {
2000
2003
  let e = {
2001
2004
  _key: crypto.randomUUID(),
2002
2005
  _dirty: !0
2003
2006
  };
2004
- g && (e[g] = a.filter((e) => !e._deleted).reduce((e, t) => {
2005
- let n = typeof t[g] == "number" ? t[g] : -1;
2006
- return Math.max(e, n);
2007
- }, -1) + 1);
2007
+ if (g) {
2008
+ let t = a.filter((e) => !e._deleted).reduce((e, t) => {
2009
+ let n = typeof t[g] == "number" ? t[g] : -1;
2010
+ return Math.max(e, n);
2011
+ }, -1);
2012
+ e[g] = t + 1;
2013
+ }
2008
2014
  let n = t.quick_add?.defaults ?? {};
2009
2015
  for (let t of v) {
2010
2016
  let i = r.fields.get(t);
@@ -2018,17 +2024,17 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2018
2024
  r,
2019
2025
  t.quick_add?.defaults,
2020
2026
  g
2021
- ]), C = V((e) => {
2027
+ ]), C = H((e) => {
2022
2028
  o(a.map((t) => t._key === e ? {
2023
2029
  ...t,
2024
2030
  _deleted: !0
2025
2031
  } : t));
2026
- }, [a, o]), T = V((e) => {
2032
+ }, [a, o]), T = H((e) => {
2027
2033
  o(a.map((t) => t._key === e ? {
2028
2034
  ...t,
2029
2035
  _deleted: !1
2030
2036
  } : t));
2031
- }, [a, o]), D = V((e, t) => {
2037
+ }, [a, o]), E = H((e, t) => {
2032
2038
  if (!g) return;
2033
2039
  let n = a.filter((e) => !e._deleted), r = a.filter((e) => e._deleted), i = n.findIndex((t) => t._key === e), s = i + t;
2034
2040
  if (i < 0 || s < 0 || s >= n.length) return;
@@ -2042,7 +2048,7 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2042
2048
  a,
2043
2049
  o,
2044
2050
  g
2045
- ]), k = V((e) => {
2051
+ ]), k = H((e) => {
2046
2052
  let t = e.target, n = t.closest("td");
2047
2053
  if (!n) return;
2048
2054
  let r = n.closest("tr");
@@ -2074,8 +2080,8 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2074
2080
  }
2075
2081
  });
2076
2082
  } else e.key === "Escape" && t.blur?.();
2077
- }, [S]), A = fe;
2078
- return p.isPhone && !u ? /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("div", {
2083
+ }, [S]), A = de;
2084
+ return p.isPhone && !u ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
2079
2085
  style: {
2080
2086
  display: "flex",
2081
2087
  flexDirection: "column",
@@ -2083,7 +2089,7 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2083
2089
  },
2084
2090
  children: a.map((t, n) => {
2085
2091
  let o = !!t._deleted, u = s?.[t._key], p = g ? a.filter((e) => !e._deleted) : [], m = g ? p.findIndex((e) => e._key === t._key) : -1;
2086
- return /* @__PURE__ */ J("div", {
2092
+ return /* @__PURE__ */ Y("div", {
2087
2093
  style: {
2088
2094
  border: "1px solid var(--border)",
2089
2095
  borderRadius: 8,
@@ -2091,7 +2097,7 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2091
2097
  opacity: o ? .58 : 1,
2092
2098
  overflow: "hidden"
2093
2099
  },
2094
- children: [/* @__PURE__ */ J("div", {
2100
+ children: [/* @__PURE__ */ Y("div", {
2095
2101
  style: {
2096
2102
  minHeight: 38,
2097
2103
  padding: "8px 10px",
@@ -2101,44 +2107,44 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2101
2107
  justifyContent: "space-between",
2102
2108
  gap: 8
2103
2109
  },
2104
- children: [/* @__PURE__ */ J("div", {
2110
+ children: [/* @__PURE__ */ Y("div", {
2105
2111
  style: {
2106
2112
  fontSize: 12,
2107
2113
  fontWeight: 600,
2108
2114
  color: "var(--text-2)"
2109
2115
  },
2110
2116
  children: ["Row ", n + 1]
2111
- }), /* @__PURE__ */ J("div", {
2117
+ }), /* @__PURE__ */ Y("div", {
2112
2118
  style: {
2113
2119
  display: "flex",
2114
2120
  alignItems: "center",
2115
2121
  gap: 4
2116
2122
  },
2117
- children: [g && !o && /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(w, {
2123
+ children: [g && !o && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(w, {
2118
2124
  size: 32,
2119
- icon: /* @__PURE__ */ q(e.up, { size: 14 }),
2120
- onClick: () => D(t._key, -1),
2125
+ icon: /* @__PURE__ */ J(e.up, { size: 14 }),
2126
+ onClick: () => E(t._key, -1),
2121
2127
  disabled: m <= 0,
2122
2128
  title: "Move row up"
2123
- }), /* @__PURE__ */ q(w, {
2129
+ }), /* @__PURE__ */ J(w, {
2124
2130
  size: 32,
2125
- icon: /* @__PURE__ */ q(e.down, { size: 14 }),
2126
- onClick: () => D(t._key, 1),
2131
+ icon: /* @__PURE__ */ J(e.down, { size: 14 }),
2132
+ onClick: () => E(t._key, 1),
2127
2133
  disabled: m === -1 || m >= p.length - 1,
2128
2134
  title: "Move row down"
2129
- })] }), o ? /* @__PURE__ */ q(w, {
2135
+ })] }), o ? /* @__PURE__ */ J(w, {
2130
2136
  size: 32,
2131
- icon: /* @__PURE__ */ q(e.refresh, { size: 14 }),
2137
+ icon: /* @__PURE__ */ J(e.refresh, { size: 14 }),
2132
2138
  onClick: () => T(t._key),
2133
2139
  title: "Undo delete"
2134
- }) : /* @__PURE__ */ q(w, {
2140
+ }) : /* @__PURE__ */ J(w, {
2135
2141
  size: 32,
2136
- icon: /* @__PURE__ */ q(e.trash, { size: 14 }),
2142
+ icon: /* @__PURE__ */ J(e.trash, { size: 14 }),
2137
2143
  onClick: () => C(t._key),
2138
2144
  title: "Delete row"
2139
2145
  })]
2140
2146
  })]
2141
- }), /* @__PURE__ */ q("div", {
2147
+ }), /* @__PURE__ */ J("div", {
2142
2148
  style: {
2143
2149
  padding: 10,
2144
2150
  display: "flex",
@@ -2155,7 +2161,7 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2155
2161
  fontWeight: 600,
2156
2162
  color: "var(--text-3)"
2157
2163
  }, v = !o && !s && !!n;
2158
- return /* @__PURE__ */ J("div", {
2164
+ return /* @__PURE__ */ Y("div", {
2159
2165
  style: {
2160
2166
  display: "flex",
2161
2167
  flexDirection: "column",
@@ -2164,16 +2170,16 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2164
2170
  textDecoration: o ? "line-through" : "none"
2165
2171
  },
2166
2172
  title: a ? `${e} is required` : void 0,
2167
- children: [v ? /* @__PURE__ */ q("label", {
2173
+ children: [v ? /* @__PURE__ */ J("label", {
2168
2174
  id: h,
2169
2175
  htmlFor: m,
2170
2176
  style: _,
2171
2177
  children: p
2172
- }) : /* @__PURE__ */ q("div", {
2178
+ }) : /* @__PURE__ */ J("div", {
2173
2179
  id: h,
2174
2180
  style: _,
2175
2181
  children: p
2176
- }), /* @__PURE__ */ q("div", {
2182
+ }), /* @__PURE__ */ J("div", {
2177
2183
  style: g,
2178
2184
  children: o || s ? n ? x({
2179
2185
  field: n,
@@ -2204,37 +2210,37 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2204
2210
  })]
2205
2211
  }, t._key);
2206
2212
  })
2207
- }), /* @__PURE__ */ q("div", {
2213
+ }), /* @__PURE__ */ J("div", {
2208
2214
  style: { marginTop: 10 },
2209
- children: /* @__PURE__ */ q(O, {
2215
+ children: /* @__PURE__ */ J(O, {
2210
2216
  kind: "ghost",
2211
2217
  size: "sm",
2212
- icon: /* @__PURE__ */ q(e.plus, { size: 14 }),
2218
+ icon: /* @__PURE__ */ J(e.plus, { size: 14 }),
2213
2219
  onClick: S,
2214
2220
  children: "Add row"
2215
2221
  })
2216
- })] }) : /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("div", {
2222
+ })] }) : /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
2217
2223
  style: { overflowX: "auto" },
2218
- children: /* @__PURE__ */ J("table", {
2224
+ children: /* @__PURE__ */ Y("table", {
2219
2225
  ref: m,
2220
- style: pe,
2226
+ style: fe,
2221
2227
  onKeyDown: k,
2222
- children: [/* @__PURE__ */ q("thead", { children: /* @__PURE__ */ J("tr", { children: [h.map((e) => {
2228
+ children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ Y("tr", { children: [h.map((e) => {
2223
2229
  let t = r.fields.get(e);
2224
- return /* @__PURE__ */ q("th", {
2230
+ return /* @__PURE__ */ J("th", {
2225
2231
  style: A,
2226
2232
  children: t ? d(t, e, i.entities) : e
2227
2233
  }, e);
2228
- }), /* @__PURE__ */ q("th", { style: {
2234
+ }), /* @__PURE__ */ J("th", { style: {
2229
2235
  ...A,
2230
2236
  width: 40
2231
- } })] }) }), /* @__PURE__ */ q("tbody", { children: a.map((t) => {
2237
+ } })] }) }), /* @__PURE__ */ J("tbody", { children: a.map((t) => {
2232
2238
  let n = !!t._deleted, i = s?.[t._key];
2233
- return /* @__PURE__ */ J("tr", {
2239
+ return /* @__PURE__ */ Y("tr", {
2234
2240
  style: { opacity: n ? .5 : 1 },
2235
2241
  children: [h.map((e) => {
2236
2242
  let a = r.fields.get(e), o = i?.includes(e), s = y.has(e);
2237
- return n || s ? /* @__PURE__ */ q("td", {
2243
+ return n || s ? /* @__PURE__ */ J("td", {
2238
2244
  style: {
2239
2245
  padding: "6px 12px",
2240
2246
  borderBottom: "1px solid var(--divider)",
@@ -2251,7 +2257,7 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2251
2257
  refs: c,
2252
2258
  locale: f
2253
2259
  }) : l(t[e])
2254
- }, e) : /* @__PURE__ */ q("td", {
2260
+ }, e) : /* @__PURE__ */ J("td", {
2255
2261
  style: {
2256
2262
  padding: "4px 4px",
2257
2263
  borderBottom: "1px solid var(--divider)",
@@ -2273,20 +2279,20 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2273
2279
  locale: f
2274
2280
  }) : l(t[e])
2275
2281
  }, e);
2276
- }), /* @__PURE__ */ q("td", {
2282
+ }), /* @__PURE__ */ J("td", {
2277
2283
  style: {
2278
2284
  padding: "4px 8px",
2279
2285
  borderBottom: "1px solid var(--divider)",
2280
2286
  verticalAlign: "middle"
2281
2287
  },
2282
- children: n ? /* @__PURE__ */ q(w, {
2288
+ children: n ? /* @__PURE__ */ J(w, {
2283
2289
  size: 24,
2284
- icon: /* @__PURE__ */ q(e.refresh, { size: 12 }),
2290
+ icon: /* @__PURE__ */ J(e.refresh, { size: 12 }),
2285
2291
  onClick: () => T(t._key),
2286
2292
  title: "Undo delete"
2287
- }) : /* @__PURE__ */ q(w, {
2293
+ }) : /* @__PURE__ */ J(w, {
2288
2294
  size: 24,
2289
- icon: /* @__PURE__ */ q(e.trash, { size: 12 }),
2295
+ icon: /* @__PURE__ */ J(e.trash, { size: 12 }),
2290
2296
  onClick: () => C(t._key),
2291
2297
  title: "Delete row"
2292
2298
  })
@@ -2294,12 +2300,12 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2294
2300
  }, t._key);
2295
2301
  }) })]
2296
2302
  })
2297
- }), /* @__PURE__ */ q("div", {
2303
+ }), /* @__PURE__ */ J("div", {
2298
2304
  style: { marginTop: 8 },
2299
- children: /* @__PURE__ */ q(O, {
2305
+ children: /* @__PURE__ */ J(O, {
2300
2306
  kind: "ghost",
2301
2307
  size: "xs",
2302
- icon: /* @__PURE__ */ q(e.plus, { size: 12 }),
2308
+ icon: /* @__PURE__ */ J(e.plus, { size: 12 }),
2303
2309
  onClick: S,
2304
2310
  children: "Add row"
2305
2311
  })
@@ -2307,25 +2313,25 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2307
2313
  }
2308
2314
  //#endregion
2309
2315
  //#region src/components/detail-layout/ChildrenBlock.tsx
2310
- var kt = _e(() => import("./DraggableChildrenTable-BDnJK0AU.js").then((e) => ({ default: e.DraggableChildrenTable })));
2316
+ var kt = ge(() => import("./DraggableChildrenTable-p2ZSdwzj.js").then((e) => ({ default: e.DraggableChildrenTable })));
2311
2317
  function At({ node: e, ctx: n }) {
2312
- let r = E(), i = e.children;
2318
+ let r = D(), i = e.children;
2313
2319
  if (!i) return null;
2314
2320
  let a = r.isPhone && n.relatedRecordsPresentation === "table";
2315
2321
  if (n.isNew && n.mode !== "edit") return null;
2316
2322
  let o = Ke(n.entity, i);
2317
- if (!o) return /* @__PURE__ */ J("div", {
2323
+ if (!o) return /* @__PURE__ */ Y("div", {
2318
2324
  className: "text-sm text-muted-foreground py-2",
2319
2325
  children: ["Unknown child relation: ", i]
2320
2326
  });
2321
2327
  let s = n.schema.entities[o.entity];
2322
- if (!s) return /* @__PURE__ */ J("div", {
2328
+ if (!s) return /* @__PURE__ */ Y("div", {
2323
2329
  className: "text-sm text-muted-foreground py-2",
2324
2330
  children: ["Entity not found: ", o.entity]
2325
2331
  });
2326
- let c = Pe(o, s, e), l = je(e, n), u = Y(e, n), d = (e) => c.mode === "timeline" || n.withinCard ? e : /* @__PURE__ */ q(ie, {
2332
+ let c = Pe(o, s, e), l = Ae(e, n), u = je(e, n), d = (e) => c.mode === "timeline" || n.withinCard ? e : /* @__PURE__ */ J(L, {
2327
2333
  title: l,
2328
- icon: u ? /* @__PURE__ */ q(t, {
2334
+ icon: u ? /* @__PURE__ */ J(t, {
2329
2335
  name: u,
2330
2336
  size: 14
2331
2337
  }) : void 0,
@@ -2333,9 +2339,9 @@ function At({ node: e, ctx: n }) {
2333
2339
  });
2334
2340
  if (n.mode === "edit" && c.editable && c.interaction !== "navigate" && c.interaction !== "readonly" && v(s, "update") && c.mode === "table" && n.pendingChildren !== void 0 && n.onChildrenChange) {
2335
2341
  let e = n.pendingChildren[i] ?? [], t = n.childValidationErrors?.[i], o = c.position_field ? r.isPhone && !a ? Ot : kt : Ot;
2336
- return d(/* @__PURE__ */ q(he, {
2337
- fallback: /* @__PURE__ */ q(L, {}),
2338
- children: /* @__PURE__ */ q(o, {
2342
+ return d(/* @__PURE__ */ J(me, {
2343
+ fallback: /* @__PURE__ */ J(ee, {}),
2344
+ children: /* @__PURE__ */ J(o, {
2339
2345
  config: c,
2340
2346
  childEntity: s,
2341
2347
  schema: n.schema,
@@ -2355,35 +2361,41 @@ function At({ node: e, ctx: n }) {
2355
2361
  schema: n.schema
2356
2362
  };
2357
2363
  switch (c.mode) {
2358
- case "list": return d(/* @__PURE__ */ q(nt, { ...f }));
2359
- case "cards": return d(/* @__PURE__ */ q(rt, { ...f }));
2360
- case "timeline": return d(/* @__PURE__ */ q(bt, { ...f }));
2361
- default: return r.isPhone && !a ? d(/* @__PURE__ */ q(rt, { ...f })) : d(/* @__PURE__ */ q(tt, { ...f }));
2364
+ case "list": return d(/* @__PURE__ */ J(nt, { ...f }));
2365
+ case "cards": return d(/* @__PURE__ */ J(rt, { ...f }));
2366
+ case "timeline": return d(/* @__PURE__ */ J(bt, { ...f }));
2367
+ default: return r.isPhone && !a ? d(/* @__PURE__ */ J(rt, { ...f })) : d(/* @__PURE__ */ J(tt, { ...f }));
2362
2368
  }
2363
2369
  }
2364
2370
  //#endregion
2365
2371
  //#region src/components/detail-layout/FieldRow.tsx
2366
- var jt = 150, Mt = 560, Nt = "20px", Pt = 4, Ft = /* @__PURE__ */ new Set([
2372
+ var jt = 150, Mt = 560, Nt = 270, Pt = "20px", Ft = 4, It = /* @__PURE__ */ new Set([
2367
2373
  "text",
2368
2374
  "rich_text",
2369
2375
  "json",
2370
2376
  "structure",
2371
2377
  "multilang_text"
2372
- ]), It = ge({ columns: 2 });
2373
- function Lt({ columns: e = 2, children: t }) {
2374
- let n = W(null), [r, i] = G(!1);
2375
- H(() => {
2376
- let t = n.current;
2377
- if (!t || e === 1 || typeof ResizeObserver > "u") return;
2378
- let r = new ResizeObserver(([e]) => {
2379
- i(e.contentRect.width < Mt);
2378
+ ]), Lt = he({
2379
+ columns: 2,
2380
+ stackPairs: !1
2381
+ });
2382
+ function Rt({ columns: e = 2, children: t }) {
2383
+ let n = G(null), [r, i] = K(null);
2384
+ U(() => {
2385
+ let e = n.current;
2386
+ if (!e || typeof ResizeObserver > "u") return;
2387
+ let t = new ResizeObserver(([e]) => {
2388
+ i(e.contentRect.width);
2380
2389
  });
2381
- return r.observe(t), () => r.disconnect();
2382
- }, [e]);
2383
- let a = e === 1 || r ? 1 : e;
2384
- return /* @__PURE__ */ q(It.Provider, {
2385
- value: { columns: a },
2386
- children: /* @__PURE__ */ q("div", {
2390
+ return t.observe(e), () => t.disconnect();
2391
+ }, []);
2392
+ let a = e === 1 || r !== null && r < Mt ? 1 : e, o = r === null ? null : (r - (a - 1) * 24) / a, s = o !== null && o < Nt;
2393
+ return /* @__PURE__ */ J(Lt.Provider, {
2394
+ value: {
2395
+ columns: a,
2396
+ stackPairs: s
2397
+ },
2398
+ children: /* @__PURE__ */ J("div", {
2387
2399
  ref: n,
2388
2400
  style: {
2389
2401
  display: "grid",
@@ -2395,9 +2407,9 @@ function Lt({ columns: e = 2, children: t }) {
2395
2407
  })
2396
2408
  });
2397
2409
  }
2398
- function Rt({ label: t, children: n, span: r = !1, required: i, error: a, hint: o, actions: s, copyValue: c, mode: l = "display", htmlFor: u, labelId: d, labelTitle: f, "data-testid": p }) {
2399
- let h = ve(It), g = r || h.columns === 1, _ = !!a;
2400
- return /* @__PURE__ */ J("div", {
2410
+ function zt({ label: t, children: n, span: r = !1, required: i, error: a, hint: o, actions: s, copyValue: c, mode: l = "display", htmlFor: u, labelId: d, labelTitle: f, "data-testid": p }) {
2411
+ let h = _e(Lt), g = r || h.stackPairs, _ = !!a;
2412
+ return /* @__PURE__ */ Y("div", {
2401
2413
  className: "detail-row",
2402
2414
  "data-error": _ || void 0,
2403
2415
  "data-testid": p,
@@ -2409,29 +2421,29 @@ function Rt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2409
2421
  padding: "6px 0",
2410
2422
  ...r ? { gridColumn: "1 / -1" } : null
2411
2423
  },
2412
- children: [/* @__PURE__ */ J("div", {
2424
+ children: [/* @__PURE__ */ Y("div", {
2413
2425
  style: {
2414
2426
  width: g ? "auto" : jt,
2415
2427
  flexShrink: 0,
2416
- paddingTop: g ? 0 : Pt,
2428
+ paddingTop: g ? 0 : Ft,
2417
2429
  fontSize: 12,
2418
- lineHeight: Nt,
2430
+ lineHeight: Pt,
2419
2431
  fontWeight: 500,
2420
2432
  color: "var(--text-3)",
2421
2433
  display: "flex",
2422
2434
  alignItems: "flex-start",
2423
2435
  gap: 2
2424
2436
  },
2425
- children: [u ? /* @__PURE__ */ q("label", {
2437
+ children: [u ? /* @__PURE__ */ J("label", {
2426
2438
  id: d,
2427
2439
  htmlFor: u,
2428
2440
  title: f || void 0,
2429
2441
  children: t
2430
- }) : /* @__PURE__ */ q("span", {
2442
+ }) : /* @__PURE__ */ J("span", {
2431
2443
  id: d,
2432
2444
  title: f || void 0,
2433
2445
  children: t
2434
- }), i && l === "edit" && /* @__PURE__ */ q("span", {
2446
+ }), i && l === "edit" && /* @__PURE__ */ J("span", {
2435
2447
  "aria-hidden": "true",
2436
2448
  style: {
2437
2449
  color: "var(--danger)",
@@ -2439,7 +2451,7 @@ function Rt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2439
2451
  },
2440
2452
  children: "*"
2441
2453
  })]
2442
- }), /* @__PURE__ */ J("div", {
2454
+ }), /* @__PURE__ */ Y("div", {
2443
2455
  style: {
2444
2456
  flex: 1,
2445
2457
  minWidth: 0,
@@ -2447,31 +2459,31 @@ function Rt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2447
2459
  flexDirection: "column",
2448
2460
  gap: 3
2449
2461
  },
2450
- children: [/* @__PURE__ */ J("div", {
2462
+ children: [/* @__PURE__ */ Y("div", {
2451
2463
  style: {
2452
2464
  display: "flex",
2453
2465
  alignItems: "flex-start",
2454
2466
  gap: 6,
2455
2467
  minHeight: 24
2456
2468
  },
2457
- children: [/* @__PURE__ */ q("div", {
2469
+ children: [/* @__PURE__ */ J("div", {
2458
2470
  style: {
2459
2471
  flex: 1,
2460
2472
  minWidth: 0,
2461
2473
  fontSize: 13,
2462
- lineHeight: Nt,
2474
+ lineHeight: Pt,
2463
2475
  color: "var(--text)",
2464
2476
  overflowWrap: "anywhere",
2465
- paddingTop: l === "display" && !g ? Pt : 0
2477
+ paddingTop: l === "display" && !g ? Ft : 0
2466
2478
  },
2467
- children: _ && l === "edit" ? /* @__PURE__ */ q("div", {
2479
+ children: _ && l === "edit" ? /* @__PURE__ */ J("div", {
2468
2480
  style: {
2469
2481
  borderRadius: 6,
2470
2482
  boxShadow: "0 0 0 1.5px var(--danger)"
2471
2483
  },
2472
2484
  children: n
2473
2485
  }) : n
2474
- }), (c || s) && /* @__PURE__ */ J("div", {
2486
+ }), (c || s) && /* @__PURE__ */ Y("div", {
2475
2487
  className: "detail-row-action",
2476
2488
  style: {
2477
2489
  display: "flex",
@@ -2479,13 +2491,13 @@ function Rt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2479
2491
  flexShrink: 0,
2480
2492
  marginTop: -2
2481
2493
  },
2482
- children: [c && /* @__PURE__ */ q(m, {
2494
+ children: [c && /* @__PURE__ */ J(m, {
2483
2495
  value: c,
2484
2496
  size: "sm",
2485
2497
  title: "Copy value"
2486
2498
  }), s]
2487
2499
  })]
2488
- }), (_ || o != null) && /* @__PURE__ */ J("div", {
2500
+ }), (_ || o != null) && /* @__PURE__ */ Y("div", {
2489
2501
  style: {
2490
2502
  fontSize: 11.5,
2491
2503
  lineHeight: 1.4,
@@ -2494,25 +2506,25 @@ function Rt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2494
2506
  alignItems: "center",
2495
2507
  gap: 4
2496
2508
  },
2497
- children: [_ && /* @__PURE__ */ q(e.warning, { size: 11 }), /* @__PURE__ */ q("span", { children: _ ? a : o })]
2509
+ children: [_ && /* @__PURE__ */ J(e.warning, { size: 11 }), /* @__PURE__ */ J("span", { children: _ ? a : o })]
2498
2510
  })]
2499
2511
  })]
2500
2512
  });
2501
2513
  }
2502
2514
  //#endregion
2503
2515
  //#region src/components/detail-layout/FieldsBlock.tsx
2504
- function zt({ fields: e, ctx: t }) {
2516
+ function Bt({ fields: e, ctx: t }) {
2505
2517
  let { entity: r, entityCode: i, record: a, mode: o, onFieldChange: s, schema: c } = t, u = n(), d = t.columns ?? 2, p = d === 1 && e.length === 1;
2506
- return /* @__PURE__ */ q(Lt, {
2518
+ return /* @__PURE__ */ J(Rt, {
2507
2519
  columns: d,
2508
2520
  children: e.map((e) => {
2509
- let n = e.name, d = `${i ?? "field"}-${n}`, m = `${d}-label`, h = r.fields.get(n), g = !!(h?.auto || h?.readonly || h?.source), _ = B(r, n), v = _?.read === "denied", y = _?.write === "denied", b = o === "display" ? v : y || v, x = g || o === "edit" && y ? "display" : o, S = b ? /* @__PURE__ */ q(oe, {
2521
+ let n = e.name, d = `${i ?? "field"}-${n}`, m = `${d}-label`, h = r.fields.get(n), g = !!(h?.auto || h?.readonly || h?.source), _ = ne(r, n), v = _?.read === "denied", y = _?.write === "denied", b = o === "display" ? v : y || v, x = g || o === "edit" && y ? "display" : o, S = b ? /* @__PURE__ */ J(ue, {
2510
2522
  tier: _.classification,
2511
- tierDef: ue(c, r, n),
2523
+ tierDef: B(c, r, n),
2512
2524
  requiredPermission: _?.required_permission,
2513
2525
  locale: u,
2514
2526
  variant: x === "edit" ? "input" : "value"
2515
- }) : se({
2527
+ }) : V({
2516
2528
  entity: r,
2517
2529
  entityCode: i,
2518
2530
  fieldName: n,
@@ -2524,20 +2536,21 @@ function zt({ fields: e, ctx: t }) {
2524
2536
  screens: c?.screens,
2525
2537
  locale: u,
2526
2538
  fieldId: d,
2527
- labelId: m
2539
+ labelId: m,
2540
+ structure: e.structure
2528
2541
  });
2529
2542
  if (!S) return null;
2530
- let C = o === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ q(K, { children: e.actions.map((e, t) => /* @__PURE__ */ q(F, {
2543
+ let C = o === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ J(q, { children: e.actions.map((e, t) => /* @__PURE__ */ J(z, {
2531
2544
  actionCode: `${n}.action[${t}]`,
2532
2545
  action: e,
2533
2546
  entityCode: i,
2534
2547
  row: a,
2535
2548
  variant: "ghost",
2536
2549
  size: "icon"
2537
- }, t)) }) : void 0, w = !!h && Ft.has(h.type), T = a?.[n], E = x === "display" && (h?.copyable || h?.type === "uuid") && T != null && T !== "" ? l(T) : void 0, D = f(h?.display?.description);
2538
- return p ? /* @__PURE__ */ J("div", {
2550
+ }, t)) }) : void 0, w = !!h && It.has(h.type), T = a?.[n], E = x === "display" && (h?.copyable || h?.type === "uuid") && T != null && T !== "" ? l(T) : void 0, D = f(h?.display?.description);
2551
+ return p ? /* @__PURE__ */ Y("div", {
2539
2552
  style: { gridColumn: "1 / -1" },
2540
- children: [S, x === "edit" && D && /* @__PURE__ */ q("div", {
2553
+ children: [S, x === "edit" && D && /* @__PURE__ */ J("div", {
2541
2554
  style: {
2542
2555
  fontSize: 11.5,
2543
2556
  lineHeight: 1.4,
@@ -2546,9 +2559,9 @@ function zt({ fields: e, ctx: t }) {
2546
2559
  },
2547
2560
  children: D
2548
2561
  })]
2549
- }, n) : /* @__PURE__ */ q(Rt, {
2562
+ }, n) : /* @__PURE__ */ J(zt, {
2550
2563
  "data-testid": `field-${n}`,
2551
- label: P(r, n, c.entities),
2564
+ label: le(r, n, c.entities),
2552
2565
  htmlFor: x === "edit" ? d : void 0,
2553
2566
  labelId: m,
2554
2567
  labelTitle: D || void 0,
@@ -2566,7 +2579,7 @@ function zt({ fields: e, ctx: t }) {
2566
2579
  }
2567
2580
  //#endregion
2568
2581
  //#region src/components/detail-layout/PropertiesBlock.tsx
2569
- var Bt = /* @__PURE__ */ new Set([
2582
+ var Vt = /* @__PURE__ */ new Set([
2570
2583
  "string",
2571
2584
  "text",
2572
2585
  "int",
@@ -2574,16 +2587,16 @@ var Bt = /* @__PURE__ */ new Set([
2574
2587
  "decimal",
2575
2588
  "email",
2576
2589
  "url"
2577
- ]), Vt = 500;
2578
- function Ht({ node: e, ctx: t }) {
2590
+ ]), Ht = 500;
2591
+ function Ut({ node: e, ctx: t }) {
2579
2592
  let { entity: n, objectProperties: i, onSetProperty: a, isNew: o, mode: s, refs: c } = t, l = n.properties ?? {};
2580
2593
  if (o) return null;
2581
2594
  let u = e.properties === !0 || e.properties, d = u === !0 ? Object.entries(l).sort(([e], [t]) => e.localeCompare(t)) : u.filter((e) => l[e] != null).map((e) => [e, l[e]]);
2582
- return d.length === 0 ? null : /* @__PURE__ */ q(Lt, {
2595
+ return d.length === 0 ? null : /* @__PURE__ */ J(Rt, {
2583
2596
  columns: 2,
2584
2597
  children: d.map(([e, o]) => {
2585
2598
  let l = i?.find((t) => t.property_code === e), u = r(o), d = o.readonly || !a ? "display" : s;
2586
- return /* @__PURE__ */ q(Ut, {
2599
+ return /* @__PURE__ */ J(Wt, {
2587
2600
  propCode: e,
2588
2601
  prop: o,
2589
2602
  field: u,
@@ -2597,25 +2610,25 @@ function Ht({ node: e, ctx: t }) {
2597
2610
  })
2598
2611
  });
2599
2612
  }
2600
- function Ut({ propCode: e, prop: t, field: r, value: i, mode: a, onSetProperty: o, refs: s, entity: c, schema: l }) {
2601
- let u = n(), d = W(null);
2602
- H(() => () => {
2613
+ function Wt({ propCode: e, prop: t, field: r, value: i, mode: a, onSetProperty: o, refs: s, entity: c, schema: l }) {
2614
+ let u = n(), d = G(null);
2615
+ U(() => () => {
2603
2616
  d.current && clearTimeout(d.current);
2604
2617
  }, []);
2605
- let p = V((n) => {
2606
- o && (Bt.has(t.type) ? (d.current && clearTimeout(d.current), d.current = setTimeout(() => o(e, n), Vt)) : o(e, n));
2618
+ let p = H((n) => {
2619
+ o && (Vt.has(t.type) ? (d.current && clearTimeout(d.current), d.current = setTimeout(() => o(e, n), Ht)) : o(e, n));
2607
2620
  }, [
2608
2621
  e,
2609
2622
  t.type,
2610
2623
  o
2611
- ]), m = B(c, e), h = m?.read === "denied", g = m?.write === "denied", _ = a === "display" ? h : g || h, v = a === "edit" && g ? "display" : a;
2612
- return /* @__PURE__ */ q(Rt, {
2624
+ ]), m = ne(c, e), h = m?.read === "denied", g = m?.write === "denied", _ = a === "display" ? h : g || h, v = a === "edit" && g ? "display" : a;
2625
+ return /* @__PURE__ */ J(zt, {
2613
2626
  label: f(t.display?.name ?? t.name),
2614
2627
  mode: v,
2615
- span: Ft.has(t.type),
2616
- children: _ ? /* @__PURE__ */ q(oe, {
2628
+ span: It.has(t.type),
2629
+ children: _ ? /* @__PURE__ */ J(ue, {
2617
2630
  tier: m.classification,
2618
- tierDef: ue(l, c, e),
2631
+ tierDef: B(l, c, e),
2619
2632
  requiredPermission: m?.required_permission,
2620
2633
  locale: u,
2621
2634
  variant: v === "edit" ? "input" : "value"
@@ -2632,9 +2645,9 @@ function Ut({ propCode: e, prop: t, field: r, value: i, mode: a, onSetProperty:
2632
2645
  }
2633
2646
  //#endregion
2634
2647
  //#region src/components/shared/StatusStepper.tsx
2635
- function Wt({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1 }) {
2648
+ function Gt({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1 }) {
2636
2649
  let o = t.findIndex((e) => e.code === n);
2637
- return /* @__PURE__ */ q("div", {
2650
+ return /* @__PURE__ */ J("div", {
2638
2651
  role: "list",
2639
2652
  style: {
2640
2653
  display: "flex",
@@ -2646,7 +2659,7 @@ function Wt({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
2646
2659
  },
2647
2660
  children: t.map((n, s) => {
2648
2661
  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%)";
2649
- return /* @__PURE__ */ J("button", {
2662
+ return /* @__PURE__ */ Y("button", {
2650
2663
  role: "listitem",
2651
2664
  type: "button",
2652
2665
  disabled: !d,
@@ -2670,7 +2683,7 @@ function Wt({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
2670
2683
  clipPath: g,
2671
2684
  whiteSpace: "nowrap"
2672
2685
  },
2673
- children: [/* @__PURE__ */ q("span", {
2686
+ children: [/* @__PURE__ */ J("span", {
2674
2687
  style: {
2675
2688
  width: 16,
2676
2689
  height: 16,
@@ -2685,8 +2698,8 @@ function Wt({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
2685
2698
  fontSize: 9.5,
2686
2699
  fontWeight: 700
2687
2700
  },
2688
- children: c ? /* @__PURE__ */ q(e.check, { size: 10 }) : s + 1
2689
- }), /* @__PURE__ */ q("span", {
2701
+ children: c ? /* @__PURE__ */ J(e.check, { size: 10 }) : s + 1
2702
+ }), /* @__PURE__ */ J("span", {
2690
2703
  style: {
2691
2704
  overflow: "hidden",
2692
2705
  textOverflow: "ellipsis"
@@ -2699,8 +2712,8 @@ function Wt({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
2699
2712
  }
2700
2713
  //#endregion
2701
2714
  //#region src/components/shared/StatusGroupsDisplay.tsx
2702
- function Gt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r, mode: i = "edit" }) {
2703
- return /* @__PURE__ */ q("div", {
2715
+ function Kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r, mode: i = "edit" }) {
2716
+ return /* @__PURE__ */ J("div", {
2704
2717
  style: {
2705
2718
  display: "flex",
2706
2719
  flexWrap: "wrap",
@@ -2711,27 +2724,27 @@ function Gt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2711
2724
  let o = t?.find((t) => t.group_code === e)?.status_code, s = o ? a.statuses.find((e) => e.code === o) : void 0;
2712
2725
  if (a.display_mode === "stepper") {
2713
2726
  let t = i === "edit", s = t ? a.transitions && o ? /* @__PURE__ */ new Set([o, ...a.transitions[o] ?? []]) : new Set(a.statuses.map((e) => e.code)) : void 0;
2714
- return /* @__PURE__ */ J("div", {
2727
+ return /* @__PURE__ */ Y("div", {
2715
2728
  style: {
2716
2729
  display: "flex",
2717
2730
  alignItems: "center",
2718
2731
  gap: 8,
2719
2732
  minWidth: 0
2720
2733
  },
2721
- children: [/* @__PURE__ */ J("span", {
2734
+ children: [/* @__PURE__ */ Y("span", {
2722
2735
  style: {
2723
2736
  fontSize: 12,
2724
2737
  color: "var(--text-3)",
2725
2738
  flexShrink: 0
2726
2739
  },
2727
2740
  children: [f(a.name), ":"]
2728
- }), /* @__PURE__ */ q("div", {
2741
+ }), /* @__PURE__ */ J("div", {
2729
2742
  style: {
2730
2743
  minWidth: 240,
2731
2744
  opacity: r ? .6 : 1,
2732
2745
  pointerEvents: r ? "none" : "auto"
2733
2746
  },
2734
- children: /* @__PURE__ */ q(Wt, {
2747
+ children: /* @__PURE__ */ J(Gt, {
2735
2748
  stages: a.statuses.map((e) => ({
2736
2749
  code: e.code,
2737
2750
  label: f(e.name)
@@ -2744,23 +2757,23 @@ function Gt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2744
2757
  })]
2745
2758
  }, e);
2746
2759
  }
2747
- if (i === "display") return /* @__PURE__ */ J("div", {
2760
+ if (i === "display") return /* @__PURE__ */ Y("div", {
2748
2761
  style: {
2749
2762
  display: "flex",
2750
2763
  alignItems: "center",
2751
2764
  gap: 8
2752
2765
  },
2753
- children: [/* @__PURE__ */ J("span", {
2766
+ children: [/* @__PURE__ */ Y("span", {
2754
2767
  style: {
2755
2768
  fontSize: 12,
2756
2769
  color: "var(--text-3)"
2757
2770
  },
2758
2771
  children: [f(a.name), ":"]
2759
- }), s ? /* @__PURE__ */ q(y, {
2772
+ }), s ? /* @__PURE__ */ J(y, {
2760
2773
  tone: s.color ?? "slate",
2761
2774
  size: "xs",
2762
2775
  children: f(s.name)
2763
- }) : /* @__PURE__ */ q("span", {
2776
+ }) : /* @__PURE__ */ J("span", {
2764
2777
  style: {
2765
2778
  fontSize: 12.5,
2766
2779
  color: "var(--text-4)"
@@ -2770,13 +2783,13 @@ function Gt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2770
2783
  }, e);
2771
2784
  let l = (a.transitions && o ? a.statuses.filter((e) => e.code === o || (a.transitions[o]?.includes(e.code) ?? !1)) : a.statuses).map((e) => ({
2772
2785
  value: e.code,
2773
- label: /* @__PURE__ */ J("span", {
2786
+ label: /* @__PURE__ */ Y("span", {
2774
2787
  style: {
2775
2788
  display: "inline-flex",
2776
2789
  alignItems: "center",
2777
2790
  gap: 6
2778
2791
  },
2779
- children: [e.color && /* @__PURE__ */ q("span", { style: {
2792
+ children: [e.color && /* @__PURE__ */ J("span", { style: {
2780
2793
  width: 8,
2781
2794
  height: 8,
2782
2795
  borderRadius: 999,
@@ -2785,25 +2798,25 @@ function Gt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2785
2798
  } }), f(e.name)]
2786
2799
  })
2787
2800
  }));
2788
- return /* @__PURE__ */ J("div", {
2801
+ return /* @__PURE__ */ Y("div", {
2789
2802
  style: {
2790
2803
  display: "flex",
2791
2804
  alignItems: "center",
2792
2805
  gap: 8
2793
2806
  },
2794
- children: [/* @__PURE__ */ J("span", {
2807
+ children: [/* @__PURE__ */ Y("span", {
2795
2808
  style: {
2796
2809
  fontSize: 12,
2797
2810
  color: "var(--text-3)"
2798
2811
  },
2799
2812
  children: [f(a.name), ":"]
2800
- }), /* @__PURE__ */ q("div", {
2813
+ }), /* @__PURE__ */ J("div", {
2801
2814
  style: {
2802
2815
  minWidth: 180,
2803
2816
  opacity: r ? .6 : 1,
2804
2817
  pointerEvents: r ? "none" : "auto"
2805
2818
  },
2806
- children: /* @__PURE__ */ q(c, {
2819
+ children: /* @__PURE__ */ J(c, {
2807
2820
  value: o ?? "",
2808
2821
  options: l,
2809
2822
  onChange: (t) => n(e, t),
@@ -2816,31 +2829,31 @@ function Gt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2816
2829
  }
2817
2830
  //#endregion
2818
2831
  //#region src/components/detail-layout/StatusesBlock.tsx
2819
- var Kt = () => {};
2820
- function qt({ node: e, ctx: t }) {
2832
+ var qt = () => {};
2833
+ function Jt({ node: e, ctx: t }) {
2821
2834
  let { entity: n, objectStatuses: r, onSetStatus: i, isStatusPending: a, isNew: o } = t, s = n.status_groups ?? {};
2822
2835
  if (o) return null;
2823
2836
  let c = e.statuses === !0 || e.statuses, l = Object.fromEntries(Object.entries(s).filter(([e]) => c === !0 || c.includes(e)));
2824
- return Object.keys(l).length === 0 ? null : /* @__PURE__ */ q(Gt, {
2837
+ return Object.keys(l).length === 0 ? null : /* @__PURE__ */ J(Kt, {
2825
2838
  statusGroups: l,
2826
2839
  objectStatuses: r,
2827
- onSetStatus: i ?? Kt,
2840
+ onSetStatus: i ?? qt,
2828
2841
  isPending: a ?? !1,
2829
2842
  mode: t.mode
2830
2843
  });
2831
2844
  }
2832
2845
  //#endregion
2833
2846
  //#region src/components/detail-layout/widgets/canonicalizeJson.ts
2834
- function Jt(e) {
2835
- if (Array.isArray(e)) return e.map(Jt);
2847
+ function Yt(e) {
2848
+ if (Array.isArray(e)) return e.map(Yt);
2836
2849
  if (typeof e == "object" && e) {
2837
2850
  let t = e, n = {};
2838
- for (let e of Object.keys(t).sort()) n[e] = Jt(t[e]);
2851
+ for (let e of Object.keys(t).sort()) n[e] = Yt(t[e]);
2839
2852
  return n;
2840
2853
  }
2841
2854
  return e;
2842
2855
  }
2843
- function Yt(e) {
2856
+ function Xt(e) {
2844
2857
  switch (typeof e) {
2845
2858
  case "string": return e;
2846
2859
  case "number":
@@ -2852,39 +2865,39 @@ function Yt(e) {
2852
2865
  default: return "";
2853
2866
  }
2854
2867
  }
2855
- function Xt(e) {
2868
+ function Zt(e) {
2856
2869
  if (e == null) return "";
2857
2870
  try {
2858
- return JSON.stringify(Jt(e), null, 2) ?? Yt(e);
2871
+ return JSON.stringify(Yt(e), null, 2) ?? Xt(e);
2859
2872
  } catch {
2860
- return Yt(e);
2873
+ return Xt(e);
2861
2874
  }
2862
2875
  }
2863
2876
  //#endregion
2864
2877
  //#region src/components/detail-layout/widgets/JsonDiffWidget.tsx
2865
- var Zt = "Audit change diff", Qt = _e(() => import("./MonacoJson-BG3S3GHX.js").then((e) => ({ default: e.MonacoJsonDiff }))), $t = _e(() => import("./MonacoJson-BG3S3GHX.js").then((e) => ({ default: e.MonacoJsonSource }))), en = _e(() => import("./JsonEditor-DoNmyrYd.js").then((e) => ({ default: e.JsonEditor })));
2866
- function tn() {
2867
- return /* @__PURE__ */ q("div", {
2878
+ var Qt = "Audit change diff", $t = ge(() => import("./MonacoJson-BG3S3GHX.js").then((e) => ({ default: e.MonacoJsonDiff }))), en = ge(() => import("./MonacoJson-BG3S3GHX.js").then((e) => ({ default: e.MonacoJsonSource }))), tn = ge(() => import("./JsonEditor-DoNmyrYd.js").then((e) => ({ default: e.JsonEditor })));
2879
+ function nn() {
2880
+ return /* @__PURE__ */ J("div", {
2868
2881
  className: "flex h-full w-full items-center justify-center text-sm text-muted-foreground",
2869
2882
  children: "Loading editor…"
2870
2883
  });
2871
2884
  }
2872
- function nn({ before: e, after: t }) {
2873
- return /* @__PURE__ */ q(he, {
2874
- fallback: /* @__PURE__ */ q(tn, {}),
2875
- children: /* @__PURE__ */ J("div", {
2885
+ function rn({ before: e, after: t }) {
2886
+ return /* @__PURE__ */ J(me, {
2887
+ fallback: /* @__PURE__ */ J(nn, {}),
2888
+ children: /* @__PURE__ */ Y("div", {
2876
2889
  className: "flex h-full w-full gap-2",
2877
2890
  role: "group",
2878
- "aria-label": Zt,
2879
- children: [/* @__PURE__ */ q("div", {
2891
+ "aria-label": Qt,
2892
+ children: [/* @__PURE__ */ J("div", {
2880
2893
  className: "min-w-0 flex-1",
2881
- children: /* @__PURE__ */ q(en, {
2894
+ children: /* @__PURE__ */ J(tn, {
2882
2895
  value: e,
2883
2896
  readOnly: !0
2884
2897
  })
2885
- }), /* @__PURE__ */ q("div", {
2898
+ }), /* @__PURE__ */ J("div", {
2886
2899
  className: "min-w-0 flex-1",
2887
- children: /* @__PURE__ */ q(en, {
2900
+ children: /* @__PURE__ */ J(tn, {
2888
2901
  value: t,
2889
2902
  readOnly: !0
2890
2903
  })
@@ -2892,18 +2905,18 @@ function nn({ before: e, after: t }) {
2892
2905
  })
2893
2906
  });
2894
2907
  }
2895
- function rn({ mode: e, onChange: t }) {
2896
- return /* @__PURE__ */ J("div", {
2908
+ function an({ mode: e, onChange: t }) {
2909
+ return /* @__PURE__ */ Y("div", {
2897
2910
  className: "inline-flex gap-1",
2898
2911
  role: "group",
2899
2912
  "aria-label": "Diff view mode",
2900
- children: [/* @__PURE__ */ q("button", {
2913
+ children: [/* @__PURE__ */ J("button", {
2901
2914
  type: "button",
2902
2915
  "aria-pressed": e === "diff",
2903
2916
  onClick: () => t("diff"),
2904
2917
  className: `rounded px-2 py-0.5 text-xs ${e === "diff" ? "bg-accent text-accent-foreground" : "text-muted-foreground"}`,
2905
2918
  children: "Diff"
2906
- }), /* @__PURE__ */ q("button", {
2919
+ }), /* @__PURE__ */ J("button", {
2907
2920
  type: "button",
2908
2921
  "aria-pressed": e === "source",
2909
2922
  onClick: () => t("source"),
@@ -2912,42 +2925,42 @@ function rn({ mode: e, onChange: t }) {
2912
2925
  })]
2913
2926
  });
2914
2927
  }
2915
- function an({ values: e, options: t }) {
2916
- let n = e.before, r = e.after, [i, a] = G(t?.default_mode === "source" ? "source" : "diff"), o = Xt(n), s = Xt(r);
2917
- return /* @__PURE__ */ J("div", {
2928
+ function on({ values: e, options: t }) {
2929
+ let n = e.before, r = e.after, i = t?.default_mode === "source" ? "source" : "diff", [a, o] = K(i), s = Zt(n), c = Zt(r);
2930
+ return /* @__PURE__ */ Y("div", {
2918
2931
  className: "flex flex-col gap-2",
2919
- children: [/* @__PURE__ */ J("div", {
2932
+ children: [/* @__PURE__ */ Y("div", {
2920
2933
  className: "flex items-center justify-between",
2921
- children: [/* @__PURE__ */ q(rn, {
2922
- mode: i,
2923
- onChange: a
2924
- }), o === s && /* @__PURE__ */ q("span", {
2934
+ children: [/* @__PURE__ */ J(an, {
2935
+ mode: a,
2936
+ onChange: o
2937
+ }), s === c && /* @__PURE__ */ J("span", {
2925
2938
  className: "text-xs text-muted-foreground",
2926
2939
  role: "status",
2927
2940
  children: "No field changes"
2928
2941
  })]
2929
- }), /* @__PURE__ */ q("div", {
2942
+ }), /* @__PURE__ */ J("div", {
2930
2943
  className: "h-[480px] w-full overflow-hidden rounded border",
2931
2944
  role: "group",
2932
- "aria-label": Zt,
2933
- children: /* @__PURE__ */ q(ae, {
2934
- fallback: /* @__PURE__ */ q(nn, {
2945
+ "aria-label": Qt,
2946
+ children: /* @__PURE__ */ J(ae, {
2947
+ fallback: /* @__PURE__ */ J(rn, {
2935
2948
  before: n,
2936
2949
  after: r
2937
2950
  }),
2938
- children: /* @__PURE__ */ q(he, {
2939
- fallback: /* @__PURE__ */ q(tn, {}),
2940
- children: i === "diff" ? /* @__PURE__ */ q(Qt, {
2941
- before: o,
2942
- after: s
2943
- }) : /* @__PURE__ */ J("div", {
2951
+ children: /* @__PURE__ */ J(me, {
2952
+ fallback: /* @__PURE__ */ J(nn, {}),
2953
+ children: a === "diff" ? /* @__PURE__ */ J($t, {
2954
+ before: s,
2955
+ after: c
2956
+ }) : /* @__PURE__ */ Y("div", {
2944
2957
  className: "flex h-full w-full gap-2",
2945
- children: [/* @__PURE__ */ q("div", {
2958
+ children: [/* @__PURE__ */ J("div", {
2946
2959
  className: "min-w-0 flex-1",
2947
- children: /* @__PURE__ */ q($t, { value: o })
2948
- }), /* @__PURE__ */ q("div", {
2960
+ children: /* @__PURE__ */ J(en, { value: s })
2961
+ }), /* @__PURE__ */ J("div", {
2949
2962
  className: "min-w-0 flex-1",
2950
- children: /* @__PURE__ */ q($t, { value: s })
2963
+ children: /* @__PURE__ */ J(en, { value: c })
2951
2964
  })]
2952
2965
  })
2953
2966
  })
@@ -2966,7 +2979,7 @@ function Q(e) {
2966
2979
  let n = Object.entries(t).filter((e) => typeof e[1] == "string");
2967
2980
  return n.length > 0 ? Object.fromEntries(n) : void 0;
2968
2981
  }
2969
- function on(e) {
2982
+ function sn(e) {
2970
2983
  return Array.isArray(e) ? e.flatMap((e) => {
2971
2984
  let t = Z(e);
2972
2985
  return !t || typeof t.field != "string" ? [] : [{
@@ -2976,7 +2989,7 @@ function on(e) {
2976
2989
  }];
2977
2990
  }) : [];
2978
2991
  }
2979
- function sn(e) {
2992
+ function cn(e) {
2980
2993
  if (!e || typeof e.entity != "string" || typeof e.scope_field != "string" || typeof e.window_field != "string") return;
2981
2994
  let t = Array.isArray(e.windows) ? e.windows.flatMap((e) => {
2982
2995
  let t = Z(e);
@@ -3011,7 +3024,7 @@ function sn(e) {
3011
3024
  filter_label: Q(r.filter_label),
3012
3025
  all_label: Q(r.all_label),
3013
3026
  empty_label: Q(r.empty_label),
3014
- columns: on(r.columns),
3027
+ columns: sn(r.columns),
3015
3028
  sort: typeof r.sort == "string" ? r.sort : void 0,
3016
3029
  limit: typeof r.limit == "number" ? Math.min(500, Math.max(1, r.limit)) : 200
3017
3030
  } : void 0, a = Z(e.drillthrough), o = a && typeof a.route == "string" && typeof a.scope_field == "string" && typeof a.window_field == "string" ? {
@@ -3036,7 +3049,7 @@ function sn(e) {
3036
3049
  drillthrough: o
3037
3050
  };
3038
3051
  }
3039
- function cn(e, t, n) {
3052
+ function ln(e, t, n) {
3040
3053
  if (e == null || e === "") return "N/A";
3041
3054
  if (t === "number") return new Intl.NumberFormat(n).format(Number(e));
3042
3055
  if (t === "percent_ratio") return new Intl.NumberFormat(n, {
@@ -3054,17 +3067,17 @@ function cn(e, t, n) {
3054
3067
  }
3055
3068
  return typeof e == "string" ? e : typeof e == "number" || typeof e == "bigint" || typeof e == "boolean" ? String(e) : "N/A";
3056
3069
  }
3057
- function ln(e, t) {
3070
+ function un(e, t) {
3058
3071
  return typeof e.id == "string" || typeof e.id == "number" ? String(e.id) : `row-${t}`;
3059
3072
  }
3060
- function un(e, t) {
3073
+ function dn(e, t) {
3061
3074
  return !t || Object.entries(t).every(([t, n]) => e[t] === n);
3062
3075
  }
3063
- function dn({ values: e, options: t }) {
3064
- let r = U(() => sn(t), [t]), i = n(), a = re(), o = e.scope, s = r?.windows.some((e) => e.code === r.default_window) ? r.default_window : r?.windows[0]?.code ?? "", [c, l] = G(s), [u, d] = G("");
3065
- H(() => {
3076
+ function fn({ values: e, options: t }) {
3077
+ let r = W(() => cn(t), [t]), i = n(), a = re(), o = e.scope, s = r?.windows.some((e) => e.code === r.default_window) ? r.default_window : r?.windows[0]?.code ?? "", [c, l] = K(s), [u, d] = K("");
3078
+ U(() => {
3066
3079
  l(s);
3067
- }, [s]), H(() => {
3080
+ }, [s]), U(() => {
3068
3081
  d("");
3069
3082
  }, [c]);
3070
3083
  let m = r ? [{
@@ -3091,12 +3104,12 @@ function dn({ values: e, options: t }) {
3091
3104
  sort: g?.sort,
3092
3105
  filters: _
3093
3106
  }, !!(g && o && c));
3094
- if (!r || !o) return /* @__PURE__ */ q("div", {
3107
+ if (!r || !o) return /* @__PURE__ */ J("div", {
3095
3108
  role: "alert",
3096
3109
  className: "rounded border border-destructive p-3 text-sm text-destructive",
3097
3110
  children: "Invalid entity_scorecard configuration."
3098
3111
  });
3099
- let y = h.data?.data?.[0], b = v.data?.data ?? [], x = g?.filter_field ? Array.from(new Set(b.map((e) => e[g.filter_field]).filter((e) => typeof e == "string" && e !== ""))).sort() : [], S = u && g?.filter_field ? b.filter((e) => e[g.filter_field] === u) : b, C = (e) => !u || !e.filtered || !g?.filter_field ? y?.[e.field] : b.find((t) => t[g.filter_field] === u && un(t, e.filtered?.where))?.[e.filtered.field], w = (e) => {
3112
+ let y = h.data?.data?.[0], b = v.data?.data ?? [], x = g?.filter_field ? Array.from(new Set(b.map((e) => e[g.filter_field]).filter((e) => typeof e == "string" && e !== ""))).sort() : [], S = u && g?.filter_field ? b.filter((e) => e[g.filter_field] === u) : b, C = (e) => !u || !e.filtered || !g?.filter_field ? y?.[e.field] : b.find((t) => t[g.filter_field] === u && dn(t, e.filtered?.where))?.[e.filtered.field], w = (e) => {
3100
3113
  let t = r.drillthrough;
3101
3114
  if (!t || !e.drillthrough_value) return;
3102
3115
  let n = [{
@@ -3118,52 +3131,52 @@ function dn({ values: e, options: t }) {
3118
3131
  value: e.drillthrough_value
3119
3132
  }), a(t.route, { search: new URLSearchParams({ filters: JSON.stringify(n) }).toString() });
3120
3133
  }, T = h.error ?? v.error;
3121
- return /* @__PURE__ */ J("div", {
3134
+ return /* @__PURE__ */ Y("div", {
3122
3135
  className: "flex min-w-0 flex-col gap-4",
3123
3136
  "aria-label": f(r.title, i) || "Scorecard",
3124
3137
  children: [
3125
- /* @__PURE__ */ J("div", {
3138
+ /* @__PURE__ */ Y("div", {
3126
3139
  className: "flex flex-wrap items-start justify-between gap-3",
3127
- children: [/* @__PURE__ */ J("div", {
3140
+ children: [/* @__PURE__ */ Y("div", {
3128
3141
  className: "min-w-0",
3129
3142
  children: [
3130
- r.title && /* @__PURE__ */ q("h3", {
3143
+ r.title && /* @__PURE__ */ J("h3", {
3131
3144
  className: "text-base font-semibold text-foreground",
3132
3145
  children: f(r.title, i)
3133
3146
  }),
3134
- r.description && /* @__PURE__ */ q("p", {
3147
+ r.description && /* @__PURE__ */ J("p", {
3135
3148
  className: "mt-1 text-sm text-muted-foreground",
3136
3149
  children: f(r.description, i)
3137
3150
  }),
3138
- r.intended_note && /* @__PURE__ */ q("p", {
3151
+ r.intended_note && /* @__PURE__ */ J("p", {
3139
3152
  className: "mt-1 text-xs text-muted-foreground",
3140
3153
  children: f(r.intended_note, i)
3141
3154
  })
3142
3155
  ]
3143
- }), /* @__PURE__ */ J("div", {
3156
+ }), /* @__PURE__ */ Y("div", {
3144
3157
  className: "flex flex-wrap items-center gap-2",
3145
- children: [/* @__PURE__ */ q("div", {
3158
+ children: [/* @__PURE__ */ J("div", {
3146
3159
  role: "group",
3147
3160
  "aria-label": "Scorecard window",
3148
3161
  className: "inline-flex rounded border border-border p-1",
3149
- children: r.windows.map((e) => /* @__PURE__ */ q("button", {
3162
+ children: r.windows.map((e) => /* @__PURE__ */ J("button", {
3150
3163
  type: "button",
3151
3164
  "aria-pressed": c === e.code,
3152
3165
  onClick: () => l(e.code),
3153
3166
  className: `rounded px-3 py-1.5 text-xs font-medium ${c === e.code ? "bg-accent text-accent-foreground" : "text-muted-foreground"}`,
3154
3167
  children: f(e.label, i) || e.code
3155
3168
  }, e.code))
3156
- }), g?.filter_field && /* @__PURE__ */ J("label", {
3169
+ }), g?.filter_field && /* @__PURE__ */ Y("label", {
3157
3170
  className: "flex items-center gap-2 text-xs text-muted-foreground",
3158
- children: [f(g.filter_label, i) || "Filter", /* @__PURE__ */ J("select", {
3171
+ children: [f(g.filter_label, i) || "Filter", /* @__PURE__ */ Y("select", {
3159
3172
  "aria-label": f(g.filter_label, i) || "Filter",
3160
3173
  value: u,
3161
3174
  onChange: (e) => d(e.target.value),
3162
3175
  className: "rounded border border-border bg-background px-2 py-1.5 text-foreground",
3163
- children: [/* @__PURE__ */ q("option", {
3176
+ children: [/* @__PURE__ */ J("option", {
3164
3177
  value: "",
3165
3178
  children: f(g.all_label, i) || "All"
3166
- }), x.map((e) => /* @__PURE__ */ q("option", {
3179
+ }), x.map((e) => /* @__PURE__ */ J("option", {
3167
3180
  value: e,
3168
3181
  children: e
3169
3182
  }, e))]
@@ -3171,60 +3184,60 @@ function dn({ values: e, options: t }) {
3171
3184
  })]
3172
3185
  })]
3173
3186
  }),
3174
- T && /* @__PURE__ */ q("div", {
3187
+ T && /* @__PURE__ */ J("div", {
3175
3188
  role: "alert",
3176
3189
  className: "rounded border border-destructive p-3 text-sm text-destructive",
3177
3190
  children: T instanceof Error ? T.message : "Scorecard data could not be loaded."
3178
3191
  }),
3179
- !T && !h.isLoading && !y && /* @__PURE__ */ q("div", {
3192
+ !T && !h.isLoading && !y && /* @__PURE__ */ J("div", {
3180
3193
  className: "rounded border border-border p-6 text-center text-sm text-muted-foreground",
3181
3194
  children: f(r.empty_label, i) || "No scorecard data."
3182
3195
  }),
3183
- y && /* @__PURE__ */ q("div", {
3196
+ y && /* @__PURE__ */ J("div", {
3184
3197
  className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",
3185
3198
  children: r.metrics.map((e) => {
3186
- let t = C(e), n = !!(r.drillthrough && e.drillthrough_value), a = /* @__PURE__ */ J(K, { children: [
3187
- /* @__PURE__ */ q("span", {
3199
+ let t = C(e), n = !!(r.drillthrough && e.drillthrough_value), a = /* @__PURE__ */ Y(q, { children: [
3200
+ /* @__PURE__ */ J("span", {
3188
3201
  className: "text-xs font-medium text-muted-foreground",
3189
3202
  children: f(e.label, i) || e.field
3190
3203
  }),
3191
- /* @__PURE__ */ q("strong", {
3204
+ /* @__PURE__ */ J("strong", {
3192
3205
  className: `mt-2 block text-2xl font-semibold ${e.attention && Number(t) > 0 ? "text-destructive" : "text-foreground"}`,
3193
- children: cn(t, e.format, i)
3206
+ children: ln(t, e.format, i)
3194
3207
  }),
3195
- e.help && /* @__PURE__ */ q("span", {
3208
+ e.help && /* @__PURE__ */ J("span", {
3196
3209
  className: "mt-1 block text-xs text-muted-foreground",
3197
3210
  children: f(e.help, i)
3198
3211
  })
3199
3212
  ] });
3200
- return n ? /* @__PURE__ */ q("button", {
3213
+ return n ? /* @__PURE__ */ J("button", {
3201
3214
  type: "button",
3202
3215
  onClick: () => w(e),
3203
3216
  className: "rounded border border-border bg-card p-3 text-left hover:bg-surface",
3204
3217
  children: a
3205
- }, e.field) : /* @__PURE__ */ q("article", {
3218
+ }, e.field) : /* @__PURE__ */ J("article", {
3206
3219
  className: "rounded border border-border bg-card p-3",
3207
3220
  children: a
3208
3221
  }, e.field);
3209
3222
  })
3210
3223
  }),
3211
- g && /* @__PURE__ */ q("div", {
3224
+ g && /* @__PURE__ */ J("div", {
3212
3225
  className: "min-w-0 overflow-x-auto rounded border border-border",
3213
- children: /* @__PURE__ */ J("table", {
3226
+ children: /* @__PURE__ */ Y("table", {
3214
3227
  className: "w-full border-collapse text-sm",
3215
- children: [/* @__PURE__ */ q("thead", {
3228
+ children: [/* @__PURE__ */ J("thead", {
3216
3229
  className: "bg-surface text-left text-xs text-muted-foreground",
3217
- children: /* @__PURE__ */ q("tr", { children: g.columns.map((e) => /* @__PURE__ */ q("th", {
3230
+ children: /* @__PURE__ */ J("tr", { children: g.columns.map((e) => /* @__PURE__ */ J("th", {
3218
3231
  className: "border-b border-divider px-3 py-2 font-medium",
3219
3232
  children: f(e.label, i) || e.field
3220
3233
  }, e.field)) })
3221
- }), /* @__PURE__ */ J("tbody", { children: [S.map((e, t) => /* @__PURE__ */ q("tr", {
3234
+ }), /* @__PURE__ */ Y("tbody", { children: [S.map((e, t) => /* @__PURE__ */ J("tr", {
3222
3235
  className: "border-b border-divider last:border-0",
3223
- children: g.columns.map((t) => /* @__PURE__ */ q("td", {
3236
+ children: g.columns.map((t) => /* @__PURE__ */ J("td", {
3224
3237
  className: "px-3 py-2 text-foreground",
3225
- children: cn(e[t.field], t.format, i)
3238
+ children: ln(e[t.field], t.format, i)
3226
3239
  }, t.field))
3227
- }, ln(e, t))), !v.isLoading && S.length === 0 && /* @__PURE__ */ q("tr", { children: /* @__PURE__ */ q("td", {
3240
+ }, un(e, t))), !v.isLoading && S.length === 0 && /* @__PURE__ */ J("tr", { children: /* @__PURE__ */ J("td", {
3228
3241
  colSpan: Math.max(1, g.columns.length),
3229
3242
  className: "px-3 py-6 text-center text-muted-foreground",
3230
3243
  children: f(g.empty_label, i) || "No breakdown rows."
@@ -3236,29 +3249,29 @@ function dn({ values: e, options: t }) {
3236
3249
  }
3237
3250
  //#endregion
3238
3251
  //#region src/components/detail-layout/widgets/builtins.ts
3239
- var fn = !1;
3240
- function pn() {
3241
- fn ||= (ce("json_diff", an), ce("entity_scorecard", dn), !0);
3252
+ var pn = !1;
3253
+ function mn() {
3254
+ pn ||= (se("json_diff", on), se("entity_scorecard", fn), !0);
3242
3255
  }
3243
3256
  //#endregion
3244
3257
  //#region src/components/detail-layout/widgets/WidgetHost.tsx
3245
- pn();
3246
- function mn({ config: e, ctx: t }) {
3247
- let n = le(e.type);
3248
- if (!n) return /* @__PURE__ */ q("span", {
3258
+ mn();
3259
+ function hn({ config: e, ctx: t }) {
3260
+ let n = ce(e.type);
3261
+ if (!n) return /* @__PURE__ */ J("span", {
3249
3262
  className: "text-sm text-muted-foreground",
3250
3263
  children: `unknown widget: ${e.type}`
3251
3264
  });
3252
3265
  let r = e.inputs ?? {}, i = t.record, a = {};
3253
3266
  for (let [e, t] of Object.entries(r)) a[e] = i[t];
3254
- return /* @__PURE__ */ q("div", {
3267
+ return /* @__PURE__ */ J("div", {
3255
3268
  style: {
3256
3269
  minWidth: 0,
3257
3270
  maxWidth: "100%",
3258
3271
  overflowX: "auto",
3259
3272
  WebkitOverflowScrolling: "touch"
3260
3273
  },
3261
- children: /* @__PURE__ */ q(n, {
3274
+ children: /* @__PURE__ */ J(n, {
3262
3275
  inputs: r,
3263
3276
  values: a,
3264
3277
  record: i,
@@ -3269,45 +3282,45 @@ function mn({ config: e, ctx: t }) {
3269
3282
  }
3270
3283
  //#endregion
3271
3284
  //#region src/components/detail-layout/LayoutRenderer.tsx
3272
- function hn({ nodes: e, ctx: t }) {
3273
- return /* @__PURE__ */ q(K, { children: e.map((e, n) => /* @__PURE__ */ q($, {
3285
+ function gn({ nodes: e, ctx: t }) {
3286
+ return /* @__PURE__ */ J(q, { children: e.map((e, n) => /* @__PURE__ */ J($, {
3274
3287
  node: e,
3275
3288
  ctx: t
3276
3289
  }, n)) });
3277
3290
  }
3278
3291
  function $({ node: e, ctx: t }) {
3279
- return e.row ? /* @__PURE__ */ q(Ee, {
3292
+ return e.row ? /* @__PURE__ */ J(Te, {
3280
3293
  config: e.row,
3281
3294
  ctx: t
3282
- }) : e.column ? /* @__PURE__ */ q(ke, {
3295
+ }) : e.column ? /* @__PURE__ */ J(Oe, {
3283
3296
  config: e.column,
3284
3297
  node: e,
3285
3298
  ctx: t
3286
- }) : e.tabs ? /* @__PURE__ */ q(Me, {
3299
+ }) : e.tabs ? /* @__PURE__ */ J(Me, {
3287
3300
  config: e.tabs,
3288
3301
  ctx: t
3289
- }) : e.section ? /* @__PURE__ */ q(Ne, {
3302
+ }) : e.section ? /* @__PURE__ */ J(Ne, {
3290
3303
  config: e.section,
3291
3304
  ctx: t
3292
- }) : e.children ? /* @__PURE__ */ q(At, {
3305
+ }) : e.children ? /* @__PURE__ */ J(At, {
3293
3306
  node: e,
3294
3307
  ctx: t
3295
- }) : e.associated ? /* @__PURE__ */ q(ee, {
3308
+ }) : e.associated ? /* @__PURE__ */ J(ie, {
3296
3309
  node: e,
3297
3310
  ctx: t
3298
- }) : e.fields ? /* @__PURE__ */ q(zt, {
3311
+ }) : e.fields ? /* @__PURE__ */ J(Bt, {
3299
3312
  fields: e.fields,
3300
3313
  ctx: t
3301
- }) : e.properties == null ? e.statuses == null ? e.widget ? /* @__PURE__ */ q(mn, {
3314
+ }) : e.properties == null ? e.statuses == null ? e.widget ? /* @__PURE__ */ J(hn, {
3302
3315
  config: e.widget,
3303
3316
  ctx: t
3304
- }) : null : /* @__PURE__ */ q(qt, {
3317
+ }) : null : /* @__PURE__ */ J(Jt, {
3305
3318
  node: e,
3306
3319
  ctx: t
3307
- }) : /* @__PURE__ */ q(Ht, {
3320
+ }) : /* @__PURE__ */ J(Ut, {
3308
3321
  node: e,
3309
3322
  ctx: t
3310
3323
  });
3311
3324
  }
3312
3325
  //#endregion
3313
- export { Gt as n, hn as t };
3326
+ export { Kt as n, gn as t };