@declarion/react 0.57.0 → 0.59.2

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 (166) hide show
  1. package/README.md +0 -2
  2. package/dist-lib/AgentChatPanel.impl-DBH1Ff4G.js +1200 -0
  3. package/dist-lib/DetailAuditStrip-9eJM2Fml.js +288 -0
  4. package/dist-lib/{DraggableChildrenTable-BV5sb8Uo.js → DraggableChildrenTable-4RZC351U.js} +87 -86
  5. package/dist-lib/Grid-CQabaBLx.js +405 -0
  6. package/dist-lib/{LayoutRenderer-C9AH9cXf.js → LayoutRenderer-DGKWZKpW.js} +1000 -1114
  7. package/dist-lib/{ListCardsBody-DXcDg536.js → ListCardsBody-DfGmyNIu.js} +84 -84
  8. package/dist-lib/MarkdownRenderer-BDbzDv_y.js +87 -0
  9. package/dist-lib/{RefreshControl-CNtN8zSl.js → RefreshControl-Bhoib0ZA.js} +126 -155
  10. package/dist-lib/SmartDetailPage.impl-DFjz29Ff.js +1565 -0
  11. package/dist-lib/SmartListPage.impl-BrZLE_Gb.js +3046 -0
  12. package/dist-lib/{SmartRecordListPage.impl-Bkl9aZJ8.js → SmartRecordListPage.impl-C1FJLr80.js} +281 -280
  13. package/dist-lib/SortHeaderMenu-Cijxk4cX.js +107 -0
  14. package/dist-lib/action-dispatch-DY0c8U81.js +1967 -0
  15. package/dist-lib/api/client.d.ts +5 -0
  16. package/dist-lib/api/data.d.ts +2 -4
  17. package/dist-lib/api/entities.d.ts +8 -15
  18. package/dist-lib/api/events.d.ts +3 -3
  19. package/dist-lib/cardProjection-Bkl2SSYz.js +499 -0
  20. package/dist-lib/components/actions/ResponsiveActionBar.d.ts +17 -16
  21. package/dist-lib/components/agents/AgentChatPanel.d.ts +3 -13
  22. package/dist-lib/components/agents/AgentChatPanel.impl.d.ts +14 -0
  23. package/dist-lib/components/agents/AgentPicker.d.ts +1 -2
  24. package/dist-lib/components/chrome/PageShell.d.ts +7 -0
  25. package/dist-lib/components/chrome/RecordHeader.d.ts +1 -2
  26. package/dist-lib/components/chrome/headerActionZone.d.ts +27 -0
  27. package/dist-lib/components/detail-layout/DetailAuditStrip.d.ts +1 -2
  28. package/dist-lib/components/detail-layout/DetailHighlights.d.ts +1 -2
  29. package/dist-lib/components/detail-layout/blockMeta.d.ts +2 -1
  30. package/dist-lib/components/fields/BoolField.d.ts +1 -1
  31. package/dist-lib/components/fields/EnumField.d.ts +1 -1
  32. package/dist-lib/components/fields/IntArrayField.d.ts +1 -1
  33. package/dist-lib/components/fields/MultilangArrayField.d.ts +2 -0
  34. package/dist-lib/components/fields/MultilangField.d.ts +1 -1
  35. package/dist-lib/components/fields/MultilangTextField.d.ts +1 -1
  36. package/dist-lib/components/fields/NumberField.d.ts +1 -1
  37. package/dist-lib/components/fields/PasswordField.d.ts +1 -1
  38. package/dist-lib/components/fields/RefCombobox.d.ts +1 -1
  39. package/dist-lib/components/fields/SecretField.d.ts +1 -1
  40. package/dist-lib/components/fields/StringArrayField.d.ts +1 -1
  41. package/dist-lib/components/fields/TimestampField.d.ts +1 -1
  42. package/dist-lib/components/fields/cells/registry.d.ts +2 -1
  43. package/dist-lib/components/fields/index.d.ts +2 -1
  44. package/dist-lib/components/fields/langMap.d.ts +2 -0
  45. package/dist-lib/components/fields/secretValue.d.ts +2 -0
  46. package/dist-lib/components/file-widgets/UnknownFileWidget.d.ts +3 -0
  47. package/dist-lib/components/file-widgets/UploadFailureText.d.ts +4 -0
  48. package/dist-lib/components/file-widgets/helpers.d.ts +1 -1
  49. package/dist-lib/components/file-widgets/host.d.ts +4 -3
  50. package/dist-lib/components/file-widgets/types.d.ts +1 -0
  51. package/dist-lib/components/file-widgets/upload.d.ts +18 -3
  52. package/dist-lib/components/filters/filter-op-label.d.ts +3 -0
  53. package/dist-lib/components/layout/ImpersonationBanner.d.ts +1 -1
  54. package/dist-lib/components/layout/ImpersonationFrame.d.ts +1 -1
  55. package/dist-lib/components/layout/Layout.d.ts +2 -1
  56. package/dist-lib/components/layout/Sidebar.d.ts +2 -1
  57. package/dist-lib/components/layout/TenantChip.d.ts +1 -1
  58. package/dist-lib/components/list/ViewSwitcher.d.ts +4 -2
  59. package/dist-lib/components/pages/DocumentsMenu.d.ts +1 -2
  60. package/dist-lib/components/pages/ExportMenu.d.ts +3 -5
  61. package/dist-lib/components/pages/RecordDocumentsPanel.d.ts +1 -2
  62. package/dist-lib/components/pages/auth/AuthShell.d.ts +4 -31
  63. package/dist-lib/components/pages/exportRequest.d.ts +4 -6
  64. package/dist-lib/components/pages/list/DeleteViewDialog.d.ts +8 -0
  65. package/dist-lib/components/pages/list/ListCardRow.d.ts +1 -2
  66. package/dist-lib/components/pages/list/ListCardsBody.d.ts +0 -1
  67. package/dist-lib/components/pages/list/ListFloatbar.d.ts +2 -2
  68. package/dist-lib/components/pages/list/ListHeader.d.ts +2 -2
  69. package/dist-lib/components/pages/list/ListNoRows.d.ts +4 -5
  70. package/dist-lib/components/pages/list/ListToolbar.d.ts +3 -2
  71. package/dist-lib/components/pages/list/ListUrlBanner.d.ts +10 -0
  72. package/dist-lib/components/pages/list/RowActionsCell.d.ts +2 -4
  73. package/dist-lib/components/pages/list/RowContextMenu.d.ts +1 -2
  74. package/dist-lib/components/pages/list/columns.d.ts +2 -1
  75. package/dist-lib/components/pages/list/filter-meta.d.ts +2 -1
  76. package/dist-lib/components/pages/list/useActiveView.d.ts +38 -0
  77. package/dist-lib/components/pages/list/useListColumnLayout.d.ts +6 -5
  78. package/dist-lib/components/pages/list/useListQuery.d.ts +4 -4
  79. package/dist-lib/components/pages/list/useListSort.d.ts +5 -4
  80. package/dist-lib/components/pages/list/useListViews.d.ts +18 -8
  81. package/dist-lib/components/pages/list/useRowMenu.d.ts +2 -3
  82. package/dist-lib/components/pages/profile/Profile.d.ts +3 -0
  83. package/dist-lib/components/params/ParamsBlock.d.ts +1 -13
  84. package/dist-lib/components/params/param-editors.d.ts +3 -11
  85. package/dist-lib/components/primitives/ClassifiedFieldLocked.d.ts +1 -2
  86. package/dist-lib/components/shared/DynamicIcon.d.ts +2 -2
  87. package/dist-lib/components/shared/LoadingSkeleton.d.ts +1 -0
  88. package/dist-lib/components/shared/LucideIcon.d.ts +1 -1
  89. package/dist-lib/components/shared/useOwnRefresh.d.ts +1 -1
  90. package/dist-lib/declarion-react.css +1 -1
  91. package/dist-lib/embed/theme.d.ts +1 -1
  92. package/dist-lib/embed/useEmbedNavigate.d.ts +1 -1
  93. package/dist-lib/failure-v-uGSpbX.js +158 -0
  94. package/dist-lib/{field-classification-D6xQYn-h.js → field-classification-C28XE-_P.js} +514 -307
  95. package/dist-lib/format-count-DA4wmmWR.js +1771 -0
  96. package/dist-lib/hooks/useEntityData.d.ts +1 -1
  97. package/dist-lib/hooks/useFilters.d.ts +7 -5
  98. package/dist-lib/hooks/useLanguage.d.ts +4 -0
  99. package/dist-lib/hooks/useParams.d.ts +4 -51
  100. package/dist-lib/hooks/useRegisterScreenTab.d.ts +1 -1
  101. package/dist-lib/hooks/useSSE.d.ts +3 -3
  102. package/dist-lib/hooks/useTabTitle.d.ts +2 -0
  103. package/dist-lib/hooks/useText.d.ts +3 -3
  104. package/dist-lib/hooks/useVersionWatcher.d.ts +1 -1
  105. package/dist-lib/hooks/useViews.d.ts +20 -0
  106. package/dist-lib/index.d.ts +8 -7
  107. package/dist-lib/index.js +2716 -5803
  108. package/dist-lib/lib/action-dispatch.d.ts +2 -1
  109. package/dist-lib/lib/actions.d.ts +30 -42
  110. package/dist-lib/lib/anchor.d.ts +3 -4
  111. package/dist-lib/lib/decimal-text.d.ts +1 -0
  112. package/dist-lib/lib/document-templates.d.ts +1 -2
  113. package/dist-lib/lib/download.d.ts +2 -1
  114. package/dist-lib/lib/evidence-verdict.d.ts +2 -1
  115. package/dist-lib/lib/failure.d.ts +2 -0
  116. package/dist-lib/lib/field-classification.d.ts +3 -3
  117. package/dist-lib/lib/filters.d.ts +18 -2
  118. package/dist-lib/lib/format-count.d.ts +8 -7
  119. package/dist-lib/lib/language.d.ts +19 -0
  120. package/dist-lib/lib/mass-edit.d.ts +2 -1
  121. package/dist-lib/lib/realtime-query-keys.d.ts +1 -1
  122. package/dist-lib/lib/realtime-reconcile.d.ts +3 -4
  123. package/dist-lib/lib/screen-back.d.ts +4 -6
  124. package/dist-lib/lib/sort.d.ts +9 -9
  125. package/dist-lib/lib/timestamp.d.ts +5 -7
  126. package/dist-lib/lib/ui-actions.d.ts +2 -1
  127. package/dist-lib/peekDraftStore-D-cTbiIr.js +199 -0
  128. package/dist-lib/registry-Cb3W-czW.js +1950 -0
  129. package/dist-lib/safe-url-oSJw5pzO.js +34 -0
  130. package/dist-lib/stores/icon-registry.d.ts +2 -2
  131. package/dist-lib/stores/list-layout.d.ts +3 -4
  132. package/dist-lib/stores/realtime.d.ts +1 -1
  133. package/dist-lib/stores/tabs.d.ts +3 -2
  134. package/dist-lib/testing.d.ts +6 -0
  135. package/dist-lib/testing.js +98 -76
  136. package/dist-lib/types/api.d.ts +7 -8
  137. package/dist-lib/types/fieldType.d.ts +1 -1
  138. package/dist-lib/types/files.d.ts +4 -4
  139. package/dist-lib/types/schema.d.ts +44 -50
  140. package/dist-lib/useAgentConversation-D97IqE-J.js +623 -0
  141. package/dist-lib/{useCurrentScreen-CzwzQpoW.js → useCurrentScreen-BL5NZFCw.js} +2777 -3768
  142. package/dist-lib/useListQuery-BG1GyKtJ.js +103 -0
  143. package/dist-lib/useProperties-4Lg3odrt.js +83 -0
  144. package/dist-lib/{useTabSearchMirror-C39U85cg.js → useTabSearchMirror-ZVLlINBX.js} +49 -51
  145. package/dist-lib/useText-BFDCTUSo.js +952 -0
  146. package/dist-lib/{value-Bo8C8WMU.js → value-By1-WJ8J.js} +74 -76
  147. package/dist-lib/vite/fingerprint-plugin.d.ts +2 -3
  148. package/package.json +9 -9
  149. package/dist-lib/Grid-DWgUPuZ3.js +0 -404
  150. package/dist-lib/MarkdownRenderer-CcSFc2N3.js +0 -85
  151. package/dist-lib/RecordIdBadge-CGxPR-8q.js +0 -24
  152. package/dist-lib/SmartDetailPage.impl-lskCd-WG.js +0 -1846
  153. package/dist-lib/SmartListPage.impl-CrGbdzyK.js +0 -2854
  154. package/dist-lib/SortHeaderMenu-SYSAaqQJ.js +0 -106
  155. package/dist-lib/action-dispatch-CR4ajBtT.js +0 -1985
  156. package/dist-lib/cardProjection-CW5RIMko.js +0 -699
  157. package/dist-lib/components/pages/home/HomeStub.d.ts +0 -6
  158. package/dist-lib/components/pages/jobs/Jobs.d.ts +0 -1
  159. package/dist-lib/components/pages/pipeline/Pipeline.d.ts +0 -1
  160. package/dist-lib/format-count-Dobmi-Ji.js +0 -1551
  161. package/dist-lib/hooks/useUserLocale.d.ts +0 -1
  162. package/dist-lib/lib/messages.d.ts +0 -12
  163. package/dist-lib/peekDraftStore-5wQ7lq_V.js +0 -194
  164. package/dist-lib/registry-CjgUaF7C.js +0 -1768
  165. package/dist-lib/useListQuery-D7Hr5WM1.js +0 -96
  166. package/dist-lib/useProperties-CqtCzFCr.js +0 -81
@@ -0,0 +1,1771 @@
1
+ import { s as e, t } from "./DynamicIcon-DW5krHuX.js";
2
+ import { Et as n, Fn as r, G as i, J as a, Ln as o, Mn as s, Pn as c, Rn as l, W as u, Zt as d, bt as f, en as p, i as m, jn as h, on as g, qt as _, rn as v, rt as y } from "./useCurrentScreen-BL5NZFCw.js";
3
+ import { d as b, f as x, t as S } from "./useText-BFDCTUSo.js";
4
+ import { C, M as w, S as T, u as E } from "./field-classification-C28XE-_P.js";
5
+ import { c as ee, o as D, p as te, r as ne } from "./action-dispatch-DY0c8U81.js";
6
+ import { a as O, d as k, f as A, h as j, i as M, o as N, s as P, u as F } from "./useTabSearchMirror-ZVLlINBX.js";
7
+ import { Fragment as I, useCallback as L, useEffect as R, useMemo as z, useRef as B, useState as V } from "react";
8
+ import { useLocation as re, useSearchParams as ie } from "react-router";
9
+ import { Fragment as H, jsx as U, jsxs as W } from "react/jsx-runtime";
10
+ //#region src/components/primitives/Avatar.tsx
11
+ function G({ name: e, size: t = 22, color: n }) {
12
+ let r = e.split(/\s+/).map((e) => e[0]).slice(0, 2).join("").toUpperCase(), i = e.split("").reduce((e, t) => e + t.charCodeAt(0), 0), a = [
13
+ "#DCE4F6",
14
+ "#E4DCF6",
15
+ "#F6DCE4",
16
+ "#F6E4DC",
17
+ "#DCF6E4",
18
+ "#DCF6F1",
19
+ "#F1F6DC",
20
+ "#F6DCF1"
21
+ ], o = n || a[i % a.length];
22
+ return /* @__PURE__ */ U("span", {
23
+ style: {
24
+ display: "inline-flex",
25
+ alignItems: "center",
26
+ justifyContent: "center",
27
+ width: t,
28
+ height: t,
29
+ borderRadius: 999,
30
+ background: o,
31
+ color: "#1E2A4A",
32
+ fontSize: t < 20 ? 9.5 : 10.5,
33
+ fontWeight: 600,
34
+ flexShrink: 0
35
+ },
36
+ children: r
37
+ });
38
+ }
39
+ //#endregion
40
+ //#region src/components/shared/ConfirmDialog.tsx
41
+ function ae({ open: t, onOpenChange: n, title: r, description: i, confirmLabel: a, onConfirm: s, destructive: c = !1 }) {
42
+ let u = S(), d = B(null);
43
+ return R(() => {
44
+ t && d.current?.focus();
45
+ }, [t]), t ? /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("div", {
46
+ onClick: () => n(!1),
47
+ style: {
48
+ position: "fixed",
49
+ inset: 0,
50
+ background: "var(--scrim)",
51
+ zIndex: 60,
52
+ backdropFilter: "blur(2px)"
53
+ }
54
+ }), /* @__PURE__ */ W("div", {
55
+ ref: d,
56
+ role: "dialog",
57
+ "aria-modal": "true",
58
+ "aria-label": r,
59
+ tabIndex: -1,
60
+ onKeyDown: (e) => {
61
+ e.key === "Escape" && n(!1);
62
+ },
63
+ style: {
64
+ position: "fixed",
65
+ top: "50%",
66
+ left: "50%",
67
+ transform: "translate(-50%, -50%)",
68
+ zIndex: 61,
69
+ width: "calc(100vw - 24px)",
70
+ maxWidth: 460,
71
+ maxHeight: "calc(var(--app-height) - var(--safe-area-top) - var(--safe-area-bottom) - 16px)",
72
+ background: "var(--surface)",
73
+ borderRadius: 12,
74
+ boxShadow: "var(--shadow-lg)",
75
+ border: "1px solid var(--border)",
76
+ overflow: "hidden",
77
+ display: "flex",
78
+ flexDirection: "column",
79
+ outline: "none"
80
+ },
81
+ children: [/* @__PURE__ */ W("div", {
82
+ style: {
83
+ padding: "14px 18px",
84
+ display: "flex",
85
+ alignItems: "center",
86
+ gap: 10,
87
+ minWidth: 0,
88
+ overflowY: "auto"
89
+ },
90
+ children: [
91
+ /* @__PURE__ */ U("span", {
92
+ style: {
93
+ width: 28,
94
+ height: 28,
95
+ borderRadius: 7,
96
+ background: c ? "var(--danger-soft)" : "var(--accent-soft)",
97
+ color: c ? "var(--danger)" : "var(--accent)",
98
+ display: "inline-flex",
99
+ alignItems: "center",
100
+ justifyContent: "center",
101
+ flexShrink: 0
102
+ },
103
+ children: U(c ? e.trash : e.info, { size: 15 })
104
+ }),
105
+ /* @__PURE__ */ W("div", {
106
+ style: {
107
+ flex: 1,
108
+ minWidth: 0
109
+ },
110
+ children: [/* @__PURE__ */ U("div", {
111
+ style: {
112
+ fontSize: 14,
113
+ fontWeight: 600,
114
+ color: "var(--text)"
115
+ },
116
+ children: r
117
+ }), /* @__PURE__ */ U("div", {
118
+ style: {
119
+ fontSize: 11.5,
120
+ color: "var(--text-3)",
121
+ marginTop: 2
122
+ },
123
+ children: i
124
+ })]
125
+ }),
126
+ /* @__PURE__ */ U(o, {
127
+ icon: /* @__PURE__ */ U(e.x, { size: 14 }),
128
+ onClick: () => n(!1)
129
+ })
130
+ ]
131
+ }), /* @__PURE__ */ W("div", {
132
+ style: {
133
+ padding: "10px 16px",
134
+ borderTop: "1px solid var(--divider)",
135
+ display: "flex",
136
+ alignItems: "center",
137
+ justifyContent: "flex-end",
138
+ flexWrap: "wrap",
139
+ gap: 8,
140
+ background: "var(--surface-2)",
141
+ flexShrink: 0
142
+ },
143
+ children: [
144
+ /* @__PURE__ */ U("div", { style: { flex: 1 } }),
145
+ /* @__PURE__ */ U(l, {
146
+ onClick: () => n(!1),
147
+ children: u("dialog.cancel", "Cancel")
148
+ }),
149
+ /* @__PURE__ */ U(l, {
150
+ kind: "primary",
151
+ danger: c,
152
+ onClick: () => {
153
+ s(), n(!1);
154
+ },
155
+ children: a ?? u("dialog.confirm", "Confirm")
156
+ })
157
+ ]
158
+ })]
159
+ })] }) : null;
160
+ }
161
+ //#endregion
162
+ //#region src/hooks/useScreen.ts
163
+ function K(e) {
164
+ let { data: t } = x();
165
+ if (t && e) return t.screens[e];
166
+ }
167
+ //#endregion
168
+ //#region src/hooks/useFilters.ts
169
+ var oe = [];
170
+ function se({ defaults: e = oe } = {}) {
171
+ let [t, n] = ie(), r = S("errors"), i = z(() => A(t), [t]), a = i.error === null && t.get("filters") !== null ? i.filters : e, o = z(() => P(a), [a]), s = L((r) => {
172
+ let i = new URLSearchParams(t);
173
+ j(r, i, e), i.set("page", "1"), n(i);
174
+ }, [
175
+ t,
176
+ n,
177
+ e
178
+ ]), c = L(() => {
179
+ let e = new URLSearchParams(t);
180
+ e.delete("filters"), e.set("page", "1"), n(e);
181
+ }, [t, n]);
182
+ return {
183
+ filters: a,
184
+ filterError: i.error === null ? null : r(i.errorCode ?? "", i.error),
185
+ activeCount: o,
186
+ setFilters: s,
187
+ clearFilters: c
188
+ };
189
+ }
190
+ //#endregion
191
+ //#region src/hooks/useViews.ts
192
+ function q(e, t) {
193
+ let n = t && String(e.user_id) === t;
194
+ return {
195
+ id: String(e.id),
196
+ name: typeof e.name == "object" && e.name !== null ? e.name : { en: h(e.name) },
197
+ icon: e.icon,
198
+ source: n ? "personal" : "shared",
199
+ is_default: e.is_default === !0,
200
+ filters: e.filters,
201
+ columns: e.columns,
202
+ sort: e.sort
203
+ };
204
+ }
205
+ function ce(e, t) {
206
+ let r = n("view", {
207
+ filters: [{
208
+ field: "id",
209
+ op: "eq",
210
+ value: e ?? ""
211
+ }],
212
+ per_page: 1
213
+ }, !!e), i = r.data?.data?.[0], a = z(() => i ? q(i, t) : void 0, [i, t]);
214
+ return e ? {
215
+ view: a,
216
+ isSettled: !r.isPending || r.fetchStatus === "paused"
217
+ } : {
218
+ view: void 0,
219
+ isSettled: !0
220
+ };
221
+ }
222
+ function le(e, t) {
223
+ return J(e, t).views;
224
+ }
225
+ function J(e, t) {
226
+ let r = K(e), i = n("view", {
227
+ filters: [{
228
+ field: "screen_code",
229
+ op: "eq",
230
+ value: e
231
+ }, ...t ? [{ or: [{
232
+ field: "user_id",
233
+ op: "eq",
234
+ value: t
235
+ }, {
236
+ field: "is_shared",
237
+ op: "eq",
238
+ value: "true"
239
+ }] }] : []],
240
+ sort: "created_at:desc",
241
+ per_page: 100
242
+ }), a = i.data, o = z(() => {
243
+ let e = [];
244
+ if (r?.views) for (let t of r.views) e.push({
245
+ id: t.code,
246
+ name: t.name,
247
+ icon: t.icon,
248
+ source: "system",
249
+ filters: t.filters,
250
+ columns: t.columns,
251
+ sort: t.sort
252
+ });
253
+ if (a?.data) for (let n of a.data) e.push(q(n, t));
254
+ return e;
255
+ }, [
256
+ r?.views,
257
+ a?.data,
258
+ t
259
+ ]), { refetch: s } = i;
260
+ return {
261
+ views: o,
262
+ isSettled: !i.isPending || i.fetchStatus === "paused",
263
+ isFetching: i.isFetching,
264
+ refetch: L(() => {
265
+ s();
266
+ }, [s])
267
+ };
268
+ }
269
+ //#endregion
270
+ //#region src/hooks/usePageState.ts
271
+ function ue(e, t, n) {
272
+ let r = re(), i = n?.scope === "path" ? T(r) : C(r), a = B(i);
273
+ a.current = i;
274
+ let o = B(t), s = w((t) => t.ttlMs <= 0 ? void 0 : t.entries[i]?.bag[e]), c = s === void 0 ? o.current : s;
275
+ return R(() => {
276
+ w.getState().touch(i);
277
+ }, [i]), [c, L((t) => {
278
+ let n = a.current, r = w.getState(), i = r.read(n, e), s = i === void 0 ? o.current : i, c = typeof t == "function" ? t(s) : t;
279
+ r.set(n, e, c);
280
+ }, [e])];
281
+ }
282
+ //#endregion
283
+ //#region src/components/shared/EmptyState.tsx
284
+ function de({ icon: e, title: n, description: r, action: i }) {
285
+ return /* @__PURE__ */ W("div", {
286
+ "data-testid": "empty-state",
287
+ style: {
288
+ display: "flex",
289
+ flexDirection: "column",
290
+ alignItems: "center",
291
+ justifyContent: "center",
292
+ padding: "64px 16px",
293
+ textAlign: "center"
294
+ },
295
+ children: [
296
+ e && /* @__PURE__ */ U("div", {
297
+ style: {
298
+ marginBottom: 16,
299
+ borderRadius: 999,
300
+ background: "var(--surface-3)",
301
+ padding: 16,
302
+ color: "var(--text-3)",
303
+ display: "inline-flex"
304
+ },
305
+ children: /* @__PURE__ */ U(t, {
306
+ name: e,
307
+ size: 32
308
+ })
309
+ }),
310
+ /* @__PURE__ */ U("h3", {
311
+ style: {
312
+ margin: 0,
313
+ fontSize: 15,
314
+ fontWeight: 600,
315
+ color: "var(--text)"
316
+ },
317
+ children: n
318
+ }),
319
+ r && /* @__PURE__ */ U("p", {
320
+ style: {
321
+ marginTop: 4,
322
+ fontSize: 12.5,
323
+ color: "var(--text-3)",
324
+ maxWidth: 420
325
+ },
326
+ children: r
327
+ }),
328
+ i && /* @__PURE__ */ U("div", {
329
+ style: { marginTop: 16 },
330
+ children: i
331
+ })
332
+ ]
333
+ });
334
+ }
335
+ //#endregion
336
+ //#region src/components/filters/filter-op-label.ts
337
+ function Y(e, t) {
338
+ let n = N[t];
339
+ return n ? e(`filter.op.${t}`, n) : t;
340
+ }
341
+ //#endregion
342
+ //#region src/components/filters/FilterDrawer.tsx
343
+ function fe({ open: t, onClose: n, filters: r, onApply: i, availableFields: a, defaultFilters: s, refs: c }) {
344
+ let u = S(), d = g().category === "phone", [f, p] = V(r), [m, h] = V(!1);
345
+ if (R(() => {
346
+ if (t) {
347
+ if (r.length === 0 && s && s.length > 0) {
348
+ let e = s.flatMap((e) => {
349
+ let t = a.find((t) => t.code === e);
350
+ return t ? [{
351
+ field: e,
352
+ op: t.operators[0] || "eq"
353
+ }] : [];
354
+ });
355
+ p(e);
356
+ return;
357
+ }
358
+ p(r);
359
+ }
360
+ }, [
361
+ t,
362
+ r,
363
+ s,
364
+ a
365
+ ]), !t) return null;
366
+ let _ = k(f), v = new Set(F(f).filter((e) => e.field).map((e) => e.field)), y = (e = f) => {
367
+ let t = new Set(F(e).map((e) => e.field).filter(Boolean)), n = a.find((e) => !t.has(e.code)) ?? a[0];
368
+ return n ? {
369
+ field: n.code,
370
+ op: n.operators[0] || "eq"
371
+ } : {};
372
+ }, b = (e) => {
373
+ let t = a.find((t) => t.code === e);
374
+ if (!t) return;
375
+ let n = t.operators[0] || "eq";
376
+ p((t) => [...t, {
377
+ field: e,
378
+ op: n
379
+ }]), h(!1);
380
+ }, x = () => {
381
+ let e = f.filter((e) => e.field && e.op), t = f.filter((e) => !e.field || !e.op), n = e.length === 1 ? e[0] : e.length > 1 ? { and: e } : {};
382
+ p([...t, { or: [n, {}] }]);
383
+ }, C = (e, t) => {
384
+ p((n) => Q(n, e, (e) => ({
385
+ ...e,
386
+ ...t
387
+ })));
388
+ }, w = (e, t) => {
389
+ p((n) => xe(n, e, t));
390
+ }, T = (e) => {
391
+ p((t) => Se(t, e));
392
+ }, E = (e, t) => {
393
+ p((n) => Q(n, e, (e) => e.or ? {
394
+ ...e,
395
+ or: [...e.or, t]
396
+ } : e.and ? {
397
+ ...e,
398
+ and: [...e.and, t]
399
+ } : e));
400
+ }, ee = (e, t) => {
401
+ let n = [...e, t], r = be(f, n);
402
+ if (!r) return;
403
+ let i = y();
404
+ r.and ? E(n, i) : r.field || r.op || r.or ? w(n, { and: [r, i] }) : w(n, i);
405
+ }, D = (e, t) => {
406
+ if (e.or || e.and) return /* @__PURE__ */ U(ye, {
407
+ node: e,
408
+ renderNode: D,
409
+ onRemoveChild: T,
410
+ onAddCondition: (n) => {
411
+ e.or && n !== void 0 ? ee(t, n) : E(t, y(e.or ?? e.and));
412
+ },
413
+ onAddBranch: () => E(t, {}),
414
+ path: t
415
+ }, t.join("-"));
416
+ if (!e.field || !e.op) return /* @__PURE__ */ U("div", { style: { minHeight: 4 } }, t.join("-"));
417
+ let n = a.find((t) => t.code === e.field);
418
+ return n ? /* @__PURE__ */ U(ve, {
419
+ node: e,
420
+ meta: n,
421
+ refs: c,
422
+ onUpdate: (e) => C(t, e),
423
+ onRemove: () => T(t)
424
+ }, t.join("-")) : null;
425
+ };
426
+ return /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("div", {
427
+ onClick: n,
428
+ style: {
429
+ position: "fixed",
430
+ inset: 0,
431
+ background: "var(--scrim-lite)",
432
+ zIndex: 40
433
+ }
434
+ }), /* @__PURE__ */ W("div", {
435
+ role: "dialog",
436
+ "aria-label": u("filter.drawer.title", "Filters"),
437
+ "aria-modal": "true",
438
+ "data-testid": "filter-drawer",
439
+ style: {
440
+ position: "fixed",
441
+ top: "calc(var(--topbar-h) + var(--safe-area-top))",
442
+ right: "var(--safe-area-right)",
443
+ width: "min(400px, calc(100vw - var(--safe-area-left) - var(--safe-area-right)))",
444
+ height: "calc(var(--app-height) - var(--topbar-h) - var(--safe-area-top) - var(--safe-area-bottom) - var(--tabbar-h))",
445
+ maxHeight: "calc(var(--app-height) - var(--topbar-h) - var(--safe-area-top) - var(--safe-area-bottom) - var(--tabbar-h))",
446
+ background: "var(--surface)",
447
+ borderLeft: "1px solid var(--border)",
448
+ boxShadow: "var(--shadow-lg)",
449
+ zIndex: 50,
450
+ display: "flex",
451
+ flexDirection: "column",
452
+ boxSizing: "border-box",
453
+ minWidth: 0,
454
+ overflow: "hidden"
455
+ },
456
+ children: [
457
+ /* @__PURE__ */ W("div", {
458
+ style: {
459
+ display: "flex",
460
+ alignItems: "center",
461
+ justifyContent: "space-between",
462
+ padding: "10px 14px",
463
+ borderBottom: "1px solid var(--divider)"
464
+ },
465
+ children: [/* @__PURE__ */ W("div", {
466
+ style: {
467
+ display: "flex",
468
+ alignItems: "center",
469
+ gap: 8
470
+ },
471
+ children: [/* @__PURE__ */ U(e.filter, { size: 14 }), /* @__PURE__ */ U("h3", {
472
+ style: {
473
+ margin: 0,
474
+ fontSize: 13,
475
+ fontWeight: 600,
476
+ color: "var(--text)"
477
+ },
478
+ children: u("filter.drawer.title", "Filters")
479
+ })]
480
+ }), /* @__PURE__ */ U(o, {
481
+ icon: /* @__PURE__ */ U(e.x, { size: 14 }),
482
+ onClick: n,
483
+ title: u("filter.drawer.close", "Close")
484
+ })]
485
+ }),
486
+ /* @__PURE__ */ W("div", {
487
+ style: {
488
+ flex: 1,
489
+ overflowY: "auto",
490
+ padding: 14,
491
+ display: "flex",
492
+ flexDirection: "column",
493
+ gap: 10,
494
+ minWidth: 0,
495
+ minHeight: 0
496
+ },
497
+ children: [f.map((e, t) => D(e, [t])), /* @__PURE__ */ U("div", {
498
+ style: {
499
+ display: "flex",
500
+ alignItems: "center",
501
+ gap: 6,
502
+ paddingTop: 6
503
+ },
504
+ children: m ? /* @__PURE__ */ U(Ce, {
505
+ fields: a,
506
+ activeFields: v,
507
+ compact: d,
508
+ onSelect: b,
509
+ onCancel: () => h(!1)
510
+ }) : /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U(l, {
511
+ icon: /* @__PURE__ */ U(e.plus, { size: 12 }),
512
+ onClick: () => h(!0),
513
+ children: u("filter.drawer.add_filter", "Add filter")
514
+ }), !_ && F(f).length > 0 && /* @__PURE__ */ U(l, {
515
+ kind: "ghost",
516
+ icon: /* @__PURE__ */ U(e.plus, { size: 12 }),
517
+ onClick: x,
518
+ children: u("filter.drawer.add_or_group", "Add OR group")
519
+ })] })
520
+ })]
521
+ }),
522
+ /* @__PURE__ */ W("div", {
523
+ style: {
524
+ display: "flex",
525
+ alignItems: "center",
526
+ padding: "10px 14px",
527
+ borderTop: "1px solid var(--divider)",
528
+ background: "var(--surface-2)",
529
+ gap: 6,
530
+ flexWrap: "wrap",
531
+ minWidth: 0,
532
+ paddingBottom: "calc(10px + var(--safe-area-bottom))"
533
+ },
534
+ children: [
535
+ /* @__PURE__ */ U(l, {
536
+ kind: "ghost",
537
+ onClick: () => {
538
+ p([]);
539
+ },
540
+ children: u("filter.drawer.reset", "Reset")
541
+ }),
542
+ /* @__PURE__ */ U("div", { style: { flex: 1 } }),
543
+ /* @__PURE__ */ U(l, {
544
+ onClick: n,
545
+ children: u("dialog.cancel", "Cancel")
546
+ }),
547
+ /* @__PURE__ */ U(l, {
548
+ kind: "primary",
549
+ onClick: () => {
550
+ i(X(f)), n();
551
+ },
552
+ children: u("filter.drawer.apply", "Apply")
553
+ })
554
+ ]
555
+ })
556
+ ]
557
+ })] });
558
+ }
559
+ function pe(e) {
560
+ return e == null || e === "" ? !1 : !Array.isArray(e) || e.length > 0;
561
+ }
562
+ function X(e) {
563
+ let t = [];
564
+ for (let n of e) {
565
+ if (n.or) {
566
+ let e = X(n.or);
567
+ e.length > 0 && t.push({
568
+ ...n,
569
+ or: e
570
+ });
571
+ continue;
572
+ }
573
+ if (n.and) {
574
+ let e = X(n.and);
575
+ e.length > 0 && t.push({
576
+ ...n,
577
+ and: e
578
+ });
579
+ continue;
580
+ }
581
+ n.field && n.op && (O.has(n.op) || pe(n.value)) && t.push(n);
582
+ }
583
+ return t;
584
+ }
585
+ function Z(e, t) {
586
+ return !t || t.length === 0 ? [] : [
587
+ {
588
+ value: "",
589
+ label: e("filter.value.special", "Special values"),
590
+ heading: !0
591
+ },
592
+ ...t.map((t) => ({
593
+ value: t.code,
594
+ label: e(t.label) || t.code
595
+ })),
596
+ {
597
+ value: "",
598
+ label: "",
599
+ divider: !0
600
+ }
601
+ ];
602
+ }
603
+ var me = "__custom__";
604
+ function he({ meta: e, value: t, onUpdate: n }) {
605
+ let r = S(), i = e.specialValues ?? [], a = h(t), o = i.some((e) => e.code === a), [s, c] = V(!o && a !== "");
606
+ return s ? /* @__PURE__ */ U(p, {
607
+ "aria-label": r("filter.value.aria", "{field} filter value", { field: e.label }),
608
+ value: a,
609
+ onChange: (e) => n({ value: e }),
610
+ placeholder: r("filter.value.placeholder", "Value…"),
611
+ autoFocus: !0
612
+ }) : /* @__PURE__ */ U(d, {
613
+ "aria-label": r("filter.value.aria", "{field} filter value", { field: e.label }),
614
+ value: a,
615
+ options: [
616
+ {
617
+ value: "",
618
+ label: r("filter.value.select", "Select…")
619
+ },
620
+ ...Z(r, i),
621
+ {
622
+ value: me,
623
+ label: r("filter.value.custom", "Custom value…")
624
+ }
625
+ ],
626
+ onChange: (e) => {
627
+ e === me ? (c(!0), n({ value: "" })) : n({ value: e });
628
+ }
629
+ });
630
+ }
631
+ function ge(e) {
632
+ return Array.isArray(e) ? e.map((e) => h(e)) : e == null || e === "" ? [] : [h(e)];
633
+ }
634
+ function _e(e) {
635
+ return Array.isArray(e) ? e.length > 0 ? h(e[0]) : "" : h(e);
636
+ }
637
+ function ve({ node: t, meta: n, refs: r, onUpdate: i, onRemove: a }) {
638
+ let s = S(), c = O.has(t.op), l = M.has(t.op), u = n.operators.map((e) => ({
639
+ value: e,
640
+ label: Y(s, e)
641
+ })), m = s("filter.value.aria", "{field} filter value", { field: n.label }), g = (e) => {
642
+ let n = M.has(t.op), r = M.has(e);
643
+ if (r === n) {
644
+ i({ op: e });
645
+ return;
646
+ }
647
+ i({
648
+ op: e,
649
+ value: r ? ge(t.value) : _e(t.value)
650
+ });
651
+ };
652
+ return /* @__PURE__ */ W("div", {
653
+ style: {
654
+ display: "flex",
655
+ flexDirection: "column",
656
+ gap: 6,
657
+ minWidth: 0
658
+ },
659
+ children: [/* @__PURE__ */ W("div", {
660
+ style: {
661
+ display: "flex",
662
+ alignItems: "center",
663
+ gap: 8,
664
+ minWidth: 0
665
+ },
666
+ children: [/* @__PURE__ */ U("span", {
667
+ style: {
668
+ flex: 1,
669
+ fontSize: 12.5,
670
+ fontWeight: 600,
671
+ color: "var(--text)",
672
+ overflow: "hidden",
673
+ textOverflow: "ellipsis",
674
+ whiteSpace: "nowrap",
675
+ minWidth: 0
676
+ },
677
+ title: n.label,
678
+ children: n.label
679
+ }), /* @__PURE__ */ U(o, {
680
+ size: 22,
681
+ icon: /* @__PURE__ */ U(e.x, { size: 12 }),
682
+ onClick: a,
683
+ title: s("filter.drawer.remove", "Remove")
684
+ })]
685
+ }), /* @__PURE__ */ W("div", {
686
+ style: {
687
+ display: "grid",
688
+ gridTemplateColumns: c ? "minmax(0, 1fr)" : "minmax(112px, 152px) minmax(0, 1fr)",
689
+ gap: 6,
690
+ alignItems: "start",
691
+ minWidth: 0
692
+ },
693
+ children: [/* @__PURE__ */ U(d, {
694
+ "aria-label": s("filter.operator.aria", "{field} filter operator", { field: n.label }),
695
+ value: t.op ?? u[0]?.value,
696
+ options: u,
697
+ onChange: (e) => g(e)
698
+ }), c ? null : l && n.options ? /* @__PURE__ */ U(_, {
699
+ "aria-label": m,
700
+ value: ge(t.value),
701
+ options: [...Z(s, n.specialValues), ...n.options.map((e) => ({
702
+ value: e.value,
703
+ label: e.label
704
+ }))],
705
+ onChange: (e) => i({ value: e }),
706
+ placeholder: s("filter.value.select", "Select…")
707
+ }) : n.type === "ref" && n.ref?.entity ? /* @__PURE__ */ U(f, {
708
+ ref: n.ref,
709
+ value: t.value,
710
+ onChange: (e) => i({ value: e ?? "" }),
711
+ refs: r,
712
+ ariaLabel: m,
713
+ placeholder: s("filter.value.select", "Select…"),
714
+ specialValues: n.specialValues
715
+ }) : n.options ? /* @__PURE__ */ U(d, {
716
+ "aria-label": m,
717
+ value: h(t.value),
718
+ options: [...Z(s, n.specialValues), ...n.options.map((e) => ({
719
+ value: e.value,
720
+ label: e.label
721
+ }))],
722
+ onChange: (e) => i({ value: e }),
723
+ placeholder: s("filter.value.select", "Select…")
724
+ }) : n.specialValues && n.specialValues.length > 0 ? /* @__PURE__ */ U(he, {
725
+ meta: n,
726
+ value: t.value,
727
+ onUpdate: i
728
+ }) : /* @__PURE__ */ U(p, {
729
+ "aria-label": m,
730
+ value: h(t.value),
731
+ onChange: (e) => i({ value: e }),
732
+ placeholder: s("filter.value.placeholder", "Value…")
733
+ })]
734
+ })]
735
+ });
736
+ }
737
+ function ye({ node: t, renderNode: n, onRemoveChild: r, onAddCondition: i, onAddBranch: a, path: s }) {
738
+ let c = S(), u = t.or ?? t.and ?? [], d = t.or !== void 0;
739
+ return /* @__PURE__ */ W("div", {
740
+ style: {
741
+ display: "flex",
742
+ flexDirection: "column",
743
+ gap: 8
744
+ },
745
+ children: [
746
+ u.map((t, a) => {
747
+ let u = [...s, a], f = d && t.and ? t.and : [t];
748
+ return /* @__PURE__ */ W("div", { children: [d && a > 0 && /* @__PURE__ */ W("div", {
749
+ style: {
750
+ display: "flex",
751
+ alignItems: "center",
752
+ gap: 8,
753
+ padding: "4px 0"
754
+ },
755
+ children: [
756
+ /* @__PURE__ */ U("div", { style: {
757
+ flex: 1,
758
+ borderTop: "1px solid var(--divider)"
759
+ } }),
760
+ /* @__PURE__ */ U("span", {
761
+ style: {
762
+ fontSize: 11,
763
+ fontWeight: 600,
764
+ color: "var(--text-3)",
765
+ padding: "0 6px"
766
+ },
767
+ children: c("filter.join.or", "OR")
768
+ }),
769
+ /* @__PURE__ */ U("div", { style: {
770
+ flex: 1,
771
+ borderTop: "1px solid var(--divider)"
772
+ } })
773
+ ]
774
+ }), /* @__PURE__ */ W("div", {
775
+ style: {
776
+ border: "1px solid var(--border)",
777
+ borderRadius: 8,
778
+ padding: 10,
779
+ display: "flex",
780
+ flexDirection: "column",
781
+ gap: 8
782
+ },
783
+ children: [
784
+ d && /* @__PURE__ */ U("div", {
785
+ style: {
786
+ fontSize: 10.5,
787
+ fontWeight: 600,
788
+ color: "var(--text-3)",
789
+ textTransform: "uppercase",
790
+ letterSpacing: "0.08em"
791
+ },
792
+ children: c("filter.group.match_all", "Match ALL")
793
+ }),
794
+ f.map((e, r) => n(e, d && t.and ? [...u, r] : u)),
795
+ d && /* @__PURE__ */ U(l, {
796
+ kind: "ghost",
797
+ size: "xs",
798
+ icon: /* @__PURE__ */ U(e.plus, { size: 11 }),
799
+ onClick: () => i(a),
800
+ children: c("filter.group.add_condition", "Add condition")
801
+ }),
802
+ d && /* @__PURE__ */ U(o, {
803
+ size: 22,
804
+ icon: /* @__PURE__ */ U(e.x, { size: 12 }),
805
+ onClick: () => r(u),
806
+ title: c("filter.group.remove_alternative", "Remove OR alternative")
807
+ })
808
+ ]
809
+ })] }, a);
810
+ }),
811
+ !d && /* @__PURE__ */ U(l, {
812
+ kind: "ghost",
813
+ size: "xs",
814
+ icon: /* @__PURE__ */ U(e.plus, { size: 11 }),
815
+ onClick: () => i(),
816
+ children: c("filter.group.add_condition", "Add condition")
817
+ }),
818
+ d && /* @__PURE__ */ U(l, {
819
+ kind: "ghost",
820
+ size: "xs",
821
+ icon: /* @__PURE__ */ U(e.plus, { size: 11 }),
822
+ onClick: a,
823
+ children: c("filter.drawer.add_or_group", "Add OR group")
824
+ })
825
+ ]
826
+ });
827
+ }
828
+ function be(e, t) {
829
+ let n = e, r;
830
+ for (let e = 0; e < t.length; e += 1) {
831
+ let i = t[e];
832
+ if (r = n[i], !r) return;
833
+ e < t.length - 1 && (n = r.or ?? r.and ?? []);
834
+ }
835
+ return r;
836
+ }
837
+ function Q(e, t, n) {
838
+ if (t.length === 0) return e;
839
+ let [r, ...i] = t;
840
+ return e.map((e, t) => {
841
+ if (t !== r) return e;
842
+ if (i.length === 0) return n(e);
843
+ let a = e.or ? "or" : "and", o = e.or ?? e.and;
844
+ if (!o) return e;
845
+ let s = Q(o, i, n);
846
+ return a === "or" ? {
847
+ ...e,
848
+ or: s
849
+ } : {
850
+ ...e,
851
+ and: s
852
+ };
853
+ });
854
+ }
855
+ function xe(e, t, n) {
856
+ if (t.length === 0) return e;
857
+ let [r, ...i] = t;
858
+ return e.map((e, t) => {
859
+ if (t !== r) return e;
860
+ if (i.length === 0) return n;
861
+ let a = e.or ?? e.and;
862
+ if (!a) return e;
863
+ let o = xe(a, i, n);
864
+ return e.or ? {
865
+ ...e,
866
+ or: o
867
+ } : {
868
+ ...e,
869
+ and: o
870
+ };
871
+ });
872
+ }
873
+ function Se(e, t) {
874
+ if (t.length === 0) return e;
875
+ let [n, ...r] = t;
876
+ return r.length === 0 ? e.filter((e, t) => t !== n) : e.map((e, t) => {
877
+ if (t !== n) return e;
878
+ let i = e.or ?? e.and;
879
+ if (!i) return e;
880
+ let a = Se(i, r);
881
+ return e.or ? {
882
+ ...e,
883
+ or: a
884
+ } : {
885
+ ...e,
886
+ and: a
887
+ };
888
+ });
889
+ }
890
+ function Ce({ fields: t, activeFields: n, compact: r, onSelect: i, onCancel: a }) {
891
+ let o = S(), [s, c] = V(""), u = t.filter((e) => !n.has(e.code) && (s === "" || e.label.toLowerCase().includes(s.toLowerCase()) || e.code.toLowerCase().includes(s.toLowerCase())));
892
+ return /* @__PURE__ */ W("div", {
893
+ style: {
894
+ width: "100%",
895
+ border: "1px solid var(--border)",
896
+ borderRadius: 8,
897
+ padding: 8,
898
+ display: "flex",
899
+ flexDirection: "column",
900
+ gap: 6,
901
+ minWidth: 0,
902
+ boxSizing: "border-box"
903
+ },
904
+ children: [
905
+ /* @__PURE__ */ U(p, {
906
+ value: s,
907
+ onChange: c,
908
+ placeholder: o("filter.fields.search", "Search fields…"),
909
+ prefix: /* @__PURE__ */ U(e.search, { size: 12 }),
910
+ autoFocus: !0
911
+ }),
912
+ /* @__PURE__ */ W("div", {
913
+ style: {
914
+ maxHeight: 200,
915
+ overflow: "auto",
916
+ display: "flex",
917
+ flexDirection: "column"
918
+ },
919
+ children: [u.map((e) => /* @__PURE__ */ W("button", {
920
+ "data-testid": `filter-field-${e.code}`,
921
+ onClick: () => i(e.code),
922
+ style: {
923
+ textAlign: "left",
924
+ padding: "6px 8px",
925
+ fontSize: 12,
926
+ background: "transparent",
927
+ border: 0,
928
+ color: "var(--text-2)",
929
+ cursor: "pointer",
930
+ borderRadius: 5,
931
+ display: "flex",
932
+ justifyContent: "space-between",
933
+ gap: 8,
934
+ minWidth: 0
935
+ },
936
+ onMouseEnter: (e) => e.currentTarget.style.background = "var(--surface-3)",
937
+ onMouseLeave: (e) => e.currentTarget.style.background = "transparent",
938
+ children: [/* @__PURE__ */ U("span", {
939
+ style: {
940
+ minWidth: 0,
941
+ overflow: "hidden",
942
+ textOverflow: "ellipsis",
943
+ whiteSpace: "nowrap"
944
+ },
945
+ children: e.label
946
+ }), /* @__PURE__ */ U("span", {
947
+ className: "mono",
948
+ style: {
949
+ color: "var(--text-4)",
950
+ fontSize: 10.5,
951
+ display: r ? "none" : void 0
952
+ },
953
+ children: e.code
954
+ })]
955
+ }, e.code)), u.length === 0 && /* @__PURE__ */ U("div", {
956
+ style: {
957
+ fontSize: 12,
958
+ color: "var(--text-3)",
959
+ padding: "6px 8px"
960
+ },
961
+ children: o("filter.fields.none", "No fields available")
962
+ })]
963
+ }),
964
+ /* @__PURE__ */ U(l, {
965
+ kind: "ghost",
966
+ size: "xs",
967
+ onClick: a,
968
+ style: { justifyContent: "center" },
969
+ children: o("dialog.cancel", "Cancel")
970
+ })
971
+ ]
972
+ });
973
+ }
974
+ //#endregion
975
+ //#region src/components/filters/FilterChips.tsx
976
+ function we({ filters: t, onRemove: n, onClearAll: r, onChipClick: i, fieldLabel: a = (e) => e, resolveValue: o }) {
977
+ let s = S();
978
+ return t.length === 0 ? null : /* @__PURE__ */ W("div", {
979
+ style: {
980
+ display: "flex",
981
+ alignItems: "center",
982
+ gap: 8,
983
+ flexWrap: "wrap",
984
+ paddingBottom: 12
985
+ },
986
+ children: [t.map((e, t) => /* @__PURE__ */ W(I, { children: [t > 0 && /* @__PURE__ */ U(Ee, { join: "and" }), /* @__PURE__ */ U(Te, {
987
+ node: e,
988
+ fieldLabel: a,
989
+ resolveValue: o,
990
+ onRemove: n,
991
+ onClick: i
992
+ })] }, t)), /* @__PURE__ */ U(l, {
993
+ kind: "ghost",
994
+ size: "xs",
995
+ icon: /* @__PURE__ */ U(e.x, { size: 11 }),
996
+ onClick: r,
997
+ children: s("filter.chips.clear_all", "Clear all")
998
+ })]
999
+ });
1000
+ }
1001
+ function Te({ node: e, fieldLabel: t, resolveValue: n, onRemove: r, onClick: i }) {
1002
+ if (e.field && e.op) return /* @__PURE__ */ U(De, {
1003
+ node: e,
1004
+ fieldLabel: t,
1005
+ resolveValue: n,
1006
+ onRemove: () => r(e.field),
1007
+ onClick: i
1008
+ });
1009
+ let a = e.or ?? e.and ?? [], o = e.or ? "or" : "and";
1010
+ return /* @__PURE__ */ W("span", {
1011
+ "data-testid": `filter-${e.or ? "or" : "and"}-group`,
1012
+ style: {
1013
+ display: "inline-flex",
1014
+ alignItems: "center",
1015
+ gap: 4,
1016
+ flexWrap: "wrap",
1017
+ border: "1px solid var(--divider)",
1018
+ borderRadius: 6,
1019
+ padding: "2px 5px"
1020
+ },
1021
+ children: [
1022
+ /* @__PURE__ */ U("span", {
1023
+ "aria-hidden": "true",
1024
+ style: {
1025
+ color: "var(--text-3)",
1026
+ fontWeight: 600
1027
+ },
1028
+ children: "("
1029
+ }),
1030
+ a.map((e, a) => /* @__PURE__ */ W(I, { children: [a > 0 && /* @__PURE__ */ U(Ee, { join: o }), /* @__PURE__ */ U(Te, {
1031
+ node: e,
1032
+ fieldLabel: t,
1033
+ resolveValue: n,
1034
+ onRemove: r,
1035
+ onClick: i
1036
+ })] }, a)),
1037
+ /* @__PURE__ */ U("span", {
1038
+ "aria-hidden": "true",
1039
+ style: {
1040
+ color: "var(--text-3)",
1041
+ fontWeight: 600
1042
+ },
1043
+ children: ")"
1044
+ })
1045
+ ]
1046
+ });
1047
+ }
1048
+ function Ee({ join: e }) {
1049
+ let t = S(), n = e === "or" ? t("filter.join.or", "OR") : t("filter.join.and", "AND");
1050
+ return /* @__PURE__ */ U("span", {
1051
+ "aria-label": n,
1052
+ style: {
1053
+ fontSize: 11,
1054
+ color: "var(--text-3)",
1055
+ fontWeight: 600,
1056
+ padding: "0 2px"
1057
+ },
1058
+ children: n
1059
+ });
1060
+ }
1061
+ function De({ node: t, fieldLabel: n, resolveValue: r, onRemove: i, onClick: a }) {
1062
+ let o = /* @__PURE__ */ U(e.filter, { size: 11 });
1063
+ return /* @__PURE__ */ U(s, {
1064
+ tone: "slate",
1065
+ icon: o,
1066
+ onClick: a,
1067
+ onRemove: i,
1068
+ children: /* @__PURE__ */ W("span", { children: [
1069
+ /* @__PURE__ */ U("span", {
1070
+ style: { color: "var(--text-3)" },
1071
+ children: n(t.field)
1072
+ }),
1073
+ " ",
1074
+ /* @__PURE__ */ U("span", {
1075
+ style: { fontWeight: 600 },
1076
+ children: /* @__PURE__ */ U(Oe, {
1077
+ node: t,
1078
+ resolveValue: r
1079
+ })
1080
+ })
1081
+ ] })
1082
+ });
1083
+ }
1084
+ function Oe({ node: e, resolveValue: t }) {
1085
+ let n = S(), r = e.op, i = Y(n, r);
1086
+ if (O.has(r)) return /* @__PURE__ */ U(H, { children: i });
1087
+ let a = Array.isArray(e.value) ? e.value : [e.value];
1088
+ return t ? /* @__PURE__ */ W(H, { children: [
1089
+ i,
1090
+ " ",
1091
+ a.map((n, r) => {
1092
+ let i = t(e.field, n);
1093
+ return /* @__PURE__ */ W(I, { children: [r > 0 ? ", " : "", /* @__PURE__ */ U("span", { children: i.status === "loading" ? /* @__PURE__ */ U(ke, {}) : i.label ?? i.raw })] }, r);
1094
+ })
1095
+ ] }) : /* @__PURE__ */ U(H, { children: `${i} ${a.map(h).join(", ")}` });
1096
+ }
1097
+ function ke() {
1098
+ let e = S();
1099
+ return /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("style", { children: E }), /* @__PURE__ */ U("span", {
1100
+ "aria-label": e("filter.chips.loading", "loading"),
1101
+ style: {
1102
+ display: "inline-block",
1103
+ width: 52,
1104
+ height: "0.72em",
1105
+ verticalAlign: "middle",
1106
+ borderRadius: 4,
1107
+ background: "linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 40%, var(--surface-3) 80%)",
1108
+ backgroundSize: "200% 100%",
1109
+ animation: "declarion-shimmer 1.2s ease-in-out infinite"
1110
+ }
1111
+ })] });
1112
+ }
1113
+ //#endregion
1114
+ //#region src/components/list/ColumnPicker.tsx
1115
+ function Ae({ availableColumns: t, visibleColumns: n, onToggle: r, onMove: i, onReset: a, onShowAll: s, onResetWidths: u, columnLabel: d = (e) => e }) {
1116
+ let f = S(), p = B(null), [m, h] = V(!1), g = t.filter((e) => !n.includes(e)), _ = (e) => /* @__PURE__ */ U("div", {
1117
+ style: {
1118
+ padding: "6px 8px 4px",
1119
+ fontSize: 10.5,
1120
+ color: "var(--text-3)",
1121
+ fontWeight: 600,
1122
+ letterSpacing: "0.06em",
1123
+ textTransform: "uppercase"
1124
+ },
1125
+ children: e
1126
+ });
1127
+ return /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U(l, {
1128
+ ref: p,
1129
+ icon: /* @__PURE__ */ U(e.columns, { size: 13 }),
1130
+ onClick: () => h((e) => !e),
1131
+ active: m,
1132
+ children: f("list.columns.button", "Columns")
1133
+ }), /* @__PURE__ */ W(c, {
1134
+ open: m,
1135
+ anchor: p.current,
1136
+ onClose: () => h(!1),
1137
+ align: "end",
1138
+ width: 240,
1139
+ children: [
1140
+ _(f("list.columns.visible", "Visible columns")),
1141
+ n.map((t, a) => /* @__PURE__ */ W("div", {
1142
+ style: {
1143
+ display: "flex",
1144
+ alignItems: "center",
1145
+ gap: 2,
1146
+ padding: "0 6px 0 8px"
1147
+ },
1148
+ children: [/* @__PURE__ */ W("button", {
1149
+ type: "button",
1150
+ onClick: () => r(t),
1151
+ "aria-label": f("list.columns.hide", "Hide {column}", { column: d(t) }),
1152
+ style: {
1153
+ flex: 1,
1154
+ display: "flex",
1155
+ alignItems: "center",
1156
+ gap: 6,
1157
+ minWidth: 0,
1158
+ background: "none",
1159
+ border: 0,
1160
+ cursor: "pointer",
1161
+ textAlign: "left",
1162
+ color: "var(--text)",
1163
+ font: "inherit",
1164
+ fontSize: 12.5,
1165
+ padding: "4px 0"
1166
+ },
1167
+ children: [/* @__PURE__ */ U(e.check, { size: 12 }), /* @__PURE__ */ U("span", {
1168
+ style: {
1169
+ overflow: "hidden",
1170
+ textOverflow: "ellipsis",
1171
+ whiteSpace: "nowrap"
1172
+ },
1173
+ children: d(t)
1174
+ })]
1175
+ }), i && /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U(o, {
1176
+ icon: /* @__PURE__ */ U(e.arrowUp, { size: 12 }),
1177
+ title: f("list.columns.move_up", "Move {column} up", { column: d(t) }),
1178
+ size: 22,
1179
+ disabled: a === 0,
1180
+ onClick: () => i(t, "up")
1181
+ }), /* @__PURE__ */ U(o, {
1182
+ icon: /* @__PURE__ */ U(e.arrowDown, { size: 12 }),
1183
+ title: f("list.columns.move_down", "Move {column} down", { column: d(t) }),
1184
+ size: 22,
1185
+ disabled: a === n.length - 1,
1186
+ onClick: () => i(t, "down")
1187
+ })] })]
1188
+ }, t)),
1189
+ g.length > 0 && /* @__PURE__ */ W(H, { children: [_(f("list.columns.hidden", "Hidden columns")), g.map((e) => /* @__PURE__ */ U(v, {
1190
+ icon: /* @__PURE__ */ U("span", { style: {
1191
+ width: 12,
1192
+ display: "inline-block"
1193
+ } }),
1194
+ onClick: () => r(e),
1195
+ children: d(e)
1196
+ }, e))] }),
1197
+ /* @__PURE__ */ U(v, { divider: !0 }),
1198
+ /* @__PURE__ */ U(v, {
1199
+ icon: /* @__PURE__ */ U(e.refresh, { size: 12 }),
1200
+ onClick: a,
1201
+ children: f("list.columns.reset", "Reset columns")
1202
+ }),
1203
+ /* @__PURE__ */ U(v, {
1204
+ icon: /* @__PURE__ */ U(e.eye, { size: 12 }),
1205
+ onClick: s,
1206
+ children: f("list.columns.show_all", "Show all")
1207
+ }),
1208
+ u && /* @__PURE__ */ U(v, {
1209
+ icon: /* @__PURE__ */ U(e.columns, { size: 12 }),
1210
+ onClick: u,
1211
+ children: f("list.columns.reset_widths", "Reset column widths (this device)")
1212
+ })
1213
+ ]
1214
+ })] });
1215
+ }
1216
+ //#endregion
1217
+ //#region src/components/list/ViewSwitcher.tsx
1218
+ var je = e["undo-2"], Me = {
1219
+ display: "flex",
1220
+ alignItems: "center",
1221
+ gap: 6,
1222
+ height: 28,
1223
+ padding: "0 10px",
1224
+ background: "var(--surface)",
1225
+ border: "1px solid var(--border)",
1226
+ borderRadius: 6,
1227
+ cursor: "pointer",
1228
+ fontSize: 12,
1229
+ color: "var(--text-2)",
1230
+ fontFamily: "inherit"
1231
+ };
1232
+ function Ne({ views: t, activeViewId: n, isDirty: r, onSelect: i, onSave: a, onSaveAs: s, onDiscard: u, onDelete: d, deletePending: f = !1 }) {
1233
+ let p = S(), m = B(null), [h, g] = V(!1), _ = t.find((e) => e.id === n), y = t.filter((e) => e.source === "system"), b = t.filter((e) => e.source === "personal"), x = t.filter((e) => e.source === "shared"), C = _ ? p(_.name) : p("list.view.all_records", "All Records"), w = (e) => /* @__PURE__ */ U("div", {
1234
+ style: {
1235
+ padding: "6px 8px 4px",
1236
+ fontSize: 10,
1237
+ color: "var(--text-3)",
1238
+ fontWeight: 700,
1239
+ letterSpacing: "0.08em",
1240
+ textTransform: "uppercase"
1241
+ },
1242
+ children: e
1243
+ });
1244
+ return /* @__PURE__ */ W("div", {
1245
+ style: {
1246
+ display: "flex",
1247
+ alignItems: "center",
1248
+ gap: 6
1249
+ },
1250
+ children: [
1251
+ /* @__PURE__ */ W("button", {
1252
+ ref: m,
1253
+ type: "button",
1254
+ onClick: () => g((e) => !e),
1255
+ style: Me,
1256
+ children: [
1257
+ /* @__PURE__ */ U(e.star, { size: 12 }),
1258
+ /* @__PURE__ */ U("span", { children: C }),
1259
+ r && /* @__PURE__ */ U("span", { style: {
1260
+ display: "inline-block",
1261
+ width: 6,
1262
+ height: 6,
1263
+ borderRadius: 999,
1264
+ background: "var(--warn)",
1265
+ marginLeft: 2
1266
+ } }),
1267
+ /* @__PURE__ */ U(e.down, { size: 11 })
1268
+ ]
1269
+ }),
1270
+ /* @__PURE__ */ W(c, {
1271
+ open: h,
1272
+ anchor: m.current,
1273
+ onClose: () => g(!1),
1274
+ width: 280,
1275
+ children: [
1276
+ /* @__PURE__ */ U(v, {
1277
+ icon: n ? void 0 : /* @__PURE__ */ U(e.check, { size: 12 }),
1278
+ active: !n,
1279
+ onClick: () => {
1280
+ i({
1281
+ id: "",
1282
+ name: { [p.language]: p("list.view.all_records", "All Records") },
1283
+ source: "system"
1284
+ }), g(!1);
1285
+ },
1286
+ children: p("list.view.all_records", "All Records")
1287
+ }),
1288
+ y.length > 0 && w(p("list.view.presets", "Presets")),
1289
+ y.map((t) => /* @__PURE__ */ U(v, {
1290
+ icon: n === t.id ? /* @__PURE__ */ U(e.check, { size: 12 }) : void 0,
1291
+ active: n === t.id,
1292
+ onClick: () => {
1293
+ i(t), g(!1);
1294
+ },
1295
+ children: p(t.name)
1296
+ }, t.id)),
1297
+ b.length > 0 && w(p("list.view.mine", "My Views")),
1298
+ b.map((t) => /* @__PURE__ */ W("div", {
1299
+ style: {
1300
+ display: "flex",
1301
+ alignItems: "center",
1302
+ gap: 2,
1303
+ paddingRight: 6
1304
+ },
1305
+ children: [/* @__PURE__ */ U("div", {
1306
+ style: {
1307
+ flex: 1,
1308
+ minWidth: 0
1309
+ },
1310
+ children: /* @__PURE__ */ U(v, {
1311
+ icon: n === t.id ? /* @__PURE__ */ U(e.check, { size: 12 }) : t.is_default ? /* @__PURE__ */ U(e.star, { size: 12 }) : void 0,
1312
+ active: n === t.id,
1313
+ onClick: () => {
1314
+ i(t), g(!1);
1315
+ },
1316
+ children: p(t.name)
1317
+ })
1318
+ }), d && /* @__PURE__ */ U(o, {
1319
+ icon: /* @__PURE__ */ U(e.trash, { size: 12 }),
1320
+ title: p("list.view.delete_action", "Delete view {name}", { name: p(t.name) }),
1321
+ size: 22,
1322
+ disabled: f,
1323
+ onClick: () => {
1324
+ d(t), g(!1);
1325
+ }
1326
+ })]
1327
+ }, t.id)),
1328
+ x.length > 0 && w(p("list.view.shared", "Shared")),
1329
+ x.map((t) => /* @__PURE__ */ U(v, {
1330
+ icon: n === t.id ? /* @__PURE__ */ U(e.check, { size: 12 }) : /* @__PURE__ */ U(e.globe, { size: 12 }),
1331
+ active: n === t.id,
1332
+ onClick: () => {
1333
+ i(t), g(!1);
1334
+ },
1335
+ children: p(t.name)
1336
+ }, t.id)),
1337
+ s && /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U(v, { divider: !0 }), /* @__PURE__ */ U(v, {
1338
+ icon: /* @__PURE__ */ U(e.plus, { size: 12 }),
1339
+ onClick: () => {
1340
+ s(), g(!1);
1341
+ },
1342
+ children: p("list.view.save_as_menu", "Save as new view…")
1343
+ })] })
1344
+ ]
1345
+ }),
1346
+ r && n && /* @__PURE__ */ W(H, { children: [a && _?.source === "personal" ? /* @__PURE__ */ U(l, {
1347
+ icon: /* @__PURE__ */ U(e.save, { size: 12 }),
1348
+ onClick: a,
1349
+ children: p("list.view.save", "Save")
1350
+ }) : s ? /* @__PURE__ */ U(l, {
1351
+ icon: /* @__PURE__ */ U(e.plus, { size: 12 }),
1352
+ onClick: s,
1353
+ children: p("list.view.save_as", "Save as new")
1354
+ }) : null, u && /* @__PURE__ */ U(l, {
1355
+ kind: "ghost",
1356
+ icon: /* @__PURE__ */ U(je, { size: 12 }),
1357
+ onClick: u,
1358
+ children: p("list.view.discard", "Discard")
1359
+ })] })
1360
+ ]
1361
+ });
1362
+ }
1363
+ //#endregion
1364
+ //#region src/components/list/PeekFieldCell.tsx
1365
+ var Pe = /* @__PURE__ */ new Set([
1366
+ "enum",
1367
+ "bool",
1368
+ "ref"
1369
+ ]);
1370
+ function Fe(e) {
1371
+ let t = e.display?.widget;
1372
+ return t && Pe.has(t) ? !0 : Pe.has(e.type);
1373
+ }
1374
+ function Ie({ field: t, fieldName: n, label: r, value: i, record: a, refs: s, readOnly: c, onCommit: l }) {
1375
+ let u = S(), [d, f] = V(!1), [p, m] = V(i), h = Fe(t);
1376
+ R(() => {
1377
+ d || m(i);
1378
+ }, [i, d]);
1379
+ let g = L(() => {
1380
+ c || (m(i), f(!0));
1381
+ }, [c, i]), _ = L((e) => {
1382
+ l(e === void 0 ? p : e), f(!1);
1383
+ }, [l, p]), v = L(() => {
1384
+ m(i), f(!1);
1385
+ }, [i]), b = L((e) => {
1386
+ if (c || d) return;
1387
+ let t = e.target;
1388
+ t.closest("a") || t.closest("[data-peek-pencil=\"true\"]") || g();
1389
+ }, [
1390
+ c,
1391
+ d,
1392
+ g
1393
+ ]), x = L((e) => {
1394
+ if (!d) {
1395
+ !c && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), g());
1396
+ return;
1397
+ }
1398
+ h || (e.key === "Enter" ? (e.preventDefault(), e.stopPropagation(), _()) : e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), v()));
1399
+ }, [
1400
+ d,
1401
+ h,
1402
+ c,
1403
+ g,
1404
+ _,
1405
+ v
1406
+ ]), C = L((e) => {
1407
+ h ? (m(e), _(e)) : m(e);
1408
+ }, [h, _]), w = y({
1409
+ field: t,
1410
+ fieldName: n,
1411
+ value: i,
1412
+ mode: "display",
1413
+ record: a,
1414
+ refs: s,
1415
+ t: u
1416
+ }), T = d ? y({
1417
+ field: t,
1418
+ fieldName: n,
1419
+ value: p,
1420
+ mode: "edit",
1421
+ onChange: C,
1422
+ record: a,
1423
+ refs: s,
1424
+ t: u
1425
+ }) : null;
1426
+ return /* @__PURE__ */ U("div", {
1427
+ className: "peek-field-cell",
1428
+ "data-editing": d ? "true" : "false",
1429
+ onClick: b,
1430
+ onKeyDown: x,
1431
+ onMouseEnter: (e) => {
1432
+ c || d || (e.currentTarget.style.borderColor = "var(--border)");
1433
+ },
1434
+ onMouseLeave: (e) => {
1435
+ e.currentTarget.style.borderColor = "transparent";
1436
+ },
1437
+ style: {
1438
+ position: "relative",
1439
+ display: "flex",
1440
+ alignItems: "center",
1441
+ gap: 6,
1442
+ padding: "4px 6px",
1443
+ margin: "-4px -6px",
1444
+ borderRadius: 4,
1445
+ minHeight: 28,
1446
+ cursor: c || d ? "default" : "text",
1447
+ border: "1px dashed transparent"
1448
+ },
1449
+ tabIndex: c || d ? -1 : 0,
1450
+ role: c || d ? void 0 : "button",
1451
+ "aria-label": c || d ? void 0 : u("list.peek.edit_field", "Edit {field}", { field: r }),
1452
+ children: d ? /* @__PURE__ */ W("div", {
1453
+ style: {
1454
+ display: "flex",
1455
+ alignItems: "center",
1456
+ gap: 4,
1457
+ flex: 1,
1458
+ minWidth: 0
1459
+ },
1460
+ children: [/* @__PURE__ */ U("div", {
1461
+ style: {
1462
+ flex: 1,
1463
+ minWidth: 0
1464
+ },
1465
+ children: T
1466
+ }), !h && /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U(o, {
1467
+ size: 24,
1468
+ icon: /* @__PURE__ */ U(e.check, { size: 13 }),
1469
+ onClick: () => _(),
1470
+ title: u("dialog.save", "Save")
1471
+ }), /* @__PURE__ */ U(o, {
1472
+ size: 24,
1473
+ icon: /* @__PURE__ */ U(e.x, { size: 13 }),
1474
+ onClick: v,
1475
+ title: u("dialog.cancel", "Cancel")
1476
+ })] })]
1477
+ }) : /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("div", {
1478
+ style: {
1479
+ flex: 1,
1480
+ minWidth: 0
1481
+ },
1482
+ children: w
1483
+ }), !c && /* @__PURE__ */ U("span", {
1484
+ "data-peek-pencil": "true",
1485
+ style: {
1486
+ position: "absolute",
1487
+ right: 4,
1488
+ top: "50%",
1489
+ transform: "translateY(-50%)"
1490
+ },
1491
+ className: "peek-pencil",
1492
+ children: /* @__PURE__ */ U(o, {
1493
+ size: 20,
1494
+ icon: /* @__PURE__ */ U(e.edit, { size: 12 }),
1495
+ onClick: (e) => {
1496
+ e.stopPropagation(), g();
1497
+ },
1498
+ title: u("list.record.edit", "Edit")
1499
+ })
1500
+ })] })
1501
+ });
1502
+ }
1503
+ //#endregion
1504
+ //#region src/components/list/QuickPeek.tsx
1505
+ var Le = {
1506
+ tab: "Tab",
1507
+ esc: "Esc"
1508
+ };
1509
+ function Re({ entity: t, entityCode: n, record: s, title: c, recordId: d, avatarName: f, fields: p, refs: h, screen: g, actions: _, screenActionLayout: v, entityActionLayout: y, executeAction: x, onClose: C, onOpen: w, onSave: T }) {
1510
+ let E = S(), [O, k] = V({ ...s }), [A, j] = V(!1), M = B(null), { run: N } = m(), P = ne(t, g, O);
1511
+ R(() => {
1512
+ k({ ...s }), j(!1);
1513
+ }, [s]), R(() => {
1514
+ M.current?.focus();
1515
+ }, []);
1516
+ let F = z(() => {
1517
+ let e = P?.action_layout ?? v ?? y ?? i(_, "quick_peek"), n = a(e, _, void 0, "quick_peek");
1518
+ return u(E, n, _, void 0, O, [], D(t, O));
1519
+ }, [
1520
+ E,
1521
+ P?.action_layout,
1522
+ v,
1523
+ y,
1524
+ _,
1525
+ O,
1526
+ t
1527
+ ]), I = ({ code: e, action: t }) => {
1528
+ N({
1529
+ action: t,
1530
+ title: E(t.display?.name) || e,
1531
+ row: O,
1532
+ execute: (n) => x(e, t, n)
1533
+ });
1534
+ }, L = (e, t) => {
1535
+ let n = {
1536
+ ...O,
1537
+ [e]: t
1538
+ };
1539
+ k(n), j(!0), T?.(n);
1540
+ }, re = P?.quick_peek?.width ?? 480;
1541
+ return /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("div", {
1542
+ onClick: C,
1543
+ style: {
1544
+ position: "fixed",
1545
+ inset: 0,
1546
+ background: "var(--scrim-lite)",
1547
+ zIndex: 40
1548
+ }
1549
+ }), /* @__PURE__ */ W("aside", {
1550
+ ref: M,
1551
+ role: "dialog",
1552
+ "aria-label": E("list.peek.dialog", "Quick peek"),
1553
+ tabIndex: -1,
1554
+ onKeyDown: (e) => {
1555
+ e.key === "Escape" && C();
1556
+ },
1557
+ style: {
1558
+ position: "fixed",
1559
+ top: "var(--topbar-h)",
1560
+ right: 0,
1561
+ bottom: "var(--tabbar-h)",
1562
+ width: re,
1563
+ background: "var(--surface)",
1564
+ borderLeft: "1px solid var(--border)",
1565
+ zIndex: 41,
1566
+ display: "flex",
1567
+ flexDirection: "column",
1568
+ boxShadow: "var(--shadow-lg)"
1569
+ },
1570
+ children: [
1571
+ /* @__PURE__ */ W("div", {
1572
+ style: {
1573
+ display: "flex",
1574
+ alignItems: "center",
1575
+ padding: "12px 16px",
1576
+ borderBottom: "1px solid var(--divider)",
1577
+ gap: 10
1578
+ },
1579
+ children: [
1580
+ /* @__PURE__ */ U(G, {
1581
+ name: f || c,
1582
+ size: 28
1583
+ }),
1584
+ /* @__PURE__ */ W("div", {
1585
+ style: {
1586
+ flex: 1,
1587
+ minWidth: 0
1588
+ },
1589
+ children: [/* @__PURE__ */ U("div", {
1590
+ style: {
1591
+ fontSize: 14,
1592
+ fontWeight: 600,
1593
+ color: "var(--text)",
1594
+ overflow: "hidden",
1595
+ textOverflow: "ellipsis",
1596
+ whiteSpace: "nowrap"
1597
+ },
1598
+ children: c
1599
+ }), d && /* @__PURE__ */ U("div", {
1600
+ className: "mono",
1601
+ style: {
1602
+ fontSize: 11,
1603
+ color: "var(--text-4)"
1604
+ },
1605
+ children: d
1606
+ })]
1607
+ }),
1608
+ /* @__PURE__ */ U(o, {
1609
+ icon: /* @__PURE__ */ U(e.external, { size: 13 }),
1610
+ title: A ? E("list.peek.open_in_tab_dirty", "Open in tab (keeps unsaved changes)") : E("list.peek.open_in_tab", "Open in tab"),
1611
+ onClick: () => w(A ? O : null)
1612
+ }),
1613
+ /* @__PURE__ */ U(o, {
1614
+ icon: /* @__PURE__ */ U(e.x, { size: 14 }),
1615
+ title: E("list.peek.close", "Close"),
1616
+ onClick: C
1617
+ })
1618
+ ]
1619
+ }),
1620
+ /* @__PURE__ */ W("div", {
1621
+ style: {
1622
+ flex: 1,
1623
+ overflowY: "auto",
1624
+ padding: 14,
1625
+ display: "flex",
1626
+ flexDirection: "column",
1627
+ gap: 10
1628
+ },
1629
+ children: [/* @__PURE__ */ W("div", {
1630
+ style: {
1631
+ padding: "8px 10px",
1632
+ background: "var(--accent-soft)",
1633
+ borderRadius: 6,
1634
+ fontSize: 11.5,
1635
+ color: "var(--accent)",
1636
+ display: "flex",
1637
+ alignItems: "center",
1638
+ gap: 6
1639
+ },
1640
+ children: [
1641
+ /* @__PURE__ */ U(e.sparkle, { size: 12 }),
1642
+ " ",
1643
+ E("list.peek.hint", "Inline quick-edit — click any field to change."),
1644
+ b(E("list.peek.keys_hint", "{tab} to move, {esc} to close."), {
1645
+ tab: /* @__PURE__ */ U(r, { children: Le.tab }),
1646
+ esc: /* @__PURE__ */ U(r, { children: Le.esc })
1647
+ })
1648
+ ]
1649
+ }), p.map((e) => /* @__PURE__ */ U(ze, {
1650
+ label: e.label,
1651
+ children: e.kind === "file" ? te({
1652
+ entity: t,
1653
+ entityCode: n,
1654
+ fieldName: e.key,
1655
+ record: O,
1656
+ mode: e.readOnly ? "display" : "edit",
1657
+ onChange: (t) => L(e.key, t),
1658
+ refs: h,
1659
+ disabled: e.readOnly,
1660
+ t: E
1661
+ }) : /* @__PURE__ */ U(Ie, {
1662
+ field: e.field,
1663
+ fieldName: e.key,
1664
+ label: e.label,
1665
+ value: O[e.key],
1666
+ record: O,
1667
+ refs: h,
1668
+ readOnly: e.readOnly,
1669
+ onCommit: (t) => L(e.key, t)
1670
+ })
1671
+ }, e.key))]
1672
+ }),
1673
+ /* @__PURE__ */ W("div", {
1674
+ style: {
1675
+ display: "flex",
1676
+ padding: "10px 14px",
1677
+ borderTop: "1px solid var(--divider)",
1678
+ gap: 6,
1679
+ alignItems: "center"
1680
+ },
1681
+ children: [
1682
+ A && /* @__PURE__ */ W("span", {
1683
+ style: {
1684
+ fontSize: 11,
1685
+ color: "var(--warn)",
1686
+ display: "flex",
1687
+ alignItems: "center",
1688
+ gap: 4
1689
+ },
1690
+ children: [/* @__PURE__ */ U("span", { style: {
1691
+ width: 6,
1692
+ height: 6,
1693
+ borderRadius: 999,
1694
+ background: "var(--warn)"
1695
+ } }), E("list.peek.unsaved", "Unsaved")]
1696
+ }),
1697
+ /* @__PURE__ */ U("div", {
1698
+ style: {
1699
+ flex: 1,
1700
+ minWidth: 0,
1701
+ display: "flex",
1702
+ justifyContent: "flex-end"
1703
+ },
1704
+ children: F.length > 0 && /* @__PURE__ */ U(ee, {
1705
+ layout: F,
1706
+ row: O,
1707
+ onRun: (e, t) => I({
1708
+ code: e,
1709
+ action: t
1710
+ }),
1711
+ kind: "toolbar",
1712
+ entityActions: _,
1713
+ align: "trailing",
1714
+ ariaLabel: E("list.peek.actions", "Quick peek actions")
1715
+ })
1716
+ }),
1717
+ /* @__PURE__ */ U(l, {
1718
+ kind: "primary",
1719
+ icon: /* @__PURE__ */ U(e.edit, { size: 13 }),
1720
+ onClick: () => w(A ? O : null),
1721
+ children: E("list.peek.open_full", "Open full")
1722
+ })
1723
+ ]
1724
+ })
1725
+ ]
1726
+ })] });
1727
+ }
1728
+ function ze({ label: e, children: t }) {
1729
+ return /* @__PURE__ */ W("div", {
1730
+ style: {
1731
+ display: "grid",
1732
+ gridTemplateColumns: "120px 1fr",
1733
+ alignItems: "center",
1734
+ padding: "4px 0",
1735
+ borderBottom: "1px solid var(--divider)"
1736
+ },
1737
+ children: [/* @__PURE__ */ U("div", {
1738
+ style: {
1739
+ fontSize: 11.5,
1740
+ color: "var(--text-3)",
1741
+ fontWeight: 500
1742
+ },
1743
+ children: e
1744
+ }), /* @__PURE__ */ U("div", { children: t })]
1745
+ });
1746
+ }
1747
+ //#endregion
1748
+ //#region src/lib/format-count.ts
1749
+ var Be = [
1750
+ 1e9,
1751
+ 1e6,
1752
+ 1e3
1753
+ ];
1754
+ function Ve(e, t) {
1755
+ if (!Number.isFinite(e) || e < 0) return "~0";
1756
+ let n = Math.round(e);
1757
+ if (n < 1e3) return `~${n}`;
1758
+ let r = +(n / (Be.find((e) => n >= e) ?? 1e3) < 10);
1759
+ return `~${new Intl.NumberFormat(t, {
1760
+ notation: "compact",
1761
+ maximumFractionDigits: r
1762
+ }).format(n)}`;
1763
+ }
1764
+ function $(e, t) {
1765
+ return !Number.isFinite(e) || e < 0 ? "0" : Math.round(e).toLocaleString(t);
1766
+ }
1767
+ function He(e, t, n) {
1768
+ return t === "estimated" ? Ve(e, n) : $(e, n);
1769
+ }
1770
+ //#endregion
1771
+ export { ae as _, Re as a, we as c, ue as d, ce as f, K as g, se as h, ze as i, fe as l, J as m, Ve as n, Ne as o, le as p, $ as r, Ae as s, He as t, de as u, G as v };