ding-react-admin 1.0.4 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/README.md +4 -10
  2. package/dist/index.js +1071 -803
  3. package/dist/src/crud/InlineFormSet.d.ts +2 -17
  4. package/dist/src/crud/InlineFormSet.d.ts.map +1 -1
  5. package/dist/src/crud/ResourceForm.d.ts +4 -9
  6. package/dist/src/crud/ResourceForm.d.ts.map +1 -1
  7. package/dist/src/crud/ResourceList.d.ts.map +1 -1
  8. package/dist/src/crud/columns/ImageColumn.d.ts +14 -0
  9. package/dist/src/crud/columns/ImageColumn.d.ts.map +1 -0
  10. package/dist/src/crud/context/InlineFieldsRegistry.d.ts +15 -0
  11. package/dist/src/crud/context/InlineFieldsRegistry.d.ts.map +1 -0
  12. package/dist/src/crud/context/PayloadFieldsContext.d.ts +18 -0
  13. package/dist/src/crud/context/PayloadFieldsContext.d.ts.map +1 -0
  14. package/dist/src/crud/fields/FileField.d.ts +12 -0
  15. package/dist/src/crud/fields/FileField.d.ts.map +1 -0
  16. package/dist/src/crud/fields/ImageField.d.ts +14 -0
  17. package/dist/src/crud/fields/ImageField.d.ts.map +1 -0
  18. package/dist/src/crud/fields/uploadFieldUtils.d.ts +5 -0
  19. package/dist/src/crud/fields/uploadFieldUtils.d.ts.map +1 -0
  20. package/dist/src/crud/fields/useUploadPreviewUrl.d.ts +4 -0
  21. package/dist/src/crud/fields/useUploadPreviewUrl.d.ts.map +1 -0
  22. package/dist/src/crud/index.d.ts +22 -9
  23. package/dist/src/crud/index.d.ts.map +1 -1
  24. package/dist/src/crud/types.d.ts +9 -7
  25. package/dist/src/crud/types.d.ts.map +1 -1
  26. package/dist/src/crud/utils/buildFormPayload.d.ts +6 -0
  27. package/dist/src/crud/utils/buildFormPayload.d.ts.map +1 -0
  28. package/dist/src/crud/utils/buildInlineRowsPayload.d.ts +6 -0
  29. package/dist/src/crud/utils/buildInlineRowsPayload.d.ts.map +1 -0
  30. package/dist/src/crud/utils/buildResourceFormSubmitBody.d.ts +5 -0
  31. package/dist/src/crud/utils/buildResourceFormSubmitBody.d.ts.map +1 -0
  32. package/dist/src/crud/utils/formErrors.d.ts +1 -1
  33. package/dist/src/crud/utils/formErrors.d.ts.map +1 -1
  34. package/dist/src/crud/utils/getFormValue.d.ts +3 -0
  35. package/dist/src/crud/utils/getFormValue.d.ts.map +1 -0
  36. package/dist/src/crud/utils/hasUploadValues.d.ts +3 -0
  37. package/dist/src/crud/utils/hasUploadValues.d.ts.map +1 -0
  38. package/dist/src/crud/utils/nestedFieldPath.d.ts +3 -0
  39. package/dist/src/crud/utils/nestedFieldPath.d.ts.map +1 -0
  40. package/dist/src/crud/utils/prepareFormSubmitBody.d.ts +7 -0
  41. package/dist/src/crud/utils/prepareFormSubmitBody.d.ts.map +1 -0
  42. package/dist/src/crud/utils/setFormValue.d.ts +3 -0
  43. package/dist/src/crud/utils/setFormValue.d.ts.map +1 -0
  44. package/dist/src/crud/utils/toFormData.d.ts +13 -0
  45. package/dist/src/crud/utils/toFormData.d.ts.map +1 -0
  46. package/dist/src/crud/utils/useFormRecord.d.ts +42 -0
  47. package/dist/src/crud/utils/useFormRecord.d.ts.map +1 -0
  48. package/dist/src/data/createRestResourceHandlers.d.ts +5 -5
  49. package/dist/src/data/createRestResourceHandlers.d.ts.map +1 -1
  50. package/dist/src/data/dataProviderTypes.d.ts +6 -5
  51. package/dist/src/data/dataProviderTypes.d.ts.map +1 -1
  52. package/dist/src/data/parseFormErrorHelpers.d.ts +44 -6
  53. package/dist/src/data/parseFormErrorHelpers.d.ts.map +1 -1
  54. package/dist/src/data/resourceHandlers.d.ts +1 -1
  55. package/dist/src/data/resourceHandlers.d.ts.map +1 -1
  56. package/dist/src/index.d.ts +4 -4
  57. package/dist/src/index.d.ts.map +1 -1
  58. package/dist/src/layouts/AdminLayout.d.ts.map +1 -1
  59. package/package.json +1 -1
  60. package/src/crud/InlineFormSet.tsx +28 -85
  61. package/src/crud/ResourceForm.tsx +60 -66
  62. package/src/crud/ResourceFormModal.tsx +25 -25
  63. package/src/crud/ResourceList.tsx +1 -0
  64. package/src/crud/columns/ImageColumn.tsx +58 -0
  65. package/src/crud/columns/TextColumn.tsx +2 -2
  66. package/src/crud/context/InlineFieldsRegistry.tsx +61 -0
  67. package/src/crud/context/PayloadFieldsContext.tsx +62 -0
  68. package/src/crud/fields/FieldWrapper.tsx +87 -87
  69. package/src/crud/fields/FileField.tsx +123 -0
  70. package/src/crud/fields/ImageField.tsx +120 -0
  71. package/src/crud/fields/uploadFieldUtils.ts +21 -0
  72. package/src/crud/fields/useUploadPreviewUrl.ts +20 -0
  73. package/src/crud/index.ts +23 -19
  74. package/src/crud/types.ts +9 -7
  75. package/src/crud/utils/buildFormPayload.ts +24 -0
  76. package/src/crud/utils/buildInlineRowsPayload.ts +37 -0
  77. package/src/crud/utils/buildResourceFormSubmitBody.ts +29 -0
  78. package/src/crud/utils/formErrors.ts +42 -38
  79. package/src/crud/utils/{getByPath.ts → getFormValue.ts} +2 -2
  80. package/src/crud/utils/hasUploadValues.ts +9 -0
  81. package/src/crud/utils/nestedFieldPath.ts +8 -0
  82. package/src/crud/utils/prepareFormSubmitBody.ts +17 -0
  83. package/src/crud/utils/{setByPath.ts → setFormValue.ts} +2 -2
  84. package/src/crud/utils/toFormData.ts +81 -0
  85. package/src/crud/utils/useFormRecord.ts +156 -0
  86. package/src/data/createRestResourceHandlers.ts +19 -13
  87. package/src/data/dataProviderTypes.ts +7 -5
  88. package/src/data/dataUtils.test.ts +118 -6
  89. package/src/data/parseFormErrorHelpers.test.ts +138 -84
  90. package/src/data/parseFormErrorHelpers.ts +311 -224
  91. package/src/data/resourceHandlers.ts +1 -1
  92. package/src/index.ts +23 -11
  93. package/src/layouts/AdminLayout.tsx +2 -1
  94. package/dist/src/crud/context/SubmitFieldsContext.d.ts +0 -18
  95. package/dist/src/crud/context/SubmitFieldsContext.d.ts.map +0 -1
  96. package/dist/src/crud/utils/getByPath.d.ts +0 -3
  97. package/dist/src/crud/utils/getByPath.d.ts.map +0 -1
  98. package/dist/src/crud/utils/inlineArrayName.d.ts +0 -3
  99. package/dist/src/crud/utils/inlineArrayName.d.ts.map +0 -1
  100. package/dist/src/crud/utils/inlineFieldName.d.ts +0 -3
  101. package/dist/src/crud/utils/inlineFieldName.d.ts.map +0 -1
  102. package/dist/src/crud/utils/pickBySources.d.ts +0 -6
  103. package/dist/src/crud/utils/pickBySources.d.ts.map +0 -1
  104. package/dist/src/crud/utils/setByPath.d.ts +0 -3
  105. package/dist/src/crud/utils/setByPath.d.ts.map +0 -1
  106. package/dist/src/crud/utils/useResourceFormData.d.ts +0 -47
  107. package/dist/src/crud/utils/useResourceFormData.d.ts.map +0 -1
  108. package/src/crud/context/SubmitFieldsContext.tsx +0 -62
  109. package/src/crud/utils/inlineArrayName.ts +0 -4
  110. package/src/crud/utils/inlineFieldName.ts +0 -8
  111. package/src/crud/utils/pickBySources.ts +0 -24
  112. package/src/crud/utils/useResourceFormData.ts +0 -231
package/dist/index.js CHANGED
@@ -1,32 +1,32 @@
1
1
  import { Children as e, createContext as t, createElement as n, isValidElement as r, useCallback as i, useContext as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
2
2
  import { Link as u, Navigate as d, Outlet as f, RouterProvider as p, createBrowserRouter as m, useLocation as h, useNavigate as g, useParams as _, useSearchParams as v } from "react-router-dom";
3
- import { App as y, Avatar as b, Button as x, Card as S, ConfigProvider as C, DatePicker as w, Drawer as ee, Dropdown as T, Flex as E, Form as D, Grid as O, Input as k, InputNumber as A, Layout as j, Menu as M, Modal as te, Popover as N, Segmented as P, Select as F, Space as I, Spin as L, Steps as ne, Switch as re, Table as ie, Tabs as ae, Typography as R, theme as z } from "antd";
3
+ import { App as y, Avatar as b, Button as x, Card as S, ConfigProvider as C, DatePicker as w, Drawer as ee, Dropdown as T, Flex as E, Form as D, Grid as O, Image as k, Input as A, InputNumber as te, Layout as j, Menu as ne, Modal as M, Popover as N, Segmented as re, Select as P, Space as F, Spin as I, Steps as ie, Switch as ae, Table as oe, Tabs as L, Typography as R, theme as z } from "antd";
4
4
  import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
5
- import { ArrowLeftOutlined as U, CaretDownOutlined as oe, CaretUpOutlined as se, ColumnHeightOutlined as W, DesktopOutlined as ce, LayoutOutlined as le, LogoutOutlined as ue, MenuOutlined as de, MoonOutlined as fe, SettingOutlined as pe, SunOutlined as me, UserOutlined as he } from "@ant-design/icons";
6
- import { Controller as ge, FormProvider as _e, useFieldArray as ve, useForm as ye, useFormContext as G, useFormState as K, useWatch as be } from "react-hook-form";
7
- import xe from "dayjs";
5
+ import { ArrowLeftOutlined as U, CaretDownOutlined as se, CaretUpOutlined as ce, ColumnHeightOutlined as le, DeleteOutlined as ue, DesktopOutlined as de, LayoutOutlined as fe, LogoutOutlined as pe, MenuOutlined as me, MoonOutlined as he, PaperClipOutlined as ge, SettingOutlined as _e, SunOutlined as ve, UploadOutlined as ye, UserOutlined as be } from "@ant-design/icons";
6
+ import { Controller as xe, FormProvider as W, useFieldArray as Se, useForm as Ce, useFormContext as G, useFormState as we, useWatch as Te } from "react-hook-form";
7
+ import Ee from "dayjs";
8
8
  //#region src/context/AppThemeProvider.tsx
9
- var Se = t(null);
10
- function Ce(e) {
9
+ var De = t(null);
10
+ function Oe(e) {
11
11
  try {
12
12
  let t = localStorage.getItem(e);
13
13
  if (t === "light" || t === "dark" || t === "system") return t;
14
14
  } catch {}
15
15
  return "system";
16
16
  }
17
- function we() {
17
+ function ke() {
18
18
  return window.matchMedia("(prefers-color-scheme: dark)").matches;
19
19
  }
20
- function Te(e) {
20
+ function Ae(e) {
21
21
  try {
22
22
  let t = localStorage.getItem(e);
23
23
  if (t === "comfortable" || t === "compact") return t;
24
24
  } catch {}
25
25
  return "comfortable";
26
26
  }
27
- var Ee = "ding-react-admin-theme-mode", De = "ding-react-admin-theme-density";
28
- function Oe({ children: e, modeStorageKey: t = Ee, densityStorageKey: n = De }) {
29
- let [r, i] = l(() => Ce(t)), [a, c] = l(() => Te(n)), [u, d] = l(we);
27
+ var je = "ding-react-admin-theme-mode", Me = "ding-react-admin-theme-density";
28
+ function Ne({ children: e, modeStorageKey: t = je, densityStorageKey: n = Me }) {
29
+ let [r, i] = l(() => Oe(t)), [a, c] = l(() => Ae(n)), [u, d] = l(ke);
30
30
  o(() => {
31
31
  if (r !== "system") return;
32
32
  let e = window.matchMedia("(prefers-color-scheme: dark)"), t = () => d(e.matches);
@@ -58,7 +58,7 @@ function Oe({ children: e, modeStorageKey: t = Ee, densityStorageKey: n = De })
58
58
  f,
59
59
  p
60
60
  ]);
61
- return /* @__PURE__ */ V(Se.Provider, {
61
+ return /* @__PURE__ */ V(De.Provider, {
62
62
  value: g,
63
63
  children: /* @__PURE__ */ V(C, {
64
64
  theme: h,
@@ -66,87 +66,87 @@ function Oe({ children: e, modeStorageKey: t = Ee, densityStorageKey: n = De })
66
66
  })
67
67
  });
68
68
  }
69
- function ke() {
70
- let e = a(Se);
69
+ function Pe() {
70
+ let e = a(De);
71
71
  if (!e) throw Error("useThemeMode must be used within AppThemeProvider");
72
72
  return e;
73
73
  }
74
74
  //#endregion
75
75
  //#region src/components/DensitySwitch.tsx
76
- var Ae = [{
76
+ var Fe = [{
77
77
  label: "Comfortable",
78
78
  value: "comfortable",
79
- icon: /* @__PURE__ */ V(le, {})
79
+ icon: /* @__PURE__ */ V(fe, {})
80
80
  }, {
81
81
  label: "Compact",
82
82
  value: "compact",
83
- icon: /* @__PURE__ */ V(W, {})
83
+ icon: /* @__PURE__ */ V(le, {})
84
84
  }];
85
- function je() {
86
- let { density: e, setDensity: t } = ke();
87
- return /* @__PURE__ */ V(P, {
85
+ function Ie() {
86
+ let { density: e, setDensity: t } = Pe();
87
+ return /* @__PURE__ */ V(re, {
88
88
  size: "small",
89
89
  value: e,
90
- options: Ae,
90
+ options: Fe,
91
91
  onChange: (e) => t(e)
92
92
  });
93
93
  }
94
94
  //#endregion
95
95
  //#region src/components/ThemeSwitch.tsx
96
- var Me = [
96
+ var Le = [
97
97
  {
98
98
  label: "Light",
99
99
  value: "light",
100
- icon: /* @__PURE__ */ V(me, {})
100
+ icon: /* @__PURE__ */ V(ve, {})
101
101
  },
102
102
  {
103
103
  label: "Dark",
104
104
  value: "dark",
105
- icon: /* @__PURE__ */ V(fe, {})
105
+ icon: /* @__PURE__ */ V(he, {})
106
106
  },
107
107
  {
108
108
  label: "Auto",
109
109
  value: "system",
110
- icon: /* @__PURE__ */ V(ce, {})
110
+ icon: /* @__PURE__ */ V(de, {})
111
111
  }
112
112
  ];
113
- function Ne() {
114
- let { mode: e, setMode: t } = ke();
115
- return /* @__PURE__ */ V(P, {
113
+ function Re() {
114
+ let { mode: e, setMode: t } = Pe();
115
+ return /* @__PURE__ */ V(re, {
116
116
  size: "small",
117
117
  value: e,
118
- options: Me,
118
+ options: Le,
119
119
  onChange: (e) => t(e)
120
120
  });
121
121
  }
122
122
  //#endregion
123
123
  //#region src/components/ThemeToolbar.tsx
124
- function Pe() {
124
+ function ze() {
125
125
  let { token: e } = z.useToken();
126
126
  return /* @__PURE__ */ V(N, {
127
127
  placement: O.useBreakpoint().lg ? "bottomRight" : "bottom",
128
128
  trigger: "click",
129
- content: /* @__PURE__ */ H(I, {
129
+ content: /* @__PURE__ */ H(F, {
130
130
  orientation: "vertical",
131
131
  size: "middle",
132
132
  style: {
133
133
  minWidth: 240,
134
134
  maxWidth: "min(92vw, 320px)"
135
135
  },
136
- children: [/* @__PURE__ */ V(Ne, {}), /* @__PURE__ */ V(je, {})]
136
+ children: [/* @__PURE__ */ V(Re, {}), /* @__PURE__ */ V(Ie, {})]
137
137
  }),
138
138
  styles: { content: { padding: e.paddingSM } },
139
139
  children: /* @__PURE__ */ V(x, {
140
140
  type: "default",
141
- icon: /* @__PURE__ */ V(pe, {}),
141
+ icon: /* @__PURE__ */ V(_e, {}),
142
142
  "aria-label": "Display and theme settings"
143
143
  })
144
144
  });
145
145
  }
146
146
  //#endregion
147
147
  //#region src/context/AuthProvider.tsx
148
- var Fe = t(null);
149
- function Ie({ children: e, adapter: t }) {
148
+ var Be = t(null);
149
+ function Ve({ children: e, adapter: t }) {
150
150
  let [n, r] = l(() => t.getToken()), a = i(async (e) => {
151
151
  await t.login(e), r(t.getToken());
152
152
  }, [t]), o = i(() => {
@@ -160,18 +160,18 @@ function Ie({ children: e, adapter: t }) {
160
160
  a,
161
161
  o
162
162
  ]);
163
- return /* @__PURE__ */ V(Fe.Provider, {
163
+ return /* @__PURE__ */ V(Be.Provider, {
164
164
  value: c,
165
165
  children: e
166
166
  });
167
167
  }
168
- function Le() {
169
- let e = a(Fe);
168
+ function He() {
169
+ let e = a(Be);
170
170
  if (!e) throw Error("useAuth must be used within AuthProvider");
171
171
  return e;
172
172
  }
173
- var Re = "ding-react-admin-auth";
174
- function ze(e = Re) {
173
+ var Ue = "ding-react-admin-auth";
174
+ function We(e = Ue) {
175
175
  return {
176
176
  async login({ username: t, password: n }) {
177
177
  if (!t.trim() || !n) throw Error("Invalid credentials");
@@ -187,37 +187,37 @@ function ze(e = Re) {
187
187
  }
188
188
  //#endregion
189
189
  //#region src/context/PermissionsProvider.tsx
190
- var Be = t(null);
191
- function Ve({ children: e, can: t }) {
190
+ var Ge = t(null);
191
+ function Ke({ children: e, can: t }) {
192
192
  let n = s(() => t, [t]);
193
- return /* @__PURE__ */ V(Be.Provider, {
193
+ return /* @__PURE__ */ V(Ge.Provider, {
194
194
  value: n,
195
195
  children: e
196
196
  });
197
197
  }
198
- function q() {
199
- let e = a(Be);
198
+ function K() {
199
+ let e = a(Ge);
200
200
  if (!e) throw Error("usePermissions must be used within PermissionsProvider");
201
201
  return e;
202
202
  }
203
- function He(e) {
203
+ function qe(e) {
204
204
  return (t) => e()?.includes(t) ?? !1;
205
205
  }
206
- function Ue(e) {
207
- let t = q();
206
+ function Je(e) {
207
+ let t = K();
208
208
  return i(() => t(e), [t, e]);
209
209
  }
210
210
  //#endregion
211
211
  //#region src/permissions/resourcePermissions.ts
212
- function J(e, t, n) {
212
+ function q(e, t, n) {
213
213
  if (!t) return !0;
214
214
  let r = t[n];
215
215
  return n === "read" && !r && (r = t.list), r ? e(r) : !1;
216
216
  }
217
- function We(e, t) {
217
+ function Ye(e, t) {
218
218
  return e.map((e) => {
219
219
  if (e.children?.length) {
220
- let n = We(e.children, t);
220
+ let n = Ye(e.children, t);
221
221
  return n.length === 0 ? null : {
222
222
  ...e,
223
223
  children: n
@@ -228,25 +228,25 @@ function We(e, t) {
228
228
  }
229
229
  //#endregion
230
230
  //#region src/layouts/AdminLayout.tsx
231
- var Ge = "#001529", Ke = "ding-react-admin-sider-collapsed";
232
- function qe(e) {
231
+ var Xe = "#001529", Ze = "ding-react-admin-sider-collapsed";
232
+ function Qe(e) {
233
233
  try {
234
234
  return localStorage.getItem(e) === "1";
235
235
  } catch {
236
236
  return !1;
237
237
  }
238
238
  }
239
- function Je() {
239
+ function $e() {
240
240
  return O.useBreakpoint().lg !== !0;
241
241
  }
242
- function Ye(e) {
242
+ function et(e) {
243
243
  let t = /* @__PURE__ */ new Set();
244
244
  function n(e) {
245
245
  for (let r of e) r.children?.length ? n(r.children) : t.add(r.path);
246
246
  }
247
247
  return n(e), t;
248
248
  }
249
- function Xe(e, t) {
249
+ function tt(e, t) {
250
250
  function n(e) {
251
251
  for (let r of e) if (r.children?.length) {
252
252
  let e = n(r.children);
@@ -256,14 +256,14 @@ function Xe(e, t) {
256
256
  }
257
257
  return n(e) ?? [];
258
258
  }
259
- function Ze(e) {
259
+ function nt(e) {
260
260
  return e.map((e) => {
261
261
  let t = e.Icon, n = t ? /* @__PURE__ */ V(t, {}) : void 0;
262
262
  return e.children?.length ? {
263
263
  key: e.path,
264
264
  icon: n,
265
265
  label: e.label,
266
- children: Ze(e.children)
266
+ children: nt(e.children)
267
267
  } : {
268
268
  key: e.path,
269
269
  icon: n,
@@ -271,8 +271,8 @@ function Ze(e) {
271
271
  };
272
272
  });
273
273
  }
274
- function Qe({ menuItems: e, selectedKeys: t, inlineCollapsed: n, openKeys: r, onOpenChange: i, onNavigate: a }) {
275
- return /* @__PURE__ */ V(M, {
274
+ function rt({ menuItems: e, selectedKeys: t, inlineCollapsed: n, openKeys: r, onOpenChange: i, onNavigate: a }) {
275
+ return /* @__PURE__ */ V(ne, {
276
276
  mode: "inline",
277
277
  theme: "dark",
278
278
  inlineCollapsed: n,
@@ -289,10 +289,10 @@ function Qe({ menuItems: e, selectedKeys: t, inlineCollapsed: n, openKeys: r, on
289
289
  }
290
290
  });
291
291
  }
292
- function $e({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDrawerTitle: r, headerExtras: a, userMenuItems: c, onUserMenuClick: u, loginPath: d = "/login", siderCollapsedStorageKey: p = Ke }) {
293
- let m = g(), _ = h(), { resolved: v } = ke(), y = v === "dark", { logout: S } = Le(), C = q(), [w, E] = l(() => qe(p)), [D, O] = l(!1), k = Je(), { token: A } = z.useToken(), M = r ?? t, te = () => {
292
+ function it({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDrawerTitle: r, headerExtras: a, userMenuItems: c, onUserMenuClick: u, loginPath: d = "/login", siderCollapsedStorageKey: p = Ze }) {
293
+ let m = g(), _ = h(), { resolved: v } = Pe(), y = v === "dark", { logout: S } = He(), C = K(), [w, E] = l(() => Qe(p)), [D, O] = l(!1), k = $e(), { token: A } = z.useToken(), te = r ?? t, ne = () => {
294
294
  S(), m(d, { replace: !0 });
295
- }, N = i((e) => {
295
+ }, M = i((e) => {
296
296
  E(e);
297
297
  try {
298
298
  localStorage.setItem(p, e ? "1" : "0");
@@ -303,25 +303,25 @@ function $e({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
303
303
  }, [k]), o(() => {
304
304
  O(!1);
305
305
  }, [_.pathname]);
306
- let P = s(() => We(e, C), [e, C]), F = s(() => Ye(P), [P]), I = s(() => Ze(P), [P]), L = s(() => Xe(P, _.pathname), [P, _.pathname]), [ne, re] = l(() => Xe(P, _.pathname));
306
+ let N = s(() => Ye(e, C), [e, C]), re = s(() => et(N), [N]), P = s(() => nt(N), [N]), F = s(() => tt(N, _.pathname), [N, _.pathname]), [I, ie] = l(() => tt(N, _.pathname));
307
307
  o(() => {
308
- re((e) => [...new Set([...e, ...L])]);
309
- }, [L]);
310
- let ie = i((e) => {
311
- re(e);
312
- }, []), ae = s(() => [{
308
+ ie((e) => [...new Set([...e, ...F])]);
309
+ }, [F]);
310
+ let ae = i((e) => {
311
+ ie(e);
312
+ }, []), oe = s(() => [{
313
313
  key: "logout",
314
- icon: /* @__PURE__ */ V(ue, {}),
314
+ icon: /* @__PURE__ */ V(pe, {}),
315
315
  label: "Log out",
316
316
  danger: !0
317
- }], []), B = c ?? ae, U = (e) => {
317
+ }], []), L = c ?? oe, B = (e) => {
318
318
  if (u) {
319
319
  u(e);
320
320
  return;
321
321
  }
322
- e.key === "logout" && te();
323
- }, oe = y ? A.colorBgContainer : Ge, se = [_.pathname], W = (e) => {
324
- F.has(e) && (m(e), k && O(!1));
322
+ e.key === "logout" && ne();
323
+ }, U = y ? A.colorBgContainer : Xe, se = [_.pathname], ce = (e) => {
324
+ re.has(e) && (m(e), k && O(!1));
325
325
  };
326
326
  return /* @__PURE__ */ H(j, {
327
327
  style: {
@@ -333,10 +333,10 @@ function $e({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
333
333
  !k && /* @__PURE__ */ H(j.Sider, {
334
334
  collapsible: !0,
335
335
  collapsed: w,
336
- onCollapse: N,
336
+ onCollapse: M,
337
337
  collapsedWidth: 64,
338
338
  style: {
339
- background: oe,
339
+ background: U,
340
340
  borderInlineEnd: y ? `1px solid ${A.colorSplit}` : void 0
341
341
  },
342
342
  children: [/* @__PURE__ */ V("div", {
@@ -352,20 +352,20 @@ function $e({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
352
352
  style: { color: A.colorTextLightSolid },
353
353
  children: w ? n : t
354
354
  })
355
- }), /* @__PURE__ */ V(Qe, {
356
- menuItems: I,
355
+ }), /* @__PURE__ */ V(rt, {
356
+ menuItems: P,
357
357
  selectedKeys: se,
358
358
  inlineCollapsed: w,
359
- openKeys: ne,
360
- onOpenChange: ie,
361
- onNavigate: W
359
+ openKeys: I,
360
+ onOpenChange: ae,
361
+ onNavigate: ce
362
362
  })]
363
363
  }),
364
364
  k && /* @__PURE__ */ V(ee, {
365
365
  title: /* @__PURE__ */ V(R.Text, {
366
366
  strong: !0,
367
367
  style: { color: A.colorTextLightSolid },
368
- children: M
368
+ children: te
369
369
  }),
370
370
  placement: "left",
371
371
  size: 280,
@@ -373,119 +373,125 @@ function $e({ navItems: e, brand: t = "Admin", collapsedBrand: n = "A", mobileDr
373
373
  open: D,
374
374
  styles: {
375
375
  header: {
376
- background: oe,
376
+ background: U,
377
377
  borderBottom: `1px solid ${A.colorSplit}`
378
378
  },
379
379
  body: {
380
380
  padding: 0,
381
- background: oe
381
+ background: U
382
382
  }
383
383
  },
384
384
  destroyOnHidden: !0,
385
- children: /* @__PURE__ */ V(Qe, {
386
- menuItems: I,
385
+ children: /* @__PURE__ */ V(rt, {
386
+ menuItems: P,
387
387
  selectedKeys: se,
388
388
  inlineCollapsed: !1,
389
- openKeys: ne,
390
- onOpenChange: ie,
391
- onNavigate: W
389
+ openKeys: I,
390
+ onOpenChange: ae,
391
+ onNavigate: ce
392
392
  })
393
393
  }),
394
- /* @__PURE__ */ H(j, { children: [/* @__PURE__ */ H(j.Header, {
395
- style: {
396
- background: A.colorBgContainer,
397
- paddingInline: A.paddingLG,
398
- display: "flex",
399
- alignItems: "center",
400
- gap: A.marginSM,
401
- lineHeight: "normal"
402
- },
403
- children: [
404
- k && /* @__PURE__ */ V(x, {
405
- type: "text",
406
- icon: /* @__PURE__ */ V(de, {}),
407
- onClick: () => O(!0),
408
- "aria-label": "Open navigation"
409
- }),
410
- /* @__PURE__ */ V("div", { style: {
411
- flex: 1,
412
- minWidth: 0
413
- } }),
414
- a,
415
- /* @__PURE__ */ V(Pe, {}),
416
- /* @__PURE__ */ V(T, {
417
- menu: {
418
- items: B,
419
- onClick: U
420
- },
421
- trigger: ["click"],
422
- children: /* @__PURE__ */ H(x, {
394
+ /* @__PURE__ */ H(j, {
395
+ style: { minWidth: 0 },
396
+ children: [/* @__PURE__ */ H(j.Header, {
397
+ style: {
398
+ background: A.colorBgContainer,
399
+ paddingInline: A.paddingLG,
400
+ display: "flex",
401
+ alignItems: "center",
402
+ gap: A.marginSM,
403
+ lineHeight: "normal"
404
+ },
405
+ children: [
406
+ k && /* @__PURE__ */ V(x, {
423
407
  type: "text",
424
- style: {
425
- display: "inline-flex",
426
- alignItems: "center",
427
- gap: A.marginXS,
428
- maxWidth: k ? 44 : void 0,
429
- paddingInline: k ? A.paddingXS : void 0
408
+ icon: /* @__PURE__ */ V(me, {}),
409
+ onClick: () => O(!0),
410
+ "aria-label": "Open navigation"
411
+ }),
412
+ /* @__PURE__ */ V("div", { style: {
413
+ flex: 1,
414
+ minWidth: 0
415
+ } }),
416
+ a,
417
+ /* @__PURE__ */ V(ze, {}),
418
+ /* @__PURE__ */ V(T, {
419
+ menu: {
420
+ items: L,
421
+ onClick: B
430
422
  },
431
- "aria-label": "Account menu",
432
- children: [/* @__PURE__ */ V(b, {
433
- size: "small",
434
- icon: /* @__PURE__ */ V(he, {})
435
- }), !k && /* @__PURE__ */ V(R.Text, {
436
- type: "secondary",
437
- children: "User"
438
- })]
423
+ trigger: ["click"],
424
+ children: /* @__PURE__ */ H(x, {
425
+ type: "text",
426
+ style: {
427
+ display: "inline-flex",
428
+ alignItems: "center",
429
+ gap: A.marginXS,
430
+ maxWidth: k ? 44 : void 0,
431
+ paddingInline: k ? A.paddingXS : void 0
432
+ },
433
+ "aria-label": "Account menu",
434
+ children: [/* @__PURE__ */ V(b, {
435
+ size: "small",
436
+ icon: /* @__PURE__ */ V(be, {})
437
+ }), !k && /* @__PURE__ */ V(R.Text, {
438
+ type: "secondary",
439
+ children: "User"
440
+ })]
441
+ })
439
442
  })
440
- })
441
- ]
442
- }), /* @__PURE__ */ V(j.Content, {
443
- style: { margin: k ? A.marginSM : A.marginLG },
444
- children: /* @__PURE__ */ V(f, {})
445
- })] })
443
+ ]
444
+ }), /* @__PURE__ */ V(j.Content, {
445
+ style: {
446
+ margin: k ? A.marginSM : A.marginLG,
447
+ minWidth: 0
448
+ },
449
+ children: /* @__PURE__ */ V(f, {})
450
+ })]
451
+ })
446
452
  ]
447
453
  });
448
454
  }
449
455
  //#endregion
450
456
  //#region src/router/guards.tsx
451
- function et({ when: e, redirect: t, children: n }) {
457
+ function at({ when: e, redirect: t, children: n }) {
452
458
  return e ? n : /* @__PURE__ */ V(d, {
453
459
  to: t,
454
460
  replace: !0
455
461
  });
456
462
  }
457
- function tt({ children: e, redirectTo: t = "/login" }) {
458
- let { isAuthenticated: n } = Le();
459
- return /* @__PURE__ */ V(et, {
463
+ function ot({ children: e, redirectTo: t = "/login" }) {
464
+ let { isAuthenticated: n } = He();
465
+ return /* @__PURE__ */ V(at, {
460
466
  when: n,
461
467
  redirect: t,
462
468
  children: e
463
469
  });
464
470
  }
465
- function nt({ children: e, redirectTo: t = "/" }) {
466
- let { isAuthenticated: n } = Le();
467
- return /* @__PURE__ */ V(et, {
471
+ function st({ children: e, redirectTo: t = "/" }) {
472
+ let { isAuthenticated: n } = He();
473
+ return /* @__PURE__ */ V(at, {
468
474
  when: !n,
469
475
  redirect: t,
470
476
  children: e
471
477
  });
472
478
  }
473
- function rt({ permission: e, redirect: t, children: n }) {
474
- return /* @__PURE__ */ V(et, {
475
- when: q()(e),
479
+ function ct({ permission: e, redirect: t, children: n }) {
480
+ return /* @__PURE__ */ V(at, {
481
+ when: K()(e),
476
482
  redirect: t,
477
483
  children: n
478
484
  });
479
485
  }
480
486
  //#endregion
481
487
  //#region src/router/routeAccess.ts
482
- function it(e) {
488
+ function lt(e) {
483
489
  return e.access ?? "protected";
484
490
  }
485
- function at(e) {
491
+ function ut(e) {
486
492
  let t = [], n = [], r = [];
487
493
  for (let i of e) {
488
- let e = it(i);
494
+ let e = lt(i);
489
495
  e === "guest" ? t.push(i) : e === "public" ? n.push(i) : r.push(i);
490
496
  }
491
497
  return {
@@ -494,24 +500,24 @@ function at(e) {
494
500
  protected: r
495
501
  };
496
502
  }
497
- function ot(e) {
503
+ function dt(e) {
498
504
  return e.replace(/^\/+/, "");
499
505
  }
500
- function st(e) {
501
- return `/${ot(e)}`;
506
+ function ft(e) {
507
+ return `/${dt(e)}`;
502
508
  }
503
- function ct(e, t) {
504
- let { guest: n, protected: r } = at(e), i = n.find((e) => "path" in e && e.path), a = r.find((e) => "index" in e && e.index), o = r.find((e) => "path" in e && e.path), s = t?.unauthenticated;
505
- !s && i && "path" in i && i.path && (s = st(i.path));
509
+ function pt(e, t) {
510
+ let { guest: n, protected: r } = ut(e), i = n.find((e) => "path" in e && e.path), a = r.find((e) => "index" in e && e.index), o = r.find((e) => "path" in e && e.path), s = t?.unauthenticated;
511
+ !s && i && "path" in i && i.path && (s = ft(i.path));
506
512
  let c = t?.afterLogin;
507
- if (c || (a ? c = "/" : o && "path" in o && o.path && (c = st(o.path))), r.length > 0 && !s) throw Error("createAdminRouter: protected routes require redirects.unauthenticated or a guest route (access: \"guest\").");
513
+ if (c || (a ? c = "/" : o && "path" in o && o.path && (c = ft(o.path))), r.length > 0 && !s) throw Error("createAdminRouter: protected routes require redirects.unauthenticated or a guest route (access: \"guest\").");
508
514
  if (n.length > 0 && !c) throw Error("createAdminRouter: guest routes require redirects.afterLogin or a protected route (index or path).");
509
515
  return {
510
516
  loginPath: s ?? "/",
511
517
  homePath: c ?? "/"
512
518
  };
513
519
  }
514
- function lt(e) {
520
+ function mt(e) {
515
521
  return "index" in e && e.index ? {
516
522
  index: !0,
517
523
  element: e.element
@@ -522,30 +528,30 @@ function lt(e) {
522
528
  }
523
529
  //#endregion
524
530
  //#region src/router/createAdminRouter.tsx
525
- function ut({ navItems: e, children: t, layoutProps: n, redirects: r }) {
526
- let { loginPath: i, homePath: a } = ct(t, r), { guest: o, public: s, protected: c } = at(t), l = [];
531
+ function ht({ navItems: e, children: t, layoutProps: n, redirects: r }) {
532
+ let { loginPath: i, homePath: a } = pt(t, r), { guest: o, public: s, protected: c } = ut(t), l = [];
527
533
  for (let e of o) !("path" in e) || !e.path || l.push({
528
- path: ot(e.path),
529
- element: /* @__PURE__ */ V(nt, {
534
+ path: dt(e.path),
535
+ element: /* @__PURE__ */ V(st, {
530
536
  redirectTo: a,
531
537
  children: e.element
532
538
  })
533
539
  });
534
540
  for (let e of s) !("path" in e) || !e.path || l.push({
535
- path: ot(e.path),
541
+ path: dt(e.path),
536
542
  element: e.element
537
543
  });
538
544
  return c.length > 0 && l.push({
539
545
  path: "/",
540
- element: /* @__PURE__ */ V(tt, {
546
+ element: /* @__PURE__ */ V(ot, {
541
547
  redirectTo: i,
542
- children: /* @__PURE__ */ V($e, {
548
+ children: /* @__PURE__ */ V(it, {
543
549
  navItems: e,
544
550
  loginPath: i,
545
551
  ...n
546
552
  })
547
553
  }),
548
- children: c.map(lt)
554
+ children: c.map(mt)
549
555
  }), l.push({
550
556
  path: "*",
551
557
  element: /* @__PURE__ */ V(d, {
@@ -556,8 +562,8 @@ function ut({ navItems: e, children: t, layoutProps: n, redirects: r }) {
556
562
  }
557
563
  //#endregion
558
564
  //#region src/app/AdminApp.tsx
559
- function dt({ navItems: e, routes: t, authRedirects: n, layoutProps: r, theme: i }) {
560
- let a = s(() => ut({
565
+ function gt({ navItems: e, routes: t, authRedirects: n, layoutProps: r, theme: i }) {
566
+ let a = s(() => ht({
561
567
  navItems: e,
562
568
  children: t,
563
569
  layoutProps: r,
@@ -568,67 +574,67 @@ function dt({ navItems: e, routes: t, authRedirects: n, layoutProps: r, theme: i
568
574
  r,
569
575
  n
570
576
  ]);
571
- return /* @__PURE__ */ V(Oe, {
577
+ return /* @__PURE__ */ V(Ne, {
572
578
  ...i,
573
579
  children: /* @__PURE__ */ V(p, { router: a })
574
580
  });
575
581
  }
576
582
  //#endregion
577
583
  //#region src/context/DataProvider.tsx
578
- var ft = t(null);
579
- function pt({ children: e, value: t }) {
584
+ var _t = t(null);
585
+ function vt({ children: e, value: t }) {
580
586
  let n = s(() => t, [t]);
581
- return /* @__PURE__ */ V(ft.Provider, {
587
+ return /* @__PURE__ */ V(_t.Provider, {
582
588
  value: n,
583
589
  children: e
584
590
  });
585
591
  }
586
- function mt() {
587
- let e = a(ft);
592
+ function yt() {
593
+ let e = a(_t);
588
594
  if (!e) throw Error("useDataProvider must be used within DataProvider");
589
595
  return e;
590
596
  }
591
597
  //#endregion
592
598
  //#region src/data/resourceHandlers.ts
593
- function ht(e) {
599
+ function bt(e) {
594
600
  return "handlers" in e ? e : { handlers: e };
595
601
  }
596
- function gt(e, t, n) {
597
- if (!(!e || !t) && !J(e, t, n)) throw Error("Forbidden");
602
+ function J(e, t, n) {
603
+ if (!(!e || !t) && !q(e, t, n)) throw Error("Forbidden");
598
604
  }
599
- function _t(e, t) {
605
+ function xt(e, t) {
600
606
  let { can: n, guard: r, parseFormError: i } = t ?? {}, a = (t) => {
601
607
  let n = e[t];
602
608
  if (!n) throw Error(`Unknown resource: ${t}`);
603
- return ht(n);
609
+ return bt(n);
604
610
  };
605
611
  return {
606
612
  async getList(e, t) {
607
613
  let { handlers: i, permissions: o } = a(e);
608
- return r?.(e, "list"), gt(n, o, "list"), i.getList(t);
614
+ return r?.(e, "list"), J(n, o, "list"), i.getList(t);
609
615
  },
610
616
  async getOne(e, t, i) {
611
617
  let { handlers: o, permissions: s } = a(e);
612
- return r?.(e, "read"), gt(n, s, "read"), o.getOne(t, i);
618
+ return r?.(e, "read"), J(n, s, "read"), o.getOne(t, i);
613
619
  },
614
620
  async create(e, t) {
615
621
  let { handlers: i, permissions: o } = a(e);
616
- return r?.(e, "add"), gt(n, o, "add"), i.create(t);
622
+ return r?.(e, "add"), J(n, o, "add"), i.create(t);
617
623
  },
618
624
  async update(e, t) {
619
625
  let { handlers: i, permissions: o } = a(e);
620
- return r?.(e, "change"), gt(n, o, "change"), i.update(t);
626
+ return r?.(e, "change"), J(n, o, "change"), i.update(t);
621
627
  },
622
628
  async delete(e, t) {
623
629
  let { handlers: i, permissions: o } = a(e);
624
- return r?.(e, "delete"), gt(n, o, "delete"), i.delete(t);
630
+ return r?.(e, "delete"), J(n, o, "delete"), i.delete(t);
625
631
  },
626
632
  parseFormError: i
627
633
  };
628
634
  }
629
635
  //#endregion
630
636
  //#region src/data/abortError.ts
631
- function vt(e) {
637
+ function St(e) {
632
638
  if (typeof e != "object" || !e) return !1;
633
639
  let t = e;
634
640
  return t.name === "AbortError" || t.name === "CanceledError" || t.code === "ERR_CANCELED";
@@ -643,72 +649,104 @@ function Y(e) {
643
649
  }
644
650
  return [];
645
651
  }
646
- function yt(e) {
652
+ function Ct(e) {
647
653
  return e.length === 1 ? e[0] : e;
648
654
  }
649
- function bt(e) {
655
+ function wt(e) {
656
+ return typeof e == "object" && !!e && !Array.isArray(e);
657
+ }
658
+ function Tt(e) {
659
+ return typeof Response < "u" && e instanceof Response ? !0 : typeof e == "object" && !!e && typeof e.json == "function" && typeof e.status == "number" && e.headers != null;
660
+ }
661
+ function Et(e) {
650
662
  if (!e || typeof e != "object") return null;
651
663
  let t = e;
652
- if (t.body && typeof t.body == "object" && !Array.isArray(t.body)) return t.body;
664
+ if (wt(t.body)) return t.body;
665
+ if (wt(t.data)) return t.data;
653
666
  let n = t.response;
654
667
  if (n && typeof n == "object" && !Array.isArray(n)) {
655
668
  let e = n.data;
656
- if (e && typeof e == "object" && !Array.isArray(e)) return e;
669
+ if (wt(e)) return e;
657
670
  }
658
671
  return null;
659
672
  }
660
- function xt(e, t) {
661
- if (t.inlineArrayName == null || t.rowIndex == null) return e;
662
- let n = `${t.inlineArrayName}.${t.rowIndex}.`, r = {};
663
- for (let [t, i] of Object.entries(e)) r[n + t] = i;
664
- return r;
673
+ async function Dt(e) {
674
+ let t = Et(e);
675
+ if (t) return t;
676
+ if (!e || typeof e != "object") return null;
677
+ let n = e.response;
678
+ if (!Tt(n)) return null;
679
+ let r = n.headers.get("content-type");
680
+ if (!r || !/application\/json/i.test(r)) return null;
681
+ try {
682
+ let e = await n.clone().json();
683
+ return wt(e) ? e : null;
684
+ } catch {
685
+ return null;
686
+ }
687
+ }
688
+ function Ot(e) {
689
+ return Array.isArray(e) ? e.some((e) => e && typeof e == "object" && !Array.isArray(e) && Object.values(e).some((e) => Y(e).length > 0)) : !1;
665
690
  }
666
- function St(e, t, n) {
667
- let r = xt(e, n);
691
+ function kt(e, t, n) {
692
+ t.forEach((t, r) => {
693
+ if (!(!t || typeof t != "object" || Array.isArray(t))) for (let [i, a] of Object.entries(t)) {
694
+ let t = Y(a);
695
+ t.length && (n[`${e}.${r}.${i}`] = Ct(t));
696
+ }
697
+ });
698
+ }
699
+ function At(e, t) {
668
700
  return {
669
- fields: Object.keys(r).length ? r : void 0,
701
+ fields: Object.keys(e).length ? e : void 0,
670
702
  global: t.length ? t : void 0
671
703
  };
672
704
  }
673
- var Ct = new Set(["non_field_errors", "detail"]);
674
- function wt(e, t) {
675
- let n = bt(e);
676
- if (!n) return null;
677
- let r = {}, i = [];
678
- for (let [e, t] of Object.entries(n)) {
679
- if (Ct.has(e)) {
680
- i.push(...Y(t));
705
+ var jt = new Set(["non_field_errors", "detail"]);
706
+ function Mt(e) {
707
+ let t = {}, n = [];
708
+ for (let [r, i] of Object.entries(e)) {
709
+ if (jt.has(r)) {
710
+ n.push(...Y(i));
681
711
  continue;
682
712
  }
683
- let n = Y(t);
684
- n.length && (r[e] = yt(n));
713
+ if (Ot(i)) {
714
+ kt(r, i, t);
715
+ continue;
716
+ }
717
+ let e = Y(i);
718
+ e.length && (t[r] = Ct(e));
685
719
  }
686
- return !Object.keys(r).length && !i.length ? null : St(r, i, t);
720
+ return !Object.keys(t).length && !n.length ? null : At(t, n);
721
+ }
722
+ function Nt(e, t) {
723
+ let n = Et(e);
724
+ return n ? Mt(n) : null;
687
725
  }
688
- function Tt(e, t, n) {
689
- let r = bt(e);
726
+ function Pt(e, t, n) {
727
+ let r = Et(e);
690
728
  if (!r) return null;
691
729
  let i = n?.camelCase ?? !0, a = n?.fieldMap, o = {}, s = [];
692
730
  n?.includeSummary && (s.push(...Y(r.title)), s.push(...Y(r.message)));
693
731
  let c = r.errors;
694
732
  if (c && typeof c == "object" && !Array.isArray(c)) for (let [e, t] of Object.entries(c)) {
695
- let n = a?.[e] ?? (i ? Ot(e) : e), r = Y(t);
696
- r.length && (o[n] = yt(r));
733
+ let n = a?.[e] ?? (i ? Lt(e) : e), r = Y(t);
734
+ r.length && (o[n] = Ct(r));
697
735
  }
698
- return !Object.keys(o).length && !s.length ? null : St(o, s, t);
736
+ return !Object.keys(o).length && !s.length ? null : At(o, s);
699
737
  }
700
- function Et(e, t, n) {
701
- let r = bt(e);
738
+ function Ft(e, t, n) {
739
+ let r = Et(e);
702
740
  if (!r) return null;
703
741
  let i = {}, a = [], o = n?.fieldMap, s = r.errors;
704
742
  if (Array.isArray(s)) for (let e of s) {
705
743
  if (!e || typeof e != "object") continue;
706
744
  let t = e, n = typeof t.path == "string" && t.path || typeof t.param == "string" && t.param || typeof t.field == "string" && t.field, r = Y(t.msg)[0] ?? Y(t.message)[0];
707
- r && (n ? Dt(i, o?.[n] ?? n, r) : a.push(r));
745
+ r && (n ? It(i, o?.[n] ?? n, r) : a.push(r));
708
746
  }
709
747
  else if (s && typeof s == "object") for (let [e, t] of Object.entries(s)) {
710
748
  let n = o?.[e] ?? e, r = Y(t);
711
- r.length && (i[n] = yt(r));
749
+ r.length && (i[n] = Ct(r));
712
750
  }
713
751
  let c = r.details;
714
752
  if (Array.isArray(c)) for (let e of c) {
@@ -719,9 +757,9 @@ function Et(e, t, n) {
719
757
  i[e] = r;
720
758
  } else a.push(r);
721
759
  }
722
- return a.push(...Y(r.error)), !Object.keys(i).length && !a.length ? null : St(i, a, t);
760
+ return a.push(...Y(r.error)), !Object.keys(i).length && !a.length ? null : At(i, a);
723
761
  }
724
- function Dt(e, t, n) {
762
+ function It(e, t, n) {
725
763
  let r = e[t];
726
764
  if (!r) {
727
765
  e[t] = n;
@@ -729,20 +767,20 @@ function Dt(e, t, n) {
729
767
  }
730
768
  e[t] = Array.isArray(r) ? [...r, n] : [r, n];
731
769
  }
732
- function Ot(e) {
770
+ function Lt(e) {
733
771
  return e && e.charAt(0).toLowerCase() + e.slice(1);
734
772
  }
735
773
  //#endregion
736
774
  //#region src/data/inMemoryList.ts
737
- function kt(e, t) {
775
+ function Rt(e, t) {
738
776
  return e === t || String(e) === String(t);
739
777
  }
740
- function At(e, t) {
741
- let n = e.find((e) => kt(e.id, t));
778
+ function zt(e, t) {
779
+ let n = e.find((e) => Rt(e.id, t));
742
780
  if (!n) throw Error("Not found");
743
781
  return n;
744
782
  }
745
- function jt(e, t) {
783
+ function Bt(e, t) {
746
784
  if (t.length === 0) return e;
747
785
  let n = (e) => e === "DESC" ? -1 : 1;
748
786
  return [...e].sort((e, r) => {
@@ -758,33 +796,33 @@ function jt(e, t) {
758
796
  return 0;
759
797
  });
760
798
  }
761
- function Mt(e, t) {
799
+ function Vt(e, t) {
762
800
  return t == null || t === "" ? !0 : Array.isArray(t) ? t.length === 0 ? !0 : Array.isArray(e) ? t.some((t) => e.includes(t)) : t.includes(e) : Array.isArray(e) ? e.includes(t) : typeof t == "string" && typeof e == "string" ? e.toLowerCase().includes(t.toLowerCase()) : e === t;
763
801
  }
764
- function Nt(e, t) {
765
- return t ? e.filter((e) => Object.entries(t).every(([t, n]) => Mt(e[t], n))) : e;
802
+ function Ht(e, t) {
803
+ return t ? e.filter((e) => Object.entries(t).every(([t, n]) => Vt(e[t], n))) : e;
766
804
  }
767
- function Pt(e, t, n) {
805
+ function Ut(e, t, n) {
768
806
  let r = (t - 1) * n;
769
807
  return {
770
808
  data: e.slice(r, r + n),
771
809
  total: e.length
772
810
  };
773
811
  }
774
- function Ft(e, t) {
775
- let { pagination: n, sort: r, filter: i } = t, a = Nt(e, i);
812
+ function Wt(e, t) {
813
+ let { pagination: n, sort: r, filter: i } = t, a = Ht(e, i);
776
814
  if (r) {
777
815
  let e = Array.isArray(r) ? r : [r];
778
- e.length > 0 && e[0]?.field && (a = jt(a, e));
816
+ e.length > 0 && e[0]?.field && (a = Bt(a, e));
779
817
  }
780
- return n ? Pt(a, n.page, n.perPage) : {
818
+ return n ? Ut(a, n.page, n.perPage) : {
781
819
  data: a,
782
820
  total: a.length
783
821
  };
784
822
  }
785
823
  //#endregion
786
824
  //#region src/data/createMemoryResourceHandlers.ts
787
- function It(e) {
825
+ function Gt(e) {
788
826
  let t = (e) => e, n = e.mapCreate ?? ((e, t) => ({
789
827
  ...e,
790
828
  id: t
@@ -795,21 +833,21 @@ function It(e) {
795
833
  }));
796
834
  return {
797
835
  async getList(n) {
798
- return Ft(t(e.scopeList ? e.scopeList(e.getRows(), n) : e.getRows()), n);
836
+ return Wt(t(e.scopeList ? e.scopeList(e.getRows(), n) : e.getRows()), n);
799
837
  },
800
838
  async getOne(t, n) {
801
- return { data: At(e.getRows(), t) };
839
+ return { data: zt(e.getRows(), t) };
802
840
  },
803
841
  async create(t) {
804
842
  let r = n(t, e.nextId());
805
843
  return e.getRows().push(r), { data: r };
806
844
  },
807
845
  async update({ id: t, data: n }) {
808
- let i = At(e.getRows(), t), a = r(i, n);
846
+ let i = zt(e.getRows(), t), a = r(i, n);
809
847
  return Object.assign(i, a), { data: i };
810
848
  },
811
849
  async delete(t) {
812
- let n = e.getRows(), r = n.findIndex((e) => kt(e.id, t));
850
+ let n = e.getRows(), r = n.findIndex((e) => Rt(e.id, t));
813
851
  if (r < 0) return { data: null };
814
852
  let [i] = n.splice(r, 1);
815
853
  return e.afterDelete?.(i), { data: i };
@@ -818,7 +856,7 @@ function It(e) {
818
856
  }
819
857
  //#endregion
820
858
  //#region src/data/createRestResourceHandlers.ts
821
- function Lt(e) {
859
+ function Kt(e) {
822
860
  return {
823
861
  async getList(t) {
824
862
  return e.list(t);
@@ -827,11 +865,11 @@ function Lt(e) {
827
865
  return { data: await e.retrieve(t, n) };
828
866
  },
829
867
  async create(t) {
830
- let n = e.transformCreate ? e.transformCreate(t) : t;
868
+ let n = t instanceof FormData ? t : e.transformCreate ? e.transformCreate(t) : t;
831
869
  return { data: await e.create(n) };
832
870
  },
833
871
  async update({ id: t, data: n }) {
834
- let r = e.transformUpdate ? e.transformUpdate(n) : n;
872
+ let r = n instanceof FormData ? n : e.transformUpdate ? e.transformUpdate(n) : n;
835
873
  return { data: await e.update(t, r) };
836
874
  },
837
875
  async delete(t) {
@@ -841,24 +879,24 @@ function Lt(e) {
841
879
  }
842
880
  //#endregion
843
881
  //#region src/data/sortHelpers.ts
844
- function Rt(e) {
882
+ function qt(e) {
845
883
  return e ? Array.isArray(e) ? e : [e] : [];
846
884
  }
847
- function zt(e) {
848
- let t = Rt(e);
885
+ function Jt(e) {
886
+ let t = qt(e);
849
887
  if (t.length !== 0) return t.map((e) => e.order === "DESC" ? `-${e.field}` : e.field).join(",");
850
888
  }
851
- function Bt(e) {
852
- let t = Rt(e);
889
+ function Yt(e) {
890
+ let t = qt(e);
853
891
  if (t.length !== 0) return t.map((e) => `${e.field} ${e.order === "DESC" ? "desc" : "asc"}`).join(",");
854
892
  }
855
- function Vt(e) {
856
- let t = Rt(e);
893
+ function Xt(e) {
894
+ let t = qt(e);
857
895
  if (t.length !== 0) return t.map((e) => e.order === "DESC" ? `-${e.field}` : e.field).join(",");
858
896
  }
859
897
  //#endregion
860
898
  //#region src/components/AuthAlternateLink.tsx
861
- function Ht({ prompt: e, linkText: t, to: n }) {
899
+ function Zt({ prompt: e, linkText: t, to: n }) {
862
900
  return /* @__PURE__ */ H(R.Paragraph, {
863
901
  type: "secondary",
864
902
  style: {
@@ -877,7 +915,7 @@ function Ht({ prompt: e, linkText: t, to: n }) {
877
915
  }
878
916
  //#endregion
879
917
  //#region src/layouts/AuthPageLayout.tsx
880
- function Ut({ children: e, brand: t, footer: n, showThemeToolbar: r = !0 }) {
918
+ function Qt({ children: e, brand: t, footer: n, showThemeToolbar: r = !0 }) {
881
919
  let { token: i } = z.useToken();
882
920
  return /* @__PURE__ */ H(E, {
883
921
  vertical: !0,
@@ -898,7 +936,7 @@ function Ut({ children: e, brand: t, footer: n, showThemeToolbar: r = !0 }) {
898
936
  padding: 16,
899
937
  background: i.colorBgLayout
900
938
  },
901
- children: /* @__PURE__ */ V(Pe, {})
939
+ children: /* @__PURE__ */ V(ze, {})
902
940
  }) : null,
903
941
  t ? /* @__PURE__ */ V("div", {
904
942
  style: {
@@ -935,11 +973,11 @@ function Ut({ children: e, brand: t, footer: n, showThemeToolbar: r = !0 }) {
935
973
  }
936
974
  //#endregion
937
975
  //#region src/pages/LoginPage.tsx
938
- function Wt({ title: e = "Sign in", description: t = "Use any username and password to continue.", logo: n, brand: r, extraFields: i, showThemeToolbar: a = !0, afterLoginPath: o = "/", alternateAuth: s, footer: c }) {
939
- let { login: l } = Le(), u = g();
940
- return /* @__PURE__ */ V(Ut, {
976
+ function $t({ title: e = "Sign in", description: t = "Use any username and password to continue.", logo: n, brand: r, extraFields: i, showThemeToolbar: a = !0, afterLoginPath: o = "/", alternateAuth: s, footer: c }) {
977
+ let { login: l } = He(), u = g();
978
+ return /* @__PURE__ */ V(Qt, {
941
979
  brand: r ?? n,
942
- footer: c ?? (s ? /* @__PURE__ */ V(Ht, {
980
+ footer: c ?? (s ? /* @__PURE__ */ V(Zt, {
943
981
  prompt: s.prompt ?? "Don't have an account?",
944
982
  linkText: s.linkText,
945
983
  to: s.to
@@ -972,7 +1010,7 @@ function Wt({ title: e = "Sign in", description: t = "Use any username and passw
972
1010
  required: !0,
973
1011
  message: "Required"
974
1012
  }],
975
- children: /* @__PURE__ */ V(k, { autoComplete: "username" })
1013
+ children: /* @__PURE__ */ V(A, { autoComplete: "username" })
976
1014
  }),
977
1015
  /* @__PURE__ */ V(D.Item, {
978
1016
  name: "password",
@@ -981,7 +1019,7 @@ function Wt({ title: e = "Sign in", description: t = "Use any username and passw
981
1019
  required: !0,
982
1020
  message: "Required"
983
1021
  }],
984
- children: /* @__PURE__ */ V(k.Password, { autoComplete: "current-password" })
1022
+ children: /* @__PURE__ */ V(A.Password, { autoComplete: "current-password" })
985
1023
  }),
986
1024
  i,
987
1025
  /* @__PURE__ */ V(D.Item, {
@@ -1000,7 +1038,7 @@ function Wt({ title: e = "Sign in", description: t = "Use any username and passw
1000
1038
  }
1001
1039
  //#endregion
1002
1040
  //#region src/pages/PlaceholderPage.tsx
1003
- function Gt({ title: e }) {
1041
+ function en({ title: e }) {
1004
1042
  return /* @__PURE__ */ V(R.Title, {
1005
1043
  level: 3,
1006
1044
  style: { marginTop: 0 },
@@ -1009,7 +1047,7 @@ function Gt({ title: e }) {
1009
1047
  }
1010
1048
  //#endregion
1011
1049
  //#region src/crud/utils/sortQueryParam.ts
1012
- function Kt(e) {
1050
+ function tn(e) {
1013
1051
  if (!e) return [];
1014
1052
  let t = [];
1015
1053
  for (let n of e.split(",").map((e) => e.trim()).filter(Boolean)) {
@@ -1033,17 +1071,17 @@ function Kt(e) {
1033
1071
  }
1034
1072
  return t;
1035
1073
  }
1036
- function qt(e) {
1074
+ function nn(e) {
1037
1075
  return e.length === 0 ? null : e.map((e) => e.order === "DESC" ? `-${e.field}` : e.field).join(",");
1038
1076
  }
1039
- function Jt(e) {
1077
+ function rn(e) {
1040
1078
  return new Map(e.map((e, t) => [e.field, t + 1]));
1041
1079
  }
1042
1080
  //#endregion
1043
1081
  //#region src/crud/context/ListContext.tsx
1044
- var Yt = t(null);
1045
- function Xt({ children: e, toggleSort: t, sort: n }) {
1046
- let [r, a] = l([]), o = s(() => new Set(n.map((e) => e.field)), [n]), c = s(() => new Map(n.map((e) => [e.field, e.order])), [n]), u = s(() => Jt(n), [n]), d = i((e) => (a((t) => {
1082
+ var an = t(null);
1083
+ function on({ children: e, toggleSort: t, sort: n }) {
1084
+ let [r, a] = l([]), o = s(() => new Set(n.map((e) => e.field)), [n]), c = s(() => new Map(n.map((e) => [e.field, e.order])), [n]), u = s(() => rn(n), [n]), d = i((e) => (a((t) => {
1047
1085
  let n = t.findIndex((t) => t.key === e.key);
1048
1086
  if (n < 0) return [...t, e];
1049
1087
  if (t[n] === e) return t;
@@ -1066,24 +1104,24 @@ function Xt({ children: e, toggleSort: t, sort: n }) {
1066
1104
  u,
1067
1105
  d
1068
1106
  ]);
1069
- return /* @__PURE__ */ V(Yt.Provider, {
1107
+ return /* @__PURE__ */ V(an.Provider, {
1070
1108
  value: f,
1071
1109
  children: e
1072
1110
  });
1073
1111
  }
1074
- function Zt() {
1075
- let e = a(Yt);
1112
+ function sn() {
1113
+ let e = a(an);
1076
1114
  if (!e) throw Error("Column components must be used within ResourceList");
1077
1115
  return e;
1078
1116
  }
1079
1117
  function X(e) {
1080
- let { registerColumn: t } = Zt();
1118
+ let { registerColumn: t } = sn();
1081
1119
  o(() => t(e), [t, e]);
1082
1120
  }
1083
1121
  //#endregion
1084
1122
  //#region src/crud/context/FilterContext.tsx
1085
- var Qt = t(null);
1086
- function $t({ children: e, values: t, setFilterValue: n }) {
1123
+ var cn = t(null);
1124
+ function ln({ children: e, values: t, setFilterValue: n }) {
1087
1125
  let [r, a] = l([]), o = i((e) => (a((t) => {
1088
1126
  let n = t.findIndex((t) => t.key === e.key);
1089
1127
  if (n < 0) return [...t, e];
@@ -1103,25 +1141,25 @@ function $t({ children: e, values: t, setFilterValue: n }) {
1103
1141
  n,
1104
1142
  o
1105
1143
  ]);
1106
- return /* @__PURE__ */ V(Qt.Provider, {
1144
+ return /* @__PURE__ */ V(cn.Provider, {
1107
1145
  value: c,
1108
1146
  children: e
1109
1147
  });
1110
1148
  }
1111
- function en() {
1112
- return a(Qt);
1149
+ function un() {
1150
+ return a(cn);
1113
1151
  }
1114
1152
  function Z(e) {
1115
- let t = en()?.registerFilter;
1153
+ let t = un()?.registerFilter;
1116
1154
  o(() => {
1117
1155
  if (t) return t(e);
1118
1156
  }, [t, e]);
1119
1157
  }
1120
1158
  //#endregion
1121
1159
  //#region src/crud/context/FormContext.tsx
1122
- var tn = t(null);
1123
- function nn({ children: e, resource: t, isNew: n, disabled: r }) {
1124
- return /* @__PURE__ */ V(tn.Provider, {
1160
+ var dn = t(null);
1161
+ function fn({ children: e, resource: t, isNew: n, disabled: r }) {
1162
+ return /* @__PURE__ */ V(dn.Provider, {
1125
1163
  value: {
1126
1164
  resource: t,
1127
1165
  isNew: n,
@@ -1130,35 +1168,35 @@ function nn({ children: e, resource: t, isNew: n, disabled: r }) {
1130
1168
  children: e
1131
1169
  });
1132
1170
  }
1133
- function rn() {
1134
- return a(tn);
1171
+ function pn() {
1172
+ return a(dn);
1135
1173
  }
1136
1174
  //#endregion
1137
1175
  //#region src/crud/context/FormSectionContext.tsx
1138
- var an = t(null);
1139
- function on({ sourcesRef: e, children: t }) {
1140
- return /* @__PURE__ */ V(an.Provider, {
1176
+ var mn = t(null);
1177
+ function hn({ sourcesRef: e, children: t }) {
1178
+ return /* @__PURE__ */ V(mn.Provider, {
1141
1179
  value: e,
1142
1180
  children: t
1143
1181
  });
1144
1182
  }
1145
- function sn() {
1146
- return a(an);
1183
+ function gn() {
1184
+ return a(mn);
1147
1185
  }
1148
1186
  //#endregion
1149
- //#region src/crud/context/SubmitFieldsContext.tsx
1150
- var cn = t(null);
1151
- function ln({ children: e, fieldsRef: t }) {
1152
- return /* @__PURE__ */ V(cn.Provider, {
1187
+ //#region src/crud/context/PayloadFieldsContext.tsx
1188
+ var _n = t(null);
1189
+ function vn({ children: e, fieldsRef: t }) {
1190
+ return /* @__PURE__ */ V(_n.Provider, {
1153
1191
  value: t,
1154
1192
  children: e
1155
1193
  });
1156
1194
  }
1157
- function un() {
1158
- return a(cn);
1195
+ function yn() {
1196
+ return a(_n);
1159
1197
  }
1160
- function dn(e, t = !0) {
1161
- let n = un();
1198
+ function bn(e, t = !0) {
1199
+ let n = yn();
1162
1200
  o(() => {
1163
1201
  if (!(!t || !n)) return n.current.add(e), () => {
1164
1202
  n.current.delete(e);
@@ -1169,8 +1207,8 @@ function dn(e, t = !0) {
1169
1207
  t
1170
1208
  ]);
1171
1209
  }
1172
- function fn(e, t = !0) {
1173
- let n = sn();
1210
+ function xn(e, t = !0) {
1211
+ let n = gn();
1174
1212
  o(() => {
1175
1213
  if (!(!t || !n)) return n.current.add(e), () => {
1176
1214
  n.current.delete(e);
@@ -1182,8 +1220,8 @@ function fn(e, t = !0) {
1182
1220
  ]);
1183
1221
  }
1184
1222
  //#endregion
1185
- //#region src/crud/utils/getByPath.ts
1186
- function pn(e, t) {
1223
+ //#region src/crud/utils/getFormValue.ts
1224
+ function Sn(e, t) {
1187
1225
  let n = t.split("."), r = e;
1188
1226
  for (let e of n) {
1189
1227
  if (typeof r != "object" || !r) return;
@@ -1192,8 +1230,8 @@ function pn(e, t) {
1192
1230
  return r;
1193
1231
  }
1194
1232
  //#endregion
1195
- //#region src/crud/utils/setByPath.ts
1196
- function mn(e, t, n) {
1233
+ //#region src/crud/utils/setFormValue.ts
1234
+ function Cn(e, t, n) {
1197
1235
  let r = t.split("."), i = e;
1198
1236
  for (let e = 0; e < r.length - 1; e++) {
1199
1237
  let t = r[e], n = i[t];
@@ -1202,23 +1240,101 @@ function mn(e, t, n) {
1202
1240
  i[r[r.length - 1]] = n;
1203
1241
  }
1204
1242
  //#endregion
1205
- //#region src/crud/utils/pickBySources.ts
1206
- function hn(e, t) {
1243
+ //#region src/crud/utils/buildFormPayload.ts
1244
+ function wn(e, t) {
1207
1245
  if (t.length === 0) return { ...e };
1208
1246
  let n = {};
1209
1247
  for (let r of t) {
1210
- let t = pn(e, r);
1211
- t !== void 0 && mn(n, r, t);
1248
+ let t = Sn(e, r);
1249
+ t !== void 0 && Cn(n, r, t);
1212
1250
  }
1213
1251
  return n;
1214
1252
  }
1215
1253
  //#endregion
1254
+ //#region src/crud/utils/buildInlineRowsPayload.ts
1255
+ function Tn(e, t, n) {
1256
+ if (!Array.isArray(e)) return [];
1257
+ let r = e.map((e) => {
1258
+ if (!e || typeof e != "object") return {};
1259
+ let n = e, r = {};
1260
+ for (let e of t) {
1261
+ let t = n[e];
1262
+ t !== void 0 && (r[e] = t);
1263
+ }
1264
+ let i = n.id;
1265
+ return i != null && (r.id = i), r;
1266
+ });
1267
+ return n?.transformRows ? n.transformRows(r) : r;
1268
+ }
1269
+ //#endregion
1270
+ //#region src/crud/utils/hasUploadValues.ts
1271
+ function En(e) {
1272
+ return e instanceof Blob ? !0 : Array.isArray(e) ? e.some(En) : e && typeof e == "object" ? Object.values(e).some(En) : !1;
1273
+ }
1274
+ //#endregion
1275
+ //#region src/crud/utils/toFormData.ts
1276
+ function Dn(e) {
1277
+ return /^https?:\/\//i.test(e);
1278
+ }
1279
+ function On(e, t, n, r) {
1280
+ if (n !== void 0) {
1281
+ if (n === null) {
1282
+ e.append(t, "");
1283
+ return;
1284
+ }
1285
+ if (n instanceof Blob) {
1286
+ e.append(t, n);
1287
+ return;
1288
+ }
1289
+ if (typeof n == "boolean" || typeof n == "number") {
1290
+ e.append(t, String(n));
1291
+ return;
1292
+ }
1293
+ if (typeof n == "string") {
1294
+ if (r.skipExistingUploadUrls && Dn(n)) return;
1295
+ e.append(t, n);
1296
+ return;
1297
+ }
1298
+ if (Array.isArray(n)) {
1299
+ n.forEach((n, i) => {
1300
+ On(e, `${t}[${i}]`, n, r);
1301
+ });
1302
+ return;
1303
+ }
1304
+ if (typeof n == "object") {
1305
+ for (let [i, a] of Object.entries(n)) On(e, `${t}[${i}]`, a, r);
1306
+ return;
1307
+ }
1308
+ e.append(t, String(n));
1309
+ }
1310
+ }
1311
+ function kn(e, t) {
1312
+ let n = { skipExistingUploadUrls: t?.skipExistingUploadUrls ?? !0 }, r = new FormData();
1313
+ for (let [t, i] of Object.entries(e)) On(r, t, i, n);
1314
+ return r;
1315
+ }
1316
+ //#endregion
1317
+ //#region src/crud/utils/prepareFormSubmitBody.ts
1318
+ function An(e, t) {
1319
+ return En(e) ? kn(e, t) : e;
1320
+ }
1321
+ //#endregion
1322
+ //#region src/crud/utils/buildResourceFormSubmitBody.ts
1323
+ function jn(e, t, n, r) {
1324
+ let i = wn(e, t);
1325
+ if (n) for (let t of n) {
1326
+ let n = e[t.field], r = t.payloadKey ?? t.field;
1327
+ i[r] = Tn(n, t.sources, { transformRows: t.transformRows });
1328
+ }
1329
+ return An(i, r);
1330
+ }
1331
+ //#endregion
1216
1332
  //#region src/crud/utils/formErrors.ts
1217
- function gn(e) {
1333
+ function Mn(e) {
1218
1334
  return e ? Array.isArray(e) ? e : [e] : [];
1219
1335
  }
1220
- function _n(e, t, n) {
1221
- for (let e of gn(t.global)) n.error(e);
1336
+ function Nn(e, t, n) {
1337
+ for (let e of Mn(t.global)) n.error(e);
1222
1338
  for (let [n, r] of Object.entries(t.fields ?? {})) {
1223
1339
  let t = Array.isArray(r) ? r.join(", ") : r;
1224
1340
  e.setError(n, {
@@ -1227,15 +1343,15 @@ function _n(e, t, n) {
1227
1343
  });
1228
1344
  }
1229
1345
  }
1230
- function vn(e, t, n, r, i) {
1231
- let a = e.parseFormError?.(r, i);
1232
- if (!a) return !1;
1233
- let o = Object.keys(a.fields ?? {}).length > 0, s = gn(a.global).length > 0;
1234
- return !o && !s ? !1 : (_n(t, a, n), !0);
1346
+ async function Pn(e, t, n, r, i) {
1347
+ let a = await Dt(r), o = a == null ? r : { body: a }, s = e.parseFormError?.(o, i);
1348
+ if (!s) return !1;
1349
+ let c = Object.keys(s.fields ?? {}).length > 0, l = Mn(s.global).length > 0;
1350
+ return !c && !l ? !1 : (Nn(t, s, n), !0);
1235
1351
  }
1236
1352
  //#endregion
1237
1353
  //#region src/crud/utils/useAbortableEffect.ts
1238
- function yn(e, t) {
1354
+ function Fn(e, t) {
1239
1355
  o(() => {
1240
1356
  let t = new AbortController();
1241
1357
  return e(t.signal), () => t.abort();
@@ -1243,8 +1359,8 @@ function yn(e, t) {
1243
1359
  }
1244
1360
  //#endregion
1245
1361
  //#region src/crud/ResourceFormModal.tsx
1246
- function bn({ resource: e, editId: t, onClose: n, children: r, title: a }) {
1247
- let o = t === "new" || t == null, s = t != null, u = mt(), { message: d } = y.useApp(), [f, p] = l(!o), m = ye(), h = c(/* @__PURE__ */ new Set()), g = i(async (n) => {
1362
+ function In({ resource: e, editId: t, onClose: n, children: r, title: a }) {
1363
+ let o = t === "new" || t == null, s = t != null, u = yt(), { message: d } = y.useApp(), [f, p] = l(!o), m = Ce(), h = c(/* @__PURE__ */ new Set()), g = i(async (n) => {
1248
1364
  if (o || !t) {
1249
1365
  m.reset({}), p(!1);
1250
1366
  return;
@@ -1255,7 +1371,7 @@ function bn({ resource: e, editId: t, onClose: n, children: r, title: a }) {
1255
1371
  if (n?.aborted) return;
1256
1372
  m.reset(r.data);
1257
1373
  } catch (e) {
1258
- vt(e) || d.error(e instanceof Error ? e.message : "Load failed");
1374
+ St(e) || d.error(e instanceof Error ? e.message : "Load failed");
1259
1375
  } finally {
1260
1376
  n?.aborted || p(!1);
1261
1377
  }
@@ -1267,36 +1383,36 @@ function bn({ resource: e, editId: t, onClose: n, children: r, title: a }) {
1267
1383
  m,
1268
1384
  d
1269
1385
  ]);
1270
- yn((e) => {
1386
+ Fn((e) => {
1271
1387
  if (s) return g(e);
1272
1388
  }, [s, g]);
1273
1389
  async function _(r) {
1274
1390
  try {
1275
- let i = hn(r, Array.from(h.current));
1391
+ let i = jn(r, Array.from(h.current));
1276
1392
  o ? (await u.create(e, i), d.success("Created")) : t && (await u.update(e, {
1277
1393
  id: t,
1278
1394
  data: i
1279
1395
  }), d.success("Updated")), n();
1280
1396
  } catch (t) {
1281
- vn(u, m, d, t, {
1397
+ await Pn(u, m, d, t, {
1282
1398
  resource: e,
1283
1399
  mutation: o ? "create" : "update"
1284
1400
  }) || d.error(t instanceof Error ? t.message : "Save failed");
1285
1401
  }
1286
1402
  }
1287
- return /* @__PURE__ */ V(te, {
1403
+ return /* @__PURE__ */ V(M, {
1288
1404
  open: s,
1289
1405
  title: a ?? (o ? `New ${e}` : `Edit ${e}`),
1290
1406
  onCancel: n,
1291
1407
  footer: null,
1292
1408
  destroyOnHidden: !0,
1293
1409
  width: 560,
1294
- children: f ? /* @__PURE__ */ V(L, {}) : /* @__PURE__ */ V(nn, {
1410
+ children: f ? /* @__PURE__ */ V(I, {}) : /* @__PURE__ */ V(fn, {
1295
1411
  resource: e,
1296
1412
  isNew: o,
1297
- children: /* @__PURE__ */ V(ln, {
1413
+ children: /* @__PURE__ */ V(vn, {
1298
1414
  fieldsRef: h,
1299
- children: /* @__PURE__ */ V(_e, {
1415
+ children: /* @__PURE__ */ V(W, {
1300
1416
  ...m,
1301
1417
  children: /* @__PURE__ */ H(D, {
1302
1418
  layout: "vertical",
@@ -1324,7 +1440,7 @@ function bn({ resource: e, editId: t, onClose: n, children: r, title: a }) {
1324
1440
  }
1325
1441
  //#endregion
1326
1442
  //#region src/crud/ListActionsBar.tsx
1327
- function xn({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelected: r, onSelectAllMatching: a, onClearSelection: o, actions: c, onExecute: u, selectedIds: d, running: f = !1 }) {
1443
+ function Ln({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelected: r, onSelectAllMatching: a, onClearSelection: o, actions: c, onExecute: u, selectedIds: d, running: f = !1 }) {
1328
1444
  let [p, m] = l(), h = s(() => c.map((e) => ({
1329
1445
  value: e.key,
1330
1446
  label: e.label
@@ -1338,7 +1454,7 @@ function xn({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
1338
1454
  e,
1339
1455
  d
1340
1456
  ]), _ = n && !r && t > e;
1341
- return /* @__PURE__ */ H(I, {
1457
+ return /* @__PURE__ */ H(F, {
1342
1458
  wrap: !0,
1343
1459
  style: {
1344
1460
  marginBottom: 16,
@@ -1387,7 +1503,7 @@ function xn({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
1387
1503
  " items selected"
1388
1504
  ]
1389
1505
  })] }) : null,
1390
- /* @__PURE__ */ V(F, {
1506
+ /* @__PURE__ */ V(P, {
1391
1507
  placeholder: "Action",
1392
1508
  style: { minWidth: 200 },
1393
1509
  options: h,
@@ -1408,14 +1524,14 @@ function xn({ selectedCount: e, total: t, allPageSelected: n, allMatchingSelecte
1408
1524
  }
1409
1525
  //#endregion
1410
1526
  //#region src/crud/types.ts
1411
- var Sn = new Set([
1527
+ var Rn = new Set([
1412
1528
  "page",
1413
1529
  "perPage",
1414
1530
  "sort",
1415
1531
  "create",
1416
1532
  "edit"
1417
- ]), Cn = 1, wn = 10;
1418
- function Tn(e) {
1533
+ ]), zn = 1, Bn = 10;
1534
+ function Vn(e) {
1419
1535
  if (e.includes(",")) {
1420
1536
  let t = e.split(",").map((e) => e.trim()), n = t.map(Number);
1421
1537
  return n.every((e) => Number.isFinite(e)) ? n : t;
@@ -1423,16 +1539,16 @@ function Tn(e) {
1423
1539
  let t = Number(e);
1424
1540
  return e !== "" && Number.isFinite(t) && String(t) === e ? t : e === "true" ? !0 : e === "false" ? !1 : e;
1425
1541
  }
1426
- function En(e) {
1542
+ function Hn(e) {
1427
1543
  return e == null || e === "" ? null : Array.isArray(e) ? e.length === 0 ? null : e.map(String).join(",") : String(e);
1428
1544
  }
1429
- function Dn(e) {
1545
+ function Un(e) {
1430
1546
  let [t, n] = v(), r = s(() => {
1431
- let n = t.get("page"), r = t.get("perPage"), i = n ? Math.max(1, Number(n) || Cn) : Cn, a = r ? Math.max(1, Number(r) || wn) : wn, o = t.getAll("sort"), s = o.length > 0 ? o.flatMap((e) => Kt(e)) : Kt(t.get("sort")), c = { ...e };
1547
+ let n = t.get("page"), r = t.get("perPage"), i = n ? Math.max(1, Number(n) || zn) : zn, a = r ? Math.max(1, Number(r) || Bn) : Bn, o = t.getAll("sort"), s = o.length > 0 ? o.flatMap((e) => tn(e)) : tn(t.get("sort")), c = { ...e };
1432
1548
  return t.forEach((e, n) => {
1433
- if (Sn.has(n)) return;
1549
+ if (Rn.has(n)) return;
1434
1550
  let r = c[n];
1435
- r === void 0 ? t.getAll(n).length > 1 ? c[n] = t.getAll(n).map(Tn) : c[n] = Tn(e) : c[n] = [...Array.isArray(r) ? r : [r], Tn(e)];
1551
+ r === void 0 ? t.getAll(n).length > 1 ? c[n] = t.getAll(n).map(Vn) : c[n] = Vn(e) : c[n] = [...Array.isArray(r) ? r : [r], Vn(e)];
1436
1552
  }), {
1437
1553
  page: i,
1438
1554
  perPage: a,
@@ -1455,19 +1571,19 @@ function Dn(e) {
1455
1571
  },
1456
1572
  setPerPage: (e) => {
1457
1573
  a((t) => {
1458
- e === wn ? t.delete("perPage") : t.set("perPage", String(e)), t.delete("page");
1574
+ e === Bn ? t.delete("perPage") : t.set("perPage", String(e)), t.delete("page");
1459
1575
  });
1460
1576
  },
1461
1577
  setSort: (e) => {
1462
1578
  a((t) => {
1463
1579
  t.delete("sort");
1464
- let n = qt(e);
1580
+ let n = nn(e);
1465
1581
  n && t.set("sort", n);
1466
1582
  });
1467
1583
  },
1468
1584
  toggleSort: (e) => {
1469
1585
  a((t) => {
1470
- let n = t.getAll("sort").flatMap((e) => Kt(e)), r = n.findIndex((t) => t.field === e), i;
1586
+ let n = t.getAll("sort").flatMap((e) => tn(e)), r = n.findIndex((t) => t.field === e), i;
1471
1587
  i = r < 0 ? [...n, {
1472
1588
  field: e,
1473
1589
  order: "ASC"
@@ -1475,22 +1591,22 @@ function Dn(e) {
1475
1591
  ...e,
1476
1592
  order: "DESC"
1477
1593
  } : e) : n.filter((e, t) => t !== r), t.delete("sort");
1478
- let a = qt(i);
1594
+ let a = nn(i);
1479
1595
  a && t.set("sort", a);
1480
1596
  });
1481
1597
  },
1482
1598
  setFilter: (e, t) => {
1483
1599
  a((n) => {
1484
1600
  n.delete(e);
1485
- let r = En(t);
1601
+ let r = Hn(t);
1486
1602
  r != null && n.set(e, r), n.delete("page");
1487
1603
  });
1488
1604
  },
1489
1605
  setFilters: (e) => {
1490
1606
  a((t) => {
1491
- for (let e of [...t.keys()]) Sn.has(e) || t.delete(e);
1607
+ for (let e of [...t.keys()]) Rn.has(e) || t.delete(e);
1492
1608
  for (let [n, r] of Object.entries(e)) {
1493
- let e = En(r);
1609
+ let e = Hn(r);
1494
1610
  e != null && t.set(n, e);
1495
1611
  }
1496
1612
  t.delete("page");
@@ -1515,17 +1631,17 @@ function Dn(e) {
1515
1631
  }
1516
1632
  //#endregion
1517
1633
  //#region src/crud/ResourceList.tsx
1518
- var On = t(null);
1519
- function kn() {
1520
- return a(On);
1521
- }
1522
- function An({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: a = "page", formChildren: o, actions: c, rowActions: d, headerExtra: f, bulkActions: p, bulkDelete: m = !0, bulkActionsEnabled: h = !0, permissions: g, queryState: _, queryActions: v }) {
1523
- let b = mt(), C = q(), { message: w, modal: ee } = y.useApp(), { columns: T, sortOrders: E, sortPriorities: D } = Zt(), [O, k] = l(!1), [A, j] = l([]), [M, te] = l(0), [N, P] = l(() => /* @__PURE__ */ new Set()), [F, L] = l(!1), ne = r ?? `${n}/new`, re = J(C, g, "add"), ae = J(C, g, "change"), z = J(C, g, "delete"), U = ae && (a === "page" || a === "both") && c?.edit !== !1, W = ae && (a === "modal" || a === "both") && c?.quickEdit !== !1, ce = z && c?.delete !== !1, le = U || W || ce || d, ue = i(() => {
1524
- P(/* @__PURE__ */ new Set());
1525
- }, []), de = s(() => {
1634
+ var Wn = t(null);
1635
+ function Gn() {
1636
+ return a(Wn);
1637
+ }
1638
+ function Kn({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: a = "page", formChildren: o, actions: c, rowActions: d, headerExtra: f, bulkActions: p, bulkDelete: m = !0, bulkActionsEnabled: h = !0, permissions: g, queryState: _, queryActions: v }) {
1639
+ let b = yt(), C = K(), { message: w, modal: ee } = y.useApp(), { columns: T, sortOrders: E, sortPriorities: D } = sn(), [O, k] = l(!1), [A, te] = l([]), [j, ne] = l(0), [M, N] = l(() => /* @__PURE__ */ new Set()), [re, P] = l(!1), I = r ?? `${n}/new`, ie = q(C, g, "add"), ae = q(C, g, "change"), L = q(C, g, "delete"), z = ae && (a === "page" || a === "both") && c?.edit !== !1, U = ae && (a === "modal" || a === "both") && c?.quickEdit !== !1, le = L && c?.delete !== !1, ue = z || U || le || d, de = i(() => {
1640
+ N(/* @__PURE__ */ new Set());
1641
+ }, []), fe = s(() => {
1526
1642
  if (!h) return [];
1527
1643
  let t = [];
1528
- return m && z && t.push({
1644
+ return m && L && t.push({
1529
1645
  key: "__delete",
1530
1646
  label: "Delete selected",
1531
1647
  confirm: (e) => `Delete ${e.length} selected item(s)? This cannot be undone.`,
@@ -1536,45 +1652,45 @@ function An({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: a = "p
1536
1652
  }, [
1537
1653
  h,
1538
1654
  m,
1539
- z,
1655
+ L,
1540
1656
  p,
1541
1657
  b,
1542
1658
  e,
1543
1659
  w
1544
- ]), fe = de.length > 0, pe = N.size, me = A.length > 0 && A.every((e) => N.has(e.id)), he = M > 0 && pe >= M, ge = s(() => A.filter((e) => N.has(e.id)).map((e) => e.id), [A, N]), _e = i((e) => {
1545
- P((t) => {
1660
+ ]), pe = fe.length > 0, me = M.size, he = A.length > 0 && A.every((e) => M.has(e.id)), ge = j > 0 && me >= j, _e = s(() => A.filter((e) => M.has(e.id)).map((e) => e.id), [A, M]), ve = i((e) => {
1661
+ N((t) => {
1546
1662
  let n = new Set(t), r = A.map((e) => e.id);
1547
1663
  for (let t of r) e.includes(t) || n.delete(t);
1548
1664
  for (let t of e) n.add(t);
1549
1665
  return n;
1550
1666
  });
1551
- }, [A]), ve = i(async () => {
1552
- if (!(M <= 0)) {
1553
- L(!0);
1667
+ }, [A]), ye = i(async () => {
1668
+ if (!(j <= 0)) {
1669
+ P(!0);
1554
1670
  try {
1555
1671
  let t = _.sort.length === 0 ? void 0 : _.sort.length === 1 ? _.sort[0] : _.sort, n = await b.getList(e, {
1556
1672
  pagination: {
1557
1673
  page: 1,
1558
- perPage: M
1674
+ perPage: j
1559
1675
  },
1560
1676
  sort: t,
1561
1677
  filter: _.filter
1562
1678
  });
1563
- P(new Set(n.data.map((e) => e.id)));
1679
+ N(new Set(n.data.map((e) => e.id)));
1564
1680
  } catch (e) {
1565
1681
  w.error(e instanceof Error ? e.message : "Load failed");
1566
1682
  } finally {
1567
- L(!1);
1683
+ P(!1);
1568
1684
  }
1569
1685
  }
1570
1686
  }, [
1571
1687
  b,
1572
1688
  e,
1573
- M,
1689
+ j,
1574
1690
  _.sort,
1575
1691
  _.filter,
1576
1692
  w
1577
- ]), ye = i((e) => {
1693
+ ]), be = i((e) => {
1578
1694
  let t = (e) => {
1579
1695
  let t = e?.columnKey ?? e?.field;
1580
1696
  return t == null ? null : String(Array.isArray(t) ? t[0] : t);
@@ -1595,7 +1711,7 @@ function An({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: a = "p
1595
1711
  return;
1596
1712
  }
1597
1713
  !e?.order && _.sort.length > 0 && v.setSort([]);
1598
- }, [v, _.sort.length]), G = s(() => {
1714
+ }, [v, _.sort.length]), xe = s(() => {
1599
1715
  let e = _.sort.length === 0 ? void 0 : _.sort.length === 1 ? _.sort[0] : _.sort;
1600
1716
  return {
1601
1717
  pagination: {
@@ -1605,33 +1721,33 @@ function An({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: a = "p
1605
1721
  sort: e,
1606
1722
  filter: _.filter
1607
1723
  };
1608
- }, [_]), K = i(async (t) => {
1724
+ }, [_]), W = i(async (t) => {
1609
1725
  k(!0);
1610
1726
  try {
1611
1727
  let n = await b.getList(e, {
1612
- ...G,
1728
+ ...xe,
1613
1729
  signal: t
1614
1730
  });
1615
1731
  if (t?.aborted) return;
1616
- j(n.data), te(n.total);
1732
+ te(n.data), ne(n.total);
1617
1733
  } catch (e) {
1618
- vt(e) || w.error(e instanceof Error ? e.message : "Load failed");
1734
+ St(e) || w.error(e instanceof Error ? e.message : "Load failed");
1619
1735
  } finally {
1620
1736
  t?.aborted || k(!1);
1621
1737
  }
1622
1738
  }, [
1623
1739
  b,
1624
1740
  e,
1625
- G,
1741
+ xe,
1626
1742
  w
1627
1743
  ]);
1628
- yn((e) => K(e), [K]);
1629
- let be = s(() => ({
1630
- reload: () => void K(),
1631
- clearSelection: ue
1632
- }), [K, ue]), xe = i(async (e, t) => {
1744
+ Fn((e) => W(e), [W]);
1745
+ let Se = s(() => ({
1746
+ reload: () => void W(),
1747
+ clearSelection: de
1748
+ }), [W, de]), Ce = i(async (e, t) => {
1633
1749
  if (e.confirm) {
1634
- let n = typeof e.confirm == "function" ? await e.confirm(t, be) : e.confirm;
1750
+ let n = typeof e.confirm == "function" ? await e.confirm(t, Se) : e.confirm;
1635
1751
  if (n === !1 || !await new Promise((t) => {
1636
1752
  ee.confirm({
1637
1753
  title: n,
@@ -1641,31 +1757,31 @@ function An({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: a = "p
1641
1757
  });
1642
1758
  })) return;
1643
1759
  }
1644
- L(!0);
1760
+ P(!0);
1645
1761
  try {
1646
- await e.execute(t, be);
1762
+ await e.execute(t, Se);
1647
1763
  } catch (e) {
1648
1764
  w.error(e instanceof Error ? e.message : "Action failed");
1649
1765
  } finally {
1650
- L(!1);
1766
+ P(!1);
1651
1767
  }
1652
1768
  }, [
1653
- be,
1769
+ Se,
1654
1770
  ee,
1655
1771
  w
1656
- ]), Se = i(async (t) => {
1657
- if (z) try {
1658
- await b.delete(e, t.id), w.success("Deleted"), K();
1772
+ ]), G = i(async (t) => {
1773
+ if (L) try {
1774
+ await b.delete(e, t.id), w.success("Deleted"), W();
1659
1775
  } catch (e) {
1660
1776
  w.error(e instanceof Error ? e.message : "Delete failed");
1661
1777
  }
1662
1778
  }, [
1663
- z,
1779
+ L,
1664
1780
  b,
1665
1781
  e,
1666
- K,
1782
+ W,
1667
1783
  w
1668
- ]), Ce = s(() => {
1784
+ ]), we = s(() => {
1669
1785
  let e = T.map((e) => {
1670
1786
  let t = e.buildColumn();
1671
1787
  if (e.sortable) {
@@ -1686,7 +1802,7 @@ function An({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: a = "p
1686
1802
  textAlign: "center"
1687
1803
  },
1688
1804
  children: r
1689
- }), V(i === "ascend" ? se : oe, { style: { fontSize: 11 } })]
1805
+ }), V(i === "ascend" ? ce : se, { style: { fontSize: 11 } })]
1690
1806
  });
1691
1807
  return {
1692
1808
  ...t,
@@ -1697,34 +1813,34 @@ function An({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: a = "p
1697
1813
  }
1698
1814
  return t;
1699
1815
  });
1700
- if (!le) return e;
1816
+ if (!ue) return e;
1701
1817
  let t = {
1702
- reload: () => void K(),
1818
+ reload: () => void W(),
1703
1819
  openEditModal: v.openEditModal
1704
1820
  }, r = {
1705
1821
  title: "Actions",
1706
1822
  key: "__actions",
1707
1823
  width: a === "both" ? 200 : 160,
1708
- render: (e, r) => /* @__PURE__ */ H(I, {
1824
+ render: (e, r) => /* @__PURE__ */ H(F, {
1709
1825
  size: "small",
1710
1826
  wrap: !0,
1711
1827
  children: [
1712
- U ? /* @__PURE__ */ V(u, {
1828
+ z ? /* @__PURE__ */ V(u, {
1713
1829
  to: `${n}/${String(r.id)}`,
1714
1830
  children: "Edit"
1715
1831
  }) : null,
1716
- W ? /* @__PURE__ */ V(x, {
1832
+ U ? /* @__PURE__ */ V(x, {
1717
1833
  type: "link",
1718
1834
  size: "small",
1719
1835
  style: { padding: 0 },
1720
1836
  onClick: () => v.openEditModal(r.id),
1721
1837
  children: a === "both" ? "Quick edit" : "Edit"
1722
1838
  }) : null,
1723
- ce ? /* @__PURE__ */ V(x, {
1839
+ le ? /* @__PURE__ */ V(x, {
1724
1840
  type: "link",
1725
1841
  danger: !0,
1726
1842
  size: "small",
1727
- onClick: () => void Se(r),
1843
+ onClick: () => void G(r),
1728
1844
  style: { padding: 0 },
1729
1845
  children: "Delete"
1730
1846
  }) : null,
@@ -1735,84 +1851,85 @@ function An({ resource: e, title: t, pathPrefix: n, newPath: r, editMode: a = "p
1735
1851
  return [...e, r];
1736
1852
  }, [
1737
1853
  T,
1738
- le,
1854
+ ue,
1855
+ z,
1739
1856
  U,
1740
- W,
1741
- ce,
1857
+ le,
1742
1858
  a,
1743
1859
  n,
1744
- Se,
1860
+ G,
1745
1861
  E,
1746
1862
  D,
1747
1863
  v,
1748
1864
  d,
1749
- K
1750
- ]), we = o && (_.createModal || _.editId != null) && (a === "modal" || a === "both");
1865
+ W
1866
+ ]), Te = o && (_.createModal || _.editId != null) && (a === "modal" || a === "both");
1751
1867
  return /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ H(S, {
1752
1868
  title: /* @__PURE__ */ V(R.Title, {
1753
1869
  level: 5,
1754
1870
  style: { margin: 0 },
1755
1871
  children: t
1756
1872
  }),
1757
- extra: f || re ? /* @__PURE__ */ H(I, { children: [f, re ? a === "modal" || a === "both" ? /* @__PURE__ */ H(B, { children: [a === "both" ? /* @__PURE__ */ V(u, {
1758
- to: ne,
1873
+ extra: f || ie ? /* @__PURE__ */ H(F, { children: [f, ie ? a === "modal" || a === "both" ? /* @__PURE__ */ H(B, { children: [a === "both" ? /* @__PURE__ */ V(u, {
1874
+ to: I,
1759
1875
  children: /* @__PURE__ */ V(x, { children: "New page" })
1760
1876
  }) : null, /* @__PURE__ */ V(x, {
1761
1877
  type: "primary",
1762
1878
  onClick: () => v.openCreateModal(),
1763
1879
  children: "New"
1764
1880
  })] }) : /* @__PURE__ */ V(u, {
1765
- to: ne,
1881
+ to: I,
1766
1882
  children: /* @__PURE__ */ V(x, {
1767
1883
  type: "primary",
1768
1884
  children: "New"
1769
1885
  })
1770
1886
  }) : null] }) : null,
1771
- children: [fe ? /* @__PURE__ */ V(xn, {
1772
- selectedCount: pe,
1773
- total: M,
1774
- allPageSelected: me,
1775
- allMatchingSelected: he,
1776
- onSelectAllMatching: () => void ve(),
1777
- onClearSelection: ue,
1778
- actions: de,
1779
- onExecute: xe,
1780
- selectedIds: [...N],
1781
- running: F || O
1782
- }) : null, /* @__PURE__ */ V(ie, {
1887
+ children: [pe ? /* @__PURE__ */ V(Ln, {
1888
+ selectedCount: me,
1889
+ total: j,
1890
+ allPageSelected: he,
1891
+ allMatchingSelected: ge,
1892
+ onSelectAllMatching: () => void ye(),
1893
+ onClearSelection: de,
1894
+ actions: fe,
1895
+ onExecute: Ce,
1896
+ selectedIds: [...M],
1897
+ running: re || O
1898
+ }) : null, /* @__PURE__ */ V(oe, {
1783
1899
  rowKey: "id",
1784
1900
  loading: O,
1785
- columns: Ce,
1901
+ columns: we,
1786
1902
  dataSource: A,
1787
- rowSelection: fe ? {
1788
- selectedRowKeys: ge,
1789
- onChange: _e,
1903
+ scroll: { x: "max-content" },
1904
+ rowSelection: pe ? {
1905
+ selectedRowKeys: _e,
1906
+ onChange: ve,
1790
1907
  preserveSelectedRowKeys: !0
1791
1908
  } : void 0,
1792
1909
  pagination: {
1793
1910
  current: _.page,
1794
1911
  pageSize: _.perPage,
1795
- total: M,
1912
+ total: j,
1796
1913
  showSizeChanger: !0,
1797
1914
  onChange: (e, t) => {
1798
1915
  v.setPage(e), t && v.setPerPage(t);
1799
1916
  }
1800
1917
  },
1801
1918
  onChange: (e, t, n) => {
1802
- ye(n);
1919
+ be(n);
1803
1920
  }
1804
1921
  })]
1805
- }), we ? /* @__PURE__ */ V(bn, {
1922
+ }), Te ? /* @__PURE__ */ V(In, {
1806
1923
  resource: e,
1807
1924
  editId: _.createModal ? "new" : _.editId,
1808
1925
  onClose: () => {
1809
- v.closeModal(), K();
1926
+ v.closeModal(), W();
1810
1927
  },
1811
1928
  children: o
1812
1929
  }) : null] });
1813
1930
  }
1814
- function jn({ resource: e, title: t, pathPrefix: n, newPath: r, staticFilter: a, editMode: o = "page", syncQueryParams: c = !0, children: l, formChildren: u, actions: d, rowActions: f, headerExtra: p, bulkActions: m, bulkDelete: h, bulkActionsEnabled: g, permissions: _ }) {
1815
- let [v, y] = Dn(a), b = s(() => {
1931
+ function qn({ resource: e, title: t, pathPrefix: n, newPath: r, staticFilter: a, editMode: o = "page", syncQueryParams: c = !0, children: l, formChildren: u, actions: d, rowActions: f, headerExtra: p, bulkActions: m, bulkDelete: h, bulkActionsEnabled: g, permissions: _ }) {
1932
+ let [v, y] = Un(a), b = s(() => {
1816
1933
  if (!c) return a ?? {};
1817
1934
  let e = {};
1818
1935
  for (let [t, n] of Object.entries(v.filter)) a && t in a || (e[t] = n);
@@ -1827,15 +1944,15 @@ function jn({ resource: e, title: t, pathPrefix: n, newPath: r, staticFilter: a,
1827
1944
  filterValues: b,
1828
1945
  setFilterValue: x
1829
1946
  }), [b, x]);
1830
- return /* @__PURE__ */ V(On.Provider, {
1947
+ return /* @__PURE__ */ V(Wn.Provider, {
1831
1948
  value: S,
1832
- children: /* @__PURE__ */ V($t, {
1949
+ children: /* @__PURE__ */ V(ln, {
1833
1950
  values: b,
1834
1951
  setFilterValue: x,
1835
- children: /* @__PURE__ */ H(Xt, {
1952
+ children: /* @__PURE__ */ H(on, {
1836
1953
  toggleSort: y.toggleSort,
1837
1954
  sort: v.sort,
1838
- children: [l, /* @__PURE__ */ V(An, {
1955
+ children: [l, /* @__PURE__ */ V(Kn, {
1839
1956
  resource: e,
1840
1957
  title: t,
1841
1958
  pathPrefix: n,
@@ -1858,13 +1975,13 @@ function jn({ resource: e, title: t, pathPrefix: n, newPath: r, staticFilter: a,
1858
1975
  }
1859
1976
  //#endregion
1860
1977
  //#region src/crud/FilterBar.tsx
1861
- function Mn() {
1862
- let e = en();
1863
- return !e || e.filters.length === 0 ? null : /* @__PURE__ */ V(I, {
1978
+ function Jn() {
1979
+ let e = un();
1980
+ return !e || e.filters.length === 0 ? null : /* @__PURE__ */ V(F, {
1864
1981
  wrap: !0,
1865
1982
  size: "middle",
1866
1983
  style: { marginBottom: 16 },
1867
- children: e.filters.map((t) => /* @__PURE__ */ H(I, {
1984
+ children: e.filters.map((t) => /* @__PURE__ */ H(F, {
1868
1985
  orientation: "vertical",
1869
1986
  size: 2,
1870
1987
  children: [t.label ? /* @__PURE__ */ V(R.Text, {
@@ -1878,50 +1995,242 @@ function Mn() {
1878
1995
  }, t.key))
1879
1996
  });
1880
1997
  }
1881
- function Nn({ children: e }) {
1882
- return /* @__PURE__ */ H(B, { children: [e, /* @__PURE__ */ V(Mn, {})] });
1998
+ function Yn({ children: e }) {
1999
+ return /* @__PURE__ */ H(B, { children: [e, /* @__PURE__ */ V(Jn, {})] });
1883
2000
  }
1884
2001
  //#endregion
1885
- //#region src/crud/utils/inlineArrayName.ts
1886
- function Pn(e, t) {
1887
- return t ?? `__inline_${e.replace(/[^a-z0-9]/gi, "_")}`;
2002
+ //#region src/crud/context/InlineFieldsRegistry.tsx
2003
+ var Xn = t(null);
2004
+ function Zn({ children: e, registryRef: t }) {
2005
+ return /* @__PURE__ */ V(Xn.Provider, {
2006
+ value: t,
2007
+ children: e
2008
+ });
2009
+ }
2010
+ function Qn() {
2011
+ return a(Xn);
2012
+ }
2013
+ function $n(e, t, n, r, i = !0) {
2014
+ let a = Qn();
2015
+ o(() => {
2016
+ if (!(!i || !a)) return a.current.set(e, {
2017
+ field: e,
2018
+ sources: t,
2019
+ payloadKey: n,
2020
+ transformRows: r
2021
+ }), () => {
2022
+ a.current.delete(e);
2023
+ };
2024
+ }, [
2025
+ a,
2026
+ e,
2027
+ t,
2028
+ n,
2029
+ r,
2030
+ i
2031
+ ]);
1888
2032
  }
1889
2033
  //#endregion
1890
- //#region src/crud/utils/inlineFieldName.ts
1891
- function Fn(e, t, n) {
2034
+ //#region src/crud/utils/useFormRecord.ts
2035
+ function er({ dp: e, resource: t, id: n, isNew: r, form: a, message: o, defaultValues: s }) {
2036
+ let [c, u] = l(!r), [d, f] = l(0), p = i(async (i) => {
2037
+ if (r || !n) {
2038
+ s && a.reset({ ...s }), u(!1);
2039
+ return;
2040
+ }
2041
+ u(!0);
2042
+ try {
2043
+ let r = await e.getOne(t, n, { signal: i });
2044
+ if (i?.aborted) return;
2045
+ a.reset(r.data), f((e) => e + 1);
2046
+ } catch (e) {
2047
+ St(e) || o.error(e instanceof Error ? e.message : "Load failed");
2048
+ } finally {
2049
+ i?.aborted || u(!1);
2050
+ }
2051
+ }, [
2052
+ e,
2053
+ t,
2054
+ n,
2055
+ r,
2056
+ a,
2057
+ o,
2058
+ s
2059
+ ]);
2060
+ return Fn((e) => p(e), [p]), {
2061
+ loading: c,
2062
+ formVersion: d
2063
+ };
2064
+ }
2065
+ function tr({ dp: e, resource: t, id: n, isNew: r, form: a, message: o, navigate: s, listPath: c, payloadFieldsRef: l, inlineRegistryRef: u, onSaved: d, stayOnPage: f }) {
2066
+ return i(async (i) => {
2067
+ try {
2068
+ let a = jn(i, Array.from(l.current), u.current.values()), p;
2069
+ if (r) p = (await e.create(t, a)).data, o.success("Created");
2070
+ else if (n) p = (await e.update(t, {
2071
+ id: n,
2072
+ data: a
2073
+ })).data, o.success("Updated");
2074
+ else return;
2075
+ d?.(p), f || s(c);
2076
+ } catch (n) {
2077
+ let i = Array.from(u.current.keys());
2078
+ await Pn(e, a, o, n, {
2079
+ resource: t,
2080
+ mutation: r ? "create" : "update",
2081
+ inlineFieldPaths: i
2082
+ }) || o.error(n instanceof Error ? n.message : "Save failed");
2083
+ }
2084
+ }, [
2085
+ e,
2086
+ t,
2087
+ n,
2088
+ r,
2089
+ a,
2090
+ o,
2091
+ s,
2092
+ c,
2093
+ l,
2094
+ u,
2095
+ d,
2096
+ f
2097
+ ]);
2098
+ }
2099
+ //#endregion
2100
+ //#region src/crud/ResourceForm.tsx
2101
+ function nr({ resource: e, title: t, listPath: r, children: i, defaultValues: a, onSaved: s, stayOnPage: l, permissions: d }) {
2102
+ let { id: f } = _(), p = f === "new" || !f, m = yt(), h = K(), v = g(), { message: b } = y.useApp(), { token: C } = z.useToken(), w = c(/* @__PURE__ */ new Set()), ee = c(/* @__PURE__ */ new Map()), T = Ce({ defaultValues: a }), { loading: E, formVersion: O } = er({
2103
+ dp: m,
2104
+ resource: e,
2105
+ id: f,
2106
+ isNew: p,
2107
+ form: T,
2108
+ message: b,
2109
+ defaultValues: a
2110
+ }), k = tr({
2111
+ dp: m,
2112
+ resource: e,
2113
+ id: f,
2114
+ isNew: p,
2115
+ form: T,
2116
+ message: b,
2117
+ navigate: v,
2118
+ listPath: r,
2119
+ payloadFieldsRef: w,
2120
+ inlineRegistryRef: ee,
2121
+ onSaved: s,
2122
+ stayOnPage: l
2123
+ });
2124
+ o(() => {
2125
+ d && (q(h, d, p ? "add" : "change") || v(r, { replace: !0 }));
2126
+ }, [
2127
+ d,
2128
+ p,
2129
+ h,
2130
+ v,
2131
+ r
2132
+ ]);
2133
+ let A = d ? q(h, d, p ? "add" : "change") : !0;
2134
+ return /* @__PURE__ */ V(S, {
2135
+ title: /* @__PURE__ */ H(F, { children: [/* @__PURE__ */ H(u, {
2136
+ to: r,
2137
+ style: { color: C.colorText },
2138
+ children: [/* @__PURE__ */ V(U, {}), " Back"]
2139
+ }), /* @__PURE__ */ V(R.Title, {
2140
+ level: 5,
2141
+ style: { margin: 0 },
2142
+ children: t
2143
+ })] }),
2144
+ children: /* @__PURE__ */ V(fn, {
2145
+ resource: e,
2146
+ isNew: p,
2147
+ children: /* @__PURE__ */ V(vn, {
2148
+ fieldsRef: w,
2149
+ children: /* @__PURE__ */ V(Zn, {
2150
+ registryRef: ee,
2151
+ children: /* @__PURE__ */ H("div", {
2152
+ style: { position: "relative" },
2153
+ children: [E ? /* @__PURE__ */ V("div", {
2154
+ style: {
2155
+ position: "absolute",
2156
+ inset: 0,
2157
+ display: "flex",
2158
+ alignItems: "center",
2159
+ justifyContent: "center",
2160
+ zIndex: 1
2161
+ },
2162
+ children: /* @__PURE__ */ V(I, {})
2163
+ }) : null, /* @__PURE__ */ n(W, {
2164
+ ...T,
2165
+ key: O
2166
+ }, /* @__PURE__ */ H(D, {
2167
+ layout: "vertical",
2168
+ onFinish: () => void T.handleSubmit(k)(),
2169
+ style: {
2170
+ opacity: E ? .4 : 1,
2171
+ pointerEvents: E ? "none" : void 0
2172
+ },
2173
+ children: [i, /* @__PURE__ */ V(D.Item, {
2174
+ style: { marginTop: 16 },
2175
+ children: /* @__PURE__ */ H(F, { children: [/* @__PURE__ */ V(x, {
2176
+ type: "primary",
2177
+ htmlType: "submit",
2178
+ disabled: E || !A,
2179
+ children: "Save"
2180
+ }), /* @__PURE__ */ V(u, {
2181
+ to: r,
2182
+ children: /* @__PURE__ */ V(x, {
2183
+ disabled: E,
2184
+ children: "Cancel"
2185
+ })
2186
+ })] })
2187
+ })]
2188
+ }))]
2189
+ })
2190
+ })
2191
+ })
2192
+ })
2193
+ });
2194
+ }
2195
+ //#endregion
2196
+ //#region src/crud/utils/nestedFieldPath.ts
2197
+ function rr(e, t, n) {
1892
2198
  return `${e}.${t}.${n}`;
1893
2199
  }
1894
2200
  //#endregion
1895
2201
  //#region src/crud/InlineFormSet.tsx
1896
- function In(e) {
2202
+ function ir(e) {
1897
2203
  let t = {};
1898
2204
  for (let n of e) t[n] = void 0;
1899
2205
  return t;
1900
2206
  }
1901
- function Ln(e, t) {
1902
- let { control: n } = G(), { fields: r, append: i, remove: a } = ve({
2207
+ function ar(e, t) {
2208
+ let { control: n } = G(), { fields: r, append: i, remove: a } = Se({
1903
2209
  control: n,
1904
- name: e
2210
+ name: e,
2211
+ keyName: "rowKey"
1905
2212
  });
1906
2213
  return {
1907
2214
  fields: r,
1908
2215
  remove: a,
1909
- appendEmpty: () => i(In(t))
2216
+ appendEmpty: () => i(ir(t))
1910
2217
  };
1911
2218
  }
1912
- function Rn({ resource: e, label: t, name: n, columns: r }) {
1913
- let i = Pn(e, n), { fields: a, remove: o, appendEmpty: c } = Ln(i, s(() => r.map((e) => e.source), [r])), l = s(() => r.map((e) => ({
1914
- title: e.label ?? e.source,
1915
- key: e.source,
1916
- width: e.width,
1917
- onHeaderCell: () => e.minWidth == null ? {} : { style: { minWidth: e.minWidth } },
1918
- onCell: () => e.minWidth == null ? {} : { style: { minWidth: e.minWidth } },
1919
- render: (t, n, r) => e.cell({
1920
- name: Fn(i, r, e.source),
1921
- index: r,
1922
- arrayName: i
2219
+ function or({ field: e, label: t, payloadKey: n, transformRows: r, columns: i }) {
2220
+ let a = s(() => i.map((e) => e.source), [i]), { fields: o, remove: c, appendEmpty: l } = ar(e, a);
2221
+ bn(e), $n(e, a, n, r);
2222
+ let u = s(() => i.map((t) => ({
2223
+ title: t.label ?? t.source,
2224
+ key: t.source,
2225
+ width: t.width,
2226
+ onHeaderCell: () => t.minWidth == null ? {} : { style: { minWidth: t.minWidth } },
2227
+ onCell: () => t.minWidth == null ? {} : { style: { minWidth: t.minWidth } },
2228
+ render: (n, r, i) => t.cell({
2229
+ name: rr(e, i, t.source),
2230
+ index: i,
2231
+ field: e
1923
2232
  })
1924
- })), [r, i]);
2233
+ })), [i, e]);
1925
2234
  return /* @__PURE__ */ H("div", {
1926
2235
  style: { marginTop: 24 },
1927
2236
  children: [
@@ -1929,15 +2238,15 @@ function Rn({ resource: e, label: t, name: n, columns: r }) {
1929
2238
  level: 5,
1930
2239
  children: t ?? "Related items"
1931
2240
  }),
1932
- /* @__PURE__ */ V(ie, {
2241
+ /* @__PURE__ */ V(oe, {
1933
2242
  size: "small",
1934
2243
  pagination: !1,
1935
2244
  scroll: { x: "max-content" },
1936
- dataSource: a.map((e) => ({
2245
+ dataSource: o.map((e) => ({
1937
2246
  ...e,
1938
- key: e.id
2247
+ key: e.rowKey
1939
2248
  })),
1940
- columns: [...l, {
2249
+ columns: [...u, {
1941
2250
  title: "",
1942
2251
  key: "__remove",
1943
2252
  width: 80,
@@ -1945,7 +2254,7 @@ function Rn({ resource: e, label: t, name: n, columns: r }) {
1945
2254
  type: "link",
1946
2255
  danger: !0,
1947
2256
  size: "small",
1948
- onClick: () => o(n),
2257
+ onClick: () => c(n),
1949
2258
  children: "Remove"
1950
2259
  })
1951
2260
  }]
@@ -1953,41 +2262,41 @@ function Rn({ resource: e, label: t, name: n, columns: r }) {
1953
2262
  /* @__PURE__ */ V(x, {
1954
2263
  type: "dashed",
1955
2264
  style: { marginTop: 8 },
1956
- onClick: c,
2265
+ onClick: l,
1957
2266
  children: "Add row"
1958
2267
  })
1959
2268
  ]
1960
2269
  });
1961
2270
  }
1962
- function zn({ resource: e, label: t, name: n, sources: r, renderRow: i }) {
1963
- let a = Pn(e, n), { fields: o, remove: s, appendEmpty: c } = Ln(a, r);
1964
- return /* @__PURE__ */ H("div", {
2271
+ function sr({ field: e, label: t, payloadKey: n, transformRows: r, sources: i, renderRow: a }) {
2272
+ let { fields: o, remove: s, appendEmpty: c } = ar(e, i);
2273
+ return bn(e), $n(e, i, n, r), /* @__PURE__ */ H("div", {
1965
2274
  style: { marginTop: 24 },
1966
2275
  children: [
1967
2276
  /* @__PURE__ */ V(R.Title, {
1968
2277
  level: 5,
1969
2278
  children: t ?? "Related items"
1970
2279
  }),
1971
- /* @__PURE__ */ V(I, {
2280
+ /* @__PURE__ */ V(F, {
1972
2281
  orientation: "vertical",
1973
2282
  size: "middle",
1974
2283
  style: { width: "100%" },
1975
- children: o.map((e, t) => /* @__PURE__ */ V(S, {
2284
+ children: o.map((t, n) => /* @__PURE__ */ V(S, {
1976
2285
  size: "small",
1977
- title: `Item ${t + 1}`,
2286
+ title: `Item ${n + 1}`,
1978
2287
  extra: /* @__PURE__ */ V(x, {
1979
2288
  type: "link",
1980
2289
  danger: !0,
1981
2290
  size: "small",
1982
- onClick: () => s(t),
2291
+ onClick: () => s(n),
1983
2292
  children: "Remove"
1984
2293
  }),
1985
- children: i({
1986
- arrayName: a,
1987
- index: t,
1988
- name: (e) => Fn(a, t, e)
2294
+ children: a({
2295
+ field: e,
2296
+ index: n,
2297
+ name: (t) => rr(e, n, t)
1989
2298
  })
1990
- }, e.id))
2299
+ }, t.rowKey))
1991
2300
  }),
1992
2301
  /* @__PURE__ */ V(x, {
1993
2302
  type: "dashed",
@@ -1998,258 +2307,24 @@ function zn({ resource: e, label: t, name: n, sources: r, renderRow: i }) {
1998
2307
  ]
1999
2308
  });
2000
2309
  }
2001
- async function Bn(e, t) {
2002
- let { resource: n, foreignKey: r, parentId: i, rows: a, existingIds: o = [], onRowError: s } = t, c = [];
2003
- for (let t = 0; t < a.length; t++) {
2004
- let l = a[t];
2005
- try {
2006
- let { id: t, ...a } = l, s = {
2007
- ...a,
2008
- [r]: i
2009
- }, u = l.id;
2010
- if (u != null && o.some((e) => e === u)) await e.update(n, {
2011
- id: u,
2012
- data: s
2013
- }), c.push(u);
2014
- else {
2015
- let t = (await e.create(n, s)).data;
2016
- c.push(t.id);
2017
- }
2018
- } catch (e) {
2019
- if (s?.(e, t)) return !1;
2020
- throw e;
2021
- }
2022
- }
2023
- for (let t of o) c.some((e) => e === t) || await e.delete(n, t);
2024
- return !0;
2025
- }
2026
- async function Vn(e, t, n, r) {
2027
- let i = await e.getList(t, {
2028
- filter: { [n]: Number(r) || r },
2029
- pagination: {
2030
- page: 1,
2031
- perPage: 500
2032
- }
2033
- });
2034
- return {
2035
- rows: i.data,
2036
- ids: i.data.map((e) => e.id)
2037
- };
2038
- }
2039
- //#endregion
2040
- //#region src/crud/utils/useResourceFormData.ts
2041
- function Hn(e) {
2042
- return Pn(e.resource, e.name);
2043
- }
2044
- function Un({ dp: e, resource: t, id: n, isNew: r, form: a, message: o, defaultValues: s, inlines: c }) {
2045
- let [u, d] = l(!r), [f, p] = l(0), [m, h] = l({}), g = i(async (i) => {
2046
- if (r || !n) {
2047
- s && a.reset({ ...s }), d(!1);
2048
- return;
2049
- }
2050
- d(!0);
2051
- try {
2052
- let r = await e.getOne(t, n, { signal: i });
2053
- if (i?.aborted) return;
2054
- let o = r.data;
2055
- if (c?.length) {
2056
- let t = { ...o }, r = {};
2057
- for (let i of c) {
2058
- let a = Hn(i), { rows: o, ids: s } = await Vn(e, i.resource, i.foreignKey, n);
2059
- t[a] = o, r[a] = s;
2060
- }
2061
- if (i?.aborted) return;
2062
- a.reset(t), h(r), p((e) => e + 1);
2063
- } else a.reset(o), p((e) => e + 1);
2064
- } catch (e) {
2065
- vt(e) || o.error(e instanceof Error ? e.message : "Load failed");
2066
- } finally {
2067
- i?.aborted || d(!1);
2068
- }
2069
- }, [
2070
- e,
2071
- t,
2072
- n,
2073
- r,
2074
- a,
2075
- o,
2076
- s,
2077
- c
2078
- ]);
2079
- return yn((e) => g(e), [g]), {
2080
- loading: u,
2081
- formVersion: f,
2082
- existingInlineIds: m
2083
- };
2084
- }
2085
- function Wn({ dp: e, resource: t, id: n, isNew: r, form: a, message: o, navigate: s, listPath: c, submitFieldsRef: l, inlines: u, existingInlineIds: d, onSaved: f, stayOnPage: p }) {
2086
- return i(async (i) => {
2087
- try {
2088
- let m = hn(i, Array.from(l.current));
2089
- if (u?.length) for (let e of u) delete m[Hn(e)];
2090
- let h;
2091
- if (r) h = (await e.create(t, m)).data, o.success("Created");
2092
- else if (n) h = (await e.update(t, {
2093
- id: n,
2094
- data: m
2095
- })).data, o.success("Updated");
2096
- else return;
2097
- let g = h.id;
2098
- if (u?.length && g != null) for (let t of u) {
2099
- let n = Hn(t), r = a.getValues(n) ?? [];
2100
- if (!await Bn(e, {
2101
- resource: t.resource,
2102
- foreignKey: t.foreignKey,
2103
- parentId: g,
2104
- rows: r,
2105
- existingIds: d[n] ?? [],
2106
- onRowError: (i, s) => {
2107
- let c = r[s]?.id;
2108
- return vn(e, a, o, i, {
2109
- resource: t.resource,
2110
- mutation: c != null && (d[n] ?? []).some((e) => e === c) ? "update" : "create",
2111
- inlineArrayName: n,
2112
- rowIndex: s
2113
- });
2114
- }
2115
- })) return;
2116
- }
2117
- f?.(h), p || s(c);
2118
- } catch (n) {
2119
- vn(e, a, o, n, {
2120
- resource: t,
2121
- mutation: r ? "create" : "update"
2122
- }), o.error(n instanceof Error ? n.message : "Save failed");
2123
- }
2124
- }, [
2125
- e,
2126
- t,
2127
- n,
2128
- r,
2129
- a,
2130
- o,
2131
- s,
2132
- c,
2133
- l,
2134
- u,
2135
- d,
2136
- f,
2137
- p
2138
- ]);
2139
- }
2140
- //#endregion
2141
- //#region src/crud/ResourceForm.tsx
2142
- function Gn({ resource: e, title: t, listPath: r, children: i, defaultValues: a, onSaved: s, stayOnPage: l, inlines: d, permissions: f }) {
2143
- let { id: p } = _(), m = p === "new" || !p, h = mt(), v = q(), b = g(), { message: C } = y.useApp(), { token: w } = z.useToken(), ee = c(/* @__PURE__ */ new Set()), T = ye({ defaultValues: a }), { loading: E, formVersion: O, existingInlineIds: k } = Un({
2144
- dp: h,
2145
- resource: e,
2146
- id: p,
2147
- isNew: m,
2148
- form: T,
2149
- message: C,
2150
- defaultValues: a,
2151
- inlines: d
2152
- }), A = Wn({
2153
- dp: h,
2154
- resource: e,
2155
- id: p,
2156
- isNew: m,
2157
- form: T,
2158
- message: C,
2159
- navigate: b,
2160
- listPath: r,
2161
- submitFieldsRef: ee,
2162
- inlines: d,
2163
- existingInlineIds: k,
2164
- onSaved: s,
2165
- stayOnPage: l
2166
- });
2167
- o(() => {
2168
- f && (J(v, f, m ? "add" : "change") || b(r, { replace: !0 }));
2169
- }, [
2170
- f,
2171
- m,
2172
- v,
2173
- b,
2174
- r
2175
- ]);
2176
- let j = f ? J(v, f, m ? "add" : "change") : !0;
2177
- return /* @__PURE__ */ V(S, {
2178
- title: /* @__PURE__ */ H(I, { children: [/* @__PURE__ */ H(u, {
2179
- to: r,
2180
- style: { color: w.colorText },
2181
- children: [/* @__PURE__ */ V(U, {}), " Back"]
2182
- }), /* @__PURE__ */ V(R.Title, {
2183
- level: 5,
2184
- style: { margin: 0 },
2185
- children: t
2186
- })] }),
2187
- children: /* @__PURE__ */ V(nn, {
2188
- resource: e,
2189
- isNew: m,
2190
- children: /* @__PURE__ */ V(ln, {
2191
- fieldsRef: ee,
2192
- children: /* @__PURE__ */ H("div", {
2193
- style: { position: "relative" },
2194
- children: [E ? /* @__PURE__ */ V("div", {
2195
- style: {
2196
- position: "absolute",
2197
- inset: 0,
2198
- display: "flex",
2199
- alignItems: "center",
2200
- justifyContent: "center",
2201
- zIndex: 1
2202
- },
2203
- children: /* @__PURE__ */ V(L, {})
2204
- }) : null, /* @__PURE__ */ n(_e, {
2205
- ...T,
2206
- key: O
2207
- }, /* @__PURE__ */ H(D, {
2208
- layout: "vertical",
2209
- onFinish: () => void T.handleSubmit(A)(),
2210
- style: {
2211
- opacity: E ? .4 : 1,
2212
- pointerEvents: E ? "none" : void 0
2213
- },
2214
- children: [i, /* @__PURE__ */ V(D.Item, {
2215
- style: { marginTop: 16 },
2216
- children: /* @__PURE__ */ H(I, { children: [/* @__PURE__ */ V(x, {
2217
- type: "primary",
2218
- htmlType: "submit",
2219
- disabled: E || !j,
2220
- children: "Save"
2221
- }), /* @__PURE__ */ V(u, {
2222
- to: r,
2223
- children: /* @__PURE__ */ V(x, {
2224
- disabled: E,
2225
- children: "Cancel"
2226
- })
2227
- })] })
2228
- })]
2229
- }))]
2230
- })
2231
- })
2232
- })
2233
- });
2234
- }
2235
2310
  //#endregion
2236
2311
  //#region src/crud/utils/formSectionErrors.ts
2237
- function Kn(e, t, n) {
2312
+ function cr(e, t, n) {
2238
2313
  for (let r of e) if (t(r, n).invalid) return !0;
2239
2314
  return !1;
2240
2315
  }
2241
- function qn(e) {
2316
+ function lr(e) {
2242
2317
  let t = c([]);
2243
2318
  for (; t.current.length < e;) t.current.push({ current: /* @__PURE__ */ new Set() });
2244
2319
  return t.current.length > e && (t.current.length = e), t.current;
2245
2320
  }
2246
- function Jn(e, t) {
2247
- let { control: n, getFieldState: r, setFocus: i } = G(), a = K({ control: n }), s = c(0), l = c(0);
2321
+ function ur(e, t) {
2322
+ let { control: n, getFieldState: r, setFocus: i } = G(), a = we({ control: n }), s = c(0), l = c(0);
2248
2323
  o(() => {
2249
2324
  if (a.submitCount === 0) return;
2250
2325
  let n = Object.keys(a.errors).length, o = a.submitCount !== s.current, c = !o && n > 0 && l.current === 0;
2251
2326
  if (s.current = a.submitCount, l.current = n, !o && !c || n === 0) return;
2252
- let u = e.findIndex((e) => Kn(e.current, r, a));
2327
+ let u = e.findIndex((e) => cr(e.current, r, a));
2253
2328
  if (u < 0) return;
2254
2329
  t(u);
2255
2330
  let d = [...e[u].current].find((e) => r(e, a).invalid);
@@ -2268,30 +2343,30 @@ function Jn(e, t) {
2268
2343
  }
2269
2344
  //#endregion
2270
2345
  //#region src/crud/FormTabs.tsx
2271
- function Yn(e) {
2346
+ function dr(e) {
2272
2347
  return null;
2273
2348
  }
2274
- function Xn(e) {
2275
- return r(e) && e.type === Yn;
2349
+ function fr(e) {
2350
+ return r(e) && e.type === dr;
2276
2351
  }
2277
- function Zn({ children: t, defaultActiveKey: n, activeKey: r, onChange: a, ...o }) {
2278
- let { token: c } = z.useToken(), u = s(() => e.toArray(t).filter(Xn).map((e, t) => ({
2352
+ function pr({ children: t, defaultActiveKey: n, activeKey: r, onChange: a, ...o }) {
2353
+ let { token: c } = z.useToken(), u = s(() => e.toArray(t).filter(fr).map((e, t) => ({
2279
2354
  key: e.key ?? String(t),
2280
2355
  label: e.props.label,
2281
2356
  disabled: e.props.disabled,
2282
2357
  children: e.props.children
2283
- })), [t]), d = qn(u.length), f = r !== void 0, [p, m] = l(() => n ?? u[0]?.key ?? "0"), h = f ? r : p, g = i((e) => {
2358
+ })), [t]), d = lr(u.length), f = r !== void 0, [p, m] = l(() => n ?? u[0]?.key ?? "0"), h = f ? r : p, g = i((e) => {
2284
2359
  f || m(e), a?.(e);
2285
2360
  }, [f, a]);
2286
- Jn(d, i((e) => {
2361
+ ur(d, i((e) => {
2287
2362
  let t = u[e]?.key;
2288
2363
  t != null && g(t);
2289
2364
  }, [g, u]));
2290
- let { control: _, getFieldState: v } = G(), y = K({ control: _ });
2291
- return /* @__PURE__ */ V(ae, {
2365
+ let { control: _, getFieldState: v } = G(), y = we({ control: _ });
2366
+ return /* @__PURE__ */ V(L, {
2292
2367
  destroyOnHidden: !1,
2293
2368
  items: s(() => u.map((e, t) => {
2294
- let n = Kn(d[t].current, v, y);
2369
+ let n = cr(d[t].current, v, y);
2295
2370
  return {
2296
2371
  key: e.key,
2297
2372
  label: n ? /* @__PURE__ */ V("span", {
@@ -2299,7 +2374,7 @@ function Zn({ children: t, defaultActiveKey: n, activeKey: r, onChange: a, ...o
2299
2374
  children: e.label
2300
2375
  }) : e.label,
2301
2376
  disabled: e.disabled,
2302
- children: /* @__PURE__ */ V(on, {
2377
+ children: /* @__PURE__ */ V(hn, {
2303
2378
  sourcesRef: d[t],
2304
2379
  children: e.children
2305
2380
  })
@@ -2318,17 +2393,17 @@ function Zn({ children: t, defaultActiveKey: n, activeKey: r, onChange: a, ...o
2318
2393
  }
2319
2394
  //#endregion
2320
2395
  //#region src/crud/FormSteps.tsx
2321
- function Qn(e) {
2396
+ function mr(e) {
2322
2397
  return null;
2323
2398
  }
2324
- function $n(e) {
2325
- return r(e) && e.type === Qn;
2399
+ function hr(e) {
2400
+ return r(e) && e.type === mr;
2326
2401
  }
2327
- function er({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStepSelect: a = !1, stepsStyle: o, navigationStyle: c, size: u, direction: d, type: f, status: p }) {
2328
- let m = s(() => e.toArray(t).filter($n), [t]), h = qn(m.length), [g, _] = l(n), v = m.length - 1;
2329
- Jn(h, _);
2330
- let { control: y, getFieldState: b } = G(), S = K({ control: y }), C = s(() => m.map((e, t) => {
2331
- let n = Kn(h[t].current, b, S);
2402
+ function gr({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStepSelect: a = !1, stepsStyle: o, navigationStyle: c, size: u, direction: d, type: f, status: p }) {
2403
+ let m = s(() => e.toArray(t).filter(hr), [t]), h = lr(m.length), [g, _] = l(n), v = m.length - 1;
2404
+ ur(h, _);
2405
+ let { control: y, getFieldState: b } = G(), S = we({ control: y }), C = s(() => m.map((e, t) => {
2406
+ let n = cr(h[t].current, b, S);
2332
2407
  return {
2333
2408
  title: e.props.title,
2334
2409
  description: e.props.description,
@@ -2343,7 +2418,7 @@ function er({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStep
2343
2418
  _(e);
2344
2419
  }, []);
2345
2420
  return /* @__PURE__ */ H(B, { children: [
2346
- /* @__PURE__ */ V(ne, {
2421
+ /* @__PURE__ */ V(ie, {
2347
2422
  current: g,
2348
2423
  items: C,
2349
2424
  style: {
@@ -2358,12 +2433,12 @@ function er({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStep
2358
2433
  }),
2359
2434
  m.map((e, t) => /* @__PURE__ */ V("div", {
2360
2435
  style: { display: g === t ? void 0 : "none" },
2361
- children: /* @__PURE__ */ V(on, {
2436
+ children: /* @__PURE__ */ V(hn, {
2362
2437
  sourcesRef: h[t],
2363
2438
  children: e.props.children
2364
2439
  })
2365
2440
  }, e.key ?? String(t))),
2366
- r && m.length > 1 ? /* @__PURE__ */ H(I, {
2441
+ r && m.length > 1 ? /* @__PURE__ */ H(F, {
2367
2442
  style: {
2368
2443
  marginTop: 16,
2369
2444
  ...c
@@ -2384,8 +2459,8 @@ function er({ children: t, initialStep: n = 0, showNavigation: r = !0, allowStep
2384
2459
  //#endregion
2385
2460
  //#region src/crud/fields/FieldWrapper.tsx
2386
2461
  function Q({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, children: o }) {
2387
- let s = t ?? e, c = !s.includes("."), { control: l } = G(), u = rn(), d = a ? void 0 : n ?? e, f = n ?? e;
2388
- return dn(e, c), fn(e, c), /* @__PURE__ */ V(ge, {
2462
+ let s = t ?? e, c = !s.includes("."), { control: l } = G(), u = pn(), d = a ? void 0 : n ?? e, f = n ?? e;
2463
+ return bn(e, c), xn(e, c), /* @__PURE__ */ V(xe, {
2389
2464
  name: s,
2390
2465
  control: l,
2391
2466
  rules: {
@@ -2410,7 +2485,7 @@ function Q({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a,
2410
2485
  }
2411
2486
  //#endregion
2412
2487
  //#region src/crud/fields/TextField.tsx
2413
- function tr({ source: e, name: t, label: n, required: r, rules: i, placeholder: a, inputStyle: o, hideLabel: s }) {
2488
+ function _r({ source: e, name: t, label: n, required: r, rules: i, placeholder: a, inputStyle: o, hideLabel: s }) {
2414
2489
  return /* @__PURE__ */ V(Q, {
2415
2490
  source: e,
2416
2491
  name: t,
@@ -2418,7 +2493,7 @@ function tr({ source: e, name: t, label: n, required: r, rules: i, placeholder:
2418
2493
  required: r,
2419
2494
  rules: i,
2420
2495
  hideLabel: s,
2421
- children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ V(k, {
2496
+ children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ V(A, {
2422
2497
  value: e,
2423
2498
  onChange: (e) => t(e.target.value),
2424
2499
  onBlur: n,
@@ -2430,7 +2505,7 @@ function tr({ source: e, name: t, label: n, required: r, rules: i, placeholder:
2430
2505
  }
2431
2506
  //#endregion
2432
2507
  //#region src/crud/fields/NumberField.tsx
2433
- function nr({ source: e, name: t, label: n, required: r, rules: i, min: a, max: o, step: s, inputStyle: c, hideLabel: l }) {
2508
+ function vr({ source: e, name: t, label: n, required: r, rules: i, min: a, max: o, step: s, inputStyle: c, hideLabel: l }) {
2434
2509
  return /* @__PURE__ */ V(Q, {
2435
2510
  source: e,
2436
2511
  name: t,
@@ -2438,7 +2513,7 @@ function nr({ source: e, name: t, label: n, required: r, rules: i, min: a, max:
2438
2513
  required: r,
2439
2514
  rules: i,
2440
2515
  hideLabel: l,
2441
- children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ V(A, {
2516
+ children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ V(te, {
2442
2517
  value: e,
2443
2518
  onChange: (e) => t(e),
2444
2519
  onBlur: n,
@@ -2455,7 +2530,7 @@ function nr({ source: e, name: t, label: n, required: r, rules: i, min: a, max:
2455
2530
  }
2456
2531
  //#endregion
2457
2532
  //#region src/crud/fields/BooleanField.tsx
2458
- function rr({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a }) {
2533
+ function yr({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a }) {
2459
2534
  return /* @__PURE__ */ V(Q, {
2460
2535
  source: e,
2461
2536
  name: t,
@@ -2463,7 +2538,7 @@ function rr({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a
2463
2538
  required: r,
2464
2539
  rules: i,
2465
2540
  hideLabel: a,
2466
- children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ V(re, {
2541
+ children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ V(ae, {
2467
2542
  checked: !!e,
2468
2543
  onChange: t,
2469
2544
  disabled: n
@@ -2472,8 +2547,8 @@ function rr({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a
2472
2547
  }
2473
2548
  //#endregion
2474
2549
  //#region src/crud/fields/DateField.tsx
2475
- var ir = "YYYY-MM-DD";
2476
- function ar({ source: e, name: t, label: n, required: r, rules: i, showTime: a, hideLabel: o }) {
2550
+ var br = "YYYY-MM-DD";
2551
+ function xr({ source: e, name: t, label: n, required: r, rules: i, showTime: a, hideLabel: o }) {
2477
2552
  return /* @__PURE__ */ V(Q, {
2478
2553
  source: e,
2479
2554
  name: t,
@@ -2482,19 +2557,19 @@ function ar({ source: e, name: t, label: n, required: r, rules: i, showTime: a,
2482
2557
  rules: i,
2483
2558
  hideLabel: o,
2484
2559
  children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ V(w, {
2485
- value: e ? xe(String(e)) : null,
2486
- onChange: (e) => t(e ? e.format(a ? `${ir} HH:mm:ss` : ir) : null),
2560
+ value: e ? Ee(String(e)) : null,
2561
+ onChange: (e) => t(e ? e.format(a ? `${br} HH:mm:ss` : br) : null),
2487
2562
  onBlur: n,
2488
2563
  showTime: a,
2489
2564
  disabled: r,
2490
- format: a ? `${ir} HH:mm:ss` : ir,
2565
+ format: a ? `${br} HH:mm:ss` : br,
2491
2566
  style: { width: "100%" }
2492
2567
  })
2493
2568
  });
2494
2569
  }
2495
2570
  //#endregion
2496
2571
  //#region src/crud/fields/SelectField.tsx
2497
- function or({ source: e, name: t, label: n, required: r, rules: i, choices: a, mode: o, allowClear: s, hideLabel: c }) {
2572
+ function Sr({ source: e, name: t, label: n, required: r, rules: i, choices: a, mode: o, allowClear: s, hideLabel: c }) {
2498
2573
  return /* @__PURE__ */ V(Q, {
2499
2574
  source: e,
2500
2575
  name: t,
@@ -2502,7 +2577,7 @@ function or({ source: e, name: t, label: n, required: r, rules: i, choices: a, m
2502
2577
  required: r,
2503
2578
  rules: i,
2504
2579
  hideLabel: c,
2505
- children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ V(F, {
2580
+ children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ V(P, {
2506
2581
  value: e,
2507
2582
  onChange: t,
2508
2583
  options: a,
@@ -2515,7 +2590,7 @@ function or({ source: e, name: t, label: n, required: r, rules: i, choices: a, m
2515
2590
  }
2516
2591
  //#endregion
2517
2592
  //#region src/crud/fields/PasswordField.tsx
2518
- function sr({ source: e, name: t, label: n, required: r, rules: i, autoComplete: a, hideLabel: o }) {
2593
+ function Cr({ source: e, name: t, label: n, required: r, rules: i, autoComplete: a, hideLabel: o }) {
2519
2594
  return /* @__PURE__ */ V(Q, {
2520
2595
  source: e,
2521
2596
  name: t,
@@ -2523,7 +2598,7 @@ function sr({ source: e, name: t, label: n, required: r, rules: i, autoComplete:
2523
2598
  required: r,
2524
2599
  rules: i,
2525
2600
  hideLabel: o,
2526
- children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ V(k.Password, {
2601
+ children: ({ value: e, onChange: t, onBlur: n, disabled: r }) => /* @__PURE__ */ V(A.Password, {
2527
2602
  value: e,
2528
2603
  onChange: (e) => t(e.target.value),
2529
2604
  onBlur: n,
@@ -2532,12 +2607,12 @@ function sr({ source: e, name: t, label: n, required: r, rules: i, autoComplete:
2532
2607
  })
2533
2608
  });
2534
2609
  }
2535
- function cr({ source: e, name: t, label: n, required: r, rules: i, confirmSource: a, confirmLabel: o = "Confirm password", autoComplete: s = "new-password", hideLabel: c }) {
2536
- let l = be({
2610
+ function wr({ source: e, name: t, label: n, required: r, rules: i, confirmSource: a, confirmLabel: o = "Confirm password", autoComplete: s = "new-password", hideLabel: c }) {
2611
+ let l = Te({
2537
2612
  name: t ?? e,
2538
2613
  disabled: !a
2539
2614
  });
2540
- return a ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V(sr, {
2615
+ return a ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V(Cr, {
2541
2616
  source: e,
2542
2617
  name: t,
2543
2618
  label: n,
@@ -2545,14 +2620,14 @@ function cr({ source: e, name: t, label: n, required: r, rules: i, confirmSource
2545
2620
  rules: i,
2546
2621
  autoComplete: s,
2547
2622
  hideLabel: c
2548
- }), /* @__PURE__ */ V(sr, {
2623
+ }), /* @__PURE__ */ V(Cr, {
2549
2624
  source: a,
2550
2625
  label: o,
2551
2626
  required: r,
2552
2627
  autoComplete: s,
2553
2628
  hideLabel: c,
2554
2629
  rules: { validate: (e) => !l || e === l || "Passwords do not match" }
2555
- })] }) : /* @__PURE__ */ V(sr, {
2630
+ })] }) : /* @__PURE__ */ V(Cr, {
2556
2631
  source: e,
2557
2632
  name: t,
2558
2633
  label: n,
@@ -2564,14 +2639,14 @@ function cr({ source: e, name: t, label: n, required: r, rules: i, confirmSource
2564
2639
  }
2565
2640
  //#endregion
2566
2641
  //#region src/crud/utils/useChoices.ts
2567
- var lr = /* @__PURE__ */ new Map(), ur = /* @__PURE__ */ new Map();
2568
- function dr(e, t) {
2642
+ var Tr = /* @__PURE__ */ new Map(), Er = /* @__PURE__ */ new Map();
2643
+ function Dr(e, t) {
2569
2644
  return typeof e == "function" ? `fn:${t ?? ""}` : Array.isArray(e) ? `static:${e.length}` : `res:${e.resource}:${JSON.stringify(e.filter ?? {})}:${t ?? ""}`;
2570
2645
  }
2571
- function fr(e, t) {
2646
+ function Or(e, t) {
2572
2647
  return typeof t == "function" ? t(e) : String(e[t] ?? "");
2573
2648
  }
2574
- async function pr(e, t, n, r, i) {
2649
+ async function kr(e, t, n, r, i) {
2575
2650
  return typeof e == "function" ? e({
2576
2651
  dataProvider: t,
2577
2652
  search: i
@@ -2585,23 +2660,23 @@ async function pr(e, t, n, r, i) {
2585
2660
  perPage: 500
2586
2661
  }
2587
2662
  })).data.map((e) => ({
2588
- label: fr(e, n),
2663
+ label: Or(e, n),
2589
2664
  value: e[r],
2590
2665
  record: e
2591
2666
  }));
2592
2667
  }
2593
- function mr(e, t, n, r, i) {
2594
- let a = dr(e, i), o = lr.get(a);
2668
+ function Ar(e, t, n, r, i) {
2669
+ let a = Dr(e, i), o = Tr.get(a);
2595
2670
  if (o && !i) return Promise.resolve(o);
2596
- let s = ur.get(a);
2671
+ let s = Er.get(a);
2597
2672
  if (s) return s;
2598
- let c = pr(e, t, n, r, i).then((e) => (i || lr.set(a, e), e)).finally(() => {
2599
- ur.delete(a);
2673
+ let c = kr(e, t, n, r, i).then((e) => (i || Tr.set(a, e), e)).finally(() => {
2674
+ Er.delete(a);
2600
2675
  });
2601
- return ur.set(a, c), c;
2676
+ return Er.set(a, c), c;
2602
2677
  }
2603
2678
  function $(e, t, n = "name", r = "id", a) {
2604
- let c = mt(), u = s(() => {
2679
+ let c = yt(), u = s(() => {
2605
2680
  if (e) return e;
2606
2681
  if (t) return {
2607
2682
  resource: t,
@@ -2611,19 +2686,19 @@ function $(e, t, n = "name", r = "id", a) {
2611
2686
  e,
2612
2687
  t,
2613
2688
  a
2614
- ]), d = u ? dr(u, a) : void 0, [f, p] = l(() => !d || a ? [] : lr.get(d) ?? []), [m, h] = l(() => !d || a ? !!u : !lr.has(d)), g = i(async () => {
2689
+ ]), d = u ? Dr(u, a) : void 0, [f, p] = l(() => !d || a ? [] : Tr.get(d) ?? []), [m, h] = l(() => !d || a ? !!u : !Tr.has(d)), g = i(async () => {
2615
2690
  if (!u) {
2616
2691
  p([]), h(!1);
2617
2692
  return;
2618
2693
  }
2619
- let e = dr(u, a), t = lr.get(e);
2694
+ let e = Dr(u, a), t = Tr.get(e);
2620
2695
  if (t && !a) {
2621
2696
  p(t), h(!1);
2622
2697
  return;
2623
2698
  }
2624
2699
  h(!0);
2625
2700
  try {
2626
- p(await mr(u, c, n, r, a));
2701
+ p(await Ar(u, c, n, r, a));
2627
2702
  } catch {
2628
2703
  p([]);
2629
2704
  } finally {
@@ -2651,7 +2726,7 @@ function $(e, t, n = "name", r = "id", a) {
2651
2726
  }
2652
2727
  //#endregion
2653
2728
  //#region src/crud/fields/ReferenceField.tsx
2654
- function hr({ source: e, name: t, label: n, reference: r, choices: i, optionLabel: a = "name", optionValue: o = "id", required: c, rules: u, search: d, allowClear: f, disabled: p, hideLabel: m, inputStyle: h, onValueChange: g }) {
2729
+ function jr({ source: e, name: t, label: n, reference: r, choices: i, optionLabel: a = "name", optionValue: o = "id", required: c, rules: u, search: d, allowClear: f, disabled: p, hideLabel: m, inputStyle: h, onValueChange: g }) {
2655
2730
  let [_, v] = l(), { options: y, loading: b, optionForValue: x } = $(i, r, a, o, d ? _ : void 0), S = s(() => y.map((e) => ({
2656
2731
  label: e.label,
2657
2732
  value: e.value
@@ -2663,7 +2738,7 @@ function hr({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
2663
2738
  required: c,
2664
2739
  rules: u,
2665
2740
  hideLabel: m,
2666
- children: ({ value: e, onChange: t, disabled: n, name: r }) => /* @__PURE__ */ V(F, {
2741
+ children: ({ value: e, onChange: t, disabled: n, name: r }) => /* @__PURE__ */ V(P, {
2667
2742
  value: e,
2668
2743
  onChange: (e) => {
2669
2744
  t(e), g?.(e, x(e), { name: r });
@@ -2686,7 +2761,7 @@ function hr({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
2686
2761
  }
2687
2762
  //#endregion
2688
2763
  //#region src/crud/fields/ReferenceManyField.tsx
2689
- function gr({ source: e, name: t, label: n, reference: r, choices: i, optionLabel: a = "name", optionValue: o = "id", required: c, rules: u, search: d, allowClear: f = !0, hideLabel: p }) {
2764
+ function Mr({ source: e, name: t, label: n, reference: r, choices: i, optionLabel: a = "name", optionValue: o = "id", required: c, rules: u, search: d, allowClear: f = !0, hideLabel: p }) {
2690
2765
  let [m, h] = l(), { options: g, loading: _ } = $(i, r, a, o, d ? m : void 0), v = s(() => g.map((e) => ({
2691
2766
  label: e.label,
2692
2767
  value: e.value
@@ -2698,7 +2773,7 @@ function gr({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
2698
2773
  required: c,
2699
2774
  rules: u,
2700
2775
  hideLabel: p,
2701
- children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ V(F, {
2776
+ children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ V(P, {
2702
2777
  mode: "multiple",
2703
2778
  value: e ?? [],
2704
2779
  onChange: t,
@@ -2715,8 +2790,166 @@ function gr({ source: e, name: t, label: n, reference: r, choices: i, optionLabe
2715
2790
  });
2716
2791
  }
2717
2792
  //#endregion
2793
+ //#region src/crud/fields/uploadFieldUtils.ts
2794
+ function Nr(e) {
2795
+ return e instanceof File ? !0 : typeof e == "string" && e.length > 0;
2796
+ }
2797
+ function Pr(e) {
2798
+ if (e instanceof File) return e.name;
2799
+ if (typeof e == "string" && e.length > 0) try {
2800
+ return new URL(e, "http://local").pathname.split("/").filter(Boolean).pop() || e;
2801
+ } catch {
2802
+ return e.split("/").filter(Boolean).pop() || e;
2803
+ }
2804
+ }
2805
+ //#endregion
2806
+ //#region src/crud/fields/useUploadPreviewUrl.ts
2807
+ function Fr(e) {
2808
+ let [t, n] = l();
2809
+ if (o(() => {
2810
+ if (e instanceof File) {
2811
+ let t = URL.createObjectURL(e);
2812
+ return n(t), () => URL.revokeObjectURL(t);
2813
+ }
2814
+ n(void 0);
2815
+ }, [e]), e instanceof File) return t;
2816
+ if (typeof e == "string" && e.length > 0) return e;
2817
+ }
2818
+ //#endregion
2819
+ //#region src/crud/fields/ImageField.tsx
2820
+ function Ir({ value: e, onChange: t, disabled: n, clearable: r, accept: i = "image/*", previewWidth: a = 200 }) {
2821
+ let o = c(null), s = Fr(e), l = r && Nr(e);
2822
+ return /* @__PURE__ */ H(F, {
2823
+ direction: "vertical",
2824
+ size: "middle",
2825
+ style: { width: "100%" },
2826
+ children: [
2827
+ s ? /* @__PURE__ */ V(k, {
2828
+ src: s,
2829
+ alt: "",
2830
+ style: {
2831
+ maxWidth: a,
2832
+ maxHeight: a,
2833
+ objectFit: "contain"
2834
+ }
2835
+ }) : null,
2836
+ /* @__PURE__ */ H(F, {
2837
+ wrap: !0,
2838
+ children: [/* @__PURE__ */ V(x, {
2839
+ icon: /* @__PURE__ */ V(ye, {}),
2840
+ disabled: n,
2841
+ onClick: () => o.current?.click(),
2842
+ children: "Choose image"
2843
+ }), l ? /* @__PURE__ */ V(x, {
2844
+ icon: /* @__PURE__ */ V(ue, {}),
2845
+ disabled: n,
2846
+ onClick: () => {
2847
+ t(null), o.current && (o.current.value = "");
2848
+ },
2849
+ children: "Clear"
2850
+ }) : null]
2851
+ }),
2852
+ /* @__PURE__ */ V("input", {
2853
+ ref: o,
2854
+ type: "file",
2855
+ accept: i,
2856
+ disabled: n,
2857
+ tabIndex: -1,
2858
+ "aria-hidden": !0,
2859
+ style: { display: "none" },
2860
+ onChange: (e) => {
2861
+ let n = e.target.files?.[0];
2862
+ t(n ?? null), e.target.value = "";
2863
+ }
2864
+ })
2865
+ ]
2866
+ });
2867
+ }
2868
+ function Lr({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, clearable: o, accept: s, previewWidth: c }) {
2869
+ return /* @__PURE__ */ V(Q, {
2870
+ source: e,
2871
+ name: t,
2872
+ label: n,
2873
+ required: r,
2874
+ rules: i,
2875
+ hideLabel: a,
2876
+ children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ V(Ir, {
2877
+ value: e,
2878
+ onChange: t,
2879
+ disabled: n,
2880
+ clearable: o,
2881
+ accept: s,
2882
+ previewWidth: c
2883
+ })
2884
+ });
2885
+ }
2886
+ //#endregion
2887
+ //#region src/crud/fields/FileField.tsx
2888
+ function Rr({ value: e, onChange: t, disabled: n, clearable: r, accept: i }) {
2889
+ let a = c(null), o = Pr(e), s = typeof e == "string" && e.length > 0 ? e : void 0, l = r && Nr(e);
2890
+ return /* @__PURE__ */ H(F, {
2891
+ direction: "vertical",
2892
+ size: "middle",
2893
+ style: { width: "100%" },
2894
+ children: [
2895
+ o ? /* @__PURE__ */ H(F, { children: [/* @__PURE__ */ V(ge, {}), s ? /* @__PURE__ */ V(R.Link, {
2896
+ href: s,
2897
+ target: "_blank",
2898
+ rel: "noopener noreferrer",
2899
+ children: o
2900
+ }) : /* @__PURE__ */ V(R.Text, { children: o })] }) : null,
2901
+ /* @__PURE__ */ H(F, {
2902
+ wrap: !0,
2903
+ children: [/* @__PURE__ */ V(x, {
2904
+ icon: /* @__PURE__ */ V(ye, {}),
2905
+ disabled: n,
2906
+ onClick: () => a.current?.click(),
2907
+ children: "Choose file"
2908
+ }), l ? /* @__PURE__ */ V(x, {
2909
+ icon: /* @__PURE__ */ V(ue, {}),
2910
+ disabled: n,
2911
+ onClick: () => {
2912
+ t(null), a.current && (a.current.value = "");
2913
+ },
2914
+ children: "Clear"
2915
+ }) : null]
2916
+ }),
2917
+ /* @__PURE__ */ V("input", {
2918
+ ref: a,
2919
+ type: "file",
2920
+ accept: i,
2921
+ disabled: n,
2922
+ tabIndex: -1,
2923
+ "aria-hidden": !0,
2924
+ style: { display: "none" },
2925
+ onChange: (e) => {
2926
+ let n = e.target.files?.[0];
2927
+ t(n ?? null), e.target.value = "";
2928
+ }
2929
+ })
2930
+ ]
2931
+ });
2932
+ }
2933
+ function zr({ source: e, name: t, label: n, required: r, rules: i, hideLabel: a, clearable: o, accept: s }) {
2934
+ return /* @__PURE__ */ V(Q, {
2935
+ source: e,
2936
+ name: t,
2937
+ label: n,
2938
+ required: r,
2939
+ rules: i,
2940
+ hideLabel: a,
2941
+ children: ({ value: e, onChange: t, disabled: n }) => /* @__PURE__ */ V(Rr, {
2942
+ value: e,
2943
+ onChange: t,
2944
+ disabled: n,
2945
+ clearable: o,
2946
+ accept: s
2947
+ })
2948
+ });
2949
+ }
2950
+ //#endregion
2718
2951
  //#region src/crud/columns/TextColumn.tsx
2719
- function _r({ source: e, label: t, sortable: n = !0 }) {
2952
+ function Br({ source: e, label: t, sortable: n = !0 }) {
2720
2953
  return X(s(() => ({
2721
2954
  key: e,
2722
2955
  source: e,
@@ -2734,12 +2967,12 @@ function _r({ source: e, label: t, sortable: n = !0 }) {
2734
2967
  n
2735
2968
  ])), null;
2736
2969
  }
2737
- function vr(e, t, n) {
2738
- return typeof n == "function" ? n(e) : n ? pn(e, n) : e[t];
2970
+ function Vr(e, t, n) {
2971
+ return typeof n == "function" ? n(e) : n ? Sn(e, n) : e[t];
2739
2972
  }
2740
2973
  //#endregion
2741
2974
  //#region src/crud/columns/NumberColumn.tsx
2742
- function yr({ source: e, label: t, sortable: n = !0 }) {
2975
+ function Hr({ source: e, label: t, sortable: n = !0 }) {
2743
2976
  return X(s(() => ({
2744
2977
  key: e,
2745
2978
  source: e,
@@ -2759,7 +2992,7 @@ function yr({ source: e, label: t, sortable: n = !0 }) {
2759
2992
  }
2760
2993
  //#endregion
2761
2994
  //#region src/crud/columns/BooleanColumn.tsx
2762
- function br({ source: e, label: t, sortable: n = !0 }) {
2995
+ function Ur({ source: e, label: t, sortable: n = !0 }) {
2763
2996
  return X(s(() => ({
2764
2997
  key: e,
2765
2998
  source: e,
@@ -2780,7 +3013,7 @@ function br({ source: e, label: t, sortable: n = !0 }) {
2780
3013
  }
2781
3014
  //#endregion
2782
3015
  //#region src/crud/columns/DateColumn.tsx
2783
- function xr({ source: e, label: t, sortable: n = !0 }) {
3016
+ function Wr({ source: e, label: t, sortable: n = !0 }) {
2784
3017
  return X(s(() => ({
2785
3018
  key: e,
2786
3019
  source: e,
@@ -2801,16 +3034,16 @@ function xr({ source: e, label: t, sortable: n = !0 }) {
2801
3034
  }
2802
3035
  //#endregion
2803
3036
  //#region src/crud/columns/ReferenceColumn.tsx
2804
- function Sr({ record: e, source: t, display: n, reference: r, choices: i, optionLabel: a, optionValue: o }) {
3037
+ function Gr({ record: e, source: t, display: n, reference: r, choices: i, optionLabel: a, optionValue: o }) {
2805
3038
  let { labelForValue: s } = $(i, r, a, o), c = e[t];
2806
3039
  if (typeof n == "function") return /* @__PURE__ */ V(B, { children: n(e) });
2807
3040
  if (n && n !== t) {
2808
- let r = vr(e, t, n);
3041
+ let r = Vr(e, t, n);
2809
3042
  return /* @__PURE__ */ V(B, { children: r == null ? "—" : String(r) });
2810
3043
  }
2811
3044
  return /* @__PURE__ */ V(B, { children: s(c) });
2812
3045
  }
2813
- function Cr({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", display: o, sortable: c = !0 }) {
3046
+ function Kr({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", display: o, sortable: c = !0 }) {
2814
3047
  return X(s(() => ({
2815
3048
  key: e,
2816
3049
  source: e,
@@ -2821,7 +3054,7 @@ function Cr({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
2821
3054
  dataIndex: e,
2822
3055
  key: e,
2823
3056
  sorter: c ? !0 : void 0,
2824
- render: (s, c) => /* @__PURE__ */ V(Sr, {
3057
+ render: (s, c) => /* @__PURE__ */ V(Gr, {
2825
3058
  record: c,
2826
3059
  source: e,
2827
3060
  label: t,
@@ -2845,11 +3078,11 @@ function Cr({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
2845
3078
  }
2846
3079
  //#endregion
2847
3080
  //#region src/crud/columns/ReferenceManyColumn.tsx
2848
- function wr({ record: e, source: t, reference: n, choices: r, optionLabel: i, optionValue: a }) {
3081
+ function qr({ record: e, source: t, reference: n, choices: r, optionLabel: i, optionValue: a }) {
2849
3082
  let { labelsForValues: o } = $(r, n, i, a), s = e[t];
2850
3083
  return /* @__PURE__ */ V(B, { children: o(Array.isArray(s) ? s : []) });
2851
3084
  }
2852
- function Tr({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", sortable: o = !1 }) {
3085
+ function Jr({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", sortable: o = !1 }) {
2853
3086
  return X(s(() => ({
2854
3087
  key: e,
2855
3088
  source: e,
@@ -2860,7 +3093,7 @@ function Tr({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
2860
3093
  dataIndex: e,
2861
3094
  key: e,
2862
3095
  sorter: o ? !0 : void 0,
2863
- render: (t, o) => /* @__PURE__ */ V(wr, {
3096
+ render: (t, o) => /* @__PURE__ */ V(qr, {
2864
3097
  record: o,
2865
3098
  source: e,
2866
3099
  reference: n,
@@ -2880,8 +3113,43 @@ function Tr({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
2880
3113
  ])), null;
2881
3114
  }
2882
3115
  //#endregion
3116
+ //#region src/crud/columns/ImageColumn.tsx
3117
+ function Yr({ source: e, label: t, sortable: n = !1, width: r = 40, height: i = 40, objectFit: a = "cover", borderRadius: o = 4, alt: c = "" }) {
3118
+ return X(s(() => ({
3119
+ key: e,
3120
+ source: e,
3121
+ label: t,
3122
+ sortable: n,
3123
+ buildColumn: () => ({
3124
+ title: t ?? e,
3125
+ dataIndex: e,
3126
+ key: e,
3127
+ sorter: n ? !0 : void 0,
3128
+ render: (e) => e == null || e === "" ? null : /* @__PURE__ */ V("img", {
3129
+ src: String(e),
3130
+ alt: c,
3131
+ style: {
3132
+ width: r,
3133
+ height: i,
3134
+ objectFit: a,
3135
+ borderRadius: o
3136
+ }
3137
+ })
3138
+ })
3139
+ }), [
3140
+ e,
3141
+ t,
3142
+ n,
3143
+ r,
3144
+ i,
3145
+ a,
3146
+ o,
3147
+ c
3148
+ ])), null;
3149
+ }
3150
+ //#endregion
2883
3151
  //#region src/crud/columns/CustomColumn.tsx
2884
- function Er({ source: e, label: t, sortable: n = !1, render: r }) {
3152
+ function Xr({ source: e, label: t, sortable: n = !1, render: r }) {
2885
3153
  return X(s(() => ({
2886
3154
  key: e,
2887
3155
  source: e,
@@ -2901,12 +3169,12 @@ function Er({ source: e, label: t, sortable: n = !1, render: r }) {
2901
3169
  }
2902
3170
  //#endregion
2903
3171
  //#region src/crud/filters/TextFilter.tsx
2904
- function Dr({ source: e, label: t, placeholder: n }) {
3172
+ function Zr({ source: e, label: t, placeholder: n }) {
2905
3173
  return Z(s(() => ({
2906
3174
  key: e,
2907
3175
  source: e,
2908
3176
  label: t,
2909
- render: ({ value: r, onChange: i }) => /* @__PURE__ */ V(k, {
3177
+ render: ({ value: r, onChange: i }) => /* @__PURE__ */ V(A, {
2910
3178
  allowClear: !0,
2911
3179
  placeholder: n ?? t ?? e,
2912
3180
  value: r ?? "",
@@ -2921,12 +3189,12 @@ function Dr({ source: e, label: t, placeholder: n }) {
2921
3189
  }
2922
3190
  //#endregion
2923
3191
  //#region src/crud/filters/NumberFilter.tsx
2924
- function Or({ source: e, label: t }) {
3192
+ function Qr({ source: e, label: t }) {
2925
3193
  return Z(s(() => ({
2926
3194
  key: e,
2927
3195
  source: e,
2928
3196
  label: t,
2929
- render: ({ value: n, onChange: r }) => /* @__PURE__ */ V(A, {
3197
+ render: ({ value: n, onChange: r }) => /* @__PURE__ */ V(te, {
2930
3198
  placeholder: t ?? e,
2931
3199
  value: n,
2932
3200
  onChange: (e) => r(e ?? void 0),
@@ -2936,12 +3204,12 @@ function Or({ source: e, label: t }) {
2936
3204
  }
2937
3205
  //#endregion
2938
3206
  //#region src/crud/filters/BooleanFilter.tsx
2939
- function kr({ source: e, label: t }) {
3207
+ function $r({ source: e, label: t }) {
2940
3208
  return Z(s(() => ({
2941
3209
  key: e,
2942
3210
  source: e,
2943
3211
  label: t,
2944
- render: ({ value: n, onChange: r }) => /* @__PURE__ */ V(F, {
3212
+ render: ({ value: n, onChange: r }) => /* @__PURE__ */ V(P, {
2945
3213
  allowClear: !0,
2946
3214
  placeholder: t ?? e,
2947
3215
  value: n,
@@ -2959,7 +3227,7 @@ function kr({ source: e, label: t }) {
2959
3227
  }
2960
3228
  //#endregion
2961
3229
  //#region src/crud/filters/DateFilter.tsx
2962
- function Ar({ source: e, label: t }) {
3230
+ function ei({ source: e, label: t }) {
2963
3231
  return Z(s(() => ({
2964
3232
  key: e,
2965
3233
  source: e,
@@ -2967,7 +3235,7 @@ function Ar({ source: e, label: t }) {
2967
3235
  render: ({ value: n, onChange: r }) => /* @__PURE__ */ V(w, {
2968
3236
  allowClear: !0,
2969
3237
  placeholder: t ?? e,
2970
- value: n ? xe(String(n)) : null,
3238
+ value: n ? Ee(String(n)) : null,
2971
3239
  onChange: (e) => r(e ? e.format("YYYY-MM-DD") : void 0),
2972
3240
  style: { minWidth: 160 }
2973
3241
  })
@@ -2975,12 +3243,12 @@ function Ar({ source: e, label: t }) {
2975
3243
  }
2976
3244
  //#endregion
2977
3245
  //#region src/crud/filters/SelectFilter.tsx
2978
- function jr({ source: e, label: t, choices: n, multiple: r }) {
3246
+ function ti({ source: e, label: t, choices: n, multiple: r }) {
2979
3247
  return Z(s(() => ({
2980
3248
  key: e,
2981
3249
  source: e,
2982
3250
  label: t,
2983
- render: ({ value: i, onChange: a }) => /* @__PURE__ */ V(F, {
3251
+ render: ({ value: i, onChange: a }) => /* @__PURE__ */ V(P, {
2984
3252
  allowClear: !0,
2985
3253
  mode: r ? "multiple" : void 0,
2986
3254
  placeholder: t ?? e,
@@ -2998,9 +3266,9 @@ function jr({ source: e, label: t, choices: n, multiple: r }) {
2998
3266
  }
2999
3267
  //#endregion
3000
3268
  //#region src/crud/filters/ReferenceFilter.tsx
3001
- function Mr({ source: e, label: t, reference: n, choices: r, optionLabel: i, optionValue: a, multiple: o, search: s, value: c, onChange: u }) {
3269
+ function ni({ source: e, label: t, reference: n, choices: r, optionLabel: i, optionValue: a, multiple: o, search: s, value: c, onChange: u }) {
3002
3270
  let [d, f] = l(), { options: p, loading: m } = $(r, n, i, a, s ? d : void 0);
3003
- return /* @__PURE__ */ V(F, {
3271
+ return /* @__PURE__ */ V(P, {
3004
3272
  allowClear: !0,
3005
3273
  mode: o ? "multiple" : void 0,
3006
3274
  placeholder: t ?? e,
@@ -3018,12 +3286,12 @@ function Mr({ source: e, label: t, reference: n, choices: r, optionLabel: i, opt
3018
3286
  style: { minWidth: 180 }
3019
3287
  });
3020
3288
  }
3021
- function Nr({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", multiple: o, search: c }) {
3289
+ function ri({ source: e, label: t, reference: n, choices: r, optionLabel: i = "name", optionValue: a = "id", multiple: o, search: c }) {
3022
3290
  return Z(s(() => ({
3023
3291
  key: e,
3024
3292
  source: e,
3025
3293
  label: t,
3026
- render: ({ value: s, onChange: l }) => /* @__PURE__ */ V(Mr, {
3294
+ render: ({ value: s, onChange: l }) => /* @__PURE__ */ V(ni, {
3027
3295
  source: e,
3028
3296
  label: t,
3029
3297
  reference: n,
@@ -3046,11 +3314,11 @@ function Nr({ source: e, label: t, reference: n, choices: r, optionLabel: i = "n
3046
3314
  c
3047
3315
  ])), null;
3048
3316
  }
3049
- function Pr(e) {
3050
- return /* @__PURE__ */ V(Nr, {
3317
+ function ii(e) {
3318
+ return /* @__PURE__ */ V(ri, {
3051
3319
  ...e,
3052
3320
  multiple: !0
3053
3321
  });
3054
3322
  }
3055
3323
  //#endregion
3056
- export { dt as AdminApp, $e as AdminLayout, Oe as AppThemeProvider, Ht as AuthAlternateLink, Ut as AuthPageLayout, Ie as AuthProvider, br as BooleanColumn, rr as BooleanField, kr as BooleanFilter, Er as CustomColumn, pt as DataProvider, xr as DateColumn, ar as DateField, Ar as DateFilter, je as DensitySwitch, Q as FieldWrapper, Nn as FilterBar, Qn as FormStep, er as FormSteps, Yn as FormTab, Zn as FormTabs, et as Guard, nt as GuestOnly, Rn as InlineFormSet, zn as InlineFormSetStacked, Wt as LoginPage, yr as NumberColumn, nr as NumberField, Or as NumberFilter, cr as PasswordField, Ve as PermissionsProvider, Gt as PlaceholderPage, tt as Protected, Cr as ReferenceColumn, hr as ReferenceField, Nr as ReferenceFilter, Tr as ReferenceManyColumn, gr as ReferenceManyField, Pr as ReferenceManyFilter, rt as RequirePermission, Gn as ResourceForm, bn as ResourceFormModal, jn as ResourceList, or as SelectField, jr as SelectFilter, _r as TextColumn, tr as TextField, Dr as TextFilter, Ne as ThemeSwitch, Pe as ThemeToolbar, Ft as applyInMemoryListParams, xt as applyInlineFieldPaths, Y as asStringMessages, _t as combineResourceHandlers, ut as createAdminRouter, It as createMemoryResourceHandlers, He as createPermissionsChecker, Lt as createRestResourceHandlers, ze as createSessionStorageAuthAdapter, ct as deriveAuthPaths, We as filterNavByPermission, Nt as filterRows, St as finalizeFormErrors, pn as getByPath, bt as getErrorBody, it as getRouteAccess, At as getRowById, Pn as inlineArrayName, Fn as inlineFieldName, vt as isAbortError, Vn as loadInlineRows, wt as parseDjangoDRFFormErrors, Tt as parseDotNetFormErrors, Et as parseNodeFormErrors, at as partitionAdminRoutes, hn as pickBySources, Bn as saveInlineRows, zt as toDjangoRestOrdering, Vt as toJsonApiSort, Bt as toODataOrderBy, yn as useAbortableEffect, Le as useAuth, Ue as useCan, $ as useChoices, mt as useDataProvider, Dn as useListQueryState, q as usePermissions, kn as useResourceListContext, fn as useSectionField, dn as useSubmitField, ke as useThemeMode };
3324
+ export { gt as AdminApp, it as AdminLayout, Ne as AppThemeProvider, Zt as AuthAlternateLink, Qt as AuthPageLayout, Ve as AuthProvider, Ur as BooleanColumn, yr as BooleanField, $r as BooleanFilter, Xr as CustomColumn, vt as DataProvider, Wr as DateColumn, xr as DateField, ei as DateFilter, Ie as DensitySwitch, Q as FieldWrapper, zr as FileField, Yn as FilterBar, mr as FormStep, gr as FormSteps, dr as FormTab, pr as FormTabs, at as Guard, st as GuestOnly, Yr as ImageColumn, Lr as ImageField, or as InlineFormSet, sr as InlineFormSetStacked, $t as LoginPage, Hr as NumberColumn, vr as NumberField, Qr as NumberFilter, wr as PasswordField, Ke as PermissionsProvider, en as PlaceholderPage, ot as Protected, Kr as ReferenceColumn, jr as ReferenceField, ri as ReferenceFilter, Jr as ReferenceManyColumn, Mr as ReferenceManyField, ii as ReferenceManyFilter, ct as RequirePermission, nr as ResourceForm, In as ResourceFormModal, qn as ResourceList, Sr as SelectField, ti as SelectFilter, Br as TextColumn, _r as TextField, Zr as TextFilter, Re as ThemeSwitch, ze as ThemeToolbar, Wt as applyInMemoryListParams, Y as asStringMessages, wn as buildFormPayload, Tn as buildInlineRowsPayload, jn as buildResourceFormSubmitBody, xt as combineResourceHandlers, ht as createAdminRouter, Gt as createMemoryResourceHandlers, qe as createPermissionsChecker, Kt as createRestResourceHandlers, We as createSessionStorageAuthAdapter, pt as deriveAuthPaths, Ye as filterNavByPermission, Ht as filterRows, At as finalizeFormErrors, kt as flattenNestedArrayErrors, Et as getErrorBody, Sn as getFormValue, lt as getRouteAccess, zt as getRowById, En as hasUploadValues, St as isAbortError, rr as nestedFieldPath, Nt as parseDjangoDRFFormErrors, Pt as parseDotNetFormErrors, Ft as parseNodeFormErrors, ut as partitionAdminRoutes, An as prepareFormSubmitBody, Dt as resolveErrorBody, Cn as setFormValue, Jt as toDjangoRestOrdering, kn as toFormData, Xt as toJsonApiSort, Yt as toODataOrderBy, Fn as useAbortableEffect, He as useAuth, Je as useCan, $ as useChoices, yt as useDataProvider, Un as useListQueryState, K as usePermissions, bn as useRegisterPayloadField, xn as useRegisterSectionField, Gn as useResourceListContext, Pe as useThemeMode };