react-admin-crud-manager 1.0.23 → 1.0.24

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.
package/dist/index.es.js CHANGED
@@ -1,65 +1,65 @@
1
- import { jsx as e, Fragment as j, jsxs as h } from "react/jsx-runtime";
2
- import Le, { useState as R, useRef as ee, useEffect as K, useMemo as Re } from "react";
3
- import { ChevronDown as Ie, Search as Oe, Check as Ye, X as Ne, Plus as Ve, Filter as We, ChevronLeft as qe, ChevronRight as Ze, EllipsisVertical as Je, User as Be, Music as Qe } from "lucide-react";
4
- import { createPortal as Xe } from "react-dom";
1
+ import { jsx as e, Fragment as E, jsxs as h } from "react/jsx-runtime";
2
+ import Oe, { useState as R, useRef as ae, useEffect as z, useMemo as Le } from "react";
3
+ import { ChevronDown as Be, Search as Ae, Check as Ve, X as Se, Plus as We, Filter as qe, ChevronLeft as Ze, ChevronRight as Je, EllipsisVertical as Qe, User as Ue, Music as Xe } from "lucide-react";
4
+ import { createPortal as ea } from "react-dom";
5
5
  import { Icon as re } from "@iconify/react";
6
- import { Editor as ea } from "@tinymce/tinymce-react";
7
- import { SnackbarProvider as aa, enqueueSnackbar as Se } from "notistack";
6
+ import { Editor as aa } from "@tinymce/tinymce-react";
7
+ import { SnackbarProvider as ta, enqueueSnackbar as Me } from "notistack";
8
8
  import r from "prop-types";
9
- const Ue = (b, o = "DD MMM YYYY") => {
10
- if (!b) return "N/A";
11
- const s = new Date(b);
12
- if (isNaN(s)) return "Invalid Date";
13
- const i = (t) => String(t).padStart(2, "0"), d = {
14
- YYYY: s.getFullYear(),
15
- YY: String(s.getFullYear()).slice(-2),
16
- MMMM: s.toLocaleString("en-US", { month: "long" }),
17
- MMM: s.toLocaleString("en-US", { month: "short" }),
18
- MM: i(s.getMonth() + 1),
19
- M: s.getMonth() + 1,
20
- DD: i(s.getDate()),
21
- D: s.getDate(),
22
- dddd: s.toLocaleString("en-US", { weekday: "long" }),
23
- ddd: s.toLocaleString("en-US", { weekday: "short" }),
24
- HH: i(s.getHours()),
25
- hh: i(s.getHours() % 12 || 12),
26
- mm: i(s.getMinutes()),
27
- ss: i(s.getSeconds()),
28
- A: s.getHours() >= 12 ? "PM" : "AM"
9
+ const je = (u, l = "DD MMM YYYY") => {
10
+ if (!u) return "N/A";
11
+ const i = new Date(u);
12
+ if (isNaN(i)) return "Invalid Date";
13
+ const o = (n) => String(n).padStart(2, "0"), d = {
14
+ YYYY: i.getFullYear(),
15
+ YY: String(i.getFullYear()).slice(-2),
16
+ MMMM: i.toLocaleString("en-US", { month: "long" }),
17
+ MMM: i.toLocaleString("en-US", { month: "short" }),
18
+ MM: o(i.getMonth() + 1),
19
+ M: i.getMonth() + 1,
20
+ DD: o(i.getDate()),
21
+ D: i.getDate(),
22
+ dddd: i.toLocaleString("en-US", { weekday: "long" }),
23
+ ddd: i.toLocaleString("en-US", { weekday: "short" }),
24
+ HH: o(i.getHours()),
25
+ hh: o(i.getHours() % 12 || 12),
26
+ mm: o(i.getMinutes()),
27
+ ss: o(i.getSeconds()),
28
+ A: i.getHours() >= 12 ? "PM" : "AM"
29
29
  };
30
- return o.replace(
30
+ return l.replace(
31
31
  /YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|ddd|HH|hh|mm|ss|A/g,
32
- (t) => d[t]
32
+ (n) => d[n]
33
33
  );
34
- }, ra = (b, o, s = []) => {
35
- if (!(o != null && o.trim())) return b;
36
- const i = o.toLowerCase(), d = (t) => t == null ? [] : typeof t == "object" ? Object.values(t).flatMap(d) : [String(t)];
37
- return b.filter((t) => {
38
- let g = [];
39
- return s.length > 0 ? s.forEach((M) => {
40
- t[M] !== void 0 && g.push(...d(t[M]));
41
- }) : g = d(t), g.some(
42
- (M) => M.toLowerCase().includes(i)
34
+ }, ra = (u, l, i = []) => {
35
+ if (!(l != null && l.trim())) return u;
36
+ const o = l.toLowerCase(), d = (n) => n == null ? [] : typeof n == "object" ? Object.values(n).flatMap(d) : [String(n)];
37
+ return u.filter((n) => {
38
+ let b = [];
39
+ return i.length > 0 ? i.forEach((S) => {
40
+ n[S] !== void 0 && b.push(...d(n[S]));
41
+ }) : b = d(n), b.some(
42
+ (S) => S.toLowerCase().includes(o)
43
43
  );
44
44
  });
45
- }, Z = Le.forwardRef(
45
+ }, Q = Oe.forwardRef(
46
46
  ({
47
- className: b = "",
48
- variant: o = "contained",
49
- color: s = "default",
50
- size: i = "default",
47
+ className: u = "",
48
+ variant: l = "contained",
49
+ color: i = "default",
50
+ size: o = "default",
51
51
  fullWidth: d = !1,
52
- children: t,
53
- ...g
54
- }, M) => {
55
- var c;
56
- const S = "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", p = {
52
+ children: n,
53
+ ...b
54
+ }, S) => {
55
+ var s;
56
+ const O = "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", c = {
57
57
  sm: "h-8 px-3 rounded-md text-sm",
58
58
  md: "h-9 px-4 rounded-md text-sm",
59
59
  lg: "h-11 px-6 rounded-md text-base",
60
60
  xl: "h-12 px-8 rounded-lg text-lg",
61
61
  default: "h-9 px-4 rounded-md text-sm"
62
- }, l = {
62
+ }, m = {
63
63
  primary: {
64
64
  contained: "bg-primary text-white hover:bg-primary-600 focus:ring-primary-500 shadow-sm",
65
65
  outlined: "border border-primary bg-transparent text-primary hover:bg-primary-50 focus:ring-primary-500",
@@ -80,151 +80,151 @@ const Ue = (b, o = "DD MMM YYYY") => {
80
80
  outlined: "border border-gray-300 bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-300 dark:border-gray-600 dark:text-gray-200 dark:hover:bg-gray-700 dark:focus:ring-gray-500",
81
81
  text: "bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-300 dark:text-gray-200 dark:hover:bg-gray-700 dark:focus:ring-gray-500"
82
82
  }
83
- }, u = ((c = l[s]) == null ? void 0 : c[o]) || l.default.contained, m = p[i], v = `
84
- ${S}
85
- ${u}
86
- ${m}
83
+ }, a = ((s = m[i]) == null ? void 0 : s[l]) || m.default.contained, f = c[o], y = `
84
+ ${O}
85
+ ${a}
86
+ ${f}
87
87
  ${d ? "w-full" : ""}
88
- ${b}
88
+ ${u}
89
89
  `.trim();
90
90
  return /* @__PURE__ */ e(
91
91
  "button",
92
92
  {
93
- ref: M,
94
- type: g.type || "button",
95
- className: v,
96
- ...g,
97
- children: t
93
+ ref: S,
94
+ type: b.type || "button",
95
+ className: y,
96
+ ...b,
97
+ children: n
98
98
  }
99
99
  );
100
100
  }
101
101
  );
102
- Z.displayName = "Button";
103
- function q({ label: b, required: o = !1 }) {
104
- return /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
105
- b,
106
- o && /* @__PURE__ */ e("span", { className: "ml-1", children: "*" })
102
+ Q.displayName = "Button";
103
+ function Z({ label: u, required: l = !1 }) {
104
+ return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
105
+ u,
106
+ l && /* @__PURE__ */ e("span", { className: "ml-1", children: "*" })
107
107
  ] }) });
108
108
  }
109
- const ta = ({
110
- options: b = [],
111
- value: o = "",
112
- defaultValue: s = "",
113
- onChange: i,
109
+ const na = ({
110
+ options: u = [],
111
+ value: l = "",
112
+ defaultValue: i = "",
113
+ onChange: o,
114
114
  placeholder: d = "Select option",
115
- className: t = "",
116
- disabled: g = !1,
117
- search: M = !1,
118
- label: S = "",
119
- required: p = !1,
120
- name: l = "",
121
- parentClass: u = "",
122
- multiple: m = !1,
115
+ className: n = "",
116
+ disabled: b = !1,
117
+ search: S = !1,
118
+ label: O = "",
119
+ required: c = !1,
120
+ name: m = "",
121
+ parentClass: a = "",
122
+ multiple: f = !1,
123
123
  // ✅ NEW
124
- dropdownMaxHeight: v = "",
125
- formData: c = {},
124
+ dropdownMaxHeight: y = "",
125
+ formData: s = {},
126
126
  dependencyKey: w = ""
127
127
  }) => {
128
- var V;
129
- const [y, k] = R(!1), [I, A] = R(""), [C, O] = R(!0), F = ee(null), T = ee(null), [L, B] = R([]);
130
- let E = o || o === !1 ? o : s;
131
- const Y = (x) => x == null || x === "" ? "" : String(typeof x == "boolean" ? x : x ?? "");
132
- K(
128
+ var _;
129
+ const [x, N] = R(!1), [P, F] = R(""), [M, L] = R(!0), B = ae(null), T = ae(null), [C, j] = R([]);
130
+ let G = l || l === !1 ? l : i;
131
+ const W = (k) => k == null || k === "" ? "" : String(typeof k == "boolean" ? k : k ?? "");
132
+ z(
133
133
  () => {
134
134
  (async () => {
135
- if (typeof b == "function") {
136
- const H = await b(c);
137
- B(H);
135
+ if (typeof u == "function") {
136
+ const U = await u(s);
137
+ j(U);
138
138
  } else
139
- B(b || []);
139
+ j(u || []);
140
140
  })();
141
141
  },
142
- w ? [b, c == null ? void 0 : c[w]] : [b]
142
+ w ? [u, s == null ? void 0 : s[w]] : [u]
143
143
  );
144
- const $ = m ? (E || []).map(Y) : Y(E), _ = L.filter(
145
- (x) => x.label.toLowerCase().includes(I.toLowerCase())
146
- ), z = (x) => {
147
- const H = Y(x);
148
- return m ? $.includes(H) : H === $;
144
+ const $ = f ? (G || []).map(W) : W(G), H = C.filter(
145
+ (k) => k.label.toLowerCase().includes(P.toLowerCase())
146
+ ), Y = (k) => {
147
+ const U = W(k);
148
+ return f ? $.includes(U) : U === $;
149
149
  };
150
- K(() => {
151
- const x = (H) => {
152
- F.current && !F.current.contains(H.target) && (k(!1), A(""));
150
+ z(() => {
151
+ const k = (U) => {
152
+ B.current && !B.current.contains(U.target) && (N(!1), F(""));
153
153
  };
154
- return document.addEventListener("mousedown", x), () => document.removeEventListener("mousedown", x);
155
- }, []), K(() => {
156
- if (y && F.current) {
157
- const x = F.current.getBoundingClientRect(), J = window.innerHeight - x.bottom;
158
- O(J < 200);
154
+ return document.addEventListener("mousedown", k), () => document.removeEventListener("mousedown", k);
155
+ }, []), z(() => {
156
+ if (x && B.current) {
157
+ const k = B.current.getBoundingClientRect(), X = window.innerHeight - k.bottom;
158
+ L(X < 200);
159
159
  }
160
- }, [y]), K(() => {
161
- y && T.current && T.current.focus();
162
- }, [y]);
163
- const D = (x) => {
164
- let H = x;
165
- if (x === "true" ? H = !0 : x === "false" && (H = !1), m) {
166
- const J = $.includes(Y(x));
167
- let Q;
168
- J ? Q = o.filter(
169
- (W) => Y(W) !== Y(x)
170
- ) : Q = [...o || [], H], i(Q);
160
+ }, [x]), z(() => {
161
+ x && T.current && T.current.focus();
162
+ }, [x]);
163
+ const I = (k) => {
164
+ let U = k;
165
+ if (k === "true" ? U = !0 : k === "false" && (U = !1), f) {
166
+ const X = $.includes(W(k));
167
+ let J;
168
+ X ? J = l.filter(
169
+ (ee) => W(ee) !== W(k)
170
+ ) : J = [...l || [], U], o(J);
171
171
  } else
172
- i(H), k(!1);
173
- A("");
174
- }, U = m ? L.filter((x) => z(x.value)).map((x) => x.label).join(", ") : (V = L.find((x) => z(x.value))) == null ? void 0 : V.label;
175
- return K(() => {
176
- (E || E === !1) && setTimeout(() => {
177
- i(E);
172
+ o(U), N(!1);
173
+ F("");
174
+ }, K = f ? C.filter((k) => Y(k.value)).map((k) => k.label).join(", ") : (_ = C.find((k) => Y(k.value))) == null ? void 0 : _.label;
175
+ return z(() => {
176
+ (G || G === !1) && setTimeout(() => {
177
+ o(G);
178
178
  }, 100);
179
- }, []), /* @__PURE__ */ h("div", { className: u || "col-span-12", children: [
180
- /* @__PURE__ */ e(q, { label: S, required: p }),
181
- /* @__PURE__ */ h("div", { className: `relative ${t}`, ref: F, children: [
179
+ }, []), /* @__PURE__ */ h("div", { className: a || "col-span-12", children: [
180
+ /* @__PURE__ */ e(Z, { label: O, required: c }),
181
+ /* @__PURE__ */ h("div", { className: `relative ${n}`, ref: B, children: [
182
182
  /* @__PURE__ */ e(
183
183
  "select",
184
184
  {
185
185
  name: "hidden_select_for_validation",
186
- value: U || "",
187
- required: p,
188
- multiple: m,
186
+ value: K || "",
187
+ required: c,
188
+ multiple: f,
189
189
  className: "absolute opacity-0 right-1/2 top-[80%] -translate-x-1/2 -translate-y-1/2 pointer-events-none h-[10px]",
190
- children: /* @__PURE__ */ e("option", { hidden: !0, value: U, children: U })
190
+ children: /* @__PURE__ */ e("option", { hidden: !0, value: K, children: K })
191
191
  }
192
192
  ),
193
193
  /* @__PURE__ */ h(
194
194
  "button",
195
195
  {
196
196
  type: "button",
197
- onClick: () => !g && k(!y),
198
- disabled: g,
197
+ onClick: () => !b && N(!x),
198
+ disabled: b,
199
199
  className: `w-full h-10 px-3 border border-gray-300 dark:border-gray-600 rounded-md text-left text-sm flex items-center justify-between
200
- ${U ? "dark:text-white" : "text-gray-500 dark:text-gray-400"}
201
- ${g ? "opacity-50 cursor-not-allowed" : "dark:bg-gray-700"}`,
200
+ ${K ? "dark:text-white" : "text-gray-500 dark:text-gray-400"}
201
+ ${b ? "opacity-50 cursor-not-allowed" : "dark:bg-gray-700"}`,
202
202
  children: [
203
- /* @__PURE__ */ e("span", { className: "truncate", children: U || d }),
203
+ /* @__PURE__ */ e("span", { className: "truncate", children: K || d }),
204
204
  /* @__PURE__ */ e(
205
- Ie,
205
+ Be,
206
206
  {
207
- className: `w-4 h-4 transition-transform ${y ? "rotate-180" : ""}`
207
+ className: `w-4 h-4 transition-transform ${x ? "rotate-180" : ""}`
208
208
  }
209
209
  )
210
210
  ]
211
211
  }
212
212
  ),
213
- y && /* @__PURE__ */ h(
213
+ x && /* @__PURE__ */ h(
214
214
  "div",
215
215
  {
216
216
  className: `absolute z-50 w-full border rounded-md bg-white dark:bg-gray-700 shadow-lg
217
- ${C ? "bottom-full mb-1" : "top-full mt-1"}`,
217
+ ${M ? "bottom-full mb-1" : "top-full mt-1"}`,
218
218
  children: [
219
- M && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-600", children: /* @__PURE__ */ h("div", { className: "relative", children: [
220
- /* @__PURE__ */ e(Oe, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400" }),
219
+ S && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-600", children: /* @__PURE__ */ h("div", { className: "relative", children: [
220
+ /* @__PURE__ */ e(Ae, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400" }),
221
221
  /* @__PURE__ */ e(
222
222
  "input",
223
223
  {
224
224
  ref: T,
225
225
  type: "text",
226
- value: I,
227
- onChange: (x) => A(x.target.value),
226
+ value: P,
227
+ onChange: (k) => F(k.target.value),
228
228
  placeholder: "Search...",
229
229
  className: "w-full pl-9 pr-3 py-2 text-sm border rounded-md bg-white dark:bg-gray-800 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none"
230
230
  }
@@ -235,21 +235,21 @@ const ta = ({
235
235
  {
236
236
  className: "max-h-40 overflow-y-auto",
237
237
  style: {
238
- maxHeight: v || ""
238
+ maxHeight: y || ""
239
239
  },
240
- children: _.length > 0 ? _.map((x) => /* @__PURE__ */ h(
240
+ children: H.length > 0 ? H.map((k) => /* @__PURE__ */ h(
241
241
  "button",
242
242
  {
243
243
  type: "button",
244
- onClick: () => D(String(x.value)),
244
+ onClick: () => I(String(k.value)),
245
245
  className: `w-full px-3 py-2 text-left text-sm flex items-center justify-between hover:bg-gray-100 dark:hover:bg-gray-600
246
- ${z(x.value) ? "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300" : ""}`,
246
+ ${Y(k.value) ? "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300" : ""}`,
247
247
  children: [
248
- /* @__PURE__ */ e("span", { children: x.label }),
249
- m && z(x.value) && /* @__PURE__ */ e(Ye, { className: "w-4 h-4" })
248
+ /* @__PURE__ */ e("span", { children: k.label }),
249
+ f && Y(k.value) && /* @__PURE__ */ e(Ve, { className: "w-4 h-4" })
250
250
  ]
251
251
  },
252
- String(x.value)
252
+ String(k.value)
253
253
  )) : /* @__PURE__ */ e("div", { className: "px-3 py-2 text-sm text-gray-500 dark:text-gray-400", children: "No options found" })
254
254
  }
255
255
  )
@@ -257,27 +257,27 @@ const ta = ({
257
257
  }
258
258
  )
259
259
  ] })
260
- ] }, l);
261
- }, na = ({
262
- value: b = !0,
263
- onChange: o,
264
- text: s,
265
- options: i = [],
260
+ ] }, m);
261
+ }, la = ({
262
+ value: u = !0,
263
+ onChange: l,
264
+ text: i,
265
+ options: o = [],
266
266
  label: d,
267
- required: t,
268
- name: g = "",
269
- disabled: M = !1,
270
- parentClass: S = ""
267
+ required: n,
268
+ name: b = "",
269
+ disabled: S = !1,
270
+ parentClass: O = ""
271
271
  }) => {
272
- const p = i.length > 0 ? i : [
272
+ const c = o.length > 0 ? o : [
273
273
  { label: "Active", value: !0 },
274
274
  { label: "Inactive", value: !1 }
275
275
  ];
276
- return /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h("div", { className: S || "col-span-12", children: [
277
- /* @__PURE__ */ e(q, { label: d, required: t }),
276
+ return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("div", { className: O || "col-span-12", children: [
277
+ /* @__PURE__ */ e(Z, { label: d, required: n }),
278
278
  /* @__PURE__ */ h("div", { className: "flex items-center justify-between h-10 gap-4 bg-gray-100 dark:bg-gray-700 px-3 rounded-md border border-gray-100 dark:border-gray-600", children: [
279
- s && /* @__PURE__ */ e("p", { className: "text-xs text-gray-600 dark:text-gray-400 flex-shrink overflow-hidden text-ellipsis whitespace-nowrap max-w-[200px]", children: s }),
280
- /* @__PURE__ */ e("div", { className: "flex items-center gap-6", children: p.map((l, u) => /* @__PURE__ */ h(
279
+ i && /* @__PURE__ */ e("p", { className: "text-xs text-gray-600 dark:text-gray-400 flex-shrink overflow-hidden text-ellipsis whitespace-nowrap max-w-[200px]", children: i }),
280
+ /* @__PURE__ */ e("div", { className: "flex items-center gap-6", children: c.map((m, a) => /* @__PURE__ */ h(
281
281
  "label",
282
282
  {
283
283
  className: "flex items-center gap-2 cursor-pointer select-none",
@@ -287,22 +287,22 @@ const ta = ({
287
287
  {
288
288
  type: "radio",
289
289
  name: "switch-field",
290
- required: t && u === 0,
291
- value: l.value,
292
- disabled: M,
293
- checked: b === l.value,
294
- onChange: () => o(l.value),
290
+ required: n && a === 0,
291
+ value: m.value,
292
+ disabled: S,
293
+ checked: u === m.value,
294
+ onChange: () => l(m.value),
295
295
  className: "w-4 h-4 border-gray-300 cursor-pointer"
296
296
  }
297
297
  ),
298
- /* @__PURE__ */ e("span", { className: "text-sm text-gray-700 dark:text-white", children: l.label })
298
+ /* @__PURE__ */ e("span", { className: "text-sm text-gray-700 dark:text-white", children: m.label })
299
299
  ]
300
300
  },
301
- u
301
+ a
302
302
  )) })
303
303
  ] })
304
- ] }, g) });
305
- }, we = [
304
+ ] }, b) });
305
+ }, ke = [
306
306
  { label: "Afghanistan", code: "AF", phone: "93" },
307
307
  { label: "Aland Islands", code: "AX", phone: "358" },
308
308
  { label: "Albania", code: "AL", phone: "355" },
@@ -554,90 +554,90 @@ const ta = ({
554
554
  { label: "Zambia", code: "ZM", phone: "260" },
555
555
  { label: "Zimbabwe", code: "ZW", phone: "263" }
556
556
  ];
557
- function la({
558
- label: b = "",
559
- value: o = "",
560
- name: s = "",
561
- parentClass: i = "",
557
+ function oa({
558
+ label: u = "",
559
+ value: l = "",
560
+ name: i = "",
561
+ parentClass: o = "",
562
562
  onChange: d,
563
- disabled: t = !1,
564
- required: g = !1,
565
- placeholder: M = "Phone number",
566
- search: S = !1,
567
- countriesList: p = !1,
568
- defaultCountry: l = ""
563
+ disabled: n = !1,
564
+ required: b = !1,
565
+ placeholder: S = "Phone number",
566
+ search: O = !1,
567
+ countriesList: c = !1,
568
+ defaultCountry: m = ""
569
569
  }) {
570
- const u = (L) => we.find((B) => B.code == L), [m, v] = R(
571
- u(l) || we[0]
572
- ), [c, w] = R(""), [y, k] = R(!1), [I, A] = R(""), C = ee();
573
- K(() => {
574
- if (typeof o == "string" && o.startsWith("+")) {
575
- const L = we.filter((B) => o.startsWith("+" + B.phone)).sort((B, E) => E.phone.length - B.phone.length)[0];
576
- if (L) {
577
- v(L), w(o.replace("+" + L.phone, ""));
570
+ const a = (C) => ke.find((j) => j.code == C), [f, y] = R(
571
+ a(m) || ke[0]
572
+ ), [s, w] = R(""), [x, N] = R(!1), [P, F] = R(""), M = ae();
573
+ z(() => {
574
+ if (typeof l == "string" && l.startsWith("+")) {
575
+ const C = ke.filter((j) => l.startsWith("+" + j.phone)).sort((j, G) => G.phone.length - j.phone.length)[0];
576
+ if (C) {
577
+ y(C), w(l.replace("+" + C.phone, ""));
578
578
  return;
579
579
  }
580
580
  }
581
- w(o);
582
- }, [o]);
583
- const O = (L) => {
584
- const B = L.target.value.replace(/\D/g, "");
585
- w(B), m && d && d("+" + m.phone + B);
586
- }, F = (L) => {
587
- v(L), d && d("+" + L.phone + c), k(!1), A("");
581
+ w(l);
582
+ }, [l]);
583
+ const L = (C) => {
584
+ const j = C.target.value.replace(/\D/g, "");
585
+ w(j), f && d && d("+" + f.phone + j);
586
+ }, B = (C) => {
587
+ y(C), d && d("+" + C.phone + s), N(!1), F("");
588
588
  };
589
- K(() => {
590
- const L = (B) => {
591
- C.current && !C.current.contains(B.target) && k(!1);
589
+ z(() => {
590
+ const C = (j) => {
591
+ M.current && !M.current.contains(j.target) && N(!1);
592
592
  };
593
- return document.addEventListener("mousedown", L), () => document.removeEventListener("mousedown", L);
593
+ return document.addEventListener("mousedown", C), () => document.removeEventListener("mousedown", C);
594
594
  }, []);
595
- const T = we.filter(
596
- (L) => L.label.toLowerCase().includes(I.toLowerCase()) || L.phone.includes(I)
595
+ const T = ke.filter(
596
+ (C) => C.label.toLowerCase().includes(P.toLowerCase()) || C.phone.includes(P)
597
597
  );
598
- return p ? /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h("div", { className: i || "col-span-12", children: [
599
- /* @__PURE__ */ e(q, { label: b, required: g }),
600
- /* @__PURE__ */ h("div", { className: "relative ", ref: C, children: [
598
+ return c ? /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("div", { className: o || "col-span-12", children: [
599
+ /* @__PURE__ */ e(Z, { label: u, required: b }),
600
+ /* @__PURE__ */ h("div", { className: "relative ", ref: M, children: [
601
601
  /* @__PURE__ */ h(
602
602
  "div",
603
603
  {
604
604
  className: `h-[40px] flex items-center border rounded-md px-2 bg-white dark:bg-gray-700 transition-all
605
- ${y ? "ring-0.5 ring-blue-100 border-blue-300" : "border-gray-300 dark:border-gray-600"}
606
- ${t ? "opacity-60 cursor-not-allowed" : ""}`,
605
+ ${x ? "ring-0.5 ring-blue-100 border-blue-300" : "border-gray-300 dark:border-gray-600"}
606
+ ${n ? "opacity-60 cursor-not-allowed" : ""}`,
607
607
  children: [
608
608
  /* @__PURE__ */ h(
609
609
  "button",
610
610
  {
611
611
  type: "button",
612
- disabled: t,
613
- onClick: () => k(!y),
612
+ disabled: n,
613
+ onClick: () => N(!x),
614
614
  className: "flex items-center gap-1 pr-2 border-r border-gray-300 dark:border-gray-700 focus:outline-none",
615
615
  children: [
616
- m ? /* @__PURE__ */ e(
616
+ f ? /* @__PURE__ */ e(
617
617
  "img",
618
618
  {
619
- src: `https://flagcdn.com/w20/${m.code.toLowerCase()}.png`,
620
- alt: m.code,
619
+ src: `https://flagcdn.com/w20/${f.code.toLowerCase()}.png`,
620
+ alt: f.code,
621
621
  className: "w-5 h-3 object-cover"
622
622
  }
623
623
  ) : /* @__PURE__ */ e("span", { className: "text-gray-400 text-xs", children: "🌐" }),
624
- /* @__PURE__ */ e(Ie, { className: "w-3 h-3 text-gray-500" })
624
+ /* @__PURE__ */ e(Be, { className: "w-3 h-3 text-gray-500" })
625
625
  ]
626
626
  }
627
627
  ),
628
- m && /* @__PURE__ */ h("span", { className: "ml-2 text-sm text-gray-700 dark:text-gray-200 whitespace-nowrap", children: [
628
+ f && /* @__PURE__ */ h("span", { className: "ml-2 text-sm text-gray-700 dark:text-gray-200 whitespace-nowrap", children: [
629
629
  "+",
630
- m.phone
630
+ f.phone
631
631
  ] }),
632
632
  /* @__PURE__ */ e(
633
633
  "input",
634
634
  {
635
635
  type: "tel",
636
- value: c,
637
- onChange: O,
638
- required: g,
639
- disabled: t || !m,
640
- placeholder: m ? M : "Select a country",
636
+ value: s,
637
+ onChange: L,
638
+ required: b,
639
+ disabled: n || !f,
640
+ placeholder: f ? S : "Select a country",
641
641
  className: "flex-1 ml-2 bg-transparent outline-none text-sm text-gray-800 dark:text-gray-100 placeholder-gray-400"
642
642
  }
643
643
  ),
@@ -645,10 +645,10 @@ function la({
645
645
  "input",
646
646
  {
647
647
  type: "tel",
648
- required: g,
648
+ required: b,
649
649
  tabIndex: -1,
650
650
  readOnly: !0,
651
- value: m && c ? "+" + m.phone + c : "",
651
+ value: f && s ? "+" + f.phone + s : "",
652
652
  style: {
653
653
  position: "absolute",
654
654
  opacity: 0,
@@ -660,61 +660,61 @@ function la({
660
660
  ]
661
661
  }
662
662
  ),
663
- y && /* @__PURE__ */ h("div", { className: "absolute top-full left-0 w-full mt-1 border border-gray-300 dark:border-gray-700 rounded-md bg-white dark:bg-gray-700 shadow-lg z-50 max-h-60 overflow-y-auto", children: [
664
- S && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ h("div", { className: "relative", children: [
665
- /* @__PURE__ */ e(Oe, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400" }),
663
+ x && /* @__PURE__ */ h("div", { className: "absolute top-full left-0 w-full mt-1 border border-gray-300 dark:border-gray-700 rounded-md bg-white dark:bg-gray-700 shadow-lg z-50 max-h-60 overflow-y-auto", children: [
664
+ O && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ h("div", { className: "relative", children: [
665
+ /* @__PURE__ */ e(Ae, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400" }),
666
666
  /* @__PURE__ */ e(
667
667
  "input",
668
668
  {
669
669
  type: "text",
670
- value: I,
671
- onChange: (L) => A(L.target.value),
670
+ value: P,
671
+ onChange: (C) => F(C.target.value),
672
672
  placeholder: "Search country...",
673
673
  className: "w-full pl-9 pr-3 py-2 text-sm border rounded-md bg-white dark:bg-gray-800 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none "
674
674
  }
675
675
  )
676
676
  ] }) }),
677
- T.map((L) => /* @__PURE__ */ h(
677
+ T.map((C) => /* @__PURE__ */ h(
678
678
  "button",
679
679
  {
680
680
  type: "button",
681
- onClick: () => F(L),
681
+ onClick: () => B(C),
682
682
  className: "w-full flex items-center gap-2 px-2 py-1 text-sm hover:bg-blue-50 dark:hover:bg-gray-700 text-gray-800 dark:text-gray-100",
683
683
  children: [
684
684
  /* @__PURE__ */ e(
685
685
  "img",
686
686
  {
687
- src: `https://flagcdn.com/w20/${L.code.toLowerCase()}.png`,
688
- alt: L.code,
687
+ src: `https://flagcdn.com/w20/${C.code.toLowerCase()}.png`,
688
+ alt: C.code,
689
689
  className: "w-5 h-3 object-cover"
690
690
  }
691
691
  ),
692
692
  /* @__PURE__ */ h("span", { children: [
693
- L.label,
693
+ C.label,
694
694
  " (+",
695
- L.phone,
695
+ C.phone,
696
696
  ")"
697
697
  ] })
698
698
  ]
699
699
  },
700
- L.code
700
+ C.code
701
701
  ))
702
702
  ] })
703
703
  ] })
704
- ] }, s) }) : /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h("div", { className: i || "col-span-12", children: [
705
- /* @__PURE__ */ e(q, { label: b, required: g }),
704
+ ] }, i) }) : /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("div", { className: o || "col-span-12", children: [
705
+ /* @__PURE__ */ e(Z, { label: u, required: b }),
706
706
  /* @__PURE__ */ e(
707
707
  "input",
708
708
  {
709
709
  type: "text",
710
- value: o,
711
- onChange: (B) => {
712
- const E = B.target.value.replace(/[^+\d]/g, ""), Y = E.startsWith("+") ? "+" + E.replace(/[+]/g, "").slice(0) : E;
713
- d(Y);
710
+ value: l,
711
+ onChange: (j) => {
712
+ const G = j.target.value.replace(/[^+\d]/g, ""), W = G.startsWith("+") ? "+" + G.replace(/[+]/g, "").slice(0) : G;
713
+ d(W);
714
714
  },
715
- placeholder: M,
716
- disabled: t,
717
- required: g,
715
+ placeholder: S,
716
+ disabled: n,
717
+ required: b,
718
718
  className: `w-full h-10 px-3 text-sm border border-gray-300 dark:border-gray-600 rounded-md \r
719
719
  bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none \r
720
720
  focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-200`,
@@ -722,99 +722,99 @@ function la({
722
722
  pattern: "^\\+\\d{1,15}$"
723
723
  }
724
724
  )
725
- ] }, s) });
725
+ ] }, i) });
726
726
  }
727
- const je = Le.forwardRef(
728
- ({ className: b = "", label: o, required: s, ...i }, d) => {
729
- const t = `
727
+ const Ee = Oe.forwardRef(
728
+ ({ className: u = "", label: l, required: i, ...o }, d) => {
729
+ const n = `
730
730
  placeholder-gray-400 dark:placeholder-gray-400
731
- ${b}
731
+ ${u}
732
732
  `.trim();
733
- return /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h("div", { className: i.parentClass || "col-span-12", children: [
734
- /* @__PURE__ */ e(q, { label: o, required: s }),
733
+ return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("div", { className: o.parentClass || "col-span-12", children: [
734
+ /* @__PURE__ */ e(Z, { label: l, required: i }),
735
735
  /* @__PURE__ */ e("div", { className: "relative", children: /* @__PURE__ */ e(
736
736
  "textarea",
737
737
  {
738
- className: t,
738
+ className: n,
739
739
  ref: d,
740
- required: s,
741
- ...i
740
+ required: i,
741
+ ...o
742
742
  }
743
743
  ) })
744
- ] }, i.name) });
744
+ ] }, o.name) });
745
745
  }
746
746
  );
747
- je.displayName = "TextArea";
748
- const oa = ({
749
- label: b = "",
750
- value: o = null,
751
- onChange: s,
752
- required: i = !1,
747
+ Ee.displayName = "TextArea";
748
+ const ia = ({
749
+ label: u = "",
750
+ value: l = null,
751
+ onChange: i,
752
+ required: o = !1,
753
753
  accept: d = "image/*",
754
- id: t,
755
- dragDrop: g = !1,
756
- name: M = "",
757
- parentClass: S = ""
754
+ id: n,
755
+ dragDrop: b = !1,
756
+ name: S = "",
757
+ parentClass: O = ""
758
758
  }) => {
759
- const [p, l] = R(o), [u, m] = R(!1), v = ee(null);
760
- K(() => (o instanceof File ? l({ file: o, preview: URL.createObjectURL(o) }) : (o != null && o.preview, l(o)), () => {
761
- p != null && p.preview && p.preview.startsWith("blob:") && URL.revokeObjectURL(p.preview);
762
- }), [o]);
763
- const c = (C) => {
764
- if (!C || C.length === 0)
759
+ const [c, m] = R(l), [a, f] = R(!1), y = ae(null);
760
+ z(() => (l instanceof File ? m({ file: l, preview: URL.createObjectURL(l) }) : (l != null && l.preview, m(l)), () => {
761
+ c != null && c.preview && c.preview.startsWith("blob:") && URL.revokeObjectURL(c.preview);
762
+ }), [l]);
763
+ const s = (M) => {
764
+ if (!M || M.length === 0)
765
765
  return;
766
- const O = C[0], F = URL.createObjectURL(O), T = { file: O, preview: F };
767
- p != null && p.preview && p.preview.startsWith("blob:") && URL.revokeObjectURL(p.preview), l(T), s == null || s(O);
768
- }, w = (C) => {
769
- C && C.stopPropagation(), p != null && p.preview && p.preview.startsWith("blob:") && URL.revokeObjectURL(p.preview), l(null), s == null || s(null), v.current && (v.current.value = "");
770
- }, y = (C) => {
771
- g && (C.preventDefault(), m(!0));
772
- }, k = (C) => {
773
- g && (C.preventDefault(), m(!1));
774
- }, I = (C) => {
775
- g && (C.preventDefault(), m(!1), c(C.dataTransfer.files));
776
- }, A = () => {
777
- v.current.click();
766
+ const L = M[0], B = URL.createObjectURL(L), T = { file: L, preview: B };
767
+ c != null && c.preview && c.preview.startsWith("blob:") && URL.revokeObjectURL(c.preview), m(T), i == null || i(L);
768
+ }, w = (M) => {
769
+ M && M.stopPropagation(), c != null && c.preview && c.preview.startsWith("blob:") && URL.revokeObjectURL(c.preview), m(null), i == null || i(null), y.current && (y.current.value = "");
770
+ }, x = (M) => {
771
+ b && (M.preventDefault(), f(!0));
772
+ }, N = (M) => {
773
+ b && (M.preventDefault(), f(!1));
774
+ }, P = (M) => {
775
+ b && (M.preventDefault(), f(!1), s(M.dataTransfer.files));
776
+ }, F = () => {
777
+ y.current.click();
778
778
  };
779
- return /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h("div", { className: S || "col-span-12", children: [
780
- /* @__PURE__ */ e(q, { label: b, required: i }),
779
+ return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("div", { className: O || "col-span-12", children: [
780
+ /* @__PURE__ */ e(Z, { label: u, required: o }),
781
781
  /* @__PURE__ */ h(
782
782
  "div",
783
783
  {
784
- className: `relative rounded-md p-2 transition-all ${u ? "border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20" : "border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800"}`,
785
- onDragOver: y,
786
- onDragLeave: k,
787
- onDrop: I,
784
+ className: `relative rounded-md p-2 transition-all ${a ? "border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20" : "border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800"}`,
785
+ onDragOver: x,
786
+ onDragLeave: N,
787
+ onDrop: P,
788
788
  children: [
789
789
  /* @__PURE__ */ e(
790
790
  "input",
791
791
  {
792
- ref: v,
793
- id: t,
792
+ ref: y,
793
+ id: n,
794
794
  type: "file",
795
795
  accept: d,
796
- onChange: (C) => c(C.target.files),
797
- required: i && !p,
796
+ onChange: (M) => s(M.target.files),
797
+ required: o && !c,
798
798
  className: "absolute opacity-0 right-[50%] top-[80%] -translate-y-1/2 pointer-events-none h-[10px]"
799
799
  }
800
800
  ),
801
801
  /* @__PURE__ */ h(
802
802
  "div",
803
803
  {
804
- className: `flex items-center space-x-4 transition-all ${u ? "opacity-50" : ""}`,
804
+ className: `flex items-center space-x-4 transition-all ${a ? "opacity-50" : ""}`,
805
805
  children: [
806
- p ? (
806
+ c ? (
807
807
  // Image preview with close button
808
808
  /* @__PURE__ */ h("div", { className: "relative group", children: [
809
809
  /* @__PURE__ */ e(
810
810
  "img",
811
811
  {
812
- src: p.preview || p,
812
+ src: c.preview || c,
813
813
  alt: "preview",
814
814
  className: "object-cover w-20 h-20 rounded-full shadow-md"
815
815
  }
816
816
  ),
817
- !i && /* @__PURE__ */ e(
817
+ !o && /* @__PURE__ */ e(
818
818
  "button",
819
819
  {
820
820
  type: "button",
@@ -837,76 +837,79 @@ const oa = ({
837
837
  ),
838
838
  /* @__PURE__ */ h("div", { className: "flex flex-col items-center space-y-1", children: [
839
839
  /* @__PURE__ */ e(
840
- Z,
840
+ Q,
841
841
  {
842
842
  type: "button",
843
- onClick: A,
843
+ onClick: F,
844
844
  variant: "outlined",
845
845
  color: "default",
846
- children: p ? "Change Image" : "Select Image"
846
+ children: c ? "Change Image" : "Select Image"
847
847
  }
848
848
  ),
849
- g && !p && /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "or drag and drop" })
849
+ b && !c && /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "or drag and drop" })
850
850
  ] })
851
851
  ]
852
852
  }
853
853
  ),
854
- g && u && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-md", children: /* @__PURE__ */ e("span", { className: "text-blue-600 dark:text-blue-400 font-semibold text-lg", children: "Drop image here" }) })
854
+ b && a && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-md", children: /* @__PURE__ */ e("span", { className: "text-blue-600 dark:text-blue-400 font-semibold text-lg", children: "Drop image here" }) })
855
855
  ]
856
856
  }
857
857
  )
858
- ] }, M) });
859
- }, Ee = Le.forwardRef(
858
+ ] }, S) });
859
+ }, $e = Oe.forwardRef(
860
860
  ({
861
- label: b,
862
- required: o,
863
- parentClass: s = "",
864
- className: i = "",
861
+ label: u,
862
+ required: l,
863
+ parentClass: i = "",
864
+ className: o = "",
865
865
  type: d = "text",
866
- onKeyDown: t,
867
- negativeNumberAllow: g = !0,
868
- defaultValue: M = "",
869
- ...S
870
- }, p) => {
871
- const [l, u] = R(!1), m = (c) => {
866
+ onKeyDown: n,
867
+ negativeNumberAllow: b = !0,
868
+ defaultValue: S = "",
869
+ ...O
870
+ }, c) => {
871
+ const [m, a] = R(!1), f = (s) => {
872
872
  if (d === "number") {
873
- if (["e", "E", "+"].includes(c.key)) {
874
- c.preventDefault();
873
+ if (["e", "E", "+"].includes(s.key)) {
874
+ s.preventDefault();
875
875
  return;
876
876
  }
877
- if (g == !1 && c.key === "-") {
878
- c.preventDefault();
877
+ if (b == !1 && s.key === "-") {
878
+ s.preventDefault();
879
879
  return;
880
880
  }
881
- if (["ArrowUp", "ArrowDown"].includes(c.key)) {
882
- c.preventDefault();
881
+ if (["ArrowUp", "ArrowDown"].includes(s.key)) {
882
+ s.preventDefault();
883
883
  return;
884
884
  }
885
885
  }
886
- t == null || t(c);
887
- }, v = `
886
+ n == null || n(s);
887
+ }, y = `
888
888
  h-10 placeholder-gray-400 dark:placeholder-gray-400
889
889
  ${d === "password" ? "pr-10" : ""}
890
890
  ${d === "number" ? "no-spinner" : ""}
891
- ${i}
891
+ ${o}
892
892
  `.trim();
893
- return K(() => {
894
- M && setTimeout(() => {
895
- var c;
896
- (c = S.onChange) == null || c.call(S, { target: { value: M } });
897
- }, 100);
898
- }, [M]), /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h("div", { className: s || "col-span-12", children: [
899
- /* @__PURE__ */ e(q, { label: b, required: o }),
893
+ return z(() => {
894
+ if (S) {
895
+ let s = O.value || S;
896
+ setTimeout(() => {
897
+ var w;
898
+ (w = O.onChange) == null || w.call(O, { target: { value: s } });
899
+ }, 100);
900
+ }
901
+ }, [S]), /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("div", { className: i || "col-span-12", children: [
902
+ /* @__PURE__ */ e(Z, { label: u, required: l }),
900
903
  /* @__PURE__ */ h("div", { className: "relative", children: [
901
904
  /* @__PURE__ */ e(
902
905
  "input",
903
906
  {
904
- type: d === "password" && l ? "text" : d,
905
- ref: p,
906
- required: o,
907
- onKeyDown: m,
908
- className: v,
909
- ...S
907
+ type: d === "password" && m ? "text" : d,
908
+ ref: c,
909
+ required: l,
910
+ onKeyDown: f,
911
+ className: y,
912
+ ...O
910
913
  }
911
914
  ),
912
915
  d === "password" && /* @__PURE__ */ e(
@@ -914,70 +917,70 @@ const oa = ({
914
917
  {
915
918
  type: "button",
916
919
  tabIndex: -1,
917
- onClick: () => u((c) => !c),
920
+ onClick: () => a((s) => !s),
918
921
  className: "absolute inset-y-0 right-3 flex items-center text-gray-400 hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-200",
919
922
  children: /* @__PURE__ */ e(
920
923
  re,
921
924
  {
922
- icon: l ? "mdi:eye-outline" : "mdi:eye-off-outline",
925
+ icon: m ? "mdi:eye-outline" : "mdi:eye-off-outline",
923
926
  className: "w-5 h-5"
924
927
  }
925
928
  )
926
929
  }
927
930
  )
928
931
  ] })
929
- ] }, S.name) });
932
+ ] }, O.name) });
930
933
  }
931
934
  );
932
- Ee.displayName = "Input";
933
- const ia = ({
934
- key: b,
935
- editorKey: o = "",
936
- value: s = "",
937
- onChange: i,
935
+ $e.displayName = "Input";
936
+ const sa = ({
937
+ key: u,
938
+ editorKey: l = "",
939
+ value: i = "",
940
+ onChange: o,
938
941
  label: d = "",
939
- required: t = !1,
940
- placeholder: g = "",
941
- parentClass: M = "col-span-12",
942
- height: S = 400,
943
- inline: p = !1,
944
- disabled: l = !1,
945
- plugins: u,
946
- toolbar: m,
947
- menubar: v = !1,
948
- fontFamily: c = "Inter, sans-serif",
942
+ required: n = !1,
943
+ placeholder: b = "",
944
+ parentClass: S = "col-span-12",
945
+ height: O = 400,
946
+ inline: c = !1,
947
+ disabled: m = !1,
948
+ plugins: a,
949
+ toolbar: f,
950
+ menubar: y = !1,
951
+ fontFamily: s = "Inter, sans-serif",
949
952
  initConfig: w = {},
950
- imageUploadHandler: y
953
+ imageUploadHandler: x
951
954
  // ✅ Promise function passed from parent
952
- }) => /* @__PURE__ */ h("div", { className: M, children: [
953
- d && /* @__PURE__ */ e(q, { label: d, required: t }),
955
+ }) => /* @__PURE__ */ h("div", { className: S, children: [
956
+ d && /* @__PURE__ */ e(Z, { label: d, required: n }),
954
957
  /* @__PURE__ */ e(
955
- ea,
958
+ aa,
956
959
  {
957
- apiKey: o,
958
- value: s,
959
- disabled: l,
960
+ apiKey: l,
961
+ value: i,
962
+ disabled: m,
960
963
  init: {
961
- height: S,
962
- inline: p,
963
- menubar: v,
964
+ height: O,
965
+ inline: c,
966
+ menubar: y,
964
967
  branding: !1,
965
968
  statusbar: !0,
966
969
  automatic_uploads: !0,
967
- images_upload_handler: (C) => new Promise((O, F) => {
968
- if (!y) {
969
- O(`data:${C.blob().type};base64,${C.base64()}`);
970
+ images_upload_handler: (M) => new Promise((L, B) => {
971
+ if (!x) {
972
+ L(`data:${M.blob().type};base64,${M.base64()}`);
970
973
  return;
971
974
  }
972
- y(C).then((T) => {
973
- T ? O(T) : F("Upload failed: No URL returned");
975
+ x(M).then((T) => {
976
+ T ? L(T) : B("Upload failed: No URL returned");
974
977
  }).catch((T) => {
975
- F(
978
+ B(
976
979
  typeof T == "string" ? T : (T == null ? void 0 : T.message) || "Image upload failed"
977
980
  );
978
981
  });
979
982
  }),
980
- plugins: u ?? [
983
+ plugins: a ?? [
981
984
  "advlist",
982
985
  "autolink",
983
986
  "lists",
@@ -996,178 +999,178 @@ const ia = ({
996
999
  "help",
997
1000
  "wordcount"
998
1001
  ],
999
- toolbar: m ?? "undo redo | blocks | bold italic underline forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media table | removeformat | code fullscreen preview",
1000
- placeholder: g,
1002
+ toolbar: f ?? "undo redo | blocks | bold italic underline forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media table | removeformat | code fullscreen preview",
1003
+ placeholder: b,
1001
1004
  content_style: `
1002
1005
  body {
1003
- font-family: ${c};
1006
+ font-family: ${s};
1004
1007
  }
1005
1008
  `,
1006
1009
  ...w
1007
1010
  },
1008
- onEditorChange: (C) => {
1009
- i && i(C);
1011
+ onEditorChange: (M) => {
1012
+ o && o(M);
1010
1013
  }
1011
1014
  }
1012
1015
  )
1013
- ] }, b), sa = ({
1014
- name: b = "",
1015
- label: o = "",
1016
+ ] }, u), da = ({
1017
+ name: u = "",
1018
+ label: l = "",
1016
1019
  // label for single checkbox
1017
- options: s = [],
1020
+ options: i = [],
1018
1021
  // array of { label, value } for multiple
1019
- value: i = null,
1022
+ value: o = null,
1020
1023
  // boolean for single, array for multiple, or string for single select
1021
1024
  onChange: d,
1022
- disabled: t = !1,
1023
- required: g = !1,
1024
- parentClass: M = "col-span-12",
1025
- className: S = "",
1026
- multiSelect: p = !1
1025
+ disabled: n = !1,
1026
+ required: b = !1,
1027
+ parentClass: S = "col-span-12",
1028
+ className: O = "",
1029
+ multiSelect: c = !1
1027
1030
  // ✅ if true, only one option can be selected (like radio)
1028
1031
  }) => {
1029
- const l = Array.isArray(s) && s.length > 0, u = (c) => l ? p ? Array.isArray(i) && i.includes(c) : i === c : !!i, m = (c) => {
1030
- d == null || d(c.target.checked, b);
1031
- }, v = (c, w) => {
1032
+ const m = Array.isArray(i) && i.length > 0, a = (s) => m ? c ? Array.isArray(o) && o.includes(s) : o === s : !!o, f = (s) => {
1033
+ d == null || d(s.target.checked, u);
1034
+ }, y = (s, w) => {
1032
1035
  if (d)
1033
- if (!p)
1034
- d(w ? c : "", b);
1036
+ if (!c)
1037
+ d(w ? s : "", u);
1035
1038
  else {
1036
- const y = Array.isArray(i) ? [...i] : [];
1039
+ const x = Array.isArray(o) ? [...o] : [];
1037
1040
  if (w)
1038
- y.includes(c) || y.push(c);
1041
+ x.includes(s) || x.push(s);
1039
1042
  else {
1040
- const k = y.indexOf(c);
1041
- k > -1 && y.splice(k, 1);
1043
+ const N = x.indexOf(s);
1044
+ N > -1 && x.splice(N, 1);
1042
1045
  }
1043
- d(y, b);
1046
+ d(x, u);
1044
1047
  }
1045
1048
  };
1046
- return l ? /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h("div", { className: `${M}`, children: [
1047
- /* @__PURE__ */ e(q, { label: o, required: g }),
1048
- /* @__PURE__ */ e("div", { className: "flex flex-col space-y-2", children: s.map((c, w) => /* @__PURE__ */ h("div", { className: "flex items-center", children: [
1049
+ return m ? /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("div", { className: `${S}`, children: [
1050
+ /* @__PURE__ */ e(Z, { label: l, required: b }),
1051
+ /* @__PURE__ */ e("div", { className: "flex flex-col space-y-2", children: i.map((s, w) => /* @__PURE__ */ h("div", { className: "flex items-center", children: [
1049
1052
  /* @__PURE__ */ e(
1050
1053
  "input",
1051
1054
  {
1052
1055
  type: "checkbox",
1053
- name: b,
1054
- value: c.value,
1055
- checked: u(c.value),
1056
- disabled: t || c.disabled,
1057
- required: g && w === 0,
1058
- onChange: (y) => v(c.value, y.target.checked),
1059
- className: `h-4 w-4 cursor-pointer text-blue-600 border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 ${S}`
1056
+ name: u,
1057
+ value: s.value,
1058
+ checked: a(s.value),
1059
+ disabled: n || s.disabled,
1060
+ required: b && w === 0,
1061
+ onChange: (x) => y(s.value, x.target.checked),
1062
+ className: `h-4 w-4 cursor-pointer text-blue-600 border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 ${O}`
1060
1063
  },
1061
- b
1064
+ u
1062
1065
  ),
1063
- c.label && /* @__PURE__ */ e(
1066
+ s.label && /* @__PURE__ */ e(
1064
1067
  "label",
1065
1068
  {
1066
- htmlFor: b,
1069
+ htmlFor: u,
1067
1070
  className: "ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",
1068
- children: c.label
1071
+ children: s.label
1069
1072
  }
1070
1073
  )
1071
- ] }, c.value || c.label)) })
1072
- ] }) }) : /* @__PURE__ */ h("div", { className: `flex items-center ${M}`, children: [
1074
+ ] }, s.value || s.label)) })
1075
+ ] }) }) : /* @__PURE__ */ h("div", { className: `flex items-center ${S}`, children: [
1073
1076
  /* @__PURE__ */ e(
1074
1077
  "input",
1075
1078
  {
1076
1079
  type: "checkbox",
1077
- name: b,
1078
- checked: u(),
1079
- disabled: t,
1080
- required: g,
1081
- onChange: m,
1082
- className: `h-4 w-4 text-blue-600 cursor-pointer border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 ${S}`
1080
+ name: u,
1081
+ checked: a(),
1082
+ disabled: n,
1083
+ required: b,
1084
+ onChange: f,
1085
+ className: `h-4 w-4 text-blue-600 cursor-pointer border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 ${O}`
1083
1086
  }
1084
1087
  ),
1085
- o && /* @__PURE__ */ e(
1088
+ l && /* @__PURE__ */ e(
1086
1089
  "label",
1087
1090
  {
1088
- htmlFor: b,
1091
+ htmlFor: u,
1089
1092
  className: "ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",
1090
- children: o
1093
+ children: l
1091
1094
  }
1092
1095
  )
1093
1096
  ] });
1094
- }, da = ({
1095
- label: b = "",
1096
- value: o = null,
1097
- onChange: s,
1098
- required: i = !1,
1097
+ }, ca = ({
1098
+ label: u = "",
1099
+ value: l = null,
1100
+ onChange: i,
1101
+ required: o = !1,
1099
1102
  accept: d = "audio/*",
1100
- id: t,
1101
- dragDrop: g = !1,
1102
- name: M = "",
1103
- parentClass: S = ""
1103
+ id: n,
1104
+ dragDrop: b = !1,
1105
+ name: S = "",
1106
+ parentClass: O = ""
1104
1107
  }) => {
1105
- const [p, l] = R(null), [u, m] = R(!1), v = ee(null);
1106
- K(() => {
1107
- if (!o) {
1108
- c(), l(null);
1108
+ const [c, m] = R(null), [a, f] = R(!1), y = ae(null);
1109
+ z(() => {
1110
+ if (!l) {
1111
+ s(), m(null);
1109
1112
  return;
1110
1113
  }
1111
- if (o instanceof File) {
1112
- const O = URL.createObjectURL(o);
1113
- return l({ file: o, preview: O }), () => {
1114
- URL.revokeObjectURL(O);
1114
+ if (l instanceof File) {
1115
+ const L = URL.createObjectURL(l);
1116
+ return m({ file: l, preview: L }), () => {
1117
+ URL.revokeObjectURL(L);
1115
1118
  };
1116
- } else typeof o == "string" ? l({ preview: o }) : o != null && o.preview && l(o);
1117
- }, [o]);
1118
- const c = () => {
1119
- p != null && p.preview && p.preview.startsWith("blob:") && URL.revokeObjectURL(p.preview);
1120
- }, w = (O) => {
1121
- if (!O || O.length === 0)
1119
+ } else typeof l == "string" ? m({ preview: l }) : l != null && l.preview && m(l);
1120
+ }, [l]);
1121
+ const s = () => {
1122
+ c != null && c.preview && c.preview.startsWith("blob:") && URL.revokeObjectURL(c.preview);
1123
+ }, w = (L) => {
1124
+ if (!L || L.length === 0)
1122
1125
  return;
1123
- const F = O[0], T = URL.createObjectURL(F);
1124
- c(), l({ file: F, preview: T }), s == null || s(F);
1125
- }, y = (O) => {
1126
- O && O.stopPropagation(), c(), l(null), s == null || s(null), v.current && (v.current.value = "");
1127
- }, k = (O) => {
1128
- g && (O.preventDefault(), m(!0));
1129
- }, I = (O) => {
1130
- g && (O.preventDefault(), m(!1));
1131
- }, A = (O) => {
1132
- g && (O.preventDefault(), m(!1), w(O.dataTransfer.files));
1133
- }, C = () => {
1134
- v.current.click();
1126
+ const B = L[0], T = URL.createObjectURL(B);
1127
+ s(), m({ file: B, preview: T }), i == null || i(B);
1128
+ }, x = (L) => {
1129
+ L && L.stopPropagation(), s(), m(null), i == null || i(null), y.current && (y.current.value = "");
1130
+ }, N = (L) => {
1131
+ b && (L.preventDefault(), f(!0));
1132
+ }, P = (L) => {
1133
+ b && (L.preventDefault(), f(!1));
1134
+ }, F = (L) => {
1135
+ b && (L.preventDefault(), f(!1), w(L.dataTransfer.files));
1136
+ }, M = () => {
1137
+ y.current.click();
1135
1138
  };
1136
- return /* @__PURE__ */ h("div", { className: S || "col-span-12", children: [
1137
- /* @__PURE__ */ e(q, { label: b, required: i }),
1139
+ return /* @__PURE__ */ h("div", { className: O || "col-span-12", children: [
1140
+ /* @__PURE__ */ e(Z, { label: u, required: o }),
1138
1141
  /* @__PURE__ */ h(
1139
1142
  "div",
1140
1143
  {
1141
- className: `relative rounded-lg p-2 transition-all ${u ? "border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20" : "border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800"}`,
1142
- onDragOver: k,
1143
- onDragLeave: I,
1144
- onDrop: A,
1144
+ className: `relative rounded-lg p-2 transition-all ${a ? "border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20" : "border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800"}`,
1145
+ onDragOver: N,
1146
+ onDragLeave: P,
1147
+ onDrop: F,
1145
1148
  children: [
1146
1149
  /* @__PURE__ */ e(
1147
1150
  "input",
1148
1151
  {
1149
- ref: v,
1150
- id: t,
1152
+ ref: y,
1153
+ id: n,
1151
1154
  type: "file",
1152
1155
  accept: d,
1153
- onChange: (O) => w(O.target.files),
1154
- required: i && !p,
1156
+ onChange: (L) => w(L.target.files),
1157
+ required: o && !c,
1155
1158
  className: "absolute opacity-0 right-[50%] top-[80%] -translate-y-1/2 pointer-events-none h-[10px]"
1156
1159
  }
1157
1160
  ),
1158
1161
  /* @__PURE__ */ e(
1159
1162
  "div",
1160
1163
  {
1161
- className: `flex items-center space-x-4 transition-all ${u ? "opacity-50" : ""}`,
1162
- children: p ? (
1164
+ className: `flex items-center space-x-4 transition-all ${a ? "opacity-50" : ""}`,
1165
+ children: c ? (
1163
1166
  // Audio player with close button and change button
1164
1167
  /* @__PURE__ */ h("div", { className: "flex items-center space-x-4", children: [
1165
1168
  /* @__PURE__ */ h("div", { className: "relative w-full", children: [
1166
- !i && /* @__PURE__ */ e(
1169
+ !o && /* @__PURE__ */ e(
1167
1170
  "button",
1168
1171
  {
1169
1172
  type: "button",
1170
- onClick: y,
1173
+ onClick: x,
1171
1174
  className: "absolute top-0 -right-2 bg-red-500 text-white rounded-full p-1 shadow-lg hover:bg-red-600 transition-colors z-10 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800",
1172
1175
  "aria-label": "Remove audio",
1173
1176
  children: /* @__PURE__ */ e(re, { icon: "mdi:close", className: "w-3 h-3" })
@@ -1176,239 +1179,239 @@ const ia = ({
1176
1179
  /* @__PURE__ */ e(
1177
1180
  "audio",
1178
1181
  {
1179
- src: p.preview,
1182
+ src: c.preview,
1180
1183
  controls: !0,
1181
1184
  controlsList: "nodownload"
1182
1185
  },
1183
- p.preview
1186
+ c.preview
1184
1187
  )
1185
1188
  ] }),
1186
- /* @__PURE__ */ e(Z, { type: "button", onClick: C, children: /* @__PURE__ */ e("span", { children: "Change Audio File" }) })
1189
+ /* @__PURE__ */ e(Q, { type: "button", onClick: M, children: /* @__PURE__ */ e("span", { children: "Change Audio File" }) })
1187
1190
  ] })
1188
1191
  ) : (
1189
1192
  // Empty state with upload button
1190
1193
  /* @__PURE__ */ h("div", { className: "flex items-center justify-center space-x-4", children: [
1191
1194
  /* @__PURE__ */ e("div", { className: "rounded-full bg-gray-100 dark:bg-gray-700 h-20 w-20 flex items-center justify-center", children: /* @__PURE__ */ e(re, { icon: "mdi:music", className: "text-gray-400 w-10 h-10" }) }),
1192
1195
  /* @__PURE__ */ e(
1193
- Z,
1196
+ Q,
1194
1197
  {
1195
1198
  type: "button",
1196
- onClick: C,
1199
+ onClick: M,
1197
1200
  variant: "outlined",
1198
1201
  children: /* @__PURE__ */ e("span", { children: "Choose Audio File" })
1199
1202
  }
1200
1203
  ),
1201
- g && /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "or drag and drop your audio file here" })
1204
+ b && /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "or drag and drop your audio file here" })
1202
1205
  ] })
1203
1206
  )
1204
1207
  }
1205
1208
  ),
1206
- g && u && !p && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-lg", children: /* @__PURE__ */ e("span", { className: "text-blue-600 dark:text-blue-400 font-semibold text-lg bg-white dark:bg-gray-800 px-4 py-2 rounded-lg shadow-lg", children: "Drop audio here" }) })
1209
+ b && a && !c && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-lg", children: /* @__PURE__ */ e("span", { className: "text-blue-600 dark:text-blue-400 font-semibold text-lg bg-white dark:bg-gray-800 px-4 py-2 rounded-lg shadow-lg", children: "Drop audio here" }) })
1207
1210
  ]
1208
1211
  }
1209
1212
  )
1210
- ] }, M);
1211
- }, $e = ({ field: b, formData: o, handleChange: s }) => {
1213
+ ] }, S);
1214
+ }, Ge = ({ field: u, formData: l, handleChange: i }) => {
1212
1215
  const {
1213
- key: i,
1216
+ key: o,
1214
1217
  label: d,
1215
- type: t,
1216
- options: g,
1217
- placeholder: M,
1218
- rows: S,
1219
- inputClass: p,
1220
- search: l,
1221
- accept: u,
1222
- text: m,
1223
- required: v = !1,
1224
- minLength: c,
1218
+ type: n,
1219
+ options: b,
1220
+ placeholder: S,
1221
+ rows: O,
1222
+ inputClass: c,
1223
+ search: m,
1224
+ accept: a,
1225
+ text: f,
1226
+ required: y = !1,
1227
+ minLength: s,
1225
1228
  dragDrop: w,
1226
- parentClass: y,
1227
- countriesList: k,
1228
- defaultCountry: I,
1229
- multiple: A,
1230
- dropdownMaxHeight: C,
1231
- editorKey: O,
1232
- fontFamily: F,
1229
+ parentClass: x,
1230
+ countriesList: N,
1231
+ defaultCountry: P,
1232
+ multiple: F,
1233
+ dropdownMaxHeight: M,
1234
+ editorKey: L,
1235
+ fontFamily: B,
1233
1236
  disabled: T,
1234
- negativeNumberAllow: L,
1235
- defaultValue: B,
1236
- renderCondition: E,
1237
- optionDependencyKey: Y
1238
- } = b;
1239
- let $ = o == null ? void 0 : o[i];
1237
+ negativeNumberAllow: C,
1238
+ defaultValue: j,
1239
+ renderCondition: G,
1240
+ optionDependencyKey: W
1241
+ } = u;
1242
+ let $ = l == null ? void 0 : l[o];
1240
1243
  $ == null && ($ = "");
1241
- const _ = M || (t === "select" ? `Select ${d}` : `Enter ${d}`), z = "w-full px-3 py-2 rounded-md border border-gray-300 dark:border-gray-600 text-sm focus:outline-none focus:ring-1 focus:ring-blue-200 bg-white text-black dark:bg-gray-700 dark:text-white";
1242
- if (E && typeof E == "function" && !E(o))
1244
+ const H = S || (n === "select" ? `Select ${d}` : `Enter ${d}`), Y = "w-full px-3 py-2 rounded-md border border-gray-300 dark:border-gray-600 text-sm focus:outline-none focus:ring-1 focus:ring-blue-200 bg-white text-black dark:bg-gray-700 dark:text-white";
1245
+ if (G && typeof G == "function" && !G(l))
1243
1246
  return null;
1244
- switch (t) {
1247
+ switch (n) {
1245
1248
  case "select":
1246
1249
  return /* @__PURE__ */ e(
1247
- ta,
1250
+ na,
1248
1251
  {
1249
- options: g || [],
1252
+ options: b || [],
1250
1253
  value: $,
1251
- formData: o,
1252
- dependencyKey: Y,
1253
- onChange: (D) => s(i, D),
1254
- placeholder: _,
1255
- className: p || "",
1256
- search: l,
1257
- required: v,
1258
- defaultValue: B,
1254
+ formData: l,
1255
+ dependencyKey: W,
1256
+ onChange: (I) => i(o, I),
1257
+ placeholder: H,
1258
+ className: c || "",
1259
+ search: m,
1260
+ required: y,
1261
+ defaultValue: j,
1259
1262
  label: d,
1260
- name: i,
1263
+ name: o,
1261
1264
  disabled: T,
1262
- parentClass: y,
1263
- multiple: A,
1264
- dropdownMaxHeight: C
1265
+ parentClass: x,
1266
+ multiple: F,
1267
+ dropdownMaxHeight: M
1265
1268
  }
1266
1269
  );
1267
1270
  case "checkbox":
1268
1271
  return /* @__PURE__ */ e(
1269
- sa,
1272
+ da,
1270
1273
  {
1271
- name: i,
1274
+ name: o,
1272
1275
  label: d,
1273
- options: g || [],
1276
+ options: b || [],
1274
1277
  value: $,
1275
- onChange: (D) => s(i, D),
1276
- required: v,
1277
- parentClass: y,
1278
- className: p || "",
1279
- multiSelect: A,
1278
+ onChange: (I) => i(o, I),
1279
+ required: y,
1280
+ parentClass: x,
1281
+ className: c || "",
1282
+ multiSelect: F,
1280
1283
  disabled: T
1281
1284
  }
1282
1285
  );
1283
1286
  case "switch":
1284
1287
  return /* @__PURE__ */ e(
1285
- na,
1288
+ la,
1286
1289
  {
1287
1290
  value: $,
1288
- onChange: (D) => s(i, D),
1289
- text: m,
1290
- options: g || [],
1291
+ onChange: (I) => i(o, I),
1292
+ text: f,
1293
+ options: b || [],
1291
1294
  label: d,
1292
- required: v,
1293
- name: i,
1295
+ required: y,
1296
+ name: o,
1294
1297
  disabled: T,
1295
- parentClass: y
1298
+ parentClass: x
1296
1299
  }
1297
1300
  );
1298
1301
  case "phone":
1299
1302
  return /* @__PURE__ */ e(
1300
- la,
1303
+ oa,
1301
1304
  {
1302
1305
  value: $,
1303
- onChange: (D) => s(i, D),
1304
- countriesList: k,
1305
- defaultCountry: I,
1306
- required: v,
1307
- placeholder: _,
1308
- search: l,
1306
+ onChange: (I) => i(o, I),
1307
+ countriesList: N,
1308
+ defaultCountry: P,
1309
+ required: y,
1310
+ placeholder: H,
1311
+ search: m,
1309
1312
  label: d,
1310
- name: i,
1313
+ name: o,
1311
1314
  disabled: T,
1312
- parentClass: y
1315
+ parentClass: x
1313
1316
  }
1314
1317
  );
1315
1318
  case "textarea":
1316
1319
  return /* @__PURE__ */ e(
1317
- je,
1320
+ Ee,
1318
1321
  {
1319
1322
  value: $,
1320
- onChange: (D) => s(i, D.target.value),
1321
- placeholder: _,
1322
- rows: S || 3,
1323
- className: `${z} ${p || ""}`,
1324
- required: v,
1325
- name: i,
1323
+ onChange: (I) => i(o, I.target.value),
1324
+ placeholder: H,
1325
+ rows: O || 3,
1326
+ className: `${Y} ${c || ""}`,
1327
+ required: y,
1328
+ name: o,
1326
1329
  label: d,
1327
1330
  disabled: T,
1328
- parentClass: y
1331
+ parentClass: x
1329
1332
  }
1330
1333
  );
1331
1334
  case "image":
1332
1335
  return /* @__PURE__ */ e(
1333
- oa,
1336
+ ia,
1334
1337
  {
1335
1338
  value: $,
1336
- onChange: (D) => s(i, D),
1337
- required: v,
1338
- accept: u || "image/*",
1339
- id: `file-${i}`,
1339
+ onChange: (I) => i(o, I),
1340
+ required: y,
1341
+ accept: a || "image/*",
1342
+ id: `file-${o}`,
1340
1343
  dragDrop: w,
1341
1344
  label: d,
1342
- name: i,
1343
- parentClass: y
1345
+ name: o,
1346
+ parentClass: x
1344
1347
  }
1345
1348
  );
1346
1349
  case "audio":
1347
1350
  return /* @__PURE__ */ e(
1348
- da,
1351
+ ca,
1349
1352
  {
1350
1353
  value: $,
1351
- onChange: (D) => s(i, D),
1352
- required: v,
1353
- accept: u || "audio/*",
1354
- id: `file-${i}`,
1354
+ onChange: (I) => i(o, I),
1355
+ required: y,
1356
+ accept: a || "audio/*",
1357
+ id: `file-${o}`,
1355
1358
  dragDrop: w,
1356
1359
  label: d,
1357
- name: i,
1358
- parentClass: y
1360
+ name: o,
1361
+ parentClass: x
1359
1362
  }
1360
1363
  );
1361
1364
  case "tinyEditor":
1362
1365
  return /* @__PURE__ */ e(
1363
- ia,
1366
+ sa,
1364
1367
  {
1365
1368
  value: $,
1366
- onChange: (D) => s(i, D),
1367
- required: v,
1368
- placeholder: _,
1369
+ onChange: (I) => i(o, I),
1370
+ required: y,
1371
+ placeholder: H,
1369
1372
  label: d,
1370
- parentClass: y,
1371
- fontFamily: F,
1372
- editorKey: O,
1373
+ parentClass: x,
1374
+ fontFamily: B,
1375
+ editorKey: L,
1373
1376
  disabled: T
1374
1377
  },
1375
- `editor-${i}`
1378
+ `editor-${o}`
1376
1379
  );
1377
1380
  default:
1378
1381
  return /* @__PURE__ */ e(
1379
- Ee,
1382
+ $e,
1380
1383
  {
1381
- type: t || "text",
1382
- defaultValue: B,
1384
+ type: n || "text",
1385
+ defaultValue: j,
1383
1386
  value: $,
1384
- onChange: (D) => s(i, D.target.value),
1385
- placeholder: _,
1386
- className: `${z} ${p || ""}`,
1387
- required: v,
1388
- name: i,
1389
- minLength: c,
1387
+ onChange: (I) => i(o, I.target.value),
1388
+ placeholder: H,
1389
+ className: `${Y} ${c || ""}`,
1390
+ required: y,
1391
+ name: o,
1392
+ minLength: s,
1390
1393
  label: d,
1391
- negativeNumberAllow: L,
1392
- parentClass: y,
1394
+ negativeNumberAllow: C,
1395
+ parentClass: x,
1393
1396
  disabled: T
1394
1397
  }
1395
1398
  );
1396
1399
  }
1397
- }, ca = ({ isOpen: b, onClose: o, config: s, onApply: i }) => {
1398
- var p;
1399
- const [d, t] = R({}), g = (l, u) => {
1400
- t((m) => ({ ...m, [l]: u }));
1401
- }, M = () => {
1402
- i == null || i(d), o();
1400
+ }, ha = ({ isOpen: u, onClose: l, config: i, onApply: o }) => {
1401
+ var c;
1402
+ const [d, n] = R({}), b = (m, a) => {
1403
+ n((f) => ({ ...f, [m]: a }));
1403
1404
  }, S = () => {
1404
- t({}), i == null || i({}), o();
1405
+ o == null || o(d), l();
1406
+ }, O = () => {
1407
+ n({}), o == null || o({}), l();
1405
1408
  };
1406
- return /* @__PURE__ */ h(j, { children: [
1409
+ return /* @__PURE__ */ h(E, { children: [
1407
1410
  /* @__PURE__ */ e(
1408
1411
  "div",
1409
1412
  {
1410
- className: `fixed inset-0 bg-black/50 z-40 transition-opacity duration-300 ${b ? "opacity-100 pointer-events-auto" : "opacity-0 pointer-events-none"}`,
1411
- onClick: o
1413
+ className: `fixed inset-0 bg-black/50 z-40 transition-opacity duration-300 ${u ? "opacity-100 pointer-events-auto" : "opacity-0 pointer-events-none"}`,
1414
+ onClick: l
1412
1415
  }
1413
1416
  ),
1414
1417
  /* @__PURE__ */ h(
@@ -1416,7 +1419,7 @@ const ia = ({
1416
1419
  {
1417
1420
  className: `fixed top-0 right-0 h-full w-[28rem] bg-white dark:bg-gray-900 shadow-2xl z-50 flex flex-col border-l border-gray-200 dark:border-gray-700
1418
1421
  transform transition-transform duration-300 ease-in-out
1419
- ${b ? "translate-x-0" : "translate-x-full"}
1422
+ ${u ? "translate-x-0" : "translate-x-full"}
1420
1423
  `,
1421
1424
  children: [
1422
1425
  /* @__PURE__ */ h("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700", children: [
@@ -1424,26 +1427,26 @@ const ia = ({
1424
1427
  /* @__PURE__ */ e(
1425
1428
  "button",
1426
1429
  {
1427
- onClick: o,
1430
+ onClick: l,
1428
1431
  className: "p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition",
1429
- children: /* @__PURE__ */ e(Ne, { className: "w-5 h-5 text-gray-500 dark:text-gray-400" })
1432
+ children: /* @__PURE__ */ e(Se, { className: "w-5 h-5 text-gray-500 dark:text-gray-400" })
1430
1433
  }
1431
1434
  )
1432
1435
  ] }),
1433
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto px-4 py-3", children: s != null && s.component ? /* @__PURE__ */ e(s.component, { filters: d, onFilterChange: g }) : /* @__PURE__ */ e("div", { className: "space-y-4", children: (p = s == null ? void 0 : s.fields) == null ? void 0 : p.map((l) => /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(
1434
- $e,
1436
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto px-4 py-3", children: i != null && i.component ? /* @__PURE__ */ e(i.component, { filters: d, onFilterChange: b }) : /* @__PURE__ */ e("div", { className: "space-y-4", children: (c = i == null ? void 0 : i.fields) == null ? void 0 : c.map((m) => /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
1437
+ Ge,
1435
1438
  {
1436
- field: l,
1439
+ field: m,
1437
1440
  formData: d,
1438
- handleChange: g
1441
+ handleChange: b
1439
1442
  },
1440
- l.key
1443
+ m.key
1441
1444
  ) })) }) }),
1442
1445
  /* @__PURE__ */ h("div", { className: "flex gap-2 px-4 py-3 border-t border-gray-200 dark:border-gray-700", children: [
1443
1446
  /* @__PURE__ */ e(
1444
- Z,
1447
+ Q,
1445
1448
  {
1446
- onClick: M,
1449
+ onClick: S,
1447
1450
  variant: "contained",
1448
1451
  color: "primary",
1449
1452
  fullWidth: !0,
@@ -1451,9 +1454,9 @@ const ia = ({
1451
1454
  }
1452
1455
  ),
1453
1456
  /* @__PURE__ */ e(
1454
- Z,
1457
+ Q,
1455
1458
  {
1456
- onClick: S,
1459
+ onClick: O,
1457
1460
  variant: "contained",
1458
1461
  className: "min-w-[150px]",
1459
1462
  children: "Reset"
@@ -1464,7 +1467,7 @@ const ia = ({
1464
1467
  }
1465
1468
  )
1466
1469
  ] });
1467
- }, Te = {
1470
+ }, Fe = {
1468
1471
  blue: {
1469
1472
  bg: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",
1470
1473
  border: "border border-blue-300 text-blue-700 dark:border-blue-700 dark:text-blue-300"
@@ -1497,47 +1500,47 @@ const ia = ({
1497
1500
  contained: "bg",
1498
1501
  outline: "border !bg-transparent",
1499
1502
  soft: "bg opacity-90"
1500
- }, Ge = ({
1501
- label: b,
1502
- variant: o = "contained",
1503
+ }, Ke = ({
1504
+ label: u,
1505
+ variant: l = "contained",
1503
1506
  // contained | outline | soft
1504
- color: s = "green",
1505
- className: i = ""
1507
+ color: i = "green",
1508
+ className: o = ""
1506
1509
  }) => {
1507
- const d = Te[s] || Te.green, t = Pe[o] || Pe.contained, g = o === "outline" ? d.border : d.bg;
1510
+ const d = Fe[i] || Fe.green, n = Pe[l] || Pe.contained, b = l === "outline" ? d.border : d.bg;
1508
1511
  return /* @__PURE__ */ e(
1509
1512
  "span",
1510
1513
  {
1511
1514
  className: `inline-flex justify-center items-center rounded-sm text-xs font-semibold px-3 py-1 min-w-[78px]
1512
- ${g}
1513
- ${t}
1514
- ${i}`,
1515
- children: b
1515
+ ${b}
1516
+ ${n}
1517
+ ${o}`,
1518
+ children: u
1516
1519
  }
1517
1520
  );
1518
- }, ha = ({ rows: b = 5, columns: o = 5 }) => /* @__PURE__ */ h(j, { children: [
1521
+ }, ua = ({ rows: u = 5, columns: l = 5 }) => /* @__PURE__ */ h(E, { children: [
1519
1522
  /* @__PURE__ */ e("div", { className: "w-full mb-6 inline-flex justify-end items-center", children: /* @__PURE__ */ e("div", { className: "h-8 w-80 bg-gray-300 dark:bg-gray-700 rounded animate-pulse" }) }),
1520
1523
  /* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ h("table", { className: "w-full border-collapse", children: [
1521
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "bg-gray-50 dark:bg-gray-900", children: Array.from({ length: o }).map((s, i) => /* @__PURE__ */ e("th", { className: "px-4 py-3", children: /* @__PURE__ */ e("div", { className: "h-6 w-24 bg-gray-300 dark:bg-gray-700 rounded animate-pulse inline-flex justify-center items-center" }) }, i)) }) }),
1522
- /* @__PURE__ */ e("tbody", { children: Array.from({ length: b }).map((s, i) => /* @__PURE__ */ e(
1524
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "bg-gray-50 dark:bg-gray-900", children: Array.from({ length: l }).map((i, o) => /* @__PURE__ */ e("th", { className: "px-4 py-3", children: /* @__PURE__ */ e("div", { className: "h-6 w-24 bg-gray-300 dark:bg-gray-700 rounded animate-pulse inline-flex justify-center items-center" }) }, o)) }) }),
1525
+ /* @__PURE__ */ e("tbody", { children: Array.from({ length: u }).map((i, o) => /* @__PURE__ */ e(
1523
1526
  "tr",
1524
1527
  {
1525
1528
  className: "border-t border-gray-200 dark:border-gray-800",
1526
- children: Array.from({ length: o }).map((d, t) => /* @__PURE__ */ e("td", { className: "px-4 py-6", children: /* @__PURE__ */ e("div", { className: "h-6 w-full bg-gray-300 dark:bg-gray-700 rounded animate-pulse" }) }, t))
1529
+ children: Array.from({ length: l }).map((d, n) => /* @__PURE__ */ e("td", { className: "px-4 py-6", children: /* @__PURE__ */ e("div", { className: "h-6 w-full bg-gray-300 dark:bg-gray-700 rounded animate-pulse" }) }, n))
1527
1530
  },
1528
- i
1531
+ o
1529
1532
  )) })
1530
1533
  ] }) })
1531
- ] }), _e = ({ src: b, alt: o = "preview", isOpen: s, setIsOpen: i }) => {
1532
- const d = () => i(!1);
1533
- return K(() => {
1534
- const t = (g) => {
1535
- g.key === "Escape" && d();
1534
+ ] }), _e = ({ src: u, alt: l = "preview", isOpen: i, setIsOpen: o }) => {
1535
+ const d = () => o(!1);
1536
+ return z(() => {
1537
+ const n = (b) => {
1538
+ b.key === "Escape" && d();
1536
1539
  };
1537
- return s && (document.body.style.overflow = "hidden", document.addEventListener("keydown", t)), () => {
1538
- document.body.style.overflow = "", document.removeEventListener("keydown", t);
1540
+ return i && (document.body.style.overflow = "hidden", document.addEventListener("keydown", n)), () => {
1541
+ document.body.style.overflow = "", document.removeEventListener("keydown", n);
1539
1542
  };
1540
- }, [s]), /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h(
1543
+ }, [i]), /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h(
1541
1544
  "div",
1542
1545
  {
1543
1546
  className: `fixed inset-0 z-50 flex items-center justify-center bg-black/70 dark:bg-black/80 \r
@@ -1550,19 +1553,19 @@ const ia = ({
1550
1553
  onClick: d,
1551
1554
  className: `absolute top-4 right-4 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200\r
1552
1555
  hover:bg-gray-100 dark:hover:bg-gray-700 rounded-full p-2 shadow-lg transition`,
1553
- children: /* @__PURE__ */ e(Ne, { size: 20 })
1556
+ children: /* @__PURE__ */ e(Se, { size: 20 })
1554
1557
  }
1555
1558
  ),
1556
1559
  /* @__PURE__ */ e(
1557
1560
  "div",
1558
1561
  {
1559
1562
  className: "max-w-5xl w-full px-4 transform transition-all duration-200 scale-95 animate-in zoom-in-95",
1560
- onClick: (t) => t.stopPropagation(),
1563
+ onClick: (n) => n.stopPropagation(),
1561
1564
  children: /* @__PURE__ */ e(
1562
1565
  "img",
1563
1566
  {
1564
- src: b,
1565
- alt: o,
1567
+ src: u,
1568
+ alt: l,
1566
1569
  className: "w-full max-h-[90vh] object-contain rounded-xl"
1567
1570
  }
1568
1571
  )
@@ -1571,201 +1574,220 @@ const ia = ({
1571
1574
  ]
1572
1575
  }
1573
1576
  ) });
1574
- }, ua = ({ config: b, setShowAdd: o, title: s, buttonText: i, description: d }) => {
1577
+ }, ba = ({
1578
+ config: u,
1579
+ setShowAdd: l,
1580
+ title: i,
1581
+ buttonText: o,
1582
+ description: d,
1583
+ showAddButton: n
1584
+ }) => {
1575
1585
  const {
1576
- data: t = [],
1577
- table_head: g = [],
1578
- loading: M = !1,
1579
- search: S = {
1586
+ data: b = [],
1587
+ table_head: S = [],
1588
+ loading: O = !1,
1589
+ search: c = {
1580
1590
  enabled: !1,
1581
1591
  placeholder: "Search...",
1582
1592
  useServerSideSearch: !1
1583
1593
  },
1584
- filter: p = {
1594
+ filter: m = {
1585
1595
  enabled: !1,
1586
1596
  useServerSideFilters: !1
1587
1597
  },
1588
- pagination: l = {
1598
+ pagination: a = {
1589
1599
  enabled: !1,
1590
1600
  rows_per_page: 10,
1591
1601
  useServerSidePagination: !1
1592
1602
  },
1593
- emptyMessage: u = "No data available",
1594
- onMenuAction: m,
1595
- setServerSidePaginationData: v = () => {
1603
+ emptyMessage: f = "No data available",
1604
+ onMenuAction: y,
1605
+ setServerSidePaginationData: s = () => {
1596
1606
  },
1597
- onFilterApply: c,
1598
- filterConfig: w = null,
1599
- rowClick: y = null
1600
- } = b, [k, I] = R(""), [A, C] = R(null), [O, F] = R([]), [T, L] = R({}), [B, E] = R(!1), [Y, $] = R(null), [_, z] = R(!1), D = Re(() => !S.enabled || !k.trim() || S.useServerSideSearch ? t : ra(t, k, S.searchKeys || []), [t, k, S]), [U, V] = R(1), [x, H] = R((l == null ? void 0 : l.rows_per_page) || 50), [J, Q] = R(D.length || 0), W = l != null && l.useServerSidePagination ? l.total_pages : Math.ceil(D.length / x), ie = Re(() => {
1601
- if (l.useServerSidePagination) return D;
1602
- const a = (U - 1) * x;
1603
- return D.slice(a, a + x);
1604
- }, [D, U, x]), te = ee(null), se = ee({}), ae = ee(null), de = (a) => {
1605
- I(a), V(1), S.useServerSideSearch && (ae.current && clearTimeout(ae.current), ae.current = setTimeout(async () => {
1607
+ onFilterApply: w,
1608
+ filterConfig: x = null,
1609
+ rowClick: N = null
1610
+ } = u, [P, F] = R(""), [M, L] = R(null), [B, T] = R([]), [C, j] = R({}), [G, W] = R(!1), [$, H] = R(null), [Y, I] = R(!1), K = Le(() => !c.enabled || !P.trim() || c.useServerSideSearch ? b : ra(b, P, c.searchKeys || []), [b, P, c]), [_, k] = R(1), [U, X] = R((a == null ? void 0 : a.rows_per_page) || 50), [J, ee] = R(K.length || 0), ne = a != null && a.useServerSidePagination ? a.total_pages : Math.ceil(K.length / U), ce = Le(() => {
1611
+ if (a.useServerSidePagination) return K;
1612
+ const t = (_ - 1) * U;
1613
+ return K.slice(t, t + U);
1614
+ }, [K, _, U]), le = ae(null), oe = ae({}), te = ae(null), he = (t) => {
1615
+ F(t), k(1), c.useServerSideSearch && (te.current && clearTimeout(te.current), te.current = setTimeout(async () => {
1606
1616
  try {
1607
- await v((n) => ({
1608
- ...n,
1609
- search: a,
1617
+ await s((g) => ({
1618
+ ...g,
1619
+ search: t,
1610
1620
  current_page: 1
1611
1621
  }));
1612
- } catch (n) {
1613
- console.error("Search error:", n);
1622
+ } catch (g) {
1623
+ console.error("Search error:", g);
1614
1624
  }
1615
1625
  }, 800));
1616
- }, ce = (a, n, f) => {
1617
- f.stopPropagation(), C(null), m == null || m(a.type, n);
1618
- }, he = (a, n, f) => {
1619
- n.stopPropagation(), F(f);
1620
- const N = n.currentTarget;
1621
- se.current[a] = N;
1622
- const P = N.getBoundingClientRect(), G = 192, X = f.length * 40, ve = window.innerWidth, De = window.innerHeight, ze = ve - P.right < G ? P.left - G + P.width : P.left, He = De - P.bottom < X && P.top > X ? P.top - X - 2 : P.bottom + 2;
1623
- L({
1624
- top: Math.max(8, Math.min(He, De - X - 8)),
1625
- left: Math.max(8, Math.min(ze, ve - G - 8))
1626
- }), C(A === a ? null : a);
1627
- }, ue = (a) => (U - 1) * x + a + 1, be = (a) => {
1628
- a && a.src instanceof File && (a = { ...a, src: URL.createObjectURL(a.src) }), $(a), z(!0);
1629
- }, ne = (a, n, f, N = null) => /* @__PURE__ */ e(j, { children: a ? /* @__PURE__ */ e(
1626
+ }, ue = (t, g, D) => {
1627
+ D.stopPropagation(), L(null), y == null || y(t.type, g);
1628
+ }, be = (t, g, D) => {
1629
+ g.stopPropagation(), T(D);
1630
+ const p = g.currentTarget;
1631
+ oe.current[t] = p;
1632
+ const v = p.getBoundingClientRect(), A = 192, q = D.length * 40, V = window.innerWidth, Te = window.innerHeight, He = V - v.right < A ? v.left - A + v.width : v.left, Ye = Te - v.bottom < q && v.top > q ? v.top - q - 2 : v.bottom + 2;
1633
+ j({
1634
+ top: Math.max(8, Math.min(Ye, Te - q - 8)),
1635
+ left: Math.max(8, Math.min(He, V - A - 8))
1636
+ }), L(M === t ? null : t);
1637
+ }, pe = (t) => (_ - 1) * U + t + 1, ge = (t) => {
1638
+ t && t.src instanceof File && (t = { ...t, src: URL.createObjectURL(t.src) }), H(t), I(!0);
1639
+ }, ie = (t, g, D, p = null, v = null) => /* @__PURE__ */ e(E, { children: t ? /* @__PURE__ */ e(
1630
1640
  "img",
1631
1641
  {
1632
- src: a instanceof File ? URL.createObjectURL(a) : a,
1633
- alt: n || "Avatar",
1634
- onClick: (P) => {
1635
- P.stopPropagation(), P.preventDefault(), be({ src: a, alt: n });
1642
+ src: t instanceof File ? URL.createObjectURL(t) : t,
1643
+ alt: g || "Avatar",
1644
+ onClick: (A) => {
1645
+ A.stopPropagation(), A.preventDefault(), ge({ src: t, alt: g });
1636
1646
  },
1637
- className: `w-10 h-10 cursor-pointer shrink-0 rounded-full object-cover border border-gray-200 dark:border-gray-700 ${f || ""}`
1647
+ className: `w-10 h-10 cursor-pointer shrink-0 rounded-full object-cover border border-gray-200 dark:border-gray-700 ${D || ""}`
1638
1648
  }
1639
- ) : /* @__PURE__ */ e(j, { children: N || /* @__PURE__ */ e(
1649
+ ) : /* @__PURE__ */ e(E, { children: p ? typeof p == "function" ? p(v) : p : /* @__PURE__ */ e(
1640
1650
  "div",
1641
1651
  {
1642
- className: `w-10 h-10 flex items-center shrink-0 justify-center rounded-full border border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600 ${f || ""}`,
1643
- children: /* @__PURE__ */ e(Be, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
1652
+ className: `w-10 h-10 flex items-center shrink-0 justify-center rounded-full border border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600 ${D || ""}`,
1653
+ children: /* @__PURE__ */ e(Ue, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
1644
1654
  }
1645
- ) }) }), pe = (a, n) => /* @__PURE__ */ e(j, { children: a ? /* @__PURE__ */ e(
1655
+ ) }) }), me = (t, g) => /* @__PURE__ */ e(E, { children: t ? /* @__PURE__ */ e(
1646
1656
  "audio",
1647
1657
  {
1648
1658
  controls: !0,
1649
- src: a instanceof File ? URL.createObjectURL(a) : a,
1650
- onClick: (f) => {
1651
- f.stopPropagation();
1659
+ src: t instanceof File ? URL.createObjectURL(t) : t,
1660
+ onClick: (D) => {
1661
+ D.stopPropagation();
1652
1662
  },
1653
- className: `w-64 cursor-pointer ${n || ""}`
1663
+ className: `w-64 cursor-pointer ${g || ""}`
1654
1664
  },
1655
- a instanceof File ? URL.createObjectURL(a) : a
1656
- ) : /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(
1665
+ t instanceof File ? URL.createObjectURL(t) : t
1666
+ ) : /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
1657
1667
  "div",
1658
1668
  {
1659
- className: `w-12 h-12 flex items-center shrink-0 justify-center rounded-full border border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600 ${n || ""}`,
1660
- children: /* @__PURE__ */ e(Qe, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
1669
+ className: `w-12 h-12 flex items-center shrink-0 justify-center rounded-full border border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600 ${g || ""}`,
1670
+ children: /* @__PURE__ */ e(Xe, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
1661
1671
  }
1662
- ) }) }), ge = (a, n) => /* @__PURE__ */ h("div", { className: `flex items-center space-x-4 ${n.className || ""}`, children: [
1663
- n.imageKey ? ne(a[n.imageKey], a[n.titleKey], "group-avatar") : "",
1672
+ ) }) }), fe = (t, g) => /* @__PURE__ */ h("div", { className: `flex items-center space-x-4 ${g.className || ""}`, children: [
1673
+ g.imageKey ? ie(
1674
+ t[g.imageKey],
1675
+ t[g.titleKey],
1676
+ "group-avatar",
1677
+ g.fallback_icon,
1678
+ t
1679
+ ) : "",
1664
1680
  /* @__PURE__ */ h("div", { children: [
1665
- /* @__PURE__ */ e("p", { className: "font-medium text-gray-900 dark:text-white group-title", children: a[n.titleKey] || "" }),
1666
- /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400 group-sub-title", children: a[n.subtitleKey] || "" })
1681
+ /* @__PURE__ */ e("p", { className: "font-medium text-gray-900 dark:text-white group-title", children: t[g.titleKey] || "" }),
1682
+ /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400 group-sub-title", children: t[g.subtitleKey] || "" })
1667
1683
  ] })
1668
- ] }), me = (a, n) => {
1669
- var G;
1670
- let f = String(a);
1671
- const N = n.variant || "contained";
1672
- let P = n.defaultColor;
1673
- if (((G = n == null ? void 0 : n.chipOptions) == null ? void 0 : G.length) > 0) {
1674
- let X = n == null ? void 0 : n.chipOptions.find((ve) => ve.value == a);
1675
- X && (f = X.label, P = X.color);
1684
+ ] }), ye = (t, g) => {
1685
+ var A;
1686
+ let D = String(t);
1687
+ const p = g.variant || "contained";
1688
+ let v = g.defaultColor;
1689
+ if (((A = g == null ? void 0 : g.chipOptions) == null ? void 0 : A.length) > 0) {
1690
+ let q = g == null ? void 0 : g.chipOptions.find((V) => V.value == t);
1691
+ q && (D = q.label, v = q.color);
1676
1692
  }
1677
1693
  return /* @__PURE__ */ e(
1678
- Ge,
1694
+ Ke,
1679
1695
  {
1680
- label: f,
1681
- variant: N,
1682
- color: P,
1683
- className: n.className || ""
1696
+ label: D,
1697
+ variant: p,
1698
+ color: v,
1699
+ className: g.className || ""
1684
1700
  }
1685
1701
  );
1686
- }, fe = (a, n, f) => {
1687
- const N = n[a.key];
1688
- return a.type === "menu_actions" ? /* @__PURE__ */ e("div", { className: `text-center ${a.className || ""}`, children: /* @__PURE__ */ e(
1702
+ }, xe = (t, g, D) => {
1703
+ const p = g[t.key];
1704
+ return t.type === "menu_actions" ? /* @__PURE__ */ e("div", { className: `text-center ${t.className || ""}`, children: /* @__PURE__ */ e(
1689
1705
  "button",
1690
1706
  {
1691
- ref: (P) => se.current[n.id || n._id] = P,
1692
- onClick: (P) => he(n.id || n._id, P, a.menuList),
1707
+ ref: (v) => oe.current[g.id || g._id] = v,
1708
+ onClick: (v) => be(g.id || g._id, v, t.menuList),
1693
1709
  className: "p-2 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-full transition text-gray-700 dark:text-gray-300",
1694
- children: /* @__PURE__ */ e(Je, { className: "h-4 w-4" })
1710
+ children: /* @__PURE__ */ e(Qe, { className: "h-4 w-4" })
1695
1711
  }
1696
- ) }) : a.type === "index" ? /* @__PURE__ */ e("span", { className: a.className || "", children: ue(f) }) : a.type === "group" ? ge(n, a) : a.type === "chip" ? /* @__PURE__ */ e(j, { children: me(N, a) }) : a.type === "date" ? /* @__PURE__ */ e("span", { className: a.className || "", children: Ue(N, a.format || "DD MMM YYYY") }) : a.type === "avatar" ? /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e("div", { className: "min-w-[40px]", children: ne(N, a.alt, a.className, a.fallback_icon) }) }) : a.type === "audio" ? /* @__PURE__ */ e(j, { children: pe(N, a.className) }) : /* @__PURE__ */ e("span", { className: a.className || "", children: N || "N/A" });
1697
- }, ye = (a) => {
1698
- if (typeof y == "function")
1699
- return y(a);
1700
- if (y)
1701
- return m == null ? void 0 : m("view", a);
1702
- }, xe = (a, n) => {
1703
- if (a.onClickDetails)
1704
- return m == null ? void 0 : m("view", n);
1705
- if (typeof a.handleClick == "function")
1706
- return a.handleClick(n);
1707
- }, le = () => y || typeof y == "function", oe = (a) => a.onClickDetails || typeof a.handleClick == "function";
1708
- return K(() => {
1709
- const a = () => {
1710
- A && C(null);
1712
+ ) }) : t.type === "index" ? /* @__PURE__ */ e("span", { className: t.className || "", children: pe(D) }) : t.type === "group" ? fe(g, t) : t.type === "chip" ? /* @__PURE__ */ e(E, { children: ye(p, t) }) : t.type === "date" ? /* @__PURE__ */ e("span", { className: t.className || "", children: je(p, t.format || "DD MMM YYYY") }) : t.type === "avatar" ? /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e("div", { className: "min-w-[40px]", children: ie(
1713
+ p,
1714
+ t.alt,
1715
+ t.className,
1716
+ t.fallback_icon,
1717
+ g
1718
+ ) }) }) : t.type === "audio" ? /* @__PURE__ */ e(E, { children: me(p, t.className) }) : /* @__PURE__ */ e("span", { className: t.className || "", children: p || "N/A" });
1719
+ }, ve = (t) => {
1720
+ if (typeof N == "function")
1721
+ return N(t);
1722
+ if (N)
1723
+ return y == null ? void 0 : y("view", t);
1724
+ }, we = (t, g) => {
1725
+ if (t.onClickDetails)
1726
+ return y == null ? void 0 : y("view", g);
1727
+ if (typeof t.handleClick == "function")
1728
+ return t.handleClick(g);
1729
+ }, se = () => N || typeof N == "function", de = (t) => t.onClickDetails || typeof t.handleClick == "function";
1730
+ return z(() => {
1731
+ const t = () => {
1732
+ M && L(null);
1711
1733
  };
1712
- return window.addEventListener("scroll", a, !0), () => {
1713
- window.removeEventListener("scroll", a, !0);
1734
+ return window.addEventListener("scroll", t, !0), () => {
1735
+ window.removeEventListener("scroll", t, !0);
1714
1736
  };
1715
- }, [A]), K(() => {
1716
- const a = (n) => {
1717
- te.current && !te.current.contains(n.target) && C(null);
1737
+ }, [M]), z(() => {
1738
+ const t = (g) => {
1739
+ le.current && !le.current.contains(g.target) && L(null);
1718
1740
  };
1719
- return document.addEventListener("click", a), () => document.removeEventListener("click", a);
1720
- }, []), K(() => {
1721
- l != null && l.rows_per_page && (l != null && l.useServerSidePagination) && H((l == null ? void 0 : l.rows_per_page) || 50), l.current_page && V(l.current_page);
1741
+ return document.addEventListener("click", t), () => document.removeEventListener("click", t);
1742
+ }, []), z(() => {
1743
+ a != null && a.rows_per_page && (a != null && a.useServerSidePagination) && X((a == null ? void 0 : a.rows_per_page) || 50), a.current_page && k(a.current_page);
1722
1744
  }, [
1723
- l.rows_per_page,
1724
- l == null ? void 0 : l.useServerSidePagination,
1725
- l.current_page
1726
- ]), K(() => {
1727
- Q(
1728
- l != null && l.useServerSidePagination ? l.total_records : D.length
1729
- ), D.length <= x * (U - 1) && !(l != null && l.useServerSidePagination) && V((a) => a - 1 || 1);
1745
+ a.rows_per_page,
1746
+ a == null ? void 0 : a.useServerSidePagination,
1747
+ a.current_page
1748
+ ]), z(() => {
1749
+ ee(
1750
+ a != null && a.useServerSidePagination ? a.total_records : K.length
1751
+ ), K.length <= U * (_ - 1) && !(a != null && a.useServerSidePagination) && k((t) => t - 1 || 1);
1730
1752
  }, [
1731
- D.length,
1732
- l.total_records,
1733
- l == null ? void 0 : l.useServerSidePagination
1734
- ]), M ? /* @__PURE__ */ e(ha, { rows: 6, columns: 6 }) : /* @__PURE__ */ h(j, { children: [
1753
+ K.length,
1754
+ a.total_records,
1755
+ a == null ? void 0 : a.useServerSidePagination
1756
+ ]), O ? /* @__PURE__ */ e(ua, { rows: 6, columns: 6 }) : /* @__PURE__ */ h(E, { children: [
1735
1757
  /* @__PURE__ */ h("div", { className: "flex flex-col sm:flex-row sm:justify-between gap-4 mb-3", children: [
1736
1758
  /* @__PURE__ */ h("div", { children: [
1737
- /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: s }),
1759
+ /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: i }),
1738
1760
  /* @__PURE__ */ e("p", { className: "text-md text-gray-600 dark:text-gray-400", children: d })
1739
1761
  ] }),
1740
1762
  /* @__PURE__ */ h("div", { className: "flex flex-col justify-end items-end gap-2", children: [
1741
- /* @__PURE__ */ h(
1742
- Z,
1763
+ n && /* @__PURE__ */ h(
1764
+ Q,
1743
1765
  {
1744
- onClick: () => o(!0),
1766
+ onClick: () => l(!0),
1745
1767
  variant: "contained",
1746
1768
  color: "primary",
1747
1769
  children: [
1748
- /* @__PURE__ */ e(Ve, { className: "w-4 h-4 mr-2" }),
1749
- i || "Add New"
1770
+ /* @__PURE__ */ e(We, { className: "w-4 h-4 mr-2" }),
1771
+ o || "Add New"
1750
1772
  ]
1751
1773
  }
1752
1774
  ),
1753
1775
  /* @__PURE__ */ h("div", { className: "flex justify-end items-center gap-2", children: [
1754
- S.enabled && /* @__PURE__ */ e("div", { className: "", children: /* @__PURE__ */ h("div", { className: "relative min-w-[300px]", children: [
1755
- /* @__PURE__ */ e(Oe, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-300" }),
1776
+ c.enabled && /* @__PURE__ */ e("div", { className: "", children: /* @__PURE__ */ h("div", { className: "relative min-w-[300px]", children: [
1777
+ /* @__PURE__ */ e(Ae, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-300" }),
1756
1778
  /* @__PURE__ */ e(
1757
1779
  "input",
1758
1780
  {
1759
1781
  type: "text",
1760
- placeholder: S.placeholder || "Search...",
1761
- value: k,
1762
- onChange: (a) => de(a.target.value),
1782
+ placeholder: c.placeholder || "Search...",
1783
+ value: P,
1784
+ onChange: (t) => he(t.target.value),
1763
1785
  className: "w-full h-[36px] pl-9 pr-4 py-3 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-300 dark:ring-blue-200 disabled:opacity-50"
1764
1786
  }
1765
1787
  )
1766
1788
  ] }) }),
1767
- w && p.enabled && /* @__PURE__ */ h(Z, { onClick: () => E(!0), variant: "contained", children: [
1768
- /* @__PURE__ */ e(We, { className: "w-4 h-4 mr-2" }),
1789
+ x && m.enabled && /* @__PURE__ */ h(Q, { onClick: () => W(!0), variant: "contained", children: [
1790
+ /* @__PURE__ */ e(qe, { className: "w-4 h-4 mr-2" }),
1769
1791
  "Filters"
1770
1792
  ] })
1771
1793
  ] })
@@ -1773,51 +1795,51 @@ const ia = ({
1773
1795
  ] }),
1774
1796
  /* @__PURE__ */ h("div", { className: "bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden border border-gray-200 dark:border-gray-700", children: [
1775
1797
  /* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ h("table", { className: "min-w-full divide-y divide-gray-200 dark:divide-gray-700", children: [
1776
- /* @__PURE__ */ e("thead", { className: "bg-gray-50 dark:bg-gray-700/60", children: /* @__PURE__ */ e("tr", { children: g.map((a) => /* @__PURE__ */ e(
1798
+ /* @__PURE__ */ e("thead", { className: "bg-gray-50 dark:bg-gray-700/60", children: /* @__PURE__ */ e("tr", { children: S.map((t) => /* @__PURE__ */ e(
1777
1799
  "th",
1778
1800
  {
1779
- className: `px-6 py-4 text-left text-xs font-medium text-black dark:text-white uppercase tracking-wider min-w-max max-w-[180px] truncate ${a.headClass || ""}`,
1780
- children: a.title
1801
+ className: `px-6 py-4 text-left text-xs font-medium text-black dark:text-white uppercase tracking-wider min-w-max max-w-[180px] truncate ${t.headClass || ""}`,
1802
+ children: t.title
1781
1803
  },
1782
- a.key
1804
+ t.key
1783
1805
  )) }) }),
1784
- /* @__PURE__ */ e("tbody", { className: "bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700", children: ie.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e(
1806
+ /* @__PURE__ */ e("tbody", { className: "bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700", children: ce.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e(
1785
1807
  "td",
1786
1808
  {
1787
- colSpan: g.length,
1809
+ colSpan: S.length,
1788
1810
  className: "text-center py-10 text-gray-500 dark:text-gray-400",
1789
- children: u
1811
+ children: f
1790
1812
  }
1791
- ) }) : ie.map((a, n) => /* @__PURE__ */ e(
1813
+ ) }) : ce.map((t, g) => /* @__PURE__ */ e(
1792
1814
  "tr",
1793
1815
  {
1794
- className: `hover:bg-gray-50 dark:hover:bg-blue-800/10 transition ${le() ? "cursor-pointer" : ""}`,
1795
- onClick: (f) => {
1796
- le() && ye(a);
1816
+ className: `hover:bg-gray-50 dark:hover:bg-blue-800/10 transition ${se() ? "cursor-pointer" : ""}`,
1817
+ onClick: (D) => {
1818
+ se() && ve(t);
1797
1819
  },
1798
- children: g.map((f) => /* @__PURE__ */ e(
1820
+ children: S.map((D) => /* @__PURE__ */ e(
1799
1821
  "td",
1800
1822
  {
1801
- className: `px-6 py-4 text-sm text-gray-900 dark:text-gray-100 min-w-max ${f.type == "audio" ? "" : "max-w-[300px]"} truncate ${oe(f) ? "cursor-pointer" : ""}`,
1802
- title: String(a[f.key] ?? ""),
1803
- onClick: (N) => {
1804
- oe(f) && (N.stopPropagation(), N.preventDefault(), xe(f, a));
1823
+ className: `px-6 py-4 text-sm text-gray-900 dark:text-gray-100 min-w-max ${D.type == "audio" ? "" : "max-w-[300px]"} truncate ${de(D) ? "cursor-pointer" : ""}`,
1824
+ title: String(t[D.key] ?? ""),
1825
+ onClick: (p) => {
1826
+ de(D) && (p.stopPropagation(), p.preventDefault(), we(D, t));
1805
1827
  },
1806
- children: f.render ? f.render(a, n) : fe(f, a, n)
1828
+ children: D.render ? D.render(t, g) : xe(D, t, g)
1807
1829
  },
1808
- f.key
1830
+ D.key
1809
1831
  ))
1810
1832
  },
1811
- a.id || a._id || n
1833
+ t.id || t._id || g
1812
1834
  )) })
1813
1835
  ] }) }),
1814
- (l == null ? void 0 : l.enabled) && D.length > 0 && /* @__PURE__ */ h("div", { className: " bg-gray-50 dark:bg-gray-700/60 px-6 py-3 flex flex-wrap items-center justify-between border-t border-gray-200 dark:border-gray-600 gap-3", children: [
1836
+ (a == null ? void 0 : a.enabled) && K.length > 0 && /* @__PURE__ */ h("div", { className: " bg-gray-50 dark:bg-gray-700/60 px-6 py-3 flex flex-wrap items-center justify-between border-t border-gray-200 dark:border-gray-600 gap-3", children: [
1815
1837
  /* @__PURE__ */ h("div", { className: "text-sm text-gray-700 dark:text-gray-300", children: [
1816
1838
  "Showing ",
1817
- (U - 1) * x + 1,
1839
+ (_ - 1) * U + 1,
1818
1840
  " to",
1819
1841
  " ",
1820
- Math.min(U * x, J),
1842
+ Math.min(_ * U, J),
1821
1843
  " of ",
1822
1844
  J,
1823
1845
  " ",
@@ -1829,17 +1851,17 @@ const ia = ({
1829
1851
  /* @__PURE__ */ e(
1830
1852
  "select",
1831
1853
  {
1832
- value: x,
1833
- onChange: (a) => {
1834
- const n = Number(a.target.value);
1835
- H(n), V(1), l.useServerSidePagination && v((f) => ({
1836
- ...f,
1854
+ value: U,
1855
+ onChange: (t) => {
1856
+ const g = Number(t.target.value);
1857
+ X(g), k(1), a.useServerSidePagination && s((D) => ({
1858
+ ...D,
1837
1859
  current_page: 1,
1838
- rows_per_page: n
1860
+ rows_per_page: g
1839
1861
  }));
1840
1862
  },
1841
1863
  className: "border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-sm rounded-md px-2 py-1 focus:outline-none focus:ring-1 focus:ring-blue-500",
1842
- children: [2, 10, 25, 50, 100].map((a) => /* @__PURE__ */ e("option", { value: a, children: a }, a))
1864
+ children: [2, 10, 25, 50, 100].map((t) => /* @__PURE__ */ e("option", { value: t, children: t }, t))
1843
1865
  }
1844
1866
  )
1845
1867
  ] }),
@@ -1848,121 +1870,121 @@ const ia = ({
1848
1870
  "button",
1849
1871
  {
1850
1872
  onClick: () => {
1851
- if (U > 1) {
1852
- const a = U - 1;
1853
- V(a), l.useServerSidePagination && v((n) => ({
1854
- ...n,
1855
- current_page: a
1873
+ if (_ > 1) {
1874
+ const t = _ - 1;
1875
+ k(t), a.useServerSidePagination && s((g) => ({
1876
+ ...g,
1877
+ current_page: t
1856
1878
  }));
1857
1879
  }
1858
1880
  },
1859
- disabled: U === 1,
1881
+ disabled: _ === 1,
1860
1882
  className: "p-2 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition text-gray-500 dark:text-gray-300 disabled:opacity-50",
1861
- children: /* @__PURE__ */ e(qe, { className: "h-4 w-4" })
1883
+ children: /* @__PURE__ */ e(Ze, { className: "h-4 w-4" })
1862
1884
  }
1863
1885
  ),
1864
1886
  /* @__PURE__ */ h("span", { className: "text-sm text-gray-800 dark:text-gray-200", children: [
1865
1887
  "Page ",
1866
- U,
1888
+ _,
1867
1889
  " of ",
1868
- W
1890
+ ne
1869
1891
  ] }),
1870
1892
  /* @__PURE__ */ e(
1871
1893
  "button",
1872
1894
  {
1873
1895
  onClick: () => {
1874
- if (U < W) {
1875
- const a = U + 1;
1876
- V(a), l.useServerSidePagination && v((n) => ({
1877
- ...n,
1878
- current_page: a
1896
+ if (_ < ne) {
1897
+ const t = _ + 1;
1898
+ k(t), a.useServerSidePagination && s((g) => ({
1899
+ ...g,
1900
+ current_page: t
1879
1901
  }));
1880
1902
  }
1881
1903
  },
1882
- disabled: U === W,
1904
+ disabled: _ === ne,
1883
1905
  className: "p-2 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition text-gray-500 dark:text-gray-300 disabled:opacity-50",
1884
- children: /* @__PURE__ */ e(Ze, { className: "h-4 w-4" })
1906
+ children: /* @__PURE__ */ e(Je, { className: "h-4 w-4" })
1885
1907
  }
1886
1908
  )
1887
1909
  ] })
1888
1910
  ] })
1889
1911
  ] })
1890
1912
  ] }),
1891
- A && Xe(
1913
+ M && ea(
1892
1914
  /* @__PURE__ */ e(
1893
1915
  "div",
1894
1916
  {
1895
- ref: te,
1917
+ ref: le,
1896
1918
  style: {
1897
1919
  position: "fixed",
1898
- top: `${T.top}px`,
1899
- left: `${T.left}px`,
1920
+ top: `${C.top}px`,
1921
+ left: `${C.left}px`,
1900
1922
  zIndex: 9999
1901
1923
  },
1902
1924
  className: "w-48 bg-white dark:bg-gray-700 rounded-md shadow-lg border border-gray-200 dark:border-gray-600",
1903
- children: O.map((a, n) => /* @__PURE__ */ h(
1925
+ children: B.map((t, g) => /* @__PURE__ */ h(
1904
1926
  "button",
1905
1927
  {
1906
- onClick: (f) => ce(
1907
- a,
1908
- t.find(
1909
- (N) => N.id === A || N._id == A
1928
+ onClick: (D) => ue(
1929
+ t,
1930
+ b.find(
1931
+ (p) => p.id === M || p._id == M
1910
1932
  ),
1911
- f
1933
+ D
1912
1934
  ),
1913
- className: `w-full flex items-center gap-2 px-4 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-gray-600 ${a.variant === "danger" ? "text-red-600 dark:text-red-500" : "text-gray-700 dark:text-gray-200"}`,
1935
+ className: `w-full flex items-center gap-2 px-4 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-gray-600 ${t.variant === "danger" ? "text-red-600 dark:text-red-500" : "text-gray-700 dark:text-gray-200"}`,
1914
1936
  children: [
1915
- a.icon && /* @__PURE__ */ e("span", { className: "shrink-0", children: a.icon }),
1916
- a.title
1937
+ t.icon && /* @__PURE__ */ e("span", { className: "shrink-0", children: t.icon }),
1938
+ t.title
1917
1939
  ]
1918
1940
  },
1919
- n
1941
+ g
1920
1942
  ))
1921
1943
  }
1922
1944
  ),
1923
1945
  document.body
1924
1946
  ),
1925
- w && /* @__PURE__ */ e(
1926
- ca,
1947
+ x && /* @__PURE__ */ e(
1948
+ ha,
1927
1949
  {
1928
- isOpen: B,
1929
- onClose: () => E(!1),
1930
- config: w,
1931
- onApply: c
1950
+ isOpen: G,
1951
+ onClose: () => W(!1),
1952
+ config: x,
1953
+ onApply: w
1932
1954
  }
1933
1955
  ),
1934
- _ && /* @__PURE__ */ e(
1956
+ Y && /* @__PURE__ */ e(
1935
1957
  _e,
1936
1958
  {
1937
- src: Y.src,
1938
- alt: Y.alt,
1939
- isOpen: _,
1940
- setIsOpen: z
1959
+ src: $.src,
1960
+ alt: $.alt,
1961
+ isOpen: Y,
1962
+ setIsOpen: I
1941
1963
  }
1942
1964
  )
1943
1965
  ] });
1944
- }, ke = ({
1945
- isOpen: b,
1946
- onClose: o,
1947
- icon: s,
1948
- title: i,
1966
+ }, Ne = ({
1967
+ isOpen: u,
1968
+ onClose: l,
1969
+ icon: i,
1970
+ title: o,
1949
1971
  children: d,
1950
- size: t = "md",
1951
- actionButtons: g = [],
1952
- actions: M,
1953
- showDefaultClose: S = !0,
1954
- footerConfig: p = null,
1955
- hideFooter: l = !1,
1956
- onFormSubmit: u = () => {
1972
+ size: n = "md",
1973
+ actionButtons: b = [],
1974
+ actions: S,
1975
+ showDefaultClose: O = !0,
1976
+ footerConfig: c = null,
1977
+ hideFooter: m = !1,
1978
+ onFormSubmit: a = () => {
1957
1979
  },
1958
- onCancel: m,
1959
- loadingBtn: v = !1,
1960
- executeFunction: c = () => {
1980
+ onCancel: f,
1981
+ loadingBtn: y = !1,
1982
+ executeFunction: s = () => {
1961
1983
  },
1962
1984
  selectedItem: w = null
1963
1985
  }) => {
1964
- if (!b) return null;
1965
- const y = {
1986
+ if (!u) return null;
1987
+ const x = {
1966
1988
  sm: "max-w-md",
1967
1989
  md: "max-w-lg",
1968
1990
  lg: "max-w-2xl",
@@ -1974,117 +1996,117 @@ const ia = ({
1974
1996
  "div",
1975
1997
  {
1976
1998
  className: "fixed inset-0 bg-gray-500 opacity-75",
1977
- onClick: () => o()
1999
+ onClick: () => l()
1978
2000
  }
1979
2001
  ),
1980
2002
  /* @__PURE__ */ h(
1981
2003
  "div",
1982
2004
  {
1983
- className: `relative bg-white rounded-lg shadow-xl w-full ${y[t] || y.md} max-h-[90vh] flex flex-col dark:bg-gray-800`,
2005
+ className: `relative bg-white rounded-lg shadow-xl w-full ${x[n] || x.md} max-h-[90vh] flex flex-col dark:bg-gray-800`,
1984
2006
  children: [
1985
2007
  /* @__PURE__ */ h("div", { className: "flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0", children: [
1986
2008
  /* @__PURE__ */ h("div", { className: "flex items-center gap-1", children: [
1987
- s && /* @__PURE__ */ e("span", { children: s }),
1988
- /* @__PURE__ */ e("h3", { className: "text-lg font-medium text-gray-900 dark:text-white", children: i })
2009
+ i && /* @__PURE__ */ e("span", { children: i }),
2010
+ /* @__PURE__ */ e("h3", { className: "text-lg font-medium text-gray-900 dark:text-white", children: o })
1989
2011
  ] }),
1990
2012
  /* @__PURE__ */ e(
1991
2013
  "button",
1992
2014
  {
1993
- onClick: () => o(),
2015
+ onClick: () => l(),
1994
2016
  className: "text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",
1995
- children: /* @__PURE__ */ e(Ne, { className: "w-6 h-6" })
2017
+ children: /* @__PURE__ */ e(Se, { className: "w-6 h-6" })
1996
2018
  }
1997
2019
  )
1998
2020
  ] }),
1999
2021
  /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: d }),
2000
- g.length > 0 && /* @__PURE__ */ e("div", { className: "px-4 py-3 flex justify-end gap-3 border-t border-gray-200 dark:border-gray-700 sm:px-6", children: g.map((k) => /* @__PURE__ */ e(
2001
- Z,
2022
+ b.length > 0 && /* @__PURE__ */ e("div", { className: "px-4 py-3 flex justify-end gap-3 border-t border-gray-200 dark:border-gray-700 sm:px-6", children: b.map((N) => /* @__PURE__ */ e(
2023
+ Q,
2002
2024
  {
2003
- onClick: (I) => {
2004
- k.type == "submit" ? u(I) : c(
2025
+ onClick: (P) => {
2026
+ N.type == "submit" ? a(P) : s(
2005
2027
  () => {
2006
- var A;
2007
- return (A = k == null ? void 0 : k.onClick) == null ? void 0 : A.call(k, I, w);
2028
+ var F;
2029
+ return (F = N == null ? void 0 : N.onClick) == null ? void 0 : F.call(N, P, w);
2008
2030
  },
2009
- (A) => o == null ? void 0 : o(A)
2031
+ (F) => l == null ? void 0 : l(F)
2010
2032
  );
2011
2033
  },
2012
- disabled: v || k.disabled,
2013
- variant: k.variant || "contained",
2014
- color: k.color || "primary",
2015
- className: `min-w-[100px] ${k.className}`,
2016
- type: k.type || "button",
2017
- children: v ? /* @__PURE__ */ h("div", { className: "flex items-center", children: [
2034
+ disabled: y || N.disabled,
2035
+ variant: N.variant || "contained",
2036
+ color: N.color || "primary",
2037
+ className: `min-w-[100px] ${N.className}`,
2038
+ type: N.type || "button",
2039
+ children: y ? /* @__PURE__ */ h("div", { className: "flex items-center", children: [
2018
2040
  /* @__PURE__ */ e("div", { className: "animate-spin rounded-full h-4 w-4 border-2 border-white/30 border-t-2 border-t-white mr-2" }),
2019
- k.label || "Submit",
2041
+ N.label || "Submit",
2020
2042
  "..."
2021
- ] }) : k.label || "Submit"
2043
+ ] }) : N.label || "Submit"
2022
2044
  }
2023
2045
  )) })
2024
2046
  ]
2025
2047
  }
2026
2048
  )
2027
2049
  ] });
2028
- }, Fe = ({ config: b, onSubmit: o, initialData: s = {}, type: i = "add" }) => {
2029
- const { formClass: d = "grid grid-cols-12 gap-4", formFields: t = [] } = b || {}, [g, M] = R(s);
2030
- K(() => {
2031
- M(s);
2050
+ }, Ie = ({ config: u, onSubmit: l, initialData: i = {}, type: o = "add" }) => {
2051
+ const { formClass: d = "grid grid-cols-12 gap-4", formFields: n = [] } = u || {}, [b, S] = R(i);
2052
+ z(() => {
2053
+ S(i);
2032
2054
  }, []);
2033
- const S = (l, u) => {
2034
- M((m) => ({ ...m, [l]: u }));
2035
- }, p = (l) => {
2036
- l.preventDefault();
2037
- const u = l.target;
2038
- if (!u.checkValidity()) {
2039
- u.reportValidity();
2055
+ const O = (m, a) => {
2056
+ S((f) => ({ ...f, [m]: a }));
2057
+ }, c = (m) => {
2058
+ m.preventDefault();
2059
+ const a = m.target;
2060
+ if (!a.checkValidity()) {
2061
+ a.reportValidity();
2040
2062
  return;
2041
2063
  }
2042
- o(g);
2064
+ l(b);
2043
2065
  };
2044
2066
  return /* @__PURE__ */ e(
2045
2067
  "form",
2046
2068
  {
2047
- id: i == "add" ? "addForm" : i == "edit" ? "editForm" : "defaultForm",
2048
- onSubmit: p,
2069
+ id: o == "add" ? "addForm" : o == "edit" ? "editForm" : "defaultForm",
2070
+ onSubmit: c,
2049
2071
  className: d,
2050
2072
  noValidate: !1,
2051
- children: t.map((l) => /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(
2052
- $e,
2073
+ children: n.map((m) => /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
2074
+ Ge,
2053
2075
  {
2054
- field: l,
2055
- formData: g,
2056
- handleChange: S
2076
+ field: m,
2077
+ formData: b,
2078
+ handleChange: O
2057
2079
  },
2058
- l.key
2080
+ m.key
2059
2081
  ) }))
2060
2082
  }
2061
2083
  );
2062
2084
  };
2063
- function ba({ data: b, config: o }) {
2064
- const { fields: s, containerClass: i } = o, [d, t] = R(null), [g, M] = R(!1), S = (u) => {
2065
- u && u.src instanceof File && (u = { ...u, src: URL.createObjectURL(u.src) }), t(u), M(!0);
2066
- }, p = ({ col: u }) => {
2067
- var I;
2068
- let m = u == null ? void 0 : u.icon, v = u.label, c = b[u.key], w = u.type, y = u.variant || "outline", k = u.defaultColor;
2069
- if (w === "chip" && ((I = u.chipOptions) == null ? void 0 : I.length) > 0) {
2070
- let A = u == null ? void 0 : u.chipOptions.find((C) => C.value == c);
2071
- A && (c = A.label, k = A.color);
2085
+ function pa({ data: u, config: l }) {
2086
+ const { fields: i, containerClass: o } = l, [d, n] = R(null), [b, S] = R(!1), O = (a) => {
2087
+ a && a.src instanceof File && (a = { ...a, src: URL.createObjectURL(a.src) }), n(a), S(!0);
2088
+ }, c = ({ col: a }) => {
2089
+ var P;
2090
+ let f = a == null ? void 0 : a.icon, y = a.label, s = u[a.key], w = a.type, x = a.variant || "outline", N = a.defaultColor;
2091
+ if (w === "chip" && ((P = a.chipOptions) == null ? void 0 : P.length) > 0) {
2092
+ let F = a == null ? void 0 : a.chipOptions.find((M) => M.value == s);
2093
+ F && (s = F.label, N = F.color);
2072
2094
  }
2073
2095
  return /* @__PURE__ */ h(
2074
2096
  "div",
2075
2097
  {
2076
2098
  className: `col-span-12 flex items-center space-x-4 p-4 rounded-xl
2077
- bg-gray-100 dark:bg-gray-900 ${u.blockClass || ""}`,
2099
+ bg-gray-100 dark:bg-gray-900 ${a.blockClass || ""}`,
2078
2100
  children: [
2079
- m && /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: m }),
2101
+ f && /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: f }),
2080
2102
  /* @__PURE__ */ h("div", { className: "flex-1 min-w-0", children: [
2081
- /* @__PURE__ */ e("p", { className: "text-sm font-medium text-gray-500 dark:text-gray-400", children: v }),
2103
+ /* @__PURE__ */ e("p", { className: "text-sm font-medium text-gray-500 dark:text-gray-400", children: y }),
2082
2104
  w === "chip" ? /* @__PURE__ */ e(
2083
- Ge,
2105
+ Ke,
2084
2106
  {
2085
- label: c,
2086
- variant: y,
2087
- color: k,
2107
+ label: s,
2108
+ variant: x,
2109
+ color: N,
2088
2110
  className: "mt-1"
2089
2111
  }
2090
2112
  ) : (
@@ -2094,163 +2116,161 @@ function ba({ data: b, config: o }) {
2094
2116
  {
2095
2117
  className: "mt-1 text-sm text-gray-900 dark:text-white break-words",
2096
2118
  dangerouslySetInnerHTML: {
2097
- __html: c
2119
+ __html: s
2098
2120
  }
2099
2121
  }
2100
- ) : w === "audio" ? c ? /* @__PURE__ */ e(
2122
+ ) : w === "audio" ? s ? /* @__PURE__ */ e(
2101
2123
  "audio",
2102
2124
  {
2103
2125
  controls: !0,
2104
- src: c instanceof File ? URL.createObjectURL(c) : c,
2105
- onClick: (A) => A.stopPropagation(),
2106
- className: "shadow-md rounded-full"
2126
+ src: s instanceof File ? URL.createObjectURL(s) : s,
2127
+ onClick: (F) => F.stopPropagation(),
2128
+ className: "shadow-md rounded-full mt-1"
2107
2129
  },
2108
- c instanceof File ? URL.createObjectURL(c) : c
2130
+ s instanceof File ? URL.createObjectURL(s) : s
2109
2131
  ) : /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-400", children: "N/A" }) : (
2110
2132
  /* DEFAULT */
2111
- /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-900 dark:text-white break-words", children: w == "date" ? /* @__PURE__ */ e("span", { children: Ue(c, u.format || "DD MMM YYYY") }) : c || "N/A" })
2133
+ /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-900 dark:text-white break-words", children: w == "date" ? /* @__PURE__ */ e("span", { children: je(s, a.format || "DD MMM YYYY") }) : s || "N/A" })
2112
2134
  )
2113
2135
  )
2114
2136
  ] })
2115
2137
  ]
2116
2138
  }
2117
2139
  );
2118
- }, l = ({ col: u }) => {
2119
- let m = b[u.titleKey], v = b[u.subtitleKey], c = b[u.imageKey], w = b[u.fallback_icon];
2140
+ }, m = ({ col: a }) => {
2141
+ let f = u[a.titleKey], y = u[a.subtitleKey], s = u[a.imageKey], w = a.fallback_icon;
2120
2142
  return /* @__PURE__ */ h(
2121
2143
  "div",
2122
2144
  {
2123
2145
  className: `col-span-12 flex items-center space-x-4 p-4 rounded-xl
2124
2146
  bg-gray-100 dark:bg-gray-900
2125
- ${u.blockClass}`,
2147
+ ${a.blockClass}`,
2126
2148
  children: [
2127
- c ? /* @__PURE__ */ e(
2149
+ s ? /* @__PURE__ */ e(
2128
2150
  "img",
2129
2151
  {
2130
- src: c instanceof File ? URL.createObjectURL(c) : c,
2131
- alt: m,
2132
- onClick: () => S({ src: c, alt: m }),
2152
+ src: s instanceof File ? URL.createObjectURL(s) : s,
2153
+ alt: f,
2154
+ onClick: () => O({ src: s, alt: f }),
2133
2155
  className: "w-16 h-16 cursor-pointer rounded-full object-cover border-2 border-gray-200 dark:border-gray-700"
2134
2156
  }
2135
- ) : w || /* @__PURE__ */ e("div", { className: "w-16 h-16 flex items-center justify-center rounded-full border-2 border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600", children: /* @__PURE__ */ e(Be, { className: "w-8 h-8 text-gray-400" }) }),
2157
+ ) : w ? w instanceof Function ? w(u) : w : /* @__PURE__ */ e("div", { className: "w-16 h-16 flex items-center justify-center rounded-full border-2 border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600", children: /* @__PURE__ */ e(Ue, { className: "w-8 h-8 text-gray-400" }) }),
2136
2158
  /* @__PURE__ */ h("div", { children: [
2137
- /* @__PURE__ */ e("h3", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: m }),
2138
- /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: v })
2159
+ /* @__PURE__ */ e("h3", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: f }),
2160
+ /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: y })
2139
2161
  ] })
2140
2162
  ]
2141
2163
  }
2142
2164
  );
2143
2165
  };
2144
- return /* @__PURE__ */ h(j, { children: [
2145
- g && /* @__PURE__ */ e(
2166
+ return /* @__PURE__ */ h(E, { children: [
2167
+ b && /* @__PURE__ */ e(
2146
2168
  _e,
2147
2169
  {
2148
2170
  src: d.src,
2149
2171
  alt: d.alt,
2150
- isOpen: g,
2151
- setIsOpen: M
2172
+ isOpen: b,
2173
+ setIsOpen: S
2152
2174
  }
2153
2175
  ),
2154
- /* @__PURE__ */ e("div", { className: `grid grid-cols-12 gap-4 ${i || ""}`, children: s.map(
2155
- (u) => u.type == "group" ? /* @__PURE__ */ e(l, { col: u }) : /* @__PURE__ */ e(p, { col: u })
2156
- ) })
2176
+ /* @__PURE__ */ e("div", { className: `grid grid-cols-12 gap-4 ${o || ""}`, children: i.map((a) => a.renderCondition && typeof a.renderCondition == "function" && !a.renderCondition(u) ? null : a.type == "group" ? /* @__PURE__ */ e(m, { col: a }) : /* @__PURE__ */ e(c, { col: a })) })
2157
2177
  ] });
2158
2178
  }
2159
- const Ke = ({ config: b }) => {
2160
- var ae, de, ce, he, ue, be, ne, pe, ge, me, fe, ye, xe, le, oe, a;
2179
+ const ze = ({ config: u }) => {
2180
+ var oe, te, he, ue, be, pe, ge, ie, me, fe, ye, xe, ve, we, se, de, t, g, D;
2161
2181
  const {
2162
- title: o,
2163
- fetchData: s = async () => {
2182
+ title: l,
2183
+ fetchData: i = async () => {
2164
2184
  },
2165
- isStaticData: i = !1,
2185
+ isStaticData: o = !1,
2166
2186
  tableConfig: d = {},
2167
- modalConfig: t = {},
2168
- filterConfig: g
2169
- } = b, [M, S] = R(!0), [p, l] = R(!1), [u, m] = R([]), [v, c] = R(null), [w, y] = R({
2187
+ modalConfig: n = {},
2188
+ filterConfig: b
2189
+ } = u, [S, O] = R(!0), [c, m] = R(!1), [a, f] = R([]), [y, s] = R(null), [w, x] = R({
2170
2190
  search: "",
2171
2191
  rows_per_page: 50,
2172
2192
  current_page: 1
2173
- }), [k, I] = R({}), [A, C] = R(!1), [O, F] = R(!1), [T, L] = R(!1), [B, E] = R(!1), [Y, $] = R(!1), [_, z] = R(null), D = (n, f) => {
2174
- n === "edit" ? (z(f), L(!0)) : n === "view" ? (z(f), $(!0)) : n === "delete" && (z(f), E(!0));
2175
- }, U = async (n, f, N = "", P = "") => {
2176
- l(!0);
2193
+ }), [N, P] = R({}), [F, M] = R(!1), [L, B] = R(!1), [T, C] = R(!1), [j, G] = R(!1), [W, $] = R(!1), [H, Y] = R(null), I = (p, v) => {
2194
+ p === "edit" ? (Y(v), C(!0)) : p === "view" ? (Y(v), $(!0)) : p === "delete" && (Y(v), G(!0));
2195
+ }, K = async (p, v, A = "", q = "") => {
2196
+ m(!0);
2177
2197
  try {
2178
- const G = await (n == null ? void 0 : n());
2179
- (N || G.message) && Se(N || G.message, {
2198
+ const V = await (p == null ? void 0 : p());
2199
+ (A || V.message) && Me(A || V.message, {
2180
2200
  variant: "success"
2181
- }), f == null || f(G);
2182
- } catch (G) {
2183
- (P || G.message) && Se(P || G.message, { variant: "error" });
2201
+ }), v == null || v(V);
2202
+ } catch (V) {
2203
+ (q || V.message) && Me(q || V.message, { variant: "error" });
2184
2204
  } finally {
2185
- l(!1);
2205
+ m(!1);
2186
2206
  }
2187
- }, V = (n) => {
2188
- let f = n.newObject;
2189
- i ? (m((N) => [f, ...N]), c((N) => ({
2190
- ...N,
2207
+ }, _ = (p) => {
2208
+ let v = p.newObject;
2209
+ o ? (f((A) => [v, ...A]), s((A) => ({
2210
+ ...A,
2191
2211
  current_page: 1
2192
- }))) : (y((N) => ({
2193
- ...N,
2212
+ }))) : (x((A) => ({
2213
+ ...A,
2194
2214
  current_page: 1
2195
- })), w.current_page == 1 && W()), F(!1);
2196
- }, x = (n) => {
2197
- let f = n.newObject, N = n.targetObject;
2198
- i ? m(
2199
- (P) => P.map(
2200
- (G) => G.id === N.id ? { ...G, ...f } : G
2215
+ })), w.current_page == 1 && ee()), B(!1);
2216
+ }, k = (p) => {
2217
+ let v = p.newObject, A = p.targetObject;
2218
+ o ? f(
2219
+ (q) => q.map(
2220
+ (V) => V.id === A.id ? { ...V, ...v } : V
2201
2221
  )
2202
- ) : W(), L(!1);
2203
- }, H = (n) => {
2204
- if (!n) {
2205
- E(!1), z(null);
2222
+ ) : ee(), C(!1);
2223
+ }, U = (p) => {
2224
+ if (!p) {
2225
+ G(!1), Y(null);
2206
2226
  return;
2207
2227
  }
2208
- i ? m(
2209
- (f) => f.filter((N) => N.id !== n.targetObject.id)
2210
- ) : u.length == 1 && w.current_page > 1 ? y((f) => ({
2211
- ...f,
2212
- current_page: f.current_page - 1
2213
- })) : W(), E(!1), z(null);
2214
- }, J = (n) => U(
2228
+ o ? f(
2229
+ (v) => v.filter((A) => A.id !== p.targetObject.id)
2230
+ ) : a.length == 1 && w.current_page > 1 ? x((v) => ({
2231
+ ...v,
2232
+ current_page: v.current_page - 1
2233
+ })) : ee(), G(!1), Y(null);
2234
+ }, X = (p) => K(
2215
2235
  () => {
2216
- var f, N;
2217
- return (N = (f = t == null ? void 0 : t.addModal) == null ? void 0 : f.handleSubmit) == null ? void 0 : N.call(f, n);
2236
+ var v, A;
2237
+ return (A = (v = n == null ? void 0 : n.addModal) == null ? void 0 : v.handleSubmit) == null ? void 0 : A.call(v, p);
2218
2238
  },
2219
- V
2220
- ), Q = (n) => U(
2239
+ _
2240
+ ), J = (p) => K(
2221
2241
  () => {
2222
- var f, N;
2223
- return (N = (f = t == null ? void 0 : t.editModal) == null ? void 0 : f.handleSubmit) == null ? void 0 : N.call(f, n, _);
2242
+ var v, A;
2243
+ return (A = (v = n == null ? void 0 : n.editModal) == null ? void 0 : v.handleSubmit) == null ? void 0 : A.call(v, p, H);
2224
2244
  },
2225
- x
2226
- ), W = async () => {
2227
- S(!0), s == null || s({ ...w, ...k }).then((n) => {
2228
- m(n.data), c(n.pagination);
2229
- }).catch((n) => {
2230
- Se(n.message, { variant: "error" });
2245
+ k
2246
+ ), ee = async () => {
2247
+ O(!0), i == null || i({ ...w, ...N }).then((p) => {
2248
+ f(p.data), s(p.pagination);
2249
+ }).catch((p) => {
2250
+ Me(p.message, { variant: "error" });
2231
2251
  }).finally(() => {
2232
- S(!1);
2252
+ O(!1);
2233
2253
  });
2234
- }, ie = (n) => {
2235
- var f;
2236
- I((N) => ({
2237
- ...n
2238
- })), (f = d == null ? void 0 : d.filter) != null && f.useServerSideFilters && C((N) => !N);
2239
- }, te = (n, f) => n.filter(
2240
- (N) => Object.entries(f).every(([P, G]) => N[P] === G)
2241
- ), se = Re(() => {
2242
- var n;
2243
- return (n = d == null ? void 0 : d.filter) != null && n.useServerSideFilters ? u : te(u, k);
2244
- }, [u, k]);
2245
- return K(() => {
2246
- W();
2254
+ }, ne = (p) => {
2255
+ var v;
2256
+ P((A) => ({
2257
+ ...p
2258
+ })), (v = d == null ? void 0 : d.filter) != null && v.useServerSideFilters && M((A) => !A);
2259
+ }, ce = (p, v) => p.filter(
2260
+ (A) => Object.entries(v).every(([q, V]) => A[q] === V)
2261
+ ), le = Le(() => {
2262
+ var p;
2263
+ return (p = d == null ? void 0 : d.filter) != null && p.useServerSideFilters ? a : ce(a, N);
2264
+ }, [a, N]);
2265
+ return z(() => {
2266
+ ee();
2247
2267
  }, [
2248
2268
  w.search,
2249
2269
  w.rows_per_page,
2250
2270
  w.current_page,
2251
- A
2271
+ F
2252
2272
  ]), /* @__PURE__ */ e(
2253
- aa,
2273
+ ta,
2254
2274
  {
2255
2275
  maxSnack: 3,
2256
2276
  anchorOrigin: {
@@ -2258,133 +2278,134 @@ const Ke = ({ config: b }) => {
2258
2278
  horizontal: "right"
2259
2279
  },
2260
2280
  autoHideDuration: 3e3,
2261
- action: (n) => /* @__PURE__ */ e(
2281
+ action: (p) => /* @__PURE__ */ e(
2262
2282
  "button",
2263
2283
  {
2264
2284
  onClick: () => {
2265
2285
  window.dispatchEvent(
2266
- new CustomEvent("closeSnackbar", { detail: n })
2286
+ new CustomEvent("closeSnackbar", { detail: p })
2267
2287
  );
2268
2288
  },
2269
2289
  className: "p-1 hover:bg-white/20 rounded-full transition-colors duration-200 text-white flex items-center justify-center",
2270
- children: /* @__PURE__ */ e(Ne, { className: "h-4 w-4" })
2290
+ children: /* @__PURE__ */ e(Se, { className: "h-4 w-4" })
2271
2291
  }
2272
2292
  ),
2273
2293
  children: /* @__PURE__ */ h("div", { children: [
2274
2294
  /* @__PURE__ */ e(
2275
- ua,
2295
+ ba,
2276
2296
  {
2277
- title: o,
2278
- setShowAdd: F,
2279
- description: b.description,
2280
- buttonText: b.buttonText,
2297
+ title: l,
2298
+ setShowAdd: B,
2299
+ description: u.description,
2300
+ buttonText: u.buttonText,
2301
+ showAddButton: !!n.addModal,
2281
2302
  config: {
2282
2303
  ...d,
2283
2304
  pagination: {
2284
2305
  ...d.pagination,
2285
- ...v
2306
+ ...y
2286
2307
  },
2287
- data: se,
2288
- setServerSidePaginationData: y,
2289
- onMenuAction: D,
2290
- filterConfig: g,
2291
- onFilterApply: ie,
2292
- loading: M
2308
+ data: le,
2309
+ setServerSidePaginationData: x,
2310
+ onMenuAction: I,
2311
+ filterConfig: b,
2312
+ onFilterApply: ne,
2313
+ loading: S
2293
2314
  }
2294
2315
  }
2295
2316
  ),
2296
2317
  /* @__PURE__ */ e(
2297
- ke,
2318
+ Ne,
2298
2319
  {
2299
- isOpen: O,
2320
+ isOpen: L,
2300
2321
  onClose: () => {
2301
- p || F(!1);
2322
+ c || B(!1);
2302
2323
  },
2303
- icon: (ae = t.addModal) == null ? void 0 : ae.icon,
2304
- title: ((de = t.addModal) == null ? void 0 : de.title) || "Add New",
2305
- size: ((ce = t.addModal) == null ? void 0 : ce.size) || "md",
2324
+ icon: (oe = n.addModal) == null ? void 0 : oe.icon,
2325
+ title: ((te = n.addModal) == null ? void 0 : te.title) || "Add New",
2326
+ size: ((he = n.addModal) == null ? void 0 : he.size) || "md",
2306
2327
  onFormSubmit: () => {
2307
- var n;
2308
- return (n = document.querySelector("#addForm")) == null ? void 0 : n.requestSubmit();
2328
+ var p;
2329
+ return (p = document.querySelector("#addForm")) == null ? void 0 : p.requestSubmit();
2309
2330
  },
2310
- loadingBtn: p,
2311
- actionButtons: t.addModal.actionButtons,
2331
+ loadingBtn: c,
2332
+ actionButtons: ((ue = n == null ? void 0 : n.addModal) == null ? void 0 : ue.actionButtons) || [],
2312
2333
  children: /* @__PURE__ */ e(
2313
- Fe,
2334
+ Ie,
2314
2335
  {
2315
- config: (t == null ? void 0 : t.addModal) || [],
2316
- onSubmit: J,
2336
+ config: (n == null ? void 0 : n.addModal) || {},
2337
+ onSubmit: X,
2317
2338
  initialData: {},
2318
2339
  type: "add",
2319
- loading: p
2340
+ loading: c
2320
2341
  }
2321
2342
  )
2322
2343
  }
2323
2344
  ),
2324
2345
  /* @__PURE__ */ e(
2325
- ke,
2346
+ Ne,
2326
2347
  {
2327
2348
  isOpen: T,
2328
2349
  onClose: () => {
2329
- p || L(!1);
2350
+ c || C(!1);
2330
2351
  },
2331
- icon: (he = t.editModal) == null ? void 0 : he.icon,
2332
- title: ((ue = t.editModal) == null ? void 0 : ue.title) || "Edit",
2333
- size: ((be = t.editModal) == null ? void 0 : be.size) || "md",
2352
+ icon: (be = n.editModal) == null ? void 0 : be.icon,
2353
+ title: ((pe = n.editModal) == null ? void 0 : pe.title) || "Edit",
2354
+ size: ((ge = n.editModal) == null ? void 0 : ge.size) || "md",
2334
2355
  onFormSubmit: () => {
2335
- var n;
2336
- return (n = document.querySelector("#editForm")) == null ? void 0 : n.requestSubmit();
2356
+ var p;
2357
+ return (p = document.querySelector("#editForm")) == null ? void 0 : p.requestSubmit();
2337
2358
  },
2338
- actionButtons: t.editModal.actionButtons,
2339
- loadingBtn: p,
2359
+ actionButtons: ((ie = n == null ? void 0 : n.editModal) == null ? void 0 : ie.actionButtons) || [],
2360
+ loadingBtn: c,
2340
2361
  children: /* @__PURE__ */ e(
2341
- Fe,
2362
+ Ie,
2342
2363
  {
2343
- config: t.editModal || [],
2344
- onSubmit: Q,
2345
- initialData: _,
2364
+ config: n.editModal || {},
2365
+ onSubmit: J,
2366
+ initialData: H,
2346
2367
  type: "edit",
2347
- loading: p
2368
+ loading: c
2348
2369
  }
2349
2370
  )
2350
2371
  }
2351
2372
  ),
2352
- B && /* @__PURE__ */ e(
2353
- ke,
2373
+ j && /* @__PURE__ */ e(
2374
+ Ne,
2354
2375
  {
2355
- isOpen: B,
2356
- onClose: (n) => {
2357
- H(n);
2376
+ isOpen: j,
2377
+ onClose: (p) => {
2378
+ U(p);
2358
2379
  },
2359
- icon: ((ne = t.deleteModal) == null ? void 0 : ne.icon) || /* @__PURE__ */ e(re, { icon: "ph:warning-bold", className: "w-6 h-6 text-red-500" }),
2360
- title: ((pe = t.deleteModal) == null ? void 0 : pe.title) || "Confirm Delete",
2361
- size: ((ge = t.deleteModal) == null ? void 0 : ge.size) || "md",
2362
- loading: p,
2363
- actionButtons: t.deleteModal.actionButtons,
2364
- executeFunction: U,
2365
- selectedItem: _,
2380
+ icon: ((me = n.deleteModal) == null ? void 0 : me.icon) || /* @__PURE__ */ e(re, { icon: "ph:warning-bold", className: "w-6 h-6 text-red-500" }),
2381
+ title: ((fe = n.deleteModal) == null ? void 0 : fe.title) || "Confirm Delete",
2382
+ size: ((ye = n.deleteModal) == null ? void 0 : ye.size) || "md",
2383
+ loading: c,
2384
+ actionButtons: ((xe = n == null ? void 0 : n.deleteModal) == null ? void 0 : xe.actionButtons) || [],
2385
+ executeFunction: K,
2386
+ selectedItem: H,
2366
2387
  children: /* @__PURE__ */ e("div", { className: "flex items-center space-x-2 py-3", children: /* @__PURE__ */ h("div", { children: [
2367
- /* @__PURE__ */ e("p", { className: "text-md text-gray-700 dark:text-white", children: ((me = t.deleteModal) == null ? void 0 : me.confirmText) || "Are you sure you want to delete this item?" }),
2368
- ((fe = t.deleteModal) == null ? void 0 : fe.referenceKey) && /* @__PURE__ */ e("p", { className: "text-md font-semibold text-gray-700 dark:text-white", children: _[(ye = t.deleteModal) == null ? void 0 : ye.referenceKey] })
2388
+ /* @__PURE__ */ e("p", { className: "text-md text-gray-700 dark:text-white", children: ((ve = n.deleteModal) == null ? void 0 : ve.confirmText) || "Are you sure you want to delete this item?" }),
2389
+ ((we = n.deleteModal) == null ? void 0 : we.referenceKey) && /* @__PURE__ */ e("p", { className: "text-md font-semibold text-gray-700 dark:text-white", children: H[(se = n.deleteModal) == null ? void 0 : se.referenceKey] })
2369
2390
  ] }) })
2370
2391
  }
2371
2392
  ),
2372
- t.viewModal && /* @__PURE__ */ e(
2373
- ke,
2393
+ n.viewModal && /* @__PURE__ */ e(
2394
+ Ne,
2374
2395
  {
2375
- isOpen: Y,
2396
+ isOpen: W,
2376
2397
  onClose: () => {
2377
- $(!1), z(null);
2398
+ $(!1), Y(null);
2378
2399
  },
2379
- icon: (xe = t.viewModal) == null ? void 0 : xe.icon,
2380
- title: ((le = t.viewModal) == null ? void 0 : le.title) || "View Details",
2381
- size: ((oe = t.viewModal) == null ? void 0 : oe.size) || "lg",
2382
- footerConfig: t == null ? void 0 : t.viewModal.footer,
2383
- children: (a = t.viewModal) != null && a.component ? /* @__PURE__ */ e(t.viewModal.component, { data: _ }) : /* @__PURE__ */ e(
2384
- ba,
2400
+ icon: (de = n.viewModal) == null ? void 0 : de.icon,
2401
+ title: ((t = n.viewModal) == null ? void 0 : t.title) || "View Details",
2402
+ size: ((g = n.viewModal) == null ? void 0 : g.size) || "lg",
2403
+ footerConfig: n == null ? void 0 : n.viewModal.footer,
2404
+ children: (D = n.viewModal) != null && D.component ? /* @__PURE__ */ e(n.viewModal.component, { data: H }) : /* @__PURE__ */ e(
2405
+ pa,
2385
2406
  {
2386
- data: _,
2387
- config: t.viewModal || {}
2407
+ data: H,
2408
+ config: n.viewModal || {}
2388
2409
  }
2389
2410
  )
2390
2411
  }
@@ -2392,7 +2413,7 @@ const Ke = ({ config: b }) => {
2392
2413
  ] })
2393
2414
  }
2394
2415
  );
2395
- }, Ae = r.shape({
2416
+ }, De = r.shape({
2396
2417
  value: r.oneOfType([
2397
2418
  r.string,
2398
2419
  r.number,
@@ -2400,18 +2421,18 @@ const Ke = ({ config: b }) => {
2400
2421
  ]).isRequired,
2401
2422
  label: r.string.isRequired,
2402
2423
  color: r.string
2403
- }), Me = r.shape({
2424
+ }), Ce = r.shape({
2404
2425
  type: r.string.isRequired,
2405
2426
  label: r.string.isRequired,
2406
2427
  color: r.string,
2407
2428
  variant: r.string,
2408
2429
  onClick: r.func
2409
- }), pa = r.shape({
2430
+ }), ga = r.shape({
2410
2431
  title: r.string.isRequired,
2411
2432
  type: r.string.isRequired,
2412
2433
  variant: r.string,
2413
2434
  icon: r.node
2414
- }), ga = r.shape({
2435
+ }), ma = r.shape({
2415
2436
  key: r.string.isRequired,
2416
2437
  title: r.string,
2417
2438
  type: r.string,
@@ -2420,12 +2441,12 @@ const Ke = ({ config: b }) => {
2420
2441
  subtitleKey: r.string,
2421
2442
  onClickDetails: r.bool,
2422
2443
  variant: r.string,
2423
- chipOptions: r.arrayOf(Ae),
2444
+ chipOptions: r.arrayOf(De),
2424
2445
  defaultColor: r.string,
2425
2446
  className: r.string,
2426
2447
  format: r.string,
2427
- menuList: r.arrayOf(pa)
2428
- }), Ce = r.shape({
2448
+ menuList: r.arrayOf(ga)
2449
+ }), Re = r.shape({
2429
2450
  key: r.string.isRequired,
2430
2451
  label: r.string,
2431
2452
  type: r.string.isRequired,
@@ -2442,8 +2463,8 @@ const Ke = ({ config: b }) => {
2442
2463
  rows: r.number,
2443
2464
  text: r.string,
2444
2465
  editorKey: r.string,
2445
- options: r.arrayOf(Ae)
2446
- }), ma = r.shape({
2466
+ options: r.arrayOf(De)
2467
+ }), fa = r.shape({
2447
2468
  key: r.string,
2448
2469
  label: r.string,
2449
2470
  type: r.string,
@@ -2453,12 +2474,12 @@ const Ke = ({ config: b }) => {
2453
2474
  blockClass: r.string,
2454
2475
  icon: r.node,
2455
2476
  variant: r.string,
2456
- chipOptions: r.arrayOf(Ae),
2477
+ chipOptions: r.arrayOf(De),
2457
2478
  defaultColor: r.string,
2458
2479
  className: r.string,
2459
2480
  format: r.string
2460
2481
  });
2461
- Ke.propTypes = {
2482
+ ze.propTypes = {
2462
2483
  config: r.shape({
2463
2484
  title: r.string.isRequired,
2464
2485
  description: r.string,
@@ -2467,7 +2488,7 @@ Ke.propTypes = {
2467
2488
  isStaticData: r.bool,
2468
2489
  /* ================= TABLE CONFIG ================= */
2469
2490
  tableConfig: r.shape({
2470
- table_head: r.arrayOf(ga).isRequired,
2491
+ table_head: r.arrayOf(ma).isRequired,
2471
2492
  search: r.shape({
2472
2493
  enabled: r.bool,
2473
2494
  useServerSideSearch: r.bool,
@@ -2488,24 +2509,24 @@ Ke.propTypes = {
2488
2509
  title: r.string.isRequired,
2489
2510
  size: r.string,
2490
2511
  formClass: r.string,
2491
- formFields: r.arrayOf(Ce),
2512
+ formFields: r.arrayOf(Re),
2492
2513
  handleSubmit: r.func.isRequired,
2493
- actionButtons: r.arrayOf(Me)
2514
+ actionButtons: r.arrayOf(Ce)
2494
2515
  }),
2495
2516
  editModal: r.shape({
2496
2517
  title: r.string.isRequired,
2497
2518
  size: r.string,
2498
2519
  formClass: r.string,
2499
- formFields: r.arrayOf(Ce),
2520
+ formFields: r.arrayOf(Re),
2500
2521
  handleSubmit: r.func.isRequired,
2501
- actionButtons: r.arrayOf(Me)
2522
+ actionButtons: r.arrayOf(Ce)
2502
2523
  }),
2503
2524
  deleteModal: r.shape({
2504
2525
  title: r.string.isRequired,
2505
2526
  size: r.string,
2506
2527
  confirmText: r.string,
2507
2528
  referenceKey: r.string,
2508
- actionButtons: r.arrayOf(Me)
2529
+ actionButtons: r.arrayOf(Ce)
2509
2530
  }),
2510
2531
  viewModal: r.shape({
2511
2532
  title: r.string.isRequired,
@@ -2513,7 +2534,7 @@ Ke.propTypes = {
2513
2534
  // 👇 This covers your commented code:
2514
2535
  component: r.elementType,
2515
2536
  // for custom component like TeamMemberDetail
2516
- fields: r.arrayOf(ma),
2537
+ fields: r.arrayOf(fa),
2517
2538
  footer: r.shape({
2518
2539
  cancelButton: r.bool,
2519
2540
  cancelText: r.string
@@ -2522,15 +2543,15 @@ Ke.propTypes = {
2522
2543
  }),
2523
2544
  /* ================= FILTER CONFIG ================= */
2524
2545
  filterConfig: r.shape({
2525
- fields: r.arrayOf(Ce)
2546
+ fields: r.arrayOf(Re)
2526
2547
  })
2527
2548
  }).isRequired
2528
2549
  };
2529
- const fa = () => {
2550
+ const ya = () => {
2530
2551
  if (typeof document > "u" || document.getElementById("react-admin-crud-manager-styles")) return;
2531
- const b = document.createElement("style");
2532
- b.id = "react-admin-crud-manager-styles";
2533
- const o = `
2552
+ const u = document.createElement("style");
2553
+ u.id = "react-admin-crud-manager-styles";
2554
+ const l = `
2534
2555
  .no-spinner::-webkit-outer-spin-button,
2535
2556
  .no-spinner::-webkit-inner-spin-button {
2536
2557
  -webkit-appearance: none;
@@ -2546,14 +2567,14 @@ const fa = () => {
2546
2567
  box-shadow: none !important;
2547
2568
  }
2548
2569
  `;
2549
- b.textContent = o, document.head.appendChild(b);
2570
+ u.textContent = l, document.head.appendChild(u);
2550
2571
  };
2551
- function La(b) {
2552
- return K(() => {
2553
- fa();
2554
- }, []), /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(Ke, { config: b.config }) });
2572
+ function Oa(u) {
2573
+ return z(() => {
2574
+ ya();
2575
+ }, []), /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(ze, { config: u.config }) });
2555
2576
  }
2556
2577
  export {
2557
- La as default
2578
+ Oa as default
2558
2579
  };
2559
2580
  //# sourceMappingURL=index.es.js.map