react-admin-crud-manager 1.0.13 → 1.0.14

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