@declarion/react 0.31.1 → 0.32.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 (41) hide show
  1. package/dist-lib/{ActionRunner-BzaZQtiI.js → ActionRunner-CaSrGpBi.js} +264 -260
  2. package/dist-lib/{DraggableChildrenTable-DILqStHQ.js → DraggableChildrenTable-CAHg7paQ.js} +1 -1
  3. package/dist-lib/{Grid-BIsiUwPh.js → Grid-DDbBhqcl.js} +2 -2
  4. package/dist-lib/{LayoutRenderer-3RvIsC9M.js → LayoutRenderer-CelsqsZ6.js} +433 -433
  5. package/dist-lib/{MarkdownRenderer-CaHhWrfm.js → MarkdownRenderer-DThy2ixe.js} +1 -1
  6. package/dist-lib/RefreshControl-CorluL6r.js +582 -0
  7. package/dist-lib/{SmartDetailPage.impl--EO-9fos.js → SmartDetailPage.impl-USIxbl-8.js} +449 -411
  8. package/dist-lib/{SmartRecordListPage.impl-B1iws8yf.js → SmartRecordListPage.impl-BKIpTNK7.js} +210 -210
  9. package/dist-lib/api/data.d.ts +4 -4
  10. package/dist-lib/api/params.d.ts +1 -1
  11. package/dist-lib/components/layout/Rail.d.ts +5 -5
  12. package/dist-lib/components/layout/TopBar.d.ts +3 -1
  13. package/dist-lib/components/pages/auth/AuthShell.d.ts +1 -1
  14. package/dist-lib/components/pages/list/ListHeader.d.ts +1 -1
  15. package/dist-lib/components/primitives/BrandLogo.d.ts +1 -1
  16. package/dist-lib/components/shared/ActionRunner.d.ts +1 -0
  17. package/dist-lib/components/shared/ObjectActionBar.d.ts +29 -0
  18. package/dist-lib/components/shared/PageHeader.d.ts +1 -1
  19. package/dist-lib/components/shared/RecordHeader.d.ts +2 -1
  20. package/dist-lib/components/shared/RefreshControl.d.ts +6 -0
  21. package/dist-lib/hooks/useBranding.d.ts +8 -0
  22. package/dist-lib/hooks/useBrandingChrome.d.ts +6 -0
  23. package/dist-lib/hooks/useLiveObject.d.ts +9 -0
  24. package/dist-lib/hooks/useMutations.d.ts +3 -3
  25. package/dist-lib/hooks/useObject.d.ts +10 -0
  26. package/dist-lib/hooks/usePageStateRuntime.d.ts +1 -1
  27. package/dist-lib/hooks/useParams.d.ts +10 -1
  28. package/dist-lib/index.d.ts +11 -5
  29. package/dist-lib/index.js +1890 -1722
  30. package/dist-lib/lib/actions.d.ts +6 -2
  31. package/dist-lib/lib/branding.d.ts +10 -1
  32. package/dist-lib/{registry-2KliNTHB.js → registry-KQyyL5Gt.js} +1452 -1401
  33. package/dist-lib/testing.d.ts +5 -3
  34. package/dist-lib/testing.js +35 -31
  35. package/dist-lib/types/api.d.ts +70 -3
  36. package/dist-lib/types/schema.d.ts +1 -15
  37. package/dist-lib/{useProperties-Co3RdtuT.js → useProperties-D74hyWIa.js} +53 -53
  38. package/dist-lib/{value-BooGwUik.js → value-BfXXl5EE.js} +1 -1
  39. package/package.json +1 -1
  40. package/dist-lib/hooks/useEntityItem.d.ts +0 -10
  41. package/dist-lib/peekDraftStore-yyzMbaiI.js +0 -468
@@ -1,8 +1,8 @@
1
1
  import { s as e, t } from "./DynamicIcon-DCRdxxZ7.js";
2
- import { $ as n, B as r, Bn as i, F as a, Fn as o, H as s, Hn as c, I as l, Ot as u, Q as d, V as f, Vn as p, Xt as m, an as h, cn as g, dn as _, f as v, fn as y, gn as b, h as x, kn as S, m as C, nn as w, on as T, p as E, rn as D, sn as O, tn as k, wn as A } from "./ActionRunner-BzaZQtiI.js";
3
- import { E as j, G as M, K as N, Q as ee, T as P, U as F, W as I, Z as L, _t as R, d as z, gt as B, k as V, o as te, r as ne, t as re, u as ie, ut as ae } from "./registry-2KliNTHB.js";
4
- import { n as oe, r as se, t as ce } from "./dataTableStyles-vwD1mVOP.js";
5
- import { Suspense as le, createContext as ue, lazy as de, useCallback as H, useContext as fe, useEffect as U, useId as pe, useLayoutEffect as me, useMemo as W, useRef as G, useState as K } from "react";
2
+ import { Bn as n, F as r, Fn as i, Hn as a, I as o, Ot as s, R as c, Vn as l, Xt as u, an as d, cn as f, dn as p, et as m, f as h, fn as g, ft as _, gn as v, h as y, kn as b, m as x, nn as S, nt as C, on as w, p as T, rn as E, sn as D, tn as O, tt as k, wn as A } from "./ActionRunner-CaSrGpBi.js";
3
+ import { E as j, J as M, K as ee, T as te, Y as N, bt as P, d as F, et as I, k as L, o as R, pt as z, q as B, r as ne, t as re, tt as ie, u as ae, yt as oe } from "./registry-KQyyL5Gt.js";
4
+ import { n as se, r as ce, t as le } from "./dataTableStyles-vwD1mVOP.js";
5
+ import { Suspense as ue, createContext as de, lazy as V, useCallback as H, useContext as fe, useEffect as U, useId as pe, useLayoutEffect as me, useMemo as W, useRef as G, useState as K } from "react";
6
6
  import { useInfiniteQuery as he, useMutation as ge, useQueryClient as _e } from "@tanstack/react-query";
7
7
  import { Fragment as q, jsx as J, jsxs as Y } from "react/jsx-runtime";
8
8
  //#region src/lib/size-value.ts
@@ -61,16 +61,16 @@ function be({ config: e, ctx: t }) {
61
61
  }, [u, p]), h = u ?? p(), g = e.height ? Se(e.height) : void 0;
62
62
  return /* @__PURE__ */ J("div", {
63
63
  ref: l,
64
- className: ae("flex", s && "flex-col"),
64
+ className: z("flex", s && "flex-col"),
65
65
  style: {
66
66
  gap: r ? `${r}px` : void 0,
67
67
  ...g
68
68
  },
69
69
  children: n.map((r, a) => /* @__PURE__ */ Y("div", {
70
- className: ae("min-w-0 flex items-stretch", s && "w-full"),
70
+ className: z("min-w-0 flex items-stretch", s && "w-full"),
71
71
  style: s ? void 0 : xe(r.width ?? r.column?.width ?? r.row?.width ?? e.width, h[a], r.min_width, r.max_width),
72
72
  children: [/* @__PURE__ */ J("div", {
73
- className: ae("flex-1 min-w-0 flex flex-col", g && "overflow-y-auto overflow-x-hidden"),
73
+ className: z("flex-1 min-w-0 flex flex-col", g && "overflow-y-auto overflow-x-hidden"),
74
74
  children: /* @__PURE__ */ J($, {
75
75
  node: r,
76
76
  ctx: t
@@ -123,13 +123,13 @@ function we(e) {
123
123
  function X(e, t) {
124
124
  let n = we(e);
125
125
  if (n) {
126
- if (e.label) return T(e.label);
126
+ if (e.label) return w(e.label);
127
127
  let r = t.entity.children?.find((e) => e.entity === n);
128
- if (r?.display?.name) return T(r.display.name);
128
+ if (r?.display?.name) return w(r.display.name);
129
129
  let i = t.schema.entities[n];
130
- return i && (T(i.display.name_plural) || T(i.display.name)) || n;
130
+ return i && (w(i.display.name_plural) || w(i.display.name)) || n;
131
131
  }
132
- return e.section ? T(e.section.name) : "Tab";
132
+ return e.section ? w(e.section.name) : "Tab";
133
133
  }
134
134
  function Z(e, t) {
135
135
  if (e.icon) return e.icon;
@@ -144,7 +144,7 @@ function Z(e, t) {
144
144
  //#endregion
145
145
  //#region src/components/detail-layout/LayoutTabs.tsx
146
146
  function Te({ config: e, ctx: n }) {
147
- let { items: r } = e, [i, a] = K(0), s = o(), c = n.detailTabsPresentation ?? (s.isPhone ? "sections" : "scroll");
147
+ let { items: r } = e, [a, o] = K(0), s = i(), c = n.detailTabsPresentation ?? (s.isPhone ? "sections" : "scroll");
148
148
  if (r.length === 0) return null;
149
149
  if (c === "sections") {
150
150
  let e = r.map((e, t) => `detail-tab-section-${t}`);
@@ -268,12 +268,12 @@ function Te({ config: e, ctx: n }) {
268
268
  overflowX: "auto"
269
269
  },
270
270
  children: r.map((e, r) => {
271
- let o = X(e, n), s = Z(e, n), c = r === i;
271
+ let i = X(e, n), s = Z(e, n), c = r === a;
272
272
  return /* @__PURE__ */ Y("button", {
273
273
  role: "tab",
274
274
  "aria-selected": c,
275
275
  onClick: (e) => {
276
- e.stopPropagation(), a(r);
276
+ e.stopPropagation(), o(r);
277
277
  },
278
278
  style: {
279
279
  position: "relative",
@@ -302,7 +302,7 @@ function Te({ config: e, ctx: n }) {
302
302
  name: s,
303
303
  size: 13
304
304
  }),
305
- o,
305
+ i,
306
306
  c && /* @__PURE__ */ J("span", { style: {
307
307
  position: "absolute",
308
308
  left: 4,
@@ -319,12 +319,12 @@ function Te({ config: e, ctx: n }) {
319
319
  role: "tabpanel",
320
320
  style: { padding: 14 },
321
321
  children: /* @__PURE__ */ J($, {
322
- node: r[i],
322
+ node: r[a],
323
323
  ctx: {
324
324
  ...n,
325
325
  withinCard: !0
326
326
  }
327
- }, i)
327
+ }, a)
328
328
  })]
329
329
  });
330
330
  }
@@ -339,12 +339,12 @@ function Ee({ config: e, ctx: n }) {
339
339
  name: s,
340
340
  size: 14
341
341
  }) : void 0, f = c ? {
342
- text: T(c.text),
342
+ text: w(c.text),
343
343
  tone: c.tone,
344
344
  dot: c.dot
345
345
  } : void 0;
346
- return /* @__PURE__ */ J(R, {
347
- title: T(r),
346
+ return /* @__PURE__ */ J(P, {
347
+ title: w(r),
348
348
  defaultOpen: !a,
349
349
  icon: d,
350
350
  badge: f,
@@ -383,7 +383,7 @@ function Q(e, t, n) {
383
383
  return e ?? t ?? n;
384
384
  }
385
385
  function Oe(e) {
386
- return k(e, "update") ? "inline_edit" : "readonly";
386
+ return O(e, "update") ? "inline_edit" : "readonly";
387
387
  }
388
388
  function ke(e) {
389
389
  return e.display.name_plural && Object.keys(e.display.name_plural).length > 0 ? e.display.name_plural : e.display.name;
@@ -459,7 +459,7 @@ function Le(e, ...t) {
459
459
  }
460
460
  }
461
461
  function Re(e) {
462
- let t = h(e);
462
+ let t = d(e);
463
463
  return t.length > 0 ? t[0] : void 0;
464
464
  }
465
465
  function ze(e, t) {
@@ -473,7 +473,7 @@ function Be(e, t, n, r) {
473
473
  ...e
474
474
  };
475
475
  if (Array.isArray(n)) {
476
- let e = Array.isArray(r) ? r.map(String) : g(String(r), n.length);
476
+ let e = Array.isArray(r) ? r.map(String) : f(String(r), n.length);
477
477
  if (!e || e.length !== n.length) throw Error("invalid composite parent id");
478
478
  for (let t = 0; t < n.length; t++) i[n[t]] = e[t];
479
479
  } else i[n] = Array.isArray(r) ? r[0] : r;
@@ -489,26 +489,26 @@ function Ve(e, t) {
489
489
  //#endregion
490
490
  //#region src/components/detail-layout/useQuickAdd.ts
491
491
  function He(e, t, n, i) {
492
- let [o, s] = K(() => {
493
- let t = e.quick_add, n = i.entities[e.entity], r = {};
494
- if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (r[e] = a()) : r[e] = t.defaults[e];
495
- return r;
496
- }), c = _e(), { mutate: l, isPending: u, error: d, reset: f } = ge({
497
- mutationFn: (t) => r(e.entity, t),
492
+ let [a, o] = K(() => {
493
+ let t = e.quick_add, n = i.entities[e.entity], a = {};
494
+ if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (a[e] = r()) : a[e] = t.defaults[e];
495
+ return a;
496
+ }), s = _e(), { mutate: c, isPending: l, error: u, reset: d } = ge({
497
+ mutationFn: (t) => m(e.entity, t),
498
498
  onMutate: async (r) => {
499
499
  let i = [
500
500
  M,
501
501
  t,
502
- Array.isArray(n) ? O(n.map(String)) : n,
502
+ Array.isArray(n) ? D(n.map(String)) : n,
503
503
  e.entity
504
504
  ];
505
- await c.cancelQueries({ queryKey: i });
506
- let a = c.getQueriesData({ queryKey: i }), o = {
505
+ await s.cancelQueries({ queryKey: i });
506
+ let a = s.getQueriesData({ queryKey: i }), o = {
507
507
  ...r,
508
508
  id: `__optimistic_${crypto.randomUUID()}`,
509
509
  __optimistic: !0
510
510
  };
511
- return c.setQueriesData({ queryKey: i }, (e) => {
511
+ return s.setQueriesData({ queryKey: i }, (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;
@@ -524,38 +524,38 @@ function He(e, t, n, i) {
524
524
  }), { snapshots: a };
525
525
  },
526
526
  onError: (e, t, n) => {
527
- if (n?.snapshots) for (let [e, t] of n.snapshots) c.setQueryData(e, t);
527
+ if (n?.snapshots) for (let [e, t] of n.snapshots) s.setQueryData(e, t);
528
528
  },
529
529
  onSuccess: () => {
530
- let t = e.quick_add, n = i.entities[e.entity], r = {};
531
- if (t?.fields) for (let e of t.fields) t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? r[e] = a() : r[e] = "" : r[e] = t.defaults[e];
532
- s(r);
530
+ let t = e.quick_add, n = i.entities[e.entity], a = {};
531
+ if (t?.fields) for (let e of t.fields) t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? a[e] = r() : a[e] = "" : a[e] = t.defaults[e];
532
+ o(a);
533
533
  },
534
534
  onSettled: () => {
535
- let r = Array.isArray(n) ? O(n.map(String)) : n;
536
- c.invalidateQueries({ queryKey: [
535
+ let r = Array.isArray(n) ? D(n.map(String)) : n;
536
+ s.invalidateQueries({ queryKey: [
537
537
  M,
538
538
  t,
539
539
  r,
540
540
  e.entity
541
541
  ] });
542
542
  }
543
- }), p = e.quick_add, m = i.entities[e.entity], h = Ve(o, p?.fields.filter((e) => m?.fields.get(e)?.required) ?? []);
543
+ }), f = e.quick_add, p = i.entities[e.entity], h = Ve(a, f?.fields.filter((e) => p?.fields.get(e)?.required) ?? []);
544
544
  function g(t) {
545
- t.preventDefault(), p && l(Be(o, p.defaults, e.foreign_key, n));
545
+ t.preventDefault(), f && c(Be(a, f.defaults, e.foreign_key, n));
546
546
  }
547
547
  function _(e, t) {
548
- d && f(), s((n) => ({
548
+ u && d(), o((n) => ({
549
549
  ...n,
550
550
  [e]: t
551
551
  }));
552
552
  }
553
553
  return {
554
- values: o,
555
- quickAdd: p,
556
- childEntity: m,
557
- isPending: u,
558
- error: d,
554
+ values: a,
555
+ quickAdd: f,
556
+ childEntity: p,
557
+ isPending: l,
558
+ error: u,
559
559
  isReady: h,
560
560
  handleSubmit: g,
561
561
  handleFieldChange: _
@@ -563,9 +563,9 @@ function He(e, t, n, i) {
563
563
  }
564
564
  //#endregion
565
565
  //#region src/components/detail-layout/QuickAddForm.tsx
566
- function Ue({ config: t, parentEntity: n, parentId: r, schema: i }) {
567
- let { values: a, quickAdd: s, childEntity: l, isPending: u, error: d, isReady: f, handleSubmit: p, handleFieldChange: m } = He(t, n, r, i), h = E(), g = o(), _ = pe();
568
- return !s || s.fields.length === 0 || !l ? null : /* @__PURE__ */ Y("form", {
566
+ function Ue({ config: t, parentEntity: n, parentId: r, schema: o }) {
567
+ let { values: s, quickAdd: c, childEntity: l, isPending: u, error: d, isReady: f, handleSubmit: p, handleFieldChange: m } = He(t, n, r, o), h = T(), g = i(), _ = pe();
568
+ return !c || c.fields.length === 0 || !l ? null : /* @__PURE__ */ Y("form", {
569
569
  onSubmit: p,
570
570
  style: {
571
571
  display: "flex",
@@ -576,10 +576,10 @@ function Ue({ config: t, parentEntity: n, parentId: r, schema: i }) {
576
576
  borderBottom: "1px solid var(--divider)"
577
577
  },
578
578
  children: [
579
- s.fields.map((e) => {
579
+ c.fields.map((e) => {
580
580
  let n = l.fields.get(e);
581
581
  if (!n) return null;
582
- let r = `${_}-quick-add-${t.entity}-${e}`, o = `${r}-label`;
582
+ let r = `${_}-quick-add-${t.entity}-${e}`, i = `${r}-label`;
583
583
  return /* @__PURE__ */ Y("div", {
584
584
  style: {
585
585
  flex: 1,
@@ -587,7 +587,7 @@ function Ue({ config: t, parentEntity: n, parentId: r, schema: i }) {
587
587
  width: g.isPhone ? "100%" : void 0
588
588
  },
589
589
  children: [/* @__PURE__ */ J("label", {
590
- id: o,
590
+ id: i,
591
591
  htmlFor: r,
592
592
  style: {
593
593
  fontSize: 11,
@@ -596,21 +596,21 @@ function Ue({ config: t, parentEntity: n, parentId: r, schema: i }) {
596
596
  display: "block",
597
597
  fontWeight: 500
598
598
  },
599
- children: D(n, e, i.entities)
600
- }), C({
599
+ children: E(n, e, o.entities)
600
+ }), x({
601
601
  field: n,
602
602
  fieldName: e,
603
- value: a[e] ?? "",
603
+ value: s[e] ?? "",
604
604
  mode: "edit",
605
605
  onChange: (t) => m(e, t),
606
- record: a,
606
+ record: s,
607
607
  fieldId: r,
608
- labelId: o,
608
+ labelId: i,
609
609
  locale: h
610
610
  })]
611
611
  }, e);
612
612
  }),
613
- /* @__PURE__ */ J(c, {
613
+ /* @__PURE__ */ J(a, {
614
614
  type: "submit",
615
615
  kind: "primary",
616
616
  size: g.isPhone ? "md" : "sm",
@@ -633,29 +633,29 @@ function Ue({ config: t, parentEntity: n, parentId: r, schema: i }) {
633
633
  }
634
634
  //#endregion
635
635
  //#region src/components/detail-layout/ChildrenTable.tsx
636
- function We({ config: t, parentEntity: n, parentId: r, schema: a }) {
637
- let o = a.entities[t.entity], s = E(), c = I((e) => e.degradedEntities), { data: l, isLoading: u, isError: d, isFetching: f, refetch: m } = N(n, r, t.entity, t.foreign_key, t.sort, t.limit), h = l?.data ?? [], g = l?.$refs, _ = G(g);
638
- _.current = g;
639
- let v = t.columns, C = t.interaction === "navigate", w = v[0], T = C && o ? y(void 0, o, a.screens) : null, O = o ? Re(o) : void 0, k = W(() => {
636
+ function We({ config: t, parentEntity: r, parentId: i, schema: a }) {
637
+ let o = a.entities[t.entity], s = T(), c = B((e) => e.degradedEntities), { data: u, isLoading: d, isError: f, isFetching: p, refetch: m } = N(r, i, t.entity, t.foreign_key, t.sort, t.limit), h = u?.data ?? [], _ = u?.$refs, x = G(_);
638
+ x.current = _;
639
+ let S = t.columns, C = t.interaction === "navigate", w = S[0], D = C && o ? g(void 0, o, a.screens) : null, O = o ? Re(o) : void 0, k = W(() => {
640
640
  let e = /* @__PURE__ */ new Map();
641
641
  if (!o) return e;
642
- for (let t of v) {
642
+ for (let t of S) {
643
643
  let n = o.fields.get(t);
644
- n && e.set(t, x({
644
+ n && e.set(t, y({
645
645
  field: n,
646
646
  fieldName: t,
647
647
  surface: "list",
648
648
  entity: o,
649
649
  entities: a.entities,
650
650
  screens: a.screens,
651
- refs: () => _.current,
651
+ refs: () => x.current,
652
652
  locale: s
653
653
  }));
654
654
  }
655
655
  return e;
656
656
  }, [
657
657
  o,
658
- v,
658
+ S,
659
659
  a.entities,
660
660
  a.screens,
661
661
  s
@@ -670,8 +670,8 @@ function We({ config: t, parentEntity: n, parentId: r, schema: a }) {
670
670
  });
671
671
  let A = /* @__PURE__ */ J(Ue, {
672
672
  config: t,
673
- parentEntity: n,
674
- parentId: r,
673
+ parentEntity: r,
674
+ parentId: i,
675
675
  schema: a
676
676
  }), j = /* @__PURE__ */ Y("div", {
677
677
  style: {
@@ -681,30 +681,30 @@ function We({ config: t, parentEntity: n, parentId: r, schema: a }) {
681
681
  padding: "4px 0",
682
682
  justifyContent: "flex-end"
683
683
  },
684
- children: [F(o.realtime, c, t.entity) && /* @__PURE__ */ J("span", {
684
+ children: [ee(o.realtime, c, t.entity) && /* @__PURE__ */ J("span", {
685
685
  "data-testid": "children-live-indicator",
686
686
  title: "This table updates automatically in realtime.",
687
- children: /* @__PURE__ */ J(i, {
687
+ children: /* @__PURE__ */ J(n, {
688
688
  tone: "emerald",
689
689
  size: "xs",
690
690
  dot: !0,
691
691
  children: "Live"
692
692
  })
693
- }), /* @__PURE__ */ J(p, {
694
- icon: f ? /* @__PURE__ */ J("span", {
693
+ }), /* @__PURE__ */ J(l, {
694
+ icon: p ? /* @__PURE__ */ J("span", {
695
695
  "data-testid": "children-refresh-spinner",
696
696
  style: { display: "inline-flex" },
697
- children: /* @__PURE__ */ J(S, { size: 13 })
697
+ children: /* @__PURE__ */ J(b, { size: 13 })
698
698
  }) : /* @__PURE__ */ J(e.refresh, { size: 13 }),
699
699
  title: "Refresh",
700
700
  size: 24,
701
- disabled: f,
701
+ disabled: p,
702
702
  onClick: () => {
703
703
  m();
704
704
  }
705
705
  })]
706
706
  });
707
- return d ? /* @__PURE__ */ Y("div", { children: [
707
+ return f ? /* @__PURE__ */ Y("div", { children: [
708
708
  A,
709
709
  j,
710
710
  /* @__PURE__ */ J("div", {
@@ -715,7 +715,7 @@ function We({ config: t, parentEntity: n, parentId: r, schema: a }) {
715
715
  },
716
716
  children: "Failed to load. Try again."
717
717
  })
718
- ] }) : u ? /* @__PURE__ */ Y("div", { children: [
718
+ ] }) : d ? /* @__PURE__ */ Y("div", { children: [
719
719
  A,
720
720
  j,
721
721
  /* @__PURE__ */ J("div", {
@@ -752,20 +752,20 @@ function We({ config: t, parentEntity: n, parentId: r, schema: a }) {
752
752
  /* @__PURE__ */ J("div", {
753
753
  style: { overflowX: "auto" },
754
754
  children: /* @__PURE__ */ Y("table", {
755
- style: se,
756
- children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ J("tr", { children: v.map((e) => {
755
+ style: ce,
756
+ children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ J("tr", { children: S.map((e) => {
757
757
  let t = o.fields.get(e);
758
758
  return /* @__PURE__ */ J("th", {
759
- style: oe,
760
- children: t ? D(t, e, a.entities) : e
759
+ style: se,
760
+ children: t ? E(t, e, a.entities) : e
761
761
  }, e);
762
762
  }) }) }), /* @__PURE__ */ J("tbody", { children: h.map((e, t) => {
763
- let n = O ? b(e[O]) : "", r = C && T && n ? T.replace(/:\w+/, n) : void 0;
764
- return /* @__PURE__ */ J("tr", { children: v.map((t) => {
765
- let n = t === w, i = k.get(t), a = i ? i(e[t], e) : b(e[t]);
763
+ let n = O ? v(e[O]) : "", r = C && D && n ? D.replace(/:\w+/, n) : void 0;
764
+ return /* @__PURE__ */ J("tr", { children: S.map((t) => {
765
+ let n = t === w, i = k.get(t), a = i ? i(e[t], e) : v(e[t]);
766
766
  return /* @__PURE__ */ J("td", {
767
767
  title: typeof a == "string" ? a : void 0,
768
- style: ce,
768
+ style: le,
769
769
  children: n && r ? /* @__PURE__ */ J("a", {
770
770
  href: r,
771
771
  style: {
@@ -778,7 +778,7 @@ function We({ config: t, parentEntity: n, parentId: r, schema: a }) {
778
778
  children: a
779
779
  }) : a
780
780
  }, t);
781
- }) }, b(e.id ?? t));
781
+ }) }, v(e.id ?? t));
782
782
  }) })]
783
783
  })
784
784
  })
@@ -787,7 +787,7 @@ function We({ config: t, parentEntity: n, parentId: r, schema: a }) {
787
787
  //#endregion
788
788
  //#region src/components/detail-layout/ChildrenList.tsx
789
789
  function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
790
- let i = r.entities[e.entity], a = E(), { data: o, isLoading: s, isError: c } = N(t, n, e.entity, e.foreign_key, e.sort, e.limit), l = o?.data ?? [], u = o?.$refs, d = e.columns;
790
+ let i = r.entities[e.entity], a = T(), { data: o, isLoading: s, isError: c } = N(t, n, e.entity, e.foreign_key, e.sort, e.limit), l = o?.data ?? [], d = o?.$refs, f = e.columns;
791
791
  if (!i) return /* @__PURE__ */ J("div", {
792
792
  style: {
793
793
  fontSize: 12.5,
@@ -796,13 +796,13 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
796
796
  },
797
797
  children: "Entity not found."
798
798
  });
799
- let f = /* @__PURE__ */ J(Ue, {
799
+ let p = /* @__PURE__ */ J(Ue, {
800
800
  config: e,
801
801
  parentEntity: t,
802
802
  parentId: n,
803
803
  schema: r
804
804
  });
805
- if (c) return /* @__PURE__ */ Y("div", { children: [f, /* @__PURE__ */ J("div", {
805
+ if (c) return /* @__PURE__ */ Y("div", { children: [p, /* @__PURE__ */ J("div", {
806
806
  style: {
807
807
  fontSize: 12.5,
808
808
  color: "var(--danger)",
@@ -810,7 +810,7 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
810
810
  },
811
811
  children: "Failed to load. Try again."
812
812
  })] });
813
- if (s) return /* @__PURE__ */ Y("div", { children: [f, /* @__PURE__ */ Y("div", {
813
+ if (s) return /* @__PURE__ */ Y("div", { children: [p, /* @__PURE__ */ Y("div", {
814
814
  style: {
815
815
  display: "flex",
816
816
  flexDirection: "column",
@@ -836,7 +836,7 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
836
836
  } })
837
837
  ]
838
838
  })] });
839
- if (l.length === 0) return /* @__PURE__ */ Y("div", { children: [f, /* @__PURE__ */ J("div", {
839
+ if (l.length === 0) return /* @__PURE__ */ Y("div", { children: [p, /* @__PURE__ */ J("div", {
840
840
  style: {
841
841
  fontSize: 12.5,
842
842
  color: "var(--text-3)",
@@ -844,8 +844,8 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
844
844
  },
845
845
  children: "No records yet."
846
846
  })] });
847
- let p = d.length > 0 ? i.display.display_field ?? d[0] : i.display.display_field;
848
- return /* @__PURE__ */ Y("div", { children: [f, /* @__PURE__ */ J("div", {
847
+ let m = f.length > 0 ? i.display.display_field ?? f[0] : i.display.display_field;
848
+ return /* @__PURE__ */ Y("div", { children: [p, /* @__PURE__ */ J("div", {
849
849
  style: {
850
850
  display: "flex",
851
851
  flexDirection: "column"
@@ -870,17 +870,17 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
870
870
  textOverflow: "ellipsis",
871
871
  whiteSpace: "nowrap"
872
872
  },
873
- children: (typeof e.$display == "string" ? e[m] : "") || (p && i.fields.get(p) ? C({
874
- field: i.fields.get(p),
875
- fieldName: p,
876
- value: e[p],
873
+ children: (typeof e.$display == "string" ? e[u] : "") || (m && i.fields.get(m) ? x({
874
+ field: i.fields.get(m),
875
+ fieldName: m,
876
+ value: e[m],
877
877
  mode: "display",
878
878
  record: e,
879
- refs: u,
879
+ refs: d,
880
880
  locale: a
881
- }) : p && e[p] != null ? b(e[p]) : null)
882
- }), d.length > 1 && (() => {
883
- let t = d.slice(1, 3).filter((t) => e[t] != null);
881
+ }) : m && e[m] != null ? v(e[m]) : null)
882
+ }), f.length > 1 && (() => {
883
+ let t = f.slice(1, 3).filter((t) => e[t] != null);
884
884
  return t.length === 0 ? null : /* @__PURE__ */ J("div", {
885
885
  style: {
886
886
  fontSize: 11.5,
@@ -889,25 +889,25 @@ function Ge({ config: e, parentEntity: t, parentId: n, schema: r }) {
889
889
  textOverflow: "ellipsis",
890
890
  whiteSpace: "nowrap"
891
891
  },
892
- children: t.map((t, n) => /* @__PURE__ */ Y("span", { children: [n > 0 && " · ", i.fields.get(t) ? C({
892
+ children: t.map((t, n) => /* @__PURE__ */ Y("span", { children: [n > 0 && " · ", i.fields.get(t) ? x({
893
893
  field: i.fields.get(t),
894
894
  fieldName: t,
895
895
  value: e[t],
896
896
  mode: "display",
897
897
  record: e,
898
- refs: u,
898
+ refs: d,
899
899
  locale: a
900
900
  }) : String(e[t])] }, t))
901
901
  });
902
902
  })()]
903
903
  })
904
- }, b(e.id ?? t)))
904
+ }, v(e.id ?? t)))
905
905
  })] });
906
906
  }
907
907
  //#endregion
908
908
  //#region src/components/detail-layout/ChildrenCards.tsx
909
- function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
910
- let a = r.entities[e.entity], o = E(), { data: s, isLoading: c, isError: l } = N(t, n, e.entity, e.foreign_key, e.sort, e.limit), u = s?.data ?? [], d = s?.$refs, f = e.columns, p = e.cards, m = p?.header_field ?? f[0], h = p?.badge_field, g = p?.columns_count ?? 3;
909
+ function Ke({ config: e, parentEntity: t, parentId: r, schema: i }) {
910
+ let a = i.entities[e.entity], o = T(), { data: s, isLoading: c, isError: l } = N(t, r, e.entity, e.foreign_key, e.sort, e.limit), u = s?.data ?? [], d = s?.$refs, f = e.columns, p = e.cards, m = p?.header_field ?? f[0], h = p?.badge_field, g = p?.columns_count ?? 3;
911
911
  if (!a) return /* @__PURE__ */ J("div", {
912
912
  style: {
913
913
  fontSize: 12.5,
@@ -920,13 +920,13 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
920
920
  display: "grid",
921
921
  gridTemplateColumns: `repeat(auto-fill, minmax(${g >= 4 ? 180 : 240}px, 1fr))`,
922
922
  gap: 12
923
- }, v = /* @__PURE__ */ J(Ue, {
923
+ }, y = /* @__PURE__ */ J(Ue, {
924
924
  config: e,
925
925
  parentEntity: t,
926
- parentId: n,
927
- schema: r
926
+ parentId: r,
927
+ schema: i
928
928
  });
929
- if (l) return /* @__PURE__ */ Y("div", { children: [v, /* @__PURE__ */ J("div", {
929
+ if (l) return /* @__PURE__ */ Y("div", { children: [y, /* @__PURE__ */ J("div", {
930
930
  style: {
931
931
  fontSize: 12.5,
932
932
  color: "var(--danger)",
@@ -934,7 +934,7 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
934
934
  },
935
935
  children: "Failed to load. Try again."
936
936
  })] });
937
- if (c) return /* @__PURE__ */ Y("div", { children: [v, /* @__PURE__ */ J("div", {
937
+ if (c) return /* @__PURE__ */ Y("div", { children: [y, /* @__PURE__ */ J("div", {
938
938
  style: _,
939
939
  children: [
940
940
  0,
@@ -946,7 +946,7 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
946
946
  borderRadius: 10
947
947
  } }, e))
948
948
  })] });
949
- if (u.length === 0) return /* @__PURE__ */ Y("div", { children: [v, /* @__PURE__ */ J("div", {
949
+ if (u.length === 0) return /* @__PURE__ */ Y("div", { children: [y, /* @__PURE__ */ J("div", {
950
950
  style: {
951
951
  fontSize: 12.5,
952
952
  color: "var(--text-3)",
@@ -954,10 +954,10 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
954
954
  },
955
955
  children: "No records yet."
956
956
  })] });
957
- let y = f.filter((e) => e !== m && e !== h);
958
- return /* @__PURE__ */ Y("div", { children: [v, /* @__PURE__ */ J("div", {
957
+ let b = f.filter((e) => e !== m && e !== h);
958
+ return /* @__PURE__ */ Y("div", { children: [y, /* @__PURE__ */ J("div", {
959
959
  style: _,
960
- children: u.map((t, n) => /* @__PURE__ */ Y("div", {
960
+ children: u.map((t, r) => /* @__PURE__ */ Y("div", {
961
961
  style: {
962
962
  background: "var(--surface)",
963
963
  border: "1px solid var(--border)",
@@ -971,7 +971,7 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
971
971
  alignItems: "center",
972
972
  justifyContent: "space-between",
973
973
  gap: 8,
974
- borderBottom: y.length > 0 ? "1px solid var(--divider)" : "none"
974
+ borderBottom: b.length > 0 ? "1px solid var(--divider)" : "none"
975
975
  },
976
976
  children: [/* @__PURE__ */ J("div", {
977
977
  style: {
@@ -981,7 +981,7 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
981
981
  textOverflow: "ellipsis",
982
982
  whiteSpace: "nowrap"
983
983
  },
984
- children: m && a.fields.get(m) ? C({
984
+ children: m && a.fields.get(m) ? x({
985
985
  field: a.fields.get(m),
986
986
  fieldName: m,
987
987
  value: t[m],
@@ -989,11 +989,11 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
989
989
  record: t,
990
990
  refs: d,
991
991
  locale: o
992
- }) : `Record ${n + 1}`
993
- }), h && t[h] != null && /* @__PURE__ */ J(i, {
992
+ }) : `Record ${r + 1}`
993
+ }), h && t[h] != null && /* @__PURE__ */ J(n, {
994
994
  tone: "slate",
995
995
  size: "xs",
996
- children: a.fields.get(h) ? C({
996
+ children: a.fields.get(h) ? x({
997
997
  field: a.fields.get(h),
998
998
  fieldName: h,
999
999
  value: t[h],
@@ -1001,18 +1001,18 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
1001
1001
  record: t,
1002
1002
  refs: d,
1003
1003
  locale: o
1004
- }) : b(t[h])
1004
+ }) : v(t[h])
1005
1005
  })]
1006
- }), y.length > 0 && /* @__PURE__ */ J("div", {
1006
+ }), b.length > 0 && /* @__PURE__ */ J("div", {
1007
1007
  style: {
1008
1008
  padding: "10px 14px",
1009
1009
  display: "flex",
1010
1010
  flexDirection: "column",
1011
1011
  gap: 4
1012
1012
  },
1013
- children: y.slice(0, 4).map((n) => {
1014
- let i = a.fields.get(n);
1015
- return i ? /* @__PURE__ */ Y("div", {
1013
+ children: b.slice(0, 4).map((n) => {
1014
+ let r = a.fields.get(n);
1015
+ return r ? /* @__PURE__ */ Y("div", {
1016
1016
  style: {
1017
1017
  display: "flex",
1018
1018
  alignItems: "baseline",
@@ -1024,15 +1024,15 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
1024
1024
  color: "var(--text-3)",
1025
1025
  flexShrink: 0
1026
1026
  },
1027
- children: [r.entities[e.entity]?.fields.get(n)?.display?.name ? Object.values(r.entities[e.entity].fields.get(n).display.name)[0] : n, ":"]
1027
+ children: [i.entities[e.entity]?.fields.get(n)?.display?.name ? Object.values(i.entities[e.entity].fields.get(n).display.name)[0] : n, ":"]
1028
1028
  }), /* @__PURE__ */ J("span", {
1029
1029
  style: {
1030
1030
  overflow: "hidden",
1031
1031
  textOverflow: "ellipsis",
1032
1032
  whiteSpace: "nowrap"
1033
1033
  },
1034
- children: C({
1035
- field: i,
1034
+ children: x({
1035
+ field: r,
1036
1036
  fieldName: n,
1037
1037
  value: t[n],
1038
1038
  mode: "display",
@@ -1044,14 +1044,14 @@ function Ke({ config: e, parentEntity: t, parentId: n, schema: r }) {
1044
1044
  }, n) : null;
1045
1045
  })
1046
1046
  })]
1047
- }, b(t.id ?? n)))
1047
+ }, v(t.id ?? r)))
1048
1048
  })] });
1049
1049
  }
1050
1050
  //#endregion
1051
1051
  //#region src/hooks/useTimelineData.ts
1052
1052
  var qe = 50;
1053
1053
  function Je(e, t, n, r, i, a) {
1054
- let o = Array.isArray(r) ? r : [r], s = Array.isArray(r) ? g(t, o.length) : [t], c = a ?? qe, l = he({
1054
+ let o = Array.isArray(r) ? r : [r], c = Array.isArray(r) ? f(t, o.length) : [t], l = a ?? qe, u = he({
1055
1055
  queryKey: [
1056
1056
  M,
1057
1057
  e,
@@ -1059,102 +1059,102 @@ function Je(e, t, n, r, i, a) {
1059
1059
  n,
1060
1060
  "timeline",
1061
1061
  i,
1062
- c
1062
+ l
1063
1063
  ],
1064
1064
  queryFn: ({ pageParam: e }) => {
1065
1065
  let t = new URLSearchParams();
1066
- if (!s) throw Error("invalid composite parent id");
1066
+ if (!c) throw Error("invalid composite parent id");
1067
1067
  let r = o.map((e, t) => ({
1068
1068
  field: e,
1069
1069
  op: "eq",
1070
- value: s[t]
1070
+ value: c[t]
1071
1071
  }));
1072
- return t.set("filters", JSON.stringify(r)), t.set("preview", "true"), i ? t.set("sort", `${i}:desc`) : typeof console < "u" && console.warn(`[useTimelineData] no time_field for ${n}; fetch order falls back to API default`), t.set("limit", String(c)), e && t.set("after", e), u(`/api/data/${n}?${t.toString()}`);
1072
+ return t.set("filters", JSON.stringify(r)), t.set("preview", "true"), i ? t.set("sort", `${i}:desc`) : typeof console < "u" && console.warn(`[useTimelineData] no time_field for ${n}; fetch order falls back to API default`), t.set("limit", String(l)), e && t.set("after", e), s(`/api/data/${n}?${t.toString()}`);
1073
1073
  },
1074
1074
  getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
1075
1075
  initialPageParam: void 0,
1076
- enabled: !!e && !!t && !!n && !!r && s !== null
1076
+ enabled: !!e && !!t && !!n && !!r && c !== null
1077
1077
  });
1078
1078
  return {
1079
- rows: W(() => l.data?.pages.flatMap((e) => e.data) ?? [], [l.data?.pages]),
1080
- refs: l.data?.pages[0]?.$refs,
1081
- fetchNextPage: l.fetchNextPage,
1082
- hasOlder: !!l.hasNextPage,
1083
- isFetchingOlder: l.isFetchingNextPage,
1084
- isLoading: l.isLoading,
1085
- isError: l.isError
1079
+ rows: W(() => u.data?.pages.flatMap((e) => e.data) ?? [], [u.data?.pages]),
1080
+ refs: u.data?.pages[0]?.$refs,
1081
+ fetchNextPage: u.fetchNextPage,
1082
+ hasOlder: !!u.hasNextPage,
1083
+ isFetchingOlder: u.isFetchingNextPage,
1084
+ isLoading: u.isLoading,
1085
+ isError: u.isError
1086
1086
  };
1087
1087
  }
1088
1088
  //#endregion
1089
1089
  //#region src/components/detail-layout/TimelineComposer.tsx
1090
1090
  var Ye = "quick_entry", Xe = 100, Ze = 240, Qe = 800, $e = 80;
1091
1091
  function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
1092
- let { values: a, quickAdd: o, childEntity: s, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = He(t, n, r, i), m = E(), [h, g] = K(Ze), _ = G(null), y = G(null), [b, x] = K(Qe);
1092
+ let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = He(t, n, r, i), m = T(), [g, _] = K(Ze), v = G(null), y = G(null), [b, S] = K(Qe);
1093
1093
  U(() => {
1094
1094
  let e = y.current?.parentElement;
1095
1095
  if (!e) return;
1096
1096
  let t = () => {
1097
1097
  let t = Math.max(Xe, e.clientHeight - $e);
1098
- x(Math.min(Qe, t));
1098
+ S(Math.min(Qe, t));
1099
1099
  };
1100
1100
  t();
1101
1101
  let n = new ResizeObserver(t);
1102
1102
  return n.observe(e), () => n.disconnect();
1103
1103
  }, []), U(() => {
1104
- g((e) => Math.min(e, b));
1104
+ _((e) => Math.min(e, b));
1105
1105
  }, [b]);
1106
- let S = G(a);
1107
- S.current = a;
1106
+ let C = G(o);
1107
+ C.current = o;
1108
1108
  let w = G(p);
1109
1109
  w.current = p;
1110
- let T = G({}), D = W(() => ({
1111
- getField: (e) => S.current[e],
1110
+ let E = G({}), D = W(() => ({
1111
+ getField: (e) => C.current[e],
1112
1112
  setField: (e, t) => {
1113
1113
  w.current(e, t);
1114
1114
  },
1115
1115
  focusField: (e) => {
1116
- let t = T.current[e];
1116
+ let t = E.current[e];
1117
1117
  t && (t.querySelector("textarea, input, select, [contenteditable]") ?? t).focus();
1118
1118
  }
1119
1119
  }), []);
1120
- U(() => v(Ye, D), [D]);
1120
+ U(() => h(Ye, D), [D]);
1121
1121
  let O = H((e) => {
1122
- e.preventDefault(), _.current = {
1122
+ e.preventDefault(), v.current = {
1123
1123
  startY: e.clientY,
1124
- startHeight: h
1124
+ startHeight: g
1125
1125
  };
1126
1126
  let t = (e) => {
1127
- if (!_.current) return;
1128
- let t = _.current.startY - e.clientY;
1129
- g(Math.min(b, Math.max(Xe, _.current.startHeight + t)));
1127
+ if (!v.current) return;
1128
+ let t = v.current.startY - e.clientY;
1129
+ _(Math.min(b, Math.max(Xe, v.current.startHeight + t)));
1130
1130
  }, n = () => {
1131
- _.current = null, document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
1131
+ v.current = null, document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
1132
1132
  };
1133
1133
  document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
1134
- }, [h, b]);
1135
- if (!o || o.fields.length === 0 || !s) return null;
1136
- let k = o.fields.find((e) => {
1137
- let t = s.fields.get(e);
1134
+ }, [g, b]);
1135
+ if (!s || s.fields.length === 0 || !c) return null;
1136
+ let k = s.fields.find((e) => {
1137
+ let t = c.fields.get(e);
1138
1138
  return t && (t.type === "text" || t.type === "string");
1139
1139
  }), A = [], j = [];
1140
- for (let e of o.fields) {
1140
+ for (let e of s.fields) {
1141
1141
  if (e === k) continue;
1142
- let t = s.fields.get(e);
1142
+ let t = c.fields.get(e);
1143
1143
  t && (t.type === "enum" ? A.push(e) : j.push(e));
1144
1144
  }
1145
1145
  let M = (e) => {
1146
- let t = s.fields.get(e);
1146
+ let t = c.fields.get(e);
1147
1147
  return t ? /* @__PURE__ */ J("div", {
1148
1148
  ref: (t) => {
1149
- T.current[e] = t;
1149
+ E.current[e] = t;
1150
1150
  },
1151
- children: C({
1151
+ children: x({
1152
1152
  field: t,
1153
1153
  fieldName: e,
1154
- value: a[e] ?? "",
1154
+ value: o[e] ?? "",
1155
1155
  mode: "edit",
1156
1156
  onChange: (t) => p(e, t),
1157
- record: a,
1157
+ record: o,
1158
1158
  locale: m
1159
1159
  })
1160
1160
  }, e) : null;
@@ -1167,7 +1167,7 @@ function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
1167
1167
  background: "var(--surface)",
1168
1168
  display: "flex",
1169
1169
  flexDirection: "column",
1170
- height: `${h}px`
1170
+ height: `${g}px`
1171
1171
  },
1172
1172
  children: [/* @__PURE__ */ J("div", {
1173
1173
  onMouseDown: O,
@@ -1210,22 +1210,22 @@ function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
1210
1210
  },
1211
1211
  children: A.map(M)
1212
1212
  }),
1213
- k && s.fields.get(k) && /* @__PURE__ */ J("div", {
1213
+ k && c.fields.get(k) && /* @__PURE__ */ J("div", {
1214
1214
  style: {
1215
1215
  flex: 1,
1216
1216
  minHeight: 0,
1217
1217
  display: "flex"
1218
1218
  },
1219
1219
  ref: (e) => {
1220
- T.current[k] = e;
1220
+ E.current[k] = e;
1221
1221
  },
1222
- children: C({
1223
- field: s.fields.get(k),
1222
+ children: x({
1223
+ field: c.fields.get(k),
1224
1224
  fieldName: k,
1225
- value: a[k] ?? "",
1225
+ value: o[k] ?? "",
1226
1226
  mode: "edit",
1227
1227
  onChange: (e) => p(k, e),
1228
- record: a,
1228
+ record: o,
1229
1229
  fill: !0,
1230
1230
  locale: m
1231
1231
  })
@@ -1261,7 +1261,7 @@ function et({ config: t, parentEntity: n, parentId: r, schema: i }) {
1261
1261
  }),
1262
1262
  " to add"
1263
1263
  ]
1264
- }), /* @__PURE__ */ J(c, {
1264
+ }), /* @__PURE__ */ J(a, {
1265
1265
  type: "submit",
1266
1266
  kind: "primary",
1267
1267
  icon: /* @__PURE__ */ J(e.plus, { size: 13 }),
@@ -1289,17 +1289,17 @@ var tt = 80, nt = 200;
1289
1289
  function rt(e, t) {
1290
1290
  if (it(t)) {
1291
1291
  let e = t.id;
1292
- return e == null ? "" : b(e);
1292
+ return e == null ? "" : v(e);
1293
1293
  }
1294
- return s(w(e, t));
1294
+ return C(S(e, t));
1295
1295
  }
1296
1296
  function it(e) {
1297
1297
  return e.__optimistic === !0;
1298
1298
  }
1299
1299
  function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
1300
- let i = r.entities[e.entity], { rows: a, refs: o, fetchNextPage: s, hasOlder: l, isFetchingOlder: u, isLoading: d, isError: f } = Je(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), p = e.timeline, m = p?.scroll ?? !1, h = (e.sort ?? "").endsWith(":asc"), g = W(() => h ? [...a].reverse() : a, [a, h]), _ = p?.auto_scroll ?? "none", v = G(null), y = G(null), b = G(!1), x = G(0), C = G(null), w = G(null), E = G(!0), D = G(null);
1300
+ let i = r.entities[e.entity], { rows: o, refs: s, fetchNextPage: c, hasOlder: l, isFetchingOlder: u, isLoading: d, isError: f } = Je(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), p = e.timeline, m = p?.scroll ?? !1, h = (e.sort ?? "").endsWith(":asc"), g = W(() => h ? [...o].reverse() : o, [o, h]), _ = p?.auto_scroll ?? "none", v = G(null), y = G(null), x = G(!1), S = G(0), C = G(null), T = G(null), E = G(!0), D = G(null);
1301
1301
  U(() => {
1302
- b.current = !1, x.current = 0, C.current = null, w.current = null, E.current = !0, D.current = null;
1302
+ x.current = !1, S.current = 0, C.current = null, T.current = null, E.current = !0, D.current = null;
1303
1303
  }, [n]), me(() => {
1304
1304
  !u || !v.current || (D.current = {
1305
1305
  scrollHeight: v.current.scrollHeight,
@@ -1308,16 +1308,16 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
1308
1308
  }, [u]), me(() => {
1309
1309
  let e = v.current;
1310
1310
  if (!e || g.length === 0 || !i) {
1311
- x.current = g.length;
1311
+ S.current = g.length;
1312
1312
  return;
1313
1313
  }
1314
- let t = rt(i, g[0]), n = rt(i, g[g.length - 1]), r = !b.current, a = g.length > x.current && x.current > 0, o = a && (h && t !== C.current && n === w.current || !h && n !== w.current && t === C.current), s = a && !o;
1315
- if (r) h && _ === "bottom" && (e.scrollTop = e.scrollHeight), b.current = !0;
1314
+ let t = rt(i, g[0]), n = rt(i, g[g.length - 1]), r = !x.current, a = g.length > S.current && S.current > 0, o = a && (h && t !== C.current && n === T.current || !h && n !== T.current && t === C.current), s = a && !o;
1315
+ if (r) h && _ === "bottom" && (e.scrollTop = e.scrollHeight), x.current = !0;
1316
1316
  else if (o && D.current) {
1317
1317
  let t = D.current;
1318
1318
  h && (e.scrollTop = t.scrollTop + (e.scrollHeight - t.scrollHeight)), D.current = null;
1319
1319
  } else s && h && E.current && (e.scrollTop = e.scrollHeight);
1320
- x.current = g.length, C.current = t, w.current = n;
1320
+ S.current = g.length, C.current = t, T.current = n;
1321
1321
  }, [
1322
1322
  g,
1323
1323
  _,
@@ -1332,7 +1332,7 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
1332
1332
  let e = y.current;
1333
1333
  if (!e || typeof IntersectionObserver > "u") return;
1334
1334
  let t = new IntersectionObserver((e) => {
1335
- for (let t of e) t.isIntersecting && l && !u && s();
1335
+ for (let t of e) t.isIntersecting && l && !u && c();
1336
1336
  }, {
1337
1337
  root: v.current ?? null,
1338
1338
  rootMargin: `${nt}px 0px 0px 0px`,
@@ -1342,7 +1342,7 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
1342
1342
  }, [
1343
1343
  l,
1344
1344
  u,
1345
- s
1345
+ c
1346
1346
  ]);
1347
1347
  let [k, A] = K(null);
1348
1348
  if (!i) return /* @__PURE__ */ J("div", {
@@ -1353,25 +1353,25 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
1353
1353
  },
1354
1354
  children: "Entity not found."
1355
1355
  });
1356
- let j = e.quick_add?.fields ?? [p?.content_field].filter(Boolean), M = T(i.display?.name_plural) || T(i.display?.name) || e.entity, N = l ? /* @__PURE__ */ J("div", {
1356
+ let j = e.quick_add?.fields ?? [p?.content_field].filter(Boolean), M = w(i.display?.name_plural) || w(i.display?.name) || e.entity, ee = l ? /* @__PURE__ */ J("div", {
1357
1357
  style: {
1358
1358
  display: "flex",
1359
1359
  justifyContent: "center",
1360
1360
  padding: "6px 0"
1361
1361
  },
1362
- children: /* @__PURE__ */ J(c, {
1362
+ children: /* @__PURE__ */ J(a, {
1363
1363
  size: "xs",
1364
- onClick: () => s(),
1364
+ onClick: () => c(),
1365
1365
  disabled: u,
1366
- icon: u ? /* @__PURE__ */ J(S, { size: 11 }) : void 0,
1366
+ icon: u ? /* @__PURE__ */ J(b, { size: 11 }) : void 0,
1367
1367
  children: u ? "Loading…" : "Load older"
1368
1368
  })
1369
- }) : null, ee = /* @__PURE__ */ J("div", {
1369
+ }) : null, te = /* @__PURE__ */ J("div", {
1370
1370
  ref: y,
1371
1371
  "aria-hidden": "true",
1372
1372
  style: { height: 1 }
1373
- }), P;
1374
- if (f) P = /* @__PURE__ */ J("div", {
1373
+ }), N;
1374
+ if (f) N = /* @__PURE__ */ J("div", {
1375
1375
  style: {
1376
1376
  fontSize: 12.5,
1377
1377
  color: "var(--danger)",
@@ -1379,7 +1379,7 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
1379
1379
  },
1380
1380
  children: "Failed to load."
1381
1381
  });
1382
- else if (d) P = /* @__PURE__ */ Y("div", {
1382
+ else if (d) N = /* @__PURE__ */ Y("div", {
1383
1383
  style: {
1384
1384
  display: "flex",
1385
1385
  flexDirection: "column",
@@ -1396,7 +1396,7 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
1396
1396
  borderRadius: 8
1397
1397
  } })]
1398
1398
  });
1399
- else if (g.length === 0) P = /* @__PURE__ */ Y(q, { children: [ee, /* @__PURE__ */ J("div", {
1399
+ else if (g.length === 0) N = /* @__PURE__ */ Y(q, { children: [te, /* @__PURE__ */ J("div", {
1400
1400
  style: {
1401
1401
  fontSize: 12.5,
1402
1402
  color: "var(--text-3)",
@@ -1405,8 +1405,8 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
1405
1405
  children: "No activity yet."
1406
1406
  })] });
1407
1407
  else {
1408
- let a = (a, s) => {
1409
- let c = rt(i, a) || String(s);
1408
+ let a = (a, o) => {
1409
+ let c = rt(i, a) || String(o);
1410
1410
  return /* @__PURE__ */ J(ot, {
1411
1411
  row: a,
1412
1412
  rowId: c,
@@ -1416,7 +1416,7 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
1416
1416
  parentId: n,
1417
1417
  timeline: p,
1418
1418
  editableFields: j,
1419
- refs: o,
1419
+ refs: s,
1420
1420
  isEditing: k === c,
1421
1421
  onStartEdit: () => A(c),
1422
1422
  onCancelEdit: () => A(null),
@@ -1424,11 +1424,11 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
1424
1424
  schema: r,
1425
1425
  optimistic: it(a)
1426
1426
  }, c);
1427
- }, s = p?.time_field, c;
1428
- if (s) {
1427
+ }, o = p?.time_field, c;
1428
+ if (o) {
1429
1429
  let e = [];
1430
1430
  g.forEach((t, n) => {
1431
- let r = t[s], i = st(r), a = e[e.length - 1];
1431
+ let r = t[o], i = st(r), a = e[e.length - 1];
1432
1432
  !a || a.key !== i ? e.push({
1433
1433
  key: i,
1434
1434
  label: ct(r),
@@ -1452,9 +1452,9 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
1452
1452
  }), e.rows.map(({ row: e, idx: t }) => a(e, t))]
1453
1453
  }, `day-${e.key}`));
1454
1454
  } else c = g.map((e, t) => a(e, t));
1455
- P = /* @__PURE__ */ Y(q, { children: [
1455
+ N = /* @__PURE__ */ Y(q, { children: [
1456
+ te,
1456
1457
  ee,
1457
- N,
1458
1458
  c
1459
1459
  ] });
1460
1460
  }
@@ -1494,7 +1494,7 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
1494
1494
  flexDirection: "column",
1495
1495
  gap: 8
1496
1496
  },
1497
- children: P
1497
+ children: N
1498
1498
  }),
1499
1499
  /* @__PURE__ */ J(et, {
1500
1500
  config: e,
@@ -1509,7 +1509,7 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
1509
1509
  flexDirection: "column",
1510
1510
  gap: 8
1511
1511
  },
1512
- children: P
1512
+ children: N
1513
1513
  }), /* @__PURE__ */ J(et, {
1514
1514
  config: e,
1515
1515
  parentEntity: t,
@@ -1517,52 +1517,52 @@ function at({ config: e, parentEntity: t, parentId: n, schema: r }) {
1517
1517
  schema: r
1518
1518
  })] });
1519
1519
  }
1520
- function ot({ row: t, rowId: r, childEntity: a, entityCode: o, parentEntity: s, parentId: l, timeline: u, editableFields: m, refs: h, isEditing: g, onStartEdit: _, onCancelEdit: v, onSaved: y, schema: b, optimistic: x = !1 }) {
1521
- let w = _e(), T = E(), [O, k] = K({}), A = H(() => {
1522
- w.invalidateQueries({ queryKey: [
1520
+ function ot({ row: t, rowId: r, childEntity: i, entityCode: o, parentEntity: s, parentId: u, timeline: d, editableFields: f, refs: p, isEditing: m, onStartEdit: h, onCancelEdit: g, onSaved: v, schema: y, optimistic: S = !1 }) {
1521
+ let C = _e(), w = T(), [D, O] = K({}), A = H(() => {
1522
+ C.invalidateQueries({ queryKey: [
1523
1523
  M,
1524
1524
  s,
1525
- l,
1525
+ u,
1526
1526
  o
1527
1527
  ] });
1528
1528
  }, [
1529
- w,
1529
+ C,
1530
1530
  s,
1531
- l,
1531
+ u,
1532
1532
  o
1533
1533
  ]), j = ge({
1534
1534
  mutationFn: (e) => {
1535
1535
  let n = t.$row_version;
1536
- return d(o, r, typeof n == "string" && n !== "" ? {
1536
+ return _(o, r, typeof n == "string" && n !== "" ? {
1537
1537
  ...e,
1538
1538
  $row_version: n
1539
1539
  } : e);
1540
1540
  },
1541
1541
  onSuccess: () => {
1542
- A(), n.success("Updated"), y();
1542
+ A(), c.success("Updated"), v();
1543
1543
  },
1544
- onError: (e) => n.error(e.message)
1545
- }), N = ge({
1546
- mutationFn: () => f(o, r),
1544
+ onError: (e) => c.error(e.message)
1545
+ }), ee = ge({
1546
+ mutationFn: () => k(o, r),
1547
1547
  onSuccess: () => {
1548
- A(), n.success("Deleted");
1548
+ A(), c.success("Deleted");
1549
1549
  },
1550
- onError: (e) => n.error(e.message)
1551
- }), ee = H(() => {
1550
+ onError: (e) => c.error(e.message)
1551
+ }), te = H(() => {
1552
1552
  let e = {};
1553
- for (let n of m) e[n] = t[n] ?? "";
1554
- k(e), _();
1553
+ for (let n of f) e[n] = t[n] ?? "";
1554
+ O(e), h();
1555
1555
  }, [
1556
1556
  t,
1557
- m,
1558
- _
1559
- ]), P = H((e, t) => {
1560
- k((n) => ({
1557
+ f,
1558
+ h
1559
+ ]), N = H((e, t) => {
1560
+ O((n) => ({
1561
1561
  ...n,
1562
1562
  [e]: t
1563
1563
  }));
1564
- }, []), F = u?.time_field, I = u?.type_field, L = u?.summary_field, R = u?.content_field, z = u?.author_field, B = u?.direction_field, V = u?.intent_field;
1565
- return g ? /* @__PURE__ */ Y("div", {
1564
+ }, []), P = d?.time_field, F = d?.type_field, I = d?.summary_field, L = d?.content_field, R = d?.author_field, z = d?.direction_field, B = d?.intent_field;
1565
+ return m ? /* @__PURE__ */ Y("div", {
1566
1566
  style: {
1567
1567
  borderRadius: 10,
1568
1568
  border: "1px solid var(--accent)",
@@ -1572,8 +1572,8 @@ function ot({ row: t, rowId: r, childEntity: a, entityCode: o, parentEntity: s,
1572
1572
  flexDirection: "column",
1573
1573
  gap: 8
1574
1574
  },
1575
- children: [m.map((e) => {
1576
- let t = a.fields.get(e);
1575
+ children: [f.map((e) => {
1576
+ let t = i.fields.get(e);
1577
1577
  return t ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("label", {
1578
1578
  style: {
1579
1579
  fontSize: 11,
@@ -1581,15 +1581,15 @@ function ot({ row: t, rowId: r, childEntity: a, entityCode: o, parentEntity: s,
1581
1581
  marginBottom: 4,
1582
1582
  display: "block"
1583
1583
  },
1584
- children: D(t, e, b.entities)
1585
- }), C({
1584
+ children: E(t, e, y.entities)
1585
+ }), x({
1586
1586
  field: t,
1587
1587
  fieldName: e,
1588
- value: O[e] ?? "",
1588
+ value: D[e] ?? "",
1589
1589
  mode: "edit",
1590
- onChange: (t) => P(e, t),
1591
- record: O,
1592
- locale: T
1590
+ onChange: (t) => N(e, t),
1591
+ record: D,
1592
+ locale: w
1593
1593
  })] }, e) : null;
1594
1594
  }), /* @__PURE__ */ Y("div", {
1595
1595
  style: {
@@ -1598,18 +1598,18 @@ function ot({ row: t, rowId: r, childEntity: a, entityCode: o, parentEntity: s,
1598
1598
  gap: 6,
1599
1599
  paddingTop: 4
1600
1600
  },
1601
- children: [/* @__PURE__ */ J(c, {
1601
+ children: [/* @__PURE__ */ J(a, {
1602
1602
  kind: "primary",
1603
1603
  size: "xs",
1604
- icon: j.isPending ? /* @__PURE__ */ J(S, { size: 12 }) : /* @__PURE__ */ J(e.check, { size: 12 }),
1605
- onClick: () => j.mutate(O),
1604
+ icon: j.isPending ? /* @__PURE__ */ J(b, { size: 12 }) : /* @__PURE__ */ J(e.check, { size: 12 }),
1605
+ onClick: () => j.mutate(D),
1606
1606
  disabled: j.isPending,
1607
1607
  children: j.isPending ? "Saving…" : "Save"
1608
- }), /* @__PURE__ */ J(c, {
1608
+ }), /* @__PURE__ */ J(a, {
1609
1609
  size: "xs",
1610
1610
  icon: /* @__PURE__ */ J(e.x, { size: 12 }),
1611
1611
  onClick: () => {
1612
- k({}), v();
1612
+ O({}), g();
1613
1613
  },
1614
1614
  disabled: j.isPending,
1615
1615
  children: "Cancel"
@@ -1617,14 +1617,14 @@ function ot({ row: t, rowId: r, childEntity: a, entityCode: o, parentEntity: s,
1617
1617
  })]
1618
1618
  }) : /* @__PURE__ */ Y("div", {
1619
1619
  className: "group",
1620
- "data-optimistic": x || void 0,
1620
+ "data-optimistic": S || void 0,
1621
1621
  style: {
1622
1622
  borderRadius: 10,
1623
1623
  border: "1px solid var(--border)",
1624
1624
  background: "var(--surface)",
1625
1625
  padding: 12,
1626
1626
  transition: "border-color .12s",
1627
- opacity: x ? .6 : 1
1627
+ opacity: S ? .6 : 1
1628
1628
  },
1629
1629
  onMouseEnter: (e) => e.currentTarget.style.borderColor = "var(--border-strong)",
1630
1630
  onMouseLeave: (e) => e.currentTarget.style.borderColor = "var(--border)",
@@ -1639,112 +1639,112 @@ function ot({ row: t, rowId: r, childEntity: a, entityCode: o, parentEntity: s,
1639
1639
  color: "var(--text-3)"
1640
1640
  },
1641
1641
  children: [
1642
- F && t[F] != null && a.fields.get(F) && /* @__PURE__ */ J("span", {
1642
+ P && t[P] != null && i.fields.get(P) && /* @__PURE__ */ J("span", {
1643
1643
  style: { fontWeight: 500 },
1644
- children: C({
1645
- field: a.fields.get(F),
1646
- fieldName: F,
1647
- value: t[F],
1644
+ children: x({
1645
+ field: i.fields.get(P),
1646
+ fieldName: P,
1647
+ value: t[P],
1648
1648
  mode: "display",
1649
1649
  record: t,
1650
- refs: h,
1651
- locale: T
1650
+ refs: p,
1651
+ locale: w
1652
1652
  })
1653
1653
  }),
1654
- I && t[I] != null && a.fields.get(I) && /* @__PURE__ */ J(i, {
1654
+ F && t[F] != null && i.fields.get(F) && /* @__PURE__ */ J(n, {
1655
1655
  tone: "slate",
1656
1656
  size: "xs",
1657
- children: C({
1658
- field: a.fields.get(I),
1659
- fieldName: I,
1660
- value: t[I],
1657
+ children: x({
1658
+ field: i.fields.get(F),
1659
+ fieldName: F,
1660
+ value: t[F],
1661
1661
  mode: "display",
1662
1662
  record: t,
1663
- refs: h,
1664
- locale: T
1663
+ refs: p,
1664
+ locale: w
1665
1665
  })
1666
1666
  }),
1667
- B && t[B] != null && a.fields.get(B) && /* @__PURE__ */ J(ut, {
1668
- value: t[B],
1669
- field: a.fields.get(B)
1667
+ z && t[z] != null && i.fields.get(z) && /* @__PURE__ */ J(ut, {
1668
+ value: t[z],
1669
+ field: i.fields.get(z)
1670
1670
  }),
1671
- V && t[V] != null && a.fields.get(V) && /* @__PURE__ */ J(i, {
1671
+ B && t[B] != null && i.fields.get(B) && /* @__PURE__ */ J(n, {
1672
1672
  tone: "slate",
1673
1673
  size: "xs",
1674
- children: C({
1675
- field: a.fields.get(V),
1676
- fieldName: V,
1677
- value: t[V],
1674
+ children: x({
1675
+ field: i.fields.get(B),
1676
+ fieldName: B,
1677
+ value: t[B],
1678
1678
  mode: "display",
1679
1679
  record: t,
1680
- refs: h,
1681
- locale: T
1680
+ refs: p,
1681
+ locale: w
1682
1682
  })
1683
1683
  }),
1684
- z && t[z] != null && a.fields.get(z) && /* @__PURE__ */ Y("span", { children: [
1684
+ R && t[R] != null && i.fields.get(R) && /* @__PURE__ */ Y("span", { children: [
1685
1685
  "by",
1686
1686
  " ",
1687
- C({
1688
- field: a.fields.get(z),
1689
- fieldName: z,
1690
- value: t[z],
1687
+ x({
1688
+ field: i.fields.get(R),
1689
+ fieldName: R,
1690
+ value: t[R],
1691
1691
  mode: "display",
1692
1692
  record: t,
1693
- refs: h,
1694
- locale: T
1693
+ refs: p,
1694
+ locale: w
1695
1695
  })
1696
1696
  ] }),
1697
- !x && /* @__PURE__ */ Y("div", {
1697
+ !S && /* @__PURE__ */ Y("div", {
1698
1698
  style: {
1699
1699
  marginLeft: "auto",
1700
1700
  display: "flex",
1701
1701
  alignItems: "center",
1702
1702
  gap: 2
1703
1703
  },
1704
- children: [/* @__PURE__ */ J(p, {
1704
+ children: [/* @__PURE__ */ J(l, {
1705
1705
  size: 22,
1706
1706
  icon: /* @__PURE__ */ J(e.edit, { size: 11 }),
1707
- onClick: ee,
1707
+ onClick: te,
1708
1708
  title: "Edit"
1709
- }), /* @__PURE__ */ J(p, {
1709
+ }), /* @__PURE__ */ J(l, {
1710
1710
  size: 22,
1711
1711
  icon: /* @__PURE__ */ J(e.trash, { size: 11 }),
1712
- onClick: () => N.mutate(),
1712
+ onClick: () => ee.mutate(),
1713
1713
  title: "Delete"
1714
1714
  })]
1715
1715
  })
1716
1716
  ]
1717
1717
  }),
1718
- L && t[L] != null && a.fields.get(L) && /* @__PURE__ */ J("div", {
1718
+ I && t[I] != null && i.fields.get(I) && /* @__PURE__ */ J("div", {
1719
1719
  style: {
1720
1720
  fontSize: 12.5,
1721
1721
  fontWeight: 500,
1722
1722
  marginTop: 6
1723
1723
  },
1724
- children: C({
1725
- field: a.fields.get(L),
1726
- fieldName: L,
1727
- value: t[L],
1724
+ children: x({
1725
+ field: i.fields.get(I),
1726
+ fieldName: I,
1727
+ value: t[I],
1728
1728
  mode: "display",
1729
1729
  record: t,
1730
- refs: h,
1731
- locale: T
1730
+ refs: p,
1731
+ locale: w
1732
1732
  })
1733
1733
  }),
1734
- R && t[R] != null && R !== L && a.fields.get(R) && /* @__PURE__ */ J("div", {
1734
+ L && t[L] != null && L !== I && i.fields.get(L) && /* @__PURE__ */ J("div", {
1735
1735
  style: {
1736
1736
  fontSize: 12.5,
1737
1737
  fontWeight: 400,
1738
1738
  marginTop: 6
1739
1739
  },
1740
- children: C({
1741
- field: a.fields.get(R),
1742
- fieldName: R,
1743
- value: t[R],
1740
+ children: x({
1741
+ field: i.fields.get(L),
1742
+ fieldName: L,
1743
+ value: t[L],
1744
1744
  mode: "display",
1745
1745
  record: t,
1746
- refs: h,
1747
- locale: T
1746
+ refs: p,
1747
+ locale: w
1748
1748
  })
1749
1749
  })
1750
1750
  ]
@@ -1752,12 +1752,12 @@ function ot({ row: t, rowId: r, childEntity: a, entityCode: o, parentEntity: s,
1752
1752
  }
1753
1753
  function st(e) {
1754
1754
  if (e == null) return "";
1755
- let t = new Date(b(e));
1755
+ let t = new Date(v(e));
1756
1756
  return Number.isNaN(t.getTime()) ? "" : `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`;
1757
1757
  }
1758
1758
  function ct(e) {
1759
1759
  if (e == null) return "—";
1760
- let t = new Date(b(e));
1760
+ let t = new Date(v(e));
1761
1761
  if (Number.isNaN(t.getTime())) return "—";
1762
1762
  let n = /* @__PURE__ */ new Date(), r = /* @__PURE__ */ new Date();
1763
1763
  r.setDate(n.getDate() - 1);
@@ -1833,66 +1833,66 @@ function dt(e, t) {
1833
1833
  }
1834
1834
  //#endregion
1835
1835
  //#region src/components/detail-layout/EditableChildrenTable.tsx
1836
- function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: a, validationErrors: s, refs: l, forceTablePresentation: u = !1 }) {
1837
- let d = E(), f = o(), 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) => {
1836
+ function ft({ config: t, childEntity: n, schema: r, rows: o, onChange: s, validationErrors: c, refs: u, forceTablePresentation: d = !1 }) {
1837
+ let f = T(), p = i(), m = G(null), h = t.columns, g = t.position_field, _ = new Set(Array.isArray(t.foreign_key) ? t.foreign_key : [t.foreign_key]), y = h.filter((e) => {
1838
1838
  if (_.has(e) || t.position_field && e === t.position_field) return !1;
1839
1839
  let r = n.fields.get(e);
1840
1840
  return !(!r || r.auto || r.primary || r.source);
1841
- }), y = new Set(h.filter((e) => {
1841
+ }), b = new Set(h.filter((e) => {
1842
1842
  if (t.position_field && e === t.position_field) return !0;
1843
1843
  let r = n.fields.get(e);
1844
1844
  return r && (r.auto || r.primary || r.source);
1845
- })), x = H((e, t, n) => {
1846
- a(i.map((r) => r._key === e ? {
1845
+ })), S = H((e, t, n) => {
1846
+ s(o.map((r) => r._key === e ? {
1847
1847
  ...r,
1848
1848
  [t]: n,
1849
1849
  _dirty: !0
1850
1850
  } : r));
1851
- }, [i, a]), S = H(() => {
1851
+ }, [o, s]), C = H(() => {
1852
1852
  let e = {
1853
1853
  _key: crypto.randomUUID(),
1854
1854
  _dirty: !0
1855
1855
  };
1856
- g && (e[g] = i.filter((e) => !e._deleted).reduce((e, t) => {
1856
+ g && (e[g] = o.filter((e) => !e._deleted).reduce((e, t) => {
1857
1857
  let n = typeof t[g] == "number" ? t[g] : -1;
1858
1858
  return Math.max(e, n);
1859
1859
  }, -1) + 1);
1860
1860
  let r = t.quick_add?.defaults ?? {};
1861
- for (let t of v) {
1861
+ for (let t of y) {
1862
1862
  let i = n.fields.get(t);
1863
1863
  i && (r[t] === void 0 ? i.default === void 0 ? i.type === "bool" && (e[t] = !1) : e[t] = i.default : e[t] = r[t]);
1864
1864
  }
1865
- a([...i, e]);
1865
+ s([...o, e]);
1866
1866
  }, [
1867
- i,
1868
- a,
1869
- v,
1867
+ o,
1868
+ s,
1869
+ y,
1870
1870
  n,
1871
1871
  t.quick_add?.defaults,
1872
1872
  g
1873
1873
  ]), w = H((e) => {
1874
- a(i.map((t) => t._key === e ? {
1874
+ s(o.map((t) => t._key === e ? {
1875
1875
  ...t,
1876
1876
  _deleted: !0
1877
1877
  } : t));
1878
- }, [i, a]), T = H((e) => {
1879
- a(i.map((t) => t._key === e ? {
1878
+ }, [o, s]), D = H((e) => {
1879
+ s(o.map((t) => t._key === e ? {
1880
1880
  ...t,
1881
1881
  _deleted: !1
1882
1882
  } : t));
1883
- }, [i, a]), O = H((e, t) => {
1883
+ }, [o, s]), O = H((e, t) => {
1884
1884
  if (!g) return;
1885
- let n = i.filter((e) => !e._deleted), r = i.filter((e) => e._deleted), o = n.findIndex((t) => t._key === e), s = o + t;
1886
- if (o < 0 || s < 0 || s >= n.length) return;
1887
- let c = [...n], [l] = c.splice(o, 1);
1888
- c.splice(s, 0, l), a([...c.map((e, t) => ({
1885
+ let n = o.filter((e) => !e._deleted), r = o.filter((e) => e._deleted), i = n.findIndex((t) => t._key === e), a = i + t;
1886
+ if (i < 0 || a < 0 || a >= n.length) return;
1887
+ let c = [...n], [l] = c.splice(i, 1);
1888
+ c.splice(a, 0, l), s([...c.map((e, t) => ({
1889
1889
  ...e,
1890
1890
  [g]: t,
1891
1891
  _dirty: e[g] === t ? e._dirty : !0
1892
1892
  })), ...r]);
1893
1893
  }, [
1894
- i,
1895
- a,
1894
+ o,
1895
+ s,
1896
1896
  g
1897
1897
  ]), k = H((e) => {
1898
1898
  let t = e.target, n = t.closest("td");
@@ -1918,7 +1918,7 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
1918
1918
  if (o < t.length - 1) {
1919
1919
  let e = t[o + 1].cells[a]?.querySelector("input, select, textarea, [tabindex]");
1920
1920
  e && e.focus();
1921
- } else S(), requestAnimationFrame(() => {
1921
+ } else C(), requestAnimationFrame(() => {
1922
1922
  let e = i.querySelectorAll("tr"), t = e[e.length - 1];
1923
1923
  if (t) {
1924
1924
  let e = t.querySelector("input, select, textarea, [tabindex]");
@@ -1926,21 +1926,21 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
1926
1926
  }
1927
1927
  });
1928
1928
  } else e.key === "Escape" && t.blur?.();
1929
- }, [S]), A = oe;
1930
- return f.isPhone && !u ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
1929
+ }, [C]), A = se;
1930
+ return p.isPhone && !d ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
1931
1931
  style: {
1932
1932
  display: "flex",
1933
1933
  flexDirection: "column",
1934
1934
  gap: 10
1935
1935
  },
1936
- children: i.map((t, a) => {
1937
- let o = !!t._deleted, c = s?.[t._key], u = g ? i.filter((e) => !e._deleted) : [], f = g ? u.findIndex((e) => e._key === t._key) : -1;
1936
+ children: o.map((t, i) => {
1937
+ let a = !!t._deleted, s = c?.[t._key], d = g ? o.filter((e) => !e._deleted) : [], p = g ? d.findIndex((e) => e._key === t._key) : -1;
1938
1938
  return /* @__PURE__ */ Y("div", {
1939
1939
  style: {
1940
1940
  border: "1px solid var(--border)",
1941
1941
  borderRadius: 8,
1942
1942
  background: "var(--surface)",
1943
- opacity: o ? .58 : 1,
1943
+ opacity: a ? .58 : 1,
1944
1944
  overflow: "hidden"
1945
1945
  },
1946
1946
  children: [/* @__PURE__ */ Y("div", {
@@ -1959,31 +1959,31 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
1959
1959
  fontWeight: 600,
1960
1960
  color: "var(--text-2)"
1961
1961
  },
1962
- children: ["Row ", a + 1]
1962
+ children: ["Row ", i + 1]
1963
1963
  }), /* @__PURE__ */ Y("div", {
1964
1964
  style: {
1965
1965
  display: "flex",
1966
1966
  alignItems: "center",
1967
1967
  gap: 4
1968
1968
  },
1969
- children: [g && !o && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(p, {
1969
+ children: [g && !a && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(l, {
1970
1970
  size: 32,
1971
1971
  icon: /* @__PURE__ */ J(e.up, { size: 14 }),
1972
1972
  onClick: () => O(t._key, -1),
1973
- disabled: f <= 0,
1973
+ disabled: p <= 0,
1974
1974
  title: "Move row up"
1975
- }), /* @__PURE__ */ J(p, {
1975
+ }), /* @__PURE__ */ J(l, {
1976
1976
  size: 32,
1977
1977
  icon: /* @__PURE__ */ J(e.down, { size: 14 }),
1978
1978
  onClick: () => O(t._key, 1),
1979
- disabled: f === -1 || f >= u.length - 1,
1979
+ disabled: p === -1 || p >= d.length - 1,
1980
1980
  title: "Move row down"
1981
- })] }), o ? /* @__PURE__ */ J(p, {
1981
+ })] }), a ? /* @__PURE__ */ J(l, {
1982
1982
  size: 32,
1983
1983
  icon: /* @__PURE__ */ J(e.refresh, { size: 14 }),
1984
- onClick: () => T(t._key),
1984
+ onClick: () => D(t._key),
1985
1985
  title: "Undo delete"
1986
- }) : /* @__PURE__ */ J(p, {
1986
+ }) : /* @__PURE__ */ J(l, {
1987
1987
  size: 32,
1988
1988
  icon: /* @__PURE__ */ J(e.trash, { size: 14 }),
1989
1989
  onClick: () => w(t._key),
@@ -1998,58 +1998,58 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
1998
1998
  gap: 12
1999
1999
  },
2000
2000
  children: h.map((e) => {
2001
- let i = n.fields.get(e), a = c?.includes(e), s = y.has(e), u = i ? D(i, e, r.entities) : e, f = `child-${t._key}-${e}`, p = `${f}-label`, m = {
2002
- outline: a ? "1px solid var(--danger)" : "none",
2001
+ let i = n.fields.get(e), o = s?.includes(e), c = b.has(e), l = i ? E(i, e, r.entities) : e, d = `child-${t._key}-${e}`, p = `${d}-label`, m = {
2002
+ outline: o ? "1px solid var(--danger)" : "none",
2003
2003
  outlineOffset: 3,
2004
- borderRadius: a ? 5 : 0
2004
+ borderRadius: o ? 5 : 0
2005
2005
  }, h = {
2006
2006
  fontSize: 11.5,
2007
2007
  fontWeight: 600,
2008
2008
  color: "var(--text-3)"
2009
- }, g = !o && !s && !!i;
2009
+ }, g = !a && !c && !!i;
2010
2010
  return /* @__PURE__ */ Y("div", {
2011
2011
  style: {
2012
2012
  display: "flex",
2013
2013
  flexDirection: "column",
2014
2014
  gap: 5,
2015
2015
  minWidth: 0,
2016
- textDecoration: o ? "line-through" : "none"
2016
+ textDecoration: a ? "line-through" : "none"
2017
2017
  },
2018
- title: a ? `${e} is required` : void 0,
2018
+ title: o ? `${e} is required` : void 0,
2019
2019
  children: [g ? /* @__PURE__ */ J("label", {
2020
2020
  id: p,
2021
- htmlFor: f,
2021
+ htmlFor: d,
2022
2022
  style: h,
2023
- children: u
2023
+ children: l
2024
2024
  }) : /* @__PURE__ */ J("div", {
2025
2025
  id: p,
2026
2026
  style: h,
2027
- children: u
2027
+ children: l
2028
2028
  }), /* @__PURE__ */ J("div", {
2029
2029
  style: m,
2030
- children: o || s ? i ? C({
2030
+ children: a || c ? i ? x({
2031
2031
  field: i,
2032
2032
  fieldName: e,
2033
2033
  value: t[e],
2034
2034
  mode: "display",
2035
2035
  record: t,
2036
- refs: l,
2037
- fieldId: f,
2036
+ refs: u,
2037
+ fieldId: d,
2038
2038
  labelId: p,
2039
- locale: d
2040
- }) : b(t[e]) : i ? C({
2039
+ locale: f
2040
+ }) : v(t[e]) : i ? x({
2041
2041
  field: i,
2042
2042
  fieldName: e,
2043
2043
  value: t[e],
2044
2044
  mode: "edit",
2045
- onChange: (n) => x(t._key, e, n),
2045
+ onChange: (n) => S(t._key, e, n),
2046
2046
  record: t,
2047
- refs: l,
2047
+ refs: u,
2048
2048
  compact: !0,
2049
- fieldId: f,
2049
+ fieldId: d,
2050
2050
  labelId: p,
2051
- locale: d
2052
- }) : b(t[e])
2051
+ locale: f
2052
+ }) : v(t[e])
2053
2053
  })]
2054
2054
  }, e);
2055
2055
  })
@@ -2058,34 +2058,34 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
2058
2058
  })
2059
2059
  }), /* @__PURE__ */ J("div", {
2060
2060
  style: { marginTop: 10 },
2061
- children: /* @__PURE__ */ J(c, {
2061
+ children: /* @__PURE__ */ J(a, {
2062
2062
  kind: "ghost",
2063
2063
  size: "sm",
2064
2064
  icon: /* @__PURE__ */ J(e.plus, { size: 14 }),
2065
- onClick: S,
2065
+ onClick: C,
2066
2066
  children: "Add row"
2067
2067
  })
2068
2068
  })] }) : /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
2069
2069
  style: { overflowX: "auto" },
2070
2070
  children: /* @__PURE__ */ Y("table", {
2071
2071
  ref: m,
2072
- style: se,
2072
+ style: ce,
2073
2073
  onKeyDown: k,
2074
2074
  children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ Y("tr", { children: [h.map((e) => {
2075
2075
  let t = n.fields.get(e);
2076
2076
  return /* @__PURE__ */ J("th", {
2077
2077
  style: A,
2078
- children: t ? D(t, e, r.entities) : e
2078
+ children: t ? E(t, e, r.entities) : e
2079
2079
  }, e);
2080
2080
  }), /* @__PURE__ */ J("th", { style: {
2081
2081
  ...A,
2082
2082
  width: 40
2083
- } })] }) }), /* @__PURE__ */ J("tbody", { children: i.map((t) => {
2084
- let r = !!t._deleted, i = s?.[t._key];
2083
+ } })] }) }), /* @__PURE__ */ J("tbody", { children: o.map((t) => {
2084
+ let r = !!t._deleted, i = c?.[t._key];
2085
2085
  return /* @__PURE__ */ Y("tr", {
2086
2086
  style: { opacity: r ? .5 : 1 },
2087
2087
  children: [h.map((e) => {
2088
- let a = n.fields.get(e), o = i?.includes(e), s = y.has(e);
2088
+ let a = n.fields.get(e), o = i?.includes(e), s = b.has(e);
2089
2089
  return r || s ? /* @__PURE__ */ J("td", {
2090
2090
  style: {
2091
2091
  padding: "6px 12px",
@@ -2094,15 +2094,15 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
2094
2094
  textDecoration: r ? "line-through" : "none",
2095
2095
  color: "var(--text-2)"
2096
2096
  },
2097
- children: a ? C({
2097
+ children: a ? x({
2098
2098
  field: a,
2099
2099
  fieldName: e,
2100
2100
  value: t[e],
2101
2101
  mode: "display",
2102
2102
  record: t,
2103
- refs: l,
2104
- locale: d
2105
- }) : b(t[e])
2103
+ refs: u,
2104
+ locale: f
2105
+ }) : v(t[e])
2106
2106
  }, e) : /* @__PURE__ */ J("td", {
2107
2107
  style: {
2108
2108
  padding: "4px 4px",
@@ -2113,17 +2113,17 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
2113
2113
  borderRadius: o ? 4 : 0
2114
2114
  },
2115
2115
  title: o ? `${e} is required` : void 0,
2116
- children: a ? C({
2116
+ children: a ? x({
2117
2117
  field: a,
2118
2118
  fieldName: e,
2119
2119
  value: t[e],
2120
2120
  mode: "edit",
2121
- onChange: (n) => x(t._key, e, n),
2121
+ onChange: (n) => S(t._key, e, n),
2122
2122
  record: t,
2123
- refs: l,
2123
+ refs: u,
2124
2124
  compact: !0,
2125
- locale: d
2126
- }) : b(t[e])
2125
+ locale: f
2126
+ }) : v(t[e])
2127
2127
  }, e);
2128
2128
  }), /* @__PURE__ */ J("td", {
2129
2129
  style: {
@@ -2131,12 +2131,12 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
2131
2131
  borderBottom: "1px solid var(--divider)",
2132
2132
  verticalAlign: "middle"
2133
2133
  },
2134
- children: r ? /* @__PURE__ */ J(p, {
2134
+ children: r ? /* @__PURE__ */ J(l, {
2135
2135
  size: 24,
2136
2136
  icon: /* @__PURE__ */ J(e.refresh, { size: 12 }),
2137
- onClick: () => T(t._key),
2137
+ onClick: () => D(t._key),
2138
2138
  title: "Undo delete"
2139
- }) : /* @__PURE__ */ J(p, {
2139
+ }) : /* @__PURE__ */ J(l, {
2140
2140
  size: 24,
2141
2141
  icon: /* @__PURE__ */ J(e.trash, { size: 12 }),
2142
2142
  onClick: () => w(t._key),
@@ -2148,34 +2148,34 @@ function ft({ config: t, childEntity: n, schema: r, rows: i, onChange: a, valida
2148
2148
  })
2149
2149
  }), /* @__PURE__ */ J("div", {
2150
2150
  style: { marginTop: 8 },
2151
- children: /* @__PURE__ */ J(c, {
2151
+ children: /* @__PURE__ */ J(a, {
2152
2152
  kind: "ghost",
2153
2153
  size: "xs",
2154
2154
  icon: /* @__PURE__ */ J(e.plus, { size: 12 }),
2155
- onClick: S,
2155
+ onClick: C,
2156
2156
  children: "Add row"
2157
2157
  })
2158
2158
  })] });
2159
2159
  }
2160
2160
  //#endregion
2161
2161
  //#region src/components/detail-layout/ChildrenBlock.tsx
2162
- var pt = de(() => import("./DraggableChildrenTable-DILqStHQ.js").then((e) => ({ default: e.DraggableChildrenTable })));
2162
+ var pt = V(() => import("./DraggableChildrenTable-CAHg7paQ.js").then((e) => ({ default: e.DraggableChildrenTable })));
2163
2163
  function mt({ node: e, ctx: n }) {
2164
- let r = o(), i = e.children;
2165
- if (!i) return null;
2166
- let a = r.isPhone && n.relatedRecordsPresentation === "table";
2164
+ let r = i(), a = e.children;
2165
+ if (!a) return null;
2166
+ let o = r.isPhone && n.relatedRecordsPresentation === "table";
2167
2167
  if (n.isNew && n.mode !== "edit") return null;
2168
- let s = ze(n.entity, i);
2168
+ let s = ze(n.entity, a);
2169
2169
  if (!s) return /* @__PURE__ */ Y("div", {
2170
2170
  className: "text-sm text-muted-foreground py-2",
2171
- children: ["Unknown child relation: ", i]
2171
+ children: ["Unknown child relation: ", a]
2172
2172
  });
2173
2173
  let c = n.schema.entities[s.entity];
2174
2174
  if (!c) return /* @__PURE__ */ Y("div", {
2175
2175
  className: "text-sm text-muted-foreground py-2",
2176
2176
  children: ["Entity not found: ", s.entity]
2177
2177
  });
2178
- let l = De(s, c, e), u = X(e, n), d = Z(e, n), f = (e) => l.mode === "timeline" || n.withinCard ? e : /* @__PURE__ */ J(R, {
2178
+ let l = De(s, c, e), u = X(e, n), d = Z(e, n), f = (e) => l.mode === "timeline" || n.withinCard ? e : /* @__PURE__ */ J(P, {
2179
2179
  title: u,
2180
2180
  icon: d ? /* @__PURE__ */ J(t, {
2181
2181
  name: d,
@@ -2183,19 +2183,19 @@ function mt({ node: e, ctx: n }) {
2183
2183
  }) : void 0,
2184
2184
  children: e
2185
2185
  });
2186
- if (n.mode === "edit" && l.editable && l.interaction !== "navigate" && l.interaction !== "readonly" && k(c, "update") && l.mode === "table" && n.pendingChildren !== void 0 && n.onChildrenChange) {
2187
- let e = n.pendingChildren[i] ?? [], t = n.childValidationErrors?.[i], o = l.position_field ? r.isPhone && !a ? ft : pt : ft;
2188
- return f(/* @__PURE__ */ J(le, {
2189
- fallback: /* @__PURE__ */ J(P, {}),
2190
- children: /* @__PURE__ */ J(o, {
2186
+ if (n.mode === "edit" && l.editable && l.interaction !== "navigate" && l.interaction !== "readonly" && O(c, "update") && l.mode === "table" && n.pendingChildren !== void 0 && n.onChildrenChange) {
2187
+ let e = n.pendingChildren[a] ?? [], t = n.childValidationErrors?.[a], i = l.position_field ? r.isPhone && !o ? ft : pt : ft;
2188
+ return f(/* @__PURE__ */ J(ue, {
2189
+ fallback: /* @__PURE__ */ J(te, {}),
2190
+ children: /* @__PURE__ */ J(i, {
2191
2191
  config: l,
2192
2192
  childEntity: c,
2193
2193
  schema: n.schema,
2194
2194
  rows: e,
2195
- onChange: (e) => n.onChildrenChange(i, e),
2195
+ onChange: (e) => n.onChildrenChange(a, e),
2196
2196
  validationErrors: t,
2197
2197
  refs: n.refs,
2198
- forceTablePresentation: a
2198
+ forceTablePresentation: o
2199
2199
  })
2200
2200
  }));
2201
2201
  }
@@ -2210,7 +2210,7 @@ function mt({ node: e, ctx: n }) {
2210
2210
  case "list": return f(/* @__PURE__ */ J(Ge, { ...p }));
2211
2211
  case "cards": return f(/* @__PURE__ */ J(Ke, { ...p }));
2212
2212
  case "timeline": return f(/* @__PURE__ */ J(at, { ...p }));
2213
- default: return r.isPhone && !a ? f(/* @__PURE__ */ J(Ke, { ...p })) : f(/* @__PURE__ */ J(We, { ...p }));
2213
+ default: return r.isPhone && !o ? f(/* @__PURE__ */ J(Ke, { ...p })) : f(/* @__PURE__ */ J(We, { ...p }));
2214
2214
  }
2215
2215
  }
2216
2216
  //#endregion
@@ -2221,7 +2221,7 @@ var ht = 150, gt = 560, _t = "20px", vt = 4, yt = /* @__PURE__ */ new Set([
2221
2221
  "json",
2222
2222
  "structure",
2223
2223
  "multilang_text"
2224
- ]), bt = ue({ columns: 2 });
2224
+ ]), bt = de({ columns: 2 });
2225
2225
  function xt({ columns: e = 2, children: t }) {
2226
2226
  let n = G(null), [r, i] = K(!1);
2227
2227
  U(() => {
@@ -2247,7 +2247,7 @@ function xt({ columns: e = 2, children: t }) {
2247
2247
  })
2248
2248
  });
2249
2249
  }
2250
- function St({ label: t, children: n, span: r = !1, required: i, error: a, hint: o, actions: s, copyValue: c, mode: u = "display", htmlFor: d, labelId: f, labelTitle: p, "data-testid": m }) {
2250
+ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint: s, actions: c, copyValue: l, mode: u = "display", htmlFor: d, labelId: f, labelTitle: p, "data-testid": m }) {
2251
2251
  let h = fe(bt), g = r || h.columns === 1, _ = !!a;
2252
2252
  return /* @__PURE__ */ Y("div", {
2253
2253
  className: "detail-row",
@@ -2323,7 +2323,7 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2323
2323
  },
2324
2324
  children: n
2325
2325
  }) : n
2326
- }), (c || s) && /* @__PURE__ */ Y("div", {
2326
+ }), (l || c) && /* @__PURE__ */ Y("div", {
2327
2327
  className: "detail-row-action",
2328
2328
  style: {
2329
2329
  display: "flex",
@@ -2331,13 +2331,13 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2331
2331
  flexShrink: 0,
2332
2332
  marginTop: -2
2333
2333
  },
2334
- children: [c && /* @__PURE__ */ J(l, {
2335
- value: c,
2334
+ children: [l && /* @__PURE__ */ J(o, {
2335
+ value: l,
2336
2336
  size: "sm",
2337
2337
  title: "Copy value"
2338
- }), s]
2338
+ }), c]
2339
2339
  })]
2340
- }), (_ || o != null) && /* @__PURE__ */ Y("div", {
2340
+ }), (_ || s != null) && /* @__PURE__ */ Y("div", {
2341
2341
  style: {
2342
2342
  fontSize: 11.5,
2343
2343
  lineHeight: 1.4,
@@ -2346,7 +2346,7 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2346
2346
  alignItems: "center",
2347
2347
  gap: 4
2348
2348
  },
2349
- children: [_ && /* @__PURE__ */ J(e.warning, { size: 11 }), /* @__PURE__ */ J("span", { children: _ ? a : o })]
2349
+ children: [_ && /* @__PURE__ */ J(e.warning, { size: 11 }), /* @__PURE__ */ J("span", { children: _ ? a : s })]
2350
2350
  })]
2351
2351
  })]
2352
2352
  });
@@ -2354,22 +2354,22 @@ function St({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2354
2354
  //#endregion
2355
2355
  //#region src/components/detail-layout/FieldsBlock.tsx
2356
2356
  function Ct({ fields: e, ctx: t }) {
2357
- let { entity: n, entityCode: r, record: i, mode: a, onFieldChange: o, schema: s } = t, c = E(), l = t.columns ?? 2, u = l === 1 && e.length === 1;
2357
+ let { entity: n, entityCode: r, record: i, mode: a, onFieldChange: o, schema: s } = t, c = T(), l = t.columns ?? 2, u = l === 1 && e.length === 1;
2358
2358
  return /* @__PURE__ */ J(xt, {
2359
2359
  columns: l,
2360
2360
  children: e.map((e) => {
2361
- let l = e.name, d = `${r ?? "field"}-${l}`, f = `${d}-label`, p = n.fields.get(l), m = !!(p?.auto || p?.readonly || p?.source), h = z(n, l), g = h?.read === "denied", _ = h?.write === "denied", v = a === "display" ? g : _ || g, y = m || a === "edit" && _ ? "display" : a, x = v ? /* @__PURE__ */ J(B, {
2361
+ let l = e.name, d = `${r ?? "field"}-${l}`, f = `${d}-label`, p = n.fields.get(l), m = !!(p?.auto || p?.readonly || p?.source), h = F(n, l), g = h?.read === "denied", _ = h?.write === "denied", y = a === "display" ? g : _ || g, b = m || a === "edit" && _ ? "display" : a, x = y ? /* @__PURE__ */ J(oe, {
2362
2362
  tier: h.classification,
2363
- tierDef: ie(s, n, l),
2363
+ tierDef: ae(s, n, l),
2364
2364
  requiredPermission: h?.required_permission,
2365
2365
  locale: c,
2366
- variant: y === "edit" ? "input" : "value"
2367
- }) : L({
2366
+ variant: b === "edit" ? "input" : "value"
2367
+ }) : I({
2368
2368
  entity: n,
2369
2369
  entityCode: r,
2370
2370
  fieldName: l,
2371
2371
  record: i,
2372
- mode: y,
2372
+ mode: b,
2373
2373
  onChange: o && !m ? (e) => o(l, e) : void 0,
2374
2374
  refs: t.refs,
2375
2375
  entities: s?.entities,
@@ -2379,17 +2379,17 @@ function Ct({ fields: e, ctx: t }) {
2379
2379
  labelId: f
2380
2380
  });
2381
2381
  if (!x) return null;
2382
- let S = a === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ J(q, { children: e.actions.map((e, t) => /* @__PURE__ */ J(V, {
2382
+ let S = a === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ J(q, { children: e.actions.map((e, t) => /* @__PURE__ */ J(L, {
2383
2383
  actionCode: `${l}.action[${t}]`,
2384
2384
  action: e,
2385
2385
  entityCode: r,
2386
2386
  row: i,
2387
2387
  variant: "ghost",
2388
2388
  size: "icon"
2389
- }, t)) }) : void 0, C = !!p && yt.has(p.type), w = i?.[l], E = y === "display" && (p?.copyable || p?.type === "uuid") && w != null && w !== "" ? b(w) : void 0, D = T(p?.display?.description);
2389
+ }, t)) }) : void 0, C = !!p && yt.has(p.type), T = i?.[l], E = b === "display" && (p?.copyable || p?.type === "uuid") && T != null && T !== "" ? v(T) : void 0, D = w(p?.display?.description);
2390
2390
  return u ? /* @__PURE__ */ Y("div", {
2391
2391
  style: { gridColumn: "1 / -1" },
2392
- children: [x, y === "edit" && D && /* @__PURE__ */ J("div", {
2392
+ children: [x, b === "edit" && D && /* @__PURE__ */ J("div", {
2393
2393
  style: {
2394
2394
  fontSize: 11.5,
2395
2395
  lineHeight: 1.4,
@@ -2399,15 +2399,15 @@ function Ct({ fields: e, ctx: t }) {
2399
2399
  children: D
2400
2400
  })]
2401
2401
  }, l) : /* @__PURE__ */ J(St, {
2402
- label: ee(n, l, s.entities),
2403
- htmlFor: y === "edit" ? d : void 0,
2402
+ label: ie(n, l, s.entities),
2403
+ htmlFor: b === "edit" ? d : void 0,
2404
2404
  labelId: f,
2405
2405
  labelTitle: D || void 0,
2406
2406
  required: p?.required ?? !1,
2407
- mode: y,
2407
+ mode: b,
2408
2408
  span: C,
2409
2409
  error: t.fieldErrors?.[l],
2410
- hint: y === "edit" && D ? D : void 0,
2410
+ hint: b === "edit" && D ? D : void 0,
2411
2411
  actions: S,
2412
2412
  copyValue: E,
2413
2413
  children: x
@@ -2433,7 +2433,7 @@ function Et({ node: e, ctx: t }) {
2433
2433
  return u.length === 0 ? null : /* @__PURE__ */ J(xt, {
2434
2434
  columns: 2,
2435
2435
  children: u.map(([e, a]) => {
2436
- let c = r?.find((t) => t.property_code === e), l = _(a), u = a.readonly || !i ? "display" : o;
2436
+ let c = r?.find((t) => t.property_code === e), l = p(a), u = a.readonly || !i ? "display" : o;
2437
2437
  return /* @__PURE__ */ J(Dt, {
2438
2438
  propCode: e,
2439
2439
  prop: a,
@@ -2449,7 +2449,7 @@ function Et({ node: e, ctx: t }) {
2449
2449
  });
2450
2450
  }
2451
2451
  function Dt({ propCode: e, prop: t, field: n, value: r, mode: i, onSetProperty: a, refs: o, entity: s, schema: c }) {
2452
- let l = E(), u = G(null);
2452
+ let l = T(), u = G(null);
2453
2453
  U(() => () => {
2454
2454
  u.current && clearTimeout(u.current);
2455
2455
  }, []);
@@ -2459,18 +2459,18 @@ function Dt({ propCode: e, prop: t, field: n, value: r, mode: i, onSetProperty:
2459
2459
  e,
2460
2460
  t.type,
2461
2461
  a
2462
- ]), f = z(s, e), p = f?.read === "denied", m = f?.write === "denied", h = i === "display" ? p : m || p, g = i === "edit" && m ? "display" : i;
2462
+ ]), f = F(s, e), p = f?.read === "denied", m = f?.write === "denied", h = i === "display" ? p : m || p, g = i === "edit" && m ? "display" : i;
2463
2463
  return /* @__PURE__ */ J(St, {
2464
- label: T(t.display?.name ?? t.name),
2464
+ label: w(t.display?.name ?? t.name),
2465
2465
  mode: g,
2466
2466
  span: yt.has(t.type),
2467
- children: h ? /* @__PURE__ */ J(B, {
2467
+ children: h ? /* @__PURE__ */ J(oe, {
2468
2468
  tier: f.classification,
2469
- tierDef: ie(c, s, e),
2469
+ tierDef: ae(c, s, e),
2470
2470
  requiredPermission: f?.required_permission,
2471
2471
  locale: l,
2472
2472
  variant: g === "edit" ? "input" : "value"
2473
- }) : C({
2473
+ }) : x({
2474
2474
  field: n,
2475
2475
  fieldName: e,
2476
2476
  value: r,
@@ -2550,7 +2550,7 @@ function Ot({ stages: t, current: n, selectable: r, onSelect: i, compact: a = !1
2550
2550
  }
2551
2551
  //#endregion
2552
2552
  //#region src/components/shared/StatusGroupsDisplay.tsx
2553
- function kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r, mode: a = "edit" }) {
2553
+ function kt({ statusGroups: e, objectStatuses: t, onSetStatus: r, isPending: i, mode: a = "edit" }) {
2554
2554
  return /* @__PURE__ */ J("div", {
2555
2555
  style: {
2556
2556
  display: "flex",
@@ -2561,7 +2561,7 @@ function kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2561
2561
  children: Object.entries(e).map(([e, o]) => {
2562
2562
  let s = t?.find((t) => t.group_code === e)?.status_code, c = s ? o.statuses.find((e) => e.code === s) : void 0;
2563
2563
  if (o.display_mode === "stepper") {
2564
- let t = a === "edit", i = t ? o.transitions && s ? /* @__PURE__ */ new Set([s, ...o.transitions[s] ?? []]) : new Set(o.statuses.map((e) => e.code)) : void 0;
2564
+ let t = a === "edit", n = t ? o.transitions && s ? /* @__PURE__ */ new Set([s, ...o.transitions[s] ?? []]) : new Set(o.statuses.map((e) => e.code)) : void 0;
2565
2565
  return /* @__PURE__ */ Y("div", {
2566
2566
  style: {
2567
2567
  display: "flex",
@@ -2575,21 +2575,21 @@ function kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2575
2575
  color: "var(--text-3)",
2576
2576
  flexShrink: 0
2577
2577
  },
2578
- children: [T(o.name), ":"]
2578
+ children: [w(o.name), ":"]
2579
2579
  }), /* @__PURE__ */ J("div", {
2580
2580
  style: {
2581
2581
  minWidth: 240,
2582
- opacity: r ? .6 : 1,
2583
- pointerEvents: r ? "none" : "auto"
2582
+ opacity: i ? .6 : 1,
2583
+ pointerEvents: i ? "none" : "auto"
2584
2584
  },
2585
2585
  children: /* @__PURE__ */ J(Ot, {
2586
2586
  stages: o.statuses.map((e) => ({
2587
2587
  code: e.code,
2588
- label: T(e.name)
2588
+ label: w(e.name)
2589
2589
  })),
2590
2590
  current: s,
2591
- selectable: i,
2592
- onSelect: t ? (t) => n(e, t) : void 0,
2591
+ selectable: n,
2592
+ onSelect: t ? (t) => r(e, t) : void 0,
2593
2593
  compact: !0
2594
2594
  })
2595
2595
  })]
@@ -2606,11 +2606,11 @@ function kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2606
2606
  fontSize: 12,
2607
2607
  color: "var(--text-3)"
2608
2608
  },
2609
- children: [T(o.name), ":"]
2610
- }), c ? /* @__PURE__ */ J(i, {
2609
+ children: [w(o.name), ":"]
2610
+ }), c ? /* @__PURE__ */ J(n, {
2611
2611
  tone: c.color ?? "slate",
2612
2612
  size: "xs",
2613
- children: T(c.name)
2613
+ children: w(c.name)
2614
2614
  }) : /* @__PURE__ */ J("span", {
2615
2615
  style: {
2616
2616
  fontSize: 12.5,
@@ -2633,7 +2633,7 @@ function kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2633
2633
  borderRadius: 999,
2634
2634
  background: `var(--pill-${e.color}, ${e.color})`,
2635
2635
  display: "inline-block"
2636
- } }), T(e.name)]
2636
+ } }), w(e.name)]
2637
2637
  })
2638
2638
  }));
2639
2639
  return /* @__PURE__ */ Y("div", {
@@ -2647,17 +2647,17 @@ function kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2647
2647
  fontSize: 12,
2648
2648
  color: "var(--text-3)"
2649
2649
  },
2650
- children: [T(o.name), ":"]
2650
+ children: [w(o.name), ":"]
2651
2651
  }), /* @__PURE__ */ J("div", {
2652
2652
  style: {
2653
2653
  minWidth: 180,
2654
- opacity: r ? .6 : 1,
2655
- pointerEvents: r ? "none" : "auto"
2654
+ opacity: i ? .6 : 1,
2655
+ pointerEvents: i ? "none" : "auto"
2656
2656
  },
2657
2657
  children: /* @__PURE__ */ J(A, {
2658
2658
  value: s ?? "",
2659
2659
  options: l,
2660
- onChange: (t) => n(e, t),
2660
+ onChange: (t) => r(e, t),
2661
2661
  placeholder: "Select…"
2662
2662
  })
2663
2663
  })]
@@ -2713,7 +2713,7 @@ function Pt(e) {
2713
2713
  }
2714
2714
  //#endregion
2715
2715
  //#region src/components/detail-layout/widgets/JsonDiffWidget.tsx
2716
- var Ft = "Audit change diff", It = de(() => import("./MonacoJson-DVjwsaBK.js").then((e) => ({ default: e.MonacoJsonDiff }))), Lt = de(() => import("./MonacoJson-DVjwsaBK.js").then((e) => ({ default: e.MonacoJsonSource }))), Rt = de(() => import("./JsonEditor-KelPV-OQ.js").then((e) => ({ default: e.JsonEditor })));
2716
+ var Ft = "Audit change diff", It = V(() => import("./MonacoJson-DVjwsaBK.js").then((e) => ({ default: e.MonacoJsonDiff }))), Lt = V(() => import("./MonacoJson-DVjwsaBK.js").then((e) => ({ default: e.MonacoJsonSource }))), Rt = V(() => import("./JsonEditor-KelPV-OQ.js").then((e) => ({ default: e.JsonEditor })));
2717
2717
  function zt() {
2718
2718
  return /* @__PURE__ */ J("div", {
2719
2719
  className: "flex h-full w-full items-center justify-center text-sm text-muted-foreground",
@@ -2721,7 +2721,7 @@ function zt() {
2721
2721
  });
2722
2722
  }
2723
2723
  function Bt({ before: e, after: t }) {
2724
- return /* @__PURE__ */ J(le, {
2724
+ return /* @__PURE__ */ J(ue, {
2725
2725
  fallback: /* @__PURE__ */ J(zt, {}),
2726
2726
  children: /* @__PURE__ */ Y("div", {
2727
2727
  className: "flex h-full w-full gap-2",
@@ -2781,12 +2781,12 @@ function Ht({ values: e, options: t }) {
2781
2781
  className: "h-[480px] w-full overflow-hidden rounded border",
2782
2782
  role: "group",
2783
2783
  "aria-label": Ft,
2784
- children: /* @__PURE__ */ J(te, {
2784
+ children: /* @__PURE__ */ J(R, {
2785
2785
  fallback: /* @__PURE__ */ J(Bt, {
2786
2786
  before: n,
2787
2787
  after: r
2788
2788
  }),
2789
- children: /* @__PURE__ */ J(le, {
2789
+ children: /* @__PURE__ */ J(ue, {
2790
2790
  fallback: /* @__PURE__ */ J(zt, {}),
2791
2791
  children: i === "diff" ? /* @__PURE__ */ J(It, {
2792
2792
  before: o,