react-admin-crud-manager 1.0.25 → 1.0.27

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