@declarion/react 0.36.3 → 0.36.4

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,6 +1,6 @@
1
1
  import { s as e, t } from "./DynamicIcon-BWO6QtNF.js";
2
- import { Bn as n, C as r, D as i, E as a, En as o, G as s, Hn as c, Ln as l, Mn as u, N as d, Qt as f, S as p, Un as m, V as h, W as g, Wn as _, Z as v, _ as y, an as b, b as x, cn as S, ct as C, d as w, dn as T, et as E, gn as D, i as O, in as k, it as A, jn as j, k as M, kn as N, kt as P, lt as F, m as I, mn as ee, mt as L, n as R, nt as te, on as z, ot as B, p as ne, pt as re, r as ie, rn as V, rt as H, sn as U, tt as ae, u as oe, un as se, vn as W, w as ce, x as le, y as ue, yn as de } from "./ActionRunner-BrXXs8ga.js";
3
- import { a as fe, c as pe, d as me, f as he, i as ge, l as _e, n as ve, o as ye, p as be, r as xe, s as Se, t as Ce, u as we } from "./value-BBnVc95O.js";
2
+ import { $ as n, C as r, E as i, F as a, Gn as o, Hn as s, K as c, Kn as l, Nn as u, O as d, On as f, Pn as p, S as m, T as h, U as g, Wn as _, a as v, an as y, at as b, bn as x, cn as S, ct as C, dt as w, en as T, f as E, fn as D, g as O, gn as k, gt as A, h as j, ht as M, i as N, it as P, j as F, jn as I, jt as L, k as R, ln as z, nt as B, o as ee, on as V, ot as te, p as ne, pn as H, q as U, rt as re, sn as ie, un as W, ut as ae, vn as oe, w as se, x as ce, xn as le, y as ue, zn as de } from "./useCurrentScreen-Bgp6_vne.js";
3
+ import { a as fe, c as pe, d as me, f as he, i as ge, l as _e, n as ve, o as ye, p as be, r as xe, s as Se, t as Ce, u as we } from "./value-CUVtVjKI.js";
4
4
  import { n as Te, r as Ee, t as De } from "./dataTableStyles-vwD1mVOP.js";
5
5
  import { Component as Oe, Suspense as ke, lazy as Ae, useCallback as G, useEffect as K, useId as je, useLayoutEffect as Me, useMemo as q, useRef as J, useState as Y } from "react";
6
6
  import { parsePath as Ne, useNavigate as Pe } from "react-router-dom";
@@ -20,8 +20,8 @@ var He = {
20
20
  shadow: "none"
21
21
  }
22
22
  };
23
- function Ue({ title: t, subtitle: n, right: r, badge: i, count: a, children: o, footer: s, collapsible: l = !0, defaultOpen: u = !0, icon: d, emphasis: f = "primary", headingLevel: p = 2, padding: h = "16px" }) {
24
- let [g, _] = Y(u), v = He[f] ?? He.primary;
23
+ function Ue({ title: t, subtitle: n, right: r, badge: i, count: a, children: s, footer: c, collapsible: l = !0, defaultOpen: u = !0, icon: d, emphasis: f = "primary", headingLevel: p = 2, padding: m = "16px" }) {
24
+ let [h, g] = Y(u), v = He[f] ?? He.primary;
25
25
  return /* @__PURE__ */ Q("div", {
26
26
  "data-emphasis": f,
27
27
  style: {
@@ -39,7 +39,7 @@ function Ue({ title: t, subtitle: n, right: r, badge: i, count: a, children: o,
39
39
  alignItems: "center",
40
40
  gap: 10,
41
41
  padding: "10px 14px",
42
- borderBottom: g ? "1px solid var(--divider)" : "none",
42
+ borderBottom: h ? "1px solid var(--divider)" : "none",
43
43
  minHeight: 40
44
44
  },
45
45
  children: [
@@ -54,10 +54,10 @@ function Ue({ title: t, subtitle: n, right: r, badge: i, count: a, children: o,
54
54
  children: /* @__PURE__ */ Q("div", {
55
55
  role: l ? "button" : void 0,
56
56
  tabIndex: l ? 0 : void 0,
57
- "aria-expanded": l ? g : void 0,
58
- onClick: l ? () => _((e) => !e) : void 0,
57
+ "aria-expanded": l ? h : void 0,
58
+ onClick: l ? () => g((e) => !e) : void 0,
59
59
  onKeyDown: l ? (e) => {
60
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), _((e) => !e));
60
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), g((e) => !e));
61
61
  } : void 0,
62
62
  style: {
63
63
  display: "flex",
@@ -119,26 +119,26 @@ function Ue({ title: t, subtitle: n, right: r, badge: i, count: a, children: o,
119
119
  ]
120
120
  })
121
121
  }),
122
- i && /* @__PURE__ */ Z(c, {
122
+ i && /* @__PURE__ */ Z(_, {
123
123
  tone: i.tone ?? "violet",
124
124
  size: "xs",
125
125
  dot: i.dot,
126
126
  children: i.text
127
127
  }),
128
128
  r,
129
- l && /* @__PURE__ */ Z(m, {
129
+ l && /* @__PURE__ */ Z(o, {
130
130
  size: 24,
131
- icon: Z(g ? e.up : e.down, { size: 14 }),
132
- onClick: () => _((e) => !e),
133
- title: g ? "Collapse" : "Expand"
131
+ icon: Z(h ? e.up : e.down, { size: 14 }),
132
+ onClick: () => g((e) => !e),
133
+ title: h ? "Collapse" : "Expand"
134
134
  })
135
135
  ]
136
136
  }),
137
- g && /* @__PURE__ */ Z("div", {
138
- style: { padding: h },
139
- children: o
137
+ h && /* @__PURE__ */ Z("div", {
138
+ style: { padding: m },
139
+ children: s
140
140
  }),
141
- s && g && /* @__PURE__ */ Z("div", {
141
+ c && h && /* @__PURE__ */ Z("div", {
142
142
  style: {
143
143
  padding: "8px 14px",
144
144
  borderTop: "1px solid var(--divider)",
@@ -146,7 +146,7 @@ function Ue({ title: t, subtitle: n, right: r, badge: i, count: a, children: o,
146
146
  fontSize: 11.5,
147
147
  color: "var(--text-3)"
148
148
  },
149
- children: s
149
+ children: c
150
150
  })
151
151
  ]
152
152
  });
@@ -525,10 +525,10 @@ function Dt(e) {
525
525
  }
526
526
  //#endregion
527
527
  //#region src/components/shared/ConfirmDialog.tsx
528
- function Ot({ open: t, onOpenChange: n, title: r, description: i, confirmLabel: a = "Confirm", onConfirm: o, destructive: s = !1 }) {
529
- let c = J(null);
528
+ function Ot({ open: t, onOpenChange: n, title: r, description: i, confirmLabel: a = "Confirm", onConfirm: s, destructive: c = !1 }) {
529
+ let u = J(null);
530
530
  return K(() => {
531
- t && c.current?.focus();
531
+ t && u.current?.focus();
532
532
  }, [t]), t ? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("div", {
533
533
  onClick: () => n(!1),
534
534
  style: {
@@ -539,7 +539,7 @@ function Ot({ open: t, onOpenChange: n, title: r, description: i, confirmLabel:
539
539
  backdropFilter: "blur(2px)"
540
540
  }
541
541
  }), /* @__PURE__ */ Q("div", {
542
- ref: c,
542
+ ref: u,
543
543
  role: "dialog",
544
544
  "aria-modal": "true",
545
545
  "aria-label": r,
@@ -580,14 +580,14 @@ function Ot({ open: t, onOpenChange: n, title: r, description: i, confirmLabel:
580
580
  width: 28,
581
581
  height: 28,
582
582
  borderRadius: 7,
583
- background: s ? "var(--danger-soft)" : "var(--accent-soft)",
584
- color: s ? "var(--danger)" : "var(--accent)",
583
+ background: c ? "var(--danger-soft)" : "var(--accent-soft)",
584
+ color: c ? "var(--danger)" : "var(--accent)",
585
585
  display: "inline-flex",
586
586
  alignItems: "center",
587
587
  justifyContent: "center",
588
588
  flexShrink: 0
589
589
  },
590
- children: Z(s ? e.trash : e.info, { size: 15 })
590
+ children: Z(c ? e.trash : e.info, { size: 15 })
591
591
  }),
592
592
  /* @__PURE__ */ Q("div", {
593
593
  style: {
@@ -610,7 +610,7 @@ function Ot({ open: t, onOpenChange: n, title: r, description: i, confirmLabel:
610
610
  children: i
611
611
  })]
612
612
  }),
613
- /* @__PURE__ */ Z(m, {
613
+ /* @__PURE__ */ Z(o, {
614
614
  icon: /* @__PURE__ */ Z(e.x, { size: 14 }),
615
615
  onClick: () => n(!1)
616
616
  })
@@ -629,15 +629,15 @@ function Ot({ open: t, onOpenChange: n, title: r, description: i, confirmLabel:
629
629
  },
630
630
  children: [
631
631
  /* @__PURE__ */ Z("div", { style: { flex: 1 } }),
632
- /* @__PURE__ */ Z(_, {
632
+ /* @__PURE__ */ Z(l, {
633
633
  onClick: () => n(!1),
634
634
  children: "Cancel"
635
635
  }),
636
- /* @__PURE__ */ Z(_, {
636
+ /* @__PURE__ */ Z(l, {
637
637
  kind: "primary",
638
- danger: s,
638
+ danger: c,
639
639
  onClick: () => {
640
- o(), n(!1);
640
+ s(), n(!1);
641
641
  },
642
642
  children: a
643
643
  })
@@ -701,11 +701,11 @@ function Ft(e) {
701
701
  if (!(!e || e === "?")) return e.startsWith("?") ? e : `?${e}`;
702
702
  }
703
703
  function It() {
704
- let e = Pe(), { data: t } = L(), n = v(), r = s();
705
- return G((i, a) => {
706
- let { pathname: o, search: s, hash: c } = Pt(i, a?.search);
707
- if (n.enabled) {
708
- r(`${o}${s ?? ""}${c ?? ""}`, { replace: a?.replace });
704
+ let e = Pe(), { data: t } = A(), r = n(), i = U();
705
+ return G((n, a) => {
706
+ let { pathname: o, search: s, hash: c } = Pt(n, a?.search);
707
+ if (r.enabled) {
708
+ i(`${o}${s ?? ""}${c ?? ""}`, { replace: a?.replace });
709
709
  return;
710
710
  }
711
711
  let l = wt.getState(), u = a?.topLevel ?? !1, d = kt(s), f = u || typeof window > "u" ? void 0 : jt({
@@ -727,7 +727,7 @@ function It() {
727
727
  }, { replace: a?.replace });
728
728
  return;
729
729
  }
730
- let m = a?.title ? void 0 : D(o, t?.screens, t?.entities), h = a?.title ?? m?.title ?? o, g = a?.icon ?? m?.icon;
730
+ let m = a?.title ? void 0 : oe(o, t?.screens, t?.entities), h = a?.title ?? m?.title ?? o, g = a?.icon ?? m?.icon;
731
731
  l.openTab({
732
732
  pathname: o,
733
733
  search: d,
@@ -744,8 +744,8 @@ function It() {
744
744
  e,
745
745
  t?.screens,
746
746
  t?.entities,
747
- n.enabled,
748
- r
747
+ r.enabled,
748
+ i
749
749
  ]);
750
750
  }
751
751
  //#endregion
@@ -782,57 +782,57 @@ function Kt(e) {
782
782
  return t.length === 0 ? "?" : t.length === 1 ? t[0].slice(0, 2).toUpperCase() : (t[0][0] + t[1][0]).toUpperCase();
783
783
  }
784
784
  function qt(e) {
785
- let { field: t, fieldName: n, value: i, onChange: a, mode: o, alt: s, disabled: c, visual: l, uploadFieldCode: u, uploadSlotCode: d } = e, f = ve(i), [m, h] = Y("idle"), [g, _] = Y(null), [v, b] = Y(null), [S, C] = Y(null), [w, T] = Y(!1), E = J(null), D = J(!1), O = J(null), { register: k, unregister: A, isDraft: j } = y();
785
+ let { field: t, fieldName: n, value: r, onChange: i, mode: a, alt: o, disabled: s, visual: c, uploadFieldCode: l, uploadSlotCode: u } = e, d = ve(r), [f, p] = Y("idle"), [g, _] = Y(null), [v, y] = Y(null), [b, x] = Y(null), [S, C] = Y(!1), w = J(null), T = J(!1), E = J(null), { register: D, unregister: O, isDraft: k } = ue();
786
786
  K(() => () => {
787
- E.current && E.current.abort();
787
+ w.current && w.current.abort();
788
788
  }, []);
789
- let M = q(() => he(f, s, t.display?.placeholder || n), [
790
- s,
789
+ let A = q(() => he(d, o, t.display?.placeholder || n), [
790
+ o,
791
791
  t.display?.placeholder,
792
792
  n,
793
- f
794
- ]), N = (t.accepts ?? ["image/*"]).join(","), P = G(async (i) => {
795
- let o = r(i, t.accepts, t.max_size_bytes);
796
- if (o) {
797
- b(o), h("error");
793
+ d
794
+ ]), j = (t.accepts ?? ["image/*"]).join(","), M = G(async (r) => {
795
+ let a = h(r, t.accepts, t.max_size_bytes);
796
+ if (a) {
797
+ y(a), p("error");
798
798
  return;
799
799
  }
800
- let s = i;
800
+ let o = r;
801
801
  if (t.display?.crop_on_upload) try {
802
802
  let { blob: e, filename: n } = await Wt()({
803
- file: i,
803
+ file: r,
804
804
  aspectRatio: Zt(t.display.aspect_ratio)
805
805
  });
806
- s = new File([e], n, { type: e.type || i.type });
806
+ o = new File([e], n, { type: e.type || r.type });
807
807
  } catch (e) {
808
- b({
808
+ y({
809
809
  code: "CROP_FAILED",
810
810
  message: e instanceof Error ? e.message : "Crop failed"
811
- }), h("error");
811
+ }), p("error");
812
812
  return;
813
813
  }
814
- b(null), D.current = !1, h("uploading"), _({
814
+ y(null), T.current = !1, p("uploading"), _({
815
815
  loaded: 0,
816
- total: s.size,
816
+ total: o.size,
817
817
  pct: 0
818
818
  });
819
- let c = new AbortController();
820
- E.current = c;
819
+ let s = new AbortController();
820
+ w.current = s;
821
821
  try {
822
- let r = await p({
823
- file: s,
822
+ let r = await se({
823
+ file: o,
824
824
  entityCode: e.entityCode,
825
- fieldCode: u ?? n,
826
- slotCode: d,
827
- signal: c.signal,
825
+ fieldCode: l ?? n,
826
+ slotCode: u,
827
+ signal: s.signal,
828
828
  onProgress: _
829
829
  });
830
- if (D.current) {
831
- x(r.id).catch(() => {}), A(r.id);
830
+ if (T.current) {
831
+ m(r.id).catch(() => {}), O(r.id);
832
832
  return;
833
833
  }
834
- f && j(f.id) && (x(f.id).catch(() => {}), A(f.id)), k(r.id, () => x(r.id)), C(r.id), h("idle"), _(null);
835
- let i = {
834
+ d && k(d.id) && (m(d.id).catch(() => {}), O(d.id)), D(r.id, () => m(r.id)), x(r.id), p("idle"), _(null);
835
+ let a = {
836
836
  id: r.id,
837
837
  filename: r.filename,
838
838
  content_type: r.content_type,
@@ -843,17 +843,17 @@ function qt(e) {
843
843
  url: r.url,
844
844
  metadata: r.metadata
845
845
  };
846
- a?.(t.mode === "array" ? [i] : i);
846
+ i?.(t.mode === "array" ? [a] : a);
847
847
  } catch (e) {
848
- if (e instanceof ue && e.code === "ABORTED") return;
849
- let t = e instanceof ue ? {
848
+ if (e instanceof ce && e.code === "ABORTED") return;
849
+ let t = e instanceof ce ? {
850
850
  code: e.code,
851
851
  message: e.message
852
852
  } : {
853
853
  code: "UNKNOWN",
854
854
  message: e instanceof Error ? e.message : "Upload failed"
855
855
  };
856
- b(t), h("error"), _(null);
856
+ y(t), p("error"), _(null);
857
857
  }
858
858
  }, [
859
859
  t.accepts,
@@ -862,133 +862,133 @@ function qt(e) {
862
862
  t.display?.aspect_ratio,
863
863
  t.mode,
864
864
  n,
865
- a,
865
+ i,
866
866
  e.entityCode,
867
+ D,
867
868
  k,
868
- j,
869
- f,
870
- A,
871
- u,
872
- d
873
- ]), F = G(() => {
874
- m === "uploading" && E.current && (D.current = !0, E.current.abort(), E.current = null, h("idle"), _(null)), S && (x(S).catch(() => {}), A(S), C(null));
875
- }, [
876
- m,
877
- S,
878
- A
879
- ]), I = G(() => {
880
- f && j(f.id) && (x(f.id).catch(() => {}), A(f.id), C(null)), a?.(t.mode === "array" ? [] : null);
869
+ d,
870
+ O,
871
+ l,
872
+ u
873
+ ]), N = G(() => {
874
+ f === "uploading" && w.current && (T.current = !0, w.current.abort(), w.current = null, p("idle"), _(null)), b && (m(b).catch(() => {}), O(b), x(null));
881
875
  }, [
882
876
  f,
877
+ b,
878
+ O
879
+ ]), P = G(() => {
880
+ d && k(d.id) && (m(d.id).catch(() => {}), O(d.id), x(null)), i?.(t.mode === "array" ? [] : null);
881
+ }, [
882
+ d,
883
883
  t.mode,
884
- j,
885
- a,
886
- A
887
- ]), ee = G(() => {
888
- b(null), h("idle"), O.current?.click();
889
- }, []), L = G(() => {
890
- c || O.current?.click();
891
- }, [c]), R = G((e) => {
892
- c || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), L());
893
- }, [c, L]), te = G((e) => {
894
- c || (e.preventDefault(), e.dataTransfer.dropEffect = "copy");
895
- }, [c]), z = G((e) => {
896
- if (c) return;
884
+ k,
885
+ i,
886
+ O
887
+ ]), F = G(() => {
888
+ y(null), p("idle"), E.current?.click();
889
+ }, []), I = G(() => {
890
+ s || E.current?.click();
891
+ }, [s]), L = G((e) => {
892
+ s || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), I());
893
+ }, [s, I]), R = G((e) => {
894
+ s || (e.preventDefault(), e.dataTransfer.dropEffect = "copy");
895
+ }, [s]), z = G((e) => {
896
+ if (s) return;
897
897
  e.preventDefault();
898
898
  let t = e.dataTransfer.files?.[0];
899
- t && P(t);
900
- }, [c, P]), B = G((e) => {
899
+ t && M(t);
900
+ }, [s, M]), B = G((e) => {
901
901
  let t = e.target.files?.[0];
902
- e.target.value = "", t && P(t);
903
- }, [P]), ne = l.aspectRatio ?? Xt(l.shape, t.display?.aspect_ratio), re = me(f), ie = {
904
- aspectRatio: ne,
905
- width: l.width ?? (l.shape === "wide" ? "100%" : "120px")
906
- }, V = !!f, H = Gt(f, t.display?.listable_thumbnail), U = _e(f, t.display?.listable_thumbnail), ae = ge(f?.id, U, H), oe = o === "display", se = G((e) => {
907
- e.stopPropagation(), T((e) => !e);
908
- }, []), W = G((e) => {
909
- if (!f || !w) return;
910
- let n = e.currentTarget.getBoundingClientRect(), r = n.width > 0 ? (e.clientX - n.left) / n.width : .5, i = n.height > 0 ? (e.clientY - n.top) / n.height : .5, o = be(f, {
902
+ e.target.value = "", t && M(t);
903
+ }, [M]), ee = c.aspectRatio ?? Xt(c.shape, t.display?.aspect_ratio), V = me(d), te = {
904
+ aspectRatio: ee,
905
+ width: c.width ?? (c.shape === "wide" ? "100%" : "120px")
906
+ }, ne = !!d, H = Gt(d, t.display?.listable_thumbnail), U = _e(d, t.display?.listable_thumbnail), re = ge(d?.id, U, H), ie = a === "display", W = G((e) => {
907
+ e.stopPropagation(), C((e) => !e);
908
+ }, []), ae = G((e) => {
909
+ if (!d || !S) return;
910
+ let n = e.currentTarget.getBoundingClientRect(), r = n.width > 0 ? (e.clientX - n.left) / n.width : .5, a = n.height > 0 ? (e.clientY - n.top) / n.height : .5, o = be(d, {
911
911
  x: Math.max(0, Math.min(1, r)),
912
- y: Math.max(0, Math.min(1, i))
912
+ y: Math.max(0, Math.min(1, a))
913
913
  });
914
- a?.(t.mode === "array" ? [o] : o), T(!1);
914
+ i?.(t.mode === "array" ? [o] : o), C(!1);
915
915
  }, [
916
916
  t.mode,
917
- f,
918
- w,
919
- a
917
+ d,
918
+ S,
919
+ i
920
920
  ]);
921
- return oe ? /* @__PURE__ */ Z("div", {
922
- className: Jt(l.shape, !1),
923
- style: ie,
924
- "aria-label": M,
925
- children: V && ae ? /* @__PURE__ */ Z("img", {
926
- src: ae,
927
- alt: M,
928
- className: Yt(l.shape),
929
- style: { objectPosition: Se(re) },
921
+ return ie ? /* @__PURE__ */ Z("div", {
922
+ className: Jt(c.shape, !1),
923
+ style: te,
924
+ "aria-label": A,
925
+ children: ne && re ? /* @__PURE__ */ Z("img", {
926
+ src: re,
927
+ alt: A,
928
+ className: Yt(c.shape),
929
+ style: { objectPosition: Se(V) },
930
930
  loading: "lazy"
931
931
  }) : /* @__PURE__ */ Z(Qt, {
932
- shape: l.shape,
933
- label: M,
932
+ shape: c.shape,
933
+ label: A,
934
934
  placeholder: t.display?.placeholder
935
935
  })
936
936
  }) : /* @__PURE__ */ Q("div", {
937
- className: Jt(l.shape, !c),
938
- style: ie,
939
- tabIndex: c ? -1 : 0,
937
+ className: Jt(c.shape, !s),
938
+ style: te,
939
+ tabIndex: s ? -1 : 0,
940
940
  role: "button",
941
- "aria-label": M,
942
- "aria-disabled": c || void 0,
943
- "aria-busy": m === "uploading" || void 0,
944
- "aria-invalid": m === "error" || void 0,
945
- onClick: m === "idle" && !V ? L : void 0,
946
- onMouseDown: w ? W : void 0,
947
- onKeyDown: R,
948
- onDragOver: te,
941
+ "aria-label": A,
942
+ "aria-disabled": s || void 0,
943
+ "aria-busy": f === "uploading" || void 0,
944
+ "aria-invalid": f === "error" || void 0,
945
+ onClick: f === "idle" && !ne ? I : void 0,
946
+ onMouseDown: S ? ae : void 0,
947
+ onKeyDown: L,
948
+ onDragOver: R,
949
949
  onDrop: z,
950
- "data-testid": w ? "focal-point-target" : `file-widget-${n}`,
950
+ "data-testid": S ? "focal-point-target" : `file-widget-${n}`,
951
951
  children: [
952
952
  /* @__PURE__ */ Z("input", {
953
- ref: O,
953
+ ref: E,
954
954
  type: "file",
955
- accept: N,
955
+ accept: j,
956
956
  onChange: B,
957
957
  style: { display: "none" },
958
958
  "data-testid": `file-input-${n}`
959
959
  }),
960
- V && ae ? /* @__PURE__ */ Z("img", {
961
- src: ae,
962
- alt: M,
963
- className: Yt(l.shape),
964
- style: { objectPosition: Se(re) },
960
+ ne && re ? /* @__PURE__ */ Z("img", {
961
+ src: re,
962
+ alt: A,
963
+ className: Yt(c.shape),
964
+ style: { objectPosition: Se(V) },
965
965
  loading: "lazy"
966
- }) : m === "uploading" ? null : /* @__PURE__ */ Z(Qt, {
967
- shape: l.shape,
968
- label: M,
966
+ }) : f === "uploading" ? null : /* @__PURE__ */ Z(Qt, {
967
+ shape: c.shape,
968
+ label: A,
969
969
  placeholder: t.display?.placeholder
970
970
  }),
971
- m === "uploading" && /* @__PURE__ */ Z($t, { pct: g?.pct ?? 0 }),
972
- S && /* @__PURE__ */ Z("span", {
971
+ f === "uploading" && /* @__PURE__ */ Z($t, { pct: g?.pct ?? 0 }),
972
+ b && /* @__PURE__ */ Z("span", {
973
973
  className: "absolute right-1 top-1 h-2 w-2 rounded-full bg-warning",
974
974
  "aria-hidden": "true",
975
975
  "data-testid": "draft-indicator"
976
976
  }),
977
- V && m === "idle" && !c && /* @__PURE__ */ Q("div", {
977
+ ne && f === "idle" && !s && /* @__PURE__ */ Q("div", {
978
978
  className: "absolute inset-0 flex items-center justify-center gap-2 bg-black/40 opacity-0 transition-opacity hover:opacity-100 focus-within:opacity-100",
979
979
  children: [
980
980
  t.display?.focal_point && /* @__PURE__ */ Z("button", {
981
981
  type: "button",
982
982
  className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
983
- onClick: se,
983
+ onClick: W,
984
984
  "data-testid": "focal-point-toggle",
985
- children: w ? "Cancel focus" : "Set focus"
985
+ children: S ? "Cancel focus" : "Set focus"
986
986
  }),
987
987
  /* @__PURE__ */ Z("button", {
988
988
  type: "button",
989
989
  className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
990
990
  onClick: (e) => {
991
- e.stopPropagation(), L();
991
+ e.stopPropagation(), I();
992
992
  },
993
993
  children: "Change"
994
994
  }),
@@ -996,30 +996,30 @@ function qt(e) {
996
996
  type: "button",
997
997
  className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-destructive hover:bg-surface-2",
998
998
  onClick: (e) => {
999
- e.stopPropagation(), I();
999
+ e.stopPropagation(), P();
1000
1000
  },
1001
1001
  children: "Remove"
1002
1002
  })
1003
1003
  ]
1004
1004
  }),
1005
- re && V && /* @__PURE__ */ Z("span", {
1005
+ V && ne && /* @__PURE__ */ Z("span", {
1006
1006
  className: "absolute h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full border border-white bg-black/70",
1007
1007
  style: {
1008
- left: `${re.x * 100}%`,
1009
- top: `${re.y * 100}%`
1008
+ left: `${V.x * 100}%`,
1009
+ top: `${V.y * 100}%`
1010
1010
  },
1011
1011
  "data-testid": "focal-point-marker"
1012
1012
  }),
1013
- m === "uploading" && /* @__PURE__ */ Z("button", {
1013
+ f === "uploading" && /* @__PURE__ */ Z("button", {
1014
1014
  type: "button",
1015
1015
  className: "absolute bottom-1 right-1 rounded-sm border border-border bg-card px-2 py-0.5 text-xs",
1016
1016
  onClick: (e) => {
1017
- e.stopPropagation(), F();
1017
+ e.stopPropagation(), N();
1018
1018
  },
1019
1019
  "data-testid": "cancel-upload",
1020
1020
  children: "Cancel"
1021
1021
  }),
1022
- m === "error" && v && /* @__PURE__ */ Q("div", {
1022
+ f === "error" && v && /* @__PURE__ */ Q("div", {
1023
1023
  className: "absolute inset-x-0 bottom-0 flex items-center justify-between gap-2 bg-destructive-soft px-2 py-1 text-xs text-destructive",
1024
1024
  role: "alert",
1025
1025
  children: [/* @__PURE__ */ Z("span", {
@@ -1030,7 +1030,7 @@ function qt(e) {
1030
1030
  type: "button",
1031
1031
  className: "underline",
1032
1032
  onClick: (e) => {
1033
- e.stopPropagation(), ee();
1033
+ e.stopPropagation(), F();
1034
1034
  },
1035
1035
  "data-testid": "retry-upload",
1036
1036
  children: "Retry"
@@ -1142,7 +1142,7 @@ function nn(e) {
1142
1142
  }
1143
1143
  //#endregion
1144
1144
  //#region src/components/file-widgets/GridLazy.tsx
1145
- var rn = Ae(() => import("./Grid-DT9wV-D7.js").then((e) => ({ default: e.Grid })));
1145
+ var rn = Ae(() => import("./Grid-D0ckegd1.js").then((e) => ({ default: e.Grid })));
1146
1146
  function an() {
1147
1147
  return /* @__PURE__ */ Z("div", { className: "h-24 w-full rounded-md bg-muted animate-pulse" });
1148
1148
  }
@@ -1161,61 +1161,61 @@ function sn({ contentType: e }) {
1161
1161
  });
1162
1162
  }
1163
1163
  function cn(e) {
1164
- let { field: t, fieldName: n, value: i, onChange: a, mode: o, disabled: s, uploadFieldCode: c, uploadSlotCode: l } = e, u = ve(i), [d, f] = Y("idle"), [m, h] = Y(null), [g, _] = Y(null), [v, b] = Y(!1), [S, C] = Y(u?.filename ?? ""), w = J(null), T = J(!1), E = J(null), { register: D, unregister: O, isDraft: k } = y(), { open: A } = xe();
1164
+ let { field: t, fieldName: n, value: i, onChange: a, mode: o, disabled: s, uploadFieldCode: c, uploadSlotCode: l } = e, u = ve(i), [d, f] = Y("idle"), [p, g] = Y(null), [_, v] = Y(null), [y, b] = Y(!1), [x, S] = Y(u?.filename ?? ""), C = J(null), w = J(!1), T = J(null), { register: E, unregister: D, isDraft: O } = ue(), { open: k } = xe();
1165
1165
  K(() => () => {
1166
- w.current && w.current.abort();
1166
+ C.current && C.current.abort();
1167
1167
  }, []), K(() => {
1168
- C(u?.filename ?? "");
1168
+ S(u?.filename ?? "");
1169
1169
  }, [u?.filename]);
1170
- let j = (t.accepts ?? []).join(","), M = G(async (i) => {
1171
- let o = r(i, t.accepts, t.max_size_bytes);
1172
- if (o) {
1173
- _(o), f("error");
1170
+ let A = (t.accepts ?? []).join(","), j = G(async (r) => {
1171
+ let i = h(r, t.accepts, t.max_size_bytes);
1172
+ if (i) {
1173
+ v(i), f("error");
1174
1174
  return;
1175
1175
  }
1176
- _(null), T.current = !1, f("uploading"), h({
1176
+ v(null), w.current = !1, f("uploading"), g({
1177
1177
  loaded: 0,
1178
- total: i.size,
1178
+ total: r.size,
1179
1179
  pct: 0
1180
1180
  });
1181
- let s = new AbortController();
1182
- w.current = s;
1181
+ let o = new AbortController();
1182
+ C.current = o;
1183
1183
  try {
1184
- let r = await p({
1185
- file: i,
1184
+ let i = await se({
1185
+ file: r,
1186
1186
  entityCode: e.entityCode,
1187
1187
  fieldCode: c ?? n,
1188
1188
  slotCode: l,
1189
- signal: s.signal,
1190
- onProgress: h
1189
+ signal: o.signal,
1190
+ onProgress: g
1191
1191
  });
1192
- if (T.current) {
1193
- x(r.id).catch(() => {}), O(r.id);
1192
+ if (w.current) {
1193
+ m(i.id).catch(() => {}), D(i.id);
1194
1194
  return;
1195
1195
  }
1196
- u && k(u.id) && (x(u.id).catch(() => {}), O(u.id)), D(r.id, () => x(r.id)), f("idle"), h(null);
1197
- let o = {
1198
- id: r.id,
1199
- filename: r.filename,
1200
- content_type: r.content_type,
1201
- size_bytes: r.size_bytes,
1202
- sha256: r.sha256,
1203
- width: r.width,
1204
- height: r.height,
1205
- url: r.url,
1206
- metadata: r.metadata
1196
+ u && O(u.id) && (m(u.id).catch(() => {}), D(u.id)), E(i.id, () => m(i.id)), f("idle"), g(null);
1197
+ let s = {
1198
+ id: i.id,
1199
+ filename: i.filename,
1200
+ content_type: i.content_type,
1201
+ size_bytes: i.size_bytes,
1202
+ sha256: i.sha256,
1203
+ width: i.width,
1204
+ height: i.height,
1205
+ url: i.url,
1206
+ metadata: i.metadata
1207
1207
  };
1208
- a?.(t.mode === "array" ? [o] : o);
1208
+ a?.(t.mode === "array" ? [s] : s);
1209
1209
  } catch (e) {
1210
- if (e instanceof ue && e.code === "ABORTED") return;
1211
- let t = e instanceof ue ? {
1210
+ if (e instanceof ce && e.code === "ABORTED") return;
1211
+ let t = e instanceof ce ? {
1212
1212
  code: e.code,
1213
1213
  message: e.message
1214
1214
  } : {
1215
1215
  code: "UNKNOWN",
1216
1216
  message: e instanceof Error ? e.message : "Upload failed"
1217
1217
  };
1218
- _(t), f("error"), h(null);
1218
+ v(t), f("error"), g(null);
1219
1219
  }
1220
1220
  }, [
1221
1221
  t.accepts,
@@ -1223,40 +1223,40 @@ function cn(e) {
1223
1223
  t.mode,
1224
1224
  n,
1225
1225
  u,
1226
- k,
1226
+ O,
1227
1227
  a,
1228
1228
  e.entityCode,
1229
+ E,
1229
1230
  D,
1230
- O,
1231
1231
  c,
1232
1232
  l
1233
- ]), N = G(() => {
1234
- s || E.current?.click();
1235
- }, [s]), P = G((e) => {
1233
+ ]), M = G(() => {
1234
+ s || T.current?.click();
1235
+ }, [s]), N = G((e) => {
1236
1236
  let t = e.target.files?.[0];
1237
- e.target.value = "", t && M(t);
1238
- }, [M]), F = G(() => {
1239
- u && k(u.id) && (x(u.id).catch(() => {}), O(u.id)), a?.(t.mode === "array" ? [] : null);
1237
+ e.target.value = "", t && j(t);
1238
+ }, [j]), P = G(() => {
1239
+ u && O(u.id) && (m(u.id).catch(() => {}), D(u.id)), a?.(t.mode === "array" ? [] : null);
1240
1240
  }, [
1241
1241
  u,
1242
1242
  t.mode,
1243
- k,
1243
+ O,
1244
1244
  a,
1245
- O
1246
- ]), I = G(() => {
1247
- d === "uploading" && w.current && (T.current = !0, w.current.abort(), w.current = null, f("idle"), h(null));
1248
- }, [d]), ee = G(() => {
1249
- u && A(u.id, "download", ye(u));
1250
- }, [u, A]), L = u ? fe(u) : !1, R = G(() => {
1251
- !u || !fe(u) || A(u.id, "preview", we(u));
1252
- }, [u, A]), te = G(() => {
1245
+ D
1246
+ ]), F = G(() => {
1247
+ d === "uploading" && C.current && (w.current = !0, C.current.abort(), C.current = null, f("idle"), g(null));
1248
+ }, [d]), I = G(() => {
1249
+ u && k(u.id, "download", ye(u));
1250
+ }, [u, k]), L = u ? fe(u) : !1, R = G(() => {
1251
+ !u || !fe(u) || k(u.id, "preview", we(u));
1252
+ }, [u, k]), z = G(() => {
1253
1253
  if (!u) {
1254
1254
  b(!1);
1255
1255
  return;
1256
1256
  }
1257
- let e = S.trim();
1257
+ let e = x.trim();
1258
1258
  if (b(!1), !e || e === u.filename) {
1259
- C(u.filename);
1259
+ S(u.filename);
1260
1260
  return;
1261
1261
  }
1262
1262
  let n = {
@@ -1265,11 +1265,11 @@ function cn(e) {
1265
1265
  };
1266
1266
  a?.(t.mode === "array" ? [n] : n);
1267
1267
  }, [
1268
- S,
1268
+ x,
1269
1269
  u,
1270
1270
  a,
1271
1271
  t.mode
1272
- ]), z = o === "display";
1272
+ ]), B = o === "display";
1273
1273
  return !u && d !== "uploading" ? /* @__PURE__ */ Q("div", {
1274
1274
  "data-testid": `file-widget-${n}`,
1275
1275
  className: "flex items-center gap-3 rounded-md border border-dashed border-border bg-surface p-3",
@@ -1280,27 +1280,27 @@ function cn(e) {
1280
1280
  children: [/* @__PURE__ */ Z("span", {
1281
1281
  className: "text-sm text-foreground",
1282
1282
  children: t.display?.placeholder || "No document attached"
1283
- }), !z && /* @__PURE__ */ Z("button", {
1283
+ }), !B && /* @__PURE__ */ Z("button", {
1284
1284
  type: "button",
1285
1285
  className: "self-start rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
1286
- onClick: N,
1286
+ onClick: M,
1287
1287
  disabled: s,
1288
1288
  "data-testid": "upload",
1289
1289
  children: "Upload"
1290
1290
  })]
1291
1291
  }),
1292
- !z && /* @__PURE__ */ Z("input", {
1293
- ref: E,
1292
+ !B && /* @__PURE__ */ Z("input", {
1293
+ ref: T,
1294
1294
  type: "file",
1295
- accept: j || void 0,
1296
- onChange: P,
1295
+ accept: A || void 0,
1296
+ onChange: N,
1297
1297
  style: { display: "none" },
1298
1298
  "data-testid": `file-input-${n}`
1299
1299
  }),
1300
- d === "error" && g && /* @__PURE__ */ Z("div", {
1300
+ d === "error" && _ && /* @__PURE__ */ Z("div", {
1301
1301
  className: "ml-auto text-xs text-destructive",
1302
1302
  role: "alert",
1303
- children: g.message
1303
+ children: _.message
1304
1304
  })
1305
1305
  ]
1306
1306
  }) : /* @__PURE__ */ Q("div", {
@@ -1313,22 +1313,22 @@ function cn(e) {
1313
1313
  /* @__PURE__ */ Q("div", {
1314
1314
  className: "flex min-w-0 flex-1 flex-col gap-1",
1315
1315
  children: [
1316
- v && u ? /* @__PURE__ */ Z("input", {
1316
+ y && u ? /* @__PURE__ */ Z("input", {
1317
1317
  type: "text",
1318
1318
  className: "rounded-sm border border-border bg-card px-1 py-0.5 text-sm text-foreground",
1319
- value: S,
1319
+ value: x,
1320
1320
  autoFocus: !0,
1321
- onChange: (e) => C(e.target.value),
1322
- onBlur: te,
1321
+ onChange: (e) => S(e.target.value),
1322
+ onBlur: z,
1323
1323
  onKeyDown: (e) => {
1324
- e.key === "Enter" ? te() : e.key === "Escape" && (b(!1), C(u.filename));
1324
+ e.key === "Enter" ? z() : e.key === "Escape" && (b(!1), S(u.filename));
1325
1325
  },
1326
1326
  "data-testid": "filename-input"
1327
1327
  }) : /* @__PURE__ */ Z("button", {
1328
1328
  type: "button",
1329
1329
  className: "truncate text-left text-sm font-medium text-foreground hover:underline",
1330
- onClick: () => !z && u && b(!0),
1331
- disabled: z || s || !u,
1330
+ onClick: () => !B && u && b(!0),
1331
+ disabled: B || s || !u,
1332
1332
  title: u?.filename,
1333
1333
  "data-testid": "filename",
1334
1334
  children: u?.filename ?? "Uploading…"
@@ -1336,7 +1336,7 @@ function cn(e) {
1336
1336
  /* @__PURE__ */ Q("div", {
1337
1337
  className: "flex flex-wrap gap-2 text-xs text-muted-foreground",
1338
1338
  children: [
1339
- u && /* @__PURE__ */ Z("span", { children: le(u.size_bytes) }),
1339
+ u && /* @__PURE__ */ Z("span", { children: r(u.size_bytes) }),
1340
1340
  u?.page_count != null && /* @__PURE__ */ Q("span", { children: [u.page_count, " pages"] }),
1341
1341
  u?.uploaded_at && /* @__PURE__ */ Z("span", { children: ln(u.uploaded_at) }),
1342
1342
  u?.uploaded_by && /* @__PURE__ */ Q("span", { children: ["by ", u.uploaded_by] }),
@@ -1349,20 +1349,20 @@ function cn(e) {
1349
1349
  d === "uploading" && /* @__PURE__ */ Q("div", {
1350
1350
  className: "text-xs text-muted-foreground",
1351
1351
  role: "progressbar",
1352
- "aria-valuenow": m?.pct ?? 0,
1352
+ "aria-valuenow": p?.pct ?? 0,
1353
1353
  "aria-valuemin": 0,
1354
1354
  "aria-valuemax": 100,
1355
1355
  "data-testid": "upload-progress",
1356
1356
  children: [
1357
1357
  "Uploading ",
1358
- m?.pct ?? 0,
1358
+ p?.pct ?? 0,
1359
1359
  "%"
1360
1360
  ]
1361
1361
  }),
1362
- d === "error" && g && /* @__PURE__ */ Z("div", {
1362
+ d === "error" && _ && /* @__PURE__ */ Z("div", {
1363
1363
  className: "text-xs text-destructive",
1364
1364
  role: "alert",
1365
- children: g.message
1365
+ children: _.message
1366
1366
  })
1367
1367
  ]
1368
1368
  }),
@@ -1372,7 +1372,7 @@ function cn(e) {
1372
1372
  /* @__PURE__ */ Z("button", {
1373
1373
  type: "button",
1374
1374
  className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
1375
- onClick: ee,
1375
+ onClick: I,
1376
1376
  "data-testid": "download",
1377
1377
  children: "Download"
1378
1378
  }),
@@ -1385,17 +1385,17 @@ function cn(e) {
1385
1385
  "data-testid": "preview",
1386
1386
  children: "Preview"
1387
1387
  }),
1388
- !z && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("button", {
1388
+ !B && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("button", {
1389
1389
  type: "button",
1390
1390
  className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
1391
- onClick: N,
1391
+ onClick: M,
1392
1392
  disabled: s,
1393
1393
  "data-testid": "replace",
1394
1394
  children: "Replace"
1395
1395
  }), /* @__PURE__ */ Z("button", {
1396
1396
  type: "button",
1397
1397
  className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-destructive hover:bg-surface-2",
1398
- onClick: F,
1398
+ onClick: P,
1399
1399
  disabled: s,
1400
1400
  "data-testid": "remove",
1401
1401
  children: "Remove"
@@ -1403,16 +1403,16 @@ function cn(e) {
1403
1403
  ] }), d === "uploading" && /* @__PURE__ */ Z("button", {
1404
1404
  type: "button",
1405
1405
  className: "rounded-sm border border-border bg-card px-2 py-1 text-xs",
1406
- onClick: I,
1406
+ onClick: F,
1407
1407
  "data-testid": "cancel-upload",
1408
1408
  children: "Cancel"
1409
1409
  })]
1410
1410
  }),
1411
- !z && /* @__PURE__ */ Z("input", {
1412
- ref: E,
1411
+ !B && /* @__PURE__ */ Z("input", {
1412
+ ref: T,
1413
1413
  type: "file",
1414
- accept: j || void 0,
1415
- onChange: P,
1414
+ accept: A || void 0,
1415
+ onChange: N,
1416
1416
  style: { display: "none" },
1417
1417
  "data-testid": `file-input-${n}`
1418
1418
  })
@@ -1429,54 +1429,54 @@ function un(e) {
1429
1429
  return e ? (e.split("/")[1] ?? e).toUpperCase().slice(0, 6) : "";
1430
1430
  }
1431
1431
  function dn(e) {
1432
- let { field: t, fieldName: n, value: i, onChange: a, mode: o, disabled: s } = e, c = Ce(i), [l, u] = Y([]), { register: d, unregister: f, isDraft: m } = y(), h = J(c);
1433
- h.current = c;
1434
- let g = J(null), _ = J(/* @__PURE__ */ new Set()), v = J([]);
1435
- v.current = l;
1432
+ let { field: t, fieldName: n, value: i, onChange: a, mode: o, disabled: s } = e, c = Ce(i), [l, u] = Y([]), { register: d, unregister: f, isDraft: p } = ue(), g = J(c);
1433
+ g.current = c;
1434
+ let _ = J(null), v = J(/* @__PURE__ */ new Set()), y = J([]);
1435
+ y.current = l;
1436
1436
  let { open: b } = xe();
1437
1437
  K(() => () => {
1438
- v.current.forEach((e) => e.abort());
1438
+ y.current.forEach((e) => e.abort());
1439
1439
  }, []);
1440
- let S = (t.accepts ?? []).join(","), C = o === "display", w = G(async (i) => {
1441
- let o = r(i, t.accepts, t.max_size_bytes), s = `row-${Math.random().toString(36).slice(2)}-${Date.now()}`, c = new AbortController();
1442
- if (o) {
1440
+ let x = (t.accepts ?? []).join(","), S = o === "display", C = G(async (r) => {
1441
+ let i = h(r, t.accepts, t.max_size_bytes), o = `row-${Math.random().toString(36).slice(2)}-${Date.now()}`, s = new AbortController();
1442
+ if (i) {
1443
1443
  u((e) => [...e, {
1444
- localId: s,
1445
- filename: i.name,
1444
+ localId: o,
1445
+ filename: r.name,
1446
1446
  progress: null,
1447
- error: o,
1447
+ error: i,
1448
1448
  abort: () => {}
1449
1449
  }]);
1450
1450
  return;
1451
1451
  }
1452
1452
  u((e) => [...e, {
1453
- localId: s,
1454
- filename: i.name,
1453
+ localId: o,
1454
+ filename: r.name,
1455
1455
  progress: {
1456
1456
  loaded: 0,
1457
- total: i.size,
1457
+ total: r.size,
1458
1458
  pct: 0
1459
1459
  },
1460
1460
  error: null,
1461
- abort: () => c.abort()
1461
+ abort: () => s.abort()
1462
1462
  }]);
1463
1463
  try {
1464
- let t = await p({
1465
- file: i,
1464
+ let t = await se({
1465
+ file: r,
1466
1466
  entityCode: e.entityCode,
1467
1467
  fieldCode: n,
1468
- signal: c.signal,
1469
- onProgress: (e) => u((t) => t.map((t) => t.localId === s ? {
1468
+ signal: s.signal,
1469
+ onProgress: (e) => u((t) => t.map((t) => t.localId === o ? {
1470
1470
  ...t,
1471
1471
  progress: e
1472
1472
  } : t))
1473
1473
  });
1474
- if (_.current.delete(s)) {
1475
- x(t.id).catch(() => {}), f(t.id);
1474
+ if (v.current.delete(o)) {
1475
+ m(t.id).catch(() => {}), f(t.id);
1476
1476
  return;
1477
1477
  }
1478
- d(t.id, () => x(t.id));
1479
- let r = {
1478
+ d(t.id, () => m(t.id));
1479
+ let i = {
1480
1480
  id: t.id,
1481
1481
  filename: t.filename,
1482
1482
  content_type: t.content_type,
@@ -1486,21 +1486,21 @@ function dn(e) {
1486
1486
  height: t.height,
1487
1487
  url: t.url,
1488
1488
  metadata: t.metadata
1489
- }, o = [...h.current, r];
1490
- h.current = o, a?.(o), u((e) => e.filter((e) => e.localId !== s));
1489
+ }, c = [...g.current, i];
1490
+ g.current = c, a?.(c), u((e) => e.filter((e) => e.localId !== o));
1491
1491
  } catch (e) {
1492
- if (e instanceof ue && e.code === "ABORTED") {
1493
- u((e) => e.filter((e) => e.localId !== s));
1492
+ if (e instanceof ce && e.code === "ABORTED") {
1493
+ u((e) => e.filter((e) => e.localId !== o));
1494
1494
  return;
1495
1495
  }
1496
- let t = e instanceof ue ? {
1496
+ let t = e instanceof ce ? {
1497
1497
  code: e.code,
1498
1498
  message: e.message
1499
1499
  } : {
1500
1500
  code: "UNKNOWN",
1501
1501
  message: e instanceof Error ? e.message : "Upload failed"
1502
1502
  };
1503
- u((e) => e.map((e) => e.localId === s ? {
1503
+ u((e) => e.map((e) => e.localId === o ? {
1504
1504
  ...e,
1505
1505
  error: t,
1506
1506
  progress: null,
@@ -1515,21 +1515,21 @@ function dn(e) {
1515
1515
  e.entityCode,
1516
1516
  d,
1517
1517
  f
1518
- ]), T = G((e) => {
1519
- Array.from(e).forEach((e) => void w(e));
1520
- }, [w]), E = G(() => {
1521
- s || g.current?.click();
1522
- }, [s]), D = G((e) => {
1518
+ ]), w = G((e) => {
1519
+ Array.from(e).forEach((e) => void C(e));
1520
+ }, [C]), T = G(() => {
1521
+ s || _.current?.click();
1522
+ }, [s]), E = G((e) => {
1523
1523
  let t = e.target.files;
1524
- e.target.value = "", t && t.length > 0 && T(t);
1525
- }, [T]), O = G((e) => {
1526
- m(e) && (x(e).catch(() => {}), f(e)), a?.(c.filter((t) => t.id !== e));
1524
+ e.target.value = "", t && t.length > 0 && w(t);
1525
+ }, [w]), D = G((e) => {
1526
+ p(e) && (m(e).catch(() => {}), f(e)), a?.(c.filter((t) => t.id !== e));
1527
1527
  }, [
1528
- m,
1528
+ p,
1529
1529
  c,
1530
1530
  a,
1531
1531
  f
1532
- ]), k = G((e) => {
1532
+ ]), O = G((e) => {
1533
1533
  b(e.id, "download", ye(e));
1534
1534
  }, [b]);
1535
1535
  return /* @__PURE__ */ Q("div", {
@@ -1552,26 +1552,26 @@ function dn(e) {
1552
1552
  }),
1553
1553
  /* @__PURE__ */ Z("button", {
1554
1554
  type: "button",
1555
- onClick: () => k(e),
1555
+ onClick: () => O(e),
1556
1556
  className: "min-w-0 flex-1 truncate text-left text-sm text-foreground hover:underline",
1557
1557
  title: e.filename,
1558
1558
  children: e.filename
1559
1559
  }),
1560
1560
  /* @__PURE__ */ Z("span", {
1561
1561
  className: "flex-none text-xs text-muted-foreground",
1562
- children: le(e.size_bytes)
1562
+ children: r(e.size_bytes)
1563
1563
  }),
1564
1564
  /* @__PURE__ */ Z("button", {
1565
1565
  type: "button",
1566
1566
  className: "flex-none rounded-sm border border-border bg-card px-2 py-0.5 text-xs text-foreground hover:bg-surface-2",
1567
- onClick: () => k(e),
1567
+ onClick: () => O(e),
1568
1568
  "data-testid": `download-${e.id}`,
1569
1569
  children: "Download"
1570
1570
  }),
1571
- !C && /* @__PURE__ */ Z("button", {
1571
+ !S && /* @__PURE__ */ Z("button", {
1572
1572
  type: "button",
1573
1573
  className: "flex-none rounded-sm border border-border bg-card px-2 py-0.5 text-xs text-destructive hover:bg-surface-2",
1574
- onClick: () => O(e.id),
1574
+ onClick: () => D(e.id),
1575
1575
  disabled: s,
1576
1576
  "data-testid": `remove-${e.id}`,
1577
1577
  children: "Remove"
@@ -1606,26 +1606,26 @@ function dn(e) {
1606
1606
  type: "button",
1607
1607
  className: "flex-none rounded-sm border border-border bg-card px-2 py-0.5 text-xs",
1608
1608
  onClick: () => {
1609
- e.abort(), _.current.add(e.localId), u((t) => t.filter((t) => t.localId !== e.localId));
1609
+ e.abort(), v.current.add(e.localId), u((t) => t.filter((t) => t.localId !== e.localId));
1610
1610
  },
1611
1611
  children: e.error ? "Dismiss" : "Cancel"
1612
1612
  })
1613
1613
  ]
1614
1614
  }, e.localId))
1615
1615
  ]
1616
- }), !C && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("button", {
1616
+ }), !S && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("button", {
1617
1617
  type: "button",
1618
1618
  className: "self-start rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
1619
- onClick: E,
1619
+ onClick: T,
1620
1620
  disabled: s,
1621
1621
  "data-testid": "add-files",
1622
1622
  children: "Add files"
1623
1623
  }), /* @__PURE__ */ Z("input", {
1624
- ref: g,
1624
+ ref: _,
1625
1625
  type: "file",
1626
- accept: S || void 0,
1626
+ accept: x || void 0,
1627
1627
  multiple: !0,
1628
- onChange: D,
1628
+ onChange: E,
1629
1629
  style: { display: "none" },
1630
1630
  "data-testid": `file-input-${n}`
1631
1631
  })] })]
@@ -1736,17 +1736,17 @@ function bn(e, t) {
1736
1736
  function xn(e, t, n) {
1737
1737
  if (yn(e, n)) return bn(t, n);
1738
1738
  let r = e.fields.get(n);
1739
- return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ? ce(t[n], bn(t, n)) : t[n];
1739
+ return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ? i(t[n], bn(t, n)) : t[n];
1740
1740
  }
1741
1741
  function Sn(e, t, n) {
1742
1742
  let r = e.fields.get(t);
1743
- return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ? i(n) : n;
1743
+ return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ? R(n) : n;
1744
1744
  }
1745
1745
  function Cn(e, t, n) {
1746
1746
  let r = yn(e, t);
1747
1747
  if (r) return r.name || t;
1748
1748
  let i = e.fields.get(t);
1749
- return i ? b(i, t, n) : t;
1749
+ return i ? ie(i, t, n) : t;
1750
1750
  }
1751
1751
  function wn(e) {
1752
1752
  let { entity: t, entityCode: n, fieldName: r, record: i, mode: a, onChange: o, refs: s, disabled: c, surface: l, entities: u, screens: d, locale: f, fieldId: p, labelId: m } = e, h = yn(t, r);
@@ -1767,7 +1767,7 @@ function wn(e) {
1767
1767
  });
1768
1768
  }
1769
1769
  let g = t.fields.get(r);
1770
- return g ? I({
1770
+ return g ? O({
1771
1771
  field: g,
1772
1772
  entityCode: n,
1773
1773
  fieldName: r,
@@ -1862,7 +1862,7 @@ function Nn(e) {
1862
1862
  }
1863
1863
  function Pn(e, t) {
1864
1864
  if (e.mode !== "rich_text_inline") return { clear: !0 };
1865
- let n = a(i(t));
1865
+ let n = d(R(t));
1866
1866
  return n.length === 0 ? { clear: !0 } : { set: n.map((e, t) => ({
1867
1867
  file_id: e,
1868
1868
  position: t
@@ -1872,7 +1872,7 @@ function Pn(e, t) {
1872
1872
  //#region src/hooks/useChildrenData.ts
1873
1873
  var Fn = "entity-children";
1874
1874
  function In(e, t, n, r, i, a) {
1875
- let o = Array.isArray(r) ? r : [r], s = Array.isArray(r) ? se(t, o.length) : [t];
1875
+ let o = Array.isArray(r) ? r : [r], s = Array.isArray(r) ? D(t, o.length) : [t];
1876
1876
  return Le({
1877
1877
  queryKey: [
1878
1878
  Fn,
@@ -1890,7 +1890,7 @@ function In(e, t, n, r, i, a) {
1890
1890
  op: "eq",
1891
1891
  value: s[t]
1892
1892
  }));
1893
- return e.set("filters", JSON.stringify(t)), e.set("preview", "true"), i && e.set("sort", i), a && e.set("limit", String(a)), P(`/api/data/${n}?${e.toString()}`);
1893
+ return e.set("filters", JSON.stringify(t)), e.set("preview", "true"), i && e.set("sort", i), a && e.set("limit", String(a)), L(`/api/data/${n}?${e.toString()}`);
1894
1894
  },
1895
1895
  enabled: !!e && !!t && !!n && !!r && s !== null
1896
1896
  });
@@ -1933,7 +1933,7 @@ function zn(e, t, n, r, i, a, o, s) {
1933
1933
  op: "eq",
1934
1934
  value: t
1935
1935
  });
1936
- return c.set("filters", JSON.stringify(l)), i && c.set("sort", i), a && c.set("limit", String(a)), o && c.set("search", o), e && c.set("after", e), P(`/api/data/${n}?${c.toString()}`);
1936
+ return c.set("filters", JSON.stringify(l)), i && c.set("sort", i), a && c.set("limit", String(a)), o && c.set("search", o), e && c.set("after", e), L(`/api/data/${n}?${c.toString()}`);
1937
1937
  },
1938
1938
  getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
1939
1939
  initialPageParam: void 0,
@@ -1942,12 +1942,12 @@ function zn(e, t, n, r, i, a, o, s) {
1942
1942
  }
1943
1943
  //#endregion
1944
1944
  //#region src/components/shared/ActionConfirmDialog.tsx
1945
- function Bn({ open: t, onOpenChange: n, actionName: r, message: i, onConfirm: a, isPending: o }) {
1946
- let s = J(null);
1945
+ function Bn({ open: t, onOpenChange: n, actionName: r, message: i, onConfirm: a, isPending: s }) {
1946
+ let c = J(null);
1947
1947
  return K(() => {
1948
- t && s.current?.focus();
1948
+ t && c.current?.focus();
1949
1949
  }, [t]), t ? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("div", {
1950
- onClick: () => !o && n(!1),
1950
+ onClick: () => !s && n(!1),
1951
1951
  style: {
1952
1952
  position: "fixed",
1953
1953
  inset: 0,
@@ -1956,13 +1956,13 @@ function Bn({ open: t, onOpenChange: n, actionName: r, message: i, onConfirm: a,
1956
1956
  backdropFilter: "blur(2px)"
1957
1957
  }
1958
1958
  }), /* @__PURE__ */ Q("div", {
1959
- ref: s,
1959
+ ref: c,
1960
1960
  role: "dialog",
1961
1961
  "aria-modal": "true",
1962
1962
  "aria-label": r,
1963
1963
  tabIndex: -1,
1964
1964
  onKeyDown: (e) => {
1965
- e.key === "Escape" && !o && n(!1);
1965
+ e.key === "Escape" && !s && n(!1);
1966
1966
  },
1967
1967
  style: {
1968
1968
  position: "fixed",
@@ -2027,9 +2027,9 @@ function Bn({ open: t, onOpenChange: n, actionName: r, message: i, onConfirm: a,
2027
2027
  children: i
2028
2028
  })]
2029
2029
  }),
2030
- /* @__PURE__ */ Z(m, {
2030
+ /* @__PURE__ */ Z(o, {
2031
2031
  icon: /* @__PURE__ */ Z(e.x, { size: 14 }),
2032
- onClick: () => !o && n(!1)
2032
+ onClick: () => !s && n(!1)
2033
2033
  })
2034
2034
  ]
2035
2035
  }), /* @__PURE__ */ Q("div", {
@@ -2046,17 +2046,17 @@ function Bn({ open: t, onOpenChange: n, actionName: r, message: i, onConfirm: a,
2046
2046
  },
2047
2047
  children: [
2048
2048
  /* @__PURE__ */ Z("div", { style: { flex: 1 } }),
2049
- /* @__PURE__ */ Z(_, {
2049
+ /* @__PURE__ */ Z(l, {
2050
2050
  onClick: () => n(!1),
2051
- disabled: o,
2051
+ disabled: s,
2052
2052
  children: "Cancel"
2053
2053
  }),
2054
- /* @__PURE__ */ Z(_, {
2054
+ /* @__PURE__ */ Z(l, {
2055
2055
  kind: "primary",
2056
- icon: Z(o ? j : e.bolt, { size: 13 }),
2056
+ icon: Z(s ? u : e.bolt, { size: 13 }),
2057
2057
  onClick: a,
2058
- disabled: o,
2059
- children: o ? "Executing…" : "Confirm"
2058
+ disabled: s,
2059
+ children: s ? "Executing…" : "Confirm"
2060
2060
  })
2061
2061
  ]
2062
2062
  })]
@@ -2065,7 +2065,7 @@ function Bn({ open: t, onOpenChange: n, actionName: r, message: i, onConfirm: a,
2065
2065
  //#endregion
2066
2066
  //#region src/hooks/useMutations.ts
2067
2067
  function Vn(e) {
2068
- h.error(e.message);
2068
+ g.error(e.message);
2069
2069
  }
2070
2070
  function Hn(e, t, n = {}) {
2071
2071
  e.invalidateQueries({ queryKey: ["entity-data", t] }), e.invalidateQueries({ queryKey: ["entity-count", t] }), n.item && e.invalidateQueries({ queryKey: ["entity-item", t] }), n.children && e.invalidateQueries({ queryKey: [Fn, t] }), n.objectMeta && (e.invalidateQueries({ queryKey: ["object-status", t] }), e.invalidateQueries({ queryKey: ["object-properties", t] }));
@@ -2073,9 +2073,9 @@ function Hn(e, t, n = {}) {
2073
2073
  function Un(e) {
2074
2074
  let t = Re();
2075
2075
  return Ie({
2076
- mutationFn: (t) => ae(e, t),
2076
+ mutationFn: (t) => re(e, t),
2077
2077
  onSuccess: () => {
2078
- Hn(t, e), h.success("Record created");
2078
+ Hn(t, e), g.success("Record created");
2079
2079
  },
2080
2080
  onError: Vn
2081
2081
  });
@@ -2083,13 +2083,13 @@ function Un(e) {
2083
2083
  function Wn(e) {
2084
2084
  let t = Re();
2085
2085
  return Ie({
2086
- mutationFn: ({ pkValues: t, data: n }) => re(e, t, n),
2086
+ mutationFn: ({ pkValues: t, data: n }) => M(e, t, n),
2087
2087
  onSuccess: () => {
2088
2088
  Hn(t, e, {
2089
2089
  item: !0,
2090
2090
  children: !0,
2091
2091
  objectMeta: !0
2092
- }), h.success("Record updated");
2092
+ }), g.success("Record updated");
2093
2093
  },
2094
2094
  onError: Vn
2095
2095
  });
@@ -2097,9 +2097,9 @@ function Wn(e) {
2097
2097
  function Gn(e) {
2098
2098
  let t = Re();
2099
2099
  return Ie({
2100
- mutationFn: (t) => te(e, t),
2100
+ mutationFn: (t) => P(e, t),
2101
2101
  onSuccess: () => {
2102
- Hn(t, e, { item: !0 }), h.success("Record deleted");
2102
+ Hn(t, e, { item: !0 }), g.success("Record deleted");
2103
2103
  },
2104
2104
  onError: Vn
2105
2105
  });
@@ -2107,12 +2107,12 @@ function Gn(e) {
2107
2107
  function Kn(e) {
2108
2108
  let t = Re();
2109
2109
  return Ie({
2110
- mutationFn: (t) => F(e, t),
2110
+ mutationFn: (t) => w(e, t),
2111
2111
  onSuccess: () => {
2112
2112
  Hn(t, e, {
2113
2113
  item: !0,
2114
2114
  objectMeta: !0
2115
- }), h.success("Record restored");
2115
+ }), g.success("Record restored");
2116
2116
  },
2117
2117
  onError: Vn
2118
2118
  });
@@ -2121,7 +2121,7 @@ function qn(e) {
2121
2121
  let t = Re();
2122
2122
  return Ie({
2123
2123
  mutationFn: async ({ actionCode: e, body: t }) => {
2124
- let n = await A(e, t);
2124
+ let n = await te(e, t);
2125
2125
  if (n.status === "error") throw Error("Action failed for all items");
2126
2126
  return n;
2127
2127
  },
@@ -2130,7 +2130,7 @@ function qn(e) {
2130
2130
  item: !0,
2131
2131
  children: !0,
2132
2132
  objectMeta: !0
2133
- }), n.status === "accepted" ? h.success("Action started - check audit for progress") : n.status === "partial" ? h.warning("Action partially completed - some items failed or were skipped") : h.success("Action executed");
2133
+ }), n.status === "accepted" ? g.success("Action started - check audit for progress") : n.status === "partial" ? g.warning("Action partially completed - some items failed or were skipped") : g.success("Action executed");
2134
2134
  },
2135
2135
  onError: Vn
2136
2136
  });
@@ -2146,10 +2146,10 @@ var Jn = {
2146
2146
  function Yn(e, t) {
2147
2147
  if (!e) return "";
2148
2148
  if (t) try {
2149
- return T(t, k(t, e));
2149
+ return H(t, V(t, e));
2150
2150
  } catch {}
2151
2151
  let n = e.id;
2152
- return typeof n == "string" ? n : n == null ? "" : W(n);
2152
+ return typeof n == "string" ? n : n == null ? "" : x(n);
2153
2153
  }
2154
2154
  function Xn(e, t) {
2155
2155
  if (!e || e.length === 0) return !0;
@@ -2165,10 +2165,10 @@ function Xn(e, t) {
2165
2165
  function Zn(e, t) {
2166
2166
  let n = Qn(t, e.field), r = e.op || "eq";
2167
2167
  if (r === "in" || r === "not_in") {
2168
- let t = Array.isArray(e.value) ? e.value : [e.value], i = W(n), a = t.some((e) => W(e) === i);
2168
+ let t = Array.isArray(e.value) ? e.value : [e.value], i = x(n), a = t.some((e) => x(e) === i);
2169
2169
  return r === "in" ? a : !a;
2170
2170
  }
2171
- return typeof e.value == "boolean" && r === "eq" ? er(n) === e.value : typeof n == "number" && typeof e.value == "number" ? tr(n, e.value, r) : tr(W(n), W(e.value), r);
2171
+ return typeof e.value == "boolean" && r === "eq" ? er(n) === e.value : typeof n == "number" && typeof e.value == "number" ? tr(n, e.value, r) : tr(x(n), x(e.value), r);
2172
2172
  }
2173
2173
  function Qn(e, t) {
2174
2174
  if (Object.prototype.hasOwnProperty.call(e, t)) return e[t];
@@ -2232,7 +2232,7 @@ function rr(e, t, n, r) {
2232
2232
  function ir(e, t) {
2233
2233
  return e.filter(({ code: e }) => {
2234
2234
  let n = Jn[e];
2235
- return !n || V(t, n);
2235
+ return !n || y(t, n);
2236
2236
  });
2237
2237
  }
2238
2238
  function ar(e) {
@@ -2241,7 +2241,7 @@ function ar(e) {
2241
2241
  }
2242
2242
  function or(e, t, n, r) {
2243
2243
  if (n && r) return r;
2244
- let i = S(e?.display?.description);
2244
+ let i = W(e?.display?.description);
2245
2245
  return i ? e?.display?.icon_only === !0 ? `${t} - ${i}` : i : t;
2246
2246
  }
2247
2247
  function sr(e) {
@@ -2405,185 +2405,185 @@ function Cr(e, t) {
2405
2405
  }
2406
2406
  //#endregion
2407
2407
  //#region src/components/shared/ActionButton.tsx
2408
- function wr({ actionCode: n, action: r, entityCode: i, objectIds: a = [], row: o, variant: s = "outline", size: c = "default", onSuccess: l, onBatchStart: u, onBatchError: d, onBatchPartial: f }) {
2409
- let [p, g] = Y(!1), [v, y] = Y(!1), [b, x] = Y(!1), [T, D] = Y(null), k = qn(i), { data: A } = L(), j = It(), M = sr(r), N = ar(r), P = !!r.confirmation && Object.keys(r.confirmation).length > 0, F = o ? Xn(r.conditions, o) : !0, I = G(async () => {
2408
+ function wr({ actionCode: n, action: r, entityCode: i, objectIds: a = [], row: s, variant: c = "outline", size: u = "default", onSuccess: d, onBatchStart: f, onBatchError: p, onBatchPartial: m }) {
2409
+ let [h, _] = Y(!1), [y, b] = Y(!1), [x, S] = Y(!1), [C, w] = Y(null), T = qn(i), { data: D } = A(), O = It(), k = sr(r), j = ar(r), M = !!r.confirmation && Object.keys(r.confirmation).length > 0, N = s ? Xn(r.conditions, s) : !0, P = G(async () => {
2410
2410
  if (!(!r.association || a.length === 0)) {
2411
- x(!0);
2411
+ S(!0);
2412
2412
  try {
2413
- let e = await C(i ? `${i}.${r.association}` : r.association, a), t = cr(A, e.target_entity);
2413
+ let e = await ae(i ? `${i}.${r.association}` : r.association, a), t = cr(D, e.target_entity);
2414
2414
  if (!t) {
2415
- h.error(`No list screen found for ${e.target_entity}`);
2415
+ g.error(`No list screen found for ${e.target_entity}`);
2416
2416
  return;
2417
2417
  }
2418
- let n = A?.entities[e.target_entity], o = S(r.display?.name) || e.target_entity;
2418
+ let n = D?.entities[e.target_entity], o = W(r.display?.name) || e.target_entity;
2419
2419
  if (e.ids.length === 0) {
2420
- h.info(`No related ${o} found`);
2420
+ g.info(`No related ${o} found`);
2421
2421
  return;
2422
2422
  }
2423
2423
  let s = n?.fields.names().find((e) => n.fields.get(e)?.primary) ?? "id", c = new URLSearchParams();
2424
- c.set(`filter_${s}`, e.ids.join(",")), j(t.route, {
2424
+ c.set(`filter_${s}`, e.ids.join(",")), O(t.route, {
2425
2425
  title: o,
2426
2426
  icon: r.display?.icon || t.icon,
2427
2427
  search: c.toString()
2428
- }), l?.();
2428
+ }), d?.();
2429
2429
  } catch (e) {
2430
- h.error(e instanceof Error ? e.message : "Failed to resolve association");
2430
+ g.error(e instanceof Error ? e.message : "Failed to resolve association");
2431
2431
  } finally {
2432
- x(!1);
2432
+ S(!1);
2433
2433
  }
2434
2434
  }
2435
2435
  }, [
2436
2436
  r,
2437
2437
  i,
2438
2438
  a,
2439
- A,
2440
- j,
2441
- l
2442
- ]), ee = r.entity ? `${r.entity}.${n}` : n, R = a.length > 0 ? a : void 0, te = r.resolved_hidden_defaults && Object.keys(r.resolved_hidden_defaults).length > 0 ? r.resolved_hidden_defaults : void 0, z = G((e, t) => {
2439
+ D,
2440
+ O,
2441
+ d
2442
+ ]), F = r.entity ? `${r.entity}.${n}` : n, I = a.length > 0 ? a : void 0, L = r.resolved_hidden_defaults && Object.keys(r.resolved_hidden_defaults).length > 0 ? r.resolved_hidden_defaults : void 0, R = G((e, t) => {
2443
2443
  if (t?.(), e.status === "accepted") {
2444
- l?.();
2444
+ d?.();
2445
2445
  return;
2446
2446
  }
2447
2447
  let n = e.result?.$display;
2448
2448
  if (n) {
2449
- D(n);
2449
+ w(n);
2450
2450
  return;
2451
2451
  }
2452
- e.status === "partial" ? f?.(a.length, e.success) : l?.();
2452
+ e.status === "partial" ? m?.(a.length, e.success) : d?.();
2453
2453
  }, [
2454
2454
  a.length,
2455
- l,
2456
- f
2457
- ]), B = G(() => {
2458
- if (w(r)) {
2459
- oe(r.ui_steps, { row: o }).then(() => l?.());
2455
+ d,
2456
+ m
2457
+ ]), z = G(() => {
2458
+ if (ne(r)) {
2459
+ E(r.ui_steps, { row: s }).then(() => d?.());
2460
2460
  return;
2461
2461
  }
2462
- if (M) {
2463
- I();
2462
+ if (k) {
2463
+ P();
2464
2464
  return;
2465
2465
  }
2466
2466
  if (r.href && !r.handler && !r.association) {
2467
- let e = Yn(o, i ? A?.entities[i] : void 0), t = r.href;
2468
- i && (t = t.replaceAll("${entity}", i)), e && (t = t.replaceAll("${id}", encodeURIComponent(e))), j(t, {
2469
- title: S(r.display?.name) || n,
2467
+ let e = Yn(s, i ? D?.entities[i] : void 0), t = r.href;
2468
+ i && (t = t.replaceAll("${entity}", i)), e && (t = t.replaceAll("${id}", encodeURIComponent(e))), O(t, {
2469
+ title: W(r.display?.name) || n,
2470
2470
  icon: r.display?.icon
2471
- }), l?.();
2471
+ }), d?.();
2472
2472
  return;
2473
2473
  }
2474
- N ? g(!0) : P ? y(!0) : (u?.(a.length), k.mutate({
2475
- actionCode: ee,
2476
- body: E(te, R)
2474
+ j ? _(!0) : M ? b(!0) : (f?.(a.length), T.mutate({
2475
+ actionCode: F,
2476
+ body: B(L, I)
2477
2477
  }, {
2478
- onSuccess: (e) => z(e),
2479
- onError: () => d?.(a.length)
2478
+ onSuccess: (e) => R(e),
2479
+ onError: () => p?.(a.length)
2480
2480
  }));
2481
2481
  }, [
2482
2482
  r,
2483
- o,
2483
+ s,
2484
2484
  i,
2485
- A?.entities,
2485
+ D?.entities,
2486
2486
  n,
2487
+ O,
2488
+ k,
2487
2489
  j,
2488
2490
  M,
2489
- N,
2490
- P,
2491
- ee,
2492
- R,
2493
- a,
2494
- te,
2495
- k,
2496
- z,
2491
+ F,
2497
2492
  I,
2498
- u,
2499
- d,
2500
- l
2501
- ]), ne = G(() => {
2502
- u?.(a.length), k.mutate({
2503
- actionCode: ee,
2504
- body: E(te, R)
2493
+ a,
2494
+ L,
2495
+ T,
2496
+ R,
2497
+ P,
2498
+ f,
2499
+ p,
2500
+ d
2501
+ ]), V = G(() => {
2502
+ f?.(a.length), T.mutate({
2503
+ actionCode: F,
2504
+ body: B(L, I)
2505
2505
  }, {
2506
- onSuccess: (e) => z(e, () => y(!1)),
2507
- onError: () => d?.(a.length)
2506
+ onSuccess: (e) => R(e, () => b(!1)),
2507
+ onError: () => p?.(a.length)
2508
2508
  });
2509
2509
  }, [
2510
- ee,
2511
- R,
2510
+ F,
2511
+ I,
2512
2512
  a,
2513
- te,
2514
- k,
2515
- z,
2516
- u,
2517
- d
2518
- ]), re = G((e) => {
2519
- u?.(a.length), k.mutate({
2520
- actionCode: ee,
2521
- body: E(e, R)
2513
+ L,
2514
+ T,
2515
+ R,
2516
+ f,
2517
+ p
2518
+ ]), te = G((e) => {
2519
+ f?.(a.length), T.mutate({
2520
+ actionCode: F,
2521
+ body: B(e, I)
2522
2522
  }, {
2523
- onSuccess: (e) => z(e, () => g(!1)),
2524
- onError: () => d?.(a.length)
2523
+ onSuccess: (e) => R(e, () => _(!1)),
2524
+ onError: () => p?.(a.length)
2525
2525
  });
2526
2526
  }, [
2527
- ee,
2528
- R,
2527
+ F,
2528
+ I,
2529
2529
  a,
2530
- k,
2531
- z,
2532
- u,
2533
- d
2534
- ]), V = S(r.display?.name), H = r.display?.icon, U = H && e[H], ae = U ? /* @__PURE__ */ Z(U, { size: 13 }) : H ? /* @__PURE__ */ Z(t, {
2535
- name: H,
2530
+ T,
2531
+ R,
2532
+ f,
2533
+ p
2534
+ ]), H = W(r.display?.name), U = r.display?.icon, re = U && e[U], ie = re ? /* @__PURE__ */ Z(re, { size: 13 }) : U ? /* @__PURE__ */ Z(t, {
2535
+ name: U,
2536
2536
  size: 13
2537
- }) : null, se = !F || k.isPending || b;
2537
+ }) : null, oe = !N || T.isPending || x;
2538
2538
  return /* @__PURE__ */ Q(X, { children: [
2539
- c === "icon" ? /* @__PURE__ */ Z(m, {
2540
- icon: ae ?? /* @__PURE__ */ Z(e.bolt, { size: 13 }),
2541
- onClick: B,
2542
- title: V
2543
- }) : /* @__PURE__ */ Z(_, {
2544
- kind: s === "default" ? "primary" : s === "ghost" ? "ghost" : "default",
2539
+ u === "icon" ? /* @__PURE__ */ Z(o, {
2540
+ icon: ie ?? /* @__PURE__ */ Z(e.bolt, { size: 13 }),
2541
+ onClick: z,
2542
+ title: H
2543
+ }) : /* @__PURE__ */ Z(l, {
2544
+ kind: c === "default" ? "primary" : c === "ghost" ? "ghost" : "default",
2545
2545
  size: "sm",
2546
- icon: ae,
2546
+ icon: ie,
2547
2547
  danger: r.destructive,
2548
- onClick: B,
2549
- disabled: se,
2550
- title: V,
2551
- "aria-label": V,
2552
- children: V
2548
+ onClick: z,
2549
+ disabled: oe,
2550
+ title: H,
2551
+ "aria-label": H,
2552
+ children: H
2553
2553
  }),
2554
- N && /* @__PURE__ */ Z(O, {
2555
- open: p,
2556
- onOpenChange: g,
2554
+ j && /* @__PURE__ */ Z(ee, {
2555
+ open: h,
2556
+ onOpenChange: _,
2557
2557
  action: r,
2558
- actionName: V,
2559
- onSubmit: re,
2560
- isPending: k.isPending,
2561
- row: o
2558
+ actionName: H,
2559
+ onSubmit: te,
2560
+ isPending: T.isPending,
2561
+ row: s
2562
2562
  }),
2563
- P && /* @__PURE__ */ Z(Bn, {
2564
- open: v,
2565
- onOpenChange: y,
2566
- actionName: V,
2567
- message: S(r.confirmation),
2568
- onConfirm: ne,
2569
- isPending: k.isPending
2563
+ M && /* @__PURE__ */ Z(Bn, {
2564
+ open: y,
2565
+ onOpenChange: b,
2566
+ actionName: H,
2567
+ message: W(r.confirmation),
2568
+ onConfirm: V,
2569
+ isPending: T.isPending
2570
2570
  }),
2571
- T && /* @__PURE__ */ Z(ie, {
2572
- open: !!T,
2571
+ C && /* @__PURE__ */ Z(v, {
2572
+ open: !!C,
2573
2573
  onClose: () => {
2574
- D(null), l?.();
2574
+ w(null), d?.();
2575
2575
  },
2576
- display: T
2576
+ display: C
2577
2577
  })
2578
2578
  ] });
2579
2579
  }
2580
2580
  //#endregion
2581
2581
  //#region src/components/shared/RowActionsKebab.tsx
2582
- function Tr({ actions: t, objectIds: r, row: i, onSuccess: a, preMenu: o, divider: s, size: c = 22, align: l = "end" }) {
2583
- let d = J(null), [f, p] = Y(!1), { run: h } = R();
2584
- if (!o && t.length === 0) return null;
2582
+ function Tr({ actions: t, objectIds: n, row: r, onSuccess: i, preMenu: a, divider: c, size: l = 22, align: u = "end" }) {
2583
+ let d = J(null), [f, m] = Y(!1), { run: h } = N();
2584
+ if (!a && t.length === 0) return null;
2585
2585
  let g = (e) => () => {
2586
- p(!1), e();
2586
+ m(!1), e();
2587
2587
  };
2588
2588
  return /* @__PURE__ */ Q("div", {
2589
2589
  className: "sl-row-actions",
@@ -2593,35 +2593,35 @@ function Tr({ actions: t, objectIds: r, row: i, onSuccess: a, preMenu: o, divide
2593
2593
  alignItems: "center",
2594
2594
  justifyContent: "flex-end"
2595
2595
  },
2596
- children: [/* @__PURE__ */ Z(m, {
2596
+ children: [/* @__PURE__ */ Z(o, {
2597
2597
  ref: d,
2598
- size: c,
2599
- icon: /* @__PURE__ */ Z(e.more, { size: Math.round(c * .55) }),
2600
- onClick: () => p((e) => !e),
2598
+ size: l,
2599
+ icon: /* @__PURE__ */ Z(e.more, { size: Math.round(l * .55) }),
2600
+ onClick: () => m((e) => !e),
2601
2601
  title: "Actions"
2602
- }), /* @__PURE__ */ Q(n, {
2602
+ }), /* @__PURE__ */ Q(s, {
2603
2603
  open: f,
2604
2604
  anchor: d.current,
2605
- onClose: () => p(!1),
2605
+ onClose: () => m(!1),
2606
2606
  width: 200,
2607
- align: l,
2607
+ align: u,
2608
2608
  children: [
2609
- o,
2610
- o && s && t.length > 0 && /* @__PURE__ */ Z(u, { divider: !0 }),
2611
- t.map(({ code: t, action: n }) => {
2612
- let o = i ? Xn(n.conditions, i) : !0, s = S(n.display?.name) || t, c = n.display?.icon, l = c && e[c] ? e[c] : void 0;
2613
- return /* @__PURE__ */ Z(u, {
2609
+ a,
2610
+ a && c && t.length > 0 && /* @__PURE__ */ Z(p, { divider: !0 }),
2611
+ t.map(({ code: t, action: a }) => {
2612
+ let o = r ? Xn(a.conditions, r) : !0, s = W(a.display?.name) || t, c = a.display?.icon, l = c && e[c] ? e[c] : void 0;
2613
+ return /* @__PURE__ */ Z(p, {
2614
2614
  icon: l ? /* @__PURE__ */ Z(l, { size: 12 }) : null,
2615
- danger: n.destructive,
2615
+ danger: a.destructive,
2616
2616
  onClick: g(() => {
2617
2617
  if (!o) return;
2618
- let e = n.entity ? `${n.entity}.${t}` : t;
2618
+ let e = a.entity ? `${a.entity}.${t}` : t;
2619
2619
  h({
2620
- action: n,
2620
+ action: a,
2621
2621
  title: s,
2622
2622
  execute: async (t) => {
2623
- let n = await A(e, E(t, r));
2624
- return a?.(), n;
2623
+ let r = await te(e, B(t, n));
2624
+ return i?.(), r;
2625
2625
  }
2626
2626
  });
2627
2627
  }),
@@ -2634,47 +2634,47 @@ function Tr({ actions: t, objectIds: r, row: i, onSuccess: a, preMenu: o, divide
2634
2634
  }
2635
2635
  //#endregion
2636
2636
  //#region src/components/detail-layout/AssociatedToolbar.tsx
2637
- function Er({ entity: t, searchable: n, filterFields: r, searchValue: i, onSearchChange: a, filters: s, onFilterChange: c, allEntities: l }) {
2638
- let u = n === !0, d = r && r.length > 0;
2639
- return !u && !d ? null : /* @__PURE__ */ Q("div", {
2637
+ function Er({ entity: t, searchable: n, filterFields: r, searchValue: i, onSearchChange: a, filters: o, onFilterChange: s, allEntities: c }) {
2638
+ let l = n === !0, u = r && r.length > 0;
2639
+ return !l && !u ? null : /* @__PURE__ */ Q("div", {
2640
2640
  style: {
2641
2641
  display: "flex",
2642
2642
  alignItems: "center",
2643
2643
  gap: 6,
2644
2644
  marginBottom: 8
2645
2645
  },
2646
- children: [u && /* @__PURE__ */ Z("div", {
2646
+ children: [l && /* @__PURE__ */ Z("div", {
2647
2647
  style: {
2648
2648
  flex: 1,
2649
2649
  maxWidth: 220
2650
2650
  },
2651
- children: /* @__PURE__ */ Z(N, {
2651
+ children: /* @__PURE__ */ Z(I, {
2652
2652
  value: i,
2653
2653
  onChange: a,
2654
2654
  placeholder: "Search…",
2655
2655
  prefix: /* @__PURE__ */ Z(e.search, { size: 12 })
2656
2656
  })
2657
- }), d && r.map((e) => {
2657
+ }), u && r.map((e) => {
2658
2658
  let n = t.fields.get(e);
2659
2659
  if (!n) return null;
2660
- let r = s[e] ?? "__all__", i = b(n, e, l);
2660
+ let r = o[e] ?? "__all__", i = ie(n, e, c);
2661
2661
  return n.type === "ref" && n.ref?.entity ? /* @__PURE__ */ Z(Dr, {
2662
2662
  field: n,
2663
2663
  label: i,
2664
2664
  value: r,
2665
- onChange: (t) => c(e, t)
2665
+ onChange: (t) => s(e, t)
2666
2666
  }, e) : n.values ? /* @__PURE__ */ Z("div", {
2667
2667
  style: { width: 160 },
2668
- children: /* @__PURE__ */ Z(o, {
2668
+ children: /* @__PURE__ */ Z(f, {
2669
2669
  value: r,
2670
2670
  options: [{
2671
2671
  value: "__all__",
2672
2672
  label: `All ${i}`
2673
2673
  }, ...n.values.map((e) => ({
2674
2674
  value: e.code,
2675
- label: S(e.name) || e.code
2675
+ label: W(e.name) || e.code
2676
2676
  }))],
2677
- onChange: (t) => c(e, t),
2677
+ onChange: (t) => s(e, t),
2678
2678
  placeholder: i
2679
2679
  })
2680
2680
  }, e) : null;
@@ -2682,29 +2682,29 @@ function Er({ entity: t, searchable: n, filterFields: r, searchValue: i, onSearc
2682
2682
  });
2683
2683
  }
2684
2684
  function Dr({ field: e, label: t, value: n, onChange: r }) {
2685
- let i = M(e.ref?.entity), a = e.display?.ref_display_field ?? i?.display?.display_field, s = q(() => i ? [...i.fields].find(([, e]) => e.primary)?.[0] ?? "id" : "id", [i]), { data: c } = d(e.ref?.entity, {
2685
+ let i = F(e.ref?.entity), o = e.display?.ref_display_field ?? i?.display?.display_field, s = q(() => i ? [...i.fields].find(([, e]) => e.primary)?.[0] ?? "id" : "id", [i]), { data: c } = a(e.ref?.entity, {
2686
2686
  per_page: 200,
2687
- sort: a ? `${a}:asc` : void 0
2687
+ sort: o ? `${o}:asc` : void 0
2688
2688
  }), l = c?.data ?? [], u = (e) => {
2689
2689
  if (e == null) return "—";
2690
2690
  if (typeof e == "object" && !Array.isArray(e)) {
2691
2691
  let t = Object.values(e)[0];
2692
- return t == null ? "—" : W(t);
2692
+ return t == null ? "—" : x(t);
2693
2693
  }
2694
- return W(e);
2694
+ return x(e);
2695
2695
  };
2696
2696
  return /* @__PURE__ */ Z("div", {
2697
2697
  style: { width: 160 },
2698
- children: /* @__PURE__ */ Z(o, {
2698
+ children: /* @__PURE__ */ Z(f, {
2699
2699
  value: n,
2700
2700
  options: [{
2701
2701
  value: "__all__",
2702
2702
  label: `All ${t}`
2703
2703
  }, ...l.map((e) => {
2704
- let t = String(e[s]), n = e[f];
2704
+ let t = String(e[s]), n = e[T];
2705
2705
  return {
2706
2706
  value: t,
2707
- label: typeof n == "string" && n !== "" ? n : a ? u(e[a] ?? t) : t
2707
+ label: typeof n == "string" && n !== "" ? n : o ? u(e[o] ?? t) : t
2708
2708
  };
2709
2709
  })],
2710
2710
  onChange: r,
@@ -2783,7 +2783,7 @@ function Pr(e, t, n) {
2783
2783
  if (n && e in n) return n[e];
2784
2784
  }
2785
2785
  function Fr(e, t, n) {
2786
- return S(Pr(e, t, n)?.display?.name) || e;
2786
+ return W(Pr(e, t, n)?.display?.name) || e;
2787
2787
  }
2788
2788
  function Ir(e, t, n) {
2789
2789
  return Pr(e, t, n)?.display?.icon || void 0;
@@ -2791,32 +2791,32 @@ function Ir(e, t, n) {
2791
2791
  function Lr(e) {
2792
2792
  return `action-tooltip-${e}`;
2793
2793
  }
2794
- function Rr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a, onLoadingChange: o, measureRef: s, style: c, row: l, widgetContext: u, onActionClick: d }) {
2795
- let f = Pr(e.code, n, r), p = Fr(e.code, n, r), m = Ir(e.code, n, r), h = f?.destructive ?? !1, g = !h && f?.display?.primary === !0, v = !e.enabled, y = v ? Lr(e.code) : void 0, b = G(async () => {
2796
- if (!(!f || v || a)) {
2794
+ function Rr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a, onLoadingChange: o, measureRef: s, style: c, row: d, widgetContext: f, onActionClick: p }) {
2795
+ let m = Pr(e.code, n, r), h = Fr(e.code, n, r), g = Ir(e.code, n, r), _ = m?.destructive ?? !1, v = !_ && m?.display?.primary === !0, y = !e.enabled, b = y ? Lr(e.code) : void 0, x = G(async () => {
2796
+ if (!(!m || y || a)) {
2797
2797
  o(!0);
2798
2798
  try {
2799
- Ar(e.code, f, l, u, d) || await Promise.resolve(i(e.code, f));
2799
+ Ar(e.code, m, d, f, p) || await Promise.resolve(i(e.code, m));
2800
2800
  } finally {
2801
2801
  o(!1);
2802
2802
  }
2803
2803
  }
2804
2804
  }, [
2805
- f,
2806
- v,
2805
+ m,
2806
+ y,
2807
2807
  a,
2808
2808
  i,
2809
2809
  e.code,
2810
2810
  o,
2811
- l,
2812
- u,
2813
- d
2814
- ]), x = a ? /* @__PURE__ */ Z(j, { size: 12 }) : m ? /* @__PURE__ */ Z(t, {
2815
- name: m,
2811
+ d,
2812
+ f,
2813
+ p
2814
+ ]), S = a ? /* @__PURE__ */ Z(u, { size: 12 }) : g ? /* @__PURE__ */ Z(t, {
2815
+ name: g,
2816
2816
  size: 12
2817
2817
  }) : null;
2818
- return /* @__PURE__ */ Q(X, { children: [y && e.reason && /* @__PURE__ */ Z("span", {
2819
- id: y,
2818
+ return /* @__PURE__ */ Q(X, { children: [b && e.reason && /* @__PURE__ */ Z("span", {
2819
+ id: b,
2820
2820
  role: "tooltip",
2821
2821
  style: {
2822
2822
  position: "absolute",
@@ -2826,72 +2826,72 @@ function Rr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
2826
2826
  clip: "rect(0,0,0,0)"
2827
2827
  },
2828
2828
  children: e.reason
2829
- }), /* @__PURE__ */ Z(_, {
2829
+ }), /* @__PURE__ */ Z(l, {
2830
2830
  ref: s,
2831
- kind: g ? "primary" : "default",
2832
- danger: h,
2833
- icon: x,
2834
- disabled: v || a,
2835
- "aria-disabled": v ? "true" : void 0,
2836
- "aria-describedby": y,
2837
- title: or(f, p, v, e.reason),
2838
- onClick: b,
2831
+ kind: v ? "primary" : "default",
2832
+ danger: _,
2833
+ icon: S,
2834
+ disabled: y || a,
2835
+ "aria-disabled": y ? "true" : void 0,
2836
+ "aria-describedby": b,
2837
+ title: or(m, h, y, e.reason),
2838
+ onClick: x,
2839
2839
  style: c,
2840
- children: p
2840
+ children: h
2841
2841
  })] });
2842
2842
  }
2843
- function zr({ group: r, entityActions: i, globalActions: a, onRun: o, loading: s, onLoadingChange: c, measureRef: l, style: u }) {
2844
- let d = J(null), [f, p] = Y(!1), m = r.name ? S(r.name) : "Actions", h = G((e) => {
2845
- d.current = e, l?.(e);
2846
- }, [l]), g = G((e, t) => (p(!1), o(e, t)), [o]);
2847
- return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(_, {
2848
- ref: h,
2843
+ function zr({ group: n, entityActions: r, globalActions: i, onRun: a, loading: o, onLoadingChange: c, measureRef: d, style: f }) {
2844
+ let p = J(null), [m, h] = Y(!1), g = n.name ? W(n.name) : "Actions", _ = G((e) => {
2845
+ p.current = e, d?.(e);
2846
+ }, [d]), v = G((e, t) => (h(!1), a(e, t)), [a]);
2847
+ return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(l, {
2848
+ ref: _,
2849
2849
  kind: "default",
2850
- icon: s == null ? r.icon ? /* @__PURE__ */ Z(t, {
2851
- name: r.icon,
2850
+ icon: o == null ? n.icon ? /* @__PURE__ */ Z(t, {
2851
+ name: n.icon,
2852
2852
  size: 12
2853
- }) : void 0 : /* @__PURE__ */ Z(j, { size: 12 }),
2853
+ }) : void 0 : /* @__PURE__ */ Z(u, { size: 12 }),
2854
2854
  iconRight: /* @__PURE__ */ Z(e.down, { size: 10 }),
2855
2855
  "aria-haspopup": "menu",
2856
- "aria-expanded": f ? "true" : "false",
2857
- title: m,
2858
- onClick: () => p((e) => !e),
2859
- style: u,
2860
- children: m
2861
- }), /* @__PURE__ */ Z(n, {
2862
- open: f,
2863
- anchor: d.current,
2864
- onClose: () => p(!1),
2856
+ "aria-expanded": m ? "true" : "false",
2857
+ title: g,
2858
+ onClick: () => h((e) => !e),
2859
+ style: f,
2860
+ children: g
2861
+ }), /* @__PURE__ */ Z(s, {
2862
+ open: m,
2863
+ anchor: p.current,
2864
+ onClose: () => h(!1),
2865
2865
  align: "start",
2866
2866
  width: 200,
2867
2867
  children: /* @__PURE__ */ Z("div", {
2868
2868
  role: "menu",
2869
- "aria-label": m,
2870
- children: r.items.map((e) => e.kind === "action" ? /* @__PURE__ */ Z(Br, {
2869
+ "aria-label": g,
2870
+ children: n.items.map((e) => e.kind === "action" ? /* @__PURE__ */ Z(Br, {
2871
2871
  leaf: e,
2872
- entityActions: i,
2873
- globalActions: a,
2874
- onRun: g,
2875
- loading: s === e.code,
2872
+ entityActions: r,
2873
+ globalActions: i,
2874
+ onRun: v,
2875
+ loading: o === e.code,
2876
2876
  onLoadingChange: (t) => c(t ? e.code : null)
2877
2877
  }, e.code) : /* @__PURE__ */ Z(Vr, {
2878
2878
  group: e,
2879
- entityActions: i,
2880
- globalActions: a,
2881
- onRun: g,
2882
- loading: s,
2879
+ entityActions: r,
2880
+ globalActions: i,
2881
+ onRun: v,
2882
+ loading: o,
2883
2883
  onLoadingChange: c
2884
2884
  }, e.items[0]?.kind === "action" ? e.items[0].code : e.icon ?? "group"))
2885
2885
  })
2886
2886
  })] });
2887
2887
  }
2888
2888
  function Br({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a, onLoadingChange: o, row: s, widgetContext: c, onActionClick: l }) {
2889
- let u = Pr(e.code, n, r), d = Fr(e.code, n, r), f = Ir(e.code, n, r), p = u?.destructive ?? !1, m = !e.enabled, h = m ? Lr(e.code) : void 0, g = a ? /* @__PURE__ */ Z(j, { size: 12 }) : f ? /* @__PURE__ */ Z(t, {
2890
- name: f,
2889
+ let d = Pr(e.code, n, r), f = Fr(e.code, n, r), p = Ir(e.code, n, r), m = d?.destructive ?? !1, h = !e.enabled, g = h ? Lr(e.code) : void 0, _ = a ? /* @__PURE__ */ Z(u, { size: 12 }) : p ? /* @__PURE__ */ Z(t, {
2890
+ name: p,
2891
2891
  size: 12
2892
2892
  }) : null;
2893
- return /* @__PURE__ */ Q(X, { children: [h && e.reason && /* @__PURE__ */ Z("span", {
2894
- id: h,
2893
+ return /* @__PURE__ */ Q(X, { children: [g && e.reason && /* @__PURE__ */ Z("span", {
2894
+ id: g,
2895
2895
  role: "tooltip",
2896
2896
  style: {
2897
2897
  position: "absolute",
@@ -2903,14 +2903,14 @@ function Br({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
2903
2903
  children: e.reason
2904
2904
  }), /* @__PURE__ */ Q("div", {
2905
2905
  role: "menuitem",
2906
- "aria-disabled": m ? "true" : void 0,
2907
- "aria-describedby": h,
2908
- title: or(u, d, m, e.reason),
2906
+ "aria-disabled": h ? "true" : void 0,
2907
+ "aria-describedby": g,
2908
+ title: or(d, f, h, e.reason),
2909
2909
  onClick: async () => {
2910
- if (!(!u || m || a)) {
2910
+ if (!(!d || h || a)) {
2911
2911
  o(!0);
2912
2912
  try {
2913
- Ar(e.code, u, s, c, l) || await Promise.resolve(i(e.code, u));
2913
+ Ar(e.code, d, s, c, l) || await Promise.resolve(i(e.code, d));
2914
2914
  } finally {
2915
2915
  o(!1);
2916
2916
  }
@@ -2923,30 +2923,30 @@ function Br({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
2923
2923
  padding: "6px 10px",
2924
2924
  borderRadius: 5,
2925
2925
  fontSize: 12.5,
2926
- color: p ? "var(--danger)" : m ? "var(--text-3)" : "var(--text-2)",
2927
- cursor: m ? "not-allowed" : "pointer",
2928
- opacity: m ? .6 : 1
2926
+ color: m ? "var(--danger)" : h ? "var(--text-3)" : "var(--text-2)",
2927
+ cursor: h ? "not-allowed" : "pointer",
2928
+ opacity: h ? .6 : 1
2929
2929
  },
2930
2930
  onMouseEnter: (e) => {
2931
- m || (e.currentTarget.style.background = "var(--surface-3)");
2931
+ h || (e.currentTarget.style.background = "var(--surface-3)");
2932
2932
  },
2933
2933
  onMouseLeave: (e) => {
2934
2934
  e.currentTarget.style.background = "transparent";
2935
2935
  },
2936
- children: [g && /* @__PURE__ */ Z("span", {
2936
+ children: [_ && /* @__PURE__ */ Z("span", {
2937
2937
  style: {
2938
- color: p ? "var(--danger)" : "var(--text-3)",
2938
+ color: m ? "var(--danger)" : "var(--text-3)",
2939
2939
  display: "flex"
2940
2940
  },
2941
- children: g
2941
+ children: _
2942
2942
  }), /* @__PURE__ */ Z("span", {
2943
2943
  style: { flex: 1 },
2944
- children: d
2944
+ children: f
2945
2945
  })]
2946
2946
  })] });
2947
2947
  }
2948
2948
  function Vr({ group: e, entityActions: t, globalActions: n, onRun: r, loading: i, onLoadingChange: a, row: o, widgetContext: s, onActionClick: c }) {
2949
- let l = e.name ? S(e.name) : void 0;
2949
+ let l = e.name ? W(e.name) : void 0;
2950
2950
  return /* @__PURE__ */ Q(X, { children: [l && /* @__PURE__ */ Z("div", {
2951
2951
  style: {
2952
2952
  padding: "4px 10px 2px",
@@ -2979,66 +2979,66 @@ function Vr({ group: e, entityActions: t, globalActions: n, onRun: r, loading: i
2979
2979
  onActionClick: c
2980
2980
  }, e.icon ?? "nested"))] });
2981
2981
  }
2982
- function Hr({ layout: t, entityActions: r, globalActions: i, onRun: a, trailingNormalItems: o, trailingDestructiveItems: s, row: c, widgetContext: l, onActionClick: d }) {
2983
- let f = J(null), [p, h] = Y(!1), [g, _] = Y(null), v = G((e, t) => (h(!1), a(e, t)), [a]), y = o != null && o !== !1, b = s != null && s !== !1;
2984
- if (jr(t) === 0 && !y && !b) return null;
2985
- let { normal: x, destructive: S } = Mr(t, r, i), C = S.length > 0 || b;
2982
+ function Hr({ layout: t, entityActions: n, globalActions: r, onRun: i, trailingNormalItems: a, trailingDestructiveItems: c, row: l, widgetContext: d, onActionClick: f }) {
2983
+ let m = J(null), [h, g] = Y(!1), [_, v] = Y(null), y = G((e, t) => (g(!1), i(e, t)), [i]), b = a != null && a !== !1, x = c != null && c !== !1;
2984
+ if (jr(t) === 0 && !b && !x) return null;
2985
+ let { normal: S, destructive: C } = Mr(t, n, r), w = C.length > 0 || x;
2986
2986
  return /* @__PURE__ */ Q("div", {
2987
2987
  style: {
2988
2988
  display: "inline-flex",
2989
2989
  alignItems: "center"
2990
2990
  },
2991
- children: [/* @__PURE__ */ Z(m, {
2992
- ref: f,
2993
- icon: Z(g == null ? e.more : j, { size: 14 }),
2991
+ children: [/* @__PURE__ */ Z(o, {
2992
+ ref: m,
2993
+ icon: Z(_ == null ? e.more : u, { size: 14 }),
2994
2994
  title: "Actions",
2995
2995
  size: 28,
2996
- onClick: () => h((e) => !e)
2997
- }), /* @__PURE__ */ Z(n, {
2998
- open: p,
2999
- anchor: f.current,
3000
- onClose: () => h(!1),
2996
+ onClick: () => g((e) => !e)
2997
+ }), /* @__PURE__ */ Z(s, {
2998
+ open: h,
2999
+ anchor: m.current,
3000
+ onClose: () => g(!1),
3001
3001
  align: "end",
3002
3002
  width: 220,
3003
3003
  children: /* @__PURE__ */ Q("div", {
3004
3004
  role: "menu",
3005
3005
  "aria-label": "Row actions",
3006
3006
  children: [
3007
- x.map((e) => e.kind === "action" ? /* @__PURE__ */ Z(Br, {
3007
+ S.map((e) => e.kind === "action" ? /* @__PURE__ */ Z(Br, {
3008
3008
  leaf: e,
3009
- entityActions: r,
3010
- globalActions: i,
3011
- onRun: v,
3012
- loading: g === e.code,
3013
- onLoadingChange: (t) => _(t ? e.code : null),
3014
- row: c,
3015
- widgetContext: l,
3016
- onActionClick: d
3009
+ entityActions: n,
3010
+ globalActions: r,
3011
+ onRun: y,
3012
+ loading: _ === e.code,
3013
+ onLoadingChange: (t) => v(t ? e.code : null),
3014
+ row: l,
3015
+ widgetContext: d,
3016
+ onActionClick: f
3017
3017
  }, e.code) : /* @__PURE__ */ Z(Vr, {
3018
3018
  group: e,
3019
- entityActions: r,
3020
- globalActions: i,
3021
- onRun: v,
3022
- loading: g,
3023
- onLoadingChange: _,
3024
- row: c,
3025
- widgetContext: l,
3026
- onActionClick: d
3019
+ entityActions: n,
3020
+ globalActions: r,
3021
+ onRun: y,
3022
+ loading: _,
3023
+ onLoadingChange: v,
3024
+ row: l,
3025
+ widgetContext: d,
3026
+ onActionClick: f
3027
3027
  }, e.icon ?? "group")),
3028
- y && o,
3029
- C && /* @__PURE__ */ Z(u, { divider: !0 }),
3030
- S.map((e) => /* @__PURE__ */ Z(Br, {
3028
+ b && a,
3029
+ w && /* @__PURE__ */ Z(p, { divider: !0 }),
3030
+ C.map((e) => /* @__PURE__ */ Z(Br, {
3031
3031
  leaf: e,
3032
- entityActions: r,
3033
- globalActions: i,
3034
- onRun: v,
3035
- loading: g === e.code,
3036
- onLoadingChange: (t) => _(t ? e.code : null),
3037
- row: c,
3038
- widgetContext: l,
3039
- onActionClick: d
3032
+ entityActions: n,
3033
+ globalActions: r,
3034
+ onRun: y,
3035
+ loading: _ === e.code,
3036
+ onLoadingChange: (t) => v(t ? e.code : null),
3037
+ row: l,
3038
+ widgetContext: d,
3039
+ onActionClick: f
3040
3040
  }, e.code)),
3041
- b && s
3041
+ x && c
3042
3042
  ]
3043
3043
  })
3044
3044
  })]
@@ -3064,65 +3064,65 @@ function Kr(e, t, n, r, i, a, o) {
3064
3064
  };
3065
3065
  }
3066
3066
  function qr(e) {
3067
- return e.kind === "action" ? `action:${e.code}` : `group:${e.name ? S(e.name) : ""}`;
3067
+ return e.kind === "action" ? `action:${e.code}` : `group:${e.name ? W(e.name) : ""}`;
3068
3068
  }
3069
- function Jr({ layout: r, entityActions: i, globalActions: a, onRun: o, reservedRightWidth: s = 0, measurementOverride: c, ariaLabel: l = "Actions", align: u = "trailing", constrain: d = !0, row: f, widgetContext: p, onActionClick: m }) {
3070
- let h = J(null), g = J(null), [v, y] = Y(0), [b, x] = Y(/* @__PURE__ */ new Map()), [C, w] = Y(!1), [T, E] = Y(null), [D, O] = Y(() => typeof document < "u" && document.documentElement.dir === "rtl");
3069
+ function Jr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedRightWidth: o = 0, measurementOverride: c, ariaLabel: u = "Actions", align: d = "trailing", constrain: f = !0, row: p, widgetContext: m, onActionClick: h }) {
3070
+ let g = J(null), _ = J(null), [v, y] = Y(0), [b, x] = Y(/* @__PURE__ */ new Map()), [S, C] = Y(!1), [w, T] = Y(null), [E, D] = Y(() => typeof document < "u" && document.documentElement.dir === "rtl");
3071
3071
  K(() => {
3072
3072
  if (typeof MutationObserver > "u") return;
3073
3073
  let e = new MutationObserver((e) => {
3074
- for (let t of e) t.attributeName === "dir" && O(document.documentElement.dir === "rtl"), t.attributeName === "lang" && w(!1);
3074
+ for (let t of e) t.attributeName === "dir" && D(document.documentElement.dir === "rtl"), t.attributeName === "lang" && C(!1);
3075
3075
  });
3076
3076
  return e.observe(document.documentElement, {
3077
3077
  attributes: !0,
3078
3078
  attributeFilter: ["dir", "lang"]
3079
3079
  }), () => e.disconnect();
3080
3080
  }, []);
3081
- let k = J(null), [A, j] = Y(!1), M = G((e, t) => (j(!1), o(e, t)), [o]), N = jr(r), P = !!c, F = G(() => {
3082
- if (P || !g.current) return;
3083
- let e = Array.from(g.current.children), t = /* @__PURE__ */ new Map();
3081
+ let O = J(null), [k, A] = Y(!1), j = G((e, t) => (A(!1), a(e, t)), [a]), M = jr(n), N = !!c, P = G(() => {
3082
+ if (N || !_.current) return;
3083
+ let e = Array.from(_.current.children), t = /* @__PURE__ */ new Map();
3084
3084
  e.forEach((e) => {
3085
3085
  let n = e.dataset.nodeKey;
3086
3086
  n && t.set(n, e.getBoundingClientRect().width || e.offsetWidth);
3087
- }), x(t), w(!0);
3088
- }, [P]);
3087
+ }), x(t), C(!0);
3088
+ }, [N]);
3089
3089
  Me(() => {
3090
- if (P) {
3091
- w(!0);
3090
+ if (N) {
3091
+ C(!0);
3092
3092
  return;
3093
3093
  }
3094
- w(!1);
3094
+ C(!1);
3095
3095
  let e = requestAnimationFrame(() => {
3096
- F();
3096
+ P();
3097
3097
  });
3098
3098
  return () => cancelAnimationFrame(e);
3099
3099
  }, [
3100
- q(() => JSON.stringify(r.map((e) => qr(e))), [r]),
3101
- F,
3102
- P
3100
+ q(() => JSON.stringify(n.map((e) => qr(e))), [n]),
3101
+ P,
3102
+ N
3103
3103
  ]), K(() => {
3104
- if (P || C) return;
3104
+ if (N || S) return;
3105
3105
  let e = setTimeout(() => {
3106
- F(), w(!0);
3106
+ P(), C(!0);
3107
3107
  }, 16);
3108
3108
  return () => clearTimeout(e);
3109
3109
  }, [
3110
- C,
3111
- F,
3112
- P
3110
+ S,
3111
+ P,
3112
+ N
3113
3113
  ]), K(() => {
3114
- if (P || !d || !C || v === 0) return;
3114
+ if (N || !f || !S || v === 0) return;
3115
3115
  let e = [...b.entries()].filter(([e]) => e !== Ur).reduce((e, [, t]) => e + t, 0);
3116
3116
  e > 0 && v <= e && console.error(`[declarion] ResponsiveActionBar has no room to measure: its container is ${Math.round(v)}px and its buttons are ${Math.round(e)}px. The slot holding this bar is sized by its own content, so the bar is measuring itself. Give that slot \`flex: 1 1 auto; min-width: 0\` (and justify its content to the edge the buttons sit on), or pass \`constrain={false}\` if it genuinely has no row to take space from.`);
3117
3117
  }, [
3118
- P,
3119
- d,
3120
- C,
3118
+ N,
3119
+ f,
3120
+ S,
3121
3121
  v,
3122
3122
  b
3123
3123
  ]), K(() => {
3124
- if (P) return;
3125
- let e = h.current;
3124
+ if (N) return;
3125
+ let e = g.current;
3126
3126
  if (!e) return;
3127
3127
  if (typeof ResizeObserver > "u") {
3128
3128
  y(e.getBoundingClientRect().width);
@@ -3133,45 +3133,45 @@ function Jr({ layout: r, entityActions: i, globalActions: a, onRun: o, reservedR
3133
3133
  t && y(t.contentRect.width);
3134
3134
  });
3135
3135
  return t.observe(e), y(e.getBoundingClientRect().width), () => t.disconnect();
3136
- }, [P]);
3137
- let I = q(() => P || !d ? Kr(r, 2 ** 53 - 1, s, b, i, a, c) : C ? v === 0 ? Kr(r, 2 ** 53 - 1, s, b, i, a, c) : Kr(r, v, s, b, i, a, c) : {
3136
+ }, [N]);
3137
+ let F = q(() => N || !f ? Kr(n, 2 ** 53 - 1, o, b, r, i, c) : S ? v === 0 ? Kr(n, 2 ** 53 - 1, o, b, r, i, c) : Kr(n, v, o, b, r, i, c) : {
3138
3138
  primaryInline: [],
3139
3139
  inline: [],
3140
3140
  overflow: [],
3141
3141
  destructiveInline: []
3142
3142
  }, [
3143
- P,
3144
- d,
3145
- C,
3143
+ N,
3144
+ f,
3145
+ S,
3146
3146
  v,
3147
- r,
3148
- s,
3147
+ n,
3148
+ o,
3149
3149
  b,
3150
+ r,
3150
3151
  i,
3151
- a,
3152
3152
  c
3153
3153
  ]);
3154
- if (N === 0) return null;
3155
- let ee = I.overflow.length > 0;
3154
+ if (M === 0) return null;
3155
+ let I = F.overflow.length > 0;
3156
3156
  return /* @__PURE__ */ Q("div", {
3157
- ref: h,
3157
+ ref: g,
3158
3158
  role: "toolbar",
3159
- "aria-label": l,
3159
+ "aria-label": u,
3160
3160
  style: {
3161
3161
  display: "flex",
3162
- flexDirection: D ? "row-reverse" : "row",
3162
+ flexDirection: E ? "row-reverse" : "row",
3163
3163
  alignItems: "center",
3164
3164
  gap: 4,
3165
- visibility: C || P ? "visible" : "hidden",
3165
+ visibility: S || N ? "visible" : "hidden",
3166
3166
  position: "relative",
3167
- flex: d ? "1 1 auto" : "0 1 auto",
3168
- justifyContent: u === "trailing" ? "flex-end" : "flex-start",
3167
+ flex: f ? "1 1 auto" : "0 1 auto",
3168
+ justifyContent: d === "trailing" ? "flex-end" : "flex-start",
3169
3169
  minWidth: 0,
3170
3170
  boxSizing: "border-box"
3171
3171
  },
3172
3172
  children: [
3173
3173
  /* @__PURE__ */ Q("div", {
3174
- ref: g,
3174
+ ref: _,
3175
3175
  "aria-hidden": "true",
3176
3176
  style: {
3177
3177
  position: "absolute",
@@ -3182,17 +3182,17 @@ function Jr({ layout: r, entityActions: i, globalActions: a, onRun: o, reservedR
3182
3182
  top: 0,
3183
3183
  left: 0
3184
3184
  },
3185
- children: [/* @__PURE__ */ Z(_, {
3185
+ children: [/* @__PURE__ */ Z(l, {
3186
3186
  "data-node-key": Ur,
3187
3187
  iconRight: /* @__PURE__ */ Z(e.down, { size: 10 }),
3188
3188
  tabIndex: -1,
3189
3189
  children: "Actions"
3190
- }, Ur), r.map((n) => {
3191
- let r = qr(n);
3190
+ }, Ur), n.map((n) => {
3191
+ let a = qr(n);
3192
3192
  if (n.kind === "action") {
3193
- let e = Pr(n.code, i, a), o = Fr(n.code, i, a), s = Ir(n.code, i, a);
3194
- return /* @__PURE__ */ Z(_, {
3195
- "data-node-key": r,
3193
+ let e = Pr(n.code, r, i), o = Fr(n.code, r, i), s = Ir(n.code, r, i);
3194
+ return /* @__PURE__ */ Z(l, {
3195
+ "data-node-key": a,
3196
3196
  icon: s ? /* @__PURE__ */ Z(t, {
3197
3197
  name: s,
3198
3198
  size: 12
@@ -3200,97 +3200,97 @@ function Jr({ layout: r, entityActions: i, globalActions: a, onRun: o, reservedR
3200
3200
  danger: e?.destructive,
3201
3201
  tabIndex: -1,
3202
3202
  children: o
3203
- }, r);
3203
+ }, a);
3204
3204
  } else {
3205
- let t = n.name ? S(n.name) : "Actions";
3206
- return /* @__PURE__ */ Z(_, {
3207
- "data-node-key": r,
3205
+ let t = n.name ? W(n.name) : "Actions";
3206
+ return /* @__PURE__ */ Z(l, {
3207
+ "data-node-key": a,
3208
3208
  iconRight: /* @__PURE__ */ Z(e.down, { size: 10 }),
3209
3209
  tabIndex: -1,
3210
3210
  children: t
3211
- }, r);
3211
+ }, a);
3212
3212
  }
3213
3213
  })]
3214
3214
  }),
3215
- I.primaryInline.map((e) => /* @__PURE__ */ Z(Rr, {
3215
+ F.primaryInline.map((e) => /* @__PURE__ */ Z(Rr, {
3216
3216
  leaf: e,
3217
- entityActions: i,
3218
- globalActions: a,
3219
- onRun: o,
3220
- loading: T === e.code,
3221
- onLoadingChange: (t) => E(t ? e.code : null),
3222
- row: f,
3223
- widgetContext: p,
3224
- onActionClick: m
3217
+ entityActions: r,
3218
+ globalActions: i,
3219
+ onRun: a,
3220
+ loading: w === e.code,
3221
+ onLoadingChange: (t) => T(t ? e.code : null),
3222
+ row: p,
3223
+ widgetContext: m,
3224
+ onActionClick: h
3225
3225
  }, qr(e))),
3226
- I.inline.map((e) => {
3226
+ F.inline.map((e) => {
3227
3227
  let t = qr(e);
3228
3228
  return e.kind === "action" ? /* @__PURE__ */ Z(Rr, {
3229
3229
  leaf: e,
3230
- entityActions: i,
3231
- globalActions: a,
3232
- onRun: o,
3233
- loading: T === e.code,
3234
- onLoadingChange: (t) => E(t ? e.code : null),
3235
- row: f,
3236
- widgetContext: p,
3237
- onActionClick: m
3230
+ entityActions: r,
3231
+ globalActions: i,
3232
+ onRun: a,
3233
+ loading: w === e.code,
3234
+ onLoadingChange: (t) => T(t ? e.code : null),
3235
+ row: p,
3236
+ widgetContext: m,
3237
+ onActionClick: h
3238
3238
  }, t) : /* @__PURE__ */ Z(zr, {
3239
3239
  group: e,
3240
- entityActions: i,
3241
- globalActions: a,
3242
- onRun: o,
3243
- loading: T,
3244
- onLoadingChange: E
3240
+ entityActions: r,
3241
+ globalActions: i,
3242
+ onRun: a,
3243
+ loading: w,
3244
+ onLoadingChange: T
3245
3245
  }, t);
3246
3246
  }),
3247
- ee && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(_, {
3248
- ref: k,
3247
+ I && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(l, {
3248
+ ref: O,
3249
3249
  kind: "default",
3250
3250
  iconRight: /* @__PURE__ */ Z(e.down, { size: 10 }),
3251
3251
  "aria-haspopup": "menu",
3252
- "aria-expanded": A ? "true" : "false",
3253
- onClick: () => j((e) => !e),
3252
+ "aria-expanded": k ? "true" : "false",
3253
+ onClick: () => A((e) => !e),
3254
3254
  children: "Actions"
3255
- }), /* @__PURE__ */ Z(n, {
3256
- open: A,
3257
- anchor: k.current,
3258
- onClose: () => j(!1),
3259
- align: D ? "start" : "end",
3255
+ }), /* @__PURE__ */ Z(s, {
3256
+ open: k,
3257
+ anchor: O.current,
3258
+ onClose: () => A(!1),
3259
+ align: E ? "start" : "end",
3260
3260
  width: 220,
3261
3261
  children: /* @__PURE__ */ Z("div", {
3262
3262
  role: "menu",
3263
3263
  "aria-label": "More actions",
3264
- children: I.overflow.map((e) => e.kind === "action" ? /* @__PURE__ */ Z(Br, {
3264
+ children: F.overflow.map((e) => e.kind === "action" ? /* @__PURE__ */ Z(Br, {
3265
3265
  leaf: e,
3266
- entityActions: i,
3267
- globalActions: a,
3268
- onRun: M,
3269
- loading: T === e.code,
3270
- onLoadingChange: (t) => E(t ? e.code : null),
3271
- row: f,
3272
- widgetContext: p,
3273
- onActionClick: m
3266
+ entityActions: r,
3267
+ globalActions: i,
3268
+ onRun: j,
3269
+ loading: w === e.code,
3270
+ onLoadingChange: (t) => T(t ? e.code : null),
3271
+ row: p,
3272
+ widgetContext: m,
3273
+ onActionClick: h
3274
3274
  }, e.code) : /* @__PURE__ */ Z(Vr, {
3275
3275
  group: e,
3276
- entityActions: i,
3277
- globalActions: a,
3278
- onRun: M,
3279
- loading: T,
3280
- onLoadingChange: E
3276
+ entityActions: r,
3277
+ globalActions: i,
3278
+ onRun: j,
3279
+ loading: w,
3280
+ onLoadingChange: T
3281
3281
  }, qr(e)))
3282
3282
  })
3283
3283
  })] }),
3284
- I.destructiveInline.map((e) => /* @__PURE__ */ Z(Rr, {
3284
+ F.destructiveInline.map((e) => /* @__PURE__ */ Z(Rr, {
3285
3285
  leaf: e,
3286
- entityActions: i,
3287
- globalActions: a,
3288
- onRun: o,
3289
- loading: T === e.code,
3290
- onLoadingChange: (t) => E(t ? e.code : null),
3291
- row: f,
3292
- widgetContext: p,
3293
- onActionClick: m
3286
+ entityActions: r,
3287
+ globalActions: i,
3288
+ onRun: a,
3289
+ loading: w === e.code,
3290
+ onLoadingChange: (t) => T(t ? e.code : null),
3291
+ row: p,
3292
+ widgetContext: m,
3293
+ onActionClick: h
3294
3294
  }, qr(e)))
3295
3295
  ]
3296
3296
  });
@@ -3362,7 +3362,7 @@ function Xr({ layout: e, row: t, rowSelection: n, onRun: r, reservedRightWidth:
3362
3362
  //#endregion
3363
3363
  //#region src/lib/action-dispatch.ts
3364
3364
  function Zr(e, t, n, r) {
3365
- return w(t) ? (oe(t.ui_steps, n), null) : t.entity ? `${t.entity}.${e}` : r ? `${r}.${e}` : e;
3365
+ return ne(t) ? (E(t.ui_steps, n), null) : t.entity ? `${t.entity}.${e}` : r ? `${r}.${e}` : e;
3366
3366
  }
3367
3367
  //#endregion
3368
3368
  //#region src/components/detail-layout/AssociatedBlock.tsx
@@ -3391,7 +3391,7 @@ function $r(e, t, n) {
3391
3391
  let n = a.resolved_params.items().filter((e) => e.name !== t);
3392
3392
  e = {
3393
3393
  ...e,
3394
- resolved_params: new de(n)
3394
+ resolved_params: new le(n)
3395
3395
  };
3396
3396
  }
3397
3397
  r.push({
@@ -3424,7 +3424,7 @@ function ei(e, t, n) {
3424
3424
  return null;
3425
3425
  }
3426
3426
  function ti(e, t, n) {
3427
- let r = new Set(U(e));
3427
+ let r = new Set(z(e));
3428
3428
  return new Set(t.filter((t) => {
3429
3429
  if (t === n || r.has(t)) return !1;
3430
3430
  let i = e.fields.get(t);
@@ -3486,52 +3486,52 @@ function ai({ node: n, ctx: r, assocCode: i, assocEntity: a, fkField: o }) {
3486
3486
  if (e === o) return !1;
3487
3487
  let t = a.fields.get(e);
3488
3488
  return !(!t || t.primary || t.display?.is_listable === !1);
3489
- }), c = V(a, "update"), l = n.interaction ?? (c ? "navigate" : "readonly"), u = (l === "inline_edit" || l === "row_edit") && c && n.editable !== !1, d = S(a.display?.name_plural) || S(a.display?.name) || i, f = n.searchable === !0 || n.filters && n.filters.length > 0, p = q(() => $r(a.actions, o, r.recordId), [
3489
+ }), c = y(a, "update"), u = n.interaction ?? (c ? "navigate" : "readonly"), d = (u === "inline_edit" || u === "row_edit") && c && n.editable !== !1, f = W(a.display?.name_plural) || W(a.display?.name) || i, p = n.searchable === !0 || n.filters && n.filters.length > 0, m = q(() => $r(a.actions, o, r.recordId), [
3490
3490
  a.actions,
3491
3491
  o,
3492
3492
  r.recordId
3493
- ]), m = q(() => {
3493
+ ]), h = q(() => {
3494
3494
  let e = {};
3495
- for (let { code: t, action: n } of p) e[t] = n;
3495
+ for (let { code: t, action: n } of m) e[t] = n;
3496
3496
  return e;
3497
- }, [p]), h = q(() => lr(a.action_layout ?? null ?? Cr(m, "list_toolbar"), m, void 0, {}, []), [a.action_layout, m]), { run: g } = R(), v = It(), y = ne(), b = q(() => ({
3497
+ }, [m]), g = q(() => lr(a.action_layout ?? null ?? Cr(h, "list_toolbar"), h, void 0, {}, []), [a.action_layout, h]), { run: _ } = N(), v = It(), b = j(), x = q(() => ({
3498
3498
  entity: a,
3499
3499
  entityCode: i,
3500
3500
  screenRoute: typeof window < "u" ? window.location.pathname : "",
3501
3501
  selectedRows: [],
3502
3502
  selectedIds: [],
3503
- locale: y,
3503
+ locale: b,
3504
3504
  tabNavigate: (e, t) => v(e, {
3505
3505
  title: t?.title,
3506
3506
  icon: t?.icon,
3507
3507
  search: t?.search
3508
3508
  }),
3509
- runActionApi: (e, t) => A(e, t)
3509
+ runActionApi: (e, t) => te(e, t)
3510
3510
  }), [
3511
3511
  a,
3512
3512
  i,
3513
- y,
3513
+ b,
3514
3514
  v
3515
- ]), x = Re(), C = G(() => {
3516
- x.invalidateQueries({ predicate: (e) => {
3515
+ ]), S = Re(), C = G(() => {
3516
+ S.invalidateQueries({ predicate: (e) => {
3517
3517
  let t = e.queryKey;
3518
3518
  return t[0] === "entity-children" && t[3] === i;
3519
3519
  } });
3520
- }, [x, i]), w = G((e, t) => {
3520
+ }, [S, i]), w = G((e, t) => {
3521
3521
  let n = Zr(e, t, {}, i);
3522
- if (n !== null) return g({
3522
+ if (n !== null) return _({
3523
3523
  action: t,
3524
- title: S(t.display?.name) || e,
3524
+ title: W(t.display?.name) || e,
3525
3525
  execute: async (e) => {
3526
- let t = await A(n, E(e, void 0));
3526
+ let t = await te(n, B(e, void 0));
3527
3527
  return C(), t;
3528
3528
  }
3529
3529
  });
3530
3530
  }, [
3531
- g,
3531
+ _,
3532
3532
  i,
3533
3533
  C
3534
- ]), [T, D] = Y(0), O = /* @__PURE__ */ Q("div", {
3534
+ ]), [T, E] = Y(0), D = /* @__PURE__ */ Q("div", {
3535
3535
  style: {
3536
3536
  display: "flex",
3537
3537
  alignItems: "center",
@@ -3540,36 +3540,36 @@ function ai({ node: n, ctx: r, assocCode: i, assocEntity: a, fkField: o }) {
3540
3540
  minWidth: 0,
3541
3541
  justifyContent: "flex-end"
3542
3542
  },
3543
- children: [a.action_layout ? h.length > 0 && /* @__PURE__ */ Z(Xr, {
3543
+ children: [a.action_layout ? g.length > 0 && /* @__PURE__ */ Z(Xr, {
3544
3544
  kind: "toolbar",
3545
- layout: h,
3546
- entityActions: m,
3545
+ layout: g,
3546
+ entityActions: h,
3547
3547
  onRun: w,
3548
- widgetContext: b,
3549
- ariaLabel: `${d} toolbar actions`
3550
- }) : p.map(({ code: e, action: t }) => /* @__PURE__ */ Z(wr, {
3548
+ widgetContext: x,
3549
+ ariaLabel: `${f} toolbar actions`
3550
+ }) : m.map(({ code: e, action: t }) => /* @__PURE__ */ Z(wr, {
3551
3551
  actionCode: e,
3552
3552
  action: t,
3553
3553
  entityCode: i,
3554
3554
  variant: "ghost",
3555
3555
  size: "sm",
3556
3556
  onSuccess: C
3557
- }, e)), u && /* @__PURE__ */ Z(_, {
3557
+ }, e)), d && /* @__PURE__ */ Z(l, {
3558
3558
  kind: "ghost",
3559
3559
  size: "xs",
3560
3560
  icon: /* @__PURE__ */ Z(e.plus, { size: 12 }),
3561
- onClick: () => D((e) => e + 1),
3561
+ onClick: () => E((e) => e + 1),
3562
3562
  children: "Add row"
3563
3563
  })]
3564
- }), k = f ? /* @__PURE__ */ Z(si, {
3564
+ }), O = p ? /* @__PURE__ */ Z(si, {
3565
3565
  entityCode: i,
3566
3566
  entity: a,
3567
3567
  parentEntity: r.entityCode,
3568
3568
  parentId: r.recordId,
3569
3569
  foreignKey: o,
3570
3570
  columns: s,
3571
- editable: u,
3572
- interaction: l,
3571
+ editable: d,
3572
+ interaction: u,
3573
3573
  ctx: r,
3574
3574
  searchable: n.searchable,
3575
3575
  filterFields: n.filters,
@@ -3582,8 +3582,8 @@ function ai({ node: n, ctx: r, assocCode: i, assocEntity: a, fkField: o }) {
3582
3582
  parentId: r.recordId,
3583
3583
  foreignKey: o,
3584
3584
  columns: s,
3585
- editable: u,
3586
- interaction: l,
3585
+ editable: d,
3586
+ interaction: u,
3587
3587
  ctx: r,
3588
3588
  sort: n.sort,
3589
3589
  startDraftSignal: T
@@ -3594,15 +3594,15 @@ function ai({ node: n, ctx: r, assocCode: i, assocEntity: a, fkField: o }) {
3594
3594
  justifyContent: "flex-end",
3595
3595
  marginBottom: 8
3596
3596
  },
3597
- children: O
3598
- }), k] }) : /* @__PURE__ */ Z(Ue, {
3599
- title: d,
3597
+ children: D
3598
+ }), O] }) : /* @__PURE__ */ Z(Ue, {
3599
+ title: f,
3600
3600
  icon: a.display?.icon ? /* @__PURE__ */ Z(t, {
3601
3601
  name: a.display.icon,
3602
3602
  size: 14
3603
3603
  }) : void 0,
3604
- right: O,
3605
- children: k
3604
+ right: D,
3605
+ children: O
3606
3606
  });
3607
3607
  }
3608
3608
  function oi({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, sort: l, startDraftSignal: u }) {
@@ -3636,15 +3636,15 @@ function oi({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
3636
3636
  startDraftSignal: u
3637
3637
  });
3638
3638
  }
3639
- function si({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, searchable: l, filterFields: u, sort: d, startDraftSignal: f }) {
3640
- let p = Re(), [m, h] = Y(""), [g, v] = Y(""), [y, b] = Y({}), x = J(void 0);
3641
- K(() => (x.current && clearTimeout(x.current), x.current = setTimeout(() => {
3642
- v(m);
3639
+ function si({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, searchable: d, filterFields: f, sort: p, startDraftSignal: m }) {
3640
+ let h = Re(), [g, _] = Y(""), [v, y] = Y(""), [b, x] = Y({}), S = J(void 0);
3641
+ K(() => (S.current && clearTimeout(S.current), S.current = setTimeout(() => {
3642
+ y(g);
3643
3643
  }, 300), () => {
3644
- x.current && clearTimeout(x.current);
3645
- }), [m]);
3646
- let S = G((e, t) => {
3647
- b((n) => {
3644
+ S.current && clearTimeout(S.current);
3645
+ }), [g]);
3646
+ let C = G((e, t) => {
3647
+ x((n) => {
3648
3648
  if (t === "__all__") {
3649
3649
  let { [e]: t, ...r } = n;
3650
3650
  return r;
@@ -3654,13 +3654,13 @@ function si({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
3654
3654
  [e]: t
3655
3655
  };
3656
3656
  });
3657
- }, []), C = q(() => Object.keys(y).length > 0 ? y : void 0, [y]), { data: w, isLoading: T, isError: E, hasNextPage: D, fetchNextPage: O, isFetchingNextPage: k } = zn(n, r, e, i, d, void 0, g || void 0, C), { rows: A, refs: M } = q(() => {
3658
- if (!w?.pages) return {
3657
+ }, []), w = q(() => Object.keys(b).length > 0 ? b : void 0, [b]), { data: T, isLoading: E, isError: D, hasNextPage: O, fetchNextPage: k, isFetchingNextPage: A } = zn(n, r, e, i, p, void 0, v || void 0, w), { rows: j, refs: M } = q(() => {
3658
+ if (!T?.pages) return {
3659
3659
  rows: [],
3660
3660
  refs: void 0
3661
3661
  };
3662
3662
  let e = [], t;
3663
- for (let n of w.pages) if (e.push(...n.data), n.$refs) if (!t) t = { ...n.$refs };
3663
+ for (let n of T.pages) if (e.push(...n.data), n.$refs) if (!t) t = { ...n.$refs };
3664
3664
  else for (let [e, r] of Object.entries(n.$refs)) t[e] = {
3665
3665
  ...t[e],
3666
3666
  ...r
@@ -3669,21 +3669,21 @@ function si({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
3669
3669
  rows: e,
3670
3670
  refs: t
3671
3671
  };
3672
- }, [w]), N = G(() => {
3673
- p.invalidateQueries({ predicate: (t) => {
3672
+ }, [T]), N = G(() => {
3673
+ h.invalidateQueries({ predicate: (t) => {
3674
3674
  let n = t.queryKey;
3675
3675
  return n[0] === "entity-children" && n[3] === e;
3676
3676
  } });
3677
- }, [p, e]);
3677
+ }, [h, e]);
3678
3678
  return /* @__PURE__ */ Q("div", { children: [
3679
3679
  /* @__PURE__ */ Z(Er, {
3680
3680
  entity: t,
3681
- searchable: l,
3682
- filterFields: u,
3683
- searchValue: m,
3684
- onSearchChange: h,
3685
- filters: y,
3686
- onFilterChange: S,
3681
+ searchable: d,
3682
+ filterFields: f,
3683
+ searchValue: g,
3684
+ onSearchChange: _,
3685
+ filters: b,
3686
+ onFilterChange: C,
3687
3687
  allEntities: c.schema.entities
3688
3688
  }),
3689
3689
  /* @__PURE__ */ Z(ci, {
@@ -3695,65 +3695,65 @@ function si({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
3695
3695
  editable: o,
3696
3696
  interaction: s,
3697
3697
  ctx: c,
3698
- rows: A,
3698
+ rows: j,
3699
3699
  refs: M,
3700
- isLoading: T,
3701
- isError: E,
3700
+ isLoading: E,
3701
+ isError: D,
3702
3702
  invalidateQuery: N,
3703
- startDraftSignal: f
3703
+ startDraftSignal: m
3704
3704
  }),
3705
- D && /* @__PURE__ */ Z("div", {
3705
+ O && /* @__PURE__ */ Z("div", {
3706
3706
  style: { marginTop: 4 },
3707
- children: /* @__PURE__ */ Z(_, {
3707
+ children: /* @__PURE__ */ Z(l, {
3708
3708
  kind: "ghost",
3709
3709
  size: "xs",
3710
- icon: k ? /* @__PURE__ */ Z(j, { size: 12 }) : void 0,
3711
- onClick: () => O(),
3712
- disabled: k,
3710
+ icon: A ? /* @__PURE__ */ Z(u, { size: 12 }) : void 0,
3711
+ onClick: () => k(),
3712
+ disabled: A,
3713
3713
  children: "Load more"
3714
3714
  })
3715
3715
  })
3716
3716
  ] });
3717
3717
  }
3718
- function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i, editable: a, interaction: o, ctx: s, rows: c, refs: u, isLoading: d, isError: f, invalidateQuery: p, startDraftSignal: m }) {
3719
- let h = l(), g = h.isPhone && s.relatedRecordsPresentation === "table", _ = i.find((e) => e !== r), v = q(() => o === "navigate" ? ee(void 0, t, s.schema.screens) : null, [
3718
+ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i, editable: a, interaction: o, ctx: s, rows: c, refs: l, isLoading: u, isError: d, invalidateQuery: f, startDraftSignal: p }) {
3719
+ let m = de(), h = m.isPhone && s.relatedRecordsPresentation === "table", g = i.find((e) => e !== r), _ = q(() => o === "navigate" ? k(void 0, t, s.schema.screens) : null, [
3720
3720
  o,
3721
3721
  t,
3722
3722
  s.schema.screens
3723
- ]), y = q(() => a ? ti(t, i, r) : /* @__PURE__ */ new Set(), [
3723
+ ]), v = q(() => a ? ti(t, i, r) : /* @__PURE__ */ new Set(), [
3724
3724
  i,
3725
3725
  r,
3726
3726
  t,
3727
3727
  a
3728
- ]), x = q(() => ni(t, i, r), [
3728
+ ]), y = q(() => ni(t, i, r), [
3729
3729
  i,
3730
3730
  r,
3731
3731
  t
3732
- ]), S = q(() => {
3732
+ ]), x = q(() => {
3733
3733
  let e = /* @__PURE__ */ new Map();
3734
3734
  for (let n of c) {
3735
- let r = k(t, n);
3736
- e.set(H(r), r);
3735
+ let r = V(t, n);
3736
+ e.set(b(r), r);
3737
3737
  }
3738
3738
  return e;
3739
3739
  }, [c, t]), C = q(() => {
3740
3740
  let e = /* @__PURE__ */ new Map();
3741
3741
  for (let n of c) {
3742
3742
  let r = n.$row_version;
3743
- typeof r == "string" && r !== "" && e.set(H(k(t, n)), r);
3743
+ typeof r == "string" && r !== "" && e.set(b(V(t, n)), r);
3744
3744
  }
3745
3745
  return e;
3746
- }, [c, t]), w = q(() => Qr(t.actions), [t.actions]), [T, E] = Y(null), [D, O] = Y(null), [A, j] = Y([]), [M, N] = Y({}), P = J(M);
3747
- P.current = M;
3748
- let F = J({});
3746
+ }, [c, t]), w = q(() => Qr(t.actions), [t.actions]), [T, E] = Y(null), [D, O] = Y(null), [A, j] = Y([]), [N, F] = Y({}), I = J(N);
3747
+ I.current = N;
3748
+ let L = J({});
3749
3749
  K(() => {
3750
- let e = F.current;
3750
+ let e = L.current;
3751
3751
  return () => {
3752
3752
  for (let t of Object.values(e)) clearTimeout(t);
3753
3753
  };
3754
3754
  }, []);
3755
- let [I, L] = Y(null), [R, B] = Y([]), [ne, ie] = Y(!1), [V, U] = Y(null), [oe, se] = Y(/* @__PURE__ */ new Set()), W = G(async (t, n, r) => {
3756
- N((e) => ({
3755
+ let [R, z] = Y(null), [B, ee] = Y([]), [te, ne] = Y(!1), [H, U] = Y(null), [W, ae] = Y(/* @__PURE__ */ new Set()), oe = G(async (t, n, r) => {
3756
+ F((e) => ({
3757
3757
  ...e,
3758
3758
  [t]: {
3759
3759
  ...e[t],
@@ -3766,7 +3766,7 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
3766
3766
  ...n,
3767
3767
  $row_version: i
3768
3768
  } : n;
3769
- return await re(e, S.get(t) ?? t, a), N((e) => {
3769
+ return await M(e, x.get(t) ?? t, a), F((e) => {
3770
3770
  let n = e[t];
3771
3771
  if (!n) return e;
3772
3772
  if (n.ver > r) return {
@@ -3778,10 +3778,10 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
3778
3778
  };
3779
3779
  let { [t]: i, ...a } = e;
3780
3780
  return a;
3781
- }), p(), !0;
3781
+ }), f(), !0;
3782
3782
  } catch (e) {
3783
3783
  let n = e instanceof Error ? e.message : "Save failed";
3784
- return N((e) => ({
3784
+ return F((e) => ({
3785
3785
  ...e,
3786
3786
  [t]: {
3787
3787
  ...e[t],
@@ -3792,11 +3792,11 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
3792
3792
  }
3793
3793
  }, [
3794
3794
  e,
3795
- p,
3796
- S,
3795
+ f,
3796
+ x,
3797
3797
  C
3798
- ]), ce = G((e, t, n) => {
3799
- N((r) => {
3798
+ ]), se = G((e, t, n) => {
3799
+ F((r) => {
3800
3800
  let i = r[e] ?? {
3801
3801
  buffer: {},
3802
3802
  ver: 0,
@@ -3813,99 +3813,99 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
3813
3813
  ver: a
3814
3814
  }
3815
3815
  };
3816
- }), o === "inline_edit" && (F.current[e] && clearTimeout(F.current[e]), F.current[e] = setTimeout(() => {
3817
- let t = P.current[e];
3818
- t && Object.keys(t.buffer).length > 0 && W(e, { ...t.buffer }, t.ver);
3816
+ }), o === "inline_edit" && (L.current[e] && clearTimeout(L.current[e]), L.current[e] = setTimeout(() => {
3817
+ let t = I.current[e];
3818
+ t && Object.keys(t.buffer).length > 0 && oe(e, { ...t.buffer }, t.ver);
3819
3819
  }, 500));
3820
- }, [W, o]), le = G(() => {
3820
+ }, [oe, o]), ce = G(() => {
3821
3821
  let e = {};
3822
3822
  e[r] = n;
3823
3823
  for (let n of i) {
3824
3824
  let r = t.fields.get(n);
3825
3825
  r && (r.default === void 0 ? r.type === "bool" && (e[n] = !1) : e[n] = r.default);
3826
3826
  }
3827
- L(e), B([]);
3827
+ z(e), ee([]);
3828
3828
  }, [
3829
3829
  r,
3830
3830
  n,
3831
3831
  i,
3832
3832
  t.fields
3833
- ]), ue = J(m);
3833
+ ]), le = J(p);
3834
3834
  K(() => {
3835
- m !== void 0 && m !== ue.current && (ue.current = m, !I && le());
3835
+ p !== void 0 && p !== le.current && (le.current = p, !R && ce());
3836
3836
  }, [
3837
- m,
3838
- I,
3839
- le
3837
+ p,
3838
+ R,
3839
+ ce
3840
3840
  ]);
3841
- let de = G(async () => {
3842
- if (!I) return;
3843
- let n = ri(I, i, t, r);
3841
+ let ue = G(async () => {
3842
+ if (!R) return;
3843
+ let n = ri(R, i, t, r);
3844
3844
  if (n.length > 0) {
3845
- B(n);
3845
+ ee(n);
3846
3846
  return;
3847
3847
  }
3848
- ie(!0);
3848
+ ne(!0);
3849
3849
  try {
3850
- await ae(e, I), L(null), B([]), p();
3850
+ await re(e, R), z(null), ee([]), f();
3851
3851
  } catch (e) {
3852
3852
  let t = e instanceof Error ? e.message : "Create failed";
3853
- B([`_error:${t}`]);
3853
+ ee([`_error:${t}`]);
3854
3854
  } finally {
3855
- ie(!1);
3855
+ ne(!1);
3856
3856
  }
3857
3857
  }, [
3858
- I,
3858
+ R,
3859
3859
  i,
3860
3860
  t,
3861
3861
  r,
3862
3862
  e,
3863
- p
3863
+ f
3864
3864
  ]), fe = G((e) => {
3865
- N({}), j([]), O(e);
3865
+ F({}), j([]), O(e);
3866
3866
  }, []), pe = G(async (e) => {
3867
- let n = P.current[e], a = n?.buffer ?? {};
3867
+ let n = I.current[e], a = n?.buffer ?? {};
3868
3868
  if (Object.keys(a).length === 0) {
3869
3869
  O(null), j([]);
3870
3870
  return;
3871
3871
  }
3872
3872
  let o = ri({
3873
- ...c.find((n) => H(k(t, n)) === e) ?? {},
3873
+ ...c.find((n) => b(V(t, n)) === e) ?? {},
3874
3874
  ...a
3875
3875
  }, i, t, r);
3876
3876
  if (o.length > 0) {
3877
3877
  j(o);
3878
3878
  return;
3879
3879
  }
3880
- await W(e, { ...a }, n?.ver ?? 0) && (O(null), j([]));
3880
+ await oe(e, { ...a }, n?.ver ?? 0) && (O(null), j([]));
3881
3881
  }, [
3882
3882
  c,
3883
3883
  t,
3884
3884
  i,
3885
3885
  r,
3886
- W
3886
+ oe
3887
3887
  ]), me = G((e) => {
3888
- N((t) => {
3888
+ F((t) => {
3889
3889
  if (!t[e]) return t;
3890
3890
  let { [e]: n, ...r } = t;
3891
3891
  return r;
3892
3892
  }), j([]), O(null);
3893
3893
  }, []), he = G(async (t) => {
3894
- U(null), se((e) => new Set(e).add(t));
3894
+ U(null), ae((e) => new Set(e).add(t));
3895
3895
  try {
3896
- await te(e, S.get(t) ?? t), p();
3896
+ await P(e, x.get(t) ?? t), f();
3897
3897
  } catch {} finally {
3898
- se((e) => {
3898
+ ae((e) => {
3899
3899
  let n = new Set(e);
3900
3900
  return n.delete(t), n;
3901
3901
  });
3902
3902
  }
3903
3903
  }, [
3904
3904
  e,
3905
- p,
3906
- S
3905
+ f,
3906
+ x
3907
3907
  ]);
3908
- if (f) return /* @__PURE__ */ Z("div", {
3908
+ if (d) return /* @__PURE__ */ Z("div", {
3909
3909
  style: {
3910
3910
  fontSize: 12.5,
3911
3911
  color: "var(--danger)",
@@ -3913,7 +3913,7 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
3913
3913
  },
3914
3914
  children: "Failed to load."
3915
3915
  });
3916
- if (d) return /* @__PURE__ */ Q("div", {
3916
+ if (u) return /* @__PURE__ */ Q("div", {
3917
3917
  style: {
3918
3918
  display: "flex",
3919
3919
  flexDirection: "column",
@@ -3930,8 +3930,8 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
3930
3930
  borderRadius: 6
3931
3931
  } })]
3932
3932
  });
3933
- let ge = c.length === 0 && !I;
3934
- return h.isPhone && !g ? /* @__PURE__ */ Q("div", { children: [
3933
+ let ge = c.length === 0 && !R;
3934
+ return m.isPhone && !h ? /* @__PURE__ */ Q("div", { children: [
3935
3935
  ge && !a && /* @__PURE__ */ Z("div", {
3936
3936
  style: {
3937
3937
  fontSize: 12.5,
@@ -3947,7 +3947,7 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
3947
3947
  gap: 10
3948
3948
  },
3949
3949
  children: [c.map((n) => {
3950
- let r = H(k(t, n)), c = oe.has(r), l = M[r], d = v && r ? v.replace(/:\w+/, r) : void 0;
3950
+ let r = b(V(t, n)), c = W.has(r), u = N[r], d = _ && r ? _.replace(/:\w+/, r) : void 0;
3951
3951
  return /* @__PURE__ */ Z(li, {
3952
3952
  rowId: r,
3953
3953
  row: n,
@@ -3955,7 +3955,7 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
3955
3955
  entities: s.schema.entities,
3956
3956
  screens: s.schema.screens,
3957
3957
  columns: i,
3958
- editableColumns: y,
3958
+ editableColumns: v,
3959
3959
  editable: a,
3960
3960
  interaction: o,
3961
3961
  isEditing: D === r,
@@ -3963,10 +3963,10 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
3963
3963
  isDeleting: c,
3964
3964
  activeCell: T,
3965
3965
  setActiveCell: E,
3966
- rowState: l,
3967
- onCellChange: ce,
3966
+ rowState: u,
3967
+ onCellChange: se,
3968
3968
  onDeleteClick: (e) => {
3969
- let r = z(n, t) ?? "";
3969
+ let r = S(n, t) ?? "";
3970
3970
  U({
3971
3971
  show: !0,
3972
3972
  rowId: e,
@@ -3976,39 +3976,39 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
3976
3976
  onStartEdit: fe,
3977
3977
  onConfirmEdit: pe,
3978
3978
  onCancelEdit: me,
3979
- refs: u,
3980
- identityCol: _,
3979
+ refs: l,
3980
+ identityCol: g,
3981
3981
  href: d,
3982
3982
  rowActions: w,
3983
3983
  entityCode: e,
3984
- onRowActionSuccess: p
3984
+ onRowActionSuccess: f
3985
3985
  }, r);
3986
- }), I && /* @__PURE__ */ Z(mi, {
3987
- draftRow: I,
3986
+ }), R && /* @__PURE__ */ Z(mi, {
3987
+ draftRow: R,
3988
3988
  entity: t,
3989
3989
  columns: i,
3990
- editableColumns: x,
3990
+ editableColumns: y,
3991
3991
  foreignKey: r,
3992
- draftErrors: R,
3993
- draftSaving: ne,
3994
- onChange: (e, t) => L((n) => n && {
3992
+ draftErrors: B,
3993
+ draftSaving: te,
3994
+ onChange: (e, t) => z((n) => n && {
3995
3995
  ...n,
3996
3996
  [e]: t
3997
3997
  }),
3998
- onConfirm: de,
3998
+ onConfirm: ue,
3999
3999
  onCancel: () => {
4000
- L(null), B([]);
4000
+ z(null), ee([]);
4001
4001
  },
4002
- refs: u
4002
+ refs: l
4003
4003
  })]
4004
4004
  }),
4005
- V && /* @__PURE__ */ Z(Ot, {
4006
- open: V.show,
4005
+ H && /* @__PURE__ */ Z(Ot, {
4006
+ open: H.show,
4007
4007
  onOpenChange: (e) => !e && U(null),
4008
4008
  title: "Delete record",
4009
- description: V.label ? `Are you sure you want to delete "${V.label}"?` : "Are you sure you want to delete this record?",
4009
+ description: H.label ? `Are you sure you want to delete "${H.label}"?` : "Are you sure you want to delete this record?",
4010
4010
  confirmLabel: "Delete",
4011
- onConfirm: () => he(V.rowId),
4011
+ onConfirm: () => he(H.rowId),
4012
4012
  destructive: !0
4013
4013
  })
4014
4014
  ] }) : /* @__PURE__ */ Q("div", { children: [
@@ -4029,7 +4029,7 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
4029
4029
  let n = t.fields.get(e);
4030
4030
  return /* @__PURE__ */ Z("th", {
4031
4031
  style: Te,
4032
- children: n ? b(n, e, s.schema.entities) : e
4032
+ children: n ? ie(n, e, s.schema.entities) : e
4033
4033
  }, e);
4034
4034
  }),
4035
4035
  a && /* @__PURE__ */ Z("th", { style: {
@@ -4041,7 +4041,7 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
4041
4041
  width: 40
4042
4042
  } })
4043
4043
  ] }) }), /* @__PURE__ */ Q("tbody", { children: [c.map((n) => {
4044
- let r = H(k(t, n)), c = oe.has(r), l = M[r], d = v && r ? v.replace(/:\w+/, r) : void 0;
4044
+ let r = b(V(t, n)), c = W.has(r), u = N[r], d = _ && r ? _.replace(/:\w+/, r) : void 0;
4045
4045
  return /* @__PURE__ */ Z(ui, {
4046
4046
  rowId: r,
4047
4047
  row: n,
@@ -4049,7 +4049,7 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
4049
4049
  entities: s.schema.entities,
4050
4050
  screens: s.schema.screens,
4051
4051
  columns: i,
4052
- editableColumns: y,
4052
+ editableColumns: v,
4053
4053
  editable: a,
4054
4054
  interaction: o,
4055
4055
  isEditing: D === r,
@@ -4057,10 +4057,10 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
4057
4057
  isDeleting: c,
4058
4058
  activeCell: T,
4059
4059
  setActiveCell: E,
4060
- rowState: l,
4061
- onCellChange: ce,
4060
+ rowState: u,
4061
+ onCellChange: se,
4062
4062
  onDeleteClick: (e) => {
4063
- let r = z(n, t) ?? "";
4063
+ let r = S(n, t) ?? "";
4064
4064
  U({
4065
4065
  show: !0,
4066
4066
  rowId: e,
@@ -4070,66 +4070,66 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
4070
4070
  onStartEdit: fe,
4071
4071
  onConfirmEdit: pe,
4072
4072
  onCancelEdit: me,
4073
- refs: u,
4074
- identityCol: _,
4073
+ refs: l,
4074
+ identityCol: g,
4075
4075
  href: d,
4076
4076
  rowActions: w,
4077
4077
  entityCode: e,
4078
- onRowActionSuccess: p
4078
+ onRowActionSuccess: f
4079
4079
  }, r);
4080
- }), I && /* @__PURE__ */ Z(pi, {
4081
- draftRow: I,
4080
+ }), R && /* @__PURE__ */ Z(pi, {
4081
+ draftRow: R,
4082
4082
  entity: t,
4083
4083
  columns: i,
4084
- editableColumns: x,
4084
+ editableColumns: y,
4085
4085
  foreignKey: r,
4086
- draftErrors: R,
4087
- draftSaving: ne,
4088
- onChange: (e, t) => L((n) => n && {
4086
+ draftErrors: B,
4087
+ draftSaving: te,
4088
+ onChange: (e, t) => z((n) => n && {
4089
4089
  ...n,
4090
4090
  [e]: t
4091
4091
  }),
4092
- onConfirm: de,
4092
+ onConfirm: ue,
4093
4093
  onCancel: () => {
4094
- L(null), B([]);
4094
+ z(null), ee([]);
4095
4095
  },
4096
- refs: u
4096
+ refs: l
4097
4097
  })] })]
4098
4098
  })
4099
4099
  }),
4100
- V && /* @__PURE__ */ Z(Ot, {
4101
- open: V.show,
4100
+ H && /* @__PURE__ */ Z(Ot, {
4101
+ open: H.show,
4102
4102
  onOpenChange: (e) => !e && U(null),
4103
4103
  title: "Delete record",
4104
- description: V.label ? `Are you sure you want to delete "${V.label}"?` : "Are you sure you want to delete this record?",
4104
+ description: H.label ? `Are you sure you want to delete "${H.label}"?` : "Are you sure you want to delete this record?",
4105
4105
  confirmLabel: "Delete",
4106
- onConfirm: () => he(V.rowId),
4106
+ onConfirm: () => he(H.rowId),
4107
4107
  destructive: !0
4108
4108
  })
4109
4109
  ] });
4110
4110
  }
4111
- function li({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o, editableColumns: s, editable: c, interaction: l, isEditing: u, editErrors: d, isDeleting: f, rowState: p, onCellChange: h, onDeleteClick: g, onStartEdit: _, onConfirmEdit: v, onCancelEdit: y, refs: x, identityCol: S, href: C, rowActions: w, onRowActionSuccess: T }) {
4112
- let E = ne(), D = je(), O = q(() => !p || Object.keys(p.buffer).length === 0 ? n : {
4111
+ function li({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: s, editableColumns: c, editable: l, interaction: d, isEditing: f, editErrors: p, isDeleting: m, rowState: h, onCellChange: g, onDeleteClick: _, onStartEdit: v, onConfirmEdit: y, onCancelEdit: b, refs: S, identityCol: C, href: w, rowActions: T, onRowActionSuccess: E }) {
4112
+ let D = j(), k = je(), A = q(() => !h || Object.keys(h.buffer).length === 0 ? n : {
4113
4113
  ...n,
4114
- ...p.buffer
4115
- }, [n, p]);
4116
- return l === "row_edit" && u ? /* @__PURE__ */ Z(fi, {
4117
- values: O,
4114
+ ...h.buffer
4115
+ }, [n, h]);
4116
+ return d === "row_edit" && f ? /* @__PURE__ */ Z(fi, {
4117
+ values: A,
4118
4118
  entity: r,
4119
- columns: o,
4120
- editableColumns: s,
4121
- errors: p?.error ? [...d, `_error:${p.error}`] : d,
4122
- saving: p?.saving ?? !1,
4123
- onChange: (e, n) => h(t, e, n),
4124
- onConfirm: () => v(t),
4125
- onCancel: () => y(t),
4126
- refs: x
4119
+ columns: s,
4120
+ editableColumns: c,
4121
+ errors: h?.error ? [...p, `_error:${h.error}`] : p,
4122
+ saving: h?.saving ?? !1,
4123
+ onChange: (e, n) => g(t, e, n),
4124
+ onConfirm: () => y(t),
4125
+ onCancel: () => b(t),
4126
+ refs: S
4127
4127
  }) : /* @__PURE__ */ Q("div", {
4128
4128
  style: {
4129
4129
  border: "1px solid var(--border)",
4130
4130
  borderRadius: 8,
4131
4131
  background: "var(--surface)",
4132
- opacity: f ? .58 : 1,
4132
+ opacity: m ? .58 : 1,
4133
4133
  overflow: "hidden"
4134
4134
  },
4135
4135
  children: [/* @__PURE__ */ Z("div", {
@@ -4139,27 +4139,27 @@ function li({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o,
4139
4139
  flexDirection: "column",
4140
4140
  gap: 12
4141
4141
  },
4142
- children: o.map((e) => {
4143
- let n = r.fields.get(e), o = c && l === "inline_edit" && s.has(e), u = C && e === S, d = n ? b(n, e, i) : e, f = `${D}-${t}-${e}`, p = `${f}-label`, m = {
4142
+ children: s.map((e) => {
4143
+ let n = r.fields.get(e), o = l && d === "inline_edit" && c.has(e), s = w && e === C, u = n ? ie(n, e, i) : e, f = `${k}-${t}-${e}`, p = `${f}-label`, m = {
4144
4144
  fontSize: 11.5,
4145
4145
  fontWeight: 600,
4146
4146
  color: "var(--text-3)"
4147
- }, g = n ? I({
4147
+ }, h = n ? O({
4148
4148
  field: n,
4149
4149
  fieldName: e,
4150
- value: O[e],
4150
+ value: A[e],
4151
4151
  mode: o ? "edit" : "display",
4152
- onChange: o ? (n) => h(t, e, n) : void 0,
4153
- record: O,
4154
- refs: x,
4152
+ onChange: o ? (n) => g(t, e, n) : void 0,
4153
+ record: A,
4154
+ refs: S,
4155
4155
  compact: o,
4156
4156
  entity: r,
4157
4157
  entities: i,
4158
- screens: u ? void 0 : a,
4158
+ screens: s ? void 0 : a,
4159
4159
  fieldId: f,
4160
4160
  labelId: p,
4161
- locale: E
4162
- }) : W(O[e]);
4161
+ locale: D
4162
+ }) : x(A[e]);
4163
4163
  return /* @__PURE__ */ Q("div", {
4164
4164
  style: {
4165
4165
  display: "flex",
@@ -4171,26 +4171,26 @@ function li({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o,
4171
4171
  id: p,
4172
4172
  htmlFor: f,
4173
4173
  style: m,
4174
- children: d
4174
+ children: u
4175
4175
  }) : /* @__PURE__ */ Z("div", {
4176
4176
  id: p,
4177
4177
  style: m,
4178
- children: d
4178
+ children: u
4179
4179
  }), /* @__PURE__ */ Z("div", {
4180
4180
  style: { minWidth: 0 },
4181
- children: u && !o ? /* @__PURE__ */ Z("a", {
4182
- href: C,
4181
+ children: s && !o ? /* @__PURE__ */ Z("a", {
4182
+ href: w,
4183
4183
  style: {
4184
4184
  color: "var(--accent)",
4185
4185
  textDecoration: "none",
4186
4186
  fontWeight: 500
4187
4187
  },
4188
- children: g
4189
- }) : g
4188
+ children: h
4189
+ }) : h
4190
4190
  })]
4191
4191
  }, e);
4192
4192
  })
4193
- }), (c || w && w.length > 0) && /* @__PURE__ */ Q("div", {
4193
+ }), (l || T && T.length > 0) && /* @__PURE__ */ Q("div", {
4194
4194
  style: {
4195
4195
  minHeight: 42,
4196
4196
  padding: "6px 8px",
@@ -4200,101 +4200,101 @@ function li({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o,
4200
4200
  justifyContent: "flex-end",
4201
4201
  gap: 6
4202
4202
  },
4203
- children: [c && /* @__PURE__ */ Q(X, { children: [
4204
- p?.saving && /* @__PURE__ */ Z(j, { size: 12 }),
4205
- p?.error && /* @__PURE__ */ Z("span", {
4203
+ children: [l && /* @__PURE__ */ Q(X, { children: [
4204
+ h?.saving && /* @__PURE__ */ Z(u, { size: 12 }),
4205
+ h?.error && /* @__PURE__ */ Z("span", {
4206
4206
  style: {
4207
4207
  fontSize: 11,
4208
4208
  color: "var(--danger)"
4209
4209
  },
4210
- title: p.error,
4210
+ title: h.error,
4211
4211
  children: "!"
4212
4212
  }),
4213
- l === "row_edit" && /* @__PURE__ */ Z(m, {
4213
+ d === "row_edit" && /* @__PURE__ */ Z(o, {
4214
4214
  size: 32,
4215
4215
  icon: /* @__PURE__ */ Z(e.edit, { size: 14 }),
4216
- onClick: () => _(t),
4216
+ onClick: () => v(t),
4217
4217
  title: "Edit row"
4218
4218
  }),
4219
- /* @__PURE__ */ Z(m, {
4219
+ /* @__PURE__ */ Z(o, {
4220
4220
  size: 32,
4221
4221
  icon: /* @__PURE__ */ Z(e.trash, { size: 14 }),
4222
- onClick: () => g(t),
4222
+ onClick: () => _(t),
4223
4223
  title: "Delete row"
4224
4224
  })
4225
- ] }), !c && w && w.length > 0 && /* @__PURE__ */ Z(Tr, {
4226
- actions: w,
4225
+ ] }), !l && T && T.length > 0 && /* @__PURE__ */ Z(Tr, {
4226
+ actions: T,
4227
4227
  objectIds: [t],
4228
- row: O,
4229
- onSuccess: T
4228
+ row: A,
4229
+ onSuccess: E
4230
4230
  })]
4231
4231
  })]
4232
4232
  });
4233
4233
  }
4234
- function ui({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o, editableColumns: s, editable: c, interaction: l, isEditing: u, editErrors: d, isDeleting: f, activeCell: p, setActiveCell: h, rowState: g, onCellChange: _, onDeleteClick: v, onStartEdit: y, onConfirmEdit: b, onCancelEdit: x, refs: S, identityCol: C, href: w, rowActions: T, onRowActionSuccess: E }) {
4235
- let D = ne(), O = q(() => !g || Object.keys(g.buffer).length === 0 ? n : {
4234
+ function ui({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: s, editableColumns: c, editable: l, interaction: d, isEditing: f, editErrors: p, isDeleting: m, activeCell: h, setActiveCell: g, rowState: _, onCellChange: v, onDeleteClick: y, onStartEdit: b, onConfirmEdit: S, onCancelEdit: C, refs: w, identityCol: T, href: E, rowActions: D, onRowActionSuccess: k }) {
4235
+ let A = j(), M = q(() => !_ || Object.keys(_.buffer).length === 0 ? n : {
4236
4236
  ...n,
4237
- ...g.buffer
4238
- }, [n, g]);
4239
- if (l === "row_edit" && u) return /* @__PURE__ */ Z(di, {
4240
- values: O,
4237
+ ..._.buffer
4238
+ }, [n, _]);
4239
+ if (d === "row_edit" && f) return /* @__PURE__ */ Z(di, {
4240
+ values: M,
4241
4241
  entity: r,
4242
- columns: o,
4243
- editableColumns: s,
4244
- errors: g?.error ? [...d, `_error:${g.error}`] : d,
4245
- saving: g?.saving ?? !1,
4246
- onChange: (e, n) => _(t, e, n),
4247
- onConfirm: () => b(t),
4248
- onCancel: () => x(t),
4249
- refs: S
4242
+ columns: s,
4243
+ editableColumns: c,
4244
+ errors: _?.error ? [...p, `_error:${_.error}`] : p,
4245
+ saving: _?.saving ?? !1,
4246
+ onChange: (e, n) => v(t, e, n),
4247
+ onConfirm: () => S(t),
4248
+ onCancel: () => C(t),
4249
+ refs: w
4250
4250
  });
4251
- let k = De, A = {
4251
+ let N = De, P = {
4252
4252
  padding: "4px 4px",
4253
4253
  borderBottom: "1px solid var(--divider)",
4254
4254
  verticalAlign: "middle"
4255
- }, M = l === "inline_edit";
4255
+ }, F = d === "inline_edit";
4256
4256
  return /* @__PURE__ */ Q("tr", {
4257
- style: { opacity: f ? .5 : 1 },
4257
+ style: { opacity: m ? .5 : 1 },
4258
4258
  children: [
4259
- o.map((e) => {
4260
- let n = r.fields.get(e), o = s.has(e);
4261
- if (M && p?.rowId === t && p?.col === e && o) return /* @__PURE__ */ Z("td", {
4262
- style: A,
4263
- children: n ? I({
4259
+ s.map((e) => {
4260
+ let n = r.fields.get(e), o = c.has(e);
4261
+ if (F && h?.rowId === t && h?.col === e && o) return /* @__PURE__ */ Z("td", {
4262
+ style: P,
4263
+ children: n ? O({
4264
4264
  field: n,
4265
4265
  fieldName: e,
4266
- value: O[e],
4266
+ value: M[e],
4267
4267
  mode: "edit",
4268
- onChange: (n) => _(t, e, n),
4269
- record: O,
4270
- refs: S,
4268
+ onChange: (n) => v(t, e, n),
4269
+ record: M,
4270
+ refs: w,
4271
4271
  compact: !0,
4272
- locale: D
4273
- }) : W(O[e])
4272
+ locale: A
4273
+ }) : x(M[e])
4274
4274
  }, e);
4275
- let c = w && e === C, l = n ? I({
4275
+ let s = E && e === T, l = n ? O({
4276
4276
  field: n,
4277
4277
  fieldName: e,
4278
- value: O[e],
4278
+ value: M[e],
4279
4279
  mode: "display",
4280
- record: O,
4281
- refs: S,
4280
+ record: M,
4281
+ refs: w,
4282
4282
  entity: r,
4283
4283
  entities: i,
4284
- screens: c ? void 0 : a,
4285
- locale: D
4286
- }) : W(O[e]), u = M && o && !f;
4284
+ screens: s ? void 0 : a,
4285
+ locale: A
4286
+ }) : x(M[e]), u = F && o && !m;
4287
4287
  return /* @__PURE__ */ Z("td", {
4288
4288
  style: {
4289
- ...k,
4289
+ ...N,
4290
4290
  cursor: u ? "pointer" : "default"
4291
4291
  },
4292
- onClick: u ? () => h({
4292
+ onClick: u ? () => g({
4293
4293
  rowId: t,
4294
4294
  col: e
4295
4295
  }) : void 0,
4296
- children: c ? /* @__PURE__ */ Z("a", {
4297
- href: w,
4296
+ children: s ? /* @__PURE__ */ Z("a", {
4297
+ href: E,
4298
4298
  style: {
4299
4299
  color: "var(--accent)",
4300
4300
  textDecoration: "none",
@@ -4306,7 +4306,7 @@ function ui({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o,
4306
4306
  }) : l
4307
4307
  }, e);
4308
4308
  }),
4309
- c && /* @__PURE__ */ Z("td", {
4309
+ l && /* @__PURE__ */ Z("td", {
4310
4310
  style: {
4311
4311
  padding: "4px 8px",
4312
4312
  borderBottom: "1px solid var(--divider)",
@@ -4319,96 +4319,96 @@ function ui({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o,
4319
4319
  gap: 4
4320
4320
  },
4321
4321
  children: [
4322
- g?.saving && /* @__PURE__ */ Z(j, { size: 12 }),
4323
- g?.error && /* @__PURE__ */ Z("span", {
4322
+ _?.saving && /* @__PURE__ */ Z(u, { size: 12 }),
4323
+ _?.error && /* @__PURE__ */ Z("span", {
4324
4324
  style: {
4325
4325
  fontSize: 11,
4326
4326
  color: "var(--danger)"
4327
4327
  },
4328
- title: g.error,
4328
+ title: _.error,
4329
4329
  children: "!"
4330
4330
  }),
4331
- l === "row_edit" && /* @__PURE__ */ Z(m, {
4331
+ d === "row_edit" && /* @__PURE__ */ Z(o, {
4332
4332
  size: 24,
4333
4333
  icon: /* @__PURE__ */ Z(e.edit, { size: 12 }),
4334
- onClick: () => y(t),
4334
+ onClick: () => b(t),
4335
4335
  title: "Edit row"
4336
4336
  }),
4337
- /* @__PURE__ */ Z(m, {
4337
+ /* @__PURE__ */ Z(o, {
4338
4338
  size: 24,
4339
4339
  icon: /* @__PURE__ */ Z(e.trash, { size: 12 }),
4340
- onClick: () => v(t),
4340
+ onClick: () => y(t),
4341
4341
  title: "Delete row"
4342
4342
  })
4343
4343
  ]
4344
4344
  })
4345
4345
  }),
4346
- !c && T && T.length > 0 && /* @__PURE__ */ Z("td", {
4346
+ !l && D && D.length > 0 && /* @__PURE__ */ Z("td", {
4347
4347
  style: {
4348
4348
  padding: "4px 8px",
4349
4349
  borderBottom: "1px solid var(--divider)",
4350
4350
  verticalAlign: "middle"
4351
4351
  },
4352
4352
  children: /* @__PURE__ */ Z(Tr, {
4353
- actions: T,
4353
+ actions: D,
4354
4354
  objectIds: [t],
4355
- row: O,
4356
- onSuccess: E
4355
+ row: M,
4356
+ onSuccess: k
4357
4357
  })
4358
4358
  })
4359
4359
  ]
4360
4360
  });
4361
4361
  }
4362
- function di({ values: t, entity: n, columns: r, editableColumns: i, errors: a, saving: o, onChange: s, onConfirm: c, onCancel: l, refs: u, accent: d }) {
4363
- let f = ne(), p = a.find((e) => e.startsWith("_error:")), h = new Set(a.filter((e) => !e.startsWith("_error:"))), g = {
4362
+ function di({ values: t, entity: n, columns: r, editableColumns: i, errors: a, saving: s, onChange: c, onConfirm: l, onCancel: d, refs: f, accent: p }) {
4363
+ let m = j(), h = a.find((e) => e.startsWith("_error:")), g = new Set(a.filter((e) => !e.startsWith("_error:"))), _ = {
4364
4364
  padding: "6px 12px",
4365
4365
  borderBottom: "1px solid var(--divider)",
4366
4366
  verticalAlign: "middle",
4367
4367
  height: 40,
4368
4368
  minWidth: 0
4369
- }, _ = {
4369
+ }, v = {
4370
4370
  display: "block",
4371
4371
  width: "100%",
4372
4372
  maxWidth: "100%",
4373
4373
  minWidth: 0
4374
4374
  };
4375
4375
  return /* @__PURE__ */ Q("tr", {
4376
- style: d ? { boxShadow: "inset 3px 0 0 var(--accent)" } : void 0,
4376
+ style: p ? { boxShadow: "inset 3px 0 0 var(--accent)" } : void 0,
4377
4377
  onKeyDown: (e) => {
4378
- e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), c()) : e.key === "Escape" && (e.preventDefault(), l());
4378
+ e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), l()) : e.key === "Escape" && (e.preventDefault(), d());
4379
4379
  },
4380
4380
  children: [r.map((e) => {
4381
- let r = n.fields.get(e), a = i.has(e), o = h.has(e);
4381
+ let r = n.fields.get(e), a = i.has(e), o = g.has(e);
4382
4382
  return a ? /* @__PURE__ */ Z("td", {
4383
4383
  style: {
4384
- ...g,
4384
+ ..._,
4385
4385
  outline: o ? "1px solid var(--danger)" : "none",
4386
4386
  outlineOffset: -1
4387
4387
  },
4388
4388
  title: o ? `${e} is required` : void 0,
4389
4389
  children: /* @__PURE__ */ Z("div", {
4390
- style: _,
4391
- children: r ? I({
4390
+ style: v,
4391
+ children: r ? O({
4392
4392
  field: r,
4393
4393
  fieldName: e,
4394
4394
  value: t[e],
4395
4395
  mode: "edit",
4396
- onChange: (t) => s(e, t),
4396
+ onChange: (t) => c(e, t),
4397
4397
  record: t,
4398
- refs: u,
4398
+ refs: f,
4399
4399
  compact: !0,
4400
- locale: f
4401
- }) : W(t[e])
4400
+ locale: m
4401
+ }) : x(t[e])
4402
4402
  })
4403
4403
  }, e) : /* @__PURE__ */ Z("td", {
4404
4404
  style: {
4405
- ...g,
4405
+ ..._,
4406
4406
  color: "var(--text-3)"
4407
4407
  },
4408
- children: r?.auto ? "—" : W(t[e])
4408
+ children: r?.auto ? "—" : x(t[e])
4409
4409
  }, e);
4410
4410
  }), /* @__PURE__ */ Z("td", {
4411
- style: g,
4411
+ style: _,
4412
4412
  children: /* @__PURE__ */ Q("div", {
4413
4413
  style: {
4414
4414
  display: "flex",
@@ -4417,24 +4417,24 @@ function di({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
4417
4417
  justifyContent: "flex-end"
4418
4418
  },
4419
4419
  children: [
4420
- p && /* @__PURE__ */ Z("span", {
4420
+ h && /* @__PURE__ */ Z("span", {
4421
4421
  style: {
4422
4422
  fontSize: 11,
4423
4423
  color: "var(--danger)"
4424
4424
  },
4425
- title: p.slice(7),
4425
+ title: h.slice(7),
4426
4426
  children: "!"
4427
4427
  }),
4428
- /* @__PURE__ */ Z(m, {
4428
+ /* @__PURE__ */ Z(o, {
4429
4429
  size: 24,
4430
- icon: Z(o ? j : e.check, { size: 12 }),
4431
- onClick: c,
4430
+ icon: Z(s ? u : e.check, { size: 12 }),
4431
+ onClick: l,
4432
4432
  title: "Confirm (Enter)"
4433
4433
  }),
4434
- /* @__PURE__ */ Z(m, {
4434
+ /* @__PURE__ */ Z(o, {
4435
4435
  size: 24,
4436
4436
  icon: /* @__PURE__ */ Z(e.x, { size: 12 }),
4437
- onClick: l,
4437
+ onClick: d,
4438
4438
  title: "Cancel (Esc)"
4439
4439
  })
4440
4440
  ]
@@ -4442,18 +4442,18 @@ function di({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
4442
4442
  })]
4443
4443
  });
4444
4444
  }
4445
- function fi({ values: t, entity: n, columns: r, editableColumns: i, errors: a, saving: o, onChange: s, onConfirm: c, onCancel: l, refs: u, accent: d }) {
4446
- let f = ne(), p = je(), h = a.find((e) => e.startsWith("_error:")), g = new Set(a.filter((e) => !e.startsWith("_error:")));
4445
+ function fi({ values: t, entity: n, columns: r, editableColumns: i, errors: a, saving: s, onChange: c, onConfirm: l, onCancel: d, refs: f, accent: p }) {
4446
+ let m = j(), h = je(), g = a.find((e) => e.startsWith("_error:")), _ = new Set(a.filter((e) => !e.startsWith("_error:")));
4447
4447
  return /* @__PURE__ */ Q("div", {
4448
4448
  style: {
4449
4449
  border: "1px solid var(--border)",
4450
4450
  borderRadius: 8,
4451
4451
  background: "var(--surface)",
4452
4452
  overflow: "hidden",
4453
- boxShadow: d ? "inset 3px 0 0 var(--accent)" : void 0
4453
+ boxShadow: p ? "inset 3px 0 0 var(--accent)" : void 0
4454
4454
  },
4455
4455
  onKeyDown: (e) => {
4456
- e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), c()) : e.key === "Escape" && (e.preventDefault(), l());
4456
+ e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), l()) : e.key === "Escape" && (e.preventDefault(), d());
4457
4457
  },
4458
4458
  children: [/* @__PURE__ */ Z("div", {
4459
4459
  style: {
@@ -4463,7 +4463,7 @@ function fi({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
4463
4463
  gap: 12
4464
4464
  },
4465
4465
  children: r.map((e) => {
4466
- let r = n.fields.get(e), a = i.has(e), o = g.has(e), c = r ? b(r, e) : e, l = `${p}-${e}`, d = `${l}-label`, m = {
4466
+ let r = n.fields.get(e), a = i.has(e), o = _.has(e), s = r ? ie(r, e) : e, l = `${h}-${e}`, u = `${l}-label`, d = {
4467
4467
  fontSize: 11.5,
4468
4468
  fontWeight: 600,
4469
4469
  color: "var(--text-3)"
@@ -4476,14 +4476,14 @@ function fi({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
4476
4476
  minWidth: 0
4477
4477
  },
4478
4478
  children: [a && r ? /* @__PURE__ */ Z("label", {
4479
- id: d,
4479
+ id: u,
4480
4480
  htmlFor: l,
4481
- style: m,
4482
- children: c
4481
+ style: d,
4482
+ children: s
4483
4483
  }) : /* @__PURE__ */ Z("div", {
4484
- id: d,
4485
- style: m,
4486
- children: c
4484
+ id: u,
4485
+ style: d,
4486
+ children: s
4487
4487
  }), /* @__PURE__ */ Z("div", {
4488
4488
  style: {
4489
4489
  minWidth: 0,
@@ -4492,19 +4492,19 @@ function fi({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
4492
4492
  borderRadius: o ? 5 : 0
4493
4493
  },
4494
4494
  title: o ? `${e} is required` : void 0,
4495
- children: a ? r ? I({
4495
+ children: a ? r ? O({
4496
4496
  field: r,
4497
4497
  fieldName: e,
4498
4498
  value: t[e],
4499
4499
  mode: "edit",
4500
- onChange: (t) => s(e, t),
4500
+ onChange: (t) => c(e, t),
4501
4501
  record: t,
4502
- refs: u,
4502
+ refs: f,
4503
4503
  compact: !0,
4504
4504
  fieldId: l,
4505
- labelId: d,
4506
- locale: f
4507
- }) : W(t[e]) : r?.auto ? "—" : W(t[e])
4505
+ labelId: u,
4506
+ locale: m
4507
+ }) : x(t[e]) : r?.auto ? "—" : x(t[e])
4508
4508
  })]
4509
4509
  }, e);
4510
4510
  })
@@ -4519,24 +4519,24 @@ function fi({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
4519
4519
  gap: 6
4520
4520
  },
4521
4521
  children: [
4522
- h && /* @__PURE__ */ Z("span", {
4522
+ g && /* @__PURE__ */ Z("span", {
4523
4523
  style: {
4524
4524
  fontSize: 11,
4525
4525
  color: "var(--danger)"
4526
4526
  },
4527
- title: h.slice(7),
4527
+ title: g.slice(7),
4528
4528
  children: "!"
4529
4529
  }),
4530
- /* @__PURE__ */ Z(m, {
4530
+ /* @__PURE__ */ Z(o, {
4531
4531
  size: 32,
4532
- icon: Z(o ? j : e.check, { size: 14 }),
4533
- onClick: c,
4532
+ icon: Z(s ? u : e.check, { size: 14 }),
4533
+ onClick: l,
4534
4534
  title: "Confirm (Enter)"
4535
4535
  }),
4536
- /* @__PURE__ */ Z(m, {
4536
+ /* @__PURE__ */ Z(o, {
4537
4537
  size: 32,
4538
4538
  icon: /* @__PURE__ */ Z(e.x, { size: 14 }),
4539
- onClick: l,
4539
+ onClick: d,
4540
4540
  title: "Cancel (Esc)"
4541
4541
  })
4542
4542
  ]
@@ -4755,49 +4755,49 @@ function Ti(e, t) {
4755
4755
  //#endregion
4756
4756
  //#region src/hooks/useScreenBack.ts
4757
4757
  function Ei(e) {
4758
- let t = Pe(), n = v(), r = g(), i = Tt((e) => e.depth), { data: a } = L(), o = e?.fallback, s = wt((e) => {
4758
+ let t = Pe(), r = n(), i = c(), a = Tt((e) => e.depth), { data: o } = A(), s = e?.fallback, l = wt((e) => {
4759
4759
  let t = e.tabs.find((t) => t.id === e.activeTabId);
4760
4760
  return t ? t.returnTo : void 0;
4761
- }), { hasOriginBack: c, allowFallbackBack: l } = q(() => Mt(s, n.enabled), [s, n.enabled]), u = G(() => {
4762
- if (n.enabled) {
4763
- Tt.getState().depth > 0 ? r() : o?.();
4761
+ }), { hasOriginBack: u, allowFallbackBack: d } = q(() => Mt(l, r.enabled), [l, r.enabled]), f = G(() => {
4762
+ if (r.enabled) {
4763
+ Tt.getState().depth > 0 ? i() : s?.();
4764
4764
  return;
4765
4765
  }
4766
- let e = wt.getState(), i = Nt(e.tabs.find((t) => t.id === e.activeTabId)?.returnTo, e.tabs, !1);
4767
- if (!i) {
4768
- o?.();
4766
+ let e = wt.getState(), n = Nt(e.tabs.find((t) => t.id === e.activeTabId)?.returnTo, e.tabs, !1);
4767
+ if (!n) {
4768
+ s?.();
4769
4769
  return;
4770
4770
  }
4771
- if (i.kind === "live" && i.tabId) e.commitTabNavigation(i.tabId, { search: i.search ?? "" });
4772
- else if (i.kind === "reopen") {
4773
- let t = i.title ? void 0 : D(i.pathname, a?.screens, a?.entities);
4771
+ if (n.kind === "live" && n.tabId) e.commitTabNavigation(n.tabId, { search: n.search ?? "" });
4772
+ else if (n.kind === "reopen") {
4773
+ let t = n.title ? void 0 : oe(n.pathname, o?.screens, o?.entities);
4774
4774
  e.openTab({
4775
- pathname: i.pathname,
4776
- search: i.search ?? "",
4777
- title: i.title ?? t?.title ?? i.pathname,
4778
- icon: i.icon ?? t?.icon,
4779
- screen: i.screen,
4775
+ pathname: n.pathname,
4776
+ search: n.search ?? "",
4777
+ title: n.title ?? t?.title ?? n.pathname,
4778
+ icon: n.icon ?? t?.icon,
4779
+ screen: n.screen,
4780
4780
  closable: !0
4781
4781
  });
4782
4782
  }
4783
4783
  t({
4784
- pathname: i.pathname,
4785
- search: At(i.search),
4786
- hash: i.hash || void 0
4784
+ pathname: n.pathname,
4785
+ search: At(n.search),
4786
+ hash: n.hash || void 0
4787
4787
  });
4788
4788
  }, [
4789
- n.enabled,
4790
- r,
4791
- o,
4789
+ r.enabled,
4790
+ i,
4791
+ s,
4792
4792
  t,
4793
- a?.screens,
4794
- a?.entities
4793
+ o?.screens,
4794
+ o?.entities
4795
4795
  ]);
4796
4796
  return {
4797
- canGoBack: n.enabled ? i > 0 || !!o : c || !!o,
4798
- hasOriginBack: c,
4799
- allowFallbackBack: l,
4800
- goBack: u
4797
+ canGoBack: r.enabled ? a > 0 || !!s : u || !!s,
4798
+ hasOriginBack: u,
4799
+ allowFallbackBack: d,
4800
+ goBack: f
4801
4801
  };
4802
4802
  }
4803
4803
  //#endregion
@@ -5074,7 +5074,7 @@ function sa(e, t) {
5074
5074
  function ca(e, t) {
5075
5075
  if (!e) return [];
5076
5076
  let n = new $();
5077
- for (let r of U(e)) n.add(r), t.addField(r, "identity");
5077
+ for (let r of z(e)) n.add(r), t.addField(r, "identity");
5078
5078
  let r = Qi(e, e.display.display_field, { explicit: !0 });
5079
5079
  r && (n.add(r), t.addField(r, "display"), xa(e, r, t, "display"));
5080
5080
  for (let r of la(e.display.display_template)) {
@@ -5334,7 +5334,7 @@ var $ = class {
5334
5334
  },
5335
5335
  children: this.state.error?.message || "An unexpected error occurred."
5336
5336
  }),
5337
- /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(_, {
5337
+ /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(l, {
5338
5338
  onClick: this.handleRetry,
5339
5339
  children: "Try again"
5340
5340
  }) })
@@ -5356,7 +5356,7 @@ function Da(e, t) {
5356
5356
  let n = Ea(e, t), r = n[2];
5357
5357
  return Le({
5358
5358
  queryKey: n,
5359
- queryFn: () => B(e, t),
5359
+ queryFn: () => C(e, t),
5360
5360
  enabled: !!e && !!t && t !== "new" && r !== void 0
5361
5361
  });
5362
5362
  }