react-admin-crud-manager 1.0.18 → 1.0.19

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