@declarion/react 0.39.0 → 0.40.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  import { s as e, t } from "./DynamicIcon-DeRpAaXm.js";
2
- import { F as n, Gn as r, Kn as i, L as a, Nn as o, On as s, R as c, U as l, Wn as u, _ as d, an as f, at as p, bn as m, dn as h, en as g, fn as _, g as v, gn as y, h as b, hn as x, ht as S, it as C, jt as w, ln as T, m as E, on as D, rt as O, sn as k, un as A, zn as j } from "./useCurrentScreen-BA2lb-d7.js";
3
- import { A as M, Dt as N, E as P, J as F, Ot as I, Q as L, T as R, X as ee, Y as z, Z as B, _t as V, d as te, et as ne, o as re, ot as ie, r as ae, st as oe, t as se, u as ce, yt as le } from "./registry-DXNFRlbB.js";
4
- import { n as ue, r as de, t as fe } from "./dataTableStyles-vwD1mVOP.js";
5
- import { Suspense as pe, createContext as me, lazy as he, useCallback as H, useContext as ge, useEffect as U, useId as _e, useLayoutEffect as ve, useMemo as W, useRef as G, useState as K } from "react";
2
+ import { $ as n, A as r, An as i, At as a, Dn as o, En as s, Fn as c, Kt as l, M as u, Q as d, Sn as f, Tn as p, Wn as m, X as h, Yn as g, bn as _, bt as v, cr as y, f as b, hn as x, it as S, j as C, jn as w, or as T, sr as E, tr as D, vt as O, wn as k, xn as A, yt as j } from "./useCurrentScreen-C33VZcNn.js";
3
+ import { A as M, F as ee, I as te, J as N, L as P, P as F, R as I, T as L, V as R, at as z, d as B, it as ne, mt as re, o as ie, pt as ae, q as oe, r as se, t as ce, u as le, z as ue } from "./registry-DbZX1hy8.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 V, useCallback as H, useContext as ge, useEffect as U, useId as _e, useLayoutEffect as ve, useMemo as W, useRef as G, useState as K } from "react";
6
6
  import { useInfiniteQuery as ye, useMutation as be, useQueryClient as xe } 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 we({ config: e, ctx: t }) {
61
61
  }, [u, p]), h = u ?? p(), g = e.height ? Ee(e.height) : void 0;
62
62
  return /* @__PURE__ */ J("div", {
63
63
  ref: l,
64
- className: le("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: le("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 : Te(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: le("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 Oe(e) {
123
123
  function ke(e, t) {
124
124
  let n = Oe(e);
125
125
  if (n) {
126
- if (e.label) return A(e.label);
126
+ if (e.label) return p(e.label);
127
127
  let r = t.entity.children?.find((e) => e.entity === n);
128
- if (r?.display?.name) return A(r.display.name);
128
+ if (r?.display?.name) return p(r.display.name);
129
129
  let i = t.schema.entities[n];
130
- return i && (A(i.display.name_plural) || A(i.display.name)) || n;
130
+ return i && (p(i.display.name_plural) || p(i.display.name)) || n;
131
131
  }
132
- return e.section ? A(e.section.name) : "Tab";
132
+ return e.section ? p(e.section.name) : "Tab";
133
133
  }
134
134
  function Ae(e, t) {
135
135
  if (e.icon) return e.icon;
@@ -144,7 +144,7 @@ function Ae(e, t) {
144
144
  //#endregion
145
145
  //#region src/components/detail-layout/LayoutTabs.tsx
146
146
  function je({ config: e, ctx: n }) {
147
- let { items: r } = e, [i, a] = K(0), o = j(), 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}`);
@@ -339,12 +339,12 @@ function Me({ config: e, ctx: n }) {
339
339
  name: s,
340
340
  size: 14
341
341
  }) : void 0, f = c ? {
342
- text: A(c.text),
342
+ text: p(c.text),
343
343
  tone: c.tone,
344
344
  dot: c.dot
345
345
  } : void 0;
346
- return /* @__PURE__ */ J(I, {
347
- title: A(r),
346
+ return /* @__PURE__ */ J(re, {
347
+ title: p(r),
348
348
  defaultOpen: !a,
349
349
  icon: d,
350
350
  badge: f,
@@ -383,7 +383,7 @@ function X(e, t, n) {
383
383
  return e ?? t ?? n;
384
384
  }
385
385
  function Pe(e) {
386
- return f(e, "update") ? "inline_edit" : "readonly";
386
+ return _(e, "update") ? "inline_edit" : "readonly";
387
387
  }
388
388
  function Fe(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 Ue(e, ...t) {
459
459
  }
460
460
  }
461
461
  function We(e) {
462
- let t = T(e);
462
+ let t = k(e);
463
463
  return t.length > 0 ? t[0] : void 0;
464
464
  }
465
465
  function Ge(e, t) {
@@ -473,7 +473,7 @@ function Ke(e, t, n, r) {
473
473
  ...e
474
474
  };
475
475
  if (Array.isArray(n)) {
476
- let e = Array.isArray(r) ? r.map(String) : _(String(r), n.length);
476
+ let e = Array.isArray(r) ? r.map(String) : o(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 qe(e, t) {
489
489
  //#endregion
490
490
  //#region src/components/detail-layout/useQuickAdd.ts
491
491
  function Je(e, t, n, r) {
492
- let [i, o] = K(() => {
492
+ let [i, a] = K(() => {
493
493
  let t = e.quick_add, n = r.entities[e.entity], i = {};
494
- if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (i[e] = a()) : i[e] = t.defaults[e];
494
+ if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (i[e] = d()) : i[e] = t.defaults[e];
495
495
  return i;
496
- }), s = xe(), { mutate: c, isPending: l, error: u, reset: d } = be({
496
+ }), o = xe(), { mutate: c, isPending: l, error: u, reset: f } = be({
497
497
  mutationFn: (t) => O(e.entity, t),
498
498
  onMutate: async (r) => {
499
499
  let i = [
500
- ee,
500
+ P,
501
501
  t,
502
- Array.isArray(n) ? h(n.map(String)) : n,
502
+ Array.isArray(n) ? s(n.map(String)) : n,
503
503
  e.entity
504
504
  ];
505
- await s.cancelQueries({ queryKey: i });
506
- let a = s.getQueriesData({ queryKey: i }), o = {
505
+ await o.cancelQueries({ queryKey: i });
506
+ let a = o.getQueriesData({ queryKey: i }), c = {
507
507
  ...r,
508
508
  id: `__optimistic_${crypto.randomUUID()}`,
509
509
  __optimistic: !0
510
510
  };
511
- return s.setQueriesData({ queryKey: i }, (e) => {
511
+ return o.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;
@@ -516,7 +516,7 @@ function Je(e, t, n, r) {
516
516
  ...t,
517
517
  pages: [{
518
518
  ...n,
519
- data: [o, ...n.data]
519
+ data: [c, ...n.data]
520
520
  }, ...r]
521
521
  };
522
522
  }
@@ -524,54 +524,54 @@ function Je(e, t, n, r) {
524
524
  }), { snapshots: a };
525
525
  },
526
526
  onError: (e, t, n) => {
527
- if (n?.snapshots) for (let [e, t] of n.snapshots) s.setQueryData(e, t);
527
+ if (n?.snapshots) for (let [e, t] of n.snapshots) o.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] = a() : i[e] = "" : i[e] = t.defaults[e];
532
- o(i);
531
+ if (t?.fields) for (let e of t.fields) t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? i[e] = d() : i[e] = "" : i[e] = t.defaults[e];
532
+ a(i);
533
533
  },
534
534
  onSettled: () => {
535
- let r = Array.isArray(n) ? h(n.map(String)) : n;
536
- s.invalidateQueries({ queryKey: [
537
- ee,
535
+ let r = Array.isArray(n) ? s(n.map(String)) : n;
536
+ o.invalidateQueries({ queryKey: [
537
+ P,
538
538
  t,
539
539
  r,
540
540
  e.entity
541
541
  ] });
542
542
  }
543
- }), f = e.quick_add, p = r.entities[e.entity], m = qe(i, f?.fields.filter((e) => p?.fields.get(e)?.required) ?? []);
543
+ }), p = e.quick_add, m = r.entities[e.entity], h = qe(i, p?.fields.filter((e) => m?.fields.get(e)?.required) ?? []);
544
544
  function g(t) {
545
- if (t.preventDefault(), !f) return;
546
- let r = Ke(i, f.defaults, e.foreign_key, n);
545
+ if (t.preventDefault(), !p) return;
546
+ let r = Ke(i, p.defaults, e.foreign_key, n);
547
547
  c(r);
548
548
  }
549
549
  function _(e, t) {
550
- u && d(), o((n) => ({
550
+ u && f(), a((n) => ({
551
551
  ...n,
552
552
  [e]: t
553
553
  }));
554
554
  }
555
555
  return {
556
556
  values: i,
557
- quickAdd: f,
558
- childEntity: p,
557
+ quickAdd: p,
558
+ childEntity: m,
559
559
  isPending: l,
560
560
  error: u,
561
- isReady: m,
561
+ isReady: h,
562
562
  handleSubmit: g,
563
563
  handleFieldChange: _
564
564
  };
565
565
  }
566
566
  //#endregion
567
567
  //#region src/components/detail-layout/QuickAddForm.tsx
568
- function Ye({ config: t, parentEntity: n, parentId: r, schema: a }) {
569
- let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Je(t, n, r, a), m = b(), h = j(), g = _e();
568
+ function Ye({ config: t, parentEntity: n, parentId: i, schema: a }) {
569
+ let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: p, handleFieldChange: m } = Je(t, n, i, a), h = r(), g = D(), _ = _e();
570
570
  return !s || s.fields.length === 0 || !c ? null : /* @__PURE__ */ Y("form", {
571
- onSubmit: f,
571
+ onSubmit: p,
572
572
  style: {
573
573
  display: "flex",
574
- flexDirection: h.isPhone ? "column" : "row",
574
+ flexDirection: g.isPhone ? "column" : "row",
575
575
  alignItems: "flex-end",
576
576
  gap: 8,
577
577
  padding: "8px 0",
@@ -581,12 +581,12 @@ function Ye({ config: t, parentEntity: n, parentId: r, schema: a }) {
581
581
  s.fields.map((e) => {
582
582
  let n = c.fields.get(e);
583
583
  if (!n) return null;
584
- let r = `${g}-quick-add-${t.entity}-${e}`, i = `${r}-label`;
584
+ let r = `${_}-quick-add-${t.entity}-${e}`, i = `${r}-label`;
585
585
  return /* @__PURE__ */ Y("div", {
586
586
  style: {
587
587
  flex: 1,
588
588
  minWidth: 0,
589
- width: h.isPhone ? "100%" : void 0
589
+ width: g.isPhone ? "100%" : void 0
590
590
  },
591
591
  children: [/* @__PURE__ */ J("label", {
592
592
  id: i,
@@ -598,27 +598,27 @@ function Ye({ config: t, parentEntity: n, parentId: r, schema: a }) {
598
598
  display: "block",
599
599
  fontWeight: 500
600
600
  },
601
- children: k(n, e, a.entities)
602
- }), v({
601
+ children: f(n, e, a.entities)
602
+ }), C({
603
603
  field: n,
604
604
  fieldName: e,
605
605
  value: o[e] ?? "",
606
606
  mode: "edit",
607
- onChange: (t) => p(e, t),
607
+ onChange: (t) => m(e, t),
608
608
  record: o,
609
609
  fieldId: r,
610
610
  labelId: i,
611
- locale: m
611
+ locale: h
612
612
  })]
613
613
  }, e);
614
614
  }),
615
- /* @__PURE__ */ J(i, {
615
+ /* @__PURE__ */ J(y, {
616
616
  type: "submit",
617
617
  kind: "primary",
618
- size: h.isPhone ? "md" : "sm",
618
+ size: g.isPhone ? "md" : "sm",
619
619
  icon: /* @__PURE__ */ J(e.plus, { size: 12 }),
620
620
  disabled: l || !d,
621
- style: h.isPhone ? { alignSelf: "flex-end" } : void 0,
621
+ style: g.isPhone ? { alignSelf: "flex-end" } : void 0,
622
622
  children: "Add"
623
623
  }),
624
624
  u != null && /* @__PURE__ */ J("span", {
@@ -639,10 +639,10 @@ function Xe(e, t, n) {
639
639
  return `${e}::child::${t}.${n}`;
640
640
  }
641
641
  function Ze(e) {
642
- return Math.min(L, Math.max(60, Math.round(e)));
642
+ return Math.min(ue, Math.max(60, Math.round(e)));
643
643
  }
644
644
  function Qe(e) {
645
- let { widths: t, setWidths: n, resetWidths: r } = ne(e), [i, a] = K({}), o = G(null);
645
+ let { widths: t, setWidths: n, resetWidths: r } = R(e), [i, a] = K({}), o = G(null);
646
646
  U(() => {
647
647
  let e = (e) => {
648
648
  let t = o.current;
@@ -726,33 +726,33 @@ function $e({ colId: e, onMouseDown: t }) {
726
726
  //#endregion
727
727
  //#region src/components/detail-layout/ChildrenTable.tsx
728
728
  function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
729
- let s = a.entities[t.entity], c = Array.isArray(t.foreign_key) ? t.foreign_key.join(",") : t.foreign_key, l = Qe(Xe(n, t.entity, c)), f = b(), p = z((e) => e.degradedEntities), { data: h, isLoading: g, isError: _, isFetching: v, refetch: x } = B(n, i, t.entity, t.foreign_key, t.sort, t.limit), S = h?.data ?? [], C = h?.$refs, w = G(C);
730
- w.current = C;
731
- let T = t.columns, E = t.interaction === "navigate", D = T[0], O = E && s ? y(void 0, s, a.screens) : null, A = s ? We(s) : void 0, j = W(() => {
729
+ let o = a.entities[t.entity], s = Array.isArray(t.foreign_key) ? t.foreign_key.join(",") : t.foreign_key, l = Qe(Xe(n, t.entity, s)), d = r(), p = te((e) => e.degradedEntities), { data: m, isLoading: h, isError: _, isFetching: v, refetch: y } = I(n, i, t.entity, t.foreign_key, t.sort, t.limit), b = m?.data ?? [], x = m?.$refs, S = G(x);
730
+ S.current = x;
731
+ let C = t.columns, D = t.interaction === "navigate", O = C[0], k = D && o ? w(void 0, o, a.screens) : null, A = o ? We(o) : void 0, j = W(() => {
732
732
  let e = /* @__PURE__ */ new Map();
733
- if (!s) return e;
734
- for (let t of T) {
735
- let n = s.fields.get(t);
736
- n && e.set(t, d({
733
+ if (!o) return e;
734
+ for (let t of C) {
735
+ let n = o.fields.get(t);
736
+ n && e.set(t, u({
737
737
  field: n,
738
738
  fieldName: t,
739
739
  surface: "list",
740
- entity: s,
740
+ entity: o,
741
741
  entities: a.entities,
742
742
  screens: a.screens,
743
- refs: () => w.current,
744
- locale: f
743
+ refs: () => S.current,
744
+ locale: d
745
745
  }));
746
746
  }
747
747
  return e;
748
748
  }, [
749
- s,
750
- T,
749
+ o,
750
+ C,
751
751
  a.entities,
752
752
  a.screens,
753
- f
753
+ d
754
754
  ]);
755
- if (!s) return /* @__PURE__ */ J("div", {
755
+ if (!o) return /* @__PURE__ */ J("div", {
756
756
  style: {
757
757
  fontSize: 12.5,
758
758
  color: "var(--text-3)",
@@ -765,7 +765,7 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
765
765
  parentEntity: n,
766
766
  parentId: i,
767
767
  schema: a
768
- }), N = F(s.realtime, p, t.entity), P = /* @__PURE__ */ Y("div", {
768
+ }), N = ee(o.realtime, p, t.entity), P = /* @__PURE__ */ Y("div", {
769
769
  style: {
770
770
  display: "flex",
771
771
  alignItems: "center",
@@ -774,7 +774,7 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
774
774
  justifyContent: "flex-end"
775
775
  },
776
776
  children: [
777
- l.hasWidths && /* @__PURE__ */ J(r, {
777
+ l.hasWidths && /* @__PURE__ */ J(E, {
778
778
  icon: /* @__PURE__ */ J(e.columns, { size: 13 }),
779
779
  title: "Reset column widths (this device)",
780
780
  size: 24,
@@ -783,24 +783,24 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
783
783
  N && /* @__PURE__ */ J("span", {
784
784
  "data-testid": "children-live-indicator",
785
785
  title: "This table updates automatically in realtime.",
786
- children: /* @__PURE__ */ J(u, {
786
+ children: /* @__PURE__ */ J(T, {
787
787
  tone: "emerald",
788
788
  size: "xs",
789
789
  dot: !0,
790
790
  children: "Live"
791
791
  })
792
792
  }),
793
- /* @__PURE__ */ J(r, {
793
+ /* @__PURE__ */ J(E, {
794
794
  icon: v ? /* @__PURE__ */ J("span", {
795
795
  "data-testid": "children-refresh-spinner",
796
796
  style: { display: "inline-flex" },
797
- children: /* @__PURE__ */ J(o, { size: 13 })
797
+ children: /* @__PURE__ */ J(g, { size: 13 })
798
798
  }) : /* @__PURE__ */ J(e.refresh, { size: 13 }),
799
799
  title: "Refresh",
800
800
  size: 24,
801
801
  disabled: v,
802
802
  onClick: () => {
803
- x();
803
+ y();
804
804
  }
805
805
  })
806
806
  ]
@@ -816,7 +816,7 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
816
816
  },
817
817
  children: "Failed to load. Try again."
818
818
  })
819
- ] }) : g ? /* @__PURE__ */ Y("div", { children: [
819
+ ] }) : h ? /* @__PURE__ */ Y("div", { children: [
820
820
  M,
821
821
  P,
822
822
  /* @__PURE__ */ J("div", {
@@ -836,7 +836,7 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
836
836
  borderRadius: 4
837
837
  } }, e))
838
838
  })
839
- ] }) : S.length === 0 ? /* @__PURE__ */ Y("div", { children: [
839
+ ] }) : b.length === 0 ? /* @__PURE__ */ Y("div", { children: [
840
840
  M,
841
841
  P,
842
842
  /* @__PURE__ */ J("div", {
@@ -853,23 +853,23 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
853
853
  /* @__PURE__ */ J("div", {
854
854
  style: { overflowX: "auto" },
855
855
  children: /* @__PURE__ */ Y("table", {
856
- style: de,
857
- children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ J("tr", { children: T.map((e) => {
858
- let t = s.fields.get(e);
856
+ style: fe,
857
+ children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ J("tr", { children: C.map((e) => {
858
+ let t = o.fields.get(e);
859
859
  return /* @__PURE__ */ Y("th", {
860
- style: l.headerStyle(e, ue),
861
- children: [t ? k(t, e, a.entities) : e, /* @__PURE__ */ J($e, {
860
+ style: l.headerStyle(e, de),
861
+ children: [t ? f(t, e, a.entities) : e, /* @__PURE__ */ J($e, {
862
862
  colId: e,
863
863
  onMouseDown: l.onHandleMouseDown
864
864
  })]
865
865
  }, e);
866
- }) }) }), /* @__PURE__ */ J("tbody", { children: S.map((e, t) => {
867
- let n = A ? m(e[A]) : "", r = E && O && n ? O.replace(/:\w+/, n) : void 0;
868
- return /* @__PURE__ */ J("tr", { children: T.map((t) => {
869
- let n = t === D, i = j.get(t), a = i ? i(e[t], e) : m(e[t]);
866
+ }) }) }), /* @__PURE__ */ J("tbody", { children: b.map((e, t) => {
867
+ let n = A ? c(e[A]) : "", r = D && k && n ? k.replace(/:\w+/, n) : void 0;
868
+ return /* @__PURE__ */ J("tr", { children: C.map((t) => {
869
+ let n = t === O, i = j.get(t), a = i ? i(e[t], e) : c(e[t]);
870
870
  return /* @__PURE__ */ J("td", {
871
871
  title: typeof a == "string" ? a : void 0,
872
- style: l.cellStyle(t, fe),
872
+ style: l.cellStyle(t, pe),
873
873
  children: n && r ? /* @__PURE__ */ J("a", {
874
874
  href: r,
875
875
  style: {
@@ -882,7 +882,7 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
882
882
  children: a
883
883
  }) : a
884
884
  }, t);
885
- }) }, m(e.id ?? t));
885
+ }) }, c(e.id ?? t));
886
886
  }) })]
887
887
  })
888
888
  })
@@ -890,9 +890,9 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
890
890
  }
891
891
  //#endregion
892
892
  //#region src/components/detail-layout/ChildrenList.tsx
893
- function tt({ config: e, parentEntity: t, parentId: n, schema: r }) {
894
- let i = r.entities[e.entity], a = b(), { data: o, isLoading: s, isError: c } = B(t, n, e.entity, e.foreign_key, e.sort, e.limit), l = o?.data ?? [], u = o?.$refs, d = e.columns;
895
- if (!i) return /* @__PURE__ */ J("div", {
893
+ function tt({ config: e, parentEntity: t, parentId: n, schema: i }) {
894
+ let a = i.entities[e.entity], o = r(), { data: s, isLoading: l, isError: u } = I(t, n, 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 tt({ config: e, parentEntity: t, parentId: n, schema: r }) {
900
900
  },
901
901
  children: "Entity not found."
902
902
  });
903
- let f = /* @__PURE__ */ J(Ye, {
903
+ let m = /* @__PURE__ */ J(Ye, {
904
904
  config: e,
905
905
  parentEntity: t,
906
906
  parentId: n,
907
- schema: r
907
+ schema: i
908
908
  });
909
- if (c) return /* @__PURE__ */ Y("div", { children: [f, /* @__PURE__ */ J("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 tt({ config: e, parentEntity: t, parentId: n, schema: r }) {
914
914
  },
915
915
  children: "Failed to load. Try again."
916
916
  })] });
917
- if (s) return /* @__PURE__ */ Y("div", { children: [f, /* @__PURE__ */ Y("div", {
917
+ if (l) return /* @__PURE__ */ Y("div", { children: [m, /* @__PURE__ */ Y("div", {
918
918
  style: {
919
919
  display: "flex",
920
920
  flexDirection: "column",
@@ -940,7 +940,7 @@ function tt({ config: e, parentEntity: t, parentId: n, schema: r }) {
940
940
  } })
941
941
  ]
942
942
  })] });
943
- if (l.length === 0) return /* @__PURE__ */ Y("div", { children: [f, /* @__PURE__ */ J("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)",
@@ -948,13 +948,13 @@ function tt({ config: e, parentEntity: t, parentId: n, schema: r }) {
948
948
  },
949
949
  children: "No records yet."
950
950
  })] });
951
- let p = d.length > 0 ? i.display.display_field ?? d[0] : i.display.display_field;
952
- return /* @__PURE__ */ Y("div", { children: [f, /* @__PURE__ */ J("div", {
951
+ let h = p.length > 0 ? a.display.display_field ?? p[0] : a.display.display_field;
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: l.map((e, t) => /* @__PURE__ */ J("div", {
957
+ children: d.map((e, t) => /* @__PURE__ */ J("div", {
958
958
  style: {
959
959
  display: "flex",
960
960
  alignItems: "center",
@@ -974,17 +974,17 @@ function tt({ config: e, parentEntity: t, parentId: n, schema: r }) {
974
974
  textOverflow: "ellipsis",
975
975
  whiteSpace: "nowrap"
976
976
  },
977
- children: (typeof e.$display == "string" ? e[g] : "") || (p && i.fields.get(p) ? v({
978
- field: i.fields.get(p),
979
- fieldName: p,
980
- value: e[p],
977
+ children: (typeof e.$display == "string" ? e[x] : "") || (h && a.fields.get(h) ? C({
978
+ field: a.fields.get(h),
979
+ fieldName: h,
980
+ value: e[h],
981
981
  mode: "display",
982
982
  record: e,
983
- refs: u,
984
- locale: a
985
- }) : p && e[p] != null ? m(e[p]) : null)
986
- }), d.length > 1 && (() => {
987
- let t = d.slice(1, 3).filter((t) => e[t] != null);
983
+ refs: f,
984
+ locale: o
985
+ }) : h && e[h] != null ? c(e[h]) : null)
986
+ }), p.length > 1 && (() => {
987
+ let t = p.slice(1, 3).filter((t) => e[t] != null);
988
988
  return t.length === 0 ? null : /* @__PURE__ */ J("div", {
989
989
  style: {
990
990
  fontSize: 11.5,
@@ -993,26 +993,26 @@ function tt({ config: e, parentEntity: t, parentId: n, schema: r }) {
993
993
  textOverflow: "ellipsis",
994
994
  whiteSpace: "nowrap"
995
995
  },
996
- children: t.map((t, n) => /* @__PURE__ */ Y("span", { children: [n > 0 && " · ", i.fields.get(t) ? v({
997
- field: i.fields.get(t),
996
+ children: t.map((t, n) => /* @__PURE__ */ Y("span", { children: [n > 0 && " · ", a.fields.get(t) ? C({
997
+ field: a.fields.get(t),
998
998
  fieldName: t,
999
999
  value: e[t],
1000
1000
  mode: "display",
1001
1001
  record: e,
1002
- refs: u,
1003
- locale: a
1002
+ refs: f,
1003
+ locale: o
1004
1004
  }) : String(e[t])] }, t))
1005
1005
  });
1006
1006
  })()]
1007
1007
  })
1008
- }, m(e.id ?? t)))
1008
+ }, c(e.id ?? t)))
1009
1009
  })] });
1010
1010
  }
1011
1011
  //#endregion
1012
1012
  //#region src/components/detail-layout/ChildrenCards.tsx
1013
- function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1014
- let i = r.entities[e.entity], a = b(), { data: o, isLoading: s, isError: c } = B(t, n, e.entity, e.foreign_key, e.sort, e.limit), l = o?.data ?? [], d = o?.$refs, f = e.columns, p = e.cards, h = p?.header_field ?? f[0], g = p?.badge_field, _ = p?.columns_count ?? 3;
1015
- if (!i) return /* @__PURE__ */ J("div", {
1013
+ function nt({ config: e, parentEntity: t, parentId: n, schema: i }) {
1014
+ let a = i.entities[e.entity], o = r(), { data: s, isLoading: l, isError: u } = I(t, n, 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__ */ J("div", {
1016
1016
  style: {
1017
1017
  fontSize: 12.5,
1018
1018
  color: "var(--text-3)",
@@ -1020,17 +1020,17 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1020
1020
  },
1021
1021
  children: "Entity not found."
1022
1022
  });
1023
- let y = {
1023
+ let v = {
1024
1024
  display: "grid",
1025
1025
  gridTemplateColumns: `repeat(auto-fill, minmax(${_ >= 4 ? 180 : 240}px, 1fr))`,
1026
1026
  gap: 12
1027
- }, x = /* @__PURE__ */ J(Ye, {
1027
+ }, y = /* @__PURE__ */ J(Ye, {
1028
1028
  config: e,
1029
1029
  parentEntity: t,
1030
1030
  parentId: n,
1031
- schema: r
1031
+ schema: i
1032
1032
  });
1033
- if (c) return /* @__PURE__ */ Y("div", { children: [x, /* @__PURE__ */ J("div", {
1033
+ if (u) return /* @__PURE__ */ Y("div", { children: [y, /* @__PURE__ */ J("div", {
1034
1034
  style: {
1035
1035
  fontSize: 12.5,
1036
1036
  color: "var(--danger)",
@@ -1038,8 +1038,8 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1038
1038
  },
1039
1039
  children: "Failed to load. Try again."
1040
1040
  })] });
1041
- if (s) return /* @__PURE__ */ Y("div", { children: [x, /* @__PURE__ */ J("div", {
1042
- style: y,
1041
+ if (l) return /* @__PURE__ */ Y("div", { children: [y, /* @__PURE__ */ J("div", {
1042
+ style: v,
1043
1043
  children: [
1044
1044
  0,
1045
1045
  1,
@@ -1050,7 +1050,7 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1050
1050
  borderRadius: 10
1051
1051
  } }, e))
1052
1052
  })] });
1053
- if (l.length === 0) return /* @__PURE__ */ Y("div", { children: [x, /* @__PURE__ */ J("div", {
1053
+ if (d.length === 0) return /* @__PURE__ */ Y("div", { children: [y, /* @__PURE__ */ J("div", {
1054
1054
  style: {
1055
1055
  fontSize: 12.5,
1056
1056
  color: "var(--text-3)",
@@ -1058,10 +1058,10 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1058
1058
  },
1059
1059
  children: "No records yet."
1060
1060
  })] });
1061
- let S = f.filter((e) => e !== h && e !== g);
1062
- return /* @__PURE__ */ Y("div", { children: [x, /* @__PURE__ */ J("div", {
1063
- style: y,
1064
- children: l.map((t, n) => /* @__PURE__ */ Y("div", {
1061
+ let b = p.filter((e) => e !== h && e !== g);
1062
+ return /* @__PURE__ */ Y("div", { children: [y, /* @__PURE__ */ J("div", {
1063
+ style: v,
1064
+ children: d.map((t, n) => /* @__PURE__ */ Y("div", {
1065
1065
  style: {
1066
1066
  background: "var(--surface)",
1067
1067
  border: "1px solid var(--border)",
@@ -1075,7 +1075,7 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1075
1075
  alignItems: "center",
1076
1076
  justifyContent: "space-between",
1077
1077
  gap: 8,
1078
- borderBottom: S.length > 0 ? "1px solid var(--divider)" : "none"
1078
+ borderBottom: b.length > 0 ? "1px solid var(--divider)" : "none"
1079
1079
  },
1080
1080
  children: [/* @__PURE__ */ J("div", {
1081
1081
  style: {
@@ -1085,38 +1085,38 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1085
1085
  textOverflow: "ellipsis",
1086
1086
  whiteSpace: "nowrap"
1087
1087
  },
1088
- children: h && i.fields.get(h) ? v({
1089
- field: i.fields.get(h),
1088
+ children: h && a.fields.get(h) ? C({
1089
+ field: a.fields.get(h),
1090
1090
  fieldName: h,
1091
1091
  value: t[h],
1092
1092
  mode: "display",
1093
1093
  record: t,
1094
- refs: d,
1095
- locale: a
1094
+ refs: f,
1095
+ locale: o
1096
1096
  }) : `Record ${n + 1}`
1097
- }), g && t[g] != null && /* @__PURE__ */ J(u, {
1097
+ }), g && t[g] != null && /* @__PURE__ */ J(T, {
1098
1098
  tone: "slate",
1099
1099
  size: "xs",
1100
- children: i.fields.get(g) ? v({
1101
- field: i.fields.get(g),
1100
+ children: a.fields.get(g) ? C({
1101
+ field: a.fields.get(g),
1102
1102
  fieldName: g,
1103
1103
  value: t[g],
1104
1104
  mode: "display",
1105
1105
  record: t,
1106
- refs: d,
1107
- locale: a
1108
- }) : m(t[g])
1106
+ refs: f,
1107
+ locale: o
1108
+ }) : c(t[g])
1109
1109
  })]
1110
- }), S.length > 0 && /* @__PURE__ */ J("div", {
1110
+ }), b.length > 0 && /* @__PURE__ */ J("div", {
1111
1111
  style: {
1112
1112
  padding: "10px 14px",
1113
1113
  display: "flex",
1114
1114
  flexDirection: "column",
1115
1115
  gap: 4
1116
1116
  },
1117
- children: S.slice(0, 4).map((n) => {
1118
- let o = i.fields.get(n);
1119
- return o ? /* @__PURE__ */ Y("div", {
1117
+ children: b.slice(0, 4).map((n) => {
1118
+ let r = a.fields.get(n);
1119
+ return r ? /* @__PURE__ */ Y("div", {
1120
1120
  style: {
1121
1121
  display: "flex",
1122
1122
  alignItems: "baseline",
@@ -1128,74 +1128,74 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1128
1128
  color: "var(--text-3)",
1129
1129
  flexShrink: 0
1130
1130
  },
1131
- children: [r.entities[e.entity]?.fields.get(n)?.display?.name ? Object.values(r.entities[e.entity].fields.get(n).display.name)[0] : n, ":"]
1131
+ children: [i.entities[e.entity]?.fields.get(n)?.display?.name ? Object.values(i.entities[e.entity].fields.get(n).display.name)[0] : n, ":"]
1132
1132
  }), /* @__PURE__ */ J("span", {
1133
1133
  style: {
1134
1134
  overflow: "hidden",
1135
1135
  textOverflow: "ellipsis",
1136
1136
  whiteSpace: "nowrap"
1137
1137
  },
1138
- children: v({
1139
- field: o,
1138
+ children: C({
1139
+ field: r,
1140
1140
  fieldName: n,
1141
1141
  value: t[n],
1142
1142
  mode: "display",
1143
1143
  record: t,
1144
- refs: d,
1145
- locale: a
1144
+ refs: f,
1145
+ locale: o
1146
1146
  })
1147
1147
  })]
1148
1148
  }, n) : null;
1149
1149
  })
1150
1150
  })]
1151
- }, m(t.id ?? n)))
1151
+ }, c(t.id ?? n)))
1152
1152
  })] });
1153
1153
  }
1154
1154
  //#endregion
1155
1155
  //#region src/hooks/useTimelineData.ts
1156
1156
  var rt = 50;
1157
1157
  function it(e, t, n, r, i, a) {
1158
- let o = Array.isArray(r) ? r : [r], s = Array.isArray(r) ? _(t, o.length) : [t], c = a ?? rt, l = ye({
1158
+ let s = Array.isArray(r) ? r : [r], c = Array.isArray(r) ? o(t, s.length) : [t], u = a ?? rt, d = ye({
1159
1159
  queryKey: [
1160
- ee,
1160
+ P,
1161
1161
  e,
1162
1162
  t,
1163
1163
  n,
1164
1164
  "timeline",
1165
1165
  i,
1166
- c
1166
+ u
1167
1167
  ],
1168
1168
  queryFn: ({ pageParam: e }) => {
1169
1169
  let t = new URLSearchParams();
1170
- if (!s) throw Error("invalid composite parent id");
1171
- let r = o.map((e, t) => ({
1170
+ if (!c) throw Error("invalid composite parent id");
1171
+ let r = s.map((e, t) => ({
1172
1172
  field: e,
1173
1173
  op: "eq",
1174
- value: s[t]
1174
+ value: c[t]
1175
1175
  }));
1176
- 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), w(`/api/data/${n}?${t.toString()}`);
1176
+ 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(u)), e && t.set("after", e), l(`/api/data/${n}?${t.toString()}`);
1177
1177
  },
1178
1178
  getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
1179
1179
  initialPageParam: void 0,
1180
- enabled: !!e && !!t && !!n && !!r && s !== null
1180
+ enabled: !!e && !!t && !!n && !!r && c !== null
1181
1181
  });
1182
1182
  return {
1183
- rows: W(() => l.data?.pages.flatMap((e) => e.data) ?? [], [l.data?.pages]),
1184
- refs: l.data?.pages[0]?.$refs,
1185
- fetchNextPage: l.fetchNextPage,
1186
- hasOlder: !!l.hasNextPage,
1187
- isFetchingOlder: l.isFetchingNextPage,
1188
- isLoading: l.isLoading,
1189
- isError: l.isError
1183
+ rows: W(() => d.data?.pages.flatMap((e) => e.data) ?? [], [d.data?.pages]),
1184
+ refs: d.data?.pages[0]?.$refs,
1185
+ fetchNextPage: d.fetchNextPage,
1186
+ hasOlder: !!d.hasNextPage,
1187
+ isFetchingOlder: d.isFetchingNextPage,
1188
+ isLoading: d.isLoading,
1189
+ isError: d.isError
1190
1190
  };
1191
1191
  }
1192
1192
  //#endregion
1193
1193
  //#region src/components/detail-layout/TimelineComposer.tsx
1194
1194
  var at = "quick_entry", ot = 100, st = 240, ct = 800, lt = 80;
1195
- function ut({ config: t, parentEntity: n, parentId: r, schema: a }) {
1196
- let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Je(t, n, r, a), m = b(), [h, g] = K(st), _ = G(null), y = G(null), [x, S] = K(ct);
1195
+ function ut({ config: t, parentEntity: n, parentId: i, schema: a }) {
1196
+ let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Je(t, n, i, a), m = r(), [h, g] = K(st), _ = G(null), v = G(null), [x, S] = K(ct);
1197
1197
  U(() => {
1198
- let e = y.current?.parentElement;
1198
+ let e = v.current?.parentElement;
1199
1199
  if (!e) return;
1200
1200
  let t = () => {
1201
1201
  let t = Math.max(ot, e.clientHeight - lt);
@@ -1207,21 +1207,21 @@ function ut({ config: t, parentEntity: n, parentId: r, schema: a }) {
1207
1207
  }, []), U(() => {
1208
1208
  g((e) => Math.min(e, x));
1209
1209
  }, [x]);
1210
- let C = G(o);
1211
- C.current = o;
1212
- let w = G(p);
1213
- w.current = p;
1214
- let T = G({}), D = W(() => ({
1215
- getField: (e) => C.current[e],
1210
+ let w = G(o);
1211
+ w.current = o;
1212
+ let T = G(p);
1213
+ T.current = p;
1214
+ let E = G({}), D = W(() => ({
1215
+ getField: (e) => w.current[e],
1216
1216
  setField: (e, t) => {
1217
- w.current(e, t);
1217
+ T.current(e, t);
1218
1218
  },
1219
1219
  focusField: (e) => {
1220
- let t = T.current[e];
1220
+ let t = E.current[e];
1221
1221
  t && (t.querySelector("textarea, input, select, [contenteditable]") ?? t).focus();
1222
1222
  }
1223
1223
  }), []);
1224
- U(() => E(at, D), [D]);
1224
+ U(() => b(at, D), [D]);
1225
1225
  let O = H((e) => {
1226
1226
  e.preventDefault(), _.current = {
1227
1227
  startY: e.clientY,
@@ -1250,9 +1250,9 @@ function ut({ config: t, parentEntity: n, parentId: r, schema: a }) {
1250
1250
  let t = c.fields.get(e);
1251
1251
  return t ? /* @__PURE__ */ J("div", {
1252
1252
  ref: (t) => {
1253
- T.current[e] = t;
1253
+ E.current[e] = t;
1254
1254
  },
1255
- children: v({
1255
+ children: C({
1256
1256
  field: t,
1257
1257
  fieldName: e,
1258
1258
  value: o[e] ?? "",
@@ -1264,7 +1264,7 @@ function ut({ config: t, parentEntity: n, parentId: r, schema: a }) {
1264
1264
  }, e) : null;
1265
1265
  };
1266
1266
  return /* @__PURE__ */ Y("div", {
1267
- ref: y,
1267
+ ref: v,
1268
1268
  style: {
1269
1269
  flexShrink: 0,
1270
1270
  borderTop: "1px solid var(--divider)",
@@ -1321,9 +1321,9 @@ function ut({ config: t, parentEntity: n, parentId: r, schema: a }) {
1321
1321
  display: "flex"
1322
1322
  },
1323
1323
  ref: (e) => {
1324
- T.current[k] = e;
1324
+ E.current[k] = e;
1325
1325
  },
1326
- children: v({
1326
+ children: C({
1327
1327
  field: c.fields.get(k),
1328
1328
  fieldName: k,
1329
1329
  value: o[k] ?? "",
@@ -1365,7 +1365,7 @@ function ut({ config: t, parentEntity: n, parentId: r, schema: a }) {
1365
1365
  }),
1366
1366
  " to add"
1367
1367
  ]
1368
- }), /* @__PURE__ */ J(i, {
1368
+ }), /* @__PURE__ */ J(y, {
1369
1369
  type: "submit",
1370
1370
  kind: "primary",
1371
1371
  icon: /* @__PURE__ */ J(e.plus, { size: 13 }),
@@ -1393,63 +1393,63 @@ var dt = 80, ft = 200;
1393
1393
  function pt(e, t) {
1394
1394
  if (mt(t)) {
1395
1395
  let e = t.id;
1396
- return e == null ? "" : m(e);
1396
+ return e == null ? "" : c(e);
1397
1397
  }
1398
- return p(D(e, t));
1398
+ return v(A(e, t));
1399
1399
  }
1400
1400
  function mt(e) {
1401
1401
  return e.__optimistic === !0;
1402
1402
  }
1403
1403
  function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
1404
- let a = r.entities[e.entity], { rows: s, refs: c, fetchNextPage: l, hasOlder: u, isFetchingOlder: d, isLoading: f, isError: p } = it(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), m = e.timeline, h = m?.scroll ?? !1, g = (e.sort ?? "").endsWith(":asc"), _ = W(() => g ? [...s].reverse() : s, [s, g]), v = m?.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);
1404
+ let i = r.entities[e.entity], { rows: a, refs: o, fetchNextPage: s, hasOlder: c, isFetchingOlder: l, isLoading: u, isError: d } = it(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), f = e.timeline, m = f?.scroll ?? !1, h = (e.sort ?? "").endsWith(":asc"), _ = W(() => h ? [...a].reverse() : a, [a, h]), v = f?.auto_scroll ?? "none", b = G(null), x = G(null), S = G(!1), C = G(0), w = G(null), T = G(null), E = G(!0), D = G(null);
1405
1405
  U(() => {
1406
- x.current = !1, S.current = 0, C.current = null, w.current = null, T.current = !0, E.current = null;
1406
+ S.current = !1, C.current = 0, w.current = null, T.current = null, E.current = !0, D.current = null;
1407
1407
  }, [n]), ve(() => {
1408
- !d || !y.current || (E.current = {
1409
- scrollHeight: y.current.scrollHeight,
1410
- scrollTop: y.current.scrollTop
1408
+ !l || !b.current || (D.current = {
1409
+ scrollHeight: b.current.scrollHeight,
1410
+ scrollTop: b.current.scrollTop
1411
1411
  });
1412
- }, [d]), ve(() => {
1413
- let e = y.current;
1414
- if (!e || _.length === 0 || !a) {
1415
- S.current = _.length;
1412
+ }, [l]), ve(() => {
1413
+ let e = b.current;
1414
+ if (!e || _.length === 0 || !i) {
1415
+ C.current = _.length;
1416
1416
  return;
1417
1417
  }
1418
- let t = pt(a, _[0]), n = pt(a, _[_.length - 1]), r = !x.current, i = _.length > S.current && S.current > 0, o = i && (g && t !== C.current && n === w.current || !g && n !== w.current && t === C.current), s = i && !o;
1419
- if (r) g && v === "bottom" && (e.scrollTop = e.scrollHeight), x.current = !0;
1420
- else if (o && E.current) {
1421
- let t = E.current;
1422
- g && (e.scrollTop = t.scrollTop + (e.scrollHeight - t.scrollHeight)), E.current = null;
1423
- } else s && g && T.current && (e.scrollTop = e.scrollHeight);
1424
- S.current = _.length, C.current = t, w.current = n;
1418
+ let t = pt(i, _[0]), n = pt(i, _[_.length - 1]), r = !S.current, a = _.length > C.current && C.current > 0, o = a && (h && t !== w.current && n === T.current || !h && n !== T.current && t === w.current), s = a && !o;
1419
+ if (r) h && v === "bottom" && (e.scrollTop = e.scrollHeight), S.current = !0;
1420
+ else if (o && D.current) {
1421
+ let t = D.current;
1422
+ h && (e.scrollTop = t.scrollTop + (e.scrollHeight - t.scrollHeight)), D.current = null;
1423
+ } else s && h && E.current && (e.scrollTop = e.scrollHeight);
1424
+ C.current = _.length, w.current = t, T.current = n;
1425
1425
  }, [
1426
1426
  _,
1427
1427
  v,
1428
- g,
1429
- a
1428
+ h,
1429
+ i
1430
1430
  ]);
1431
- let D = H(() => {
1432
- let e = y.current;
1433
- e && (T.current = e.scrollHeight - e.scrollTop - e.clientHeight < dt);
1431
+ let O = H(() => {
1432
+ let e = b.current;
1433
+ e && (E.current = e.scrollHeight - e.scrollTop - e.clientHeight < dt);
1434
1434
  }, []);
1435
1435
  U(() => {
1436
- let e = b.current;
1436
+ let e = x.current;
1437
1437
  if (!e || typeof IntersectionObserver > "u") return;
1438
1438
  let t = new IntersectionObserver((e) => {
1439
- for (let t of e) t.isIntersecting && u && !d && l();
1439
+ for (let t of e) t.isIntersecting && c && !l && s();
1440
1440
  }, {
1441
- root: y.current ?? null,
1441
+ root: b.current ?? null,
1442
1442
  rootMargin: `${ft}px 0px 0px 0px`,
1443
1443
  threshold: 0
1444
1444
  });
1445
1445
  return t.observe(e), () => t.disconnect();
1446
1446
  }, [
1447
- u,
1448
- d,
1449
- l
1447
+ c,
1448
+ l,
1449
+ s
1450
1450
  ]);
1451
- let [O, k] = K(null);
1452
- if (!a) return /* @__PURE__ */ J("div", {
1451
+ let [k, A] = K(null);
1452
+ if (!i) return /* @__PURE__ */ J("div", {
1453
1453
  style: {
1454
1454
  fontSize: 12.5,
1455
1455
  color: "var(--text-3)",
@@ -1457,25 +1457,25 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
1457
1457
  },
1458
1458
  children: "Entity not found."
1459
1459
  });
1460
- let j = e.quick_add?.fields ?? [m?.content_field].filter(Boolean), M = A(a.display?.name_plural) || A(a.display?.name) || e.entity, N = u ? /* @__PURE__ */ J("div", {
1460
+ let j = e.quick_add?.fields ?? [f?.content_field].filter(Boolean), M = p(i.display?.name_plural) || p(i.display?.name) || e.entity, ee = c ? /* @__PURE__ */ J("div", {
1461
1461
  style: {
1462
1462
  display: "flex",
1463
1463
  justifyContent: "center",
1464
1464
  padding: "6px 0"
1465
1465
  },
1466
- children: /* @__PURE__ */ J(i, {
1466
+ children: /* @__PURE__ */ J(y, {
1467
1467
  size: "xs",
1468
- onClick: () => l(),
1469
- disabled: d,
1470
- icon: d ? /* @__PURE__ */ J(o, { size: 11 }) : void 0,
1471
- children: d ? "Loading…" : "Load older"
1468
+ onClick: () => s(),
1469
+ disabled: l,
1470
+ icon: l ? /* @__PURE__ */ J(g, { size: 11 }) : void 0,
1471
+ children: l ? "Loading…" : "Load older"
1472
1472
  })
1473
- }) : null, P = /* @__PURE__ */ J("div", {
1474
- ref: b,
1473
+ }) : null, te = /* @__PURE__ */ J("div", {
1474
+ ref: x,
1475
1475
  "aria-hidden": "true",
1476
1476
  style: { height: 1 }
1477
- }), F;
1478
- if (p) F = /* @__PURE__ */ J("div", {
1477
+ }), N;
1478
+ if (d) N = /* @__PURE__ */ J("div", {
1479
1479
  style: {
1480
1480
  fontSize: 12.5,
1481
1481
  color: "var(--danger)",
@@ -1483,7 +1483,7 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
1483
1483
  },
1484
1484
  children: "Failed to load."
1485
1485
  });
1486
- else if (f) F = /* @__PURE__ */ Y("div", {
1486
+ else if (u) N = /* @__PURE__ */ Y("div", {
1487
1487
  style: {
1488
1488
  display: "flex",
1489
1489
  flexDirection: "column",
@@ -1500,7 +1500,7 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
1500
1500
  borderRadius: 8
1501
1501
  } })]
1502
1502
  });
1503
- else if (_.length === 0) F = /* @__PURE__ */ Y(q, { children: [P, /* @__PURE__ */ J("div", {
1503
+ else if (_.length === 0) N = /* @__PURE__ */ Y(q, { children: [te, /* @__PURE__ */ J("div", {
1504
1504
  style: {
1505
1505
  fontSize: 12.5,
1506
1506
  color: "var(--text-3)",
@@ -1509,30 +1509,30 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
1509
1509
  children: "No activity yet."
1510
1510
  })] });
1511
1511
  else {
1512
- let i = (i, o) => {
1513
- let s = pt(a, i) || String(o);
1512
+ let a = (a, s) => {
1513
+ let c = pt(i, a) || String(s);
1514
1514
  return /* @__PURE__ */ J(gt, {
1515
- row: i,
1516
- rowId: s,
1517
- childEntity: a,
1515
+ row: a,
1516
+ rowId: c,
1517
+ childEntity: i,
1518
1518
  entityCode: e.entity,
1519
1519
  parentEntity: t,
1520
1520
  parentId: n,
1521
- timeline: m,
1521
+ timeline: f,
1522
1522
  editableFields: j,
1523
- refs: c,
1524
- isEditing: O === s,
1525
- onStartEdit: () => k(s),
1526
- onCancelEdit: () => k(null),
1527
- onSaved: () => k(null),
1523
+ refs: o,
1524
+ isEditing: k === c,
1525
+ onStartEdit: () => A(c),
1526
+ onCancelEdit: () => A(null),
1527
+ onSaved: () => A(null),
1528
1528
  schema: r,
1529
- optimistic: mt(i)
1530
- }, s);
1531
- }, o = m?.time_field, s;
1532
- if (o) {
1529
+ optimistic: mt(a)
1530
+ }, c);
1531
+ }, s = f?.time_field, c;
1532
+ if (s) {
1533
1533
  let e = [];
1534
1534
  _.forEach((t, n) => {
1535
- let r = t[o], i = _t(r), a = e[e.length - 1];
1535
+ let r = t[s], i = _t(r), a = e[e.length - 1];
1536
1536
  !a || a.key !== i ? e.push({
1537
1537
  key: i,
1538
1538
  label: vt(r),
@@ -1544,7 +1544,7 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
1544
1544
  row: t,
1545
1545
  idx: n
1546
1546
  });
1547
- }), s = e.map((e) => /* @__PURE__ */ Y("div", {
1547
+ }), c = e.map((e) => /* @__PURE__ */ Y("div", {
1548
1548
  style: {
1549
1549
  display: "flex",
1550
1550
  flexDirection: "column",
@@ -1553,16 +1553,16 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
1553
1553
  children: [/* @__PURE__ */ J(yt, {
1554
1554
  label: e.label,
1555
1555
  count: e.rows.length
1556
- }), e.rows.map(({ row: e, idx: t }) => i(e, t))]
1556
+ }), e.rows.map(({ row: e, idx: t }) => a(e, t))]
1557
1557
  }, `day-${e.key}`));
1558
- } else s = _.map((e, t) => i(e, t));
1559
- F = /* @__PURE__ */ Y(q, { children: [
1560
- P,
1561
- N,
1562
- s
1558
+ } else c = _.map((e, t) => a(e, t));
1559
+ N = /* @__PURE__ */ Y(q, { children: [
1560
+ te,
1561
+ ee,
1562
+ c
1563
1563
  ] });
1564
1564
  }
1565
- return h ? /* @__PURE__ */ Y("div", {
1565
+ return m ? /* @__PURE__ */ Y("div", {
1566
1566
  style: {
1567
1567
  display: "flex",
1568
1568
  flexDirection: "column",
@@ -1588,8 +1588,8 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
1588
1588
  })
1589
1589
  }),
1590
1590
  /* @__PURE__ */ J("div", {
1591
- ref: y,
1592
- onScroll: D,
1591
+ ref: b,
1592
+ onScroll: O,
1593
1593
  style: {
1594
1594
  flex: 1,
1595
1595
  overflowY: "auto",
@@ -1598,7 +1598,7 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
1598
1598
  flexDirection: "column",
1599
1599
  gap: 8
1600
1600
  },
1601
- children: F
1601
+ children: N
1602
1602
  }),
1603
1603
  /* @__PURE__ */ J(ut, {
1604
1604
  config: e,
@@ -1613,7 +1613,7 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
1613
1613
  flexDirection: "column",
1614
1614
  gap: 8
1615
1615
  },
1616
- children: F
1616
+ children: N
1617
1617
  }), /* @__PURE__ */ J(ut, {
1618
1618
  config: e,
1619
1619
  parentEntity: t,
@@ -1621,52 +1621,52 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
1621
1621
  schema: r
1622
1622
  })] });
1623
1623
  }
1624
- function gt({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c, parentId: d, timeline: f, editableFields: p, refs: m, isEditing: h, onStartEdit: g, onCancelEdit: _, onSaved: y, schema: x, optimistic: w = !1 }) {
1625
- let T = xe(), E = b(), [D, O] = K({}), A = H(() => {
1626
- T.invalidateQueries({ queryKey: [
1627
- ee,
1624
+ function gt({ row: t, rowId: n, childEntity: i, entityCode: o, parentEntity: s, parentId: c, timeline: l, editableFields: u, refs: d, isEditing: p, onStartEdit: m, onCancelEdit: h, onSaved: _, schema: v, optimistic: b = !1 }) {
1625
+ let x = xe(), w = r(), [D, O] = K({}), k = H(() => {
1626
+ x.invalidateQueries({ queryKey: [
1627
+ P,
1628
+ s,
1628
1629
  c,
1629
- d,
1630
- s
1630
+ o
1631
1631
  ] });
1632
1632
  }, [
1633
- T,
1633
+ x,
1634
+ s,
1634
1635
  c,
1635
- d,
1636
- s
1637
- ]), j = be({
1636
+ o
1637
+ ]), A = be({
1638
1638
  mutationFn: (e) => {
1639
1639
  let r = t.$row_version;
1640
- return S(s, n, typeof r == "string" && r !== "" ? {
1640
+ return a(o, n, typeof r == "string" && r !== "" ? {
1641
1641
  ...e,
1642
1642
  $row_version: r
1643
1643
  } : e);
1644
1644
  },
1645
1645
  onSuccess: () => {
1646
- A(), l.success("Updated"), y();
1646
+ k(), S.success("Updated"), _();
1647
1647
  },
1648
- onError: (e) => l.error(e.message)
1648
+ onError: (e) => S.error(e.message)
1649
1649
  }), M = be({
1650
- mutationFn: () => C(s, n),
1650
+ mutationFn: () => j(o, n),
1651
1651
  onSuccess: () => {
1652
- A(), l.success("Deleted");
1652
+ k(), S.success("Deleted");
1653
1653
  },
1654
- onError: (e) => l.error(e.message)
1655
- }), N = H(() => {
1654
+ onError: (e) => S.error(e.message)
1655
+ }), ee = H(() => {
1656
1656
  let e = {};
1657
- for (let n of p) e[n] = t[n] ?? "";
1658
- O(e), g();
1657
+ for (let n of u) e[n] = t[n] ?? "";
1658
+ O(e), m();
1659
1659
  }, [
1660
1660
  t,
1661
- p,
1662
- g
1663
- ]), P = H((e, t) => {
1661
+ u,
1662
+ m
1663
+ ]), te = H((e, t) => {
1664
1664
  O((n) => ({
1665
1665
  ...n,
1666
1666
  [e]: t
1667
1667
  }));
1668
- }, []), F = f?.time_field, I = f?.type_field, L = f?.summary_field, R = f?.content_field, z = f?.author_field, B = f?.direction_field, V = f?.intent_field;
1669
- return h ? /* @__PURE__ */ Y("div", {
1668
+ }, []), N = l?.time_field, F = l?.type_field, I = l?.summary_field, L = l?.content_field, R = l?.author_field, z = l?.direction_field, B = l?.intent_field;
1669
+ return p ? /* @__PURE__ */ Y("div", {
1670
1670
  style: {
1671
1671
  borderRadius: 10,
1672
1672
  border: "1px solid var(--accent)",
@@ -1676,8 +1676,8 @@ function gt({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c,
1676
1676
  flexDirection: "column",
1677
1677
  gap: 8
1678
1678
  },
1679
- children: [p.map((e) => {
1680
- let t = a.fields.get(e);
1679
+ children: [u.map((e) => {
1680
+ let t = i.fields.get(e);
1681
1681
  return t ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("label", {
1682
1682
  style: {
1683
1683
  fontSize: 11,
@@ -1685,15 +1685,15 @@ function gt({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c,
1685
1685
  marginBottom: 4,
1686
1686
  display: "block"
1687
1687
  },
1688
- children: k(t, e, x.entities)
1689
- }), v({
1688
+ children: f(t, e, v.entities)
1689
+ }), C({
1690
1690
  field: t,
1691
1691
  fieldName: e,
1692
1692
  value: D[e] ?? "",
1693
1693
  mode: "edit",
1694
- onChange: (t) => P(e, t),
1694
+ onChange: (t) => te(e, t),
1695
1695
  record: D,
1696
- locale: E
1696
+ locale: w
1697
1697
  })] }, e) : null;
1698
1698
  }), /* @__PURE__ */ Y("div", {
1699
1699
  style: {
@@ -1702,33 +1702,33 @@ function gt({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c,
1702
1702
  gap: 6,
1703
1703
  paddingTop: 4
1704
1704
  },
1705
- children: [/* @__PURE__ */ J(i, {
1705
+ children: [/* @__PURE__ */ J(y, {
1706
1706
  kind: "primary",
1707
1707
  size: "xs",
1708
- icon: j.isPending ? /* @__PURE__ */ J(o, { size: 12 }) : /* @__PURE__ */ J(e.check, { size: 12 }),
1709
- onClick: () => j.mutate(D),
1710
- disabled: j.isPending,
1711
- children: j.isPending ? "Saving…" : "Save"
1712
- }), /* @__PURE__ */ J(i, {
1708
+ icon: A.isPending ? /* @__PURE__ */ J(g, { size: 12 }) : /* @__PURE__ */ J(e.check, { size: 12 }),
1709
+ onClick: () => A.mutate(D),
1710
+ disabled: A.isPending,
1711
+ children: A.isPending ? "Saving…" : "Save"
1712
+ }), /* @__PURE__ */ J(y, {
1713
1713
  size: "xs",
1714
1714
  icon: /* @__PURE__ */ J(e.x, { size: 12 }),
1715
1715
  onClick: () => {
1716
- O({}), _();
1716
+ O({}), h();
1717
1717
  },
1718
- disabled: j.isPending,
1718
+ disabled: A.isPending,
1719
1719
  children: "Cancel"
1720
1720
  })]
1721
1721
  })]
1722
1722
  }) : /* @__PURE__ */ Y("div", {
1723
1723
  className: "group",
1724
- "data-optimistic": w || void 0,
1724
+ "data-optimistic": b || void 0,
1725
1725
  style: {
1726
1726
  borderRadius: 10,
1727
1727
  border: "1px solid var(--border)",
1728
1728
  background: "var(--surface)",
1729
1729
  padding: 12,
1730
1730
  transition: "border-color .12s",
1731
- opacity: w ? .6 : 1
1731
+ opacity: b ? .6 : 1
1732
1732
  },
1733
1733
  onMouseEnter: (e) => e.currentTarget.style.borderColor = "var(--border-strong)",
1734
1734
  onMouseLeave: (e) => e.currentTarget.style.borderColor = "var(--border)",
@@ -1743,74 +1743,74 @@ function gt({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c,
1743
1743
  color: "var(--text-3)"
1744
1744
  },
1745
1745
  children: [
1746
- F && t[F] != null && a.fields.get(F) && /* @__PURE__ */ J("span", {
1746
+ N && t[N] != null && i.fields.get(N) && /* @__PURE__ */ J("span", {
1747
1747
  style: { fontWeight: 500 },
1748
- children: v({
1749
- field: a.fields.get(F),
1750
- fieldName: F,
1751
- value: t[F],
1748
+ children: C({
1749
+ field: i.fields.get(N),
1750
+ fieldName: N,
1751
+ value: t[N],
1752
1752
  mode: "display",
1753
1753
  record: t,
1754
- refs: m,
1755
- locale: E
1754
+ refs: d,
1755
+ locale: w
1756
1756
  })
1757
1757
  }),
1758
- I && t[I] != null && a.fields.get(I) && /* @__PURE__ */ J(u, {
1758
+ F && t[F] != null && i.fields.get(F) && /* @__PURE__ */ J(T, {
1759
1759
  tone: "slate",
1760
1760
  size: "xs",
1761
- children: v({
1762
- field: a.fields.get(I),
1763
- fieldName: I,
1764
- value: t[I],
1761
+ children: C({
1762
+ field: i.fields.get(F),
1763
+ fieldName: F,
1764
+ value: t[F],
1765
1765
  mode: "display",
1766
1766
  record: t,
1767
- refs: m,
1768
- locale: E
1767
+ refs: d,
1768
+ locale: w
1769
1769
  })
1770
1770
  }),
1771
- B && t[B] != null && a.fields.get(B) && /* @__PURE__ */ J(bt, {
1772
- value: t[B],
1773
- field: a.fields.get(B)
1771
+ z && t[z] != null && i.fields.get(z) && /* @__PURE__ */ J(bt, {
1772
+ value: t[z],
1773
+ field: i.fields.get(z)
1774
1774
  }),
1775
- V && t[V] != null && a.fields.get(V) && /* @__PURE__ */ J(u, {
1775
+ B && t[B] != null && i.fields.get(B) && /* @__PURE__ */ J(T, {
1776
1776
  tone: "slate",
1777
1777
  size: "xs",
1778
- children: v({
1779
- field: a.fields.get(V),
1780
- fieldName: V,
1781
- value: t[V],
1778
+ children: C({
1779
+ field: i.fields.get(B),
1780
+ fieldName: B,
1781
+ value: t[B],
1782
1782
  mode: "display",
1783
1783
  record: t,
1784
- refs: m,
1785
- locale: E
1784
+ refs: d,
1785
+ locale: w
1786
1786
  })
1787
1787
  }),
1788
- z && t[z] != null && a.fields.get(z) && /* @__PURE__ */ Y("span", { children: [
1788
+ R && t[R] != null && i.fields.get(R) && /* @__PURE__ */ Y("span", { children: [
1789
1789
  "by",
1790
1790
  " ",
1791
- v({
1792
- field: a.fields.get(z),
1793
- fieldName: z,
1794
- value: t[z],
1791
+ C({
1792
+ field: i.fields.get(R),
1793
+ fieldName: R,
1794
+ value: t[R],
1795
1795
  mode: "display",
1796
1796
  record: t,
1797
- refs: m,
1798
- locale: E
1797
+ refs: d,
1798
+ locale: w
1799
1799
  })
1800
1800
  ] }),
1801
- !w && /* @__PURE__ */ Y("div", {
1801
+ !b && /* @__PURE__ */ Y("div", {
1802
1802
  style: {
1803
1803
  marginLeft: "auto",
1804
1804
  display: "flex",
1805
1805
  alignItems: "center",
1806
1806
  gap: 2
1807
1807
  },
1808
- children: [/* @__PURE__ */ J(r, {
1808
+ children: [/* @__PURE__ */ J(E, {
1809
1809
  size: 22,
1810
1810
  icon: /* @__PURE__ */ J(e.edit, { size: 11 }),
1811
- onClick: N,
1811
+ onClick: ee,
1812
1812
  title: "Edit"
1813
- }), /* @__PURE__ */ J(r, {
1813
+ }), /* @__PURE__ */ J(E, {
1814
1814
  size: 22,
1815
1815
  icon: /* @__PURE__ */ J(e.trash, { size: 11 }),
1816
1816
  onClick: () => M.mutate(),
@@ -1819,36 +1819,36 @@ function gt({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c,
1819
1819
  })
1820
1820
  ]
1821
1821
  }),
1822
- L && t[L] != null && a.fields.get(L) && /* @__PURE__ */ J("div", {
1822
+ I && t[I] != null && i.fields.get(I) && /* @__PURE__ */ J("div", {
1823
1823
  style: {
1824
1824
  fontSize: 12.5,
1825
1825
  fontWeight: 500,
1826
1826
  marginTop: 6
1827
1827
  },
1828
- children: v({
1829
- field: a.fields.get(L),
1830
- fieldName: L,
1831
- value: t[L],
1828
+ children: C({
1829
+ field: i.fields.get(I),
1830
+ fieldName: I,
1831
+ value: t[I],
1832
1832
  mode: "display",
1833
1833
  record: t,
1834
- refs: m,
1835
- locale: E
1834
+ refs: d,
1835
+ locale: w
1836
1836
  })
1837
1837
  }),
1838
- R && t[R] != null && R !== L && a.fields.get(R) && /* @__PURE__ */ J("div", {
1838
+ L && t[L] != null && L !== I && i.fields.get(L) && /* @__PURE__ */ J("div", {
1839
1839
  style: {
1840
1840
  fontSize: 12.5,
1841
1841
  fontWeight: 400,
1842
1842
  marginTop: 6
1843
1843
  },
1844
- children: v({
1845
- field: a.fields.get(R),
1846
- fieldName: R,
1847
- value: t[R],
1844
+ children: C({
1845
+ field: i.fields.get(L),
1846
+ fieldName: L,
1847
+ value: t[L],
1848
1848
  mode: "display",
1849
1849
  record: t,
1850
- refs: m,
1851
- locale: E
1850
+ refs: d,
1851
+ locale: w
1852
1852
  })
1853
1853
  })
1854
1854
  ]
@@ -1856,12 +1856,12 @@ function gt({ row: t, rowId: n, childEntity: a, entityCode: s, parentEntity: c,
1856
1856
  }
1857
1857
  function _t(e) {
1858
1858
  if (e == null) return "";
1859
- let t = new Date(m(e));
1859
+ let t = new Date(c(e));
1860
1860
  return Number.isNaN(t.getTime()) ? "" : `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`;
1861
1861
  }
1862
1862
  function vt(e) {
1863
1863
  if (e == null) return "—";
1864
- let t = new Date(m(e));
1864
+ let t = new Date(c(e));
1865
1865
  if (Number.isNaN(t.getTime())) return "—";
1866
1866
  let n = /* @__PURE__ */ new Date(), r = /* @__PURE__ */ new Date();
1867
1867
  r.setDate(n.getDate() - 1);
@@ -1937,68 +1937,68 @@ function xt(e, t) {
1937
1937
  }
1938
1938
  //#endregion
1939
1939
  //#region src/components/detail-layout/EditableChildrenTable.tsx
1940
- function St({ config: t, childEntity: n, schema: a, rows: o, onChange: s, validationErrors: c, refs: l, forceTablePresentation: u = !1 }) {
1941
- let d = b(), f = j(), p = 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) => {
1940
+ function St({ config: t, childEntity: n, schema: i, rows: a, onChange: o, validationErrors: s, refs: l, forceTablePresentation: u = !1 }) {
1941
+ let d = r(), 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) => {
1942
1942
  if (_.has(e) || t.position_field && e === t.position_field) return !1;
1943
1943
  let r = n.fields.get(e);
1944
1944
  return !(!r || r.auto || r.primary || r.source);
1945
- }), x = new Set(h.filter((e) => {
1945
+ }), b = new Set(h.filter((e) => {
1946
1946
  if (t.position_field && e === t.position_field) return !0;
1947
1947
  let r = n.fields.get(e);
1948
1948
  return r && (r.auto || r.primary || r.source);
1949
- })), S = H((e, t, n) => {
1950
- s(o.map((r) => r._key === e ? {
1949
+ })), x = H((e, t, n) => {
1950
+ o(a.map((r) => r._key === e ? {
1951
1951
  ...r,
1952
1952
  [t]: n,
1953
1953
  _dirty: !0
1954
1954
  } : r));
1955
- }, [o, s]), C = H(() => {
1955
+ }, [a, o]), S = H(() => {
1956
1956
  let e = {
1957
1957
  _key: crypto.randomUUID(),
1958
1958
  _dirty: !0
1959
1959
  };
1960
- g && (e[g] = o.filter((e) => !e._deleted).reduce((e, t) => {
1960
+ g && (e[g] = a.filter((e) => !e._deleted).reduce((e, t) => {
1961
1961
  let n = typeof t[g] == "number" ? t[g] : -1;
1962
1962
  return Math.max(e, n);
1963
1963
  }, -1) + 1);
1964
1964
  let r = t.quick_add?.defaults ?? {};
1965
- for (let t of y) {
1965
+ for (let t of v) {
1966
1966
  let i = n.fields.get(t);
1967
1967
  i && (r[t] === void 0 ? i.default === void 0 ? i.type === "bool" && (e[t] = !1) : e[t] = i.default : e[t] = r[t]);
1968
1968
  }
1969
- s([...o, e]);
1969
+ o([...a, e]);
1970
1970
  }, [
1971
+ a,
1971
1972
  o,
1972
- s,
1973
- y,
1973
+ v,
1974
1974
  n,
1975
1975
  t.quick_add?.defaults,
1976
1976
  g
1977
1977
  ]), w = H((e) => {
1978
- s(o.map((t) => t._key === e ? {
1978
+ o(a.map((t) => t._key === e ? {
1979
1979
  ...t,
1980
1980
  _deleted: !0
1981
1981
  } : t));
1982
- }, [o, s]), T = H((e) => {
1983
- s(o.map((t) => t._key === e ? {
1982
+ }, [a, o]), T = H((e) => {
1983
+ o(a.map((t) => t._key === e ? {
1984
1984
  ...t,
1985
1985
  _deleted: !1
1986
1986
  } : t));
1987
- }, [o, s]), E = H((e, t) => {
1987
+ }, [a, o]), O = H((e, t) => {
1988
1988
  if (!g) return;
1989
- let n = o.filter((e) => !e._deleted), r = o.filter((e) => e._deleted), i = n.findIndex((t) => t._key === e), a = i + t;
1990
- if (i < 0 || a < 0 || a >= n.length) return;
1989
+ let n = a.filter((e) => !e._deleted), r = a.filter((e) => e._deleted), i = n.findIndex((t) => t._key === e), s = i + t;
1990
+ if (i < 0 || s < 0 || s >= n.length) return;
1991
1991
  let c = [...n], [l] = c.splice(i, 1);
1992
- c.splice(a, 0, l), s([...c.map((e, t) => ({
1992
+ c.splice(s, 0, l), o([...c.map((e, t) => ({
1993
1993
  ...e,
1994
1994
  [g]: t,
1995
1995
  _dirty: e[g] !== t || e._dirty
1996
1996
  })), ...r]);
1997
1997
  }, [
1998
+ a,
1998
1999
  o,
1999
- s,
2000
2000
  g
2001
- ]), D = H((e) => {
2001
+ ]), k = H((e) => {
2002
2002
  let t = e.target, n = t.closest("td");
2003
2003
  if (!n) return;
2004
2004
  let r = n.closest("tr");
@@ -2022,7 +2022,7 @@ function St({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
2022
2022
  if (o < t.length - 1) {
2023
2023
  let e = t[o + 1].cells[a]?.querySelector("input, select, textarea, [tabindex]");
2024
2024
  e && e.focus();
2025
- } else C(), requestAnimationFrame(() => {
2025
+ } else S(), requestAnimationFrame(() => {
2026
2026
  let e = i.querySelectorAll("tr"), t = e[e.length - 1];
2027
2027
  if (t) {
2028
2028
  let e = t.querySelector("input, select, textarea, [tabindex]");
@@ -2030,21 +2030,21 @@ function St({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
2030
2030
  }
2031
2031
  });
2032
2032
  } else e.key === "Escape" && t.blur?.();
2033
- }, [C]), O = ue;
2034
- return f.isPhone && !u ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
2033
+ }, [S]), A = de;
2034
+ return p.isPhone && !u ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
2035
2035
  style: {
2036
2036
  display: "flex",
2037
2037
  flexDirection: "column",
2038
2038
  gap: 10
2039
2039
  },
2040
- children: o.map((t, i) => {
2041
- let s = !!t._deleted, u = c?.[t._key], f = g ? o.filter((e) => !e._deleted) : [], p = g ? f.findIndex((e) => e._key === t._key) : -1;
2040
+ children: a.map((t, r) => {
2041
+ 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;
2042
2042
  return /* @__PURE__ */ Y("div", {
2043
2043
  style: {
2044
2044
  border: "1px solid var(--border)",
2045
2045
  borderRadius: 8,
2046
2046
  background: "var(--surface)",
2047
- opacity: s ? .58 : 1,
2047
+ opacity: o ? .58 : 1,
2048
2048
  overflow: "hidden"
2049
2049
  },
2050
2050
  children: [/* @__PURE__ */ Y("div", {
@@ -2063,31 +2063,31 @@ function St({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
2063
2063
  fontWeight: 600,
2064
2064
  color: "var(--text-2)"
2065
2065
  },
2066
- children: ["Row ", i + 1]
2066
+ children: ["Row ", r + 1]
2067
2067
  }), /* @__PURE__ */ Y("div", {
2068
2068
  style: {
2069
2069
  display: "flex",
2070
2070
  alignItems: "center",
2071
2071
  gap: 4
2072
2072
  },
2073
- children: [g && !s && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(r, {
2073
+ children: [g && !o && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(E, {
2074
2074
  size: 32,
2075
2075
  icon: /* @__PURE__ */ J(e.up, { size: 14 }),
2076
- onClick: () => E(t._key, -1),
2077
- disabled: p <= 0,
2076
+ onClick: () => O(t._key, -1),
2077
+ disabled: m <= 0,
2078
2078
  title: "Move row up"
2079
- }), /* @__PURE__ */ J(r, {
2079
+ }), /* @__PURE__ */ J(E, {
2080
2080
  size: 32,
2081
2081
  icon: /* @__PURE__ */ J(e.down, { size: 14 }),
2082
- onClick: () => E(t._key, 1),
2083
- disabled: p === -1 || p >= f.length - 1,
2082
+ onClick: () => O(t._key, 1),
2083
+ disabled: m === -1 || m >= p.length - 1,
2084
2084
  title: "Move row down"
2085
- })] }), s ? /* @__PURE__ */ J(r, {
2085
+ })] }), o ? /* @__PURE__ */ J(E, {
2086
2086
  size: 32,
2087
2087
  icon: /* @__PURE__ */ J(e.refresh, { size: 14 }),
2088
2088
  onClick: () => T(t._key),
2089
2089
  title: "Undo delete"
2090
- }) : /* @__PURE__ */ J(r, {
2090
+ }) : /* @__PURE__ */ J(E, {
2091
2091
  size: 32,
2092
2092
  icon: /* @__PURE__ */ J(e.trash, { size: 14 }),
2093
2093
  onClick: () => w(t._key),
@@ -2102,58 +2102,58 @@ function St({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
2102
2102
  gap: 12
2103
2103
  },
2104
2104
  children: h.map((e) => {
2105
- let r = n.fields.get(e), i = u?.includes(e), o = x.has(e), c = r ? k(r, e, a.entities) : e, f = `child-${t._key}-${e}`, p = `${f}-label`, h = {
2106
- outline: i ? "1px solid var(--danger)" : "none",
2105
+ let r = n.fields.get(e), a = u?.includes(e), s = b.has(e), p = r ? f(r, e, i.entities) : e, m = `child-${t._key}-${e}`, h = `${m}-label`, g = {
2106
+ outline: a ? "1px solid var(--danger)" : "none",
2107
2107
  outlineOffset: 3,
2108
- borderRadius: i ? 5 : 0
2109
- }, g = {
2108
+ borderRadius: a ? 5 : 0
2109
+ }, _ = {
2110
2110
  fontSize: 11.5,
2111
2111
  fontWeight: 600,
2112
2112
  color: "var(--text-3)"
2113
- }, _ = !s && !o && !!r;
2113
+ }, v = !o && !s && !!r;
2114
2114
  return /* @__PURE__ */ Y("div", {
2115
2115
  style: {
2116
2116
  display: "flex",
2117
2117
  flexDirection: "column",
2118
2118
  gap: 5,
2119
2119
  minWidth: 0,
2120
- textDecoration: s ? "line-through" : "none"
2120
+ textDecoration: o ? "line-through" : "none"
2121
2121
  },
2122
- title: i ? `${e} is required` : void 0,
2123
- children: [_ ? /* @__PURE__ */ J("label", {
2124
- id: p,
2125
- htmlFor: f,
2126
- style: g,
2127
- children: c
2122
+ title: a ? `${e} is required` : void 0,
2123
+ children: [v ? /* @__PURE__ */ J("label", {
2124
+ id: h,
2125
+ htmlFor: m,
2126
+ style: _,
2127
+ children: p
2128
2128
  }) : /* @__PURE__ */ J("div", {
2129
- id: p,
2130
- style: g,
2131
- children: c
2129
+ id: h,
2130
+ style: _,
2131
+ children: p
2132
2132
  }), /* @__PURE__ */ J("div", {
2133
- style: h,
2134
- children: s || o ? r ? v({
2133
+ style: g,
2134
+ children: o || s ? r ? C({
2135
2135
  field: r,
2136
2136
  fieldName: e,
2137
2137
  value: t[e],
2138
2138
  mode: "display",
2139
2139
  record: t,
2140
2140
  refs: l,
2141
- fieldId: f,
2142
- labelId: p,
2141
+ fieldId: m,
2142
+ labelId: h,
2143
2143
  locale: d
2144
- }) : m(t[e]) : r ? v({
2144
+ }) : c(t[e]) : r ? C({
2145
2145
  field: r,
2146
2146
  fieldName: e,
2147
2147
  value: t[e],
2148
2148
  mode: "edit",
2149
- onChange: (n) => S(t._key, e, n),
2149
+ onChange: (n) => x(t._key, e, n),
2150
2150
  record: t,
2151
2151
  refs: l,
2152
2152
  compact: !0,
2153
- fieldId: f,
2154
- labelId: p,
2153
+ fieldId: m,
2154
+ labelId: h,
2155
2155
  locale: d
2156
- }) : m(t[e])
2156
+ }) : c(t[e])
2157
2157
  })]
2158
2158
  }, e);
2159
2159
  })
@@ -2162,51 +2162,51 @@ function St({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
2162
2162
  })
2163
2163
  }), /* @__PURE__ */ J("div", {
2164
2164
  style: { marginTop: 10 },
2165
- children: /* @__PURE__ */ J(i, {
2165
+ children: /* @__PURE__ */ J(y, {
2166
2166
  kind: "ghost",
2167
2167
  size: "sm",
2168
2168
  icon: /* @__PURE__ */ J(e.plus, { size: 14 }),
2169
- onClick: C,
2169
+ onClick: S,
2170
2170
  children: "Add row"
2171
2171
  })
2172
2172
  })] }) : /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
2173
2173
  style: { overflowX: "auto" },
2174
2174
  children: /* @__PURE__ */ Y("table", {
2175
- ref: p,
2176
- style: de,
2177
- onKeyDown: D,
2175
+ ref: m,
2176
+ style: fe,
2177
+ onKeyDown: k,
2178
2178
  children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ Y("tr", { children: [h.map((e) => {
2179
2179
  let t = n.fields.get(e);
2180
2180
  return /* @__PURE__ */ J("th", {
2181
- style: O,
2182
- children: t ? k(t, e, a.entities) : e
2181
+ style: A,
2182
+ children: t ? f(t, e, i.entities) : e
2183
2183
  }, e);
2184
2184
  }), /* @__PURE__ */ J("th", { style: {
2185
- ...O,
2185
+ ...A,
2186
2186
  width: 40
2187
- } })] }) }), /* @__PURE__ */ J("tbody", { children: o.map((t) => {
2188
- let i = !!t._deleted, a = c?.[t._key];
2187
+ } })] }) }), /* @__PURE__ */ J("tbody", { children: a.map((t) => {
2188
+ let r = !!t._deleted, i = s?.[t._key];
2189
2189
  return /* @__PURE__ */ Y("tr", {
2190
- style: { opacity: i ? .5 : 1 },
2190
+ style: { opacity: r ? .5 : 1 },
2191
2191
  children: [h.map((e) => {
2192
- let r = n.fields.get(e), o = a?.includes(e), s = x.has(e);
2193
- return i || s ? /* @__PURE__ */ J("td", {
2192
+ let a = n.fields.get(e), o = i?.includes(e), s = b.has(e);
2193
+ return r || s ? /* @__PURE__ */ J("td", {
2194
2194
  style: {
2195
2195
  padding: "6px 12px",
2196
2196
  borderBottom: "1px solid var(--divider)",
2197
2197
  verticalAlign: "middle",
2198
- textDecoration: i ? "line-through" : "none",
2198
+ textDecoration: r ? "line-through" : "none",
2199
2199
  color: "var(--text-2)"
2200
2200
  },
2201
- children: r ? v({
2202
- field: r,
2201
+ children: a ? C({
2202
+ field: a,
2203
2203
  fieldName: e,
2204
2204
  value: t[e],
2205
2205
  mode: "display",
2206
2206
  record: t,
2207
2207
  refs: l,
2208
2208
  locale: d
2209
- }) : m(t[e])
2209
+ }) : c(t[e])
2210
2210
  }, e) : /* @__PURE__ */ J("td", {
2211
2211
  style: {
2212
2212
  padding: "4px 4px",
@@ -2217,17 +2217,17 @@ function St({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
2217
2217
  borderRadius: o ? 4 : 0
2218
2218
  },
2219
2219
  title: o ? `${e} is required` : void 0,
2220
- children: r ? v({
2221
- field: r,
2220
+ children: a ? C({
2221
+ field: a,
2222
2222
  fieldName: e,
2223
2223
  value: t[e],
2224
2224
  mode: "edit",
2225
- onChange: (n) => S(t._key, e, n),
2225
+ onChange: (n) => x(t._key, e, n),
2226
2226
  record: t,
2227
2227
  refs: l,
2228
2228
  compact: !0,
2229
2229
  locale: d
2230
- }) : m(t[e])
2230
+ }) : c(t[e])
2231
2231
  }, e);
2232
2232
  }), /* @__PURE__ */ J("td", {
2233
2233
  style: {
@@ -2235,12 +2235,12 @@ function St({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
2235
2235
  borderBottom: "1px solid var(--divider)",
2236
2236
  verticalAlign: "middle"
2237
2237
  },
2238
- children: i ? /* @__PURE__ */ J(r, {
2238
+ children: r ? /* @__PURE__ */ J(E, {
2239
2239
  size: 24,
2240
2240
  icon: /* @__PURE__ */ J(e.refresh, { size: 12 }),
2241
2241
  onClick: () => T(t._key),
2242
2242
  title: "Undo delete"
2243
- }) : /* @__PURE__ */ J(r, {
2243
+ }) : /* @__PURE__ */ J(E, {
2244
2244
  size: 24,
2245
2245
  icon: /* @__PURE__ */ J(e.trash, { size: 12 }),
2246
2246
  onClick: () => w(t._key),
@@ -2252,20 +2252,20 @@ function St({ config: t, childEntity: n, schema: a, rows: o, onChange: s, valida
2252
2252
  })
2253
2253
  }), /* @__PURE__ */ J("div", {
2254
2254
  style: { marginTop: 8 },
2255
- children: /* @__PURE__ */ J(i, {
2255
+ children: /* @__PURE__ */ J(y, {
2256
2256
  kind: "ghost",
2257
2257
  size: "xs",
2258
2258
  icon: /* @__PURE__ */ J(e.plus, { size: 12 }),
2259
- onClick: C,
2259
+ onClick: S,
2260
2260
  children: "Add row"
2261
2261
  })
2262
2262
  })] });
2263
2263
  }
2264
2264
  //#endregion
2265
2265
  //#region src/components/detail-layout/ChildrenBlock.tsx
2266
- var Ct = he(() => import("./DraggableChildrenTable-DziCVhq6.js").then((e) => ({ default: e.DraggableChildrenTable })));
2266
+ var Ct = V(() => import("./DraggableChildrenTable-BkqtkJuz.js").then((e) => ({ default: e.DraggableChildrenTable })));
2267
2267
  function wt({ node: e, ctx: n }) {
2268
- let r = j(), i = e.children;
2268
+ let r = D(), i = e.children;
2269
2269
  if (!i) return null;
2270
2270
  let a = r.isPhone && n.relatedRecordsPresentation === "table";
2271
2271
  if (n.isNew && n.mode !== "edit") return null;
@@ -2279,7 +2279,7 @@ function wt({ node: e, ctx: n }) {
2279
2279
  className: "text-sm text-muted-foreground py-2",
2280
2280
  children: ["Entity not found: ", o.entity]
2281
2281
  });
2282
- let c = Ne(o, s, e), l = ke(e, n), u = Ae(e, n), d = (e) => c.mode === "timeline" || n.withinCard ? e : /* @__PURE__ */ J(I, {
2282
+ let c = Ne(o, s, e), l = ke(e, n), u = Ae(e, n), d = (e) => c.mode === "timeline" || n.withinCard ? e : /* @__PURE__ */ J(re, {
2283
2283
  title: l,
2284
2284
  icon: u ? /* @__PURE__ */ J(t, {
2285
2285
  name: u,
@@ -2287,10 +2287,10 @@ function wt({ node: e, ctx: n }) {
2287
2287
  }) : void 0,
2288
2288
  children: e
2289
2289
  });
2290
- if (n.mode === "edit" && c.editable && c.interaction !== "navigate" && c.interaction !== "readonly" && f(s, "update") && c.mode === "table" && n.pendingChildren !== void 0 && n.onChildrenChange) {
2290
+ if (n.mode === "edit" && c.editable && c.interaction !== "navigate" && c.interaction !== "readonly" && _(s, "update") && c.mode === "table" && n.pendingChildren !== void 0 && n.onChildrenChange) {
2291
2291
  let e = n.pendingChildren[i] ?? [], t = n.childValidationErrors?.[i], o = c.position_field ? r.isPhone && !a ? St : Ct : St;
2292
- return d(/* @__PURE__ */ J(pe, {
2293
- fallback: /* @__PURE__ */ J(R, {}),
2292
+ return d(/* @__PURE__ */ J(me, {
2293
+ fallback: /* @__PURE__ */ J(L, {}),
2294
2294
  children: /* @__PURE__ */ J(o, {
2295
2295
  config: c,
2296
2296
  childEntity: s,
@@ -2304,17 +2304,17 @@ function wt({ node: e, ctx: n }) {
2304
2304
  }));
2305
2305
  }
2306
2306
  if (n.isNew) return null;
2307
- let p = {
2307
+ let f = {
2308
2308
  config: c,
2309
2309
  parentEntity: n.entityCode,
2310
2310
  parentId: n.recordId,
2311
2311
  schema: n.schema
2312
2312
  };
2313
2313
  switch (c.mode) {
2314
- case "list": return d(/* @__PURE__ */ J(tt, { ...p }));
2315
- case "cards": return d(/* @__PURE__ */ J(nt, { ...p }));
2316
- case "timeline": return d(/* @__PURE__ */ J(ht, { ...p }));
2317
- default: return r.isPhone && !a ? d(/* @__PURE__ */ J(nt, { ...p })) : d(/* @__PURE__ */ J(et, { ...p }));
2314
+ case "list": return d(/* @__PURE__ */ J(tt, { ...f }));
2315
+ case "cards": return d(/* @__PURE__ */ J(nt, { ...f }));
2316
+ case "timeline": return d(/* @__PURE__ */ J(ht, { ...f }));
2317
+ default: return r.isPhone && !a ? d(/* @__PURE__ */ J(nt, { ...f })) : d(/* @__PURE__ */ J(et, { ...f }));
2318
2318
  }
2319
2319
  }
2320
2320
  //#endregion
@@ -2325,7 +2325,7 @@ var Tt = 150, Et = 560, Dt = "20px", Ot = 4, kt = /* @__PURE__ */ new Set([
2325
2325
  "json",
2326
2326
  "structure",
2327
2327
  "multilang_text"
2328
- ]), At = me({ columns: 2 });
2328
+ ]), At = he({ columns: 2 });
2329
2329
  function jt({ columns: e = 2, children: t }) {
2330
2330
  let n = G(null), [r, i] = K(!1);
2331
2331
  U(() => {
@@ -2351,8 +2351,8 @@ function jt({ columns: e = 2, children: t }) {
2351
2351
  })
2352
2352
  });
2353
2353
  }
2354
- function Mt({ label: t, children: n, span: r = !1, required: i, error: a, hint: o, actions: s, copyValue: l, mode: u = "display", htmlFor: d, labelId: f, labelTitle: p, "data-testid": m }) {
2355
- let h = ge(At), g = r || h.columns === 1, _ = !!a;
2354
+ function Mt({ label: t, children: r, span: i = !1, required: a, error: o, hint: s, actions: c, copyValue: l, mode: u = "display", htmlFor: d, labelId: f, labelTitle: p, "data-testid": m }) {
2355
+ let h = ge(At), g = i || h.columns === 1, _ = !!o;
2356
2356
  return /* @__PURE__ */ Y("div", {
2357
2357
  className: "detail-row",
2358
2358
  "data-error": _ || void 0,
@@ -2363,7 +2363,7 @@ function Mt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2363
2363
  gap: g ? 4 : 16,
2364
2364
  alignItems: g ? "stretch" : "flex-start",
2365
2365
  padding: "6px 0",
2366
- ...r ? { gridColumn: "1 / -1" } : null
2366
+ ...i ? { gridColumn: "1 / -1" } : null
2367
2367
  },
2368
2368
  children: [/* @__PURE__ */ Y("div", {
2369
2369
  style: {
@@ -2387,7 +2387,7 @@ function Mt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2387
2387
  id: f,
2388
2388
  title: p || void 0,
2389
2389
  children: t
2390
- }), i && u === "edit" && /* @__PURE__ */ J("span", {
2390
+ }), a && u === "edit" && /* @__PURE__ */ J("span", {
2391
2391
  "aria-hidden": "true",
2392
2392
  style: {
2393
2393
  color: "var(--danger)",
@@ -2425,9 +2425,9 @@ function Mt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2425
2425
  borderRadius: 6,
2426
2426
  boxShadow: "0 0 0 1.5px var(--danger)"
2427
2427
  },
2428
- children: n
2429
- }) : n
2430
- }), (l || s) && /* @__PURE__ */ Y("div", {
2428
+ children: r
2429
+ }) : r
2430
+ }), (l || c) && /* @__PURE__ */ Y("div", {
2431
2431
  className: "detail-row-action",
2432
2432
  style: {
2433
2433
  display: "flex",
@@ -2435,13 +2435,13 @@ function Mt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2435
2435
  flexShrink: 0,
2436
2436
  marginTop: -2
2437
2437
  },
2438
- children: [l && /* @__PURE__ */ J(c, {
2438
+ children: [l && /* @__PURE__ */ J(n, {
2439
2439
  value: l,
2440
2440
  size: "sm",
2441
2441
  title: "Copy value"
2442
- }), s]
2442
+ }), c]
2443
2443
  })]
2444
- }), (_ || o != null) && /* @__PURE__ */ Y("div", {
2444
+ }), (_ || s != null) && /* @__PURE__ */ Y("div", {
2445
2445
  style: {
2446
2446
  fontSize: 11.5,
2447
2447
  lineHeight: 1.4,
@@ -2450,7 +2450,7 @@ function Mt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2450
2450
  alignItems: "center",
2451
2451
  gap: 4
2452
2452
  },
2453
- children: [_ && /* @__PURE__ */ J(e.warning, { size: 11 }), /* @__PURE__ */ J("span", { children: _ ? a : o })]
2453
+ children: [_ && /* @__PURE__ */ J(e.warning, { size: 11 }), /* @__PURE__ */ J("span", { children: _ ? o : s })]
2454
2454
  })]
2455
2455
  })]
2456
2456
  });
@@ -2458,64 +2458,64 @@ function Mt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2458
2458
  //#endregion
2459
2459
  //#region src/components/detail-layout/FieldsBlock.tsx
2460
2460
  function Nt({ fields: e, ctx: t }) {
2461
- let { entity: n, entityCode: r, record: i, mode: a, onFieldChange: o, schema: s } = t, c = b(), l = t.columns ?? 2, u = l === 1 && e.length === 1;
2461
+ let { entity: n, entityCode: i, record: a, mode: o, onFieldChange: s, schema: l } = t, u = r(), d = t.columns ?? 2, f = d === 1 && e.length === 1;
2462
2462
  return /* @__PURE__ */ J(jt, {
2463
- columns: l,
2463
+ columns: d,
2464
2464
  children: e.map((e) => {
2465
- let l = e.name, d = `${r ?? "field"}-${l}`, f = `${d}-label`, p = n.fields.get(l), h = !!(p?.auto || p?.readonly || p?.source), g = te(n, l), _ = g?.read === "denied", v = g?.write === "denied", y = a === "display" ? _ : v || _, b = h || a === "edit" && v ? "display" : a, x = y ? /* @__PURE__ */ J(N, {
2466
- tier: g.classification,
2467
- tierDef: ce(s, n, l),
2468
- requiredPermission: g?.required_permission,
2469
- locale: c,
2470
- variant: b === "edit" ? "input" : "value"
2471
- }) : ie({
2465
+ let r = e.name, d = `${i ?? "field"}-${r}`, m = `${d}-label`, h = n.fields.get(r), g = !!(h?.auto || h?.readonly || h?.source), _ = B(n, r), v = _?.read === "denied", y = _?.write === "denied", b = o === "display" ? v : y || v, x = g || o === "edit" && y ? "display" : o, S = b ? /* @__PURE__ */ J(ae, {
2466
+ tier: _.classification,
2467
+ tierDef: le(l, n, r),
2468
+ requiredPermission: _?.required_permission,
2469
+ locale: u,
2470
+ variant: x === "edit" ? "input" : "value"
2471
+ }) : oe({
2472
2472
  entity: n,
2473
- entityCode: r,
2474
- fieldName: l,
2475
- record: i,
2476
- mode: b,
2477
- onChange: o && !h ? (e) => o(l, e) : void 0,
2473
+ entityCode: i,
2474
+ fieldName: r,
2475
+ record: a,
2476
+ mode: x,
2477
+ onChange: s && !g ? (e) => s(r, e) : void 0,
2478
2478
  refs: t.refs,
2479
- entities: s?.entities,
2480
- screens: s?.screens,
2481
- locale: c,
2479
+ entities: l?.entities,
2480
+ screens: l?.screens,
2481
+ locale: u,
2482
2482
  fieldId: d,
2483
- labelId: f
2483
+ labelId: m
2484
2484
  });
2485
- if (!x) return null;
2486
- let S = a === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ J(q, { children: e.actions.map((e, t) => /* @__PURE__ */ J(M, {
2487
- actionCode: `${l}.action[${t}]`,
2485
+ if (!S) return null;
2486
+ let C = o === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ J(q, { children: e.actions.map((e, t) => /* @__PURE__ */ J(F, {
2487
+ actionCode: `${r}.action[${t}]`,
2488
2488
  action: e,
2489
- entityCode: r,
2490
- row: i,
2489
+ entityCode: i,
2490
+ row: a,
2491
2491
  variant: "ghost",
2492
2492
  size: "icon"
2493
- }, t)) }) : void 0, C = !!p && kt.has(p.type), w = i?.[l], T = b === "display" && (p?.copyable || p?.type === "uuid") && w != null && w !== "" ? m(w) : void 0, E = A(p?.display?.description);
2494
- return u ? /* @__PURE__ */ Y("div", {
2493
+ }, t)) }) : void 0, w = !!h && kt.has(h.type), T = a?.[r], E = x === "display" && (h?.copyable || h?.type === "uuid") && T != null && T !== "" ? c(T) : void 0, D = p(h?.display?.description);
2494
+ return f ? /* @__PURE__ */ Y("div", {
2495
2495
  style: { gridColumn: "1 / -1" },
2496
- children: [x, b === "edit" && E && /* @__PURE__ */ J("div", {
2496
+ children: [S, x === "edit" && D && /* @__PURE__ */ J("div", {
2497
2497
  style: {
2498
2498
  fontSize: 11.5,
2499
2499
  lineHeight: 1.4,
2500
2500
  color: "var(--text-3)",
2501
2501
  marginTop: 3
2502
2502
  },
2503
- children: E
2503
+ children: D
2504
2504
  })]
2505
- }, l) : /* @__PURE__ */ J(Mt, {
2506
- label: oe(n, l, s.entities),
2507
- htmlFor: b === "edit" ? d : void 0,
2508
- labelId: f,
2509
- labelTitle: E || void 0,
2510
- required: p?.required ?? !1,
2511
- mode: b,
2512
- span: C,
2513
- error: t.fieldErrors?.[l],
2514
- hint: b === "edit" && E ? E : void 0,
2515
- actions: S,
2516
- copyValue: T,
2517
- children: x
2518
- }, l);
2505
+ }, r) : /* @__PURE__ */ J(Mt, {
2506
+ label: N(n, r, l.entities),
2507
+ htmlFor: x === "edit" ? d : void 0,
2508
+ labelId: m,
2509
+ labelTitle: D || void 0,
2510
+ required: h?.required ?? !1,
2511
+ mode: x,
2512
+ span: w,
2513
+ error: t.fieldErrors?.[r],
2514
+ hint: x === "edit" && D ? D : void 0,
2515
+ actions: C,
2516
+ copyValue: E,
2517
+ children: S
2518
+ }, r);
2519
2519
  })
2520
2520
  });
2521
2521
  }
@@ -2531,57 +2531,57 @@ var Pt = /* @__PURE__ */ new Set([
2531
2531
  "url"
2532
2532
  ]), Ft = 500;
2533
2533
  function It({ node: e, ctx: t }) {
2534
- let { entity: n, objectProperties: r, onSetProperty: i, isNew: a, mode: o, refs: s } = t, c = n.properties ?? {};
2535
- if (a) return null;
2536
- let l = e.properties === !0 || e.properties, u = l === !0 ? Object.entries(c).sort(([e], [t]) => e.localeCompare(t)) : l.filter((e) => c[e] != null).map((e) => [e, c[e]]);
2537
- return u.length === 0 ? null : /* @__PURE__ */ J(jt, {
2534
+ let { entity: n, objectProperties: r, onSetProperty: a, isNew: o, mode: s, refs: c } = t, l = n.properties ?? {};
2535
+ if (o) return null;
2536
+ 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]]);
2537
+ return d.length === 0 ? null : /* @__PURE__ */ J(jt, {
2538
2538
  columns: 2,
2539
- children: u.map(([e, a]) => {
2540
- let c = r?.find((t) => t.property_code === e), l = x(a), u = a.readonly || !i ? "display" : o;
2539
+ children: d.map(([e, o]) => {
2540
+ let l = r?.find((t) => t.property_code === e), u = i(o), d = o.readonly || !a ? "display" : s;
2541
2541
  return /* @__PURE__ */ J(Lt, {
2542
2542
  propCode: e,
2543
- prop: a,
2544
- field: l,
2545
- value: c?.value,
2546
- mode: u,
2547
- onSetProperty: i,
2548
- refs: s,
2543
+ prop: o,
2544
+ field: u,
2545
+ value: l?.value,
2546
+ mode: d,
2547
+ onSetProperty: a,
2548
+ refs: c,
2549
2549
  entity: n,
2550
2550
  schema: t.schema
2551
2551
  }, e);
2552
2552
  })
2553
2553
  });
2554
2554
  }
2555
- function Lt({ propCode: e, prop: t, field: n, value: r, mode: i, onSetProperty: a, refs: o, entity: s, schema: c }) {
2556
- let l = b(), u = G(null);
2555
+ function Lt({ propCode: e, prop: t, field: n, value: i, mode: a, onSetProperty: o, refs: s, entity: c, schema: l }) {
2556
+ let u = r(), d = G(null);
2557
2557
  U(() => () => {
2558
- u.current && clearTimeout(u.current);
2558
+ d.current && clearTimeout(d.current);
2559
2559
  }, []);
2560
- let d = H((n) => {
2561
- a && (Pt.has(t.type) ? (u.current && clearTimeout(u.current), u.current = setTimeout(() => a(e, n), Ft)) : a(e, n));
2560
+ let f = H((n) => {
2561
+ o && (Pt.has(t.type) ? (d.current && clearTimeout(d.current), d.current = setTimeout(() => o(e, n), Ft)) : o(e, n));
2562
2562
  }, [
2563
2563
  e,
2564
2564
  t.type,
2565
- a
2566
- ]), f = te(s, e), p = f?.read === "denied", m = f?.write === "denied", h = i === "display" ? p : m || p, g = i === "edit" && m ? "display" : i;
2565
+ o
2566
+ ]), m = B(c, e), h = m?.read === "denied", g = m?.write === "denied", _ = a === "display" ? h : g || h, v = a === "edit" && g ? "display" : a;
2567
2567
  return /* @__PURE__ */ J(Mt, {
2568
- label: A(t.display?.name ?? t.name),
2569
- mode: g,
2568
+ label: p(t.display?.name ?? t.name),
2569
+ mode: v,
2570
2570
  span: kt.has(t.type),
2571
- children: h ? /* @__PURE__ */ J(N, {
2572
- tier: f.classification,
2573
- tierDef: ce(c, s, e),
2574
- requiredPermission: f?.required_permission,
2575
- locale: l,
2576
- variant: g === "edit" ? "input" : "value"
2577
- }) : v({
2571
+ children: _ ? /* @__PURE__ */ J(ae, {
2572
+ tier: m.classification,
2573
+ tierDef: le(l, c, e),
2574
+ requiredPermission: m?.required_permission,
2575
+ locale: u,
2576
+ variant: v === "edit" ? "input" : "value"
2577
+ }) : C({
2578
2578
  field: n,
2579
2579
  fieldName: e,
2580
- value: r,
2581
- mode: g,
2582
- onChange: g === "edit" ? d : void 0,
2583
- refs: o,
2584
- locale: l
2580
+ value: i,
2581
+ mode: v,
2582
+ onChange: v === "edit" ? f : void 0,
2583
+ refs: s,
2584
+ locale: u
2585
2585
  })
2586
2586
  });
2587
2587
  }
@@ -2663,7 +2663,7 @@ function zt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2663
2663
  gap: 16
2664
2664
  },
2665
2665
  children: Object.entries(e).map(([e, a]) => {
2666
- let o = t?.find((t) => t.group_code === e)?.status_code, c = o ? a.statuses.find((e) => e.code === o) : void 0;
2666
+ let o = t?.find((t) => t.group_code === e)?.status_code, s = o ? a.statuses.find((e) => e.code === o) : void 0;
2667
2667
  if (a.display_mode === "stepper") {
2668
2668
  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;
2669
2669
  return /* @__PURE__ */ Y("div", {
@@ -2679,7 +2679,7 @@ function zt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2679
2679
  color: "var(--text-3)",
2680
2680
  flexShrink: 0
2681
2681
  },
2682
- children: [A(a.name), ":"]
2682
+ children: [p(a.name), ":"]
2683
2683
  }), /* @__PURE__ */ J("div", {
2684
2684
  style: {
2685
2685
  minWidth: 240,
@@ -2689,7 +2689,7 @@ function zt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2689
2689
  children: /* @__PURE__ */ J(Rt, {
2690
2690
  stages: a.statuses.map((e) => ({
2691
2691
  code: e.code,
2692
- label: A(e.name)
2692
+ label: p(e.name)
2693
2693
  })),
2694
2694
  current: o,
2695
2695
  selectable: s,
@@ -2710,11 +2710,11 @@ function zt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2710
2710
  fontSize: 12,
2711
2711
  color: "var(--text-3)"
2712
2712
  },
2713
- children: [A(a.name), ":"]
2714
- }), c ? /* @__PURE__ */ J(u, {
2715
- tone: c.color ?? "slate",
2713
+ children: [p(a.name), ":"]
2714
+ }), s ? /* @__PURE__ */ J(T, {
2715
+ tone: s.color ?? "slate",
2716
2716
  size: "xs",
2717
- children: A(c.name)
2717
+ children: p(s.name)
2718
2718
  }) : /* @__PURE__ */ J("span", {
2719
2719
  style: {
2720
2720
  fontSize: 12.5,
@@ -2723,7 +2723,7 @@ function zt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2723
2723
  children: "—"
2724
2724
  })]
2725
2725
  }, e);
2726
- let l = (a.transitions && o ? a.statuses.filter((e) => e.code === o || (a.transitions[o]?.includes(e.code) ?? !1)) : a.statuses).map((e) => ({
2726
+ let c = (a.transitions && o ? a.statuses.filter((e) => e.code === o || (a.transitions[o]?.includes(e.code) ?? !1)) : a.statuses).map((e) => ({
2727
2727
  value: e.code,
2728
2728
  label: /* @__PURE__ */ Y("span", {
2729
2729
  style: {
@@ -2737,7 +2737,7 @@ function zt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2737
2737
  borderRadius: 999,
2738
2738
  background: `var(--pill-${e.color}, ${e.color})`,
2739
2739
  display: "inline-block"
2740
- } }), A(e.name)]
2740
+ } }), p(e.name)]
2741
2741
  })
2742
2742
  }));
2743
2743
  return /* @__PURE__ */ Y("div", {
@@ -2751,16 +2751,16 @@ function zt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2751
2751
  fontSize: 12,
2752
2752
  color: "var(--text-3)"
2753
2753
  },
2754
- children: [A(a.name), ":"]
2754
+ children: [p(a.name), ":"]
2755
2755
  }), /* @__PURE__ */ J("div", {
2756
2756
  style: {
2757
2757
  minWidth: 180,
2758
2758
  opacity: r ? .6 : 1,
2759
2759
  pointerEvents: r ? "none" : "auto"
2760
2760
  },
2761
- children: /* @__PURE__ */ J(s, {
2761
+ children: /* @__PURE__ */ J(m, {
2762
2762
  value: o ?? "",
2763
- options: l,
2763
+ options: c,
2764
2764
  onChange: (t) => n(e, t),
2765
2765
  placeholder: "Select…"
2766
2766
  })
@@ -2817,7 +2817,7 @@ function Wt(e) {
2817
2817
  }
2818
2818
  //#endregion
2819
2819
  //#region src/components/detail-layout/widgets/JsonDiffWidget.tsx
2820
- var Gt = "Audit change diff", Kt = he(() => import("./MonacoJson-BfpzZ1iT.js").then((e) => ({ default: e.MonacoJsonDiff }))), qt = he(() => import("./MonacoJson-BfpzZ1iT.js").then((e) => ({ default: e.MonacoJsonSource }))), Jt = he(() => import("./JsonEditor-DoNmyrYd.js").then((e) => ({ default: e.JsonEditor })));
2820
+ var Gt = "Audit change diff", Kt = V(() => import("./MonacoJson-BfpzZ1iT.js").then((e) => ({ default: e.MonacoJsonDiff }))), qt = V(() => import("./MonacoJson-BfpzZ1iT.js").then((e) => ({ default: e.MonacoJsonSource }))), Jt = V(() => import("./JsonEditor-DoNmyrYd.js").then((e) => ({ default: e.JsonEditor })));
2821
2821
  function Yt() {
2822
2822
  return /* @__PURE__ */ J("div", {
2823
2823
  className: "flex h-full w-full items-center justify-center text-sm text-muted-foreground",
@@ -2825,7 +2825,7 @@ function Yt() {
2825
2825
  });
2826
2826
  }
2827
2827
  function Xt({ before: e, after: t }) {
2828
- return /* @__PURE__ */ J(pe, {
2828
+ return /* @__PURE__ */ J(me, {
2829
2829
  fallback: /* @__PURE__ */ J(Yt, {}),
2830
2830
  children: /* @__PURE__ */ Y("div", {
2831
2831
  className: "flex h-full w-full gap-2",
@@ -2885,12 +2885,12 @@ function Qt({ values: e, options: t }) {
2885
2885
  className: "h-[480px] w-full overflow-hidden rounded border",
2886
2886
  role: "group",
2887
2887
  "aria-label": Gt,
2888
- children: /* @__PURE__ */ J(re, {
2888
+ children: /* @__PURE__ */ J(ie, {
2889
2889
  fallback: /* @__PURE__ */ J(Xt, {
2890
2890
  before: n,
2891
2891
  after: r
2892
2892
  }),
2893
- children: /* @__PURE__ */ J(pe, {
2893
+ children: /* @__PURE__ */ J(me, {
2894
2894
  fallback: /* @__PURE__ */ J(Yt, {}),
2895
2895
  children: i === "diff" ? /* @__PURE__ */ J(Kt, {
2896
2896
  before: o,
@@ -3016,45 +3016,45 @@ function rn(e, t) {
3016
3016
  return !t || Object.entries(t).every(([t, n]) => e[t] === n);
3017
3017
  }
3018
3018
  function an({ values: e, options: t }) {
3019
- let r = W(() => en(t), [t]), i = b(), a = V(), 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("");
3019
+ let n = W(() => en(t), [t]), i = r(), a = ne(), o = e.scope, s = n?.windows.some((e) => e.code === n.default_window) ? n.default_window : n?.windows[0]?.code ?? "", [c, l] = K(s), [u, d] = K("");
3020
3020
  U(() => {
3021
3021
  l(s);
3022
3022
  }, [s]), U(() => {
3023
3023
  d("");
3024
3024
  }, [c]);
3025
- let f = r ? [{
3026
- field: r.scope_field,
3025
+ let f = n ? [{
3026
+ field: n.scope_field,
3027
3027
  op: "eq",
3028
3028
  value: o
3029
3029
  }, {
3030
- field: r.window_field,
3030
+ field: n.window_field,
3031
3031
  op: "eq",
3032
3032
  value: c
3033
- }] : [], p = n(r?.entity, {
3033
+ }] : [], m = h(n?.entity, {
3034
3034
  per_page: 1,
3035
3035
  filters: f
3036
- }, !!(r && o && c)), m = r?.breakdown, h = m ? [{
3037
- field: m.scope_field,
3036
+ }, !!(n && o && c)), g = n?.breakdown, _ = g ? [{
3037
+ field: g.scope_field,
3038
3038
  op: "eq",
3039
3039
  value: o
3040
3040
  }, {
3041
- field: m.window_field,
3041
+ field: g.window_field,
3042
3042
  op: "eq",
3043
3043
  value: c
3044
- }] : [], g = n(m?.entity, {
3045
- per_page: m?.limit ?? 200,
3046
- sort: m?.sort,
3047
- filters: h
3048
- }, !!(m && o && c));
3049
- if (!r || !o) return /* @__PURE__ */ J("div", {
3044
+ }] : [], v = h(g?.entity, {
3045
+ per_page: g?.limit ?? 200,
3046
+ sort: g?.sort,
3047
+ filters: _
3048
+ }, !!(g && o && c));
3049
+ if (!n || !o) return /* @__PURE__ */ J("div", {
3050
3050
  role: "alert",
3051
3051
  className: "rounded border border-destructive p-3 text-sm text-destructive",
3052
3052
  children: "Invalid entity_scorecard configuration."
3053
3053
  });
3054
- let _ = p.data?.data?.[0], v = g.data?.data ?? [], y = m?.filter_field ? Array.from(new Set(v.map((e) => e[m.filter_field]).filter((e) => typeof e == "string" && e !== ""))).sort() : [], x = u && m?.filter_field ? v.filter((e) => e[m.filter_field] === u) : v, S = (e) => !u || !e.filtered || !m?.filter_field ? _?.[e.field] : v.find((t) => t[m.filter_field] === u && rn(t, e.filtered?.where))?.[e.filtered.field], C = (e) => {
3055
- let t = r.drillthrough;
3054
+ let y = m.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 && rn(t, e.filtered?.where))?.[e.filtered.field], w = (e) => {
3055
+ let t = n.drillthrough;
3056
3056
  if (!t || !e.drillthrough_value) return;
3057
- let n = [{
3057
+ let r = [{
3058
3058
  field: t.scope_field,
3059
3059
  op: "eq",
3060
3060
  value: o
@@ -3063,36 +3063,36 @@ function an({ values: e, options: t }) {
3063
3063
  op: "eq",
3064
3064
  value: c
3065
3065
  }];
3066
- t.filter_field && u && e.drillthrough_filter !== !1 && n.push({
3066
+ t.filter_field && u && e.drillthrough_filter !== !1 && r.push({
3067
3067
  field: t.filter_field,
3068
3068
  op: "eq",
3069
3069
  value: u
3070
- }), t.metric_field && n.push({
3070
+ }), t.metric_field && r.push({
3071
3071
  field: t.metric_field,
3072
3072
  op: "eq",
3073
3073
  value: e.drillthrough_value
3074
- }), a(t.route, { search: new URLSearchParams({ filters: JSON.stringify(n) }).toString() });
3075
- }, w = p.error ?? g.error;
3074
+ }), a(t.route, { search: new URLSearchParams({ filters: JSON.stringify(r) }).toString() });
3075
+ }, T = m.error ?? v.error;
3076
3076
  return /* @__PURE__ */ Y("div", {
3077
3077
  className: "flex min-w-0 flex-col gap-4",
3078
- "aria-label": A(r.title, i) || "Scorecard",
3078
+ "aria-label": p(n.title, i) || "Scorecard",
3079
3079
  children: [
3080
3080
  /* @__PURE__ */ Y("div", {
3081
3081
  className: "flex flex-wrap items-start justify-between gap-3",
3082
3082
  children: [/* @__PURE__ */ Y("div", {
3083
3083
  className: "min-w-0",
3084
3084
  children: [
3085
- r.title && /* @__PURE__ */ J("h3", {
3085
+ n.title && /* @__PURE__ */ J("h3", {
3086
3086
  className: "text-base font-semibold text-foreground",
3087
- children: A(r.title, i)
3087
+ children: p(n.title, i)
3088
3088
  }),
3089
- r.description && /* @__PURE__ */ J("p", {
3089
+ n.description && /* @__PURE__ */ J("p", {
3090
3090
  className: "mt-1 text-sm text-muted-foreground",
3091
- children: A(r.description, i)
3091
+ children: p(n.description, i)
3092
3092
  }),
3093
- r.intended_note && /* @__PURE__ */ J("p", {
3093
+ n.intended_note && /* @__PURE__ */ J("p", {
3094
3094
  className: "mt-1 text-xs text-muted-foreground",
3095
- children: A(r.intended_note, i)
3095
+ children: p(n.intended_note, i)
3096
3096
  })
3097
3097
  ]
3098
3098
  }), /* @__PURE__ */ Y("div", {
@@ -3101,24 +3101,24 @@ function an({ values: e, options: t }) {
3101
3101
  role: "group",
3102
3102
  "aria-label": "Scorecard window",
3103
3103
  className: "inline-flex rounded border border-border p-1",
3104
- children: r.windows.map((e) => /* @__PURE__ */ J("button", {
3104
+ children: n.windows.map((e) => /* @__PURE__ */ J("button", {
3105
3105
  type: "button",
3106
3106
  "aria-pressed": c === e.code,
3107
3107
  onClick: () => l(e.code),
3108
3108
  className: `rounded px-3 py-1.5 text-xs font-medium ${c === e.code ? "bg-accent text-accent-foreground" : "text-muted-foreground"}`,
3109
- children: A(e.label, i) || e.code
3109
+ children: p(e.label, i) || e.code
3110
3110
  }, e.code))
3111
- }), m?.filter_field && /* @__PURE__ */ Y("label", {
3111
+ }), g?.filter_field && /* @__PURE__ */ Y("label", {
3112
3112
  className: "flex items-center gap-2 text-xs text-muted-foreground",
3113
- children: [A(m.filter_label, i) || "Filter", /* @__PURE__ */ Y("select", {
3114
- "aria-label": A(m.filter_label, i) || "Filter",
3113
+ children: [p(g.filter_label, i) || "Filter", /* @__PURE__ */ Y("select", {
3114
+ "aria-label": p(g.filter_label, i) || "Filter",
3115
3115
  value: u,
3116
3116
  onChange: (e) => d(e.target.value),
3117
3117
  className: "rounded border border-border bg-background px-2 py-1.5 text-foreground",
3118
3118
  children: [/* @__PURE__ */ J("option", {
3119
3119
  value: "",
3120
- children: A(m.all_label, i) || "All"
3121
- }), y.map((e) => /* @__PURE__ */ J("option", {
3120
+ children: p(g.all_label, i) || "All"
3121
+ }), x.map((e) => /* @__PURE__ */ J("option", {
3122
3122
  value: e,
3123
3123
  children: e
3124
3124
  }, e))]
@@ -3126,22 +3126,22 @@ function an({ values: e, options: t }) {
3126
3126
  })]
3127
3127
  })]
3128
3128
  }),
3129
- w && /* @__PURE__ */ J("div", {
3129
+ T && /* @__PURE__ */ J("div", {
3130
3130
  role: "alert",
3131
3131
  className: "rounded border border-destructive p-3 text-sm text-destructive",
3132
- children: w instanceof Error ? w.message : "Scorecard data could not be loaded."
3132
+ children: T instanceof Error ? T.message : "Scorecard data could not be loaded."
3133
3133
  }),
3134
- !w && !p.isLoading && !_ && /* @__PURE__ */ J("div", {
3134
+ !T && !m.isLoading && !y && /* @__PURE__ */ J("div", {
3135
3135
  className: "rounded border border-border p-6 text-center text-sm text-muted-foreground",
3136
- children: A(r.empty_label, i) || "No scorecard data."
3136
+ children: p(n.empty_label, i) || "No scorecard data."
3137
3137
  }),
3138
- _ && /* @__PURE__ */ J("div", {
3138
+ y && /* @__PURE__ */ J("div", {
3139
3139
  className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",
3140
- children: r.metrics.map((e) => {
3141
- let t = S(e), n = !!(r.drillthrough && e.drillthrough_value), a = /* @__PURE__ */ Y(q, { children: [
3140
+ children: n.metrics.map((e) => {
3141
+ let t = C(e), r = !!(n.drillthrough && e.drillthrough_value), a = /* @__PURE__ */ Y(q, { children: [
3142
3142
  /* @__PURE__ */ J("span", {
3143
3143
  className: "text-xs font-medium text-muted-foreground",
3144
- children: A(e.label, i) || e.field
3144
+ children: p(e.label, i) || e.field
3145
3145
  }),
3146
3146
  /* @__PURE__ */ J("strong", {
3147
3147
  className: `mt-2 block text-2xl font-semibold ${e.attention && Number(t) > 0 ? "text-destructive" : "text-foreground"}`,
@@ -3149,12 +3149,12 @@ function an({ values: e, options: t }) {
3149
3149
  }),
3150
3150
  e.help && /* @__PURE__ */ J("span", {
3151
3151
  className: "mt-1 block text-xs text-muted-foreground",
3152
- children: A(e.help, i)
3152
+ children: p(e.help, i)
3153
3153
  })
3154
3154
  ] });
3155
- return n ? /* @__PURE__ */ J("button", {
3155
+ return r ? /* @__PURE__ */ J("button", {
3156
3156
  type: "button",
3157
- onClick: () => C(e),
3157
+ onClick: () => w(e),
3158
3158
  className: "rounded border border-border bg-card p-3 text-left hover:bg-surface",
3159
3159
  children: a
3160
3160
  }, e.field) : /* @__PURE__ */ J("article", {
@@ -3163,26 +3163,26 @@ function an({ values: e, options: t }) {
3163
3163
  }, e.field);
3164
3164
  })
3165
3165
  }),
3166
- m && /* @__PURE__ */ J("div", {
3166
+ g && /* @__PURE__ */ J("div", {
3167
3167
  className: "min-w-0 overflow-x-auto rounded border border-border",
3168
3168
  children: /* @__PURE__ */ Y("table", {
3169
3169
  className: "w-full border-collapse text-sm",
3170
3170
  children: [/* @__PURE__ */ J("thead", {
3171
3171
  className: "bg-surface text-left text-xs text-muted-foreground",
3172
- children: /* @__PURE__ */ J("tr", { children: m.columns.map((e) => /* @__PURE__ */ J("th", {
3172
+ children: /* @__PURE__ */ J("tr", { children: g.columns.map((e) => /* @__PURE__ */ J("th", {
3173
3173
  className: "border-b border-divider px-3 py-2 font-medium",
3174
- children: A(e.label, i) || e.field
3174
+ children: p(e.label, i) || e.field
3175
3175
  }, e.field)) })
3176
- }), /* @__PURE__ */ Y("tbody", { children: [x.map((e, t) => /* @__PURE__ */ J("tr", {
3176
+ }), /* @__PURE__ */ Y("tbody", { children: [S.map((e, t) => /* @__PURE__ */ J("tr", {
3177
3177
  className: "border-b border-divider last:border-0",
3178
- children: m.columns.map((t) => /* @__PURE__ */ J("td", {
3178
+ children: g.columns.map((t) => /* @__PURE__ */ J("td", {
3179
3179
  className: "px-3 py-2 text-foreground",
3180
3180
  children: tn(e[t.field], t.format, i)
3181
3181
  }, t.field))
3182
- }, nn(e, t))), !g.isLoading && x.length === 0 && /* @__PURE__ */ J("tr", { children: /* @__PURE__ */ J("td", {
3183
- colSpan: Math.max(1, m.columns.length),
3182
+ }, nn(e, t))), !v.isLoading && S.length === 0 && /* @__PURE__ */ J("tr", { children: /* @__PURE__ */ J("td", {
3183
+ colSpan: Math.max(1, g.columns.length),
3184
3184
  className: "px-3 py-6 text-center text-muted-foreground",
3185
- children: A(m.empty_label, i) || "No breakdown rows."
3185
+ children: p(g.empty_label, i) || "No breakdown rows."
3186
3186
  }) })] })]
3187
3187
  })
3188
3188
  })
@@ -3193,13 +3193,13 @@ function an({ values: e, options: t }) {
3193
3193
  //#region src/components/detail-layout/widgets/builtins.ts
3194
3194
  var on = !1;
3195
3195
  function sn() {
3196
- on ||= (ae("json_diff", Qt), ae("entity_scorecard", an), !0);
3196
+ on ||= (se("json_diff", Qt), se("entity_scorecard", an), !0);
3197
3197
  }
3198
3198
  //#endregion
3199
3199
  //#region src/components/detail-layout/widgets/WidgetHost.tsx
3200
3200
  sn();
3201
3201
  function cn({ config: e, ctx: t }) {
3202
- let n = se(e.type);
3202
+ let n = ce(e.type);
3203
3203
  if (!n) return /* @__PURE__ */ J("span", {
3204
3204
  className: "text-sm text-muted-foreground",
3205
3205
  children: `unknown widget: ${e.type}`
@@ -3247,7 +3247,7 @@ function $({ node: e, ctx: t }) {
3247
3247
  }) : e.children ? /* @__PURE__ */ J(wt, {
3248
3248
  node: e,
3249
3249
  ctx: t
3250
- }) : e.associated ? /* @__PURE__ */ J(P, {
3250
+ }) : e.associated ? /* @__PURE__ */ J(M, {
3251
3251
  node: e,
3252
3252
  ctx: t
3253
3253
  }) : e.fields ? /* @__PURE__ */ J(Nt, {