warqadui 0.0.50 → 0.0.52

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.js CHANGED
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ AdminProtectedRoute: () => AdminProtectedRoute,
33
34
  Badge: () => Badge,
34
35
  Branding: () => Branding,
35
36
  Button: () => Button,
@@ -46,6 +47,7 @@ __export(index_exports, {
46
47
  DataTable: () => DataTable,
47
48
  DateInput: () => DateInput,
48
49
  Fields: () => Fields_default,
50
+ Guard: () => Guard,
49
51
  InfoGrid: () => InfoGrid,
50
52
  Input: () => Input,
51
53
  LoadingBox: () => LoadingBox,
@@ -56,6 +58,8 @@ __export(index_exports, {
56
58
  PageHeader: () => PageHeader,
57
59
  PhoneInput: () => PhoneInput,
58
60
  PostTable: () => PostTable,
61
+ ProfileDropdown: () => ProfileDropdown,
62
+ ProtectedRoute: () => ProtectedRoute,
59
63
  SearchApi: () => SearchApi,
60
64
  SearchApiContent: () => SearchApiContent,
61
65
  SearchApiInput: () => SearchApiInput,
@@ -69,6 +73,8 @@ __export(index_exports, {
69
73
  Textarea: () => Textarea,
70
74
  ThemeProvider: () => ThemeProvider,
71
75
  ThemeToggle: () => ThemeToggle,
76
+ ThemedLogin: () => ThemedLogin,
77
+ UnProtectedRoute: () => UnProtectedRoute,
72
78
  Views: () => Views_default,
73
79
  WarqadProvider: () => WarqadProvider,
74
80
  generatePdf: () => generatePdf,
@@ -77,6 +83,9 @@ __export(index_exports, {
77
83
  useA4StatementView: () => useA4DataView_default,
78
84
  useAntdImageUpload: () => useAntdImageUpload_default,
79
85
  useApi: () => useApis_default,
86
+ useAuth: () => useAuth_default,
87
+ useAuthStore: () => useAuthStore,
88
+ useLogin: () => useLogin,
80
89
  useModal: () => useModal,
81
90
  useSearchApiContext: () => useSearchApiContext,
82
91
  useSelectContext: () => useSelectContext,
@@ -363,7 +372,10 @@ var ThemeProvider = ({ children }) => {
363
372
  localStorage.setItem("theme", "light");
364
373
  }
365
374
  }, [isDarkMode]);
366
- const toggleTheme = () => setIsDarkMode((prev) => !prev);
375
+ const toggleTheme = () => {
376
+ console.log("Toggle theme clicked, currently isDarkMode:", isDarkMode);
377
+ setTheme(isDarkMode ? "light" : "dark");
378
+ };
367
379
  const setTheme = (theme) => setIsDarkMode(theme === "dark");
368
380
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ThemeContext.Provider, { value: { isDarkMode, toggleTheme, setTheme }, children });
369
381
  };
@@ -1178,19 +1190,20 @@ var Input = (0, import_react8.forwardRef)(
1178
1190
  }
1179
1191
  }
1180
1192
  }, [props.value, name, form]);
1181
- let message = error;
1193
+ let message2 = error;
1182
1194
  if (form && name) {
1183
1195
  const {
1184
1196
  formState: { errors }
1185
1197
  } = form;
1186
1198
  const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
1187
- message = errorObj?.message;
1199
+ message2 = errorObj?.message;
1188
1200
  }
1201
+ const watchedValue = form?.watch(name);
1189
1202
  (0, import_react8.useEffect)(() => {
1190
- if (form && name) {
1203
+ if (form && name && form.formState.errors?.root) {
1191
1204
  form.clearErrors("root");
1192
1205
  }
1193
- }, [form?.watch(name)]);
1206
+ }, [watchedValue, name, form]);
1194
1207
  const renderInput = (inputProps, localType = type || "text") => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
1195
1208
  "div",
1196
1209
  {
@@ -1250,7 +1263,7 @@ var Input = (0, import_react8.forwardRef)(
1250
1263
  }
1251
1264
  )
1252
1265
  ] }),
1253
- message && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message })
1266
+ message2 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message2 })
1254
1267
  ]
1255
1268
  }
1256
1269
  );
@@ -1365,7 +1378,7 @@ var PhoneInput = (0, import_react9.forwardRef)(
1365
1378
  const [isFocused, setIsFocused] = (0, import_react9.useState)(false);
1366
1379
  const { theme } = useWarqadConfig();
1367
1380
  const primaryColor = theme?.primaryColor;
1368
- let message = error;
1381
+ let message2 = error;
1369
1382
  if (form && name) {
1370
1383
  const {
1371
1384
  formState: { errors }
@@ -1375,7 +1388,7 @@ var PhoneInput = (0, import_react9.forwardRef)(
1375
1388
  for (const part of nameParts) {
1376
1389
  currentError = currentError?.[part];
1377
1390
  }
1378
- message = currentError?.message || message;
1391
+ message2 = currentError?.message || message2;
1379
1392
  }
1380
1393
  const renderInput = (onChangeHandler, currentValue) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `space-y-2 group relative ${containerClassName}`, children: [
1381
1394
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
@@ -1420,7 +1433,7 @@ var PhoneInput = (0, import_react9.forwardRef)(
1420
1433
  }
1421
1434
  )
1422
1435
  ] }),
1423
- message && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message })
1436
+ message2 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message2 })
1424
1437
  ] });
1425
1438
  if (form && name) {
1426
1439
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
@@ -1569,7 +1582,7 @@ var SelectRoot = ({
1569
1582
  document.addEventListener("mousedown", handleClickOutside);
1570
1583
  return () => document.removeEventListener("mousedown", handleClickOutside);
1571
1584
  }, [fieldInternalProps]);
1572
- let message = error;
1585
+ let message2 = error;
1573
1586
  if (form && name) {
1574
1587
  const {
1575
1588
  formState: { errors }
@@ -1579,7 +1592,7 @@ var SelectRoot = ({
1579
1592
  for (const part of nameParts) {
1580
1593
  currentError = currentError?.[part];
1581
1594
  }
1582
- message = currentError?.message || message;
1595
+ message2 = currentError?.message || message2;
1583
1596
  }
1584
1597
  const allOptions = initialOptions?.length ? initialOptions : registeredOptions;
1585
1598
  const valueCtx = {
@@ -1640,7 +1653,7 @@ var SelectRoot = ({
1640
1653
  String(opt.value) || index
1641
1654
  )) })
1642
1655
  ] }),
1643
- message && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message })
1656
+ message2 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message2 })
1644
1657
  ]
1645
1658
  }
1646
1659
  ) });
@@ -1874,13 +1887,13 @@ var Textarea = (0, import_react11.forwardRef)(
1874
1887
  const [isFocused, setIsFocused] = (0, import_react11.useState)(false);
1875
1888
  const { theme } = useWarqadConfig();
1876
1889
  const primaryColor = theme?.primaryColor;
1877
- let message = error;
1890
+ let message2 = error;
1878
1891
  if (form && name) {
1879
1892
  const {
1880
1893
  formState: { errors }
1881
1894
  } = form;
1882
1895
  const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
1883
- message = errorObj?.message;
1896
+ message2 = errorObj?.message;
1884
1897
  }
1885
1898
  const renderInput = (inputProps, ref2) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `space-y-2 group w-full! relative ${containerClassName}`, children: [
1886
1899
  /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
@@ -1916,7 +1929,7 @@ var Textarea = (0, import_react11.forwardRef)(
1916
1929
  ...inputProps
1917
1930
  }
1918
1931
  ) }),
1919
- message && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message })
1932
+ message2 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message2 })
1920
1933
  ] });
1921
1934
  (0, import_react11.useEffect)(() => {
1922
1935
  if (form && name && props.value !== void 0 && props.value !== null && props.value !== "") {
@@ -2402,7 +2415,7 @@ var SearchApiRoot = ({
2402
2415
  const filteredOptions = options.filter(
2403
2416
  (option) => !filter.includes(getOptionValue(option))
2404
2417
  );
2405
- let message = error || errorMessage;
2418
+ let message2 = error || errorMessage;
2406
2419
  if (form && name) {
2407
2420
  const {
2408
2421
  formState: { errors }
@@ -2412,7 +2425,7 @@ var SearchApiRoot = ({
2412
2425
  for (const part of nameParts) {
2413
2426
  currentError = currentError?.[part];
2414
2427
  }
2415
- message = currentError?.message || message;
2428
+ message2 = currentError?.message || message2;
2416
2429
  }
2417
2430
  const valueCtx = {
2418
2431
  isOpen,
@@ -2446,7 +2459,7 @@ var SearchApiRoot = ({
2446
2459
  form,
2447
2460
  name,
2448
2461
  obj,
2449
- error: message,
2462
+ error: message2,
2450
2463
  onSelect,
2451
2464
  onClear
2452
2465
  };
@@ -2801,19 +2814,19 @@ var DateInput = (0, import_react14.forwardRef)(
2801
2814
  const { theme } = useWarqadConfig();
2802
2815
  const primaryColor = theme?.primaryColor;
2803
2816
  const [isFocused, setIsFocused] = (0, import_react14.useState)(false);
2804
- let message = error;
2817
+ let message2 = error;
2805
2818
  if (form && name) {
2806
2819
  const {
2807
2820
  formState: { errors }
2808
2821
  } = form;
2809
2822
  const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
2810
- message = errorObj?.message;
2823
+ message2 = errorObj?.message;
2811
2824
  }
2812
2825
  const inputStyles = `w-full px-2.5 py-1 rounded-xl border! shadow-none transition-all! duration-200! outline-none!
2813
2826
  bg-white! dark:bg-zinc-900!
2814
2827
  text-gray-900! dark:text-zinc-100!
2815
2828
  hover:bg-white! dark:hover:bg-zinc-900!
2816
- ${message ? "border-red-500 hover:border-red-500 [&.ant-picker-focused]:border-red-500 [&.ant-picker-focused]:ring-red-500/20" : "border-gray-200 dark:border-zinc-700 hover:border-gray-200 dark:hover:border-zinc-700 [&.ant-picker-focused]:ring-2"}
2829
+ ${message2 ? "border-red-500 hover:border-red-500 [&.ant-picker-focused]:border-red-500 [&.ant-picker-focused]:ring-red-500/20" : "border-gray-200 dark:border-zinc-700 hover:border-gray-200 dark:hover:border-zinc-700 [&.ant-picker-focused]:ring-2"}
2817
2830
  [&.ant-picker-focused]:bg-white dark:[&.ant-picker-focused]:bg-zinc-900
2818
2831
  ${className}`;
2819
2832
  const renderDatePicker = (val, changeHandler, blurHandler, refProps) => {
@@ -2841,8 +2854,8 @@ var DateInput = (0, import_react14.forwardRef)(
2841
2854
  needConfirm: false,
2842
2855
  style: {
2843
2856
  height: "36px",
2844
- borderColor: isFocused && !message ? primaryColor : void 0,
2845
- boxShadow: isFocused && !message ? `${primaryColor}33 0px 0px 0px 2px` : void 0
2857
+ borderColor: isFocused && !message2 ? primaryColor : void 0,
2858
+ boxShadow: isFocused && !message2 ? `${primaryColor}33 0px 0px 0px 2px` : void 0
2846
2859
  },
2847
2860
  classNames: { popup: { root: "z-50" } },
2848
2861
  suffixIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
@@ -2863,7 +2876,7 @@ var DateInput = (0, import_react14.forwardRef)(
2863
2876
  {
2864
2877
  className: "block text-xs font-medium transition-colors duration-200",
2865
2878
  style: {
2866
- color: message ? "#ef4444" : isFocused ? primaryColor : void 0
2879
+ color: message2 ? "#ef4444" : isFocused ? primaryColor : void 0
2867
2880
  },
2868
2881
  children: [
2869
2882
  label,
@@ -2884,7 +2897,7 @@ var DateInput = (0, import_react14.forwardRef)(
2884
2897
  )
2885
2898
  }
2886
2899
  ) : renderDatePicker(value, onChange, onBlur, ref),
2887
- message && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message })
2900
+ message2 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message2 })
2888
2901
  ] });
2889
2902
  }
2890
2903
  );
@@ -4097,11 +4110,620 @@ var Branding = ({
4097
4110
  );
4098
4111
  };
4099
4112
 
4100
- // src/hooks/Fetches/useA4DataView.tsx
4101
- var import_react19 = require("react");
4102
- var import_react_to_print = require("react-to-print");
4113
+ // src/hooks/useLogin.tsx
4114
+ var import_react19 = __toESM(require("react"));
4115
+ var import_react_hook_form7 = require("react-hook-form");
4116
+ var import_zod = require("@hookform/resolvers/zod");
4117
+ var z = __toESM(require("zod"));
4118
+
4119
+ // src/components/Login/ThemedLogins.tsx
4103
4120
  var import_lucide_react12 = require("lucide-react");
4121
+ var import_react_router_dom2 = require("react-router-dom");
4104
4122
  var import_jsx_runtime28 = require("react/jsx-runtime");
4123
+ var TechLogin = ({
4124
+ form,
4125
+ onSubmit,
4126
+ image,
4127
+ title,
4128
+ subtitle,
4129
+ brandName,
4130
+ backUrl,
4131
+ isLoading
4132
+ }) => {
4133
+ const navigate = (0, import_react_router_dom2.useNavigate)();
4134
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex h-screen w-full overflow-hidden bg-white dark:bg-[#0A0B10]", children: [
4135
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "hidden lg:flex lg:w-3/5 relative overflow-hidden bg-slate-900 border-r border-slate-800", children: [
4136
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4137
+ "div",
4138
+ {
4139
+ className: "absolute inset-0 z-0 opacity-60 bg-cover bg-center transition-transform hover:scale-110 duration-[20s]",
4140
+ style: { backgroundImage: `url('${image || "/tech_bg.png"}')` }
4141
+ }
4142
+ ),
4143
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "absolute inset-0 bg-linear-to-tr from-[#0A0B10] via-transparent to-purple-500/10 z-10" }),
4144
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "relative z-20 p-12 flex flex-col justify-between w-full h-full", children: [
4145
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-3", children: [
4146
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "h-10 w-10 bg-indigo-600 rounded-lg flex items-center justify-center shadow-[0_0_20px_rgba(79,70,229,0.5)]", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.Terminal, { className: "text-white w-6 h-6" }) }),
4147
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-2xl font-bold text-white tracking-widest uppercase", children: brandName || "DevNode" })
4148
+ ] }),
4149
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "max-w-md", children: [
4150
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("h1", { className: "text-5xl font-extrabold text-white mb-6 leading-tight", children: [
4151
+ "Build the ",
4152
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-indigo-400", children: "Future" }),
4153
+ " of Web."
4154
+ ] }),
4155
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-slate-400 text-lg leading-relaxed mb-8", children: "Join thousands of developers building scalable applications with our state-of-the-art infrastructure." })
4156
+ ] }),
4157
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "text-slate-500 text-sm", children: [
4158
+ "\xA9 2026 ",
4159
+ brandName || "DevNode",
4160
+ "."
4161
+ ] })
4162
+ ] })
4163
+ ] }),
4164
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "w-full lg:w-2/5 p-8 lg:p-16 flex flex-col justify-center bg-white dark:bg-[#0A0B10] relative transition-colors duration-300", children: [
4165
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "absolute top-4 right-4 z-50 flex items-center gap-2", children: [
4166
+ backUrl && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4167
+ "button",
4168
+ {
4169
+ onClick: () => navigate(backUrl),
4170
+ disabled: isLoading,
4171
+ className: "p-2 rounded-lg text-slate-500 hover:text-indigo-600 hover:bg-slate-100 dark:text-slate-400 dark:hover:text-indigo-400 dark:hover:bg-slate-800 transition-colors flex items-center gap-2 font-medium disabled:opacity-50",
4172
+ children: [
4173
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.ArrowLeft, { size: 18 }),
4174
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-sm", children: "Back" })
4175
+ ]
4176
+ }
4177
+ ),
4178
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ThemeToggle, {})
4179
+ ] }),
4180
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "max-w-md w-full mx-auto relative z-10", children: [
4181
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "mb-12", children: [
4182
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h2", { className: "text-3xl font-bold text-slate-900 dark:text-white mb-3 tracking-tight", children: title || "Welcome Back" }),
4183
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-slate-500 dark:text-slate-400", children: subtitle || "Please enter your credentials to access your dashboard." })
4184
+ ] }),
4185
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4186
+ "form",
4187
+ {
4188
+ onSubmit: form.handleSubmit((d) => onSubmit(d, form)),
4189
+ className: "space-y-6",
4190
+ children: [
4191
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4192
+ Fields_default.Input,
4193
+ {
4194
+ form,
4195
+ name: "email",
4196
+ label: "Email Address",
4197
+ type: "email",
4198
+ disabled: isLoading,
4199
+ placeholder: "maoo@example.com",
4200
+ icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4201
+ import_lucide_react12.Mail,
4202
+ {
4203
+ size: 18,
4204
+ className: "text-slate-400 dark:text-slate-500"
4205
+ }
4206
+ ),
4207
+ className: "bg-slate-50 dark:bg-slate-900/50 border-slate-200 dark:border-slate-800 text-slate-900 dark:text-white h-12"
4208
+ }
4209
+ ),
4210
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4211
+ Fields_default.Input,
4212
+ {
4213
+ form,
4214
+ name: "password",
4215
+ label: "Password",
4216
+ type: "password",
4217
+ disabled: isLoading,
4218
+ placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
4219
+ icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4220
+ import_lucide_react12.Lock,
4221
+ {
4222
+ size: 18,
4223
+ className: "text-slate-400 dark:text-slate-500"
4224
+ }
4225
+ ),
4226
+ className: "bg-slate-50 dark:bg-slate-900/50 border-slate-200 dark:border-slate-800 text-slate-900 dark:text-white h-12"
4227
+ }
4228
+ ),
4229
+ form.formState.errors.root && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-red-500 text-sm font-medium animate-in fade-in slide-in-from-top-1 duration-200", children: form.formState.errors.root.message }),
4230
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4231
+ Button,
4232
+ {
4233
+ type: "submit",
4234
+ isLoading,
4235
+ className: "w-full bg-indigo-600 hover:bg-indigo-500 text-white h-12 font-semibold flex items-center justify-center gap-2",
4236
+ children: [
4237
+ isLoading ? "Logging in..." : "Authenticate Now",
4238
+ !isLoading && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.ArrowRight, { size: 18 })
4239
+ ]
4240
+ }
4241
+ )
4242
+ ]
4243
+ }
4244
+ )
4245
+ ] })
4246
+ ] })
4247
+ ] });
4248
+ };
4249
+ var TravelLogin = ({
4250
+ form,
4251
+ onSubmit,
4252
+ image,
4253
+ title,
4254
+ subtitle,
4255
+ brandName,
4256
+ backUrl,
4257
+ isLoading
4258
+ }) => {
4259
+ const navigate = (0, import_react_router_dom2.useNavigate)();
4260
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex h-screen w-full overflow-hidden bg-white dark:bg-slate-950 transition-colors", children: [
4261
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "hidden lg:flex lg:w-1/2 relative overflow-hidden bg-slate-100 border-r border-slate-100", children: [
4262
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4263
+ "div",
4264
+ {
4265
+ className: "absolute inset-0 z-0 bg-cover bg-center transition-transform hover:scale-105 duration-[30s]",
4266
+ style: { backgroundImage: `url('${image || "/travel_bg.png"}')` }
4267
+ }
4268
+ ),
4269
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "absolute inset-0 bg-linear-to-br from-orange-500/20 via-transparent to-black/30 z-10" }),
4270
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "relative z-20 p-16 flex flex-col justify-between w-full h-full text-white", children: [
4271
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-3", children: [
4272
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "h-10 w-10 bg-orange-500 rounded-full flex items-center justify-center shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.Plane, { className: "text-white w-6 h-6 rotate-45" }) }),
4273
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-2xl font-bold tracking-tight", children: brandName || "Wanderlust" })
4274
+ ] }),
4275
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "max-w-md", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("h1", { className: "text-6xl font-black mb-8 leading-[1.1]", children: [
4276
+ "Your Next ",
4277
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-orange-400", children: "Adventure" }),
4278
+ " ",
4279
+ "Starts Now."
4280
+ ] }) }),
4281
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "text-white/70 text-sm", children: [
4282
+ "Discover the world with ",
4283
+ brandName || "Wanderlust",
4284
+ "."
4285
+ ] })
4286
+ ] })
4287
+ ] }),
4288
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "w-full lg:w-1/2 p-10 lg:p-24 flex flex-col justify-center bg-white dark:bg-slate-950 relative transition-colors", children: [
4289
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "absolute top-4 right-4 z-50 flex items-center gap-2", children: [
4290
+ backUrl && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4291
+ "button",
4292
+ {
4293
+ onClick: () => navigate(backUrl),
4294
+ disabled: isLoading,
4295
+ className: "p-2 rounded-lg text-slate-500 hover:text-orange-600 hover:bg-slate-100 dark:text-slate-400 dark:hover:text-orange-400 dark:hover:bg-slate-800 transition-colors flex items-center gap-2 font-medium disabled:opacity-50",
4296
+ children: [
4297
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.ArrowLeft, { size: 18 }),
4298
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-sm", children: "Back" })
4299
+ ]
4300
+ }
4301
+ ),
4302
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ThemeToggle, {})
4303
+ ] }),
4304
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "max-w-md w-full mx-auto relative z-10", children: [
4305
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "mb-12 text-center lg:text-left", children: [
4306
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h2", { className: "text-4xl font-bold text-slate-900 dark:text-white mb-4 tracking-tight", children: title || "Login to Explore" }),
4307
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-slate-500 dark:text-slate-400 text-lg", children: subtitle || "Enter your details to access your travel dashboard." })
4308
+ ] }),
4309
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4310
+ "form",
4311
+ {
4312
+ onSubmit: form.handleSubmit((d) => onSubmit(d, form)),
4313
+ className: "space-y-6",
4314
+ children: [
4315
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4316
+ Fields_default.Input,
4317
+ {
4318
+ form,
4319
+ name: "email",
4320
+ label: "Email Address",
4321
+ type: "email",
4322
+ disabled: isLoading,
4323
+ placeholder: "traveler@world.com",
4324
+ icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4325
+ import_lucide_react12.Mail,
4326
+ {
4327
+ size: 18,
4328
+ className: "text-slate-400 dark:text-slate-500"
4329
+ }
4330
+ ),
4331
+ className: "bg-slate-50 dark:bg-slate-900/50 border-slate-200 dark:border-slate-800 text-slate-900 dark:text-white h-14 rounded-xl"
4332
+ }
4333
+ ),
4334
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4335
+ Fields_default.Input,
4336
+ {
4337
+ form,
4338
+ name: "password",
4339
+ label: "Password",
4340
+ type: "password",
4341
+ disabled: isLoading,
4342
+ placeholder: "Secret journey phrase",
4343
+ icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4344
+ import_lucide_react12.Lock,
4345
+ {
4346
+ size: 18,
4347
+ className: "text-slate-400 dark:text-slate-500"
4348
+ }
4349
+ ),
4350
+ className: "bg-slate-50 dark:bg-slate-900/50 border-slate-200 dark:border-slate-800 text-slate-900 dark:text-white h-14 rounded-xl"
4351
+ }
4352
+ ),
4353
+ form.formState.errors.root && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-orange-600 dark:text-orange-400 text-sm font-bold text-center lg:text-left animate-in fade-in slide-in-from-top-1 duration-200", children: form.formState.errors.root.message }),
4354
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4355
+ Button,
4356
+ {
4357
+ type: "submit",
4358
+ isLoading,
4359
+ className: "w-full bg-orange-500 hover:bg-orange-600 text-white h-14 rounded-xl font-bold text-lg flex items-center justify-center gap-2 transition-all",
4360
+ children: [
4361
+ isLoading ? "Logging in..." : "Start Journey",
4362
+ !isLoading && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.Plane, { size: 20, className: "rotate-45" })
4363
+ ]
4364
+ }
4365
+ )
4366
+ ]
4367
+ }
4368
+ )
4369
+ ] })
4370
+ ] })
4371
+ ] });
4372
+ };
4373
+ var HealthcareLogin = ({
4374
+ form,
4375
+ onSubmit,
4376
+ image,
4377
+ title,
4378
+ subtitle,
4379
+ brandName,
4380
+ backUrl,
4381
+ isLoading
4382
+ }) => {
4383
+ const navigate = (0, import_react_router_dom2.useNavigate)();
4384
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex h-screen w-full overflow-hidden bg-[#F0F7FF] dark:bg-slate-950 transition-colors", children: [
4385
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "w-full lg:w-[450px] flex flex-col justify-center bg-white dark:bg-slate-900 shadow-2xl z-30 relative px-10 lg:px-14 transition-colors", children: [
4386
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "absolute top-4 right-4 z-50 flex items-center gap-2", children: [
4387
+ backUrl && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4388
+ "button",
4389
+ {
4390
+ onClick: () => navigate(backUrl),
4391
+ disabled: isLoading,
4392
+ className: "p-2 rounded-lg text-slate-500 hover:text-blue-600 hover:bg-slate-100 dark:text-slate-400 dark:hover:text-blue-400 dark:hover:bg-slate-800 transition-colors flex items-center gap-2 font-medium disabled:opacity-50",
4393
+ children: [
4394
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.ArrowLeft, { size: 18 }),
4395
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-sm font-semibold", children: "Back" })
4396
+ ]
4397
+ }
4398
+ ),
4399
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ThemeToggle, {})
4400
+ ] }),
4401
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "max-w-[340px] w-full mx-auto", children: [
4402
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "mb-14", children: [
4403
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-3 mb-8", children: [
4404
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "h-12 w-12 bg-blue-600 rounded-xl flex items-center justify-center shadow-md shadow-blue-200 dark:shadow-blue-900/20", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.HeartPulse, { className: "text-white w-7 h-7" }) }),
4405
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-2xl font-bold text-slate-800 dark:text-white tracking-tight", children: brandName || "CarePoint" })
4406
+ ] }),
4407
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h2", { className: "text-3xl font-bold text-slate-800 dark:text-white mb-3 tracking-tight", children: title || "Clinical Login" }),
4408
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-slate-500 dark:text-slate-400 font-medium leading-relaxed", children: subtitle || "Secure access for staff and healthcare professionals." })
4409
+ ] }),
4410
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4411
+ "form",
4412
+ {
4413
+ onSubmit: form.handleSubmit((d) => onSubmit(d, form)),
4414
+ className: "space-y-7",
4415
+ children: [
4416
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4417
+ Fields_default.Input,
4418
+ {
4419
+ form,
4420
+ name: "email",
4421
+ label: "Employee Email",
4422
+ type: "email",
4423
+ disabled: isLoading,
4424
+ placeholder: "dr.name@carepoint.org",
4425
+ icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.Mail, { size: 18, className: "text-blue-500" }),
4426
+ className: "bg-slate-50/50 dark:bg-slate-800/50 border-slate-200 dark:border-slate-700 text-slate-900 dark:text-white h-13 rounded-lg border-2"
4427
+ }
4428
+ ),
4429
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4430
+ Fields_default.Input,
4431
+ {
4432
+ form,
4433
+ name: "password",
4434
+ label: "Staff Password",
4435
+ type: "password",
4436
+ disabled: isLoading,
4437
+ placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
4438
+ icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.Lock, { size: 18, className: "text-blue-500" }),
4439
+ className: "bg-slate-50/50 dark:bg-slate-800/50 border-slate-200 dark:border-slate-700 text-slate-900 dark:text-white h-13 rounded-lg border-2"
4440
+ }
4441
+ ),
4442
+ form.formState.errors.root && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-red-600 dark:text-red-400 text-sm font-bold animate-in fade-in slide-in-from-top-1 duration-200", children: form.formState.errors.root.message }),
4443
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4444
+ Button,
4445
+ {
4446
+ type: "submit",
4447
+ isLoading,
4448
+ className: "w-full bg-blue-600 hover:bg-blue-700 text-white h-13 rounded-lg font-bold flex items-center justify-center gap-2 transition-all shadow-lg active:translate-y-0.5",
4449
+ children: [
4450
+ isLoading ? "Logging in..." : "Secure Login",
4451
+ !isLoading && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.MonitorCheck, { size: 18 })
4452
+ ]
4453
+ }
4454
+ )
4455
+ ]
4456
+ }
4457
+ )
4458
+ ] })
4459
+ ] }),
4460
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "hidden lg:flex flex-1 relative overflow-hidden bg-slate-900", children: [
4461
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4462
+ "div",
4463
+ {
4464
+ className: "absolute inset-0 z-0 bg-cover bg-center brightness-110",
4465
+ style: { backgroundImage: `url('${image || "/medicine_bg.png"}')` }
4466
+ }
4467
+ ),
4468
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "absolute inset-0 bg-linear-to-l from-transparent via-blue-900/10 to-blue-900/40 z-10" }),
4469
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "relative z-20 p-20 flex flex-col items-center justify-center w-full h-full text-center", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "max-w-2xl bg-white/20 backdrop-blur-xl border border-white/30 p-12 rounded-[40px] shadow-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("h1", { className: "text-5xl font-black text-white mb-6 leading-tight drop-shadow-sm", children: [
4470
+ "Next-Gen ",
4471
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("br", {}),
4472
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-blue-100", children: "Patient Management" })
4473
+ ] }) }) })
4474
+ ] })
4475
+ ] });
4476
+ };
4477
+ var ThemedLogin = (props) => {
4478
+ switch (props.theme) {
4479
+ case "tech":
4480
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TechLogin, { ...props });
4481
+ case "travel":
4482
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TravelLogin, { ...props });
4483
+ case "healthcare":
4484
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(HealthcareLogin, { ...props });
4485
+ default:
4486
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TechLogin, { ...props });
4487
+ }
4488
+ };
4489
+
4490
+ // src/hooks/useLogin.tsx
4491
+ var import_jsx_runtime29 = require("react/jsx-runtime");
4492
+ var defaultLoginSchema = z.object({
4493
+ email: z.string().email("Invalid email address"),
4494
+ password: z.string().min(1, "Password is required")
4495
+ });
4496
+ var useLogin = (props) => {
4497
+ const form = (0, import_react_hook_form7.useForm)({
4498
+ resolver: (0, import_zod.zodResolver)(props.schema || defaultLoginSchema),
4499
+ defaultValues: props.defaultValues || {
4500
+ email: "",
4501
+ password: ""
4502
+ }
4503
+ });
4504
+ const propsRef = import_react19.default.useRef(props);
4505
+ propsRef.current = props;
4506
+ const Login = import_react19.default.useMemo(() => {
4507
+ const StableLogin = () => {
4508
+ const currentProps = propsRef.current;
4509
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4510
+ ThemedLogin,
4511
+ {
4512
+ form,
4513
+ onSubmit: currentProps.onSubmit,
4514
+ theme: currentProps.theme,
4515
+ image: currentProps.image,
4516
+ brandName: currentProps.brandName,
4517
+ title: currentProps.title,
4518
+ subtitle: currentProps.subtitle,
4519
+ backUrl: currentProps.backUrl,
4520
+ isLoading: currentProps.isLoading
4521
+ }
4522
+ );
4523
+ };
4524
+ return StableLogin;
4525
+ }, [form]);
4526
+ return {
4527
+ form,
4528
+ Login
4529
+ };
4530
+ };
4531
+
4532
+ // src/components/ProfileDropdown.tsx
4533
+ var import_react20 = require("react");
4534
+ var import_jsx_runtime30 = require("react/jsx-runtime");
4535
+ var ProfileDropdown = ({
4536
+ name,
4537
+ image,
4538
+ items,
4539
+ className,
4540
+ triggerMode = "click",
4541
+ size = "md"
4542
+ }) => {
4543
+ const [isOpen, setIsOpen] = (0, import_react20.useState)(false);
4544
+ const dropdownRef = (0, import_react20.useRef)(null);
4545
+ const [loadingItems, setLoadingItems] = (0, import_react20.useState)({});
4546
+ const sizeConfigs = {
4547
+ sm: {
4548
+ avatar: "h-8 w-8",
4549
+ initials: "text-base",
4550
+ container: "gap-2 px-2 py-1.5",
4551
+ name: "text-xs",
4552
+ role: "text-[8px]"
4553
+ },
4554
+ md: {
4555
+ avatar: "h-10 w-10",
4556
+ initials: "text-lg",
4557
+ container: "gap-3 px-3 py-2",
4558
+ name: "text-sm",
4559
+ role: "text-[10px]"
4560
+ },
4561
+ lg: {
4562
+ avatar: "h-12 w-12",
4563
+ initials: "text-xl",
4564
+ container: "gap-4 px-4 py-2.5",
4565
+ name: "text-base",
4566
+ role: "text-[12px]"
4567
+ }
4568
+ };
4569
+ const currentSize = sizeConfigs[size];
4570
+ (0, import_react20.useEffect)(() => {
4571
+ const handleClickOutside = (event) => {
4572
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
4573
+ setIsOpen(false);
4574
+ }
4575
+ };
4576
+ if (isOpen) {
4577
+ document.addEventListener("mousedown", handleClickOutside);
4578
+ }
4579
+ return () => {
4580
+ document.removeEventListener("mousedown", handleClickOutside);
4581
+ };
4582
+ }, [isOpen]);
4583
+ const toggleDropdown = () => setIsOpen(!isOpen);
4584
+ const openDropdown = () => triggerMode === "hover" && setIsOpen(true);
4585
+ const closeDropdown = () => triggerMode === "hover" && setIsOpen(false);
4586
+ const handleItemClick = async (item, index) => {
4587
+ if (item.disabled || loadingItems[index]) return;
4588
+ if (item.onClick) {
4589
+ const result = item.onClick();
4590
+ if (result instanceof Promise) {
4591
+ setLoadingItems((prev) => ({ ...prev, [index]: true }));
4592
+ try {
4593
+ await result;
4594
+ } finally {
4595
+ setLoadingItems((prev) => ({ ...prev, [index]: false }));
4596
+ setIsOpen(false);
4597
+ }
4598
+ } else {
4599
+ setIsOpen(false);
4600
+ }
4601
+ } else {
4602
+ setIsOpen(false);
4603
+ }
4604
+ };
4605
+ const fallbackInitial = name ? name.charAt(0).toUpperCase() : "?";
4606
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
4607
+ "div",
4608
+ {
4609
+ ref: dropdownRef,
4610
+ className: cn("relative inline-block text-left ", className),
4611
+ onMouseEnter: openDropdown,
4612
+ onMouseLeave: closeDropdown,
4613
+ children: [
4614
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
4615
+ "button",
4616
+ {
4617
+ type: "button",
4618
+ onClick: triggerMode === "click" ? toggleDropdown : void 0,
4619
+ className: cn(
4620
+ "flex items-center rounded-xl transition-all duration-200 hover:bg-gray-100 dark:hover:bg-white/5 group focus:outline-none cursor-pointer",
4621
+ currentSize.container
4622
+ ),
4623
+ children: [
4624
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4625
+ "div",
4626
+ {
4627
+ className: cn(
4628
+ "relative overflow-hidden rounded-full ring-2 ring-transparent group-hover:ring-blue-500/30 transition-all duration-300 shadow-sm border border-gray-100 dark:border-white/10 flex items-center justify-center bg-blue-50 dark:bg-blue-900/20",
4629
+ currentSize.avatar
4630
+ ),
4631
+ children: image ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4632
+ "img",
4633
+ {
4634
+ src: image,
4635
+ alt: name,
4636
+ className: "h-full w-full object-cover"
4637
+ }
4638
+ ) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4639
+ "span",
4640
+ {
4641
+ className: cn(
4642
+ "text-blue-600 dark:text-blue-400 font-semibold",
4643
+ currentSize.initials
4644
+ ),
4645
+ children: fallbackInitial
4646
+ }
4647
+ )
4648
+ }
4649
+ ),
4650
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col items-start mr-1", children: [
4651
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4652
+ "span",
4653
+ {
4654
+ className: cn(
4655
+ "font-semibold text-gray-700 dark:text-gray-200 leading-tight",
4656
+ currentSize.name
4657
+ ),
4658
+ children: name
4659
+ }
4660
+ ),
4661
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4662
+ "span",
4663
+ {
4664
+ className: cn(
4665
+ "text-gray-500 dark:text-gray-400 uppercase tracking-wider font-medium",
4666
+ currentSize.role
4667
+ ),
4668
+ children: "Account"
4669
+ }
4670
+ )
4671
+ ] }),
4672
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4673
+ "svg",
4674
+ {
4675
+ className: cn(
4676
+ "h-4 w-4 text-gray-400 transition-transform duration-300",
4677
+ isOpen && "rotate-180"
4678
+ ),
4679
+ fill: "none",
4680
+ viewBox: "0 0 24 24",
4681
+ stroke: "currentColor",
4682
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4683
+ "path",
4684
+ {
4685
+ strokeLinecap: "round",
4686
+ strokeLinejoin: "round",
4687
+ strokeWidth: 2,
4688
+ d: "M19 9l-7 7-7-7"
4689
+ }
4690
+ )
4691
+ }
4692
+ )
4693
+ ]
4694
+ }
4695
+ ),
4696
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "absolute right-0 top-full pt-2 w-64 origin-top-right z-50 group-data-[state=open]:animate-in group-data-[state=closed]:animate-out fade-in zoom-in duration-200", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "rounded-2xl bg-white dark:bg-gray-900 shadow-2xl ring-1 ring-black/5 dark:ring-white/10 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "py-2", children: items.map((item, index) => {
4697
+ const isLoading = loadingItems[index];
4698
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
4699
+ "button",
4700
+ {
4701
+ onClick: () => handleItemClick(item, index),
4702
+ disabled: item.disabled || isLoading,
4703
+ className: cn(
4704
+ "flex w-full items-center gap-3 px-4 py-3 text-sm transition-all duration-150",
4705
+ "text-gray-700 dark:text-gray-200",
4706
+ !item.disabled && !isLoading ? "hover:bg-blue-50/50 dark:hover:bg-blue-900/10 active:bg-blue-100 dark:active:bg-blue-900/20" : "opacity-40 cursor-not-allowed grayscale",
4707
+ item.className
4708
+ ),
4709
+ children: [
4710
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "flex-shrink-0 flex items-center justify-center w-5 h-5", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(LoadingSpin, { size: "sm", className: "text-blue-500" }) : item.icon }),
4711
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "flex-grow text-left font-medium", children: item.label })
4712
+ ]
4713
+ },
4714
+ index
4715
+ );
4716
+ }) }) }) })
4717
+ ]
4718
+ }
4719
+ );
4720
+ };
4721
+
4722
+ // src/hooks/Fetches/useA4DataView.tsx
4723
+ var import_react21 = require("react");
4724
+ var import_react_to_print = require("react-to-print");
4725
+ var import_lucide_react13 = require("lucide-react");
4726
+ var import_jsx_runtime31 = require("react/jsx-runtime");
4105
4727
  var useA4StatementView = ({
4106
4728
  url,
4107
4729
  v = 1,
@@ -4110,7 +4732,7 @@ var useA4StatementView = ({
4110
4732
  startPage = 1
4111
4733
  } = {}) => {
4112
4734
  const { data: apiData, isLoading, get, error: apiError } = useApis_default();
4113
- const contentRef = (0, import_react19.useRef)(null);
4735
+ const contentRef = (0, import_react21.useRef)(null);
4114
4736
  const reactToPrintFn = (0, import_react_to_print.useReactToPrint)({
4115
4737
  contentRef
4116
4738
  });
@@ -4120,7 +4742,7 @@ var useA4StatementView = ({
4120
4742
  await get({ url, v, params, delay });
4121
4743
  }
4122
4744
  };
4123
- (0, import_react19.useEffect)(() => {
4745
+ (0, import_react21.useEffect)(() => {
4124
4746
  getData();
4125
4747
  }, [url, v, JSON.stringify(params), delay]);
4126
4748
  const A4DataViewComponent = ({
@@ -4151,12 +4773,12 @@ var useA4StatementView = ({
4151
4773
  }) => {
4152
4774
  const { store } = useWarqadConfig();
4153
4775
  const isActuallyLoading = externalLoading ?? isLoading;
4154
- const measureContainerRef = (0, import_react19.useRef)(null);
4155
- const [pages, setPages] = (0, import_react19.useState)([]);
4156
- const [isMeasuring, setIsMeasuring] = (0, import_react19.useState)(true);
4157
- const [globalFilter, setGlobalFilter] = (0, import_react19.useState)("");
4158
- const [currentPageIndex, setCurrentPageIndex] = (0, import_react19.useState)(0);
4159
- const [pageSearch, setPageSearch] = (0, import_react19.useState)("");
4776
+ const measureContainerRef = (0, import_react21.useRef)(null);
4777
+ const [pages, setPages] = (0, import_react21.useState)([]);
4778
+ const [isMeasuring, setIsMeasuring] = (0, import_react21.useState)(true);
4779
+ const [globalFilter, setGlobalFilter] = (0, import_react21.useState)("");
4780
+ const [currentPageIndex, setCurrentPageIndex] = (0, import_react21.useState)(0);
4781
+ const [pageSearch, setPageSearch] = (0, import_react21.useState)("");
4160
4782
  const displayColumnsForSearch = columns.filter((col) => !col.hide);
4161
4783
  const filteredDisplayData = data.filter((row) => {
4162
4784
  if (!globalFilter) return true;
@@ -4172,20 +4794,20 @@ var useA4StatementView = ({
4172
4794
  const columnsWithFooters = columns.filter(
4173
4795
  (col) => col.renderFooter && !col.hide
4174
4796
  );
4175
- const DisplayFinalTotalEl = columnsWithFooters.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4797
+ const DisplayFinalTotalEl = columnsWithFooters.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4176
4798
  "div",
4177
4799
  {
4178
4800
  id: "a4-final-total",
4179
4801
  className: "mt-6 flex flex-wrap justify-end items-center pt-4 border-t border-black dark:border-zinc-700 print:border-black gap-4",
4180
4802
  children: [
4181
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "text-black dark:text-white print:text-black font-bold uppercase tracking-widest text-xs mr-auto", children: "Grand Totals" }),
4182
- columnsWithFooters.map((col, idx) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4803
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "text-black dark:text-white print:text-black font-bold uppercase tracking-widest text-xs mr-auto", children: "Grand Totals" }),
4804
+ columnsWithFooters.map((col, idx) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4183
4805
  "div",
4184
4806
  {
4185
4807
  className: "flex items-center gap-3 px-4 py-2 rounded-md border border-black dark:border-zinc-700 print:border-black",
4186
4808
  children: [
4187
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold uppercase tracking-widest text-xs", children: typeof col.header === "string" ? col.header : typeof col.key === "string" ? col.key : "Total" }),
4188
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "text-base font-bold font-sans tabular-nums text-black dark:text-white print:text-black", children: col.renderFooter(filteredDisplayData) })
4809
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold uppercase tracking-widest text-xs", children: typeof col.header === "string" ? col.header : typeof col.key === "string" ? col.key : "Total" }),
4810
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "text-base font-bold font-sans tabular-nums text-black dark:text-white print:text-black", children: col.renderFooter(filteredDisplayData) })
4189
4811
  ]
4190
4812
  },
4191
4813
  col.key || idx
@@ -4201,7 +4823,7 @@ var useA4StatementView = ({
4201
4823
  renderFooter: c.renderFooter ? c.renderFooter.toString() : ""
4202
4824
  }))
4203
4825
  });
4204
- (0, import_react19.useEffect)(() => {
4826
+ (0, import_react21.useEffect)(() => {
4205
4827
  if (filteredDisplayData && filteredDisplayData.length > 0) {
4206
4828
  setIsMeasuring(true);
4207
4829
  setPages((prev) => prev.length === 0 ? [[]] : prev);
@@ -4216,7 +4838,7 @@ var useA4StatementView = ({
4216
4838
  setCurrentPageIndex(0);
4217
4839
  }
4218
4840
  }, [depsString]);
4219
- (0, import_react19.useEffect)(() => {
4841
+ (0, import_react21.useEffect)(() => {
4220
4842
  if (!isMeasuring || filteredDisplayData.length === 0) return;
4221
4843
  const timer = setTimeout(() => {
4222
4844
  if (!measureContainerRef.current) return;
@@ -4272,28 +4894,28 @@ var useA4StatementView = ({
4272
4894
  }, 150);
4273
4895
  return () => clearTimeout(timer);
4274
4896
  }, [isMeasuring, depsString]);
4275
- const HeaderEl = /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4897
+ const HeaderEl = /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4276
4898
  "div",
4277
4899
  {
4278
4900
  className: "flex justify-between items-start mb-5 px-8 pt-8",
4279
4901
  id: "a4-header-section",
4280
4902
  children: [
4281
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("section", { children: [
4282
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h1", { className: "text-4xl font-bold text-blue-600 dark:text-blue-500 print:text-blue-600 tracking-tight uppercase", children: title }),
4283
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-gray-500 dark:text-gray-400 print:text-gray-500 mt-1 uppercase text-xs font-semibold tracking-wider", children: subtitle })
4903
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("section", { children: [
4904
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("h1", { className: "text-4xl font-bold text-blue-600 dark:text-blue-500 print:text-blue-600 tracking-tight uppercase", children: title }),
4905
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-gray-500 dark:text-gray-400 print:text-gray-500 mt-1 uppercase text-xs font-semibold tracking-wider", children: subtitle })
4284
4906
  ] }) }) }),
4285
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "text-right", children: [
4286
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h2", { className: "text-lg font-bold text-gray-800 dark:text-gray-100 print:text-gray-800", children: store?.name }),
4287
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "text-sm text-gray-500 dark:text-gray-400 print:text-gray-500 leading-relaxed text-right flex flex-col items-end", children: [
4288
- store?.address && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "whitespace-pre-line", children: store.address }),
4289
- store?.phone && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: store.phone }),
4290
- store?.email && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: store.email })
4907
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "text-right", children: [
4908
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("h2", { className: "text-lg font-bold text-gray-800 dark:text-gray-100 print:text-gray-800", children: store?.name }),
4909
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "text-sm text-gray-500 dark:text-gray-400 print:text-gray-500 leading-relaxed text-right flex flex-col items-end", children: [
4910
+ store?.address && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "whitespace-pre-line", children: store.address }),
4911
+ store?.phone && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: store.phone }),
4912
+ store?.email && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: store.email })
4291
4913
  ] })
4292
4914
  ] })
4293
4915
  ]
4294
4916
  }
4295
4917
  );
4296
- const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { id: "a4-info-grid", className: "px-8", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4918
+ const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { id: "a4-info-grid", className: "px-8", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4297
4919
  InfoGrid,
4298
4920
  {
4299
4921
  className: "mb-4",
@@ -4301,29 +4923,29 @@ var useA4StatementView = ({
4301
4923
  isLoading: isActuallyLoading
4302
4924
  }
4303
4925
  ) }) : null;
4304
- const statusOverlay = isActuallyLoading || error || !data || data.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex flex-col relative w-full items-center justify-center py-12 min-h-[400px]", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col items-center justify-center p-8 bg-gray-50/50 dark:bg-zinc-900/30 rounded-2xl border border-dashed border-gray-300 dark:border-zinc-700 w-full max-w-lg text-center shadow-sm", children: [
4305
- isActuallyLoading ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ClassicSpin, {}) }) : error ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-14 h-14 bg-red-100 dark:bg-red-500/10 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.AlertCircle, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.FileX, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
4306
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h3", { className: "text-lg font-bold text-gray-900 dark:text-white mb-2", children: isActuallyLoading ? "Loading data..." : error ? "Failed to Load Statement" : "No Records Found" }),
4307
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-xs mb-6 leading-relaxed", children: isActuallyLoading ? "Please wait while we prepare your statement." : error ? typeof error === "string" ? error : "An unexpected error occurred while fetching the statement data." : "There are no transactions or records available in this requested statement." }),
4308
- url && !isActuallyLoading && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4926
+ const statusOverlay = isActuallyLoading || error || !data || data.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex flex-col relative w-full items-center justify-center py-12 min-h-[400px]", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col items-center justify-center p-8 bg-gray-50/50 dark:bg-zinc-900/30 rounded-2xl border border-dashed border-gray-300 dark:border-zinc-700 w-full max-w-lg text-center shadow-sm", children: [
4927
+ isActuallyLoading ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ClassicSpin, {}) }) : error ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "w-14 h-14 bg-red-100 dark:bg-red-500/10 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react13.AlertCircle, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react13.FileX, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
4928
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("h3", { className: "text-lg font-bold text-gray-900 dark:text-white mb-2", children: isActuallyLoading ? "Loading data..." : error ? "Failed to Load Statement" : "No Records Found" }),
4929
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-xs mb-6 leading-relaxed", children: isActuallyLoading ? "Please wait while we prepare your statement." : error ? typeof error === "string" ? error : "An unexpected error occurred while fetching the statement data." : "There are no transactions or records available in this requested statement." }),
4930
+ url && !isActuallyLoading && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4309
4931
  "button",
4310
4932
  {
4311
4933
  onClick: () => getData(),
4312
4934
  className: "flex items-center gap-2 px-5 py-2 bg-black dark:bg-white text-white dark:text-black font-semibold rounded-lg shadow-md hover:bg-gray-800 dark:hover:bg-gray-100 transition-all active:scale-95 text-sm",
4313
4935
  children: [
4314
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.RefreshCw, { size: 14 }),
4936
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react13.RefreshCw, { size: 14 }),
4315
4937
  "Try Again"
4316
4938
  ]
4317
4939
  }
4318
4940
  )
4319
4941
  ] }) }) : null;
4320
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col relative w-full items-center", children: [
4321
- isMeasuring && filteredDisplayData.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "absolute top-0 opacity-0 pointer-events-none -left-full", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4942
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col relative w-full items-center", children: [
4943
+ isMeasuring && filteredDisplayData.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "absolute top-0 opacity-0 pointer-events-none -left-full", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4322
4944
  "div",
4323
4945
  {
4324
4946
  style: { width: "210mm", boxSizing: "border-box" },
4325
4947
  className: "bg-white",
4326
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4948
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4327
4949
  "div",
4328
4950
  {
4329
4951
  ref: measureContainerRef,
@@ -4331,9 +4953,9 @@ var useA4StatementView = ({
4331
4953
  children: [
4332
4954
  HeaderEl,
4333
4955
  DisplayInfoGridEl,
4334
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "grow w-full px-8 pb-8", children: [
4335
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mb-4 border-b border-gray-200 dark:border-zinc-800 print:border-gray-200 pb-2 flex items-center gap-2 justify-between px-2 mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h3", { className: "text-sm font-bold text-gray-800 dark:text-gray-100 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }) }),
4336
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4956
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "grow w-full px-8 pb-8", children: [
4957
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "mb-4 border-b border-gray-200 dark:border-zinc-800 print:border-gray-200 pb-2 flex items-center gap-2 justify-between px-2 mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("h3", { className: "text-sm font-bold text-gray-800 dark:text-gray-100 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }) }),
4958
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4337
4959
  SimpleTable,
4338
4960
  {
4339
4961
  columns,
@@ -4351,52 +4973,52 @@ var useA4StatementView = ({
4351
4973
  )
4352
4974
  }
4353
4975
  ) }),
4354
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "py-2 px-0 md:px-4 w-full", ref: contentRef, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex flex-col gap-8 print:block print:gap-0 w-full items-center", children: pages.map((pageData, pageIndex) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4976
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "py-2 px-0 md:px-4 w-full", ref: contentRef, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex flex-col gap-8 print:block print:gap-0 w-full items-center", children: pages.map((pageData, pageIndex) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4355
4977
  "div",
4356
4978
  {
4357
4979
  className: pageIndex === currentPageIndex ? "w-full" : "hidden print:block w-full",
4358
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4980
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4359
4981
  PageA4,
4360
4982
  {
4361
4983
  className: "w-full",
4362
4984
  pageNumber: pageIndex + 1,
4363
4985
  totalPages: pages.length,
4364
4986
  isLastPage: pageIndex === pages.length - 1,
4365
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col h-full grow w-full", children: [
4366
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("header", { className: "flex justify-between gap-2 items-center px-8 pt-4 print:hidden", children: [
4987
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col h-full grow w-full", children: [
4988
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("header", { className: "flex justify-between gap-2 items-center px-8 pt-4 print:hidden", children: [
4367
4989
  headers,
4368
- printable && pageIndex === currentPageIndex && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex items-center justify-end ", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2", children: [
4369
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4990
+ printable && pageIndex === currentPageIndex && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex items-center justify-end ", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2", children: [
4991
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4370
4992
  "button",
4371
4993
  {
4372
4994
  onClick: async () => await getData(),
4373
4995
  disabled: isLoading,
4374
4996
  className: "flex items-center gap-2 px-3 py-1.5 text-gray-600 dark:text-gray-300 hover:text-black dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-all disabled:opacity-50",
4375
4997
  children: [
4376
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4377
- import_lucide_react12.RefreshCw,
4998
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4999
+ import_lucide_react13.RefreshCw,
4378
5000
  {
4379
5001
  size: 16,
4380
5002
  className: isLoading ? "animate-spin" : ""
4381
5003
  }
4382
5004
  ),
4383
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-xs font-semibold", children: "Reload" })
5005
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-xs font-semibold", children: "Reload" })
4384
5006
  ]
4385
5007
  }
4386
5008
  ),
4387
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
5009
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4388
5010
  "button",
4389
5011
  {
4390
5012
  onClick: () => reactToPrintFn(),
4391
5013
  className: "flex items-center gap-2 px-4 py-1.5 bg-black dark:bg-zinc-800 text-white rounded-md text-xs font-bold shadow-sm hover:bg-zinc-800 dark:hover:bg-zinc-700 transition-all active:scale-95",
4392
5014
  children: [
4393
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.Printer, { size: 16 }),
5015
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react13.Printer, { size: 16 }),
4394
5016
  "Print"
4395
5017
  ]
4396
5018
  }
4397
5019
  ),
4398
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1.5 ml-2 pl-2 border-l border-gray-200 dark:border-zinc-700", children: [
4399
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5020
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-1.5 ml-2 pl-2 border-l border-gray-200 dark:border-zinc-700", children: [
5021
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4400
5022
  "button",
4401
5023
  {
4402
5024
  onClick: (e) => {
@@ -4407,11 +5029,11 @@ var useA4StatementView = ({
4407
5029
  },
4408
5030
  disabled: currentPageIndex === 0,
4409
5031
  className: "p-1 rounded hover:bg-gray-100 dark:hover:bg-zinc-800 disabled:opacity-30 transition-colors text-gray-600 dark:text-gray-400",
4410
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.ChevronLeft, { size: 18 })
5032
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react13.ChevronLeft, { size: 18 })
4411
5033
  }
4412
5034
  ),
4413
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1 text-[11px] font-bold tabular-nums", children: [
4414
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
5035
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-1 text-[11px] font-bold tabular-nums", children: [
5036
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4415
5037
  Select,
4416
5038
  {
4417
5039
  value: currentPageIndex + 1,
@@ -4424,9 +5046,9 @@ var useA4StatementView = ({
4424
5046
  variant: "ghost",
4425
5047
  containerClassName: "inline-block",
4426
5048
  children: [
4427
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SelectTrigger, { className: "h-7 px-2 min-w-[40px] border border-gray-200 dark:border-zinc-700 rounded flex items-center justify-center bg-white dark:bg-zinc-900 hover:bg-gray-100 dark:hover:bg-zinc-800 transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-gray-900 dark:text-white", children: currentPageIndex + 1 }) }),
4428
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(SelectContent, { className: "min-w-[100px] max-h-64 overflow-y-auto p-0", children: [
4429
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "p-2 border-b border-gray-100 dark:border-zinc-800 sticky top-0 bg-white dark:bg-zinc-950 z-10", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5049
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(SelectTrigger, { className: "h-7 px-2 min-w-[40px] border border-gray-200 dark:border-zinc-700 rounded flex items-center justify-center bg-white dark:bg-zinc-900 hover:bg-gray-100 dark:hover:bg-zinc-800 transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-gray-900 dark:text-white", children: currentPageIndex + 1 }) }),
5050
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(SelectContent, { className: "min-w-[100px] max-h-64 overflow-y-auto p-0", children: [
5051
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "p-2 border-b border-gray-100 dark:border-zinc-800 sticky top-0 bg-white dark:bg-zinc-950 z-10", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4430
5052
  "input",
4431
5053
  {
4432
5054
  type: "text",
@@ -4438,17 +5060,17 @@ var useA4StatementView = ({
4438
5060
  autoFocus: true
4439
5061
  }
4440
5062
  ) }),
4441
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "p-1", children: pages.map((_, i) => i + 1).filter(
5063
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "p-1", children: pages.map((_, i) => i + 1).filter(
4442
5064
  (p) => String(p).includes(pageSearch)
4443
- ).map((p) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SelectItem, { value: p, children: p }, p)) })
5065
+ ).map((p) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(SelectItem, { value: p, children: p }, p)) })
4444
5066
  ] })
4445
5067
  ]
4446
5068
  }
4447
5069
  ),
4448
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-gray-400 mx-0.5", children: "/" }),
4449
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-gray-600 dark:text-gray-400", children: pages.length })
5070
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-gray-400 mx-0.5", children: "/" }),
5071
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-gray-600 dark:text-gray-400", children: pages.length })
4450
5072
  ] }),
4451
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5073
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4452
5074
  "button",
4453
5075
  {
4454
5076
  onClick: (e) => {
@@ -4459,7 +5081,7 @@ var useA4StatementView = ({
4459
5081
  },
4460
5082
  disabled: currentPageIndex === pages.length - 1,
4461
5083
  className: "p-1 rounded hover:bg-gray-100 dark:hover:bg-zinc-800 disabled:opacity-30 transition-colors text-gray-600 dark:text-gray-400",
4462
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.ChevronRight, { size: 18 })
5084
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react13.ChevronRight, { size: 18 })
4463
5085
  }
4464
5086
  )
4465
5087
  ] })
@@ -4467,10 +5089,10 @@ var useA4StatementView = ({
4467
5089
  ] }),
4468
5090
  pageIndex === 0 && HeaderEl,
4469
5091
  pageIndex === 0 && DisplayInfoGridEl,
4470
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "grow w-full px-8 pb-8", children: [
4471
- pageIndex === 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "mb-4 border-b border-gray-200 dark:border-zinc-700 print:border-gray-200 pb-2 flex items-center gap-2 justify-between px-2 mt-2 print:hidden", children: [
4472
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h3", { className: "text-sm font-bold text-gray-800 dark:text-gray-100 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }),
4473
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5092
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "grow w-full px-8 pb-8", children: [
5093
+ pageIndex === 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "mb-4 border-b border-gray-200 dark:border-zinc-700 print:border-gray-200 pb-2 flex items-center gap-2 justify-between px-2 mt-2 print:hidden", children: [
5094
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("h3", { className: "text-sm font-bold text-gray-800 dark:text-gray-100 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }),
5095
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4474
5096
  "input",
4475
5097
  {
4476
5098
  type: "text",
@@ -4481,9 +5103,9 @@ var useA4StatementView = ({
4481
5103
  }
4482
5104
  )
4483
5105
  ] }),
4484
- pageIndex === 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "hidden print:flex mb-4 border-b border-gray-200 print:border-gray-200 pb-2 items-center gap-2 justify-between px-2 mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h3", { className: "text-sm font-bold text-gray-800 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }) }),
4485
- pageIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "h-7 print:h-0" }),
4486
- statusOverlay ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "px-8 pb-8", children: statusOverlay }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5106
+ pageIndex === 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "hidden print:flex mb-4 border-b border-gray-200 print:border-gray-200 pb-2 items-center gap-2 justify-between px-2 mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("h3", { className: "text-sm font-bold text-gray-800 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }) }),
5107
+ pageIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "h-7 print:h-0" }),
5108
+ statusOverlay ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "px-8 pb-8", children: statusOverlay }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4487
5109
  SimpleTable,
4488
5110
  {
4489
5111
  columns,
@@ -4519,10 +5141,10 @@ var useA4StatementView = ({
4519
5141
  var useA4DataView_default = useA4StatementView;
4520
5142
 
4521
5143
  // src/hooks/Fetches/useA4CategoryView.tsx
4522
- var import_react20 = require("react");
5144
+ var import_react22 = require("react");
4523
5145
  var import_react_to_print2 = require("react-to-print");
4524
- var import_lucide_react13 = require("lucide-react");
4525
- var import_jsx_runtime29 = require("react/jsx-runtime");
5146
+ var import_lucide_react14 = require("lucide-react");
5147
+ var import_jsx_runtime32 = require("react/jsx-runtime");
4526
5148
  var useA4CategoryView = ({
4527
5149
  url,
4528
5150
  v = 1,
@@ -4531,7 +5153,7 @@ var useA4CategoryView = ({
4531
5153
  startPage = 1
4532
5154
  } = {}) => {
4533
5155
  const { data: apiData, isLoading, get, error: apiError } = useApis_default();
4534
- const contentRef = (0, import_react20.useRef)(null);
5156
+ const contentRef = (0, import_react22.useRef)(null);
4535
5157
  const reactToPrintFn = (0, import_react_to_print2.useReactToPrint)({
4536
5158
  contentRef
4537
5159
  });
@@ -4540,7 +5162,7 @@ var useA4CategoryView = ({
4540
5162
  await get({ url, v, params, delay });
4541
5163
  }
4542
5164
  };
4543
- (0, import_react20.useEffect)(() => {
5165
+ (0, import_react22.useEffect)(() => {
4544
5166
  getData();
4545
5167
  }, [url, v, JSON.stringify(params), delay]);
4546
5168
  const A4CategoryView = ({
@@ -4559,12 +5181,12 @@ var useA4CategoryView = ({
4559
5181
  }) => {
4560
5182
  const { store } = useWarqadConfig();
4561
5183
  const isActuallyLoading = externalLoading ?? isLoading;
4562
- const measureContainerRef = (0, import_react20.useRef)(null);
4563
- const [pages, setPages] = (0, import_react20.useState)([]);
4564
- const [isMeasuring, setIsMeasuring] = (0, import_react20.useState)(true);
4565
- const [globalFilter, setGlobalFilter] = (0, import_react20.useState)("");
4566
- const [currentPageIndex, setCurrentPageIndex] = (0, import_react20.useState)(0);
4567
- const [pageSearch, setPageSearch] = (0, import_react20.useState)("");
5184
+ const measureContainerRef = (0, import_react22.useRef)(null);
5185
+ const [pages, setPages] = (0, import_react22.useState)([]);
5186
+ const [isMeasuring, setIsMeasuring] = (0, import_react22.useState)(true);
5187
+ const [globalFilter, setGlobalFilter] = (0, import_react22.useState)("");
5188
+ const [currentPageIndex, setCurrentPageIndex] = (0, import_react22.useState)(0);
5189
+ const [pageSearch, setPageSearch] = (0, import_react22.useState)("");
4568
5190
  const groups = incomingGroups ? [...incomingGroups].sort(
4569
5191
  (a, b) => a.title.localeCompare(b.title)
4570
5192
  ) : data ? [{ title: gridTitle, items: data }] : [];
@@ -4595,7 +5217,7 @@ var useA4CategoryView = ({
4595
5217
  gridColumns,
4596
5218
  globalFilter
4597
5219
  });
4598
- (0, import_react20.useEffect)(() => {
5220
+ (0, import_react22.useEffect)(() => {
4599
5221
  if (flattenedNodes.length > 0) {
4600
5222
  setIsMeasuring(true);
4601
5223
  setPages((prev) => prev.length === 0 ? [[]] : prev);
@@ -4608,7 +5230,7 @@ var useA4CategoryView = ({
4608
5230
  setCurrentPageIndex(0);
4609
5231
  }
4610
5232
  }, [depsString]);
4611
- (0, import_react20.useEffect)(() => {
5233
+ (0, import_react22.useEffect)(() => {
4612
5234
  if (!isMeasuring || flattenedNodes.length === 0) return;
4613
5235
  const timer = setTimeout(() => {
4614
5236
  if (!measureContainerRef.current) return;
@@ -4647,28 +5269,28 @@ var useA4CategoryView = ({
4647
5269
  }, 150);
4648
5270
  return () => clearTimeout(timer);
4649
5271
  }, [isMeasuring, depsString]);
4650
- const HeaderEl = /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
5272
+ const HeaderEl = /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
4651
5273
  "div",
4652
5274
  {
4653
5275
  className: "flex justify-between items-start mb-5 px-8 pt-8",
4654
5276
  id: "a4-header-section",
4655
5277
  children: [
4656
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("section", { children: [
4657
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("h1", { className: "text-4xl font-black text-black dark:text-white print:text-black tracking-tighter uppercase", children: title }),
4658
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-gray-600 dark:text-gray-400 print:text-gray-600 mt-1 uppercase text-xs font-bold tracking-widest", children: subtitle })
5278
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("section", { children: [
5279
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("h1", { className: "text-4xl font-black text-black dark:text-white print:text-black tracking-tighter uppercase", children: title }),
5280
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-gray-600 dark:text-gray-400 print:text-gray-600 mt-1 uppercase text-xs font-bold tracking-widest", children: subtitle })
4659
5281
  ] }) }) }),
4660
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "text-right", children: [
4661
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("h2", { className: "text-lg font-black text-black dark:text-white print:text-black uppercase tracking-tight", children: store?.name }),
4662
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "text-sm text-gray-600 dark:text-gray-400 print:text-gray-600 leading-relaxed text-right flex flex-col items-end font-medium", children: [
4663
- store?.address && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "whitespace-pre-line", children: store.address }),
4664
- store?.phone && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: store.phone }),
4665
- store?.email && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: store.email })
5282
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "text-right", children: [
5283
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("h2", { className: "text-lg font-black text-black dark:text-white print:text-black uppercase tracking-tight", children: store?.name }),
5284
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "text-sm text-gray-600 dark:text-gray-400 print:text-gray-600 leading-relaxed text-right flex flex-col items-end font-medium", children: [
5285
+ store?.address && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "whitespace-pre-line", children: store.address }),
5286
+ store?.phone && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: store.phone }),
5287
+ store?.email && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: store.email })
4666
5288
  ] })
4667
5289
  ] })
4668
5290
  ]
4669
5291
  }
4670
5292
  );
4671
- const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { id: "a4-info-grid", className: "px-8", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5293
+ const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { id: "a4-info-grid", className: "px-8", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4672
5294
  InfoGrid,
4673
5295
  {
4674
5296
  className: "mb-4",
@@ -4678,40 +5300,40 @@ var useA4CategoryView = ({
4678
5300
  ) }) : null;
4679
5301
  const renderNode = (node) => {
4680
5302
  if (node.type === "header") {
4681
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "mb-4 border-b border-black print:border-black pb-2 flex items-center gap-2 justify-between px-2 mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("h3", { className: "text-sm font-black text-black dark:text-white print:text-black uppercase tracking-[0.2em]", children: node.title }) });
5303
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "mb-4 border-b border-black print:border-black pb-2 flex items-center gap-2 justify-between px-2 mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("h3", { className: "text-sm font-black text-black dark:text-white print:text-black uppercase tracking-[0.2em]", children: node.title }) });
4682
5304
  }
4683
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5305
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4684
5306
  "div",
4685
5307
  {
4686
5308
  className: "grid gap-4 px-2",
4687
5309
  style: { gridTemplateColumns: `repeat(${gridColumns}, 1fr)` },
4688
- children: node.items.map((item, j) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: renderItem(item) }, j))
5310
+ children: node.items.map((item, j) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: renderItem(item) }, j))
4689
5311
  }
4690
5312
  );
4691
5313
  };
4692
- const statusOverlay = isActuallyLoading || error || flattenedNodes.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex flex-col relative w-full items-center justify-center py-12 min-h-[400px]", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col items-center justify-center p-8 bg-gray-50/50 dark:bg-zinc-900/30 rounded-2xl border border-dashed border-gray-300 dark:border-zinc-700 w-full max-w-lg text-center shadow-sm", children: [
4693
- isActuallyLoading ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ClassicSpin, {}) }) : error ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "w-14 h-14 bg-red-100 dark:bg-red-500/10 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react13.AlertCircle, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react13.FileX, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
4694
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("h3", { className: "text-lg font-bold text-gray-900 dark:text-white mb-2", children: isActuallyLoading ? "Loading data..." : error ? "Failed to Load Report" : "No Records Found" }),
4695
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-xs mb-6 leading-relaxed", children: isActuallyLoading ? "Please wait while we prepare your report." : error ? typeof error === "string" ? error : "An unexpected error occurred while fetching the data." : "There are no items available in this requested report." }),
4696
- url && !isActuallyLoading && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
5314
+ const statusOverlay = isActuallyLoading || error || flattenedNodes.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex flex-col relative w-full items-center justify-center py-12 min-h-[400px]", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col items-center justify-center p-8 bg-gray-50/50 dark:bg-zinc-900/30 rounded-2xl border border-dashed border-gray-300 dark:border-zinc-700 w-full max-w-lg text-center shadow-sm", children: [
5315
+ isActuallyLoading ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ClassicSpin, {}) }) : error ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "w-14 h-14 bg-red-100 dark:bg-red-500/10 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react14.AlertCircle, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react14.FileX, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
5316
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("h3", { className: "text-lg font-bold text-gray-900 dark:text-white mb-2", children: isActuallyLoading ? "Loading data..." : error ? "Failed to Load Report" : "No Records Found" }),
5317
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-xs mb-6 leading-relaxed", children: isActuallyLoading ? "Please wait while we prepare your report." : error ? typeof error === "string" ? error : "An unexpected error occurred while fetching the data." : "There are no items available in this requested report." }),
5318
+ url && !isActuallyLoading && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
4697
5319
  "button",
4698
5320
  {
4699
5321
  onClick: () => getData(),
4700
5322
  className: "flex items-center gap-2 px-5 py-2 bg-black dark:bg-white text-white dark:text-black font-semibold rounded-lg shadow-md hover:bg-gray-800 dark:hover:bg-gray-100 transition-all active:scale-95 text-sm",
4701
5323
  children: [
4702
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react13.RefreshCw, { size: 14 }),
5324
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react14.RefreshCw, { size: 14 }),
4703
5325
  "Try Again"
4704
5326
  ]
4705
5327
  }
4706
5328
  )
4707
5329
  ] }) }) : null;
4708
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col relative w-full items-center", children: [
4709
- isMeasuring && flattenedNodes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "absolute top-0 opacity-0 pointer-events-none -left-full", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5330
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col relative w-full items-center", children: [
5331
+ isMeasuring && flattenedNodes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "absolute top-0 opacity-0 pointer-events-none -left-full", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4710
5332
  "div",
4711
5333
  {
4712
5334
  style: { width: "210mm", boxSizing: "border-box" },
4713
5335
  className: "bg-white",
4714
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
5336
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
4715
5337
  "div",
4716
5338
  {
4717
5339
  ref: measureContainerRef,
@@ -4719,56 +5341,56 @@ var useA4CategoryView = ({
4719
5341
  children: [
4720
5342
  HeaderEl,
4721
5343
  DisplayInfoGridEl,
4722
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "grow w-full px-8 pb-8", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex flex-col gap-2", children: flattenedNodes.map((node, i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "a4-measure-node", children: renderNode(node) }, i)) }) })
5344
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "grow w-full px-8 pb-8", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex flex-col gap-2", children: flattenedNodes.map((node, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "a4-measure-node", children: renderNode(node) }, i)) }) })
4723
5345
  ]
4724
5346
  }
4725
5347
  )
4726
5348
  }
4727
5349
  ) }),
4728
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "py-2 px-0 md:px-4 w-full", ref: contentRef, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex flex-col gap-8 print:block print:gap-0 w-full items-center", children: pages.map((pageNodes, pageIndex) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5350
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "py-2 px-0 md:px-4 w-full", ref: contentRef, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex flex-col gap-8 print:block print:gap-0 w-full items-center", children: pages.map((pageNodes, pageIndex) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4729
5351
  "div",
4730
5352
  {
4731
5353
  className: pageIndex === currentPageIndex ? "w-full" : "hidden print:block w-full",
4732
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5354
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4733
5355
  PageA4,
4734
5356
  {
4735
5357
  className: "w-full",
4736
5358
  pageNumber: pageIndex + 1,
4737
5359
  totalPages: pages.length,
4738
5360
  isLastPage: pageIndex === pages.length - 1,
4739
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col h-full grow w-full", children: [
4740
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("header", { className: "flex justify-between gap-2 items-center px-8 pt-4 print:hidden", children: printable && pageIndex === currentPageIndex && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-2", children: [
4741
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
5361
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col h-full grow w-full", children: [
5362
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("header", { className: "flex justify-between gap-2 items-center px-8 pt-4 print:hidden", children: printable && pageIndex === currentPageIndex && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-2", children: [
5363
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
4742
5364
  "button",
4743
5365
  {
4744
5366
  onClick: async () => await getData(),
4745
5367
  disabled: isLoading,
4746
5368
  className: "flex items-center gap-2 px-3 py-1.5 text-gray-600 dark:text-gray-300 hover:text-black dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-all disabled:opacity-50",
4747
5369
  children: [
4748
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4749
- import_lucide_react13.RefreshCw,
5370
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5371
+ import_lucide_react14.RefreshCw,
4750
5372
  {
4751
5373
  size: 16,
4752
5374
  className: isLoading ? "animate-spin" : ""
4753
5375
  }
4754
5376
  ),
4755
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-xs font-semibold", children: "Reload" })
5377
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-xs font-semibold", children: "Reload" })
4756
5378
  ]
4757
5379
  }
4758
5380
  ),
4759
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
5381
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
4760
5382
  "button",
4761
5383
  {
4762
5384
  onClick: () => reactToPrintFn(),
4763
5385
  className: "flex items-center gap-2 px-4 py-1.5 bg-black dark:bg-zinc-800 text-white rounded-md text-xs font-bold shadow-sm hover:bg-zinc-800 dark:hover:bg-zinc-700 transition-all active:scale-95",
4764
5386
  children: [
4765
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react13.Printer, { size: 16 }),
5387
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react14.Printer, { size: 16 }),
4766
5388
  "Print"
4767
5389
  ]
4768
5390
  }
4769
5391
  ),
4770
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-1.5 ml-2 pl-2 border-l border-gray-200 dark:border-zinc-700", children: [
4771
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5392
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-1.5 ml-2 pl-2 border-l border-gray-200 dark:border-zinc-700", children: [
5393
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4772
5394
  "button",
4773
5395
  {
4774
5396
  onClick: (e) => {
@@ -4779,11 +5401,11 @@ var useA4CategoryView = ({
4779
5401
  },
4780
5402
  disabled: currentPageIndex === 0,
4781
5403
  className: "p-1 rounded hover:bg-gray-100 dark:hover:bg-zinc-800 disabled:opacity-30 transition-colors text-gray-600 dark:text-gray-400",
4782
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react13.ChevronLeft, { size: 18 })
5404
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react14.ChevronLeft, { size: 18 })
4783
5405
  }
4784
5406
  ),
4785
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-1 text-[11px] font-bold tabular-nums", children: [
4786
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
5407
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-1 text-[11px] font-bold tabular-nums", children: [
5408
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
4787
5409
  Select,
4788
5410
  {
4789
5411
  value: currentPageIndex + 1,
@@ -4796,9 +5418,9 @@ var useA4CategoryView = ({
4796
5418
  variant: "ghost",
4797
5419
  containerClassName: "inline-block",
4798
5420
  children: [
4799
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SelectTrigger, { className: "h-7 px-2 min-w-[40px] border border-gray-200 dark:border-zinc-700 rounded flex items-center justify-center bg-white dark:bg-zinc-900 hover:bg-gray-100 dark:hover:bg-zinc-800 transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-gray-900 dark:text-white", children: currentPageIndex + 1 }) }),
4800
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(SelectContent, { className: "min-w-[100px] max-h-64 overflow-y-auto p-0", children: [
4801
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "p-2 border-b border-gray-100 dark:border-zinc-800 sticky top-0 bg-white dark:bg-zinc-950 z-10", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5421
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SelectTrigger, { className: "h-7 px-2 min-w-[40px] border border-gray-200 dark:border-zinc-700 rounded flex items-center justify-center bg-white dark:bg-zinc-900 hover:bg-gray-100 dark:hover:bg-zinc-800 transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-gray-900 dark:text-white", children: currentPageIndex + 1 }) }),
5422
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(SelectContent, { className: "min-w-[100px] max-h-64 overflow-y-auto p-0", children: [
5423
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "p-2 border-b border-gray-100 dark:border-zinc-800 sticky top-0 bg-white dark:bg-zinc-950 z-10", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4802
5424
  "input",
4803
5425
  {
4804
5426
  type: "text",
@@ -4810,17 +5432,17 @@ var useA4CategoryView = ({
4810
5432
  autoFocus: true
4811
5433
  }
4812
5434
  ) }),
4813
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "p-1", children: pages.map((_, i) => i + 1).filter(
5435
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "p-1", children: pages.map((_, i) => i + 1).filter(
4814
5436
  (p) => String(p).includes(pageSearch)
4815
- ).map((p) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SelectItem, { value: p, children: p }, p)) })
5437
+ ).map((p) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SelectItem, { value: p, children: p }, p)) })
4816
5438
  ] })
4817
5439
  ]
4818
5440
  }
4819
5441
  ),
4820
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-gray-400 mx-0.5", children: "/" }),
4821
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-gray-600 dark:text-gray-400", children: pages.length })
5442
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-gray-400 mx-0.5", children: "/" }),
5443
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-gray-600 dark:text-gray-400", children: pages.length })
4822
5444
  ] }),
4823
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5445
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4824
5446
  "button",
4825
5447
  {
4826
5448
  onClick: (e) => {
@@ -4831,15 +5453,15 @@ var useA4CategoryView = ({
4831
5453
  },
4832
5454
  disabled: currentPageIndex === pages.length - 1,
4833
5455
  className: "p-1 rounded hover:bg-gray-100 dark:hover:bg-zinc-800 disabled:opacity-30 transition-colors text-gray-600 dark:text-gray-400",
4834
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react13.ChevronRight, { size: 18 })
5456
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react14.ChevronRight, { size: 18 })
4835
5457
  }
4836
5458
  )
4837
5459
  ] })
4838
5460
  ] }) }) }),
4839
5461
  pageIndex === 0 && HeaderEl,
4840
5462
  pageIndex === 0 && DisplayInfoGridEl,
4841
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "grow w-full px-8 pb-8", children: [
4842
- pageIndex === 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex items-center justify-end px-2 mt-2 print:hidden mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5463
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "grow w-full px-8 pb-8", children: [
5464
+ pageIndex === 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex items-center justify-end px-2 mt-2 print:hidden mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4843
5465
  "input",
4844
5466
  {
4845
5467
  type: "text",
@@ -4849,8 +5471,8 @@ var useA4CategoryView = ({
4849
5471
  className: "block w-full max-w-xs px-3 py-2 border border-gray-300 rounded-md text-sm shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 dark:bg-zinc-900 dark:border-zinc-700 dark:text-white"
4850
5472
  }
4851
5473
  ) }),
4852
- pageIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "h-14 print:h-14" }),
4853
- statusOverlay ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "px-8 pb-8", children: statusOverlay }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex flex-col gap-2", children: pageNodes.map((node, i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: renderNode(node) }, i)) })
5474
+ pageIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "h-14 print:h-14" }),
5475
+ statusOverlay ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "px-8 pb-8", children: statusOverlay }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex flex-col gap-2", children: pageNodes.map((node, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: renderNode(node) }, i)) })
4854
5476
  ] })
4855
5477
  ] })
4856
5478
  },
@@ -4872,10 +5494,10 @@ var useA4CategoryView = ({
4872
5494
  var useA4CategoryView_default = useA4CategoryView;
4873
5495
 
4874
5496
  // src/hooks/Fetches/useTransaction.tsx
4875
- var import_react21 = require("react");
4876
- var import_lucide_react14 = require("lucide-react");
5497
+ var import_react23 = require("react");
5498
+ var import_lucide_react15 = require("lucide-react");
4877
5499
  var import_moment = __toESM(require("moment"));
4878
- var import_jsx_runtime30 = require("react/jsx-runtime");
5500
+ var import_jsx_runtime33 = require("react/jsx-runtime");
4879
5501
  var useTransaction = ({
4880
5502
  url,
4881
5503
  v = 1,
@@ -4883,7 +5505,7 @@ var useTransaction = ({
4883
5505
  params = {},
4884
5506
  dateFilter = true
4885
5507
  }) => {
4886
- const [date, setDate] = (0, import_react21.useState)(
5508
+ const [date, setDate] = (0, import_react23.useState)(
4887
5509
  (0, import_moment.default)().format("DD/MM/YYYY")
4888
5510
  );
4889
5511
  const dateObj = {};
@@ -4900,7 +5522,7 @@ var useTransaction = ({
4900
5522
  delay
4901
5523
  });
4902
5524
  };
4903
- (0, import_react21.useEffect)(() => {
5525
+ (0, import_react23.useEffect)(() => {
4904
5526
  getData();
4905
5527
  }, [url, v, JSON.stringify(params), delay, date]);
4906
5528
  const TransactionViewComponent = ({
@@ -4927,21 +5549,21 @@ var useTransaction = ({
4927
5549
  createTitle = "Add New",
4928
5550
  ...rest
4929
5551
  }) => {
4930
- const emptyState = !isLoading && (error || !data || data.length === 0) ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5552
+ const emptyState = !isLoading && (error || !data || data.length === 0) ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4931
5553
  "div",
4932
5554
  {
4933
5555
  className: `flex flex-col relative w-full items-center justify-center py-12 min-h-[300px] ${className}`,
4934
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col items-center justify-center p-8 bg-gray-50/50 dark:bg-zinc-900/30 rounded-2xl border border-dashed border-gray-300 dark:border-zinc-700 w-full max-w-lg text-center shadow-sm", children: [
4935
- error ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "w-14 h-14 bg-red-100 dark:bg-red-500/10 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react14.AlertCircle, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react14.FileX, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
4936
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("h3", { className: "text-lg font-bold text-gray-900 dark:text-white mb-2", children: error ? "Failed to Load Data" : "No Records Found" }),
4937
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-xs mb-6 leading-relaxed", children: error ? typeof error === "string" ? error : "An unexpected error occurred while fetching the data." : "There are no transactions or records available to display here." }),
4938
- url && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5556
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col items-center justify-center p-8 bg-gray-50/50 dark:bg-zinc-900/30 rounded-2xl border border-dashed border-gray-300 dark:border-zinc-700 w-full max-w-lg text-center shadow-sm", children: [
5557
+ error ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "w-14 h-14 bg-red-100 dark:bg-red-500/10 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react15.AlertCircle, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react15.FileX, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
5558
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("h3", { className: "text-lg font-bold text-gray-900 dark:text-white mb-2", children: error ? "Failed to Load Data" : "No Records Found" }),
5559
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-xs mb-6 leading-relaxed", children: error ? typeof error === "string" ? error : "An unexpected error occurred while fetching the data." : "There are no transactions or records available to display here." }),
5560
+ url && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4939
5561
  "button",
4940
5562
  {
4941
5563
  onClick: () => getData(),
4942
5564
  className: "flex items-center gap-2 px-5 py-2 bg-black dark:bg-white text-white dark:text-black font-semibold rounded-lg shadow-md hover:bg-gray-800 dark:hover:bg-gray-100 transition-all active:scale-95 text-sm",
4943
5565
  children: [
4944
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react14.RefreshCw, { size: 14 }),
5566
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react15.RefreshCw, { size: 14 }),
4945
5567
  "Try Again"
4946
5568
  ]
4947
5569
  }
@@ -4949,14 +5571,14 @@ var useTransaction = ({
4949
5571
  ] })
4950
5572
  }
4951
5573
  ) : void 0;
4952
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Card, { children: [
4953
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Card.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("header", { className: "flex items-center justify-between gap-4 py-2", children: [
4954
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "space-y-1", children: [
4955
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Card.Title, { children: title }),
4956
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Card.Description, { children: description })
5574
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Card, { children: [
5575
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Card.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("header", { className: "flex items-center justify-between gap-4 py-2", children: [
5576
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "space-y-1", children: [
5577
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Card.Title, { children: title }),
5578
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Card.Description, { children: description })
4957
5579
  ] }),
4958
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("section", { className: "flex gap-2 items-center", children: [
4959
- dateFilter && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5580
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("section", { className: "flex gap-2 items-center", children: [
5581
+ dateFilter && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4960
5582
  Fields_default.DateInput,
4961
5583
  {
4962
5584
  value: date,
@@ -4966,20 +5588,20 @@ var useTransaction = ({
4966
5588
  }
4967
5589
  }
4968
5590
  ),
4969
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5591
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4970
5592
  Button,
4971
5593
  {
4972
5594
  size: "sm",
4973
5595
  className: "rounded-md!",
4974
5596
  onClick: onCreate,
4975
5597
  variant: "primary",
4976
- icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react14.Plus, {}),
5598
+ icon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react15.Plus, {}),
4977
5599
  children: createTitle
4978
5600
  }
4979
5601
  )
4980
5602
  ] })
4981
5603
  ] }) }),
4982
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Card.Content, { className: "space-y-6", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: `w-full ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5604
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Card.Content, { className: "space-y-6", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: `w-full ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4983
5605
  DataTable,
4984
5606
  {
4985
5607
  columns,
@@ -5196,15 +5818,15 @@ var storage = {
5196
5818
  };
5197
5819
 
5198
5820
  // src/hooks/uploads/useAntdImageUpload.tsx
5199
- var import_react24 = require("react");
5821
+ var import_react26 = require("react");
5200
5822
 
5201
5823
  // ../../node_modules/@ant-design/icons/es/components/Context.js
5202
- var import_react22 = require("react");
5203
- var IconContext = /* @__PURE__ */ (0, import_react22.createContext)({});
5824
+ var import_react24 = require("react");
5825
+ var IconContext = /* @__PURE__ */ (0, import_react24.createContext)({});
5204
5826
  var Context_default = IconContext;
5205
5827
 
5206
5828
  // ../../node_modules/@ant-design/icons/es/components/AntdIcon.js
5207
- var React14 = __toESM(require("react"));
5829
+ var React16 = __toESM(require("react"));
5208
5830
  var import_clsx2 = require("clsx");
5209
5831
 
5210
5832
  // ../../node_modules/@ant-design/fast-color/es/presetColors.js
@@ -6051,7 +6673,7 @@ var greyDark = ["#151515", "#1f1f1f", "#2d2d2d", "#393939", "#494949", "#5a5a5a"
6051
6673
  greyDark.primary = greyDark[5];
6052
6674
 
6053
6675
  // ../../node_modules/@ant-design/icons/es/components/IconBase.js
6054
- var React13 = __toESM(require("react"));
6676
+ var React15 = __toESM(require("react"));
6055
6677
 
6056
6678
  // ../../node_modules/@rc-component/util/es/Dom/canUseDom.js
6057
6679
  function canUseDom() {
@@ -6207,17 +6829,17 @@ var preWarningFns = [];
6207
6829
  var preMessage = (fn) => {
6208
6830
  preWarningFns.push(fn);
6209
6831
  };
6210
- function warning(valid, message) {
6832
+ function warning(valid, message2) {
6211
6833
  if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
6212
- const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"), message);
6834
+ const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"), message2);
6213
6835
  if (finalMessage) {
6214
6836
  console.error(`Warning: ${finalMessage}`);
6215
6837
  }
6216
6838
  }
6217
6839
  }
6218
- function note(valid, message) {
6840
+ function note(valid, message2) {
6219
6841
  if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
6220
- const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"), message);
6842
+ const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"), message2);
6221
6843
  if (finalMessage) {
6222
6844
  console.warn(`Note: ${finalMessage}`);
6223
6845
  }
@@ -6226,29 +6848,29 @@ function note(valid, message) {
6226
6848
  function resetWarned() {
6227
6849
  warned = {};
6228
6850
  }
6229
- function call(method, valid, message) {
6230
- if (!valid && !warned[message]) {
6231
- method(false, message);
6232
- warned[message] = true;
6851
+ function call(method, valid, message2) {
6852
+ if (!valid && !warned[message2]) {
6853
+ method(false, message2);
6854
+ warned[message2] = true;
6233
6855
  }
6234
6856
  }
6235
- function warningOnce(valid, message) {
6236
- call(warning, valid, message);
6857
+ function warningOnce(valid, message2) {
6858
+ call(warning, valid, message2);
6237
6859
  }
6238
- function noteOnce(valid, message) {
6239
- call(note, valid, message);
6860
+ function noteOnce(valid, message2) {
6861
+ call(note, valid, message2);
6240
6862
  }
6241
6863
  warningOnce.preMessage = preMessage;
6242
6864
  warningOnce.resetWarned = resetWarned;
6243
6865
  warningOnce.noteOnce = noteOnce;
6244
6866
 
6245
6867
  // ../../node_modules/@ant-design/icons/es/utils.js
6246
- var import_react23 = __toESM(require("react"));
6868
+ var import_react25 = __toESM(require("react"));
6247
6869
  function camelCase(input) {
6248
6870
  return input.replace(/-(.)/g, (match, g) => g.toUpperCase());
6249
6871
  }
6250
- function warning2(valid, message) {
6251
- warningOnce(valid, `[@ant-design/icons] ${message}`);
6872
+ function warning2(valid, message2) {
6873
+ warningOnce(valid, `[@ant-design/icons] ${message2}`);
6252
6874
  }
6253
6875
  function isIconDefinition(target) {
6254
6876
  return typeof target === "object" && typeof target.name === "string" && typeof target.theme === "string" && (typeof target.icon === "object" || typeof target.icon === "function");
@@ -6270,12 +6892,12 @@ function normalizeAttrs(attrs = {}) {
6270
6892
  }
6271
6893
  function generate2(node, key, rootProps) {
6272
6894
  if (!rootProps) {
6273
- return /* @__PURE__ */ import_react23.default.createElement(node.tag, {
6895
+ return /* @__PURE__ */ import_react25.default.createElement(node.tag, {
6274
6896
  key,
6275
6897
  ...normalizeAttrs(node.attrs)
6276
6898
  }, (node.children || []).map((child, index) => generate2(child, `${key}-${node.tag}-${index}`)));
6277
6899
  }
6278
- return /* @__PURE__ */ import_react23.default.createElement(node.tag, {
6900
+ return /* @__PURE__ */ import_react25.default.createElement(node.tag, {
6279
6901
  key,
6280
6902
  ...normalizeAttrs(node.attrs),
6281
6903
  ...rootProps
@@ -6352,7 +6974,7 @@ var useInsertStyles = (eleRef) => {
6352
6974
  csp,
6353
6975
  prefixCls,
6354
6976
  layer
6355
- } = (0, import_react23.useContext)(Context_default);
6977
+ } = (0, import_react25.useContext)(Context_default);
6356
6978
  let mergedStyleStr = iconStyles;
6357
6979
  if (prefixCls) {
6358
6980
  mergedStyleStr = mergedStyleStr.replace(/anticon/g, prefixCls);
@@ -6362,7 +6984,7 @@ var useInsertStyles = (eleRef) => {
6362
6984
  ${mergedStyleStr}
6363
6985
  }`;
6364
6986
  }
6365
- (0, import_react23.useEffect)(() => {
6987
+ (0, import_react25.useEffect)(() => {
6366
6988
  const ele = eleRef.current;
6367
6989
  const shadowRoot = getShadowRoot(ele);
6368
6990
  updateCSS(mergedStyleStr, "@ant-design-icons", {
@@ -6402,7 +7024,7 @@ var IconBase = (props) => {
6402
7024
  secondaryColor,
6403
7025
  ...restProps
6404
7026
  } = props;
6405
- const svgRef = React13.useRef(null);
7027
+ const svgRef = React15.useRef(null);
6406
7028
  let colors = twoToneColorPalette;
6407
7029
  if (primaryColor) {
6408
7030
  colors = {
@@ -6472,7 +7094,7 @@ function _extends() {
6472
7094
  return _extends.apply(this, arguments);
6473
7095
  }
6474
7096
  setTwoToneColor(blue.primary);
6475
- var Icon = /* @__PURE__ */ React14.forwardRef((props, ref) => {
7097
+ var Icon = /* @__PURE__ */ React16.forwardRef((props, ref) => {
6476
7098
  const {
6477
7099
  // affect outter <i>...</i>
6478
7100
  className,
@@ -6489,7 +7111,7 @@ var Icon = /* @__PURE__ */ React14.forwardRef((props, ref) => {
6489
7111
  const {
6490
7112
  prefixCls = "anticon",
6491
7113
  rootClassName
6492
- } = React14.useContext(Context_default);
7114
+ } = React16.useContext(Context_default);
6493
7115
  const classString = (0, import_clsx2.clsx)(rootClassName, prefixCls, {
6494
7116
  [`${prefixCls}-${icon.name}`]: !!icon.name,
6495
7117
  [`${prefixCls}-spin`]: !!spin || icon.name === "loading"
@@ -6503,7 +7125,7 @@ var Icon = /* @__PURE__ */ React14.forwardRef((props, ref) => {
6503
7125
  transform: `rotate(${rotate}deg)`
6504
7126
  } : void 0;
6505
7127
  const [primaryColor, secondaryColor] = normalizeTwoToneColors(twoToneColor);
6506
- return /* @__PURE__ */ React14.createElement("span", _extends({
7128
+ return /* @__PURE__ */ React16.createElement("span", _extends({
6507
7129
  role: "img",
6508
7130
  "aria-label": icon.name
6509
7131
  }, restProps, {
@@ -6511,7 +7133,7 @@ var Icon = /* @__PURE__ */ React14.forwardRef((props, ref) => {
6511
7133
  tabIndex: iconTabIndex,
6512
7134
  onClick,
6513
7135
  className: classString
6514
- }), /* @__PURE__ */ React14.createElement(IconBase_default, {
7136
+ }), /* @__PURE__ */ React16.createElement(IconBase_default, {
6515
7137
  icon,
6516
7138
  primaryColor,
6517
7139
  secondaryColor,
@@ -6526,7 +7148,7 @@ if (process.env.NODE_ENV !== "production") {
6526
7148
  var AntdIcon_default = Icon;
6527
7149
 
6528
7150
  // ../../node_modules/@ant-design/icons/es/icons/PlusOutlined.js
6529
- var React15 = __toESM(require("react"));
7151
+ var React17 = __toESM(require("react"));
6530
7152
 
6531
7153
  // ../../node_modules/@ant-design/icons-svg/es/asn/PlusOutlined.js
6532
7154
  var PlusOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z" } }, { "tag": "path", "attrs": { "d": "M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z" } }] }, "name": "plus", "theme": "outlined" };
@@ -6547,11 +7169,11 @@ function _extends2() {
6547
7169
  };
6548
7170
  return _extends2.apply(this, arguments);
6549
7171
  }
6550
- var PlusOutlined2 = (props, ref) => /* @__PURE__ */ React15.createElement(AntdIcon_default, _extends2({}, props, {
7172
+ var PlusOutlined2 = (props, ref) => /* @__PURE__ */ React17.createElement(AntdIcon_default, _extends2({}, props, {
6551
7173
  ref,
6552
7174
  icon: PlusOutlined_default
6553
7175
  }));
6554
- var RefIcon = /* @__PURE__ */ React15.forwardRef(PlusOutlined2);
7176
+ var RefIcon = /* @__PURE__ */ React17.forwardRef(PlusOutlined2);
6555
7177
  if (process.env.NODE_ENV !== "production") {
6556
7178
  RefIcon.displayName = "PlusOutlined";
6557
7179
  }
@@ -6559,7 +7181,7 @@ var PlusOutlined_default2 = RefIcon;
6559
7181
 
6560
7182
  // src/hooks/uploads/useAntdImageUpload.tsx
6561
7183
  var import_antd2 = require("antd");
6562
- var import_jsx_runtime31 = require("react/jsx-runtime");
7184
+ var import_jsx_runtime34 = require("react/jsx-runtime");
6563
7185
  var getBase64 = (file) => new Promise((resolve, reject) => {
6564
7186
  const reader = new FileReader();
6565
7187
  reader.readAsDataURL(file);
@@ -6567,9 +7189,9 @@ var getBase64 = (file) => new Promise((resolve, reject) => {
6567
7189
  reader.onerror = (error) => reject(error);
6568
7190
  });
6569
7191
  var useAntdImageUpload = ({ length = 1 }) => {
6570
- const [fileList, setFileList] = (0, import_react24.useState)([]);
6571
- const [previewOpen, setPreviewOpen] = (0, import_react24.useState)(false);
6572
- const [previewImage, setPreviewImage] = (0, import_react24.useState)("");
7192
+ const [fileList, setFileList] = (0, import_react26.useState)([]);
7193
+ const [previewOpen, setPreviewOpen] = (0, import_react26.useState)(false);
7194
+ const [previewImage, setPreviewImage] = (0, import_react26.useState)("");
6573
7195
  const handlePreview = async (file) => {
6574
7196
  if (!file.url && !file.preview) {
6575
7197
  file.preview = await getBase64(file.originFileObj);
@@ -6586,8 +7208,8 @@ var useAntdImageUpload = ({ length = 1 }) => {
6586
7208
  }))
6587
7209
  );
6588
7210
  };
6589
- const ImageBox = () => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
6590
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
7211
+ const ImageBox = () => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
7212
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6591
7213
  import_antd2.Upload,
6592
7214
  {
6593
7215
  listType: "picture-card",
@@ -6595,13 +7217,13 @@ var useAntdImageUpload = ({ length = 1 }) => {
6595
7217
  onPreview: handlePreview,
6596
7218
  onChange: handleChange,
6597
7219
  beforeUpload: () => false,
6598
- children: fileList.length >= length ? null : /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("button", { style: { border: 0, background: "none" }, type: "button", children: [
6599
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PlusOutlined_default2, {}),
6600
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { style: { marginTop: 8 }, children: "Upload" })
7220
+ children: fileList.length >= length ? null : /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("button", { style: { border: 0, background: "none" }, type: "button", children: [
7221
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PlusOutlined_default2, {}),
7222
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { style: { marginTop: 8 }, children: "Upload" })
6601
7223
  ] })
6602
7224
  }
6603
7225
  ),
6604
- previewImage && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
7226
+ previewImage && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6605
7227
  import_antd2.Image,
6606
7228
  {
6607
7229
  style: { display: "none" },
@@ -6619,10 +7241,10 @@ var useAntdImageUpload = ({ length = 1 }) => {
6619
7241
  var useAntdImageUpload_default = useAntdImageUpload;
6620
7242
 
6621
7243
  // src/components/Views/CategoryView.tsx
6622
- var import_jsx_runtime32 = require("react/jsx-runtime");
7244
+ var import_jsx_runtime35 = require("react/jsx-runtime");
6623
7245
  var CategoryCard = ({ item }) => {
6624
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "group bg-white rounded-md overflow-hidden border border-black/80 flex flex-col h-full print:border-black transition-all duration-300", children: [
6625
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "relative aspect-square w-full overflow-hidden bg-gray-50 flex-shrink-0 border-b border-black/10", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7246
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "group bg-white rounded-md overflow-hidden border border-black/80 flex flex-col h-full print:border-black transition-all duration-300", children: [
7247
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "relative aspect-square w-full overflow-hidden bg-gray-50 flex-shrink-0 border-b border-black/10", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6626
7248
  "img",
6627
7249
  {
6628
7250
  src: item.image,
@@ -6630,7 +7252,7 @@ var CategoryCard = ({ item }) => {
6630
7252
  className: "w-full h-full object-cover"
6631
7253
  }
6632
7254
  ) }),
6633
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "p-1.5 flex flex-col justify-center flex-grow", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("h3", { className: "text-[10px] font-bold text-black line-clamp-2 leading-tight text-center", children: item.name }) })
7255
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "p-1.5 flex flex-col justify-center flex-grow", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("h3", { className: "text-[10px] font-bold text-black line-clamp-2 leading-tight text-center", children: item.name }) })
6634
7256
  ] });
6635
7257
  };
6636
7258
  var CategoryView = ({
@@ -6638,20 +7260,20 @@ var CategoryView = ({
6638
7260
  items,
6639
7261
  className
6640
7262
  }) => {
6641
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: cn("p-6 bg-gray-50 min-h-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "max-w-7xl mx-auto", children: [
6642
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "mb-8", children: [
6643
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("h2", { className: "text-2xl md:text-3xl font-bold text-gray-900 tracking-tight", children: categoryName }),
6644
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "mt-2 h-1.5 w-16 bg-green-500 rounded-full" })
7263
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: cn("p-6 bg-gray-50 min-h-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "max-w-7xl mx-auto", children: [
7264
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mb-8", children: [
7265
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("h2", { className: "text-2xl md:text-3xl font-bold text-gray-900 tracking-tight", children: categoryName }),
7266
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "mt-2 h-1.5 w-16 bg-green-500 rounded-full" })
6645
7267
  ] }),
6646
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 md:gap-6", children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CategoryCard, { item }, item.id)) })
7268
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 md:gap-6", children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CategoryCard, { item }, item.id)) })
6647
7269
  ] }) });
6648
7270
  };
6649
7271
  var CategoryView_default = CategoryView;
6650
7272
 
6651
7273
  // src/components/Views/Transaction.tsx
6652
- var import_jsx_runtime33 = require("react/jsx-runtime");
7274
+ var import_jsx_runtime36 = require("react/jsx-runtime");
6653
7275
  var Transaction = () => {
6654
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { children: "Transaction" });
7276
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: "Transaction" });
6655
7277
  };
6656
7278
  var Transaction_default = Transaction;
6657
7279
 
@@ -6662,8 +7284,152 @@ var Views = {
6662
7284
  CategoryCard
6663
7285
  };
6664
7286
  var Views_default = Views;
7287
+
7288
+ // src/components/Guard.tsx
7289
+ var import_react27 = require("react");
7290
+ var import_react_router_dom3 = require("react-router-dom");
7291
+ var import_antd3 = require("antd");
7292
+
7293
+ // src/store/useAuthStore.ts
7294
+ var import_zustand = require("zustand");
7295
+ var useAuthStore = (0, import_zustand.create)((set, get) => ({
7296
+ auth: null,
7297
+ account: null,
7298
+ isLoggedIn: false,
7299
+ isFetched: false,
7300
+ setAuth: (auth, account) => set({
7301
+ auth,
7302
+ account,
7303
+ isLoggedIn: true
7304
+ }),
7305
+ setIsLoggedIn: (isLoggedIn) => set({ isLoggedIn }),
7306
+ setIsFetched: (isFetched) => set({ isFetched }),
7307
+ logout: () => set({
7308
+ auth: null,
7309
+ account: null,
7310
+ isLoggedIn: false,
7311
+ isFetched: true
7312
+ }),
7313
+ updateAuth: (data) => set((state) => ({
7314
+ auth: state.auth ? { ...state.auth, ...data } : state.auth
7315
+ })),
7316
+ updateAccount: (data) => set((state) => ({
7317
+ account: state.account ? { ...state.account, ...data } : state.account
7318
+ })),
7319
+ hasPermission: (key) => !!get().auth?.permissions?.[key]
7320
+ }));
7321
+
7322
+ // src/hooks/useAuth.ts
7323
+ var useAuth = () => {
7324
+ const auth = useAuthStore((state) => state.auth);
7325
+ const account = useAuthStore((state) => state.account);
7326
+ const isLoggedIn = useAuthStore((state) => state.isLoggedIn);
7327
+ const isFetched = useAuthStore((state) => state.isFetched);
7328
+ const setIsLoggedIn = useAuthStore((state) => state.setIsLoggedIn);
7329
+ const setIsFetched = useAuthStore((state) => state.setIsFetched);
7330
+ const logout = useAuthStore((state) => state.logout);
7331
+ const setAuth = useAuthStore((state) => state.setAuth);
7332
+ const updateAuth = useAuthStore((state) => state.updateAuth);
7333
+ const updateAccount = useAuthStore((state) => state.updateAccount);
7334
+ const hasPermission = useAuthStore((state) => state.hasPermission);
7335
+ return {
7336
+ // ----- State -----
7337
+ auth,
7338
+ user: auth,
7339
+ // Alias for 'auth'
7340
+ account,
7341
+ isLoggedIn,
7342
+ isFetched,
7343
+ // ----- Shorthand Accessors -----
7344
+ role: auth?.role,
7345
+ userId: auth?._id,
7346
+ accountId: account?._id,
7347
+ userName: account?.name,
7348
+ userEmail: auth?.email || account?.email,
7349
+ permissions: auth?.permissions || {},
7350
+ // ----- Derived Flags -----
7351
+ isAdmin: auth?.role === "admin",
7352
+ isActive: auth?.isActive ?? false,
7353
+ isVerified: !!(auth?.isEmailVerified || auth?.isPhoneVerified),
7354
+ isEmailVerified: auth?.isEmailVerified ?? false,
7355
+ isPhoneVerified: auth?.isPhoneVerified ?? false,
7356
+ // ----- Actions -----
7357
+ logout,
7358
+ setIsLoggedIn,
7359
+ setIsFetched,
7360
+ setAuth,
7361
+ login: (data) => {
7362
+ if (data?.auth && data?.account) {
7363
+ setAuth(data.auth, data.account);
7364
+ } else if (data?.user && data?.account) {
7365
+ setAuth(data.user, data.account);
7366
+ } else {
7367
+ setAuth(data, data?.account || data);
7368
+ }
7369
+ },
7370
+ updateAuth,
7371
+ updateUser: updateAuth,
7372
+ // Alias for 'updateAuth'
7373
+ updateAccount,
7374
+ // ----- Helper Functions -----
7375
+ hasPermission,
7376
+ can: (key) => hasPermission(key)
7377
+ // Shorthand for 'hasPermission'
7378
+ };
7379
+ };
7380
+ var useAuth_default = useAuth;
7381
+
7382
+ // src/components/Guard.tsx
7383
+ var import_jsx_runtime37 = require("react/jsx-runtime");
7384
+ var Guard = () => {
7385
+ const { get } = useApis_default();
7386
+ const location = (0, import_react_router_dom3.useLocation)();
7387
+ const { login, setIsLoggedIn, setIsFetched, isFetched } = useAuth();
7388
+ (0, import_react27.useLayoutEffect)(() => {
7389
+ const fetchProfile = async () => {
7390
+ try {
7391
+ const res = await get({
7392
+ url: "/users/me",
7393
+ v: 1
7394
+ });
7395
+ console.log("res", res);
7396
+ login(res?.data);
7397
+ setIsLoggedIn(true);
7398
+ setIsFetched(true);
7399
+ } catch (error) {
7400
+ console.log(error);
7401
+ setIsFetched(true);
7402
+ setIsLoggedIn(false);
7403
+ }
7404
+ };
7405
+ fetchProfile();
7406
+ }, [location.pathname]);
7407
+ if (!isFetched) {
7408
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "min-h-screen flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(LoadingSpin, { size: "lg" }) });
7409
+ }
7410
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_router_dom3.Outlet, {});
7411
+ };
7412
+ var ProtectedRoute = () => {
7413
+ const { isLoggedIn } = useAuth();
7414
+ const location = (0, import_react_router_dom3.useLocation)();
7415
+ return isLoggedIn ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_router_dom3.Outlet, {}) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_router_dom3.Navigate, { to: "/login", state: { from: location }, replace: true });
7416
+ };
7417
+ var UnProtectedRoute = () => {
7418
+ const { isLoggedIn, user } = useAuth();
7419
+ return !isLoggedIn ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_router_dom3.Outlet, {}) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_router_dom3.Navigate, { to: user?.homePath || "/", replace: true });
7420
+ };
7421
+ var AdminProtectedRoute = () => {
7422
+ const { role } = useAuth();
7423
+ (0, import_react27.useEffect)(() => {
7424
+ if (role && !["admin"].includes(role)) {
7425
+ import_antd3.message.error("Only admin can access this page");
7426
+ }
7427
+ }, [role]);
7428
+ return role && ["admin"].includes(role) ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_router_dom3.Outlet, {}) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_router_dom3.Navigate, { to: "/", replace: true });
7429
+ };
6665
7430
  // Annotate the CommonJS export names for ESM import in node:
6666
7431
  0 && (module.exports = {
7432
+ AdminProtectedRoute,
6667
7433
  Badge,
6668
7434
  Branding,
6669
7435
  Button,
@@ -6680,6 +7446,7 @@ var Views_default = Views;
6680
7446
  DataTable,
6681
7447
  DateInput,
6682
7448
  Fields,
7449
+ Guard,
6683
7450
  InfoGrid,
6684
7451
  Input,
6685
7452
  LoadingBox,
@@ -6690,6 +7457,8 @@ var Views_default = Views;
6690
7457
  PageHeader,
6691
7458
  PhoneInput,
6692
7459
  PostTable,
7460
+ ProfileDropdown,
7461
+ ProtectedRoute,
6693
7462
  SearchApi,
6694
7463
  SearchApiContent,
6695
7464
  SearchApiInput,
@@ -6703,6 +7472,8 @@ var Views_default = Views;
6703
7472
  Textarea,
6704
7473
  ThemeProvider,
6705
7474
  ThemeToggle,
7475
+ ThemedLogin,
7476
+ UnProtectedRoute,
6706
7477
  Views,
6707
7478
  WarqadProvider,
6708
7479
  generatePdf,
@@ -6711,6 +7482,9 @@ var Views_default = Views;
6711
7482
  useA4StatementView,
6712
7483
  useAntdImageUpload,
6713
7484
  useApi,
7485
+ useAuth,
7486
+ useAuthStore,
7487
+ useLogin,
6714
7488
  useModal,
6715
7489
  useSearchApiContext,
6716
7490
  useSelectContext,