dynamic-mui 2.5.0 → 2.5.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 (85) hide show
  1. package/README.md +61 -0
  2. package/dist/AIForm-CAlzDffx.js +44 -0
  3. package/dist/{AIForm-Czsvpf7g.mjs → AIForm-DhR29Z6d.mjs} +2712 -2521
  4. package/dist/{accordion-8p1FoyfL.js → accordion-B1Laqpu6.js} +1 -1
  5. package/dist/{accordion-CQ4Vldth.mjs → accordion-DRo0ZP5u.mjs} +1 -1
  6. package/dist/{addressfield-N7DifI3i.mjs → addressfield-1Ht4A4u9.mjs} +1 -1
  7. package/dist/{addressfield-T4e_d87q.js → addressfield-DEu_5gQv.js} +1 -1
  8. package/dist/ai/index.cjs +1 -1
  9. package/dist/ai/index.mjs +1 -1
  10. package/dist/{asyncautocomplete-BB_MyjIj.mjs → asyncautocomplete-BPTtLquY.mjs} +1 -1
  11. package/dist/{asyncautocomplete-CpO6EO3W.js → asyncautocomplete-DPn-jVl4.js} +1 -1
  12. package/dist/{bar-BOse0ZkP.js → bar-CEFjy1KY.js} +1 -1
  13. package/dist/{bar-CbpJ-MEV.mjs → bar-CkCZunh6.mjs} +1 -1
  14. package/dist/{cascadeselect-PzCw6JHX.mjs → cascadeselect-BKqX6e3j.mjs} +1 -1
  15. package/dist/{cascadeselect-C30RVgmc.js → cascadeselect-DCMmaKxY.js} +1 -1
  16. package/dist/collection-B6mXg1EE.js +1 -0
  17. package/dist/collection-D6iGJnXe.mjs +1157 -0
  18. package/dist/{colorpicker-CMhVJNQT.mjs → colorpicker-DRC4NHgd.mjs} +1 -1
  19. package/dist/{colorpicker-DoNrfUY7.js → colorpicker-VOk6ZC89.js} +1 -1
  20. package/dist/components/controls/Collection/CollectionList.d.ts +22 -0
  21. package/dist/components/controls/Collection/ItemDialog.d.ts +20 -0
  22. package/dist/components/controls/Collection/collection.d.ts +9 -0
  23. package/dist/components/controls/Collection/parts.d.ts +39 -0
  24. package/dist/components/controls/Collection/tree.d.ts +18 -0
  25. package/dist/components/controls/Collection/ui.d.ts +49 -0
  26. package/dist/components/controls/index.d.ts +1 -0
  27. package/dist/{consentfield-Bp1dXs7L.js → consentfield-Bogbxanw.js} +1 -1
  28. package/dist/{consentfield-DIa3sXrr.mjs → consentfield-DHIVXzhj.mjs} +1 -1
  29. package/dist/{datatable-CO0Iv6R6.mjs → datatable-DU0W9LHs.mjs} +1 -1
  30. package/dist/{datatable-CyfyY3Wh.js → datatable-DUdM8xtY.js} +1 -1
  31. package/dist/dynamic-mui.cjs +1 -1
  32. package/dist/dynamic-mui.mjs +2 -2
  33. package/dist/{editabletable-C_MA7QEb.mjs → editabletable-D801lgHY.mjs} +1 -1
  34. package/dist/{editabletable-CCDJ2BPB.js → editabletable-De_BiNVx.js} +1 -1
  35. package/dist/{fileupload-DX3dxKFN.mjs → fileupload-CozsBlXX.mjs} +1 -1
  36. package/dist/{fileupload-WV5shCIK.js → fileupload-YGYUpPXo.js} +1 -1
  37. package/dist/{formrepeater-D5K8qgAA.mjs → formrepeater-LXzfFY3V.mjs} +1 -1
  38. package/dist/{formrepeater-Cxu8Dk8P.js → formrepeater-iD9e1ow4.js} +1 -1
  39. package/dist/{formwizard-B-HCfrnp.mjs → formwizard-Bb0LOmIN.mjs} +1 -1
  40. package/dist/{formwizard-HRF3hTyF.js → formwizard-CuDayHm6.js} +1 -1
  41. package/dist/{geofield-DlqMZ_hl.mjs → geofield-B22-bJ0f.mjs} +1 -1
  42. package/dist/{geofield-0k7PkHRa.js → geofield-DkB-js8Y.js} +1 -1
  43. package/dist/{group-BFDXdAfg.mjs → group-B5vjjzsk.mjs} +1 -1
  44. package/dist/{group-mONe185y.js → group-B_WI43pI.js} +1 -1
  45. package/dist/{intlphone-zZ0xd-DG.js → intlphone-CkHQ2YvK.js} +1 -1
  46. package/dist/{intlphone-Bbk2UF9T.mjs → intlphone-DnqGCNdx.mjs} +1 -1
  47. package/dist/{keyvaluefield-B6oRZzic.js → keyvaluefield-CX97ykNT.js} +1 -1
  48. package/dist/{keyvaluefield-BynOkgTq.mjs → keyvaluefield-Dm5dRen5.mjs} +1 -1
  49. package/dist/{line-ChQNdVfl.js → line-CjQk91Nq.js} +1 -1
  50. package/dist/{line-DebtzkF3.mjs → line-pFBz6CTL.mjs} +1 -1
  51. package/dist/{lineitemlist-CjFNpqI5.mjs → lineitemlist-B5JJqhjg.mjs} +1 -1
  52. package/dist/{lineitemlist-CI0LwIUz.js → lineitemlist-C39r0qRM.js} +1 -1
  53. package/dist/{list-B5wBsflP.mjs → list-73Pemuh_.mjs} +1 -1
  54. package/dist/{list-CJFKxKyN.js → list-CkVSoMPM.js} +1 -1
  55. package/dist/{locationfield-CrOMF7jt.js → locationfield-DLFggIVT.js} +1 -1
  56. package/dist/{locationfield-DQj3yDCa.mjs → locationfield-DY8wZ-Vv.mjs} +1 -1
  57. package/dist/{markdowneditor-Jaz7uTyZ.js → markdowneditor-BtF43ekZ.js} +1 -1
  58. package/dist/{markdowneditor-emqJhQV7.mjs → markdowneditor-VfwnN9cX.mjs} +1 -1
  59. package/dist/{matrixfield-j5mf9lh5.mjs → matrixfield-BIKQg7FM.mjs} +1 -1
  60. package/dist/{matrixfield-BPJsawGk.js → matrixfield-BjdsHrtX.js} +1 -1
  61. package/dist/{multitextbox-DQbcEqkM.js → multitextbox-BNZ6kVPG.js} +1 -1
  62. package/dist/{multitextbox-CyZiTd_E.mjs → multitextbox-DqLIw1i-.mjs} +1 -1
  63. package/dist/{npsscale-oUUyPdxP.js → npsscale-B2JYIHr8.js} +1 -1
  64. package/dist/{npsscale-BIkJMD4Z.mjs → npsscale-CWFVm0wp.mjs} +1 -1
  65. package/dist/{numberstepper-DRIvgtcH.js → numberstepper-Cpb7ceR4.js} +1 -1
  66. package/dist/{numberstepper-thjufBMI.mjs → numberstepper-DLwZsyV1.mjs} +1 -1
  67. package/dist/{pie-4SHUYmRs.mjs → pie-AC1_bQ6M.mjs} +1 -1
  68. package/dist/{pie-COA-uozf.js → pie-BZhroZyG.js} +1 -1
  69. package/dist/{richtexteditor-CvZ3Y7X1.mjs → richtexteditor-Bwn62mA-.mjs} +1 -1
  70. package/dist/{richtexteditor-BSV7hG6d.js → richtexteditor-DDIzZxki.js} +1 -1
  71. package/dist/schema.d.ts +10 -2
  72. package/dist/{signature-6QvVbfkT.js → signature-DtXYAy1a.js} +1 -1
  73. package/dist/{signature-DeDxnc8U.mjs → signature-z2PB3zv7.mjs} +1 -1
  74. package/dist/{stepper-Sx3SWXTM.mjs → stepper-B8Blpvp8.mjs} +1 -1
  75. package/dist/{stepper-CDsErlLH.js → stepper-o3Ef6Czl.js} +1 -1
  76. package/dist/{summaryfield-DxzQ3g6Z.js → summaryfield-2t_sXF8P.js} +1 -1
  77. package/dist/{summaryfield-CAJjGmE2.mjs → summaryfield-CTQL3W7R.mjs} +1 -1
  78. package/dist/{tabs-CnDP2ngC.js → tabs-DlIOUQ5z.js} +1 -1
  79. package/dist/{tabs-CvHNZU5o.mjs → tabs-lqveygGh.mjs} +1 -1
  80. package/dist/{tagsinput-bWU3Mem0.mjs → tagsinput-C2awcyJT.mjs} +1 -1
  81. package/dist/{tagsinput-DZcLPuX1.js → tagsinput-g_-HLhtt.js} +1 -1
  82. package/dist/types.d.ts +188 -0
  83. package/dist/util/collection.d.ts +83 -0
  84. package/package.json +1 -1
  85. package/dist/AIForm-LoeI18mO.js +0 -43
@@ -0,0 +1,1157 @@
1
+ import { jsxs as h, jsx as n, Fragment as St } from "react/jsx-runtime";
2
+ import { useRef as Je, useState as Y, Fragment as Re } from "react";
3
+ import { R as Ae, S as Ct, T as kt, U as wt, W as At, X as Ye, Y as Tt, Z as It, _ as zt, $ as Ze, a0 as Mt, a1 as _t, a2 as $t, a3 as qt, a4 as jt, a5 as Wt, a6 as Et, a7 as Dt, a8 as Qe, a9 as Rt, aa as Ot, ab as Bt, ac as Lt, ad as Pt, ae as Ft, af as $e, ag as Vt, ah as et, F as Gt, ai as Ht, aj as oe, ak as Nt, al as Ut, am as Te, an as tt, j as Oe, ao as Kt } from "./AIForm-DhR29Z6d.mjs";
4
+ import { ButtonBase as nt, Icon as j, Button as Z, Typography as R, Box as f, Tooltip as U, useMediaQuery as rt, Dialog as at, IconButton as X, DialogContent as ot, DialogActions as it, Menu as Xt, MenuItem as pe, ListItemIcon as xe, ListItemText as me, Table as Jt, TableHead as Yt, TableRow as he, TableCell as K, TableBody as Zt, Collapse as lt } from "@mui/material";
5
+ import { alpha as p, useTheme as J } from "@mui/material/styles";
6
+ let Qt = 0;
7
+ const ie = () => `dmui-col-${++Qt}`, st = (e) => (e.collections || []).map((t) => t.id), en = (e) => Object.fromEntries(st(e).map((t) => [t, []])), Ie = (e, t) => Ae(e).map((r) => {
8
+ const a = new Set(st(t)), i = Object.fromEntries(Object.entries(r).filter(([c]) => !a.has(c))), l = Object.fromEntries(
9
+ (t.collections || []).map((c) => [c.id, Ie(r[c.id], c)])
10
+ );
11
+ return { key: ie(), data: i, children: l };
12
+ }), ze = (e, t) => e.map((r) => {
13
+ const a = { ...r.data };
14
+ return (t.collections || []).forEach((i) => {
15
+ a[i.id] = ze(r.children[i.id] || [], i);
16
+ }), a;
17
+ }), ct = (e) => ({
18
+ key: ie(),
19
+ data: Ct(e.data),
20
+ children: Object.fromEntries(Object.entries(e.children).map(([t, r]) => [t, r.map(ct)]))
21
+ });
22
+ var fe, Be;
23
+ function dt() {
24
+ if (Be) return fe;
25
+ Be = 1;
26
+ var e = kt(), t = wt();
27
+ function r(a, i, l) {
28
+ (l !== void 0 && !t(a[i], l) || l === void 0 && !(i in a)) && e(a, i, l);
29
+ }
30
+ return fe = r, fe;
31
+ }
32
+ var ge, Le;
33
+ function tn() {
34
+ if (Le) return ge;
35
+ Le = 1;
36
+ var e = At(), t = Ye();
37
+ function r(a) {
38
+ return t(a) && e(a);
39
+ }
40
+ return ge = r, ge;
41
+ }
42
+ var be, Pe;
43
+ function nn() {
44
+ if (Pe) return be;
45
+ Pe = 1;
46
+ var e = Tt(), t = It(), r = Ye(), a = "[object Object]", i = Function.prototype, l = Object.prototype, c = i.toString, x = l.hasOwnProperty, g = c.call(Object);
47
+ function d(y) {
48
+ if (!r(y) || e(y) != a)
49
+ return !1;
50
+ var b = t(y);
51
+ if (b === null)
52
+ return !0;
53
+ var o = x.call(b, "constructor") && b.constructor;
54
+ return typeof o == "function" && o instanceof o && c.call(o) == g;
55
+ }
56
+ return be = d, be;
57
+ }
58
+ var ue, Fe;
59
+ function pt() {
60
+ if (Fe) return ue;
61
+ Fe = 1;
62
+ function e(t, r) {
63
+ if (!(r === "constructor" && typeof t[r] == "function") && r != "__proto__")
64
+ return t[r];
65
+ }
66
+ return ue = e, ue;
67
+ }
68
+ var ye, Ve;
69
+ function rn() {
70
+ if (Ve) return ye;
71
+ Ve = 1;
72
+ var e = zt(), t = Ze();
73
+ function r(a) {
74
+ return e(a, t(a));
75
+ }
76
+ return ye = r, ye;
77
+ }
78
+ var ve, Ge;
79
+ function an() {
80
+ if (Ge) return ve;
81
+ Ge = 1;
82
+ var e = dt(), t = Mt(), r = _t(), a = $t(), i = qt(), l = jt(), c = Wt(), x = tn(), g = Et(), d = Dt(), y = Qe(), b = nn(), o = Rt(), v = pt(), S = rn();
83
+ function I(A, k, M, W, P, q, _) {
84
+ var w = v(A, M), C = v(k, M), V = _.get(C);
85
+ if (V) {
86
+ e(A, M, V);
87
+ return;
88
+ }
89
+ var $ = q ? q(w, C, M + "", A, k, _) : void 0, E = $ === void 0;
90
+ if (E) {
91
+ var D = c(C), O = !D && g(C), N = !D && !O && o(C);
92
+ $ = C, D || O || N ? c(w) ? $ = w : x(w) ? $ = a(w) : O ? (E = !1, $ = t(C, !0)) : N ? (E = !1, $ = r(C, !0)) : $ = [] : b(C) || l(C) ? ($ = w, l(w) ? $ = S(w) : (!y(w) || d(w)) && ($ = i(C))) : E = !1;
93
+ }
94
+ E && (_.set(C, $), P($, C, W, q, _), _.delete(C)), e(A, M, $);
95
+ }
96
+ return ve = I, ve;
97
+ }
98
+ var Se, He;
99
+ function on() {
100
+ if (He) return Se;
101
+ He = 1;
102
+ var e = Ot(), t = dt(), r = Bt(), a = an(), i = Qe(), l = Ze(), c = pt();
103
+ function x(g, d, y, b, o) {
104
+ g !== d && r(d, function(v, S) {
105
+ if (o || (o = new e()), i(v))
106
+ a(g, d, S, y, x, b, o);
107
+ else {
108
+ var I = b ? b(c(g, S), v, S + "", g, d, o) : void 0;
109
+ I === void 0 && (I = v), t(g, S, I);
110
+ }
111
+ }, l);
112
+ }
113
+ return Se = x, Se;
114
+ }
115
+ var Ce, Ne;
116
+ function ln() {
117
+ if (Ne) return Ce;
118
+ Ne = 1;
119
+ var e = Lt(), t = Pt();
120
+ function r(a) {
121
+ return e(function(i, l) {
122
+ var c = -1, x = l.length, g = x > 1 ? l[x - 1] : void 0, d = x > 2 ? l[2] : void 0;
123
+ for (g = a.length > 3 && typeof g == "function" ? (x--, g) : void 0, d && t(l[0], l[1], d) && (g = x < 3 ? void 0 : g, x = 1), i = Object(i); ++c < x; ) {
124
+ var y = l[c];
125
+ y && a(i, y, c, g);
126
+ }
127
+ return i;
128
+ });
129
+ }
130
+ return Ce = r, Ce;
131
+ }
132
+ var ke, Ue;
133
+ function sn() {
134
+ if (Ue) return ke;
135
+ Ue = 1;
136
+ var e = on(), t = ln(), r = t(function(a, i, l) {
137
+ e(a, i, l);
138
+ });
139
+ return ke = r, ke;
140
+ }
141
+ var cn = sn();
142
+ const dn = /* @__PURE__ */ Ft(cn), xt = (e, t) => {
143
+ const r = e.palette[t || "primary"];
144
+ if (r && typeof r == "object" && r.main) return r;
145
+ try {
146
+ return e.palette.augmentColor({ color: { main: String(t) } });
147
+ } catch {
148
+ return e.palette.primary;
149
+ }
150
+ }, mt = (e, t) => e.palette.mode === "dark" ? t.light : t.dark, pn = {
151
+ add: "Add {label}",
152
+ addMore: "Add another {labelLower}",
153
+ emptyTitle: "No {pluralLower} yet",
154
+ emptyText: void 0,
155
+ edit: "Edit",
156
+ duplicate: "Duplicate",
157
+ moveUp: "Move up",
158
+ moveDown: "Move down",
159
+ delete: "Delete",
160
+ more: "More actions",
161
+ collapse: "Collapse",
162
+ expand: "Expand",
163
+ editAria: "Edit {title}",
164
+ deleteAria: "Delete {title}",
165
+ viewAria: "View {title}",
166
+ moreAria: "More actions for {title}",
167
+ collapseAria: "Collapse {title}",
168
+ expandAria: "Expand {title}",
169
+ maxReached: "Maximum of {max} reached",
170
+ dialogAddTitle: "Add {label}",
171
+ dialogEditTitle: "Edit {label}",
172
+ dialogViewTitle: "{label}",
173
+ dialogContext: "For {parent}",
174
+ save: "Add {label}",
175
+ saveChanges: "Save changes",
176
+ saveAndAddAnother: "Save & add another",
177
+ cancel: "Cancel",
178
+ close: "Close",
179
+ closeAria: "Close dialog",
180
+ shortcut: "⌘/Ctrl + Enter",
181
+ deleteTitle: "Delete {labelLower}?",
182
+ deleteMessage: "{title} will be removed{detail}. This can’t be undone.",
183
+ deleteDetail: ", along with {detail}",
184
+ deleteConfirm: "Delete"
185
+ }, xn = (e, t) => e.replace(/\{(\w+)\}/g, (r, a) => t[a] != null ? String(t[a]) : r), mn = (e, t) => {
186
+ if (e == null) return `repeat(auto-fill, minmax(min(${t}px, 100%), 1fr))`;
187
+ const r = (a) => `repeat(${Math.max(1, a)}, minmax(0, 1fr))`;
188
+ return typeof e == "number" ? r(e) : Object.fromEntries(Object.entries(e).map(([a, i]) => [a, r(Number(i))]));
189
+ }, Ke = (e) => e == null ? [] : Array.isArray(e) ? e : [e], hn = (e, t, r, a = {}) => {
190
+ const i = r > 0, l = xt(e, t.color), c = $e(t), x = Vt(t), g = { ...pn, ...a, ...t.texts || {} }, d = t.styles || {}, y = {
191
+ label: c,
192
+ labelLower: c.toLowerCase(),
193
+ plural: x,
194
+ pluralLower: x.toLowerCase(),
195
+ max: t.max
196
+ };
197
+ return {
198
+ config: t,
199
+ depth: r,
200
+ nested: i,
201
+ accent: l,
202
+ ink: mt(e, l),
203
+ icon: t.icon || (i ? "label" : "folder_open"),
204
+ itemLabel: c,
205
+ plural: x,
206
+ texts: g,
207
+ layout: t.layout || (i ? "table" : "cards"),
208
+ variant: t.variant || "outlined",
209
+ addButton: {
210
+ position: "header",
211
+ variant: i ? "outlined" : "contained",
212
+ icon: "add",
213
+ ...t.addButton || {}
214
+ },
215
+ // Simple by default: edit + delete. Duplicate / move / collapse are opt-in.
216
+ actions: { edit: !0, delete: !0, duplicate: !1, move: !1, collapse: !1, ...t.actions || {} },
217
+ t: (b, o = {}) => xn(String(g[b] ?? ""), { ...y, ...o }),
218
+ sx: (b, o) => [...Ke(o), ...Ke(d[b])],
219
+ merged: (b, o = {}) => dn({}, o, d[b] || {})
220
+ };
221
+ }, ee = "cubic-bezier(0.4, 0, 0.2, 1)";
222
+ function fn({ ui: e, n: t }) {
223
+ const r = J();
224
+ return /* @__PURE__ */ n(
225
+ f,
226
+ {
227
+ component: "span",
228
+ sx: e.sx("headerCount", {
229
+ minWidth: 22,
230
+ height: 20,
231
+ px: 0.75,
232
+ borderRadius: "999px",
233
+ display: "inline-grid",
234
+ placeItems: "center",
235
+ fontSize: 11.5,
236
+ fontWeight: 700,
237
+ bgcolor: t > 0 ? p(e.accent.main, 0.12) : p(r.palette.text.primary, 0.07),
238
+ color: t > 0 ? e.ink : "text.secondary",
239
+ border: `1px solid ${t > 0 ? p(e.accent.main, 0.2) : "transparent"}`
240
+ }),
241
+ children: t
242
+ }
243
+ );
244
+ }
245
+ const gn = (e) => e.split(/\s+/).map((t) => t.match(/[A-Za-z0-9]/)?.[0] || "").filter(Boolean).slice(0, 2).join("").toUpperCase() || "#";
246
+ function bn({ ui: e, mode: t, title: r, index: a }) {
247
+ return t === "none" ? null : /* @__PURE__ */ n(f, { sx: e.sx("avatar", {
248
+ width: 40,
249
+ height: 40,
250
+ flexShrink: 0,
251
+ borderRadius: "10px",
252
+ display: "grid",
253
+ placeItems: "center",
254
+ fontWeight: 600,
255
+ fontSize: 14,
256
+ bgcolor: p(e.accent.main, 0.1),
257
+ color: e.ink,
258
+ "& .MuiIcon-root": { fontSize: 20 }
259
+ }), children: t === "initials" ? gn(r) : t === "index" ? a + 1 : /* @__PURE__ */ n(j, { children: e.icon }) });
260
+ }
261
+ function un({ ui: e, text: t, color: r }) {
262
+ const a = J(), i = r === "default" ? null : xt(a, r);
263
+ return /* @__PURE__ */ n(
264
+ f,
265
+ {
266
+ component: "span",
267
+ sx: e.sx("badge", {
268
+ display: "inline-flex",
269
+ alignItems: "center",
270
+ gap: 0.5,
271
+ px: 1.25,
272
+ py: 0.3,
273
+ borderRadius: "999px",
274
+ fontSize: 11.5,
275
+ fontWeight: 700,
276
+ lineHeight: 1.6,
277
+ whiteSpace: "nowrap",
278
+ letterSpacing: "0.02em",
279
+ bgcolor: i ? p(i.main, 0.1) : p(a.palette.text.primary, 0.06),
280
+ color: i ? mt(a, i) : "text.secondary",
281
+ border: `1px solid ${i ? p(i.main, 0.25) : p(a.palette.text.primary, 0.12)}`,
282
+ "&::before": {
283
+ content: '""',
284
+ width: 6,
285
+ height: 6,
286
+ borderRadius: "50%",
287
+ bgcolor: i ? i.main : "text.disabled",
288
+ flexShrink: 0
289
+ }
290
+ }),
291
+ children: t
292
+ }
293
+ );
294
+ }
295
+ function Xe({ ui: e, placement: t, empty: r, disabled: a, onClick: i }) {
296
+ const { variant: l, icon: c, size: x, fullWidth: g } = e.addButton, d = t === "footer" && !r ? e.t("addMore") : e.t("add"), y = e.config.max != null && a, b = !!g || l === "dashed" && g !== !1, o = (S) => /* @__PURE__ */ n(U, { title: y ? e.t("maxReached") : "", children: /* @__PURE__ */ n(f, { component: "span", sx: { display: b ? "block" : "inline-flex", flexShrink: 0 }, children: S }) });
297
+ if (l === "dashed")
298
+ return o(
299
+ /* @__PURE__ */ h(
300
+ nt,
301
+ {
302
+ onClick: i,
303
+ disabled: a,
304
+ sx: e.sx("addButton", {
305
+ width: b ? "100%" : "auto",
306
+ display: "flex",
307
+ alignItems: "center",
308
+ justifyContent: "center",
309
+ gap: 0.75,
310
+ py: 1.1,
311
+ px: 2,
312
+ borderRadius: "8px",
313
+ border: `1px dashed ${p(e.accent.main, 0.5)}`,
314
+ color: e.ink,
315
+ fontFamily: "inherit",
316
+ fontSize: 14,
317
+ fontWeight: 600,
318
+ transition: `background-color .15s ${ee}`,
319
+ "&:hover": { bgcolor: p(e.accent.main, 0.06) },
320
+ "&.Mui-focusVisible": { outline: `2px solid ${p(e.accent.main, 0.5)}`, outlineOffset: 2 },
321
+ "&.Mui-disabled": { opacity: 0.5 },
322
+ "& .MuiIcon-root": { fontSize: 19 }
323
+ }),
324
+ children: [
325
+ /* @__PURE__ */ n(j, { children: c }),
326
+ d
327
+ ]
328
+ }
329
+ )
330
+ );
331
+ const v = {
332
+ contained: { bgcolor: e.accent.main, color: e.accent.contrastText, "&:hover": { bgcolor: e.accent.dark } },
333
+ outlined: { color: e.ink, borderColor: p(e.accent.main, 0.5), "&:hover": { borderColor: e.accent.main, bgcolor: p(e.accent.main, 0.05) } },
334
+ text: { color: e.ink, "&:hover": { bgcolor: p(e.accent.main, 0.07) } },
335
+ soft: { color: e.ink, bgcolor: p(e.accent.main, 0.1), "&:hover": { bgcolor: p(e.accent.main, 0.16) } }
336
+ }[l] || {};
337
+ return o(
338
+ /* @__PURE__ */ n(
339
+ Z,
340
+ {
341
+ onClick: i,
342
+ disabled: a,
343
+ variant: l === "soft" ? "text" : l,
344
+ color: "inherit",
345
+ size: x || (e.nested ? "small" : "medium"),
346
+ fullWidth: g,
347
+ disableElevation: !0,
348
+ startIcon: /* @__PURE__ */ n(j, { children: c }),
349
+ sx: e.sx("addButton", {
350
+ textTransform: "none",
351
+ fontWeight: 600,
352
+ borderRadius: "8px",
353
+ px: e.nested ? 1.5 : 2,
354
+ whiteSpace: "nowrap",
355
+ ...v
356
+ }),
357
+ children: d
358
+ }
359
+ )
360
+ );
361
+ }
362
+ const yn = (e) => /^[aeiou]/i.test(e) ? "an" : "a", vn = (e) => e.length <= 1 ? e.join("") : `${e.slice(0, -1).join(", ")} and ${e[e.length - 1]}`, Sn = (e) => {
363
+ if (e.nested) return "";
364
+ const t = e.itemLabel.toLowerCase(), r = (e.config.collections || []).map((a) => et($e(a)).toLowerCase());
365
+ return r.length ? `Add ${yn(t)} ${t}, then add its ${vn(r)}.` : `Add your first ${t} to get started.`;
366
+ };
367
+ function Cn({ ui: e, readOnly: t, error: r }) {
368
+ const a = J(), i = e.texts.emptyText != null ? e.t("emptyText") : Sn(e);
369
+ return e.nested ? /* @__PURE__ */ n(R, { sx: e.sx("empty", {
370
+ fontSize: 13,
371
+ color: "text.disabled",
372
+ fontStyle: "italic",
373
+ py: 0.75,
374
+ px: 0,
375
+ display: "block"
376
+ }), children: e.t("emptyTitle") }) : /* @__PURE__ */ h(
377
+ f,
378
+ {
379
+ sx: e.sx("empty", {
380
+ py: 5,
381
+ px: 3,
382
+ textAlign: "center",
383
+ borderRadius: "10px",
384
+ border: `1.5px dashed ${r ? a.palette.error.main : p(a.palette.text.primary, 0.15)}`,
385
+ bgcolor: r ? p(a.palette.error.main, 0.03) : p(a.palette.text.primary, 0.02)
386
+ }),
387
+ children: [
388
+ /* @__PURE__ */ n(f, { sx: {
389
+ width: 48,
390
+ height: 48,
391
+ borderRadius: "50%",
392
+ bgcolor: p(e.accent.main, 0.1),
393
+ display: "flex",
394
+ alignItems: "center",
395
+ justifyContent: "center",
396
+ mx: "auto",
397
+ mb: 1.5
398
+ }, children: /* @__PURE__ */ n(j, { sx: { color: e.ink, fontSize: "22px !important" }, children: e.icon || "inbox" }) }),
399
+ /* @__PURE__ */ n(R, { sx: e.sx("emptyTitle", { fontSize: 15, fontWeight: 600, color: "text.primary" }), children: e.t("emptyTitle") }),
400
+ i && !t && /* @__PURE__ */ n(R, { sx: e.sx("emptyText", { fontSize: 13.5, color: "text.secondary", mt: 0.5, maxWidth: 380, mx: "auto" }), children: i })
401
+ ]
402
+ }
403
+ );
404
+ }
405
+ function kn({ ui: e, open: t, mode: r, guid: a, session: i, initial: l, context: c, onClose: x, onSave: g }) {
406
+ const d = J(), y = e.config.dialog || {}, b = rt(d.breakpoints.down("sm")), o = y.fullScreen === !0 || y.fullScreen !== !1 && b, v = Je(null), [S, I] = Y(0), { accent: A } = e, k = e.t(r === "add" ? "dialogAddTitle" : r === "edit" ? "dialogEditTitle" : "dialogViewTitle"), M = `${a}-dialog-${i}-${S}`, W = e.t("dialogContext"), [P, q] = W.includes("{parent}") ? W.split("{parent}") : [W, null], _ = (w) => {
407
+ const C = v.current;
408
+ !C || !C.validate() || (g({ ...C.getValues() }, w), w && I((V) => V + 1));
409
+ };
410
+ return /* @__PURE__ */ h(
411
+ at,
412
+ {
413
+ open: t,
414
+ onClose: (w, C) => {
415
+ C !== "backdropClick" && x();
416
+ },
417
+ fullScreen: o,
418
+ fullWidth: !0,
419
+ maxWidth: y.maxWidth || "sm",
420
+ "aria-labelledby": `${a}-dialog-title`,
421
+ onKeyDown: (w) => {
422
+ r !== "view" && w.key === "Enter" && (w.metaKey || w.ctrlKey) && (w.preventDefault(), _(!1));
423
+ },
424
+ sx: {
425
+ "& .MuiDialog-paper": e.merged("dialog", {
426
+ borderRadius: o ? 0 : "12px",
427
+ backgroundImage: "none"
428
+ })
429
+ },
430
+ children: [
431
+ /* @__PURE__ */ h(f, { sx: e.sx("dialogHeader", {
432
+ display: "flex",
433
+ alignItems: "flex-start",
434
+ gap: 1,
435
+ px: { xs: 2, sm: 3 },
436
+ pt: 2.5,
437
+ pb: 2,
438
+ borderBottom: `1px solid ${d.palette.divider}`
439
+ }), children: [
440
+ /* @__PURE__ */ h(f, { sx: { flex: 1, minWidth: 0 }, children: [
441
+ /* @__PURE__ */ n(R, { id: `${a}-dialog-title`, sx: e.sx("dialogTitle", { fontWeight: 600, fontSize: 18, lineHeight: 1.3 }), children: k }),
442
+ c && /* @__PURE__ */ h(R, { sx: e.sx("dialogContext", { fontSize: 13.5, color: "text.secondary", mt: 0.25 }), children: [
443
+ P,
444
+ q !== null && /* @__PURE__ */ n(f, { component: "strong", sx: { color: "text.primary", fontWeight: 600 }, children: c }),
445
+ q
446
+ ] }),
447
+ y.description && /* @__PURE__ */ n(R, { sx: e.sx("dialogDescription", { fontSize: 13.5, color: "text.secondary", mt: 0.25 }), children: y.description })
448
+ ] }),
449
+ /* @__PURE__ */ n(X, { "aria-label": e.t("closeAria"), onClick: x, size: "small", sx: { mt: -0.5, mr: -1, color: "text.secondary" }, children: /* @__PURE__ */ n(j, { children: "close" }) })
450
+ ] }),
451
+ /* @__PURE__ */ n(ot, { sx: e.sx("dialogContent", { px: { xs: 2, sm: 3 }, pt: "20px !important", pb: 3 }), children: /* @__PURE__ */ n(
452
+ Gt,
453
+ {
454
+ guid: M,
455
+ data: e.config.fields || [],
456
+ patch: r === "add" ? {} : l || {},
457
+ apiRef: v,
458
+ readOnly: r === "view",
459
+ MuiGridAttributes: { spacing: y.spacing ?? 2 }
460
+ },
461
+ M
462
+ ) }),
463
+ /* @__PURE__ */ n(it, { sx: e.sx("dialogActions", {
464
+ px: { xs: 2, sm: 3 },
465
+ py: 1.5,
466
+ gap: 1,
467
+ flexWrap: "wrap",
468
+ borderTop: `1px solid ${d.palette.divider}`,
469
+ "& .MuiButton-root": { textTransform: "none", fontWeight: 600, borderRadius: "8px", px: 2, whiteSpace: "nowrap", ml: "0 !important" }
470
+ }), children: r === "view" ? /* @__PURE__ */ n(Z, { variant: "contained", disableElevation: !0, onClick: x, sx: e.sx("dialogSave", { bgcolor: A.main, color: A.contrastText, "&:hover": { bgcolor: A.dark } }), children: e.t("close") }) : /* @__PURE__ */ h(St, { children: [
471
+ /* @__PURE__ */ n(Z, { onClick: x, color: "inherit", sx: e.sx("dialogCancel", { color: "text.secondary" }), children: e.t("cancel") }),
472
+ r === "add" && y.addAnother !== !1 && /* @__PURE__ */ n(
473
+ Z,
474
+ {
475
+ variant: "outlined",
476
+ color: "inherit",
477
+ onClick: () => _(!0),
478
+ sx: e.sx("dialogSaveAnother", { color: e.ink, borderColor: p(A.main, 0.5), "&:hover": { borderColor: A.main, bgcolor: p(A.main, 0.06) } }),
479
+ children: e.t("saveAndAddAnother")
480
+ }
481
+ ),
482
+ /* @__PURE__ */ n(U, { title: e.t("shortcut"), placement: "top", describeChild: !0, children: /* @__PURE__ */ n(
483
+ Z,
484
+ {
485
+ variant: "contained",
486
+ color: "inherit",
487
+ disableElevation: !0,
488
+ startIcon: /* @__PURE__ */ n(j, { children: r === "add" ? "add" : "check" }),
489
+ onClick: () => _(!1),
490
+ sx: e.sx("dialogSave", { bgcolor: A.main, color: A.contrastText, "&:hover": { bgcolor: A.dark } }),
491
+ children: r === "add" ? e.t("save") : e.t("saveChanges")
492
+ }
493
+ ) })
494
+ ] }) })
495
+ ]
496
+ }
497
+ );
498
+ }
499
+ function wn({ ui: e, count: t, required: r, action: a, alone: i = !1 }) {
500
+ const { nested: l } = e;
501
+ return /* @__PURE__ */ h(f, { sx: e.sx("header", { display: "flex", alignItems: "center", gap: 1.5, mb: i ? 0 : l ? 1.25 : 2.5, flexWrap: "wrap" }), children: [
502
+ /* @__PURE__ */ h(f, { sx: { flex: 1, minWidth: l ? 140 : { xs: "100%", sm: 220 } }, children: [
503
+ /* @__PURE__ */ h(f, { sx: { display: "flex", alignItems: "center", gap: l ? 0.75 : 1 }, children: [
504
+ e.config.icon && /* Same pill-badge for both nested and top-level — just smaller for nested */
505
+ /* @__PURE__ */ n(f, { sx: {
506
+ width: l ? 26 : 32,
507
+ height: l ? 26 : 32,
508
+ borderRadius: l ? "6px" : "8px",
509
+ bgcolor: p(e.accent.main, 0.12),
510
+ display: "flex",
511
+ alignItems: "center",
512
+ justifyContent: "center",
513
+ flexShrink: 0
514
+ }, children: /* @__PURE__ */ n(j, { sx: e.sx("headerIcon", {
515
+ color: e.ink,
516
+ fontSize: `${l ? 14 : 18}px !important`
517
+ }), children: e.icon }) }),
518
+ /* @__PURE__ */ h(R, { sx: e.sx("headerTitle", {
519
+ fontWeight: 700,
520
+ fontSize: l ? 14 : 19,
521
+ lineHeight: 1.3,
522
+ color: "text.primary"
523
+ }), children: [
524
+ e.plural,
525
+ r && /* @__PURE__ */ n(f, { component: "span", sx: { color: "error.main", ml: 0.25 }, children: "*" })
526
+ ] }),
527
+ /* @__PURE__ */ n(fn, { ui: e, n: t })
528
+ ] }),
529
+ e.config.description && /* @__PURE__ */ n(R, { sx: e.sx("headerDescription", {
530
+ fontSize: 13.5,
531
+ color: "text.secondary",
532
+ mt: 0.5,
533
+ ml: l ? 0 : e.config.icon ? "44px" : 0
534
+ }), children: e.config.description })
535
+ ] }),
536
+ a
537
+ ] });
538
+ }
539
+ function Me({ ui: e, title: t, canEdit: r, onOpen: a, size: i }) {
540
+ return /* @__PURE__ */ n(
541
+ nt,
542
+ {
543
+ onClick: a,
544
+ "aria-label": r ? void 0 : e.t("viewAria", { title: t }),
545
+ "aria-haspopup": "dialog",
546
+ sx: e.sx("itemTitle", {
547
+ borderRadius: "4px",
548
+ textAlign: "left",
549
+ justifyContent: "flex-start",
550
+ fontFamily: "inherit",
551
+ fontWeight: 600,
552
+ fontSize: i,
553
+ lineHeight: 1.4,
554
+ color: "text.primary",
555
+ wordBreak: "break-word",
556
+ "&:hover": { color: e.ink, textDecoration: "underline" },
557
+ "&.Mui-focusVisible": { outline: `2px solid ${p(e.accent.main, 0.5)}`, outlineOffset: 2 }
558
+ }),
559
+ children: t
560
+ }
561
+ );
562
+ }
563
+ function _e({ ui: e, data: t }) {
564
+ const r = e.config.display || {}, a = typeof r.badge == "string" ? { field: r.badge } : r.badge;
565
+ if (!a) return null;
566
+ const i = t[a.field], l = tt(Te(e.config.fields || [], a.field), i);
567
+ if (!l) return null;
568
+ const c = a.colors?.[String(i)] ?? a.colors?.[l] ?? "default";
569
+ return /* @__PURE__ */ n(un, { ui: e, text: l, color: c });
570
+ }
571
+ function An({ ui: e, title: t, readOnly: r, open: a, canToggle: i, onEdit: l, onDelete: c, onMenu: x, onToggle: g }) {
572
+ const d = J(), y = !r && e.actions.edit, b = !r && e.actions.delete, o = !r && (e.actions.duplicate || e.actions.move), v = (S, I) => ({
573
+ width: 30,
574
+ height: 30,
575
+ borderRadius: "8px",
576
+ color: S,
577
+ transition: `background-color .15s ${ee}, color .15s ${ee}`,
578
+ "&:hover": { bgcolor: I }
579
+ });
580
+ return /* @__PURE__ */ h(f, { sx: e.sx("actions", { display: "flex", alignItems: "center", gap: 0.25, flexShrink: 0 }), children: [
581
+ y && /* @__PURE__ */ n(U, { title: e.t("edit"), children: /* @__PURE__ */ n(
582
+ X,
583
+ {
584
+ size: "small",
585
+ "aria-label": e.t("editAria", { title: t }),
586
+ onClick: l,
587
+ sx: e.sx("actionButton", v(e.ink, p(e.accent.main, 0.1))),
588
+ children: /* @__PURE__ */ n(j, { sx: { fontSize: "17px !important" }, children: "edit" })
589
+ }
590
+ ) }),
591
+ b && /* @__PURE__ */ n(U, { title: e.t("delete"), children: /* @__PURE__ */ n(
592
+ X,
593
+ {
594
+ size: "small",
595
+ "aria-label": e.t("deleteAria", { title: t }),
596
+ onClick: c,
597
+ sx: e.sx("actionButton", v(d.palette.error.main, p(d.palette.error.main, 0.08))),
598
+ children: /* @__PURE__ */ n(j, { sx: { fontSize: "17px !important" }, children: "delete_outline" })
599
+ }
600
+ ) }),
601
+ o && /* @__PURE__ */ n(U, { title: e.t("more"), children: /* @__PURE__ */ n(
602
+ X,
603
+ {
604
+ size: "small",
605
+ "aria-label": e.t("moreAria", { title: t }),
606
+ onClick: (S) => x(S.currentTarget),
607
+ sx: e.sx("actionButton", v(d.palette.text.secondary, p(d.palette.text.primary, 0.07))),
608
+ children: /* @__PURE__ */ n(j, { sx: { fontSize: "17px !important" }, children: "more_vert" })
609
+ }
610
+ ) }),
611
+ i && /* @__PURE__ */ n(U, { title: a ? e.t("collapse") : e.t("expand"), children: /* @__PURE__ */ n(
612
+ X,
613
+ {
614
+ size: "small",
615
+ "aria-label": e.t(a ? "collapseAria" : "expandAria", { title: t }),
616
+ "aria-expanded": a,
617
+ onClick: g,
618
+ sx: e.sx("actionButton", v(d.palette.text.secondary, p(d.palette.text.primary, 0.07))),
619
+ children: /* @__PURE__ */ n(j, { sx: { fontSize: "19px !important", transition: `transform .2s ${ee}`, transform: a ? "rotate(180deg)" : "none" }, children: "expand_more" })
620
+ }
621
+ ) })
622
+ ] });
623
+ }
624
+ function ht({ ui: e, node: t, guid: r, readOnly: a, issues: i, showErrors: l, texts: c, parentTitle: x, onChildChange: g }) {
625
+ const d = J(), y = e.config.collections || [];
626
+ return /* @__PURE__ */ n(f, { sx: e.sx("sections", { display: "grid", gridTemplateColumns: mn(e.config.sectionColumns ?? 1, 320) }), children: y.map((b, o) => /* @__PURE__ */ n(
627
+ f,
628
+ {
629
+ sx: e.sx("section", {
630
+ borderTop: `1px solid ${d.palette.divider}`,
631
+ bgcolor: d.palette.mode === "dark" ? p(d.palette.common.white, 0.02) : p(d.palette.grey[500], 0.03),
632
+ minWidth: 0,
633
+ // If there are multiple columns, add left border to separate them
634
+ ...o > 0 ? { borderLeft: `1px solid ${d.palette.divider}` } : {}
635
+ }),
636
+ children: /* @__PURE__ */ n(f, { sx: { px: { xs: 2, sm: 2.5 }, pt: { xs: 1.5, sm: 1.75 }, pb: { xs: 1.25, sm: 1.5 } }, children: /* @__PURE__ */ n(
637
+ ft,
638
+ {
639
+ config: b,
640
+ nodes: t.children[b.id] || [],
641
+ onChange: (v) => g(b.id, v),
642
+ guid: `${r}-${t.key}`,
643
+ depth: e.depth + 1,
644
+ readOnly: a,
645
+ issues: i.filter((v) => v.path[0] === b.id).map((v) => ({ ...v, path: v.path.slice(1) })),
646
+ showErrors: l,
647
+ parentTitle: x,
648
+ texts: c
649
+ }
650
+ ) })
651
+ },
652
+ b.id
653
+ )) });
654
+ }
655
+ function Tn({ ui: e, node: t, index: r, guid: a, readOnly: i, collapsed: l, issues: c, showErrors: x, texts: g, onOpen: d, onDelete: y, onMenu: b, onToggle: o, onChildChange: v }) {
656
+ const S = J(), { config: I } = e, A = I.display || {}, { title: k, subtitle: M, details: W } = oe(t.data, I, r), P = I.collections || [], q = P.length > 0, _ = x && c.length > 0, w = A.avatar || "none", C = !i && e.actions.edit, V = !i && e.actions.delete, $ = !i && (e.actions.duplicate || e.actions.move), E = W.length > 0 || q, D = !l, O = _ ? p(S.palette.error.main, 0.05) : p(e.accent.main, 0.05), N = _ ? p(S.palette.error.main, 0.2) : p(e.accent.main, 0.15), G = (m, u) => ({
657
+ width: 30,
658
+ height: 30,
659
+ borderRadius: "8px",
660
+ color: m,
661
+ transition: `background-color .15s ${ee}`,
662
+ "&:hover": { bgcolor: u }
663
+ });
664
+ return /* @__PURE__ */ h(f, { sx: e.sx("item", {
665
+ border: `1px solid ${_ ? S.palette.error.main : S.palette.divider}`,
666
+ borderRadius: "14px",
667
+ overflow: "hidden",
668
+ bgcolor: "background.paper",
669
+ boxShadow: `0 1px 3px ${p(S.palette.common.black, 0.06)}, 0 4px 12px ${p(S.palette.common.black, 0.04)}`
670
+ }), children: [
671
+ /* @__PURE__ */ h(f, { sx: e.sx("itemHeader", {
672
+ px: { xs: 2, sm: 2.5 },
673
+ pt: { xs: 1.75, sm: 2 },
674
+ pb: { xs: 1.5, sm: 1.75 },
675
+ bgcolor: O,
676
+ borderBottom: D && E ? `1px solid ${N}` : "1px solid transparent",
677
+ transition: `border-color .2s ${ee}`,
678
+ display: "flex",
679
+ alignItems: "flex-start",
680
+ gap: 1.5
681
+ }), children: [
682
+ w !== "none" && /* @__PURE__ */ n(bn, { ui: e, mode: w, title: k, index: r }),
683
+ /* @__PURE__ */ h(f, { sx: { flex: 1, minWidth: 0 }, children: [
684
+ /* @__PURE__ */ h(f, { sx: { display: "flex", alignItems: "center", flexWrap: "wrap", gap: 0.75, mb: M ? 0.25 : 0 }, children: [
685
+ /* @__PURE__ */ n(Me, { ui: e, title: k, canEdit: C, onOpen: d, size: 15.5 }),
686
+ /* @__PURE__ */ n(_e, { ui: e, data: t.data })
687
+ ] }),
688
+ M && /* @__PURE__ */ h(R, { sx: e.sx("subtitle", {
689
+ display: "flex",
690
+ alignItems: "center",
691
+ gap: 0.4,
692
+ fontSize: 13,
693
+ color: "text.secondary",
694
+ wordBreak: "break-word",
695
+ "& .MuiIcon-root": { fontSize: 14, color: "text.disabled" }
696
+ }), children: [
697
+ A.subtitleIcon && /* @__PURE__ */ n(j, { children: A.subtitleIcon }),
698
+ M
699
+ ] }),
700
+ !D && q && /* @__PURE__ */ n(f, { sx: { display: "flex", flexWrap: "wrap", gap: 0.75, mt: 0.6 }, children: P.map((m) => {
701
+ const u = (t.children[m.id] || []).length;
702
+ return /* @__PURE__ */ h(f, { component: "span", sx: {
703
+ fontSize: 12,
704
+ fontWeight: 600,
705
+ px: 1,
706
+ py: 0.2,
707
+ borderRadius: "999px",
708
+ bgcolor: p(e.accent.main, 0.08),
709
+ color: e.ink,
710
+ border: `1px solid ${p(e.accent.main, 0.18)}`
711
+ }, children: [
712
+ u,
713
+ " ",
714
+ et($e(m), u).toLowerCase()
715
+ ] }, m.id);
716
+ }) })
717
+ ] }),
718
+ /* @__PURE__ */ h(f, { sx: { display: "flex", alignItems: "center", flexShrink: 0, gap: 0.25, mt: -0.25 }, children: [
719
+ C && /* @__PURE__ */ n(U, { title: e.t("edit"), children: /* @__PURE__ */ n(
720
+ X,
721
+ {
722
+ size: "small",
723
+ "aria-label": e.t("editAria", { title: k }),
724
+ onClick: d,
725
+ sx: G(e.ink, p(e.accent.main, 0.1)),
726
+ children: /* @__PURE__ */ n(j, { sx: { fontSize: "17px !important" }, children: "edit" })
727
+ }
728
+ ) }),
729
+ V && /* @__PURE__ */ n(U, { title: e.t("delete"), children: /* @__PURE__ */ n(
730
+ X,
731
+ {
732
+ size: "small",
733
+ "aria-label": e.t("deleteAria", { title: k }),
734
+ onClick: y,
735
+ sx: G(S.palette.error.main, p(S.palette.error.main, 0.08)),
736
+ children: /* @__PURE__ */ n(j, { sx: { fontSize: "17px !important" }, children: "delete_outline" })
737
+ }
738
+ ) }),
739
+ $ && /* @__PURE__ */ n(U, { title: e.t("more"), children: /* @__PURE__ */ n(
740
+ X,
741
+ {
742
+ size: "small",
743
+ "aria-label": e.t("moreAria", { title: k }),
744
+ onClick: (m) => b(m.currentTarget),
745
+ sx: G(S.palette.text.secondary, p(S.palette.text.primary, 0.07)),
746
+ children: /* @__PURE__ */ n(j, { sx: { fontSize: "17px !important" }, children: "more_vert" })
747
+ }
748
+ ) }),
749
+ E && /* @__PURE__ */ n(U, { title: D ? e.t("collapse") : e.t("expand"), children: /* @__PURE__ */ n(
750
+ X,
751
+ {
752
+ size: "small",
753
+ "aria-label": e.t(D ? "collapseAria" : "expandAria", { title: k }),
754
+ onClick: o,
755
+ sx: G(S.palette.text.secondary, p(S.palette.text.primary, 0.07)),
756
+ children: /* @__PURE__ */ n(j, { sx: {
757
+ fontSize: "19px !important",
758
+ transition: `transform .25s ${ee}`,
759
+ transform: D ? "rotate(180deg)" : "none"
760
+ }, children: "expand_more" })
761
+ }
762
+ ) })
763
+ ] })
764
+ ] }),
765
+ E && /* @__PURE__ */ h(lt, { in: D, timeout: 220, children: [
766
+ W.length > 0 && /* @__PURE__ */ n(f, { sx: e.sx("details", {
767
+ display: "flex",
768
+ overflowX: "auto",
769
+ borderBottom: q ? `1px solid ${S.palette.divider}` : "none",
770
+ "&::-webkit-scrollbar": { height: 0 }
771
+ }), children: W.map((m, u) => /* @__PURE__ */ h(
772
+ f,
773
+ {
774
+ sx: e.sx("detail", {
775
+ flex: "1 1 0",
776
+ minWidth: 90,
777
+ maxWidth: 220,
778
+ px: { xs: 2, sm: 2.5 },
779
+ py: 1.5,
780
+ borderLeft: u > 0 ? `1px solid ${S.palette.divider}` : "none"
781
+ }),
782
+ children: [
783
+ /* @__PURE__ */ h(R, { sx: e.sx("detailLabel", {
784
+ fontSize: 10.5,
785
+ fontWeight: 700,
786
+ letterSpacing: "0.07em",
787
+ textTransform: "uppercase",
788
+ color: "text.disabled",
789
+ mb: 0.25,
790
+ display: "flex",
791
+ alignItems: "center",
792
+ gap: 0.4,
793
+ whiteSpace: "nowrap"
794
+ }), children: [
795
+ m.icon && /* @__PURE__ */ n(j, { sx: { fontSize: "11px !important" }, children: m.icon }),
796
+ m.label
797
+ ] }),
798
+ /* @__PURE__ */ n(R, { sx: e.sx("detailValue", {
799
+ fontSize: 13.5,
800
+ fontWeight: 600,
801
+ color: m.value ? "text.primary" : "text.disabled",
802
+ wordBreak: "break-word",
803
+ lineHeight: 1.4
804
+ }), children: m.value || "—" })
805
+ ]
806
+ },
807
+ m.id
808
+ )) }),
809
+ q && /* @__PURE__ */ n(
810
+ ht,
811
+ {
812
+ ui: e,
813
+ node: t,
814
+ guid: a,
815
+ readOnly: i,
816
+ issues: c,
817
+ showErrors: x,
818
+ texts: g,
819
+ parentTitle: k,
820
+ onChildChange: v
821
+ }
822
+ )
823
+ ] })
824
+ ] });
825
+ }
826
+ function In({ ui: e, nodes: t, guid: r, readOnly: a, issues: i, showErrors: l, texts: c, isCollapsed: x, onToggle: g, onOpen: d, onDelete: y, onMenu: b, onChildChange: o }) {
827
+ const v = J(), S = rt(v.breakpoints.down("sm")), { config: I } = e, A = I.fields || [], k = I.display || {}, M = Nt(I), W = typeof k.badge == "string" ? k.badge : k.badge?.field, P = typeof k.badge == "object" && k.badge?.label || (W ? Ut(Te(A, W)) || W : ""), q = (I.collections || []).length > 0, _ = !a && e.actions.edit, w = !a && (e.actions.edit || e.actions.delete || e.actions.duplicate || e.actions.move), C = (m) => i.filter((u) => u.path[0] === m).map((u) => ({ ...u, path: u.path.slice(1) })), V = /* @__PURE__ */ n(f, { component: "span", sx: { color: "text.disabled" }, children: "—" }), $ = (m, u, L) => q && /* @__PURE__ */ n(lt, { in: !x(m.key), timeout: 200, unmountOnExit: !0, children: /* @__PURE__ */ n(
828
+ ht,
829
+ {
830
+ ui: e,
831
+ node: m,
832
+ guid: r,
833
+ readOnly: a,
834
+ issues: C(u),
835
+ showErrors: l,
836
+ texts: c,
837
+ parentTitle: L,
838
+ onChildChange: (F, Q) => o(u, F, Q)
839
+ }
840
+ ) }), E = (m, u, L) => /* @__PURE__ */ n(
841
+ An,
842
+ {
843
+ ui: e,
844
+ title: L,
845
+ readOnly: a,
846
+ open: !x(m.key),
847
+ canToggle: q,
848
+ onEdit: () => d(u),
849
+ onDelete: () => y(u),
850
+ onMenu: (F) => b(F, u),
851
+ onToggle: () => g(m.key)
852
+ }
853
+ ), D = p(v.palette.error.main, 0.06);
854
+ if (S)
855
+ return /* @__PURE__ */ n(f, { sx: e.sx("table", { border: `1px solid ${v.palette.divider}`, borderRadius: "8px", overflow: "hidden", bgcolor: "background.paper" }), children: t.map((m, u) => {
856
+ const { title: L, details: F } = oe(m.data, I, u), Q = l && C(u).length > 0;
857
+ return /* @__PURE__ */ h(f, { sx: e.sx("mobileRow", { borderTop: u ? `1px solid ${v.palette.divider}` : "none", ...Q ? { bgcolor: D } : {} }), children: [
858
+ /* @__PURE__ */ h(f, { sx: { display: "flex", alignItems: "flex-start", gap: 1, p: 1.5 }, children: [
859
+ /* @__PURE__ */ h(f, { sx: { flex: 1, minWidth: 0 }, children: [
860
+ /* @__PURE__ */ h(f, { sx: { display: "flex", alignItems: "center", flexWrap: "wrap", gap: 1 }, children: [
861
+ /* @__PURE__ */ n(Me, { ui: e, title: L, canEdit: _, onOpen: () => d(u), size: 14.5 }),
862
+ /* @__PURE__ */ n(_e, { ui: e, data: m.data })
863
+ ] }),
864
+ F.length > 0 && /* @__PURE__ */ n(f, { sx: { display: "grid", gridTemplateColumns: "auto 1fr", columnGap: 1.5, rowGap: 0.25, mt: 0.75 }, children: F.map((H) => /* @__PURE__ */ h(Re, { children: [
865
+ /* @__PURE__ */ n(R, { sx: e.sx("detailLabel", { fontSize: 13, color: "text.secondary" }), children: H.label }),
866
+ /* @__PURE__ */ n(R, { sx: e.sx("detailValue", { fontSize: 13, fontWeight: 500, wordBreak: "break-word" }), children: H.value })
867
+ ] }, H.id)) })
868
+ ] }),
869
+ (w || q) && E(m, u, L)
870
+ ] }),
871
+ $(m, u, L)
872
+ ] }, m.key);
873
+ }) });
874
+ const O = e.sx("tableHeadCell", { fontSize: 12.5, fontWeight: 600, color: "text.secondary", whiteSpace: "nowrap", py: 1, px: 1.75 }), N = e.sx("tableCell", { fontSize: 14, color: "text.primary", whiteSpace: "nowrap", py: 1.1, px: 1.75 }), G = 1 + M.length + (W ? 1 : 0) + (w || q ? 1 : 0);
875
+ return /* @__PURE__ */ n(f, { sx: e.sx("table", { border: `1px solid ${v.palette.divider}`, borderRadius: "8px", overflowX: "auto", bgcolor: "background.paper" }), children: /* @__PURE__ */ h(Jt, { size: "small", children: [
876
+ /* @__PURE__ */ n(Yt, { children: /* @__PURE__ */ h(he, { sx: e.sx("tableHead", { bgcolor: p(v.palette.text.primary, v.palette.mode === "dark" ? 0.05 : 0.03) }), children: [
877
+ /* @__PURE__ */ n(K, { sx: O, children: k.titleLabel || e.itemLabel }),
878
+ M.map((m) => /* @__PURE__ */ n(K, { sx: O, children: m.label }, m.id)),
879
+ W && /* @__PURE__ */ n(K, { sx: O, children: P }),
880
+ (w || q) && /* @__PURE__ */ n(K, { sx: O })
881
+ ] }) }),
882
+ /* @__PURE__ */ n(Zt, { children: t.map((m, u) => {
883
+ const { title: L, rawTitle: F } = oe(m.data, I, u), Q = l && C(u).length > 0, H = u === t.length - 1, re = H && !(q && !x(m.key)) ? { "& > td": { borderBottom: 0 } } : {};
884
+ return /* @__PURE__ */ h(Re, { children: [
885
+ /* @__PURE__ */ h(he, { hover: !0, sx: e.sx("tableRow", { ...re, ...Q ? { bgcolor: D } : {} }), children: [
886
+ /* @__PURE__ */ n(K, { sx: N, children: F ? /* @__PURE__ */ n(Me, { ui: e, title: F, canEdit: _, onOpen: () => d(u), size: 14 }) : /* @__PURE__ */ n(
887
+ f,
888
+ {
889
+ component: _ ? "button" : "span",
890
+ type: _ ? "button" : void 0,
891
+ onClick: _ ? () => d(u) : void 0,
892
+ "aria-label": _ ? e.t("editAria", { title: L }) : void 0,
893
+ sx: {
894
+ background: "none",
895
+ border: 0,
896
+ p: 0,
897
+ font: "inherit",
898
+ color: "text.disabled",
899
+ cursor: _ ? "pointer" : "default"
900
+ },
901
+ children: "—"
902
+ }
903
+ ) }),
904
+ M.map((te) => /* @__PURE__ */ n(K, { sx: N, children: tt(Te(A, te.id), m.data[te.id]) || V }, te.id)),
905
+ W && /* @__PURE__ */ n(K, { sx: N, children: /* @__PURE__ */ n(_e, { ui: e, data: m.data }) }),
906
+ (w || q) && /* @__PURE__ */ n(K, { align: "right", sx: e.sx("rowActions", { width: "1%", whiteSpace: "nowrap", py: 0.25 }), children: /* @__PURE__ */ n(f, { sx: { display: "inline-flex" }, children: E(m, u, L) }) })
907
+ ] }),
908
+ q && !x(m.key) && /* @__PURE__ */ n(he, { children: /* @__PURE__ */ n(K, { colSpan: G, sx: { p: 0, ...H ? { borderBottom: 0 } : {} }, children: $(m, u, L) }) })
909
+ ] }, m.key);
910
+ }) })
911
+ ] }) });
912
+ }
913
+ function ft({
914
+ config: e,
915
+ nodes: t,
916
+ onChange: r,
917
+ guid: a,
918
+ depth: i = 0,
919
+ readOnly: l = !1,
920
+ issues: c = [],
921
+ showErrors: x = !1,
922
+ required: g = !1,
923
+ parentTitle: d,
924
+ texts: y
925
+ }) {
926
+ const b = J(), o = hn(b, e, i, y), { emptyTitle: v, emptyText: S, ...I } = { ...y || {}, ...e.texts || {} }, A = e.max != null ? Number(e.max) : void 0, k = !l && (A === void 0 || t.length < A), M = l ? "none" : o.addButton.position, W = M === "header" || M === "both", P = M === "footer" || M === "both", q = e.showEmpty ?? !o.nested, _ = t.length === 0 && q && !(P && o.addButton.variant === "dashed"), w = t.length === 0 && !_ && !P, [C, V] = Y({ open: !1, mode: "add", index: -1, session: 0 }), [$, E] = Y({ open: !1, index: -1, title: "", detail: "" }), [D, O] = Y(null), [N, G] = Y({}), m = (s, T = -1) => V((z) => ({ open: !0, mode: s, index: T, session: z.session + 1 })), u = () => V((s) => ({ ...s, open: !1 })), L = () => m("add"), F = (s) => m(!l && o.actions.edit ? "edit" : "view", s), Q = e.defaultCollapsed ?? o.layout === "table", H = (s) => N[s] ?? Q, re = (s) => G((T) => ({ ...T, [s]: !H(s) })), te = (s, T) => {
927
+ if (C.mode === "add") {
928
+ const z = { key: ie(), data: s, children: en(e) };
929
+ o.layout === "cards" && G((de) => ({ ...de, [z.key]: !1 })), r([...t, z]);
930
+ const B = A !== void 0 && t.length + 1 >= A;
931
+ (!T || B) && u();
932
+ return;
933
+ }
934
+ C.mode === "edit" && r(t.map((z, B) => B === C.index ? { ...z, data: s } : z)), u();
935
+ }, qe = (s) => r(t.filter((T, z) => z !== s)), je = (s) => {
936
+ if (e.confirmDelete === !1) {
937
+ qe(s);
938
+ return;
939
+ }
940
+ const T = t[s];
941
+ E({
942
+ open: !0,
943
+ index: s,
944
+ title: oe(T.data, e, s).title,
945
+ detail: Ht({ ...T.data, ...T.children }, e)
946
+ });
947
+ }, gt = (s) => {
948
+ const T = [...t];
949
+ T.splice(s + 1, 0, ct(t[s])), r(T);
950
+ }, We = (s, T) => {
951
+ const z = s + T;
952
+ if (z < 0 || z >= t.length) return;
953
+ const B = [...t];
954
+ [B[s], B[z]] = [B[z], B[s]], r(B);
955
+ }, Ee = (s, T, z) => r(t.map((B, de) => de === s ? { ...B, children: { ...B.children, [T]: z } } : B)), ae = x ? c.find((s) => s.path.length === 0)?.message : void 0, bt = C.index >= 0 ? t[C.index] : void 0, ne = D?.index ?? -1, le = (s) => {
956
+ O(null), s();
957
+ }, ut = () => G(Object.fromEntries(t.map((s) => [s.key, !0]))), yt = () => G(Object.fromEntries(t.map((s) => [s.key, !1]))), se = t.length > 0 && t.every((s) => H(s.key)), ce = o.t("deleteMessage", { detail: $.detail ? o.t("deleteDetail", { detail: $.detail }) : "" }), [vt, De] = ce.includes("{title}") ? ce.split("{title}") : [ce, null];
958
+ return /* @__PURE__ */ h(f, { "data-collection": e.id, sx: o.sx("root", { width: "100%", minWidth: 0 }), children: [
959
+ /* @__PURE__ */ n(
960
+ wn,
961
+ {
962
+ ui: o,
963
+ count: t.length,
964
+ required: g || (Number(e.min) || 0) > 0,
965
+ alone: w && !ae,
966
+ action: /* @__PURE__ */ h(f, { sx: { display: "flex", alignItems: "center", gap: 1, flexWrap: "wrap" }, children: [
967
+ o.layout === "cards" && t.length >= 2 && /* @__PURE__ */ n(
968
+ Z,
969
+ {
970
+ size: "small",
971
+ variant: "text",
972
+ onClick: se ? yt : ut,
973
+ sx: {
974
+ fontSize: 12.5,
975
+ fontWeight: 600,
976
+ color: "text.secondary",
977
+ px: 1,
978
+ minWidth: 0,
979
+ textTransform: "none",
980
+ "&:hover": { color: "text.primary", bgcolor: p(b.palette.text.primary, 0.05) }
981
+ },
982
+ startIcon: /* @__PURE__ */ n(j, { sx: { fontSize: "15px !important" }, children: se ? "unfold_more" : "unfold_less" }),
983
+ children: se ? "Expand all" : "Collapse all"
984
+ }
985
+ ),
986
+ W && /* @__PURE__ */ n(Xe, { ui: o, placement: "header", empty: t.length === 0, disabled: !k, onClick: L })
987
+ ] })
988
+ }
989
+ ),
990
+ ae && /* @__PURE__ */ h(
991
+ R,
992
+ {
993
+ role: "alert",
994
+ sx: o.sx("error", { display: "flex", alignItems: "center", gap: 0.5, color: "error.main", fontSize: 13, fontWeight: 500, mt: -0.5, mb: 1.25 }),
995
+ children: [
996
+ /* @__PURE__ */ n(j, { sx: { fontSize: "17px !important" }, children: "error_outline" }),
997
+ ae
998
+ ]
999
+ }
1000
+ ),
1001
+ _ && /* @__PURE__ */ n(Cn, { ui: o, readOnly: l, error: !!ae }),
1002
+ t.length > 0 && o.layout === "table" && /* @__PURE__ */ n(
1003
+ In,
1004
+ {
1005
+ ui: o,
1006
+ nodes: t,
1007
+ guid: a,
1008
+ readOnly: l,
1009
+ issues: c,
1010
+ showErrors: x,
1011
+ texts: I,
1012
+ isCollapsed: H,
1013
+ onToggle: re,
1014
+ onOpen: F,
1015
+ onDelete: je,
1016
+ onMenu: (s, T) => O({ anchor: s, index: T }),
1017
+ onChildChange: Ee
1018
+ }
1019
+ ),
1020
+ t.length > 0 && o.layout === "cards" && /* @__PURE__ */ n(f, { sx: o.sx("list", { display: "flex", flexDirection: "column", gap: 2 }), children: t.map((s, T) => /* @__PURE__ */ n(
1021
+ Tn,
1022
+ {
1023
+ ui: o,
1024
+ node: s,
1025
+ index: T,
1026
+ guid: a,
1027
+ readOnly: l,
1028
+ collapsed: H(s.key),
1029
+ issues: c.filter((z) => z.path[0] === T).map((z) => ({ ...z, path: z.path.slice(1) })),
1030
+ showErrors: x,
1031
+ texts: I,
1032
+ onOpen: () => F(T),
1033
+ onDelete: () => je(T),
1034
+ onMenu: (z) => O({ anchor: z, index: T }),
1035
+ onToggle: () => re(s.key),
1036
+ onChildChange: (z, B) => Ee(T, z, B)
1037
+ },
1038
+ s.key
1039
+ )) }),
1040
+ P && /* @__PURE__ */ n(f, { sx: { mt: t.length || o.addButton.variant !== "dashed" ? 1.25 : 0 }, children: /* @__PURE__ */ n(Xe, { ui: o, placement: "footer", empty: t.length === 0, disabled: !k, onClick: L }) }),
1041
+ /* @__PURE__ */ n(
1042
+ kn,
1043
+ {
1044
+ ui: o,
1045
+ open: C.open,
1046
+ mode: C.mode,
1047
+ session: C.session,
1048
+ guid: `${a}-${e.id}`,
1049
+ initial: bt?.data,
1050
+ context: d,
1051
+ onClose: u,
1052
+ onSave: te
1053
+ }
1054
+ ),
1055
+ /* @__PURE__ */ h(
1056
+ Xt,
1057
+ {
1058
+ anchorEl: D?.anchor,
1059
+ open: !!D,
1060
+ onClose: () => O(null),
1061
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
1062
+ transformOrigin: { vertical: "top", horizontal: "right" },
1063
+ sx: { "& .MuiPaper-root": o.merged("menu", { borderRadius: "10px", minWidth: 170 }) },
1064
+ children: [
1065
+ o.actions.duplicate && /* @__PURE__ */ h(pe, { sx: o.sx("menuItem"), disabled: !k, onClick: () => le(() => gt(ne)), children: [
1066
+ /* @__PURE__ */ n(xe, { children: /* @__PURE__ */ n(j, { fontSize: "small", children: "content_copy" }) }),
1067
+ /* @__PURE__ */ n(me, { children: o.t("duplicate") })
1068
+ ] }),
1069
+ o.actions.move && /* @__PURE__ */ h(pe, { sx: o.sx("menuItem"), disabled: ne <= 0, onClick: () => le(() => We(ne, -1)), children: [
1070
+ /* @__PURE__ */ n(xe, { children: /* @__PURE__ */ n(j, { fontSize: "small", children: "arrow_upward" }) }),
1071
+ /* @__PURE__ */ n(me, { children: o.t("moveUp") })
1072
+ ] }),
1073
+ o.actions.move && /* @__PURE__ */ h(pe, { sx: o.sx("menuItem"), disabled: ne >= t.length - 1, onClick: () => le(() => We(ne, 1)), children: [
1074
+ /* @__PURE__ */ n(xe, { children: /* @__PURE__ */ n(j, { fontSize: "small", children: "arrow_downward" }) }),
1075
+ /* @__PURE__ */ n(me, { children: o.t("moveDown") })
1076
+ ] })
1077
+ ]
1078
+ }
1079
+ ),
1080
+ /* @__PURE__ */ h(
1081
+ at,
1082
+ {
1083
+ open: $.open,
1084
+ onClose: () => E((s) => ({ ...s, open: !1 })),
1085
+ maxWidth: "xs",
1086
+ fullWidth: !0,
1087
+ sx: { "& .MuiDialog-paper": o.merged("confirm", { borderRadius: "12px", backgroundImage: "none" }) },
1088
+ children: [
1089
+ /* @__PURE__ */ h(ot, { sx: { pt: 3, pb: 1 }, children: [
1090
+ /* @__PURE__ */ n(R, { sx: o.sx("confirmTitle", { fontWeight: 600, fontSize: 17 }), children: o.t("deleteTitle") }),
1091
+ /* @__PURE__ */ h(R, { sx: o.sx("confirmText", { fontSize: 14, color: "text.secondary", mt: 1 }), children: [
1092
+ vt,
1093
+ De !== null && /* @__PURE__ */ n(f, { component: "strong", sx: { color: "text.primary", fontWeight: 600 }, children: $.title }),
1094
+ De
1095
+ ] })
1096
+ ] }),
1097
+ /* @__PURE__ */ h(it, { sx: { px: 3, pb: 2.5, pt: 2, gap: 1, "& .MuiButton-root": { textTransform: "none", fontWeight: 600, borderRadius: "8px" } }, children: [
1098
+ /* @__PURE__ */ n(Z, { color: "inherit", onClick: () => E((s) => ({ ...s, open: !1 })), sx: o.sx("confirmCancel", { color: "text.secondary" }), children: o.t("cancel") }),
1099
+ /* @__PURE__ */ n(
1100
+ Z,
1101
+ {
1102
+ variant: "contained",
1103
+ color: "error",
1104
+ disableElevation: !0,
1105
+ onClick: () => {
1106
+ qe($.index), E((s) => ({ ...s, open: !1 }));
1107
+ },
1108
+ sx: o.sx("confirmDelete"),
1109
+ children: o.t("deleteConfirm")
1110
+ }
1111
+ )
1112
+ ] })
1113
+ ]
1114
+ }
1115
+ )
1116
+ ] });
1117
+ }
1118
+ const zn = ["mandatory", "mandatoryselect"], we = (e) => {
1119
+ try {
1120
+ return JSON.stringify(e);
1121
+ } catch {
1122
+ return "";
1123
+ }
1124
+ };
1125
+ function Wn({ attributes: e = {}, rules: t = {}, onChange: r, submitTick: a }) {
1126
+ const { id: i = "", value: l } = e, c = { ...e, id: i, fields: e.fields || [] }, x = !!(e.readOnly || e.disabled || e.MuiAttributes?.disabled), g = t?.validation?.find((k) => zn.includes(k.rule)), [d] = Y(ie), [y, b] = Y(() => Ie(l, c)), [o, v] = Y(!1), S = Je(we(Ae(l)));
1127
+ Oe(() => {
1128
+ const k = we(Ae(l));
1129
+ k !== S.current && (S.current = k, b(Ie(l, c)));
1130
+ }, [l]), Oe(() => {
1131
+ a && v(!0);
1132
+ }, [a]);
1133
+ const I = (k) => {
1134
+ b(k);
1135
+ const M = ze(k, c);
1136
+ S.current = we(M), r?.({ id: i, value: M });
1137
+ }, A = Kt(ze(y, c), c, {
1138
+ required: !!g,
1139
+ requiredMessage: g?.message
1140
+ });
1141
+ return /* @__PURE__ */ n(
1142
+ ft,
1143
+ {
1144
+ config: c,
1145
+ nodes: y,
1146
+ onChange: I,
1147
+ guid: `${d}-${i}`,
1148
+ readOnly: x,
1149
+ issues: A,
1150
+ showErrors: o,
1151
+ required: !!g
1152
+ }
1153
+ );
1154
+ }
1155
+ export {
1156
+ Wn as default
1157
+ };