@declarion/react 0.104.0 → 0.109.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist-lib/api/agents.js +8 -7
  2. package/dist-lib/api/client.js +48 -49
  3. package/dist-lib/components/agents/AgentChatPanel.impl.js +362 -301
  4. package/dist-lib/components/agents/ChatAttachments.js +144 -0
  5. package/dist-lib/components/agents/transcript-runs.js +1 -1
  6. package/dist-lib/components/chrome/AssociationTabs.js +89 -75
  7. package/dist-lib/components/detail-layout/AssociatedBlock.js +243 -235
  8. package/dist-lib/components/detail-layout/ChildrenCards.js +57 -55
  9. package/dist-lib/components/detail-layout/ChildrenList.js +45 -43
  10. package/dist-lib/components/detail-layout/ChildrenTable.js +93 -91
  11. package/dist-lib/components/detail-layout/ChildrenTimeline.js +160 -155
  12. package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +127 -121
  13. package/dist-lib/components/fields/RefCombobox.js +53 -48
  14. package/dist-lib/components/fields/index.js +1 -0
  15. package/dist-lib/components/file-widgets/useFileSelection.js +152 -0
  16. package/dist-lib/components/pages/SmartDetailPage.impl.js +506 -482
  17. package/dist-lib/components/pages/SmartRecordListPage.impl.js +335 -300
  18. package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +112 -109
  19. package/dist-lib/components/params/ParamsBlock.js +18 -15
  20. package/dist-lib/components/params/param-editors.js +60 -54
  21. package/dist-lib/components/primitives/RetryButton.js +14 -0
  22. package/dist-lib/components/primitives/StatTile.js +42 -34
  23. package/dist-lib/hooks/useAgentConversation.js +18 -13
  24. package/dist-lib/hooks/useParams.js +54 -52
  25. package/dist-lib/hooks/useSchema.js +5 -2
  26. package/dist-lib/hooks/useTimelineData.js +26 -24
  27. package/dist-lib/index.d.ts +89 -5
  28. package/dist-lib/index.js +95 -93
  29. package/dist-lib/lib/read-display-state.js +19 -0
  30. package/dist-lib/stores/auth.js +1 -0
  31. package/dist-lib/testing.d.ts +1 -1
  32. package/dist-lib/types/fieldType.js +1 -1
  33. package/dist-lib/{useResponsiveMode-ECv1AEhv.d.ts → useResponsiveMode-DODbtSrY.d.ts} +3 -0
  34. package/package.json +1 -1
@@ -7,78 +7,81 @@ import { useFirstScreenSettled as ne } from "../../lib/capabilityPrefetch.js";
7
7
  import { useAuthStore as re } from "../../stores/auth.js";
8
8
  import { useSchema as ie } from "../../hooks/useSchema.js";
9
9
  import { buildActionBody as ae, executeAction as oe } from "../../api/data.js";
10
+ import { failureTitle as se } from "../../lib/failure.js";
10
11
  import { Icon as h } from "../primitives/Icons.js";
11
12
  import { Btn as g } from "../primitives/Btn.js";
12
- import { IconBtn as se } from "../primitives/IconBtn.js";
13
- import { useText as _ } from "../../hooks/useText.js";
14
- import { useResponsiveMode as ce } from "../../hooks/useResponsiveMode.js";
15
- import { Spinner as le } from "../primitives/Spinner.js";
16
- import { DynamicIcon as ue } from "../shared/DynamicIcon.js";
17
- import { useTabStore as de } from "../../stores/tabs.js";
18
- import { useReportEmbedDirty as fe } from "../../embed/embed-dirty.js";
19
- import { useEmbedNavigate as pe } from "../../embed/useEmbedNavigate.js";
20
- import { useTabNavigate as v } from "../../hooks/useTabNavigate.js";
21
- import { usePageStateStore as me } from "../../stores/page-state.js";
22
- import { applyRowState as he, resolveActionLayoutForSlot as y } from "../../lib/actions.js";
23
- import { useScreenIsLive as ge } from "../../stores/realtime.js";
24
- import { useActionRunner as _e } from "../actions/ActionRunner.js";
25
- import { canonicalUrl as ve } from "../../lib/canonical-url.js";
26
- import { useRegisterRetainedQuery as ye } from "../../hooks/usePageStateRuntime.js";
13
+ import { IconBtn as ce } from "../primitives/IconBtn.js";
14
+ import { useText as le } from "../../hooks/useText.js";
15
+ import { RetryButton as ue } from "../primitives/RetryButton.js";
16
+ import { useResponsiveMode as de } from "../../hooks/useResponsiveMode.js";
17
+ import { Spinner as fe } from "../primitives/Spinner.js";
18
+ import { readDisplayState as pe } from "../../lib/read-display-state.js";
19
+ import { DynamicIcon as me } from "../shared/DynamicIcon.js";
20
+ import { useTabStore as he } from "../../stores/tabs.js";
21
+ import { useReportEmbedDirty as ge } from "../../embed/embed-dirty.js";
22
+ import { useEmbedNavigate as _e } from "../../embed/useEmbedNavigate.js";
23
+ import { useTabNavigate as _ } from "../../hooks/useTabNavigate.js";
24
+ import { usePageStateStore as ve } from "../../stores/page-state.js";
25
+ import { applyRowState as ye, resolveActionLayoutForSlot as v } from "../../lib/actions.js";
26
+ import { useScreenIsLive as y } from "../../stores/realtime.js";
27
+ import { useActionRunner as be } from "../actions/ActionRunner.js";
28
+ import { canonicalUrl as xe } from "../../lib/canonical-url.js";
29
+ import { useRegisterRetainedQuery as Se } from "../../hooks/usePageStateRuntime.js";
27
30
  import { useBrandingChrome as b } from "../../hooks/useBrandingChrome.js";
28
- import { objectQueryKey as be, useObject as x } from "../../hooks/useObject.js";
29
- import { discardFile as xe } from "../file-widgets/upload.js";
30
- import { FileDraftScope as S, useFileDraftScope as Se } from "../file-widgets/draft-scope.js";
31
- import { getEntityFileField as C, getSchemaFieldValue as w, serializeSchemaFieldValue as T } from "../file-widgets/host.js";
32
- import { buildFilesPayload as Ce, collectCommittedFileIds as we } from "../file-widgets/payload.js";
33
- import { useCreateObject as Te, useRestoreEntity as Ee, useUpdateObject as De } from "../../hooks/useMutations.js";
34
- import { useScreenBack as Oe } from "../../hooks/useScreenBack.js";
35
- import { usePlainScrollRestoration as ke } from "../../lib/scroll-restoration.js";
36
- import { DetailSkeleton as Ae } from "../shared/LoadingSkeleton.js";
37
- import { dispatchAction as E } from "../../lib/action-dispatch.js";
38
- import { ResponsiveActionBar as je } from "../actions/ResponsiveActionBar.js";
39
- import { useRowTenant as Me } from "../../hooks/useRowTenant.js";
40
- import { effectiveScreenForRecord as Ne, variantActionCodesForRecord as Pe } from "../../lib/variants.js";
41
- import { RefreshControl as D } from "../shared/RefreshControl.js";
42
- import { useUnsavedInput as Fe } from "../../hooks/useUnsavedInput.js";
43
- import { AssociationTabs as Ie } from "../chrome/AssociationTabs.js";
44
- import { DocumentsMenu as O } from "./DocumentsMenu.js";
45
- import { canManageDocumentTemplates as Le } from "../../lib/document-templates.js";
46
- import { RecordPanels as Re } from "./RecordPanels.js";
47
- import { showsOnNewRecord as ze } from "../../lib/child-config.js";
48
- import { StatusGroupsDisplay as Be } from "../shared/StatusGroupsDisplay.js";
49
- import { LayoutRenderer as Ve } from "../detail-layout/LayoutRenderer.js";
50
- import { ErrorSummary as He } from "../detail-layout/ErrorSummary.js";
51
- import { DetailHighlights as Ue, highlightedFieldCodes as We } from "../detail-layout/DetailHighlights.js";
52
- import { DetailAuditStrip as Ge } from "../detail-layout/DetailAuditStrip.js";
53
- import { EvidenceBlock as Ke } from "../detail-layout/EvidenceBlock.js";
54
- import { RecordHeader as k } from "../chrome/RecordHeader.js";
55
- import { PageShell as qe } from "../chrome/PageShell.js";
56
- import { findInvalidEmailFields as Je, findMissingRequiredFields as Ye, validatePendingChildren as Xe } from "../../lib/children-validation.js";
57
- import { takePeekDraft as Ze } from "../list/peekDraftStore.js";
58
- import { resolveCard as Qe } from "./list/cardProjection.js";
59
- import { useCallback as A, useEffect as j, useMemo as M, useRef as N, useState as P } from "react";
60
- import { Fragment as $e, jsx as F, jsxs as I } from "react/jsx-runtime";
61
- import { useLocation as et, useParams as tt, useSearchParams as nt } from "react-router";
31
+ import { objectQueryKey as Ce, useObject as we } from "../../hooks/useObject.js";
32
+ import { discardFile as Te } from "../file-widgets/upload.js";
33
+ import { FileDraftScope as x, useFileDraftScope as Ee } from "../file-widgets/draft-scope.js";
34
+ import { getEntityFileField as De, getSchemaFieldValue as Oe, serializeSchemaFieldValue as S } from "../file-widgets/host.js";
35
+ import { buildFilesPayload as ke, collectCommittedFileIds as Ae } from "../file-widgets/payload.js";
36
+ import { useCreateObject as je, useRestoreEntity as Me, useUpdateObject as Ne } from "../../hooks/useMutations.js";
37
+ import { useScreenBack as Pe } from "../../hooks/useScreenBack.js";
38
+ import { usePlainScrollRestoration as Fe } from "../../lib/scroll-restoration.js";
39
+ import { DetailSkeleton as Ie } from "../shared/LoadingSkeleton.js";
40
+ import { dispatchAction as C } from "../../lib/action-dispatch.js";
41
+ import { ResponsiveActionBar as Le } from "../actions/ResponsiveActionBar.js";
42
+ import { useRowTenant as Re } from "../../hooks/useRowTenant.js";
43
+ import { effectiveScreenForRecord as ze, variantActionCodesForRecord as Be } from "../../lib/variants.js";
44
+ import { RefreshControl as w } from "../shared/RefreshControl.js";
45
+ import { useUnsavedInput as Ve } from "../../hooks/useUnsavedInput.js";
46
+ import { AssociationTabs as He } from "../chrome/AssociationTabs.js";
47
+ import { DocumentsMenu as T } from "./DocumentsMenu.js";
48
+ import { canManageDocumentTemplates as Ue } from "../../lib/document-templates.js";
49
+ import { RecordPanels as We } from "./RecordPanels.js";
50
+ import { showsOnNewRecord as Ge } from "../../lib/child-config.js";
51
+ import { StatusGroupsDisplay as Ke } from "../shared/StatusGroupsDisplay.js";
52
+ import { LayoutRenderer as qe } from "../detail-layout/LayoutRenderer.js";
53
+ import { ErrorSummary as Je } from "../detail-layout/ErrorSummary.js";
54
+ import { DetailHighlights as Ye, highlightedFieldCodes as Xe } from "../detail-layout/DetailHighlights.js";
55
+ import { DetailAuditStrip as Ze } from "../detail-layout/DetailAuditStrip.js";
56
+ import { EvidenceBlock as Qe } from "../detail-layout/EvidenceBlock.js";
57
+ import { RecordHeader as E } from "../chrome/RecordHeader.js";
58
+ import { PageShell as $e } from "../chrome/PageShell.js";
59
+ import { findInvalidEmailFields as et, findMissingRequiredFields as tt, validatePendingChildren as nt } from "../../lib/children-validation.js";
60
+ import { takePeekDraft as rt } from "../list/peekDraftStore.js";
61
+ import { resolveCard as it } from "./list/cardProjection.js";
62
+ import { useCallback as D, useEffect as O, useMemo as k, useRef as A, useState as j } from "react";
63
+ import { Fragment as at, jsx as M, jsxs as N } from "react/jsx-runtime";
64
+ import { useLocation as ot, useParams as st, useSearchParams as ct } from "react-router";
62
65
  //#region src/components/pages/SmartDetailPage.impl.tsx
63
- var rt = () => {}, it = { expand: ["evidence"] };
64
- function L(e, t) {
66
+ var lt = () => {}, ut = { expand: ["evidence"] };
67
+ function P(e, t) {
65
68
  return e.length === t.length && JSON.stringify(e) === JSON.stringify(t);
66
69
  }
67
- function at({ entity: e, formData: t, record: n, isNew: r, pendingStatuses: i, pendingProperties: a, pendingChildren: o, childrenSnapshot: s }) {
68
- let c = {}, l = Ce({
70
+ function dt({ entity: e, formData: t, record: n, isNew: r, pendingStatuses: i, pendingProperties: a, pendingChildren: o, childrenSnapshot: s }) {
71
+ let c = {}, l = ke({
69
72
  entity: e,
70
73
  formData: t,
71
74
  record: n,
72
75
  isNew: r
73
- }), u = we(l);
76
+ }), u = Ae(l);
74
77
  if (r) for (let [n, r] of Object.entries(t)) {
75
78
  if (e.files?.has(n)) continue;
76
- let t = T(e, n, r);
79
+ let t = S(e, n, r);
77
80
  t !== "" && t != null && (c[n] = t);
78
81
  }
79
82
  else for (let [r, i] of Object.entries(t)) {
80
83
  if (e.files?.has(r)) continue;
81
- let t = n ? w(e, n, r) : void 0, a = T(e, r, i), o = T(e, r, t);
84
+ let t = n ? Oe(e, n, r) : void 0, a = S(e, r, i), o = S(e, r, t);
82
85
  (a === "" ? null : a) !== (o === "" || o === void 0 ? null : o) && (c[r] = a);
83
86
  }
84
87
  if (Object.keys(l).length > 0 && (c.$files = l), Object.keys(i).length > 0 && (c.$statuses = Object.entries(i).map(([e, t]) => ({
@@ -94,7 +97,7 @@ function at({ entity: e, formData: t, record: n, isNew: r, pendingStatuses: i, p
94
97
  let { _key: t, _deleted: n, _dirty: r, ...i } = e;
95
98
  return i;
96
99
  }), a = s?.[t] ?? [];
97
- (r || !L(i, a)) && (e[t] = i);
100
+ (r || !P(i, a)) && (e[t] = i);
98
101
  }
99
102
  Object.keys(e).length > 0 && (c.$children = e);
100
103
  }
@@ -103,329 +106,350 @@ function at({ entity: e, formData: t, record: n, isNew: r, pendingStatuses: i, p
103
106
  committedFileIds: u
104
107
  };
105
108
  }
106
- function ot(e, n) {
109
+ function ft(e, n) {
107
110
  if (e) {
108
111
  let t = o(e, n), r = f(t);
109
112
  if (r.replace(/^\|+|\|+$/g, "")) return r;
110
113
  }
111
114
  return n.id == null ? crypto.randomUUID() : t(n.id);
112
115
  }
113
- function st({ screenCode: e }) {
114
- return /* @__PURE__ */ F(S, { children: /* @__PURE__ */ F(ct, { screenCode: e }) });
116
+ function pt({ screenCode: e }) {
117
+ return /* @__PURE__ */ M(x, { children: /* @__PURE__ */ M(mt, { screenCode: e }) });
115
118
  }
116
- function ct({ screenCode: t }) {
117
- let p = _(), ae = _("errors"), { id: oe } = tt(), g = pe(), [le, ue] = nt(), { data: v } = ie(), he = re((e) => e.user), y = Se(), _e = ce(), b = v?.screens[t], S = b?.entity ? v?.entities[b.entity] : void 0, T = b?.entity, E = a(S, "create"), je = Me(S), Pe = (() => {
118
- if (!S || !S.singleton || !S.prefilter) return;
119
- let e = l(S);
119
+ function mt({ screenCode: t }) {
120
+ let p = le(), ae = le("errors"), { id: oe } = st(), g = _e(), [fe, me] = ct(), { data: _ } = ie(), ye = re((e) => e.user), v = Ee(), be = de(), b = _?.screens[t], x = b?.entity ? _?.entities[b.entity] : void 0, S = b?.entity, C = a(x, "create"), Le = Re(x), Be = (() => {
121
+ if (!x || !x.singleton || !x.prefilter) return;
122
+ let e = l(x);
120
123
  if (e.length !== 1) return;
121
- let t = S.prefilter[e[0]];
122
- if (t === "$caller.user_id") return he?.id;
123
- if (t === "$caller.tenant_id") return he?.tenant?.id;
124
- })(), D = Pe !== void 0, O = D ? Pe : oe, k = !D && O === "new", L = M(() => {
125
- if (!O || k) return;
126
- if (!S) return O;
127
- let e = l(S);
128
- if (e.length === 1) return { [e[0]]: O };
129
- let t = d(O, e.length);
124
+ let t = x.prefilter[e[0]];
125
+ if (t === "$caller.user_id") return ye?.id;
126
+ if (t === "$caller.tenant_id") return ye?.tenant?.id;
127
+ })(), w = Be !== void 0, T = w ? Be : oe, E = !w && T === "new", P = k(() => {
128
+ if (!T || E) return;
129
+ if (!x) return T;
130
+ let e = l(x);
131
+ if (e.length === 1) return { [e[0]]: T };
132
+ let t = d(T, e.length);
130
133
  if (!t) return;
131
134
  let n = {};
132
135
  for (let r = 0; r < e.length; r++) n[e[r]] = t[r] ?? "";
133
136
  return n;
134
137
  }, [
135
- O,
136
- k,
137
- S
138
- ]), st = M(() => {
139
- if (L) return typeof L == "string" ? L : f(L);
140
- }, [L]), ct = x(T, L, it), { data: ut, isLoading: dt, error: pt } = ct;
141
- ne(!dt);
142
- let gt = ge(S?.realtime, T ?? ""), _t = T ? gt : !1;
143
- ye(be(T, L, it), !k);
144
- let vt = Te(T ?? ""), yt = De(T ?? ""), bt = Ee(T ?? ""), xt = Object.keys(S?.status_groups ?? {}).length > 0, R = ut?.data, z = m(S, "update", R, je.tenantId), St = !!R && a(S, "update") && !ee(S, R, je.tenantId), Ct = m(S, "restore", R, je.tenantId), wt = R?.$statuses, Tt = R?.$properties, Et = le.get("edit") === "true", [Dt, Ot] = P(k || Et), [B, kt] = P({}), [V, At] = P({}), [H, jt] = P({}), [U, W] = P(void 0), [Mt, Nt] = P(!1), [Pt, G] = P(void 0), [Ft, It] = P(!1), Lt = k ? E : z, K = Dt && Lt, Rt = te();
145
- fe(K && !k, Rt.enabled);
146
- let [zt, Bt] = P(() => {
138
+ T,
139
+ E,
140
+ x
141
+ ]), pt = k(() => {
142
+ if (P) return typeof P == "string" ? P : f(P);
143
+ }, [P]), mt = we(S, P, ut), { data: F, isLoading: gt, error: vt } = mt, I = pe(mt), xt = !E && I.error !== null && !(I.error instanceof e && I.error.status === 404);
144
+ ne(!gt);
145
+ let St = y(x?.realtime, S ?? ""), Ct = S ? St : !1;
146
+ Se(Ce(S, P, ut), !E);
147
+ let wt = je(S ?? ""), Tt = Ne(S ?? ""), Et = Me(S ?? ""), Dt = Object.keys(x?.status_groups ?? {}).length > 0, L = F?.data, R = m(x, "update", L, Le.tenantId), Ot = !!L && a(x, "update") && !ee(x, L, Le.tenantId), kt = m(x, "restore", L, Le.tenantId), At = L?.$statuses, jt = L?.$properties, Mt = fe.get("edit") === "true", [Nt, Pt] = j(E || Mt), [z, Ft] = j({}), [B, It] = j({}), [V, Lt] = j({}), [H, U] = j(void 0), [Rt, zt] = j(!1), [Bt, W] = j(void 0), [Vt, Ht] = j(!1), Ut = E ? C : R, G = Nt && Ut, Wt = te();
148
+ ge(G && !E, Wt.enabled);
149
+ let [Gt, Kt] = j(() => {
147
150
  let e = parseInt(b?.sidebar_width || "380", 10);
148
151
  return isNaN(e) ? 380 : e;
149
- }), Vt = N(null), q = N(null), Ht = A((e) => {
152
+ }), qt = A(null), K = A(null), Jt = D((e) => {
150
153
  e.preventDefault();
151
- let t = Vt.current;
154
+ let t = qt.current;
152
155
  if (!t) return;
153
156
  let n = t.offsetWidth;
154
- q.current = {
157
+ K.current = {
155
158
  startX: e.clientX,
156
159
  startW: n
157
160
  };
158
161
  let r = (e) => {
159
- if (!q.current) return;
160
- let n = q.current.startX - e.clientX, r = Math.max(280, Math.min(800, q.current.startW + n));
162
+ if (!K.current) return;
163
+ let n = K.current.startX - e.clientX, r = Math.max(280, Math.min(800, K.current.startW + n));
161
164
  t.style.width = `${r}px`;
162
165
  }, i = () => {
163
- q.current && t && Bt(parseInt(t.style.width, 10) || q.current.startW), q.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
166
+ K.current && t && Kt(parseInt(t.style.width, 10) || K.current.startW), K.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
164
167
  };
165
168
  document.addEventListener("mousemove", r), document.addEventListener("mouseup", i);
166
- }, []), J = ut?.data, Y = Ne(S, b, J ?? {});
167
- j(() => {
168
- let e = parseInt(Y?.sidebar_width || "380", 10);
169
- Bt(Number.isNaN(e) ? 380 : e);
170
- }, [Y?.sidebar_width]);
171
- let X = typeof J?.$row_version == "string" ? J.$row_version : void 0, Ut = J?.$refs, Wt = N(X);
172
- j(() => {
173
- if (!X) return;
174
- let e = Wt.current;
175
- Wt.current = X, e && e !== X && Dt && Nt(!0);
176
- }, [Dt, X]);
177
- let Gt = !!S?.soft_delete && J != null && J[S.soft_delete] != null, Z = et(), Kt = N(null);
178
- ke({ scrollElementRef: Kt });
179
- let qt = !k && pt instanceof e && pt.status === 404, Jt = k && !i(S), Yt = N(null);
180
- j(() => {
181
- if (!qt) return;
182
- let e = ve(Z);
183
- Yt.current !== e && (Yt.current = e, me.getState().kill(e));
184
- }, [qt, Z]);
185
- let { openTab: Xt, updateTabTitle: Zt, findTabByPathname: Qt } = de();
186
- j(() => {
187
- if (!S || D || Rt.enabled) return;
188
- let e = Z.pathname, t = p(Y?.display?.name) || p(S.display.name), n = Y?.display?.icon || S.display.icon;
189
- Xt({
169
+ }, []), q = F?.data, J = ze(x, b, q ?? {});
170
+ O(() => {
171
+ let e = parseInt(J?.sidebar_width || "380", 10);
172
+ Kt(Number.isNaN(e) ? 380 : e);
173
+ }, [J?.sidebar_width]);
174
+ let Y = typeof q?.$row_version == "string" ? q.$row_version : void 0, Yt = q?.$refs, Xt = A(Y);
175
+ O(() => {
176
+ if (!Y) return;
177
+ let e = Xt.current;
178
+ Xt.current = Y, e && e !== Y && Nt && zt(!0);
179
+ }, [Nt, Y]);
180
+ let Zt = !!x?.soft_delete && q != null && q[x.soft_delete] != null, X = ot(), Qt = A(null);
181
+ Fe({ scrollElementRef: Qt });
182
+ let $t = !E && vt instanceof e && vt.status === 404, en = E && !i(x), tn = A(null);
183
+ O(() => {
184
+ if (!$t) return;
185
+ let e = xe(X);
186
+ tn.current !== e && (tn.current = e, ve.getState().kill(e));
187
+ }, [$t, X]);
188
+ let { openTab: nn, updateTabTitle: rn, findTabByPathname: an } = he();
189
+ O(() => {
190
+ if (!x || w || Wt.enabled) return;
191
+ let e = X.pathname, t = p(J?.display?.name) || p(x.display.name), n = J?.display?.icon || x.display.icon;
192
+ nn({
190
193
  pathname: e,
191
194
  search: "",
192
- title: k ? p("record.new_title", "New {name}", { name: t }) : t,
193
- derivedTitle: !k,
195
+ title: E ? p("record.new_title", "New {name}", { name: t }) : t,
196
+ derivedTitle: !E,
194
197
  icon: n,
195
198
  closable: !0
196
199
  });
197
200
  }, [
198
- Z.pathname,
201
+ X.pathname,
199
202
  p,
200
- Y?.display?.icon,
201
- S?.display.icon,
202
- k,
203
- D,
204
- Rt.enabled
205
- ]), j(() => {
206
- if (!J || !S || D || Rt.enabled) return;
207
- let e = Qt(Z.pathname);
203
+ J?.display?.icon,
204
+ x?.display.icon,
205
+ E,
206
+ w,
207
+ Wt.enabled
208
+ ]), O(() => {
209
+ if (!q || !x || w || Wt.enabled) return;
210
+ let e = an(X.pathname);
208
211
  if (e) {
209
- let t = p(Y?.display?.name) || p(S.display.name), n = c(p, J, S), r = n && !String(n).startsWith("/") ? String(n) : t;
210
- Zt(e.id, r, r === t);
212
+ let t = p(J?.display?.name) || p(x.display.name), n = c(p, q, x), r = n && !String(n).startsWith("/") ? String(n) : t;
213
+ rn(e.id, r, r === t);
211
214
  }
212
215
  }, [
213
- J,
216
+ q,
214
217
  p,
215
- S?.display.display_field,
216
- Z.pathname,
217
- D,
218
- Rt.enabled
218
+ x?.display.display_field,
219
+ X.pathname,
220
+ w,
221
+ Wt.enabled
219
222
  ]);
220
- let $t = M(() => {
221
- if (!S || !Lt) return /* @__PURE__ */ new Set();
223
+ let on = k(() => {
224
+ if (!x || !Ut) return /* @__PURE__ */ new Set();
222
225
  let e = /* @__PURE__ */ new Set();
223
- for (let [t, n] of S.fields) u(n) && e.add(t);
224
- for (let [t] of S.files ?? []) e.add(t);
226
+ for (let [t, n] of x.fields) u(n) && e.add(t);
227
+ for (let [t] of x.files ?? []) e.add(t);
225
228
  return e;
226
- }, [S, Lt]), en = N(null);
227
- j(() => {
228
- if (Et && J && S && z && en.current !== Z.key) {
229
- if (en.current = Z.key, Dt || Ot(!0), Object.keys(B).length === 0) {
230
- let e = O ? Ze(O) : null;
229
+ }, [x, Ut]), sn = A(null);
230
+ O(() => {
231
+ if (Mt && q && x && R && sn.current !== X.key) {
232
+ if (sn.current = X.key, Nt || Pt(!0), Object.keys(z).length === 0) {
233
+ let e = T ? rt(T) : null;
231
234
  if (e) {
232
- let t = Ce({
233
- entity: S,
235
+ let t = ke({
236
+ entity: x,
234
237
  formData: e,
235
238
  record: void 0,
236
239
  isNew: !0
237
240
  });
238
- we(t).forEach((e) => {
239
- y.registerDraft({
241
+ Ae(t).forEach((e) => {
242
+ v.registerDraft({
240
243
  fileId: e,
241
- discard: () => xe(e)
244
+ discard: () => Te(e)
242
245
  });
243
246
  });
244
247
  }
245
248
  let t = {};
246
- $t.forEach((n) => {
249
+ on.forEach((n) => {
247
250
  let r = e ? e[n] : void 0;
248
251
  if (r !== void 0) {
249
252
  t[n] = r;
250
253
  return;
251
254
  }
252
- let i = w(S, J, n);
253
- t[n] = C(S, n) ? i ?? null : i ?? "";
254
- }), kt(t);
255
+ let i = Oe(x, q, n);
256
+ t[n] = De(x, n) ? i ?? null : i ?? "";
257
+ }), Ft(t);
255
258
  }
256
- if (S.children !== void 0 && S.children.length > 0 && U === void 0) {
257
- let e = J.$children;
259
+ if (x.children !== void 0 && x.children.length > 0 && H === void 0) {
260
+ let e = q.$children;
258
261
  if (e && Object.keys(e).length > 0) {
259
262
  let t = {};
260
263
  for (let [n, r] of Object.entries(e)) {
261
- let e = v?.entities[n];
264
+ let e = _?.entities[n];
262
265
  t[n] = r.map((t) => ({
263
266
  ...t,
264
- _key: ot(e, t)
267
+ _key: ft(e, t)
265
268
  }));
266
269
  }
267
- W(t), G(e);
268
- } else W({}), G({});
270
+ U(t), W(e);
271
+ } else U({}), W({});
269
272
  }
270
- ue((e) => {
273
+ me((e) => {
271
274
  let t = new URLSearchParams(e);
272
275
  return t.delete("edit"), t;
273
276
  }, { replace: !0 });
274
277
  }
275
278
  }, [
276
- Et,
277
- J,
278
- $t,
279
- z,
280
- S,
281
- U,
282
- v,
283
- Z.key
284
- ]), j(() => {
285
- k && E && S?.children && S.children.length !== 0 && U === void 0 && (W({}), G({}));
279
+ Mt,
280
+ q,
281
+ on,
282
+ R,
283
+ x,
284
+ H,
285
+ _,
286
+ X.key
287
+ ]), O(() => {
288
+ E && C && x?.children && x.children.length !== 0 && H === void 0 && (U({}), W({}));
286
289
  }, [
287
- k,
288
290
  E,
289
- S?.children
291
+ C,
292
+ x?.children
290
293
  ]);
291
- let tn = A(async () => {
292
- if (await y.flushAllDrafts(), k) {
293
- let e = Y?.route?.replace("/:id", "") ?? "/";
294
+ let cn = D(async () => {
295
+ if (await v.flushAllDrafts(), E) {
296
+ let e = J?.route?.replace("/:id", "") ?? "/";
294
297
  g(e);
295
- } else Ot(!1), kt({}), At({}), jt({}), W(void 0), G(void 0), It(!1);
298
+ } else Pt(!1), Ft({}), It({}), Lt({}), U(void 0), W(void 0), Ht(!1);
296
299
  }, [
297
- y,
298
- k,
299
- Y,
300
+ v,
301
+ E,
302
+ J,
300
303
  g
301
- ]), nn = A((e, t) => {
302
- kt((n) => ({
304
+ ]), ln = D((e, t) => {
305
+ Ft((n) => ({
303
306
  ...n,
304
307
  [e]: t
305
308
  }));
306
- }, []), Q = M(() => {
307
- if (!Y?.route) return "/";
308
- let e = Y.route.split("/");
309
+ }, []), Z = k(() => {
310
+ if (!J?.route) return "/";
311
+ let e = J.route.split("/");
309
312
  return e.pop(), e.join("/") || "/";
310
- }, [Y]), rn = M(() => !v?.screens || !Q || Q === "/" ? !1 : Object.values(v.screens).some((e) => e.route === Q), [v, Q]), an = A(() => {
311
- if (!rn) {
313
+ }, [J]), un = k(() => !_?.screens || !Z || Z === "/" ? !1 : Object.values(_.screens).some((e) => e.route === Z), [_, Z]), dn = D(() => {
314
+ if (!un) {
312
315
  g("/");
313
316
  return;
314
317
  }
315
- let e = Qt(Q)?.search ?? "";
316
- g(e ? `${Q}?${e}` : Q);
318
+ let e = an(Z)?.search ?? "";
319
+ g(e ? `${Z}?${e}` : Z);
317
320
  }, [
318
- rn,
319
- Q,
320
- Qt,
321
+ un,
322
+ Z,
323
+ an,
321
324
  g
322
- ]), on = Oe({ fallback: an }), sn = !D && (on.hasOriginBack || on.allowFallbackBack && !!rn), cn = M(() => {
323
- if (!S) return {};
325
+ ]), Q = Pe({ fallback: dn }), fn = !w && (Q.hasOriginBack || Q.allowFallbackBack && !!un), pn = k(() => {
326
+ if (!x) return {};
324
327
  let e = {};
325
- for (let t of Ye(S, B, k)) $t.has(t) && (e[t] = p("record.field.required", "Required"));
326
- for (let t of Je(S, B)) $t.has(t) && (e[t] = ae("record.email_invalid", "This is not a valid email address."));
328
+ for (let t of tt(x, z, E)) on.has(t) && (e[t] = p("record.field.required", "Required"));
329
+ for (let t of et(x, z)) on.has(t) && (e[t] = ae("record.email_invalid", "This is not a valid email address."));
327
330
  return e;
328
331
  }, [
329
332
  p,
330
333
  ae,
331
- S,
332
- B,
333
- k,
334
- $t
335
- ]), ln = Object.keys(cn).length > 0, un = M(() => S ? at({
336
- entity: S,
337
- formData: B,
338
- record: J,
339
- isNew: k,
340
- pendingStatuses: V,
341
- pendingProperties: H,
342
- pendingChildren: U,
343
- childrenSnapshot: Pt
334
+ x,
335
+ z,
336
+ E,
337
+ on
338
+ ]), mn = Object.keys(pn).length > 0, hn = k(() => x ? dt({
339
+ entity: x,
340
+ formData: z,
341
+ record: q,
342
+ isNew: E,
343
+ pendingStatuses: B,
344
+ pendingProperties: V,
345
+ pendingChildren: H,
346
+ childrenSnapshot: Bt
344
347
  }) : {
345
348
  payload: {},
346
349
  committedFileIds: []
347
350
  }, [
348
- S,
351
+ x,
352
+ z,
353
+ q,
354
+ E,
349
355
  B,
350
- J,
351
- k,
352
356
  V,
353
357
  H,
354
- U,
355
- Pt
356
- ]), dn = Object.keys(un.payload).length > 0, fn = K && (k || dn);
357
- Fe(fn);
358
- let pn = A(() => {
359
- if (!T || !S || k && !E || !k && !z || (It(!0), ln)) return;
360
- let t = { ...un.payload }, { committedFileIds: n } = un;
361
- if (!k && !dn) {
362
- Ot(!1), At({}), jt({}), W(void 0), G(void 0), It(!1);
358
+ Bt
359
+ ]), gn = Object.keys(hn.payload).length > 0, _n = G && (E || gn);
360
+ Ve(_n);
361
+ let vn = D(() => {
362
+ if (!S || !x || E && !C || !E && !R || (Ht(!0), mn)) return;
363
+ let t = { ...hn.payload }, { committedFileIds: n } = hn;
364
+ if (!E && !gn) {
365
+ Pt(!1), It({}), Lt({}), U(void 0), W(void 0), Ht(!1);
363
366
  return;
364
367
  }
365
- !k && X && (t.$row_version = X);
368
+ !E && Y && (t.$row_version = Y);
366
369
  let r = () => {
367
- Ot(!1), Nt(!1), It(!1), At({}), jt({}), W(void 0), G(void 0);
370
+ Pt(!1), zt(!1), Ht(!1), It({}), Lt({}), U(void 0), W(void 0);
368
371
  };
369
- k ? vt.mutate(t, { onSuccess: (e) => {
370
- n.forEach((e) => y.markCommitted(e));
371
- let t = e.data, i = S ? o(S, t) : {}, a = f(i);
372
- g(a ? `${Q}/${encodeURIComponent(a)}` : Q, { replace: !0 }), r();
373
- } }) : L && yt.mutate({
374
- pkValues: L,
372
+ E ? wt.mutate(t, { onSuccess: (e) => {
373
+ n.forEach((e) => v.markCommitted(e));
374
+ let t = e.data, i = x ? o(x, t) : {}, a = f(i);
375
+ g(a ? `${Z}/${encodeURIComponent(a)}` : Z, { replace: !0 }), r();
376
+ } }) : P && Tt.mutate({
377
+ pkValues: P,
375
378
  data: t
376
379
  }, {
377
380
  onSuccess: () => {
378
- n.forEach((e) => y.markCommitted(e)), r();
381
+ n.forEach((e) => v.markCommitted(e)), r();
379
382
  },
380
383
  onError: (t) => {
381
- t instanceof e && t.code === "entity.stale_object" && Nt(!0);
384
+ t instanceof e && t.code === "entity.stale_object" && zt(!0);
382
385
  }
383
386
  });
384
387
  }, [
385
- y,
386
- k,
388
+ v,
387
389
  E,
388
- z,
389
- T,
390
- ln,
391
- un,
392
- dn,
393
- vt,
394
- yt,
390
+ C,
391
+ R,
395
392
  S,
393
+ mn,
394
+ hn,
395
+ gn,
396
+ wt,
397
+ Tt,
398
+ x,
396
399
  g,
397
- Q,
398
- X,
399
- L
400
- ]), mn = A((e, t) => {
401
- W((n) => ({
400
+ Z,
401
+ Y,
402
+ P
403
+ ]), yn = D((e, t) => {
404
+ U((n) => ({
402
405
  ...n ?? {},
403
406
  [e]: t
404
407
  }));
405
- }, []), hn = A(() => {
406
- L && !k && Ct && bt.mutate(L);
408
+ }, []), bn = D(() => {
409
+ P && !E && kt && Et.mutate(P);
407
410
  }, [
408
- L,
409
- k,
410
- Ct,
411
- bt
412
- ]), gn = M(() => Xe(U, v), [U, v]), _n = Object.keys(gn).length > 0;
413
- if (!Y || !S) return null;
414
- if (!k && dt) return /* @__PURE__ */ F(Ae, {});
415
- if (Jt) return /* @__PURE__ */ I("div", {
411
+ P,
412
+ E,
413
+ kt,
414
+ Et
415
+ ]), xn = k(() => nt(H, _), [H, _]), Sn = Object.keys(xn).length > 0;
416
+ if (!J || !x) return null;
417
+ if (!E && I.loading) return /* @__PURE__ */ M(Ie, {});
418
+ if (xt && !F) return /* @__PURE__ */ N("div", {
419
+ style: { padding: 24 },
420
+ children: [fn && /* @__PURE__ */ M(ce, {
421
+ icon: /* @__PURE__ */ M(h.back, { size: 14 }),
422
+ onClick: Q.goBack,
423
+ title: p("record.back", "Back")
424
+ }), /* @__PURE__ */ N("p", {
425
+ role: "alert",
426
+ style: {
427
+ color: "var(--danger)",
428
+ display: "flex",
429
+ alignItems: "center",
430
+ gap: 8
431
+ },
432
+ children: [
433
+ se(ae, I.error),
434
+ " ",
435
+ /* @__PURE__ */ M(ue, { onRetry: I.retry })
436
+ ]
437
+ })]
438
+ });
439
+ if (en) return /* @__PURE__ */ N("div", {
416
440
  style: { padding: 24 },
417
- children: [/* @__PURE__ */ I("div", {
441
+ children: [/* @__PURE__ */ N("div", {
418
442
  style: {
419
443
  display: "flex",
420
444
  alignItems: "center",
421
445
  gap: 8,
422
446
  marginBottom: 8
423
447
  },
424
- children: [sn && /* @__PURE__ */ F(se, {
425
- icon: /* @__PURE__ */ F(h.back, { size: 14 }),
426
- onClick: on.goBack,
448
+ children: [fn && /* @__PURE__ */ M(ce, {
449
+ icon: /* @__PURE__ */ M(h.back, { size: 14 }),
450
+ onClick: Q.goBack,
427
451
  title: p("record.back", "Back")
428
- }), /* @__PURE__ */ F("h1", {
452
+ }), /* @__PURE__ */ M("h1", {
429
453
  style: {
430
454
  margin: 0,
431
455
  fontSize: 18,
@@ -434,25 +458,25 @@ function ct({ screenCode: t }) {
434
458
  },
435
459
  children: p("record.create_closed.title", "Not Available")
436
460
  })]
437
- }), /* @__PURE__ */ F("p", {
461
+ }), /* @__PURE__ */ M("p", {
438
462
  style: { color: "var(--text-3)" },
439
463
  children: p("record.create_closed.body", "This record type is not created from a form.")
440
464
  })]
441
465
  });
442
- if (!k && !J || qt) return /* @__PURE__ */ I("div", {
466
+ if (!E && !q || $t) return /* @__PURE__ */ N("div", {
443
467
  style: { padding: 24 },
444
- children: [/* @__PURE__ */ I("div", {
468
+ children: [/* @__PURE__ */ N("div", {
445
469
  style: {
446
470
  display: "flex",
447
471
  alignItems: "center",
448
472
  gap: 8,
449
473
  marginBottom: 8
450
474
  },
451
- children: [sn && /* @__PURE__ */ F(se, {
452
- icon: /* @__PURE__ */ F(h.back, { size: 14 }),
453
- onClick: on.goBack,
475
+ children: [fn && /* @__PURE__ */ M(ce, {
476
+ icon: /* @__PURE__ */ M(h.back, { size: 14 }),
477
+ onClick: Q.goBack,
454
478
  title: p("record.back", "Back")
455
- }), /* @__PURE__ */ F("h1", {
479
+ }), /* @__PURE__ */ M("h1", {
456
480
  style: {
457
481
  margin: 0,
458
482
  fontSize: 18,
@@ -461,36 +485,36 @@ function ct({ screenCode: t }) {
461
485
  },
462
486
  children: p("record.missing.title", "Not Found")
463
487
  })]
464
- }), /* @__PURE__ */ F("p", {
488
+ }), /* @__PURE__ */ M("p", {
465
489
  style: { color: "var(--text-3)" },
466
490
  children: ae("entity.not_found", "This record does not exist.")
467
491
  })]
468
492
  });
469
- let vn = S.display, yn = p(Y.display?.name) || p(vn.name), bn = c(p, J, S), xn = k ? p("record.new_title", "New {name}", { name: yn }) : bn ? String(bn) : yn, Sn = vt.isPending || yt.isPending, Cn = Y.responsive?.[_e.category]?.layout, wn = Cn?.tabs ?? (_e.isPhone ? "sections" : void 0), Tn = Cn?.header_card === !0 ? Qe({
470
- entity: S,
471
- screen: Y
493
+ let Cn = x.display, wn = p(J.display?.name) || p(Cn.name), Tn = c(p, q, x), En = E ? p("record.new_title", "New {name}", { name: wn }) : Tn ? String(Tn) : wn, Dn = wt.isPending || Tt.isPending, On = J.responsive?.[be.category]?.layout, kn = On?.tabs ?? (be.isPhone ? "sections" : void 0), An = On?.header_card === !0 ? it({
494
+ entity: x,
495
+ screen: J
472
496
  }) : void 0, $ = {
473
- schema: v,
474
- entity: S,
475
- entityCode: T,
476
- recordId: st ?? O ?? "",
477
- record: K ? {
478
- ...J ?? {},
479
- ...B
480
- } : J ?? {},
481
- isNew: k,
482
- mode: K ? "edit" : "display",
483
- onFieldChange: K ? nn : void 0,
484
- refs: Ut,
485
- headerFields: !k && J ? We(Y, S) : void 0,
497
+ schema: _,
498
+ entity: x,
499
+ entityCode: S,
500
+ recordId: pt ?? T ?? "",
501
+ record: G ? {
502
+ ...q ?? {},
503
+ ...z
504
+ } : q ?? {},
505
+ isNew: E,
506
+ mode: G ? "edit" : "display",
507
+ onFieldChange: G ? ln : void 0,
508
+ refs: Yt,
509
+ headerFields: !E && q ? Xe(J, x) : void 0,
486
510
  objectProperties: (() => {
487
- let e = Tt ?? [];
488
- if (!K || Object.keys(H).length === 0) return e.length > 0 ? e : void 0;
489
- let t = e.map((e) => H[e.property_code] === void 0 ? e : {
511
+ let e = jt ?? [];
512
+ if (!G || Object.keys(V).length === 0) return e.length > 0 ? e : void 0;
513
+ let t = e.map((e) => V[e.property_code] === void 0 ? e : {
490
514
  ...e,
491
- value: H[e.property_code]
515
+ value: V[e.property_code]
492
516
  });
493
- for (let [n, r] of Object.entries(H)) e.some((e) => e.property_code === n) || t.push({
517
+ for (let [n, r] of Object.entries(V)) e.some((e) => e.property_code === n) || t.push({
494
518
  property_code: n,
495
519
  name: {},
496
520
  type: "string",
@@ -498,19 +522,19 @@ function ct({ screenCode: t }) {
498
522
  });
499
523
  return t;
500
524
  })(),
501
- onSetProperty: k || !z ? void 0 : K ? (e, t) => jt((n) => ({
525
+ onSetProperty: E || !R ? void 0 : G ? (e, t) => Lt((n) => ({
502
526
  ...n,
503
527
  [e]: t
504
528
  })) : void 0,
505
529
  isPropertyPending: !1,
506
530
  objectStatuses: (() => {
507
- let e = wt ?? [];
508
- if (!K || Object.keys(V).length === 0) return e.length > 0 ? e : void 0;
509
- let t = e.map((e) => V[e.group_code] === void 0 ? e : {
531
+ let e = At ?? [];
532
+ if (!G || Object.keys(B).length === 0) return e.length > 0 ? e : void 0;
533
+ let t = e.map((e) => B[e.group_code] === void 0 ? e : {
510
534
  ...e,
511
- status_code: V[e.group_code]
535
+ status_code: B[e.group_code]
512
536
  });
513
- for (let [n, i] of Object.entries(V)) e.some((e) => e.group_code === n) || t.push({
537
+ for (let [n, i] of Object.entries(B)) e.some((e) => e.group_code === n) || t.push({
514
538
  group_code: n,
515
539
  status_code: i,
516
540
  status_name: {},
@@ -518,144 +542,144 @@ function ct({ screenCode: t }) {
518
542
  });
519
543
  return t;
520
544
  })(),
521
- onSetStatus: k || !z ? void 0 : K ? (e, t) => At((n) => ({
545
+ onSetStatus: E || !R ? void 0 : G ? (e, t) => It((n) => ({
522
546
  ...n,
523
547
  [e]: t
524
548
  })) : void 0,
525
549
  isStatusPending: !1,
526
- pendingChildren: K ? U : void 0,
527
- onChildrenChange: K ? mn : void 0,
528
- childValidationErrors: K ? gn : void 0,
529
- fieldErrors: K && Ft ? cn : void 0,
530
- detailTabsPresentation: wn,
531
- relatedRecordsPresentation: Cn?.related_records
532
- }, En = !!Y.sidebar && (k ? Y.sidebar.some((e) => ze(e, S, v?.entities ?? {})) : Y.sidebar.length > 0), Dn = Cn?.sidebar === "hidden", On = En && !Dn && !_e.isDesktop, kn = En && !Dn && _e.isDesktop, An = !k && J ? /* @__PURE__ */ F(Ue, {
533
- screen: Y,
534
- entity: S,
535
- entityCode: T,
536
- record: J,
537
- refs: Ut,
538
- objectStatuses: wt,
539
- schema: v
540
- }) : void 0, jn = /* @__PURE__ */ F(ft, {
541
- title: xn,
542
- editing: K,
543
- isNew: k,
544
- isRecordDeleted: Gt,
545
- dirty: fn,
546
- isSaving: Sn,
547
- hasChildErrors: _n,
548
- hasFieldErrors: Ft && ln,
549
- canRestore: Ct,
550
- entity: S,
551
- screen: Y,
552
- globalActions: v?.actions,
553
- entityCode: T,
554
- record: J,
555
- id: O,
556
- listRoute: Q,
557
- listRouteExists: !!rn,
558
- highlights: An,
559
- showBack: sn,
560
- onBack: on.goBack,
561
- onCancelEdit: tn,
562
- onSave: pn,
563
- onRestore: hn,
564
- isRestoring: bt.isPending,
550
+ pendingChildren: G ? H : void 0,
551
+ onChildrenChange: G ? yn : void 0,
552
+ childValidationErrors: G ? xn : void 0,
553
+ fieldErrors: G && Vt ? pn : void 0,
554
+ detailTabsPresentation: kn,
555
+ relatedRecordsPresentation: On?.related_records
556
+ }, jn = !!J.sidebar && (E ? J.sidebar.some((e) => Ge(e, x, _?.entities ?? {})) : J.sidebar.length > 0), Mn = On?.sidebar === "hidden", Nn = jn && !Mn && !be.isDesktop, Pn = jn && !Mn && be.isDesktop, Fn = !E && q ? /* @__PURE__ */ M(Ye, {
557
+ screen: J,
558
+ entity: x,
559
+ entityCode: S,
560
+ record: q,
561
+ refs: Yt,
562
+ objectStatuses: At,
563
+ schema: _
564
+ }) : void 0, In = /* @__PURE__ */ M(_t, {
565
+ title: En,
566
+ editing: G,
567
+ isNew: E,
568
+ isRecordDeleted: Zt,
569
+ dirty: _n,
570
+ isSaving: Dn,
571
+ hasChildErrors: Sn,
572
+ hasFieldErrors: Vt && mn,
573
+ canRestore: kt,
574
+ entity: x,
575
+ screen: J,
576
+ globalActions: _?.actions,
577
+ entityCode: S,
578
+ record: q,
579
+ id: T,
580
+ listRoute: Z,
581
+ listRouteExists: !!un,
582
+ highlights: Fn,
583
+ showBack: fn,
584
+ onBack: Q.goBack,
585
+ onCancelEdit: cn,
586
+ onSave: vn,
587
+ onRestore: bn,
588
+ isRestoring: Et.isPending,
565
589
  refreshControl: {
566
- refetch: ct.refetch,
567
- isLoading: ct.isLoading,
568
- isLive: _t
590
+ refetch: mt.refetch,
591
+ isLoading: mt.isLoading,
592
+ isLive: Ct
569
593
  },
570
- isRealtimeEntity: S?.realtime === !0,
571
- canManageTemplates: Le(v)
572
- }), Mn = Gt && /* @__PURE__ */ F(mt, {
594
+ isRealtimeEntity: x?.realtime === !0,
595
+ canManageTemplates: Ue(_)
596
+ }), Ln = Zt && /* @__PURE__ */ M(yt, {
573
597
  tone: "danger",
574
- children: p("record.deleted_banner", "This record was deleted on {date}", { date: n(String(J[S.soft_delete]), {
598
+ children: p("record.deleted_banner", "This record was deleted on {date}", { date: n(String(q[x.soft_delete]), {
575
599
  zone: p.timeZone,
576
- declared: !!(S.fields.get(S.soft_delete)?.timezone || S.default_timezone)
600
+ declared: !!(x.fields.get(x.soft_delete)?.timezone || x.default_timezone)
577
601
  }) })
578
- }), Nn = Mt && /* @__PURE__ */ F(mt, {
602
+ }), Rn = Rt && /* @__PURE__ */ M(yt, {
579
603
  tone: "warn",
580
604
  children: p("record.changed_on_server", "This record changed on the server while you were viewing or editing it.")
581
- }), Pn = St && J ? ht(p, S, J, Ut) : void 0, Fn = St && /* @__PURE__ */ F(mt, {
605
+ }), zn = Ot && q ? bt(p, x, q, Yt) : void 0, Bn = Ot && /* @__PURE__ */ M(yt, {
582
606
  tone: "info",
583
607
  testId: "record-other-tenant-banner",
584
- children: Pn ? p("record.other_tenant_banner_named", "This record is set in the tenant {tenant}. Change it from that tenant.", { tenant: Pn }) : p("record.other_tenant_banner", "This record is set in another tenant. Change it from that tenant.")
585
- }), In = K && Ft && ln && /* @__PURE__ */ F(He, {
586
- errors: Object.entries(cn).map(([e, t]) => {
587
- let n = S.fields.get(e);
608
+ children: zn ? p("record.other_tenant_banner_named", "This record is set in the tenant {tenant}. Change it from that tenant.", { tenant: zn }) : p("record.other_tenant_banner", "This record is set in another tenant. Change it from that tenant.")
609
+ }), Vn = G && Vt && mn && /* @__PURE__ */ M(Je, {
610
+ errors: Object.entries(pn).map(([e, t]) => {
611
+ let n = x.fields.get(e);
588
612
  return {
589
613
  name: e,
590
- label: n ? s(p, n, e, v?.entities) : e,
614
+ label: n ? s(p, n, e, _?.entities) : e,
591
615
  message: t
592
616
  };
593
617
  }),
594
618
  onJump: (e) => {
595
- let t = document.getElementById(`${T}-${e}`);
619
+ let t = document.getElementById(`${S}-${e}`);
596
620
  t && (t.scrollIntoView({
597
621
  block: "center",
598
622
  behavior: "smooth"
599
623
  }), t.focus?.());
600
624
  }
601
- }), Ln = xt && !k && !(Y.items && Y.items.length > 0) && /* @__PURE__ */ F("div", {
625
+ }), Hn = Dt && !E && !(J.items && J.items.length > 0) && /* @__PURE__ */ M("div", {
602
626
  className: "mb-4",
603
- children: /* @__PURE__ */ F(Be, {
604
- statusGroups: S.status_groups ?? {},
627
+ children: /* @__PURE__ */ M(Ke, {
628
+ statusGroups: x.status_groups ?? {},
605
629
  objectStatuses: $.objectStatuses,
606
- onSetStatus: z && K ? (e, t) => At((n) => ({
630
+ onSetStatus: R && G ? (e, t) => It((n) => ({
607
631
  ...n,
608
632
  [e]: t
609
- })) : rt,
633
+ })) : lt,
610
634
  isPending: !1,
611
- mode: K ? "edit" : "display"
635
+ mode: G ? "edit" : "display"
612
636
  })
613
- }), Rn = S.evidence_covered && !k && J && /* @__PURE__ */ F("div", {
637
+ }), Un = x.evidence_covered && !E && q && /* @__PURE__ */ M("div", {
614
638
  className: "mb-4",
615
- children: /* @__PURE__ */ F(Ke, { evidence: J.$evidence })
616
- }), zn = /* @__PURE__ */ I($e, { children: [
617
- Tn && (J || k) && /* @__PURE__ */ F(lt, {
618
- card: Tn,
619
- entity: S,
639
+ children: /* @__PURE__ */ M(Qe, { evidence: q.$evidence })
640
+ }), Wn = /* @__PURE__ */ N(at, { children: [
641
+ An && (q || E) && /* @__PURE__ */ M(ht, {
642
+ card: An,
643
+ entity: x,
620
644
  record: $.record,
621
645
  objectStatuses: $.objectStatuses,
622
646
  objectProperties: $.objectProperties
623
647
  }),
624
- Y.items && Y.items.length > 0 && (J || k) && v && /* @__PURE__ */ F(Ve, {
625
- nodes: Y.items,
648
+ J.items && J.items.length > 0 && (q || E) && _ && /* @__PURE__ */ M(qe, {
649
+ nodes: J.items,
626
650
  ctx: $
627
651
  }),
628
- !k && O && T && S.associations && Object.keys(S.associations).length > 0 && v && /* @__PURE__ */ F(Ie, {
629
- entityCode: T,
630
- recordId: st ?? O ?? "",
631
- associations: S.associations,
632
- schema: v
652
+ !E && T && S && x.associations && Object.keys(x.associations).length > 0 && _ && /* @__PURE__ */ M(He, {
653
+ entityCode: S,
654
+ recordId: pt ?? T ?? "",
655
+ associations: x.associations,
656
+ schema: _
633
657
  }),
634
- !k && O && T && /* @__PURE__ */ F(Re, {
635
- entity: S,
636
- entityCode: T,
637
- objectId: st ?? O,
638
- schema: v
658
+ !E && T && S && /* @__PURE__ */ M(We, {
659
+ entity: x,
660
+ entityCode: S,
661
+ objectId: pt ?? T,
662
+ schema: _
639
663
  }),
640
- !k && J && v && /* @__PURE__ */ F(Ge, {
641
- screen: Y,
642
- entity: S,
643
- entityCode: T,
644
- record: J,
645
- recordId: st ?? O,
646
- refs: Ut,
647
- schema: v
664
+ !E && q && _ && /* @__PURE__ */ M(Ze, {
665
+ screen: J,
666
+ entity: x,
667
+ entityCode: S,
668
+ record: q,
669
+ recordId: pt ?? T,
670
+ refs: Yt,
671
+ schema: _
648
672
  })
649
- ] }), Bn = /* @__PURE__ */ I($e, { children: [
650
- jn,
651
- Nn,
652
- Mn,
653
- Fn,
673
+ ] }), Gn = /* @__PURE__ */ N(at, { children: [
654
674
  In,
675
+ Rn,
655
676
  Ln,
656
- Rn
677
+ Bn,
678
+ Vn,
679
+ Hn,
680
+ Un
657
681
  ] });
658
- return kn ? /* @__PURE__ */ I("div", {
682
+ return Pn ? /* @__PURE__ */ N("div", {
659
683
  style: {
660
684
  height: "100%",
661
685
  display: "flex",
@@ -663,23 +687,23 @@ function ct({ screenCode: t }) {
663
687
  background: "var(--background)"
664
688
  },
665
689
  children: [
666
- /* @__PURE__ */ F("div", {
690
+ /* @__PURE__ */ M("div", {
667
691
  style: {
668
692
  flex: 1,
669
693
  minWidth: 0,
670
694
  height: "100%"
671
695
  },
672
- children: /* @__PURE__ */ F(qe, {
673
- scrollRef: Kt,
674
- header: Bn,
675
- children: zn
696
+ children: /* @__PURE__ */ M($e, {
697
+ scrollRef: Qt,
698
+ header: Gn,
699
+ children: Wn
676
700
  })
677
701
  }),
678
- /* @__PURE__ */ F("div", {
702
+ /* @__PURE__ */ M("div", {
679
703
  className: "detail-resize-handle",
680
- onMouseDown: Ht,
704
+ onMouseDown: Jt,
681
705
  title: p("record.layout.drag_to_resize", "Drag to resize"),
682
- children: /* @__PURE__ */ F("div", { style: {
706
+ children: /* @__PURE__ */ M("div", { style: {
683
707
  position: "absolute",
684
708
  top: 0,
685
709
  bottom: 0,
@@ -689,23 +713,23 @@ function ct({ screenCode: t }) {
689
713
  background: "var(--border)"
690
714
  } })
691
715
  }),
692
- /* @__PURE__ */ F("div", {
693
- ref: Vt,
716
+ /* @__PURE__ */ M("div", {
717
+ ref: qt,
694
718
  style: {
695
719
  flexShrink: 0,
696
720
  height: "100%",
697
- width: `${zt}px`
721
+ width: `${Gt}px`
698
722
  },
699
- children: (J || k) && v && /* @__PURE__ */ F(Ve, {
700
- nodes: Y.sidebar,
723
+ children: (q || E) && _ && /* @__PURE__ */ M(qe, {
724
+ nodes: J.sidebar,
701
725
  ctx: $
702
726
  })
703
727
  })
704
728
  ]
705
- }) : /* @__PURE__ */ I(qe, {
706
- scrollRef: Kt,
707
- header: Bn,
708
- children: [zn, On && (J || k) && v && /* @__PURE__ */ F("div", {
729
+ }) : /* @__PURE__ */ N($e, {
730
+ scrollRef: Qt,
731
+ header: Gn,
732
+ children: [Wn, Nn && (q || E) && _ && /* @__PURE__ */ M("div", {
709
733
  "data-testid": "detail-sidebar-inline",
710
734
  style: {
711
735
  display: "flex",
@@ -713,25 +737,25 @@ function ct({ screenCode: t }) {
713
737
  gap: 16,
714
738
  minWidth: 0
715
739
  },
716
- children: /* @__PURE__ */ F(Ve, {
717
- nodes: Y.sidebar,
740
+ children: /* @__PURE__ */ M(qe, {
741
+ nodes: J.sidebar,
718
742
  ctx: $
719
743
  })
720
744
  })]
721
745
  });
722
746
  }
723
- function lt({ card: e, entity: n, record: r, objectStatuses: i, objectProperties: a }) {
724
- let o = _(), s = (e) => {
725
- let s = ut(o, n, e, r, i, a);
747
+ function ht({ card: e, entity: n, record: r, objectStatuses: i, objectProperties: a }) {
748
+ let o = le(), s = (e) => {
749
+ let s = F(o, n, e, r, i, a);
726
750
  return s != null && t(s) !== "";
727
751
  }, l = (e) => {
728
- let s = ut(o, n, e, r, i, a);
729
- return t(s) || /* @__PURE__ */ F("span", {
752
+ let s = F(o, n, e, r, i, a);
753
+ return t(s) || /* @__PURE__ */ M("span", {
730
754
  style: { color: "var(--text-3)" },
731
755
  children: "-"
732
756
  });
733
- }, u = e.titleUsesDisplay ? c(o, r, n) : e.titleField ? ut(o, n, e.titleField, r, i, a) : void 0, d = t(u) || o(n.display?.name) || o("record.fallback_title", "Record"), f = e.badgeFields.filter((t) => !e.hideEmptyFields || s(t)), p = e.bodyFields.filter((t) => !e.hideEmptyFields || s(t)), m = e.metaFields.filter((t) => !e.hideEmptyFields || s(t));
734
- return /* @__PURE__ */ I("section", {
757
+ }, u = e.titleUsesDisplay ? c(o, r, n) : e.titleField ? F(o, n, e.titleField, r, i, a) : void 0, d = t(u) || o(n.display?.name) || o("record.fallback_title", "Record"), f = e.badgeFields.filter((t) => !e.hideEmptyFields || s(t)), p = e.bodyFields.filter((t) => !e.hideEmptyFields || s(t)), m = e.metaFields.filter((t) => !e.hideEmptyFields || s(t));
758
+ return /* @__PURE__ */ N("section", {
735
759
  "data-testid": "detail-header-card",
736
760
  style: {
737
761
  width: "100%",
@@ -744,9 +768,9 @@ function lt({ card: e, entity: n, record: r, objectStatuses: i, objectProperties
744
768
  boxSizing: "border-box"
745
769
  },
746
770
  children: [
747
- /* @__PURE__ */ I("div", {
771
+ /* @__PURE__ */ N("div", {
748
772
  style: { minWidth: 0 },
749
- children: [/* @__PURE__ */ F("div", {
773
+ children: [/* @__PURE__ */ M("div", {
750
774
  style: {
751
775
  fontSize: 15,
752
776
  lineHeight: 1.25,
@@ -755,7 +779,7 @@ function lt({ card: e, entity: n, record: r, objectStatuses: i, objectProperties
755
779
  overflowWrap: "anywhere"
756
780
  },
757
781
  children: d
758
- }), e.subtitleField && /* @__PURE__ */ F("div", {
782
+ }), e.subtitleField && /* @__PURE__ */ M("div", {
759
783
  style: {
760
784
  marginTop: 4,
761
785
  fontSize: 12.5,
@@ -766,14 +790,14 @@ function lt({ card: e, entity: n, record: r, objectStatuses: i, objectProperties
766
790
  children: l(e.subtitleField)
767
791
  })]
768
792
  }),
769
- f.length > 0 && /* @__PURE__ */ F("div", {
793
+ f.length > 0 && /* @__PURE__ */ M("div", {
770
794
  style: {
771
795
  display: "flex",
772
796
  flexWrap: "wrap",
773
797
  gap: 6,
774
798
  marginTop: 10
775
799
  },
776
- children: f.map((e) => /* @__PURE__ */ F("span", {
800
+ children: f.map((e) => /* @__PURE__ */ M("span", {
777
801
  style: {
778
802
  minWidth: 0,
779
803
  maxWidth: "100%",
@@ -788,7 +812,7 @@ function lt({ card: e, entity: n, record: r, objectStatuses: i, objectProperties
788
812
  children: l(e)
789
813
  }, e))
790
814
  }),
791
- p.length > 0 && /* @__PURE__ */ F("dl", {
815
+ p.length > 0 && /* @__PURE__ */ M("dl", {
792
816
  style: {
793
817
  display: "grid",
794
818
  gridTemplateColumns: "minmax(84px, max-content) minmax(0, 1fr)",
@@ -797,12 +821,12 @@ function lt({ card: e, entity: n, record: r, objectStatuses: i, objectProperties
797
821
  fontSize: 12.5,
798
822
  lineHeight: 1.35
799
823
  },
800
- children: p.map((e) => /* @__PURE__ */ I("div", {
824
+ children: p.map((e) => /* @__PURE__ */ N("div", {
801
825
  style: { display: "contents" },
802
- children: [/* @__PURE__ */ F("dt", {
826
+ children: [/* @__PURE__ */ M("dt", {
803
827
  style: { color: "var(--text-3)" },
804
- children: dt(o, n, e)
805
- }), /* @__PURE__ */ F("dd", {
828
+ children: gt(o, n, e)
829
+ }), /* @__PURE__ */ M("dd", {
806
830
  style: {
807
831
  margin: 0,
808
832
  color: "var(--text-2)",
@@ -813,7 +837,7 @@ function lt({ card: e, entity: n, record: r, objectStatuses: i, objectProperties
813
837
  })]
814
838
  }, e))
815
839
  }),
816
- m.length > 0 && /* @__PURE__ */ F("div", {
840
+ m.length > 0 && /* @__PURE__ */ M("div", {
817
841
  style: {
818
842
  display: "flex",
819
843
  flexWrap: "wrap",
@@ -822,13 +846,13 @@ function lt({ card: e, entity: n, record: r, objectStatuses: i, objectProperties
822
846
  color: "var(--text-3)",
823
847
  fontSize: 11.5
824
848
  },
825
- children: m.map((e) => /* @__PURE__ */ I("span", {
849
+ children: m.map((e) => /* @__PURE__ */ N("span", {
826
850
  style: {
827
851
  minWidth: 0,
828
852
  overflowWrap: "anywhere"
829
853
  },
830
854
  children: [
831
- dt(o, n, e),
855
+ gt(o, n, e),
832
856
  ": ",
833
857
  l(e)
834
858
  ]
@@ -837,7 +861,7 @@ function lt({ card: e, entity: n, record: r, objectStatuses: i, objectProperties
837
861
  ]
838
862
  });
839
863
  }
840
- function ut(e, t, n, r, i, a) {
864
+ function F(e, t, n, r, i, a) {
841
865
  if (n.startsWith("$status.")) {
842
866
  let t = n.slice(8), r = i?.find((e) => e.group_code === t);
843
867
  return e(r?.status_name) || r?.status_code;
@@ -846,16 +870,16 @@ function ut(e, t, n, r, i, a) {
846
870
  let e = n.slice(10);
847
871
  return a?.find((t) => t.property_code === e)?.value;
848
872
  }
849
- return w(t, r, n);
873
+ return Oe(t, r, n);
850
874
  }
851
- function dt(e, t, n) {
875
+ function gt(e, t, n) {
852
876
  if (n.startsWith("$status.")) return n.slice(8);
853
877
  if (n.startsWith("$property.")) return n.slice(10);
854
878
  let r = t.fields.get(n);
855
879
  return r ? s(e, r, n) : n;
856
880
  }
857
- function ft({ title: e, editing: t, isNew: n, isRecordDeleted: r, dirty: i, isSaving: a, hasChildErrors: o, hasFieldErrors: s, canRestore: c, entity: l, screen: u, globalActions: d, entityCode: f, record: p, id: m, listRoute: ee, listRouteExists: te, highlights: ne, showBack: re, onBack: ie, onCancelEdit: se, onSave: ce, onRestore: de, isRestoring: fe, refreshControl: ge, isRealtimeEntity: ye, canManageTemplates: be }) {
858
- let x = _(), xe = _("errors"), S = Me(l), { run: Se } = _e(), C = b("detail"), w = v(), T = pe(), Ce = y(u?.action_layout, l?.action_layout, l?.actions, d, "detail_toolbar"), we = y(u?.action_layout, l?.action_layout, l?.actions, d, "detail"), Te = he(x, we, l?.actions, d, p ?? {}, [], S, Pe(l, p ?? {})), Ee = he(x, Ce, l?.actions, d, p ?? {}, [], S, Pe(l, p ?? {})), De = M(() => {
881
+ function _t({ title: e, editing: t, isNew: n, isRecordDeleted: r, dirty: i, isSaving: a, hasChildErrors: o, hasFieldErrors: s, canRestore: c, entity: l, screen: u, globalActions: d, entityCode: f, record: p, id: m, listRoute: ee, listRouteExists: te, highlights: ne, showBack: re, onBack: ie, onCancelEdit: se, onSave: ce, onRestore: ue, isRestoring: de, refreshControl: pe, isRealtimeEntity: he, canManageTemplates: ge }) {
882
+ let y = le(), Se = le("errors"), Ce = Re(l), { run: we } = be(), Te = b("detail"), x = _(), Ee = _e(), De = v(u?.action_layout, l?.action_layout, l?.actions, d, "detail_toolbar"), Oe = v(u?.action_layout, l?.action_layout, l?.actions, d, "detail"), S = ye(y, Oe, l?.actions, d, p ?? {}, [], Ce, Be(l, p ?? {})), ke = ye(y, De, l?.actions, d, p ?? {}, [], Ce, Be(l, p ?? {})), Ae = k(() => {
859
883
  if (!l) return;
860
884
  let e = m ? [m] : [];
861
885
  return {
@@ -865,8 +889,8 @@ function ft({ title: e, editing: t, isNew: n, isRecordDeleted: r, dirty: i, isSa
865
889
  screenRoute: u?.route ?? "",
866
890
  selectedRows: p ? [p] : [],
867
891
  selectedIds: e,
868
- t: x,
869
- tabNavigate: (e, t) => w(e, {
892
+ t: y,
893
+ tabNavigate: (e, t) => x(e, {
870
894
  title: t?.title,
871
895
  icon: t?.icon,
872
896
  search: t?.search
@@ -880,34 +904,34 @@ function ft({ title: e, editing: t, isNew: n, isRecordDeleted: r, dirty: i, isSa
880
904
  u,
881
905
  m,
882
906
  p,
883
- x,
884
- w
885
- ]), Oe = (e, t) => {
886
- let n = E(xe, e, t, { row: p ?? void 0 });
907
+ y,
908
+ x
909
+ ]), je = (e, t) => {
910
+ let n = C(Se, e, t, { row: p ?? void 0 });
887
911
  if (n === null) return;
888
912
  let r = m ? [m] : [], i = e === "__delete" && te ? ee : null;
889
- return Se({
913
+ return we({
890
914
  action: t,
891
- title: x(t.display?.name) || e,
915
+ title: y(t.display?.name) || e,
892
916
  row: p ?? void 0,
893
917
  execute: (e) => oe(n, ae(e, r)),
894
918
  onSuccess: i ? () => {
895
- me.getState().kill(ve(location)), T(i, { replace: !0 });
919
+ ve.getState().kill(xe(location)), Ee(i, { replace: !0 });
896
920
  } : void 0
897
921
  });
898
- }, ke = C.isVisible("show_actions") && !n && m && Te.length > 0 ? /* @__PURE__ */ F(je, {
899
- layout: Te,
922
+ }, Me = Te.isVisible("show_actions") && !n && m && S.length > 0 ? /* @__PURE__ */ M(Le, {
923
+ layout: S,
900
924
  row: p,
901
- onRun: Oe,
925
+ onRun: je,
902
926
  kind: "detail",
903
927
  entityActions: l?.actions,
904
928
  globalActions: d,
905
929
  reservedRightWidth: 0,
906
- widgetContext: De
907
- }) : null, Ae = !n && m ? /* @__PURE__ */ F(D, {
908
- liveObject: ge,
909
- realtime: ye
910
- }) : null, Ne = C.isVisible("show_actions") && !n && m && Ee.length > 0 ? /* @__PURE__ */ I("div", {
930
+ widgetContext: Ae
931
+ }) : null, Ne = !n && m ? /* @__PURE__ */ M(w, {
932
+ liveObject: pe,
933
+ realtime: he
934
+ }) : null, Pe = Te.isVisible("show_actions") && !n && m && ke.length > 0 ? /* @__PURE__ */ N("div", {
911
935
  style: {
912
936
  display: "flex",
913
937
  justifyContent: "flex-end",
@@ -915,63 +939,63 @@ function ft({ title: e, editing: t, isNew: n, isRecordDeleted: r, dirty: i, isSa
915
939
  gap: 8,
916
940
  marginTop: 10
917
941
  },
918
- children: [ke ? null : Ae, /* @__PURE__ */ F(je, {
919
- layout: Ee,
942
+ children: [Me ? null : Ne, /* @__PURE__ */ M(Le, {
943
+ layout: ke,
920
944
  row: p,
921
- onRun: Oe,
945
+ onRun: je,
922
946
  kind: "detail",
923
947
  entityActions: l?.actions,
924
948
  globalActions: d,
925
949
  reservedRightWidth: 0,
926
- widgetContext: De,
927
- ariaLabel: ke ? x("record.toolbar_actions", "Detail toolbar actions") : x("record.page_actions", "Page actions")
950
+ widgetContext: Ae,
951
+ ariaLabel: Me ? y("record.toolbar_actions", "Detail toolbar actions") : y("record.page_actions", "Page actions")
928
952
  })]
929
- }) : null, Fe = C.isVisible("show_actions") && !n && m && f ? /* @__PURE__ */ F(O, {
953
+ }) : null, Fe = Te.isVisible("show_actions") && !n && m && f ? /* @__PURE__ */ M(T, {
930
954
  entityCode: f,
931
955
  scope: "detail",
932
956
  objectIds: [m],
933
957
  capability: l?.documents,
934
- canManageTemplates: be
935
- }) : null, Ie = r ? c ? /* @__PURE__ */ F(g, {
958
+ canManageTemplates: ge
959
+ }) : null, Ie = r ? c ? /* @__PURE__ */ M(g, {
936
960
  kind: "primary",
937
- icon: F(fe ? le : h.refresh, { size: 13 }),
938
- onClick: de,
939
- disabled: fe,
940
- children: fe ? x("record.restoring", "Restoring…") : x("record.restore", "Restore")
941
- }) : null : t ? /* @__PURE__ */ I($e, { children: [/* @__PURE__ */ F(g, {
942
- icon: /* @__PURE__ */ F(h.x, { size: 13 }),
961
+ icon: M(de ? fe : h.refresh, { size: 13 }),
962
+ onClick: ue,
963
+ disabled: de,
964
+ children: de ? y("record.restoring", "Restoring…") : y("record.restore", "Restore")
965
+ }) : null : t ? /* @__PURE__ */ N(at, { children: [/* @__PURE__ */ M(g, {
966
+ icon: /* @__PURE__ */ M(h.x, { size: 13 }),
943
967
  onClick: se,
944
968
  disabled: a,
945
- children: x("dialog.cancel", "Cancel")
946
- }), /* @__PURE__ */ F(g, {
969
+ children: y("dialog.cancel", "Cancel")
970
+ }), /* @__PURE__ */ M(g, {
947
971
  kind: "primary",
948
- icon: F(a ? le : h.save, { size: 13 }),
972
+ icon: M(a ? fe : h.save, { size: 13 }),
949
973
  onClick: ce,
950
974
  disabled: a || o || s,
951
- title: o ? x("record.save.fix_child_rows", "Fix errors in child rows") : s ? x("record.save.fix_fields", "Fix the highlighted fields") : void 0,
952
- children: a ? x("dialog.saving", "Saving…") : x("dialog.save", "Save")
953
- })] }) : !n && m ? ke ? /* @__PURE__ */ I("span", {
975
+ title: o ? y("record.save.fix_child_rows", "Fix errors in child rows") : s ? y("record.save.fix_fields", "Fix the highlighted fields") : void 0,
976
+ children: a ? y("dialog.saving", "Saving…") : y("dialog.save", "Save")
977
+ })] }) : !n && m ? Me ? /* @__PURE__ */ N("span", {
954
978
  style: { display: "contents" },
955
- children: [Fe, ke]
979
+ children: [Fe, Me]
956
980
  }) : Fe : null;
957
- return /* @__PURE__ */ I($e, { children: [/* @__PURE__ */ F(k, {
958
- icon: l?.display.icon ? /* @__PURE__ */ F(ue, {
981
+ return /* @__PURE__ */ N(at, { children: [/* @__PURE__ */ M(E, {
982
+ icon: l?.display.icon ? /* @__PURE__ */ M(me, {
959
983
  name: l.display.icon,
960
984
  size: 16
961
985
  }) : void 0,
962
986
  title: e,
963
- description: x(u?.display?.description) || x(l?.display?.description),
987
+ description: y(u?.display?.description) || y(l?.display?.description),
964
988
  highlights: ne,
965
- identityControls: !r && !t && !n ? Ae : null,
989
+ identityControls: !r && !t && !n ? Ne : null,
966
990
  mode: n ? "create" : t ? "edit" : "display",
967
991
  dirty: i,
968
992
  showBack: re,
969
993
  onBack: ie,
970
994
  right: Ie,
971
- showTitle: C.isVisible("show_title")
972
- }), Ne] });
995
+ showTitle: Te.isVisible("show_title")
996
+ }), Pe] });
973
997
  }
974
- var pt = {
998
+ var vt = {
975
999
  danger: {
976
1000
  border: "var(--danger)",
977
1001
  background: "var(--danger-soft)",
@@ -988,9 +1012,9 @@ var pt = {
988
1012
  color: "var(--accent)"
989
1013
  }
990
1014
  };
991
- function mt({ tone: e, testId: t, children: n }) {
992
- let r = pt[e];
993
- return /* @__PURE__ */ I("div", {
1015
+ function yt({ tone: e, testId: t, children: n }) {
1016
+ let r = vt[e];
1017
+ return /* @__PURE__ */ N("div", {
994
1018
  "data-testid": t,
995
1019
  style: {
996
1020
  display: "flex",
@@ -1004,14 +1028,14 @@ function mt({ tone: e, testId: t, children: n }) {
1004
1028
  color: r.color,
1005
1029
  fontSize: 12.5
1006
1030
  },
1007
- children: [F(e === "info" ? h.info : h.warning, { size: 14 }), /* @__PURE__ */ F("span", { children: n })]
1031
+ children: [M(e === "info" ? h.info : h.warning, { size: 14 }), /* @__PURE__ */ M("span", { children: n })]
1008
1032
  });
1009
1033
  }
1010
- function ht(e, t, n, r) {
1034
+ function bt(e, t, n, r) {
1011
1035
  let i = t.tenant_key, a = i ? t.fields.get(i) : void 0;
1012
1036
  if (!i || !a?.ref?.entity) return;
1013
1037
  let o = r?.[a.ref.entity]?.[String(n[i])];
1014
1038
  if (o) return p(e, o, a.display?.ref_display_field || "$display", "") || void 0;
1015
1039
  }
1016
1040
  //#endregion
1017
- export { st as SmartDetailPage };
1041
+ export { pt as SmartDetailPage };